From a32c38eda635daa4f7bf00e971e8105bd7d25c57 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 11 Nov 2016 15:14:52 -0500 Subject: document sections --- maker.org | 16 ++ org/ao_abstract_doc_source.org | 6 +- org/ao_output_debugs.org | 327 +++++++++++++++++++++++++++++++++++++-- org/sdp.org | 29 ++-- src/sdp.d | 28 ++-- src/sdp/ao_abstract_doc_source.d | 2 +- src/sdp/ao_object_setter.d | 4 +- src/sdp/ao_output_debugs.d | 208 +++++++++++++++++++++++-- 8 files changed, 547 insertions(+), 73 deletions(-) diff --git a/maker.org b/maker.org index a9688b1..c3d44e5 100644 --- a/maker.org +++ b/maker.org @@ -979,6 +979,7 @@ debugVersions "endnotes" debugVersions "endnotes_build" debugVersions "footnotes" debugVersions "footnotesdone" +debugVersions "glossary" debugVersions "group" debugVersions "header" debugVersions "header_and_content" @@ -1007,11 +1008,26 @@ debugVersions "poem" debugVersions "quote" debugVersions "raw" debugVersions "sdlang" +debugVersions "section_head" +debugVersions "section_toc" +debugVersions "section_toc_seg" +debugVersions "section_toc_scroll" +debugVersions "section_body" +debugVersions "section_endnotes" +debugVersions "section_endnotes_seg" +debugVersions "section_endnotes_scroll" +debugVersions "section_glossary" +debugVersions "section_bibliography" +debugVersions "section_bookindex" +debugVersions "section_bookindex_seg" +debugVersions "section_bookindex_scroll" +debugVersions "section_blurb" debugVersions "source" debugVersions "srclines" debugVersions "structattrib" debugVersions "summary" debugVersions "table" +debugVersions "toc" #+END_SRC ** make (emacs) diff --git a/org/ao_abstract_doc_source.org b/org/ao_abstract_doc_source.org index 6b1906d..0de77a2 100644 --- a/org/ao_abstract_doc_source.org +++ b/org/ao_abstract_doc_source.org @@ -1009,7 +1009,7 @@ foreach (entry; biblio_ordered) { out_, // nugget/object "", // attrib 0, // obj_cite_number - ([ "hang_position" : "0", "base_position" : "1", ]), // indent + ([ "hang_position" : "0", "base_position" : "1", ]), // indent false ); } @@ -4788,8 +4788,8 @@ auto contents_para( object_set.is_a = "para"; object_set.object = object.strip; object_set.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); - object_set.para_attrib.indent_start = 0; // indent["hang_position"]; - object_set.para_attrib.indent_rest = 0; // indent["base_position"]; + object_set.para_attrib.indent_start = to!int(indent["hang_position"]); + object_set.para_attrib.indent_rest = to!int(indent["base_position"]); object_set.para_attrib.bullet = false; // bullet; // object_set.node_structure.node = _node; return object_set; diff --git a/org/ao_output_debugs.org b/org/ao_output_debugs.org index b13bdce..0cab796 100644 --- a/org/ao_output_debugs.org +++ b/org/ao_output_debugs.org @@ -15,7 +15,52 @@ * output debugs :debug:output: [[./sdp.org][sdp]] [[./][org/]] -** book index (sort &) report :report: +** initialize :report: + +#+name: initialize +#+BEGIN_SRC d +string key; +string indent_amount_; +auto indented_(int indent) { + switch (indent) { + case 0: + indent_amount_=""; + break; + case 1: + indent_amount_=" "; + break; + case 2: + indent_amount_=" "; + break; + case 3: + indent_amount_=" "; + break; + case 4: + indent_amount_=" "; + break; + case 5: + indent_amount_=" "; + break; + case 6: + indent_amount_=" "; + break; + case 7: + indent_amount_=" "; + break; + case 8: + indent_amount_=" "; + break; + case 9: + indent_amount_=" "; + break; + default: + break; + } + return indent_amount_; +} +#+END_SRC + +** book index (sort &) report :report: #+name: book_index_sorted_report #+BEGIN_SRC d @@ -97,6 +142,262 @@ debug(dumpdoc) { } #+END_SRC +** shared output section arrange +*** out toc + +#+name: ao_output_debugs +#+BEGIN_SRC d +void out_toc(S)( + auto ref const S contents, + string key, +) { + if (contents[key].length > 1) { + string indent_amount; + foreach (obj; contents[key]) { + indent_amount=indented_(obj.para_attrib.indent_start); + writefln( + "%s%s", + indent_amount, + obj.object + ); + } + } +} +#+END_SRC + +*** out endnotes :endnotes: + +#+name: ao_output_debugs +#+BEGIN_SRC d +void out_endnotes(S)( + auto ref const S contents, + string key, +) { + if (contents[key].length > 1) { + foreach (obj; contents[key]) { + writefln( + "[%s]\n%s", + obj.is_a, + obj.object + ); + } + } +} +#+END_SRC + +*** out bookindex :bookindex: + +#+name: ao_output_debugs +#+BEGIN_SRC d +void out_bookindex(S)( + auto ref const S contents, + string key, +) { + if (contents[key].length > 1) { + foreach (obj; contents[key]) { + writefln( + "[%s][%s]\n%s", + obj.obj_cite_number, + obj.is_a, + obj.object + ); + } + } +} +#+END_SRC + +** sections +*** heading_section :heading: + +#+name: ao_output_debugs +#+BEGIN_SRC d +debug(section_head) { + key="head"; + if (contents[key].length > 1) { + foreach (obj; contents[key]) { + writefln( + "[%s][%s]\n%s", + obj.obj_cite_number, + obj.is_a, + obj.object + ); + } + } +} +#+END_SRC + +*** toc_section (seg & scroll) +**** toc + +#+name: ao_output_debugs +#+BEGIN_SRC d +debug(section_toc) { + key="toc_seg"; + out_toc(contents, key); +} +#+END_SRC + +**** toc seg + +#+name: ao_output_debugs +#+BEGIN_SRC d +debug(section_toc_seg) { + key="toc_seg"; + out_toc(contents, key); +} +#+END_SRC + +**** toc scroll + +#+name: ao_output_debugs +#+BEGIN_SRC d +debug(section_toc_scroll) { + key="toc_scroll"; + out_toc(contents, key); +} +#+END_SRC + +*** body_section :body: + +#+name: ao_output_debugs +#+BEGIN_SRC d +debug(section_body) { + key="body"; + if (contents[key].length > 1) { + foreach (obj; contents[key]) { + writefln( + "[%s][%s]\n%s", + obj.obj_cite_number, + obj.is_a, + obj.object + ); + } + } +} +#+END_SRC + +*** endnotes_section (seg & scroll) :endnotes: + +**** endnotes + +#+name: ao_output_debugs +#+BEGIN_SRC d +debug(section_endnotes) { + key="endnotes_seg"; + out_endnotes(contents, key); +} +#+END_SRC + +**** endnotes seg + +#+name: ao_output_debugs +#+BEGIN_SRC d +debug(section_endnotes_seg) { + key="endnotes_seg"; + out_endnotes(contents, key); +} +#+END_SRC + +**** endnotes scroll + +#+name: ao_output_debugs +#+BEGIN_SRC d +debug(section_endnotes_scroll) { + key="endnotes_scroll"; + out_endnotes(contents, key); +} +#+END_SRC + +*** glossary_section :glossary: + +#+name: ao_output_debugs +#+BEGIN_SRC d +debug(section_glossary) { + key="glossary"; + if (contents[key].length > 1) { + foreach (obj; contents[key]) { + writefln( + "[%s][%s]\n%s", + obj.obj_cite_number, + obj.is_a, + obj.object + ); + } + } +} +#+END_SRC + +*** bibliography_section (seg & scroll) :bibliography: + +#+name: ao_output_debugs +#+BEGIN_SRC d +debug(section_bibliography) { + key="bibliography"; + if (contents[key].length > 1) { + foreach (obj; contents[key]) { + writefln( + "[%s][%s]\n%s", + obj.obj_cite_number, + obj.is_a, + obj.object + ); + } + } +} +#+END_SRC + +*** bookindex_section (seg & scroll) :bookindex: + +**** bookindex + +#+name: ao_output_debugs +#+BEGIN_SRC d +debug(section_bookindex) { + key="bookindex_seg"; + out_bookindex(contents, key); +} +#+END_SRC + +**** bookindex seg + +#+name: ao_output_debugs +#+BEGIN_SRC d +debug(section_bookindex_seg) { + key="bookindex_seg"; + out_bookindex(contents, key); +} +#+END_SRC + +**** bookindex scroll + +#+name: ao_output_debugs +#+BEGIN_SRC d +debug(section_bookindex_scroll) { + key="bookindex_scroll"; + out_bookindex(contents, key); +} +#+END_SRC + +*** section_blurb :blurb: + +#+name: ao_output_debugs +#+BEGIN_SRC d +debug(blurb_section) { + key="blurb"; + if (contents[key].length > 1) { + foreach (obj; contents[key]) { + writefln( + "[%s][%s]\n%s", + obj.obj_cite_number, + obj.is_a, + obj.object + ); + } + } +} +#+END_SRC + +* end ** (objects) :objects: #+name: ao_output_debugs @@ -325,8 +626,8 @@ debug(anchor) { __FILE__, __LINE__, ); - foreach (key; document_section_keys_sequenced["seg"]) { - foreach (obj; contents[key]) { + foreach (k; document_section_keys_sequenced["seg"]) { + foreach (obj; contents[k]) { if (obj.is_a == "heading") { writefln( "%s~ [%s] %s %s", @@ -348,8 +649,8 @@ debug(anchor) { #+BEGIN_SRC d debug(heading) { // heading string spc; - foreach (key; document_section_keys_sequenced["seg"]) { - foreach (o; contents[key]) { + foreach (k; document_section_keys_sequenced["seg"]) { + foreach (o; contents[k]) { if (o.is_a == "heading") { switch (o.heading_attrib.lev_markup_number) { case 0: @@ -391,13 +692,6 @@ debug(heading) { // heading o.heading_attrib.lev_collapsed_number ); } - writefln( - "%s* %s\n (markup level: %s; collapsed level: %s)", - spc, - strip(o.object), - o.heading_attrib.lev_markup_number, - o.heading_attrib.lev_collapsed_number - ); } } } @@ -414,8 +708,8 @@ debug(headings) { __FILE__, __LINE__, ); - foreach (key; document_section_keys_sequenced["seg"]) { - foreach (obj; contents[key]) { + foreach (k; document_section_keys_sequenced["seg"]) { + foreach (obj; contents[k]) { if (obj.is_a == "heading") { writefln( "%s~ [%s] %s", @@ -443,8 +737,8 @@ debug(summary) { #+name: ao_output_debugs_summary #+BEGIN_SRC d debug(checkdoc) { - foreach (key; document_section_keys_sequenced["seg"]) { - foreach (obj; contents[key]) { + foreach (k; document_section_keys_sequenced["seg"]) { + foreach (obj; contents[k]) { if (obj.use == "content") { if (!empty(obj.obj_cite_number)) { check["last_obj_cite_number"] = obj.obj_cite_number; @@ -638,6 +932,7 @@ template SiSUoutputDebugs() { ) { mixin RgxInit; auto rgx = Rgx(); + <> <> <> <> diff --git a/org/sdp.org b/org/sdp.org index c1157eb..d69262b 100644 --- a/org/sdp.org +++ b/org/sdp.org @@ -365,6 +365,7 @@ auto doc_ao_bookindex_unordered_hashes = t[1]; // redundant? auto doc_ao_biblio = t[2]; // redundant? #+END_SRC +**** document section keys view #+NAME: sdp_each_file_do_document_abstraction #+BEGIN_SRC d @@ -380,45 +381,37 @@ string[][string] document_section_keys_sequenced = [ "body", ] ]; -/+ seg +/ if (doc_ao_contents["endnotes_seg"].length > 1) { document_section_keys_sequenced["seg"] = document_section_keys_sequenced["seg"] ~= "endnotes_seg"; } -if (doc_ao_contents["glossary"].length > 1) { - document_section_keys_sequenced["seg"] = - document_section_keys_sequenced["seg"] ~= "glossary"; -} -if (doc_ao_contents["bibliography"].length > 1) { - document_section_keys_sequenced["seg"] = - document_section_keys_sequenced["seg"] ~= "bibliography"; -} -if (doc_ao_contents["bookindex_seg"].length > 1) { - document_section_keys_sequenced["seg"] = - document_section_keys_sequenced["seg"] ~= "bookindex_seg"; -} -if (doc_ao_contents["blurb"].length > 1) { - document_section_keys_sequenced["seg"] = - document_section_keys_sequenced["seg"] ~= "blurb"; -} -/+ scroll +/ if (doc_ao_contents["endnotes_scroll"].length > 1) { document_section_keys_sequenced["scroll"] = document_section_keys_sequenced["scroll"] ~= "endnotes_scroll"; } if (doc_ao_contents["glossary"].length > 1) { + document_section_keys_sequenced["seg"] = + document_section_keys_sequenced["seg"] ~= "glossary"; document_section_keys_sequenced["scroll"] = document_section_keys_sequenced["scroll"] ~= "glossary"; } if (doc_ao_contents["bibliography"].length > 1) { + document_section_keys_sequenced["seg"] = + document_section_keys_sequenced["seg"] ~= "bibliography"; document_section_keys_sequenced["scroll"] = document_section_keys_sequenced["scroll"] ~= "bibliography"; } +if (doc_ao_contents["bookindex_seg"].length > 1) { + document_section_keys_sequenced["seg"] = + document_section_keys_sequenced["seg"] ~= "bookindex_seg"; +} if (doc_ao_contents["bookindex_scroll"].length > 1) { document_section_keys_sequenced["scroll"] = document_section_keys_sequenced["scroll"] ~= "bookindex_scroll"; } if (doc_ao_contents["blurb"].length > 1) { + document_section_keys_sequenced["seg"] = + document_section_keys_sequenced["seg"] ~= "blurb"; document_section_keys_sequenced["scroll"] = document_section_keys_sequenced["scroll"] ~= "blurb"; } diff --git a/src/sdp.d b/src/sdp.d index 63df077..3cb555a 100755 --- a/src/sdp.d +++ b/src/sdp.d @@ -211,45 +211,37 @@ void main(string[] args) { "body", ] ]; - /+ seg +/ if (doc_ao_contents["endnotes_seg"].length > 1) { document_section_keys_sequenced["seg"] = document_section_keys_sequenced["seg"] ~= "endnotes_seg"; } - if (doc_ao_contents["glossary"].length > 1) { - document_section_keys_sequenced["seg"] = - document_section_keys_sequenced["seg"] ~= "glossary"; - } - if (doc_ao_contents["bibliography"].length > 1) { - document_section_keys_sequenced["seg"] = - document_section_keys_sequenced["seg"] ~= "bibliography"; - } - if (doc_ao_contents["bookindex_seg"].length > 1) { - document_section_keys_sequenced["seg"] = - document_section_keys_sequenced["seg"] ~= "bookindex_seg"; - } - if (doc_ao_contents["blurb"].length > 1) { - document_section_keys_sequenced["seg"] = - document_section_keys_sequenced["seg"] ~= "blurb"; - } - /+ scroll +/ if (doc_ao_contents["endnotes_scroll"].length > 1) { document_section_keys_sequenced["scroll"] = document_section_keys_sequenced["scroll"] ~= "endnotes_scroll"; } if (doc_ao_contents["glossary"].length > 1) { + document_section_keys_sequenced["seg"] = + document_section_keys_sequenced["seg"] ~= "glossary"; document_section_keys_sequenced["scroll"] = document_section_keys_sequenced["scroll"] ~= "glossary"; } if (doc_ao_contents["bibliography"].length > 1) { + document_section_keys_sequenced["seg"] = + document_section_keys_sequenced["seg"] ~= "bibliography"; document_section_keys_sequenced["scroll"] = document_section_keys_sequenced["scroll"] ~= "bibliography"; } + if (doc_ao_contents["bookindex_seg"].length > 1) { + document_section_keys_sequenced["seg"] = + document_section_keys_sequenced["seg"] ~= "bookindex_seg"; + } if (doc_ao_contents["bookindex_scroll"].length > 1) { document_section_keys_sequenced["scroll"] = document_section_keys_sequenced["scroll"] ~= "bookindex_scroll"; } if (doc_ao_contents["blurb"].length > 1) { + document_section_keys_sequenced["seg"] = + document_section_keys_sequenced["seg"] ~= "blurb"; document_section_keys_sequenced["scroll"] = document_section_keys_sequenced["scroll"] ~= "blurb"; } diff --git a/src/sdp/ao_abstract_doc_source.d b/src/sdp/ao_abstract_doc_source.d index 421c094..2d10585 100644 --- a/src/sdp/ao_abstract_doc_source.d +++ b/src/sdp/ao_abstract_doc_source.d @@ -777,7 +777,7 @@ template SiSUdocAbstraction() { out_, // nugget/object "", // attrib 0, // obj_cite_number - ([ "hang_position" : "0", "base_position" : "1", ]), // indent + ([ "hang_position" : "0", "base_position" : "1", ]), // indent false ); } diff --git a/src/sdp/ao_object_setter.d b/src/sdp/ao_object_setter.d index f942fc3..4d31d8d 100644 --- a/src/sdp/ao_object_setter.d +++ b/src/sdp/ao_object_setter.d @@ -89,8 +89,8 @@ template ObjectSetter() { object_set.is_a = "para"; object_set.object = object.strip; object_set.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); - object_set.para_attrib.indent_start = 0; // indent["hang_position"]; - object_set.para_attrib.indent_rest = 0; // indent["base_position"]; + object_set.para_attrib.indent_start = to!int(indent["hang_position"]); + object_set.para_attrib.indent_rest = to!int(indent["base_position"]); object_set.para_attrib.bullet = false; // bullet; // object_set.node_structure.node = _node; return object_set; diff --git a/src/sdp/ao_output_debugs.d b/src/sdp/ao_output_debugs.d index 3bb8ae2..4800591 100644 --- a/src/sdp/ao_output_debugs.d +++ b/src/sdp/ao_output_debugs.d @@ -15,6 +15,45 @@ template SiSUoutputDebugs() { ) { mixin RgxInit; auto rgx = Rgx(); + string key; + string indent_amount_; + auto indented_(int indent) { + switch (indent) { + case 0: + indent_amount_=""; + break; + case 1: + indent_amount_=" "; + break; + case 2: + indent_amount_=" "; + break; + case 3: + indent_amount_=" "; + break; + case 4: + indent_amount_=" "; + break; + case 5: + indent_amount_=" "; + break; + case 6: + indent_amount_=" "; + break; + case 7: + indent_amount_=" "; + break; + case 8: + indent_amount_=" "; + break; + case 9: + indent_amount_=" "; + break; + default: + break; + } + return indent_amount_; + } struct BookIndexReport { int mkn, skn; auto bookindex_report_sorted( @@ -79,6 +118,152 @@ template SiSUoutputDebugs() { } } } + void out_toc(S)( + auto ref const S contents, + string key, + ) { + if (contents[key].length > 1) { + string indent_amount; + foreach (obj; contents[key]) { + indent_amount=indented_(obj.para_attrib.indent_start); + writefln( + "%s%s", + indent_amount, + obj.object + ); + } + } + } + void out_endnotes(S)( + auto ref const S contents, + string key, + ) { + if (contents[key].length > 1) { + foreach (obj; contents[key]) { + writefln( + "[%s]\n%s", + obj.is_a, + obj.object + ); + } + } + } + void out_bookindex(S)( + auto ref const S contents, + string key, + ) { + if (contents[key].length > 1) { + foreach (obj; contents[key]) { + writefln( + "[%s][%s]\n%s", + obj.obj_cite_number, + obj.is_a, + obj.object + ); + } + } + } + debug(section_head) { + key="head"; + if (contents[key].length > 1) { + foreach (obj; contents[key]) { + writefln( + "[%s][%s]\n%s", + obj.obj_cite_number, + obj.is_a, + obj.object + ); + } + } + } + debug(section_toc) { + key="toc_seg"; + out_toc(contents, key); + } + debug(section_toc_seg) { + key="toc_seg"; + out_toc(contents, key); + } + debug(section_toc_scroll) { + key="toc_scroll"; + out_toc(contents, key); + } + debug(section_body) { + key="body"; + if (contents[key].length > 1) { + foreach (obj; contents[key]) { + writefln( + "[%s][%s]\n%s", + obj.obj_cite_number, + obj.is_a, + obj.object + ); + } + } + } + debug(section_endnotes) { + key="endnotes_seg"; + out_endnotes(contents, key); + } + debug(section_endnotes_seg) { + key="endnotes_seg"; + out_endnotes(contents, key); + } + debug(section_endnotes_scroll) { + key="endnotes_scroll"; + out_endnotes(contents, key); + } + debug(section_glossary) { + key="glossary"; + if (contents[key].length > 1) { + foreach (obj; contents[key]) { + writefln( + "[%s][%s]\n%s", + obj.obj_cite_number, + obj.is_a, + obj.object + ); + } + } + } + debug(section_bibliography) { + key="bibliography"; + if (contents[key].length > 1) { + foreach (obj; contents[key]) { + writefln( + "[%s][%s]\n%s", + obj.obj_cite_number, + obj.is_a, + obj.object + ); + } + } + } + debug(section_bookindex) { + key="bookindex_seg"; + out_bookindex(contents, key); + } + debug(section_bookindex_seg) { + key="bookindex_seg"; + out_bookindex(contents, key); + } + debug(section_bookindex_scroll) { + key="bookindex_scroll"; + out_bookindex(contents, key); + } + debug(blurb_section) { + key="blurb"; + if (contents[key].length > 1) { + foreach (obj; contents[key]) { + writefln( + "[%s][%s]\n%s", + obj.obj_cite_number, + obj.is_a, + obj.object + ); + } + } + } debug(objects) { writefln( "%s\n%s:%s", @@ -273,8 +458,8 @@ template SiSUoutputDebugs() { __FILE__, __LINE__, ); - foreach (key; document_section_keys_sequenced["seg"]) { - foreach (obj; contents[key]) { + foreach (k; document_section_keys_sequenced["seg"]) { + foreach (obj; contents[k]) { if (obj.is_a == "heading") { writefln( "%s~ [%s] %s %s", @@ -290,8 +475,8 @@ template SiSUoutputDebugs() { } debug(heading) { // heading string spc; - foreach (key; document_section_keys_sequenced["seg"]) { - foreach (o; contents[key]) { + foreach (k; document_section_keys_sequenced["seg"]) { + foreach (o; contents[k]) { if (o.is_a == "heading") { switch (o.heading_attrib.lev_markup_number) { case 0: @@ -333,13 +518,6 @@ template SiSUoutputDebugs() { o.heading_attrib.lev_collapsed_number ); } - writefln( - "%s* %s\n (markup level: %s; collapsed level: %s)", - spc, - strip(o.object), - o.heading_attrib.lev_markup_number, - o.heading_attrib.lev_collapsed_number - ); } } } @@ -354,8 +532,8 @@ template SiSUoutputDebugs() { __FILE__, __LINE__, ); - foreach (key; document_section_keys_sequenced["seg"]) { - foreach (obj; contents[key]) { + foreach (k; document_section_keys_sequenced["seg"]) { + foreach (obj; contents[k]) { if (obj.is_a == "heading") { writefln( "%s~ [%s] %s", @@ -369,8 +547,8 @@ template SiSUoutputDebugs() { } } debug(checkdoc) { - foreach (key; document_section_keys_sequenced["seg"]) { - foreach (obj; contents[key]) { + foreach (k; document_section_keys_sequenced["seg"]) { + foreach (obj; contents[k]) { if (obj.use == "content") { if (!empty(obj.obj_cite_number)) { check["last_obj_cite_number"] = obj.obj_cite_number; -- cgit v1.2.3