diff options
Diffstat (limited to 'lib')
134 files changed, 1831 insertions, 1447 deletions
diff --git a/lib/sisu/v4/dal_doc_str.rb b/lib/sisu/v4/dal_doc_str.rb index f9dd4954..96e1ac5d 100644 --- a/lib/sisu/v4/dal_doc_str.rb +++ b/lib/sisu/v4/dal_doc_str.rb @@ -813,7 +813,7 @@ module SiSU_DAL_DocumentStructureExtract when /2/ '1' when /3/ - '3' + '2' end end def possible_children(parent) diff --git a/lib/sisu/v4/epub_format.rb b/lib/sisu/v4/epub_format.rb index 9873c96f..4a060806 100644 --- a/lib/sisu/v4/epub_format.rb +++ b/lib/sisu/v4/epub_format.rb @@ -1225,7 +1225,7 @@ module SiSU_EPUB_Format x=x.gsub(/ /,' ') if Ep[:alt]==:on x.gsub(/&/,'&'). gsub(/</,"<").gsub(/>/,">"). - gsub(/#{Dx[:url_o]}/,Dx[:url_o_xml]).gsub(/#{Dx[:url_c]}/,Dx[:url_o_xml]). + gsub(/#{Dx[:url_o]}/,Dx[:url_o_xml]).gsub(/#{Dx[:url_c]}/,Dx[:url_c_xml]). #gsub(/</,'<').gsub(/>/,'>'). gsub(/\\\\/,'<br />'). gsub(/<br(?: \/)?>/,'<br />') diff --git a/lib/sisu/v4/epub_tune.rb b/lib/sisu/v4/epub_tune.rb index 45291ca8..dd9f478d 100644 --- a/lib/sisu/v4/epub_tune.rb +++ b/lib/sisu/v4/epub_tune.rb @@ -156,7 +156,7 @@ module SiSU_EPUB_Tune gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>'). # tt, kbd gsub(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,''). gsub(/#{Mx[:gl_bullet]}/m,"●#{$ep[:hsp]*2}"). - gsub(/#{Dx[:url_o]}/,Dx[:url_o_xml]).gsub(/#{Dx[:url_c]}/,Dx[:url_o_xml]). + gsub(/#{Dx[:url_o]}/,Dx[:url_o_xml]).gsub(/#{Dx[:url_c]}/,Dx[:url_c_xml]). gsub(/#{Mx[:nbsp]}/,$ep[:hsp]). gsub(/<(p|br)>/,'<\1 />') dob.obj=SiSU_EPUB_Tune::CleanXHTML.new(dob.obj).clean diff --git a/lib/sisu/v4/html.rb b/lib/sisu/v4/html.rb index 1dda9aae..7acb279a 100644 --- a/lib/sisu/v4/html.rb +++ b/lib/sisu/v4/html.rb @@ -329,7 +329,7 @@ WOK and link !~/#/ #% keep eye on link SiSU_HTML_Format::ParagraphNumber.new(@md,link) end - title=if dob.obj !~/Metadata/ then linkname + title=if dob.obj !~/^Metadata$/; linkname else link='metadata' %{<b><a href="#{link}#{@md.lang_code_insert}#{Sfx[:html]}">#{linkname}</a></b>} @@ -364,9 +364,7 @@ WOK end txt_obj={ txt: title } format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj) - toc[:scr]=if dob.name =~/^meta/ \ - and dob.obj =~/Document Information/ - format_toc.lev0 + toc[:scr]=if dob.obj =~/^Metadata$/; '' else format_toc.lev1 end toc diff --git a/lib/sisu/v4/manifest.rb b/lib/sisu/v4/manifest.rb index d86830e4..db409f46 100644 --- a/lib/sisu/v4/manifest.rb +++ b/lib/sisu/v4/manifest.rb @@ -757,7 +757,7 @@ WOK metadata(id,info) end if @md.sisu_version - id,info=@translate.sisu_version,"#{@md.sisu_version[:project]} #{@md.sisu_version[:version]} #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" + id,info=@translate.sisu_version,"#{@md.sisu_version[:project]} #{@md.sisu_version[:version]} #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})#{@md.sisu_version[:install_method]}" metadata(id,info) end if @md.ruby_version diff --git a/lib/sisu/v4/screen_text_color.rb b/lib/sisu/v4/screen_text_color.rb index 5e395133..304a677a 100644 --- a/lib/sisu/v4/screen_text_color.rb +++ b/lib/sisu/v4/screen_text_color.rb @@ -216,7 +216,7 @@ module SiSU_Screen STDERR.puts "\t #{@cX.grey}#{@txt[0]}#{@cX.off} #{@cX.fuchsia}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}" end def version - puts "#{@cX.blue_hi}#{@txt[0]} #{@txt[1]}#{@cX.off} #{@cX.grey} (#{@txt[3]} [#{@txt[2]}]) &#{@cX.off} #{@cX.ruby}Ruby#{@cX.off} #{@cX.grey}(#{@txt[4]})#{@cX.off}\n" + puts "#{@cX.blue_hi}#{@txt[0]} #{@txt[1]}#{@cX.off} #{@cX.grey} (#{@txt[3]} [#{@txt[2]}])#{@txt[4]} &#{@cX.off} #{@cX.ruby}Ruby#{@cX.off} #{@cX.grey}(#{@txt[5]})#{@cX.off}\n" end def html3numbers puts %{\t#{@cX.green}#{@txt[0]}#{@cX.off} #{@cX.cyan}files processed#{@cX.off}. } + diff --git a/lib/sisu/v4/sysenv.rb b/lib/sisu/v4/sysenv.rb index c0598070..b216089d 100644 --- a/lib/sisu/v4/sysenv.rb +++ b/lib/sisu/v4/sysenv.rb @@ -797,7 +797,7 @@ module SiSU_Env ? (system(%{ echo "#{@input}" | #{program} -s 3 -o #{@output} })) - : (STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" if cmd =~/V/) + : (STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" if @cmd =~/V/) #found end def imagemagick #imagemagick is a image manipulation program @@ -3599,6 +3599,11 @@ WOK if File.exist?(yst_ver) @version=YAML::load(File::open(yst_ver)) #unless @@noyaml end + spec = Gem::Specification.find_by_name("sisu") + gem_root = spec.gem_dir + @version[:install_method]=(File.dirname(__FILE__.gsub(/\/lib\/sisu\/#{SiSU_version_dir}/,'')) == gem_root) \ + ? ' (ruby gem install)' + : '' @version end def rbversion @@ -3618,7 +3623,7 @@ WOK @color.cmd else '-v' end - SiSU_Screen::Ansi.new(opt_cmd,version[:project],version[:version],version[:date_stamp],version[:date],rb_ver).version + SiSU_Screen::Ansi.new(opt_cmd,version[:project],version[:version],version[:date_stamp],version[:date],version[:install_method],rb_ver).version else puts 'SiSU (version information not available)' end end diff --git a/lib/sisu/v5/air.rb b/lib/sisu/v5/air.rb index a6636fe9..12ec9ed6 100644 --- a/lib/sisu/v5/air.rb +++ b/lib/sisu/v5/air.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/ao.rb b/lib/sisu/v5/ao.rb index 7c367980..2a02ad63 100644 --- a/lib/sisu/v5/ao.rb +++ b/lib/sisu/v5/ao.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/ao_character_check.rb b/lib/sisu/v5/ao_character_check.rb index 86f23f5b..ef45679a 100644 --- a/lib/sisu/v5/ao_character_check.rb +++ b/lib/sisu/v5/ao_character_check.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/ao_doc_objects.rb b/lib/sisu/v5/ao_doc_objects.rb index 556304d4..70696d37 100644 --- a/lib/sisu/v5/ao_doc_objects.rb +++ b/lib/sisu/v5/ao_doc_objects.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -107,36 +108,38 @@ module SiSU_AO_DocumentStructure end def heading_ln(lv) case lv - when /A/; 1 - when /B/; 2 - when /C/; 3 - when /1/; 4 - when /2/; 5 - when /3/; 6 - when /4/; 7 - when /5/; 8 - when /6/; 9 + when /A/ then 0 + when /B/ then 1 + when /C/ then 2 + when /D/ then 3 + when /1/ then 4 + when /2/ then 5 + when /3/ then 6 + when /4/ then 7 + when /5/ then 8 + when /6/ then 9 end end def heading_lv(ln) case ln.to_s - when /1/; 'A' - when /2/; 'B' - when /3/; 'C' - when /4/; '1' - when /5/; '2' - when /6/; '3' - when /7/; '4' - when /8/; '5' - when /9/; '6' + when /0/ then 'A' + when /1/ then 'B' + when /2/ then 'C' + when /3/ then 'D' + when /4/ then '1' + when /5/ then '2' + when /6/ then '3' + when /7/ then '4' + when /8/ then '5' + when /9/ then '6' end end def heading(h,o=nil) if not h[:ln] \ - and (h[:lv] and h[:lv]=~/[1-6A-C]/) + and (h[:lv] and h[:lv]=~/[1-6A-D]/) h[:ln]=heading_ln(h[:lv]) elsif not h[:lv] \ - and (h[:ln] and h[:ln].to_s=~/[1-9]/) + and (h[:ln] and h[:ln].to_s=~/[0-9]/) h[:lv]=heading_lv(h[:ln]) end of= @of #String, classification - group @@ -150,7 +153,7 @@ module SiSU_AO_DocumentStructure osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) node= h[:node] || ((defined? o.node) ? o.node : nil) #[Node relationship doc structure info] parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] - lv= h[:lv] || ((defined? o.lv) ? o.lv : nil) #Alpha-numeric, document structure as used in markup, A-C then 1-6 + lv= h[:lv] || ((defined? o.lv) ? o.lv : nil) #Alpha-numeric, document structure as used in markup, A-D then 1-6 ln= h[:ln] || ((defined? o.ln) ? o.ln : nil) #Integer, document structure level, for convenience in processing 1-9 lc= h[:lc] || ((defined? o.lc) ? o.lc : nil) #Integer, document structure collapsed level, convenience (collapse sisu's dual level document structure for markup with simple linear structure) toc_= h[:toc_] || ((defined? o.toc_) ? o.toc_ : false) #Bool, do not include in toc, (relevant to headings) @@ -400,7 +403,7 @@ module SiSU_AO_DocumentStructure of= @of #String, classification - group is= :xml_dom #String, classification - specific type obj= h[:obj] || ((defined? o.obj) ? o.obj : '') #String, text content - lv= h[:lv] || ((defined? o.lv) ? o.lv : nil) #Alpha-numeric, document structure as used in markup, A-C then 1-6 + lv= h[:lv] || ((defined? o.lv) ? o.lv : nil) #Alpha-numeric, document structure as used in markup, A-D then 1-6 ln= h[:ln] || ((defined? o.ln) ? o.ln : nil) #Integer, document structure level, for convenience in processing 1-9 lc= h[:lc] || ((defined? o.lc) ? o.lc : nil) #Integer, document structure collapsed level, convenience (collapse sisu's dual level document structure for markup with simple linear structure) node= h[:node] || ((defined? o.node) ? o.node : nil) #[Node relationship doc structure info] diff --git a/lib/sisu/v5/ao_doc_str.rb b/lib/sisu/v5/ao_doc_str.rb index 465a5666..31479252 100644 --- a/lib/sisu/v5/ao_doc_str.rb +++ b/lib/sisu/v5/ao_doc_str.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -96,15 +97,16 @@ module SiSU_AO_DocumentStructureExtract end def ln_get(lv) case lv - when /A/; 1 - when /B/; 2 - when /C/; 3 - when /1/; 4 - when /2/; 5 - when /3/; 6 - when /4/; 7 - when /5/; 8 - when /6/; 9 + when /A/ then 0 + when /B/ then 1 + when /C/ then 2 + when /D/ then 3 + when /1/ then 4 + when /2/ then 5 + when /3/ then 6 + when /4/ then 7 + when /5/ then 8 + when /6/ then 9 end end def image_test(str) @@ -274,10 +276,10 @@ module SiSU_AO_DocumentStructureExtract SiSU_AO_DocumentStructure::ObjectComment.new.comment(h) else nil end - when /^:?([A-C1-6])\~/ #heading / lv + when /^:?([A-D1-6])\~/ #heading / lv lv=$1 ln=ln_get(lv) - t_o=if t_o=~/^:?[A-C1-6]\~\s+(.+)/m + t_o=if t_o=~/^:?[A-D1-6]\~\s+(.+)/m obj=$1 note=endnote_test?(obj) obj,tags=extract_tags(obj) @@ -293,7 +295,7 @@ module SiSU_AO_DocumentStructureExtract end h={ lv: lv, ln: ln, obj: obj, idx: idx, tags: tags } SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h) - elsif t_o=~/^:?[A-C1-6]\~(\S+?)-\s+(.+)/m + elsif t_o=~/^:?[A-D1-6]\~(\S+?)-\s+(.+)/m name,obj=$1,$2 note=endnote_test?(obj) obj,tags=extract_tags(obj) @@ -309,7 +311,7 @@ module SiSU_AO_DocumentStructureExtract end h={ lv: lv, name: name, obj: obj, idx: idx, autonum_: false, tags: tags} SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h) - elsif t_o=~/^:?[A-C1-6]\~(\S+)\s+(.+)/m + elsif t_o=~/^:?[A-D1-6]\~(\S+)\s+(.+)/m name,obj=$1,$2 note=endnote_test?(obj) obj,tags=extract_tags(obj,name) @@ -400,8 +402,8 @@ module SiSU_AO_DocumentStructureExtract elsif @@flag[:code]==:off if t_o =~/^(?:code\{|[`]{3}\s+code)/ @@flag[:code]=case t_o - when /^code\{/; :curls - when /^[`]{3}\s+code/; :tics + when /^code\{/ then :curls + when /^[`]{3}\s+code/ then :tics else @@flag[:code] #error end @@counter=1 @@ -410,8 +412,8 @@ module SiSU_AO_DocumentStructureExtract t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h) elsif t_o =~/^(?:poem\{|[`]{3}\s+poem)/ @@flag[:poem]=case t_o - when /^poem\{/; :curls - when /^[`]{3}\s+poem/; :tics + when /^poem\{/ then :curls + when /^[`]{3}\s+poem/ then :tics else @@flag[:poem] #error end h={ obj: 'poem start' } #introduce a counter @@ -419,8 +421,8 @@ module SiSU_AO_DocumentStructureExtract tuned_file << t_o elsif t_o =~/^(?:group\{|[`]{3}\s+group)/ @@flag[:group]=case t_o - when /^group\{/; :curls - when /^[`]{3}\s+group/; :tics + when /^group\{/ then :curls + when /^[`]{3}\s+group/ then :tics else @@flag[:group] #error end h={ obj: 'group text start' } #introduce a counter @@ -428,8 +430,8 @@ module SiSU_AO_DocumentStructureExtract tuned_file << t_o elsif t_o =~/^(?:block\{|[`]{3}\s+block)/ @@flag[:block]=case t_o - when /^block\{/; :curls - when /^[`]{3}\s+block/; :tics + when /^block\{/ then :curls + when /^[`]{3}\s+block/ then :tics else @@flag[:block] #error end h={ obj: 'block text start' } #introduce a counter @@ -437,8 +439,8 @@ module SiSU_AO_DocumentStructureExtract tuned_file << t_o elsif t_o =~/^(?:alt\{|[`]{3}\s+alt)/ @@flag[:alt]=case t_o - when /^alt\{/; :curls - when /^[`]{3}\s+alt/; :tics + when /^alt\{/ then :curls + when /^[`]{3}\s+alt/ then :tics else @@flag[:alt] #error end h={ obj: 'alt text start' } #introduce a counter @@ -690,24 +692,24 @@ module SiSU_AO_DocumentStructureExtract end if @md.flag_endnotes tuned_file << @pb - h={ ln: 2, lc: 2, obj: 'Endnotes', autonum_: false } + h={ ln: 1, lc: 1, obj: 'Endnotes', autonum_: false } tuned_file << SiSU_AO_DocumentStructure::ObjectHeading.new.heading_insert(h) - h={ ln: 4, lc: 3, obj: 'Endnotes', name: 'endnotes', autonum_: false } + h={ ln: 4, lc: 2, obj: 'Endnotes', name: 'endnotes', autonum_: false } tuned_file << SiSU_AO_DocumentStructure::ObjectHeading.new.heading_insert(h) h={ obj: 'Endnotes' } end if @md.book_idx tuned_file << @pb - h={ ln: 2, lc: 2, obj: 'Index', autonum_: false } + h={ ln: 1, lc: 1, obj: 'Index', autonum_: false } tuned_file << SiSU_AO_DocumentStructure::ObjectHeading.new.heading_insert(h) - h={ ln: 4, lc: 3, obj: 'Index', name: 'book_index', autonum_: false } + h={ ln: 4, lc: 2, obj: 'Index', name: 'book_index', autonum_: false } tuned_file << SiSU_AO_DocumentStructure::ObjectHeading.new.heading_insert(h) h={ obj: 'Index' } end tuned_file << @pb - h={ ln: 2, lc: 2, obj: 'Metadata', autonum_: false, ocn_: false } + h={ ln: 1, lc: 1, obj: 'Metadata', autonum_: false, ocn_: false } tuned_file << SiSU_AO_DocumentStructure::ObjectHeading.new.heading_insert(h) - h={ ln: 4, lc: 3, obj: 'SiSU Metadata, document information', name: 'metadata', autonum_: false, ocn_: false } + h={ ln: 4, lc: 2, obj: 'SiSU Metadata, document information', name: 'metadata', autonum_: false, ocn_: false } tuned_file << SiSU_AO_DocumentStructure::ObjectHeading.new.heading_insert(h) h={ obj: 'eof' } meta=SiSU_AO_DocumentStructure::ObjectMetadata.new.metadata(@metadata) @@ -767,14 +769,17 @@ module SiSU_AO_DocumentStructureExtract || (@dob.hang != @dob.indent)) \ and not @dob.bullet_ @dob=case @dob.obj + when /^#{@md.lv0}/ + h={ lv: 'A', ln: 0 } + SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob) when /^#{@md.lv1}/ - h={ lv: 'A', ln: 1 } + h={ lv: 'B', ln: 1 } SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob) when /^#{@md.lv2}/ - h={ lv: 'B', ln: 2 } + h={ lv: 'C', ln: 2 } SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob) when /^#{@md.lv3}/ - h={ lv: 'C', ln: 3 } + h={ lv: 'D', ln: 3 } SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob) when /^#{@md.lv4}/ h={ lv: '1', ln: 4 } @@ -798,38 +803,28 @@ module SiSU_AO_DocumentStructureExtract end def structure_info def lv - %w[0 A~ B~ C~ 1 2 3] + %w[A~ B~ C~ D~ 1 2 3] end def possible_parents(child) case child - when /A~/ - 'none' - when /B~/ - 'A~' - when /C~/ - 'B~' - when /1/ - 'A~, B~, C~' - when /2/ - '1' - when /3/ - '3' + when /A~/ then 'none' + when /B~/ then 'A~' + when /C~/ then 'B~' + when /D~/ then 'C~' + when /1/ then 'A~, B~, C~, D~' + when /2/ then '1' + when /3/ then '2' end end def possible_children(parent) case parent - when /A~/ - 'B~, 1' - when /B~/ - 'C~, 1' - when /C~/ - '1' - when /1/ - '2' - when /2/ - '3' - when /3/ - 'none' + when /A~/ then 'B~, 1' + when /B~/ then 'C~, 1' + when /C~/ then 'D~, 1' + when /D~/ then '1' + when /1/ then '2' + when /2/ then '3' + when /3/ then 'none' end end self @@ -857,11 +852,11 @@ has incorrect level and/or parent level} def ocn #and auto segment numbering increment data=@data @o_array=[] - node=ocn=ocn_dv=ocn_sp=ocnh=ocnh1=ocnh2=ocnh3=ocnh4=ocnh5=ocnh6=ocno=ocnp=ocnt=ocnc=ocng=ocni=ocnu=0 # h heading, o other, t table, g group, i image + node=ocn=ocn_dv=ocn_sp=ocnh=ocnh0=ocnh1=ocnh2=ocnh3=ocnh4=ocnh5=ocnh6=ocno=ocnp=ocnt=ocnc=ocng=ocni=ocnu=0 # h heading, o other, t table, g group, i image regex_exclude_ocn_and_node = /#{Rx[:meta]}|^@\S+?:\s|^4~endnotes|^#{Mx[:lv_o]}4:endnotes#{Mx[:lv_c]}|^\^~ |<:e[:_]\d+?>|^<:\#|<:- |<[:!]!4|<hr width|#{Mx[:br_endnotes]}|\A\s*\Z/mi #ocn here # added with Tune.code #¡ parent=node1=node2=node3=node4=node5=node6=nil node0='0:0;0' - @collapsed_lv1=1 + @collapsed_lv0=0 data.each do |dob| h={} if (dob.obj !~ regex_exclude_ocn_and_node || dob.is==:code) \ @@ -872,22 +867,24 @@ has incorrect level and/or parent level} #dob.ln now is determined, and set earlier, check how best to remove this --> if dob.is==:heading ln=case dob.lv - when 'A'; 1 - when 'B'; 2 - when 'C'; 3 - when '1'; 4 - when '2'; 5 - when '3'; 6 - when '4'; 7 - when '5'; 8 - when '6'; 9 + when 'A' then 0 + when 'B' then 1 + when 'C' then 2 + when 'D' then 3 + when '1' then 4 + when '2' then 5 + when '3' then 6 + when '4' then 7 + when '5' then 8 + when '6' then 9 end end if not dob.obj =~/~#|-#/ ocn+=1 end if dob.is==:heading \ - and (ln.to_s =~/^[1-9]/ \ + and (ln.to_s =~/^[0-9]/ \ + or ln.to_s =~@md.lv0 \ or ln.to_s =~@md.lv1 \ or ln.to_s =~@md.lv2 \ or ln.to_s =~@md.lv3 \ @@ -897,7 +894,21 @@ has incorrect level and/or parent level} if not dob.obj =~/~#|-#/ ocnh+=1 end - if ln==1 \ + if ln==0 \ + or ln=~@md.lv0 + if not dob.obj =~/~#|-#/ + ocn_flag=true + ocnh0+=1 #heading + node0="0:#{ocnh0};#{ocn}" + else + ocn_flag=false + node0="0:0;0" + end + document_structure_check_info(node0,node0) + @collapsed_lv0=0 + collapsed_level=@collapsed_lv0 + node,ocn_sp,parent=node0,"h#{ocnh}",'ROOT' + elsif ln==1 \ or ln=~@md.lv1 if not dob.obj =~/~#|-#/ ocn_flag=true @@ -907,8 +918,14 @@ has incorrect level and/or parent level} ocn_flag=false node1="1:0;0" end - document_structure_check_info(node1,node0) - @collapsed_lv1=1 + parent=if node0 + document_structure_check_info(node1,node0) + @collapsed_lv1=@collapsed_lv0+1 + node0 + else + document_structure_check_info(node0,node0,:error) + node0 + end collapsed_level=@collapsed_lv1 node,ocn_sp,parent=node1,"h#{ocnh}",node0 #FIX elsif ln==2 \ @@ -982,6 +999,10 @@ or this level should be level :B~ rather than #{dob.lv}} document_structure_check_info(node4,node1) @collapsed_lv4=@collapsed_lv1+1 node1 + elsif node0 + document_structure_check_info(node4,node0) + @collapsed_lv4=@collapsed_lv0+1 + node0 else warning_incorrect_parent_level_or_level(dob.obj) document_structure_check_info(node4,node0,:error) @@ -1155,10 +1176,11 @@ or this level should be 5~ rather #{dob.lv}" #level 6 @data,@md=data,md end def dom - @s=['0', + @s=[ 'A', 'B', 'C', + 'D', '1', '2', '3' @@ -1181,6 +1203,14 @@ or this level should be 5~ rather #{dob.lv}" #level 6 if o.is==:heading \ || o.is==:heading_insert case o.ln + when 0 + tuned_file << tag_close(o.ln,hs) + tuned_file << tag_open(o,@s) + if @md.opt.act[:verbose_plus][:set]==:on + puts_tag_close(o.ln,hs) + puts_tag_open(o,@s) + end + hs=[0,true,false,false,false] when 1 tuned_file << tag_close(o.ln,hs) tuned_file << tag_open(o,@s) @@ -1188,7 +1218,7 @@ or this level should be 5~ rather #{dob.lv}" #level 6 puts_tag_close(o.ln,hs) puts_tag_open(o,@s) end - hs=[1,true,false,false] + hs=[1,true,true,false,false] when 2 tuned_file << tag_close(o.ln,hs) tuned_file << tag_open(o,@s) @@ -1196,7 +1226,7 @@ or this level should be 5~ rather #{dob.lv}" #level 6 puts_tag_close(o.ln,hs) puts_tag_open(o,@s) end - hs=[2,true,true,false] + hs=[2,true,true,true,false] when 3 tuned_file << tag_close(o.ln,hs) tuned_file << tag_open(o,@s) @@ -1204,7 +1234,7 @@ or this level should be 5~ rather #{dob.lv}" #level 6 puts_tag_close(o.ln,hs) puts_tag_open(o,@s) end - hs=[3,true,true,true] + hs=[3,true,true,true,true] when 4 tuned_file << tag_close(o.ln,hs) tuned_file << tag_open(o,@s) @@ -1244,15 +1274,16 @@ or this level should be 5~ rather #{dob.lv}" #level 6 ? %{<#{o[:lv]} id="#{o[:node]}">} : "</#{o[:lv]}>" ln=case o[:lv] - when 'A'; 1 - when 'B'; 2 - when 'C'; 3 - when '1'; 4 - when '2'; 5 - when '3'; 6 - when '4'; 7 - when '5'; 8 - when '6'; 9 + when 'A' then 0 + when 'B' then 1 + when 'C' then 2 + when 'D' then 3 + when '1' then 4 + when '2' then 5 + when '3' then 6 + when '4' then 7 + when '5' then 8 + when '6' then 9 end h={ tag: tag, node: o[:node], lv: o[:lv], ln: ln, status: o[:status] } SiSU_AO_DocumentStructure::ObjectStructure.new.xml_dom(h) #downstream code utilise else ignore like comments @@ -1265,6 +1296,11 @@ or this level should be 5~ rather #{dob.lv}" #level 6 def tag_close(lev,hs) ary=[] case hs[0] + when 0 + if (lev <= 0) and hs[0] + t={ lv: @s[0], status: 'close' } + ary << tags(t) + end when 1 if (lev <= 1) and hs[1] t={ lv: @s[1], status: 'close' } @@ -1387,6 +1423,9 @@ or this level should be 5~ rather #{dob.lv}" #level 6 end def puts_tag_close(lev,hs) case hs[0] + when 0 + #puts "#{@sp*0}</#{@s[0]}>" if (lev <= 0) and hs[0] + puts "</#{@s[0]}>" if (lev==0) when 1 puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1] puts "</#{@s[0]}>" if (lev==0) diff --git a/lib/sisu/v5/ao_endnotes.rb b/lib/sisu/v5/ao_endnotes.rb index 981c97f6..a662370c 100644 --- a/lib/sisu/v5/ao_endnotes.rb +++ b/lib/sisu/v5/ao_endnotes.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/ao_expand_insertions.rb b/lib/sisu/v5/ao_expand_insertions.rb index 44ae1f60..60117e1d 100644 --- a/lib/sisu/v5/ao_expand_insertions.rb +++ b/lib/sisu/v5/ao_expand_insertions.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -67,12 +68,12 @@ module SiSU_AO_Insertions def output_filetypes_in_cmd(cmd_shortcut,lnk=nil) #make list of file types in shortcut command (as configured), e.g. when sisu -3 is used cf_defaults=SiSU_Env::InfoProcessingFlag.new cmd_list=case cmd_shortcut.inspect - when /0/; cf_defaults.cf_0 - when /1/; cf_defaults.cf_1 - when /2/; cf_defaults.cf_2 - when /3/; cf_defaults.cf_3 - when /4/; cf_defaults.cf_4 - when /5/; cf_defaults.cf_5 + when /0/ then cf_defaults.cf_0 + when /1/ then cf_defaults.cf_1 + when /2/ then cf_defaults.cf_2 + when /3/ then cf_defaults.cf_3 + when /4/ then cf_defaults.cf_4 + when /5/ then cf_defaults.cf_5 end file_type_names={} file_type_names[:gen],file_type_names[:src]=[],[] diff --git a/lib/sisu/v5/ao_hash_digest.rb b/lib/sisu/v5/ao_hash_digest.rb index e1cc840c..585ff659 100644 --- a/lib/sisu/v5/ao_hash_digest.rb +++ b/lib/sisu/v5/ao_hash_digest.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/ao_idx.rb b/lib/sisu/v5/ao_idx.rb index 94e3aff6..aa5f6609 100644 --- a/lib/sisu/v5/ao_idx.rb +++ b/lib/sisu/v5/ao_idx.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -141,7 +142,7 @@ module SiSU_AO_BookIndex o=SiSU_AO_DocumentStructure::ObjectLayout.new.break(h) idx[:sst_rel_html_seg] << o idx[:sst_rel] << o - h={lv: '2', name: 'index', obj: "Index"} + h={lv: '1', name: 'index', obj: "Index"} o=SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h) idx[:sst_rel_html_seg] << o idx[:sst_rel] << o diff --git a/lib/sisu/v5/ao_images.rb b/lib/sisu/v5/ao_images.rb index 4354dfa9..ab42034d 100644 --- a/lib/sisu/v5/ao_images.rb +++ b/lib/sisu/v5/ao_images.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/ao_metadata.rb b/lib/sisu/v5/ao_metadata.rb index 8d017769..c51c40dc 100644 --- a/lib/sisu/v5/ao_metadata.rb +++ b/lib/sisu/v5/ao_metadata.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/ao_misc_arrange.rb b/lib/sisu/v5/ao_misc_arrange.rb index 8f7acbc4..caf3326c 100644 --- a/lib/sisu/v5/ao_misc_arrange.rb +++ b/lib/sisu/v5/ao_misc_arrange.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -66,7 +67,7 @@ module SiSU_AO_MiscArrangeText 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 + gsub(/^((?:[1-9]|:?[A-D])~\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") diff --git a/lib/sisu/v5/ao_numbering.rb b/lib/sisu/v5/ao_numbering.rb index 00afdfa5..8caa5ccc 100644 --- a/lib/sisu/v5/ao_numbering.rb +++ b/lib/sisu/v5/ao_numbering.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -97,9 +98,9 @@ module SiSU_AO_Numbering 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} ") + when /-/ then dob.obj.gsub(/^/,"#{title_no} ") + when /^#/ then dob.obj.gsub(/^/,"#{title_no} ") + when /^[a-z_\.]+/ then 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 @@ -157,7 +158,7 @@ module SiSU_AO_Numbering @subnumber=1 @subnumber=0 if dob.ln==no1 end - if dob.ln.to_s =~/^[1-6]/ \ + if dob.ln.to_s =~/^[0-6]/ \ and not dob.toc_ \ and dob.obj !~/#{Mx[:fa_o]}(?:~#|-#)#{Mx[:fa_c]}/ # <-- fix if dob.ln==no1 @@ -205,7 +206,7 @@ module SiSU_AO_Numbering 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]/ \ + elsif dob.ln.to_s =~/^[0-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') @@ -215,7 +216,7 @@ module SiSU_AO_Numbering 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.ln.to_s =~/^[0-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 @@ -249,7 +250,7 @@ module SiSU_AO_Numbering || 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) + and dob.ln.to_s=~/^[0-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]/ \ @@ -372,7 +373,7 @@ module SiSU_AO_Numbering : @segname tags["#{dob.ocn}"]={ segname: @segname } ocn_html_seg[dob.ocn]=if (dob.is==:heading || dob.is==:heading_insert) - if dob.ln =~/[1-3]/ + if dob.ln =~/[0-3]/ { seg: nil, level: dob.ln } else #elsif dob.ln =~/[4-6]/ { seg: @seg, level: dob.ln } @@ -445,7 +446,7 @@ module SiSU_AO_Numbering @tuned_file=[] data.each do |dob| unless @md.set_heading_seg - if defined? dob.ln and dob.ln.to_s !~/^[123]/m \ + if defined? dob.ln and dob.ln.to_s !~/^[0-3]/m \ and dob.obj !~/\A\s*\Z/m \ and dob.is !=:layout @md.set_heading_seg=true diff --git a/lib/sisu/v5/ao_syntax.rb b/lib/sisu/v5/ao_syntax.rb index 22e0124c..cdcb3883 100644 --- a/lib/sisu/v5/ao_syntax.rb +++ b/lib/sisu/v5/ao_syntax.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -411,7 +412,7 @@ module SiSU_AO_Syntax 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 + and dob.ln ==0 dob.obj=dob.obj.gsub(/\s*@title\b/," #{@md.title.full}") dob.obj=if defined? @md.creator.author \ and @md.creator.author diff --git a/lib/sisu/v5/author_format.rb b/lib/sisu/v5/author_format.rb index 3a9d49a6..3bda7904 100644 --- a/lib/sisu/v5/author_format.rb +++ b/lib/sisu/v5/author_format.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/cgi.rb b/lib/sisu/v5/cgi.rb index 1c0e023a..cd0175b5 100644 --- a/lib/sisu/v5/cgi.rb +++ b/lib/sisu/v5/cgi.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/cgi_pgsql.rb b/lib/sisu/v5/cgi_pgsql.rb index be23f6d2..33e43b46 100644 --- a/lib/sisu/v5/cgi_pgsql.rb +++ b/lib/sisu/v5/cgi_pgsql.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -166,7 +167,7 @@ module SiSU_CGI_PgSQL # set file permissions to 755 WOK a=case @webserv - when /pwd/; '' + when /pwd/ then '' else <<-WOK sudo cp -vi #{Dir.pwd}/#{@cgi_file_name} /usr/lib/cgi-bin/.; \\ diff --git a/lib/sisu/v5/cgi_sql_common.rb b/lib/sisu/v5/cgi_sql_common.rb index 0944ab61..42c648e0 100644 --- a/lib/sisu/v5/cgi_sql_common.rb +++ b/lib/sisu/v5/cgi_sql_common.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -82,7 +83,7 @@ module SiSU_CGI_SQL * Author: Ralph Amissah - * Copyright: (C) 1997 - 2013, Ralph Amissah, All Rights Reserved. + * Copyright: (C) 1997 - 2014, Ralph Amissah, All Rights Reserved. * License: GPL 3 or later: @@ -572,7 +573,7 @@ module SiSU_CGI_SQL <br /> <a href="http://www.sisudoc.org" > <b>#{v[:project]}</b></a> <sup>©</sup> Ralph Amissah - 1993, current 2013. + 1993, current 2014. All Rights Reserved. <br /> #{v[:project]} is software for document structuring, publishing and search, @@ -610,7 +611,7 @@ module SiSU_CGI_SQL <br />Standard SiSU meta-markup syntax, and the <br />Standard SiSU <u>object citation numbering</u> and system, (object/text identifying/locating system) <br /> - <sup>©</sup> Ralph Amissah 1997, current 2013. + <sup>©</sup> Ralph Amissah 1997, current 2014. All Rights Reserved. </font></p> </td></tr> diff --git a/lib/sisu/v5/cgi_sqlite.rb b/lib/sisu/v5/cgi_sqlite.rb index d2d6eb28..8ebe0c16 100644 --- a/lib/sisu/v5/cgi_sqlite.rb +++ b/lib/sisu/v5/cgi_sqlite.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -99,13 +100,13 @@ module SiSU_CGI_SQLite end f2 << %{ selected_db=case cgi['db']\n} serve.each do |x| - f2 << %{ when /#{Db[:name_prefix]}#{x}/; '<option value="#{Db[:name_prefix]}#{x}">#{x}</option>'\n} + f2 << %{ when /#{Db[:name_prefix]}#{x}/ then '<option value="#{Db[:name_prefix]}#{x}">#{x}</option>'\n} end f2 << " end\n" f3 << %{ db_name='#{@name_of_sqlite_db_file}'\n} f3 << %{ db_sqlite=case cgi['db']\n} serve.each do |x| - f3 << %{ when /#{Db[:name_prefix]}#{x}/; "#{@env.path.webserv}/#{x}/\#{db_name}"\n} + f3 << %{ when /#{Db[:name_prefix]}#{x}/ then "#{@env.path.webserv}/#{x}/\#{db_name}"\n} end f3 << %{ else '#{@env.path.webserv}/#{serve[0]}/\#{db_name}'\n end\n} if FileTest.writable?('.') @@ -138,7 +139,7 @@ module SiSU_CGI_SQLite # set file permissions to 755 WOK a=case @webserv - when /pwd/; '' + when /pwd/ then '' else <<-WOK sudo cp -vi #{Dir.pwd}/#{@cgi_file_name} /usr/lib/cgi-bin/.; \\ diff --git a/lib/sisu/v5/composite.rb b/lib/sisu/v5/composite.rb index 822121ae..c1457779 100644 --- a/lib/sisu/v5/composite.rb +++ b/lib/sisu/v5/composite.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/concordance.rb b/lib/sisu/v5/concordance.rb index 3bb313d4..55892ab7 100644 --- a/lib/sisu/v5/concordance.rb +++ b/lib/sisu/v5/concordance.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -326,9 +327,9 @@ WOK end else @word_map[word] << case line - when @rxp_lv1; location_seg('T1',ocn) #fix @rxp_lv # Mx[:lv_o] - when @rxp_lv2; location_seg('T2',ocn) #fix @rxp_lv # Mx[:lv_o] - when @rxp_lv3; location_seg('T3',ocn) #fix @rxp_lv # Mx[:lv_o] + when @rxp_lv1 then location_seg('T1',ocn) #fix @rxp_lv # Mx[:lv_o] + when @rxp_lv2 then location_seg('T2',ocn) #fix @rxp_lv # Mx[:lv_o] + when @rxp_lv3 then location_seg('T3',ocn) #fix @rxp_lv # Mx[:lv_o] end end end diff --git a/lib/sisu/v5/conf.rb b/lib/sisu/v5/conf.rb index 57e9614b..1365a90e 100644 --- a/lib/sisu/v5/conf.rb +++ b/lib/sisu/v5/conf.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/constants.rb b/lib/sisu/v5/constants.rb index da9858f2..1b7cccea 100644 --- a/lib/sisu/v5/constants.rb +++ b/lib/sisu/v5/constants.rb @@ -9,7 +9,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -61,7 +62,7 @@ =end #Ax,Xx,Mx,Rx,Hx,Dx,Px,Ep,Db,Gt,Tex=Array.new(11){{}} -YEAR='2013' +YEAR='2014' Sfx={ txt: '.txt', txt_textile: '.textile', diff --git a/lib/sisu/v5/css.rb b/lib/sisu/v5/css.rb index 8d02f20d..676290d8 100644 --- a/lib/sisu/v5/css.rb +++ b/lib/sisu/v5/css.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/db_columns.rb b/lib/sisu/v5/db_columns.rb index 5223aed8..0b06e212 100644 --- a/lib/sisu/v5/db_columns.rb +++ b/lib/sisu/v5/db_columns.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/db_create.rb b/lib/sisu/v5/db_create.rb index 15cf8586..4de362c5 100644 --- a/lib/sisu/v5/db_create.rb +++ b/lib/sisu/v5/db_create.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -235,6 +236,7 @@ module SiSU_DbCreate seg VARCHAR(256) NULL, lev_an VARCHAR(1), lev SMALLINT NULL, + lev0 SMALLINT, lev1 SMALLINT, lev2 SMALLINT, lev3 SMALLINT, @@ -483,9 +485,9 @@ module SiSU_DbCreate %{COMMENT ON COLUMN doc_objects.metadata_tid IS 'tie to title in metadata_and_text';}, %{COMMENT ON COLUMN doc_objects.lev_an - IS 'doc level A-C 1-6';}, + IS 'doc level A-D 1-6';}, %{COMMENT ON COLUMN doc_objects.lev - IS 'doc level 1-6 \d\~';}, + IS 'doc level 0-6 \d\~';}, %{COMMENT ON COLUMN doc_objects.seg IS 'segment name from level number 4 (lv 1)';}, %{COMMENT ON COLUMN doc_objects.ocn @@ -510,6 +512,8 @@ module SiSU_DbCreate IS 'text object - substantive text: light html markup';}, %{COMMENT ON COLUMN doc_objects.book_idx IS 'book index creation information for paragraph, if provided';}, + %{COMMENT ON COLUMN doc_objects.lev0 + IS 'document structure, level number 0';}, %{COMMENT ON COLUMN doc_objects.lev1 IS 'document structure, level number 1';}, %{COMMENT ON COLUMN doc_objects.lev2 diff --git a/lib/sisu/v5/db_dbi.rb b/lib/sisu/v5/db_dbi.rb index 85640b3a..05c44220 100644 --- a/lib/sisu/v5/db_dbi.rb +++ b/lib/sisu/v5/db_dbi.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/db_drop.rb b/lib/sisu/v5/db_drop.rb index 33029501..b1ff634e 100644 --- a/lib/sisu/v5/db_drop.rb +++ b/lib/sisu/v5/db_drop.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -158,6 +159,7 @@ module SiSU_DbDrop %{DROP INDEX idx_ocn;}, %{DROP INDEX idx_digest_clean;}, %{DROP INDEX idx_digest_all;}, + %{DROP INDEX idx_lev0;}, %{DROP INDEX idx_lev1;}, %{DROP INDEX idx_lev2;}, %{DROP INDEX idx_lev3;}, diff --git a/lib/sisu/v5/db_import.rb b/lib/sisu/v5/db_import.rb index dc73bbf5..8d9fc229 100644 --- a/lib/sisu/v5/db_import.rb +++ b/lib/sisu/v5/db_import.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -115,7 +116,7 @@ module SiSU_DbImport puts "#{__FILE__}:#{__LINE__}" if @opt.act[:maintenance][:set]==:on end @id_n =0 if @col[:lid].nil? or @col[:lid].to_s.empty? - @col[:lv1]=@col[:lv2]=@col[:lv3]=@col[:lv4]=@col[:lv5]=@col[:lv6]=0 + @col[:lv0]=@col[:lv1]=@col[:lv2]=@col[:lv3]=@col[:lv4]=@col[:lv5]=@col[:lv6]=0 @db=SiSU_Env::InfoDb.new @pdf_fn=SiSU_Env::FileOp.new(@md).base_filename @@dl ||=SiSU_Env::InfoEnv.new.digest.length @@ -151,7 +152,7 @@ module SiSU_DbImport puts @conn.driver_name if defined? @conn.driver_name puts @conn.driver if defined? @conn.driver end - begin + begin #% sql if @sql_type=~/sqlite/ @conn.transaction do |conn| t_d.each do |sql| @@ -309,8 +310,23 @@ module SiSU_DbImport notedata=data.obj.dup #% :headings if data.is==:heading \ - && (data.ln.inspect=~/[123]/) - @col[:lev],txt,@col[:ocn],@col[:lev_an],@col[:ocnd],@col[:ocns],@col[:t_of],@col[:t_is],@col[:node],@col[:parent],@col[:digest_clean],@col[:digest_all]=data.ln,data.obj,data.ocn,data.lv,data.odv,data.osp,data.of,data.is,data.node,data.parent,'','' + && (data.ln.inspect=~/[0-3]/) + ( + @col[:lev], + txt,@col[:ocn], + @col[:lev_an], + @col[:ocnd],@col[:ocns], + @col[:t_of],@col[:t_is], + @col[:node],@col[:parent], + @col[:digest_clean],@col[:digest_all]= + data.ln, + data.obj,data.ocn, + data.lv, + data.odv,data.osp, + data.of,data.is, + data.node,data.parent, + '','' + ) @col[:lid]+=1 txt=endnotes(txt).extract_any body=SiSU_FormatShared::CSS_Format.new(@md,data).lev4_minus @@ -329,14 +345,28 @@ module SiSU_DbImport t=SiSU_DbTuple::LoadDocuments.new(@conn,@col,@opt,@file_maint) @tuple_array << t.tuple case @col[:lev] - when /1/; @col[:lv1]+=1 - when /2/; @col[:lv2]+=1 - when /3/; @col[:lv3]+=1 + when /0/ then @col[:lv0]+=1 + when /1/ then @col[:lv1]+=1 + when /2/ then @col[:lv2]+=1 + when /3/ then @col[:lv3]+=1 end @col[:lev]=@col[:plaintext]=@col[:body]='' elsif data.is==:heading \ && data.ln==4 - @@seg,txt,@col[:ocn],@col[:lev_an],@col[:ocnd],@col[:ocns],@col[:t_of],@col[:t_is],@col[:node],@col[:parent],@col[:digest_clean],@col[:digest_all]=data.name,data.obj,data.ocn,data.lv,data.odv,data.osp,data.of,data.is,data.node,data.parent,'','' + ( + @@seg,txt, + @col[:ocn],@col[:lev_an], + @col[:ocnd],@col[:ocns], + @col[:t_of],@col[:t_is], + @col[:node],@col[:parent], + @col[:digest_clean],@col[:digest_all]= + data.name,data.obj, + data.ocn,data.lv, + data.odv,data.osp, + data.of,data.is, + data.node,data.parent, + '','' + ) @col[:seg]=@@seg @col[:lv4]+=1 @col[:lid]+=1 @@ -364,7 +394,20 @@ module SiSU_DbImport @col[:lev]=@col[:plaintext]=@col[:body]='' elsif data.is==:heading \ && data.ln==5 - txt,@col[:ocn],@col[:lev_an],@col[:ocnd],@col[:ocns],@col[:t_of],@col[:t_is],@col[:node],@col[:parent],@col[:digest_clean],@col[:digest_all]=data.obj,data.ocn,data.lv,data.odv,data.osp,data.of,data.is,data.node,data.parent,'','' + ( + txt, + @col[:ocn],@col[:lev_an], + @col[:ocnd],@col[:ocns], + @col[:t_of],@col[:t_is], + @col[:node],@col[:parent], + @col[:digest_clean],@col[:digest_all]= + data.obj, + data.ocn,data.lv, + data.odv,data.osp, + data.of,data.is, + data.node,data.parent, + '','' + ) @@seg_full=data.name if data.is==:heading \ && data.ln==5 \ && data.name #check data.name @@ -432,8 +475,21 @@ module SiSU_DbImport #% : else #% regular text @col[:lid]+=1 - txt='' - txt,@col[:ocn],@col[:ocnd],@col[:ocns],@col[:t_of],@col[:t_is],@col[:node],@col[:parent],@col[:digest_clean],@col[:digest_all]=data.obj,data.ocn,data.odv,data.osp,data.of,data.is,'',data.parent,'','' + ( + txt='' + txt,@col[:ocn], + @col[:ocnd],@col[:ocns], + @col[:t_of],@col[:t_is], + @col[:node],@col[:parent], + @col[:digest_clean],@col[:digest_all], + @col[:lev]= + data.obj,data.ocn, + data.odv,data.osp, + data.of,data.is, + '',data.parent, + '','', + 9 + ) @hname=if @col[:seg] \ and not @col[:seg].to_s.empty? @@hname=@col[:seg].to_s diff --git a/lib/sisu/v5/db_indexes.rb b/lib/sisu/v5/db_indexes.rb index b3e2f45f..0fa51b3f 100644 --- a/lib/sisu/v5/db_indexes.rb +++ b/lib/sisu/v5/db_indexes.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -82,6 +83,7 @@ module SiSU_DbIndex %{CREATE INDEX idx_ocn ON doc_objects(ocn);}, %{CREATE INDEX idx_digest_clean ON doc_objects(digest_clean);}, %{CREATE INDEX idx_digest_all ON doc_objects(digest_all);}, + %{CREATE INDEX idx_lev0 ON doc_objects(lev0);}, %{CREATE INDEX idx_lev1 ON doc_objects(lev1);}, %{CREATE INDEX idx_lev2 ON doc_objects(lev2);}, %{CREATE INDEX idx_lev3 ON doc_objects(lev3);}, diff --git a/lib/sisu/v5/db_load_tuple.rb b/lib/sisu/v5/db_load_tuple.rb index 10282bdd..750a47f0 100644 --- a/lib/sisu/v5/db_load_tuple.rb +++ b/lib/sisu/v5/db_load_tuple.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -68,25 +69,20 @@ module SiSU_DbTuple def initialize(conn,col,opt,file_maint) @conn,@col,@opt,@file_maint=conn,col,opt,file_maint @col[:lev]=@col[:lev].to_i - unless @col[:lev]=~/^[1-6]/ \ - or @col[:lev]==1 \ - or @col[:lev]==2 \ - or @col[:lev]==3 \ - or @col[:lev]==4 \ - or @col[:lev]==5 \ - or @col[:lev]==6 #changed from \d+ ?? - @col[:lev]=0 + unless @col[:lev].inspect=~/^[0-6]/ \ + or @col[:lev]==0..6 + @col[:lev]=9 end @col[:ocn]=0 unless @col[:ocn].inspect=~/\d+/ @cX=SiSU_Screen::Ansi.new(@opt.act[:color_state][:set]).cX end def tuple #% import line sql_entry=if @col[:en_a] - "INSERT INTO doc_objects (lid, metadata_tid, lev, lev_an, clean, body, book_idx, ocn, ocnd, ocns, seg, lev1, lev2, lev3, lev4, lev5, lev6, en_a, en_z, t_of, t_is, node, parent, digest_clean, digest_all) " + - "VALUES (#{@col[:lid]}, #{@col[:tid]}, #{@col[:lev]}, '#{@col[:lev_an]}', '#{@col[:plaintext]}', '#{@col[:body]}', '#{@col[:book_idx]}', '#{@col[:ocn]}', '#{@col[:ocnd]}', '#{@col[:ocns]}', '#{@col[:seg]}', '#{@col[:lv1]}', '#{@col[:lv2]}', '#{@col[:lv3]}', '#{@col[:lv4]}', '#{@col[:lv5]}', '#{@col[:lv6]}', '#{@col[:en_a]}', '#{@col[:en_z]}', '#{@col[:t_of]}', '#{@col[:t_is]}', '#{@col[:node]}', '#{@col[:parent]}', '#{@col[:digest_clean]}', '#{@col[:digest_all]}');" + "INSERT INTO doc_objects (lid, metadata_tid, lev, lev_an, clean, body, book_idx, ocn, ocnd, ocns, seg, lev0, lev1, lev2, lev3, lev4, lev5, lev6, en_a, en_z, t_of, t_is, node, parent, digest_clean, digest_all) " + + "VALUES (#{@col[:lid]}, #{@col[:tid]}, #{@col[:lev]}, '#{@col[:lev_an]}', '#{@col[:plaintext]}', '#{@col[:body]}', '#{@col[:book_idx]}', '#{@col[:ocn]}', '#{@col[:ocnd]}', '#{@col[:ocns]}', '#{@col[:seg]}', '#{@col[:lv0]}', '#{@col[:lv1]}', '#{@col[:lv2]}', '#{@col[:lv3]}', '#{@col[:lv4]}', '#{@col[:lv5]}', '#{@col[:lv6]}', '#{@col[:en_a]}', '#{@col[:en_z]}', '#{@col[:t_of]}', '#{@col[:t_is]}', '#{@col[:node]}', '#{@col[:parent]}', '#{@col[:digest_clean]}', '#{@col[:digest_all]}');" else - "INSERT INTO doc_objects (lid, metadata_tid, lev, lev_an, clean, body, book_idx, ocn, ocnd, ocns, seg, lev1, lev2, lev3, lev4, lev5, lev6, t_of, t_is, node, parent, digest_clean, digest_all) " + - "VALUES (#{@col[:lid]}, #{@col[:tid]}, #{@col[:lev]}, '#{@col[:lev_an]}', '#{@col[:plaintext]}', '#{@col[:body]}', '#{@col[:book_idx]}', '#{@col[:ocn]}', '#{@col[:ocnd]}', '#{@col[:ocns]}', '#{@col[:seg]}', '#{@col[:lv1]}', '#{@col[:lv2]}', '#{@col[:lv3]}', '#{@col[:lv4]}', '#{@col[:lv5]}', '#{@col[:lv6]}', '#{@col[:t_of]}', '#{@col[:t_is]}', '#{@col[:node]}', '#{@col[:parent]}', '#{@col[:digest_clean]}', '#{@col[:digest_all]}');" + "INSERT INTO doc_objects (lid, metadata_tid, lev, lev_an, clean, body, book_idx, ocn, ocnd, ocns, seg, lev0, lev1, lev2, lev3, lev4, lev5, lev6, t_of, t_is, node, parent, digest_clean, digest_all) " + + "VALUES (#{@col[:lid]}, #{@col[:tid]}, #{@col[:lev]}, '#{@col[:lev_an]}', '#{@col[:plaintext]}', '#{@col[:body]}', '#{@col[:book_idx]}', '#{@col[:ocn]}', '#{@col[:ocnd]}', '#{@col[:ocns]}', '#{@col[:seg]}', '#{@col[:lv0]}', '#{@col[:lv1]}', '#{@col[:lv2]}', '#{@col[:lv3]}', '#{@col[:lv4]}', '#{@col[:lv5]}', '#{@col[:lv6]}', '#{@col[:t_of]}', '#{@col[:t_is]}', '#{@col[:node]}', '#{@col[:parent]}', '#{@col[:digest_clean]}', '#{@col[:digest_all]}');" end if @opt.act[:verbose_plus][:set]==:on if @opt.act[:maintenance][:set]==:on @@ -101,17 +97,18 @@ module SiSU_DbTuple end end if @opt.act[:verbose][:set]==:on - if @col[:lev].inspect =~/[12356789]/ + if @col[:lev].inspect =~/[0-356]/ lev=case @col[:lev].inspect - when /1/; ':A' - when /2/; ':B' - when /3/; ':C' - when /5/; ' 2' - when /6/; ' 3' + when /0/ then ':A' + when /1/ then ':B' + when /2/ then ':C' + when /3/ then ':D' + when /5/ then ' 2' + when /6/ then ' 3' end - puts %{#{lev}>\t#{@col[:lv1]}\t#{@col[:lv2]}\t#{@col[:lv3]}\t#{@col[:lv4]}\t#{@col[:lv5]}\t#{@col[:lv6]}\t#{@col[:ocn]}\t#{@col[:node]}\t#{@col[:ocns]}} + puts %{#{lev}>\t#{@col[:lv0]}\t#{@col[:lv1]}\t#{@col[:lv2]}\t#{@col[:lv3]}\t#{@col[:lv4]}\t#{@col[:lv5]}\t#{@col[:lv6]}\t#{@col[:ocn]}\t#{@col[:node]}\t#{@col[:ocns]}} elsif @col[:lev].inspect =~/[4]/ - puts %{ #{@cX.green}1>#{@cX.off}\t#{@col[:lv1]}\t#{@col[:lv2]}\t#{@col[:lv3]}\t#{@col[:lv4]}\t#{@col[:lv5]}\t#{@col[:lv6]}\t#{@col[:ocn]}\t#{@col[:node]}\t#{@col[:ocns]}\t#{@col[:seg]}} + puts %{ #{@cX.green}1>#{@cX.off}\t#{@col[:lv0]}\t#{@col[:lv1]}\t#{@col[:lv2]}\t#{@col[:lv3]}\t#{@col[:lv4]}\t#{@col[:lv5]}\t#{@col[:lv6]}\t#{@col[:ocn]}\t#{@col[:node]}\t#{@col[:ocns]}\t#{@col[:seg]}} end end sql_entry diff --git a/lib/sisu/v5/db_remove.rb b/lib/sisu/v5/db_remove.rb index 71be0ebc..9ffba024 100644 --- a/lib/sisu/v5/db_remove.rb +++ b/lib/sisu/v5/db_remove.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/db_select.rb b/lib/sisu/v5/db_select.rb index 38251554..06d8c429 100644 --- a/lib/sisu/v5/db_select.rb +++ b/lib/sisu/v5/db_select.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -172,8 +173,8 @@ module SiSU_DbSelect db_exist? @sdb_import.marshal_load tell=case @sql_type - when /sqlite/; SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"sqlite3 #{@db.sqlite.db} database?") - when /pg/; SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"pgaccess or psql #{@db.psql.db} database?") + when /sqlite/ then SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"sqlite3 #{@db.sqlite.db} database?") + when /pg/ then SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"pgaccess or psql #{@db.psql.db} database?") else '???' end tell.puts_grey if @opt.act[:verbose][:set]==:on @@ -182,8 +183,8 @@ module SiSU_DbSelect @sdb_remove_doc.remove @sdb_import.marshal_load tell=case @sql_type - when /sqlite/; SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"sqlite3 #{@db.sqlite.db} database?") - when /pg/; SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"pgaccess or psql #{@db.psql.db} database?") + when /sqlite/ then SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"sqlite3 #{@db.sqlite.db} database?") + when /pg/ then SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"pgaccess or psql #{@db.psql.db} database?") else '???' end tell.puts_grey if @opt.act[:verbose][:set]==:on diff --git a/lib/sisu/v5/db_sqltxt.rb b/lib/sisu/v5/db_sqltxt.rb index d678ef22..394328bd 100644 --- a/lib/sisu/v5/db_sqltxt.rb +++ b/lib/sisu/v5/db_sqltxt.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/db_tests.rb b/lib/sisu/v5/db_tests.rb index 2e93ba11..7ce8a534 100644 --- a/lib/sisu/v5/db_tests.rb +++ b/lib/sisu/v5/db_tests.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/dbi.rb b/lib/sisu/v5/dbi.rb index 6a40d3ce..d92f1964 100644 --- a/lib/sisu/v5/dbi.rb +++ b/lib/sisu/v5/dbi.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -126,8 +127,8 @@ manually create the database: "#{cX.green}#{@db.db}#{cX.off}" if it does not yet end def connect case @sql_type - when /pg/; read_psql - when /sqlite/; read_sqlite + when /pg/ then read_psql + when /sqlite/ then read_sqlite end SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"DBI (#{@sql_type}) #{@opt.mod}",@opt.fno).dbi_title unless @opt.act[:quiet][:set]==:on begin diff --git a/lib/sisu/v5/dbi_discrete.rb b/lib/sisu/v5/dbi_discrete.rb index 95fb9ce3..0981455c 100644 --- a/lib/sisu/v5/dbi_discrete.rb +++ b/lib/sisu/v5/dbi_discrete.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/defaults.rb b/lib/sisu/v5/defaults.rb index 91ded537..fd56c2c4 100644 --- a/lib/sisu/v5/defaults.rb +++ b/lib/sisu/v5/defaults.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -563,8 +564,8 @@ module SiSU_Viz if italics_list r=italics_list.dup x=case r - when /\/i$/; 'i' - else '' + when /\/i$/ then 'i' + else '' end r=r.gsub(/^\/(.+?)\/i?/,'\1'). gsub(/\(/,'(?:') # avoid need to escape use of brackets within regex provided @@ -584,8 +585,8 @@ module SiSU_Viz if bold_list r=bold_list.dup x=case r - when /\/i$/; 'i' - else '' + when /\/i$/ then 'i' + else '' end r.gsub(/^\/(.+?)\/i?/,'\1'). gsub(/\(/,'(?:') # avoid need to escape use of brackets within regex provided @@ -1198,12 +1199,12 @@ WOK end def dimensions case @papersize - when /a4/; a4 - when /letter/; letter - when /legal/; legal - when /b5/; b5 - when /a5/; a5 - else a4 + when /a4/ then a4 + when /letter/ then letter + when /legal/ then legal + when /b5/ then b5 + when /a5/ then a5 + else a4 end end end diff --git a/lib/sisu/v5/digests.rb b/lib/sisu/v5/digests.rb index 0afa7378..2b010374 100644 --- a/lib/sisu/v5/digests.rb +++ b/lib/sisu/v5/digests.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -335,17 +336,17 @@ module SiSU_DigestView data.each do |t_o| if t_o.is==:heading x=case t_o.ln - when 1; l[1] +=1 #fix Mx[:lv_o] + when 1 then l[1] +=1 #fix Mx[:lv_o] ' '*0 << ':A' - when 2; l[2] +=1 #fix Mx[:lv_o] + when 2 then l[2] +=1 #fix Mx[:lv_o] ' '*1 << ':B' - when 3; l[3] +=1 #fix Mx[:lv_o] + when 3 then l[3] +=1 #fix Mx[:lv_o] ' '*2 << ':C' - when 4; l[4] +=1 #fix Mx[:lv_o] + when 4 then l[4] +=1 #fix Mx[:lv_o] ' '*3 << '1' - when 5; l[5] +=1 #fix Mx[:lv_o] + when 5 then l[5] +=1 #fix Mx[:lv_o] ' '*4 << '2' - when 6; l[6] +=1 #fix Mx[:lv_o] + when 6 then l[6] +=1 #fix Mx[:lv_o] ' '*5 << '3' else nil end @@ -358,12 +359,12 @@ module SiSU_DigestView ao_structure_summary("document structure[*]\n") [0,1,2,3,4,5,6].each do |y| v=case y - when 1; ':A' - when 2; ':B' - when 3; ':C' - when 4; '1 ' - when 5; '2 ' - when 6; '3 ' + when 1 then ':A' + when 2 then ':B' + when 3 then ':C' + when 4 then '1 ' + when 5 then '2 ' + when 6 then '3 ' end ao_structure_summary("#{v} = #{l[y]}\n") if l[y] > 0 end diff --git a/lib/sisu/v5/embedded.rb b/lib/sisu/v5/embedded.rb index 89ba1d41..e205353a 100644 --- a/lib/sisu/v5/embedded.rb +++ b/lib/sisu/v5/embedded.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/errors.rb b/lib/sisu/v5/errors.rb index 37a8e1a5..f4e05091 100644 --- a/lib/sisu/v5/errors.rb +++ b/lib/sisu/v5/errors.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/git.rb b/lib/sisu/v5/git.rb index 7a69a187..d04aafee 100644 --- a/lib/sisu/v5/git.rb +++ b/lib/sisu/v5/git.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/harvest.rb b/lib/sisu/v5/harvest.rb index 8ff7cc31..6c9b144f 100644 --- a/lib/sisu/v5/harvest.rb +++ b/lib/sisu/v5/harvest.rb @@ -10,7 +10,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/harvest_authors.rb b/lib/sisu/v5/harvest_authors.rb index a442df0c..a4d6c530 100644 --- a/lib/sisu/v5/harvest_authors.rb +++ b/lib/sisu/v5/harvest_authors.rb @@ -9,7 +9,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/harvest_topics.rb b/lib/sisu/v5/harvest_topics.rb index bb2d7959..aeca5246 100644 --- a/lib/sisu/v5/harvest_topics.rb +++ b/lib/sisu/v5/harvest_topics.rb @@ -10,7 +10,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/html.rb b/lib/sisu/v5/html.rb index 7a1c4b60..f473f1b7 100644 --- a/lib/sisu/v5/html.rb +++ b/lib/sisu/v5/html.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -258,12 +259,13 @@ module SiSU_HTML toc=if dob_toc.is ==:heading \ || dob.is==:heading_insert toc=case dob_toc.ln - when 1; SiSU_HTML::Source::Toc.new(@md,dob_toc).level_1 - when 2; SiSU_HTML::Source::Toc.new(@md,dob_toc).level_2 - when 3; SiSU_HTML::Source::Toc.new(@md,dob_toc).level_3 - when 4; SiSU_HTML::Source::Toc.new(@md,dob_toc).level_4 - when 5; SiSU_HTML::Source::Toc.new(@md,dob_toc).level_5 - when 6; SiSU_HTML::Source::Toc.new(@md,dob_toc).level_6 + when 0 then SiSU_HTML::Source::Toc.new(@md,dob_toc).level_0 + when 1 then SiSU_HTML::Source::Toc.new(@md,dob_toc).level_1 + when 2 then SiSU_HTML::Source::Toc.new(@md,dob_toc).level_2 + when 3 then SiSU_HTML::Source::Toc.new(@md,dob_toc).level_3 + when 4 then SiSU_HTML::Source::Toc.new(@md,dob_toc).level_4 + when 5 then SiSU_HTML::Source::Toc.new(@md,dob_toc).level_5 + when 6 then SiSU_HTML::Source::Toc.new(@md,dob_toc).level_6 else nil end end @@ -334,6 +336,29 @@ WOK @@toc[:seg_mini] << format_head_toc.mini_concordance end # <-- not used + def level_0 + dob=@data + linkname,link=dob.obj.strip,dob.ocn + if link \ + and link !~/#/ #% keep eye on link + SiSU_HTML_Format::ParagraphNumber.new(@md,link) + end + title=linkname + toc={} + txt_obj={ txt: title } + format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj) + toc[:seg]=format_toc.lev0 + toc[:seg_mini]=format_toc.mini_lev0 + title=if dob.ocn ==0 then linkname + else + @@toc[:scr] << '<br />' + %{<b><a href="##{dob.ocn}">#{linkname}</a></b>} + end + txt_obj={ txt: title } + format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj) + toc[:scr]=format_toc.lev0 + toc + end def level_1 dob=@data linkname,link=dob.obj.strip,dob.ocn @@ -341,7 +366,7 @@ WOK and link !~/#/ #% keep eye on link SiSU_HTML_Format::ParagraphNumber.new(@md,link) end - title=if dob.obj !~/Metadata/ then linkname + title=if dob.obj !~/^Metadata$/ then linkname else link='metadata' %{<b><a href="#{link}#{@md.lang_code_insert}#{Sfx[:html]}">#{linkname}</a></b>} @@ -369,16 +394,13 @@ WOK end else @@toc[:scr] << '<br />' - link=(dob.ln) \ - ? dob.ln - : '' - %{<b><a href="##{link}">#{linkname}</a></b>} + %{<b><a href="##{dob.ocn}">#{linkname}</a></b>} end txt_obj={ txt: title } format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj) - toc[:scr]=if dob.name =~/^meta/ \ - and dob.obj =~/Document Information/ - format_toc.lev0 + toc[:scr]=if dob.obj =~/^Metadata$/ then '' + elsif txt_obj[:txt] =~/<a href="#">/ + format_toc.lev1.gsub(/<a href="#">|<\/a>/,'') else format_toc.lev1 end toc @@ -400,7 +422,10 @@ WOK title=%{#{p_num.goto}#{linkname}</a>} txt_obj={ txt: title } format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj) - toc[:scr]=format_toc.lev2 + toc[:scr]=if txt_obj[:txt] =~/<a href="#">/ + format_toc.lev2.gsub(/<a href="#">|<\/a>/,'') + else format_toc.lev2 + end end toc end @@ -421,7 +446,10 @@ WOK title=%{#{p_num.goto}#{linkname}</a>} txt_obj={ txt: title } format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj) - toc[:scr]=format_toc.lev3 + toc[:scr]=if txt_obj[:txt] =~/<a href="#">/ + format_toc.lev3.gsub(/<a href="#">|<\/a>/,'') + else format_toc.lev3 + end end toc end @@ -563,9 +591,8 @@ WOK format_head_toc=SiSU_HTML_Format::HeadToc.new(@md) dochead=format_head_toc.head dochead=dochead.gsub(/toc\.(html)/,'doc.\1') #kludge - ads=SiSU_HTML_Promo::Ad.new(@md) - toc_shared << dochead << ads.div.major - @segtoc << format_head_toc.head << ads.div.major + toc_shared << dochead + @segtoc << format_head_toc.head if @make.build.html_top_band? toc_shared << format_head_toc.scroll_head_navigation_band end @@ -628,8 +655,7 @@ WOK #Segtoc tail added here @segtoc << "</p>\n" #bugfix sort later DEBUGNOW @segtoc << @seg_toc_band_bottom - ads=SiSU_HTML_Promo::Ad.new(@md) - @segtoc << format_head_toc.seg_navigation_tail << ads.div.close << ads.display << format_head_toc.html_close + @segtoc << format_head_toc.seg_navigation_tail << format_head_toc.html_close @segtoc=@segtoc.flatten.compact #watch if @md.opt.act[:html_seg][:set]==:on SiSU_HTML::Source::Output.new(@segtoc,@md).segtoc diff --git a/lib/sisu/v5/html_format.rb b/lib/sisu/v5/html_format.rb index db9fb449..3b15502f 100644 --- a/lib/sisu/v5/html_format.rb +++ b/lib/sisu/v5/html_format.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -1029,7 +1030,7 @@ WOK para_form_css(tag,attrib) end def heading_normal(tag,attrib) - section_break=(tag=~/h[1-4]/) \ + section_break=(tag=~/h[1-5]/) \ ? '<br /><hr width=90% /><br />' : '' %{#{section_break} @@ -1044,6 +1045,9 @@ WOK def heading_body heading_normal('p','norm') end + def heading_body0 + heading_normal('h1','norm') + end def heading_body1 heading_normal('h1','norm') end @@ -1074,6 +1078,9 @@ WOK </div> } end + def title_heading0 + title_heading('h1','tiny') + end def title_heading1 title_heading('h1','tiny') end @@ -1331,6 +1338,9 @@ WOK else '' end end + def lev0 #docinfo + lev('h1','toc') + end def lev1 lev('h1','toc') end @@ -1349,13 +1359,14 @@ WOK def lev6 lev('h6','toc') end - def lev0 #docinfo - lev('h0','toc') - end def strip_endnotes(txt) txt=txt.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ') txt end + def mini_lev0 + @txt=strip_endnotes(@txt) + lev('h1','minitoc') + end def mini_lev1 @txt=strip_endnotes(@txt) lev('h1','minitoc') @@ -1381,7 +1392,7 @@ WOK lev('h6','minitoc') end def mini_lev0 #docinfo - lev('h0','minitoc') + lev('h1','minitoc') end def mini_tail %{ diff --git a/lib/sisu/v5/html_lite_shared.rb b/lib/sisu/v5/html_lite_shared.rb index 20e07f8c..8c447352 100644 --- a/lib/sisu/v5/html_lite_shared.rb +++ b/lib/sisu/v5/html_lite_shared.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/html_minitoc.rb b/lib/sisu/v5/html_minitoc.rb index 71128c2f..dae74c46 100644 --- a/lib/sisu/v5/html_minitoc.rb +++ b/lib/sisu/v5/html_minitoc.rb @@ -9,7 +9,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -88,12 +89,13 @@ gsub(@pat_strip_heading_name,'\1') #gsub(/(.*?)<a name="(\d+)"><\/a>(.*)/,'\1') #2002w42 altered gsub - problematic? - suspect toc=case txt.ln - when 1; SiSU_HTML_MiniToc::TocMini.new(@md,txt).level_1 - when 2; SiSU_HTML_MiniToc::TocMini.new(@md,txt).level_2 - when 3; SiSU_HTML_MiniToc::TocMini.new(@md,txt).level_3 - when 4; SiSU_HTML_MiniToc::TocMini.new(@md,txt).level_4 - when 5; SiSU_HTML_MiniToc::TocMini.new(@md,txt).level_5 - when 6; SiSU_HTML_MiniToc::TocMini.new(@md,txt).level_6 + when 0 then SiSU_HTML_MiniToc::TocMini.new(@md,txt).level_0 + when 1 then SiSU_HTML_MiniToc::TocMini.new(@md,txt).level_1 + when 2 then SiSU_HTML_MiniToc::TocMini.new(@md,txt).level_2 + when 3 then SiSU_HTML_MiniToc::TocMini.new(@md,txt).level_3 + when 4 then SiSU_HTML_MiniToc::TocMini.new(@md,txt).level_4 + when 5 then SiSU_HTML_MiniToc::TocMini.new(@md,txt).level_5 + when 6 then SiSU_HTML_MiniToc::TocMini.new(@md,txt).level_6 else end @toc << toc @@ -114,6 +116,18 @@ format_head_toc=SiSU_HTML_Format::HeadToc.new(@d0c) @@seg_mini << format_head_toc.mini_concordance end + def level_0 + txt=@data + if (txt.is ==:heading \ + || txt.is ==:heading_insert) \ + && txt.ocn !=0 + txt.obj=txt.obj.gsub(@pat_strip_heading_name,'\1') + end + txt_obj={ txt: txt.obj } + format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj) + toc_mini=format_toc.mini_lev0 + toc_mini + end def level_1 txt=@data if (txt.is ==:heading \ @@ -121,7 +135,7 @@ && txt.ocn !=0 txt.obj=txt.obj.gsub(@pat_strip_heading_name,'\1') end - title=unless txt.obj =~/Document Information/; txt.obj + title=unless txt.obj =~/Document Information/ then txt.obj else link='metadata' %{<b><a href="#{link}#{@md.lang_code_insert}#{Sfx[:html]}">#{txt.obj}</a></b>} diff --git a/lib/sisu/v5/html_promo.rb b/lib/sisu/v5/html_promo.rb index 8b26a689..d9157b49 100644 --- a/lib/sisu/v5/html_promo.rb +++ b/lib/sisu/v5/html_promo.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/html_scroll.rb b/lib/sisu/v5/html_scroll.rb index f525b462..01fe2940 100644 --- a/lib/sisu/v5/html_scroll.rb +++ b/lib/sisu/v5/html_scroll.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -95,7 +96,7 @@ module SiSU_HTML_Scroll end if dob.obj =~/^Metadata$/ \ and dob.lv =='B' - dob.obj=dob.obj.gsub(/Metadata/,'') + dob.obj=dob.obj.gsub(/Metadata/,'') #dob.obj='' end if defined? dob.name \ and dob.name =~/^metadata/ \ @@ -114,7 +115,9 @@ module SiSU_HTML_Scroll end sto=SiSU_HTML_Format::FormatTextObject.new(@md,dob) para_html=if dob.is==:heading - x=if dob.ln==1 + x=if dob.ln==0 + sto.heading_body0 + elsif dob.ln==1 sto.heading_body1 elsif dob.ln==2 sto.heading_body2 @@ -131,7 +134,11 @@ module SiSU_HTML_Scroll and dob.from==:markup '<br /><hr width=90% /><br />' elsif dob.is==:heading_insert - x=if dob.ln==1 + x=if dob.ln==0 + unless dob.obj.empty? + sto.heading_body0 + end + elsif dob.ln==1 unless dob.obj.empty? sto.heading_body1 end @@ -215,8 +222,7 @@ module SiSU_HTML_Scroll def tails scr_tail=[] format_head_scroll=SiSU_HTML_Format::HeadToc.new(@md) - ads=SiSU_HTML_Promo::Ad.new(@md) - scr_tail << format_head_scroll.scroll_tail << ads.div.close << ads.display << format_head_scroll.html_close + scr_tail << format_head_scroll.scroll_tail << format_head_scroll.html_close scr_tail end end diff --git a/lib/sisu/v5/html_segments.rb b/lib/sisu/v5/html_segments.rb index d6b341ac..b710db81 100644 --- a/lib/sisu/v5/html_segments.rb +++ b/lib/sisu/v5/html_segments.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -143,8 +144,8 @@ module SiSU_HTML_Seg @@seg_name,@@seg_name_html=[],[] @@seg_url=@@fn=@@get_hash_to=@@get_hash_fn='' @@loop_count=@@seg_total=@@tracker=0 - @@is4=@@is3=@@is2=@@is1=0 - @@heading1=@@heading2=@@heading3=@@heading4=0 + @@is4=@@is3=@@is2=@@is1=@@is0=0 + @@heading0=@@heading1=@@heading2=@@heading3=@@heading4=0 @@seg[:tocband_banner],@@seg[:tocband_bannerless],@@seg[:title],@@seg[:headings],@@seg[:main],@@seg[:idx],@@seg[:tail],@@seg[:credits],@@seg_subtoc_array,@@seg_endnotes_array,@@seg[:endnote_all]=Array.new(11){[]} @@seg[:heading_endnotes]='' @@tablehead,@@number_of_cols=0,0 @@ -186,7 +187,7 @@ module SiSU_HTML_Seg protected def articles(data) tracking,newfile=0,0 - @@is4=@@is3=@@is2=@@is1=0 + @@is4=@@is3=@@is2=@@is1=@@is0=0 printed_endnote_seg='n' idx_html=nil if @md.book_idx @@ -233,10 +234,7 @@ module SiSU_HTML_Seg if (dob.is==:heading \ || dob.is==:heading_insert) \ && dob.ln==4 - if dob.ocn==0 - @@heading4=dob.obj - else @@heading4=dob.obj - end + @@heading4=dob.obj @@is4=newfile=1 end if (dob.is==:heading \ @@ -257,10 +255,16 @@ module SiSU_HTML_Seg @@heading1=dob.obj @@is4,@@is3,@@is2,@@is1=0,0,0,1 end + if (dob.is==:heading \ + || dob.is==:heading_insert) \ + && dob.ln==0 + @@heading0=dob.obj + @@is4,@@is3,@@is2,@@is1,@@is0=0,0,0,0,1 + end if (@@is1 && !@@is2 && !@@is3 && !@@is4) if not (dob.is==:heading \ || dob.is==:heading_insert) \ - && dob.ln==1 + && dob.ln==0 $_ #; check end end @@ -283,9 +287,7 @@ module SiSU_HTML_Seg fn=@md.file.base_filename.html_seg(fnh) segfilename="#{@file.output_path.html_seg.dir}/#{fn}" output_seg_file=File.new(segfilename,'w') if @@seg_name_html[tracking-1] - minitoc=(@make.build.html_minitoc?) \ - ? @minitoc - : '' + minitoc=(@make.build.html_minitoc?) ? @minitoc : '' if dob.is==:heading \ || (@@seg_name_html[tracking-1] !~/endnotes|book_index|metadata/) SiSU_HTML_Seg::Output.new(@md,output_seg_file,@@seg,minitoc).output @@ -352,7 +354,7 @@ module SiSU_HTML_Seg && (@make.build.html_navigation_bar?) x=if (dob.is==:heading \ || dob.is==:heading_insert) \ - && (dob.ln.to_s =~/^[1-6]/) + && (dob.ln.to_s =~/^[0-6]/) x=if @@tracker < @@seg_total-1 format_head_seg.dot_control_pre_next else @@ -371,31 +373,38 @@ module SiSU_HTML_Seg if @make.build.html_navigation? if @@tracker < @@seg_total-1 @@segtocband=if @@tracker==0 - format_head_seg.toc_next2 #if format_head_seg.toc_next2 + format_head_seg.toc_next2 else - format_head_seg.toc_pre_next2 #if format_head_seg.toc_pre_next2 + format_head_seg.toc_pre_next2 end - else @@segtocband=format_head_seg.toc_pre2 #if format_head_seg.toc_pre2 + else @@segtocband=format_head_seg.toc_pre2 end else @@segtocband='' end @p_num ||= '' - if @@is1==1 + if @@is0==1 @author=%{<b>#{@md.author}</b>\n} if @md.author.to_s =~/\S/ @@seg[:tocband_banner] << format_head_seg.navigation_band(@@segtocband,@@seg[:dot_nav]) - conditional_div_close=if @@get_hash_fn =~/metadata/ #watch - '</div>' - else '' - end - @@seg[:tocband_bannerless] << '<br />' << conditional_div_close << format_head_seg.navigation_band_bottom(@@segtocband,@@seg[:dot_nav]) + @@seg[:tocband_bannerless] << '<br />' << format_head_seg.navigation_band_bottom(@@segtocband,@@seg[:dot_nav]) if @title_banner_ @@seg[:headings] << format_head_seg.title_banner(@md.title.main,@md.title.sub,@author).gsub(clean,'') end - ocn=(@@heading1[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \ + ocn=(@@heading0[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \ + ? $1 + : '' + @p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn) + txt_obj={ txt: @@heading0, ocn_display: @p_num.ocn_display } + format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj) + @@seg[:headings] << format_seg.title_heading0.gsub(clean,'') + @@heading0=@@heading0.gsub(/ <a name="-[\d*+]+" href="#_[\d*+]+"> <sup>[\d*+]+<\/sup> <\/a>/,'') + end + if @@is1==1 + heading1=@@heading1 + ocn=(heading1[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \ ? $1 : '' @p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn) - txt_obj={ txt: @@heading1, ocn_display: @p_num.ocn_display } + txt_obj={ txt: heading1, ocn_display: @p_num.ocn_display } format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj) @@seg[:headings] << format_seg.title_heading1.gsub(clean,'') @@heading1=@@heading1.gsub(/ <a name="-[\d*+]+" href="#_[\d*+]+"> <sup>[\d*+]+<\/sup> <\/a>/,'') @@ -553,7 +562,7 @@ module SiSU_HTML_Seg if @md.flag_auto_endnotes if (dob.is==:heading \ || dob.is==:heading_insert) \ - && (dob.ln.to_s =~/^[1234]/) \ + && (dob.ln.to_s =~/^[0-4]/) \ and not @@fn.to_s.empty? @@seg_endnotes[@@fn]=[] @@seg_endnotes[@@fn] << @@seg_endnotes_array diff --git a/lib/sisu/v5/html_shared.rb b/lib/sisu/v5/html_shared.rb index 63a8964e..859ea99f 100644 --- a/lib/sisu/v5/html_shared.rb +++ b/lib/sisu/v5/html_shared.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/html_table.rb b/lib/sisu/v5/html_table.rb index 8c9b76d0..599b6323 100644 --- a/lib/sisu/v5/html_table.rb +++ b/lib/sisu/v5/html_table.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/html_tune.rb b/lib/sisu/v5/html_tune.rb index 8ed292c7..e9392ca8 100644 --- a/lib/sisu/v5/html_tune.rb +++ b/lib/sisu/v5/html_tune.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/hub.rb b/lib/sisu/v5/hub.rb index f09bd832..d0393a3b 100644 --- a/lib/sisu/v5/hub.rb +++ b/lib/sisu/v5/hub.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -308,7 +309,7 @@ module SiSU end if @opt.act[:txt_asciidoc][:set]==:on #% --asciidoc require_relative 'txt_asciidoc' # txt_asciidoc.rb - SiSU_Txt_asciiDoc::Source.new(@opt).read + SiSU_Txt_AsciiDoc::Source.new(@opt).read end if @opt.act[:txt_markdown][:set]==:on #% --markdown require_relative 'txt_markdown' # txt_markdown.rb diff --git a/lib/sisu/v5/i18n.rb b/lib/sisu/v5/i18n.rb index be2c7020..cd8daba1 100644 --- a/lib/sisu/v5/i18n.rb +++ b/lib/sisu/v5/i18n.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -259,76 +260,76 @@ module SiSU_TextTranslation def tex_name(char) @lang=if char case char - when 'sq'; 'albanian' - when 'am'; 'amharic' - #when 'ar'; 'arabic' # see polyglossia - when 'hy'; 'armenian' - #when ''; 'asturian' # polyglossia - #when ''; 'bahasai' # polyglossia - #when ''; 'bahasam' # polyglossia - when 'eu'; 'basque' - when 'bn'; 'bengali' - when 'pt_BR'; 'brazilian' - when 'br'; 'breton' - when 'bg'; 'bulgarian' - when 'ca'; 'catalan' # see polyglossia - #when ''; 'coptic' # polyglossia - when 'hr'; 'croatian' - when 'cs'; 'czech' - when 'da'; 'danish' - #when ''; 'divehi' # polyglossia - when 'nl'; 'dutch' # see polyglossia - when 'en'; 'english' # see polyglossia - when 'eo'; 'esperanto' # see polyglossia - when 'et'; 'estonian' - when 'gl'; 'galician' - when 'de'; 'german' - when 'el'; 'greek' #gl ? - when 'he'; 'hebrew' - when 'hi'; 'hindi' - when 'is'; 'icelandic' - when 'ia'; 'interlingua' - when 'ga'; 'irish' - when 'it'; 'italian' - #when ''; 'farsi' # polyglossia - when 'fi'; 'finnish' - when 'fr'; 'french' - when 'lo'; 'lao' - when 'la'; 'latin' - when 'lv'; 'latvian' - when 'lt'; 'lithuanian' - #when ''; 'lsorbian' # polyglossia - #when ''; 'magyar' # polyglossia - when 'ml'; 'malayalam' - when 'mr'; 'marathi' - #when 'hu'; 'magyar' - when 'no'; 'norske' - when 'nn'; 'nynorsk' - when 'oc'; 'occitan' - when 'pl'; 'polish' - when 'pt'; 'portuges' - when 'ro'; 'romanian' - when 'ru'; 'russian' - when 'se'; 'samin' #(check sami?) - when 'sa'; 'sanskrit' - when 'sr'; 'serbian' - #when ''; 'scottish' # polyglossia (gd (Gaelic (Scots))) - when 'sk'; 'slovak' - when 'sl'; 'slovenian' - when 'es'; 'spanish' - when 'sv'; 'swedish' - when 'ta'; 'tamil' - when 'te'; 'telugu' - when 'th'; 'thai' - when 'tr'; 'turkish' - when 'tk'; 'turkmen' - when 'uk'; 'ukrainian' - when 'ur'; 'urdu' - #when ''; 'usorbian' # polyglossia - when 'vi'; 'vietnamese' - when 'cy'; 'welsh' - when 'us'; 'USenglish' # depreciated, see iso-639-2 - else 'english' + when 'sq' then 'albanian' + when 'am' then 'amharic' + #when 'ar' then 'arabic' # see polyglossia + when 'hy' then 'armenian' + #when '' then 'asturian' # polyglossia + #when '' then 'bahasai' # polyglossia + #when '' then 'bahasam' # polyglossia + when 'eu' then 'basque' + when 'bn' then 'bengali' + when 'pt_BR' then 'brazilian' + when 'br' then 'breton' + when 'bg' then 'bulgarian' + when 'ca' then 'catalan' # see polyglossia + #when '' then 'coptic' # polyglossia + when 'hr' then 'croatian' + when 'cs' then 'czech' + when 'da' then 'danish' + #when '' then 'divehi' # polyglossia + when 'nl' then 'dutch' # see polyglossia + when 'en' then 'english' # see polyglossia + when 'eo' then 'esperanto' # see polyglossia + when 'et' then 'estonian' + when 'gl' then 'galician' + when 'de' then 'german' + when 'el' then 'greek' #gl ? + when 'he' then 'hebrew' + when 'hi' then 'hindi' + when 'is' then 'icelandic' + when 'ia' then 'interlingua' + when 'ga' then 'irish' + when 'it' then 'italian' + #when '' then 'farsi' # polyglossia + when 'fi' then 'finnish' + when 'fr' then 'french' + when 'lo' then 'lao' + when 'la' then 'latin' + when 'lv' then 'latvian' + when 'lt' then 'lithuanian' + #when '' then 'lsorbian' # polyglossia + #when '' then 'magyar' # polyglossia + when 'ml' then 'malayalam' + when 'mr' then 'marathi' + #when 'hu' then 'magyar' + when 'no' then 'norske' + when 'nn' then 'nynorsk' + when 'oc' then 'occitan' + when 'pl' then 'polish' + when 'pt' then 'portuges' + when 'ro' then 'romanian' + when 'ru' then 'russian' + when 'se' then 'samin' #(check sami?) + when 'sa' then 'sanskrit' + when 'sr' then 'serbian' + #when '' then 'scottish' # polyglossia (gd (Gaelic (Scots))) + when 'sk' then 'slovak' + when 'sl' then 'slovenian' + when 'es' then 'spanish' + when 'sv' then 'swedish' + when 'ta' then 'tamil' + when 'te' then 'telugu' + when 'th' then 'thai' + when 'tr' then 'turkish' + when 'tk' then 'turkmen' + when 'uk' then 'ukrainian' + when 'ur' then 'urdu' + #when '' then 'usorbian' # polyglossia + when 'vi' then 'vietnamese' + when 'cy' then 'welsh' + when 'us' then 'USenglish' # depreciated, see iso-639-2 + else then 'english' end else 'english' end diff --git a/lib/sisu/v5/manifest.rb b/lib/sisu/v5/manifest.rb index fb3064e7..f6e76ec0 100644 --- a/lib/sisu/v5/manifest.rb +++ b/lib/sisu/v5/manifest.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -469,7 +470,7 @@ module SiSU_Manifest summarize(id,file,pth,rel,url) end if FileTest.file?(@f.place_file.asciidoc.dir)==true - id='asciiDoc text (UTF-8)' + id='AsciiDoc text (UTF-8)' pth=@f.output_path.asciidoc.dir rel=@f.output_path.asciidoc.rel_sm url=@f.output_path.asciidoc.url @@ -828,7 +829,7 @@ WOK metadata(id,info) end if @md.sisu_version - id,info=@translate.sisu_version,"#{@md.sisu_version[:project]} #{@md.sisu_version[:version]} #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" + id,info=@translate.sisu_version,"#{@md.sisu_version[:project]} #{@md.sisu_version[:version]} #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})#{@md.sisu_version[:install_method]}" metadata(id,info) end if @md.ruby_version diff --git a/lib/sisu/v5/manpage.rb b/lib/sisu/v5/manpage.rb index ccdd829c..0fe2b0b1 100644 --- a/lib/sisu/v5/manpage.rb +++ b/lib/sisu/v5/manpage.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -237,10 +238,10 @@ WOK times=wrapped.length times=78 if times > 78 @manpage[:body] << case lv - when 1; '.SH ' << wrapped.upcase << break_line << break_line - when 2..3; '.SH ' << wrapped.upcase << break_line << break_line - when 4; '.SH ' << wrapped.upcase << break_line << break_line - when 5..6; '.SH ' << wrapped.upcase << break_line << break_line + when 1 then '.SH ' << wrapped.upcase << break_line << break_line + when 2..3 then '.SH ' << wrapped.upcase << break_line << break_line + when 4 then '.SH ' << wrapped.upcase << break_line << break_line + when 5..6 then '.SH ' << wrapped.upcase << break_line << break_line end else @manpage[:body] << if wrapped =~/^\.BI\s/ # main text, contents, body KEEP @@ -340,12 +341,12 @@ WOK if dob.is==:heading manpage_structure(dob) dob.obj=case dob.ln - when 1; x.heading_body1 - when 2; x.heading_body2 - when 3; x.heading_body3 - when 4; x.heading_body4 - when 5; x.heading_body5 - when 6; x.heading_body6 + when 1 then x.heading_body1 + when 2 then x.heading_body2 + when 3 then x.heading_body3 + when 4 then x.heading_body4 + when 5 then x.heading_body5 + when 6 then x.heading_body6 end elsif dob.is==:para manpage_structure(dob) diff --git a/lib/sisu/v5/manpage_format.rb b/lib/sisu/v5/manpage_format.rb index ce54fdb7..dae1d6b3 100644 --- a/lib/sisu/v5/manpage_format.rb +++ b/lib/sisu/v5/manpage_format.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/options.rb b/lib/sisu/v5/options.rb index f410e61f..65af15b4 100644 --- a/lib/sisu/v5/options.rb +++ b/lib/sisu/v5/options.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -493,51 +494,51 @@ module SiSU_Commandline unless m.empty? m.each do |s| case s - when /^--(?:color-toggle)$/; c=c+'c' - when /^--(?:color-off)$/; c=c+'k' - when /^--(?:conf|config|configure|init|initialize|init-site)$/; c=c+'CC' - 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' + when /^--(?:color-toggle)$/ then c=c+'c' + when /^--(?:color-off)$/ then c=c+'k' + when /^--(?:conf|config|configure|init|initialize|init-site)$/ then c=c+'CC' + when /^--(?:ao|dal?|machine|abstraction|abs)$/ then c=c+'m' + when /^--(?:txt|text|plaintext)$/ then c=c+'t' + when /^--(?:html)$/ then c=c+'h' + when /^--(?:html-scroll|html-seg)$/ then c=c+'H' mod << s - when /^--(?:epub)$/; c=c+'e' - when /^--(?:od[ft])$/; c=c+'o' - when /^--(?:pdf)$/; c=c+'p' - when /^--pdf-(?:a4|a5|b5|legal|letter)$/; c=c+'p' - when /^--pdf-(?:p|l|portrait|landscape)$/; c=c+'L' - when /^--pdf-(?:p(?:ortrait)?|l(?:andscape)?)-(?:a4|letter|a5|b5|legal)$/; c=c+'L' - when /^--pdf-(?:a4|letter|a5|b5|legal)-(?:p(?:ortrait)?|l(?:andscape)?)$/; c=c+'L' - when /^--(?:concordance|wordmap)$/; c=c+'w' - when /^--(?:manpage|man)$/; c=c+'i' - when /^--(?:texinfo)$/; c=c+'I' - when /^--(?:xhtml)$/; c=c+'b' - when /^--(?:xml-sax)$/; c=c+'x' - when /^--(?:xml-dom)$/; c=c+'X' - when /^--(?:images)$/; c=c+'j' - when /^--(?:hash-digests)$/; c=c+'N' - when /^--(?:po4a|pot?)$/; c=c+'P' - when /^--(?:termsheet)$/; c=c+'T' - when /^--(?:manifest)$/; c=c+'y' - when /^--(?:qrcode)$/; c=c+'Q' - when /^--(?:sqlite)$/; c=c+'d' - when /^--(?:pg|pg?sql|postgresql)$/; c=c+'D' - when /^--(?:remote|rsync)$/; c=c+'R' - when /^--(?:scp)$/; c=c+'r' - when /^--(?:source)$/; c=c+'s' - when /^--(?:sisupod|pod)$/; c=c+'S' - when /^--(?:git)$/; c=c+'g' - when /^--(?:urls)$/; c=c+'U' - when /^--(?:zap|delete)$/; c=c+'Z' - when /^--(?:sample-search-form)$/; c=c+'F' - when /^--(?:webserv|webrick)$/; c=c+'W' - when /^--(?:profile)$/; c=c+'E' - when /^--(?:maintenance|keep-processing-files)$/; c=c+'M' - when /^--(?:verbose[=-]3)$/; c=c+'VM' - when /^--(?:verbose[=-]2|Verbose|VERBOSE)$/; c=c+'V' - when /^--(?:verbose(?:[=-]1)?)$/; c=c+'v' - when /^--(?:version)$/; c=c+'v' - when /^--(?:verbose[=-]0|quiet|silent)$/; c=c+'q' + when /^--(?:epub)$/ then c=c+'e' + when /^--(?:od[ft])$/ then c=c+'o' + when /^--(?:pdf)$/ then c=c+'p' + when /^--pdf-(?:a4|a5|b5|legal|letter)$/ then c=c+'p' + when /^--pdf-(?:p|l|portrait|landscape)$/ then c=c+'L' + when /^--pdf-(?:p(?:ortrait)?|l(?:andscape)?)-(?:a4|letter|a5|b5|legal)$/ then c=c+'L' + when /^--pdf-(?:a4|letter|a5|b5|legal)-(?:p(?:ortrait)?|l(?:andscape)?)$/ then c=c+'L' + when /^--(?:concordance|wordmap)$/ then c=c+'w' + when /^--(?:manpage|man)$/ then c=c+'i' + when /^--(?:texinfo)$/ then c=c+'I' + when /^--(?:xhtml)$/ then c=c+'b' + when /^--(?:xml-sax)$/ then c=c+'x' + when /^--(?:xml-dom)$/ then c=c+'X' + when /^--(?:images)$/ then c=c+'j' + when /^--(?:hash-digests)$/ then c=c+'N' + when /^--(?:po4a|pot?)$/ then c=c+'P' + when /^--(?:termsheet)$/ then c=c+'T' + when /^--(?:manifest)$/ then c=c+'y' + when /^--(?:qrcode)$/ then c=c+'Q' + when /^--(?:sqlite)$/ then c=c+'d' + when /^--(?:pg|pg?sql|postgresql)$/ then c=c+'D' + when /^--(?:remote|rsync)$/ then c=c+'R' + when /^--(?:scp)$/ then c=c+'r' + when /^--(?:source)$/ then c=c+'s' + when /^--(?:sisupod|pod)$/ then c=c+'S' + when /^--(?:git)$/ then c=c+'g' + when /^--(?:urls)$/ then c=c+'U' + when /^--(?:zap|delete)$/ then c=c+'Z' + when /^--(?:sample-search-form)$/ then c=c+'F' + when /^--(?:webserv|webrick)$/ then c=c+'W' + when /^--(?:profile)$/ then c=c+'E' + when /^--(?:maintenance|keep-processing-files)$/ then c=c+'M' + when /^--(?:verbose[=-]3)$/ then c=c+'VM' + when /^--(?:verbose[=-]2|Verbose|VERBOSE)$/ then c=c+'V' + when /^--(?:verbose(?:[=-]1)?)$/ then c=c+'v' + when /^--(?:version)$/ then c=c+'v' + when /^--(?:verbose[=-]0|quiet|silent)$/ then c=c+'q' else mod << s #mod only contains command modifiers; commands converted to character end end diff --git a/lib/sisu/v5/param.rb b/lib/sisu/v5/param.rb index d01f39e2..e8eb3fc6 100644 --- a/lib/sisu/v5/param.rb +++ b/lib/sisu/v5/param.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -831,9 +832,9 @@ module SiSU_Param @doc={ lv: [] } @doc[:fns],@doc[:fnb],@doc[:scr_suffix]='','','' @@publisher='SiSU scribe' - attr_accessor :make,:env,:path,:file,:fn,:fns,:fno,:fnb,:fnn,:fnt,:fnl,:flv,:fnz,:fnstex,:ocn,:sfx_src,:pdf,:file_type,:dir_out,:dir_tex,:dir_lout,:txt_path,:sisu,:sisu_version,:ruby_version,:title,:subtitle,:full_title,:html_title,:subtitle_tex,:creator,:classify,:author_home,:author,:author_title,:author_nationality,:authors,:authorship,:translator,:illustrator,:prepared_by,:digitized_by,:subject,:description,:publisher,:current_publisher,:contributor,:date,:date_created,:date_issued,:date_available,:date_valid,:date_modified,:date_translated,:date_added_to_site,:date_scheme,:date_created_scheme,:date_issued_scheme,:date_available_scheme,:date_valid_scheme,:date_modified_scheme,:type,:format,:identifier,:source,:language,:language_original,:relation,:coverage,:rights,:keywords,:comments,:abstract,:cls_loc,:cls_dewey,:cls_pg,:cls_isbn,:papersize,:papersize_array,:toc,:lv1,:lv2,:lv3,:lv4,:lv5,:lv6,:lvs,:pagenew,:pagebreak,:pageline,:num_top,:bold_match_list,:italics_match_list,:substitution_match_list,:emphasis_set_to,:toc_lev_limit,:flag_endnotes,:flag_auto_endnotes,:flag_separate_endnotes,:flag_separate_endnotes_make,:markup,:markup_instruction,:flag_tables,:vocabulary,:doc_css,:yaml,:lnk,:links,:prefix_a,:prefix_b,:suffix,:information,:contact,:icon,:image,:ad_url,:ad_png,:ad_alt,:ad_began,:flag_promo,:promo,:ad_home,:stmp,:stmpd,:sc_filename,:sc_number,:sc_date,:sc_time,:sc_info,:yamladdr,:locale,:wc_lines,:wc_words,:wc_bytes,:file_encoding,:filesize,:user,:home,:hostname,:pwd,:firstseg,:programs,:author_copymark,:i18n,:lang,:lang_code_insert,:en,:notes,:dgst,:generated,:tags,:tag_array,:concord_make,:seg_names,:seg_autoname_safe,:set_header_title,:set_heading_top,:set_heading_seg,:heading_seg_first,:heading_seg_first_flag,:base_program,:ec,:opt,:sem_tag,:book_idx,:topic_register,:topic_register_array,:original,:writing_focus,:audio,:daisy,:home_button_image,:home_button_links,:footer_links,:cover_image,:man_section + attr_accessor :make,:env,:path,:file,:fn,:fns,:fno,:fnb,:fnn,:fnt,:fnl,:flv,:fnz,:fnstex,:ocn,:sfx_src,:pdf,:file_type,:dir_out,:dir_tex,:dir_lout,:txt_path,:sisu,:sisu_version,:ruby_version,:title,:subtitle,:full_title,:html_title,:subtitle_tex,:creator,:classify,:author_home,:author,:author_title,:author_nationality,:authors,:authorship,:translator,:illustrator,:prepared_by,:digitized_by,:subject,:description,:publisher,:current_publisher,:contributor,:date,:date_created,:date_issued,:date_available,:date_valid,:date_modified,:date_translated,:date_added_to_site,:date_scheme,:date_created_scheme,:date_issued_scheme,:date_available_scheme,:date_valid_scheme,:date_modified_scheme,:type,:format,:identifier,:source,:language,:language_original,:relation,:coverage,:rights,:keywords,:comments,:abstract,:cls_loc,:cls_dewey,:cls_pg,:cls_isbn,:papersize,:papersize_array,:toc,:lv0,:lv1,:lv2,:lv3,:lv4,:lv5,:lv6,:lvs,:pagenew,:pagebreak,:pageline,:num_top,:bold_match_list,:italics_match_list,:substitution_match_list,:emphasis_set_to,:toc_lev_limit,:flag_endnotes,:flag_auto_endnotes,:flag_separate_endnotes,:flag_separate_endnotes_make,:markup,:markup_instruction,:flag_tables,:vocabulary,:doc_css,:yaml,:lnk,:links,:prefix_a,:prefix_b,:suffix,:information,:contact,:icon,:image,:ad_url,:ad_png,:ad_alt,:ad_began,:flag_promo,:promo,:ad_home,:stmp,:stmpd,:sc_filename,:sc_number,:sc_date,:sc_time,:sc_info,:yamladdr,:locale,:wc_lines,:wc_words,:wc_bytes,:file_encoding,:filesize,:user,:home,:hostname,:pwd,:firstseg,:programs,:author_copymark,:i18n,:lang,:lang_code_insert,:en,:notes,:dgst,:generated,:tags,:tag_array,:concord_make,:seg_names,:seg_autoname_safe,:set_header_title,:set_heading_top,:set_heading_seg,:heading_seg_first,:heading_seg_first_flag,:base_program,:ec,:opt,:sem_tag,:book_idx,:topic_register,:topic_register_array,:original,:writing_focus,:audio,:daisy,:home_button_image,:home_button_links,:footer_links,:cover_image,:man_section def initialize(fns_array,opt) - @env=@path,@file=@fn=@fns=@fno=@fnb=@fnn=@fnt=@fnl=@flv=@fnz=@fnstex=@ocn=@sfx_src=@pdf=@file_type=@dir_out=@dir_tex=@dir_lout=@txt_path=@make=@flag_endnotes=@flag_auto_endnotes=@flag_separate_endnotes=@flag_separate_endnotes_make=@sisu=@sisu_version=@ruby_version=@title=@subtitle=@full_title=@html_title=@subtitle_tex=@creator=@classify=@author_home=@author=@author_title=@author_nationality=@translator=@illustrator=@prepared_by=@digitized_by=@subject=@description=@publisher=@current_publisher=@contributor=@date=@date_created=@date_issued=@date_available=@date_valid=@date_modified=@date_translated=@date_added_to_site=@date_scheme=@date_created_scheme=@date_issued_scheme=@date_available_scheme=@date_valid_scheme=@date_modified_scheme=@type=@format=@identifier=@source=@language=@language_original=@relation=@coverage=@rights=@keywords=@comments=@abstract=@cls_loc=@cls_dewey=@cls_pg=@cls_isbn=@papersize=@toc=@lv1=@lv2=@lv3=@lv4=@lv5=@lv6=@pagenew=@pagebreak=@pageline=@num_top=@bold_match_list=@italics_match_list=@substitution_match_list=@emphasis_set_to=@toc_lev_limit=@flag_tables=@vocabulary=@doc_css=@yaml=@lnk=@links=@prefix_a=@prefix_b=@suffix=@information=@contact=@icon=@ad_url=@ad_png=@ad_alt=@ad_began=@promo=@ad_home=@stmp=@stmpd=@sc_filename=@sc_number=@sc_date=@sc_time=@sc_info=@yamladdr=@locale=@wc_lines=@wc_words=@wc_bytes=@file_encoding=@filesize=@firstseg=@programs=@author_copymark=@i18n=@lang=@lang_code_insert=@en=@notes=@dgst=@generated=@heading_seg_first=@base_program=@topic_register=@original=@writing_focus=@audio=@home_button_image=@home_button_links=@cover_image=@man_section=nil + @env=@path,@file=@fn=@fns=@fno=@fnb=@fnn=@fnt=@fnl=@flv=@fnz=@fnstex=@ocn=@sfx_src=@pdf=@file_type=@dir_out=@dir_tex=@dir_lout=@txt_path=@make=@flag_endnotes=@flag_auto_endnotes=@flag_separate_endnotes=@flag_separate_endnotes_make=@sisu=@sisu_version=@ruby_version=@title=@subtitle=@full_title=@html_title=@subtitle_tex=@creator=@classify=@author_home=@author=@author_title=@author_nationality=@translator=@illustrator=@prepared_by=@digitized_by=@subject=@description=@publisher=@current_publisher=@contributor=@date=@date_created=@date_issued=@date_available=@date_valid=@date_modified=@date_translated=@date_added_to_site=@date_scheme=@date_created_scheme=@date_issued_scheme=@date_available_scheme=@date_valid_scheme=@date_modified_scheme=@type=@format=@identifier=@source=@language=@language_original=@relation=@coverage=@rights=@keywords=@comments=@abstract=@cls_loc=@cls_dewey=@cls_pg=@cls_isbn=@papersize=@toc=@lv0=@lv1=@lv2=@lv3=@lv4=@lv5=@lv6=@pagenew=@pagebreak=@pageline=@num_top=@bold_match_list=@italics_match_list=@substitution_match_list=@emphasis_set_to=@toc_lev_limit=@flag_tables=@vocabulary=@doc_css=@yaml=@lnk=@links=@prefix_a=@prefix_b=@suffix=@information=@contact=@icon=@ad_url=@ad_png=@ad_alt=@ad_began=@promo=@ad_home=@stmp=@stmpd=@sc_filename=@sc_number=@sc_date=@sc_time=@sc_info=@yamladdr=@locale=@wc_lines=@wc_words=@wc_bytes=@file_encoding=@filesize=@firstseg=@programs=@author_copymark=@i18n=@lang=@lang_code_insert=@en=@notes=@dgst=@generated=@heading_seg_first=@base_program=@topic_register=@original=@writing_focus=@audio=@home_button_image=@home_button_links=@cover_image=@man_section=nil @data,@path,@fns,@fno,@opt=fns_array,opt.pth,opt.fns,opt.fno,opt #@data used as data @flag_tables,@set_header_title,@set_heading_top,@set_heading_seg,@heading_seg_first_flag,@flag_promo,@book_idx=false,false,false,false,false,false,false @seg_autoname_safe=true @@ -869,6 +870,7 @@ module SiSU_Param @pagebreak=common_makes[:pagebreak] @pageline=common_makes[:pageline] @toc=common_makes[:toc] + @lv0=common_makes[:lv0] @lv1=common_makes[:lv1] @lv2=common_makes[:lv2] @lv3=common_makes[:lv3] @@ -957,9 +959,9 @@ module SiSU_Param raise "Old markup style in file #{@fns}, current version #{@sisu_version[:project]} #{@sisu_version[:version]} #{@sisu_version[:date_stamp]} #{@sisu_version[:date]}:\n\t\t#{para}\n\n" end @code_flag=case para - when /^code\{\s*$/; true - when /^\}code\s*$/; false - else @code_flag + when /^code\{\s*$/ then true + when /^\}code\s*$/ then false + else @code_flag end regx_header=/^@\S+?:[+-]?\s/ if para =~regx_header \ @@ -1011,6 +1013,7 @@ module SiSU_Param ? (makes[:pageline]) \ : @pageline @toc=(makes[:toc]) ? (makes[:toc]) : @toc + @lv0=(makes[:lv0]) ? (makes[:lv0]) : @lv0 @lv1=(makes[:lv1]) ? (makes[:lv1]) : @lv1 @lv2=(makes[:lv2]) ? (makes[:lv2]) : @lv2 @lv3=(makes[:lv3]) ? (makes[:lv3]) : @lv3 @@ -1051,6 +1054,7 @@ module SiSU_Param ? (makes[:cover_image]) \ : @cover_image end + @lv0 ||=/^0~/ @lv1 ||=/^1~/ @lv2 ||=/^2~/ @lv3 ||=/^3~/ @@ -1086,11 +1090,12 @@ module SiSU_Param end end case para - when /^:?A~#{l_0}/ + #when /^:?A~/ + when /^:?B~#{l_0}/ @lvs[1]=1 - when /^:?B~#{l_1}/ + when /^:?C~#{l_1}/ @lvs[2]=1 - when /^:?C~#{l_2}/ + when /^:?D~#{l_2}/ @lvs[3]=1 when /^1~#{l_3}/ @lvs[4]=1 @@ -1099,7 +1104,7 @@ module SiSU_Param when /^3~#{l_5}/ @lvs[6]=1 end - if para =~ /^:A~/ #% processing + if para =~ /^:?A~/ #% processing if not defined? @title.full.nil? tf=para[/^:A~\S*(.+)$/m,1] tf="@title: #{tf}" @@ -1125,7 +1130,7 @@ module SiSU_Param when /~\^(?:\s|$)/m #% processing mk=para.scan(/~\^(?:\s|$)/) mk.each { |e| @en[:mark] +=1 } - when /^\^~\s+\S/; @en[:note] +=1 #% processing + when /^\^~\s+\S/ then @en[:note] +=1 #% processing end end if para =~/~\{|\^~ |~\^|\{.+?\[[1-6]\]\}\S+?\.ss[tm]/m @@ -1388,6 +1393,7 @@ module SiSU_Param end end @lnk=@lnk.compact if @lnk + @lv0 ||=/^0~/ @lv1 ||=/^1~/ @lv2 ||=/^2~/ @lv3 ||=/^3~/ diff --git a/lib/sisu/v5/param_identify_markup.rb b/lib/sisu/v5/param_identify_markup.rb index 94d28ab8..f6884c7d 100644 --- a/lib/sisu/v5/param_identify_markup.rb +++ b/lib/sisu/v5/param_identify_markup.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -150,8 +151,8 @@ module SiSU_MarkupType end def series s=case identify.version[:determined].to_s - when /^[01]\./; '1.0' - when /^[2]\./; '2.0' + when /^[01]\./ then '1.0' + when /^[2]\./ then '2.0' else '2.0' end "series #{s}" diff --git a/lib/sisu/v5/param_make.rb b/lib/sisu/v5/param_make.rb index 2382532a..17d3b9a3 100644 --- a/lib/sisu/v5/param_make.rb +++ b/lib/sisu/v5/param_make.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -146,17 +147,18 @@ module SiSU_Param_Make x=@h['headings'] x=((x =~/;/) ? (x.split(/;\s*/)) : [ x ]) lv[0]=x - lv1=x[0] ||='1~ ' #some arbitrary changes made + lv0 ||='A~ ' #root level, single document apex, document title + lv1=x[0] ||='B~ ' lv[1]=/^#{lv1}/ - lv2=x[1] ||='2~ ' + lv2=x[1] ||='C~ ' lv[2]=/^#{lv2}/ - lv3=x[2] ||='3~ ' + lv3=x[2] ||='D~ ' lv[3]=/^#{lv3}/ - lv4=x[3] ||='4~ ' + lv4=x[3] ||='1~ ' lv[4]=/^#{lv4}/ - lv5=x[4] ||='5~ ' + lv5=x[4] ||='2~ ' lv[5]=/^#{lv5}/ - lv6=x[5] ||='6~ ' + lv6=x[5] ||='3~ ' lv[6]=/^#{lv6}/ lv end diff --git a/lib/sisu/v5/particulars.rb b/lib/sisu/v5/particulars.rb index beeaf429..0687150a 100644 --- a/lib/sisu/v5/particulars.rb +++ b/lib/sisu/v5/particulars.rb @@ -9,7 +9,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/po4a.rb b/lib/sisu/v5/po4a.rb index 217f2975..990600aa 100644 --- a/lib/sisu/v5/po4a.rb +++ b/lib/sisu/v5/po4a.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -820,13 +821,13 @@ GSUB @p_num=SiSU_Po4aUtils::ParagraphNumber.new(paranum) end case dob_src.is - when :heading; pot_structure_heading(dob_src,notes_s,dob_trn,notes_t) - when :para; pot_structure_para(dob_src,notes_s,dob_trn,notes_t) - when :group; pot_structure_group(dob_src,notes_s,dob_trn,notes_t) - when :block; pot_structure_block(dob_src,notes_s,dob_trn,notes_t) - when :verse; pot_structure_verse(dob_src,notes_s,dob_trn,notes_t) - when :code; pot_structure_code(dob_src,notes_s,dob_trn,notes_t) - when :table; pot_structure_table(dob_src,notes_s,dob_trn,notes_t) + when :heading then pot_structure_heading(dob_src,notes_s,dob_trn,notes_t) + when :para then pot_structure_para(dob_src,notes_s,dob_trn,notes_t) + when :group then pot_structure_group(dob_src,notes_s,dob_trn,notes_t) + when :block then pot_structure_block(dob_src,notes_s,dob_trn,notes_t) + when :verse then pot_structure_verse(dob_src,notes_s,dob_trn,notes_t) + when :code then pot_structure_code(dob_src,notes_s,dob_trn,notes_t) + when :table then pot_structure_table(dob_src,notes_s,dob_trn,notes_t) end if defined? dob_src.idx \ and not dob_src.idx.nil? \ diff --git a/lib/sisu/v5/po4a_set.rb b/lib/sisu/v5/po4a_set.rb index 44660ef5..33ccc33f 100644 --- a/lib/sisu/v5/po4a_set.rb +++ b/lib/sisu/v5/po4a_set.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -216,52 +217,52 @@ WOK end def start_is_match case @p - when /^#{Mx[:meta_o]}(title)#{Mx[:meta_c]}\s*(.+?)$/; header($1,@md.title.full,'meta','dc') #dc 1 - when /^#{Mx[:meta_o]}(creator|author)#{Mx[:meta_c]}\s*(.+?)$/; header('creator',$2,'meta','dc') #dc 2 - when /^#{Mx[:meta_o]}(subject)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 3 - when /^#{Mx[:meta_o]}(description)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 4 - when /^#{Mx[:meta_o]}(publisher)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 5 - when /^#{Mx[:meta_o]}(contributor)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 6 - when /^#{Mx[:meta_o]}(date)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 7 - when /^#{Mx[:meta_o]}(date\.created)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra') - when /^#{Mx[:meta_o]}(date\.issued)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra') - when /^#{Mx[:meta_o]}(date\.available)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra') - when /^#{Mx[:meta_o]}(date\.valid)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra') - when /^#{Mx[:meta_o]}(date\.modified)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra') - when /^#{Mx[:meta_o]}(type)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 8 - when /^#{Mx[:meta_o]}(format)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 9 - when /^#{Mx[:meta_o]}(identifier)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 10 - when /^#{Mx[:meta_o]}(source)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 11 - when /^#{Mx[:meta_o]}(language)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 12 - when /^#{Mx[:meta_o]}(relation)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 13 - when /^#{Mx[:meta_o]}(coverage)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 14 - when /^#{Mx[:meta_o]}(rights)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 15 - when /^#{Mx[:meta_o]}(keywords)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra') - when /^#{Mx[:meta_o]}(copyright)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra') - when /^#{Mx[:meta_o]}(translator|translated_by)#{Mx[:meta_c]}\s*(.+?)$/; header('translator',$2) - when /^#{Mx[:meta_o]}(illustrator|illustrated_by)#{Mx[:meta_c]}\s*(.+?)$/; header('illustrator',$2) - when /^#{Mx[:meta_o]}(prepared_by)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra') - when /^#{Mx[:meta_o]}(digitized_by)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra') - when /^#{Mx[:meta_o]}(comments?)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra') - when /^#{Mx[:meta_o]}(abstract)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra') - when /^#{Mx[:meta_o]}(tags?)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra') - when /^#{Mx[:meta_o]}(catalogue)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra') - when /^#{Mx[:meta_o]}(class(?:ify)?_loc)#{Mx[:meta_c]}\s*(.+?)$/; header('classify_loc',$2,'meta','extra') - when /^#{Mx[:meta_o]}(class(?:ify)?_dewey)#{Mx[:meta_c]}\s*(.+?)$/; header('classify_dewey',$2,'meta','extra') - when /^#{Mx[:meta_o]}(class(?:ify)?_pg)#{Mx[:meta_c]}\s*(.+?)$/; header('classify_pg',$2,'meta','extra') - when /^#{Mx[:meta_o]}(class(?:ify)?_isbn)#{Mx[:meta_c]}\s*(.+?)$/; header('classify_isbn',$2,'meta','extra') - when /^#{Mx[:meta_o]}(toc|structure)#{Mx[:meta_c]}\s*(.+?)$/; header('structure',$2,'process','instruct') - when /^#{Mx[:meta_o]}(level|page|markup)#{Mx[:meta_c]}\s*(.+?)$/; header('markup',$2,'process','instruct') - when /^#{Mx[:meta_o]}(bold)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct') - when /^#{Mx[:meta_o]}(italics|itali[sz]e)#{Mx[:meta_c]}\s*(.+?)$/; header('italicize',$2,'process','instruct') - when /^#{Mx[:meta_o]}(vocabulary|wordlist)#{Mx[:meta_c]}\s*(.+?)$/; header('vocabulary',$2,'process','instruct') - when /^#{Mx[:meta_o]}(css|stylesheet)#{Mx[:meta_c]}\s*(.+?)$/; header('css',$2,'process','instruct') - when /^#{Mx[:meta_o]}(links)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct') - when /^#{Mx[:meta_o]}(prefix)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct') #add a & b - when /^#{Mx[:meta_o]}(suffix)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct') - when /^#{Mx[:meta_o]}(information)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct') - when /^#{Mx[:meta_o]}(contact)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct') - when /^#{Mx[:meta_o]}(rcs|cvs)#{Mx[:meta_c]}\s*(.+?)$/; header('version',$2,'process','instruct') + when /^#{Mx[:meta_o]}(title)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,@md.title.full,'meta','dc') #dc 1 + when /^#{Mx[:meta_o]}(creator|author)#{Mx[:meta_c]}\s*(.+?)$/ then header('creator',$2,'meta','dc') #dc 2 + when /^#{Mx[:meta_o]}(subject)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','dc') #dc 3 + when /^#{Mx[:meta_o]}(description)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','dc') #dc 4 + when /^#{Mx[:meta_o]}(publisher)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','dc') #dc 5 + when /^#{Mx[:meta_o]}(contributor)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','dc') #dc 6 + when /^#{Mx[:meta_o]}(date)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','dc') #dc 7 + when /^#{Mx[:meta_o]}(date\.created)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','extra') + when /^#{Mx[:meta_o]}(date\.issued)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','extra') + when /^#{Mx[:meta_o]}(date\.available)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','extra') + when /^#{Mx[:meta_o]}(date\.valid)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','extra') + when /^#{Mx[:meta_o]}(date\.modified)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','extra') + when /^#{Mx[:meta_o]}(type)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','dc') #dc 8 + when /^#{Mx[:meta_o]}(format)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','dc') #dc 9 + when /^#{Mx[:meta_o]}(identifier)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','dc') #dc 10 + when /^#{Mx[:meta_o]}(source)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','dc') #dc 11 + when /^#{Mx[:meta_o]}(language)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','dc') #dc 12 + when /^#{Mx[:meta_o]}(relation)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','dc') #dc 13 + when /^#{Mx[:meta_o]}(coverage)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','dc') #dc 14 + when /^#{Mx[:meta_o]}(rights)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','dc') #dc 15 + when /^#{Mx[:meta_o]}(keywords)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','extra') + when /^#{Mx[:meta_o]}(copyright)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','extra') + when /^#{Mx[:meta_o]}(translator|translated_by)#{Mx[:meta_c]}\s*(.+?)$/ then header('translator',$2) + when /^#{Mx[:meta_o]}(illustrator|illustrated_by)#{Mx[:meta_c]}\s*(.+?)$/ then header('illustrator',$2) + when /^#{Mx[:meta_o]}(prepared_by)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','extra') + when /^#{Mx[:meta_o]}(digitized_by)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','extra') + when /^#{Mx[:meta_o]}(comments?)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','extra') + when /^#{Mx[:meta_o]}(abstract)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','extra') + when /^#{Mx[:meta_o]}(tags?)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','extra') + when /^#{Mx[:meta_o]}(catalogue)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','extra') + when /^#{Mx[:meta_o]}(class(?:ify)?_loc)#{Mx[:meta_c]}\s*(.+?)$/ then header('classify_loc',$2,'meta','extra') + when /^#{Mx[:meta_o]}(class(?:ify)?_dewey)#{Mx[:meta_c]}\s*(.+?)$/ then header('classify_dewey',$2,'meta','extra') + when /^#{Mx[:meta_o]}(class(?:ify)?_pg)#{Mx[:meta_c]}\s*(.+?)$/ then header('classify_pg',$2,'meta','extra') + when /^#{Mx[:meta_o]}(class(?:ify)?_isbn)#{Mx[:meta_c]}\s*(.+?)$/ then header('classify_isbn',$2,'meta','extra') + when /^#{Mx[:meta_o]}(toc|structure)#{Mx[:meta_c]}\s*(.+?)$/ then header('structure',$2,'process','instruct') + when /^#{Mx[:meta_o]}(level|page|markup)#{Mx[:meta_c]}\s*(.+?)$/ then header('markup',$2,'process','instruct') + when /^#{Mx[:meta_o]}(bold)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'process','instruct') + when /^#{Mx[:meta_o]}(italics|itali[sz]e)#{Mx[:meta_c]}\s*(.+?)$/ then header('italicize',$2,'process','instruct') + when /^#{Mx[:meta_o]}(vocabulary|wordlist)#{Mx[:meta_c]}\s*(.+?)$/ then header('vocabulary',$2,'process','instruct') + when /^#{Mx[:meta_o]}(css|stylesheet)#{Mx[:meta_c]}\s*(.+?)$/ then header('css',$2,'process','instruct') + when /^#{Mx[:meta_o]}(links)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'process','instruct') + when /^#{Mx[:meta_o]}(prefix)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'process','instruct') #add a & b + when /^#{Mx[:meta_o]}(suffix)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'process','instruct') + when /^#{Mx[:meta_o]}(information)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'process','instruct') + when /^#{Mx[:meta_o]}(contact)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'process','instruct') + when /^#{Mx[:meta_o]}(rcs|cvs)#{Mx[:meta_c]}\s*(.+?)$/ then header('version',$2,'process','instruct') else nil end end diff --git a/lib/sisu/v5/prog_text_translation.rb b/lib/sisu/v5/prog_text_translation.rb index ae166d23..98319960 100644 --- a/lib/sisu/v5/prog_text_translation.rb +++ b/lib/sisu/v5/prog_text_translation.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -66,35 +67,35 @@ module SiSU_Translate def initialize(md,doc_lang,trans_str='') @md,@doc_lang,@trans_str=md,doc_lang,trans_str @lang_class=case @doc_lang - when /American/i; English.new(md,doc_lang,trans_str) # tag depreciated, see iso 639-2 - when /English/i; English.new(md,doc_lang,trans_str) - when /French/i; French.new(md,doc_lang,trans_str) - when /German/i; German.new(md,doc_lang,trans_str) - when /Italian/i; Italian.new(md,doc_lang,trans_str) - when /Spanish/i; Spanish.new(md,doc_lang,trans_str) - when /Portuguese Brazil|Brazilian(?: Portuguese)?/i; - Portuguese.new(md,doc_lang,trans_str) # tag depreciated, see iso 639-2 - when /Portuguese/i; Portuguese.new(md,doc_lang,trans_str) - when /Swedish/i; Swedish.new(md,doc_lang,trans_str) - when /Danish/i; Danish.new(md,doc_lang,trans_str) - when /Finnish/i; Finnish.new(md,doc_lang,trans_str) - when /Norwegian/i; Norwegian.new(md,doc_lang,trans_str) - when /Icelandic/i; Icelandic.new(md,doc_lang,trans_str) - when /Dutch/i; Dutch.new(md,doc_lang,trans_str) - when /Estonian/i; Estonian.new(md,doc_lang,trans_str) - when /Hungarian/i; Hungarian.new(md,doc_lang,trans_str) - when /Polish/i; Polish.new(md,doc_lang,trans_str) - when /Romanian/i; Romanian.new(md,doc_lang,trans_str) - when /Russian/i; Russian.new(md,doc_lang,trans_str) - when /Greek/i; Greek.new(md,doc_lang,trans_str) - when /Ukranian/i; Ukranian.new(md,doc_lang,trans_str) - when /Turkish/i; Turkish.new(md,doc_lang,trans_str) - when /Slovenian/i; Slovenian.new(md,doc_lang,trans_str) - when /Croatian/i; Croatian.new(md,doc_lang,trans_str) - when /Slovak(?:ian)?/i; Slovak.new(md,doc_lang,trans_str) - when /Czech/i; Czech.new(md,doc_lang,trans_str) - when /Bulgarian/i; Bulgarian.new(md,doc_lang,trans_str) - else English.new(md,doc_lang,trans_str) + when /American/i then English.new(md,doc_lang,trans_str) # tag depreciated, see iso 639-2 + when /English/i then English.new(md,doc_lang,trans_str) + when /French/i then French.new(md,doc_lang,trans_str) + when /German/i then German.new(md,doc_lang,trans_str) + when /Italian/i then Italian.new(md,doc_lang,trans_str) + when /Spanish/i then Spanish.new(md,doc_lang,trans_str) + when /Portuguese Brazil|Brazilian(?: Portuguese)?/i + Portuguese.new(md,doc_lang,trans_str) # tag depreciated, see iso 639-2 + when /Portuguese/i then Portuguese.new(md,doc_lang,trans_str) + when /Swedish/i then Swedish.new(md,doc_lang,trans_str) + when /Danish/i then Danish.new(md,doc_lang,trans_str) + when /Finnish/i then Finnish.new(md,doc_lang,trans_str) + when /Norwegian/i then Norwegian.new(md,doc_lang,trans_str) + when /Icelandic/i then Icelandic.new(md,doc_lang,trans_str) + when /Dutch/i then Dutch.new(md,doc_lang,trans_str) + when /Estonian/i then Estonian.new(md,doc_lang,trans_str) + when /Hungarian/i then Hungarian.new(md,doc_lang,trans_str) + when /Polish/i then Polish.new(md,doc_lang,trans_str) + when /Romanian/i then Romanian.new(md,doc_lang,trans_str) + when /Russian/i then Russian.new(md,doc_lang,trans_str) + when /Greek/i then Greek.new(md,doc_lang,trans_str) + when /Ukranian/i then Ukranian.new(md,doc_lang,trans_str) + when /Turkish/i then Turkish.new(md,doc_lang,trans_str) + when /Slovenian/i then Slovenian.new(md,doc_lang,trans_str) + when /Croatian/i then Croatian.new(md,doc_lang,trans_str) + when /Slovak(?:ian)?/i then Slovak.new(md,doc_lang,trans_str) + when /Czech/i then Czech.new(md,doc_lang,trans_str) + when /Bulgarian/i then Bulgarian.new(md,doc_lang,trans_str) + else English.new(md,doc_lang,trans_str) end end def filename @@ -279,38 +280,38 @@ module SiSU_Translate end def language_list case @trans_str - when /American/i; 'American English' # tag depreciated, see iso 639-2 - when /English/i; 'English' - when /French/i; 'français' - when /German/i; 'Deutsch' - when /Italian/i; 'Italiano' - when /Spanish/i; 'español' - when /Portuguese Brazil|Brazilian(?: Portuguese)?/i; - 'Brazilian Português' # tag depreciated, see iso 639-2 - when /Portuguese/i; 'Português' - when /Swedish/i; 'svenska' - when /Danish/i; 'dansk' - when /Finnish/i; 'suomi' - when /Norwegian/i; 'norsk' - when /Icelandic/i; 'Icelandic' - when /Dutch/i; 'Nederlands' - when /Estonian/i; 'Estonian' - when /Hungarian/i; 'Hungarian' - when /Polish/i; 'polski' - when /Romanian/i; 'română' - when /Russian/i; 'Русский (Russkij)' - when /Greek/i; 'Ελληνικά (Ellinika)' - when /Ukranian/i; 'українська (ukrajins\'ka)' - when /Turkish/i; 'Türkçe' - when /Slovenian/i; 'Slovenian' - when /Croatian/i; 'Croatian' - when /Slovak(?:ian)?/i; 'slovensky' #slovensky ? - when /Czech/i; 'česky' - when /Bulgarian/i; 'Български (Bəlgarski)' - when /Japanese/i; '日本語 (Nihongo)' - when /Korean/i; '한국어 (Hangul)' - #when /Catalan/i; 'català' - else 'English' + when /American/i then 'American English' # tag depreciated, see iso 639-2 + when /English/i then 'English' + when /French/i then 'français' + when /German/i then 'Deutsch' + when /Italian/i then 'Italiano' + when /Spanish/i then 'español' + when /Portuguese Brazil|Brazilian(?: Portuguese)?/i + 'Brazilian Português' # tag depreciated, see iso 639-2 + when /Portuguese/i then 'Português' + when /Swedish/i then 'svenska' + when /Danish/i then 'dansk' + when /Finnish/i then 'suomi' + when /Norwegian/i then 'norsk' + when /Icelandic/i then 'Icelandic' + when /Dutch/i then 'Nederlands' + when /Estonian/i then 'Estonian' + when /Hungarian/i then 'Hungarian' + when /Polish/i then 'polski' + when /Romanian/i then 'română' + when /Russian/i then 'Русский (Russkij)' + when /Greek/i then 'Ελληνικά (Ellinika)' + when /Ukranian/i then 'українська (ukrajins\'ka)' + when /Turkish/i then 'Türkçe' + when /Slovenian/i then 'Slovenian' + when /Croatian/i then 'Croatian' + when /Slovak(?:ian)?/i then 'slovensky' #slovensky ? + when /Czech/i then 'česky' + when /Bulgarian/i then 'Български (Bəlgarski)' + when /Japanese/i then '日本語 (Nihongo)' + when /Korean/i then '한국어 (Hangul)' + #when /Catalan/i then 'català' + else 'English' end #check on 中文 and عربي end @@ -498,34 +499,34 @@ module SiSU_Translate end def language_list_translated case @trans_str - when /American/i; 'American English' # tag depreciated, see iso 639-2 - when /English/i; 'English' - when /French/i; 'French' - when /German/i; 'German' - when /Italian/i; 'Italian' - when /Spanish/i; 'Spanish' - when /Portuguese Brazil|Brazilian(?: Portuguese)?/i; - 'Brazilian Portuguese' # tag depreciated, see iso 639-2 - when /Portuguese/i; 'Portuguese' - when /Swedish/i; 'Swedish' - when /Danish/i; 'Danish' - when /Finnish/i; 'Finnish' - when /Norwegian/i; 'Norwegian' - when /Icelandic/i; 'Icelandic' - when /Dutch/i; 'Dutch' - when /Estonian/i; 'Estonian' - when /Hungarian/i; 'Hungarian' - when /Polish/i; 'Polish' - when /Romanian/i; 'Romanian' - when /Russian/i; 'Russian' - when /Greek/i; 'Greek' - when /Ukranian/i; 'Ukranian' - when /Turkish/i; 'Turkish' - when /Slovenian/i; 'Slovenian' - when /Croatian/i; 'Croatian' - when /Slovak(?:ian)?/i; 'Slovakian' - when /Czech/i; 'Czech' - when /Bulgarian/i; 'Bulgarian' + when /American/i then 'American English' # tag depreciated, see iso 639-2 + when /English/i then 'English' + when /French/i then 'French' + when /German/i then 'German' + when /Italian/i then 'Italian' + when /Spanish/i then 'Spanish' + when /Portuguese Brazil|Brazilian(?: Portuguese)?/i + 'Brazilian Portuguese' # tag depreciated, see iso 639-2 + when /Portuguese/i then 'Portuguese' + when /Swedish/i then 'Swedish' + when /Danish/i then 'Danish' + when /Finnish/i then 'Finnish' + when /Norwegian/i then 'Norwegian' + when /Icelandic/i then 'Icelandic' + when /Dutch/i then 'Dutch' + when /Estonian/i then 'Estonian' + when /Hungarian/i then 'Hungarian' + when /Polish/i then 'Polish' + when /Romanian/i then 'Romanian' + when /Russian/i then 'Russian' + when /Greek/i then 'Greek' + when /Ukranian/i then 'Ukranian' + when /Turkish/i then 'Turkish' + when /Slovenian/i then 'Slovenian' + when /Croatian/i then 'Croatian' + when /Slovak(?:ian)?/i then 'Slovakian' + when /Czech/i then 'Czech' + when /Bulgarian/i then 'Bulgarian' else @trans_str end end @@ -713,34 +714,34 @@ module SiSU_Translate end def language_list_translated case @trans_str - when /American/i; 'Anglais americain' # tag depreciated, see iso 639-2 - when /English/i; 'Anglais' - when /French/i; 'Français' - when /German/i; 'Allemand' - when /Italian/i; 'Italien' - when /Spanish/i; 'Espagnol' - when /Portuguese Brazil|Brazilian(?: Portuguese)?/i; - 'Portugais brésilien' # tag depreciated, see iso 639-2 - when /Portuguese/i; 'Portugais' - when /Swedish/i; 'Suédois' - when /Danish/i; 'Danois' - when /Finnish/i; 'Finnois' - when /Norwegian/i; 'Norvégien' - when /Icelandic/i; 'Islandais' - when /Dutch/i; 'Néerlandais' - when /Estonian/i; 'Estonien' - when /Hungarian/i; 'Hongrois' - when /Polish/i; 'Polonais' - when /Romanian/i; 'Roumain' - when /Russian/i; 'Russe' - when /Greek/i; 'Grec' - when /Ukranian/i; 'Ukrainien' - when /Turkish/i; 'Turc' - when /Slovenian/i; 'Slovène' - when /Croatian/i; 'Croate' - when /Slovak(?:ian)?/i; 'Slovaque' - when /Czech/i; 'Tcheque' - when /Bulgarian/i; 'Bulgare' + when /American/i then 'Anglais americain' # tag depreciated, see iso 639-2 + when /English/i then 'Anglais' + when /French/i then 'Français' + when /German/i then 'Allemand' + when /Italian/i then 'Italien' + when /Spanish/i then 'Espagnol' + when /Portuguese Brazil|Brazilian(?: Portuguese)?/i + 'Portugais brésilien' # tag depreciated, see iso 639-2 + when /Portuguese/i then 'Portugais' + when /Swedish/i then 'Suédois' + when /Danish/i then 'Danois' + when /Finnish/i then 'Finnois' + when /Norwegian/i then 'Norvégien' + when /Icelandic/i then 'Islandais' + when /Dutch/i then 'Néerlandais' + when /Estonian/i then 'Estonien' + when /Hungarian/i then 'Hongrois' + when /Polish/i then 'Polonais' + when /Romanian/i then 'Roumain' + when /Russian/i then 'Russe' + when /Greek/i then 'Grec' + when /Ukranian/i then 'Ukrainien' + when /Turkish/i then 'Turc' + when /Slovenian/i then 'Slovène' + when /Croatian/i then 'Croate' + when /Slovak(?:ian)?/i then 'Slovaque' + when /Czech/i then 'Tcheque' + when /Bulgarian/i then 'Bulgare' else @trans_str end end @@ -925,34 +926,34 @@ module SiSU_Translate end def language_list_translated case @trans_str - when /American/i; 'Amerikanisch-Englisch' # tag depreciated, see iso 639-2 - when /English/i; 'Englisch' - when /French/i; 'Französisch' - when /German/i; 'Deutsch' - when /Italian/i; 'Italienisch' - when /Spanish/i; 'Spanisch' - when /Portuguese Brazil|Brazilian(?: Portuguese)?/i; - 'Brasilianisch-Portugiesisch' # tag depreciated, see iso 639-2 - when /Portuguese/i; 'Portugiesisch' - when /Swedish/i; 'Schwedisch' - when /Danish/i; 'Dänisch' - when /Finnish/i; 'Finnisch' - when /Norwegian/i; 'Norwegisch' - when /Icelandic/i; 'Isländisch' - when /Dutch/i; 'Niederländisch' - when /Estonian/i; 'Estnisch' - when /Hungarian/i; 'Ungarisch' - when /Polish/i; 'Polnisch' - when /Romanian/i; 'Rumänisch' - when /Russian/i; 'Russisch' - when /Greek/i; 'Griechisch' - when /Ukranian/i; 'Ukrainisch' - when /Turkish/i; 'Türkisch' - when /Slovenian/i; 'Slovenisch' - when /Croatian/i; 'Kroatisch' - when /Slovak(?:ian)?/i; 'Slovakisch' - when /Czech/i; 'Tschechisch' - when /Bulgarian/i; 'Bulgarisch' + when /American/i then 'Amerikanisch-Englisch' # tag depreciated, see iso 639-2 + when /English/i then 'Englisch' + when /French/i then 'Französisch' + when /German/i then 'Deutsch' + when /Italian/i then 'Italienisch' + when /Spanish/i then 'Spanisch' + when /Portuguese Brazil|Brazilian(?: Portuguese)?/i + 'Brasilianisch-Portugiesisch' # tag depreciated, see iso 639-2 + when /Portuguese/i then 'Portugiesisch' + when /Swedish/i then 'Schwedisch' + when /Danish/i then 'Dänisch' + when /Finnish/i then 'Finnisch' + when /Norwegian/i then 'Norwegisch' + when /Icelandic/i then 'Isländisch' + when /Dutch/i then 'Niederländisch' + when /Estonian/i then 'Estnisch' + when /Hungarian/i then 'Ungarisch' + when /Polish/i then 'Polnisch' + when /Romanian/i then 'Rumänisch' + when /Russian/i then 'Russisch' + when /Greek/i then 'Griechisch' + when /Ukranian/i then 'Ukrainisch' + when /Turkish/i then 'Türkisch' + when /Slovenian/i then 'Slovenisch' + when /Croatian/i then 'Kroatisch' + when /Slovak(?:ian)?/i then 'Slovakisch' + when /Czech/i then 'Tschechisch' + when /Bulgarian/i then 'Bulgarisch' else @trans_str end end @@ -1137,34 +1138,34 @@ module SiSU_Translate end def language_list_translated case @trans_str - when /American/i; 'Inglés Americano' # tag depreciated, see iso 639-2 - when /English/i; 'Inglés' - when /French/i; 'Francés' - when /German/i; 'Alemán' - when /Italian/i; 'Italiano' - when /Spanish/i; 'Español' - when /Portuguese Brazil|Brazilian(?: Portuguese)?/i; - 'Portugués de Brasil' # tag depreciated, see iso 639-2 - when /Portuguese/i; 'Portugués' - when /Swedish/i; 'Sueco' - when /Danish/i; 'Danés' - when /Finnish/i; 'Finés' - when /Norwegian/i; 'Noruego' - when /Icelandic/i; 'Islandés' - when /Dutch/i; 'Holandés' - when /Estonian/i; 'Estonio' - when /Hungarian/i; 'Húngaro' - when /Polish/i; 'Polaco' - when /Romanian/i; 'Rumano' - when /Russian/i; 'Ruso' - when /Greek/i; 'Griego' - when /Ukranian/i; 'Ucraniano' - when /Turkish/i; 'Turco' - when /Slovenian/i; 'Eslovaco' - when /Croatian/i; 'Croata' - when /Slovak(?:ian)?/i; 'Eslovaco' - when /Czech/i; 'Checo' - when /Bulgarian/i; 'Búlgaro' + when /American/i then 'Inglés Americano' # tag depreciated, see iso 639-2 + when /English/i then 'Inglés' + when /French/i then 'Francés' + when /German/i then 'Alemán' + when /Italian/i then 'Italiano' + when /Spanish/i then 'Español' + when /Portuguese Brazil|Brazilian(?: Portuguese)?/i + 'Portugués de Brasil' # tag depreciated, see iso 639-2 + when /Portuguese/i then 'Portugués' + when /Swedish/i then 'Sueco' + when /Danish/i then 'Danés' + when /Finnish/i then 'Finés' + when /Norwegian/i then 'Noruego' + when /Icelandic/i then 'Islandés' + when /Dutch/i then 'Holandés' + when /Estonian/i then 'Estonio' + when /Hungarian/i then 'Húngaro' + when /Polish/i then 'Polaco' + when /Romanian/i then 'Rumano' + when /Russian/i then 'Ruso' + when /Greek/i then 'Griego' + when /Ukranian/i then 'Ucraniano' + when /Turkish/i then 'Turco' + when /Slovenian/i then 'Eslovaco' + when /Croatian/i then 'Croata' + when /Slovak(?:ian)?/i then 'Eslovaco' + when /Czech/i then 'Checo' + when /Bulgarian/i then 'Búlgaro' else @trans_str end end @@ -1349,34 +1350,34 @@ module SiSU_Translate end def language_list_translated case @trans_str - when /American/i; 'Inglese USA' # tag depreciated, see iso 639-2 - when /English/i; 'Inglese' - when /French/i; 'Francese' - when /German/i; 'Tedesco' - when /Italian/i; 'Italiano' - when /Spanish/i; 'Spagnolo' - when /Portuguese Brazil|Brazilian(?: Portuguese)?/i; - 'Portoguese (Brasile)' # tag depreciated, see iso 639-2 - when /Portuguese/i; 'Portoguese' - when /Swedish/i; 'Svedese' - when /Danish/i; 'Danese' - when /Finnish/i; 'Finlandese' - when /Norwegian/i; 'Norvegese' - when /Icelandic/i; 'Islandese' - when /Dutch/i; 'Olandese' - when /Estonian/i; 'Estone' - when /Hungarian/i; 'Ungherese' - when /Polish/i; 'Polacco' - when /Romanian/i; 'Romeno' - when /Russian/i; 'Russo' - when /Greek/i; 'Greco' - when /Ukranian/i; 'Ucraino' - when /Turkish/i; 'Turco' - when /Slovenian/i; 'Sloveno' - when /Croatian/i; 'Croato' - when /Slovak(?:ian)?/i; 'Slovacco' - when /Czech/i; 'Ceco' - when /Bulgarian/i; 'Bulgaro' + when /American/i then 'Inglese USA' # tag depreciated, see iso 639-2 + when /English/i then 'Inglese' + when /French/i then 'Francese' + when /German/i then 'Tedesco' + when /Italian/i then 'Italiano' + when /Spanish/i then 'Spagnolo' + when /Portuguese Brazil|Brazilian(?: Portuguese)?/i + 'Portoguese (Brasile)' # tag depreciated, see iso 639-2 + when /Portuguese/i then 'Portoguese' + when /Swedish/i then 'Svedese' + when /Danish/i then 'Danese' + when /Finnish/i then 'Finlandese' + when /Norwegian/i then 'Norvegese' + when /Icelandic/i then 'Islandese' + when /Dutch/i then 'Olandese' + when /Estonian/i then 'Estone' + when /Hungarian/i then 'Ungherese' + when /Polish/i then 'Polacco' + when /Romanian/i then 'Romeno' + when /Russian/i then 'Russo' + when /Greek/i then 'Greco' + when /Ukranian/i then 'Ucraino' + when /Turkish/i then 'Turco' + when /Slovenian/i then 'Sloveno' + when /Croatian/i then 'Croato' + when /Slovak(?:ian)?/i then 'Slovacco' + when /Czech/i then 'Ceco' + when /Bulgarian/i then 'Bulgaro' else @trans_str end end @@ -1561,34 +1562,34 @@ module SiSU_Translate end def language_list_translated case @trans_str - when /American/i; 'Amerikanenglanti' # tag depreciated, see iso 639-2 - when /English/i; 'Englanti' - when /French/i; 'Ranska' - when /German/i; 'Saksa' - when /Italian/i; 'Italia' - when /Spanish/i; 'Espanja' - when /Portuguese Brazil|Brazilian(?: Portuguese)?/i; - 'Brasilian portugali' # tag depreciated, see iso 639-2 - when /Portuguese/i; 'Portugali' - when /Swedish/i; 'Ruotsi' - when /Danish/i; 'Tanska' - when /Finnish/i; 'Suomi' - when /Norwegian/i; 'Norja' - when /Icelandic/i; 'Islanti' - when /Dutch/i; 'Hollanti' - when /Estonian/i; 'Viro' - when /Hungarian/i; 'Unkari' - when /Polish/i; 'Puola' - when /Romanian/i; 'Romania' - when /Russian/i; 'Venäjä' - when /Greek/i; 'Kreikka' - when /Ukranian/i; 'Ukraina' - when /Turkish/i; 'Turkki' - when /Slovenian/i; 'Slovenia' - when /Croatian/i; 'Kroatia' - when /Slovak(?:ian)?/i; 'Slovakki' - when /Czech/i; 'Tsekki' - when /Bulgarian/i; 'Bulgaria' + when /American/i then 'Amerikanenglanti' # tag depreciated, see iso 639-2 + when /English/i then 'Englanti' + when /French/i then 'Ranska' + when /German/i then 'Saksa' + when /Italian/i then 'Italia' + when /Spanish/i then 'Espanja' + when /Portuguese Brazil|Brazilian(?: Portuguese)?/i + 'Brasilian portugali' # tag depreciated, see iso 639-2 + when /Portuguese/i then 'Portugali' + when /Swedish/i then 'Ruotsi' + when /Danish/i then 'Tanska' + when /Finnish/i then 'Suomi' + when /Norwegian/i then 'Norja' + when /Icelandic/i then 'Islanti' + when /Dutch/i then 'Hollanti' + when /Estonian/i then 'Viro' + when /Hungarian/i then 'Unkari' + when /Polish/i then 'Puola' + when /Romanian/i then 'Romania' + when /Russian/i then 'Venäjä' + when /Greek/i then 'Kreikka' + when /Ukranian/i then 'Ukraina' + when /Turkish/i then 'Turkki' + when /Slovenian/i then 'Slovenia' + when /Croatian/i then 'Kroatia' + when /Slovak(?:ian)?/i then 'Slovakki' + when /Czech/i then 'Tsekki' + when /Bulgarian/i then 'Bulgaria' else @trans_str end end diff --git a/lib/sisu/v5/qrcode.rb b/lib/sisu/v5/qrcode.rb index bb587f26..a5888365 100644 --- a/lib/sisu/v5/qrcode.rb +++ b/lib/sisu/v5/qrcode.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/relaxng.rb b/lib/sisu/v5/relaxng.rb index ef632308..f6e86470 100644 --- a/lib/sisu/v5/relaxng.rb +++ b/lib/sisu/v5/relaxng.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/remote.rb b/lib/sisu/v5/remote.rb index 7af2e823..145ec9b2 100644 --- a/lib/sisu/v5/remote.rb +++ b/lib/sisu/v5/remote.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/response.rb b/lib/sisu/v5/response.rb index 6d167ab6..969da001 100644 --- a/lib/sisu/v5/response.rb +++ b/lib/sisu/v5/response.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/rexml.rb b/lib/sisu/v5/rexml.rb index 40135202..c00797a3 100644 --- a/lib/sisu/v5/rexml.rb +++ b/lib/sisu/v5/rexml.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/screen_text_color.rb b/lib/sisu/v5/screen_text_color.rb index 1d9de72c..42b0c698 100644 --- a/lib/sisu/v5/screen_text_color.rb +++ b/lib/sisu/v5/screen_text_color.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -70,8 +71,7 @@ module SiSU_Screen attr_reader :cX def initialize(color_state,*txt) @color_state,@txt=color_state,txt - @color_instruct=txt[0] #### - #flag=SiSU_Env::InfoProcessingFlag.new + @color_instruct=txt[0] @cX=@@cX=if color_state==:on Color.new do self.off=self.white=self.white_bold=self.marker=self.bold=self.underline=self.invert=self.darkgrey_hi=self.grey_hi=self.pink_hi=self.fuchsia_hi=self.red_hi=self.orange_hi=self.yellow_hi=self.brown_hi=self.lightgreen_hi=self.green_hi=self.cyan_hi=self.blue_hi=self.navy_hi=self.grey=self.pink=self.fuchsia=self.ruby=self.red=self.orange=self.yellow=self.brown=self.green=self.darkgreen=self.cyan=self.blue=self.navy=self.black='' @@ -121,69 +121,69 @@ module SiSU_Screen end def color case @color_instruct - when /invert/; @cX.invert - when /darkgrey_hi/; @cX.darkgrey_hi - when /grey_hi/; @cX.grey_hi - when /pink_hi/; @cX.pink_hi - when /fuchsia_hi/; @cX.fuchsia_hi - when /red_hi/; @cX.red_hi - when /orange_hi/; @cX.orange_hi - when /yellow_hi/; @cX.yellow_hi - when /brown_hi/; @cX.brown_hi - when /lightgreen_hi/; @cX.lightgreen_hi - when /green_hi/; @cX.green_hi - when /cyan_hi/; @cX.cyan_hi - when /blue_hi/; @cX.blue_hi - when /navy_hi/; @cX.navy_hi - when /white/; @cX.white - when /grey/; @cX.grey - when /pink/; @cX.pink - when /fuchsia/; @cX.fuchsia - when /ruby/; @cX.ruby - when /red/; @cX.red - when /orange/; @cX.orange - when /yellow/; @cX.yellow - when /brown/; @cX.brown - when /green/; @cX.green - when /darkgreen/; @cX.darkgreen - when /cyan/; @cX.cyan - when /blue/; @cX.blue - when /navy/; @cX.navy - when /close/; @cX.off - when /off/; @cX.off + when /invert/ then @cX.invert + when /darkgrey_hi/ then @cX.darkgrey_hi + when /grey_hi/ then @cX.grey_hi + when /pink_hi/ then @cX.pink_hi + when /fuchsia_hi/ then @cX.fuchsia_hi + when /red_hi/ then @cX.red_hi + when /orange_hi/ then @cX.orange_hi + when /yellow_hi/ then @cX.yellow_hi + when /brown_hi/ then @cX.brown_hi + when /lightgreen_hi/ then @cX.lightgreen_hi + when /green_hi/ then @cX.green_hi + when /cyan_hi/ then @cX.cyan_hi + when /blue_hi/ then @cX.blue_hi + when /navy_hi/ then @cX.navy_hi + when /white/ then @cX.white + when /grey/ then @cX.grey + when /pink/ then @cX.pink + when /fuchsia/ then @cX.fuchsia + when /ruby/ then @cX.ruby + when /red/ then @cX.red + when /orange/ then @cX.orange + when /yellow/ then @cX.yellow + when /brown/ then @cX.brown + when /green/ then @cX.green + when /darkgreen/ then @cX.darkgreen + when /cyan/ then @cX.cyan + when /blue/ then @cX.blue + when /navy/ then @cX.navy + when /close/ then @cX.off + when /off/ then @cX.off end end def colorize case @color_instruct - when /invert/; puts "#{@cX.invert}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off} #{@cX.grey}#{@txt[3]}#{@cX.off}" - when /darkgrey_hi/; puts "#{@cX.darkgrey_hi}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off} #{@cX.grey}#{@txt[3]}#{@cX.off}" - when /grey_hi/; puts "#{@cX.grey_hi}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off} #{@cX.grey}#{@txt[3]}#{@cX.off}" - when /pink_hi/; puts "#{@cX.pink_hi}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off} #{@cX.grey}#{@txt[3]}#{@cX.off}" - when /fuchsia_hi/; puts "#{@cX.fuchsia_hi}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off} #{@cX.grey}#{@txt[3]}#{@cX.off}" - when /red_hi/; puts "#{@cX.red_hi}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off} #{@cX.grey}#{@txt[3]}#{@cX.off}" - when /orange_hi/; puts "#{@cX.orange_hi}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off} #{@cX.grey}#{@txt[3]}#{@cX.off}" - when /yellow_hi/; puts "#{@cX.yellow_hi}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off} #{@cX.grey}#{@txt[3]}#{@cX.off}" - when /brown_hi/; puts "#{@cX.brown_hi}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off} #{@cX.grey}#{@txt[3]}#{@cX.off}" - when /lightgreen_hi/; puts "#{@cX.lightgreen_hi}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off} #{@cX.grey}#{@txt[3]}#{@cX.off}" - when /green_hi/; puts "#{@cX.green_hi}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off} #{@cX.grey}#{@txt[3]}#{@cX.off}" - when /cyan_hi/; puts "#{@cX.cyan_hi}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off} #{@cX.grey}#{@txt[3]}#{@cX.off}" - when /blue_hi/; puts "#{@cX.blue_hi}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off} #{@cX.grey}#{@txt[3]}#{@cX.off}" - when /navy_hi/; puts "#{@cX.navy_hi}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off} #{@cX.grey}#{@txt[3]}#{@cX.off}" - when /bold/; puts "#{@cX.bold}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}" - when /white/; puts "#{@cX.off}#{@txt[1]} #{@txt[2]}" - when /grey/; puts "#{@cX.grey}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}" - when /pink/; puts "#{@cX.pink}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}" - when /fuchsia/; puts "#{@cX.fuchsia}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}" - when /ruby/; puts "#{@cX.ruby}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}" - when /red/; puts "#{@cX.red}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}" - when /orange/; puts "#{@cX.orange}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}" - when /yellow/; puts "#{@cX.yellow}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}" - when /brown/; puts "#{@cX.brown}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}" - when /green/; puts "#{@cX.green}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}" - when /darkgreen/; puts "#{@cX.darkgreen}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}" - when /cyan/; puts "#{@cX.cyan}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}" - when /blue/; puts "#{@cX.blue}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}" - when /navy/; puts "#{@cX.navy}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}" + when /invert/ then puts "#{@cX.invert}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off} #{@cX.grey}#{@txt[3]}#{@cX.off}" + when /darkgrey_hi/ then puts "#{@cX.darkgrey_hi}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off} #{@cX.grey}#{@txt[3]}#{@cX.off}" + when /grey_hi/ then puts "#{@cX.grey_hi}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off} #{@cX.grey}#{@txt[3]}#{@cX.off}" + when /pink_hi/ then puts "#{@cX.pink_hi}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off} #{@cX.grey}#{@txt[3]}#{@cX.off}" + when /fuchsia_hi/ then puts "#{@cX.fuchsia_hi}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off} #{@cX.grey}#{@txt[3]}#{@cX.off}" + when /red_hi/ then puts "#{@cX.red_hi}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off} #{@cX.grey}#{@txt[3]}#{@cX.off}" + when /orange_hi/ then puts "#{@cX.orange_hi}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off} #{@cX.grey}#{@txt[3]}#{@cX.off}" + when /yellow_hi/ then puts "#{@cX.yellow_hi}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off} #{@cX.grey}#{@txt[3]}#{@cX.off}" + when /brown_hi/ then puts "#{@cX.brown_hi}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off} #{@cX.grey}#{@txt[3]}#{@cX.off}" + when /lightgreen_hi/ then puts "#{@cX.lightgreen_hi}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off} #{@cX.grey}#{@txt[3]}#{@cX.off}" + when /green_hi/ then puts "#{@cX.green_hi}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off} #{@cX.grey}#{@txt[3]}#{@cX.off}" + when /cyan_hi/ then puts "#{@cX.cyan_hi}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off} #{@cX.grey}#{@txt[3]}#{@cX.off}" + when /blue_hi/ then puts "#{@cX.blue_hi}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off} #{@cX.grey}#{@txt[3]}#{@cX.off}" + when /navy_hi/ then puts "#{@cX.navy_hi}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off} #{@cX.grey}#{@txt[3]}#{@cX.off}" + when /bold/ then puts "#{@cX.bold}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}" + when /white/ then puts "#{@cX.off}#{@txt[1]} #{@txt[2]}" + when /grey/ then puts "#{@cX.grey}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}" + when /pink/ then puts "#{@cX.pink}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}" + when /fuchsia/ then puts "#{@cX.fuchsia}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}" + when /ruby/ then puts "#{@cX.ruby}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}" + when /red/ then puts "#{@cX.red}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}" + when /orange/ then puts "#{@cX.orange}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}" + when /yellow/ then puts "#{@cX.yellow}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}" + when /brown/ then puts "#{@cX.brown}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}" + when /green/ then puts "#{@cX.green}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}" + when /darkgreen/ then puts "#{@cX.darkgreen}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}" + when /cyan/ then puts "#{@cX.cyan}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}" + when /blue/ then puts "#{@cX.blue}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}" + when /navy/ then puts "#{@cX.navy}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}" end end def sourcename(sourcefilename) @@ -207,7 +207,7 @@ module SiSU_Screen STDERR.puts "\t #{@cX.grey}#{@txt[0]}#{@cX.off} #{@cX.fuchsia}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}" end def version - puts "#{@cX.blue_hi}#{@txt[0]} #{@txt[1]}#{@cX.off} #{@cX.grey} (#{@txt[3]} [#{@txt[2]}]) &#{@cX.off} #{@cX.ruby}Ruby#{@cX.off} #{@cX.grey}(#{@txt[4]})#{@cX.off}\n" + puts "#{@cX.blue_hi}#{@txt[0]} #{@txt[1]}#{@cX.off} #{@cX.grey} (#{@txt[3]} [#{@txt[2]}])#{@txt[4]} &#{@cX.off} #{@cX.ruby}Ruby#{@cX.off} #{@cX.grey}(#{@txt[5]})#{@cX.off}\n" end def html3numbers puts %{\t#{@cX.green}#{@txt[0]}#{@cX.off} #{@cX.cyan}files processed#{@cX.off}. } + diff --git a/lib/sisu/v5/shared_images.rb b/lib/sisu/v5/shared_images.rb index 1dc44121..b3d3f4fb 100644 --- a/lib/sisu/v5/shared_images.rb +++ b/lib/sisu/v5/shared_images.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/shared_markup_alt.rb b/lib/sisu/v5/shared_markup_alt.rb index 827e547a..4a1959e8 100644 --- a/lib/sisu/v5/shared_markup_alt.rb +++ b/lib/sisu/v5/shared_markup_alt.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/shared_metadata.rb b/lib/sisu/v5/shared_metadata.rb index e176deb9..b7ba2f1f 100644 --- a/lib/sisu/v5/shared_metadata.rb +++ b/lib/sisu/v5/shared_metadata.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/shared_sem.rb b/lib/sisu/v5/shared_sem.rb index 4a30e26d..860457bb 100644 --- a/lib/sisu/v5/shared_sem.rb +++ b/lib/sisu/v5/shared_sem.rb @@ -9,7 +9,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/sitemaps.rb b/lib/sisu/v5/sitemaps.rb index 6e81369a..c22b865f 100644 --- a/lib/sisu/v5/sitemaps.rb +++ b/lib/sisu/v5/sitemaps.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/spell.rb b/lib/sisu/v5/spell.rb index 60d2e947..69b6da7e 100644 --- a/lib/sisu/v5/spell.rb +++ b/lib/sisu/v5/spell.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/src_kdissert_share.rb b/lib/sisu/v5/src_kdissert_share.rb index a71aca99..f91aec55 100644 --- a/lib/sisu/v5/src_kdissert_share.rb +++ b/lib/sisu/v5/src_kdissert_share.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/src_share.rb b/lib/sisu/v5/src_share.rb index 1aba0d95..e33b4340 100644 --- a/lib/sisu/v5/src_share.rb +++ b/lib/sisu/v5/src_share.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/src_shared.rb b/lib/sisu/v5/src_shared.rb index 65c4288e..5338a18c 100644 --- a/lib/sisu/v5/src_shared.rb +++ b/lib/sisu/v5/src_shared.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/src_sisupod_make.rb b/lib/sisu/v5/src_sisupod_make.rb index d244ece4..5ae7313f 100644 --- a/lib/sisu/v5/src_sisupod_make.rb +++ b/lib/sisu/v5/src_sisupod_make.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/sst_convert_markup.rb b/lib/sisu/v5/sst_convert_markup.rb index 6eaa691e..cec67960 100644 --- a/lib/sisu/v5/sst_convert_markup.rb +++ b/lib/sisu/v5/sst_convert_markup.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -160,9 +161,9 @@ WOK def convert_filename_36_to_37 @opt.files.each do |f| s=case f - when /(\.s[1-3])$/; f.sub($1,'.sst') - when /(\.r[1-3])$/; f.sub($1,'.ssm') - when /(\.ri)$/; f.sub($1,'.ssi') + when /(\.s[1-3])$/ then f.sub($1,'.sst') + when /(\.r[1-3])$/ then f.sub($1,'.ssm') + when /(\.ri)$/ then f.sub($1,'.ssi') else f end pwd=Dir.pwd @@ -203,26 +204,26 @@ WOK if @opt.mod.inspect =~/--help/ then help elsif @opt.mod.inspect =~/(?:convert|to)[=-](?:xml |sxs|sax|sxd|dom|sxn|node)/ ext=case @opt.mod.inspect - when /(?:convert|to)[=-](?:xml|sxs|sax)/; '.sxs.xml' - when /(?:convert|to)[=-](?:sxd|dom)/; '.sxd.xml' - when /(?:convert|to)[=-](?:sxn|node)/; '.sxn.xml' + when /(?:convert|to)[=-](?:xml|sxs|sax)/ then '.sxs.xml' + when /(?:convert|to)[=-](?:sxd|dom)/ then '.sxd.xml' + when /(?:convert|to)[=-](?:sxn|node)/ then '.sxn.xml' end message("#{@opt.files.inspect}\n\nWARNING, PROCEED AT YOUR OWN RISK,\noverwriting any equivalent file with the extension #{ext}") mr=case @opt.mod.inspect - when /(?:convert|to)[=-](?:sxs|sax|xml )/; convert_to_simple_xml_model_sax - when /(?:convert|to)[=-](?:sxd|dom)/; convert_to_simple_xml_model_dom - when /(?:convert|to)[=-](?:sxn|node)/; convert_to_simple_xml_model_node + when /(?:convert|to)[=-](?:sxs|sax|xml )/ then convert_to_simple_xml_model_sax + when /(?:convert|to)[=-](?:sxd|dom)/ then convert_to_simple_xml_model_dom + when /(?:convert|to)[=-](?:sxn|node)/ then convert_to_simple_xml_model_node else help end else mr=case @opt.mod.inspect - when /(?:(?:37)?to-?38|--(?:convert|to)[=-](?:current|0.38))/; convert_37_to_38 - when /(?:(?:38)?to-?37|--(?:convert|to)[=-](?:0.37))/; convert_38_to_37 - when /(?:36to37)/; convert_filename_36_to_37 - when /(?:convert|from)[=-]kdi/; convert_kdi_to_sst - when /(?:(?:convert|from)[=-])?(?:xml_to_sst|xml2sst|sxml|sxs|sxd|sxd)/; convert_s_xml_to_sst - when /(?:convert|to)[=-]footnotes/; convert_footnotes - when /convert|default/; current_match_and_replace + when /(?:(?:37)?to-?38|--(?:convert|to)[=-](?:current|0.38))/ then convert_37_to_38 + when /(?:(?:38)?to-?37|--(?:convert|to)[=-](?:0.37))/ then convert_38_to_37 + when /(?:36to37)/ then convert_filename_36_to_37 + when /(?:convert|from)[=-]kdi/ then convert_kdi_to_sst + when /(?:(?:convert|from)[=-])?(?:xml_to_sst|xml2sst|sxml|sxs|sxd|sxd)/ then convert_s_xml_to_sst + when /(?:convert|to)[=-]footnotes/ then convert_footnotes + when /convert|default/ then current_match_and_replace else help end end diff --git a/lib/sisu/v5/sst_do_inline_footnotes.rb b/lib/sisu/v5/sst_do_inline_footnotes.rb index cafe9c60..b157ce16 100644 --- a/lib/sisu/v5/sst_do_inline_footnotes.rb +++ b/lib/sisu/v5/sst_do_inline_footnotes.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -339,8 +340,8 @@ module SiSU_ConvertFootnotes end def number_sub_heading(para,num,title_no) case para - when /#{num}~- /; para.gsub!(/#{num}~- /,"#{title_no} ") - when /^#{num}~#\s*/; para.gsub!(/^#{num}~#\s*/,"#{title_no} ") + when /#{num}~- / then para.gsub!(/#{num}~- /,"#{title_no} ") + when /^#{num}~#\s*/ then para.gsub!(/^#{num}~#\s*/,"#{title_no} ") when /^#{num}~[a-z_\.]+ / para.gsub!(/^#{num}~([a-z_\.]+)\s+(.+)/i,%{#{num}~\\1 #{title_no} \\2 <:name##{title_no}>}) else para.gsub!(/^#{num}~ /,"#{num}~#{title_no} #{title_no} ") #main diff --git a/lib/sisu/v5/sst_from_xml.rb b/lib/sisu/v5/sst_from_xml.rb index cf5a6ac6..110d7df5 100644 --- a/lib/sisu/v5/sst_from_xml.rb +++ b/lib/sisu/v5/sst_from_xml.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/sst_identify_markup.rb b/lib/sisu/v5/sst_identify_markup.rb index 76b7770e..236ca593 100644 --- a/lib/sisu/v5/sst_identify_markup.rb +++ b/lib/sisu/v5/sst_identify_markup.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/sst_to_s_xml_sax.rb b/lib/sisu/v5/sst_to_s_xml_sax.rb index 5f18496a..2059e796 100644 --- a/lib/sisu/v5/sst_to_s_xml_sax.rb +++ b/lib/sisu/v5/sst_to_s_xml_sax.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/sysenv.rb b/lib/sisu/v5/sysenv.rb index 65cc0460..954fb179 100644 --- a/lib/sisu/v5/sysenv.rb +++ b/lib/sisu/v5/sysenv.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -797,7 +798,7 @@ module SiSU_Env ? (system(%{ echo "#{@input}" | #{program} -s 3 -o #{@output} })) - : (STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" if cmd =~/V/) + : (STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" if @cmd =~/V/) #found end def imagemagick #imagemagick is a image manipulation program @@ -936,63 +937,63 @@ module SiSU_Env def language lng={} case @language - when /^am$|Amharic/i; d,c,l=false,lang_lst['am'][:c], lang_lst['am'][:n] - when /^bg$|Bulgarian/i; d,c,l=false,lang_lst['bg'][:c], lang_lst['bg'][:n] - when /^bn$|Bengali/i; d,c,l=false,lang_lst['bn'][:c], lang_lst['bn'][:n] - when /^br$|Breton/i; d,c,l=false,lang_lst['br'][:c], lang_lst['br'][:n] - when /^ca$|Catalan/i; d,c,l=false,lang_lst['ca'][:c], lang_lst['ca'][:n] - when /^cs$|Czech/i; d,c,l=false,lang_lst['cs'][:c], lang_lst['cs'][:n] - when /^cy$|Welsh/i; d,c,l=false,lang_lst['cy'][:c], lang_lst['cy'][:n] - when /^da$|Danish|Dansk/i; d,c,l=false,lang_lst['da'][:c], lang_lst['da'][:n] - when /^de$|German/i; d,c,l=false,lang_lst['de'][:c], lang_lst['de'][:n] - when /^el$|Greek/i; d,c,l=false,lang_lst['el'][:c], lang_lst['el'][:n] - when /^en$|English/i; d,c,l=false,lang_lst['en'][:c], lang_lst['en'][:n] - when /^eo$|Esperanto/i; d,c,l=false,lang_lst['eo'][:c], lang_lst['eo'][:n] - when /^es$|Spanish|Espanol/i; d,c,l=false,lang_lst['es'][:c], lang_lst['es'][:n] - when /^et$|Estonian/i; d,c,l=false,lang_lst['et'][:c], lang_lst['et'][:n] - when /^eu$|Basque/i; d,c,l=false,lang_lst['eu'][:c], lang_lst['eu'][:n] - when /^fi$|Finnish|Finsk|Suomi/i; d,c,l=false,lang_lst['fi'][:c], lang_lst['fi'][:n] - when /^fr$|French|Francais/i; d,c,l=false,lang_lst['fr'][:c], lang_lst['fr'][:n] - when /^ga$|Irish/i; d,c,l=false,lang_lst['ga'][:c], lang_lst['ga'][:n] - when /^gl$|Galician/i; d,c,l=false,lang_lst['gl'][:c], lang_lst['gl'][:n] - when /^he$|Hebrew/i; d,c,l=false,lang_lst['he'][:c], lang_lst['he'][:n] - when /^hi$|Hindi/i; d,c,l=false,lang_lst['hi'][:c], lang_lst['hi'][:n] - when /^hr$|Croatian/i; d,c,l=false,lang_lst['hr'][:c], lang_lst['hr'][:n] - when /^hy$|Armenian/i; d,c,l=false,lang_lst['hy'][:c], lang_lst['hy'][:n] - when /^ia$|Interlingua/i; d,c,l=false,lang_lst['ia'][:c], lang_lst['ia'][:n] - when /^is$|Icelandic/i; d,c,l=false,lang_lst['is'][:c], lang_lst['is'][:n] - when /^it$|Italian/i; d,c,l=false,lang_lst['it'][:c], lang_lst['it'][:n] - when /^la$|Latin/i; d,c,l=false,lang_lst['la'][:c], lang_lst['la'][:n] - when /^lo$|Lao/i; d,c,l=false,lang_lst['lo'][:c], lang_lst['lo'][:n] - when /^lt$|Lithuanian/i; d,c,l=false,lang_lst['lt'][:c], lang_lst['lt'][:n] - when /^lv$|Latvian/i; d,c,l=false,lang_lst['lv'][:c], lang_lst['lv'][:n] - when /^ml$|Malayalam/i; d,c,l=false,lang_lst['ml'][:c], lang_lst['ml'][:n] - when /^mr$|Marathi/i; d,c,l=false,lang_lst['mr'][:c], lang_lst['mr'][:n] - when /^nl$|Dutch/i; d,c,l=false,lang_lst['nl'][:c], lang_lst['nl'][:n] - when /^no$|Norwegian|Norsk/i; d,c,l=false,lang_lst['no'][:c], lang_lst['no'][:n] - when /^nn$|Norwegian Nynorsk/i; d,c,l=false,lang_lst['nn'][:c], lang_lst['nn'][:n] - when /^oc$|Occitan/i; d,c,l=false,lang_lst['oc'][:c], lang_lst['oc'][:n] - when /^pl$|Polish/i; d,c,l=false,lang_lst['pl'][:c], lang_lst['pl'][:n] - when /^pt$|Portuguese/i; d,c,l=false,lang_lst['pt'][:c], lang_lst['pt'][:n] - when /^pt_BR$|Portuguese Brazil/i; d,c,l=false,lang_lst['pt_BR'][:c], lang_lst['pt_BR'][:n] - when /^ro$|Romanian/i; d,c,l=false,lang_lst['ro'][:c], lang_lst['ro'][:n] - when /^ru$|Russian/i; d,c,l=false,lang_lst['ru'][:c], lang_lst['ru'][:n] - when /^sa$|Sanskrit/i; d,c,l=false,lang_lst['sa'][:c], lang_lst['sa'][:n] - when /^se$|Sami/i; d,c,l=false,lang_lst['se'][:c], lang_lst['se'][:n] - when /^sk$|Slovak/i; d,c,l=false,lang_lst['sk'][:c], lang_lst['sk'][:n] - when /^sl$|Slovenian/i; d,c,l=false,lang_lst['sl'][:c], lang_lst['sl'][:n] - when /^sq$|Albanian/i; d,c,l=false,lang_lst['sq'][:c], lang_lst['sq'][:n] - when /^sr$|Serbian/i; d,c,l=false,lang_lst['sr'][:c], lang_lst['sr'][:n] - when /^sv$|Swedish|Svensk/i; d,c,l=false,lang_lst['sv'][:c], lang_lst['sv'][:n] - when /^ta$|Tamil/i; d,c,l=false,lang_lst['ta'][:c], lang_lst['ta'][:n] - when /^te$|Telugu/i; d,c,l=false,lang_lst['te'][:c], lang_lst['te'][:n] - when /^th$|Thai/i; d,c,l=false,lang_lst['th'][:c], lang_lst['th'][:n] - when /^tk$|Turkmen/i; d,c,l=false,lang_lst['tk'][:c], lang_lst['tk'][:n] - when /^tr$|Turkish/i; d,c,l=false,lang_lst['tr'][:c], lang_lst['tr'][:n] - when /^uk$|Ukranian/i; d,c,l=false,lang_lst['uk'][:c], lang_lst['uk'][:n] - when /^ur$|Urdu/i; d,c,l=false,lang_lst['ur'][:c], lang_lst['ur'][:n] - when /^us|American$|/i; d,c,l=false,lang_lst['en'][:c], lang_lst['en'][:n] - when /^vi$|Vietnamese/i; d,c,l=false,lang_lst['vi'][:c], lang_lst['vi'][:n] + when /^am$|Amharic/i then d,c,l=false,lang_lst['am'][:c], lang_lst['am'][:n] + when /^bg$|Bulgarian/i then d,c,l=false,lang_lst['bg'][:c], lang_lst['bg'][:n] + when /^bn$|Bengali/i then d,c,l=false,lang_lst['bn'][:c], lang_lst['bn'][:n] + when /^br$|Breton/i then d,c,l=false,lang_lst['br'][:c], lang_lst['br'][:n] + when /^ca$|Catalan/i then d,c,l=false,lang_lst['ca'][:c], lang_lst['ca'][:n] + when /^cs$|Czech/i then d,c,l=false,lang_lst['cs'][:c], lang_lst['cs'][:n] + when /^cy$|Welsh/i then d,c,l=false,lang_lst['cy'][:c], lang_lst['cy'][:n] + when /^da$|Danish|Dansk/i then d,c,l=false,lang_lst['da'][:c], lang_lst['da'][:n] + when /^de$|German/i then d,c,l=false,lang_lst['de'][:c], lang_lst['de'][:n] + when /^el$|Greek/i then d,c,l=false,lang_lst['el'][:c], lang_lst['el'][:n] + when /^en$|English/i then d,c,l=false,lang_lst['en'][:c], lang_lst['en'][:n] + when /^eo$|Esperanto/i then d,c,l=false,lang_lst['eo'][:c], lang_lst['eo'][:n] + when /^es$|Spanish|Espanol/i then d,c,l=false,lang_lst['es'][:c], lang_lst['es'][:n] + when /^et$|Estonian/i then d,c,l=false,lang_lst['et'][:c], lang_lst['et'][:n] + when /^eu$|Basque/i then d,c,l=false,lang_lst['eu'][:c], lang_lst['eu'][:n] + when /^fi$|Finnish|Finsk|Suomi/i then d,c,l=false,lang_lst['fi'][:c], lang_lst['fi'][:n] + when /^fr$|French|Francais/i then d,c,l=false,lang_lst['fr'][:c], lang_lst['fr'][:n] + when /^ga$|Irish/i then d,c,l=false,lang_lst['ga'][:c], lang_lst['ga'][:n] + when /^gl$|Galician/i then d,c,l=false,lang_lst['gl'][:c], lang_lst['gl'][:n] + when /^he$|Hebrew/i then d,c,l=false,lang_lst['he'][:c], lang_lst['he'][:n] + when /^hi$|Hindi/i then d,c,l=false,lang_lst['hi'][:c], lang_lst['hi'][:n] + when /^hr$|Croatian/i then d,c,l=false,lang_lst['hr'][:c], lang_lst['hr'][:n] + when /^hy$|Armenian/i then d,c,l=false,lang_lst['hy'][:c], lang_lst['hy'][:n] + when /^ia$|Interlingua/i then d,c,l=false,lang_lst['ia'][:c], lang_lst['ia'][:n] + when /^is$|Icelandic/i then d,c,l=false,lang_lst['is'][:c], lang_lst['is'][:n] + when /^it$|Italian/i then d,c,l=false,lang_lst['it'][:c], lang_lst['it'][:n] + when /^la$|Latin/i then d,c,l=false,lang_lst['la'][:c], lang_lst['la'][:n] + when /^lo$|Lao/i then d,c,l=false,lang_lst['lo'][:c], lang_lst['lo'][:n] + when /^lt$|Lithuanian/i then d,c,l=false,lang_lst['lt'][:c], lang_lst['lt'][:n] + when /^lv$|Latvian/i then d,c,l=false,lang_lst['lv'][:c], lang_lst['lv'][:n] + when /^ml$|Malayalam/i then d,c,l=false,lang_lst['ml'][:c], lang_lst['ml'][:n] + when /^mr$|Marathi/i then d,c,l=false,lang_lst['mr'][:c], lang_lst['mr'][:n] + when /^nl$|Dutch/i then d,c,l=false,lang_lst['nl'][:c], lang_lst['nl'][:n] + when /^no$|Norwegian|Norsk/i then d,c,l=false,lang_lst['no'][:c], lang_lst['no'][:n] + when /^nn$|Norwegian Nynorsk/i then d,c,l=false,lang_lst['nn'][:c], lang_lst['nn'][:n] + when /^oc$|Occitan/i then d,c,l=false,lang_lst['oc'][:c], lang_lst['oc'][:n] + when /^pl$|Polish/i then d,c,l=false,lang_lst['pl'][:c], lang_lst['pl'][:n] + when /^pt$|Portuguese/i then d,c,l=false,lang_lst['pt'][:c], lang_lst['pt'][:n] + when /^pt_BR$|Portuguese Brazil/i then d,c,l=false,lang_lst['pt_BR'][:c], lang_lst['pt_BR'][:n] + when /^ro$|Romanian/i then d,c,l=false,lang_lst['ro'][:c], lang_lst['ro'][:n] + when /^ru$|Russian/i then d,c,l=false,lang_lst['ru'][:c], lang_lst['ru'][:n] + when /^sa$|Sanskrit/i then d,c,l=false,lang_lst['sa'][:c], lang_lst['sa'][:n] + when /^se$|Sami/i then d,c,l=false,lang_lst['se'][:c], lang_lst['se'][:n] + when /^sk$|Slovak/i then d,c,l=false,lang_lst['sk'][:c], lang_lst['sk'][:n] + when /^sl$|Slovenian/i then d,c,l=false,lang_lst['sl'][:c], lang_lst['sl'][:n] + when /^sq$|Albanian/i then d,c,l=false,lang_lst['sq'][:c], lang_lst['sq'][:n] + when /^sr$|Serbian/i then d,c,l=false,lang_lst['sr'][:c], lang_lst['sr'][:n] + when /^sv$|Swedish|Svensk/i then d,c,l=false,lang_lst['sv'][:c], lang_lst['sv'][:n] + when /^ta$|Tamil/i then d,c,l=false,lang_lst['ta'][:c], lang_lst['ta'][:n] + when /^te$|Telugu/i then d,c,l=false,lang_lst['te'][:c], lang_lst['te'][:n] + when /^th$|Thai/i then d,c,l=false,lang_lst['th'][:c], lang_lst['th'][:n] + when /^tk$|Turkmen/i then d,c,l=false,lang_lst['tk'][:c], lang_lst['tk'][:n] + when /^tr$|Turkish/i then d,c,l=false,lang_lst['tr'][:c], lang_lst['tr'][:n] + when /^uk$|Ukranian/i then d,c,l=false,lang_lst['uk'][:c], lang_lst['uk'][:n] + when /^ur$|Urdu/i then d,c,l=false,lang_lst['ur'][:c], lang_lst['ur'][:n] + when /^us|American$|/i then d,c,l=false,lang_lst['en'][:c], lang_lst['en'][:n] + when /^vi$|Vietnamese/i then d,c,l=false,lang_lst['vi'][:c], lang_lst['vi'][:n] else d,c,l=true, lang_lst['en'][:c], lang_lst['en'][:n] #default end lng[:d],lng[:c],lng[:n]=d,c,l @@ -2183,8 +2184,8 @@ WOK end def usr_dir? case root_dir - when /^\/home/; false - else true + when /^\/home/ then false + else true end end def stub_dir @@ -2456,11 +2457,11 @@ WOK def webserv_host_base(opt=nil) if defined? @rc['webserv']['host'] case @rc['webserv']['host'] - when /https?:\/\//; @rc['webserv']['host'] - when /\S+/; "http://#{@rc['webserv']['host']}" - else defaults[:webserv_host_cgi] + when /https?:\/\// then @rc['webserv']['host'] + when /\S+/ then "http://#{@rc['webserv']['host']}" + else defaults[:webserv_host_cgi] end - else defaults[:webserv_host_cgi] + else defaults[:webserv_host_cgi] end end def webserv_cgi(opt=nil) #web url for local webserv (localhost, or hostname) @@ -2554,11 +2555,11 @@ WOK else '' end m=case show_output_on - when /webserv_cgi/; url.webserv_base_cgi(opt) - when /webserv/; @rc['webserv']['url_root'] - when /https?:\/\//; @rc['webserv_cgi']['file_links'] - when /\S+/; "http://#{@rc['webserv_cgi']['file_links']}" - else webserv_base_cgi(opt) + when /webserv_cgi/ then url.webserv_base_cgi(opt) + when /webserv/ then @rc['webserv']['url_root'] + when /https?:\/\// then @rc['webserv_cgi']['file_links'] + when /\S+/ then "http://#{@rc['webserv_cgi']['file_links']}" + else webserv_base_cgi(opt) end end end @@ -2592,15 +2593,15 @@ WOK else 'filesystem' end case output_type - when /^filesystem(?:_url)?/; url.dir_url - when /^remote(?:_webserv)?/; url.remote - when /^(?:webserv|local_webserv)/; url.local - when /^local(:\d+)/; url.hostname + $1 + '/' + stub_pwd - when /^localhost(:\d+)/; url.localhost + $1 + '/' + stub_pwd - when /^localhost/; url.localhost - when /^webrick/; url.webrick - when /^path/; url.webserv_map_pwd - else url.webserv_map_pwd + when /^filesystem(?:_url)?/ then url.dir_url + when /^remote(?:_webserv)?/ then url.remote + when /^(?:webserv|local_webserv)/ then url.local + when /^local(:\d+)/ then url.hostname + $1 + '/' + stub_pwd + when /^localhost(:\d+)/ then url.localhost + $1 + '/' + stub_pwd + when /^localhost/ then url.localhost + when /^webrick/ then url.webrick + when /^path/ then url.webserv_map_pwd + else url.webserv_map_pwd end end def images @@ -2698,18 +2699,18 @@ WOK if defined? @rc['default']['digest'] \ and @rc['default']['digest'] != nil case @rc['default']['digest'] - when /^sha(?:2|256)?$/; 'sha256' - when /^md5$/; 'md5' - else 'sha256' + when /^sha(?:2|256)?$/ then 'sha256' + when /^md5$/ then 'md5' + else 'sha256' end - else 'sha256' + else 'sha256' end end def length case digest.type - when /sha256/; 64 - when /md5/; 32 - else 64 + when /sha256/ then 64 + when /md5/ then 32 + else 64 end end def pattern @@ -3374,9 +3375,9 @@ WOK self.remote_host_base.each do |remote_conn| local_gen=@source_path remote_gen=case @opt.cmd - when /u/; "#{remote_conn[:name]}/#{@env.path.stub_pwd}/." #creates remote directory tree, this is not the usual function of u - when /[abhHNopwxXy]/; "#{remote_conn[:name]}/#{@env.path.stub_pwd}/#{@fnb}/." - else "#{remote_conn[:name]}/#{@env.path.stub_pwd}/." + when /u/ then "#{remote_conn[:name]}/#{@env.path.stub_pwd}/." #creates remote directory tree, this is not the usual function of u + when /[abhHNopwxXy]/ then "#{remote_conn[:name]}/#{@env.path.stub_pwd}/#{@fnb}/." + else "#{remote_conn[:name]}/#{@env.path.stub_pwd}/." end local_epub=@source_path_epub local_src=@source_path_src @@ -3716,6 +3717,11 @@ WOK if File.exist?(yst_ver) @version=YAML::load(File::open(yst_ver)) #unless @@noyaml end + spec = Gem::Specification.find_by_name("sisu") + gem_root = spec.gem_dir + @version[:install_method]=(File.dirname(__FILE__.gsub(/\/lib\/sisu\/#{SiSU_version_dir}/,'')) == gem_root) \ + ? ' (ruby gem install)' + : '' @version end def rbversion @@ -3735,7 +3741,7 @@ WOK @color.cmd else '-v' end - SiSU_Screen::Ansi.new(opt_cmd,version[:project],version[:version],version[:date_stamp],version[:date],rb_ver).version + SiSU_Screen::Ansi.new(opt_cmd,version[:project],version[:version],version[:date_stamp],version[:date],version[:install_method],rb_ver).version else puts 'SiSU (version information not available)' end end @@ -6666,9 +6672,9 @@ WOK @md=operation end case operation #watch - when /pdf/; @env_out='' + when /pdf/ then @env_out='' when /sql/ - when /xml|plaintext|ascii/; @env_out="#{@env.path.output}/#{@fnb}" #check change of name to plaintext from ascii + when /xml|plaintext|ascii/ then @env_out="#{@env.path.output}/#{@fnb}" #check change of name to plaintext from ascii else if defined? @md.sfx_src \ and @md.sfx_src =~/ss[ftsumc]/ diff --git a/lib/sisu/v5/termsheet.rb b/lib/sisu/v5/termsheet.rb index 5f3700c4..7e8a2a30 100644 --- a/lib/sisu/v5/termsheet.rb +++ b/lib/sisu/v5/termsheet.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/texinfo.rb b/lib/sisu/v5/texinfo.rb index 2e92268a..ba890be3 100644 --- a/lib/sisu/v5/texinfo.rb +++ b/lib/sisu/v5/texinfo.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -310,9 +311,9 @@ module SiSU_TexInfo mono=SiSU_TexInfoFormat::Texinfo.new(@md,dob) if dob.is==:heading case dob.ln - when 1; dob=mono.level1 - when 2; dob=mono.level2 - when 3; dob=mono.level3 + when 1 then dob=mono.level1 + when 2 then dob=mono.level2 + when 3 then dob=mono.level3 when 4; dob=mono.level4 n_menu+=1 diff --git a/lib/sisu/v5/texinfo_format.rb b/lib/sisu/v5/texinfo_format.rb index 2da5d6c4..5e920475 100644 --- a/lib/sisu/v5/texinfo_format.rb +++ b/lib/sisu/v5/texinfo_format.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/texpdf.rb b/lib/sisu/v5/texpdf.rb index bf72a1a6..4239fac2 100644 --- a/lib/sisu/v5/texpdf.rb +++ b/lib/sisu/v5/texpdf.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -214,12 +215,12 @@ module SiSU_TeX landscape_pdf="#{pwd}/#{tex_fn_base}.landscape.pdf" end case papersize - when /a4/; pdf_p=@f.pdf_p_a4; pdf_l=@f.pdf_l_a4 - when /a5/; pdf_p=@f.pdf_p_a5; pdf_l=@f.pdf_l_a5 - when /b5/; pdf_p=@f.pdf_p_b5; pdf_l=@f.pdf_l_b5 - when /letter/; pdf_p=@f.pdf_p_letter; pdf_l=@f.pdf_l_letter - when /legal/; pdf_p=@f.pdf_p_legal; pdf_l=@f.pdf_l_legal - else pdf_p=@f.pdf_p_a4; pdf_l=@f.pdf_l_a4 + when /a4/ then pdf_p=@f.pdf_p_a4; pdf_l=@f.pdf_l_a4 + when /a5/ then pdf_p=@f.pdf_p_a5; pdf_l=@f.pdf_l_a5 + when /b5/ then pdf_p=@f.pdf_p_b5; pdf_l=@f.pdf_l_b5 + when /letter/ then pdf_p=@f.pdf_p_letter; pdf_l=@f.pdf_l_letter + when /legal/ then pdf_p=@f.pdf_p_legal; pdf_l=@f.pdf_l_legal + else pdf_p=@f.pdf_p_a4; pdf_l=@f.pdf_l_a4 end FileUtils::mkdir_p(@md.file.output_path.pdf.dir) unless FileTest.directory?(@md.file.output_path.pdf.dir) cX=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set]).cX @@ -278,12 +279,12 @@ module SiSU_TeX end end case @md.papersize_array[0] #default pdf - when /a4/; pdf_p=@f.pdf_p_a4; pdf_l=@f.pdf_l_a4 - when /a5/; pdf_p=@f.pdf_p_a5; pdf_l=@f.pdf_l_a5 - when /b5/; pdf_p=@f.pdf_p_b5; pdf_l=@f.pdf_l_b5 - when /letter/; pdf_p=@f.pdf_p_letter; pdf_l=@f.pdf_l_letter - when /legal/; pdf_p=@f.pdf_p_legal; pdf_l=@f.pdf_l_legal - else pdf_p=@f.pdf_p_a4; pdf_l=@f.pdf_l_a4 + when /a4/ then pdf_p=@f.pdf_p_a4; pdf_l=@f.pdf_l_a4 + when /a5/ then pdf_p=@f.pdf_p_a5; pdf_l=@f.pdf_l_a5 + when /b5/ then pdf_p=@f.pdf_p_b5; pdf_l=@f.pdf_l_b5 + when /letter/ then pdf_p=@f.pdf_p_letter; pdf_l=@f.pdf_l_letter + when /legal/ then pdf_p=@f.pdf_p_legal; pdf_l=@f.pdf_l_legal + else pdf_p=@f.pdf_p_a4; pdf_l=@f.pdf_l_a4 end if @md.opt.act[:pdf_p][:set]==:on if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{pdf_p}") diff --git a/lib/sisu/v5/texpdf_format.rb b/lib/sisu/v5/texpdf_format.rb index 556de8a6..d97f3618 100644 --- a/lib/sisu/v5/texpdf_format.rb +++ b/lib/sisu/v5/texpdf_format.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -133,11 +134,11 @@ module SiSU_TeX_Pdf row_break='\\\\\\' if @dob.is==:table tw=case @dob.tmp[:paper_size] - when /a4/i; @tx.a4.landscape.w #European default, SiSU default - when /letter/i; @tx.letter.landscape.w #U.S. default - when /legal/i; @tx.legal.landscape.w #U.S. alternative - when /book|b5/i; @tx.b5.landscape.w #book default - larger - when /a5/i; @tx.a5.landscape.w + when /a4/i then @tx.a4.landscape.w #European default, SiSU default + when /letter/i then @tx.letter.landscape.w #U.S. default + when /legal/i then @tx.legal.landscape.w #U.S. alternative + when /book|b5/i then @tx.b5.landscape.w #book default - larger + when /a5/i then @tx.a5.landscape.w else @tx.a4.landscape.w #default currently A4 end textwidth=(tw.to_i/2) - 24 @@ -178,11 +179,11 @@ module SiSU_TeX_Pdf row_break='\\\\\\' if @dob.is==:table tw=case @dob.tmp[:paper_size] - when /a4/i; @tx.a4.portrait.w #European default, SiSU default - when /letter/i; @tx.letter.portrait.w #U.S. default - when /legal/i; @tx.legal.portrait.w #U.S. alternative - when /book|b5/i; @tx.b5.portrait.w #book default - larger - when /a5/i; @tx.a5.portrait.w + when /a4/i then @tx.a4.portrait.w #European default, SiSU default + when /letter/i then @tx.letter.portrait.w #U.S. default + when /legal/i then @tx.legal.portrait.w #U.S. alternative + when /book|b5/i then @tx.b5.portrait.w #book default - larger + when /a5/i then @tx.a5.portrait.w else @tx.a4.portrait.w #default currently A4 end textwidth=tw.to_i - 20 @@ -311,163 +312,163 @@ module SiSU_TeX_Pdf case @dob.indent when /0/ case @dob.hang - when /0/; indent,hang='0mm', '0mm' - when /1/; indent,hang='0mm','10mm' - when /2/; indent,hang='0mm','20mm' - when /3/; indent,hang='0mm','30mm' - when /4/; indent,hang='0mm','40mm' - when /5/; indent,hang='0mm','50mm' - when /6/; indent,hang='0mm','60mm' - when /7/; indent,hang='0mm','70mm' - when /8/; indent,hang='0mm','80mm' - when /9/; indent,hang='0mm','90mm' + when /0/ then indent,hang='0mm', '0mm' + when /1/ then indent,hang='0mm','10mm' + when /2/ then indent,hang='0mm','20mm' + when /3/ then indent,hang='0mm','30mm' + when /4/ then indent,hang='0mm','40mm' + when /5/ then indent,hang='0mm','50mm' + when /6/ then indent,hang='0mm','60mm' + when /7/ then indent,hang='0mm','70mm' + when /8/ then indent,hang='0mm','80mm' + when /9/ then indent,hang='0mm','90mm' end when /1/ case @dob.hang - when /0/; indent,hang='10mm','-10mm' - when /1/; indent,hang='10mm', '0mm' - when /2/; indent,hang='10mm', '10mm' - when /3/; indent,hang='10mm', '20mm' - when /4/; indent,hang='10mm', '30mm' - when /5/; indent,hang='10mm', '40mm' - when /6/; indent,hang='10mm', '50mm' - when /7/; indent,hang='10mm', '60mm' - when /8/; indent,hang='10mm', '70mm' - when /9/; indent,hang='10mm', '80mm' + when /0/ then indent,hang='10mm','-10mm' + when /1/ then indent,hang='10mm', '0mm' + when /2/ then indent,hang='10mm', '10mm' + when /3/ then indent,hang='10mm', '20mm' + when /4/ then indent,hang='10mm', '30mm' + when /5/ then indent,hang='10mm', '40mm' + when /6/ then indent,hang='10mm', '50mm' + when /7/ then indent,hang='10mm', '60mm' + when /8/ then indent,hang='10mm', '70mm' + when /9/ then indent,hang='10mm', '80mm' end when /2/ case @dob.hang - when /0/; indent,hang='20mm','-20mm' - when /1/; indent,hang='20mm','-10mm' - when /2/; indent,hang='20mm', '0mm' - when /3/; indent,hang='20mm', '10mm' - when /4/; indent,hang='20mm', '20mm' - when /5/; indent,hang='20mm', '30mm' - when /6/; indent,hang='20mm', '40mm' - when /7/; indent,hang='20mm', '50mm' - when /8/; indent,hang='20mm', '60mm' - when /9/; indent,hang='20mm', '70mm' + when /0/ then indent,hang='20mm','-20mm' + when /1/ then indent,hang='20mm','-10mm' + when /2/ then indent,hang='20mm', '0mm' + when /3/ then indent,hang='20mm', '10mm' + when /4/ then indent,hang='20mm', '20mm' + when /5/ then indent,hang='20mm', '30mm' + when /6/ then indent,hang='20mm', '40mm' + when /7/ then indent,hang='20mm', '50mm' + when /8/ then indent,hang='20mm', '60mm' + when /9/ then indent,hang='20mm', '70mm' end when /3/ case @dob.hang - when /0/; indent,hang='30mm','-30mm' - when /1/; indent,hang='30mm','-20mm' - when /2/; indent,hang='30mm','-10mm' - when /3/; indent,hang='30mm', '0mm' - when /4/; indent,hang='30mm', '10mm' - when /5/; indent,hang='30mm', '20mm' - when /6/; indent,hang='30mm', '30mm' - when /7/; indent,hang='30mm', '40mm' - when /8/; indent,hang='30mm', '50mm' - when /9/; indent,hang='30mm', '60mm' + when /0/ then indent,hang='30mm','-30mm' + when /1/ then indent,hang='30mm','-20mm' + when /2/ then indent,hang='30mm','-10mm' + when /3/ then indent,hang='30mm', '0mm' + when /4/ then indent,hang='30mm', '10mm' + when /5/ then indent,hang='30mm', '20mm' + when /6/ then indent,hang='30mm', '30mm' + when /7/ then indent,hang='30mm', '40mm' + when /8/ then indent,hang='30mm', '50mm' + when /9/ then indent,hang='30mm', '60mm' end when /4/ case @dob.hang - when /0/; indent,hang='40mm','-40mm' - when /1/; indent,hang='40mm','-30mm' - when /2/; indent,hang='40mm','-20mm' - when /3/; indent,hang='40mm','-10mm' - when /4/; indent,hang='40mm', '0mm' - when /5/; indent,hang='40mm', '10mm' - when /6/; indent,hang='40mm', '20mm' - when /7/; indent,hang='40mm', '30mm' - when /8/; indent,hang='40mm', '40mm' - when /9/; indent,hang='40mm', '50mm' + when /0/ then indent,hang='40mm','-40mm' + when /1/ then indent,hang='40mm','-30mm' + when /2/ then indent,hang='40mm','-20mm' + when /3/ then indent,hang='40mm','-10mm' + when /4/ then indent,hang='40mm', '0mm' + when /5/ then indent,hang='40mm', '10mm' + when /6/ then indent,hang='40mm', '20mm' + when /7/ then indent,hang='40mm', '30mm' + when /8/ then indent,hang='40mm', '40mm' + when /9/ then indent,hang='40mm', '50mm' end when /5/ case @dob.hang - when /0/; indent,hang='50mm','-50mm' - when /1/; indent,hang='50mm','-40mm' - when /2/; indent,hang='50mm','-30mm' - when /3/; indent,hang='50mm','-20mm' - when /4/; indent,hang='50mm','-10mm' - when /5/; indent,hang='50mm', '0mm' - when /6/; indent,hang='50mm', '10mm' - when /7/; indent,hang='50mm', '20mm' - when /8/; indent,hang='50mm', '30mm' - when /9/; indent,hang='50mm', '40mm' + when /0/ then indent,hang='50mm','-50mm' + when /1/ then indent,hang='50mm','-40mm' + when /2/ then indent,hang='50mm','-30mm' + when /3/ then indent,hang='50mm','-20mm' + when /4/ then indent,hang='50mm','-10mm' + when /5/ then indent,hang='50mm', '0mm' + when /6/ then indent,hang='50mm', '10mm' + when /7/ then indent,hang='50mm', '20mm' + when /8/ then indent,hang='50mm', '30mm' + when /9/ then indent,hang='50mm', '40mm' end when /6/ case @dob.hang - when /0/; indent,hang='60mm','-60mm' - when /1/; indent,hang='60mm','-50mm' - when /2/; indent,hang='60mm','-40mm' - when /3/; indent,hang='60mm','-30mm' - when /4/; indent,hang='60mm','-20mm' - when /5/; indent,hang='60mm','-10mm' - when /6/; indent,hang='60mm', '0mm' - when /7/; indent,hang='60mm', '10mm' - when /8/; indent,hang='60mm', '20mm' - when /9/; indent,hang='60mm', '30mm' + when /0/ then indent,hang='60mm','-60mm' + when /1/ then indent,hang='60mm','-50mm' + when /2/ then indent,hang='60mm','-40mm' + when /3/ then indent,hang='60mm','-30mm' + when /4/ then indent,hang='60mm','-20mm' + when /5/ then indent,hang='60mm','-10mm' + when /6/ then indent,hang='60mm', '0mm' + when /7/ then indent,hang='60mm', '10mm' + when /8/ then indent,hang='60mm', '20mm' + when /9/ then indent,hang='60mm', '30mm' end when /7/ case @dob.hang - when /0/; indent,hang='70mm','-70mm' - when /1/; indent,hang='70mm','-60mm' - when /2/; indent,hang='70mm','-50mm' - when /3/; indent,hang='70mm','-40mm' - when /4/; indent,hang='70mm','-30mm' - when /5/; indent,hang='70mm','-20mm' - when /6/; indent,hang='70mm','-10mm' - when /7/; indent,hang='70mm', '0mm' - when /8/; indent,hang='70mm', '10mm' - when /9/; indent,hang='70mm', '20mm' + when /0/ then indent,hang='70mm','-70mm' + when /1/ then indent,hang='70mm','-60mm' + when /2/ then indent,hang='70mm','-50mm' + when /3/ then indent,hang='70mm','-40mm' + when /4/ then indent,hang='70mm','-30mm' + when /5/ then indent,hang='70mm','-20mm' + when /6/ then indent,hang='70mm','-10mm' + when /7/ then indent,hang='70mm', '0mm' + when /8/ then indent,hang='70mm', '10mm' + when /9/ then indent,hang='70mm', '20mm' end when /8/ case @dob.hang - when /0/; indent,hang='80mm','-80mm' - when /1/; indent,hang='80mm','-70mm' - when /2/; indent,hang='80mm','-60mm' - when /3/; indent,hang='80mm','-50mm' - when /4/; indent,hang='80mm','-40mm' - when /5/; indent,hang='80mm','-30mm' - when /6/; indent,hang='80mm','-20mm' - when /7/; indent,hang='80mm','-10mm' - when /8/; indent,hang='80mm', '0mm' - when /9/; indent,hang='80mm', '10mm' + when /0/ then indent,hang='80mm','-80mm' + when /1/ then indent,hang='80mm','-70mm' + when /2/ then indent,hang='80mm','-60mm' + when /3/ then indent,hang='80mm','-50mm' + when /4/ then indent,hang='80mm','-40mm' + when /5/ then indent,hang='80mm','-30mm' + when /6/ then indent,hang='80mm','-20mm' + when /7/ then indent,hang='80mm','-10mm' + when /8/ then indent,hang='80mm', '0mm' + when /9/ then indent,hang='80mm', '10mm' end when /9/ case @dob.hang - when /0/; indent,hang='90mm','-90mm' - when /1/; indent,hang='90mm','-80mm' - when /2/; indent,hang='90mm','-70mm' - when /3/; indent,hang='90mm','-60mm' - when /4/; indent,hang='90mm','-50mm' - when /5/; indent,hang='90mm','-40mm' - when /6/; indent,hang='90mm','-30mm' - when /7/; indent,hang='90mm','-20mm' - when /8/; indent,hang='90mm','-10mm' - when /9/; indent,hang='90mm', '0mm' + when /0/ then indent,hang='90mm','-90mm' + when /1/ then indent,hang='90mm','-80mm' + when /2/ then indent,hang='90mm','-70mm' + when /3/ then indent,hang='90mm','-60mm' + when /4/ then indent,hang='90mm','-50mm' + when /5/ then indent,hang='90mm','-40mm' + when /6/ then indent,hang='90mm','-30mm' + when /7/ then indent,hang='90mm','-20mm' + when /8/ then indent,hang='90mm','-10mm' + when /9/ then indent,hang='90mm', '0mm' end end "\\begin{ParagraphHang}{#{indent}}{#{hang}}#{@dob.tmp} \\end{ParagraphHang}}" end def indent indent=case @dob.indent - when /1/; '0mm' - when /2/; '10mm' - when /3/; '20mm' - when /4/; '30mm' - when /5/; '40mm' - when /6/; '50mm' - when /7/; '60mm' - when /8/; '70mm' - when /9/; '80mm' + when /1/ then '0mm' + when /2/ then '10mm' + when /3/ then '20mm' + when /4/ then '30mm' + when /5/ then '40mm' + when /6/ then '50mm' + when /7/ then '60mm' + when /8/ then '70mm' + when /9/ then '80mm' end "\\begin{ParagraphIndent}{#{indent}}#{@dob.tmp} \\end{ParagraphIndent}}" end def bullet blt=if @dob.indent indent=case @dob.indent - when /1/; '0em' - when /2/; '1.0em' - when /3/; '2.0em' - when /4/; '3.0em' - when /5/; '4.0em' - when /6/; '5.0em' - when /7/; '6.0em' - when /8/; '7.0em' - when /9/; '8.0em' + when /1/ then '0em' + when /2/ then '1.0em' + when /3/ then '2.0em' + when /4/ then '3.0em' + when /5/ then '4.0em' + when /6/ then '5.0em' + when /7/ then '6.0em' + when /8/ then '7.0em' + when /9/ then '8.0em' else '-1.0em' end "\\begin{Bullet}{#{indent}}$\\txtbullet$\\hspace{\\enspace}#{@dob.tmp}\\end{Bullet}" @@ -816,9 +817,9 @@ module SiSU_TeX_Pdf @md.make.texpdf_font.cjk else case @md.opt.lng - when /zh/; @env.font.texpdf.cjk_zh - when /ja/; @env.font.texpdf.cjk_ja - when /ko/; @env.font.texpdf.cjk_ko + when /zh/ then @env.font.texpdf.cjk_zh + when /ja/ then @env.font.texpdf.cjk_ja + when /ko/ then @env.font.texpdf.cjk_ko else @env.font.texpdf.cjk end end @@ -1497,7 +1498,7 @@ module SiSU_TeX_Pdf v=SiSU_Env::InfoVersion.instance.get_version base_prog_txt=if @md.base_program case @md.base_program - when /kdissert/i; "\n\\\\ This document prepared using \\href{http://freehackers.org/~tnagy/kdissert/}{Kdissert \\ http://freehackers.org/~tnagy/kdissert/ } \\\\ Kdissert is Document Mapping software by Thomas Nagy" + when /kdissert/i then "\n\\\\ This document prepared using \\href{http://freehackers.org/~tnagy/kdissert/}{Kdissert \\ http://freehackers.org/~tnagy/kdissert/ } \\\\ Kdissert is Document Mapping software by Thomas Nagy" else '' end else '' diff --git a/lib/sisu/v5/txt_asciidoc.rb b/lib/sisu/v5/txt_asciidoc.rb index 114252b1..07b8832f 100644 --- a/lib/sisu/v5/txt_asciidoc.rb +++ b/lib/sisu/v5/txt_asciidoc.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -59,7 +60,7 @@ ** Description: plaintext (smarttext) generation, asciidoc =end -module SiSU_Txt_asciiDoc +module SiSU_Txt_AsciiDoc require_relative 'ao' # ao.rb require_relative 'sysenv' # sysenv.rb include SiSU_Env @@ -89,8 +90,8 @@ module SiSU_Txt_asciiDoc (@opt.act[:verbose][:set]==:on \ || @opt.act[:verbose_plus][:set]==:on \ || @opt.act[:maintenance][:set]==:on) \ - ? SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'asciiDoc (plaintext utf-8)',tool).green_hi_blue - : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'asciiDoc (plaintext utf-8)',tool).green_title_hi + ? SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'AsciiDoc (plaintext utf-8)',tool).green_hi_blue + : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'AsciiDoc (plaintext utf-8)',tool).green_title_hi if (@opt.act[:verbose_plus][:set]==:on \ || @opt.act[:maintenance][:set]==:on) SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{md.file.output_path.asciidoc.dir}/#{md.file.base_filename.asciidoc}").flow @@ -106,7 +107,7 @@ module SiSU_Txt_asciiDoc else 78 end #wrap_width=(defined? md.make.plaintext_wrap) ? md.make.plaintext_wrap : 78 - SiSU_Txt_asciiDoc::Source::Scroll.new(md,ao_array,wrap_width).songsheet + SiSU_Txt_AsciiDoc::Source::Scroll.new(md,ao_array,wrap_width).songsheet rescue SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do __LINE__.to_s + ':' + __FILE__ @@ -126,9 +127,9 @@ module SiSU_Txt_asciiDoc @brace_url=SiSU_Viz::Defaults.new.url_decoration @tab="\t" @@endnotes_=case md.opt.mod.inspect - when /--footnote/; false - when /--endnote/; true - else true + when /--footnote/ then false + when /--endnote/ then true + else true end @plaintext={ body: [], open: [], close: [], head: [], metadata: [], tail: [] } end @@ -220,6 +221,9 @@ WOK def decorate def heading def inline + def l0 + '=' + end def l1 '==' end @@ -235,12 +239,12 @@ WOK def l5 '' #'======' #logical end - def l6 - '' #'=======' #logical - end self end def underscore + def l0 + '=' + end def l1 '-' end @@ -256,9 +260,6 @@ WOK def l5 '' #'.' #proposed end - def l6 - '' #'.' #proposed - end self end self diff --git a/lib/sisu/v5/txt_markdown.rb b/lib/sisu/v5/txt_markdown.rb index 89ee022d..96aca820 100644 --- a/lib/sisu/v5/txt_markdown.rb +++ b/lib/sisu/v5/txt_markdown.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -126,9 +127,9 @@ module SiSU_Txt_Markdown @brace_url=SiSU_Viz::Defaults.new.url_decoration @tab="\t" @@endnotes_=case md.opt.mod.inspect - when /--footnote/; false - when /--endnote/; true - else true + when /--footnote/ then false + when /--endnote/ then true + else true end @plaintext={ body: [], open: [], close: [], head: [], metadata: [], tail: [] } end @@ -220,22 +221,22 @@ WOK def decorate def heading def inline #atx - def l1 + def l0 '#' end - def l2 + def l1 '##' end - def l3 + def l2 '###' end - def l4 + def l3 '####' end - def l5 + def l4 '#####' end - def l6 + def l5 '######' end self diff --git a/lib/sisu/v5/txt_plain.rb b/lib/sisu/v5/txt_plain.rb index 0cd50254..ca944a1f 100644 --- a/lib/sisu/v5/txt_plain.rb +++ b/lib/sisu/v5/txt_plain.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -127,9 +128,9 @@ module SiSU_Txt_Plain @brace_url=SiSU_Viz::Defaults.new.url_decoration @tab="\t" @@endnotes_=case md.opt.mod.inspect - when /--footnote/; false - when /--endnote/; true - else true + when /--footnote/ then false + when /--endnote/ then true + else true end @plaintext={ body: [], open: [], close: [], head: [], metadata: [], tail: [] } end @@ -220,11 +221,14 @@ WOK end def decorate def heading_underscore + def l0 + '=' + end def l1 '*' end def l2 - '=' + '+' end def l3 '~' @@ -376,12 +380,13 @@ WOK times=wrapped.length times=@wrap_width if times > @wrap_width @plaintext[:body] << case lv - when 1; wrapped.upcase << break_line << decorate.heading_underscore.l1*times + p_num << break_line*2 - when 2; wrapped.upcase << break_line << decorate.heading_underscore.l2*times + p_num << break_line*2 - when 3; wrapped.upcase << break_line << decorate.heading_underscore.l3*times + p_num << break_line*2 - when 4; wrapped.upcase << break_line << decorate.heading_underscore.l4*times + p_num << break_line*2 - when 5; wrapped.upcase << break_line << decorate.heading_underscore.l5*times + p_num << break_line*2 - when 6; wrapped.upcase << break_line << decorate.heading_underscore.l6*times + p_num << break_line*2 + when 0 then wrapped.upcase << break_line << decorate.heading_underscore.l0*times + p_num << break_line*2 + when 1 then wrapped.upcase << break_line << decorate.heading_underscore.l1*times + p_num << break_line*2 + when 2 then wrapped.upcase << break_line << decorate.heading_underscore.l2*times + p_num << break_line*2 + when 3 then wrapped.upcase << break_line << decorate.heading_underscore.l3*times + p_num << break_line*2 + when 4 then wrapped.upcase << break_line << decorate.heading_underscore.l4*times + p_num << break_line*2 + when 5 then wrapped.upcase << break_line << decorate.heading_underscore.l5*times + p_num << break_line*2 + when 6 then wrapped.upcase << break_line << decorate.heading_underscore.l6*times + p_num << break_line*2 end else @plaintext[:body] << wrapped + p_num << break_line # main text, contents, body KEEP diff --git a/lib/sisu/v5/txt_rst.rb b/lib/sisu/v5/txt_rst.rb index c98bb275..56a34de2 100644 --- a/lib/sisu/v5/txt_rst.rb +++ b/lib/sisu/v5/txt_rst.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -126,9 +127,9 @@ module SiSU_Txt_rST @brace_url=SiSU_Viz::Defaults.new.url_decoration @tab="\t" @@endnotes_=case md.opt.mod.inspect - when /--footnote/; false - when /--endnote/; true - else true + when /--footnote/ then false + when /--endnote/ then true + else true end @plaintext={ body: [], open: [], close: [], head: [], metadata: [], tail: [] } end @@ -220,22 +221,22 @@ WOK def decorate def heading def underscore - def l1 + def l0 '=' end - def l2 + def l1 '-' end - def l3 + def l2 '`' end - def l4 + def l3 ':' end - def l5 + def l4 "'" end - def l6 + def l5 '"' end self diff --git a/lib/sisu/v5/txt_shared.rb b/lib/sisu/v5/txt_shared.rb index 31a976d2..0b6c1953 100644 --- a/lib/sisu/v5/txt_shared.rb +++ b/lib/sisu/v5/txt_shared.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -176,52 +177,52 @@ module SiSU_TextUtils end def start_is_match case @p - when /^#{Mx[:meta_o]}(title)#{Mx[:meta_c]}\s*(.+?)$/; header($1,@md.title.full,'meta','dc') #dc 1 - when /^#{Mx[:meta_o]}(creator|author)#{Mx[:meta_c]}\s*(.+?)$/; header('creator',$2,'meta','dc') #dc 2 - when /^#{Mx[:meta_o]}(subject)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 3 - when /^#{Mx[:meta_o]}(description)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 4 - when /^#{Mx[:meta_o]}(publisher)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 5 - when /^#{Mx[:meta_o]}(contributor)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 6 - when /^#{Mx[:meta_o]}(date)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 7 - when /^#{Mx[:meta_o]}(date\.created)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra') - when /^#{Mx[:meta_o]}(date\.issued)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra') - when /^#{Mx[:meta_o]}(date\.available)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra') - when /^#{Mx[:meta_o]}(date\.valid)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra') - when /^#{Mx[:meta_o]}(date\.modified)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra') - when /^#{Mx[:meta_o]}(type)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 8 - when /^#{Mx[:meta_o]}(format)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 9 - when /^#{Mx[:meta_o]}(identifier)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 10 - when /^#{Mx[:meta_o]}(source)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 11 - when /^#{Mx[:meta_o]}(language)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 12 - when /^#{Mx[:meta_o]}(relation)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 13 - when /^#{Mx[:meta_o]}(coverage)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 14 - when /^#{Mx[:meta_o]}(rights)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 15 - when /^#{Mx[:meta_o]}(keywords)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra') - when /^#{Mx[:meta_o]}(copyright)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra') - when /^#{Mx[:meta_o]}(translator|translated_by)#{Mx[:meta_c]}\s*(.+?)$/; header('translator',$2) - when /^#{Mx[:meta_o]}(illustrator|illustrated_by)#{Mx[:meta_c]}\s*(.+?)$/; header('illustrator',$2) - when /^#{Mx[:meta_o]}(prepared_by)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra') - when /^#{Mx[:meta_o]}(digitized_by)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra') - when /^#{Mx[:meta_o]}(comments?)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra') - when /^#{Mx[:meta_o]}(abstract)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra') - when /^#{Mx[:meta_o]}(tags?)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra') - when /^#{Mx[:meta_o]}(catalogue)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra') - when /^#{Mx[:meta_o]}(class(?:ify)?_loc)#{Mx[:meta_c]}\s*(.+?)$/; header('classify_loc',$2,'meta','extra') - when /^#{Mx[:meta_o]}(class(?:ify)?_dewey)#{Mx[:meta_c]}\s*(.+?)$/; header('classify_dewey',$2,'meta','extra') - when /^#{Mx[:meta_o]}(class(?:ify)?_pg)#{Mx[:meta_c]}\s*(.+?)$/; header('classify_pg',$2,'meta','extra') - when /^#{Mx[:meta_o]}(class(?:ify)?_isbn)#{Mx[:meta_c]}\s*(.+?)$/; header('classify_isbn',$2,'meta','extra') - when /^#{Mx[:meta_o]}(toc|structure)#{Mx[:meta_c]}\s*(.+?)$/; header('structure',$2,'process','instruct') - when /^#{Mx[:meta_o]}(level|page|markup)#{Mx[:meta_c]}\s*(.+?)$/; header('markup',$2,'process','instruct') - when /^#{Mx[:meta_o]}(bold)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct') - when /^#{Mx[:meta_o]}(italics|itali[sz]e)#{Mx[:meta_c]}\s*(.+?)$/; header('italicize',$2,'process','instruct') - when /^#{Mx[:meta_o]}(vocabulary|wordlist)#{Mx[:meta_c]}\s*(.+?)$/; header('vocabulary',$2,'process','instruct') - when /^#{Mx[:meta_o]}(css|stylesheet)#{Mx[:meta_c]}\s*(.+?)$/; header('css',$2,'process','instruct') - when /^#{Mx[:meta_o]}(links)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct') - when /^#{Mx[:meta_o]}(prefix)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct') #add a & b - when /^#{Mx[:meta_o]}(suffix)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct') - when /^#{Mx[:meta_o]}(information)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct') - when /^#{Mx[:meta_o]}(contact)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct') - when /^#{Mx[:meta_o]}(rcs|cvs)#{Mx[:meta_c]}\s*(.+?)$/; header('version',$2,'process','instruct') + when /^#{Mx[:meta_o]}(title)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,@md.title.full,'meta','dc') #dc 1 + when /^#{Mx[:meta_o]}(creator|author)#{Mx[:meta_c]}\s*(.+?)$/ then header('creator',$2,'meta','dc') #dc 2 + when /^#{Mx[:meta_o]}(subject)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','dc') #dc 3 + when /^#{Mx[:meta_o]}(description)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','dc') #dc 4 + when /^#{Mx[:meta_o]}(publisher)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','dc') #dc 5 + when /^#{Mx[:meta_o]}(contributor)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','dc') #dc 6 + when /^#{Mx[:meta_o]}(date)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','dc') #dc 7 + when /^#{Mx[:meta_o]}(date\.created)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','extra') + when /^#{Mx[:meta_o]}(date\.issued)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','extra') + when /^#{Mx[:meta_o]}(date\.available)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','extra') + when /^#{Mx[:meta_o]}(date\.valid)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','extra') + when /^#{Mx[:meta_o]}(date\.modified)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','extra') + when /^#{Mx[:meta_o]}(type)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','dc') #dc 8 + when /^#{Mx[:meta_o]}(format)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','dc') #dc 9 + when /^#{Mx[:meta_o]}(identifier)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','dc') #dc 10 + when /^#{Mx[:meta_o]}(source)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','dc') #dc 11 + when /^#{Mx[:meta_o]}(language)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','dc') #dc 12 + when /^#{Mx[:meta_o]}(relation)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','dc') #dc 13 + when /^#{Mx[:meta_o]}(coverage)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','dc') #dc 14 + when /^#{Mx[:meta_o]}(rights)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','dc') #dc 15 + when /^#{Mx[:meta_o]}(keywords)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','extra') + when /^#{Mx[:meta_o]}(copyright)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','extra') + when /^#{Mx[:meta_o]}(translator|translated_by)#{Mx[:meta_c]}\s*(.+?)$/ then header('translator',$2) + when /^#{Mx[:meta_o]}(illustrator|illustrated_by)#{Mx[:meta_c]}\s*(.+?)$/ then header('illustrator',$2) + when /^#{Mx[:meta_o]}(prepared_by)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','extra') + when /^#{Mx[:meta_o]}(digitized_by)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','extra') + when /^#{Mx[:meta_o]}(comments?)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','extra') + when /^#{Mx[:meta_o]}(abstract)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','extra') + when /^#{Mx[:meta_o]}(tags?)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','extra') + when /^#{Mx[:meta_o]}(catalogue)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','extra') + when /^#{Mx[:meta_o]}(class(?:ify)?_loc)#{Mx[:meta_c]}\s*(.+?)$/ then header('classify_loc',$2,'meta','extra') + when /^#{Mx[:meta_o]}(class(?:ify)?_dewey)#{Mx[:meta_c]}\s*(.+?)$/ then header('classify_dewey',$2,'meta','extra') + when /^#{Mx[:meta_o]}(class(?:ify)?_pg)#{Mx[:meta_c]}\s*(.+?)$/ then header('classify_pg',$2,'meta','extra') + when /^#{Mx[:meta_o]}(class(?:ify)?_isbn)#{Mx[:meta_c]}\s*(.+?)$/ then header('classify_isbn',$2,'meta','extra') + when /^#{Mx[:meta_o]}(toc|structure)#{Mx[:meta_c]}\s*(.+?)$/ then header('structure',$2,'process','instruct') + when /^#{Mx[:meta_o]}(level|page|markup)#{Mx[:meta_c]}\s*(.+?)$/ then header('markup',$2,'process','instruct') + when /^#{Mx[:meta_o]}(bold)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'process','instruct') + when /^#{Mx[:meta_o]}(italics|itali[sz]e)#{Mx[:meta_c]}\s*(.+?)$/ then header('italicize',$2,'process','instruct') + when /^#{Mx[:meta_o]}(vocabulary|wordlist)#{Mx[:meta_c]}\s*(.+?)$/ then header('vocabulary',$2,'process','instruct') + when /^#{Mx[:meta_o]}(css|stylesheet)#{Mx[:meta_c]}\s*(.+?)$/ then header('css',$2,'process','instruct') + when /^#{Mx[:meta_o]}(links)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'process','instruct') + when /^#{Mx[:meta_o]}(prefix)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'process','instruct') #add a & b + when /^#{Mx[:meta_o]}(suffix)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'process','instruct') + when /^#{Mx[:meta_o]}(information)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'process','instruct') + when /^#{Mx[:meta_o]}(contact)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'process','instruct') + when /^#{Mx[:meta_o]}(rcs|cvs)#{Mx[:meta_c]}\s*(.+?)$/ then header('version',$2,'process','instruct') else nil end end diff --git a/lib/sisu/v5/txt_textile.rb b/lib/sisu/v5/txt_textile.rb index 429593cc..5645f490 100644 --- a/lib/sisu/v5/txt_textile.rb +++ b/lib/sisu/v5/txt_textile.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -126,9 +127,9 @@ module SiSU_Txt_Textile @brace_url=SiSU_Viz::Defaults.new.url_decoration @tab="\t" @@endnotes_=case md.opt.mod.inspect - when /--footnote/; false - when /--endnote/; true - else true + when /--footnote/ then false + when /--endnote/ then true + else true end @plaintext={ body: [], open: [], close: [], head: [], metadata: [], tail: [] } end @@ -220,22 +221,22 @@ WOK def decorate def heading def inline - def l1 + def l0 'h1. ' end - def l2 + def l1 'h2. ' end - def l3 + def l2 'h3. ' end - def l4 + def l3 'h4. ' end - def l5 + def l4 'h5. ' end - def l6 + def l5 'h6. ' end self @@ -345,12 +346,12 @@ WOK end def heading_decorated_inline(dob) heading_inline = case dob.lc - when 1; decorate.heading.inline.l1 - when 2; decorate.heading.inline.l2 - when 3; decorate.heading.inline.l3 - when 4; decorate.heading.inline.l4 - when 5; decorate.heading.inline.l5 - when 6; decorate.heading.inline.l6 + when 1 then decorate.heading.inline.l1 + when 2 then decorate.heading.inline.l2 + when 3 then decorate.heading.inline.l3 + when 4 then decorate.heading.inline.l4 + when 5 then decorate.heading.inline.l5 + when 6 then decorate.heading.inline.l6 end heading_inline + ' ' + dob.obj end diff --git a/lib/sisu/v5/update.rb b/lib/sisu/v5/update.rb index 22abc6a0..3004b0b1 100644 --- a/lib/sisu/v5/update.rb +++ b/lib/sisu/v5/update.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/urls.rb b/lib/sisu/v5/urls.rb index ce3be66b..d814965f 100644 --- a/lib/sisu/v5/urls.rb +++ b/lib/sisu/v5/urls.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -115,7 +116,7 @@ module SiSU_Urls 'S --sisupod (sisupod)'=>@fn[:sisupod], 't --txt (Plain-text (endnotes))'=>@fn[:plain], ' --textile (textile txt)'=>@fn[:txt_textile], - ' --asciidoc (asciidoc txt)'=>@fn[:txt_asciidoc], + ' --asciidoc (AsciiDoc txt)'=>@fn[:txt_asciidoc], ' --markdown (markdown txt)'=>@fn[:txt_markdown], ' --rst (rST restructured-text)'=>@fn[:txt_rst], ' --docbook-book (DocBook Book)'=>@fn[:xml_docbook_book], diff --git a/lib/sisu/v5/utils.rb b/lib/sisu/v5/utils.rb index 52ca22d0..97ca24be 100644 --- a/lib/sisu/v5/utils.rb +++ b/lib/sisu/v5/utils.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -68,25 +69,25 @@ module SiSU_Utils @color=color ? color : @color c={} c[:on]=case @color - when :red; ANSI_C[:red] - when :green; ANSI_C[:green] - when :yellow; ANSI_C[:yellow] - when :blue; ANSI_C[:blue] - when :fuchsia; ANSI_C[:fuchsia] - when :cyan; ANSI_C[:cyan] - when :inv_red; ANSI_C[:inv_red] - when :inv_green; ANSI_C[:inv_green] - when :inv_yellow; ANSI_C[:inv_yellow] - when :inv_blue; ANSI_C[:inv_blue] - when :inv_fuchsia; ANSI_C[:inv_fuchsia] - when :inv_cyan; ANSI_C[:inv_cyan] - when :b_red; ANSI_C[:b_red] - when :b_green; ANSI_C[:b_green] - when :b_yellow; ANSI_C[:b_yellow] - when :b_blue; ANSI_C[:b_blue] - when :b_fuchsia; ANSI_C[:b_fuchsia] - when :b_cyan; ANSI_C[:b_cyan] - else ANSI_C[:red] + when :red then ANSI_C[:red] + when :green then ANSI_C[:green] + when :yellow then ANSI_C[:yellow] + when :blue then ANSI_C[:blue] + when :fuchsia then ANSI_C[:fuchsia] + when :cyan then ANSI_C[:cyan] + when :inv_red then ANSI_C[:inv_red] + when :inv_green then ANSI_C[:inv_green] + when :inv_yellow then ANSI_C[:inv_yellow] + when :inv_blue then ANSI_C[:inv_blue] + when :inv_fuchsia then ANSI_C[:inv_fuchsia] + when :inv_cyan then ANSI_C[:inv_cyan] + when :b_red then ANSI_C[:b_red] + when :b_green then ANSI_C[:b_green] + when :b_yellow then ANSI_C[:b_yellow] + when :b_blue then ANSI_C[:b_blue] + when :b_fuchsia then ANSI_C[:b_fuchsia] + when :b_cyan then ANSI_C[:b_cyan] + else ANSI_C[:red] end c[:off]= ANSI_C[:off] #ansi_color + @line.to_s + ansi_color_off + ' ' + @file.gsub(/([^\/]+$)/,"#{ansi_color}\\1#{ansi_color_off}") diff --git a/lib/sisu/v5/webrick.rb b/lib/sisu/v5/webrick.rb index f4a262e9..baf468c2 100644 --- a/lib/sisu/v5/webrick.rb +++ b/lib/sisu/v5/webrick.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/wikispeak.rb b/lib/sisu/v5/wikispeak.rb index b87fef61..04626030 100644 --- a/lib/sisu/v5/wikispeak.rb +++ b/lib/sisu/v5/wikispeak.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -222,10 +223,10 @@ WOK para.gsub!(/<\S+?>#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}/,'') # endnote marker marked up if lv @@wiki[:body] << case lv - when 1; '='*2 << para.strip << @br*2 - when 2..3; '='*2 << para.strip << @br*2 - when 4; '='*4 << para.strip << @br*2 - when 5..6; '='*4 << para.strip << @br*2 + when 1 then '='*2 << para.strip << @br*2 + when 2..3 then '='*2 << para.strip << @br*2 + when 4 then '='*4 << para.strip << @br*2 + when 5..6 then '='*4 << para.strip << @br*2 end else @@wiki[:body] << para << @br*2 # main text, contents, body KEEP end diff --git a/lib/sisu/v5/xhtml.rb b/lib/sisu/v5/xhtml.rb index 841ae03e..0e0d7781 100644 --- a/lib/sisu/v5/xhtml.rb +++ b/lib/sisu/v5/xhtml.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -316,12 +317,13 @@ WOK if dob.is==:heading xml_structure(dob) dob.obj=case dob.ln - when 1; x.heading_body1 - when 2; x.heading_body2 - when 3; x.heading_body3 - when 4; x.heading_body4 - when 5; x.heading_body5 - when 6; x.heading_body6 + when 0 then x.heading_body0 + when 1 then x.heading_body1 + when 2 then x.heading_body2 + when 3 then x.heading_body3 + when 4 then x.heading_body4 + when 5 then x.heading_body5 + when 6 then x.heading_body6 end else if dob.is ==:verse diff --git a/lib/sisu/v5/xhtml_epub2.rb b/lib/sisu/v5/xhtml_epub2.rb index c54d77ff..33e3a529 100644 --- a/lib/sisu/v5/xhtml_epub2.rb +++ b/lib/sisu/v5/xhtml_epub2.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -208,7 +209,7 @@ module SiSU_XHTML_EPUB2 @@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 + @s_a_no,@s_b_no,@s_c_no,@s_d_no,@lv5_no,@lv6_no=0,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 @@ -230,7 +231,7 @@ module SiSU_XHTML_EPUB2 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] + @ncxo=[false,false,false,false,false,false,false] @dob_toc2,@dob_toc3=nil,nil @ncx_cls=[] @level_a_first_occurrence=true @@ -239,7 +240,7 @@ module SiSU_XHTML_EPUB2 || dob.is==:heading_insert dob_toc=dob.dup toc=case dob_toc.ln - when 1 + when 0 @s_a_no +=1 lv_name='section_a' + @s_a_no.to_s @nav_no+=1 @@ -250,20 +251,21 @@ module SiSU_XHTML_EPUB2 @@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 + @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[0] + @ncxo[0],@ncxo[1],@ncxo[2],@ncxo[3],@ncxo[4],@ncxo[5],@ncxo[6]=true,false,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 + @nav_no+=1 @level_a_first_occurrence=false end + @@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_XHTML_EPUB2::Source::Toc.new(@md,dob_toc).level_1 - when 2 + SiSU_XHTML_EPUB2::Source::Toc.new(@md,dob_toc).level_0 + when 1 @s_b_no +=1 lv_name='section_b' + @s_b_no.to_s @nav_no+=1 @@ -273,6 +275,24 @@ module SiSU_XHTML_EPUB2 @@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 + 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_XHTML_EPUB2::Source::Toc.new(@md,dob_toc).level_1 + when 2 + @s_c_no +=1 + lv_name='section_c' + @s_c_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 @@ -281,8 +301,8 @@ module SiSU_XHTML_EPUB2 md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,lv_name) SiSU_XHTML_EPUB2::Source::Toc.new(@md,dob_toc).level_2 when 3 - @s_c_no +=1 - lv_name='section_c' + @s_c_no.to_s + @s_d_no +=1 + lv_name='section_d' + @s_d_no.to_s @nav_no+=1 @nav_no3=@nav_no @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[6] @@ -363,7 +383,8 @@ module SiSU_XHTML_EPUB2 @@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 + @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[0] + @ncxo[0],@ncxo[1],@ncxo[2],@ncxo[3],@ncxo[4],@ncxo[5],@ncxo[6]=false,false,false,false,false,false,false md_opf_a_content << @epub.metadata_opf.manifest_images(@md.ec[:image]) @@toc[:seg] << "</div>\n</div>" @@toc[:scr] << "</div>\n</div>" @@ -380,9 +401,32 @@ module SiSU_XHTML_EPUB2 @@toc end protected + def level_0 + dob=@data + linkname=dob.obj.gsub(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/,'').strip + link=dob.ocn + title=linkname + toc={} + txt_obj={ txt: title } + format_toc=SiSU_XHTML_EPUB2_Format::FormatToc.new(@md,txt_obj) + toc[:seg]=format_toc.lev1 + title=if dob.ocn ==0 then linkname + else + @@toc[:scr] << '<br />' + link=(dob.ln) \ + ? dob.ln + : '' + %{<b><a href="##{link}">#{linkname}</a></b>} + end + txt_obj={ txt: title } + format_toc=SiSU_XHTML_EPUB2_Format::FormatToc.new(@md,txt_obj) + toc[:scr]=format_toc.lev1 + toc + end def level_1 dob=@data - linkname,link=dob.obj.strip,dob.ocn + linkname=dob.obj.gsub(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/,'').strip + link=dob.ocn title=if dob.obj !~/Document Information/ linkname else @@ -421,7 +465,8 @@ module SiSU_XHTML_EPUB2 end def level_2 dob=@data - linkname,ocn=dob.obj.strip,dob.ocn + linkname=dob.obj.gsub(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/,'').strip + ocn=dob.ocn if ocn \ and ocn !~/#/ p_num=SiSU_XHTML_EPUB2_Format::ParagraphNumber.new(@md,ocn) @@ -440,7 +485,8 @@ module SiSU_XHTML_EPUB2 end def level_3 dob=@data - linkname,ocn=dob.obj.strip,dob.ocn + linkname=dob.obj.gsub(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/,'').strip + ocn=dob.ocn if ocn \ and ocn !~/#/ p_num=SiSU_XHTML_EPUB2_Format::ParagraphNumber.new(@md,ocn) @@ -459,7 +505,8 @@ module SiSU_XHTML_EPUB2 end def level_4 dob=@data - linkname,ocn=dob.obj.strip,dob.ocn + linkname=dob.obj.gsub(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/,'').strip + ocn=dob.ocn p_num=SiSU_XHTML_EPUB2_Format::ParagraphNumber.new(@md,ocn) if ocn if dob.ln==4 seg_link=%{ <a href="#{dob.name}#{Sfx[:epub_xhtml]}"> @@ -484,7 +531,8 @@ module SiSU_XHTML_EPUB2 end def level_5 dob=@data - linkname,ocn=dob.obj.strip,dob.ocn + linkname=dob.obj.gsub(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/,'').strip + ocn=dob.ocn toc={} if ocn \ and ocn !~/#/ @@ -504,7 +552,8 @@ module SiSU_XHTML_EPUB2 end def level_6 dob=@data - linkname,ocn=dob.obj.strip,dob.ocn + linkname=dob.obj.gsub(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/,'').strip + ocn=dob.ocn toc={} if ocn \ and ocn !~/#/ diff --git a/lib/sisu/v5/xhtml_epub2_concordance.rb b/lib/sisu/v5/xhtml_epub2_concordance.rb index 5668521b..6d7c4758 100644 --- a/lib/sisu/v5/xhtml_epub2_concordance.rb +++ b/lib/sisu/v5/xhtml_epub2_concordance.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -159,11 +160,13 @@ WOK @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_lv0=/^#{Mx[:lv_o]}0:/ + @rxp_lv1=/^#{Mx[:lv_o]}1:/ + @rxp_lv2=/^#{Mx[:lv_o]}2:/ + @rxp_lv3=/^#{Mx[:lv_o]}3:/ @rxp_seg=/^#{Mx[:lv_o]}4:(\S+?)#{Mx[:lv_c]}/ @rxp_title=Regexp.new("^#{Mx[:meta_o]}title#{Mx[:meta_c]}\s*(.+?)\s*$") + @rxp_t0=Regexp.new('^T0') @rxp_t1=Regexp.new('^T1') @rxp_t2=Regexp.new('^T2') @rxp_t3=Regexp.new('^T3') @@ -270,15 +273,17 @@ WOK end @freq[word] +=1 @word_map[word] ||= [] - if line !~@rxp_lv1 \ + if line !~@rxp_lv0 \ + and 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) + when @rxp_lv0 then location_seg('T0',toy) + when @rxp_lv1 then location_seg('T1',toy) + when @rxp_lv2 then location_seg('T2',toy) + when @rxp_lv3 then location_seg('T3',toy) end end end diff --git a/lib/sisu/v5/xhtml_epub2_format.rb b/lib/sisu/v5/xhtml_epub2_format.rb index e53c3bfe..8dd8a88e 100644 --- a/lib/sisu/v5/xhtml_epub2_format.rb +++ b/lib/sisu/v5/xhtml_epub2_format.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -1225,7 +1226,7 @@ module SiSU_XHTML_EPUB2_Format x=x.gsub(/ /,' ') if Ep[:alt]==:on x.gsub(/&/,'&'). gsub(/</,"<").gsub(/>/,">"). - gsub(/#{Dx[:url_o]}/,Dx[:url_o_xml]).gsub(/#{Dx[:url_c]}/,Dx[:url_o_xml]). + gsub(/#{Dx[:url_o]}/,Dx[:url_o_xml]).gsub(/#{Dx[:url_c]}/,Dx[:url_c_xml]). #gsub(/</,'<').gsub(/>/,'>'). gsub(/\\\\/,'<br />'). gsub(/<br(?: \/)?>/,'<br />') @@ -1305,6 +1306,7 @@ application/epub+zip dir_epub_cont=@md.env.processing_path.epub + '/' + Ep[:d_oebps] segfilename=dir_epub_cont + '/' + name output_epub_cont_seg=File.new(segfilename,'w') + txt=dob.obj.gsub(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/,'') output_epub_cont_seg << %{#{doc_type} <head> <title> @@ -1319,7 +1321,7 @@ application/epub+zip <div class="substance"> <label class="ocn"><a href="#o#{dob.ocn}" class="lnkocn">#{dob.ocn}</a></label> <h1 class="norm" id="o#{dob.ocn}"> - #{dob.obj} + #{txt} </h1> </div> </div> @@ -1412,15 +1414,16 @@ output_epub_cont_seg.close WOK end def navpoint(dob,no,fn_base,hashtag=nil) - fn=fn_base + Sfx[:epub_xhtml] - name=hashtag ? fn + hashtag : fn + fn=fn_base + Sfx[:epub_xhtml] + name=hashtag ? fn + hashtag : fn id_u=DISABLE[:epub][:ncx_navpoint_unique_id] \ ? '' : "-#{no}" + txt=dob.obj.gsub(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/,'') <<-WOK <navPoint class="chapter" id="navpoint#{id_u}" playOrder="#{no}"> <navLabel> - <text>#{dob.obj}</text> + <text>#{txt}</text> </navLabel> <content src="#{name}" /> WOK @@ -1988,6 +1991,11 @@ output_epub_cont_seg.close </div> } end + def title_heading0 + DISABLE[:epub][:per_section_title] \ + ? '' + : title_heading('h1','tiny') + end def title_heading1 DISABLE[:epub][:per_section_title] \ ? '' diff --git a/lib/sisu/v5/xhtml_epub2_segments.rb b/lib/sisu/v5/xhtml_epub2_segments.rb index d16e98e8..764fcc17 100644 --- a/lib/sisu/v5/xhtml_epub2_segments.rb +++ b/lib/sisu/v5/xhtml_epub2_segments.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -123,8 +124,8 @@ WOK @@seg_name,@@seg_name_xhtml=[],[] @@seg_url=@@fn=@@get_hash_to=@@get_hash_fn='' @@loop_count=@@seg_total=@@tracker=0 - @@is4=@@is3=@@is2=@@is1=0 - @@heading1=@@heading2=@@heading3=@@heading4=0 + @@is4=@@is3=@@is2=@@is1=@@is0=0 + @@heading0=@@heading1=@@heading2=@@heading3=@@heading4=0 @@seg[:headings],@@seg[:main],@@seg[:idx],@@seg[:tail],@@seg_subtoc_array,@@seg_endnotes_array,@@seg[:endnote_all]=Array.new(7){[]} @@seg[:heading_endnotes]='' @@tablehead,@@number_of_cols=0,0 @@ -154,7 +155,7 @@ WOK protected def articles(data) tracking,newfile=0,0 - @@is4=@@is3=@@is2=@@is1=0 + @@is4=@@is3=@@is2=@@is1=@@is0=0 printed_endnote_seg='n' idx_xhtml=nil if @md.book_idx @@ -195,35 +196,38 @@ WOK #end if (dob.is==:heading \ || dob.is==:heading_insert) \ - and dob.ln==4 - if dob.ocn==0 - @@heading4=dob.obj - else @@heading4=dob.obj - end + && dob.ln==4 + @@heading4=dob.obj @@is4=newfile=1 end if (dob.is==:heading \ || dob.is==:heading_insert) \ - and dob.ln==3 + && dob.ln==3 @@heading3=dob.obj @@is4,@@is3=0,1 end if (dob.is==:heading \ || dob.is==:heading_insert) \ - and dob.ln==2 + && dob.ln==2 @@heading2=dob.obj @@is4,@@is3,@@is2=0,0,1 end if (dob.is==:heading \ || dob.is==:heading_insert) \ - and dob.ln==1 + && dob.ln==1 @@heading1=dob.obj @@is4,@@is3,@@is2,@@is1=0,0,0,1 end - if (@@is1 && !@@is2 && !@@is3 && !@@is4) + if (dob.is==:heading \ + || dob.is==:heading_insert) \ + && dob.ln==0 + @@heading0=dob.obj + @@is4,@@is3,@@is2,@@is1,@@is0=0,0,0,0,1 + end + if (@@is0 && !@@is1 && !@@is2 && !@@is3 && !@@is4) if not (dob.is==:heading \ || dob.is==:heading_insert) \ - and dob.ln==1 + && dob.ln==0 $_ #; check end end @@ -234,7 +238,7 @@ WOK newfile=0 if (dob.is==:heading \ || dob.is==:heading_insert) \ - and dob.ln==4 + && dob.ln==4 if tracking != 0 SiSU_XHTML_EPUB2_Seg::Seg.new(@md).tail segfilename="#{dir_epub_cont}/#{@@seg_name_xhtml[tracking-1]}#{Sfx[:epub_xhtml]}" @@ -274,8 +278,8 @@ WOK end if (dob.is==:heading \ || dob.is==:heading_insert) \ - and dob.ln==4 \ - and dob.name + && dob.ln==4 \ + && dob.name @@get_hash_to=dob.name @@get_hash_fn=dob.name end @@ -301,15 +305,19 @@ WOK def head(dob) clean=/<!.*?!>|<:.*?>$/ @p_num ||= '' - if @@is1==1 + if @@is0==1 if defined? @md.creator.author \ and @md.creator.author @author=%{<b>#{@md.creator.author}</b>\n} end - ocn=(@@heading1[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \ - ? $1 - : '' - @p_num=SiSU_XHTML_EPUB2_Format::ParagraphNumber.new(@md,ocn) + @p_num=SiSU_XHTML_EPUB2_Format::ParagraphNumber.new(@md,dob.ocn) + txt_obj={ txt: @@heading0, ocn_display: @p_num.ocn_display } + format_seg=SiSU_XHTML_EPUB2_Format::FormatSeg.new(@md,txt_obj) + @@seg[:headings] << format_seg.title_heading0.gsub(clean,'') + @@heading0=@@heading0.gsub(/#{$ep[:hsp]}<a name="-[\d*+]+" href="#_[\d*+]+">#{$ep[:hsp]}<sup>[\d*+]+<\/sup>#{$ep[:hsp]}<\/a>/,'') + end + if @@is1==1 + @p_num=SiSU_XHTML_EPUB2_Format::ParagraphNumber.new(@md,dob.ocn) txt_obj={ txt: @@heading1, ocn_display: @p_num.ocn_display } format_seg=SiSU_XHTML_EPUB2_Format::FormatSeg.new(@md,txt_obj) @@seg[:headings] << format_seg.title_heading1.gsub(clean,'') @@ -317,10 +325,7 @@ WOK end if @@is2==1 heading2=@@heading2 - ocn=(heading2[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \ - ? $1 - : '' - @p_num=SiSU_XHTML_EPUB2_Format::ParagraphNumber.new(@md,ocn) + @p_num=SiSU_XHTML_EPUB2_Format::ParagraphNumber.new(@md,dob.ocn) txt_obj={ txt: heading2, ocn_display: @p_num.ocn_display } format_seg=SiSU_XHTML_EPUB2_Format::FormatSeg.new(@md,txt_obj) @@seg[:headings] << format_seg.title_heading2.gsub(clean,'') @@ -328,10 +333,7 @@ WOK end if @@is3==1 heading3=@@heading3 - ocn=(heading3[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \ - ? $1 - : '' - @p_num=SiSU_XHTML_EPUB2_Format::ParagraphNumber.new(@md,ocn) + @p_num=SiSU_XHTML_EPUB2_Format::ParagraphNumber.new(@md,dob.ocn) txt_obj={ txt: heading3, ocn_display: @p_num.ocn_display } format_seg=SiSU_XHTML_EPUB2_Format::FormatSeg.new(@md,txt_obj) @@seg[:headings] << format_seg.title_heading3.gsub(clean,'') @@ -339,10 +341,7 @@ WOK end if @@is4==1 heading4=@@heading4 - ocn=(heading4[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \ - ? $1 - : '' - @p_num=SiSU_XHTML_EPUB2_Format::ParagraphNumber.new(@md,ocn) + @p_num=SiSU_XHTML_EPUB2_Format::ParagraphNumber.new(@md,dob.ocn) txt_obj={ txt: heading4, ocn_display: @p_num.ocn_display } format_seg=SiSU_XHTML_EPUB2_Format::FormatSeg.new(@md,txt_obj) @@seg[:headings] << format_seg.title_heading4.gsub(clean,'') diff --git a/lib/sisu/v5/xhtml_epub2_tune.rb b/lib/sisu/v5/xhtml_epub2_tune.rb index b46f49f0..6ac53c39 100644 --- a/lib/sisu/v5/xhtml_epub2_tune.rb +++ b/lib/sisu/v5/xhtml_epub2_tune.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -160,7 +161,7 @@ module SiSU_XHTML_EPUB2_Tune gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>'). # tt, kbd gsub(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,''). gsub(/#{Mx[:gl_bullet]}/m,"●#{$ep[:hsp]*2}"). - gsub(/#{Dx[:url_o]}/,Dx[:url_o_xml]).gsub(/#{Dx[:url_c]}/,Dx[:url_o_xml]). + gsub(/#{Dx[:url_o]}/,Dx[:url_o_xml]).gsub(/#{Dx[:url_c]}/,Dx[:url_c_xml]). gsub(/#{Mx[:nbsp]}/,$ep[:hsp]). gsub(/<(p|br)>/,'<\1 />') dob.obj=SiSU_XHTML_EPUB2_Tune::CleanXHTML.new(dob.obj).clean diff --git a/lib/sisu/v5/xhtml_shared.rb b/lib/sisu/v5/xhtml_shared.rb index 27ddba4b..626c140b 100644 --- a/lib/sisu/v5/xhtml_shared.rb +++ b/lib/sisu/v5/xhtml_shared.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/xhtml_table.rb b/lib/sisu/v5/xhtml_table.rb index 1431306d..11048040 100644 --- a/lib/sisu/v5/xhtml_table.rb +++ b/lib/sisu/v5/xhtml_table.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/xml_docbook5.rb b/lib/sisu/v5/xml_docbook5.rb index 9e02af39..0dddf264 100644 --- a/lib/sisu/v5/xml_docbook5.rb +++ b/lib/sisu/v5/xml_docbook5.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -131,18 +132,20 @@ module SiSU_XML_Docbook_Book def tags # collapsed --> def collapsed - %w[ 0 1 2 3 4 5 6 ] + %w[ 0 1 2 3 4 5 ] end def docbook(lc,chlv='') case lc - when 1 + when 0 'book' + when 1 + lc==chlv ? 'chapter' : 'section' when 2 lc==chlv ? 'chapter' : 'section' when 3 lc==chlv ? 'chapter' : 'section' when 4 - lc==chlv ? 'chapter' : 'section' + 'section' when 5 'section' when 6 @@ -177,16 +180,16 @@ module SiSU_XML_Docbook_Book WOK put(tail) end - def output(o,lev=nil,comment='') - puts lev == 0..6 \ - ? "#{space*lev}<#{lev}>[#{o.ocn}] #{o.ln} #{o.obj}</#{lev}>#{comment}" - : "<#{lev}>[#{o.ocn}] #{o.ln} #{o.obj}</#{lev}>#{comment}" + def output(o,comment='') + puts o.lc == 0..6 \ + ? "#{space*o.lc}<#{o.lc}>[#{o.ocn}] #{o.ln} #{o.obj}</#{o.lc}>#{comment}" + : "<#{o.lc}>[#{o.ocn}] #{o.ln} #{o.obj}</#{o.lc}>#{comment}" end def structure_collapsed(data) puts "\ncollapsed structure, heading outline --->\n\n" data.each_with_index do |o,i| if (o.is ==:heading || o.is ==:heading_insert) - output(o,o.lc) + output(o) end end end @@ -208,24 +211,23 @@ module SiSU_XML_Docbook_Book ocn,id='','' end if (o.is ==:heading || o.is ==:heading_insert) - lev=o.lc chlv=(o.lv.to_i == 1) \ ? @chlv=o.lc.to_i : 0 - @splv=lev + @splv=o.lc tag_id=o.tags[0] ? %{ id="#{o.tags[0]}" } : '' if doc_position ==:head - filename_docbook.puts %{#{space*lev}<title#{id}>} + filename_docbook.puts %{#{space*o.lc}<title#{id}>} doc_position=:body_and_tail else - filename_docbook.puts structure_build_tag_close(lev,h) - filename_docbook.puts %{#{space*(lev-1)}<#{tags.docbook(lev,chlv)}#{tag_id}> -#{space*lev}<title#{id}> + filename_docbook.puts structure_build_tag_close(o.lc,h) + filename_docbook.puts %{#{space*(o.lc)}<#{tags.docbook(o.lc,chlv)}#{tag_id}> +#{space*o.lc}<title#{id}> } end filename_docbook.puts SiSU_TextUtils::Wrap.new(o.obj + ocn,80,(@splv*2+2)).line_wrap - filename_docbook.puts %{#{space*lev}</title>} - h=lev + filename_docbook.puts %{#{space*o.lc}</title>} + h=o.lc elsif (o.of ==:para or o.of ==:block) filename_docbook.puts "#{space*(@splv)}<para#{id}>" filename_docbook.puts SiSU_TextUtils::Wrap.new(o.obj + ocn,80,(@splv*2+2)).line_wrap @@ -235,36 +237,44 @@ module SiSU_XML_Docbook_Book filename_docbook.puts structure_build_tag_close(0,h) filename_docbook.close end - def structure_build_tag_close(lev,h) + def structure_build_tag_close(lc,h) x=[] case h + when 0 + x << "#{space*0}</#{tags.docbook(0)}>" if (lc <= 0) when 1 - x << "#{space*0}</#{tags.docbook(1)}>" if (lev <= 1) + x << "#{space*1}</#{tags.docbook(1,@chlv)}>" if (lc <= 1) + x << "#{space*0}</#{tags.docbook(0)}>" if (lc <= 0) when 2 - x << "#{space*1}</#{tags.docbook(2,@chlv)}>" if (lev <= 2) - x << "#{space*0}</#{tags.docbook(1)}>" if (lev <= 1) + x << "#{space*2}</#{tags.docbook(2,@chlv)}>" if (lc <= 2) + x << "#{space*1}</#{tags.docbook(1,@chlv)}>" if (lc <= 1) + x << "#{space*0}</#{tags.docbook(0)}>" if (lc <= 0) when 3 - x << "#{space*2}</#{tags.docbook(3,@chlv)}>" if (lev <= 3) - x << "#{space*1}</#{tags.docbook(2,@chlv)}>" if (lev <= 2) - x << "#{space*0}</#{tags.docbook(1)}>" if (lev <= 1) + x << "#{space*3}</#{tags.docbook(3,@chlv)}>" if (lc <= 3) + x << "#{space*2}</#{tags.docbook(2,@chlv)}>" if (lc <= 2) + x << "#{space*1}</#{tags.docbook(1,@chlv)}>" if (lc <= 1) + x << "#{space*0}</#{tags.docbook(0)}>" if (lc <= 0) when 4 - x << "#{space*3}</#{tags.docbook(4,@chlv)}>" if (lev <= 4) - x << "#{space*2}</#{tags.docbook(3,@chlv)}>" if (lev <= 3) - x << "#{space*1}</#{tags.docbook(2,@chlv)}>" if (lev <= 2) - x << "#{space*0}</#{tags.docbook(1)}>" if (lev <= 1) + x << "#{space*4}</#{tags.docbook(4,@chlv)}>" if (lc <= 4) + x << "#{space*3}</#{tags.docbook(3,@chlv)}>" if (lc <= 3) + x << "#{space*2}</#{tags.docbook(2,@chlv)}>" if (lc <= 2) + x << "#{space*1}</#{tags.docbook(1,@chlv)}>" if (lc <= 1) + x << "#{space*0}</#{tags.docbook(0)}>" if (lc <= 0) when 5 - x << "#{space*4}</#{tags.docbook(5)}>" if (lev <= 5) - x << "#{space*3}</#{tags.docbook(4,@chlv)}>" if (lev <= 4) - x << "#{space*2}</#{tags.docbook(3,@chlv)}>" if (lev <= 3) - x << "#{space*1}</#{tags.docbook(2,@chlv)}>" if (lev <= 2) - x << "#{space*0}</#{tags.docbook(1)}>" if (lev <= 1) + x << "#{space*5}</#{tags.docbook(5)}>" if (lc <= 5) + x << "#{space*4}</#{tags.docbook(4,@chlv)}>" if (lc <= 4) + x << "#{space*5}</#{tags.docbook(3,@chlv)}>" if (lc <= 3) + x << "#{space*2}</#{tags.docbook(2,@chlv)}>" if (lc <= 2) + x << "#{space*1}</#{tags.docbook(1,@chlv)}>" if (lc <= 1) + x << "#{space*0}</#{tags.docbook(0)}>" if (lc <= 0) when 6 - x << "#{space*5}</#{tags.docbook(6)}>" if (lev <= 6) - x << "#{space*4}</#{tags.docbook(5)}>" if (lev <= 5) - x << "#{space*3}</#{tags.docbook(4,@chlv)}>" if (lev <= 4) - x << "#{space*2}</#{tags.docbook(3,@chlv)}>" if (lev <= 3) - x << "#{space*1}</#{tags.docbook(2,@chlv)}>" if (lev <= 2) - x << "#{space*0}</#{tags.docbook(1)}>" if (lev <= 1) + x << "#{space*6}</#{tags.docbook(6)}>" if (lc <= 6) + x << "#{space*5}</#{tags.docbook(5)}>" if (lc <= 5) + x << "#{space*4}</#{tags.docbook(4,@chlv)}>" if (lc <= 4) + x << "#{space*3}</#{tags.docbook(3,@chlv)}>" if (lc <= 3) + x << "#{space*2}</#{tags.docbook(2,@chlv)}>" if (lc <= 2) + x << "#{space*1}</#{tags.docbook(1,@chlv)}>" if (lc <= 1) + x << "#{space*0}</#{tags.docbook(0)}>" if (lc <= 0) end x.join("\n") end diff --git a/lib/sisu/v5/xml_dom.rb b/lib/sisu/v5/xml_dom.rb index 6f0391f1..c8f3d881 100644 --- a/lib/sisu/v5/xml_dom.rb +++ b/lib/sisu/v5/xml_dom.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -190,11 +191,10 @@ WOK n=n1=n2=n3=0 if dob.is==:heading lv=dob.ln - n=dob.ln - 1 + n=dob.ln n1=dob.ln - n2=dob.ln + 1 - n3=dob.ln + 2 - dob.ln - 3 + n2=dob.ln + 2 + n3=dob.ln + 3 else lv=nil end tag=if defined? dob.name and dob.name=~/\S+/ @@ -373,7 +373,12 @@ WOK format_scroll=SiSU_XML_Format::FormatScroll.new(@md,dob) if dob.is==:para and dob.indent ##FIX x=SiSU_XML_Format::FormatSeg.new(@md,dob) if dob.is==:heading - if dob.ln==1 + if dob.ln==0 + type="heading_section_#{dob.ln.to_s}" + xml_markup(dob) + xml_structure(dob,type) + dob.obj=x.heading_body0 + elsif dob.ln==1 type="heading_section_#{dob.ln.to_s}" xml_markup(dob) xml_structure(dob,type) diff --git a/lib/sisu/v5/xml_fictionbook2.rb b/lib/sisu/v5/xml_fictionbook2.rb index 8ee2fb89..6549fa12 100644 --- a/lib/sisu/v5/xml_fictionbook2.rb +++ b/lib/sisu/v5/xml_fictionbook2.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -131,10 +132,11 @@ module SiSU_XML_Fictionbook def tags # collapsed --> def collapsed - %w[ 0 1 2 3 4 5 6 ] + %w[ 0 1 2 3 4 5 ] end def fictionbook - [ 'section', + [ + 'section', 'section', 'section', 'section', @@ -270,16 +272,16 @@ module SiSU_XML_Fictionbook </FictionBook> WOK end - def output(o,lev=nil,comment='') - puts lev == 0..6 \ - ? "#{space*lev}<#{lev}>[#{o.ocn}] #{o.ln} #{o.obj}</#{lev}>#{comment}" - : "<#{lev}>[#{o.ocn}] #{o.ln} #{o.obj}</#{lev}>#{comment}" + def output(o,comment='') + puts o.lc == 0..6 \ + ? "#{space*o.lc}<#{o.lc}>[#{o.ocn}] #{o.ln} #{o.obj}</#{o.lc}>#{comment}" + : "<#{o.lc}>[#{o.ocn}] #{o.ln} #{o.obj}</#{o.lc}>#{comment}" end def structure_collapsed(data) puts "\ncollapsed structure, heading outline --->\n\n" data.each_with_index do |o,i| if (o.is ==:heading || o.is ==:heading_insert) - output(o,o.lc) + output(o) end end end @@ -300,23 +302,19 @@ module SiSU_XML_Fictionbook data.each_with_index do |o,i| ocn=(defined? o.ocn and not o.ocn.nil?) ? "\n#{Dx[:ocn_o]}#{o.ocn}#{Dx[:ocn_c]}" : '' if o.is ==:heading - lev=o.lc - chlv=(o.lv.to_i == 1) \ - ? @chlv=o.lc.to_i - : 0 unless doc_position==:head - filename_fictionbook.puts structure_build_tag_close(lev,h) + filename_fictionbook.puts structure_build_tag_close(o.lc,h) end doc_position=:body_and_tail - filename_fictionbook.puts %{#{space*lev}<#{tags.fictionbook[lev]}> -#{space*lev}<title> + filename_fictionbook.puts %{#{space*o.lc}<#{tags.fictionbook[o.lc]}> +#{space*o.lc}<title> } - filename_fictionbook.puts SiSU_TextUtils::Wrap.new("<p>#{o.obj}#{ocn}</p>",80,(lev*2+2)).line_wrap - filename_fictionbook.puts %{#{space*lev}</title>} - h=lev + filename_fictionbook.puts SiSU_TextUtils::Wrap.new("<p>#{o.obj}#{ocn}</p>",80,(o.lc*2+2)).line_wrap + filename_fictionbook.puts %{#{space*o.lc}</title>} + h=o.lc elsif o.is ==:heading_insert \ and o.obj =~/Endnotes/ \ - and o.ln == 2 + and o.ln == 1 break elsif (o.of ==:para or o.of ==:block) filename_fictionbook.puts SiSU_TextUtils::Wrap.new("<p>#{o.obj}#{ocn}</p>",80,6).line_wrap @@ -327,36 +325,44 @@ module SiSU_XML_Fictionbook filename_fictionbook.puts tail(images_base64) filename_fictionbook.close end - def structure_build_tag_close(lev,h) + def structure_build_tag_close(lc,h) x=[] case h + when 0 + x << "#{space*0}</#{tags.fictionbook[0]}>" if (lc <= 0) when 1 - x << "#{space*1}</#{tags.fictionbook[1]}>" if (lev <= 1) + x << "#{space*1}</#{tags.fictionbook[1]}>" if (lc <= 1) + x << "#{space*0}</#{tags.fictionbook[0]}>" if (lc <= 0) when 2 - x << "#{space*2}</#{tags.fictionbook[2]}>" if (lev <= 2) - x << "#{space*1}</#{tags.fictionbook[1]}>" if (lev <= 1) + x << "#{space*2}</#{tags.fictionbook[2]}>" if (lc <= 2) + x << "#{space*1}</#{tags.fictionbook[1]}>" if (lc <= 1) + x << "#{space*0}</#{tags.fictionbook[0]}>" if (lc <= 0) when 3 - x << "#{space*3}</#{tags.fictionbook[3]}>" if (lev <= 3) - x << "#{space*2}</#{tags.fictionbook[2]}>" if (lev <= 2) - x << "#{space*1}</#{tags.fictionbook[1]}>" if (lev <= 1) + x << "#{space*3}</#{tags.fictionbook[3]}>" if (lc <= 3) + x << "#{space*2}</#{tags.fictionbook[2]}>" if (lc <= 2) + x << "#{space*1}</#{tags.fictionbook[1]}>" if (lc <= 1) + x << "#{space*0}</#{tags.fictionbook[0]}>" if (lc <= 0) when 4 - x << "#{space*4}</#{tags.fictionbook[4]}>" if (lev <= 4) - x << "#{space*3}</#{tags.fictionbook[3]}>" if (lev <= 3) - x << "#{space*2}</#{tags.fictionbook[2]}>" if (lev <= 2) - x << "#{space*1}</#{tags.fictionbook[1]}>" if (lev <= 1) + x << "#{space*4}</#{tags.fictionbook[4]}>" if (lc <= 4) + x << "#{space*3}</#{tags.fictionbook[3]}>" if (lc <= 3) + x << "#{space*2}</#{tags.fictionbook[2]}>" if (lc <= 2) + x << "#{space*1}</#{tags.fictionbook[1]}>" if (lc <= 1) + x << "#{space*0}</#{tags.fictionbook[0]}>" if (lc <= 0) when 5 - x << "#{space*5}</#{tags.fictionbook[5]}>" if (lev <= 5) - x << "#{space*4}</#{tags.fictionbook[4]}>" if (lev <= 4) - x << "#{space*3}</#{tags.fictionbook[3]}>" if (lev <= 3) - x << "#{space*2}</#{tags.fictionbook[2]}>" if (lev <= 2) - x << "#{space*1}</#{tags.fictionbook[1]}>" if (lev <= 1) + x << "#{space*5}</#{tags.fictionbook[5]}>" if (lc <= 5) + x << "#{space*4}</#{tags.fictionbook[4]}>" if (lc <= 4) + x << "#{space*3}</#{tags.fictionbook[3]}>" if (lc <= 3) + x << "#{space*2}</#{tags.fictionbook[2]}>" if (lc <= 2) + x << "#{space*1}</#{tags.fictionbook[1]}>" if (lc <= 1) + x << "#{space*0}</#{tags.fictionbook[0]}>" if (lc <= 0) when 6 - x << "#{space*6}</#{tags.fictionbook[6]}>" if (lev <= 6) - x << "#{space*5}</#{tags.fictionbook[5]}>" if (lev <= 5) - x << "#{space*4}</#{tags.fictionbook[4]}>" if (lev <= 4) - x << "#{space*3}</#{tags.fictionbook[3]}>" if (lev <= 3) - x << "#{space*2}</#{tags.fictionbook[2]}>" if (lev <= 2) - x << "#{space*1}</#{tags.fictionbook[1]}>" if (lev <= 1) + x << "#{space*6}</#{tags.fictionbook[6]}>" if (lc <= 6) + x << "#{space*5}</#{tags.fictionbook[5]}>" if (lc <= 5) + x << "#{space*4}</#{tags.fictionbook[4]}>" if (lc <= 4) + x << "#{space*3}</#{tags.fictionbook[3]}>" if (lc <= 3) + x << "#{space*2}</#{tags.fictionbook[2]}>" if (lc <= 2) + x << "#{space*1}</#{tags.fictionbook[1]}>" if (lc <= 1) + x << "#{space*0}</#{tags.fictionbook[0]}>" if (lc <= 0) end x.join("\n") end diff --git a/lib/sisu/v5/xml_format.rb b/lib/sisu/v5/xml_format.rb index 642096c0..7694f56b 100644 --- a/lib/sisu/v5/xml_format.rb +++ b/lib/sisu/v5/xml_format.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -297,30 +298,34 @@ WOK %{<p class="norm">#{@p_num.name}#{@headname}#{@dob.obj} </p>} + %{<p class="paranum"><font size="1" color="#777777"> #{@dob.ocn}</font></p>\n} end - def heading_body1 + def heading_body0 %{<h1 class="norm">#{@p_num.name}#{@headname}#{@dob.obj}</h1>} + %{<p class="paranum"><font size="1" color="#777777"> #{@dob.ocn}</font></p>\n} end - def heading_body2 + def heading_body1 %{<h2 class="norm">#{@p_num.name}#{@headname}#{@dob.obj}</h2>} + %{<p class="paranum"><font size="1" color="#777777"> #{@dob.ocn}</font></p>\n} end - def heading_body3 + def heading_body2 %{<h3 class="norm">#{@p_num.name}#{@headname}#{@dob.obj}</h3>} + %{<p class="paranum"><font size="1" color="#777777"> #{@dob.ocn}</font></p>\n} end - def heading_body4 + def heading_body3 %{<h4 class="norm">#{@p_num.name}#{@headname}#{@dob.obj}</h4>} + %{<p class="paranum"><font size="1" color="#777777"> #{@dob.ocn}</font></p>\n} end - def heading_body5 + def heading_body4 %{<h5 class="norm">#{@p_num.name}#{@headname}#{@dob.obj}</h5>} + %{<p class="paranum"><font size="1" color="#777777"> #{@dob.ocn}</font></p>\n} end - def heading_body6 + def heading_body5 %{<h6 class="norm">#{@p_num.name}#{@headname}#{@dob.obj}</h6>} + %{<p class="paranum"><font size="1" color="#777777"> #{@dob.ocn}</font></p>\n} end + def heading_body6 + %{<h7 class="norm">#{@p_num.name}#{@headname}#{@dob.obj}</h7>} + + %{<p class="paranum"><font size="1" color="#777777"> #{@dob.ocn}</font></p>\n} + end end class ParagraphNumber def initialize(md,ocn) @@ -1089,6 +1094,9 @@ WOK def heading_body heading_normal('p','norm') end + def heading_body0 + heading_normal('h1','norm') + end def heading_body1 heading_normal('h1','norm') end diff --git a/lib/sisu/v5/xml_md_oai_pmh_dc.rb b/lib/sisu/v5/xml_md_oai_pmh_dc.rb index e5857fb1..7ec83ff2 100644 --- a/lib/sisu/v5/xml_md_oai_pmh_dc.rb +++ b/lib/sisu/v5/xml_md_oai_pmh_dc.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/xml_odf_odt.rb b/lib/sisu/v5/xml_odf_odt.rb index e7389110..a6a7a127 100644 --- a/lib/sisu/v5/xml_odf_odt.rb +++ b/lib/sisu/v5/xml_odf_odt.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/xml_odf_odt_format.rb b/lib/sisu/v5/xml_odf_odt_format.rb index 27628e82..2a092011 100644 --- a/lib/sisu/v5/xml_odf_odt_format.rb +++ b/lib/sisu/v5/xml_odf_odt_format.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -179,21 +180,21 @@ module SiSU_XML_ODF_ODT_Format ? 1 : 2 alpha=case @dob.cols - when 1; 'A' - when 2; 'B' - when 3; 'C' - when 4; 'D' - when 5; 'E' - when 6; 'F' - when 7; 'G' - when 8; 'H' - when 9; 'I' - when 10; 'J' - when 11; 'K' - when 12; 'L' - when 13; 'M' - when 14; 'N' - else 'D' + when 1 then 'A' + when 2 then 'B' + when 3 then 'C' + when 4 then 'D' + when 5 then 'E' + when 6 then 'F' + when 7 then 'G' + when 8 then 'H' + when 9 then 'I' + when 10 then 'J' + when 11 then 'K' + when 12 then 'L' + when 13 then 'M' + when 14 then 'N' + else 'D' end tag=SiSU_XML_ODF_ODT_Format::Tags.new.set_bookmark_tag(@dob) %{<table:table table:name="Table#{count}" table:style-name="Table#{type}">#{@p_num[:set_ref]}#{tag}#{break_line}} + diff --git a/lib/sisu/v5/xml_sax.rb b/lib/sisu/v5/xml_sax.rb index aa701822..1554056b 100644 --- a/lib/sisu/v5/xml_sax.rb +++ b/lib/sisu/v5/xml_sax.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -341,12 +342,12 @@ WOK if dob.is==:heading xml_structure(dob) dob.obj=case dob.ln - when 1; x.heading_body1 - when 2; x.heading_body2 - when 3; x.heading_body3 - when 4; x.heading_body4 - when 5; x.heading_body5 - when 6; x.heading_body6 + when 1 then x.heading_body1 + when 2 then x.heading_body2 + when 3 then x.heading_body3 + when 4 then x.heading_body4 + when 5 then x.heading_body5 + when 6 then x.heading_body6 end else if dob.is==:verse diff --git a/lib/sisu/v5/xml_scaffold_structure_collapsed.rb b/lib/sisu/v5/xml_scaffold_structure_collapsed.rb index 9a095f4b..b6430159 100644 --- a/lib/sisu/v5/xml_scaffold_structure_collapsed.rb +++ b/lib/sisu/v5/xml_scaffold_structure_collapsed.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/xml_scaffold_structure_sisu.rb b/lib/sisu/v5/xml_scaffold_structure_sisu.rb index 2848187f..5e2afa4d 100644 --- a/lib/sisu/v5/xml_scaffold_structure_sisu.rb +++ b/lib/sisu/v5/xml_scaffold_structure_sisu.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/xml_shared.rb b/lib/sisu/v5/xml_shared.rb index a6092559..fc972833 100644 --- a/lib/sisu/v5/xml_shared.rb +++ b/lib/sisu/v5/xml_shared.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/xml_tables.rb b/lib/sisu/v5/xml_tables.rb index 9cbf259b..4ae41190 100644 --- a/lib/sisu/v5/xml_tables.rb +++ b/lib/sisu/v5/xml_tables.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v5/zap.rb b/lib/sisu/v5/zap.rb index 908d33d1..85f023a0 100644 --- a/lib/sisu/v5/zap.rb +++ b/lib/sisu/v5/zap.rb @@ -8,7 +8,8 @@ * 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. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: |