From a47b0ef98ca7c5c47b81227b06f993609c41c3ff Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 24 Jun 2023 15:22:30 -0400 Subject: ocda, process section rather than part --- src/doc_reform/io_out/epub3.d | 30 +++++++++++------------ src/doc_reform/io_out/html.d | 56 +++++++++++++++++++++---------------------- src/doc_reform/io_out/xmls.d | 14 +++++------ 3 files changed, 50 insertions(+), 50 deletions(-) (limited to 'src/doc_reform/io_out') diff --git a/src/doc_reform/io_out/epub3.d b/src/doc_reform/io_out/epub3.d index 54568ff..7a646fb 100644 --- a/src/doc_reform/io_out/epub3.d +++ b/src/doc_reform/io_out/epub3.d @@ -157,8 +157,8 @@ template outputEPub3() { content ~= " " ~ "" ~ "\n "; content ~= "" ~ ""; debug(epubmanifest) { - foreach (part; doc_matters.has.keys_seq.seg) { // TODO - foreach (obj; doc_abstraction[part]) { + foreach (section; doc_matters.has.keys_seq.seg) { // TODO + foreach (obj; doc_abstraction[section]) { if (obj.metainfo.is_a == "heading") { if (obj.metainfo.heading_lev_markup == 4) { writefln( @@ -321,11 +321,11 @@ template outputEPub3() { string[] doc_parts; } auto epubWrite = writeOut(); - foreach (part; doc_matters.has.keys_seq.seg) { - foreach (obj; doc_abstraction[part]) { + foreach (section; doc_matters.has.keys_seq.seg) { + foreach (obj; doc_abstraction[section]) { string _txt = xhtml_format.special_characters_breaks_indents_bullets(obj); if (obj.metainfo.is_a == "heading") { - assert(part == "head" || "toc" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail"); + assert(section == "head" || "toc" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail"); switch (obj.metainfo.heading_lev_markup) { case 0: .. case 3: /+ fill buffer, and replace with new levels from 1 to 3 +/ @@ -386,10 +386,10 @@ template outputEPub3() { break; } } else { - assert(part == "head" || "toc" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail"); + assert(section == "head" || "toc" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail"); Tuple!(string, string[]) t; switch (obj.metainfo.is_of_part) { - case "frontmatter": assert(part == "head" || "toc"); + case "frontmatter": assert(section == "head" || "toc"); switch (obj.metainfo.is_of_type) { case "para": switch (obj.metainfo.is_a) { @@ -416,7 +416,7 @@ template outputEPub3() { break; } break; - case "body": assert(part == "body"); + case "body": assert(section == "body"); switch (obj.metainfo.is_of_type) { case "para": switch (obj.metainfo.is_a) { @@ -484,35 +484,35 @@ template outputEPub3() { } break; case "backmatter": - assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail"); + assert(section == "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail"); switch (obj.metainfo.is_of_type) { case "para": switch (obj.metainfo.is_a) { - case "endnote": assert(part == "endnotes"); + case "endnote": assert(section == "endnotes"); t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0]; break; - case "glossary": assert(part == "glossary"); + case "glossary": assert(section == "glossary"); t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0]; epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; break; - case "bibliography": assert(part == "bibliography"); + case "bibliography": assert(section == "bibliography"); t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0]; epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; break; - case "bookindex": assert(part == "bookindex"); + case "bookindex": assert(section == "bookindex"); t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0]; epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; break; - case "blurb": assert(part == "blurb"); + case "blurb": assert(section == "blurb"); t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0]; epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; break; - case "tail": assert(part == "tail"); + case "tail": assert(section == "tail"); t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0]; epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; diff --git a/src/doc_reform/io_out/html.d b/src/doc_reform/io_out/html.d index fe7e7a6..0cbf61e 100644 --- a/src/doc_reform/io_out/html.d +++ b/src/doc_reform/io_out/html.d @@ -75,14 +75,14 @@ template outputHTML() { string[] doc_html; string[] doc; string suffix = ".html"; - string previous_part = ""; + string previous_section = ""; string delimit = ""; - foreach (part; doc_matters.has.keys_seq.scroll) { - foreach (obj; doc_abstraction[part]) { - delimit = xhtml_format.div_delimit(part, previous_part); + foreach (section; doc_matters.has.keys_seq.scroll) { + foreach (obj; doc_abstraction[section]) { + delimit = xhtml_format.div_delimit(section, previous_section); string _txt = xhtml_format.special_characters_breaks_indents_bullets(obj); switch (obj.metainfo.is_of_part) { - case "frontmatter": assert(part == "head" || "toc"); + case "frontmatter": assert(section == "head" || "toc"); switch (obj.metainfo.is_of_type) { case "para": switch (obj.metainfo.is_a) { @@ -110,7 +110,7 @@ template outputHTML() { break; } break; - case "body": assert(part == "body" || "head"); + case "body": assert(section == "body" || "head"); switch (obj.metainfo.is_of_type) { case "para": switch (obj.metainfo.is_a) { @@ -170,29 +170,29 @@ template outputHTML() { } break; case "backmatter": - assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail"); + assert(section == "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail"); switch (obj.metainfo.is_of_type) { case "para": switch (obj.metainfo.is_a) { case "heading": doc_html ~= delimit ~ xhtml_format.heading_scroll(_txt, obj, doc_matters, suffix); break; - case "endnote": assert(part == "endnotes"); + case "endnote": assert(section == "endnotes"); doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); break; - case "glossary": assert(part == "glossary"); + case "glossary": assert(section == "glossary"); doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); break; - case "bibliography": assert(part == "bibliography"); + case "bibliography": assert(section == "bibliography"); doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); break; - case "bookindex": assert(part == "bookindex"); + case "bookindex": assert(section == "bookindex"); doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); break; - case "blurb": assert(part == "blurb"); + case "blurb": assert(section == "blurb"); doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); break; - case "tail": assert(part == "tail"); + case "tail": assert(section == "tail"); doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); break; default: @@ -272,14 +272,14 @@ template outputHTML() { string[] top_level_headings = ["","","",""]; string previous_seg_filename = ""; string suffix = ".html"; - string previous_part = ""; + string previous_section = ""; string delimit = ""; - foreach (part; doc_matters.has.keys_seq.seg) { - foreach (obj; doc_abstraction[part]) { - delimit = xhtml_format.div_delimit(part, previous_part); + foreach (section; doc_matters.has.keys_seq.seg) { + foreach (obj; doc_abstraction[section]) { + delimit = xhtml_format.div_delimit(section, previous_section); string _txt = xhtml_format.special_characters_breaks_indents_bullets(obj); if (obj.metainfo.is_a == "heading") { - assert(part == "head" || "toc" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail"); + assert(section == "head" || "toc" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail"); switch (obj.metainfo.heading_lev_markup) { case 0: .. case 3: /+ fill buffer, and replace with new levels from 1 to 3 +/ @@ -344,10 +344,10 @@ template outputHTML() { break; } } else { - assert(part == "head" || "toc" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail"); + assert(section == "head" || "toc" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail"); Tuple!(string, string[]) t; switch (obj.metainfo.is_of_part) { - case "frontmatter": assert(part == "head" || "toc"); + case "frontmatter": assert(section == "head" || "toc"); switch (obj.metainfo.is_of_type) { case "para": switch (obj.metainfo.is_a) { @@ -373,7 +373,7 @@ template outputHTML() { break; } break; - case "body": assert(part == "body"); + case "body": assert(section == "body"); switch (obj.metainfo.is_of_type) { case "para": switch (obj.metainfo.is_a) { @@ -440,35 +440,35 @@ template outputHTML() { } break; case "backmatter": - assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail"); + assert(section == "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail"); switch (obj.metainfo.is_of_type) { case "para": switch (obj.metainfo.is_a) { - case "endnote": assert(part == "endnotes"); + case "endnote": assert(section == "endnotes"); t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); doc_html[segment_filename] ~= t[0]; break; - case "glossary": assert(part == "glossary"); + case "glossary": assert(section == "glossary"); t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); doc_html[segment_filename] ~= t[0]; doc_html_endnotes[segment_filename] ~= t[1]; break; - case "bibliography": assert(part == "bibliography"); + case "bibliography": assert(section == "bibliography"); t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); doc_html[segment_filename] ~= t[0]; doc_html_endnotes[segment_filename] ~= t[1]; break; - case "bookindex": assert(part == "bookindex"); + case "bookindex": assert(section == "bookindex"); t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); doc_html[segment_filename] ~= t[0]; doc_html_endnotes[segment_filename] ~= t[1]; break; - case "blurb": assert(part == "blurb"); + case "blurb": assert(section == "blurb"); t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); doc_html[segment_filename] ~= t[0]; doc_html_endnotes[segment_filename] ~= t[1]; break; - case "tail": assert(part == "tail"); + case "tail": assert(section == "tail"); t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); doc_html[segment_filename] ~= t[0]; doc_html_endnotes[segment_filename] ~= t[1]; diff --git a/src/doc_reform/io_out/xmls.d b/src/doc_reform/io_out/xmls.d index 2b1f55b..048b614 100644 --- a/src/doc_reform/io_out/xmls.d +++ b/src/doc_reform/io_out/xmls.d @@ -68,13 +68,13 @@ template outputXHTMLs() { static auto rgx = RgxO(); static auto rgx_xhtml = RgxXHTML(); @safe string div_delimit( - string part, - return ref string previous_part + string section, + return ref string previous_section ) { string delimit = ""; string delimit_ = ""; - if (part != previous_part) { - switch (part) { + if (section != previous_section) { + switch (section) { case "head": delimit_ ~= "\n
\n" ; break; @@ -85,13 +85,13 @@ template outputXHTMLs() { delimit_ ~= "\n
\n" ; break; default: - delimit_ ~= "\n
\n" ; + delimit_ ~= "\n
\n" ; break; } - if (previous_part.length > 0) { + if (previous_section.length > 0) { delimit ~= "\n
"; } - previous_part = part; + previous_section = section; delimit ~= delimit_; } // you also need to close the last div, introduce a footer? -- cgit v1.2.3