}
+ the_idx.each do |i|
+ i.each do |x|
+ if x.is_a?(String)
+ f=/^(\S)/.match(x)[1]
+ if letter < f
+ while letter < f
+ if alph.length > 0
+ letter=alph.shift
+ idx[:html] << %{\n
#{c}, }
+ print "\n\t" + k + ', ' if @md.opt.act[:verbose_plus][:set]==:on
+ y.each do |z|
+ if z[:range]
+ idx[:sst_rel_html_seg][@o]=idx[:sst_rel_html_seg][@o] + %{#{Mx[:lnk_o]}#{z[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:seg]}.html##{z[:ocn]}#{Mx[:rel_c]}, }
+ idx[:sst_rel][@t]=idx[:sst_rel][@t] + %{#{Mx[:lnk_o]}#{z[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:ocn]}#{Mx[:rel_c]}, }
+ idx[:html][@q]=idx[:html][@q] + %{#{z[:range]}, }
+ idx[:xhtml][@q]=idx[:xhtml][@q] + %{#{z[:range]}, }
+ print z[:range] + ', ' if @md.opt.act[:verbose_plus][:set]==:on
+ elsif z[:ocn]
+ idx[:sst_rel_html_seg][@o]=idx[:sst_rel_html_seg][@o] + %{#{Mx[:lnk_o]}#{z[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:seg]}.html##{z[:ocn]}#{Mx[:rel_c]}, }
+ idx[:sst_rel][@t]=idx[:sst_rel][@t] + %{#{Mx[:lnk_o]}#{z[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:ocn]}#{Mx[:rel_c]}, }
+ idx[:html][@q]=idx[:html][@q] + %{#{z[:ocn]}, }
+ idx[:xhtml][@q]=idx[:xhtml][@q] + %{#{z[:ocn]}, }
+ print z[:ocn] + ', ' if @md.opt.act[:verbose_plus][:set]==:on
+ else p 'error'
+ end
+ end
+ idx[:html][@q]=idx[:html][@q] + '
'
+ idx[:xhtml][@r]=idx[:xhtml][@r] + ''
+ end
+ end
+ end
+ @x +=1
+ end
+ end
+ end
+ print "\n" if @md.opt.act[:verbose_plus][:set]==:on
+ idx
+ end
+ def screen_print(the_idx)
+ the_idx.each do |i|
+ i.each do |x|
+ if x.is_a?(String)
+ print "\n" + x + ', '
+ elsif x.is_a?(Array)
+ p 'array error? -->'
+ print x
+ elsif x.is_a?(Hash)
+ if x['node_0_terms'].is_a?(Array)
+ x['node_0_terms'].each do |a|
+ if a[:range]
+ print a[:range] + ', '
+ elsif a[:ocn]
+ print a[:ocn] + ', '
+ else p 'error'
+ end
+ end
+ end
+ if x['node_1_subterms']
+ x['node_1_subterms'].sort.each do |k,y|
+ if k !~/node_0_terms/
+ print "\n\t" + k + ', '
+ y.each do |z|
+ if z[:range]
+ print z[:range] + ', '
+ elsif z[:ocn]
+ print z[:ocn] + ', '
+ else p 'error'
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ def output_idx(idx)
+ if @md.book_idx
+ path="#{@env.path.output}/#{@md.fnb}"
+ Dir.mkdir(path) unless FileTest.directory?(path)
+ puts "#{path}/#{@md.fn[:book_idx_html]} #{__FILE__}::#{__LINE__}"
+ html_index_file=File.new("#{path}/#{@md.fn[:book_idx_html]}",'w')
+ idx[:html].each {|x| html_index_file << x }
+ html_index_file.close
+ end
+ end
+ def clean_and_insert_index(data,sisu_markup_idx)
+ tuned_file=[]
+ data.each do |dob|
+ tuned_file << dob
+ if dob.obj =~/#{Mx[:br_endnotes]}/ \
+ and sisu_markup_idx
+ sisu_markup_idx.each do |idx|
+ tuned_file << idx
+ end
+ end
+ end
+ tuned_file
+ end
+ def clean_index(data) #check on use of dob
+ tuned_file=[]
+ data.each do |para|
+ para=para.gsub(/\n*#{@rgx_idx}/m,'')
+ tuned_file << para
+ end
+ tuned_file
+ end
+ end
+end
+__END__
diff --git a/lib/sisu/v5/ao_images.rb b/lib/sisu/v5/ao_images.rb
new file mode 100644
index 00000000..4354dfa9
--- /dev/null
+++ b/lib/sisu/v5/ao_images.rb
@@ -0,0 +1,165 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012, 2013 Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see .
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+
+
+
+
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+
+
+
+ * Download:
+
+
+ * Git
+
+
+
+ * Ralph Amissah
+
+
+
+ ** Description: system environment, resource control and configuration details
+
+=end
+module SiSU_AO_Images
+ class Images
+ #require 'RMagick'
+ #include Magick
+ def initialize(md,data)
+ @md,@data=md,data
+ end
+ def images
+ data=@data
+ tuned_file=[]
+ @rmgk=false
+ imagemagick_=true #imagemagick_=SiSU_Env::InfoSettings.new.program?('rmagick')
+ if imagemagick_
+ begin
+ @rmgk=SiSU_Env::Load.new('RMagick').prog
+ rescue
+ @rmgk=false
+ end
+ else
+ if (@md.opt.act[:verbose][:set]==:on \
+ || @md.opt.act[:verbose_plus][:set]==:on \
+ || @md.opt.act[:maintenance][:set]==:on)
+ SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'*WARN* use of RMagick is not enabled in sisurc.yml').warn
+ end
+ end
+ data.each do |dob|
+ unless dob.is ==:table
+ dob.obj=dob.obj.strip
+ if dob.obj =~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif)(?:\s*|\s+.+)?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/
+ if dob.obj !~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif)\s+\d+x\d+/
+ m=/#{Mx[:lnk_o]}\s*(\S+\.(?:png|jpg|gif))/
+ if imagemagick_
+ imgs=dob.obj.scan(m).flatten
+ img_col=img_row=nil
+ images=imgs.each do |image|
+ dir=SiSU_Env::InfoEnv.new(@md.fns)
+ path_image=[dir.path.image_source_include_local,dir.path.image_source_include_remote,dir.path.image_source_include]
+ image_path=nil
+ path_image.each do |img_pth|
+ image_path=img_pth
+ break if FileTest.exist?("#{img_pth}/#{image}")
+ end
+ if FileTest.exist?("#{image_path}/#{image}")
+ if @rmgk
+ img=Magick::ImageList.new("#{image_path}/#{image}")
+ img_col,img_row=img.columns,img.rows
+ else
+ if (@md.opt.act[:verbose][:set]==:on \
+ || @md.opt.act[:verbose_plus][:set]==:on \
+ || @md.opt.act[:maintenance][:set]==:on)
+ SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'*WARN* RMagick not present, will attempt to use imagemagick (identify) directly').warn
+ end
+ imgk=SiSU_Env::SystemCall.new.imagemagick
+ gmgk=SiSU_Env::SystemCall.new.graphicksmagick
+ if imgk or gmgk
+ if imgk
+ imgsys=`identify #{image_path}/#{image}`.strip #system call
+ elsif gmgk
+ imgsys=`gm identify #{image_path}/#{image}`.strip #system call
+ end
+ img_col,img_row=/(\d+)x(\d+)/m.match(imgsys)[1,2]
+ img_col,img_row=img_col.to_i,img_row.to_i
+ end
+ end
+ row=((img && defined? img.rows) ? img.rows : img_row)
+ col=((img && defined? img.columns) ? img.columns : img_col)
+ if img_col > img_row #landscape
+ if img_col> 640
+ img_col=640
+ img_row=((1.00*img_col/col)*row).round
+ end
+ else #portrait
+ if img_col> 640
+ img_col=640
+ img_row=((1.00*img_col/col)*row).round
+ end
+ if img_row > 640
+ img_row=640
+ img_col=((1.00*img_row/row)*col).round
+ end
+ end
+ dob.obj=dob.obj.gsub(/(#{image})/,"#{image} #{img_col}x#{img_row}")
+ else dob.obj=dob.obj.gsub(/#{Mx[:lnk_o]}\s*(\S+)\.(png|jpg|gif).+?#{Mx[:lnk_c]}(#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/,'[ \1 (\2 missing) ]')
+ end
+ end
+ else
+ images=dob.obj.scan(m) do |image|
+ SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'*WARN* where image dimensions have not been provided RMagick or imagemagick is required',image).warn unless @md.opt.act[:quiet][:set]==:on
+ end
+ end
+ end
+ end
+ if dob.obj =~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/
+ dob.obj=dob.obj.gsub(/(#{Mx[:lnk_o]})\s*(\S+\.(?:png|jpg|gif))\s+/i,'\1\2 ')
+ end
+ end
+ tuned_file << dob unless dob.nil?
+ end
+ tuned_file
+ end
+ end
+end
+__END__
+imgsys=`identify #{image_path}/#{image}`.strip
diff --git a/lib/sisu/v5/ao_metadata.rb b/lib/sisu/v5/ao_metadata.rb
new file mode 100644
index 00000000..8d017769
--- /dev/null
+++ b/lib/sisu/v5/ao_metadata.rb
@@ -0,0 +1,82 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012, 2013 Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see .
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+
+
+
+
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+
+
+
+ * Download:
+
+
+ * Git
+
+
+
+ * Ralph Amissah
+
+
+
+ ** Description: system environment, resource control and configuration details
+
+=end
+module SiSU_AO_Metadata
+ class Metadata
+ def initialize(md,metad)
+ @md,@metadata=md,metad
+ l=SiSU_Env::StandardiseLanguage.new(@md.opt.lng).language
+ language=l[:n]
+ @tr=SiSU_Translate::Source.new(md,language)
+ end
+ def make_para(obj,ocn)
+ h={ obj: obj, ocn: 0 }
+ 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_AO_DocumentStructure::ObjectHeading.new.heading(h)
+ end
+ def metadata
+ end
+ end
+end
+__END__
diff --git a/lib/sisu/v5/ao_misc_arrange.rb b/lib/sisu/v5/ao_misc_arrange.rb
new file mode 100644
index 00000000..8f7acbc4
--- /dev/null
+++ b/lib/sisu/v5/ao_misc_arrange.rb
@@ -0,0 +1,157 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012, 2013 Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see .
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+
+
+
+
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+
+
+
+ * Download:
+
+
+ * Git
+
+
+
+ * Ralph Amissah
+
+
+
+ ** Description: system environment, resource control and configuration details
+
+=end
+module SiSU_AO_MiscArrangeText
+ class SI
+ def initialize(md,data)
+ @md,@data=md,data
+ end
+ def conditional_headings(para)
+ para=para.gsub(/^(:?A~)\s*$/,'\1~ @title @author'). #conditional header
+ gsub(/^((?:[1-9]|:?[A-C])~\S*)\s*$/,'\1~ [Note: heading marker::required title missing]~#') #conditional header for incorporated document 2004w12
+ if para =~/^@\S+?:/
+ para=para.gsub(/^@(\S+?):(\s+|$)/,"#{Mx[:meta_o]}\\1#{Mx[:meta_c]}\\2").
+ gsub(/^@(\S+?):([+-])(\s+|$)/,"#{Mx[:meta_o]}\\1\\2#{Mx[:meta_c]}\\3")
+ end
+ para
+ end
+ def code_blocks(para)
+ def ticks(para)
+ block_open,block_close,text=nil,nil,nil
+ if para =~/\A[`]{3}\s+.+?\n.+?\n[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*\Z/m
+ block_open,text,block_close=/\A([`]{3}\s+.+?)\n(.+?)\n([`]{3}(\s+[~-][#]|\s+\~\{.+?\}\~)?)\s*\Z/m.match(para)[1..3]
+ ((para=~/^[`]{3}\s+table(?:~h)?\s+/) \
+ and (para !~/^[`]{3}\s+table(?:~h)?\s+c\d+/)) \
+ ? para
+ : (para=[]; para << block_open << text << block_close)
+ elsif para =~/\A[`]{3}\s+.+?\n.*?\Z/m #look at, study
+ block_open,text=/\A([`]{3}(?:\s+.+?))\n(.*?)\Z/m.match(para)[1,2]
+ para=[]
+ if not text.to_s.empty?
+ para << block_open << text
+ else
+ para << block_open
+ end
+ elsif para =~/\A.+?\n[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*\Z/m
+ text,block_close=/\A(.+?)\n([`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?)\s*\Z/m.match(para)[1,2]
+ para=[]
+ if not text.to_s.empty?
+ para << text.to_s << block_close
+ else
+ para << block_close
+ end
+ else para
+ end
+ para
+ end
+ def curly_braces(para)
+ block_open,block_close,text=nil,nil,nil
+ para=if para =~/\A(?:code|poem|alt|group|block|table)\{ .+?\n.+?\n\}(?:code|poem|alt|group|block|table)(?: [~-][#])?\s*\Z/m
+ block_open,text,block_close=/\A((?:code|poem|alt|group|block|table)\{ .+?)\n(.+?)\n(\}(?:code|poem|alt|group|block|table)(?: [~-][#])?)\s*\Z/m.match(para)[1..3]
+ para=[]
+ para << block_open << text << block_close
+ elsif para =~/\A(?:code|poem|alt|group|block|table)\{ .+?\n.+?\Z/m
+ block_open,text=/\A((?:code|poem|alt|group|block|table)\{ .+?)\n(.+?)\Z/m.match(para)[1,2]
+ para=[]
+ if not text.to_s.empty?
+ para << block_open << text
+ else
+ para << block_open
+ end
+ elsif para =~/\A.+?\n\}(?:code|poem|alt|group|block|table)(?: [~-][#])?\s*\Z/m
+ text,block_close=/\A(.+?)\n(\}(?:code|poem|alt|group|block|table)(?: [~-][#])?)\s*\Z/m.match(para)[1,2]
+ para=[]
+ if not text.to_s.empty?
+ para << text.to_s << block_close
+ else
+ para << block_close
+ end
+ else para
+ end
+ para
+ end
+ para=para =~/^```/m \
+ ? ticks(para)
+ : para
+ para=(para =~/^(?:code|poem|alt|group|block|table)\{|^\}(?:code|poem|alt|group|block|table)/m) \
+ ? curly_braces(para)
+ : para
+ end
+ def prepare_text
+ data=@data
+ data_new=[],[]
+ if data[0] =~ /^#!\s*(?:\/usr\/bin\/env sisu|\/usr\/bin\/sisu)/ # remove bang from top #! (however file is stripped, so will be removed provided no content precedes it)
+ data[0]=data[0].gsub(/^#!\s*\/usr\/bin\/sisu/,'').
+ gsub(/^#!\s*\/usr\/bin\/env sisu/,'')
+ end
+ if data[0] =~ /^(SiSU\s+[\d.]*|sisu-[\d.]+)$/ # SiSU identifier
+ data[0]=data[0].gsub(/^(SiSU\s*[\d.]*)$/,'% \1').
+ gsub(/^(sisu-[\d.]+)$/,'% \1')
+ end
+ data.each do |para|
+ para=conditional_headings(para)
+ data_new << code_blocks(para)
+ end
+ data_new=data_new.flatten
+ end
+ end
+end
+__END__
diff --git a/lib/sisu/v5/ao_numbering.rb b/lib/sisu/v5/ao_numbering.rb
new file mode 100644
index 00000000..00afdfa5
--- /dev/null
+++ b/lib/sisu/v5/ao_numbering.rb
@@ -0,0 +1,486 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012, 2013 Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see .
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+
+
+
+
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+
+
+
+ * Download:
+
+
+ * Git
+
+
+
+ * Ralph Amissah
+
+
+
+ ** Description: system environment, resource control and configuration details
+
+=end
+module SiSU_AO_Numbering
+ class Numbering
+ attr_accessor :obj,:osp,:ocn,:lv,:name,:index,:comment
+ def initialize(md,data)
+ @md,@data=md,data
+ @obj=@type=@ocn=@lv=@name=@index=@comment=nil
+ end
+ def numbering_song
+ data=@data
+ data=number_plaintext_para(data)
+ data=auto_number_heading_ie_title(data.compact) #tr issue
+ data=ocn(data.compact) #watch
+ data=xml(data.compact)
+ data=minor_numbering(data.compact)
+ data,tags_map,ocn_html_seg_map=name_para_seg_filename(data)
+ data=set_heading_top(data) unless @md.set_heading_top
+ [data,tags_map,ocn_html_seg_map]
+ end
+ def number_plaintext_para(data)
+ @tuned_file=[]
+ data.each do |dob|
+ if (dob.of !=:block \
+ && dob.of !=:comment \
+ && dob.of !=:layout) \
+ && dob.ocn_ #and dob.obj !~ /#{Mx[:gr_o]}Th|#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}/ #FIX
+ dob.obj=dob.obj.gsub(/(.+)\n/,'\1 ') #messy, but idea is that tables should retain breaks
+ end
+ unless dob.obj.is_a?(Array)
+ dob.obj=dob.obj.gsub(/^\s+/,'').
+ gsub(/\s$/,"\n")
+ end
+ @tuned_file << dob
+ end
+ @tuned_file=@tuned_file.flatten
+ end
+ def number_sub_heading(dob,num,title_no)
+ unless dob.obj =~/\d+\.|(?:chapter|article|section|clause)\s+\d+/i #name selection arbitrary, fix
+ dob.obj=case dob.name
+ when /-/; dob.obj.gsub(/^/,"#{title_no} ")
+ when /^#/; dob.obj.gsub(/^/,"#{title_no} ")
+ when /^[a-z_\.]+/; dob.obj.gsub(/^/,"#{title_no} ")
+ else
+ dob.name=title_no if dob.name=~/^$/ #where title contains title number
+ dob.obj.gsub(/^/,"#{title_no} ") if title_no =~/\d+/ #main, where title number is to be provided #watch changed placement
+ end
+ if @md.toc_lev_limit \
+ and @md.toc_lev_limit < num
+ dob.obj=dob.obj.gsub(/^/,'!_ ') #bold line, watch
+ end
+ end
+ dob
+ end
+ def heading_tag_clean(heading_tag)
+ heading_tag=heading_tag.gsub(/[ ]+/,'_').
+ gsub(/["']/,'').
+ gsub(/[\/]/,'-').
+ gsub(/#{Mx[:fa_bold_o]}|#{Mx[:fa_bold_c]}/,'').
+ gsub(/#{Mx[:fa_italics_o]}|#{Mx[:fa_italics_c]}/,'').
+ gsub(/#{Mx[:fa_underscore_o]}|#{Mx[:fa_underscore_c]}/,'').
+ gsub(/#{Mx[:fa_cite_o]}|#{Mx[:fa_cite_c]}/,'').
+ gsub(/#{Mx[:fa_insert_o]}|#{Mx[:fa_insert_c]}/,'').
+ gsub(/#{Mx[:fa_strike_o]}|#{Mx[:fa_strike_c]}/,'').
+ gsub(/#{Mx[:fa_superscript_o]}|#{Mx[:fa_superscript_c]}/,'').
+ gsub(/#{Mx[:fa_subscript_o]}|#{Mx[:fa_subscript_c]}/,'').
+ gsub(/#{Mx[:fa_hilite_o]}|#{Mx[:fa_hilite_c]}/,'').
+ gsub(/#{Mx[:gl_bullet]}/,'')
+ end
+ def auto_number_heading_ie_title(data) #also does some segment naming
+ @tuned_file=[]
+ if defined? @md.make.num_top \
+ and @md.make.num_top \
+ and @md.make.num_top !~/^$/
+ input||=@md.make.num_top
+ end
+ num_top=(input ? input.to_i : nil)
+ t_no1=t_no2=t_no3=0
+ if num_top
+ no1=num_top; no2=(num_top + 1); no3=(num_top + 2)
+ end
+ chapter_number_counter=0
+ data=data.compact
+ data.each do |dob| #@md.seg_names << [additions to segment names]
+ title_no=nil
+ 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 \
+ and @md.make.num_top !~/^$/
+ if dob.lv=='1' \
+ and dob.obj =~/^#\s|\s#(?:\s|$)/
+ chapter_number_counter +=1
+ dob.obj=dob.obj.gsub(/^#\s/,"#{chapter_number_counter} ").
+ gsub(/#([:,]?\s|[.]?$)/,"#{chapter_number_counter}\\1")
+ end
+ if dob.ln==no1
+ @subnumber=1
+ @subnumber=0 if dob.ln==no1
+ end
+ if dob.ln.to_s =~/^[1-6]/ \
+ and not dob.toc_ \
+ and dob.obj !~/#{Mx[:fa_o]}(?:~#|-#)#{Mx[:fa_c]}/ # <-- fix
+ if dob.ln==no1
+ t_no1+=1; t_no2=0; t_no3=0
+ title_no="#{t_no1}"
+ if @md.seg_names.is_a?(Array) \
+ and not @md.seg_names.include?(title_no)
+ if dob.ln==no1
+ dob.name="#{title_no}" if not dob.name
+ dob.tags=[title_no,dob.tags].flatten if title_no !~/^\d+$/ #check whether will work across file types with stop signs
+ tag=dob.obj.gsub(/(Article|Clause|Section|Chapter)\s+/,"\\1_#{title_no}").downcase
+ tag=heading_tag_clean(tag)
+ dob.tags=[tag,dob.tags].flatten if tag !~/^\d+$/ #check whether will work across file types with stop signs
+ dob.obj=(dob.obj =~/(Article|Clause|Section)\s+/) \
+ ? (dob.obj.gsub(/(Article|Clause|Section)\s+/,"\\1 #{title_no} "))
+ : (dob.obj.gsub(/^/,"#{title_no}. ")) #fix stop later
+ end
+ if dob.ln !=no1 \
+ and dob.obj =~/^[\d.]+\s/ #fix -> if the title starts with a numbering scheme, do not auto-number, review
+ dob.name ="#{title_no}" if not dob.name
+ dob.tags=[title_no,dob.tags].flatten if title_no !~/^\d+$/ #check whether will work across file types with stop signs
+ dob.obj=dob.obj.gsub(/^/,"#{title_no}. ")
+ end
+ @md.seg_names << title_no
+ end
+ if dob.ln!=no1 \
+ and dob.name!~/^[a-z_\.]+$/ \
+ and dob.obj !~/[A-Z]\.?\s/ #bug -> tmp fix, excludes A. B. C. lettering, but not roman numerals, is arbitrary, review required # not fixed, work on
+ dob.tags=[title_no,dob.tags].flatten if title_no !~/^\d+$/ #check whether will work across file types with stop signs
+ dob.obj=dob.obj.gsub(/^/i,"#{title_no}. ")
+ end
+ end
+ if dob.ln==no1 #watch because here you change dob.name
+ dob.tags=["h#{title_no}",dob.tags].flatten #check whether will work across file types with stop signs
+ end
+ if dob.ln==no2 #watch because here you change dob.name
+ t_no2+=1; t_no3=0
+ title_no="#{t_no1}.#{t_no2}"
+ dob.tags=["h#{title_no}",dob.tags].flatten #check whether will work across file types with stop signs
+ dob=number_sub_heading(dob,no2,title_no)
+ end
+ if dob.ln==no3 #watch because here you change dob.name
+ t_no3+=1
+ title_no="#{t_no1}.#{t_no2}.#{t_no3}"
+ dob.tags=["h#{title_no}",dob.tags].flatten #check whether will work across file types with stop signs
+ dob=number_sub_heading(dob,no3,title_no)
+ end
+ elsif dob.ln.to_s =~/^[1-6]/ \
+ and dob.name =~ /^[\w-]+-/ # endnotes, watch2005# endnotes, watch2005
+ dob.tags=[dob.name,dob.tags].flatten if dob.name !~/^\d+$/ #check whether will work across file types with stop signs
+ dob.name.gsub(/^([a-z_\.]+)-$/,'\1')
+ end
+ elsif dob.is ==:heading \
+ and dob.autonum_ \
+ and @md.markup =~/num_extract/ #AS DANGEROUS force enable with document, note already does this type of numbering for cisg, locate and coordinate logic, is currently misplaced in code, chengwei inspired 2004w23/4
+ #here lies a bug, as is nil when run from -Dv --update, FIX
+ if (dob.name.nil? or dob.name.empty?) \
+ and dob.ln.to_s =~/^[1-9]/ \
+ and dob.obj =~ /^([\d\.]+)/ #risky (must be unique) consider output to 4~~\d instead of 4~\d
+ dob.name=$1
+ dob.tags=[dob.name,dob.tags].flatten if dob.name !~/^\d+$/ #check whether will work across file types with stop signs
+ end
+ if @md.toc_lev_limit
+ end
+ elsif defined? dob.name \
+ and dob.name
+ dob.tags=[dob.name,dob.tags].flatten if dob.name !~/^\d+$/ #check whether will work across file types with stop signs
+ end
+ dob.tags=dob.tags.uniq if defined? dob.tags
+ @tuned_file << dob
+ end
+ @tuned_file=@tuned_file.flatten
+ end
+ def ocn(data) #and auto segment numbering increment
+ @tuned_file=SiSU_AO_DocumentStructureExtract::OCN.new(@md,data).ocn
+ @tuned_file
+ end
+ def xml(data)
+ @tuned_file=SiSU_AO_DocumentStructureExtract::XML.new(@md,data).dom
+ @tuned_file
+ end
+ def minor_numbering(data) #and auto segment numbering increment
+ @tuned_file=[]
+ number_small,letter_small=0,0
+ letter=%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 )
+ data.each do |dob|
+ if dob.of ==:heading \
+ || dob.of ==:heading_insert \
+ || dob.of ==:para \
+ || dob.of ==:block
+ if dob.is ==:heading \
+ and dob.ln.to_s=~/^[1-9]/ #% sub-number system, (baby numbering) reset with any change of major number (more obviously should be placed in number titles, but that is conditionally executed, check and move later)
+ number_small,letter_small=0,0
+ elsif dob.is ==:para
+ if dob.obj =~/^#[ 1]/ \
+ and dob.obj !~/^#\s+(?:~#)?$/
+ letter_small=0
+ number_small=0 if dob.obj =~ /^#1/
+ number_small+=1
+ dob.obj=dob.obj.gsub(/^#[ 1]/,"#{number_small}. ")
+ end
+ if dob.obj =~/^_# /
+ dob.obj=dob.obj.gsub(/^_# /,"#{letter[letter_small]}. ")
+ dob.indent='1'
+ letter_small+=1
+ end
+ end
+ end
+ @tuned_file << dob
+ end
+ @tuned_file=@tuned_file.flatten
+ end
+ def name_para_seg_filename(data) #segment naming, remaining
+ # paragraph name/numbering rules
+ # manual naming overrides, manual naming may be
+ # alpha-numeric characters mixed,
+ # numeric only (a number), if
+ # all segments have been named,
+ # the numbers used are over 1000 or
+ # it is not minded that auto-numbering uses a funny scheme for naming segments (not yet implemented)
+ # [for now a warning is printed for such documents on use of maintenance or very-verbose flag]
+ # auto-naming takes the form of giving numbers to segments
+ # the rules for which are as follows
+ # if the title/heading text starts with a numeric, then that is used (1 3.1 3rd etc.)
+ # otherwise the level 4 segment number from the embedded document structure info is used
+ # if there is none a sequential number is designated, preceded by an underscore
+ @tuned_file,@unique_auto_name=[],[]
+ tags={}
+ art_filename_auto=1
+ @counter=1
+ if not @md.seg_autoname_safe \
+ and (@md.opt.act[:verbose_plus][:set]==:on \
+ || @md.opt.act[:maintenance][:set]==:on)
+ puts 'manual segment names, numbers used as names, risk warning (segmented html)'
+ end
+ ocn_html_seg=[]
+ data.each do |dob|
+ if dob.is==:heading \
+ && dob.ln \
+ and dob.ln.to_s =~/^[456]/
+ if dob.ln==4 \
+ and not dob.name \
+ and not @md.set_heading_seg
+ @md.set_heading_seg=true
+ end
+ if dob.name !~/^\S+/ \
+ and dob.obj =~/^\s*(?:\S+\s+)?([\d.,:-]+)/m #heading starts with a recognised numeric or word followed by a recognised numerical construct, use that as name
+ possible_seg_name=$1
+ possible_seg_name=possible_seg_name.gsub(/(?:[:,-]|\W)/,'.').
+ gsub(/\.$/,'')
+ if @md.seg_names.is_a?(Array) \
+ and not @md.seg_names.include?(possible_seg_name)
+ dob.name=possible_seg_name
+ dob.tags=[dob.name,dob.tags].flatten if dob.name !~/^\d+$/
+ @md.seg_names << possible_seg_name
+ elsif (@md.opt.act[:verbose_plus][:set]==:on \
+ or @md.opt.act[:maintenance][:set]==:on)
+ puts 'warn, there may be a conflicting numbering scheme'
+ end
+ end
+ if dob.ln==4 \
+ and dob.name #extract segment name from embedded document structure info
+ if @md.seg_names.is_a?(Array) \
+ and not @md.seg_names.include?(dob.name)
+ dob.tags=[dob.name,dob.tags].flatten if dob.name !~/^\d+$/
+ @md.seg_names << dob.name
+ end
+ end
+ if dob.ln==4 \
+ and not dob.name #if still no segment name, provide a numerical one
+ pf='_' #pg='' #may use e.g. '' or '~' or '_'
+ segn_auto="#{pf}#{art_filename_auto.to_s}"
+ if @md.seg_names.is_a?(Array) \
+ and not @md.seg_names.include?(segn_auto)
+ dob.name=segn_auto
+ dob.tags=[dob.name,dob.tags].flatten if dob.name !~/^\d+$/ #check whether will work across file types with stop signs
+ @md.seg_names << segn_auto
+ else puts 'segment name (numbering) error'
+ end
+ art_filename_auto+=1
+ end
+ if dob.ln==4 \
+ and not dob.name #should not occur
+ puts "e r r o r -\t#{__FILE__}::#{__LINE__}\n#{dob.inspect}"
+ end
+ end
+ if (dob.is ==:heading \
+ || dob.is ==:heading_insert) \
+ && dob.ln==4
+ @seg=dob.name
+ end
+ @tuned_file << if dob.is==:heading \
+ && (@md.pagenew || @md.pagebreak || @md.pageline)
+ m=dob.ln.to_s
+ dob_tmp=[]
+ if @md.pagenew.inspect =~/#{m}/
+ dob_tmp << SiSU_AO_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_new]) << dob
+ elsif @md.pagebreak.inspect =~/#{m}/
+ dob_tmp << SiSU_AO_DocumentStructure::ObjectLayout.new.break(Hx[:br_page]) << dob
+ elsif @md.pageline.inspect =~/#{m}/
+ dob_tmp << SiSU_AO_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_line]) << dob
+ end
+ unless dob_tmp.length > 0; dob
+ else dob_tmp
+ end
+ else dob
+ end
+ if defined? dob.ocn \
+ and dob.ocn
+ @segname=((dob.is==:heading || dob.is==:heading_insert) && dob.ln==4 && (defined? dob.name)) \
+ ? (dob.name)
+ : @segname
+ tags["#{dob.ocn}"]={ segname: @segname }
+ ocn_html_seg[dob.ocn]=if (dob.is==:heading || dob.is==:heading_insert)
+ if dob.ln =~/[1-3]/
+ { seg: nil, level: dob.ln }
+ else #elsif dob.ln =~/[4-6]/
+ { seg: @seg, level: dob.ln }
+ end
+ else
+ { seg: @seg, level: nil }
+ end
+ end
+ dob.tags=dob.tags.uniq if defined? dob.tags
+ if defined? dob.tags \
+ and dob.tags.length > 0
+ #@segname=((dob.is=='heading'|| dob.is=='heading_insert') && dob.ln==4 && (defined? dob.name)) \
+ #? (dob.name) \
+ #: @segname
+ dob.tags.each do |y|
+ tags[y]={ ocn: dob.ocn.to_s, segname: @segname }
+ end
+ end
+ dob
+ end
+ ocn_html_seg.each_with_index do |ocn,i|
+ if ocn \
+ and ocn[:level].to_s=~/[1-3]/
+ (1..4).each do |x|
+ if ocn_html_seg[i+x] and ocn_html_seg[i+x][:level]==4
+ ocn[:seg]=ocn_html_seg[i+x][:seg]
+ end
+ end
+ end
+ end
+ if @md.seg_names.length > 0
+ @md.set_heading_seg=true
+ end
+ tuned_file=@tuned_file.flatten
+ [tuned_file,tags,ocn_html_seg]
+ end
+ def set_heading_top(data) #% make sure no false positives
+ unless @md.set_heading_top
+ if (@md.opt.act[:verbose_plus][:set]==:on \
+ or @md.opt.act[:maintenance][:set]==:on)
+ puts "\tdocument contains no top level heading, (will have to manufacture one)"
+ end
+ @tuned_file=[]
+ data.each do |t_o|
+ unless @md.set_heading_top
+ if t_o !~/^(?:#{Rx[:meta]}|@\S+:)\s/m \
+ and t_o !~/\A\s*\Z/m
+ @md.set_heading_top=true
+ if defined? @md.title \
+ and @md.title \
+ and defined? @md.title.full \
+ and defined? @md.creator \
+ and @md.creator
+ head=@md.title.main ? ([@lv='1',@obj=@md.title.main]) : ([@lv='1',@obj='[no title provided]'])
+ @tuned_file << head
+ end
+ end
+ end
+ @tuned_file << t_o
+ end
+ @tuned_file=@tuned_file.flatten
+ end
+ end
+ def set_heading_seg(data) #% make sure no false positives
+ unless @md.set_heading_seg
+ if (@md.opt.act[:verbose_plus][:set]==:on \
+ or @md.opt.act[:maintenance][:set]==:on)
+ puts "\tdocument contains no segment level, (will have to manufacture one)"
+ end
+ @tuned_file=[]
+ data.each do |dob|
+ unless @md.set_heading_seg
+ if defined? dob.ln and dob.ln.to_s !~/^[123]/m \
+ and dob.obj !~/\A\s*\Z/m \
+ and dob.is !=:layout
+ @md.set_heading_seg=true
+ head=@md.title.main \
+ ? (dob.ln,dob.name,dob.obj=4,'seg',@md.title.main)
+ : (dob.ln,dob.name,dob.obj=4,'seg','[segment]')
+ @tuned_file << head
+ end
+ end
+ @tuned_file << dob
+ end
+ @tuned_file=@tuned_file.flatten
+ end
+ end
+ def set_header_title(data) #% make sure no false positives
+ unless @md.set_header_title
+ if (@md.opt.act[:verbose_plus][:set]==:on \
+ or @md.opt.act[:maintenance][:set]==:on)
+ puts "\t no document title provided, (will have to manufacture one)"
+ end
+ @tuned_file=[]
+ data.each do |t_o|
+ unless @md.set_header_title
+ if t_o !~/^%{1,2}\s/m \
+ and t_o !~/\A\s*\Z/m
+ @tuned_file << "#{Mx[:meta_o]}title#{Mx[:meta_c]} #{@md.heading_seg_first}"
+ @md.title.main=@md.heading_seg_first
+ @md.set_header_title=true
+ end
+ end
+ @tuned_file << t_o
+ end
+ @tuned_file=@tuned_file.flatten
+ end
+ end
+ end
+end
+__END__
diff --git a/lib/sisu/v5/ao_syntax.rb b/lib/sisu/v5/ao_syntax.rb
new file mode 100644
index 00000000..22e0124c
--- /dev/null
+++ b/lib/sisu/v5/ao_syntax.rb
@@ -0,0 +1,631 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012, 2013 Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see .
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+
+
+
+
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+
+
+
+ * Download:
+
+
+ * Git
+
+
+
+ * Ralph Amissah
+
+
+
+ ** Description: Syntax for markup, input markup syntaxes, determined here
+
+=end
+module SiSU_AO_Syntax
+ class Words
+ def initialize(line,md,mkp)
+ @line,@md,@mkp=line,md,mkp
+ end
+ end
+ class Markup
+ def initialize(md='',data='')
+ @md,@data=md,data
+ @vz=SiSU_Viz::Defaults.new
+ @data_new=[]
+ url_and_stub=SiSU_Env::InfoEnv.new.url
+ @output_url="#{url_and_stub.remote}"
+ @env=SiSU_Env::InfoEnv.new
+ emph_set=if defined? @md.emphasis_set_to \
+ and not @md.emphasis_set_to.nil?
+ @md.emphasis_set_to
+ else @env.markup_emphasis
+ end
+ @emph=case emph_set
+ when /bold/
+ emph_italics=false
+ { o: Mx[:fa_bold_o], c: Mx[:fa_bold_c] }
+ when /italics/
+ emph_italics=true
+ { o: Mx[:fa_italics_o], c: Mx[:fa_italics_c] }
+ when /underscore/
+ emph_italics=false
+ { o: Mx[:fa_underscore_o], c: Mx[:fa_underscore_c] }
+ else p __LINE__.to_s + '::' + __FILE__
+ end
+ @http_m=%r{\{.+?\}https?://\S+|https?:\S+|:\S+|\.\.\/\S+|#\S+|\S+?\.png\b|[*]~\S+|^#{Mx[:meta_o]}.+|#{Mx[:gr_o]}(?:code|block|group|alt|verse)(?:-end)?#{Mx[:gr_c]}|#{Mx[:fa_o]}:br#{Mx[:fa_c]}}
+ @manmkp_ital=emph_italics \
+ ? '[i/*]\\{.+?\\}[i/*]'
+ : '[i/]\\{.+?\\}[i/]'
+ tail_m_ital=%q{(?:\s|[.,;:?!'")]|~\^|~\\\{\s|$)}
+ tail_m_bold=%{(?:(?:#{Mx[:fa_italics_c]})?(?:\s|[.,;:?!'")]|~\^|~\\\{\s|$))?}
+ bold_line=%{^!_\s.+?(?:#{Mx[:br_line]}|\n|$)}
+ #ital_line=%{^/_\s.+?(?:#{Mx[:br_line]}|\n|$)} #not implemented
+ @line_scan_ital=if defined? @md.italics_match_list[:str]
+ /#{@http_m}|#{bold_line}|#{@manmkp_ital}#{tail_m_ital}|#{@md.italics_match_list[:str]}#{tail_m_ital}|\S+|\n/i
+ elsif defined? @vz.markup_make_italic[:str]
+ /#{@http_m}|#{bold_line}|#{@manmkp_ital}#{tail_m_ital}|#{@vz.markup_make_italic[:str]}#{tail_m_ital}|\S+|\n/i
+ end
+ @manmkp_bold=emph_italics \
+ ? '^!_\s.+?(?:\n|$)|[!b]\\{.+?\\}[*!b]|[*!][a-zA-Z0-9\-_]+[!]'
+ : '^!_\s.+?(?:\n|$)|[*!b]\\{.+?\\}[*!b]|[*!][a-zA-Z0-9\-_]+[*!]'
+ @line_scan_bold=if (defined? @md.bold_match_list[:str] \
+ and @md.bold_match_list[:str]) \
+ and (defined? @vz.markup_make_bold[:str] \
+ and @vz.markup_make_bold[:str])
+ /#{@http_m}|#{bold_line}|(?:#{@manmkp_bold}|#{@md.bold_match_list[:str]}|#{@vz.markup_make_bold[:str]})#{tail_m_bold}|\S+|\n/i
+ elsif defined? @md.bold_match_list[:str] \
+ and @md.bold_match_list[:str]
+ /#{@http_m}|#{bold_line}|(?:#{@manmkp_bold}|#{@md.bold_match_list[:str]})#{tail_m_bold}|\S+|\n/i
+ elsif defined? @vz.markup_make_bold[:str] \
+ and @vz.markup_make_bold[:str]
+ /#{@http_m}|#{bold_line}|(?:#{@manmkp_bold}|#{@vz.markup_make_bold[:str]})#{tail_m_bold}|\S+|\n/i
+ end
+ end
+ def songsheet
+ @data=@data.compact
+ @data.each do |dob|
+ dob=breaks(dob)
+ dob=if @md.sem_tag then sem(dob) else dob end #revisit
+ dob=line_actions(dob)
+ dob=paragraph_set(dob)
+ dob=substitutions(dob)
+ dob=wordlist_italics(dob)
+ dob=wordlist_bold(dob)
+ dob=bodymarkup(dob)
+ @data_new << dob unless dob.nil?
+ end
+ @data_new
+ end
+ def sem(dob) #revisit
+ dob=SiSU_Sem::Tags.new(dob,@md).rm.all
+ end
+ def breaks(dob)
+ if dob.is !=:meta \
+ && dob.is !=:comment \
+ && dob.is !=:code \
+ && dob.is !=:table
+ dob.obj=dob.obj.gsub(/^-\\\\-\s*$/,"#{Mx[:br_page]}").
+ gsub(/^=\\\\=\s*$/,"#{Mx[:br_page_new]}").
+ gsub(/ \\\\(?: |$)/,"#{Mx[:br_line]}").
+ gsub(/(?:<:?pb>)/,"#{Mx[:br_page]}"). # depreciated
+ gsub(/(?:<:?pn>)/,"#{Mx[:br_page_new]}"). # depreciated
+ gsub(/(?:<:?br>| )/,"#{Mx[:br_line]}"). # depreciated
+ gsub(/(?:^-\.\.-\s*$)/,"#{Mx[:br_page_line]}")
+ end
+ dob
+ end
+ def wordlist_italics(dob)
+ dob=dob.dup
+ if (defined? @md.italics_match_list[:str] \
+ and @md.italics_match_list[:str]) \
+ or (defined? @vz.markup_make_italic[:str] \
+ and @vz.markup_make_italic[:str])
+ dob.obj=if dob.is !=:meta \
+ && dob.is !=:heading \
+ && dob.is !=:heading_insert \
+ && dob.is !=:code \
+ && dob.is !=:comment
+ word=dob.obj.scan(@line_scan_ital)
+ word=word.flatten.compact
+ line_array=[]
+ word.each do |w|
+ unless /#{@manmkp_ital}|#{@http_m}/.match(w)
+ if defined? @md.italics_match_list[:regx] \
+ and @md.italics_match_list[:regx]
+ w=w.gsub(@md.italics_match_list[:regx],
+ "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}")
+ elsif defined? @vz.markup_make_italic \
+ and @vz.markup_make_italic
+ w=w.gsub(@vz.markup_make_italic,
+ "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}")
+ else w
+ end
+ end
+ line_array << w
+ end
+ line_array.join(' ')
+ else dob.obj
+ end
+ end
+ dob
+ end
+ def embolden(given)
+ given=given.gsub(/^!_\s+((?:\{|#{Mx[:lnk_o]})(?:~^ )?.+?(?:\}|#{Mx[:lnk_o]})https?:\/\/\S+.*?)([#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/,
+ "#{Mx[:fa_bold_o]} \\1 #{Mx[:fa_bold_c]}\\2").
+ gsub(/^!_\s+((?:\{|#{Mx[:lnk_o]})(?:~^ )?.+?(?:\}|#{Mx[:lnk_o]})https?:\/\/\S+.*)/,
+ "#{Mx[:fa_bold_o]} \\1 #{Mx[:fa_bold_c]}").
+ gsub(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)([#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/,
+ "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2").
+ gsub(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)\s+((?:[*]~\S+\s*)+)/,
+ "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2").
+ gsub(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)\s*([~-]#)$/,
+ "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2").
+ gsub(/(?:^!_\s+|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]}\s*)(.*)?\s*$/,
+ "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}")
+ end
+ def italicise(given)
+ given=given.gsub(/^\/_\s*(.+?)([#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/,
+ "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2").
+ gsub(/^\/_\s*(.+?)\s+((?:[*]~\S+\s*)+)/,
+ "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2").
+ gsub(/^\/_\s*(.+?)\s*([~-]#)$/,
+ "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2").
+ gsub(/^\/_\s+(.*)?\s*$/,
+ "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}")
+ end
+ def line_actions(dob)
+ dob.obj=if (dob.is !=:heading \
+ && dob.is !=:heading_insert \
+ && dob.is !=:comment \
+ && dob.is !=:meta) \
+ and dob.obj =~ /^!_\s+/
+ embolden(dob.obj)
+ elsif dob.obj =~ /^\/_\s+/
+ italicise(dob.obj)
+ else dob.obj
+ end
+ dob
+ end
+ def paragraph_set(dob)
+ dob.obj=if dob.is !=:meta \
+ && dob.is !=:heading \
+ && dob.is !=:heading_insert \
+ && dob.is !=:code \
+ && dob.is !=:comment \
+ && dob.is !=:table
+ dob.obj.gsub(/\n/m,' ').
+ gsub(/ \s+/m,' ')
+ else dob.obj
+ end
+ dob
+ end
+ def substitutions(dob)
+ dob=dob.dup
+ dob=if defined? @md.substitution_match_list[:match_and_replace] \
+ and @md.substitution_match_list[:match_and_replace].is_a?(Array)
+ dob=if dob.is !=:meta \
+ && dob.is !=:heading_insert \
+ && dob.is !=:code \
+ && dob.is !=:comment \
+ && dob.is !=:table
+ if dob.obj =~/#{@md.substitution_match_list[:matches]}/
+ @md.substitution_match_list[:match_and_replace].each do |x|
+ dob.obj=if x[:case_s]==:i
+ dob.obj.gsub(/#{x[:match]}/mi,x[:replace])
+ else
+ dob.obj.gsub(/#{x[:match]}/m,x[:replace])
+ end
+ end
+ end
+ dob
+ else dob
+ end
+ dob
+ else dob
+ end
+ end
+ def wordlist_bold(dob)
+ dob=dob.dup
+ if (defined? @md.bold_match_list[:str] \
+ and @md.bold_match_list[:str]) \
+ or (defined? @vz.markup_make_bold[:str] \
+ and @vz.markup_make_bold[:str])
+ dob.obj=if dob.is !=:meta \
+ && dob.is !=:heading \
+ && dob.is !=:heading_insert \
+ && dob.is !=:code \
+ && dob.is !=:comment \
+ && dob.is !=:table
+ line_array=[]
+ word=dob.obj.scan(@line_scan_bold)
+ word=word.flatten.compact
+ word.each do |w|
+ unless /#{@manmkp_bold}|#{@http_m}/.match(w)
+ if defined? @md.bold_match_list[:regx] \
+ and @md.bold_match_list[:regx] #document header: @bold: [bold word list]
+ w=w.gsub(@md.bold_match_list[:regx],"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}")
+ elsif defined? @vz.markup_make_bold \
+ and @vz.markup_make_bold #defaults adjusted bold word list
+ w=w.gsub(@vz.markup_make_bold,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}")
+ end
+ else
+ w=if w =~ /(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s+/
+ embolden(w) #bold paragraph/emphasize #may wish to remove think about 7{ 8{ conversion not satisfactory, as information is lost!
+ elsif w =~/^\/_\s+/
+ italicise(w)
+ else w
+ end
+ end
+ line_array << w
+ end
+ line_array.join(' ')
+ else dob.obj
+ end
+ else
+ dob.obj=if dob.is==:heading \
+ and dob.ln.to_s =~/[7-9]/
+ embolden(dob.obj)
+ else dob.obj
+ end
+ end
+ dob
+ end
+ def fontface_lines(dob,leader)
+ while (dob.obj =~/#{Mx[:br_nl]}/ \
+ and dob.obj =~/(?:#{leader})([*!\/_#])\{(.+?)\}\1/m) \
+ and $2 =~/#{Mx[:br_nl]}/
+ dob=if dob.obj =~/#{Mx[:br_nl]}/ \
+ and dob.obj =~/(#{leader})([*!\/_#])\{(.+?)\}\2/m
+ lead,fce,txt=$1,$2,$3
+ dob=if txt =~/#{Mx[:br_nl]}/
+ lead_break=if dob.obj =~/^#{Mx[:br_nl]}/
+ dob.obj=dob.obj.sub(/^#{Mx[:br_nl]}/,'')
+ Mx[:br_nl]
+ else ''
+ end
+ txt="#{lead_break}#{fce}\{" + txt.split(Mx[:br_nl]).join("\}#{fce}#{Mx[:br_nl]}#{fce}\{") + "\}#{fce}"
+ dob.obj=dob.obj.sub(/(?:^|#{Mx[:gl_c]}|\s+|['"]|[#{Mx[:nbsp]}#{Mx[:fa_o_c]}#{Mx[:fa_c]}#{Mx[:lnk_o]}#{Mx[:br_nl]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:tc_c]}#{Mx[:tc_p]}]|[\(\[\{]|\>)([*!\/_#])\{.+?\}\1/m,"#{lead}#{txt}")
+ dob
+ else dob
+ end
+ end
+ dob
+ end
+ dob
+ end
+ def fontface(dob)
+ leader=/^|#{Mx[:gl_c]}|\s+|['"]|[#{Mx[:nbsp]}#{Mx[:fa_o_c]}#{Mx[:fa_c]}#{Mx[:lnk_o]}#{Mx[:br_nl]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:tc_c]}#{Mx[:tc_p]}]|[\(\[\{]|[、。]|\>/
+ dob=fontface_lines(dob,leader)
+ dob.obj=dob.obj.gsub(/(#{leader})\*\{(.+?)\}\*/m,
+ "\\1#{@emph[:o]}\\2#{@emph[:c]}"). #emphasis
+ gsub(/(#{leader})!\{(.+?)\}!/m,
+ "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}"). #bold
+ gsub(/(#{leader})\/\{(.+?)\}\//m,
+ "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}"). #italics
+ gsub(/(#{leader})_\{(.+?)\}_/m,
+ "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}"). #underscore
+ gsub(/(#{leader})#\{(.+?)\}#/m,
+ "\\1#{Mx[:fa_monospace_o]}\\2#{Mx[:fa_monospace_c]}"). #monospace
+ gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|[#{Mx[:nbsp]}#{Mx[:fa_o_c]}#{Mx[:fa_c]}]|\(|\>)\"\{(.+?)\}\"/m,
+ "\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}"). #cite /blockquote?
+ gsub(/(^|[^\\])\^\{(.+?)\}\^/m,
+ "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}"). #superscript
+ gsub(/(^|[^\\]),\{(.+?)\},/m,
+ "\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}"). #subscript
+ gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\+\{(.+?)\}\+/m,
+ "\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}"). #inserted text
+ gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)-\{(.+?)\}-/m,
+ "\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}"). #strikethrough - deleted text
+ gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>|\d+)\^(\S+?)\^/,
+ "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") #superscript single word, watch digit added
+ dob
+ end
+ def bodymarkup(dob)
+ # << http://www.jus.uio.no/sisu/sisu_markup_table/markup >>
+ # See: data/sisu/sample/document_samples_sisu_markup/
+ ## fontface
+ # *{emphasis}* e{emphasis}e emphasis
+ # !{bold text}! b{bold}b bold text
+ # _{underline}_ u{underline}u underline
+ # /{italics}/ i{italics}i italics
+ # "{citation}" c{citation}c citation #blockquote?
+ # ^{superscript}^ superscript
+ # ,{subscript}, subscript
+ # +{inserted text}+ inserted text
+ # -{deleted text}- deleted text
+ # #{monospace text}#
+ #
+ # {url address}:url
+ # {image.png}imageurl
+ # {image.png}png
+ # ~{endnote}~
+ # !_ #bold/emphasise paragraph
+ # _" #blockquote paragraph
+ # _1 <:i1> #indent paragraph 1 step
+ # _2 <:i2> #indent paragraph 2 steps
+ # _3 <:i3> #indent paragraph 3 steps
+ # _4 <:i4> #indent paragraph 4 steps
+ # _* #bullet (list) ●
+ # _1* #bullet (list) indented
+ # _1* #bullet (list) indented
+ # # #numbered (list) level 1
+ # _# #numbered (list) level 2
+ dob=dob.dup
+ if dob.is !=:meta \
+ && dob.is !=:comment \
+ && dob.is !=:code \
+ && dob.is !=:table
+ line_array=[]
+ word=dob.obj.scan(/\S+|\n/) #unless line =~/^(?:#{Mx[:meta_o]}|%+\s)/ #visit
+ if word
+ word.each do |w| # _ - / # | : ! ^ ~
+ unless w =~/~\{|\}~|~\[|\]~|^\^~|~\^|\*~\S+|~#|\{t?~|\{table|https?:\/\/\S+/ # do something earlier about table!!
+ w=w.gsub(/\\?~/,"#{Mx[:gl_o]}#126#{Mx[:gl_c]}") #escaped special character
+ end
+ w=w.gsub(/^\<$/,"#{Mx[:gl_o]}#lt#{Mx[:gl_c]}").gsub(/^\>$/,"#{Mx[:gl_o]}#gt#{Mx[:gl_c]}") #escaped special character
+ line_array << w
+ end
+ dob.obj=line_array.join(' ')
+ dob.obj=dob.obj.strip
+ end
+ dob.obj=dob.obj.gsub(/^([*#-.]{1,12})$/,'\1 ~#'). #ocn off for these paragraph separators
+ gsub(/~\{(.+?)\}~/m,Mx[:en_a_o] + '\1' + Mx[:en_a_c]).
+ gsub(/~\[([^*+].+?)\]~/m,Mx[:en_b_o] + '* \1' + Mx[:en_b_c]). #default if markup does not specify
+ gsub(/~\[(.+?)\]~/m,Mx[:en_b_o] + '\1' + Mx[:en_b_c])
+ if dob.is ==:heading \
+ and dob.ln ==1
+ dob.obj=dob.obj.gsub(/\s*@title\b/," #{@md.title.full}")
+ dob.obj=if defined? @md.creator.author \
+ and @md.creator.author
+ dob.obj.gsub(/\s+(?:@creator|@author)/,",#{Mx[:br_line]}#{@md.creator.author}")
+ else dob.obj.gsub(/\s+(?:@creator|@author)/,'')
+ end
+ end
+ if defined? @md.title \
+ and @md.title \
+ and defined? @md.title.full \
+ and defined? @md.creator \
+ and @md.creator
+ if dob.is ==:heading
+ dob.obj=dob.obj.gsub(/^\s*@title\s*$/,@md.title.full) if dob.lv =~/1/
+ dob.obj=if dob.lv =~/[23]/ \
+ and defined? @md.creator.author \
+ and @md.creator.author
+ dob.obj.gsub(/^\s*(?:(by\s+)?(?:@creator|@author))\s*$/,"\\1#{@md.creator.author}")
+ else dob.obj.gsub(/^\s*(?:(by\s+)?(?:@creator|@author))\s*$/,'\1')
+ end
+ end
+ end
+ dob.obj=dob.obj.gsub(/<(https?:\/\/\S+?)>/,'< \1 >'). #catch problem markup
+ gsub(/<:=(\S+?)>/,'{ c_\1.png 14x14 }image').
+ gsub(//,'<:\1>'). #escaped special character
+ gsub(/ /,"#{Mx[:nbsp]}"). #escaped special character
+ gsub(/\\~/,"#{Mx[:gl_o]}#126#{Mx[:gl_c]}"). #escaped special character
+ gsub(/\\\{/,"#{Mx[:gl_o]}#123#{Mx[:gl_c]}"). #escaped special character
+ gsub(/\\\}/,"#{Mx[:gl_o]}#125#{Mx[:gl_c]}"). #escaped special character
+ gsub(/\\\<,"#{Mx[:gl_o]}#lt#{Mx[:gl_c]}#{Mx[:gl_o]}#lt#{Mx[:gl_c]}"). #escaped special character
+ gsub(/\\\>>/,"#{Mx[:gl_o]}#gt#{Mx[:gl_c]}#{Mx[:gl_o]}#gt#{Mx[:gl_c]}"). #escaped special character
+ gsub(/\\\,"#{Mx[:gl_o]}#lt#{Mx[:gl_c]}"). #escaped special character
+ gsub(/\\\>/,"#{Mx[:gl_o]}#gt#{Mx[:gl_c]}"). #escaped special character
+ gsub(/\\\_/,"#{Mx[:gl_o]}#095#{Mx[:gl_c]}"). #escaped special character
+ gsub(/\\\-/,"#{Mx[:gl_o]}#045#{Mx[:gl_c]}"). #escaped special character
+ gsub(/\\\+/,"#{Mx[:gl_o]}#043#{Mx[:gl_c]}"). #escaped special character
+ gsub(/\\\//,"#{Mx[:gl_o]}#047#{Mx[:gl_c]}"). #escaped special character
+ gsub(/\\\#/,"#{Mx[:gl_o]}#035#{Mx[:gl_c]}"). #escaped special character
+ gsub(/\\\&/,"#{Mx[:gl_o]}#038#{Mx[:gl_c]}"). #& #escaped special character
+ gsub(/\\\|/,"#{Mx[:gl_o]}#124#{Mx[:gl_c]}"). #not really a sisu special character but made available as possibility
+ gsub(/\\\:/,"#{Mx[:gl_o]}#058#{Mx[:gl_c]}"). #not really a sisu special character but made available as possibility
+ gsub(/\\\!/,"#{Mx[:gl_o]}#033#{Mx[:gl_c]}"). #not really a sisu special character but made available as possibility
+ gsub(/\\\^/,"#{Mx[:gl_o]}#094#{Mx[:gl_c]}"). #not really a sisu special character but made available as possibility
+ gsub(/\\\,/,"#{Mx[:gl_o]}#044#{Mx[:gl_c]}"). #not really a sisu special character but made available as possibility
+ gsub(/\\\\/,"#{Mx[:gl_o]}#092#{Mx[:gl_c]}"). #escaped special character
+ gsub(/\\\*/,"#{Mx[:gl_o]}#042#{Mx[:gl_c]}"). #escaped special character
+ gsub(/\\\!/,"#{Mx[:gl_o]}#033#{Mx[:gl_c]}") #escaped special character
+ if dob.obj=~/(?:https?:|ftp:|\{([^{}]+?)\}(?:#|:|[.]{1,2}\/))\S+/m
+ if dob.obj=~/(?:^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ (?:.+?)\s*\}(?:(?:https?:|ftp:|:|[.]{1,2}\/)\S+?)\s*#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/m
+ dob.obj=dob.obj.gsub(/(^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ ([^}]+?)\s*\}((?:https?:|ftp:|:|[.]{1,2}\/)\S+?)\s*#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/m,
+ "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3 #{Mx[:en_a_o]}\\3 \\4#{Mx[:en_a_c]}") # watch
+ end
+ if dob.obj=~/(?:^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ (?:.+?)\s*\}(?:(?:https?:|ftp:|:|[.]{1,2}\/)\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m
+ dob.obj=dob.obj.gsub(/(^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ (.+?)\s*\}((?:https?:|ftp:|:|[.]{1,2}\/)\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m,
+ "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3\\4 #{Mx[:en_a_o]}\\3#{Mx[:en_a_c]} ")
+ end
+ dob.obj=dob.obj.gsub(/(^|[^#])\{\s*([^{}]+?)\s*\}((?:https?:|:|[.]{2}\/|#)\S+?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/,
+ "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3"). #linked (text or image, however text cannot include modified face, e.g. bold, ital, underline)
+ gsub(/(^|[#{Mx[:gl_c]}#{Mx[:lnk_c]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}(\s])((?:https?|ftp):\/\/\S+?\.[^>< ]+?)([,.;'"]?)(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m,
+ %{\\1#{Mx[:url_o]}\\2#{Mx[:url_c]}\\3}).
+ gsub(/#{Mx[:lnk_c]}#(\S+?[^>< ]+?)([()\[\]]*[,.;:!?'"]{0,2})(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m,
+ %{#{Mx[:lnk_c]}#{Mx[:rel_o]}\\1#{Mx[:rel_c]}\\2}).
+ gsub(/#{Mx[:lnk_c]}:(\S+?[^>< ]+?)([()\[\]]*[,.;:!?'"]{0,2})(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m,
+ %{#{Mx[:lnk_c]}#{Mx[:rel_o]}:\\1#{Mx[:rel_c]}\\2}).
+ gsub(/#{Mx[:lnk_c]}[.]{2}\/(\S+?[^>< ]+?)([()\[\]]*[,.;:!?'"]{0,2})(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m,
+ %{#{Mx[:lnk_c]}#{Mx[:rel_o]}:\\1#{Mx[:rel_c]}\\2})
+ end
+ if dob.obj=~/_(?:https?|ftp):\S+/m # _http://url #CHECK
+ dob.obj=dob.obj.gsub(/(^|[#{Mx[:gl_c]}#{Mx[:lnk_c]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}(\s])(_(?:https?|ftp):\/\/\S+?\.[^>< ]+?)([,.;'"]?)(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m,
+ %{\\1#{Mx[:url_o]}\\2#{Mx[:url_c]}\\3})
+ end
+ dob=fontface(dob)
+ dob.obj=dob.obj.gsub(/<[:e]\s+(.+?)!?>/,
+ "#{Mx[:en_a_o]}\\1#{Mx[:en_a_c]}"). #not tested
+ gsub(/(^|#{Mx[:br_nl]})\s*_\*\s*/,
+ "\\1#{Mx[:gl_bullet]}"). #bullets, shortcut
+ gsub(/=\{(.+?)\}/,
+ "#{Mx[:idx_o]}\\1#{Mx[:idx_c]}").
+ gsub(/^\s*_([1-9])\*\s*/,
+ "#{Mx[:pa_o]}:i\\1:\\1#{Mx[:pa_c]}#{Mx[:gl_bullet]}"). #bullets, shortcut
+ gsub(/^\s*_([1-9])\s+/,
+ "#{Mx[:pa_o]}:i\\1:\\1#{Mx[:pa_c]}"). #indent
+ gsub(/^\s*_([1-9])!\s+(.+?)\s*$/,
+ "#{Mx[:pa_o]}:i\\1:\\1#{Mx[:pa_c]}#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]} "). #indent bold
+ gsub(/^\s*__([1-9])\s+/,
+ "#{Mx[:pa_o]}:i0:\\1#{Mx[:pa_c]}"). #hang
+ gsub(/^\s*__([1-9])!\s+(.+?)\s*$/,
+ "#{Mx[:pa_o]}:i0:\\1#{Mx[:pa_c]}#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]} "). #hangdef
+ gsub(/^\s*_([0-9])_([0-9])\s+/,
+ "#{Mx[:pa_o]}:i\\1:\\2#{Mx[:pa_c]}"). #hang
+ gsub(/^\s*_([0-9])_([0-9])!\s+(.+?)\s*$/,
+ "#{Mx[:pa_o]}:i\\1:\\2#{Mx[:pa_c]}#{Mx[:fa_bold_o]}\\3#{Mx[:fa_bold_c]} "). #hangdef
+ gsub(/<:hi>/,"#{Mx[:fa_hilite_o]}"). #''). # bright yellow rgb(255,255,0) pale yellow rgb(255,255,200)
+ gsub(/<:\/hi>/,"#{Mx[:fa_hilite_c]}"). #'').
+ gsub(/(#{Mx[:gr_o]}verse#{Mx[:gr_c]}.+)/m,"\\1\n").
+ gsub(/[ ]+($)/,'\1').
+ gsub(/\{\s*(.+?)\s*\}(https?:\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/,
+ "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}#{Mx[:url_o]}\\2#{Mx[:url_c]}\\3"). #any remaining linked text or image
+ gsub(/\{\s*(.+?)\s*\}(#{Mx[:url_o]}\S+?#{Mx[:url_c]})/,
+ "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2"). #any remaining linked text or image
+ gsub(/(^|\s)([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)/,"\\1#{Mx[:url_o]}\\2#{Mx[:url_c]}").
+ gsub(/(^|[ ])\{\s*(.+?)\s*\}(\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/,
+ "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3\\4"). #any remaining linked text or image
+ gsub(/\{\s*(.+?)\s*\}#([a-zA-Z0-9][a-zA-Z0-9_-]*)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/,
+ "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}#{Mx[:rel_o]}\\2#{Mx[:rel_c]}\\3"). #any remaining linked text or image, check need
+ gsub(/\{\s*(.+?)\s*\}(#{Mx[:rel_o]}\S+?#{Mx[:rel_c]})/,
+ "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2"). #any remaining linked text or image, check need
+ gsub(/\{\s*(.+?)\s*\}(image)/,
+ "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2") #linked image
+ elsif dob.is==:table
+ dob=fontface(dob)
+ elsif dob.is ==:code
+ dob.obj=dob.obj.gsub(/#{Mx[:meta_o]}(\S+?)#{Mx[:meta_c]}\s*/,'@\1: ').
+ gsub(/(^|#{Mx[:gl_c]}|\s)<(br(?: \/)?)>([\s,.]|$)/,'\1<\2>\3') #convert
}
- the_idx.each do |i|
- i.each do |x|
- if x.is_a?(String)
- f=/^(\S)/.match(x)[1]
- if letter < f
- while letter < f
- if alph.length > 0
- letter=alph.shift
- idx[:html] << %{\n
#{c}, }
- print "\n\t" + k + ', ' if @md.opt.act[:verbose_plus][:set]==:on
- y.each do |z|
- if z[:range]
- idx[:sst_rel_html_seg][@o]=idx[:sst_rel_html_seg][@o] + %{#{Mx[:lnk_o]}#{z[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:seg]}.html##{z[:ocn]}#{Mx[:rel_c]}, }
- idx[:sst_rel][@t]=idx[:sst_rel][@t] + %{#{Mx[:lnk_o]}#{z[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:ocn]}#{Mx[:rel_c]}, }
- idx[:html][@q]=idx[:html][@q] + %{#{z[:range]}, }
- idx[:xhtml][@q]=idx[:xhtml][@q] + %{#{z[:range]}, }
- print z[:range] + ', ' if @md.opt.act[:verbose_plus][:set]==:on
- elsif z[:ocn]
- idx[:sst_rel_html_seg][@o]=idx[:sst_rel_html_seg][@o] + %{#{Mx[:lnk_o]}#{z[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:seg]}.html##{z[:ocn]}#{Mx[:rel_c]}, }
- idx[:sst_rel][@t]=idx[:sst_rel][@t] + %{#{Mx[:lnk_o]}#{z[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:ocn]}#{Mx[:rel_c]}, }
- idx[:html][@q]=idx[:html][@q] + %{#{z[:ocn]}, }
- idx[:xhtml][@q]=idx[:xhtml][@q] + %{#{z[:ocn]}, }
- print z[:ocn] + ', ' if @md.opt.act[:verbose_plus][:set]==:on
- else p 'error'
- end
- end
- idx[:html][@q]=idx[:html][@q] + '
'
- idx[:xhtml][@r]=idx[:xhtml][@r] + ''
- end
- end
- end
- @x +=1
- end
- end
- end
- print "\n" if @md.opt.act[:verbose_plus][:set]==:on
- idx
- end
- def screen_print(the_idx)
- the_idx.each do |i|
- i.each do |x|
- if x.is_a?(String)
- print "\n" + x + ', '
- elsif x.is_a?(Array)
- p 'array error? -->'
- print x
- elsif x.is_a?(Hash)
- if x['node_0_terms'].is_a?(Array)
- x['node_0_terms'].each do |a|
- if a[:range]
- print a[:range] + ', '
- elsif a[:ocn]
- print a[:ocn] + ', '
- else p 'error'
- end
- end
- end
- if x['node_1_subterms']
- x['node_1_subterms'].sort.each do |k,y|
- if k !~/node_0_terms/
- print "\n\t" + k + ', '
- y.each do |z|
- if z[:range]
- print z[:range] + ', '
- elsif z[:ocn]
- print z[:ocn] + ', '
- else p 'error'
- end
- end
- end
- end
- end
- end
- end
- end
- end
- def output_idx(idx)
- if @md.book_idx
- path="#{@env.path.output}/#{@md.fnb}"
- Dir.mkdir(path) unless FileTest.directory?(path)
- puts "#{path}/#{@md.fn[:book_idx_html]} #{__FILE__}::#{__LINE__}"
- html_index_file=File.new("#{path}/#{@md.fn[:book_idx_html]}",'w')
- idx[:html].each {|x| html_index_file << x }
- html_index_file.close
- end
- end
- def clean_and_insert_index(data,sisu_markup_idx)
- tuned_file=[]
- data.each do |dob|
- tuned_file << dob
- if dob.obj =~/#{Mx[:br_endnotes]}/ \
- and sisu_markup_idx
- sisu_markup_idx.each do |idx|
- tuned_file << idx
- end
- end
- end
- tuned_file
- end
- def clean_index(data) #check on use of dob
- tuned_file=[]
- data.each do |para|
- para=para.gsub(/\n*#{@rgx_idx}/m,'')
- tuned_file << para
- end
- tuned_file
- end
- end
-end
-__END__
diff --git a/lib/sisu/v5/dal_images.rb b/lib/sisu/v5/dal_images.rb
deleted file mode 100644
index 33a5e627..00000000
--- a/lib/sisu/v5/dal_images.rb
+++ /dev/null
@@ -1,165 +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 .
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
-
-
-
-
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
-
-
-
- * Download:
-
-
- * Git
-
-
-
- * Ralph Amissah
-
-
-
- ** Description: system environment, resource control and configuration details
-
-=end
-module SiSU_DAL_Images
- class Images
- #require 'RMagick'
- #include Magick
- def initialize(md,data)
- @md,@data=md,data
- end
- def images
- data=@data
- tuned_file=[]
- @rmgk=false
- imagemagick_=true #imagemagick_=SiSU_Env::InfoSettings.new.program?('rmagick')
- if imagemagick_
- begin
- @rmgk=SiSU_Env::Load.new('RMagick').prog
- rescue
- @rmgk=false
- end
- else
- if (@md.opt.act[:verbose][:set]==:on \
- || @md.opt.act[:verbose_plus][:set]==:on \
- || @md.opt.act[:maintenance][:set]==:on)
- SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'*WARN* use of RMagick is not enabled in sisurc.yml').warn
- end
- end
- data.each do |dob|
- unless dob.is ==:table
- dob.obj=dob.obj.strip
- if dob.obj =~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif)(?:\s*|\s+.+)?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/
- if dob.obj !~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif)\s+\d+x\d+/
- m=/#{Mx[:lnk_o]}\s*(\S+\.(?:png|jpg|gif))/
- if imagemagick_
- imgs=dob.obj.scan(m).flatten
- img_col=img_row=nil
- images=imgs.each do |image|
- dir=SiSU_Env::InfoEnv.new(@md.fns)
- path_image=[dir.path.image_source_include_local,dir.path.image_source_include_remote,dir.path.image_source_include]
- image_path=nil
- path_image.each do |img_pth|
- image_path=img_pth
- break if FileTest.exist?("#{img_pth}/#{image}")
- end
- if FileTest.exist?("#{image_path}/#{image}")
- if @rmgk
- img=Magick::ImageList.new("#{image_path}/#{image}")
- img_col,img_row=img.columns,img.rows
- else
- if (@md.opt.act[:verbose][:set]==:on \
- || @md.opt.act[:verbose_plus][:set]==:on \
- || @md.opt.act[:maintenance][:set]==:on)
- SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'*WARN* RMagick not present, will attempt to use imagemagick (identify) directly').warn
- end
- imgk=SiSU_Env::SystemCall.new.imagemagick
- gmgk=SiSU_Env::SystemCall.new.graphicksmagick
- if imgk or gmgk
- if imgk
- imgsys=`identify #{image_path}/#{image}`.strip #system call
- elsif gmgk
- imgsys=`gm identify #{image_path}/#{image}`.strip #system call
- end
- img_col,img_row=/(\d+)x(\d+)/m.match(imgsys)[1,2]
- img_col,img_row=img_col.to_i,img_row.to_i
- end
- end
- row=((img && defined? img.rows) ? img.rows : img_row)
- col=((img && defined? img.columns) ? img.columns : img_col)
- if img_col > img_row #landscape
- if img_col> 640
- img_col=640
- img_row=((1.00*img_col/col)*row).round
- end
- else #portrait
- if img_col> 640
- img_col=640
- img_row=((1.00*img_col/col)*row).round
- end
- if img_row > 640
- img_row=640
- img_col=((1.00*img_row/row)*col).round
- end
- end
- dob.obj=dob.obj.gsub(/(#{image})/,"#{image} #{img_col}x#{img_row}")
- else dob.obj=dob.obj.gsub(/#{Mx[:lnk_o]}\s*(\S+)\.(png|jpg|gif).+?#{Mx[:lnk_c]}(#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/,'[ \1 (\2 missing) ]')
- end
- end
- else
- images=dob.obj.scan(m) do |image|
- SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'*WARN* where image dimensions have not been provided RMagick or imagemagick is required',image).warn unless @md.opt.act[:quiet][:set]==:on
- end
- end
- end
- end
- if dob.obj =~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/
- dob.obj=dob.obj.gsub(/(#{Mx[:lnk_o]})\s*(\S+\.(?:png|jpg|gif))\s+/i,'\1\2 ')
- end
- end
- tuned_file << dob unless dob.nil?
- end
- tuned_file
- end
- end
-end
-__END__
-imgsys=`identify #{image_path}/#{image}`.strip
diff --git a/lib/sisu/v5/dal_metadata.rb b/lib/sisu/v5/dal_metadata.rb
deleted file mode 100644
index 1fa5619c..00000000
--- a/lib/sisu/v5/dal_metadata.rb
+++ /dev/null
@@ -1,82 +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 .
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
-
-
-
-
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
-
-
-
- * Download:
-
-
- * Git
-
-
-
- * Ralph Amissah
-
-
-
- ** Description: system environment, resource control and configuration details
-
-=end
-module SiSU_DAL_Metadata
- class Metadata
- def initialize(md,metad)
- @md,@metadata=md,metad
- l=SiSU_Env::StandardiseLanguage.new(@md.opt.lng).language
- language=l[:n]
- @tr=SiSU_Translate::Source.new(md,language)
- end
- def make_para(obj,ocn)
- h={ obj: obj, ocn: 0 }
- SiSU_DAL_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)
- end
- def metadata
- end
- end
-end
-__END__
diff --git a/lib/sisu/v5/dal_misc_arrange.rb b/lib/sisu/v5/dal_misc_arrange.rb
deleted file mode 100644
index e6cc72db..00000000
--- a/lib/sisu/v5/dal_misc_arrange.rb
+++ /dev/null
@@ -1,157 +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 .
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
-
-
-
-
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
-
-
-
- * Download:
-
-
- * Git
-
-
-
- * Ralph Amissah
-
-
-
- ** Description: system environment, resource control and configuration details
-
-=end
-module SiSU_DAL_MiscArrangeText
- class SI
- def initialize(md,data)
- @md,@data=md,data
- end
- def conditional_headings(para)
- para=para.gsub(/^(:?A~)\s*$/,'\1~ @title @author'). #conditional header
- gsub(/^((?:[1-9]|:?[A-C])~\S*)\s*$/,'\1~ [Note: heading marker::required title missing]~#') #conditional header for incorporated document 2004w12
- if para =~/^@\S+?:/
- para=para.gsub(/^@(\S+?):(\s+|$)/,"#{Mx[:meta_o]}\\1#{Mx[:meta_c]}\\2").
- gsub(/^@(\S+?):([+-])(\s+|$)/,"#{Mx[:meta_o]}\\1\\2#{Mx[:meta_c]}\\3")
- end
- para
- end
- def code_blocks(para)
- def ticks(para)
- block_open,block_close,text=nil,nil,nil
- if para =~/\A[`]{3}\s+.+?\n.+?\n[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*\Z/m
- block_open,text,block_close=/\A([`]{3}\s+.+?)\n(.+?)\n([`]{3}(\s+[~-][#]|\s+\~\{.+?\}\~)?)\s*\Z/m.match(para)[1..3]
- ((para=~/^[`]{3}\s+table(?:~h)?\s+/) \
- and (para !~/^[`]{3}\s+table(?:~h)?\s+c\d+/)) \
- ? para
- : (para=[]; para << block_open << text << block_close)
- elsif para =~/\A[`]{3}\s+.+?\n.*?\Z/m #look at, study
- block_open,text=/\A([`]{3}(?:\s+.+?))\n(.*?)\Z/m.match(para)[1,2]
- para=[]
- if not text.to_s.empty?
- para << block_open << text
- else
- para << block_open
- end
- elsif para =~/\A.+?\n[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*\Z/m
- text,block_close=/\A(.+?)\n([`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?)\s*\Z/m.match(para)[1,2]
- para=[]
- if not text.to_s.empty?
- para << text.to_s << block_close
- else
- para << block_close
- end
- else para
- end
- para
- end
- def curly_braces(para)
- block_open,block_close,text=nil,nil,nil
- para=if para =~/\A(?:code|poem|alt|group|block|table)\{ .+?\n.+?\n\}(?:code|poem|alt|group|block|table)(?: [~-][#])?\s*\Z/m
- block_open,text,block_close=/\A((?:code|poem|alt|group|block|table)\{ .+?)\n(.+?)\n(\}(?:code|poem|alt|group|block|table)(?: [~-][#])?)\s*\Z/m.match(para)[1..3]
- para=[]
- para << block_open << text << block_close
- elsif para =~/\A(?:code|poem|alt|group|block|table)\{ .+?\n.+?\Z/m
- block_open,text=/\A((?:code|poem|alt|group|block|table)\{ .+?)\n(.+?)\Z/m.match(para)[1,2]
- para=[]
- if not text.to_s.empty?
- para << block_open << text
- else
- para << block_open
- end
- elsif para =~/\A.+?\n\}(?:code|poem|alt|group|block|table)(?: [~-][#])?\s*\Z/m
- text,block_close=/\A(.+?)\n(\}(?:code|poem|alt|group|block|table)(?: [~-][#])?)\s*\Z/m.match(para)[1,2]
- para=[]
- if not text.to_s.empty?
- para << text.to_s << block_close
- else
- para << block_close
- end
- else para
- end
- para
- end
- para=para =~/^```/m \
- ? ticks(para)
- : para
- para=(para =~/^(?:code|poem|alt|group|block|table)\{|^\}(?:code|poem|alt|group|block|table)/m) \
- ? curly_braces(para)
- : para
- end
- def prepare_text
- data=@data
- data_new=[],[]
- if data[0] =~ /^#!\s*(?:\/usr\/bin\/env sisu|\/usr\/bin\/sisu)/ # remove bang from top #! (however file is stripped, so will be removed provided no content precedes it)
- data[0]=data[0].gsub(/^#!\s*\/usr\/bin\/sisu/,'').
- gsub(/^#!\s*\/usr\/bin\/env sisu/,'')
- end
- if data[0] =~ /^(SiSU\s+[\d.]*|sisu-[\d.]+)$/ # SiSU identifier
- data[0]=data[0].gsub(/^(SiSU\s*[\d.]*)$/,'% \1').
- gsub(/^(sisu-[\d.]+)$/,'% \1')
- end
- data.each do |para|
- para=conditional_headings(para)
- data_new << code_blocks(para)
- end
- data_new=data_new.flatten
- end
- end
-end
-__END__
diff --git a/lib/sisu/v5/dal_numbering.rb b/lib/sisu/v5/dal_numbering.rb
deleted file mode 100644
index 96f4134b..00000000
--- a/lib/sisu/v5/dal_numbering.rb
+++ /dev/null
@@ -1,486 +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 .
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
-
-
-
-
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
-
-
-
- * Download:
-
-
- * Git
-
-
-
- * Ralph Amissah
-
-
-
- ** Description: system environment, resource control and configuration details
-
-=end
-module SiSU_DAL_Numbering
- class Numbering
- attr_accessor :obj,:osp,:ocn,:lv,:name,:index,:comment
- def initialize(md,data)
- @md,@data=md,data
- @obj=@type=@ocn=@lv=@name=@index=@comment=nil
- end
- def numbering_song
- data=@data
- data=number_plaintext_para(data)
- data=auto_number_heading_ie_title(data.compact) #tr issue
- data=ocn(data.compact) #watch
- data=xml(data.compact)
- data=minor_numbering(data.compact)
- data,tags_map,ocn_html_seg_map=name_para_seg_filename(data)
- data=set_heading_top(data) unless @md.set_heading_top
- [data,tags_map,ocn_html_seg_map]
- end
- def number_plaintext_para(data)
- @tuned_file=[]
- data.each do |dob|
- if (dob.of !=:block \
- && dob.of !=:comment \
- && dob.of !=:layout) \
- && dob.ocn_ #and dob.obj !~ /#{Mx[:gr_o]}Th|#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}/ #FIX
- dob.obj=dob.obj.gsub(/(.+)\n/,'\1 ') #messy, but idea is that tables should retain breaks
- end
- unless dob.obj.is_a?(Array)
- dob.obj=dob.obj.gsub(/^\s+/,'').
- gsub(/\s$/,"\n")
- end
- @tuned_file << dob
- end
- @tuned_file=@tuned_file.flatten
- end
- def number_sub_heading(dob,num,title_no)
- unless dob.obj =~/\d+\.|(?:chapter|article|section|clause)\s+\d+/i #name selection arbitrary, fix
- dob.obj=case dob.name
- when /-/; dob.obj.gsub(/^/,"#{title_no} ")
- when /^#/; dob.obj.gsub(/^/,"#{title_no} ")
- when /^[a-z_\.]+/; dob.obj.gsub(/^/,"#{title_no} ")
- else
- dob.name=title_no if dob.name=~/^$/ #where title contains title number
- dob.obj.gsub(/^/,"#{title_no} ") if title_no =~/\d+/ #main, where title number is to be provided #watch changed placement
- end
- if @md.toc_lev_limit \
- and @md.toc_lev_limit < num
- dob.obj=dob.obj.gsub(/^/,'!_ ') #bold line, watch
- end
- end
- dob
- end
- def heading_tag_clean(heading_tag)
- heading_tag=heading_tag.gsub(/[ ]+/,'_').
- gsub(/["']/,'').
- gsub(/[\/]/,'-').
- gsub(/#{Mx[:fa_bold_o]}|#{Mx[:fa_bold_c]}/,'').
- gsub(/#{Mx[:fa_italics_o]}|#{Mx[:fa_italics_c]}/,'').
- gsub(/#{Mx[:fa_underscore_o]}|#{Mx[:fa_underscore_c]}/,'').
- gsub(/#{Mx[:fa_cite_o]}|#{Mx[:fa_cite_c]}/,'').
- gsub(/#{Mx[:fa_insert_o]}|#{Mx[:fa_insert_c]}/,'').
- gsub(/#{Mx[:fa_strike_o]}|#{Mx[:fa_strike_c]}/,'').
- gsub(/#{Mx[:fa_superscript_o]}|#{Mx[:fa_superscript_c]}/,'').
- gsub(/#{Mx[:fa_subscript_o]}|#{Mx[:fa_subscript_c]}/,'').
- gsub(/#{Mx[:fa_hilite_o]}|#{Mx[:fa_hilite_c]}/,'').
- gsub(/#{Mx[:gl_bullet]}/,'')
- end
- def auto_number_heading_ie_title(data) #also does some segment naming
- @tuned_file=[]
- if defined? @md.make.num_top \
- and @md.make.num_top \
- and @md.make.num_top !~/^$/
- input||=@md.make.num_top
- end
- num_top=(input ? input.to_i : nil)
- t_no1=t_no2=t_no3=0
- if num_top
- no1=num_top; no2=(num_top + 1); no3=(num_top + 2)
- end
- chapter_number_counter=0
- 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
- if dob.is ==:heading \
- && dob.autonum_ \
- and defined? @md.make.num_top \
- and @md.make.num_top !~/^$/
- if dob.lv=='1' \
- and dob.obj =~/^#\s|\s#(?:\s|$)/
- chapter_number_counter +=1
- dob.obj=dob.obj.gsub(/^#\s/,"#{chapter_number_counter} ").
- gsub(/#([:,]?\s|[.]?$)/,"#{chapter_number_counter}\\1")
- end
- if dob.ln==no1
- @subnumber=1
- @subnumber=0 if dob.ln==no1
- end
- if dob.ln.to_s =~/^[1-6]/ \
- and not dob.toc_ \
- and dob.obj !~/#{Mx[:fa_o]}(?:~#|-#)#{Mx[:fa_c]}/ # <-- fix
- if dob.ln==no1
- t_no1+=1; t_no2=0; t_no3=0
- title_no="#{t_no1}"
- if @md.seg_names.is_a?(Array) \
- and not @md.seg_names.include?(title_no)
- if dob.ln==no1
- dob.name="#{title_no}" if not dob.name
- dob.tags=[title_no,dob.tags].flatten if title_no !~/^\d+$/ #check whether will work across file types with stop signs
- tag=dob.obj.gsub(/(Article|Clause|Section|Chapter)\s+/,"\\1_#{title_no}").downcase
- tag=heading_tag_clean(tag)
- dob.tags=[tag,dob.tags].flatten if tag !~/^\d+$/ #check whether will work across file types with stop signs
- dob.obj=(dob.obj =~/(Article|Clause|Section)\s+/) \
- ? (dob.obj.gsub(/(Article|Clause|Section)\s+/,"\\1 #{title_no} "))
- : (dob.obj.gsub(/^/,"#{title_no}. ")) #fix stop later
- end
- if dob.ln !=no1 \
- and dob.obj =~/^[\d.]+\s/ #fix -> if the title starts with a numbering scheme, do not auto-number, review
- dob.name ="#{title_no}" if not dob.name
- dob.tags=[title_no,dob.tags].flatten if title_no !~/^\d+$/ #check whether will work across file types with stop signs
- dob.obj=dob.obj.gsub(/^/,"#{title_no}. ")
- end
- @md.seg_names << title_no
- end
- if dob.ln!=no1 \
- and dob.name!~/^[a-z_\.]+$/ \
- and dob.obj !~/[A-Z]\.?\s/ #bug -> tmp fix, excludes A. B. C. lettering, but not roman numerals, is arbitrary, review required # not fixed, work on
- dob.tags=[title_no,dob.tags].flatten if title_no !~/^\d+$/ #check whether will work across file types with stop signs
- dob.obj=dob.obj.gsub(/^/i,"#{title_no}. ")
- end
- end
- if dob.ln==no1 #watch because here you change dob.name
- dob.tags=["h#{title_no}",dob.tags].flatten #check whether will work across file types with stop signs
- end
- if dob.ln==no2 #watch because here you change dob.name
- t_no2+=1; t_no3=0
- title_no="#{t_no1}.#{t_no2}"
- dob.tags=["h#{title_no}",dob.tags].flatten #check whether will work across file types with stop signs
- dob=number_sub_heading(dob,no2,title_no)
- end
- if dob.ln==no3 #watch because here you change dob.name
- t_no3+=1
- title_no="#{t_no1}.#{t_no2}.#{t_no3}"
- dob.tags=["h#{title_no}",dob.tags].flatten #check whether will work across file types with stop signs
- dob=number_sub_heading(dob,no3,title_no)
- end
- elsif dob.ln.to_s =~/^[1-6]/ \
- and dob.name =~ /^[\w-]+-/ # endnotes, watch2005# endnotes, watch2005
- dob.tags=[dob.name,dob.tags].flatten if dob.name !~/^\d+$/ #check whether will work across file types with stop signs
- dob.name.gsub(/^([a-z_\.]+)-$/,'\1')
- end
- elsif dob.is ==:heading \
- and dob.autonum_ \
- and @md.markup =~/num_extract/ #AS DANGEROUS force enable with document, note already does this type of numbering for cisg, locate and coordinate logic, is currently misplaced in code, chengwei inspired 2004w23/4
- #here lies a bug, as is nil when run from -Dv --update, FIX
- if (dob.name.nil? or dob.name.empty?) \
- and dob.ln.to_s =~/^[1-9]/ \
- and dob.obj =~ /^([\d\.]+)/ #risky (must be unique) consider output to 4~~\d instead of 4~\d
- dob.name=$1
- dob.tags=[dob.name,dob.tags].flatten if dob.name !~/^\d+$/ #check whether will work across file types with stop signs
- end
- if @md.toc_lev_limit
- end
- elsif defined? dob.name \
- and dob.name
- dob.tags=[dob.name,dob.tags].flatten if dob.name !~/^\d+$/ #check whether will work across file types with stop signs
- end
- dob.tags=dob.tags.uniq if defined? dob.tags
- @tuned_file << dob
- end
- @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
- end
- def xml(data)
- @tuned_file=SiSU_DAL_DocumentStructureExtract::XML.new(@md,data).dom
- @tuned_file
- end
- def minor_numbering(data) #and auto segment numbering increment
- @tuned_file=[]
- number_small,letter_small=0,0
- letter=%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 )
- data.each do |dob|
- if dob.of ==:heading \
- || dob.of ==:heading_insert \
- || dob.of ==:para \
- || dob.of ==:block
- if dob.is ==:heading \
- and dob.ln.to_s=~/^[1-9]/ #% sub-number system, (baby numbering) reset with any change of major number (more obviously should be placed in number titles, but that is conditionally executed, check and move later)
- number_small,letter_small=0,0
- elsif dob.is ==:para
- if dob.obj =~/^#[ 1]/ \
- and dob.obj !~/^#\s+(?:~#)?$/
- letter_small=0
- number_small=0 if dob.obj =~ /^#1/
- number_small+=1
- dob.obj=dob.obj.gsub(/^#[ 1]/,"#{number_small}. ")
- end
- if dob.obj =~/^_# /
- dob.obj=dob.obj.gsub(/^_# /,"#{letter[letter_small]}. ")
- dob.indent='1'
- letter_small+=1
- end
- end
- end
- @tuned_file << dob
- end
- @tuned_file=@tuned_file.flatten
- end
- def name_para_seg_filename(data) #segment naming, remaining
- # paragraph name/numbering rules
- # manual naming overrides, manual naming may be
- # alpha-numeric characters mixed,
- # numeric only (a number), if
- # all segments have been named,
- # the numbers used are over 1000 or
- # it is not minded that auto-numbering uses a funny scheme for naming segments (not yet implemented)
- # [for now a warning is printed for such documents on use of maintenance or very-verbose flag]
- # auto-naming takes the form of giving numbers to segments
- # the rules for which are as follows
- # if the title/heading text starts with a numeric, then that is used (1 3.1 3rd etc.)
- # otherwise the level 4 segment number from the embedded document structure info is used
- # if there is none a sequential number is designated, preceded by an underscore
- @tuned_file,@unique_auto_name=[],[]
- tags={}
- art_filename_auto=1
- @counter=1
- if not @md.seg_autoname_safe \
- and (@md.opt.act[:verbose_plus][:set]==:on \
- || @md.opt.act[:maintenance][:set]==:on)
- puts 'manual segment names, numbers used as names, risk warning (segmented html)'
- end
- ocn_html_seg=[]
- data.each do |dob|
- if dob.is==:heading \
- && dob.ln \
- and dob.ln.to_s =~/^[456]/
- if dob.ln==4 \
- and not dob.name \
- and not @md.set_heading_seg
- @md.set_heading_seg=true
- end
- if dob.name !~/^\S+/ \
- and dob.obj =~/^\s*(?:\S+\s+)?([\d.,:-]+)/m #heading starts with a recognised numeric or word followed by a recognised numerical construct, use that as name
- possible_seg_name=$1
- possible_seg_name=possible_seg_name.gsub(/(?:[:,-]|\W)/,'.').
- gsub(/\.$/,'')
- if @md.seg_names.is_a?(Array) \
- and not @md.seg_names.include?(possible_seg_name)
- dob.name=possible_seg_name
- dob.tags=[dob.name,dob.tags].flatten if dob.name !~/^\d+$/
- @md.seg_names << possible_seg_name
- elsif (@md.opt.act[:verbose_plus][:set]==:on \
- or @md.opt.act[:maintenance][:set]==:on)
- puts 'warn, there may be a conflicting numbering scheme'
- end
- end
- if dob.ln==4 \
- and dob.name #extract segment name from embedded document structure info
- if @md.seg_names.is_a?(Array) \
- and not @md.seg_names.include?(dob.name)
- dob.tags=[dob.name,dob.tags].flatten if dob.name !~/^\d+$/
- @md.seg_names << dob.name
- end
- end
- if dob.ln==4 \
- and not dob.name #if still no segment name, provide a numerical one
- pf='_' #pg='' #may use e.g. '' or '~' or '_'
- segn_auto="#{pf}#{art_filename_auto.to_s}"
- if @md.seg_names.is_a?(Array) \
- and not @md.seg_names.include?(segn_auto)
- dob.name=segn_auto
- dob.tags=[dob.name,dob.tags].flatten if dob.name !~/^\d+$/ #check whether will work across file types with stop signs
- @md.seg_names << segn_auto
- else puts 'segment name (numbering) error'
- end
- art_filename_auto+=1
- end
- if dob.ln==4 \
- and not dob.name #should not occur
- puts "e r r o r -\t#{__FILE__}::#{__LINE__}\n#{dob.inspect}"
- end
- end
- if (dob.is ==:heading \
- || dob.is ==:heading_insert) \
- && dob.ln==4
- @seg=dob.name
- end
- @tuned_file << if dob.is==:heading \
- && (@md.pagenew || @md.pagebreak || @md.pageline)
- 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
- elsif @md.pagebreak.inspect =~/#{m}/
- dob_tmp << SiSU_DAL_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
- end
- unless dob_tmp.length > 0; dob
- else dob_tmp
- end
- else dob
- end
- if defined? dob.ocn \
- and dob.ocn
- @segname=((dob.is==:heading || dob.is==:heading_insert) && dob.ln==4 && (defined? dob.name)) \
- ? (dob.name)
- : @segname
- tags["#{dob.ocn}"]={ segname: @segname }
- ocn_html_seg[dob.ocn]=if (dob.is==:heading || dob.is==:heading_insert)
- if dob.ln =~/[1-3]/
- { seg: nil, level: dob.ln }
- else #elsif dob.ln =~/[4-6]/
- { seg: @seg, level: dob.ln }
- end
- else
- { seg: @seg, level: nil }
- end
- end
- dob.tags=dob.tags.uniq if defined? dob.tags
- if defined? dob.tags \
- and dob.tags.length > 0
- #@segname=((dob.is=='heading'|| dob.is=='heading_insert') && dob.ln==4 && (defined? dob.name)) \
- #? (dob.name) \
- #: @segname
- dob.tags.each do |y|
- tags[y]={ ocn: dob.ocn.to_s, segname: @segname }
- end
- end
- dob
- end
- ocn_html_seg.each_with_index do |ocn,i|
- if ocn \
- and ocn[:level].to_s=~/[1-3]/
- (1..4).each do |x|
- if ocn_html_seg[i+x] and ocn_html_seg[i+x][:level]==4
- ocn[:seg]=ocn_html_seg[i+x][:seg]
- end
- end
- end
- end
- if @md.seg_names.length > 0
- @md.set_heading_seg=true
- end
- tuned_file=@tuned_file.flatten
- [tuned_file,tags,ocn_html_seg]
- end
- def set_heading_top(data) #% make sure no false positives
- unless @md.set_heading_top
- if (@md.opt.act[:verbose_plus][:set]==:on \
- or @md.opt.act[:maintenance][:set]==:on)
- puts "\tdocument contains no top level heading, (will have to manufacture one)"
- end
- @tuned_file=[]
- data.each do |t_o|
- unless @md.set_heading_top
- if t_o !~/^(?:#{Rx[:meta]}|@\S+:)\s/m \
- and t_o !~/\A\s*\Z/m
- @md.set_heading_top=true
- if defined? @md.title \
- and @md.title \
- and defined? @md.title.full \
- and defined? @md.creator \
- and @md.creator
- head=@md.title.main ? ([@lv='1',@obj=@md.title.main]) : ([@lv='1',@obj='[no title provided]'])
- @tuned_file << head
- end
- end
- end
- @tuned_file << t_o
- end
- @tuned_file=@tuned_file.flatten
- end
- end
- def set_heading_seg(data) #% make sure no false positives
- unless @md.set_heading_seg
- if (@md.opt.act[:verbose_plus][:set]==:on \
- or @md.opt.act[:maintenance][:set]==:on)
- puts "\tdocument contains no segment level, (will have to manufacture one)"
- end
- @tuned_file=[]
- data.each do |dob|
- unless @md.set_heading_seg
- if defined? dob.ln and dob.ln.to_s !~/^[123]/m \
- and dob.obj !~/\A\s*\Z/m \
- and dob.is !=:layout
- @md.set_heading_seg=true
- head=@md.title.main \
- ? (dob.ln,dob.name,dob.obj=4,'seg',@md.title.main)
- : (dob.ln,dob.name,dob.obj=4,'seg','[segment]')
- @tuned_file << head
- end
- end
- @tuned_file << dob
- end
- @tuned_file=@tuned_file.flatten
- end
- end
- def set_header_title(data) #% make sure no false positives
- unless @md.set_header_title
- if (@md.opt.act[:verbose_plus][:set]==:on \
- or @md.opt.act[:maintenance][:set]==:on)
- puts "\t no document title provided, (will have to manufacture one)"
- end
- @tuned_file=[]
- data.each do |t_o|
- unless @md.set_header_title
- if t_o !~/^%{1,2}\s/m \
- and t_o !~/\A\s*\Z/m
- @tuned_file << "#{Mx[:meta_o]}title#{Mx[:meta_c]} #{@md.heading_seg_first}"
- @md.title.main=@md.heading_seg_first
- @md.set_header_title=true
- end
- end
- @tuned_file << t_o
- end
- @tuned_file=@tuned_file.flatten
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/v5/dal_syntax.rb b/lib/sisu/v5/dal_syntax.rb
deleted file mode 100644
index 1e1d8542..00000000
--- a/lib/sisu/v5/dal_syntax.rb
+++ /dev/null
@@ -1,631 +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 .
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
-
-
-
-
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
-
-
-
- * Download:
-
-
- * Git
-
-
-
- * Ralph Amissah
-
-
-
- ** Description: Syntax for markup, input markup syntaxes, determined here
-
-=end
-module SiSU_DAL_Syntax
- class Words
- def initialize(line,md,mkp)
- @line,@md,@mkp=line,md,mkp
- end
- end
- class Markup
- def initialize(md='',data='')
- @md,@data=md,data
- @vz=SiSU_Viz::Defaults.new
- @data_new=[]
- url_and_stub=SiSU_Env::InfoEnv.new.url
- @output_url="#{url_and_stub.remote}"
- @env=SiSU_Env::InfoEnv.new
- emph_set=if defined? @md.emphasis_set_to \
- and not @md.emphasis_set_to.nil?
- @md.emphasis_set_to
- else @env.markup_emphasis
- end
- @emph=case emph_set
- when /bold/
- emph_italics=false
- { o: Mx[:fa_bold_o], c: Mx[:fa_bold_c] }
- when /italics/
- emph_italics=true
- { o: Mx[:fa_italics_o], c: Mx[:fa_italics_c] }
- when /underscore/
- emph_italics=false
- { o: Mx[:fa_underscore_o], c: Mx[:fa_underscore_c] }
- else p __LINE__.to_s + '::' + __FILE__
- end
- @http_m=%r{\{.+?\}https?://\S+|https?:\S+|:\S+|\.\.\/\S+|#\S+|\S+?\.png\b|[*]~\S+|^#{Mx[:meta_o]}.+|#{Mx[:gr_o]}(?:code|block|group|alt|verse)(?:-end)?#{Mx[:gr_c]}|#{Mx[:fa_o]}:br#{Mx[:fa_c]}}
- @manmkp_ital=emph_italics \
- ? '[i/*]\\{.+?\\}[i/*]'
- : '[i/]\\{.+?\\}[i/]'
- tail_m_ital=%q{(?:\s|[.,;:?!'")]|~\^|~\\\{\s|$)}
- tail_m_bold=%{(?:(?:#{Mx[:fa_italics_c]})?(?:\s|[.,;:?!'")]|~\^|~\\\{\s|$))?}
- bold_line=%{^!_\s.+?(?:#{Mx[:br_line]}|\n|$)}
- #ital_line=%{^/_\s.+?(?:#{Mx[:br_line]}|\n|$)} #not implemented
- @line_scan_ital=if defined? @md.italics_match_list[:str]
- /#{@http_m}|#{bold_line}|#{@manmkp_ital}#{tail_m_ital}|#{@md.italics_match_list[:str]}#{tail_m_ital}|\S+|\n/i
- elsif defined? @vz.markup_make_italic[:str]
- /#{@http_m}|#{bold_line}|#{@manmkp_ital}#{tail_m_ital}|#{@vz.markup_make_italic[:str]}#{tail_m_ital}|\S+|\n/i
- end
- @manmkp_bold=emph_italics \
- ? '^!_\s.+?(?:\n|$)|[!b]\\{.+?\\}[*!b]|[*!][a-zA-Z0-9\-_]+[!]'
- : '^!_\s.+?(?:\n|$)|[*!b]\\{.+?\\}[*!b]|[*!][a-zA-Z0-9\-_]+[*!]'
- @line_scan_bold=if (defined? @md.bold_match_list[:str] \
- and @md.bold_match_list[:str]) \
- and (defined? @vz.markup_make_bold[:str] \
- and @vz.markup_make_bold[:str])
- /#{@http_m}|#{bold_line}|(?:#{@manmkp_bold}|#{@md.bold_match_list[:str]}|#{@vz.markup_make_bold[:str]})#{tail_m_bold}|\S+|\n/i
- elsif defined? @md.bold_match_list[:str] \
- and @md.bold_match_list[:str]
- /#{@http_m}|#{bold_line}|(?:#{@manmkp_bold}|#{@md.bold_match_list[:str]})#{tail_m_bold}|\S+|\n/i
- elsif defined? @vz.markup_make_bold[:str] \
- and @vz.markup_make_bold[:str]
- /#{@http_m}|#{bold_line}|(?:#{@manmkp_bold}|#{@vz.markup_make_bold[:str]})#{tail_m_bold}|\S+|\n/i
- end
- end
- def songsheet
- @data=@data.compact
- @data.each do |dob|
- dob=breaks(dob)
- dob=if @md.sem_tag then sem(dob) else dob end #revisit
- dob=line_actions(dob)
- dob=paragraph_set(dob)
- dob=substitutions(dob)
- dob=wordlist_italics(dob)
- dob=wordlist_bold(dob)
- dob=bodymarkup(dob)
- @data_new << dob unless dob.nil?
- end
- @data_new
- end
- def sem(dob) #revisit
- dob=SiSU_Sem::Tags.new(dob,@md).rm.all
- end
- def breaks(dob)
- if dob.is !=:meta \
- && dob.is !=:comment \
- && dob.is !=:code \
- && dob.is !=:table
- dob.obj=dob.obj.gsub(/^-\\\\-\s*$/,"#{Mx[:br_page]}").
- gsub(/^=\\\\=\s*$/,"#{Mx[:br_page_new]}").
- gsub(/ \\\\(?: |$)/,"#{Mx[:br_line]}").
- gsub(/(?:<:?pb>)/,"#{Mx[:br_page]}"). # depreciated
- gsub(/(?:<:?pn>)/,"#{Mx[:br_page_new]}"). # depreciated
- gsub(/(?:<:?br>| )/,"#{Mx[:br_line]}"). # depreciated
- gsub(/(?:^-\.\.-\s*$)/,"#{Mx[:br_page_line]}")
- end
- dob
- end
- def wordlist_italics(dob)
- dob=dob.dup
- if (defined? @md.italics_match_list[:str] \
- and @md.italics_match_list[:str]) \
- or (defined? @vz.markup_make_italic[:str] \
- and @vz.markup_make_italic[:str])
- dob.obj=if dob.is !=:meta \
- && dob.is !=:heading \
- && dob.is !=:heading_insert \
- && dob.is !=:code \
- && dob.is !=:comment
- word=dob.obj.scan(@line_scan_ital)
- word=word.flatten.compact
- line_array=[]
- word.each do |w|
- unless /#{@manmkp_ital}|#{@http_m}/.match(w)
- if defined? @md.italics_match_list[:regx] \
- and @md.italics_match_list[:regx]
- w=w.gsub(@md.italics_match_list[:regx],
- "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}")
- elsif defined? @vz.markup_make_italic \
- and @vz.markup_make_italic
- w=w.gsub(@vz.markup_make_italic,
- "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}")
- else w
- end
- end
- line_array << w
- end
- line_array.join(' ')
- else dob.obj
- end
- end
- dob
- end
- def embolden(given)
- given=given.gsub(/^!_\s+((?:\{|#{Mx[:lnk_o]})(?:~^ )?.+?(?:\}|#{Mx[:lnk_o]})https?:\/\/\S+.*?)([#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/,
- "#{Mx[:fa_bold_o]} \\1 #{Mx[:fa_bold_c]}\\2").
- gsub(/^!_\s+((?:\{|#{Mx[:lnk_o]})(?:~^ )?.+?(?:\}|#{Mx[:lnk_o]})https?:\/\/\S+.*)/,
- "#{Mx[:fa_bold_o]} \\1 #{Mx[:fa_bold_c]}").
- gsub(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)([#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/,
- "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2").
- gsub(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)\s+((?:[*]~\S+\s*)+)/,
- "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2").
- gsub(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)\s*([~-]#)$/,
- "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2").
- gsub(/(?:^!_\s+|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]}\s*)(.*)?\s*$/,
- "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}")
- end
- def italicise(given)
- given=given.gsub(/^\/_\s*(.+?)([#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/,
- "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2").
- gsub(/^\/_\s*(.+?)\s+((?:[*]~\S+\s*)+)/,
- "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2").
- gsub(/^\/_\s*(.+?)\s*([~-]#)$/,
- "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2").
- gsub(/^\/_\s+(.*)?\s*$/,
- "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}")
- end
- def line_actions(dob)
- dob.obj=if (dob.is !=:heading \
- && dob.is !=:heading_insert \
- && dob.is !=:comment \
- && dob.is !=:meta) \
- and dob.obj =~ /^!_\s+/
- embolden(dob.obj)
- elsif dob.obj =~ /^\/_\s+/
- italicise(dob.obj)
- else dob.obj
- end
- dob
- end
- def paragraph_set(dob)
- dob.obj=if dob.is !=:meta \
- && dob.is !=:heading \
- && dob.is !=:heading_insert \
- && dob.is !=:code \
- && dob.is !=:comment \
- && dob.is !=:table
- dob.obj.gsub(/\n/m,' ').
- gsub(/ \s+/m,' ')
- else dob.obj
- end
- dob
- end
- def substitutions(dob)
- dob=dob.dup
- dob=if defined? @md.substitution_match_list[:match_and_replace] \
- and @md.substitution_match_list[:match_and_replace].is_a?(Array)
- dob=if dob.is !=:meta \
- && dob.is !=:heading_insert \
- && dob.is !=:code \
- && dob.is !=:comment \
- && dob.is !=:table
- if dob.obj =~/#{@md.substitution_match_list[:matches]}/
- @md.substitution_match_list[:match_and_replace].each do |x|
- dob.obj=if x[:case_s]==:i
- dob.obj.gsub(/#{x[:match]}/mi,x[:replace])
- else
- dob.obj.gsub(/#{x[:match]}/m,x[:replace])
- end
- end
- end
- dob
- else dob
- end
- dob
- else dob
- end
- end
- def wordlist_bold(dob)
- dob=dob.dup
- if (defined? @md.bold_match_list[:str] \
- and @md.bold_match_list[:str]) \
- or (defined? @vz.markup_make_bold[:str] \
- and @vz.markup_make_bold[:str])
- dob.obj=if dob.is !=:meta \
- && dob.is !=:heading \
- && dob.is !=:heading_insert \
- && dob.is !=:code \
- && dob.is !=:comment \
- && dob.is !=:table
- line_array=[]
- word=dob.obj.scan(@line_scan_bold)
- word=word.flatten.compact
- word.each do |w|
- unless /#{@manmkp_bold}|#{@http_m}/.match(w)
- if defined? @md.bold_match_list[:regx] \
- and @md.bold_match_list[:regx] #document header: @bold: [bold word list]
- w=w.gsub(@md.bold_match_list[:regx],"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}")
- elsif defined? @vz.markup_make_bold \
- and @vz.markup_make_bold #defaults adjusted bold word list
- w=w.gsub(@vz.markup_make_bold,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}")
- end
- else
- w=if w =~ /(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s+/
- embolden(w) #bold paragraph/emphasize #may wish to remove think about 7{ 8{ conversion not satisfactory, as information is lost!
- elsif w =~/^\/_\s+/
- italicise(w)
- else w
- end
- end
- line_array << w
- end
- line_array.join(' ')
- else dob.obj
- end
- else
- dob.obj=if dob.is==:heading \
- and dob.ln.to_s =~/[7-9]/
- embolden(dob.obj)
- else dob.obj
- end
- end
- dob
- end
- def fontface_lines(dob,leader)
- while (dob.obj =~/#{Mx[:br_nl]}/ \
- and dob.obj =~/(?:#{leader})([*!\/_#])\{(.+?)\}\1/m) \
- and $2 =~/#{Mx[:br_nl]}/
- dob=if dob.obj =~/#{Mx[:br_nl]}/ \
- and dob.obj =~/(#{leader})([*!\/_#])\{(.+?)\}\2/m
- lead,fce,txt=$1,$2,$3
- dob=if txt =~/#{Mx[:br_nl]}/
- lead_break=if dob.obj =~/^#{Mx[:br_nl]}/
- dob.obj=dob.obj.sub(/^#{Mx[:br_nl]}/,'')
- Mx[:br_nl]
- else ''
- end
- txt="#{lead_break}#{fce}\{" + txt.split(Mx[:br_nl]).join("\}#{fce}#{Mx[:br_nl]}#{fce}\{") + "\}#{fce}"
- dob.obj=dob.obj.sub(/(?:^|#{Mx[:gl_c]}|\s+|['"]|[#{Mx[:nbsp]}#{Mx[:fa_o_c]}#{Mx[:fa_c]}#{Mx[:lnk_o]}#{Mx[:br_nl]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:tc_c]}#{Mx[:tc_p]}]|[\(\[\{]|\>)([*!\/_#])\{.+?\}\1/m,"#{lead}#{txt}")
- dob
- else dob
- end
- end
- dob
- end
- dob
- end
- def fontface(dob)
- leader=/^|#{Mx[:gl_c]}|\s+|['"]|[#{Mx[:nbsp]}#{Mx[:fa_o_c]}#{Mx[:fa_c]}#{Mx[:lnk_o]}#{Mx[:br_nl]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:tc_c]}#{Mx[:tc_p]}]|[\(\[\{]|[、。]|\>/
- dob=fontface_lines(dob,leader)
- dob.obj=dob.obj.gsub(/(#{leader})\*\{(.+?)\}\*/m,
- "\\1#{@emph[:o]}\\2#{@emph[:c]}"). #emphasis
- gsub(/(#{leader})!\{(.+?)\}!/m,
- "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}"). #bold
- gsub(/(#{leader})\/\{(.+?)\}\//m,
- "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}"). #italics
- gsub(/(#{leader})_\{(.+?)\}_/m,
- "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}"). #underscore
- gsub(/(#{leader})#\{(.+?)\}#/m,
- "\\1#{Mx[:fa_monospace_o]}\\2#{Mx[:fa_monospace_c]}"). #monospace
- gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|[#{Mx[:nbsp]}#{Mx[:fa_o_c]}#{Mx[:fa_c]}]|\(|\>)\"\{(.+?)\}\"/m,
- "\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}"). #cite /blockquote?
- gsub(/(^|[^\\])\^\{(.+?)\}\^/m,
- "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}"). #superscript
- gsub(/(^|[^\\]),\{(.+?)\},/m,
- "\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}"). #subscript
- gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\+\{(.+?)\}\+/m,
- "\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}"). #inserted text
- gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)-\{(.+?)\}-/m,
- "\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}"). #strikethrough - deleted text
- gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>|\d+)\^(\S+?)\^/,
- "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") #superscript single word, watch digit added
- dob
- end
- def bodymarkup(dob)
- # << http://www.jus.uio.no/sisu/sisu_markup_table/markup >>
- # See: data/sisu/sample/document_samples_sisu_markup/
- ## fontface
- # *{emphasis}* e{emphasis}e emphasis
- # !{bold text}! b{bold}b bold text
- # _{underline}_ u{underline}u underline
- # /{italics}/ i{italics}i italics
- # "{citation}" c{citation}c citation #blockquote?
- # ^{superscript}^ superscript
- # ,{subscript}, subscript
- # +{inserted text}+ inserted text
- # -{deleted text}- deleted text
- # #{monospace text}#
- #
- # {url address}:url
- # {image.png}imageurl
- # {image.png}png
- # ~{endnote}~
- # !_ #bold/emphasise paragraph
- # _" #blockquote paragraph
- # _1 <:i1> #indent paragraph 1 step
- # _2 <:i2> #indent paragraph 2 steps
- # _3 <:i3> #indent paragraph 3 steps
- # _4 <:i4> #indent paragraph 4 steps
- # _* #bullet (list) ●
- # _1* #bullet (list) indented
- # _1* #bullet (list) indented
- # # #numbered (list) level 1
- # _# #numbered (list) level 2
- dob=dob.dup
- if dob.is !=:meta \
- && dob.is !=:comment \
- && dob.is !=:code \
- && dob.is !=:table
- line_array=[]
- word=dob.obj.scan(/\S+|\n/) #unless line =~/^(?:#{Mx[:meta_o]}|%+\s)/ #visit
- if word
- word.each do |w| # _ - / # | : ! ^ ~
- unless w =~/~\{|\}~|~\[|\]~|^\^~|~\^|\*~\S+|~#|\{t?~|\{table|https?:\/\/\S+/ # do something earlier about table!!
- w=w.gsub(/\\?~/,"#{Mx[:gl_o]}#126#{Mx[:gl_c]}") #escaped special character
- end
- w=w.gsub(/^\<$/,"#{Mx[:gl_o]}#lt#{Mx[:gl_c]}").gsub(/^\>$/,"#{Mx[:gl_o]}#gt#{Mx[:gl_c]}") #escaped special character
- line_array << w
- end
- dob.obj=line_array.join(' ')
- dob.obj=dob.obj.strip
- end
- dob.obj=dob.obj.gsub(/^([*#-.]{1,12})$/,'\1 ~#'). #ocn off for these paragraph separators
- gsub(/~\{(.+?)\}~/m,Mx[:en_a_o] + '\1' + Mx[:en_a_c]).
- gsub(/~\[([^*+].+?)\]~/m,Mx[:en_b_o] + '* \1' + Mx[:en_b_c]). #default if markup does not specify
- gsub(/~\[(.+?)\]~/m,Mx[:en_b_o] + '\1' + Mx[:en_b_c])
- if dob.is ==:heading \
- and dob.ln ==1
- dob.obj=dob.obj.gsub(/\s*@title\b/," #{@md.title.full}")
- dob.obj=if defined? @md.creator.author \
- and @md.creator.author
- dob.obj.gsub(/\s+(?:@creator|@author)/,",#{Mx[:br_line]}#{@md.creator.author}")
- else dob.obj.gsub(/\s+(?:@creator|@author)/,'')
- end
- end
- if defined? @md.title \
- and @md.title \
- and defined? @md.title.full \
- and defined? @md.creator \
- and @md.creator
- if dob.is ==:heading
- dob.obj=dob.obj.gsub(/^\s*@title\s*$/,@md.title.full) if dob.lv =~/1/
- dob.obj=if dob.lv =~/[23]/ \
- and defined? @md.creator.author \
- and @md.creator.author
- dob.obj.gsub(/^\s*(?:(by\s+)?(?:@creator|@author))\s*$/,"\\1#{@md.creator.author}")
- else dob.obj.gsub(/^\s*(?:(by\s+)?(?:@creator|@author))\s*$/,'\1')
- end
- end
- end
- dob.obj=dob.obj.gsub(/<(https?:\/\/\S+?)>/,'< \1 >'). #catch problem markup
- gsub(/<:=(\S+?)>/,'{ c_\1.png 14x14 }image').
- gsub(//,'<:\1>'). #escaped special character
- gsub(/ /,"#{Mx[:nbsp]}"). #escaped special character
- gsub(/\\~/,"#{Mx[:gl_o]}#126#{Mx[:gl_c]}"). #escaped special character
- gsub(/\\\{/,"#{Mx[:gl_o]}#123#{Mx[:gl_c]}"). #escaped special character
- gsub(/\\\}/,"#{Mx[:gl_o]}#125#{Mx[:gl_c]}"). #escaped special character
- gsub(/\\\<,"#{Mx[:gl_o]}#lt#{Mx[:gl_c]}#{Mx[:gl_o]}#lt#{Mx[:gl_c]}"). #escaped special character
- gsub(/\\\>>/,"#{Mx[:gl_o]}#gt#{Mx[:gl_c]}#{Mx[:gl_o]}#gt#{Mx[:gl_c]}"). #escaped special character
- gsub(/\\\,"#{Mx[:gl_o]}#lt#{Mx[:gl_c]}"). #escaped special character
- gsub(/\\\>/,"#{Mx[:gl_o]}#gt#{Mx[:gl_c]}"). #escaped special character
- gsub(/\\\_/,"#{Mx[:gl_o]}#095#{Mx[:gl_c]}"). #escaped special character
- gsub(/\\\-/,"#{Mx[:gl_o]}#045#{Mx[:gl_c]}"). #escaped special character
- gsub(/\\\+/,"#{Mx[:gl_o]}#043#{Mx[:gl_c]}"). #escaped special character
- gsub(/\\\//,"#{Mx[:gl_o]}#047#{Mx[:gl_c]}"). #escaped special character
- gsub(/\\\#/,"#{Mx[:gl_o]}#035#{Mx[:gl_c]}"). #escaped special character
- gsub(/\\\&/,"#{Mx[:gl_o]}#038#{Mx[:gl_c]}"). #& #escaped special character
- gsub(/\\\|/,"#{Mx[:gl_o]}#124#{Mx[:gl_c]}"). #not really a sisu special character but made available as possibility
- gsub(/\\\:/,"#{Mx[:gl_o]}#058#{Mx[:gl_c]}"). #not really a sisu special character but made available as possibility
- gsub(/\\\!/,"#{Mx[:gl_o]}#033#{Mx[:gl_c]}"). #not really a sisu special character but made available as possibility
- gsub(/\\\^/,"#{Mx[:gl_o]}#094#{Mx[:gl_c]}"). #not really a sisu special character but made available as possibility
- gsub(/\\\,/,"#{Mx[:gl_o]}#044#{Mx[:gl_c]}"). #not really a sisu special character but made available as possibility
- gsub(/\\\\/,"#{Mx[:gl_o]}#092#{Mx[:gl_c]}"). #escaped special character
- gsub(/\\\*/,"#{Mx[:gl_o]}#042#{Mx[:gl_c]}"). #escaped special character
- gsub(/\\\!/,"#{Mx[:gl_o]}#033#{Mx[:gl_c]}") #escaped special character
- if dob.obj=~/(?:https?:|ftp:|\{([^{}]+?)\}(?:#|:|[.]{1,2}\/))\S+/m
- if dob.obj=~/(?:^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ (?:.+?)\s*\}(?:(?:https?:|ftp:|:|[.]{1,2}\/)\S+?)\s*#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/m
- dob.obj=dob.obj.gsub(/(^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ ([^}]+?)\s*\}((?:https?:|ftp:|:|[.]{1,2}\/)\S+?)\s*#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/m,
- "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3 #{Mx[:en_a_o]}\\3 \\4#{Mx[:en_a_c]}") # watch
- end
- if dob.obj=~/(?:^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ (?:.+?)\s*\}(?:(?:https?:|ftp:|:|[.]{1,2}\/)\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m
- dob.obj=dob.obj.gsub(/(^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ (.+?)\s*\}((?:https?:|ftp:|:|[.]{1,2}\/)\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m,
- "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3\\4 #{Mx[:en_a_o]}\\3#{Mx[:en_a_c]} ")
- end
- dob.obj=dob.obj.gsub(/(^|[^#])\{\s*([^{}]+?)\s*\}((?:https?:|:|[.]{2}\/|#)\S+?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/,
- "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3"). #linked (text or image, however text cannot include modified face, e.g. bold, ital, underline)
- gsub(/(^|[#{Mx[:gl_c]}#{Mx[:lnk_c]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}(\s])((?:https?|ftp):\/\/\S+?\.[^>< ]+?)([,.;'"]?)(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m,
- %{\\1#{Mx[:url_o]}\\2#{Mx[:url_c]}\\3}).
- gsub(/#{Mx[:lnk_c]}#(\S+?[^>< ]+?)([()\[\]]*[,.;:!?'"]{0,2})(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m,
- %{#{Mx[:lnk_c]}#{Mx[:rel_o]}\\1#{Mx[:rel_c]}\\2}).
- gsub(/#{Mx[:lnk_c]}:(\S+?[^>< ]+?)([()\[\]]*[,.;:!?'"]{0,2})(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m,
- %{#{Mx[:lnk_c]}#{Mx[:rel_o]}:\\1#{Mx[:rel_c]}\\2}).
- gsub(/#{Mx[:lnk_c]}[.]{2}\/(\S+?[^>< ]+?)([()\[\]]*[,.;:!?'"]{0,2})(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m,
- %{#{Mx[:lnk_c]}#{Mx[:rel_o]}:\\1#{Mx[:rel_c]}\\2})
- end
- if dob.obj=~/_(?:https?|ftp):\S+/m # _http://url #CHECK
- dob.obj=dob.obj.gsub(/(^|[#{Mx[:gl_c]}#{Mx[:lnk_c]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}(\s])(_(?:https?|ftp):\/\/\S+?\.[^>< ]+?)([,.;'"]?)(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m,
- %{\\1#{Mx[:url_o]}\\2#{Mx[:url_c]}\\3})
- end
- dob=fontface(dob)
- dob.obj=dob.obj.gsub(/<[:e]\s+(.+?)!?>/,
- "#{Mx[:en_a_o]}\\1#{Mx[:en_a_c]}"). #not tested
- gsub(/(^|#{Mx[:br_nl]})\s*_\*\s*/,
- "\\1#{Mx[:gl_bullet]}"). #bullets, shortcut
- gsub(/=\{(.+?)\}/,
- "#{Mx[:idx_o]}\\1#{Mx[:idx_c]}").
- gsub(/^\s*_([1-9])\*\s*/,
- "#{Mx[:pa_o]}:i\\1:\\1#{Mx[:pa_c]}#{Mx[:gl_bullet]}"). #bullets, shortcut
- gsub(/^\s*_([1-9])\s+/,
- "#{Mx[:pa_o]}:i\\1:\\1#{Mx[:pa_c]}"). #indent
- gsub(/^\s*_([1-9])!\s+(.+?)\s*$/,
- "#{Mx[:pa_o]}:i\\1:\\1#{Mx[:pa_c]}#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]} "). #indent bold
- gsub(/^\s*__([1-9])\s+/,
- "#{Mx[:pa_o]}:i0:\\1#{Mx[:pa_c]}"). #hang
- gsub(/^\s*__([1-9])!\s+(.+?)\s*$/,
- "#{Mx[:pa_o]}:i0:\\1#{Mx[:pa_c]}#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]} "). #hangdef
- gsub(/^\s*_([0-9])_([0-9])\s+/,
- "#{Mx[:pa_o]}:i\\1:\\2#{Mx[:pa_c]}"). #hang
- gsub(/^\s*_([0-9])_([0-9])!\s+(.+?)\s*$/,
- "#{Mx[:pa_o]}:i\\1:\\2#{Mx[:pa_c]}#{Mx[:fa_bold_o]}\\3#{Mx[:fa_bold_c]} "). #hangdef
- gsub(/<:hi>/,"#{Mx[:fa_hilite_o]}"). #''). # bright yellow rgb(255,255,0) pale yellow rgb(255,255,200)
- gsub(/<:\/hi>/,"#{Mx[:fa_hilite_c]}"). #'').
- gsub(/(#{Mx[:gr_o]}verse#{Mx[:gr_c]}.+)/m,"\\1\n").
- gsub(/[ ]+($)/,'\1').
- gsub(/\{\s*(.+?)\s*\}(https?:\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/,
- "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}#{Mx[:url_o]}\\2#{Mx[:url_c]}\\3"). #any remaining linked text or image
- gsub(/\{\s*(.+?)\s*\}(#{Mx[:url_o]}\S+?#{Mx[:url_c]})/,
- "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2"). #any remaining linked text or image
- gsub(/(^|\s)([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)/,"\\1#{Mx[:url_o]}\\2#{Mx[:url_c]}").
- gsub(/(^|[ ])\{\s*(.+?)\s*\}(\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/,
- "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3\\4"). #any remaining linked text or image
- gsub(/\{\s*(.+?)\s*\}#([a-zA-Z0-9][a-zA-Z0-9_-]*)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/,
- "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}#{Mx[:rel_o]}\\2#{Mx[:rel_c]}\\3"). #any remaining linked text or image, check need
- gsub(/\{\s*(.+?)\s*\}(#{Mx[:rel_o]}\S+?#{Mx[:rel_c]})/,
- "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2"). #any remaining linked text or image, check need
- gsub(/\{\s*(.+?)\s*\}(image)/,
- "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2") #linked image
- elsif dob.is==:table
- dob=fontface(dob)
- elsif dob.is ==:code
- dob.obj=dob.obj.gsub(/#{Mx[:meta_o]}(\S+?)#{Mx[:meta_c]}\s*/,'@\1: ').
- gsub(/(^|#{Mx[:gl_c]}|\s)<(br(?: \/)?)>([\s,.]|$)/,'\1<\2>\3') #convert
back, clumsy
- if dob.number_
- codeline=[]
- ln=1
- dob.obj.split(/#{Mx[:gr_o]}codeline#{Mx[:gr_c]}| |\n/).each_with_index do |cl,i|
- unless i == 0
- cl=cl.gsub(Mx[:br_nl],'')
- w=3-ln.to_s.length
- cl = "#{ln}#{Mx[:nbsp]*w}#{Mx[:vline]}#{cl}#{Mx[:br_nl]}"
- ln +=1
- end
- codeline << cl
- end
- codeline= codeline.join("")
- dob.obj=codeline
- else
- dob.obj=dob.obj.gsub(/#{Mx[:gr_o]}codeline#{Mx[:gr_c]}/,"\n")
- end
- dob
- else # @\S+?:
- end
- dob
- end
- def tech #script markup planned to be more strict for technical documents
- # *{emphasis}* e{emphasis}e emphasis
- # !{bold text}! b{bold}b bold text
- # _{underline}_ u{underline}u underline
- # /{italics}/ i{italics}i italics
- # "{citation}" c{citation}c citation
- # ^{superscript}^ superscript
- # ,{subscript}, subscript
- # +{inserted text}+ inserted text
- # -{deleted text}- deleted text
- # #{monospace text}#
- # {url address}:url
- # {image.png}imageurl
- # {image.png}png
- # ~{endnote}~
- # +1
- # +2
- puts 'tech'
- @data.each do |line|
- line=line.gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)e\{(.+?)\}e/,
- "\\1#{@emph[:o]}\\2#{@emph[:c]}"). #emphasis
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)b\{(.+?)\}b/,
- "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}"). #bold
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)u\{(.+?)\}u/,
- "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}"). #underscore
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)c\{(.+?)\}c/,
- "\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}"). #cite
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)i\{(.+?)\}i/,
- "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}"). #italics
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)!\{(.+?)\}!/,
- "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}"). #bold
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)\*\{(.+?)\}\*/,
- "\\1#{@emph[:o]}\\2#{@emph[:c]}"). #emphasis
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)_\{(.+?)\}_/,
- "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}"). #underscore
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\(|\>)\/\{(.+?)\}\//,
- "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}"). #italics
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\"\{(.+?)\}\"/,
- "\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}").
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\^\{(.+?)\}\^/,
- "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}").
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)9\{(.+?)\}9/,
- "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}").
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>),\{(.+?)\},/,
- "\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}").
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)6\{(.+?)\}6/,
- "\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}").
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\+\{(.+?)\}\+/,
- "\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}").
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)v\{(.+?)\}v/,
- "\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}").
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)-\{(.+?)\}-/,
- "\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}").
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)x\{(.+?)\}x/,
- "\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}").
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\*(\S+?)\*/,
- "\\1#{@emph[:o]}\\2#{@emph[:c]}"). #emphasise single word, watch
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\!(\S+?)\!/,
- "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}"). #bold single word, watch
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\/([\(\)a-zA-Z0-9']+?)\/([ ,.;:'"~$]|[^a-zA-Z0-9])/,
- "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}\\3"). #italics single word, watch
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)_(\S+?)_/,
- "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}"). #underscore single word, watch
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\^(\S+?)\^/,
- "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}"). #check #superscript single word, watch digit added
- gsub(/^\s*_\([1-9]\)\(\*\+\)\s*/,
- "#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}#{Mx[:fa_o]}\\2#{Mx[:fa_c_o]}"). #bullets, shortcut
- gsub(/^\s*_\([1-9]\)\s+/,
- "#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}"). #watch
- gsub(/^\s*__\([1-9]\)\s+/,
- "#{Mx[:pa_o]}:h\\1#{Mx[:pa_c]}"). #watch
- #line.gsub(/^\s*__\([1-9]\)!\s+/,
- # "#{Mx[:pa_o]}:hd\\1#{Mx[:pa_c]}"). #watch
- gsub(/#{Mx[:br_line]}\s*_[12]\s+/,
- "#{Mx[:br_line]} ") #indent used in endnotes, not implemented, replace when ready with: line.gsub(/(?: | )\s*_([12])\s+/,' <:i\1> ')
- end
- @data
- end
- end
-end
-__END__
diff --git a/lib/sisu/v5/db_import.rb b/lib/sisu/v5/db_import.rb
index 6edb0f99..147f27df 100644
--- a/lib/sisu/v5/db_import.rb
+++ b/lib/sisu/v5/db_import.rb
@@ -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
+ @dal_array=SiSU_AO::Source.new(@opt).get # dal file drawn here
if (@opt.act[:verbose][:set]==:on \
|| @opt.act[:verbose_plus][:set]==:on \
|| @opt.act[:maintenance][:set]==:on)
diff --git a/lib/sisu/v5/git.rb b/lib/sisu/v5/git.rb
index 92322b7c..447117ca 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
@@ -192,7 +192,7 @@ module SiSU_Git
if composite_src \
and not @opt.act[:dal][: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_format.rb b/lib/sisu/v5/html_format.rb
index c087f1ec..3a20ef67 100644
--- a/lib/sisu/v5/html_format.rb
+++ b/lib/sisu/v5/html_format.rb
@@ -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/hub.rb b/lib/sisu/v5/hub.rb
index c158f214..c6545c1d 100644
--- a/lib/sisu/v5/hub.rb
+++ b/lib/sisu/v5/hub.rb
@@ -286,8 +286,8 @@ module SiSU
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
diff --git a/lib/sisu/v5/manpage.rb b/lib/sisu/v5/manpage.rb
index 44180819..8f721fd2 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
@@ -100,7 +100,7 @@ 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
+ @dal_array=SiSU_AO::Source.new(@opt).get # dal file drawn here
SiSU_Manpage::Source::Scroll.new(@md,@dal_array).songsheet
rescue
SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do
diff --git a/lib/sisu/v5/odf.rb b/lib/sisu/v5/odf.rb
index 3e83e1cf..b64c8ebe 100644
--- a/lib/sisu/v5/odf.rb
+++ b/lib/sisu/v5/odf.rb
@@ -62,7 +62,7 @@
module SiSU_ODF
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
diff --git a/lib/sisu/v5/particulars.rb b/lib/sisu/v5/particulars.rb
index 000748ff..d06afc12 100644
--- a/lib/sisu/v5/particulars.rb
+++ b/lib/sisu/v5/particulars.rb
@@ -66,7 +66,7 @@ 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)
@@ -152,7 +152,7 @@ module SiSU_Particulars
attr_accessor :opt,:dal_array
def set_dal(opt)
begin
- @dal_array=SiSU_DAL::Source.new(opt).get
+ @dal_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.rb b/lib/sisu/v5/plaintext.rb
index 49c198e7..8585ad9d 100644
--- a/lib/sisu/v5/plaintext.rb
+++ b/lib/sisu/v5/plaintext.rb
@@ -61,7 +61,7 @@
=end
module SiSU_Plaintext
- require_relative 'dal' # dal.rb
+ require_relative 'ao' # ao.rb
require_relative 'sysenv' # sysenv.rb
include SiSU_Env
require_relative 'plaintext_format' # plaintext_format.rb
@@ -99,7 +99,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
+ dal_array=SiSU_AO::Source.new(@opt).get # dal file drawn here
wrap_width=if defined? md.make.plaintext_wrap \
and md.make.plaintext_wrap
md.make.plaintext_wrap
diff --git a/lib/sisu/v5/po4a.rb b/lib/sisu/v5/po4a.rb
index 64f2c18d..43ff51e9 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
+ @dal_array_lang_translation=SiSU_AO::Source.new(@opt,opt_lang_trn_fn).get # dal 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,14 +141,14 @@ 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
+ @dal_array_lang_src=SiSU_AO::Source.new(@@opt_src,opt_lang_src_fn).get # dal 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_src=SiSU_AO::Source.new(@opt,fn).get # dal file drawn here
@dal_array_lang_translation=nil
end
wrap_width=if defined? md.make.plaintext_wrap \
diff --git a/lib/sisu/v5/sst_do_inline_footnotes.rb b/lib/sisu/v5/sst_do_inline_footnotes.rb
index 836d0d29..f03c1c34 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!!
diff --git a/lib/sisu/v5/sst_to_s_xml_sax.rb b/lib/sisu/v5/sst_to_s_xml_sax.rb
index d6767595..a3fbde9f 100644
--- a/lib/sisu/v5/sst_to_s_xml_sax.rb
+++ b/lib/sisu/v5/sst_to_s_xml_sax.rb
@@ -68,7 +68,7 @@ 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 'ao_doc_str' # ao_doc_str.rb
require_relative 'shared_xml' # shared_xml.rb
include SiSU_XML_Munge
require_relative 'shared_sem' # shared_sem.rb
@@ -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..19031711 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_dal
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',
diff --git a/lib/sisu/v5/texpdf.rb b/lib/sisu/v5/texpdf.rb
index 2dc3e860..df089d31 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,7 +126,7 @@ 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
+ dal_array=SiSU_AO::Source.new(@opt).get # dal file drawn here
SiSU_TeX::Source::LaTeXcreate.new(@particulars).songsheet
dal_array=''
pwd=Dir.pwd
@@ -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/wikispeak.rb b/lib/sisu/v5/wikispeak.rb
index da8fc9fa..eab2336d 100644
--- a/lib/sisu/v5/wikispeak.rb
+++ b/lib/sisu/v5/wikispeak.rb
@@ -60,7 +60,7 @@
=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
@@ -90,7 +90,7 @@ 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
+ @dal_array=SiSU_AO::Source.new(@opt).get # dal file drawn here
SiSU_Wikispeak::Source::Scroll.new(@dal_array,@md).songsheet
rescue
SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do
diff --git a/lib/sisu/v5/xml_dom.rb b/lib/sisu/v5/xml_dom.rb
index f6d86883..36a0dae1 100644
--- a/lib/sisu/v5/xml_dom.rb
+++ b/lib/sisu/v5/xml_dom.rb
@@ -66,7 +66,7 @@ module SiSU_XML_DOM
include SiSU_Particulars
require_relative 'sysenv' # sysenv.rb
include SiSU_Env
- require_relative 'dal' # dal.rb
+ require_relative 'ao' # ao.rb
require_relative 'shared_xml' # shared_xml.rb
include SiSU_XML_Munge
require_relative 'xml_format' # xml_format.rb
diff --git a/lib/sisu/v5/xml_scaffold_structure_collapsed.rb b/lib/sisu/v5/xml_scaffold_structure_collapsed.rb
index a90207ff..8f14ea54 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
diff --git a/lib/sisu/v5/xml_scaffold_structure_sisu.rb b/lib/sisu/v5/xml_scaffold_structure_sisu.rb
index 64173566..12e1088a 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
--
cgit v1.2.3
From 3d4ec6deee066dec01b9445f9b54f844d9443aae Mon Sep 17 00:00:00 2001
From: Ralph Amissah
Date: Mon, 2 Dec 2013 23:59:06 -0500
Subject: v5: some renaming to ao from dal continued
---
lib/sisu/v5/air.rb | 6 +-
lib/sisu/v5/ao.rb | 158 ++++++++++++------------
lib/sisu/v5/ao_hash_digest.rb | 4 +-
lib/sisu/v5/concordance.rb | 4 +-
lib/sisu/v5/conf.rb | 12 +-
lib/sisu/v5/db_import.rb | 14 +--
lib/sisu/v5/digests.rb | 32 ++---
lib/sisu/v5/epub.rb | 4 +-
lib/sisu/v5/epub_concordance.rb | 4 +-
lib/sisu/v5/git.rb | 2 +-
lib/sisu/v5/html.rb | 4 +-
lib/sisu/v5/hub.rb | 8 +-
lib/sisu/v5/manpage.rb | 4 +-
lib/sisu/v5/odf.rb | 6 +-
lib/sisu/v5/options.rb | 18 ++-
lib/sisu/v5/param.rb | 4 +-
lib/sisu/v5/particulars.rb | 12 +-
lib/sisu/v5/plaintext.rb | 4 +-
lib/sisu/v5/po4a.rb | 10 +-
lib/sisu/v5/prog_text_translation.rb | 4 +-
lib/sisu/v5/relaxng.rb | 4 +-
lib/sisu/v5/shared_sisupod_source.rb | 2 +-
lib/sisu/v5/sisupod_make.rb | 2 +-
lib/sisu/v5/sst_do_inline_footnotes.rb | 44 +++----
lib/sisu/v5/sst_to_s_xml_sax.rb | 4 +-
lib/sisu/v5/sysenv.rb | 134 ++++++++++----------
lib/sisu/v5/texinfo.rb | 2 +-
lib/sisu/v5/texpdf.rb | 6 +-
lib/sisu/v5/texpdf_format.rb | 4 +-
lib/sisu/v5/urls.rb | 4 +-
lib/sisu/v5/wikispeak.rb | 4 +-
lib/sisu/v5/xhtml.rb | 8 +-
lib/sisu/v5/xml_dom.rb | 8 +-
lib/sisu/v5/xml_sax.rb | 8 +-
lib/sisu/v5/xml_scaffold_structure_collapsed.rb | 4 +-
lib/sisu/v5/xml_scaffold_structure_sisu.rb | 4 +-
36 files changed, 276 insertions(+), 280 deletions(-)
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/ao.rb b/lib/sisu/v5/ao.rb
index 00484ff9..7c367980 100644
--- a/lib/sisu/v5/ao.rb
+++ b/lib/sisu/v5/ao.rb
@@ -89,7 +89,7 @@ module SiSU_AO
end
end
class Source #{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_AO
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_AO::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_AO::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_AO
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_AO
@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,17 +505,17 @@ module SiSU_AO
def song
reset
data=@data
- data=SiSU_AO_Insertions::Insertions.new(@md,data).expand_insertions? # dal_expand_insertions.rb
- data=SiSU_AO_MiscArrangeText::SI.new(@md,data).prepare_text # dal_misc_arrange.rb
- data,metadata=SiSU_AO_DocumentStructureExtract::Build.new(@md,data).identify_parts # dal_doc_str.rb
- data=SiSU_AO_Syntax::Markup.new(@md,data).songsheet # dal_syntax.rb
- data,endnote_array=SiSU_AO_CharacterCheck::Check.new(data).character_check_and_oldstyle_endnote_array # dal_character_check.rb
- data=SiSU_AO_Images::Images.new(@md,data).images # dal_images.rb
- data,tags_map,ocn_html_seg_map=SiSU_AO_Numbering::Numbering.new(@md,data).numbering_song # dal_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 # dal_idx.rb
- data=SiSU_AO_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_AO::Output.new(@fn,@md,outputdata).hard_output
SiSU_AO::Output.new(@fn,@md,outputdata).make_marshal_content
diff --git a/lib/sisu/v5/ao_hash_digest.rb b/lib/sisu/v5/ao_hash_digest.rb
index 70deee80..e1cc840c 100644
--- a/lib/sisu/v5/ao_hash_digest.rb
+++ b/lib/sisu/v5/ao_hash_digest.rb
@@ -96,7 +96,7 @@ module SiSU_AO_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_AO_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/concordance.rb b/lib/sisu/v5/concordance.rb
index 3ad394c7..8c675e36 100644
--- a/lib/sisu/v5/concordance.rb
+++ b/lib/sisu/v5/concordance.rb
@@ -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/db_import.rb b/lib/sisu/v5/db_import.rb
index 147f27df..8a8cc13d 100644
--- a/lib/sisu/v5/db_import.rb
+++ b/lib/sisu/v5/db_import.rb
@@ -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 'ao' # ao.rb
- @dal_array=SiSU_AO::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/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/epub.rb b/lib/sisu/v5/epub.rb
index 969debe2..5f4957aa 100644
--- a/lib/sisu/v5/epub.rb
+++ b/lib/sisu/v5/epub.rb
@@ -149,8 +149,8 @@ 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_EPUB_Tune::Tune.new(ao_array,@md).songsheet
@tuned_file_array
end
end
diff --git a/lib/sisu/v5/epub_concordance.rb b/lib/sisu/v5/epub_concordance.rb
index 628435f2..ab5b272a 100644
--- a/lib/sisu/v5/epub_concordance.rb
+++ b/lib/sisu/v5/epub_concordance.rb
@@ -156,7 +156,7 @@ WOK
@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) \
diff --git a/lib/sisu/v5/git.rb b/lib/sisu/v5/git.rb
index 447117ca..7a69a187 100644
--- a/lib/sisu/v5/git.rb
+++ b/lib/sisu/v5/git.rb
@@ -190,7 +190,7 @@ 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_AO::Source.new(@opt).read # -m
"#{@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/hub.rb b/lib/sisu/v5/hub.rb
index c6545c1d..9390d517 100644
--- a/lib/sisu/v5/hub.rb
+++ b/lib/sisu/v5/hub.rb
@@ -280,7 +280,7 @@ 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
@@ -529,7 +529,7 @@ module SiSU
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'
@@ -581,7 +581,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=[],[],[]
@@ -633,7 +633,7 @@ 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 \
diff --git a/lib/sisu/v5/manpage.rb b/lib/sisu/v5/manpage.rb
index 8f721fd2..905cf87f 100644
--- a/lib/sisu/v5/manpage.rb
+++ b/lib/sisu/v5/manpage.rb
@@ -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_AO::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__
diff --git a/lib/sisu/v5/odf.rb b/lib/sisu/v5/odf.rb
index b64c8ebe..c865b0cb 100644
--- a/lib/sisu/v5/odf.rb
+++ b/lib/sisu/v5/odf.rb
@@ -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 \
@@ -115,7 +115,7 @@ module SiSU_ODF
@@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
@@ -125,7 +125,7 @@ module SiSU_ODF
def songsheet
begin
pre
- @data=markup(@dal_array)
+ @data=markup(@ao_array)
publish
ensure
unless (@md.opt.act[:verbose_plus][:set]==:on \
diff --git a/lib/sisu/v5/options.rb b/lib/sisu/v5/options.rb
index 7203f8b2..650105fa 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
@@ -883,10 +883,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,8 +960,8 @@ 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[:xhtml][:set]==:on \
@@ -992,14 +988,14 @@ module SiSU_Commandline
#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
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 d06afc12..beeaf429 100644
--- a/lib/sisu/v5/particulars.rb
+++ b/lib/sisu/v5/particulars.rb
@@ -73,7 +73,7 @@ module SiSU_Particulars
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_AO::Source.new(opt).get
+ @ao_array=SiSU_AO::Source.new(opt).get
self
rescue
SiSU_Errors::Rescued.new($!,$@,opt.cmd,opt.fnl).location do
diff --git a/lib/sisu/v5/plaintext.rb b/lib/sisu/v5/plaintext.rb
index 8585ad9d..57838342 100644
--- a/lib/sisu/v5/plaintext.rb
+++ b/lib/sisu/v5/plaintext.rb
@@ -99,7 +99,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_AO::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 +109,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_Plaintext::Source::Scroll.new(md,ao_array,wrap_width).songsheet
rescue
SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do
__LINE__.to_s + ':' + __FILE__
diff --git a/lib/sisu/v5/po4a.rb b/lib/sisu/v5/po4a.rb
index 43ff51e9..217f2975 100644
--- a/lib/sisu/v5/po4a.rb
+++ b/lib/sisu/v5/po4a.rb
@@ -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_AO::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_AO::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_AO::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 f6426f54..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 =< #{@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 a3fbde9f..09fecc9e 100644
--- a/lib/sisu/v5/sst_to_s_xml_sax.rb
+++ b/lib/sisu/v5/sst_to_s_xml_sax.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
diff --git a/lib/sisu/v5/sysenv.rb b/lib/sisu/v5/sysenv.rb
index 19031711..344a88d3 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_AO=:processing_dal
+ PROCESSING_AO=:processing_ao
PROCESSING_TUNE=:processing_tune
PROCESSING_LATEX=:processing_latex
PROCESSING_TEXINFO=:processing_texinfo
@@ -2161,7 +2161,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 +2195,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 +2219,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 +2238,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
@@ -2978,51 +2978,51 @@ 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[: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_scaffold_structure_sisu][:set]==:on #% --xml-scaffold --xml-scaffold-sisu
@@ -3033,46 +3033,46 @@ 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[: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_scaffold_structure_sisu][:set]==:on #% --xml-scaffold --xml-scaffold-sisu
@@ -3139,16 +3139,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 +3378,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 +3704,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 +3741,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 +4255,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
@@ -6130,17 +6130,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 +6148,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 df089d31..bf72a1a6 100644
--- a/lib/sisu/v5/texpdf.rb
+++ b/lib/sisu/v5/texpdf.rb
@@ -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_AO::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
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/urls.rb b/lib/sisu/v5/urls.rb
index a7b53985..9b2f1937 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],
@@ -249,7 +249,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]/ \
diff --git a/lib/sisu/v5/wikispeak.rb b/lib/sisu/v5/wikispeak.rb
index eab2336d..65e87c13 100644
--- a/lib/sisu/v5/wikispeak.rb
+++ b/lib/sisu/v5/wikispeak.rb
@@ -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_AO::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__
diff --git a/lib/sisu/v5/xhtml.rb b/lib/sisu/v5/xhtml.rb
index 03ba0134..995316b1 100644
--- a/lib/sisu/v5/xhtml.rb
+++ b/lib/sisu/v5/xhtml.rb
@@ -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
@@ -140,7 +140,7 @@ module SiSU_XHTML
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/xml_dom.rb b/lib/sisu/v5/xml_dom.rb
index 36a0dae1..6a2d7505 100644
--- a/lib/sisu/v5/xml_dom.rb
+++ b/lib/sisu/v5/xml_dom.rb
@@ -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
@@ -140,14 +140,14 @@ module SiSU_XML_DOM
require_relative 'shared_xhtml' # 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_sax.rb b/lib/sisu/v5/xml_sax.rb
index f9741ec1..a53abdd6 100644
--- a/lib/sisu/v5/xml_sax.rb
+++ b/lib/sisu/v5/xml_sax.rb
@@ -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
@@ -141,14 +141,14 @@ module SiSU_XML_SAX
require_relative 'shared_xhtml' # 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 8f14ea54..9a095f4b 100644
--- a/lib/sisu/v5/xml_scaffold_structure_collapsed.rb
+++ b/lib/sisu/v5/xml_scaffold_structure_collapsed.rb
@@ -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 12e1088a..2848187f 100644
--- a/lib/sisu/v5/xml_scaffold_structure_sisu.rb
+++ b/lib/sisu/v5/xml_scaffold_structure_sisu.rb
@@ -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__
--
cgit v1.2.3
From 6c3930e1c1faeee50dcde7991b7e8d63a746805c Mon Sep 17 00:00:00 2001
From: Ralph Amissah
Date: Tue, 3 Dec 2013 00:10:52 -0500
Subject: v5: some file renaming related to: shared files & epub, odf:odt,
plaintext
---
data/doc/sisu/CHANGELOG_v5 | 3 +
lib/sisu/v5/concordance.rb | 4 +-
lib/sisu/v5/db_import.rb | 2 +-
lib/sisu/v5/dbi.rb | 2 +-
lib/sisu/v5/dbi_discrete.rb | 2 +-
lib/sisu/v5/epub.rb | 769 -----------
lib/sisu/v5/epub_concordance.rb | 324 -----
lib/sisu/v5/epub_format.rb | 2236 --------------------------------
lib/sisu/v5/epub_segments.rb | 543 --------
lib/sisu/v5/epub_tune.rb | 333 -----
lib/sisu/v5/html_format.rb | 2 +-
lib/sisu/v5/html_lite_shared.rb | 325 +++++
lib/sisu/v5/html_scroll.rb | 2 +-
lib/sisu/v5/html_segments.rb | 2 +-
lib/sisu/v5/html_shared.rb | 68 +
lib/sisu/v5/hub.rb | 18 +-
lib/sisu/v5/manpage.rb | 4 +-
lib/sisu/v5/odf.rb | 820 ------------
lib/sisu/v5/odf_format.rb | 671 ----------
lib/sisu/v5/plaintext.rb | 576 --------
lib/sisu/v5/plaintext_format.rb | 104 --
lib/sisu/v5/share_src.rb | 102 --
lib/sisu/v5/share_src_kdissert.rb | 90 --
lib/sisu/v5/shared_html.rb | 68 -
lib/sisu/v5/shared_html_lite.rb | 325 -----
lib/sisu/v5/shared_sisupod_source.rb | 312 -----
lib/sisu/v5/shared_txt.rb | 236 ----
lib/sisu/v5/shared_xhtml.rb | 68 -
lib/sisu/v5/shared_xml.rb | 721 ----------
lib/sisu/v5/sisupod_make.rb | 167 ---
lib/sisu/v5/sitemaps.rb | 2 +-
lib/sisu/v5/src_kdissert_share.rb | 90 ++
lib/sisu/v5/src_share.rb | 102 ++
lib/sisu/v5/src_shared.rb | 312 +++++
lib/sisu/v5/src_sisupod_make.rb | 167 +++
lib/sisu/v5/sst_to_s_xml_sax.rb | 4 +-
lib/sisu/v5/txt_plain.rb | 576 ++++++++
lib/sisu/v5/txt_shared.rb | 242 ++++
lib/sisu/v5/wikispeak.rb | 4 +-
lib/sisu/v5/xhtml.rb | 6 +-
lib/sisu/v5/xhtml_epub2.rb | 769 +++++++++++
lib/sisu/v5/xhtml_epub2_concordance.rb | 324 +++++
lib/sisu/v5/xhtml_epub2_format.rb | 2236 ++++++++++++++++++++++++++++++++
lib/sisu/v5/xhtml_epub2_segments.rb | 543 ++++++++
lib/sisu/v5/xhtml_epub2_tune.rb | 333 +++++
lib/sisu/v5/xhtml_shared.rb | 68 +
lib/sisu/v5/xml_dom.rb | 6 +-
lib/sisu/v5/xml_fictionbook.rb | 305 -----
lib/sisu/v5/xml_odf_odt.rb | 820 ++++++++++++
lib/sisu/v5/xml_odf_odt_format.rb | 671 ++++++++++
lib/sisu/v5/xml_sax.rb | 6 +-
lib/sisu/v5/xml_shared.rb | 751 +++++++++++
52 files changed, 8433 insertions(+), 8803 deletions(-)
delete mode 100644 lib/sisu/v5/epub.rb
delete mode 100644 lib/sisu/v5/epub_concordance.rb
delete mode 100644 lib/sisu/v5/epub_format.rb
delete mode 100644 lib/sisu/v5/epub_segments.rb
delete mode 100644 lib/sisu/v5/epub_tune.rb
create mode 100644 lib/sisu/v5/html_lite_shared.rb
create mode 100644 lib/sisu/v5/html_shared.rb
delete mode 100644 lib/sisu/v5/odf.rb
delete mode 100644 lib/sisu/v5/odf_format.rb
delete mode 100644 lib/sisu/v5/plaintext.rb
delete mode 100644 lib/sisu/v5/plaintext_format.rb
delete mode 100644 lib/sisu/v5/share_src.rb
delete mode 100644 lib/sisu/v5/share_src_kdissert.rb
delete mode 100644 lib/sisu/v5/shared_html.rb
delete mode 100644 lib/sisu/v5/shared_html_lite.rb
delete mode 100644 lib/sisu/v5/shared_sisupod_source.rb
delete mode 100644 lib/sisu/v5/shared_txt.rb
delete mode 100644 lib/sisu/v5/shared_xhtml.rb
delete mode 100644 lib/sisu/v5/shared_xml.rb
delete mode 100644 lib/sisu/v5/sisupod_make.rb
create mode 100644 lib/sisu/v5/src_kdissert_share.rb
create mode 100644 lib/sisu/v5/src_share.rb
create mode 100644 lib/sisu/v5/src_shared.rb
create mode 100644 lib/sisu/v5/src_sisupod_make.rb
create mode 100644 lib/sisu/v5/txt_plain.rb
create mode 100644 lib/sisu/v5/txt_shared.rb
create mode 100644 lib/sisu/v5/xhtml_epub2.rb
create mode 100644 lib/sisu/v5/xhtml_epub2_concordance.rb
create mode 100644 lib/sisu/v5/xhtml_epub2_format.rb
create mode 100644 lib/sisu/v5/xhtml_epub2_segments.rb
create mode 100644 lib/sisu/v5/xhtml_epub2_tune.rb
create mode 100644 lib/sisu/v5/xhtml_shared.rb
delete mode 100644 lib/sisu/v5/xml_fictionbook.rb
create mode 100644 lib/sisu/v5/xml_odf_odt.rb
create mode 100644 lib/sisu/v5/xml_odf_odt_format.rb
create mode 100644 lib/sisu/v5/xml_shared.rb
diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5
index d132b705..af0dff54 100644
--- a/data/doc/sisu/CHANGELOG_v5
+++ b/data/doc/sisu/CHANGELOG_v5
@@ -46,6 +46,9 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.1.0.orig.tar.xz
ao (abstract objects) shorter, also easily searched, higher sort location
abstract as representation of & extraction of document objects
(dal (document abstraction layer))
+ * shared files e.g. shared_xml becomes xml_shared
+ * epub becomes xhtml_epub2
+ * odf becomes xml_odf_odt
* xml sax file renamed xml_sax.rb (from xml.rb)
* xmlns xlink using xl
diff --git a/lib/sisu/v5/concordance.rb b/lib/sisu/v5/concordance.rb
index 8c675e36..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
diff --git a/lib/sisu/v5/db_import.rb b/lib/sisu/v5/db_import.rb
index 8a8cc13d..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
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/epub.rb b/lib/sisu/v5/epub.rb
deleted file mode 100644
index 5f4957aa..00000000
--- a/lib/sisu/v5/epub.rb
+++ /dev/null
@@ -1,769 +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 .
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
-
-
-
-
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
-
-
-
- * Download:
-
-
- * Git
-
-
-
- * Ralph Amissah
-
-
-
- ** Description: epub generation, processing
-
-=end
-module SiSU_EPUB
- 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
- class Source
- def initialize(opt)
- @opt=opt
- @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)
- end
- def read
- songsheet
- end
- def songsheet
- begin
- @md=@particulars.md
- @fnb=@md.fnb
- @env=@particulars.env
- 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.epub_viewer} #{@md.file.output_path.epub.dir}/#{@md.file.base_filename.epub}"
- : "[#{@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],'EPUB',tool).green_hi_blue
- : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'EPUB',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.epub.dir}/#{@md.file.base_filename.epub}").flow
- end
- end
- @env.processing_path.epub_bld #(@md)
- @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
- data=@tuned_file_array
- toc=SiSU_EPUB::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
- rescue
- SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do
- __LINE__.to_s + ':' + __FILE__
- end
- ensure
- unless (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- texfiles=Dir["#{@env.processing_path.tune}/#{@opt.fns}*"]
- texfiles.each do |f|
- if FileTest.file?(f)
- File.unlink(f)
- end
- end
- end
- SiSU_Env::Clear.new(@opt.cmd,@opt.fns).param_instantiate
- @@flag,@@scr,@@seg,@@seg_endnotes,@@seg_subtoc,@@seg_ad={},{},{},{},{},{}
- @@seg_total,@@tracker,@@loop_count,@@tablehead,@@number_of_cols=0,0,0,0,0
- @@seg_name,@@seg_name_html,@@seg_subtoc_array,@@seg_endnotes_array,@@segtocband,@@tablefoot=Array.new(7){[]}
- @@filename_seg,@@seg_url,@@fn,@@to_lev4,@@get_hash_to,@@get_hash_fn='','','','','','',''
- @@is4=@@is3=@@is2=@@is1=@@heading1=@@heading2=@@heading3=@@heading4=0
- end
- end
- private
- class XHTML_Environment
- def initialize(particulars)
- @particulars=particulars
- @md,@env=particulars.md,particulars.env
- @vz=SiSU_Viz::Defaults.new
- @env,@css=particulars.env,SiSU_Style::CSS.new
- end
- def directories
- SiSU_Env::FileOp.new(@md).mkdir.output.epub
- end
- def tuned_file_instructions
- @tell=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set])
- directories
- ao_array=@particulars.ao_array # ao file drawn here
- @tuned_file_array=SiSU_EPUB_Tune::Tune.new(ao_array,@md).songsheet
- @tuned_file_array
- end
- end
- class Endnotes
- include SiSU_EPUB_Format
- def initialize(md,data)
- @md,@data=md,data
- end
- def scroll
- @scr_endnotes=[]
- @data.each do |dob|
- pg=dob.dup
- unless pg.is ==:code
- if pg.obj =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[\d*+]+ /
- endnote_array=[]
- if pg.obj=~/#{Mx[:en_a_o]}[\d*+].+?#{Mx[:en_a_c]}/m
- endnote_array = pg.obj.scan(/#{Mx[:en_a_o]}[\d*+]+(.+?)#{Mx[:en_a_c]}/m)
- end
- if pg.obj=~/#{Mx[:en_b_o]}[\d*]+\s.+?#{Mx[:en_b_c]}/m
- endnote_array = pg.obj.scan(/#{Mx[:en_b_o]}[\d*]+(.+?)#{Mx[:en_b_c]}/m)
- end
- if pg.obj=~/#{Mx[:en_b_o]}[\d+]+\s.+?#{Mx[:en_b_c]}/m
- endnote_array = pg.obj.scan(/#{Mx[:en_b_o]}[\d+]+(.+?)#{Mx[:en_b_c]}/m)
- end
- endnote_array.flatten.each do |note|
- txt_obj={ txt: note }
- format_scroll=SiSU_EPUB_Format::FormatScroll.new(@md,txt_obj)
- @scr_endnotes << format_scroll.endnote_body
- end
- end
- end
- end
- @scr_endnotes
- end
- end
- class Toc
- @@toc={ seg: [], seg_mini: [], scr: [], ncx: [], opf: [] }
- @@seg_url=''
- @@firstseg=nil
- def initialize(md=nil,data='')
- @md,@data=md,data
- @vz=SiSU_Viz::Defaults.new
- @epub=SiSU_EPUB_Format::HeadInformation.new(@md)
- @tell=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set]) if @md
- @make=SiSU_Env::ProcessingSettings.new(@md)
- end
- def songsheet #extracts toc for scroll & seg
- if (@md.opt.act[:verbose][:set]==:on \
- || @md.opt.act[:verbose_plus][:set]==:on \
- || @md.opt.act[:maintenance][:set]==:on)
- SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'Toc').txt_grey
- end
- toc=nil
- @@firstseg=nil
- @@toc={ seg: [], seg_mini: [], scr: [], ncx: [], opf: [] }
- md_opf_a_content,md_opf_a_spine,md_opf_a_guide=[],[],[]
- @nav_no=0
- @s_a_no,@s_b_no,@s_c_no,@lv5_no,@lv6_no=0,0,0,0,0
- @@toc[:ncx] << @epub.toc_ncx.open #epub ncx navmap
- @@toc[:ncx] << @epub.toc_ncx.head_open << @epub.toc_ncx.head << @epub.toc_ncx.head_close
- @@toc[:ncx] << @epub.toc_ncx.doc_title << @epub.toc_ncx.doc_author
- @@toc[:ncx] << @epub.toc_ncx.navmap_open
- @@toc[:opf] << @epub.metadata_opf.package_open
- @@toc[:opf] << @epub.metadata_opf.metadata
- @@toc[:opf] << @epub.metadata_opf.manifest_open
- @@toc[:seg] << %{
\n
}
- @@toc[:scr] << %{
\n
}
- if defined? @md.make.cover_image \
- and @md.make.cover_image.is_a?(Hash) \
- and @md.make.cover_image[:cover] =~/\S+/
- md_opf_a_content << @epub.metadata_opf.manifest_cover_image_information(@md)
- md_opf_a_spine << @epub.metadata_opf.spine_cover_image
- md_opf_a_guide << @epub.metadata_opf.guide_cover_image
- end
- md_opf_a_content << @epub.metadata_opf.manifest_content_sisu_toc
- if @make.build.toc?
- md_opf_a_spine << @epub.metadata_opf.spine_sisu_toc
- md_opf_a_guide << @epub.metadata_opf.guide_sisu_toc
- end
- @ncxo=[nil,false,false,false,false,false,false]
- @dob_toc2,@dob_toc3=nil,nil
- @ncx_cls=[]
- @level_a_first_occurrence=true
- @data.each do |dob|
- if dob.is==:heading \
- || dob.is==:heading_insert
- dob_toc=dob.dup
- toc=case dob_toc.ln
- when 1
- @s_a_no +=1
- lv_name='section_a' + @s_a_no.to_s
- @nav_no+=1
- @nav_no2=@nav_no
- @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[6]
- @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[5]
- @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[4]
- @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[3]
- @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[2]
- @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[1]
- @ncxo[1],@ncxo[2],@ncxo[3],@ncxo[4],@ncxo[5],@ncxo[6]=true,false,false,false,false,false
- @epub.sections(dob_toc,lv_name)
- @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no,lv_name) if dob_toc
- if @level_a_first_occurrence \
- && @make.build.toc?
- @nav_no+=1
- @@toc[:ncx] << @epub.toc_ncx.navmap_sisu_toc(@nav_no) #epub ncx navmap, toc
- @level_a_first_occurrence=false
- end
- 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
- when 2
- @s_b_no +=1
- lv_name='section_b' + @s_b_no.to_s
- @nav_no+=1
- @nav_no2=@nav_no
- @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[6]
- @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[5]
- @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[4]
- @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[3]
- @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[2]
- @ncxo[2],@ncxo[3],@ncxo[4],@ncxo[5],@ncxo[6]=true,false,false,false,false
- @epub.sections(dob_toc,lv_name)
- @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no,lv_name) if dob_toc
- 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
- when 3
- @s_c_no +=1
- lv_name='section_c' + @s_c_no.to_s
- @nav_no+=1
- @nav_no3=@nav_no
- @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[6]
- @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[5]
- @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[4]
- @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[3]
- @ncxo[3],@ncxo[4],@ncxo[5],@ncxo[6]=true,false,false,false
- @epub.sections(dob_toc,lv_name)
- @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no,lv_name) if dob_toc
- 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
- when 4
- @ncx_cls=[]
- lv_name=dob_toc.name
- @nav_no+=1
- @dob_name=dob.name
- @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[6]
- @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[5]
- @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[4]
- @ncxo[4],@ncxo[5],@ncxo[6]=true,false,false
- @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no,lv_name) if dob_toc
- 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
- when 5
- @ncx_cls=[]
- hashtag='#o' + dob_toc.ocn.to_s
- lv_name=@dob_name
- @nav_no+=1
- @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[6]
- @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[5]
- @ncxo[5],@ncxo[6]=true,false
- @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no,lv_name,hashtag) if dob_toc
- 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
- when 6
- @ncx_cls=[]
- hashtag='#o' + dob_toc.ocn.to_s
- lv_name=@dob_name
- @nav_no+=1
- @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[6]
- @ncxo[6]=true
- @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no,lv_name,hashtag) if dob_toc
- 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
- else nil
- end
- toc.each do |k,d|
- d.gsub!(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ')
- end if toc
- if @@firstseg.nil? \
- and dob.ln==4 \
- and dob.name =~/\S+/
- @@firstseg=dob.name
- end
- if toc
- begin
- @@toc[:seg] << toc[:seg]
- @@toc[:scr] << toc[:seg]
- rescue
- SiSU_Errors::Rescued.new($!,$@,@md.opt.cmd,@md.fns).location do
- __LINE__.to_s + ':' + __FILE__
- end
- end
- end
- end
- end
- @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[6]
- @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[5]
- @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[4]
- @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[3]
- @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[2]
- @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[1]
- @ncxo[1],@ncxo[2],@ncxo[3],@ncxo[4],@ncxo[5],@ncxo[6]=false,false,false,false,false,false
- md_opf_a_content << @epub.metadata_opf.manifest_images(@md.ec[:image])
- @@toc[:seg] << "
\n
"
- @@toc[:scr] << "
\n
"
- @@toc[:ncx] << @epub.toc_ncx.navmap_close
- @@toc[:ncx] << @epub.toc_ncx.close
- @@toc[:opf] << md_opf_a_content << @epub.metadata_opf.manifest_close
- @@toc[:opf] << @epub.metadata_opf.spine_open << md_opf_a_spine << @epub.metadata_opf.spine_close
- @@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
- @md.firstseg=@@firstseg
- @@toc
- end
- protected
- def level_1
- dob=@data
- linkname,link=dob.obj.strip,dob.ocn
- title=if dob.obj !~/Document Information/
- linkname
- else
- link='metadata'
- %{#{linkname}}
- end
- toc={}
- txt_obj={ txt: title }
- format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj)
- toc[:seg]=if dob.name =~/^meta/ \
- and dob.obj =~/Document Information/ #check
- format_toc.lev0
- else format_toc.lev1
- end
- title=if dob.ocn ==0
- if dob.name =~/^meta/ \
- and dob.obj =~/Document Information/
- %{#{linkname}}
- else linkname
- end
- else
- @@toc[:scr] << ' '
- link=(dob.ln) \
- ? dob.ln
- : ''
- %{#{linkname}}
- end
- txt_obj={ txt: title }
- format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj)
- toc[:scr]=if dob.name =~/^meta/ \
- and dob.obj =~/Document Information/
- format_toc.lev0
- else format_toc.lev1
- end
- toc
- end
- def level_2
- dob=@data
- linkname,ocn=dob.obj.strip,dob.ocn
- if ocn \
- and ocn !~/#/
- p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn)
- end
- txt_obj={ txt: linkname }
- format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj)
- toc={}
- toc[:seg]=format_toc.lev2
- if p_num
- title=%{#{p_num.goto}#{linkname}}
- txt_obj={ txt: title }
- format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj)
- toc[:scr]=format_toc.lev2
- end
- toc
- end
- def level_3
- dob=@data
- linkname,ocn=dob.obj.strip,dob.ocn
- if ocn \
- and ocn !~/#/
- p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn)
- end
- txt_obj={ txt: linkname }
- format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj)
- toc={}
- toc[:seg]=format_toc.lev3
- if p_num
- title=%{#{p_num.goto}#{linkname}}
- txt_obj={ txt: title }
- format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj)
- toc[:scr]=format_toc.lev3
- end
- toc
- end
- def level_4
- dob=@data
- linkname,ocn=dob.obj.strip,dob.ocn
- p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn) if ocn
- if dob.ln==4
- seg_link=%{
- #{dob.obj}
- }
- @@seg_url=dob.name
- elsif dob.obj =~/\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+/
- seg_link=dob.obj.gsub(/^(\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+)(.*)/,
- %{} +
- %{\\1 \\2 })
- end
- p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn) if ocn
- txt_obj={ txt: seg_link }
- format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj)
- toc={}
- toc[:seg]=format_toc.lev4
- title=%{#{p_num.goto}#{linkname}} if p_num
- txt_obj={ txt: title }
- format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj)
- toc[:scr]=format_toc.lev4
- toc
- end
- def level_5
- dob=@data
- linkname,ocn=dob.obj.strip,dob.ocn
- toc={}
- if ocn \
- and ocn !~/#/
- p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn)
- lnk_n_txt=%{
- #{linkname}
- }
- txt_obj={ txt: lnk_n_txt }
- format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj)
- toc[:seg]=format_toc.lev5
- title=%{#{p_num.goto}#{linkname}}
- txt_obj={ txt: title }
- format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj)
- toc[:scr]=format_toc.lev5
- end
- toc
- end
- def level_6
- dob=@data
- linkname,ocn=dob.obj.strip,dob.ocn
- toc={}
- if ocn \
- and ocn !~/#/
- p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn)
- lnk_n_txt=%{
- #{linkname}
-}
- txt_obj={ txt: lnk_n_txt }
- format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj)
- toc[:seg]=format_toc.lev6
- title=%{#{p_num.goto}#{linkname}}
- txt_obj={ txt: title }
- format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj)
- toc[:scr]=format_toc.lev6
- end
- toc
- end
- end
- class ScrollHeadAndSegToc < Toc
- def initialize(md='',toc='',links_guide_toc='')
- @md,@toc,@links_guide_toc=md,toc,links_guide_toc
- @vz=SiSU_Viz::Defaults.new
- end
- def in_common
- toc_shared=[]
- segtoc=[]
- if (@md.opt.act[:verbose][:set]==:on \
- || @md.opt.act[:verbose_plus][:set]==:on \
- || @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)
- dochead=format_head_toc.head
- dochead=dochead.gsub(/toc\.(html)/,'doc.\1') #kludge
- toc_shared << dochead #<< ads.div.major
- segtoc << format_head_toc.head #<< ads.div.major
- if defined? @md.rights.all \
- and @md.rights.all
- rights=format_head_toc.rights.all
- rights=SiSU_EPUB_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
- end
- tmp_head=nil
- doc_title_endnote=@md.title.full.gsub(/(\*+)/,'\1')
- tmp_head=doc_title_endnote + "\n"
- txt_obj={ txt: tmp_head }
- format_txt_obj=SiSU_EPUB_Format::FormatTextObject.new(@md,txt_obj)
- toc_shared << format_txt_obj.center_bold
- segtoc << format_txt_obj.center_bold
- if defined? @md.creator.author \
- and @md.creator.author
- creator_endnote=@md.creator.author.gsub(/(\*+)/,%{#{$ep[:hsp]}\\1})
- tmp_head=creator_endnote + "\n"
- txt_obj={ txt: tmp_head }
- format_txt_obj=SiSU_EPUB_Format::FormatTextObject.new(@md,txt_obj)
- toc_shared << format_txt_obj.center_bold
- segtoc << format_txt_obj.center_bold
- end
- tmp_head=nil
- if defined? @md.prefix_a \
- and @md.prefix_a
- tmp_head ||= %{#{@md.prefix_a}\n}
- toc_shared << tmp_head.dup
- segtoc << tmp_head.dup
- end
- tmp_head=nil
- toc_shared << @links_guide_toc
- if defined? @md.rights.all \
- and @md.rights.all
- toc_shared << rights
- end
- if defined? @md.prefix_b \
- and @md.prefix_b
- toc_shared << prefix_b
- end
- #Table of Contents added/appended here
- toc_shared << @toc[:scr]
- segtoc << @links_guide_toc
- segtoc << @toc[:seg]
- if defined? @md.rights.all \
- and @md.rights.all
- segtoc << rights
- end
- if defined? @md.prefix_b \
- and @md.prefix_b
- segtoc << prefix_b
- end
- #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
- segtoc=[]
- @toc[:scr],@toc[:seg]=[],[]
- toc_shared
- end
- end
- class Table < SiSU_XHTML_Table::TableXHTML
- end
- class Seg < SiSU_EPUB_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)
- @make=SiSU_Env::ProcessingSettings.new(@md)
- @make_file=SiSU_Env::CreateFile.new(@md.fns)
- end
- def songsheet
- mimetype
- metainf_container
- css
- images if @md.ec[:image]
- #concordance #uncomment to enable inclusion of concordance file
- output_zip
- end
- def mimetype
- out=@make_file.epub.mimetype
- out<<@epub_header.mimetype
- out.close
- end
- def metainf_container #container.xml file in META-INF directory
- out=@make_file.epub.metainf_cont
- out<<@epub_header.metainf_container
- out.close
- end
- def css
- out=@make_file.epub.xhtml_css
- out << SiSU_EPUB_Format::CSS.new.css_epub_xhtml
- out.close
- end
- def epub_toc_ncx
- begin
- out=@make_file.epub.toc_ncx
- @output.each do |para|
- unless para =~/\A\s*\Z/
- out.puts para
- end
- end
- out.close
- rescue
- SiSU_Errors::Rescued.new($!,$@,@md.opt.cmd,@md.fns).location do
- __LINE__.to_s + ':' + __FILE__
- end
- end
- end
- def epub_metadata_opf
- begin
- out=@make_file.epub.metadata
- @output.each do |para|
- unless para =~/\A\s*\Z/
- out.puts para
- end
- end
- out.close
- rescue
- SiSU_Errors::Rescued.new($!,$@,@md.opt.cmd,@md.fns).location do
- __LINE__.to_s + ':' + __FILE__
- end
- end
- end
- def images
- img_pth=@md.env.path.image_source_include
- img_src_pth=unless @md.opt.f_pth[:pth] =~/\/\S+?\/sisupod\/\S+?\/sisupod\/doc/
- @md.file.output_path.epub.rel_image
- else
- pt=/(\/\S+?\/sisupod\/\S+?\/sisupod)\/doc/.match(@md.opt.f_pth[:pth])[1]
- pt + '/image'
- end
- @md.ec[:image].each do |x|
- if FileTest.directory?("#{@md.env.processing_path.epub}/#{Ep[:d_oebps]}/image") \
- && FileTest.file?("#{img_src_pth}/#{x}")
- FileUtils::cp("#{img_src_pth}/#{x}","#{@md.env.processing_path.epub}/#{Ep[:d_oebps]}/image")
- elsif FileTest.directory?("#{@md.env.processing_path.epub}/#{Ep[:d_oebps]}/image") \
- && FileTest.file?("#{img_pth}/#{x}")
- FileUtils::cp("#{img_pth}/#{x}","#{@md.env.processing_path.epub}/#{Ep[:d_oebps]}/image")
- else STDERR.puts %{\t*WARN* did not find image - "#{x}" in #{img_src_pth} or #{img_pth} [#{__FILE__}:#{__LINE__}]}
- end
- end
- end
- def concordance
- SiSU_EPUB_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)
- if FileTest.directory?(@md.env.processing_path.epub)
- pwd=Dir.pwd
- Dir.chdir(@md.env.processing_path.epub)
- system("
- zip -qXr9D #{@epub_doc} *
- ")
- FileUtils::mv(@epub_doc, @md.file.place_file.epub.dir)
- Dir.chdir(pwd)
- unless @md.opt.act[:maintenance][:set]==:on
- FileUtils::rm_r(@md.env.processing_path.epub)
- end
- end
- end
- def make_cover_image
- begin
- if @md.make.cover_image? \
- and @md.make.cover_image.is_a?(Hash) \
- and @md.make.cover_image[:cover] =~/\S+/
- filename_xhtml=@make_file.epub.xhtml_cover_image
- cover_image=<
-
-
-
- Cover
-
-
-
-
-
-
-
-
-
-
-
-
-WOK
- filename_xhtml.puts cover_image,"\n"
- filename_xhtml.close
- end
- rescue
- SiSU_Errors::Rescued.new($!,$@,@md.opt.cmd,@md.fns).location do
- __LINE__.to_s + ':' + __FILE__
- end
- end
- end
- def make_segtoc
- begin
- if @make.build.toc?
- filename_xhtml=@make_file.epub.xhtml_index
- @output.each do |para|
- para=para.strip
- unless para =~/\A\s*\Z/
- filename_xhtml.puts para,"\n"
- end
- end
- filename_xhtml.close
- end
- rescue
- SiSU_Errors::Rescued.new($!,$@,@md.opt.cmd,@md.fns).location do
- __LINE__.to_s + ':' + __FILE__
- end
- end
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/v5/epub_concordance.rb b/lib/sisu/v5/epub_concordance.rb
deleted file mode 100644
index ab5b272a..00000000
--- a/lib/sisu/v5/epub_concordance.rb
+++ /dev/null
@@ -1,324 +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 .
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
-
-
-
-
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
-
-
-
- * Download:
-
-
- * Git
-
-
-
- * Ralph Amissah
-
-
-
- ** Description: epub concordance file (html concordance, wordmap, linked index
- of words in document)
-
-=end
-module SiSU_EPUB_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
- class Source
- def initialize(opt)
- @opt=opt
- @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)
- end
- def read
- begin
- @env,@md=@particulars.env,@particulars.md
- wordmax=@env.concord_max
- unless @md.wc_words.nil?
- if @md.wc_words < wordmax
- SiSU_EPUB_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
- end
- rescue
- SiSU_Errors::Rescued.new($!,$@,@md.opt.cmd,@md.fns).location do
- __LINE__.to_s + ':' + __FILE__
- end
- ensure
- end
- end
- 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
- def initialize(particulars)
- @particulars,@md=particulars,particulars.md
- @data=SiSU_EPUB::Source::XHTML_Environment.new(particulars).tuned_file_instructions
- @vz=SiSU_Viz::Defaults.new
- @fnb=@md.fnb
- @lex_button=%{}
- @doc_details =<
Word index links are to html versions of the text the segmented version followed by the scroll (single document) version. [For segmented text references [T1], [T2] or [T3] appearing without a link, indicates that the word appears in a title (or subtitle) of the text (that is identifiable by the appended object citation number).]
-
(The word listing/index is Case sensitive: Capitalized words appear before lower case)
-
- word (number of occurences) linked references to word within document
- [if number of occurences exceed number of references - word occurs more than once in at least one reference. Footnote/endnotes are either assigned to the paragraph from which they are referenced or ignored, so it is relevant to check the footnotes referenced from within a paragraph as well.]
-
-
- (After the page is fully loaded) you can jump directly to a word by appending a hash (#) and the word to the url for this text, (do not forget that words are case sensitive, and may be listed twice (starting with and without an upper case letter)), #your_word # [#{$ep[:hsp]}http://[web host]/#{@fnb}/concordance.html#your_word#{$ep[:hsp]}]
-
-WOK
- end
- end
- class Word
- @@word_previous=''
- def initialize(word,freq)
- @word,@freq=word,freq
- end
- def html
- w=if @word.capitalize==@@word_previous
- %{\n
#{@word}
(#{@freq})
\n\t
}
- else n=@word.strip.gsub(/\s+/,'_') #also need to convert extended character set to html
- %{\n
}
- end
- @@word_previous=@word.capitalize
- w
- end
- end
- class Words
- require_relative 'defaults' # defaults.rb
- include SiSU_Viz
- require_relative 'epub_format' # epub_format.rb
- include SiSU_EPUB_Format
- require_relative 'sysenv' # sysenv.rb
- include SiSU_Screen
- def initialize(particulars)
- @particulars=particulars
- begin
- @vz=SiSU_Viz::Defaults.new
- @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]
- @rxp_lv2=/^#{Mx[:lv_o]}2:/ #fix Mx[:lv_o]
- @rxp_lv3=/^#{Mx[:lv_o]}3:/ #fix Mx[:lv_o]
- @rxp_seg=/^#{Mx[:lv_o]}4:(\S+?)#{Mx[:lv_c]}/
- @rxp_title=Regexp.new("^#{Mx[:meta_o]}title#{Mx[:meta_c]}\s*(.+?)\s*$")
- @rxp_t1=Regexp.new('^T1')
- @rxp_t2=Regexp.new('^T2')
- @rxp_t3=Regexp.new('^T3')
- @rxp_excluded1=/(?:https?|file|ftp):\/\/\S+/
- @rxp_excluded0=/^(?:#{Mx[:fa_bold_o]}|#{Mx[:fa_italics_o]})?(?:to\d+|\d+| |#{Mx[:br_endnotes]}|EOF|#{Mx[:br_eof]}|thumb_\S+|snap_\S+|_+|-+|[(]?(?:ii+|iv|vi+|ix|xi+|xiv|xv|xvi+|xix|xx)[).]?|\S+?_\S+|[\d_]+\w\S+|[\w\d]{1,2}|\d{1,3}\w?|[0-9a-f]{16,64}|\d{2,3}x\d{2,3}|\S{0,2}sha\d|\S{0,3}\d{4}w\d\d|\b\w\d+|\d_all\b|e\.?g\.?)(?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})?$/mi #this regex causes and cures a stack dump in ruby 1.9 !!!
- @rgx_splitlist=%r{[—.,;:-]+|#{Mx[:nbsp]}+}mi
- @rgx_scanlist=%r{#{Mx[:fa_italics_o]}[a-zA-Z0-9"\s]{2,12}#{Mx[:fa_italics_c]}|#{Mx[:fa_bold_o]}[a-zA-Z0-9"\s]{2,12}#{Mx[:fa_bold_c]}|#{Mx[:url_o]}https?://\S+?#{Mx[:url_c]}|file://\S+|<\S+?>|\w+|[a-zA-Z]+}mi
- rescue
- SiSU_Errors::Rescued.new($!,$@,@md.opt.cmd,@md.fns).location do
- __LINE__.to_s + ':' + __FILE__
- end
- end
- end
- def songsheet
- begin
- #fix to use
- p __LINE__.to_s + ':' + __FILE__
- p "#{@path}/content/#{@md.fn[:epub_concord]}"
- p "#{@md.file.output_path.epub.dir}/#{@md.file.base_filename.epub}"
- @file_concordance=File.open("#{@path}/content/#{@md.fn[:epub_concord]}",'w')
- map_para
- rescue
- SiSU_Errors::Rescued.new($!,$@,@md.opt.cmd,@md.fns).location do
- __LINE__.to_s + ':' + __FILE__
- end
- ensure
- @file_concordance.close
- end
- end
- protected
- def location_scroll(wordlocation,show)
- @wordlocation=wordlocation
- %{#{@wordlocation}; }
- end
- def location_seg(wordlocation,show)
- @wordlocation,@show=wordlocation,show
- @word_location_seg=wordlocation.gsub(/(.+?)\#(\d+)/,"\\1#{Sfx[:epub_xhtml]}#o\\2") unless wordlocation.nil?
- case @wordlocation
- when @rxp_t1
- %{[H]#{@show}, }
- when @rxp_t2
- %{[H]#{@show}, }
- when @rxp_t3
- %{[H]#{@show}, }
- else %{#{@show}, }
- end
- end
- def map_para
- @seg,toy=nil,nil
- @word_map={}
- @ao_array.each do |line|
- if defined? line.ocn
- if (line.is ==:heading \
- || line.is ==:heading_insert) \
- && line.ln==4
- @seg=line.name
- end
- if line.ocn.to_s =~/\d+/ then toy=line.ocn.to_s
- end
- if toy =~/\d+/ \
- and toy !~/^0$/
- line.obj=line.obj.split(@rgx_splitlist).join(' ') #%take in word or other match
- for word in line.obj.scan(@rgx_scanlist) #%take in word or other match
- word=word.gsub(/#{Mx[:lnk_o]}|#{Mx[:lnk_c]}|#{Mx[:url_o]}|#{Mx[:url_c]}/,'').
- gsub(/#{Mx[:fa_o]}\S+?#{Mx[:fa_o_c]}/,'').
- gsub(/#{Mx[:fa_c_o]}\S+?#{Mx[:fa_c]}/,'').
- gsub(/#{Mx[:gl_o]}#[a-z]+#{Mx[:gl_c]}/,'').
- gsub(/#{Mx[:gl_o]}#[0-9]+#{Mx[:gl_c]}/,'').
- gsub(/^\S$/,'')
- word=nil if word.empty?
- word=nil if word =~@rxp_excluded0 #watch
- word=nil if word =~@rxp_excluded1 #watch
- word=nil if word =~/^\S$/
- if word
- word=word.gsub(/#{Mx[:br_nl]}|#{Mx[:br_line]}/,' ').
- gsub(/#{Mx[:fa_o]}[a-z]{1,7}#{Mx[:fa_o_c]}|#{Mx[:fa_c_o]}[a-z]{1,7}#{Mx[:fa_c]}/,'').
- gsub(/#{Mx[:mk_o]}(?:[0-9a-f]{32}:[0-9a-f]{32}|[0-9a-f]{64}:[0-9a-f]{64})#{Mx[:mk_c]}/,'').
- gsub(/#{Mx[:mk_o]}(?:[0-9a-f]{32}|[0-9a-f]{64})#{Mx[:mk_c]}/,'').
- gsub(/#{Mx[:en_a_o]}(?:\d|[*+])*|#{Mx[:en_b_o]}(?:\d|[*+])*|#{Mx[:en_a_c]}|#{Mx[:en_b_c]}/mi,'').
- gsub(/#{Mx[:fa_o]}\S+?#{Mx[:fa_o_c]}/,'').gsub(/#{Mx[:fa_c_o]}\S+?#{Mx[:fa_c]}/,'').
- gsub(/<\/?\S+?>/,'').
- gsub(/^\@+/,'').
- strip.
- gsub(/#{Mx[:tc_p]}.+/,'').
- gsub(/[\.,;:"]$/,'').
- gsub(/["]/,'').
- gsub(/^\s*[\(]/,'').
- gsub(/[\(]\s*$/,'').
- gsub(/^(?:See|e\.?g\.?).+/,'').
- gsub(/^\s*[.,;:]\s*/,'').
- strip.
- gsub(/^\(?[a-zA-Z]\)$/,'').
- gsub(/^\d+(st|nd|rd|th)$/,'').
- gsub(/^(\d+\.?)+$/, '').
- gsub(/#{Mx[:mk_o]}|#{Mx[:mk_c]}/,'').
- gsub(/:name#\S+/,'').
- gsub(/^\S$/,'')
- word=nil if word =~/^\S$/
- word=nil if word =~/^\s*$/ #watch
- if word
- unless word =~/[A-Z][A-Z]/ \
- or word =~/\w+\s\w+/
- word=word.capitalize
- end
- @freq[word] +=1
- @word_map[word] ||= []
- if line !~@rxp_lv1 \
- and line !~@rxp_lv2 \
- and line !~@rxp_lv3
- @word_map[word] << location_seg("#{@seg}\##{toy}",toy)
- else
- @word_map[word] << case line
- when @rxp_lv1; location_seg('T1',toy)
- when @rxp_lv2; location_seg('T2',toy)
- when @rxp_lv3; location_seg('T3',toy)
- end
- end
- end
- end
- end
- end
- end
- end
- seg=''
- @file_concordance << SiSU_EPUB_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 << '
}
- for word in @freq.keys.sort! {|a,b| a.downcase<=>b.downcase}
- f=/^(\S)/.match(word)[1]
- if letter < f.upcase
- while letter < f.upcase
- if alph.length > 0
- letter=alph.shift
- @file_concordance << %{\n