diff options
Diffstat (limited to 'lib/sisu/v0/shared_xml.rb')
-rw-r--r-- | lib/sisu/v0/shared_xml.rb | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/lib/sisu/v0/shared_xml.rb b/lib/sisu/v0/shared_xml.rb index 135f368e..4b9ccb12 100644 --- a/lib/sisu/v0/shared_xml.rb +++ b/lib/sisu/v0/shared_xml.rb @@ -355,22 +355,18 @@ module SiSU_XML_munge para.gsub!(/<0;\w\d+;[um]\d+><#@dp:#@dp>/,'') 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?|file|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?|file|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?|file|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 + para.gsub!(/ /,' ') + #para.gsub!(/ /,' ') #clean + else + para.gsub!(/_</m,'<'); para.gsub!(/_>/m,'>') #code-block: angle brackets special characters + para.gsub!(/ /,' ') end para end @@ -386,7 +382,8 @@ module SiSU_XML_munge para.gsub!(/&([^;]{1,5})/,'&\1') #sort, rough estimate, revisit #WATCH found in node not sax para.gsub!(/\{(\S+?\.(?:png|jpg|gif)) .+?\}(?:(?:https?|file|ftp):\/\/\S+|image)/, "<image.path>#{@dir.url.images_local}\/\\1</image.path>") - para.gsub!(/ /,' ') + para.gsub!(/ /,' ') + #para.gsub!(/ /,' ') #clean wordlist=para.scan(/\S+|\n/) #\n needed for tables, check though added 2005w17 para=tidywords(wordlist).join(' ').strip para @@ -412,15 +409,6 @@ module SiSU_XML_tags #Format if @md.dc_title # DublinCore 1 - title @rdf_title=%{ dc.title="#{seg_name}#{@md.dc_title}"\n} @dc_title=%{ <meta name="dc.title" content="#{seg_name}#{@md.dc_title}" />\n} - #if @md.subtitle - # @rdf_title=%{ dc.title="#{seg_name}#{@md.title} - #{@md.subtitle}"\n} - # @title=%{<meta name="dc.title" } + - # %{content="#{seg_name}#{@md.title} - #{@md.subtitle}" />\n} - #else - # @rdf_title=%{ dc.title="#{seg_name}#{@md.title}"\n} - # @title=%{<meta name="dc.title" } + - # %{content="#{seg_name}#{@md.title}" />\n} - #end end if @md.dc_creator # DublinCore 2 - creator/author (author) @rdf_creator=%{ dc.creator="#{@md.dc_creator}"\n} |