diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2019-04-30 19:22:32 -0400 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2019-05-17 16:59:54 -0400 |
commit | 2660db249780e6ec90bf63c43bc1e85785a88cf3 (patch) | |
tree | b4a63ffe0fbb9445342427f56ce31a2926a53cf3 /src/doc_reform/meta/rgx.d | |
parent | (segmented html) dummy heading related (diff) |
regex, meta_abstraction, naming of some regex submatches
Diffstat (limited to 'src/doc_reform/meta/rgx.d')
-rw-r--r-- | src/doc_reform/meta/rgx.d | 54 |
1 files changed, 27 insertions, 27 deletions
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}$)`); |