diff options
| -rw-r--r-- | CHANGELOG | 13 | ||||
| -rw-r--r-- | lib/sisu/v0/dal_syntax.rb | 11 | ||||
| -rw-r--r-- | lib/sisu/v0/html_tune.rb | 1 | ||||
| -rw-r--r-- | lib/sisu/v0/odf.rb | 1 | ||||
| -rw-r--r-- | lib/sisu/v0/shared_html_lite.rb | 3 | ||||
| -rw-r--r-- | lib/sisu/v0/shared_xml.rb | 41 | ||||
| -rw-r--r-- | lib/sisu/v0/texpdf.rb | 4 | ||||
| -rw-r--r-- | lib/sisu/v0/texpdf_format.rb | 7 | 
8 files changed, 55 insertions, 26 deletions
| @@ -3,6 +3,19 @@ Reverse Chronological:  %% STABLE MANIFEST +%% sisu_0.58.1.orig.tar.gz (2007-09-04:36/2) +http://www.jus.uio.no/sisu/pkg/src/sisu_0.58.1.orig.tar.gz +  sisu_0.58.1.orig.tar.gz +  sisu_0.58.1-1.dsc +  sisu_0.58.1-1.diff.gz + +  * code-block exceptions +    * dal, code block, url matching, should no longer be tagged with decoration +      escape mark +    * texpdf, code-blocks latex markup change to scriptsize from tiny, consider +      going back to footnotesize +    * angle bracket exceptions [still issues] +  %% sisu_0.58.0.orig.tar.gz (2007-09-03:36/1)  http://www.jus.uio.no/sisu/pkg/src/sisu_0.58.0.orig.tar.gz    dffd47831df42ca96e77940936d04c8b 1276544 sisu_0.58.0.orig.tar.gz 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 diff --git a/lib/sisu/v0/html_tune.rb b/lib/sisu/v0/html_tune.rb index 7c829831..639ecd26 100644 --- a/lib/sisu/v0/html_tune.rb +++ b/lib/sisu/v0/html_tune.rb @@ -334,6 +334,7 @@ module SiSU_Tune              end              para.gsub!(/<a href="\.\.\//,%{<a href="#{@vz.url_site}/})            end +        else para.gsub!(/_</m,'<'); para.gsub!(/_>/m,'>') #code-block: angle brackets special characters          end          @tuned_file << para        end diff --git a/lib/sisu/v0/odf.rb b/lib/sisu/v0/odf.rb index 16cea2f4..93a5be52 100644 --- a/lib/sisu/v0/odf.rb +++ b/lib/sisu/v0/odf.rb @@ -469,6 +469,7 @@ module SiSU_ODF              para=para_array.join(' ')              para=para.strip            end +          para.gsub!(/_</m,'<'); para.gsub!(/_>/m,'>') #code-block: angle brackets special characters            para.gsub!(/^(<:i[1-9]>\s+)?_\*\s+/,'\1<draw:frame draw:style-name="gr1" text:anchor-type="as-char" svg:width="0.22cm" svg:height="0.22cm" draw:z-index="2"><draw:image xlink:href="Pictures/bullet_09.png" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/></draw:frame> ') # bullet_09.png            #para.gsub!(/^(<:i[1-9]>\s+)?_\*\s+/,'\1<text:span text:style-name="T6">●</text:span> ')     #bullet            #para.gsub!(/^(<:i[1-9]>\s+)?_\*\s+/,'\1● ') # bullet utf8, make smaller if used diff --git a/lib/sisu/v0/shared_html_lite.rb b/lib/sisu/v0/shared_html_lite.rb index 1046b6c4..df6b0bcb 100644 --- a/lib/sisu/v0/shared_html_lite.rb +++ b/lib/sisu/v0/shared_html_lite.rb @@ -125,7 +125,7 @@ module SiSU_Format_Shared        @words      end      def markup(para) -      unless para =~/^<:code>/ +      if para !~/^<:code>/          if para =~/\{.+?\}((?:http|ftp)\S+|image)/            wm=para.scan(/\{.+?\}(?:(?:https?|ftp)\S+|image)|\S+/)            word_mode=urls(wm) @@ -135,6 +135,7 @@ module SiSU_Format_Shared          para.gsub!(/\b[_\\]((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'<a href="\1" target="_top">\1</a>\2') #http ftp matches escaped, no decoration          para.gsub!(/((?:^|\s)[}])((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1<a href="\2" target="_top">\2</a>\3') #special case \{ e.g. \}http://url          para.gsub!(/(^|\s)((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/,%{\\1#{@url_brace.xml_open}<a href="\\2" target="_top">\\2</a>#{@url_brace.xml_close}\\3}) #http ftp matches with decoration +      else para.gsub!(/_</m,'<'); para.gsub!(/_>/m,'>') #code-block: angle brackets special characters        end        para      end diff --git a/lib/sisu/v0/shared_xml.rb b/lib/sisu/v0/shared_xml.rb index 4e77e995..0d9c0476 100644 --- a/lib/sisu/v0/shared_xml.rb +++ b/lib/sisu/v0/shared_xml.rb @@ -345,28 +345,33 @@ module SiSU_XML_munge        end      end      def markup(para='') -      wordlist=para.scan(/\S+|\n/) #\n needed for tables, check though added 2005w17 -      para=tidywords(wordlist).join(' ').strip +      #if para !~/^<:code>/ +        wordlist=para.scan(/\S+|\n/) #\n needed for tables, check though added 2005w17 +        para=tidywords(wordlist).join(' ').strip +      #end        para.gsub!(/(^|\s+)<\s+/,'\1< '); para.gsub!(/\s+>(\s+|$)/,' >\1')        para.gsub!(/<:pb>\s*/,'')        para.gsub!(/<+[-~]#>+/,'')        para.gsub!(/<0;\w\d+;[um]\d+><#@dp:#@dp>/,'') -      #embeds a red-bullet image --> -      #para.gsub!(/^(<:i[1-9]>\s*_\*)\s+/,'\1 <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="/usr/share/sisu/image/bullet_09.png" width="12" height="12" alt="*" /> ') -      #para.gsub!(/^_\*\s+/,'<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="/usr/share/sisu/image/bullet_09.png" width="12" height="12" alt="*" /> ') -      para.gsub!(/(^|\s)\{\s*(\S+?\.(?:jpg|png|gif))\s+(\d+)x(\d+)(\s+[^}]+)?\}(https?:\/\/\S+)/,%{\\1<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@dir.url.images_local}/\\2" width="\\3" height="\\4" />[\\2] \\5}) -      para.gsub!(/(^|\s)\{\s*(\S+?\.(?:jpg|png|gif))(\s+[^}]+)?\}(https?:\/\/\S+)/,%{\\1<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@dir.url.images_local}/\\2"/>\\2}) -      para.gsub!(/(^|\s)\{([^}]+)\}(https?:\/\/[^"><]+?)([,.:;"><]?(?=\s|$))/, -        '\1<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\3">\2</link>\4') #watch, compare html_tune -      #para.gsub!(/\B\{([^}]+)\}(https?:\/\/[^"><]+?)([,.:;"><]?(?:\s|$))/, -      #  '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\2">\1</link>\3') #watch, compare html_tune -      para.gsub!(/(^|\s)((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/, -        %{\\1#{@url_brace.xml_open}<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\\2">\\2</link>#{@url_brace.xml_close}\\3}) -      #para.gsub!(/\b((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/, #also works -        #%{#{@url_brace.xml_open}<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\\1">\\1</link>#{@url_brace.xml_close}\\2}) -      para.gsub!(/\b[_\\]((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\1">\1</link>\2') #escaped urls not linked, deal with later -      #para.gsub!(/(^|\s)[_\\]((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,'\1<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\2">\2</link>\3') #escaped urls not linked, deal with later -      para.gsub!(/ /,' ') #clean +      if para !~/^<:code>/ +        #embeds a red-bullet image --> +        #para.gsub!(/^(<:i[1-9]>\s*_\*)\s+/,'\1 <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="/usr/share/sisu/image/bullet_09.png" width="12" height="12" alt="*" /> ') +        #para.gsub!(/^_\*\s+/,'<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="/usr/share/sisu/image/bullet_09.png" width="12" height="12" alt="*" /> ') +        para.gsub!(/(^|\s)\{\s*(\S+?\.(?:jpg|png|gif))\s+(\d+)x(\d+)(\s+[^}]+)?\}(https?:\/\/\S+)/,%{\\1<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@dir.url.images_local}/\\2" width="\\3" height="\\4" />[\\2] \\5}) +        para.gsub!(/(^|\s)\{\s*(\S+?\.(?:jpg|png|gif))(\s+[^}]+)?\}(https?:\/\/\S+)/,%{\\1<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@dir.url.images_local}/\\2"/>\\2}) +        para.gsub!(/(^|\s)\{([^}]+)\}(https?:\/\/[^"><]+?)([,.:;"><]?(?=\s|$))/, +          '\1<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\3">\2</link>\4') #watch, compare html_tune +        #para.gsub!(/\B\{([^}]+)\}(https?:\/\/[^"><]+?)([,.:;"><]?(?:\s|$))/, +        #  '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\2">\1</link>\3') #watch, compare html_tune +        para.gsub!(/(^|\s)((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/, +          %{\\1#{@url_brace.xml_open}<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\\2">\\2</link>#{@url_brace.xml_close}\\3}) +        #para.gsub!(/\b((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/, #also works +          #%{#{@url_brace.xml_open}<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\\1">\\1</link>#{@url_brace.xml_close}\\2}) +        para.gsub!(/\b[_\\]((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\1">\1</link>\2') #escaped urls not linked, deal with later +        #para.gsub!(/(^|\s)[_\\]((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,'\1<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\2">\2</link>\3') #escaped urls not linked, deal with later +        para.gsub!(/ /,' ') #clean +      else para.gsub!(/_</m,'<'); para.gsub!(/_>/m,'>') #code-block: angle brackets special characters +      end        para      end      def markup_light(para='') diff --git a/lib/sisu/v0/texpdf.rb b/lib/sisu/v0/texpdf.rb index 8bd5b6f2..4faab502 100644 --- a/lib/sisu/v0/texpdf.rb +++ b/lib/sisu/v0/texpdf.rb @@ -432,7 +432,7 @@ WOK              if para =~/<:(code|alt|verse|group)>/                @lineone=case para                when /<:(alt|verse|group)>/; para -              when /<:code>/; "#{@tex.paraskip_small} \\begin{tiny} " + para +              when /<:code>/; "#{@tex.paraskip_small} \\begin{scriptsize} " + para                #when /<:code>/; "#{@tex.paraskip_small} \\begin{footnotesize} " + para                ##when /<:code>/; "#{@tex.paraskip_small} \\begin{texttt} " + para                #when /<:code>/; "#{@tex.paraskip_small} \\begin{small} \\begin{ttfamily} " + para @@ -465,7 +465,7 @@ WOK                #@lineone.gsub!(/(.#{@@tilde}\S*\s*|<:\S+>|<!.*?!>|<!>)/,' ')                insert=[]                if para =~/<:code-end>/ -                insert << y + @lineone << @group_collect << ' \end{tiny}' << " #{@tex.paraskip_normal}" +                insert << y + @lineone << @group_collect << ' \end{scriptsize}' << " #{@tex.paraskip_normal}"                  #insert << y + @lineone << @group_collect << ' \end{footnotesize}' << " #{@tex.paraskip_normal}"                  #insert << y + @lineone << @group_collect << ' \end{texttt}' << " #{@tex.paraskip_normal}"                  #insert << y + @lineone << @group_collect << ' \end{ttfamily} \end{small}' << " #{@tex.paraskip_normal}" diff --git a/lib/sisu/v0/texpdf_format.rb b/lib/sisu/v0/texpdf_format.rb index 0880a9c7..d86c053a 100644 --- a/lib/sisu/v0/texpdf_format.rb +++ b/lib/sisu/v0/texpdf_format.rb @@ -501,7 +501,12 @@ WOK        @string.gsub!(/[^\}>_]((?:https?|ftp):\/\/\S+?)(<\/\S>)/,' \begin{scriptsize}\href{\1}{\1} \end{scriptsize}\2') #special case        @string.gsub!(/((?:^|\s)[}])((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1\begin{scriptsize}\\href{\2}{\2}\end{scriptsize}\3') #special case \{ e.g. \}http://url        @string.gsub!(/\B(?:\\_|\\)((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\begin{scriptsize}\\href{\1}{\1}\end{scriptsize}\2') #specially escaped url no decoration -      @string.gsub!(/(^|\s)((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/,"\\1#{@url_brace.tex_open}\\begin{scriptsize}\\href{\\2}{\\2}\\end{scriptsize}#{@url_brace.tex_close}\\3") #url matching with decoration <url> positive lookahead, sequence issue with { linked }http://url cannot use \b at start +      unless @@flag_code +        @string.gsub!(/(^|\s)((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/,"\\1#{@url_brace.tex_open}\\begin{scriptsize}\\href{\\2}{\\2}\\end{scriptsize}#{@url_brace.tex_close}\\3") #url matching with decoration <url> positive lookahead, sequence issue with { linked }http://url cannot use \b at start +      else #code-block: angle brackets special characters, note _ already escaped +        @string.gsub!(/\\_</,'{\UseTextSymbol{OML}{<}}') +        @string.gsub!(/\\_>/,'{\UseTextSymbol{OML}{>}}') +      end        @string.gsub!(/<:ee>/,'')        @string.gsub!(/<!>/,' ')        #proposed change, insert, but may be redundant | 
