From 8d66ef709531e3ea04024bb992c60df7ad6d4db7 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 4 Sep 2007 00:29:17 +0100 Subject: sisu-0.58.0 + md5s --- CHANGELOG | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 4034b3df..42bdda05 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -5,9 +5,9 @@ Reverse Chronological: %% 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 - sisu_0.58.0.orig.tar.gz - sisu_0.58.0-1.dsc - sisu_0.58.0-1.diff.gz + dffd47831df42ca96e77940936d04c8b 1276544 sisu_0.58.0.orig.tar.gz + 859e21f81c9ac012db126ecf1b72529f 606 sisu_0.58.0-1.dsc + 66480197b3b04d255a104a94d32628dc 142555 sisu_0.58.0-1.diff.gz * code block, exclude from most markup, should make it possible (eventually) to describe sisu markup using sisu, which was not an initial goal, but useful -- cgit v1.2.3 From f7a6194ca54ce58a1f8162627513442da3e84bea Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 4 Sep 2007 14:57:41 +0100 Subject: code-block exceptions --- CHANGELOG | 13 +++++++++++++ lib/sisu/v0/dal_syntax.rb | 11 +++++++---- lib/sisu/v0/html_tune.rb | 1 + lib/sisu/v0/odf.rb | 1 + lib/sisu/v0/shared_html_lite.rb | 3 ++- lib/sisu/v0/shared_xml.rb | 41 +++++++++++++++++++++++------------------ lib/sisu/v0/texpdf.rb | 4 ++-- lib/sisu/v0/texpdf_format.rb | 7 ++++++- 8 files changed, 55 insertions(+), 26 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 42bdda05..686e9f24 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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!(/(
)/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

back, clumsy + line.gsub!(/(^|\s)<(br(?: \/)?)>([\s,.]|$)/,'\1<\2>\3') #convert

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!(//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,'>') #code-block: angle brackets special characters para.gsub!(/^(<:i[1-9]>\s+)?_\*\s+/,'\1 ') # bullet_09.png #para.gsub!(/^(<:i[1-9]>\s+)?_\*\s+/,'\1 ') #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|$))/,'\1\2') #http ftp matches escaped, no decoration para.gsub!(/((?:^|\s)[}])((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1\2\3') #special case \{ e.g. \}http://url para.gsub!(/(^|\s)((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/,%{\\1#{@url_brace.xml_open}\\2#{@url_brace.xml_close}\\3}) #http ftp matches with decoration + else 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 * ') - #para.gsub!(/^_\*\s+/,'* ') - para.gsub!(/(^|\s)\{\s*(\S+?\.(?:jpg|png|gif))\s+(\d+)x(\d+)(\s+[^}]+)?\}(https?:\/\/\S+)/,%{\\1[\\2] \\5}) - para.gsub!(/(^|\s)\{\s*(\S+?\.(?:jpg|png|gif))(\s+[^}]+)?\}(https?:\/\/\S+)/,%{\\1\\2}) - para.gsub!(/(^|\s)\{([^}]+)\}(https?:\/\/[^"><]+?)([,.:;"><]?(?=\s|$))/, - '\1\2\4') #watch, compare html_tune - #para.gsub!(/\B\{([^}]+)\}(https?:\/\/[^"><]+?)([,.:;"><]?(?:\s|$))/, - # '\1\3') #watch, compare html_tune - para.gsub!(/(^|\s)((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/, - %{\\1#{@url_brace.xml_open}\\2#{@url_brace.xml_close}\\3}) - #para.gsub!(/\b((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/, #also works - #%{#{@url_brace.xml_open}\\1#{@url_brace.xml_close}\\2}) - para.gsub!(/\b[_\\]((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1\2') #escaped urls not linked, deal with later - #para.gsub!(/(^|\s)[_\\]((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,'\1\2\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 * ') + #para.gsub!(/^_\*\s+/,'* ') + para.gsub!(/(^|\s)\{\s*(\S+?\.(?:jpg|png|gif))\s+(\d+)x(\d+)(\s+[^}]+)?\}(https?:\/\/\S+)/,%{\\1[\\2] \\5}) + para.gsub!(/(^|\s)\{\s*(\S+?\.(?:jpg|png|gif))(\s+[^}]+)?\}(https?:\/\/\S+)/,%{\\1\\2}) + para.gsub!(/(^|\s)\{([^}]+)\}(https?:\/\/[^"><]+?)([,.:;"><]?(?=\s|$))/, + '\1\2\4') #watch, compare html_tune + #para.gsub!(/\B\{([^}]+)\}(https?:\/\/[^"><]+?)([,.:;"><]?(?:\s|$))/, + # '\1\3') #watch, compare html_tune + para.gsub!(/(^|\s)((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/, + %{\\1#{@url_brace.xml_open}\\2#{@url_brace.xml_close}\\3}) + #para.gsub!(/\b((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/, #also works + #%{#{@url_brace.xml_open}\\1#{@url_brace.xml_close}\\2}) + para.gsub!(/\b[_\\]((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1\2') #escaped urls not linked, deal with later + #para.gsub!(/(^|\s)[_\\]((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,'\1\2\3') #escaped urls not linked, deal with later + para.gsub!(/ /,' ') #clean + else 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 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 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}{>}}') + end @string.gsub!(/<:ee>/,'') @string.gsub!(//,' ') #proposed change, insert, but may be redundant -- cgit v1.2.3