diff options
Diffstat (limited to 'org/default_regex.org')
-rw-r--r-- | org/default_regex.org | 50 |
1 files changed, 41 insertions, 9 deletions
diff --git a/org/default_regex.org b/org/default_regex.org index b20c564..f95be72 100644 --- a/org/default_regex.org +++ b/org/default_regex.org @@ -162,8 +162,8 @@ static heading_biblio_blurb = ctRegex!(`^:?(?:(1)[~][! static heading_blurb_glossary = ctRegex!(`^:?(?:(1)[~][!](?:blurb|glossary)|[A-D1][~])`); static para_bullet = ctRegex!(`^_[*] `); static para_bullet_indent = ctRegex!(`^_([1-9])[*] `); -static para_indent = ctRegex!(`^_([1-9]) `); -static para_indent_hang = ctRegex!(`^_([0-9])_([0-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"); #+END_SRC @@ -280,10 +280,18 @@ static smid_inline_link_endnote_url_helper = ctRegex!(`\{~\^\s+(?P<co #+name: meta_rgx #+BEGIN_SRC d static image = ctRegex!(`([a-zA-Z0-9._-]+?\.(?:png|gif|jpg))`, "mg"); -static smid_image = ctRegex!(`(?P<pre>(?:^|[ ]|[^\S]?)[{┥](?:~\^\s+|\s*))(?P<image>\S+\.(?:png|gif|jpg))(?P<post>(?:.*?)\s*[}┝](?:image|┤.*?├|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$)))`, "mg"); +static smid_image = ctRegex!(`(?P<pre>(?:^|[ ]|[^\S]?)[{┥](?:~\^\s+|\s*))(?P<image>[a-zA-Z0-9._-]+?\.(?:png|gif|jpg))(?P<post>(?:.*?)\s*[}┝](?:image|┤.*?├|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$)))`, "mg"); static smid_image_generic = ctRegex!(`(?:^|[ ]|[^\S]?)[{┥](?:~\^\s+|\s*)\S+\.(?:png|gif|jpg).*?[}┝](?:image|┤.*?├|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$))`, "mg"); -static smid_image_with_dimensions = ctRegex!(`(?P<pre>(?:^|[ ]|[^\S]?)[{┥](?:~\^\s+|\s*))(?P<image>\S+\.(?:png|gif|jpg))\s+(?P<width>\d+)x(?P<height>\d+)\s*(?P<post>(?:.*?)\s*[}┝](?:image|┤.*?├|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$)))`, "mg"); +static smid_image_with_dimensions = ctRegex!(`(?P<pre>(?:^|[ ]|[^\S]?)[{┥](?:~\^\s+|\s*))(?P<image>[a-zA-Z0-9._-]+?\.(?:png|gif|jpg))\s+(?P<width>\d+)x(?P<height>\d+)\s*(?P<post>(?:.*?)\s*[}┝](?:image|┤.*?├|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$)))`, "mg"); static smid_mod_image_without_dimensions = ctRegex!(`[{┥](?:~\^\s+|\s*)☼\S+\.(?:png|gif|jpg),w0h0.*[}┝](?:image|┤.*?├|(?:https?|git):\/\/\S+?)(?=[;:!,?.]?([ )\]]|$))`, "mg"); +static smid_a_image = ctRegex!(`(?P<pre>(?:^|[ ]|[^\S]?)[{](?:~\^\s+|\s*))(?P<image>[a-zA-Z0-9._-]+?\.(?:png|gif|jpg))(?P<post>(?:.*?)\s*[}](?:image|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$)))`, "mg"); +static smid_a_image_generic = ctRegex!(`(?:^|[ ]|[^\S]?)[{](?:~\^\s+|\s*)\S+\.(?:png|gif|jpg).*?[}](?:image|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$))`, "mg"); +static smid_a_image_with_dimensions = ctRegex!(`(?P<pre>(?:^|[ ]|[^\S]?)[{](?:~\^\s+|\s*))(?P<image>[a-zA-Z0-9._-]+?\.(?:png|gif|jpg))\s+(?P<width>\d+)x(?P<height>\d+)\s*(?P<post>(?:.*?)\s*[}](?:image|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$)))`, "mg"); +static smid_a_mod_image_without_dimensions = ctRegex!(`[{](?:~\^\s+|\s*)☼\S+\.(?:png|gif|jpg),w0h0.*[}](?:image|(?:https?|git):\/\/\S+?)(?=[;:!,?.]?([ )\]]|$))`, "mg"); +static smid_b_image = ctRegex!(`(?P<pre>(?:^|[ ]|[^\S]?)[┥](?:~\^\s+|\s*))(?P<image>[a-zA-Z0-9._-]+?\.(?:png|gif|jpg))(?P<post>(?:.*?)\s*[┝](?:┤.*?├|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$)))`, "mg"); +static smid_b_image_generic = ctRegex!(`(?:^|[ ]|[^\S]?)[┥](?:~\^\s+|\s*)\S+\.(?:png|gif|jpg).*?[┝](?:┤.*?├|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$))`, "mg"); +static smid_b_image_with_dimensions = ctRegex!(`(?P<pre>(?:^|[ ]|[^\S]?)[┥](?:~\^\s+|\s*))(?P<image>[a-zA-Z0-9._-]+?\.(?:png|gif|jpg))\s+(?P<width>\d+)x(?P<height>\d+)\s*(?P<post>(?:.*?)\s*[┝](?:┤.*?├|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$)))`, "mg"); +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"); #+END_SRC @@ -297,6 +305,22 @@ static book_index_open = ctRegex!(`^=\{\s*([^}]*? static book_index_close = ctRegex!(`^(.*?)\}$`, "m"); #+END_SRC +** switch +*** switch off auto-heading number + +#+name: meta_rgx +#+BEGIN_SRC d +static auto_heading_numbering_lv1 = ctRegex!(`^1~`, "m"); +static auto_heading_numbering_lv2 = ctRegex!(`^2~`, "m"); +static auto_heading_numbering_lv3 = ctRegex!(`^3~`, "m"); +static auto_heading_numbering_lv4 = ctRegex!(`^4~`, "m"); +static auto_heading_numbering_off = ctRegex!(`^[A-D1-4]~\S*?-\s`, "m"); +static auto_heading_numbering_off_lv1 = ctRegex!(`^1~\S*?-\s`, "m"); +static auto_heading_numbering_off_lv2 = ctRegex!(`^2~\S*?-\s`, "m"); +static auto_heading_numbering_off_lv3 = ctRegex!(`^3~\S*?-\s`, "m"); +static auto_heading_numbering_off_lv4 = ctRegex!(`^4~\S*?-\s`, "m"); +#+END_SRC + ** no object_number object :ocn:off:object: #+name: meta_rgx @@ -305,6 +329,7 @@ static book_index_close = ctRegex!(`^(.*?)\}$`, "m static object_number_off = ctRegex!(`~#[ ]*$`, "m"); static object_number_off_dh = ctRegex!(`-#$`, "m"); static object_number_off_all = ctRegex!(`[~-]#$`, "m"); +static repeated_character_line_separator = ctRegex!(`^(?:(?:(?:[.][ ]?){4,}|(?:[-][ ]?|[~][ ]?|[*][ ]?|[$][ ]?|[#][ ]?|[\\][ ]?|[/][ ]?){2,})\s*?)*$`); #+END_SRC ** no object_number block :ocn:off:block: @@ -467,6 +492,11 @@ static src_formalised_file_path_parts = ctRegex!(`(?P<pth>(?:[/a #+name: prgmkup_rgx #+BEGIN_SRC d /+ line breaks +/ +static empty_line = ctRegex!(`^\s*$`); +static empty_block = ctRegex!(`^\s*$`, "mg"); +static br_line_natural = ctRegex!(`\n`, "mg"); +static br_empty_line = ctRegex!(`\n[ ]*\n`, "mg"); +static br_newlines_linebreaks = ctRegex!(`[\n┘┙]`, "mg"); static br_line = ctRegex!(`┘`, "mg"); static br_nl = ctRegex!(`┙`, "mg"); static br_paragraph = ctRegex!(`┚`, "mg"); @@ -483,15 +513,15 @@ static br_page_new = ctRegex!(`╂`, "mg"); static inline_notes_al = ctRegex!(`【(?:[*+]\s+|\s*)(.+?)】`, "mg"); static inline_notes_al_special = ctRegex!(`【(?:[*+]\s+)(.+?)】`, "mg"); // TODO remove match when special footnotes are implemented static inline_notes_al_gen = ctRegex!(`【.+?】`, "m"); +static inline_notes_al_regular = ctRegex!(`【(.+?)】`, "mg"); static inline_notes_al_gen_text = ctRegex!(`【(?P<text>.+?)】`, "m"); static inline_notes_al_gen_ref = ctRegex!(`【(?P<ref>[*+]\s+)\s*(?P<text>.+?)】`, "mg"); +static inline_notes_al_regular_number_note = ctRegex!(`【(?P<num>\d+)\s+(?P<note>.+?)\s*】`, "mg"); static inline_al_delimiter_open_regular = ctRegex!(`【\s`, "m"); static inline_al_delimiter_open_symbol_star = ctRegex!(`【[*]\s`, "m"); static inline_al_delimiter_open_symbol_plus = ctRegex!(`【[+]\s`, "m"); static inline_al_delimiter_close_regular = ctRegex!(`】`, "m"); static inline_al_delimiter_open_and_close_regular = ctRegex!(`【|】`, "m"); -static inline_notes_delimiter_al_regular = ctRegex!(`【(.+?)】`, "mg"); -static inline_notes_delimiter_al_regular_number_note = ctRegex!(`【(?P<num>\d+)\s+(?P<note>.+?)】`, "mg"); static inline_al_delimiter_open_asterisk = ctRegex!(`【\*`, "m"); static inline_al_delimiter_open_plus = ctRegex!(`【\+`, "m"); static inline_text_and_note_al = ctRegex!(`(?P<text>.+?)【(?:[*+ ]*)(?P<note>.+?)】`, "mg"); @@ -502,9 +532,10 @@ static inline_text_and_note_al_ = ctRegex!(`(.+?(?:【[*+] #+name: prgmkup_rgx #+BEGIN_SRC d -/+ inline markup footnotes endnotes +/ -static inline_image = ctRegex!(`(?P<pre>┥)☼(?P<imginf>(?P<img>\S+?\.(?:jpg|gif|png)),w(?P<width>\d+)h(?P<height>\d+))\s*(?P<post>.*?┝┤.*?├)`, "mg"); -static inline_image_without_dimensions = ctRegex!(`(?P<pre>┥)☼(?P<imginf>(?P<img>\S+?\.(?:jpg|gif|png)),w(?P<width>0)h(?P<height>0))\s*(?P<post>.*?┝┤.*?├)`, "mg"); +/+ inline markup links +/ +static inline_image = ctRegex!(`(?P<pre>┥)☼(?P<imginf>(?P<img>[a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P<width>\d+)h(?P<height>\d+))\s*(?P<post>.*?┝┤.*?├)`, "mg"); +static inline_image_without_dimensions = ctRegex!(`(?P<pre>┥)☼(?P<imginf>(?P<img>[a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P<width>0)h(?P<height>0))\s*(?P<post>.*?┝┤.*?├)`, "mg"); +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"); @@ -516,6 +547,7 @@ static inline_link_hash = ctRegex!(`┥(?P<text>.+ static inline_link_clean = ctRegex!(`┤(?:.+?)├|[┥┝]`, "mg"); static inline_a_url = ctRegex!(`(┤)([^\s┥┝┤├]+)(├)`, "mg"); static url = ctRegex!(`https?://`, "mg"); +static uri = ctRegex!(`(?:https?|git)://`, "mg"); static inline_link_subtoc = ctRegex!(`^(?P<level>[5-7])~ ┥(?P<text>.+?)┝┤(?P<link>.+?)├`, "mg"); static fn_suffix = ctRegex!(`\.fnSuffix`, "mg"); static inline_link_fn_suffix = ctRegex!(`¤(.+?)(\.fnSuffix)`, "mg"); |