Merge tag 'sisu_6.5.0' into debian/sid
authorRalph Amissah <ralph@amissah.com>
Fri, 1 May 2015 22:51:40 +0000 (18:51 -0400)
committerRalph Amissah <ralph@amissah.com>
Fri, 1 May 2015 22:51:40 +0000 (18:51 -0400)
SiSU 6.5.0

117 files changed:
.gitignore
bin/sisu [changed mode: 0644->0755]
bin/sisu-concordance [changed mode: 0644->0755]
bin/sisu-epub [changed mode: 0644->0755]
bin/sisu-harvest [changed mode: 0644->0755]
bin/sisu-html [changed mode: 0644->0755]
bin/sisu-html-scroll [changed mode: 0644->0755]
bin/sisu-html-seg [changed mode: 0644->0755]
bin/sisu-misc-utils [changed mode: 0644->0755]
bin/sisu-odf [changed mode: 0644->0755]
bin/sisu-pdf [changed mode: 0644->0755]
bin/sisu-pdf-landscape [changed mode: 0644->0755]
bin/sisu-pdf-portrait [changed mode: 0644->0755]
bin/sisu-pg [changed mode: 0644->0755]
bin/sisu-sqlite [changed mode: 0644->0755]
bin/sisu-txt [changed mode: 0644->0755]
bin/sisu-webrick [changed mode: 0644->0755]
data/doc/sisu/CHANGELOG_v5
data/doc/sisu/CHANGELOG_v6
data/doc/sisu/org/sisu_packaging.org
data/sisu/version/current.yml
data/sisu/version/develop.yml
lib/sisu/current/ao.rb
lib/sisu/current/ao_character_check.rb
lib/sisu/current/ao_composite.rb
lib/sisu/current/ao_doc_objects.rb
lib/sisu/current/ao_doc_str.rb
lib/sisu/current/ao_endnotes.rb
lib/sisu/current/ao_expand_insertions.rb
lib/sisu/current/ao_hash_digest.rb
lib/sisu/current/ao_idx.rb
lib/sisu/current/ao_images.rb
lib/sisu/current/ao_misc_arrange.rb
lib/sisu/current/ao_numbering.rb
lib/sisu/current/ao_persist.rb [new file with mode: 0644]
lib/sisu/current/ao_references.rb [new file with mode: 0644]
lib/sisu/current/ao_syntax.rb
lib/sisu/current/cgi_sql_common.rb
lib/sisu/current/constants.rb
lib/sisu/current/db_drop.rb
lib/sisu/current/db_sqltxt.rb
lib/sisu/current/dp.rb
lib/sisu/current/git.rb
lib/sisu/current/html.rb
lib/sisu/current/html_format.rb
lib/sisu/current/html_harvest_authors.rb
lib/sisu/current/html_harvest_topics.rb
lib/sisu/current/html_lite_shared.rb
lib/sisu/current/html_manifest.rb
lib/sisu/current/html_minitoc.rb
lib/sisu/current/html_parts.rb
lib/sisu/current/html_persist.rb [new file with mode: 0644]
lib/sisu/current/html_segments.rb
lib/sisu/current/html_tune.rb
lib/sisu/current/hub.rb
lib/sisu/current/hub_actions.rb
lib/sisu/current/hub_loop_markup_files.rb
lib/sisu/current/hub_options.rb
lib/sisu/current/manpage.rb
lib/sisu/current/object_munge.rb [new file with mode: 0644]
lib/sisu/current/se_clear.rb
lib/sisu/current/se_file_op.rb
lib/sisu/current/se_filemap.rb
lib/sisu/current/se_get_init.rb
lib/sisu/current/se_info_env.rb
lib/sisu/current/se_programs.rb
lib/sisu/current/se_version.rb
lib/sisu/current/shared_markup_alt.rb
lib/sisu/current/shared_metadata.rb
lib/sisu/current/src_po4a_share.rb [new file with mode: 0644]
lib/sisu/current/src_po4a_shelf.rb [moved from lib/sisu/current/po4a.rb with 56% similarity]
lib/sisu/current/src_po4a_shelf_set.rb [moved from lib/sisu/current/po4a_set.rb with 97% similarity]
lib/sisu/current/src_po4a_sst_ao_sst.rb [new file with mode: 0644]
lib/sisu/current/src_po4a_sst_ao_sst_set.rb [new file with mode: 0644]
lib/sisu/current/src_po4a_sstm.rb [new file with mode: 0644]
lib/sisu/current/src_shared.rb
lib/sisu/current/src_sisupod_sstm.rb [moved from lib/sisu/current/src_share.rb with 97% similarity]
lib/sisu/current/sst_convert_markup.rb
lib/sisu/current/sst_from_xml.rb
lib/sisu/current/sst_to_s_xml_sax.rb
lib/sisu/current/texinfo_format.rb
lib/sisu/current/texpdf_format.rb
lib/sisu/current/txt_asciidoc.rb
lib/sisu/current/txt_asciidoc_decorate.rb [new file with mode: 0644]
lib/sisu/current/txt_markdown.rb
lib/sisu/current/txt_markdown_decorate.rb [new file with mode: 0644]
lib/sisu/current/txt_orgmode.rb [new file with mode: 0644]
lib/sisu/current/txt_orgmode_decorate.rb [new file with mode: 0644]
lib/sisu/current/txt_output.rb [new file with mode: 0644]
lib/sisu/current/txt_plain.rb
lib/sisu/current/txt_plain_decorate.rb [new file with mode: 0644]
lib/sisu/current/txt_read.rb [new file with mode: 0644]
lib/sisu/current/txt_rst.rb
lib/sisu/current/txt_rst_decorate.rb [new file with mode: 0644]
lib/sisu/current/txt_textile.rb
lib/sisu/current/txt_textile_decorate.rb [new file with mode: 0644]
lib/sisu/current/urls.rb
lib/sisu/current/utils_composite.rb [new file with mode: 0644]
lib/sisu/current/utils_response.rb
lib/sisu/current/wikispeak.rb
lib/sisu/current/xhtml.rb
lib/sisu/current/xhtml_epub2.rb
lib/sisu/current/xhtml_epub2_format.rb
lib/sisu/current/xhtml_epub2_persist.rb [new file with mode: 0644]
lib/sisu/current/xhtml_epub2_segments.rb
lib/sisu/current/xhtml_parts.rb
lib/sisu/current/xhtml_table.rb
lib/sisu/current/xml_dom.rb
lib/sisu/current/xml_fictionbook2.rb
lib/sisu/current/xml_odf_odt.rb
lib/sisu/current/xml_odf_odt_format.rb
lib/sisu/current/xml_persist.rb [new file with mode: 0644]
lib/sisu/current/xml_sax.rb
lib/sisu/current/xml_shared.rb
setup.rb
setup/qi_libs.rb
setup/sisu_version.rb

index 2811a57996f7c5e5ea8c25f52cac06fb50283050..327d5c62aec7a16f5b1af2bd2a1aef2422f6cd96 100644 (file)
@@ -11,3 +11,5 @@
 *.rb_
 .pc
 0???-*.patch
+*.gz
+*.xz
old mode 100644 (file)
new mode 100755 (executable)
index 9bb4173..f7c36bb
--- a/bin/sisu
+++ b/bin/sisu
@@ -16,7 +16,7 @@ class Orient
      '6'
     end
     def default
-     stable
+     unstable
     end
     def current
      'current'
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
index 6e68ba5cff04113616767204e5982150a89d821f..af735e3f55abd2a5477b4fc1980aa4235fd9e43c 100644 (file)
@@ -34,6 +34,13 @@ v2 branch is removed; it is available in sisu =< 3.3.2
 
 --- HEAD ---
 
+** 5.9.0.orig.tar.xz (2015-04-21:16/2)
+http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/sisu_5.9.0
+http://www.jus.uio.no/sisu/pkg/src/sisu_5.9.0.orig.tar.xz
+  sisu_5.9.0.orig.tar.xz
+
+  * merge v6 into v5, and make v6 the default branch, so v5 is legacy
+
 ** 5.8.0.orig.tar.xz (2015-04-20:16/1)
 http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/sisu_5.8.0
 http://www.jus.uio.no/sisu/pkg/src/sisu_5.8.0.orig.tar.xz
index 857d19ea2c145e308d55c8f68c357bc39e00b282..e260b312b4fdd71958165b12f1ab94a5110e16eb 100644 (file)
@@ -24,6 +24,13 @@ v2 branch is removed; it is available in sisu =< 3.3.2
 
 --- HEAD ---
 
+** 6.5.0.orig.tar.xz (2015-04-21:16/2)
+http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/sisu_6.4.1
+http://www.jus.uio.no/sisu/pkg/src/sisu_6.4.1.orig.tar.xz
+  sisu_6.4.1.orig.tar.xz
+
+  * v6 made the default branch (prior to restructuring for v7)
+
 ** 6.4.0.orig.tar.xz (2015-04-20:16/1)
 http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/sisu_6.4.0
 http://www.jus.uio.no/sisu/pkg/src/sisu_6.4.0.orig.tar.xz
index 3ef53fe72870154a213f2f6f7ebfaa98ff34a539..66e7b9656a7611af5d63c749aa7514917b19df4e 100644 (file)
@@ -3,36 +3,34 @@ Developer Notes, Dependencies
 
 * description
 ** short summary: 80 chars
-smart text parser for document structuring, multiple format publishing & search
+documents - structuring, publishing in multiple formats and search
 ** longer
  SiSU is a lightweight markup based, command line oriented, document
- structuring, publishing and search framework for document collections.
+ structuring, publishing and search, static content tool for document
+ collections.
  .
- With minimal preparation of a plain-text (UTF-8) file, using sisu markup
- syntax in a text editor of your choice, SiSU can generate various document
- formats (most of which share a common object numbering system for locating
- content), including plain text, HTML, XHTML, XML, EPUB, OpenDocument text
- (ODF:ODT), LaTeX, PDF files, and populate an SQL database with objects
- (roughly paragraph-sized chunks) so searches may be performed and matches
- returned with that degree of granularity. Think being able to finely match
- text in documents, using object numbers, across different output formats (and
- across languages if you have translations of the same document). Search results
- can be an index of documents and object numbers within them, your criteria is
- met by these documents at these locations within each document (equally
- relevant across different output formats and languages). To be clear (if
- obvious) page numbers provide none of this functionality. Object numbering is
- particularly suitable for "published" works (finalized texts as opposed to
- works that are frequently changed or updated) for which it provides a fixed
- means of reference of content. Document outputs can also share provided
- semantic meta-data.
+ With minimal preparation of a plain-text (UTF-8) file, using sisu markup syntax
+ in your text editor of choice, SiSU can generate various document formats, most
+ of which share a common object numbering system for locating content, including
+ plain text, HTML, XHTML, XML, EPUB, OpenDocument text (ODF:ODT), LaTeX, PDF
+ files, and populate an SQL database with objects (roughly paragraph-sized
+ chunks) so searches may be performed and matches returned with that degree of
+ granularity. Think of being able to finely match text in documents, using
+ common object numbers, across different output formats and across languages if
+ you have translations of the same document. For search, your criteria is met
+ by these documents at these locations within each document (equally relevant
+ across different output formats and languages). To be clear (if obvious) page
+ numbers provide none of this functionality. Object numbering is particularly
+ suitable for "published" works (finalized texts as opposed to works that are
+ frequently changed or updated) for which it provides a fixed means of reference
+ of content. Document outputs can also share provided semantic meta-data.
  .
  SiSU also provides concordance files, document content certificates and
- manifests of generated output. SiSU provides the means to make book indexes
that make use of its object numbering.
+ manifests of generated output and the means to make book indexes that make use
+ of its object numbering.
  .
- A vim syntax highlighting file and an ftplugin with folds for sisu markup is
- provided. Vim 7 includes syntax highlighting for SiSU. Some syntax hilighting
- is also available for Emacs and a few other editors.
+ Syntax highlighting and folding (outlining) files are provided for the Vim and
+ Emacs editors.
  .
  Dependencies for various features are taken care of in sisu related packages.
  The package sisu-complete installs the whole of SiSU.
@@ -49,6 +47,7 @@ smart text parser for document structuring, multiple format publishing & search
  .
  SiSU works well under po4a translation management, for which an administrative
  sample Rakefile is provided with sisu_manual under markup-samples.
+
 * Generic Dependencies
 ** source
 git clone --depth 1 git://git.sisudoc.org/git/code/sisu.git --branch upstream
@@ -67,11 +66,11 @@ $ qi setup --all --dryrun
 $ sudo ./qi setup --all dryrun
 
 ** minimal
-            needed for
-----------------------
-ruby        all, provides outputs text, html
-xz          sisupod
-zip unzip   epub & odt
+*** interpreter
+ruby                 all, provides outputs text, html
+*** compression tools
+xz                   sisupod (sisu source)
+zip unzip            epub & odt
 
 *** images
 imagemagick | graphicsmagick
@@ -79,6 +78,87 @@ ruby-rmagick ?
 
 ** special requirements
 
+*** ruby requires
+(checked for sisu 6.5.0 & 7.0.0)
+require 'RMagick'         ao_images.rb
+require 'base64'          xml_fictionbook2.rb
+require 'cgi'             cgi_pgsql.rb
+                          cgi_sqlite.rb
+                          webrick.rb
+require 'date'            se_date.rb
+require 'dbi'             se_load.rb
+require 'digest/md5'      shared_markup_alt.rb
+require 'digest/sha2'     shared_markup_alt.rb
+                          shared_markup_alt.rb
+require 'fcgi'            cgi_pgsql.rb
+                          cgi_sqlite.rb
+                          webrick.rb
+require 'fileutils'       dbi_discrete.rb
+                          hub.rb
+                          se.rb
+                          se_cleanoutput.rb
+                          se_createsite.rb
+                          se_file_op.rb
+                          se_file_op.rb
+                          se_info_env.rb
+                          se_info_env.rb
+                          se_remotes.rb
+                          src_kdissert_share.rb
+require 'find'            xml_odf_odt.rb
+require 'net/http'        remote.rb
+require 'open-uri'        ao_composite.rb
+                          remote.rb
+require 'pathname'        hub_options.rb
+                          se_info_env.rb
+require 'pg'              cgi_pgsql.rb
+                          dbi.rb
+                          se_db.rb
+require 'pp'              ao_composite.rb
+                          remote.rb
+require 'profile'         hub.rb
+require 'pstore'          dp.rb
+                          html.rb
+                          texpdf.rb
+                          texpdf.rb
+                          xhtml_epub2.rb
+require 'rbconfig'        se_info_system.rb
+                          se_version.rb
+require 'rexml/document'  sst_from_xml.rb
+                          rexml.rb
+                          rexml.rb
+require 'singleton'       se.rb
+                          se_clear.rb
+                          se_envcall.rb
+                          se_hub_particulars.rb
+                          se_info_env.rb
+                          se_programs.rb
+                          se_version.rb
+                          se_version.rb
+require 'socket'          se_remotes.rb
+require 'sqlite3'         cgi_sqlite.rb
+                          dbi.rb
+                          dbi_discrete.rb
+                          se_db.rb
+require 'time'            webrick.rb
+                          webrick.rb
+require 'timeout'         src_po4a_shelf.rb
+                          src_po4a_sst_ao_sst.rb
+require 'uri'             ao_composite.rb
+                          dp.rb
+                          hub.rb
+                          hub_loop_markup_files.rb
+require 'webrick'         webrick.rb
+require 'yaml'            se_get_init.rb
+                          se_get_init.rb
+                          se_get_init.rb
+                          se_get_init.rb
+                          se_version.rb
+require 'zlib'            xml_odf_odt.rb
+require @prog             se_load.rb
+require termsheet         termsheet.rb
+
+ao_hash_digest.rb        sha_ ? (require 'digest/sha2') : (require 'digest/md5')
+
 *** pdf
 
 texlive
@@ -119,23 +199,27 @@ xunicode.sty
 *** sql db
 **** sqlite3
 
-sqlite3
-ruby-sqlite3
-
-ruby-fcgi (fast-cgi)
-httpd
+sqlite3               sql db, search
+ruby-sqlite3          ruby driver
 
 **** postgresql
 
-postgresql
-ruby-pg
+postgresql            sql db, search
+ruby-pg               ruby driver
 
-ruby-fcgi (fast-cgi)
-httpd
+*** web serve & search
+
+ruby-fcgi (fast-cgi)  search form
+httpd                 web server
+(along with sql db)
 
 *** qr codes
 
-qrencode
+qrencode              qr codes based on document metadata
+
+*** misc
+
+tree                  information on document structure
 
 *** maintenance/installation
 ruby-thor | rake
@@ -214,24 +298,26 @@ needs more than a shallow clone of depth 1
 ** pacman install
 
 sudo pacman -S ruby \
-  zip unzip xy
+  zip unzip xy tree
 
 sudo pacman -S ruby \
   texlive-core texlive-latexextra texlive-fontsextra texlive-langcjk
 
 sudo pacman -S ruby \
-  sqlite postgresql
+  sqlite postgresql \
+  fastcgi ruby-sqlite ruby-postgrsql
 
 # issue with ruby-pg ruby-sqlite ruby-fcgi
 
-** interpreter
+** sort
+*** interpreter
   ruby
 
-** compression tools (epub, odf:odt, sisupod)
+*** compression tools (epub, odf:odt, sisupod)
   zip unzip
   xy
 
-** texlive (pdf)
+*** texlive (pdf)
 sudo pacman -S texlive-core texlive-latexextra
 sudo pacman -S texlive-core texlive-latexextra texlive-fontsextra texlive-langcjk
 
index 18463362e3288917af9f8108a14a70982dd501d8..82262ef8dfb06ba7c9f1c50509fad91c62c2c984 100644 (file)
@@ -1,5 +1,5 @@
 ---
 :project: SiSU
-:version: 5.8.0
-:date_stamp: 2015w16/1
-:date: "2015-04-20"
+:version: 5.9.0
+:date_stamp: 2015w16/2
+:date: "2015-04-21"
index 5ae6ac06b94244b768d7f06e9a93519bce1a73a7..f69fce72481193f1b2cd26bae810d68120c55e5c 100644 (file)
@@ -1,5 +1,5 @@
 ---
 :project: SiSU
-:version: 6.4.0
-:date_stamp: 2015w16/1
-:date: "2015-04-20"
+:version: 6.5.0
+:date_stamp: 2015w16/2
+:date: "2015-04-21"
index 3467c4c656d0afefc243d448b422f4ea5d183461..b7878dbf1a071bd82d7bea3fb75499e6ad235893 100644 (file)
@@ -64,6 +64,7 @@ module SiSU_AO
   require_relative 'ao_syntax'                          # ao_syntax.rb
     include SiSU_AO_Syntax
   require_relative 'ao_doc_str'                         # ao_doc_str.rb
+  require_relative 'ao_references'                      # ao_references.rb
   require_relative 'ao_idx'                             # ao_idx.rb
   require_relative 'ao_numbering'                       # ao_numbering.rb
   require_relative 'ao_hash_digest'                     # ao_hash_digest.rb
@@ -73,6 +74,7 @@ module SiSU_AO
   require_relative 'ao_character_check'                 # ao_character_check.rb
   require_relative 'ao_misc_arrange'                    # ao_misc_arrange.rb
   require_relative 'ao_expand_insertions'               # ao_expand_insertions.rb
+  require_relative 'ao_persist'                         # ao_persist.rb
   require_relative 'prog_text_translation'              # prog_text_translation.rb
   require_relative 'shared_sem'                         # shared_sem.rb
   class Instantiate < SiSU_Param::Parameters::Instructions
@@ -82,13 +84,10 @@ module SiSU_AO
     end
   end
   class Source <Instantiate
-    @@ao_array=[]
-    @@idx_arr={ sst: [], tex: [], html: [], xhtml: [] }
-    @@map_arr={ nametags: [], ocn_htmlseg: [] }
-    @@fns=nil
     def initialize(opt,fnx=nil,process=:complete)
       @opt,@fnx,@process=opt,fnx,process
-      @@fns ||=opt.fns
+      @per ||=SiSU_AO_Persist::Persist.new.persist_init
+      @per.fns ||=opt.fns
       fn_use=if fnx \
       and fnx =~/\.ss[tmi]$/
         fnx
@@ -110,32 +109,34 @@ module SiSU_AO
     end
     def read                                                                   #creates ao
       begin
-        @@ao_array=[]
-        @@fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
+        @per=SiSU_AO_Persist::Persist.new
+        @per.ao_arr=[]
+        @per.fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
         ? @fnx
         : @opt.fns
         create_ao
       rescue
-        SiSU_Errors::Rescued.new($!,$@,@opt.selections,@@fns).location do
+        SiSU_Errors::Rescued.new($!,$@,@opt.selections,@per.fns).location do
           __LINE__.to_s + ':' + __FILE__
         end
       ensure
+        SiSU_AO_Persist::Persist.new.persist_init
         SiSU_AO::Instantiate.new
       end
     end
     def get                                                                    #reads ao, unless does not exist then creates first
       begin
         ao=[]
-        unless @@fns==@opt.fns \
-        or @@fns==@fnx
-          @@fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
+        unless @per.fns==@opt.fns \
+        or @per.fns==@fnx
+          @per.fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
           ? @fnx
           : @opt.fns
-          @@ao_array=[]
+          @per.ao_arr=[]
         end
-        ao=(@@ao_array.empty?) \
+        ao=(@per.ao_arr.empty?) \
         ? read_fnc
-        : @@ao_array.dup
+        : @per.ao_arr.dup
       rescue
         SiSU_Errors::Rescued.new($!,$@,@opt.selections,@opt.fns).location do
           __LINE__.to_s + ':' + __FILE__
@@ -147,16 +148,16 @@ module SiSU_AO
     def get_idx_sst                                                            #reads ao idx.sst, #unless does not exist then creates first
       begin
         ao=[]
-        unless @@fns==@opt.fns \
-        or @@fns==@fnx
-          @@fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
+        unless @per.fns==@opt.fns \
+        or @per.fns==@fnx
+          @per.fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
           ? @fnx
           : @opt.fns
-          @@idx_arr[:sst]=[]
+          @per.idx_arr_sst=[]
         end
-        ao=(@@idx_arr[:sst].empty?) \
+        ao=(@per.idx_arr_sst.empty?) \
         ? read_idx_sst
-        : @@idx_arr[:sst].dup #check
+        : @per.idx_arr_sst.dup #check
       rescue
         SiSU_Errors::Rescued.new($!,$@,@opt.selections,@opt.fns).location do
           __LINE__.to_s + ':' + __FILE__
@@ -168,16 +169,16 @@ module SiSU_AO
     def get_idx_raw
       begin
         ao=[]
-        unless @@fns==@opt.fns \
-        or @@fns==@fnx
-          @@fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
+        unless @per.fns==@opt.fns \
+        or @per.fns==@fnx
+          @per.fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
           ? @fnx
           : @opt.fns
-          @@idx_arr[:tex]=[]
+          @per.idx_arr_tex=[]
         end
-        ao=(@@idx_arr[:tex].empty?) \
+        ao=(@per.idx_arr_tex.empty?) \
         ? read_idx_raw
-        : @@idx_arr[:tex].dup #check
+        : @per.idx_arr_tex.dup #check
       rescue
         SiSU_Errors::Rescued.new($!,$@,@opt.selections,@opt.fns).location do
           __LINE__.to_s + ':' + __FILE__
@@ -189,16 +190,16 @@ module SiSU_AO
     def get_idx_html                                                           #reads ao idx.html, #unless does not exist then creates first
       begin
         ao=[]
-        unless @@fns==@opt.fns \
-        or @@fns==@fnx
-          @@fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
+        unless @per.fns==@opt.fns \
+        or @per.fns==@fnx
+          @per.fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
           ? @fnx
           : @opt.fns
-          @@idx_arr[:html]=[]
+          @per.idx_arr_html=[]
         end
-        ao=(@@idx_arr[:html].empty?) \
+        ao=(@per.idx_arr_html.empty?) \
         ? read_idx_html
-        : @@idx_arr[:html].dup
+        : @per.idx_arr_html.dup
       rescue
         SiSU_Errors::Rescued.new($!,$@,@opt.selections,@opt.fns).location do
           __LINE__.to_s + ':' + __FILE__
@@ -210,16 +211,16 @@ module SiSU_AO
     def get_idx_xhtml                                                          #reads ao idx.xhtml, #unless does not exist then creates first
       begin
         ao=[]
-        unless @@fns==@opt.fns \
-        or @@fns==@fnx
-          @@fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
+        unless @per.fns==@opt.fns \
+        or @per.fns==@fnx
+          @per.fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
           ? @fnx
           : @opt.fns
-          @@idx_arr[:xthml]=[]
+          @per.idx_arr_xhtml=[] #...
         end
-        ao=(@@idx_arr[:xhtml].empty?) \
+        ao=(@per.idx_arr_xhtml.empty?) \
         ? read_idx_xhtml
-        : @@idx_arr[:xhtml].dup
+        : @per.idx_arr_xhtml.dup
       rescue
         SiSU_Errors::Rescued.new($!,$@,@opt.selections,@opt.fns).location do
           __LINE__.to_s + ':' + __FILE__
@@ -231,16 +232,16 @@ module SiSU_AO
     def get_map_nametags                                                       #reads ao map.nametags, #unless does not exist then creates first
       begin
         ao=[]
-        unless @@fns==@opt.fns \
-        or @@fns==@fnx
-          @@fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
+        unless @per.fns==@opt.fns \
+        or @per.fns==@fnx
+          @per.fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
           ? @fnx
           : @opt.fns
-          @@map_arr[:nametags]=[]
+          @per.map_arr_nametags=[]
         end
-        ao=(@@map_arr[:nametags].empty?) \
+        ao=(@per.map_arr_nametags.empty?) \
         ? read_map_nametags
-        : @@map_arr[:nametags].dup
+        : @per.map_arr_nametags.dup
       rescue
         SiSU_Errors::Rescued.new($!,$@,@opt.selections,@opt.fns).location do
           __LINE__.to_s + ':' + __FILE__
@@ -252,16 +253,16 @@ module SiSU_AO
     def get_map_ocn_htmlseg                                                    #reads ao map.ocn_htmlseg, #unless does not exist then creates first
       begin
         ao=[]
-        unless @@fns==@opt.fns \
-        or @@fns==@fnx
-          @@fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
+        unless @per.fns==@opt.fns \
+        or @per.fns==@fnx
+          @per.fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
           ? @fnx
           : @opt.fns
-          @@map_arr[:ocn_htmlseg]=[]
+          @per.map_arr_ocn_htmlseg=[]
         end
-        ao=(@@map_arr[:ocn_htmlseg].empty?) \
+        ao=(@per.map_arr_ocn_htmlseg.empty?) \
         ? read_map_ocn_htmlseg
-        : @@map_arr[:ocn_htmlseg].dup
+        : @per.map_arr_ocn_htmlseg.dup
       rescue
         SiSU_Errors::Rescued.new($!,$@,@opt.selections,@opt.fns).location do
           __LINE__.to_s + ':' + __FILE__
@@ -539,11 +540,12 @@ module SiSU_AO
         SiSU_AO_MiscArrangeText::SI.new(@md,data_txt).               # ao_misc_arrange.rb
           prepare_text
       data_obj,
-        metadata=
+        metadata,
+        bibliography=
           SiSU_AO_DocumentStructureExtract::Build.new(@md,data_txt). # ao_doc_str.rb
             identify_parts
       data_obj=
-        SiSU_AO_Syntax::Markup.new(@md,data_obj).songsheet           # ao_syntax.rb
+        SiSU_AO_Syntax::Markup.new(@md,data_obj,bibliography).songsheet           # ao_syntax.rb
       data_obj,
         endnote_array=
           SiSU_AO_CharacterCheck::Check.new(data_obj).               # ao_character_check.rb
index faee59243c3d600f69a6da533eda26f38b85d879..9d91baa5290790499e1d23305be0b09308f45f03 100644 (file)
@@ -63,9 +63,9 @@ module SiSU_AO_CharacterCheck
     end
     def character_check_and_oldstyle_endnote_array
       data=@data
-      @tuned_file,@endnote_array=[],[]
+      @endnote_array=[]
       endnote_no=1
-      data.each do |dob|
+      @tuned_file=data.select do |dob|
         unless dob.is ==:table
           dob.obj=dob.obj.strip.
             gsub(/^[{~}]\s*$/,'').
@@ -93,9 +93,8 @@ module SiSU_AO_CharacterCheck
             end
           end
         end
-        @tuned_file << dob if dob.is_a?(Object)
-      end
-      @tuned_file=@tuned_file.flatten.compact
+        dob if dob.is_a?(Object)
+      end.flatten.compact
       [@tuned_file,@endnote_array]
     end
   end
index 611dd70c886a66b9fa1d2e602532f77c9c61093c..24683cba2522afe1bd40b0f7c488510743349826 100644 (file)
@@ -57,6 +57,7 @@
 =end
 module SiSU_Assemble
   require_relative 'se'                                 # se.rb
+  require_relative 'utils_composite'                    # utils_composite.rb
   class RemoteImage
     def initialize
       @env=SiSU_Env::InfoEnv.new
@@ -86,7 +87,7 @@ module SiSU_Assemble
     end
   end
   class Composite
-    @@imager={}
+    include SiSU_Composite_Doc_Utils # composite doc, .ssm, extract all related insert files, array of filenames test
     def initialize(opt)
       @opt=opt
       @env=SiSU_Env::InfoEnv.new
@@ -101,14 +102,14 @@ module SiSU_Assemble
             'Composite Document',
             "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}",
           ).grey_title_hi unless @opt.act[:quiet][:set]==:on
+          composite_and_imported_filenames_array(@opt.fno) # composite doc, .ssm, extract all related insert files, array of filenames test
           assembled=loadfile(@opt.fno)
-          #assembled=insertions?(fns_array)
-          write(assembled)
           write(assembled)
         end
         Dir.chdir(pwd)
       rescue
-        SiSU_Errors::Rescued.new($!,$@,@opt.selections.str,@opt.fns).location do
+        SiSU_Errors::Rescued.new($!,$@,@opt.selections.str,@opt.fns).
+          location do
           __LINE__.to_s + ':' + __FILE__
         end
       ensure
@@ -126,7 +127,6 @@ module SiSU_Assemble
       end
     end
     def loadfile(loadfilename)
-      tuned_file=[]
       begin
         if FileTest.file?(loadfilename)
           insert_array=IO.readlines(loadfilename,'')
@@ -140,18 +140,17 @@ module SiSU_Assemble
                 loadfilename,
               ).txt_grey
             end
-            if loadfilename =~/\S+?\.ss[im]$/
-              insert_array.each do |para|
-                tuned_file << insert?(para)
+            tuned_file=if loadfilename =~/\S+?\.ss[im]$/
+              insert_array.each.map do |para|
+                insert?(para)
               end
             elsif loadfilename =~/\S+?\.sst$/
-              insert_array.each do |para|
-                tuned_file << para
+              insert_array.each.map do |para|
+                para
               end
-            end
+            end.flatten.compact
           end
         end
-        tuned_file=tuned_file.flatten.compact
       rescue
         SiSU_Errors::Rescued.new($!,$@,@opt.selections.str,@opt.fns).location do
           __LINE__.to_s + ':' + __FILE__
@@ -162,9 +161,6 @@ module SiSU_Assemble
     def url(loadfilename)
       if loadfilename =~ /((?:https?|file):\/\/\S+?\.ss[it])$/ # and NetTest
         loadfilename=$1
-        imagedir = /((?:https?|file):\/\/\S+?)\/[^\/]+?\.ss[it]$/.
-          match(loadfilename).captures.join +
-          '/_sisu/image' #watch
         begin
           require 'uri'
           require 'open-uri'
@@ -173,13 +169,10 @@ module SiSU_Assemble
           SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
             error('uri, open-uri or pp NOT FOUND (LoadError)')
         end
-        image_uri=URI.parse(imagedir)
         insert=open(loadfilename)
         insert_array=insert.dup
         insert.close
         file=insertion(loadfilename,insert_array)
-        @@imager[image_uri] ||=[]
-        @@imager[image_uri] << file[:images]
         file[:prepared]
       end
     end
@@ -238,7 +231,6 @@ module SiSU_Assemble
     end
   end
   class CompositeFileList
-    @@imager={}
     def initialize(opt)
       @opt=opt
       @env=SiSU_Env::InfoEnv.new
index ac528b904f19396d9ffee828b82d573f658abfe6..a4b2fa8aebd144e3220dc5e829d119a21d4c3168 100644 (file)
@@ -495,6 +495,18 @@ module SiSU_AO_DocumentStructure
         of,is, obj, flag, act, selections,tmp
       self
     end
