Improve <b> and <strong> placement

This commit is contained in:
Domenic Denicola 2020-10-10 14:08:43 -04:00
commit 84a9540497

View file

@ -200,6 +200,19 @@ function getBodyXML(chapter, contentEl) {
fixQuotesAndApostrophes();
fixEms();
// Similar problems occur in Ward with <b> and <strong> as do in Worm with <em>s
xml = xml.replace(/<b\/>/g, "");
xml = xml.replace(/<b>(\s*<br\/>\s*)<\/b>/g, "$1");
xml = xml.replace(/<strong>(\s*<br\/>\s*)<\/strong>/g, "$1");
xml = xml.replace(/<\/strong>(\s*)<strong>/g, "$1");
xml = xml.replace(/<strong>@<\/strong>/g, "@");
xml = xml.replace(/<br\/>(\s*)<\/strong>/g, "</strong><br/>$1");
xml = xml.replace(/(\s*)<\/strong>/g, "</strong>$1");
// No need for line breaks before paragraph ends
// These often occur with the <br>s inside <b>/<strong> fixed above.
xml = xml.replace(/<br\/>\s*<\/p>/g, "</p>");
// Fix possessive of names ending in "s"
// Note: if the "s" is unvoiced, as in Marquis, then it doesn't get the second "s".
xml = xml.replace(/([^])Judas([^s])/g, "$1Judass$2");
@ -246,7 +259,7 @@ function getBodyXML(chapter, contentEl) {
xml = xml.replace(/<p style="text-align: center;">⊙<\/p>/g, "<hr/>");
xml = xml.replace(/<p style="text-align: center;"><strong>⊙<\/strong><\/p>/g, "<hr/>");
xml = xml.replace(/<p style="text-align: center;"><em><strong>⊙<\/strong><\/em><\/p>/g, "<hr/>");
xml = xml.replace(/<p style="text-align: center;"><strong>⊙<\/strong><strong>⊙<\/strong><\/p>/g, "<hr/>");
xml = xml.replace(/<p style="text-align: center;"><strong>⊙⊙<\/strong><\/p>/g, "<hr/>");
// Fix recurring miscapitalization with questions
xml = xml.replace(/\?”\s\s?She asked/g, "?” she asked");