From 9700518408f388c9f070894f7986d94d80e4c070 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 3 Dec 2013 00:30:50 -0500 Subject: v5: xml, fictionbook --- data/doc/sisu/CHANGELOG_v5 | 1 + lib/sisu/v5/constants.rb | 1 + lib/sisu/v5/hub.rb | 5 + lib/sisu/v5/manifest.rb | 7 + lib/sisu/v5/options.rb | 6 + lib/sisu/v5/sysenv.rb | 99 +++++++++++ lib/sisu/v5/urls.rb | 8 + lib/sisu/v5/xml_fictionbook2.rb | 366 ++++++++++++++++++++++++++++++++++++++++ lib/sisu/v5/xml_shared.rb | 8 +- 9 files changed, 497 insertions(+), 4 deletions(-) create mode 100644 lib/sisu/v5/xml_fictionbook2.rb diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5 index 742a6e70..7a09c091 100644 --- a/data/doc/sisu/CHANGELOG_v5 +++ b/data/doc/sisu/CHANGELOG_v5 @@ -60,6 +60,7 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.1.0.orig.tar.xz * rst * xml * docbook, book + * fictionbook * sisu.gemspec diff --git a/lib/sisu/v5/constants.rb b/lib/sisu/v5/constants.rb index 1f96f0aa..da9858f2 100644 --- a/lib/sisu/v5/constants.rb +++ b/lib/sisu/v5/constants.rb @@ -79,6 +79,7 @@ Sfx={ xml_docbook: '.docbook.xml', xml_docbook_article: '.article.docbook.xml', xml_docbook_book: '.book.docbook.xml', + xml_fictionbook: '.fb2', epub: '.epub', epub_xhtml: '.xhtml', odt: '.odt', diff --git a/lib/sisu/v5/hub.rb b/lib/sisu/v5/hub.rb index 08147d96..f09bd832 100644 --- a/lib/sisu/v5/hub.rb +++ b/lib/sisu/v5/hub.rb @@ -359,6 +359,10 @@ module SiSU require_relative 'xml_docbook5' # xml_docbook5.rb SiSU_XML_Docbook_Book::Source.new(@opt).read end + if @opt.act[:xml_fictionbook][:set]==:on #% --xml-fictionbook + require_relative 'xml_fictionbook2' # xml_fictionbook2.rb + SiSU_XML_Fictionbook::Source.new(@opt).read + end if @opt.act[:xml_sax][:set]==:on #% --xml-sax, -x xml sax type require_relative 'xml_sax' # xml_sax.rb SiSU_XML_SAX::Source.new(@opt).read @@ -673,6 +677,7 @@ module SiSU || @opt.act[:xml_scaffold_structure_sisu][:set]==:on \ || @opt.act[:xml_scaffold_structure_collapse][:set]==:on \ || @opt.act[:xml_docbook_book][:set]==:on \ + || @opt.act[:xml_fictionbook][:set]==:on \ || @opt.act[:pdf][:set]==:on \ || @opt.act[:pdf_p][:set]==:on \ || @opt.act[:pdf_l][:set]==:on \ diff --git a/lib/sisu/v5/manifest.rb b/lib/sisu/v5/manifest.rb index 42755151..fb3064e7 100644 --- a/lib/sisu/v5/manifest.rb +++ b/lib/sisu/v5/manifest.rb @@ -410,6 +410,13 @@ module SiSU_Manifest id,file='XML Docbook Book',@f.base_filename.xml_docbook_book summarize(id,file,pth,rel,url) end + if FileTest.file?(@f.place_file.xml_fictionbook.dir)==true + pth=@f.output_path.xml_fictionbook.dir + rel=@f.output_path.xml_fictionbook.rel_sm + url=@f.output_path.xml_fictionbook.url + id,file='XML Fictionbook',@f.base_filename.xml_fictionbook + summarize(id,file,pth,rel,url) + end if FileTest.file?(@f.place_file.xml_scaffold_structure_sisu.dir)==true pth=@f.output_path.xml_scaffold_structure_sisu.dir rel=@f.output_path.xml_scaffold_structure_sisu.rel_sm diff --git a/lib/sisu/v5/options.rb b/lib/sisu/v5/options.rb index 1e11b711..f410e61f 100644 --- a/lib/sisu/v5/options.rb +++ b/lib/sisu/v5/options.rb @@ -864,6 +864,10 @@ module SiSU_Commandline act[:xml_docbook_book]=mod.inspect =~/"--docbook"|"--docbook-book"|"--xml-docbook"|"--xml-docbook_book"/ \ ? { bool: true, set: :on } : { bool: false, set: :na } + act[:xml_fictionbook]=(cmd =~/f/ \ + || mod.inspect =~/"--fictionbook"|"--xml-fictionbook"/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:xml_scaffold_structure_sisu]=mod.inspect =~/"--xml-scaffold"|"--xml-scaffold-sisu"/ \ ? { bool: true, set: :on } : { bool: false, set: :na } @@ -1002,6 +1006,7 @@ module SiSU_Commandline || act[:xml_dom][:set]==:on \ || act[:xml_sax][:set]==:on \ || act[:xml_docbook_book][:set]==:on \ + || act[:xml_fictionbook][:set]==:on \ || act[:xml_scaffold_structure_sisu][:set]==:on \ || act[:xml_scaffold_structure_collapse][:set]==:on ) { bool: true, set: :on } @@ -1051,6 +1056,7 @@ module SiSU_Commandline || act[:xml_dom][:set]==:on \ || act[:xml_sax][:set]==:on \ || act[:xml_docbook_book][:set]==:on \ + || act[:xml_fictionbook][:set]==:on \ || act[:xml_scaffold_structure_sisu][:set]==:on \ || act[:xml_scaffold_structure_collapse][:set]==:on ) { bool: true, set: :on } diff --git a/lib/sisu/v5/sysenv.rb b/lib/sisu/v5/sysenv.rb index f25cd027..1f5d7d3a 100644 --- a/lib/sisu/v5/sysenv.rb +++ b/lib/sisu/v5/sysenv.rb @@ -1484,6 +1484,12 @@ module SiSU_Env ? @rc['xml_docbook']['ocn'] : true end + def xml_fictionbook_ocn? + ((defined? @rc['xml_fictionbook']['ocn']) \ + && @rc['xml_fictionbook']['ocn']==false) \ + ? @rc['xml_fictionbook']['ocn'] + : true + end def xml_scaffold_ocn? ((defined? @rc['xml_scaffold']['ocn']) \ && @rc['xml_scaffold']['ocn']==false) \ @@ -2772,6 +2778,12 @@ WOK ? @rc['program_select']['xml_viewer'] : text_editor end + def fictionbook_viewer + ((defined? @rc['program_select']['xml_viewer']) \ + && @rc['program_select']['xml_viewer'] =~/\S\S+/) \ + ? @rc['program_select']['xml_viewer'] + : text_editor + end def xml_editor xml_viewer end @@ -3076,6 +3088,9 @@ WOK if @md.opt.act[:xml_docbook_book][:set]==:on #% --xml-docbook-book ft << @md.fn[:xml_docbook_book] end + if @md.opt.act[:xml_fictionbook][:set]==:on #% --xml-fictionbook + ft << @md.fn[:xml_fictionbook] + end if @md.opt.act[:xml_scaffold_structure_sisu][:set]==:on #% --xml-scaffold --xml-scaffold-sisu ft << @md.fn[:xml_scaffold_structure_sisu] end @@ -3141,6 +3156,9 @@ WOK if @opt.act[:xml_docbook_book][:set]==:on #% --xml-docbook-book ft << 'docbook.xml' << '??.docbook.xml' << 'docbook.??.xml' end + if @opt.act[:xml_fictionbook][:set]==:on #% --xml-fictionbook + ft << 'fictionbook.xml' << '??.fictionbook.xml' << 'fictionbook.??.xml' + end if @opt.act[:xml_scaffold_structure_sisu][:set]==:on #% --xml-scaffold --xml-scaffold-sisu ft << 'scaffold.xml' << '??.scaffold.xml' << 'scaffold.??.xml' end @@ -4511,6 +4529,12 @@ WOK fn=base_filename.xml_docbook_book make_file(path,fn) end + def xml_fictionbook + path=output_path.xml_fictionbook.dir + make_path(path) + fn=base_filename.xml_fictionbook + make_file(path,fn) + end def xml_scaffold_structure_sisu path=output_path.xml_scaffold_structure_sisu.dir make_path(path) @@ -4730,6 +4754,15 @@ WOK end self end + def xml_fictionbook + def dir + output_path.xml_fictionbook.dir + '/' + base_filename.xml_fictionbook + end + def rel + output_path.xml_fictionbook.rel + '/' + base_filename.xml_fictionbook + end + self + end def xml_scaffold_structure_sisu def dir output_path.xml.dir + '/' + base_filename.xml_scaffold_structure_sisu @@ -5183,6 +5216,24 @@ WOK end i18n(fnh) end + def xml_fictionbook(fh=nil) + fh=default_hash_build(fh,Sfx[:xml_fictionbook]) + fh[:lng]=lang_code?(fh[:lng]) + fnh=if output_dir_structure.by_filename? + { + fn: 'scroll', + ft: fh[:ft], + lng: fh[:lng], + } + else + { + fn: fh[:fn], + ft: fh[:ft], + lng: fh[:lng], + } + end + i18n(fnh) + end def xml_scaffold_structure_sisu(fh=nil) fh=default_hash_build(fh,Sfx[:xml_scaffold_structure_sisu]) fh[:lng]=lang_code?(fh[:lng]) @@ -6098,6 +6149,30 @@ WOK end self end + def xml_docbook_article + def ft + 'docbook' + end + def dir + set_path(ft).dir.abc + end + def url + set_path(ft).url.abc + end + def rel + set_path(ft).rel.abc + end + def rcp + set_path(ft).rcp.abc + end + def rel_sm + set_path(ft).rel_sm.ab + end + def rel_image + '../../_sisu/image' + end + self + end def xml_docbook_book def ft 'docbook_CONSTRUCTION_ZONE' @@ -6122,6 +6197,30 @@ WOK end self end + def xml_fictionbook + def ft + 'fictionbook_CONSTRUCTION_ZONE' + end + def dir + set_path(ft).dir.abc + end + def url + set_path(ft).url.abc + end + def rel + set_path(ft).rel.abc + end + def rcp + set_path(ft).rcp.abc + end + def rel_sm + set_path(ft).rel_sm.ab + end + def rel_image + '../../_sisu/image' + end + self + end def xml_scaffold_structure_sisu def ft 'sisu.scaffold.xml' diff --git a/lib/sisu/v5/urls.rb b/lib/sisu/v5/urls.rb index bdd66a59..ce3be66b 100644 --- a/lib/sisu/v5/urls.rb +++ b/lib/sisu/v5/urls.rb @@ -119,6 +119,7 @@ module SiSU_Urls ' --markdown (markdown txt)'=>@fn[:txt_markdown], ' --rst (rST restructured-text)'=>@fn[:txt_rst], ' --docbook-book (DocBook Book)'=>@fn[:xml_docbook_book], + ' --fictionbook (Fictionbook)'=>@fn[:xml_fictionbook], 'x --xml-sax (XML sax type)'=>@fn[:sax], 'X --xml-dom (XML dom type)'=>@fn[:dom], ' --xml-scaffold-sisu (XML scaffold)'=>@fn[:xml_scaffold_structure_sisu], @@ -231,6 +232,9 @@ module SiSU_Urls def docbook_book(x) SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.xml_docbook_book.dir}/#{@md.file.base_filename.xml_docbook_book}").result end + def fictionbook(x) + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.xml_fictionbook.dir}/#{@md.file.base_filename.xml_fictionbook}").result + end def scaffold_structure_sisu(x) SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.xml_scaffold_structure_sisu.dir}/#{@md.file.base_filename.xml_scaffold_structure_sisu}").result end @@ -446,6 +450,10 @@ module SiSU_Urls and @opt.act[:xml_docbook_book][:set]==:on show.xml.docbook_book(x) end + if x=~/--fictionbook\b/ \ + and @opt.act[:xml_fictionbook][:set]==:on + show.xml.fictionbook(x) + end if x=~/--xml-scaffold-sisu\b/ \ and @opt.act[:xml_scaffold_structure_sisu][:set]==:on show.xml.scaffold_structure_sisu(x) diff --git a/lib/sisu/v5/xml_fictionbook2.rb b/lib/sisu/v5/xml_fictionbook2.rb new file mode 100644 index 00000000..8ee2fb89 --- /dev/null +++ b/lib/sisu/v5/xml_fictionbook2.rb @@ -0,0 +1,366 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008, 2009, 2010, 2011, 2012, 2013 Ralph Amissah, All Rights Reserved. + + * License: GPL 3 or later: + + SiSU, a framework for document structuring, publishing and search + + Copyright (C) Ralph Amissah + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program. If not, see . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Git + + + + * Ralph Amissah + + + + ** Description: Fictionbook XML rendition + +=end +module SiSU_XML_Fictionbook + require_relative 'particulars' # particulars.rb + include SiSU_Particulars + require_relative 'ao' # ao.rb + require_relative 'sysenv' # sysenv.rb + include SiSU_Env + require_relative 'txt_shared' # txt_shared.rb + include SiSU_TextUtils + require_relative 'xml_shared' # xml_shared.rb + include SiSU_XML_Munge + class Source + def initialize(opt) + @opt=opt + @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt) + end + def read + begin + @md,@ao_array=@particulars.md,@particulars.ao_array + @env=@particulars.env + report + SiSU_XML_Fictionbook::Source::Scroll.new(@ao_array,@md).songsheet + rescue + SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do + __LINE__.to_s + ':' + __FILE__ + end + ensure + end + end + private + def report + unless @opt.act[:quiet][:set]==:on + tool=(@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) \ + ? "#{@env.program.fictionbook_viewer} #{@md.file.output_path.xml_fictionbook.dir}/#{@md.file.base_filename.xml_fictionbook}" + : "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}" + (@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) \ + ? SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Fictionbook',tool).green_hi_blue + : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Fictionbook',tool).green_title_hi + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{@md.file.output_path.xml_fictionbook.dir}/#{@md.file.base_filename.xml_fictionbook}").flow + end + end + end + class Scroll + def collapsed + %w[ 0 1 2 3 4 5 6 ] + end + def fictionbook + [ 'section', + 'section', + 'section', + 'section', + 'section', + 'section', + 'section' + ] + end + self + end + def put(line) + puts line if @md.opt.act[:verbose_plus][:set]==:on + end + def head + version=SiSU_Env::InfoVersion.instance.get_version + rb_ver=SiSU_Env::InfoVersion.instance.rbversion + date_available=if defined? @md.date.available; "\n

#{@md.date.available} Initial version

" + else '' + end + date_modified=if defined? @md.date.modified; "\n

#{@md.date.modified} Last Modified

" + else '' + end + coverpageimage=if defined? @md.make.cover_image[:cover] + %{\n } + else '' + end + if defined? @md.authors \ + and @md.authors.length > 0 + authors=[] + @md.authors.each do |author| + authors << ' ' + if not author[:others].empty? + authors << %{ #{author[:others]}} + end + if not author[:the].empty? + authors << %{ #{author[:the]}} + end + authors << ' ' + end + authors=authors.join("\n") + end + <<-WOK + + + + + *** +#{authors} + #{@md.title.full}#{coverpageimage} + + + #{@md.date.published} + + + + + + + + #{version[:project]} #{version[:version]} and #{rb_ver} + #{version[:date]} + #{@md.file.output_path.manifest.url}/#{@md.file.base_filename.manifest} + + 1.0 + #{date_available}#{date_modified} + + + + + WOK + end + def extract_endnotes #work on + endnotes,endnotes_raw,endnotes_b=[],[],[] + @data.each do |para| + endnotes_raw << para.obj.scan(/#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/m) + endnotes_b << para.obj.scan(/#{Mx[:en_b_o]}(.+?)#{Mx[:en_b_c]}/m) + end + endnotes_raw.flatten.each do |en| + en=@trans.markup_fictionbook(en) + endnotes << en.gsub(/([\d+*]+)\s+(.+)/m, + %{
\n +<p>\\1.</p>\n +

\\2

\n +
}) + end + endnotes_raw=[] + endnotes + end + def extract_images #work on + require "base64" + images_raw,images_base64_fb2=[],[] + images_base64={} + if defined? @md.make.cover_image[:cover] + images_raw << @md.make.cover_image[:cover] + end + @data.each do |para| + images_raw << para.obj.scan(/#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg|gif)).+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/m) + end + images_raw.flatten.sort.each do |img| + imgpth=@env.url.images_local + '/' + img + open(imgpth) + if FileTest.file?(imgpth) + images_base64[img]=Base64.encode64(File.read(imgpth)) + end + end + images_raw=[] + images_base64.each_key do |k| + imgtype=case k + when /\.jpg/ then 'jpeg' + when /\.png/ then 'png' + when /\.gif/ then 'gif' + else 'jpeg' + end + images_base64_fb2 << %{#{images_base64[k]} + +} + end + images_base64_fb2.join("\n") + end + def markup_text(data) + data.each_with_index do |o,i| + if o.is ==:heading || o.is ==:para + o.obj=@trans.markup_fictionbook(o.obj,o.is) #unless o.obj==nil + end + end + data + end + def tail(images_base64_fb2) + <<-WOK + +#{images_base64_fb2} +
+ WOK + end + def output(o,lev=nil,comment='') + puts lev == 0..6 \ + ? "#{space*lev}<#{lev}>[#{o.ocn}] #{o.ln} #{o.obj}#{comment}" + : "<#{lev}>[#{o.ocn}] #{o.ln} #{o.obj}#{comment}" + end + def structure_collapsed(data) + puts "\ncollapsed structure, heading outline --->\n\n" + data.each_with_index do |o,i| + if (o.is ==:heading || o.is ==:heading_insert) + output(o,o.lc) + end + end + end + def endnotes_build(endnotes,filename_fictionbook) + if endnotes.length > 0 + filename_fictionbook.puts %{} + endnotes.each do |en| + filename_fictionbook.puts SiSU_TextUtils::Wrap.new(en,80,6).line_wrap + end + end + end + def structure_build_collapsed(data,endnotes,images_base64) + file=SiSU_Env::FileOp.new(@md) + filename_fictionbook=file.write_file.xml_fictionbook + h=0 + doc_position=:head + filename_fictionbook.puts head + data.each_with_index do |o,i| + ocn=(defined? o.ocn and not o.ocn.nil?) ? "\n#{Dx[:ocn_o]}#{o.ocn}#{Dx[:ocn_c]}" : '' + if o.is ==:heading + lev=o.lc + chlv=(o.lv.to_i == 1) \ + ? @chlv=o.lc.to_i + : 0 + unless doc_position==:head + filename_fictionbook.puts structure_build_tag_close(lev,h) + end + doc_position=:body_and_tail + filename_fictionbook.puts %{#{space*lev}<#{tags.fictionbook[lev]}> +#{space*lev} +} + filename_fictionbook.puts SiSU_TextUtils::Wrap.new("<p>#{o.obj}#{ocn}</p>",80,(lev*2+2)).line_wrap + filename_fictionbook.puts %{#{space*lev}} + h=lev + elsif o.is ==:heading_insert \ + and o.obj =~/Endnotes/ \ + and o.ln == 2 + break + elsif (o.of ==:para or o.of ==:block) + filename_fictionbook.puts SiSU_TextUtils::Wrap.new("

#{o.obj}#{ocn}

",80,6).line_wrap + end + end + filename_fictionbook.puts structure_build_tag_close(0,h) + endnotes_build(endnotes,filename_fictionbook) + filename_fictionbook.puts tail(images_base64) + filename_fictionbook.close + end + def structure_build_tag_close(lev,h) + x=[] + case h + when 1 + x << "#{space*1}" if (lev <= 1) + when 2 + x << "#{space*2}" if (lev <= 2) + x << "#{space*1}" if (lev <= 1) + when 3 + x << "#{space*3}" if (lev <= 3) + x << "#{space*2}" if (lev <= 2) + x << "#{space*1}" if (lev <= 1) + when 4 + x << "#{space*4}" if (lev <= 4) + x << "#{space*3}" if (lev <= 3) + x << "#{space*2}" if (lev <= 2) + x << "#{space*1}" if (lev <= 1) + when 5 + x << "#{space*5}" if (lev <= 5) + x << "#{space*4}" if (lev <= 4) + x << "#{space*3}" if (lev <= 3) + x << "#{space*2}" if (lev <= 2) + x << "#{space*1}" if (lev <= 1) + when 6 + x << "#{space*6}" if (lev <= 6) + x << "#{space*5}" if (lev <= 5) + x << "#{space*4}" if (lev <= 4) + x << "#{space*3}" if (lev <= 3) + x << "#{space*2}" if (lev <= 2) + x << "#{space*1}" if (lev <= 1) + end + x.join("\n") + end + end + end +end +__END__ diff --git a/lib/sisu/v5/xml_shared.rb b/lib/sisu/v5/xml_shared.rb index 688e34c3..a6092559 100644 --- a/lib/sisu/v5/xml_shared.rb +++ b/lib/sisu/v5/xml_shared.rb @@ -435,7 +435,7 @@ module SiSU_XML_Munge gsub(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;') end def markup_fictionbook(str='',is='') - str=str.gsub(/#{Mx[:en_a_o]}([\d+*]+).+?#{Mx[:en_a_c]}/m,'[\1]'). + str=str.gsub(/#{Mx[:en_a_o]}([\d+*]+).+?#{Mx[:en_a_c]}/m,'[\1]'). gsub(/&/,'&'). #sort gsub(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;'). gsub(/(^|#{Mx[:gl_c]}|\s)&\s+/,'\1& '). #sort @@ -450,11 +450,11 @@ module SiSU_XML_Munge gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'\1'). gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'\1'). gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'\1'). # tt, kbd - gsub(/#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg|gif)).+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/m,''). + gsub(/#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg|gif)).+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/m,''). gsub(/#{Mx[:url_o]}(.+?)#{Mx[:url_c]}/,"#{Dx[:url_o]}\\1#{Dx[:url_c]}"). gsub(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,''). - gsub(/#{Mx[:gl_bullet]}/m,'●  '). - gsub(/#{Mx[:nbsp]}/,' '). + gsub(/#{Mx[:gl_bullet]}/m,'● '). #  not available + gsub(/#{Mx[:nbsp]}/,' '). #  not available gsub(/<(p|br)>/,'<\1 />') clean(str) end -- cgit v1.2.3