diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sisu/v0/odf.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/sisu/v0/odf.rb b/lib/sisu/v0/odf.rb index 381e23d4..f6d6d942 100644 --- a/lib/sisu/v0/odf.rb +++ b/lib/sisu/v0/odf.rb @@ -279,7 +279,7 @@ module SiSU_ODF end def text_link(para) para.gsub!(@serial,'') - m=para.scan(/(\{([^}]+?)\}((?:https?|ftp)\S+?))([;.,]?$)/) #sort + m=para.scan(/(\{([^}]+?)\}((?:https?|ftp)\S+?))([;.,]?(?=\s|$))/) #sort if m m.each do |i| txt,url,trail=i[1],i[2] @@ -297,8 +297,8 @@ module SiSU_ODF para.gsub!(@serial,'') para.gsub!(/\b[_\\]((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/, %{<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>\\2}) #http ftp matches escaped, no decoration - para.gsub!(/((?:^|\s)[}])((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/, - %{\\1<text:a xlink:type="simple" xlink:href="\\2">\\2</text:a>\\3}) #special case \{ e.g. \}http://url + para.gsub!(/((?:^|\s)[}])((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/, + '\1<text:a xlink:type="simple" xlink:href="\2">\2</text:a>\3') #special case \{ e.g. \}http://url para.gsub!(/(^|\s)((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/, %{\\1#{@url_brace.xml_open}<text:a xlink:type="simple" xlink:href="\\2">\\2</text:a>#{@url_brace.xml_close}\\3}) #http ftp matches with decoration #para.gsub!(/\b((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/, also works @@ -346,6 +346,7 @@ module SiSU_ODF def group_clean(para) para.gsub!(/&nbsp;| /,' ') para.gsub!(/</,'<'); para.gsub!(/>/,'>') + para.gsub!(/<(text:span text:style-name="T[1-5]"|\/text:span)>/,'<\1>') #works, not ideal para.gsub!(/<br(?:\s+\/)?>/,'<br />') #para.gsub!(/\s\s/,'  ') para @@ -382,6 +383,7 @@ module SiSU_ODF parray << %{<text:p text:style-name="P5">#{parablock}</text:p>} if parablock =~/\S+/ end para=parray.join + '<text:p text:style-name="Standard"/>' + para end def table(para) # if para =~/<!Th?.+/ # tables come as single block |