From 7ad032412c7006982ee5909d645b67f4e3b04000 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 2 Sep 2019 11:36:58 -0400 Subject: markup modification: code blocks attributes, numberlines --- data/doc/sisu/CHANGELOG_v7 | 1 + data/doc/sisu/markup-samples/manual/en/sisu_markup.sst | 6 ++++-- lib/sisu/ao_doc_str.rb | 14 +++++++------- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v7 b/data/doc/sisu/CHANGELOG_v7 index dce249e0..1815a67a 100644 --- a/data/doc/sisu/CHANGELOG_v7 +++ b/data/doc/sisu/CHANGELOG_v7 @@ -30,6 +30,7 @@ Reverse Chronological: - table attributes, place in parenthesis table([attributes]){ ``` table([attributes]) + - code blocks attributes, numberlines * 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_markup.sst b/data/doc/sisu/markup-samples/manual/en/sisu_markup.sst index 73ed21ab..95b4a146 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 eec2cbad..1aba9bd7 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 -- cgit v1.2.3