From 172c0417022b847d4a1f1011979d8fdae9700519 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 28 Aug 2019 10:50:16 -0400 Subject: markup modification: table attributes --- lib/sisu/ao_doc_str.rb | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'lib') diff --git a/lib/sisu/ao_doc_str.rb b/lib/sisu/ao_doc_str.rb index 27152b98..5b1f8f61 100644 --- a/lib/sisu/ao_doc_str.rb +++ b/lib/sisu/ao_doc_str.rb @@ -296,7 +296,7 @@ module SiSU_AO_DocumentStructureExtract else nil end end - if t_o !~/^(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block)\{|^\}(?:code|poem|alt|group|block)|^(?:table\{|\{table)[ ~]/ \ + if t_o !~/^(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block)\{|^\}(?:code|poem|alt|group|block)|^(?:table\(.+?\)\{|\{table\()/ \ and t_o !~/^```[ ]+(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table)|^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$|^`:quote_(?:open|close)`/ \ and @per.code==:off \ and @per.poem==:off \ @@ -613,7 +613,7 @@ module SiSU_AO_DocumentStructureExtract } t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h) #tuned_file << t_o #% find second source, entered twice, should be once so closed off here - elsif t_o =~/^(?:table\{|```[ ]+table|\{table)[ ~]/ + elsif t_o =~/^(?:table\(.+?\)\{|```[ ]+table\(.+?\)|\{table\(.+?\))/ @num_id[:table] +=1 h={ is_for: :table, @@ -623,15 +623,15 @@ module SiSU_AO_DocumentStructureExtract } ins_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h) tuned_file << ins_o - if t_o=~/^table\{(?:~h)?\s+/ + if t_o=~/^table\((?:.*?\bh;\s+)?.+?\)\{/ @per.table=:curls @rows='' case t_o - when /table\{~h\s+c(\d+);\s+(.+)/ + when /table\(.*?\bh;\s+c(\d+):\s+(.+?)\)\{/ cols=$1 col=$2.scan(/\d+/) heading=true - when /table\{\s+c(\d+);\s+(.+)/ + when /table\(.*?c(\d+):\s+(.+?)\)\{/ cols=$1 col=$2.scan(/\d+/) heading=false @@ -642,15 +642,15 @@ module SiSU_AO_DocumentStructureExtract widths: col, idx: idx, } - elsif t_o=~/^```[ ]+table(?:~h)?\s+c\d+/ + elsif t_o=~/^```[ ]+table\((?:.*?\bh;)?\s+c\d+:/ @per.table=:tics @rows='' case t_o - when /^```[ ]+table~h\s+c(\d+);\s+(.+)/ + when /^```[ ]+table\(.*?\bh;\s+c(\d+):\s+(.+?)\)/ cols=$1 col=$2.scan(/\d+/) heading=true - when /^```[ ]+table\s+c(\d+);\s+(.+)/ + when /^```[ ]+table\(\s*c(\d+):\s+(.+?)\)/ cols=$1 col=$2.scan(/\d+/) heading=false @@ -661,10 +661,10 @@ module SiSU_AO_DocumentStructureExtract widths: col, idx: idx, } - elsif t_o=~/^\{table(?:~h)?(?:\s+\d+;?)?\}\n.+\Z/m + elsif t_o=~/^\{table\((?:.*?\bh;\s+)?(?:\s+\d+,?)?\)\s*\}\n.+\Z/m m1,m2,hd=nil,nil,nil - tbl=/^\{table(?:~h)?(?:\s+\d+;?)?\}\n(.+)\Z/m.match(t_o)[1] - hd=((t_o =~/^\{table~h/) ? true : false) + tbl=/^\{table\((?:.*?\bh;\s+)?(?:\s+\d+,?)*\)\s*\}\n(.+)\Z/m.match(t_o)[1] # fix + hd=((t_o =~/^\{table\(.*?\bh;\s+/) ? true : false) tbl,tags=extract_tags(tbl) rws=tbl.split(/\n/) rows='' @@ -675,7 +675,7 @@ module SiSU_AO_DocumentStructureExtract rows += r + Mx[:tc_c] end col=[] - if t_o =~/^\{table(?:~h)?\s+(\d+);?\}/ #width of col 1 given as %, usually when wider than rest that are even + if t_o =~/^\{table\((?:.*?\bh;\s+)?\s+c(\d+):.*?\)\s*\}/ #width of col 1 given as %, usually when wider than rest that are even c1=$1.to_i width=(100 - c1)/(cols - 1) col=[ c1 ] @@ -704,12 +704,12 @@ module SiSU_AO_DocumentStructureExtract } t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h) t_o - elsif t_o=~/^```[ ]+table(?:~h)?\s+/ + elsif t_o=~/^```[ ]+table\((?:.*?\bh;)?\s+/ m1,m2,hd=nil,nil,nil h=case t_o - when /^```[ ]+table~h\s+(.+?)\n(.+)\Z/m #two table representations should be consolidated as one + when /^```[ ]+table\(.*?\bh;\s+(.+?)\)\n(.+)\Z/m #two table representations should be consolidated as one m1,tbl,hd=$1,$2,true - when /^```[ ]+table\s+(.+?)\n(.+)\Z/m #two table representations should be consolidated as one + when /^```[ ]+table\((.+?)\)\n(.+)\Z/m #two table representations should be consolidated as one m1,tbl,hd=$1,$2,false else nil end @@ -741,12 +741,12 @@ module SiSU_AO_DocumentStructureExtract } t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h) t_o - elsif t_o=~/^\{table(?:~h)?\s+/ + elsif t_o=~/^\{table\((?:.*?\bh;)?/ m1,m2,hd=nil,nil,nil h=case t_o - when /\{table~h\s+(.+?)\}\n(.+)\Z/m #two table representations should be consolidated as one + when /\{table\(.*?\bh;\s+(.+?)\)\s*\}\n(.+)\Z/m #two table representations should be consolidated as one m1,tbl,hd=$1,$2,true - when /\{table\s+(.+?)\}\n(.+)\Z/m #two table representations should be consolidated as one + when /\{table\((.+?)\)\s*\}\n(.+)\Z/m #two table representations should be consolidated as one m1,tbl,hd=$1,$2,false else nil end -- cgit v1.2.3