diff options
author | Ralph Amissah <ralph@amissah.com> | 2016-09-06 20:58:58 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2019-04-10 15:14:13 -0400 |
commit | ff78ec1fffc029a6947528f4b546dde57a633549 (patch) | |
tree | 7b77ccd936719da2538ade75d3bdeb4a8c490a59 /org | |
parent | naming of para indent attributes (diff) |
0.6.8 work on heading & anchor tag attributes, re-fix header_make headings
Diffstat (limited to 'org')
-rw-r--r-- | org/ao_abstract_doc_source.org | 83 | ||||
-rw-r--r-- | org/ao_defaults.org | 1 | ||||
-rw-r--r-- | org/sdp.org | 2 |
3 files changed, 60 insertions, 26 deletions
diff --git a/org/ao_abstract_doc_source.org b/org/ao_abstract_doc_source.org index b2f38c8..6bbf233 100644 --- a/org/ao_abstract_doc_source.org +++ b/org/ao_abstract_doc_source.org @@ -463,11 +463,11 @@ if (matchFirst(line, rgx.block_open)) { && ((type["para"] == State.off) && (type["heading"] == State.off))) { /+ heading or para but neither flag nor line exists +/ - if ((to!string(dochead_make_json["make"]["headings"]).length > 2) + if ((dochead_make_aa["make"]["headings"].length > 2) && (type["make_headings"] == State.off)) { /+ heading found +/ auto dochead_make_headings = - to!string(dochead_make_json["make"]["headings"]); + dochead_make_aa["make"]["headings"]; heading_found(line, dochead_make_headings, heading_match_str, heading_match_rgx, type); } if ((type["make_headings"] == State.on) @@ -480,7 +480,7 @@ if (matchFirst(line, rgx.block_open)) { } if (matchFirst(line, rgx.heading)) { /+ heading match +/ - heading_matched(line, line_occur, an_object, lv, collapsed_lev, type, dochead_meta_json); + heading_matched(line, line_occur, an_object, lv, collapsed_lev, type, dochead_meta_aa); } else if (line_occur["para"] == State.off) { /+ para match +/ para_match(line, an_object, indent, bullet, type, line_occur); @@ -1773,7 +1773,7 @@ auto block_flag_line_empty( an_object["attrib"] = obj_att.obj_attributes(an_object["is"], an_object["obj"], node); contents_the_objects ~= - set_abstract_object.contents_block( + set_abstract_object.contents_block_code( an_object["is"], an_object["substantive"], an_object["attrib"], @@ -2007,19 +2007,15 @@ auto heading_found( ref Regex!(char)[string] heading_match_rgx, ref int[string] type ) { - if ((to!string(dochead_make_headings).length > 2) + if ((dochead_make_headings.length > 2) && (type["make_headings"] == State.off)) { /+ headings found +/ debug(headingsfound) { writeln(dochead_make_headings); } - auto make_headings_txt = - match( - to!string(dochead_make_headings), - rgx.within_quotes); char[][] make_headings_spl = split( - cast(char[]) make_headings_txt.captures[1], + cast(char[]) dochead_make_headings, rgx.make_heading_delimiter); debug(headingsfound) { writeln(make_headings_spl.length); @@ -2163,7 +2159,7 @@ auto heading_matched( ref int[string] lv, ref int[string] collapsed_lev, ref int[string] type, - ref string[string][string] dochead_meta_json + ref string[string][string] dochead_meta_aa ) { if (auto m = match(line, rgx.heading)) { /+ heading match +/ @@ -2177,8 +2173,8 @@ auto heading_matched( assertions_doc_structure(an_object, lv); // includes most of the logic for collapsed levels switch (an_object["lev"]) { case "A": - an_object["obj"]=replaceFirst(an_object["obj"], rgx.variable_doc_title, to!string(dochead_meta_json["title"]["main"])); - an_object["obj"]=replaceFirst(an_object["obj"], rgx.variable_doc_author, to!string(dochead_meta_json["creator"]["author"])); + an_object["obj"]=replaceFirst(an_object["obj"], rgx.variable_doc_title, to!string(dochead_meta_aa["title"]["main"])); + an_object["obj"]=replaceFirst(an_object["obj"], rgx.variable_doc_author, to!string(dochead_meta_aa["creator"]["author"])); collapsed_lev["h0"] = 1; an_object["lev_collapsed_number"] = to!string(collapsed_lev["h0"]); @@ -3271,10 +3267,7 @@ struct NotesSection { ++obj_cite_number; ++mkn; foreach (endnote; endnotes_) { - type="para"; attrib=""; - indent["first"] = "0"; - indent["second"] = "0"; attrib=""; // endnotes ~= // set_abstract_object.contents_para( @@ -3284,15 +3277,9 @@ struct NotesSection { // false // ); endnotes_section ~= - set_abstract_object.contents_para( - type, + set_abstract_object.contents_endnote( endnote, - attrib, - obj_cite_number, - indent, - false ); - ++obj_cite_number; ++mkn; } auto t = tuple(endnotes_section, obj_cite_number); @@ -3874,6 +3861,7 @@ struct ParaAttrib { bool bullet = false; } struct BlockAttrib { + string syntax = ""; } struct Comment { // no .attrib and no .obj_cite_number @@ -3967,6 +3955,29 @@ auto contents_para( } #+END_SRC +*** para_endnote :para: + +#+name: ao_object_setter +#+BEGIN_SRC d +auto contents_endnote( + in string object, +) { + auto m = (matchFirst(object, rgx.note_ref)); + string notenumber = to!string(m.captures[1]); + string anchor_tag = "note_" ~ notenumber; + ObjComposite object_set; + object_set.use = "content"; + object_set.of = "para"; + object_set.is_a = "endnote"; + object_set.object = object.strip; + object_set.obj_cite_number = ""; + object_set.para_attrib.indent_start = 0; + object_set.para_attrib.indent_rest = 0; + object_set.para_attrib.bullet = false; + return object_set; +} +#+END_SRC + *** block :block: #+name: ao_object_setter @@ -3988,6 +3999,28 @@ auto contents_block( } #+END_SRC +*** block code :block:code: + +#+name: ao_object_setter +#+BEGIN_SRC d +auto contents_block_code( + in string type, + in string object, + in string attrib_language_syntax, + in int obj_cite_number +) { + ObjComposite object_set; + object_set.use = "content"; + object_set.of = "block"; + object_set.is_a = type; + object_set.block_attrib.syntax = attrib_language_syntax; + object_set.object = object; + object_set.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); + // object_set.node_structure.node = node; + return object_set; +} +#+END_SRC + *** block obj_cite_number string :block: #+name: ao_object_setter @@ -4029,8 +4062,8 @@ template SiSUdocAbstraction() { /+ ↓ abstract marked up document +/ auto abstract_doc_source( char[][] markup_sourcefile_content, - string[string][string] dochead_make_json, - string[string][string] dochead_meta_json + string[string][string] dochead_make_aa, + string[string][string] dochead_meta_aa ) { /+ ↓ abstraction init +/ <<abs_init_rest>> diff --git a/org/ao_defaults.org b/org/ao_defaults.org index 78b1de8..3ea0a6f 100644 --- a/org/ao_defaults.org +++ b/org/ao_defaults.org @@ -721,6 +721,7 @@ static inline_notes_square = ctRegex!(`~\[\s*(.+?)\]~`, "mg"); static inline_text_and_note_square_sp = ctRegex!(`(.+?)~\[[*+]+\s+(.+?)\]~`, "mg"); static inline_text_and_note_square = ctRegex!(`(.+?)~\[\s*(.+?)\]~`, "mg"); static inline_note_square_delimiters = ctRegex!(`(~\[\s*)(.+?)(\]~)`, "mg"); +static note_ref = ctRegex!(`^\S+?noteref_([0-9]+)`, "mg"); // {^{73.}^}#noteref_73 #+END_SRC ** inline markup book index :inline:bookindex: diff --git a/org/sdp.org b/org/sdp.org index 2c28c18..af16b3d 100644 --- a/org/sdp.org +++ b/org/sdp.org @@ -24,7 +24,7 @@ struct Version { int minor; int patch; } -enum ver = Version(0, 6, 7); +enum ver = Version(0, 6, 8); #+END_SRC * sdp.d sisu document parser :sdp.d: |