diff options
author | Ralph Amissah <ralph@amissah.com> | 2007-09-04 14:57:41 +0100 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2007-09-04 14:57:41 +0100 |
commit | f7a6194ca54ce58a1f8162627513442da3e84bea (patch) | |
tree | b5ba64663e538d2703d1ca5ed70811b02048c180 /lib/sisu/v0/dal_syntax.rb | |
parent | sisu-0.58.0 + md5s (diff) |
code-block exceptions
Diffstat (limited to 'lib/sisu/v0/dal_syntax.rb')
-rw-r--r-- | lib/sisu/v0/dal_syntax.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/sisu/v0/dal_syntax.rb b/lib/sisu/v0/dal_syntax.rb index 292f7343..14bed691 100644 --- a/lib/sisu/v0/dal_syntax.rb +++ b/lib/sisu/v0/dal_syntax.rb @@ -191,7 +191,7 @@ module Syntax # # #numbered (list) level 1 # _# #numbered (list) level 2 line=line.dup - unless line =~/^0~|<:codeline>|<:code-end>/ + if line !~/^0~|<:codeline>|<:code-end>/ #special characters: ~ { } < > - _ / also used : ^ ! # line_array=[] line.gsub!(/^%{1,4} .+/mi,'') #remove comments @@ -285,10 +285,13 @@ module Syntax if line =~/(<:(?:verse|group)>)/; line.gsub!(/(<:(?:verse|group)>)/i,"\\1\n") #cosmetic else line.gsub!(/(<br \/>)/i,"\\1\n") end - else #code blocks - line.gsub!(/(^|\s)(https?:\/\/\S+)/,'\1_\2') #line.gsub!(/(^|\s)(http:\/\/\S+)/,"\\1\\\\\\2") #escape urls - line.gsub!(/(^|\s)<(https?:\/\/\S+)>([\s,.]|$)/,'\1\2\3') #clean/unescape urls with decoration, re-apply decoration later + elsif line =~/^<:code(?:-end)?>|<:codeline>/ # /^<:code>/ #should be enough # underscore used as escape for angle brackets + line.gsub!(/([<>])/,'_\1') + line.gsub!(/_<:(\S+?)_>/,'<:\1>') #convert <:\S+> back, clumsy + line.gsub!(/_<(br(?: \/)?)_>/,'<\1>') #convert <br> <br /> back, clumsy + line.gsub!(/(^|\s)<(br(?: \/)?)>([\s,.]|$)/,'\1<\2>\3') #convert <br> <br /> back, clumsy line.gsub!(/<:codeline>/,"\n ") #temporary fix, prefer: #line.gsub!(/<:codeline>/,"\n") + else # 0~ end line end |