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 --- src/doc_reform/meta/metadoc_from_src.d | 49 ++++++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 8 deletions(-) (limited to 'src/doc_reform/meta/metadoc_from_src.d') 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; -- cgit v1.2.3