From 4fb0979097a0dcfda7cd2cf3bc510d60d7e6e4e1 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 15 Jan 2017 10:02:27 -0500 Subject: some reorganising, moved doc sections sequence keys, tuple change --- org/ao_abstract_doc_source.org | 40 ++++++++++++++++++++++++++++++++++++ org/sdp.org | 44 +++------------------------------------- src/sdp.d | 36 ++------------------------------ src/sdp/ao_abstract_doc_source.d | 34 +++++++++++++++++++++++++++++++ 4 files changed, 79 insertions(+), 75 deletions(-) diff --git a/org/ao_abstract_doc_source.org b/org/ao_abstract_doc_source.org index 897a3b7..dbc44a0 100644 --- a/org/ao_abstract_doc_source.org +++ b/org/ao_abstract_doc_source.org @@ -1935,6 +1935,45 @@ auto document_the = [ ]; #+END_SRC +*** document _section keys_ sequence + +#+name: abs_post +#+BEGIN_SRC d +string[][string] document_section_keys_sequenced = [ + "seg": ["head", "toc_seg", "body",], + "scroll": ["head", "toc_scroll", "body",] +]; +if (document_the["endnotes"].length > 1) { + document_section_keys_sequenced["seg"] ~= "endnotes"; + document_section_keys_sequenced["scroll"] ~= "endnotes"; +} +if (document_the["glossary"].length > 1) { + document_section_keys_sequenced["seg"] ~= "glossary"; + document_section_keys_sequenced["scroll"] ~= "glossary"; +} +if (document_the["bibliography"].length > 1) { + document_section_keys_sequenced["seg"] ~= "bibliography"; + document_section_keys_sequenced["scroll"] ~= "bibliography"; +} +if (document_the["bookindex_seg"].length > 1) { + document_section_keys_sequenced["seg"] ~= "bookindex_seg"; +} +if (document_the["bookindex_scroll"].length > 1) { + document_section_keys_sequenced["scroll"] ~= "bookindex_scroll"; +} +if (document_the["blurb"].length > 1) { + document_section_keys_sequenced["seg"] ~= "blurb"; + document_section_keys_sequenced["scroll"] ~= "blurb"; +} +if ((opt_action_bool["html"]) +|| (opt_action_bool["html_scroll"]) +|| (opt_action_bool["html_seg"]) +|| (opt_action_bool["epub"])) { + document_section_keys_sequenced["seg"] ~= "tail"; + document_section_keys_sequenced["scroll"] ~= "tail"; +} +#+END_SRC + *** clean out structure #+name: abs_post @@ -1954,6 +1993,7 @@ destroy(the_blurb_section); #+BEGIN_SRC d auto t = tuple( document_the, + document_section_keys_sequenced, html_segnames, ); return t; diff --git a/org/sdp.org b/org/sdp.org index 9e38ed7..9452b57 100644 --- a/org/sdp.org +++ b/org/sdp.org @@ -431,49 +431,11 @@ string[string][string] _dochead_meta = header_make_and_meta_tuple[1]; auto t = abs.abstract_doc_source(content_body, _dochead_make, _dochead_meta, _opt_action_bool); static assert(!isTypeTuple!(t)); auto doc_abstraction = t[0]; // head ~ toc ~ contents ~ endnotes_seg ~ glossary ~ bibliography ~ bookindex ~blurb; -string[] doc_html_segnames = t[1]; +string[][string] document_section_keys_sequenced = t[1]; +string[] doc_html_segnames = t[2]; #+END_SRC -**** 4. document _section keys_ sequence - -#+NAME: sdp_each_file_do_document_abstraction -#+BEGIN_SRC d -string[][string] document_section_keys_sequenced = [ - "seg": ["head", "toc_seg", "body",], - "scroll": ["head", "toc_scroll", "body",] -]; -if (doc_abstraction["endnotes"].length > 1) { - document_section_keys_sequenced["seg"] ~= "endnotes"; - document_section_keys_sequenced["scroll"] ~= "endnotes"; -} -if (doc_abstraction["glossary"].length > 1) { - document_section_keys_sequenced["seg"] ~= "glossary"; - document_section_keys_sequenced["scroll"] ~= "glossary"; -} -if (doc_abstraction["bibliography"].length > 1) { - document_section_keys_sequenced["seg"] ~= "bibliography"; - document_section_keys_sequenced["scroll"] ~= "bibliography"; -} -if (doc_abstraction["bookindex_seg"].length > 1) { - document_section_keys_sequenced["seg"] ~= "bookindex_seg"; -} -if (doc_abstraction["bookindex_scroll"].length > 1) { - document_section_keys_sequenced["scroll"] ~= "bookindex_scroll"; -} -if (doc_abstraction["blurb"].length > 1) { - document_section_keys_sequenced["seg"] ~= "blurb"; - document_section_keys_sequenced["scroll"] ~= "blurb"; -} -if ((_opt_action_bool["html"]) -|| (_opt_action_bool["html_scroll"]) -|| (_opt_action_bool["html_seg"]) -|| (_opt_action_bool["epub"])) { - document_section_keys_sequenced["seg"] ~= "tail"; - document_section_keys_sequenced["scroll"] ~= "tail"; -} -#+END_SRC - -**** 5. _document matters_ (compiled from various sources) +**** 4. _document matters_ (compiled from various sources) #+NAME: sdp_each_file_do_document_abstraction #+BEGIN_SRC d diff --git a/src/sdp.d b/src/sdp.d index f3fd07f..3a754b9 100755 --- a/src/sdp.d +++ b/src/sdp.d @@ -225,40 +225,8 @@ void main(string[] args) { auto t = abs.abstract_doc_source(content_body, _dochead_make, _dochead_meta, _opt_action_bool); static assert(!isTypeTuple!(t)); auto doc_abstraction = t[0]; // head ~ toc ~ contents ~ endnotes_seg ~ glossary ~ bibliography ~ bookindex ~blurb; - string[] doc_html_segnames = t[1]; - string[][string] document_section_keys_sequenced = [ - "seg": ["head", "toc_seg", "body",], - "scroll": ["head", "toc_scroll", "body",] - ]; - if (doc_abstraction["endnotes"].length > 1) { - document_section_keys_sequenced["seg"] ~= "endnotes"; - document_section_keys_sequenced["scroll"] ~= "endnotes"; - } - if (doc_abstraction["glossary"].length > 1) { - document_section_keys_sequenced["seg"] ~= "glossary"; - document_section_keys_sequenced["scroll"] ~= "glossary"; - } - if (doc_abstraction["bibliography"].length > 1) { - document_section_keys_sequenced["seg"] ~= "bibliography"; - document_section_keys_sequenced["scroll"] ~= "bibliography"; - } - if (doc_abstraction["bookindex_seg"].length > 1) { - document_section_keys_sequenced["seg"] ~= "bookindex_seg"; - } - if (doc_abstraction["bookindex_scroll"].length > 1) { - document_section_keys_sequenced["scroll"] ~= "bookindex_scroll"; - } - if (doc_abstraction["blurb"].length > 1) { - document_section_keys_sequenced["seg"] ~= "blurb"; - document_section_keys_sequenced["scroll"] ~= "blurb"; - } - if ((_opt_action_bool["html"]) - || (_opt_action_bool["html_scroll"]) - || (_opt_action_bool["html_seg"]) - || (_opt_action_bool["epub"])) { - document_section_keys_sequenced["seg"] ~= "tail"; - document_section_keys_sequenced["scroll"] ~= "tail"; - } + string[][string] document_section_keys_sequenced = t[1]; + string[] doc_html_segnames = t[2]; struct DocumentMatters { string[] keys_seq_seg() { string[] _k = document_section_keys_sequenced["seg"]; diff --git a/src/sdp/ao_abstract_doc_source.d b/src/sdp/ao_abstract_doc_source.d index e813260..d8eb7d2 100644 --- a/src/sdp/ao_abstract_doc_source.d +++ b/src/sdp/ao_abstract_doc_source.d @@ -1481,8 +1481,42 @@ template SiSUdocAbstraction() { /+ dom tail only +/ "tail": the_dom_tail_section, ]; + string[][string] document_section_keys_sequenced = [ + "seg": ["head", "toc_seg", "body",], + "scroll": ["head", "toc_scroll", "body",] + ]; + if (document_the["endnotes"].length > 1) { + document_section_keys_sequenced["seg"] ~= "endnotes"; + document_section_keys_sequenced["scroll"] ~= "endnotes"; + } + if (document_the["glossary"].length > 1) { + document_section_keys_sequenced["seg"] ~= "glossary"; + document_section_keys_sequenced["scroll"] ~= "glossary"; + } + if (document_the["bibliography"].length > 1) { + document_section_keys_sequenced["seg"] ~= "bibliography"; + document_section_keys_sequenced["scroll"] ~= "bibliography"; + } + if (document_the["bookindex_seg"].length > 1) { + document_section_keys_sequenced["seg"] ~= "bookindex_seg"; + } + if (document_the["bookindex_scroll"].length > 1) { + document_section_keys_sequenced["scroll"] ~= "bookindex_scroll"; + } + if (document_the["blurb"].length > 1) { + document_section_keys_sequenced["seg"] ~= "blurb"; + document_section_keys_sequenced["scroll"] ~= "blurb"; + } + if ((opt_action_bool["html"]) + || (opt_action_bool["html_scroll"]) + || (opt_action_bool["html_seg"]) + || (opt_action_bool["epub"])) { + document_section_keys_sequenced["seg"] ~= "tail"; + document_section_keys_sequenced["scroll"] ~= "tail"; + } auto t = tuple( document_the, + document_section_keys_sequenced, html_segnames, ); return t; -- cgit v1.2.3