From c37eb0768635a42686ea986343ff95ae03f08c1d Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 30 Oct 2018 11:46:44 -0400 Subject: 0.3.0 internal links, anchor tags & segment associations --- src/doc_reform/output/html.d | 148 +++++++++++++++++++++++++++++-------------- 1 file changed, 101 insertions(+), 47 deletions(-) (limited to 'src/doc_reform/output/html.d') diff --git a/src/doc_reform/output/html.d b/src/doc_reform/output/html.d index 3424dc9..e247221 100644 --- a/src/doc_reform/output/html.d +++ b/src/doc_reform/output/html.d @@ -29,7 +29,7 @@ template outputHTML() { delimit = xhtml_format.div_delimit(part, previous_part); string _txt = xhtml_format.special_characters(obj, obj.text); switch (obj.metainfo.is_of_part) { - case "frontmatter": assert(part == "head" || "toc_scroll"); + case "frontmatter": assert(part == "head" || "toc"); switch (obj.metainfo.is_of_type) { case "para": switch (obj.metainfo.is_a) { @@ -40,15 +40,21 @@ template outputHTML() { doc_html ~= xhtml_format.para_scroll(doc_matters, obj, _txt, suffix); break; default: - if ((doc_matters.opt.action.debug_do)) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } } break; } break; default: - if ((doc_matters.opt.action.debug_do)) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); + } } break; } @@ -64,8 +70,11 @@ template outputHTML() { doc_html ~= xhtml_format.para_scroll(doc_matters, obj, _txt, suffix); break; default: - if ((doc_matters.opt.action.debug_do)) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } } break; } @@ -93,21 +102,27 @@ template outputHTML() { doc_html ~= xhtml_format.table(doc_matters, obj, _txt); break; default: - if ((doc_matters.opt.action.debug_do)) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } } break; } break; default: - if ((doc_matters.opt.action.debug_do)) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); + } } break; } break; case "backmatter": - assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex_scroll" || "blurb" || "tail"); + assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail"); switch (obj.metainfo.is_of_type) { case "para": switch (obj.metainfo.is_a) { @@ -123,22 +138,28 @@ template outputHTML() { case "bibliography": assert(part == "bibliography"); doc_html ~= xhtml_format.para_scroll(doc_matters, obj, _txt, suffix); break; - case "bookindex": assert(part == "bookindex_scroll"); + case "bookindex": assert(part == "bookindex"); doc_html ~= xhtml_format.para_scroll(doc_matters, obj, _txt, suffix); break; case "blurb": assert(part == "blurb"); doc_html ~= xhtml_format.para_scroll(doc_matters, obj, _txt, suffix); break; default: - if ((doc_matters.opt.action.debug_do)) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } } break; } break; default: - if ((doc_matters.opt.action.debug_do)) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); + } } break; } @@ -146,10 +167,13 @@ template outputHTML() { case "comment": break; default: - if ((doc_matters.opt.action.debug_do)) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part); - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); - writeln(__FILE__, ":", __LINE__, ": ", obj.text); + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part); + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + writeln(__FILE__, ":", __LINE__, ": ", obj.text); + } } break; } @@ -202,7 +226,7 @@ template outputHTML() { delimit = xhtml_format.div_delimit(part, previous_part); string _txt = xhtml_format.special_characters(obj, obj.text); if (obj.metainfo.is_a == "heading") { - assert(part == "head" || "toc_seg" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex_seg" || "blurb" || "tail"); + assert(part == "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 +/ @@ -251,21 +275,27 @@ template outputHTML() { doc_html_endnotes[segment_filename] ~= t[1]; break; case 8: .. case 9: - if ((doc_matters.opt.action.debug_do)) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup); - writeln(__FILE__, ":", __LINE__, ": ", obj.text); + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + 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.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup); + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + 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"); + assert(part == "head" || "toc" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail"); switch (obj.metainfo.is_of_part) { - case "frontmatter": assert(part == "head" || "toc_seg"); + case "frontmatter": assert(part == "head" || "toc"); switch (obj.metainfo.is_of_type) { case "para": switch (obj.metainfo.is_a) { @@ -274,15 +304,21 @@ template outputHTML() { doc_html[segment_filename] ~= t[0].to!string; break; default: - if ((doc_matters.opt.action.debug_do)) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } } break; } break; default: - if ((doc_matters.opt.action.debug_do)) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } } break; } @@ -297,8 +333,11 @@ template outputHTML() { doc_html_endnotes[segment_filename] ~= t[1]; break; default: - if ((doc_matters.opt.action.debug_do)) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } } break; } @@ -335,21 +374,27 @@ template outputHTML() { doc_html_endnotes[segment_filename] ~= ""; break; default: - if ((doc_matters.opt.action.debug_do)) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } } break; } break; default: - if ((doc_matters.opt.action.debug_do)) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); + } } break; } break; case "backmatter": - assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex_seg" || "blurb" || "tail"); + assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail"); switch (obj.metainfo.is_of_type) { case "para": switch (obj.metainfo.is_a) { @@ -367,7 +412,7 @@ template outputHTML() { doc_html[segment_filename] ~= t[0]; doc_html_endnotes[segment_filename] ~= t[1]; break; - case "bookindex": assert(part == "bookindex_seg"); + case "bookindex": assert(part == "bookindex"); auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "seg"); doc_html[segment_filename] ~= t[0]; doc_html_endnotes[segment_filename] ~= t[1]; @@ -378,15 +423,21 @@ template outputHTML() { doc_html_endnotes[segment_filename] ~= t[1]; break; default: - if ((doc_matters.opt.action.debug_do)) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } } break; } break; default: - if ((doc_matters.opt.action.debug_do)) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); + } } break; } @@ -394,8 +445,11 @@ template outputHTML() { case "comment": break; default: - if ((doc_matters.opt.action.debug_do)) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part); + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part); + } } break; } -- cgit v1.2.3