Try to fix the rest of the hyphen-minuses that should be dashes

This commit is contained in:
Domenic Denicola 2015-05-17 16:38:56 -04:00
commit 601d200c6b

View file

@ -149,7 +149,11 @@ function getBodyXml(chapter, contentEl) {
// Fix use of instead of closing single quote
xml = xml.replace(//g, "");
// Some fixes for dashes; not comprehensive
// There are way too many nonbreaking spaces where they don't belong.
// If they show up three in a row, then let them live. Otherwise, they die.
xml = xml.replace(/([^\xA0])\xA0\xA0?([^\xA0])/g, "$1 $2");
// Fixes dashes
xml = xml.replace(/ /g, "—");
xml = xml.replace(/“-/g, "“—");
xml = xml.replace(/-”/g, "—”");
@ -158,10 +162,8 @@ function getBodyXml(chapter, contentEl) {
xml = xml.replace(/<p>-/g, "<p>—");
xml = xml.replace(/-<\/p>/g, "—</p>");
xml = xml.replace(/\s?\s?\s?\s?/g, "—");
// There are way too many nonbreaking spaces where they don't belong.
// If they show up three in a row, then let them live. Otherwise, they die.
xml = xml.replace(/([^\xA0])\xA0\xA0?([^\xA0])/g, "$1 $2");
xml = xml.replace(/-\s\s?/g, "—");
xml = xml.replace(/\s?\s-/g, "—");
// Fix recurring broken-up <em>s
xml = xml.replace(/<\/em>s/g, "s</em>")