diff options
Diffstat (limited to 'lib/sisu/v0/shared_xml.rb')
-rw-r--r-- | lib/sisu/v0/shared_xml.rb | 23 |
1 files changed, 23 insertions, 0 deletions
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!(/\/\{(.+?)\}\//,'<i>\1</i>') + para.gsub!(/[*!]\{(.+?)\}[*!]/,'<b>\1</b>') + para.gsub!(/_\{(.+?)\}_/,'<u>\1</u>') + para.gsub!(/-\{(.+?)\}-/,'<del>\1</del>') + para.gsub!(/<br(\s*\/)?>/,'<br />') + 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)/, + "<image.path>#{@dir.url.images_local}\/\\1</image.path>") + 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!(/>/,'>') para.gsub!(/<:?br(?:\s+\/)?>/,'<br />') |