From db15c23ad882d0a61a7244d381544c653accf659 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 19 Oct 2007 01:01:26 +0100 Subject: first pass at fictionbook output; images posted with document rsync; also ... * first pass at fictionbook output - fictionbook is interesting, (develop over time or drop support) * images in document posted with document rsync * ruby1.9 strip bug re-encountered in debian sid build version, (unless it is my setup) see changelog --- lib/sisu/v0/shared_xml.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'lib/sisu/v0/shared_xml.rb') diff --git a/lib/sisu/v0/shared_xml.rb b/lib/sisu/v0/shared_xml.rb index d2897a1f..5d427782 100644 --- a/lib/sisu/v0/shared_xml.rb +++ b/lib/sisu/v0/shared_xml.rb @@ -389,6 +389,29 @@ module SiSU_XML_munge para=tidywords(wordlist).join(' ').strip para end + def markup_fictionbook(para='') + para.gsub!(/~\{([\d*+]+).+?\}~/,'[\1]') + para.gsub!(/\/\{(.+?)\}\//,'\1') + para.gsub!(/[*!]\{(.+?)\}[*!]/,'\1') + para.gsub!(/_\{(.+?)\}_/,'\1') + para.gsub!(/-\{(.+?)\}-/,'\1') + para.gsub!(//,'
') + para.gsub!(/<:pb>\s*/,'') + para.gsub!(/<[-~]#>/,'') + #temporary --> + para.gsub!(/<:\S+?>/,'') + #<-- temporary + para.gsub!(/<[-~]#>/,'') + para.gsub!(/(^|\s)&\s+/,'\1& ') #sort + 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)/, + "#{@dir.url.images_local}\/\\1") + para.gsub!(/ /,' ') + #para.gsub!(/ /,' ') #clean + wordlist=para.scan(/\S+|\n/) #\n needed for tables, check though added 2005w17 + para=tidywords(wordlist).join(' ').strip + para + end def markup_group(para='') para.gsub!(//,'>') para.gsub!(/<:?br(?:\s+\/)?>/,'
') -- cgit v1.2.3