aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v2/dal_syntax.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2010-10-14 14:51:14 -0400
committerRalph Amissah <ralph@amissah.com>2010-10-14 14:54:22 -0400
commit9a32a0743767b16456fee98354f269ba6a29efdf (patch)
tree6e83ba9d708c627d4e4c5844b47cd052fddfe9c3 /lib/sisu/v2/dal_syntax.rb
parentdocumentation related minor updates and fixes (diff)
codeblocks, numbered markup option, fix
(requested fix needed by debian-live:live-manual, Ben Armstrong & Mark Schneider) * numbered codeblocks, , where codeblock opens with code{# * dal changes as required, flag markup request and number * constants, provide vertical line symbol, use to separate numbered codeblock from code * texpdf substitute \vline for numbered codeblock line separator
Diffstat (limited to 'lib/sisu/v2/dal_syntax.rb')
-rw-r--r--lib/sisu/v2/dal_syntax.rb23
1 files changed, 20 insertions, 3 deletions
diff --git a/lib/sisu/v2/dal_syntax.rb b/lib/sisu/v2/dal_syntax.rb
index 2f78fbe6..fbc62158 100644
--- a/lib/sisu/v2/dal_syntax.rb
+++ b/lib/sisu/v2/dal_syntax.rb
@@ -427,14 +427,31 @@ module SiSU_Syntax
"#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2") #linked image
elsif dob.is=='table'
dob=fontface(dob)
- elsif dob.is =='code' # /^<:code>/ #should be enough # underscore used as escape for angle brackets
+ elsif dob.is =='code'
+#p dob.obj
dob.obj.gsub!(/#{Mx[:meta_o]}(\S+?)#{Mx[:meta_c]}\s*/,'@\1: ')
dob.obj.gsub!(/([<>])/,'_\1')
dob.obj.gsub!(/_<:(\S+?)_>/,'<:\1>') #convert <:\S+> back, clumsy
dob.obj.gsub!(/_<(br(?: \/)?)_>/,'<\1>') #convert <br> <br /> back, clumsy
dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s)&lt;(br(?: \/)?)&gt;([\s,.]|$)/,'\1<\2>\3') #convert <br> <br /> back, clumsy
- dob.obj.gsub!(/#{Mx[:gr_o]}codeline#{Mx[:gr_c]}/,
- "\n#{Mx[:nbsp]}#{Mx[:nbsp]}") #temporary fix, prefer: #line.gsub!(/<:codeline>/,"\n")
+ if dob.number_
+ codeline=[]
+ ln=1
+ dob.obj.split(/#{Mx[:gr_o]}codeline#{Mx[:gr_c]}|<br(?: \/)?>|\n/).each_with_index do |cl,i|
+ unless i == 0
+ cl.gsub!(Mx[:br_nl],'')
+ w=3-ln.to_s.length
+ cl = "#{ln}#{Mx[:nbsp]*w}#{Mx[:vline]}#{Mx[:nbsp]}#{Mx[:nbsp]}#{cl}#{Mx[:br_nl]}"
+ ln +=1
+ end
+ codeline << cl
+ end
+ codeline= codeline.join("")
+ dob.obj=codeline
+ else
+ dob.obj.gsub!(/#{Mx[:gr_o]}codeline#{Mx[:gr_c]}/,
+ "\n#{Mx[:nbsp]}#{Mx[:nbsp]}") #temporary fix, prefer: #line.gsub!(/<:codeline>/,"\n")
+ end
dob
else # @\S+?:
end