diff options
-rw-r--r-- | org/default_regex.org | 54 | ||||
-rw-r--r-- | org/meta_abstraction.org | 106 | ||||
-rw-r--r-- | org/output_xmls.org | 2 | ||||
-rw-r--r-- | src/doc_reform/meta/metadoc_from_src.d | 106 | ||||
-rw-r--r-- | src/doc_reform/meta/rgx.d | 54 | ||||
-rw-r--r-- | src/doc_reform/output/rgx.d | 22 | ||||
-rw-r--r-- | src/doc_reform/output/xmls.d | 2 |
7 files changed, 173 insertions, 173 deletions
diff --git a/org/default_regex.org b/org/default_regex.org index f316600..911832b 100644 --- a/org/default_regex.org +++ b/org/default_regex.org @@ -162,7 +162,7 @@ static heading_biblio_glossary = ctRegex!(`^:?(?:(1)[~][! static heading_biblio_blurb = ctRegex!(`^:?(?:(1)[~][!](?:(?:biblio(?:graphy)?|references?)|blurb)|[A-D1][~])`); static heading_blurb_glossary = ctRegex!(`^:?(?:(1)[~][!](?:blurb|glossary)|[A-D1][~])`); static para_bullet = ctRegex!(`^_[*] `); -static para_bullet_indent = ctRegex!(`^_([1-9])[*] `); +static para_bullet_indent = ctRegex!(`^_(?P<indent>[1-9])[*] `); static para_indent = ctRegex!(`^_(?P<indent>[1-9])[ ]`); static para_indent_hang = ctRegex!(`^_(?P<hang>[0-9])_(?P<indent>[0-9])[ ]`); static para_attribs = ctRegex!(`^_(?:(?:[0-9])(?:_([0-9]))?|(?:[1-9])?[*]) `); @@ -175,7 +175,7 @@ static para_inline_link_anchor = ctRegex!(`\*[~](?P<ancho #+name: meta_rgx #+BEGIN_SRC d /+ blocked markup +/ -static block_open = ctRegex!("^((code(?:[.][a-z][0-9a-z_]+)?|poem|group|block|quote|table)(?:[(][ a-zA-Z0-9;:,]*[)])?[{][ ]*$)|^`{3} (code(?:[.][a-z][0-9a-z_]+)?|poem|group|block|quote|table)(?:[(][ a-zA-Z0-9;:,]*[)])?|^[{]table[(](?:h;)?(?P<columns>(?:[ ,]+[0-9]+)+)[)][}]"); +static block_open = ctRegex!("^((code(?:[.][a-z][0-9a-z#+_]+)?|(?:poem|group|block|quote)(?:[.][a-z][0-9a-z_]+)?|table)(?:[(][ a-zA-Z0-9;:,]*[)])?[{][ ]*$)|^`{3} (code(?:[.][a-z][0-9a-z#+_]+)?|(?:poem|group|block|quote)(?:[.][a-z][0-9a-z_]+)?|table)(?:[(][ a-zA-Z0-9;:,]*[)])?|^[{]table[(](?:h;)?(?P<columns>(?:[ ,]+[0-9]+)+)[)][}]"); static block_poem_open = ctRegex!("^((poem(?:[(][ a-zA-Z0-9;:,]*[)])?[{][ ]*$)|`{3} poem(?:[(][ a-zA-Z0-9;:,]*[)])?)"); #+END_SRC @@ -184,12 +184,12 @@ static block_poem_open = ctRegex!("^((poem(?:[(][ #+name: meta_rgx #+BEGIN_SRC d /+ blocked markup tics +/ -static block_tic_open = ctRegex!("^`{3} (code(?:[.][a-z][0-9a-z_]+)?|poem|group|block|quote|table)"); -static block_tic_code_open = ctRegex!("^`{3} (?:code)(?:[.](?P<syntax>[a-z][0-9a-z_]+))?(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?"); -static block_tic_poem_open = ctRegex!("^`{3} (poem)(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?"); -static block_tic_group_open = ctRegex!("^`{3} (group)(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?"); -static block_tic_block_open = ctRegex!("^`{3} (block)(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?"); -static block_tic_quote_open = ctRegex!("^`{3} (quote)(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?"); +static block_tic_open = ctRegex!("^`{3} (code(?:[.][a-z][0-9a-z#+_]+)?|(?:poem|group|block|quote)(?:[.][a-z][0-9a-z_]+)?|table)"); +static block_tic_code_open = ctRegex!("^`{3} code(?:[.](?P<syntax>[a-z][0-9a-z#+_]+))?(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?"); +static block_tic_poem_open = ctRegex!("^`{3} poem(?:[.](?P<lang>[a-z][0-9a-z_]+))?(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?"); +static block_tic_group_open = ctRegex!("^`{3} group(?:[.](?P<lang>[a-z][0-9a-z_]+))?(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?"); +static block_tic_block_open = ctRegex!("^`{3} block(?:[.](?P<lang>[a-z][0-9a-z_]+))?(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?"); +static block_tic_quote_open = ctRegex!("^`{3} quote(?:[.](?P<lang>[a-z][0-9a-z_]+))?(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?"); static block_tic_table_open = ctRegex!("^`{3} table(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?"); // ctRegex!("^`{3} table(?:\(.*?\))?"); static block_tic_close = ctRegex!("^(`{3})$","m"); #+END_SRC @@ -199,18 +199,18 @@ static block_tic_close = ctRegex!("^(`{3})$","m") #+name: meta_rgx #+BEGIN_SRC d /+ blocked markup curly +/ -static block_curly_open = ctRegex!(`^((?:code([.][a-z][0-9a-z_]+)?|poem|group|block|quote|table)(?:[(][ a-zA-Z0-9;:,]*[)])?[{][ ]*$)`); +static block_curly_open = ctRegex!(`^((?:code([.][a-z][0-9a-z#+_]+)?|(?:poem|group|block|quote)(?:[.][a-z][0-9a-z_]+)?|table)(?:[(][ a-zA-Z0-9;:,]*[)])?[{][ ]*$)`); static block_curly_code_open = ctRegex!(`^(?:code(?:[.](?P<syntax>[a-z][0-9a-z_]+))?(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?[{][ ]*$)`); static block_curly_code_close = ctRegex!(`^([}]code)`); -static block_curly_poem_open = ctRegex!(`^(poem(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?[{][ ]*$)`); +static block_curly_poem_open = ctRegex!(`^(poem(?:[.](?P<lang>[a-z][0-9a-z_]+))?(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?[{][ ]*$)`); static block_curly_poem_close = ctRegex!(`^([}]poem)`); -static block_curly_group_open = ctRegex!(`^(group(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?[{][ ]*$)`); +static block_curly_group_open = ctRegex!(`^(group(?:[.](?P<lang>[a-z][0-9a-z_]+))?(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?[{][ ]*$)`); static block_curly_group_close = ctRegex!(`^([}]group)`); -static block_curly_block_open = ctRegex!(`^(block(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?[{][ ]*$)`); +static block_curly_block_open = ctRegex!(`^(block(?:[.](?P<lang>[a-z][0-9a-z_]+))?(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?[{][ ]*$)`); static block_curly_block_close = ctRegex!(`^([}]block)`); -static block_curly_quote_open = ctRegex!(`^(quote(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?[{][ ]*$)`); +static block_curly_quote_open = ctRegex!(`^(quote(?:[.](?P<lang>[a-z][0-9a-z_]+))?(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?[{][ ]*$)`); static block_curly_quote_close = ctRegex!(`^([}]quote)`); -static block_curly_table_open = ctRegex!(`^table(?:[(]([?P<attrib> a-zA-Z0-9;:,]*)[)])?[{][ ]*$`); +static block_curly_table_open = ctRegex!(`^table(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?[{][ ]*$`); static block_curly_table_close = ctRegex!(`^([}]table)`); static block_curly_table_special_markup = ctRegex!(`^[{]table[(](?P<attrib>(?:(h);)?(?P<columns>(?:[, ]+[0-9]+)+))[)][}]`, "mg"); #+END_SRC @@ -260,7 +260,7 @@ static inline_curly_delimiter_open_symbol_plus = ctRegex!(`~\{[+]\s`, "m" static inline_curly_delimiter_open_star_or_plus = ctRegex!(`~\{[+*]`, "m"); static inline_curly_delimiter_close_regular = ctRegex!(`\s*\}~`, "m"); static inline_text_and_note_curly = ctRegex!(`(?P<text>.+?)(?:(?:[~])[{][*+ ]*)(?P<note>.+?)(?:[}][~])`, "mg"); -static note_ref = ctRegex!(`^\S+?noteref_([0-9]+)`, "mg"); // {^{73.}^}#noteref_73 +static note_ref = ctRegex!(`^\S+?noteref_(?P<ref>[0-9]+)`, "mg"); // {^{73.}^}#noteref_73 #+END_SRC *** links/ urls :inline:footnote: @@ -301,7 +301,7 @@ static smid_image_delimit = ctRegex!(`(?P<pre>^|[ ] #+name: meta_rgx #+BEGIN_SRC d /+ inline markup book index +/ -static book_index = ctRegex!(`^=\{\s*(.+?)\}$`, "m"); +static book_index = ctRegex!(`^=\{\s*(?P<bookindex>.+?)\}$`, "m"); static book_index_open = ctRegex!(`^=\{\s*([^}]*?)$`); static book_index_close = ctRegex!(`^(.*?)\}$`, "m"); #+END_SRC @@ -539,7 +539,7 @@ static inline_image_without_dimensions = ctRegex!(`(?P<pre>โฅ)โ static inline_image_info = ctRegex!(`โผ?(?P<img>[a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P<width>\d+)h(?P<height>\d+)`, "mg"); static inline_link_anchor = ctRegex!(`โ(?P<anchor>\S+?)โ`, "mg"); // TODO *~text_link_anchor static inline_link_ = ctRegex!(`โฅ(?P<text>.+?)โโค(?P<link>.+?)โ`, "mg"); -static inline_link = ctRegex!(`โฅ(?P<text>.+?)โโค(?P<link>\S+?)โ`, "mg"); +static inline_link = ctRegex!(`โฅ(?P<text>.+?)โโค(?P<link>#?(\S+?))โ`, "mg"); static inline_link_empty = ctRegex!(`โฅ(?P<text>.+?)โโคโ`, "mg"); static inline_link_number = ctRegex!(`โฅ(?P<text>.+?)โโค(?P<num>[0-9]+)โ`, "mg"); // not used static inline_link_number_only = ctRegex!(`(โฅ.+?โ)โค(?P<num>[0-9]+)โ`, "mg"); @@ -565,16 +565,16 @@ static quotation_mark_various = ctRegex!(q"โ['โโโ /+ inline markup font face mod +/ static inline_mark_faces = ctRegex!(`(?P<markup>(?P<mod>[*!/_^,+#"-])\{(?P<text>.+?)\}[*!/_^,+#"-])`, "mg"); static inline_mark_faces_to_mod = ctRegex!(`(?P<mod>[*!/_^,+#"-])\{(?P<text>.+?)\}([*!/_^,+#"-])`, "mg"); -static inline_mark_emphasis = ctRegex!(`([*])\{(?P<text>.+?)\}[*]`, "mg"); -static inline_mark_bold = ctRegex!(`([!])\{(?P<text>.+?)\}[!]`, "mg"); -static inline_mark_underscore = ctRegex!(`([_])\{(?P<text>.+?)\}[_]`, "mg"); -static inline_mark_italics = ctRegex!(`([/])\{(?P<text>.+?)\}[/]`, "mg"); -static inline_mark_superscript = ctRegex!(`(\^)\{(?P<text>.+?)\}\^`, "mg"); -static inline_mark_subscript = ctRegex!(`([,])\{(?P<text>.+?)\}[,]`, "mg"); -static inline_mark_strike = ctRegex!(`([-])\{(?P<text>.+?)\}[-]`, "mg"); -static inline_mark_insert = ctRegex!(`([+])\{(?P<text>.+?)\}[+]`, "mg"); -static inline_mark_mono = ctRegex!(`([#])\{(?P<text>.+?)\}[#]`, "mg"); -static inline_mark_cite = ctRegex!(`(["])\{(?P<text>.+?)\}["]`, "mg"); +static inline_mark_emphasis = ctRegex!(`(?P<mark>[*])\{(?P<text>.+?)\}[*]`, "mg"); +static inline_mark_bold = ctRegex!(`(?P<mark>[!])\{(?P<text>.+?)\}[!]`, "mg"); +static inline_mark_underscore = ctRegex!(`(?P<mark>[_])\{(?P<text>.+?)\}[_]`, "mg"); +static inline_mark_italics = ctRegex!(`(?P<mark>[/])\{(?P<text>.+?)\}[/]`, "mg"); +static inline_mark_superscript = ctRegex!(`(?P<mark>\^)\{(?P<text>.+?)\}\^`, "mg"); +static inline_mark_subscript = ctRegex!(`(?P<mark>[,])\{(?P<text>.+?)\}[,]`, "mg"); +static inline_mark_strike = ctRegex!(`(?P<mark>[-])\{(?P<text>.+?)\}[-]`, "mg"); +static inline_mark_insert = ctRegex!(`(?P<mark>[+])\{(?P<text>.+?)\}[+]`, "mg"); +static inline_mark_mono = ctRegex!(`(?P<mark>[#])\{(?P<text>.+?)\}[#]`, "mg"); +static inline_mark_cite = ctRegex!(`(?P<mark>["])\{(?P<text>.+?)\}["]`, "mg"); static inline_mark_fontface_clean = ctRegex!(`[*!_/^,+#โ "-]\{|\}[*!_/^,+#โ "-]`, "mg"); #+END_SRC diff --git a/org/meta_abstraction.org b/org/meta_abstraction.org index d2adf27..e2f4638 100644 --- a/org/meta_abstraction.org +++ b/org/meta_abstraction.org @@ -418,10 +418,10 @@ static auto inline_markup_faces(L)(L line) { static auto rgx = Rgx(); static auto mkup = InlineMarkup(); line = replaceAll!(m => mkup.quote_o ~ m[1] ~ mkup.quote_c)(line, rgx.within_quotes); - line = replaceAll!(m => mkup.mono ~ mkup.ff_o ~ m[2] ~ mkup.ff_c ~ mkup.mono)(line, rgx.inline_mark_mono); - line = replaceAll!(m => mkup.cite ~ mkup.ff_o ~ m[2] ~ mkup.ff_c ~ mkup.cite)(line, rgx.inline_mark_cite); + line = replaceAll!(m => mkup.mono ~ mkup.ff_o ~ m["text"] ~ mkup.ff_c ~ mkup.mono)(line, rgx.inline_mark_mono); + line = replaceAll!(m => mkup.cite ~ mkup.ff_o ~ m["text"] ~ mkup.ff_c ~ mkup.cite)(line, rgx.inline_mark_cite); foreach (regx; [rgx.inline_mark_emphasis, rgx.inline_mark_bold, rgx.inline_mark_underscore, rgx.inline_mark_italics, rgx.inline_mark_superscript, rgx.inline_mark_subscript, rgx.inline_mark_strike, rgx.inline_mark_insert]) { - line = replaceAll!(m => m[1] ~ mkup.ff_o ~ m[2] ~ mkup.ff_c ~ m[1])(line, regx); + line = replaceAll!(m => m["mark"] ~ mkup.ff_o ~ m["text"] ~ mkup.ff_c ~ m["mark"])(line, regx); } return line; } @@ -434,33 +434,33 @@ static auto links_and_images(L)(L obj_txt) { || obj_txt.match(rgx.smid_inline_link_endnote_url_helper_punctuated) ) { obj_txt = replaceAll!(m => format("%s%s%s%s%s%s%s %s%s%s%s%s%s %s%s", - mkup.lnk_o, m[1].strip, mkup.lnk_c, - mkup.url_o, m[2], mkup.url_c, + mkup.lnk_o, m["content"].strip, mkup.lnk_c, + mkup.url_o, m["link"], mkup.url_c, mkup.en_a_o, - mkup.lnk_o, m[2].strip, mkup.lnk_c, - mkup.url_o, m[2], mkup.url_c, + mkup.lnk_o, m["link"].strip, mkup.lnk_c, + mkup.url_o, m["link"], mkup.url_c, mkup.en_a_c, m[3] ))(obj_txt, rgx.smid_inline_link_endnote_url_helper_punctuated); obj_txt = replaceAll!(m => format("%s%s%s%s%s%s%s %s%s%s%s%s%s %s", - mkup.lnk_o, m[1].strip, mkup.lnk_c, - mkup.url_o, m[2], mkup.url_c, + mkup.lnk_o, m["content"].strip, mkup.lnk_c, + mkup.url_o, m["link"], mkup.url_c, mkup.en_a_o, - mkup.lnk_o, m[2].strip, mkup.lnk_c, - mkup.url_o, m[2], mkup.url_c, + mkup.lnk_o, m["link"].strip, mkup.lnk_c, + mkup.url_o, m["link"], mkup.url_c, mkup.en_a_c ))(obj_txt, rgx.smid_inline_link_endnote_url_helper); } else { obj_txt = replaceAll!(m => format("%s%s%s%s%s%s%s", - m[1], - mkup.lnk_o, m[2].strip, mkup.lnk_c, - mkup.url_o, m[3], mkup.url_c + m["pre"], + mkup.lnk_o, m["content"].strip, mkup.lnk_c, + mkup.url_o, m["link"], mkup.url_c ))(obj_txt, rgx.smid_inline_link_markup_regular); } obj_txt = replaceAll!(m => format("%s%s%s%s%s%s%s", - m[1], - mkup.lnk_o, m[2].strip, mkup.lnk_c, - mkup.url_o, m[2], mkup.url_c + m["pre"], + mkup.lnk_o, m["link"].strip, mkup.lnk_c, + mkup.url_o, m["link"], mkup.url_c ))(obj_txt, rgx.smid_inline_link_naked_url); // } return obj_txt; @@ -886,8 +886,8 @@ if there is a blurb section you need to: debug(paraindent) { writeln(line); } - indent["hang_position"] = (m[1]).to!int; - indent["base_position"] = (m[1]).to!int; + indent["hang_position"] = (m["indent"]).to!int; + indent["base_position"] = (m["indent"]).to!int; } else if (line.matchFirst(rgx.para_bullet)) { debug(parabullet) { writeln(line); @@ -898,16 +898,16 @@ if there is a blurb section you need to: writeln(line); } indent=[ - "hang_position" : (m[1]).to!int, - "base_position" : (m[2]).to!int, + "hang_position" : (m["hang"]).to!int, + "base_position" : (m["indent"]).to!int, ]; } else if (auto m = line.matchFirst(rgx.para_bullet_indent)) { debug(parabulletindent) { writeln(line); } indent=[ - "hang_position" : (m[1]).to!int, - "base_position" : (m[1]).to!int, + "hang_position" : (m["indent"]).to!int, + "base_position" : (m["indent"]).to!int, ]; bullet = true; } @@ -3349,7 +3349,7 @@ void _start_block_(L,T,N)( line ); } - an_object["table_head"] = m[1].to!string; + an_object["table_head"] = m["attrib"].to!string; an_object["block_type"] = "curly"; obj_type_status["blocks"] = TriState.on; obj_type_status["table"] = TriState.on; @@ -3362,7 +3362,7 @@ void _start_block_(L,T,N)( #+BEGIN_SRC d } else if (auto m = line.matchFirst(rgx.block_curly_table_special_markup)) { /+ table: special table block markup syntax! +/ - an_object["table_head"] = m[1].to!string; + an_object["table_head"] = m["attrib"].to!string; an_object["block_type"] = "special"; obj_type_status["blocks"] = TriState.on; obj_type_status["table"] = TriState.on; @@ -3472,7 +3472,7 @@ void _start_block_(L,T,N)( line ); } - an_object["table_head"] = m[1].to!string; + an_object["table_head"] = m["attrib"].to!string; an_object["block_type"] = "tic"; obj_type_status["blocks"] = TriState.on; obj_type_status["table"] = TriState.on; @@ -3754,7 +3754,7 @@ void _quote_block_(L,O,T)( debug(quote) { // quote (curly) close writeln(line); } - an_object[an_object_key] = an_object[an_object_key].stripRight; + an_object[an_object_key] = an_object[an_object_key].stripRight; obj_type_status["blocks"] = TriState.closing; obj_type_status["quote"] = TriState.closing; obj_type_status["curly_quote"] = TriState.off; @@ -3769,7 +3769,7 @@ void _quote_block_(L,O,T)( debug(quote) { // quote (tic) close writeln(line); } - an_object[an_object_key] = an_object[an_object_key].stripRight; + an_object[an_object_key] = an_object[an_object_key].stripRight; obj_type_status["blocks"] = TriState.closing; obj_type_status["quote"] = TriState.closing; obj_type_status["tic_quote"] = TriState.off; @@ -3968,7 +3968,7 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)( processing.remove("verse"); ++cntr; } - object_number_poem["end"] = obj_cite_digits.object_number.to!string; + object_number_poem["end"] = obj_cite_digits.object_number.to!string; obj_type_status["blocks"] = TriState.closing; obj_type_status["poem"] = TriState.closing; obj_type_status["curly_poem"] = TriState.off; @@ -4654,7 +4654,7 @@ auto _book_index_(L,I,O,T,B)( debug(bookindexmatch) { writefln( "* [bookindex] %s\n", - m[1].to!string, + m["bookindex"].to!string, ); } an_object["bookindex_nugget"] = m.captures[1].to!string; @@ -5057,8 +5057,8 @@ void _para_match_(L,O,K,I,B,T,C)( debug(paraindent) { writeln(line); } - indent["hang_position"] = (m[1]).to!int; - indent["base_position"] = (m[1]).to!int; + indent["hang_position"] = (m["indent"]).to!int; + indent["base_position"] = (m["indent"]).to!int; } else if (line.matchFirst(rgx.para_bullet)) { debug(parabullet) { writeln(line); @@ -5069,16 +5069,16 @@ void _para_match_(L,O,K,I,B,T,C)( writeln(line); } indent=[ - "hang_position" : (m[1]).to!int, - "base_position" : (m[2]).to!int, + "hang_position" : (m["hang"]).to!int, + "base_position" : (m["indent"]).to!int, ]; } else if (auto m = line.matchFirst(rgx.para_bullet_indent)) { debug(parabulletindent) { writeln(line); } indent=[ - "hang_position" : (m[1]).to!int, - "base_position" : (m[1]).to!int, + "hang_position" : (m["indent"]).to!int, + "base_position" : (m["indent"]).to!int, ]; bullet = true; } @@ -6431,16 +6431,16 @@ struct ObjAttributes { ~ " \"indent_base\": 0,"; } else if (auto m = obj_txt_in.matchFirst(rgx.para_bullet_indent)) { _obj_attributes =" \"bullet\": \"true\"," - ~ " \"indent_hang\": " ~ m[1].to!string ~ "," - ~ " \"indent_base\": " ~ m[1].to!string ~ ","; + ~ " \"indent_hang\": " ~ m["indent"].to!string ~ "," + ~ " \"indent_base\": " ~ m["indent"].to!string ~ ","; } else if (auto m = obj_txt_in.matchFirst(rgx.para_indent_hang)) { _obj_attributes =" \"bullet\": \"false\"," - ~ " \"indent_hang\": " ~ m[1].to!string ~ "," - ~ " \"indent_base\": " ~ m[2].to!string ~ ","; + ~ " \"indent_hang\": " ~ m["hang"].to!string ~ "," + ~ " \"indent_base\": " ~ m["indent"].to!string ~ ","; } else if (auto m = obj_txt_in.matchFirst(rgx.para_indent)) { _obj_attributes =" \"bullet\": \"false\"," - ~ " \"indent_hang\": " ~ m[1].to!string ~ "," - ~ " \"indent_base\": " ~ m[1].to!string ~ ","; + ~ " \"indent_hang\": " ~ m["indent"].to!string ~ "," + ~ " \"indent_base\": " ~ m["indent"].to!string ~ ","; } else { _obj_attributes =" \"bullet\": \"false\"," ~ " \"indent_hang\": 0," @@ -7047,27 +7047,27 @@ struct NotesSection { ) { debug(endnotes_build) { writeln( - "{^", mkup.ff_o, m[1], ".", mkup.ff_c, "^}" + "{^", mkup.ff_o, m["num"], ".", mkup.ff_c, "^}" ~ mkup.mark_internal_site_lnk, tag_in_seg["seg_lv4"], - ".fnSuffix#noteref_\n ", m[1], " ", - m[2]); // sometimes need segment name (segmented html & epub) + ".fnSuffix#noteref_\n ", m["num"], " ", + m["note"]); // sometimes need segment name (segmented html & epub) } // you need anchor for segments at this point -> - object_notes["anchor"] ~= "note_" ~ m[1] ~ "ใ"; + object_notes["anchor"] ~= "note_" ~ m["num"] ~ "ใ"; object_notes["notes"] ~= (tag_in_seg["seg_lv4"].empty) ? (links_and_images( - "{" ~ mkup.superscript ~ mkup.ff_o ~ m[1] ~ "." ~ mkup.ff_c ~ mkup.superscript ~ "}#noteref_" - ~ m[1]) ~ " " - ~ m[2] ~ "ใ" + "{" ~ mkup.superscript ~ mkup.ff_o ~ m["num"] ~ "." ~ mkup.ff_c ~ mkup.superscript ~ "}#noteref_" + ~ m["num"]) ~ " " + ~ m["note"] ~ "ใ" ) : (links_and_images( - "{" ~ mkup.superscript ~ mkup.ff_o ~ m[1] ~ "." ~ mkup.ff_c ~ mkup.superscript ~ "}" + "{" ~ mkup.superscript ~ mkup.ff_o ~ m["num"] ~ "." ~ mkup.ff_c ~ mkup.superscript ~ "}" ~ mkup.mark_internal_site_lnk ~ tag_in_seg["seg_lv4"] ~ ".fnSuffix#noteref_" - ~ m[1]) ~ " " - ~ m[2] ~ "ใ" + ~ m["num"]) ~ " " + ~ m["note"] ~ "ใ" ); } return object_notes; @@ -7195,7 +7195,7 @@ struct NotesSection { comp_obj_endnote_.attrib.bullet = false; foreach (i, endnote; endnotes_["notes"]) { auto m = endnote.matchFirst(rgx.note_ref); - string notenumber = m[1].to!string; + string notenumber = m["ref"].to!string; string anchor_tag = "note_" ~ notenumber; comp_obj_endnote_.tags.anchor_tags = [ endnotes_["anchor"][i] ]; comp_obj_endnote_.has.inline_links = true; diff --git a/org/output_xmls.org b/org/output_xmls.org index 747ca9d..33995bd 100644 --- a/org/output_xmls.org +++ b/org/output_xmls.org @@ -473,7 +473,7 @@ auto inline_links(O,M)( if (obj.has.inline_links) { if (obj.metainfo.is_a != "code") { _txt = replaceAll!(m => - m[1] ~ "โค" ~ to!string((obj.stow.link[m[2].to!ulong])).encode ~ "โ" + m[1] ~ "โค" ~ to!string((obj.stow.link[m["num"].to!ulong])).encode ~ "โ" )(_txt, rgx.inline_link_number_only); } if ((_txt.match(rgx.mark_internal_site_lnk)) diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d index 9ad6004..2633665 100644 --- a/src/doc_reform/meta/metadoc_from_src.d +++ b/src/doc_reform/meta/metadoc_from_src.d @@ -238,10 +238,10 @@ template DocReformDocAbstraction() { static auto rgx = Rgx(); static auto mkup = InlineMarkup(); line = replaceAll!(m => mkup.quote_o ~ m[1] ~ mkup.quote_c)(line, rgx.within_quotes); - line = replaceAll!(m => mkup.mono ~ mkup.ff_o ~ m[2] ~ mkup.ff_c ~ mkup.mono)(line, rgx.inline_mark_mono); - line = replaceAll!(m => mkup.cite ~ mkup.ff_o ~ m[2] ~ mkup.ff_c ~ mkup.cite)(line, rgx.inline_mark_cite); + line = replaceAll!(m => mkup.mono ~ mkup.ff_o ~ m["text"] ~ mkup.ff_c ~ mkup.mono)(line, rgx.inline_mark_mono); + line = replaceAll!(m => mkup.cite ~ mkup.ff_o ~ m["text"] ~ mkup.ff_c ~ mkup.cite)(line, rgx.inline_mark_cite); foreach (regx; [rgx.inline_mark_emphasis, rgx.inline_mark_bold, rgx.inline_mark_underscore, rgx.inline_mark_italics, rgx.inline_mark_superscript, rgx.inline_mark_subscript, rgx.inline_mark_strike, rgx.inline_mark_insert]) { - line = replaceAll!(m => m[1] ~ mkup.ff_o ~ m[2] ~ mkup.ff_c ~ m[1])(line, regx); + line = replaceAll!(m => m["mark"] ~ mkup.ff_o ~ m["text"] ~ mkup.ff_c ~ m["mark"])(line, regx); } return line; } @@ -254,33 +254,33 @@ template DocReformDocAbstraction() { || obj_txt.match(rgx.smid_inline_link_endnote_url_helper_punctuated) ) { obj_txt = replaceAll!(m => format("%s%s%s%s%s%s%s %s%s%s%s%s%s %s%s", - mkup.lnk_o, m[1].strip, mkup.lnk_c, - mkup.url_o, m[2], mkup.url_c, + mkup.lnk_o, m["content"].strip, mkup.lnk_c, + mkup.url_o, m["link"], mkup.url_c, mkup.en_a_o, - mkup.lnk_o, m[2].strip, mkup.lnk_c, - mkup.url_o, m[2], mkup.url_c, + mkup.lnk_o, m["link"].strip, mkup.lnk_c, + mkup.url_o, m["link"], mkup.url_c, mkup.en_a_c, m[3] ))(obj_txt, rgx.smid_inline_link_endnote_url_helper_punctuated); obj_txt = replaceAll!(m => format("%s%s%s%s%s%s%s %s%s%s%s%s%s %s", - mkup.lnk_o, m[1].strip, mkup.lnk_c, - mkup.url_o, m[2], mkup.url_c, + mkup.lnk_o, m["content"].strip, mkup.lnk_c, + mkup.url_o, m["link"], mkup.url_c, mkup.en_a_o, - mkup.lnk_o, m[2].strip, mkup.lnk_c, - mkup.url_o, m[2], mkup.url_c, + mkup.lnk_o, m["link"].strip, mkup.lnk_c, + mkup.url_o, m["link"], mkup.url_c, mkup.en_a_c ))(obj_txt, rgx.smid_inline_link_endnote_url_helper); } else { obj_txt = replaceAll!(m => format("%s%s%s%s%s%s%s", - m[1], - mkup.lnk_o, m[2].strip, mkup.lnk_c, - mkup.url_o, m[3], mkup.url_c + m["pre"], + mkup.lnk_o, m["content"].strip, mkup.lnk_c, + mkup.url_o, m["link"], mkup.url_c ))(obj_txt, rgx.smid_inline_link_markup_regular); } obj_txt = replaceAll!(m => format("%s%s%s%s%s%s%s", - m[1], - mkup.lnk_o, m[2].strip, mkup.lnk_c, - mkup.url_o, m[2], mkup.url_c + m["pre"], + mkup.lnk_o, m["link"].strip, mkup.lnk_c, + mkup.url_o, m["link"], mkup.url_c ))(obj_txt, rgx.smid_inline_link_naked_url); // } return obj_txt; @@ -646,8 +646,8 @@ template DocReformDocAbstraction() { debug(paraindent) { writeln(line); } - indent["hang_position"] = (m[1]).to!int; - indent["base_position"] = (m[1]).to!int; + indent["hang_position"] = (m["indent"]).to!int; + indent["base_position"] = (m["indent"]).to!int; } else if (line.matchFirst(rgx.para_bullet)) { debug(parabullet) { writeln(line); @@ -658,16 +658,16 @@ template DocReformDocAbstraction() { writeln(line); } indent=[ - "hang_position" : (m[1]).to!int, - "base_position" : (m[2]).to!int, + "hang_position" : (m["hang"]).to!int, + "base_position" : (m["indent"]).to!int, ]; } else if (auto m = line.matchFirst(rgx.para_bullet_indent)) { debug(parabulletindent) { writeln(line); } indent=[ - "hang_position" : (m[1]).to!int, - "base_position" : (m[1]).to!int, + "hang_position" : (m["indent"]).to!int, + "base_position" : (m["indent"]).to!int, ]; bullet = true; } @@ -2588,14 +2588,14 @@ template DocReformDocAbstraction() { line ); } - an_object["table_head"] = m[1].to!string; + an_object["table_head"] = m["attrib"].to!string; an_object["block_type"] = "curly"; obj_type_status["blocks"] = TriState.on; obj_type_status["table"] = TriState.on; obj_type_status["curly_table"] = TriState.on; } else if (auto m = line.matchFirst(rgx.block_curly_table_special_markup)) { /+ table: special table block markup syntax! +/ - an_object["table_head"] = m[1].to!string; + an_object["table_head"] = m["attrib"].to!string; an_object["block_type"] = "special"; obj_type_status["blocks"] = TriState.on; obj_type_status["table"] = TriState.on; @@ -2668,7 +2668,7 @@ template DocReformDocAbstraction() { line ); } - an_object["table_head"] = m[1].to!string; + an_object["table_head"] = m["attrib"].to!string; an_object["block_type"] = "tic"; obj_type_status["blocks"] = TriState.on; obj_type_status["table"] = TriState.on; @@ -2691,7 +2691,7 @@ template DocReformDocAbstraction() { debug(quote) { // quote (curly) close writeln(line); } - an_object[an_object_key] = an_object[an_object_key].stripRight; + an_object[an_object_key] = an_object[an_object_key].stripRight; obj_type_status["blocks"] = TriState.closing; obj_type_status["quote"] = TriState.closing; obj_type_status["curly_quote"] = TriState.off; @@ -2706,7 +2706,7 @@ template DocReformDocAbstraction() { debug(quote) { // quote (tic) close writeln(line); } - an_object[an_object_key] = an_object[an_object_key].stripRight; + an_object[an_object_key] = an_object[an_object_key].stripRight; obj_type_status["blocks"] = TriState.closing; obj_type_status["quote"] = TriState.closing; obj_type_status["tic_quote"] = TriState.off; @@ -2878,7 +2878,7 @@ template DocReformDocAbstraction() { processing.remove("verse"); ++cntr; } - object_number_poem["end"] = obj_cite_digits.object_number.to!string; + object_number_poem["end"] = obj_cite_digits.object_number.to!string; obj_type_status["blocks"] = TriState.closing; obj_type_status["poem"] = TriState.closing; obj_type_status["curly_poem"] = TriState.off; @@ -3671,7 +3671,7 @@ template DocReformDocAbstraction() { debug(bookindexmatch) { writefln( "* [bookindex] %s\n", - m[1].to!string, + m["bookindex"].to!string, ); } an_object["bookindex_nugget"] = m.captures[1].to!string; @@ -4049,8 +4049,8 @@ template DocReformDocAbstraction() { debug(paraindent) { writeln(line); } - indent["hang_position"] = (m[1]).to!int; - indent["base_position"] = (m[1]).to!int; + indent["hang_position"] = (m["indent"]).to!int; + indent["base_position"] = (m["indent"]).to!int; } else if (line.matchFirst(rgx.para_bullet)) { debug(parabullet) { writeln(line); @@ -4061,16 +4061,16 @@ template DocReformDocAbstraction() { writeln(line); } indent=[ - "hang_position" : (m[1]).to!int, - "base_position" : (m[2]).to!int, + "hang_position" : (m["hang"]).to!int, + "base_position" : (m["indent"]).to!int, ]; } else if (auto m = line.matchFirst(rgx.para_bullet_indent)) { debug(parabulletindent) { writeln(line); } indent=[ - "hang_position" : (m[1]).to!int, - "base_position" : (m[1]).to!int, + "hang_position" : (m["indent"]).to!int, + "base_position" : (m["indent"]).to!int, ]; bullet = true; } @@ -5179,16 +5179,16 @@ template DocReformDocAbstraction() { ~ " \"indent_base\": 0,"; } else if (auto m = obj_txt_in.matchFirst(rgx.para_bullet_indent)) { _obj_attributes =" \"bullet\": \"true\"," - ~ " \"indent_hang\": " ~ m[1].to!string ~ "," - ~ " \"indent_base\": " ~ m[1].to!string ~ ","; + ~ " \"indent_hang\": " ~ m["indent"].to!string ~ "," + ~ " \"indent_base\": " ~ m["indent"].to!string ~ ","; } else if (auto m = obj_txt_in.matchFirst(rgx.para_indent_hang)) { _obj_attributes =" \"bullet\": \"false\"," - ~ " \"indent_hang\": " ~ m[1].to!string ~ "," - ~ " \"indent_base\": " ~ m[2].to!string ~ ","; + ~ " \"indent_hang\": " ~ m["hang"].to!string ~ "," + ~ " \"indent_base\": " ~ m["indent"].to!string ~ ","; } else if (auto m = obj_txt_in.matchFirst(rgx.para_indent)) { _obj_attributes =" \"bullet\": \"false\"," - ~ " \"indent_hang\": " ~ m[1].to!string ~ "," - ~ " \"indent_base\": " ~ m[1].to!string ~ ","; + ~ " \"indent_hang\": " ~ m["indent"].to!string ~ "," + ~ " \"indent_base\": " ~ m["indent"].to!string ~ ","; } else { _obj_attributes =" \"bullet\": \"false\"," ~ " \"indent_hang\": 0," @@ -5681,27 +5681,27 @@ template DocReformDocAbstraction() { ) { debug(endnotes_build) { writeln( - "{^", mkup.ff_o, m[1], ".", mkup.ff_c, "^}" + "{^", mkup.ff_o, m["num"], ".", mkup.ff_c, "^}" ~ mkup.mark_internal_site_lnk, tag_in_seg["seg_lv4"], - ".fnSuffix#noteref_\n ", m[1], " ", - m[2]); // sometimes need segment name (segmented html & epub) + ".fnSuffix#noteref_\n ", m["num"], " ", + m["note"]); // sometimes need segment name (segmented html & epub) } // you need anchor for segments at this point -> - object_notes["anchor"] ~= "note_" ~ m[1] ~ "ใ"; + object_notes["anchor"] ~= "note_" ~ m["num"] ~ "ใ"; object_notes["notes"] ~= (tag_in_seg["seg_lv4"].empty) ? (links_and_images( - "{" ~ mkup.superscript ~ mkup.ff_o ~ m[1] ~ "." ~ mkup.ff_c ~ mkup.superscript ~ "}#noteref_" - ~ m[1]) ~ " " - ~ m[2] ~ "ใ" + "{" ~ mkup.superscript ~ mkup.ff_o ~ m["num"] ~ "." ~ mkup.ff_c ~ mkup.superscript ~ "}#noteref_" + ~ m["num"]) ~ " " + ~ m["note"] ~ "ใ" ) : (links_and_images( - "{" ~ mkup.superscript ~ mkup.ff_o ~ m[1] ~ "." ~ mkup.ff_c ~ mkup.superscript ~ "}" + "{" ~ mkup.superscript ~ mkup.ff_o ~ m["num"] ~ "." ~ mkup.ff_c ~ mkup.superscript ~ "}" ~ mkup.mark_internal_site_lnk ~ tag_in_seg["seg_lv4"] ~ ".fnSuffix#noteref_" - ~ m[1]) ~ " " - ~ m[2] ~ "ใ" + ~ m["num"]) ~ " " + ~ m["note"] ~ "ใ" ); } return object_notes; @@ -5817,7 +5817,7 @@ template DocReformDocAbstraction() { comp_obj_endnote_.attrib.bullet = false; foreach (i, endnote; endnotes_["notes"]) { auto m = endnote.matchFirst(rgx.note_ref); - string notenumber = m[1].to!string; + string notenumber = m["ref"].to!string; string anchor_tag = "note_" ~ notenumber; comp_obj_endnote_.tags.anchor_tags = [ endnotes_["anchor"][i] ]; comp_obj_endnote_.has.inline_links = true; diff --git a/src/doc_reform/meta/rgx.d b/src/doc_reform/meta/rgx.d index 8982ea5..7490903 100644 --- a/src/doc_reform/meta/rgx.d +++ b/src/doc_reform/meta/rgx.d @@ -87,36 +87,36 @@ static template DocReformRgxInit() { static heading_biblio_blurb = ctRegex!(`^:?(?:(1)[~][!](?:(?:biblio(?:graphy)?|references?)|blurb)|[A-D1][~])`); static heading_blurb_glossary = ctRegex!(`^:?(?:(1)[~][!](?:blurb|glossary)|[A-D1][~])`); static para_bullet = ctRegex!(`^_[*] `); - static para_bullet_indent = ctRegex!(`^_([1-9])[*] `); + static para_bullet_indent = ctRegex!(`^_(?P<indent>[1-9])[*] `); static para_indent = ctRegex!(`^_(?P<indent>[1-9])[ ]`); static para_indent_hang = ctRegex!(`^_(?P<hang>[0-9])_(?P<indent>[0-9])[ ]`); static para_attribs = ctRegex!(`^_(?:(?:[0-9])(?:_([0-9]))?|(?:[1-9])?[*]) `); static para_inline_link_anchor = ctRegex!(`\*[~](?P<anchor>[a-z0-9_.-]+)(?= |$)`,"i"); /+ blocked markup +/ - static block_open = ctRegex!("^((code(?:[.][a-z][0-9a-z_]+)?|poem|group|block|quote|table)(?:[(][ a-zA-Z0-9;:,]*[)])?[{][ ]*$)|^`{3} (code(?:[.][a-z][0-9a-z_]+)?|poem|group|block|quote|table)(?:[(][ a-zA-Z0-9;:,]*[)])?|^[{]table[(](?:h;)?(?P<columns>(?:[ ,]+[0-9]+)+)[)][}]"); + static block_open = ctRegex!("^((code(?:[.][a-z][0-9a-z#+_]+)?|(?:poem|group|block|quote)(?:[.][a-z][0-9a-z_]+)?|table)(?:[(][ a-zA-Z0-9;:,]*[)])?[{][ ]*$)|^`{3} (code(?:[.][a-z][0-9a-z#+_]+)?|(?:poem|group|block|quote)(?:[.][a-z][0-9a-z_]+)?|table)(?:[(][ a-zA-Z0-9;:,]*[)])?|^[{]table[(](?:h;)?(?P<columns>(?:[ ,]+[0-9]+)+)[)][}]"); static block_poem_open = ctRegex!("^((poem(?:[(][ a-zA-Z0-9;:,]*[)])?[{][ ]*$)|`{3} poem(?:[(][ a-zA-Z0-9;:,]*[)])?)"); /+ blocked markup tics +/ - static block_tic_open = ctRegex!("^`{3} (code(?:[.][a-z][0-9a-z_]+)?|poem|group|block|quote|table)"); - static block_tic_code_open = ctRegex!("^`{3} (?:code)(?:[.](?P<syntax>[a-z][0-9a-z_]+))?(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?"); - static block_tic_poem_open = ctRegex!("^`{3} (poem)(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?"); - static block_tic_group_open = ctRegex!("^`{3} (group)(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?"); - static block_tic_block_open = ctRegex!("^`{3} (block)(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?"); - static block_tic_quote_open = ctRegex!("^`{3} (quote)(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?"); + static block_tic_open = ctRegex!("^`{3} (code(?:[.][a-z][0-9a-z#+_]+)?|(?:poem|group|block|quote)(?:[.][a-z][0-9a-z_]+)?|table)"); + static block_tic_code_open = ctRegex!("^`{3} code(?:[.](?P<syntax>[a-z][0-9a-z#+_]+))?(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?"); + static block_tic_poem_open = ctRegex!("^`{3} poem(?:[.](?P<lang>[a-z][0-9a-z_]+))?(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?"); + static block_tic_group_open = ctRegex!("^`{3} group(?:[.](?P<lang>[a-z][0-9a-z_]+))?(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?"); + static block_tic_block_open = ctRegex!("^`{3} block(?:[.](?P<lang>[a-z][0-9a-z_]+))?(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?"); + static block_tic_quote_open = ctRegex!("^`{3} quote(?:[.](?P<lang>[a-z][0-9a-z_]+))?(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?"); static block_tic_table_open = ctRegex!("^`{3} table(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?"); // ctRegex!("^`{3} table(?:\(.*?\))?"); static block_tic_close = ctRegex!("^(`{3})$","m"); /+ blocked markup curly +/ - static block_curly_open = ctRegex!(`^((?:code([.][a-z][0-9a-z_]+)?|poem|group|block|quote|table)(?:[(][ a-zA-Z0-9;:,]*[)])?[{][ ]*$)`); + static block_curly_open = ctRegex!(`^((?:code([.][a-z][0-9a-z#+_]+)?|(?:poem|group|block|quote)(?:[.][a-z][0-9a-z_]+)?|table)(?:[(][ a-zA-Z0-9;:,]*[)])?[{][ ]*$)`); static block_curly_code_open = ctRegex!(`^(?:code(?:[.](?P<syntax>[a-z][0-9a-z_]+))?(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?[{][ ]*$)`); static block_curly_code_close = ctRegex!(`^([}]code)`); - static block_curly_poem_open = ctRegex!(`^(poem(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?[{][ ]*$)`); + static block_curly_poem_open = ctRegex!(`^(poem(?:[.](?P<lang>[a-z][0-9a-z_]+))?(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?[{][ ]*$)`); static block_curly_poem_close = ctRegex!(`^([}]poem)`); - static block_curly_group_open = ctRegex!(`^(group(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?[{][ ]*$)`); + static block_curly_group_open = ctRegex!(`^(group(?:[.](?P<lang>[a-z][0-9a-z_]+))?(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?[{][ ]*$)`); static block_curly_group_close = ctRegex!(`^([}]group)`); - static block_curly_block_open = ctRegex!(`^(block(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?[{][ ]*$)`); + static block_curly_block_open = ctRegex!(`^(block(?:[.](?P<lang>[a-z][0-9a-z_]+))?(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?[{][ ]*$)`); static block_curly_block_close = ctRegex!(`^([}]block)`); - static block_curly_quote_open = ctRegex!(`^(quote(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?[{][ ]*$)`); + static block_curly_quote_open = ctRegex!(`^(quote(?:[.](?P<lang>[a-z][0-9a-z_]+))?(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?[{][ ]*$)`); static block_curly_quote_close = ctRegex!(`^([}]quote)`); - static block_curly_table_open = ctRegex!(`^table(?:[(]([?P<attrib> a-zA-Z0-9;:,]*)[)])?[{][ ]*$`); + static block_curly_table_open = ctRegex!(`^table(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?[{][ ]*$`); static block_curly_table_close = ctRegex!(`^([}]table)`); static block_curly_table_special_markup = ctRegex!(`^[{]table[(](?P<attrib>(?:(h);)?(?P<columns>(?:[, ]+[0-9]+)+))[)][}]`, "mg"); static code_numbering = ctRegex!(`(?P<number>\bnumber\b)`); @@ -146,7 +146,7 @@ static template DocReformRgxInit() { static inline_curly_delimiter_open_star_or_plus = ctRegex!(`~\{[+*]`, "m"); static inline_curly_delimiter_close_regular = ctRegex!(`\s*\}~`, "m"); static inline_text_and_note_curly = ctRegex!(`(?P<text>.+?)(?:(?:[~])[{][*+ ]*)(?P<note>.+?)(?:[}][~])`, "mg"); - static note_ref = ctRegex!(`^\S+?noteref_([0-9]+)`, "mg"); // {^{73.}^}#noteref_73 + static note_ref = ctRegex!(`^\S+?noteref_(?P<ref>[0-9]+)`, "mg"); // {^{73.}^}#noteref_73 static webserv_url_doc_root = ctRegex!(`(?P<url>(?P<domain>https?:\/\/[^ /]+)\/(?P<path>\S*))`, "mg"); static smid_inline_url_generic = ctRegex!(`(?:^|[}(\[ ])(?:(?:https?|git):\/\/|ยค?\.\.\/|ยค?\.\/|ยค|#)[a-zA-Z0-9_#]`, "mg"); static smid_inline_url = ctRegex!(`((?:(?:https?|git):\/\/|ยค?\.\.\/|ยค?\.\/|ยค|#)[a-zA-Z0-9_]\S*)`, "mg"); @@ -169,7 +169,7 @@ static template DocReformRgxInit() { static smid_b_mod_image_without_dimensions = ctRegex!(`[โฅ](?:~\^\s+|\s*)โผ\S+\.(?:png|gif|jpg),w0h0.*[โ](?:โค.*?โ|(?:https?|git):\/\/\S+?)(?=[;:!,?.]?([ )\]]|$))`, "mg"); static smid_image_delimit = ctRegex!(`(?P<pre>^|[ ]|[^\S]?)\{\s*(?P<text>.+?)\s*\}(?:image)(?=[;:!,?.]?([ )\]]|$))`, "mg"); /+ inline markup book index +/ - static book_index = ctRegex!(`^=\{\s*(.+?)\}$`, "m"); + static book_index = ctRegex!(`^=\{\s*(?P<bookindex>.+?)\}$`, "m"); static book_index_open = ctRegex!(`^=\{\s*([^}]*?)$`); static book_index_close = ctRegex!(`^(.*?)\}$`, "m"); static auto_heading_numbering_lv1 = ctRegex!(`^1~`, "m"); @@ -283,7 +283,7 @@ static template DocReformRgxInit() { static inline_image_info = ctRegex!(`โผ?(?P<img>[a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P<width>\d+)h(?P<height>\d+)`, "mg"); static inline_link_anchor = ctRegex!(`โ(?P<anchor>\S+?)โ`, "mg"); // TODO *~text_link_anchor static inline_link_ = ctRegex!(`โฅ(?P<text>.+?)โโค(?P<link>.+?)โ`, "mg"); - static inline_link = ctRegex!(`โฅ(?P<text>.+?)โโค(?P<link>\S+?)โ`, "mg"); + static inline_link = ctRegex!(`โฅ(?P<text>.+?)โโค(?P<link>#?(\S+?))โ`, "mg"); static inline_link_empty = ctRegex!(`โฅ(?P<text>.+?)โโคโ`, "mg"); static inline_link_number = ctRegex!(`โฅ(?P<text>.+?)โโค(?P<num>[0-9]+)โ`, "mg"); // not used static inline_link_number_only = ctRegex!(`(โฅ.+?โ)โค(?P<num>[0-9]+)โ`, "mg"); @@ -303,16 +303,16 @@ static template DocReformRgxInit() { /+ inline markup font face mod +/ static inline_mark_faces = ctRegex!(`(?P<markup>(?P<mod>[*!/_^,+#"-])\{(?P<text>.+?)\}[*!/_^,+#"-])`, "mg"); static inline_mark_faces_to_mod = ctRegex!(`(?P<mod>[*!/_^,+#"-])\{(?P<text>.+?)\}([*!/_^,+#"-])`, "mg"); - static inline_mark_emphasis = ctRegex!(`([*])\{(?P<text>.+?)\}[*]`, "mg"); - static inline_mark_bold = ctRegex!(`([!])\{(?P<text>.+?)\}[!]`, "mg"); - static inline_mark_underscore = ctRegex!(`([_])\{(?P<text>.+?)\}[_]`, "mg"); - static inline_mark_italics = ctRegex!(`([/])\{(?P<text>.+?)\}[/]`, "mg"); - static inline_mark_superscript = ctRegex!(`(\^)\{(?P<text>.+?)\}\^`, "mg"); - static inline_mark_subscript = ctRegex!(`([,])\{(?P<text>.+?)\}[,]`, "mg"); - static inline_mark_strike = ctRegex!(`([-])\{(?P<text>.+?)\}[-]`, "mg"); - static inline_mark_insert = ctRegex!(`([+])\{(?P<text>.+?)\}[+]`, "mg"); - static inline_mark_mono = ctRegex!(`([#])\{(?P<text>.+?)\}[#]`, "mg"); - static inline_mark_cite = ctRegex!(`(["])\{(?P<text>.+?)\}["]`, "mg"); + static inline_mark_emphasis = ctRegex!(`(?P<mark>[*])\{(?P<text>.+?)\}[*]`, "mg"); + static inline_mark_bold = ctRegex!(`(?P<mark>[!])\{(?P<text>.+?)\}[!]`, "mg"); + static inline_mark_underscore = ctRegex!(`(?P<mark>[_])\{(?P<text>.+?)\}[_]`, "mg"); + static inline_mark_italics = ctRegex!(`(?P<mark>[/])\{(?P<text>.+?)\}[/]`, "mg"); + static inline_mark_superscript = ctRegex!(`(?P<mark>\^)\{(?P<text>.+?)\}\^`, "mg"); + static inline_mark_subscript = ctRegex!(`(?P<mark>[,])\{(?P<text>.+?)\}[,]`, "mg"); + static inline_mark_strike = ctRegex!(`(?P<mark>[-])\{(?P<text>.+?)\}[-]`, "mg"); + static inline_mark_insert = ctRegex!(`(?P<mark>[+])\{(?P<text>.+?)\}[+]`, "mg"); + static inline_mark_mono = ctRegex!(`(?P<mark>[#])\{(?P<text>.+?)\}[#]`, "mg"); + static inline_mark_cite = ctRegex!(`(?P<mark>["])\{(?P<text>.+?)\}["]`, "mg"); static inline_mark_fontface_clean = ctRegex!(`[*!_/^,+#โ "-]\{|\}[*!_/^,+#โ "-]`, "mg"); static inline_faces_line = ctRegex!(`^[*!/_]_ (?P<text>.+?)((?: [\\]{2}|[~]#){0,2}$)`); static inline_emphasis_line = ctRegex!(`^\*_ (?P<text>.+?)(?P<tail>(?: [\\]{2}|[~]#){0,2}$)`); diff --git a/src/doc_reform/output/rgx.d b/src/doc_reform/output/rgx.d index 2ddc57f..7c1247a 100644 --- a/src/doc_reform/output/rgx.d +++ b/src/doc_reform/output/rgx.d @@ -72,7 +72,7 @@ static template DocReformOutputRgxInit() { static inline_image_info = ctRegex!(`โผ?(?P<img>[a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P<width>\d+)h(?P<height>\d+)`, "mg"); static inline_link_anchor = ctRegex!(`โ(?P<anchor>\S+?)โ`, "mg"); // TODO *~text_link_anchor static inline_link_ = ctRegex!(`โฅ(?P<text>.+?)โโค(?P<link>.+?)โ`, "mg"); - static inline_link = ctRegex!(`โฅ(?P<text>.+?)โโค(?P<link>\S+?)โ`, "mg"); + static inline_link = ctRegex!(`โฅ(?P<text>.+?)โโค(?P<link>#?(\S+?))โ`, "mg"); static inline_link_empty = ctRegex!(`โฅ(?P<text>.+?)โโคโ`, "mg"); static inline_link_number = ctRegex!(`โฅ(?P<text>.+?)โโค(?P<num>[0-9]+)โ`, "mg"); // not used static inline_link_number_only = ctRegex!(`(โฅ.+?โ)โค(?P<num>[0-9]+)โ`, "mg"); @@ -92,16 +92,16 @@ static template DocReformOutputRgxInit() { /+ inline markup font face mod +/ static inline_mark_faces = ctRegex!(`(?P<markup>(?P<mod>[*!/_^,+#"-])\{(?P<text>.+?)\}[*!/_^,+#"-])`, "mg"); static inline_mark_faces_to_mod = ctRegex!(`(?P<mod>[*!/_^,+#"-])\{(?P<text>.+?)\}([*!/_^,+#"-])`, "mg"); - static inline_mark_emphasis = ctRegex!(`([*])\{(?P<text>.+?)\}[*]`, "mg"); - static inline_mark_bold = ctRegex!(`([!])\{(?P<text>.+?)\}[!]`, "mg"); - static inline_mark_underscore = ctRegex!(`([_])\{(?P<text>.+?)\}[_]`, "mg"); - static inline_mark_italics = ctRegex!(`([/])\{(?P<text>.+?)\}[/]`, "mg"); - static inline_mark_superscript = ctRegex!(`(\^)\{(?P<text>.+?)\}\^`, "mg"); - static inline_mark_subscript = ctRegex!(`([,])\{(?P<text>.+?)\}[,]`, "mg"); - static inline_mark_strike = ctRegex!(`([-])\{(?P<text>.+?)\}[-]`, "mg"); - static inline_mark_insert = ctRegex!(`([+])\{(?P<text>.+?)\}[+]`, "mg"); - static inline_mark_mono = ctRegex!(`([#])\{(?P<text>.+?)\}[#]`, "mg"); - static inline_mark_cite = ctRegex!(`(["])\{(?P<text>.+?)\}["]`, "mg"); + static inline_mark_emphasis = ctRegex!(`(?P<mark>[*])\{(?P<text>.+?)\}[*]`, "mg"); + static inline_mark_bold = ctRegex!(`(?P<mark>[!])\{(?P<text>.+?)\}[!]`, "mg"); + static inline_mark_underscore = ctRegex!(`(?P<mark>[_])\{(?P<text>.+?)\}[_]`, "mg"); + static inline_mark_italics = ctRegex!(`(?P<mark>[/])\{(?P<text>.+?)\}[/]`, "mg"); + static inline_mark_superscript = ctRegex!(`(?P<mark>\^)\{(?P<text>.+?)\}\^`, "mg"); + static inline_mark_subscript = ctRegex!(`(?P<mark>[,])\{(?P<text>.+?)\}[,]`, "mg"); + static inline_mark_strike = ctRegex!(`(?P<mark>[-])\{(?P<text>.+?)\}[-]`, "mg"); + static inline_mark_insert = ctRegex!(`(?P<mark>[+])\{(?P<text>.+?)\}[+]`, "mg"); + static inline_mark_mono = ctRegex!(`(?P<mark>[#])\{(?P<text>.+?)\}[#]`, "mg"); + static inline_mark_cite = ctRegex!(`(?P<mark>["])\{(?P<text>.+?)\}["]`, "mg"); static inline_mark_fontface_clean = ctRegex!(`[*!_/^,+#โ "-]\{|\}[*!_/^,+#โ "-]`, "mg"); static inline_faces_line = ctRegex!(`^[*!/_]_ (?P<text>.+?)((?: [\\]{2}|[~]#){0,2}$)`); static inline_emphasis_line = ctRegex!(`^\*_ (?P<text>.+?)(?P<tail>(?: [\\]{2}|[~]#){0,2}$)`); diff --git a/src/doc_reform/output/xmls.d b/src/doc_reform/output/xmls.d index ffcbd1a..e494bab 100644 --- a/src/doc_reform/output/xmls.d +++ b/src/doc_reform/output/xmls.d @@ -356,7 +356,7 @@ template outputXHTMLs() { if (obj.has.inline_links) { if (obj.metainfo.is_a != "code") { _txt = replaceAll!(m => - m[1] ~ "โค" ~ to!string((obj.stow.link[m[2].to!ulong])).encode ~ "โ" + m[1] ~ "โค" ~ to!string((obj.stow.link[m["num"].to!ulong])).encode ~ "โ" )(_txt, rgx.inline_link_number_only); } if ((_txt.match(rgx.mark_internal_site_lnk)) |