From d60c328d3bd3d1a8be39dd835b2ee96640490120 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 20 Apr 2019 14:44:42 -0400 Subject: (segmented html) dummy heading related --- org/default_misc.org | 2 ++ org/default_regex.org | 4 +-- org/meta_abstraction.org | 50 ++++++++++++++++++++++++++++------ org/output_xmls.org | 32 +++++++++++++++++----- src/doc_reform/meta/defaults.d | 2 ++ src/doc_reform/meta/metadoc_from_src.d | 49 +++++++++++++++++++++++++++------ src/doc_reform/meta/object_setter.d | 1 + src/doc_reform/meta/rgx.d | 4 +-- src/doc_reform/output/xmls.d | 30 ++++++++++++++++---- 9 files changed, 141 insertions(+), 33 deletions(-) diff --git a/org/default_misc.org b/org/default_misc.org index 1540e30..6866c85 100644 --- a/org/default_misc.org +++ b/org/default_misc.org @@ -71,6 +71,8 @@ template DocReformRgxInitFlags() { "tic_table" : 0, "ocn_status" : 0, // 0 object_number; 1 no object_number; 2 no object_number & dummy headings "ocn_status_off_for_multiple_objects" : 0, // 0 object_number; 1 no object_number; 2 no object_number & dummy headings + "heading_status" : 0, + "heading_off_for_multiple_objects" : 0, "book_index" : 0, ]; return flags_type_init; diff --git a/org/default_regex.org b/org/default_regex.org index f4c2952..f316600 100644 --- a/org/default_regex.org +++ b/org/default_regex.org @@ -328,7 +328,7 @@ static auto_heading_numbering_off_lv4 = ctRegex!(`^4~\S*?-\s`, "m #+BEGIN_SRC d /+ no object_number object +/ static object_number_off = ctRegex!(`~#[ ]*$`, "m"); -static object_number_off_dh = ctRegex!(`-#$`, "m"); +static object_number_off_dummy_heading = ctRegex!(`-#$`, "m"); static object_number_off_all = ctRegex!(`[~-]#$`, "m"); static repeated_character_line_separator = ctRegex!(`^(?:(?:(?:[.][ ]?){4,}|(?:[-][ ]?|[~][ ]?|[*][ ]?|[$][ ]?|[#][ ]?|[\\][ ]?|[/][ ]?){2,})\s*?)*$`); #+END_SRC @@ -339,7 +339,7 @@ static repeated_character_line_separator = ctRegex!(`^(?:(?:(?:[.][ ] #+BEGIN_SRC d /+ no object_number block +/ static object_number_off_block = ctRegex!(`^--~#$`); -static object_number_off_block_dh = ctRegex!(`^---#$`); +static object_number_off_block_dummy_heading = ctRegex!(`^---#$`); static object_number_off_block_close = ctRegex!(`^--\+#$`); static object_number_block_marks = ctRegex!(`^--[+~-]#$`); #+END_SRC diff --git a/org/meta_abstraction.org b/org/meta_abstraction.org index 890519e..d2adf27 100644 --- a/org/meta_abstraction.org +++ b/org/meta_abstraction.org @@ -206,6 +206,7 @@ enum DocStructMarkupHeading { h_text_5, // extra level, drop content_non_header } // header section A-D; header text 1-4 +enum Status { off, on, } enum OCNstatus { on, off, bkidx, closing, reset, } enum OCN_off_block_status { off, on } enum OCNtype { ocn, non, bkidx, } @@ -591,6 +592,7 @@ comp_obj_heading_.metainfo.is_a = "heading"; comp_obj_heading_.text = "Table of Contents"; comp_obj_heading_.metainfo.ocn = 0; comp_obj_heading_.metainfo.identifier = ""; +comp_obj_heading_.metainfo.dummy_heading = false; comp_obj_heading_.metainfo.object_number_off = true; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.tags.segment_anchor_tag_epub = "toc"; @@ -783,6 +785,7 @@ if there is a glossary section you need to: comp_obj_heading_.text = "Glossary"; comp_obj_heading_.metainfo.ocn = 0; comp_obj_heading_.metainfo.identifier = ""; + comp_obj_heading_.metainfo.dummy_heading = false; comp_obj_heading_.metainfo.object_number_off = true; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.tags.segment_anchor_tag_epub = "_part_glossary"; @@ -805,6 +808,7 @@ if there is a glossary section you need to: comp_obj_heading_.text = "Glossary"; comp_obj_heading_.metainfo.ocn = 0; comp_obj_heading_.metainfo.identifier = ""; + comp_obj_heading_.metainfo.dummy_heading = true; comp_obj_heading_.metainfo.object_number_off = true; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.tags.segment_anchor_tag_epub = "glossary"; @@ -919,6 +923,7 @@ if there is a blurb section you need to: comp_obj_heading_.text = "Blurb"; comp_obj_heading_.metainfo.ocn = 0; comp_obj_heading_.metainfo.identifier = ""; + comp_obj_heading_.metainfo.dummy_heading = false; comp_obj_heading_.metainfo.object_number_off = true; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.tags.segment_anchor_tag_epub = "_part_blurb"; @@ -941,6 +946,7 @@ if there is a blurb section you need to: comp_obj_heading_.text = "Blurb"; comp_obj_heading_.metainfo.ocn = 0; comp_obj_heading_.metainfo.identifier = ""; + comp_obj_heading_.metainfo.dummy_heading = true; comp_obj_heading_.metainfo.object_number_off = true; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.tags.segment_anchor_tag_epub = "blurb"; @@ -966,6 +972,7 @@ if there is a blurb section you need to: comp_obj_heading_.text = line.to!string; comp_obj_heading_.metainfo.ocn = 0; comp_obj_heading_.metainfo.identifier = ""; + comp_obj_heading_.metainfo.dummy_heading = false; comp_obj_heading_.metainfo.object_number_off = true; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.tags.segment_anchor_tag_epub = "blurb"; @@ -1373,6 +1380,7 @@ if ((obj_type_status["heading"] == State.on) an_object["substantive"], an_object["lev_markup_number"], an_object["lev_collapsed_number"], + an_object["dummy_heading_status"], tag_in_seg, lev_anchor_tag, tag_assoc, @@ -1571,6 +1579,7 @@ if (an_object["glossary_nugget"].length == 0) { comp_obj_heading_.text = "(skip) there is no Glossary section"; comp_obj_heading_.metainfo.ocn = 0; comp_obj_heading_.metainfo.identifier = ""; + comp_obj_heading_.metainfo.dummy_heading = true; comp_obj_heading_.metainfo.object_number_off = true; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.metainfo.heading_lev_markup = 1; @@ -1607,6 +1616,7 @@ if (biblio_ordered.length > 0) { comp_obj_heading_.text = "Bibliography"; comp_obj_heading_.metainfo.ocn = 0; comp_obj_heading_.metainfo.identifier = ""; + comp_obj_heading_.metainfo.dummy_heading = true; comp_obj_heading_.metainfo.object_number_off = true; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.tags.segment_anchor_tag_epub = "_part_bibliography"; @@ -1627,6 +1637,7 @@ if (biblio_ordered.length > 0) { comp_obj_heading_.text = "Bibliography"; comp_obj_heading_.metainfo.ocn = 0; comp_obj_heading_.metainfo.identifier = ""; + comp_obj_heading_.metainfo.dummy_heading = true; comp_obj_heading_.metainfo.object_number_off = true; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.tags.segment_anchor_tag_epub = "bibliography"; @@ -1649,6 +1660,7 @@ if (biblio_ordered.length > 0) { comp_obj_heading_.text = "(skip) there is no Bibliography"; comp_obj_heading_.metainfo.ocn = 0; comp_obj_heading_.metainfo.identifier = ""; + comp_obj_heading_.metainfo.dummy_heading = true; comp_obj_heading_.metainfo.object_number_off = true; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.metainfo.heading_lev_markup = 1; @@ -2896,8 +2908,9 @@ comp_obj_heading_.metainfo.is_of_type = "para"; comp_obj_heading_.metainfo.is_a = "heading"; comp_obj_heading_.metainfo.ocn = 0; comp_obj_heading_.metainfo.identifier = ""; -comp_obj_para.metainfo.object_number_off = true; -comp_obj_para.metainfo.object_number_type = 0; +comp_obj_heading_.metainfo.dummy_heading = true; +comp_obj_heading_.metainfo.object_number_off = true; +comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.tags.segment_anchor_tag_epub = ""; comp_obj_heading_.tags.anchor_tag_html = ""; comp_obj_heading_.tags.in_segment_html = ""; @@ -3104,8 +3117,9 @@ static auto _check_ocn_status_(L,T)( writeln(line); } } - if (line.matchFirst(rgx.object_number_off_block_dh)) { + if (line.matchFirst(rgx.object_number_off_block_dummy_heading)) { obj_type_status["ocn_status_off_for_multiple_objects"] = OCN_off_block_status.on; + obj_type_status["heading_off_for_multiple_objects"] = Status.on; obj_type_status["ocn_status"] = OCNstatus.off; debug(ocnoff) { writeln(line); @@ -3113,15 +3127,21 @@ static auto _check_ocn_status_(L,T)( } } else { if (obj_type_status["ocn_status_off_for_multiple_objects"] == OCN_off_block_status.off) { + obj_type_status["dummy_heading_status"] = Status.off; + if (obj_type_status["heading_off_for_multiple_objects"]) { + obj_type_status["dummy_heading_status"] = Status.on; + } if (line.matchFirst(rgx.object_number_off)) { obj_type_status["ocn_status"] = OCNstatus.off; - } else if (line.matchFirst(rgx.object_number_off_dh)) { - obj_type_status["ocn_status"] = OCNstatus.off; + } else if (line.matchFirst(rgx.object_number_off_dummy_heading)) { + obj_type_status["ocn_status"] = OCNstatus.off; + obj_type_status["dummy_heading_status"] = Status.on; } else { - obj_type_status["ocn_status"] = OCNstatus.on; + obj_type_status["ocn_status"] = OCNstatus.on; + obj_type_status["dummy_heading_status"] = Status.off; } } else { - obj_type_status["ocn_status"] = obj_type_status["ocn_status_off_for_multiple_objects"]; + obj_type_status["ocn_status"] = obj_type_status["ocn_status_off_for_multiple_objects"]; } } } else if ( @@ -3131,6 +3151,7 @@ static auto _check_ocn_status_(L,T)( if (line.matchFirst(rgx.object_number_off_block_close)) { obj_type_status["ocn_status_off_for_multiple_objects"] = OCN_off_block_status.off; obj_type_status["ocn_status"] = OCNstatus.on; + obj_type_status["dummy_heading_status"] = Status.off; debug(ocnoff) { writeln(line); } @@ -4991,6 +5012,7 @@ auto _heading_matched_(L,C,O,K,Lv,Lc,T,CMM)( default: an_object["lev_markup_number"] = lv["lv"].to!string; } + an_object["dummy_heading_status"] = (obj_type_status["dummy_heading_status"] == State.off) ? "f" : "t"; debug(heading) { writeln(line.strip); } @@ -5989,6 +6011,7 @@ static struct ObjInlineMarkup { comp_obj_toc.metainfo.identifier = ""; comp_obj_toc.metainfo.object_number_off = true; comp_obj_toc.metainfo.object_number_type = 0; + comp_obj_toc.metainfo.dummy_heading = (an_object["dummy_heading_status"] == "t") ? true: false; comp_obj_toc.attrib.indent_hang = indent["hang_position"]; comp_obj_toc.attrib.indent_base = indent["base_position"]; comp_obj_toc.attrib.bullet = false; @@ -6005,6 +6028,7 @@ static struct ObjInlineMarkup { comp_obj_toc.metainfo.identifier = ""; comp_obj_toc.metainfo.object_number_off = true; comp_obj_toc.metainfo.object_number_type = 0; + comp_obj_toc.metainfo.dummy_heading = (an_object["dummy_heading_status"] == "t") ? true: false; comp_obj_toc.attrib.bullet = false; comp_obj_toc.has.inline_links = true; switch (obj_["lev_markup_number"].to!int) { @@ -6855,6 +6879,7 @@ struct BookIndexReportSection { comp_obj_heading_.text = "Book Index"; comp_obj_heading_.metainfo.ocn = 0; comp_obj_heading_.metainfo.identifier = ""; + comp_obj_heading_.metainfo.dummy_heading = false; comp_obj_heading_.metainfo.object_number_off = true; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.tags.segment_anchor_tag_epub = "_part_book_index"; @@ -6877,6 +6902,7 @@ struct BookIndexReportSection { comp_obj_heading_.text = "Index"; comp_obj_heading_.metainfo.ocn = 0; comp_obj_heading_.metainfo.identifier = ""; + comp_obj_heading_.metainfo.dummy_heading = true; comp_obj_heading_.metainfo.object_number_off = true; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.tags.segment_anchor_tag_epub = "bookindex"; @@ -6953,6 +6979,7 @@ struct BookIndexReportSection { comp_obj_heading_.text = "(skip) there is no Book Index"; comp_obj_heading_.metainfo.ocn = 0; comp_obj_heading_.metainfo.identifier = ""; + comp_obj_heading_.metainfo.dummy_heading = true; comp_obj_heading_.metainfo.object_number_off = true; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.metainfo.heading_lev_markup = 1; @@ -7096,6 +7123,7 @@ struct NotesSection { comp_obj_heading_.text = "Endnotes"; comp_obj_heading_.metainfo.ocn = 0; comp_obj_heading_.metainfo.identifier = ""; + comp_obj_heading_.metainfo.dummy_heading = false; comp_obj_heading_.metainfo.object_number_off = true; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.tags.segment_anchor_tag_epub = "_part_endnotes"; @@ -7117,6 +7145,7 @@ struct NotesSection { comp_obj_heading_.text = "Endnotes"; comp_obj_heading_.metainfo.ocn = 0; comp_obj_heading_.metainfo.identifier = ""; + comp_obj_heading_.metainfo.dummy_heading = true; comp_obj_heading_.metainfo.object_number_off = true; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.tags.segment_anchor_tag_epub = "endnotes"; @@ -7140,6 +7169,7 @@ struct NotesSection { comp_obj_heading_.text = "(skip) there are no Endnotes"; comp_obj_heading_.metainfo.ocn = 0; comp_obj_heading_.metainfo.identifier = ""; + comp_obj_heading_.metainfo.dummy_heading = true; comp_obj_heading_.metainfo.object_number_off = true; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.metainfo.heading_lev_markup = 1; @@ -7157,6 +7187,7 @@ struct NotesSection { comp_obj_endnote_.metainfo.is_a = "endnote"; comp_obj_endnote_.metainfo.ocn = 0; comp_obj_endnote_.metainfo.identifier = ""; + // comp_obj_heading_.metainfo.dummy_heading = false; comp_obj_heading_.metainfo.object_number_off = true; // check comp_obj_heading_.metainfo.object_number_type = 0; // check comp_obj_endnote_.attrib.indent_hang = 0; @@ -7404,10 +7435,11 @@ struct NodeStructureMetadata { #+name: meta_emitters_metadata #+BEGIN_SRC d - ObjGenericComposite node_emitter_heading(T,Lm,Lc,TaB,TaL,TA,N,C,P,LA,I,PSn,fNr,fNs,fL)( + ObjGenericComposite node_emitter_heading(T,Lm,Lc,Hd,TaB,TaL,TA,N,C,P,LA,I,PSn,fNr,fNs,fL)( T _text, Lm lev_markup_number, Lc lev_collapsed_number, + Hd dummy_heading_status, TaB tag_in_seg, TaL lev_anchor_tag, TA tag_assoc, @@ -7544,6 +7576,7 @@ struct NodeStructureMetadata { _comp_obj_heading_.text = _text.to!string.strip; _comp_obj_heading_.metainfo.ocn = obj_cite_digits.object_number; _comp_obj_heading_.metainfo.identifier = obj_cite_digits.identifier; + _comp_obj_heading_.metainfo.dummy_heading = (dummy_heading_status == "t") ? true: false; _comp_obj_heading_.metainfo.object_number_off = obj_cite_digits.off; // _comp_obj_heading_.metainfo.o_n_book_index = obj_cite_digits.bkidx; _comp_obj_heading_.metainfo.object_number_type = obj_cite_digits.type; @@ -7958,6 +7991,7 @@ struct DocObj_MetaInfo_ { } return _out; } + bool dummy_heading = false; int[] markedup_ancestors = [ 0, 0, 0, 0, 0, 0, 0, 0,]; int[] collapsed_ancestors = [ 0, 0, 0, 0, 0, 0, 0, 0,]; int[] dom_structure_markedup_tags_status = [ 0, 0, 0, 0, 0, 0, 0, 0,]; diff --git a/org/output_xmls.org b/org/output_xmls.org index faa273f..747ca9d 100644 --- a/org/output_xmls.org +++ b/org/output_xmls.org @@ -639,9 +639,14 @@ auto inline_markup_scroll(O,M)( M doc_matters, string _suffix = ".html", ) { - _txt = inline_images(_txt, obj, doc_matters, _suffix, "scroll"); - _txt = inline_links(_txt, obj, doc_matters, _suffix, "scroll"); - _txt = inline_notes_scroll(_txt, obj, doc_matters); + if (obj.metainfo.dummy_heading + && (obj.metainfo.is_a == "toc" || obj.metainfo.is_a == "heading")) { + _txt = ""; + } else { + _txt = inline_images(_txt, obj, doc_matters, _suffix, "scroll"); + _txt = inline_links(_txt, obj, doc_matters, _suffix, "scroll"); + _txt = inline_notes_scroll(_txt, obj, doc_matters); + } return _txt; } #+END_SRC @@ -657,8 +662,16 @@ auto inline_markup_seg(O,M)( string _suffix = ".html", string _xml_type = "seg", ) { - _txt = inline_images(_txt, obj, doc_matters, _suffix, _xml_type); // TODO - _txt = inline_links(_txt, obj, doc_matters, _suffix, _xml_type); // TODO + if (obj.metainfo.dummy_heading + && ((_xml_type == "epub" + && (obj.metainfo.is_a == "toc" || obj.metainfo.is_a == "heading")) + || obj.metainfo.is_a == "heading") + ) { + _txt = ""; + } else { + _txt = inline_images(_txt, obj, doc_matters, _suffix, _xml_type); // TODO + _txt = inline_links(_txt, obj, doc_matters, _suffix, _xml_type); // TODO + } auto t = inline_notes_seg(_txt, obj, doc_matters); return t; } @@ -808,7 +821,12 @@ auto heading(O)( heading_lev_anchor_tag = (obj.tags.heading_lev_anchor_tag.empty) ? "" : ""; - if (!(obj.metainfo.identifier.empty)) { + if (_txt.empty) { + o = format(q"┃%s + ┃", + _horizontal_rule, + ); + } else if (!(obj.metainfo.identifier.empty)) { o = format(q"┃%s
@@ -1460,7 +1478,7 @@ void scroll(D,M)( string delimit = ""; #+END_SRC -**** the loops & outer switch (sections & objects) format output +**** ↻ the loops & outer switch (sections & objects) format output #+name: output_html_scroll #+BEGIN_SRC d diff --git a/src/doc_reform/meta/defaults.d b/src/doc_reform/meta/defaults.d index 1bfc859..8fb9b89 100644 --- a/src/doc_reform/meta/defaults.d +++ b/src/doc_reform/meta/defaults.d @@ -37,6 +37,8 @@ template DocReformRgxInitFlags() { "tic_table" : 0, "ocn_status" : 0, // 0 object_number; 1 no object_number; 2 no object_number & dummy headings "ocn_status_off_for_multiple_objects" : 0, // 0 object_number; 1 no object_number; 2 no object_number & dummy headings + "heading_status" : 0, + "heading_off_for_multiple_objects" : 0, "book_index" : 0, ]; return flags_type_init; diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d index 3862403..9ad6004 100644 --- a/src/doc_reform/meta/metadoc_from_src.d +++ b/src/doc_reform/meta/metadoc_from_src.d @@ -50,6 +50,7 @@ template DocReformDocAbstraction() { h_text_5, // extra level, drop content_non_header } // header section A-D; header text 1-4 + enum Status { off, on, } enum OCNstatus { on, off, bkidx, closing, reset, } enum OCN_off_block_status { off, on } enum OCNtype { ocn, non, bkidx, } @@ -406,6 +407,7 @@ template DocReformDocAbstraction() { comp_obj_heading_.text = "Table of Contents"; comp_obj_heading_.metainfo.ocn = 0; comp_obj_heading_.metainfo.identifier = ""; + comp_obj_heading_.metainfo.dummy_heading = false; comp_obj_heading_.metainfo.object_number_off = true; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.tags.segment_anchor_tag_epub = "toc"; @@ -556,6 +558,7 @@ template DocReformDocAbstraction() { comp_obj_heading_.text = "Glossary"; comp_obj_heading_.metainfo.ocn = 0; comp_obj_heading_.metainfo.identifier = ""; + comp_obj_heading_.metainfo.dummy_heading = false; comp_obj_heading_.metainfo.object_number_off = true; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.tags.segment_anchor_tag_epub = "_part_glossary"; @@ -578,6 +581,7 @@ template DocReformDocAbstraction() { comp_obj_heading_.text = "Glossary"; comp_obj_heading_.metainfo.ocn = 0; comp_obj_heading_.metainfo.identifier = ""; + comp_obj_heading_.metainfo.dummy_heading = true; comp_obj_heading_.metainfo.object_number_off = true; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.tags.segment_anchor_tag_epub = "glossary"; @@ -679,6 +683,7 @@ template DocReformDocAbstraction() { comp_obj_heading_.text = "Blurb"; comp_obj_heading_.metainfo.ocn = 0; comp_obj_heading_.metainfo.identifier = ""; + comp_obj_heading_.metainfo.dummy_heading = false; comp_obj_heading_.metainfo.object_number_off = true; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.tags.segment_anchor_tag_epub = "_part_blurb"; @@ -701,6 +706,7 @@ template DocReformDocAbstraction() { comp_obj_heading_.text = "Blurb"; comp_obj_heading_.metainfo.ocn = 0; comp_obj_heading_.metainfo.identifier = ""; + comp_obj_heading_.metainfo.dummy_heading = true; comp_obj_heading_.metainfo.object_number_off = true; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.tags.segment_anchor_tag_epub = "blurb"; @@ -726,6 +732,7 @@ template DocReformDocAbstraction() { comp_obj_heading_.text = line.to!string; comp_obj_heading_.metainfo.ocn = 0; comp_obj_heading_.metainfo.identifier = ""; + comp_obj_heading_.metainfo.dummy_heading = false; comp_obj_heading_.metainfo.object_number_off = true; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.tags.segment_anchor_tag_epub = "blurb"; @@ -1037,6 +1044,7 @@ template DocReformDocAbstraction() { an_object["substantive"], an_object["lev_markup_number"], an_object["lev_collapsed_number"], + an_object["dummy_heading_status"], tag_in_seg, lev_anchor_tag, tag_assoc, @@ -1203,6 +1211,7 @@ template DocReformDocAbstraction() { comp_obj_heading_.text = "(skip) there is no Glossary section"; comp_obj_heading_.metainfo.ocn = 0; comp_obj_heading_.metainfo.identifier = ""; + comp_obj_heading_.metainfo.dummy_heading = true; comp_obj_heading_.metainfo.object_number_off = true; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.metainfo.heading_lev_markup = 1; @@ -1229,6 +1238,7 @@ template DocReformDocAbstraction() { comp_obj_heading_.text = "Bibliography"; comp_obj_heading_.metainfo.ocn = 0; comp_obj_heading_.metainfo.identifier = ""; + comp_obj_heading_.metainfo.dummy_heading = true; comp_obj_heading_.metainfo.object_number_off = true; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.tags.segment_anchor_tag_epub = "_part_bibliography"; @@ -1249,6 +1259,7 @@ template DocReformDocAbstraction() { comp_obj_heading_.text = "Bibliography"; comp_obj_heading_.metainfo.ocn = 0; comp_obj_heading_.metainfo.identifier = ""; + comp_obj_heading_.metainfo.dummy_heading = true; comp_obj_heading_.metainfo.object_number_off = true; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.tags.segment_anchor_tag_epub = "bibliography"; @@ -1271,6 +1282,7 @@ template DocReformDocAbstraction() { comp_obj_heading_.text = "(skip) there is no Bibliography"; comp_obj_heading_.metainfo.ocn = 0; comp_obj_heading_.metainfo.identifier = ""; + comp_obj_heading_.metainfo.dummy_heading = true; comp_obj_heading_.metainfo.object_number_off = true; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.metainfo.heading_lev_markup = 1; @@ -2248,8 +2260,9 @@ template DocReformDocAbstraction() { comp_obj_heading_.metainfo.is_a = "heading"; comp_obj_heading_.metainfo.ocn = 0; comp_obj_heading_.metainfo.identifier = ""; - comp_obj_para.metainfo.object_number_off = true; - comp_obj_para.metainfo.object_number_type = 0; + comp_obj_heading_.metainfo.dummy_heading = true; + comp_obj_heading_.metainfo.object_number_off = true; + comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.tags.segment_anchor_tag_epub = ""; comp_obj_heading_.tags.anchor_tag_html = ""; comp_obj_heading_.tags.in_segment_html = ""; @@ -2406,8 +2419,9 @@ template DocReformDocAbstraction() { writeln(line); } } - if (line.matchFirst(rgx.object_number_off_block_dh)) { + if (line.matchFirst(rgx.object_number_off_block_dummy_heading)) { obj_type_status["ocn_status_off_for_multiple_objects"] = OCN_off_block_status.on; + obj_type_status["heading_off_for_multiple_objects"] = Status.on; obj_type_status["ocn_status"] = OCNstatus.off; debug(ocnoff) { writeln(line); @@ -2415,15 +2429,21 @@ template DocReformDocAbstraction() { } } else { if (obj_type_status["ocn_status_off_for_multiple_objects"] == OCN_off_block_status.off) { + obj_type_status["dummy_heading_status"] = Status.off; + if (obj_type_status["heading_off_for_multiple_objects"]) { + obj_type_status["dummy_heading_status"] = Status.on; + } if (line.matchFirst(rgx.object_number_off)) { obj_type_status["ocn_status"] = OCNstatus.off; - } else if (line.matchFirst(rgx.object_number_off_dh)) { - obj_type_status["ocn_status"] = OCNstatus.off; + } else if (line.matchFirst(rgx.object_number_off_dummy_heading)) { + obj_type_status["ocn_status"] = OCNstatus.off; + obj_type_status["dummy_heading_status"] = Status.on; } else { - obj_type_status["ocn_status"] = OCNstatus.on; + obj_type_status["ocn_status"] = OCNstatus.on; + obj_type_status["dummy_heading_status"] = Status.off; } } else { - obj_type_status["ocn_status"] = obj_type_status["ocn_status_off_for_multiple_objects"]; + obj_type_status["ocn_status"] = obj_type_status["ocn_status_off_for_multiple_objects"]; } } } else if ( @@ -2433,6 +2453,7 @@ template DocReformDocAbstraction() { if (line.matchFirst(rgx.object_number_off_block_close)) { obj_type_status["ocn_status_off_for_multiple_objects"] = OCN_off_block_status.off; obj_type_status["ocn_status"] = OCNstatus.on; + obj_type_status["dummy_heading_status"] = Status.off; debug(ocnoff) { writeln(line); } @@ -3989,6 +4010,7 @@ template DocReformDocAbstraction() { default: an_object["lev_markup_number"] = lv["lv"].to!string; } + an_object["dummy_heading_status"] = (obj_type_status["dummy_heading_status"] == State.off) ? "f" : "t"; debug(heading) { writeln(line.strip); } @@ -4791,6 +4813,7 @@ template DocReformDocAbstraction() { comp_obj_toc.metainfo.identifier = ""; comp_obj_toc.metainfo.object_number_off = true; comp_obj_toc.metainfo.object_number_type = 0; + comp_obj_toc.metainfo.dummy_heading = (an_object["dummy_heading_status"] == "t") ? true: false; comp_obj_toc.attrib.indent_hang = indent["hang_position"]; comp_obj_toc.attrib.indent_base = indent["base_position"]; comp_obj_toc.attrib.bullet = false; @@ -4807,6 +4830,7 @@ template DocReformDocAbstraction() { comp_obj_toc.metainfo.identifier = ""; comp_obj_toc.metainfo.object_number_off = true; comp_obj_toc.metainfo.object_number_type = 0; + comp_obj_toc.metainfo.dummy_heading = (an_object["dummy_heading_status"] == "t") ? true: false; comp_obj_toc.attrib.bullet = false; comp_obj_toc.has.inline_links = true; switch (obj_["lev_markup_number"].to!int) { @@ -5506,6 +5530,7 @@ template DocReformDocAbstraction() { comp_obj_heading_.text = "Book Index"; comp_obj_heading_.metainfo.ocn = 0; comp_obj_heading_.metainfo.identifier = ""; + comp_obj_heading_.metainfo.dummy_heading = false; comp_obj_heading_.metainfo.object_number_off = true; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.tags.segment_anchor_tag_epub = "_part_book_index"; @@ -5528,6 +5553,7 @@ template DocReformDocAbstraction() { comp_obj_heading_.text = "Index"; comp_obj_heading_.metainfo.ocn = 0; comp_obj_heading_.metainfo.identifier = ""; + comp_obj_heading_.metainfo.dummy_heading = true; comp_obj_heading_.metainfo.object_number_off = true; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.tags.segment_anchor_tag_epub = "bookindex"; @@ -5604,6 +5630,7 @@ template DocReformDocAbstraction() { comp_obj_heading_.text = "(skip) there is no Book Index"; comp_obj_heading_.metainfo.ocn = 0; comp_obj_heading_.metainfo.identifier = ""; + comp_obj_heading_.metainfo.dummy_heading = true; comp_obj_heading_.metainfo.object_number_off = true; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.metainfo.heading_lev_markup = 1; @@ -5718,6 +5745,7 @@ template DocReformDocAbstraction() { comp_obj_heading_.text = "Endnotes"; comp_obj_heading_.metainfo.ocn = 0; comp_obj_heading_.metainfo.identifier = ""; + comp_obj_heading_.metainfo.dummy_heading = false; comp_obj_heading_.metainfo.object_number_off = true; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.tags.segment_anchor_tag_epub = "_part_endnotes"; @@ -5739,6 +5767,7 @@ template DocReformDocAbstraction() { comp_obj_heading_.text = "Endnotes"; comp_obj_heading_.metainfo.ocn = 0; comp_obj_heading_.metainfo.identifier = ""; + comp_obj_heading_.metainfo.dummy_heading = true; comp_obj_heading_.metainfo.object_number_off = true; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.tags.segment_anchor_tag_epub = "endnotes"; @@ -5762,6 +5791,7 @@ template DocReformDocAbstraction() { comp_obj_heading_.text = "(skip) there are no Endnotes"; comp_obj_heading_.metainfo.ocn = 0; comp_obj_heading_.metainfo.identifier = ""; + comp_obj_heading_.metainfo.dummy_heading = true; comp_obj_heading_.metainfo.object_number_off = true; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.metainfo.heading_lev_markup = 1; @@ -5779,6 +5809,7 @@ template DocReformDocAbstraction() { comp_obj_endnote_.metainfo.is_a = "endnote"; comp_obj_endnote_.metainfo.ocn = 0; comp_obj_endnote_.metainfo.identifier = ""; + // comp_obj_heading_.metainfo.dummy_heading = false; comp_obj_heading_.metainfo.object_number_off = true; // check comp_obj_heading_.metainfo.object_number_type = 0; // check comp_obj_endnote_.attrib.indent_hang = 0; @@ -5966,10 +5997,11 @@ template DocReformDocAbstraction() { } invariant() { } - ObjGenericComposite node_emitter_heading(T,Lm,Lc,TaB,TaL,TA,N,C,P,LA,I,PSn,fNr,fNs,fL)( + ObjGenericComposite node_emitter_heading(T,Lm,Lc,Hd,TaB,TaL,TA,N,C,P,LA,I,PSn,fNr,fNs,fL)( T _text, Lm lev_markup_number, Lc lev_collapsed_number, + Hd dummy_heading_status, TaB tag_in_seg, TaL lev_anchor_tag, TA tag_assoc, @@ -6106,6 +6138,7 @@ template DocReformDocAbstraction() { _comp_obj_heading_.text = _text.to!string.strip; _comp_obj_heading_.metainfo.ocn = obj_cite_digits.object_number; _comp_obj_heading_.metainfo.identifier = obj_cite_digits.identifier; + _comp_obj_heading_.metainfo.dummy_heading = (dummy_heading_status == "t") ? true: false; _comp_obj_heading_.metainfo.object_number_off = obj_cite_digits.off; // _comp_obj_heading_.metainfo.o_n_book_index = obj_cite_digits.bkidx; _comp_obj_heading_.metainfo.object_number_type = obj_cite_digits.type; diff --git a/src/doc_reform/meta/object_setter.d b/src/doc_reform/meta/object_setter.d index 7b94027..c675f9e 100644 --- a/src/doc_reform/meta/object_setter.d +++ b/src/doc_reform/meta/object_setter.d @@ -68,6 +68,7 @@ template ObjectSetter() { } return _out; } + bool dummy_heading = false; int[] markedup_ancestors = [ 0, 0, 0, 0, 0, 0, 0, 0,]; int[] collapsed_ancestors = [ 0, 0, 0, 0, 0, 0, 0, 0,]; int[] dom_structure_markedup_tags_status = [ 0, 0, 0, 0, 0, 0, 0, 0,]; diff --git a/src/doc_reform/meta/rgx.d b/src/doc_reform/meta/rgx.d index 3dcc214..8982ea5 100644 --- a/src/doc_reform/meta/rgx.d +++ b/src/doc_reform/meta/rgx.d @@ -183,12 +183,12 @@ static template DocReformRgxInit() { static auto_heading_numbering_off_lv4 = ctRegex!(`^4~\S*?-\s`, "m"); /+ no object_number object +/ static object_number_off = ctRegex!(`~#[ ]*$`, "m"); - static object_number_off_dh = ctRegex!(`-#$`, "m"); + static object_number_off_dummy_heading = ctRegex!(`-#$`, "m"); static object_number_off_all = ctRegex!(`[~-]#$`, "m"); static repeated_character_line_separator = ctRegex!(`^(?:(?:(?:[.][ ]?){4,}|(?:[-][ ]?|[~][ ]?|[*][ ]?|[$][ ]?|[#][ ]?|[\\][ ]?|[/][ ]?){2,})\s*?)*$`); /+ no object_number block +/ static object_number_off_block = ctRegex!(`^--~#$`); - static object_number_off_block_dh = ctRegex!(`^---#$`); + static object_number_off_block_dummy_heading = ctRegex!(`^---#$`); static object_number_off_block_close = ctRegex!(`^--\+#$`); static object_number_block_marks = ctRegex!(`^--[+~-]#$`); /+ ignore outside code blocks +/ diff --git a/src/doc_reform/output/xmls.d b/src/doc_reform/output/xmls.d index 30e876d..ffcbd1a 100644 --- a/src/doc_reform/output/xmls.d +++ b/src/doc_reform/output/xmls.d @@ -502,9 +502,14 @@ template outputXHTMLs() { M doc_matters, string _suffix = ".html", ) { - _txt = inline_images(_txt, obj, doc_matters, _suffix, "scroll"); - _txt = inline_links(_txt, obj, doc_matters, _suffix, "scroll"); - _txt = inline_notes_scroll(_txt, obj, doc_matters); + if (obj.metainfo.dummy_heading + && (obj.metainfo.is_a == "toc" || obj.metainfo.is_a == "heading")) { + _txt = ""; + } else { + _txt = inline_images(_txt, obj, doc_matters, _suffix, "scroll"); + _txt = inline_links(_txt, obj, doc_matters, _suffix, "scroll"); + _txt = inline_notes_scroll(_txt, obj, doc_matters); + } return _txt; } auto inline_markup_seg(O,M)( @@ -514,8 +519,16 @@ template outputXHTMLs() { string _suffix = ".html", string _xml_type = "seg", ) { - _txt = inline_images(_txt, obj, doc_matters, _suffix, _xml_type); // TODO - _txt = inline_links(_txt, obj, doc_matters, _suffix, _xml_type); // TODO + if (obj.metainfo.dummy_heading + && ((_xml_type == "epub" + && (obj.metainfo.is_a == "toc" || obj.metainfo.is_a == "heading")) + || obj.metainfo.is_a == "heading") + ) { + _txt = ""; + } else { + _txt = inline_images(_txt, obj, doc_matters, _suffix, _xml_type); // TODO + _txt = inline_links(_txt, obj, doc_matters, _suffix, _xml_type); // TODO + } auto t = inline_notes_seg(_txt, obj, doc_matters); return t; } @@ -645,7 +658,12 @@ template outputXHTMLs() { heading_lev_anchor_tag = (obj.tags.heading_lev_anchor_tag.empty) ? "" : ""; - if (!(obj.metainfo.identifier.empty)) { + if (_txt.empty) { + o = format(q"┃%s + ┃", + _horizontal_rule, + ); + } else if (!(obj.metainfo.identifier.empty)) { o = format(q"┃%s
-- cgit v1.2.3