aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/ao_output_debugs.org
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2016-12-29 20:36:41 -0500
committerRalph Amissah <ralph@amissah.com>2019-04-10 15:14:14 -0400
commit249e8d2d61f3650d934582b65200ca8fa0b47495 (patch)
tree0d03750aa9a4897c0277d85f49a9505f03b1d1c3 /org/ao_output_debugs.org
parentnaming (diff)
dom structure, levels marked up & collapsed (use e.g. in epub toc)doc-reform_v0.0.10
Diffstat (limited to 'org/ao_output_debugs.org')
-rw-r--r--org/ao_output_debugs.org103
1 files changed, 102 insertions, 1 deletions
diff --git a/org/ao_output_debugs.org b/org/ao_output_debugs.org
index a3b74c9..886adb1 100644
--- a/org/ao_output_debugs.org
+++ b/org/ao_output_debugs.org
@@ -108,6 +108,27 @@ debug(dumpdoc) {
}
#+END_SRC
+** (segnames) :objects:
+
+#+name: ao_output_debugs
+#+BEGIN_SRC d
+void out_segnames(S)(
+ auto ref const S contents,
+ string[] keys,
+ string[] html_segnames,
+) {
+ foreach (key; keys) {
+ if (contents[key].length > 1) {
+ foreach (obj; contents[key]) {
+ if (obj.heading_lev_markup == 4) {
+ writeln(obj.ptr_html_segnames, ". (", html_segnames[obj.ptr_html_segnames], ") -> ", obj.text);
+ }
+ }
+ }
+ }
+}
+#+END_SRC
+
** shared output section arrange
*** out toc
@@ -223,6 +244,32 @@ debug(section_toc_scroll) {
}
#+END_SRC
+#+name: ao_output_debugs
+#+BEGIN_SRC d
+debug(segnames) {
+ key="toc_scroll";
+ writeln(__LINE__);
+ string[] keys;
+ keys ~= [ "toc_seg", "body" ];
+ if (contents["endnotes_seg"].length > 1) {
+ keys ~= "endnotes_seg";
+ }
+ if (contents["glossary"].length > 1) {
+ keys ~= "glossary";
+ }
+ if (contents["bibliography"].length > 1) {
+ keys ~= "bibliography";
+ }
+ if (contents["bookindex_seg"].length > 1) {
+ keys ~= "bookindex_seg";
+ }
+ if (contents["blurb"].length > 1) {
+ keys ~= "blurb";
+ }
+ out_segnames(contents, keys, html_segnames);
+}
+#+END_SRC
+
*** body_section :body:
#+name: ao_output_debugs
@@ -242,7 +289,61 @@ debug(section_body) {
}
#+END_SRC
-*** endnotes_section (seg & scroll) :endnotes:
+*** dom structure :body:
+
+#+name: ao_output_debugs
+#+BEGIN_SRC d
+debug(dom) {
+ enum DomTags { none, open, close, close_and_open, open_still, }
+ foreach (sect; document_section_keys_sequenced["seg"]) {
+ foreach (obj; contents[sect]) {
+ if (obj.is_a == "heading") {
+ foreach_reverse (k; 0 .. 7) {
+ switch (obj.dom_markedup[k]) {
+ case DomTags.close :
+ writeln(markup.indent_by_spaces_provided(k), "</", k, ">");
+ break;
+ case DomTags.close_and_open :
+ writeln(markup.indent_by_spaces_provided(k), "</", k, ">");
+ writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text);
+ break;
+ case DomTags.open :
+ writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text);
+ break;
+ default :
+ break;
+ }
+ }
+ }
+ }
+ }
+ writeln("--------------------");
+ foreach (sect; document_section_keys_sequenced["seg"]) {
+ foreach (obj; contents[sect]) {
+ if (obj.is_a == "heading") {
+ foreach_reverse (k; 0 .. 7) {
+ switch (obj.dom_collapsed[k]) {
+ case DomTags.close :
+ writeln(markup.indent_by_spaces_provided(k), "</", k, ">");
+ break;
+ case DomTags.close_and_open :
+ writeln(markup.indent_by_spaces_provided(k), "</", k, ">");
+ writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text);
+ break;
+ case DomTags.open :
+ writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text);
+ break;
+ default :
+ break;
+ }
+ }
+ }
+ }
+ }
+}
+#+END_SRC
+
+*** endnotes_section (seg & scroll) :endnotes:
**** endnotes