From e923c850c2a19640fa28b8663e5dabff57c47954 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 3 May 2019 09:18:27 -0400 Subject: block (grouped text) attributes (possibility) --- org/meta_abstraction.org | 65 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 49 insertions(+), 16 deletions(-) (limited to 'org') diff --git a/org/meta_abstraction.org b/org/meta_abstraction.org index d050abb..abfa404 100644 --- a/org/meta_abstraction.org +++ b/org/meta_abstraction.org @@ -3219,8 +3219,6 @@ void flow_txt_block_start(L,T,N)( #+name: abs_functions_block #+BEGIN_SRC d static auto rgx = Rgx(); - string code_block_syntax = ""; - bool code_block_numbered = false; #+END_SRC ******* code @@ -3228,9 +3226,9 @@ void flow_txt_block_start(L,T,N)( #+name: abs_functions_block #+BEGIN_SRC d if (auto m = line.matchFirst(rgx.block_curly_code_open)) { - code_block_syntax = (m[1]) ? m[1].to!string : ""; - code_block_numbered = (m[2].matchFirst(rgx.code_numbering)) - ? true : false; + an_object["lang"] = ""; + an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : ""; + an_object["syntax"] = (m["syntax"]) ? m["syntax"].to!string : ""; debug(codecurly) { // code (curly) open writefln( "* [code curly] %s", @@ -3246,7 +3244,10 @@ void flow_txt_block_start(L,T,N)( #+name: abs_functions_block #+BEGIN_SRC d - } else if (line.matchFirst(rgx.block_curly_poem_open)) { + } else if (auto m = line.matchFirst(rgx.block_curly_poem_open)) { + an_object["syntax"] = ""; + an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : ""; + an_object["lang"] = (m["lang"]) ? m["lang"].to!string : ""; debug(poem) { // poem (curly) open writefln( "* [poem curly] %s", @@ -3264,7 +3265,10 @@ void flow_txt_block_start(L,T,N)( #+name: abs_functions_block #+BEGIN_SRC d - } else if (line.matchFirst(rgx.block_curly_group_open)) { + } else if (auto m = line.matchFirst(rgx.block_curly_group_open)) { + an_object["syntax"] = ""; + an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : ""; + an_object["lang"] = (m["lang"]) ? m["lang"].to!string : ""; debug(group) { // group (curly) open writefln( "* [group curly] %s", @@ -3280,7 +3284,10 @@ void flow_txt_block_start(L,T,N)( #+name: abs_functions_block #+BEGIN_SRC d - } else if (line.matchFirst(rgx.block_curly_block_open)) { + } else if (auto m = line.matchFirst(rgx.block_curly_block_open)) { + an_object["syntax"] = ""; + an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : ""; + an_object["lang"] = (m["lang"]) ? m["lang"].to!string : ""; debug(block) { // block (curly) open writefln( "* [block curly] %s", @@ -3296,7 +3303,10 @@ void flow_txt_block_start(L,T,N)( #+name: abs_functions_block #+BEGIN_SRC d - } else if (line.matchFirst(rgx.block_curly_quote_open)) { + } else if (auto m = line.matchFirst(rgx.block_curly_quote_open)) { + an_object["syntax"] = ""; + an_object["attrib"] = m["attrib"].to!string; + an_object["lang"] = m["lang"].to!string; debug(quote) { // quote (curly) open writefln( "* [quote curly] %s", @@ -3344,9 +3354,9 @@ void flow_txt_block_start(L,T,N)( #+name: abs_functions_block #+BEGIN_SRC d } else if (auto m = line.matchFirst(rgx.block_tic_code_open)) { - code_block_syntax = (m[1]) ? m[1].to!string : ""; - code_block_numbered = (m[2].matchFirst(rgx.code_numbering)) - ? true : false; + an_object["lang"] = ""; + an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : ""; + an_object["syntax"] = (m["syntax"]) ? m["syntax"].to!string : ""; debug(codetic) { // code (tic) open writefln( "* [code tic] %s", @@ -3362,7 +3372,10 @@ void flow_txt_block_start(L,T,N)( #+name: abs_functions_block #+BEGIN_SRC d - } else if (line.matchFirst(rgx.block_tic_poem_open)) { + } else if (auto m = line.matchFirst(rgx.block_tic_poem_open)) { + an_object["syntax"] = ""; + an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : ""; + an_object["lang"] = (m["lang"]) ? m["lang"].to!string : ""; debug(poem) { // poem (tic) open writefln( "* [poem tic] %s", @@ -3380,7 +3393,10 @@ void flow_txt_block_start(L,T,N)( #+name: abs_functions_block #+BEGIN_SRC d - } else if (line.matchFirst(rgx.block_tic_group_open)) { + } else if (auto m = line.matchFirst(rgx.block_tic_group_open)) { + an_object["syntax"] = ""; + an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : ""; + an_object["lang"] = (m["lang"]) ? m["lang"].to!string : ""; debug(group) { // group (tic) open writefln( "* [group tic] %s", @@ -3396,7 +3412,10 @@ void flow_txt_block_start(L,T,N)( #+name: abs_functions_block #+BEGIN_SRC d - } else if (line.matchFirst(rgx.block_tic_block_open)) { + } else if (auto m = line.matchFirst(rgx.block_tic_block_open)) { + an_object["syntax"] = ""; + an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : ""; + an_object["lang"] = (m["lang"]) ? m["lang"].to!string : ""; debug(block) { // block (tic) open writefln( "* [block tic] %s", @@ -3412,7 +3431,10 @@ void flow_txt_block_start(L,T,N)( #+name: abs_functions_block #+BEGIN_SRC d - } else if (line.matchFirst(rgx.block_tic_quote_open)) { + } else if (auto m = line.matchFirst(rgx.block_tic_quote_open)) { + an_object["syntax"] = ""; + an_object["attrib"] = m["attrib"].to!string; + an_object["lang"] = m["lang"].to!string; debug(quote) { // quote (tic) open writefln( "* [quote tic] %s", @@ -4318,6 +4340,8 @@ void flow_block_flag_line_empty_(B,N,CMM,Ts)( comp_obj_block.metainfo.object_number_off = obj_cite_digits.off; comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx; comp_obj_block.metainfo.object_number_type = obj_cite_digit_type; + comp_obj_block.metainfo.lang = an_object["lang"]; + comp_obj_block.metainfo.attrib = an_object["attrib"]; comp_obj_block.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; comp_obj_block.text = an_object["substantive"]; @@ -4373,6 +4397,8 @@ void flow_block_flag_line_empty_(B,N,CMM,Ts)( comp_obj_block.metainfo.object_number_off = obj_cite_digits.off; comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx; comp_obj_block.metainfo.object_number_type = obj_cite_digits.type; + comp_obj_block.metainfo.lang = an_object["lang"]; + comp_obj_block.metainfo.attrib = an_object["attrib"]; comp_obj_block.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; comp_obj_block.text = an_object["substantive"]; @@ -4428,6 +4454,8 @@ void flow_block_flag_line_empty_(B,N,CMM,Ts)( comp_obj_block.metainfo.object_number_off = obj_cite_digits.off; comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx; comp_obj_block.metainfo.object_number_type = obj_cite_digit_type; + comp_obj_block.metainfo.lang = an_object["lang"]; + comp_obj_block.metainfo.attrib = an_object["attrib"]; comp_obj_block.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; comp_obj_block.text = an_object["substantive"]; @@ -4525,6 +4553,8 @@ void flow_block_flag_line_empty_(B,N,CMM,Ts)( comp_obj_code.metainfo.object_number_off = obj_cite_digits.off; comp_obj_code.metainfo.o_n_book_index = obj_cite_digits.bkidx; comp_obj_code.metainfo.object_number_type = obj_cite_digits.type; + comp_obj_code.metainfo.syntax = an_object["syntax"]; + comp_obj_code.metainfo.attrib = an_object["attrib"]; comp_obj_code.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; comp_obj_code.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; comp_obj_code.text = an_object["substantive"]; @@ -7817,6 +7847,9 @@ struct DocObj_MetaInfo_ { alias of_part = is_of_part; alias of_section = is_of_section; alias is_of = is_of_type; + string attrib = ""; // TODO analyze attrib and subdivide here? + string lang = ""; // blocks: group, block, quote; not codeblock; TODO poem:verse not yet done + string syntax = ""; // codeblock only /+ o_n +/ int o_n_substantive = 0; int o_n_non_substantive = 0; -- cgit v1.2.3