diff options
author | Ralph Amissah <ralph@amissah.com> | 2016-11-11 15:14:52 -0500 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2019-04-10 15:14:13 -0400 |
commit | a32c38eda635daa4f7bf00e971e8105bd7d25c57 (patch) | |
tree | 57758a74537400d31a640b41c84362691ac25852 /src | |
parent | 0.9.0 document sections (diff) |
document sections
Diffstat (limited to 'src')
-rwxr-xr-x | src/sdp.d | 28 | ||||
-rw-r--r-- | src/sdp/ao_abstract_doc_source.d | 2 | ||||
-rw-r--r-- | src/sdp/ao_object_setter.d | 4 | ||||
-rw-r--r-- | src/sdp/ao_output_debugs.d | 208 |
4 files changed, 206 insertions, 36 deletions
@@ -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; |