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 --- src/doc_reform/meta/rgx.d | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'src/doc_reform/meta/rgx.d') 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 +/ -- cgit v1.2.3