+    def flag_lng(h,o=nil)
+      of=     @of                                                              #Symbol, classification - group
+      is=     :flag_lng
+      obj=    nil                                                              #String, text content
+      flag=   h[:flag]     || ((defined? o.flag)      ? o.flag    : nil)       #Symbol, :lng_on or :lng_off
+      act=    h[:act]      || ((defined? o.act)       ? o.act     : nil)       #Symbol, language set to :en etc.
+      selections= h[:selections] || ((defined? o.selections) ? o.selections : nil)   #String, text content
+      tmp=    h[:act]     || ((defined? o.tmp)       ? o.tmp     : nil)       #available for processing, empty after use
+      @of, @is,@obj,@flag,@act,@selections,@tmp=
+        of,is, obj, flag, act, selections,tmp
+      self
+    end
   end
   class ObjectLayout
     attr_accessor :obj,:sym,:attr,:is,:is_for,:of,:from,:tmp,:num
index 50916d10e97efa579f57c784e9393f360eff744b..fba1724e06c9aeefcf50cffa885c6773f3003d97 100644 (file)
 
 =end
 module SiSU_AO_DocumentStructureExtract
+  require_relative 'ao_persist'                     # ao_persist.rb
   class Instantiate < SiSU_Param::Parameters::Instructions
-    @@flag={
-      ocn:         :on,
-      code:        :off,
-      lngsyn:      :txt,
-      poem:        :off,
-      block:       :off,
-      box:         :off,
-      group:       :off,
-      alt:         :off,
-      quote:       :off,
-      table:       :off,
-      table_to:    :off,
-    }
     def initialize
       @@counter=@@column=@@columns=0
       @@line_mode=''
     end
   end
   class Build
-    @@flag={
-      ocn:         :on,
-      code:        :off,
-      lngsyn:      :txt,
-      poem:        :off,
-      block:       :off,
-      box:         :off,
-      group:       :off,
-      alt:         :off,
-      quote:       :off,
-      table:       :off,
-      table_to:    :off,
-    }
     def initialize(md,data)
       @md,@data=md,data
       SiSU_AO_DocumentStructureExtract::Instantiate.new
       @pb=SiSU_AO_DocumentStructure::ObjectLayout.new.break(Hx[:br_page])
       @pbn=SiSU_AO_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_new])
       @pbl=SiSU_AO_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_line])
+      @per=SiSU_AO_Persist::PersistDocStructExt.new
     end
     def ln_get(lv)
       case lv
@@ -120,7 +96,7 @@ module SiSU_AO_DocumentStructureExtract
       : false
     end
     def quotes?
-      @@flag[:quote]==:open \
+      @per.quote==:open \
       ? true
       : false
     end
@@ -255,42 +231,29 @@ module SiSU_AO_DocumentStructureExtract
         array: idx_array,
       }
     end
