From d67f94fc2af8be775dd9cc01f5feacd501b71721 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 12 Dec 2018 10:53:41 -0500 Subject: 0.4.1 markup syntax extension for blocks, re: attributes - for all blocks, e.g. - table{ - table(){ - table([recognized attributes if any]){ - code{ - code(){ - code.d([recognized attributes if any]){ - allows for the subsequent addition of attributes as required --- org/default_regex.org | 40 ++++++++++++++++++++-------------------- org/doc_reform.org | 2 +- src/doc_reform/meta/rgx.d | 40 ++++++++++++++++++++-------------------- views/version.txt | 2 +- 4 files changed, 42 insertions(+), 42 deletions(-) diff --git a/org/default_regex.org b/org/default_regex.org index be628dd..ad8b9e5 100644 --- a/org/default_regex.org +++ b/org/default_regex.org @@ -76,7 +76,7 @@ static levels_markup = ctRegex!(`^[A-D1-4]$`); static levels_numbered = ctRegex!(`^[0-9]$`); static levels_numbered_headings = ctRegex!(`^[0-7]$`); static numeric = ctRegex!(`[ 0-9,.-]+`); -static numeric_col = ctRegex!(`^[ 0-9,.$£₤Є€€¥-]+$`); +static numeric_col = ctRegex!(`^[ 0-9,.%$£₤Є€€¥()-]+$`); #+END_SRC ** comments :comment: @@ -174,8 +174,8 @@ static para_inline_link_anchor = ctRegex!(`\*[~](?P(?:[ ]+[0-9]+;)+)[}]"); -static block_poem_open = ctRegex!("^((poem[{].*?$)|`{3} poem)"); +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(?:[ ,]+[0-9]+)+)[)][}]"); +static block_poem_open = ctRegex!("^((poem(?:[(][ a-zA-Z0-9;:,#]*[)])?[{][ ]*$)|`{3} poem(?:[(][ a-zA-Z0-9;:,#]*[)])?)"); #+END_SRC *** blocked markup tic :block:tic: @@ -183,13 +183,13 @@ static block_poem_open = ctRegex!("^((poem[{].*?$ #+name: meta_rgx #+BEGIN_SRC d /+ blocked markup tics +/ -static block_tic_open = ctRegex!("^`{3} (code([.][a-z][0-9a-z_]+)?|poem|group|block|quote|table)"); // what of numbered code? -static block_tic_code_open = ctRegex!("^`{3} (?:code)(?:[.]([a-z][0-9a-z_]+))?(?:[ ]+([#]))?"); // extract additional info -static block_tic_poem_open = ctRegex!("^`{3} (poem)"); -static block_tic_group_open = ctRegex!("^`{3} (group)"); -static block_tic_block_open = ctRegex!("^`{3} (block)"); -static block_tic_quote_open = ctRegex!("^`{3} (quote)"); -static block_tic_table_open = ctRegex!("^`{3} table(.*)"); +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[a-z][0-9a-z_]+))?(?:[(](?P[ a-zA-Z0-9;:,#]*)[)])?"); +static block_tic_poem_open = ctRegex!("^`{3} (poem)(?:[(](?P[ a-zA-Z0-9;:,]*)[)])?"); +static block_tic_group_open = ctRegex!("^`{3} (group)(?:[(](?P[ a-zA-Z0-9;:,]*)[)])?"); +static block_tic_block_open = ctRegex!("^`{3} (block)(?:[(](?P[ a-zA-Z0-9;:,]*)[)])?"); +static block_tic_quote_open = ctRegex!("^`{3} (quote)(?:[(](?P[ a-zA-Z0-9;:,]*)[)])?"); +static block_tic_table_open = ctRegex!("^`{3} table(?:[(](?P[ a-zA-Z0-9;:,]*)[)])?"); // ctRegex!("^`{3} table(?:\(.*?\))?"); static block_tic_close = ctRegex!("^(`{3})$","m"); #+END_SRC @@ -198,27 +198,27 @@ static block_tic_close = ctRegex!("^(`{3})$","m") #+name: meta_rgx #+BEGIN_SRC d /+ blocked markup curly +/ -static block_curly_open = ctRegex!(`^((code([.][a-z][0-9a-z_]+)?|poem|group|block|quote|table)[{].*?$)`); -static block_curly_code_open = ctRegex!(`^(?:code(?:[.]([a-z][0-9a-z_]+))?[{]([#]?)\s*$)`); // extract additional info +static block_curly_open = ctRegex!(`^((?:code([.][a-z][0-9a-z_]+)?|poem|group|block|quote|table)(?:[(][ a-zA-Z0-9;:,#]*[)])?[{][ ]*$)`); +static block_curly_code_open = ctRegex!(`^(?:code(?:[.](?P[a-z][0-9a-z_]+))?(?:[(](?P[ a-zA-Z0-9;:,#]*)[)])?[{][ ]*$)`); static block_curly_code_close = ctRegex!(`^([}]code)`); -static block_curly_poem_open = ctRegex!(`^(poem[{].*?$)`); +static block_curly_poem_open = ctRegex!(`^(poem(?:[(](?P[ a-zA-Z0-9;:,]*)[)])?[{][ ]*$)`); static block_curly_poem_close = ctRegex!(`^([}]poem)`); -static block_curly_group_open = ctRegex!(`^(group[{].*?$)`); +static block_curly_group_open = ctRegex!(`^(group(?:[(](?P[ a-zA-Z0-9;:,]*)[)])?[{][ ]*$)`); static block_curly_group_close = ctRegex!(`^([}]group)`); -static block_curly_block_open = ctRegex!(`^(block[{].*?$)`); +static block_curly_block_open = ctRegex!(`^(block(?:[(](?P[ a-zA-Z0-9;:,]*)[)])?[{][ ]*$)`); static block_curly_block_close = ctRegex!(`^([}]block)`); -static block_curly_quote_open = ctRegex!(`^(quote[{].*?$)`); +static block_curly_quote_open = ctRegex!(`^(quote(?:[(](?P[ a-zA-Z0-9;:,]*)[)])?[{][ ]*$)`); static block_curly_quote_close = ctRegex!(`^([}]quote)`); -static block_curly_table_open = ctRegex!(`^table[{](.*)`); +static block_curly_table_open = ctRegex!(`^table(?:[(]([?P a-zA-Z0-9;:,]*)[)])?[{][ ]*$`); static block_curly_table_close = ctRegex!(`^([}]table)`); -static block_curly_table_special_markup = ctRegex!(`^[{]table((~h)?(?P(?:[ ]+[0-9]+;)+))[}]`, "mg"); +static block_curly_table_special_markup = ctRegex!(`^[{]table[(](?P(?:(h);)?(?P(?:[, ]+[0-9]+)+))[)][}]`, "mg"); #+END_SRC *** block sub-matches :block:curly: #+name: meta_rgx #+BEGIN_SRC d -static table_head_instructions = ctRegex!(`(?Ph)?(?:[ ]+c(?P[0-9]);)?(?P(?:[ ]+[0-9]+[lr]?;)+)`); +static table_head_instructions = ctRegex!(`(?:(?Ph);)?(?:[ ]+c(?P[0-9]):)?(?P(?:[, ]+[0-9]+[lr]?)+)`); static table_col_widths_and_alignment = ctRegex!(`(?P[0-9]+)(?P[lr]?)`); static table_col_widths = ctRegex!(`(?P[0-9]+)`); static table_col_align = ctRegex!(`(?P[lr]?)`); @@ -293,7 +293,7 @@ static book_index_close = ctRegex!(`^(.*?)\}$`, "m #+name: meta_rgx #+BEGIN_SRC d /+ no object_number object +/ -static object_number_off = ctRegex!(`~#$`, "m"); +static object_number_off = ctRegex!(`~#[ ]*$`, "m"); static object_number_off_dh = ctRegex!(`-#$`, "m"); static object_number_off_all = ctRegex!(`[~-]#$`, "m"); #+END_SRC diff --git a/org/doc_reform.org b/org/doc_reform.org index afc7477..bef16f0 100644 --- a/org/doc_reform.org +++ b/org/doc_reform.org @@ -26,7 +26,7 @@ struct Version { int minor; int patch; } -enum ver = Version(0, 4, 0); +enum ver = Version(0, 4, 1); #+END_SRC ** compilation restrictions (supported compilers) diff --git a/src/doc_reform/meta/rgx.d b/src/doc_reform/meta/rgx.d index 6143656..6cf9c28 100644 --- a/src/doc_reform/meta/rgx.d +++ b/src/doc_reform/meta/rgx.d @@ -33,7 +33,7 @@ static template DocReformRgxInit() { static levels_numbered = ctRegex!(`^[0-9]$`); static levels_numbered_headings = ctRegex!(`^[0-7]$`); static numeric = ctRegex!(`[ 0-9,.-]+`); - static numeric_col = ctRegex!(`^[ 0-9,.$£₤Є€€¥-]+$`); + static numeric_col = ctRegex!(`^[ 0-9,.%$£₤Є€€¥()-]+$`); /+ comments +/ static comment = ctRegex!(`^%+ `); static comments = ctRegex!(`^%+ |^%+$`); @@ -93,33 +93,33 @@ static template DocReformRgxInit() { static para_attribs = ctRegex!(`^_(?:(?:[0-9])(?:_([0-9]))?|(?:[1-9])?[*]) `); static para_inline_link_anchor = ctRegex!(`\*[~](?P[a-z0-9_.-]+)(?= |$)`,"i"); /+ blocked markup +/ - static block_open = ctRegex!("^((code([.][a-z][0-9a-z_]+)?|poem|group|block|quote|table)[{].*?$)|^`{3} (code([.][a-z][0-9a-z_]+)?|poem|group|block|quote|table)|^[{]table(~h)?(?P(?:[ ]+[0-9]+;)+)[}]"); - static block_poem_open = ctRegex!("^((poem[{].*?$)|`{3} poem)"); + 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(?:[ ,]+[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)"); // what of numbered code? - static block_tic_code_open = ctRegex!("^`{3} (?:code)(?:[.]([a-z][0-9a-z_]+))?(?:[ ]+([#]))?"); // extract additional info - static block_tic_poem_open = ctRegex!("^`{3} (poem)"); - static block_tic_group_open = ctRegex!("^`{3} (group)"); - static block_tic_block_open = ctRegex!("^`{3} (block)"); - static block_tic_quote_open = ctRegex!("^`{3} (quote)"); - static block_tic_table_open = ctRegex!("^`{3} table(.*)"); + 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[a-z][0-9a-z_]+))?(?:[(](?P[ a-zA-Z0-9;:,#]*)[)])?"); + static block_tic_poem_open = ctRegex!("^`{3} (poem)(?:[(](?P[ a-zA-Z0-9;:,]*)[)])?"); + static block_tic_group_open = ctRegex!("^`{3} (group)(?:[(](?P[ a-zA-Z0-9;:,]*)[)])?"); + static block_tic_block_open = ctRegex!("^`{3} (block)(?:[(](?P[ a-zA-Z0-9;:,]*)[)])?"); + static block_tic_quote_open = ctRegex!("^`{3} (quote)(?:[(](?P[ a-zA-Z0-9;:,]*)[)])?"); + static block_tic_table_open = ctRegex!("^`{3} table(?:[(](?P[ 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)[{].*?$)`); - static block_curly_code_open = ctRegex!(`^(?:code(?:[.]([a-z][0-9a-z_]+))?[{]([#]?)\s*$)`); // extract additional info + static block_curly_open = ctRegex!(`^((?:code([.][a-z][0-9a-z_]+)?|poem|group|block|quote|table)(?:[(][ a-zA-Z0-9;:,#]*[)])?[{][ ]*$)`); + static block_curly_code_open = ctRegex!(`^(?:code(?:[.](?P[a-z][0-9a-z_]+))?(?:[(](?P[ a-zA-Z0-9;:,#]*)[)])?[{][ ]*$)`); static block_curly_code_close = ctRegex!(`^([}]code)`); - static block_curly_poem_open = ctRegex!(`^(poem[{].*?$)`); + static block_curly_poem_open = ctRegex!(`^(poem(?:[(](?P[ a-zA-Z0-9;:,]*)[)])?[{][ ]*$)`); static block_curly_poem_close = ctRegex!(`^([}]poem)`); - static block_curly_group_open = ctRegex!(`^(group[{].*?$)`); + static block_curly_group_open = ctRegex!(`^(group(?:[(](?P[ a-zA-Z0-9;:,]*)[)])?[{][ ]*$)`); static block_curly_group_close = ctRegex!(`^([}]group)`); - static block_curly_block_open = ctRegex!(`^(block[{].*?$)`); + static block_curly_block_open = ctRegex!(`^(block(?:[(](?P[ a-zA-Z0-9;:,]*)[)])?[{][ ]*$)`); static block_curly_block_close = ctRegex!(`^([}]block)`); - static block_curly_quote_open = ctRegex!(`^(quote[{].*?$)`); + static block_curly_quote_open = ctRegex!(`^(quote(?:[(](?P[ a-zA-Z0-9;:,]*)[)])?[{][ ]*$)`); static block_curly_quote_close = ctRegex!(`^([}]quote)`); - static block_curly_table_open = ctRegex!(`^table[{](.*)`); + static block_curly_table_open = ctRegex!(`^table(?:[(]([?P a-zA-Z0-9;:,]*)[)])?[{][ ]*$`); static block_curly_table_close = ctRegex!(`^([}]table)`); - static block_curly_table_special_markup = ctRegex!(`^[{]table((~h)?(?P(?:[ ]+[0-9]+;)+))[}]`, "mg"); - static table_head_instructions = ctRegex!(`(?Ph)?(?:[ ]+c(?P[0-9]);)?(?P(?:[ ]+[0-9]+[lr]?;)+)`); + static block_curly_table_special_markup = ctRegex!(`^[{]table[(](?P(?:(h);)?(?P(?:[, ]+[0-9]+)+))[)][}]`, "mg"); + static table_head_instructions = ctRegex!(`(?:(?Ph);)?(?:[ ]+c(?P[0-9]):)?(?P(?:[, ]+[0-9]+[lr]?)+)`); static table_col_widths_and_alignment = ctRegex!(`(?P[0-9]+)(?P[lr]?)`); static table_col_widths = ctRegex!(`(?P[0-9]+)`); static table_col_align = ctRegex!(`(?P[lr]?)`); @@ -163,7 +163,7 @@ static template DocReformRgxInit() { static book_index_open = ctRegex!(`^=\{\s*([^}]+?)$`); static book_index_close = ctRegex!(`^(.*?)\}$`, "m"); /+ no object_number object +/ - static object_number_off = ctRegex!(`~#$`, "m"); + static object_number_off = ctRegex!(`~#[ ]*$`, "m"); static object_number_off_dh = ctRegex!(`-#$`, "m"); static object_number_off_all = ctRegex!(`[~-]#$`, "m"); /+ no object_number block +/ diff --git a/views/version.txt b/views/version.txt index de1a62b..735996e 100644 --- a/views/version.txt +++ b/views/version.txt @@ -4,7 +4,7 @@ struct Version { int minor; int patch; } -enum ver = Version(0, 4, 0); +enum ver = Version(0, 4, 1); version (Posix) { version (DigitalMars) { } else version (LDC) { -- cgit v1.2.3