From f0c4dcbc6b00dd66b115bd27953b7e54710b6ae3 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 18 Feb 2017 12:42:01 -0500 Subject: 0.13.3 tuples, sdp & doc_abstraction (flag marked up links & endnotes) --- org/ao_doc_abstraction.org | 232 ++++++++++++++++++++++++++++++--------------- org/sdp.org | 49 +++++----- 2 files changed, 181 insertions(+), 100 deletions(-) (limited to 'org') diff --git a/org/ao_doc_abstraction.org b/org/ao_doc_abstraction.org index 69093b6..63491de 100644 --- a/org/ao_doc_abstraction.org +++ b/org/ao_doc_abstraction.org @@ -397,6 +397,7 @@ string[][string][string] bookindex_unordered_hashes; /+ node +/ ObjGenericComposite comp_obj_heading, comp_obj_location, comp_obj_block, comp_obj_code, comp_obj_poem_ocn, comp_obj_comment; auto node_construct = NodeStructureMetadata(); +enum sObj { content, anchor_tags, notes_reg, notes_star, links } #+END_SRC *** scope @@ -1037,9 +1038,9 @@ if ((type["heading"] == State.on) an_object["is"] = "heading"; an_object_key="body_nugget"; auto substantive_object_and_anchor_tags_tuple = - obj_im.obj_inline_markup_and_anchor_tags(an_object, an_object_key, dochead_make_aa); - an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; - anchor_tags = substantive_object_and_anchor_tags_tuple[1]; + obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa); + an_object["substantive"] = substantive_object_and_anchor_tags_tuple[sObj.content]; + anchor_tags = substantive_object_and_anchor_tags_tuple[sObj.anchor_tags]; if (to!int(an_object["lev_markup_number"]) == 4) { segment_anchor_tag_that_object_belongs_to = anchor_tags[0]; segment_anchor_tag_that_object_belongs_to_uri = anchor_tags[0] ~ ".fnSuffix"; @@ -1079,6 +1080,9 @@ if ((type["heading"] == State.on) lv_ancestors, // string[] an_object["is"], // string html_segnames_ptr, // int + substantive_object_and_anchor_tags_tuple[sObj.notes_reg], + substantive_object_and_anchor_tags_tuple[sObj.notes_star], + substantive_object_and_anchor_tags_tuple[sObj.links], ); ++heading_ptr; debug(segments) { @@ -1118,10 +1122,10 @@ if ((type["heading"] == State.on) heading_ptr-1, an_object["is"], ); - auto substantive_object_and_anchor_tags_tuple = - obj_im.obj_inline_markup_and_anchor_tags(an_object, an_object_key, dochead_make_aa); - an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; - anchor_tags = substantive_object_and_anchor_tags_tuple[1]; + auto substantive_obj_misc_tuple = + obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa); + an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; + anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; comp_obj_para = comp_obj_para.init; comp_obj_para.use = "body"; comp_obj_para.is_of = "para"; @@ -1133,6 +1137,9 @@ if ((type["heading"] == State.on) comp_obj_para.indent_base = indent["base_position"]; comp_obj_para.bullet = bullet; comp_obj_para.anchor_tags = anchor_tags; + comp_obj_para.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; + comp_obj_para.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; + comp_obj_para.inline_links = substantive_obj_misc_tuple[sObj.links]; the_document_body_section ~= comp_obj_para; _common_reset_(line_occur, an_object, type); indent=[ @@ -2658,10 +2665,10 @@ void _poem_block_(L,O,T,C,N,Ma)( ); } an_object["is"] = "verse"; - auto substantive_object_and_anchor_tags_tuple = - obj_im.obj_inline_markup_and_anchor_tags(an_object, an_object_key, dochead_make_aa); - an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; - anchor_tags = substantive_object_and_anchor_tags_tuple[1]; + auto substantive_obj_misc_tuple = + obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa); + an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; + anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; comp_obj_block = comp_obj_block.init; comp_obj_block.use = "body"; comp_obj_block.is_of = "block"; @@ -2669,6 +2676,9 @@ void _poem_block_(L,O,T,C,N,Ma)( comp_obj_block.ocn = obj_cite_number; comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); comp_obj_block.text = an_object["substantive"]; + comp_obj_block.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; + comp_obj_block.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; + comp_obj_block.inline_links = substantive_obj_misc_tuple[sObj.links]; the_document_body_section ~= comp_obj_block; object_reset(an_object); processing.remove("verse"); @@ -2709,10 +2719,10 @@ void _poem_block_(L,O,T,C,N,Ma)( heading_ptr-1, an_object["is"] ); - auto substantive_object_and_anchor_tags_tuple = - obj_im.obj_inline_markup_and_anchor_tags(an_object, an_object_key, dochead_make_aa); - an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; - anchor_tags = substantive_object_and_anchor_tags_tuple[1]; + auto substantive_obj_misc_tuple = + obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa); + an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; + anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; comp_obj_block = comp_obj_block.init; comp_obj_block.use = "body"; comp_obj_block.is_of = "block"; @@ -2720,6 +2730,9 @@ void _poem_block_(L,O,T,C,N,Ma)( comp_obj_block.ocn = obj_cite_number; comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); comp_obj_block.text = an_object["substantive"]; + comp_obj_block.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; + comp_obj_block.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; + comp_obj_block.inline_links = substantive_obj_misc_tuple[sObj.links]; the_document_body_section ~= comp_obj_block; object_reset(an_object); processing.remove("verse"); @@ -2745,10 +2758,10 @@ void _poem_block_(L,O,T,C,N,Ma)( } processing.remove("verse"); an_object["is"] = "verse"; - auto substantive_object_and_anchor_tags_tuple = - obj_im.obj_inline_markup_and_anchor_tags(an_object, an_object_key, dochead_make_aa); - an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; - anchor_tags = substantive_object_and_anchor_tags_tuple[1]; + auto substantive_obj_misc_tuple = + obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa); + an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; + anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; comp_obj_block = comp_obj_block.init; comp_obj_block.use = "body"; comp_obj_block.is_of = "block"; @@ -2756,6 +2769,9 @@ void _poem_block_(L,O,T,C,N,Ma)( comp_obj_block.ocn = obj_cite_number; comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); comp_obj_block.text = an_object["substantive"]; + comp_obj_block.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; + comp_obj_block.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; + comp_obj_block.inline_links = substantive_obj_misc_tuple[sObj.links]; the_document_body_section ~= comp_obj_block; obj_cite_number_poem["end"] = to!string(obj_cite_number); object_reset(an_object); @@ -2796,10 +2812,10 @@ void _poem_block_(L,O,T,C,N,Ma)( heading_ptr-1, an_object["is"] ); - auto substantive_object_and_anchor_tags_tuple = - obj_im.obj_inline_markup_and_anchor_tags(an_object, an_object_key, dochead_make_aa); - an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; - anchor_tags = substantive_object_and_anchor_tags_tuple[1]; + auto substantive_obj_misc_tuple = + obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa); + an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; + anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; comp_obj_block = comp_obj_block.init; comp_obj_block.use = "body"; comp_obj_block.is_of = "block"; @@ -2807,6 +2823,9 @@ void _poem_block_(L,O,T,C,N,Ma)( comp_obj_block.ocn = obj_cite_number; comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); comp_obj_block.text = an_object["substantive"]; + comp_obj_block.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; + comp_obj_block.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; + comp_obj_block.inline_links = substantive_obj_misc_tuple[sObj.links]; the_document_body_section ~= comp_obj_block; object_reset(an_object); processing.remove("verse"); @@ -3049,10 +3068,10 @@ void _block_flag_line_empty_(B)( heading_ptr-1, an_object["is"] ); - auto substantive_object_and_anchor_tags_tuple = - obj_im.obj_inline_markup_and_anchor_tags(an_object, an_object_key, dochead_make_aa); - an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; - anchor_tags = substantive_object_and_anchor_tags_tuple[1]; + auto substantive_obj_misc_tuple = + obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa); + an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; + anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; comp_obj_code = comp_obj_code.init; comp_obj_code.use = "body"; comp_obj_code.is_of = "block"; @@ -3060,6 +3079,9 @@ void _block_flag_line_empty_(B)( comp_obj_code.ocn = obj_cite_number; comp_obj_code.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); comp_obj_code.text = an_object["substantive"]; + comp_obj_code.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; + comp_obj_code.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; + comp_obj_code.inline_links = substantive_obj_misc_tuple[sObj.links]; the_document_body_section ~= comp_obj_code; object_reset(an_object); processing.remove("verse"); @@ -3110,10 +3132,10 @@ void _block_flag_line_empty_(B)( heading_ptr-1, an_object["is"] ); - auto substantive_object_and_anchor_tags_tuple = - obj_im.obj_inline_markup_and_anchor_tags(an_object, an_object_key, dochead_make_aa); - an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; - anchor_tags = substantive_object_and_anchor_tags_tuple[1]; + auto substantive_obj_misc_tuple = + obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa); + an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; + anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; comp_obj_block = comp_obj_block.init; comp_obj_block.use = "body"; comp_obj_block.is_of = "block"; @@ -3121,6 +3143,9 @@ void _block_flag_line_empty_(B)( comp_obj_block.ocn = obj_cite_number; comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); comp_obj_block.text = an_object["substantive"]; + comp_obj_block.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; + comp_obj_block.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; + comp_obj_block.inline_links = substantive_obj_misc_tuple[sObj.links]; the_document_body_section ~= comp_obj_block; object_reset(an_object); processing.remove("verse"); @@ -3144,10 +3169,10 @@ void _block_flag_line_empty_(B)( heading_ptr-1, an_object["is"] ); - auto substantive_object_and_anchor_tags_tuple = - obj_im.obj_inline_markup_and_anchor_tags(an_object, an_object_key, dochead_make_aa); - an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; - anchor_tags = substantive_object_and_anchor_tags_tuple[1]; + auto substantive_obj_misc_tuple = + obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa); + an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; + anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; comp_obj_block = comp_obj_block.init; comp_obj_block.use = "body"; comp_obj_block.is_of = "block"; @@ -3155,6 +3180,9 @@ void _block_flag_line_empty_(B)( comp_obj_block.ocn = obj_cite_number; comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); comp_obj_block.text = an_object["substantive"]; + comp_obj_block.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; + comp_obj_block.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; + comp_obj_block.inline_links = substantive_obj_misc_tuple[sObj.links]; the_document_body_section ~= comp_obj_block; object_reset(an_object); processing.remove("verse"); @@ -3177,10 +3205,10 @@ void _block_flag_line_empty_(B)( heading_ptr-1, an_object["is"] ); - auto substantive_object_and_anchor_tags_tuple = - obj_im.obj_inline_markup_and_anchor_tags(an_object, an_object_key, dochead_make_aa); - an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; - anchor_tags = substantive_object_and_anchor_tags_tuple[1]; + auto substantive_obj_misc_tuple = + obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa); + an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; + anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; comp_obj_block = comp_obj_block.init; comp_obj_block.use = "body"; comp_obj_block.is_of = "block"; @@ -3188,6 +3216,9 @@ void _block_flag_line_empty_(B)( comp_obj_block.ocn = obj_cite_number; comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); comp_obj_block.text = an_object["substantive"]; + comp_obj_block.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; + comp_obj_block.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; + comp_obj_block.inline_links = substantive_obj_misc_tuple[sObj.links]; the_document_body_section ~= comp_obj_block; object_reset(an_object); processing.remove("verse"); @@ -3211,10 +3242,10 @@ void _block_flag_line_empty_(B)( heading_ptr-1, an_object["is"] ); - auto substantive_object_and_anchor_tags_tuple = - obj_im.obj_inline_markup_and_anchor_tags(an_object, an_object_key, dochead_make_aa); - an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; - anchor_tags = substantive_object_and_anchor_tags_tuple[1]; + auto substantive_obj_misc_tuple = + obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa); // ... + an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; // ... + anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; comp_obj_block = comp_obj_block.init; comp_obj_block.use = "body"; comp_obj_block.is_of = "block"; @@ -3222,6 +3253,9 @@ void _block_flag_line_empty_(B)( comp_obj_block.ocn = obj_cite_number; comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); comp_obj_block.text = an_object["substantive"]; + comp_obj_block.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; + comp_obj_block.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; + comp_obj_block.inline_links = substantive_obj_misc_tuple[sObj.links]; the_document_body_section ~= comp_obj_block; object_reset(an_object); processing.remove("verse"); @@ -3794,11 +3828,13 @@ struct ObjInlineMarkupMunge { } return obj_txt_in; } - string footnotes_endnotes_markup_and_number_or_stars(Ot)(Ot obj_txt_in, bool reset_note_numbers) { // here endnotes are marked up + auto footnotes_endnotes_markup_and_number_or_stars(Ot)(Ot obj_txt_in, bool reset_note_numbers) { debug(asserts){ static assert(is(typeof(obj_txt_in) == string)); } /+ endnotes (regular) +/ + bool notes_reg = false; + bool notes_star = false; obj_txt_in = replaceAll( obj_txt_in, @@ -3819,6 +3855,7 @@ struct ObjInlineMarkupMunge { stage_reset_note_numbers = false; foreach(n; m) { if (match(to!string(n.hit), rgx.inline_al_delimiter_open_symbol_star)) { + notes_star = true; ++n_foot_sp_asterisk; asterisks_ = "*"; n_foot=n_foot_sp_asterisk; @@ -3829,6 +3866,7 @@ struct ObjInlineMarkupMunge { (mkup.en_a_o ~ replicate(asterisks_, n_foot_sp_asterisk) ~ " ") ) ~ "\n"); } else if (match(to!string(n.hit), rgx.inline_al_delimiter_open_regular)) { + notes_reg = true; ++n_foot_reg; n_foot=n_foot_reg; obj_txt_out ~= @@ -3845,9 +3883,14 @@ struct ObjInlineMarkupMunge { } else { obj_txt_out = obj_txt_in; } - return obj_txt_out; + auto t = tuple( + obj_txt_out, + notes_reg, + notes_star, + ); + return t; } - private auto object_notes_(Ot)(Ot obj_txt_in, bool reset_note_numbers=false) + private auto object_notes_and_links_(Ot)(Ot obj_txt_in, bool reset_note_numbers=false) in { debug(asserts){ assert(is(typeof(obj_txt_in) == string)); @@ -3855,6 +3898,7 @@ struct ObjInlineMarkupMunge { } body { obj_txt_out = ""; + bool urls = false; tail = ""; /+ special endnotes +/ obj_txt_in = replaceAll( @@ -3870,9 +3914,11 @@ struct ObjInlineMarkupMunge { ); /+ url matched +/ if (match(obj_txt_in, rgx.inline_url)) { + urls = true; obj_txt_in = url_links(obj_txt_in); } - obj_txt_out = footnotes_endnotes_markup_and_number_or_stars(obj_txt_in, reset_note_numbers); + auto ftn = footnotes_endnotes_markup_and_number_or_stars(obj_txt_in, reset_note_numbers); + obj_txt_out = ftn[0]; debug(footnotes) { writeln(obj_txt_out, tail); } @@ -3884,9 +3930,23 @@ struct ObjInlineMarkupMunge { writeln(m.hit); } } - return obj_txt_out; + auto t = tuple( + to!string(obj_txt_out), + ftn[1], + ftn[2], + urls, + ); + return t; } - string para(Ot)(Ot obj_txt_in) + auto init() + in { } + body { + auto t = object_notes_and_links_(""); + return t; + } + invariant() { + } + auto para(Ot)(Ot obj_txt_in) in { debug(asserts){ static assert(is(typeof(obj_txt_in) == string)); @@ -3896,16 +3956,16 @@ struct ObjInlineMarkupMunge { obj_txt["munge"]=obj_txt_in; obj_txt["munge"]=replaceFirst(obj_txt["munge"], rgx.para_attribs, ""); obj_txt["munge"]=replaceFirst(obj_txt["munge"], rgx.obj_cite_number_off_all, ""); - obj_txt["munge"]=object_notes_(obj_txt["munge"]); + auto t = object_notes_and_links_(obj_txt["munge"]); debug(munge) { writeln(__LINE__); writeln(obj_txt_in); writeln(__LINE__); writeln(to!string(obj_txt["munge"])); } - return obj_txt["munge"]; + return t; } - string heading(Ot)(Ot obj_txt_in, bool reset_note_numbers=false) + auto heading(Ot)(Ot obj_txt_in, bool reset_note_numbers=false) in { debug(asserts){ static assert(is(typeof(obj_txt_in) == string)); @@ -3916,14 +3976,14 @@ struct ObjInlineMarkupMunge { obj_txt["munge"]=replaceFirst(obj_txt["munge"], rgx.heading, ""); obj_txt["munge"]=replaceFirst(obj_txt["munge"], rgx.obj_cite_number_off_all, ""); obj_txt["munge"]=strip(obj_txt["munge"]); - obj_txt["munge"]=object_notes_(obj_txt["munge"], reset_note_numbers); + auto t = object_notes_and_links_(obj_txt["munge"], reset_note_numbers); debug(munge) { writeln(__LINE__); writeln(obj_txt_in); writeln(__LINE__); writeln(to!string(obj_txt["munge"])); } - return obj_txt["munge"]; + return t; } invariant() { } @@ -3940,16 +4000,16 @@ struct ObjInlineMarkupMunge { } invariant() { } - string group(string obj_txt_in) + auto group(string obj_txt_in) in { } body { obj_txt["munge"]=obj_txt_in; - obj_txt["munge"]=object_notes_(obj_txt["munge"]); - return obj_txt["munge"]; + auto t = object_notes_and_links_(obj_txt["munge"]); + return t; } invariant() { } - string block(Ot)(Ot obj_txt_in) + auto block(Ot)(Ot obj_txt_in) in { debug(asserts){ static assert(is(typeof(obj_txt_in) == string)); @@ -3957,12 +4017,12 @@ struct ObjInlineMarkupMunge { } body { obj_txt["munge"]=obj_txt_in; - obj_txt["munge"]=object_notes_(obj_txt["munge"]); - return obj_txt["munge"]; + auto t = object_notes_and_links_(obj_txt["munge"]); + return t; } invariant() { } - string verse(Ot)(Ot obj_txt_in) + auto verse(Ot)(Ot obj_txt_in) in { debug(asserts){ static assert(is(typeof(obj_txt_in) == string)); @@ -3970,8 +4030,8 @@ struct ObjInlineMarkupMunge { } body { obj_txt["munge"]=obj_txt_in; - obj_txt["munge"]=object_notes_(obj_txt["munge"]); - return obj_txt["munge"]; + auto t = object_notes_and_links_(obj_txt["munge"]); + return t; } invariant() { } @@ -4029,7 +4089,7 @@ struct ObjInlineMarkup { #+name: ao_emitters_obj_inline_markup_and_anchor_tags_and_misc #+BEGIN_SRC d - auto obj_inline_markup_and_anchor_tags(O,K,Ma)( + auto obj_inline_markup_and_anchor_tags_and_misc(O,K,Ma)( O obj_, K obj_key_, Ma dochead_make_aa @@ -4047,6 +4107,11 @@ struct ObjInlineMarkup { ? obj_txt["munge"] : strip(obj_txt["munge"]); static __gshared string[] anchor_tags_ = []; + auto x = munge.init; + bool[string] obj_notes_and_links; + obj_notes_and_links["notes_reg"] = false; + obj_notes_and_links["notes_star"] = false; + obj_notes_and_links["links"] = false; switch (obj_["is"]) { case "heading": static __gshared string anchor_tag = ""; @@ -4059,23 +4124,23 @@ struct ObjInlineMarkup { } else if (obj_["lev"] == "1") { writeln("heading anchor tag missing: ", obj_txt["munge"]); } - obj_txt["munge"]=munge.heading(obj_txt["munge"], reset_note_numbers); + x =munge.heading(obj_txt["munge"], reset_note_numbers); reset_note_numbers=false; - break; + goto default; case "para": - obj_txt["munge"]=munge.para(obj_txt["munge"]); - break; - case "code": - obj_txt["munge"]=munge.code(obj_txt["munge"]); - break; + x = munge.para(obj_txt["munge"]); + goto default; case "group": - obj_txt["munge"]=munge.group(obj_txt["munge"]); - break; + x = munge.group(obj_txt["munge"]); + goto default; case "block": - obj_txt["munge"]=munge.block(obj_txt["munge"]); - break; + x = munge.block(obj_txt["munge"]); + goto default; case "verse": - obj_txt["munge"]=munge.verse(obj_txt["munge"]); + x = munge.verse(obj_txt["munge"]); + goto default; + case "code": + obj_txt["munge"]=munge.code(obj_txt["munge"]); break; case "quote": obj_txt["munge"]=munge.quote(obj_txt["munge"]); @@ -4090,11 +4155,18 @@ struct ObjInlineMarkup { munge.initialize_note_numbers(); break; default: + obj_txt["munge"]=x[0]; + obj_notes_and_links["notes_reg"] = x[1]; + obj_notes_and_links["notes_star"] = x[2]; + obj_notes_and_links["links"] = x[3]; break; } auto t = tuple( obj_txt["munge"], anchor_tags_, + obj_notes_and_links["notes_reg"], + obj_notes_and_links["notes_star"], + obj_notes_and_links["links"], ); anchor_tags_=[]; return t; @@ -5572,7 +5644,7 @@ struct NodeStructureMetadata { #+name: ao_emitters_metadata #+BEGIN_SRC d - ObjGenericComposite node_emitter_heading(T,L,Lm,Lc,Ta,N,C,P,LA,I,PSn)( + ObjGenericComposite node_emitter_heading(T,L,Lm,Lc,Ta,N,C,P,LA,I,PSn,fNr,fNs,fL)( T _text, L lev, Lm lev_markup_number, @@ -5584,6 +5656,9 @@ struct NodeStructureMetadata { LA lv_ancestors, I is_, PSn html_segnames_ptr, + fNr flag_notes_reg, + fNs flag_notes_star, + fL flag_links, ) in { debug(asserts){ @@ -6056,6 +6131,9 @@ struct ObjGenericComposite { 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,]; + bool inline_links = false; + bool inline_notes_reg = false; + bool inline_notes_star = false; } #+END_SRC diff --git a/org/sdp.org b/org/sdp.org index c745741..5dd7f45 100644 --- a/org/sdp.org +++ b/org/sdp.org @@ -23,7 +23,7 @@ struct Version { int minor; int patch; } -enum ver = Version(0, 13, 2); +enum ver = Version(0, 13, 3); #+END_SRC * 1. sdp (sisu document parser) :sdp: @@ -194,6 +194,7 @@ mixin outputHub; string[] fns_src; string flag_action; string arg_unrecognized; +enum dAM { abstraction, matters } auto rgx = Rgx(); #+END_SRC @@ -377,8 +378,8 @@ auto t = SiSUabstraction!()(fn_src, _opt_action_bool, env); static assert(!isTypeTuple!(t)); static assert(t.length==2); -auto doc_abstraction = t[0]; -auto doc_matters = t[1]; +auto doc_abstraction = t[dAM.abstraction]; +auto doc_matters = t[dAM.matters]; #+END_SRC *** 2. _output processing_ (post abstraction processing) @@ -447,7 +448,9 @@ template SiSUabstraction() { <> <> <> - // <> + enum headBody { header, body_content, insert_filelist } + enum makeMeta { make, meta } + enum docAbst { doc_abstraction, section_keys, segnames, images } auto rgx = Rgx(); auto SiSUabstraction(Fn,O,E)(Fn fn_src, O opts, E env){ <> @@ -479,14 +482,14 @@ template SiSUabstraction() { #+BEGIN_SRC d /+ ↓ read file (filename with path) +/ /+ ↓ file tuple of header and content +/ -auto _0_header_1_body_content_2_insert_filelist_tuple = +auto _header_body_inserts = SiSUrawMarkupContent!()(fn_src); -static assert(!isTypeTuple!(_0_header_1_body_content_2_insert_filelist_tuple)); -static assert(_0_header_1_body_content_2_insert_filelist_tuple.length==3); +static assert(!isTypeTuple!(_header_body_inserts)); +static assert(_header_body_inserts.length==3); debug(header_and_body) { writeln(header); - writeln(_0_header_1_body_content_2_insert_filelist_tuple.length); - writeln(_0_header_1_body_content_2_insert_filelist_tuple.length[1][0]); + writeln(_header_body_inserts.length); + writeln(_header_body_inserts.length[headBody.body_content][0]); } #+END_SRC @@ -506,10 +509,10 @@ debug(header_and_body) { #+NAME: sdp_each_file_do_split_sisu_markup_file_header_into_make_and_meta #+BEGIN_SRC d /+ ↓ split header into make and meta +/ -auto _0_make_1_dochead_meta_tuple = - SiSUheaderExtractHub!()(_0_header_1_body_content_2_insert_filelist_tuple[0], conf_doc_make_aa); -static assert(!isTypeTuple!(_0_make_1_dochead_meta_tuple)); -static assert(_0_make_1_dochead_meta_tuple.length==2); +auto _make_and_meta = + SiSUheaderExtractHub!()(_header_body_inserts[headBody.header], conf_doc_make_aa); +static assert(!isTypeTuple!(_make_and_meta)); +static assert(_make_and_meta.length==2); #+END_SRC ** 3. _document abstraction, tuple_ (pre-processing) :processing: @@ -530,17 +533,17 @@ static assert(_0_make_1_dochead_meta_tuple.length==2); #+BEGIN_SRC d /+ ↓ document abstraction: process document, return abstraction as tuple +/ auto da = SiSUdocAbstraction!()( - (_0_header_1_body_content_2_insert_filelist_tuple[1]), - (_0_make_1_dochead_meta_tuple[0]), - (_0_make_1_dochead_meta_tuple[1]), + (_header_body_inserts[headBody.body_content]), + (_make_and_meta[makeMeta.make]), + (_make_and_meta[makeMeta.meta]), opts ); static assert(!isTypeTuple!(da)); static assert(da.length==4); -auto doc_abstraction = da[0]; // head ~ toc ~ body ~ endnotes_seg ~ glossary ~ bibliography ~ bookindex ~blurb; -string[][string] _document_section_keys_sequenced = da[1]; -string[] _doc_html_segnames = da[2]; -auto _images = da[3]; +auto doc_abstraction = da[docAbst.doc_abstraction]; // head ~ toc ~ body ~ endnotes_seg ~ glossary ~ bibliography ~ bookindex ~blurb; +string[][string] _document_section_keys_sequenced = da[docAbst.section_keys]; +string[] _doc_html_segnames = da[docAbst.segnames]; +auto _images = da[docAbst.images]; #+END_SRC ** 4. _document matters_ (doc info gathered, various sources) @@ -564,11 +567,11 @@ struct DocumentMatters { return _k; } auto dochead_make() { - string[string][string] _k = _0_make_1_dochead_meta_tuple[0]; + string[string][string] _k = _make_and_meta[makeMeta.make]; return _k; } auto dochead_meta() { - string[string][string] _k = _0_make_1_dochead_meta_tuple[1]; + string[string][string] _k = _make_and_meta[makeMeta.meta]; return _k; } auto source_filename() { @@ -585,7 +588,7 @@ struct DocumentMatters { return _k; } auto file_insert_list() { - string[] _k = _0_header_1_body_content_2_insert_filelist_tuple[2]; + string[] _k = _header_body_inserts[headBody.insert_filelist]; return _k; } auto image_list() { -- cgit v1.2.3