From da32ec40fc237b03f22aac329017d06735289a3a Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 20 Mar 2019 13:03:02 -0400 Subject: housekeeping --- org/default_regex.org | 50 +++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 41 insertions(+), 9 deletions(-) (limited to 'org/default_regex.org') 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[1-9])[ ]`); +static para_indent_hang = ctRegex!(`^_(?P[0-9])_(?P[0-9])[ ]`); static para_attribs = ctRegex!(`^_(?:(?:[0-9])(?:_([0-9]))?|(?:[1-9])?[*]) `); static para_inline_link_anchor = ctRegex!(`\*[~](?P[a-z0-9_.-]+)(?= |$)`,"i"); #+END_SRC @@ -280,10 +280,18 @@ static smid_inline_link_endnote_url_helper = ctRegex!(`\{~\^\s+(?P(?:^|[ ]|[^\S]?)[{┥](?:~\^\s+|\s*))(?P\S+\.(?:png|gif|jpg))(?P(?:.*?)\s*[}┝](?:image|┤.*?├|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$)))`, "mg"); +static smid_image = ctRegex!(`(?P
(?:^|[ ]|[^\S]?)[{┥](?:~\^\s+|\s*))(?P[a-zA-Z0-9._-]+?\.(?:png|gif|jpg))(?P(?:.*?)\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
(?:^|[ ]|[^\S]?)[{┥](?:~\^\s+|\s*))(?P\S+\.(?:png|gif|jpg))\s+(?P\d+)x(?P\d+)\s*(?P(?:.*?)\s*[}┝](?:image|┤.*?├|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$)))`, "mg");
+static smid_image_with_dimensions                      = ctRegex!(`(?P
(?:^|[ ]|[^\S]?)[{┥](?:~\^\s+|\s*))(?P[a-zA-Z0-9._-]+?\.(?:png|gif|jpg))\s+(?P\d+)x(?P\d+)\s*(?P(?:.*?)\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
(?:^|[ ]|[^\S]?)[{](?:~\^\s+|\s*))(?P[a-zA-Z0-9._-]+?\.(?:png|gif|jpg))(?P(?:.*?)\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
(?:^|[ ]|[^\S]?)[{](?:~\^\s+|\s*))(?P[a-zA-Z0-9._-]+?\.(?:png|gif|jpg))\s+(?P\d+)x(?P\d+)\s*(?P(?:.*?)\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
(?:^|[ ]|[^\S]?)[┥](?:~\^\s+|\s*))(?P[a-zA-Z0-9._-]+?\.(?:png|gif|jpg))(?P(?:.*?)\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
(?:^|[ ]|[^\S]?)[┥](?:~\^\s+|\s*))(?P[a-zA-Z0-9._-]+?\.(?:png|gif|jpg))\s+(?P\d+)x(?P\d+)\s*(?P(?:.*?)\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
^|[ ]|[^\S]?)\{\s*(?P.+?)\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(?:[/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.+?)】`, "m");
 static inline_notes_al_gen_ref                        = ctRegex!(`【(?P[*+]\s+)\s*(?P.+?)】`, "mg");
+static inline_notes_al_regular_number_note            = ctRegex!(`【(?P\d+)\s+(?P.+?)\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\d+)\s+(?P.+?)】`, "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.+?)【(?:[*+ ]*)(?P.+?)】`, "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
┥)☼(?P(?P\S+?\.(?:jpg|gif|png)),w(?P\d+)h(?P\d+))\s*(?P.*?┝┤.*?├)`, "mg");
-static inline_image_without_dimensions                = ctRegex!(`(?P
┥)☼(?P(?P\S+?\.(?:jpg|gif|png)),w(?P0)h(?P0))\s*(?P.*?┝┤.*?├)`, "mg");
+/+ inline markup links +/
+static inline_image                                   = ctRegex!(`(?P
┥)☼(?P(?P[a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P\d+)h(?P\d+))\s*(?P.*?┝┤.*?├)`, "mg");
+static inline_image_without_dimensions                = ctRegex!(`(?P
┥)☼(?P(?P[a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P0)h(?P0))\s*(?P.*?┝┤.*?├)`, "mg");
+static inline_image_info                              = ctRegex!(`☼?(?P[a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P\d+)h(?P\d+)`, "mg");
 static inline_link_anchor                             = ctRegex!(`┋(?P\S+?)┋`, "mg"); // TODO *~text_link_anchor
 static inline_link_                                   = ctRegex!(`┥(?P.+?)┝┤(?P.+?)├`, "mg");
 static inline_link                                    = ctRegex!(`┥(?P.+?)┝┤(?P\S+?)├`, "mg");
@@ -516,6 +547,7 @@ static inline_link_hash                               = ctRegex!(`┥(?P.+
 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[5-7])~ ┥(?P.+?)┝┤(?P.+?)├`, "mg");
 static fn_suffix                                      = ctRegex!(`\.fnSuffix`, "mg");
 static inline_link_fn_suffix                          = ctRegex!(`¤(.+?)(\.fnSuffix)`, "mg");
-- 
cgit v1.2.3