summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2019-09-02 15:36:58 +0000
committerRalph Amissah <ralph@amissah.com>2019-09-03 16:28:38 +0000
commit143481f23597de24503ea66142cfb8341553d1be (patch)
tree94eba9fec7cb035d038abf69b83ca440f27bb9eb
parentre-introduce depreciated table markup for table attributes (diff)
downloadsisu-143481f23597de24503ea66142cfb8341553d1be.zip
sisu-143481f23597de24503ea66142cfb8341553d1be.tar.xz
markup modification: code blocks attributes, numberlines
-rw-r--r--data/doc/sisu/markup-samples/manual/en/sisu_markup.sst6
-rw-r--r--lib/sisu/ao_doc_str.rb14
2 files changed, 11 insertions, 9 deletions
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 73ed21a..95b4a14 100644
--- a/data/doc/sisu/markup-samples/manual/en/sisu_markup.sst
+++ b/data/doc/sisu/markup-samples/manual/en/sisu_markup.sst
@@ -1225,9 +1225,11 @@ code{
}code
-From SiSU 2.7.7 on you can number codeblocks by placing a hash after the opening code tag #{ code{# }# as demonstrated here:
+From SiSU 2.7.7 on you can number codeblocks by placing a hash after the opening code tag #{ code{# }# this is depreciated from sisu 7.2.0 with the introduction of the parenthesis before curly braces for attributes.
-code{#
+From SiSU 7.2.0 on you can number codeblocks by writing the "numberline" attribute within parenthesis before the opening code tag #{ code(numberlines){ }# as demonstrated here:
+
+code(numberlines){
`Fury said to a
mouse, That he
diff --git a/lib/sisu/ao_doc_str.rb b/lib/sisu/ao_doc_str.rb
index eec2cba..1aba9bd 100644
--- a/lib/sisu/ao_doc_str.rb
+++ b/lib/sisu/ao_doc_str.rb
@@ -296,8 +296,8 @@ 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\()|^(?: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)`/ \
+ if t_o !~/^(?:code(?:\.[a-z][0-9a-z_]+)?(?:\(.+?\))?|box(?:\.[a-z_]+)?|poem|alt|group|block)\{|^\}(?:code|poem|alt|group|block)|^(?:table\(.+?\)\{|\{table\()|^(?: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 \
and @per.group==:off \
@@ -497,15 +497,15 @@ module SiSU_AO_DocumentStructureExtract
t_o=SiSU_AO_DocumentStructureExtract::Structure.new(@md).structure_markup(t_o) #must happen earlier, node info etc. require
end
elsif @per.code==:off
- if t_o =~/^(?:code(?:\.[a-z][0-9a-z_]+)?\{|```[ ]+code(?:\.[a-z][0-9a-z_]+)?)/
+ if t_o =~/^(?:code(?:\.[a-z][0-9a-z_]+)?(?:\(.+?\))?\{|```[ ]+code(?:\.[a-z][0-9a-z_]+)?(?:\(.+?\))?)/
@per.code=case t_o
- when /^code(?:\.[a-z][0-9a-z_]+)?\{/ then :curls
+ when /^code(?:\.[a-z][0-9a-z_]+)?(?:\(.+?\))?\{/ then :curls
when /^```[ ]+code/ then :tics
else @per.code #error
end
- @per.lngsyn=if t_o =~/^(?:code\.[a-z][0-9a-z_]+\{|```[ ]+code\.[a-z_]+)/
+ @per.lngsyn=if t_o =~/^(?:code\.[a-z][0-9a-z_]+(?:\(.+?\))?\{|```[ ]+code\.[a-z_]+)/
case t_o
- when /^code\.([a-z][0-9a-z_]+)\{/
+ when /^code\.([a-z][0-9a-z_]+)(?:\(.+?\))?\{/
:"#{$1}"
when /^```[ ]+code\.([a-z][0-9a-z_]+)/
:"#{$1}"
@@ -515,7 +515,7 @@ module SiSU_AO_DocumentStructureExtract
end
@@counter=1
@codeblock_numbered=
- (t_o =~/^(?:code(?:\.[a-z][0-9a-z_]+)?\{#|```[ ]+code(?:\.[a-z][0-9a-z_]+)?\s[#])/) \
+ (t_o =~/^(?:code(?:\.[a-z][0-9a-z_]+)?\(.*number(?:lines)?.*?\)\{|```[ ]+code(?:\.[a-z][0-9a-z_]+)?\(.*number(?:lines)?.*?\))/) \
? true
: false
@num_id[:code_block] +=1