diff options
Diffstat (limited to 'lib/sisu/v0/shared_html_lite.rb')
-rw-r--r-- | lib/sisu/v0/shared_html_lite.rb | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/lib/sisu/v0/shared_html_lite.rb b/lib/sisu/v0/shared_html_lite.rb index 106a56af..a930821e 100644 --- a/lib/sisu/v0/shared_html_lite.rb +++ b/lib/sisu/v0/shared_html_lite.rb @@ -130,15 +130,16 @@ module SiSU_Format_Shared @words=@words.join(' ') end def markup(para) - if para !~/^<:code>/ + if para !~/^#{Mx[:gr_o]}:code#{Mx[:gr_c]}/ if para =~/\{.+?\}((?:https?|file|ftp)\S+|image)/ wm=para.scan(/\{.+?\}(?:(?:https?|file|ftp)\S+|image)|\S+/) words=urls(wm) para.gsub!(/.+/m,words) end + para.gsub!(/#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]}/m,'') para.gsub!(/\b[_\\]((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'<a href="\1" target="_top">\1</a>\2') #http ftp matches escaped, no decoration para.gsub!(/((?:^|\s)[}])((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1<a href="\2" target="_top">\2</a>\3') #special case \{ e.g. \}http://url - para.gsub!(/(^|\s)((?:https?|file|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 + para.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|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,'\1<'); para.gsub!(/(^|[^}])_>/m,'\1>') #code-block: angle brackets special characters para.gsub!(/(^|[^}])_</m,'\1<'); para.gsub!(/(^|[^}])_>/m,'\1>') @@ -175,13 +176,9 @@ GSUB @content=markup(@content) %{#{@tab*1}<p class="norm" id="#@ocn" type="substantive">\n#{@tab*2}#@content\n#{@tab*1}</p>\n} end - def indent1 + def indent(t) @content=markup(@content) - %{#{@tab*1}<p class="indent1" id="#@ocn" type="substantive">\n#{@tab*2}#@content\n#{@tab*1}</p>\n} - end - def indent2 - @content=markup(@content) - %{#{@tab*1}<p class="indent2" id="#@ocn" type="substantive">\n#{@tab*2}#@content\n#{@tab*1}</p>\n} + %{#{@tab*1}<p class="indent#{t}" id="#@ocn" type="substantive">\n#{@tab*2}#@content\n#{@tab*1}</p>\n} end def para_table %{<p class="norm" align="left"><font #{@vz.font_small} #{@vz.font_color} #{@vz.font_face}>} @@ -195,40 +192,40 @@ GSUB m=parablock[/<!f(.+?)!>/,1] @@tablefoot<<m if m parablock.gsub!(/<!f.+?!>/,'') - @@tablehead=1 if parablock =~/<!Th¡/u - parablock.gsub!(/<!Th?¡.+?!~(\d+)>/, + @@tablehead=1 if parablock =~/#{Mx[:gr_o]}Th#{Mx[:tc_p]}/u + parablock.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+?#{Mx[:tc_p]}~(\d+)#{Mx[:gr_c]}/, #%{<table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center"><tr><td valign="top" align="justify"><p class="norm" id="\\1"> </p> </td><td>\n} + %{<table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">}) - if parablock =~/<!TZ!>/ + if parablock =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ tablefoot=[] @@tablefoot.each {|x| tablefoot << %{<p align="center"><font size=2><i>#{x}</i></font></p>\n}} @@tablefoot=[] - parablock.gsub!(/<!TZ!>/, + parablock.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/, %{#{@vz.table_close}\n}) # + #%{#{tablefoot}}) end if @@tablehead == 1 - if parablock =~/¡¡/u - parablock.gsub!(/<!¡¡(\d+?)¡/u, + if parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}/u + parablock.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u, %{\n<tr>} + %{\n<td width="\\1%" valign="top">} + %{#{para_table}<b>}) - parablock.gsub!(/¡¡(\d+?)¡/u, + parablock.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u, %{</b></td><td width="\\1%" valign="top">} + %{#{para_table}<b>}) - parablock.gsub!(/!>/, '</b></td></tr>') - @@tablehead=0 #if parablock =~/!>/ + parablock.gsub!(/#{Mx[:tc_c]}/, '</b></td></tr>') + @@tablehead=0 end parablock else - parablock.gsub!(/<!¡¡(\d+?)¡/u, + parablock.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u, %{\n<tr>} + %{\n<td width="\\1%" valign="top">} + %{#{para_table}}) - parablock.gsub!(/¡¡(\d+?)¡/u, + parablock.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u, %{</td><td width="\\1%" valign="top">} + %{#{para_table}}) - parablock.gsub!(/!>/, '</td></tr>') + parablock.gsub!(/#{Mx[:tc_c]}/, '</td></tr>') parablock end @new_content << parablock |