From f5320e4c3a9b21209ad7fd7c089bf144cfb60971 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 28 Apr 2017 12:00:37 -0400 Subject: xml family, special characters, deal with once --- src/sdp/output_epub3.d | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'src/sdp/output_epub3.d') diff --git a/src/sdp/output_epub3.d b/src/sdp/output_epub3.d index ea33f2e..3df1992 100644 --- a/src/sdp/output_epub3.d +++ b/src/sdp/output_epub3.d @@ -273,6 +273,7 @@ template outputEPub3() { string suffix = ".xhtml"; foreach (part; doc_matters.keys_seq.seg) { foreach (obj; doc_abstraction[part]) { + string _txt = xhtml_format.special_characters(obj, obj.text); if (obj.is_a == "heading") { switch (obj.heading_lev_markup) { case 0: .. case 3: @@ -308,12 +309,12 @@ template outputEPub3() { foreach (top_level_heading; top_level_headings) { doc_epub3[segment_filename] ~= top_level_heading; } - auto t = xhtml_format.heading_seg(obj, suffix); + auto t = xhtml_format.heading_seg(obj, _txt, suffix); doc_epub3[segment_filename] ~= t[0]; doc_epub3_endnotes[segment_filename] ~= t[1]; break; case 5: .. case 7: - auto t = xhtml_format.heading_seg(obj, suffix); + auto t = xhtml_format.heading_seg(obj, _txt, suffix); doc_epub3[segment_filename] ~= t[0]; doc_epub3_endnotes[segment_filename] ~= t[1]; break; @@ -336,7 +337,7 @@ template outputEPub3() { case "para": switch (obj.is_a) { case "toc": - doc_epub3[segment_filename] ~= xhtml_format.toc(obj); + doc_epub3[segment_filename] ~= xhtml_format.toc_seg(obj, _txt); break; default: if ((doc_matters.opt_action_bool["debug"])) { @@ -357,7 +358,7 @@ template outputEPub3() { case "para": switch (obj.is_a) { case "para": - auto t = xhtml_format.para_seg(obj, suffix); + auto t = xhtml_format.para_seg(obj, _txt, suffix); doc_epub3[segment_filename] ~= t[0]; doc_epub3_endnotes[segment_filename] ~= t[1]; break; @@ -371,32 +372,32 @@ template outputEPub3() { case "block": switch (obj.is_a) { case "quote": - auto t = xhtml_format.quote_seg(obj, suffix); + auto t = xhtml_format.quote_seg(obj, _txt, suffix); doc_epub3[segment_filename] ~= to!string(t[0]); doc_epub3_endnotes[segment_filename] ~= t[1]; break; case "group": - auto t = xhtml_format.group_seg(obj, suffix); + auto t = xhtml_format.group_seg(obj, _txt, suffix); doc_epub3[segment_filename] ~= to!string(t[0]); doc_epub3_endnotes[segment_filename] ~= t[1]; break; case "block": - auto t = xhtml_format.block_seg(obj, suffix); + auto t = xhtml_format.block_seg(obj, _txt, suffix); doc_epub3[segment_filename] ~= to!string(t[0]); doc_epub3_endnotes[segment_filename] ~= t[1]; break; case "poem": // double check why both poem & verse break; case "verse": - auto t = xhtml_format.verse_seg(obj, suffix); + auto t = xhtml_format.verse_seg(obj, _txt, suffix); doc_epub3[segment_filename] ~= to!string(t[0]); doc_epub3_endnotes[segment_filename] ~= t[1]; break; case "code": - doc_epub3[segment_filename] ~= xhtml_format.code(obj); + doc_epub3[segment_filename] ~= xhtml_format.code(obj, _txt); break; case "table": - auto t = xhtml_format.para_seg(obj, suffix); + auto t = xhtml_format.para_seg(obj, _txt, suffix); doc_epub3[segment_filename] ~= t[0]; doc_epub3_endnotes[segment_filename] ~= t[1]; break; @@ -419,26 +420,26 @@ template outputEPub3() { case "para": switch (obj.is_a) { case "endnote": - auto t = xhtml_format.para_seg(obj, suffix); + auto t = xhtml_format.para_seg(obj, _txt, suffix); doc_epub3[segment_filename] ~= t[0]; break; case "glossary": - auto t = xhtml_format.para_seg(obj, suffix); + auto t = xhtml_format.para_seg(obj, _txt, suffix); doc_epub3[segment_filename] ~= t[0]; doc_epub3_endnotes[segment_filename] ~= t[1]; break; case "bibliography": - auto t = xhtml_format.para_seg(obj, suffix); + auto t = xhtml_format.para_seg(obj, _txt, suffix); doc_epub3[segment_filename] ~= t[0]; doc_epub3_endnotes[segment_filename] ~= t[1]; break; case "bookindex": - auto t = xhtml_format.para_seg(obj, suffix); + auto t = xhtml_format.para_seg(obj, _txt, suffix); doc_epub3[segment_filename] ~= t[0]; doc_epub3_endnotes[segment_filename] ~= t[1]; break; case "blurb": - auto t = xhtml_format.para_seg(obj, suffix); + auto t = xhtml_format.para_seg(obj, _txt, suffix); doc_epub3[segment_filename] ~= t[0]; doc_epub3_endnotes[segment_filename] ~= t[1]; break; -- cgit v1.2.3