diff options
-rw-r--r-- | data/doc/sisu/CHANGELOG_v4 | 9 | ||||
-rw-r--r-- | data/doc/sisu/CHANGELOG_v5 | 9 | ||||
-rw-r--r-- | data/sisu/v4/v/version.yml | 6 | ||||
-rw-r--r-- | data/sisu/v5/v/version.yml | 6 | ||||
-rw-r--r-- | lib/sisu/v5/constants.rb | 31 | ||||
-rw-r--r-- | lib/sisu/v5/dal_doc_str.rb | 12 | ||||
-rw-r--r-- | lib/sisu/v5/hub.rb | 10 | ||||
-rw-r--r-- | lib/sisu/v5/manifest.rb | 14 | ||||
-rw-r--r-- | lib/sisu/v5/options.rb | 14 | ||||
-rw-r--r-- | lib/sisu/v5/sysenv.rb | 146 | ||||
-rw-r--r-- | lib/sisu/v5/urls.rb | 16 | ||||
-rw-r--r-- | lib/sisu/v5/xml_scaffold_structure_collapsed.rb | 202 | ||||
-rw-r--r-- | lib/sisu/v5/xml_scaffold_structure_sisu.rb (renamed from lib/sisu/v5/xml_scaffold.rb) | 131 |
13 files changed, 512 insertions, 94 deletions
diff --git a/data/doc/sisu/CHANGELOG_v4 b/data/doc/sisu/CHANGELOG_v4 index c81106e5..dcf40f63 100644 --- a/data/doc/sisu/CHANGELOG_v4 +++ b/data/doc/sisu/CHANGELOG_v4 @@ -23,6 +23,15 @@ v2 branch is removed; it is available in sisu =< 3.3.2 %% Reverse Chronological: +%% 4.2.11.orig.tar.xz (2013-11-05:44/2) +http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_4.2.11 +http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_4.2.11-1 +http://www.jus.uio.no/sisu/pkg/src/sisu_4.2.11.orig.tar.xz + sisu_4.2.11.orig.tar.xz + sisu_4.2.11-1.dsc + +[5.0.24 changes only] + %% 4.2.10.orig.tar.xz (2013-11-02:43/6) http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_4.2.10 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_4.2.10-1 diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5 index b79254bc..56ca73be 100644 --- a/data/doc/sisu/CHANGELOG_v5 +++ b/data/doc/sisu/CHANGELOG_v5 @@ -23,6 +23,15 @@ v2 branch is removed; it is available in sisu =< 3.3.2 %% Reverse Chronological: +%% 5.0.24.orig.tar.xz (2013-11-05:44/2) +http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_5.0.24 +http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_5.0.24-1 +http://www.jus.uio.no/sisu/pkg/src/sisu_5.0.24.orig.tar.xz + sisu_5.0.24.orig.tar.xz + sisu_5.0.24-1.dsc + +* xml, scaffold, re-activated, split into sisu structure & collapsed structure + %% 5.0.23.orig.tar.xz (2013-11-02:43/6) http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_5.0.23 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_5.0.23-1 diff --git a/data/sisu/v4/v/version.yml b/data/sisu/v4/v/version.yml index 77eee8b8..d010c88f 100644 --- a/data/sisu/v4/v/version.yml +++ b/data/sisu/v4/v/version.yml @@ -1,5 +1,5 @@ --- -:version: 4.2.10 -:date_stamp: 2013w43/6 -:date: "2013-11-02" +:version: 4.2.11 +:date_stamp: 2013w44/2 +:date: "2013-11-05" :project: SiSU diff --git a/data/sisu/v5/v/version.yml b/data/sisu/v5/v/version.yml index c738413a..39bc4b65 100644 --- a/data/sisu/v5/v/version.yml +++ b/data/sisu/v5/v/version.yml @@ -1,5 +1,5 @@ --- -:version: 5.0.23 -:date_stamp: 2013w43/6 -:date: "2013-11-02" +:version: 5.0.24 +:date_stamp: 2013w44/2 +:date: "2013-11-05" :project: SiSU diff --git a/lib/sisu/v5/constants.rb b/lib/sisu/v5/constants.rb index 26130506..a21f01b7 100644 --- a/lib/sisu/v5/constants.rb +++ b/lib/sisu/v5/constants.rb @@ -63,20 +63,23 @@ #Ax,Xx,Mx,Rx,Hx,Dx,Px,Ep,Db,Gt,Tex=Array.new(11){{}} YEAR='2013' Sfx={ - txt: '.txt', - html: '.html', - xhtml: '.xhtml', - xml: '.xml', - xml_sax: '.sax.xml', - xml_dom: '.dom.xml', - epub: '.epub', - epub_xhtml: '.xhtml', - odt: '.odt', - pdf: '.pdf', - manpage: '.1', - info: '.info', - texinfo: '.texinfo', - sql: '.sql.db', + txt: '.txt', + html: '.html', + xhtml: '.xhtml', + xml: '.xml', + xml_sax: '.sax.xml', + xml_dom: '.dom.xml', + xml_scaffold: '.scaffold.xml', + xml_scaffold_structure_sisu: '.scaffold.sisu.xml', + xml_scaffold_structure_collapse: '.scaffold.collapse.xml', + epub: '.epub', + epub_xhtml: '.xhtml', + odt: '.odt', + pdf: '.pdf', + manpage: '.1', + info: '.info', + texinfo: '.texinfo', + sql: '.sql.db', } Ax={ tab: "\t", diff --git a/lib/sisu/v5/dal_doc_str.rb b/lib/sisu/v5/dal_doc_str.rb index 409c28ab..203bc988 100644 --- a/lib/sisu/v5/dal_doc_str.rb +++ b/lib/sisu/v5/dal_doc_str.rb @@ -690,24 +690,24 @@ module SiSU_DAL_DocumentStructureExtract end if @md.flag_endnotes tuned_file << @pb - h={ ln: 2, obj: 'Endnotes', autonum_: false } + h={ ln: 2, lc: 2, obj: 'Endnotes', autonum_: false } tuned_file << SiSU_DAL_DocumentStructure::ObjectHeading.new.heading_insert(h) - h={ ln: 4, obj: 'Endnotes', name: 'endnotes', autonum_: false } + h={ ln: 4, lc: 3, obj: 'Endnotes', name: 'endnotes', autonum_: false } tuned_file << SiSU_DAL_DocumentStructure::ObjectHeading.new.heading_insert(h) h={ obj: 'Endnotes' } end if @md.book_idx tuned_file << @pb - h={ ln: 2, obj: 'Index', autonum_: false } + h={ ln: 2, lc: 2, obj: 'Index', autonum_: false } tuned_file << SiSU_DAL_DocumentStructure::ObjectHeading.new.heading_insert(h) - h={ ln: 4, obj: 'Index', name: 'book_index', autonum_: false } + h={ ln: 4, lc: 3, obj: 'Index', name: 'book_index', autonum_: false } tuned_file << SiSU_DAL_DocumentStructure::ObjectHeading.new.heading_insert(h) h={ obj: 'Index' } end tuned_file << @pb - h={ ln: 2, obj: 'Metadata', autonum_: false, ocn_: false } + h={ ln: 2, lc: 2, obj: 'Metadata', autonum_: false, ocn_: false } tuned_file << SiSU_DAL_DocumentStructure::ObjectHeading.new.heading_insert(h) - h={ ln: 4, obj: 'SiSU Metadata, document information', name: 'metadata', autonum_: false, ocn_: false } + h={ ln: 4, lc: 3, obj: 'SiSU Metadata, document information', name: 'metadata', autonum_: false, ocn_: false } tuned_file << SiSU_DAL_DocumentStructure::ObjectHeading.new.heading_insert(h) h={ obj: 'eof' } meta=SiSU_DAL_DocumentStructure::ObjectMetadata.new.metadata(@metadata) diff --git a/lib/sisu/v5/hub.rb b/lib/sisu/v5/hub.rb index 6893e2ad..2e9092ff 100644 --- a/lib/sisu/v5/hub.rb +++ b/lib/sisu/v5/hub.rb @@ -331,6 +331,14 @@ module SiSU require_relative 'xhtml' # xhtml.rb SiSU_XHTML::Source.new(@opt).read end + if @opt.act[:xml_scaffold_structure_sisu][:set]==:on #% --xml-scaffold --xml-scaffold-sisu + require_relative 'xml_scaffold_structure_sisu' # xml_scaffold_structure_sisu.rb + SiSU_XML_Scaffold_Structure_Sisu::Source.new(@opt).read + end + if @opt.act[:xml_scaffold_structure_collapse][:set]==:on #% --xml-scaffold-collapse + require_relative 'xml_scaffold_structure_collapsed' # xml_scaffold_structure_collapsed.rb + SiSU_XML_Scaffold_Structure_Collapse::Source.new(@opt).read + end if @opt.act[:xml_sax][:set]==:on #% --xml-sax, -x xml sax type require_relative 'xml' # xml.rb SiSU_XML_SAX::Source.new(@opt).read @@ -633,6 +641,8 @@ module SiSU || @opt.act[:odt][:set]==:on \ || @opt.act[:xml_sax][:set]==:on \ || @opt.act[:xml_dom][:set]==:on \ + || @opt.act[:xml_scaffold_structure_sisu][:set]==:on \ + || @opt.act[:xml_scaffold_structure_collapse][:set]==:on \ || @opt.act[:pdf][:set]==:on \ || @opt.act[:pdf_p][:set]==:on \ || @opt.act[:pdf_l][:set]==:on \ diff --git a/lib/sisu/v5/manifest.rb b/lib/sisu/v5/manifest.rb index 3d6a5835..fc4bd5b9 100644 --- a/lib/sisu/v5/manifest.rb +++ b/lib/sisu/v5/manifest.rb @@ -396,6 +396,20 @@ module SiSU_Manifest id,file='XML DOM',@f.base_filename.xml_dom summarize(id,file,pth,rel,url) end + if FileTest.file?(@f.place_file.xml_scaffold_structure_sisu.dir)==true + pth=@f.output_path.xml_scaffold_structure_sisu.dir + rel=@f.output_path.xml_scaffold_structure_sisu.rel_sm + url=@f.output_path.xml_scaffold_structure_sisu.url + id,file='XML Scaffold sisu structure',@f.base_filename.xml_scaffold_structure_sisu + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.xml_scaffold_structure_collapse.dir)==true + pth=@f.output_path.xml_scaffold_structure_collapse.dir + rel=@f.output_path.xml_scaffold_structure_collapse.rel_sm + url=@f.output_path.xml_scaffold_structure_collapse.url + id,file='XML Scaffold collapsed structure',@f.base_filename.xml_scaffold_structure_collapse + summarize(id,file,pth,rel,url) + end if FileTest.file?(@f.place_file.info.dir)==true pth=@f.output_path.texinfo.dir rel=@f.output_path.texinfo.rel_sm diff --git a/lib/sisu/v5/options.rb b/lib/sisu/v5/options.rb index 5bf851e3..7203f8b2 100644 --- a/lib/sisu/v5/options.rb +++ b/lib/sisu/v5/options.rb @@ -861,6 +861,12 @@ module SiSU_Commandline || mod.inspect =~/"--xml-dom"/) \ ? { bool: true, set: :on } : { bool: false, set: :na } + act[:xml_scaffold_structure_sisu]=mod.inspect =~/"--xml-scaffold"|"--xml-scaffold-sisu"/ \ + ? { bool: true, set: :on } + : { bool: false, set: :na } + act[:xml_scaffold_structure_collapse]=mod.inspect =~/"--xml-scaffold-collapse"/ \ + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:xhtml]=(cmd =~/b/ \ || mod.inspect =~/"--xhtml"/) \ ? { bool: true, set: :on } @@ -979,7 +985,9 @@ module SiSU_Commandline || act[:sisupod][:set]==:on \ || act[:concordance][:set]==:on \ || act[:xml_dom][:set]==:on \ - || act[:xml_sax][:set]==:on ) + || act[:xml_sax][:set]==:on \ + || act[:xml_scaffold_structure_sisu][:set]==:on \ + || act[:xml_scaffold_structure_collapse][:set]==:on ) { bool: true, set: :on } #if cmd !~/[mn]/ # extra+=if cmd =~/[abegHhIiLNOoPpQTtwXxyz]/ \ @@ -1021,7 +1029,9 @@ module SiSU_Commandline || act[:sisupod][:set]==:on \ || act[:concordance][:set]==:on \ || act[:xml_dom][:set]==:on \ - || act[:xml_sax][:set]==:on ) + || act[:xml_sax][:set]==:on \ + || act[:xml_scaffold_structure_sisu][:set]==:on \ + || act[:xml_scaffold_structure_collapse][:set]==:on ) { bool: true, set: :on } ## if cmd !~/y/ ## extra+=if cmd =~/[abeHhIiNopQSstwXxz]/ \ diff --git a/lib/sisu/v5/sysenv.rb b/lib/sisu/v5/sysenv.rb index f1076c68..d4079f8c 100644 --- a/lib/sisu/v5/sysenv.rb +++ b/lib/sisu/v5/sysenv.rb @@ -1478,6 +1478,12 @@ module SiSU_Env ? @rc['odt']['ocn'] : true end + def xml_scaffold_ocn? + ((defined? @rc['xml_scaffold']['ocn']) \ + && @rc['xml_scaffold']['ocn']==false) \ + ? @rc['xml_scaffold']['ocn'] + : true + end def plaintext_ocn? ((defined? @rc['plaintext']['ocn']) \ && @rc['plaintext']['ocn']==false) \ @@ -3019,6 +3025,12 @@ WOK if @md.opt.act[:xml_dom][:set]==:on #% --xml-dom, -X xml dom type ft << @md.fn[:dom] end + if @md.opt.act[:xml_scaffold_structure_sisu][:set]==:on #% --xml-scaffold --xml-scaffold-sisu + ft << @md.fn[:xml_scaffold_structure_sisu] + end + if @md.opt.act[:xml_scaffold_structure_collapse][:set]==:on #% --xml-scaffold-collapse + ft << @md.fn[:xml_scaffold_structure_collapse] + end @fnb=@md.fnb else # still needed where/when param is not parsed if @opt.act[:html][:set]==:on #% --html, -h -H @@ -3063,6 +3075,12 @@ WOK if @opt.act[:xml_dom][:set]==:on #% --xml-dom, -X xml dom type ft << 'dom.xml' << '??.dom.xml' << 'dom.??.xml' end + if @opt.act[:xml_scaffold_structure_sisu][:set]==:on #% --xml-scaffold --xml-scaffold-sisu + ft << 'scaffold.xml' << '??.scaffold.xml' << 'scaffold.??.xml' + end + if @opt.act[:xml_scaffold_structure_collapse][:set]==:on #% --xml-scaffold-collapse + ft << 'scaffold.xml' << '??.scaffold.xml' << 'scaffold.??.xml' + end end ft=ft.uniq filetypes=ft.join(',') @@ -3154,6 +3172,8 @@ WOK deletion(f.place_file.xhtml.dir) deletion(f.place_file.xml_sax.dir) deletion(f.place_file.xml_dom.dir) + deletion(f.place_file.xml_scaffold_structure_sisu.dir) + deletion(f.place_file.xml_scaffold_structure_collapse.dir) deletion(f.place_file.info.dir) deletion(f.place_file.manpage.dir) deletion(f.place_file.sqlite_discrete.dir) @@ -3413,6 +3433,16 @@ WOK && FileTest.file?(f.place_file.xml_dom.dir) inp << f.place_file.xml_dom.rel end + if (@opt.act[:xml_scaffold_structure_sisu][:set]==:on \ + || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ + && FileTest.file?(f.place_file.xml_scaffold_structure_sisu.dir) + inp << f.place_file.xml_scaffold_structure_sisu.rel + end + if (@opt.act[:xml_scaffold_structure_collapse][:set]==:on \ + || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ + && FileTest.file?(f.place_file.xml_scaffold_structure_collapse.dir) + inp << f.place_file.xml_scaffold_structure_collapse.rel + end if (@opt.act[:txt][:set]==:on \ || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ && FileTest.file?(f.place_file.txt.dir) @@ -4385,6 +4415,18 @@ WOK fn=base_filename.xml_dom make_file(path,fn) end + def xml_scaffold_structure_sisu + path=output_path.xml_scaffold_structure_sisu.dir + make_path(path) + fn=base_filename.xml_scaffold_structure_sisu + make_file(path,fn) + end + def xml_scaffold_structure_collapse + path=output_path.xml_scaffold_structure_collapse.dir + make_path(path) + fn=base_filename.xml_scaffold_structure_collapse + make_file(path,fn) + end def manpage path=output_path.manpage.dir make_path(path) @@ -4547,6 +4589,24 @@ WOK end self end + def xml_scaffold_structure_sisu + def dir + output_path.xml.dir + '/' + base_filename.xml_scaffold_structure_sisu + end + def rel + output_path.xml.rel + '/' + base_filename.xml_scaffold_structure_sisu + end + self + end + def xml_scaffold_structure_collapse + def dir + output_path.xml.dir + '/' + base_filename.xml_scaffold_structure_collapse + end + def rel + output_path.xml.rel + '/' + base_filename.xml_scaffold_structure_collapse + end + self + end def sqlite_discrete def dir output_path.sqlite_discrete.dir + '/' + base_filename.sqlite_discrete @@ -4892,6 +4952,42 @@ WOK end i18n(fnh) end + def xml_scaffold_structure_sisu(fh=nil) + fh=default_hash_build(fh,Sfx[:xml_scaffold_structure_sisu]) + fh[:lng]=lang_code?(fh[:lng]) + fnh=if output_dir_structure.by_filename? + { + fn: 'scroll', + ft: fh[:ft], + lng: fh[:lng], + } + else + { + fn: fh[:fn], + ft: fh[:ft], + lng: fh[:lng], + } + end + i18n(fnh) + end + def xml_scaffold_structure_collapse(fh=nil) + fh=default_hash_build(fh,Sfx[:xml_scaffold_structure_collapse]) + fh[:lng]=lang_code?(fh[:lng]) + fnh=if output_dir_structure.by_filename? + { + fn: 'scroll', + ft: fh[:ft], + lng: fh[:lng], + } + else + { + fn: fh[:fn], + ft: fh[:ft], + lng: fh[:lng], + } + end + i18n(fnh) + end def pdf_p(fh=nil) fh=default_hash_build(fh,Sfx[:pdf]) fh[:lng]=lang_code?(fh[:lng]) @@ -5663,6 +5759,56 @@ WOK xml self end + def xml_scaffold_structure_sisu + def ft + 'sisu.scaffold.xml' + #'xml' + end + def dir + set_path(ft).dir.abc + end + def url + set_path(ft).url.abc + end + def rel + set_path(ft).rel.abc + end + def rcp + set_path(ft).rcp.abc + end + def rel_sm + set_path(ft).rel_sm.ab + end + def rel_image + '../../_sisu/image' + end + self + end + def xml_scaffold_structure_collapse + def ft + 'collapsed.scaffold.xml' + #'xml' + end + def dir + set_path(ft).dir.abc + end + def url + set_path(ft).url.abc + end + def rel + set_path(ft).rel.abc + end + def rcp + set_path(ft).rcp.abc + end + def rel_sm + set_path(ft).rel_sm.ab + end + def rel_image + '../../_sisu/image' + end + self + end def pdf def ft 'pdf' diff --git a/lib/sisu/v5/urls.rb b/lib/sisu/v5/urls.rb index 9f8c9a75..a7b53985 100644 --- a/lib/sisu/v5/urls.rb +++ b/lib/sisu/v5/urls.rb @@ -116,6 +116,8 @@ module SiSU_Urls 't --txt (Plain-text (endnotes))'=>@fn[:plain], 'x --xml-sax (XML sax type)'=>@fn[:sax], 'X --xml-dom (XML dom type)'=>@fn[:dom], + ' --xml-scaffold-sisu (XML scaffold)'=>@fn[:xml_scaffold_structure_sisu], + ' --xml-scaffold-collapse (XML scaffold)'=>@fn[:xml_scaffold_structure_collapse], 'Q --qrcode (QR Code jpg)'=>@fn[:qrcode], 'y --manifest (Manifest, html)'=>@fn[:manifest], 'Y (Sitemap, xml)'=>@fn[:sitemap], @@ -209,6 +211,12 @@ module SiSU_Urls def dom(x) SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.xml_dom.dir}/#{@md.file.base_filename.xml_dom}").result end + def scaffold_structure_sisu(x) + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.xml_scaffold_structure_sisu.dir}/#{@md.file.base_filename.xml_scaffold_structure_sisu}").result + end + def scaffold_structure_collapse(x) + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.xml_scaffold_structure_collapse.dir}/#{@md.file.base_filename.xml_scaffold_structure_collapse}").result + end def sitemap(x) #BROKEN SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.sitemaps.dir}/#{@md.file.base_filename.sitemap}").result end @@ -398,6 +406,14 @@ module SiSU_Urls and @opt.act[:xml_sax][:set]==:on show.xml.sax(x) end + if x=~/--xml-scaffold-sisu\b/ \ + and @opt.act[:xml_scaffold_structure_sisu][:set]==:on + show.xml.scaffold_structure_sisu(x) + end + if x=~/--xml-scaffold-collapse\b/ \ + and @opt.act[:xml_scaffold_structure_collapse][:set]==:on + show.xml.scaffold_structure_collapse(x) + end if x=~/--qrcode\b/ \ and @opt.act[:qrcode][:set]==:on show.qrcode(x) diff --git a/lib/sisu/v5/xml_scaffold_structure_collapsed.rb b/lib/sisu/v5/xml_scaffold_structure_collapsed.rb new file mode 100644 index 00000000..a90207ff --- /dev/null +++ b/lib/sisu/v5/xml_scaffold_structure_collapsed.rb @@ -0,0 +1,202 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008, 2009, 2010, 2011, 2012, 2013 Ralph Amissah, All Rights Reserved. + + * License: GPL 3 or later: + + SiSU, a framework for document structuring, publishing and search + + Copyright (C) Ralph Amissah + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program. If not, see <http://www.gnu.org/licenses/>. + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + <http://www.fsf.org/licensing/licenses/gpl.html> + <http://www.gnu.org/licenses/gpl.html> + + <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + <http://www.jus.uio.no/sisu> + <http://www.sisudoc.org> + + * Download: + <http://www.sisudoc.org/sisu/en/SiSU/download.html> + + * Git + <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/xml_scaffold.rb;hb=HEAD> + + * Ralph Amissah + <ralph@amissah.com> + <ralph.amissah@gmail.com> + + ** Description: extract and print an XML rendition of document structure to screen + +=end +module SiSU_XML_Scaffold_Structure_Collapse + require_relative 'particulars' # particulars.rb + include SiSU_Particulars + require_relative 'dal' # dal.rb + require_relative 'sysenv' # sysenv.rb + include SiSU_Env + class Source + def initialize(opt) + @opt=opt + @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt) + @sp=' ' + end + def read + begin + @md,@dal_array=@particulars.md,@particulars.dal_array + SiSU_XML_Scaffold_Structure_Collapse::Source::Scroll.new(@dal_array,@md).songsheet + rescue + SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do + __LINE__.to_s + ':' + __FILE__ + end + ensure + end + end + private + class Scroll <Source + def initialize(data='',md='') + @data,@md=data,md + @sp=' ' + end + def songsheet + @t='sisu' + data=@data + if @md.opt.act[:verbose_plus][:set]==:on + structure_collapsed(data) + end + structure_build_collapsed(data) + end + def tags + # collapsed --> + def collapsed + [ '0', + '1', + '2', + '3', + '4', + '5', + '6' + ] + end + def docbook + end + def fictionbook + end + self + end + def output(o,lev=nil,comment='') + puts lev == 0..6 \ + ? "#{@sp*lev}<#{lev}>[#{o.ocn}] #{o.ln} #{o.obj}</#{lev}>#{comment}" + : "<#{lev}>[#{o.ocn}] #{o.ln} #{o.obj}</#{lev}>#{comment}" + end + def structure_collapsed(data) + puts "\ncollapsed structure, heading outline --->\n\n" + data.each_with_index do |o,i| + if (o.is ==:heading || o.is ==:heading_insert) + output(o,o.lc) + end + end + end + def structure_build_collapsed(data) + @s=tags.collapsed + puts "\nXML [#{@t} type] structure outline --->\n\n" + h=[0,false,false,false] + puts "<#{@s[0]}>" + data.each_with_index do |o,i| + if (o.is ==:heading || o.is ==:heading_insert) + lev=o.lc + structure_build_tag_close(lev,h) + puts "#{@sp*lev}<#{@s[lev]}>\n#{@sp*lev} [#{o.ocn}] #{lev} {#{o.node}}" + h[0]=lev + end + end + structure_build_tag_close(0,h) + end + def structure_build_tag_close(lev,h) + case h[0] + when 1 + puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) + puts "</#{@s[0]}>" if (lev==0) + when 2 + puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) + puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) + puts "</#{@s[0]}>" if (lev==0) + when 3 + puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) + puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) + puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) + puts "</#{@s[0]}>" if (lev==0) + when 4 + puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4) + puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) + puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) + puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) + puts "</#{@s[0]}>" if (lev==0) + when 5 + puts "#{@sp*5}</#{@s[5]}>" if (lev <= 5) + puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4) + puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) + puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) + puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) + puts "</#{@s[0]}>" if (lev==0) + when 6 + puts "#{@sp*6}</#{@s[6]}>" if (lev <= 6) + puts "#{@sp*5}</#{@s[5]}>" if (lev <= 5) + puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4) + puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) + puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) + puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) + puts "</#{@s[0]}>" if (lev==0) + end + end + end + end +end +__END__ +@s=['0', + 'A', + 'B', + 'C', + '1', + '2', + '3' +] +#@t='docbook' #@t='fictionbook' +#@s=['book', #@s=['body', +# 'part', # 'section', +# 'subpart N/A', # 'section', +# 'sub-subpart N/A', # 'section', +# 'chapter', # 'section', +# 'sect1', # 'section', +# 'sect2' # 'section' +#] #] diff --git a/lib/sisu/v5/xml_scaffold.rb b/lib/sisu/v5/xml_scaffold_structure_sisu.rb index 10a1aee8..64173566 100644 --- a/lib/sisu/v5/xml_scaffold.rb +++ b/lib/sisu/v5/xml_scaffold_structure_sisu.rb @@ -59,7 +59,7 @@ ** Description: extract and print an XML rendition of document structure to screen =end -module SiSU_XML_Scaffold +module SiSU_XML_Scaffold_Structure_Sisu require_relative 'particulars' # particulars.rb include SiSU_Particulars require_relative 'dal' # dal.rb @@ -74,7 +74,7 @@ module SiSU_XML_Scaffold def read begin @md,@dal_array=@particulars.md,@particulars.dal_array - SiSU_XML_Scaffold::Source::Scroll.new(@dal_array,@md).songsheet + SiSU_XML_Scaffold_Structure_Sisu::Source::Scroll.new(@dal_array,@md).songsheet rescue SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do __LINE__.to_s + ':' + __FILE__ @@ -90,74 +90,56 @@ module SiSU_XML_Scaffold end def songsheet @t='sisu' - @s=['0', - 'A', - 'B', - 'C', - '1', - '2', - '3' - ] - #@t='docbook' #@t='fictionbook' - #@s=['book', #@s=['body', - # 'part', # 'section', - # 'subpart N/A', # 'section', - # 'sub-subpart N/A', # 'section', - # 'chapter', # 'section', - # 'sect1', # 'section', - # 'sect2' # 'section' - #] #] data=@data if @md.opt.act[:verbose_plus][:set]==:on - structure_outline(data) - structure_simple(data) + structure_sisu_simple(data) end - structure_build(data) + structure_build_sisu(data) end - def structure_outline(data) - puts "\ninfo outline --->\n\n" - data.each do |o| - puts "#{o.ocn} #{o.ln} #{o.obj}" if (o.is ==:heading || o.is ==:heading_insert) + def tags + def sisu + [ '0', + 'A', + 'B', + 'C', + '1', + '2', + '3' + ] end + self end - def structure_simple(data) - puts "\nheading outline --->\n\n" + def structure_sisu_simple(data) + puts "\nsisu structure, heading outline --->\n\n" data.each_with_index do |o,i| - if (o.is ==:heading || o.is ==:heading_insert); puts "<#{@s[o.ln]}>#{o.ocn} #{o.ln} #{o.obj}</#{@s[o.ln]}>" + if (o.is ==:heading || o.is ==:heading_insert) + puts "#{@sp*o.ln}<#{tags.sisu[o.ln]}>[#{o.ocn}] #{o.ln} #{o.obj}</#{tags.sisu[o.ln]}>" end end end - def structure_build(data) + def output(o,lev=nil,comment='') + puts lev == 0..6 \ + ? "#{@sp*lev}<#{lev}>[#{o.ocn}] #{o.ln} #{o.obj}</#{lev}>#{comment}" + : "<#{lev}>[#{o.ocn}] #{o.ln} #{o.obj}</#{lev}>#{comment}" + end + def structure_build_sisu(data) + @s=tags.sisu puts "\nXML [#{@t} type] structure outline --->\n\n" h=[0,false,false,false] puts "<#{@s[0]}>" data.each_with_index do |o,i| if (o.is ==:heading || o.is ==:heading_insert) + structure_build_tag_close(o.ln,h) + puts "#{@sp*o.ln}<#{@s[o.ln]}>\n#{@sp*o.ln} [#{o.ocn}] #{o.ln} {#{o.node}}" case o.ln when 1 - structure_build_tag_close(o.ln,h) - puts "#{@sp*1}<#{@s[1]}>\n#{@sp*1} #{o.ocn} #{o.ln} #{o.node}" - h=[1,true,false,false] + h=[o.ln,true,false,false] when 2 - structure_build_tag_close(o.ln,h) - puts "#{@sp*2}<#{@s[2]}>\n#{@sp*2} #{o.ocn} #{o.ln} #{o.node}" - h=[2,true,true,false] + h=[o.ln,true,true,false] when 3 - structure_build_tag_close(o.ln,h) - puts "#{@sp*3}<#{@s[3]}>\n#{@sp*3} #{o.ocn} #{o.ln} #{o.node}" - h=[3,true,true,true] - when 4 - structure_build_tag_close(o.ln,h) - puts "#{@sp*4}<#{@s[4]}>\n#{@sp*4} #{o.ocn} #{o.ln} #{o.node}" - h[0]=4 - when 5 - structure_build_tag_close(o.ln,h) - puts "#{@sp*5}<#{@s[5]}>\n#{@sp*5} #{o.ocn} #{o.ln} #{o.node}" - h[0]=5 - when 6 - structure_build_tag_close(o.ln,h) - puts "#{@sp*6}<#{@s[6]}>\n#{@sp*6} #{o.ocn} #{o.ln} #{o.node}" - h[0]=6 + h=[o.ln,true,true,true] + when 4..6 + h[0]=o.ln end end end @@ -166,37 +148,37 @@ module SiSU_XML_Scaffold def structure_build_tag_close(lev,h) case h[0] when 1 - puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and h[1] + puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) && h[1] puts "</#{@s[0]}>" if (lev==0) when 2 - puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and h[2] - puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and h[1] + puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) && h[2] + puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) && h[1] puts "</#{@s[0]}>" if (lev==0) when 3 - puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) and h[3] - puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and h[2] - puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and h[1] + puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) && h[3] + puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) && h[2] + puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) && h[1] puts "</#{@s[0]}>" if (lev==0) when 4 puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4) - puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) and h[3] - puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and h[2] - puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and h[1] + puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) && h[3] + puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) && h[2] + puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) && h[1] puts "</#{@s[0]}>" if (lev==0) when 5 puts "#{@sp*5}</#{@s[5]}>" if (lev <= 5) puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4) - puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) and h[3] - puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and h[2] - puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and h[1] + puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) && h[3] + puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) && h[2] + puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) && h[1] puts "</#{@s[0]}>" if (lev==0) when 6 puts "#{@sp*6}</#{@s[6]}>" if (lev <= 6) puts "#{@sp*5}</#{@s[5]}>" if (lev <= 5) puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4) - puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) and h[3] - puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and h[2] - puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and h[1] + puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) && h[3] + puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) && h[2] + puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) && h[1] puts "</#{@s[0]}>" if (lev==0) end end @@ -204,3 +186,20 @@ module SiSU_XML_Scaffold end end __END__ +@s=['0', + 'A', + 'B', + 'C', + '1', + '2', + '3' +] +#@t='docbook' #@t='fictionbook' +#@s=['book', #@s=['body', +# 'part', # 'section', +# 'subpart N/A', # 'section', +# 'sub-subpart N/A', # 'section', +# 'chapter', # 'section', +# 'sect1', # 'section', +# 'sect2' # 'section' +#] #] |