From 422dff833551ef5f2eb9530edbd8ea710d59a0f3 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 12 Dec 2018 17:22:26 -0500 Subject: code block, number(ed), regex for keyword instruction, not implemented - code(number){ to number code block (hash symbol "#" used previously) --- org/default_regex.org | 20 ++++++++++++++------ org/meta_abstraction.org | 6 ++++-- src/doc_reform/meta/metadoc_from_src.d | 6 ++++-- src/doc_reform/meta/rgx.d | 11 ++++++----- 4 files changed, 28 insertions(+), 15 deletions(-) diff --git a/org/default_regex.org b/org/default_regex.org index ad8b9e5..6138eb5 100644 --- a/org/default_regex.org +++ b/org/default_regex.org @@ -174,8 +174,8 @@ static para_inline_link_anchor = ctRegex!(`\*[~](?P(?:[ ,]+[0-9]+)+)[)][}]"); -static block_poem_open = ctRegex!("^((poem(?:[(][ a-zA-Z0-9;:,#]*[)])?[{][ ]*$)|`{3} poem(?:[(][ a-zA-Z0-9;:,#]*[)])?)"); +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: @@ -184,7 +184,7 @@ static block_poem_open = ctRegex!("^((poem(?:[(][ #+BEGIN_SRC d /+ blocked markup tics +/ 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_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;:,]*)[)])?"); @@ -198,8 +198,8 @@ 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)(?:[(][ 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_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(?:[(](?P[ a-zA-Z0-9;:,]*)[)])?[{][ ]*$)`); static block_curly_poem_close = ctRegex!(`^([}]poem)`); @@ -214,7 +214,15 @@ static block_curly_table_close = ctRegex!(`^([}]table)`); static block_curly_table_special_markup = ctRegex!(`^[{]table[(](?P(?:(h);)?(?P(?:[, ]+[0-9]+)+))[)][}]`, "mg"); #+END_SRC -*** block sub-matches :block:curly: +*** block sub-matches :block: +**** code + +#+name: meta_rgx +#+BEGIN_SRC d +static code_numbering = ctRegex!(`(?P\bnumber\b)`); +#+END_SRC + +**** table #+name: meta_rgx #+BEGIN_SRC d diff --git a/org/meta_abstraction.org b/org/meta_abstraction.org index 51b089c..1a9c53c 100644 --- a/org/meta_abstraction.org +++ b/org/meta_abstraction.org @@ -3161,7 +3161,8 @@ void _start_block_(L,T,N)( if (auto m = line.matchFirst(rgx.block_curly_code_open)) { /+ curly code open +/ code_block_syntax = (m.captures[1]) ? m.captures[1].to!string : ""; - code_block_numbered = (m.captures[2] == "#") ? true : false; + code_block_numbered = (m.captures[2].matchFirst(rgx.code_numbering)) + ? true : false; debug(codecurly) { // code (curly) open writefln( "* [code curly] %s", @@ -3246,7 +3247,8 @@ void _start_block_(L,T,N)( } else if (auto m = line.matchFirst(rgx.block_tic_code_open)) { /+ tic code open +/ code_block_syntax = (m.captures[1]) ? m.captures[1].to!string : ""; - code_block_numbered = (m.captures[2] == "#") ? true : false; + code_block_numbered = (m.captures[2].matchFirst(rgx.code_numbering)) + ? true : false; debug(codetic) { // code (tic) open writefln( "* [code tic] %s", diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d index 66efc04..4f12e0b 100644 --- a/src/doc_reform/meta/metadoc_from_src.d +++ b/src/doc_reform/meta/metadoc_from_src.d @@ -2446,7 +2446,8 @@ template DocReformDocAbstraction() { if (auto m = line.matchFirst(rgx.block_curly_code_open)) { /+ curly code open +/ code_block_syntax = (m.captures[1]) ? m.captures[1].to!string : ""; - code_block_numbered = (m.captures[2] == "#") ? true : false; + code_block_numbered = (m.captures[2].matchFirst(rgx.code_numbering)) + ? true : false; debug(codecurly) { // code (curly) open writefln( "* [code curly] %s", @@ -2525,7 +2526,8 @@ template DocReformDocAbstraction() { } else if (auto m = line.matchFirst(rgx.block_tic_code_open)) { /+ tic code open +/ code_block_syntax = (m.captures[1]) ? m.captures[1].to!string : ""; - code_block_numbered = (m.captures[2] == "#") ? true : false; + code_block_numbered = (m.captures[2].matchFirst(rgx.code_numbering)) + ? true : false; debug(codetic) { // code (tic) open writefln( "* [code tic] %s", diff --git a/src/doc_reform/meta/rgx.d b/src/doc_reform/meta/rgx.d index 6cf9c28..8c592a6 100644 --- a/src/doc_reform/meta/rgx.d +++ b/src/doc_reform/meta/rgx.d @@ -93,11 +93,11 @@ 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)(?:[(][ 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;:,#]*[)])?)"); + 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)"); - static block_tic_code_open = ctRegex!("^`{3} (?:code)(?:[.](?P[a-z][0-9a-z_]+))?(?:[(](?P[ a-zA-Z0-9;:,#]*)[)])?"); + 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;:,]*)[)])?"); @@ -105,8 +105,8 @@ static template DocReformRgxInit() { 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)(?:[(][ 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_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(?:[(](?P[ a-zA-Z0-9;:,]*)[)])?[{][ ]*$)`); static block_curly_poem_close = ctRegex!(`^([}]poem)`); @@ -119,6 +119,7 @@ static template DocReformRgxInit() { 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[(](?P(?:(h);)?(?P(?:[, ]+[0-9]+)+))[)][}]`, "mg"); + static code_numbering = ctRegex!(`(?P\bnumber\b)`); 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]+)`); -- cgit v1.2.3