diff options
Diffstat (limited to 'org')
| -rw-r--r-- | org/ao_abstract_doc_source.org | 539 | ||||
| -rw-r--r-- | org/ao_defaults.org | 2 | ||||
| -rw-r--r-- | org/ao_output_debugs.org | 103 | ||||
| -rw-r--r-- | org/output.org | 96 | ||||
| -rw-r--r-- | org/sdp.org | 52 | 
5 files changed, 690 insertions, 102 deletions
| diff --git a/org/ao_abstract_doc_source.org b/org/ao_abstract_doc_source.org index c4733cc..49f3016 100644 --- a/org/ao_abstract_doc_source.org +++ b/org/ao_abstract_doc_source.org @@ -174,6 +174,7 @@ mixin InternalMarkup;  auto rgx = Rgx();  ObjGenericComposite[][string] the_table_of_contents_section;  ObjGenericComposite[] the_document_head_section, the_document_body_section, the_bibliography_section, the_glossary_section, the_blurb_section; +ObjGenericComposite[] the_dom_tail_section;  string[string] an_object, processing;  string an_object_key;  string[] anchor_tags; @@ -204,10 +205,10 @@ int bib_entry;  /+ counters +/  int cntr, previous_count, previous_length;  int[string] line_occur; -int verse_line, heading_ptr; -string[] html_segnames=[]; +string[] html_segnames=["toc"];  int html_segnames_ptr=0;  int html_segnames_ptr_cntr=0; +int verse_line, heading_ptr;  /+ paragraph attributes +/  int[string] indent;  bool bullet = true; @@ -217,6 +218,89 @@ auto obj_att = ObjAttributes();  /+ ocn +/  int obj_cite_number, obj_cite_number_;  auto object_citation_number = OCNemitter(); +int[] dom_markedup = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; +int[] dom_markedup_buffer = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; +int[] dom_collapsed = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; +int[] dom_collapsed_buffer = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; +enum DomTags { none, open, close, close_and_open, open_still, } +auto dom_set_markup_tags(int[] dom, int lev) { +  foreach (i; 0 .. 8) { +    if (i < lev) { +      if (dom[i] == DomTags.open +         || dom[i] == DomTags.close_and_open +      ) { +        dom[i] = DomTags.open_still; +      } else if (dom[i] == DomTags.close) { +        dom[i] = DomTags.none; +      } +    } else if (i == lev) { +      if (lev  == 0 +        && dom[i] == DomTags.open_still +      ) { +        dom[i] = DomTags.close; +      } else if (dom[i] == DomTags.open +        || dom[i] == DomTags.open_still +        || dom[i] == DomTags.close_and_open +      ) { +        dom[i] = DomTags.close_and_open; +      } else { +        dom[i] = DomTags.open; +      } +    } else if (i > lev) { +      if (dom[i] == DomTags.close) { +        dom[i] = DomTags.none; +      } else if (dom[i] == DomTags.open +        || dom[i] == DomTags.open_still +        || dom[i] == DomTags.close_and_open +      ) { +        dom[i] = DomTags.close; +      } +    } +  } +  debug(dom) { +    writeln(lev, ": ", dom); +  } +  return dom; +} +auto dom_set_collapsed_tags(int[] dom, int lev) { +  foreach (i; 0 .. 8) { +    if (i < lev) { +      if (dom[i] == DomTags.open +         || dom[i] == DomTags.close_and_open +      ) { +        dom[i] = DomTags.open_still; +      } else if (dom[i] == DomTags.close) { +        dom[i] = DomTags.none; +      } +    } else if (i == lev) { +      if (lev  == 0 +        && dom[i] == DomTags.open_still +      ) { +        dom[i] = DomTags.close; +      } else if (dom[i] == DomTags.open +        || dom[i] == DomTags.open_still +        || dom[i] == DomTags.close_and_open +      ) { +        dom[i] = DomTags.close_and_open; +      } else { +        dom[i] = DomTags.open; +      } +    } else if (i > lev) { +      if (dom[i] == DomTags.close) { +        dom[i] = DomTags.none; +      } else if (dom[i] == DomTags.open +        || dom[i] == DomTags.open_still +        || dom[i] == DomTags.close_and_open +      ) { +        dom[i] = DomTags.close; +      } +    } +  } +  debug(dom) { +    writeln(lev, ": ", dom); +  } +  return dom; +}  int ocn_emit(int ocn_status_flag) {    return object_citation_number.ocn_emitter(ocn_status_flag);  } @@ -319,7 +403,7 @@ string toc_txt_;  an_object["glossary_nugget"] = "";  an_object["blurb_nugget"] = "";  comp_obj_heading_                       = comp_obj_heading_.init; -comp_obj_heading_.use                   = "body"; +comp_obj_heading_.use                   = "frontmatter";  comp_obj_heading_.is_of                 = "para";  comp_obj_heading_.is_a                  = "heading";  comp_obj_heading_.text                  = "Table of Contents"; @@ -328,17 +412,20 @@ comp_obj_heading_.obj_cite_number       = "";  comp_obj_heading_.segment_anchor_tag    = "toc";  comp_obj_heading_.marked_up_level       = "1";  comp_obj_heading_.heading_lev_markup    = 4; -comp_obj_heading_.heading_lev_collapsed = 2; +comp_obj_heading_.heading_lev_collapsed = 1;  comp_obj_heading_.parent_ocn            = 1;  comp_obj_heading_.parent_lev_markup     = 0; +comp_obj_heading_.ptr_html_segnames     = html_segnames_ptr;  comp_obj_heading_.anchor_tags           = ["toc"]; -auto toc_head                       = comp_obj_heading_; +auto toc_head                           = comp_obj_heading_; +html_segnames_ptr_cntr++;  the_table_of_contents_section = [    "seg": [toc_head],    "scroll": [toc_head],  ];  auto mkup = InlineMarkup();  auto munge = ObjInlineMarkupMunge(); +string[][string] lev4_subtoc;  #+END_SRC  ** _2. loop: process document body_ [+6]                                 :loop: @@ -393,9 +480,8 @@ continue;  #+END_SRC  **** non code objects (other blocks or regular text) [+4]          :non_code: -  ***** in section (biblio, glossary, blurb) (block group) [+1]  :block:active: -****** DONE within block group: biblio                               :biblio: +****** within section: biblio                                        :biblio:  #+name: abs_in_loop_body_non_code_obj  #+BEGIN_SRC d @@ -418,7 +504,7 @@ if ((matchFirst(line, rgx.heading_biblio)    continue;  #+END_SRC -****** within section: glossary                               :glossary: +****** within section: glossary                                    :glossary:  if there is a glossary section you need to:  - extract it @@ -480,7 +566,7 @@ if there is a glossary section you need to:        comp_obj_heading_.parent_ocn            = 1;        comp_obj_heading_.parent_lev_markup     = 0;        comp_obj_heading_.anchor_tags           = ["glossary"]; -      the_glossary_section                ~= comp_obj_heading_; +      the_glossary_section                    ~= comp_obj_heading_;      // } else if (matchFirst(line, rgx.heading)) {      //   _heading_matched_(line, line_occur, an_object, an_object_key, lv, collapsed_lev, type, dochead_meta_aa); // levels?      } else { @@ -502,7 +588,7 @@ if there is a glossary section you need to:    continue;  #+END_SRC -****** within section: blurb                                     :blurb: +****** within section: blurb                                          :blurb:  if there is a blurb section you need to:  - extract it @@ -588,8 +674,8 @@ if there is a blurb section you need to:        comp_obj_para.is_of                 = "para";        comp_obj_para.is_a                  = "blurb";        comp_obj_para.text                  = to!string(line).strip; -      comp_obj_para.ocn                   = obj_cite_number; -      comp_obj_para.obj_cite_number       = (obj_cite_number==0) ? "" : to!string(obj_cite_number); +      comp_obj_para.ocn                   = 0; +      comp_obj_para.obj_cite_number       = "";        comp_obj_para.indent_hang           = indent["hang_position"];        comp_obj_para.indent_base           = indent["base_position"];        comp_obj_para.bullet                = bullet; @@ -600,8 +686,8 @@ if there is a blurb section you need to:    continue;  #+END_SRC -***** in block group [+1]                                      :block:active: -****** within block group: poem                                        :poem: +***** in blocks [+1]                                           :block:active: +****** within block: poem                                              :poem:  #+name: abs_in_loop_body_non_code_obj  #+BEGIN_SRC d @@ -611,7 +697,7 @@ if there is a blurb section you need to:    continue;  #+END_SRC -****** within block group: group                                      :group: +****** within block: group                                            :group:  #+name: abs_in_loop_body_non_code_obj  #+BEGIN_SRC d @@ -622,7 +708,7 @@ if there is a blurb section you need to:    continue;  #+END_SRC -****** within block group: block                                      :block: +****** within block: block                                            :block:  #+name: abs_in_loop_body_non_code_obj  #+BEGIN_SRC d @@ -632,7 +718,7 @@ if there is a blurb section you need to:    continue;  #+END_SRC -****** within block group: quote                                      :quote: +****** within block: quote                                            :quote:  #+name: abs_in_loop_body_non_code_obj  #+BEGIN_SRC d @@ -642,7 +728,7 @@ if there is a blurb section you need to:    continue;  #+END_SRC -****** within block group: table                                      :table: +****** within block: table                                            :table:  #+name: abs_in_loop_body_non_code_obj  #+BEGIN_SRC d @@ -653,7 +739,6 @@ if there is a blurb section you need to:  #+END_SRC  ***** not identified as being within block group (could still be, or not) [+3] -  ****** assert  #+name: abs_in_loop_body_open_block_obj_assert @@ -879,6 +964,7 @@ if ((type["heading"] == State.on)      dochead_make_aa,      segment_anchor_tag_that_object_belongs_to,      _anchor_tag, +    lev4_subtoc,      the_table_of_contents_section,    );    if (an_object["lev_markup_number"] == "4") { @@ -1025,8 +1111,8 @@ debug(objectrelated2) { // check  // obj_im.obj_inline_markup_and_anchor_tags("doc_end_reset", an_object_key, "", dochead_make_aa);  #+END_SRC -*** document sections -**** endnotes section (scroll & seg)                          :endnotes: +*** tie up preparation of document sections +**** endnotes section (scroll & seg)                               :endnotes:  #+name: abs_post  #+BEGIN_SRC d @@ -1047,7 +1133,7 @@ debug(endnotes) {  }  #+END_SRC -**** glossary section? +**** no glossary section?                                          :glossary:  #+name: abs_post  #+BEGIN_SRC d @@ -1064,7 +1150,7 @@ if (an_object["glossary_nugget"].length == 0) {    comp_obj_heading_.heading_lev_collapsed = 1;    comp_obj_heading_.parent_ocn            = 1;    comp_obj_heading_.parent_lev_markup     = 0; -  the_glossary_section                ~= comp_obj_heading_; +  the_glossary_section                    ~= comp_obj_heading_;  } else {    writeln("gloss");  } @@ -1075,7 +1161,7 @@ debug(glossary) {  }  #+END_SRC -**** [#B] bibliography section (objects)                  :bibliography: +**** bibliography section (objects)                            :bibliography:  #+name: abs_post  #+BEGIN_SRC d @@ -1211,13 +1297,13 @@ auto biblio_entry_tags_jsonstr =  `{    "id"                               : ""  }`; // is: book, article, magazine, newspaper, blog, other -**** [#B] bookindex section (scroll & seg)                  :book:index: +**** bookindex section (scroll & seg)                            :book:index:  #+name: abs_post  #+BEGIN_SRC d  auto bi = BookIndexReportSection();  auto bi_tuple = -  bi.bookindex_build_section( +  bi.bookindex_build_abstraction_section(      bookindex_unordered_hashes,      obj_cite_number,      segment_anchor_tag_that_object_belongs_to, @@ -1233,7 +1319,7 @@ debug(bookindex) {                         // bookindex  }  #+END_SRC -**** blurb section? +**** no blurb section?                                                :blurb:  #+name: abs_post  #+BEGIN_SRC d @@ -1245,13 +1331,13 @@ if (an_object["blurb_nugget"].length == 0) {    comp_obj_heading_.text                  = "(skip) there is no Blurb section";    comp_obj_heading_.ocn                   = 0;    comp_obj_para.obj_cite_number           = ""; -  comp_obj_heading_.segment_anchor_tag    = "bibliography"; -  comp_obj_heading_.marked_up_level       = "1"; -  comp_obj_heading_.heading_lev_markup    = 4; -  comp_obj_heading_.heading_lev_collapsed = 2; +  comp_obj_heading_.segment_anchor_tag    = ""; +  comp_obj_heading_.marked_up_level       = "B"; +  comp_obj_heading_.heading_lev_markup    = 1; +  comp_obj_heading_.heading_lev_collapsed = 1;    comp_obj_heading_.parent_ocn            = 1;    comp_obj_heading_.parent_lev_markup     = 0; -  the_blurb_section                   ~= comp_obj_heading_; +  the_blurb_section                       ~= comp_obj_heading_;  } else {    writeln("blurb");  } @@ -1262,17 +1348,16 @@ debug(blurb) {  }  #+END_SRC -**** [#B] toc, table of contents section (scroll & seg)       :contents: +**** toc backmatter, table of contents backmatter (scroll & seg)   :contents:  #+name: abs_post  #+BEGIN_SRC d -  indent=[    "hang_position" : 1,    "base_position" : 1,  ];  comp_obj_toc                       = comp_obj_toc.init; -comp_obj_toc.use                   = "body"; +comp_obj_toc.use                   = "frontmatter";  comp_obj_toc.is_of                 = "para";  comp_obj_toc.is_a                  = "toc";  comp_obj_toc.ocn                   = 0; @@ -1387,12 +1472,351 @@ debug(toc) {  }  #+END_SRC -*** [#B] the document                                              :document: +**** doc head (separate document head from body, make space for toc)  #+name: abs_post  #+BEGIN_SRC d  the_document_head_section ~= the_document_body_section[0];  the_document_body_section=the_document_body_section[1..$]; +#+END_SRC + +**** loop: backmatter loop up to lev4: html_segnames, set backmatter pointers + +could optimise by +- skipping second and third pass unless the output html seg or epub is being made! +NOTE there are issues attempting to do this on first pass +- as +  - backmatter is created out of sequence and +  - it is not certain which are present +it is quite neat to have all in one place as we have here: + +#+name: abs_post +#+BEGIN_SRC d +if (the_endnotes_section["scroll"].length > 1) { +  html_segnames ~= "endnotes"; +  html_segnames_ptr = html_segnames_ptr_cntr; +  foreach (ref section; the_endnotes_section["scroll"]) { +    if (section.heading_lev_markup == 4) { +      section.ptr_html_segnames = html_segnames_ptr; +      break; +    } +  } +  foreach (ref section; the_endnotes_section["seg"]) { +    if (section.heading_lev_markup == 4) { +      section.ptr_html_segnames = html_segnames_ptr; +      break; +    } +  } +  html_segnames_ptr_cntr++; +} +if (the_glossary_section.length > 1) { +  html_segnames ~= "glossary"; +  html_segnames_ptr = html_segnames_ptr_cntr; +  foreach (ref section; the_glossary_section) { +    if (section.heading_lev_markup == 4) { +      section.ptr_html_segnames = html_segnames_ptr; +      break; +    } +  } +  html_segnames_ptr_cntr++; +} +if (the_bibliography_section.length > 1) { +  html_segnames ~= "bibliography"; +  html_segnames_ptr = html_segnames_ptr_cntr; +  foreach (ref section; the_bibliography_section) { +    if (section.heading_lev_markup == 4) { +      section.ptr_html_segnames = html_segnames_ptr; +      break; +    } +  } +  html_segnames_ptr_cntr++; +} +if (the_bookindex_section["scroll"].length > 1) { +  html_segnames ~= "bookindex"; +  html_segnames_ptr = html_segnames_ptr_cntr; +  foreach (ref section; the_bookindex_section["scroll"]) { +    if (section.heading_lev_markup == 4) { +      section.ptr_html_segnames = html_segnames_ptr; +      break; +    } +  } +  foreach (ref section; the_bookindex_section["seg"]) { +    if (section.heading_lev_markup == 4) { +      section.ptr_html_segnames = html_segnames_ptr; +      break; +    } +  } +  html_segnames_ptr_cntr++; +} +if (the_blurb_section.length > 1) { +  html_segnames ~= "blurb"; +  html_segnames_ptr = html_segnames_ptr_cntr; +  foreach (ref section; the_blurb_section) { +    if (section.heading_lev_markup == 4) { +      section.ptr_html_segnames = html_segnames_ptr; +      break; +    } +  } +  html_segnames_ptr_cntr++; +} +#+END_SRC + +**** loop: all segments (as needed) up to document heading 1~, lev4 html: segnames & subtoc, backmatter pointers + +could optimise by +- skipping second and third pass unless the output html seg or epub is being made! + +during the third pass all previous and next segment names are known +next are not yet known for backmatter during the second pass + +#+name: abs_post +#+BEGIN_SRC d +if ((opt_action_bool["html"]) +|| (opt_action_bool["html_scroll"]) +|| (opt_action_bool["html_seg"]) +|| (opt_action_bool["epub"])) { +  foreach (ref obj; the_document_head_section) { +    if (obj.is_a == "heading") { +      debug(dom) { +        writeln(obj.text); +      } +      dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup); +      obj.dom_markedup = dom_markedup.dup; +      dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed); +      obj.dom_collapsed = dom_collapsed.dup; +    } +  } +  if (the_table_of_contents_section["scroll"].length > 1) { +    dom_markedup_buffer = dom_markedup.dup; +    dom_collapsed_buffer = dom_collapsed.dup; +    foreach (ref obj; the_table_of_contents_section["scroll"]) { +      if (obj.is_a == "heading") { +        debug(dom) { +        // writeln(obj.text); +        } +        if (obj.heading_lev_markup == 4) { +          obj.segname_next = html_segnames[obj.ptr_html_segnames + 1]; +          assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]); +        } +        dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup); +        obj.dom_markedup = dom_markedup.dup; +        dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed); +        obj.dom_collapsed = dom_collapsed.dup; +      } +    } +    dom_markedup = dom_markedup_buffer.dup; +    dom_collapsed = dom_collapsed_buffer.dup; +    foreach (ref obj; the_table_of_contents_section["seg"]) { +      if (obj.is_a == "heading") { +        debug(dom) { +          writeln(obj.text); +        } +        if (obj.heading_lev_markup == 4) { +          obj.segname_next = html_segnames[obj.ptr_html_segnames + 1]; +          assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]); +        } +        dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup); +        obj.dom_markedup = dom_markedup.dup; +        dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed); +        obj.dom_collapsed = dom_collapsed.dup; +      } +    } +  } +  /+ multiple 1~ levels, loop through document body +/ +  if (the_document_body_section.length > 1) { +    foreach (ref obj; the_document_body_section) { +      if (obj.is_a == "heading") { +        debug(dom) { +          writeln(obj.text); +        } +        if (obj.heading_lev_markup == 4) { +          obj.lev4_subtoc = lev4_subtoc[obj.segment_anchor_tag]; +          obj.segname_prev = html_segnames[obj.ptr_html_segnames - 1]; +          if (html_segnames.length > obj.ptr_html_segnames + 1) { +            obj.segname_next = html_segnames[obj.ptr_html_segnames + 1]; +          } +          assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]); +        } +        dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup); +        obj.dom_markedup = dom_markedup.dup; +        dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed); +        obj.dom_collapsed = dom_collapsed.dup; +      } +    } +  } +  /+ optional only one 1~ level +/ +  if (the_endnotes_section["scroll"].length > 1) { +    dom_markedup_buffer = dom_markedup.dup; +    dom_collapsed_buffer = dom_collapsed.dup; +    foreach (ref obj; the_endnotes_section["scroll"]) { +      if (obj.is_a == "heading") { +        debug(dom) { +        } +        if (obj.heading_lev_markup == 4) { +          obj.segname_prev = html_segnames[obj.ptr_html_segnames - 1]; +          if (html_segnames.length > obj.ptr_html_segnames + 1) { +            obj.segname_next = html_segnames[obj.ptr_html_segnames + 1]; +          } +          assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]); +        } +        dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup); +        obj.dom_markedup = dom_markedup.dup; +        dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed); +        obj.dom_collapsed = dom_collapsed.dup; +      } +    } +    dom_markedup = dom_markedup_buffer.dup; +    dom_collapsed = dom_collapsed_buffer.dup; +    foreach (ref obj; the_endnotes_section["seg"]) { +      if (obj.is_a == "heading") { +        debug(dom) { +          writeln(obj.text); +        } +        if (obj.heading_lev_markup == 4) { +          obj.segname_prev = html_segnames[obj.ptr_html_segnames - 1]; +          if (html_segnames.length > obj.ptr_html_segnames + 1) { +            obj.segname_next = html_segnames[obj.ptr_html_segnames + 1]; +          } +          assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]); +        } +        dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup); +        obj.dom_markedup = dom_markedup.dup; +        dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed); +        obj.dom_collapsed = dom_collapsed.dup; +      } +    } +  } +  /+ optional only one 1~ level +/ +  if (the_glossary_section.length > 1) { +    foreach (ref obj; the_glossary_section) { +      if (obj.is_a == "heading") { +        debug(dom) { +          writeln(obj.text); +        } +        if (obj.heading_lev_markup == 4) { +          obj.segname_prev = html_segnames[obj.ptr_html_segnames - 1]; +          if (html_segnames.length > obj.ptr_html_segnames + 1) { +            obj.segname_next = html_segnames[obj.ptr_html_segnames + 1]; +          } +          assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]); +        } +        dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup); +        obj.dom_markedup = dom_markedup.dup; +        dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed); +        obj.dom_collapsed = dom_collapsed.dup; +      } +    } +  } +  /+ optional only one 1~ level +/ +  if (the_bibliography_section.length > 1) { +    foreach (ref obj; the_bibliography_section) { +      if (obj.is_a == "heading") { +        debug(dom) { +          writeln(obj.text); +        } +        if (obj.heading_lev_markup == 4) { +          obj.segname_prev = html_segnames[obj.ptr_html_segnames - 1]; +          if (html_segnames.length > obj.ptr_html_segnames + 1) { +            obj.segname_next = html_segnames[obj.ptr_html_segnames + 1]; +          } +          assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]); +        } +        dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup); +        obj.dom_markedup = dom_markedup.dup; +        dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed); +        obj.dom_collapsed = dom_collapsed.dup; +      } +    } +  } +  /+ optional only one 1~ level +/ +  if (the_bookindex_section["scroll"].length > 1) { +    dom_markedup_buffer = dom_markedup.dup; +    dom_collapsed_buffer = dom_collapsed.dup; +    foreach (ref obj; the_bookindex_section["scroll"]) { +      if (obj.is_a == "heading") { +        debug(dom) { +        // writeln(obj.text); +        } +        if (obj.heading_lev_markup == 4) { +          obj.segname_prev = html_segnames[obj.ptr_html_segnames - 1]; +          if (html_segnames.length > obj.ptr_html_segnames + 1) { +            obj.segname_next = html_segnames[obj.ptr_html_segnames + 1]; +          } +          assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]); +        } +        dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup); +        obj.dom_markedup = dom_markedup.dup; +        dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed); +        obj.dom_collapsed = dom_collapsed.dup; +      } +    } +    dom_markedup = dom_markedup_buffer.dup; +    dom_collapsed = dom_collapsed_buffer.dup; +    foreach (ref obj; the_bookindex_section["seg"]) { +      if (obj.is_a == "heading") { +        debug(dom) { +          writeln(obj.text); +        } +        if (obj.heading_lev_markup == 4) { +          obj.segname_prev = html_segnames[obj.ptr_html_segnames - 1]; +          if (html_segnames.length > obj.ptr_html_segnames + 1) { +            obj.segname_next = html_segnames[obj.ptr_html_segnames + 1]; +          } +          assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]); +        } +        dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup); +        obj.dom_markedup = dom_markedup.dup; +        dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed); +        obj.dom_collapsed = dom_collapsed.dup; +      } +    } +  } +  /+ optional only one 1~ level +/ +  if (the_blurb_section.length > 1) { +    foreach (ref obj; the_blurb_section) { +      if (obj.is_a == "heading") { +        debug(dom) { +          writeln(obj.text); +        } +        if (obj.heading_lev_markup == 4) { +          obj.segname_prev = html_segnames[obj.ptr_html_segnames - 1]; +          if (html_segnames.length > obj.ptr_html_segnames + 1) { +            obj.segname_next = html_segnames[obj.ptr_html_segnames + 1]; +          } +          assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]); +        } +        dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup); +        obj.dom_markedup = dom_markedup.dup; +        dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed); +        obj.dom_collapsed = dom_collapsed.dup; +      } +    } +  } +  dom_markedup = dom_set_markup_tags(dom_markedup, 0); +  dom_collapsed = dom_set_collapsed_tags(dom_collapsed, 0); +  comp_obj_heading_                       = comp_obj_heading_.init; +  comp_obj_heading_.use                   = "empty"; +  comp_obj_heading_.is_of                 = "para"; +  comp_obj_heading_.is_a                  = "heading"; +  // comp_obj_heading_.text                  = "(skip) this is the DOM tail"; +  comp_obj_heading_.ocn                   = 0; +  comp_obj_para.obj_cite_number           = ""; +  comp_obj_heading_.segment_anchor_tag    = ""; +  comp_obj_heading_.marked_up_level       = ""; +  comp_obj_heading_.heading_lev_markup    = 9; +  comp_obj_heading_.heading_lev_collapsed = 9; +  comp_obj_heading_.parent_ocn            = 0; +  comp_obj_heading_.parent_lev_markup     = 0; +  comp_obj_heading_.dom_markedup          = dom_markedup.dup; +  comp_obj_heading_.dom_collapsed         = dom_collapsed.dup; +  the_dom_tail_section                    ~= comp_obj_heading_; +} +#+END_SRC + +*** [#B] the document                                              :document: + +#+name: abs_post +#+BEGIN_SRC d  auto document_the = [    "head":             the_document_head_section,    "toc_seg":          the_table_of_contents_section["seg"], @@ -1407,6 +1831,8 @@ auto document_the = [    "bookindex_scroll": the_bookindex_section["scroll"],    "bookindex_seg":    the_bookindex_section["seg"],    "blurb":            the_blurb_section, +  /+ dom tail only +/ +  "tail":             the_dom_tail_section,  ];  #+END_SRC @@ -2772,7 +3198,7 @@ auto _heading_matched_(          rgx.variable_doc_title, (dochead_meta_aa["title"]["full"] ~ ","));        an_object[an_object_key]=replaceFirst(an_object[an_object_key],          rgx.variable_doc_author, dochead_meta_aa["creator"]["author"]); -      collapsed_lev["h0"] = 1; +      collapsed_lev["h0"] = 0;        an_object["lev_collapsed_number"] =          to!string(collapsed_lev["h0"]);        lv["lv"] = DocStructMarkupHeading.h_sect_A; @@ -3201,7 +3627,7 @@ struct ObjInlineMarkupMunge {  }  #+END_SRC -***** object inline markup                                     :markup:inline: +***** toc, tags, object inline markup                         :markup:inline:  ****** open  #+name: ao_emitters_obj_inline_markup @@ -3282,7 +3708,7 @@ struct ObjInlineMarkup {    }  #+END_SRC -****** table of contents objects                         :markup:inline: +****** toc, table of contents build, gather headings          :markup:inline:  #+name: ao_emitters_obj_inline_markup_table_of_contents  #+BEGIN_SRC d @@ -3303,6 +3729,7 @@ struct ObjInlineMarkup {      string[string][string]        dochead_make_aa,      string                        segment_anchor_tag_that_object_belongs_to,      string                        _anchor_tag, +    ref string[][string]          lev4_subtoc,      ObjGenericComposite[][string] the_table_of_contents_section,    )    in { } @@ -3311,7 +3738,7 @@ struct ObjInlineMarkup {      char[] heading_toc_ = to!(char[])(obj_["body_nugget"].dup.strip);      heading_toc_ = _clean_heading_toc_(heading_toc_);      auto attrib=""; -    string toc_txt_; +    string toc_txt_, subtoc_txt_;      int[string] indent;      if (to!int(obj_["lev_markup_number"]) > 0) {        indent=[ @@ -3325,7 +3752,7 @@ struct ObjInlineMarkup {        );        toc_txt_= munge.url_links(toc_txt_);        comp_obj_toc                       = comp_obj_toc.init; -      comp_obj_toc.use                   = "body"; +      comp_obj_toc.use                   = "frontmatter";        comp_obj_toc.is_of                 = "para";        comp_obj_toc.is_a                  = "toc";        comp_obj_toc.ocn                   = 0; @@ -3341,7 +3768,7 @@ struct ObjInlineMarkup {          "base_position" : 0,        ];        comp_obj_toc                       = comp_obj_toc.init; -      comp_obj_toc.use                   = "body"; +      comp_obj_toc.use                   = "frontmatter";        comp_obj_toc.is_of                 = "para";        comp_obj_toc.is_a                  = "toc";        comp_obj_toc.ocn                   = 0; @@ -3353,7 +3780,7 @@ struct ObjInlineMarkup {        the_table_of_contents_section["scroll"] ~= comp_obj_toc;      }      comp_obj_toc                       = comp_obj_toc.init; -    comp_obj_toc.use                   = "body"; +    comp_obj_toc.use                   = "frontmatter";      comp_obj_toc.is_of                 = "para";      comp_obj_toc.is_a                  = "toc";      comp_obj_toc.ocn                   = 0; @@ -3393,6 +3820,7 @@ struct ObjInlineMarkup {          heading_toc_,          segment_anchor_tag_that_object_belongs_to,        ); +      lev4_subtoc[segment_anchor_tag_that_object_belongs_to] = [];        toc_txt_= munge.url_links(toc_txt_);        indent=[          "hang_position" : to!int(obj_["lev_markup_number"]), @@ -3410,6 +3838,12 @@ struct ObjInlineMarkup {          segment_anchor_tag_that_object_belongs_to,          _anchor_tag,        ); +      subtoc_txt_ = format(                         // 5 .. 7 +        "{ %s }#%s", +        heading_toc_, +        _anchor_tag, +      ); +      lev4_subtoc[segment_anchor_tag_that_object_belongs_to] ~= obj_["lev_markup_number"] ~ "~ " ~ to!string(subtoc_txt_).strip;        toc_txt_= munge.url_links(toc_txt_);        indent=[          "hang_position" : to!int(obj_["lev_markup_number"]), @@ -4105,7 +4539,7 @@ struct BookIndexReportSection {  #+name: ao_emitters_book_index_report_section  #+BEGIN_SRC d -  auto bookindex_build_section( +  auto bookindex_build_abstraction_section(      string[][string][string] bookindex_unordered_hashes,      int                      obj_cite_number,      string                   segment_anchor_tag_that_object_belongs_to, @@ -4126,6 +4560,7 @@ struct BookIndexReportSection {      if ((mainkeys.length > 0)      && (opt_action_bool["backmatter"] && opt_action_bool["section_bookindex"])) {        string bi_tmp_seg, bi_tmp_scroll; +      string[] bi_tmp_tags;        comp_obj_heading_                       = comp_obj_heading_.init;        comp_obj_heading_.use                   = "backmatter";        comp_obj_heading_.is_of                 = "para"; @@ -4160,8 +4595,14 @@ struct BookIndexReportSection {        bookindex_section["seg"]                ~= comp_obj_heading_;        ++obj_cite_number;        ++mkn; +      import std.array : appender; +      auto buffer = appender!(char[])(); +      string[dchar] transTable = [' ' : "_"];        foreach (mainkey; mainkeys) { +        bi_tmp_tags = [""];          bi_tmp_scroll = "!{" ~ mainkey ~ "}! "; +        buffer.clear(); +        bi_tmp_tags ~= translate(mainkey, transTable);          bi_tmp_seg = "!{" ~ mainkey ~ "}! ";          foreach (ref_; bookindex_unordered_hashes[mainkey]["_a"]) {            auto go = replaceAll(ref_, rgx.book_index_go, "$1"); @@ -4177,6 +4618,8 @@ struct BookIndexReportSection {            bookindex_unordered_hashes[mainkey].byKey.array.sort().release;          foreach (subkey; subkeys) {            bi_tmp_scroll ~= subkey ~ ", "; +          buffer.clear(); +          bi_tmp_tags ~= translate(subkey, transTable);            bi_tmp_seg ~= subkey ~ ", ";            foreach (ref_; bookindex_unordered_hashes[mainkey][subkey]) {              auto go = replaceAll(ref_, rgx.book_index_go, "$1"); @@ -4198,6 +4641,7 @@ struct BookIndexReportSection {          comp_obj_para.text                  = to!string(bi_tmp_scroll).strip;          comp_obj_para.ocn                   = obj_cite_number;          comp_obj_para.obj_cite_number       = (obj_cite_number==0) ? "" : to!string(obj_cite_number); +        comp_obj_para.anchor_tags           = bi_tmp_tags;          comp_obj_para.indent_hang           = 0;          comp_obj_para.indent_base           = 1;          comp_obj_para.bullet                = false; @@ -4619,7 +5063,7 @@ struct NodeStructureMetadata {    }  #+END_SRC -***** TODO node metadata emitter heading +***** TODO node metadata emitter heading, (including most segnames & their pointers)  #+name: ao_emitters_metadata  #+BEGIN_SRC d @@ -5053,6 +5497,8 @@ struct ObjGenericComposite {    string                 syntax                       = "";    int                    ocn                          = 0;    string                 segment_anchor_tag           = ""; +  string                 segname_prev                 = ""; +  string                 segname_next                 = "";    int                    parent_lev_markup            = 0;    int                    parent_ocn                   = 0;    int[]                  ancestors                    = []; @@ -5066,7 +5512,10 @@ struct ObjGenericComposite {    int                    ptr_heading                  = 0;    int                    array_ptr                    = 0;    int                    heading_array_ptr_segments   = 0; +  string[]               lev4_subtoc                  = [];    string[string][string] node; +  int[]                  dom_markedup                          = [ 0, 0, 0, 0, 0, 0, 0, 0,]; +  int[]                  dom_collapsed                         = [ 0, 0, 0, 0, 0, 0, 0, 0,];  }  #+END_SRC diff --git a/org/ao_defaults.org b/org/ao_defaults.org index 2aad14e..24baffb 100644 --- a/org/ao_defaults.org +++ b/org/ao_defaults.org @@ -677,7 +677,7 @@ static block_tic_close                                = ctRegex!("^(`{3})$","m")  #+BEGIN_SRC d  /+ blocked markup curly +/  static block_curly_open                               = ctRegex!(`^((code([.][a-z][0-9a-z_]+)?|poem|group|block|quote|table)[{].*?$)`); -static block_curly_code_open                          = ctRegex!(`^(code([.][a-z][0-9a-z_]+)?[{].*?$)`); +static block_curly_code_open                          = ctRegex!(`^(code([.][a-z][0-9a-z_]+)?[{](.*?)$)`);  static block_curly_code_close                         = ctRegex!(`^([}]code)`);  static block_curly_poem_open                          = ctRegex!(`^(poem[{].*?$)`);  static block_curly_poem_close                         = ctRegex!(`^([}]poem)`); 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 diff --git a/org/output.org b/org/output.org index eae453a..e9253dc 100644 --- a/org/output.org +++ b/org/output.org @@ -117,23 +117,38 @@ auto html_heading(O)(  ) {    auto tags = _html_anchor_tags(obj.anchor_tags);    string o; -  o = format(q"¶<br><hr /><br> +  if (obj.obj_cite_number.empty) { +    o = format(q"¶<br><hr /><br> +  <div class="substance"> +    <h%s class="%s">%s +      %s +    </h%s> +  </div>¶", +      obj.heading_lev_markup, +      obj.is_a, +      tags, +      obj.text, +      obj.heading_lev_markup, +    ); +  } else { +    o = format(q"¶<br><hr /><br>    <div class="substance">      <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label>      <h%s class="%s" id="%s"><a name="%s"></a>%s        %s      </h%s>    </div>¶", -  obj.obj_cite_number, -  obj.obj_cite_number, -  obj.heading_lev_markup, -  obj.is_a, -  obj.obj_cite_number, -  obj.obj_cite_number, -  tags, -  obj.text, -  obj.heading_lev_markup, -  ); +    obj.obj_cite_number, +    obj.obj_cite_number, +    obj.heading_lev_markup, +    obj.is_a, +    obj.obj_cite_number, +    obj.obj_cite_number, +    tags, +    obj.text, +    obj.heading_lev_markup, +    ); +  }    return o;  }  #+END_SRC @@ -149,13 +164,10 @@ auto html_para(O)(    string o;    if (obj.obj_cite_number.empty) {      o = format(q"¶  <div class="substance"> -  <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label>    <p class="%s" indent="h%si%s">%s      %s    </p>  </div>¶", -      obj.obj_cite_number, -      obj.obj_cite_number,        obj.is_a,        obj.indent_hang,        obj.indent_base, @@ -191,18 +203,29 @@ auto html_nugget(O)(    auto ref const O         obj,  ) {    string o; -  o = format(q"¶  <div class="substance"> +  if (obj.obj_cite_number.empty) { +    o = format(q"¶  <div class="substance"> +  <p class="%s"> +    %s +  </p> +</div>¶", +      obj.is_a, +      obj.text +    ); +  } else { +    o = format(q"¶  <div class="substance">    <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label>    <p class="%s" id="%s">      %s    </p>  </div>¶", -  obj.obj_cite_number, -  obj.obj_cite_number, -  obj.is_a, -  obj.obj_cite_number, -  obj.text -  ); +      obj.obj_cite_number, +      obj.obj_cite_number, +      obj.is_a, +      obj.obj_cite_number, +      obj.text +    ); +  }    return o;  }  #+END_SRC @@ -218,7 +241,7 @@ auto scroll_head_html() {  <head>    <meta charset="utf-8">    <title> -    Title +    %s%s    </title>  <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />    <meta name="dc.title" content="Title" /> @@ -239,7 +262,10 @@ auto scroll_head_html() {    <link href="../../../_sisu/css/html.css" rel="stylesheet">  </head>  <body lang="en"> -<a name="top" id="top"></a>¶"); +<a name="top" id="top"></a>¶", +dochead_meta["title"]["full"], +(dochead_meta["creator"]["author"].empty) ? "" : ", " ~ dochead_meta["creator"]["author"], +);    return o;  }  #+END_SRC @@ -319,7 +345,7 @@ void scroll(C)(    string[] doc;    foreach (part; document_section_keys_sequenced["scroll"]) {      foreach (obj; contents[part]) { -      if (obj.use == "body") { +      if (obj.use == "frontmatter") {          switch (obj.is_of) {          case "para":            switch (obj.is_a) { @@ -329,6 +355,22 @@ void scroll(C)(            case "toc":              body_html ~= html_toc(obj);              break; +          default: +            writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); +            break; +          } +          break; +        default: +          writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); +          break; +        } +      } else if (obj.use == "body") { +        switch (obj.is_of) { +        case "para": +          switch (obj.is_a) { +          case "heading": +            body_html ~= html_heading(obj); +            break;            case "para":              body_html ~= html_para(obj);              break; @@ -402,6 +444,12 @@ void scroll(C)(        }      }    } +#+END_SRC + +**** scroll output file + +#+name: output_html +#+BEGIN_SRC d    doc = scroll_head_html ~ body_html ~ scroll_tail_html;    auto m = matchFirst(fn_src, rgx.src_fn);    auto fn = m["fn_base"] ~ ".html"; diff --git a/org/sdp.org b/org/sdp.org index 274c285..f8734be 100644 --- a/org/sdp.org +++ b/org/sdp.org @@ -24,7 +24,7 @@ struct Version {    int minor;    int patch;  } -enum ver = Version(0, 10, 0); +enum ver = Version(0, 10, 1);  #+END_SRC  ** TODO sdp src/sdp.d                                               :sdp.d: @@ -137,6 +137,7 @@ import sdlang;                            // sdlang.d  #+END_SRC  ***** notes +  sdlang.parser,                       // sdlang/parser.d  sdlang.exceptions; @@ -430,50 +431,39 @@ auto doc_html_segnames = t[1];  #+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", -   ] +  "seg": ["head", "toc_seg", "body",], +  "scroll": ["head", "toc_scroll", "body",]  ];  if (doc_ao_contents["endnotes_seg"].length > 1) { -  document_section_keys_sequenced["seg"] = -    document_section_keys_sequenced["seg"] ~= "endnotes_seg"; +  document_section_keys_sequenced["seg"] ~= "endnotes_seg";  }  if (doc_ao_contents["endnotes_scroll"].length > 1) { -  document_section_keys_sequenced["scroll"] = -    document_section_keys_sequenced["scroll"] ~= "endnotes_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"; +  document_section_keys_sequenced["seg"] ~= "glossary"; +  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"; +  document_section_keys_sequenced["seg"] ~= "bibliography"; +  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"; +  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"; +  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"; +  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 | 
