diff options
author | Ralph Amissah <ralph@amissah.com> | 2018-06-12 15:38:38 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2019-04-10 15:14:15 -0400 |
commit | 6f8fddb2dfa5faad56af2a0bfd0bf3b694695136 (patch) | |
tree | 6b8af78c4cbb2a7a601de5430f41ab4a93503d67 /src/sdp/output/epub3.d | |
parent | 0.26.2 image(s) without dimensions (diff) |
0.26.3 object info changes
Diffstat (limited to 'src/sdp/output/epub3.d')
-rw-r--r-- | src/sdp/output/epub3.d | 134 |
1 files changed, 67 insertions, 67 deletions
diff --git a/src/sdp/output/epub3.d b/src/sdp/output/epub3.d index 3209fae..18b9986 100644 --- a/src/sdp/output/epub3.d +++ b/src/sdp/output/epub3.d @@ -104,20 +104,20 @@ template outputEPub3() { debug(epubmanifest) { foreach (s; doc_matters.xml.keys_seq.seg) { foreach (obj; doc_abstraction[s]) { - if (obj.is_a == "heading") { - if (obj.heading_lev_markup == 4) { + if (obj.typeinfo.is_a == "heading") { + if (obj.node.heading_lev_markup == 4) { writefln( "%s~ [%s.xhtml] %s", obj.marked_up_level, - obj.segment_anchor_tag, + obj.tags.segment_anchor_tag, obj.text ); - } else if (obj.heading_lev_markup > 4) { + } else if (obj.node.heading_lev_markup > 4) { writefln( "%s~ [%s.xhtml#%s] %s", obj.marked_up_level, - obj.segment_anchor_tag, - obj.obj_cite_number, + obj.tags.segment_anchor_tag, + obj.node.obj_cite_number, obj.text ); } @@ -146,49 +146,49 @@ template outputEPub3() { ); foreach (sect; doc_matters.xml.keys_seq.seg) { foreach (obj; doc_abstraction[sect]) { - if (obj.is_a == "heading") { + if (obj.typeinfo.is_a == "heading") { string _txt = obj.text.replaceAll(rgx.inline_notes_al_gen, "").strip; foreach_reverse (n; 0 .. 7) { string k = n.to!string; - switch (obj.dom_collapsed[n]) { + switch (obj.node.dom_collapsed[n]) { case DomTags.close : toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "</li>" ~ "\n"; toc ~= markup.indent_by_spaces_provided(n, " ") ~ "</ol>" ~ "\n"; break; case DomTags.close_and_open : toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "</li>" ~ "\n"; - if (obj.heading_lev_markup < 4) { + if (obj.node.heading_lev_markup < 4) { toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "<li>" ~ "\n" ~ markup.indent_by_spaces_provided((n + 2), " ") - ~ "<a href=\"" ~ obj.segment_anchor_tag ~ ".xhtml" ~ "\">" + ~ "<a href=\"" ~ obj.tags.segment_anchor_tag ~ ".xhtml" ~ "\">" ~ _txt ~ "</a>" ~ "\n"; } else { - string hashtag =(obj.heading_lev_markup == 4) + string hashtag =(obj.node.heading_lev_markup == 4) ? "" - : ("#" ~ obj.ocn.to!string); + : ("#" ~ obj.node.ocn.to!string); toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "<li>" ~ "\n" ~ markup.indent_by_spaces_provided((n + 2), " ") - ~ "<a href=\"" ~ obj.segment_anchor_tag ~ ".xhtml" ~ hashtag ~ "\">" + ~ "<a href=\"" ~ obj.tags.segment_anchor_tag ~ ".xhtml" ~ hashtag ~ "\">" ~ _txt ~ "</a>" ~ "\n"; } break; case DomTags.open : toc ~= markup.indent_by_spaces_provided(n, " ") ~ "<ol>" ~ "\n"; - if (obj.heading_lev_markup < 4) { + if (obj.node.heading_lev_markup < 4) { toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "<li>" ~ "\n" ~ markup.indent_by_spaces_provided((n + 2), " ") - ~ "<a href=\"" ~ obj.segment_anchor_tag ~ ".xhtml" ~ "\">" + ~ "<a href=\"" ~ obj.tags.segment_anchor_tag ~ ".xhtml" ~ "\">" ~ _txt ~ "</a>" ~ "\n"; } else { - string hashtag =(obj.heading_lev_markup == 4) + string hashtag =(obj.node.heading_lev_markup == 4) ? "" - : ("#" ~ obj.ocn.to!string); + : ("#" ~ obj.node.ocn.to!string); toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "<li>" ~ "\n" ~ markup.indent_by_spaces_provided((n + 2), " ") - ~ "<a href=\"" ~ obj.segment_anchor_tag ~ ".xhtml" ~ hashtag ~ "\">" + ~ "<a href=\"" ~ obj.tags.segment_anchor_tag ~ ".xhtml" ~ hashtag ~ "\">" ~ _txt ~ "</a>" ~ "\n"; } @@ -243,11 +243,11 @@ template outputEPub3() { ); foreach (sect; doc_matters.xml.keys_seq.seg) { foreach (obj; doc_abstraction[sect]) { - if (obj.is_a == "heading") { + if (obj.typeinfo.is_a == "heading") { string _txt = obj.text.replaceAll(rgx.inline_notes_al_gen, "").strip; - string hashtag =(obj.heading_lev_markup <= 4) ? "" : ("#" ~ obj.ocn.to!string); + string hashtag =(obj.node.heading_lev_markup <= 4) ? "" : ("#" ~ obj.node.ocn.to!string); foreach_reverse (k; 0 .. 7) { - switch (obj.dom_markedup[k]) { + switch (obj.node.dom_markedup[k]) { case DomTags.close : toc ~= "\n </navPoint>"; break; @@ -262,7 +262,7 @@ template outputEPub3() { <content src="%s.xhtml%s" />¶", counter, _txt, - obj.segment_anchor_tag, + obj.tags.segment_anchor_tag, hashtag, ); break; @@ -276,7 +276,7 @@ template outputEPub3() { <content src="%s.xhtml%s" />¶", counter, _txt, - obj.segment_anchor_tag, + obj.tags.segment_anchor_tag, hashtag, ); break; @@ -310,12 +310,12 @@ template outputEPub3() { foreach (part; doc_matters.xml.keys_seq.seg) { foreach (obj; doc_abstraction[part]) { string _txt = xhtml_format.special_characters(obj, obj.text); - if (obj.is_a == "heading") { + if (obj.typeinfo.is_a == "heading") { assert(part == "head" || "toc_seg" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex_seg" || "blurb" || "tail"); - switch (obj.heading_lev_markup) { + switch (obj.node.heading_lev_markup) { case 0: .. case 3: /+ fill buffer, and replace with new levels from 1 to 3 +/ - switch (obj.heading_lev_markup) { + switch (obj.node.heading_lev_markup) { case 0: top_level_headings[0] = ""; top_level_headings[1] = ""; @@ -335,16 +335,16 @@ template outputEPub3() { top_level_headings[3] = ""; goto default; default: - doc_parts_ ~= obj.segment_anchor_tag; - doc_epub3[obj.segment_anchor_tag] ~= xhtml_format.epub3_seg_head(doc_matters); + doc_parts_ ~= obj.tags.segment_anchor_tag; + doc_epub3[obj.tags.segment_anchor_tag] ~= xhtml_format.epub3_seg_head(doc_matters); auto t = xhtml_format.heading_seg(obj, _txt, suffix, "epub"); - doc_epub3[obj.segment_anchor_tag] ~= t[0]; - doc_epub3_endnotes[obj.segment_anchor_tag] ~= t[1]; + doc_epub3[obj.tags.segment_anchor_tag] ~= t[0]; + doc_epub3_endnotes[obj.tags.segment_anchor_tag] ~= t[1]; break; } break; case 4: - segment_filename = obj.segment_anchor_tag; + segment_filename = obj.tags.segment_anchor_tag; doc_epub3[segment_filename] ~= xhtml_format.epub3_seg_head(doc_matters); auto t = xhtml_format.heading_seg(obj, _txt, suffix, "epub"); doc_epub3[segment_filename] ~= t[0]; @@ -357,23 +357,23 @@ template outputEPub3() { break; case 8: .. case 9: if ((doc_matters.opt.action.debug_do)) { - writeln(__FILE__, ":", __LINE__, ": ", obj.is_a, ": ", obj.heading_lev_markup); + writeln(__FILE__, ":", __LINE__, ": ", obj.typeinfo.is_a, ": ", obj.node.heading_lev_markup); writeln(__FILE__, ":", __LINE__, ": ", obj.text); } break; default: if ((doc_matters.opt.action.debug_do)) { - writeln(__FILE__, ":", __LINE__, ": ", obj.is_a, ": ", obj.heading_lev_markup); + writeln(__FILE__, ":", __LINE__, ": ", obj.typeinfo.is_a, ": ", obj.node.heading_lev_markup); } break; } } else { assert(part == "head" || "toc_seg" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex_seg" || "blurb" || "tail"); - switch (obj.of_part) { + switch (obj.typeinfo.of_part) { case "frontmatter": assert(part == "head" || "toc_seg"); - switch (obj.is_of) { + switch (obj.typeinfo.is_of) { case "para": - switch (obj.is_a) { + switch (obj.typeinfo.is_a) { case "toc": auto t = xhtml_format.para_seg(obj, _txt, suffix, "epub"); doc_epub3[segment_filename] ~= t[0]; @@ -381,22 +381,22 @@ template outputEPub3() { break; default: if ((doc_matters.opt.action.debug_do)) { - writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); + writeln(__FILE__, ":", __LINE__, ": ", obj.typeinfo.is_a); } break; } break; default: if ((doc_matters.opt.action.debug_do)) { - writeln(__FILE__, ":", __LINE__, ": ", obj.is_of); + writeln(__FILE__, ":", __LINE__, ": ", obj.typeinfo.is_of); } break; } break; case "body": assert(part == "body"); - switch (obj.is_of) { + switch (obj.typeinfo.is_of) { case "para": - switch (obj.is_a) { + switch (obj.typeinfo.is_a) { case "para": auto t = xhtml_format.para_seg(obj, _txt, suffix, "epub"); doc_epub3[segment_filename] ~= t[0]; @@ -404,13 +404,13 @@ template outputEPub3() { break; default: if ((doc_matters.opt.action.debug_do)) { - writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); + writeln(__FILE__, ":", __LINE__, ": ", obj.typeinfo.is_a); } break; } break; case "block": - switch (obj.is_a) { + switch (obj.typeinfo.is_a) { case "quote": auto t = xhtml_format.quote_seg(obj, _txt, suffix, "epub"); doc_epub3[segment_filename] ~= t[0].to!string; @@ -442,23 +442,23 @@ template outputEPub3() { break; default: if ((doc_matters.opt.action.debug_do)) { - writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); + writeln(__FILE__, ":", __LINE__, ": ", obj.typeinfo.is_a); } break; } break; default: if ((doc_matters.opt.action.debug_do)) { - writeln(__FILE__, ":", __LINE__, ": ", obj.is_of); + writeln(__FILE__, ":", __LINE__, ": ", obj.typeinfo.is_of); } break; } break; case "backmatter": assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex_seg" || "blurb" || "tail"); - switch (obj.is_of) { + switch (obj.typeinfo.is_of) { case "para": - switch (obj.is_a) { + switch (obj.typeinfo.is_a) { case "endnote": assert(part == "endnotes"); auto t = xhtml_format.para_seg(obj, _txt, suffix, "epub"); doc_epub3[segment_filename] ~= t[0]; @@ -485,14 +485,14 @@ template outputEPub3() { break; default: if ((doc_matters.opt.action.debug_do)) { - writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); + writeln(__FILE__, ":", __LINE__, ": ", obj.typeinfo.is_a); } break; } break; default: if ((doc_matters.opt.action.debug_do)) { - writeln(__FILE__, ":", __LINE__, ": ", obj.is_of); + writeln(__FILE__, ":", __LINE__, ": ", obj.typeinfo.is_of); } break; } @@ -501,53 +501,53 @@ template outputEPub3() { break; default: if ((doc_matters.opt.action.debug_do)) { - writeln(__FILE__, ":", __LINE__, ": ", obj.of_part); + writeln(__FILE__, ":", __LINE__, ": ", obj.typeinfo.of_part); } break; } } - if (obj.is_a == "heading") { + if (obj.typeinfo.is_a == "heading") { assert(obj.text.length > 0); - if (obj.heading_lev_markup <= 4) { + if (obj.node.heading_lev_markup <= 4) { oepbs_content_parts["manifest_documents"] ~= format(q"¶ <item id="%s.xhtml" href="%s.xhtml" media-type="application/xhtml+xml" /> ¶", - obj.segment_anchor_tag, - obj.segment_anchor_tag, + obj.tags.segment_anchor_tag, + obj.tags.segment_anchor_tag, ); oepbs_content_parts["spine"] ~= format(q"¶ <itemref idref="%s.xhtml" linear="yes" /> ¶", - obj.segment_anchor_tag, + obj.tags.segment_anchor_tag, ); oepbs_content_parts["guide"] ~= format(q"¶ <reference type="%s" href="%s" /> ¶", - obj.segment_anchor_tag, - obj.segment_anchor_tag, + obj.tags.segment_anchor_tag, + obj.tags.segment_anchor_tag, ); - } else if (obj.heading_lev_markup > 4) { + } else if (obj.node.heading_lev_markup > 4) { oepbs_content_parts["manifest_documents"] ~= format(q"¶ <item id="%s.xhtml#%s" href="%s.xhtml#%s" media-type="application/xhtml+xml" /> ¶", - obj.segment_anchor_tag, - obj.obj_cite_number, - obj.segment_anchor_tag, - obj.obj_cite_number, + obj.tags.segment_anchor_tag, + obj.node.obj_cite_number, + obj.tags.segment_anchor_tag, + obj.node.obj_cite_number, ); oepbs_content_parts["spine"] ~= format(q"¶ <itemref idref="%s.xhtml#%s" linear="yes" /> ¶", - obj.segment_anchor_tag, - obj.obj_cite_number, + obj.tags.segment_anchor_tag, + obj.node.obj_cite_number, ); oepbs_content_parts["guide"] ~= format(q"¶ <reference type="%s#%s" href="%s#%s" /> ¶", - obj.segment_anchor_tag, - obj.obj_cite_number, - obj.segment_anchor_tag, - obj.obj_cite_number, + obj.tags.segment_anchor_tag, + obj.node.obj_cite_number, + obj.tags.segment_anchor_tag, + obj.node.obj_cite_number, ); } } |