-    def identify_parts
-      tuned_file=[]
-      @tuned_block,@tuned_code=[],[]
-      @@counter,@verse_count=0,0
-      @num_id={
-        code_block: 0,
-        poem:       0,
-        box:        0,
-        group:      0,
-        alt:        0,
-        quote:      0,
-        table:      0,
-      }
-      @metadata={}
-      @data.each do |t_o|
+    def extract_structure_loop(data,tuned_file)
+      data.each do |t_o|
         if t_o =~/^--([+~-])[#]$/
           h=case $1
           when /[+]/
-            @@flag[:ocn]=:on
+            @per.ocn=:on
             {
               flag: :ocn_on,
             }
           when /[~]/
-            @@flag[:ocn]=:ocn_off_headings_keep
+            @per.ocn=:ocn_off_headings_keep
             {
               flag: :ocn_off,
               mod: :headings_keep,
             }
           when /[-]/ #of particular relevance with level 1~ which is required to precede substantive text & used e.g. in html segmented text
-            @@flag[:ocn]=:ocn_off_headings_dummy_lev1
+            @per.ocn=:ocn_off_headings_dummy_lev1
             {
               flag: :ocn_off,
               mod: :headings_exclude,
             }
           else
-            @@flag[:ocn]=:on
+            @per.ocn=:on
             {
               flag: :ocn_on,
             }
@@ -298,7 +261,30 @@ module SiSU_AO_DocumentStructureExtract
           t_o=SiSU_AO_DocumentStructure::ObjectFlag.new.flag_ocn(h)
           next
         end
-        t_o=t_o.gsub(/(?:\n\s*\n)+/m,"\n") if @@flag[:code]==:off
+        if t_o =~/^:[~](#{SiSU_is.language_list_regex?}|-)$/  # work with for identifying language of objects
+          lng=$1
+          h=case lng
+          when /(?:#{SiSU_is.language_list_regex?})/
+            @per.lng=:on
+            @per.lng_is=lng.to_sym
+            {
+              flag: :lng_on,
+              act:  lng.to_sym,
+            }
+          else # ^:~-
+            if @per.lng==:on
+              @per.lng=:off
+              @per.lng_is=:doc_default
+              {
+                flag: :lng_off,
+                act:  :doc_default,
+              }
+            end
+          end
+          t_o=SiSU_AO_DocumentStructure::ObjectFlag.new.flag_lng(h)
+          next
+        end
+        t_o=t_o.gsub(/(?:\n\s*\n)+/m,"\n") if @per.code==:off
         unless t_o =~/^(?:@\S+?:|%+)\s/                  # extract book index for paragraph if any
           idx=if t_o=~/^=\{\s*(.+)\s*\}\s*$\Z/m
             m=$1
@@ -313,13 +299,13 @@ module SiSU_AO_DocumentStructureExtract
         end
         if t_o !~/^(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block)\{|^\}(?:code|poem|alt|group|block)|^(?:table\{|\{table)[ ~]/ \
         and t_o !~/^```[ ]+(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table)|^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$|^`:quote_(?:open|close)`/ \
-        and @@flag[:code]==:off \
-        and @@flag[:poem]==:off \
-        and @@flag[:group]==:off \
-        and @@flag[:block]==:off \
-        and @@flag[:alt]==:off \
-        and @@flag[:box]==:off \
-        and @@flag[:table]==:off
+        and @per.code==:off \
+        and @per.poem==:off \
+        and @per.group==:off \
+        and @per.block==:off \
+        and @per.alt==:off \
+        and @per.box==:off \
+        and @per.table==:off
           t_o=case t_o
           when /^#{Mx[:meta_o]}\S+?#{Mx[:meta_c]}/                                 #metadata, header
             if t_o=~/^#{Mx[:meta_o]}(\S+?)#{Mx[:meta_c]}\s*(.+)/m
@@ -340,14 +326,14 @@ module SiSU_AO_DocumentStructureExtract
               obj=$1
               note=endnote_test?(obj)
               obj,tags=extract_tags(obj)
-              if @@flag[:ocn]==:ocn_off_headings_dummy_lev1 \
-              or @@flag[:ocn]==:ocn_off_headings_keep
+              if @per.ocn==:ocn_off_headings_dummy_lev1 \
+              or @per.ocn==:ocn_off_headings_keep
                 unless obj =~ /[~-][#]\s*$/
-                  if @@flag[:ocn]==:ocn_off_headings_dummy_lev1 \
+                  if @per.ocn==:ocn_off_headings_dummy_lev1 \
                   and t_o =~/^1\~\S*\s+/m
                     obj << ' -#'
-                  elsif @@flag[:ocn]==:ocn_off_headings_dummy_lev1 \
-                  or @@flag[:ocn]==:ocn_off_headings_keep
+                  elsif @per.ocn==:ocn_off_headings_dummy_lev1 \
+                  or @per.ocn==:ocn_off_headings_keep
                     obj << ' ~#'
                   end
                 end
@@ -364,14 +350,14 @@ module SiSU_AO_DocumentStructureExtract
               name,obj=$1,$2
               note=endnote_test?(obj)
               obj,tags=extract_tags(obj)
-              if @@flag[:ocn]==:ocn_off_headings_dummy_lev1 \
-              or @@flag[:ocn]==:ocn_off_headings_keep
+              if @per.ocn==:ocn_off_headings_dummy_lev1 \
+              or @per.ocn==:ocn_off_headings_keep
                 unless obj =~ /[~-][#]\s*$/
-                  if @@flag[:ocn]==:ocn_off_headings_dummy_lev1 \
+                  if @per.ocn==:ocn_off_headings_dummy_lev1 \
                   and t_o =~/^1\~\S*\s+/m
                     obj << ' -#'
-                  elsif @@flag[:ocn]==:ocn_off_headings_dummy_lev1 \
-                  or @@flag[:ocn]==:ocn_off_headings_keep
+                  elsif @per.ocn==:ocn_off_headings_dummy_lev1 \
+                  or @per.ocn==:ocn_off_headings_keep
                     obj << ' ~#'
                   end
                 end
@@ -389,14 +375,14 @@ module SiSU_AO_DocumentStructureExtract
               name,obj=$1,$2
               note=endnote_test?(obj)
               obj,tags=extract_tags(obj,name)
-              if @@flag[:ocn]==:ocn_off_headings_dummy_lev1 \
-              or @@flag[:ocn]==:ocn_off_headings_keep
+              if @per.ocn==:ocn_off_headings_dummy_lev1 \
+              or @per.ocn==:ocn_off_headings_keep
                 unless obj =~ /[~-][#]\s*$/
-                  if @@flag[:ocn]==:ocn_off_headings_dummy_lev1 \
+                  if @per.ocn==:ocn_off_headings_dummy_lev1 \
                   and t_o =~/^1\~\S*\s+/m
                     obj << ' -#'
-                  elsif @@flag[:ocn]==:ocn_off_headings_dummy_lev1 \
-                  or @@flag[:ocn]==:ocn_off_headings_keep
+                  elsif @per.ocn==:ocn_off_headings_dummy_lev1 \
+                  or @per.ocn==:ocn_off_headings_keep
                     obj << ' ~#'
                   end
                 end
@@ -424,8 +410,8 @@ module SiSU_AO_DocumentStructureExtract
               note=endnote_test?(obj)
               obj,tags=extract_tags(obj)
               unless obj=~/\A\s*\Z/m
-                if @@flag[:ocn]==:ocn_off_headings_dummy_lev1 \
-                or @@flag[:ocn]==:ocn_off_headings_keep
+                if @per.ocn==:ocn_off_headings_dummy_lev1 \
+                or @per.ocn==:ocn_off_headings_keep
                   unless obj =~ /[~-][#]\s*$/
                     obj << ' ~#'
                   end
@@ -457,8 +443,8 @@ module SiSU_AO_DocumentStructureExtract
               note=endnote_test?(obj)
               obj,tags=extract_tags(obj)
               unless obj=~/\A\s*\Z/m
-                if @@flag[:ocn]==:ocn_off_headings_dummy_lev1 \
-                or @@flag[:ocn]==:ocn_off_headings_keep
+                if @per.ocn==:ocn_off_headings_dummy_lev1 \
+                or @per.ocn==:ocn_off_headings_keep
                   unless obj =~ /[~-][#]\s*$/
                     obj << ' ~#'
                   end
@@ -489,8 +475,8 @@ module SiSU_AO_DocumentStructureExtract
             image=image_test(t_o)
             note=endnote_test?(t_o)
             obj,tags=extract_tags(t_o)
-            if @@flag[:ocn]==:ocn_off_headings_dummy_lev1 \
-            or @@flag[:ocn]==:ocn_off_headings_keep
+            if @per.ocn==:ocn_off_headings_dummy_lev1 \
+            or @per.ocn==:ocn_off_headings_keep
               unless obj =~ /[~-][#]\s*$/
                 obj << ' ~#'
               end
@@ -511,14 +497,14 @@ module SiSU_AO_DocumentStructureExtract
             end
             t_o=SiSU_AO_DocumentStructureExtract::Structure.new(@md).structure_markup(t_o) #must happen earlier, node info etc. require
           end
-        elsif @@flag[:code]==:off
+        elsif @per.code==:off
           if t_o =~/^(?:code(?:\.[a-z][0-9a-z_]+)?\{|```[ ]+code(?:\.[a-z][0-9a-z_]+)?)/
-            @@flag[:code]=case t_o
+            @per.code=case t_o
             when /^code(?:\.[a-z][0-9a-z_]+)?\{/ then :curls
             when /^```[ ]+code/                  then :tics
-            else                                 @@flag[:code] #error
+            else                                 @per.code #error
             end
-            @@flag[:lngsyn]=if t_o =~/^(?:code\.[a-z][0-9a-z_]+\{|```[ ]+code\.[a-z_]+)/
+            @per.lngsyn=if t_o =~/^(?:code\.[a-z][0-9a-z_]+\{|```[ ]+code\.[a-z_]+)/
               case t_o
               when /^code\.([a-z][0-9a-z_]+)\{/
                 :"#{$1}"
@@ -539,14 +525,14 @@ module SiSU_AO_DocumentStructureExtract
               obj: '',
               sym: :code_block_open,
               num: @num_id[:code_block],
-              syntax: @@flag[:lngsyn],
+              syntax: @per.lngsyn,
             }
             t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
           elsif t_o =~/^(?:poem\{|```[ ]+poem)/
-            @@flag[:poem]=case t_o
+            @per.poem=case t_o
             when /^poem\{/        then :curls
             when /^```[ ]+poem/   then :tics
-            else                  @@flag[:poem] #error
+            else                  @per.poem #error
             end
             @num_id[:poem] +=1
             h={
@@ -558,10 +544,10 @@ module SiSU_AO_DocumentStructureExtract
             t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
             tuned_file << t_o
           elsif t_o =~/^(?:box(?:\.[a-z_]+)?\{|```[ ]+box(?:\.[a-z_]+)?)/
-            @@flag[:box]=case t_o
+            @per.box=case t_o
             when /^box\{/         then :curls
             when /^```[ ]+box/    then :tics
-            else                       @@flag[:box] #error
+            else                       @per.box #error
             end
             @num_id[:box] +=1
             h={
@@ -573,10 +559,10 @@ module SiSU_AO_DocumentStructureExtract
             t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
             tuned_file << t_o
           elsif t_o =~/^(?:group\{|```[ ]+group)/
-            @@flag[:group]=case t_o
+            @per.group=case t_o
             when /^group\{/       then :curls
             when /^```[ ]+group/  then :tics
-            else                       @@flag[:group] #error
+            else                       @per.group #error
             end
             @num_id[:group] +=1
             h={
@@ -588,10 +574,10 @@ module SiSU_AO_DocumentStructureExtract
             t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
             tuned_file << t_o
           elsif t_o =~/^(?:block\{|```[ ]+block)/
-            @@flag[:block]=case t_o
+            @per.block=case t_o
             when /^block\{/       then :curls
             when /^```[ ]+block/  then :tics
-            else                       @@flag[:block] #error
+            else                       @per.block #error
             end
             @num_id[:block] +=1
             h={
@@ -603,10 +589,10 @@ module SiSU_AO_DocumentStructureExtract
             t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
             tuned_file << t_o
           elsif t_o =~/^(?:alt\{|```[ ]+alt)/
-            @@flag[:alt]=case t_o
+            @per.alt=case t_o
             when /^alt\{/         then :curls
             when /^```[ ]+alt/    then :tics
-            else                       @@flag[:alt] #error
+            else                       @per.alt #error
             end
             @num_id[:alt] +=1
             h={
@@ -618,7 +604,7 @@ module SiSU_AO_DocumentStructureExtract
             t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
             tuned_file << t_o
           elsif t_o =~/^`:quote_open`/
-            @@flag[:quote]=:open
+            @per.quote=:open
             @num_id[:quote] +=1
             h={
               is_for: :quote,
@@ -639,7 +625,7 @@ module SiSU_AO_DocumentStructureExtract
             ins_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
             tuned_file << ins_o
             if t_o=~/^table\{(?:~h)?\s+/
-              @@flag[:table]=:curls
+              @per.table=:curls
               @rows=''
               case t_o
               when /table\{~h\s+c(\d+);\s+(.+)/
@@ -658,7 +644,7 @@ module SiSU_AO_DocumentStructureExtract
                 idx: idx,
               }
             elsif t_o=~/^```[ ]+table(?:~h)?\s+c\d+/
-              @@flag[:table]=:tics
+              @per.table=:tics
               @rows=''
               case t_o
               when /^```[ ]+table~h\s+c(\d+);\s+(.+)/
@@ -797,12 +783,12 @@ module SiSU_AO_DocumentStructureExtract
           end
           t_o
         end
-        if @@flag[:table]==:curls or @@flag[:table]==:tics
-          if (@@flag[:table]==:curls \
+        if @per.table==:curls or @per.table==:tics
+          if (@per.table==:curls \
           and t_o =~/^\}table/) \
-          or (@@flag[:table]==:tics \
+          or (@per.table==:tics \
           and t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
-            @@flag[:table]=:off
+            @per.table=:off
             headings,columns,widths,idx=@h[:head_],@h[:cols],@h[:widths],@h[:idx]
             @h={
               head_: headings,
@@ -832,13 +818,13 @@ module SiSU_AO_DocumentStructureExtract
             t_o=nil
           end
         end
-        if @@flag[:code]==:curls \
-        or @@flag[:code]==:tics
-          if (@@flag[:code]==:curls \
+        if @per.code==:curls \
+        or @per.code==:tics
+          if (@per.code==:curls \
           && t_o =~/^\}code/) \
-          or (@@flag[:code]==:tics \
+          or (@per.code==:tics \
           && t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/m)
-            @@flag[:code]=:off
+            @per.code=:off
             if @tuned_code[-1]
               @tuned_code[-1].
                 gsub!(/\s*(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*\Z/m,'')
@@ -848,12 +834,12 @@ module SiSU_AO_DocumentStructureExtract
             h={
               obj: obj,
               idx: idx,
-              syntax: @@flag[:lngsyn],
+              syntax: @per.lngsyn,
               tags: tags,
               num: @num_id[:code_block],
               number_: @codeblock_numbered,
             }
-            @@flag[:lngsyn]=:txt
+            @per.lngsyn=:txt
             t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.code(h)
             @tuned_code=[]
             tuned_file << t_o
@@ -865,8 +851,8 @@ module SiSU_AO_DocumentStructureExtract
             }
             t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
           end
-          if (@@flag[:code]==:curls \
-          || @@flag[:code]==:tics) \
+          if (@per.code==:curls \
+          || @per.code==:tics) \
           and t_o.is_a?(String)
             sub_array=t_o.dup + "#{Mx[:br_nl]}"
             @line_mode=[]
@@ -875,23 +861,23 @@ module SiSU_AO_DocumentStructureExtract
             @tuned_code << t_o
             t_o=nil
           end
-        elsif (@@flag[:poem]==:curls \
-        || @@flag[:poem]==:tics) \
-        or (@@flag[:box]==:curls \
-        || @@flag[:box]==:tics) \
-        or (@@flag[:group]==:curls \
-        || @@flag[:group]==:tics) \
-        or (@@flag[:block]==:curls \
-        || @@flag[:block]==:tics) \
-        or (@@flag[:alt]==:curls \
-        || @@flag[:alt]==:tics) \
-        or (@@flag[:quote]==:open \
+        elsif (@per.poem==:curls \
+        || @per.poem==:tics) \
+        or (@per.box==:curls \
+        || @per.box==:tics) \
+        or (@per.group==:curls \
+        || @per.group==:tics) \
+        or (@per.block==:curls \
+        || @per.block==:tics) \
+        or (@per.alt==:curls \
+        || @per.alt==:tics) \
+        or (@per.quote==:open \
         && t_o =~/`:quote_close`/m) #not
-          if (@@flag[:poem]==:curls \
+          if (@per.poem==:curls \
           && t_o =~/^\}poem$/m) \
-          or (@@flag[:poem]==:tics \
+          or (@per.poem==:tics \
           && t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
-            @@flag[:poem]=:off
+            @per.poem=:off
             h={
               is_for: :poem,
               obj: '',
@@ -900,11 +886,11 @@ module SiSU_AO_DocumentStructureExtract
               num: @num_id[:poem],
             }
             t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
-          elsif (@@flag[:box]==:curls \
+          elsif (@per.box==:curls \
           && t_o =~/^\}box/) \
-          or (@@flag[:box]==:tics \
+          or (@per.box==:tics \
           && t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
-            @@flag[:box]=:off
+            @per.box=:off
             obj,tags=extract_tags(@tuned_block.join("\n"))
             h={
               obj: obj,
@@ -923,11 +909,11 @@ module SiSU_AO_DocumentStructureExtract
               num: @num_id[:box],
             }
             t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
-          elsif (@@flag[:group]==:curls \
+          elsif (@per.group==:curls \
           && t_o =~/^\}group/) \
-          or (@@flag[:group]==:tics \
+          or (@per.group==:tics \
           && t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
-            @@flag[:group]=:off
+            @per.group=:off
             obj,tags=extract_tags(@tuned_block.join("\n"))
             h={
               obj: obj,
@@ -945,11 +931,11 @@ module SiSU_AO_DocumentStructureExtract
               num: @num_id[:group],
             }
             t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
-          elsif (@@flag[:block]==:curls \
+          elsif (@per.block==:curls \
           && t_o =~/^\}block/) \
-          or (@@flag[:block]==:tics \
+          or (@per.block==:tics \
           && t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
-            @@flag[:block]=:off
+            @per.block=:off
             obj,tags=extract_tags(@tuned_block.join("\n"))
             h={
               obj: obj,
@@ -967,11 +953,11 @@ module SiSU_AO_DocumentStructureExtract
               num: @num_id[:block],
             }
             t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
-          elsif (@@flag[:alt]==:curls \
+          elsif (@per.alt==:curls \
           && t_o =~/^\}alt/) \
-          or (@@flag[:alt]==:tics \
+          or (@per.alt==:tics \
           && t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
-            @@flag[:alt]=:off
+            @per.alt=:off
             obj,tags=extract_tags(@tuned_block.join("\n"))
             h={
               obj: obj,
@@ -989,9 +975,9 @@ module SiSU_AO_DocumentStructureExtract
               num: @num_id[:alt],
             }
             t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
-          elsif @@flag[:quote]==:open \
+          elsif @per.quote==:open \
           and t_o =~/`:quote_close`/m
-            @@flag[:quote]=:off
+            @per.quote=:off
             h={
               is_for: :quote,
               idx: idx,
@@ -1000,7 +986,7 @@ module SiSU_AO_DocumentStructureExtract
               num: @num_id[:quote],
             }
             t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
-          elsif @@flag[:quote]==:open
+          elsif @per.quote==:open
             t_o,tags=extract_tags(t_o)
             h={
               indent: 1,
@@ -1013,18 +999,18 @@ module SiSU_AO_DocumentStructureExtract
             }
             SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h)
           end
-          if (@@flag[:poem]==:curls \
-          || @@flag[:poem]==:tics) \
-          or (@@flag[:group]==:curls \
-          || @@flag[:group]==:tics) \
-          or (@@flag[:alt]==:curls \
-          || @@flag[:alt]==:tics) \
+          if (@per.poem==:curls \
+          || @per.poem==:tics) \
+          or (@per.group==:curls \
+          || @per.group==:tics) \
+          or (@per.alt==:curls \
+          || @per.alt==:tics) \
           and t_o =~/\S/ \
           and t_o !~/^(?:\}(?:verse|code|box|alt|group|block)|(?:verse|code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|alt|group|block)\{)/ \
           and t_o !~/^```[ ]+(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block)|^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/ # fix logic
             sub_array=t_o.dup
             @line_mode=sub_array.scan(/.+/)
-            type=if @@flag[:poem]==:curls or @@flag[:poem]==:tics
+            type=if @per.poem==:curls or @per.poem==:tics
               t_o=SiSU_AO_DocumentStructureExtract::Build.new(@md,@line_mode).build_lines(type).join
               poem=t_o.split(/\n\n/)
               poem.each do |v|
@@ -1042,14 +1028,14 @@ module SiSU_AO_DocumentStructureExtract
             else :group
             end
           end
-          @verse_count+=1 if @@flag[:poem]==:curls or @@flag[:poem]==:tics
+          @verse_count+=1 if @per.poem==:curls or @per.poem==:tics
         end
-        if @@flag[:code]==:off
-          if @@flag[:poem]==:curls or @@flag[:poem]==:tics \
-          or @@flag[:box]==:curls or @@flag[:box]==:tics \
-          or @@flag[:group]==:curls or @@flag[:group]==:tics \
-          or @@flag[:alt]==:curls or @@flag[:alt]==:tics \
-          or (@@flag[:quote]==:open and t_o =~/`:quote_close`/m)
+        if @per.code==:off
+          if @per.poem==:curls or @per.poem==:tics \
+          or @per.box==:curls or @per.box==:tics \
+          or @per.group==:curls or @per.group==:tics \
+          or @per.alt==:curls or @per.alt==:tics \
+          or (@per.quote==:open and t_o =~/`:quote_close`/m)
             if t_o.is_a?(String)
               t_o=t_o.gsub(/\n/m,"#{Mx[:br_nl]}").
                 gsub(/[ ][ ]/m,"#{Mx[:nbsp]*2}").
@@ -1070,6 +1056,24 @@ module SiSU_AO_DocumentStructureExtract
         else tuned_file << t_o
         end
       end
+      tuned_file
+    end
+    def identify_parts
+      tuned_file=[]
+      @tuned_block,@tuned_code=[],[]
+      @@counter,@verse_count=0,0
+      @num_id={
+        code_block: 0,
+        poem:       0,
+        box:        0,
+        group:      0,
+        alt:        0,
+        quote:      0,
+        table:      0,
+      }
+      @metadata={}
+      @data,bibliography=SiSU_AO_References::Bibliography.new(@md,@data).biblio_extraction
+      tuned_file=extract_structure_loop(@data,tuned_file)
       if @md.flag_endnotes
         tuned_file << @pb
         h={
@@ -1089,7 +1093,98 @@ module SiSU_AO_DocumentStructureExtract
         tuned_file << SiSU_AO_DocumentStructure::ObjectHeading.new.heading_insert(h)
         h={
           obj: 'Endnotes'
-          }
+        }
+      end
+      if @md.flag_auto_biblio
+        tuned_file << @pb
+        h={
+          ln: 1,
+          lc: 1,
+          obj: 'References',
+          autonum_: false,
+        }
+        tuned_file << SiSU_AO_DocumentStructure::ObjectHeading.new.heading_insert(h)
+        h={
+          ln: 4,
+          lc: 2,
+          obj: 'Bibliography',
+          name: 'biblio',
+          autonum_: false,
+        }
+        tuned_file << SiSU_AO_DocumentStructure::ObjectHeading.new.heading_insert(h)
+        h={
+          obj: 'Bibliography'
+        }
+        citenumber=0
+        bibliography.each do |c|
+          citenumber +=1 if c.is_a?(Hash)
+          if c[:is]==:book
+            h={
+              obj: %{[#{citenumber}] *{#{c[:author]}}* /{"#{c[:fulltitle]}"}/ #{c[:publisher]} (#{c[:year]}) #{c[:url]}},
+              tags: [c[:id]],
+              hang: 0,
+              indent: 2,
+              ocn_: false,
+            }
+            tuned_file << SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h)
+          elsif c[:is]==:article
+            h={
+              obj: %{[#{citenumber}] *{#{c[:author]}}* /{"#{c[:title]}"}/ #{c[:journal]} #{c[:volume]} (#{c[:year]}) #{c[:url]}},
+              tags: [c[:id]],
+              hang: 0,
+              indent: 2,
+              ocn_: false,
+            }
+            tuned_file << SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h)
+          end
+        end
+      elsif @md.flag_biblio
+        tuned_file << @pb
+        h={
+          ln: 1,
+          lc: 1,
+          obj: 'References',
+          autonum_: false,
+        }
+        tuned_file << SiSU_AO_DocumentStructure::ObjectHeading.new.heading_insert(h)
+        h={
+          ln: 4,
+          lc: 2,
+          obj: 'Bibliography',
+          name: 'biblio',
+          autonum_: false,
+        }
+        tuned_file << SiSU_AO_DocumentStructure::ObjectHeading.new.heading_insert(h)
+        h={
+          obj: 'Bibliography'
+        }
+        if bibliography.length > 0
+          tuned_file=extract_structure_loop(bibliography,tuned_file)
+        else
+          tuned_file, citations =
+            SiSU_AO_References::Citations.new(@md,tuned_file).songsheet  # ao_references.rb
+          citenumber=0
+          citations.compact.each do |c|
+            citenumber +=1 if c.is_a?(Hash)
+            if c[:is]==:book
+              h={
+                obj: %{[#{citenumber}] *{#{c[:author]}}* /{#{c[:publication]}}/ (#{c[:year]})},
+                hang: 0,
+                indent: 2,
+                ocn_: false,
+              }
+              tuned_file << SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h)
+            elsif c[:is]==:article
+              h={
+                obj: %{[#{citenumber}] *{#{c[:author]}}* /{"#{c[:title]}"}/ #{c[:publication]} editor #{c[:editor]} (#{c[:year]})},
+                hang: 0,
+                indent: 2,
+                ocn_: false,
+              }
+              tuned_file << SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h)
+            end
+          end
+        end
       end
       if @md.book_idx
         tuned_file << @pb
@@ -1134,7 +1229,7 @@ module SiSU_AO_DocumentStructureExtract
         obj: 'eof',
       }
       meta=SiSU_AO_DocumentStructure::ObjectMetadata.new.metadata(@metadata)
-      [tuned_file,meta]
+      [tuned_file,meta,bibliography]
     end
     def table_rows_and_columns_array(table_str)
       table=[]
@@ -1162,13 +1257,13 @@ module SiSU_AO_DocumentStructureExtract
       SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h)
     end
     def build_lines(type=:none)
-      lines,lines_new=@data,[]
-      lines.each do |line|
+      lines=@data
+      lines.each.map do |line|
         line=if line =~/\S/ \
         and line !~/^(?:code(?:\.[a-z][0-9a-z_]+)?\{|\}code)/ \
         and line !~/^(?:```[ ]+code(?:\.[a-z][0-9a-z_]+)?|```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$)/ \
         and not line.is_a?(Hash) #watch
-          @@counter+=1 if @@flag[:code]==:curls or @@flag[:code]==:tics
+          @@counter+=1 if @per.code==:curls or @per.code==:tics
           line=line.gsub(/\s\s/,"#{Mx[:nbsp]*2}").
             gsub(/#{Mx[:nbsp]}\s/,"#{Mx[:nbsp]*2}")
           line=line.gsub(/^/,"#{Mx[:gr_o]}codeline#{Mx[:gr_c]}") if type==:code # REMOVE try sort for texpdf special case
@@ -1180,9 +1275,8 @@ module SiSU_AO_DocumentStructureExtract
           line.gsub(/\s*$/,"#{Mx[:br_nl]}")
         else line
         end
-        lines_new << line
+        line
       end
-      lines_new
     end
   end
   class Structure                                          # this must happen early
index 7c9ae067ec2c1806c218b9ad177fc077447212e6..508d798a2bd0b4d6f49fd7485b19eae4b8e7764c 100644 (file)
@@ -66,9 +66,8 @@ module SiSU_AO_Endnotes
     end
     def endnotes
       data=@data
-      @tuned_file=[]
       endnote_ref=1
-      data.each do |dob|
+      @tuned_file=data.each.map do |dob|
                                                                                # manually numbered endnotes <!e(\d)!> <!e_(\d)!> -->
         if @md.opt.selections.str =~/--no-asterisk|--no-annotate/
           dob.obj=dob.obj.
@@ -89,20 +88,20 @@ module SiSU_AO_Endnotes
             word_mode=endnote_call_number(word_mode)
             dob.obj=word_mode.join(' ')
             endnote_ref+=1
-          when /~\^(?:\s|$)|<:e>/                                              #%note inserts endnotes previously gathered from /^(<!e[:_]!>|[-~]\{{3})/ (in earlier loop)
+          when /~\^(?:\s|$)/                                              #%note inserts endnotes previously gathered from /^(<!e[:_]!>|[-~]\{{3})/ (in earlier loop)
             word_mode=dob.obj.scan(/\S+/m)
             word_mode=endnote_call_number(word_mode)
             dob.obj=word_mode.join(' ')
             endnote_ref+=1
           end
         end
-        @tuned_file << dob
-      end
+        dob
+      end.flatten
       @endnote_counter,
         @endnote_counter_asterisk,
         @endnote_counter_dag=
         1,1,1
-      @tuned_file=@tuned_file.flatten
+      @tuned_file
     end
     def endnote_call_number(words)
       words.each do |word|
@@ -123,9 +122,9 @@ module SiSU_AO_Endnotes
               "#{Mx[:en_b_o]}\*#{@endnote_counter_asterisk} ")
             @endnote_counter_asterisk+=1
           end
-        when /~\^|<:e>/
+        when /~\^/
           if @endnote_array
-            word.gsub!(/~\^|<:e>/,
+            word.gsub!(/~\^/,
               "#{@endnote_array[@endnote_counter-1]}")
             @endnote_counter+=1
           end
index 3a749df37b80283784124131bb0d2b4f6c824038..3d4ea8cb96c33000651ffa25c4978ba308892351 100644 (file)
@@ -484,21 +484,19 @@ module SiSU_AO_Insertions
           linked_title="#{m_pre}{#{m_txt} }#{lnk[:manifest]}#{m_note}\n\n"
           tuned_file_tmp << linked_title
           output_filetypes=output_filetypes_in_cmd(m_cmd,lnk)
-          output_filetypes[:gen].each do |o_f|
-            describe = o_f
-            if describe
-              tuned_file_tmp << if @u.remote #to double space <:br> at beginning of entry
-                "#{Mx[:nbsp]*4} #{describe} "
+          output_filetypes[:gen].each do |desc|
+            if desc
+              tuned_file_tmp << if @u.remote
+                "#{Mx[:nbsp]*4} #{desc} "
               else # remove ...
                 "[provide document placement host location]"
               end
             end
           end
-          output_filetypes[:src].each do |o_f|
-            describe = o_f
-            if describe
+          output_filetypes[:src].each do |desc|
+            if desc
               tuned_file_tmp << if @u.remote
-                "#{Mx[:nbsp]*4} #{describe} "
+                "#{Mx[:nbsp]*4} #{desc} "
               else
                 "[provide document placement host location]"
               end
index bc86a4852fa127b15162b2c8b699780c372fe17c..0864989cbf7c8600651bcfd5762118bfe4b24391 100644 (file)
@@ -103,9 +103,8 @@ module SiSU_AO_Hash
       #use md5 or to create hash of each ao object including ocn, & add into to each ao object
     end
     def endnote_digest(data)
-      t_o_bit=[]
-      data.each do |en_plus|
-        t_o_bit <<= case en_plus
+      data.each.map do |en_plus|
+        case en_plus
         when /#{Mx[:en_a_o]}|#{Mx[:en_b_o]}/
           if en_plus =~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/
             t_o_txt,en_open,en_txt,en_close=
@@ -133,8 +132,7 @@ module SiSU_AO_Hash
           end
         else en_plus
         end
-      end
-      t_o_bit.join
+      end.join
     end
     def stamped(t_o,hash_class) #decide what hash information is most useful, is compromise necessary?
       t_o.obj=SiSU_TextRepresentation::Alter.new(t_o).strip_clean_of_extra_spaces
index 0c9c8a43463c37d87cc57767c2b2d2be67cf4a72..defad2c3d5cd6c8c7f2fc844e4e318450b70b593 100644 (file)
@@ -61,8 +61,6 @@ module SiSU_AO_BookIndex
       @rgx_idx=/#{Mx[:idx_o]}(?:.+?)#{Mx[:idx_c]}\s*/
       @rgx_idx_ocn_seg=/(.+?)~(\d+)~(\S+)/
       @rgx_idx_ocn=/(.+?)~(\d+)/
-      @ocn_html_identifier=
-        SiSU_Env::ProcessingSettings.new(@md).ocn_html_identifier
       @env ||=SiSU_Env::InfoEnv.new(@md.fns)
     end
     def indexing_song
@@ -261,13 +259,13 @@ module SiSU_AO_BookIndex
                 if a[:range]
                   idx[:sst_rel_html_seg][@o]=
                     idx[:sst_rel_html_seg][@o] +
-                    %{#{Mx[:lnk_o]}#{a[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}/#{a[:seg]}.html##{@ocn_html_identifier}#{a[:ocn]}#{Mx[:rel_c]}, }
+                    %{#{Mx[:lnk_o]}#{a[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}/#{a[:seg]}.html##{a[:ocn]}#{Mx[:rel_c]}, }
                   idx[:sst_rel][@t]=
                     idx[:sst_rel][@t] +
                     %{#{Mx[:lnk_o]}#{a[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{a[:ocn]}#{Mx[:rel_c]}, }
                   idx[:html][@q]=
                     idx[:html][@q] +
-                    %{<a href="#{a[:seg]}.html##{@ocn_html_identifier}#{a[:ocn]}">#{a[:range]}</a>, }
+                    %{<a href="#{a[:seg]}.html##{a[:ocn]}">#{a[:range]}</a>, }
                   idx[:xhtml][@q]=
                     idx[:xhtml][@q] +
                     %{<a href="#{a[:seg]}.xhtml#o#{a[:ocn]}">#{a[:range]}</a>, }
@@ -275,13 +273,13 @@ module SiSU_AO_BookIndex
                 elsif a[:ocn]
                   idx[:sst_rel_html_seg][@o]=
                     idx[:sst_rel_html_seg][@o] +
-                    %{#{Mx[:lnk_o]}#{a[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{a[:seg]}.html##{@ocn_html_identifier}#{a[:ocn]}#{Mx[:rel_c]}, }
+                    %{#{Mx[:lnk_o]}#{a[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{a[:seg]}.html##{a[:ocn]}#{Mx[:rel_c]}, }
                   idx[:sst_rel][@t]=
                     idx[:sst_rel][@t] +
                     %{#{Mx[:lnk_o]}#{a[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{a[:ocn]}#{Mx[:rel_c]}, }
                   idx[:html][@q]=
                     idx[:html][@q] +
-                    %{<a href="#{a[:seg]}.html##{@ocn_html_identifier}#{a[:ocn]}">#{a[:ocn]}</a>, }
+                    %{<a href="#{a[:seg]}.html##{a[:ocn]}">#{a[:ocn]}</a>, }
                   idx[:xhtml][@q]=
                     idx[:xhtml][@q] +
                     %{<a href="#{a[:seg]}.xhtml#o#{a[:ocn]}">#{a[:ocn]}</a>, }
@@ -313,13 +311,13 @@ module SiSU_AO_BookIndex
                     if z[:range]
                       idx[:sst_rel_html_seg][@o]=
                         idx[:sst_rel_html_seg][@o] +
-                        %{#{Mx[:lnk_o]}#{z[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:seg]}.html##{@ocn_html_identifier}#{z[:ocn]}#{Mx[:rel_c]}, }
+                        %{#{Mx[:lnk_o]}#{z[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:seg]}.html##{z[:ocn]}#{Mx[:rel_c]}, }
                       idx[:sst_rel][@t]=
                         idx[:sst_rel][@t] +
                         %{#{Mx[:lnk_o]}#{z[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:ocn]}#{Mx[:rel_c]}, }
                       idx[:html][@q]=
                         idx[:html][@q] +
-                        %{<a href="#{z[:seg]}.html##{@ocn_html_identifier}#{z[:ocn]}">#{z[:range]}</a>, }
+                        %{<a href="#{z[:seg]}.html##{z[:ocn]}">#{z[:range]}</a>, }
                       idx[:xhtml][@q]=
                         idx[:xhtml][@q] +
                         %{<a href="#{z[:seg]}.xhtml#o#{z[:ocn]}">#{z[:range]}</a>, }
@@ -327,13 +325,13 @@ module SiSU_AO_BookIndex
                     elsif z[:ocn]
                       idx[:sst_rel_html_seg][@o]=
                         idx[:sst_rel_html_seg][@o] +
-                        %{#{Mx[:lnk_o]}#{z[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:seg]}.html##{@ocn_html_identifier}#{z[:ocn]}#{Mx[:rel_c]}, }
+                        %{#{Mx[:lnk_o]}#{z[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:seg]}.html##{z[:ocn]}#{Mx[:rel_c]}, }
                       idx[:sst_rel][@t]=
                         idx[:sst_rel][@t] +
                         %{#{Mx[:lnk_o]}#{z[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:ocn]}#{Mx[:rel_c]}, }
                       idx[:html][@q]=
                         idx[:html][@q] +
-                        %{<a href="#{z[:seg]}.html##{@ocn_html_identifier}#{z[:ocn]}">#{z[:ocn]}</a>, }
+                        %{<a href="#{z[:seg]}.html##{z[:ocn]}">#{z[:ocn]}</a>, }
                       idx[:xhtml][@q]=
                         idx[:xhtml][@q] +
                         %{<a href="#{z[:seg]}.xhtml#o#{z[:ocn]}">#{z[:ocn]}</a>, }
@@ -415,12 +413,9 @@ module SiSU_AO_BookIndex
       tuned_file
     end
     def clean_index(data)                                  #check on use of dob
-      tuned_file=[]
-      data.each do |para|
-        para=para.gsub(/\n*#{@rgx_idx}/m,'')
-        tuned_file << para
+      data.each.map do |para|
+        para.gsub(/\n*#{@rgx_idx}/m,'')
       end
-      tuned_file
     end
   end
 end
index c0c45712c2dd53cf840b810b8eb0783935cf6f7c..38fde812773d3c5a33cf2ffd2dc997c130040854 100644 (file)
@@ -67,7 +67,6 @@ module SiSU_AO_Images
     end
     def images
       data=@data
-      tuned_file=[]
       @rmgk=false
       imagemagick_=true      #imagemagick_=SiSU_Env::InfoSettings.new.program?('rmagick')
       if imagemagick_
@@ -85,7 +84,7 @@ module SiSU_AO_Images
           ).warn
         end
       end
-      data.each do |dob|
+      data.select do |dob|
         unless dob.is ==:table
           dob.obj=dob.obj.strip
           if dob.obj =~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif)(?:\s*|\s+.+)?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/
@@ -179,9 +178,8 @@ module SiSU_AO_Images
             dob.obj=dob.obj.gsub(/(#{Mx[:lnk_o]})\s*(\S+\.(?:png|jpg|gif))\s+/i,'\1\2 ')
           end
         end
-        tuned_file << dob unless dob.nil?
+        dob unless dob.nil?
       end
-      tuned_file
     end
   end
 end
index e010eaca031cdb3f03d9f070de717924b2b56dfe..d023c44f6a9c64694a905d4054cdfc59ff22cfa6 100644 (file)
@@ -189,7 +189,6 @@ module SiSU_AO_MiscArrangeText
     end
     def prepare_text
       data=@data
-      data_new=[],[]
       if data[0] =~ /^#!\s*(?:\/usr\/bin\/env sisu|\/usr\/bin\/sisu)/ # remove bang from top #! (however file is stripped, so will be removed provided no content precedes it)
         data[0]=data[0].gsub(/^#!\s*\/usr\/bin\/sisu/,'').
           gsub(/^#!\s*\/usr\/bin\/env sisu/,'')
@@ -198,11 +197,10 @@ module SiSU_AO_MiscArrangeText
         data[0]=data[0].gsub(/^(SiSU\s*[\d.]*)$/,'% \1').
           gsub(/^(sisu-[\d.]+)$/,'% \1')
       end
-      data.each do |para|
+      data.each.map do |para|
         para=conditional_headings(para)
-        data_new << markup_blocks(para)
-      end
-      data_new=data_new.flatten
+        markup_blocks(para)
+      end.flatten
     end
   end
 end
index 31986a86a330d030f996bb0dcb9d056d2baf6fae..861bbf07794eaa5c001bb3f6a5d921e7119d30e1 100644 (file)
@@ -172,7 +172,6 @@ module SiSU_AO_Numbering
         gsub(/#{Mx[:gl_bullet]}/,'')
     end
     def auto_number_heading_ie_title(data)                                             #also does some segment naming
-      @tuned_file=[]
       if defined? @md.make.num_top \
       and @md.make.num_top \
       and @md.make.num_top !~/^$/
@@ -185,7 +184,7 @@ module SiSU_AO_Numbering
       end
       chapter_number_counter=0
       data=data.compact
-      data.each do |dob| #@md.seg_names << [additions to segment names]
+      @tuned_file=data.each.map do |dob| #@md.seg_names << [additions to segment names]
         title_no=nil
         if dob.is ==:heading \
         && dob.autonum_ \
@@ -274,9 +273,8 @@ module SiSU_AO_Numbering
           dob.tags=set_tags(dob.tags,dob.name)
         end
         dob.tags=dob.tags.uniq if defined? dob.tags
-        @tuned_file << dob
-      end
-      @tuned_file=@tuned_file.flatten
+        dob
+      end.flatten
     end
     def ocn(data)                                                                      #and auto segment numbering increment
       @tuned_file=SiSU_AO_DocumentStructureExtract::OCN.new(@md,data,@fnx,@process).ocn
@@ -287,10 +285,9 @@ module SiSU_AO_Numbering
       @tuned_file
     end
     def minor_numbering(data)                                                          #and auto segment numbering increment
-      @tuned_file=[]
       number_small,letter_small=0,0
       letter=%w( a b c d e f g h i j k l m n o p q r s t u v w x y z )
-      data.each do |dob|
+      @tuned_file=data.each.map do |dob|
         if dob.of ==:heading \
         || dob.of ==:heading_insert \
         || dob.of ==:para \
@@ -313,9 +310,8 @@ module SiSU_AO_Numbering
             end
           end
         end
-        @tuned_file << dob
-      end
-      @tuned_file=@tuned_file.flatten
+        dob
+      end.flatten
     end
     def leading_zeros_fixed_width_number(possible_seg_name)
       if possible_seg_name.to_s =~/^([0-9]+?\.|[0-9]+)$/m       #!~/[.,:-]+/
diff --git a/lib/sisu/current/ao_persist.rb b/lib/sisu/current/ao_persist.rb
new file mode 100644 (file)
index 0000000..72126c9
--- /dev/null
@@ -0,0 +1,194 @@
+# encoding: utf-8
+=begin
+
+* Name: SiSU
+
+** Description: documents, structuring, processing, publishing, search
+*** document abstraction
+
+** Author: Ralph Amissah
+  <ralph@amissah.com>
+  <ralph.amissah@gmail.com>
+
+** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+  2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 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>
+
+** Git
+  <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
+  <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/ao_persist.rb;hb=HEAD>
+
+=end
+module SiSU_AO_Persist
+  class Persist
+    @@persistance=nil
+    attr_accessor :fns, :ao_arr, :idx_arr_sst, :idx_arr_tex, :idx_arr_html, :idx_arr_xhtml, :map_arr_nametags, :map_arr_ocn_htmlseg
+    def initialize(args=nil)
+      @@persistance=args=(args ? args : (@@persistance || persist_init_hash_values))
+      @fns=args[:fns]
+      @ao_arr=args[:ao_arr]
+      @idx_arr_sst=args[:idx_arr_sst]
+      @idx_arr_tex=args[:idx_arr_tex]
+      @idx_arr_html=args[:idx_arr_html]
+      @idx_arr_xhtml=args[:idx_arr_xhtml]
+      @map_arr_nametags=args[:map_arr_nametags]
+      @map_arr_ocn_htmlseg=args[:map_arr_ocn_htmlseg]
+    end
+    def fns
+      @fns
+    end
+    def ao_arr
+      @ao_arr
+    end
+    def idx_arr_sst
+      @idx_arr_sst
+    end
+    def idx_arr_tex
+      @idx_arr_tex
+    end
+    def idx_arr_html
+      @idx_arr_html
+    end
+    def idx_arr_xhtml
+      @idx_arr_xhtml
+    end
+    def map_arr_nametags
+      @map_arr_nametags
+    end
+    def map_arr_ocn_htmlseg
+      @map_arr_ocn_htmlseg
+    end
+    def persist_init_hash_values
+      {
+        fns:                 nil,
+        ao_arr:              [],
+        idx_arr_sst:         [],
+        idx_arr_tex:         [],
+        idx_arr_html:        [],
+        idx_arr_xhtml:       [],
+        map_arr_nametags:    [],
+        map_arr_ocn_htmlseg: [],
+      }
+    end
+    def persist_init
+      @@persistance=nil
+      Persist.new(persist_init_hash_values)
+    end
+  end
+  class PersistDocStructExt
+    @@persist=nil
+    attr_accessor :ocn, :lng, :lng_is, :code, :lngsyn, :poem, :block, :box, :group, :alt, :quote, :table, :table_to
+    def initialize(args=nil)
+      @@persist=args=(args ? args : (@@persist || persist_init_hash_values))
+      @ocn=args[:ocn]
+      @lng=args[:lng]
+      @lng_is=args[:lng_is]
+      @code=args[:code]
+      @lngsyn=args[:lngsyn]
+      @poem=args[:poem]
+      @block=args[:block]
+      @box=args[:box]
+      @group=args[:group]
+      @alt=args[:alt]
+      @quote=args[:quote]
+      @table=args[:table]
+      @table_to=args[:table_to]
+    end
+    def ocn
+      @ocn
+    end
+    def lng
+      @lng
+    end
+    def lng_is
+      @lng_is
+    end
+    def code
+      @code
+    end
+    def lngsyn
+      @lngsyn
+    end
+    def poem
+      @poem
+    end
+    def block
+      @block
+    end
+    def box
+      @box
+    end
+    def group
+      @group
+    end
+    def alt
+      @alt
+    end
+    def quote
+      @quote
+    end
+    def table
+      @table
+    end
+    def table_to
+      @table_to
+    end
+    def persist_init_hash_values
+      {
+        ocn:         :on,
+        lng:         :off,
+        lng_is:      :doc_default,
+        code:        :off,
+        lngsyn:      :txt,
+        poem:        :off,
+        block:       :off,
+        box:         :off,
+        group:       :off,
+        alt:         :off,
+        quote:       :off,
+        table:       :off,
+        table_to:    :off,
+      }
+    end
+    def persist_init
+      @@persist=nil
+      PersistDocStructExt.new(persist_init_hash_values)
+    end
+  end
+end
+__END__
diff --git a/lib/sisu/current/ao_references.rb b/lib/sisu/current/ao_references.rb
new file mode 100644 (file)
index 0000000..9a5e195
--- /dev/null
@@ -0,0 +1,502 @@
+# encoding: utf-8
+=begin
+
+* Name: SiSU
+
+** Description: documents, structuring, processing, publishing, search
+*** system environment, resource control and configuration details
+
+** Author: Ralph Amissah
+  <ralph@amissah.com>
+  <ralph.amissah@gmail.com>
+
+** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+  2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 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>
+
+** Git
+  <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
+  <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/ao_references.rb;hb=HEAD>
+
+=end
+module SiSU_AO_References
+  class Bibliography
+    def initialize(md,data)
+      @md,@data=md,data
+    end
+    def sort_bibliography_array_by_author_year_title(bib)
+      if bib
+        bib.compact.sort_by do |c|
+          [c[:author_arr][0],c[:year],c[:title]]
+        end
+      end
+    end
+    def citation_in_prepared_bibliography(cite)
+      @cite=cite
+      def article
+        {
+           is:         :article,
+           author_raw: nil,
+           author:     nil,
+           author_arr: nil,
+           title:      nil,
+           language:   nil,
+           journal:    nil,
+           volume:     nil,
+           editor:     nil,
+           year:       nil,
+           where:      nil,
+           url:        nil,
+           note:       nil,
+           short_name: nil,
+           id:         nil,
+        }
+      end
+      def book
+        {
+           is:         :book,
+           author_raw: nil,
+           author:     nil,
+           author_arr: nil,
+           #editor:     nil,
+           title:      nil,
+           subtitle:   nil,
+           fulltitle:  nil,
+           language:   nil,
+           publisher:  nil,
+           edition:    nil,
+           year:       nil,
+           where:      nil,
+           url:        nil,
+           note:       nil,
+           short_name: nil,
+           id:         nil,
+        }
+      end
+      def citation_metadata
+        type=if @cite =~/^jo: \S+/m
+          :article
+        elsif @cite =~/^au: \S+/m
+          :book
+        end
+        if type
+          citeblock=@cite.split("\n")
+          if type == :article
+            citation=article
+            citeblock.select do |meta|
+              case meta
+              when /^((?:au|author):\s+)\S+/ #req
+                citation[:author_raw]=/^#{$1}(.+)/.match(meta)[1]
+              when /^((?:ti|title):\s+)\S+/ #req
+                citation[:title]=/^#{$1}(.+)/.match(meta)[1]
+              when /^((?:lng|language):\s+)\S+/
+                citation[:language]=/^#{$1}(.+)/.match(meta)[1]
+              when /^((?:jo|journal):\s+)\S+/ #req?
+                citation[:journal]=/^#{$1}(.+)/.match(meta)[1]
+              when /^((?:vo|volume):\s+)\S+/
+                citation[:volume]=/^#{$1}(.+)/.match(meta)[1]
+              when /^((?:edr|editor):\s+)\S+/
+                citation[:editor]=/^#{$1}(.+)/.match(meta)[1]
+              when /^((?:yr|year):\s+)\S+/ #req?
+                citation[:year]=/^#{$1}(.+)/.match(meta)[1]
+              when /^((?:pst|publisher_state):\s+)\S+/
+                citation[:where]=/^#{$1}(.+)/.match(meta)[1]
+              when /^(url:\s+)\S+/
+                citation[:url]=/^#{$1}(.+)/.match(meta)[1]
+              when /^(note:\s+)\S+/
+                citation[:note]=/^#{$1}(.+)/.match(meta)[1]
+              when /^((?:sn|shortname):\s+)\S+/
+                citation[:short_name]=/^#{$1}(.+)/.match(meta)[1]
+              when /^(id:\s+)\S+/
+                citation[:id]=/^#{$1}(.+)/.match(meta)[1]
+              end
+            end
+          end
+          if type == :book
+            citation=book
+            citeblock.select do |meta|
+              case meta
+              when /^((?:au|author):\s+)\S+/ #req
+                citation[:author_raw]=/^#{$1}(.+)/.match(meta)[1]
+              when /^((?:ti|title):\s+)\S+/ #req
+                citation[:title]=/^#{$1}(.+)/.match(meta)[1]
+              when /^((?:st|subtitle):\s+)\S+/
+                citation[:subtitle]=/^#{$1}(.+)/.match(meta)[1]
+              when /^((?:lng|language):\s+)\S+/
+                citation[:language]=/^#{$1}(.+)/.match(meta)[1]
+              when /^((?:pb|publisher):\s+)\S+/
+                citation[:publisher]=/^#{$1}(.+)/.match(meta)[1]
+              when /^((?:edn|edition):\s+)\S+/
+                citation[:edition]=/^#{$1}(.+)/.match(meta)[1]
+              when /^((?:yr|year):\s+)\S+/ #req?
+                citation[:year]=/^#{$1}(.+)/.match(meta)[1]
+              when /^((?:pst|publisher_state):\s+)\S+/
+                citation[:where]=/^#{$1}(.+)/.match(meta)[1]
+              when /^(url:\s+)\S+/
+                citation[:url]=/^#{$1}(.+)/.match(meta)[1]
+              when /^(note:\s+)\S+/
+                citation[:note]=/^#{$1}(.+)/.match(meta)[1]
+              when /^((?:sn|shortname):\s+)\S+/
+                citation[:short_name]=/^#{$1}(.+)/.match(meta)[1]
+              when /^(id:\s+)\S+/
+                citation[:id]=/^#{$1}(.+)/.match(meta)[1]
+              end
+            end
+          end
+          if citation[:is]==:book
+            if citation[:subtitle]
+              citation[:fulltitle] = citation[:title] \
+              + ' - ' \
+              + citation[:subtitle]
+            else
+              citation[:fulltitle] = citation[:title]
+            end
+          end
+          citation[:author_arr]=citation[:author_raw].split(/;\s*/)
+          citation[:author]=citation[:author_arr].map do |author|
+            author.gsub(/(.+?),\s+(.+)/,'\2 \1').strip
+          end.join(', ').strip
+          unless citation[:short_name]
+            citation[:short_name]=%{#{c[:author]}, "#{c[:short_name]}" (#{c[:date]})}
+          end
+        end
+        citation
+      end
+      self
+    end
+    def biblio_extraction
+      bibliography=[]
+      biblioflag=false
+      code_flag=false
+      flag_code_curly=:not_code_curly
+      flag_code_tics=:not_code_tics
+      @data=@data.select do |t_o|
+        if t_o =~/^code\{/
+          flag_code_curly=:code_curly
+        elsif t_o =~/^\}code/
+          flag_code_curly=:not_code_curly
+        elsif t_o =~/^``` code/
+          flag_code_tics=:code_tics
+        elsif flag_code_tics ==:code_tics \
+        and t_o =~/^```/
+          flag_code_tics=:not_code_tics
+        end
+        code_flag=if flag_code_curly==:code_curly \
+        or flag_code_tics==:code_tics
+          true
+        else false
+        end
+        unless code_flag
+          if @md.flag_auto_biblio
+            if t_o =~/^1~biblio(?:graphy)?/
+              biblioflag = true
+              t_o
+            elsif t_o =~/^:?[B-D1]~/
+              biblioflag = false
+              t_o
+            elsif biblioflag
+              if t_o !~/\A%+ /
+                bibliography << citation_in_prepared_bibliography(t_o).citation_metadata
+                next
+              else
+                t_o
+              end
+            else t_o
+            end
+          elsif @md.flag_biblio
+            if t_o =~/^1~biblio(?:graphy)?/
+              biblioflag = true
+              next
+            elsif t_o =~/^:?[B-D]~/
+              next
+            elsif t_o =~/^:?[B-D1]~/
+              biblioflag = false
+              t_o
+            elsif biblioflag
+              if t_o !~/\A%+ /
+                bibliography << t_o
+                next
+              else
+                t_o
+              end
+            else t_o
+            end
+          else t_o
+          end
+        else t_o
+        end
+      end.compact
+      if @md.flag_auto_biblio \
+      and bibliography.length > 0
+        data_new=[]
+        bibliography=sort_bibliography_array_by_author_year_title(bibliography)
+        @data.select do |t_o|
+          if t_o =~/^1~biblio(?:graphy)?/
+            bibliography.each do  |c|
+              if c[:is]==:book
+                <<-WOK
+
+!_ #{c[:author]}
+/{"#{c[:fulltitle]}"}/ #{c[:publisher]} (#{c[:year]})
+                WOK
+              elsif c[:is]==:article
+                <<-WOK
+
+!_ #{c[:author]}
+/{"#{c[:title]}"}/ #{c[:journal]} (#{c[:year]})
+                WOK
+              end
+            end
+          else data_new << t_o
+          end
+        end
+        @data=data_new
+      end
+      [@data,bibliography]
+    end
+  end
+  class Citations
+    def initialize(md='',data='')
+      @md,@data=md,data
+      #@biblio=[]
+    end
+    def songsheet
+      tuned_file,citations=citations_scan(@data)
+      [tuned_file,citations]
+    end
+    def sort_bibliography_array_by_author_year(bib)
+      bib.sort_by do |c|
+        [c[:author_raw],c[:year]]
+        #[c[:author_arr][0],c[:year],c[:title]]
+      end
+    end
+    def citations_regex
+      def pages_pattern
+        %r{(?:[,.:]?\s+(?:p{1,2}\.?\s+)?(?:\d+--?\d+)[,.]?\s+)?}
+      end
+      def editor_pattern
+        %r{(?<editor>(?:editor|edited by)\s+.+?)}
+      end
+      def year_pattern
+        %r{[(\[]?(?<year>\d{4})[\])]?[.,]?}
+      end
+      def authors_year_title_publication_editor_pages
+        /(?<authors>.+?)\s+#{year_pattern}\s+"(?<title>.+?)"\s+(?:#{Mx[:fa_italics_o]}|#{Mx[:srcrgx_italics_o]})(?<publication>.+?)(?:#{Mx[:fa_italics_c]}|#{Mx[:srcrgx_italics_c]})\s+#{editor_pattern}#{pages_pattern}/m # note ed. is usually edition rather than editor
+      end
+      def authors_title_publication_year_editor_pages
+        /(?<authors>.+?)\s+"(?<title>.+?)"\s+(?:#{Mx[:fa_italics_o]}|#{Mx[:srcrgx_italics_o]})(?<publication>.+?)(?:#{Mx[:fa_italics_c]}|#{Mx[:srcrgx_italics_c]})\s+#{year_pattern}\s+#{editor_pattern}#{pages_pattern}/m # note ed. is usually edition rather than editor
+      end
+      def authors_title_publication_editor_year_pages ###
+        /(?<authors>.+?)\s+"(?<title>.+?)"\s+(?:#{Mx[:fa_italics_o]}|#{Mx[:srcrgx_italics_o]})(?<publication>.+?)(?:#{Mx[:fa_italics_c]}|#{Mx[:srcrgx_italics_c]})\s+ed.\s+#{editor_pattern}#{year_pattern}#{pages_pattern}/m
+ # note ed. is usually edition rather than editor
+      end
+      def authors_title_publication_editor_pages_year ###
+        /(?<authors>.+?)\s+"(?<title>.+?)"\s+(?:#{Mx[:fa_italics_o]}|#{Mx[:srcrgx_italics_o]})(?<publication>.+?)(?:#{Mx[:fa_italics_c]}|#{Mx[:srcrgx_italics_c]})\s+#{editor_pattern}#{pages_pattern}#{year_pattern}/m # note ed. is usually edition rather than editor
+      end
+      def authors_year_title_publication_pages
+        /(?<authors>.+?)\s+#{year_pattern}\s+"(?<title>.+?)"\s+(?:#{Mx[:fa_italics_o]}|#{Mx[:srcrgx_italics_o]})(?<publication>.+?)(?:#{Mx[:fa_italics_c]}|#{Mx[:srcrgx_italics_c]})[,.;]?#{pages_pattern}/m
+      end
+      def authors_title_publication_year_pages
+        /(?<authors>.+?)\s+"(?<title>.+?)"\s+(?:#{Mx[:fa_italics_o]}|#{Mx[:srcrgx_italics_o]})(?<publication>.+?)(?:#{Mx[:fa_italics_c]}|#{Mx[:srcrgx_italics_c]})\s+#{year_pattern}\s+#{pages_pattern}/m
+      end
+      def authors_title_publication_pages_year ###
+        /(?<authors>.+?)\s+"(?<title>.+?)"\s+(?:#{Mx[:fa_italics_o]}|#{Mx[:srcrgx_italics_o]})(?<publication>.+?)(?:#{Mx[:fa_italics_c]}|#{Mx[:srcrgx_italics_c]})#{pages_pattern}#{year_pattern}/m
+      end
+      def authors_year_publication_pages
+        /(?<authors>.+?)\s+#{year_pattern}\s+(?:#{Mx[:fa_italics_o]}|#{Mx[:srcrgx_italics_o]})(?<publication>.+?)(?:#{Mx[:fa_italics_c]}|#{Mx[:srcrgx_italics_c]})#{pages_pattern}/m
+      end
+      def authors_publication_year_pages
+        /(?<authors>.+?)\s+(?:#{Mx[:fa_italics_o]}|#{Mx[:srcrgx_italics_o]})(?<publication>.+?)(?:#{Mx[:fa_italics_c]}|#{Mx[:srcrgx_italics_c]})[,.;]?\s+(?<publisher>.+?)?#{year_pattern}#{pages_pattern}[.;]?/m
+      end
+      self
+    end
+    def authors?(citations)
+      citations.each.map do |b|
+        if b =~ /^.+\s+::.+?:$/
+          c=/^(?<citation>.+?)\s+::(?<shortref>.+?):$/.match(b)
+          {
+            citation: c[:citation],
+            shortref: c[:shortref],
+            c[:shortref].to_s => c[:citation]
+          }
+        else { citation: b }
+        end
+      end
+    end
+    def long_and_short_ref?(citations) #could be useful, keep ... ectract shortref
+      citations.each.map do |b|
+        if b =~ /^.+\s+::.+?:$/
+          c=/^(?<citation>.+?)\s+::(?<shortref>.+?):$/.match(b)
+          {
+            citation: c[:citation],
+            shortref: c[:shortref],
+            c[:shortref].to_s => c[:citation]
+          }
+        else { citation: b }
+        end
+      end
+    end
+    def citation_detail(citations) #could be useful, keep ... extract shortref
+      bibahash=[]
+      number=0
+      missed=0
+      citations.select do |b|
+        z=if b =~citations_regex.authors_year_title_publication_editor_pages
+          c=citations_regex.authors_year_title_publication_editor_pages.match(b)
+          {
+            is: :article,
+            author_raw: c[:authors],
+            year: c[:year],
+            title: c[:title],
+            publication: c[:publication],
+            editor: c[:editor],
+          }
+        elsif b =~citations_regex.authors_title_publication_year_editor_pages
+          c=citations_regex.authors_title_publication_year_editor_pages.match(b)
+          {
+            is: :article,
+            author_raw: c[:authors],
+            year: c[:year],
+            title: c[:title],
+            publication: c[:publication],
+            editor: c[:editor],
+          }
+        elsif b =~citations_regex.authors_title_publication_editor_year_pages
+          c=citations_regex.authors_title_publication_editor_year_pages.match(b)
+          {
+            is: :article,
+            author_raw: c[:authors],
+            year: c[:year],
+            title: c[:title],
+            publication: c[:publication],
+            editor: c[:editor],
+          }
+        elsif b =~citations_regex.authors_title_publication_editor_pages_year
+          c=citations_regex.authors_title_publication_editor_pages_year.match(b)
+          {
+            is: :article,
+            author_raw: c[:authors],
+            year: c[:year],
+            title: c[:title],
+            publication: c[:publication],
+            editor: c[:editor],
+          }
+        elsif b =~citations_regex.authors_year_title_publication_pages
+          c=citations_regex.authors_year_title_publication_pages.match(b)
+          {
+            is: :article,
+            author_raw: c[:authors],
+            year: c[:year],
+            title: c[:title],
+            publication: c[:publication],
+          }
+        elsif b =~citations_regex.authors_title_publication_year_pages
+          c=citations_regex.authors_title_publication_year_pages.match(b)
+          {
+            is: :article,
+            author_raw: c[:authors],
+            year: c[:year],
+            title: c[:title],
+            publication: c[:publication],
+          }
+        elsif b =~citations_regex.authors_year_publication_pages
+          c=citations_regex.authors_year_publication_pages.match(b)
+          {
+            is: :book,
+            author_raw: c[:authors],
+            year: c[:year],
+            publication: c[:publication],
+          }
+        elsif b =~citations_regex.authors_publication_year_pages
+          c=citations_regex.authors_publication_year_pages.match(b)
+          {
+            is: :book,
+            author_raw: c[:authors],
+            year: c[:year],
+            publication: c[:publication],
+          }
+        else b
+        end
+        if not z.is_a?(NilClass) \
+        and z.is_a?(Hash) \
+        and z[:author_raw].length > 0
+          z[:author_arr]=z[:author_raw].split(/;\s*/)
+          z[:author]=z[:author_arr].map do |author|
+            author.gsub(/(.+?),\s+(.+)/,'\2 \1').strip
+          end.join(', ').strip
+          if @md.opt.act[:verbose_plus][:set]==:on \
+          || @md.opt.act[:maintenance][:set]==:on
+            number +=1 if z.is_a?(Hash)
+            missed +=1 if z.is_a?(String)
+            (z.is_a?(Hash)) \
+            ? (p '[' + number.to_s + '] ' + z.to_s)
+            : (p '<' + missed.to_s + '> ' + z.to_s)
+          end
+        end
+        bibahash << z if z.is_a?(Hash)
+      end
+      bibahash=sort_bibliography_array_by_author_year(bibahash.compact)
+      bibahash
+    end
+    def citations_scan(data)
+      citations=[]
+      #short_ref=[]
+      tuned_file = data.compact.select do |dob|
+        if dob.is !=:meta \
+        && dob.is !=:comment \
+        && dob.is !=:code \
+        && dob.is !=:table
+          if dob.obj =~/\.:.+?:\./
+            citations << dob.obj.scan(/\.:\s*(.+?)\s*:\./m)
+            #short_ref << dob.obj.scan(/\.:\s+(.+?)\s+::([^:]+)::\./m) #look at later
+            ##short_ref << dob.obj.scan(/\.:\s+(.+?)\s+::(.+?)::\./m) #look at later
+            #short_ref << dob.obj.scan(/\.:\s*(.+?)\s*(::(.+?):)?:\./m) #look at later
+            citations=citations.flatten.compact
+            dob.obj=dob.obj.   #remove citations delimiter & helpers from text
+              gsub(/\.:|:\./,'')
+          end
+        end
+        dob if dob.is_a?(Object)
+      end
+      #bib=long_and_short_ref?(citations) #could be useful, keep ... extract shortref
+      citations=citation_detail(citations)
+      [tuned_file,citations]
+    end
+  end
+end
+__END__
index 554daae592bd738b2545d8cdd44725856aea503f..c310866859564e5e5b5e2ddf8de69b49e92b8357 100644 (file)
@@ -61,8 +61,8 @@ module SiSU_AO_Syntax
     end
   end
   class Markup
-    def initialize(md='',data='')
-      @md,@data=md,data
+    def initialize(md='',data='',biblio=[])
+      @md,@data,@bibliography=md,data,biblio
       @data_new=[]
       url_and_stub=SiSU_Env::InfoEnv.new.url
       @output_url="#{url_and_stub.remote}"
@@ -221,6 +221,24 @@ module SiSU_AO_Syntax
     end
     def substitutions(dob)
       dob=dob.dup
+      dob=if @md.flag_auto_biblio \
+      and @bibliography.length > 0
+        dob=if dob.is !=:meta \
+        && dob.is !=:heading_insert \
+        && dob.is !=:code \
+        && dob.is !=:comment \
+        && dob.is !=:table
+          @bibliography.each do |c|
+            if c[:id] and not c[:id].nil? and not c[:id].empty?
+              dob.obj=dob.obj.gsub(/#{c[:id]}/mi,c[:short_name])
+            end
+          end
+          dob
+        else dob
+        end
+        dob
+      else dob
+      end
       dob=if defined? @md.substitution_match_list[:match_and_replace] \
       and @md.substitution_match_list[:match_and_replace].is_a?(Array)
         dob=if dob.is !=:meta \
index 94f6126e384a9bac0eaefbca8e1bed83fdca9c8d..62bec0412484ee6b716a0c1067e7ed2fe19cdd9a 100644 (file)
@@ -537,14 +537,14 @@ module SiSU_CGI_SQL
 <!-- SiSU Rights -->
   <p class="tiny_left"><font color="#666666" size="2">
     Generated by
-      #{v[:project]} #{v[:version]} #{v[:date]} (#{v[:date_stamp]})
+      #{v.project} #{v.version} #{v.date} (#{v.date_stamp})
     <br>
     <a href="http://www.sisudoc.org" >
-    <b>#{v[:project]}</b></a> <sup>&copy;</sup> Ralph Amissah
+    <b>#{v.project}</b></a> <sup>&copy;</sup> Ralph Amissah
     1993, current 2014.
     All Rights Reserved.
     <br>
-      #{v[:project]} is software for document structuring, publishing and search,
+      #{v.project} is software for document structuring, publishing and search,
     <br>
     <a href="http://www.jus.uio.no/sisu" >
       www.jus.uio.no/sisu
@@ -574,7 +574,7 @@ module SiSU_CGI_SQL
   </font></p>
 </td><td valign="top" width="45%">
   <p class="tiny_left"><font color="#666666" size="2">
-    #{v[:project]} using:
+    #{v.project} using:
     <br>Standard SiSU markup syntax,
     <br>Standard SiSU meta-markup syntax, and the
     <br>Standard SiSU <u>object citation numbering</u> and system, (object/text identifying/locating system)
@@ -601,7 +601,7 @@ module SiSU_CGI_SQL
   </font></p>
 </td><td valign="top" width="45%">
   <p class="tiny_left"><font color="#666666" size="2">
-    #{v[:project]}, developed using
+    #{v.project}, developed using
     <a href="http://www.ruby-lang.org/en/">
       Ruby
     </a>
@@ -908,13 +908,11 @@ module SiSU_CGI_SQL
                     else nil
                     end
                     @search_regx=if unescaped_search                                     #check
-                      search_regex=[]
-                      build=unescaped_search.scan(/\S+/).each do |g|
+                      search_regex=unescaped_search.scan(/\S+/).each.map do |g|
                          (g.to_s =~/(AND|OR)/) \
-                         ? (search_regex << '|')
-                         : (search_regex << %{#{g.to_s}})
-                      end
-                      search_regex=search_regex.join(' ')
+                         ? ('|')
+                         : (%{#{g.to_s}})
+                      end.join(' ')
                       search_regex=search_regex.gsub(/\s*\|\s*/,'|')
                       Regexp.new(search_regex, Regexp::IGNORECASE)
                     else nil
index 7a23027d272a91bb068f46de6304f1683bb3cf2a..175c2e708800851b501427b0804f89907c941063 100644 (file)
@@ -62,6 +62,7 @@ Sfx={
   txt_asciidoc:              '.ad',
   txt_markdown:              '.md',
   txt_rst:                   '.rst',
+  txt_orgmode:               '.org',
   html:                      '.html',
   xhtml:                     '.xhtml',
   xml:                       '.xml',
@@ -146,6 +147,26 @@ Mx={
   sm_set_o:                  '◢',          sm_set_c:            '◣',
   sm_subset_o:               '◢',          sm_subset_c:         '◣',
   vline:                     '┆',                                              #  ¦ |
+  src_bold_o:                '!{',    src_bold_c:               '}!',
+  src_italics_o:             '/{',    src_italics_c:            '}/',
+  src_underscore_o:          '_{',    src_underscore_c:         '}_',
+  src_cite_o:                '"{',    src_cite_c:               '}"',
+  src_insert_o:              '+{',    src_insert_c:             '}+',
+  src_strike_o:              '-{',    src_strike_c:             '}-',
+  src_superscript_o:         '^{',    src_superscript_c:        '}^',
+  src_subscript_o:           ',{',    src_subscript_c:          '}',
+  src_hilite_o:              '*{',    src_hilite_c:             '}*',
+  src_monospace_o:           '#{',    src_monospace_c:          '}#',
+  srcrgx_bold_o:             '\!\{',   srcrgx_bold_c:           '\}\!',
+  srcrgx_italics_o:          '\/\{',   srcrgx_italics_c:        '\}\/',
+  srcrgx_underscore_o:       '_\{',    srcrgx_underscore_c:     '\}_',
+  srcrgx_cite_o:             '"\{',    srcrgx_cite_c:           '\}"',
+  srcrgx_insert_o:           '\+\{',   srcrgx_insert_c:         '\}\+',
+  srcrgx_strike_o:           '\-\{',   srcrgx_strike_c:         '\}\-',
+  srcrgx_superscript_o:      '\^\{',   srcrgx_superscript_c:    '\}\^',
+  srcrgx_subscript_o:        ',\{',    srcrgx_subscript_c:      '\},',
+  srcrgx_hilite_o:           '\*\{',   srcrgx_hilite_c:         '\}\*',
+  srcrgx_monospace_o:        '\#\{',   srcrgx_monospace_c:      '\}\#',
 }
 Mx[:fa_bold_o]=              "#{Mx[:fa_o]}b#{Mx[:fa_o_c]}"
 Mx[:fa_bold_c]=              "#{Mx[:fa_c_o]}b#{Mx[:fa_c]}"
@@ -220,16 +241,6 @@ Px={
   subscript_o:               '[',          subscript_c:              ']',
   hilite_o:                  '*',          hilite_c:                 '*',
   monospace_o:               '',           monospace_c:              '',
-  po_bold_o:                 '!{',         po_bold_c:                '}!',
-  po_italics_o:              '/{',         po_italics_c:             '}/',
-  po_underscore_o:           '_{',         po_underscore_c:          '}_',
-  po_cite_o:                 '"{',         po_cite_c:                '}"',
-  po_insert_o:               '+{',         po_insert_c:              '}+',
-  po_strike_o:               '-{',         po_strike_c:              '}-',
-  po_superscript_o:          '^{',         po_superscript_c:         '}^',
-  po_subscript_o:            ',{',         po_subscript_c:           '},',
-  po_hilite_o:               '*{',         po_hilite_c:              '}*',
-  po_monospace_o:            '#{',         po_monospace_c:           '}#',
   lng_lst:                   SiSU_is.language_list?,
   lng_lst_rgx:               SiSU_is.language_list_regex?,
   lv1:                       '*',
@@ -352,7 +363,7 @@ check:
  #˝ " λ Ω  β α π Ѫ Ж Я Ѳ ѳ Ф ✠ ㈣
  Ѳ  ѳ   Ф
  ♩ ♭   ✠   ▭  ▬  ▪
-【】〖〗◢ ◣ ◀ ▶ ◘ ◙
+【】〖〗◢ ◣ ◀ ▶ ◘ ◙ « ▲ »
 《》「」
  ‹ › ∗  ∴ ∷
 '〔lv1〕','〔lv2〕','〔lv3〕','〔lv4〕','〔lv5〕','〔lv6〕','〔lv7〕','〔lv8〕','〔lv9〕'
index acdae9da696cb8ca1fcc5a0ab6b1cbe911d18608..b90a81e520fed11fd585cb892197be3e35c7255d 100644 (file)
 
 =end
 module SiSU_DbDrop
+  require_relative 'utils_response'                   # utils_response.rb
   class Drop
-    require_relative 'utils_response'                   # utils_response.rb
+    include SiSU_Response
     def initialize(opt,conn,db_info,sql_type)
       @opt,@conn,@db_info,@sql_type=opt,conn,db_info,sql_type
-      @ans=SiSU_Response::Response.new
       case @sql_type
       when :sqlite
         cascade=''
@@ -82,7 +82,7 @@ module SiSU_DbDrop
           case @sql_type
           when :sqlite
             puts msg_sqlite
-            ans=@ans.response?('remove sql database?')
+            ans=response?('remove sql database?')
             if ans \
             and File.exist?(@db_info.sqlite.db)
               @conn.close
@@ -133,7 +133,7 @@ module SiSU_DbDrop
         rescue
           case @sql_type
           when :sqlite
-            ans=@ans.response?('remove sql database?')
+            ans=response?('remove sql database?')
             if ans and File.exist?(@db_info.sqlite.db); File.unlink(@db_info.sqlite.db)
             end
           else
index a307dc1db9de377d036410ad7d94c5cb316a40dc..de717cc6cd7247794844f7fbf645839c82606a9d 100644 (file)
@@ -66,9 +66,9 @@ module SiSU_DbText
         gsub(/#{Mx[:lnk_o]}\s*(.+?)\s*#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/m,'\1')
     end
     def clean_searchable_text_from_document_objects(arr)
-      txt_arr,en=[],[]
+      en=[]
       arr=(arr.is_a?(String)) ? [ arr ] : arr
-      arr.each do |s|
+      txt_arr=arr.each.map do |s|
         s=s.gsub(/#{Mx[:fa_o]}[a-z]{1,4}#{Mx[:fa_o_c]}/m,'').
             gsub(/#{Mx[:fa_c_o]}[a-z]{1,4}#{Mx[:fa_c]}/m,'').
             gsub(/<br>/m,' ')
@@ -77,25 +77,26 @@ module SiSU_DbText
           gsub(/#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/m,'').
           gsub(/ \s+/m,' ')
         #p s if s =~/[^ \nA-Za-z0-9'"`?!#@$%^&*=+,.;:\[\]()<>{}‹›|\\\/~_-]/
-        txt_arr << s
+        s
       end
       txt_arr=txt_arr << en
       txt=txt_arr.flatten.join("\n")
       special_character_escape(txt)
     end
     def clean_document_objects_body(arr)
-      txt_arr,en,en_arr=[],[],[]
+      en=[]
       arr=(arr.is_a?(String)) ? [ arr ] : arr
-      arr.each do |s|
+      txt_arr=arr.each.map do |s|
         en << s.scan(/#{Mx[:en_a_o]}\s*(.+?)\s*#{Mx[:en_a_c]}/m)
-        s=s.gsub(/#{Mx[:en_a_o]}\s*(\d+).+?#{Mx[:en_a_c]}/m,'<sup>\1</sup>').
+        s=s.
+          gsub(/#{Mx[:en_a_o]}\s*(\d+).+?#{Mx[:en_a_c]}/m,
+            '<sup>\1</sup>').
           gsub(/#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/m,'').
           gsub(/ \s+/m,' ')
-        txt_arr << s
+        s
       end
-      en.flatten.each do |e|
-        e=e.sub(/^(\d+)\s*/,'<sup>\1</sup> ')
-        en_arr << e
+      en_arr=en.flatten.each.map do |e|
+        e.sub(/^(\d+)\s*/,'<sup>\1</sup> ')
       end
       txt_arr=txt_arr << en_arr
       txt=txt_arr.flatten.join("\n<br>")
@@ -106,7 +107,8 @@ module SiSU_DbText
       arr=(arr.is_a?(String)) ? arr.split(/\n+/m) : arr
       arr.each do |s|
         s=s.gsub(/([*\/_-])\{(.+?)\}\1/m,'\2').
-          gsub(/^(?:block|group|poem|code)\{/m,'').gsub(/^\}(?:block|group|poem|code)/m,'').
+          gsub(/^(?:block|group|poem|code)\{/m,'').
+          gsub(/^\}(?:block|group|poem|code)/m,'').
           gsub(/\A(?:@\S+:\s+.+)\Z/m,'')
         if s =~/^:A~/
           if defined? @md.creator \
index 4cf058e7319dbc8e9466ec5d532fa7541f03e32d..85264771f284d4583a538d112e653dd284fb4edf 100644 (file)
@@ -132,8 +132,14 @@ module SiSU_Param
         @@md=@md
       else @@md
       end
-      @@md.opt=@opt
-      @@md
+      begin
+        @@md.opt=@opt
+        @@md
+      rescue
+        SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+          mark('has an existing option been selected?')
+        exit
+      end
     end
     class MdDefault
       def rights(author,date)
@@ -891,9 +897,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,: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
+      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,:project_details,: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_biblio,:flag_auto_biblio,: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=@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
+        @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_biblio=@flag_auto_biblio=@flag_endnotes=@flag_auto_endnotes=@flag_separate_endnotes=@flag_separate_endnotes_make=@sisu=@project_details=@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=
@@ -1008,22 +1014,35 @@ module SiSU_Param
           @fnstex=@fns.gsub(/_/,'\_\-').gsub(/\./,'.\-')
           @flag_endnotes,@flag_auto_endnotes,@flag_separate_endnotes=false,false,false
           @flag_separate_endnotes_make=true
+          @flag_biblio,@flag_auto_biblio=false,false
           ver=SiSU_Env::InfoVersion.instance
-          @sisu_version=ver.get_version
+          @project_details=ver.get_version
           @ruby_version=ver.rbversion
           @generated=Time.now
           fns_array=@data.dup
           skip unless fns_array                                                    # consider
           @code_flag=false
+          flag_code_curly=:not_code_curly
+          flag_code_tics=:not_code_tics
           fns_array.each do |para|                                               #% scan document
             if para !~/^%+\s/ \
             and para =~/<![abcdeghijklmnopqrstuvwxyz]/i # <!f not included
-              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"
+              raise "Old markup style in file #{@fns}, current version #{@project_details.project} #{@project_details.version} #{@project_details.date_stamp} #{@project_details.date}:\n\t\t#{para}\n\n"
+            end
+            if para =~/^code\{/
+              flag_code_curly=:code_curly
+            elsif para =~/^\}code/
+              flag_code_curly=:not_code_curly
+            elsif para =~/^``` code/
+              flag_code_tics=:code_tics
+            elsif flag_code_tics ==:code_tics \
+            and para =~/^```/
+              flag_code_tics=:not_code_tics
             end
-            @code_flag=case para
-            when /^code\{\s*$/ then true
-            when /^\}code\s*$/ then false
-            else                    @code_flag
+            @code_flag=if flag_code_curly==:code_curly \
+            or flag_code_tics==:code_tics
+              true
+            else false
             end
             regx_header=/^@\S+?:[+-]?\s/
             if para =~regx_header \
@@ -1196,6 +1215,16 @@ module SiSU_Param
                   %{#{title}#{creator}}
                 ).txt_grey if @opt.act[:verbose][:set]==:on
               end
+              unless @code_flag
+                if para =~/^1~biblio(?:graphy)?/
+                  @flag_auto_biblio,@flag_biblio=false,true
+                  #@flag_biblio=true
+                elsif @flag_biblio ==true \
+                and @flag_auto_biblio ==false \
+                and para =~/^(?:au|author):/m
+                  @flag_auto_biblio =true
+                end
+              end
               if not @book_idx \
               and para =~/^=\{(.+?)\}[\s`]*\Z/m
                 @book_idx=true
index 0ec3520b273b71b56fe5bee5d5615476a5c8380c..b8b5f106c037c640e2018f1c677cc95a02fc5200 100644 (file)
@@ -132,14 +132,22 @@ module SiSU_Git
       (found =~/bin\/git\b/) ? true : false
     end
     def make_dir_fnb
-      FileUtils::mkdir_p(@git_path[:fnb]) unless FileTest.directory?(@git_path[:fnb])
-      FileUtils::mkdir_p(@git_path[:doc]) unless FileTest.directory?(@git_path[:doc])
-      FileUtils::mkdir_p(@git_path[:po]) unless FileTest.directory?(@git_path[:po])
-      FileUtils::mkdir_p(@git_path[:pot]) unless FileTest.directory?(@git_path[:pot])
-      FileUtils::mkdir_p(@git_path[:conf]) unless FileTest.directory?(@git_path[:conf])
-      FileUtils::mkdir_p(@git_path[:image]) unless FileTest.directory?(@git_path[:image])
-      #FileUtils::mkdir_p(@git_path[:audio]) unless FileTest.directory?(@git_path[:audio])
-      #FileUtils::mkdir_p(@git_path[:video]) unless FileTest.directory?(@git_path[:video])
+      FileUtils::mkdir_p(@git_path[:fnb]) \
+        unless FileTest.directory?(@git_path[:fnb])
+      FileUtils::mkdir_p(@git_path[:doc]) \
+        unless FileTest.directory?(@git_path[:doc])
+      FileUtils::mkdir_p(@git_path[:po]) \
+        unless FileTest.directory?(@git_path[:po])
+      FileUtils::mkdir_p(@git_path[:pot]) \
+        unless FileTest.directory?(@git_path[:pot])
+      FileUtils::mkdir_p(@git_path[:conf]) \
+        unless FileTest.directory?(@git_path[:conf])
+      FileUtils::mkdir_p(@git_path[:image]) \
+        unless FileTest.directory?(@git_path[:image])
+      #FileUtils::mkdir_p(@git_path[:audio]) \
+      #  unless FileTest.directory?(@git_path[:audio])
+      #FileUtils::mkdir_p(@git_path[:video]) \
+      #  unless FileTest.directory?(@git_path[:video])
     end
     def git_init
       unless FileTest.directory?("#{@git_path[:fnb]}/.git")
@@ -168,13 +176,23 @@ module SiSU_Git
         p __LINE__
       end
       def copy_src_head
-        if @opt.f_pth[:lng]
-          FileUtils::cp_r("#{@env.path.pwd}/#{@opt.f_pth[:lng]}/#{@opt.fns}",@git_path[:doc])
+        if @opt.f_pth[:lng] \
+        and File.exist?("#{@env.path.pwd}/#{@opt.f_pth[:lng]}/#{@opt.fns}")
+          FileUtils::cp_r(
+            "#{@env.path.pwd}/#{@opt.f_pth[:lng]}/#{@opt.fns}",
+            @git_path[:doc]
+          )
         elsif @opt.fns =~/\.ssm\.sst/
           ssm=@opt.fns.gsub(/\.ssm\.sst/,'.ssm')
-          FileUtils::cp_r("#{@env.path.pwd}/#{ssm}",@git_path[:doc])
-        else
-          FileUtils::cp_r("#{@env.path.pwd}/#{@opt.fns}",@git_path[:doc])
+          FileUtils::cp_r(
+            "#{@env.path.pwd}/#{ssm}",
+            @git_path[:doc]
+          )
+        elsif File.exist?("#{@env.path.pwd}/#{@opt.fns}")
+          FileUtils::cp_r(
+            "#{@env.path.pwd}/#{@opt.fns}",
+            @git_path[:doc]
+          )
         end
       end
       def copy_related_sst_ssi
@@ -183,14 +201,21 @@ module SiSU_Git
         file_array=IO.readlines(@opt.fns,'')
         file_array.each do |f|
           if f =~@rgx_doc_import
-            doc_import = doc_import + f.scan(@rgx_doc_import).uniq.flatten
+            doc_import = doc_import \
+            + f.scan(@rgx_doc_import).uniq.flatten
           end
         end
         doc_import.each do |f|
           if @opt.f_pth[:lng]
-            FileUtils::cp_r("#{@env.path.pwd}/#{@opt.f_pth[:lng]}/#{f}",@git_path[:doc])
+            FileUtils::cp_r(
+              "#{@env.path.pwd}/#{@opt.f_pth[:lng]}/#{f}",
+              @git_path[:doc]
+            )
           else
-            FileUtils::cp_r("#{@env.path.pwd}/#{f}",@git_path[:doc])
+            FileUtils::cp_r(
+              "#{@env.path.pwd}/#{f}",
+              @git_path[:doc]
+            )
           end
         end
       end
@@ -200,10 +225,19 @@ module SiSU_Git
         and not @opt.act[:ao][:set]==:on
           ##SiSU_Assemble::Composite.new(@opt).read
           #SiSU_AO::Source.new(@opt).read                                         # -m
-          "#{@env.processing_path.composite_file}/#{@opt.fnb}.ssm.sst"
+          @env.processing_path.composite_file \
+          + '/' \
+          + @opt.fnb \
+          + '.ssm.sst'
         elsif composite_src
-          "#{@env.processing_path.composite_file}/#{@opt.fnb}.ssm.sst"
-        else "#{@env.path.pwd}/#{@opt.fns}"
+          @env.processing_path.composite_file \
+          + '/' \
+          + @opt.fnb \
+          + '.ssm.sst'
+        else
+          @env.path.pwd
+          + '/' \
+          + @opt.fns
         end
       end
       def read_composite
index 582773e518a8363a8ec62e34b0e39cd3fe19564a..3aab3be7da2456d81cdda40c95d4a268b78c9195 100644 (file)
@@ -165,11 +165,10 @@ module SiSU_HTML
           end
         end
         SiSU_Env::Clear.new(@opt.selections.str,@opt.fns,@md).param_instantiate
-        @@flag,@@scr,@@seg,@@seg_endnotes,@@seg_subtoc,@@seg_ad={},{},{},{},{},{}
-        @@seg_total,@@tracker,@@loop_count,@@tablehead,@@number_of_cols=0,0,0,0,0
-        @@seg_name,@@seg_name_html,@@seg_subtoc_array,@@seg_endnotes_array,@@segtocband,@@tablefoot=Array.new(7){[]}
-        @@filename_seg,@@seg_url,@@fn,@@to_lev4,@@get_hash_to,@@get_hash_fn='','','','','','',''
-        @@is4=@@is3=@@is2=@@is1=@@heading1=@@heading2=@@heading3=@@heading4=0
+        @@flag,@@scr,@@seg,@@seg_endnotes,@@seg_subtoc={},{},{},{},{}
+        @@tracker=0
+        @@seg_name,@@seg_name_x,@@seg_subtoc_array,@@seg_endnotes_array,@@tablefoot=Array.new(5){[]}
+        @@filename_seg,@@seg_url,@@to_lev4,@@get_hash_to,@@get_hash_fn='','','','',''
       end
     end
     private
@@ -262,8 +261,6 @@ module SiSU_HTML
       @@firstseg=nil
       def initialize(md=nil,data='')
         @data,@md=data,md
-        @ocn_html_identifier=
-          SiSU_Env::ProcessingSettings.new(@md).ocn_html_identifier
         @tell=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set]) if @md
       end
       def songsheet #extracts toc for scroll & seg
@@ -378,7 +375,7 @@ WOK
         title=if dob.ocn ==0 then linkname
         else
           @@toc[:scr] <<  '<br>'
-          %{<b><a href="##{@ocn_html_identifier}#{dob.ocn}">#{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)
@@ -420,7 +417,7 @@ WOK
           end
         else
           @@toc[:scr] <<  '<br>'
-          %{<b><a href="##{@ocn_html_identifier}#{dob.ocn}">#{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)
@@ -537,7 +534,7 @@ WOK
           }
           f=@md.file.base_filename.html_seg(fnh)
           p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn)
-          lnk_n_txt=%{  <a href="#{f}##{@ocn_html_identifier}#{ocn}">
+          lnk_n_txt=%{  <a href="#{f}##{ocn}">
     #{linkname}
   </a>}
           txt_obj={ txt: lnk_n_txt }
@@ -562,7 +559,7 @@ WOK
           }
           f=@md.file.base_filename.html_seg(fnh)
           p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn)
-          lnk_n_txt=%{  <a href="#{f}##{@ocn_html_identifier}#{ocn}">
+          lnk_n_txt=%{  <a href="#{f}##{ocn}">
   #{linkname}
 </a>}
           txt_obj={ txt: lnk_n_txt }
index 8f83219fddce8d11a6b4fb10f46347195db51cc1..b350170f35124b5f932f7d5e7ff118dfcce0a19c 100644 (file)
@@ -60,7 +60,6 @@ module SiSU_HTML_Format
     def initialize(md,ocn)
       @md,@ocn=md,ocn.to_s
       @ocn ||=''
-      @ocn_html_identifier=SiSU_Env::ProcessingSettings.new(@md).ocn_html_identifier
       @make=SiSU_Env::ProcessingSettings.new(@md)
     end
     def ocn_display
@@ -69,7 +68,7 @@ module SiSU_HTML_Format
         or @ocn.empty?
           ''
         else
-          %{<label class="ocn"><a href="##{@ocn_html_identifier}#{@ocn}" class="lnkocn">#{@ocn}</a></label>}
+          %{<label class="ocn"><a href="##{@ocn}" class="lnkocn">#{@ocn}</a></label>}
         end
       else
         ''
@@ -84,10 +83,12 @@ module SiSU_HTML_Format
       end
     end
     def id #w3c? "tidy" complains about numbers as identifiers ! annoying
-      (@ocn==nil || @ocn.empty?) ? '' : %{id="#{Mx[:ocn_id_char]}#{@ocn}"}
+      (@ocn==nil || @ocn.empty?) \
+      ? '' : %{id="#{Mx[:ocn_id_char]}#{@ocn}"}
     end
     def goto
-      (@ocn==nil || @ocn.empty?) ? '' : %{<a href="##{@ocn_html_identifier}#{@ocn}">}
+      (@ocn==nil || @ocn.empty?) \
+      ? '' : %{<a href="##{@ocn}">}
     end
   end
   class HeadInformation
@@ -99,8 +100,9 @@ module SiSU_HTML_Format
       @md=md
       # DublinCore 1 - title
       @bits=SiSU_Proj_HTML::Bits.new
-      @seg_name_html=(SiSU_HTML::Source::Seg.new.seg_name_html || [])
-      @seg_name_html_tracker=(SiSU_HTML::Source::Seg.new.seg_name_html_tracker || [])
+      @per=SiSU_HTML_Persist::Persist.new
+      @per.seg_name_x=SiSU_HTML::Seg.new.seg_name_x
+      @per.seg_name_x_tracker=SiSU_HTML::Seg.new.seg_name_x_tracker
       @tocband_scroll,@tocband_segtoc=nil,nil
       @stylesheet=SiSU_Style::CSS_HeadInfo.new(md).stylesheet
       @o_str ||=SiSU_Env::ProcessingSettings.new(md).output_dir_structure
@@ -403,7 +405,7 @@ WOK
 <head>
   <meta charset="utf-8">
   <title>
-    #{@md.html_title}
+    #{@md.title.full}
   </title>
 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
 #{rdf.metatag_html}
@@ -615,9 +617,9 @@ WOK
       super(md)
     end
     def dot_control_pre_next
-      pre="#{@seg_name_html[@seg_name_html_tracker-1]}#{@md.lang_code_insert}#{Sfx[:html]}"
+      pre="#{@per.seg_name_x[@per.seg_name_x_tracker-1]}#{@md.lang_code_insert}#{Sfx[:html]}"
       up=@toc
-      nxt="#{@seg_name_html[@seg_name_html_tracker+1]}#{@md.lang_code_insert}#{Sfx[:html]}"
+      nxt="#{@per.seg_name_x[@per.seg_name_x_tracker+1]}#{@md.lang_code_insert}#{Sfx[:html]}"
       if nxt=~/sisu_manifest\.html/
         @file=SiSU_Env::FileOp.new(@md) if @md
         if @file.output_dir_structure.by_language_code? \
@@ -643,7 +645,7 @@ WOK
 #{the_table_close}}
     end
     def dot_control_pre
-      pre="#{@seg_name_html[@seg_name_html_tracker-2]}#{@md.lang_code_insert}#{Sfx[:html]}"
+      pre="#{@per.seg_name_x[@per.seg_name_x_tracker-2]}#{@md.lang_code_insert}#{Sfx[:html]}"
       up=@toc
       nxt="#{@md.file.base_filename.html_segtoc}"
       %{<table summary="segment hidden control pre" width="100%" border="0" cellpadding="0" bgcolor=#{the_color.grey_pale} align="center">
@@ -671,12 +673,12 @@ WOK
   </a>
 </td>}
       pre=%{<td align="center" bgcolor=#{the_color.band1}>
-  <a href="#{@seg_name_html[@seg_name_html_tracker-use]}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top">
+  <a href="#{@per.seg_name_x[@per.seg_name_x_tracker-use]}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top">
     #{png_nav.pre}
   </a>
 </td>} if f_pre==true
       nxt=%{<td align="center" bgcolor=#{the_color.band1}>
-  <a href="#{@seg_name_html[@seg_name_html_tracker+1]}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top">
+  <a href="#{@per.seg_name_x[@per.seg_name_x_tracker+1]}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top">
     #{png_nav.nxt}
   </a>
 </td>} if f_nxt==true
@@ -721,23 +723,6 @@ WOK
       else ''
       end
     end
-    def navigation_table
-      %{<table summary="navigation segment table" width=#{the_width.table1} border="0" bgcolor="white" cellpadding="0">
-<tr><th width="#{@@indent['leve_1']}" align="right">
-</td>
-<td valign="top">
-  <font size=2>}
-    end
-    def navigation_table1
-      %{<table summary="navigation segment table1" width=#{the_width.table1} border="0" cellpadding=#{the_table_cellpad_box} bgcolor=#{the_color.table1} align="left">
-<tr><td valign="top">
-  <font size="2">}
-    end
-    def navigation_table2
-      %{<table summary="navigation segment table2" width=#{the_width.table2} border="0" cellpadding=#{the_table_cellpad_box} bgcolor=#{the_color.table2} align="left">
-<tr><td valign="top">
-  <font size="2">}
-    end
     def credit
       %{
 <div class="main_column">
@@ -799,8 +784,8 @@ WOK
 <head>
   <meta charset="utf-8">
   <title>
-    #{@seg_name_html[@seg_name_html_tracker]} -
-    #{@md.html_title}
+    #{@per.seg_name_x[@per.seg_name_x_tracker]} -
+    #{@md.title.main}
   </title>
 <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
 #{rdf.metatag_html}
@@ -1161,7 +1146,6 @@ WOK
     end
     def subtoc_lev(tag,attrib)
       @txt=clean(@txt)
-      @ocn_html_identifier=SiSU_Env::ProcessingSettings.new(@md).ocn_html_identifier
       txt=if @txt \
       and @txt =~/<\/?i>|<a\s+name="\S+?">/mi
         @txt.gsub(/<\/?i>|<a\s+name="\S+?">/mi,'') #removes name markers from subtoc, go directly to substantive text
@@ -1175,7 +1159,7 @@ WOK
           gsub(/<a[\s]+name="-\d+"[\s]+href="#_\d+">&nbsp;<sup>\d+<\/sup>&nbsp;/m,'')
       end
       %{<#{tag} class="#{attrib}">
-    <a href="##{@ocn_html_identifier}#{@ocn}"><i>#{txt}</i></a> #{note}
+    <a href="##{@ocn}"><i>#{txt}</i></a> #{note}
   </#{tag}>}
     end
     def subtoc_lev5
index cbbd153ccf837594287344fbae2dcc36f2e4ba41..4a91b69f9593d4ca0bf64ca80283f9de841cb44c 100644 (file)
@@ -322,7 +322,7 @@ module SiSU_HarvestAuthors
 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
 <meta name="dc.title" content= "SiSU metadata harvest, Authors - SiSU information Structuring Universe, Structured information Serialised Units" />
 <meta name="dc.subject" content= "document structuring, ebook, publishing, PDF, LaTeX, XML, ODF, SQL, postgresql, sqlite, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, granular search, digital library" />
-<meta name="generator" content="#{sv[:project]} #{sv[:version]} of #{sv[:date_stamp]} (n*x and Ruby!)" />
+<meta name="generator" content="#{sv.project} #{sv.version} of #{sv.date_stamp} (n*x and Ruby!)" />
 <link rel="generator" href="http://www.jus.uio.no/sisu/SiSU" />
 <link href="#{css_path}" rel="stylesheet" >
 <link rel="shortcut icon" href="../_sisu/image/rb7.ico" />
index 58f92bcb3d84c355897e98814ac8dfe27ecd7811..4b6f493cc509eaf9225bfd668b44af1bf8d018cb 100644 (file)
@@ -158,10 +158,9 @@ module SiSU_HarvestTopics
         end
         idx_array[lang] <<=if @idx_list =~/;/
           g=@idx_list.scan(/[^;]+/)
-          idxl=[]
-          g.each do |i|
+          g.each.map do |i|
             i=i.strip
-            idxl << {
+            {
               filename: filename,
               file: file,
               rough_idx: i,
@@ -171,7 +170,6 @@ module SiSU_HarvestTopics
               lang: lang
             }
           end
-          idxl
         else {
             filename: filename,
             file: file,
@@ -691,7 +689,7 @@ module SiSU_HarvestTopics
 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
 <meta name="dc.title" content= "SiSU metadata harvest, Topics - SiSU information Structuring Universe, Structured information Serialised Units" />
 <meta name="dc.subject" content= "document structuring, ebook, publishing, PDF, LaTeX, XML, ODF, SQL, postgresql, sqlite, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, granular search, digital library" />
-<meta name="generator" content="#{sv[:project]} #{sv[:version]} of #{sv[:date_stamp]} (n*x and Ruby!)" />
+<meta name="generator" content="#{sv.project} #{sv.version} of #{sv.date_stamp} (n*x and Ruby!)" />
 <link rel="generator" href="http://www.jus.uio.no/sisu/SiSU" />
 <link href="#{css_path}" rel="stylesheet">
 <link rel="shortcut icon" href="../_sisu/image/rb7.ico" />
index aac537279570203cca6a827327b8108e955db887..55e49bd2466c577784eeb25076972ffead5c37db 100644 (file)
@@ -75,7 +75,6 @@ module SiSU_FormatShared
       else @@hname
       end
       @tab="\t"
-      @ocn_html_identifier=SiSU_Env::ProcessingSettings.new(@md).ocn_html_identifier
       @@tablehead,@@tablefoot=[],[]
       @env=SiSU_Env::InfoEnv.new(@md.fns)
       @base_url="#{@env.url.root}/#{@md.fnb}/#{@hname}.html"
@@ -204,7 +203,7 @@ GSUB
       %{<p class="#{h[:class]}" type="#{h[:type]}">#{h[:txt]}</a></p>\n}  << "\n"
     end
     def lev_toc_hname
-      %{<p class="toc#{@lv}" header="#{@hname}"><a href="##{@ocn_html_identifier}#{@ocn}">#{@txt}</a></p>\n}  #<< "\n"
+      %{<p class="toc#{@lv}" header="#{@hname}"><a href="##{@ocn}">#{@txt}</a></p>\n}  #<< "\n"
     end
     def lev_toc
       h={ txt: txt, class: "toc#{@lv}", type: 'toc' }
index 44094383f118a45fc81a7d3127ac398ec443cc1d..7cffad71c0d62519e2a0b92b5358556a1b8f9592 100644 (file)
@@ -160,19 +160,19 @@ module SiSU_Manifest
           %{<p class="tiny">#{the_url_decoration.xml_open}<a href="#{url}/#{file}">#{url}/#{file}</a>#{the_url_decoration.xml_close}</p>}
         end
       end
-      def summarize(id,file,pth='',rel='',url='',img='● ')
+      def summarize(desc,id,file,pth='',rel='',url='',img='● ')
         size=(File.size("#{pth}/#{file}")/1024.00).to_s
         kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1]
-        @manifest[:txt] << "#{file} #{id} #{kb}\n"
-        @manifest[:html] << %{<tr><th class="left"><p class="norm"><a href="#{rel}/#{file}">#{img}#{id}</a></p></th><td><p class="small"><a href="#{rel}/#{file}">#{file}</a></p>#{url_make(url,file)}</td><td class="right"><p class="right">#{kb}</p></td></tr>\n}
+        @manifest[:txt] << "#{file} #{desc} #{kb}\n"
+        @manifest[:html] << %{<tr><th class="left"><p class="norm"><a href="#{rel}/#{file}">#{img}#{desc}</a></p></th><td><p class="small"><a href="#{rel}/#{file}">#{file}</a></p>#{url_make(url,file)}</td><td class="right"><p class="right">#{kb}</p></td></tr>\n}
       end
-      def summarize_html_seg(id,file,pth='',rel='',url='',img='● ')
+      def summarize_html_seg(desc,id,file,pth='',rel='',url='',img='● ')
         size=(File.size("#{pth}/#{file}")/1024.00).to_s
         kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1]
-        @manifest[:txt] << "#{file} #{id} #{kb}\n"
-        @manifest[:html] << %{<tr><th class="left"><p class="norm"><a href="#{rel}/#{file}">#{img}#{id}</a></p></th><td><p class="small"><a href="#{rel}/#{file}">#{file}</a></p>#{url_make(url,file)}</td><td class="right"><p class="right">#{kb}</p></td></tr>\n}
+        @manifest[:txt] << "#{file} #{desc} #{kb}\n"
+        @manifest[:html] << %{<tr><th class="left"><p class="norm"><a href="#{rel}/#{file}">#{img}#{desc}</a></p></th><td><p class="small"><a href="#{rel}/#{file}">#{file}</a></p>#{url_make(url,file)}</td><td class="right"><p class="right">#{kb}</p></td></tr>\n}
       end
-      def summarize_sources(id,file,pth,rel,url)
+      def summarize_sources(desc,id,file,pth,rel,url)
         sys=SiSU_Env::SystemCall.new
         dgst=case @dg
         when :sha512
@@ -194,9 +194,9 @@ module SiSU_Manifest
         end
         size=(File.size("#{pth}/#{file}")/1024.00).to_s
         kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1]
-        @manifest[:txt] << "#{file} #{id} #{kb}\n"
+        @manifest[:txt] << "#{file} #{desc} #{kb}\n"
         @manifest[:html] << %{<tr>} \
-        + %{<th class="left"><p class="norm"><a href="#{rel}/#{file}">#{id}</a></p></th>} \
+        + %{<th class="left"><p class="norm" id="#{id}"><a href="#{rel}/#{file}">#{desc}</a></p></th>} \
         + %{<td class="right"><p class="tiny"><a href="#{rel}/#{file}">#{file}</a> &nbsp;&nbsp;#{dgst[1]}#{url_make(url,file,:src)}</p></td>} \
         + %{<td class="right"><p class="right">#{kb}</p></td>} \
         + %{</tr>\n} \
@@ -246,7 +246,7 @@ module SiSU_Manifest
         end
         @m=@m.uniq
       end
-      def languages(id,file)
+      def languages(desc,file)
         @manifest[:html] << %{<tr><th class="left"><div id="horizontal_links"><ul id="horizontal">\n}
         published_manifests?.each do |l|
           SiSU_Translate::Source.new(@md,@language,l[:n]).language_list
@@ -255,15 +255,15 @@ module SiSU_Manifest
         end
         @manifest[:html] << %{</ul></div></th></tr>\n}
       end
-      def published_languages(id)
+      def published_languages(desc)
         published_manifests?.each do |l|
           @manifest[:txt] << "#{l[:mu]} #{l[:l]}\n"
           @manifest[:html] << %{<tr><th class="left"><p class="bold"><a href="#{l[:mu]}">#{l[:l]}</a></p></th><td><p class="norm">#{l[:l]}</p><p class="tiny">#{the_url_decoration.xml_open}<a href="#{l[:mu]}">#{l[:mu]}</a>#{the_url_decoration.xml_close}</p></td><td class="right"><p class="right">&nbsp;</p></td></tr>\n}
         end
       end
-      def metadata(id,info)
+      def metadata(desc,id,info)
         info=info.to_s.gsub(/(?:#{Mx[:br_line]}|\\)+/,'<br>')
-        @manifest[:html] << %{<tr><th class="left"><p class="bold_left">#{id}:</p></th><td><p class="left">#{info}</p></td></tr>\n}
+        @manifest[:html] << %{<tr><th class="left"><p class="bold_left" id="#{id}">#{desc}:</p></th><td><p class="left">#{info}</p></td></tr>\n}
       end
       def links(url,lnk,target)
         static=if url =~/^\.\// then url.gsub(/^\.(\.)?/,@base_url)
@@ -278,271 +278,278 @@ module SiSU_Manifest
           pth=@f.output_path.html_seg.dir
           rel=@f.output_path.html_seg.rel_sm
           url=@f.output_path.html_seg.url
-          id,file='HTML, table of contents (for segmented text)',@f.base_filename.html_segtoc
-          summarize_html_seg(id,file,pth,rel,url,img)
+          desc,id,file='HTML, table of contents (for segmented text)','html',@f.base_filename.html_segtoc
+          summarize_html_seg(desc,id,file,pth,rel,url,img)
         end
         if FileTest.file?(@f.place_file.html_scroll.dir)==true
           img=%{<img border="0" height="15" width="15" src="#{@image_path}/b_doc.png" alt="Full Text" /> }
           pth=@f.output_path.html_scroll.dir
           rel=@f.output_path.html_scroll.rel_sm
           url=@f.output_path.html_scroll.url
-          id,file='HTML, full length document',@f.base_filename.html_scroll
-          summarize(id,file,pth,rel,url,img)
+          desc,id,file='HTML, full length document','html_scroll',@f.base_filename.html_scroll
+          summarize(desc,id,file,pth,rel,url,img)
         end
         if FileTest.file?(@f.place_file.html_book_index.dir)==true
           pth=@f.output_path.html_seg.dir
           rel=@f.output_path.html_seg.rel_sm
           url=@f.output_path.html_seg.url
-          id,file='HTML, (book type) index',@f.base_filename.html_book_index
-          summarize(id,file,pth,rel,url)
+          desc,id,file='HTML, (book type) index','html_book',@f.base_filename.html_book_index
+          summarize(desc,id,file,pth,rel,url)
         end
         if FileTest.file?(@f.place_file.html_concordance.dir)==true
           pth=@f.output_path.html_seg.dir
           rel=@f.output_path.html_seg.rel_sm
           url=@f.output_path.html_seg.url
-          id,file='HTML, concordance file',@f.base_filename.html_concordance
-          summarize(id,file,pth,rel,url)
+          desc,id,file='HTML, concordance file','concordance',@f.base_filename.html_concordance
+          summarize(desc,id,file,pth,rel,url)
         end
         if FileTest.file?(@f.place_file.epub.dir)==true
           img=%{<img border="0" height="18" width="18" src="#{@image_path}/b_epub.png" alt="EPUB" /> }
-          id,file='EPUB (Electronic Publication, e-book standard)',@f.base_filename.epub
+          desc,id,file='EPUB (Electronic Publication, e-book standard)','epub',@f.base_filename.epub
           pth=@f.output_path.epub.dir
           rel=@f.output_path.epub.rel_sm
           url=@f.output_path.epub.url
-          summarize(id,file,pth,rel,url,img)
+          summarize(desc,id,file,pth,rel,url,img)
         end
         if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_letter}")==true
           img=%{<img border="0" height="18" width="15" src="#{@image_path}/b_pdf.png" alt="PDF portrait" /> }
           pth=@f.output_path.pdf.dir
           rel=@f.output_path.pdf.rel_sm
           url=@f.output_path.pdf.url
-          id,file="PDF, U.S. letter size, portrait/vertical document (recommended for printing)","#{@f.base_filename.pdf_p_letter}"
-          summarize(id,file,pth,rel,url,img)
+          desc,id,file="PDF, U.S. letter size, portrait/vertical document (recommended for printing)",'pdf_letter',"#{@f.base_filename.pdf_p_letter}"
+          summarize(desc,id,file,pth,rel,url,img)
         end
         if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_letter}")==true
           img=%{<img border="0" height="15" width="18" src="#{@image_path}/b_pdf.png" alt="PDF landscape" /> }
           pth=@f.output_path.pdf.dir
           rel=@f.output_path.pdf.rel_sm
           url=@f.output_path.pdf.url
-          id,file="PDF, U.S. letter size, landscape/horizontal document (recommended for screen viewing)","#{@f.base_filename.pdf_l_letter}"
-          summarize(id,file,pth,rel,url,img)
+          desc,id,file="PDF, U.S. letter size, landscape/horizontal document (recommended for screen viewing)",'pdf_letter_landscape',"#{@f.base_filename.pdf_l_letter}"
+          summarize(desc,id,file,pth,rel,url,img)
         end
         if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_a4}")==true
           img=%{<img border="0" height="18" width="15" src="#{@image_path}/b_pdf.png" alt="PDF portrait" /> }
           pth=@f.output_path.pdf.dir
           rel=@f.output_path.pdf.rel_sm
           url=@f.output_path.pdf.url
-          id,file="PDF, A4 size, portrait/vertical document (recommended for printing)","#{@f.base_filename.pdf_p_a4}"
-          summarize(id,file,pth,rel,url,img)
+          desc,id,file="PDF, A4 size, portrait/vertical document (recommended for printing)",'pdf_a4',"#{@f.base_filename.pdf_p_a4}"
+          summarize(desc,id,file,pth,rel,url,img)
         end
         if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_a4}")==true
           img=%{<img border="0" height="15" width="18" src="#{@image_path}/b_pdf.png" alt="PDF landscape" /> }
           pth=@f.output_path.pdf.dir
           rel=@f.output_path.pdf.rel_sm
           url=@f.output_path.pdf.url
-          id,file="PDF, A4 size, landscape/horizontal document (recommended for screen viewing)","#{@f.base_filename.pdf_l_a4}"
-          summarize(id,file,pth,rel,url,img)
+          desc,id,file="PDF, A4 size, landscape/horizontal document (recommended for screen viewing)",'pdf_a4_landscape',"#{@f.base_filename.pdf_l_a4}"
+          summarize(desc,id,file,pth,rel,url,img)
         end
         if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_a5}")==true
           img=%{<img border="0" height="18" width="15" src="#{@image_path}/b_pdf.png" alt="PDF portrait" /> }
           pth=@f.output_path.pdf.dir
           rel=@f.output_path.pdf.rel_sm
           url=@f.output_path.pdf.url
-          id,file="PDF, A5 (book) size, portrait/vertical document (recommended for printing)","#{@f.base_filename.pdf_p_a5}"
-          summarize(id,file,pth,rel,url,img)
+          desc,id,file="PDF, A5 (book) size, portrait/vertical document (recommended for printing)",'pdf_a5',"#{@f.base_filename.pdf_p_a5}"
+          summarize(desc,id,file,pth,rel,url,img)
         end
         if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_a5}")==true
           img=%{<img border="0" height="15" width="18" src="#{@image_path}/b_pdf.png" alt="PDF landscape" /> }
           pth=@f.output_path.pdf.dir
           rel=@f.output_path.pdf.rel_sm
           url=@f.output_path.pdf.url
-          id,file="PDF, A5 (book) size, landscape/horizontal document (recommended for screen viewing)","#{@f.base_filename.pdf_l_a5}"
-          summarize(id,file,pth,rel,url,img)
+          desc,id,file="PDF, A5 (book) size, landscape/horizontal document (recommended for screen viewing)",'pdf_a5_landscape',"#{@f.base_filename.pdf_l_a5}"
+          summarize(desc,id,file,pth,rel,url,img)
         end
         if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_b5}")==true
           img=%{<img border="0" height="18" width="15" src="#{@image_path}/b_pdf.png" alt="PDF portrait" /> }
           pth=@f.output_path.pdf.dir
           rel=@f.output_path.pdf.rel_sm
           url=@f.output_path.pdf.url
-          id,file="PDF, B5 (book) size, portrait/vertical document (recommended for printing)","#{@f.base_filename.pdf_p_b5}"
-          summarize(id,file,pth,rel,url,img)
+          desc,id,file="PDF, B5 (book) size, portrait/vertical document (recommended for printing)",'pdf_b5',"#{@f.base_filename.pdf_p_b5}"
+          summarize(desc,id,file,pth,rel,url,img)
         end
         if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_b5}")==true
           img=%{<img border="0" height="15" width="18" src="#{@image_path}/b_pdf.png" alt="PDF landscape" /> }
           pth=@f.output_path.pdf.dir
           rel=@f.output_path.pdf.rel_sm
           url=@f.output_path.pdf.url
-          id,file="PDF, B5 (book) size, landscape/horizontal document (recommended for screen viewing)","#{@f.base_filename.pdf_l_b5}"
-          summarize(id,file,pth,rel,url,img)
+          desc,id,file="PDF, B5 (book) size, landscape/horizontal document (recommended for screen viewing)",'pdf_a5_landscape',"#{@f.base_filename.pdf_l_b5}"
+          summarize(desc,id,file,pth,rel,url,img)
         end
         if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_legal}")==true
           img=%{<img border="0" height="18" width="15" src="#{@image_path}/b_pdf.png" alt="PDF portrait" /> }
           pth=@f.output_path.pdf.dir
           rel=@f.output_path.pdf.rel_sm
           url=@f.output_path.pdf.url
-          id,file="PDF, U.S. legal size, portrait/vertical document (recommended for printing)","#{@f.base_filename.pdf_p_legal}"
-          summarize(id,file,pth,rel,url,img)
+          desc,id,file="PDF, U.S. legal size, portrait/vertical document (recommended for printing)",'pdf_legal',"#{@f.base_filename.pdf_p_legal}"
+          summarize(desc,id,file,pth,rel,url,img)
         end
         if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_legal}")==true
           img=%{<img border="0" height="15" width="18" src="#{@image_path}/b_pdf.png" alt="PDF landscape" /> }
           pth=@f.output_path.pdf.dir
           rel=@f.output_path.pdf.rel_sm
           url=@f.output_path.pdf.url
-          id,file="PDF, U.S. legal size, landscape/horizontal document (recommended for screen viewing)","#{@f.base_filename.pdf_l_legal}"
-          summarize(id,file,pth,rel,url,img)
+          desc,id,file="PDF, U.S. legal size, landscape/horizontal document (recommended for screen viewing)",'pdf_legal_landscape',"#{@f.base_filename.pdf_l_legal}"
+          summarize(desc,id,file,pth,rel,url,img)
         end
         if FileTest.file?(@f.place_file.odt.dir)==true
           img=%{<img border="0" height="18" width="18" src="#{@image_path}/b_odf.png" alt="ODF/ODT" /> }
           pth=@f.output_path.odt.dir
           rel=@f.output_path.odt.rel_sm
           url=@f.output_path.odt.url
-          id,file='ODF:ODT (Open Document Format)',@f.base_filename.odt
-          summarize(id,file,pth,rel,url,img)
+          desc,id,file='ODF:ODT (Open Document Format)','odt',@f.base_filename.odt
+          summarize(desc,id,file,pth,rel,url,img)
         end
         if FileTest.file?(@f.place_file.xhtml.dir)==true
           pth=@f.output_path.xhtml.dir
           rel=@f.output_path.xhtml.rel_sm
           url=@f.output_path.xhtml.url
-          id,file='ODF:ODT (Open Document Format)',@f.base_filename.odt
-          id,file='XHTML',@f.base_filename.xhtml
-          summarize(id,file,pth,rel,url)
+          desc,id,file='XHTML','xhtml',@f.base_filename.xhtml
+          summarize(desc,id,file,pth,rel,url)
         end
         if FileTest.file?(@f.place_file.xml_sax.dir)==true
           pth=@f.output_path.xml_sax.dir
           rel=@f.output_path.xml_sax.rel_sm
           url=@f.output_path.xml_sax.url
-          id,file='XML SAX',@f.base_filename.xml_sax
-          summarize(id,file,pth,rel,url)
+          desc,id,file='XML SAX','xml_sax',@f.base_filename.xml_sax
+          summarize(desc,id,file,pth,rel,url)
         end
         if FileTest.file?(@f.place_file.xml_dom.dir)==true
           pth=@f.output_path.xml_dom.dir
           rel=@f.output_path.xml_dom.rel_sm
           url=@f.output_path.xml_dom.url
-          id,file='XML DOM',@f.base_filename.xml_dom
-          summarize(id,file,pth,rel,url)
+          desc,id,file='XML DOM','xml_dom',@f.base_filename.xml_dom
+          summarize(desc,id,file,pth,rel,url)
         end
         if FileTest.file?(@f.place_file.xml_docbook_article.dir)==true
           pth=@f.output_path.xml_docbook_article.dir
           rel=@f.output_path.xml_docbook_article.rel_sm
           url=@f.output_path.xml_docbook_article.url
-          id,file='XML Docbook Book',@f.base_filename.xml_docbook_article
-          summarize(id,file,pth,rel,url)
+          desc,id,file='XML Docbook Article','docbook_article',@f.base_filename.xml_docbook_article
+          summarize(desc,id,file,pth,rel,url)
         end
         if FileTest.file?(@f.place_file.xml_docbook_book.dir)==true
           pth=@f.output_path.xml_docbook_book.dir
           rel=@f.output_path.xml_docbook_book.rel_sm
           url=@f.output_path.xml_docbook_book.url
-          id,file='XML Docbook Book',@f.base_filename.xml_docbook_book
-          summarize(id,file,pth,rel,url)
+          desc,id,file='XML Docbook Book','docbook',@f.base_filename.xml_docbook_book
+          summarize(desc,id,file,pth,rel,url)
         end
         if FileTest.file?(@f.place_file.xml_fictionbook.dir)==true
           pth=@f.output_path.xml_fictionbook.dir
           rel=@f.output_path.xml_fictionbook.rel_sm
           url=@f.output_path.xml_fictionbook.url
-          id,file='XML Fictionbook',@f.base_filename.xml_fictionbook
-          summarize(id,file,pth,rel,url)
+          desc,id,file='XML Fictionbook','fictionbook',@f.base_filename.xml_fictionbook
+          summarize(desc,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)
+          desc,id,file='XML Scaffold sisu structure','xml_scaffold',@f.base_filename.xml_scaffold_structure_sisu
+          summarize(desc,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)
+          desc,id,file='XML Scaffold collapsed structure','xml_collapsed',@f.base_filename.xml_scaffold_structure_collapse
+          summarize(desc,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
           url=@f.output_path.texinfo.url
-          id,file='Info file',@f.base_filename.info
-          summarize(id,file,pth,rel,url)
+          desc,id,file='Info file','info',@f.base_filename.info
+          summarize(desc,id,file,pth,rel,url)
         end
         if FileTest.file?(@f.place_file.manpage.dir)==true
           pth=@f.output_path.manpage.dir
           rel=@f.output_path.manpage.rel_sm
           url=@f.output_path.manpage.url
-          id,file='Manpage',@f.base_filename.manpage
-          summarize(id,file,pth,rel,url)
+          desc,id,file='Manpage','manpage',@f.base_filename.manpage
+          summarize(desc,id,file,pth,rel,url)
         end
         if FileTest.file?(@f.place_file.sqlite_discrete.dir)==true
-          id,file='SQLite3 file',@f.base_filename.sqlite_discrete
+          desc,id,file='SQLite3 file','sqlite',@f.base_filename.sqlite_discrete
           pth=@f.output_path.sqlite_discrete.dir
           rel=@f.output_path.sqlite_discrete.rel_sm
           url=@f.output_path.sqlite_discrete.url
-          summarize(id,file,pth,rel,url)
+          summarize(desc,id,file,pth,rel,url)
         end
         if FileTest.file?(@f.place_file.txt.dir)==true
-          id='Plaintext (UTF-8)'
+          desc,id='Plaintext (UTF-8)','text'
           pth=@f.output_path.txt.dir
           rel=@f.output_path.txt.rel_sm
           url=@f.output_path.txt.url
           file=@f.base_filename.txt
-          summarize(id,file,pth,rel,url)
+          summarize(desc,id,file,pth,rel,url)
         end
         if FileTest.file?(@f.place_file.textile.dir)==true
-          id='Textile text (UTF-8)'
+          desc,id='Textile text (UTF-8)','textile'
           pth=@f.output_path.textile.dir
           rel=@f.output_path.textile.rel_sm
           url=@f.output_path.textile.url
           file=@f.base_filename.textile
-          summarize(id,file,pth,rel,url)
+          summarize(desc,id,file,pth,rel,url)
         end
         if FileTest.file?(@f.place_file.asciidoc.dir)==true
-          id='AsciiDoc text (UTF-8)'
+          desc,id='AsciiDoc text (UTF-8)','asciidoc'
           pth=@f.output_path.asciidoc.dir
           rel=@f.output_path.asciidoc.rel_sm
           url=@f.output_path.asciidoc.url
           file=@f.base_filename.asciidoc
-          summarize(id,file,pth,rel,url)
+          summarize(desc,id,file,pth,rel,url)
         end
         if FileTest.file?(@f.place_file.markdown.dir)==true
-          id='Markdown text (UTF-8)'
+          desc,id='Markdown text (UTF-8)','markdown'
           pth=@f.output_path.markdown.dir
           rel=@f.output_path.markdown.rel_sm
           url=@f.output_path.markdown.url
           file=@f.base_filename.markdown
-          summarize(id,file,pth,rel,url)
+          summarize(desc,id,file,pth,rel,url)
         end
         if FileTest.file?(@f.place_file.rst.dir)==true
-          id='rST text (UTF-8)'
+          desc,id='rST text (UTF-8)','rst'
           pth=@f.output_path.rst.dir
           rel=@f.output_path.rst.rel_sm
           url=@f.output_path.rst.url
           file=@f.base_filename.rst
-          summarize(id,file,pth,rel,url)
+          summarize(desc,id,file,pth,rel,url)
+        end
+        if FileTest.file?(@f.place_file.orgmode.dir)==true
+          desc,id='OrgMode structure text (UTF-8)','org'
+          pth=@f.output_path.orgmode.dir
+          rel=@f.output_path.orgmode.rel_sm
+          url=@f.output_path.orgmode.url
+          file=@f.base_filename.orgmode
+          summarize(desc,id,file,pth,rel,url)
         end
         if FileTest.file?("#{@base_path}/#{@md.fns}.tex")==true
-          id,file='LaTeX (portrait)',"#{@md.fns}.tex"
+          desc,id,file='LaTeX (portrait)','latex',"#{@md.fns}.tex"
           pth,rel,url='','',''
-          summarize(id,file,pth,rel,url)
+          summarize(desc,id,file,pth,rel,url)
         end
         if FileTest.file?("#{@base_path}/#{@md.fns}.tex")==true
-          id,file='LaTeX (landscape)',"#{@md.fns}.landscape.tex"
+          desc,id,file='LaTeX (landscape)','latex_landscape',"#{@md.fns}.landscape.tex"
           pth,rel,url='','',''
-          summarize(id,file,pth,rel,url)
+          summarize(desc,id,file,pth,rel,url)
         end
         if FileTest.file?(@f.place_file.hash_digest.dir)==true
           pth=@f.output_path.hash_digest.dir
           rel=@f.output_path.hash_digest.rel_sm
           url=@f.output_path.hash_digest.url
-          id,file="Digest/DCC - Document Content Certificate (#{@dg})",@f.base_filename.hash_digest
-          summarize(id,file,pth,rel,url)
+          desc,id,file="Digest/DCC - Document Content Certificate (#{@dg})",'digests',@f.base_filename.hash_digest
+          summarize(desc,id,file,pth,rel,url)
         end
       end
       def published_versions
-        id,file='Markup (SiSU source)',@md.fns
-        languages(id,file)
+        desc,file='Markup (SiSU source)','source',@md.fns
+        languages(desc,file)
       end
       def language_versions
         if FileTest.file?(@f.place_file.manifest.dir)==true
-          id='Markup (SiSU source)'
-          published_languages(id)
+          desc='Markup (SiSU source)'
+          published_languages(desc)
         end
       end
       def qrc_image
@@ -582,165 +589,165 @@ WOK
             pth=@f.output_path.src.dir
             rel=@f.output_path.src.rel_sm
             url=@f.output_path.src.url
-            id,file='Markup Composite File (SiSU source)',@f.base_filename.src
-            summarize_sources(id,file,pth,rel,url)
+            desc,id,file='Markup Composite File (SiSU source)','source',@f.base_filename.src
+            summarize_sources(desc,id,file,pth,rel,url)
           end
         else
           if FileTest.file?(@f.place_file.src.dir)==true
             pth=@f.output_path.src.dir
             rel=@f.output_path.src.rel_sm
             url=@f.output_path.src.url
-            id,file='Markup (SiSU source)',@f.base_filename.src
-            summarize_sources(id,file,pth,rel,url)
+            desc,id,file='Markup (SiSU source)','composite',@f.base_filename.src
+            summarize_sources(desc,id,file,pth,rel,url)
           end
         end
         if FileTest.file?(@f.place_file.sisupod.dir)==true
           pth=@f.output_path.sisupod.dir
           rel=@f.output_path.sisupod.rel_sm
           url=@f.output_path.sisupod.url
-          id,file='SiSU doc (tar.xz)',@f.base_filename.sisupod
-          summarize_sources(id,file,pth,rel,url)
+          desc,id,file='SiSUdoc pod (tar.xz)','sisupod',@f.base_filename.sisupod
+          summarize_sources(desc,id,file,pth,rel,url)
         end
         if FileTest.file?(@f.place_file.pot.dir)==true
           pth=@f.output_path.pot.dir
           rel=@f.output_path.pot.rel_sm
           url=@f.output_path.pot.url
-          id,file='SiSU pot',@f.base_filename.pot
-          summarize_sources(id,file,pth,rel,url)
+          desc,id,file='SiSU pot','pot',@f.base_filename.pot
+          summarize_sources(desc,id,file,pth,rel,url)
         end
       end
       def metadata_tests
         if defined? @md.title                                                   #%
           if defined? @md.title.full \
           and @md.title.full=~/\S+/
-            id,info=@translate.full_title,@md.title.full
-            metadata(id,info)
+            desc,id,info=@translate.full_title,'title',@md.title.full
+            metadata(desc,id,info)
           end
         end
         if defined? @md.creator                                                 #%
           if defined? @md.creator.author \
           and @md.creator.author=~/\S+/
-            id,info=@translate.author,@md.creator.author
-            metadata(id,info)
+            desc,id,info=@translate.author,'author',@md.creator.author
+            metadata(desc,id,info)
           end
           if defined? @md.creator.editor \
           and @md.creator.editor=~/\S+/
-            id,info=@translate.editor,@md.creator.editor
-            metadata(id,info)
+            desc,id,info=@translate.editor,'editor',@md.creator.editor
+            metadata(desc,id,info)
           end
           if defined? @md.creator.contributor \
           and @md.creator.contributor=~/\S+/
-            id,info=@translate.contributor,@md.creator.contributor
-            metadata(id,info)
+            desc,id,info=@translate.contributor,'contributor',@md.creator.contributor
+            metadata(desc,id,info)
           end
           if defined? @md.creator.translator \
           and @md.creator.translator=~/\S+/
-            id,info=@translate.translator,@md.creator.translator
-            metadata(id,info)
+            desc,id,info=@translate.translator,'creator',@md.creator.translator
+            metadata(desc,id,info)
           end
           if defined? @md.creator.illustrator \
           and @md.creator.illustrator=~/\S+/
-            id,info=@translate.illustrator,@md.creator.illustrator
-            metadata(id,info)
+            desc,id,info=@translate.illustrator,'illustrator',@md.creator.illustrator
+            metadata(desc,id,info)
           end
           if defined? @md.creator.prepared_by \
           and @md.creator.prepared_by=~/\S+/
-            id,info=@translate.prepared_by,@md.creator.prepared_by
-            metadata(id,info)
+            desc,id,info=@translate.prepared_by,'prepared_by',@md.creator.prepared_by
+            metadata(desc,id,info)
           end
           if defined? @md.creator.digitized_by \
           and @md.creator.digitized_by=~/\S+/
-            id,info=@translate.digitized_by,@md.creator.digitized_by
-            metadata(id,info)
+            desc,id,info=@translate.digitized_by,'designed_by',@md.creator.digitized_by
+            metadata(desc,id,info)
           end
         end
         if defined? @md.rights
           if defined? @md.rights.all \
           and @md.rights.all=~/\S+/ #dc
-            id,info=@translate.rights,@md.rights.all
-            metadata(id,info)
+            desc,id,info=@translate.rights,'rights',@md.rights.all
+            metadata(desc,id,info)
           end
         end
         if defined? @md.date                                                    #%
           if defined? @md.date.published \
           and @md.date.published=~/\S+/ #dc
-            id,info=@translate.date,@md.date.published
-            metadata(id,info)
+            desc,id,info=@translate.date,'date',@md.date.published
+            metadata(desc,id,info)
           end
           if defined? @md.date.created \
           and @md.date.created=~/\S+/ #dc
-            id,info=@translate.date_created,@md.date.created
-            metadata(id,info)
+            desc,id,info=@translate.date_created,'date_created',@md.date.created
+            metadata(desc,id,info)
           end
           if defined? @md.date.issued \
           and @md.date.issued=~/\S+/ #dc
-            id,info=@translate.date_issued,@md.date.issued
-            metadata(id,info)
+            desc,id,info=@translate.date_issued,'date_issued',@md.date.issued
+            metadata(desc,id,info)
           end
           if defined? @md.date.available \
           and @md.date.available=~/\S+/ #dc
-            id,info=@translate.date_available,@md.date.available
-            metadata(id,info)
+            desc,id,info=@translate.date_available,'date_available',@md.date.available
+            metadata(desc,id,info)
           end
           if defined? @md.date.modified \
           and @md.date.modified=~/\S+/ #dc
-            id,info=@translate.date_modified,@md.date.modified
-            metadata(id,info)
+            desc,id,info=@translate.date_modified,'date_modified',@md.date.modified
+            metadata(desc,id,info)
           end
           if defined? @md.date.valid \
           and @md.date.valid=~/\S+/ #dc
-            id,info=@translate.date_valid,@md.date.valid
-            metadata(id,info)
+            desc,id,info=@translate.date_valid,'date_valid',@md.date.valid
+            metadata(desc,id,info)
           end
         end
         if defined? @md.publisher \
         and @md.publisher=~/\S+/ #dc
-          id,info=@translate.publisher,@md.publisher
-          metadata(id,info)
+          desc,id,info=@translate.publisher,'publisher',@md.publisher
+          metadata(desc,id,info)
         end
         if defined? @md.notes                                                   #%
           if defined? @md.notes.description \
           and @md.notes.description=~/\S+/
-            id,info=@translate.description,@md.notes.description
-            metadata(id,info)
+            desc,id,info=@translate.description,'description',@md.notes.description
+            metadata(desc,id,info)
           end
           if defined? @md.notes.abstract \
           and @md.notes.abstract=~/\S+/
-            id,info=@translate.abstract,@md.notes.abstract
-            metadata(id,info)
+            desc,id,info=@translate.abstract,'abstract',@md.notes.abstract
+            metadata(desc,id,info)
           end
           if defined? @md.notes.comment \
           and @md.notes.comment=~/\S+/
-            id,info=@translate.comments,@md.notes.comment
-            metadata(id,info)
+            desc,id,info=@translate.comments,'comment',@md.notes.comment
+            metadata(desc,id,info)
           end
           if defined? @md.notes.prefix_a \
           and @md.notes.prefix_a=~/\S+/
-            id,info=@translate.prefix_a,@md.notes.prefix_a
-            metadata(id,info)
+            desc,id,info=@translate.prefix_a,'prefix',@md.notes.prefix_a
+            metadata(desc,id,info)
           end
           if defined? @md.notes.prefix_b \
           and @md.notes.prefix_b=~/\S+/
-            id,info=@translate.prefix_b,@md.notes.prefix_b
-            metadata(id,info)
+            desc,id,info=@translate.prefix_b,'prefix_b',@md.notes.prefix_b
+            metadata(desc,id,info)
           end
         end
         if defined? @md.title                                                   #%
           if defined? @md.title.language \
           and @md.title.language=~/\S+/
-            id,info=@translate.language,@md.title.language
-            metadata(id,info)
+            desc,id,info=@translate.language,'language',@md.title.language
+            metadata(desc,id,info)
           end
           if defined? @md.original.language \
           and @md.original.language=~/\S+/
-            id,info=@translate.language_original,@md.original.language
-            metadata(id,info)
+            desc,id,info=@translate.language_original,'language_original',@md.original.language
+            metadata(desc,id,info)
           end
         end
         if defined? @md.classify                                                #%
           if defined? @md.topic_register_array \
           and @md.topic_register_array.length > 0
-            @manifest[:html] << %{<tr><th class="left"><p class="bold_left">#{@translate.topic_register}:</p></th><td>\n}
+            @manifest[:html] << %{<tr><th class="left"><p class="bold_left" id="topics">#{@translate.topic_register}:</p></th><td>\n}
             @md.topic_register_array.each do |t|
               t.each_with_index do |st,i|
                 if st.is_a?(Array)
@@ -761,104 +768,104 @@ WOK
           end
           if defined? @md.classify.subject \
           and @md.classify.subject=~/\S+/
-            id,info=@translate.subject,@md.classify.subject
-            metadata(id,info)
+            desc,id,info=@translate.subject,'subject',@md.classify.subject
+            metadata(desc,id,info)
           end
           if defined? @md.classify.keywords \
           and @md.classify.keywords=~/\S+/
-            id,info=@translate.keywords,@md.classify.keywords
-            metadata(id,info)
+            desc,id,info=@translate.keywords,'keywords',@md.classify.keywords
+            metadata(desc,id,info)
           end
           if defined? @md.classify.loc \
           and @md.classify.loc=~/\S+/
-            id,info=@translate.cls_loc,@md.classify.loc
-            metadata(id,info)
+            desc,id,info=@translate.cls_loc,'loc',@md.classify.loc
+            metadata(desc,id,info)
           end
           if defined? @md.classify.dewey \
           and @md.classify.dewey=~/\S+/
-            id,info=@translate.cls_dewey,@md.classify.dewey
-            metadata(id,info)
+            desc,id,info=@translate.cls_dewey,'dewey',@md.classify.dewey
+            metadata(desc,id,info)
           end
           if defined? @md.notes.coverage \
           and @md.notes.coverage=~/\S+/
-            id,info=@translate.coverage,@md.notes.coverage
-            metadata(id,info)
+            desc,id,info=@translate.coverage,'coverage',@md.notes.coverage
+            metadata(desc,id,info)
           end
           if defined? @md.notes.relation \
           and @md.notes.relation=~/\S+/
-            id,info=@translate.relation,@md.notes.relation
-            metadata(id,info)
+            desc,id,info=@translate.relation,'relation',@md.notes.relation
+            metadata(desc,id,info)
           end
           if defined? @md.notes.type \
           and @md.notes.type=~/\S+/ #dc
-            id,info=@translate.type,@md.notes.type
-            metadata(id,info)
+            desc,id,info=@translate.type,'type',@md.notes.type
+            metadata(desc,id,info)
           end
           if defined? @md.notes.format \
           and @md.notes.format=~/\S+/
-            id,info=@transate.format,@md.notes.format
-            metadata(id,info)
+            desc,id,info=@transate.format,'format',@md.notes.format
+            metadata(desc,id,info)
           end
         end
         if defined? @md.identifier                                              #%
           if defined? @md.identifier.oclc \
           and @md.identifier.oclc=~/\S+/
-            id,info=@translate.cls_oclc,@md.identifier.oclc
-            @manifest[:html] << %{<tr><th class="left"><p class="bold_left">#{id}:</p></th><td>\n}
+            desc,id,info=@translate.cls_oclc,'',@md.identifier.oclc
+            @manifest[:html] << %{<tr><th class="left"><p class="bold_left">#{desc}:</p></th><td>\n}
             @manifest[:html] << %{<p class="left"><a href="http://worldcat.org/oclc/#{info}">#{info}</a></p>\n}
             @manifest[:html] << %{</td></tr>\n}
           end
           if defined? @md.identifier.pg \
           and @md.identifier.pg=~/\S+/
-            id,info=@translate.cls_gutenberg,@md.identifier.pg
-            metadata(id,info)
+            desc,id,info=@translate.cls_gutenberg,'ocalc',@md.identifier.pg
+            metadata(desc,id,info)
           end
           if defined? @md.identifier.isbn \
           and @md.identifier.isbn=~/\S+/
-            id,info=@translate.cls_isbn,@md.identifier.isbn
-            metadata(id,info)
+            desc,id,info=@translate.cls_isbn,'isbn',@md.identifier.isbn
+            metadata(desc,id,info)
           end
         end
         if defined? @md.original.source \
         and @md.original.source=~/\S+/
-          id,info=@translate.source,@md.original.source
-          metadata(id,info)
+          desc,id,info=@translate.source,'source_original',@md.original.source
+          metadata(desc,id,info)
         end
         if @md.fns
-          id,info=@translate.sourcefile,@md.fns
-          metadata(id,info)
+          desc,id,info=@translate.sourcefile,'source_filename',@md.fns
+          metadata(desc,id,info)
         end
         if @md.en[:mismatch] > 0
-          id,info='WARNING document error in endnote markup, number mismatch',"endnotes: #{@md.en[:note]} != endnote reference marks: #{@md.en[:mark]} (difference = #{@md.en[:mismatch]})"
-          metadata(id,info)
+          desc,id,info='WARNING document error in endnote markup, number mismatch','',"endnotes: #{@md.en[:note]} != endnote reference marks: #{@md.en[:mark]} (difference = #{@md.en[:mismatch]})"
+          metadata(desc,id,info)
         end
         if @md.wc_words
-          id,info=@translate.word_count,@md.wc_words
-          metadata(id,info)
+          desc,id,info=@translate.word_count,'wordcount',@md.wc_words
+          metadata(desc,id,info)
         end
         if @md.dgst
-          id,info="#{@translate.sourcefile_digest} (#{@dg})",@md.dgst[1]
-          metadata(id,info)
+          desc,id,info="#{@translate.sourcefile_digest} (#{@dg})",'digests',@md.dgst[1]
+          metadata(desc,id,info)
         end
         if @md.sc_number
-          id,info=@translate.sc_number,@md.sc_number
-          metadata(id,info)
+          desc,id,info=@translate.sc_number,'sc_number',@md.sc_number
+          metadata(desc,id,info)
         end
         if @md.sc_date
-          id,info=@translate.sc_date,"#{@md.sc_date} at #{@md.sc_time}"
-          metadata(id,info)
+          desc,id,info=@translate.sc_date,'sc_date',"#{@md.sc_date} at #{@md.sc_time}"
+          metadata(desc,id,info)
         end
         if @md.generated
-          id,info=@translate.last_generated,@md.generated
-          metadata(id,info)
+          desc,id,info=@translate.last_generated,'generated',@md.generated
+          metadata(desc,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]})#{@md.sisu_version[:install_method]}"
-          metadata(id,info)
+        if @md.project_details
+          desc,id,info=@translate.sisu_version,'project',"#{@md.project_details.project} #{@md.project_details.version} #{@md.project_details.date_stamp} (#{@md.project_details.date})#{@md.project_details.install_method}"
+          metadata(desc,id,info)
         end
         if @md.ruby_version
-          id,info=@translate.ruby_version,@md.ruby_version
-          metadata(id,info)
+          desc,id,info=@translate.ruby_version,'ruby',@md.ruby_version
+          metadata(desc,id,info)
         end
       end
       def links_tests
@@ -979,7 +986,7 @@ WOK
           @manifest[:html] <<<<WOK
 <h2 class="small"><a name="metadata">#{@translate.manifest_description_metadata}</a></h2>
 <table summary="document metadata" width="100%" border="0" cellpadding="2" align="center">
-<tr> <th class="left"><p class="bold">#{@translate.metadata}</p></th><th class="left"><p class="bold">#{@translate.description}</p></th></tr>
+<tr> <th class="left"><p class="bold" id="metadata">#{@translate.metadata}</p></th><th class="left"><p class="bold">#{@translate.description}</p></th></tr>
 WOK
           metadata_tests
           @manifest[:html] <<<<WOK
index 902a68d498882626dacabfd19965518f2f7b96e4..d2d890cce525d9b550416dcfd63108d5b424ba71 100644 (file)
@@ -64,7 +64,6 @@
       def initialize(md,data)
         @md,@data=md,data
         @pat_strip_heading_name=/<a name="h?\d.*?">(.+?)<\/a>/
-        @ocn_html_identifier=SiSU_Env::ProcessingSettings.new(@md).ocn_html_identifier
         @tell=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set]) if @md
       end
       def songsheet
           fn: @@seg_url,
         }
         f=@md.file.base_filename.html_seg(fnh)
-        lnk_n_txt=%{  <a href="#{f}##{@ocn_html_identifier}#{txt.ocn}">
+        lnk_n_txt=%{  <a href="#{f}##{txt.ocn}">
     #{txt.obj}
   </a>}
           txt_obj={ txt: lnk_n_txt }
           fn: @@seg_url,
         }
         f=@md.file.base_filename.html_seg(fnh)
-        lnk_n_txt=%{  <a href="#{f}##{@ocn_html_identifier}#{txt.ocn}">
+        lnk_n_txt=%{  <a href="#{f}##{txt.ocn}">
     #{txt.obj}
   </a>}
           txt_obj={ txt: lnk_n_txt }
index db7cdb765efd78e55c296783ecf8292092a7cd47..ae828ed154ff3a3e1cb19a482cce7198c696bc68 100644 (file)
@@ -293,7 +293,7 @@ module SiSU_Proj_HTML
       #@date=SiSU_Env::InfoDate.new #{@date.year}
     end
     def txt_generator
-      %{  <meta name="generator" content="#{@v[:project]} #{@v[:version]} of #{@v[:date_stamp]} (#{@v[:date]}) (n*x and Ruby!)" />
+      %{  <meta name="generator" content="#{@v.project} #{@v.version} of #{@v.date_stamp} (#{@v.date}) (n*x and Ruby!)" />
     <link rel="generator" href="http://www.sisudoc.org/" />}
     end
     def widget_sisu_text
@@ -301,9 +301,9 @@ module SiSU_Proj_HTML
   <p class="tiny"><font color="#666666" size="2">
     Output generated by
     <a href="#{the_url.sisu}">
-      #{@v[:project]}
+      #{@v.project}
     </a>
-    #{@v[:version]} #{@v[:date]} (#{@v[:date_stamp]})
+    #{@v.version} #{@v.date} (#{@v.date_stamp})
   </font></p>
 WOK
     end
@@ -362,7 +362,7 @@ WOK
 <meta name="dc.publisher" content= "SiSU http://www.sisudoc.org/" />
 <meta name="dc.language" content="en" />
 <meta name="dc.rights" content="Copyright Ralph Amissah" />
-<meta name="generator" content="#{@v[:project]} #{@v[:version]} of #{@v[:date_stamp]} (#{@v[:date]}) (n*x and Ruby!)" />
+<meta name="generator" content="#{@v.project} #{@v.version} of #{@v.date_stamp} (#{@v.date}) (n*x and Ruby!)" />
 <link rel="generator" href="http://www.sisudoc.org/" />
 <link rel="stylesheet" href="./#{@dir.path.style}/harvest.css" type="text/css" />
 <link rel="shortcut icon" href="./_sisu/image/rb7.ico" />
@@ -420,7 +420,7 @@ Outputs include: plaintext, HTML, EPUB, ODT (OpenDocumentText), (XHTML, XML,) La
 </a>
 </p>
 <p class="tiny">
-#{@v[:project]} #{@v[:version]} of #{@v[:date_stamp]} (#{@v[:date]}) (n*x and Ruby!), #{@date.year_static}.
+#{@v.project} #{@v.version} of #{@v.date_stamp} (#{@v.date}) (n*x and Ruby!), #{@date.year_static}.
 </p>
 <p class="tiny">
 w3 since October 3 1993.
diff --git a/lib/sisu/current/html_persist.rb b/lib/sisu/current/html_persist.rb
new file mode 100644 (file)
index 0000000..ff151ef
--- /dev/null
@@ -0,0 +1,237 @@
+# encoding: utf-8
+=begin
+
+* Name: SiSU
+
+** Description: documents, structuring, processing, publishing, search
+*** html segment generation, processing
+
+** Author: Ralph Amissah
+  <ralph@amissah.com>
+  <ralph.amissah@gmail.com>
+
+** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+  2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 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>
+
+** Git
+  <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
+  <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/html_persist.rb;hb=HEAD>
+
+=end
+module SiSU_HTML_Persist
+  class Persist
+    @@persist=nil
+    attr_accessor :is0,:is1,:is2,:is3,:is4,:heading0,:heading1,:heading2,:heading3,:heading4, :title, :dot_nav, :tocband_banner, :tocband_bannerless, :headings, :heading_endnotes, :main, :endnote_all, :tail, :credits, :heading_idx, :idx, :seg_endnotes, :seg_endnotes_array, :segtocband, :get_hash_fn, :get_hash_to, :seg_subtoc, :seg_subtoc_array, :fn, :seg_name ,:seg_name_x,:seg_name_x_tracker
+    def initialize(args=nil)
+      @@persist=args=(args ? args : (@@persist || persist_init_hash_values))
+      @is0=args[:is0]
+      @is1=args[:is1]
+      @is2=args[:is2]
+      @is3=args[:is3]
+      @is4=args[:is4]
+      @heading0=args[:heading0]
+      @heading1=args[:heading1]
+      @heading2=args[:heading2]
+      @heading3=args[:heading3]
+      @heading4=args[:heading4]
+      @title=args[:title]
+      @dot_nav=args[:dot_nav]
+      @tocband_banner=args[:tocband_banner]
+      @tocband_bannerless=args[:tocband_bannerless]
+      @headings=args[:headings]
+      @heading_endnotes=args[:heading_endnotes]
+      @main=args[:main]
+      @endnote_all=args[:endnote_all]
+      @tail=args[:tail]
+      @credits=args[:credits]
+      @heading_idx=args[:heading_idx]
+      @idx=args[:idx]
+      @seg_endnotes=args[:seg_endnotes]
+      @seg_endnotes_array=args[:seg_endnotes_array]
+      @get_hash_to=args[:get_hash_to]
+      @get_hash_fn=args[:get_hash_fn]
+      @seg_subtoc=args[:seg_subtoc]
+      @seg_subtoc_array=args[:seg_subtoc_array]
+      @segtocband=args[:fn]
+      @fn=args[:fn]
+      @seg_name=args[:seg_name]
+      @seg_name_x=args[:seg_name_x]
+      @seg_name_x_tracker=args[:seg_name_x_tracker]
+    end
+    def is0
+      @is0
+    end
+    def is1
+      @is1
+    end
+    def is2
+      @is2
+    end
+    def is3
+      @is3
+    end
+    def is4
+      @is4
+    end
+    def heading0
+      @heading0
+    end
+    def heading1
+      @heading1
+    end
+    def heading2
+      @heading2
+    end
+    def heading3
+      @heading3
+    end
+    def heading4
+      @heading4
+    end
+    def title
+      @title
+    end
+    def dot_nav
+      @dot_nav
+    end
+    def tocband_banner
+      @tocband_banner
+    end
+    def tocband_bannerless
+      @tocband_bannerless
+    end
+    def headings
+      @headings
+    end
+    def heading_endnotes
+      @heading_endnotes
+    end
+    def main
+      @main
+    end
+    def endnote_all
+      @endnote_all
+    end
+    def tail
+      @tail
+    end
+    def credits
+      @credits
+    end
+    def heading_idx
+      @heading_idx
+    end
+    def idx
+      @idx
+    end
+    def seg_endnotes
+      @seg_endnotes
+    end
+    def seg_endnotes_array
+      @seg_endnotes_array
+    end
+    def get_hash_to
+      @get_hash_to
+    end
+    def get_hash_fn
+      @get_hash_fn
+    end
+    def seg_subtoc
+      @seg_subtoc
+    end
+    def seg_subtoc_array
+      @seg_subtoc_array
+    end
+    def segtocband
+      @segtocband
+    end
+    def fn
+      @fn
+    end
+    def seg_name
+      @seg_name
+    end
+    def seg_name_x
+      @seg_name_x
+    end
+    def seg_name_x_tracker
+      @seg_name_x_tracker
+    end
+    def persist_init_hash_values
+      {
+        is0: 0,
+        is1: 0,
+        is2: 0,
+        is3: 0,
+        is4: 0,
+        heading0: '',
+        heading1: '',
+        heading2: '',
+        heading3: '',
+        heading4: '',
+        tocband_banner: [],
+        tocband_bannerless: [],
+        title: [],
+        headings: [],
+        main: [],
+        idx: [],
+        tail: [],
+        credits: [],
+        endnote_all: [],
+        heading_endnotes: '',
+        seg_endnotes: {},
+        seg_endnotes_array: [],
+        get_hash_fn: '',
+        get_hash_to: '',
+        seg_subtoc: {},
+        seg_subtoc_array: [],
+        segtocband: '',
+        fn: '',
+        seg_name: [],
+        seg_name_x: [],
+        seg_name_x_tracker: 0,
+      }
+    end
+    def persist_init
+      @@persist=nil
+      Persist.new(persist_init_hash_values)
+    end
+  end
+end
+__END__
index 3288b8f4f1b0f05bf8b1908222ece865aeb238df..4b413b00a44862a8cd747e42e4871551352e2226 100644 (file)
 module SiSU_HTML_Seg
   require_relative 'html_shared'                        # html_shared.rb
   require_relative 'html'                               # html.rb
+  require_relative 'html_persist'                       # html_persist.rb
   require_relative 'html_promo'                         # html_promo.rb
   require_relative 'shared_metadata'                    # shared_metadata.rb
   class Output
-    def initialize(md,outputfile,seg,minitoc,type='')
-      @md, @output_seg_file,@seg,@minitoc,@type=
-        md,outputfile,      seg,minitoc,  type
+    def initialize(md,outputfile,per,minitoc,type='')
+      @md, @output_seg_file,@per,@minitoc,@type=
+        md,outputfile,      per,minitoc,  type
       @title_banner_=SiSU_Env::CreateSite.new(@md.opt).html_seg_title_banner?
       @file=SiSU_Env::FileOp.new(@md)
       @make=SiSU_Env::ProcessingSettings.new(@md)
@@ -71,67 +72,68 @@ module SiSU_HTML_Seg
       : 'content0'
     end
     def output
-      if @seg[:title] =~/\S/
+      if @per.title =~/\S/
         filename_seg=[]
         if @make.build.html_top_band?
           filename_seg \
-          << @seg[:title] \
-          << @seg[:tocband_banner]
+          << @per.title \
+          << @per.tocband_banner
         else
           filename_seg \
-          << @seg[:title]
+          << @per.title
         end
         if @type=='endnotes'
-          @seg[:headings]=[]
+          @per.headings=[]
           format_head_seg=SiSU_HTML_Format::HeadSeg.new(@md)
           if @title_banner_
-            @seg[:headings] \
+            @per.headings \
             << format_head_seg.
               title_banner(@md.title.main,@md.title.sub,@author)
           end
           txt_obj={ txt: 'Endnotes', ocn_display: '' }
           format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj)
-          @seg[:headings] \
+          @per.headings \
           << format_seg.title_heading1
           filename_seg \
-          << @seg[:heading_endnotes] \
-          << @minitoc << @seg[:headings] \
+          << @per.heading_endnotes \
+          << @minitoc << @per.headings \
           << %{\n<div class="#{@cl}">\n} \
-          << @seg[:endnote_all] \
+          << @per.endnote_all \
           << '</div>' # << '</div>'
         elsif @type=='idx'
-          @seg[:headings]=[]
+          @per.headings=[]
           format_head_seg=SiSU_HTML_Format::HeadSeg.new(@md)
           if @title_banner_
-            @seg[:headings] \
+            @per.headings \
             << format_head_seg.
               title_banner(@md.title.main,@md.title.sub,@author)
           end
           txt_obj={ txt: 'Index', ocn_display: '' }
           format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj)
-          @seg[:headings] << format_seg.title_heading1
+          @per.headings << format_seg.title_heading1
           filename_seg \
-          << @seg[:heading_idx] \
-          << @minitoc << @seg[:headings] \
+          << @per.heading_idx \
+          << @minitoc << @per.headings \
           << %{\n<div class="#{@cl}">\n} \
-          << @seg[:idx] \
+          << @per.idx \
           << '</div>' # << '</div>'
         elsif @type=='metadata'
           metadata=SiSU_Metadata::Summary.new(@md).html_display.metadata
-          @seg[:headings]=[]
+          @per.headings=[]
           format_head_seg=SiSU_HTML_Format::HeadSeg.new(@md)
           if @title_banner_
-            @seg[:headings] \
+            @per.headings \
             << format_head_seg.
               title_banner(@md.title.main,@md.title.sub,@author)
           end
           txt_obj={ txt: 'Metadata', ocn_display: '' }
           format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj)
-          @seg[:headings] << format_seg.title_heading1
+          @per.headings \
+          << format_seg.title_heading1
           filename_seg \
-          << @seg[:heading_idx] \
+          << @per.heading_idx \
           << @minitoc \
-          << @seg[:headings] \
+          << @per.headings \
           << %{\n<div class="#{@cl}">\n} \
           << metadata \
           << '</div>' # << '</div>'
@@ -139,23 +141,23 @@ module SiSU_HTML_Seg
           if @make.build.html_top_band?
             filename_seg \
             << @minitoc \
-            << @seg[:headings] \
-            << @seg[:main] \
+            << @per.headings \
+            << @per.main \
             << "\n</div>\n"
           else
             filename_seg \
             << @minitoc \
-            << @seg[:main] \
+            << @per.main \
             << "\n</div>\n"
           end
         end
         filename_seg <<=if @make.build.html_top_band?
-          @seg[:tail] \
-          << @seg[:tocband_bannerless] \
-          << @seg[:credits]
+          @per.tail \
+          << @per.tocband_bannerless \
+          << @per.credits
         else
-          @seg[:tail] \
-          << @seg[:credits]
+          @per.tail \
+          << @per.credits
         end
         filename_seg=filename_seg.flatten.compact #watch
         filename_seg.each do |str|
@@ -173,32 +175,15 @@ module SiSU_HTML_Seg
     end
   end
   class Seg
-    @@seg,@@seg_subtoc,@@seg_endnotes,@@seg_ad={},{},{},{}
-    @@seg_name,@@seg_name_html=[],[]
-    @@seg_url=@@fn=@@get_hash_to=@@get_hash_fn=''
-    @@loop_count=@@seg_total=@@tracker=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
-    @@dp,@@segtocband=nil,nil
-    @@fns_previous=''
-    attr_reader :seg_name_html,:seg_name_html_tracker
+    @@seg_url=''
+    @@tracker=0
+    @@seg_name=[]
+    attr_reader :seg_name_x,:seg_name_x_tracker
     def initialize(md=nil,data='')
       @md,@data=md,data
-      @seg_name_html=@@seg_name_html || nil
-      @seg_name_html_tracker=@@tracker || nil
+      @per=SiSU_HTML_Persist::Persist.new
+      @seg_name_x=@per.seg_name_x=(@@seg_name || [])
+      @seg_name_x_tracker=@per.seg_name_x_tracker=(@@tracker || 0)
       @env=SiSU_Env::InfoEnv.new(@md.fns) if @md
       if @md
         @make=SiSU_Env::ProcessingSettings.new(@md)
@@ -214,22 +199,24 @@ module SiSU_HTML_Seg
     def songsheet
       begin
         @minitoc=SiSU_HTML::Source::Toc.new(@md,@data).minitoc
-        data=get_subtoc_endnotes(@data)
-        data=articles(data)
-        SiSU_HTML_Seg::Seg.new.cleanup # (((( added ))))
+        @per=SiSU_HTML_Persist::Persist.new
+        data=get_subtoc_endnotes(@data,@per)
+        data=articles(data,@per)
+        cleanup(@md,@per) # (((( added ))))
         #### (((( END )))) ####
       rescue
         SiSU_Errors::Rescued.new($!,$@,@md.opt.selections.str,@md.fns).location do
           __LINE__.to_s + ':' + __FILE__
         end
       ensure
-        @@seg_name=[]
+        SiSU_HTML_Persist::Persist.new.persist_init
+        @@seg_name=@per.seg_name=[]
       end
     end
   protected
-    def articles(data)
+    def articles(data,per)
+      @per=per
       tracking,newfile=0,0
-      @@is4=@@is3=@@is2=@@is1=@@is0=0
       printed_endnote_seg='n'
       idx_html=nil
       if @md.book_idx
@@ -237,27 +224,28 @@ module SiSU_HTML_Seg
         idx_html=SiSU_Particulars::CombinedSingleton.
           instance.get_idx_html(@md.opt).html_idx
         idx_html.each do |x|
-          @@seg[:idx] << x
+          @per.idx << x
         end
-        @@seg[:heading_idx]=''
+        @per.heading_idx=''
       end
       data.each do |dob|
         if (dob.is == :heading \
         || dob.is == :heading_insert) \
         && dob.ln == 4
           @@seg_name << dob.name
+          @per.seg_name = @@seg_name
           dob.name
         end
       end
-      @@seg_name_html=@@seg_name
-      @@seg_total=@@seg_name.length
-      testforartnum=@@seg_name_html
+      @per.seg_name_x=@per.seg_name
+      @per.seg_name.length
+      testforartnum=@per.seg_name_x
       if (@md.opt.act[:verbose][:set]==:on \
       || @md.opt.act[:verbose_plus][:set]==:on \
       || @md.opt.act[:maintenance][:set]==:on)
         SiSU_Screen::Ansi.new(
           @md.opt.act[:color_state][:set],
-          @@seg_name.length
+          @per.seg_name.length
         ).segmented
       end
       map_nametags=SiSU_Particulars::CombinedSingleton.
@@ -285,41 +273,41 @@ module SiSU_HTML_Seg
         if (dob.is==:heading \
         || dob.is==:heading_insert) \
         && dob.ln==4
-          @@heading4=dob.obj
-          @@is4=newfile=1
+          @per.heading4=dob.obj
+          @per.is4=newfile=1
         end
         if (dob.is==:heading \
         || dob.is==:heading_insert) \
         && dob.ln==3
-          @@heading3=dob.obj
-          @@is4,@@is3=0,1
+          @per.heading3=dob.obj
+          @per.is4,@per.is3=0,1
         end
         if (dob.is==:heading \
         || dob.is==:heading_insert) \
         && dob.ln==2
-          @@heading2=dob.obj
-          @@is4,@@is3,@@is2=0,0,1
+          @per.heading2=dob.obj
+          @per.is4,@per.is3,@per.is2=0,0,1
         end
         if (dob.is==:heading \
         || dob.is==:heading_insert) \
         && dob.ln==1
-          @@heading1=dob.obj
-          @@is4,@@is3,@@is2,@@is1=0,0,0,1
+          @per.heading1=dob.obj
+          @per.is4,@per.is3,@per.is2,@per.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
+          @per.heading0=dob.obj
+          @per.is4,@per.is3,@per.is2,@per.is1,@per.is0=0,0,0,0,1
         end
-        if (@@is1 && !@@is2 && !@@is3 && !@@is4)
+        if (@per.is1 && !@per.is2 && !@per.is3 && !@per.is4)
           if not (dob.is==:heading \
           || dob.is==:heading_insert) \
           && dob.ln==0
             $_ #; check
           end
         end
-        if @@is4==1
+        if @per.is4==1
           if newfile==1 \
           or dob.obj =~/^#{Mx[:br_endnotes]}|^#{Mx[:br_eof]}/
             newfile=0
@@ -332,43 +320,46 @@ module SiSU_HTML_Seg
                   FileUtils::mkdir_p(@file.output_path.html_seg.dir) \
                     if File.writable?("#{@file.output_path.base.dir}/.")
                 end
-                SiSU_HTML_Seg::Seg.new(@md).tail
+                tail(@md,@per)
+                #SiSU_HTML_Seg::Seg.new(@md,@per).tail
                 fnh={
-                  fn: @@seg_name_html[tracking-1],
+                  fn: @per.seg_name_x[tracking-1],
                 }
                 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]
+                output_seg_file=File.new(segfilename,'w') if @per.seg_name_x[tracking-1]
                 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
+                || (@per.seg_name_x[tracking-1] !~/endnotes|book_index|metadata/)
+                  SiSU_HTML_Seg::Output.new(@md,output_seg_file,@per,minitoc).output
                 elsif dob.is==:heading_insert
-                  if @@seg_name_html[tracking-1]=='endnotes'
-                    SiSU_HTML_Seg::Output.new(@md,output_seg_file,@@seg,minitoc,'endnotes').output
-                  elsif @@seg_name_html[tracking-1]=='book_index'
-                    SiSU_HTML_Seg::Output.new(@md,output_seg_file,@@seg,minitoc,'idx').output
-                    @@seg[:idx]=[]
-                  elsif @@seg_name_html[tracking-1]=='metadata'
-                    SiSU_HTML_Seg::Output.new(@md,output_seg_file,@@seg,minitoc,'metadata').output
+                  if @per.seg_name_x[tracking-1]=='endnotes'
+                    SiSU_HTML_Seg::Output.new(@md,output_seg_file,@per,minitoc,'endnotes').output
+                  elsif @per.seg_name_x[tracking-1]=='book_index'
+                    SiSU_HTML_Seg::Output.new(@md,output_seg_file,@per,minitoc,'idx').output
+                    @per.idx=[]
+                  elsif @per.seg_name_x[tracking-1]=='metadata'
+                    SiSU_HTML_Seg::Output.new(@md,output_seg_file,@per,minitoc,'metadata').output
                   else puts "#{__FILE__}::#{__LINE__}"
                   end
                 else puts "#{__FILE__}::#{__LINE__}"
                 end
-                SiSU_HTML_Seg::Seg.new.reinitialise
+                SiSU_HTML_Seg::Seg.new.reinitialise(per)
+                #per=persist_init
                 heading_art(dob)
                 head(dob)
                #keep use for last segment, eg if metadata is last segment
-               if @@seg_name_html[tracking] =='metadata' # this is for metadata
-                 fnh={
-                   fn: @@seg_name_html[tracking],
-                 }
-                 fn=@md.file.base_filename.html_seg(fnh)
-                 segfilename="#{@file.output_path.html_seg.dir}/#{fn}"
-                 output_seg_file=File.new(segfilename,'w')
-                 SiSU_HTML_Seg::Output.new(@md,output_seg_file,@@seg,minitoc,'metadata').output
-                 Seg.new.reinitialise
-               end
+                if @per.seg_name_x[tracking] =='metadata' # this is for metadata
+                  fnh={
+                    fn: @per.seg_name_x[tracking],
+                  }
+                  fn=@md.file.base_filename.html_seg(fnh)
+                  segfilename="#{@file.output_path.html_seg.dir}/#{fn}"
+                  output_seg_file=File.new(segfilename,'w')
+                  SiSU_HTML_Seg::Output.new(@md,output_seg_file,@per,minitoc,'metadata').output
+                  #per=persist_init
+                  Seg.new.reinitialise(per)
+                end
               end
               if tracking==0
                 heading_art(dob)
@@ -381,8 +372,8 @@ module SiSU_HTML_Seg
           || dob.is==:heading_insert) \
           && dob.ln==4 \
           && dob.name
-            @@get_hash_to=dob.name
-            @@get_hash_fn=dob.name
+            @per.get_hash_to=dob.name
+            @per.get_hash_fn=dob.name
           end
           if dob.obj.is_a?(String)
             markup(dob)
@@ -402,108 +393,108 @@ module SiSU_HTML_Seg
     end
     def heading_art(dob)
       format_head_seg=SiSU_HTML_Format::HeadSeg.new(@md)
-      @@seg[:dot_nav]=if (@make.build.html_navigation?) \
+      @per.dot_nav=if (@make.build.html_navigation?) \
       && (@make.build.html_navigation_bar?)
         x=if (dob.is==:heading \
         || dob.is==:heading_insert) \
         && (dob.ln.to_s =~/^[0-7]/)
-          x=if @@tracker < @@seg_total-1
+          x=if @@tracker < @per.seg_name.length-1
             format_head_seg.dot_control_pre_next
           else
             format_head_seg.dot_control_pre
           end
-        else @@seg[:dot_nav]
+        else @per.dot_nav
         end
-      else @@seg[:dot_nav]=''
+      else @per.dot_nav=''
       end
       ads=SiSU_HTML_Promo::Ad.new(@md)
-      @@seg[:title]=format_head_seg.head_seg << ads.div.major
+      @per.title=format_head_seg.head_seg << ads.div.major
     end
     def head(dob)
       clean=/<!.*?!>|<:.*?>/
       format_head_seg=SiSU_HTML_Format::HeadSeg.new(@md)
       if @make.build.html_navigation?
-        if @@tracker < @@seg_total-1
-          @@segtocband=if @@tracker==0
+        if @@tracker < @per.seg_name.length-1
+          @per.segtocband=if @@tracker==0
             format_head_seg.toc_next2
           else
             format_head_seg.toc_pre_next2
           end
-        else @@segtocband=format_head_seg.toc_pre2
+        else @per.segtocband=format_head_seg.toc_pre2
         end
-      else @@segtocband=''
+      else @per.segtocband=''
       end
       @p_num ||= ''
-      if @@is0==1
+      if @per.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])
-        @@seg[:tocband_bannerless] \
+        @per.tocband_banner \
+        << format_head_seg.navigation_band(@per.segtocband,@per.dot_nav)
+        @per.tocband_bannerless \
         << '<br>' \
-        << format_head_seg.navigation_band_bottom(@@segtocband,@@seg[:dot_nav])
+        << format_head_seg.navigation_band_bottom(@per.segtocband,@per.dot_nav)
         if @title_banner_
-          @@seg[:headings] \
+          @per.headings \
           << format_head_seg.title_banner(@md.title.main,@md.title.sub,@author).gsub(clean,'')
         end
-        ocn=(@@heading0[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \
+        ocn=(@per.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 }
+        txt_obj={ txt: @per.heading0, ocn_display: @p_num.ocn_display }
         format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj)
-        @@seg[:headings] \
+        @per.headings \
         << format_seg.title_heading0.gsub(clean,'')
-        @@heading0=@@heading0.
+        @per.heading0=@per.heading0.
           gsub(/&nbsp;<a name="-[\d*+]+" href="#_[\d*+]+">&nbsp;<sup>[\d*+]+<\/sup>&nbsp;<\/a>/,'')
       end
-      if @@is1==1
-        heading1=@@heading1
+      if @per.is1==1
+        heading1=@per.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 }
         format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj)
-        @@seg[:headings] \
+        @per.headings \
         << format_seg.title_heading1.gsub(clean,'')
-        @@heading1=@@heading1.
+        @per.heading1=@per.heading1.
           gsub(/&nbsp;<a name="-[\d*+]+" href="#_[\d*+]+">&nbsp;<sup>[\d*+]+<\/sup>&nbsp;<\/a>/,'')
       end
-      if @@is2==1
-        heading2=@@heading2
+      if @per.is2==1
+        heading2=@per.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_HTML_Format::ParagraphNumber.new(@md,ocn)
         txt_obj={ txt: heading2, ocn_display: @p_num.ocn_display }
         format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj)
-        @@seg[:headings] \
+        @per.headings \
         << format_seg.title_heading2.gsub(clean,'')
-        @@heading2=@@heading2.
+        @per.heading2=@per.heading2.
           gsub(/&nbsp;<a name="-[\d*+]+" href="#_[\d*+]+">&nbsp;<sup>[\d*+]+<\/sup>&nbsp;<\/a>/,'')
       end
-      if @@is3==1
-        heading3=@@heading3
+      if @per.is3==1
+        heading3=@per.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_HTML_Format::ParagraphNumber.new(@md,ocn)
         txt_obj={ txt: heading3, ocn_display: @p_num.ocn_display }
         format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj)
-        @@seg[:headings] \
+        @per.headings \
         << format_seg.title_heading3.gsub(clean,'')
-        @@heading3=@@heading3.
+        @per.heading3=@per.heading3.
           gsub(/&nbsp;<a name="-[\d*+]+" href="#_[\d*+]+">&nbsp;<sup>[\d*+]+<\/sup>&nbsp;<\/a>/,'')
       end
-      if @@is4==1
-        heading4=@@heading4
+      if @per.is4==1
+        heading4=@per.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_HTML_Format::ParagraphNumber.new(@md,ocn)
         txt_obj={ txt: heading4, ocn_display: @p_num.ocn_display }
         format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj)
-        @@seg[:headings] \
+        @per.headings \
         << format_seg.title_heading4.gsub(clean,'')
       end
       @@tracker=@@tracker+1
@@ -586,66 +577,73 @@ module SiSU_HTML_Seg
         if (dob.is==:heading \
         || dob.is==:heading_insert) \
         && dob.ln==4
-          @@seg[:main] << %{\n<div class="#{@cl}">\n}
-          @@seg[:main] << dob_html
+          @per.main << %{\n<div class="#{@cl}">\n}
+          @per.main << dob_html
           if @make.build.segsubtoc?
-            @@seg[:main] << @@seg_subtoc[@@get_hash_fn]                       #% insertion of sub-toc
+            @per.main << @per.seg_subtoc[@per.get_hash_fn]                       #% insertion of sub-toc
           end
         else
-          @@seg[:main] << dob_html #unless @@flag_alt==true
+          @per.main << dob_html #unless @@flag_alt==true
         end
       end
     end
-    def tail
+    def tail(md,per)
+      @md,@per=md,per
       format_head_seg=SiSU_HTML_Format::HeadSeg.new(@md)
-      if @md.flag_auto_endnotes and @@seg_endnotes[@@get_hash_fn]
-        @@seg[:tail] <<  %{\n<div class="#{@cl}">\n<div class="endnote">\n}
-        if @@seg_endnotes[@@get_hash_fn].flatten.length > 0
-          @@seg[:tail] << format_head_seg.endnote_mark
-          @@seg[:tail] << @@seg_endnotes[@@get_hash_fn].flatten #endnotes deposited at end of individual segments ||@|EXTRACTION OF ENDNOTES|
+      if @md.flag_auto_endnotes \
+      and @per.seg_endnotes[@per.get_hash_fn]
+        @per.tail <<  %{\n<div class="#{@cl}">\n<div class="endnote">\n}
+        if @per.seg_endnotes[@per.get_hash_fn].flatten.length > 0
+          @per.tail << format_head_seg.endnote_mark
+          @per.tail << @per.seg_endnotes[@per.get_hash_fn].flatten #endnotes deposited at end of individual segments ||@|EXTRACTION OF ENDNOTES|
         end
-        @@seg[:tail] << '</div>'
-        @@seg[:tail] << '</div>' #this div closes div class content
+        @per.tail << '</div>'
+        @per.tail << '</div>' #this div closes div class content
       end
       ads=SiSU_HTML_Promo::Ad.new(@md)
-      @@seg[:credits] << format_head_seg.credit << ads.div.close << ads.display << format_head_seg.html_close
+      @per.credits \
+      << format_head_seg.credit \
+      << ads.div.close \
+      << ads.display \
+      << format_head_seg.html_close
     end
-    def reinitialise
-      @@seg[:title],@@seg[:dot_nav],@@seg[:tocband_banner],@@seg[:tocband_bannerless],@@seg[:headings],@@seg[:main],@@seg[:tail],@@seg[:credits]=Array.new(8){[]}
-      @@segtocband=nil
+    def reinitialise(per)
+      per.title,per.dot_nav,per.tocband_banner,per.tocband_bannerless,per.headings,per.main,per.tail,per.credits=Array.new(8){[]}
+      @per.segtocband=nil
     end
-    def cleanup
-      reinitialise
-      @@seg_total,@@tracker=0,0
-      @@seg_endnotes,@@seg_subtoc={},{}
-      @@seg_endnotes_array,@@seg_subtoc_array=[],[]
-      @@seg[:endnote_all]=[]
+    def cleanup(md,per)
+      #per=persist_init
+      reinitialise(per)
+      @@tracker=0
+      @per.seg_endnotes,@per.seg_subtoc={},{}
+      @per.seg_endnotes_array,@per.seg_subtoc_array=[],[]
+      per.endnote_all=[]
     end
-    def get_subtoc_endnotes(data) #get endnotes & sub-table of contents subtoc
+    def get_subtoc_endnotes(data,per) #get endnotes & sub-table of contents subtoc
+      @per=per
       data.each do |dob|
         dob.obj=dob.obj.gsub(/<a name=\"h\d.*?\">(.+?)<\/a>/mi,'\1')
         if @md.flag_auto_endnotes
           if (dob.is==:heading \
           || dob.is==:heading_insert) \
           && (dob.ln.to_s =~/^[0-4]/) \
-          and not @@fn.to_s.empty?
-            @@seg_endnotes[@@fn]=[]
-            @@seg_endnotes[@@fn] << @@seg_endnotes_array
-            @@seg_endnotes_array=[] if dob.ln==4
-            @@fns_previous=@md.fns if dob.ln==4 and dob.name =~/^meta/
+          and not @per.fn.to_s.empty?
+            @per.seg_endnotes[@per.fn]=[]
+            @per.seg_endnotes[@per.fn] << @per.seg_endnotes_array
+            @per.seg_endnotes_array=[] if dob.ln==4
           end
           if (dob.is==:heading \
           || dob.is==:heading_insert) \
           && dob.ln==4                                              #%  EXTRACTION OF SUB-TOCs & SEGMENT NAME, after EXTRACTION OF ENDNOTES & SUB-TOCs
-            @@seg_subtoc[@@fn]=@@seg_subtoc_array
-            @@seg_subtoc_array=[]
+            @per.seg_subtoc[@per.fn]=@per.seg_subtoc_array
+            @per.seg_subtoc_array=[]
             if dob.name \
             and dob.obj
-              @@fn=dob.name
+              @per.fn=dob.name
             else
               if dob.name =~/\S+/
-                @@fn=dob.name
-              else @@fn=''
+                @per.fn=dob.name
+              else @per.fn=''
               end
             end
           end
@@ -666,7 +664,7 @@ module SiSU_HTML_Seg
             format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj)
             subtoc=format_seg.subtoc_lev7 #keep and make available, this is the subtoc
           end
-          @@seg_subtoc_array << subtoc
+          @per.seg_subtoc_array << subtoc
         end
         if @md.flag_auto_endnotes
           if (dob.obj =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[\d*+]+\s*<a href="##{Mx[:note_ref]}[\d*+]+"/) \
@@ -676,10 +674,12 @@ module SiSU_HTML_Seg
               endnote_array << dob.obj.scan(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/m)
             end
             if dob.obj=~/#{Mx[:en_b_o]}[*]\d+\s.+?#{Mx[:en_b_c]}/m
-              endnote_array << dob.obj.scan(/#{Mx[:en_b_o]}[*]\d+\s.+?#{Mx[:en_b_c]}/m)
+              endnote_array \
+              << dob.obj.scan(/#{Mx[:en_b_o]}[*]\d+\s.+?#{Mx[:en_b_c]}/m)
             end
             if dob.obj=~/#{Mx[:en_b_o]}[+]\d+\s.+?#{Mx[:en_b_c]}/m
-              endnote_array << dob.obj.scan(/#{Mx[:en_b_o]}[+]\d+\s.+?#{Mx[:en_b_c]}/m)
+              endnote_array \
+              << dob.obj.scan(/#{Mx[:en_b_o]}[+]\d+\s.+?#{Mx[:en_b_c]}/m)
             end
             endnote_array=endnote_array.flatten.compact #watch, check compacting
             endnote_array.each do |note|
@@ -694,7 +694,7 @@ module SiSU_HTML_Seg
                   format_seg.endnote_body_indent
                 else format_seg.endnote_body
                 end
-                @@seg_endnotes_array << note_match
+                @per.seg_endnotes_array << note_match
               end
               try.join('<br>')
               #% creation of separate end segment/page of all endnotes referenced back to reference segment
@@ -703,8 +703,8 @@ module SiSU_HTML_Seg
               endnote_part_b=note_match_seg[m,2]
               txt_obj={ endnote_part_a: endnote_part_a, endnote_part_b: endnote_part_b }
               format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj)
-              note_match_all_seg=format_seg.endnote_seg_body(@@fn) #BUG WATCH 200408
-              @@seg[:endnote_all] << note_match_all_seg
+              note_match_all_seg=format_seg.endnote_seg_body(@per.fn) #BUG WATCH 200408
+              @per.endnote_all << note_match_all_seg
             end
             dob.obj=dob.obj.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ')
           end
index 5a4575cfcf7ccd0cd5b6f8e52029da91db25f2a0..c02fc496e22ca3e1399ae0f771e49424601fa63d 100644 (file)
@@ -151,7 +151,6 @@ module SiSU_HTML_Tune
     end
     def songsheet_array(data)
       data_tuned=[]
-      #@tuned_file=[]
       data.each do |dob|
         dob=amp_angle_brackets(dob)
         dob=endnotes_html(dob)
@@ -162,9 +161,8 @@ module SiSU_HTML_Tune
       data_tuned
     end
     def urls(data)
-      @words=[]
-      data.each do |word|
-        @words << if word=~/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/
+      @words=data.each.map do |word|
+        if word=~/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/
           http_=true
           if word =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/
             m,u=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/.match(word).captures
@@ -208,9 +206,7 @@ module SiSU_HTML_Tune
           word
         else word
         end
-        word
-      end
-      @words=@words.join(' ')
+      end.join(' ')
     end
     def url_markup(dob)
       unless dob.is==:code
@@ -293,10 +289,9 @@ module SiSU_HTML_Tune
     end
     def output
       data=@data
-      @tuned_file=[]
-      data.each do |dob|
+      @tuned_file=data.each.map do |dob|
         dob.obj=dob.obj.strip.chomp
-        @tuned_file << dob
+        dob
       end
       @tuned_file << "\n<EOF>" if (@md.fns =~/\.sst0/) #remove
       @tuned_file
index eb6ab19d261d959977b09f3aba50bd7153afbd36..58d75b02ec81e1eba6e9d805de015f5e9a0afe14 100644 (file)
@@ -133,6 +133,7 @@ module SiSU
       actions.outputs.each_file.xml?
       actions.outputs.each_file.pdf?
       actions.outputs.each_file.man_or_info?
+      actions.outputs.each_file.po4a_make?
       actions.outputs.each_file.sqlite_discrete?
       actions.outputs.each_file.manifest?
     end
@@ -181,6 +182,9 @@ module SiSU
       if defined? actions.outputs.loop_files.run_termsheet?
         actions.outputs.loop_files.run_termsheet?
       end
+      if defined? actions.outputs.loop_files.po4a_setup?
+        actions.outputs.loop_files.po4a_setup?
+      end
       if defined? actions.outputs.loop_files.sql?
         actions.outputs.loop_files.sql?
       end
@@ -198,7 +202,7 @@ module SiSU
     def actions_without_files
       actions=SiSU_Hub_Actions::HubActions.new(@opt)
       actions.report.version_info?
-      actions.report.version_dir?
+      actions.report.version_info_extra?
       actions.prepare.site?
       actions.prepare.sql?
     end
index 8878855dc52683f4556012511ac589ece7ac29fb..1ea67bf464dac37d895963d808790c318ad3d576 100644 (file)
@@ -56,6 +56,8 @@
 =end
 module SiSU_Hub_Actions
   class HubActions
+    require_relative 'utils_composite'                    # utils_composite.rb
+    include SiSU_Composite_Doc_Utils                      # composite doc, .ssm, extract all related insert files, array of filenames test
     def initialize(opt)
       @opt=opt
     end
@@ -65,6 +67,17 @@ module SiSU_Hub_Actions
           SiSU_Env::InfoAbout.new(@opt).sisu_version
         end
       end
+      def version_number_git?
+        if @opt.act[:version_info][:set]==:on \
+        || @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],
+            ' ' + SiSU_is.git_version_info?
+          ).grey
+        end
+      end
       def version_dir?
         if @opt.act[:version_info][:set]==:on \
         || @opt.act[:verbose][:set]==:on \
@@ -76,6 +89,25 @@ module SiSU_Hub_Actions
           ).grey
         end
       end
+      def version_info_extra?
+        if @opt.act[:version_info][:set]==:on \
+        || @opt.act[:verbose][:set]==:on \
+        || @opt.act[:verbose_plus][:set]==:on \
+        || @opt.act[:maintenance][:set]==:on
+          if SiSU_is.git_version_info?
+            SiSU_Screen::Ansi.new(
+              @opt.act[:color_state][:set],
+              ' ' + File.dirname(__FILE__) + \
+              '  vcr: ' + SiSU_is.git_version_info?
+            ).grey
+          else
+            SiSU_Screen::Ansi.new(
+              @opt.act[:color_state][:set],
+              ' ' + File.dirname(__FILE__)
+            ).grey
+          end
+        end
+      end
       self
     end
     def prepare
@@ -156,7 +188,7 @@ module SiSU_Hub_Actions
         def abstract_objects?
           if @opt.act[:ao][:set]==:on                    #% --ao --dal, -m
             if @opt.f_pths.length > 0
-              unless @opt.act[:po4a][:set]==:on          # --po4a, -P
+              unless @opt.act[:po4a_shelf][:set]==:on    # --po4a-shelf
                 if @opt.fno =~ /\.ssm$/
                   require_relative 'ao_composite'        # ao_composite.rb #pre-processing
                   SiSU_Assemble::Composite.new(@opt).read
@@ -278,6 +310,20 @@ module SiSU_Hub_Actions
               end
             end
           end
+          if @opt.act[:txt_orgmode][:set]==:on          #% --orgmode
+            if @opt.f_pths.length > 0
+              require_relative 'txt_orgmode'            # txt_orgmode.rb
+              SiSU_Txt_OrgMode::Source.new(@opt).read
+            else
+              msg='orgmode request requires sisu markup files'
+              if (@opt.act[:verbose_plus][:set]==:on \
+              || @opt.act[:maintenance][:set]==:on)
+                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
+                  mark(msg)
+              else puts msg
+              end
+            end
+          end
         end
         def html?
           if @opt.act[:html][:set]==:on                  #% --html, -h
@@ -532,15 +578,51 @@ module SiSU_Hub_Actions
             end
           end
         end
+        def po4a_make?
+          if @opt.act[:po4a_sst_ao_sst][:set]==:on               #% --po4a-ao
+            if @opt.f_pths.length > 0
+              require_relative 'src_po4a_sst_ao_sst'
+              SiSU_SStm_AO_SStm::Source.new(@opt).read_process_src_files # src_po4a_sst_ao_sst.rb
+            else
+              msg='sst request requires sisu markup files'
+              if (@opt.act[:verbose_plus][:set]==:on \
+              || @opt.act[:maintenance][:set]==:on)
+                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan).
+                  mark(msg)
+              else puts msg
+              end
+            end
+          end
+        end
+        def elasticsearch?
+          if @opt.act[:elasticsearch][:set]==:on         #% --elastic, -x
+            if @opt.f_pths.length > 0
+              require_relative 'json_elastic'            # json_elastic.rb
+              SiSU_Elastic::Source.new(@opt).read
+            else
+              msg='easticsearch request requires sisu markup files'
+              if (@opt.act[:verbose_plus][:set]==:on \
+              || @opt.act[:maintenance][:set]==:on)
+                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
+                  mark(msg)
+              else puts msg
+              end
+            end
+          end
+        end
         def manifest?
           if @opt.act[:manifest][:set]==:on              #% --manifest, -y
             if @opt.f_pths.length > 0
-              require_relative 'html_manifest'                # html_manifest.rb
-              ((@opt.act[:sisupod][:set]==:on \
-              || @opt.act[:share_source][:set]==:on) \
-              && @opt.f_pths.length < 2 ) \
-              ? nil
-              : SiSU_Manifest::Source.new(@opt).read
+              begin
+                require_relative 'html_manifest'           # html_manifest.rb
+                ((@opt.act[:sisupod][:set]==:on \
+                || @opt.act[:share_source][:set]==:on \
+                || @opt.act[:po4a_sstm][:set]==:on) \
+                && @opt.f_pths.length < 2 ) \
+                ? nil
+                : SiSU_Manifest::Source.new(@opt).read
+              rescue
+              end
             else
               msg='manifest request requires sisu markup files'
               if (@opt.act[:verbose_plus][:set]==:on \
@@ -572,8 +654,9 @@ module SiSU_Hub_Actions
       end
       def loop_files
         def share_source?
-          if @opt.act[:share_source][:set]==:on \
-          or @opt.act[:sisupod][:set]==:on \
+          if @opt.act[:sisupod][:set]==:on \
+          or @opt.act[:share_source][:set]==:on \
+          or @opt.act[:po4a_sstm][:set]==:on \
           or @opt.act[:git][:set]==:on
             begin
               if @opt.f_pths.length > 0
@@ -591,26 +674,6 @@ module SiSU_Hub_Actions
                 else puts msg
                 end
               end
-              if @opt.act[:share_source][:set]==:on
-                if @opt.f_pths.length > 0
-                  require_relative 'src_share'           # src_share.rb
-                  begin
-                  ensure
-                    SiSU_Hub_Loops::OptionLoopFiles.new(@opt).
-                    loop_files_on_given_option_bundle do
-                      SiSU_Markup::Source.new(@opt).read
-                    end
-                  end
-                else
-                  msg='share markup source request requires sisu markup files'
-                  if (@opt.act[:verbose_plus][:set]==:on \
-                  || @opt.act[:maintenance][:set]==:on)
-                    SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan).
-                      mark(msg)
-                  else puts msg
-                  end
-                end
-              end
               if @opt.act[:sisupod][:set]==:on           #% --sisupod, -S
                 if @opt.f_pths.length > 0
                   require_relative 'src_sisupod_make'    # src_sisupod_make.rb
@@ -656,7 +719,8 @@ module SiSU_Hub_Actions
                 end
               end
               if (@opt.act[:sisupod][:set]==:on \
-              || @opt.act[:share_source][:set]==:on) \
+              || @opt.act[:share_source][:set]==:on \
+              || @opt.act[:po4a_sstm][:set]==:on) \
               and @opt.act[:manifest][:set]==:on         #% --manifest, -y
                 if @opt.f_pths.length > 0
                   require_relative 'html_manifest'            # html_manifest.rb
@@ -691,18 +755,78 @@ module SiSU_Hub_Actions
               end
             end
           end
-          if @opt.act[:po4a][:set]==:on                  #% --po4a, -P
+          if @opt.act[:share_source][:set]==:on
+            if @opt.f_pths.length > 0
+              require_relative 'src_sisupod_sstm'           # src_sisupod_sstm.rb
+              begin
+              ensure
+                SiSU_Hub_Loops::OptionLoopFiles.new(@opt).
+                loop_files_on_given_option_bundle do
+                  SiSU_Markup::Source_Sisupod.new(@opt).read
+                end
+              end
+            else
+              msg='share markup source request requires sisu markup files'
+              if (@opt.act[:verbose_plus][:set]==:on \
+              || @opt.act[:maintenance][:set]==:on)
+                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan).
+                  mark(msg)
+              else puts msg
+              end
+            end
+          end
+          if @opt.act[:po4a_sstm][:set]==:on                    #% --po4a-sst
+            if @opt.f_pths.length > 0
+              require_relative 'src_po4a_sstm'
+              begin
+                SiSU_Hub_Loops::OptionLoopFiles.new(@opt).
+                loop_files_on_given_option do
+                  SiSU_Markup::Source_Po4a.new(@opt).read       # src_po4a_sstm.rb
+                end
+              ensure
+              end
+            else
+              msg='sst request requires sisu markup files'
+              if (@opt.act[:verbose_plus][:set]==:on \
+              || @opt.act[:maintenance][:set]==:on)
+                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan).
+                  mark(msg)
+              else puts msg
+              end
+            end
+          end
+          if @opt.act[:po4a_sst_ao_sst][:set]==:on               #% --po4a-ao
+            if @opt.f_pths.length > 0
+              require_relative 'src_po4a_sst_ao_sst'
+              begin
+                SiSU_Hub_Loops::OptionLoopFiles.new(@opt).
+                loop_files_on_given_option do
+                  SiSU_SStm_AO_SStm::Source.new(@opt).read_setup # src_po4a_sst_ao_sst.rb
+                end
+              ensure
+              end
+            else
+              msg='sst request requires sisu markup files'
+              if (@opt.act[:verbose_plus][:set]==:on \
+              || @opt.act[:maintenance][:set]==:on)
+                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan).
+                  mark(msg)
+              else puts msg
+              end
+            end
+          end
+          if @opt.act[:po4a_shelf][:set]==:on            #% --po4a-shelf
             if @opt.f_pths.length > 0
-              require_relative 'po4a'
+              require_relative 'src_po4a_shelf'
               begin
                 SiSU_Hub_Loops::OptionLoopFiles.new(@opt).
                 loop_files_on_given_option do
-                  SiSU_Po4a::Source.new(@opt).read       # po4a.rb
+                  SiSU_Po4a::Source.new(@opt).read       # src_po4a_shelf.rb
                 end
               ensure
               end
             else
-              msg='po4a request requires sisu markup files'
+              msg='src_po4a_shelf request requires sisu markup files'
               if (@opt.act[:verbose_plus][:set]==:on \
               || @opt.act[:maintenance][:set]==:on)
                 SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan).
index 626dc8e1b39364eb428679ab4f53d5366f8c27ea..495739aca192c1590f24431e2b8b7971715b4d78 100644 (file)
@@ -136,6 +136,9 @@ module SiSU_Hub_Loops
           files_translated_idx << x[1]
         end
       end
+      #files_translated_idx=number_of_files.select do |x|
+      #  x[1] if x[1].length > 1
+      #end
       if files_translated_idx.flatten.length > 1
         SiSU_Screen::Ansi.new(
           @opt.act[:color_state][:set],
index 8a9af1564a1d93c8cccee5d094444de3a020449f..c36ba4c9d575dad5128a91688381c9d06c709eda 100644 (file)
@@ -175,8 +175,8 @@ module SiSU_Commandline
       @make_instructions_pod=nil
       init
     end
-    def sisu_run_from?
-      @sisu_run_from
+    def sisu_called_from?
+      @call_path
     end
     def sisu_bin_filepath?
       @sisu_run_from
@@ -184,6 +184,9 @@ module SiSU_Commandline
     def sisu_install_type?
       @sisu_install_type
     end
+    def sisu_lib_dir?
+      File.dirname(__FILE__)
+    end
     def sisu_data_dir?
       env=RbConfig::CONFIG
       if sisu_install_type? ==:full_path_to_sisu_bin_in_sisu_dir_tree
@@ -275,17 +278,15 @@ module SiSU_Commandline
       end
     end
     def init_selected_lang_dirs(a)
-      @z=[]
-      a.each do |y|
+      @z=a.each.map do |y|
         if y =~/^#{lng_base}\/(\S+?\.ss[tm])$/
           @fn=$1
-          @z << y
+          y
         elsif y =~/^#{@lang_regx}\/?$/
-          @z << "#{y}/#{@fn}"
-        else @z << y
+          "#{y}/#{@fn}"
+        else y
         end
       end
-      @z
     end
     def init
       a=@a
@@ -640,7 +641,7 @@ module SiSU_Commandline
           if ch =~/N/ then select_arr << '--digests'
             ch=ch.gsub(/[N]/,'')
           end
-          if ch =~/P/ then select_arr << '--po4a'
+          if ch =~/P/ then select_arr << '--po4a-sst'
             ch=ch.gsub(/[P]/,'')
           end
           if ch =~/d/ then select_arr << '--sqlite'
@@ -1176,6 +1177,10 @@ module SiSU_Commandline
         =~/"--rst"|"--rest"|"--restructuredtext"/) \
         ? { bool: true, set: :on }
         : { bool: false, set: :na }
+        act[:txt_orgmode]=(select_arr.inspect \
+        =~/"--org"|"--orgmode"/) \
+        ? { bool: true, set: :on }
+        : { bool: false, set: :na }
         act[:manpage]=(select_arr.inspect \
         =~/"--manpage"|"--man"/) \
         ? { bool: true, set: :on }
@@ -1323,10 +1328,56 @@ module SiSU_Commandline
         =~/"--harvest"/) \
         ? { bool: true, set: :on }
         : { bool: false, set: :na }
-        act[:po4a]=(select_arr.inspect \
-        =~/"--po4a"|"--pot?"/) \
+        act[:po4a_sstm]=(select_arr.inspect \
+        =~/"--po4a-ss[tm]"/) \
+        ? { bool: true, set: :on }
+        : { bool: false, set: :na }
+        act[:po4a_sst_ao_sst]=(select_arr.inspect \
+        =~/"--po4a-ao(?:-ss[tm])?"/) \
+        ? { bool: true, set: :on }
+        : { bool: false, set: :na }
+        act[:po4a_shelf]=(select_arr.inspect \
+        =~/"--po4a-shelf"|"--pot?-shelf"/) \
         ? { bool: true, set: :on }
         : { bool: false, set: :na }
+        if act[:po4a_shelf][:set]==:on \
+        or act[:po4a_sst_ao_sst][:set]==:on \
+        or act[:po4a_sstm][:set]==:on
+          act[:po4a_lang]=if select_arr.inspect \
+          =~/"--(?:trans|init)-([a-z]{2}):((?:(?:[a-z]{2}\b),?)+)/
+            lng_src,lng_trn=$1,$2.split(',')
+            { bool: true, set: :on, src: lng_src, trn: lng_trn }
+          elsif select_arr.inspect \
+          =~/"--trans"/
+            { bool: true, set: :on }
+            { bool: true, set: :on, src: 'en', trn: [] }
+          else
+            { bool: false, set: :na }
+          end
+          act[:po4a_lang_trans]=if select_arr.inspect \
+          =~/"--trans-([a-z]{2}):((?:(?:[a-z]{2}\b),?)+)/
+            lng_src,lng_trn=$1,$2.split(',')
+            { bool: true, set: :on, src: lng_src, trn: lng_trn }
+          elsif select_arr.inspect \
+          =~/"--trans"/
+            { bool: true, set: :on }
+            { bool: true, set: :on, src: 'en', trn: [] }
+          else
+            { bool: false, set: :na }
+          end
+          act[:po4a_lang_init]=if select_arr.inspect \
+          =~/"--init-([a-z]{2}):((?:(?:[a-z]{2}\b),?)+)/
+            lng_src,lng_trn=$1,$2.split(',')
+            { bool: true, set: :on, src: lng_src, trn: lng_trn }
+          else
+            { bool: false, set: :na }
+          end
+        else
+          act[:po4a_lang_trans]= \
+          { bool: false, set: :na }
+          act[:po4a_lang_init]= \
+          { bool: false, set: :na }
+        end
         act[:git]=(select_arr.inspect \
         =~/"--git"/) \
         ? { bool: true, set: :on }
@@ -1433,6 +1484,7 @@ module SiSU_Commandline
         || act[:txt_asciidoc][:set]==:on \
         || act[:txt_markdown][:set]==:on \
         || act[:txt_rst][:set]==:on \
+        || act[:txt_orgmode][:set]==:on \
         || act[:xhtml][:set]==:on \
         || act[:epub][:set]==:on \
         || act[:html][:set]==:on \
@@ -1446,8 +1498,9 @@ module SiSU_Commandline
         || act[:pdf_p][:set]==:on \
         || act[:pdf_l][:set]==:on \
         || act[:qrcode][:set]==:on \
-        || act[:share_source][:set]==:on \
         || act[:sisupod][:set]==:on \
+        || act[:share_source][:set]==:on \
+        || act[:po4a_sstm][:set]==:on \
         || act[:concordance][:set]==:on \
         || act[:sqlite_discrete][:set]==:on \
         || act[:sqlite_import][:set]==:on \
@@ -1481,6 +1534,7 @@ module SiSU_Commandline
         || act[:txt_asciidoc][:set]==:on \
         || act[:txt_markdown][:set]==:on \
         || act[:txt_rst][:set]==:on \
+        || act[:txt_orgmode][:set]==:on \
         || act[:xhtml][:set]==:on \
         || act[:epub][:set]==:on \
         || act[:html][:set]==:on \
@@ -1494,8 +1548,9 @@ module SiSU_Commandline
         || act[:pdf_p][:set]==:on \
         || act[:pdf_l][:set]==:on \
         || act[:qrcode][:set]==:on \
-        || act[:share_source][:set]==:on \
         || act[:sisupod][:set]==:on \
+        || act[:share_source][:set]==:on \
+        || act[:po4a_sstm][:set]==:on \
         || act[:concordance][:set]==:on \
         || act[:xml_dom][:set]==:on \
         || act[:xml_sax][:set]==:on \
index fb5a1f3c0a0deed12d523a009d819beb919e6f6f..f297db550322c59c434107ff0883b3fdb9da19e6 100644 (file)
@@ -63,10 +63,13 @@ module SiSU_Manpage
     include SiSU_ManpageFormat
   require_relative 'shared_metadata'                    # shared_metadata.rb
   require_relative 'generic_parts'                      # generic_parts.rb
+  require_relative 'txt_read'                           # txt_read.rb
+  require_relative 'txt_output'                         # txt_output.rb
   require_relative 'txt_shared'                         # txt_shared.rb
-  @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0
+  @@alt_id_count,@@alt_id_count=0,0
   @@tablefoot=''
   class Source
+    include SiSU_Txt_Read
     def initialize(opt)
       @opt=opt
       if @opt.fns =~/(.+?)\.(?:-|ssm\.)?sst$/
@@ -77,37 +80,14 @@ module SiSU_Manpage
     end
     def read
       begin
-        @md=SiSU_Param::Parameters.new(@opt).get
-        @env=SiSU_Env::InfoEnv.new(@opt.fns)
-        tool=(@opt.act[:verbose][:set]==:on \
-        || @opt.act[:verbose_plus][:set]==:on \
-        || @opt.act[:maintenance][:set]==:on) \
-        ?  "#{@env.program.text_editor} #{@md.file.output_path.manpage.dir}/#{@md.file.base_filename.manpage}"
-        : "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}"
-        (@opt.act[:verbose][:set]==:on \
-        || @opt.act[:verbose_plus][:set]==:on \
-        || @opt.act[:maintenance][:set]==:on) \
-        && @opt.act[:quiet][:set]==:on \
-        ? SiSU_Screen::Ansi.new(
-            @opt.act[:color_state][:set],
-            'Manpage',
-            tool
-          ).green_hi_blue
-        : SiSU_Screen::Ansi.new(
-            @opt.act[:color_state][:set],
-            'Manpage',
-            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.manpage.dir}/#{@md.file.base_filename.manpage}"
-          ).flow
-        end
-        @ao_array=SiSU_AO::Source.new(@opt).get # ao file drawn here
-        SiSU_Manpage::Source::Scroll.new(@md,@ao_array).songsheet
+        md=SiSU_Param::Parameters.new(@opt).get
+        specific={
+          description:     'Manpage',
+          output_path:     md.file.output_path.manpage.dir,
+          output_file:     md.file.base_filename.manpage,
+        }
+        read_generic(@opt,specific)
+        SiSU_Manpage::Source::Scroll.new(md,@ao_array,@wrap_width).songsheet
       rescue
         SiSU_Errors::Rescued.new($!,$@,@opt.selections.str,@opt.fns).location do
           __LINE__.to_s + ':' + __FILE__
@@ -121,8 +101,8 @@ module SiSU_Manpage
       include SiSU_Parts_Generic
       include SiSU_TextUtils
       @@endnotes={ para: [], end: [] }
-      def initialize(md,data)
-        @md,@data=md,data
+      def initialize(md,data,wrap_width)
+        @md,@data,@wrap_width=md,data,wrap_width
         @tab="\t"
         @@notes=:end
         @manpage={ body: [], open: [], close: [], head: [], metadata: [], tail: [], endnotes: [] }
@@ -153,8 +133,8 @@ module SiSU_Manpage
         notes=@n.flatten
         notes.each do |e|
           util=(e.to_s =~/^\[[\d*+]+\]:/) \
-          ? (SiSU_TextUtils::Wrap.new(e.to_s,78,4,1))
-          : (SiSU_TextUtils::Wrap.new(e.to_s,78,0,1))
+          ? (SiSU_TextUtils::Wrap.new(e.to_s,@wrap_width,4,1))
+          : (SiSU_TextUtils::Wrap.new(e.to_s,@wrap_width,0,1))
           wrap=util.line_wrap
           wrap=if wrap =~ /^\s*[\d*+]+\s+.+?\s*\Z/m
             wrap.gsub(/(^|&nbsp;|#{Mx[:nbsp]}|\s|\*)\\\*/,'\1\\\\\*'). #man page requires
@@ -219,19 +199,19 @@ WOK
             if dob.indent =~/[1-9]/ \
             and dob.indent == dob.hang
               util=if dob.bullet_
-                SiSU_TextUtils::Wrap.new("* #{paragraph}",78,dob.indent.to_i*2)
-              else SiSU_TextUtils::Wrap.new(paragraph,78,dob.indent.to_i*2)
+                SiSU_TextUtils::Wrap.new("* #{paragraph}",@wrap_width,dob.indent.to_i*2)
+              else SiSU_TextUtils::Wrap.new(paragraph,@wrap_width,dob.indent.to_i*2)
               end
             elsif dob.hang =~/[0-9]/ \
             and dob.indent != dob.hang                     # NOT yet implemented
-              util=SiSU_TextUtils::Wrap.new(paragraph,78,dob.indent.to_i*2)
+              util=SiSU_TextUtils::Wrap.new(paragraph,@wrap_width,dob.indent.to_i*2)
             else
               util=if dob.bullet_
-                SiSU_TextUtils::Wrap.new("* #{paragraph}",78,0)
-              else SiSU_TextUtils::Wrap.new(paragraph,78,0)
+                SiSU_TextUtils::Wrap.new("* #{paragraph}",@wrap_width,0)
+              else SiSU_TextUtils::Wrap.new(paragraph,@wrap_width,0)
               end
             end
-          else util=SiSU_TextUtils::Wrap.new(paragraph,78,0)
+          else util=SiSU_TextUtils::Wrap.new(paragraph,@wrap_width,0)
           end
           w=util.line_wrap
           w=w.gsub(/^(\\\.)/,' \1')
@@ -239,7 +219,7 @@ WOK
         end
         if lv
           times=wrapped.length
-          times=78 if times > 78
+          times=@wrap_width if times > @wrap_width
           @manpage[:body] << case lv
           when 0    then '.SH ' << wrapped.upcase << break_line << break_line
           when 1..3 then '.SH ' << wrapped.upcase << break_line << break_line
@@ -380,49 +360,18 @@ WOK
         else SiSU_Env::InfoDate.new.year #date missing decide on action
         end
         proj=SiSU_Env::InfoVersion.instance.get_version
-        manpage[:open] = %{.TH "#{@md.fnb}" "#{@md.make.manpage['section']}" "#{date}" "#{proj[:version]}" "#{@md.title.main}"#{@md.make.manpage['name']}#{@md.make.manpage['synopsis']}}
+        manpage[:open] = %{.TH "#{@md.fnb}" "#{@md.make.manpage['section']}" "#{date}" "#{proj.version}" "#{@md.title.main}"#{@md.make.manpage['name']}#{@md.make.manpage['synopsis']}}
         content << manpage[:open]
         content << manpage[:head]
         content << manpage[:body]
         content << @@endnotes[:end] if @@notes==:end
         content << manpage[:metadata]
         content << manpage[:tail]
-        Output.new(@md,content).manpage
+        outputfile=SiSU_Env::FileOp.new(@md).write_file.manpage
+        Txt_Output::Output.new.document(content,outputfile)
         @@endnotes={ para: [], end: [] }
       end
     end
-    class Output <Source
-      include SiSU_Param
-      include SiSU_Env
-      def initialize(md,content)
-        @md,@content=md,content
-      end
-      def manpage                                                            #%manpage output
-        SiSU_Env::FileOp.new(@md).mkdir
-        filename_manpage=SiSU_Env::FileOp.new(@md).write_file.manpage
-        @sisu=[]
-        emptyline=0
-        @content.each do |para|                                                # this is a hack
-          if para.is_a?(Array) \
-          and para.length > 0
-            para.each do |line|
-              if line
-                line=line.gsub(/[ \t]+$/m,'').
-                  gsub(/^\A[ ]*\Z/m,'')
-                (line=~/^\A\Z/) \
-                ? (emptyline+=1)
-                : emptyline=0
-                if emptyline < 2                     #remove additional empty lines
-                  filename_manpage.puts line           #unix manpage
-                end
-              end
-            end
-          else filename_manpage.puts para          #unix manpage # /^([*=-]|\.){5}/
-          end
-        end
-        filename_manpage.close
-      end
-    end
   end
 end
 __END__
diff --git a/lib/sisu/current/object_munge.rb b/lib/sisu/current/object_munge.rb
new file mode 100644 (file)
index 0000000..1baa8ca
--- /dev/null
@@ -0,0 +1,307 @@
+# encoding: utf-8
+=begin
+
+* Name: SiSU
+
+** Description: documents, structuring, processing, publishing, search
+*** object munge
+
+** Author: Ralph Amissah
+  <ralph@amissah.com>
+  <ralph.amissah@gmail.com>
+
+** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+  2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 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>
+
+** Git
+  <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
+  <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/html_parts.rb;hb=HEAD>
+
+=end
+module SiSU_Object_Munge
+  def i_src_o_strip_markup(txtobj)
+    txtobj=txtobj.
+      gsub(/#{Mx[:srcrgx_bold_o]}(.+?)#{Mx[:srcrgx_bold_c]}/m,'\1').
+      gsub(/#{Mx[:srcrgx_italics_o]}(.+?)#{Mx[:srcrgx_italics_c]}/m,'\1').
+      gsub(/#{Mx[:srcrgx_underscore_o]}(.+?)#{Mx[:srcrgx_underscore_c]}/m,'\1').
+      gsub(/#{Mx[:srcrgx_cite_o]}(.+?)#{Mx[:srcrgx_cite_c]}/m,'\1').
+      gsub(/#{Mx[:srcrgx_insert_o]}(.+?)#{Mx[:srcrgx_insert_c]}/m,'\1').
+      gsub(/#{Mx[:srcrgx_strike_o]}(.+?)#{Mx[:srcrgx_strike_c]}/m,'\1').
+      gsub(/#{Mx[:srcrgx_superscript_o]}(\d+)#{Mx[:srcrgx_superscript_c]}/m,'[\1]').
+      gsub(/#{Mx[:srcrgx_superscript_o]}(.+?)#{Mx[:srcrgx_superscript_c]}/m,'\1').
+      gsub(/#{Mx[:srcrgx_subscript_o]}(.+?)#{Mx[:srcrgx_subscript_c]}/m,'\1').
+      gsub(/#{Mx[:srcrgx_hilite_o]}(.+?)#{Mx[:srcrgx_hilite_c]}/m,'\1').
+      gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/i,'~').
+      gsub(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/m,''). # endnote removed
+      gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/m,''). # endnote removed
+      gsub(/(?:#{Mx[:nbsp]})+/,' ').
+      gsub(/(?:#{Mx[:br_nl]})+/,"\n").
+      gsub(/(?:#{Mx[:br_paragraph]})+/,"\n").
+      gsub(/(?:#{Mx[:br_line]})+/,"\n").
+      gsub(/#{Mx[:gl_o]}(?:#lt|#060)#{Mx[:gl_c]}/,'<').
+      gsub(/#{Mx[:gl_o]}(?:#gt|#062)#{Mx[:gl_c]}/,'>').
+      gsub(/#{Mx[:gl_o]}#(?:038|amp)#{Mx[:gl_c]}/,'&').
+      gsub(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!').
+      gsub(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#').
+      gsub(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*').
+      gsub(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-').
+      gsub(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/').
+      gsub(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_').
+      gsub(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{').
+      gsub(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}').
+      gsub(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~').
+      gsub(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'©').
+      gsub(/[ ][ ]s+/,' ').
+      strip
+if txtobj =~/Reading this/
+  puts txtobj
+  if txtobj =~ /#{Mx[:srcrgx_italics_o]}(.+?)#{Mx[:srcrgx_italics_c]}/
+    puts __LINE__
+    puts Mx[:srcrgx_italics_o]
+    puts txtobj
+  end
+end
+; txtobj
+  end
+  def i_ao_o_strip_markup(txtobj)
+    txtobj=txtobj.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\1').
+      gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\1').
+      gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\1').
+      gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'\1').
+      gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'\1').
+      gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'\1').
+      gsub(/#{Mx[:fa_superscript_o]}(\d+)#{Mx[:fa_superscript_c]}/,'[\1]').
+      gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'\1').
+      gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'\1').
+      gsub(/#{Mx[:fa_hilite_o]}(.+?)#{Mx[:fa_hilite_c]}/,'\1').
+      gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/i,'~').
+      gsub(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,''). # endnote removed
+      gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,''). # endnote removed
+      gsub(/(?:#{Mx[:nbsp]})+/,' ').
+      gsub(/(?:#{Mx[:br_nl]})+/,"\n").
+      gsub(/(?:#{Mx[:br_paragraph]})+/,"\n").
+      gsub(/(?:#{Mx[:br_line]})+/,"\n").
+      gsub(/#{Mx[:gl_o]}(?:#lt|#060)#{Mx[:gl_c]}/,'<').
+      gsub(/#{Mx[:gl_o]}(?:#gt|#062)#{Mx[:gl_c]}/,'>').
+      gsub(/#{Mx[:gl_o]}#(?:038|amp)#{Mx[:gl_c]}/,'&').
+      gsub(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!').
+      gsub(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#').
+      gsub(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*').
+      gsub(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-').
+      gsub(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/').
+      gsub(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_').
+      gsub(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{').
+      gsub(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}').
+      gsub(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~').
+      gsub(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'©').
+      gsub(/[ ][ ]s+/,' ').
+      strip
+  end
+  def i_ao_o_src_markup_restore(txtobj)
+    @txtobj=txtobj
+    def textface_marks
+      @txtobj.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'*{\1}*').
+        gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'/{\1}/').
+        gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'_{\1}_').
+        gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'"{\1}"').
+        gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'+{\1}+').
+        gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'-{\1}-').
+        gsub(/#{Mx[:fa_superscript_o]}(\d+)#{Mx[:fa_superscript_c]}/,'^{[\1]}^').
+        gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'^{\1}^').
+        gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,',{\1},').
+        gsub(/#{Mx[:fa_hilite_o]}(.+?)#{Mx[:fa_hilite_c]}/,'\1').
+        gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/i,'~').
+        gsub(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'~{\1 \2}~').
+        gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,''). # endnote removed
+        gsub(/(?:#{Mx[:nbsp]})+/,' ').
+        gsub(/(?:#{Mx[:br_nl]})+/,"\n").
+        gsub(/(?:#{Mx[:br_paragraph]})+/,"\n").
+        gsub(/(?:#{Mx[:br_line]})+/,"\n").
+        gsub(/#{Mx[:gl_o]}(?:#lt|#060)#{Mx[:gl_c]}/,'<').
+        gsub(/#{Mx[:gl_o]}(?:#gt|#062)#{Mx[:gl_c]}/,'>').
+        gsub(/#{Mx[:gl_o]}#(?:038|amp)#{Mx[:gl_c]}/,'&').
+        gsub(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!').
+        gsub(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#').
+        gsub(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*').
+        gsub(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-').
+        gsub(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/').
+        gsub(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_').
+        gsub(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{').
+        gsub(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}').
+        gsub(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~').
+        gsub(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'©').
+        gsub(/[ ][ ]s+/,' ').
+        strip
+    end
+    def object_marks
+      @txtobj
+    end
+    self
+  end
+  def clean_text(txtobj,markup=:ao)
+    if txtobj.class==String
+      txtobj=if markup ==:ao
+        i_ao_o_strip_markup(txtobj)
+      elsif markup ==:src
+        i_src_o_strip_markup(txtobj)
+      else p __FILE__; p __LINE__
+      end
+    elsif txtobj.class.inspect=~/^SiSU_AO_DocumentStructure::/
+      txtobj.obj=i_ao_o_strip_markup(txtobj.obj)
+    else p 'error'
+    end
+    txtobj
+  end
+  def footnotes_inline(txtobj)
+  end
+  def footnotes_ref_and_note(txtobj)
+  end
+  def src_markup(txtobj)
+    txtobj
+  end
+  def extract_endnotes(doc_obj_txt,endnotes_)               #% used for extraction of endnotes from paragraphs
+    if endnotes_ ==:separate
+      notes_a=doc_obj_txt.scan(/#{Mx[:en_a_o]}([\d]+\s+.+?)#{Mx[:en_a_c]}/)
+      ##notes_a=doc_obj_txt.scan(/#{Mx[:en_a_o]}([\d*+]+\s+.+?)#{Mx[:en_a_c]}/)
+      #notes_b=doc_obj_txt.scan(/#{Mx[:en_b_o]}([\d*+]+\s+.+?)#{Mx[:en_b_c]}/)
+      n=[]
+      notes_a.flatten.each do |note| #high cost to deal with <br> appropriately within plaintext, consider
+        note=note.dup.to_s
+        note=note.gsub(/^([\d]+)\s+/,'^~\1 ').
+          gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,
+            ' \\\\\\ ')
+        n << note
+      end
+      notes_a=n.flatten
+      doc_obj_txt=doc_obj_txt.
+        gsub(/#{Mx[:en_a_o]}([\d]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'~^')   # endnote marker marked up
+    else
+      doc_obj_txt=doc_obj_txt.
+        gsub(/#{Mx[:en_b_o]}[\d]+\s+(.+?)#{Mx[:en_b_c]}/,
+          '~[ \1 ]~').     # inline endnote with marker marked up
+        gsub(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)#{Mx[:en_a_c]}/,
+          '~{\1 \2 }~'). # inline endnote with marker marked up
+        gsub(/#{Mx[:en_b_o]}([*+]+)\s+(.+?)#{Mx[:en_b_c]}/,
+          '~[\1 \2 ]~') # inline endnote with marker marked up
+    end
+    [doc_obj_txt,notes_a]
+  end
+  def objects #def i_ao_o_src_markup_restore(txtobj)
+    def code_(dob)
+      if dob.is==:code
+        dob.obj=dob.obj.gsub(/(^|[^}])_([<>])/m,'\1\2'). # _> _<
+          gsub(/(^|[^}])_([<>])/m,'\1\2') # _<_<
+      end
+      dob
+    end
+    def block_(dob)
+      dob.obj=if dob.of==:block                                   # watch
+        dob.obj.gsub(/#{Mx[:gl_o]}●#{Mx[:gl_c]}/,"* ").
+          gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"\n")
+      else dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"\n\n")
+      end
+      dob
+    end
+    def textface_marks_po4a(dob,endnotes_=:inline)
+      notes=''
+      dob.obj=dob.obj.
+        gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,
+          Mx[:src_bold_o] + '\1' + Mx[:src_bold_c]).
+        gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,
+          Mx[:src_italics_o] + '\1' + Mx[:src_italics_c]).
+        gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,
+          Mx[:src_underscore_o] + '\1' + Mx[:src_underscore_c]).
+        gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,
+          Mx[:src_subscript_o] + '\1' + Mx[:src_subscript_c]).
+        gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,
+          Mx[:src_superscript_o] + '\1' + Mx[:src_superscript_c]).
+        gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,
+          Mx[:src_insert_o] + '\1' + Mx[:src_insert_c]).
+        gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,
+          Mx[:src_cite_o] + '\1' + Mx[:src_cite_c]).
+        gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,
+          Mx[:src_strike_o] + '\1' + Mx[:src_strike_c]).
+        gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,
+          Mx[:src_monospace_o] + '\1' + Mx[:src_monospace_c])
+      unless dob.is==:code
+        dob.obj=dob.obj.
+          gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/,'\1').
+          gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1').
+          gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
+            '\1 [link: <\2>]').
+          gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}image/,
+            '\1 [link: local image]').
+          gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1')
+        dob.obj,notes=extract_endnotes(dob.obj,endnotes_)
+        dob.obj=dob.obj.
+          gsub(/#{Mx[:gl_o]}(?:#lt|#060)#{Mx[:gl_c]}/,'<').
+          gsub(/#{Mx[:gl_o]}(?:#gt|#062)#{Mx[:gl_c]}/,'>').
+          gsub(/#{Mx[:gl_o]}#(?:038|amp)#{Mx[:gl_c]}/,'&').
+          gsub(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!').
+          gsub(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#').
+          gsub(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*').
+          gsub(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-').
+          gsub(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/').
+          gsub(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_').
+          gsub(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{').
+          gsub(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}').
+          gsub(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~').
+          gsub(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'©')
+      end
+      dob=block_(dob)
+      dob=code_(dob)
+      dob.obj=dob.obj.gsub(/#{Mx[:br_page]}\s*|#{Mx[:br_page_new]}/,''). # remove page breaks
+        gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1').
+        gsub(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'').                 # remove name links
+        gsub(/&nbsp;|#{Mx[:nbsp]}/,' ').                                 # decide on
+        gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,
+          '    [ \1 ]'). #"[ #{dir.url.images_local}\/\\1 ]")
+        gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}image/,
+          '    [ \1 ]'). #"[ #{dir.url.images_local}\/\\1 ]")
+        gsub(/(?:^|[^_\\])\{\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*\}\S+/,
+          '[image: "\1"]')
+      [dob,notes]
+    end
+    def object_marks
+      @txtobj
+    end
+    self
+  end
+end
+__END__
index 1d76926863be537427b348d1fb5a70359873518d..31621ee764590ce6d5e56a3139091af3ad71ebbb 100644 (file)
@@ -98,7 +98,6 @@ module SiSU_Clear
     def param_instantiate
       @cX||=SiSU_Screen::Ansi.new(@cmd)
       @@date=SiSU_Env::InfoDate.new
-      @@proc=@@filename_txt=@@filename_texinfo=@@filename_html_scroll=@@filename_html_index=@@filename_html_segtoc=@@filename_semantic=@@filename_rss=@@newfile=@@drr=@@yaml=@@yamladdr=nil
       @@publisher='SiSU scribe'
     end
   end
index 3f9cb83448a22c9591a82645cf8b3e2b34f8a53e..f70af907a74b55301a53ca727707f4d68b111933 100644 (file)
@@ -347,6 +347,12 @@ module SiSU_File_Op
         fn=base_filename.rst
         make_file(path,fn)
       end
+      def orgmode
+        path=output_path.orgmode.dir
+        make_path(path)
+        fn=base_filename.orgmode
+        make_file(path,fn)
+      end
       def html_scroll
         pth=output_path.html.dir
         make_path(pth)
@@ -456,18 +462,30 @@ module SiSU_File_Op
         fn=base_filename.manifest_txt
         make_file(path,fn)
       end
+      def po4a_cfg
+        path=output_path.po4a.dir
+        make_path(path)
+        fn=base_filename.po4a_cfg
+        make_file(path,fn)
+      end
       def pot
         path=output_path.pot.dir
         make_path(path)
         fn=base_filename.pot
         make_file(path,fn)
       end
-      def po
-        path=output_path.po.dir
+      def po(lng=@md.opt.lng)
+        path=output_path.po(lng).dir
         make_path(path)
         fn=base_filename.po
         make_file(path,fn)
       end
+      def po4a_sst(lng=@md.opt.lng)
+        path=output_path.po4a_sst(lng).dir
+        make_path(path)
+        fn=base_filename.po4a_sst
+        make_file(path,fn)
+      end
       self
     end
     def place_file
@@ -526,6 +544,17 @@ module SiSU_File_Op
         end
         self
       end
+      def orgmode
+        def dir
+          output_path.orgmode.dir + '/' \
+          + base_filename.orgmode
+        end
+        def rel
+          output_path.orgmode.rel + '/' \
+          + base_filename.orgmode
+        end
+        self
+      end
       def html_scroll
         def dir
           output_path.html_scroll.dir + '/' \
@@ -961,6 +990,24 @@ module SiSU_File_Op
         end
         i18n(fnh)
       end
+      def orgmode(fh=nil)
+        fh=default_hash_build(fh,Sfx[:txt_orgmode])
+        fh[:lng]=lang_code?(fh[:lng])
+        fnh=if output_dir_structure.by_filename?
+          {
+            fn: 'plain',
+            ft: fh[:ft],
+            lng: fh[:lng],
+           }
+         else
+          {
+            fn: fh[:fn],
+            ft: fh[:ft],
+            lng: fh[:lng],
+          }
+        end
+        i18n(fnh)
+      end
       def html_scroll(fh=nil)
         fh=default_hash_build(fh,Sfx[:html])
         fh[:lng]=lang_code?(fh[:lng])
@@ -1411,6 +1458,9 @@ module SiSU_File_Op
       def src
         @md.fno
       end
+      def po4a_cfg
+        'po4a.cfg'
+      end
       def po #check
         (@fno.empty?) \
         ? (@md.fn[:po])
@@ -1421,6 +1471,9 @@ module SiSU_File_Op
         ? (@md.fn[:pot])
         : (@fno + '.pot')
       end
+      def po4a_sst #check
+        @fno
+      end
       def sisupod
         (@md.fns =~/\.ssm\.sst$/) \
         ? @md.fns.gsub(/(?:\~\S{2,3})?\.ssm\.sst$/,'.ssm.txz')
@@ -1712,17 +1765,33 @@ module SiSU_File_Op
         end
         self
       end
-      def po
+      def po4a
+        def dir
+         output_path.base.dir + '/' \
+           + Gt[:src] + '/' \
+           + @md.opt.fng + '/po4a'
+        end
+        def url
+          output_path.base.url + '/po4a/' \
+            + @md.fnb
+        end
+        def rcp
+          #p "#{output_path.base.dir}/po4a/#{@md.fnb}"
+        end
+        self
+      end
+      def po(lng=@md.opt.lng)
+        @lng=lng
         def dir
           output_path.base.dir + '/' \
             + Gt[:src] + '/' \
             + @md.opt.fng + '/po4a/po/' \
-            + @md.opt.lng
+            + @lng
         end
         def url
           output_path.base.url + '/po4a/' \
             + @md.fnb + '/po/' \
-            + @md.opt.lng
+            + @lng
         end
         self
       end
@@ -1766,6 +1835,21 @@ module SiSU_File_Op
         end
         self
       end
+      def po4a_sst(lng=@md.opt.lng)
+        @lng=lng
+        def dir
+          output_path.base.dir + '/' \
+            + Gt[:src] + '/' \
+            + @md.opt.fng + '/po4a/' \
+            + @lng
+        end
+        def url
+          output_path.base.url + '/po4a/' \
+            + @md.fnb \
+            + @lng
+        end
+        self
+      end
       def md_harvest
         manifest
         self
@@ -1879,6 +1963,28 @@ module SiSU_File_Op
         end
         self
       end
+      def orgmode
+        def ft
+          'orgmode' \
+            + DEVELOPER[:under_construction]
+        end
+        def dir
+          set_path(ft).dir.abc
+        end
+        def url
+          set_path(ft).url.abc
+        end
+        def rel
+          set_path(ft).rel.abc
+        end
+        def rcp
+          set_path(ft).rcp.abc
+        end
+        def rel_sm
+          set_path(ft).rel_sm.ab
+        end
+        self
+      end
       def html_scroll
         def ft
           'html'