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) --- src/sdp.d | 5 +- src/sdp/abstraction.d | 46 ++++---- src/sdp/ao_abstract_doc_source.d | 229 ++++++++++++++++++++++++++------------- src/sdp/ao_object_setter.d | 3 + 4 files changed, 180 insertions(+), 103 deletions(-) (limited to 'src') diff --git a/src/sdp.d b/src/sdp.d index 9d19d38..2e3aedd 100755 --- a/src/sdp.d +++ b/src/sdp.d @@ -48,6 +48,7 @@ void main(string[] args) { string[] fns_src; string flag_action; string arg_unrecognized; + enum dAM { abstraction, matters } auto rgx = Rgx(); scope(success) { debug(checkdoc) { @@ -187,8 +188,8 @@ void main(string[] args) { 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]; /+ ↓ debugs +/ if (doc_matters.opt_action_bool["verbose"]) { SiSUabstractionSummary!()(doc_abstraction, doc_matters); diff --git a/src/sdp/abstraction.d b/src/sdp/abstraction.d index 380be1d..77a5512 100644 --- a/src/sdp/abstraction.d +++ b/src/sdp/abstraction.d @@ -34,11 +34,9 @@ template SiSUabstraction() { mixin SiSUbiblio; mixin SiSUrgxInitFlags; mixin outputHub; - // auto sdl_root_configuration = ConfigHub!()("conf.sdl", env); - // auto sdl_root_doc_make = ConfigHub!()("sisu_document_make", env); - // auto confsdl = HeaderExtractSDL(); - // auto conf_settings_aa = confsdl.configSettingsSDLangToAAmake(sdl_root_configuration); - // auto conf_doc_make_aa = confsdl.documentMakeSDLangToAAmake(sdl_root_doc_make); + 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){ auto sdl_root_configuration = ConfigHub!()("conf.sdl", env); @@ -48,33 +46,33 @@ template SiSUabstraction() { auto conf_doc_make_aa = confsdl.documentMakeSDLangToAAmake(sdl_root_doc_make); /+ ↓ 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]); } /+ ↓ 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); /+ ↓ 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]; struct DocumentMatters { string[] keys_seq_seg() { string[] _k = _document_section_keys_sequenced["seg"]; @@ -89,11 +87,11 @@ template SiSUabstraction() { 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() { @@ -110,7 +108,7 @@ template SiSUabstraction() { 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() { diff --git a/src/sdp/ao_abstract_doc_source.d b/src/sdp/ao_abstract_doc_source.d index 0775daf..14b1071 100644 --- a/src/sdp/ao_abstract_doc_source.d +++ b/src/sdp/ao_abstract_doc_source.d @@ -226,6 +226,7 @@ template SiSUdocAbstraction() { /+ 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 } /+ ↓ abstract marked up document +/ auto SiSUdocAbstraction(Src,Make,Meta,Opt)( Src markup_sourcefile_content, @@ -728,9 +729,9 @@ template SiSUdocAbstraction() { 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"; @@ -770,6 +771,9 @@ template SiSUdocAbstraction() { 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) { @@ -803,10 +807,10 @@ template SiSUdocAbstraction() { 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"; @@ -818,6 +822,9 @@ template SiSUdocAbstraction() { 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=[ @@ -2039,10 +2046,10 @@ template SiSUdocAbstraction() { ); } 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"; @@ -2050,6 +2057,9 @@ template SiSUdocAbstraction() { 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"); @@ -2090,10 +2100,10 @@ template SiSUdocAbstraction() { 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"; @@ -2101,6 +2111,9 @@ template SiSUdocAbstraction() { 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"); @@ -2126,10 +2139,10 @@ template SiSUdocAbstraction() { } 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"; @@ -2137,6 +2150,9 @@ template SiSUdocAbstraction() { 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); @@ -2177,10 +2193,10 @@ template SiSUdocAbstraction() { 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"; @@ -2188,6 +2204,9 @@ template SiSUdocAbstraction() { 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"); @@ -2400,10 +2419,10 @@ template SiSUdocAbstraction() { 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"; @@ -2411,6 +2430,9 @@ template SiSUdocAbstraction() { 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"); @@ -2461,10 +2483,10 @@ template SiSUdocAbstraction() { 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"; @@ -2472,6 +2494,9 @@ template SiSUdocAbstraction() { 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"); @@ -2495,10 +2520,10 @@ template SiSUdocAbstraction() { 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"; @@ -2506,6 +2531,9 @@ template SiSUdocAbstraction() { 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"); @@ -2528,10 +2556,10 @@ template SiSUdocAbstraction() { 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"; @@ -2539,6 +2567,9 @@ template SiSUdocAbstraction() { 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"); @@ -2562,10 +2593,10 @@ template SiSUdocAbstraction() { 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"; @@ -2573,6 +2604,9 @@ template SiSUdocAbstraction() { 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"); @@ -3103,11 +3137,13 @@ template SiSUdocAbstraction() { } 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, @@ -3128,6 +3164,7 @@ template SiSUdocAbstraction() { 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; @@ -3138,6 +3175,7 @@ template SiSUdocAbstraction() { (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 ~= @@ -3154,9 +3192,14 @@ template SiSUdocAbstraction() { } 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)); @@ -3164,6 +3207,7 @@ template SiSUdocAbstraction() { } body { obj_txt_out = ""; + bool urls = false; tail = ""; /+ special endnotes +/ obj_txt_in = replaceAll( @@ -3179,9 +3223,11 @@ template SiSUdocAbstraction() { ); /+ 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); } @@ -3193,9 +3239,23 @@ template SiSUdocAbstraction() { 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)); @@ -3205,16 +3265,16 @@ template SiSUdocAbstraction() { 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)); @@ -3225,14 +3285,14 @@ template SiSUdocAbstraction() { 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() { } @@ -3249,16 +3309,16 @@ template SiSUdocAbstraction() { } 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)); @@ -3266,12 +3326,12 @@ template SiSUdocAbstraction() { } 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)); @@ -3279,8 +3339,8 @@ template SiSUdocAbstraction() { } 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() { } @@ -3325,7 +3385,7 @@ template SiSUdocAbstraction() { auto rgx = Rgx(); auto munge = ObjInlineMarkupMunge(); string[string] obj_txt; - 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 @@ -3343,6 +3403,11 @@ template SiSUdocAbstraction() { ? 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 = ""; @@ -3355,23 +3420,23 @@ template SiSUdocAbstraction() { } 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"]); @@ -3386,11 +3451,18 @@ template SiSUdocAbstraction() { 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; @@ -4616,7 +4688,7 @@ template SiSUdocAbstraction() { } invariant() { } - 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, @@ -4628,6 +4700,9 @@ template SiSUdocAbstraction() { LA lv_ancestors, I is_, PSn html_segnames_ptr, + fNr flag_notes_reg, + fNs flag_notes_star, + fL flag_links, ) in { debug(asserts){ diff --git a/src/sdp/ao_object_setter.d b/src/sdp/ao_object_setter.d index d52474a..e165d23 100644 --- a/src/sdp/ao_object_setter.d +++ b/src/sdp/ao_object_setter.d @@ -51,6 +51,9 @@ template ObjectSetter() { 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; } struct TheObjects { ObjGenericComposite[] oca; -- cgit v1.2.3