aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/sisu/v4/hub.rb4
-rw-r--r--lib/sisu/v4/screen_text_color.rb3
-rw-r--r--lib/sisu/v5/air.rb6
-rw-r--r--lib/sisu/v5/ao.rb (renamed from lib/sisu/v5/dal.rb)224
-rw-r--r--lib/sisu/v5/ao_character_check.rb (renamed from lib/sisu/v5/dal_character_check.rb)4
-rw-r--r--lib/sisu/v5/ao_doc_objects.rb (renamed from lib/sisu/v5/dal_doc_objects.rb)4
-rw-r--r--lib/sisu/v5/ao_doc_str.rb (renamed from lib/sisu/v5/dal_doc_str.rb)501
-rw-r--r--lib/sisu/v5/ao_endnotes.rb (renamed from lib/sisu/v5/dal_endnotes.rb)6
-rw-r--r--lib/sisu/v5/ao_expand_insertions.rb (renamed from lib/sisu/v5/dal_expand_insertions.rb)4
-rw-r--r--lib/sisu/v5/ao_hash_digest.rb (renamed from lib/sisu/v5/dal_hash_digest.rb)8
-rw-r--r--lib/sisu/v5/ao_idx.rb (renamed from lib/sisu/v5/dal_idx.rb)10
-rw-r--r--lib/sisu/v5/ao_images.rb (renamed from lib/sisu/v5/dal_images.rb)4
-rw-r--r--lib/sisu/v5/ao_metadata.rb (renamed from lib/sisu/v5/dal_metadata.rb)8
-rw-r--r--lib/sisu/v5/ao_misc_arrange.rb (renamed from lib/sisu/v5/dal_misc_arrange.rb)4
-rw-r--r--lib/sisu/v5/ao_numbering.rb (renamed from lib/sisu/v5/dal_numbering.rb)16
-rw-r--r--lib/sisu/v5/ao_syntax.rb (renamed from lib/sisu/v5/dal_syntax.rb)4
-rw-r--r--lib/sisu/v5/concordance.rb8
-rw-r--r--lib/sisu/v5/conf.rb12
-rw-r--r--lib/sisu/v5/constants.rb8
-rw-r--r--lib/sisu/v5/db_import.rb16
-rw-r--r--lib/sisu/v5/dbi.rb2
-rw-r--r--lib/sisu/v5/dbi_discrete.rb2
-rw-r--r--lib/sisu/v5/digests.rb32
-rw-r--r--lib/sisu/v5/git.rb8
-rw-r--r--lib/sisu/v5/html.rb4
-rw-r--r--lib/sisu/v5/html_format.rb4
-rw-r--r--lib/sisu/v5/html_lite_shared.rb (renamed from lib/sisu/v5/shared_html_lite.rb)2
-rw-r--r--lib/sisu/v5/html_scroll.rb2
-rw-r--r--lib/sisu/v5/html_segments.rb2
-rw-r--r--lib/sisu/v5/html_shared.rb (renamed from lib/sisu/v5/shared_html.rb)2
-rw-r--r--lib/sisu/v5/hub.rb67
-rw-r--r--lib/sisu/v5/manifest.rb53
-rw-r--r--lib/sisu/v5/manpage.rb32
-rw-r--r--lib/sisu/v5/options.rb49
-rw-r--r--lib/sisu/v5/param.rb4
-rw-r--r--lib/sisu/v5/particulars.rb26
-rw-r--r--lib/sisu/v5/plaintext_format.rb104
-rw-r--r--lib/sisu/v5/po4a.rb14
-rw-r--r--lib/sisu/v5/prog_text_translation.rb4
-rw-r--r--lib/sisu/v5/relaxng.rb54
-rw-r--r--lib/sisu/v5/screen_text_color.rb3
-rw-r--r--lib/sisu/v5/shared_metadata.rb10
-rw-r--r--lib/sisu/v5/sitemaps.rb2
-rw-r--r--lib/sisu/v5/src_kdissert_share.rb (renamed from lib/sisu/v5/share_src_kdissert.rb)2
-rw-r--r--lib/sisu/v5/src_share.rb (renamed from lib/sisu/v5/share_src.rb)4
-rw-r--r--lib/sisu/v5/src_shared.rb (renamed from lib/sisu/v5/shared_sisupod_source.rb)4
-rw-r--r--lib/sisu/v5/src_sisupod_make.rb (renamed from lib/sisu/v5/sisupod_make.rb)6
-rw-r--r--lib/sisu/v5/sst_do_inline_footnotes.rb48
-rw-r--r--lib/sisu/v5/sst_to_s_xml_sax.rb12
-rw-r--r--lib/sisu/v5/sysenv.rb598
-rw-r--r--lib/sisu/v5/texinfo.rb2
-rw-r--r--lib/sisu/v5/texpdf.rb12
-rw-r--r--lib/sisu/v5/texpdf_format.rb4
-rw-r--r--lib/sisu/v5/txt_asciidoc.rb588
-rw-r--r--lib/sisu/v5/txt_markdown.rb588
-rw-r--r--lib/sisu/v5/txt_plain.rb (renamed from lib/sisu/v5/plaintext.rb)82
-rw-r--r--lib/sisu/v5/txt_rst.rb550
-rw-r--r--lib/sisu/v5/txt_shared.rb (renamed from lib/sisu/v5/shared_txt.rb)14
-rw-r--r--lib/sisu/v5/txt_textile.rb543
-rw-r--r--lib/sisu/v5/urls.rb52
-rw-r--r--lib/sisu/v5/wikispeak.rb10
-rw-r--r--lib/sisu/v5/xhtml.rb14
-rw-r--r--lib/sisu/v5/xhtml_epub2.rb (renamed from lib/sisu/v5/epub.rb)114
-rw-r--r--lib/sisu/v5/xhtml_epub2_concordance.rb (renamed from lib/sisu/v5/epub_concordance.rb)30
-rw-r--r--lib/sisu/v5/xhtml_epub2_format.rb (renamed from lib/sisu/v5/epub_format.rb)6
-rw-r--r--lib/sisu/v5/xhtml_epub2_segments.rb (renamed from lib/sisu/v5/epub_segments.rb)68
-rw-r--r--lib/sisu/v5/xhtml_epub2_tune.rb (renamed from lib/sisu/v5/epub_tune.rb)20
-rw-r--r--lib/sisu/v5/xhtml_shared.rb (renamed from lib/sisu/v5/shared_xhtml.rb)2
-rw-r--r--lib/sisu/v5/xml_docbook5.rb271
-rw-r--r--lib/sisu/v5/xml_dom.rb16
-rw-r--r--lib/sisu/v5/xml_fictionbook.rb305
-rw-r--r--lib/sisu/v5/xml_fictionbook2.rb366
-rw-r--r--lib/sisu/v5/xml_odf_odt.rb (renamed from lib/sisu/v5/odf.rb)101
-rw-r--r--lib/sisu/v5/xml_odf_odt_format.rb (renamed from lib/sisu/v5/odf_format.rb)42
-rw-r--r--lib/sisu/v5/xml_sax.rb (renamed from lib/sisu/v5/xml.rb)14
-rw-r--r--lib/sisu/v5/xml_scaffold_structure_collapsed.rb6
-rw-r--r--lib/sisu/v5/xml_scaffold_structure_sisu.rb6
-rw-r--r--lib/sisu/v5/xml_shared.rb (renamed from lib/sisu/v5/shared_xml.rb)95
78 files changed, 4589 insertions, 1342 deletions
diff --git a/lib/sisu/v4/hub.rb b/lib/sisu/v4/hub.rb
index ebe9ccf4..5965994f 100644
--- a/lib/sisu/v4/hub.rb
+++ b/lib/sisu/v4/hub.rb
@@ -388,7 +388,6 @@ module SiSU
SiSU_Source::SiSUpodSource.new(@opt).read
end
if @opt.act[:share_source][:set]==:on
-#REDO
require_relative 'share_src' # -s share_src.rb
begin
ensure
@@ -516,6 +515,9 @@ module SiSU
SiSU_Env::InfoProcessingFlag.new
if @opt.act[:version_info][:set]==:on #% version information
SiSU_Env::InfoAbout.new(@opt).sisu_version
+ if @opt.cmd =~/[vVM]/
+ SiSU_Screen::Ansi.new(@opt.cmd,' ' + File.dirname(__FILE__)).grey
+ end
end
if @opt.act[:dal][:set]==:on \
or @opt.act[:maintenance][:set]==:on #% --maintenance, -m for -C
diff --git a/lib/sisu/v4/screen_text_color.rb b/lib/sisu/v4/screen_text_color.rb
index ea9ae24d..5e395133 100644
--- a/lib/sisu/v4/screen_text_color.rb
+++ b/lib/sisu/v4/screen_text_color.rb
@@ -253,6 +253,9 @@ module SiSU_Screen
%{#{@cX.off} } +
%{#{@cX.cyan}nav only: #{@txt[4]}#{@cX.off}.}
end
+ def grey
+ puts "#{@cX.grey}#{@txt[0]}#{@cX.off} #{@cX.cyan}#{@txt[1]}#{@cX.off}"
+ end
def txt_white
puts "\t#{@cX.white}#{@txt[0]}#{@cX.off} #{@cX.white}#{@txt[1]}#{@cX.off}"
end
diff --git a/lib/sisu/v5/air.rb b/lib/sisu/v5/air.rb
index cd5c2f68..a6636fe9 100644
--- a/lib/sisu/v5/air.rb
+++ b/lib/sisu/v5/air.rb
@@ -62,7 +62,7 @@
module SiSU_Air
require_relative 'particulars' # particulars.rb
class Source
- @@dal_array=[]
+ @@ao_array=[]
@@fns=nil
def initialize(opt)
@opt=opt
@@ -70,7 +70,7 @@ module SiSU_Air
@particulars=SiSU_Particulars::Combined.new(opt)
#@env=@particulars.env
#@md=@particulars.md
- #@dal_array=@particulars.dal_array
+ #@ao_array=@particulars.ao_array
end
def read
end
@@ -78,7 +78,7 @@ module SiSU_Air
def print
puts @particulars.md.inspect
puts @particulars.env.inspect
- puts @particulars.dal_array
+ puts @particulars.ao_array
end
end
end
diff --git a/lib/sisu/v5/dal.rb b/lib/sisu/v5/ao.rb
index fb8a19ae..7c367980 100644
--- a/lib/sisu/v5/dal.rb
+++ b/lib/sisu/v5/ao.rb
@@ -50,7 +50,7 @@
* Git
<http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/dal.rb;hb=HEAD>
+ <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/ao.rb;hb=HEAD>
* Ralph Amissah
<ralph@amissah.com>
@@ -60,26 +60,26 @@
in subsequent processing
=end
-module SiSU_DAL
+module SiSU_AO
require_relative 'defaults' # defaults.rb
include SiSU_Viz
require_relative 'sysenv' # sysenv.rb
include SiSU_Env
require_relative 'param' # param.rb
include SiSU_Param
- require_relative 'dal_doc_objects' # dal_doc_objects.rb
- require_relative 'dal_syntax' # dal_syntax.rb
- include SiSU_DAL_Syntax
- require_relative 'dal_doc_str' # dal_doc_str.rb
- require_relative 'dal_idx' # dal_idx.rb
- require_relative 'dal_numbering' # dal_numbering.rb
- require_relative 'dal_hash_digest' # dal_hash_digest.rb
- require_relative 'dal_endnotes' # dal_endnotes.rb
- require_relative 'dal_images' # dal_images.rb
- require_relative 'dal_metadata' # dal_metadata.rb
- require_relative 'dal_character_check' # dal_character_check.rb
- require_relative 'dal_misc_arrange' # dal_misc_arrange.rb
- require_relative 'dal_expand_insertions' # dal_expand_insertions.rb
+ require_relative 'ao_doc_objects' # ao.rb
+ require_relative 'ao_syntax' # ao_syntax.rb
+ include SiSU_AO_Syntax
+ require_relative 'ao_doc_str' # ao_doc_str.rb
+ require_relative 'ao_idx' # ao_idx.rb
+ require_relative 'ao_numbering' # ao_numbering.rb
+ require_relative 'ao_hash_digest' # ao_hash_digest.rb
+ require_relative 'ao_endnotes' # ao_endnotes.rb
+ require_relative 'ao_images' # ao_images.rb
+ require_relative 'ao_metadata' # ao_metadata.rb
+ require_relative 'ao_character_check' # ao_character_check.rb
+ require_relative 'ao_misc_arrange' # ao_misc_arrange.rb
+ require_relative 'ao_expand_insertions' # ao_expand_insertions.rb
require_relative 'prog_text_translation' # prog_text_translation.rb
require_relative 'shared_sem' # shared_sem.rb
class Instantiate < SiSU_Param::Parameters::Instructions
@@ -89,7 +89,7 @@ module SiSU_DAL
end
end
class Source <Instantiate
- @@dal_array=[]
+ @@ao_array=[]
@@idx_arr={ sst: [], tex: [], html: [], xhtml: [] }
@@map_arr={ nametags: [], ocn_htmlseg: [] }
@@fns=nil
@@ -105,55 +105,55 @@ module SiSU_DAL
opt.fns
end
@make_fns=SiSU_Env::InfoFile.new(fn_use)
- @fnm=@make_fns.marshal.dal_metadata
- @fnc=@make_fns.marshal.dal_content
- @idx_sst=@make_fns.marshal.dal_idx_sst_rel_html_seg
- @idx_raw=@make_fns.marshal.dal_idx_sst_rel
- @idx_html=@make_fns.marshal.dal_idx_html
- @idx_xhtml=@make_fns.marshal.dal_idx_xhtml
- @map_nametags=@make_fns.marshal.dal_map_nametags
- @map_ocn_htmlseg=@make_fns.marshal.dal_map_ocn_htmlseg
+ @fnm=@make_fns.marshal.ao_metadata
+ @fnc=@make_fns.marshal.ao_content
+ @idx_sst=@make_fns.marshal.ao_idx_sst_rel_html_seg
+ @idx_raw=@make_fns.marshal.ao_idx_sst_rel
+ @idx_html=@make_fns.marshal.ao_idx_html
+ @idx_xhtml=@make_fns.marshal.ao_idx_xhtml
+ @map_nametags=@make_fns.marshal.ao_map_nametags
+ @map_ocn_htmlseg=@make_fns.marshal.ao_map_ocn_htmlseg
@env=SiSU_Env::InfoEnv.new
end
- def read #creates dal
+ def read #creates ao
begin
- @@dal_array=[]
+ @@ao_array=[]
@@fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
? @fnx
: @opt.fns
- create_dal
+ create_ao
rescue
SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@@fns).location do
__LINE__.to_s + ':' + __FILE__
end
ensure
- SiSU_DAL::Instantiate.new
+ SiSU_AO::Instantiate.new
end
end
- def get #reads dal, unless does not exist then creates first
+ def get #reads ao, unless does not exist then creates first
begin
- dal=[]
+ ao=[]
unless @@fns==@opt.fns \
or @@fns==@fnx
@@fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
? @fnx
: @opt.fns
- @@dal_array=[]
+ @@ao_array=[]
end
- dal=(@@dal_array.empty?) \
+ ao=(@@ao_array.empty?) \
? read_fnc
- : @@dal_array.dup
+ : @@ao_array.dup
rescue
SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do
__LINE__.to_s + ':' + __FILE__
end
ensure
- SiSU_DAL::Instantiate.new
+ SiSU_AO::Instantiate.new
end
end
- def get_idx_sst #reads dal idx.sst, #unless does not exist then creates first
+ def get_idx_sst #reads ao idx.sst, #unless does not exist then creates first
begin
- dal=[]
+ ao=[]
unless @@fns==@opt.fns \
or @@fns==@fnx
@@fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
@@ -161,18 +161,18 @@ module SiSU_DAL
: @opt.fns
@@idx_arr[:sst]=[]
end
- dal=(@@idx_arr[:sst].empty?) ? read_idx_sst : @@idx_arr[:sst].dup #check
+ ao=(@@idx_arr[:sst].empty?) ? read_idx_sst : @@idx_arr[:sst].dup #check
rescue
SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do
__LINE__.to_s + ':' + __FILE__
end
ensure
- SiSU_DAL::Instantiate.new
+ SiSU_AO::Instantiate.new
end
end
def get_idx_raw
begin
- dal=[]
+ ao=[]
unless @@fns==@opt.fns \
or @@fns==@fnx
@@fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
@@ -180,18 +180,18 @@ module SiSU_DAL
: @opt.fns
@@idx_arr[:tex]=[]
end
- dal=(@@idx_arr[:tex].empty?) ? read_idx_raw : @@idx_arr[:tex].dup #check
+ ao=(@@idx_arr[:tex].empty?) ? read_idx_raw : @@idx_arr[:tex].dup #check
rescue
SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do
__LINE__.to_s + ':' + __FILE__
end
ensure
- SiSU_DAL::Instantiate.new
+ SiSU_AO::Instantiate.new
end
end
- def get_idx_html #reads dal idx.html, #unless does not exist then creates first
+ def get_idx_html #reads ao idx.html, #unless does not exist then creates first
begin
- dal=[]
+ ao=[]
unless @@fns==@opt.fns \
or @@fns==@fnx
@@fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
@@ -199,18 +199,18 @@ module SiSU_DAL
: @opt.fns
@@idx_arr[:html]=[]
end
- dal=(@@idx_arr[:html].empty?) ? read_idx_html : @@idx_arr[:html].dup
+ ao=(@@idx_arr[:html].empty?) ? read_idx_html : @@idx_arr[:html].dup
rescue
SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do
__LINE__.to_s + ':' + __FILE__
end
ensure
- SiSU_DAL::Instantiate.new
+ SiSU_AO::Instantiate.new
end
end
- def get_idx_xhtml #reads dal idx.xhtml, #unless does not exist then creates first
+ def get_idx_xhtml #reads ao idx.xhtml, #unless does not exist then creates first
begin
- dal=[]
+ ao=[]
unless @@fns==@opt.fns \
or @@fns==@fnx
@@fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
@@ -218,18 +218,18 @@ module SiSU_DAL
: @opt.fns
@@idx_arr[:xthml]=[]
end
- dal=(@@idx_arr[:xhtml].empty?) ? read_idx_xhtml : @@idx_arr[:xhtml].dup
+ ao=(@@idx_arr[:xhtml].empty?) ? read_idx_xhtml : @@idx_arr[:xhtml].dup
rescue
SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do
__LINE__.to_s + ':' + __FILE__
end
ensure
- SiSU_DAL::Instantiate.new
+ SiSU_AO::Instantiate.new
end
end
- def get_map_nametags #reads dal map.nametags, #unless does not exist then creates first
+ def get_map_nametags #reads ao map.nametags, #unless does not exist then creates first
begin
- dal=[]
+ ao=[]
unless @@fns==@opt.fns \
or @@fns==@fnx
@@fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
@@ -237,18 +237,18 @@ module SiSU_DAL
: @opt.fns
@@map_arr[:nametags]=[]
end
- dal=(@@map_arr[:nametags].empty?) ? read_map_nametags : @@map_arr[:nametags].dup
+ ao=(@@map_arr[:nametags].empty?) ? read_map_nametags : @@map_arr[:nametags].dup
rescue
SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do
__LINE__.to_s + ':' + __FILE__
end
ensure
- SiSU_DAL::Instantiate.new
+ SiSU_AO::Instantiate.new
end
end
- def get_map_ocn_htmlseg #reads dal map.ocn_htmlseg, #unless does not exist then creates first
+ def get_map_ocn_htmlseg #reads ao map.ocn_htmlseg, #unless does not exist then creates first
begin
- dal=[]
+ ao=[]
unless @@fns==@opt.fns \
or @@fns==@fnx
@@fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
@@ -256,18 +256,18 @@ module SiSU_DAL
: @opt.fns
@@map_arr[:ocn_htmlseg]=[]
end
- dal=(@@map_arr[:ocn_htmlseg].empty?) ? read_map_ocn_htmlseg : @@map_arr[:ocn_htmlseg].dup
+ ao=(@@map_arr[:ocn_htmlseg].empty?) ? read_map_ocn_htmlseg : @@map_arr[:ocn_htmlseg].dup
rescue
SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do
__LINE__.to_s + ':' + __FILE__
end
ensure
- SiSU_DAL::Instantiate.new
+ SiSU_AO::Instantiate.new
end
end
protected
- def create_dal
- dal_array=[]
+ def create_ao
+ ao_array=[]
unless @opt.act[:quiet][:set]==:on
tell=(@opt.act[:verbose][:set]==:on \
|| @opt.act[:verbose_plus][:set]==:on \
@@ -285,7 +285,7 @@ module SiSU_DAL
meta=file_array=@env.source_file_processing_array(fn)
@md=SiSU_Param::Parameters::Instructions.new(meta,@opt).extract
meta=nil
- dal=SiSU_DAL::Make.new(fn,@md,file_array).song
+ ao=SiSU_AO::Make.new(fn,@md,file_array).song
if (@opt.act[:verbose][:set]==:on \
|| @opt.act[:verbose_plus][:set]==:on \
|| @opt.act[:maintenance][:set]==:on)
@@ -294,12 +294,12 @@ module SiSU_DAL
|| @opt.act[:verbose_plus][:set]==:on)
SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"~meta/#{@opt.fns}.meta").output
elsif @opt.act[:maintenance][:set]==:on
- SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"dal -> #{cf.meta}").txt_grey
+ SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"ao -> #{cf.meta}").txt_grey
end
end
- dal.each {|s| dal_array << s}
+ ao.each {|s| ao_array << s}
if @opt.act[:maintenance][:set]==:on
- dal_array.each do |obj|
+ ao_array.each do |obj|
if defined? obj.parent
if defined? obj.ln
if defined? obj.node
@@ -317,19 +317,19 @@ module SiSU_DAL
end
end
end
- dal_array
+ ao_array
end
def read_fnm
- dal=[]
- dal=(FileTest.file?(@fnm)) \
- ? (File.open(@fnm,'r:utf-8'){ |f| dal=Marshal.load(f)})
- : SiSU_DAL::Source.new(@opt).create_dal
+ ao=[]
+ ao=(FileTest.file?(@fnm)) \
+ ? (File.open(@fnm,'r:utf-8'){ |f| ao=Marshal.load(f)})
+ : SiSU_AO::Source.new(@opt).create_ao
end
def read_fnc
- dal=[]
- dal=(FileTest.file?(@fnc)) \
- ? (File.open(@fnc,'r:utf-8'){ |f| dal=Marshal.load(f)})
- : SiSU_DAL::Source.new(@opt).create_dal
+ ao=[]
+ ao=(FileTest.file?(@fnc)) \
+ ? (File.open(@fnc,'r:utf-8'){ |f| ao=Marshal.load(f)})
+ : SiSU_AO::Source.new(@opt).create_ao
end
def read_idx_sst
m=[]
@@ -439,21 +439,21 @@ module SiSU_DAL
end
end
else
- hard="#{@dir.processing_path.dal}/#{@md.fns}.meta"
+ hard="#{@dir.processing_path.ao}/#{@md.fns}.meta"
File.unlink(hard) if FileTest.file?(hard)
- hard="#{@dir.processing_path.dal}/#{@md.fns}.txt"
+ hard="#{@dir.processing_path.ao}/#{@md.fns}.txt"
File.unlink(hard) if FileTest.file?(hard)
- hard="#{@dir.processing_path.dal}/#{@md.fns}.debug.txt"
+ hard="#{@dir.processing_path.ao}/#{@md.fns}.debug.txt"
File.unlink(hard) if FileTest.file?(hard)
end
end
def make_marshal_content
- marshal_dal=@make.marshal.dal_content
- File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Array)
+ marshal_ao=@make.marshal.ao_content
+ File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Array)
end
def make_marshal_metadata
- marshal_dal=@make.marshal.dal_metadata
- File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Array)
+ marshal_ao=@make.marshal.ao_metadata
+ File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Array)
end
def idx_html_hard_output
if @md.book_idx \
@@ -464,33 +464,33 @@ module SiSU_DAL
@data.each {|s| filename_meta.puts s.strip + "\n" unless s.strip.empty?}
end
else
- hard_idx_html="#{@dir.processing_path.dal}/#{@md.fns}.idx.html"
+ hard_idx_html="#{@dir.processing_path.ao}/#{@md.fns}.idx.html"
File.unlink(hard_idx_html) if FileTest.file?(hard_idx_html)
end
end
def make_marshal_idx_sst_html_seg
- marshal_dal=@make.marshal.dal_idx_sst_rel_html_seg
- File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Array)
+ marshal_ao=@make.marshal.ao_idx_sst_rel_html_seg
+ File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Array)
end
def make_marshal_idx_sst_rel
- marshal_dal=@make.marshal.dal_idx_sst_rel
- File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Array)
+ marshal_ao=@make.marshal.ao_idx_sst_rel
+ File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Array)
end
def make_marshal_idx_html
- marshal_dal=@make.marshal.dal_idx_html
- File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Array)
+ marshal_ao=@make.marshal.ao_idx_html
+ File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Array)
end
def make_marshal_idx_xhtml
- marshal_dal=@make.marshal.dal_idx_xhtml
- File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Array)
+ marshal_ao=@make.marshal.ao_idx_xhtml
+ File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Array)
end
def make_marshal_map_nametags
- marshal_dal=@make.marshal.dal_map_nametags
- File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Hash)
+ marshal_ao=@make.marshal.ao_map_nametags
+ File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Hash)
end
def make_marshal_map_name_ocn_htmlseg
- marshal_dal=@make.marshal.dal_map_ocn_htmlseg
- File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Hash)
+ marshal_ao=@make.marshal.ao_map_ocn_htmlseg
+ File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Hash)
end
end
class Make
@@ -505,28 +505,28 @@ module SiSU_DAL
def song
reset
data=@data
- data=SiSU_DAL_Insertions::Insertions.new(@md,data).expand_insertions? # dal_expand_insertions.rb
- data=SiSU_DAL_MiscArrangeText::SI.new(@md,data).prepare_text # dal_misc_arrange.rb
- data,metadata=SiSU_DAL_DocumentStructureExtract::Build.new(@md,data).identify_parts # dal_doc_str.rb
- data=SiSU_DAL_Syntax::Markup.new(@md,data).songsheet # dal_syntax.rb
- data,endnote_array=SiSU_DAL_CharacterCheck::Check.new(data).character_check_and_oldstyle_endnote_array # dal_character_check.rb
- data=SiSU_DAL_Images::Images.new(@md,data).images # dal_images.rb
- data,tags_map,ocn_html_seg_map=SiSU_DAL_Numbering::Numbering.new(@md,data).numbering_song # dal_numbering.rb
- data,book_index_rel,book_index_rel_html_seg,html_idx,xhtml_idx=SiSU_DAL_BookIndex::BookIndex.new(@md,data,@env).indexing_song if @md.book_idx # dal_idx.rb
- data=SiSU_DAL_Endnotes::Endnotes.new(@md,data,endnote_array).endnotes # dal_endnotes.rb
+ data=SiSU_AO_Insertions::Insertions.new(@md,data).expand_insertions? # ao_expand_insertions.rb
+ data=SiSU_AO_MiscArrangeText::SI.new(@md,data).prepare_text # ao_misc_arrange.rb
+ data,metadata=SiSU_AO_DocumentStructureExtract::Build.new(@md,data).identify_parts # ao_doc_str.rb
+ data=SiSU_AO_Syntax::Markup.new(@md,data).songsheet # ao_syntax.rb
+ data,endnote_array=SiSU_AO_CharacterCheck::Check.new(data).character_check_and_oldstyle_endnote_array # ao_character_check.rb
+ data=SiSU_AO_Images::Images.new(@md,data).images # ao_images.rb
+ data,tags_map,ocn_html_seg_map=SiSU_AO_Numbering::Numbering.new(@md,data).numbering_song # ao_numbering.rb
+ data,book_index_rel,book_index_rel_html_seg,html_idx,xhtml_idx=SiSU_AO_BookIndex::BookIndex.new(@md,data,@env).indexing_song if @md.book_idx # ao_idx.rb
+ data=SiSU_AO_Endnotes::Endnotes.new(@md,data,endnote_array).endnotes # ao_endnotes.rb
outputdata=data
- if (@md.opt.act[:dal][:set]==:on \
+ if (@md.opt.act[:ao][:set]==:on \
|| @md.opt.act[:maintenance][:set]==:on)
- SiSU_DAL::Output.new(@fn,@md,outputdata).hard_output
- SiSU_DAL::Output.new(@fn,@md,outputdata).make_marshal_content
- SiSU_DAL::Output.new(@fn,@md,metadata).make_marshal_metadata
- SiSU_DAL::Output.new(@fn,@md,html_idx).idx_html_hard_output
- SiSU_DAL::Output.new(@fn,@md,book_index_rel_html_seg).make_marshal_idx_sst_html_seg
- SiSU_DAL::Output.new(@fn,@md,book_index_rel).make_marshal_idx_sst_rel
- SiSU_DAL::Output.new(@fn,@md,html_idx).make_marshal_idx_html
- SiSU_DAL::Output.new(@fn,@md,xhtml_idx).make_marshal_idx_xhtml
- SiSU_DAL::Output.new(@fn,@md,tags_map).make_marshal_map_nametags
- SiSU_DAL::Output.new(@fn,@md,ocn_html_seg_map).make_marshal_map_name_ocn_htmlseg
+ SiSU_AO::Output.new(@fn,@md,outputdata).hard_output
+ SiSU_AO::Output.new(@fn,@md,outputdata).make_marshal_content
+ SiSU_AO::Output.new(@fn,@md,metadata).make_marshal_metadata
+ SiSU_AO::Output.new(@fn,@md,html_idx).idx_html_hard_output
+ SiSU_AO::Output.new(@fn,@md,book_index_rel_html_seg).make_marshal_idx_sst_html_seg
+ SiSU_AO::Output.new(@fn,@md,book_index_rel).make_marshal_idx_sst_rel
+ SiSU_AO::Output.new(@fn,@md,html_idx).make_marshal_idx_html
+ SiSU_AO::Output.new(@fn,@md,xhtml_idx).make_marshal_idx_xhtml
+ SiSU_AO::Output.new(@fn,@md,tags_map).make_marshal_map_nametags
+ SiSU_AO::Output.new(@fn,@md,ocn_html_seg_map).make_marshal_map_name_ocn_htmlseg
end
reset
outputdata
diff --git a/lib/sisu/v5/dal_character_check.rb b/lib/sisu/v5/ao_character_check.rb
index 62aa60c1..86f23f5b 100644
--- a/lib/sisu/v5/dal_character_check.rb
+++ b/lib/sisu/v5/ao_character_check.rb
@@ -50,7 +50,7 @@
* Git
<http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/dal_character_check.rb;hb=HEAD>
+ <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/ao_character_check.rb;hb=HEAD>
* Ralph Amissah
<ralph@amissah.com>
@@ -59,7 +59,7 @@
** Description: system environment, resource control and configuration details
=end
-module SiSU_DAL_CharacterCheck
+module SiSU_AO_CharacterCheck
class Check
def initialize(data)
@data=data
diff --git a/lib/sisu/v5/dal_doc_objects.rb b/lib/sisu/v5/ao_doc_objects.rb
index 518535b0..556304d4 100644
--- a/lib/sisu/v5/dal_doc_objects.rb
+++ b/lib/sisu/v5/ao_doc_objects.rb
@@ -50,7 +50,7 @@
* Git
<http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/dal_doc_objects.rb;hb=HEAD>
+ <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/ao_doc_objects.rb;hb=HEAD>
* Ralph Amissah
<ralph@amissah.com>
@@ -59,7 +59,7 @@
** Description: document abstraction
=end
-module SiSU_DAL_DocumentStructure
+module SiSU_AO_DocumentStructure
class Extract
def extract(h,o)
h ? h : o
diff --git a/lib/sisu/v5/dal_doc_str.rb b/lib/sisu/v5/ao_doc_str.rb
index 203bc988..465a5666 100644
--- a/lib/sisu/v5/dal_doc_str.rb
+++ b/lib/sisu/v5/ao_doc_str.rb
@@ -50,7 +50,7 @@
* Git
<http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/dal_doc_str.rb;hb=HEAD>
+ <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/ao_doc_str.rb;hb=HEAD>
* Ralph Amissah
<ralph@amissah.com>
@@ -59,7 +59,7 @@
** Description: document abstraction
=end
-module SiSU_DAL_DocumentStructureExtract
+module SiSU_AO_DocumentStructureExtract
class Instantiate < SiSU_Param::Parameters::Instructions
@@flag={
ocn: :on,
@@ -89,10 +89,10 @@ module SiSU_DAL_DocumentStructureExtract
}
def initialize(md,data)
@md,@data=md,data
- SiSU_DAL_DocumentStructureExtract::Instantiate.new
- @pb=SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page])
- @pbn=SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_new])
- @pbl=SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_line])
+ SiSU_AO_DocumentStructureExtract::Instantiate.new
+ @pb=SiSU_AO_DocumentStructure::ObjectLayout.new.break(Hx[:br_page])
+ @pbn=SiSU_AO_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_new])
+ @pbl=SiSU_AO_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_line])
end
def ln_get(lv)
case lv
@@ -238,7 +238,7 @@ module SiSU_DAL_DocumentStructureExtract
@@flag[:ocn]=:on
{flag: :ocn_on}
end
- t_o=SiSU_DAL_DocumentStructure::ObjectFlag.new.flag_ocn(h)
+ t_o=SiSU_AO_DocumentStructure::ObjectFlag.new.flag_ocn(h)
next
end
t_o=t_o.gsub(/(?:\n\s*\n)+/m,"\n") if @@flag[:code]==:off
@@ -271,7 +271,7 @@ module SiSU_DAL_DocumentStructureExtract
when /^%+\s/ #comment
t_o=if t_o=~/^%+\s+(.+)/
h={obj: $1}
- SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h)
+ SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
else nil
end
when /^:?([A-C1-6])\~/ #heading / lv
@@ -292,7 +292,7 @@ module SiSU_DAL_DocumentStructureExtract
end
end
h={ lv: lv, ln: ln, obj: obj, idx: idx, tags: tags }
- SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h)
+ SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h)
elsif t_o=~/^:?[A-C1-6]\~(\S+?)-\s+(.+)/m
name,obj=$1,$2
note=endnote_test?(obj)
@@ -308,7 +308,7 @@ module SiSU_DAL_DocumentStructureExtract
end
end
h={ lv: lv, name: name, obj: obj, idx: idx, autonum_: false, tags: tags}
- SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h)
+ SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h)
elsif t_o=~/^:?[A-C1-6]\~(\S+)\s+(.+)/m
name,obj=$1,$2
note=endnote_test?(obj)
@@ -324,7 +324,7 @@ module SiSU_DAL_DocumentStructureExtract
end
end
h={ lv: lv, name: name, obj: obj, idx: idx, tags: tags }
- SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h)
+ SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h)
else nil
end
when /^_(?:[1-9]!?|[1-9]?\*)\s+/ #indented and/or bullet paragraph
@@ -347,7 +347,7 @@ module SiSU_DAL_DocumentStructureExtract
end
end
h={ bullet_: bullet, hang: hang, indent: indent, obj: obj, idx: idx, note_: note, image_: image, tags: tags }
- SiSU_DAL_DocumentStructure::ObjectPara.new.paragraph(h)
+ SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h)
end
else nil
end
@@ -370,18 +370,18 @@ module SiSU_DAL_DocumentStructureExtract
end
end
h={ hang: hang, indent: indent, obj: obj, idx: idx, note_: note, image_: image, tags: tags }
- SiSU_DAL_DocumentStructure::ObjectPara.new.paragraph(h)
+ SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h)
end
else nil
end
when /^<(?:br)?:(?:pa?r|o(?:bj|---)?)>\s*$/ #[br:par] #[br:obj]
- SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_obj])
+ SiSU_AO_DocumentStructure::ObjectLayout.new.break(Hx[:br_obj])
when /^(?:-\\\\-|<:pb>)\s*$/ #[br:pg]
- SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page],:markup)
+ SiSU_AO_DocumentStructure::ObjectLayout.new.break(Hx[:br_page],:markup)
when /^(?:=\\\\=|<:pn>)\s*$/ #[br:pgn]
- SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_new],:markup)
+ SiSU_AO_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_new],:markup)
when /^-\.\.-\s*$/ #[br:pgl]
- SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_line],:markup)
+ SiSU_AO_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_line],:markup)
else #paragraph
image=image_test(t_o)
note=endnote_test?(t_o)
@@ -394,7 +394,7 @@ module SiSU_DAL_DocumentStructureExtract
end
unless obj=~/\A\s*\Z/m
h={ bullet_: false, indent: 0, hang: 0, obj: obj, idx: idx, note_: note, image_: image, tags: tags }
- SiSU_DAL_DocumentStructure::ObjectPara.new.paragraph(h)
+ SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h)
end
end
elsif @@flag[:code]==:off
@@ -407,7 +407,7 @@ module SiSU_DAL_DocumentStructureExtract
@@counter=1
@codeblock_numbered=(t_o =~/^(?:code\{#|[`]{3}\s+code\s[#])/) ? true : false
h={ obj: 'code block start' } #introduce a counter
- t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h)
+ t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
elsif t_o =~/^(?:poem\{|[`]{3}\s+poem)/
@@flag[:poem]=case t_o
when /^poem\{/; :curls
@@ -415,7 +415,7 @@ module SiSU_DAL_DocumentStructureExtract
else @@flag[:poem] #error
end
h={ obj: 'poem start' } #introduce a counter
- t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h)
+ t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
tuned_file << t_o
elsif t_o =~/^(?:group\{|[`]{3}\s+group)/
@@flag[:group]=case t_o
@@ -424,7 +424,7 @@ module SiSU_DAL_DocumentStructureExtract
else @@flag[:group] #error
end
h={ obj: 'group text start' } #introduce a counter
- t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h)
+ t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
tuned_file << t_o
elsif t_o =~/^(?:block\{|[`]{3}\s+block)/
@@flag[:block]=case t_o
@@ -433,7 +433,7 @@ module SiSU_DAL_DocumentStructureExtract
else @@flag[:block] #error
end
h={ obj: 'block text start' } #introduce a counter
- t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h)
+ t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
tuned_file << t_o
elsif t_o =~/^(?:alt\{|[`]{3}\s+alt)/
@@flag[:alt]=case t_o
@@ -442,11 +442,11 @@ module SiSU_DAL_DocumentStructureExtract
else @@flag[:alt] #error
end
h={ obj: 'alt text start' } #introduce a counter
- t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h)
+ t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
tuned_file << t_o
elsif t_o =~/^(?:table\{|[`]{3}\s+table|\{table)[ ~]/
h={ obj: 'table start' } #introduce a counter
- ins=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h)
+ ins=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
tuned_file << ins
if t_o=~/^table\{(?:~h)?\s+/
@@flag[:table]=:curls
@@ -500,10 +500,10 @@ module SiSU_DAL_DocumentStructureExtract
cols.times { col << width }
end
h={ head_: hd, cols: cols, widths: col, obj: rows, idx: idx, tags: tags }
- t_o=SiSU_DAL_DocumentStructure::ObjectTable.new.table(h) unless h.nil?
+ t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) unless h.nil?
tuned_file << t_o
h={ obj: 'table end' } #introduce a counter
- t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h)
+ t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
t_o
elsif t_o=~/^[`]{3}\s+table(?:~h)?\s+/
m1,m2,hd=nil,nil,nil
@@ -523,10 +523,10 @@ module SiSU_DAL_DocumentStructureExtract
rows += r + Mx[:tc_c]
end
h={ head_: hd, cols: col.length, widths: col, obj: rows, idx: idx, tags: tags }
- t_o=SiSU_DAL_DocumentStructure::ObjectTable.new.table(h) unless h.nil?
+ t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) unless h.nil?
tuned_file << t_o
h={ obj: 'table end' } #introduce a counter
- t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h)
+ t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
t_o
elsif t_o=~/^\{table(?:~h)?\s+/
m1,m2,hd=nil,nil,nil
@@ -546,10 +546,10 @@ module SiSU_DAL_DocumentStructureExtract
rows += r + Mx[:tc_c]
end
h={ head_: hd, cols: col.length, widths: col, obj: rows, idx: idx, tags: tags }
- t_o=SiSU_DAL_DocumentStructure::ObjectTable.new.table(h) unless h.nil?
+ t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) unless h.nil?
tuned_file << t_o
h={ obj: 'table end' } #introduce a counter
- t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h)
+ t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
t_o
end
end
@@ -563,11 +563,11 @@ module SiSU_DAL_DocumentStructureExtract
@@flag[:table]=:off
headings,columns,widths,idx=@h[:head_],@h[:cols],@h[:widths],@h[:idx]
@h={ head_: headings, cols: columns, widths: widths, idx: idx, obj: @rows }
- t_o=SiSU_DAL_DocumentStructure::ObjectTable.new.table(@h)
+ t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(@h)
tuned_file << t_o
@h,@rows=nil,''
h={ obj: 'table end' } #introduce a counter
- t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h)
+ t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
t_o
else
if t_o.is_a?(String) \
@@ -586,18 +586,18 @@ module SiSU_DAL_DocumentStructureExtract
obj=@tuned_code.join("\n")
tags=[]
h={ obj: obj, tags: tags, number_: @codeblock_numbered }
- t_o=SiSU_DAL_DocumentStructure::ObjectBlockTxt.new.code(h)
+ t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.code(h)
@tuned_code=[]
tuned_file << t_o
h={ obj: 'code block end' } #introduce a counter
- t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h)
+ t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
end
if (@@flag[:code]==:curls or @@flag[:code]==:tics) \
and t_o.is_a?(String)
sub_array=t_o.dup + "#{Mx[:br_nl]}"
@line_mode=[]
sub_array.scan(/.+/) {|w| @line_mode << w if w =~/[\S]+/}
- t_o=SiSU_DAL_DocumentStructureExtract::Build.new(@md,@line_mode).build_lines(:code).join
+ t_o=SiSU_AO_DocumentStructureExtract::Build.new(@md,@line_mode).build_lines(:code).join
@tuned_code << t_o
t_o=nil
end
@@ -609,37 +609,37 @@ module SiSU_DAL_DocumentStructureExtract
or (@@flag[:poem]==:tics and t_o =~/^[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
@@flag[:poem]=:off
h={ obj: 'poem end' } #introduce a counter
- t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h)
+ t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
elsif (@@flag[:group]==:curls and t_o =~/^\}group/) \
or (@@flag[:group]==:tics and t_o =~/^[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
@@flag[:group]=:off
obj,tags=extract_tags(@tuned_block.join("\n"))
h={ obj: obj, tags: tags }
@tuned_block=[]
- t_o=SiSU_DAL_DocumentStructure::ObjectBlockTxt.new.group(h)
+ t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.group(h)
tuned_file << t_o
h={ obj: 'group text end' } #introduce a counter
- t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h)
+ t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
elsif (@@flag[:block]==:curls and t_o =~/^\}block/) \
or (@@flag[:block]==:tics and t_o =~/^[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
@@flag[:block]=:off
obj,tags=extract_tags(@tuned_block.join("\n"))
h={ obj: obj, tags: tags }
@tuned_block=[]
- t_o=SiSU_DAL_DocumentStructure::ObjectBlockTxt.new.block(h)
+ t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.block(h)
tuned_file << t_o
h={ obj: 'block text end' } #introduce a counter
- t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h)
+ t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
elsif (@@flag[:alt]==:curls and t_o =~/^\}alt/) \
or (@@flag[:alt]==:tics and t_o =~/^[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
@@flag[:alt]=:off
obj,tags=extract_tags(@tuned_block.join("\n"))
h={ obj: obj, tags: tags }
- t_o=SiSU_DAL_DocumentStructure::ObjectBlockTxt.new.alt(h)
+ t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.alt(h)
@tuned_block=[]
tuned_file << t_o
h={ obj: 'alt text end' } #introduce a counter
- t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h)
+ t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
end
if (@@flag[:poem]==:curls or @@flag[:poem]==:tics \
or @@flag[:group]==:curls or @@flag[:group]==:tics \
@@ -650,13 +650,13 @@ module SiSU_DAL_DocumentStructureExtract
sub_array=t_o.dup
@line_mode=sub_array.scan(/.+/)
type=if @@flag[:poem]==:curls or @@flag[:poem]==:tics
- t_o=SiSU_DAL_DocumentStructureExtract::Build.new(@md,@line_mode).build_lines(type).join
+ t_o=SiSU_AO_DocumentStructureExtract::Build.new(@md,@line_mode).build_lines(type).join
poem=t_o.split(/\n\n/)
poem.each do |v|
v=v.gsub(/\n/m,"#{Mx[:br_nl]}\n")
obj,tags=extract_tags(v)
h={ obj: obj, tags: tags }
- t_o=SiSU_DAL_DocumentStructure::ObjectBlockTxt.new.verse(h)
+ t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.verse(h)
tuned_file << t_o
end
:poem
@@ -691,26 +691,26 @@ module SiSU_DAL_DocumentStructureExtract
if @md.flag_endnotes
tuned_file << @pb
h={ ln: 2, lc: 2, obj: 'Endnotes', autonum_: false }
- tuned_file << SiSU_DAL_DocumentStructure::ObjectHeading.new.heading_insert(h)
+ tuned_file << SiSU_AO_DocumentStructure::ObjectHeading.new.heading_insert(h)
h={ ln: 4, lc: 3, obj: 'Endnotes', name: 'endnotes', autonum_: false }
- tuned_file << SiSU_DAL_DocumentStructure::ObjectHeading.new.heading_insert(h)
+ tuned_file << SiSU_AO_DocumentStructure::ObjectHeading.new.heading_insert(h)
h={ obj: 'Endnotes' }
end
if @md.book_idx
tuned_file << @pb
h={ ln: 2, lc: 2, obj: 'Index', autonum_: false }
- tuned_file << SiSU_DAL_DocumentStructure::ObjectHeading.new.heading_insert(h)
+ tuned_file << SiSU_AO_DocumentStructure::ObjectHeading.new.heading_insert(h)
h={ ln: 4, lc: 3, obj: 'Index', name: 'book_index', autonum_: false }
- tuned_file << SiSU_DAL_DocumentStructure::ObjectHeading.new.heading_insert(h)
+ tuned_file << SiSU_AO_DocumentStructure::ObjectHeading.new.heading_insert(h)
h={ obj: 'Index' }
end
tuned_file << @pb
h={ ln: 2, lc: 2, obj: 'Metadata', autonum_: false, ocn_: false }
- tuned_file << SiSU_DAL_DocumentStructure::ObjectHeading.new.heading_insert(h)
+ tuned_file << SiSU_AO_DocumentStructure::ObjectHeading.new.heading_insert(h)
h={ ln: 4, lc: 3, obj: 'SiSU Metadata, document information', name: 'metadata', autonum_: false, ocn_: false }
- tuned_file << SiSU_DAL_DocumentStructure::ObjectHeading.new.heading_insert(h)
+ tuned_file << SiSU_AO_DocumentStructure::ObjectHeading.new.heading_insert(h)
h={ obj: 'eof' }
- meta=SiSU_DAL_DocumentStructure::ObjectMetadata.new.metadata(@metadata)
+ meta=SiSU_AO_DocumentStructure::ObjectMetadata.new.metadata(@metadata)
[tuned_file,meta]
end
def table_rows_and_columns_array(table_str)
@@ -723,11 +723,11 @@ module SiSU_DAL_DocumentStructureExtract
end
def meta_heading(h)
h={ lv: h[:lv], ln: h[:ln], name: h[:name], obj: h[:obj], ocn: '0' }
- SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h)
+ SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h)
end
def meta_para(str)
h={ obj: str, ocn_: false }
- SiSU_DAL_DocumentStructure::ObjectPara.new.paragraph(h)
+ SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h)
end
def build_lines(type=:none)
lines,lines_new=@data,[]
@@ -769,22 +769,22 @@ module SiSU_DAL_DocumentStructureExtract
@dob=case @dob.obj
when /^#{@md.lv1}/
h={ lv: 'A', ln: 1 }
- SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h,@dob)
+ SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob)
when /^#{@md.lv2}/
h={ lv: 'B', ln: 2 }
- SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h,@dob)
+ SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob)
when /^#{@md.lv3}/
h={ lv: 'C', ln: 3 }
- SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h,@dob)
+ SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob)
when /^#{@md.lv4}/
h={ lv: '1', ln: 4 }
- SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h,@dob)
+ SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob)
when /^#{@md.lv5}/
h={ lv: '2', ln: 5 }
- SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h,@dob)
+ SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob)
when /^#{@md.lv6}/
h={ lv: '3', ln: 6 }
- SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h,@dob)
+ SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob)
else @dob
end
else @dob
@@ -868,7 +868,6 @@ has incorrect level and/or parent level}
&& (dob.of !=:comment \
&& dob.of !=:layout \
&& dob.of !=:meta) \
- && dob.obj !~/#{Mx[:pa_non_object_no_heading]}|#{Mx[:pa_non_object_dummy_heading]}/ \
&& dob.ocn_
#dob.ln now is determined, and set earlier, check how best to remove this -->
if dob.is==:heading
@@ -884,200 +883,258 @@ has incorrect level and/or parent level}
when '6'; 9
end
end
- if not dob.obj =~/<:#>|~#|-#/ \
- or not dob.toc_ # fix this no longer in dob.obj
+ if not dob.obj =~/~#|-#/
ocn+=1
- if dob.is==:heading \
- and (ln.to_s =~/^[1-9]/ \
- or ln.to_s =~@md.lv1 \
- or ln.to_s =~@md.lv2 \
- or ln.to_s =~@md.lv3 \
- or ln.to_s =~@md.lv4 \
- or ln.to_s =~@md.lv5 \
- or ln.to_s =~@md.lv6)
+ end
+ if dob.is==:heading \
+ and (ln.to_s =~/^[1-9]/ \
+ or ln.to_s =~@md.lv1 \
+ or ln.to_s =~@md.lv2 \
+ or ln.to_s =~@md.lv3 \
+ or ln.to_s =~@md.lv4 \
+ or ln.to_s =~@md.lv5 \
+ or ln.to_s =~@md.lv6)
+ if not dob.obj =~/~#|-#/
ocnh+=1
- if ln==1 \
- or ln=~@md.lv1; ocnh1+=1 #heading
+ end
+ if ln==1 \
+ or ln=~@md.lv1
+ if not dob.obj =~/~#|-#/
+ ocn_flag=true
+ ocnh1+=1 #heading
node1="1:#{ocnh1};#{ocn}"
- document_structure_check_info(node1,node0)
- @collapsed_lv1=1
- collapsed_level=@collapsed_lv1
- node,ocn_sp,parent=node1,"h#{ocnh}",node0 #FIX
- elsif ln==2 \
- or ln=~@md.lv2; ocnh2+=1
+ else
+ ocn_flag=false
+ node1="1:0;0"
+ end
+ document_structure_check_info(node1,node0)
+ @collapsed_lv1=1
+ collapsed_level=@collapsed_lv1
+ node,ocn_sp,parent=node1,"h#{ocnh}",node0 #FIX
+ elsif ln==2 \
+ or ln=~@md.lv2
+ if not dob.obj =~/~#|-#/
+ ocn_flag=true
+ ocnh2+=1
node2="2:#{ocnh2};#{ocn}"
- parent=if node1
- document_structure_check_info(node2,node1)
- @collapsed_lv2=@collapsed_lv1+1
- node1
- else
- document_structure_check_info(node2,node0,:error)
- node0
- end
- collapsed_level=@collapsed_lv2
- node,ocn_sp=node2,"h#{ocnh}"
- elsif ln==3 \
- or ln=~@md.lv3; ocnh3+=1
+ else
+ ocn_flag=false
+ node2="2:0;0"
+ end
+ parent=if node1
+ document_structure_check_info(node2,node1)
+ @collapsed_lv2=@collapsed_lv1+1
+ node1
+ else
+ document_structure_check_info(node2,node0,:error)
+ node0
+ end
+ collapsed_level=@collapsed_lv2
+ node,ocn_sp=node2,"h#{ocnh}"
+ elsif ln==3 \
+ or ln=~@md.lv3
+ if not dob.obj =~/~#|-#/
+ ocn_flag=true
+ ocnh3+=1
node3="3:#{ocnh3};#{ocn}"
- parent=if node2
- document_structure_check_info(node3,node2)
- @collapsed_lv3=@collapsed_lv2+1
- node2
- elsif node1
- warning_incorrect_parent_level_or_level(dob.obj)
- puts %{parent is :A~ & this level #{dob.lv}
+ else
+ ocn_flag=false
+ node3="3:0;0"
+ end
+ parent=if node2
+ document_structure_check_info(node3,node2)
+ @collapsed_lv3=@collapsed_lv2+1
+ node2
+ elsif node1
+ warning_incorrect_parent_level_or_level(dob.obj)
+ puts %{parent is :A~ & this level #{dob.lv}
either parent should be level :B~
or this level should be level :B~ rather than #{dob.lv}}
- document_structure_check_info(node3,node1,:error)
- @collapsed_lv3=@collapsed_lv1+1
- node1
- else
- document_structure_check_info(node3,node0,:error)
- warning_incorrect_parent_level_or_level(dob.obj)
- node0
- end
- collapsed_level=@collapsed_lv3
- node,ocn_sp=node3,"h#{ocnh}"
- elsif ln==4 \
- or ln=~@md.lv4; ocnh4+=1
+ document_structure_check_info(node3,node1,:error)
+ @collapsed_lv3=@collapsed_lv1+1
+ node1
+ else
+ document_structure_check_info(node3,node0,:error)
+ warning_incorrect_parent_level_or_level(dob.obj)
+ node0
+ end
+ collapsed_level=@collapsed_lv3
+ node,ocn_sp=node3,"h#{ocnh}"
+ elsif ln==4 \
+ or ln=~@md.lv4
+ if not dob.obj =~/~#|-#/
+ ocn_flag=true
+ ocnh4+=1
node4="4:#{ocnh4};#{ocn}"
- parent=if node3
- document_structure_check_info(node4,node3)
- @collapsed_lv4=@collapsed_lv3+1
- node3
- elsif node2
- document_structure_check_info(node4,node2)
- @collapsed_lv4=@collapsed_lv2+1
- node2
- elsif node1
- document_structure_check_info(node4,node1)
- @collapsed_lv4=@collapsed_lv1+1
- node1
- else
- warning_incorrect_parent_level_or_level(dob.obj)
- document_structure_check_info(node4,node0,:error)
- node0
- end
- collapsed_level=@collapsed_lv4
- node,ocn_sp=node4,"h#{ocnh}"
- elsif ln==5 \
- or ln=~@md.lv5; ocnh5+=1
+ else
+ ocn_flag=false
+ node4="4:0;0"
+ end
+ parent=if node3
+ document_structure_check_info(node4,node3)
+ @collapsed_lv4=@collapsed_lv3+1
+ node3
+ elsif node2
+ document_structure_check_info(node4,node2)
+ @collapsed_lv4=@collapsed_lv2+1
+ node2
+ elsif node1
+ document_structure_check_info(node4,node1)
+ @collapsed_lv4=@collapsed_lv1+1
+ node1
+ else
+ warning_incorrect_parent_level_or_level(dob.obj)
+ document_structure_check_info(node4,node0,:error)
+ node0
+ end
+ collapsed_level=@collapsed_lv4
+ node,ocn_sp=node4,"h#{ocnh}"
+ elsif ln==5 \
+ or ln=~@md.lv5
+ if not dob.obj =~/~#|-#/
+ ocn_flag=true
+ ocnh5+=1
node5="5:#{ocnh5};#{ocn}"
- parent=if node4
- document_structure_check_info(node5,node4)
- @collapsed_lv5=@collapsed_lv4+1
- node4
- elsif node3
- warning_incorrect_parent_level_or_level(dob.obj)
- document_structure_check_info(node5,node3,:error)
- @collapsed_lv5=@collapsed_lv3+1
- node3
- elsif node2
- warning_incorrect_parent_level_or_level(dob.obj)
- document_structure_check_info(node5,node2,:error)
- @collapsed_lv5=@collapsed_lv2+1
- node2
- elsif node1
- warning_incorrect_parent_level_or_level(dob.obj)
- document_structure_check_info(node5,node1,:error)
- @collapsed_lv5=@collapsed_lv1+1
- node1
- else
- document_structure_check_info(node5,node0,:error)
- node0
- end
- collapsed_level=@collapsed_lv5
- node,ocn_sp=node5,"h#{ocnh}"
- elsif ln==6 \
- or ln=~@md.lv6; ocnh6+=1
+ else
+ ocn_flag=false
+ node5="5:0;0"
+ end
+ parent=if node4
+ document_structure_check_info(node5,node4)
+ @collapsed_lv5=@collapsed_lv4+1
+ node4
+ elsif node3
+ warning_incorrect_parent_level_or_level(dob.obj)
+ document_structure_check_info(node5,node3,:error)
+ @collapsed_lv5=@collapsed_lv3+1
+ node3
+ elsif node2
+ warning_incorrect_parent_level_or_level(dob.obj)
+ document_structure_check_info(node5,node2,:error)
+ @collapsed_lv5=@collapsed_lv2+1
+ node2
+ elsif node1
+ warning_incorrect_parent_level_or_level(dob.obj)
+ document_structure_check_info(node5,node1,:error)
+ @collapsed_lv5=@collapsed_lv1+1
+ node1
+ else
+ document_structure_check_info(node5,node0,:error)
+ node0
+ end
+ collapsed_level=@collapsed_lv5
+ node,ocn_sp=node5,"h#{ocnh}"
+ elsif ln==6 \
+ or ln=~@md.lv6
+ if not dob.obj =~/~#|-#/
+ ocn_flag=true
+ ocnh6+=1
node6="6:#{ocnh6};#{ocn}"
- parent=if node5
- document_structure_check_info(node6,node5)
- @collapsed_lv6=@collapsed_lv5+1
- node5
- elsif node4
- warning_incorrect_parent_level_or_level(dob.obj)
- puts "parent is level 4~ & this level #{dob.lv}
+ else
+ ocn_flag=false
+ node6="6:0;0"
+ end
+ parent=if node5
+ document_structure_check_info(node6,node5)
+ @collapsed_lv6=@collapsed_lv5+1
+ node5
+ elsif node4
+ warning_incorrect_parent_level_or_level(dob.obj)
+ puts "parent is level 4~ & this level #{dob.lv}
either parent should be level 5~
or this level should be 5~ rather #{dob.lv}" #level 6
- document_structure_check_info(node6,node4,:error)
- @collapsed_lv6=@collapsed_lv4+1
- node4
- elsif node3
- warning_incorrect_parent_level_or_level(dob.obj)
- document_structure_check_info(node6,node3,:error)
- @collapsed_lv6=@collapsed_lv3+1
- node3
- elsif node2
- warning_incorrect_parent_level_or_level(dob.obj)
- document_structure_check_info(node6,node2,:error)
- @collapsed_lv6=@collapsed_lv2+1
- node2
- elsif node1
- warning_incorrect_parent_level_or_level(dob.obj)
- document_structure_check_info(node6,node1,:error)
- @collapsed_lv6=@collapsed_lv1+1
- node1
- else
- document_structure_check_info(node6,node0,:error)
- node0
- end
- collapsed_level=@collapsed_lv6
- node,ocn_sp=node6,"h#{ocnh}"
+ document_structure_check_info(node6,node4,:error)
+ @collapsed_lv6=@collapsed_lv4+1
+ node4
+ elsif node3
+ warning_incorrect_parent_level_or_level(dob.obj)
+ document_structure_check_info(node6,node3,:error)
+ @collapsed_lv6=@collapsed_lv3+1
+ node3
+ elsif node2
+ warning_incorrect_parent_level_or_level(dob.obj)
+ document_structure_check_info(node6,node2,:error)
+ @collapsed_lv6=@collapsed_lv2+1
+ node2
+ elsif node1
+ warning_incorrect_parent_level_or_level(dob.obj)
+ document_structure_check_info(node6,node1,:error)
+ @collapsed_lv6=@collapsed_lv1+1
+ node1
+ else
+ document_structure_check_info(node6,node0,:error)
+ node0
end
+ collapsed_level=@collapsed_lv6
+ node,ocn_sp=node6,"h#{ocnh}"
+ end
+ else
+ if not dob.obj =~/~#|-#/
+ ocn_flag=true
else
- ocno+=1
- if dob.is==:table
- ocnt+=1
- ocn_sp,parent="t#{ocnt}",node
- elsif dob.is==:code
- ocnc+=1
- ocn_sp,parent="c#{ocnc}",node
- elsif dob.is==:group \
- || dob.is==:block \
- || dob.is==:alt \
- || dob.is==:verse
- ocng+=1 #group, poem
- ocn_sp,parent="g#{ocng}",node
- elsif dob.is==:image #check
- ocni+=1
- ocn_sp,parent="i#{ocni}",node
- else ocnp+=1 #paragraph
- ocn_sp,parent="p#{ocnp}",node
- end
+ ocn_flag=false
end
- if dob.is==:heading
- dob.ln,dob.node,dob.ocn,dob.odv,dob.osp,dob.parent,dob.lc=ln,node,ocn,ocn_dv,ocn_sp,parent,collapsed_level
+ ocno+=1
+ if dob.is==:table
+ ocnt+=1
+ ocn_sp,parent="t#{ocnt}",node
+ elsif dob.is==:code
+ ocnc+=1
+ ocn_sp,parent="c#{ocnc}",node
+ elsif dob.is==:group \
+ || dob.is==:block \
+ || dob.is==:alt \
+ || dob.is==:verse
+ ocng+=1 #group, poem
+ ocn_sp,parent="g#{ocng}",node
+ elsif dob.is==:image #check
+ ocni+=1
+ ocn_sp,parent="i#{ocni}",node
+ else ocnp+=1 #paragraph
+ ocn_sp,parent="p#{ocnp}",node
+ end
+ end
+ if dob.is==:heading
+ if ocn_flag==true
+ dob.ln,dob.node,dob.ocn,dob.ocn_,dob.odv,dob.osp,dob.parent,dob.lc=ln,node,ocn,ocn_flag,ocn_dv,ocn_sp,parent,collapsed_level
else
- if dob.of !=:meta \
- && dob.of !=:comment \
- && dob.of !=:layout
- dob.ocn,dob.odv,dob.osp,dob.parent=ocn,ocn_dv,ocn_sp,parent
+ ocnu+=1
+ dob.obj=dob.obj.gsub(/#{Mx[:fa_o]}[~-]##{Mx[:fa_c]}/,'') if dob.obj
+ ocn_dv,ocn_sp="u#{ocnu}","u#{ocnu}"
+ dob.ln,dob.node,dob.ocn,dob.ocn_,dob.odv,dob.osp,dob.parent,dob.lc=ln,node,nil,ocn_flag,ocn_dv,ocn_sp,parent,collapsed_level
+ end
+ else
+ if dob.of !=:meta \
+ && dob.of !=:comment \
+ && dob.of !=:layout
+ if ocn_flag == true
+ dob.ocn,dob.ocn_,dob.odv,dob.osp,dob.parent=ocn,ocn_flag,ocn_dv,ocn_sp,parent
+ else
+ ocnu+=1
+ dob.obj=dob.obj.gsub(/#{Mx[:fa_o]}[~-]##{Mx[:fa_c]}/,'') if dob.obj
+ ocn_dv,ocn_sp="u#{ocnu}","u#{ocnu}"
+ dob.ocn,dob.ocn_,dob.odv,dob.osp,dob.parent=nil,ocn_flag,ocn_dv,ocn_sp,parent
end
end
- else ocnu+=1
- dob.obj=dob.obj.gsub(/#{Mx[:fa_o]}~##{Mx[:fa_c]}/,'') if dob.obj
- ocn_dv,ocn_sp="u#{ocnu}","u#{ocnu}"
- dob.ocn,dob.odv,dob.osp=ocn,ocn_dv,ocn_sp
end
h
elsif dob.obj=~/#{Mx[:pa_non_object_no_heading]}/
dob.obj=dob.obj.gsub(/#{Mx[:pa_non_object_no_heading]}/,'')
if dob.is==:para
h={ obj: dob.obj, ocn_: false, ocn: nil, hang: dob.hang, indent: dob.indent, bullet_: dob.bullet_, tags: dob.tags, parent: dob.parent }
- dob=SiSU_DAL_DocumentStructure::ObjectPara.new.paragraph(h,dob)
+ dob=SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h,dob)
elsif dob.is==:heading
h={ obj: dob.obj, ocn_: false, ocn: nil, toc_: true, parent: dob.parent }
- dob=SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h,dob)
+ dob=SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,dob)
end
elsif dob.obj=~/#{Mx[:pa_non_object_dummy_heading]}/
dob.obj=dob.obj.gsub(/#{Mx[:pa_non_object_dummy_heading]}/,'')
if dob.is==:para
h={ obj: dob.obj, ocn_: false, ocn: nil, hang: dob.hang, indent: dob.indent, bullet_: dob.bullet_, tags: dob.tags, parent: dob.parent }
- dob=SiSU_DAL_DocumentStructure::ObjectPara.new.paragraph(h,dob)
+ dob=SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h,dob)
elsif dob.is==:heading
h={ obj: dob.obj, ocn_: false, ocn: nil, toc_: false, parent: dob.parent }
- dob=SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h,dob)
+ dob=SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,dob)
end
else dob
end
@@ -1198,7 +1255,7 @@ or this level should be 5~ rather #{dob.lv}" #level 6
when '6'; 9
end
h={ tag: tag, node: o[:node], lv: o[:lv], ln: ln, status: o[:status] }
- SiSU_DAL_DocumentStructure::ObjectStructure.new.xml_dom(h) #downstream code utilise else ignore like comments
+ SiSU_AO_DocumentStructure::ObjectStructure.new.xml_dom(h) #downstream code utilise else ignore like comments
end
def tag_open(o,tag)
t={ lv: tag[o.ln], node: o.node, status: 'open' }
diff --git a/lib/sisu/v5/dal_endnotes.rb b/lib/sisu/v5/ao_endnotes.rb
index 407dc1ff..981c97f6 100644
--- a/lib/sisu/v5/dal_endnotes.rb
+++ b/lib/sisu/v5/ao_endnotes.rb
@@ -50,7 +50,7 @@
* Git
<http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/dal_doc_endnotes.rb;hb=HEAD>
+ <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/ao_doc_endnotes.rb;hb=HEAD>
* Ralph Amissah
<ralph@amissah.com>
@@ -59,7 +59,7 @@
** Description: system environment, resource control and configuration details
=end
-module SiSU_DAL_Endnotes
+module SiSU_AO_Endnotes
class Endnotes
def initialize(md,data,endnote_array=nil)
@md,@data,@endnote_array=md,data,endnote_array
@@ -82,7 +82,7 @@ module SiSU_DAL_Endnotes
&& dob.is !=:code
case dob.obj # auto-numbered endnotes <!e!> <!e_!> -->
when /#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}[*+]\s+.+?#{Mx[:en_b_c]}/
- dob.obj=dob.obj.gsub(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/,' \1') # required 2003w31
+ dob.obj=dob.obj.gsub(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/,'\1')
word_mode=dob.obj.scan(/\S+/m)
word_mode=endnote_call_number(word_mode)
dob.obj=word_mode.join(' ')
diff --git a/lib/sisu/v5/dal_expand_insertions.rb b/lib/sisu/v5/ao_expand_insertions.rb
index e43dd3af..44ae1f60 100644
--- a/lib/sisu/v5/dal_expand_insertions.rb
+++ b/lib/sisu/v5/ao_expand_insertions.rb
@@ -50,7 +50,7 @@
* Git
<http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/dal_expand_insertions.rb;hb=HEAD>
+ <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/ao_expand_insertions.rb;hb=HEAD>
* Ralph Amissah
<ralph@amissah.com>
@@ -59,7 +59,7 @@
** Description: system environment, resource control and configuration details
=end
-module SiSU_DAL_Insertions
+module SiSU_AO_Insertions
class Insertions
def initialize(md,data)
@md,@data=md,data
diff --git a/lib/sisu/v5/dal_hash_digest.rb b/lib/sisu/v5/ao_hash_digest.rb
index 9f620aa2..e1cc840c 100644
--- a/lib/sisu/v5/dal_hash_digest.rb
+++ b/lib/sisu/v5/ao_hash_digest.rb
@@ -50,7 +50,7 @@
* Git
<http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/dal_hash_digest.rb;hb=HEAD>
+ <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/ao_hash_digest.rb;hb=HEAD>
* Ralph Amissah
<ralph@amissah.com>
@@ -59,7 +59,7 @@
** Description: system environment, resource control and configuration details
=end
-module SiSU_DAL_Hash
+module SiSU_AO_Hash
require_relative 'shared_markup_alt.rb' #shared_markup_alt.rb
class ObjectDigest
def initialize(md,data,env=nil)
@@ -96,7 +96,7 @@ module SiSU_DAL_Hash
end
end
@tuned_file=@tuned_file.flatten
- #use md5 or to create hash of each dal object including ocn, & add into to each dal object
+ #use md5 or to create hash of each ao object including ocn, & add into to each ao object
end
def endnote_digest(data)
t_o_bit=[]
@@ -143,7 +143,7 @@ module SiSU_DAL_Hash
end
t_o #KEEP intact
end
- def strip_clean_extra_spaces(s) # dal output tuned
+ def strip_clean_extra_spaces(s) # ao output tuned
s=s.dup
s=s.gsub(/[ ]+([,.;:?](?:$|\s))/,'\1') unless s =~/#{Mx[:en_a_o]}|#{Mx[:en_b_o]}/
s=s.gsub(/ [ ]+/,' ').
diff --git a/lib/sisu/v5/dal_idx.rb b/lib/sisu/v5/ao_idx.rb
index be8a0211..94e3aff6 100644
--- a/lib/sisu/v5/dal_idx.rb
+++ b/lib/sisu/v5/ao_idx.rb
@@ -50,7 +50,7 @@
* Git
<http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/dal_idx.rb;hb=HEAD>
+ <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/ao_idx.rb;hb=HEAD>
* Ralph Amissah
<ralph@amissah.com>
@@ -59,7 +59,7 @@
** Description: system environment, resource control and configuration details
=end
-module SiSU_DAL_BookIndex
+module SiSU_AO_BookIndex
class BookIndex
def initialize(md,data,env=nil)
@md,@data,@env=md,data,env
@@ -138,15 +138,15 @@ module SiSU_DAL_BookIndex
idx={}
idx[:sst_rel_html_seg],idx[:sst_rel],idx[:html],idx[:xhtml]=[],[],[],[]
h={obj: Mx[:br_page]}
- o=SiSU_DAL_DocumentStructure::ObjectLayout.new.break(h)
+ o=SiSU_AO_DocumentStructure::ObjectLayout.new.break(h)
idx[:sst_rel_html_seg] << o
idx[:sst_rel] << o
h={lv: '2', name: 'index', obj: "Index"}
- o=SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h)
+ o=SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h)
idx[:sst_rel_html_seg] << o
idx[:sst_rel] << o
h={lv: '4', name: 'idx', obj: " [Index] #{Mx[:pa_non_object_dummy_heading]}"}
- o=SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h)
+ o=SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h)
idx[:sst_rel_html_seg] << o
idx[:sst_rel] << o
alph=%W[9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z]
diff --git a/lib/sisu/v5/dal_images.rb b/lib/sisu/v5/ao_images.rb
index 33a5e627..4354dfa9 100644
--- a/lib/sisu/v5/dal_images.rb
+++ b/lib/sisu/v5/ao_images.rb
@@ -50,7 +50,7 @@
* Git
<http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/dal_images.rb;hb=HEAD>
+ <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/ao_images.rb;hb=HEAD>
* Ralph Amissah
<ralph@amissah.com>
@@ -59,7 +59,7 @@
** Description: system environment, resource control and configuration details
=end
-module SiSU_DAL_Images
+module SiSU_AO_Images
class Images
#require 'RMagick'
#include Magick
diff --git a/lib/sisu/v5/dal_metadata.rb b/lib/sisu/v5/ao_metadata.rb
index 1fa5619c..8d017769 100644
--- a/lib/sisu/v5/dal_metadata.rb
+++ b/lib/sisu/v5/ao_metadata.rb
@@ -50,7 +50,7 @@
* Git
<http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/dal_metadata.rb;hb=HEAD>
+ <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/ao_metadata.rb;hb=HEAD>
* Ralph Amissah
<ralph@amissah.com>
@@ -59,7 +59,7 @@
** Description: system environment, resource control and configuration details
=end
-module SiSU_DAL_Metadata
+module SiSU_AO_Metadata
class Metadata
def initialize(md,metad)
@md,@metadata=md,metad
@@ -69,11 +69,11 @@ module SiSU_DAL_Metadata
end
def make_para(obj,ocn)
h={ obj: obj, ocn: 0 }
- SiSU_DAL_DocumentStructure::ObjectPara.new.paragraph(h)
+ SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h)
end
def make_heading(obj,ocn,name,lv,ln)
h={ lv: lv, ln: ln, name: name, obj: obj, ocn: 0 }
- SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h)
+ SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h)
end
def metadata
end
diff --git a/lib/sisu/v5/dal_misc_arrange.rb b/lib/sisu/v5/ao_misc_arrange.rb
index e6cc72db..8f7acbc4 100644
--- a/lib/sisu/v5/dal_misc_arrange.rb
+++ b/lib/sisu/v5/ao_misc_arrange.rb
@@ -50,7 +50,7 @@
* Git
<http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/dal_misc_arrange.rb;hb=HEAD>
+ <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/ao_misc_arrange.rb;hb=HEAD>
* Ralph Amissah
<ralph@amissah.com>
@@ -59,7 +59,7 @@
** Description: system environment, resource control and configuration details
=end
-module SiSU_DAL_MiscArrangeText
+module SiSU_AO_MiscArrangeText
class SI
def initialize(md,data)
@md,@data=md,data
diff --git a/lib/sisu/v5/dal_numbering.rb b/lib/sisu/v5/ao_numbering.rb
index 96f4134b..00afdfa5 100644
--- a/lib/sisu/v5/dal_numbering.rb
+++ b/lib/sisu/v5/ao_numbering.rb
@@ -50,7 +50,7 @@
* Git
<http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/dal_numbering.rb;hb=HEAD>
+ <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/ao_numbering.rb;hb=HEAD>
* Ralph Amissah
<ralph@amissah.com>
@@ -59,7 +59,7 @@
** Description: system environment, resource control and configuration details
=end
-module SiSU_DAL_Numbering
+module SiSU_AO_Numbering
class Numbering
attr_accessor :obj,:osp,:ocn,:lv,:name,:index,:comment
def initialize(md,data)
@@ -142,7 +142,7 @@ module SiSU_DAL_Numbering
data=data.compact
data.each do |dob| #@md.seg_names << [additions to segment names]
title_no=nil
- dob=SiSU_DAL_DocumentStructureExtract::Structure.new(@md,dob).structure_markup #must happen earlier, node info etc. require
+ dob=SiSU_AO_DocumentStructureExtract::Structure.new(@md,dob).structure_markup #must happen earlier, node info etc. require
if dob.is ==:heading \
&& dob.autonum_ \
and defined? @md.make.num_top \
@@ -232,11 +232,11 @@ module SiSU_DAL_Numbering
@tuned_file=@tuned_file.flatten
end
def ocn(data) #and auto segment numbering increment
- @tuned_file=SiSU_DAL_DocumentStructureExtract::OCN.new(@md,data).ocn
+ @tuned_file=SiSU_AO_DocumentStructureExtract::OCN.new(@md,data).ocn
@tuned_file
end
def xml(data)
- @tuned_file=SiSU_DAL_DocumentStructureExtract::XML.new(@md,data).dom
+ @tuned_file=SiSU_AO_DocumentStructureExtract::XML.new(@md,data).dom
@tuned_file
end
def minor_numbering(data) #and auto segment numbering increment
@@ -354,11 +354,11 @@ module SiSU_DAL_Numbering
m=dob.ln.to_s
dob_tmp=[]
if @md.pagenew.inspect =~/#{m}/
- dob_tmp << SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_new]) << dob
+ dob_tmp << SiSU_AO_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_new]) << dob
elsif @md.pagebreak.inspect =~/#{m}/
- dob_tmp << SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page]) << dob
+ dob_tmp << SiSU_AO_DocumentStructure::ObjectLayout.new.break(Hx[:br_page]) << dob
elsif @md.pageline.inspect =~/#{m}/
- dob_tmp << SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_line]) << dob
+ dob_tmp << SiSU_AO_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_line]) << dob
end
unless dob_tmp.length > 0; dob
else dob_tmp
diff --git a/lib/sisu/v5/dal_syntax.rb b/lib/sisu/v5/ao_syntax.rb
index 1e1d8542..22e0124c 100644
--- a/lib/sisu/v5/dal_syntax.rb
+++ b/lib/sisu/v5/ao_syntax.rb
@@ -50,7 +50,7 @@
* Git
<http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/dal_syntax.rb;hb=HEAD>
+ <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/ao_syntax.rb;hb=HEAD>
* Ralph Amissah
<ralph@amissah.com>
@@ -59,7 +59,7 @@
** Description: Syntax for markup, input markup syntaxes, determined here
=end
-module SiSU_DAL_Syntax
+module SiSU_AO_Syntax
class Words
def initialize(line,md,mkp)
@line,@md,@mkp=line,md,mkp
diff --git a/lib/sisu/v5/concordance.rb b/lib/sisu/v5/concordance.rb
index 3ad394c7..3bb313d4 100644
--- a/lib/sisu/v5/concordance.rb
+++ b/lib/sisu/v5/concordance.rb
@@ -113,8 +113,8 @@ module SiSU_Concordance
private
class DocTitle
include SiSU_Viz
- #revisit, both requires (html & shared_xml) needed for stand alone operation (sisu -w [filename])
- require_relative 'shared_xml' # shared_xml.rb
+ #revisit, both requires (html & xml_shared) needed for stand alone operation (sisu -w [filename])
+ require_relative 'xml_shared' # xml_shared.rb
require_relative 'html' # html.rb
def initialize(particulars)
@particulars,@md=particulars,particulars.md
@@ -202,7 +202,7 @@ WOK
def initialize(particulars)
@particulars=particulars
begin
- @env,@md,@dal_array=particulars.env,particulars.md,particulars.dal_array
+ @env,@md,@ao_array=particulars.env,particulars.md,particulars.ao_array
@file=SiSU_Env::FileOp.new(@md)
@freq=Hash.new(0)
@dp=@@dp ||=SiSU_Env::InfoEnv.new.digest.pattern
@@ -256,7 +256,7 @@ WOK
def map_para
@seg,ocn=nil,nil
@word_map={}
- @dal_array.each do |line|
+ @ao_array.each do |line|
if defined? line.ocn \
and line.ocn.to_s =~/\d/
if (line.is ==:heading \
diff --git a/lib/sisu/v5/conf.rb b/lib/sisu/v5/conf.rb
index 9418ff21..57e9614b 100644
--- a/lib/sisu/v5/conf.rb
+++ b/lib/sisu/v5/conf.rb
@@ -161,7 +161,7 @@ module SiSU_Initialize
end
def trang_rnc_model_output_sax
s=@suffix
- rnc_src=@env.processing_path.dal + '/sax.' + s[:rnc]
+ rnc_src=@env.processing_path.ao + '/sax.' + s[:rnc]
rnc_file=@path[:rnc] + '/' + @rxng.rnc_name.output_sax
rng_file=@path[:rng] + '/' + @rxng.rng_name.output_sax
xsd_file=@path[:xsd] + '/' + @rxng.xsd_name.output_sax
@@ -183,7 +183,7 @@ module SiSU_Initialize
end
def trang_rnc_model_output_dom
s=@suffix
- rnc_src=@env.processing_path.dal + '/dom.' + s[:rnc]
+ rnc_src=@env.processing_path.ao + '/dom.' + s[:rnc]
rnc_file=@path[:rnc] + '/' + @rxng.rnc_name.output_dom
rng_file=@path[:rng] + '/' + @rxng.rng_name.output_dom
xsd_file=@path[:xsd] + '/' + @rxng.xsd_name.output_dom
@@ -205,7 +205,7 @@ module SiSU_Initialize
end
def trang_rnc_model_output_xhtml
s=@suffix
- rnc_src=@env.processing_path.dal + '/xhtml.' + s[:rnc]
+ rnc_src=@env.processing_path.ao + '/xhtml.' + s[:rnc]
rnc_file=@path[:rnc] + '/' + @rxng.rnc_name.output_xhtml
rng_file=@path[:rng] + '/' + @rxng.rng_name.output_xhtml
xsd_file=@path[:xsd] + '/' + @rxng.xsd_name.output_xhtml
@@ -226,7 +226,7 @@ module SiSU_Initialize
end
end
def trang_rnc_model_input_sax
- rnc_file=@env.processing_path.dal + '/sax.rnc'
+ rnc_file=@env.processing_path.ao + '/sax.rnc'
dtd_file=@path[:xsd] + '/' + @rxng.rng_name.input_sax
rnc=File.new(rnc_file,'w')
rnc << @rxng.rnc_model_output_sax
@@ -235,7 +235,7 @@ module SiSU_Initialize
schema.relaxng(@opt.cmd)
end
def trang_rnc_model_input_dom
- rnc_file=@env.processing_path.dal + '/dom.rnc'
+ rnc_file=@env.processing_path.ao + '/dom.rnc'
dtd_file=@path[:xsd] + '/' + @rxng.rng_name.input_dom
rnc=File.new(rnc_file,'w')
rnc << @rxng.rnc_model_output_dom
@@ -244,7 +244,7 @@ module SiSU_Initialize
schema.relaxng(@opt.cmd)
end
def trang_rnc_model_input_node
- rnc_file=@env.processing_path.dal + '/node.rnc'
+ rnc_file=@env.processing_path.ao + '/node.rnc'
dtd_file=@path[:xsd] + '/' + @rxng.rng_name.input_node
rnc=File.new(rnc_file,'w')
rnc << @rxng.rnc_model_input_node
diff --git a/lib/sisu/v5/constants.rb b/lib/sisu/v5/constants.rb
index a21f01b7..da9858f2 100644
--- a/lib/sisu/v5/constants.rb
+++ b/lib/sisu/v5/constants.rb
@@ -64,6 +64,10 @@
YEAR='2013'
Sfx={
txt: '.txt',
+ txt_textile: '.textile',
+ txt_asciidoc: '.asciidoc.txt',
+ txt_markdown: '.md',
+ txt_rst: '.rst',
html: '.html',
xhtml: '.xhtml',
xml: '.xml',
@@ -72,6 +76,10 @@ Sfx={
xml_scaffold: '.scaffold.xml',
xml_scaffold_structure_sisu: '.scaffold.sisu.xml',
xml_scaffold_structure_collapse: '.scaffold.collapse.xml',
+ 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/db_import.rb b/lib/sisu/v5/db_import.rb
index 6edb0f99..dc73bbf5 100644
--- a/lib/sisu/v5/db_import.rb
+++ b/lib/sisu/v5/db_import.rb
@@ -64,7 +64,7 @@ module SiSU_DbImport
require_relative 'db_columns' # db_columns.rb
require_relative 'db_load_tuple' # db_load_tuple.rb
require_relative 'db_sqltxt' # db_sqltxt.rb
- require_relative 'shared_html_lite' # shared_html_lite.rb
+ require_relative 'html_lite_shared' # html_lite_shared.rb
require 'sqlite3'
class Import < SiSU_DbText::Prepare
include SiSU_Param
@@ -76,7 +76,7 @@ module SiSU_DbImport
@opt,@conn,@file_maint,@sql_type=opt,conn,file_maint,sql_type
@cX=SiSU_Screen::Ansi.new(@opt.act[:color_state][:set]).cX
@env=SiSU_Env::InfoEnv.new(@opt.fns)
- @dal="#{@env.processing_path.dal}"
+ @dal="#{@env.processing_path.ao}"
@fnb=if @opt.fns.empty? \
or @opt.cmd.empty?
''
@@ -121,8 +121,8 @@ module SiSU_DbImport
@@dl ||=SiSU_Env::InfoEnv.new.digest.length
end
def marshal_load
- require_relative 'dal' # dal.rb
- @dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here
+ require_relative 'ao' # ao.rb
+ @ao_array=SiSU_AO::Source.new(@opt).get # ao file drawn here
if (@opt.act[:verbose][:set]==:on \
|| @opt.act[:verbose_plus][:set]==:on \
|| @opt.act[:maintenance][:set]==:on)
@@ -142,8 +142,8 @@ module SiSU_DbImport
if not file_exist
t_d=[] # transaction_data
t_d << db_import_metadata
- t_d << db_import_documents(@dal_array)
- t_d << db_import_urls(@dal_array,@fnc) #import OID on/off
+ t_d << db_import_documents(@ao_array)
+ t_d << db_import_urls(@ao_array,@fnc) #import OID on/off
t_d=t_d.flatten
if (@opt.act[:verbose_plus][:set]==:on \
|| @opt.act[:maintenance][:set]==:on)
@@ -283,12 +283,12 @@ module SiSU_DbImport
tuple=t.tuple
tuple
end
- def db_import_documents(dal_array) #% import documents - populate main database table, import into substantive database tables (tuple)
+ def db_import_documents(ao_array) #% import documents - populate main database table, import into substantive database tables (tuple)
begin
@col[:tid]=@@id_t
@en,@en_ast,@en_pls,@tuple_array=[],[],[],[]
@col[:en_a],@col[:en_z]=nil,nil
- dal_array.each do |data|
+ ao_array.each do |data|
data.obj.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\1')
data.obj.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\1')
data.obj.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\1')
diff --git a/lib/sisu/v5/dbi.rb b/lib/sisu/v5/dbi.rb
index e59a09b7..6a40d3ce 100644
--- a/lib/sisu/v5/dbi.rb
+++ b/lib/sisu/v5/dbi.rb
@@ -66,7 +66,7 @@ module SiSU_DBI
include SiSU_Param
require_relative 'db_dbi' # db_dbi.rb
include SiSU_DbDBI
- require_relative 'shared_html_lite' # shared_html_lite.rb
+ require_relative 'html_lite_shared' # html_lite_shared.rb
include SiSU_FormatShared
class SQL
def initialize(opt)
diff --git a/lib/sisu/v5/dbi_discrete.rb b/lib/sisu/v5/dbi_discrete.rb
index 957009b1..95fb9ce3 100644
--- a/lib/sisu/v5/dbi_discrete.rb
+++ b/lib/sisu/v5/dbi_discrete.rb
@@ -66,7 +66,7 @@ module SiSU_DBI_Discrete #% database building
include SiSU_Param
require_relative 'db_dbi' # db_dbi.rb
include SiSU_DbDBI
- require_relative 'shared_html_lite' # shared_html_lite.rb
+ require_relative 'html_lite_shared' # html_lite_shared.rb
include SiSU_FormatShared
require 'fileutils'
include FileUtils::Verbose
diff --git a/lib/sisu/v5/digests.rb b/lib/sisu/v5/digests.rb
index e142ff11..0afa7378 100644
--- a/lib/sisu/v5/digests.rb
+++ b/lib/sisu/v5/digests.rb
@@ -75,7 +75,7 @@ module SiSU_DigestView
end
def read
begin
- @env,@md,@dal_array=@particulars.env,@particulars.md,@particulars.dal_array
+ @env,@md,@ao_array=@particulars.env,@particulars.md,@particulars.ao_array
unless @opt.act[:quiet][:set]==:on
tool=(@opt.act[:verbose][:set]==:on \
|| @opt.act[:verbose_plus][:set]==:on \
@@ -107,7 +107,7 @@ module SiSU_DigestView
@@description,@@ds[:digests],@@ds[:tree],@@ds[:summary],@@sc_info=[],[],[],[],[]
def initialize(particulars) #data='',md='')
@particulars=particulars
- @data,@env,@md=@particulars.dal_array,@particulars.env,@particulars.md
+ @data,@env,@md=@particulars.ao_array,@particulars.env,@particulars.md
SiSU_Env::FileOp.new(@md).mkdir
@@dg ||=@env.digest.type
@@dl ||=@env.digest.length
@@ -120,7 +120,7 @@ module SiSU_DigestView
def songsheet
@@description,@@ds[:digests],@@ds[:tree],@@ds[:summary],@@sc_info=[],[],[],[],[]
message_digest
- dal_structure
+ ao_structure
supplementary
output
end
@@ -132,11 +132,11 @@ module SiSU_DigestView
puts f if @md.opt.act[:verbose_plus][:set]==:on
@@ds[:digests] << f + "\n"
end
- def dal_structure_tree(f,e='')
+ def ao_structure_tree(f,e='')
puts f + e.to_s if @md.opt.act[:verbose_plus][:set]==:on
@@ds[:tree] << f << e
end
- def dal_structure_summary(f,e='')
+ def ao_structure_summary(f,e='')
puts f + e.to_s if @md.opt.act[:verbose_plus][:set]==:on
@@ds[:summary] << f << e
end
@@ -302,7 +302,7 @@ module SiSU_DigestView
description("Document Digests\n")
description(a)
end
- def dal_structure
+ def ao_structure
data=@data
endnotes=nil
data.each do |t_o|
@@ -330,8 +330,8 @@ module SiSU_DigestView
end
l=Hash.new(0)
ocn=nil
- dal_structure_tree("------------\n")
- dal_structure_tree("document structure[*]\n")
+ ao_structure_tree("------------\n")
+ ao_structure_tree("document structure[*]\n")
data.each do |t_o|
if t_o.is==:heading
x=case t_o.ln
@@ -351,11 +351,11 @@ module SiSU_DigestView
end
end
ocn=t_o.ocn if defined? t_o.ocn and t_o.is !=:heading_insert
- dal_structure_tree("#{x}\n") if x and not x.empty?
+ ao_structure_tree("#{x}\n") if x and not x.empty?
end
- dal_structure_tree(" [*] heading levels\n")
- dal_structure_summary("------------\n")
- dal_structure_summary("document structure[*]\n")
+ ao_structure_tree(" [*] heading levels\n")
+ ao_structure_summary("------------\n")
+ ao_structure_summary("document structure[*]\n")
[0,1,2,3,4,5,6].each do |y|
v=case y
when 1; ':A'
@@ -365,11 +365,11 @@ module SiSU_DigestView
when 5; '2 '
when 6; '3 '
end
- dal_structure_summary("#{v} = #{l[y]}\n") if l[y] > 0
+ ao_structure_summary("#{v} = #{l[y]}\n") if l[y] > 0
end
- dal_structure_summary("objects (ocn) = #{ocn}\n")
- dal_structure_summary("endnotes = #{endnotes}\n")
- dal_structure_summary(" [*] number of headers (@) and of each heading level (:A to :C and 1 to 3)\n")
+ ao_structure_summary("objects (ocn) = #{ocn}\n")
+ ao_structure_summary("endnotes = #{endnotes}\n")
+ ao_structure_summary(" [*] number of headers (@) and of each heading level (:A to :C and 1 to 3)\n")
end
def supplementary
if defined? @md.sc_number \
diff --git a/lib/sisu/v5/git.rb b/lib/sisu/v5/git.rb
index 92322b7c..7a69a187 100644
--- a/lib/sisu/v5/git.rb
+++ b/lib/sisu/v5/git.rb
@@ -62,7 +62,7 @@
module SiSU_Git
require_relative 'param' # param.rb
require_relative 'sysenv' # sysenv.rb
- require_relative 'dal' # dal.rb
+ require_relative 'ao' # ao.rb
class Source
def initialize(opt)
@opt=opt
@@ -93,7 +93,7 @@ module SiSU_Git
video: git_path_fnb + '/' + Gt[:sisupod] + '/' + Gt[:video],
conf: git_path_fnb + '/' + Gt[:sisupod] + '/' + Gt[:conf]
}
- SiSU_DAL::Source.new(@opt).read # -m
+ SiSU_AO::Source.new(@opt).read # -m
end
def create_file_structure_git
make_dir_fnb
@@ -190,9 +190,9 @@ module SiSU_Git
def locate_parse_file
composite_src=@opt.fns=~/\.ssm$/ ? true : false
if composite_src \
- and not @opt.act[:dal][:set]==:on
+ and not @opt.act[:ao][:set]==:on
##SiSU_Assemble::Composite.new(@opt).read
- #SiSU_DAL::Source.new(@opt).read # -m
+ #SiSU_AO::Source.new(@opt).read # -m
"#{@env.processing_path.composite_file}/#{@opt.fnb}.ssm.sst"
elsif composite_src
"#{@env.processing_path.composite_file}/#{@opt.fnb}.ssm.sst"
diff --git a/lib/sisu/v5/html.rb b/lib/sisu/v5/html.rb
index f1abe6c0..7a1c4b60 100644
--- a/lib/sisu/v5/html.rb
+++ b/lib/sisu/v5/html.rb
@@ -162,8 +162,8 @@ module SiSU_HTML
end
def tuned_file_instructions
@tell=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set])
- dal_array=@particulars.dal_array # dal file drawn here
- tuned_file_array=SiSU_HTML_Tune::Tune.new(dal_array,@md).songsheet
+ ao_array=@particulars.ao_array # ao file drawn here
+ tuned_file_array=SiSU_HTML_Tune::Tune.new(ao_array,@md).songsheet
tuned_file_array
end
end
diff --git a/lib/sisu/v5/html_format.rb b/lib/sisu/v5/html_format.rb
index c087f1ec..db9fb449 100644
--- a/lib/sisu/v5/html_format.rb
+++ b/lib/sisu/v5/html_format.rb
@@ -93,7 +93,7 @@ module SiSU_HTML_Format
end
class HeadInformation
require_relative 'css' # css.rb
- require_relative 'shared_xml' # shared_xml.rb
+ require_relative 'xml_shared' # xml_shared.rb
include SiSU_Viz
attr_reader :md,:rdf,:vz
def initialize(md)
@@ -904,7 +904,7 @@ WOK
@lnk_url =t_o[:lnk_url] || nil
@lnk_txt =t_o[:lnk_txt] || nil
@format =t_o[:format] || nil
- elsif t_o.class.inspect =~/^(?:#<)?SiSU_DAL_DocumentStructure/
+ elsif t_o.class.inspect =~/^(?:#<)?SiSU_AO_DocumentStructure/
@dob=t_o if defined? t_o.is
@named=nametags_seg(@dob)
@txt=((defined? t_o.obj) ? t_o.obj : nil)
diff --git a/lib/sisu/v5/shared_html_lite.rb b/lib/sisu/v5/html_lite_shared.rb
index e46510ea..20e07f8c 100644
--- a/lib/sisu/v5/shared_html_lite.rb
+++ b/lib/sisu/v5/html_lite_shared.rb
@@ -50,7 +50,7 @@
* Git
<http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/shared_html_lite.rb;hb=HEAD>
+ <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/html_lite_shared.rb;hb=HEAD>
* Ralph Amissah
<ralph@amissah.com>
diff --git a/lib/sisu/v5/html_scroll.rb b/lib/sisu/v5/html_scroll.rb
index 3ac75aaa..f525b462 100644
--- a/lib/sisu/v5/html_scroll.rb
+++ b/lib/sisu/v5/html_scroll.rb
@@ -60,7 +60,7 @@
=end
module SiSU_HTML_Scroll
- require_relative 'shared_html' # shared_html.rb
+ require_relative 'html_shared' # html_shared.rb
require_relative 'html' # html.rb
require_relative 'shared_metadata' # shared_metadata.rb
require_relative 'html_promo' # html_promo.rb
diff --git a/lib/sisu/v5/html_segments.rb b/lib/sisu/v5/html_segments.rb
index 79dda0e2..d6b341ac 100644
--- a/lib/sisu/v5/html_segments.rb
+++ b/lib/sisu/v5/html_segments.rb
@@ -60,7 +60,7 @@
=end
module SiSU_HTML_Seg
- require_relative 'shared_html' # shared_html.rb
+ require_relative 'html_shared' # html_shared.rb
require_relative 'html' # html.rb
require_relative 'html_promo' # html_promo.rb
require_relative 'shared_metadata' # shared_metadata.rb
diff --git a/lib/sisu/v5/shared_html.rb b/lib/sisu/v5/html_shared.rb
index 84c89ecf..63a8964e 100644
--- a/lib/sisu/v5/shared_html.rb
+++ b/lib/sisu/v5/html_shared.rb
@@ -50,7 +50,7 @@
* Git
<http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/shared_html.rb;hb=HEAD>
+ <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/html_shared.rb;hb=HEAD>
* Ralph Amissah
<ralph@amissah.com>
diff --git a/lib/sisu/v5/hub.rb b/lib/sisu/v5/hub.rb
index 2e9092ff..f09bd832 100644
--- a/lib/sisu/v5/hub.rb
+++ b/lib/sisu/v5/hub.rb
@@ -280,14 +280,14 @@ module SiSU
Dir.chdir(@opt.pth) #watch
end
@env=SiSU_Env::InfoEnv.new(@opt.fns)
- if @opt.act[:dal][:set]==:on #% --dal, -m
+ if @opt.act[:ao][:set]==:on #% --ao --dal, -m
unless @opt.act[:po4a][:set]==:on # --po4a, -P
if @opt.fno =~ /\.ssm$/
require_relative 'composite' # composite.rb #pre-processing
SiSU_Assemble::Composite.new(@opt).read
end
- require_relative 'dal' # -m dal.rb
- SiSU_DAL::Source.new(@opt).read
+ require_relative 'ao' # -m ao.rb
+ SiSU_AO::Source.new(@opt).read
end
end
if @opt.act[:qrcode][:set]==:on #% --qrcode, -Q
@@ -299,8 +299,24 @@ module SiSU
SiSU_DigestView::Source.new(@opt).read
end
if @opt.act[:txt][:set]==:on #% --txt, -t -a
- require_relative 'plaintext' # plaintext.rb
- SiSU_Plaintext::Source.new(@opt).read
+ require_relative 'txt_plain' # txt_plain.rb
+ SiSU_Txt_Plain::Source.new(@opt).read
+ end
+ if @opt.act[:txt_textile][:set]==:on #% --textile
+ require_relative 'txt_textile' # txt_textile.rb
+ SiSU_Txt_Textile::Source.new(@opt).read
+ end
+ if @opt.act[:txt_asciidoc][:set]==:on #% --asciidoc
+ require_relative 'txt_asciidoc' # txt_asciidoc.rb
+ SiSU_Txt_asciiDoc::Source.new(@opt).read
+ end
+ if @opt.act[:txt_markdown][:set]==:on #% --markdown
+ require_relative 'txt_markdown' # txt_markdown.rb
+ SiSU_Txt_Markdown::Source.new(@opt).read
+ end
+ if @opt.act[:txt_rst][:set]==:on #% --rst, --rest
+ require_relative 'txt_rst' # txt_rst.rb
+ SiSU_Txt_rST::Source.new(@opt).read
end
if @opt.act[:html][:set]==:on #% --html, -h -H
require_relative 'html' # html.rb
@@ -320,12 +336,12 @@ module SiSU
SiSU_Concordance::Source.new(@opt).read
end
if @opt.act[:epub][:set]==:on #% --epub, -e
- require_relative 'epub' # epub.rb
- SiSU_EPUB::Source.new(@opt).read
+ require_relative 'xhtml_epub2' # xhtml_epub2.rb
+ SiSU_XHTML_EPUB2::Source.new(@opt).read
end
if @opt.act[:odt][:set]==:on #% --odt, -o opendocument
- require_relative 'odf' # odf.rb
- SiSU_ODF::Source.new(@opt).read
+ require_relative 'xml_odf_odt' # xml_odf_odt.rb
+ SiSU_XML_ODF_ODT::Source.new(@opt).read
end
if @opt.act[:xhtml][:set]==:on #% --xhtml, -b xhtml
require_relative 'xhtml' # xhtml.rb
@@ -339,8 +355,16 @@ module SiSU
require_relative 'xml_scaffold_structure_collapsed' # xml_scaffold_structure_collapsed.rb
SiSU_XML_Scaffold_Structure_Collapse::Source.new(@opt).read
end
+ if @opt.act[:xml_docbook_book][:set]==:on #% --xml-docbook
+ 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' # xml.rb
+ require_relative 'xml_sax' # xml_sax.rb
SiSU_XML_SAX::Source.new(@opt).read
end
if @opt.act[:xml_dom][:set]==:on #% --xml-dom, -X xml dom type
@@ -391,12 +415,12 @@ module SiSU
or @opt.act[:sisupod][:set]==:on \
or @opt.act[:git][:set]==:on
begin
- require_relative 'shared_sisupod_source'
+ require_relative 'src_shared'
OptionLoopFiles.new(@opt).loop_files_on_given_option do
SiSU_Source::SiSUpodSource.new(@opt).read
end
if @opt.act[:share_source][:set]==:on
- require_relative 'share_src' # -s share_src.rb
+ require_relative 'src_share' # -s src_share.rb
begin
ensure
OptionLoopFiles.new(@opt).loop_files_on_given_option_bundle do
@@ -405,7 +429,7 @@ module SiSU
end
end
if @opt.act[:sisupod][:set]==:on #% --sisupod, -S make sisupod
- require_relative 'sisupod_make' # -S sisupod_make.rb
+ require_relative 'src_sisupod_make' # -S src_sisupod_make.rb
begin
ensure
OptionLoopFiles.new(@opt).loop_files_on_given_option_bundle do
@@ -523,8 +547,13 @@ module SiSU
SiSU_Env::InfoProcessingFlag.new
if @opt.act[:version_info][:set]==:on #% version information
SiSU_Env::InfoAbout.new(@opt).sisu_version
+ if (@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],' ' + File.dirname(__FILE__)).grey
+ end
end
- if @opt.act[:dal][:set]==:on \
+ if @opt.act[:ao][:set]==:on \
or @opt.act[:maintenance][:set]==:on #% --maintenance, -m for -C
path={}
path[:css]=@@env.path.output + '/_sisu/css'
@@ -576,7 +605,7 @@ module SiSU
if @opt.act[:webrick][:set]==:on #% --webrick, -W webrick
SiSU::Operations.new(@opt).webrick
end
- if @opt.act[:dal][:set]==:on
+ if @opt.act[:ao][:set]==:on
@retry_count= -1
begin
@get_s,@get_p,@get_pl=[],[],[]
@@ -628,10 +657,14 @@ module SiSU
and @opt.mod.join(';') =~/--(?:createdb|init(?:ialize)?|create(?:all)?|createtables|recreate|drop(?:all))/)
:false
else
- (@opt.act[:dal][:set]==:on \
+ (@opt.act[:ao][:set]==:on \
|| @opt.act[:manpage][:set]==:on \
|| @opt.act[:texinfo][:set]==:on \
|| @opt.act[:txt][:set]==:on \
+ || @opt.act[:txt_textile][:set]==:on \
+ || @opt.act[:txt_asciidoc][:set]==:on \
+ || @opt.act[:txt_markdown][:set]==:on \
+ || @opt.act[:txt_rst][:set]==:on \
|| @opt.act[:html][:set]==:on \
|| @opt.act[:html_scroll][:set]==:on \
|| @opt.act[:html_seg][:set]==:on \
@@ -643,6 +676,8 @@ module SiSU
|| @opt.act[:xml_dom][:set]==:on \
|| @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 fc4bd5b9..fb3064e7 100644
--- a/lib/sisu/v5/manifest.rb
+++ b/lib/sisu/v5/manifest.rb
@@ -396,6 +396,27 @@ module SiSU_Manifest
id,file='XML DOM',@f.base_filename.xml_dom
summarize(id,file,pth,rel,url)
end
+ if FileTest.file?(@f.place_file.xml_docbook_article.dir)==true
+ pth=@f.output_path.xml_docbook_article.dir
+ rel=@f.output_path.xml_docbook_article.rel_sm
+ url=@f.output_path.xml_docbook_article.url
+ id,file='XML Docbook Book',@f.base_filename.xml_docbook_article
+ summarize(id,file,pth,rel,url)
+ end
+ if FileTest.file?(@f.place_file.xml_docbook_book.dir)==true
+ pth=@f.output_path.xml_docbook_book.dir
+ rel=@f.output_path.xml_docbook_book.rel_sm
+ url=@f.output_path.xml_docbook_book.url
+ 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
@@ -439,6 +460,38 @@ module SiSU_Manifest
file=@f.base_filename.txt
summarize(id,file,pth,rel,url)
end
+ if FileTest.file?(@f.place_file.textile.dir)==true
+ id='Textile text (UTF-8)'
+ pth=@f.output_path.textile.dir
+ rel=@f.output_path.textile.rel_sm
+ url=@f.output_path.textile.url
+ file=@f.base_filename.textile
+ summarize(id,file,pth,rel,url)
+ end
+ if FileTest.file?(@f.place_file.asciidoc.dir)==true
+ id='asciiDoc text (UTF-8)'
+ pth=@f.output_path.asciidoc.dir
+ rel=@f.output_path.asciidoc.rel_sm
+ url=@f.output_path.asciidoc.url
+ file=@f.base_filename.asciidoc
+ summarize(id,file,pth,rel,url)
+ end
+ if FileTest.file?(@f.place_file.markdown.dir)==true
+ id='Markdown text (UTF-8)'
+ pth=@f.output_path.markdown.dir
+ rel=@f.output_path.markdown.rel_sm
+ url=@f.output_path.markdown.url
+ file=@f.base_filename.markdown
+ summarize(id,file,pth,rel,url)
+ end
+ if FileTest.file?(@f.place_file.rst.dir)==true
+ id='rST text (UTF-8)'
+ pth=@f.output_path.rst.dir
+ rel=@f.output_path.rst.rel_sm
+ url=@f.output_path.rst.url
+ file=@f.base_filename.rst
+ summarize(id,file,pth,rel,url)
+ end
if FileTest.file?("#{@base_path}/#{@md.fns}.tex")==true
id,file='LaTeX (portrait)',"#{@md.fns}.tex"
pth,rel,url='','',''
diff --git a/lib/sisu/v5/manpage.rb b/lib/sisu/v5/manpage.rb
index 3e430b55..ccdd829c 100644
--- a/lib/sisu/v5/manpage.rb
+++ b/lib/sisu/v5/manpage.rb
@@ -61,7 +61,7 @@
=end
module SiSU_Manpage
- require_relative 'dal' # dal.rb
+ require_relative 'ao' # ao.rb
require_relative 'sysenv' # sysenv.rb
include SiSU_Env
include SiSU_Param
@@ -69,7 +69,7 @@ module SiSU_Manpage
require_relative 'manpage_format' # manpage_format.rb
include SiSU_ManpageFormat
require_relative 'shared_metadata' # shared_metadata.rb
- require_relative 'shared_txt' # shared_txt.rb
+ require_relative 'txt_shared' # txt_shared.rb
@@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0
@@tablefoot=''
class Source
@@ -100,8 +100,8 @@ module SiSU_Manpage
|| @opt.act[:maintenance][:set]==:on)
SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{@md.file.output_path.manpage.dir}/#{@md.file.base_filename.manpage}").flow
end
- @dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here
- SiSU_Manpage::Source::Scroll.new(@md,@dal_array).songsheet
+ @ao_array=SiSU_AO::Source.new(@opt).get # ao file drawn here
+ SiSU_Manpage::Source::Scroll.new(@md,@ao_array).songsheet
rescue
SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do
__LINE__.to_s + ':' + __FILE__
@@ -112,7 +112,7 @@ module SiSU_Manpage
private
class Scroll <Source
require_relative 'defaults' # defaults.rb
- require_relative 'shared_txt' # shared_txt.rb
+ require_relative 'txt_shared' # txt_shared.rb
include SiSU_TextUtils
@@endnotes={ para: [], end: [] }
def initialize(md,data)
@@ -120,7 +120,6 @@ module SiSU_Manpage
@brace_url=SiSU_Viz::Defaults.new.url_decoration
@vz=SiSU_Viz::Defaults.new
@tab="\t"
- @br="\n"
@@notes=:end
@manpage={ body: [], open: [], close: [], head: [], metadata: [], tail: [], endnotes: [] }
end
@@ -128,6 +127,9 @@ module SiSU_Manpage
manpage=markup(@data)
publish(manpage)
end
+ def break_line
+ "\n"
+ end
# Used for extraction of endnotes from paragraphs
def extract_endnotes(dob='')
para=dob.obj.gsub(/#{Mx[:br_line]}/,"\n")
@@ -176,7 +178,7 @@ GSUB
end
def manpage_tail
@manpage[:tail] <<<<WOK
-#{@br}
+#{break_line}
.TP
.SH SEE ALSO
sisu(1),
@@ -235,21 +237,21 @@ WOK
times=wrapped.length
times=78 if times > 78
@manpage[:body] << case lv
- when 1; '.SH ' << wrapped.upcase << @br << @br
- when 2..3; '.SH ' << wrapped.upcase << @br << @br
- when 4; '.SH ' << wrapped.upcase << @br << @br
- when 5..6; '.SH ' << wrapped.upcase << @br << @br
+ when 1; '.SH ' << wrapped.upcase << break_line << break_line
+ when 2..3; '.SH ' << wrapped.upcase << break_line << break_line
+ when 4; '.SH ' << wrapped.upcase << break_line << break_line
+ when 5..6; '.SH ' << wrapped.upcase << break_line << break_line
end
else
@manpage[:body] << if wrapped =~/^\.BI\s/ # main text, contents, body KEEP
- '.TP' << @br << wrapped.gsub(/(^\.B)I\s/,'\1 ') # sleight ... simpler output (check gsub!)
+ '.TP' << break_line << wrapped.gsub(/(^\.B)I\s/,'\1 ') # sleight ... simpler output (check gsub!)
else
- @br + '.BR' + @br << wrapped
+ break_line + '.BR' + break_line << wrapped
end
end
if @@endnotes[:para] \
and @@notes==:foot #edit out to switch off endnotes following paragraph to which they belong
- @@endnotes[:para].each { |e| @manpage[:body] << e << @br }
+ @@endnotes[:para].each { |e| @manpage[:body] << e << break_line }
elsif @@endnotes[:para] \
and @@notes==:end
end
@@ -349,7 +351,7 @@ WOK
manpage_structure(dob)
else
if dob.obj =~/#{table_message}/
- @manpage[:body] << dob.obj << @br
+ @manpage[:body] << dob.obj << break_line
end
end
if (dob.obj =~/<a name="n\d+">/ \
diff --git a/lib/sisu/v5/options.rb b/lib/sisu/v5/options.rb
index 7203f8b2..f410e61f 100644
--- a/lib/sisu/v5/options.rb
+++ b/lib/sisu/v5/options.rb
@@ -496,7 +496,7 @@ module SiSU_Commandline
when /^--(?:color-toggle)$/; c=c+'c'
when /^--(?:color-off)$/; c=c+'k'
when /^--(?:conf|config|configure|init|initialize|init-site)$/; c=c+'CC'
- when /^--(?:dal?|machine|abstraction|abs)$/; c=c+'m'
+ when /^--(?:ao|dal?|machine|abstraction|abs)$/; c=c+'m'
when /^--(?:txt|text|plaintext)$/; c=c+'t'
when /^--(?:html)$/; c=c+'h'
when /^--(?:html-scroll|html-seg)$/; c=c+'H'
@@ -552,12 +552,12 @@ module SiSU_Commandline
if cmd !~/[mn]/
extra+=if cmd =~/[abegHhIiLNOoPpQTtwXxyz]/ \
and cmd !~/[mn]/
- 'm' #% add dal
+ 'm' #% add ao
elsif ((cmd =~/[Dd]/ \
or (mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/)) \
and mod.inspect !~/(?:remove|(?:(?:re)?create(?:all)?|dropall|drop)$)/) \
and cmd !~/[mn]/
- 'm' #% add dal
+ 'm' #% add ao
else ''
end
end
@@ -861,6 +861,13 @@ module SiSU_Commandline
|| mod.inspect =~/"--xml-dom"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
+ 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 }
@@ -875,6 +882,18 @@ module SiSU_Commandline
|| mod.inspect =~/"--txt"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
+ act[:txt_textile]=(mod.inspect =~/"--textile"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:txt_asciidoc]=(mod.inspect =~/"--asciidoc"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:txt_markdown]=(mod.inspect =~/"--markdown"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:txt_rst]=(mod.inspect =~/"--rst"|"--rest"|"--restructuredtext"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
act[:manpage]=(cmd =~/i/ \
|| mod.inspect =~/"--manpage"|"--man"/) \
? { bool: true, set: :on }
@@ -883,10 +902,6 @@ module SiSU_Commandline
|| mod.inspect =~/"--texinfo"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:fictionbook]=(cmd =~/f/ \
- || mod.inspect =~/"--fictionbook"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
act[:psql]=(cmd =~/D/ \
|| mod.inspect =~/"--pg"|"--pgsql"/) \
? { bool: true, set: :on }
@@ -964,10 +979,14 @@ module SiSU_Commandline
act[:help]=(mod.inspect =~/"--help/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:dal]=if (cmd =~/m/ \
- || mod.inspect =~/"--dal"/)
+ act[:ao]=if (cmd =~/m/ \
+ || mod.inspect =~/"--ao"|"--dal"/)
{ bool: true, set: :on }
elsif (act[:txt][:set]==:on \
+ || act[:txt_textile][:set]==:on \
+ || act[:txt_asciidoc][:set]==:on \
+ || act[:txt_markdown][:set]==:on \
+ || act[:txt_rst][:set]==:on \
|| act[:xhtml][:set]==:on \
|| act[:epub][:set]==:on \
|| act[:html][:set]==:on \
@@ -986,20 +1005,22 @@ module SiSU_Commandline
|| act[:concordance][:set]==:on \
|| 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 }
#if cmd !~/[mn]/
# extra+=if cmd =~/[abegHhIiLNOoPpQTtwXxyz]/ \
# and cmd !~/[mn]/
- # 'm' #% add dal
+ # 'm' #% add ao
#elsif (act[:txt][:set]==:on \
# { bool: true, set: :on }
# elsif ((cmd =~/[Dd]/ \
# or (mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/)) \
# and mod.inspect !~/(?:remove|(?:(?:re)?create(?:all)?|dropall|drop)$)/) \
# and cmd !~/[mn]/
- # 'm' #% add dal
+ # 'm' #% add ao
else
{ bool: false, set: :na }
end
@@ -1012,6 +1033,10 @@ module SiSU_Commandline
|| mod.inspect =~/"--manifest"/)
{ bool: true, set: :on }
elsif (act[:txt][:set]==:on \
+ || act[:txt_textile][:set]==:on \
+ || act[:txt_asciidoc][:set]==:on \
+ || act[:txt_markdown][:set]==:on \
+ || act[:txt_rst][:set]==:on \
|| act[:xhtml][:set]==:on \
|| act[:epub][:set]==:on \
|| act[:html][:set]==:on \
@@ -1030,6 +1055,8 @@ module SiSU_Commandline
|| act[:concordance][:set]==:on \
|| 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/param.rb b/lib/sisu/v5/param.rb
index e8144a5e..d01f39e2 100644
--- a/lib/sisu/v5/param.rb
+++ b/lib/sisu/v5/param.rb
@@ -86,7 +86,7 @@ module SiSU_Param
end
SiSU_Param::Instantiate.new.param_instantiate
@env=SiSU_Env::InfoEnv.new(@fns)
- @pstorefile="#{@env.processing_path.dal}/#{@fns}.pstore"
+ @pstorefile="#{@env.processing_path.ao}/#{@fns}.pstore"
end
def get
if @opt.f_pth \
@@ -1406,7 +1406,7 @@ module SiSU_Param
end
def store
begin
- pstorefile="#{@env.processing_path.dal}/#{@md.fns}.pstore"
+ pstorefile="#{@env.processing_path.ao}/#{@md.fns}.pstore"
File.unlink(pstorefile) if FileTest.file?(pstorefile)
if (@md.opt.act[:verbose_plus][:set]==:on \
|| @md.opt.act[:maintenance][:set]==:on)
diff --git a/lib/sisu/v5/particulars.rb b/lib/sisu/v5/particulars.rb
index 000748ff..beeaf429 100644
--- a/lib/sisu/v5/particulars.rb
+++ b/lib/sisu/v5/particulars.rb
@@ -66,14 +66,14 @@ module SiSU_Particulars
include SiSU_Env
require_relative 'param' # param.rb
include SiSU_Param
- require_relative 'dal' # dal.rb
+ require_relative 'ao' # ao.rb
class CombinedSingleton
include Singleton
def get_all(opt)
set_env(opt)
set_file(opt)
set_md(opt)
- set_dal(opt) #needs @md
+ set_ao(opt) #needs @md
end
def get_env(opt)
set_env(opt)
@@ -84,8 +84,8 @@ module SiSU_Particulars
def get_md(opt)
set_md(opt)
end
- def get_dal_array(opt)
- set_dal(opt) #needs @md
+ def get_ao_array(opt)
+ set_ao(opt) #needs @md
end
def get_env_md(opt)
set_env(opt)
@@ -149,10 +149,10 @@ module SiSU_Particulars
end
end
end
- attr_accessor :opt,:dal_array
- def set_dal(opt)
+ attr_accessor :opt,:ao_array
+ def set_ao(opt)
begin
- @dal_array=SiSU_DAL::Source.new(opt).get
+ @ao_array=SiSU_AO::Source.new(opt).get
self
rescue
SiSU_Errors::Rescued.new($!,$@,opt.cmd,opt.fnl).location do
@@ -162,7 +162,7 @@ module SiSU_Particulars
end
def set_sst_idx(opt)
begin
- @sst_idx=SiSU_DAL::Source.new(opt).get_idx_sst
+ @sst_idx=SiSU_AO::Source.new(opt).get_idx_sst
self
rescue
SiSU_Errors::Rescued.new($!,$@,opt.cmd,opt.fnl).location do
@@ -172,7 +172,7 @@ module SiSU_Particulars
end
def set_raw_idx(opt)
begin
- @raw_idx=SiSU_DAL::Source.new(opt).get_idx_raw
+ @raw_idx=SiSU_AO::Source.new(opt).get_idx_raw
self
rescue
SiSU_Errors::Rescued.new($!,$@,opt.cmd,opt.fnl).location do
@@ -182,7 +182,7 @@ module SiSU_Particulars
end
def set_html_idx(opt)
begin
- @html_idx=SiSU_DAL::Source.new(opt).get_idx_html
+ @html_idx=SiSU_AO::Source.new(opt).get_idx_html
self
rescue
SiSU_Errors::Rescued.new($!,$@,opt.cmd,opt.fnl).location do
@@ -192,7 +192,7 @@ module SiSU_Particulars
end
def set_xhtml_idx(opt)
begin
- @xhtml_idx=SiSU_DAL::Source.new(opt).get_idx_xhtml
+ @xhtml_idx=SiSU_AO::Source.new(opt).get_idx_xhtml
self
rescue
SiSU_Errors::Rescued.new($!,$@,opt.cmd,opt.fnl).location do
@@ -204,7 +204,7 @@ module SiSU_Particulars
def set_nametags_map(opt)
begin
opt=@md ? @md : opt
- @nametags_map=SiSU_DAL::Source.new(opt).get_map_nametags
+ @nametags_map=SiSU_AO::Source.new(opt).get_map_nametags
self
rescue
if @md
@@ -221,7 +221,7 @@ module SiSU_Particulars
attr_accessor :ocn_htmlseg_map
def set_ocn_htmlseg_map(opt)
begin
- @ocn_htmlseg_map=SiSU_DAL::Source.new(@md).get_map_ocn_htmlseg
+ @ocn_htmlseg_map=SiSU_AO::Source.new(@md).get_map_ocn_htmlseg
self
rescue
SiSU_Errors::Rescued.new($!,$@,opt.cmd,opt.fnl).location do
diff --git a/lib/sisu/v5/plaintext_format.rb b/lib/sisu/v5/plaintext_format.rb
deleted file mode 100644
index acad8828..00000000
--- a/lib/sisu/v5/plaintext_format.rb
+++ /dev/null
@@ -1,104 +0,0 @@
-# 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 <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.sisudoc.org/sisu/en/SiSU/download.html>
-
- * Git
- <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/plaintext_format.rb;hb=HEAD>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: plaintext formatting template
-
-=end
-module SiSU_Plaintext_Format
- require_relative 'param' # param.rb
- include SiSU_Param
- include SiSU_Viz
- class ParagraphNumber
- def initialize(paranum)
- @paranum=/(\d+)/m.match(paranum.to_s)[1]
- end
- def display
- @paranum.gsub(/(\d+)/,"\n#{Dx[:ocn_o]}\\1#{Dx[:ocn_c]}")
- end
- def name #unused
- @paranum.gsub(/(\d+)/,'\1')
- end
- def goto #unused
- @paranum.gsub(/(\d+)/,'"#\1"')
- end
- end
- class FormatTextObject
- def initialize(md,t_o)
- @md,@t_o=md,t_o
- if t_o.is_a?(Hash)
- @txt =t_o[:txt] || nil
- @lnk_url =t_o[:lnk_url] || nil
- @lnk_txt =t_o[:lnk_txt] || nil
- else
- p t_o.class
- p caller
- end
- rgx=/^#{Rx[:lv]}/
- @txt=@txt.gsub(rgx,'') if @txt =~rgx
- rgx=/#{Mx[:en_a_o]}[\d*+]+\s+(.+?)#{Mx[:en_a_c]}/
- @txt=@txt.gsub(rgx,'\1') if @txt =~rgx
- @vz=SiSU_Viz::Defaults.new
- end
- def scr_endnote_body
- "<endnote>#{@txt}</endnote> "
- end
- end
- class XML
- end
-end
-__END__
diff --git a/lib/sisu/v5/po4a.rb b/lib/sisu/v5/po4a.rb
index 64f2c18d..217f2975 100644
--- a/lib/sisu/v5/po4a.rb
+++ b/lib/sisu/v5/po4a.rb
@@ -61,7 +61,7 @@
=end
module SiSU_Po4a
- require_relative 'dal' # dal.rb
+ require_relative 'ao' # ao.rb
require_relative 'sysenv' # sysenv.rb
include SiSU_Env
require_relative 'composite' # composite.rb
@@ -101,7 +101,7 @@ module SiSU_Po4a
end
md=SiSU_Param::Parameters.new(@opt).get
src[:files].each do |fn|
- SiSU_DAL::Source.new(@opt,fn).read # -m
+ SiSU_AO::Source.new(@opt,fn).read # -m
env=SiSU_Env::InfoEnv.new(@opt.fns)
m=/((.+?)(?:\~\w\w(?:_\w\w)?)?)\.((?:-|ssm\.)?sst|ssm|ssi)$/ #watch added match for sss
@fnn,@fnb,@fnt=fn[m,1],fn[m,2],fn[m,3]
@@ -126,7 +126,7 @@ module SiSU_Po4a
if @opt.fns =~/\S+?~#{@lang_regx}\.ss[mti]/ \
or @opt.f_pth[:lng] !=@opt.lng_base
opt_lang_trn_fn=fn
- @dal_array_lang_translation=SiSU_DAL::Source.new(@opt,opt_lang_trn_fn).get # dal file drawn here
+ @ao_array_lang_translation=SiSU_AO::Source.new(@opt,opt_lang_trn_fn).get # ao file drawn here
opt_lang_src_fn=if fn =~/\S+?~\S{2}(?:_\S{2})?\.ss[mti]/
fn.gsub(/(\S+?)~\S{2}(?:_\S{2})?(\.ss[mti])/,'\1\2') #check i
else fn
@@ -141,15 +141,15 @@ module SiSU_Po4a
else nil
end
if FileTest.file?("#{srcdir}/#{opt_lang_src_fn}")
- @dal_array_lang_src=SiSU_DAL::Source.new(@@opt_src,opt_lang_src_fn).get # dal file drawn here
+ @ao_array_lang_src=SiSU_AO::Source.new(@@opt_src,opt_lang_src_fn).get # ao file drawn here
else
puts "no identified source document"
exit
end
Dir.chdir(transdir) if transdir
else
- @dal_array_lang_src=SiSU_DAL::Source.new(@opt,fn).get # dal file drawn here
- @dal_array_lang_translation=nil
+ @ao_array_lang_src=SiSU_AO::Source.new(@opt,fn).get # ao file drawn here
+ @ao_array_lang_translation=nil
end
wrap_width=if defined? md.make.plaintext_wrap \
and md.make.plaintext_wrap
@@ -159,7 +159,7 @@ module SiSU_Po4a
env.plaintext_wrap
else 78
end
- SiSU_Po4a::Source::Scroll.new(fn,@dal_array_lang_src,@dal_array_lang_translation,@@md_src,@@md_trn,wrap_width).songsheet
+ SiSU_Po4a::Source::Scroll.new(fn,@ao_array_lang_src,@ao_array_lang_translation,@@md_src,@@md_trn,wrap_width).songsheet
end
rescue
SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do
diff --git a/lib/sisu/v5/prog_text_translation.rb b/lib/sisu/v5/prog_text_translation.rb
index 8425a109..ae166d23 100644
--- a/lib/sisu/v5/prog_text_translation.rb
+++ b/lib/sisu/v5/prog_text_translation.rb
@@ -473,7 +473,7 @@ module SiSU_Translate
'Document (RCS/CVS) number'
end
def last_generated
- 'Document (dal) last generated'
+ 'Document (ao) last generated'
end
def sisu_version
'Generated by'
@@ -1324,7 +1324,7 @@ module SiSU_Translate
'Numero di revisione (RCS/CVS)'
end
def last_generated
- 'Data di ultima generazione (dal metaverse)'
+ 'Data di ultima generazione (ao metaverse)'
end
def sisu_version
'Generato da'
diff --git a/lib/sisu/v5/relaxng.rb b/lib/sisu/v5/relaxng.rb
index 39d6bde9..ef632308 100644
--- a/lib/sisu/v5/relaxng.rb
+++ b/lib/sisu/v5/relaxng.rb
@@ -327,9 +327,9 @@ element-external_space =
}
RELAXNG
end
- def rnc_sisu_object_dal
+ def rnc_sisu_object_ao
@relaxng =<<RELAXNG
-#%% sisu object model: dal
+#%% sisu object model: ao
#{gpl3_or_later}
#%% definitions
# dublin core:
@@ -500,7 +500,7 @@ RELAXNG
@relaxng =<<RELAXNG
#% sax output model, part of SiSU and distributed under the same license
default namespace = ""
-namespace xlink = "http://www.w3.org/1999/xlink"
+namespace xl = "http://www.w3.org/1999/xlink"
start =
element document {
element head {
@@ -510,8 +510,8 @@ start =
attribute class { xsd:NCName },
(text
| element link {
- attribute xlink:href { xsd:anyURI },
- attribute xlink:type { xsd:NCName },
+ attribute xl:href { xsd:anyURI },
+ attribute xl:type { xsd:NCName },
xsd:anyURI
})+
}
@@ -603,10 +603,10 @@ start =
attribute alt { text }?,
attribute height { xsd:integer }?,
attribute width { xsd:integer }?,
- attribute xlink:actuate { xsd:NCName },
- attribute xlink:href { text },
- attribute xlink:show { xsd:NCName },
- attribute xlink:type { xsd:NCName }
+ attribute xl:actuate { xsd:NCName },
+ attribute xl:href { text },
+ attribute xl:show { xsd:NCName },
+ attribute xl:type { xsd:NCName }
})+
}?,
element table {
@@ -654,8 +654,8 @@ sub = element sub { xsd:NCName }
sup = element sup { xsd:NCName }
link =
element link {
- attribute xlink:href { xsd:anyURI },
- attribute xlink:type { xsd:NCName },
+ attribute xl:href { xsd:anyURI },
+ attribute xl:type { xsd:NCName },
(xsd:anyURI | text | b | i | sup)+
}
u = element u { (text | b | i)+ }
@@ -666,7 +666,7 @@ RELAXNG
@relaxng =<<RELAXNG
#% dom output model, part of SiSU and distributed under the same license
default namespace = ""
-namespace xlink = "http://www.w3.org/1999/xlink"
+namespace xl = "http://www.w3.org/1999/xlink"
start =
element document {
element head {
@@ -770,10 +770,10 @@ object =
| element image {
attribute height { xsd:integer },
attribute width { xsd:integer },
- attribute xlink:actuate { xsd:NCName },
- attribute xlink:href { text },
- attribute xlink:show { xsd:NCName },
- attribute xlink:type { xsd:NCName }
+ attribute xl:actuate { xsd:NCName },
+ attribute xl:href { text },
+ attribute xl:show { xsd:NCName },
+ attribute xl:type { xsd:NCName }
}
| element sub { text })+
})
@@ -786,8 +786,8 @@ sup = element sup { xsd:NCName }
del = element del { (text | b | i | link)+ }
link =
element link {
- attribute xlink:href { xsd:anyURI },
- attribute xlink:type { xsd:NCName },
+ attribute xl:href { xsd:anyURI },
+ attribute xl:type { xsd:NCName },
xsd:anyURI
}
endnote =
@@ -814,7 +814,7 @@ RELAXNG
@relaxng =<<RELAXNG
#% xhtml output model, part of SiSU and distributed under the same license
default namespace = ""
-namespace xlink = "http://www.w3.org/1999/xlink"
+namespace xl = "http://www.w3.org/1999/xlink"
start =
element document {
element head {
@@ -823,8 +823,8 @@ start =
attribute class { xsd:NCName },
(text
| element link {
- attribute xlink:href { xsd:anyURI },
- attribute xlink:type { xsd:NCName },
+ attribute xl:href { xsd:anyURI },
+ attribute xl:type { xsd:NCName },
xsd:anyURI
})+
}
@@ -923,10 +923,10 @@ start =
attribute alt { text }?,
attribute height { xsd:integer }?,
attribute width { xsd:integer }?,
- attribute xlink:actuate { xsd:NCName },
- attribute xlink:href { text },
- attribute xlink:show { xsd:NCName },
- attribute xlink:type { xsd:NCName }
+ attribute xl:actuate { xsd:NCName },
+ attribute xl:href { text },
+ attribute xl:show { xsd:NCName },
+ attribute xl:type { xsd:NCName }
}
| element sub { text })+
})+,
@@ -954,8 +954,8 @@ sup = element sup { xsd:NCName }
i = element i { (text | b | br | sup)+ }
link =
element link {
- attribute xlink:href { xsd:anyURI },
- attribute xlink:type { xsd:NCName },
+ attribute xl:href { xsd:anyURI },
+ attribute xl:type { xsd:NCName },
(text | b | i | sup)+
}
b = element b { (text | en | i | link | sup)+ }
diff --git a/lib/sisu/v5/screen_text_color.rb b/lib/sisu/v5/screen_text_color.rb
index 4e4a319f..1d9de72c 100644
--- a/lib/sisu/v5/screen_text_color.rb
+++ b/lib/sisu/v5/screen_text_color.rb
@@ -244,6 +244,9 @@ module SiSU_Screen
%{#{@cX.off} } +
%{#{@cX.cyan}nav only: #{@txt[4]}#{@cX.off}.}
end
+ def grey
+ puts "#{@cX.grey}#{@txt[0]}#{@cX.off} #{@cX.cyan}#{@txt[1]}#{@cX.off}"
+ end
def txt_white
puts "\t#{@cX.white}#{@txt[0]}#{@cX.off} #{@cX.white}#{@txt[1]}#{@cX.off}"
end
diff --git a/lib/sisu/v5/shared_metadata.rb b/lib/sisu/v5/shared_metadata.rb
index 91b12043..e176deb9 100644
--- a/lib/sisu/v5/shared_metadata.rb
+++ b/lib/sisu/v5/shared_metadata.rb
@@ -832,18 +832,18 @@ WOK
@inf=inf_array.join(' ')
end
@inf=@inf.gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,
- '<text:a xlink:type="simple" xlink:href="\1">\1</text:a>'). #http ftp matches escaped, no decoration
+ '<text:a xl:type="simple" xl:href="\1">\1</text:a>'). #http ftp matches escaped, no decoration
gsub(/(#{Mx[:lnk_c]})#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
- '\1<text:a xlink:type="simple" xlink:href="\2">\2</text:a>') #special case \{ e.g. \}http://url
+ '\1<text:a xl:type="simple" xl:href="\2">\2</text:a>') #special case \{ e.g. \}http://url
@inf=if @inf =~/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/
@inf.gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
- %{#{url_brace.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{url_brace.xml_close}}) #http ftp matches with decoration
+ %{#{url_brace.xml_open}<text:a xl:type="simple" xl:href="\\1">\\1</text:a>#{url_brace.xml_close}}) #http ftp matches with decoration
else
@inf.gsub(/(https?:\/\/[^<>()'"\s]+)/,
- %{#{url_brace.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{url_brace.xml_close}}) #http ftp matches with decoration
+ %{#{url_brace.xml_open}<text:a xl:type="simple" xl:href="\\1">\\1</text:a>#{url_brace.xml_close}}) #http ftp matches with decoration
end
@inf=@inf.gsub(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+)/,
- %{#{url_brace.xml_open}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{url_brace.xml_close}}) if @inf !~/http:\/\// # improve upon, document crash where url contains '@' symbol
+ %{#{url_brace.xml_open}<text:a xl:type="simple" xl:href="mailto:\\1">\\1</text:a>#{url_brace.xml_close}}) if @inf !~/http:\/\// # improve upon, document crash where url contains '@' symbol
end
<<WOK
<text:p text:style-name="P1">#{@tag.capitalize}: #{@inf}</text:p>
diff --git a/lib/sisu/v5/sitemaps.rb b/lib/sisu/v5/sitemaps.rb
index 8e4d1410..6e81369a 100644
--- a/lib/sisu/v5/sitemaps.rb
+++ b/lib/sisu/v5/sitemaps.rb
@@ -64,7 +64,7 @@ module SiSU_Sitemaps
include SiSU_Param
require_relative 'sysenv' # sysenv.rb
include SiSU_Env
- require_relative 'shared_xml' # shared_xml.rb
+ require_relative 'xml_shared' # xml_shared.rb
include SiSU_XML_Munge
class Source
def initialize(opt)
diff --git a/lib/sisu/v5/share_src_kdissert.rb b/lib/sisu/v5/src_kdissert_share.rb
index b696891e..a71aca99 100644
--- a/lib/sisu/v5/share_src_kdissert.rb
+++ b/lib/sisu/v5/src_kdissert_share.rb
@@ -50,7 +50,7 @@
* Git
<http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/share_src_kdissert.rb;hb=HEAD>
+ <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/src_share_kdissert.rb;hb=HEAD>
* Ralph Amissah
<ralph@amissah.com>
diff --git a/lib/sisu/v5/share_src.rb b/lib/sisu/v5/src_share.rb
index 69dd7bb9..1aba0d95 100644
--- a/lib/sisu/v5/share_src.rb
+++ b/lib/sisu/v5/src_share.rb
@@ -50,7 +50,7 @@
* Git
<http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/share_src.rb;hb=HEAD>
+ <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/src_share.rb;hb=HEAD>
* Ralph Amissah
<ralph@amissah.com>
@@ -60,7 +60,7 @@
=end
module SiSU_Markup
- require_relative 'shared_sisupod_source' # shared_sisupod_source.rb
+ require_relative 'src_shared' # src_shared.rb
include SiSU_Source
require_relative 'sysenv' # sysenv.rb
include SiSU_Env
diff --git a/lib/sisu/v5/shared_sisupod_source.rb b/lib/sisu/v5/src_shared.rb
index f8a4058d..65c4288e 100644
--- a/lib/sisu/v5/shared_sisupod_source.rb
+++ b/lib/sisu/v5/src_shared.rb
@@ -50,7 +50,7 @@
* Git
<http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/shared_sisupod_source.rb;hb=HEAD>
+ <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/src_shared.rb;hb=HEAD>
* Ralph Amissah
<ralph@amissah.com>
@@ -300,7 +300,7 @@ sisu
standard_terms/
image
processing
- dal/
+ ao/
tex/
texinfo/
tune/
diff --git a/lib/sisu/v5/sisupod_make.rb b/lib/sisu/v5/src_sisupod_make.rb
index 462e2ea4..d244ece4 100644
--- a/lib/sisu/v5/sisupod_make.rb
+++ b/lib/sisu/v5/src_sisupod_make.rb
@@ -50,7 +50,7 @@
* Git
<http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/sisupod_make.rb;hb=HEAD>
+ <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/src_sisupod_make.rb;hb=HEAD>
* Ralph Amissah
<ralph@amissah.com>
@@ -60,7 +60,7 @@
=end
module SiSU_Doc
- require_relative 'shared_sisupod_source' # shared_sisupod_source.rb
+ require_relative 'src_shared' # scr_shared.rb
include SiSU_Source
require_relative 'sysenv' # sysenv.rb
include SiSU_Env
@@ -155,7 +155,7 @@ sisu
standard_terms/
image
processing
- dal/
+ ao/
tex/
texinfo/
tune/
diff --git a/lib/sisu/v5/sst_do_inline_footnotes.rb b/lib/sisu/v5/sst_do_inline_footnotes.rb
index 836d0d29..cafe9c60 100644
--- a/lib/sisu/v5/sst_do_inline_footnotes.rb
+++ b/lib/sisu/v5/sst_do_inline_footnotes.rb
@@ -67,8 +67,8 @@ module SiSU_ConvertFootnotes
include SiSU_Env
require_relative 'param' # param.rb
include SiSU_Param
- require_relative 'dal_syntax' # dal_syntax.rb
- include SiSU_DAL_Syntax
+ require_relative 'ao_syntax' # ao_syntax.rb
+ include SiSU_AO_Syntax
require_relative 'i18n' # i18n.rb
class Instantiate < SiSU_Param::Parameters::Instructions
@@flag={} #Beware!!
@@ -82,19 +82,19 @@ module SiSU_ConvertFootnotes
end
end
class Source <Instantiate
- @@dal_array=[]
+ @@ao_array=[]
@@fns=nil
def initialize(opt)
@opt=opt
@@fns||@opt.fns
@my_make=SiSU_Env::CreateFile.new(@opt.fns)
- @fnm=SiSU_Env::InfoFile.new(@opt.fns).marshal.dal_content
+ @fnm=SiSU_Env::InfoFile.new(@opt.fns).marshal.ao_content
end
- def read #creates dal
+ def read #creates ao
begin
- @@dal_array=[]
+ @@ao_array=[]
@@fns=@opt.fns
- create_dal
+ create_ao
rescue
SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do
__LINE__.to_s + ':' + __FILE__
@@ -103,16 +103,16 @@ module SiSU_ConvertFootnotes
Instantiate.new
end
end
- def get #reads dal, unless does not exist then creates first
+ def get #reads ao, unless does not exist then creates first
begin
- dal=[]
+ ao=[]
unless @@fns==@opt.fns
@@fns=@opt.fns
- @@dal_array=[]
+ @@ao_array=[]
end
- dal=(@@dal_array.empty?) \
+ ao=(@@ao_array.empty?) \
? read_fnm
- : @@dal_array.dup #check
+ : @@ao_array.dup #check
rescue
SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do
__LINE__.to_s + ':' + __FILE__
@@ -122,8 +122,8 @@ module SiSU_ConvertFootnotes
end
end
protected
- def create_dal
- dal_array=[]
+ def create_ao
+ ao_array=[]
SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'convert footnotes').green_title_hi unless @opt.act[:quiet][:set]==:on
file_array=IO.readlines(@opt.fns,'')
file_array.each do |l|
@@ -136,21 +136,21 @@ module SiSU_ConvertFootnotes
if @md.en[:mismatch]==0 \
or @md.opt.mod.inspect =~/=footnotes-force/
meta=nil
- dal=SiSU_ConvertFootnotes::Make.new(@md,file_array).song
+ ao=SiSU_ConvertFootnotes::Make.new(@md,file_array).song
SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{@md.fns}.fn").output if @md.opt.act[:verbose][:set]==:on
SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"#{@md.fns}.fn -> #{@md.fns}.fn").txt_red unless @md.opt.act[:quiet][:set]==:on
- dal.each {|s| dal_array << "#{s.strip}\n\n" unless s.strip.empty?}
- dal_array
+ ao.each {|s| ao_array << "#{s.strip}\n\n" unless s.strip.empty?}
+ ao_array
else
SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'*WARN* no footnote conversion done, problem with source file','to override use --convert=footnote-force (this is not advised)').warn unless @md.opt.act[:quiet][:set]==:on
''
end
end
def read_fnm
- dal=[]
- dal=(FileTest.file?(@fnm)) \
- ? (File.open(@fnm){ |f| dal=Marshal.load(f)})
- : (SiSU_ConvertFootnotes::Source.new(@opt).create_dal) #watch
+ ao=[]
+ ao=(FileTest.file?(@fnm)) \
+ ? (File.open(@fnm){ |f| ao=Marshal.load(f)})
+ : (SiSU_ConvertFootnotes::Source.new(@opt).create_ao) #watch
end
end
class Output
@@ -189,7 +189,7 @@ module SiSU_ConvertFootnotes
def song
reset
data=@data
- @metafile="#{@env.processing_path.dal}/#{@md.fns}.meta"
+ @metafile="#{@env.processing_path.ao}/#{@md.fns}.meta"
SiSU_Env::CreateFile.new(@md.fns)
data=data.join.split("\n\n")
data_new=[]
@@ -458,7 +458,7 @@ module SiSU_ConvertFootnotes
end
end
end
- def strip_clean_extra_spaces(s) # dal output tuned
+ def strip_clean_extra_spaces(s) # ao output tuned
s=s.dup
s=s.gsub(/[ ]+([,.;:?](?:$|\s))/,'\1')
s=s.gsub(/ [ ]+/,' ')
@@ -482,4 +482,4 @@ module SiSU_ConvertFootnotes
end
__END__
@particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)
-dal_array=@particulars.dal_array # dal file drawn here
+ao_array=@particulars.ao_array # ao file drawn here
diff --git a/lib/sisu/v5/sst_to_s_xml_sax.rb b/lib/sisu/v5/sst_to_s_xml_sax.rb
index d6767595..5f18496a 100644
--- a/lib/sisu/v5/sst_to_s_xml_sax.rb
+++ b/lib/sisu/v5/sst_to_s_xml_sax.rb
@@ -68,8 +68,8 @@ module SiSU_SimpleXML_ModelSax
include SiSU_Param
require_relative 'sysenv' # sysenv.rb
include SiSU_Env
- require_relative 'dal_doc_str' # dal_doc_str.rb
- require_relative 'shared_xml' # shared_xml.rb
+ require_relative 'ao_doc_str' # ao_doc_str.rb
+ require_relative 'xml_shared' # xml_shared.rb
include SiSU_XML_Munge
require_relative 'shared_sem' # shared_sem.rb
require_relative 'xml_format' # xml_format.rb
@@ -109,9 +109,9 @@ module SiSU_SimpleXML_ModelSax
end
end
def read_fnm
- dal=[]
+ ao=[]
if FileTest.file?("#{Dir.pwd}/#{@opt.fns}")
- dal=IO.readlines("#{Dir.pwd}/#{@opt.fns}","\n\n")
+ ao=IO.readlines("#{Dir.pwd}/#{@opt.fns}","\n\n")
else STDERR.puts 'Error'
end
end
@@ -138,7 +138,7 @@ module SiSU_SimpleXML_ModelSax
end
end
class Scroll
- require_relative 'shared_txt' # shared_txt.rb
+ require_relative 'txt_shared' # txt_shared.rb
require_relative 'css' # css.rb
include SiSU_TextUtils
@@xml={ body: [], open: [], close: [], head: [] }
@@ -276,7 +276,7 @@ WOK
(0..6).each { |x| @cont[x]=@level[x]=false }
(4..6).each { |x| @xml_contents_close[x]='' }
@data.each do |para|
- data << SiSU_DAL_DocumentStructureExtract::Structure.new(@md,para).structure #takes on Mx marks
+ data << SiSU_AO_DocumentStructureExtract::Structure.new(@md,para).structure #takes on Mx marks
end
data.each do |para|
if para !~/^\s*(?:%+ |<:code>)/
diff --git a/lib/sisu/v5/sysenv.rb b/lib/sisu/v5/sysenv.rb
index d4079f8c..1f5d7d3a 100644
--- a/lib/sisu/v5/sysenv.rb
+++ b/lib/sisu/v5/sysenv.rb
@@ -142,7 +142,7 @@ module SiSU_Env
PROCESSING_PATH=:processing_path
PROCESSING_DIR_TMP_ROOT=:processing_dir_tmp_root
PROCESSING_PATH_TMP_BASE=:processing_path_tmp_base
- PROCESSING_DAL=:processing_dal
+ PROCESSING_AO=:processing_ao
PROCESSING_TUNE=:processing_tune
PROCESSING_LATEX=:processing_latex
PROCESSING_TEXINFO=:processing_texinfo
@@ -186,7 +186,7 @@ module SiSU_Env
PROCESSING_PATH => processing_pth,
PROCESSING_DIR_TMP_ROOT => prcss_dir_tmp_root,
PROCESSING_PATH_TMP_BASE => processing_pth,
- PROCESSING_DAL => 'dal',
+ PROCESSING_AO => 'ao',
PROCESSING_TUNE => 'tune',
PROCESSING_LATEX => 'tex',
PROCESSING_TEXINFO => 'texinfo',
@@ -1478,6 +1478,18 @@ module SiSU_Env
? @rc['odt']['ocn']
: true
end
+ def xml_docbook_ocn?
+ ((defined? @rc['xml_docbook']['ocn']) \
+ && @rc['xml_docbook']['ocn']==false) \
+ ? @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) \
@@ -1490,6 +1502,30 @@ module SiSU_Env
? @rc['plaintext']['ocn']
: true
end
+ def textile_ocn?
+ ((defined? @rc['textile']['ocn']) \
+ && @rc['textile']['ocn']==true) \
+ ? @rc['textile']['ocn']
+ : false
+ end
+ def asciidoc_ocn?
+ ((defined? @rc['asciidoc']['ocn']) \
+ && @rc['asciidoc']['ocn']==true) \
+ ? @rc['asciidoc']['ocn']
+ : false
+ end
+ def markdown_ocn?
+ ((defined? @rc['markdown']['ocn']) \
+ && @rc['markdown']['ocn']==true) \
+ ? @rc['markdown']['ocn']
+ : false
+ end
+ def rst_ocn?
+ ((defined? @rc['rst']['ocn']) \
+ && @rc['rst']['ocn']==true) \
+ ? @rc['rst']['ocn']
+ : false
+ end
def widget #needs (md) #move
@rc=SiSU_Env::GetInit.new.sisu_yaml.rc
@ad=SiSU_Env::GetInit.new.ads
@@ -2161,7 +2197,7 @@ WOK
? ("#{root_dir}/#{user}/#{stub_pwd}")
: ("#{root_dir}/#{stub_pwd}") # see defaults[:processing_path]
end
- def processing_sisupod(opt=nil) #processing directory, used/needed for sisu work files, has sub-directories (dal,tex etc)
+ def processing_sisupod(opt=nil) #processing directory, used/needed for sisu work files, has sub-directories (ao,tex etc)
@opt=opt
def paths
processing_path_usr="#{root_dir}/#{user}"
@@ -2195,7 +2231,7 @@ WOK
end
self
end
- def processing #processing directory, used/needed for sisu work files, has sub-directories (dal,tex etc)
+ def processing #processing directory, used/needed for sisu work files, has sub-directories (ao,tex etc)
unless FileTest.directory?(root_dir)
FileUtils::mkdir_p(root_dir)
File.chmod(0777,root_dir)
@@ -2219,11 +2255,11 @@ WOK
end
processing
end
- def dal
+ def ao
pth=if defined? @rc['processing']['dal'] \
and @rc['processing']['dal'].is_a?(String)
"#{processing}/#{@rc['processing']['dal']}"
- else "#{processing}/#{defaults[:processing_dal]}"
+ else "#{processing}/#{defaults[:processing_ao]}"
end
FileUtils::mkdir_p(pth) unless FileTest.directory?(pth)
pth
@@ -2238,7 +2274,7 @@ WOK
pth
end
def composite_file
- pth=processing_path.dal #"#{processing}/composite"
+ pth=processing_path.ao #"#{processing}/composite"
FileUtils::mkdir_p(pth) unless FileTest.directory?(pth)
pth
end
@@ -2736,6 +2772,18 @@ WOK
? @rc['program_select']['xml_viewer']
: text_editor
end
+ def docbook_viewer
+ ((defined? @rc['program_select']['xml_viewer']) \
+ && @rc['program_select']['xml_viewer'] =~/\S\S+/) \
+ ? @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
@@ -2978,53 +3026,71 @@ WOK
? (SiSU_Env::InfoEnv.new(@opt.fns))
: (SiSU_Env::InfoEnv.new('dummy.sst')))
ft=[]
- if @opt.act[:dal][:set]==:on
+ if @opt.act[:ao][:set]==:on
@md=SiSU_Param::Parameters.new(@opt).get
if @md \
and defined? @md.fn \
and @md.fn # used for by_language_code?
- if @md.opt.act[:html][:set]==:on #% --html, -h -H
+ if @md.opt.act[:html][:set]==:on #% --html, -h -H
ft << @md.fn[:html]
end
- if @md.opt.act[:concordance][:set]==:on #% --concordance, -w
+ if @md.opt.act[:concordance][:set]==:on #% --concordance, -w
ft << @md.fn[:concordance]
end
- if @md.opt.act[:manifest][:set]==:on #% --manifest, -y
+ if @md.opt.act[:manifest][:set]==:on #% --manifest, -y
ft << @md.fn[:manifest]
end
- if @md.opt.act[:txt][:set]==:on #% --txt, -t -a
+ if @md.opt.act[:txt][:set]==:on #% --txt, -t -a
ft << @md.fn[:plain]
end
- if @md.opt.act[:xhtml][:set]==:on #% --xhtml, -b xhtml
+ if @md.opt.act[:txt_textile][:set]==:on #% --textile
+ ft << @md.fn[:txt_textile]
+ end
+ if @md.opt.act[:txt_asciidoc][:set]==:on #% --asciidoc
+ ft << @md.fn[:txt_asciidoc]
+ end
+ if @md.opt.act[:txt_markdown][:set]==:on #% --markdown
+ ft << @md.fn[:txt_markdown]
+ end
+ if @md.opt.act[:txt_rst][:set]==:on #% --rst, --rest
+ ft << @md.fn[:txt_rst]
+ end
+ if @md.opt.act[:xhtml][:set]==:on #% --xhtml, -b xhtml
ft << @md.fn[:xhtml]
end
- if @md.opt.act[:epub][:set]==:on #% --epub, -e
+ if @md.opt.act[:epub][:set]==:on #% --epub, -e
ft << @md.fn[:epub]
end
- if @md.opt.act[:manpage][:set]==:on #% --manpage, -i
+ if @md.opt.act[:manpage][:set]==:on #% --manpage, -i
ft << @md.fn[:manpage]
end
- if @md.opt.act[:hash_digests][:set]==:on #% --hash-digests, -N digest tree
+ if @md.opt.act[:hash_digests][:set]==:on #% --hash-digests, -N digest tree
ft << @md.fn[:digest]
end
- if @md.opt.act[:odt][:set]==:on #% --odt, -o opendocument
+ if @md.opt.act[:odt][:set]==:on #% --odt, -o opendocument
ft << @md.fn[:odf]
end
- if @md.opt.act[:pdf][:set]==:on #% --pdf-l --pdf, -p latex/ texpdf
+ if @md.opt.act[:pdf][:set]==:on #% --pdf-l --pdf, -p latex/ texpdf
ft << @md.fn[:pdf_l] << @md.fn[:pdf_p]
end
if @md.opt.act[:share_source][:set]==:on
ft << @md.fns
end
- if @md.opt.act[:sisupod][:set]==:on #% --sisupod, -S make sisupod
+ if @md.opt.act[:sisupod][:set]==:on #% --sisupod, -S make sisupod
ft << @md.fn[:sisupod]
end
- if @md.opt.act[:xml_sax][:set]==:on #% --xml-sax, -x xml sax type
+ if @md.opt.act[:xml_sax][:set]==:on #% --xml-sax, -x xml sax type
ft << @md.fn[:sax]
end
- if @md.opt.act[:xml_dom][:set]==:on #% --xml-dom, -X xml dom type
+ if @md.opt.act[:xml_dom][:set]==:on #% --xml-dom, -X xml dom type
ft << @md.fn[:dom]
end
+ 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
@@ -3033,48 +3099,66 @@ WOK
end
@fnb=@md.fnb
else # still needed where/when param is not parsed
- if @opt.act[:html][:set]==:on #% --html, -h -H
+ if @opt.act[:html][:set]==:on #% --html, -h -H
ft << '.html' << '.html.??'
end
- if @opt.act[:concordance][:set]==:on #% --concordance, -w
+ if @opt.act[:concordance][:set]==:on #% --concordance, -w
ft << 'concordance.html' << '??.concordance.html' << 'concordance.??.html'
end
- if @opt.act[:manifest][:set]==:on #% --manifest, -y
+ if @opt.act[:manifest][:set]==:on #% --manifest, -y
ft << 'sisu_manifest.html' << '??.sisu_manifest.html' << 'sisu_manifest.??.html'
end
- if @opt.act[:txt][:set]==:on #% --txt, -t -a
+ if @opt.act[:txt][:set]==:on #% --txt, -t -a
+ ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt'
+ end
+ if @opt.act[:txt_textile][:set]==:on #% --textile
+ ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt'
+ end
+ if @opt.act[:txt_asciidoc][:set]==:on #% --asciidoc
+ ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt'
+ end
+ if @opt.act[:txt_markdown][:set]==:on #% --markdown
+ ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt'
+ end
+ if @opt.act[:txt_rst][:set]==:on #% --rst, --rest
ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt'
end
- if @opt.act[:xhtml][:set]==:on #% --xhtml, -b xhtml
+ if @opt.act[:xhtml][:set]==:on #% --xhtml, -b xhtml
ft << 'scroll.xhtml' << '??.scroll.xhtml' << 'scroll.??.xhtml'
end
- if @opt.act[:epub][:set]==:on #% --epub, -e
+ if @opt.act[:epub][:set]==:on #% --epub, -e
ft << @fnb << '.epub'
end
- if @opt.act[:manpage][:set]==:on #% --manpage, -i
+ if @opt.act[:manpage][:set]==:on #% --manpage, -i
ft << '.1' << '??.man.1' << 'man.??.1'
end
- if @opt.act[:hash_digests][:set]==:on #% --hash-digests, -N digest tree
+ if @opt.act[:hash_digests][:set]==:on #% --hash-digests, -N digest tree
ft << 'digest.txt' << '??.digest.txt' << 'digest.??.txt'
end
- if @opt.act[:odt][:set]==:on #% --odt, -o opendocument
+ if @opt.act[:odt][:set]==:on #% --odt, -o opendocument
ft << 'opendocument.odt' << '??.opendocument.odt' << 'opendocument.??.odt'
end
- if @opt.act[:pdf][:set]==:on #% --pdf-l --pdf, -p latex/ texpdf
+ if @opt.act[:pdf][:set]==:on #% --pdf-l --pdf, -p latex/ texpdf
ft << 'landscape.pdf' << 'portrait.pdf' << '.pdf'
end
if @opt.act[:share_source][:set]==:on
ft << '.sst' << '.ssi' << '.ssm'
end
- if @opt.act[:sisupod][:set]==:on #% --sisupod, -S make sisupod
+ if @opt.act[:sisupod][:set]==:on #% --sisupod, -S make sisupod
ft << '.zip'
end
- if @opt.act[:xml_sax][:set]==:on #% --xml-sax, -x xml sax type
+ if @opt.act[:xml_sax][:set]==:on #% --xml-sax, -x xml sax type
ft << 'sax.xml' << '??.sax.xml' << 'sax.??.xml'
end
- if @opt.act[:xml_dom][:set]==:on #% --xml-dom, -X xml dom type
+ if @opt.act[:xml_dom][:set]==:on #% --xml-dom, -X xml dom type
ft << 'dom.xml' << '??.dom.xml' << 'dom.??.xml'
end
+ 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
@@ -3139,16 +3223,16 @@ WOK
def remove_output
if @opt.act[:maintenance][:set] == :on
m=InfoFile.new(@opt.fnc)
- tell=SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns, 'remove maintenance files from: ' + @env.processing_path.dal)
+ tell=SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns, 'remove maintenance files from: ' + @env.processing_path.ao)
tell.warn unless @opt.cmd =~/q/
- deletion(m.marshal.dal_content)
- deletion(m.marshal.dal_idx_sst_rel_html_seg)
- deletion(m.dal_idx_sst_rel)
- deletion(m.dal_idx_html)
- deletion(m.dal_idx_xhtml)
- deletion(m.dal_metadata)
- deletion(m.dal_map_nametags)
- deletion(m.dal_map_ocn_htmlseg)
+ deletion(m.marshal.ao_content)
+ deletion(m.marshal.ao_idx_sst_rel_html_seg)
+ deletion(m.ao_idx_sst_rel)
+ deletion(m.ao_idx_html)
+ deletion(m.ao_idx_xhtml)
+ deletion(m.ao_metadata)
+ deletion(m.ao_map_nametags)
+ deletion(m.ao_map_ocn_htmlseg)
deletion(m.html_tune)
end
md=SiSU_Param::Parameters.new(@opt).get
@@ -3378,7 +3462,7 @@ WOK
end
def rsync
def document
- f=(@opt.act[:dal][:set]==:on) \
+ f=(@opt.act[:ao][:set]==:on) \
? SiSU_Env::FileOp.new(@md)
: nil
if f
@@ -3704,29 +3788,29 @@ WOK
FileUtils::mkdir_p(path) unless FileTest.directory?(path)
end
def marshal
- def dal_content
- "#{@env.processing_path.dal}/#{@fns}.content.rbm"
+ def ao_content
+ "#{@env.processing_path.ao}/#{@fns}.content.rbm"
end
- def dal_idx_sst_rel_html_seg
- "#{@env.processing_path.dal}/#{@fns}.idx_sst.rbm"
+ def ao_idx_sst_rel_html_seg
+ "#{@env.processing_path.ao}/#{@fns}.idx_sst.rbm"
end
- def dal_idx_sst_rel #used by tex & odf
- "#{@env.processing_path.dal}/#{@fns}.idx_raw.rbm"
+ def ao_idx_sst_rel #used by tex & odf
+ "#{@env.processing_path.ao}/#{@fns}.idx_raw.rbm"
end
- def dal_idx_html
- "#{@env.processing_path.dal}/#{@fns}.idx_html.rbm"
+ def ao_idx_html
+ "#{@env.processing_path.ao}/#{@fns}.idx_html.rbm"
end
- def dal_idx_xhtml
- "#{@env.processing_path.dal}/#{@fns}.idx_xhtml.rbm"
+ def ao_idx_xhtml
+ "#{@env.processing_path.ao}/#{@fns}.idx_xhtml.rbm"
end
- def dal_metadata
- "#{@env.processing_path.dal}/#{@fns}.metadata.rbm"
+ def ao_metadata
+ "#{@env.processing_path.ao}/#{@fns}.metadata.rbm"
end
- def dal_map_nametags
- "#{@env.processing_path.dal}/#{@fns}.map_name_tags.rbm"
+ def ao_map_nametags
+ "#{@env.processing_path.ao}/#{@fns}.map_name_tags.rbm"
end
- def dal_map_ocn_htmlseg
- "#{@env.processing_path.dal}/#{@fns}.map_ocn_htmlseg.rbm"
+ def ao_map_ocn_htmlseg
+ "#{@env.processing_path.ao}/#{@fns}.map_ocn_htmlseg.rbm"
end
def html_tune
"#{@env.processing_path.tune}/#{@fns}.marshal_tune"
@@ -3741,8 +3825,8 @@ WOK
end
def mkdir #check moved from FileOp, existing mkdir
def processing
- def dal
- FileUtils::mkdir_p(@env.processing_path.dal) unless FileTest.directory?(@env.processing_path.dal)
+ def ao
+ FileUtils::mkdir_p(@env.processing_path.ao) unless FileTest.directory?(@env.processing_path.ao)
end
def tune
FileUtils::mkdir_p(@env.processing_path.tune) unless FileTest.directory?(@env.processing_path.tune)
@@ -4255,7 +4339,7 @@ WOK
FileUtils::mkdir_p(output_path.base.dir) unless FileTest.directory?(output_path.base.dir)
FileUtils::mkdir_p("#{output_path.base.dir}/#{@md.fnb}") unless FileTest.directory?("#{output_path.base.dir}/#{@md.fnb}")
FileUtils::mkdir_p("#{output_path.base.dir}/#{@env.path.style}") unless FileTest.directory?("#{output_path.base.dir}/#{@env.path.style}")
- FileUtils::mkdir_p(@env.processing_path.dal) unless FileTest.directory?(@env.processing_path.dal)
+ FileUtils::mkdir_p(@env.processing_path.ao) unless FileTest.directory?(@env.processing_path.ao)
FileUtils::mkdir_p(@env.processing_path.tune) unless FileTest.directory?(@env.processing_path.tune)
end
def path_rel_links
@@ -4372,6 +4456,30 @@ WOK
fn=base_filename.txt
make_file(path,fn)
end
+ def textile
+ path=output_path.textile.dir
+ make_path(path)
+ fn=base_filename.textile
+ make_file(path,fn)
+ end
+ def asciidoc
+ path=output_path.asciidoc.dir
+ make_path(path)
+ fn=base_filename.asciidoc
+ make_file(path,fn)
+ end
+ def markdown
+ path=output_path.markdown.dir
+ make_path(path)
+ fn=base_filename.markdown
+ make_file(path,fn)
+ end
+ def rst
+ path=output_path.rst.dir
+ make_path(path)
+ fn=base_filename.rst
+ make_file(path,fn)
+ end
def html_scroll
pth=output_path.html.dir
make_path(pth)
@@ -4415,6 +4523,18 @@ WOK
fn=base_filename.xml_dom
make_file(path,fn)
end
+ def xml_docbook_book
+ path=output_path.xml_docbook_book.dir
+ make_path(path)
+ 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)
@@ -4493,6 +4613,42 @@ WOK
end
self
end
+ def textile
+ def dir
+ output_path.textile.dir + '/' + base_filename.textile
+ end
+ def rel
+ output_path.textile.rel + '/' + base_filename.textile
+ end
+ self
+ end
+ def asciidoc
+ def dir
+ output_path.asciidoc.dir + '/' + base_filename.asciidoc
+ end
+ def rel
+ output_path.asciidoc.rel + '/' + base_filename.asciidoc
+ end
+ self
+ end
+ def markdown
+ def dir
+ output_path.markdown.dir + '/' + base_filename.markdown
+ end
+ def rel
+ output_path.markdown.rel + '/' + base_filename.markdown
+ end
+ self
+ end
+ def rst
+ def dir
+ output_path.rst.dir + '/' + base_filename.rst
+ end
+ def rel
+ output_path.rst.rel + '/' + base_filename.rst
+ end
+ self
+ end
def html_scroll
def dir
output_path.html_scroll.dir + '/' + base_filename.html_scroll
@@ -4589,6 +4745,24 @@ WOK
end
self
end
+ def xml_docbook_book
+ def dir
+ output_path.xml_docbook.dir + '/' + base_filename.xml_docbook_book
+ end
+ def rel
+ output_path.xml_docbook.rel + '/' + base_filename.xml_docbook_book
+ 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
@@ -4784,6 +4958,78 @@ WOK
end
i18n(fnh)
end
+ def textile(fh=nil)
+ fh=default_hash_build(fh,Sfx[:txt_textile])
+ fh[:lng]=lang_code?(fh[:lng])
+ fnh=if output_dir_structure.by_filename?
+ {
+ fn: 'plain',
+ ft: fh[:ft],
+ lng: fh[:lng],
+ }
+ else
+ {
+ fn: fh[:fn],
+ ft: fh[:ft],
+ lng: fh[:lng],
+ }
+ end
+ i18n(fnh)
+ end
+ def asciidoc(fh=nil)
+ fh=default_hash_build(fh,Sfx[:txt_asciidoc])
+ fh[:lng]=lang_code?(fh[:lng])
+ fnh=if output_dir_structure.by_filename?
+ {
+ fn: 'plain',
+ ft: fh[:ft],
+ lng: fh[:lng],
+ }
+ else
+ {
+ fn: fh[:fn],
+ ft: fh[:ft],
+ lng: fh[:lng],
+ }
+ end
+ i18n(fnh)
+ end
+ def markdown(fh=nil)
+ fh=default_hash_build(fh,Sfx[:txt_markdown])
+ fh[:lng]=lang_code?(fh[:lng])
+ fnh=if output_dir_structure.by_filename?
+ {
+ fn: 'plain',
+ ft: fh[:ft],
+ lng: fh[:lng],
+ }
+ else
+ {
+ fn: fh[:fn],
+ ft: fh[:ft],
+ lng: fh[:lng],
+ }
+ end
+ i18n(fnh)
+ end
+ def rst(fh=nil)
+ fh=default_hash_build(fh,Sfx[:txt_rst])
+ fh[:lng]=lang_code?(fh[:lng])
+ fnh=if output_dir_structure.by_filename?
+ {
+ fn: 'plain',
+ ft: fh[:ft],
+ lng: fh[:lng],
+ }
+ else
+ {
+ fn: fh[:fn],
+ ft: fh[:ft],
+ lng: fh[:lng],
+ }
+ end
+ i18n(fnh)
+ end
def html_scroll(fh=nil)
fh=default_hash_build(fh,Sfx[:html])
fh[:lng]=lang_code?(fh[:lng])
@@ -4952,6 +5198,42 @@ WOK
end
i18n(fnh)
end
+ def xml_docbook_book(fh=nil)
+ fh=default_hash_build(fh,Sfx[:xml_docbook_book])
+ 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_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])
@@ -5560,6 +5842,90 @@ WOK
end
self
end
+ def textile
+ def ft
+ 'textile_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
+ self
+ end
+ def asciidoc
+ def ft
+ 'asciidoc_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
+ self
+ end
+ def markdown
+ def ft
+ 'markdown_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
+ self
+ end
+ def rst
+ def ft
+ 'rst_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
+ self
+ end
def html_scroll
def ft
'html'
@@ -5759,6 +6125,102 @@ WOK
xml
self
end
+ def xml_docbook
+ def ft
+ 'docbook_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_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'
+ 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_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'
@@ -6130,17 +6592,17 @@ WOK
File.new('/tmp/errorlog.sisu','w+')
end
def file_txt
- File.new("#{@env.processing_path.dal}/#{@fns}.txt",'w+')
+ File.new("#{@env.processing_path.ao}/#{@fns}.txt",'w+')
end
def file_debug
- File.new("#{@env.processing_path.dal}/#{@fns}.debug.txt",'w+')
+ File.new("#{@env.processing_path.ao}/#{@fns}.debug.txt",'w+')
end
def metaverse
def file_meta
- File.new("#{@env.processing_path.dal}/#{@fns}.meta",'w+')
+ File.new("#{@env.processing_path.ao}/#{@fns}.meta",'w+')
end
def file_meta_idx_html
- File.new("#{@env.processing_path.dal}/#{@fns}.idx.html",'w+')
+ File.new("#{@env.processing_path.ao}/#{@fns}.idx.html",'w+')
end
self
end
@@ -6148,7 +6610,7 @@ WOK
File.new("#{Dir.pwd}/#{@fns}.fn",'w+')
end
def meta
- "#{@env.processing_path.dal}/#{@fns}.meta"
+ "#{@env.processing_path.ao}/#{@fns}.meta"
end
def file_semantic
filename_semantic="./semantic.yaml"
diff --git a/lib/sisu/v5/texinfo.rb b/lib/sisu/v5/texinfo.rb
index 623cee2d..2e92268a 100644
--- a/lib/sisu/v5/texinfo.rb
+++ b/lib/sisu/v5/texinfo.rb
@@ -116,7 +116,7 @@ module SiSU_TexInfo
: SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'TexInfo',tool).green_title_hi
@md=SiSU_Param::Parameters.new(@opt).get
directories
- @marshalfile=SiSU_Env::InfoFile.new(@opt.fns).marshal.dal_content
+ @marshalfile=SiSU_Env::InfoFile.new(@opt.fns).marshal.ao_content
if FileTest.file?(@marshalfile)==true
File.open(@marshalfile) { |f| @@tuned_file=Marshal.load(f)}
#tell.meta_verse_skipped if @opt.cmd =~/[vVM]/
diff --git a/lib/sisu/v5/texpdf.rb b/lib/sisu/v5/texpdf.rb
index 2dc3e860..bf72a1a6 100644
--- a/lib/sisu/v5/texpdf.rb
+++ b/lib/sisu/v5/texpdf.rb
@@ -81,8 +81,8 @@ module SiSU_TeX
require_relative 'sysenv' # sysenv.rb
include SiSU_Env
include SiSU_Viz
- require_relative 'dal' # dal.rb
- include SiSU_DAL
+ require_relative 'ao' # ao.rb
+ include SiSU_AO
include SiSU_TeX
def initialize(opt)
@opt=opt
@@ -126,9 +126,9 @@ module SiSU_TeX
$flag=@md.opt.cmd #introduced to pass 0 for no object citation numbers... to texpdf_format
directories
#% needed needs to be reprogrammed !!!
- dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here
+ ao_array=SiSU_AO::Source.new(@opt).get # ao file drawn here
SiSU_TeX::Source::LaTeXcreate.new(@particulars).songsheet
- dal_array=''
+ ao_array=''
pwd=Dir.pwd
SiSU_TeX::Source::LaTeXtoPdf.new(@md,@particulars.env).latexrun_selective
Dir.chdir(pwd)
@@ -339,7 +339,7 @@ module SiSU_TeX
@particulars=particulars
@md=@particulars.md
@env=SiSU_Env::InfoEnv.new(@md.fns) #@env=@particulars.env
- @data=@particulars.dal_array # dal file drawn here
+ @data=@particulars.ao_array # ao file drawn here
@st={ tex: {} }
@tex_ml=SiSU_TeX_Pdf::UseTeX.new(@md)
@vz=SiSU_Viz::Defaults.new
@@ -1042,7 +1042,7 @@ module SiSU_TeX
file[:landscape].puts morph,"\n"
end
end
- elsif morph.class.inspect =~ /SiSU_DAL_DocumentStructure/ \
+ elsif morph.class.inspect =~ /SiSU_AO_DocumentStructure/ \
and morph.tmp \
and morph.tmp.is_a?(String)
if morph.is !=:code \
diff --git a/lib/sisu/v5/texpdf_format.rb b/lib/sisu/v5/texpdf_format.rb
index b20105af..556de8a6 100644
--- a/lib/sisu/v5/texpdf_format.rb
+++ b/lib/sisu/v5/texpdf_format.rb
@@ -168,7 +168,7 @@ module SiSU_TeX_Pdf
end
rows_new << r
end
- table=rows_new.join #@dob[:dal].obj=rows.join
+ table=rows_new.join #@dob[:ao].obj=rows.join
ocn_display(@dob) + start_table + table + " #{end_table}\n\\end{tiny}"
else ''
end
@@ -213,7 +213,7 @@ module SiSU_TeX_Pdf
end
rows_new << r
end
- table=rows_new.join #@dob[:dal].obj=rows.join
+ table=rows_new.join #@dob[:ao].obj=rows.join
ocn_display(@dob) + start_table + table + " #{end_table}\n\\end{tiny}"
else ''
end
diff --git a/lib/sisu/v5/txt_asciidoc.rb b/lib/sisu/v5/txt_asciidoc.rb
new file mode 100644
index 00000000..114252b1
--- /dev/null
+++ b/lib/sisu/v5/txt_asciidoc.rb
@@ -0,0 +1,588 @@
+# 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 <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Git
+ <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
+ <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/plaintext_asciidoc.rb;hb=HEAD>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: plaintext (smarttext) generation, asciidoc
+
+=end
+module SiSU_Txt_asciiDoc
+ require_relative 'ao' # ao.rb
+ require_relative 'sysenv' # sysenv.rb
+ include SiSU_Env
+ require_relative 'shared_metadata' # shared_metadata.rb
+ require_relative 'txt_shared' # txt_shared.rb
+ include SiSU_Param
+ include SiSU_Viz
+ @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0
+ @@tablefoot=''
+ class Source
+ def initialize(opt)
+ @opt=opt
+ unless @opt.fns =~/(.+?)\.(?:-|ssm\.)?sst$/
+ puts "#{sf} not a processed file type"
+ end
+ end
+ def read
+ begin
+ md=SiSU_Param::Parameters.new(@opt).get
+ env=SiSU_Env::InfoEnv.new(@opt.fns)
+ 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.text_editor} #{md.file.output_path.asciidoc.dir}/#{md.file.base_filename.asciidoc}"
+ : "[#{@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],'asciiDoc (plaintext utf-8)',tool).green_hi_blue
+ : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'asciiDoc (plaintext utf-8)',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.asciidoc.dir}/#{md.file.base_filename.asciidoc}").flow
+ end
+ end
+ ao_array=SiSU_AO::Source.new(@opt).get # ao file drawn here
+ wrap_width=if defined? md.make.plaintext_wrap \
+ and md.make.plaintext_wrap
+ md.make.plaintext_wrap
+ elsif defined? env.plaintext_wrap \
+ and env.plaintext_wrap
+ env.plaintext_wrap
+ else 78
+ end
+ #wrap_width=(defined? md.make.plaintext_wrap) ? md.make.plaintext_wrap : 78
+ SiSU_Txt_asciiDoc::Source::Scroll.new(md,ao_array,wrap_width).songsheet
+ rescue
+ SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ end
+ end
+ private
+ class Scroll <Source
+ require_relative 'defaults' # defaults.rb
+ require_relative 'txt_shared' # txt_shared.rb
+ include SiSU_TextUtils
+ @@endnotes={ para: [], end: [] }
+ def initialize(md,data,wrap_width)
+ @md,@data,@wrap_width=md,data,wrap_width
+ @env=SiSU_Env::InfoEnv.new(@md.fns)
+ @brace_url=SiSU_Viz::Defaults.new.url_decoration
+ @tab="\t"
+ @@endnotes_=case md.opt.mod.inspect
+ when /--footnote/; false
+ when /--endnote/; true
+ else true
+ end
+ @plaintext={ body: [], open: [], close: [], head: [], metadata: [], tail: [] }
+ end
+ def songsheet
+ plaintext=markup(@data)
+ publish(plaintext)
+ end
+ def break_line
+ "\n"
+ end
+ # Used for extraction of endnotes from paragraphs
+ def extract_endnotes(dob='')
+ notes=dob.obj.scan(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})([\d*+]+\s+.+?)(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/)
+ @n=[]
+ notes.flatten.each do |n| #high cost to deal with <br> appropriately within plaintext, consider
+ n=n.dup.to_s
+ if n =~/#{Mx[:br_line]}|#{Mx[:br_nl]}/
+ fix = n.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/) #watch #added
+ fix.each do |x|
+ unless x.empty?; @n << x
+ end
+ end
+ else @n << n
+ end
+ end
+ notes=@n.flatten
+ notes.each do |e|
+ util=(e.to_s =~/^\[[\d*+]+\]:/) \
+ ? (SiSU_TextUtils::Wrap.new(e.to_s,@wrap_width,4,1))
+ : (SiSU_TextUtils::Wrap.new(e.to_s,@wrap_width,1,1))
+ wrap=util.line_wrap
+ wrap=if wrap =~ /^\s*[\d*+]+\s+.+?\s*\Z/m
+ wrap.gsub(/^(\s*)([\d*+]+)\s+(.+?)\s*\Z/m, <<-GSUB
+\\1[\\2]: \\3
+ GSUB
+ )
+ else
+ wrap.gsub(/^(.+)\Z/m, <<-GSUB
+\\1
+ GSUB
+ )
+ end
+ @@endnotes[:para] << "-#{wrap}"
+ @@endnotes[:end] << '' << wrap
+ end
+ @@endnotes
+ end
+ def plaintext_metadata
+ array=SiSU_Metadata::Summary.new(@md).plaintext.metadata
+ array.each do |meta|
+ tag,inf=meta.scan(/^.+?:\s|.+/)
+ if tag and inf
+ util=SiSU_TextUtils::Wrap.new(inf,@wrap_width,15,1)
+ txt=util.line_wrap
+ @plaintext[:metadata] <<<<WOK
+
+#{@tab}#{tag}#{txt}
+WOK
+ end
+ end
+ end
+ def plaintext_tail
+# env=SiSU_Env::InfoEnv.new(@md.fns)
+ vz=SiSU_Viz::Defaults.new
+ generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version]
+ lastdone="Last Generated on: #{Time.now}"
+ rubyv="Ruby version: #{@md.ruby_version}"
+ sc=if @md.sc_info
+ "Source file: #{@md.sc_filename}#{break_line}Version number: #{@md.sc_number}#{break_line}Version date: #{@md.sc_date}#{break_line}"
+ else ''
+ end
+ @plaintext[:tail] <<<<WOK
+#{break_line}
+plaintext (plain text):
+ #{@md.file.output_path.asciidoc.url}/#{@md.file.base_filename.asciidoc}#{break_line}
+Other versions of this document: #{break_line}
+manifest:
+ #{@md.file.output_path.manifest.url}/#{@md.file.base_filename.manifest}#{break_line}
+at:
+ #{@md.file.output_path.base.url}#{break_line}
+
+#{sc}
+* #{generator}
+* #{rubyv}
+* #{lastdone}
+* SiSU #{vz.url_sisu}
+WOK
+ end
+ def decorate
+ def heading
+ def inline
+ def l1
+ '=='
+ end
+ def l2
+ '==='
+ end
+ def l3
+ '===='
+ end
+ def l4
+ '====='
+ end
+ def l5
+ '' #'======' #logical
+ end
+ def l6
+ '' #'=======' #logical
+ end
+ self
+ end
+ def underscore
+ def l1
+ '-'
+ end
+ def l2
+ '~'
+ end
+ def l3
+ '^'
+ end
+ def l4
+ '+'
+ end
+ def l5
+ '' #'.' #proposed
+ end
+ def l6
+ '' #'.' #proposed
+ end
+ self
+ end
+ self
+ end
+ def bold
+ def open
+ '*'
+ end
+ def close
+ '*'
+ end
+ self
+ end
+ def italics
+ def open
+ '_'
+ end
+ def close
+ '_'
+ end
+ self
+ end
+ def underscore
+ def open
+ ''
+ end
+ def close
+ ''
+ end
+ self
+ end
+ #def emphasis
+ # def open
+ # ''
+ # end
+ # def close
+ # ''
+ # end
+ # self
+ #end
+ def cite
+ def open
+ '"'
+ end
+ def close
+ '"'
+ end
+ self
+ end
+ def insert
+ def open
+ ''
+ end
+ def close
+ ''
+ end
+ self
+ end
+ def strike
+ def open
+ '-'
+ end
+ def close
+ '-'
+ end
+ self
+ end
+ def superscript
+ def open
+ '^'
+ end
+ def close
+ '^'
+ end
+ self
+ end
+ def subscript
+ def open
+ '~'
+ end
+ def close
+ '~'
+ end
+ self
+ end
+ def hilite #bold
+ def open
+ '*'
+ end
+ def close
+ '*'
+ end
+ self
+ end
+ def monospace
+ def open
+ '+'
+ end
+ def close
+ '+'
+ end
+ self
+ end
+ self
+ end
+ def heading_decorated_inline(dob)
+ if dob.is==:heading
+ heading_inline = case dob.lc
+ when 1 then decorate.heading.inline.l1
+ when 2 then decorate.heading.inline.l2
+ when 3 then decorate.heading.inline.l3
+ when 4 then decorate.heading.inline.l4
+ when 5 then decorate.heading.inline.l5
+ when 6 then decorate.heading.inline.l6
+ end
+ heading_inline + ' ' + dob.obj + ' ' + heading_inline
+ end
+ end
+ def heading_decorated_underscore(dob,times,p_num)
+ if dob.is==:heading
+ #times=@wrap_width if times > @wrap_width
+ case dob.lc
+ when 1 then decorate.heading.underscore.l1*times + p_num << break_line*2
+ when 2 then decorate.heading.underscore.l2*times + p_num << break_line*2
+ when 3 then decorate.heading.underscore.l3*times + p_num << break_line*2
+ when 4 then decorate.heading.underscore.l4*times + p_num << break_line*2
+ when 5 then decorate.heading.underscore.l5*times + p_num << break_line*2
+ when 6 then decorate.heading.underscore.l6*times + p_num << break_line*2
+ end
+ end
+ end
+ def plaintext_structure(dob='',p_num='') #% Used to extract the structure of a document
+ heading_decoration=:inline #(:inline|:underscore) #switch heading decoration between inline & underscore options
+ util=nil
+ wrapped=if dob.is==:para \
+ || dob.is==:heading
+ if dob.is==:heading
+ util=(heading_decoration== :inline) \
+ ? (SiSU_TextUtils::Wrap.new(heading_decorated_inline(dob),@wrap_width,0))
+ : (SiSU_TextUtils::Wrap.new(dob.obj,@wrap_width,0))
+ elsif dob.is==:para
+ if dob.hang \
+ and dob.hang =~/[0-9]/ \
+ and dob.indent != dob.hang
+ util=SiSU_TextUtils::Wrap.new(dob.obj,@wrap_width,dob.indent.to_i*2,dob.hang.to_i*2)
+ #util=SiSU_TextUtils::Wrap.new(dob.obj,@wrap_width,dob.hang.to_i*2,0)
+ elsif dob.indent =~/[1-9]/
+ util=if dob.bullet_
+ SiSU_TextUtils::Wrap.new("* #{dob.obj}",@wrap_width,dob.indent.to_i*2)
+ else SiSU_TextUtils::Wrap.new(dob.obj,@wrap_width,dob.indent.to_i*2)
+ end
+ else
+ util=if dob.bullet_
+ SiSU_TextUtils::Wrap.new("* #{dob.obj}",@wrap_width,0)
+ else SiSU_TextUtils::Wrap.new(dob.obj,@wrap_width,0)
+ end
+ end
+ else util=SiSU_TextUtils::Wrap.new(dob.obj,@wrap_width,0)
+ end
+ dob.is==:heading ? util.no_wrap_no_breaks : util.line_wrap
+ end
+ if heading_decoration== :underscore \
+ and dob.is==:heading
+ @plaintext[:body] << wrapped + p_num # main text, contents, body KEEP
+ @plaintext[:body] << heading_decorated_underscore(dob,wrapped.length,p_num)
+ else
+ @plaintext[:body] << wrapped + p_num << break_line # main text, contents, body KEEP
+ end
+ if @@endnotes[:para] \
+ and not @@endnotes_
+ @@endnotes[:para].each {|e| @plaintext[:body] << e << break_line}
+ elsif @@endnotes[:para] \
+ and @@endnotes_
+ end
+ @@endnotes[:para]=[]
+ end
+ def markup(data) # Used for major markup instructions
+ SiSU_Env::InfoEnv.new(@md.fns)
+ @data_mod,@endnotes,@level,@cont,@copen,@plaintext_contents_close=Array.new(6){[]}
+ (0..6).each { |x| @cont[x]=@level[x]=false }
+ (4..6).each { |x| @plaintext_contents_close[x]='' }
+ plaintext_tail #($1,$2)
+ plaintext_metadata
+ table_message='[table conversion awaited, see other document formats]'
+ data.each do |dob|
+ dob.obj=dob.obj.gsub(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+/um,"#{break_line}#{table_message}"). #fix
+ gsub(/.+?#{Mx[:gl_o]}-##{Mx[:gl_c]}/,''). # remove dummy headings (used by html) #check also [~-]#
+ gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,
+ "#{decorate.bold.open}\\1#{decorate.bold.close}").
+ gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,
+ "#{decorate.italics.open}\\1#{decorate.italics.close}").
+ gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,
+ "#{decorate.underscore.open}\\1#{decorate.underscore.close}").
+ gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,
+ "#{decorate.subscript.open}\\1#{decorate.subscript.close}").
+ gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,
+ "#{decorate.superscript.open}\\1#{decorate.superscript.close}").
+ gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,
+ "#{decorate.insert.open}\\1#{decorate.insert.close}").
+ gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,
+ "#{decorate.cite.open}\\1#{decorate.cite.close}").
+ gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,
+ "#{decorate.strike.open}\\1#{decorate.strike.close}").
+ gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,
+ "#{decorate.monospace.open}\\1#{decorate.monospace.close}")
+ unless dob.is==:code
+ dob.obj=dob.obj.gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/,'\1').
+ gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1').
+ gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1 [link: <\2>]').
+ gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}image/,'\1 [link: local image]').
+ gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,"#{@brace_url.txt_open}\\1#{@brace_url.txt_close}")
+ extract_endnotes(dob)
+ dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'[^\1]'). # endnote marker marked up
+ gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'[^\1]'). # endnote marker marked up
+ gsub(/#{Mx[:gl_o]}(?:#lt|#060)#{Mx[:gl_c]}/,'<').
+ gsub(/#{Mx[:gl_o]}(?:#gt|#062)#{Mx[:gl_c]}/,'>').
+ gsub(/#{Mx[:gl_o]}#(?:038|amp)#{Mx[:gl_c]}/,'&').
+ gsub(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!').
+ gsub(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#').
+ gsub(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*').
+ gsub(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-').
+ gsub(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/').
+ gsub(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_').
+ gsub(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{').
+ gsub(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}').
+ gsub(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~').
+ gsub(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'©').
+ gsub(/#{Mx[:gl_o]}#092#{Mx[:gl_c]}/,'\\')
+ end
+ dob.obj=if dob.of==:block # watch
+ dob.obj.gsub(/#{Mx[:gl_o]}●#{Mx[:gl_c]}/m,"* ").
+ gsub(/\n?#{Mx[:br_line]}\n?|\n?#{Mx[:br_nl]}\n?/m,break_line)
+ else dob.obj.gsub(/\n?#{Mx[:br_line]}\n?|\n?#{Mx[:br_nl]}\n?/m,break_line*2)
+ end
+ if dob.is==:code
+ dob.obj=dob.obj.gsub(/(^|[^}])_([<>])/m,'\1\2'). # _> _<
+ gsub(/(^|[^}])_([<>])/m,'\1\2') # _<_<
+ end
+ dob.obj=dob.obj.gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1').
+ gsub(/<a href=".+?">(.+?)<\/a>/m,'\1').
+ gsub(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,''). # remove name links
+ gsub(/&nbsp;|#{Mx[:nbsp]}/,' '). # decide on
+ gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,' [ \1 ]'). #"[ #{dir.url.images_local}\/\\1 ]")
+ gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}image/,' [ \1 ]').
+ gsub(/(?:^|[^_\\])\{\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*\}\S+/,'[image: "\1"]')
+ if dob.obj !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/
+ p_num=''
+ #ocn
+ if dob.is==:heading \
+ or dob.is==:para
+ plaintext_structure(dob,p_num)
+ elsif dob.is==:group \
+ or dob.is==:block \
+ or dob.is==:verse \
+ or dob.is==:code \
+ or dob.is==:table
+ @plaintext[:body] << dob.obj + p_num << break_line
+ elsif dob.is==:break
+ sp=' '
+ ln='-'
+ @plaintext[:body] <<=if dob.obj==Mx[:br_page] \
+ or dob.obj==Mx[:br_page_new] \
+ or dob.obj==Mx[:br_page_line]
+ "#{break_line}#{ln*40}#{break_line*2}"
+ elsif dob.obj ==Mx[:br_obj]
+ "#{break_line}#{sp*20}* * *#{break_line*2}"
+ end # following empty line (break_line) missing, fix
+ end
+ dob='' if (dob.obj =~/<a name="n\d+">/ \
+ and dob.obj =~/^(-\{{2}~\d+|<!e[:_]\d+!>)/) # -endnote
+ if dob ## Clean Prepared Text
+ dob.obj=dob.obj.gsub(/<!.+!>/,' ').
+ gsub(/<:\S+>/,' ')
+ end
+ end
+ end
+ @plaintext
+ end
+ def publish(plaintext)
+ divider='='
+ content=[]
+ content << plaintext[:open]
+ content << plaintext[:head]
+ content << plaintext[:body]
+ content << @@endnotes[:end] if @@endnotes_
+ content << "#{break_line}#{divider*@wrap_width}#{break_line}"
+ content << plaintext[:metadata]
+ content << "#{break_line}#{divider*@wrap_width}#{break_line}" if @md.stmp =~/\w+/ #not used?
+ content << plaintext[:tail]
+ Output.new(content,@md).asciidoc
+ @@endnotes={ para: [], end: [] }
+ end
+ end
+ class Output <Source
+ include SiSU_Param
+ include SiSU_Env
+ def initialize(content,md)
+ @content,@md=content,md
+ end
+ def asciidoc
+ file_plaintext=SiSU_Env::FileOp.new(@md).write_file.asciidoc
+ @sisu=[]
+ emptyline=0
+ @content.each do |para| # this is a hack
+ if para.is_a?(Array) \
+ and para.length > 0
+ para.each do |line|
+ if line
+ line=line.gsub(/[ \t]+$/m,'').
+ gsub(/^\A[ ]*\Z/m,'')
+ (line=~/^\A\Z/) \
+ ? (emptyline+=1)
+ : emptyline=0
+ if emptyline < 2 #remove additional empty lines
+ file_plaintext.puts line
+ end
+ end
+ end
+ else file_plaintext.puts para #unix plaintext # /^([*=-]|\.){5}/
+ end
+ end
+ file_plaintext.close
+ end
+ end
+ end
+end
+__END__
diff --git a/lib/sisu/v5/txt_markdown.rb b/lib/sisu/v5/txt_markdown.rb
new file mode 100644
index 00000000..89ee022d
--- /dev/null
+++ b/lib/sisu/v5/txt_markdown.rb
@@ -0,0 +1,588 @@
+# 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 <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Git
+ <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
+ <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/plaintext_markdown.rb;hb=HEAD>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: plaintext (smarttext) generation, markdown
+
+=end
+module SiSU_Txt_Markdown
+ require_relative 'ao' # ao.rb
+ require_relative 'sysenv' # sysenv.rb
+ include SiSU_Env
+ require_relative 'shared_metadata' # shared_metadata.rb
+ require_relative 'txt_shared' # txt_shared.rb
+ include SiSU_Param
+ include SiSU_Viz
+ @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0
+ @@tablefoot=''
+ class Source
+ def initialize(opt)
+ @opt=opt
+ unless @opt.fns =~/(.+?)\.(?:-|ssm\.)?sst$/
+ puts "#{sf} not a processed file type"
+ end
+ end
+ def read
+ begin
+ md=SiSU_Param::Parameters.new(@opt).get
+ env=SiSU_Env::InfoEnv.new(@opt.fns)
+ 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.text_editor} #{md.file.output_path.markdown.dir}/#{md.file.base_filename.markdown}"
+ : "[#{@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],'Markdown (plaintext utf-8)',tool).green_hi_blue
+ : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Markdown (plaintext utf-8)',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.markdown.dir}/#{md.file.base_filename.markdown}").flow
+ end
+ end
+ ao_array=SiSU_AO::Source.new(@opt).get # ao file drawn here
+ wrap_width=if defined? md.make.plaintext_wrap \
+ and md.make.plaintext_wrap
+ md.make.plaintext_wrap
+ elsif defined? env.plaintext_wrap \
+ and env.plaintext_wrap
+ env.plaintext_wrap
+ else 78
+ end
+ #wrap_width=(defined? md.make.plaintext_wrap) ? md.make.plaintext_wrap : 78
+ SiSU_Txt_Markdown::Source::Scroll.new(md,ao_array,wrap_width).songsheet
+ rescue
+ SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ end
+ end
+ private
+ class Scroll <Source
+ require_relative 'defaults' # defaults.rb
+ require_relative 'txt_shared' # txt_shared.rb
+ include SiSU_TextUtils
+ @@endnotes={ para: [], end: [] }
+ def initialize(md,data,wrap_width)
+ @md,@data,@wrap_width=md,data,wrap_width
+ @env=SiSU_Env::InfoEnv.new(@md.fns)
+ @brace_url=SiSU_Viz::Defaults.new.url_decoration
+ @tab="\t"
+ @@endnotes_=case md.opt.mod.inspect
+ when /--footnote/; false
+ when /--endnote/; true
+ else true
+ end
+ @plaintext={ body: [], open: [], close: [], head: [], metadata: [], tail: [] }
+ end
+ def songsheet
+ plaintext=markup(@data)
+ publish(plaintext)
+ end
+ def break_line
+ "\n"
+ end
+ # Used for extraction of endnotes from paragraphs
+ def extract_endnotes(dob='')
+ notes=dob.obj.scan(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})([\d*+]+\s+.+?)(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/)
+ @n=[]
+ notes.flatten.each do |n| #high cost to deal with <br> appropriately within plaintext, consider
+ n=n.dup.to_s
+ if n =~/#{Mx[:br_line]}|#{Mx[:br_nl]}/
+ fix = n.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/) #watch #added
+ fix.each do |x|
+ unless x.empty?; @n << x
+ end
+ end
+ else @n << n
+ end
+ end
+ notes=@n.flatten
+ notes.each do |e|
+ util=(e.to_s =~/^\[[\d*+]+\]:/) \
+ ? (SiSU_TextUtils::Wrap.new(e.to_s,@wrap_width,4,1))
+ : (SiSU_TextUtils::Wrap.new(e.to_s,@wrap_width,1,1))
+ wrap=util.line_wrap
+ wrap=if wrap =~ /^\s*[\d*+]+\s+.+?\s*\Z/m
+ wrap.gsub(/^(\s*)([\d*+]+)\s+(.+?)\s*\Z/m, <<-GSUB
+\\1[\\2]: \\3
+ GSUB
+ )
+ else
+ wrap.gsub(/^(.+)\Z/m, <<-GSUB
+\\1
+ GSUB
+ )
+ end
+ @@endnotes[:para] << "-#{wrap}"
+ @@endnotes[:end] << '' << wrap
+ end
+ @@endnotes
+ end
+ def plaintext_metadata
+ array=SiSU_Metadata::Summary.new(@md).plaintext.metadata
+ array.each do |meta|
+ tag,inf=meta.scan(/^.+?:\s|.+/)
+ if tag and inf
+ util=SiSU_TextUtils::Wrap.new(inf,@wrap_width,15,1)
+ txt=util.line_wrap
+ @plaintext[:metadata] <<<<WOK
+
+#{@tab}#{tag}#{txt}
+WOK
+ end
+ end
+ end
+ def plaintext_tail
+# env=SiSU_Env::InfoEnv.new(@md.fns)
+ vz=SiSU_Viz::Defaults.new
+ generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version]
+ lastdone="Last Generated on: #{Time.now}"
+ rubyv="Ruby version: #{@md.ruby_version}"
+ sc=if @md.sc_info
+ "Source file: #{@md.sc_filename}#{break_line}Version number: #{@md.sc_number}#{break_line}Version date: #{@md.sc_date}#{break_line}"
+ else ''
+ end
+ @plaintext[:tail] <<<<WOK
+#{break_line}
+plaintext (plain text):
+ #{@md.file.output_path.markdown.url}/#{@md.file.base_filename.markdown}#{break_line}
+Other versions of this document: #{break_line}
+manifest:
+ #{@md.file.output_path.manifest.url}/#{@md.file.base_filename.manifest}#{break_line}
+at:
+ #{@md.file.output_path.base.url}#{break_line}
+
+#{sc}
+* #{generator}
+* #{rubyv}
+* #{lastdone}
+* SiSU #{vz.url_sisu}
+WOK
+ end
+ def decorate
+ def heading
+ def inline #atx
+ def l1
+ '#'
+ end
+ def l2
+ '##'
+ end
+ def l3
+ '###'
+ end
+ def l4
+ '####'
+ end
+ def l5
+ '#####'
+ end
+ def l6
+ '######'
+ end
+ self
+ end
+ def underscore #Setext
+ def l1
+ '='
+ end
+ def l2
+ '-'
+ end
+ def l3
+ ''
+ end
+ def l4
+ ''
+ end
+ def l5
+ ''
+ end
+ def l6
+ ''
+ end
+ self
+ end
+ self
+ end
+ def bold
+ def open
+ '**'
+ end
+ def close
+ '**'
+ end
+ self
+ end
+ def italics
+ def open
+ '*'
+ end
+ def close
+ '*'
+ end
+ self
+ end
+ def underscore
+ def open
+ '_'
+ end
+ def close
+ '_'
+ end
+ self
+ end
+ #def emphasis
+ # def open
+ # ''
+ # end
+ # def close
+ # ''
+ # end
+ # self
+ #end
+ def cite
+ def open
+ '"'
+ end
+ def close
+ '"'
+ end
+ self
+ end
+ def insert
+ def open
+ '+'
+ end
+ def close
+ '+'
+ end
+ self
+ end
+ def strike
+ def open
+ '-'
+ end
+ def close
+ '-'
+ end
+ self
+ end
+ def superscript
+ def open
+ '^'
+ end
+ def close
+ '^'
+ end
+ self
+ end
+ def subscript
+ def open
+ '['
+ end
+ def close
+ ']'
+ end
+ self
+ end
+ def hilite
+ def open
+ '**'
+ end
+ def close
+ '**'
+ end
+ self
+ end
+ def monospace
+ def open
+ '`'
+ end
+ def close
+ '`'
+ end
+ self
+ end
+ self
+ end
+ def heading_decorated_inline(dob)
+ if dob.is==:heading
+ heading_inline = case dob.lc
+ when 1 then decorate.heading.inline.l1
+ when 2 then decorate.heading.inline.l2
+ when 3 then decorate.heading.inline.l3
+ when 4 then decorate.heading.inline.l4
+ when 5 then decorate.heading.inline.l5
+ when 6 then decorate.heading.inline.l6
+ end
+ heading_inline + ' ' + dob.obj + ' ' + heading_inline
+ end
+ end
+ def heading_decorated_underscore(dob,times,p_num)
+ if dob.is==:heading
+ #times=@wrap_width if times > @wrap_width
+ case dob.lc
+ when 1 then decorate.heading.underscore.l1*times + p_num << break_line*2
+ when 2 then decorate.heading.underscore.l2*times + p_num << break_line*2
+ when 3 then decorate.heading.underscore.l3*times + p_num << break_line*2
+ when 4 then decorate.heading.underscore.l4*times + p_num << break_line*2
+ when 5 then decorate.heading.underscore.l5*times + p_num << break_line*2
+ when 6 then decorate.heading.underscore.l6*times + p_num << break_line*2
+ end
+ end
+ end
+ def plaintext_structure(dob='',p_num='') #% Used to extract the structure of a document
+ heading_decoration=:inline #(:inline|:underscore) #switch heading decoration between inline & underscore options
+ util=nil
+ wrapped=if dob.is==:para \
+ || dob.is==:heading
+ if dob.is==:heading
+ util=(heading_decoration== :inline) \
+ ? (SiSU_TextUtils::Wrap.new(heading_decorated_inline(dob),@wrap_width,0))
+ : (SiSU_TextUtils::Wrap.new(dob.obj,@wrap_width,0))
+ elsif dob.is==:para
+ if dob.hang \
+ and dob.hang =~/[0-9]/ \
+ and dob.indent != dob.hang
+ util=SiSU_TextUtils::Wrap.new(dob.obj,@wrap_width,dob.indent.to_i*2,dob.hang.to_i*2)
+ #util=SiSU_TextUtils::Wrap.new(dob.obj,@wrap_width,dob.hang.to_i*2,0)
+ elsif dob.indent =~/[1-9]/
+ util=if dob.bullet_
+ SiSU_TextUtils::Wrap.new("* #{dob.obj}",@wrap_width,dob.indent.to_i*2)
+ else SiSU_TextUtils::Wrap.new(dob.obj,@wrap_width,dob.indent.to_i*2)
+ end
+ else
+ util=if dob.bullet_
+ SiSU_TextUtils::Wrap.new("* #{dob.obj}",@wrap_width,0)
+ else SiSU_TextUtils::Wrap.new(dob.obj,@wrap_width,0)
+ end
+ end
+ else util=SiSU_TextUtils::Wrap.new(dob.obj,@wrap_width,0)
+ end
+ dob.is==:heading ? util.no_wrap_no_breaks : util.line_wrap
+ end
+ if heading_decoration== :underscore \
+ and dob.is==:heading
+ @plaintext[:body] << wrapped + p_num # main text, contents, body KEEP
+ @plaintext[:body] << heading_decorated_underscore(dob,wrapped.length,p_num)
+ else
+ @plaintext[:body] << wrapped + p_num << break_line # main text, contents, body KEEP
+ end
+ if @@endnotes[:para] \
+ and not @@endnotes_
+ @@endnotes[:para].each {|e| @plaintext[:body] << e << break_line}
+ elsif @@endnotes[:para] \
+ and @@endnotes_
+ end
+ @@endnotes[:para]=[]
+ end
+ def markup(data) # Used for major markup instructions
+ SiSU_Env::InfoEnv.new(@md.fns)
+ @data_mod,@endnotes,@level,@cont,@copen,@plaintext_contents_close=Array.new(6){[]}
+ (0..6).each { |x| @cont[x]=@level[x]=false }
+ (4..6).each { |x| @plaintext_contents_close[x]='' }
+ plaintext_tail #($1,$2)
+ plaintext_metadata
+ table_message='[table conversion awaited, see other document formats]'
+ data.each do |dob|
+ dob.obj=dob.obj.gsub(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+/um,"#{break_line}#{table_message}"). #fix
+ gsub(/.+?#{Mx[:gl_o]}-##{Mx[:gl_c]}/,''). # remove dummy headings (used by html) #check also [~-]#
+ gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,
+ "#{decorate.bold.open}\\1#{decorate.bold.close}").
+ gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,
+ "#{decorate.italics.open}\\1#{decorate.italics.close}").
+ gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,
+ "#{decorate.underscore.open}\\1#{decorate.underscore.close}").
+ gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,
+ "#{decorate.subscript.open}\\1#{decorate.subscript.close}").
+ gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,
+ "#{decorate.superscript.open}\\1#{decorate.superscript.close}").
+ gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,
+ "#{decorate.insert.open}\\1#{decorate.insert.close}").
+ gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,
+ "#{decorate.cite.open}\\1#{decorate.cite.close}").
+ gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,
+ "#{decorate.strike.open}\\1#{decorate.strike.close}").
+ gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,
+ "#{decorate.monospace.open}\\1#{decorate.monospace.close}")
+ unless dob.is==:code
+ dob.obj=dob.obj.gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/,'\1').
+ gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1').
+ gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1 [link: <\2>]').
+ gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}image/,'\1 [link: local image]').
+ gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,"#{@brace_url.txt_open}\\1#{@brace_url.txt_close}")
+ extract_endnotes(dob)
+ dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'[^\1]'). # endnote marker marked up
+ gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'[^\1]'). # endnote marker marked up
+ gsub(/#{Mx[:gl_o]}(?:#lt|#060)#{Mx[:gl_c]}/,'<').
+ gsub(/#{Mx[:gl_o]}(?:#gt|#062)#{Mx[:gl_c]}/,'>').
+ gsub(/#{Mx[:gl_o]}#(?:038|amp)#{Mx[:gl_c]}/,'&').
+ gsub(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!').
+ gsub(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#').
+ gsub(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*').
+ gsub(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-').
+ gsub(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/').
+ gsub(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_').
+ gsub(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{').
+ gsub(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}').
+ gsub(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~').
+ gsub(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'©').
+ gsub(/#{Mx[:gl_o]}#092#{Mx[:gl_c]}/,'\\')
+ end
+ dob.obj=if dob.of==:block # watch
+ dob.obj.gsub(/#{Mx[:gl_o]}●#{Mx[:gl_c]}/m,"* ").
+ gsub(/\n?#{Mx[:br_line]}\n?|\n?#{Mx[:br_nl]}\n?/m,break_line)
+ else dob.obj.gsub(/\n?#{Mx[:br_line]}\n?|\n?#{Mx[:br_nl]}\n?/m,break_line*2)
+ end
+ if dob.is==:code
+ dob.obj=dob.obj.gsub(/(^|[^}])_([<>])/m,'\1\2'). # _> _<
+ gsub(/(^|[^}])_([<>])/m,'\1\2') # _<_<
+ end
+ dob.obj=dob.obj.gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1').
+ gsub(/<a href=".+?">(.+?)<\/a>/m,'\1').
+ gsub(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,''). # remove name links
+ gsub(/&nbsp;|#{Mx[:nbsp]}/,' '). # decide on
+ gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,' [ \1 ]'). #"[ #{dir.url.images_local}\/\\1 ]")
+ gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}image/,' [ \1 ]').
+ gsub(/(?:^|[^_\\])\{\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*\}\S+/,'[image: "\1"]')
+ if dob.obj !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/
+ p_num=''
+ #ocn
+ if dob.is==:heading \
+ or dob.is==:para
+ plaintext_structure(dob,p_num)
+ elsif dob.is==:group \
+ or dob.is==:block \
+ or dob.is==:verse \
+ or dob.is==:code \
+ or dob.is==:table
+ @plaintext[:body] << dob.obj + p_num << break_line
+ elsif dob.is==:break
+ sp=' '
+ ln='-'
+ @plaintext[:body] <<=if dob.obj==Mx[:br_page] \
+ or dob.obj==Mx[:br_page_new] \
+ or dob.obj==Mx[:br_page_line]
+ "#{break_line}#{ln*40}#{break_line*2}"
+ elsif dob.obj ==Mx[:br_obj]
+ "#{break_line}#{sp*20}* * *#{break_line*2}"
+ end # following empty line (break_line) missing, fix
+ end
+ dob='' if (dob.obj =~/<a name="n\d+">/ \
+ and dob.obj =~/^(-\{{2}~\d+|<!e[:_]\d+!>)/) # -endnote
+ if dob ## Clean Prepared Text
+ dob.obj=dob.obj.gsub(/<!.+!>/,' ').
+ gsub(/<:\S+>/,' ')
+ end
+ end
+ end
+ @plaintext
+ end
+ def publish(plaintext)
+ divider='='
+ content=[]
+ content << plaintext[:open]
+ content << plaintext[:head]
+ content << plaintext[:body]
+ content << @@endnotes[:end] if @@endnotes_
+ content << "#{break_line}#{divider*@wrap_width}#{break_line}"
+ content << plaintext[:metadata]
+ content << "#{break_line}#{divider*@wrap_width}#{break_line}" if @md.stmp =~/\w+/ #not used?
+ content << plaintext[:tail]
+ Output.new(content,@md).markdown
+ @@endnotes={ para: [], end: [] }
+ end
+ end
+ class Output <Source
+ include SiSU_Param
+ include SiSU_Env
+ def initialize(content,md)
+ @content,@md=content,md
+ end
+ def markdown
+ file_plaintext=SiSU_Env::FileOp.new(@md).write_file.markdown
+ @sisu=[]
+ emptyline=0
+ @content.each do |para| # this is a hack
+ if para.is_a?(Array) \
+ and para.length > 0
+ para.each do |line|
+ if line
+ line=line.gsub(/[ \t]+$/m,'').
+ gsub(/^\A[ ]*\Z/m,'')
+ (line=~/^\A\Z/) \
+ ? (emptyline+=1)
+ : emptyline=0
+ if emptyline < 2 #remove additional empty lines
+ file_plaintext.puts line
+ end
+ end
+ end
+ else file_plaintext.puts para #unix plaintext # /^([*=-]|\.){5}/
+ end
+ end
+ file_plaintext.close
+ end
+ end
+ end
+end
+__END__
diff --git a/lib/sisu/v5/plaintext.rb b/lib/sisu/v5/txt_plain.rb
index b82013aa..0cd50254 100644
--- a/lib/sisu/v5/plaintext.rb
+++ b/lib/sisu/v5/txt_plain.rb
@@ -60,14 +60,12 @@
linefeed)
=end
-module SiSU_Plaintext
- require_relative 'dal' # dal.rb
+module SiSU_Txt_Plain
+ require_relative 'ao' # ao.rb
require_relative 'sysenv' # sysenv.rb
include SiSU_Env
- require_relative 'plaintext_format' # plaintext_format.rb
- include SiSU_Plaintext_Format
require_relative 'shared_metadata' # shared_metadata.rb
- require_relative 'shared_txt' # shared_txt.rb
+ require_relative 'txt_shared' # txt_shared.rb
include SiSU_Param
include SiSU_Viz
@@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0
@@ -99,7 +97,7 @@ module SiSU_Plaintext
SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{md.file.output_path.txt.dir}/#{md.file.base_filename.txt}").flow
end
end
- dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here
+ ao_array=SiSU_AO::Source.new(@opt).get # ao file drawn here
wrap_width=if defined? md.make.plaintext_wrap \
and md.make.plaintext_wrap
md.make.plaintext_wrap
@@ -109,7 +107,7 @@ module SiSU_Plaintext
else 78
end
#wrap_width=(defined? md.make.plaintext_wrap) ? md.make.plaintext_wrap : 78
- SiSU_Plaintext::Source::Scroll.new(md,dal_array,wrap_width).songsheet
+ SiSU_Txt_Plain::Source::Scroll.new(md,ao_array,wrap_width).songsheet
rescue
SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do
__LINE__.to_s + ':' + __FILE__
@@ -120,7 +118,7 @@ module SiSU_Plaintext
private
class Scroll <Source
require_relative 'defaults' # defaults.rb
- require_relative 'shared_txt' # shared_txt.rb
+ require_relative 'txt_shared' # txt_shared.rb
include SiSU_TextUtils
@@endnotes={ para: [], end: [] }
def initialize(md,data,wrap_width)
@@ -133,13 +131,15 @@ module SiSU_Plaintext
when /--endnote/; true
else true
end
- @br="\n"
@plaintext={ body: [], open: [], close: [], head: [], metadata: [], tail: [] }
end
def songsheet
plaintext=markup(@data)
publish(plaintext)
end
+ def break_line
+ "\n"
+ end
# Used for extraction of endnotes from paragraphs
def extract_endnotes(dob='')
notes=dob.obj.scan(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})([\d*+]+\s+.+?)(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/)
@@ -198,18 +198,18 @@ WOK
lastdone="Last Generated on: #{Time.now}"
rubyv="Ruby version: #{@md.ruby_version}"
sc=if @md.sc_info
- "Source file: #{@md.sc_filename}#{@br}Version number: #{@md.sc_number}#{@br}Version date: #{@md.sc_date}#{@br}"
+ "Source file: #{@md.sc_filename}#{break_line}Version number: #{@md.sc_number}#{break_line}Version date: #{@md.sc_date}#{break_line}"
else ''
end
@plaintext[:tail] <<<<WOK
-#{@br}
+#{break_line}
plaintext (plain text):
- #{@md.file.output_path.txt.url}/#{@md.file.base_filename.txt}#{@br}
-Other versions of this document: #{@br}
+ #{@md.file.output_path.txt.url}/#{@md.file.base_filename.txt}#{break_line}
+Other versions of this document: #{break_line}
manifest:
- #{@md.file.output_path.manifest.url}/#{@md.file.base_filename.manifest}#{@br}
+ #{@md.file.output_path.manifest.url}/#{@md.file.base_filename.manifest}#{break_line}
at:
- #{@md.file.output_path.base.url}#{@br}
+ #{@md.file.output_path.base.url}#{break_line}
#{sc}
* #{generator}
@@ -376,24 +376,34 @@ WOK
times=wrapped.length
times=@wrap_width if times > @wrap_width
@plaintext[:body] << case lv
- when 1; wrapped.upcase << @br << decorate.heading_underscore.l1*times + p_num << @br*2
- when 2; wrapped.upcase << @br << decorate.heading_underscore.l2*times + p_num << @br*2
- when 3; wrapped.upcase << @br << decorate.heading_underscore.l3*times + p_num << @br*2
- when 4; wrapped.upcase << @br << decorate.heading_underscore.l4*times + p_num << @br*2
- when 5; wrapped.upcase << @br << decorate.heading_underscore.l5*times + p_num << @br*2
- when 6; wrapped.upcase << @br << decorate.heading_underscore.l6*times + p_num << @br*2
+ when 1; wrapped.upcase << break_line << decorate.heading_underscore.l1*times + p_num << break_line*2
+ when 2; wrapped.upcase << break_line << decorate.heading_underscore.l2*times + p_num << break_line*2
+ when 3; wrapped.upcase << break_line << decorate.heading_underscore.l3*times + p_num << break_line*2
+ when 4; wrapped.upcase << break_line << decorate.heading_underscore.l4*times + p_num << break_line*2
+ when 5; wrapped.upcase << break_line << decorate.heading_underscore.l5*times + p_num << break_line*2
+ when 6; wrapped.upcase << break_line << decorate.heading_underscore.l6*times + p_num << break_line*2
end
else
- @plaintext[:body] << wrapped + p_num << @br # main text, contents, body KEEP
+ @plaintext[:body] << wrapped + p_num << break_line # main text, contents, body KEEP
end
if @@endnotes[:para] \
and not @@endnotes_
- @@endnotes[:para].each {|e| @plaintext[:body] << e << @br}
+ @@endnotes[:para].each {|e| @plaintext[:body] << e << break_line}
elsif @@endnotes[:para] \
and @@endnotes_
end
@@endnotes[:para]=[]
end
+ def ocn_display(dob)
+ if @env.plaintext_ocn?
+ if defined? dob.ocn \
+ and dob.ocn.is_a?(Fixnum)
+ (defined? dob.ocn) ? "\n#{Dx[:ocn_o]}#{dob.ocn}#{Dx[:ocn_c]}" : ''
+ else ''
+ end
+ else ''
+ end
+ end
def markup(data) # Used for major markup instructions
SiSU_Env::InfoEnv.new(@md.fns)
@data_mod,@endnotes,@level,@cont,@copen,@plaintext_contents_close=Array.new(6){[]}
@@ -403,7 +413,7 @@ WOK
plaintext_metadata
table_message='[table omitted, see other document formats]'
data.each do |dob|
- dob.obj=dob.obj.gsub(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+/um,"#{@br}#{table_message}"). #fix
+ dob.obj=dob.obj.gsub(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+/um,"#{break_line}#{table_message}"). #fix
gsub(/.+?#{Mx[:gl_o]}-##{Mx[:gl_c]}/,''). # remove dummy headings (used by html) #check also [~-]#
gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,
"#{decorate.bold.open}\\1#{decorate.bold.close}").
@@ -449,8 +459,8 @@ WOK
end
dob.obj=if dob.of==:block # watch
dob.obj.gsub(/#{Mx[:gl_o]}●#{Mx[:gl_c]}/m,"* ").
- gsub(/\n?#{Mx[:br_line]}\n?|\n?#{Mx[:br_nl]}\n?/m,@br)
- else dob.obj.gsub(/\n?#{Mx[:br_line]}\n?|\n?#{Mx[:br_nl]}\n?/m,@br*2)
+ gsub(/\n?#{Mx[:br_line]}\n?|\n?#{Mx[:br_nl]}\n?/m,break_line)
+ else dob.obj.gsub(/\n?#{Mx[:br_line]}\n?|\n?#{Mx[:br_nl]}\n?/m,break_line*2)
end
if dob.is==:code
dob.obj=dob.obj.gsub(/(^|[^}])_([<>])/m,'\1\2'). # _> _<
@@ -464,13 +474,7 @@ WOK
gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}image/,' [ \1 ]').
gsub(/(?:^|[^_\\])\{\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*\}\S+/,'[image: "\1"]')
if dob.obj !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/
- p_num=''
- if @env.plaintext_ocn?
- if defined? dob.ocn \
- and dob.ocn.is_a?(Fixnum)
- p_num=SiSU_Plaintext_Format::ParagraphNumber.new(dob.ocn).display
- end
- end
+ p_num=ocn_display(dob)
if dob.is==:heading \
or dob.is==:para
plaintext_structure(dob,p_num)
@@ -479,17 +483,17 @@ WOK
or dob.is==:verse \
or dob.is==:code \
or dob.is==:table
- @plaintext[:body] << dob.obj + p_num << @br
+ @plaintext[:body] << dob.obj + p_num << break_line
elsif dob.is==:break
sp=' '
ln='-'
@plaintext[:body] <<=if dob.obj==Mx[:br_page] \
or dob.obj==Mx[:br_page_new] \
or dob.obj==Mx[:br_page_line]
- "#{@br}#{ln*40}#{@br*2}"
+ "#{break_line}#{ln*40}#{break_line*2}"
elsif dob.obj ==Mx[:br_obj]
- "#{@br}#{sp*20}* * *#{@br*2}"
- end # following empty line (@br) missing, fix
+ "#{break_line}#{sp*20}* * *#{break_line*2}"
+ end # following empty line (break_line) missing, fix
end
dob='' if (dob.obj =~/<a name="n\d+">/ \
and dob.obj =~/^(-\{{2}~\d+|<!e[:_]\d+!>)/) # -endnote
@@ -508,9 +512,9 @@ WOK
content << plaintext[:head]
content << plaintext[:body]
content << @@endnotes[:end] if @@endnotes_
- content << "#{@br}#{divider*@wrap_width}#{@br}"
+ content << "#{break_line}#{divider*@wrap_width}#{break_line}"
content << plaintext[:metadata]
- content << "#{@br}#{divider*@wrap_width}#{@br}" if @md.stmp =~/\w+/ #not used?
+ content << "#{break_line}#{divider*@wrap_width}#{break_line}" if @md.stmp =~/\w+/ #not used?
content << plaintext[:tail]
Output.new(content,@md).plaintext
@@endnotes={ para: [], end: [] }
diff --git a/lib/sisu/v5/txt_rst.rb b/lib/sisu/v5/txt_rst.rb
new file mode 100644
index 00000000..c98bb275
--- /dev/null
+++ b/lib/sisu/v5/txt_rst.rb
@@ -0,0 +1,550 @@
+# 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 <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Git
+ <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
+ <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/plaintext_rst.rb;hb=HEAD>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: plaintext (smarttext) generation, rST
+
+=end
+module SiSU_Txt_rST
+ require_relative 'ao' # ao.rb
+ require_relative 'sysenv' # sysenv.rb
+ include SiSU_Env
+ require_relative 'shared_metadata' # shared_metadata.rb
+ require_relative 'txt_shared' # txt_shared.rb
+ include SiSU_Param
+ include SiSU_Viz
+ @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0
+ @@tablefoot=''
+ class Source
+ def initialize(opt)
+ @opt=opt
+ unless @opt.fns =~/(.+?)\.(?:-|ssm\.)?sst$/
+ puts "#{sf} not a processed file type"
+ end
+ end
+ def read
+ begin
+ md=SiSU_Param::Parameters.new(@opt).get
+ env=SiSU_Env::InfoEnv.new(@opt.fns)
+ 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.text_editor} #{md.file.output_path.rst.dir}/#{md.file.base_filename.rst}"
+ : "[#{@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],'rST (plaintext utf-8)',tool).green_hi_blue
+ : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'rST (plaintext utf-8)',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.rst.dir}/#{md.file.base_filename.rst}").flow
+ end
+ end
+ ao_array=SiSU_AO::Source.new(@opt).get # ao file drawn here
+ wrap_width=if defined? md.make.plaintext_wrap \
+ and md.make.plaintext_wrap
+ md.make.plaintext_wrap
+ elsif defined? env.plaintext_wrap \
+ and env.plaintext_wrap
+ env.plaintext_wrap
+ else 78
+ end
+ #wrap_width=(defined? md.make.plaintext_wrap) ? md.make.plaintext_wrap : 78
+ SiSU_Txt_rST::Source::Scroll.new(md,ao_array,wrap_width).songsheet
+ rescue
+ SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ end
+ end
+ private
+ class Scroll <Source
+ require_relative 'defaults' # defaults.rb
+ require_relative 'txt_shared' # txt_shared.rb
+ include SiSU_TextUtils
+ @@endnotes={ para: [], end: [] }
+ def initialize(md,data,wrap_width)
+ @md,@data,@wrap_width=md,data,wrap_width
+ @env=SiSU_Env::InfoEnv.new(@md.fns)
+ @brace_url=SiSU_Viz::Defaults.new.url_decoration
+ @tab="\t"
+ @@endnotes_=case md.opt.mod.inspect
+ when /--footnote/; false
+ when /--endnote/; true
+ else true
+ end
+ @plaintext={ body: [], open: [], close: [], head: [], metadata: [], tail: [] }
+ end
+ def songsheet
+ plaintext=markup(@data)
+ publish(plaintext)
+ end
+ def break_line
+ "\n"
+ end
+ # Used for extraction of endnotes from paragraphs
+ def extract_endnotes(dob='')
+ notes=dob.obj.scan(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})([\d*+]+\s+.+?)(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/)
+ @n=[]
+ notes.flatten.each do |n| #high cost to deal with <br> appropriately within plaintext, consider
+ n=n.dup.to_s
+ if n =~/#{Mx[:br_line]}|#{Mx[:br_nl]}/
+ fix = n.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/) #watch #added
+ fix.each do |x|
+ unless x.empty?; @n << x
+ end
+ end
+ else @n << n
+ end
+ end
+ notes=@n.flatten
+ notes.each do |e|
+ util=(e.to_s =~/^\[[\d*+]+\]:/) \
+ ? (SiSU_TextUtils::Wrap.new(e.to_s,@wrap_width,4,1))
+ : (SiSU_TextUtils::Wrap.new(e.to_s,@wrap_width,1,1))
+ wrap=util.line_wrap
+ wrap=if wrap =~ /^\s*[\d*+]+\s+.+?\s*\Z/m
+ wrap.gsub(/^(\s*)([\d*+]+)\s+(.+?)\s*\Z/m, <<-GSUB
+\\1[\\2]: \\3
+ GSUB
+ )
+ else
+ wrap.gsub(/^(.+)\Z/m, <<-GSUB
+\\1
+ GSUB
+ )
+ end
+ @@endnotes[:para] << "-#{wrap}"
+ @@endnotes[:end] << '' << wrap
+ end
+ @@endnotes
+ end
+ def plaintext_metadata
+ array=SiSU_Metadata::Summary.new(@md).plaintext.metadata
+ array.each do |meta|
+ tag,inf=meta.scan(/^.+?:\s|.+/)
+ if tag and inf
+ util=SiSU_TextUtils::Wrap.new(inf,@wrap_width,15,1)
+ txt=util.line_wrap
+ @plaintext[:metadata] <<<<WOK
+
+#{@tab}#{tag}#{txt}
+WOK
+ end
+ end
+ end
+ def plaintext_tail
+# env=SiSU_Env::InfoEnv.new(@md.fns)
+ vz=SiSU_Viz::Defaults.new
+ generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version]
+ lastdone="Last Generated on: #{Time.now}"
+ rubyv="Ruby version: #{@md.ruby_version}"
+ sc=if @md.sc_info
+ "Source file: #{@md.sc_filename}#{break_line}Version number: #{@md.sc_number}#{break_line}Version date: #{@md.sc_date}#{break_line}"
+ else ''
+ end
+ @plaintext[:tail] <<<<WOK
+#{break_line}
+plaintext (plain text):
+ #{@md.file.output_path.rst.url}/#{@md.file.base_filename.rst}#{break_line}
+Other versions of this document: #{break_line}
+manifest:
+ #{@md.file.output_path.manifest.url}/#{@md.file.base_filename.manifest}#{break_line}
+at:
+ #{@md.file.output_path.base.url}#{break_line}
+
+#{sc}
+* #{generator}
+* #{rubyv}
+* #{lastdone}
+* SiSU #{vz.url_sisu}
+WOK
+ end
+ def decorate
+ def heading
+ def underscore
+ def l1
+ '='
+ end
+ def l2
+ '-'
+ end
+ def l3
+ '`'
+ end
+ def l4
+ ':'
+ end
+ def l5
+ "'"
+ end
+ def l6
+ '"'
+ end
+ self
+ end
+ self
+ end
+ def bold
+ def open
+ '*'
+ end
+ def close
+ '*'
+ end
+ self
+ end
+ def italics
+ def open
+ '/'
+ end
+ def close
+ '/'
+ end
+ self
+ end
+ def underscore
+ def open
+ '_'
+ end
+ def close
+ '_'
+ end
+ self
+ end
+ #def emphasis
+ # def open
+ # ''
+ # end
+ # def close
+ # ''
+ # end
+ # self
+ #end
+ def cite
+ def open
+ '"'
+ end
+ def close
+ '"'
+ end
+ self
+ end
+ def insert
+ def open
+ '+'
+ end
+ def close
+ '+'
+ end
+ self
+ end
+ def strike
+ def open
+ '-'
+ end
+ def close
+ '-'
+ end
+ self
+ end
+ def superscript
+ def open
+ '^'
+ end
+ def close
+ '^'
+ end
+ self
+ end
+ def subscript
+ def open
+ '['
+ end
+ def close
+ ']'
+ end
+ self
+ end
+ def hilite
+ def open
+ '*'
+ end
+ def close
+ '*'
+ end
+ self
+ end
+ def monospace
+ def open
+ '#'
+ end
+ def close
+ '#'
+ end
+ self
+ end
+ self
+ end
+ def heading_decorated_underscore(dob,times,p_num)
+ if dob.is==:heading
+ #times=@wrap_width if times > @wrap_width
+ case dob.lc
+ when 1 then decorate.heading.underscore.l1*times + p_num << break_line*2
+ when 2 then decorate.heading.underscore.l2*times + p_num << break_line*2
+ when 3 then decorate.heading.underscore.l3*times + p_num << break_line*2
+ when 4 then decorate.heading.underscore.l4*times + p_num << break_line*2
+ when 5 then decorate.heading.underscore.l5*times + p_num << break_line*2
+ when 6 then decorate.heading.underscore.l6*times + p_num << break_line*2
+ end
+ end
+ end
+ def plaintext_structure(dob='',p_num='') #% Used to extract the structure of a document
+ util=nil
+ wrapped=if dob.is==:para \
+ || dob.is==:heading
+ if dob.is==:heading
+ util=SiSU_TextUtils::Wrap.new(dob.obj,@wrap_width,0)
+ elsif dob.is==:para
+ if dob.hang \
+ and dob.hang =~/[0-9]/ \
+ and dob.indent != dob.hang
+ util=SiSU_TextUtils::Wrap.new(dob.obj,@wrap_width,dob.indent.to_i*2,dob.hang.to_i*2)
+ #util=SiSU_TextUtils::Wrap.new(dob.obj,@wrap_width,dob.hang.to_i*2,0)
+ elsif dob.indent =~/[1-9]/
+ util=if dob.bullet_
+ SiSU_TextUtils::Wrap.new("* #{dob.obj}",@wrap_width,dob.indent.to_i*2)
+ else SiSU_TextUtils::Wrap.new(dob.obj,@wrap_width,dob.indent.to_i*2)
+ end
+ else
+ util=if dob.bullet_
+ SiSU_TextUtils::Wrap.new("* #{dob.obj}",@wrap_width,0)
+ else SiSU_TextUtils::Wrap.new(dob.obj,@wrap_width,0)
+ end
+ end
+ else util=SiSU_TextUtils::Wrap.new(dob.obj,@wrap_width,0)
+ end
+ dob.is==:heading ? util.no_wrap_no_breaks : util.line_wrap
+ end
+ if dob.is==:heading
+ @plaintext[:body] << wrapped + p_num # main text, contents, body KEEP
+ @plaintext[:body] << heading_decorated_underscore(dob,wrapped.length,p_num)
+ else
+ @plaintext[:body] << wrapped + p_num << break_line # main text, contents, body KEEP
+ end
+ if @@endnotes[:para] \
+ and not @@endnotes_
+ @@endnotes[:para].each {|e| @plaintext[:body] << e << break_line}
+ elsif @@endnotes[:para] \
+ and @@endnotes_
+ end
+ @@endnotes[:para]=[]
+ end
+ def markup(data) # Used for major markup instructions
+ SiSU_Env::InfoEnv.new(@md.fns)
+ @data_mod,@endnotes,@level,@cont,@copen,@plaintext_contents_close=Array.new(6){[]}
+ (0..6).each { |x| @cont[x]=@level[x]=false }
+ (4..6).each { |x| @plaintext_contents_close[x]='' }
+ plaintext_tail #($1,$2)
+ plaintext_metadata
+ table_message='[table conversion awaited, see other document formats]'
+ data.each do |dob|
+ dob.obj=dob.obj.gsub(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+/um,"#{break_line}#{table_message}"). #fix
+ gsub(/.+?#{Mx[:gl_o]}-##{Mx[:gl_c]}/,''). # remove dummy headings (used by html) #check also [~-]#
+ gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,
+ "#{decorate.bold.open}\\1#{decorate.bold.close}").
+ gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,
+ "#{decorate.italics.open}\\1#{decorate.italics.close}").
+ gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,
+ "#{decorate.underscore.open}\\1#{decorate.underscore.close}").
+ gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,
+ "#{decorate.subscript.open}\\1#{decorate.subscript.close}").
+ gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,
+ "#{decorate.superscript.open}\\1#{decorate.superscript.close}").
+ gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,
+ "#{decorate.insert.open}\\1#{decorate.insert.close}").
+ gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,
+ "#{decorate.cite.open}\\1#{decorate.cite.close}").
+ gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,
+ "#{decorate.strike.open}\\1#{decorate.strike.close}").
+ gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,
+ "#{decorate.monospace.open}\\1#{decorate.monospace.close}")
+ unless dob.is==:code
+ dob.obj=dob.obj.gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/,'\1').
+ gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1').
+ gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1 [link: <\2>]').
+ gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}image/,'\1 [link: local image]').
+ gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,"#{@brace_url.txt_open}\\1#{@brace_url.txt_close}")
+ extract_endnotes(dob)
+ dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'[^\1]'). # endnote marker marked up
+ gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'[^\1]'). # endnote marker marked up
+ gsub(/#{Mx[:gl_o]}(?:#lt|#060)#{Mx[:gl_c]}/,'<').
+ gsub(/#{Mx[:gl_o]}(?:#gt|#062)#{Mx[:gl_c]}/,'>').
+ gsub(/#{Mx[:gl_o]}#(?:038|amp)#{Mx[:gl_c]}/,'&').
+ gsub(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!').
+ gsub(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#').
+ gsub(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*').
+ gsub(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-').
+ gsub(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/').
+ gsub(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_').
+ gsub(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{').
+ gsub(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}').
+ gsub(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~').
+ gsub(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'©').
+ gsub(/#{Mx[:gl_o]}#092#{Mx[:gl_c]}/,'\\')
+ end
+ dob.obj=if dob.of==:block # watch
+ dob.obj.gsub(/#{Mx[:gl_o]}●#{Mx[:gl_c]}/m,"* ").
+ gsub(/\n?#{Mx[:br_line]}\n?|\n?#{Mx[:br_nl]}\n?/m,break_line)
+ else dob.obj.gsub(/\n?#{Mx[:br_line]}\n?|\n?#{Mx[:br_nl]}\n?/m,break_line*2)
+ end
+ if dob.is==:code
+ dob.obj=dob.obj.gsub(/(^|[^}])_([<>])/m,'\1\2'). # _> _<
+ gsub(/(^|[^}])_([<>])/m,'\1\2') # _<_<
+ end
+ dob.obj=dob.obj.gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1').
+ gsub(/<a href=".+?">(.+?)<\/a>/m,'\1').
+ gsub(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,''). # remove name links
+ gsub(/&nbsp;|#{Mx[:nbsp]}/,' '). # decide on
+ gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,' [ \1 ]'). #"[ #{dir.url.images_local}\/\\1 ]")
+ gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}image/,' [ \1 ]').
+ gsub(/(?:^|[^_\\])\{\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*\}\S+/,'[image: "\1"]')
+ if dob.obj !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/
+ p_num=''
+ #ocn
+ if dob.is==:heading \
+ or dob.is==:para
+ plaintext_structure(dob,p_num)
+ elsif dob.is==:group \
+ or dob.is==:block \
+ or dob.is==:verse \
+ or dob.is==:code \
+ or dob.is==:table
+ @plaintext[:body] << dob.obj + p_num << break_line
+ elsif dob.is==:break
+ sp=' '
+ ln='-'
+ @plaintext[:body] <<=if dob.obj==Mx[:br_page] \
+ or dob.obj==Mx[:br_page_new] \
+ or dob.obj==Mx[:br_page_line]
+ "#{break_line}#{ln*40}#{break_line*2}"
+ elsif dob.obj ==Mx[:br_obj]
+ "#{break_line}#{sp*20}* * *#{break_line*2}"
+ end # following empty line (break_line) missing, fix
+ end
+ dob='' if (dob.obj =~/<a name="n\d+">/ \
+ and dob.obj =~/^(-\{{2}~\d+|<!e[:_]\d+!>)/) # -endnote
+ if dob ## Clean Prepared Text
+ dob.obj=dob.obj.gsub(/<!.+!>/,' ').
+ gsub(/<:\S+>/,' ')
+ end
+ end
+ end
+ @plaintext
+ end
+ def publish(plaintext)
+ divider='='
+ content=[]
+ content << plaintext[:open]
+ content << plaintext[:head]
+ content << plaintext[:body]
+ content << @@endnotes[:end] if @@endnotes_
+ content << "#{break_line}#{divider*@wrap_width}#{break_line}"
+ content << plaintext[:metadata]
+ content << "#{break_line}#{divider*@wrap_width}#{break_line}" if @md.stmp =~/\w+/ #not used?
+ content << plaintext[:tail]
+ Output.new(content,@md).rst
+ @@endnotes={ para: [], end: [] }
+ end
+ end
+ class Output <Source
+ include SiSU_Param
+ include SiSU_Env
+ def initialize(content,md)
+ @content,@md=content,md
+ end
+ def rst
+ file_plaintext=SiSU_Env::FileOp.new(@md).write_file.rst
+ @sisu=[]
+ emptyline=0
+ @content.each do |para| # this is a hack
+ if para.is_a?(Array) \
+ and para.length > 0
+ para.each do |line|
+ if line
+ line=line.gsub(/[ \t]+$/m,'').
+ gsub(/^\A[ ]*\Z/m,'')
+ (line=~/^\A\Z/) \
+ ? (emptyline+=1)
+ : emptyline=0
+ if emptyline < 2 #remove additional empty lines
+ file_plaintext.puts line
+ end
+ end
+ end
+ else file_plaintext.puts para #unix plaintext # /^([*=-]|\.){5}/
+ end
+ end
+ file_plaintext.close
+ end
+ end
+ end
+end
+__END__
diff --git a/lib/sisu/v5/shared_txt.rb b/lib/sisu/v5/txt_shared.rb
index 8e8e7edb..31a976d2 100644
--- a/lib/sisu/v5/shared_txt.rb
+++ b/lib/sisu/v5/txt_shared.rb
@@ -50,7 +50,7 @@
* Git
<http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/shared_txt.rb;hb=HEAD>
+ <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/txt_shared.rb;hb=HEAD>
* Ralph Amissah
<ralph@amissah.com>
@@ -64,12 +64,14 @@ module SiSU_TextUtils
def initialize(para='',n_char_max=76,n_indent=0,n_hang=nil)
@para,@n_char_max,@n_indent=para,n_char_max,n_indent
@n_char_max_extend = n_char_max
- @br="\n"
@n_hang=n_hang ? n_hang : @n_indent
end
+ def break_line
+ "\n"
+ end
def line_wrap
space=' '
- spaces_indent,spaces_hang="#{@br}#{space*@n_indent}",space*@n_hang
+ spaces_indent,spaces_hang="#{break_line}#{space*@n_indent}",space*@n_hang
line=0
out=[]
out[line]=''
@@ -126,6 +128,12 @@ module SiSU_TextUtils
end
@arr
end
+ def no_wrap
+ @para
+ end
+ def no_wrap_no_breaks
+ @para.gsub(/\n/m,' ').gsub(/\s\s+/,' ')
+ end
end
class HeaderScan
def initialize(md,para)
diff --git a/lib/sisu/v5/txt_textile.rb b/lib/sisu/v5/txt_textile.rb
new file mode 100644
index 00000000..429593cc
--- /dev/null
+++ b/lib/sisu/v5/txt_textile.rb
@@ -0,0 +1,543 @@
+# 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 <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Git
+ <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
+ <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/plaintext_textile.rb;hb=HEAD>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: plaintext (smarttext) generation, textile
+
+=end
+module SiSU_Txt_Textile
+ require_relative 'ao' # ao.rb
+ require_relative 'sysenv' # sysenv.rb
+ include SiSU_Env
+ require_relative 'shared_metadata' # shared_metadata.rb
+ require_relative 'txt_shared' # txt_shared.rb
+ include SiSU_Param
+ include SiSU_Viz
+ @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0
+ @@tablefoot=''
+ class Source
+ def initialize(opt)
+ @opt=opt
+ unless @opt.fns =~/(.+?)\.(?:-|ssm\.)?sst$/
+ puts "#{sf} not a processed file type"
+ end
+ end
+ def read
+ begin
+ md=SiSU_Param::Parameters.new(@opt).get
+ env=SiSU_Env::InfoEnv.new(@opt.fns)
+ 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.text_editor} #{md.file.output_path.textile.dir}/#{md.file.base_filename.textile}"
+ : "[#{@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],'Textile (plaintext utf-8)',tool).green_hi_blue
+ : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Textile (plaintext utf-8)',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.textile.dir}/#{md.file.base_filename.textile}").flow
+ end
+ end
+ ao_array=SiSU_AO::Source.new(@opt).get # ao file drawn here
+ wrap_width=if defined? md.make.plaintext_wrap \
+ and md.make.plaintext_wrap
+ md.make.plaintext_wrap
+ elsif defined? env.plaintext_wrap \
+ and env.plaintext_wrap
+ env.plaintext_wrap
+ else 78
+ end
+ #wrap_width=(defined? md.make.plaintext_wrap) ? md.make.plaintext_wrap : 78
+ SiSU_Txt_Textile::Source::Scroll.new(md,ao_array,wrap_width).songsheet
+ rescue
+ SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ end
+ end
+ private
+ class Scroll <Source
+ require_relative 'defaults' # defaults.rb
+ require_relative 'txt_shared' # txt_shared.rb
+ include SiSU_TextUtils
+ @@endnotes={ para: [], end: [] }
+ def initialize(md,data,wrap_width)
+ @md,@data,@wrap_width=md,data,wrap_width
+ @env=SiSU_Env::InfoEnv.new(@md.fns)
+ @brace_url=SiSU_Viz::Defaults.new.url_decoration
+ @tab="\t"
+ @@endnotes_=case md.opt.mod.inspect
+ when /--footnote/; false
+ when /--endnote/; true
+ else true
+ end
+ @plaintext={ body: [], open: [], close: [], head: [], metadata: [], tail: [] }
+ end
+ def songsheet
+ plaintext=markup(@data)
+ publish(plaintext)
+ end
+ def break_line
+ "\n"
+ end
+ # Used for extraction of endnotes from paragraphs
+ def extract_endnotes(dob='')
+ notes=dob.obj.scan(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})([\d*+]+\s+.+?)(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/)
+ @n=[]
+ notes.flatten.each do |n| #high cost to deal with <br> appropriately within plaintext, consider
+ n=n.dup.to_s
+ if n =~/#{Mx[:br_line]}|#{Mx[:br_nl]}/
+ fix = n.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/) #watch #added
+ fix.each do |x|
+ unless x.empty?; @n << x
+ end
+ end
+ else @n << n
+ end
+ end
+ notes=@n.flatten
+ notes.each do |e|
+ util=(e.to_s =~/^\[[\d*+]+\]:/) \
+ ? (SiSU_TextUtils::Wrap.new(e.to_s,@wrap_width,4,1))
+ : (SiSU_TextUtils::Wrap.new(e.to_s,@wrap_width,1,1))
+ wrap=util.line_wrap
+ wrap=if wrap =~ /^\s*[\d*+]+\s+.+?\s*\Z/m
+ wrap.gsub(/^(\s*)([\d*+]+)\s+(.+?)\s*\Z/m, <<-GSUB
+\\1[\\2]: \\3
+ GSUB
+ )
+ else
+ wrap.gsub(/^(.+)\Z/m, <<-GSUB
+\\1
+ GSUB
+ )
+ end
+ @@endnotes[:para] << "-#{wrap}"
+ @@endnotes[:end] << '' << wrap
+ end
+ @@endnotes
+ end
+ def plaintext_metadata
+ array=SiSU_Metadata::Summary.new(@md).plaintext.metadata
+ array.each do |meta|
+ tag,inf=meta.scan(/^.+?:\s|.+/)
+ if tag and inf
+ util=SiSU_TextUtils::Wrap.new(inf,@wrap_width,15,1)
+ txt=util.line_wrap
+ @plaintext[:metadata] <<<<WOK
+
+#{@tab}#{tag}#{txt}
+WOK
+ end
+ end
+ end
+ def plaintext_tail
+# env=SiSU_Env::InfoEnv.new(@md.fns)
+ vz=SiSU_Viz::Defaults.new
+ generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version]
+ lastdone="Last Generated on: #{Time.now}"
+ rubyv="Ruby version: #{@md.ruby_version}"
+ sc=if @md.sc_info
+ "Source file: #{@md.sc_filename}#{break_line}Version number: #{@md.sc_number}#{break_line}Version date: #{@md.sc_date}#{break_line}"
+ else ''
+ end
+ @plaintext[:tail] <<<<WOK
+#{break_line}
+plaintext (plain text):
+ #{@md.file.output_path.textile.url}/#{@md.file.base_filename.textile}#{break_line}
+Other versions of this document: #{break_line}
+manifest:
+ #{@md.file.output_path.manifest.url}/#{@md.file.base_filename.manifest}#{break_line}
+at:
+ #{@md.file.output_path.base.url}#{break_line}
+
+#{sc}
+* #{generator}
+* #{rubyv}
+* #{lastdone}
+* SiSU #{vz.url_sisu}
+WOK
+ end
+ def decorate
+ def heading
+ def inline
+ def l1
+ 'h1. '
+ end
+ def l2
+ 'h2. '
+ end
+ def l3
+ 'h3. '
+ end
+ def l4
+ 'h4. '
+ end
+ def l5
+ 'h5. '
+ end
+ def l6
+ 'h6. '
+ end
+ self
+ end
+ self
+ end
+ def bold
+ def open
+ '*'
+ end
+ def close
+ '*'
+ end
+ self
+ end
+ def italics
+ def open
+ '_'
+ end
+ def close
+ '_'
+ end
+ self
+ end
+ def underscore
+ def open
+ '+'
+ end
+ def close
+ '+'
+ end
+ self
+ end
+ #def emphasis
+ # def open
+ # ''
+ # end
+ # def close
+ # ''
+ # end
+ # self
+ #end
+ def cite
+ def open
+ '"'
+ end
+ def close
+ '"'
+ end
+ self
+ end
+ def insert
+ def open
+ ''
+ end
+ def close
+ ''
+ end
+ self
+ end
+ def strike
+ def open
+ '-'
+ end
+ def close
+ '-'
+ end
+ self
+ end
+ def superscript
+ def open
+ '^'
+ end
+ def close
+ '^'
+ end
+ self
+ end
+ def subscript
+ def open
+ '~'
+ end
+ def close
+ '~'
+ end
+ self
+ end
+ def hilite
+ def open
+ '*'
+ end
+ def close
+ '*'
+ end
+ self
+ end
+ def monospace
+ def open
+ ''
+ end
+ def close
+ ''
+ end
+ self
+ end
+ self
+ end
+ def heading_decorated_inline(dob)
+ heading_inline = case dob.lc
+ when 1; decorate.heading.inline.l1
+ when 2; decorate.heading.inline.l2
+ when 3; decorate.heading.inline.l3
+ when 4; decorate.heading.inline.l4
+ when 5; decorate.heading.inline.l5
+ when 6; decorate.heading.inline.l6
+ end
+ heading_inline + ' ' + dob.obj
+ end
+ def plaintext_structure(dob='',p_num='') #% Used to extract the structure of a document
+ util=nil
+ wrapped=if dob.is==:para \
+ || dob.is==:heading
+ if dob.is==:heading
+ util=SiSU_TextUtils::Wrap.new(heading_decorated_inline(dob),@wrap_width,0,0)
+ elsif dob.is==:para
+ if dob.hang \
+ and dob.hang =~/[0-9]/ \
+ and dob.indent != dob.hang
+ util=SiSU_TextUtils::Wrap.new(dob.obj,@wrap_width,dob.indent.to_i*2,dob.hang.to_i*2)
+ #util=SiSU_TextUtils::Wrap.new(dob.obj,@wrap_width,dob.hang.to_i*2,0)
+ elsif dob.indent =~/[1-9]/
+ util=if dob.bullet_
+ SiSU_TextUtils::Wrap.new("* #{dob.obj}",@wrap_width,dob.indent.to_i*2)
+ else SiSU_TextUtils::Wrap.new(dob.obj,@wrap_width,dob.indent.to_i*2)
+ end
+ else
+ util=if dob.bullet_
+ SiSU_TextUtils::Wrap.new("* #{dob.obj}",@wrap_width,0)
+ else SiSU_TextUtils::Wrap.new(dob.obj,@wrap_width,0)
+ end
+ end
+ else util=SiSU_TextUtils::Wrap.new(dob.obj,@wrap_width,0)
+ end
+ dob.is==:heading ? util.no_wrap_no_breaks : util.line_wrap
+ end
+ @plaintext[:body] << wrapped + p_num << break_line # main text, contents, body KEEP
+ if @@endnotes[:para] \
+ and not @@endnotes_
+ @@endnotes[:para].each {|e| @plaintext[:body] << e << break_line}
+ elsif @@endnotes[:para] \
+ and @@endnotes_
+ end
+ @@endnotes[:para]=[]
+ end
+ def markup(data) # Used for major markup instructions
+ SiSU_Env::InfoEnv.new(@md.fns)
+ @data_mod,@endnotes,@level,@cont,@copen,@plaintext_contents_close=Array.new(6){[]}
+ (0..6).each { |x| @cont[x]=@level[x]=false }
+ (4..6).each { |x| @plaintext_contents_close[x]='' }
+ plaintext_tail #($1,$2)
+ plaintext_metadata
+ table_message='[table conversion awaited, see other document formats]'
+ data.each do |dob|
+ dob.obj=dob.obj.gsub(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+/um,"#{break_line}#{table_message}"). #fix
+ gsub(/.+?#{Mx[:gl_o]}-##{Mx[:gl_c]}/,''). # remove dummy headings (used by html) #check also [~-]#
+ gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,
+ "#{decorate.bold.open}\\1#{decorate.bold.close}").
+ gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,
+ "#{decorate.italics.open}\\1#{decorate.italics.close}").
+ gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,
+ "#{decorate.underscore.open}\\1#{decorate.underscore.close}").
+ gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,
+ "#{decorate.subscript.open}\\1#{decorate.subscript.close}").
+ gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,
+ "#{decorate.superscript.open}\\1#{decorate.superscript.close}").
+ gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,
+ "#{decorate.insert.open}\\1#{decorate.insert.close}").
+ gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,
+ "#{decorate.cite.open}\\1#{decorate.cite.close}").
+ gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,
+ "#{decorate.strike.open}\\1#{decorate.strike.close}").
+ gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,
+ "#{decorate.monospace.open}\\1#{decorate.monospace.close}")
+ unless dob.is==:code
+ dob.obj=dob.obj.gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/,'\1').
+ gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1').
+ gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1 [link: <\2>]').
+ gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}image/,'\1 [link: local image]').
+ gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,"#{@brace_url.txt_open}\\1#{@brace_url.txt_close}")
+ extract_endnotes(dob)
+ dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'[^\1]'). # endnote marker marked up
+ gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'[^\1]'). # endnote marker marked up
+ gsub(/#{Mx[:gl_o]}(?:#lt|#060)#{Mx[:gl_c]}/,'<').
+ gsub(/#{Mx[:gl_o]}(?:#gt|#062)#{Mx[:gl_c]}/,'>').
+ gsub(/#{Mx[:gl_o]}#(?:038|amp)#{Mx[:gl_c]}/,'&').
+ gsub(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!').
+ gsub(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#').
+ gsub(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*').
+ gsub(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-').
+ gsub(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/').
+ gsub(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_').
+ gsub(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{').
+ gsub(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}').
+ gsub(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~').
+ gsub(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'©').
+ gsub(/#{Mx[:gl_o]}#092#{Mx[:gl_c]}/,'\\')
+ end
+ dob.obj=if dob.of==:block # watch
+ dob.obj.gsub(/#{Mx[:gl_o]}●#{Mx[:gl_c]}/m,"* ").
+ gsub(/\n?#{Mx[:br_line]}\n?|\n?#{Mx[:br_nl]}\n?/m,break_line)
+ else dob.obj.gsub(/\n?#{Mx[:br_line]}\n?|\n?#{Mx[:br_nl]}\n?/m,break_line*2)
+ end
+ if dob.is==:code
+ dob.obj=dob.obj.gsub(/(^|[^}])_([<>])/m,'\1\2'). # _> _<
+ gsub(/(^|[^}])_([<>])/m,'\1\2') # _<_<
+ end
+ dob.obj=dob.obj.gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1').
+ gsub(/<a href=".+?">(.+?)<\/a>/m,'\1').
+ gsub(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,''). # remove name links
+ gsub(/&nbsp;|#{Mx[:nbsp]}/,' '). # decide on
+ gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,' [ \1 ]'). #"[ #{dir.url.images_local}\/\\1 ]")
+ gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}image/,' [ \1 ]').
+ gsub(/(?:^|[^_\\])\{\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*\}\S+/,'[image: "\1"]')
+ if dob.obj !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/
+ p_num=''
+ #ocn
+ if dob.is==:heading \
+ or dob.is==:para
+ plaintext_structure(dob,p_num)
+ elsif dob.is==:group \
+ or dob.is==:block \
+ or dob.is==:verse \
+ or dob.is==:code \
+ or dob.is==:table
+ @plaintext[:body] << dob.obj + p_num << break_line
+ elsif dob.is==:break
+ sp=' '
+ ln='-'
+ @plaintext[:body] <<=if dob.obj==Mx[:br_page] \
+ or dob.obj==Mx[:br_page_new] \
+ or dob.obj==Mx[:br_page_line]
+ "#{break_line}#{ln*40}#{break_line*2}"
+ elsif dob.obj ==Mx[:br_obj]
+ "#{break_line}#{sp*20}* * *#{break_line*2}"
+ end # following empty line (break_line) missing, fix
+ end
+ dob='' if (dob.obj =~/<a name="n\d+">/ \
+ and dob.obj =~/^(-\{{2}~\d+|<!e[:_]\d+!>)/) # -endnote
+ if dob ## Clean Prepared Text
+ dob.obj=dob.obj.gsub(/<!.+!>/,' ').
+ gsub(/<:\S+>/,' ')
+ end
+ end
+ end
+ @plaintext
+ end
+ def publish(plaintext)
+ divider='='
+ content=[]
+ content << plaintext[:open]
+ content << plaintext[:head]
+ content << plaintext[:body]
+ content << @@endnotes[:end] if @@endnotes_
+ content << "#{break_line}#{divider*@wrap_width}#{break_line}"
+ content << plaintext[:metadata]
+ content << "#{break_line}#{divider*@wrap_width}#{break_line}" if @md.stmp =~/\w+/ #not used?
+ content << plaintext[:tail]
+ Output.new(content,@md).textile
+ @@endnotes={ para: [], end: [] }
+ end
+ end
+ class Output <Source
+ include SiSU_Param
+ include SiSU_Env
+ def initialize(content,md)
+ @content,@md=content,md
+ end
+ def textile
+ file_plaintext=SiSU_Env::FileOp.new(@md).write_file.textile
+ @sisu=[]
+ emptyline=0
+ @content.each do |para| # this is a hack
+ if para.is_a?(Array) \
+ and para.length > 0
+ para.each do |line|
+ if line
+ line=line.gsub(/[ \t]+$/m,'').
+ gsub(/^\A[ ]*\Z/m,'')
+ (line=~/^\A\Z/) \
+ ? (emptyline+=1)
+ : emptyline=0
+ if emptyline < 2 #remove additional empty lines
+ file_plaintext.puts line
+ end
+ end
+ end
+ else file_plaintext.puts para #unix plaintext # /^([*=-]|\.){5}/
+ end
+ end
+ file_plaintext.close
+ end
+ end
+ end
+end
+__END__
diff --git a/lib/sisu/v5/urls.rb b/lib/sisu/v5/urls.rb
index a7b53985..ce3be66b 100644
--- a/lib/sisu/v5/urls.rb
+++ b/lib/sisu/v5/urls.rb
@@ -105,7 +105,7 @@ module SiSU_Urls
'h --html (HTML scroll)'=>@fn[:doc],
'I --texinfo (Info file)'=>'info',
'i --manpage (manpage)'=>'manpage',
- 'm --dal (Document Abstraction)'=>'dal',
+ 'm --ao (Document Abstraction)'=>'ao',
'N --hash-digests (Digests md5/sha256)'=>@fn[:digest],
'o --odt (ODF:ODT - Open Document)'=>@fn[:odf],
'p --pdf (PDF landscape)'=>@fn[:pdf_l],
@@ -114,6 +114,12 @@ module SiSU_Urls
's --source (sisu markup)'=>@opt.fno,
'S --sisupod (sisupod)'=>@fn[:sisupod],
't --txt (Plain-text (endnotes))'=>@fn[:plain],
+ ' --textile (textile txt)'=>@fn[:txt_textile],
+ ' --asciidoc (asciidoc txt)'=>@fn[:txt_asciidoc],
+ ' --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],
@@ -153,6 +159,18 @@ module SiSU_Urls
def text(x)
SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.txt.dir}/#{@md.file.base_filename.txt}").result
end
+ def textile(x)
+ SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.textile.dir}/#{@md.file.base_filename.textile}").result
+ end
+ def asciidoc(x)
+ SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.asciidoc.dir}/#{@md.file.base_filename.asciidoc}").result
+ end
+ def markdown(x)
+ SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.markdown.dir}/#{@md.file.base_filename.markdown}").result
+ end
+ def rst(x)
+ SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.rst.dir}/#{@md.file.base_filename.rst}").result
+ end
def epub(x)
SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.epub_viewer} #{@md.file.output_path.epub.dir}/#{@md.file.base_filename.epub}").result
end
@@ -211,6 +229,12 @@ module SiSU_Urls
def dom(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_dom.dir}/#{@md.file.base_filename.xml_dom}").result
end
+ 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
@@ -249,7 +273,7 @@ module SiSU_Urls
if x =~/^m/ \
and @opt.cmd=~/m/ \
and x=~/^[#{opt.cmd}]/
- SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"-#{x}","#{@prog.text_editor} #{@env.processing_path.dal}/#{@opt.fns}.meta").maintenance
+ SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"-#{x}","#{@prog.text_editor} #{@env.processing_path.ao}/#{@opt.fns}.meta").maintenance
end
if x=~/^([hw])/ \
and @opt.cmd=~/[hw]/ \
@@ -310,6 +334,22 @@ module SiSU_Urls
and @opt.act[:txt][:set]==:on
show.text(x)
end
+ if x=~/--textile\b/ \
+ and @opt.act[:txt_textile][:set]==:on
+ show.textile(x)
+ end
+ if x=~/--asciidoc\b/ \
+ and @opt.act[:txt_asciidoc][:set]==:on
+ show.asciidoc(x)
+ end
+ if x=~/--markdown\b/ \
+ and @opt.act[:txt_markdown][:set]==:on
+ show.markdown(x)
+ end
+ if x=~/--rst\b/ \
+ and @opt.act[:txt_rst][:set]==:on
+ show.rst(x)
+ end
if x=~/--xhtml\b/ \
and @opt.act[:xhtml][:set]==:on
show.xhtml(x)
@@ -406,6 +446,14 @@ module SiSU_Urls
and @opt.act[:xml_sax][:set]==:on
show.xml.sax(x)
end
+ if x=~/--docbook-book\b/ \
+ 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/wikispeak.rb b/lib/sisu/v5/wikispeak.rb
index da8fc9fa..b87fef61 100644
--- a/lib/sisu/v5/wikispeak.rb
+++ b/lib/sisu/v5/wikispeak.rb
@@ -60,14 +60,14 @@
=end
module SiSU_Wikispeak
- require_relative 'dal' # dal.rb
+ require_relative 'ao' # ao.rb
require_relative 'sysenv' # sysenv.rb
include SiSU_Env
include SiSU_Param
include SiSU_Viz
require_relative 'plaintext_format' # plaintext_format.rb
include Format
- require_relative 'shared_txt'
+ require_relative 'txt_shared'
@@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0
@@tablefoot=''
class Source
@@ -90,8 +90,8 @@ module SiSU_Wikispeak
|| @opt.act[:maintenance][:set]==:on)
SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{@env.path.output_tell}/#{@md.fnb}/#{@md.fn[:wiki]}").flow
end
- @dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here
- SiSU_Wikispeak::Source::Scroll.new(@dal_array,@md).songsheet
+ @ao_array=SiSU_AO::Source.new(@opt).get # ao file drawn here
+ SiSU_Wikispeak::Source::Scroll.new(@ao_array,@md).songsheet
rescue
SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do
__LINE__.to_s + ':' + __FILE__
@@ -149,7 +149,7 @@ module SiSU_Wikispeak
end
end
class Scroll <Source
- require_relative 'shared_txt' # shared_txt.rb
+ require_relative 'txt_shared' # txt_shared.rb
include SiSU_TextUtils
@@endnotes_para=[]
@@wiki={ body: [], open: [], close: [], head: [], metadata: [], tail: [], endnotes: [] }
diff --git a/lib/sisu/v5/xhtml.rb b/lib/sisu/v5/xhtml.rb
index 03ba0134..841ae03e 100644
--- a/lib/sisu/v5/xhtml.rb
+++ b/lib/sisu/v5/xhtml.rb
@@ -66,7 +66,7 @@ module SiSU_XHTML
include SiSU_Particulars
require_relative 'sysenv' # sysenv.rb
include SiSU_Env
- require_relative 'shared_xml' # shared_xml.rb
+ require_relative 'xml_shared' # xml_shared.rb
include SiSU_XML_Munge
require_relative 'xml_format' # xml_format.rb
include SiSU_XML_Format
@@ -82,7 +82,7 @@ module SiSU_XHTML
end
def read
begin
- @env,@md,@dal_array=@particulars.env,@particulars.md,@particulars.dal_array
+ @env,@md,@ao_array=@particulars.env,@particulars.md,@particulars.ao_array
unless @opt.act[:quiet][:set]==:on
tool=if (@opt.act[:verbose_plus][:set]==:on \
|| @opt.act[:maintenance][:set]==:on)
@@ -113,7 +113,7 @@ module SiSU_XHTML
private
class Songsheet
def initialize(particulars)
- @env,@md,@dal_array,@particulars=particulars.env,particulars.md,particulars.dal_array,particulars
+ @env,@md,@ao_array,@particulars=particulars.env,particulars.md,particulars.ao_array,particulars
@file=SiSU_Env::FileOp.new(@md)
end
def song
@@ -134,13 +134,13 @@ module SiSU_XHTML
end
end
class Scroll
- require_relative 'shared_xhtml' # shared_xhtml.rb #check already called
- require_relative 'shared_txt' # shared_txt.rb
+ require_relative 'xhtml_shared' # xhtml_shared.rb #check already called
+ require_relative 'txt_shared' # txt_shared.rb
include SiSU_TextUtils
require_relative 'css' # css.rb
@@xml={ body: [], sisu: [], open: [], close: [], head: [] }
def initialize(particulars)
- @env,@md,@dal_array=particulars.env,particulars.md,particulars.dal_array
+ @env,@md,@ao_array=particulars.env,particulars.md,particulars.ao_array
@vz=SiSU_Viz::Defaults.new
@tab="\t"
@trans=SiSU_XML_Munge::Trans.new(@md)
@@ -148,7 +148,7 @@ module SiSU_XHTML
end
def songsheet
pre
- @data=markup(@dal_array)
+ @data=markup(@ao_array)
post
publish
end
diff --git a/lib/sisu/v5/epub.rb b/lib/sisu/v5/xhtml_epub2.rb
index 37ab535b..c54d77ff 100644
--- a/lib/sisu/v5/epub.rb
+++ b/lib/sisu/v5/xhtml_epub2.rb
@@ -59,20 +59,20 @@
** Description: epub generation, processing
=end
-module SiSU_EPUB
+module SiSU_XHTML_EPUB2
require 'pstore'
require_relative 'particulars' # particulars.rb
include SiSU_Particulars
require_relative 'defaults' # defaults.rb
include SiSU_Viz
require_relative 'xhtml_table' # xhtml_table.rb
- require_relative 'epub_format' # epub_format.rb
- include SiSU_EPUB_Format
- require_relative 'epub_segments' # epub_segments.rb
- include SiSU_EPUB_Seg
- require_relative 'epub_tune' # epub_tune.rb
- include SiSU_EPUB_Tune
- require_relative 'epub_concordance' # epub_concordance.rb
+ require_relative 'xhtml_epub2_format' # xhtml_epub2_format.rb
+ include SiSU_XHTML_EPUB2_Format
+ require_relative 'xhtml_epub2_segments' # xhtml_epub2_segments.rb
+ include SiSU_XHTML_EPUB2_Seg
+ require_relative 'xhtml_epub2_tune' # xhtml_epub2_tune.rb
+ include SiSU_XHTML_EPUB2_Tune
+ require_relative 'xhtml_epub2_concordance' # xhtml_epub2_concordance.rb
class Source
def initialize(opt)
@opt=opt
@@ -106,13 +106,13 @@ module SiSU_EPUB
@env.processing_path.epub_cp_images(@md)
data=nil
SiSU_Env::FileOp.new(@md).mkdir.output.epub
- @tuned_file_array=SiSU_EPUB::Source::XHTML_Environment.new(@particulars).tuned_file_instructions
+ @tuned_file_array=SiSU_XHTML_EPUB2::Source::XHTML_Environment.new(@particulars).tuned_file_instructions
data=@tuned_file_array
- toc=SiSU_EPUB::Source::Toc.new(@md,data).songsheet
+ toc=SiSU_XHTML_EPUB2::Source::Toc.new(@md,data).songsheet
data=@tuned_file_array
- SiSU_EPUB::Source::ScrollHeadAndSegToc.new(@md,toc).in_common #watch
- SiSU_EPUB::Source::Seg.new(@md,data).songsheet
- SiSU_EPUB::Source::Output.new(@md).songsheet
+ SiSU_XHTML_EPUB2::Source::ScrollHeadAndSegToc.new(@md,toc).in_common #watch
+ SiSU_XHTML_EPUB2::Source::Seg.new(@md,data).songsheet
+ SiSU_XHTML_EPUB2::Source::Output.new(@md).songsheet
rescue
SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do
__LINE__.to_s + ':' + __FILE__
@@ -149,13 +149,13 @@ module SiSU_EPUB
def tuned_file_instructions
@tell=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set])
directories
- dal_array=@particulars.dal_array # dal file drawn here
- @tuned_file_array=SiSU_EPUB_Tune::Tune.new(dal_array,@md).songsheet
+ ao_array=@particulars.ao_array # ao file drawn here
+ @tuned_file_array=SiSU_XHTML_EPUB2_Tune::Tune.new(ao_array,@md).songsheet
@tuned_file_array
end
end
class Endnotes
- include SiSU_EPUB_Format
+ include SiSU_XHTML_EPUB2_Format
def initialize(md,data)
@md,@data=md,data
end
@@ -177,7 +177,7 @@ module SiSU_EPUB
end
endnote_array.flatten.each do |note|
txt_obj={ txt: note }
- format_scroll=SiSU_EPUB_Format::FormatScroll.new(@md,txt_obj)
+ format_scroll=SiSU_XHTML_EPUB2_Format::FormatScroll.new(@md,txt_obj)
@scr_endnotes << format_scroll.endnote_body
end
end
@@ -193,7 +193,7 @@ module SiSU_EPUB
def initialize(md=nil,data='')
@md,@data=md,data
@vz=SiSU_Viz::Defaults.new
- @epub=SiSU_EPUB_Format::HeadInformation.new(@md)
+ @epub=SiSU_XHTML_EPUB2_Format::HeadInformation.new(@md)
@tell=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set]) if @md
@make=SiSU_Env::ProcessingSettings.new(@md)
end
@@ -262,7 +262,7 @@ module SiSU_EPUB
md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,lv_name)
md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,lv_name)
md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,lv_name)
- SiSU_EPUB::Source::Toc.new(@md,dob_toc).level_1
+ SiSU_XHTML_EPUB2::Source::Toc.new(@md,dob_toc).level_1
when 2
@s_b_no +=1
lv_name='section_b' + @s_b_no.to_s
@@ -279,7 +279,7 @@ module SiSU_EPUB
md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,lv_name)
md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,lv_name)
md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,lv_name)
- SiSU_EPUB::Source::Toc.new(@md,dob_toc).level_2
+ SiSU_XHTML_EPUB2::Source::Toc.new(@md,dob_toc).level_2
when 3
@s_c_no +=1
lv_name='section_c' + @s_c_no.to_s
@@ -295,7 +295,7 @@ module SiSU_EPUB
md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,lv_name)
md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,lv_name)
md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,lv_name)
- SiSU_EPUB::Source::Toc.new(@md,dob_toc).level_3
+ SiSU_XHTML_EPUB2::Source::Toc.new(@md,dob_toc).level_3
when 4
@ncx_cls=[]
lv_name=dob_toc.name
@@ -309,7 +309,7 @@ module SiSU_EPUB
md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,lv_name)
md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,lv_name)
md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,lv_name)
- SiSU_EPUB::Source::Toc.new(@md,dob_toc).level_4
+ SiSU_XHTML_EPUB2::Source::Toc.new(@md,dob_toc).level_4
when 5
@ncx_cls=[]
hashtag='#o' + dob_toc.ocn.to_s
@@ -322,7 +322,7 @@ module SiSU_EPUB
md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,lv_name,hashtag)
md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,lv_name,hashtag)
md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,lv_name,hashtag)
- SiSU_EPUB::Source::Toc.new(@md,dob_toc).level_5
+ SiSU_XHTML_EPUB2::Source::Toc.new(@md,dob_toc).level_5
when 6
@ncx_cls=[]
hashtag='#o' + dob_toc.ocn.to_s
@@ -334,7 +334,7 @@ module SiSU_EPUB
md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,lv_name,hashtag)
md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,lv_name,hashtag)
md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,lv_name,hashtag)
- SiSU_EPUB::Source::Toc.new(@md,dob_toc).level_6
+ SiSU_XHTML_EPUB2::Source::Toc.new(@md,dob_toc).level_6
else nil
end
toc.each do |k,d|
@@ -374,8 +374,8 @@ module SiSU_EPUB
@@toc[:opf] << @epub.metadata_opf.guide_open << md_opf_a_guide << @epub.metadata_opf.guide_close
@@toc[:opf] << @epub.metadata_opf.package_close
@@toc[:opf]=@@toc[:opf].flatten
- SiSU_EPUB::Source::Output.new(@md,@@toc[:opf]).epub_metadata_opf
- SiSU_EPUB::Source::Output.new(@md,@@toc[:ncx]).epub_toc_ncx
+ SiSU_XHTML_EPUB2::Source::Output.new(@md,@@toc[:opf]).epub_metadata_opf
+ SiSU_XHTML_EPUB2::Source::Output.new(@md,@@toc[:ncx]).epub_toc_ncx
@md.firstseg=@@firstseg
@@toc
end
@@ -391,7 +391,7 @@ module SiSU_EPUB
end
toc={}
txt_obj={ txt: title }
- format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj)
+ format_toc=SiSU_XHTML_EPUB2_Format::FormatToc.new(@md,txt_obj)
toc[:seg]=if dob.name =~/^meta/ \
and dob.obj =~/Document Information/ #check
format_toc.lev0
@@ -411,7 +411,7 @@ module SiSU_EPUB
%{<b><a href="##{link}">#{linkname}</a></b>}
end
txt_obj={ txt: title }
- format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj)
+ format_toc=SiSU_XHTML_EPUB2_Format::FormatToc.new(@md,txt_obj)
toc[:scr]=if dob.name =~/^meta/ \
and dob.obj =~/Document Information/
format_toc.lev0
@@ -424,16 +424,16 @@ module SiSU_EPUB
linkname,ocn=dob.obj.strip,dob.ocn
if ocn \
and ocn !~/#/
- p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn)
+ p_num=SiSU_XHTML_EPUB2_Format::ParagraphNumber.new(@md,ocn)
end
txt_obj={ txt: linkname }
- format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj)
+ format_toc=SiSU_XHTML_EPUB2_Format::FormatToc.new(@md,txt_obj)
toc={}
toc[:seg]=format_toc.lev2
if p_num
title=%{#{p_num.goto}#{linkname}</a>}
txt_obj={ txt: title }
- format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj)
+ format_toc=SiSU_XHTML_EPUB2_Format::FormatToc.new(@md,txt_obj)
toc[:scr]=format_toc.lev2
end
toc
@@ -443,16 +443,16 @@ module SiSU_EPUB
linkname,ocn=dob.obj.strip,dob.ocn
if ocn \
and ocn !~/#/
- p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn)
+ p_num=SiSU_XHTML_EPUB2_Format::ParagraphNumber.new(@md,ocn)
end
txt_obj={ txt: linkname }
- format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj)
+ format_toc=SiSU_XHTML_EPUB2_Format::FormatToc.new(@md,txt_obj)
toc={}
toc[:seg]=format_toc.lev3
if p_num
title=%{#{p_num.goto}#{linkname}</a>}
txt_obj={ txt: title }
- format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj)
+ format_toc=SiSU_XHTML_EPUB2_Format::FormatToc.new(@md,txt_obj)
toc[:scr]=format_toc.lev3
end
toc
@@ -460,7 +460,7 @@ module SiSU_EPUB
def level_4
dob=@data
linkname,ocn=dob.obj.strip,dob.ocn
- p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn) if ocn
+ p_num=SiSU_XHTML_EPUB2_Format::ParagraphNumber.new(@md,ocn) if ocn
if dob.ln==4
seg_link=%{ <a href="#{dob.name}#{Sfx[:epub_xhtml]}">
#{dob.obj}
@@ -471,14 +471,14 @@ module SiSU_EPUB
%{<a href="\\1#{Sfx[:epub_xhtml]}">} +
%{\\1 \\2</a> })
end
- p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn) if ocn
+ p_num=SiSU_XHTML_EPUB2_Format::ParagraphNumber.new(@md,ocn) if ocn
txt_obj={ txt: seg_link }
- format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj)
+ format_toc=SiSU_XHTML_EPUB2_Format::FormatToc.new(@md,txt_obj)
toc={}
toc[:seg]=format_toc.lev4
title=%{#{p_num.goto}#{linkname}</a>} if p_num
txt_obj={ txt: title }
- format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj)
+ format_toc=SiSU_XHTML_EPUB2_Format::FormatToc.new(@md,txt_obj)
toc[:scr]=format_toc.lev4
toc
end
@@ -488,16 +488,16 @@ module SiSU_EPUB
toc={}
if ocn \
and ocn !~/#/
- p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn)
+ p_num=SiSU_XHTML_EPUB2_Format::ParagraphNumber.new(@md,ocn)
lnk_n_txt=%{ <a href="#{@@seg_url}#{Sfx[:epub_xhtml]}#o#{ocn}">
#{linkname}
</a>}
txt_obj={ txt: lnk_n_txt }
- format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj)
+ format_toc=SiSU_XHTML_EPUB2_Format::FormatToc.new(@md,txt_obj)
toc[:seg]=format_toc.lev5
title=%{#{p_num.goto}#{linkname}</a>}
txt_obj={ txt: title }
- format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj)
+ format_toc=SiSU_XHTML_EPUB2_Format::FormatToc.new(@md,txt_obj)
toc[:scr]=format_toc.lev5
end
toc
@@ -508,16 +508,16 @@ module SiSU_EPUB
toc={}
if ocn \
and ocn !~/#/
- p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn)
+ p_num=SiSU_XHTML_EPUB2_Format::ParagraphNumber.new(@md,ocn)
lnk_n_txt=%{ <a href="#{@@seg_url}#{Sfx[:epub_xhtml]}#o#{ocn}">
#{linkname}
</a>}
txt_obj={ txt: lnk_n_txt }
- format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj)
+ format_toc=SiSU_XHTML_EPUB2_Format::FormatToc.new(@md,txt_obj)
toc[:seg]=format_toc.lev6
title=%{#{p_num.goto}#{linkname}</a>}
txt_obj={ txt: title }
- format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj)
+ format_toc=SiSU_XHTML_EPUB2_Format::FormatToc.new(@md,txt_obj)
toc[:scr]=format_toc.lev6
end
toc
@@ -536,7 +536,7 @@ module SiSU_EPUB
|| @md.opt.act[:maintenance][:set]==:on)
SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'Scroll & Segtoc').txt_grey
end
- format_head_toc=SiSU_EPUB_Format::HeadToc.new(@md)
+ format_head_toc=SiSU_XHTML_EPUB2_Format::HeadToc.new(@md)
dochead=format_head_toc.head
dochead=dochead.gsub(/toc\.(html)/,'doc.\1') #kludge
toc_shared << dochead #<< ads.div.major
@@ -544,18 +544,18 @@ module SiSU_EPUB
if defined? @md.rights.all \
and @md.rights.all
rights=format_head_toc.rights.all
- rights=SiSU_EPUB_Tune::CleanXHTML.new(rights).clean
+ rights=SiSU_XHTML_EPUB2_Tune::CleanXHTML.new(rights).clean
end
if defined? @md.notes.prefix_b \
and @md.notes.prefix_b
prefix_b=format_head_toc.prefix_b
- prefix_b=SiSU_EPUB_Tune::CleanXHTML.new(prefix_b).clean
+ prefix_b=SiSU_XHTML_EPUB2_Tune::CleanXHTML.new(prefix_b).clean
end
tmp_head=nil
doc_title_endnote=@md.title.full.gsub(/(\*+)/,'<sup><a href="#endnotes">\1</a></sup>')
tmp_head=doc_title_endnote + "\n"
txt_obj={ txt: tmp_head }
- format_txt_obj=SiSU_EPUB_Format::FormatTextObject.new(@md,txt_obj)
+ format_txt_obj=SiSU_XHTML_EPUB2_Format::FormatTextObject.new(@md,txt_obj)
toc_shared << format_txt_obj.center_bold
segtoc << format_txt_obj.center_bold
if defined? @md.creator.author \
@@ -563,7 +563,7 @@ module SiSU_EPUB
creator_endnote=@md.creator.author.gsub(/(\*+)/,%{#{$ep[:hsp]}<sup><a href="#notes">\\1</a></sup>})
tmp_head=creator_endnote + "\n"
txt_obj={ txt: tmp_head }
- format_txt_obj=SiSU_EPUB_Format::FormatTextObject.new(@md,txt_obj)
+ format_txt_obj=SiSU_XHTML_EPUB2_Format::FormatTextObject.new(@md,txt_obj)
toc_shared << format_txt_obj.center_bold
segtoc << format_txt_obj.center_bold
end
@@ -599,8 +599,8 @@ module SiSU_EPUB
#Segtoc tail added here
segtoc << format_head_toc.xhtml_close
segtoc=segtoc.flatten.compact #watch
- SiSU_EPUB::Source::Output.new(@md).make_cover_image
- SiSU_EPUB::Source::Output.new(@md,segtoc).make_segtoc
+ SiSU_XHTML_EPUB2::Source::Output.new(@md).make_cover_image
+ SiSU_XHTML_EPUB2::Source::Output.new(@md,segtoc).make_segtoc
segtoc=[]
@toc[:scr],@toc[:seg]=[],[]
toc_shared
@@ -608,13 +608,13 @@ module SiSU_EPUB
end
class Table < SiSU_XHTML_Table::TableXHTML
end
- class Seg < SiSU_EPUB_Seg::Seg
+ class Seg < SiSU_XHTML_EPUB2_Seg::Seg
end
class Output
def initialize(md,output='')
@md,@output=md,output
@epub_doc="#{@md.fnb}.epub"
- @epub_header=SiSU_EPUB_Format::HeadInformation.new(@md)
+ @epub_header=SiSU_XHTML_EPUB2_Format::HeadInformation.new(@md)
@make=SiSU_Env::ProcessingSettings.new(@md)
@make_file=SiSU_Env::CreateFile.new(@md.fns)
end
@@ -638,7 +638,7 @@ module SiSU_EPUB
end
def css
out=@make_file.epub.xhtml_css
- out << SiSU_EPUB_Format::CSS.new.css_epub_xhtml
+ out << SiSU_XHTML_EPUB2_Format::CSS.new.css_epub_xhtml
out.close
end
def epub_toc_ncx
@@ -691,7 +691,7 @@ module SiSU_EPUB
end
end
def concordance
- SiSU_EPUB_Concordance::Source.new(@md.opt).read
+ SiSU_XHTML_EPUB2_Concordance::Source.new(@md.opt).read
end
def output_zip
FileUtils::mkdir_p(@md.file.output_path.epub.dir) unless FileTest.directory?(@md.file.output_path.epub.dir)
@@ -728,8 +728,8 @@ module SiSU_EPUB
<body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en">
<div class="svg_outer">
<div class="svg_inner">
- <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100%" height="100%" viewBox="0 0 #{@md.make.cover_image[:w]} #{@md.make.cover_image[:h]}" preserveAspectRatio="xMidYMid meet">
- <image width="#{@md.make.cover_image[:w]}" height="#{@md.make.cover_image[:h]}" xlink:href="image/#{@md.make.cover_image[:cover]}" />
+ <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xl="http://www.w3.org/1999/xlink" width="100%" height="100%" viewBox="0 0 #{@md.make.cover_image[:w]} #{@md.make.cover_image[:h]}" preserveAspectRatio="xMidYMid meet">
+ <image width="#{@md.make.cover_image[:w]}" height="#{@md.make.cover_image[:h]}" xl:href="image/#{@md.make.cover_image[:cover]}" />
</svg>
</div>
</div>
diff --git a/lib/sisu/v5/epub_concordance.rb b/lib/sisu/v5/xhtml_epub2_concordance.rb
index 628435f2..5668521b 100644
--- a/lib/sisu/v5/epub_concordance.rb
+++ b/lib/sisu/v5/xhtml_epub2_concordance.rb
@@ -60,15 +60,15 @@
of words in document)
=end
-module SiSU_EPUB_Concordance
+module SiSU_XHTML_EPUB2_Concordance
require_relative 'particulars' # particulars.rb
include SiSU_Particulars
require_relative 'sysenv' # sysenv.rb
include SiSU_Env
require_relative 'defaults' # defaults.rb
include SiSU_Viz
- require_relative 'epub_format' # epub_format.rb
- include SiSU_EPUB_Format
+ require_relative 'xhtml_epub2_format' # xhtml_epub2_format.rb
+ include SiSU_XHTML_EPUB2_Format
class Source
def initialize(opt)
@opt=opt
@@ -80,13 +80,13 @@ module SiSU_EPUB_Concordance
wordmax=@env.concord_max
unless @md.wc_words.nil?
if @md.wc_words < wordmax
- SiSU_EPUB_Concordance::Source::Words.new(@particulars).songsheet
+ SiSU_XHTML_EPUB2_Concordance::Source::Words.new(@particulars).songsheet
else
SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"*WARN* concordance skipped, large document has over #{wordmax} words (#{@md.wc_words})").warn unless @md.opt.act[:quiet][:set]==:on
end
else
SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"*WARN* wc (word count) is off, concordance will be processed for all files including those over the max set size of: #{wordmax} words").warn unless @md.opt.act[:quiet][:set]==:on
- SiSU_EPUB_Concordance::Source::Words.new(@particulars).songsheet
+ SiSU_XHTML_EPUB2_Concordance::Source::Words.new(@particulars).songsheet
end
rescue
SiSU_Errors::Rescued.new($!,$@,@md.opt.cmd,@md.fns).location do
@@ -98,11 +98,11 @@ module SiSU_EPUB_Concordance
private
class DocTitle
include SiSU_Viz
- #revisit, both requires (html & shared_xml) needed for stand alone operation (sisu -w [filename])
- require_relative 'epub' # epub.rb
+ #revisit, both requires (html & xml_shared) needed for stand alone operation (sisu -w [filename])
+ require_relative 'xhtml_epub2' # xhtml_epub2.rb
def initialize(particulars)
@particulars,@md=particulars,particulars.md
- @data=SiSU_EPUB::Source::XHTML_Environment.new(particulars).tuned_file_instructions
+ @data=SiSU_XHTML_EPUB2::Source::XHTML_Environment.new(particulars).tuned_file_instructions
@vz=SiSU_Viz::Defaults.new
@fnb=@md.fnb
@lex_button=%{<a href="http://www.jus.uio.no/sisu/" target="_top"><img border="0" height="44" width="144" valign="center" src="../_sisu/image/sisu.png" alt="SiSU home"></a>}
@@ -112,7 +112,7 @@ WOK
end
def create
@css=SiSU_Env::CSS_Stylesheet.new(@particulars.md)
- format_head_toc=SiSU_EPUB_Format::HeadToc.new(@md)
+ format_head_toc=SiSU_XHTML_EPUB2_Format::HeadToc.new(@md)
dochead=format_head_toc.head
<<WOK
#{dochead}
@@ -148,15 +148,15 @@ WOK
class Words
require_relative 'defaults' # defaults.rb
include SiSU_Viz
- require_relative 'epub_format' # epub_format.rb
- include SiSU_EPUB_Format
+ require_relative 'xhtml_epub2_format' # xhtml_epub2_format.rb
+ include SiSU_XHTML_EPUB2_Format
require_relative 'sysenv' # sysenv.rb
include SiSU_Screen
def initialize(particulars)
@particulars=particulars
begin
@vz=SiSU_Viz::Defaults.new
- @env,@md,@dal_array=particulars.env,particulars.md,particulars.dal_array
+ @env,@md,@ao_array=particulars.env,particulars.md,particulars.ao_array
@path="#{@env.processing_path.epub}"
@freq=Hash.new(0)
@rxp_lv1=/^#{Mx[:lv_o]}1:/ #fix Mx[:lv_o]
@@ -214,7 +214,7 @@ WOK
def map_para
@seg,toy=nil,nil
@word_map={}
- @dal_array.each do |line|
+ @ao_array.each do |line|
if defined? line.ocn
if (line.is ==:heading \
|| line.is ==:heading_insert) \
@@ -288,7 +288,7 @@ WOK
end
end
seg=''
- @file_concordance << SiSU_EPUB_Concordance::Source::DocTitle.new(@particulars).create
+ @file_concordance << SiSU_XHTML_EPUB2_Concordance::Source::DocTitle.new(@particulars).create
alph=%W[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z]
@file_concordance << '<p>'
alph.each {|x| @file_concordance << %{<a href="##{x}">#{x}</a>,#{$ep[:hsp]}}}
@@ -306,7 +306,7 @@ WOK
end
end
end
- keyword=SiSU_EPUB_Concordance::Source::Word.new(word,@freq[word]).html
+ keyword=SiSU_XHTML_EPUB2_Concordance::Source::Word.new(word,@freq[word]).html
if keyword !~ @rxp_excluded0
if @word_map[word][0] =~ /\d+/
@file_concordance << %{#{keyword}#{seg}#{@word_map[word].uniq.compact.join}}
diff --git a/lib/sisu/v5/epub_format.rb b/lib/sisu/v5/xhtml_epub2_format.rb
index 1c57cd20..e53c3bfe 100644
--- a/lib/sisu/v5/epub_format.rb
+++ b/lib/sisu/v5/xhtml_epub2_format.rb
@@ -59,7 +59,7 @@
** Description: epub formating, css template
=end
-module SiSU_EPUB_Format
+module SiSU_XHTML_EPUB2_Format
include SiSU_Viz
class ParagraphNumber
def initialize(md,ocn)
@@ -1241,8 +1241,8 @@ module SiSU_EPUB_Format
# DublinCore 1 - title
@vz=SiSU_Viz::Defaults.new
@css=SiSU_Env::CSS_Stylesheet.new(md)
- @seg_name_xhtml=(SiSU_EPUB::Source::Seg.new.seg_name_xhtml || [])
- @seg_name_xhtml_tracker=(SiSU_EPUB::Source::Seg.new.seg_name_xhtml_tracker || [])
+ @seg_name_xhtml=(SiSU_XHTML_EPUB2::Source::Seg.new.seg_name_xhtml || [])
+ @seg_name_xhtml_tracker=(SiSU_XHTML_EPUB2::Source::Seg.new.seg_name_xhtml_tracker || [])
@tocband_scroll,@tocband_segtoc=nil,nil
@index,@metalink='index','#metadata'
end
diff --git a/lib/sisu/v5/epub_segments.rb b/lib/sisu/v5/xhtml_epub2_segments.rb
index 16e26855..d16e98e8 100644
--- a/lib/sisu/v5/epub_segments.rb
+++ b/lib/sisu/v5/xhtml_epub2_segments.rb
@@ -59,9 +59,9 @@
** Description: epub segment generation, processing
=end
-module SiSU_EPUB_Seg
- require_relative 'shared_xhtml' # shared_xhtml.rb
- require_relative 'epub' # epub.rb
+module SiSU_XHTML_EPUB2_Seg
+ require_relative 'xhtml_shared' # xhtml_shared.rb
+ require_relative 'xhtml_epub2' # xhtml_epub2.rb
require_relative 'shared_metadata' # shared_metadata.rb
class Output
def initialize(md,outputfile,seg,type='')
@@ -74,19 +74,19 @@ module SiSU_EPUB_Seg
if @type=='endnotes'
@seg[:headings]=[] #watch
txt_obj={ txt: 'Endnotes', ocn_display: ''}
- format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj)
+ format_seg=SiSU_XHTML_EPUB2_Format::FormatSeg.new(@md,txt_obj)
@seg[:headings] << format_seg.title_heading1
filename_seg << @seg[:heading_endnotes] << @seg[:headings] << %{\n<div class="content">\n} << @seg[:endnote_all] << '</div>'
elsif @type=='idx'
@seg[:headings]=[]
- format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj)
+ format_seg=SiSU_XHTML_EPUB2_Format::FormatSeg.new(@md,txt_obj)
@seg[:headings] << format_seg.title_heading1
filename_seg << @seg[:heading_idx] << @seg[:headings] << %{\n<div class="content">\n} << @seg[:idx] << '</div>'
elsif @type=='metadata'
metadata=SiSU_Metadata::Summary.new(@md).xhtml_display.metadata
@seg[:headings]=[]
txt_obj={ txt: 'Metadata', ocn_display: ''}
- format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj)
+ format_seg=SiSU_XHTML_EPUB2_Format::FormatSeg.new(@md,txt_obj)
@seg[:headings] << format_seg.title_heading1
filename_seg << @seg[:heading_idx] << @seg[:headings] << %{\n<div class="content">\n} << metadata << '</div>'
elsif @type=='sisu_manifest'
@@ -101,7 +101,7 @@ WOK
end
@seg[:headings]=[]
txt_obj={ txt: 'Manifest', ocn_display: ''}
- format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj)
+ format_seg=SiSU_XHTML_EPUB2_Format::FormatSeg.new(@md,txt_obj)
@seg[:headings] << format_seg.title_heading1
filename_seg << @seg[:heading_idx] << @seg[:headings] << %{\n<div class="content">\n} << manifest << '</div>'
else
@@ -141,7 +141,7 @@ WOK
begin
data=get_subtoc_endnotes(@data)
data=articles(data)
- SiSU_EPUB_Seg::Seg.new.cleanup # (((( added ))))
+ SiSU_XHTML_EPUB2_Seg::Seg.new.cleanup # (((( added ))))
#### (((( END )))) ####
rescue
SiSU_Errors::Rescued.new($!,$@,@md.opt.cmd,@md.fns).location do
@@ -236,32 +236,32 @@ WOK
|| dob.is==:heading_insert) \
and dob.ln==4
if tracking != 0
- SiSU_EPUB_Seg::Seg.new(@md).tail
+ SiSU_XHTML_EPUB2_Seg::Seg.new(@md).tail
segfilename="#{dir_epub_cont}/#{@@seg_name_xhtml[tracking-1]}#{Sfx[:epub_xhtml]}"
output_epub_cont_seg=File.new(segfilename,'w') if @@seg_name_xhtml[tracking-1]
if dob.is==:heading \
or @@seg_name_xhtml[tracking-1] !~/endnotes|book_index|metadata/
- SiSU_EPUB_Seg::Output.new(@md,output_epub_cont_seg,@@seg).output
+ SiSU_XHTML_EPUB2_Seg::Output.new(@md,output_epub_cont_seg,@@seg).output
elsif dob.is==:heading_insert
if @@seg_name_xhtml[tracking-1]=='endnotes'
- SiSU_EPUB_Seg::Output.new(@md,output_epub_cont_seg,@@seg,'endnotes').output
+ SiSU_XHTML_EPUB2_Seg::Output.new(@md,output_epub_cont_seg,@@seg,'endnotes').output
elsif @@seg_name_xhtml[tracking-1]=='book_index'
- SiSU_EPUB_Seg::Output.new(@md,output_epub_cont_seg,@@seg,'idx').output
+ SiSU_XHTML_EPUB2_Seg::Output.new(@md,output_epub_cont_seg,@@seg,'idx').output
@@seg[:idx]=[]
elsif @@seg_name_xhtml[tracking-1]=='metadata' # navigation bug FIX
- SiSU_EPUB_Seg::Output.new(@md,output_epub_cont_seg,@@seg,'metadata').output
+ SiSU_XHTML_EPUB2_Seg::Output.new(@md,output_epub_cont_seg,@@seg,'metadata').output
else puts "#{__FILE__}::#{__LINE__}"
end
else puts "#{__FILE__}::#{__LINE__}"
end
- SiSU_EPUB_Seg::Seg.new.reinitialise
+ SiSU_XHTML_EPUB2_Seg::Seg.new.reinitialise
heading_art(dob)
head(dob)
if @@seg_name_xhtml[tracking] =='metadata'
segfilename="#{dir_epub_cont}/#{@@seg_name_xhtml[tracking]}#{Sfx[:epub_xhtml]}"
output_epub_cont_seg=File.new(segfilename,'w')
- SiSU_EPUB_Seg::Output.new(@md,output_epub_cont_seg,@@seg,'metadata').output
- SiSU_EPUB_Seg::Seg.new.reinitialise #BUG navigation bug with items following metadata, and occurring before manifest, this becomes a bug ... work area for book index, FIX
+ SiSU_XHTML_EPUB2_Seg::Output.new(@md,output_epub_cont_seg,@@seg,'metadata').output
+ SiSU_XHTML_EPUB2_Seg::Seg.new.reinitialise #BUG navigation bug with items following metadata, and occurring before manifest, this becomes a bug ... work area for book index, FIX
end
#@output_epub_cont_seg.close #%(((( EOF )))) -->
end
@@ -296,7 +296,7 @@ WOK
data
end
def heading_art(dob)
- @@seg[:title]=SiSU_EPUB_Format::HeadSeg.new(@md).head
+ @@seg[:title]=SiSU_XHTML_EPUB2_Format::HeadSeg.new(@md).head
end
def head(dob)
clean=/<!.*?!>|<:.*?>$/
@@ -309,9 +309,9 @@ WOK
ocn=(@@heading1[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \
? $1
: ''
- @p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn)
+ @p_num=SiSU_XHTML_EPUB2_Format::ParagraphNumber.new(@md,ocn)
txt_obj={ txt: @@heading1, ocn_display: @p_num.ocn_display }
- format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj)
+ format_seg=SiSU_XHTML_EPUB2_Format::FormatSeg.new(@md,txt_obj)
@@seg[:headings] << format_seg.title_heading1.gsub(clean,'')
@@heading1=@@heading1.gsub(/#{$ep[:hsp]}<a name="-[\d*+]+" href="#_[\d*+]+">#{$ep[:hsp]}<sup>[\d*+]+<\/sup>#{$ep[:hsp]}<\/a>/,'')
end
@@ -320,9 +320,9 @@ WOK
ocn=(heading2[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \
? $1
: ''
- @p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn)
+ @p_num=SiSU_XHTML_EPUB2_Format::ParagraphNumber.new(@md,ocn)
txt_obj={ txt: heading2, ocn_display: @p_num.ocn_display }
- format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj)
+ format_seg=SiSU_XHTML_EPUB2_Format::FormatSeg.new(@md,txt_obj)
@@seg[:headings] << format_seg.title_heading2.gsub(clean,'')
@@heading2=@@heading2.gsub(/#{$ep[:hsp]}<a name="-[\d*+]+" href="#_[\d*+]+">#{$ep[:hsp]}<sup>[\d*+]+<\/sup>#{$ep[:hsp]}<\/a>/,'')
end
@@ -331,9 +331,9 @@ WOK
ocn=(heading3[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \
? $1
: ''
- @p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn)
+ @p_num=SiSU_XHTML_EPUB2_Format::ParagraphNumber.new(@md,ocn)
txt_obj={ txt: heading3, ocn_display: @p_num.ocn_display }
- format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj)
+ format_seg=SiSU_XHTML_EPUB2_Format::FormatSeg.new(@md,txt_obj)
@@seg[:headings] << format_seg.title_heading3.gsub(clean,'')
@@heading3=@@heading3.gsub(/#{$ep[:hsp]}<a name="-[\d*+]+" href="#_[\d*+]+">#{$ep[:hsp]}<sup>[\d*+]+<\/sup>#{$ep[:hsp]}<\/a>/,'')
end
@@ -342,9 +342,9 @@ WOK
ocn=(heading4[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \
? $1
: ''
- @p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn)
+ @p_num=SiSU_XHTML_EPUB2_Format::ParagraphNumber.new(@md,ocn)
txt_obj={ txt: heading4, ocn_display: @p_num.ocn_display }
- format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj)
+ format_seg=SiSU_XHTML_EPUB2_Format::FormatSeg.new(@md,txt_obj)
@@seg[:headings] << format_seg.title_heading4.gsub(clean,'')
end
@@tracker=@@tracker+1
@@ -355,9 +355,9 @@ WOK
|| dob.is ==:heading_insert \
|| dob.is ==:para
#extend as necessary FIX
- @p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,dob.ocn)
+ @p_num=SiSU_XHTML_EPUB2_Format::ParagraphNumber.new(@md,dob.ocn)
end
- sto=SiSU_EPUB_Format::FormatTextObject.new(@md,dob)
+ sto=SiSU_XHTML_EPUB2_Format::FormatTextObject.new(@md,dob)
dob_xhtml=if dob.is==:heading \
|| dob.is==:heading_insert \
|| dob.is==:para
@@ -408,13 +408,13 @@ WOK
|| dob.is==:heading_insert \
|| dob.is==:para) \
&& (not dob.ocn or dob.ocn.to_s.empty?)
- format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,dob)
+ format_seg=SiSU_XHTML_EPUB2_Format::FormatSeg.new(@md,dob)
end
if (dob.is==:heading \
|| dob.is==:heading_insert \
|| dob.is==:para) \
and dob.note_ #dob.obj =~/<a href="#note_ref\d+">&nbsp;<sup id=/ #endnote- note-
- format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,dob)
+ format_seg=SiSU_XHTML_EPUB2_Format::FormatSeg.new(@md,dob)
dob.obj=format_seg.no_paranum
end
if (dob.is==:heading \
@@ -430,7 +430,7 @@ WOK
end
end
def tail
- format_head_seg=SiSU_EPUB_Format::HeadSeg.new(@md)
+ format_head_seg=SiSU_XHTML_EPUB2_Format::HeadSeg.new(@md)
if @md.flag_auto_endnotes \
and @@seg_endnotes[@@get_hash_fn]
@@seg[:tail] << %{\n<div class="content">\n<div class="endnote">\n}
@@ -486,10 +486,10 @@ WOK
and dob.ln.to_s =~/^[56]/
case dob.ln
when 5
- format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,dob)
+ format_seg=SiSU_XHTML_EPUB2_Format::FormatSeg.new(@md,dob)
subtoc=format_seg.subtoc_lev5 #keep and make available, this is the subtoc
when 6
- format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,dob)
+ format_seg=SiSU_XHTML_EPUB2_Format::FormatSeg.new(@md,dob)
subtoc=format_seg.subtoc_lev6 #keep and make available, this is the subtoc
end
@@seg_subtoc_array << subtoc
@@ -516,7 +516,7 @@ WOK
try=e_n.split(/<br \/>/)
try.each do |e|
txt_obj={ txt: e }
- format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj)
+ format_seg=SiSU_XHTML_EPUB2_Format::FormatSeg.new(@md,txt_obj)
note_match=if e =~/#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]}/
format_seg.endnote_body_indent
else format_seg.endnote_body
@@ -529,7 +529,7 @@ WOK
endnote_part_a=note_match_seg[m,1]
endnote_part_b=note_match_seg[m,2]
txt_obj={ endnote_part_a: endnote_part_a, endnote_part_b: endnote_part_b }
- format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj)
+ format_seg=SiSU_XHTML_EPUB2_Format::FormatSeg.new(@md,txt_obj)
note_match_all_seg=format_seg.endnote_seg_body(@@fn) #BUG WATCH 200408
@@seg[:endnote_all] << note_match_all_seg
end
diff --git a/lib/sisu/v5/epub_tune.rb b/lib/sisu/v5/xhtml_epub2_tune.rb
index 5ec5fa56..b46f49f0 100644
--- a/lib/sisu/v5/epub_tune.rb
+++ b/lib/sisu/v5/xhtml_epub2_tune.rb
@@ -60,10 +60,10 @@
=end
require_relative 'param'
-module SiSU_EPUB_Tune
+module SiSU_XHTML_EPUB2_Tune
require_relative 'sysenv' # sysenv.rb
include SiSU_Env; include SiSU_Screen
- require_relative 'epub_format' # epub_format.rb #watch
+ require_relative 'xhtml_epub2_format' # xhtml_epub2_format.rb #watch
@@line_mode=''
@@endnote_array=[]
@@endnote_call_counter=1
@@ -127,15 +127,15 @@ module SiSU_EPUB_Tune
|| @md.opt.act[:maintenance][:set]==:on)
SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'Tune').txt_grey
end
- data=SiSU_EPUB_Tune::Tune.new(@data,@md).amp_angle_brackets
- data=SiSU_EPUB_Tune::Tune.new(data,@md).endnotes_html
- data=SiSU_EPUB_Tune::Tune.new(data,@md).url_markup
- data=SiSU_EPUB_Tune::Tune.new(data,@md).markup
+ data=SiSU_XHTML_EPUB2_Tune::Tune.new(@data,@md).amp_angle_brackets
+ data=SiSU_XHTML_EPUB2_Tune::Tune.new(data,@md).endnotes_html
+ data=SiSU_XHTML_EPUB2_Tune::Tune.new(data,@md).url_markup
+ data=SiSU_XHTML_EPUB2_Tune::Tune.new(data,@md).markup
if @md.opt.act[:maintenance][:set]==:on #Hard Output Tune Optional on/off here
- data=SiSU_EPUB_Tune::Output.new(data,@md).hard_output
- SiSU_EPUB_Tune::Output.new(data,@md).marshal
+ data=SiSU_XHTML_EPUB2_Tune::Output.new(data,@md).hard_output
+ SiSU_XHTML_EPUB2_Tune::Output.new(data,@md).marshal
end
- SiSU_EPUB_Tune::Tune.new(@data,@md).output
+ SiSU_XHTML_EPUB2_Tune::Tune.new(@data,@md).output
rescue
SiSU_Errors::Rescued.new($!,$@,@md.opt.cmd,@md.fns).location do
__LINE__.to_s + ':' + __FILE__
@@ -163,7 +163,7 @@ module SiSU_EPUB_Tune
gsub(/#{Dx[:url_o]}/,Dx[:url_o_xml]).gsub(/#{Dx[:url_c]}/,Dx[:url_o_xml]).
gsub(/#{Mx[:nbsp]}/,$ep[:hsp]).
gsub(/<(p|br)>/,'<\1 />')
- dob.obj=SiSU_EPUB_Tune::CleanXHTML.new(dob.obj).clean
+ dob.obj=SiSU_XHTML_EPUB2_Tune::CleanXHTML.new(dob.obj).clean
@tuned_file << dob
end
end
diff --git a/lib/sisu/v5/shared_xhtml.rb b/lib/sisu/v5/xhtml_shared.rb
index c9534823..27ddba4b 100644
--- a/lib/sisu/v5/shared_xhtml.rb
+++ b/lib/sisu/v5/xhtml_shared.rb
@@ -50,7 +50,7 @@
* Git
<http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/shared_xhtml.rb;hb=HEAD>
+ <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/xhtml_shared.rb;hb=HEAD>
* Ralph Amissah
<ralph@amissah.com>
diff --git a/lib/sisu/v5/xml_docbook5.rb b/lib/sisu/v5/xml_docbook5.rb
new file mode 100644
index 00000000..d3840d18
--- /dev/null
+++ b/lib/sisu/v5/xml_docbook5.rb
@@ -0,0 +1,271 @@
+# 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 <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Git
+ <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
+ <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/xml_docbook_book.rb;hb=HEAD>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: Docbook book XML rendition
+
+=end
+module SiSU_XML_Docbook_Book
+ 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_Docbook_Book::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.docbook_viewer} #{@md.file.output_path.xml_docbook_book.dir}/#{@md.file.base_filename.xml_docbook_book}"
+ : "[#{@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],'DocBook',tool).green_hi_blue
+ : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'DocBook',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_docbook_book.dir}/#{@md.file.base_filename.xml_docbook_book}").flow
+ end
+ end
+ end
+ class Scroll <Source
+ def initialize(data='',md='')
+ @data,@md=data,md
+ @trans=SiSU_XML_Munge::Trans.new(@md)
+ @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(md.opt)
+ @env=@particulars.env
+ end
+ def songsheet
+ @t='sisu'
+ data=@data
+ if @md.opt.act[:verbose_plus][:set]==:on
+ structure_collapsed(data)
+ end
+ #head
+ #extract_endnotes
+ data=markup_text(data)
+ structure_build_collapsed(data)
+ #tail
+ end
+ def space
+ ' '
+ end
+ def tags
+ # collapsed -->
+ def collapsed
+ %w[ 0 1 2 3 4 5 6 ]
+ end
+ def docbook(lc,chlv='')
+ case lc
+ when 1
+ 'book'
+ when 2
+ lc==chlv ? 'chapter' : 'section'
+ when 3
+ lc==chlv ? 'chapter' : 'section'
+ when 4
+ lc==chlv ? 'chapter' : 'section'
+ when 5
+ 'section'
+ when 6
+ 'section'
+ end
+ end
+ self
+ end
+ def put(line)
+ #@file_docbook.puts line #look into and use perhaps
+ puts line if @md.opt.act[:verbose_plus][:set]==:on
+ end
+ def head
+ <<-WOK
+<?xml version="1.0" encoding="utf-8"?>
+<book xmlns="http://docbook.org/ns/docbook"
+ xmlns:xl="http://www.w3.org/1999/xlink"
+ version="5.0">
+ WOK
+ end
+ def markup_text(data)
+ data.each_with_index do |o,i|
+ if o.is ==:heading || o.is ==:para
+ o=@trans.markup_docbook(o) #unless o.obj==nil
+ end
+ end
+ data
+ end
+ def tail
+ tail=<<-WOK
+</book>
+ WOK
+ put(tail)
+ end
+ def output(o,lev=nil,comment='')
+ puts lev == 0..6 \
+ ? "#{space*lev}<#{lev}>[#{o.ocn}] #{o.ln} #{o.obj}</#{lev}>#{comment}"
+ : "<#{lev}>[#{o.ocn}] #{o.ln} #{o.obj}</#{lev}>#{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 chapterlevel
+ #end
+ def structure_build_collapsed(data)
+ #output_file=@md.file.output_path.xml_docbook_book.dir + '/' + @md.file.base_filename.xml_docbook_book
+ file=SiSU_Env::FileOp.new(@md)
+ filename_docbook=file.write_file.xml_docbook_book
+ h=0
+ @chlv=chlv=0
+ doc_position=:head
+ filename_docbook.puts head
+ data.each_with_index do |o,i|
+ if (defined? o.ocn and not o.ocn.nil?)
+ ocn="\n#{Dx[:ocn_o]}#{o.ocn}#{Dx[:ocn_c]}"
+ id=%{ id="o#{o.ocn}" }
+ else
+ ocn,id='',''
+ end
+ if (o.is ==:heading || o.is ==:heading_insert)
+ lev=o.lc
+ chlv=(o.lv.to_i == 1) \
+ ? @chlv=o.lc.to_i
+ : 0
+ @splv=lev
+ unless doc_position==:head
+ filename_docbook.puts structure_build_tag_close(lev,h)
+ end
+ doc_position=:body_and_tail
+ filename_docbook.puts %{#{space*(lev-1)}<#{tags.docbook(lev,chlv)}>
+#{space*lev}<title#{id}>
+}
+ filename_docbook.puts SiSU_TextUtils::Wrap.new(o.obj + ocn,80,(@splv*2+2)).line_wrap
+ filename_docbook.puts %{#{space*lev}</title>}
+ h=lev
+ elsif (o.of ==:para or o.of ==:block)
+ filename_docbook.puts "#{space*(@splv)}<para#{id}>"
+ filename_docbook.puts SiSU_TextUtils::Wrap.new(o.obj + ocn,80,(@splv*2+2)).line_wrap
+ filename_docbook.puts "#{space*(@splv)}</para>"
+ end
+ end
+ filename_docbook.puts structure_build_tag_close(0,h)
+ filename_docbook.close
+ end
+ def structure_build_tag_close(lev,h)
+ x=[]
+ case h
+ when 1
+ x << "#{space*0}</#{tags.docbook(1)}>" if (lev <= 1)
+ when 2
+ x << "#{space*1}</#{tags.docbook(2,@chlv)}>" if (lev <= 2)
+ x << "#{space*0}</#{tags.docbook(1)}>" if (lev <= 1)
+ when 3
+ x << "#{space*2}</#{tags.docbook(3,@chlv)}>" if (lev <= 3)
+ x << "#{space*1}</#{tags.docbook(2,@chlv)}>" if (lev <= 2)
+ x << "#{space*0}</#{tags.docbook(1)}>" if (lev <= 1)
+ when 4
+ x << "#{space*3}</#{tags.docbook(4,@chlv)}>" if (lev <= 4)
+ x << "#{space*2}</#{tags.docbook(3,@chlv)}>" if (lev <= 3)
+ x << "#{space*1}</#{tags.docbook(2,@chlv)}>" if (lev <= 2)
+ x << "#{space*0}</#{tags.docbook(1)}>" if (lev <= 1)
+ when 5
+ x << "#{space*4}</#{tags.docbook(5)}>" if (lev <= 5)
+ x << "#{space*3}</#{tags.docbook(4,@chlv)}>" if (lev <= 4)
+ x << "#{space*2}</#{tags.docbook(3,@chlv)}>" if (lev <= 3)
+ x << "#{space*1}</#{tags.docbook(2,@chlv)}>" if (lev <= 2)
+ x << "#{space*0}</#{tags.docbook(1)}>" if (lev <= 1)
+ when 6
+ x << "#{space*5}</#{tags.docbook(6)}>" if (lev <= 6)
+ x << "#{space*4}</#{tags.docbook(5)}>" if (lev <= 5)
+ x << "#{space*3}</#{tags.docbook(4,@chlv)}>" if (lev <= 4)
+ x << "#{space*2}</#{tags.docbook(3,@chlv)}>" if (lev <= 3)
+ x << "#{space*1}</#{tags.docbook(2,@chlv)}>" if (lev <= 2)
+ x << "#{space*0}</#{tags.docbook(1)}>" if (lev <= 1)
+ end
+ x.join("\n")
+ end
+ end
+ end
+end
+__END__
diff --git a/lib/sisu/v5/xml_dom.rb b/lib/sisu/v5/xml_dom.rb
index f6d86883..6f0391f1 100644
--- a/lib/sisu/v5/xml_dom.rb
+++ b/lib/sisu/v5/xml_dom.rb
@@ -66,8 +66,8 @@ module SiSU_XML_DOM
include SiSU_Particulars
require_relative 'sysenv' # sysenv.rb
include SiSU_Env
- require_relative 'dal' # dal.rb
- require_relative 'shared_xml' # shared_xml.rb
+ require_relative 'ao' # ao.rb
+ require_relative 'xml_shared' # xml_shared.rb
include SiSU_XML_Munge
require_relative 'xml_format' # xml_format.rb
include SiSU_XML_Format
@@ -83,7 +83,7 @@ module SiSU_XML_DOM
end
def read
begin
- @env,@md,@dal_array=@particulars.env,@particulars.md,@particulars.dal_array
+ @env,@md,@ao_array=@particulars.env,@particulars.md,@particulars.ao_array
unless @opt.act[:quiet][:set]==:on
tool=if (@opt.act[:verbose_plus][:set]==:on \
|| @opt.act[:maintenance][:set]==:on)
@@ -114,7 +114,7 @@ module SiSU_XML_DOM
private
class Songsheet
def initialize(particulars)
- @env,@md,@dal_array,@particulars=particulars.env,particulars.md,particulars.dal_array,particulars
+ @env,@md,@ao_array,@particulars=particulars.env,particulars.md,particulars.ao_array,particulars
@file=SiSU_Env::FileOp.new(@md)
end
def songsheet
@@ -135,19 +135,19 @@ module SiSU_XML_DOM
end
end
class Scroll
- require_relative 'shared_txt' # shared_txt.rb
+ require_relative 'txt_shared' # txt_shared.rb
include SiSU_TextUtils
- require_relative 'shared_xhtml' # decide use, whether xml rather than xhtml
+ require_relative 'xhtml_shared' # decide use, whether xml rather than xhtml
@@xml={ body: [], open: [], close: [], head: [], sc: [] }
def initialize(particulars)
- @env,@md,@dal_array=particulars.env,particulars.md,particulars.dal_array
+ @env,@md,@ao_array=particulars.env,particulars.md,particulars.ao_array
@vz=SiSU_Viz::Defaults.new
@trans=SiSU_XML_Munge::Trans.new(@md)
@sys=SiSU_Env::SystemCall.new
end
def songsheet
pre
- @data=markup(@dal_array)
+ @data=markup(@ao_array)
post
publish
end
diff --git a/lib/sisu/v5/xml_fictionbook.rb b/lib/sisu/v5/xml_fictionbook.rb
deleted file mode 100644
index 446e12e2..00000000
--- a/lib/sisu/v5/xml_fictionbook.rb
+++ /dev/null
@@ -1,305 +0,0 @@
-# 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 <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.sisudoc.org/sisu/en/SiSU/download.html>
-
- * Git
- <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/xml_fictionbook.rb;hb=HEAD>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: extract and print an XML rendition of document structure to screen
-
-=end
-module SiSU_XML_Fictionbook
- require_relative 'dal' # dal.rb
- require_relative 'sysenv' # sysenv.rb
- include SiSU_Env
- require_relative 'shared_txt' # shared_txt.rb
- include SiSU_TextUtils
- require_relative 'shared_xml' # shared_xml.rb
- include SiSU_XML_Munge
- include SiSU_Param
- class Source
- def initialize(opt)
- @opt=opt
- @sp=' '
- end
- def read
- begin
- @md=SiSU_Param::Parameters.new(@opt).get
- @dal_array=SiSU_DAL::Source.new(@opt).get
- SiSU_XML_Fictionbook::Source::Scroll.new(@dal_array,@md).songsheet
- rescue
- SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do
- __LINE__.to_s + ':' + __FILE__
- end
- ensure
- end
- end
- private
- class Scroll <Source
- def initialize(data='',md='')
- @data,@md=data,md
- @trans=SiSU_XML_Munge::Trans.new(@md)
- @file_fictionbook=SiSU_Env::FileOp.new(@md,'fictionbook.xml').mkfile
- end
- def songsheet
- @t='fictionbook'
- @s=['section', #@s=['body',
- 'section',
- 'section',
- 'section',
- 'section',
- 'section',
- 'section'
- ]
- head
- extract_endnotes
- structure
- tail
- 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 <p>#{@md.date.available} Initial version</p>"
- else ''
- end
- date_modified=if defined? @md.date.modified; "\n <p>#{@md.date.modified} Last Modified</p>"
- else ''
- end
- head=<<WOK
-<?xml version="1.0" encoding="UTF-8"?>
-<FictionBook xmlns:xlink="http://www.w3.org/1999/xlink"
- xmlns="http://www.gribuser.ru/xml/fictionbook/2.0">
-<description>
- <title-info>
- <genre match="100">***</genre>
- <author>
- <first-name>***</first-name>
- <middle-name>***</middle-name>
- <last-name>***</last-name>
- </author>
- <book-title>#{@md.title.full}</book-title>
- <annotation>
- </annotation>
- <date value="#{@md.date}">yyyy</date>
- </title-info>
- <document-info>
- <author>
- <first-name/>
- <last-name/>
- <nickname/>
- </author>
- <program-used>#{version[:project]} #{version[:version]} and #{rb_ver}</program-used>
- <date value="#{version[:date]}">#{version[:date]}</date>
- <src-ocr/>
- <version>1.0</version>
- <history>#{date_available}#{date_modified}
- </history>
- </document-info>
-</description>
-<body>
-WOK
- put(head)
- end
- def extract_endnotes
- @endnotes=[]
- @data.each do |para|
- @endnotes << para.scan(/~\{(.+?)\}~/m)
- end
- @endnotes=@endnotes.flatten
- end
- def endnotes
- @endnotes.each do |endnote|
- endnote=endnote.strip
- endnote=@trans.markup_fictionbook(endnote)
- endnote="<p>#{endnote}</p>"
- util=SiSU_TextUtils::Wrap.new(endnote,80,10)
- endnote=util.line_wrap
- put(endnote)
- end
- end
- def tail
- tail=<<WOK
-</body>
-</FictionBook>
-WOK
- put(tail)
- end
- def markup(para,type='')
- para=para.strip
- para=@trans.markup_fictionbook(para)
- para=if type.empty?; "<p>#{para}</p>"
- else "<#{type}><p>#{para}</p></#{type}>"
- end
- util=SiSU_TextUtils::Wrap.new(para,80,10)
- util.line_wrap
- end
- def put(line)
- @file_fictionbook.puts line
- puts line if @md.opt.act[:verbose_plus][:set]==:on
- end
- def structure_build_tag_close(lev,h)
- @sp=' '
- case h[0]
- when 1
- put("#{@sp*1}</#{@s[1]}>") if (lev <= 1) and h[1]
- put("</#{@s[0]}>") if (lev==0)
- when 2
- put("#{@sp*2}</#{@s[2]}>") if (lev <= 2) and h[2]
- put("#{@sp*1}</#{@s[1]}>") if (lev <= 1) and h[1]
- put("</#{@s[0]}>") if (lev==0)
- when 3
- put("#{@sp*3}</#{@s[3]}>") if (lev <= 3) and h[3]
- put("#{@sp*2}</#{@s[2]}>") if (lev <= 2) and h[2]
- put("#{@sp*1}</#{@s[1]}>") if (lev <= 1) and h[1]
- put("</#{@s[0]}>") if (lev==0)
- when 4
- put("#{@sp*4}</#{@s[4]}>") if (lev <= 4)
- put("#{@sp*3}</#{@s[3]}>") if (lev <= 3) and h[3]
- put("#{@sp*2}</#{@s[2]}>") if (lev <= 2) and h[2]
- put("#{@sp*1}</#{@s[1]}>") if (lev <= 1) and h[1]
- put("</#{@s[0]}>") if (lev==0)
- when 5
- put("#{@sp*5}</#{@s[5]}>") if (lev <= 5)
- put("#{@sp*4}</#{@s[4]}>") if (lev <= 4)
- put("#{@sp*3}</#{@s[3]}>") if (lev <= 3) and h[3]
- put("#{@sp*2}</#{@s[2]}>") if (lev <= 2) and h[2]
- put("#{@sp*1}</#{@s[1]}>") if (lev <= 1) and h[1]
- put("</#{@s[0]}>") if (lev==0)
- when 6
- put("#{@sp*6}</#{@s[6]}>") if (lev <= 6)
- put("#{@sp*5}</#{@s[5]}>") if (lev <= 5)
- put("#{@sp*4}</#{@s[4]}>") if (lev <= 4)
- put("#{@sp*3}</#{@s[3]}>") if (lev <= 3) and h[3]
- put("#{@sp*2}</#{@s[2]}>") if (lev <= 2) and h[2]
- put("#{@sp*1}</#{@s[1]}>") if (lev <= 1) and h[1]
- put("</#{@s[0]}>") if (lev==0)
- end
- end
- def structure_build(ds)
- @h=[0,false,false,false]
- put("<#{@s[0]}>")
- ds.each_with_index do |x,i|
- @ef=false
- case x[:lev]
- when /^1/
- structure_build_tag_close(1,@h)
- y="#{@sp*1}<#{@s[1]}>\n#{x[:para]}"
- @h=[1,true,false,false]
- when /^2/
- structure_build_tag_close(2,@h)
- y="#{@sp*2}<#{@s[2]}>\n#{x[:para]}"
- @h=[2,true,true,false]
- when /^0:0/ #endnotes and metadata
- structure_build_tag_close(2,@h)
- y="#{@sp*2}<#{@s[2]}>\n#{x[:para]}"
- @h=[2,true,true,false]
- @ef=true if x[:hdr] =~/u0/
- when /^3/
- structure_build_tag_close(3,@h)
- y="#{@sp*3}<#{@s[3]}>\n#{x[:para]}"
- @h=[3,true,true,true]
- when /^4/
- structure_build_tag_close(4,@h)
- y="#{@sp*4}<#{@s[4]}>\n#{x[:para]}"
- @h[0]=4
- when /^m2/ #metadata
- structure_build_tag_close(4,@h)
- y="#{@sp*4}<#{@s[4]}>\n#{x[:para]}"
- @h[0]=4
- when /^5/
- structure_build_tag_close(5,@h)
- y="#{@sp*5}<#{@s[5]}>\n#{x[:para]}"
- @h[0]=5
- when /^6/
- structure_build_tag_close(6,@h)
- y="#{@sp*6}<#{@s[6]}>\n#{x[:para]}"
- @h[0]=6
- else
- y=if @md.opt.act[:verbose_plus][:set]==:on; "#{x[:para]}"
- else nil
- end
- end
- put(y) if y
- endnotes if @ef
- end
- structure_build_tag_close(0,@h)
- end
- def structure
- data=@data
- @ds=[]
- c=0
- data.each do |para|
- rgx_headers=/#{Mx[:id_o]}~(\d+);((?:\w|[0-6]:)\d+);(\w\d+)#{Mx[:id_c]}/ #fix
- if para =~rgx_headers
- x=(rgx_headers).match(para)
- if x[3] =~/^[hum]\d+/
- @ds[c]={}
- @ds[c][:ocn]=x[1]
- @ds[c][:lev]=x[2]
- @ds[c][:hdr]=x[3]
- @ds[c][:para]=markup(para,'title')
- else
- @ds[c]={}
- @ds[c][:para]=markup(para) if @md.opt.act[:verbose_plus][:set]==:on
- end
- c+=1
- end
- end
- structure_build(@ds)
- @ds
- end
- end
- end
-end
-__END__
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 <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Git
+ <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
+ <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/xml_fictionbook.rb;hb=HEAD>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** 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 <Source
+ def initialize(data='',md='')
+ @data,@md=data,md
+ @trans=SiSU_XML_Munge::Trans.new(@md)
+ @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(md.opt)
+ @env=@particulars.env
+ end
+ def songsheet
+ @t='sisu'
+ data=@data
+ if @md.opt.act[:verbose_plus][:set]==:on
+ structure_collapsed(data)
+ end
+ head
+ endnotes=extract_endnotes
+ images_base64=extract_images
+ data=markup_text(data)
+ structure_build_collapsed(data,endnotes,images_base64)
+ end
+ def space
+ ' '
+ end
+ def tags
+ # collapsed -->
+ 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 <p>#{@md.date.available} Initial version</p>"
+ else ''
+ end
+ date_modified=if defined? @md.date.modified; "\n <p>#{@md.date.modified} Last Modified</p>"
+ else ''
+ end
+ coverpageimage=if defined? @md.make.cover_image[:cover]
+ %{\n <coverpage><image href="##{@md.make.cover_image[:cover]}" /></coverpage>}
+ else ''
+ end
+ if defined? @md.authors \
+ and @md.authors.length > 0
+ authors=[]
+ @md.authors.each do |author|
+ authors << ' <author>'
+ if not author[:others].empty?
+ authors << %{ <first-name>#{author[:others]}</first-name>}
+ end
+ if not author[:the].empty?
+ authors << %{ <last-name>#{author[:the]}</last-name>}
+ end
+ authors << ' </author>'
+ end
+ authors=authors.join("\n")
+ end
+ <<-WOK
+<?xml version="1.0" encoding="UTF-8"?>
+<FictionBook xmlns:xl="http://www.w3.org/1999/xlink"
+ xmlns="http://www.gribuser.ru/xml/fictionbook/2.0">
+<description>
+ <title-info>
+ <genre match="100">***</genre>
+#{authors}
+ <book-title>#{@md.title.full}</book-title>#{coverpageimage}
+ <annotation>
+ </annotation>
+ <date value="#{@md.date.published}">#{@md.date.published}</date>
+ </title-info>
+ <document-info>
+ <author>
+ <first-name/>
+ <last-name/>
+ <nickname/>
+ </author>
+ <program-used>#{version[:project]} #{version[:version]} and #{rb_ver}</program-used>
+ <date value="#{version[:date]}">#{version[:date]}</date>
+ <src-url>#{@md.file.output_path.manifest.url}/#{@md.file.base_filename.manifest}</src-url>
+ <id></id>
+ <version>1.0</version>
+ <history>#{date_available}#{date_modified}
+ </history>
+ </document-info>
+</description>
+<body>
+ 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,
+ %{<section id="footnote\\1">\n
+<title><p>\\1.</p></title>\n
+<p>\\2</p>\n
+</section>})
+ 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 << %{<binary content-type="image/#{imgtype}" id="#{k}">#{images_base64[k]}
+</binary>
+}
+ 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
+</body>
+#{images_base64_fb2}
+</FictionBook>
+ WOK
+ end
+ def output(o,lev=nil,comment='')
+ puts lev == 0..6 \
+ ? "#{space*lev}<#{lev}>[#{o.ocn}] #{o.ln} #{o.obj}</#{lev}>#{comment}"
+ : "<#{lev}>[#{o.ocn}] #{o.ln} #{o.obj}</#{lev}>#{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 %{</body><body name="notes">}
+ 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}<title>
+}
+ filename_fictionbook.puts SiSU_TextUtils::Wrap.new("<p>#{o.obj}#{ocn}</p>",80,(lev*2+2)).line_wrap
+ filename_fictionbook.puts %{#{space*lev}</title>}
+ 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("<p>#{o.obj}#{ocn}</p>",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}</#{tags.fictionbook[1]}>" if (lev <= 1)
+ when 2
+ x << "#{space*2}</#{tags.fictionbook[2]}>" if (lev <= 2)
+ x << "#{space*1}</#{tags.fictionbook[1]}>" if (lev <= 1)
+ when 3
+ x << "#{space*3}</#{tags.fictionbook[3]}>" if (lev <= 3)
+ x << "#{space*2}</#{tags.fictionbook[2]}>" if (lev <= 2)
+ x << "#{space*1}</#{tags.fictionbook[1]}>" if (lev <= 1)
+ when 4
+ x << "#{space*4}</#{tags.fictionbook[4]}>" if (lev <= 4)
+ x << "#{space*3}</#{tags.fictionbook[3]}>" if (lev <= 3)
+ x << "#{space*2}</#{tags.fictionbook[2]}>" if (lev <= 2)
+ x << "#{space*1}</#{tags.fictionbook[1]}>" if (lev <= 1)
+ when 5
+ x << "#{space*5}</#{tags.fictionbook[5]}>" if (lev <= 5)
+ x << "#{space*4}</#{tags.fictionbook[4]}>" if (lev <= 4)
+ x << "#{space*3}</#{tags.fictionbook[3]}>" if (lev <= 3)
+ x << "#{space*2}</#{tags.fictionbook[2]}>" if (lev <= 2)
+ x << "#{space*1}</#{tags.fictionbook[1]}>" if (lev <= 1)
+ when 6
+ x << "#{space*6}</#{tags.fictionbook[6]}>" if (lev <= 6)
+ x << "#{space*5}</#{tags.fictionbook[5]}>" if (lev <= 5)
+ x << "#{space*4}</#{tags.fictionbook[4]}>" if (lev <= 4)
+ x << "#{space*3}</#{tags.fictionbook[3]}>" if (lev <= 3)
+ x << "#{space*2}</#{tags.fictionbook[2]}>" if (lev <= 2)
+ x << "#{space*1}</#{tags.fictionbook[1]}>" if (lev <= 1)
+ end
+ x.join("\n")
+ end
+ end
+ end
+end
+__END__
diff --git a/lib/sisu/v5/odf.rb b/lib/sisu/v5/xml_odf_odt.rb
index 5e277992..e7389110 100644
--- a/lib/sisu/v5/odf.rb
+++ b/lib/sisu/v5/xml_odf_odt.rb
@@ -59,17 +59,17 @@
** Description: opendocument text generation
=end
-module SiSU_ODF
+module SiSU_XML_ODF_ODT
require_relative 'particulars' # particulars.rb
include SiSU_Particulars
- require_relative 'dal' # dal.rb
+ require_relative 'ao' # ao.rb
require_relative 'sysenv' # sysenv.rb
include SiSU_Env
include SiSU_Viz
- require_relative 'odf_format' # odf_format.rb
- include SiSU_ODF_Format
+ require_relative 'xml_odf_odt_format' # xml_odf_odt_format.rb
+ include SiSU_XML_ODF_ODT_Format
require_relative 'shared_metadata' # shared_metadata.rb
- require_relative 'shared_txt' # shared_txt.rb
+ require_relative 'txt_shared' # txt_shared.rb
@@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0
class Source
require 'zlib'
@@ -81,7 +81,7 @@ module SiSU_ODF
end
def read
begin
- @md,@env,@dal_array=@particulars.md,@particulars.env,@particulars.dal_array
+ @md,@env,@ao_array=@particulars.md,@particulars.env,@particulars.ao_array
unless @opt.act[:quiet][:set]==:on
tool=(@opt.act[:verbose][:set]==:on \
|| @opt.act[:verbose_plus][:set]==:on \
@@ -98,7 +98,7 @@ module SiSU_ODF
SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"file://#{@md.file.output_path.odt.dir}/#{@md.file.base_filename.odt}").flow
end
end
- SiSU_ODF::Source::Scroll.new(@particulars).songsheet
+ SiSU_XML_ODF_ODT::Source::Scroll.new(@particulars).songsheet
rescue
SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do
__LINE__.to_s + ':' + __FILE__
@@ -109,24 +109,23 @@ module SiSU_ODF
private
class Scroll <Source
require_relative 'defaults' # defaults.rb
- require_relative 'shared_txt' # shared_txt.rb
+ require_relative 'txt_shared' # txt_shared.rb
@@img_count=0
@@odf={ body: [], head: [], toc: [], metadata: [], tail: [], book_idx: [], endnotes: [] }
@@docstart=true
@@fns=nil
def initialize(particulars)
- @md,@env,@dal_array=particulars.md,particulars.env,particulars.dal_array
+ @md,@env,@ao_array=particulars.md,particulars.env,particulars.ao_array
@vz=SiSU_Viz::Defaults.new
@tab="\t"
@brace_url=SiSU_Viz::Defaults.new.url_decoration
@br=(@md.opt.act[:maintenance][:set]==:on) \
? '' : ''
- #@br=(@md.opt.cmd =~/M/) ? "\n" : ''
end
def songsheet
begin
pre
- @data=markup(@dal_array)
+ @data=markup(@ao_array)
publish
ensure
unless (@md.opt.act[:verbose_plus][:set]==:on \
@@ -139,6 +138,10 @@ module SiSU_ODF
end
end
end
+ def break_line
+ (@md.opt.act[:maintenance][:set]==:on) \
+ ? "\n" : ''
+ end
# Used for extraction of endnotes from paragraphs
def extract_endnotes(dob='')
notes=dob.obj.scan(/#{Mx[:en_a_o]}(\d+\s+.+?)#{Mx[:en_a_c]}/)[1] #FIX
@@ -160,7 +163,7 @@ module SiSU_ODF
idx_arr,idx_raw=[],SiSU_Particulars::CombinedSingleton.instance.get_idx_raw(@md.opt).raw_idx
idx_raw.each do |x|
x=if x.is_a?(String)
- SiSU_ODF_Format::FormatBookIndex.new(x).book_idx_bookmark
+ SiSU_XML_ODF_ODT_Format::FormatBookIndex.new(x).book_idx_bookmark
else nil
end
idx_arr << x.strip if x.is_a?(String)
@@ -173,12 +176,12 @@ module SiSU_ODF
end
def odf_tail
manifest="#{@md.file.output_path.manifest.url}/#{@md.file.base_filename.manifest}"
- @@odf[:tail] << %{<text:p text:style-name="P_normal">Available document outputs: <br /> &lt;<text:a xlink:type="simple" xlink:href="#{manifest}">#{manifest}</text:a>&gt;</text:p>}
- @@odf[:tail] << %{\n<text:p text:style-name="P_normal">SiSU: &lt;<text:a xlink:type="simple" xlink:href="http://www.jus.uio.no/lm">www.jus.uio.no/sisu</text:a>&gt; and &lt;<text:a xlink:type="simple" xlink:href="http://www.sisudoc.org">www.sisudoc.org</text:a>&gt;</text:p>}
+ @@odf[:tail] << %{<text:p text:style-name="P_normal">Available document outputs: <br /> &lt;<text:a xl:type="simple" xl:href="#{manifest}">#{manifest}</text:a>&gt;</text:p>}
+ @@odf[:tail] << %{\n<text:p text:style-name="P_normal">SiSU: &lt;<text:a xl:type="simple" xl:href="http://www.jus.uio.no/lm">www.jus.uio.no/sisu</text:a>&gt; and &lt;<text:a xl:type="simple" xl:href="http://www.sisudoc.org">www.sisudoc.org</text:a>&gt;</text:p>}
@@odf[:tail] << "\n</office:text></office:body></office:document-content>"
end
def set_bookmark_tag(dob)
- SiSU_ODF_Format::Tags.new.set_bookmark_tag(dob)
+ SiSU_XML_ODF_ODT_Format::Tags.new.set_bookmark_tag(dob)
end
def heading(dob,p_num)
dob=footnote(dob)
@@ -263,7 +266,7 @@ module SiSU_ODF
and h.to_s =~/\d/ \
and w.to_s =~/\d/
@@img_count +=1
- %{<draw:frame draw:style-name="fr1" draw:name="graphics#{@@img_count}" text:anchor-type="as-char" svg:width="#{w}cm" svg:height="#{h}cm" draw:z-index="2"><draw:image xlink:href="Pictures/#{i}" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/></draw:frame>#{c}} #anchor-type: as-char or paragraph or char or ...
+ %{<draw:frame draw:style-name="fr1" draw:name="graphics#{@@img_count}" text:anchor-type="as-char" svg:width="#{w}cm" svg:height="#{h}cm" draw:z-index="2"><draw:image xl:href="Pictures/#{i}" xl:type="simple" xl:show="embed" xl:actuate="onLoad"/></draw:frame>#{c}} #anchor-type: as-char or paragraph or char or ...
else %{<text:p text:style-name="P_normal">[image omitted]</text:p>}
end
end
@@ -293,13 +296,13 @@ module SiSU_ODF
map_nametags=SiSU_Particulars::CombinedSingleton.instance.get_map_nametags(@md).nametags_map
t=case url
when /^https?:/
- %{<text:a xlink:type="simple" xlink:href="#{url}">#{txt.strip}</text:a>#{trail}}
+ %{<text:a xl:type="simple" xl:href="#{url}">#{txt.strip}</text:a>#{trail}}
when /^:/ # site same document collection html link
url=url.gsub(/^:/,"#{@env.url.root}/")
- %{<text:a xlink:type="simple" xlink:href="#{url}">#{txt.strip}</text:a>#{trail}}
+ %{<text:a xl:type="simple" xl:href="#{url}">#{txt.strip}</text:a>#{trail}}
when /^\.\.\// # site same document collection html link
url=url.gsub(/^\.\.\//,"#{@env.url.root}/")
- %{<text:a xlink:type="simple" xlink:href="#{url}">#{txt.strip}</text:a>#{trail}}
+ %{<text:a xl:type="simple" xl:href="#{url}">#{txt.strip}</text:a>#{trail}}
else # document internal link
if map_nametags[url] \
and map_nametags[url][:segname]
@@ -307,7 +310,7 @@ module SiSU_ODF
end
t=map_nametags[url] \
&& map_nametags[url][:segname] \
- ? %{<text:a xlink:type="simple" xlink:href="#{@env.url.root}/#{@md.fnb}/#{map_nametags[url][:segname]}#{Sfx[:html]}##{url}">#{txt.strip}</text:a>#{trail}}
+ ? %{<text:a xl:type="simple" xl:href="#{@env.url.root}/#{@md.fnb}/#{map_nametags[url][:segname]}#{Sfx[:html]}##{url}">#{txt.strip}</text:a>#{trail}}
: %{#{txt.strip}#{trail}}
end
t
@@ -362,11 +365,11 @@ module SiSU_ODF
def normal(dob,p_num) #P1 - P3
dob=footnote(dob)
dob.obj=dob.obj.gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,
- '<text:a xlink:type="simple" xlink:href="\1">\1</text:a>'). #http ftp matches escaped, no decoration
+ '<text:a xl:type="simple" xl:href="\1">\1</text:a>'). #http ftp matches escaped, no decoration
gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,
- %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{@brace_url.xml_close}}).
+ %{#{@brace_url.xml_open}<text:a xl:type="simple" xl:href="mailto:\\1">\\1</text:a>#{@brace_url.xml_close}}).
gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
- %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{@brace_url.xml_close}}) #http ftp matches with decoration
+ %{#{@brace_url.xml_open}<text:a xl:type="simple" xl:href="\\1">\\1</text:a>#{@brace_url.xml_close}}) #http ftp matches with decoration
dob.obj= if dob.is==:para \
and dob.indent.to_s =~/[0-9]/ \
and dob.indent == dob.hang
@@ -383,7 +386,7 @@ module SiSU_ODF
end
def footnote_urls(str)
str=str.gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
- %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{@brace_url.xml_close}})
+ %{#{@brace_url.xml_open}<text:a xl:type="simple" xl:href="\\1">\\1</text:a>#{@brace_url.xml_close}})
str=text_link(str) if str =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/
str=text_link_relative(str) if str =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/
str
@@ -452,15 +455,15 @@ module SiSU_ODF
def group(dob,p_num) #P4 #same as verse
parray=[]
dob.obj=dob.obj.gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,
- '<text:a xlink:type="simple" xlink:href="\1">\1</text:a>'). #http ftp matches escaped, no decoration
+ '<text:a xl:type="simple" xl:href="\1">\1</text:a>'). #http ftp matches escaped, no decoration
gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,
- %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{@brace_url.xml_close}}).
+ %{#{@brace_url.xml_open}<text:a xl:type="simple" xl:href="mailto:\\1">\\1</text:a>#{@brace_url.xml_close}}).
gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
- %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{@brace_url.xml_close}}) #http ftp matches with decoration
+ %{#{@brace_url.xml_open}<text:a xl:type="simple" xl:href="\\1">\\1</text:a>#{@brace_url.xml_close}}) #http ftp matches with decoration
dob.obj.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/).each_with_index do |parablock,i|
set_ref=(i==0) ? "#{p_num[:set_ref]}#{set_bookmark_tag(dob)}" : ''
parablock=group_clean(parablock)
- parablock=parablock.gsub(/&lt;text:a xlink:type="simple" xlink:href="(.+?)"&gt;/m,'<text:a xlink:type="simple" xlink:href="\1">').
+ parablock=parablock.gsub(/&lt;text:a xl:type="simple" xl:href="(.+?)"&gt;/m,'<text:a xl:type="simple" xl:href="\1">').
gsub(/&lt;(\/text:a)&gt;/,'<\1>').
gsub(/&lt;(text:note text:id=.+?)&gt;/,'<\1>').
gsub(/&lt;(text:p text:style-name="Footnote")&gt;/,'<\1>').
@@ -476,15 +479,15 @@ module SiSU_ODF
def block(dob,p_num) #P4 #same as verse
parray=[]
dob.obj=dob.obj.gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,
- '<text:a xlink:type="simple" xlink:href="\1">\1</text:a>'). #http ftp matches escaped, no decoration
+ '<text:a xl:type="simple" xl:href="\1">\1</text:a>'). #http ftp matches escaped, no decoration
gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,
- %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{@brace_url.xml_close}}).
+ %{#{@brace_url.xml_open}<text:a xl:type="simple" xl:href="mailto:\\1">\\1</text:a>#{@brace_url.xml_close}}).
gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
- %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{@brace_url.xml_close}}) #http ftp matches with decoration
+ %{#{@brace_url.xml_open}<text:a xl:type="simple" xl:href="\\1">\\1</text:a>#{@brace_url.xml_close}}) #http ftp matches with decoration
dob.obj.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/).each_with_index do |parablock,i|
set_ref=(i==0) ? "#{p_num[:set_ref]}#{set_bookmark_tag(dob)}" : ''
parablock=group_clean(parablock)
- parablock=parablock.gsub(/&lt;text:a xlink:type="simple" xlink:href="(.+?)"&gt;/m,'<text:a xlink:type="simple" xlink:href="\1">').
+ parablock=parablock.gsub(/&lt;text:a xl:type="simple" xl:href="(.+?)"&gt;/m,'<text:a xl:type="simple" xl:href="\1">').
gsub(/&lt;(\/text:a)&gt;/,'<\1>').
gsub(/&lt;(text:note text:id=.+?)&gt;/,'<\1>').
gsub(/&lt;(text:p text:style-name="Footnote")&gt;/,'<\1>').
@@ -506,7 +509,7 @@ module SiSU_ODF
parablock=group_clean(parablock)
parablock=parablock.gsub(/^\s*$/,'<br />').
gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,
- '<text:a xlink:type="simple" xlink:href="\1">\1</text:a>') #http ftp matches escaped, no decoration
+ '<text:a xl:type="simple" xl:href="\1">\1</text:a>') #http ftp matches escaped, no decoration
parray << %{<text:p text:style-name="P_code">#{set_ref}#{parablock}</text:p>} if parablock =~/\S+/
end
dob.obj=parray.join \
@@ -518,14 +521,14 @@ module SiSU_ODF
def table(dob,p_num) #
if dob.is ==:table
dob=footnote(dob) #check
- table=SiSU_ODF_Format::Table.new(@md,dob,p_num)
+ table=SiSU_XML_ODF_ODT_Format::Table.new(@md,dob,p_num)
dob=table.table
end
dob
end
def obj_break(dob)
if dob.is ==:break
- br=SiSU_ODF_Format::FormatObjBreak.new(@md,dob)
+ br=SiSU_XML_ODF_ODT_Format::FormatObjBreak.new(@md,dob)
if dob.obj==Mx[:br_page] \
or dob.obj==Mx[:br_page_new]
dob=br.br_page
@@ -551,31 +554,31 @@ module SiSU_ODF
if @env.odt_ocn?
if defined? dob.ocn \
and dob.ocn.is_a?(Fixnum)
- p_num=SiSU_ODF_Format::ParagraphNumber.new(dob.ocn).set_bookmark_and_display
+ p_num=SiSU_XML_ODF_ODT_Format::ParagraphNumber.new(dob.ocn).set_bookmark_and_display
end
end
end
if dob.is==:heading
- @@odf[:body] << heading(dob,p_num).obj << @br*2
+ @@odf[:body] << heading(dob,p_num).obj << break_line*2
if SiSU_Env::ProcessingSettings.new(md).build.toc?
if dob.lv =~/[A-C1]/i
@@odf[:toc] << toc(dob,p_num).obj
end
end
elsif dob.is ==:verse
- @@odf[:body] << poem(dob,p_num).obj << @br*2
+ @@odf[:body] << poem(dob,p_num).obj << break_line*2
elsif dob.is==:group
- @@odf[:body] << group(dob,p_num).obj << @br*2
+ @@odf[:body] << group(dob,p_num).obj << break_line*2
elsif dob.is==:block
- @@odf[:body] << block(dob,p_num).obj << @br*2
+ @@odf[:body] << block(dob,p_num).obj << break_line*2
elsif dob.is==:code
- @@odf[:body] << code(dob,p_num).obj << @br*2
+ @@odf[:body] << code(dob,p_num).obj << break_line*2
elsif dob.is==:table #elsif dob.obj =~ /<!Th?¡/u
- @@odf[:body] << table(dob,p_num).obj << @br*2
+ @@odf[:body] << table(dob,p_num).obj << break_line*2
elsif dob.is==:break
- @@odf[:body] << obj_break(dob).obj << @br*2
+ @@odf[:body] << obj_break(dob).obj << break_line*2
else
- @@odf[:body] << normal(dob,p_num).obj << @br*2 # main text, contents, body KEEP
+ @@odf[:body] << normal(dob,p_num).obj << break_line*2 # main text, contents, body KEEP
end
@@endnotes_para=[]
end
@@ -639,7 +642,7 @@ module SiSU_ODF
gsub(/#{Mx[:mk_o]}[~-]##{Mx[:mk_c]}/,'')
if dob.is==:para \
and dob.bullet_
- dob.obj='<draw:frame draw:style-name="gr1" text:anchor-type="as-char" svg:width="0.22cm" svg:height="0.22cm" draw:z-index="2"><draw:image xlink:href="Pictures/bullet_09.png" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/></draw:frame> ' +
+ dob.obj='<draw:frame draw:style-name="gr1" text:anchor-type="as-char" svg:width="0.22cm" svg:height="0.22cm" draw:z-index="2"><draw:image xl:href="Pictures/bullet_09.png" xl:type="simple" xl:show="embed" xl:actuate="onLoad"/></draw:frame> ' +
dob.obj
end
dob.obj=dob.obj.gsub(/#{Mx[:br_line]}/,'<br />').
@@ -674,7 +677,7 @@ module SiSU_ODF
and (dob.obj =~/~metadata/ or dob =~/#{Mx[:lv_o]}1:meta#{Mx[:lv_x]}\s*Document Information/) #fix Mx[:lv_o]
if dob.is !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/ #check
if defined? dob.ocn and dob.ocn =~/\d+/
- @p_num=SiSU_ODF_Format::ParagraphNumber.new(dob.ocn)
+ @p_num=SiSU_XML_ODF_ODT_Format::ParagraphNumber.new(dob.ocn)
end
if dob.is ==:heading \
|| dob.is ==:para \
@@ -728,7 +731,7 @@ WOK
end
x=<<WOK
<?xml version="1.0" encoding="UTF-8"?>
-<office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2"><office:scripts/>
+<office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xl="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2"><office:scripts/>
<office:font-face-decls><style:font-face style:name="DejaVu Sans Mono" svg:font-family="'DejaVu Sans Mono'" style:font-adornments="Book" style:font-family-generic="modern" style:font-pitch="fixed"/><style:font-face style:name="Inconsolata" svg:font-family="Inconsolata" style:font-adornments="Regular" style:font-pitch="fixed"/><style:font-face style:name="Liberation Mono" svg:font-family="'Liberation Mono'" style:font-adornments="Regular" style:font-family-generic="modern" style:font-pitch="fixed"/><style:font-face style:name="DejaVu Sans" svg:font-family="'DejaVu Sans'" style:font-adornments="ExtraLight" style:font-family-generic="swiss" style:font-pitch="variable"/><style:font-face style:name="Nimbus Sans L" svg:font-family="&apos;Nimbus Sans L&apos;" style:font-pitch="variable"/><style:font-face style:name="Tahoma" svg:font-family="Tahoma, Lucidasans, &apos;Lucida Sans&apos;, &apos;Arial Unicode MS&apos;" style:font-pitch="variable"/><style:font-face style:name="Nimbus Roman No9 L" svg:font-family="&apos;Nimbus Roman No9 L&apos;" style:font-family-generic="roman" style:font-pitch="variable"/><style:font-face style:name="Bitstream Vera Sans" svg:font-family="&apos;Bitstream Vera Sans&apos;" style:font-family-generic="swiss" style:font-pitch="variable"/></office:font-face-decls>
<office:automatic-styles>
#{table}
@@ -755,7 +758,7 @@ WOK
br_pg <<
@@odf[:metadata] <<
@@odf[:tail]
- SiSU_ODF::Source::Output.new(content,@md,@env).odf
+ SiSU_XML_ODF_ODT::Source::Output.new(content,@md,@env).odf
@@odf={ head: [], toc: [], body: [], tail: [], book_idx: [], metadata: [] }
end
end
@@ -766,7 +769,7 @@ WOK
def odf #%odf output
env=SiSU_Env::FileOp.new(@md)
env.mkdir
- header=SiSU_ODF_Format::ODT_Head_1_2.new(@md)
+ header=SiSU_XML_ODF_ODT_Format::ODT_Head_1_2.new(@md)
filename="#{@env.processing_path.odt}/manifest.rdf"
od=File.new(filename,'w+')
od << header.manifest_rdf
diff --git a/lib/sisu/v5/odf_format.rb b/lib/sisu/v5/xml_odf_odt_format.rb
index 28c69c44..27628e82 100644
--- a/lib/sisu/v5/odf_format.rb
+++ b/lib/sisu/v5/xml_odf_odt_format.rb
@@ -59,7 +59,7 @@
** Description: opendocument formatting, default opendocument template
=end
-module SiSU_ODF_Format
+module SiSU_XML_ODF_ODT_Format
require_relative 'param' # param.rb
include SiSU_Param
include SiSU_Viz
@@ -170,6 +170,10 @@ module SiSU_ODF_Format
@@fns=@md.fns
end
end
+ def break_line
+ (@md.opt.act[:maintenance][:set]==:on) \
+ ? "\n" : ''
+ end
def table_head_open(count)
type=(@dob.head_) \
? 1
@@ -191,9 +195,9 @@ module SiSU_ODF_Format
when 14; 'N'
else 'D'
end
- tag=SiSU_ODF_Format::Tags.new.set_bookmark_tag(@dob)
- %{<table:table table:name="Table#{count}" table:style-name="Table#{type}">#{@p_num[:set_ref]}#{tag}#{@br}} +
- %{<table:table-column table:style-name="Table#{type}.#{alpha}" table:number-columns-repeated="#{@dob.cols}"/>#{@br}}
+ tag=SiSU_XML_ODF_ODT_Format::Tags.new.set_bookmark_tag(@dob)
+ %{<table:table table:name="Table#{count}" table:style-name="Table#{type}">#{@p_num[:set_ref]}#{tag}#{break_line}} +
+ %{<table:table-column table:style-name="Table#{type}.#{alpha}" table:number-columns-repeated="#{@dob.cols}"/>#{break_line}}
end
def table_close(tablefoot='')
'</table:table>' \
@@ -206,16 +210,16 @@ module SiSU_ODF_Format
else 'P_table_cell'
end
str=str.gsub(/^~$/,'') # tilde / empty cell
- %{<table:table-cell office:value-type="string">#{@br}} +
- %{<text:p text:style-name="#{txt_name_cell}">#{@br}} +
+ %{<table:table-cell office:value-type="string">#{break_line}} +
+ %{<text:p text:style-name="#{txt_name_cell}">#{break_line}} +
%{#{str}} +
- %{</text:p>#{@br}} +
- %{</table:table-cell>#{@br}}
+ %{</text:p>#{break_line}} +
+ %{</table:table-cell>#{break_line}}
end
def table_tag_row(str,i)
- %{<table:table-row>#{@br}} +
+ %{<table:table-row>#{break_line}} +
%{#{str}} +
- %{</table:table-row>#{@br}}
+ %{</table:table-row>#{break_line}}
end
def table_tag_row_dump(str,i)
txt_name_row=if i==0 \
@@ -223,13 +227,13 @@ module SiSU_ODF_Format
'Table_Heading'
else 'P_table_cell'
end
- %{<table:table-row>#{@br}} +
- %{<table:table-cell office:value-type="string">#{@br}} +
- %{<text:p text:style-name="#{txt_name_row}">#{@br}} +
+ %{<table:table-row>#{break_line}} +
+ %{<table:table-cell office:value-type="string">#{break_line}} +
+ %{<text:p text:style-name="#{txt_name_row}">#{break_line}} +
%{#{str}} +
- %{</text:p>#{@br}} +
- %{</table:table-cell>#{@br}} +
- %{</table:table-row>#{@br}}
+ %{</text:p>#{break_line}} +
+ %{</table:table-cell>#{break_line}} +
+ %{</table:table-row>#{break_line}}
end
def table_row(row,i)
row='' if row =~/^<!$/
@@ -318,7 +322,7 @@ WOK
def meta_xml
x=<<WOK
<?xml version="1.0" encoding="UTF-8"?>
-<office:document-meta xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:grddl="http://www.w3.org/2003/g/data-view#" office:version="1.2">
+<office:document-meta xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:xl="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:grddl="http://www.w3.org/2003/g/data-view#" office:version="1.2">
<office:meta>
<meta:generator>#{@generator}</meta:generator>
<meta:creation-date>#{@md.generated}</meta:creation-date>
@@ -334,7 +338,7 @@ WOK
def settings_xml
x=<<WOK
<?xml version="1.0" encoding="UTF-8"?>
-<office:document-settings xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" office:version="1.2">
+<office:document-settings xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:xl="http://www.w3.org/1999/xlink" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" office:version="1.2">
<office:settings>
<config:config-item-set config:name="ooo:view-settings">
<config:config-item config:name="ViewAreaTop" config:type="int">0</config:config-item>
@@ -437,7 +441,7 @@ WOK
def styles_xml
x=<<WOK
<?xml version="1.0" encoding="UTF-8"?>
-<office:document-styles xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2">
+<office:document-styles xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xl="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2">
<office:font-face-decls>
<style:font-face style:name="DejaVu Sans Mono" svg:font-family="'DejaVu Sans Mono'" style:font-adornments="Book" style:font-family-generic="modern" style:font-pitch="fixed"/>
<style:font-face style:name="Nimbus Sans L" svg:font-family="'Nimbus Sans L'" style:font-pitch="variable"/>
diff --git a/lib/sisu/v5/xml.rb b/lib/sisu/v5/xml_sax.rb
index f9741ec1..aa701822 100644
--- a/lib/sisu/v5/xml.rb
+++ b/lib/sisu/v5/xml_sax.rb
@@ -66,7 +66,7 @@ module SiSU_XML_SAX
include SiSU_Particulars
require_relative 'sysenv' # sysenv.rb
include SiSU_Env
- require_relative 'shared_xml' # shared_xml.rb
+ require_relative 'xml_shared' # xml_shared.rb
include SiSU_XML_Munge
require_relative 'xml_format' # xml_format.rb
include SiSU_XML_Format
@@ -82,7 +82,7 @@ module SiSU_XML_SAX
end
def read
begin
- @env,@md,@dal_array=@particulars.env,@particulars.md,@particulars.dal_array
+ @env,@md,@ao_array=@particulars.env,@particulars.md,@particulars.ao_array
unless @opt.act[:quiet][:set]==:on
tool=if (@opt.act[:verbose_plus][:set]==:on \
|| @opt.act[:maintenance][:set]==:on)
@@ -114,7 +114,7 @@ module SiSU_XML_SAX
private
class Songsheet
def initialize(particulars)
- @env,@md,@dal_array,@particulars=particulars.env,particulars.md,particulars.dal_array,particulars
+ @env,@md,@ao_array,@particulars=particulars.env,particulars.md,particulars.ao_array,particulars
@file=SiSU_Env::FileOp.new(@md)
end
def song
@@ -135,20 +135,20 @@ module SiSU_XML_SAX
end
end
class Scroll
- require_relative 'shared_txt' # shared_txt.rb
+ require_relative 'txt_shared' # txt_shared.rb
include SiSU_TextUtils
require_relative 'css' # css.rb
- require_relative 'shared_xhtml' # decide use, whether xml rather than xhtml
+ require_relative 'xhtml_shared' # decide use, whether xml rather than xhtml
@@xml={ body: [], open: [], close: [], head: [] }
def initialize(particulars)
- @env,@md,@dal_array=particulars.env,particulars.md,particulars.dal_array
+ @env,@md,@ao_array=particulars.env,particulars.md,particulars.ao_array
@vz=SiSU_Viz::Defaults.new
@trans=SiSU_XML_Munge::Trans.new(@md)
@sys=SiSU_Env::SystemCall.new
end
def songsheet
pre
- @data=markup(@dal_array)
+ @data=markup(@ao_array)
post
publish
end
diff --git a/lib/sisu/v5/xml_scaffold_structure_collapsed.rb b/lib/sisu/v5/xml_scaffold_structure_collapsed.rb
index a90207ff..9a095f4b 100644
--- a/lib/sisu/v5/xml_scaffold_structure_collapsed.rb
+++ b/lib/sisu/v5/xml_scaffold_structure_collapsed.rb
@@ -62,7 +62,7 @@
module SiSU_XML_Scaffold_Structure_Collapse
require_relative 'particulars' # particulars.rb
include SiSU_Particulars
- require_relative 'dal' # dal.rb
+ require_relative 'ao' # ao.rb
require_relative 'sysenv' # sysenv.rb
include SiSU_Env
class Source
@@ -73,8 +73,8 @@ module SiSU_XML_Scaffold_Structure_Collapse
end
def read
begin
- @md,@dal_array=@particulars.md,@particulars.dal_array
- SiSU_XML_Scaffold_Structure_Collapse::Source::Scroll.new(@dal_array,@md).songsheet
+ @md,@ao_array=@particulars.md,@particulars.ao_array
+ SiSU_XML_Scaffold_Structure_Collapse::Source::Scroll.new(@ao_array,@md).songsheet
rescue
SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do
__LINE__.to_s + ':' + __FILE__
diff --git a/lib/sisu/v5/xml_scaffold_structure_sisu.rb b/lib/sisu/v5/xml_scaffold_structure_sisu.rb
index 64173566..2848187f 100644
--- a/lib/sisu/v5/xml_scaffold_structure_sisu.rb
+++ b/lib/sisu/v5/xml_scaffold_structure_sisu.rb
@@ -62,7 +62,7 @@
module SiSU_XML_Scaffold_Structure_Sisu
require_relative 'particulars' # particulars.rb
include SiSU_Particulars
- require_relative 'dal' # dal.rb
+ require_relative 'ao' # ao.rb
require_relative 'sysenv' # sysenv.rb
include SiSU_Env
class Source
@@ -73,8 +73,8 @@ module SiSU_XML_Scaffold_Structure_Sisu
end
def read
begin
- @md,@dal_array=@particulars.md,@particulars.dal_array
- SiSU_XML_Scaffold_Structure_Sisu::Source::Scroll.new(@dal_array,@md).songsheet
+ @md,@ao_array=@particulars.md,@particulars.ao_array
+ SiSU_XML_Scaffold_Structure_Sisu::Source::Scroll.new(@ao_array,@md).songsheet
rescue
SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do
__LINE__.to_s + ':' + __FILE__
diff --git a/lib/sisu/v5/shared_xml.rb b/lib/sisu/v5/xml_shared.rb
index af9b0992..a6092559 100644
--- a/lib/sisu/v5/shared_xml.rb
+++ b/lib/sisu/v5/xml_shared.rb
@@ -50,7 +50,7 @@
* Git
<http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/shared_xml.rb;hb=HEAD>
+ <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/xml_shared.rb;hb=HEAD>
* Ralph Amissah
<ralph@amissah.com>
@@ -381,25 +381,25 @@ module SiSU_XML_Munge
gsub(/<[-~]#>/,'').
gsub(/href="#{Xx[:segment]}/m,'href="').
gsub(/#{Mx[:lnk_o]}([^#{Mx[:lnk_o]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{Mx[:rel_c]}]+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}(\.\.\/\S+?)#{Mx[:rel_c]}/,
- '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\2">\1</link>').
+ '<link xmlns:xl="http://www.w3.org/1999/xlink" xl:type="simple" xl:href="\2">\1</link>').
gsub(/#{Mx[:lnk_o]}([^#{Mx[:lnk_o]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{Mx[:rel_c]}]+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}:(\S+?)#{Mx[:rel_c]}/,
- '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="../\2">\1</link>').
+ '<link xmlns:xl="http://www.w3.org/1999/xlink" xl:type="simple" xl:href="../\2">\1</link>').
gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}(\S+?)#{Mx[:rel_c]}/,
- '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="#\2">\1</link>').
+ '<link xmlns:xl="http://www.w3.org/1999/xlink" xl:type="simple" xl:href="#\2">\1</link>').
gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))[ ]+(\d+)x(\d+)(\s+[^}]+)?#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
- %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@md.file.output_path.xml.rel_image}/\\1" width="\\2" height="\\3" />[\\1] \\4}).
+ %{<image xmlns:xl="http://www.w3.org/1999/xlink" xl:type="simple" xl:actuate="onLoad" xl:show="embed" xl:href="#{@md.file.output_path.xml.rel_image}/\\1" width="\\2" height="\\3" />[\\1] \\4}).
gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))([ ]+[^}]+)?#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
- %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@md.file.output_path.xml.rel_image}/\\1"/>\\1}).
+ %{<image xmlns:xl="http://www.w3.org/1999/xlink" xl:type="simple" xl:actuate="onLoad" xl:show="embed" xl:href="#{@md.file.output_path.xml.rel_image}/\\1"/>\\1}).
gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))[ ]+(\d+)x(\d+)(\s+[^}]+)?#{Mx[:lnk_c]}image/,
- %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@md.file.output_path.xml.rel_image}/\\1" width="\\2" height="\\3" />[\\1] \\4}).
+ %{<image xmlns:xl="http://www.w3.org/1999/xlink" xl:type="simple" xl:actuate="onLoad" xl:show="embed" xl:href="#{@md.file.output_path.xml.rel_image}/\\1" width="\\2" height="\\3" />[\\1] \\4}).
gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))([ ]+[^}]+)?#{Mx[:lnk_c]}image/,
- %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@md.file.output_path.xml.rel_image}/\\1"/>\\1}).
+ %{<image xmlns:xl="http://www.w3.org/1999/xlink" xl:type="simple" xl:actuate="onLoad" xl:show="embed" xl:href="#{@md.file.output_path.xml.rel_image}/\\1"/>\\1}).
gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
- '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\2">\1</link>'). #watch, compare html_tune
+ '<link xmlns:xl="http://www.w3.org/1999/xlink" xl:type="simple" xl:href="\2">\1</link>'). #watch, compare html_tune
gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
- %{#{@brace_url.xml_open}<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\\1">\\1</link>#{@brace_url.xml_close}}).
+ %{#{@brace_url.xml_open}<link xmlns:xl="http://www.w3.org/1999/xlink" xl:type="simple" xl:href="\\1">\\1</link>#{@brace_url.xml_close}}).
gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,
- '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\1">\1</link>') #escaped urls not linked, deal with later
+ '<link xmlns:xl="http://www.w3.org/1999/xlink" xl:type="simple" xl:href="\1">\1</link>') #escaped urls not linked, deal with later
else
dob.obj=dob.obj.gsub(/</m,'&lt;').gsub(/>/m,'&gt;')
end
@@ -430,32 +430,63 @@ module SiSU_XML_Munge
dob.obj=tidywords(wordlist).join(' ').strip
dob
end
- def markup_fictionbook(dob='')
- dob.obj.gsub(/~\{([\d*+]+).+?\}~/,'[\1]').
- gsub(/\/\{(.+?)\}\//,'<i>\1</i>').
- gsub(/[*!]\{(.+?)\}[*!]/,'<b>\1</b>').
- gsub(/_\{(.+?)\}_/,'<u>\1</u>').
- gsub(/-\{(.+?)\}-/,'<del>\1</del>').
- gsub(/<br(?:\s*\/)?>/,'<br />').
- gsub(/<:pb>\s*/,'').
- gsub(/<[-~]#>/,'').
- #temporary -->
- gsub(/<:\S+?>/,'').
- #<-- temporary
- gsub(/<[-~]#>/,'').
+ def clean(str)
+ str=str.gsub(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;').
+ 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,'<a xl:href="#footnote\1" type="note">[\1]</a>').
+ gsub(/&/,'&amp;'). #sort
+ gsub(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;').
gsub(/(^|#{Mx[:gl_c]}|\s)&\s+/,'\1&amp; '). #sort
- gsub(/&([^;]{1,5})/,'&amp;\1') #sort, rough estimate, revisit #WATCH found in node not sax
- gsub(/(#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif))[ ]+.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/,
- "<image.path>#{@md.file.output_path.xml.rel_image}\/\\1</image.path>").
- gsub(/&nbsp;|#{Mx[:nbsp]}/,'&#160;')
- wordlist=dob.obj.scan(/&[#0-9a-z]+;|\S+|\n/) #\n needed for tables, check though added 2005w17
- dob.obj=tidywords(wordlist).join(' ').strip
+ gsub(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;')
+ str=str.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />') unless is==:table
+ str=str.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>').
+ gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>').
+ gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>').
+ gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>').
+ gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>').
+ gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'<ins>\1</ins>').
+ gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>').
+ gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>').
+ gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>'). # 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,'<image xl:href="#\1" />').
+ gsub(/#{Mx[:url_o]}(.+?)#{Mx[:url_c]}/,"#{Dx[:url_o]}\\1#{Dx[:url_c]}").
+ gsub(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'<a name="\1"></a>').
+ gsub(/#{Mx[:gl_bullet]}/m,'● '). #&nbsp; not available
+ gsub(/#{Mx[:nbsp]}/,' '). #&nbsp; not available
+ gsub(/<(p|br)>/,'<\1 />')
+ clean(str)
+ end
+ def markup_docbook(dob='') # work on, initially a copy of fictionbook!
+ dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/m,'<footnote>\1</footnote>').
+ gsub(/&/,'&amp;'). #sort
+ gsub(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;').
+ gsub(/(^|#{Mx[:gl_c]}|\s)&\s+/,'\1&amp; '). #sort
+ gsub(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;')
+ dob.obj=dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />') unless dob.is==:table
+ dob.obj=dob.obj.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>').
+ gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>').
+ gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>').
+ gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>').
+ gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>').
+ gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'<ins>\1</ins>').
+ gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>').
+ gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>').
+ gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>'). # 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,'<image xl:href="../../_sisu/image/\1" />'). #taken unmodified except path from fictionbook
+ gsub(/#{Mx[:url_o]}(.+?)#{Mx[:url_c]}/,"#{Dx[:url_o]}\\1#{Dx[:url_c]}").
+ gsub(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'<a name="\1"></a>').
+ gsub(/#{Mx[:gl_bullet]}/m,'● '). #&nbsp; not available
+ gsub(/#{Mx[:nbsp]}/,' '). #&nbsp; not available
+ gsub(/<(p|br)>/,'<\1 />')
+ dob.obj=clean(dob.obj)
dob
end
def markup_group(dob='')
dob.obj=dob.obj.gsub(/</,'&lt;').gsub(/>/,'&gt;').
gsub(/&lt;:?br(?:\s+\/)?&gt;/,'<br />').
- gsub(/&lt;(link xmlns:xlink=".+?")&gt;/,'<\1>').
+ gsub(/&lt;(link xmlns:xl=".+?")&gt;/,'<\1>').
gsub(/&lt;(\/link)&gt;/,'<\1>').
gsub(/&lt;(\/?en)&gt;/,'<\1>')
dob
@@ -463,7 +494,7 @@ module SiSU_XML_Munge
def markup_block(dob='')
dob.obj=dob.obj.gsub(/</,'&lt;').gsub(/>/,'&gt;').
gsub(/&lt;:?br(?:\s+\/)?&gt;/,'<br />').
- gsub(/&lt;(link xmlns:xlink=".+?")&gt;/,'<\1>').
+ gsub(/&lt;(link xmlns:xl=".+?")&gt;/,'<\1>').
gsub(/&lt;(\/link)&gt;/,'<\1>').
gsub(/&lt;(\/?en)&gt;/,'<\1>')
dob