diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2019-05-21 12:00:35 -0400 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2019-05-21 12:00:35 -0400 |
commit | 13ea2d6b2d551013a4c10a22d60e7e666986b979 (patch) | |
tree | 57a13844a775bbdc9a3c4c9ac1f7a5e76cf65659 /src/doc_reform | |
parent | cosmetic mostly (diff) |
a regex & some clearing
Diffstat (limited to 'src/doc_reform')
-rw-r--r-- | src/doc_reform/meta/rgx.d | 22 | ||||
-rw-r--r-- | src/doc_reform/source/read_source_files.d | 12 |
2 files changed, 1 insertions, 33 deletions
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<substitution>/(?P<match>.+?)/,[ ]*['"](?P<replace>.+?)['"])`); static make_simple_substitutions_d = ctRegex!(`(?P<substitution>` ~ '`' ~ `(?P<match>.+?)` ~ '`' ~ `,[ ]*['"](?P<replace>.+?)['"])`); /+ 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<header>[a-z_]+):\s*(?P<content>.*)`, "m"); - static native_header_sub = ctRegex!(`^[ ]*:(?P<subheader>[a-z_]+):\s+(?P<content>.+)`, "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; |