diff options
author | Ralph Amissah <ralph@amissah.com> | 2018-06-20 11:42:14 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2019-04-10 15:14:15 -0400 |
commit | b86c91d6136476de3a35e0077db28caccacd816e (patch) | |
tree | 4aad808156bb045eadfc9191d593732832e5de2f /src/sdp/output/epub3.d | |
parent | naming is_of_ (is_ of_) (diff) |
doc object metainfo consolidation
Diffstat (limited to 'src/sdp/output/epub3.d')
-rw-r--r-- | src/sdp/output/epub3.d | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/src/sdp/output/epub3.d b/src/sdp/output/epub3.d index 74856e1..0e864f7 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.typeinfo.is_a == "heading") { - if (obj.node.heading_lev_markup == 4) { + if (obj.metainfo.is_a == "heading") { + if (obj.metainfo.heading_lev_markup == 4) { writefln( "%s~ [%s.xhtml] %s", obj.marked_up_level, obj.tags.segment_anchor_tag, obj.text ); - } else if (obj.node.heading_lev_markup > 4) { + } else if (obj.metainfo.heading_lev_markup > 4) { writefln( "%s~ [%s.xhtml#%s] %s", obj.marked_up_level, obj.tags.segment_anchor_tag, - obj.node.object_number, + obj.metainfo.object_number, obj.text ); } @@ -146,27 +146,27 @@ template outputEPub3() { ); foreach (sect; doc_matters.xml.keys_seq.seg) { foreach (obj; doc_abstraction[sect]) { - if (obj.typeinfo.is_a == "heading") { + if (obj.metainfo.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.node.dom_collapsed[n]) { + switch (obj.metainfo.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.node.heading_lev_markup < 4) { + if (obj.metainfo.heading_lev_markup < 4) { toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "<li>" ~ "\n" ~ markup.indent_by_spaces_provided((n + 2), " ") ~ "<a href=\"" ~ obj.tags.segment_anchor_tag ~ ".xhtml" ~ "\">" ~ _txt ~ "</a>" ~ "\n"; } else { - string hashtag =(obj.node.heading_lev_markup == 4) + string hashtag =(obj.metainfo.heading_lev_markup == 4) ? "" - : ("#" ~ obj.node.ocn.to!string); + : ("#" ~ obj.metainfo.ocn.to!string); toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "<li>" ~ "\n" ~ markup.indent_by_spaces_provided((n + 2), " ") ~ "<a href=\"" ~ obj.tags.segment_anchor_tag ~ ".xhtml" ~ hashtag ~ "\">" @@ -176,16 +176,16 @@ template outputEPub3() { break; case DomTags.open : toc ~= markup.indent_by_spaces_provided(n, " ") ~ "<ol>" ~ "\n"; - if (obj.node.heading_lev_markup < 4) { + if (obj.metainfo.heading_lev_markup < 4) { toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "<li>" ~ "\n" ~ markup.indent_by_spaces_provided((n + 2), " ") ~ "<a href=\"" ~ obj.tags.segment_anchor_tag ~ ".xhtml" ~ "\">" ~ _txt ~ "</a>" ~ "\n"; } else { - string hashtag =(obj.node.heading_lev_markup == 4) + string hashtag =(obj.metainfo.heading_lev_markup == 4) ? "" - : ("#" ~ obj.node.ocn.to!string); + : ("#" ~ obj.metainfo.ocn.to!string); toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "<li>" ~ "\n" ~ markup.indent_by_spaces_provided((n + 2), " ") ~ "<a href=\"" ~ obj.tags.segment_anchor_tag ~ ".xhtml" ~ hashtag ~ "\">" @@ -243,11 +243,11 @@ template outputEPub3() { ); foreach (sect; doc_matters.xml.keys_seq.seg) { foreach (obj; doc_abstraction[sect]) { - if (obj.typeinfo.is_a == "heading") { + if (obj.metainfo.is_a == "heading") { string _txt = obj.text.replaceAll(rgx.inline_notes_al_gen, "").strip; - string hashtag =(obj.node.heading_lev_markup <= 4) ? "" : ("#" ~ obj.node.ocn.to!string); + string hashtag =(obj.metainfo.heading_lev_markup <= 4) ? "" : ("#" ~ obj.metainfo.ocn.to!string); foreach_reverse (k; 0 .. 7) { - switch (obj.node.dom_markedup[k]) { + switch (obj.metainfo.dom_markedup[k]) { case DomTags.close : toc ~= "\n </navPoint>"; 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.typeinfo.is_a == "heading") { + if (obj.metainfo.is_a == "heading") { assert(part == "head" || "toc_seg" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex_seg" || "blurb" || "tail"); - switch (obj.node.heading_lev_markup) { + switch (obj.metainfo.heading_lev_markup) { case 0: .. case 3: /+ fill buffer, and replace with new levels from 1 to 3 +/ - switch (obj.node.heading_lev_markup) { + switch (obj.metainfo.heading_lev_markup) { case 0: top_level_headings[0] = ""; top_level_headings[1] = ""; @@ -357,23 +357,23 @@ template outputEPub3() { break; case 8: .. case 9: if ((doc_matters.opt.action.debug_do)) { - writeln(__FILE__, ":", __LINE__, ": ", obj.typeinfo.is_a, ": ", obj.node.heading_lev_markup); + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup); writeln(__FILE__, ":", __LINE__, ": ", obj.text); } break; default: if ((doc_matters.opt.action.debug_do)) { - writeln(__FILE__, ":", __LINE__, ": ", obj.typeinfo.is_a, ": ", obj.node.heading_lev_markup); + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup); } break; } } else { assert(part == "head" || "toc_seg" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex_seg" || "blurb" || "tail"); - switch (obj.typeinfo.is_of_part) { + switch (obj.metainfo.is_of_part) { case "frontmatter": assert(part == "head" || "toc_seg"); - switch (obj.typeinfo.is_of_type) { + switch (obj.metainfo.is_of_type) { case "para": - switch (obj.typeinfo.is_a) { + switch (obj.metainfo.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.typeinfo.is_a); + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } break; } break; default: if ((doc_matters.opt.action.debug_do)) { - writeln(__FILE__, ":", __LINE__, ": ", obj.typeinfo.is_of_type); + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } break; } break; case "body": assert(part == "body"); - switch (obj.typeinfo.is_of_type) { + switch (obj.metainfo.is_of_type) { case "para": - switch (obj.typeinfo.is_a) { + switch (obj.metainfo.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.typeinfo.is_a); + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } break; } break; case "block": - switch (obj.typeinfo.is_a) { + switch (obj.metainfo.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.typeinfo.is_a); + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } break; } break; default: if ((doc_matters.opt.action.debug_do)) { - writeln(__FILE__, ":", __LINE__, ": ", obj.typeinfo.is_of_type); + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } break; } break; case "backmatter": assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex_seg" || "blurb" || "tail"); - switch (obj.typeinfo.is_of_type) { + switch (obj.metainfo.is_of_type) { case "para": - switch (obj.typeinfo.is_a) { + switch (obj.metainfo.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.typeinfo.is_a); + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } break; } break; default: if ((doc_matters.opt.action.debug_do)) { - writeln(__FILE__, ":", __LINE__, ": ", obj.typeinfo.is_of_type); + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } break; } @@ -501,14 +501,14 @@ template outputEPub3() { break; default: if ((doc_matters.opt.action.debug_do)) { - writeln(__FILE__, ":", __LINE__, ": ", obj.typeinfo.is_of_part); + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part); } break; } } - if (obj.typeinfo.is_a == "heading") { + if (obj.metainfo.is_a == "heading") { assert(obj.text.length > 0); - if (obj.node.heading_lev_markup <= 4) { + if (obj.metainfo.heading_lev_markup <= 4) { oepbs_content_parts["manifest_documents"] ~= format(q"¶ <item id="%s.xhtml" href="%s.xhtml" media-type="application/xhtml+xml" /> ¶", @@ -526,28 +526,28 @@ template outputEPub3() { obj.tags.segment_anchor_tag, obj.tags.segment_anchor_tag, ); - } else if (obj.node.heading_lev_markup > 4) { + } else if (obj.metainfo.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.tags.segment_anchor_tag, - obj.node.object_number, + obj.metainfo.object_number, obj.tags.segment_anchor_tag, - obj.node.object_number, + obj.metainfo.object_number, ); oepbs_content_parts["spine"] ~= format(q"¶ <itemref idref="%s.xhtml#%s" linear="yes" /> ¶", obj.tags.segment_anchor_tag, - obj.node.object_number, + obj.metainfo.object_number, ); oepbs_content_parts["guide"] ~= format(q"¶ <reference type="%s#%s" href="%s#%s" /> ¶", obj.tags.segment_anchor_tag, - obj.node.object_number, + obj.metainfo.object_number, obj.tags.segment_anchor_tag, - obj.node.object_number, + obj.metainfo.object_number, ); } } |