From 13ea2d6b2d551013a4c10a22d60e7e666986b979 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 21 May 2019 12:00:35 -0400 Subject: a regex & some clearing --- org/default_regex.org | 28 +--------------------------- org/source_files_read.org | 12 ------------ src/doc_reform/meta/rgx.d | 22 +--------------------- src/doc_reform/source/read_source_files.d | 12 ------------ 4 files changed, 2 insertions(+), 72 deletions(-) diff --git a/org/default_regex.org b/org/default_regex.org index 25536ff..e8b6b3f 100644 --- a/org/default_regex.org +++ b/org/default_regex.org @@ -104,38 +104,12 @@ static make_simple_substitutions_d = ctRegex!(`(?P[a-z_]+):\s*(?P.*)`, "m"); -static native_header_sub = ctRegex!(`^[ ]*:(?P[a-z_]+):\s+(?P.+)`, "m"); -static native_header_meta_title = ctRegex!(`^@title:\s`, "m"); static variable_doc_title = ctRegex!(`@title`); static variable_doc_author = ctRegex!(`@author|@creator`); static raw_author_munge = ctRegex!(`(\S.+?),\s+(.+)`,"i"); static toml_header_meta_title = ctRegex!(`^\s*(title\s*=\s*"|\[title\])`, "m"); #+END_SRC -*** subheader :native:subheader: - -#+name: meta_rgx -#+BEGIN_SRC d -/+ head +/ -static native_subhead_creator = ctRegex!(`^(?:author|translator|illustrator)$`, "m"); -static native_subhead_title = ctRegex!(`^(?:main|sub(?:title)?|full|language|edition|note)$`, "m"); -static native_subhead_rights = ctRegex!(`^(?:copyright|illustrations|license|cover)$`, "m"); -static native_subhead_date = ctRegex!(`^(?:published|created|issued|available|valid|modified|added_to_site)$`, "m"); -static native_subhead_original = ctRegex!(`^(?:title|language|source)$`, "m"); -static native_subhead_classify = ctRegex!(`^(?:topic_register|subject|keywords|loc|dewey)$`, "m"); -static native_subhead_identifier = ctRegex!(`^(?:oclc|pg|isbn)$`, "m"); -static native_subhead_notes = ctRegex!(`^(?:abstract|description)$`, "m"); -static native_subhead_publisher = ctRegex!(`^(?:name)$`, "m"); -static native_subhead_make = ctRegex!(`^(?:cover_image|home_button_image|home_button_text|footer|headings|num_top|auto_num_depth|breaks|substitute|bold|italics|emphasis|texpdf_font|css)$`, "m"); -#+END_SRC - ** heading & paragraph operators :paragraph:operator: #+name: meta_rgx @@ -330,7 +304,7 @@ static auto_heading_numbering_off_lv4 = ctRegex!(`^4~\S*?-\s`, "m static object_number_off = ctRegex!(`~#[ ]*$`, "m"); static object_number_off_dummy_heading = ctRegex!(`-#$`, "m"); static object_number_off_all = ctRegex!(`[~-]#$`, "m"); -static repeated_character_line_separator = ctRegex!(`^(?:(?:(?:[.][ ]?){4,}|(?:[-][ ]?|[~][ ]?|[*][ ]?|[$][ ]?|[#][ ]?|[\\][ ]?|[/][ ]?){2,})\s*?)*$`); +static repeated_character_line_separator = ctRegex!(`^(?:[ ]*(?:(?:[.][ ]*){4,}|(?:[-][ ]*|[~][ ]*|[*][ ]*|[$][ ]*|[#][ ]*|[\\][ ]*|[/][ ]*){2,})\s*?)+$`); #+END_SRC ** no object_number block :ocn:off:block: diff --git a/org/source_files_read.org b/org/source_files_read.org index 495b856..a7e5b1c 100644 --- a/org/source_files_read.org +++ b/org/source_files_read.org @@ -544,18 +544,6 @@ if (type1["curly_code"] == 1) { type1["header_make"] = 0; type1["header_meta"] = 0; contents_insert ~= line; -} else if ( - (type1["header_make"] == 1) - && line.matchFirst(rgx.native_header_sub) -) { - type1["header_make"] = 1; - type1["header_meta"] = 0; -} else if ( - (type1["header_meta"] == 1) - && line.matchFirst(rgx.native_header_sub) -) { - type1["header_meta"] = 1; - type1["header_make"] = 0; } else if (auto m = line.match(rgx.insert_src_fn_ssi_or_sst)) { type1["header_make"] = 0; type1["header_meta"] = 0; diff --git a/src/doc_reform/meta/rgx.d b/src/doc_reform/meta/rgx.d index ecaa97c..373400f 100644 --- a/src/doc_reform/meta/rgx.d +++ b/src/doc_reform/meta/rgx.d @@ -41,30 +41,10 @@ static template DocReformRgxInit() { static make_simple_substitutions_rb = ctRegex!(`(?P/(?P.+?)/,[ ]*['"](?P.+?)['"])`); static make_simple_substitutions_d = ctRegex!(`(?P` ~ '`' ~ `(?P.+?)` ~ '`' ~ `,[ ]*['"](?P.+?)['"])`); /+ header +/ - static main_headers = - ctRegex!(`^(?:creator|title|rights|date|original|classify|identifier|notes|publisher|make|links)$`, "m"); - static native_header = ctRegex!(`^@([a-z_]+):(?:\s|$)`); - static native_header_make = ctRegex!(`^@(make):(?:\s|$)`); - static native_header_meta = - ctRegex!(`^@(?:creator|title|rights|date|original|classify|identifier|notes|publisher|links):(?:\s|$)`); - static native_header_main = ctRegex!(`^@(?P
[a-z_]+):\s*(?P.*)`, "m"); - static native_header_sub = ctRegex!(`^[ ]*:(?P[a-z_]+):\s+(?P.+)`, "m"); - static native_header_meta_title = ctRegex!(`^@title:\s`, "m"); static variable_doc_title = ctRegex!(`@title`); static variable_doc_author = ctRegex!(`@author|@creator`); static raw_author_munge = ctRegex!(`(\S.+?),\s+(.+)`,"i"); static toml_header_meta_title = ctRegex!(`^\s*(title\s*=\s*"|\[title\])`, "m"); - /+ head +/ - static native_subhead_creator = ctRegex!(`^(?:author|translator|illustrator)$`, "m"); - static native_subhead_title = ctRegex!(`^(?:main|sub(?:title)?|full|language|edition|note)$`, "m"); - static native_subhead_rights = ctRegex!(`^(?:copyright|illustrations|license|cover)$`, "m"); - static native_subhead_date = ctRegex!(`^(?:published|created|issued|available|valid|modified|added_to_site)$`, "m"); - static native_subhead_original = ctRegex!(`^(?:title|language|source)$`, "m"); - static native_subhead_classify = ctRegex!(`^(?:topic_register|subject|keywords|loc|dewey)$`, "m"); - static native_subhead_identifier = ctRegex!(`^(?:oclc|pg|isbn)$`, "m"); - static native_subhead_notes = ctRegex!(`^(?:abstract|description)$`, "m"); - static native_subhead_publisher = ctRegex!(`^(?:name)$`, "m"); - static native_subhead_make = ctRegex!(`^(?:cover_image|home_button_image|home_button_text|footer|headings|num_top|auto_num_depth|breaks|substitute|bold|italics|emphasis|texpdf_font|css)$`, "m"); /+ heading & paragraph operators +/ static heading_a = ctRegex!(`^:?[A][~] `, "m"); static heading = ctRegex!(`^:?([A-D1-4])[~]([a-z0-9_.-]*[?]?)\s+`,"i"); @@ -185,7 +165,7 @@ static template DocReformRgxInit() { static object_number_off = ctRegex!(`~#[ ]*$`, "m"); static object_number_off_dummy_heading = ctRegex!(`-#$`, "m"); static object_number_off_all = ctRegex!(`[~-]#$`, "m"); - static repeated_character_line_separator = ctRegex!(`^(?:(?:(?:[.][ ]?){4,}|(?:[-][ ]?|[~][ ]?|[*][ ]?|[$][ ]?|[#][ ]?|[\\][ ]?|[/][ ]?){2,})\s*?)*$`); + static repeated_character_line_separator = ctRegex!(`^(?:[ ]*(?:(?:[.][ ]*){4,}|(?:[-][ ]*|[~][ ]*|[*][ ]*|[$][ ]*|[#][ ]*|[\\][ ]*|[/][ ]*){2,})\s*?)+$`); /+ no object_number block +/ static object_number_off_block = ctRegex!(`^--~#$`); static object_number_off_block_dummy_heading = ctRegex!(`^---#$`); diff --git a/src/doc_reform/source/read_source_files.d b/src/doc_reform/source/read_source_files.d index ae6f32e..5c1e6fb 100644 --- a/src/doc_reform/source/read_source_files.d +++ b/src/doc_reform/source/read_source_files.d @@ -187,18 +187,6 @@ static template DocReformRawMarkupContent() { type1["header_make"] = 0; type1["header_meta"] = 0; contents_insert ~= line; - } else if ( - (type1["header_make"] == 1) - && line.matchFirst(rgx.native_header_sub) - ) { - type1["header_make"] = 1; - type1["header_meta"] = 0; - } else if ( - (type1["header_meta"] == 1) - && line.matchFirst(rgx.native_header_sub) - ) { - type1["header_meta"] = 1; - type1["header_make"] = 0; } else if (auto m = line.match(rgx.insert_src_fn_ssi_or_sst)) { type1["header_make"] = 0; type1["header_meta"] = 0; -- cgit v1.2.3