diff options
author | Ralph Amissah <ralph@amissah.com> | 2019-08-28 10:50:16 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2019-09-03 12:08:28 -0400 |
commit | 172c0417022b847d4a1f1011979d8fdae9700519 (patch) | |
tree | 594dcbf3cc398c0cc832ea00e5f8f2e7d9c97834 | |
parent | markup modification: distinguish blocks and groups (diff) |
markup modification: table attributes
-rw-r--r-- | data/doc/sisu/CHANGELOG_v7 | 3 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/manual/en/sisu_howto.sst | 2 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/manual/en/sisu_markup.sst | 8 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/manual/en/sisu_output_overview.sst | 6 | ||||
-rw-r--r-- | lib/sisu/ao_doc_str.rb | 36 |
5 files changed, 29 insertions, 26 deletions
diff --git a/data/doc/sisu/CHANGELOG_v7 b/data/doc/sisu/CHANGELOG_v7 index 7e7a44c5..dce249e0 100644 --- a/data/doc/sisu/CHANGELOG_v7 +++ b/data/doc/sisu/CHANGELOG_v7 @@ -27,6 +27,9 @@ Reverse Chronological: - markup modification - (markup blocks) distinguish block from group + - table attributes, place in parenthesis + table([attributes]){ + ``` table([attributes]) * sisu_7.1.12.orig.tar.xz (2019-07-16:28/2) http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/sisu_7.1.12 diff --git a/data/doc/sisu/markup-samples/manual/en/sisu_howto.sst b/data/doc/sisu/markup-samples/manual/en/sisu_howto.sst index f40d5329..8440a64a 100644 --- a/data/doc/sisu/markup-samples/manual/en/sisu_howto.sst +++ b/data/doc/sisu/markup-samples/manual/en/sisu_howto.sst @@ -455,7 +455,7 @@ Table markup sample code{ -table{~h c3; 26; 32; 32; +table(h c3, 26, 32, 32){ This is a table, column1 this would become row one of column two diff --git a/data/doc/sisu/markup-samples/manual/en/sisu_markup.sst b/data/doc/sisu/markup-samples/manual/en/sisu_markup.sst index f67db5a1..73ed21ab 100644 --- a/data/doc/sisu/markup-samples/manual/en/sisu_markup.sst +++ b/data/doc/sisu/markup-samples/manual/en/sisu_markup.sst @@ -839,7 +839,7 @@ Tables may be prepared in two either of two forms code{ -table{ c3; 40; 30; 30; +table(c3: 40, 30, 30){ This is a table this would become column two of row one @@ -855,7 +855,7 @@ column three of row two, and so on !_ resulting output: -table{ c3; 40; 30; 30; +table(c3: 40, 30, 30){ This is a table this would become column two of row one @@ -877,7 +877,7 @@ code{ !_ Table 3.1: Contributors to Wikipedia, January 2001 - June 2005 -{table~h 24; 12; 12; 12; 12; 12; 12;} +{table(h 24, 12, 12, 12, 12, 12, 12)} |Jan. 2001|Jan. 2002|Jan. 2003|Jan. 2004|July 2004|June 2006 Contributors* | 10| 472| 2,188| 9,653| 25,011| 48,721 Active contributors** | 9| 212| 846| 3,228| 8,442| 16,945 @@ -894,7 +894,7 @@ No. of articles, all languages | 25| 19,000| 138,000| 490,000| 862,0 !_ Table 3.1: Contributors to Wikipedia, January 2001 - June 2005 -{table~h 24; 12; 12; 12; 12; 12; 12;} +{table(h 24, 12, 12, 12, 12, 12, 12)} |Jan. 2001|Jan. 2002|Jan. 2003|Jan. 2004|July 2004|June 2006 Contributors* | 10| 472| 2,188| 9,653| 25,011| 48,721 Active contributors** | 9| 212| 846| 3,228| 8,442| 16,945 diff --git a/data/doc/sisu/markup-samples/manual/en/sisu_output_overview.sst b/data/doc/sisu/markup-samples/manual/en/sisu_output_overview.sst index 332f4aae..428bc223 100644 --- a/data/doc/sisu/markup-samples/manual/en/sisu_output_overview.sst +++ b/data/doc/sisu/markup-samples/manual/en/sisu_output_overview.sst @@ -34,7 +34,7 @@ for various forms of output of SiSU. !_ sisu-2.0.0 on 2010-03-06 -{table~h 28} +{table(h 28)} feature |txt|ltx/pdf|HTML|EPUB|XML/s|XML/d|ODF|SQLite|pgSQL headings | * | * | * | * | * | * | * | * | * footnotes | * | * | * | * | * | * | * | * | * @@ -65,7 +65,7 @@ special characters | . | . | . | . | | | | | !_ sisu-1.0.0 on 2009-10-28 -{table~h 28} +{table(h 28)} feature |txt|ltx/pdf|HTML|XML/s|XML/d|ODF|SQLite|pgSQL headings | * | * | * | * | * | * | * | * footnotes | * | * | * | * | * | * | * | * @@ -96,7 +96,7 @@ special characters | . | . | . | | | | | !_ sisu-0.36.6 on 2006-01-23 -{table~h 28; 8; 8; 8; 8; 8; 8; 8; 8; 8;} +{table(h 28, 8, 8, 8, 8, 8, 8, 8, 8, 8)} feature |txt|ltx/pdf|HTML|XHTML|XML/s|XML/d|ODF|SQLite|pgSQL headings | * | * | * | * | * | * | * | * | * footnotes | * | * | * | * | * | * | * | * | * 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 |