aboutsummaryrefslogtreecommitdiffhomepage
path: root/org
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2019-04-20 14:44:42 -0400
committerRalph Amissah <ralph.amissah@gmail.com>2019-05-17 16:59:54 -0400
commitd60c328d3bd3d1a8be39dd835b2ee96640490120 (patch)
tree9f0c930715dcf9ba2fd5800447b96f49fad1b82c /org
parenttext format delimiter, use: "┃" instead of "┋" (diff)
(segmented html) dummy heading related
Diffstat (limited to 'org')
-rw-r--r--org/default_misc.org2
-rw-r--r--org/default_regex.org4
-rw-r--r--org/meta_abstraction.org50
-rw-r--r--org/output_xmls.org32
4 files changed, 71 insertions, 17 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)
? ""
: "<a name=\"" ~ obj.tags.heading_lev_anchor_tag ~ "\"></a>";
- if (!(obj.metainfo.identifier.empty)) {
+ if (_txt.empty) {
+ o = format(q"┃%s
+ ┃",
+ _horizontal_rule,
+ );
+ } else if (!(obj.metainfo.identifier.empty)) {
o = format(q"┃%s
<div class="substance">
<label class="ocn"><a href="#%s" class="lnkocn">%s</a></label>
@@ -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