diff options
Diffstat (limited to 'src/sdp/ao_output_debugs.d')
-rw-r--r-- | src/sdp/ao_output_debugs.d | 208 |
1 files changed, 193 insertions, 15 deletions
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; |