aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v0/shared_xml.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v0/shared_xml.rb')
-rw-r--r--lib/sisu/v0/shared_xml.rb23
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&amp; ') #sort
+ para.gsub!(/&([^;]{1,5})/,'&amp;\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!(/&nbsp;/,'&#160;')
+ #para.gsub!(/&nbsp;/,' ') #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!(/</,'&lt;'); para.gsub!(/>/,'&gt;')
para.gsub!(/&lt;:?br(?:\s+\/)?&gt;/,'<br />')