Skip to content

Commit 42b1bd9

Browse files
committed
Add <u> to the elements that we protect from space-insertion by tidy
1 parent bcca7e6 commit 42b1bd9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/BloomExe/XmlHtmlConverter.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,13 @@ public static XmlDocument GetXmlDomFromHtml(string content, bool includeXmlDecla
4545
content = content.Replace("></span>", ">REMOVEME</span>");
4646
content = content.Replace("></i>", ">REMOVEME</i>");
4747

48-
// It also likes to insert newlines before <b> and <i>, and convert any existing whitespace
48+
// It also likes to insert newlines before <b>, <u>, and <i>, and convert any existing whitespace
4949
// there to a space.
5050
// It probably does the same to embedded <span> elements, too, so we might need a similar fix
5151
// for those if we start using them in persistent data.
5252
content = content.Replace(@"<b>", "REMOVEWHITESPACE<b>");
5353
content = content.Replace(@"<i>", "REMOVEWHITESPACE<i>");
54+
content = content.Replace(@"<u>", "REMOVEWHITESPACE<u>");
5455

5556
// fix for <br></br> tag doubling
5657
content = content.Replace("<br></br>", "<br />");
@@ -94,7 +95,7 @@ public static XmlDocument GetXmlDomFromHtml(string content, bool includeXmlDecla
9495

9596
// The regex here is mainly for the \s as a convenient way to remove whatever whitespace TIDY
9697
// has inserted. It's a fringe benefit that we can use the[bi] to deal with both elements in one replace.
97-
newContents = Regex.Replace(newContents, @"REMOVEWHITESPACE\s*\<([bi])\>", "<$1>");
98+
newContents = Regex.Replace(newContents, @"REMOVEWHITESPACE\s*\<([biu])\>", "<$1>");
9899
dom.LoadXml(newContents);
99100
}
100101
catch (Exception e)

0 commit comments

Comments
 (0)