diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sisu/v3/defaults.rb | 2196 | ||||
-rw-r--r-- | lib/sisu/v5/air.rb (renamed from lib/sisu/v3/air.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/author_format.rb (renamed from lib/sisu/v3/author_format.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/cgi.rb (renamed from lib/sisu/v3/cgi.rb) | 10 | ||||
-rw-r--r-- | lib/sisu/v5/cgi_pgsql.rb (renamed from lib/sisu/v3/cgi_pgsql.rb) | 61 | ||||
-rw-r--r-- | lib/sisu/v5/cgi_sql_common.rb (renamed from lib/sisu/v3/cgi_sql_common.rb) | 59 | ||||
-rw-r--r-- | lib/sisu/v5/cgi_sqlite.rb (renamed from lib/sisu/v3/cgi_sqlite.rb) | 11 | ||||
-rw-r--r-- | lib/sisu/v5/composite.rb (renamed from lib/sisu/v3/composite.rb) | 32 | ||||
-rw-r--r-- | lib/sisu/v5/concordance.rb (renamed from lib/sisu/v3/concordance.rb) | 14 | ||||
-rw-r--r-- | lib/sisu/v5/conf.rb (renamed from lib/sisu/v3/conf.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/constants.rb (renamed from lib/sisu/v3/constants.rb) | 45 | ||||
-rw-r--r-- | lib/sisu/v5/css.rb (renamed from lib/sisu/v3/css.rb) | 21 | ||||
-rw-r--r-- | lib/sisu/v5/dal.rb (renamed from lib/sisu/v3/dal.rb) | 16 | ||||
-rw-r--r-- | lib/sisu/v5/dal_character_check.rb (renamed from lib/sisu/v3/dal_character_check.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/dal_doc_objects.rb (renamed from lib/sisu/v3/dal_doc_objects.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/dal_doc_str.rb (renamed from lib/sisu/v3/dal_doc_str.rb) | 5 | ||||
-rw-r--r-- | lib/sisu/v5/dal_endnotes.rb (renamed from lib/sisu/v3/dal_endnotes.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/dal_expand_insertions.rb (renamed from lib/sisu/v3/dal_expand_insertions.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/dal_hash_digest.rb (renamed from lib/sisu/v3/dal_hash_digest.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/dal_idx.rb (renamed from lib/sisu/v3/dal_idx.rb) | 13 | ||||
-rw-r--r-- | lib/sisu/v5/dal_images.rb (renamed from lib/sisu/v3/dal_images.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/dal_metadata.rb (renamed from lib/sisu/v3/dal_metadata.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/dal_numbering.rb (renamed from lib/sisu/v3/dal_numbering.rb) | 6 | ||||
-rw-r--r-- | lib/sisu/v5/dal_substitutions_and_insertions.rb (renamed from lib/sisu/v3/dal_substitutions_and_insertions.rb) | 11 | ||||
-rw-r--r-- | lib/sisu/v5/dal_syntax.rb (renamed from lib/sisu/v3/dal_syntax.rb) | 64 | ||||
-rw-r--r-- | lib/sisu/v5/db_columns.rb (renamed from lib/sisu/v3/db_columns.rb) | 368 | ||||
-rw-r--r-- | lib/sisu/v5/db_create.rb (renamed from lib/sisu/v3/db_create.rb) | 46 | ||||
-rw-r--r-- | lib/sisu/v5/db_dbi.rb (renamed from lib/sisu/v3/db_dbi.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/db_drop.rb (renamed from lib/sisu/v3/db_drop.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/db_import.rb (renamed from lib/sisu/v3/db_import.rb) | 3 | ||||
-rw-r--r-- | lib/sisu/v5/db_indexes.rb (renamed from lib/sisu/v3/db_indexes.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/db_load_tuple.rb (renamed from lib/sisu/v3/db_load_tuple.rb) | 38 | ||||
-rw-r--r-- | lib/sisu/v5/db_remove.rb (renamed from lib/sisu/v3/db_remove.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/db_select.rb (renamed from lib/sisu/v3/db_select.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/db_sqltxt.rb (renamed from lib/sisu/v3/db_sqltxt.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/db_tests.rb (renamed from lib/sisu/v3/db_tests.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/dbi.rb (renamed from lib/sisu/v3/dbi.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/dbi_discrete.rb (renamed from lib/sisu/v3/dbi_discrete.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/defaults.rb | 1212 | ||||
-rw-r--r-- | lib/sisu/v5/digests.rb (renamed from lib/sisu/v3/digests.rb) | 7 | ||||
-rw-r--r-- | lib/sisu/v5/embedded.rb (renamed from lib/sisu/v3/embedded.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/epub.rb (renamed from lib/sisu/v3/epub.rb) | 128 | ||||
-rw-r--r-- | lib/sisu/v5/epub_concordance.rb (renamed from lib/sisu/v3/epub_concordance.rb) | 17 | ||||
-rw-r--r-- | lib/sisu/v5/epub_format.rb (renamed from lib/sisu/v3/epub_format.rb) | 294 | ||||
-rw-r--r-- | lib/sisu/v5/epub_segments.rb (renamed from lib/sisu/v3/epub_segments.rb) | 10 | ||||
-rw-r--r-- | lib/sisu/v5/epub_tune.rb (renamed from lib/sisu/v3/epub_tune.rb) | 17 | ||||
-rw-r--r-- | lib/sisu/v5/errors.rb (renamed from lib/sisu/v3/errors.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/git.rb (renamed from lib/sisu/v3/git.rb) | 52 | ||||
-rw-r--r-- | lib/sisu/v5/harvest.rb (renamed from lib/sisu/v3/harvest.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/harvest_authors.rb (renamed from lib/sisu/v3/harvest_authors.rb) | 34 | ||||
-rw-r--r-- | lib/sisu/v5/harvest_topics.rb (renamed from lib/sisu/v3/harvest_topics.rb) | 27 | ||||
-rw-r--r-- | lib/sisu/v5/help.rb (renamed from lib/sisu/v3/help.rb) | 320 | ||||
-rw-r--r-- | lib/sisu/v5/html.rb (renamed from lib/sisu/v3/html.rb) | 122 | ||||
-rw-r--r-- | lib/sisu/v5/html_format.rb (renamed from lib/sisu/v3/html_format.rb) | 137 | ||||
-rw-r--r-- | lib/sisu/v5/html_minitoc.rb (renamed from lib/sisu/v3/html_minitoc.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/html_promo.rb (renamed from lib/sisu/v3/html_promo.rb) | 10 | ||||
-rw-r--r-- | lib/sisu/v5/html_scroll.rb (renamed from lib/sisu/v3/html_scroll.rb) | 6 | ||||
-rw-r--r-- | lib/sisu/v5/html_segments.rb (renamed from lib/sisu/v3/html_segments.rb) | 6 | ||||
-rw-r--r-- | lib/sisu/v5/html_table.rb (renamed from lib/sisu/v3/html_table.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/html_tune.rb (renamed from lib/sisu/v3/html_tune.rb) | 6 | ||||
-rw-r--r-- | lib/sisu/v5/hub.rb (renamed from lib/sisu/v3/hub.rb) | 206 | ||||
-rw-r--r-- | lib/sisu/v5/i18n.rb (renamed from lib/sisu/v3/i18n.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/manifest.rb (renamed from lib/sisu/v3/manifest.rb) | 421 | ||||
-rw-r--r-- | lib/sisu/v5/manpage.rb (renamed from lib/sisu/v3/manpage.rb) | 57 | ||||
-rw-r--r-- | lib/sisu/v5/manpage_format.rb (renamed from lib/sisu/v3/manpage_format.rb) | 4 | ||||
-rw-r--r-- | lib/sisu/v5/odf.rb (renamed from lib/sisu/v3/odf.rb) | 17 | ||||
-rw-r--r-- | lib/sisu/v5/odf_format.rb (renamed from lib/sisu/v3/odf_format.rb) | 11 | ||||
-rw-r--r-- | lib/sisu/v5/options.rb (renamed from lib/sisu/v3/options.rb) | 367 | ||||
-rw-r--r-- | lib/sisu/v5/param.rb (renamed from lib/sisu/v3/param.rb) | 591 | ||||
-rw-r--r-- | lib/sisu/v5/param_identify_markup.rb (renamed from lib/sisu/v3/param_identify_markup.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/param_make.rb | 646 | ||||
-rw-r--r-- | lib/sisu/v5/particulars.rb (renamed from lib/sisu/v3/particulars.rb) | 12 | ||||
-rw-r--r-- | lib/sisu/v5/plaintext.rb (renamed from lib/sisu/v3/plaintext.rb) | 13 | ||||
-rw-r--r-- | lib/sisu/v5/plaintext_format.rb (renamed from lib/sisu/v3/plaintext_format.rb) | 4 | ||||
-rw-r--r-- | lib/sisu/v5/po4a.rb (renamed from lib/sisu/v3/po4a.rb) | 37 | ||||
-rw-r--r-- | lib/sisu/v5/po4a_set.rb (renamed from lib/sisu/v3/po4a_set.rb) | 3 | ||||
-rw-r--r-- | lib/sisu/v5/prog_text_translation.rb (renamed from lib/sisu/v3/prog_text_translation.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/qrcode.rb (renamed from lib/sisu/v3/qrcode.rb) | 119 | ||||
-rw-r--r-- | lib/sisu/v5/relaxng.rb (renamed from lib/sisu/v3/relaxng.rb) | 5 | ||||
-rw-r--r-- | lib/sisu/v5/remote.rb (renamed from lib/sisu/v3/remote.rb) | 18 | ||||
-rw-r--r-- | lib/sisu/v5/response.rb (renamed from lib/sisu/v3/response.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/rexml.rb (renamed from lib/sisu/v3/rexml.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/screen_text_color.rb (renamed from lib/sisu/v3/screen_text_color.rb) | 16 | ||||
-rw-r--r-- | lib/sisu/v5/share_src.rb (renamed from lib/sisu/v3/share_src.rb) | 13 | ||||
-rw-r--r-- | lib/sisu/v5/share_src_kdissert.rb (renamed from lib/sisu/v3/share_src_kdissert.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/shared_html.rb (renamed from lib/sisu/v3/shared_html.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/shared_html_lite.rb (renamed from lib/sisu/v3/shared_html_lite.rb) | 6 | ||||
-rw-r--r-- | lib/sisu/v5/shared_images.rb (renamed from lib/sisu/v3/shared_images.rb) | 38 | ||||
-rw-r--r-- | lib/sisu/v5/shared_markup_alt.rb (renamed from lib/sisu/v3/shared_markup_alt.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/shared_metadata.rb (renamed from lib/sisu/v3/shared_metadata.rb) | 247 | ||||
-rw-r--r-- | lib/sisu/v5/shared_sem.rb (renamed from lib/sisu/v3/shared_sem.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/shared_sisupod_source.rb (renamed from lib/sisu/v3/shared_sisupod_source.rb) | 103 | ||||
-rw-r--r-- | lib/sisu/v5/shared_txt.rb (renamed from lib/sisu/v3/shared_txt.rb) | 3 | ||||
-rw-r--r-- | lib/sisu/v5/shared_xhtml.rb (renamed from lib/sisu/v3/shared_xhtml.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/shared_xml.rb (renamed from lib/sisu/v3/shared_xml.rb) | 95 | ||||
-rw-r--r-- | lib/sisu/v5/sisupod_make.rb (renamed from lib/sisu/v3/sisupod_make.rb) | 22 | ||||
-rw-r--r-- | lib/sisu/v5/sitemaps.rb (renamed from lib/sisu/v3/sitemaps.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/spell.rb (renamed from lib/sisu/v3/spell.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/sst_convert_markup.rb (renamed from lib/sisu/v3/sst_convert_markup.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/sst_do_inline_footnotes.rb (renamed from lib/sisu/v3/sst_do_inline_footnotes.rb) | 4 | ||||
-rw-r--r-- | lib/sisu/v5/sst_from_xml.rb (renamed from lib/sisu/v3/sst_from_xml.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/sst_identify_markup.rb (renamed from lib/sisu/v3/sst_identify_markup.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/sst_to_s_xml_sax.rb (renamed from lib/sisu/v3/sst_to_s_xml_sax.rb) | 4 | ||||
-rw-r--r-- | lib/sisu/v5/sysenv.rb (renamed from lib/sisu/v3/sysenv.rb) | 1295 | ||||
-rw-r--r-- | lib/sisu/v5/termsheet.rb (renamed from lib/sisu/v3/termsheet.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/texinfo.rb (renamed from lib/sisu/v3/texinfo.rb) | 6 | ||||
-rw-r--r-- | lib/sisu/v5/texinfo_format.rb (renamed from lib/sisu/v3/texinfo_format.rb) | 50 | ||||
-rw-r--r-- | lib/sisu/v5/texpdf.rb (renamed from lib/sisu/v3/texpdf.rb) | 347 | ||||
-rw-r--r-- | lib/sisu/v5/texpdf_format.rb (renamed from lib/sisu/v3/texpdf_format.rb) | 129 | ||||
-rw-r--r-- | lib/sisu/v5/update.rb (renamed from lib/sisu/v3/update.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/urls.rb (renamed from lib/sisu/v3/urls.rb) | 26 | ||||
-rw-r--r-- | lib/sisu/v5/utils.rb (renamed from lib/sisu/v3/utils.rb) | 18 | ||||
-rw-r--r-- | lib/sisu/v5/webrick.rb (renamed from lib/sisu/v3/webrick.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/wikispeak.rb (renamed from lib/sisu/v3/wikispeak.rb) | 8 | ||||
-rw-r--r-- | lib/sisu/v5/xhtml.rb (renamed from lib/sisu/v3/xhtml.rb) | 6 | ||||
-rw-r--r-- | lib/sisu/v5/xhtml_table.rb (renamed from lib/sisu/v3/xhtml_table.rb) | 4 | ||||
-rw-r--r-- | lib/sisu/v5/xml.rb (renamed from lib/sisu/v3/xml.rb) | 6 | ||||
-rw-r--r-- | lib/sisu/v5/xml_dom.rb (renamed from lib/sisu/v3/xml_dom.rb) | 6 | ||||
-rw-r--r-- | lib/sisu/v5/xml_fictionbook.rb (renamed from lib/sisu/v3/xml_fictionbook.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/xml_format.rb (renamed from lib/sisu/v3/xml_format.rb) | 58 | ||||
-rw-r--r-- | lib/sisu/v5/xml_md_oai_pmh_dc.rb (renamed from lib/sisu/v3/xml_md_oai_pmh_dc.rb) | 85 | ||||
-rw-r--r-- | lib/sisu/v5/xml_scaffold.rb (renamed from lib/sisu/v3/xml_scaffold.rb) | 2 | ||||
-rw-r--r-- | lib/sisu/v5/xml_tables.rb (renamed from lib/sisu/v3/xml_tables.rb) | 8 | ||||
-rw-r--r-- | lib/sisu/v5/zap.rb (renamed from lib/sisu/v3/zap.rb) | 25 |
124 files changed, 5160 insertions, 5511 deletions
diff --git a/lib/sisu/v3/defaults.rb b/lib/sisu/v3/defaults.rb deleted file mode 100644 index 416534d1..00000000 --- a/lib/sisu/v3/defaults.rb +++ /dev/null @@ -1,2196 +0,0 @@ -# encoding: utf-8 -=begin - - * Name: SiSU - - * Description: a framework for document structuring, publishing and search - - * Author: Ralph Amissah - - * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008, 2009, 2010, 2011, 2012, 2013 Ralph Amissah, All Rights Reserved. - - * License: GPL 3 or later: - - SiSU, a framework for document structuring, publishing and search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the Free - Software Foundation, either version 3 of the License, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see <http://www.gnu.org/licenses/>. - - If you have Internet connection, the latest version of the GPL should be - available at these locations: - <http://www.fsf.org/licensing/licenses/gpl.html> - <http://www.gnu.org/licenses/gpl.html> - - <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> - - * SiSU uses: - * Standard SiSU markup syntax, - * Standard SiSU meta-markup syntax, and the - * Standard SiSU object citation numbering and system - - * Hompages: - <http://www.jus.uio.no/sisu> - <http://www.sisudoc.org> - - * Download: - <http://www.sisudoc.org/sisu/en/SiSU/download.html> - - * Git - <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/defaults.rb;hb=HEAD> - - * Ralph Amissah - <ralph@amissah.com> - <ralph.amissah@gmail.com> - - ** Description: Default values (reset by skins) - -=end -$latex_run=nil -module SiSU_Viz - require 'uri' - require_relative 'sysenv' # sysenv.rb - include SiSU_Env - require_relative 'css' # css.rb - include SiSU_Style - class Skin - def initialize - @fonts='verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman' # 'verdana, arial, georgia, tahoma, sans-serif, helvetica, "times new roman", times, roman' - @dir=SiSU_Env::InfoEnv.new - @date=SiSU_Env::InfoDate.new #{@date.year} - @v=SiSU_Env::InfoVersion.instance.get_version - end - #% glyph - def glyph_bullet # • - '• ' # [• flagged] - end - #% html - def html_hardspace - ' ' - end - def semantic_tags - def default - { - pub: 'publication', - conv: 'convention', - vol: 'volume', - pg: 'page', - cty: 'city', - org: 'organization', - uni: 'university', - dept: 'department', - fac: 'faculty', - inst: 'institute', - co: 'company', - com: 'company', - conv: 'convention', - dt: 'date', - y: 'year', - m: 'month', - d: 'day', - ti: 'title', - au: 'author', - ed: 'editor', #editor? - v: 'version', #edition - n: 'name', - fn: 'firstname', - mn: 'middlename', - ln: 'lastname', - in: 'initials', - qt: 'quote', - ct: 'cite', - ref: 'reference', - ab: 'abreviation', - def: 'define', - desc: 'description', - trans: 'translate', - } - end - self - end - #% decorate - def decorate_italics - 'title|article|book|journal' - end - def decorate_bold - end - def decorate_uppercase - 'surname' - end - #% semantic - def sem_title #dc 1 - 'title' - end - def sem_article - 'article' - end - def sem_book - 'book' - end - def sem_journal - 'journal' - end - def sem_fullname # (contains: firstname, surname) #issues arise as contains surname etc. - 'fullname' - end - def sem_first - 'first' - end - def sem_surname - 'surname' - end - def sem_middle - 'middle' - end - def sem_creator #dc 2 #==fullname (contains: firstname, surname) - 'creator' - end - def sem_author #==fullname (contains: firstname, surname) - 'author' - end - def sem_editor #==fullname (contains: firstname, surname) - 'editor' - end - def sem_illustrator #==fullname (contains: firstname, surname) - 'illustrator' - end - def sem_translator #==fullname (contains: firstname, surname) - 'translator' - end - def sem_isbn # 10 or 13 - 'isbn' - end - def sem_isbn_10 - 'isbn10' - end - def sem_isbn_13 - 'isbn13' - end - def sem_loc # library of congress - 'loc' - end - def sem_dewey - 'dewey' - end - def sem_pg # project gutenberg number - 'pg' - end - def sem_subject #dc 3 - 'subject' - end - def sem_date #dc 7 - 'date' - end - def sem_date_created - 'date_created' - end - def sem_date_issued - 'date_issued' - end - def sem_date_available - 'date_available' - end - def sem_date_valid - 'date_valid' - end - def sem_date_modified - 'date_modified' - end - def sem_type #dc 8 - 'type' - end - def sem_description #dc 4 - 'description' - end - def sem_publisher #dc 5 - 'publisher' - end - def sem_contributor #dc 6 - 'contributor' - end - def sem_format #dc 9 - 'format' - end - def sem_identifier #dc 10 - 'identifier' - end - def sem_source #dc 11 - 'source' - end - def sem_language #dc 12 - 'language' - end - def sem_relation #dc 13 - 'source' - end - def sem_coverage #dc 14 - 'coverage' - end - def sem_rights #dc 15 - 'rights' - end - def sem_copyright - 'copyright' - end - def sem_license - 'license' - end - def sem_prepared_by - 'prepared_by' - end - def sem_digitized_by - 'digitized_by' - end - def sem_keywords - 'keywords' - end - def sem_comments - 'comments' - end - def sem_abstract - 'abstract' - end - #% path - def path_stylesheet_home - %{ <link rel="stylesheet" href="./#{@dir.path.style}/homepage.css" type="text/css" />} - end - #% text #changed from txt to avoid naming conflicts #FOLLOW - def txt_generator - %{ <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 txt_generator_comment - %{ <!- #{@v[:project]} #{@v[:version]} of #{@v[:date_stamp]} (#{@v[:date]}) (n*x and Ruby!)" http://www.sisudoc.org/ ->} - end - def txt_hp - ' SiSU' - end - def txt_hp_alias - 'SiSU' - end - def txt_home - 'SiSU' - end - def txt_signature # used in latex/pdf footer - 'SiSU' - end - #% url - def url_urify(uri) - URI.parse(uri) - end - def url_sisu - 'http://www.sisudoc.org/' - end - def url_sisudoc - 'http://www.sisudoc.org' - end - def url_footer_signature - 'http://www.sisudoc.org/' - end - def url_root - '/sisu' #watch - end - def url_root_http - 'http://www.sisudoc.org/' #watch - end - def url_home - 'http://www.sisudoc.org/' # used in pdf header - end - def url_site #used as stub... where there are subdirectories and is different from home - url_home - #'http://www.sisudoc.org/' # used in pdf header - end - def url_txt - 'www.sisudoc.org/' - end - def url_path_image_base #used for html image display - "#{Xx[:html_relative2]}_sisu/image" - end - def url_path_image #used for html image display - "#{Xx[:html_relative2]}_sisu/image" - end - def url_path_image_sys #used for html image display - "#{Xx[:html_relative2]}_sisu/image_sys" - end - def url_path_image_epub - './image' - end - def url_path_ebook_dir - './ebook' - end - def url_path_ebook_images - '.' - end - def url_promo - '' - end - def url_promo_home - '' - end - def url_decoration - def tex_open #'{\UseTextSymbol{OML}{<}}' - Dx[:url_o] - end - def tex_close #'{\UseTextSymbol{OML}{>}}' - Dx[:url_c] - end - def xml_open #'<' - Dx[:url_o] - end - def xml_close #'>' - Dx[:url_c] - end - def txt_open - '<' - end - def txt_close - '>' - end - self - end - def rel_decoration - def tex_open #'{\UseTextSymbol{OML}{<}}' - Dx[:rel_o] - end - def tex_close #'{\UseTextSymbol{OML}{>}}' - Dx[:rel_c] - end - def xml_open #'<' - Dx[:rel_o] - end - def xml_close #'>' - Dx[:rel_c] - end - def txt_open - '<' - end - def txt_close - '>' - end - self - end - #% color - def color_shadow - '"4"' - end - def color_body - %{<body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en">} - end - def color_white - '"#ffffff"' - end - def color_black - '#000000' - end - def color_shadow #hmmm - '"4"' - end - def color_blue_dark - '#000099' - end - def color_blue - 'blue' - end - def color_blue_base - '#b9d4dd' - end - def color_blue_ink - '#003399' - end - def color_blue_tinge - '#e3ecef' - end - def color_blue_grey - '#8faebf' - end - def color_blue_murky - '#437389' - end - def color_beige - '#f1e8de' - end - def color_subtleglow - '#dddccc' - end - def color_glow - '#fff0c3' - end - def color_rose - '#ffdec9' - end - def color_turquoise - '#1c869b' - end - def color_grey_pale - '#eeeeee' - end - def color_grey_medium - '#cccccc' - end - def color_grey - '#999999' - end - def color_yellow_light - '#fff3b6' - end - def color_yellow - '#ffde14' - end - def color_yellow_dark - '#ffcc00' - end - def color_green_light - '#b7d398' # #e2efd5 #b7d398 #b1c999 # '#aed19e' - end - def color_green - '#0a8400' - end - def color_green_dark - '#086800' - end - def color_ruby - '#a00000' - end - def color_maroon - '#800000' - end - def color_paper - %{"#{color_white}"} - end - def color_band1 - %{"#{color_white}"} - end - def color_band2 - %{"#{color_white}"} - end - def color_body - %{<body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en">} - end - def color_font_face #was font WATCH - "#{color_black}" - end - def color_surround - %{"#{color_white}"} - end - def color_band - %{"#{color_white}"} - end - def color_table1 - 'ffffcc' - end - def color_table2 - 'c0d0f0' - end - def color_band1 - '"#ffffff"' - end - def color_band2 - '"#ffffff"' - end - #% icon - def icon_ico - 'rb7.ico' - end - def icon_sisu - 'sisu.png' - end - def icon_manifest - 'b_info.png' - end - def icon_doc - 'b_doc.png' - end - def icon_toc - 'b_toc.png' - end - def icon_wmp - 'b_wmp.png' - end - def icon_odf - 'b_odf.png' - end - def icon_epub - 'b_epub.png' - end - def icon_pdf - 'b_pdf.png' - end - def icon_pdf_portrait - 'b_pdf.png' - end - def icon_pdf_landscape - 'b_pdf.png' - end - def icon_status - 'b_status.png' - end - def icon_external - 'b_ext.png' - end - def icon_external_toc - 'b_ext_toc.png' - end - def icon_seg_toc - 'b_bluebell.png' - end - def icon_crosslink_toc - 'b_amber.png' - end - def icon_mail - 'b_mail.png' - end - def icon_para - 'b_para.png' - end - def icon_pdf - 'b_pdf.png' - end - def icon_ftp - 'b_ftp.png' - end - def icon_gopher - 'b_gopher.png' - end - def icon_choice - 'b_choice.png' - end - def icon_new - 'b_new.png' - end - def icon_book - 'b_amber.png' - # b_book.png - end - def icon_dot_clear - 'dot_clear.png' - end - def icon_dot_white - 'dot_white.png' - end - def icon_dot - icon_dot_white - end - def icon_amber - 'b_amber.png' - end - def icon_rose - 'b_rose.png' - end - def icon_bluebell - 'b_bluebell.png' - end - def icon_home_button - 'sisu.png' - end - def icon_home_banner - 'sisu.png' - end - def icon_site - 'b_home.png' - end - def icon_bluedot - 'blueband.png' - end - def icon_next - 'arrow_next_red.png' - end - def icon_previous - 'arrow_prev_red.png' - end - def icon_up - 'arrow_up_red.png' - end - #% font - def font_fonts - @fonts - end - def font_face - %{face="#{font_fonts}"} - end - def font_lmtoc_face - %{face="#{font_fonts}"} - end - def font_ebook_face - %{face="#{font_fonts}"} - end - def font_face_lmtoc - %{face="#{font_fonts}"} - end - def font_color - 'color="#000000"' - end - def font_size - 'size="4"' - end - def font_size_txt - 'size="4"' - end - def font_size_txt_00 - 'size="3"' - end - def font_size_endnote - 'size="3"' - end - def font_small - 'size="3"' - end - def font_tiny - 'size="2"' - end - #% markup - def markup_italics_list #regular expression of words to be italised - end - def markup_bold_list #regular expression of words to be made bold - 'SiSU' - end - def markup_make_italic - if defined? italics_list \ - and italics_list - make={} - if italics_list - r=italics_list.dup - x=case r - when /\/i$/; 'i' - else '' - end - r=r.gsub(/^\/(.+?)\/i?/,'\1'). - gsub(/\(/,'(?:') # avoid need to escape use of brackets within regex provided - m='\b(' + r + ')\b' - make[:str] - make[:regx]=(x =~/i/) \ - ? (/#{m}/i) - : (/#{m}/) - else nil - end - end - end - def markup_make_bold - if defined? bold_list \ - and not bold_list.empty? - make={} - if bold_list - r=bold_list.dup - x=case r - when /\/i$/; 'i' - else '' - end - r.gsub(/^\/(.+?)\/i?/,'\1'). - gsub(/\(/,'(?:') # avoid need to escape use of brackets within regex provided - m='\b(' + r + ')\b' - make[:str] - make[:regx]=(x =~/i/) \ - ? (/#{m}/i) - : (/#{m}/) - else nil - end - make - end - end - #% paragraph - def paragraph_txt - %{<p class="normal">} - end - def paragraph_txt_00 - %{<p class="justify">} - end - def paragraph_font_citation - %{<font #{font_size_txt} #{font_face}>} - end - def paragraph_endnote - %{<p class="endnote">} - end - def paragraph_table - %{<p align="left"><font #{font_small} #{font_color} #{font_face}>} - end - def paragraph_tiny - %{<p class="tiny">} - end - def paragraph_small - %{<p class="small">} # keep but not used? - end - def paragraph_font_tiny - %{<font #{font_tiny} #{font_face}>} - end - def paragraph_font_small - %{<font #{font_small} #{font_face}>} - end - def paragraph_heading_1 - %{<h1>} - end - def paragraph_heading_1_center - %{<h1 class="center">} - end - #% table - def table_close - '</td></tr> -</table>' - end - def table_close_centered_table - end - def table_align_A - end - def table_align_B - end - def table_align_C - end - def table_width_1 - '"100%"' - end - def table_width_2 - '"99%"' - end - def table_width_3 - '"94%"' - end - def table_width_4 - '"90%"' - end - def table_width_txt - '"94%"' - end - def table_width_txt_avgo - '"100%"' - end - def table_width_txt_r - '"96%"' - end - def table_cellpad_small_paper_margins - '"6"' - end - def table_cellpad_paper_margins - '"36"' - end - def table_cellpad_A - '"0"' - end - def table_cellpad_B - '"20"' - end - def table_cellpad_shadow - '"4"' - end - def table_cellpad_band - '"16"' - end - def table_cellpad_box - '"20"' - end - def table_table_align_A - '<center>' - end - def table_table_align_B - '<center>' - end - def table_table_align_C - ' ' - end - #% table_do - def table_do_table_paper - %{#{table_align_C} <table summary="table paper" width=#{table_width_2} border="0" cellpadding=#{table_cellpad_paper_margins} bgcolor=#{color_paper} align="Justify"><tr><td>\n<font color="#000000"><p />\n} - end - def table_do_table_surround - %{<table summary="table surround" width="100%" border="0" cellpadding="0" bgcolor="#ffffff" align="center"><tr><td>\n} - end - #% indent - def indent_level_0 - '"1%"' - end - def indent_level_1 - '"4%"' - end - def indent_level_2 - '"6%"' - end - def indent_level_3 - '"8%"' - end - def indent_level_4 - '"10%"' - end - #% margin - def margin_num - '</p> </td><td width="4%" align="right" valign="top">' - end - def margin_numless - '</td><td width="4%" align="right" valign="top">' - end - def margin_num_css - '</td> -<td width="2%" align="right" valign="top"> ' - end - def margin_num_header - '</td> -<td width="4%" align="right" valign="top">' - end - def margin_txt_00_1 - %{<table summary="" width=#{table_width_txt} border="0" bgcolor="white" cellpadding="2" align="center"> -<tr><td width=#{indent_level_1} align="right"> -</td> -<td valign="top" align="left" width=#{indent_level_1_c2w100}>} - end - def margin_txt_w1 - %{<table summary="" width=#{table_width_txt_r} border="0" bgcolor="white" cellpadding="2" align="center"> -<tr><td width="6%" align="right"> </td> -<td width="90%" valign="top" align="justify">} - end - def margin_txt_w2 - %{<table summary="" width=#{table_width_txt_r} border="0" bgcolor="white" cellpadding="2" align="center"> -<tr><td width="10%" align="right"> </td> -<td width="86%" valign="top" align="justify">} - end - def margin_txt_0 - %{<table summary="" width=#{table_width_txt} border="0" bgcolor="white" cellpadding="2" align="center"> -<tr><td width=#{indent_level_0} align="right"> -</td><td valign="top" align="justify">} - end - def margin_txt_1 - %{<table summary="" width=#{table_width_txt} border="0" bgcolor="white" cellpadding="2" align="center"> -<tr><td width=#{indent_level_1} align="right"></td><td valign="top" align="justify">} - end - def margin_txt_2 - %{<table summary="" width=#{table_width_txt} border="0" bgcolor="white" cellpadding="2" align="center"> -<tr><td width=#{indent_level_2} align="right"> -</td> -<td valign="top" align="justify">} - end - def margin_txt_3 - %{<table summary="" width=#{table_width_txt} border="0" bgcolor="white" cellpadding="2" align="center"> -<tr><td width=#{indent_level_3} align="right"> -</td> -<td valign="top" align="justify">} - end - def margin_css #unused, check - '<table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center"> -<tr><td valign="top" align="justify"> ' - end - #% png - def png_ico - %{ <link rel="shortcut icon" href="../_sisu/image/#{icon_ico}" />} - end - def png_sisu #check url path - %{ <a href="#{@url.sisu}"> - <img border="0" width="160" height="60" src="#{url_path_image}/#{icon_sisu}" alt="SiSU" /> - </a>} - end - def png_hp - dir=SiSU_Env::InfoEnv.new #(@fns) - %{ <a href="#{url.site}"> - <img border="0" width="160" height="60" src="#{@dir.url.images_local}/#{icon_home_banner}" alt="#{txt_home}" /> - </a>} - end - def png_site - %{<img src="#{url_path_image}/#{icon_site}" alt="@" border="0" />} - end - def png_homepage - png_site - end - def png_nav - %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_bluebell}" alt="Contents" />} - end - def png_manifest - %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_manifest}" alt="Document Manifest" />} - end - def png_doc - %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_doc}" alt="Full Text" />} - end - def png_toc - %{<img border="0" height="18" width="15" src="#{url_path_image_sys}/#{icon_toc}" alt="TOC linked" />} - end - def png_odf - %{<img border="0" height="18" width="18" src="#{url_path_image_sys}/#{icon_odf}" alt="ODF/ODT" />} - end - def png_epub - %{<img border="0" height="18" width="15" src="#{url_path_image_sys}/#{icon_epub}" alt="EPUB" />} - end - def png_pdf - %{<img border="0" height="18" width="15" src="#{url_path_image_sys}/#{icon_pdf}" alt="PDF" />} - end - def png_pdf_portrait - %{<img border="0" height="18" width="15" src="#{url_path_image_sys}/#{icon_pdf}" alt="PDF portrait" />} - end - def png_pdf_landscape - %{<img border="0" height="15" width="18" src="#{url_path_image_sys}/#{icon_pdf}" alt="PDF landscape" />} - end - def png_wmp - %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_wmp}" alt="Concordance" />} - end - def png_para - %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_para}" alt="Segment" />} - end - def png_status - %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_status}" alt="Membership status" />} - end - def png_mark - %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_rose}" alt="*" />} - end - def png_doc_tiny - %{<img border="0" height="8" width="8" src="#{url_path_image_sys}/#{icon_doc}" alt="Doc" />} - end - def png_toc_tiny - %{<img border="0" height="8" width="8" src="#{url_path_image_sys}/#{icon_toc}" alt="TOC" />} - end - def png_status_tiny - %{<img border="0" height="8" width="8" src="#{url_path_image_sys}/#{icon_status}" alt="Status, Member States" />} - end - def png_ftp - %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_ftp}" alt="FTP" />} - end - def png_gopher - %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_gopher}" alt="Gopher" />} - end - def png_crosslink - %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_crosslink_toc}" alt="lateral hop" />} - end - def png_crosslink_ext - %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_external_toc}" alt="lateral hop" />} - end - def png_home - #dir=SiSU_Env::InfoEnv.new #(@fns) - %{<img border="0" src="#{url_path_image_base}/#{icon_home_button}" alt="#{txt_home} -->" />} - #%{<img border="0" src="#{dir.url.images_local}/#{icon_home_button}" alt="#{txt_home} -->" />} - end - def png_home_button - rel=@dir.path_rel_links.html_scroll_2 - %{<img border="0" src="#{rel}/#{icon_home_button}" alt="#{txt_home} -->" />} - end - def png_book - %{<img border="2" height="15" width="15" src="#{url_path_image_sys}/#{icon_book}" alt="Cameron May Books" />} - end - #% png_nav #not currently used - def png_nav_home - end - def png_nav_toc - %{<img border="0" width="22" height="22" src="#{url_path_image_sys}/#{icon_up}" alt="TOC" />} - end - def png_nav_doc - end - def png_nav_previous - %{<img border="0" width="22" height="22" src="#{url_path_image_sys}/#{icon_previous}" alt="<< previous" />} - end - def png_nav_next - %{<img border="0" width="22" height="22" src="#{url_path_image_sys}/#{icon_next}" alt="next >>" />} - end - def png_nav_pre - png_nav_previous - end - def png_nav_nxt - png_nav_next - end - def epub_png_nav_previous - %{<img border="0" width="22" height="22" src="#{url_path_image_epub}/#{icon_previous}" alt="<< previous" />} - end - def epub_png_nav_next - %{<img border="0" width="22" height="22" src="#{url_path_image_epub}/#{icon_next}" alt="next >>" />} - end - def epub_png_nav_up - %{<img border="0" width="22" height="22" src="#{url_path_image_epub}/#{icon_up}" alt="^up ^" />} - end - def epub_png_nav_pre - epub_png_nav_previous - end - def epub_png_nav_nxt - epub_png_nav_next - end - def epub_png_nav_toc - epub_png_nav_up - end - def png_nav_pdf - %{<img border="0" height="18" width="15" src="#{url_path_image_sys}/#{icon_pdf}" alt="PDF" />} - end - def png_nav_pdf_portrait - %{<img border="0" width="15" height="18" src="#{url_path_image_sys}/#{icon_pdf}" alt="pdf portrait" />} - end - def png_nav_pdf_landscape - %{<img border="0" width="18" height="15" src="#{url_path_image_sys}/#{icon_pdf}" alt="pdf landscape" />} - end - def png_nav_dot_toc - %{<img border="0" width="100%" height="20" src="#{url_path_image_sys}/#{icon_dot}" alt="^" />} - end - def png_nav_dot_previous - %{<img border="0" width="100%" height="20" src="#{url_path_image_sys}/#{icon_dot}" alt="<" />} - end - def png_nav_dot_next - %{<img border="0" width="100%" height="20" src="#{url_path_image_sys}/#{icon_dot}" alt=">" />} - end - def png_nav_dot_pre - png_nav_dot_previous - end - def png_nav_dot_nxt - png_nav_dot_next - end - #% nav_txt - def nav_txt_home - %{ <font face="#{font_fonts}" size="2"> - #{png_site} - </font> } - end - def nav_txt_home_button - %{ <font face="#{font_fonts}" size="2"> - #{png_home_button} - </font> } - end - def nav_txt_homepage - %{ <font face="#{font_fonts}" size="2"> - home - </font> } - end - def nav_txt_toc_link - %{ <font face="#{font_fonts}" size="2"> - toc - </font> } - end - def nav_txt_toc_link_verbose - %{ <font face="#{font_fonts}" size="2"> - #{png_toc} segments' toc - </font> } - end - def nav_txt_doc_link - %{ <font face="#{font_fonts}" size="2"> - scroll - </font> } - end - def nav_txt_manifest - #{png_manifest} document manifest - %{ <font face="#{font_fonts}" size="2"> - [ document manifest ] - </font> } - end - def nav_txt_concordance - %{ <font face="#{font_fonts}" size="2"> - A-Z - </font> } - end - def nav_txt_previous - ' <font face="" size="2"> - <b><<</b> Previous - </font> - Full Text ' - end - def nav_txt_next - %{ <font face="#{font_fonts}" size="2"> - Next <b>>></b> - </font> } - end - def nav_txt_plaintext - %{ <font face="#{font_fonts}" size="2"> - txt - </font> } - end - def nav_txt_odf - %{ <font face="#{font_fonts}" size="2"> - odt - </font> } - end - def nav_txt_pdfs - %{ <font face="#{font_fonts}" size="2"> - pdfs - </font> } - end - def nav_txt_epub - %{ <font face="#{font_fonts}" size="2"> - epub - </font> } - end - def nav_txt_pdf_portrait - %{ <font face="#{font_fonts}" size="2"> - pdf - </font> } - end - def nav_txt_pdf_landscape - %{ <font face="#{font_fonts}" size="2"> - pdf - </font> } - end - #% banner - def banner_home - %{ <center> - <a href="#{url_site}/" target="_top"> - #{png_site} - </a> - <br /> - <font size="2" color="#444444"> - an - <br /> - ( international | transnational ) - <br /> - commercial law & e-commerce - <br /> - infrastructure monitor</font></center>} - end - def banner_home_guide - %{ <br /> - <a href="#{url_site}/" target="_top"> - #{png_doc} LM toc - </a> - <a href="../treaties.and.organisations/lm.chronological" target="_top"> - #{png_doc} LM 20** - </a> - <br />} - end - def banner_home_button_only - %{<a href="#{url_site}/"> - #{png_home_button} - </a>} - end - def banner_home_button #yellow_dark now white - %{<table summary="home button" width="100%" border="0" cellpadding="3" bgcolor= "#ffffff" align="center"> -<tr><td align="left" valign="middle" bgcolor="#{color_white}" width="10%"> - <a href="#{url_site}/"> - #{png_home_button} - </a> -</td> -<td width="90%"> -#{table_close}} - end - def banner_home_and_index_buttons #yellow_dark now white - %{<table summary="home and index buttons" bgcolor=#{color_band1}> -<tr><td width="20%"> -<table summary="home button" width="100%" border="0" cellpadding="3" align="center"> -<tr><td align="center" valign="middle" bgcolor="#{color_white}"> - <a href="#{url_site}/" target="_top"> - #{png_home} - </a> -</td></tr> -</table> -</td> -<td width="60%"> -<table summary="other contents buttons" border="0" cellpadding="3" cellspacing="0"> -<tr><td align="center" bgcolor=#{color_band2}> - <font face="arial" size="2"> - <a href="toc" target="_top"> - This text's sub- - <br /> - Table of Contents - </a> - </font> -</td></tr> -</table> -</td> -<td width="20%"> - -#{table_close}} - end - def banner_url_txt_sisu - %{<a href="#{url_sisu}/sisu" target="_top">SiSU</a>} - end - def banner_band #yellow_dark now white - %{<table summary="home button" width="100%" border="0" cellpadding="3" bgcolor= "#ffffff" align="center"> -<tr><td align="left" valign="middle" bgcolor="#{color_white}"> - <a href="#{url_site}/" target="_top"> - #{png_home} - </a> -</td> -<td width="90%"> -#{table_close}} - end - def banner_credit_band - %{<table summary="credits table yellow" width="80%" border="1" cellpadding="0" bgcolor="#{color_yellow_dark}" align="center"> -<tr><td align="center"> -<table summary="salmon" width="100%" border="0" cellpadding="0" bgcolor="#ffdec9"> -<tr><td align="center"> -<table summary="credits white background" width="100%" border="0" cellpadding="6" bgcolor="#ffffff"> -<tr><td align="center">} - end - def banner_instrument_cover_band_scr - '<table summary="scroll instrument cover band" width="100%" border="0" cellpadding="8" bgcolor="#ffffff" align="center"> -<tr><td align="center">' - end - def banner_instrument_cover_band_seg - '<table summary="segment instrument cover band, title, author, location" width="100%" border="0" cellpadding="8" bgcolor="#ffffff" align="center"> -<tr><td align="center">' - end - #% widget - def widget_promo # Array used to build promo from list.yml and promo.yml - # ['sisu_icon','sisu','sisu_search_libre','open_society','fsf','ruby'] - end - def widget_browsers -<<WOK -<tr align="center"><td align="center"> -<table summary="browser suggestions" bgcolor="#ffffff" cellpadding="4" border="0"> -<tr><td> - <p> - <font color="#666666" size="2"> - If you have problems viewing pages on this site please update your browser: - </font> - </p> -#{table_close} -<table summary="browser suggestions" bgcolor="#ffffff" cellpadding="4" border="0"> -<tr><td> - <p> - <font color="#666666" size="1"> - <a href="http://www.gnome.org/projects/epiphany/" target="external"> - Epiphany - </a> - <sup>®</sup> | - </font> - </p> -</td> -<td> - <p> - <font color="#666666" size="1"> - <a href="http://galeon.sourceforge.net/" target="external"> - Galeon - </a> - <sup>®</sup> | - </font> - </p> -</td> -<td> - <p> - <font color="#666666" size="1"> - <a href="http://www.microsoft.com/windows/ie/default.asp" target="external"> - I-Explorer - </a> - <sup>®</sup> | - </font> - </p> -</td> -<td> - <p> - <font color="#666666" size="1"> - <a href="http://kazehakase.sourceforge.jp/" target="external"> - Kazehakase</a> - <sup>®</sup> |</font></p></td> -<td> -<td> - <p> - <font color="#666666" size="1"> - <a href="http://www.konqueror.org/" target="external"> - Konqueror</a> - <sup>®</sup> |</font></p></td> -<td> - <p> - <font color="#666666" size="1"> - <a href="http://www.mozilla.org/" target="external"> - Mozilla - </a> - <a href="http://www.mozilla.org/products/firefox/" target="external"> - <b>Firefox</b> - </a> - <sup>®</sup> | - </font> - </p> -</td> -<td> - <p> - <font color="#666666" size="1"> - <a href="http://home.netscape.com/comprod/mirror/client_download.html" target="external"> - Netscape - </a> - <sup>®</sup> | - </font> - </p> -</td> -<td> - <p> - <font color="#666666" size="1"> - <a href="http://www.opera.com/" target="external"> - Opera - </a> - <sup>®</sup> | - </font> - </p> -</td> -<td> - <p> - <font color="#666666" size="1"> - <a href="http://www.apple.com/safari/" target="external"> - Safari - </a> - <sup>®</sup> - </font> - </p> -#{table_close} -<table summary="lightweight browser and text browser suggestions" bgcolor="#ffffff" cellpadding="4" border="0"> -<tr><td> - <p> - <font color="#666666" size="1"> - for console/text viewing: - </font> - </p> -</td> -<td> - <p> - <font color="#666666" size="1"> - <a href="http://elinks.or.cz/" target="external"> - <b>elinks</b> - </a> | - </font> - </p> -</td> -<td> - <p> - <font color="#666666" size="1"> - <a href="http://atrey.karlin.mff.cuni.cz/~clock/twibright/links" target="external"> - <b>links2</b> - </a> | - </font> - </p> -</td> -<td> - <p> - <font color="#666666" size="1"> - <a href="http://w3m.sourceforge.net/" target="external"> - <b>w3m</b> - </a> - </font> - </p> -</td> -<td> - <p> - <font color="#666666" size="1"> - for lightweight gui (X) viewing try: - </font> - </p> -</td> -<td> - <p> - <font color="#666666" size="1"> - <a href="http://www.dillo.org/" target="external"> - Dillo - </a> - | - </font> - </p> -</td> -<td> - <p> - <font color="#666666" size="1"> - <a href="http://www.gnome.org/projects/epiphany/" target="external"> - Epiphany - </a> - <sup>®</sup> | - </font> - </p> -</td> -<td> - <p> - <font color="#666666" size="1"> - <a href="http://galeon.sourceforge.net/" target="external"> - Galeon - </a> | - </font> - </p> -</td> -<td> - <p> - <font color="#666666" size="1"> - <a href="http://atrey.karlin.mff.cuni.cz/~clock/twibright/links" target="external"> - <b>links2 -g</b> - </a> - </font> - </p> -#{table_close} -</td></tr> -WOK - end - def widgets_open -<<WOK -<table summary="SiSU summary" bgcolor="#ffffff" cellpadding="4" border="0"> -WOK - end - def widget_pdfviewers -<<WOK -<tr align="center"><td align="center"> -<!-- pdf viewer suggestions --> -<tr><td> - <p class="center"> - <font color="#666666" size="1"> - & for - <a href="http://www.adobe.com/products/acrobat/adobepdf.html" target="external"> - pdf - </a> - viewings of this site we recommend stand alone viewers - <br /> - (rather than web browser plugins): - </font> - </p> -</td></tr> -<tr align="center"><td align="center"> - <p class="center"> - <font color="#666666" size="1"> - <a href="http://www.adobe.com/products/acrobat/readstep2.html" target="external"> - Acrobat Reader - </a> - <sup>®</sup> - | - </font> - </p> -</td> -<td> - <p class="center"> - <font color="#666666" size="1"> - <a href="http://www.gnome.org/projects/evince/" target="external"> - <b>Evince</b> - </a> - <sup>®</sup> - </font> - </p> -</td> -<td> - <p class="center"><font color="#666666" size="1"> - <a href="http://www.cs.wisc.edu/~ghost/gv/" target="external"> - GhostView<sup>®</sup> </a>, - <a href="http://wwwthep.physik.uni-mainz.de/~plass/gv/" target="external"> - GV<sup>®</sup> - </a> - & - <a href="http://www.cs.wisc.edu/~ghost/gsview/" target="external"> - GSview<sup>®</sup> - </a> - | - </font> - </p> -</td> -<td> - <p class="center"> - <font color="#666666" size="1"> - <a href="http://www.foolabs.com/xpdf/" target="external"> - Xpdf - </a> - <sup>®</sup> - </font> - </p> -</td></tr> -WOK - end - def widget_sisu_text -<<WOK - <p class="tiny"><font color="#666666" size="2"> - Output generated by - <a href="#{url_sisu}"> - #{@v[:project]} - </a> - #{@v[:version]} #{@v[:date]} (#{@v[:date_stamp]}) - </font></p> -WOK - end - def widget_sisu -<<WOK -<!-- widget sisu --> -<tr><td valign="top" width="100%"> -<!-- SiSU Rights --> -#{widget_sisu_text} -</td></tr> -WOK - end - def widget_sisu_verbose -<<WOK -<!-- widget sisu --> -<tr><td valign="top" width="10%"> - <p class="tiny_left"><font color="#666666" size="2"> - <a href="#{url_sisu}"> - <img border="0" src="../_sisu/image/sisu.png" alt="SiSU" width="120" height="39" /> - </a> - </font></p> -</td><td valign="top" width="45%"> -<!-- SiSU Rights --> - <p class="tiny_left"><font color="#666666" size="2"> - Output generated by - <a href="#{url_sisu}"> - #{@v[:project]} - </a> - #{@v[:version]} #{@v[:date]} (#{@v[:date_stamp]}) - <br /> - <a href="#{url_sisu}"> - <b>#{@v[:project]}</b> - </a> - Copyright <sup>©</sup> Ralph Amissah - 1997, current #{@date.year_static}. - All Rights Reserved. - <br /> - <a href="#{url_sisu}"> - #{@v[:project]} - </a> - is software for document structuring, publishing and search, - <br /> - <a href="#{url_sisu}"> - www.sisudoc.org/ - </a> - and - <a href="#{url_sisudoc}"> - www.sisudoc.org - </a> - <br /> - <i>w3 since October 3 1993</i> - <a href="mailto:ralph@amissah.com"> - ralph@amissah.com - </a> - </font></p> -</td><td valign="top" width="45%"> - <p class="tiny_left"><font color="#666666" size="2"> - #{@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 positioning system) - <br /> - Copyright <sup>©</sup> Ralph Amissah 1997, current #{@date.year_static}. - All Rights Reserved. - </font></p> -</td></tr> -WOK - end - def widget_way_better - <<WOK -<!-- widget way better --> -<tr><td valign="top" width="10%"> - <p class="tiny_left"><font color="#666666" size="2"> - <a href="http://www.gnu.org/licenses/gpl.html"> - <img border="0" src="../_sisu/image/gplv3_free_software.png" alt="GPLv3" width="127" height="51" /> - </a> - </font></p> -</td><td valign="top" width="45%"> - <p class="tiny_left"><font color="#666666" size="2"> - <a href="#{url_sisu}"> - #{@v[:project]} - </a> - is released under - <a href="http://www.gnu.org/licenses/gpl.html">GPLv3</a> - or later, - #{url_decoration.xml_open}<a href="http://www.gnu.org/licenses/gpl.html">http://www.gnu.org/licenses/gpl.html</a>#{url_decoration.xml_close} - </font></p> -</td><td valign="top" width="45%"> - <p class="tiny_left"><font color="#666666" size="2"> - #{@v[:project]}, developed using - <a href="http://www.ruby-lang.org/en/"> - Ruby - </a> - on - <a href="http://www.debian.org/"> - Debian/Gnu/Linux - </a> - software infrastructure, - with the usual GPL (or OSS) suspects. - <br /> - Better - "performance, reliability, scalability, security & total cost of ownership" - [not to mention flexibility & choice] use of and adherence to open standards (where practical and fair) and it is software libré. - <br /> - Get With the Future - <a href="http://www.sisudoc.org/"> - Way Better! - </a> - </font></p> -</td></tr> -WOK - end - #% credits - def credits_itl_cover_band - %{<table summary="itl cover band" width="88%" border="0" cellpadding="0" bgcolor="blue"> -<tr><td> -<table summary="" width="100%" border="0" cellpadding="8" bgcolor="#000099"> -<tr><td> -<table summary="" width="99%" border="1" cellpadding="0" bgcolor="#ffcc00"> -<tr><td> -<table summary="" width="100%" border="1" cellpadding="0" bgcolor="#ffffff"> -<tr><td align="center"> - <font #{font_face}> - <br /> - \@ - <br /> - #{txt_home} - <br /> - #{banner_url_txt_sisu} - <br /> - </font> -#{table_close*4}} - end - def credits_sisu_manifest - widget_sisu_text - end - def credits_sisu - x=%{<div class="substance"> -<table summary="SiSU summary" bgcolor="#ffffff" cellpadding="4" border="0"> -<tr><td> - #{widget_sisu} - #{widget_way_better} -</table></div>} - '' - end - def credits_splash - end - def credits_sisu_epub - x=%{<div class="substance"> -<p class="center"><a href="http://www.openebook.org"><b>EPUB</b></a> generated by <a href="http://www.sisudoc.org"><b>#{@v[:project]}</b></a> v#{@v[:version]}, GPL3</p> -</div>} - '' - end - #% bottom - def bottom_surround - %{</td> -<td align="center" valign="bottom">#{table_close}<table summary="" border="0" width="100%" valign="top"> -<tr><td valign="top" width="20%"><table summary="" width="100%" border="0" cellpadding="0" bgcolor="#e3ecef" align="center"> -<tr><td valign="top"> -#{table_close} -</td> -<td align="center" valign="top"> - #{banner_band} -#{table_close} -<table summary="" border="0" width="100%" valign="top"> -<tr><td valign="top" width="20%"> -<table summary="" width="100%" border="0" cellpadding="0" bgcolor="#e3ecef" align="center"> -<tr><td valign="top"> - #{table_close} -</td> -<td align="center" valign="top"> - #{credits_splash} -#{table_close} -</body> -</html>} - end - end - class Home < Skin - def initialize - @v=SiSU_Env::InfoVersion.instance.get_version - @dir=SiSU_Env::InfoEnv.new - @date=SiSU_Env::InfoDate.new #{@date.year} - end - def redirect - <<WOK -<html><head> -<title>SiSU</title> -<meta http-equiv="refresh" content="0, url=http://www.sisudoc.org/sisu/SiSU/"> -</head> -<body> -SiSU informtion provided at <a href="http://www.sisudoc.org/sisu/SiSU/">www.sisudoc.org/sisu/SiSU</a><p /> -If your browser supports redirection, you will be escorted there shortly. -</body> -</html> -WOK - end - def homepage - <<WOK -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> -<html> -<head> -<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> -<title>SiSU information Structuring Universe - Structured -information, Serialized Units - software for electronic texts, -documents, books, digital libraries in plaintext, html, XHTML, XML, -ODF (OpenDocument), EPUB, LaTeX, PDF, SQL (PostgreSQL and SQLite), and -for search</title> -<meta name="dc.title" - content="SiSU information Structuring Universe, Structured information Serialised Units, #{@date.year_static}" /> -<meta name="dc.creator" content="Ralph Amissah" /> -<meta name="dc.subject" content= -"document structuring, ebook, publishing, PDF, LaTeX, XML, ODF, EPUB, SQL, postgresql, sqlite, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, granular search, digital library" /> -<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!)" /> -<link rel="generator" href="http://www.sisudoc.org/sisu/SiSU" /> -<link rel="stylesheet" href="./#{@dir.path.style}/html.css" type="text/css" /> -<link rel="shortcut icon" href="./_sisu/image/rb7.ico" /> -</head> -<body> -<div id="top_band"> -<p class="top_band_image"> - <a href="http://www.sisudoc.org/sisu/SiSU" target="_top"> - <img border="0" src="./_sisu/image/sisu.png" alt="SiSU >>"> - </a> -</p> -<h1 class="top_band"> - SiSU information Structuring Universe -</h1> -<h2 class="top_band_tiny"> - Structured information, Serialized Units - - <a href="http://www.sisudoc.org" target="_top"> - <www.sisudoc.org> - </a> - or - <a href="http://www.jus.uio.no/sisu/" target="_top"> - <www.jus.uio.no/sisu/> - </a> -</h2> -<h2 class="top_band_tiny"> -software for electronic texts, document collections, books, digital libraries, and search, -</h2> -<h2 class="top_band_tiny"> - with "atomic search" and text positioning system (shared text citation numbering: "<i>ocn</i>") -</h2> -<h2 class="top_band_tiny"> -outputs include: plaintext, html, XHTML, XML, ODF (OpenDocument), EPUB, LaTeX, PDF, SQL (PostgreSQL and SQLite) -</h2> -</div> -<div id="top_band_search"> -</div> -<div id="column_left"> -<p class="bold"> - <a href="http://www.sisudoc.org/sisu/SiSU" target="_top"> - SiSU - </a> -</p> -<p class="tiny"> - --- -</p> -<p class="small"> - <a href="http://www.sisudoc.org/sisu/sisu_manual/" target="_top"> - SiSU Manual - </a> -</p> -<p class="tiny"> - --- -</p> -<p class="small"> - <a href="http://www.sisudoc.org/sisu/SiSU/1.html#summary" target="_top"> - What does SiSU do? Summary - </a> -</p> -<p class="tiny"> - --- -</p> -<p class="small"> - <a href="http://www.sisudoc.org/sisu/SiSU/examples.html" target="_top"> - Book Samples and Markup Examples - </a> -</p> -<p class="small"> - <a href="http://www.sisudoc.org/sisu/sisu_site_metadata/harvest_authors.html" target="_top"> - sorted by Author (sisu metadata) - </a> -</p> -<p class="small"> - <a href="http://www.sisudoc.org/sisu/sisu_site_metadata/harvest_topics.html" target="_top"> - sorted by Topic (sisu metadata) - </a> -</p> -<p class="tiny"> - --- -</p> -<p class="small"> - <a href="http://www.sisudoc.org/sisu/SiSU/1.html#ocn" target="_top"> - Object Citation Numbering - <i>ocn</i> - </a> -</p> -<p class="tiny">(a text positioning system)</p> -<p class="tiny"> - --- -</p> -<p class="small"> - <a href="http://www.sisudoc.org/sisu/SiSU/1.html#search" target="_top"> - Search - "<i>granular</i>" - </a> -</p> -<p class="tiny"> - Of interest is the ease of streaming documents to a relational database, at an object (roughly paragraph) level and the potential for increased precision in the presentation of matches that results thereby. The ability to serialise html, LaTeX, XML, SQL, (whatever) is also inherent in / incidental to the design. For a description see the - <a href="http://www.sisudoc.org/sisu/sisu_provisional_patent_application_200408" target="_top"> - abandoned U.S. provisional patent application - </a> -</p> -<p class="tiny"> - --- -</p> -<p class="small"> - <a href="http://git.sisudoc.org/" target="_top"> - <b>Development, SCM - Git</b> - </a><br /> - <a href="http://git.sisudoc.org/" target="_top"> - <http://git.sisudoc.org> - </a> -</p> -<p class="small"> - <a href="http://www.sisudoc.org/sisu/SiSU/download.html" target="_top"> - <b>Download</b> alternatives - </a> -</p> -<p class="tiny"> - --- -</p> -<p class="small"> - <a href="http://www.sisudoc.org/sisu/SiSU/changelog.html" target="_top"> - Changelog - </a> -</p> -<p class="tiny"> - --- -</p> -<p class="small"> - License, SiSU is licensed under - <a href="http://www.gnu.org/licenses/gpl.html" target="_top"> - GPLv3 or later - </a> -</p> -<p class="tiny"> - Gnu / Linux / Unix -</p> -<p class="tiny"> - Note: the placement of SiSU documents on the Net predate the release of SiSU. -</p> -</div> -<div id="column_center"> -<p class="bold"> -SiSU Short Description -</p> -<p> -SiSU is a comprehensive future-proofing electronic document management system. Built-in search capabilities allow you to search across multiple documents and highlight matches in an easy-to-follow format. Paragraph numbering system allows you to cite your electronic documents in a consistent manner across multiple file formats. Multiple format outputs allow you to display your documents in plain text, PDF (portrait and horizontal), OpenDocument format, HTML, or e-book reading format (EPUB). Word mapping allows you to easily create word indexes for your documents. Future-proofing flexibility allows you to quickly adapt your documents to newer output formats as needed. All these and many other features are achieved with little or no additional work on your documents - by marking up the documents with a super simplistic markup language, leaving the SiSU engine to handle the heavy-lifting processing. -</p> -<p> -Potential users of SiSU include individual authors who want to publish their books or articles electronically to reach a broad audience, web publishers who want to provide multiple channels of access to their electronic documents, or any organizations which centrally manage a medium or large set of electronic documents, especially governmental organizations which may prefer to keep their documents in easily accessible yet non-proprietary formats. -</p> -<p> -SiSU is an Open Source project initiated and led by Ralph Amissah <a href="mailto:ralph.amissah@gmail.com"><ralph.amissah@gmail.com></a> and can be contacted via mailing list <a href="http://lists.sisudoc.org/listinfo/sisu"><http://lists.sisudoc.org/listinfo/sisu></a> at <a href="mailto:sisu@lists.sisudoc.org"><sisu@lists.sisudoc.org></a>. SiSU is licensed under the GNU General Public License. -</p> -<p class="bold"> - For less markup than the most elementary HTML you can have more. -</p> -<p><a href="http://www.sisudoc.org/sisu/SiSU" target="_top"><b>SiSU</b> - Structured information, Serialized Units</a> for electronic documents, is an information structuring, transforming, publishing and search framework with the following features:</p> -<p> -<b>(i)</b> markup syntax: -<b>(a)</b> -simpler than html, -<b>(b)</b> -mnemonic, influenced by mail/messaging/wiki markup practices, -<b>(c)</b> human readable, and easily writable,</p> -<p><b>(ii)</b> -<b>(a)</b> -minimal markup requirement, -<b>(b)</b> -single file marked up for multiple outputs,</p> -<p><b> -notes -</b></p> -<p class="small"> -<b>*</b> -documents are prepared in a single UTF-8 file using a minimalistic mnemonic syntax. Typical literature, documents like "War and Peace" require almost no markup, and most of the headers are optional. -</p> -<p class="small"> -<b>*</b> -markup is easily readable/parsed by the human eye, (basic markup is simpler and more sparse than the most basic html), [this may also be converted to XML representations of the same input/source document]. -</p> -<p class="small"> -<b>*</b> -markup defines document structure (this may be done once in a header pattern-match description, or for heading levels individually); basic text attributes (bold, italics, underscore, strike-through etc.) as required; and semantic information related to the document (header information, extended beyond the Dublin core and easily further extended as required); the headers may also contain processing instructions. -</p> -<p><b>(iii)</b> -<b>(a)</b> -multiple outputs primarily industry established and institutionally accepted open standard formats, include amongst others: plaintext (UTF-8); html; (structured) XML; ODF (Open Document text); EPUB; LaTeX; PDF (via LaTeX); SQL type databases (currently PostgreSQL and SQLite). Also produces: concordance files; document content certificates (md5 or sha256 digests of headings, paragraphs, images etc.) and html manifests (and sitemaps of content). - -<b>(b) -</b> -takes advantage of the strengths implicit in these very different output types, (e.g. PDFs produced using typesetting of LaTeX, databases populated with documents at an individual object/paragraph level, making possible granular search (and related possibilities))</p> -<p><b>(iv)</b> -outputs share a common numbering system (dubbed "object citation numbering" (ocn)) that is meaningful (to man and machine) across various digital outputs whether paper, screen, or database oriented, (PDF, html, XML, EPUB, sqlite, postgresql), this numbering system can be used to reference content.</p> -<p> -<b>(v)</b> -SQL databases are populated at an object level (roughly headings, paragraphs, verse, tables) and become searchable with that degree of granularity, the output information provides the object/paragraph numbers which are relevant across all generated outputs; it is also possible to look at just the matching paragraphs of the documents in the database; [output indexing also work well with search indexing tools like hyperesteier].</p> -<p> -<b>(vi)</b> - use of semantic meta-tags in headers permit the addition of semantic information on documents, (the available fields are easily extended)</p> -<p> -<b>(vii)</b> -creates organised directory/file structure for (file-system) output, easily mapped with its clearly defined structure, with all text objects numbered, you know in advance where in each document output type, a bit of text will be found (e.g. from an SQL search, you know where to go to find the prepared html output or PDF etc.)... there is more; easy directory management and document associations, the document preparation (sub-)directory may be used to determine output (sub-)directory, the skin used, and the SQL database used,</p> -<p> -<b>(viii)</b> -"Concordance file" wordmap, consisting of all the words in a document and their (text/ object) locations within the text, (and the possibility of adding vocabularies),</p> -<p> -<b>(ix)</b> -document content certification and comparison considerations: -<b>(a)</b> -the document and each object within it stamped with an md5 hash making it possible to easily check or guarantee that the substantive content of a document is unchanged, -<b>(b)</b> -version control, documents integrated with time based source control system, default RCS or CVS with use of $Id$ tag, which SiSU checks -</p> -<p> -<b>(x)</b> -SiSU's minimalist markup makes for meaningful "diffing" of the substantive content of markup-files,</p> -<p> -<b>(xi)</b> -easily skinnable, document appearance on a project/site wide, directory wide, or document instance level easily controlled/changed,</p> -<p> -<b>(xii)</b> -in many cases a regular expression may be used (once in the document header) to define all or part of a documents structure obviating or reducing the need to provide structural markup within the document,</p> -<p> -<b>(xiii)</b> -prepared files may be batch process, documents produced are static files so this needs to be done only once but may be repeated for various reasons as desired (updated content, addition of new output formats, updated technology document presentations/representations)</p> -<p> -<b>(xiv)</b> -possible to pre-process, which permits: the easy creation of standard form documents, and templates/term-sheets, or; building of composite documents (master documents) from other sisu marked up documents, or marked up parts, i.e. import documents or parts of text into a main document should this be desired</p> -<p> -there is a considerable degree of future-proofing, output representations are "upgradeable", and new document formats may be added. -</p> -<p> -<b>(xv)</b> -there is a considerable degree of future-proofing, output representations are "upgradeable", and new document formats may be added: -<b>(a)</b> -modular, (thanks in no small part to Ruby) another output format required, write another module.... -<b>(b)</b> easy to update output formats (eg html, XHTML, LaTeX/PDF produced can be updated in program and run against whole document set), -<b>(c)</b> easy to add, modify, or have alternative syntax rules for input, should you need to,</p> -<p> -<b>(xvi)</b> -scalability, dependent on your file-system (ext3, Reiserfs, XFS, whatever) and on the relational database used (currently Postgresql and SQLite), and your hardware,</p> -<p> -<b>(xvii)</b> -only marked up files need be backed up, to secure the larger document set produced,</p> -<p> -<b>(xviii)</b> -document management,</p> -<p> -<b>(xix)</b> -Syntax highlighting for SiSU markup is available for a number of text editors.</p> -<p><b>(xx)</b> remote operations: -<b>(a)</b> -run SiSU on a remote server, (having prepared sisu markup documents locally or on that server, i.e. this solution where sisu is installed on the remote server, would work whatever type of machine you chose to prepare your markup documents on), -<b>(b)</b> -generated document outputs may be posted by sisu to remote sites (using rsync/scp) -<b>(c)</b> -document source (plaintext utf-8) if shared on the net may be identified by its url and processed locally to produce the different document outputs.</p> -<p> -<b>(xxi)</b> -document source may be bundled together (automatically) with associated documents (multiple language versions or master document with inclusions) and images and sent as a zip file called a sisupod, if shared on the net these too may be processed locally to produce the desired document outputs, these may be downloaded, shared as email attachments, or processed by running sisu against them, either using a url or the filename. -</p> -<p> -<b>(xxii)</b> -for basic document generation, the only software dependency is Ruby, and a few standard Unix tools (this covers plaintext, html, XML, ODF, EPUB, LaTeX). To use a database you of course need that, and to convert the LaTeX generated to PDF, a LaTeX processor like tetex or texlive. -</p> -<p> -as a developers tool it is flexible and extensible -</p> -<br /> -<p class="small"> -<a href="http://www.sisudoc.org"><b>SiSU</b></a> at <a href="http://www.sisudoc.org"><www.sisudoc.org></a> or <a href="http://www.jus.uio.no/sisu/"><www.jus.uio.no/sisu/></a></p> -</div> -<div id="column_right"> -<p class="tiny"> -<!-- Search SiSU --> -<a name="search"></a><form method="get" action="http://search.sisudoc.org" target="_top"> -<input type="text" name="s1" size="24" maxlength="255" /> -<br /> -<input type="submit" name="ignore" value="search" /> -<input type="hidden" name="db" value="#{Db[:name_prefix]}sisu" /> -<input type="hidden" name="a" value="1" /> -<input type="radio" name="view" value="index" checked="checked" /> idx -<input type="radio" name="view" value="text" /> txt -<a href="http://search.sisudoc.org" target="_top"><search.sisudoc.org></a> -</form> -<!-- Search SiSU --> -</p> -<p class="tiny"> -SiSU ("SiSU information Structuring Universe" or "Structured information, Serialized Units"),<sup>1</sup> is a Unix command line oriented framework for document structuring, publishing and search. Featuring minimalistic markup, multiple standard outputs, a common citation system, and granular search. -</p> -<p class="tiny"> - Using markup applied to a document, SiSU can produce plain text, HTML, XHTML, XML, OpenDocument, LaTeX or PDF files, and populate an SQL database with objects<sup>2</sup> (equating generally to paragraph-sized chunks) so searches may be performed and matches returned with that degree of granularity (e.g. your search criteria is met by these documents and at these locations within each document). Document output formats share a common object numbering system for locating content. This 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. -</p> - -<p class="small"> -How it works -</p> -<p class="tiny"> -SiSU markup is fairly minimalistic, it consists of: a (largely optional) document header, made up of information about the document (such as when it was published, who authored it, and granting what rights) and any processing instructions; and markup within text which is related to document structure and typeface. SiSU must be able to discern the structure of a document, (text headings and their levels in relation to each other), either from information provided in the instruction header or from markup within the text (or from a combination of both). Processing is done against an abstraction of the document comprising of information on the document's structure and its objects,<sup>2</sup> which the program serializes (providing the object numbers) and which are assigned hash sum values based on their content. This abstraction of information about document structure, objects, (and hash sums), provides considerable flexibility in representing documents different ways and for different purposes (e.g. search, document layout, publishing, content certification, concordance etc.), and makes it possible to take advantage of some of the strengths of established ways of representing documents, (or indeed to create new ones).</p> -<p class="tiny"> -<sup>1.</sup> also chosen for the meaning of the Finnish term "sisu". -</p> -<p class="tiny"> -<sup>2</sup> objects include: headings, paragraphs, verse, tables, images, but not footnotes/endnotes which are numbered separately and tied to the object from which they are referenced.</p> -<p class="small"> - More information on <a href="http://www.sisudoc.org/sisu/SiSU/"><b>SiSU</b></a> provided at: - <a href="http://www.sisudoc.org/sisu/SiSU/"> - <www.sisudoc.org/sisu/SiSU> - </a> -</p> -<p class="tiny"> -SiSU was developed in relation to legal documents, and is strong across a wide variety of texts (law, literature...(humanities, law and part of the social sciences)). SiSU handles images but is not suitable for formulae/ statistics, or for technical writing at this time.</p> -<p class="tiny"> -SiSU has been developed and has been in use for several years. Requirements to cover a wide range of documents within its use domain have been explored.</p> -<p class="small"> -<a href="mailto:ralph@amissah.com"> -<ralph@amissah.com> -</a> -</p> -<p class="small"> -<a href="mailto:ralph.amissah@gmail.com"> -<ralph.amissah@gmail.com> -</a> -</p> -<p class="small"> -<a href="mailto:sisu@lists.sisudoc.org"> -<sisu@lists.sisudoc.org> -</a> -</p> -<p class="small"> -<a href="http://lists.sisudoc.org/listinfo/sisu"> -<http://lists.sisudoc.org/listinfo/sisu> -</a> -</p> -<p class="small"> -#{@date.year_static} -</p> -<p class="tiny"> -w3 since October 3 1993 -</p> -</div> -</body> -</html> -WOK - end - def home_toc - ' ' - end - end - class Inserts - end - class TeX < Skin - def initialize(papersize='') - @papersize=papersize - end - def a4 - def portrait - def w - 160 - end - def h - 228 - end - def img_px - 450 - end - self - end - def landscape - def w - 238 - end - def h - 160 - end - def img_px - 300 - end - self - end - self - end - def letter - def portrait - def w - 166 - end - def h - 212 - end - def img_px - 468 - end - self - end - def landscape - def w - 226 - end - def h - 166 - end - def img_px - 290 - end - self - end - self - end - def legal - def portrait - def w - 168 - end - def h - 286 - end - def img_px - 474 - end - self - end - def landscape - def w - 296 - end - def h - 166 - end - def img_px - 420 - end - self - end - self - end - def b5 - def portrait - def w - 140 - end - def h - 204 - end - def img_px - 356 - end - self - end - def landscape - def w - 200 - end - def h - 130 - end - def img_px - 260 - end - self - end - self - end - def a5 - def portrait - def w - 112 - end - def h - 162 - end - def img_px - 280 - end - self - end - def landscape - def w - 152 - end - def h - 100 - end - def img_px - 190 - end - self - end - self - end - def dimensions - d=case @papersize - when /a4/; a4 - when /letter/; letter - when /legal/; legal - when /b5/; b5 - when /a5/; a5 - else a4 - end - end - end -end -__END__ diff --git a/lib/sisu/v3/air.rb b/lib/sisu/v5/air.rb index d4b49392..cd5c2f68 100644 --- a/lib/sisu/v3/air.rb +++ b/lib/sisu/v5/air.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/air.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/air.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v3/author_format.rb b/lib/sisu/v5/author_format.rb index 5f08ef45..3a9d49a6 100644 --- a/lib/sisu/v3/author_format.rb +++ b/lib/sisu/v5/author_format.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/author_format.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/author_format.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v3/cgi.rb b/lib/sisu/v5/cgi.rb index f0ae55ba..dd9cdf22 100644 --- a/lib/sisu/v3/cgi.rb +++ b/lib/sisu/v5/cgi.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/cgi.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/cgi.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -69,17 +69,9 @@ module SiSU_CGI @opt=opt @webserv=@opt.files[0].to_s.strip end - def search_info - a=%{ - For help on sisu search, type: - sisu --help search - } - SiSU_Screen::Ansi.new(@opt.cmd,a).print_grey - end def read SiSU_CGI_SQLite::SearchSQLite.new(@opt,@webserv).sqlite SiSU_CGI_PgSQL::SearchPgSQL.new(@opt,@webserv).pgsql - search_info unless @opt.cmd =~/q/ end end end diff --git a/lib/sisu/v3/cgi_pgsql.rb b/lib/sisu/v5/cgi_pgsql.rb index 20e51772..8d09f733 100644 --- a/lib/sisu/v3/cgi_pgsql.rb +++ b/lib/sisu/v5/cgi_pgsql.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/cgi_pgsql.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/cgi_pgsql.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -68,10 +68,40 @@ module SiSU_CGI_PgSQL @opt,@webserv=opt,webserv @env=SiSU_Env::InfoEnv.new('',opt) @sys=SiSU_Env::SystemCall.new - @image_src="#{@env.url.webserv_cgi}/_sisu/image_sys" - @common=SiSU_CGI_SQL::CGI_Common.new(@webserv,@opt,@image_src,@env) @db=SiSU_Env::InfoDb.new + get_init=SiSU_Env::GetInit.new + @rc=get_init.sisu_yaml.rc + @name_of={} + if defined? @rc['webserv'] \ + and defined? @rc['webserv']['url_root'] \ + and defined? @rc['webserv']['url_root'] =~/\S+/ + @name_of[:host_url_docs]=@rc['webserv']['url_root'] + end + @name_of[:output_dir_structure]=if defined? @rc['output_dir_structure_by'] \ + and defined? @rc['output_dir_structure_by'] =~/(language|filetype|filename)/ + @rc['output_dir_structure_by'] + else 'language' + end + if defined? @rc['search'] \ + and defined? @rc['search']['sisu'] \ + and defined? @rc['search']['sisu']['action'] \ + and @rc['search']['sisu']['action'] =~/https?:\/\/\S+?\.cgi/ \ + and defined? @rc['search']['sisu']['db'] \ + and @rc['search']['sisu']['db'] =~/\S+/ + @name_of[:db]=@rc['search']['sisu']['db'] + #@name_of[:cgi_script]=/https?:\/\/\S+?([^\/]+?)\.cgi$/.match(@rc['search']['sisu']['action'])[1] + @name_of[:host_url_cgi],@name_of[:cgi_script]=/(https?:\/\/\S+?)\/([^\/]+?)\.cgi$/.match(@rc['search']['sisu']['action'])[1,2] + else + @name_of[:host_url_docs]=@env.url.webserv_files_from_db + @name_of[:db]='sisu' #breaks if not present + @name_of[:host_url_cgi]=@env.url.webserv_base_cgi + @name_of[:cgi_script]='sisu_pgsql' + false + end @cgi_file_name="#{Db[:name_prefix_db]}by_#{opt.dir_structure_by.to_s}_pgsql.cgi" + @cgi_link_name="#{@name_of[:db]}.cgi" #sisu_pgsql.cgi, + @image_src="#{@name_of[:host_url_docs]}/_sisu/image_sys" + @common=SiSU_CGI_SQL::CGI_Common.new(@webserv,@opt,@image_src,@env) end def pgsql serve=[] @@ -90,16 +120,12 @@ module SiSU_CGI_PgSQL serve.each do |x| f1 << %{ <option value="#{Db[:name_prefix]}#{x}">#{x}</option>\n} unless x =~/apache|sisu\/image/ #check end - f2 << %{ selected_db=case cgi['db']\n} - serve.each do |x| - f2 << %{ when /#{Db[:name_prefix]}#{x}/; '<option value="#{Db[:name_prefix]}#{x}">#{x}</option>'\n} unless x =~/apache|sisu\/image/ #check - end end - f2 << " end\n" + f2 << %q{ selected_db=%{<option value="#{@db_name_prefix}#{@stub}">#{@stub}</option>}} + "\n" if FileTest.writable?('.') output=File.open(@cgi_file_name,'w') output << header0 << header1 << header_desc << header2 << f1 << buttons1 << buttons1_pgsql << buttons2 << search_request << search_statement << search_statement_common << search_query1 << @common.pages << search_query2 << @common.tail << @common.main1 << f2 << dbi_connect << @common.main2 << @common.dir_structure << @common.main3 - a=%{ generated sisu_pgsql.cgi, + a=%{ generated #{@cgi_file_name}, BASED ON ALREADY EXISTING directories that could potentially be used to populate postgresql db, (-D) } SiSU_Screen::Ansi.new(@opt.cmd,a).print_grey @@ -108,11 +134,11 @@ module SiSU_CGI_PgSQL else "if necessary make the directory /usr/lib/cgi-bin : sudo cp -vi #{Dir.pwd}/#{@cgi_file_name} /usr/lib/cgi-bin/. sudo chmod -v 755 /usr/lib/cgi-bin/#{@cgi_file_name} - sudo ln -s /usr/lib/cgi-bin/#{@cgi_file_name} /usr/lib/cgi-bin/sisu_pgsql.cgi - (copy #{@cgi_file_name} to your cgi directory) set file permissions to 755, and make symbolic link to sisu_pgsql.cgi" + sudo ln -s /usr/lib/cgi-bin/#{@cgi_file_name} /usr/lib/cgi-bin/#{@cgi_link_name} + (copy #{@cgi_file_name} to your cgi directory) set file permissions to 755, and make symbolic link to #{@cgi_link_name}" end a=%{#{c} - #{@env.webserv_base_cgi}/cgi-bin/sisu_pgsql.cgi + #{@env.webserv_base_cgi}/cgi-bin/#{@cgi_link_name} } SiSU_Screen::Ansi.new(@opt.cmd,a).warn a="postgresql db used for present directory: #{@db.psql.db}" @@ -132,13 +158,14 @@ module SiSU_CGI_PgSQL require 'cgi' require 'fcgi' require 'dbi' - @version='sisu_pgsql' - @image_src="#{@env.url.webserv_cgi}/_sisu/image_sys" - @hosturl_db="#{@env.url.webserv_base_cgi}" - @hosturl_files="#{@env.url.webserv_files_from_db}" + @stub_default="#{@name_of[:db]}" + @image_src="#{@name_of[:host_url_docs]}/_sisu/image_sys" + @hosturl_cgi="#{@name_of[:host_url_cgi]}" + @hosturl_files="#{@name_of[:host_url_docs]}" + @output_dir_structure_by="#{@name_of[:output_dir_structure]}" @port="#{@db.psql.port}" @db_name_prefix="#{Db[:name_prefix]}" - user='#{@env.user}' # check user name for access to pg database: '#{@env.user}' + user='www-data' # check user name for access to pg database: e.g. www-data or '#{@env.user}' WOK_SQL end def search_statement diff --git a/lib/sisu/v3/cgi_sql_common.rb b/lib/sisu/v5/cgi_sql_common.rb index 627cdbfa..5604d6cb 100644 --- a/lib/sisu/v3/cgi_sql_common.rb +++ b/lib/sisu/v5/cgi_sql_common.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/cgi_sql_common.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/cgi_sql_common.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -130,7 +130,7 @@ module SiSU_CGI_SQL <<-'WOK_SQL' #Common TOP @@offset=0 - @base="#{@hosturl_db}/cgi-bin/#{@version}.cgi" + @base="#{@hosturl_cgi}/#{@stub_default}.cgi" #fix sqlite @@canned_search_url=@base @color_heading='#DDFFAA' @color_match='#ffff48' @@ -167,8 +167,7 @@ module SiSU_CGI_SQL <body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en"> <table summary="band" border="0" cellpadding="3" cellspacing="0"> <tr><td align="left" bgcolor="#ffffff"><a href="http://www.jus.uio.no/sisu/" target="_top"><img border="0" src="#{@image_src}/sisu.png" alt="SiSU -->" /></a></td><td> -<!-- <p class="tiny"><a href="http://www.jus.uio.no/sisu/SiSU/"> http://www.jus.uio.no/sisu/SiSU/</a></p> --> - <label for="find"><b>#{@env.sample_search_form_title}</b></label> + <label for="find"><b>#{@env.sample_search_form_title(@opt.dir_structure_by)}</b></label> </td></tr> </table> WOK_SQL @@ -349,11 +348,6 @@ module SiSU_CGI_SQL search[:text] << st[:search] search[:endnotes] << st[:search] end - st=DBI_SearchString.new('metadata_and_text.classify_keywords',search_for.keywords,q['key'],cse).string - if st[:flag] - search[:text] << st[:search] - search[:endnotes] << st[:search] - end st=DBI_SearchString.new('metadata_and_text.title',search_for.title,q['ti'],cse).string if st[:flag] search[:text] << st[:search] @@ -374,6 +368,11 @@ module SiSU_CGI_SQL search[:text] << st[:search] search[:endnotes] << st[:search] end + st=DBI_SearchString.new('metadata_and_text.classify_keywords',search_for.keywords,q['key'],cse).string + if st[:flag] + search[:text] << st[:search] + search[:endnotes] << st[:search] + end st=DBI_SearchString.new('metadata_and_text.notes_description',search_for.description,q['dsc'],cse).string if st[:flag] search[:text] << st[:search] @@ -399,12 +398,7 @@ module SiSU_CGI_SQL search[:text] << st[:search] search[:endnotes] << st[:search] end - st=DBI_SearchString.new('metadata_and_text.classify_type',search_for.type,q['ty'],cse).string - if st[:flag] - search[:text] << st[:search] - search[:endnotes] << st[:search] - end - st=DBI_SearchString.new('metadata_and_text.classify_identifier',search_for.identifier,q['id'],cse).string + st=DBI_SearchString.new('metadata_and_text.notes_type',search_for.type,q['ty'],cse).string if st[:flag] search[:text] << st[:search] search[:endnotes] << st[:search] @@ -419,12 +413,12 @@ module SiSU_CGI_SQL search[:text] << st[:search] search[:endnotes] << st[:search] end - st=DBI_SearchString.new('metadata_and_text.classify_relation',search_for.relation,q['rel'],cse).string + st=DBI_SearchString.new('metadata_and_text.notes_relation',search_for.relation,q['rel'],cse).string if st[:flag] search[:text] << st[:search] search[:endnotes] << st[:search] end - st=DBI_SearchString.new('metadata_and_text.classify_coverage',search_for.coverage,q['cov'],cse).string + st=DBI_SearchString.new('metadata_and_text.notes_coverage',search_for.coverage,q['cov'],cse).string if st[:flag] search[:text] << st[:search] search[:endnotes] << st[:search] @@ -630,14 +624,6 @@ module SiSU_CGI_SQL </a> software infrastructure, with the usual GPL (or OSS) suspects. - <br /> - Better - "performance, reliability, scalability, security & total cost of ownership" - [not to mention flexibility & choice] use of and adherence to open standards (where practical and fair) and it is software libré. - <br /> - Get With the Future - <a href="http://www.jus.uio.no/sisu/"> - Way Better! - </a> </font></p> </td></tr> </table> @@ -656,12 +642,12 @@ module SiSU_CGI_SQL begin # all code goes in begin section @search={ text: [], endnotes: [] } q=CGI.new - @db=if cgi['db'] =~/\S+/ - @stub=/#{@db_name_prefix}(\S+)/.match(cgi['db'])[1] + @db=if cgi['db'] =~ /#{@db_name_prefix}(\S+)/ + @stub=$1 cgi['db'] else - @stub='sisu' - "#{@db_name_prefix}#{@stub}" + @stub=@stub_default + @db_name_prefix + @stub end checked_url,checked_stats,checked_searched,checked_tip,checked_case,checked_echo,checked_sql,checked_all,checked_none,checked_selected,checked_default,selected_db='','','','','','','','','' result_type=(cgi['view']=~/text/) \ @@ -839,7 +825,6 @@ module SiSU_CGI_SQL else end @hostpath="#{@hosturl_files}/#{@stub}" - @ln='en' WOK_SQL end def dir_structure @@ -927,7 +912,7 @@ module SiSU_CGI_SQL can_txt_srch=(cgi['view']=~/index/) \ ? %{<a href="#{@canned_base_url}&fns=#{c['src_filename']}&lang=#{c['language_document_char']}&view=text"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a> } : %{<a href="#{@canned_base_url}&fns=#{c['src_filename']}&lang=#{c['language_document_char']}&view=index"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a> } - title=%{<span style="background-color: #{@color_heading}"><a href="#{path_toc(location,c['language_document_char'])}"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html"> #{ti}</a></span> [#{c['language_document_char']}] by #{c['creator_author']} #{can_txt_srch}<a href="#{path_toc(location,c['language_document_char'])}"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html"></a> <a href="#{path_manifest(location,c['language_document_char'])}"><img border="0" width="15" height="15" src="#{@image_src}/b_info.png" alt="manifest"></a><br />} if file_suffix=~/s/ #hmm watch file_suffix + title=%{<span style="background-color: #{@color_heading}"><a href="#{path_toc(location,c['language_document_char'])}"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html"> #{ti}</a></span> [#{c['language_document_char']}] by #{c['creator_author']} <a href="#{path_manifest(location,c['language_document_char'])}"><img border="0" width="15" height="15" src="#{@image_src}/b_info.png" alt="manifest"></a> #{can_txt_srch}<br />} if file_suffix=~/s/ #hmm watch file_suffix title=@text_search_flag \ ? '<br /><hr>'+title : '<br />'+title @@ -964,7 +949,7 @@ module SiSU_CGI_SQL matched_para=(@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/) \ ? (c['body'].gsub(/(<a\s+href="https?:\/\/[^><\s]+#{@search_regx}[^>]+?>|#{@search_regx})/mi,%{<span style="background-color: #{@color_match}">\\1</span>})) : c['body'] - %{<hr><p><font size="2">ocn <b><a href="#{path_filename(location,c['seg'],@ln)}##{c['ocn']}">#{c['ocn']}</a></b>:</font></p>#{matched_para}} + %{<hr><p><font size="2">ocn <b><a href="#{path_filename(location,c['seg'],c['language_document_char'])}##{c['ocn']}">#{c['ocn']}</a></b>:</font></p>#{matched_para}} elsif c['suffix'] =~/1/ #doc %{#{title}<hr><p><font size="2">ocn #{c['ocn']}:#{c['body']}} end @@ -972,9 +957,9 @@ module SiSU_CGI_SQL output=title+text else #elsif cgi['view']=~/index/ #% idx body if c['suffix'] !~/1/ #seg - index=%{<a href="#{path_filename(location,c['seg'],@ln)}##{c['ocn']}">#{c['ocn']}</a>, } if @text_search_flag + index=%{<a href="#{path_filename(location,c['seg'],c['language_document_char'])}##{c['ocn']}">#{c['ocn']}</a>, } if @text_search_flag elsif c['suffix'] =~/1/ #doc #FIX - index=%{<a href="#{path_html_doc(location,@ln)}##{c['ocn']}">#{c['ocn']}</a>, } + index=%{<a href="#{path_html_doc(location,c['language_document_char'])}##{c['ocn']}">#{c['ocn']}</a>, } end if c['seg'] =~/\S+/ if @text_search_flag @@ -1020,7 +1005,7 @@ module SiSU_CGI_SQL can_txt_srch=(cgi['view']=~/index/) \ ? %{<a href="#{@canned_base_url}&fns=#{e['src_filename']}&lang=#{e['language_document_char']}&view=text"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a> } : %{<a href="#{@canned_base_url}&fns=#{e['src_filename']}&lang=#{e['language_document_char']}&view=index"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a> } - title=%{<br /><hr><span style="background-color: #{@color_heading}"><a href="#{path_toc(location,@ln)}"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html"> #{ti}</a></span> [#{e['language_document_char']}] by #{e['creator_author']} #{can_txt_srch}<a href="#{path_toc(location,@ln)}"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html"></a> <a href="#{path_manifest(location,@ln)}"><img border="0" width="15" height="15" src="#{@image_src}/b_info.png" alt="manifest"></a><br />} if file_suffix=~/s/ + title=%{<br /><hr><span style="background-color: #{@color_heading}"><a href="#{path_toc(location,e['language_document_char'])}"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html"> #{ti}</a></span> [#{e['language_document_char']}] by #{e['creator_author']} #{can_txt_srch}<a href="#{path_toc(location,e['language_document_char'])}"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html"></a> <a href="#{path_manifest(location,e['language_document_char'])}"><img border="0" width="15" height="15" src="#{@image_src}/b_info.png" alt="manifest"></a><br />} if file_suffix=~/s/ @counter_endn_doc+=1 oldtid=e['metadata_tid'].to_i else title = '' @@ -1032,10 +1017,10 @@ module SiSU_CGI_SQL && @search_regx.to_s=~/\S\S+/) \ ? (matched=e['body'].gsub(/(<a\s+href="https?:\/\/[^><\s]+#{@search_regx}[^>]+?>|#{@search_regx})/mi,%{<span style="background-color: #{@color_match}">\\1</span>})) : e['body'] - output=%{#{title}<hr><font size="2">note <b><a href="#{path_endnotes(location,@ln)}#_#{e['nr']}">#{e['nr']}</a></b> referred to from ocn <a href="#{path_html_doc(location,@ln)}##{e['ocn']}">#{e['ocn']}</a>:</font> #{matched_endnote}} + output=%{#{title}<hr><font size="2">note <b><a href="#{path_endnotes(location,e['language_document_char'])}#_#{e['nr']}">#{e['nr']}</a></b> referred to from ocn <a href="#{path_html_doc(location,e['language_document_char'])}##{e['ocn']}">#{e['ocn']}</a>:</font> #{matched_endnote}} else #elsif cgi['view']=~/index/ #doc #FIX #% idx endnotes @counter_endn_ocn+=1 - output=%{#{title}<a href="#{path_endnotes(location,@ln)}#_#{e['nr']}">#{e['nr']}</a> [§ <a href="#{path_html_doc(location,@ln)}##{e['ocn']}">#{e['ocn']}</a>], } + output=%{#{title}<a href="#{path_endnotes(location,e['language_document_char'])}#_#{e['nr']}">#{e['nr']}</a> [§ <a href="#{path_html_doc(location,e['language_document_char'])}##{e['ocn']}">#{e['ocn']}</a>], } end @counters_endn=if @counter_endn_doc > 0 if checked_stats =~/\S/ diff --git a/lib/sisu/v3/cgi_sqlite.rb b/lib/sisu/v5/cgi_sqlite.rb index e56fa359..45f6d1ca 100644 --- a/lib/sisu/v3/cgi_sqlite.rb +++ b/lib/sisu/v5/cgi_sqlite.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/cgi_sql_sqlite.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/cgi_sql_sqlite.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -131,10 +131,11 @@ module SiSU_CGI_SQLite require 'cgi' require 'fcgi' require 'dbi' - @version='sisu_sqlite' - @image_src="#{@env.url.webserv_cgi}/_sisu/image_sys" - @hosturl_db="#{@env.url.webserv_base_cgi}" - @hosturl_files="#{@env.url.webserv_files_from_db}" + @stub_default="#{@name_of[:db]}" + @image_src="#{@name_of[:host_url_docs]}/_sisu/image_sys" + @hosturl_cgi="#{@name_of[:host_url_cgi]}" + @hosturl_files="#{@name_of[:host_url_docs]}" + @output_dir_structure_by="#{@name_of[:output_dir_structure]}" @db_name_prefix="#{Db[:name_prefix]}" WOK_SQL end diff --git a/lib/sisu/v3/composite.rb b/lib/sisu/v5/composite.rb index 3923799c..c1cfb127 100644 --- a/lib/sisu/v3/composite.rb +++ b/lib/sisu/v5/composite.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/composite.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/composite.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -87,21 +87,6 @@ module SiSU_Assemble FileUtils::mkdir_p(output_path) unless FileTest.directory?(output_path) SiSU_Env::SystemCall.new("#{path}/*",output_path,'q').rsync end - def download_doc_skin(doc_skin) #first element in array is source url - path="#{@env.processing_path.processing}/external_document/skin/doc" - FileUtils::mkdir_p(path) unless FileTest.directory?(path) - download_from=doc_skin.shift - doc_skin.each do |i| - skin="#{path}/#{i}.rb" - unless FileTest.exists?(skin) - skinfile=File.new(skin,'w+') - open("#{download_from}/#{i}.rb") do |g| - skinfile << g.read - end - skinfile.close - end - end - end end class Composite @@imager={} @@ -143,21 +128,6 @@ module SiSU_Assemble end end end - def download_doc_skin(doc_skin) #first element in array is source url - path="#{@env.processing_path.processing}/external_document/skin/doc" - FileUtils::mkdir_p(path) unless FileTest.directory?(path) - download_from=doc_skin.shift - doc_skin.each do |i| - skin="#{path}/#{i}.rb" - unless FileTest.exists?(skin) - skinfile=File.new(skin,'w+') - open("#{download_from}/#{i}.rb") do |g| - skinfile << g.read - end - skinfile.close - end - end - end def insertion(fni,insert_array) file={ prepared: [], images: [] } rgx_image=/(?:^|[^_\\])\{\s*(\S+?\.(?:png|jpg|gif))/ diff --git a/lib/sisu/v3/concordance.rb b/lib/sisu/v5/concordance.rb index 6a984454..ac148f49 100644 --- a/lib/sisu/v3/concordance.rb +++ b/lib/sisu/v5/concordance.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/concordance.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/concordance.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -84,7 +84,7 @@ module SiSU_Concordance ? "#{@env.program.web_browser} #{@md.file.output_path.html_concordance.dir}/#{@md.file.base_filename.html_concordance}" : "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}" @md.opt.cmd=~/[MVvz]/ \ - ? SiSU_Screen::Ansi.new(@opt.cmd,"Concordance",tool).grey_title_hi + ? SiSU_Screen::Ansi.new(@opt.cmd,"Concordance",tool).green_hi_blue : SiSU_Screen::Ansi.new(@opt.cmd,'Concordance',tool).green_title_hi end wordmax=@env.concord_max @@ -116,28 +116,26 @@ module SiSU_Concordance @particulars,@md=particulars,particulars.md @data=SiSU_HTML::Source::HTML_Environment.new(particulars).tuned_file_instructions @file=SiSU_Env::FileOp.new(@md) - @vz=SiSU_Env::GetInit.instance.skin txt_path=%{#{@md.dir_out}} - SiSU_Env::InfoSkin.new(@md).select @fnb=@md.fnb @lex_button=%{<a href="http://www.jus.uio.no/sisu/" target="_top"><img border="0" height="44" width="144" valign="center" src="#{@file.path_rel_links.html_seg_2}_sisu/image/sisu.png" alt="SiSU home -->"></a>} @doc_details =<<WOK <table summary="links to text related to this rudimentary index" width="96%" border="0" bgcolor="white" cellpadding="0" align="center"><tr><td width="2%" align="right"> </td><td width="94%" valign="top" align="justify"><h1 class="small"><a href="#{@md.file.base_filename.html_segtoc}"><b>#{@md.title.full}</b></a></h1><p class="bold">#{@md.author}</p></td></tr></table> WOK + @make=SiSU_Env::ProcessingSettings.new(@md) end def create head_banner=SiSU_HTML_Format::HeadToc.new(@md) minitoc=SiSU_HTML_MiniToc::TocMini.new(@md,@data).songsheet.join("\n") stylesheet=SiSU_Style::CSS_HeadInfo.new(@md).stylesheet - make=SiSU_Env::ProcessingSettings.new(@md) - if make.build.manifest_minitoc? + if @make.build.manifest_minitoc? toc='<div class="toc">' + minitoc + '</div>' div_class='content' else toc='' div_class='content0' end - top_band=if make.build.html_top_band? + top_band=if @make.build.html_top_band? head_banner.concordance_navigation_band else '' end @@ -201,7 +199,6 @@ WOK def initialize(particulars) @particulars=particulars begin - @vz=SiSU_Env::GetInit.instance.skin @env,@md,@dal_array=particulars.env,particulars.md,particulars.dal_array @file=SiSU_Env::FileOp.new(@md) @freq=Hash.new(0) @@ -370,7 +367,6 @@ WOK end # special cases endnotes and header levels 1 - 3 end - credits=@vz.credits_sisu @file_concordance << %{</div></body>\n</html>} # footer SiSU_Screen::Ansi.new(@md.opt.cmd,@md.fns,"#{@md.file.output_path.html_concordance.dir}/#{@md.file.base_filename.html_concordance}").flow if @md.opt.cmd =~/[MV]/ end diff --git a/lib/sisu/v3/conf.rb b/lib/sisu/v5/conf.rb index e9fecf32..4d5b58d2 100644 --- a/lib/sisu/v3/conf.rb +++ b/lib/sisu/v5/conf.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/conf.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/conf.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v3/constants.rb b/lib/sisu/v5/constants.rb index 10eb8040..d72049e9 100644 --- a/lib/sisu/v3/constants.rb +++ b/lib/sisu/v5/constants.rb @@ -51,7 +51,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/constants.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/constants.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -102,6 +102,7 @@ Mx={ br_nl: '╲', #lB ▌ 』 ┘ br_paragraph: '█', #FB █ 9608 # PP ∥ 8741 #▐ #'┘' #'¶' #FB █ 9608 lB ▌ 9612 RB ▐ 9616 br_obj: 'break_obj', + br_page_line: '▭', br_page: '┼', br_page_new: '╋', lnk_o: '⌠', lnk_c: '⌡', #'⌈' '⌋' '⌠' '⌡' #Mx[:lnk_o: '◁'; Mx[:lnk_c: '▷' #‹ › @@ -139,6 +140,7 @@ Mx[:pa_non_object_dummy_heading]="#{Mx[:pa_o]}-##{Mx[:pa_c]}" # Mx[:pa_non_object_no_heading]="#{Mx[:pa_o]}~##{Mx[:pa_c]}" #unnumbered paragraph (place marker at end of paragraph) Hx={ br_obj: { obj: Mx[:br_obj] }, # line sep + br_page_line: { obj: Mx[:br_page_line] }, # line across page br_page: { obj: Mx[:br_page] }, # newpage br_page_new: { obj: Mx[:br_page_new] }, # clearpage } @@ -202,13 +204,27 @@ Px={ } Px[:lng_lst_rgx]=Px[:lng_lst].join('|') Ep={ + alt: :on, d_oebps: 'OEBPS', + d_image: 'OEBPS/image', + d_css: 'OEBPS/css', f_ncx: 'toc.ncx', f_opf: 'content.opf', } +$ep=if Ep[:alt]==:on + { + o: 'opf:', + hsp: ' ', + } +else + { + o: '', + hsp: ' ', + } +end Db={ - name_prefix: "SiSU#{SiSU_version_dir}f_", - name_prefix_db: "sisu_#{SiSU_version_dir}f_", + name_prefix: "SiSU#{SiSU_version_dir}a_", + name_prefix_db: "sisu_#{SiSU_version_dir}a_", col_title: 800, col_title_part: 400, col_title_edition: 10, @@ -217,12 +233,11 @@ Db={ col_language: 100, col_language_char: 6, col_date_text: 10, - col_classify_txt_long: 600, - col_classify_txt_short: 600, - col_classify_short: 200, - col_classify_identify: 256, - col_classify_library: 30, - col_classify_small: 16, + col_txt_long: 600, + col_txt_short: 200, + col_identify_hash: 256, + col_library: 30, + col_small: 16, col_filename: 256, col_digest: 64, col_filesize: 10, @@ -243,7 +258,10 @@ Gt={ audio: 'audio', video: 'video', conf: 'doc/_sisu', - skin: 'doc/_sisu/skin', #Gt[:skin: 'conf/skin/doc' +} +S_CONF={ + header_make: 'sisu_document_make', + rc_yml: 'sisurc.yml', } ANSI_C={ red: "\033[#{31}m", @@ -277,6 +295,13 @@ DEVELOPER={ maintenance: :false, } __END__ +puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:red).set +puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).set(:green) +puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).set(:fuchsia) +puts ANSI_C[:red] + __LINE__.to_s + ANSI_C[:off] + ' ' + __FILE__ +puts "#{ANSI_C[:red]} #{__LINE__.to_s} #{ANSI_C[:off]} #{__FILE__}" +puts ANSI_C[:fuchsia] + __LINE__.to_s + ANSI_C[:off] + ' ' + __FILE__.gsub(/([^\/]+$)/,"#{ANSI_C[:fuchsia]}\\1#{ANSI_C[:off]}") +puts ANSI_C[:red] + __LINE__.to_s + ANSI_C[:off] + ' ' + __FILE__.gsub(/([^\/]+$)/,"#{ANSI_C[:red]}\\1#{ANSI_C[:off]}") consider: 〔comment〕 〔links?????〕 diff --git a/lib/sisu/v3/css.rb b/lib/sisu/v5/css.rb index c6358cd0..4b682e5d 100644 --- a/lib/sisu/v3/css.rb +++ b/lib/sisu/v5/css.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/css.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/css.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -156,7 +156,7 @@ module SiSU_Style end class CSS def initialize - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new end def fonts @vz.font_fonts @@ -2406,6 +2406,23 @@ WOK p.right, th.right, td.right { text-align: right; } + + .svg_outer { + display: block; + margin-bottom: 0; + margin-left: 0; + margin-right: 0; + margin-top: 0; + padding-bottom: 0; + padding-left: 0; + padding-right: 0; + padding-top: 0; + text-align: left; + } + .svg_inner { + display: block; + text-align: center; + } WOK end def xml_sax #stylesheet for xml sax diff --git a/lib/sisu/v3/dal.rb b/lib/sisu/v5/dal.rb index 3feb5782..e6003b4f 100644 --- a/lib/sisu/v3/dal.rb +++ b/lib/sisu/v5/dal.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/dal.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/dal.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -95,12 +95,16 @@ module SiSU_DAL @@fns=nil def initialize(opt,fnx=nil) @opt,@fnx=opt,fnx - @@fns||@opt.fns - @make_fns=if @fnx and @fnx =~/\.ss[tmi]$/ - SiSU_Env::InfoFile.new(@fnx) + @@fns ||=opt.fns + fn_use=if fnx \ + and fnx =~/\.ss[tmi]$/ + fnx + elsif opt.fns =~/\.ssm$/ + opt.fns + '.sst' else - SiSU_Env::InfoFile.new(@opt.fns) + opt.fns end + @make_fns=SiSU_Env::InfoFile.new(fn_use) @fnm=@make_fns.marshal.dal_metadata @fnc=@make_fns.marshal.dal_content @idx_sst=@make_fns.marshal.dal_idx_sst_rel_html_seg @@ -269,7 +273,7 @@ module SiSU_DAL tell=(@opt.cmd=~/[vVM]/) \ ? SiSU_Screen::Ansi.new(@opt.cmd,'Document Abstraction') : SiSU_Screen::Ansi.new(@opt.cmd,'Document Abstraction',"[#{@opt.f_pth[:lng_is]}] #{@opt.fno}") - tell.grey_title_hi + tell.blue_title_hi end fn=(@fnx && @fnx =~/\.ss[tmi]$/) \ ? @fnx diff --git a/lib/sisu/v3/dal_character_check.rb b/lib/sisu/v5/dal_character_check.rb index c993b8e1..62aa60c1 100644 --- a/lib/sisu/v3/dal_character_check.rb +++ b/lib/sisu/v5/dal_character_check.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/dal_character_check.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/dal_character_check.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v3/dal_doc_objects.rb b/lib/sisu/v5/dal_doc_objects.rb index 94bb9cb0..de9d568f 100644 --- a/lib/sisu/v3/dal_doc_objects.rb +++ b/lib/sisu/v5/dal_doc_objects.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/dal_doc_objects.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/dal_doc_objects.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v3/dal_doc_str.rb b/lib/sisu/v5/dal_doc_str.rb index 87da4fad..da417bd6 100644 --- a/lib/sisu/v3/dal_doc_str.rb +++ b/lib/sisu/v5/dal_doc_str.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/dal_doc_str.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/dal_doc_str.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -75,6 +75,7 @@ module SiSU_DAL_DocumentStructureExtract SiSU_DAL_DocumentStructureExtract::Instantiate.new @pb=SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page]) @pbn=SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_new]) + @pbl=SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_line]) end def ln_get(lv) ln=case lv @@ -243,6 +244,8 @@ module SiSU_DAL_DocumentStructureExtract SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page],:markup) when /^(?:=\\\\=|<:pn>)\s*$/ #[br:pgn] SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_new],:markup) + when /^-\.\.-\s*$/ #[br:pgl] + SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_line],:markup) else #paragraph image=image_test(t_o) note=endnote_test?(t_o) diff --git a/lib/sisu/v3/dal_endnotes.rb b/lib/sisu/v5/dal_endnotes.rb index 326efea1..8412b45e 100644 --- a/lib/sisu/v3/dal_endnotes.rb +++ b/lib/sisu/v5/dal_endnotes.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/dal_doc_endnotes.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/dal_doc_endnotes.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v3/dal_expand_insertions.rb b/lib/sisu/v5/dal_expand_insertions.rb index 68855ba0..46efaa63 100644 --- a/lib/sisu/v3/dal_expand_insertions.rb +++ b/lib/sisu/v5/dal_expand_insertions.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/dal_expand_insertions.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/dal_expand_insertions.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v3/dal_hash_digest.rb b/lib/sisu/v5/dal_hash_digest.rb index f2e13cb5..29d8a1ed 100644 --- a/lib/sisu/v3/dal_hash_digest.rb +++ b/lib/sisu/v5/dal_hash_digest.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/dal_hash_digest.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/dal_hash_digest.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v3/dal_idx.rb b/lib/sisu/v5/dal_idx.rb index bf8d569c..67f2805d 100644 --- a/lib/sisu/v3/dal_idx.rb +++ b/lib/sisu/v5/dal_idx.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/dal_idx.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/dal_idx.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -165,12 +165,7 @@ module SiSU_DAL_BookIndex the_idx end def clean_xml(str) - str=str.gsub(/&/,'&'). - gsub(/\(/,'('). - gsub(/\)/,')'). - gsub(/\*/,'*'). - gsub(/\+/,'+'). - gsub(/,/,',') + str=str.gsub(/&/,'&') str end def index(the_idx) @@ -197,8 +192,8 @@ module SiSU_DAL_BookIndex idx[:html] << '' idx[:xhtml] << '' else - idx[:html] << %{<a href="##{x}">#{x}</a>, } - idx[:xhtml] << %{<a href="##{x.downcase}">#{x}</a>, } + idx[:html] << %{<a href="##{x}">#{x}</a>,#{$ep[:hsp]}} + idx[:xhtml] << %{<a href="##{x.downcase}">#{x}</a>,#{$ep[:hsp]}} end end idx[:html] << '</p>' diff --git a/lib/sisu/v3/dal_images.rb b/lib/sisu/v5/dal_images.rb index 2c867c1c..1141447d 100644 --- a/lib/sisu/v3/dal_images.rb +++ b/lib/sisu/v5/dal_images.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/dal_images.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/dal_images.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v3/dal_metadata.rb b/lib/sisu/v5/dal_metadata.rb index 4dbfe175..1fa5619c 100644 --- a/lib/sisu/v3/dal_metadata.rb +++ b/lib/sisu/v5/dal_metadata.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/dal_metadata.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/dal_metadata.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v3/dal_numbering.rb b/lib/sisu/v5/dal_numbering.rb index 21ada29f..39524cc9 100644 --- a/lib/sisu/v3/dal_numbering.rb +++ b/lib/sisu/v5/dal_numbering.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/dal_numbering.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/dal_numbering.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -347,13 +347,15 @@ module SiSU_DAL_Numbering @seg=dob.name end @tuned_file << if dob.is==:heading \ - && (@md.pagenew || @md.pagebreak) + && (@md.pagenew || @md.pagebreak || @md.pageline) m=dob.ln.to_s dob_tmp=[] if @md.pagenew.inspect =~/#{m}/ dob_tmp << SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_new]) << dob elsif @md.pagebreak.inspect =~/#{m}/ dob_tmp << SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page]) << dob + elsif @md.pageline.inspect =~/#{m}/ + dob_tmp << SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_line]) << dob end para_result=unless dob_tmp.length > 0; dob else dob_tmp diff --git a/lib/sisu/v3/dal_substitutions_and_insertions.rb b/lib/sisu/v5/dal_substitutions_and_insertions.rb index 847f917a..051d2bfd 100644 --- a/lib/sisu/v3/dal_substitutions_and_insertions.rb +++ b/lib/sisu/v5/dal_substitutions_and_insertions.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/dal_substitutions_and_insertions.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/dal_substitutions_and_insertions.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -63,7 +63,6 @@ module SiSU_DAL_SubstituteAndInsert class SI def initialize(md,data) @md,@data=md,data - @skin=SiSU_Env::InfoSkin.new(@md) end def substitutions_and_insertions? data=@data @@ -79,7 +78,6 @@ module SiSU_DAL_SubstituteAndInsert data.each do |para| if para =~/<:(insert\d+)!?>/ \ and para !~/^%\s+/ - @skin.select ins=SiSU_Viz::Inserts.new case para when /^\s*<:(insert1)>\s*$/ @@ -87,49 +85,42 @@ module SiSU_DAL_SubstituteAndInsert if defined? ins.insert1 para=[] ins.insert1.split(/\n\n/).each {|x| para << x } - else p "skin #{i} not found in #{@skin.select}" end when /^\s*<:(insert2)>\s*$/ i=$1 if defined? ins.insert2 para=[] ins.insert2.split(/\n\n/).each {|x| para << x } - else p "skin #{i} not found in #{@skin.select}" end when /^\s*<:(insert3)>\s*$/ i=$1 if defined? ins.insert3 para=[] ins.insert3.split(/\n\n/).each {|x| para << x << "\n"} - else p "skin #{i} not found in #{@skin.select}" end when /^\s*<:(insert4)>\s*$/ i=$1 if defined? ins.insert4 para=[] ins.insert4.split(/\n\n/).each {|x| para << x << "\n"} - else p "skin #{i} not found in #{@skin.select}" end when /^\s*<:(insert5)>\s*$/ i=$1 if defined? ins.insert5 para=[] ins.insert5.split(/\n\n/).each {|x| para << x << "\n"} - else p "skin #{i} not found in #{@skin.select}" end when /^\s*<:(insert6)>\s*$/ i=$1 if defined? ins.insert6 para=[] ins.insert6.split(/\n\n/).each {|x| para << x << "\n"} - else p "skin #{i} not found in #{@skin.select}" end when /^\s*<:(insert7)>\s*$/ i=$1 if defined? ins.insert7 para=[] ins.insert7.split(/\n\n/).each {|x| para << x << "\n"} - else p "skin #{i} not found in #{@skin.select}" end end para.each {|x| data_expand << x } diff --git a/lib/sisu/v3/dal_syntax.rb b/lib/sisu/v5/dal_syntax.rb index a43ca005..03d397b3 100644 --- a/lib/sisu/v3/dal_syntax.rb +++ b/lib/sisu/v5/dal_syntax.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/dal_syntax.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/dal_syntax.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -67,15 +67,15 @@ module SiSU_DAL_Syntax end class Markup def initialize(md='',data='') - @data,@md=data,md - @vz=SiSU_Env::GetInit.instance.skin + @md,@data=md,data + @vz=SiSU_Viz::Defaults.new @data_new=[] url_and_stub=SiSU_Env::InfoEnv.new.url @output_url="#{url_and_stub.remote}" @env=SiSU_Env::InfoEnv.new - emph_set=if defined? @md.make.emphasis \ - and not @md.make.emphasis.nil? - @md.make.emphasis + emph_set=if defined? @md.emphasis_set_to \ + and not @md.emphasis_set_to.nil? + @md.emphasis_set_to else @env.markup_emphasis end @emph=case emph_set @@ -98,25 +98,22 @@ module SiSU_DAL_Syntax tail_m_bold=%{(?:(?:#{Mx[:fa_italics_c]})?(?:\s|[.,;:?!'")]|~\^|~\\\{\s|$))?} bold_line=%{^!_\s.+?(?:#{Mx[:br_line]}|\n|$)} ital_line=%{^/_\s.+?(?:#{Mx[:br_line]}|\n|$)} - @line_scan_ital=if defined? @md.make.italics[:str] \ - and defined? @vz.markup_make_italic[:str] - /#{@http_m}|#{bold_line}|#{@manmkp_ital}#{tail_m_ital}|(?:#{@md.make.italics[:str]}|#{@vz.markup_make_italic[:str]})#{tail_m_ital}|\S+|\n/i - elsif defined? @md.make.italics[:str] - /#{@http_m}|#{bold_line}|#{@manmkp_ital}#{tail_m_ital}|#{@md.make.italics[:str]}#{tail_m_ital}|\S+|\n/i + @line_scan_ital=if defined? @md.italics_match_list[:str] + /#{@http_m}|#{bold_line}|#{@manmkp_ital}#{tail_m_ital}|#{@md.italics_match_list[:str]}#{tail_m_ital}|\S+|\n/i elsif defined? @vz.markup_make_italic[:str] /#{@http_m}|#{bold_line}|#{@manmkp_ital}#{tail_m_ital}|#{@vz.markup_make_italic[:str]}#{tail_m_ital}|\S+|\n/i end @manmkp_bold=emph_italics \ ? '^!_\s.+?(?:\n|$)|[!b]\\{.+?\\}[*!b]|[*!][a-zA-Z0-9\-_]+[!]' : '^!_\s.+?(?:\n|$)|[*!b]\\{.+?\\}[*!b]|[*!][a-zA-Z0-9\-_]+[*!]' - @line_scan_bold=if (defined? @md.make.bold[:str] \ - and @md.make.bold[:str]) \ + @line_scan_bold=if (defined? @md.bold_match_list[:str] \ + and @md.bold_match_list[:str]) \ and (defined? @vz.markup_make_bold[:str] \ and @vz.markup_make_bold[:str]) - /#{@http_m}|#{bold_line}|(?:#{@manmkp_bold}|#{@md.make.bold[:str]}|#{@vz.markup_make_bold[:str]})#{tail_m_bold}|\S+|\n/i - elsif defined? @md.make.bold[:str] \ - and @md.make.bold[:str] - /#{@http_m}|#{bold_line}|(?:#{@manmkp_bold}|#{@md.make.bold[:str]})#{tail_m_bold}|\S+|\n/i + /#{@http_m}|#{bold_line}|(?:#{@manmkp_bold}|#{@md.bold_match_list[:str]}|#{@vz.markup_make_bold[:str]})#{tail_m_bold}|\S+|\n/i + elsif defined? @md.bold_match_list[:str] \ + and @md.bold_match_list[:str] + /#{@http_m}|#{bold_line}|(?:#{@manmkp_bold}|#{@md.bold_match_list[:str]})#{tail_m_bold}|\S+|\n/i elsif defined? @vz.markup_make_bold[:str] \ and @vz.markup_make_bold[:str] /#{@http_m}|#{bold_line}|(?:#{@manmkp_bold}|#{@vz.markup_make_bold[:str]})#{tail_m_bold}|\S+|\n/i @@ -150,14 +147,15 @@ module SiSU_DAL_Syntax gsub(/ \\\\(?: |$)/,"#{Mx[:br_line]}"). gsub(/(?:<:?pb>)/,"#{Mx[:br_page]}"). # depreciated gsub(/(?:<:?pn>)/,"#{Mx[:br_page_new]}"). # depreciated - gsub(/(?:<:?br>|<br \/>)/,"#{Mx[:br_line]}") # depreciated + gsub(/(?:<:?br>|<br \/>)/,"#{Mx[:br_line]}"). # depreciated + gsub(/(?:^-\.\.-\s*$)/,"#{Mx[:br_page_line]}") end dob end def wordlist_italics(dob) dob=dob.dup - if (defined? @md.make.italics[:str] \ - and @md.make.italics[:str]) \ + if (defined? @md.italics_match_list[:str] \ + and @md.italics_match_list[:str]) \ or (defined? @vz.markup_make_italic[:str] \ and @vz.markup_make_italic[:str]) dob.obj=if dob.is !=:meta \ @@ -170,9 +168,9 @@ module SiSU_DAL_Syntax line_array=[] word.each do |w| unless /#{@manmkp_ital}|#{@http_m}/.match(w) - if defined? @md.make.italics[:regx] \ - and @md.make.italics[:regx] - w=w.gsub(@md.make.italics[:regx], + if defined? @md.italics_match_list[:regx] \ + and @md.italics_match_list[:regx] + w=w.gsub(@md.italics_match_list[:regx], "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}") elsif defined? @vz.markup_make_italic \ and @vz.markup_make_italic @@ -241,15 +239,15 @@ module SiSU_DAL_Syntax end def substitutions(dob) dob=dob.dup - dob=if defined? @md.make.substitute[:match_and_replace] \ - and @md.make.substitute[:match_and_replace].is_a?(Array) + dob=if defined? @md.substitution_match_list[:match_and_replace] \ + and @md.substitution_match_list[:match_and_replace].is_a?(Array) dob=if dob.is !=:meta \ && dob.is !=:heading_insert \ && dob.is !=:code \ && dob.is !=:comment \ && dob.is !=:table - if dob.obj =~/#{@md.make.substitute[:matches]}/ - @md.make.substitute[:match_and_replace].each do |x| + if dob.obj =~/#{@md.substitution_match_list[:matches]}/ + @md.substitution_match_list[:match_and_replace].each do |x| dob.obj=if x[:case_s]==:i dob.obj.gsub(/#{x[:match]}/mi,x[:replace]) else @@ -266,8 +264,8 @@ module SiSU_DAL_Syntax end def wordlist_bold(dob) dob=dob.dup - if (defined? @md.make.bold[:str] \ - and @md.make.bold[:str]) \ + if (defined? @md.bold_match_list[:str] \ + and @md.bold_match_list[:str]) \ or (defined? @vz.markup_make_bold[:str] \ and @vz.markup_make_bold[:str]) dob.obj=if dob.is !=:meta \ @@ -281,11 +279,11 @@ module SiSU_DAL_Syntax word=word.flatten.compact word.each do |w| unless /#{@manmkp_bold}|#{@http_m}/.match(w) - if defined? @md.make.bold[:regx] \ - and @md.make.bold[:regx] #document header: @bold: [bold word list] - w=w.gsub(@md.make.bold[:regx],"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}") + if defined? @md.bold_match_list[:regx] \ + and @md.bold_match_list[:regx] #document header: @bold: [bold word list] + w=w.gsub(@md.bold_match_list[:regx],"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}") elsif defined? @vz.markup_make_bold \ - and @vz.markup_make_bold #defaults and skin adjusted bold word list + and @vz.markup_make_bold #defaults adjusted bold word list w=w.gsub(@vz.markup_make_bold,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}") end else diff --git a/lib/sisu/v3/db_columns.rb b/lib/sisu/v5/db_columns.rb index 02adf4c1..14d3bb46 100644 --- a/lib/sisu/v3/db_columns.rb +++ b/lib/sisu/v5/db_columns.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/db_columns.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/db_columns.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -1367,20 +1367,64 @@ module SiSU_DbColumns self end =begin +#% identifier +@identifier: + :oclc: + :isbn: +=end + def identifier_oclc + def name + 'identifier_oclc' + end + def create_column + "#{name} VARCHAR(#{Db[:col_library]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata identifier document Online Computer Library Center number';} + end + def tuple + t=if defined? @md.identifier.oclc \ + and @md.identifier.oclc=~/\S+/ + txt=@md.identifier.oclc + txt=special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def identifier_isbn + def name + 'identifier_isbn' + end + def create_column + "#{name} VARCHAR(#{Db[:col_small]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata identifier document isbn (if any)';} + end + def tuple + t=if defined? @md.identifier.isbn \ + and @md.identifier.isbn=~/\S+/ + txt=@md.identifier.isbn + txt=special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end +=begin #% classify @classify: :topic_register: - :coverage: - :format: - :identifier: - :keywords: - :relation: :subject: + :keywords: :type: :loc: :dewey: - :pg: - :isbn: =end def classify_topic_register def name @@ -1409,7 +1453,7 @@ module SiSU_DbColumns 'classify_subject' end def create_column - "#{name} VARCHAR(#{Db[:col_classify_txt_short]}) NULL," + "#{name} VARCHAR(#{Db[:col_txt_long]}) NULL," end def column_comment %{COMMENT ON COLUMN metadata_and_text.#{name} @@ -1426,34 +1470,12 @@ module SiSU_DbColumns end self end - def classify_type #check - def name - 'classify_type' - end - def create_column - "#{name} VARCHAR(#{Db[:col_classify_txt_short]}) NULL," - end - def column_comment - %{COMMENT ON COLUMN metadata_and_text.#{name} - IS 'metadata classify document type [DC8]';} - end - def tuple - t=if defined? @md.classify.type \ - and @md.classify.type=~/\S+/ - txt=@md.classify.type - txt=special_character_escape(txt) - ["#{name}, ","'#{txt}', "] - else ['',''] - end - end - self - end def classify_loc def name 'classify_loc' end def create_column - "#{name} VARCHAR(#{Db[:col_classify_library]}) NULL," + "#{name} VARCHAR(#{Db[:col_library]}) NULL," end def column_comment %{COMMENT ON COLUMN metadata_and_text.#{name} @@ -1475,7 +1497,7 @@ module SiSU_DbColumns 'classify_dewey' end def create_column - "#{name} VARCHAR(#{Db[:col_classify_library]}) NULL," + "#{name} VARCHAR(#{Db[:col_library]}) NULL," end def column_comment %{COMMENT ON COLUMN metadata_and_text.#{name} @@ -1492,65 +1514,21 @@ module SiSU_DbColumns end self end - def classify_oclc - def name - 'classify_oclc' - end - def create_column - "#{name} VARCHAR(#{Db[:col_classify_library]}) NULL," - end - def column_comment - %{COMMENT ON COLUMN metadata_and_text.#{name} - IS 'metadata classify document Online Computer Library Center number';} - end - def tuple - t=if defined? @md.classify.oclc \ - and @md.classify.oclc=~/\S+/ - txt=@md.classify.oclc - txt=special_character_escape(txt) - ["#{name}, ","'#{txt}', "] - else ['',''] - end - end - self - end - def classify_pg - def name - 'classify_pg' - end - def create_column - "#{name} VARCHAR(#{Db[:col_classify_small]}) NULL," - end - def column_comment - %{COMMENT ON COLUMN metadata_and_text.#{name} - IS 'metadata classify document project gutenberg (if any)';} - end - def tuple - t=if defined? @md.classify.pg \ - and @md.classify.pg=~/\S+/ - txt=@md.classify.pg - txt=special_character_escape(txt) - ["#{name}, ","'#{txt}', "] - else ['',''] - end - end - self - end - def classify_isbn + def classify_keywords def name - 'classify_isbn' + 'classify_keywords' end def create_column - "#{name} VARCHAR(#{Db[:col_classify_small]}) NULL," + "#{name} VARCHAR(#{Db[:col_txt_long]}) NULL," end def column_comment %{COMMENT ON COLUMN metadata_and_text.#{name} - IS 'metadata classify document isbn (if any)';} + IS 'metadata classify document keywords';} end def tuple - t=if defined? @md.classify.isbn \ - and @md.classify.isbn=~/\S+/ - txt=@md.classify.isbn + t=if defined? @md.classify.keywords \ + and @md.classify.keywords=~/\S+/ + txt=@md.classify.keywords txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] @@ -1558,21 +1536,36 @@ module SiSU_DbColumns end self end - def classify_format +=begin +#% notes +@notes: + :abstract: + :description: + :comment: + :coverage: + :relation: + :format: + :history: + :prefix: + :prefix_a: + :prefix_b: + :suffix: +=end + def notes_abstract def name - 'classify_format' + 'notes_abstract' end def create_column - "#{name} VARCHAR(#{Db[:col_classify_txt_short]}) NULL," + "#{name} TEXT NULL," end def column_comment %{COMMENT ON COLUMN metadata_and_text.#{name} - IS 'metadata classify document format [DC9]';} + IS 'metadata document notes abstract';} end def tuple - t=if defined? @md.classify.format \ - and @md.classify.format=~/\S+/ - txt=@md.classify.format + t=if defined? @md.notes.abstract \ + and @md.notes.abstract=~/\S+/ + txt=@md.notes.abstract txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] @@ -1580,21 +1573,21 @@ module SiSU_DbColumns end self end - def classify_identifier + def notes_description def name - 'classify_identifier' + 'notes_description' end def create_column - "#{name} VARCHAR(#{Db[:col_classify_identify]}) NULL," + "#{name} TEXT NULL," end def column_comment %{COMMENT ON COLUMN metadata_and_text.#{name} - IS 'metadata classify document identifier [DC10]';} + IS 'metadata document notes description [DC4]';} end def tuple - t=if defined? @md.classify.identifier \ - and @md.classify.identifier=~/\S+/ - txt=@md.classify.identifier + t=if defined? @md.notes.description \ + and @md.notes.description=~/\S+/ + txt=@md.notes.description txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] @@ -1602,21 +1595,21 @@ module SiSU_DbColumns end self end - def classify_relation + def notes_comment def name - 'classify_relation' + 'notes_comment' end def create_column - "#{name} VARCHAR(#{Db[:col_classify_short]}) NULL," + "#{name} TEXT NULL," end def column_comment %{COMMENT ON COLUMN metadata_and_text.#{name} - IS 'metadata classify document relation [DC13]';} + IS 'metadata document notes comment';} end def tuple - t=if defined? @md.classify.relation \ - and @md.classify.relation=~/\S+/ - txt=@md.classify.relation + t=if defined? @md.notes.comment \ + and @md.notes.comment=~/\S+/ + txt=@md.notes.comment txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] @@ -1624,12 +1617,12 @@ module SiSU_DbColumns end self end - def classify_coverage + def notes_coverage def name - 'classify_coverage' + 'notes_coverage' end def create_column - "#{name} VARCHAR(#{Db[:col_classify_short]}) NULL," + "#{name} VARCHAR(#{Db[:col_txt_short]}) NULL," end def column_comment %{COMMENT ON COLUMN metadata_and_text.#{name} @@ -1646,21 +1639,21 @@ module SiSU_DbColumns end self end - def classify_keywords + def notes_relation def name - 'classify_keywords' + 'notes_relation' end def create_column - "#{name} VARCHAR(#{Db[:col_classify_txt_short]}) NULL," + "#{name} VARCHAR(#{Db[:col_txt_short]}) NULL," end def column_comment %{COMMENT ON COLUMN metadata_and_text.#{name} - IS 'metadata classify document keywords';} + IS 'metadata classify document relation [DC13]';} end def tuple - t=if defined? @md.classify.keywords \ - and @md.classify.keywords=~/\S+/ - txt=@md.classify.keywords + t=if defined? @md.classify.relation \ + and @md.classify.relation=~/\S+/ + txt=@md.classify.relation txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] @@ -1668,33 +1661,21 @@ module SiSU_DbColumns end self end -=begin -#% notes -@notes: - :abstract: - :comment: - :description: - :history: - :prefix: - :prefix_a: - :prefix_b: - :suffix: -=end - def notes_abstract + def notes_history #check, consider removal def name - 'notes_abstract' + 'notes_history' end def create_column - "#{name} TEXT NULL," + "#{name} VARCHAR(#{Db[:col_txt_long]}) NULL," end def column_comment %{COMMENT ON COLUMN metadata_and_text.#{name} - IS 'metadata document notes abstract';} + IS 'metadata document notes history';} end def tuple - t=if defined? @md.notes.abstract \ - and @md.notes.abstract=~/\S+/ - txt=@md.notes.abstract + t=if defined? @md.notes.history \ + and @md.notes.history=~/\S+/ + txt=@md.notes.history txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] @@ -1702,21 +1683,21 @@ module SiSU_DbColumns end self end - def notes_comment + def notes_type #check def name - 'notes_comment' + 'notes_type' end def create_column - "#{name} TEXT NULL," + "#{name} VARCHAR(#{Db[:col_txt_long]}) NULL," end def column_comment %{COMMENT ON COLUMN metadata_and_text.#{name} - IS 'metadata document notes comment';} + IS 'metadata notes document type [DC8]';} end def tuple - t=if defined? @md.notes.comment \ - and @md.notes.comment=~/\S+/ - txt=@md.notes.comment + t=if defined? @md.notes.type \ + and @md.notes.type=~/\S+/ + txt=@md.notes.type txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] @@ -1724,43 +1705,21 @@ module SiSU_DbColumns end self end - def notes_description + def notes_format def name - 'notes_description' + 'notes_format' end def create_column - "#{name} TEXT NULL," + "#{name} VARCHAR(#{Db[:col_txt_long]}) NULL," end def column_comment %{COMMENT ON COLUMN metadata_and_text.#{name} - IS 'metadata document notes description [DC4]';} - end - def tuple - t=if defined? @md.notes.description \ - and @md.notes.description=~/\S+/ - txt=@md.notes.description - txt=special_character_escape(txt) - ["#{name}, ","'#{txt}', "] - else ['',''] - end - end - self - end - def notes_history #check, consider removal - def name - 'notes_history' - end - def create_column - "#{name} VARCHAR(#{Db[:col_classify_txt_short]}) NULL," - end - def column_comment - %{COMMENT ON COLUMN metadata_and_text.#{name} - IS 'metadata document notes history';} + IS 'metadata classify document format [DC9]';} end def tuple - t=if defined? @md.notes.history \ - and @md.notes.history=~/\S+/ - txt=@md.notes.history + t=if defined? @md.classify.format \ + and @md.classify.format=~/\S+/ + txt=@md.classify.format txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] @@ -1970,8 +1929,6 @@ module SiSU_DbColumns end =begin #% misc -@make: - :skin: @links: =end def fulltext @@ -1994,73 +1951,6 @@ module SiSU_DbColumns end self end - def skin_name #check - def name - 'skin_name' - end - def create_column - "#{name} VARCHAR(#{Db[:col_filename]}) NULL," - end - def column_comment - %{COMMENT ON COLUMN metadata_and_text.#{name} - IS 'source text skin name';} - end - def tuple - t=if defined? @md.skin_name \ - and @md.skin_name=~/\S+/ - txt=@md.skin_name - txt=special_character_escape(txt) - ["#{name}, ","'#{txt}', "] - else ['',''] - end - end - self - end - def skin_fingerprint #check - def name - 'skin_fingerprint' - end - def create_column - "#{name} VARCHAR(#{Db[:col_digest]}) NULL," - end - def column_comment - %{COMMENT ON COLUMN metadata_and_text.#{name} - IS 'source text skin fingerprint';} - end - def tuple - t=if defined? @md.dgst_skin \ - and @md.dgst_skin.is_a?(Array) \ - and @md.dgst_skin[1]=~/\S+/ - txt=@md.dgst_skin[1] - txt=special_character_escape(txt) - ["#{name}, ","'#{txt}', "] - else ['',''] - end - end - self - end - def skin # you likely want a separate table for skins - def name - 'skin' - end - def create_column - "#{name} TEXT NULL," - end - def column_comment - %{COMMENT ON COLUMN metadata_and_text.#{name} - IS 'source text skin';} - end - def tuple - t=if defined? @md.skin \ - and @md.skin=~/\S+/ - txt=@md.skin - txt=special_character_escape(txt) - ["#{name}, ","'#{txt}', "] - else ['',''] - end - end - self - end def links def name 'links' diff --git a/lib/sisu/v3/db_create.rb b/lib/sisu/v5/db_create.rb index 5df72a2a..e2d1f916 100644 --- a/lib/sisu/v3/db_create.rb +++ b/lib/sisu/v5/db_create.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/db_create.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/db_create.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -84,9 +84,9 @@ module SiSU_DbCreate def create_db @env=SiSU_Env::InfoEnv.new(@opt.fns) tell=(@sql_type=='sqlite') \ - ? SiSU_Screen::Ansi.new(@opt.cmd,'invert','Create Sqlite db tables in:',%{"#{@file}"}) - : SiSU_Screen::Ansi.new(@opt.cmd,'invert','Create PG db tables in:',%{"#{Db[:name_prefix]}#{@env.path.stub_pwd}"}) - tell.colorize if @opt.cmd =~/[vVM]/ + ? SiSU_Screen::Ansi.new(@opt.cmd,'Create SQLite db tables in:',%{"#{@file}"}) + : SiSU_Screen::Ansi.new(@opt.cmd,'Create pgSQL db tables in:',%{"#{Db[:name_prefix]}#{@env.path.stub_pwd}"}) + tell.dark_grey_title_hi if @opt.cmd =~/[vVM]/ SiSU_Env::SystemCall.new.create_pg_db(@env.path.stub_pwd) if @sql_type=='pg' #watch use of path.stub_pwd instead of stub end def output_dir? @@ -167,22 +167,22 @@ module SiSU_DbCreate /* classify */ #{column.classify_topic_register.create_column} #{column.classify_subject.create_column} - #{column.classify_type.create_column} #{column.classify_loc.create_column} #{column.classify_dewey.create_column} - #{column.classify_oclc.create_column} - #{column.classify_pg.create_column} - #{column.classify_isbn.create_column} - #{column.classify_format.create_column} - #{column.classify_identifier.create_column} - #{column.classify_relation.create_column} - #{column.classify_coverage.create_column} #{column.classify_keywords.create_column} + /* identifier */ + #{column.identifier_oclc.create_column} + #{column.identifier_isbn.create_column} /* notes */ #{column.notes_abstract.create_column} - #{column.notes_comment.create_column} #{column.notes_description.create_column} + #{column.notes_comment.create_column} #{column.notes_history.create_column} + #{column.notes_coverage.create_column} + #{column.notes_relation.create_column} + /* column.notes_source.create_column */ + #{column.notes_type.create_column} + #{column.notes_format.create_column} #{column.notes_prefix.create_column} #{column.notes_prefix_a.create_column} #{column.notes_prefix_b.create_column} @@ -195,9 +195,6 @@ module SiSU_DbCreate #{column.src_txt.create_column} /* misc */ #{column.fulltext.create_column} - #{column.skin_name.create_column} - #{column.skin_fingerprint.create_column} - #{column.skin.create_column} #{column.links.create_column.gsub(/,$/,'')} /* subj VARCHAR(64) NULL, */ /* contact VARCHAR(100) NULL, */ @@ -428,21 +425,19 @@ module SiSU_DbCreate %{#{column.rights_license.column_comment}}, %{#{column.classify_topic_register.column_comment}}, %{#{column.classify_subject.column_comment}}, - %{#{column.classify_type.column_comment}}, %{#{column.classify_loc.column_comment}}, %{#{column.classify_dewey.column_comment}}, - %{#{column.classify_oclc.column_comment}}, - %{#{column.classify_pg.column_comment}}, - %{#{column.classify_isbn.column_comment}}, - %{#{column.classify_format.column_comment}}, - %{#{column.classify_identifier.column_comment}}, - %{#{column.classify_relation.column_comment}}, - %{#{column.classify_coverage.column_comment}}, %{#{column.classify_keywords.column_comment}}, + %{#{column.identifier_oclc.column_comment}}, + %{#{column.identifier_isbn.column_comment}}, %{#{column.notes_abstract.column_comment}}, %{#{column.notes_comment.column_comment}}, %{#{column.notes_description.column_comment}}, %{#{column.notes_history.column_comment}}, + %{#{column.notes_coverage.column_comment}}, + %{#{column.notes_relation.column_comment}}, + %{#{column.notes_type.column_comment}}, + %{#{column.notes_format.column_comment}}, %{#{column.notes_prefix.column_comment}}, %{#{column.notes_prefix_a.column_comment}}, %{#{column.notes_prefix_b.column_comment}}, @@ -453,9 +448,6 @@ module SiSU_DbCreate %{#{column.src_word_count.column_comment}}, %{#{column.src_txt.column_comment}}, %{#{column.fulltext.column_comment}}, - %{#{column.skin_name.column_comment}}, - %{#{column.skin_fingerprint.column_comment}}, - %{#{column.skin.column_comment}}, %{#{column.links.column_comment}}, ] conn_execute_array(sql_arr) diff --git a/lib/sisu/v3/db_dbi.rb b/lib/sisu/v5/db_dbi.rb index 0164ceb5..85640b3a 100644 --- a/lib/sisu/v3/db_dbi.rb +++ b/lib/sisu/v5/db_dbi.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/db_dbi.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/db_dbi.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v3/db_drop.rb b/lib/sisu/v5/db_drop.rb index b4f8c7ed..caf7faa5 100644 --- a/lib/sisu/v3/db_drop.rb +++ b/lib/sisu/v5/db_drop.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/db_drop.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/db_drop.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v3/db_import.rb b/lib/sisu/v5/db_import.rb index 530e23df..a1d332bb 100644 --- a/lib/sisu/v3/db_import.rb +++ b/lib/sisu/v5/db_import.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/db_import.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/db_import.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -84,7 +84,6 @@ module SiSU_DbImport @md=SiSU_Param::Parameters.new(@opt).get @md.fnb end - @suffix=@opt.fns[/(?:.+?)(?:\.ssm\.sst|\.-?sst)/,1] @fnc="#{@dal}/#{@opt.fns}.content.rbm" @@seg,@@seg_full='','' #create? consider placing field just before clean text as opposed to seg which contains seg(.html) name info seg_full would contain seg info for levels 5 & 6 where available eg seg_full may be 7.3 (level 5) and 7.3.1 (level 6) where seg is 7 @col=Hash.new('') diff --git a/lib/sisu/v3/db_indexes.rb b/lib/sisu/v5/db_indexes.rb index beae0aa1..265d5169 100644 --- a/lib/sisu/v3/db_indexes.rb +++ b/lib/sisu/v5/db_indexes.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/db_indexes.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/db_indexes.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v3/db_load_tuple.rb b/lib/sisu/v5/db_load_tuple.rb index d615fcab..bdaf285a 100644 --- a/lib/sisu/v3/db_load_tuple.rb +++ b/lib/sisu/v5/db_load_tuple.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/db_load_tuple.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/db_load_tuple.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -177,21 +177,19 @@ module SiSU_DbTuple #{@tp.column.rights_license.tuple[0]} #{@tp.column.classify_topic_register.tuple[0]} #{@tp.column.classify_subject.tuple[0]} -#{@tp.column.classify_type.tuple[0]} #{@tp.column.classify_loc.tuple[0]} #{@tp.column.classify_dewey.tuple[0]} -#{@tp.column.classify_oclc.tuple[0]} -#{@tp.column.classify_pg.tuple[0]} -#{@tp.column.classify_isbn.tuple[0]} -#{@tp.column.classify_format.tuple[0]} -#{@tp.column.classify_identifier.tuple[0]} -#{@tp.column.classify_relation.tuple[0]} -#{@tp.column.classify_coverage.tuple[0]} #{@tp.column.classify_keywords.tuple[0]} +#{@tp.column.identifier_oclc.tuple[0]} +#{@tp.column.identifier_isbn.tuple[0]} #{@tp.column.notes_abstract.tuple[0]} -#{@tp.column.notes_comment.tuple[0]} #{@tp.column.notes_description.tuple[0]} +#{@tp.column.notes_comment.tuple[0]} #{@tp.column.notes_history.tuple[0]} +#{@tp.column.notes_format.tuple[0]} +#{@tp.column.notes_relation.tuple[0]} +#{@tp.column.notes_coverage.tuple[0]} +#{@tp.column.notes_type.tuple[0]} #{@tp.column.notes_prefix.tuple[0]} #{@tp.column.notes_prefix_a.tuple[0]} #{@tp.column.notes_prefix_b.tuple[0]} @@ -202,9 +200,6 @@ module SiSU_DbTuple #{@tp.column.src_word_count.tuple[0]} #{@tp.column.src_txt.tuple[0]} #{@tp.column.fulltext.tuple[0]} -#{@tp.column.skin_name.tuple[0]} -#{@tp.column.skin_fingerprint.tuple[0]} -#{@tp.column.skin.tuple[0]} #{@tp.column.links.tuple[0]} tid) " + @@ -262,21 +257,19 @@ tid) #{@tp.column.rights_license.tuple[1]} #{@tp.column.classify_topic_register.tuple[1]} #{@tp.column.classify_subject.tuple[1]} -#{@tp.column.classify_type.tuple[1]} #{@tp.column.classify_loc.tuple[1]} #{@tp.column.classify_dewey.tuple[1]} -#{@tp.column.classify_oclc.tuple[1]} -#{@tp.column.classify_pg.tuple[1]} -#{@tp.column.classify_isbn.tuple[1]} -#{@tp.column.classify_format.tuple[1]} -#{@tp.column.classify_identifier.tuple[1]} -#{@tp.column.classify_relation.tuple[1]} -#{@tp.column.classify_coverage.tuple[1]} #{@tp.column.classify_keywords.tuple[1]} +#{@tp.column.identifier_oclc.tuple[1]} +#{@tp.column.identifier_isbn.tuple[1]} #{@tp.column.notes_abstract.tuple[1]} #{@tp.column.notes_comment.tuple[1]} #{@tp.column.notes_description.tuple[1]} #{@tp.column.notes_history.tuple[1]} +#{@tp.column.notes_format.tuple[1]} +#{@tp.column.notes_relation.tuple[1]} +#{@tp.column.notes_coverage.tuple[1]} +#{@tp.column.notes_type.tuple[1]} #{@tp.column.notes_prefix.tuple[1]} #{@tp.column.notes_prefix_a.tuple[1]} #{@tp.column.notes_prefix_b.tuple[1]} @@ -287,9 +280,6 @@ tid) #{@tp.column.src_word_count.tuple[1]} #{@tp.column.src_txt.tuple[1]} #{@tp.column.fulltext.tuple[1]} -#{@tp.column.skin_name.tuple[1]} -#{@tp.column.skin_fingerprint.tuple[1]} -#{@tp.column.skin.tuple[1]} #{@tp.column.links.tuple[1]} #{@id} );" diff --git a/lib/sisu/v3/db_remove.rb b/lib/sisu/v5/db_remove.rb index de579832..1fb40e30 100644 --- a/lib/sisu/v3/db_remove.rb +++ b/lib/sisu/v5/db_remove.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/db_remove.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/db_remove.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v3/db_select.rb b/lib/sisu/v5/db_select.rb index efa1e7bd..f6930fa4 100644 --- a/lib/sisu/v3/db_select.rb +++ b/lib/sisu/v5/db_select.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/db_select.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/db_select.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v3/db_sqltxt.rb b/lib/sisu/v5/db_sqltxt.rb index 91c775f8..eb52f300 100644 --- a/lib/sisu/v3/db_sqltxt.rb +++ b/lib/sisu/v5/db_sqltxt.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/db_sqltxt.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/db_sqltxt.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v3/db_tests.rb b/lib/sisu/v5/db_tests.rb index 33762987..5cc7c982 100644 --- a/lib/sisu/v3/db_tests.rb +++ b/lib/sisu/v5/db_tests.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/db_tests.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/db_tests.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v3/dbi.rb b/lib/sisu/v5/dbi.rb index 9521edbc..33592727 100644 --- a/lib/sisu/v3/dbi.rb +++ b/lib/sisu/v5/dbi.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/dbi.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/dbi.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v3/dbi_discrete.rb b/lib/sisu/v5/dbi_discrete.rb index b8e8f6ef..89fd3898 100644 --- a/lib/sisu/v3/dbi_discrete.rb +++ b/lib/sisu/v5/dbi_discrete.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/dbi_discrete.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/dbi_discrete.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v5/defaults.rb b/lib/sisu/v5/defaults.rb new file mode 100644 index 00000000..6b3004ef --- /dev/null +++ b/lib/sisu/v5/defaults.rb @@ -0,0 +1,1212 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008, 2009, 2010, 2011, 2012, 2013 Ralph Amissah, All Rights Reserved. + + * License: GPL 3 or later: + + SiSU, a framework for document structuring, publishing and search + + Copyright (C) Ralph Amissah + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program. If not, see <http://www.gnu.org/licenses/>. + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + <http://www.fsf.org/licensing/licenses/gpl.html> + <http://www.gnu.org/licenses/gpl.html> + + <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + <http://www.jus.uio.no/sisu> + <http://www.sisudoc.org> + + * Download: + <http://www.sisudoc.org/sisu/en/SiSU/download.html> + + * Git + <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/defaults.rb;hb=HEAD> + + * Ralph Amissah + <ralph@amissah.com> + <ralph.amissah@gmail.com> + + ** Description: Default values + +=end +$latex_run=nil +module SiSU_Viz + require 'uri' + require_relative 'sysenv' # sysenv.rb + include SiSU_Env + require_relative 'css' # css.rb + include SiSU_Style + class Defaults + def initialize + @fonts='verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman' # 'verdana, arial, georgia, tahoma, sans-serif, helvetica, "times new roman", times, roman' + @dir=SiSU_Env::InfoEnv.new + @date=SiSU_Env::InfoDate.new #{@date.year} + @v=SiSU_Env::InfoVersion.instance.get_version + end + #% glyph + def glyph_bullet # • + '• ' # [• flagged] + end + #% html + def html_hardspace + ' ' + end + def semantic_tags + def default + { + pub: 'publication', + conv: 'convention', + vol: 'volume', + pg: 'page', + cty: 'city', + org: 'organization', + uni: 'university', + dept: 'department', + fac: 'faculty', + inst: 'institute', + co: 'company', + com: 'company', + conv: 'convention', + dt: 'date', + y: 'year', + m: 'month', + d: 'day', + ti: 'title', + au: 'author', + ed: 'editor', #editor? + v: 'version', #edition + n: 'name', + fn: 'firstname', + mn: 'middlename', + ln: 'lastname', + in: 'initials', + qt: 'quote', + ct: 'cite', + ref: 'reference', + ab: 'abreviation', + def: 'define', + desc: 'description', + trans: 'translate', + } + end + self + end + #% decorate + def decorate_italics + 'title|article|book|journal' + end + def decorate_bold + end + def decorate_uppercase + 'surname' + end + #% semantic + def sem_title #dc 1 + 'title' + end + def sem_article + 'article' + end + def sem_book + 'book' + end + def sem_journal + 'journal' + end + def sem_fullname # (contains: firstname, surname) #issues arise as contains surname etc. + 'fullname' + end + def sem_first + 'first' + end + def sem_surname + 'surname' + end + def sem_middle + 'middle' + end + def sem_creator #dc 2 #==fullname (contains: firstname, surname) + 'creator' + end + def sem_author #==fullname (contains: firstname, surname) + 'author' + end + def sem_editor #==fullname (contains: firstname, surname) + 'editor' + end + def sem_illustrator #==fullname (contains: firstname, surname) + 'illustrator' + end + def sem_translator #==fullname (contains: firstname, surname) + 'translator' + end + def sem_isbn # 10 or 13 + 'isbn' + end + def sem_isbn_10 + 'isbn10' + end + def sem_isbn_13 + 'isbn13' + end + def sem_loc # library of congress + 'loc' + end + def sem_dewey + 'dewey' + end + def sem_pg # project gutenberg number + 'pg' + end + def sem_subject #dc 3 + 'subject' + end + def sem_date #dc 7 + 'date' + end + def sem_date_created + 'date_created' + end + def sem_date_issued + 'date_issued' + end + def sem_date_available + 'date_available' + end + def sem_date_valid + 'date_valid' + end + def sem_date_modified + 'date_modified' + end + def sem_type #dc 8 + 'type' + end + def sem_description #dc 4 + 'description' + end + def sem_publisher #dc 5 + 'publisher' + end + def sem_contributor #dc 6 + 'contributor' + end + def sem_format #dc 9 + 'format' + end + def sem_identifier #dc 10 + 'identifier' + end + def sem_source #dc 11 + 'source' + end + def sem_language #dc 12 + 'language' + end + def sem_relation #dc 13 + 'source' + end + def sem_coverage #dc 14 + 'coverage' + end + def sem_rights #dc 15 + 'rights' + end + def sem_copyright + 'copyright' + end + def sem_license + 'license' + end + def sem_prepared_by + 'prepared_by' + end + def sem_digitized_by + 'digitized_by' + end + def sem_keywords + 'keywords' + end + def sem_comments + 'comments' + end + def sem_abstract + 'abstract' + end + #% path + def path_stylesheet_home + %{ <link rel="stylesheet" href="./#{@dir.path.style}/homepage.css" type="text/css" />} + end + #% text #changed from txt to avoid naming conflicts #FOLLOW + def txt_generator + %{ <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 txt_generator_comment + %{ <!- #{@v[:project]} #{@v[:version]} of #{@v[:date_stamp]} (#{@v[:date]}) (n*x and Ruby!)" http://www.sisudoc.org/ ->} + end + def txt_hp + ' SiSU' + end + def txt_hp_alias + 'SiSU' + end + def txt_home + 'SiSU' + end + def txt_signature # used in latex/pdf footer + 'SiSU' + end + #% url + def url_urify(uri) + URI.parse(uri) + end + def url_sisu + 'http://www.sisudoc.org/' + end + def url_sisudoc + 'http://www.sisudoc.org' + end + def url_footer_signature + 'http://www.sisudoc.org/' + end + def url_root + '/sisu' #watch + end + def url_root_http + 'http://www.sisudoc.org/' #watch + end + def url_home + 'http://www.sisudoc.org/' # used in pdf header + end + def url_site #used as stub... where there are subdirectories and is different from home + url_home + #'http://www.sisudoc.org/' # used in pdf header + end + def url_txt + 'www.sisudoc.org/' + end + def url_path_image_base #used for html image display + "#{Xx[:html_relative2]}_sisu/image" + end + def url_path_image #used for html image display + "#{Xx[:html_relative2]}_sisu/image" + end + def url_path_image_sys #used for html image display + "#{Xx[:html_relative2]}_sisu/image_sys" + end + def url_decoration + def tex_open #'{\UseTextSymbol{OML}{<}}' + Dx[:url_o] + end + def tex_close #'{\UseTextSymbol{OML}{>}}' + Dx[:url_c] + end + def xml_open #'<' + Dx[:url_o] + end + def xml_close #'>' + Dx[:url_c] + end + def txt_open + '<' + end + def txt_close + '>' + end + self + end + def rel_decoration + def tex_open #'{\UseTextSymbol{OML}{<}}' + Dx[:rel_o] + end + def tex_close #'{\UseTextSymbol{OML}{>}}' + Dx[:rel_c] + end + def xml_open #'<' + Dx[:rel_o] + end + def xml_close #'>' + Dx[:rel_c] + end + def txt_open + '<' + end + def txt_close + '>' + end + self + end + #% color + def color_body + %{<body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en">} + end + def color_white + '"#ffffff"' + end + def color_black + '#000000' + end + def color_blue_ink + '#003399' + end + def color_blue_tinge + '#e3ecef' + end + def color_blue_grey + '#8faebf' + end + def color_blue_murky + '#437389' + end + def color_beige + '#f1e8de' + end + def color_subtleglow + '#dddccc' + end + def color_glow + '#fff0c3' + end + def color_rose + '#ffdec9' + end + def color_turquoise + '#1c869b' + end + def color_grey_pale + '#eeeeee' + end + def color_grey_medium + '#cccccc' + end + def color_grey + '#999999' + end + def color_yellow_light + '#fff3b6' + end + def color_yellow + '#ffde14' + end + def color_yellow_dark + '#ffcc00' + end + def color_green_light + '#b7d398' # #e2efd5 #b7d398 #b1c999 # '#aed19e' + end + def color_green + '#0a8400' + end + def color_green_dark + '#086800' + end + def color_ruby + '#a00000' + end + def color_maroon + '#800000' + end + def color_paper + %{"#{color_white}"} + end + def color_band1 + %{"#{color_white}"} + end + def color_band2 + %{"#{color_white}"} + end + def color_body + %{<body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en">} + end + def color_font_face #was font WATCH + "#{color_black}" + end + def color_surround + %{"#{color_white}"} + end + def color_band + %{"#{color_white}"} + end + def color_table1 + 'ffffcc' + end + def color_table2 + 'c0d0f0' + end + def color_band1 + '"#ffffff"' + end + def color_band2 + '"#ffffff"' + end + #% icon + def icon_ico + 'rb7.ico' + end + def icon_sisu + 'sisu.png' + end + def icon_manifest + 'b_info.png' + end + def icon_doc + 'b_doc.png' + end + def icon_toc + 'b_toc.png' + end + def icon_wmp + 'b_wmp.png' + end + def icon_odf + 'b_odf.png' + end + def icon_epub + 'b_epub.png' + end + def icon_pdf + 'b_pdf.png' + end + def icon_pdf_portrait + 'b_pdf.png' + end + def icon_pdf_landscape + 'b_pdf.png' + end + def icon_choice + 'b_choice.png' + end + def icon_new + 'b_new.png' + end + def icon_dot_clear + 'dot_clear.png' + end + def icon_dot_white + 'dot_white.png' + end + def icon_dot + icon_dot_white + end + def icon_home_button + 'sisu.png' + end + def icon_next + 'arrow_next_red.png' + end + def icon_previous + 'arrow_prev_red.png' + end + def icon_up + 'arrow_up_red.png' + end + #% font + def font_fonts + @fonts + end + def font_face + %{face="#{font_fonts}"} + end + def font_color + 'color="#000000"' + end + def font_size_endnote + 'size="3"' + end + def font_small + 'size="3"' + end + def font_tiny + 'size="2"' + end + #% markup + def markup_italics_list #regular expression of words to be italised + end + def markup_bold_list #regular expression of words to be made bold + 'SiSU' + end + def markup_make_italic + if defined? italics_list \ + and italics_list + make={} + if italics_list + r=italics_list.dup + x=case r + when /\/i$/; 'i' + else '' + end + r=r.gsub(/^\/(.+?)\/i?/,'\1'). + gsub(/\(/,'(?:') # avoid need to escape use of brackets within regex provided + m='\b(' + r + ')\b' + make[:str] + make[:regx]=(x =~/i/) \ + ? (/#{m}/i) + : (/#{m}/) + else nil + end + end + end + def markup_make_bold + if defined? bold_list \ + and not bold_list.empty? + make={} + if bold_list + r=bold_list.dup + x=case r + when /\/i$/; 'i' + else '' + end + r.gsub(/^\/(.+?)\/i?/,'\1'). + gsub(/\(/,'(?:') # avoid need to escape use of brackets within regex provided + m='\b(' + r + ')\b' + make[:str] + make[:regx]=(x =~/i/) \ + ? (/#{m}/i) + : (/#{m}/) + else nil + end + make + end + end + #% paragraph + def paragraph_txt + %{<p class="normal">} + end + def paragraph_endnote + %{<p class="endnote">} + end + def paragraph_font_tiny + %{<font #{font_tiny} #{font_face}>} + end + def paragraph_font_small + %{<font #{font_small} #{font_face}>} + end + #% table + def table_close + '</td></tr> +</table>' + end + def table_width_1 + '"100%"' + end + def table_width_2 + '"99%"' + end + def table_width_txt + '"94%"' + end + def table_width_txt_r + '"96%"' + end + def table_cellpad_box + '"20"' + end + #% indent + def indent_level_0 + '"1%"' + end + def indent_level_1 + '"4%"' + end + def indent_level_2 + '"6%"' + end + def indent_level_3 + '"8%"' + end + def indent_level_4 + '"10%"' + end + #% margin + def margin_num + '</p> </td><td width="4%" align="right" valign="top">' + end + def margin_numless + '</td><td width="4%" align="right" valign="top">' + end + def margin_num_css + '</td> +<td width="2%" align="right" valign="top"> ' + end + def margin_txt_w1 + %{<table summary="" width=#{table_width_txt_r} border="0" bgcolor="white" cellpadding="2" align="center"> +<tr><td width="6%" align="right"> </td> +<td width="90%" valign="top" align="justify">} + end + def margin_txt_w2 + %{<table summary="" width=#{table_width_txt_r} border="0" bgcolor="white" cellpadding="2" align="center"> +<tr><td width="10%" align="right"> </td> +<td width="86%" valign="top" align="justify">} + end + def margin_txt_0 + %{<table summary="" width=#{table_width_txt} border="0" bgcolor="white" cellpadding="2" align="center"> +<tr><td width=#{indent_level_0} align="right"> +</td><td valign="top" align="justify">} + end + def margin_txt_1 + %{<table summary="" width=#{table_width_txt} border="0" bgcolor="white" cellpadding="2" align="center"> +<tr><td width=#{indent_level_1} align="right"></td><td valign="top" align="justify">} + end + def margin_txt_2 + %{<table summary="" width=#{table_width_txt} border="0" bgcolor="white" cellpadding="2" align="center"> +<tr><td width=#{indent_level_2} align="right"> +</td> +<td valign="top" align="justify">} + end + def margin_txt_3 + %{<table summary="" width=#{table_width_txt} border="0" bgcolor="white" cellpadding="2" align="center"> +<tr><td width=#{indent_level_3} align="right"> +</td> +<td valign="top" align="justify">} + end + def margin_css + '<table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center"> +<tr><td valign="top" align="justify"> ' + end + #% png + def png_ico + %{ <link rel="shortcut icon" href="../_sisu/image/#{icon_ico}" />} + end + def png_sisu #check url path + %{ <a href="#{@url.sisu}"> + <img border="0" width="160" height="60" src="#{url_path_image}/#{icon_sisu}" alt="SiSU" /> + </a>} + end + def png_site + %{<img src="#{url_path_image}/#{icon_site}" alt="@" border="0" />} + end + def png_nav + %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_bluebell}" alt="Contents" />} + end + def png_manifest + %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_manifest}" alt="Document Manifest" />} + end + def png_doc + %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_doc}" alt="Full Text" />} + end + def png_toc + %{<img border="0" height="18" width="15" src="#{url_path_image_sys}/#{icon_toc}" alt="TOC linked" />} + end + def png_odf + %{<img border="0" height="18" width="18" src="#{url_path_image_sys}/#{icon_odf}" alt="ODF/ODT" />} + end + def png_epub + %{<img border="0" height="18" width="15" src="#{url_path_image_sys}/#{icon_epub}" alt="EPUB" />} + end + def png_pdf + %{<img border="0" height="18" width="15" src="#{url_path_image_sys}/#{icon_pdf}" alt="PDF" />} + end + def png_pdf_portrait + %{<img border="0" height="18" width="15" src="#{url_path_image_sys}/#{icon_pdf}" alt="PDF portrait" />} + end + def png_pdf_landscape + %{<img border="0" height="15" width="18" src="#{url_path_image_sys}/#{icon_pdf}" alt="PDF landscape" />} + end + def png_home + #dir=SiSU_Env::InfoEnv.new #(@fns) + %{<img border="0" src="#{url_path_image_base}/#{icon_home_button}" alt="#{txt_home} -->" />} + #%{<img border="0" src="#{dir.url.images_local}/#{icon_home_button}" alt="#{txt_home} -->" />} + end + def png_home_button + rel=@dir.path_rel_links.html_scroll_2 + %{<img border="0" src="#{rel}/#{icon_home_button}" alt="#{txt_home} -->" />} + end + #% png_nav #not currently used + #% nav_txt + def nav_txt_homepage + %{ <font face="#{font_fonts}" size="2"> + home + </font> } + end + def nav_txt_toc_link + %{ <font face="#{font_fonts}" size="2"> + toc + </font> } + end + def nav_txt_doc_link + %{ <font face="#{font_fonts}" size="2"> + scroll + </font> } + end + def nav_txt_manifest + #{png_manifest} document manifest + %{ <font face="#{font_fonts}" size="2"> + [ document manifest ] + </font> } + end + def nav_txt_concordance + %{ <font face="#{font_fonts}" size="2"> + A-Z + </font> } + end + def nav_txt_pdf_portrait + %{ <font face="#{font_fonts}" size="2"> + pdf + </font> } + end + def nav_txt_pdf_landscape + %{ <font face="#{font_fonts}" size="2"> + pdf + </font> } + end + #% banner + def banner_home_button_only + %{<a href="#{url_site}/"> + #{png_home_button} + </a>} + end + def banner_band #yellow_dark now white + %{<table summary="home button" width="100%" border="0" cellpadding="3" bgcolor= "#ffffff" align="center"> +<tr><td align="left" valign="middle" bgcolor="#{color_white}"> + <a href="#{url_site}/" target="_top"> + #{png_home} + </a> +</td> +<td width="90%"> +#{table_close}} + end + def banner_instrument_cover_band_scr + '<table summary="scroll instrument cover band" width="100%" border="0" cellpadding="8" bgcolor="#ffffff" align="center"> +<tr><td align="center">' + end + def banner_instrument_cover_band_seg + '<table summary="segment instrument cover band, title, author, location" width="100%" border="0" cellpadding="8" bgcolor="#ffffff" align="center"> +<tr><td align="center">' + end + #% widget + def widget_promo # Array used to build promo from list.yml and promo.yml + # ['sisu_icon','sisu','sisu_search_libre','open_society','fsf','ruby'] + end + def widgets_open +<<WOK +<table summary="SiSU summary" bgcolor="#ffffff" cellpadding="4" border="0"> +WOK + end + def widget_sisu_text +<<WOK + <p class="tiny"><font color="#666666" size="2"> + Output generated by + <a href="#{url_sisu}"> + #{@v[:project]} + </a> + #{@v[:version]} #{@v[:date]} (#{@v[:date_stamp]}) + </font></p> +WOK + end + def widget_sisu +<<WOK +<!-- widget sisu --> +<tr><td valign="top" width="100%"> +<!-- SiSU Rights --> +#{widget_sisu_text} +</td></tr> +WOK + end + def widget_sisu_verbose +<<WOK +<!-- widget sisu --> +<tr><td valign="top" width="10%"> + <p class="tiny_left"><font color="#666666" size="2"> + <a href="#{url_sisu}"> + <img border="0" src="../_sisu/image/sisu.png" alt="SiSU" width="120" height="39" /> + </a> + </font></p> +</td><td valign="top" width="45%"> +<!-- SiSU Rights --> + <p class="tiny_left"><font color="#666666" size="2"> + Output generated by + <a href="#{url_sisu}"> + #{@v[:project]} + </a> + #{@v[:version]} #{@v[:date]} (#{@v[:date_stamp]}) + <br /> + <a href="#{url_sisu}"> + <b>#{@v[:project]}</b> + </a> + Copyright <sup>©</sup> Ralph Amissah + 1997, current #{@date.year_static}. + All Rights Reserved. + <br /> + <a href="#{url_sisu}"> + #{@v[:project]} + </a> + is software for document structuring, publishing and search, + <br /> + <a href="#{url_sisu}"> + www.sisudoc.org/ + </a> + and + <a href="#{url_sisudoc}"> + www.sisudoc.org + </a> + <br /> + <i>w3 since October 3 1993</i> + <a href="mailto:ralph@amissah.com"> + ralph@amissah.com + </a> + </font></p> +</td><td valign="top" width="45%"> + <p class="tiny_left"><font color="#666666" size="2"> + #{@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 positioning system) + <br /> + Copyright <sup>©</sup> Ralph Amissah 1997, current #{@date.year_static}. + All Rights Reserved. + </font></p> +</td></tr> +WOK + end + def widget_way_better + <<WOK +<!-- widget way better --> +<tr><td valign="top" width="10%"> + <p class="tiny_left"><font color="#666666" size="2"> + <a href="http://www.gnu.org/licenses/gpl.html"> + <img border="0" src="../_sisu/image/gplv3_free_software.png" alt="GPLv3" width="127" height="51" /> + </a> + </font></p> +</td><td valign="top" width="45%"> + <p class="tiny_left"><font color="#666666" size="2"> + <a href="#{url_sisu}"> + #{@v[:project]} + </a> + is released under + <a href="http://www.gnu.org/licenses/gpl.html">GPLv3</a> + or later, + #{url_decoration.xml_open}<a href="http://www.gnu.org/licenses/gpl.html">http://www.gnu.org/licenses/gpl.html</a>#{url_decoration.xml_close} + </font></p> +</td><td valign="top" width="45%"> + <p class="tiny_left"><font color="#666666" size="2"> + #{@v[:project]}, developed using + <a href="http://www.ruby-lang.org/en/"> + Ruby + </a> + on + <a href="http://www.debian.org/"> + Debian/Gnu/Linux + </a> + software infrastructure, + with the usual GPL (or OSS) suspects. + <br /> + Better - "performance, reliability, scalability, security & total cost of ownership" + [not to mention flexibility & choice] use of and adherence to open standards (where practical and fair) and it is software libré. + <br /> + Get With the Future + <a href="http://www.sisudoc.org/"> + Way Better! + </a> + </font></p> +</td></tr> +WOK + end + #% credits + def credits_sisu_manifest + widget_sisu_text + end + def credits_sisu + x=%{<div class="substance"> +<table summary="SiSU summary" bgcolor="#ffffff" cellpadding="4" border="0"> +<tr><td> + #{widget_sisu} + #{widget_way_better} +</table></div>} + '' + end + def credits_splash + end + def credits_sisu_epub + x=%{<div class="substance"> +<p class="center"><a href="http://www.openebook.org"><b>EPUB</b></a> generated by <a href="http://www.sisudoc.org"><b>#{@v[:project]}</b></a> v#{@v[:version]}, GPL3</p> +</div>} + '' + end + end + class Home < Defaults + def initialize + @v=SiSU_Env::InfoVersion.instance.get_version + @dir=SiSU_Env::InfoEnv.new + @date=SiSU_Env::InfoDate.new #{@date.year} + end + def redirect + <<WOK +<html><head> +<title>SiSU</title> +<meta http-equiv="refresh" content="0, url=http://www.sisudoc.org/sisu/SiSU/"> +</head> +<body> +SiSU informtion provided at <a href="http://www.sisudoc.org/sisu/SiSU/">www.sisudoc.org/sisu/SiSU</a><p /> +If your browser supports redirection, you will be escorted there shortly. +</body> +</html> +WOK + end + def homepage + <<WOK +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> +<title>SiSU information Structuring Universe - Structured information, Serialized Units - software for electronic texts, documents, books, digital libraries in plaintext, HTML, EPUB, XHTML, XML, ODF (OpenDocument), LaTeX, PDF, SQL (PostgreSQL and SQLite), and for search</title> +<meta name="dc.title" content="SiSU - SiSU information Structuring Universe, Structured information Serialised Units, #{@date.year_static}" /> +<meta name="dc.creator" content="Ralph Amissah" /> +<meta name="dc.subject" content= "document structuring, ebook, publishing, PDF, LaTeX, XML, ODF, EPUB, SQL, postgresql, sqlite, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, granular search, digital library" /> +<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!)" /> +<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" /> +</head> + +<body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en"> +<a name="top" id="top"></a> +<a name="up" id="up"></a> +<a name="start" id="start"></a> + +<h1>SiSU</h1> +<p> +[<a href="http://sisudoc.org/sisu_manual/en/html/sisu/toc.html">Manual</a>] +</p> +<p> +[<a href="http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary">Source</a>] +[<a href="http://lists.sisudoc.org/listinfo/sisu">List Info (sisu@lists.sisudoc.org)</a>] +</p> + +<h1>SiSU Markup Samples</h1> +<p> +[<a href="http://sources.sisudoc.org/gitweb/?p=doc/sisu-markup-samples.git;a=summary">Source</a>] +[<a href="http://sisudoc.org/sisu_markup_samples.html">Output</a>] +</p> + +<hr /> + +<h2 class="top_band_tiny"> + Structured information, Serialized Units + + <a href="http://www.sisudoc.org" target="_top"> + <www.sisudoc.org> + </a> + or + <a href="http://www.jus.uio.no/sisu/" target="_top"> + <www.jus.uio.no/sisu/> + </a> +software for electronic texts, document collections, books, digital libraries & search, with "atomic search" & text locating system (shared object citation numbering: "<i>ocn</i>"). +Outputs include: plaintext, HTML, EPUB, ODT (OpenDocumentText), (XHTML, XML,) LaTeX, PDF, SQL (PostgreSQL and SQLite). +</h2> +<p class="small"> +<a href="mailto:sisu@lists.sisudoc.org"> +<sisu@lists.sisudoc.org> +</a> +<a href="http://lists.sisudoc.org/listinfo/sisu"> +<http://lists.sisudoc.org/listinfo/sisu> +</a> +</p> +<p class="small"> +<a href="mailto:ralph@amissah.com"> +<ralph@amissah.com> +</a> +<a href="mailto:ralph.amissah@gmail.com"> +<ralph.amissah@gmail.com> +</a> +</p> +<p class="tiny"> +#{@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. +</p> +</body> +</html> +WOK + end + def home_toc + ' ' + end + end + class Inserts + end + class TeX < Defaults + def initialize(papersize='') + @papersize=papersize + end + def a4 + def portrait + def w + 160 + end + def h + 228 + end + def img_px + 450 + end + self + end + def landscape + def w + 238 + end + def h + 160 + end + def img_px + 300 + end + self + end + self + end + def letter + def portrait + def w + 166 + end + def h + 212 + end + def img_px + 468 + end + self + end + def landscape + def w + 226 + end + def h + 166 + end + def img_px + 290 + end + self + end + self + end + def legal + def portrait + def w + 168 + end + def h + 286 + end + def img_px + 474 + end + self + end + def landscape + def w + 296 + end + def h + 166 + end + def img_px + 420 + end + self + end + self + end + def b5 + def portrait + def w + 140 + end + def h + 204 + end + def img_px + 356 + end + self + end + def landscape + def w + 200 + end + def h + 130 + end + def img_px + 260 + end + self + end + self + end + def a5 + def portrait + def w + 112 + end + def h + 162 + end + def img_px + 280 + end + self + end + def landscape + def w + 152 + end + def h + 100 + end + def img_px + 190 + end + self + end + self + end + def dimensions + d=case @papersize + when /a4/; a4 + when /letter/; letter + when /legal/; legal + when /b5/; b5 + when /a5/; a5 + else a4 + end + end + end +end +__END__ diff --git a/lib/sisu/v3/digests.rb b/lib/sisu/v5/digests.rb index d3c3f8c3..902a0e94 100644 --- a/lib/sisu/v3/digests.rb +++ b/lib/sisu/v5/digests.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/digests.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/digests.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -87,7 +87,6 @@ module SiSU_DigestView SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"file://#{@md.file.output_path.hash_digest.dir}/#{@md.file.base_filename.hash_digest}").flow if @opt.cmd =~/[MV]/ end SiSU_DigestView::Source::Scroll.new(@particulars).songsheet - SiSU_Env::InfoSkin.new(@md).select rescue SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do __LINE__.to_s + ':' + __FILE__ @@ -233,7 +232,7 @@ module SiSU_DigestView end else prefix='' - metad=[@tr.full_title,@tr.author,@tr.translator,@tr.illustrator,@tr.prepared_by,@tr.digitized_by,@tr.description,@tr.subject,@tr.abstract,@tr.publisher,@tr.contributor,@tr.date_created,@tr.date_issued,@tr.date_available,@tr.date_modified,@tr.date_valid,@tr.date,@tr.type,@tr.format,@tr.rights,@tr.identifier,@tr.source,@tr.language,@tr.language_original,@tr.relation,@tr.coverage,@tr.keywords,@tr.comments,@tr.cls_loc,@tr.cls_dewey,@tr.cls_gutenberg,@tr.cls_isbn,@tr.prefix_a,@tr.prefix_b,@tr.sourcefile,@tr.sourcefile_digest,@tr.last_generated,@tr.sisu_version,@tr.ruby_version,@tr.sc_number,@tr.sc_date,'Skin_Digest: ','Generated by: ','Ruby version: '] + metad=[@tr.full_title,@tr.author,@tr.translator,@tr.illustrator,@tr.prepared_by,@tr.digitized_by,@tr.description,@tr.subject,@tr.abstract,@tr.publisher,@tr.contributor,@tr.date_created,@tr.date_issued,@tr.date_available,@tr.date_modified,@tr.date_valid,@tr.date,@tr.type,@tr.format,@tr.rights,@tr.identifier,@tr.source,@tr.language,@tr.language_original,@tr.relation,@tr.coverage,@tr.keywords,@tr.comments,@tr.cls_loc,@tr.cls_dewey,@tr.cls_gutenberg,@tr.cls_isbn,@tr.prefix_a,@tr.prefix_b,@tr.sourcefile,@tr.sourcefile_digest,@tr.last_generated,@tr.sisu_version,@tr.ruby_version,@tr.sc_number,@tr.sc_date,'Generated by: ','Ruby version: '] metad.each do |n| m=rgx_txt(n) if m=~/\S+/ \ @@ -261,8 +260,6 @@ module SiSU_DigestView @c=/#{m_author}: (.+?)#{Mx[:id_o]}~\d;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}[0-9a-f]{#{@dl}}:[0-9a-f]{#{@dl}}#{Mx[:id_c]}/.match(para)[1].gsub(/<\/?u>/,'').strip when /#{m_sourcefile_digest}.+?<u>/ #watch dgst_extra="\n" + ' '*21 +'source' +' '*4 + @md.dgst[1] + ' '*34 + @md.fns - when /Skin_Digest: / - dgst_extra="\n" + ' '*21 + 'skin' +' '*6 + @md.dgst_skin[1] + ' '*34 + /(skin_\S+?\.rb)/.match(@md.dgst_skin[0])[1] when /#{m_sisu_version}: / @v=/#{m_sisu_version}: (.+?)#{Mx[:id_o]}~\d;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}[0-9a-f]{#{@dl}}:[0-9a-f]{#{@dl}}#{Mx[:id_c]}/.match(para)[1].gsub(/<\/?u>/,'').strip when /#{m_last_generated}: / diff --git a/lib/sisu/v3/embedded.rb b/lib/sisu/v5/embedded.rb index 2b1e7596..a75b1690 100644 --- a/lib/sisu/v3/embedded.rb +++ b/lib/sisu/v5/embedded.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/embedded.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/embedded.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v3/epub.rb b/lib/sisu/v5/epub.rb index e7325bcd..480474e1 100644 --- a/lib/sisu/v3/epub.rb +++ b/lib/sisu/v5/epub.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/epub.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/epub.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -99,7 +99,6 @@ module SiSU_EPUB @env.processing_path.epub_bld #(@md) @env.processing_path.epub_cp_images(@md) dir_epub=@env.processing_path.epub - SiSU_Env::InfoSkin.new(@md).select data=nil SiSU_Env::FileOp.new(@md).mkdir.output.epub @tuned_file_array=SiSU_EPUB::Source::XHTML_Environment.new(@particulars).tuned_file_instructions @@ -136,7 +135,7 @@ module SiSU_EPUB def initialize(particulars) @particulars=particulars @md,@env=particulars.md,particulars.env - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new @env,@css=particulars.env,SiSU_Style::CSS.new end def directories @@ -145,7 +144,6 @@ module SiSU_EPUB end def tuned_file_instructions @tell=SiSU_Screen::Ansi.new(@md.opt.cmd) - @md.opt.cmd=@md.opt.cmd.gsub(/H/,'h') directories dal_array=@particulars.dal_array # dal file drawn here @tuned_file_array=SiSU_EPUB_Tune::Tune.new(dal_array,@md).songsheet @@ -191,7 +189,7 @@ module SiSU_EPUB @@firstseg=nil def initialize(md=nil,data='') @md,@data=md,data - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new @epub=SiSU_EPUB_Format::HeadInformation.new(@md) @tell=SiSU_Screen::Ansi.new(@md.opt.cmd) if @md @make=SiSU_Env::ProcessingSettings.new(@md) @@ -213,6 +211,13 @@ module SiSU_EPUB @@toc[:opf] << @epub.metadata_opf.manifest_open @@toc[:seg] << %{<div class="content">\n<div class="substance">} @@toc[:scr] << %{<div class="content">\n<div class="substance">} + if defined? @md.make.cover_image \ + and @md.make.cover_image.is_a?(Hash) \ + and @md.make.cover_image[:cover] =~/\S+/ + md_opf_a_content << @epub.metadata_opf.manifest_cover_image_information(@md) + md_opf_a_spine << @epub.metadata_opf.spine_cover_image + md_opf_a_guide << @epub.metadata_opf.guide_cover_image + end md_opf_a_content << @epub.metadata_opf.manifest_content_sisu_toc if @make.build.toc? md_opf_a_spine << @epub.metadata_opf.spine_sisu_toc @@ -229,7 +234,7 @@ module SiSU_EPUB toc=case dob_toc.ln when 1 @s_a_no +=1 - name_s_a='section_a' + @s_a_no.to_s + lv_name='section_a' + @s_a_no.to_s @nav_no+=1 @nav_no2=@nav_no @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[6] @@ -239,21 +244,21 @@ module SiSU_EPUB @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[2] @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[1] @ncxo[1],@ncxo[2],@ncxo[3],@ncxo[4],@ncxo[5],@ncxo[6]=true,false,false,false,false,false - @epub.sections(dob_toc,name_s_a) - @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no,name_s_a) if dob_toc + @epub.sections(dob_toc,lv_name) + @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no,lv_name) if dob_toc if @level_a_first_occurrence \ && @make.build.toc? @nav_no+=1 @@toc[:ncx] << @epub.toc_ncx.navmap_sisu_toc(@nav_no) #epub ncx navmap, toc @level_a_first_occurrence=false end - md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,name_s_a) - md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,name_s_a) - md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,name_s_a) + md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,lv_name) + md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,lv_name) + md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,lv_name) SiSU_EPUB::Source::Toc.new(@md,dob_toc).level_1 when 2 @s_b_no +=1 - name_s_b='section_b' + @s_b_no.to_s + lv_name='section_b' + @s_b_no.to_s @nav_no+=1 @nav_no2=@nav_no @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[6] @@ -262,15 +267,15 @@ module SiSU_EPUB @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[3] @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[2] @ncxo[2],@ncxo[3],@ncxo[4],@ncxo[5],@ncxo[6]=true,false,false,false,false - @epub.sections(dob_toc,name_s_b) - @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no,name_s_b) if dob_toc - md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,name_s_b) - md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,name_s_b) - md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,name_s_b) + @epub.sections(dob_toc,lv_name) + @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no,lv_name) if dob_toc + md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,lv_name) + md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,lv_name) + md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,lv_name) SiSU_EPUB::Source::Toc.new(@md,dob_toc).level_2 when 3 @s_c_no +=1 - name_s_c='section_c' + @s_c_no.to_s + lv_name='section_c' + @s_c_no.to_s @nav_no+=1 @nav_no3=@nav_no @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[6] @@ -278,47 +283,50 @@ module SiSU_EPUB @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[4] @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[3] @ncxo[3],@ncxo[4],@ncxo[5],@ncxo[6]=true,false,false,false - @epub.sections(dob_toc,name_s_c) - @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no,name_s_c) if dob_toc - md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,name_s_c) - md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,name_s_c) - md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,name_s_c) + @epub.sections(dob_toc,lv_name) + @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no,lv_name) if dob_toc + md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,lv_name) + md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,lv_name) + md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,lv_name) SiSU_EPUB::Source::Toc.new(@md,dob_toc).level_3 when 4 @ncx_cls=[] + lv_name=dob_toc.name @nav_no+=1 @dob_name=dob.name @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[6] @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[5] @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[4] @ncxo[4],@ncxo[5],@ncxo[6]=true,false,false - @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no) if dob_toc - md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc) - md_opf_a_spine << @epub.metadata_opf.spine(dob_toc) - md_opf_a_guide << @epub.metadata_opf.guide(dob_toc) + @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no,lv_name) if dob_toc + md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,lv_name) + md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,lv_name) + md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,lv_name) SiSU_EPUB::Source::Toc.new(@md,dob_toc).level_4 when 5 @ncx_cls=[] - name_lv5=@dob_name + '.xhtml' + '#o' + dob_toc.ocn.to_s + hashtag='#o' + dob_toc.ocn.to_s + lv_name=@dob_name @nav_no+=1 @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[6] @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[5] @ncxo[5],@ncxo[6]=true,false - @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no,name_lv5) if dob_toc - md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,name_lv5) - md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,name_lv5) - md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,name_lv5) + @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no,lv_name,hashtag) if dob_toc + md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,lv_name,hashtag) + md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,lv_name,hashtag) + md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,lv_name,hashtag) SiSU_EPUB::Source::Toc.new(@md,dob_toc).level_5 when 6 @ncx_cls=[] - name_lv6=@dob_name + '.xhtml' + '#o' + dob_toc.ocn.to_s + hashtag='#o' + dob_toc.ocn.to_s + lv_name=@dob_name @nav_no+=1 @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[6] @ncxo[6]=true - @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no,name_lv6) if dob_toc - md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,name_lv6) - md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,name_lv6) - md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,name_lv6) + @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no,lv_name,hashtag) if dob_toc + md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,lv_name,hashtag) + md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,lv_name,hashtag) + md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,lv_name,hashtag) SiSU_EPUB::Source::Toc.new(@md,dob_toc).level_6 else nil end @@ -515,7 +523,7 @@ module SiSU_EPUB class ScrollHeadAndSegToc < Toc def initialize(md='',toc='',links_guide_toc='') @md,@toc,@links_guide_toc=md,toc,links_guide_toc - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new end def in_common toc_shared=[] @@ -545,7 +553,7 @@ module SiSU_EPUB segtoc << format_txt_obj.center_bold if defined? @md.creator.author \ and @md.creator.author - creator_endnote=@md.creator.author.gsub(/(\*+)/,%{ <sup><a href="#notes">\\1</a></sup>}) + creator_endnote=@md.creator.author.gsub(/(\*+)/,%{#{$ep[:hsp]}<sup><a href="#notes">\\1</a></sup>}) tmp_head=creator_endnote + "\n" txt_obj={ txt: tmp_head } format_txt_obj=SiSU_EPUB_Format::FormatTextObject.new(@md,txt_obj) @@ -584,7 +592,8 @@ module SiSU_EPUB #Segtoc tail added here segtoc << format_head_toc.xhtml_close segtoc=segtoc.flatten.compact #watch - SiSU_EPUB::Source::Output.new(@md,segtoc).segtoc + SiSU_EPUB::Source::Output.new(@md).make_cover_image + SiSU_EPUB::Source::Output.new(@md,segtoc).make_segtoc segtoc=[] @toc[:scr],@toc[:seg]=[],[] toc_shared @@ -692,7 +701,44 @@ module SiSU_EPUB end end end - def segtoc + def make_cover_image + begin + if @md.make.cover_image? \ + and @md.make.cover_image.is_a?(Hash) \ + and @md.make.cover_image[:cover] =~/\S+/ + filename_xhtml=@make_file.epub.xhtml_cover_image + cover_image=<<WOK +<?xml version='1.0' encoding='utf-8'?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" + "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <title>Cover</title> + <meta http-equiv="Content-Type" content='text/html; charset=utf-8' /> + <link rel="stylesheet" href="css/xhtml.css" type="text/css" /> + <style type="text/css"> img { max-width: 100%; } </style> + </head> + <body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en"> + <div class="svg_outer"> + <div class="svg_inner"> + <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100%" height="100%" viewBox="0 0 #{@md.make.cover_image[:w]} #{@md.make.cover_image[:h]}" preserveAspectRatio="xMidYMid meet"> + <image width="#{@md.make.cover_image[:w]}" height="#{@md.make.cover_image[:h]}" xlink:href="image/#{@md.make.cover_image[:cover]}" /> + </svg> + </div> + </div> + </body> +</html> +WOK + filename_xhtml.puts cover_image,"\n" + filename_xhtml.close + end + rescue + SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do + __LINE__.to_s + ':' + __FILE__ + end + end + end + def make_segtoc begin if @make.build.toc? filename_xhtml=@make_file.epub.xhtml_index diff --git a/lib/sisu/v3/epub_concordance.rb b/lib/sisu/v5/epub_concordance.rb index 4a63df91..e528a788 100644 --- a/lib/sisu/v3/epub_concordance.rb +++ b/lib/sisu/v5/epub_concordance.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/epub_concordance.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/epub_concordance.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -103,13 +103,12 @@ module SiSU_EPUB_Concordance def initialize(particulars) @particulars,@md=particulars,particulars.md @data=SiSU_EPUB::Source::XHTML_Environment.new(particulars).tuned_file_instructions - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new txt_path=%{#{@md.dir_out}} - SiSU_Env::InfoSkin.new(@md).select @fnb=@md.fnb - @lex_button=%{<a href="http://www.jus.uio.no/sisu/" target="_top"><img border="0" height="44" width="144" valign="center" src="../_sisu/image/sisu.png" alt="SiSU home -->"></a>} + @lex_button=%{<a href="http://www.jus.uio.no/sisu/" target="_top"><img border="0" height="44" width="144" valign="center" src="../_sisu/image/sisu.png" alt="SiSU home"></a>} @doc_details =<<WOK -<table summary="links to text related to this rudimentary index" width="96%" border="0" bgcolor="white" cellpadding="0" align="center"><tr><td width="2%" align="right"> </td><td width="94%" valign="top" align="justify"><h1 class="small"><a href="#{@md.file.base_filename.epub}"><b>#{@md.title.full}</b></a></h1><p class="bold">#{@md.creator.author}</p></td></tr></table> +<table summary="links to text related to this rudimentary index" width="96%" border="0" bgcolor="white" cellpadding="0" align="center"><tr><td width="2%" align="right">#{$ep[:hsp]}</td><td width="94%" valign="top" align="justify"><h1 class="small"><a href="#{@md.file.base_filename.epub}"><b>#{@md.title.full}</b></a></h1><p class="bold">#{@md.creator.author}</p></td></tr></table> WOK end def create @@ -127,7 +126,7 @@ WOK [if number of occurences exceed number of references - word occurs more than once in at least one reference. Footnote/endnotes are either assigned to the paragraph from which they are referenced or ignored, so it is relevant to check the footnotes referenced from within a paragraph as well.] </p> <p> - (After the page is fully loaded) you can jump directly to a word by appending a hash (#) and the word to the url for this text, (do not forget that words are case sensitive, and may be listed twice (starting with and without an upper case letter)), #your_word # [ http://[web host]/#{@fnb}/concordance.html#your_word ] + (After the page is fully loaded) you can jump directly to a word by appending a hash (#) and the word to the url for this text, (do not forget that words are case sensitive, and may be listed twice (starting with and without an upper case letter)), #your_word # [#{$ep[:hsp]}http://[web host]/#{@fnb}/concordance.html#your_word#{$ep[:hsp]}] </p> WOK end @@ -157,7 +156,7 @@ WOK def initialize(particulars) @particulars=particulars begin - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new @env,@md,@dal_array=particulars.env,particulars.md,particulars.dal_array @path="#{@env.processing_path.epub}" @freq=Hash.new(0) @@ -289,12 +288,12 @@ WOK end end end - scr='<font size="1" color="#777777" face=times new roman><img border="0" height="15" width="15" src="../_sisu/image/b_doc.png" alt="Full Text"> scroll: </font><font size="1" color="#222222" face=times new roman>doc# </font> ' + scr=%{<font size="1" color="#777777" face=times new roman><img border="0" height="15" width="15" src="../_sisu/image/b_doc.png" alt="Full Text">#{$ep[:hsp]}scroll:#{$ep[:hsp]}</font><font size="1" color="#222222" face=times new roman>doc##{$ep[:hsp]}</font> } seg='' @file_concordance << SiSU_EPUB_Concordance::Source::DocTitle.new(@particulars).create alph=%W[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z] @file_concordance << '<p>' - alph.each {|x| @file_concordance << %{<a href="##{x}">#{x}</a>, }} + alph.each {|x| @file_concordance << %{<a href="##{x}">#{x}</a>,#{$ep[:hsp]}}} @file_concordance << '</p>' letter=alph.shift @file_concordance << %{\n<p class="letter"><a name="A">A</a></p>} diff --git a/lib/sisu/v3/epub_format.rb b/lib/sisu/v5/epub_format.rb index 228c2df4..75967653 100644 --- a/lib/sisu/v3/epub_format.rb +++ b/lib/sisu/v5/epub_format.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/epub_format.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/epub_format.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -65,33 +65,31 @@ module SiSU_EPUB_Format def initialize(md,ocn) @md,@ocn=md,ocn.to_s @ocn ||='' - vz=SiSU_Env::GetInit.instance.skin end def ocn_display make=SiSU_Env::ProcessingSettings.new(@md) if make.build.ocn? ocn_class='ocn' - if @ocn.to_i==0 - @ocn.gsub(/^(\d+|)$/, - %{<label class="#{ocn_class}"> </label>}) + if @ocn==nil \ + or @ocn.to_i==0 \ + or @ocn.empty? + %{<label class="ocn_off"></label>} else @ocn.gsub(/^(\d+|)$/, %{<label class="#{ocn_class}"><a href="#o\\1" class="lnk#{ocn_class}">\\1</a></label>}) end else - ocn_class='ocn_off' - @ocn.gsub(/^(\d+|)$/, - %{<label class="#{ocn_class}"> </label>}) + %{<label class="ocn_off"></label>} end end def name - %{<a name="#{@ocn}"></a>} + (@ocn==nil || @ocn.empty?) ? '' : %{<a name="#{@ocn}"></a>} end def id #w3c? "tidy" complains about numbers as identifiers ! annoying - %{id="o#{@ocn}"} + (@ocn==nil || @ocn.empty?) ? '' : %{id="o#{@ocn}"} end def goto - %{<a href="##{@ocn}">} + (@ocn==nil || @ocn.empty?) ? '' : %{<a href="##{@ocn}">} end end class CSS @@ -1221,25 +1219,36 @@ module SiSU_EPUB_Format WOK end end + module SanitizeXML + def self.xml(x) + if x.is_a?(String) + x=x.gsub(/ /,' ') if Ep[:alt]==:on + x.gsub(/&/,'&'). + gsub(/</,"<").gsub(/>/,">"). + gsub(/#{Dx[:url_o]}/,Dx[:url_o_xml]).gsub(/#{Dx[:url_c]}/,Dx[:url_o_xml]). + #gsub(/</,'<').gsub(/>/,'>'). + gsub(/\\\\/,'<br />'). + gsub(/<br(?: \/)?>/,'<br />') + else x + end + end + end class HeadInformation include SiSU_Viz attr_reader :md,:rdf,:vz def initialize(md) @md=md # DublinCore 1 - title - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new @css=SiSU_Env::CSS_Stylesheet.new(md) @seg_name_xhtml=(SiSU_EPUB::Source::Seg.new.seg_name_xhtml || []) @seg_name_xhtml_tracker=(SiSU_EPUB::Source::Seg.new.seg_name_xhtml_tracker || []) - @index='index' - @metalink='#metadata' @tocband_scroll,@tocband_segtoc=nil,nil + @index,@metalink='index','#metadata' end def doc_type_xhtml <<-WOK <?xml version='1.0' encoding='utf-8'?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" - "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> WOK end @@ -1291,31 +1300,31 @@ application/epub+zip </container> WOK end - def sections(dob,name) - filename="#{name}#{Sfx[:epub_xhtml]}" - dir_epub_cont="#{@md.env.processing_path.epub}/#{Ep[:d_oebps]}" - segfilename="#{dir_epub_cont}/#{filename}" + def sections(dob,fn_base) + name=fn_base + Sfx[:epub_xhtml] + dir_epub_cont=@md.env.processing_path.epub + '/' + Ep[:d_oebps] + segfilename=dir_epub_cont + '/' + name output_epub_cont_seg=File.new(segfilename,'w') output_epub_cont_seg << %{#{doc_type} -<head> - <title> - #{dob.obj} - - #{@md.html_title} - </title> -<meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> -#{@css.xhtml_epub} -</head> -#{@vz.color_body} -<div class="content"> - <div class="substance"> - <label class="ocn"><a href="#o#{dob.ocn}" class="lnkocn">#{dob.ocn}</a></label> - <h1 class="norm" id="o#{dob.ocn}"> - #{dob.obj} - </h1> - </div> -</div> -</body> -</html>} + <head> + <title> + #{dob.obj} - + #{@md.html_title} + </title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + #{@css.xhtml_epub} + </head> + #{@vz.color_body} + <div class="content"> + <div class="substance"> + <label class="ocn"><a href="#o#{dob.ocn}" class="lnkocn">#{dob.ocn}</a></label> + <h1 class="norm" id="o#{dob.ocn}"> + #{dob.obj} + </h1> + </div> + </div> + </body> + </html>} output_epub_cont_seg.close end def toc_ncx #list of navigation points (like chapters), table of contents, listing each navigation point (chapters and such) under the navigation map @@ -1333,9 +1342,7 @@ output_epub_cont_seg.close end def open <<-WOK -<?xml version="1.0"?> -<!DOCTYPE ncx PUBLIC "-//NISO//DTD ncx 2005-1//EN" - "http://www.daisy.org/z3986/2005/ncx-2005-1.dtd"> +<?xml version='1.0' encoding='utf-8'?> <ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1"> WOK end @@ -1351,10 +1358,12 @@ output_epub_cont_seg.close end def head depth=@md.lvs[1] + @md.lvs[2] + @md.lvs[3] + @md.lvs[4] + title=SanitizeXML.xml(@md.title.full) + author=SanitizeXML.xml(@md.author) <<-WOK <!-- four required metadata items (for all NCX documents, (including the relaxed constraints of OPS 2.0) --> - <title>#{@md.title.full} by #{@md.author}</title> + <title>#{title} by #{author}</title> <link href="css/xhtml.css" rel="stylesheet" type="text/css" id="main-css" /> <meta name="dtb:uid" content="urn:uuid:#{@md.dgst[1]}" /> <!-- <meta name="epub-creator" content="#{@md.publisher}" /> --> @@ -1369,16 +1378,18 @@ output_epub_cont_seg.close WOK end def doc_title + txt=SanitizeXML.xml(@md.title.full) <<-WOK <docTitle> - <text>#{@md.title.full}</text> + <text>#{txt}</text> </docTitle> WOK end def doc_author + txt=SanitizeXML.xml(@md.author) <<-WOK <docAuthor> - <text>#{@md.author}</text> + <text>#{txt}</text> </docAuthor> WOK end @@ -1392,31 +1403,31 @@ output_epub_cont_seg.close ? '' : "-#{no}" <<-WOK - <navPoint id="navpoint#{id_u}" playOrder="#{no}"> - <navLabel> - <text>Table of Contents</text> - </navLabel> - <content src="index#{Sfx[:epub_xhtml]}" /> - </navPoint> + <navPoint id="navpoint#{id_u}" playOrder="#{no}"> + <navLabel> + <text>Table of Contents</text> + </navLabel> + <content src="index#{Sfx[:epub_xhtml]}" /> + </navPoint> WOK end - def navpoint(dob,no,name=nil) - name=name ? name : dob.name - cont_name=(name =~/#{Sfx[:epub_xhtml]}/) ? name : (name + Sfx[:epub_xhtml]) + def navpoint(dob,no,fn_base,hashtag=nil) + fn=fn_base + Sfx[:epub_xhtml] + name=hashtag ? fn + hashtag : fn id_u=DISABLE[:epub][:ncx_navpoint_unique_id] \ ? '' : "-#{no}" <<-WOK - <navPoint id="navpoint#{id_u}" playOrder="#{no}"> - <navLabel> - <text>#{dob.obj}</text> - </navLabel> - <content src="#{cont_name}" /> + <navPoint class="chapter" id="navpoint#{id_u}" playOrder="#{no}"> + <navLabel> + <text>#{dob.obj}</text> + </navLabel> + <content src="#{name}" /> WOK end def navpoint_close <<-WOK - </navPoint> + </navPoint> WOK end def navmap_close @@ -1442,7 +1453,7 @@ output_epub_cont_seg.close def package_open <<-WOK <?xml version='1.0' encoding='utf-8'?> -<package xmlns="http://www.idpf.org/2007/opf" unique-identifier="EPB-UUID" version="2.0"> +<package xmlns="http://www.idpf.org/2007/opf" version="2.0" unique-identifier="EPB-UUID"> WOK end def package_close @@ -1451,6 +1462,12 @@ output_epub_cont_seg.close WOK end def metadata #metadata dc + cover_image=if defined? @md.make.cover_image \ + and @md.make.cover_image.is_a?(Hash) \ + and @md.make.cover_image[:cover] =~/\S+/ + %{\n <#{$ep[:o]}meta name="cover" content="cover_image" />} + else '' + end author=if defined? @md.creator.author \ and @md.creator.author =~/\S+/ m='' @@ -1464,12 +1481,10 @@ output_epub_cont_seg.close m=(m.empty?) \ ? (surname + other_names) : (m + '; ' + surname + ', ' + other_names) - m=m.gsub(/</,'<').gsub(/>/,'>'). - gsub(/<br(?: \/)?>/,';') + m=SanitizeXML.xml(m) end x=@md.creator.author.dup - x=x.gsub(/</,'<').gsub(/>/,'>'). - gsub(/<br(?: \/)?>/,'<br />') + x=SanitizeXML.xml(x) %{\n <dc:creator opf:file-as="#{m}" opf:role="aut">#{x}</dc:creator>} else '' end @@ -1486,12 +1501,10 @@ output_epub_cont_seg.close m=(m.empty?) \ ? (surname + other_names) : (m + '; ' + surname + ', ' + other_names) - m=m.gsub(/</,'<').gsub(/>/,'>'). - gsub(/<br(?: \/)?>/,';') + m=SanitizeXML.xml(m) end x=@md.creator.editor.dup - x=x.gsub(/</,'<').gsub(/>/,'>'). - gsub(/<br(?: \/)?>/,'<br />') + x=SanitizeXML.xml(x) %{\n <dc:creator opf:file-as="#{m}" opf:role="edt">#{x}</dc:creator>} else '' end @@ -1508,12 +1521,10 @@ output_epub_cont_seg.close m=(m.empty?) \ ? (surname + other_names) : (m + '; ' + surname + ', ' + other_names) - m=m.gsub(/</,'<').gsub(/>/,'>'). - gsub(/<br(?: \/)?>/,';') + m=SanitizeXML.xml(m) end x=@md.creator.translator.dup - x=x.gsub(/</,'<').gsub(/>/,'>'). - gsub(/<br(?: \/)?>/,'<br />') + x=SanitizeXML.xml(x) %{\n <dc:creator opf:file-as="#{m}" opf:role="trl">#{x}</dc:creator>} else '' end @@ -1530,28 +1541,24 @@ output_epub_cont_seg.close m=(m.empty?) \ ? (surname + other_names) : (m + '; ' + surname + ', ' + other_names) - m=m.gsub(/</,'<').gsub(/>/,'>'). - gsub(/<br(?: \/)?>/,';') + m=SanitizeXML.xml(m) end x=@md.creator.illustrator.dup - x=x.gsub(/</,'<').gsub(/>/,'>'). - gsub(/<br(?: \/)?>/,'<br />') + x=SanitizeXML.xml(x) %{\n <dc:creator opf:file-as="#{m}" opf:role="ill">#{x}</dc:creator>} else '' end date_published=if defined? @md.date.published \ and @md.date.published =~/\S+/ x=@md.date.published.dup - x=x.gsub(/</,'<').gsub(/>/,'>'). - gsub(/<br(?: \/)?>/,'<br />') + x=SanitizeXML.xml(x) %{\n <dc:date opf:event="published">#{x}</dc:date>} else '' end subject=if defined? @md.classify.subject \ and @md.classify.subject =~/\S+/ x=@md.classify.subject.dup - x=x.gsub(/</,'<').gsub(/>/,'>'). - gsub(/<br(?: \/)?>/,'<br />') + x=SanitizeXML.xml(x) %{\n <dc:subject>#{x}</dc:subject>} else '' end @@ -1563,21 +1570,25 @@ output_epub_cont_seg.close end rights=if defined? @md.rights.all \ and @md.rights.all =~/\S+/ - rights=@md.rights.all.gsub(/<br>/,'<br />') + rights=SanitizeXML.xml(@md.rights.all) + rights=rights.gsub(/<br\s*\/?>/,' ') %{\n <dc:rights>#{rights}</dc:rights>} else '' end f=SiSU_Env::FileOp.new(@md) <<-WOK - <metadata xmlns:dc="http://purl.org/dc/elements/1.1/" + <#{$ep[:o]}metadata + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:opf="http://www.idpf.org/2007/opf" + xmlns:dcterms="http://purl.org/dc/terms/" + xmlns:dc="http://purl.org/dc/elements/1.1/" unique-identifier="urn:uuid:#{@md.dgst[1]}" version="2.0"> <dc:title>#{@md.title.full}</dc:title> - #{author}#{editor}#{translator}#{illustrator}#{language}#{date_published}#{subject}#{rights} - <dc:identifier opf:scheme="URI">#{f.output_path.epub.url}/#{f.base_filename.epub}</dc:identifier> + #{cover_image}#{author}#{editor}#{translator}#{illustrator}#{language}#{date_published}#{subject}#{rights} + <dc:identifier opf:scheme="URI">#{f.output_path.epub.url.gsub(/http:\/\//,'')}/#{f.base_filename.epub}</dc:identifier> <dc:identifier id="bookid">urn:uuid:#{@md.dgst[1]}</dc:identifier> <!-- <dc:identifier id="EPB-UUID">urn:uuid:#{@md.dgst[1]}</dc:identifier> --> - </metadata> + </#{$ep[:o]}metadata> WOK end def manifest_open @@ -1592,14 +1603,24 @@ output_epub_cont_seg.close end def manifest_content_sisu_toc <<-WOK - <item id="index" href="index.xhtml" media-type="application/xhtml+xml" /> + <item id="index#{Sfx[:epub_xhtml]}" href="index#{Sfx[:epub_xhtml]}" media-type="application/xhtml+xml" /> WOK end - def manifest_content(dob,name=nil) - name=name ? name : dob.name - href_name=(name =~/#{Sfx[:epub_xhtml]}/) ? name : (name + Sfx[:epub_xhtml]) + def manifest_cover_image_information(md) + cover_image=if defined? md.make.cover_image \ + and @md.make.cover_image.is_a?(Hash) \ + and md.make.cover_image[:cover] =~/\S+/ + <<-WOK + <item id="cover_image#{Sfx[:epub_xhtml]}" href="cover_image#{Sfx[:epub_xhtml]}" media-type="application/xhtml+xml" /> + WOK + else '' + end + end + def manifest_content(dob,fn_base,hashtag=nil) + fn=fn_base + Sfx[:epub_xhtml] + name=hashtag ? fn + hashtag : fn <<-WOK - <item id="#{name}" href="#{href_name}" media-type="application/xhtml+xml" /> + <item id="#{name}" href="#{name}" media-type="application/xhtml+xml" /> WOK end def manifest_images(imgs) @@ -1607,6 +1628,7 @@ output_epub_cont_seg.close images=[" <!-- Images -->\n"] imgs.each do |i| image,type=/(\S+?)\.(png|jpg|gif)/.match(i)[1,2] + type=type.sub(/jpg/,'jpeg') images<<<<-WOK <item id="#{image}" href="image/#{image}.#{type}" media-type="image/#{type}" /> WOK @@ -1625,13 +1647,19 @@ output_epub_cont_seg.close <spine toc="ncx"> WOK end + def spine_cover_image + <<-WOK + <itemref idref="cover_image#{Sfx[:epub_xhtml]}" /> + WOK + end def spine_sisu_toc <<-WOK - <itemref idref="index" linear="yes" /> + <itemref idref="index#{Sfx[:epub_xhtml]}" linear="yes" /> WOK end - def spine(dob,name=nil) - name=name ? name : dob.name + def spine(dob,fn_base,hashtag=nil) + fn=fn_base + Sfx[:epub_xhtml] + name=hashtag ? fn + hashtag : fn <<-WOK <itemref idref="#{name}" linear="yes" /> WOK @@ -1647,12 +1675,19 @@ output_epub_cont_seg.close <guide> WOK end + def guide_cover_image + <<-WOK + <reference type="cover" title="Cover of #{SanitizeXML.xml(@md.title.full)}" href="cover_image#{Sfx[:epub_xhtml]}" /> + WOK + end def guide_sisu_toc <<-WOK - <reference type="index" href="index#{Sfx[:epub_xhtml]}" /> + <reference type="index#{Sfx[:epub_xhtml]}" href="index#{Sfx[:epub_xhtml]}" /> WOK end - def guide(dob,name=nil) + def guide(dob,fn_base,hashtag=nil) + fn=fn_base + Sfx[:epub_xhtml] + name=hashtag ? fn + hashtag : fn name=name ? name : dob.name guide_name=(name =~/#{Sfx[:epub_xhtml]}/) ? name : (name + Sfx[:epub_xhtml]) <<-WOK @@ -1695,20 +1730,20 @@ output_epub_cont_seg.close end def head %{#{doc_type} -<head> -<meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> -#{@css.xhtml_epub} -</head> -#{@vz.color_body}} + <head> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + #{@css.xhtml_epub} + </head> + #{@vz.color_body}} end def concordance if @md.concord_make %{#{@vz.margin_css} - <h4 class="toc"> - <a href="./#{@md.file.base_filename.html_concordance}"> - <i>Concordance</i> - </a> - </h4> + <h4 class="toc"> + <a href="./#{@md.file.base_filename.html_concordance}"> + <i>Concordance</i> + </a> + </h4> #{@vz.table_close}} else %{#{@vz.margin_css} @@ -1724,9 +1759,8 @@ output_epub_cont_seg.close end def rights def all - rghts=@md.rights.all.gsub(/<br>/,'<br />') - rghts=rghts.gsub(/^\s*Copyright\s+\(C\)/,'Copyright <sup>©</sup> ') - %{<p class="small_left">Rights: #{rghts}</p>} + rights=SanitizeXML.xml(@md.rights.all) + %{<p class="small_left">Rights: #{rights}</p>} end self end @@ -1776,15 +1810,15 @@ output_epub_cont_seg.close end def head %{#{doc_type} -<head> - <title> - #{@seg_name_xhtml[@seg_name_xhtml_tracker]} - - #{@md.html_title} - </title> -<meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> -#{@css.xhtml_epub} -</head> -#{@vz.color_body}} + <head> + <title> + #{@seg_name_xhtml[@seg_name_xhtml_tracker]} - + #{@md.html_title} + </title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + #{@css.xhtml_epub} + </head> + #{@vz.color_body}} end def endnote_mark %{ @@ -1802,7 +1836,7 @@ output_epub_cont_seg.close <a href="#owner.details"> Owner Details <font size="1" color="#777777"> - + #{$ep[:hsp]*3} </font> </a> </font> @@ -1810,7 +1844,7 @@ output_epub_cont_seg.close end end class FormatTextObject - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new attr_accessor :md,:t_o,:txt,:ocn,:format,:table,:link,:linkname,:paranum,:p_num,:headname,:banner,:url def initialize(md,t_o) @md,@t_o=md,t_o @@ -1854,7 +1888,7 @@ output_epub_cont_seg.close @txt=@txt.gsub(/#{Mx[:mk_o]}[-~]##{Mx[:mk_c]}/,'') end @p_num=ParagraphNumber.new(@md,@ocn) - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new end def nametags_seg(dob) #FIX tags='' @@ -1883,7 +1917,7 @@ output_epub_cont_seg.close def no_paranum %{ <div class="substance"> - <label class="ocn"> </label> + <label class="ocn">#{$ep[:hsp]}</label> <p class="norm"> #{@txt} </p> @@ -1938,7 +1972,7 @@ output_epub_cont_seg.close para_form_css('p','norm',@txt) end def break - @txt=@txt.gsub(/#{Mx[:br_page_new]}|#{Mx[:br_page]}/,'<hr /><br />'). + @txt=@txt.gsub(/#{Mx[:br_page_new]}|#{Mx[:br_page]}|#{Mx[:br_page_line]}/,'<hr /><br />'). gsub(/#{Mx[:br_obj]}/,'<hr style="width:30%" /><br />') para_form_css('p','norm',@txt) end @@ -2028,7 +2062,7 @@ output_epub_cont_seg.close #{@txt} </p> #{@vz.margin_num_css} - + #{$ep[:hsp]*3} #{@vz.table_close}} end def bold_heading #unused @@ -2038,26 +2072,30 @@ output_epub_cont_seg.close #{@txt} </p> #{@vz.margin_num_css} - + #{$ep[:hsp]*3} #{@vz.table_close}} end def toc_head_copy_at + @txt=SanitizeXML.xml(@txt) %{<p class="center">#{@txt}</p>\n} end def center + @txt=SanitizeXML.xml(@txt) %{<p class="center">#{@txt}</p>\n} end def bold + @txt=SanitizeXML.xml(@txt) %{<p class="bold">#{@txt}</p>\n} end def center_bold + @txt=SanitizeXML.xml(@txt) %{<p class="centerbold">#{@txt}</p>\n} end end class FormatScroll < FormatTextObject def initialize(md,txt) super(md,txt) - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new end end class FormatSeg < FormatTextObject @@ -2088,8 +2126,8 @@ output_epub_cont_seg.close note=$1 note=note.gsub(/[\n\s]+/m,' ') txt=txt.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' '). - gsub(/<a[\n\s]+"[\n\s]+href="#note_ref\d+"> <sup id="note\d+">\d+<\/sup> /m,''). - gsub(/<a[\n\s]+"[\n\s]+href="#note_ref\d+">#{Mx[:nbsp]}<sup id="note\d+">\d+<\/sup>#{Mx[:nbsp]}/m,'') #remove + gsub(/<a[\n\s]+"[\n\s]+href="#note_ref\d+">#{$ep[:hsp]}<sup id="note\d+">\d+<\/sup>#{$ep[:hsp]}/m,''). + gsub(/<a[\n\s]+"[\n\s]+href="#note_ref\d+">#{$ep[:hsp]}<sup id="note\d+">\d+<\/sup>#{$ep[:hsp]}/m,'') #remove end %{<#{tag} class="#{attrib}"> <a href="#o#{@ocn}"><i>#{txt}</i></a> #{note} diff --git a/lib/sisu/v3/epub_segments.rb b/lib/sisu/v5/epub_segments.rb index 40989632..64bea759 100644 --- a/lib/sisu/v3/epub_segments.rb +++ b/lib/sisu/v5/epub_segments.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/epub_segments.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/epub_segments.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -132,7 +132,7 @@ WOK attr_reader :seg_name_xhtml,:seg_name_xhtml_tracker def initialize(md='',data='') @md,@data=md,data - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new @seg_name_xhtml=@@seg_name_xhtml || nil @seg_name_xhtml_tracker=@@tracker || nil @make=SiSU_Env::ProcessingSettings.new(@md) if @md @@ -309,7 +309,7 @@ WOK txt_obj={ txt: @@heading1, ocn_display: @p_num.ocn_display } format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj) @@seg[:headings] << format_seg.title_heading1.gsub(clean,'') - @@heading1=@@heading1.gsub(/ <a name="-[\d*+]+" href="#_[\d*+]+"> <sup>[\d*+]+<\/sup> <\/a>/,'') + @@heading1=@@heading1.gsub(/#{$ep[:hsp]}<a name="-[\d*+]+" href="#_[\d*+]+">#{$ep[:hsp]}<sup>[\d*+]+<\/sup>#{$ep[:hsp]}<\/a>/,'') end if @@is2==1 heading2=@@heading2 @@ -320,7 +320,7 @@ WOK txt_obj={ txt: heading2, ocn_display: @p_num.ocn_display } format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj) @@seg[:headings] << format_seg.title_heading2.gsub(clean,'') - @@heading2=@@heading2.gsub(/ <a name="-[\d*+]+" href="#_[\d*+]+"> <sup>[\d*+]+<\/sup> <\/a>/,'') + @@heading2=@@heading2.gsub(/#{$ep[:hsp]}<a name="-[\d*+]+" href="#_[\d*+]+">#{$ep[:hsp]}<sup>[\d*+]+<\/sup>#{$ep[:hsp]}<\/a>/,'') end if @@is3==1 heading3=@@heading3 @@ -331,7 +331,7 @@ WOK txt_obj={ txt: heading3, ocn_display: @p_num.ocn_display } format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj) @@seg[:headings] << format_seg.title_heading3.gsub(clean,'') - @@heading3=@@heading3.gsub(/ <a name="-[\d*+]+" href="#_[\d*+]+"> <sup>[\d*+]+<\/sup> <\/a>/,'') + @@heading3=@@heading3.gsub(/#{$ep[:hsp]}<a name="-[\d*+]+" href="#_[\d*+]+">#{$ep[:hsp]}<sup>[\d*+]+<\/sup>#{$ep[:hsp]}<\/a>/,'') end if @@is4==1 heading4=@@heading4 diff --git a/lib/sisu/v3/epub_tune.rb b/lib/sisu/v5/epub_tune.rb index 664f143e..c0005365 100644 --- a/lib/sisu/v3/epub_tune.rb +++ b/lib/sisu/v5/epub_tune.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/epub_tune.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/epub_tune.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -107,17 +107,17 @@ module SiSU_EPUB_Tune str=str.gsub(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;'). gsub(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;'). gsub(/<br>/u,'<br />'). - gsub(/#{Mx[:nbsp]}/u,' ') + gsub(/#{Mx[:nbsp]}/u,$ep[:hsp]) end end class Tune def initialize(data,md) @data,@md=data,md - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new @env=SiSU_Env::InfoEnv.new(@md.fns) @sys=SiSU_Env::SystemCall.new @env=SiSU_Env::InfoEnv.new(@md.fns) - @brace_url=SiSU_Viz::Skin.new.url_decoration + @brace_url=SiSU_Viz::Defaults.new.url_decoration end def songsheet begin @@ -155,8 +155,9 @@ module SiSU_EPUB_Tune gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>'). gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>'). # tt, kbd gsub(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,''). - gsub(/#{Mx[:gl_bullet]}/m,'● '). - gsub(/#{Mx[:nbsp]}/,' '). + gsub(/#{Mx[:gl_bullet]}/m,"●#{$ep[:hsp]*2}"). + gsub(/#{Dx[:url_o]}/,Dx[:url_o_xml]).gsub(/#{Dx[:url_c]}/,Dx[:url_o_xml]). + gsub(/#{Mx[:nbsp]}/,$ep[:hsp]). gsub(/<(p|br)>/,'<\1 />') dob.obj=SiSU_EPUB_Tune::CleanXHTML.new(dob.obj).clean @tuned_file << dob @@ -257,9 +258,9 @@ module SiSU_EPUB_Tune %{\n<center><a href="\\1" target="_top"><img src="#{@env.url.images_epub}/\\2" alt="\\3" /></a></center>\n}) end dob.obj=dob.obj.gsub(/!pick/,%{<img border="0" height="15" width="15" src="#{@env.url.images_epub}/#{@vz.icon_choice}" alt="stellar" />}). - gsub(/!new/,%{ <img border="0" height="15" width="15" src="#{@env.url.images_epub}/#{@vz.icon_new}" alt="new" />}). + gsub(/!new/,%{#{$ep[:hsp]}<img border="0" height="15" width="15" src="#{@env.url.images_epub}/#{@vz.icon_new}" alt="new" />}). gsub(/<:h(.{1,7}?)>/,'<a href="#h\1">\1</a>'). - gsub(/<:to(\d{1,7}?)>/,'<a href="#to\1">to { \1 }</a> '). + gsub(/<:to(\d{1,7}?)>/,%{<a href="#to\\1">to#{$ep[:hsp]}\{#{$ep[:hsp]}\\1#{$ep[:hsp]}\}</a> }). gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'<a href="\1" target="_top">\1</a>'). #http ftp matches escaped, no decoration gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}<a href="mailto:\\1">\\1</a>#{@brace_url.xml_close}}). gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}<a href="\\1" target="_top">\\1</a>#{@brace_url.xml_close}}) #http ftp matches with decoration diff --git a/lib/sisu/v3/errors.rb b/lib/sisu/v5/errors.rb index 505ba616..9721bf72 100644 --- a/lib/sisu/v3/errors.rb +++ b/lib/sisu/v5/errors.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/errors.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/errors.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v3/git.rb b/lib/sisu/v5/git.rb index 9ec2986a..eb5a9b99 100644 --- a/lib/sisu/v3/git.rb +++ b/lib/sisu/v5/git.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/git.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/git.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -94,7 +94,6 @@ module SiSU_Git po: git_path_fnb + '/' + Gt[:po] + '/' + lng, pot: git_path_fnb + '/' + Gt[:pot], conf: git_path_fnb + '/' + Gt[:sisupod] + '/' + Gt[:conf], - skin: git_path_fnb + '/' + Gt[:sisupod] + '/' + Gt[:skin], image: git_path_fnb + '/' + Gt[:sisupod] + '/' + Gt[:image], audio: git_path_fnb + '/' + Gt[:sisupod] + '/' + Gt[:audio], video: git_path_fnb + '/' + Gt[:sisupod] + '/' + Gt[:video], @@ -131,7 +130,6 @@ module SiSU_Git 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[:skin]) unless FileTest.directory?(@git_path[:skin]) 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]) @@ -201,56 +199,10 @@ module SiSU_Git else "#{@env.path.pwd}/#{@opt.fns}" end end - def locate_skin - SiSU_Env::InfoSkin.new(@md).select - end def read_composite #print __FILE__ + ':' #p __LINE__ end - def extract_skin - #print __FILE__ + ':' - #p __LINE__ - end - def extract_skin_and_images #(parse_file) - parse_file_name=locate_parse_file - parse_file=IO.readlines(parse_file_name,'') - rgx_image=/(?:^|[^_\\])\{\s*(\S+?\.(?:png|jpg|gif))/ - #rgx_rb_image=/["'](\S+?\.(?:png|jpg|gif))["']/ - #rgx_rb_image=/[^\/]?([a-z]\S+?\.(?:png|jpg|gif))/ - rgx_rb_image=/([a-z][^ \/]+?\.(?:png|jpg|gif))/ - rgx_skin=/^\s+:skin:\s+(\S+)/ - skin_get=nil - images=[] - skin_get - parse_file.each do |f| #% work area - if f !~/^%+\s/ - skin_get ||= f.scan(rgx_skin).uniq.flatten if f =~rgx_skin - if f =~rgx_image - images << f.scan(rgx_image).uniq - end - end - end - skin=skin_get[0] if skin_get - skin=locate_skin - parse_skin=IO.readlines(skin,"\n") - parse_skin.each do |f| #% work area - if f !~/^#/ \ - and f =~rgx_rb_image - images << f.scan(rgx_rb_image).uniq - end - end - image_path="#{@env.path.pwd}/_sisu/image" - images.flatten.each do |i| - if FileTest.file?("#{image_path}/#{i}") - FileUtils::cp_r("#{image_path}/#{i}",@git_path[:image]) - end - end - if FileTest.file?(skin) - FileUtils::cp_r(skin,"#{@git_path[:conf]}/skin") - end - { skin: skin, images: images } - end def sisuyaml_rc sisurc=@env.path.sisurc_path if FileTest.file?(sisurc) @@ -269,11 +221,9 @@ module SiSU_Git if composite_src? populate.copy_related_sst_ssi end - populate.extract_skin #parse_file_name=locate_parse_file #parse_file=IO.readlines(parse_file_name,'') populate.sisuyaml_rc #(parse_file) - populate.extract_skin_and_images #(parse_file) #populate.extract_composite_source #populate.read_composite # or read_each_composite populate.identify_language_versions diff --git a/lib/sisu/v3/harvest.rb b/lib/sisu/v5/harvest.rb index b458b8df..ffcb6aa3 100644 --- a/lib/sisu/v3/harvest.rb +++ b/lib/sisu/v5/harvest.rb @@ -52,7 +52,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/harvest.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/harvest.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v3/harvest_authors.rb b/lib/sisu/v5/harvest_authors.rb index 0c5d82e9..89a64fee 100644 --- a/lib/sisu/v3/harvest_authors.rb +++ b/lib/sisu/v5/harvest_authors.rb @@ -51,7 +51,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/harvest_authors.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/harvest_authors.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -69,7 +69,6 @@ module SiSU_HarvestAuthors @file_list=opt.files end def songsheet - puts 'authors:' idx_array={} @opt.f_pths.each do |y| lang_hash_file_array={} @@ -176,11 +175,11 @@ module SiSU_HarvestAuthors def initialize(opt,the_idx) @opt,@the_idx=opt,the_idx @env=SiSU_Env::InfoEnv.new - @rc=SiSU_Env::GetInit.instance.sisu_yaml.rc + @rc=SiSU_Env::GetInit.new.sisu_yaml.rc @alphabet_list=%W[9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z] @alph=@alphabet_list.dup @letter=@alph.shift - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new end def html_file_open @the_idx.keys.each do |lng| @@ -198,7 +197,8 @@ module SiSU_HarvestAuthors file="#{harvest_pth}/authors.#{lng}.html" end FileUtils::mkdir_p(harvest_pth) unless FileTest.directory?(harvest_pth) - puts "file://#{file}" + fileinfo=(@opt.cmd =~/[vVM]/) ? ("file://#{file}") : '' + SiSU_Screen::Ansi.new(@opt.cmd,"harvest authors (#{@opt.files.length} files)",fileinfo).dark_grey_title_hi unless @opt.cmd =~/q/ @output[lng][:html]=File.new(file,'w') end end @@ -231,7 +231,7 @@ module SiSU_HarvestAuthors topics="topics.#{lng}.html" elsif @env.output_dir_structure.by? == :filename css_path=(type !~/maintenance/) \ - ? '../_sisu/css/harvest.css' + ? './_sisu/css/harvest.css' : 'harvest.css' topics="topics.#{lng}.html" end @@ -244,11 +244,27 @@ module SiSU_HarvestAuthors elsif @env.output_dir_structure.by? == :filetype harvest_pth='.' file="#{harvest_pth}/authors.#{lng}.html" + elsif @env.output_dir_structure.by? == :filename + harvest_pth='.' + file="#{harvest_pth}/authors.#{lng}.html" end l=ln[lng][:t] harvest_languages += %{<a href="#{file}">#{l}</a> } end sv=SiSU_Env::InfoVersion.instance.get_version + if @env.output_dir_structure.by? == :language + home_pth='../..' + output_structure_by='(output organised by language & filetype)' + elsif @env.output_dir_structure.by? == :filetype + home_pth='..' + output_structure_by='(output organised by filetype)' + elsif @env.output_dir_structure.by? == :filename + home_pth='.' + output_structure_by='(output organised by filename)' + else + home_pth='.' + output_structure_by='(output organised by ?)' + end <<WOK <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> @@ -267,8 +283,8 @@ module SiSU_HarvestAuthors <a name="top" id="top"></a> <a name="up" id="up"></a> <a name="start" id="start"></a> -<h1>SiSU Metadata Harvest - Authors</h1> -<p>[<a href="../index.html"> HOME </a>] also see <a href="#{topics}">SiSU Metadata Harvest - Topics</a></p> +<h1>SiSU Metadata Harvest - Authors #{output_structure_by}</h1> +<p>[<a href="#{home_pth}/index.html"> HOME </a>] also see <a href="#{topics}">SiSU Metadata Harvest - Topics</a></p> <p>#{@env.widget_static.search_form}</p> <hr /> <p class="tiny">#{harvest_languages}</p> @@ -357,7 +373,7 @@ WOK manifest_name=x[:file] x[:file] + '.' + lng + '.html' elsif @env.output_dir_structure.by? == :filename - "../#{x[:file]}/#{x[:page]}" + "./#{x[:file]}/#{x[:page]}" else '' #error end work=[ "#{x[:date]} #{x[:title]}", %{<p class="publication">#{x[:date]} <a href="#{manifest_at}">#{x[:title]}</a>, #{x[:author][:authors_s]}</p>} ] diff --git a/lib/sisu/v3/harvest_topics.rb b/lib/sisu/v5/harvest_topics.rb index 59ba4c06..7375e191 100644 --- a/lib/sisu/v3/harvest_topics.rb +++ b/lib/sisu/v5/harvest_topics.rb @@ -52,7 +52,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/harvest_topics.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/harvest_topics.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -71,7 +71,6 @@ module SiSU_HarvestTopics @file_list=opt.files end def songsheet - puts 'topics:' idx_array={} @opt.f_pths.each do |y| lang_hash_file_array={} @@ -451,11 +450,11 @@ module SiSU_HarvestTopics def initialize(opt,the_idx) @opt,@the_idx=opt,the_idx @env=SiSU_Env::InfoEnv.new - @rc=SiSU_Env::GetInit.instance.sisu_yaml.rc + @rc=SiSU_Env::GetInit.new.sisu_yaml.rc @alphabet_list=%W[9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z] @alph=@alphabet_list.dup @letter=@alph.shift - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new end def html_file_open @the_idx.keys.each do |lng| @@ -473,7 +472,8 @@ module SiSU_HarvestTopics file="#{harvest_pth}/topics.#{lng}.html" end FileUtils::mkdir_p(harvest_pth) unless FileTest.directory?(harvest_pth) - puts "file://#{file}" + fileinfo=(@opt.cmd =~/[vVM]/) ? ("file://#{file}") : '' + SiSU_Screen::Ansi.new(@opt.cmd,"harvest topics(#{@opt.files.length} files)",fileinfo).dark_grey_title_hi unless @opt.cmd =~/q/ @output[lng][:html]=File.new(file,'w') if @opt.cmd.inspect =~/[M]/ @output[lng][:html_mnt]=File.new("#{@env.path.pwd}/topics.html",'w') @@ -610,6 +610,19 @@ module SiSU_HarvestTopics harvest_languages += %{<a href="#{file}">#{l}</a> } end sv=SiSU_Env::InfoVersion.instance.get_version + if @env.output_dir_structure.by? == :language + home_pth='../..' + output_structure_by='(output organised by language & filetype)' + elsif @env.output_dir_structure.by? == :filetype + home_pth='..' + output_structure_by='(output organised by filetype)' + elsif @env.output_dir_structure.by? == :filename + home_pth='.' + output_structure_by='(output organised by filename)' + else + home_pth='.' + output_structure_by='(output organised by ?)' + end <<WOK <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> @@ -628,8 +641,8 @@ module SiSU_HarvestTopics <a name="top" id="top"></a> <a name="up" id="up"></a> <a name="start" id="start"></a> -<h1>SiSU Metadata Harvest - Topics</h1> -<p>[<a href="../index.html"> HOME </a>] also see <a href="#{authors}">SiSU Metadata Harvest - Authors</a></p> +<h1>SiSU Metadata Harvest - Topics #{output_structure_by}</h1> +<p>[<a href="#{home_pth}/index.html"> HOME </a>] also see <a href="#{authors}">SiSU Metadata Harvest - Authors</a></p> <p>#{@env.widget_static.search_form}</p> <hr /> <p class="tiny">#{harvest_languages}</p> diff --git a/lib/sisu/v3/help.rb b/lib/sisu/v5/help.rb index f31e71d1..b73cd138 100644 --- a/lib/sisu/v3/help.rb +++ b/lib/sisu/v5/help.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/help.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/help.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -67,7 +67,8 @@ module SiSU_Help require_relative 'i18n' # i18n.rb def initialize(request='',color='') @request,@color=request,color - @cX=(color =~/color_off/) \ + @cX=((color =~/color_off/) \ + || (defined? color.act && color.act[:color_state][:set]==:off)) \ ? (SiSU_Screen::Ansi.new('k').cX) : (SiSU_Screen::Ansi.new('yes').cX) fns='help_example_dummy_file_name.sst' @@ -162,7 +163,7 @@ module SiSU_Help end end def summary - print <<WOK + print <<-WOK SiSU, Copyright (C) 1997 - 2013 Ralph Amissah License GPL version 3 or Later. This program comes with ABSOLUTELY NO WARRANTY; This is free software, and you are welcome to redistribute it under the conditions of the GPL3 or later. @@ -196,11 +197,10 @@ alternatively typing #{@cX.orange}sisu --help#{@cX.off} #{@cX.green}[keyword]#{@ #{@cX.green}license#{@cX.off} sisu --help license for help type 'sisu --help', 'sisu --help [help request]', 'man sisu', (or see the system or online documentation) -WOK - # #{@cX.cyan}sisu_convert#{@cX.off} program for initial (very basic and partial) conversion to sisu file format (html and word97 supported) + WOK end def abstract - print <<WOK + print <<-WOK Features: #{@cX.cyan}(i)#{@cX.off} minimal markup requirement #{@cX.cyan}(ii)#{@cX.off} single file marked up for multiple outputs @@ -228,27 +228,18 @@ SiSU was developed in relation to legal documents, and so is strong across a wid There is more detailed information available on it from: #{@cX.blue}http://www.jus.uio.no/sisu#{@cX.off} * plaintext - * html + * HTML + * ODT (Open Document Format text) + * EPUB * XML (structured) - * LaTeX/pdf - * texinfo - * sql (at present postgresql & sqlite) - -A couple of sample inputs and outputs: - -The markup for "War and Peace" (chosen because it is a large text & to test the use of SiSU on Project Gutenberg's plaintext), this is the markup, very little after the headers (there is an insert of their legal notices). Took no time at all, it is a particularly simple text to markup though -A simple document and a more demanding document - #{@cX.blue}http://www.jus.uio.no/sisu/sample/war.and.peace.leo.tolstoy.er20 http://www.jus.uio.no/sisu/sample/autonomy.markup1.er30#{@cX.off} -Some resulting outputs: - html #{@cX.blue}http://www.jus.uio.no/sisu/war.and.peace.leo.tolstoy/ http://www.jus.uio.no/sisu/autonomy.markup1/#{@cX.off} - #{@cX.blue}http://www.jus.uio.no/sisu/autonomy.markup1/doc#{@cX.off} - pdf #{@cX.blue}http://www.jus.uio.no/sisu/war.and.peace.leo.tolstoy/portrait http://www.jus.uio.no/sisu/autonomy.markup1/portrait - #{@cX.blue}http://www.jus.uio.no/sisu/war.and.peace.leo.tolstoy/landscape http://www.jus.uio.no/sisu/autonomy.markup1/landscape#{@cX.off} - plaintext #{@cX.blue}http://www.jus.uio.no/sisu/war.and.peace.leo.tolstoy/doc.txt http://www.jus.uio.no/sisu/autonomy.markup1/doc.txt#{@cX.off} -WOK + * LaTeX + * PDF (via LaTeX) + * TeXinfo + * SQL (at postgreSQL & SQLite) + WOK end def commands - print <<WOK + print <<-WOK #{@cX.ruby}-a#{@cX.off} #{@cX.green}[filename/wildcard]#{@cX.off} produces plaintext with Unix linefeeds. Without markup, (object numbers are omitted), has footnotes at end of each para‐ graph that contains them. Modifier options available: --footnotes (default) or --endnotes and for linefeeds --unix (default) or --msdos @@ -337,11 +328,11 @@ WOK #{@cX.ruby}-D#{@cX.off} #{@cX.ruby}--recreate#{@cX.off} kills data" and drops (postgresql or sqlite) db, tables & indexes, then creates an empty db with tables and indexes [#{@cX.ruby}-d --recreate#{@cX.off} sqlite equivalent] also see command #{@cX.green}shortcuts#{@cX.off}, and shorthand mappings for multiple flags -WOK + WOK end def shortcuts cf_defaults=SiSU_Env::InfoProcessingFlag.new - print <<WOK + print <<-WOK #{@cX.ruby}Shorthand for multiple flags#{@cX.off} @@ -362,11 +353,10 @@ WOK defaults may be changed in active sisurc.yml file under 'flag:' add -v for verbose mode and -c (color toggle), e.g. - sisu -2vc [filename or wildcard] -WOK + WOK end def modifiers - print <<WOK + print <<-WOK #{@cX.ruby}Command flag modifiers#{@cX.off} @@ -378,10 +368,10 @@ WOK #{@cX.ruby}--no-dagger#{@cX.off} strips output text of editor endnotes~[+ square brackets ]~ denoted by dagger/plus sign -WOK + WOK end def misc - <<WOK + <<-WOK #{@cX.cyan}misc#{@cX.off} #{@cX.green}-s#{@cX.off} [filename or wildcard] #{@cX.green}spellcheck#{@cX.off} (aspell previously ispell \t#{@cX.green}mailer examples#{@cX.off} @@ -393,15 +383,15 @@ WOK #{@cX.blue}-R #{@cX.off} (yaml|rss) extraction of semantic data into yaml file for auto build of xml feeds (rss, rdf) #{@cX.fuschia}[work area]#{@cX.off} #{@cX.green}-R #{@cX.off} yaml extraction of semantic data into yaml file for auto build of xml feeds (rss, rdf) #{@cX.green}-R #{@cX.off} rss creates rss2.0 feed -WOK + WOK end def markup - print <<WOK + print <<-WOK sisu Note: files for SiSU should be in UTF-8 character encoding. #{@cX.cyan}Data text markup#{@cX.off} (alternative to available html subset) - #{@cX.green}% SiSU 2.00#{@cX.off} [statement on first line of document, declared file-type identifier, SiSU markup document, markup used is version 0.38] + #{@cX.green}% SiSU 4.00#{@cX.off} [statement on first line of document, declared file-type identifier, SiSU markup document #{@cX.green}A~#{@cX.off} heading/title [levels A to C available (and beneath that 1 to 6)] @@ -518,16 +508,14 @@ sisu general text markup: headings; endnotes; tables (which also includes a note on preformatted text) configuration and customisation document or site wide customisation: customise; skin -WOK + WOK help_markup -# {../_sisu/image/tux.png http://www.jus.uio.no/sisu/ w=64 c=\"a better way\" }:image depreciated image eg -# <!image http://www.jus.uio.no/sisu/ ../_sisu/image/tux.png width=\"64\" height=\"80\" !> old form end def example help_markup end def example_v1 - print <<WOK + print <<-WOK % SiSU 1.0 @title: Working Sample Document @@ -567,11 +555,11 @@ _1 for a listing type: sisu ~ commands _1 for an outline of sisu markup type: sisu ~ markup The example ends here. -WOK + WOK help_markup end def example_v2 - print <<WOK + print <<-WOK % SiSU 2.0 @title: Working Sample Document @@ -615,11 +603,11 @@ _1 for a listing type: sisu ~ commands _1 for an outline of sisu markup type: sisu ~ markup The example ends here. -WOK + WOK help_markup end def headers - print <<WOK + print <<-WOK Header tags appear at the beginning of a document and provide meta information on the document (such as the Dublin Core), or information as to how the document as a whole is to be processed. All header instructions take either the form #{@cX.green}@headername:#{@cX.off} followed on the next line by an indented sub-category header if any #{@cX.green}:sub-headername:#{@cX.off}. #{@cX.green}@indentifier:#{@cX.off} information or instructions @@ -652,12 +640,10 @@ where the #{@cX.green}"identifier"#{@cX.off} is a tag recognised by the program, #{@cX.cyan}:topic_register:#{@cX.off} [e.g.:] text markup language; application:text processing;output:html|xml|latex|pdf|sql #{@cX.cyan}:subject:#{@cX.off} (whatever your subject) #{@cX.cyan}:keywords:#{@cX.off} - #{@cX.cyan}:coverage:#{@cX.off} - #{@cX.cyan}:relation:#{@cX.off} - #{@cX.cyan}:type:#{@cX.off} - #{@cX.cyan}:identifier:#{@cX.off} #{@cX.cyan}:loc:#{@cX.off} [Library of Congress classification] #{@cX.cyan}:dewey:#{@cX.off} [Dewey classification] + +#{@cX.ruby}@identifier:#{@cX.off} #{@cX.cyan}:isbn:#{@cX.off} #{@cX.cyan}:oclc:#{@cX.off} @@ -665,7 +651,12 @@ where the #{@cX.green}"identifier"#{@cX.off} is a tag recognised by the program, #{@cX.cyan}:description:#{@cX.off} #{@cX.cyan}:abstract:#{@cX.off} #{@cX.cyan}:comment:#{@cX.off} + #{@cX.cyan}:coverage:#{@cX.off} + #{@cX.cyan}:relation:#{@cX.off} + #{@cX.cyan}:source:#{@cX.off} #{@cX.cyan}:history:#{@cX.off} + #{@cX.cyan}:type:#{@cX.off} + #{@cX.cyan}:format:#{@cX.off} #{@cX.cyan}:prefix:#{@cX.off} #{@cX.cyan}:suffix:#{@cX.off} @@ -684,6 +675,9 @@ original language in which the work was published #{@cX.cyan}:breaks:#{@cX.off} new=:B; break=1 #{@cX.cyan}:bold:#{@cX.off} [regular expression of words/phrases to be made bold] #{@cX.cyan}:italics:#{@cX.off} [regular expression of words/phrases to italize] + #{@cX.cyan}:home_button_image:#{@cX.off} {free_as_in_freedom.png }http://stallman.org/ + #{@cX.cyan}:home_button_text:#{@cX.off} {Free Culture}http://www.free-culture.cc; {Lawrence Lessig}http://www.lessig.org + #{@cX.cyan}:footer:#{@cX.off} {Free Culture}http://www.free-culture.cc; {Lawrence Lessig}http://www.lessig.org #{@cX.cyan}:headings:#{@cX.off} PART; CHAPTER; Section; Article; #{@cX.grey}% optional, document structure can be defined by words to match or regular expression (the regular expression is assumed to start at the beginning of a line of text i.e. ^) default markers A~ to C~ and 1~ to 6~ can be used within text instead, without this header tag, and may be used to supplement the instructions provided in this header tag if provided#{@cX.off} #{@cX.cyan}:papersize:#{@cX.off} (A4|US_letter|book_B5|book_A5|US_legal) @@ -704,11 +698,11 @@ original language in which the work was published #{@cX.blue}3~#{@cX.off} Third level heading preceding substantive text of document, that would normally be marked 1.1.1 or 1.1.2 or 1.2.1 or 2.1.1 etc. in a document -WOK + WOK help_markup end def customise - print <<WOK + print <<-WOK There are a number of files that control the appearance of a site or a document i.e. #{@cX.blue}(i)#{@cX.off} files that control #{@cX.green}site-wide appearance#{@cX.off}: @@ -739,21 +733,21 @@ WOK if you have a body of documents the easiest way to give them a particular appearance/skin, is to associate that directory with a skin, all files in that directory take on the specified appearance, changing appearance of documents once directories are set up is as simple as copying the files from one directory to another (or renaming the directory); or associating the directory with a different skin. see also directories -WOK + WOK end def configure - print <<WOK + print <<-WOK see the following topics install setup and note for initial configuration it is necessary to run: sisu -C (this places the default CSS files and DTDs in place) -WOK + WOK end def path help_env - puts <<WOK + puts <<-WOK If you have problems check permissions (and if in home directory ownership). @@ -795,12 +789,12 @@ If you have problems check permissions (and if in home directory ownership). See also sisu --help directory -WOK + WOK help_env end def directories help_env - print <<WOK + print <<-WOK the directory structure used by sisu is controlled by the configuration files #{@cX.blue}sisurc.yml#{@cX.off} @@ -886,7 +880,7 @@ WOK See also sisu --help path -WOK + WOK help_env end def program_found?(program) @@ -911,7 +905,12 @@ WOK version=SiSU_Env::InfoVersion.instance.get_version rb_ver=SiSU_Env::InfoVersion.instance.rbversion if version[:version] - SiSU_Screen::Ansi.new('-v',version[:project],version[:version],version[:date_stamp],version[:date],rb_ver).version + opt_cmd=if defined? @color.cmd \ + and @color.cmd =~/[ck]/ + @color.cmd + else '-v' + end + SiSU_Screen::Ansi.new(opt_cmd,version[:project],version[:version],version[:date_stamp],version[:date],rb_ver).version else puts 'SiSU version information not available' end end @@ -959,7 +958,7 @@ WOK def environment cf_defaults=SiSU_Env::InfoProcessingFlag.new sisu_version - x =<<WOK + x =<<-WOK #{@cX.green}current and output directories#{@cX.off} user: #{@cX.blue}#{@env.user}#{@cX.off} home: #{@cX.blue}#{@env.path.home}#{@cX.off} @@ -1021,11 +1020,11 @@ WOK (true/false defaults may be changed in active sisurc.yml file under permissions_set:) NOTE: for HELP type 'sisu --help', 'sisu --help [help request]', 'man sisu', (or see the system or online documentation) -WOK -print x + WOK + print x end def dublin_core - print <<WOK + print <<-WOK @title: @subtitle: [is added to title for purposes of Dublin Core description] @@ -1060,10 +1059,10 @@ print x @rights: -WOK + WOK end def headings - print <<WOK + print <<-WOK These are not required, a header is quicker to prepare if a documents structure can be defined by matching words or a regular expression, see headers). @structure: PART; CHAPTER; SECTION; ARTICLE; none; none; @@ -1072,10 +1071,6 @@ structure can be defined by a match words or regular expression (the regular exp The following heading or level (structuring) defaults are available (for use instead of or together with @structure: header): - 1~ 2~ 3~ 4~ 5~ 6~ - -or, [0.38] - A~ B~ C~ 1~ 2~ 3~ Heading tags take either of the forms above, ranging from 1-6 @@ -1088,26 +1083,6 @@ segments (in html output) are by default created on level 4 assigned a file name automatically according to the title number, unless you explicitly specify otherwise) -eg. - -% SiSU 0.16 - 0.37 - -1~ Document Title - -2~ Document Subtitle whatever it is - -3~ Part - -4~ Chapter - -5~ Heading - -6~ sub-heading - -in the 0.38 notation this maps to: - -% SiSU 0.38 - A~ Document Title B~ Document Subtitle whatever it is @@ -1120,8 +1095,6 @@ C~ Part 3~ sub-heading -(a conversion script provided in sisu-examples, modify.rb makes conversion between 0.37 and 0.38 markup simple) - Normal text would follow each heading level as appropriate, though it is most usual to start with ordinary writing beneath level 4 as it is at this level that segments are created. Automatic numbering of paragraphs is usually set to start at level 4 trough level 6 and takes the form 1. then 1.1 then 1.1.1 this being given as a Header tag 0~ There may be up to 6 levels in a document, @@ -1135,13 +1108,13 @@ the words can be used to identify the levels in a header tag: 0~toc Part; Chapter; Section; Article; none; none instead of providing individual heading tags -sisu structure, (0.38) alternative notation, A,B,C,1,2,3 mapping to 1,2,3,4,5,6 +sisu structure, notation, A,B,C,1,2,3 SiSU has in effect two sets of levels to be considered - 1-3 headings/levels, (A-C [0.38]) pre-ordinary paragraphs /pre-substantive text, and + A-C pre-ordinary paragraphs /pre-substantive text, and - 4-6 headings/levels, (1-3 [0.38]) levels which are followed by ordinary text. + 1-3 levels which are followed by ordinary text. This may be conceptualised as levels A,B,C, 1,2,3, and using such letter number notation, in effect: @@ -1153,7 +1126,7 @@ sisu structure, (0.38) alternative notation, A,B,C,1,2,3 mapping to 1,2,3,4,5,6 on the positive side: (a) the A,B,C,1,2,3 alternative makes explicit an aspect of structuring documents in SiSU that is not otherwise obvious to the newcomer (though it appears more complicated, is more in your face and likely to be understood fairly quickly); (b) the substantive text follows levels 1,2,3 and it is 'nice' to do most work in those levels -WOK + WOK end def languages lang=SiSU_i18n::Languages.new.language.table @@ -1164,7 +1137,7 @@ WOK puts "#{lng[:c]}: #{lng[:t]} (#{lng[:n]})" end end - puts <<WOK + puts <<-WOK Multi-language Document File Naming and Directory Mapping @@ -1200,10 +1173,10 @@ WOK Selecting this form of filename will overide other language settings including the language header within a document. -WOK + WOK end def endnotes - print <<WOK + print <<-WOK (1) Footnote/endnotes tags take a number of possible forms, the simplest being to embed an endnote within your text~{ this would appear as an endnote, and would have an automatically assigned number }~ Embedded endnotes~{this is an endnote}~ and at the end of the paragraph~{* an asterisk marked note }~ writing the endnote:~{another endnote}~ @@ -1216,10 +1189,10 @@ WOK ^~ another endnote -WOK + WOK end def tables - print <<WOK + print <<-WOK #{@cX.green}table{ [number of columns] [column width %];[column width %]#{@cX.off} @@ -1276,17 +1249,17 @@ preformatted text #{@cX.green}}code#{@cX.off} -WOK + WOK end def modules - print <<WOK + print <<-WOK #{@cX.ruby}IGNORE#{@cX.off} -WOK + WOK end def install #% system configuration - print <<WOK + print <<-WOK #{@cX.green}Install SiSU#{@cX.off} Presumably if you are reading this interactively you have a copy of SiSU already installed, nevertheless here are a few notes. @@ -1343,10 +1316,10 @@ WOK sisu --help -WOK + WOK end def setup - print <<WOK + print <<-WOK #{@cX.green}configuration files#{@cX.off} sisurc.yml used: @@ -1367,10 +1340,10 @@ WOK #{@cX.blue}man 8 sisu#{@cX.off} and #{@cX.blue}http://www.jus.uio.no/sisu/SiSU#{@cX.off} -WOK + WOK end def termsheet - print <<WOK + print <<-WOK #{@cX.green}sisu --termsheet [termsheetname].termsheet.rb#{@cX.off} will produce the collection of documents associated with [termsheetname.termsheet.rb] @@ -1399,29 +1372,29 @@ WOK it is necessary to purge the directory ~facilityData when old files are removed -WOK + WOK end def help_commands - print <<WOK + print <<-WOK also see: sisu --help commands man sisu -WOK + WOK end def help_env - print <<WOK + print <<-WOK for sisu environment information see: sisu --help env -WOK + WOK end def help_general help_env help_commands end def help_markup - print <<WOK + print <<-WOK for help with sisu markup see: sisu --help markup @@ -1433,8 +1406,6 @@ WOK for brief descriptive summary of markup history sisu --query-history - or if for a particular version - sisu --query-0.38 for markup: sisu --help example @@ -1443,19 +1414,14 @@ WOK #{@cX.green}/usr/share/doc/sisu/markup-samples#{@cX.off} and online #{@cX.green}www.jus.uio.no/sisu#{@cX.off} -WOK + WOK end def convert - print <<WOK + print <<-WOK for information on the markup version used within a sisu markup file: sisu --inspect [filename] - to convert between sst markup versions 0.37 and 0.38: - sisu --to-current - sisu --to-38 [filename/wildcard] - sisu --to-37 [filename/wildcard] - convert an sst file with footnotes following text to (preferred) inline footnotes sisu --convert-footnotes [filename/wildcard] @@ -1476,50 +1442,50 @@ WOK to attempt to convert a kdissert (.kdi) file to sisu markup: sisu --from-kdi [kdissert filename] (very basic and experimental) -WOK + WOK end def dal - print <<WOK + print <<-WOK sisu --dal [filename/wildcard] creates the metaverse, used by all other modules for downstream processing sisu -m [filename/wildcard] creates the metaverse, used by all other modules for downstream processing -WOK + WOK help_commands end def utf8 - print <<WOK + print <<-WOK documents prepared for sisu processing should be stored in utf8 -WOK + WOK end def plaintext - print <<WOK + print <<-WOK sisu --txt [filename/wildcard] plaintext with Unix linefeeds (footnotes follow paragraphs) sisu -t [filename/wildcard] plaintext with Unix linefeeds (footnotes follow paragraphs) -WOK + WOK help_commands end def html - print <<WOK + print <<-WOK sisu --html [filename/wildcard] html document type suffixes included sisu -h [filename/wildcard] html document type suffixes included -WOK + WOK help_commands end def xhtml - print <<WOK + print <<-WOK sisu --xhtml [filename/wildcard] xhtml document sisu -b [filename/wildcard] xhtml document -WOK + WOK help_commands end def xml - print <<WOK + print <<-WOK sisu --xml-sax [filename/wildcard] xml document (sax type parsing) sisu -x [filename/wildcard] xml document (sax type parsing) @@ -1532,52 +1498,52 @@ WOK sisu --epub [filename/wildcard] odt document, (epub document) sisu -e [filename/wildcard] odt document, (epub document) -WOK + WOK help_commands end def odf - print <<WOK + print <<-WOK sisu --odt [filename/wildcard] odt document, (odf open document format) sisu -o [filename/wildcard] odt document, (odf open document format) -WOK + WOK help_commands end def epub - print <<WOK + print <<-WOK sisu --epub [filename/wildcard] epub document, (open format for e-books) sisu -e [filename/wildcard] epub document, (open format for e-books) -WOK + WOK help_commands end def php - print <<WOK + print <<-WOK not supported [php output has been removed] -WOK + WOK help_commands end def pdf - print <<WOK + print <<-WOK sisu --pdf [filename/wildcard] produces pdf files from LaTeX output sisu -p [filename/wildcard] produces pdf files from LaTeX output -WOK + WOK help_commands end def latex - print <<WOK + print <<-WOK sisu --pdf [filename/wildcard] produces pdf files from LaTeX output sisu -p [filename/wildcard] produces pdf files from LaTeX output -WOK + WOK help_commands end def texinfo - print <<WOK + print <<-WOK sisu --texinfo [filename] produces texinfo and info files sisu -I [filename] produces texinfo and info files @@ -1591,29 +1557,29 @@ WOK and then to point at the file using pinfo ./[filename] -WOK + WOK help_commands end def lout - print <<WOK + print <<-WOK sisu -l [filename/wildcard] not currently supported, revisit someday? -WOK + WOK help_commands end def concordance - print <<WOK + print <<-WOK sisu --concordance starts the sisu webrick server, default port 8081 sisu --wordmap starts the sisu webrick server, default port 8081 sisu -W starts the sisu webrick server, default port 8081 -WOK + WOK help_commands end def help_search - print <<WOK + print <<-WOK SiSU searches, depending on how you wish to implement search, @@ -1622,10 +1588,10 @@ WOK sisu --help searchform (or 'sisu --help cgi') sisu --help hyperestraier (or 'sisu --help est') sisu --help webrick -WOK + WOK end def cgi - print <<WOK + print <<-WOK sisu --sample-search-form generates a sample search form sisu -F generates a sample search form @@ -1635,12 +1601,12 @@ WOK sisu -W starts the webrick server the generated search form must be copied to the webserver directory as instructed -WOK + WOK help_search help_general end def sql - print <<WOK + print <<-WOK Mappings to two databases are provided by default, postgresql (--pg or -D) and sqlite (--sqlite or -d), @@ -1671,21 +1637,21 @@ WOK By default, [unless otherwise specified] databases are built on a directory basis, from collections of documents within that directory. The name of the directory you choose to work from is used as the database name, i.e. if you are working in a directory called #{@cX.blue}#{@env.path.home}/ebook#{@cX.off} the database #{@cX.blue}#{Db[:name_prefix]}ebook#{@cX.off} is used. [otherwise a manual mapping for the collection is necessary] -WOK + WOK help_search help_general end def webrick - print <<WOK + print <<-WOK sisu --webrick starts the sisu webrick server, default port 8081 sisu -W starts the sisu webrick server, default port 8081 -WOK + WOK help_commands end def hyperestraier out_dir='(' + `ls #{@env.path.webserv}`.split("\n").join('|') + ')' - print <<WOK + print <<-WOK Not tested recently, not up-to-date NOTE: The examples that follow assume that sisu output is placed in the directory @@ -1742,10 +1708,10 @@ WOK and try open the url: #{@cX.blue} #{@env.url.webserv_host_base}/cgi-bin/estseek.cgi #{@cX.off} -WOK + WOK end def yaml - print <<WOK + print <<-WOK Yaml sisurc files may be used to configure sisu, these are searched for in the following locations: under the current SiSU markup data directory: #{@cX.blue}#{Dir.pwd}/_sisu/sisurc.yml#{@cX.off} @@ -1760,10 +1726,10 @@ WOK these may be called by the sisurc.yml, skins for document, directory or site, or from individual document headers in the header @@promo: [a commented out example header may be found in document sample: free_as_in_freedom.richard_stallman_cru‐ sade_for_free_software.sam_williams.sst, it calls for the specified lists in list.yml, which in turn calls the widgets named in promo.yml which are used to build content in the right pane of html output] -WOK + WOK end def sitemap - print <<WOK + print <<-WOK SiSU sitemaps, an experimental feature (following g,y,m announcement to use them this week) @@ -1773,11 +1739,11 @@ WOK to generate/update the index of sitemaps sisu --sitemaps -WOK + WOK end def license - print <<WOK + print <<-WOK * License: GPL 3 or later: @@ -1802,7 +1768,6 @@ WOK available at these locations: <#{@cX.blue}http://www.fsf.org/licenses/gpl.html#{@cX.off}> <#{@cX.blue}http://www.gnu.org/licenses/gpl.html#{@cX.off}> - <#{@cX.blue}http://www.jus.uio.no/sisu/gpl.fsf#{@cX.off}> * SiSU uses: * Standard SiSU markup syntax, @@ -1810,20 +1775,21 @@ WOK * Standard SiSU object citation numbering and system * Hompages: - <#{@cX.blue}http://www.jus.uio.no/sisu#{@cX.off}> <#{@cX.blue}http://www.sisudoc.org#{@cX.off}> + <#{@cX.blue}http://www.jus.uio.no/sisu#{@cX.off}> * Download: - <#{@cX.blue}http://www.jus.uio.no/sisu/SiSU/download.html#{@cX.off}> + <#{@cX.blue}http://sources.sisudoc.org#{@cX.off}> + <#{@cX.blue}http://www.jus.uio.no/sisu/en/html/SiSU/download.html#{@cX.off}> Ralph Amissah <#{@cX.blue}ralph@amissah.com#{@cX.off}> <#{@cX.blue}ralph.amissah@gmail.com#{@cX.off}> -WOK + WOK end def standards - print <<WOK + print <<-WOK * SiSU uses: * Standard SiSU markup syntax, @@ -1834,7 +1800,7 @@ Copyright (C) Ralph Amissah 1997, current 2013. All Rights Reserved. Information on these may be obtained from: - http://www.jus.uio.no/sisu + <#{@cX.blue}http://sisudoc.org#{@cX.off}> More information to be provided later. @@ -1843,10 +1809,10 @@ More information to be provided later. * Ralph Amissah ralph@amissah.com Ralph Amissah ralph.amissah@gmail.com -WOK + WOK end def conversion - print <<WOK + print <<-WOK sisu_convert does the initial conversion from a couple of file formats to SiSU file format, currently only html and word97 #{@cX.cyan}sisu_convert#{@cX.off} [keyword] sisu [keyword] @@ -1854,10 +1820,10 @@ sisu_convert does the initial conversion from a couple of file formats to SiSU f ------------------------------------------ Preparing Documents for SiSU #{@cX.green}--word97#{@cX.off} sisu --help markup (an incomplete overview) -WOK + WOK end def external_programs - puts <<WOK + puts <<-WOK external ruby programs @@ -1877,10 +1843,10 @@ WOK #{@cX.brown}suggested/recommended#{@cX.off} tidy (xml, xhtml well formed check) trang (relaxng, rnc to dtd conversion) -WOK + WOK end def scratch - print <<WOK + print <<-WOK Types of tag, then there are various tags which occur within the document. @@ -1907,7 +1873,7 @@ This makes citation a lot easier... regardless of the form of output that is bei It also permits the building of various addons, like the concordance feature which identifies each word and the paragraphs in which the word appears with links to the paragraph... Urls are automatically turned to live links in the html and pdf files created... -WOK + WOK end end end diff --git a/lib/sisu/v3/html.rb b/lib/sisu/v5/html.rb index 340b81e9..d3122670 100644 --- a/lib/sisu/v3/html.rb +++ b/lib/sisu/v5/html.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/html.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/html.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -93,29 +93,37 @@ module SiSU_HTML @fnb=@md.fnb @env=@particulars.env loc=@env.url.output_tell + primary_output_file=(@opt.act[:html_seg][:set]==:on) \ + ? (@md.file.output_path.html_seg.dir + '/' + @md.file.base_filename.html_segtoc) + : (@md.file.output_path.html_scroll.dir + '/' + @md.file.base_filename.html_scroll) unless @opt.cmd =~/q/ tool=(@opt.cmd =~/[MVvz]/) \ - ? ("#{@env.program.web_browser} file://#{@md.file.output_path.html_seg.dir}/#{@md.file.base_filename.html_segtoc}") + ? ("#{@env.program.web_browser} file://#{primary_output_file}") : ("[#{@opt.f_pth[:lng_is]}] #{@opt.fno}") @opt.cmd=~/[MVvz]/ \ ? SiSU_Screen::Ansi.new(@opt.cmd,'HTML',tool).green_hi_blue : SiSU_Screen::Ansi.new(@opt.cmd,'HTML',tool).green_title_hi - SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"file://#{@md.file.output_path.html_seg.dir}/#{@md.file.base_filename.html_segtoc}").flow if @opt.cmd =~/[MV]/ + SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"file://#{primary_output_file}").flow if @opt.cmd =~/[MV]/ end - SiSU_Env::InfoSkin.new(@md).select data=nil tuned_file_array=SiSU_HTML::Source::HTML_Environment.new(@particulars).tuned_file_instructions data=tuned_file_array - scr_endnotes=SiSU_HTML::Source::Endnotes.new(data,@md).scroll + if @opt.act[:html_scroll][:set]==:on + scr_endnotes=SiSU_HTML::Source::Endnotes.new(data,@md).scroll + end toc=SiSU_HTML::Source::Toc.new(@md,data).songsheet links_guide=SiSU_HTML::Source::LinksGuide.new(data,@md).toc data=tuned_file_array scr_toc=SiSU_HTML::Source::ScrollHeadAndSegToc.new(@md,toc,links_guide).in_common #watch - SiSU_HTML::Source::Seg.new(@md,data).songsheet + if @opt.act[:html_seg][:set]==:on + SiSU_HTML::Source::Seg.new(@md,data).songsheet + end data=tuned_file_array - scr=SiSU_HTML::Source::Scroll.new(@md,data,scr_endnotes).songsheet - scroll=SiSU_HTML::Source::ScrollOutput.new(scr_toc,scr[:body],scr[:metadata],scr[:owner_details],scr[:tails],@md).publish - SiSU_HTML::Source::Output.new(scroll,@md).scroll + if @opt.act[:html_scroll][:set]==:on + scr=SiSU_HTML::Source::Scroll.new(@md,data,scr_endnotes).songsheet + scroll=SiSU_HTML::Source::ScrollOutput.new(scr_toc,scr[:body],scr[:metadata],scr[:owner_details],scr[:tails],@md).publish + SiSU_HTML::Source::Output.new(scroll,@md).scroll + end rescue SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do __LINE__.to_s + ':' + __FILE__ @@ -142,7 +150,7 @@ module SiSU_HTML def initialize(particulars) @particulars=particulars @md,@env=particulars.md,particulars.env - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new @env,@css=particulars.env,SiSU_Style::CSS.new end def tuned_file_instructions @@ -224,7 +232,7 @@ module SiSU_HTML @@firstseg=nil def initialize(md=nil,data='') @data,@md=data,md - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new @tell=SiSU_Screen::Ansi.new(@md.opt.cmd) if @md end def songsheet #extracts toc for scroll & seg @@ -516,7 +524,7 @@ WOK class ScrollHeadAndSegToc < Toc def initialize(md='',toc='',links_guide_toc='') @md,@toc,@links_guide_toc=md,toc,links_guide_toc - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new @make=SiSU_Env::ProcessingSettings.new(@md) end def in_common @@ -594,7 +602,9 @@ WOK ads=SiSU_HTML_Promo::Ad.new(@md) @segtoc << format_head_toc.seg_navigation_tail << ads.div.close << ads.display << format_head_toc.html_close @segtoc=@segtoc.flatten.compact #watch - SiSU_HTML::Source::Output.new(@segtoc,@md).segtoc + if @md.opt.act[:html_seg][:set]==:on + SiSU_HTML::Source::Output.new(@segtoc,@md).segtoc + end @segtoc=[] @toc[:scr],@toc[:seg]=[],[] toc_shared @@ -623,54 +633,58 @@ WOK @o_str ||=SiSU_Env::ProcessingSettings.new(md).output_dir_structure end def scroll - begin - @filename_html_scroll=@file.write_file.html_scroll - @data.each do |para| - para=para.strip. - gsub(/<:.+?>/,''). - gsub(Xx[:html_relative2],@file.path_rel_links.html_scroll_2). - gsub(Xx[:html_relative1],@file.path_rel_links.html_scroll_1). - #gsub(/#{Xx[:html_relative]}/,@file.path_rel_links.html_scroll). - gsub(/#{Rx[:mx_fa_clean]}/,'') - unless para =~/\A\s*\Z/ - @filename_html_scroll.puts para,"\n" + if @md.opt.act[:html_scroll][:set]==:on + begin + @filename_html_scroll=@file.write_file.html_scroll + @data.each do |para| + para=para.strip. + gsub(/<:.+?>/,''). + gsub(Xx[:html_relative2],@file.path_rel_links.html_scroll_2). + gsub(Xx[:html_relative1],@file.path_rel_links.html_scroll_1). + #gsub(/#{Xx[:html_relative]}/,@file.path_rel_links.html_scroll). + gsub(/#{Rx[:mx_fa_clean]}/,'') + unless para =~/\A\s*\Z/ + @filename_html_scroll.puts para,"\n" + end end + rescue + SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do + __LINE__.to_s + ':' + __FILE__ + end + ensure + @filename_html_scroll.close end - rescue - SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do - __LINE__.to_s + ':' + __FILE__ - end - ensure - @filename_html_scroll.close end end def segtoc - begin - @filename_html_segtoc=@file.write_file.html_segtoc - @data.each do |para| - para=para.strip. - gsub(/<!.+?!>/,''). - gsub(Xx[:html_relative2],@file.path_rel_links.html_seg_2). - gsub(Xx[:html_relative1],@file.path_rel_links.html_seg_1) - unless para =~/\A\s*\Z/ - @filename_html_segtoc.puts para,"\n" + if @md.opt.act[:html_seg][:set]==:on + begin + @filename_html_segtoc=@file.write_file.html_segtoc + @data.each do |para| + para=para.strip. + gsub(/<!.+?!>/,''). + gsub(Xx[:html_relative2],@file.path_rel_links.html_seg_2). + gsub(Xx[:html_relative1],@file.path_rel_links.html_seg_1) + unless para =~/\A\s*\Z/ + @filename_html_segtoc.puts para,"\n" + end end + rescue + SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do + __LINE__.to_s + ':' + __FILE__ + end + ensure + @filename_html_segtoc.close + pwd_set=Dir.pwd + idx_lnk=(@o_str.dump_or_redirect?) \ + ? @file.base_filename.manifest + : @file.base_filename.html_segtoc + mlnk=@file.base_filename.html_seg_index + Dir.chdir(@file.output_path.html_seg.dir) + FileUtils::rm_f(mlnk) + FileUtils::ln_s(idx_lnk,mlnk) + Dir.chdir(pwd_set) end - rescue - SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do - __LINE__.to_s + ':' + __FILE__ - end - ensure - @filename_html_segtoc.close - pwd_set=Dir.pwd - idx_lnk=(@o_str.dump_or_redirect?) \ - ? @file.base_filename.manifest - : @file.base_filename.html_segtoc - mlnk=@file.base_filename.html_seg_index - Dir.chdir(@file.output_path.html_seg.dir) - FileUtils::rm_f(mlnk) - FileUtils::ln_s(idx_lnk,mlnk) - Dir.chdir(pwd_set) end end end diff --git a/lib/sisu/v3/html_format.rb b/lib/sisu/v5/html_format.rb index da67a296..3c8bc465 100644 --- a/lib/sisu/v3/html_format.rb +++ b/lib/sisu/v5/html_format.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/html_format.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/html_format.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -67,30 +67,28 @@ module SiSU_HTML_Format @ocn ||='' end def ocn_display - @make=SiSU_Env::ProcessingSettings.new(@md) - if @make.build.ocn? + make=SiSU_Env::ProcessingSettings.new(@md) + if make.build.ocn? ocn_class='ocn' - if @ocn.to_i==0 - @ocn.gsub(/^(\d+|)$/, - %{<label class="#{ocn_class}"><a name="#{@ocn}"> </a></label>}) + if @ocn.to_i==0 \ + or @ocn.empty? + %{<label class="ocn_off"> </label>} else @ocn.gsub(/^(\d+|)$/, %{<label class="#{ocn_class}"><a name="#{@ocn}" href="##{@ocn}" class="lnk#{ocn_class}">\\1</a></label>}) end else - ocn_class='ocn_off' - @ocn.gsub(/^(\d+|)$/, - %{<label class="#{ocn_class}"> </label>}) + %{<label class="ocn_off"> </label>} end end def name - %{<a name="#{@ocn}"></a>} + (@ocn==nil || @ocn.empty?) ? '' : %{<a name="#{@ocn}"></a>} end def id #w3c? "tidy" complains about numbers as identifiers ! annoying - %{id="o#{@ocn}"} + (@ocn==nil || @ocn.empty?) ? '' : %{id="o#{@ocn}"} end def goto - %{<a href="##{@ocn}">} + (@ocn==nil || @ocn.empty?) ? '' : %{<a href="##{@ocn}">} end end class HeadInformation @@ -101,15 +99,14 @@ module SiSU_HTML_Format def initialize(md) @md=md # DublinCore 1 - title - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.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 || []) - @metalink='#metadata' @tocband_scroll,@tocband_segtoc=nil,nil @stylesheet=SiSU_Style::CSS_HeadInfo.new(md).stylesheet @o_str ||=SiSU_Env::ProcessingSettings.new(md).output_dir_structure - @index='index' - @toc="#{@md.file.output_path.html_seg.dir}/#{@md.file.base_filename.html_segtoc}" + @index,@metalink='index','#metadata' + @toc=@md.file.base_filename.html_segtoc end def url_path_image_sys (@o_str.dump_or_redirect?) \ @@ -158,14 +155,13 @@ module SiSU_HTML_Format end self end - def doc_types #used in toc & seg_nav_band - scroll=seg='' + def doc_types(page=:seg) #used in toc & seg_nav_band wgt=SiSU_HTML_Format::Widget.new(@md) %{ <table summary="segment navigation available documents types: toc,doc,pdf,concordance" border="0" cellpadding="3" cellspacing="0"> <tr> <td align="center" bgcolor=#{@vz.color_band2}> - #{wgt.manifest} + #{wgt.manifest(page)} #{wgt.search} </tr></table>} end @@ -181,16 +177,25 @@ module SiSU_HTML_Format %{ </font> #{@vz.table_close}} end - def buttons_home - %{<!- home and index buttons -!> - #{@vz.banner_home_and_index_buttons} -<!- home and index buttons -!>} - end - def copyat - %{#{@vz.paragraph_font_tiny}copy @ - <a href="#{@vz.url_home}"> - #{@vz.txt_home} - </a></h1>} + def button_home(page=:seg) + button=%{ <table summary="home button / home information" border="0" cellpadding="3" cellspacing="0">\n <tr><td align="left" bgcolor="#ffffff">\n} + if @md.make.home_button_image.is_a?(Hash) + image_path=if page==:manifest + @md.file.output_path.manifest.rel_image + elsif page==:scroll + @md.file.output_path.html_scroll.rel_image + else + @md.file.output_path.html_seg.rel_image + end + dir=SiSU_Env::FileOp.new(@md) + button +=%{ <p class="tiny_left"><a href="#{@md.make.home_button_image[:link]}" target="_top"><img border="0" src="#{image_path}/#{@md.make.home_button_image[:home_button]}" width="#{@md.make.home_button_image[:w]}" height="#{@md.make.home_button_image[:h]}" alt="home icon -->" /></a></p>\n} + elsif @md.home_button_links.is_a?(Array) + @md.home_button_links.each do |links| + button +=%{ <p class="tiny_left"><a href="#{links[:url]}/" target="_top">\n #{links[:say]}\n </a></p>\n} + end + end + button +=%{ </td></tr>\n </table>} + button end def html_close #moved %{</body> @@ -239,7 +244,7 @@ module SiSU_HTML_Format else '' end end - def manifest + def manifest(page=:seg) if @make.build.links_to_manifest? \ and not @o_str.dump_or_redirect? manifest_lnk=if @file.output_dir_structure.by_language_code? \ @@ -247,11 +252,21 @@ module SiSU_HTML_Format "#{Xx[:html_relative1]}manifest/#{@file.base_filename.manifest}" else @file.base_filename.manifest end - %{<td align="center" bgcolor=#{@vz.color_band2}> + if page==:manifest + manifest_lnk="#{@md.file.output_path.manifest.url}/#{@file.base_filename.manifest}" + brace_url=SiSU_Viz::Defaults.new.url_decoration + %{<td align="center" bgcolor=#{@vz.color_band2}> + <font face="#{@vz.font_fonts}" size="2"> + #{brace_url.xml_open}<a href="#{manifest_lnk}" target="_top">#{@md.file.output_path.manifest.url}/#{@file.base_filename.manifest}</a>#{brace_url.xml_close} + </font> +</td>} + else + %{<td align="center" bgcolor=#{@vz.color_band2}> <a href="#{manifest_lnk}" target="_top"> #{@vz.nav_txt_manifest} </a> </td>} + end else '' end end @@ -282,6 +297,7 @@ module SiSU_HTML_Format @md=md @o_str ||=SiSU_Env::ProcessingSettings.new(md).output_dir_structure @make=SiSU_Env::ProcessingSettings.new(@md) + @file=SiSU_Env::FileOp.new(@md) end def scroll_head_navigation_band if @make.build.html_top_band? @@ -292,8 +308,11 @@ module SiSU_HTML_Format WOK %{<table summary="table of contents scroll navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}> <tr><td width="20%"> - #{@vz.banner_band} -</td>#{search_and_manifest} + #{button_home(:scroll)} +</td> +<td width="75%" align="center"> + #{doc_types} +</td> <td width="20%"> #{@vz.table_close} @@ -301,13 +320,16 @@ WOK else '' end end - def concordance_navigation_band(type='') + def concordance_navigation_band if @make.build.html_top_band? %{<table summary="concordance navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}> <tr><td width="20%"> - #{@vz.banner_band} + #{button_home} +</td> +<td width="75%" align="center"> + #{doc_types} </td> -<td width="20%" align="right"> +<td width="5%" align="right"> <a href="toc.html" target="_top" alt="->"> #{png_nav.toc} </a> @@ -316,16 +338,24 @@ WOK else '' end end - def seg_head_navigation_band(type='') - firstseg=%{<a href="#{@md.firstseg}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top" alt="->"> - #{png_nav.nxt} - </a>} if @md.firstseg =~/\S+/ + def seg_head_navigation_band(page=:seg) + if page==:manifest + nxt=(@file.output_dir_structure.by_language_code? \ + || @file.output_dir_structure.by_filetype?) \ + ? "../html/#{@md.fnb}/toc#{@md.lang_code_insert}#{Sfx[:html]}" + : "toc#{@md.lang_code_insert}#{Sfx[:html]}" + firstseg=%{<a href="#{nxt}" target="_top" alt="->"> + #{png_nav.nxt}</a>} + elsif @md.firstseg =~/\S+/ + firstseg=%{<a href="#{@md.firstseg}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top" alt="->"> + #{png_nav.nxt}</a>} + end %{<table summary="table of contents segment navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}> <tr><td width="20%"> - #{@vz.banner_band} +#{button_home(page)} </td> <td width="75%" align="center"> - #{doc_types} + #{doc_types(page)} </td> <td width="5%" align="right"> #{firstseg} @@ -494,15 +524,13 @@ WOK %{<p class="small_left">Prefix: #{@md.prefix_b}<p />} end def scroll_head_title_banner_open - %{<center> -#{@md.icon} -</center> + icon=@md.icon ? %{<center>\n#{@md.icon}\n</center>} : '' + %{#{icon} #{@vz.banner_instrument_cover_band_scr}} end def seg_head_title_banner_open - %{<center> - #{@md.icon} -</center> + icon=@md.icon ? %{<center>\n#{@md.icon}\n</center>} : '' + %{#{icon} #{@vz.banner_instrument_cover_band_seg}} end def make_scroll @@ -596,8 +624,6 @@ WOK <a name="stop" id="stop"></a> <a name="credits"></a> </div> -</div> -</div> } end def seg_navigation_tail #this is a bug area, look up and "tidy" @@ -766,7 +792,7 @@ WOK def navigation_band(segtocband,seg_table_top_control) #change name to navigation_band_banner %{<table summary="segment navigation band with banner" bgcolor=#{@vz.color_band1} width="100%"><tr> <td width="20%" align="left"> -#{@vz.banner_band} +#{button_home} </td> <td width="75%" align="center"> #{doc_types} @@ -865,7 +891,7 @@ WOK end end class FormatTextObject - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new attr_accessor :md,:t_o,:txt,:ocn,:format,:table,:link,:linkname,:paranum,:p_num,:headname,:banner,:url def initialize(md,t_o) @md,@t_o=md,t_o @@ -897,7 +923,7 @@ WOK @txt=@txt.gsub(/#{Mx[:mk_o]}[-~]##{Mx[:mk_c]}/,'') end @p_num=ParagraphNumber.new(@md,@ocn) - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new @make=SiSU_Env::ProcessingSettings.new(@md) end def nametags_scroll(dob) @@ -1006,7 +1032,7 @@ WOK end def heading_normal(tag,attrib) section_break=(tag=~/h[1-4]/) \ - ? '<p><hr width=90% /></p>' + ? '<br /><hr width=90% /><br />' : '' %{#{section_break} <div class="substance"> @@ -1145,7 +1171,7 @@ WOK class FormatScroll < FormatTextObject def initialize(md,txt) super(md,txt) - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new end end class FormatSeg < FormatTextObject @@ -1211,7 +1237,6 @@ WOK def clean(txt) txt=txt.gsub(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/,''). gsub(/#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/,'') - txt end def subtoc_lev(tag,attrib) @txt=clean(@txt) diff --git a/lib/sisu/v3/html_minitoc.rb b/lib/sisu/v5/html_minitoc.rb index 8158c48d..bd9835dd 100644 --- a/lib/sisu/v3/html_minitoc.rb +++ b/lib/sisu/v5/html_minitoc.rb @@ -51,7 +51,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/html_minitoc.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/html_minitoc.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v3/html_promo.rb b/lib/sisu/v5/html_promo.rb index c2a8462d..a76a15fa 100644 --- a/lib/sisu/v3/html_promo.rb +++ b/lib/sisu/v5/html_promo.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/html_promo.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/html_promo.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -66,9 +66,9 @@ module SiSU_HTML_Promo def initialize(md) @md=md @env=SiSU_Env::InfoEnv.new(@md.fns,@md) - @rc=SiSU_Env::GetInit.instance.sisu_yaml.rc - @ad=SiSU_Env::GetInit.instance.ads - @vz=SiSU_Env::GetInit.instance.skin + @rc=SiSU_Env::GetInit.new.sisu_yaml.rc + @ad=SiSU_Env::GetInit.new.ads + @vz=SiSU_Viz::Defaults.new @flag=@env.widget.promo? @make=SiSU_Env::ProcessingSettings.new(@md) end @@ -99,7 +99,7 @@ module SiSU_HTML_Promo && @flag[:ad] ads=if @md.promo && @md.promo.length > 0 #promo set in document promo_array=@md.promo - elsif @flag[:sk] #promo set in associated skin + elsif @flag[:sk] #promo set promo_array=@vz.widget_promo elsif @flag[:rc] #promo set in rc file promo_array=if @rc['html']['promo'].is_a?(String) diff --git a/lib/sisu/v3/html_scroll.rb b/lib/sisu/v5/html_scroll.rb index 3180586c..fa183f46 100644 --- a/lib/sisu/v3/html_scroll.rb +++ b/lib/sisu/v5/html_scroll.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/html_scroll.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/html_scroll.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -67,7 +67,7 @@ module SiSU_HTML_Scroll class Scroll def initialize(md='',data='',endnotes='') @md,@data,@endnotes=md,data,endnotes - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new end def songsheet begin @@ -129,7 +129,7 @@ module SiSU_HTML_Scroll end elsif dob.is==:break \ and dob.from==:markup - '<p><hr width=90% /></p>' + '<br /><hr width=90% /><br />' elsif dob.is==:heading_insert x=if dob.ln==1 unless dob.obj.empty? diff --git a/lib/sisu/v3/html_segments.rb b/lib/sisu/v5/html_segments.rb index 7c90c53e..9efa2067 100644 --- a/lib/sisu/v3/html_segments.rb +++ b/lib/sisu/v5/html_segments.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/html_segments.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/html_segments.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -153,7 +153,7 @@ module SiSU_HTML_Seg attr_reader :seg_name_html,:seg_name_html_tracker def initialize(md=nil,data='') @md,@data=md,data - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new @seg_name_html=@@seg_name_html || nil @seg_name_html_tracker=@@tracker || nil @env=SiSU_Env::InfoEnv.new(@md.fns) if @md @@ -480,7 +480,7 @@ module SiSU_HTML_Seg sto.table elsif dob.is==:break \ and dob.from==:markup - '<p><hr width=90% /></p>' + '<br /><hr width=90% /><br />' end if @md.flag_separate_endnotes dob.obj=dob.obj.gsub(/"\s+href="#_(\d+)">/,%{" href=\"endnotes#{Sfx[:html]}#_\\1">}) #endnote- twice #removed file type diff --git a/lib/sisu/v3/html_table.rb b/lib/sisu/v5/html_table.rb index 7713a66f..8c9b76d0 100644 --- a/lib/sisu/v3/html_table.rb +++ b/lib/sisu/v5/html_table.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/html_table.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/html_table.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v3/html_tune.rb b/lib/sisu/v5/html_tune.rb index 23fa586e..9f81e8cd 100644 --- a/lib/sisu/v3/html_tune.rb +++ b/lib/sisu/v5/html_tune.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/html_tune.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/html_tune.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -116,11 +116,11 @@ module SiSU_HTML_Tune class Tune def initialize(data,md) @data,@md=data,md - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new @env=SiSU_Env::InfoEnv.new(@md.fns) @sys=SiSU_Env::SystemCall.new @env=SiSU_Env::InfoEnv.new(@md.fns) - @brace_url=SiSU_Viz::Skin.new.url_decoration + @brace_url=SiSU_Viz::Defaults.new.url_decoration end def songsheet begin diff --git a/lib/sisu/v3/hub.rb b/lib/sisu/v5/hub.rb index 2421a50c..6f0d0b63 100644 --- a/lib/sisu/v3/hub.rb +++ b/lib/sisu/v5/hub.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/hub.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/hub.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -146,11 +146,9 @@ module SiSU number_of_files={} @opt.files.each_with_index do |fns,i| fn=fns.gsub(/(?:~(?:#{@r}))?\.ss[tm]$/,'') - if number_of_files[fn].is_a?(Array) - number_of_files[fn] << i - else - number_of_files.store(fn,[i]) - end + (number_of_files[fn].is_a?(Array)) \ + ? (number_of_files[fn] << i) + : (number_of_files.store(fn,[i])) end files_translated_idx=[] number_of_files.each do |x| @@ -191,22 +189,22 @@ module SiSU @@n_do=0 end def remote_put_base_site_rsync # -CR -p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on + puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).set(:cyan) if @opt.act[:maintenance][:set] ==:on require_relative 'remote' # remote.rb SiSU_Remote::Put.new(@opt).rsync_base end def remote_put_base_site_rsync_match # -CCRZ -p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on + puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).set(:cyan) if @opt.act[:maintenance][:set] ==:on require_relative 'remote' # remote.rb SiSU_Remote::Put.new(@opt).rsync_base_sync end def remote_put_base_site # -Cr -p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on + puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).set(:cyan) if @opt.act[:maintenance][:set] ==:on require_relative 'remote' # remote.rb SiSU_Remote::Put.new(@opt).scp_base end def remote_put_base_site_all # -CCr -p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on + puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).set(:cyan) if @opt.act[:maintenance][:set] ==:on require_relative 'remote' # remote.rb SiSU_Remote::Put.new(@opt).scp_base_all end @@ -256,11 +254,14 @@ p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on attr_accessor :op def initialize(opt) @opt=opt - @@env=SiSU_Env::InfoEnv.new + @@env=@env=SiSU_Env::InfoEnv.new @msg,@msgs='',nil @tell=lambda { SiSU_Screen::Ansi.new(@opt.cmd,@msg,"#{@msgs.inspect if @msgs}") } end def do_loops + if @opt.act[:zap][:set]==:on #% --zap, -Z + do_loop_files_on_given_option_pre + end do_each_file_loop_options do_loop_files_on_given_option_post end @@ -307,6 +308,15 @@ p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on if @opt.act[:html][:set]==:on #% --html, -h require_relative 'html' # -h -H html.rb SiSU_HTML::Source.new(@opt).read + else + if @opt.act[:html_seg][:set]==:on #% --html-seg + require_relative 'html' # -h -H html.rb + SiSU_HTML::Source.new(@opt).read + end + if @opt.act[:html_scroll][:set]==:on #% --html-scroll + require_relative 'html' # -h -H html.rb + SiSU_HTML::Source.new(@opt).read + end end if @opt.act[:concordance][:set]==:on #% --concordance, -w require_relative 'concordance' # -w concordance.rb @@ -332,7 +342,9 @@ p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on require_relative 'xml_dom' # -X xml_dom.rb SiSU_XML_DOM::Source.new(@opt).read end - if @opt.act[:pdf][:set]==:on #% --pdf, -p latex/ texpdf + if @opt.act[:pdf][:set]==:on \ + or @opt.act[:pdf_p][:set]==:on \ + or @opt.act[:pdf_l][:set]==:on #% --pdf-l --pdf, -p latex/ texpdf require_relative 'texpdf' # -p texpdf.rb SiSU_TeX::Source.new(@opt).read end @@ -345,25 +357,28 @@ p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on SiSU_TexInfo::Source.new(@opt).read end if @opt.act[:sqlite_discrete][:set]==:on #% --sqlite, -d DB sqlite - require_relative 'dbi_discrete' # -d dbi_discrete.rb + require_relative 'dbi_discrete' # -d dbi_discrete.rb SiSU_DBI_Discrete::SQL.new(@opt).build end if @opt.act[:manifest][:set]==:on #% --manifest, -y require_relative 'manifest' # -y manifest.rb - SiSU_Manifest::Source.new(@opt).read + ((@opt.act[:sisupod][:set]==:on \ + || @opt.act[:share_source][:set]==:on) \ + && @opt.files.length < 2 ) \ + ? nil + : SiSU_Manifest::Source.new(@opt).read end end end - def loop_files_on_given_option_pre_do - if @opt.act[:sisupod][:set]==:on #% --sisupod, -S make sisupod - require_relative 'sisupod_make' # -S sisupod_make.rb - begin + def do_loop_files_on_given_option_pre + begin + if @opt.act[:zap][:set]==:on #% --zap, -Z OptionLoopFiles.new(@opt).loop_files_on_given_option do - SiSU_Doc::Source.new(@opt).read + require_relative 'zap' + SiSU_Zap::Source.new(@opt).read # -Z zap.rb end - ensure - SiSU_Doc::Source.new(@opt).sisupod_tar_xz end + ensure end end def do_loop_files_on_given_option_post @@ -406,11 +421,21 @@ p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on end end end + if (@opt.act[:sisupod][:set]==:on \ + || @opt.act[:share_source][:set]==:on) \ + and @opt.act[:manifest][:set]==:on #% --manifest, -y + require_relative 'manifest' # -y manifest.rb + begin + ensure + OptionLoopFiles.new(@opt).loop_files_on_given_option_bundle do + SiSU_Manifest::Source.new(@opt).read + end + end + end ensure path_pod=@env.processing_path.processing_sisupod(@opt).paths unless @opt.cmd =~/M/ FileUtils::rm_rf("#{path_pod[:sisupod]}/*") if FileTest.directory?(path_pod[:sisupod]) - #FileUtils::rm_rf("#{path_pod[:fnb]}/*") if FileTest.directory?(path_pod[:fnb]) end end end @@ -444,50 +469,18 @@ p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on end SiSU::Operations.new.counter end - if @opt.cmd =~/k/ #% -k temporary tests - OptionLoopFiles.new(@opt).loop_files_on_given_option do - #require_relative 'xml_scaffold' - #fix - end - end if @opt.act[:psql][:set]==:on #% --pg, -D DB postgresql require_relative 'dbi' - if @opt.files.length > 0 #switch test to actual commands - OptionLoopFiles.new(@opt).loop_files_on_given_option do - SiSU_DBI::SQL.new(@opt).connect # -D -d dbi.rb - end - else - SiSU_DBI::SQL.new(@opt).connect # -D -d dbi.rb + OptionLoopFiles.new(@opt).loop_files_on_given_option do + SiSU_DBI::SQL.new(@opt).connect # -D -d dbi.rb end end if @opt.act[:sqlite][:set]==:on #% --sqlite, -d DB sqlite require_relative 'dbi' - if @opt.files.length > 0 #switch test to actual commands - OptionLoopFiles.new(@opt).loop_files_on_given_option do - SiSU_DBI::SQL.new(@opt).connect # -D -d dbi.rb - end - else - SiSU_DBI::SQL.new(@opt).connect # -D -d dbi.rb + OptionLoopFiles.new(@opt).loop_files_on_given_option do + SiSU_DBI::SQL.new(@opt).connect # -D -d dbi.rb end end - if @opt.act[:dal][:set]==:on #% --dal, -m embedded content - # OptionLoopFiles.new(@opt).loop_files_on_given_option do - # require_relative 'embedded' - # SiSU_Embedded::Source.new(@opt).read # -m embedded.rb (image and other content) #check - # end - end - if @opt.act[:zap][:set]==:on #% --zap, -Z - # OptionLoopFiles.new(@opt).loop_files_on_given_option do - # require_relative 'zap' - # SiSU_Zap::Source.new(@opt).read # -Z zap.rb - # end - end - if @opt.act[:sisupod][:set]==:on #% --sisupod, -S make sisupod - # OptionLoopFiles.new(@opt).loop_files_on_given_option do - # require_relative 'sisupod_make' - # SiSU_Doc::Source.new(@opt).read # -S sisupod_make.rb - # end - end if @opt.act[:manifest][:set]==:on #% --manifest, -y require_relative 'manifest' OptionLoopFiles.new(@opt).manifest_on_files_translated do @@ -583,15 +576,10 @@ p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on if @opt.act[:webrick][:set]==:on #% --webrick, -W webrick SiSU::Operations.new(@opt).webrick end - if @opt.act[:zap][:set]==:on #% --zap -Z wipe previous output clean DUPLICATE - #require_relative 'zap' - #SiSU_Zap::Source.new(@opt).read # -Z zap.rb - end if @opt.act[:dal][:set]==:on @retry_count= -1 begin path_image='./_sisu/processing/external_document/image' - path_skin='./_sisu/processing/external_document/skin/doc' @get_s,@get_p,@get_pl=[],[],[] re_s=/(\S+?\.-sst)$/ re_p3=/((?:https?|file):\/\/\S+?(?:\/\S+?\.ss[mt]\.txz|sisupod(?:\.txz)?|\.ssp))/ @@ -625,35 +613,93 @@ p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on ensure end end - if @opt.act[:site_init][:set]==:on #% -C - require_relative 'conf' # -s conf.rb - SiSU_Initialize::Source.new(@opt).read - end end def actions if @opt.act[:profile][:set]==:on require 'profile' end + action_on_file_ =if @opt.act[:rsync][:set]==:on \ + && @opt.act[:site_init][:set]==:on + :false + elsif @opt.act[:rsync][:set]==:on \ + && @opt.act[:site_init][:set] !=:on + :true + elsif ((@opt.act[:psql][:set]==:on \ + or @opt.act[:sqlite][:set]==:on) \ + and @opt.mod.join(';') =~/--(?:createdb|init(?:ialize)?|create(?:all)?|createtables|recreate|drop(?:all))/) + :false + else + (@opt.act[:dal][:set]==:on \ + || @opt.act[:manpage][:set]==:on \ + || @opt.act[:texinfo][:set]==:on \ + || @opt.act[:txt][:set]==:on \ + || @opt.act[:html][:set]==:on \ + || @opt.act[:html_scroll][:set]==:on \ + || @opt.act[:html_seg][:set]==:on \ + || @opt.act[:concordance][:set]==:on \ + || @opt.act[:xhtml][:set]==:on \ + || @opt.act[:epub][:set]==:on \ + || @opt.act[:odt][:set]==:on \ + || @opt.act[:xml_sax][:set]==:on \ + || @opt.act[:xml_dom][:set]==:on \ + || @opt.act[:pdf][:set]==:on \ + || @opt.act[:pdf_p][:set]==:on \ + || @opt.act[:pdf_l][:set]==:on \ + || @opt.act[:psql][:set]==:on \ + || @opt.act[:sqlite][:set]==:on \ + || @opt.act[:sqlite_discrete][:set]==:on \ + || @opt.act[:share_source][:set]==:on \ + || @opt.act[:sisupod][:set]==:on \ + || @opt.act[:qrcode][:set]==:on \ + || @opt.act[:hash_digests][:set]==:on \ + || @opt.act[:manifest][:set]==:on \ + || @opt.act[:scp][:set]==:on \ + || @opt.act[:webrick][:set]==:on \ + || @opt.act[:zap][:set]==:on) \ + ? (:true) + : (:false) + end if @opt.act[:harvest][:set]==:on require_relative 'harvest' # harvest.rb SiSU_Harvest::Source.new(@opt).read # -h -H html.rb elsif @opt.mod.inspect =~/--convert|--to|--from/ require_relative 'sst_convert_markup' # sst_convert_markup.rb - elsif @opt.cmd =~/([abCcDdeFGgHhIjikLMmNnoPpQqRrSsTtUuVvWwXxYyZ_0-9])/ \ - and @opt.cmd =~/^-/ \ - and @opt.mod.inspect !~/--(?:sitemaps|query|identify)/ \ - or @opt.mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/ + elsif action_on_file_ == :false \ + and (@opt.act[:psql][:set]==:on \ + or @opt.act[:sqlite][:set]==:on) + if @opt.act[:psql][:set]==:on + require_relative 'dbi' + SiSU_DBI::SQL.new(@opt).connect + end + if @opt.act[:sqlite][:set]==:on + require_relative 'dbi' + SiSU_DBI::SQL.new(@opt).connect + end + elsif action_on_file_ == :true \ + or ( + @opt.cmd =~/^-/ \ + and @opt.cmd =~/([abCcDdeFGgHhIjikLMmNnoPpQqRrSsTtUuVvWwXxYyZ_0-9])/ \ + and @opt.mod.inspect !~/--(?:sitemaps|query|identify)/ \ + or @opt.mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/ + ) do_initialization - do_loops - @msg,@msgs="\tsisu -W [to start ruby web-server on output directory]\n",nil unless @opt.act[:quiet][:set] ==:on - @tell.call.print_brown if @opt.cmd =~/[uUvVM]/ unless @opt.files.join.empty? - if defined? @@env.processing_path.processing \ - and @@env.user \ - and FileTest.directory?(@@env.processing_path.processing) \ - and @@env.processing_path.processing =~/#{@@env.user}$/ #clean temporary processing directory of content as is located in public area - FileUtils::cd(@@env.processing_path.processing_base_tmp) do - FileUtils::rm_rf(@@env.user) unless @opt.act[:maintenance][:set] ==:on + if action_on_file_ == :true \ + and @opt.files.length > 0 + do_loops + @msg,@msgs="\tsisu -W [to start ruby web-server on output directory]\n",nil if @opt.cmd =~/[vVM]/ + @tell.call.print_brown if @opt.cmd =~/[uUvVM]/ unless @opt.files.join.empty? + if defined? @@env.processing_path.processing \ + and @@env.user \ + and FileTest.directory?(@@env.processing_path.processing) \ + and @@env.processing_path.processing =~/#{@@env.user}$/ #clean temporary processing directory of content as is located in public area + FileUtils::cd(@@env.processing_path.processing_base_tmp) do + FileUtils::rm_rf(@@env.user) unless @opt.act[:maintenance][:set] ==:on + end end + elsif action_on_file_ == :true \ + and @opt.files.length == 0 + STDERR.puts %{requested action requires valid sisu markup file filename (.sst .ssm) or wildcard (that includes a valid filame)} + puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).set(:fuchsia) if @opt.cmd =~/[MV]/ end elsif @opt.mod.inspect =~/--query/ require_relative 'sst_identify_markup' # sst_identify_markup.rb diff --git a/lib/sisu/v3/i18n.rb b/lib/sisu/v5/i18n.rb index 9e61fbdf..b635af15 100644 --- a/lib/sisu/v3/i18n.rb +++ b/lib/sisu/v5/i18n.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/i18n.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/i18n.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v3/manifest.rb b/lib/sisu/v5/manifest.rb index 225c235d..75d8233d 100644 --- a/lib/sisu/v3/manifest.rb +++ b/lib/sisu/v5/manifest.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/manifest.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/manifest.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -83,7 +83,6 @@ module SiSU_Manifest begin @env=SiSU_Env::InfoEnv.new(@opt.fns) @md=SiSU_Param::Parameters.new(@opt).get - SiSU_Env::InfoSkin.new(@md).select xbrowser=@env.program.web_browser browser=@env.program.console_web_browser # webserv_url=@env.path.url.output_tell #fix in sysenv @@ -114,19 +113,20 @@ module SiSU_Manifest @fnb=md.fnb @base_url="#{@env.url.root}/#{@fnb}" @o_str=SiSU_Env::FileOp.new(md).output_dir_structure - @image_path=if @o_str.dump_or_redirect? - './image' - else - %{#{@f.path_rel_links.html_scroll_2}_sisu/image_sys} - end + @image_path=(@o_str.dump_or_redirect?) \ + ? './image' + : %{#{@f.path_rel_links.html_scroll_2}_sisu/image_sys} @base_path=@f.output_path.manifest.dir @@dg ||=SiSU_Env::InfoEnv.new.digest.type @dg=@@dg l=SiSU_Env::StandardiseLanguage.new(md.opt.lng).language @language=l[:n] @translate=SiSU_Translate::Source.new(md,@language) - @brace_url=SiSU_Viz::Skin.new.url_decoration + @brace_url=SiSU_Viz::Defaults.new.url_decoration @stylesheet=SiSU_Style::CSS_HeadInfo.new(md).stylesheet + @fn_lng=(@f.output_dir_structure.by_language_code?) \ + ? '' + : ('.' + md.opt.lng) end def output manifest=@f.write_file.manifest @@ -451,12 +451,15 @@ module SiSU_Manifest end end def qrc_image - fn=@md.fnb - pth=(@o_str.dump_or_redirect?) \ + fn=(@f.output_dir_structure.by_filename?) \ + ? 'sisu_manifest' + : @md.fnb + pth=((@o_str.dump_or_redirect?) \ + || (@f.output_dir_structure.by_filename?)) \ ? '.' : 'qrcode' - img_md="#{pth}/#{fn}.md.png" - img_title="#{pth}/#{fn}.title.png" + img_md="#{pth}/#{fn}#{@fn_lng}.md.png" + img_title="#{pth}/#{fn}#{@fn_lng}.title.png" if FileTest.file?(@f.place_file.qrcode_md.dir)==true @manifest[:html] <<<<WOK <tr><td class="left"> @@ -498,7 +501,7 @@ WOK end if FileTest.file?(@f.place_file.sisupod.dir)==true pth=@f.output_path.sisupod.dir - rel=@f.output_path.sisupod.ab_pod + 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) @@ -512,77 +515,58 @@ WOK end end def metadata_tests - if defined? @md.title.full \ - and @md.title.full=~/\S+/ - id,info=@translate.full_title,@md.title.full - metadata(id,info) - end - if defined? @md.creator.author \ - and @md.creator.author=~/\S+/ - id,info=@translate.author,@md.creator.author - metadata(id,info) - end - if defined? @md.creator.editor \ - and @md.creator.editor=~/\S+/ - id,info=@translate.editor,@md.creator.editor - metadata(id,info) - end - if defined? @md.creator.contributor \ - and @md.creator.contributor=~/\S+/ - id,info=@translate.contributor,@md.creator.contributor - metadata(id,info) - end - if defined? @md.creator.translator \ - and @md.creator.translator=~/\S+/ - id,info=@translate.translator,@md.creator.translator - metadata(id,info) - end - if defined? @md.creator.illustrator \ - and @md.creator.illustrator=~/\S+/ - id,info=@translate.illustrator,@md.creator.illustrator - metadata(id,info) - end - if defined? @md.publisher \ - and @md.publisher=~/\S+/ #dc - id,info=@translate.publisher,@md.publisher - metadata(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) - 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) - end - if defined? @md.classify.subject \ - and @md.classify.subject=~/\S+/ - id,info=@translate.subject,@md.classify.subject - metadata(id,info) - end - if defined? @md.notes.description \ - and @md.notes.description=~/\S+/ - id,info=@translate.description,@md.notes.description - metadata(id,info) - end - if defined? @md.notes.abstract \ - and @md.notes.abstract=~/\S+/ - id,info=@translate.abstract,@md.notes.abstract - metadata(id,info) + 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) + end end - if defined? @md.type \ - and @md.type=~/\S+/ #dc - id,info=@translate.type,@md.type - metadata(id,info) + if defined? @md.creator #% + if defined? @md.creator.author \ + and @md.creator.author=~/\S+/ + id,info=@translate.author,@md.creator.author + metadata(id,info) + end + if defined? @md.creator.editor \ + and @md.creator.editor=~/\S+/ + id,info=@translate.editor,@md.creator.editor + metadata(id,info) + end + if defined? @md.creator.contributor \ + and @md.creator.contributor=~/\S+/ + id,info=@translate.contributor,@md.creator.contributor + metadata(id,info) + end + if defined? @md.creator.translator \ + and @md.creator.translator=~/\S+/ + id,info=@translate.translator,@md.creator.translator + metadata(id,info) + end + if defined? @md.creator.illustrator \ + and @md.creator.illustrator=~/\S+/ + id,info=@translate.illustrator,@md.creator.illustrator + metadata(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) + 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) + end end - if defined? @md.rights.all \ - and @md.rights.all=~/\S+/ #dc - id,info=@translate.rights,@md.rights.all - metadata(id,info) + 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) + end end - if defined? @md.date.published + if defined? @md.date #% if defined? @md.date.published \ and @md.date.published=~/\S+/ #dc id,info=@translate.date,@md.date.published @@ -614,108 +598,136 @@ WOK metadata(id,info) end end - if defined? @md.title.language \ - and @md.title.language=~/\S+/ - id,info=@translate.language,@md.title.language - metadata(id,info) - end - if defined? @md.original.language \ - and @md.original.language=~/\S+/ - id,info=@translate.language_original,@md.original.language - metadata(id,info) - end - if defined? @md.classify.format \ - and @md.classify.format=~/\S+/ - id,info=@transate.format,@md.classify.format - metadata(id,info) - end - if defined? @md.classify.identifier \ - and @md.classify.identifier=~/\S+/ - id,info=@translate.identifier,@md.classify.identifier - metadata(id,info) - end - if defined? @md.original.source \ - and @md.original.source=~/\S+/ - id,info=@translate.source,@md.original.source - metadata(id,info) - end - if defined? @md.classify.relation \ - and @md.classify.relation=~/\S+/ - id,info=@translate.relation,@md.classify.relation - metadata(id,info) - end - if defined? @md.classify.coverage \ - and @md.classify.coverage=~/\S+/ - id,info=@translate.coverage,@md.classify.coverage - metadata(id,info) - end - if defined? @md.classify.keywords \ - and @md.classify.keywords=~/\S+/ - id,info=@translate.keywords,@md.classify.keywords - metadata(id,info) - end - if defined? @md.notes.comment \ - and @md.notes.comment=~/\S+/ - id,info=@translate.comments,@md.notes.comment - metadata(id,info) - end - if defined? @md.classify.loc \ - and @md.classify.loc=~/\S+/ - id,info=@translate.cls_loc,@md.classify.loc - metadata(id,info) - end - if defined? @md.classify.dewey \ - and @md.classify.dewey=~/\S+/ - id,info=@translate.cls_dewey,@md.classify.dewey - metadata(id,info) - end - if defined? @md.classify.oclc \ - and @md.classify.oclc=~/\S+/ - id,info=@translate.cls_oclc,@md.classify.oclc - @manifest[:html] << %{<tr><th class="left"><p class="bold_left">#{id}:</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.classify.pg \ - and @md.classify.pg=~/\S+/ - id,info=@translate.cls_gutenberg,@md.classify.pg - metadata(id,info) - end - if defined? @md.classify.isbn \ - and @md.classify.isbn=~/\S+/ - id,info=@translate.cls_isbn,@md.classify.isbn + if defined? @md.publisher \ + and @md.publisher=~/\S+/ #dc + id,info=@translate.publisher,@md.publisher metadata(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) + if defined? @md.notes #% + if defined? @md.notes.description \ + and @md.notes.description=~/\S+/ + id,info=@translate.description,@md.notes.description + metadata(id,info) + end + if defined? @md.notes.abstract \ + and @md.notes.abstract=~/\S+/ + id,info=@translate.abstract,@md.notes.abstract + metadata(id,info) + end + if defined? @md.notes.comment \ + and @md.notes.comment=~/\S+/ + id,info=@translate.comments,@md.notes.comment + metadata(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) + 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) + end 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) + if defined? @md.title #% + if defined? @md.title.language \ + and @md.title.language=~/\S+/ + id,info=@translate.language,@md.title.language + metadata(id,info) + end + if defined? @md.original.language \ + and @md.original.language=~/\S+/ + id,info=@translate.language_original,@md.original.language + metadata(id,info) + end end - 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} - @md.topic_register_array.each do |t| - t.each_with_index do |st,i| - if st.is_a?(Array) - st.each do |v| - if v.is_a?(Array) - v.each do |w,i| - @manifest[:html] << %{<p class="it#{i}">#{w}</p>\n} + 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} + @md.topic_register_array.each do |t| + t.each_with_index do |st,i| + if st.is_a?(Array) + st.each do |v| + if v.is_a?(Array) + v.each do |w,i| + @manifest[:html] << %{<p class="it#{i}">#{w}</p>\n} + end + else + @manifest[:html] << %{<p class="it#{i}">#{v}</p>\n} end - else - @manifest[:html] << %{<p class="it#{i}">#{v}</p>\n} end + else @manifest[:html] << %{<p class="it#{i}">#{st}</p>\n} end - else @manifest[:html] << %{<p class="it#{i}">#{st}</p>\n} end end + @manifest[:html] << %{</td></tr>\n} + end + if defined? @md.classify.subject \ + and @md.classify.subject=~/\S+/ + id,info=@translate.subject,@md.classify.subject + metadata(id,info) + end + if defined? @md.classify.keywords \ + and @md.classify.keywords=~/\S+/ + id,info=@translate.keywords,@md.classify.keywords + metadata(id,info) + end + if defined? @md.classify.loc \ + and @md.classify.loc=~/\S+/ + id,info=@translate.cls_loc,@md.classify.loc + metadata(id,info) + end + if defined? @md.classify.dewey \ + and @md.classify.dewey=~/\S+/ + id,info=@translate.cls_dewey,@md.classify.dewey + metadata(id,info) + end + if defined? @md.notes.coverage \ + and @md.notes.coverage=~/\S+/ + id,info=@translate.coverage,@md.notes.coverage + metadata(id,info) + end + if defined? @md.notes.relation \ + and @md.notes.relation=~/\S+/ + id,info=@translate.relation,@md.notes.relation + metadata(id,info) + end + if defined? @md.notes.type \ + and @md.notes.type=~/\S+/ #dc + id,info=@translate.type,@md.notes.type + metadata(id,info) + end + if defined? @md.notes.format \ + and @md.notes.format=~/\S+/ + id,info=@transate.format,@md.notes.format + metadata(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} + @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) + end + if defined? @md.identifier.isbn \ + and @md.identifier.isbn=~/\S+/ + id,info=@translate.cls_isbn,@md.identifier.isbn + metadata(id,info) end - @manifest[:html] << %{</td></tr>\n} + end + if defined? @md.original.source \ + and @md.original.source=~/\S+/ + id,info=@translate.source,@md.original.source + metadata(id,info) end if @md.fns id,info=@translate.sourcefile,@md.fns @@ -773,31 +785,14 @@ WOK end def check_output(data) begin + make=SiSU_Env::ProcessingSettings.new(@md) minitoc=SiSU_HTML_MiniToc::TocMini.new(@md,data).songsheet.join("\n") id,file='','' - vz=SiSU_Env::GetInit.instance.skin - search_form=if @f.build.search_form? - "<td>#{@env.widget_static.search_form}</td>" - else '' - end - banner_table=if vz.banner_home_button_only !~ /http:\/\/www\.jus\.uio\.no\/sisu/ \ - and vz.banner_home_button_only !~ /sisu\.home\.png/ -<<WOK -<table summary="band" border="0" cellpadding="3" cellspacing="0"> -<tr><td align="left" width="15%" bgcolor="#ffffff">#{vz.banner_band}</td> -<td width="70%"><p class="tiny">#{@brace_url.xml_open}<a href="#{@base_url}/#{file}">#{@base_url}/#{file}</a>#{@brace_url.xml_close}</p></td> -#{search_form}</tr> -</table> -WOK - else -<<WOK -<table summary="band" border="0" cellpadding="3" cellspacing="0"> -<tr><td align="left" bgcolor="#ffffff"><a href="http://www.jus.uio.no/sisu/" target="_top"><img border="0" src="#{vz.url_path_image_sys}/sisu.png" alt="SiSU -->" /></a></td> -<td><p class="tiny">#{@brace_url.xml_open}<a href="#{@base_url}/#{file}">#{@base_url}/#{file}</a>#{@brace_url.xml_close}</p></td> -#{search_form}</tr> -</table> -WOK - end + vz=SiSU_Viz::Defaults.new + search_form=(make.build.search_form?) \ + ? "<td>#{@env.widget_static.search_form}</td>" + : '' + format_head_toc=SiSU_HTML_Format::HeadToc.new(@md) @manifest[:html] <<<<WOK <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> @@ -813,9 +808,9 @@ SiSU manifest: #{@md.title.full} #{@stylesheet.css_head} </head> <body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en"> -#{banner_table} +#{format_head_toc.seg_head_navigation_band(:manifest)} WOK - if @f.build.manifest_minitoc? + if make.build.manifest_minitoc? if @o_str.dump_or_redirect? elsif @f.output_dir_structure.by_language_code? \ or @f.output_dir_structure.by_filetype? @@ -834,10 +829,35 @@ WOK <div> WOK end + if @o_str.dump_or_redirect? + elsif @f.output_dir_structure.by_language_code? \ + or @f.output_dir_structure.by_filetype? + pth_local=@f.output_path.manifest.dir + pth_rel='.' + else + pth_local=@f.output_path.base.dir + pth_rel='..' + end + pth_rel_home=if @env.output_dir_structure.by? == :language + '../..' + elsif @env.output_dir_structure.by? == :filetype + '..' + elsif @env.output_dir_structure.by? == :filename + '..' + else '..' + end + harvest=(FileTest.file?("#{pth_local}/authors#{@fn_lng}.html") \ + && FileTest.file?("#{pth_local}/topics#{@fn_lng}.html")) \ + ? %{<p class="small"><a href="#{pth_rel_home}/index.html">.:</a> other document manifests: [<a href="#{pth_rel}/authors#{@fn_lng}.html">authors</a>] [<a href="#{pth_rel}/topics#{@fn_lng}.html">topics</a>]</p>} + : '' + manifest_title=%{<p class="bold">#{@translate.manifest_description}</p>#{harvest}} @manifest[:html] <<<<WOK -<h1 class="small">#{@translate.manifest_description}</h1> -<h2 class="small">#{@md.title.full}</h2> +<div id="horizontal_links"> +#{manifest_title} +</div> +<h1 class="small">#{@md.title.full}</h1> <p class="bold">#{@md.author}</p> +<div id="horizontal_links"><p class="bold"> <p class="small"> <a href="#output">Document, Available Filetypes</a> </p> @@ -847,6 +867,7 @@ WOK <p class="tiny"> <a href="#links">metadata suggested links (if any)</a> </p> +</div> <table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center"> WOK published_versions diff --git a/lib/sisu/v3/manpage.rb b/lib/sisu/v5/manpage.rb index 8be6ecdc..0873e3f3 100644 --- a/lib/sisu/v3/manpage.rb +++ b/lib/sisu/v5/manpage.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/manpage.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/manpage.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -97,7 +97,6 @@ module SiSU_Manpage SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@md.file.output_path.manpage.dir}/#{@md.file.base_filename.manpage}").flow if @opt.cmd =~/[MV]/ @dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here SiSU_Manpage::Source::Scroll.new(@md,@dal_array).songsheet - SiSU_Env::InfoSkin.new(@md).select #watch rescue SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do __LINE__.to_s + ':' + __FILE__ @@ -113,8 +112,8 @@ module SiSU_Manpage @@endnotes={ para: [], end: [] } def initialize(md,data) @md,@data=md,data - @brace_url=SiSU_Viz::Skin.new.url_decoration - @vz=SiSU_Env::GetInit.instance.skin + @brace_url=SiSU_Viz::Defaults.new.url_decoration + @vz=SiSU_Viz::Defaults.new @tab="\t" @br="\n" @@notes=:end @@ -171,8 +170,7 @@ GSUB @manpage[:metadata]=SiSU_Metadata::Summary.new(@md).manpage.metadata end def manpage_tail - SiSU_Env::InfoSkin.new(@md).select - vz=SiSU_Env::GetInit.instance.skin + vz=SiSU_Viz::Defaults.new generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version] lastdone="Last Generated on: #{Time.now}" rubyv="Ruby version: #{@md.ruby_version}" @@ -183,21 +181,26 @@ GSUB @manpage[:tail] <<<<WOK #{@br} .TP -Other versions of this document: +.SH SEE ALSO + sisu(1), + sisu-epub(1), + sisu-harvest(1), + sisu-html(1), + sisu-odf(1), + sisu-pdf(1), + sisu-pg(1), + sisu-sqlite(1), + sisu-txt(1). + sisu_vim(7) .TP - manifest: <#{@md.file.output_path.digest.url}/#{@md.file.base_filename.digest}> +.SH HOMEPAGE + More information about SiSU can be found at <http://www.sisudoc.org/> or <http://www.jus.uio.no/sisu/> .TP -at: <#{vz.url_site}> +.SH SOURCE + <http://sources.sisudoc.org/> .TP -#{sc} -.TP -* #{generator} -.TP -* #{rubyv} -.TP -* #{lastdone} -.TP -* SiSU #{vz.url_sisu} +.SH AUTHOR + SiSU is written by Ralph Amissah <ralph@amissah.com> WOK end def manpage_structure(dob='',hname='') #% Used to extract the structure of a document @@ -309,27 +312,27 @@ WOK gsub(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'©') else dob.obj=dob.obj.gsub(/\\/,'\e'). - gsub(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*/,"\n") # watch + gsub(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*/,"\n") # watch end - dob.obj=dob.obj.gsub(/(^| |#{Mx[:nbsp]}|\s|\*)\\\*/,'\1\\\\\*'). #man page requires + dob.obj=dob.obj.gsub(/(^| |#{Mx[:nbsp]}|\s|\*)\\\*/,'\1\\\\\*'). #man page requires gsub(/┆/,'|'). - gsub(/^(\.\S{3,})/m,' \1') # ^\. used by interpreter, disable when use not intended + gsub(/^(\.\S{3,})/m,' \1') # ^\. used by interpreter, disable when use not intended dob.obj=dob.obj.gsub(/~/,'~') if dob.obj #manpages use this if dob.is ==:code dob.obj=dob.obj.gsub(/(^|[^}])_([<>])/m,'\1\2'). # _> _< gsub(/(^|[^}])_([<>])/m,'\1\2'). # _<_< - gsub(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})+(\s*)/m,"\n\\1"). # watch + gsub(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})+(\s*)/m,"\n\\1"). # watch gsub(/\A(.+?)\s*\Z/m,".nf\n\\1\n.fi") end - dob.obj=dob.obj.gsub(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})+\s*/m,"\n\n") # watch + dob.obj=dob.obj.gsub(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})+\s*/m,"\n\n") # watch blit=dob.obj.scan(/\[[^\]]+\]|[^\[]+/) blit_array=[] - dob.obj=dob.obj.gsub(/#{Mx[:gl_o]}:name#\S+?#{Mx[:gl_c]}/mi,''). #added - gsub(/#{Mx[:br_page]}\s*|#{Mx[:br_page_new]}/,''). # remove page breaks + dob.obj=dob.obj.gsub(/#{Mx[:gl_o]}:name#\S+?#{Mx[:gl_c]}/mi,''). #added + gsub(/#{Mx[:br_page]}\s*|#{Mx[:br_page_new]}|#{Mx[:br_page_line]}/,''). # remove page breaks, you may wish to have a line across the page break instead gsub(/(^|#{Mx[:gl_c]}|\s)#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1\2'). gsub(/<a href=".+?">(.+?)<\/a>/m,'\1'). - gsub(/#{Mx[:mk_o]}name#\S+?#{Mx[:mk_c]}/,''). # remove name links - gsub(/ |#{Mx[:nbsp]}/,' '). # decide on + gsub(/#{Mx[:mk_o]}name#\S+?#{Mx[:mk_c]}/,''). # remove name links + gsub(/ |#{Mx[:nbsp]}/,' '). # decide on gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}\s*(\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*(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}image/,' [ \1 ]'). #"[ #{dir.url.images_local}\/\\1 ]") gsub(/^(?:^|[^_\\])#{Mx[:lnk_o]}\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*#{Mx[:lnk_c]}\S+/,'[image: "\1"]') diff --git a/lib/sisu/v3/manpage_format.rb b/lib/sisu/v5/manpage_format.rb index bd07a0bc..ce54fdb7 100644 --- a/lib/sisu/v3/manpage_format.rb +++ b/lib/sisu/v5/manpage_format.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/manpage_format.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/manpage_format.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -82,7 +82,7 @@ module SiSU_ManpageFormat @md,@dob=md,dob rgx=/#{Mx[:en_a_o]}[\d*+]+\s+(.+?)#{Mx[:en_a_c]}/ @dob.obj.gsub!(rgx,'\1') if @dob.obj =~rgx - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new end def scr_endnote_body "<endnote>#{@dob.obj}</endnote> " diff --git a/lib/sisu/v3/odf.rb b/lib/sisu/v5/odf.rb index 71cbcca5..671cc350 100644 --- a/lib/sisu/v3/odf.rb +++ b/lib/sisu/v5/odf.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/odf.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/odf.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -92,7 +92,6 @@ module SiSU_ODF SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"file://#{@md.file.output_path.odt.dir}/#{@md.file.base_filename.odt}").flow if @opt.cmd =~/[MV]/ end SiSU_ODF::Source::Scroll.new(@particulars).songsheet - SiSU_Env::InfoSkin.new(@md).select rescue SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do __LINE__.to_s + ':' + __FILE__ @@ -110,9 +109,9 @@ module SiSU_ODF @@fns=nil def initialize(particulars) @md,@env,@dal_array=particulars.md,particulars.env,particulars.dal_array - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new @tab="\t" - @brace_url=SiSU_Viz::Skin.new.url_decoration + @brace_url=SiSU_Viz::Defaults.new.url_decoration @br=(@md.opt.cmd =~/M/) ? '' : '' #@br=(@md.opt.cmd =~/M/) ? "\n" : '' end @@ -192,9 +191,11 @@ module SiSU_ODF @@fns=@md.fns end unless @@docstart - breakpage=if (@md.pagenew or @md.pagebreak) \ - and (@md.pagenew =~ m or @md.pagebreak =~m) + breakpage=if (@md.pagenew || @md.pagebreak) \ + and (@md.pagenew =~m or @md.pagebreak =~m) '<text:p text:style-name="P_normal_page_new"> </text:p>' + elsif @md.pageline \ + and @md.pageline =~m #fix else '' end end @@ -527,6 +528,8 @@ module SiSU_ODF if dob.obj==Mx[:br_page] \ or dob.obj==Mx[:br_page_new] dob=br.br_page + elsif dob.obj==Mx[:br_page_line] + dob=br.br_page_line elsif dob.obj==Mx[:br_obj] dob=br.obj_sep end @@ -726,6 +729,8 @@ WOK breakpage=if @md.pagenew \ or @md.pagebreak ' fo:break-before="page"' + elsif @md.pageline ##fix + '' else '' end x=<<WOK diff --git a/lib/sisu/v3/odf_format.rb b/lib/sisu/v5/odf_format.rb index 9c5f37ce..8abff36f 100644 --- a/lib/sisu/v3/odf_format.rb +++ b/lib/sisu/v5/odf_format.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/odf_format.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/odf_format.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -139,7 +139,7 @@ module SiSU_ODF_Format end rgx=/#{Mx[:en_a_o]}\d+\s+(.+?)#{Mx[:en_a_c]}/ @txt=@txt.gsub(rgx,'\1') if @txt =~rgx - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new end def scr_endnote_body "<endnote>#{@txt}</endnote> " @@ -164,7 +164,7 @@ module SiSU_ODF_Format def initialize(md,dob,p_num) @md,@dob,@p_num=md,dob,p_num @txt=dob.obj - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new if @md.fns != @@fns @@table_counter=0 @@fns=@md.fns @@ -650,6 +650,11 @@ WOK @t_o.obj='<text:p text:style-name="P_page_break"> </text:p>' @t_o end + def br_page_line + sep='_' + @t_o.obj=%{<text:p text:style-name="P_normal">#{sep*60}</text:p>} + @t_o + end def obj_sep #center later sep='--- ' @t_o.obj=%{<text:p text:style-name="P_normal">#{sep*20}</text:p>} diff --git a/lib/sisu/v3/options.rb b/lib/sisu/v5/options.rb index f44b5505..2133a812 100644 --- a/lib/sisu/v3/options.rb +++ b/lib/sisu/v5/options.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/options.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/options.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -63,9 +63,81 @@ module SiSU_Commandline require 'pathname' require_relative 'sysenv' # sysenv.rb - @@base_path=nil + require_relative 'param_make' # param_make.rb + @@sisu_call_origin_path=nil + class HeaderCommon + def initialize(make_instruct_array) + @make_instruct_array=make_instruct_array + end + def sisu_document_make_instructions + @pagenew=@pagebreak=@pageline=@toc=@lv1=@lv2=@lv3=@lv4=@lv5=@lv6=@num_top=@i18n=@man_section=@emphasis_set_to=@bold_match_list=@italics_match_list=@substitution_match_list=@footer_links=@home_button_links=@links=nil + @makeset=false + if @make_instruct_array + @make_instruct_array.each do |para| #% scan document + if para =~/^(?:@make:|@links:)[+-]?\s/ + case para + when /^@make:(.+)/m #% header processing - make + @env=SiSU_Env::InfoEnv.new + @make=SiSU_Param_Make::MdMake.new($1.strip,@opt,@env).make + makes=SiSU_Param_Make::MakeHead.new(@make).make_instruct + @makeset=true + @pagenew=makes[:pagenew] + @pagebreak=makes[:pagenew] + @pageline=makes[:pageline] + @toc=makes[:toc] + @lv1=makes[:lv1] + @lv2=makes[:lv2] + @lv3=makes[:lv3] + @lv4=makes[:lv4] + @lv5=makes[:lv5] + @lv6=makes[:lv6] + @num_top=makes[:num_top] + @i18n=makes[:i18n] + @man_section=makes[:man_section] + @emphasis_set_to=makes[:emphasis_set_to] + @bold_match_list=makes[:bold_match_list] + @italics_match_list=makes[:italics_match_list] + @substitution_match_list=makes[:substitution_match_list] + @footer_links=makes[:footer_links] + @home_button_links=makes[:home_button_links] + @home_button_image=makes[:home_button_image] + @cover_image=makes[:cover_image] + when /^@links:(.+)/m #% header processing - make + make_links=SiSU_Param::Parameters::MdMake.new($1.strip,@opt,@env).make_links + @links,@links_append=make_links.links,make_links.append? + end + end + end #% here endeth the common header loop + end + { makeset: @makeset, + pagenew: @pagenew, + pagebreak: @pagebreak, + pageline: @pageline, + toc: @toc, + lv1: @lv1, + lv2: @lv2, + lv3: @lv3, + lv4: @lv4, + lv5: @lv5, + lv6: @lv6, + num_top: @num_top, + i18n: @i18n, + man_section: @man_section, + emphasis_set_to: @emphasis_set_to, + bold_match_list: @bold_match_list, + italics_match_list: @italics_match_list, + substitution_match_list: @substitution_match_list, + footer_links: @footer_links, + home_button_links: @home_button_links, + home_button_image: @home_button_image, + cover_image: @cover_image, + links: @links, + links_append: @links_append + } + end + end class Options - attr_accessor :cmd,:mod,:act,:dir_structure_by,:f_pths,:files,:files_mod,:base_path,:base_stub,:sub_location,:paths,:lngs,:f_pth,:pth,:fno,:fns,:fnb,:fnc,:fng,:fncb,:lng,:lng_base,:what + attr_accessor :cmd,:mod,:act,:dir_structure_by,:f_pths,:files,:files_mod,:base_path,:base_stub,:sub_location,:paths,:lngs,:f_pth,:pth,:fno,:fns,:fnb,:fnc,:fng,:fncb,:lng,:lng_base,:what,:make_instructions,:make_instructions_pod @@act=nil def initialize(a) @cmd,@f_pth,@pth,@fno,@fns,@fnb,@fnc,@fng,@fncb,@what,@lng,@lng_base,@base_path,@base_stub,@sub_location='','','','','','','','','','','','','','' @@ -73,13 +145,16 @@ module SiSU_Commandline @env=SiSU_Env::InfoEnv.new @lng_base=@env.language_default_set @dir_structure_by=SiSU_Env::EnvCall.new.output_dir_structure.by? - @@base_path ||=Dir.pwd - @base_path=@@base_path + @@sisu_call_origin_path ||=Dir.pwd + @base_path=@@sisu_call_origin_path r=Px[:lng_lst_rgx] u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/ @base_stub=@base_path.gsub(u,'\1') @a=sisu_glob_rules(a) @a.freeze + make_instruct_array=SiSU_Env::GetInit.new.sisu_document_make.makefile_read + @make_instructions=HeaderCommon.new(make_instruct_array).sisu_document_make_instructions + @make_instructions_pod=nil init end def find_all(find_flag,opt) @@ -185,13 +260,13 @@ module SiSU_Commandline @lngs = q[:lngs] if @files.length > 0 \ and @cmd.empty? \ - and @mod.length==0 #% if no other action called on filename given, default is sisu --v3 -0 [filename(s)] configured as flag default + and @mod.length==0 #% if no other action called on filename given, default is sisu --v4 -0 [filename(s)] configured as flag default shortcut=SiSU_Env::InfoProcessingFlag.new - @mod=['--v3'] + @mod=['--v4'] @cmd=shortcut.cf_0 + 'm' end if @cmd =~/[vVM]/ \ - && @cmd !~/-vu?$/ + && @cmd !~/-[ku]*v[ku]*$/ SiSU_Screen::Ansi.new(@cmd,"\tsisu " + @cmd + ' ' + @mod.join(' ') + ' ' + @files.join(' ') + "\n").print_brown end end @@ -200,6 +275,22 @@ module SiSU_Commandline @files self end + def sisu_document_make_pod + def makefile_name + SiSU_Env::GetInit.new.sisu_document_make.makefile_name + end + def makefile(pod_make_path) + "#{pod_make_path}/#{makefile_name}" + end + def makefile_read(pod_make_path) + f=if FileTest.file?(makefile(pod_make_path)) + sisu_doc_makefile=IO.read(makefile(pod_make_path), mode: 'r:utf-8') + sisu_doc_makefile.split(/\s*\n\s*\n/m) + else nil + end + end + self + end def set_files_and_paths_and_general_extract(s) c,w='','' m,f,pth,z,lng,lngs=[],[],[],[],[],[] @@ -224,6 +315,10 @@ module SiSU_Commandline fullname=@env.processing_path.processing + '/sisupod/' + fn_pod pt=Pathname.new(fullname) FileUtils::mkdir_p(pt.to_s) + pod_make_path=fullname + '/sisupod/doc/_sisu' + pod_make_path_file=pod_make_path + make_instruct_array=sisu_document_make_pod.makefile_read(pod_make_path) + @make_instructions_pod=HeaderCommon.new(make_instruct_array).sisu_document_make_instructions Dir.chdir(pt.realpath) options=s.gsub(/(\s+--?\S+)+.+/,'\1') system(" @@ -373,46 +468,85 @@ module SiSU_Commandline end def opt_cmd_and_mod_adjust(c,m) cmd,mod,files=@cmd,@mod,@files + if not m.empty? \ + and m.inspect =~/"--pdf-/ + ps,psa='',[] + mod << '--pdf' + m.each do |m| + if m =~ /^--pdf-(?:(?:l|landscape)(?:-(?:a4|letter|a5|b5|legal))?|(?:a4|letter|a5|b5|legal)-(?:l|landscape))$/ + mod << '--landscape' + end + if m =~ /^--pdf-(?:(?:p|portrait)(?:-(?:a4|letter|a5|b5|legal))?|(?:a4|letter|a5|b5|legal)-(?:p|portrait))$/ + mod << '--portrait' + end + if m =~ /^--pdf(?:-(?:a4|letter|a5|b5|legal)(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))(?:-(?:a4|letter|a5|b5|legal)))$/ + if m =~ /^--pdf(?:-a4(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-a4)$/ + mod << '--papersize-a4' + end + if m =~ /^--pdf(?:-a5(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-a5)$/ + mod << '--papersize-a5' + end + if m =~ /^--pdf(?:-b5(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-b5)$/ + mod << '--papersize-b5' + end + if m =~ /^--pdf(?:-letter(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-letter)$/ + mod << '--papersize-letter' + end + if m =~ /^--pdf(?:-legal(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-legal)$/ + mod << '--papersize-legal' + end + end + end + mod=mod.uniq + end unless m.empty? m.each do |m| case m - when /^--(?:color-toggle)$/; c=c+'c' - when /^--(?:configure|init-site)$/; c=c+'CC' - when /^--(?:dal?|machine|abstraction|abs)$/; c=c+'m' - when /^--(?:txt|text|plaintext)$/; c=c+'t' - when /^--(?:html)$/; c=c+'h' - when /^--(?:epub)$/; c=c+'e' - when /^--(?:od[ft])$/; c=c+'o' - when /^--(?:pdf)$/; c=c+'p' - when /^--(?:concordance|wordmap)$/; c=c+'w' - when /^--(?:manpage|man)$/; c=c+'i' - when /^--(?:texinfo)$/; c=c+'I' - when /^--(?:xhtml)$/; c=c+'b' - when /^--(?:xml-sax)$/; c=c+'x' - when /^--(?:xml-dom)$/; c=c+'X' - when /^--(?:images)$/; c=c+'j' - when /^--(?:hash-digests)$/; c=c+'N' - when /^--(?:po4a|pot?)$/; c=c+'P' - when /^--(?:termsheet)$/; c=c+'T' - when /^--(?:manifest)$/; c=c+'y' - when /^--(?:qrcode)$/; c=c+'Q' - when /^--(?:sqlite)$/; c=c+'d' - when /^--(?:pg|pg?sql|postgresql)$/; c=c+'D' - when /^--(?:remote|rsync)$/; c=c+'R' - when /^--(?:scp)$/; c=c+'r' - when /^--(?:source)$/; c=c+'s' - when /^--(?:sisupod|pod)$/; c=c+'S' - when /^--(?:git)$/; c=c+'g' - when /^--(?:urls)$/; c=c+'U' - when /^--(?:zap|delete)$/; c=c+'Z' - when /^--(?:sample-search-form)$/; c=c+'F' - when /^--(?:webserv|webrick)$/; c=c+'W' - when /^--(?:profile)$/; c=c+'E' - when /^--(?:maintenance|keep-processing-files)$/; c=c+'M' - when /^--(?:verbose[=-]3)$/; c=c+'VM' - when /^--(?:verbose[=-]2|Verbose|VERBOSE)$/; c=c+'V' - when /^--(?:verbose(?:[=-]1)?)$/; c=c+'v' - when /^--(?:verbose[=-]0|quiet|silent)$/; c=c+'q' + when /^--(?:color-toggle)$/; c=c+'c' + when /^--(?:color-off)$/; c=c+'k' + when /^--(?:conf|config|configure|init|initialize|init-site)$/; c=c+'CC' + when /^--(?:dal?|machine|abstraction|abs)$/; c=c+'m' + when /^--(?:txt|text|plaintext)$/; c=c+'t' + when /^--(?:html)$/; c=c+'h' + when /^--(?:html-scroll|html-seg)$/; c=c+'H' + mod << m + when /^--(?:epub)$/; c=c+'e' + when /^--(?:od[ft])$/; c=c+'o' + when /^--(?:pdf)$/; c=c+'p' + when /^--pdf-(?:a4|a5|b5|legal|letter)$/; c=c+'p' + when /^--pdf-(?:p|l|portrait|landscape)$/; c=c+'L' + when /^--pdf-(?:p(?:ortrait)?|l(?:andscape)?)-(?:a4|letter|a5|b5|legal)$/; c=c+'L' + when /^--pdf-(?:a4|letter|a5|b5|legal)-(?:p(?:ortrait)?|l(?:andscape)?)$/; c=c+'L' + when /^--(?:concordance|wordmap)$/; c=c+'w' + when /^--(?:manpage|man)$/; c=c+'i' + when /^--(?:texinfo)$/; c=c+'I' + when /^--(?:xhtml)$/; c=c+'b' + when /^--(?:xml-sax)$/; c=c+'x' + when /^--(?:xml-dom)$/; c=c+'X' + when /^--(?:images)$/; c=c+'j' + when /^--(?:hash-digests)$/; c=c+'N' + when /^--(?:po4a|pot?)$/; c=c+'P' + when /^--(?:termsheet)$/; c=c+'T' + when /^--(?:manifest)$/; c=c+'y' + when /^--(?:qrcode)$/; c=c+'Q' + when /^--(?:sqlite)$/; c=c+'d' + when /^--(?:pg|pg?sql|postgresql)$/; c=c+'D' + when /^--(?:remote|rsync)$/; c=c+'R' + when /^--(?:scp)$/; c=c+'r' + when /^--(?:source)$/; c=c+'s' + when /^--(?:sisupod|pod)$/; c=c+'S' + when /^--(?:git)$/; c=c+'g' + when /^--(?:urls)$/; c=c+'U' + when /^--(?:zap|delete)$/; c=c+'Z' + when /^--(?:sample-search-form)$/; c=c+'F' + when /^--(?:webserv|webrick)$/; c=c+'W' + when /^--(?:profile)$/; c=c+'E' + when /^--(?:maintenance|keep-processing-files)$/; c=c+'M' + when /^--(?:verbose[=-]3)$/; c=c+'VM' + when /^--(?:verbose[=-]2|Verbose|VERBOSE)$/; c=c+'V' + when /^--(?:verbose(?:[=-]1)?)$/; c=c+'v' + when /^--(?:version)$/; c=c+'v' + when /^--(?:verbose[=-]0|quiet|silent)$/; c=c+'q' else mod << m #mod only contains command modifiers; commands converted to character end end @@ -425,7 +559,7 @@ module SiSU_Commandline end extra='' if cmd !~/[mn]/ - extra+=if cmd =~/[abegHhIiNOoPpQTtwXxyz]/ \ + extra+=if cmd =~/[abegHhIiLNOoPpQTtwXxyz]/ \ and cmd !~/[mn]/ 'm' #% add dal elsif ((cmd =~/[Dd]/ \ @@ -468,12 +602,11 @@ module SiSU_Commandline @act=@@act else act={} - act[:license]=(cmd =~/L/ \ - || mod.inspect =~/"--license/) \ + act[:license]=(mod.inspect =~/"--license/) \ ? { bool: true, set: :on } : { bool: false, set: :na } act[:site_init]=(cmd =~/C/ \ - || mod.inspect =~/"--init-site"|"--configure"/) \ + || mod.inspect =~/"--init"|"--initialize"|"--init-site"|"--conf"|"--config"|"--configure"/) \ ? { bool: true, set: :on } : { bool: false, set: :na } act[:rc]=if mod.inspect =~/"--rc=/ @@ -520,7 +653,8 @@ module SiSU_Commandline : { bool: false, set: :na } act[:color_state]=if mod.inspect =~/"--color-on"|"--color"/ { bool: true, set: :on } - elsif mod.inspect =~/"--color-off"/ + elsif (cmd =~/k/ \ + || mod.inspect =~/"--color-off"/) { bool: false, set: :off } else { bool: true, set: :na } #fix default color end @@ -584,6 +718,9 @@ module SiSU_Commandline end act[:links_to_manifest]=if mod.inspect =~/"--inc-links-to-manifest"|"--inc-manifest-links"/ { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-manifest"/ \ + || act[:switch][:off].inspect =~/"manifest"/ #place lower + { bool: false, set: :off } elsif mod.inspect =~/"--(?:exc|no)-links-to-manifest"|"--(?:exc|no)-manifest-links"/ \ || act[:switch][:off].inspect =~/"links_to_manifest"|"manifest_links"|"--(?:exc|no)-manifest"/ \ || mod.inspect =~/"--(?:redirect|dump)/ @@ -665,10 +802,20 @@ module SiSU_Commandline || mod.inspect =~/"--dal"/) \ ? { bool: true, set: :on } : { bool: false, set: :na } - act[:html]=(cmd =~/h/ \ - || mod.inspect =~/"--html"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } + act[:html]=if (cmd =~/h/ \ + || mod.inspect =~/"--html"/) + act[:html_scroll]={ bool: true, set: :on } + act[:html_seg]={ bool: true, set: :on } + { bool: true, set: :on } + else + act[:html_scroll]=(mod.inspect =~/"--html-scroll"/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } + act[:html_seg]=(mod.inspect =~/"--html-seg"/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } + { bool: false, set: :na } + end act[:concordance]=(cmd =~/w/ \ || mod.inspect =~/"--concordance"/) \ ? { bool: true, set: :on } @@ -677,10 +824,65 @@ module SiSU_Commandline || mod.inspect =~/"--images"/) \ ? { bool: true, set: :on } : { bool: false, set: :na } - act[:pdf]=(cmd =~/p/ \ - || mod.inspect =~/"--pdf"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } + if (cmd =~/p/ \ + || mod.inspect =~/"--pdf"/) + if mod.inspect =~/"--portrait"/ + act[:pdf]= { bool: false, set: :na } + act[:pdf_l]={ bool: false, set: :na } + act[:pdf_p]={ bool: true, set: :on } + elsif mod.inspect =~/"--landscape"/ + act[:pdf]= { bool: false, set: :na } + act[:pdf_l]={ bool: true, set: :on } + act[:pdf_p]={ bool: false, set: :na } + else + act[:pdf]= { bool: true, set: :on } + act[:pdf_l]={ bool: true, set: :on } + act[:pdf_p]={ bool: true, set: :on } + end + else + act[:pdf]= { bool: false, set: :na } + act[:pdf_p]= { bool: false, set: :na } + act[:pdf_l]= { bool: false, set: :na } + act[:pdf_a4]= { bool: false, set: :na } + act[:pdf_a5]= { bool: false, set: :na } + act[:pdf_b5]= { bool: false, set: :na } + act[:pdf_letter]={ bool: false, set: :na } + act[:pdf_legal]= { bool: false, set: :na } + end + if act[:pdf][:set]==:on \ + or act[:pdf_p][:set]==:on \ + or act[:pdf_l][:set]==:on + act[:pdf_a4]=if mod.inspect =~/"--a4"|--papersize-a4"/ \ + or mod.inspect =~/"--papersize=\S*a4\b\S*"/ #--papersize=a4,a5 + { bool: true, set: :on } + else + { bool: false, set: :na } + end + act[:pdf_a5]=if mod.inspect =~/"--a5"|"--papersize-a5"/ \ + or mod.inspect =~/"--papersize=\S*a5\b\S*"/ #--papersize=a4,a5 + { bool: true, set: :on } + else + { bool: false, set: :na } + end + act[:pdf_b5]=if mod.inspect =~/"--b5"|"--papersize-b5"/ \ + or mod.inspect =~/"--papersize=\S*b5\b\S*"/ + { bool: true, set: :on } + else + { bool: false, set: :na } + end + act[:pdf_letter]=if mod.inspect =~/"--letter"|"--papersize-letter"/ \ + or mod.inspect =~/"--papersize=\S*letter\b\S*"/ + { bool: true, set: :on } + else + { bool: false, set: :na } + end + act[:pdf_legal]=if mod.inspect =~/"--legal"|"--papersize-legal"/ \ + or mod.inspect =~/"--papersize=\S*legal\b\S*"/ + { bool: true, set: :on } + else + { bool: false, set: :na } + end + end act[:epub]=(cmd =~/e/ \ || mod.inspect =~/"--epub"/) \ ? { bool: true, set: :on } @@ -743,10 +945,6 @@ module SiSU_Commandline || mod.inspect =~/"--git"/) \ ? { bool: true, set: :on } : { bool: false, set: :na } - act[:zap]=(cmd =~/Z/ \ - || mod.inspect =~/"--zap"|"--delete"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } act[:hash_digests]=(cmd =~/N/ \ || mod.inspect =~/"--hash-digests"/) \ ? { bool: true, set: :on } @@ -775,8 +973,8 @@ module SiSU_Commandline || mod.inspect =~/"--rsync"/) \ ? { bool: true, set: :on } : { bool: false, set: :na } - act[:delete_output]=(cmd =~/z/ \ - || mod.inspect =~/"--delete"|"--zap"/) \ + act[:zap]=(cmd =~/Z/ \ + || mod.inspect =~/"--zap"|"--delete"/) \ ? { bool: true, set: :on } : { bool: false, set: :na } act[:urls_all]=(cmd =~/U/ \ @@ -813,7 +1011,6 @@ module SiSU_Commandline def files_mod files_mod=files @files_mod=files_mod - @files_mod end def f_pth @f_pth @@ -831,46 +1028,38 @@ module SiSU_Commandline @lng_base end def fno - @fno=if @fno \ - and not @fno.empty? - @fno - else - fns[/(.+?(?:sst|ssm))(?:\.sst)?/,1] - end + @fno=(fns.nil? || fns.empty?) \ + ? '' \ + : (fns[/(.+?(?:sst|ssm))(?:\.sst)?/,1]) end def fng - @fng=if @fng \ - and not @fng.empty? - @fng - else - fno.gsub(/(?:~(?:#{Px[:lng_lst_rgx]}))?(\.ss[tm])$/,'\1') - end + @fng=(fno.nil? || fno.empty?) \ + ? '' \ + : (fno.gsub(/(?:~(?:#{Px[:lng_lst_rgx]}))?(\.ss[tm])$/,'\1')) end def fns @fns end def fnl - x=@fns.gsub(/(\S+?)((?:\.ssm)?\.sst)/,"\\1.#{lng}\\2") + @fns.gsub(/(\S+?)((?:\.ssm)?\.sst)/,"\\1.#{lng}\\2") end def what @what end def fnb - unless fns.empty? - fns[/(.+?)\.(?:(?:-|ssm\.)?sst|ssm)$/,1] - end + (fns.nil? || fns.empty?) \ + ? '' \ + : (fns[/(.+?)\.(?:(?:-|ssm\.)?sst|ssm)$/,1]) end def fnc - @fnc=if @fns =~/\.(?:ssm\.sst|ssm)$/ - fnb + '.ssm.sst' - else @fns - end + @fnc=(@fns =~/\.(?:ssm\.sst|ssm)$/) \ + ? fnb + '.ssm.sst' + : @fns end def fncb - @fncb=if @fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/ - fnb + '.ssm.sst' - else @fns.gsub(/(?:\~\S{2,3})?(\.sst)$/,'\1') - end + @fncb=(@fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/) \ + ? fnb + '.ssm.sst' + : @fns.gsub(/(?:\~\S{2,3})?(\.sst)$/,'\1') end end end diff --git a/lib/sisu/v3/param.rb b/lib/sisu/v5/param.rb index 0d882874..b2ced415 100644 --- a/lib/sisu/v3/param.rb +++ b/lib/sisu/v5/param.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/param.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/param.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -64,6 +64,7 @@ module SiSU_Param require 'pstore' require_relative 'sysenv' # sysenv.rb include SiSU_Env + require_relative 'param_make' # param_make.rb require_relative 'param_identify_markup' # param_identify_markup.rb require_relative 'help' # help.rb include SiSU_Help @@ -163,6 +164,8 @@ module SiSU_Param self end end + class MdMake < SiSU_Param_Make::MdMake + end class Md def initialize(str,opt,env) @s,@opt,@env=str,opt,env @@ -609,62 +612,52 @@ module SiSU_Param end self end - def classify - a=@s.split(/(\n%\s.+?$|[ ]*)(?:\n[ ]*(?=:)|\Z)/m) + def identifier + a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m) @h=build_hash(a) - def coverage - s=@h['coverage'] - l,n=Db[:col_classify_short],'classify.coverage' + def oclc + s=@h['oclc'] + l,n=Db[:col_library],'identifier.oclc' validate_length(s,l,n) end - def relation - s=@h['relation'] - l,n=Db[:col_classify_short],'classify.short' + def isbn + s=@h['isbn'] + l,n=Db[:col_small],'identifier.isbn' validate_length(s,l,n) end - def subject - s=@h['subject'] - l,n=Db[:col_classify_txt_short],'classify.subject' + def pg + s=@h['pg'] + l,n=Db[:col_small],'identifier.pg' validate_length(s,l,n) end + self + end + def classify + a=@s.split(/(\n%\s.+?$|[ ]*)(?:\n[ ]*(?=:)|\Z)/m) + @h=build_hash(a) def topic_register s=@h['topic_register'] l,n=Db[:col_info_note],'classify.topic_register' validate_length(s,l,n) end - def type - s=@h['type'] - l,n=Db[:col_classify_txt_short],'classify.type' + def subject + s=@h['subject'] + l,n=Db[:col_txt_long],'classify.subject' validate_length(s,l,n) end - def identifier - s=@h['identifier'] - l,n=Db[:col_classify_identify],'classify.identifier' + def keywords + s=@h['keywords'] + l,n=Db[:col_txt_long],'classify.keywords' validate_length(s,l,n) end def loc s=@h['loc'] - l,n=Db[:col_classify_library],'classify.loc' + l,n=Db[:col_library],'classify.loc' validate_length(s,l,n) end def dewey s=@h['dewey'] - l,n=Db[:col_classify_library],'classify.dewey' - validate_length(s,l,n) - end - def oclc - s=@h['oclc'] - l,n=Db[:col_classify_library],'classify.oclc' - validate_length(s,l,n) - end - def pg - s=@h['pg'] - l,n=Db[:col_classify_small],'classify.pg' - validate_length(s,l,n) - end - def isbn - s=@h['isbn'] - l,n=Db[:col_classify_small],'classify.isbn' + l,n=Db[:col_library],'classify.dewey' validate_length(s,l,n) end self @@ -741,262 +734,6 @@ module SiSU_Param # end # self #end - def make - a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m) - @h=build_hash(a) - def headings - lv=[] - x=@h['headings'] - x=((x =~/;/) ? (x.split(/;\s*/)) : [ x ]) - lv[0]=x - lv1=x[0] ||='1~ ' #some arbitrary changes made - lv[1]=/^#{lv1}/ - lv2=x[1] ||='2~ ' - lv[2]=/^#{lv2}/ - lv3=x[2] ||='3~ ' - lv[3]=/^#{lv3}/ - lv4=x[3] ||='4~ ' - lv[4]=/^#{lv4}/ - lv5=x[4] ||='5~ ' - lv[5]=/^#{lv5}/ - lv6=x[5] ||='6~ ' - lv[6]=/^#{lv6}/ - lv - end - def num_top - @h['num_top'] - end - def breaks - pagebreaks=((@h['breaks'] =~/;/) \ - ? (@h['breaks'].split(/;\s*/)) - : [ @h['breaks'] ]) - page_new,page_break=nil,nil - pagebreaks.each do |x| - page_new=x[/(:?[\dA-C],?)+/] if x=~/new|clear/ - page_break=x[/(:?[\dA-C],?)+/] if x =~/break/ - end - { page_new: page_new, page_break: page_break } - end - def language - l=if @h['language'] && (@h['language']=~/\S{2,}/) - ((@h['language'] =~/,/) \ - ? (@h['language'].split(/,\s*/)) - : [ @h['language'] ]) - else [ 'en' ] - end - end - def bold - m=@h['bold'] - i=(m=~/\/i$/)? 'i' : '' - z=if m - x=m.gsub(/^\/(.+?)\/i?/,'\1'). - gsub(/\((?:\?:)?/,'(?:') # avoid need to escape use of brackets within regex provided - rgx='\b(' + x + ')\b' - y=((i =~/i/) ? (/#{rgx}/i) : (/#{rgx}/)) - { str: '\b(?:' + x + ')\b', regx: y, i: i } - else nil - end - end - def italics - m=@h['italics'] - i=((m=~/\/i$/) ? 'i' : '') - z=if m - x=m.gsub(/^\/(.+?)\/i?/,'\1'). - gsub(/\((?:\?:)?/,'(?:') # avoid need to escape use of brackets within regex provided - rgx='\b(' + x + ')\b' - y=((i =~/i/) ? (/#{rgx}/i) : (/#{rgx}/)) - { str: '\b(?:' + x + ')\b', regx: y, i: i } - else nil - end - end - def emphasis - if @h['emphasis'] =~/bold/ then 'bold' - elsif @h['emphasis'] =~/italics?/ then 'italics' - elsif @h['emphasis'] =~/under(?:line|score)/ then 'underscore' - else nil - end - end - def substitute - m=@h['substitute'] - z=if m - w=m.scan(/\/(.+?)\/(i?,)\s*'(.+?)'(?:\s+|\s*;\s*|$)/) - arr_hash=[] - matches='' - w.each do |x| - c=(x[1] =~/[i],/) ? :i : :s - matches=matches + x[0].gsub(/([${}])/,'\\\\\1') + '|' - arr_hash << { - match: x[0].gsub(/([${}])/,'\\\\\1'), - replace: x[2], - case_s: c - } - end - matches.chop! - { match_and_replace: arr_hash, matches: matches } - else nil - end - end - def plaintext_wrap - if @h['plaintext_wrap'].to_s =~/\d\d+/ \ - and @h['plaintext_wrap'].to_i > 19 \ - and @h['plaintext_wrap'].to_i < 201 - @h['plaintext_wrap'].to_i - else nil - end - end - def omit - m=@h['omit'] - @m=m ? (m.split(/,\s+/)) : nil - def list - @m - end - self - end - def ocn? - (omit.list.inspect =~/"ocn"/) \ - ? :off - : :na - end - def toc? - (omit.list.inspect =~/"toc"/) \ - ? :off - : :na - end - def manifest? - (omit.list.inspect =~/"manifest"/) \ - ? :off - : :na - end - def links_to_manifest? - (omit.list.inspect =~/"manifest_links"|"links_to_manifest"/) \ - ? :off - : :na - end - def metadata? - (omit.list.inspect =~/"metadata"/) \ - ? :off - : :na - end - def minitoc? - (omit.list.inspect =~/"minitoc"/) \ - ? :off - : :na - end - def html_minitoc? - (omit.list.inspect =~/"html_minitoc"/) \ - ? :off - : :na - end - def html_top_band? - (omit.list.inspect =~/"html_top_band"/) \ - ? :off - : :na - end - def html_navigation? - (omit.list.inspect =~/"html_navigation"/) \ - ? :off - : :na - end - def html_navigation_bar? - (omit.list.inspect =~/"html_navigation_bar"/) \ - ? :off - : :na - end - def segsubtoc? - (omit.list.inspect =~/"segsubtoc"/) \ - ? :off - : :na - end - def search_form? - (omit.list.inspect =~/"search_form"/) \ - ? :off - : :na - end - def html_search_form? - (omit.list.inspect =~/"html_search_form"/) \ - ? :off - : :na - end - def html_right_pane? - (omit.list.inspect =~/"html_right_column"|"html_right_pane"/) \ - ? :off - : :na - end - def manifest_minitoc? - (omit.list.inspect =~/"manifest_minitoc"/) \ - ? :off - : :na - end - def texpdf_font - def main - @h['texpdf_font'] \ - && (@h['texpdf_font']=~/\S{3,}/) \ - ? @h['texpdf_font'] - : @env.font.texpdf.main - end - def sans # not used - @h['texpdf_font_sans'] \ - && (@h['texpdf_font_sans']=~/\S{3,}/) \ - ? @h['texpdf_font_sans'] - : @env.font.texpdf.sans - end - def serif # not used - @h['texpdf_font_serif'] \ - && (@h['texpdf_font_serif']=~/\S{3,}/) \ - ? @h['texpdf_font_serif'] - : @env.font.texpdf.serif - end - def mono - @h['texpdf_font_mono'] \ - && (@h['texpdf_font_mono']=~/\S{3,}/) \ - ? @h['texpdf_font_mono'] - : @env.font.texpdf.mono - end - self - end - def skin - @h['skin'] - end - def promo - @h['promo'] - end - def ad - @h['ad'] - end - def manpage - manpage={} - if @h['manpage'] - if @h['manpage'] =~/;/m - man=@h['manpage'].split(/;/m) - man.each do |x| - m=(x=~/=/m) ? x.split(/=/m) : nil - if m - manpage[m[0].strip] = m[1].split(/ \. /) - end - end - end - end - if manpage['name'] - manpage['name']=manpage['name'].join("\n.br\n"). - gsub(/(-)/m,"\\\\\\1"). - gsub(/\A/,"\n.br\n.SH NAME\n.br\n") - else - manpage['name']='man page "name/whatis" information not provided, set in header @man: name=[whatis information]' - end - if manpage['synopsis'] - manpage['synopsis']=manpage['synopsis'].join("\n\n.br\n"). - gsub(/(-)/m,"\\\\\\1"). - gsub(/\A/,"\n.br\n.SH SYNOPSIS\n.br\n") - else - manpage['synopsis']='' - end - unless manpage['section'] - manpage['section']=1 - end - manpage - end - self - end def current_publisher @s end @@ -1035,23 +772,53 @@ module SiSU_Param end self end - def links - a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m) - end def notes a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m) @h=build_hash(a) + def description + s=@h['description'] + l,n=Db[:col_info_note],'notes.description' + validate_length(s,l,n) + end def abstract - @h['abstract'] + s=@h['abstract'] + l,n=Db[:col_info_note],'notes.abstract' + validate_length(s,l,n) end def comment - @h['comment'] + s=@h['comment'] + l,n=Db[:col_info_note],'notes.comment' + validate_length(s,l,n) end - def description - @h['description'] + def coverage + s=@h['coverage'] + l,n=Db[:col_info_note],'notes.coverage' + validate_length(s,l,n) + end + def relation + s=@h['relation'] + l,n=Db[:col_info_note],'notes.relation' + validate_length(s,l,n) + end + def source + s=@h['source'] + l,n=Db[:col_txt_long],'notes.source' + validate_length(s,l,n) end def history - @h['history'] + s=@h['history'] + l,n=Db[:col_txt_long],'notes.history' + validate_length(s,l,n) + end + def type + s=@h['type'] + l,n=Db[:col_txt_long],'notes.relation' + validate_length(s,l,n) + end + def format + s=@h['format'] + l,n=Db[:col_txt_short],'notes.format' + validate_length(s,l,n) end def prefix @h['prefix'] @@ -1063,9 +830,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,:site_skin,:sisu,:sisu_version,:ruby_version,:title,:subtitle,:full_title,:html_title,:subtitle_tex,:creator,:classify,:author_home,:author,:author_title,:author_nationality,:authors,:authorship,:translator,:illustrator,:prepared_by,:digitized_by,:subject,:description,:publisher,:current_publisher,:contributor,:date,:date_created,:date_issued,:date_available,:date_valid,:date_modified,:date_translated,:date_added_to_site,:date_scheme,:date_created_scheme,:date_issued_scheme,:date_available_scheme,:date_valid_scheme,:date_modified_scheme,:type,:format,:identifier,:source,:language,:language_original,:relation,:coverage,:rights,:keywords,:comments,:abstract,:cls_loc,:cls_dewey,:cls_pg,:cls_isbn,:papersize,:papersize_array,:toc,:lv1,:lv2,:lv3,:lv4,:lv5,:lv6,:lvs,:pagenew,:pagebreak,:num_top,:toc_lev_limit,:flag_endnotes,:flag_auto_endnotes,:flag_separate_endnotes,:flag_separate_endnotes_make,:markup,:markup_instruction,:markup_version,:markup_declared,:flag_tables,:vocabulary,:doc_skin,: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,:dgst_skin,: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 + attr_accessor :make,:env,:path,:file,:fn,:fns,:fno,:fnb,:fnn,:fnt,:fnl,:flv,:fnz,:fnstex,:ocn,:sfx_src,:pdf,:file_type,:dir_out,:dir_tex,:dir_lout,:txt_path,:sisu,:sisu_version,:ruby_version,:title,:subtitle,:full_title,:html_title,:subtitle_tex,:creator,:classify,:author_home,:author,:author_title,:author_nationality,:authors,:authorship,:translator,:illustrator,:prepared_by,:digitized_by,:subject,:description,:publisher,:current_publisher,:contributor,:date,:date_created,:date_issued,:date_available,:date_valid,:date_modified,:date_translated,:date_added_to_site,:date_scheme,:date_created_scheme,:date_issued_scheme,:date_available_scheme,:date_valid_scheme,:date_modified_scheme,:type,:format,:identifier,:source,:language,:language_original,:relation,:coverage,:rights,:keywords,:comments,:abstract,:cls_loc,:cls_dewey,:cls_pg,:cls_isbn,:papersize,:papersize_array,:toc,:lv1,:lv2,:lv3,:lv4,:lv5,:lv6,:lvs,:pagenew,:pagebreak,:pageline,:num_top,:bold_match_list,:italics_match_list,:substitution_match_list,:emphasis_set_to,:toc_lev_limit,:flag_endnotes,:flag_auto_endnotes,:flag_separate_endnotes,:flag_separate_endnotes_make,:markup,:markup_instruction,:markup_version,:markup_declared,: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=@site_skin=@sisu=@sisu_version=@ruby_version=@title=@subtitle=@full_title=@html_title=@subtitle_tex=@creator=@classify=@author_home=@author=@author_title=@author_nationality=@translator=@illustrator=@prepared_by=@digitized_by=@subject=@description=@publisher=@current_publisher=@contributor=@date=@date_created=@date_issued=@date_available=@date_valid=@date_modified=@date_translated=@date_added_to_site=@date_scheme=@date_created_scheme=@date_issued_scheme=@date_available_scheme=@date_valid_scheme=@date_modified_scheme=@type=@format=@identifier=@source=@language=@language_original=@relation=@coverage=@rights=@keywords=@comments=@abstract=@cls_loc=@cls_dewey=@cls_pg=@cls_isbn=@papersize=@toc=@lv1=@lv2=@lv3=@lv4=@lv5=@lv6=@pagenew=@pagebreak=@num_top=@toc_lev_limit=@flag_tables=@vocabulary=@doc_skin=@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=@dgst_skin=@generated=@heading_seg_first=@base_program=@topic_register=@original=@writing_focus=@audio=nil + @env=@path,@file=@fn=@fns=@fno=@fnb=@fnn=@fnt=@fnl=@flv=@fnz=@fnstex=@ocn=@sfx_src=@pdf=@file_type=@dir_out=@dir_tex=@dir_lout=@txt_path=@make=@flag_endnotes=@flag_auto_endnotes=@flag_separate_endnotes=@flag_separate_endnotes_make=@sisu=@sisu_version=@ruby_version=@title=@subtitle=@full_title=@html_title=@subtitle_tex=@creator=@classify=@author_home=@author=@author_title=@author_nationality=@translator=@illustrator=@prepared_by=@digitized_by=@subject=@description=@publisher=@current_publisher=@contributor=@date=@date_created=@date_issued=@date_available=@date_valid=@date_modified=@date_translated=@date_added_to_site=@date_scheme=@date_created_scheme=@date_issued_scheme=@date_available_scheme=@date_valid_scheme=@date_modified_scheme=@type=@format=@identifier=@source=@language=@language_original=@relation=@coverage=@rights=@keywords=@comments=@abstract=@cls_loc=@cls_dewey=@cls_pg=@cls_isbn=@papersize=@toc=@lv1=@lv2=@lv3=@lv4=@lv5=@lv6=@pagenew=@pagebreak=@pageline=@num_top=@bold_match_list=@italics_match_list=@substitution_match_list=@emphasis_set_to=@toc_lev_limit=@flag_tables=@vocabulary=@doc_css=@yaml=@lnk=@links=@prefix_a=@prefix_b=@suffix=@information=@contact=@icon=@ad_url=@ad_png=@ad_alt=@ad_began=@promo=@ad_home=@stmp=@stmpd=@sc_filename=@sc_number=@sc_date=@sc_time=@sc_info=@yamladdr=@locale=@wc_lines=@wc_words=@wc_bytes=@file_encoding=@filesize=@firstseg=@programs=@author_copymark=@i18n=@lang=@lang_code_insert=@en=@notes=@dgst=@generated=@heading_seg_first=@base_program=@topic_register=@original=@writing_focus=@audio=@home_button_image=@home_button_links=@cover_image=@man_section=nil @data,@path,@fns,@fno,@opt=fns_array,opt.pth,opt.fns,opt.fno,opt #@data used as data @flag_tables,@set_header_title,@set_heading_top,@set_heading_seg,@heading_seg_first_flag,@flag_promo,@book_idx=false,false,false,false,false,false,false @seg_autoname_safe=true @@ -1076,6 +843,7 @@ module SiSU_Param @flv,@lang,@seg_names,@tags,@tag_array,@tag_a,@ec[:image],@ec[:audio],@ec[:multimedia]=Array.new(9){[]} @authors,@topic_register_array,@papersize_array=[],[],[] @lvs=[nil,0,0,0,0,0,0] + @emphasis_set_to='bold' @lang_code_insert=if @opt.act[:output_by][:set]==:language '' elsif @opt.act[:output_by][:set]==:filetype \ @@ -1086,6 +854,7 @@ module SiSU_Param else ".#{@opt.lng}" end + @footer_links= { left: { say: '', url: '' }, center: { say: '', url: '' } } @rgx_image=/(?:^|[^_\\])\{(?:\s*|\~\^\s+)(\S+?\.(?:png|jpg|gif)\b)/m @rgx_audio=/\{\s*(\S+?\.(?:mp3|ogg))/ @rgx_mm=/\{\s*(\S+?\.(?:ogg|mpeg))/ #expand and distinguish ogg @@ -1097,18 +866,39 @@ module SiSU_Param end ensure end - end - #protected - def determine_papersize(l) - l=case l - when /eu|europe|uk/i; 'A4' #European default, SiSU default - when /(?:us-)?legal|legal/i; 'US_legal' #U.S. alternative - when /(?:us-)?letter|u.s.|us/i; 'US_letter' #U.S. default - when /book_a5|a5/i; 'book_a5' - when /book_b5|b5|book/i; 'book_b5' #book default - larger - else 'A4' + @header_make_links_append=:no + common_makes=(defined? @opt.make_instructions_pod) \ + && @opt.make_instructions_pod !=nil \ + && @opt.make_instructions_pod[:makeset]==true \ + ? @opt.make_instructions_pod + : @opt.make_instructions + if common_makes[:makeset] + @pagenew=common_makes[:pagenew] + @pagebreak=common_makes[:pagebreak] + @pageline=common_makes[:pageline] + @toc=common_makes[:toc] + @lv1=common_makes[:lv1] + @lv2=common_makes[:lv2] + @lv3=common_makes[:lv3] + @lv4=common_makes[:lv4] + @lv5=common_makes[:lv5] + @lv6=common_makes[:lv6] + @num_top=common_makes[:num_top] + @i18n=common_makes[:i18n] + @man_section=common_makes[:man_section] + @emphasis_set_to=common_makes[:emphasis_set_to] + @bold_match_list=common_makes[:bold_match_list] + @italics_match_list=common_makes[:italics_match_list] + @substitution_match_list=common_makes[:substitution_match_list] + @footer_links=common_makes[:footer_links] + @home_button_links=common_makes[:home_button_links] + @home_button_image=common_makes[:home_button_image] + @cover_image=common_makes[:cover_image] + @lnk=@links=common_makes[:links] + @header_make_links_append=common_makes[:links_append] end end + #protected def extract @user,@home,@hostname,@pwd=ENV['USER'],ENV['HOME'],ENV['HOSTNAME'],ENV['PWD'] @programs,@wc,@language,@language_original={},{},{},{} @@ -1234,61 +1024,76 @@ module SiSU_Param @rights=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).rights when /^@classify:(.+)/m; classify=$1 #% * header metadata - classify @classify=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).classify + when /^@identifier:(.+)/m; identify=$1 #% * header metadata - identifier + @identifier=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).identifier when /^@original:(.+)/m #% * header metadata - original (document) @original=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).original @source=@original.source when /^@notes?:\s(.+)\Z/m #% * header metadata - notes @notes=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).notes when /^@links:\s+(.+?)\Z/m #% * header metadata - links - doc_links=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).links - a_idx=0 - @links=[] - doc_links.each do |doc_link| - if doc_link=~/\{.+?\}(?:(?:https?|file|ftp):\/|\.\.)\/\S+(?:\s|$)/ - @links[a_idx]={} - @links[a_idx][:say],@links[a_idx][:url]=/\{\s*(.+?)\s*\}((?:(?:https?|file|ftp):\/|\.\.)\/\S+)/im.match(doc_link)[1,2] - a_idx +=1 - end + links=SiSU_Param::Parameters::MdMake.new($1.strip,@opt,@env).make_links.links + @lnk=@links=if @header_make_links_append == :yes + (links) \ + ? (links + @links) + : @links + else + (links) \ + ? (links) + : @links end - @lnk=@links when /^@make:(.+)/m #% * header processing - make - @make=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).make - if defined? @make.breaks \ - and @make.breaks[:page_new] #clearpage - @pagenew=@make.breaks[:page_new] - end - if defined? @make.breaks \ - and @make.breaks[:page_break] #newpage - @pagebreak=@make.breaks[:page_break] - end - if defined? @make.headings \ - and @make.headings - @toc=@make.headings[0] - @lv1=@make.headings[1] - @lv2=@make.headings[2] - @lv3=@make.headings[3] - @lv4=@make.headings[4] - @lv5=@make.headings[5] - @lv6=@make.headings[6] - end - if defined? @make.num_top \ - and @make.num_top - @num_top=@make.num_top # remove @num_top - end - if defined? @make.language \ - and @make.language[0] - @i18n=@make.language - end - if defined? @make.skin \ - and @make.skin - @doc_skin=@make.skin - end - if defined? @make.manpage \ - and @make.manpage - @man_section=(defined? @make.manpage.section) \ - ? @make.manpage.section - : 1 - end + @make=SiSU_Param::Parameters::MdMake.new($1.strip,@opt,@env).make + makes=SiSU_Param_Make::MakeHead.new(@make).make_instruct + @pagenew=(makes[:pagenew]) \ + ? (makes[:pagenew]) \ + : @pagenew + @pagebreak=(makes[:pagebreak]) \ + ? (makes[:pagebreak]) \ + : @pagebreak + @pageline=(makes[:pageline]) \ + ? (makes[:pageline]) \ + : @pageline + @toc=(makes[:toc]) ? (makes[:toc]) : @toc + @lv1=(makes[:lv1]) ? (makes[:lv1]) : @lv1 + @lv2=(makes[:lv2]) ? (makes[:lv2]) : @lv2 + @lv3=(makes[:lv3]) ? (makes[:lv3]) : @lv3 + @lv4=(makes[:lv4]) ? (makes[:lv4]) : @lv4 + @lv5=(makes[:lv5]) ? (makes[:lv5]) : @lv5 + @lv6=(makes[:lv6]) ? (makes[:lv6]) : @lv6 + @num_top=(makes[:num_top]) \ + ? (makes[:num_top]) \ + : @num_top + @substitution_match_list=(makes[:substitution_match_list]) \ + ? (makes[:substitution_match_list]) \ + : @substitution_match_list + @bold_match_list=(makes[:bold_match_list]) \ + ? (makes[:bold_match_list]) \ + : @bold_match_list + @italics_match_list=(makes[:italics_match_list]) \ + ? (makes[:italics_match_list]) \ + : @italics_match_list + @emphasis_set_to=(makes[:emphasis_set_to]) \ + ? (makes[:emphasis_set_to]) \ + : @emphasis_set_to + @i18n=(makes[:i18n]) \ + ? (makes[:i18n]) \ + : @i18n + @man_section=(makes[:man_section]) \ + ? (makes[:man_section]) \ + : @man_section + @footer_links=(makes[:footer_links]) \ + ? (makes[:footer_links]) \ + : @footer_links + @home_button_links=(makes[:home_button_links]) \ + ? (makes[:home_button_links]) \ + : @home_button_links + @home_button_image=(makes[:home_button_image]) \ + ? (makes[:home_button_image]) \ + : @home_button_image + @cover_image=(makes[:cover_image]) \ + ? (makes[:cover_image]) \ + : @cover_image end @lv1 ||=/^1~/ @lv2 ||=/^2~/ @@ -1349,8 +1154,13 @@ module SiSU_Param tf="@title: #{tf}" @title=SiSU_Param::Parameters::Md.new(tf.strip,@opt,@env).title end - @html_title=@title.full.gsub(/(<p>|<p \/>|<br>|<br \/>)/,'') - SiSU_Screen::Ansi.new(@opt.cmd,'Parameters',@html_title).txt_grey if @opt.cmd =~/v/ + creator=(@creator.is_a?(SiSU_Param::Parameters::Md) \ + && defined? @creator.author \ + && @creator.author.is_a?(String)) \ + ? " #{@creator.author}" + : '' + title=%{"#{@title.full.gsub(/(<p>|<p \/>|<br>|<br \/>)/,'')}",} + SiSU_Screen::Ansi.new(@opt.cmd,'Parameters',%{#{title}#{creator}}).txt_grey if @opt.cmd =~/v/ end if not @book_idx \ and para =~/^=\{(.+?)\}\s*$/ @@ -1412,7 +1222,19 @@ module SiSU_Param if @opt.cmd =~/[VM]/ SiSU_Screen::Ansi.new(@opt.cmd,'@make:','header absent').warn end - @make=SiSU_Param::Parameters::Md.new('@make: ',@opt,@env).make + @make=SiSU_Param::Parameters::MdMake.new('@make: ',@opt,@env).make + end + if @cover_image \ + and @cover_image.is_a?(Hash) \ + and (@cover_image[:cover] =~@rgx_image \ + or @cover_image[:cover] =~/\S+?.(?:jpg|png|gif)/) + @ec[:image] << @cover_image[:cover] + end + if @home_button_image \ + and @home_button_image.is_a?(Hash) \ + and (@home_button_image =~@rgx_image \ + or @home_button_image =~/\S+?\.(?:jpg|png|gif)/) + @ec[:image] << @home_button_image end if @ec[:image].length > 0 @ec[:image]=@ec[:image].flatten.uniq @@ -1455,7 +1277,7 @@ module SiSU_Param end if @markup_version.determined >= 0.38 #convert values in headers to internal representation translated=[] - translate_list=[@pagenew,@pagebreak,@num_top,@toc_lev_limit] + translate_list=[@pagenew,@pagebreak,@pageline,@num_top,@toc_lev_limit] translate_list.each do |t| translate=t.to_s if t translated << if translate @@ -1478,35 +1300,40 @@ module SiSU_Param else nil end end - @pagenew,@pagebreak,@num_top,@toc_lev_limit=translated + @pagenew,@pagebreak,@pageline,@num_top,@toc_lev_limit=translated @markup=@markup.gsub(/page_new\s*=\s*([\dA-C])/,"page_new=#{@pagenew}"). gsub(/page_break\s*=\s*([\dA-C])/,"page_break=#{@pagebreak}"). + gsub(/page_line\s*=\s*([\dA-C])/,"page_line=#{@pageline}"). gsub(/num_top\s*=\s*([\dA-C])/,"num_top=#{@num_top}"). gsub(/toc_lev_limit\s*=\s*([\dA-C])/,"toc_lev_limit=#{@toc_lev_limit}") end - if @opt.mod.inspect =~/--papersize[=-]\S+|--pdf[=-]\S+/ \ - or @opt.mod.inspect =~/--(?:a4|letter|legal|book|a5|b5)\b/i #command line config/header override - @papersize=determine_papersize(@opt.mod.inspect) - end - @papersize_array=@papersize.scan(/(?:a4|letter|legal|book|a5|b5)/i) + papersize_array_rc=@papersize.downcase.scan(/(?:a4|letter|legal|book|a5|b5)/) + papersize_array_opt=[ + ((@opt.act[:pdf_a4][:set]==:on) ? 'a4' : ''), + ((@opt.act[:pdf_a5][:set]==:on) ? 'a5' : ''), + ((@opt.act[:pdf_b5][:set]==:on) ? 'b5' : ''), + ((@opt.act[:pdf_letter][:set]==:on) ? 'letter' : ''), + ((@opt.act[:pdf_legal][:set]==:on) ? 'legal' : ''), + ] - [""] + @papersize_array=(papersize_array_opt.length > 0) \ + ? papersize_array_opt + : papersize_array_rc fn=@opt.fno #decide what to do a filesize on .ssm tells very little about actual document size @filesize=(File.size(fn)).to_s - if @sys.openssl !=false - skin=@doc_skin \ - ? (SiSU_Env::InfoSkin.new(@opt,@doc_skin).select) - : SiSU_Env::InfoSkin.new(@opt).select - @dgst,@dgst_skin=[],[] + if @sys.openssl !=false \ + and FileTest.file?(@env.source_file_with_path) + @dgst=[] if @env.digest.type =~/sha256/ dgst=@sys.sha256(@env.source_file_with_path) @dgst=dgst[1].length==64 ? dgst : nil puts 'check document (sha256) digest' if not @dgst - @dgst_skin=skin ? (@sys.sha256(skin)) : nil else dgst=@sys.md5(@env.source_file_with_path) @dgst=dgst[1].length==32 ? dgst : nil puts 'check document (md5) digest' if not @dgst - @dgst_skin=skin ? (@sys.md5(skin)) : nil end + elsif not FileTest.file?(@env.source_file_with_path) + #puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).set(:fuchsia) end @publisher ||= "#{@@publisher} (this copy)" fn_set_lang=SiSU_Env::StandardiseLanguage.new(@opt.lng).language @@ -1521,19 +1348,8 @@ module SiSU_Param @language[:name]=fn_set_lang[:n] end @fnl=@env.i18n.lang_filename(fn_set_lang[:c]) -#fix -# @flv.each do |l| -# lang=SiSU_Env::StandardiseLanguage.new.file_to_language(l) -# c={ a: '', b: '', c: '' } -# if @fnl[:pre] =~/\S/ then c[:a]="#{lang[:c]}." -# elsif @fnl[:mid] =~/\S/ then c[:b]=".#{lang[:c]}" -# elsif @fnl[:post] =~/\S/ then c[:c]=".#{lang[:c]}" -# end -# @lang << [lang[:n],"#{c[:a]}sisu_manifest#{c[:b]}.html#{c[:c]}"] -# end if @flv @lang=@lang.uniq @fn=SiSU_Env::EnvCall.new(@fns).lang(fn_set_lang[:c]) - @identifier="#{@env.url.root}/#{@fnb}/#{@fn[:toc]}" #DC note constructed dc identifier if @en[:note] > 0 \ and @en[:sum] > 0 if @en[:sum] > 0 @@ -1628,9 +1444,6 @@ module SiSU_Param @lv4 ||=/^4~/ @lv5 ||=/^5~/ @lv6 ||=/^6~/ - if @doc_skin - SiSU_Screen::Ansi.new(@opt.cmd,"doc_skin <- #{@doc_skin}").txt_grey if @opt.cmd =~/v/ - end @data=nil #else whole file's contents are stored in md pstore & is not required to be... big waste actually @file=SiSU_Env::FileOp.new(self) #watch Store.new(self,@env).store #% pstore diff --git a/lib/sisu/v3/param_identify_markup.rb b/lib/sisu/v5/param_identify_markup.rb index 6449759b..148c73d5 100644 --- a/lib/sisu/v3/param_identify_markup.rb +++ b/lib/sisu/v5/param_identify_markup.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/param_identify_markup.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/param_identify_markup.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v5/param_make.rb b/lib/sisu/v5/param_make.rb new file mode 100644 index 00000000..24a4dbb7 --- /dev/null +++ b/lib/sisu/v5/param_make.rb @@ -0,0 +1,646 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008, 2009, 2010, 2011, 2012, 2013 Ralph Amissah, All Rights Reserved. + + * License: GPL 3 or later: + + SiSU, a framework for document structuring, publishing and search + + Copyright (C) Ralph Amissah + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public Lic/home/ralph/live-manual/build/manual/manifest/live-manual.ca.htmlense for + more details. + + You should have received a copy of the GNU General Public License along with + this program. If not, see <http://www.gnu.org/licenses/>. + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + <http://www.fsf.org/licensing/licenses/gpl.html> + <http://www.gnu.org/licenses/gpl.html> + + <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + <http://www.jus.uio.no/sisu> + <http://www.sisudoc.org> + + * Download: + <http://www.sisudoc.org/sisu/en/SiSU/download.html> + + * Git + <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/param_make.rb;hb=HEAD> + + * Ralph Amissah + <ralph@amissah.com> + <ralph.amissah@gmail.com> + + ** Description: make parameters extracted for program use + +=end + +module SiSU_Param_Make + class MdMake + def initialize(str,opt,env) + @s,@opt,@env=str,opt,env + end + def validate_length(s,l,n) + #s=(s.length <= l) ? s : nil + s=if s.is_a?(String) \ + and s.length <= l + s + elsif s.is_a?(NilClass) + nil + elsif s.class !=String + STDERR.puts "#{n} is #{s.class}: programming error, String expected #{__FILE__}:#{__LINE__}" + s + else + SiSU_Screen::Ansi.new('v',"*WARN* #{n} length #{s.length} exceeds set db field length #{l}, metadata dropped",@opt.fns).warn unless @opt.cmd =~/q/ + nil + end + end + def name_format(name) + if name + name=name.strip + @name_a_h=[] + authors=name.scan(/[^;]+/) + authors.each_with_index do |a,i| + b=((a =~/\s*\|\s*/) ? (a.split(/\|/)) : [a]) + if b[0] =~/"(.+?)"/ + @name_a_h << { the: $1 } + else + x=b[0].scan(/[^,]+/) + if x.length==1 + @name_a_h << { the: x[0].strip } + elsif x.length==2 + @name_a_h << { the: x[0].strip, others: x[1].strip } + else #p x.length + end + end + b.delete_at(0) + b.each do |d| + k,c=nil + k,c=/^(\S+)\s+(.*)/.match(d)[1,2] if d + @name_a_h[i][:hon]=c.strip if k=='hon' + @name_a_h[i][:affiliation]=c.strip if k=='affiliation' + @name_a_h[i][:nationality]=c.strip if k=='nationality' + end + end + l=@name_a_h.length + name_str='' + @name_a_h.each_with_index do |a,i| + name_str += if a[:others] + z=(((l - i) > 1) ? ', ' : '') + "#{a[:others].strip} #{a[:the].strip}" + z + else + z=(((l - i) > 2) ? ', ' : '') + "#{a[:the].strip}" + z + end + end + { name_a_h: @name_a_h, name_str: name_str } + else nil + end + end + def build_hash(arr) + @h={} + arr.each_with_index do |x,i| + a,b=nil,nil + if x =~/^%[:\s]/ #ignore comment + elsif x =~/:(\S+?):\s+(.+)/ + a,b=/:(\S+?):\s+(.+)\Z/m.match(x)[1,2] + elsif i == 0 + a='main' + b=x + else + end + @h[a]=b + end + @h + end + def make + a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m) + @h=build_hash(a) + def headings + lv=[] + x=@h['headings'] + x=((x =~/;/) ? (x.split(/;\s*/)) : [ x ]) + lv[0]=x + lv1=x[0] ||='1~ ' #some arbitrary changes made + lv[1]=/^#{lv1}/ + lv2=x[1] ||='2~ ' + lv[2]=/^#{lv2}/ + lv3=x[2] ||='3~ ' + lv[3]=/^#{lv3}/ + lv4=x[3] ||='4~ ' + lv[4]=/^#{lv4}/ + lv5=x[4] ||='5~ ' + lv[5]=/^#{lv5}/ + lv6=x[5] ||='6~ ' + lv[6]=/^#{lv6}/ + lv + end + def num_top + @h['num_top'] + end + def breaks + pagebreaks=((@h['breaks'] =~/;/) \ + ? (@h['breaks'].split(/;\s*/)) + : [ @h['breaks'] ]) + page_new,page_break,page_line=nil,nil,nil + pagebreaks.each do |x| + page_new=x[/(:?[\dA-C],?)+/] if x=~/new|clear/ + page_break=x[/(:?[\dA-C],?)+/] if x =~/break/ + page_line=x[/(:?[\dA-C],?)+/] if x =~/line/ + end + { page_new: page_new, page_break: page_break, page_line: page_line } + end + def language + l=if @h['language'] && (@h['language']=~/\S{2,}/) + ((@h['language'] =~/,/) \ + ? (@h['language'].split(/,\s*/)) + : [ @h['language'] ]) + else [ 'en' ] + end + end + def bold + m=@h['bold'] + i=(m=~/\/i$/)? 'i' : '' + z=if m + x=m.gsub(/^\/(.+?)\/i?/,'\1'). + gsub(/\((?:\?:)?/,'(?:') # avoid need to escape use of brackets within regex provided + rgx='\b(' + x + ')\b' + y=((i =~/i/) ? (/#{rgx}/i) : (/#{rgx}/)) + { str: '\b(?:' + x + ')\b', regx: y, i: i } + else nil + end + end + def italics + m=@h['italics'] + i=((m=~/\/i$/) ? 'i' : '') + z=if m + x=m.gsub(/^\/(.+?)\/i?/,'\1'). + gsub(/\((?:\?:)?/,'(?:') # avoid need to escape use of brackets within regex provided + rgx='\b(' + x + ')\b' + y=((i =~/i/) ? (/#{rgx}/i) : (/#{rgx}/)) + { str: '\b(?:' + x + ')\b', regx: y, i: i } + else nil + end + end + def emphasis + if @h['emphasis'] =~/bold/ then 'bold' + elsif @h['emphasis'] =~/italics?/ then 'italics' + elsif @h['emphasis'] =~/under(?:line|score)/ then 'underscore' + else nil + end + end + def substitute + m=@h['substitute'] + z=if m + w=m.scan(/\/(.+?)\/(i?,)\s*'(.+?)'(?:\s+|\s*;\s*|$)/) + arr_hash=[] + matches='' + w.each do |x| + c=(x[1] =~/[i],/) ? :i : :s + matches=matches + x[0].gsub(/([${}])/,'\\\\\1') + '|' + arr_hash << { + match: x[0].gsub(/([${}])/,'\\\\\1'), + replace: x[2], + case_s: c + } + end + matches.chop! + { match_and_replace: arr_hash, matches: matches } + else nil + end + end + def plaintext_wrap + if @h['plaintext_wrap'].to_s =~/\d\d+/ \ + and @h['plaintext_wrap'].to_i > 19 \ + and @h['plaintext_wrap'].to_i < 201 + @h['plaintext_wrap'].to_i + else nil + end + end + def omit + m=@h['omit'] + @m=m ? (m.split(/,\s+/)) : nil + def list + @m + end + self + end + def ocn? + (omit.list.inspect =~/"ocn"/) \ + ? :off + : :na + end + def toc? + (omit.list.inspect =~/"toc"/) \ + ? :off + : :na + end + def manifest? + (omit.list.inspect =~/"manifest"/) \ + ? :off + : :na + end + def links_to_manifest? + (omit.list.inspect =~/"manifest_links"|"links_to_manifest"/) \ + ? :off + : :na + end + def metadata? + (omit.list.inspect =~/"metadata"/) \ + ? :off + : :na + end + def minitoc? + (omit.list.inspect =~/"minitoc"/) \ + ? :off + : :na + end + def html_minitoc? + (omit.list.inspect =~/"html_minitoc"/) \ + ? :off + : :na + end + def html_top_band? + (omit.list.inspect =~/"html_top_band"/) \ + ? :off + : :na + end + def html_navigation? + (omit.list.inspect =~/"html_navigation"/) \ + ? :off + : :na + end + def html_navigation_bar? + (omit.list.inspect =~/"html_navigation_bar"/) \ + ? :off + : :na + end + def segsubtoc? + (omit.list.inspect =~/"segsubtoc"/) \ + ? :off + : :na + end + def search_form? + (omit.list.inspect =~/"search_form"/) \ + ? :off + : :na + end + def html_search_form? + (omit.list.inspect =~/"html_search_form"/) \ + ? :off + : :na + end + def html_right_pane? + (omit.list.inspect =~/"html_right_column"|"html_right_pane"/) \ + ? :off + : :na + end + def manifest_minitoc? + (omit.list.inspect =~/"manifest_minitoc"/) \ + ? :off + : :na + end + def cover_image? + (omit.list.inspect =~/"cover_image"/) \ + ? :off + : :na + end + def home_button_image? + (omit.list.inspect =~/"home_button_image"/) \ + ? :off + : :na + end + def texpdf_font + def main + @h['texpdf_font'] \ + && (@h['texpdf_font']=~/\S{3,}/) \ + ? @h['texpdf_font'] + : @env.font.texpdf.main + end + def sans # not used + @h['texpdf_font_sans'] \ + && (@h['texpdf_font_sans']=~/\S{3,}/) \ + ? @h['texpdf_font_sans'] + : @env.font.texpdf.sans + end + def serif # not used + @h['texpdf_font_serif'] \ + && (@h['texpdf_font_serif']=~/\S{3,}/) \ + ? @h['texpdf_font_serif'] + : @env.font.texpdf.serif + end + def mono + @h['texpdf_font_mono'] \ + && (@h['texpdf_font_mono']=~/\S{3,}/) \ + ? @h['texpdf_font_mono'] + : @env.font.texpdf.mono + end + self + end + def promo + @h['promo'] + end + def ad + @h['ad'] + end + def manpage + manpage={} + if @h['manpage'] + if @h['manpage'] =~/;/m + man=@h['manpage'].split(/;/m) + man.each do |x| + m=(x=~/=/m) ? x.split(/=/m) : nil + if m + manpage[m[0].strip] = m[1].split(/ \. /) + end + end + end + end + if manpage['name'] + manpage['name']=manpage['name'].join("\n.br\n"). + gsub(/(-)/m,"\\\\\\1"). + gsub(/\A/,"\n.br\n.SH NAME\n.br\n") + else + manpage['name']='man page "name/whatis" information not provided, set in header @man: name=[whatis information]' + end + if manpage['synopsis'] + manpage['synopsis']=manpage['synopsis'].join("\n\n.br\n"). + gsub(/(-)/m,"\\\\\\1"). + gsub(/\A/,"\n.br\n.SH SYNOPSIS\n.br\n") + else + manpage['synopsis']='' + end + unless manpage['section'] + manpage['section']=1 + end + manpage + end + def get_image_dimensions(img) + imgk=SiSU_Env::SystemCall.new.imagemagick + gmgk=SiSU_Env::SystemCall.new.graphicksmagick + img_pth={ + sst: @env.path.image_source_include, + pod: File.expand_path("../../../sisupod/image" ) + } + path_img=if FileTest.file?("#{img_pth[:pod]}/#{img}") + "#{img_pth[:pod]}/#{img}" + elsif FileTest.file?("#{img_pth[:sst]}/#{img}") + "#{img_pth[:sst]}/#{img}" + else nil + end + if path_img + if imgk or gmgk + if imgk + imgsys=`identify #{path_img}`.strip #system call + elsif gmgk + imgsys=`gm identify #{path_img}`.strip #system call + end + w,h=/(\d+)x(\d+)/m.match(imgsys)[1,2] + else + w,h='600','800' + end + else + w,h=nil,nil + end + {w: w, h: h} + end + def home_button_text + s=if @h['home_button_text'] + @h['home_button_text'].split(/\s*;\s*/) + else nil + end + #l,n=Db[:home_button],'make.home_button_text' + #validate_length(s,l,n) + end + def home_button_image + s=nil + s=if @h['home_button_image'] + s=@h['home_button_image'].split(/\s*;\s*/) + s0=s[0] #if + image={} + s=if s0 =~/{(\S+\.(?:jpg|png|gif))(?:\s+(\d+x\d+))?\s*}(?:(http:\/\/\S+)|image)/ + image[:home_button]=$1 + if $2 + image[:dimensions]=$2 + image[:w],image[:h]=/(\d+)x(\d+)/m.match(image[:dimensions])[1,2] + else + d=get_image_dimensions(image[:home_button]) + image[:w],image[:h]=d[:w],d[:h] + image[:dimensions]="#{d[:w]}x#{d[:h]}" + end + image[:link]=$3 + image + end + else nil + end + end + def cover_image + s=nil + if @h['cover_image'] + s=@h['cover_image'].split(/\s*;\s*/) + s=s[0] #if + image={} + if s =~/{\s*(\S+\.(?:jpg|png|gif))(?:\s+(\d+x\d+))?(?:\s+"(.+?)")?\s*}image/ + image[:cover]=$1 + if $2 + image[:dimensions]=$2 + image[:w],image[:h]=/(\d+)x(\d+)/m.match(image[:dimensions])[1,2] + else + d=get_image_dimensions(image[:cover]) + image[:w],image[:h]=d[:w],d[:h] + image[:dimensions]="#{d[:w]}x#{d[:h]}" + end + image[:note]=$3 + elsif s =~/(\S+\.(?:jpg|png|gif))/ + image[:cover]=$1 + d=get_image_dimensions(image[:cover]) + image[:w],image[:h]=d[:w],d[:h] + image[:dimensions]="#{d[:w]}x#{d[:h]}" + image[:note]=nil + end + image + else nil + end + end + def footer + s=if @h['footer'] + @h['footer'].split(/\s*;\s*/) + else nil + end + end + self + end + def make_links + @doc_links=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m) + def links + lnks,a_idx=[],0 + @doc_links.each do |doc_link| + if doc_link=~/\{.+?\}(?:(?:https?|file|ftp):\/|\.\.)\/\S+(?:\s|$)/ + say,url=/\{\s*(.+?)\s*\}((?:(?:https?|file|ftp):\/|\.\.)\/\S+)/im.match(doc_link)[1,2] + lnks[a_idx]={ say: say, url: url } + a_idx +=1 + end + end + lnks + end + def append? + (@doc_links[0]=='+') \ + ? :yes + : :no + end + self + end + end + class MakeHead + attr_accessor :pagenew,:pagebreak,:pageline,:toc,:lv1,:lv2,:lv3,:lv4,:lv5,:lv6,:num_top,:i18n,:man_section,:substitution_match_list,:bold_match_list,:italics_match_list,:emphasis_set_to,:footer_links,:home_button_links,:home_button_image,:cover_image + def initialize(make) + @make=make + end + def clear + @pagenew=@pagebreak=@pageline=@toc=@lv1=@lv2=@lv3=@lv4=@lv5=@lv6=@num_top=@i18n=@man_section=@footer_links=@substitution_match_list=@bold_match_list=@italics_match_list=@emphasis_set_to=@home_button_links=@home_button_image=@cover_image=nil + end + def make_instruct + clear + if defined? @make.breaks \ + and @make.breaks[:page_new] #clearpage + @pagenew=@make.breaks[:page_new] + end + if defined? @make.breaks \ + and @make.breaks[:page_break] #newpage + @pagebreak=@make.breaks[:page_break] + end + if defined? @make.breaks \ + and @make.breaks[:page_line] #page line across + @pagebreak=@make.breaks[:page_line] + end + if defined? @make.headings \ + and @make.headings + @toc=@make.headings[0] + @lv1=@make.headings[1] + @lv2=@make.headings[2] + @lv3=@make.headings[3] + @lv4=@make.headings[4] + @lv5=@make.headings[5] + @lv6=@make.headings[6] + end + if defined? @make.num_top \ + and @make.num_top + @num_top=@make.num_top # remove @num_top + end + if defined? @make.language \ + and @make.language[0] + @i18n=@make.language + end + if defined? @make.manpage \ + and @make.manpage + @man_section=(defined? @make.manpage.section) \ + ? @make.manpage.section + : 1 + end + if defined? @make.substitute \ + and @make.substitute + @substitution_match_list=@make.substitute + end + if defined? @make.bold \ + and @make.bold + @bold_match_list=@make.bold + end + if defined? @make.italics \ + and @make.italics + @italics_match_list=@make.italics + end + if defined? @make.emphasis \ + and @make.emphasis + @emphasis_set_to=@make.emphasis + end + if defined? @make.footer \ + and @make.footer.is_a?(Array) + @footer_links= { left: { say: '', url: '' }, center: { say: '', url: '' } } #already set + @footer_links[:left]=if @make.footer[0]=~/\{.+?\}(?:(?:https?|file|ftp):\/|\.\.)\/\S+(?:\s|$)/ + say,url=/\{\s*(.+?)\s*\}((?:(?:https?|file|ftp):\/|\.\.)\/\S+)/im.match(@make.footer[0])[1,2] + { say: say, url: url } + else + { say: '', url: '' } + end + @footer_links[:center]=if @make.footer[1]=~/\{.+?\}(?:(?:https?|file|ftp):\/|\.\.)\/\S+(?:\s|$)/ + say,url=/\{\s*(.+?)\s*\}((?:(?:https?|file|ftp):\/|\.\.)\/\S+)/im.match(@make.footer[1])[1,2] + { say: say, url: url } + else + { say: '', url: '' } + end + @footer_links + else #already set + @footer_links= { left: { say: '', url: '' }, center: { say: '', url: '' } } + end + if defined? @make.home_button_text \ + and @make.home_button_text.is_a?(Array) + a_idx=0 + @home_button_links=[] + @make.home_button_text.each do |doc_link| + if doc_link=~/\{.+?\}(?:(?:https?|file|ftp):\/|\.\.)\/\S+(?:\s|$)/ + say,url=/\{\s*(.+?)\s*\}((?:(?:https?|file|ftp):\/|\.\.)\/\S+)/im.match(doc_link)[1,2] + @home_button_links[a_idx]= { say: say, url: url } + a_idx +=1 + end + end + @home_button_links + end + if defined? @make.home_button_image \ + and @make.home_button_image.is_a?(Hash) + @home_button_image=@make.home_button_image + end + if defined? @make.cover_image \ + and @make.cover_image.is_a?(Hash) + @cover_image=@make.cover_image + end + { pagenew: @pagenew, + pagebreak: @pagebreak, + pageline: @pageline, + toc: @toc, + lv1: @lv1, + lv2: @lv2, + lv3: @lv3, + lv4: @lv4, + lv5: @lv5, + lv6: @lv6, + num_top: @num_top, + i18n: @i18n, + emphasis_set_to: @emphasis_set_to, + bold_match_list: @bold_match_list, + italics_match_list: @italics_match_list, + substitution_match_list: @substitution_match_list, + man_section: @man_section, + footer_links: @footer_links, + home_button_links: @home_button_links, + home_button_image: @home_button_image, + cover_image: @cover_image, + } + end + end +end +__END__ diff --git a/lib/sisu/v3/particulars.rb b/lib/sisu/v5/particulars.rb index ca77074c..7cc54737 100644 --- a/lib/sisu/v3/particulars.rb +++ b/lib/sisu/v5/particulars.rb @@ -51,7 +51,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/particulars.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/particulars.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -207,8 +207,14 @@ module SiSU_Particulars @nametags_map=SiSU_DAL::Source.new(opt).get_map_nametags self rescue - SiSU_Errors::InfoError.new($!,$@,opt.cmd,opt.fnl).error do - __LINE__.to_s + ':' + __FILE__ + if @md + SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.opt.fnl).error do + __LINE__.to_s + ':' + __FILE__ + end + else + SiSU_Errors::InfoError.new($!,$@,opt.cmd,opt.fnl).error do + __LINE__.to_s + ':' + __FILE__ + end end end end diff --git a/lib/sisu/v3/plaintext.rb b/lib/sisu/v5/plaintext.rb index 898b355c..9980b170 100644 --- a/lib/sisu/v3/plaintext.rb +++ b/lib/sisu/v5/plaintext.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/plaintext.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/plaintext.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -77,7 +77,7 @@ module SiSU_Plaintext def initialize(opt) @opt=opt unless @opt.fns =~/(.+?)\.(?:-|ssm\.)?sst$/ - puts "#{sf} not a processed file type" + puts "#{sf} not a processed file type" end end def read @@ -105,7 +105,6 @@ module SiSU_Plaintext end #wrap_width=(defined? md.make.plaintext_wrap) ? md.make.plaintext_wrap : 78 SiSU_Plaintext::Source::Scroll.new(md,dal_array,wrap_width).songsheet - SiSU_Env::InfoSkin.new(md).select #watch rescue SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do __LINE__.to_s + ':' + __FILE__ @@ -122,7 +121,7 @@ module SiSU_Plaintext def initialize(md,data,wrap_width) @md,@data,@wrap_width=md,data,wrap_width @env=SiSU_Env::InfoEnv.new(@md.fns) - @brace_url=SiSU_Viz::Skin.new.url_decoration + @brace_url=SiSU_Viz::Defaults.new.url_decoration @tab="\t" @@endnotes_=case md.opt.mod.inspect when /--footnote/; false @@ -188,9 +187,8 @@ WOK end end def plaintext_tail - SiSU_Env::InfoSkin.new(@md).select # env=SiSU_Env::InfoEnv.new(@md.fns) - vz=SiSU_Env::GetInit.instance.skin + vz=SiSU_Viz::Defaults.new base_url="#{@env.url.root}/#{@md.fnb}" generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version] lastdone="Last Generated on: #{Time.now}" @@ -365,7 +363,8 @@ WOK sp=' ' ln='-' @plaintext[:body] <<=if dob.obj==Mx[:br_page] \ - or dob.obj==Mx[:br_page_new] + or dob.obj==Mx[:br_page_new] \ + or dob.obj==Mx[:br_page_line] "#{@br}#{ln*40}#{@br*2}" elsif dob.obj ==Mx[:br_obj] "#{@br}#{sp*20}* * *#{@br*2}" diff --git a/lib/sisu/v3/plaintext_format.rb b/lib/sisu/v5/plaintext_format.rb index 0761260a..2d7850e0 100644 --- a/lib/sisu/v3/plaintext_format.rb +++ b/lib/sisu/v5/plaintext_format.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/plaintext_format.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/plaintext_format.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -92,7 +92,7 @@ module SiSU_PlaintextFormat @txt=@txt.gsub(rgx,'') if @txt =~rgx rgx=/#{Mx[:en_a_o]}[\d*+]+\s+(.+?)#{Mx[:en_a_c]}/ @txt=@txt.gsub(rgx,'\1') if @txt =~rgx - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new end def scr_endnote_body "<endnote>#{@txt}</endnote> " diff --git a/lib/sisu/v3/po4a.rb b/lib/sisu/v5/po4a.rb index 6ea61e10..b3bcc81f 100644 --- a/lib/sisu/v3/po4a.rb +++ b/lib/sisu/v5/po4a.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/po4a.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/po4a.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -153,7 +153,6 @@ module SiSU_Po4a else 78 end SiSU_Po4a::Source::Scroll.new(fn,@dal_array_lang_src,@dal_array_lang_translation,@@md_src,@@md_trn,wrap_width).songsheet - SiSU_Env::InfoSkin.new(md).select #watch end rescue SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do @@ -173,8 +172,8 @@ module SiSU_Po4a @md=(md_trn.nil?) \ ? md_src : md_trn - @brace_url=SiSU_Viz::Skin.new.url_decoration - @vz=SiSU_Env::GetInit.instance.skin + @brace_url=SiSU_Viz::Defaults.new.url_decoration + @vz=SiSU_Viz::Defaults.new @tab="\t" @@endnotes_=(@md.opt.mod.inspect =~/--endnote/) ? true : false # --footnote @br=(@md.opt.mod.inspect =~/--dos/) ? "\r\n" : "\n" # --unix @@ -294,15 +293,14 @@ GSUB "#: en/#{@md.fns}:#{SiSU_Po4aUtils::PotNumber.new.num}", 'msgid ""', meta_src.metadata_tags.classify.head, - meta_src.metadata_tags.classify.relation, meta_src.metadata_tags.classify.subject, meta_src.metadata_tags.classify.topic_register, - meta_src.metadata_tags.classify.type, - meta_src.metadata_tags.classify.identifier, meta_src.metadata_tags.classify.loc, meta_src.metadata_tags.classify.dewey, - meta_src.metadata_tags.classify.oclc, - meta_src.metadata_tags.classify.isbn, + meta_src.metadata_tags.notes.relation, + meta_src.metadata_tags.notes.type, + meta_src.metadata_tags.identifier.oclc, + meta_src.metadata_tags.identifier.isbn, 'msgstr ""', ] w << [ @@ -331,7 +329,6 @@ GSUB meta_src.processing_tags.make.bold, meta_src.processing_tags.make.italics, meta_src.processing_tags.make.texpdf_font, - meta_src.processing_tags.make.skin, 'msgstr ""', ] w.each do |y| @@ -424,26 +421,24 @@ GSUB "#: en/#{@md.fns}:#{SiSU_Po4aUtils::PotNumber.new.num}", 'msgid ""', meta_src.metadata_tags.classify.head, - meta_src.metadata_tags.classify.relation, meta_src.metadata_tags.classify.subject, meta_src.metadata_tags.classify.topic_register, - meta_src.metadata_tags.classify.type, - meta_src.metadata_tags.classify.identifier, meta_src.metadata_tags.classify.loc, meta_src.metadata_tags.classify.dewey, - meta_src.metadata_tags.classify.oclc, - meta_src.metadata_tags.classify.isbn, + meta_src.metadata_tags.notes.relation, + meta_src.metadata_tags.notes.type, + meta_src.metadata_tags.identifier.oclc, + meta_src.metadata_tags.identifier.isbn, 'msgstr ""', meta_trn.metadata_tags.classify.head, - meta_trn.metadata_tags.classify.relation, meta_trn.metadata_tags.classify.subject, meta_trn.metadata_tags.classify.topic_register, - meta_trn.metadata_tags.classify.type, - meta_trn.metadata_tags.classify.identifier, meta_trn.metadata_tags.classify.loc, meta_trn.metadata_tags.classify.dewey, - meta_trn.metadata_tags.classify.oclc, - meta_trn.metadata_tags.classify.isbn, + meta_trn.metadata_tags.notes.relation, + meta_trn.metadata_tags.notes.type, + meta_trn.metadata_tags.identifier.oclc, + meta_trn.metadata_tags.identifier.isbn, ] w << [ "#. #{@po4a_identify_type} - metadata: date", @@ -479,7 +474,6 @@ GSUB meta_src.processing_tags.make.bold, meta_src.processing_tags.make.italics, meta_src.processing_tags.make.texpdf_font, - meta_src.processing_tags.make.skin, 'msgstr ""', meta_trn.processing_tags.make.language, meta_trn.processing_tags.make.headings, @@ -489,7 +483,6 @@ GSUB meta_trn.processing_tags.make.bold, meta_trn.processing_tags.make.italics, meta_trn.processing_tags.make.texpdf_font, - meta_trn.processing_tags.make.skin, ] w.each do |y| z='' diff --git a/lib/sisu/v3/po4a_set.rb b/lib/sisu/v5/po4a_set.rb index 594c62bc..042bbaa0 100644 --- a/lib/sisu/v3/po4a_set.rb +++ b/lib/sisu/v5/po4a_set.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/po4a_set.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/po4a_set.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -255,7 +255,6 @@ WOK when /^#{Mx[:meta_o]}(bold)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct') when /^#{Mx[:meta_o]}(italics|itali[sz]e)#{Mx[:meta_c]}\s*(.+?)$/; header('italicize',$2,'process','instruct') when /^#{Mx[:meta_o]}(vocabulary|wordlist)#{Mx[:meta_c]}\s*(.+?)$/; header('vocabulary',$2,'process','instruct') - when /^#{Mx[:meta_o]}(skin)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct') when /^#{Mx[:meta_o]}(css|stylesheet)#{Mx[:meta_c]}\s*(.+?)$/; header('css',$2,'process','instruct') when /^#{Mx[:meta_o]}(links)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct') when /^#{Mx[:meta_o]}(prefix)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct') #add a & b diff --git a/lib/sisu/v3/prog_text_translation.rb b/lib/sisu/v5/prog_text_translation.rb index ee481d10..b35741c1 100644 --- a/lib/sisu/v3/prog_text_translation.rb +++ b/lib/sisu/v5/prog_text_translation.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/prog_text_translation.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/prog_text_translation.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v3/qrcode.rb b/lib/sisu/v5/qrcode.rb index a730b832..6d93cd64 100644 --- a/lib/sisu/v3/qrcode.rb +++ b/lib/sisu/v5/qrcode.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/qrcode.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/qrcode.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -81,7 +81,6 @@ module SiSU_QRcode begin @env=SiSU_Env::InfoEnv.new(@opt.fns) @md=SiSU_Param::Parameters.new(@opt).get - SiSU_Env::InfoSkin.new(@md).select xbrowser=@env.program.web_browser browser=@env.program.console_web_browser unless @opt.cmd =~/q/ @@ -115,7 +114,7 @@ module SiSU_QRcode l=SiSU_Env::StandardiseLanguage.new(@md.opt.lng).language @language=l[:n] @translate=SiSU_Translate::Source.new(@md,@language) - @brace_url=SiSU_Viz::Skin.new.url_decoration + @brace_url=SiSU_Viz::Defaults.new.url_decoration @f.make_path(@f.output_path.qrcode.dir) end def output_metadata @@ -529,26 +528,6 @@ WOK id,info=@translate.digitized_by,@md.creator.digitized_by metadata(id,info) end - if defined? @md.classify.subject \ - and @md.classify.subject=~/\S+/ - id,info=@translate.subject,@md.classify.subject - metadata(id,info) - end - if defined? @md.notes.description \ - and @md.notes.description=~/\S+/ - id,info=@translate.description,@md.notes.description - metadata(id,info) - end - if defined? @md.notes.abstract \ - and @md.notes.abstract=~/\S+/ - id,info=@translate.abstract,@md.notes.abstract - metadata(id,info) - end - if defined? @md.type \ - and @md.type=~/\S+/ #dc - id,info=@translate.type,@md.type - metadata(id,info) - end if defined? @md.rights.all \ and @md.rights.all=~/\S+/ #dc id,info=@translate.rights,@md.rights.all @@ -597,34 +576,34 @@ WOK id,info=@translate.language_original,@md.original.language metadata(id,info) end - if defined? @md.classify.format \ - and @md.classify.format=~/\S+/ - id,info=@transate.format,@md.classify.format + if defined? @md.classify.subject \ + and @md.classify.subject=~/\S+/ + id,info=@translate.subject,@md.classify.subject metadata(id,info) end - if defined? @md.classify.identifier \ - and @md.classify.identifier=~/\S+/ - id,info=@translate.identifier,@md.classify.identifier + if defined? @md.classify.keywords \ + and @md.classify.keywords=~/\S+/ + id,info=@translate.keywords,@md.classify.keywords metadata(id,info) end - if defined? @md.original.source \ - and @md.original.source=~/\S+/ - id,info=@translate.source,@md.original.source + if defined? @md.classify.loc \ + and @md.classify.loc=~/\S+/ + id,info=@translate.cls_loc,@md.classify.loc metadata(id,info) end - if defined? @md.classify.relation \ - and @md.classify.relation=~/\S+/ - id,info=@translate.relation,@md.classify.relation + if defined? @md.classify.dewey \ + and @md.classify.dewey=~/\S+/ + id,info=@translate.cls_dewey,@md.classify.dewey metadata(id,info) end - if defined? @md.classify.coverage \ - and @md.classify.coverage=~/\S+/ - id,info=@translate.coverage,@md.classify.coverage + if defined? @md.notes.description \ + and @md.notes.description=~/\S+/ + id,info=@translate.description,@md.notes.description metadata(id,info) end - if defined? @md.classify.keywords \ - and @md.classify.keywords=~/\S+/ - id,info=@translate.keywords,@md.classify.keywords + if defined? @md.notes.abstract \ + and @md.notes.abstract=~/\S+/ + id,info=@translate.abstract,@md.notes.abstract metadata(id,info) end if defined? @md.notes.comment \ @@ -632,30 +611,34 @@ WOK id,info=@translate.comments,@md.notes.comment metadata(id,info) end - if defined? @md.classify.loc \ - and @md.classify.loc=~/\S+/ - id,info=@translate.cls_loc,@md.classify.loc + if defined? @md.notes.coverage \ + and @md.notes.coverage=~/\S+/ + id,info=@translate.coverage,@md.notes.coverage metadata(id,info) end - if defined? @md.classify.dewey \ - and @md.classify.dewey=~/\S+/ - id,info=@translate.cls_dewey,@md.classify.dewey + if defined? @md.notes.relation \ + and @md.notes.relation=~/\S+/ + id,info=@translate.relation,@md.notes.relation metadata(id,info) end - if defined? @md.classify.oclc \ - and @md.classify.oclc=~/\S+/ - id,info=@translate.cls_oclc,@md.classify.oclc - @manifest[:txt] << %{#{id}:\n} - @manifest[:txt] << %{#{info}\n} - end - if defined? @md.classify.pg \ - and @md.classify.pg=~/\S+/ - id,info=@translate.cls_gutenberg,@md.classify.pg + #if defined? @md.notes.source \ + #and @md.notes.source=~/\S+/ + # id,info=@translate.source,@md.notes.source + # metadata(id,info) + #end + #if defined? @md.notes.history \ + #and @md.notes.history=~/\S+/ + # id,info=@translate.history,@md.notes.history + # metadata(id,info) + #end + if defined? @md.notes.type \ + and @md.notes.type=~/\S+/ #dc + id,info=@translate.type,@md.type metadata(id,info) end - if defined? @md.classify.isbn \ - and @md.classify.isbn=~/\S+/ - id,info=@translate.cls_isbn,@md.classify.isbn + if defined? @md.notes.format \ + and @md.notes.format=~/\S+/ + id,info=@transate.format,@md.notes.format metadata(id,info) end if defined? @md.notes.prefix_a \ @@ -668,6 +651,22 @@ WOK id,info=@translate.prefix_b,@md.notes.prefix_b metadata(id,info) end + if defined? @md.original.source \ + and @md.original.source=~/\S+/ + id,info=@translate.source,@md.original.source + metadata(id,info) + end + if defined? @md.identifier.oclc \ + and @md.identifier.oclc=~/\S+/ + id,info=@translate.cls_oclc,@md.identifier.oclc + @manifest[:txt] << %{#{id}:\n} + @manifest[:txt] << %{#{info}\n} + end + if defined? @md.identifier.isbn \ + and @md.identifier.isbn=~/\S+/ + id,info=@translate.cls_isbn,@md.identifier.isbn + metadata(id,info) + end if defined? @md.topic_register_array \ and @md.topic_register_array.length > 0 @manifest[:txt] << %{#{@translate.topic_register}:\n} @@ -711,7 +710,7 @@ WOK def check_output(data) begin id,file='','' - vz=SiSU_Env::GetInit.instance.skin + vz=SiSU_Viz::Defaults.new @f=SiSU_Env::FileOp.new(@md) #.base_filename url=@f.output_path.base.url @en_manifest=if @env.output_dir_structure.by_language_code? diff --git a/lib/sisu/v3/relaxng.rb b/lib/sisu/v5/relaxng.rb index 0981692e..39d6bde9 100644 --- a/lib/sisu/v3/relaxng.rb +++ b/lib/sisu/v5/relaxng.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/relaxng.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/relaxng.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -984,7 +984,6 @@ start = | element links { text } | element markup { text } | element rights { text } - | element skin { xsd:NCName } | element subject { text } | element title { text } | element type { xsd:NCName } @@ -1035,7 +1034,6 @@ start = | element links { text } | element markup { text } | element rights { text } - | element skin { xsd:NCName } | element subject { text } | element title { text } | element type { xsd:NCName } @@ -1108,7 +1106,6 @@ start = | element links { text } | element markup { text } | element rights { text } - | element skin { xsd:NCName } | element subject { text } | element title { text } | element type { xsd:NCName } diff --git a/lib/sisu/v3/remote.rb b/lib/sisu/v5/remote.rb index 4eecac50..3a560ae1 100644 --- a/lib/sisu/v3/remote.rb +++ b/lib/sisu/v5/remote.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/remote.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/remote.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -68,9 +68,9 @@ module SiSU_Remote @opt=opt @dir=SiSU_Env::InfoEnv.new(@opt.fns) @put=(@opt.fns =~/\.ssm\.sst$/) \ - ? @opt.fns.gsub(/(.+)?\.ssm\.sst$/,'\1.ssm') - : @opt.fns - @remote=SiSU_Env::InfoRemote.new(@opt) + ? opt.fns.gsub(/(.+)?\.ssm\.sst$/,'\1.ssm') + : opt.fns + @remote=SiSU_Env::InfoRemote.new(opt) end def rsync SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement ->',@put).dark_grey_title_hi unless @opt.cmd =~/q/ @@ -90,7 +90,7 @@ module SiSU_Remote end def rsync_harvest SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement metadata harvest ->','rsync_harvest').dark_grey_title_hi unless @opt.cmd =~/q/ - @remote.rsync_harvest + @remote.rsync.site_harvest end def scp SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement ->',@put).dark_grey_title_hi unless @opt.cmd =~/q/ @@ -116,7 +116,6 @@ module SiSU_Remote require 'pp' require_relative 'composite' # composite.rb @rgx_image=/(?:^|[^_\\])\{\s*(\S+?\.(?:png|jpg|gif))/ - @rgx_skin=/@skin:\s+(\S+)/ threads=[] for requested_page in @get_s re_fnb=/((?:https?|file):\/\/[^\/ ]+?\/[^\/ ]+?)\/\S+?\/([^\/]+?)\.ss(t)/ #revisit and remove DO @@ -125,14 +124,11 @@ module SiSU_Remote raise "#{url} not found" unless f base_uri,fnb,instr=re_fnb.match(url)[1..3] if re_fnb imagedir=base_uri + '/_sisu/image' #check on - doc_skin_dir = /((?:https?|file):\/\/\S+?)\/[^\/]+?\.sst$/.match(url).captures.join + '/_sisu/skin/doc' downloaded_file=File.new("#{fnb}.-sst",'w+') image_download_url=SiSU_Assemble::RemoteImage.new.image(imagedir) images=[] - skin=SiSU_Assemble::RemoteImage.new.image(doc_skin_dir) f.collect.each do |r| # work area unless r =~/^%+\s/ - skin << r.scan(@rgx_skin).uniq if r =~@rgx_skin if r !~/^%+\s/ \ and r =~@rgx_image images << r.scan(@rgx_image).uniq @@ -140,10 +136,6 @@ module SiSU_Remote end downloaded_file << r end - if skin \ - and skin.length > 0 - SiSU_Assemble::RemoteImage.new.download_doc_skin(skin) - end if images \ and images.length > 1 images=images.flatten.uniq diff --git a/lib/sisu/v3/response.rb b/lib/sisu/v5/response.rb index a4849840..6d167ab6 100644 --- a/lib/sisu/v3/response.rb +++ b/lib/sisu/v5/response.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/response.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/response.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v3/rexml.rb b/lib/sisu/v5/rexml.rb index 4aedfe23..5a30734f 100644 --- a/lib/sisu/v3/rexml.rb +++ b/lib/sisu/v5/rexml.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/rexml.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/rexml.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v3/screen_text_color.rb b/lib/sisu/v5/screen_text_color.rb index dde1d338..ebd954ae 100644 --- a/lib/sisu/v3/screen_text_color.rb +++ b/lib/sisu/v5/screen_text_color.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/screen_text_color.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/screen_text_color.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -72,12 +72,12 @@ module SiSU_Screen @cmd,@txt=cmd,txt @color_instruct=txt[0] flag=SiSU_Env::InfoProcessingFlag.new - if @cmd + if cmd #set default colors on or off -c acts as toggle against this default, if default is off -c turns on, if default is on -c turns off @use_color=(flag.color) \ - ? ((@cmd =~/c/) ? false : true) - : ((@cmd =~/c/) ? true : false) - if @cmd =~/k/ then @use_color=false # useful color off switch, however, k may be used for something else in future + ? ((cmd =~/c/) ? false : true) + : ((cmd =~/c/) ? true : false) + if cmd =~/k/ then @use_color=false # useful color off switch, however, k may be used for something else in future end else @use_color=false end @@ -337,6 +337,9 @@ module SiSU_Screen def green_hi_blue puts %{#{@cX.green_hi}#{@cX.black}#{@txt[0]}#{@cX.off*2} #{@cX.blue}#{@txt[1]}#{@cX.off}} end + def blue_title_hi + puts %{#{@cX.blue_hi}#{@txt[0]}#{@cX.off*2} #{@cX.blue}#{@txt[1]}#{@cX.off}} + end def grey_title_hi puts %{#{@cX.grey_hi}#{@cX.black}#{@txt[0]}#{@cX.off*2} #{@cX.blue}#{@txt[1]}#{@cX.off}} end @@ -349,6 +352,9 @@ module SiSU_Screen def cyan_title_hi puts %{#{@cX.cyan_hi}#{@cX.black}#{@txt[0]}#{@cX.off*2} #{@cX.blue}#{@txt[1]}#{@cX.off}} end + def cyan_hi_blue + puts %{#{@cX.cyan_hi}#{@cX.black}#{@txt[0]}#{@cX.off*2} #{@cX.blue}#{@txt[1]}#{@cX.off}} + end def dbi_title puts %{#{@cX.blue_hi}#{@cX.black}#{@txt[0]}#{@cX.off*2} #{@cX.cyan}#{@cX.grey}#{@txt[1]}#{@cX.off*2} #{@cX.green}#{@txt[2]}#{@cX.off}} end diff --git a/lib/sisu/v3/share_src.rb b/lib/sisu/v5/share_src.rb index 3f8965c9..cb93dee2 100644 --- a/lib/sisu/v3/share_src.rb +++ b/lib/sisu/v5/share_src.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/share_src.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/share_src.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -64,7 +64,6 @@ module SiSU_Markup include SiSU_Source require_relative 'sysenv' # sysenv.rb include SiSU_Env - pwd=Dir.pwd class Source < SiSU_Source::SiSUpodSource def initialize(opt,build=nil,place=nil) super(opt,build,place) @@ -73,15 +72,19 @@ module SiSU_Markup def read unless @opt.cmd =~/q/ @opt.cmd=~/[MVvz]/ \ - ? SiSU_Screen::Ansi.new(@opt.cmd,'Share Document Source!',@opt.fns).green_hi_blue - : SiSU_Screen::Ansi.new(@opt.cmd,'Share Document Source!',@opt.fns).green_title_hi - SiSU_Screen::Ansi.new(@opt.cmd,"Copy sisu markup file to output directory","#{@opt.fno} -> #{@file.output_path.src.dir}").warn if @opt.cmd =~/[MVv]/ + ? SiSU_Screen::Ansi.new(@opt.cmd,'Share document markup text source',@opt.fns).cyan_hi_blue + : SiSU_Screen::Ansi.new(@opt.cmd,'Share document markup text source',@opt.fns).cyan_title_hi end if FileTest.directory?(@path_pod[:fnb]) FileUtils::mkdir_p(@file.output_path.src.dir) unless FileTest.directory?(@file.output_path.src.dir) v=(@opt.cmd =~/M/) ? 'v' : '' system(%{ rsync -a#{v} #{@path_pod[:fnb]} #{@file.output_path.sisupod.dir} + chbk=`pwd` + cd #{@file.output_path.sisupod.dir} + for I in `find -type d` ; do chmod 755 $I ; done + for I in `find -type f` ; do chmod 644 $I ; done + cd ${chbk} }) else SiSU_Screen::Ansi.new('',"#{@opt.fno} not available").blue_tab if @opt.cmd=~/[MVv]/ diff --git a/lib/sisu/v3/share_src_kdissert.rb b/lib/sisu/v5/share_src_kdissert.rb index ccd76e1a..e91a3cf3 100644 --- a/lib/sisu/v3/share_src_kdissert.rb +++ b/lib/sisu/v5/share_src_kdissert.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/share_src_kdissert.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/share_src_kdissert.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v3/shared_html.rb b/lib/sisu/v5/shared_html.rb index 6e897cf6..84c89ecf 100644 --- a/lib/sisu/v3/shared_html.rb +++ b/lib/sisu/v5/shared_html.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/shared_html.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/shared_html.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v3/shared_html_lite.rb b/lib/sisu/v5/shared_html_lite.rb index d7302212..c01ec086 100644 --- a/lib/sisu/v3/shared_html_lite.rb +++ b/lib/sisu/v5/shared_html_lite.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/shared_html_lite.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/shared_html_lite.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -81,9 +81,9 @@ module SiSU_FormatShared else @@hname end @tab="\t" - @brace_url=SiSU_Viz::Skin.new.url_decoration + @brace_url=SiSU_Viz::Defaults.new.url_decoration @@tablehead,@@tablefoot=[],[] - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new @env=SiSU_Env::InfoEnv.new(@md.fns) @base_url="#{@env.url.root}/#{@md.fnb}/#{@hname}.html" end diff --git a/lib/sisu/v3/shared_images.rb b/lib/sisu/v5/shared_images.rb index d71710df..1dc44121 100644 --- a/lib/sisu/v3/shared_images.rb +++ b/lib/sisu/v5/shared_images.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/shared_images.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/shared_images.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -77,9 +77,6 @@ module SiSU_Images def songsheet images_set.select_sisu_base images_set.select_with_document - if @md.opt.cmd =~/h/ - images_set.select_with_document_skin - end end def images_set @pwd=(/(\S+?)(?:\/(?:#{Px[:lng_lst_rgx]}))?$/).match(Dir.pwd)[1] @@ -130,39 +127,6 @@ module SiSU_Images dest=dest_path(:image) copy(src_path,dest,images) end - def select_with_document_skin - rgx_rb_image=/["']\S*?([a-zA-Z0-9_-]+?\.(?:png|jpg|gif))["']/ - skin_source=SiSU_Env::InfoSkin.new(@md).apply - docskin=nil - if skin_source \ - and skin_source[:type] == :dir - docskin_with_path="#{docskin_place}/skin_#{@env.stub_pwd}.rb" - docskin=[docskin_with_path.gsub(/.+?\/(skin_\S+?)\.rb/,'\1')] - #docskin='skin_sisupod' - end - images=[] - if skin_source \ - and skin_source[:name_path] #imperfect, revisit - unless (skin_source[:name_path].nil? \ - or skin_source[:name_path].empty?) - skinfile_array=IO.readlines(skin_source[:name_path],'') - skinfile_array.each do |f| #% work area - unless f =~/^%+ / #hmmm - images << f.scan(rgx_rb_image).uniq if f =~rgx_rb_image - #does not really discriminate, may duplicate images in sisu file, and may take images from default image pool - end - end - end - end - src_path=unless @md.opt.f_pth[:pth] =~/\/\S+?\/sisupod\/\S+?\/sisupod\/doc/ - "#{@pwd}/_sisu/image" - else #sisupod - pt=/(\/\S+?\/sisupod\/\S+?\/sisupod)\/doc/.match(@md.opt.f_pth[:pth])[1] - pt + '/image' - end - dest=dest_path(:image) - copy(src_path,dest,images.flatten) - end def select_sisu_base images=%w[arrow_next_red.png arrow_prev_red.png arrow_up_red.png dot_clear.png dot_white.png b_doc.png b_epub.png b_odf.png b_pdf.png b_toc.png] src_path="#{@env.path.share}/image" diff --git a/lib/sisu/v3/shared_markup_alt.rb b/lib/sisu/v5/shared_markup_alt.rb index 9bceeb17..e0fec924 100644 --- a/lib/sisu/v3/shared_markup_alt.rb +++ b/lib/sisu/v5/shared_markup_alt.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/shared_markup_alt.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/shared_markup_alt.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v3/shared_metadata.rb b/lib/sisu/v5/shared_metadata.rb index 6fd66291..5c8c225d 100644 --- a/lib/sisu/v3/shared_metadata.rb +++ b/lib/sisu/v5/shared_metadata.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/shared_metadata.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/shared_metadata.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -108,6 +108,11 @@ module SiSU_Metadata @tag,@inf,@class=tr.digitized_by,@md.creator.digitized_by,'ext' meta << self.meta_para end + if defined? @md.creator.contributor \ + and @md.creator.contributor=~/\S+/ + @tag,@inf,@class=tr.contributor,@md.creator.contributor,'dc' #6 + meta << self.meta_para + end if defined? @md.rights.all \ and @md.rights.all=~/\S+/ @tag,@inf,@class=tr.rights,@md.rights.all,'dc' #15 @@ -118,24 +123,24 @@ module SiSU_Metadata @tag,@inf,@class=tr.subject,@md.classify.subject,'dc' #3 meta << self.meta_para end - if defined? @md.notes.description \ - and @md.notes.description=~/\S+/ - @tag,@inf,@class=tr.description,@md.notes.description,'dc' #4 + if defined? @md.classify.keywords \ + and @md.classify.keywords=~/\S+/ + @tag,@inf,@class=tr.keywords,@md.classify.keywords,'ext' meta << self.meta_para end - if defined? @md.publisher \ - and @md.publisher=~/\S+/ - @tag,@inf,@class=tr.publisher,@md.publisher,'dc' #5 + if defined? @md.classify.loc \ + and @md.classify.loc=~/\S+/ + @tag,@inf,@class=tr.cls_loc,@md.classify.loc,'id' meta << self.meta_para end - if defined? @md.creator.contributor \ - and @md.creator.contributor=~/\S+/ - @tag,@inf,@class=tr.contributor,@md.creator.contributor,'dc' #6 + if defined? @md.classify.dewey \ + and @md.classify.dewey=~/\S+/ + @tag,@inf,@class=tr.cls_dewey,@md.classify.dewey,'id' meta << self.meta_para end - if defined? @md.notes.abstract \ - and @md.notes.abstract=~/\S+/ - @tag,@inf,@class=tr.abstract,@md.notes.abstract,'ext' + if defined? @md.publisher \ + and @md.publisher=~/\S+/ + @tag,@inf,@class=tr.publisher,@md.publisher,'dc' #5 meta << self.meta_para end if defined? @md.date.created \ @@ -168,29 +173,24 @@ module SiSU_Metadata @tag,@inf,@class=tr.date,@md.date.published,'dc' #7 meta << self.meta_para end - if defined? @md.type \ - and @md.date=~/\S+/ - @tag,@inf,@class=tr.type,@md.type,'dc' #8 + if defined? @md.identifier.isbn \ + and @md.identifier.isbn=~/\S+/ + @tag,@inf,@class=tr.cls_isbn,@md.identifier.isbn,'id' meta << self.meta_para end - if defined? @md.classify.loc \ - and @md.classify.loc=~/\S+/ - @tag,@inf,@class=tr.cls_loc,@md.classify.loc,'id' + if defined? @md.identifier.oclc \ + and @md.identifier.oclc=~/\S+/ + @tag,@inf,@class=tr.cls_oclc,@md.identifier.oclc,'id' meta << self.meta_para end - if defined? @md.classify.dewey \ - and @md.classify.dewey=~/\S+/ - @tag,@inf,@class=tr.cls_dewey,@md.classify.dewey,'id' - meta << self.meta_para - end - if defined? @md.classify.pg \ - and @md.classify.pg=~/\S+/ - @tag,@inf,@class=tr.cls_gutenberg,@md.classify.pg,'id' + if defined? @md.notes.description \ + and @md.notes.description=~/\S+/ + @tag,@inf,@class=tr.description,@md.notes.description,'dc' #4 meta << self.meta_para end - if defined? @md.classify.isbn \ - and @md.classify.isbn=~/\S+/ - @tag,@inf,@class=tr.cls_isbn,@md.classify.isbn,'id' + if defined? @md.notes.abstract \ + and @md.notes.abstract=~/\S+/ + @tag,@inf,@class=tr.abstract,@md.notes.abstract,'ext' meta << self.meta_para end if defined? @md.notes.comment \ @@ -198,6 +198,36 @@ module SiSU_Metadata @tag,@inf,@class=tr.comments,@md.notes.comment,'ext' meta << self.meta_para end + if defined? @md.notes.coverage \ + and @md.notes.coverage=~/\S+/ + @tag,@inf,@class=tr.coverage,@md.notes.coverage,'dc' #14 + meta << self.meta_para + end + if defined? @md.notes.relation \ + and @md.notes.relation=~/\S+/ + @tag,@inf,@class=tr.relation,@md.notes.relation,'dc' #13 + meta << self.meta_para + end + #if defined? @md.notes.source \ + #and @md.notes.source=~/\S+/ + # @tag,@inf,@class=tr.source,@md.notes.source,'dc' #11 + # meta << self.meta_para + #end + if defined? @md.notes.history \ + and @md.notes.history=~/\S+/ + @tag,@inf,@class=tr.type,@md.notes.history,'dc' #8 + meta << self.meta_para + end + if defined? @md.notes.type \ + and @md.notes.type=~/\S+/ + @tag,@inf,@class=tr.type,@md.notes.type,'dc' #8 + meta << self.meta_para + end + if defined? @md.notes.format \ + and @md.notes.format=~/\S+/ + @tag,@inf,@class=tr.format,@md.notes.format,'dc' #9 + meta << self.meta_para + end if defined? @md.notes.prefix_a \ and @md.notes.prefix_a=~/\S+/ @tag,@inf,@class=tr.prefix_a,@md.notes.prefix_a,'inf' @@ -208,11 +238,6 @@ module SiSU_Metadata @tag,@inf,@class=tr.prefix_b,@md.notes.prefix_b,'inf' meta << self.meta_para end - if defined? @md.classify.identifier \ - and @md.classify.identifier=~/\S+/ - @tag,@inf,@class=tr.identifier,@md.classify.identifier,'dc' #10 - meta << self.meta_para - end if defined? @md.original.source \ and @md.original.source=~/\S+/ @tag,@inf,@class=tr.source,@md.original.source,'dc' #11 @@ -228,26 +253,6 @@ module SiSU_Metadata @tag,@inf,@class=tr.language_original,@md.original.language,'ext' meta << self.meta_para end - if defined? @md.classify.format \ - and @md.classify.format=~/\S+/ - @tag,@inf,@class=tr.format,@md.classify.format,'dc' #9 - meta << self.meta_para - end - if defined? @md.classify.relation \ - and @md.classify.relation=~/\S+/ - @tag,@inf,@class=tr.relation,@md.classify.relation,'dc' #13 - meta << self.meta_para - end - if defined? @md.classify.coverage \ - and @md.classify.coverage=~/\S+/ - @tag,@inf,@class=tr.coverage,@md.classify.coverage,'dc' #14 - meta << self.meta_para - end - if defined? @md.classify.keywords \ - and @md.classify.keywords=~/\S+/ - @tag,@inf,@class=tr.keywords,@md.classify.keywords,'ext' - meta << self.meta_para - end if @display_heading @tag,@inf=%{<b><u>Version Information</u></b>},'' meta << self.meta_para @@ -267,11 +272,6 @@ module SiSU_Metadata @tag,@inf,@class='Source Digest',"#{@md.dgst[0]} #{@md.dgst[1]}",'src' meta << self.meta_para end - if defined? @md.dgst_skin \ - and @md.dgst_skin.is_a?(Array) - @tag,@inf,@class='Skin Digest',"#{@md.dgst_skin[0]} #{@md.dgst_skin[1]}",'src' - meta << self.meta_para - end if @display_heading @tag,@inf=%{<b><u>Generated</u></b>},'' meta << self.meta_para @@ -362,13 +362,6 @@ module SiSU_Metadata else nil end end - def skin - if defined? @md.make.skin \ - and @md.make.skin - ' :skin: ' + @md.make.skin - else nil - end - end self end self @@ -736,107 +729,19 @@ module SiSU_Metadata end def char_enc(str) @s=str + def amp + if @s \ + and @s.is_a?(String) + @s=@s.gsub(/&/u,'&') + end + @s + end def utf8 if @s \ and @s.is_a?(String) @s=@s.gsub(/<br(?: \/)?>/u,Mx[:br_paragraph]). - gsub(/</um,'<'). # '<' # < - gsub(/</um,'<'). # '<' # < - gsub(/>/um,'>'). # '>' # > - gsub(/¢/um,'¢'). # '¢' # ¢ - gsub(/£/um,'£'). # '£' # £ - gsub(/¥/um,'¥'). # '¥' # ¥ - gsub(/§/um,'§'). # '§' # § - gsub(/©/um,'©'). # '©' # © - gsub(/ª/um,'ª'). # 'ª' # ª - gsub(/«/um,'«'). # '«' # « - gsub(/®/um,'®'). # '®' # ® - gsub(/°/um,'°'). # '°' # ° - gsub(/±/um,'±'). # '±' # ± - gsub(/²/um,'²'). # '²' # ² - gsub(/³/um,'³'). # '³' # ³ - gsub(/µ/um,'µ'). # 'µ' # µ - gsub(/¶/um,'¶'). # '¶' # ¶ - gsub(/¹/um,'¹'). # '¹' # ¹ - gsub(/º/um,'º'). # 'º' # º - gsub(/»/um,'»'). # '»' # » - gsub(/¼/um,'¼'). # '¼' # ¼ - gsub(/½/um,'½'). # '½' # ½ - gsub(/¾/um,'¾'). # '¾' # ¾ - gsub(/×/um,'×'). # '×' # × - gsub(/÷/um,'÷'). # '÷' # ÷ - gsub(/¿/um,'¿'). # '¿' # ¿ - gsub(/À/um,'À'). # 'À' # À - gsub(/Á/um,'Á'). # 'Á' # Á - gsub(/Â/um,'Â'). # 'Â' # Â - gsub(/Ã/um,'Ã'). # 'Ã' # Ã - gsub(/Ä/um,'Ä'). # 'Ä' # Ä - gsub(/Å/um,'Å'). # 'Å' # Å - gsub(/Æ/um,'Æ'). # 'Æ' # Æ - gsub(/Ç/um,'Ç'). # 'Ç' # Ç - gsub(/È/um,'È'). # 'È' # È - gsub(/É/um,'É'). # 'É' # É - gsub(/Ê/um,'Ê'). # 'Ê' # Ê - gsub(/Ë/um,'Ë'). # 'Ë' # Ë - gsub(/Ì/um,'Ì'). # 'Ì' # Ì - gsub(/Í/um,'Í'). # 'Í' # Í - gsub(/Î/um,'Î'). # 'Î' # Î - gsub(/Ï/um,'Ï'). # 'Ï' # Ï - gsub(/Ð/um,'Ð'). # 'Ð' # Ð - gsub(/Ñ/um,'Ñ'). # 'Ñ' # Ñ - gsub(/Ò/um,'Ò'). # 'Ò' # Ò - gsub(/Ó/um,'Ó'). # 'Ó' # Ó - gsub(/Ô/um,'Ô'). # 'Ô' # Ô - gsub(/Õ/um,'Õ'). # 'Õ' # Õ - gsub(/Ö/um,'Ö'). # 'Ö' # Ö - gsub(/Ø/um,'Ø'). # 'Ø' # Ø - gsub(/Ù/um,'Ù'). # 'Ù' # Ù - gsub(/Ú/um,'Ú'). # 'Ú' # Ú - gsub(/Û/um,'Û'). # 'Û' # Û - gsub(/Ü/um,'Ü'). # 'Ü' # Ü - gsub(/Ý/um,'Ý'). # 'Ý' # Ý - gsub(/Þ/um,'Þ'). # 'Þ' # Þ - gsub(/ß/um,'ß'). # 'ß' # ß - gsub(/à/um,'à'). # 'à' # à - gsub(/á/um,'á'). # 'á' # á - gsub(/â/um,'â'). # 'â' # â - gsub(/ã/um,'ã'). # 'ã' # ã - gsub(/ä/um,'ä'). # 'ä' # ä - gsub(/å/um,'å'). # 'å' # å - gsub(/æ/um,'æ'). # 'æ' # æ - gsub(/ç/um,'ç'). # 'ç' # ç - gsub(/è/um,'è'). # 'è' # è - gsub(/é/um,'é'). # '´' # é - gsub(/ê/um,'ê'). # 'ˆ' # ê - gsub(/ë/um,'ë'). # 'ë' # ë - gsub(/ì/um,'ì'). # 'ì' # ì - gsub(/í/um,'í'). # '´' # í - gsub(/î/um,'î'). # 'î' # î - gsub(/ï/um,'ï'). # 'ï' # ï - gsub(/ð/um,'ð'). # 'ð' # ð - gsub(/ñ/um,'ñ'). # 'ñ' # ñ - gsub(/ò/um,'ò'). # 'ò' # ò - gsub(/ó/um,'ó'). # 'ó' # ó - gsub(/ô/um,'ô'). # 'ô' # ô - gsub(/õ/um,'õ'). # 'õ' # õ - gsub(/ö/um,'ö'). # 'ö' # ö - gsub(/ø/um,'ø'). # 'ø' # ø - gsub(/ù/um,'ú'). # 'ù' # ú - gsub(/ú/um,'û'). # 'ú' # û - gsub(/û/um,'ü'). # 'û' # ü - gsub(/ü/um,'ý'). # 'ü' # ý - gsub(/þ/um,'þ'). # 'þ' # þ - gsub(/ÿ/um,'ÿ'). # 'ÿ' # ÿ - gsub(/‘/um,'‘'). # '‘' # ‘ - gsub(/’/um,'’'). # '’' # ’ - gsub(/“/um,'“'). # “ # “ - gsub(/”/um,'”'). # ” # ” - gsub(/–/um,'–'). # – # – - gsub(/—/um,'—'). # — # — - gsub(/∝/um,'∝'). # ∝ # ∝ - gsub(/∞/um,'∞'). # ∞ # ∞ - gsub(/™/um,'™'). # ™ # ™ - gsub(/✠/um,'✠'). # ✗ # ✠ + gsub(/</um,'<').gsub(/>/um,'>'). + #gsub(/</um,'<').gsub(/>/um,'>'). gsub(/ /um,' '). # space identify gsub(/ /um,' '). # space identify gsub(/#{Mx[:br_paragraph]}/u,'<br />') @@ -899,7 +804,8 @@ WOK end def xhtml_display def meta_para - inf_xml=char_enc(@inf).utf8 + inf_xml=char_enc(@inf).amp + inf_xml=char_enc(inf_xml).utf8 %{<p class="norm"> <b>#{@tag}</b>: #{inf_xml} </p>} @@ -911,7 +817,7 @@ WOK end def odf def meta_para - url_brace=SiSU_Viz::Skin.new.url_decoration + url_brace=SiSU_Viz::Defaults.new.url_decoration if @inf.is_a?(String) @inf=@inf.gsub(/</,'<').gsub(/>/,'>'). gsub(/<br(?: \/)?>/,'<br />') @@ -1204,14 +1110,6 @@ WOK tag,inf='Source Digest',"\\begin\{footnotesize\}#{hash_of}\\end\{footnotesize\}\\-\\begin\{scriptsize\}#{dgst}\\end\{scriptsize\}" meta << meta_para(tag,inf,false) end - if defined? @md.dgst_skin \ - and @md.dgst_skin.is_a?(Array) - hash_of=spec_char(@md.dgst_skin[0]) - hash_of=word_break_points(hash_of) - dgst=number_break_points(@md.dgst_skin[1]) - tag,inf='Skin Digest',"\\begin\{footnotesize\}#{hash_of}\\end\{footnotesize\}\\-\\begin\{scriptsize\}#{dgst}\\end\{scriptsize\}" - meta << meta_para(tag,inf,false) - end meta << %{#{@br}\\begin\{bfseries\}Generated \\end\{bfseries\}} if defined? @md.generated \ and @md.generated.is_a?(Time) @@ -1328,7 +1226,6 @@ if @md.make @md.make.emphasis, @md.make.plaintext_wrap, @md.make.texpdf_font, - @md.make.skin, @md.make.promo, @md.make.ad, @md.make.manpage diff --git a/lib/sisu/v3/shared_sem.rb b/lib/sisu/v5/shared_sem.rb index 041448ab..4a30e26d 100644 --- a/lib/sisu/v3/shared_sem.rb +++ b/lib/sisu/v5/shared_sem.rb @@ -51,7 +51,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/shared_sem.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/shared_sem.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v3/shared_sisupod_source.rb b/lib/sisu/v5/shared_sisupod_source.rb index f1eb048f..f35287de 100644 --- a/lib/sisu/v3/shared_sisupod_source.rb +++ b/lib/sisu/v5/shared_sisupod_source.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/shared_sisupod_source.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/shared_sisupod_source.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -68,13 +68,13 @@ module SiSU_Source @opt=opt m=/.+\/(?:src\/)?(\S+)/im @date=SiSU_Env::InfoDate.new.dt - @env=SiSU_Env::InfoEnv.new(@opt.fns) + @env=SiSU_Env::InfoEnv.new(opt.fns) @ver=SiSU_Env::InfoVersion.instance.get_version - @v=(@opt.cmd =~/[VM]/) ? 'v' : '' + @v=(opt.cmd =~/[VM]/) ? 'v' : '' @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt) @file=@particulars.file @local_path="#{@file.output_path.sisupod.dir}" - processing_sisupod=@env.processing_path.processing_sisupod(@opt) + processing_sisupod=@env.processing_path.processing_sisupod(opt) processing_sisupod.make path_pod=processing_sisupod.paths[:sisupod] path_pod_fnb=processing_sisupod.paths[:fnb] @@ -82,11 +82,10 @@ module SiSU_Source @path_pod={ fnb: path_pod_fnb, pod: path_pod, - doc: path_pod + '/' + Gt[:doc] + '/' + @opt.lng, - po: path_pod + '/' + Gt[:po] + '/' + @opt.lng, + doc: path_pod + '/' + Gt[:doc] + '/' + opt.lng, + po: path_pod + '/' + Gt[:po] + '/' + opt.lng, pot: path_pod + '/' + Gt[:pot], conf: path_pod + '/' + Gt[:conf], - skin: path_pod + '/' + Gt[:skin], image: path_pod + '/' + Gt[:image], audio: path_pod + '/' + Gt[:audio], video: path_pod + '/' + Gt[:video], @@ -104,33 +103,7 @@ module SiSU_Source end end def directories - SiSU_Env::InfoEnv.new.sisupod_v3(@opt) - end - def select_skin(skin='') #skin loading logic here - load "#{SiSU_lib}/defaults.rb" - @skin={} - skin_path = [ - "#{@opt.base_path}/_sisu/skin", - "#{@env.path.home}/.sisu/skin", - '/etc/sisu/skin', - "#{@path_pod[:pod]}/external_document/skin" #CHECK - ] - sk_doc,sk_dir="#{Gt[:doc]}/#{skin}.rb","dir/skin_#{@env.stub_pwd}.rb" - skin_path.each do |v| #document skin priority 1 - if FileTest.file?("#{v}/#{sk_doc}") - @skin={ name_path: "#{v}/#{sk_doc}", type: :doc } - break - end - end - unless @skin.length > 0 - skin_path.each do |v| #directory skin priority 2 - if FileTest.file?("#{v}/#{sk_dir}") - @skin={ name_path: "#{v}/#{sk_dir}", type: :dir } - break - end - end - end - @skin + SiSU_Env::InfoEnv.new.sisupod_v4(@opt) end def images_extract(f,images) # consider using param info rgx_image=/(?:^|[^_\\])\{(?:\s*|\~\^\s+)(\S+?\.(?:png|jpg|gif)\b)/m @@ -144,14 +117,12 @@ module SiSU_Source @pwd=Dir.pwd @rgx_rb_image=/["']\S*?([a-zA-Z0-9_-]+?\.(?:png|jpg|gif))["']/ @rgx_image=/(?:^|[^_\\])\{\s*(\S+?\.(?:png|jpg|gif))/ - @rgx_skin=/^\s+:skin:\s+(\S+)/ @rgx_doc_import=/^<<\s*(\S+?\.ss[ti])/ file_array=IO.readlines(@opt.fno,'') - skin,images,doc_import=[],[],[] + images,doc_import=[],[] doc_import_dir=@opt.sub_location file_array.each do |f| #% work area if f !~/^%+\s/ - skin << f.scan(@rgx_skin).uniq.flatten if f =~@rgx_skin f=f.gsub(/<:=(\S+?)>/,'{ c_\1.png 14x14 }image') # embedded symbol (image) if f !~/^%+\s/ \ and f =~@rgx_image @@ -174,41 +145,15 @@ module SiSU_Source end end end - docskin=nil - if skin \ - and skin.length > 0 - docskin=skin.pop.flatten.join - skin_source=select_skin(docskin) - else - skin_source=select_skin - end - docskin_place="#{@path_pod[:skin]}/#{skin_source[:type].to_s}" - FileUtils::mkdir_p(docskin_place) - if skin_source[:type] == :dir - docskin_with_path="#{docskin_place}/skin_#{@env.stub_pwd}.rb" - docskin=[docskin_with_path.gsub(/.+?\/(skin_\S+?)\.rb/,'\1')] - docskin='skin_sisupod' - end - if skin_source \ - and skin_source[:name_path] - unless skin_source[:name_path].nil? \ - or skin_source[:name_path].empty? - if FileTest.file?(skin_source[:name_path]) - FileUtils::cp(skin_source[:name_path],"#{docskin_place}/#{docskin}.rb") - skinfile_array=IO.readlines(skin_source[:name_path],'') - para_images=[] - skinfile_array.each do |f| #% work area - unless f =~/^%+ / #hmmm - images << f.scan(@rgx_rb_image).uniq if f =~@rgx_rb_image - #does not really discriminate, may duplicate images in sisu file, and may take images from default image pool - end - end - else STDERR.puts %{\t*WARN* did not find - "#{skin_source[:name_path]}" [#{__FILE__}:#{__LINE__}]} - end + gi=SiSU_Env::GetInit.new + unless FileTest.file?("#{@path_pod[:conf]}/#{gi.makefile_name}") + if gi.makefile \ + && FileTest.file?(gi.makefile) + FileUtils::mkdir_p(@path_pod[:conf]) unless FileTest.directory?(@path_pod[:conf]) + FileUtils::cp(gi.makefile,"#{@path_pod[:conf]}/#{gi.makefile_name}") end + #get images from makefile, consider placing in param end - #1. mapping in doc dir? - #2. need images used by skin, scan skin?? if images \ and images.length > 1 images=images.flatten.uniq @@ -231,7 +176,7 @@ module SiSU_Source images=images.uniq images.each do |i| if FileTest.file?("#{images_pwd}/#{i}") - FileUtils::cp("#{images_pwd}/#{i}","#{@path_pod[:image]}/#{i}") if FileTest.file?("#{images_pwd}/#{i}") + FileUtils::cp("#{images_pwd}/#{i}","#{@path_pod[:image]}/#{i}") else STDERR.puts %{\t*WARN* did not find image - "#{images_pwd}/#{i}" [#{__FILE__}:#{__LINE__}]} end end @@ -266,11 +211,9 @@ module SiSU_Source cpy= :no cpy=if f[:f] =~ /^#{@opt.f_pth[:lng_is]}\// \ or f[:f] =~ /~#{@opt.f_pth[:lng_is]}\.sst/ - p "#{@opt.base_path}/#{f[:f]} --> #{@path_pod[:doc]}/#{f[:n]}" :yes elsif f[:f] !~ /^(?:#{Px[:lng_lst_rgx]})\/|~(?:#{Px[:lng_lst_rgx]})\.sst/ \ and @opt.f_pth[:lng_is] == 'en' - p "#{@opt.base_path}/#{f[:f]} --> #{@path_pod[:doc]}/#{f[:n]}" :yes else :no end @@ -294,11 +237,9 @@ module SiSU_Source cpy= :no cpy=if f[:f] =~ /^#{@opt.f_pth[:lng_is]}\// \ or f[:f] =~ /~#{@opt.f_pth[:lng_is]}\.sst/ - p "#{@opt.base_path}/#{f[:f]} --> #{@path_pod[:doc]}/#{f[:n]}" :yes elsif f[:f] !~ /^(?:#{Px[:lng_lst_rgx]})\/|~(?:#{Px[:lng_lst_rgx]})\.sst/ \ and @opt.f_pth[:lng_is] == 'en' - p "#{@opt.base_path}/#{f[:f]} --> #{@path_pod[:doc]}/#{f[:n]}" :yes else :no end @@ -321,8 +262,6 @@ question?: should you permit the packing of multiple documents open @opt.fns, parse file extract from file content: images and copy each image from whatever image source to _sisu/sisupod/sisu/_sisu/image - skin and copy active skin from whatever source to _sisu/sisupod/sisu/_sisu/skin/doc - extract from skin images required by skin remove previously existing contents of _/sisu/sisupod & make directory structure: @@ -336,8 +275,6 @@ v3 --> fr/content.sst _sisu conf - skin/ - doc [relevant skin if any other than default] image (ln -s ../../image) audio (ln -s ../../audio) video (ln -s ../../video) @@ -351,19 +288,11 @@ v2 --> content.sst [file content] filename.sst [link to content.sst] _sisu/ - skin/ - doc [relevant skin if any other than default] image/ [all images for specific document gathered here] sisu _sisu sisurc.yml - skin/ - dir/ - doc/ - misc/ - site/ - yaml/ convert/ standard_terms/ image diff --git a/lib/sisu/v3/shared_txt.rb b/lib/sisu/v5/shared_txt.rb index 1ebefdd5..3401b05b 100644 --- a/lib/sisu/v3/shared_txt.rb +++ b/lib/sisu/v5/shared_txt.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/shared_txt.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/shared_txt.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -207,7 +207,6 @@ module SiSU_TextUtils when /^#{Mx[:meta_o]}(bold)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct') when /^#{Mx[:meta_o]}(italics|itali[sz]e)#{Mx[:meta_c]}\s*(.+?)$/; header('italicize',$2,'process','instruct') when /^#{Mx[:meta_o]}(vocabulary|wordlist)#{Mx[:meta_c]}\s*(.+?)$/; header('vocabulary',$2,'process','instruct') - when /^#{Mx[:meta_o]}(skin)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct') when /^#{Mx[:meta_o]}(css|stylesheet)#{Mx[:meta_c]}\s*(.+?)$/; header('css',$2,'process','instruct') when /^#{Mx[:meta_o]}(links)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct') when /^#{Mx[:meta_o]}(prefix)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct') #add a & b diff --git a/lib/sisu/v3/shared_xhtml.rb b/lib/sisu/v5/shared_xhtml.rb index bb2de86c..c9534823 100644 --- a/lib/sisu/v3/shared_xhtml.rb +++ b/lib/sisu/v5/shared_xhtml.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/shared_xhtml.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/shared_xhtml.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v3/shared_xml.rb b/lib/sisu/v5/shared_xml.rb index 00312a66..fe4be74e 100644 --- a/lib/sisu/v3/shared_xml.rb +++ b/lib/sisu/v5/shared_xml.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/shared_xml.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/shared_xml.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -65,7 +65,7 @@ module SiSU_XML_Munge @md=md @sys=SiSU_Env::SystemCall.new @dir=SiSU_Env::InfoEnv.new(@md.fns) - @brace_url=SiSU_Viz::Skin.new.url_decoration + @brace_url=SiSU_Viz::Defaults.new.url_decoration if @md.sem_tag @ab ||=semantic_tags.default end @@ -376,6 +376,7 @@ module SiSU_XML_Munge dob.obj=dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />') unless dob.is==:table dob.obj=dob.obj.gsub(/#{Mx[:br_page]}\s*/,''). gsub(/#{Mx[:br_page_new]}\s*/,''). + gsub(/#{Mx[:br_page_line]}\s*/,''). gsub(/#{Mx[:pa_non_object_no_heading]}|#{Mx[:pa_non_object_dummy_heading]}/,''). gsub(/<[-~]#>/,''). gsub(/href="#{Xx[:segment]}/m,'href="'). @@ -542,18 +543,6 @@ module SiSU_XML_Tags #Format content=meta_content_clean(@md.creator.author) @author=%{ <meta name="dc.author" content="#{content}" />\n} end - if defined? @md.classify.subject \ - and @md.classify.subject=~/\S+/ # DublinCore 3 - subject (us library of congress, eric or udc, or schema???) - @rdf_subject=%{ dc.subject="#{@md.classify.subject}"\n} - content=meta_content_clean(@md.classify.subject) - @subject=%{ <meta name="dc.subject" content="#{content}" />\n} - end - if defined? @md.notes.description \ - and @md.notes.description=~/\S+/ # DublinCore 4 - description - @rdf_description=%{ dc.description="#{@md.notes.description}"\n} - content=meta_content_clean(@md.notes.description) - @description=%{ <meta name="dc.description" content="#{content}" />\n} - end if defined? @md.publisher \ and @md.publisher # DublinCore 5 - publisher (current copy published by) @rdf_publisher=%{ dc.publisher="#{@md.publisher}"\n} @@ -596,24 +585,54 @@ module SiSU_XML_Tags #Format @rdf_date_modified=%{ dc.date.modified="#{@md.date.modified}"\n} @date_modified=%{ <meta name="dc.date.modified" content="#{@md.date.modified}" #{@md.date_scheme} />\n} end - if defined? @md.type \ - and @md.type # DublinCore 8 - type (genre eg. report, convention etc) - @rdf_type=%{ dc.type="#{@md.type}"\n} - content=meta_content_clean(@md.type) + if defined? @md.rights.all \ + and @md.rights.all # DublinCore 15 - rights + @rdf_rights=%{ dc.rights="#{@md.rights.all}"\n} + content=meta_content_clean(@md.rights.all) + @rights=%{ <meta name="dc.rights" content="#{content}" />\n} + end + if defined? @md.classify.subject \ + and @md.classify.subject=~/\S+/ # DublinCore 3 - subject (us library of congress, eric or udc, or schema???) + @rdf_subject=%{ dc.subject="#{@md.classify.subject}"\n} + content=meta_content_clean(@md.classify.subject) + @subject=%{ <meta name="dc.subject" content="#{content}" />\n} + end + if defined? @md.notes.description \ + and @md.notes.description=~/\S+/ # DublinCore 4 - description + @rdf_description=%{ dc.description="#{@md.notes.description}"\n} + content=meta_content_clean(@md.notes.description) + @description=%{ <meta name="dc.description" content="#{content}" />\n} + end + if defined? @md.notes.coverage \ + and @md.notes.coverage=~/\S+/ # DublinCore 14 - coverage + @rdf_coverage=%{ dc.coverage="#{@md.notes.coverage}"\n} + content=meta_content_clean(@md.notes.coverage) + @coverage=%{ <meta name="dc.coverage" content="#{content}" />\n} + end + if defined? @md.notes.relation \ + and @md.notes.relation=~/\S+/ # DublinCore 13 - relation + @rdf_relation=%{ dc.relation="#{@md.notes.relation}"\n} + content=meta_content_clean(@md.notes.relation) + @relation=%{ <meta name="dc.relation" content="#{content}" />\n} + end + if defined? @md.notes.type \ + and @md.notes.type # DublinCore 8 - type (genre eg. report, convention etc) + @rdf_type=%{ dc.type="#{@md.notes.type}"\n} + content=meta_content_clean(@md.notes.type) @type=%{ <meta name="dc.type" content="#{content}" />\n} end - if defined? @md.classify.format \ - and @md.classify.format=~/\S+/ # DublinCore 9 - format (use your mime type) - @rdf_format=%{ dc.format="#{@md.classify.format}"\n} - content=meta_content_clean(@md.classify.format) + if defined? @md.notes.format \ + and @md.notes.format=~/\S+/ # DublinCore 9 - format (use your mime type) + @rdf_format=%{ dc.format="#{@md.notes.format}"\n} + content=meta_content_clean(@md.notes.format) @format=%{ <meta name="dc.format" content="#{content}" />\n} end - if defined? @md.classify.identifier \ - and @md.classify.identifier=~/\S+/ # DublinCore 10 - identifier (your identifier, could use urn which is free) - @rdf_identifier=%{ dc.identifier="#{@md.classify.identifier}"\n} - content=meta_content_clean(@md.classify.identifier) - @identifier=%{ <meta name="dc.identifier" content="#{content}" />\n} - end + #if defined? @md.identifier.sisupod \ + #and @md.identifier.sisupod=~/\S+/ # DublinCore 10 - identifier (your identifier, could use urn which is free) + # @rdf_identifier=%{ dc.identifier="#{@md.identifier.sisupod}"\n} + # content=meta_content_clean(@md.identifier.sisupod) + # @identifier=%{ <meta name="dc.identifier" content="#{content}" />\n} + #end if defined? @md.original.source \ and @md.original.source=~/\S+/ # DublinCore 11 - source (document source) @rdf_source=%{ dc.source="#{@md.original.source}"\n} @@ -630,27 +649,9 @@ module SiSU_XML_Tags #Format @rdf_language_original=%{ dc.language="#{@md.original.language}"\n} @language_original=%{ <meta name="dc.language" content="#{@md.original.language}" />\n} end - if defined? @md.classify.relation \ - and @md.classify.relation=~/\S+/ # DublinCore 13 - relation - @rdf_relation=%{ dc.relation="#{@md.classify.relation}"\n} - content=meta_content_clean(@md.classify.relation) - @relation=%{ <meta name="dc.relation" content="#{content}" />\n} - end - if defined? @md.classify.coverage \ - and @md.classify.coverage=~/\S+/ # DublinCore 14 - coverage - @rdf_coverage=%{ dc.coverage="#{@md.classify.coverage}"\n} - content=meta_content_clean(@md.classify.coverage) - @coverage=%{ <meta name="dc.coverage" content="#{content}" />\n} - end - if defined? @md.rights.all \ - and @md.rights.all # DublinCore 15 - rights - @rdf_rights=%{ dc.rights="#{@md.rights.all}"\n} - content=meta_content_clean(@md.rights.all) - @rights=%{ <meta name="dc.rights" content="#{content}" />\n} - end content=meta_content_clean(@md.keywords) @keywords=%{ <meta name="keywords" content="#{content}" />\n} if @md.keywords - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new end def meta_content_clean(content='') content diff --git a/lib/sisu/v3/sisupod_make.rb b/lib/sisu/v5/sisupod_make.rb index 75182aba..d4341abf 100644 --- a/lib/sisu/v3/sisupod_make.rb +++ b/lib/sisu/v5/sisupod_make.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/sisupod_make.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/sisupod_make.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -69,9 +69,11 @@ module SiSU_Doc def initialize(opt,build=nil,place=nil) super(opt,build,place) @zipfile=@opt.fno.gsub(/(?:\~\S{2,3})?(\.ss[tm])$/,'\1') - @ans=SiSU_Response::Response.new - if @opt.cmd=~/[MVv]/ - SiSU_Screen::Ansi.new(@opt.cmd,'Assemble source for sisu document',"#{@opt.fns} -> file://#{@file.output_path.sisupod.dir}/#{@zipfile}.txz").warn + unless @opt.cmd =~/q/ + pthinfo="#{@file.output_path.sisupod.dir}/#{@zipfile}.txz" + @opt.cmd=~/[MVv]/ \ + ? SiSU_Screen::Ansi.new(@opt.cmd,'Assemble source for sisu document',"#{@opt.fns} -> file://#{pthinfo}").cyan_hi_blue + : SiSU_Screen::Ansi.new(@opt.cmd,'Assemble source for sisu document',pthinfo).cyan_title_hi end end def sisupod_tar_xz @@ -106,8 +108,6 @@ question?: should you permit the packing of multiple documents open @opt.fns, parse file extract from file content: images and copy each image from whatever image source to _sisu/sisupod/sisu/_sisu/image - skin and copy active skin from whatever source to _sisu/sisupod/sisu/_sisu/skin/doc - extract from skin images required by skin remove previously existing contents of _/sisu/sisupod & make directory structure: @@ -121,8 +121,6 @@ v3 --> fr/content.sst _sisu conf - skin/ - doc [relevant skin if any other than default] image (ln -s ../../image) audio (ln -s ../../audio) video (ln -s ../../video) @@ -136,19 +134,11 @@ v2 --> content.sst [file content] filename.sst [link to content.sst] _sisu/ - skin/ - doc [relevant skin if any other than default] image/ [all images for specific document gathered here] sisu _sisu sisurc.yml - skin/ - dir/ - doc/ - misc/ - site/ - yaml/ convert/ standard_terms/ image diff --git a/lib/sisu/v3/sitemaps.rb b/lib/sisu/v5/sitemaps.rb index 8eff9792..fcdfe883 100644 --- a/lib/sisu/v3/sitemaps.rb +++ b/lib/sisu/v5/sitemaps.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/sitemaps.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/sitemaps.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v3/spell.rb b/lib/sisu/v5/spell.rb index ce881619..8f10e3be 100644 --- a/lib/sisu/v3/spell.rb +++ b/lib/sisu/v5/spell.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/spell.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/spell.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v3/sst_convert_markup.rb b/lib/sisu/v5/sst_convert_markup.rb index 7c83fd93..cbf40f24 100644 --- a/lib/sisu/v3/sst_convert_markup.rb +++ b/lib/sisu/v5/sst_convert_markup.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/sst_convert_markup.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/sst_convert_markup.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v3/sst_do_inline_footnotes.rb b/lib/sisu/v5/sst_do_inline_footnotes.rb index d989c95e..08dd9f4f 100644 --- a/lib/sisu/v3/sst_do_inline_footnotes.rb +++ b/lib/sisu/v5/sst_do_inline_footnotes.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/set_do_inline_footnotes.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/set_do_inline_footnotes.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -176,7 +176,6 @@ module SiSU_ConvertFootnotes @md,@data=md,data @@word_mode=[] @env=SiSU_Env::InfoEnv.new(@md.fns) - @skin=SiSU_Env::InfoSkin.new(@md) l=SiSU_Env::StandardiseLanguage.new(@md.opt.lng).language @language=l[:n] @translate=SiSU_Translate::Source.new(@md,@language) @@ -278,7 +277,6 @@ module SiSU_ConvertFootnotes end if para =~/<:insert\d+!?>/ \ and para !~/^%\s+/ - @skin.select ins=SiSU_Viz::Inserts.new case para when /^\s*<:insert1>\s*$/ diff --git a/lib/sisu/v3/sst_from_xml.rb b/lib/sisu/v5/sst_from_xml.rb index 8346ce16..9d9f90ce 100644 --- a/lib/sisu/v3/sst_from_xml.rb +++ b/lib/sisu/v5/sst_from_xml.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/sst_from_xml.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/sst_from_xml.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v3/sst_identify_markup.rb b/lib/sisu/v5/sst_identify_markup.rb index 6cc1a589..248aa207 100644 --- a/lib/sisu/v3/sst_identify_markup.rb +++ b/lib/sisu/v5/sst_identify_markup.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/sst_identify_markup.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/sst_identify_markup.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v3/sst_to_s_xml_sax.rb b/lib/sisu/v5/sst_to_s_xml_sax.rb index ccc518d4..3276d1fc 100644 --- a/lib/sisu/v3/sst_to_s_xml_sax.rb +++ b/lib/sisu/v5/sst_to_s_xml_sax.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/sst_to_s_xml_sax.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/sst_to_s_xml_sax.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -143,7 +143,7 @@ module SiSU_SimpleXML_ModelSax @@xml={ body: [], open: [], close: [], head: [] } def initialize(data='',particulars='') @data,@env,@md=data,particulars.env,particulars.md - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new @regx=/^(?:#{Mx[:mk_o]}:p[bn]#{Mx[:mk_c]}\s*)?(?:#{Mx[:lv_o]}[1-9]:(\S*)#{Mx[:lv_c]})?(.+)/ @tab="\t" if @md diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v5/sysenv.rb index 9e03406d..25984397 100644 --- a/lib/sisu/v3/sysenv.rb +++ b/lib/sisu/v5/sysenv.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/sysenv.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/sysenv.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -64,6 +64,7 @@ @@lang_info=nil module SiSU_Env require_relative 'constants' # constants.rb + require_relative 'utils' # utils.rb require 'fileutils' include FileUtils::Verbose require 'singleton' @@ -94,9 +95,8 @@ module SiSU_Env YEAR end end - class InfoSystem + class InfoSystemGen require 'rbconfig' - include Singleton @@user,@@home,@@hostname,@@pwd,@@sisu_etc,@@host,@@arch,@@rbver,@@dir_arch,@@dir_sitearch,@@dir_bin,@@locale,@@rc,@@sisurc_path,@@ad=ENV['USER'],ENV['HOME'],ENV['HOSTNAME'],ENV['PWD'],Config::CONFIG['sysconfdir'] + '/sisu',Config::CONFIG['host'],Config::CONFIG['arch'],%x{ruby -v}.strip,Config::CONFIG['archdir'],Config::CONFIG['sitearchdir'],Config::CONFIG['bindir'],%x{locale charmap}.strip,nil,nil,{} # %x{ruby -v}.strip # Config::CONFIG['rb_ver'] out=Config::CONFIG['localstatedir'] etc=Config::CONFIG['sysconfdir'] + '/sisu' @@ -218,31 +218,21 @@ module SiSU_Env } @@default_dir=DEFAULT_DIR m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m - stub_pwd=@@pwd[m,1] - @@rc_path=[ - "#{@@pwd}/.sisu/#{SiSU_version_dir}", - "#{@@pwd}/.sisu", - "#{@@pwd}/_sisu/#{SiSU_version_dir}", - "#{@@pwd}/_sisu", - "#{@@home}/.sisu/#{SiSU_version_dir}", - "#{@@home}/.sisu", - "#{@@sisu_etc}/#{SiSU_version_dir}", - ] - @@ad_path=(stub_pwd !~/^sisupod$/) \ - ? ([ - "#{@@pwd}/.sisu/skin/yml", - "#{@@pwd}/_sisu/skin/yml", - "#{@@home}/.sisu/skin/yml", - "#{@@sisu_etc}/skin/yml", - ]) - : ["#{@@home}/.sisu",@@sisu_etc] + @@pwd=@pwd=SiSU_Utils::Path.new.base_markup + stub_pwd=@pwd[m,1] attr_accessor :user,:home,:hostname,:pwd,:host,:arch,:rbver,:dir_arch,:dir_sitearch,:dir_bin,:locale,:webserv_path,:webserv_host_cgi,:webserv_port_cgi,:default_dir,:rc_path,:ad_path def initialize - @user,@home,@hostname,@pwd,@sisu_etc,@host,@arch,@rbver,@dir_arch,@dir_sitearch,@dir_bin,@locale,@default_dir,@rc_path,@ad_path=\ - @@user,@@home,@@hostname,@@pwd,@@sisu_etc,@@host,@@arch,@@rbver,@@dir_arch,@@dir_sitearch,@@dir_bin,@@locale,@@default_dir,@@rc_path,@@ad_path + @user,@home,@hostname,@pwd,@sisu_etc,@host,@arch,@rbver,@dir_arch,@dir_sitearch,@dir_bin,@locale,@default_dir=\ + @@user,@@home,@@hostname,@@pwd,@@sisu_etc,@@host,@@arch,@@rbver,@@dir_arch,@@dir_sitearch,@@dir_bin,@@locale,@@default_dir #note rbver is duplicated in InfoVersion end end + class InfoSystem < InfoSystemGen + include Singleton + def initialize + super() + end + end class Load def initialize(prog,mandatory=false) @prog,@mandatory=prog,mandatory @@ -279,44 +269,87 @@ module SiSU_Env load_prog end end - class GetInit < InfoSystem - include Singleton + class GetInit < InfoSystemGen @@noyaml=false - @@rc,@@sisurc_path,@@vz,@@tx=nil,nil,nil,nil + @@rc,@@sisu_doc_makefile,@@sisurc_path,@@tx=nil,nil,nil,nil @@ad={ promo: nil, promo_list: nil, flag_promo: false } + @@sdmd=nil attr_accessor :yaml def initialize super() - end - def skin - @@vz ||=SiSU_Viz::Skin.new + @markup_dir_changed_=if @@sdmd==$sisu_document_markup_directory + false + else + @@sdmd=$sisu_document_markup_directory + true + end end def tex @@tx ||=SiSU_Viz::TeX.new end + def rc_path_options + @rc_path=[ + "#{$sisu_document_markup_directory_base_fixed_path}/.sisu/#{SiSU_version_dir}", + "#{$sisu_document_markup_directory_base_fixed_path}/.sisu", + "#{$sisu_document_markup_directory_base_fixed_path}/_sisu/#{SiSU_version_dir}", + "#{$sisu_document_markup_directory_base_fixed_path}/_sisu", + "#{@@home}/.sisu/#{SiSU_version_dir}", + "#{@@home}/.sisu", + "#{@@sisu_etc}/#{SiSU_version_dir}", + "#{@@sisu_etc}", + ] + end + def sisu_document_make + def makefile_name + S_CONF[:header_make] + end + def makefile + #if @markup_dir_changed_ + rc_path_options.each do |v| + if FileTest.exist?("#{v}/#{makefile_name}") + @sisu_make_path=v + break + end + end + #end + @sisu_make_file_path=@sisu_make_path \ + ? "#{@sisu_make_path}/#{makefile_name}" + : nil + end + def makefile_read + if makefile + sisu_doc_makefile=IO.read(makefile, mode: 'r:utf-8') + @sisu_doc_makefile=sisu_doc_makefile.split(/\s*\n\s*\n/m) + end + @sisu_doc_makefile + end + self + end def sisu_yaml def rc - unless @@rc - @rc_path.each do |v| + if @markup_dir_changed_ + rc_path_options.each do |v| if @@noyaml \ or FileTest.exist?("#{v}/noyaml") STDERR.puts "WARNING - YAML loading switched off, to enable delete the file:\n\t#{v}/noyaml\n\n" unless @@noyaml @@noyaml=true break else - f='sisurc.yml' - if FileTest.exist?("#{v}/#{f}") + f=S_CONF[:rc_yml] + p_f="#{v}/#{f}" + if FileTest.exist?(p_f) require 'yaml' - @@sisurc_path="#{v}/#{f}" - @@rc=YAML::load(File::open(@@sisurc_path)) + @@sisurc_path=v + @@rc=YAML::load(File::open(p_f)) break end unless @@rc f='sisurc.yaml' - if FileTest.exist?("#{v}/#{f}") + p_f="#{v}/#{f}" + if FileTest.exist?(p_f) require 'yaml' - @@sisurc_path="#{v}/#{f}" - @@rc=YAML::load(File::open(@@sisurc_path)) + @@sisurc_path=v + @@rc=YAML::load(File::open(p_f)) break end end @@ -333,40 +366,52 @@ module SiSU_Env end def ads #WORK AREA tell_no_yaml='WARNING - YAML loading switched off, to enable delete the file:' - @ad_path.each do |v| - if @@noyaml \ - or FileTest.exist?("#{v}/noyaml") - puts tell_no_yaml + "\n\t#{v}/noyaml\n" unless @@noyaml - @@noyaml=true - break - else - if FileTest.exist?("#{v}/list.yml") - unless @@ad[:promo_list] - require 'yaml' - @@ad[:promo_list] ||= YAML::load(File::open("#{v}/list.yml")) - end - @@ad[:flag_promo]=true + if @markup_dir_changed_ + @ad_path=[ + "#{$sisu_document_markup_directory_base_fixed_path}/.sisu/#{SiSU_version_dir}/skin/yml", + "#{$sisu_document_markup_directory_base_fixed_path}/.sisu/skin/yml", + "#{$sisu_document_markup_directory_base_fixed_path}/_sisu/#{SiSU_version_dir}/skin/yml", + "#{$sisu_document_markup_directory_base_fixed_path}/_sisu/skin/yml", + "#{@@home}/.sisu/#{SiSU_version_dir}/skin/yml", + "#{@@home}/.sisu/skin/yml", + "#{@@sisu_etc}/#{SiSU_version_dir}/skin/yml", + "#{@@sisu_etc}/skin/yml", + ] + @ad_path.each do |v| + if @@noyaml \ + or FileTest.exist?("#{v}/noyaml") + puts tell_no_yaml + "\n\t#{v}/noyaml\n" unless @@noyaml + @@noyaml=true break + else + if FileTest.exist?("#{v}/list.yml") + unless @@ad[:promo_list] + require 'yaml' + @@ad[:promo_list] ||= YAML::load(File::open("#{v}/list.yml")) + end + @@ad[:flag_promo]=true + break + end + @@ad[:flag_promo]=false end - @@ad[:flag_promo]=false end - end - @ad_path.each do |v| - if @@noyaml \ - or FileTest.exist?("#{v}/noyaml") - puts tell_no_yaml + "\n\t#{v}/noyaml\n" unless @@noyaml - @@noyaml=true - break - else - if FileTest.exist?("#{v}/promo.yml") - unless @@ad[:promo] - require 'yaml' - @@ad[:promo] ||= YAML::load(File::open("#{v}/promo.yml")) - end - @@ad[:flag_promo]=true + @ad_path.each do |v| + if @@noyaml \ + or FileTest.exist?("#{v}/noyaml") + puts tell_no_yaml + "\n\t#{v}/noyaml\n" unless @@noyaml + @@noyaml=true break + else + if FileTest.exist?("#{v}/promo.yml") + unless @@ad[:promo] + require 'yaml' + @@ad[:promo] ||= YAML::load(File::open("#{v}/promo.yml")) + end + @@ad[:flag_promo]=true + break + end + @@ad[:flag_promo]=false end - @@ad[:flag_promo]=false end end @@ad @@ -377,11 +422,11 @@ module SiSU_Env @@ad={} attr_accessor :rc,:fnn,:fnb,:fnt,:fnv,:fnz,:ad def initialize(fns='') - super() @fns=fns @sys=InfoSystem.instance - @rc=GetInit.instance.sisu_yaml.rc - @ad=GetInit.instance.ads + get_init=SiSU_Env::GetInit.new + @rc=get_init.sisu_yaml.rc + @ad=get_init.ads if @fns \ and @fns != '' \ and @fns !=@@fns @@ -427,9 +472,11 @@ module SiSU_Env or ((defined? @rc['output_structure']['by_filename']) \ && @rc['output_structure']['by_filename'] ==true) :filename - else #recheck current default + else #set default :language end + else #set default + :language end end def dump? @@ -611,8 +658,11 @@ module SiSU_Env end class SystemCall @@locale_flag=false - def initialize(input='',output='',cmd='') - @input,@output,@cmd=input,output,cmd + def initialize(input='',output='',opt_or_cmd='') + @input,@output=input,output + (opt_or_cmd.is_a?(SiSU_Commandline::Options)) \ + ? (@cmd,@opt=opt_or_cmd.cmd,opt_or_cmd) + : (@cmd,@opt=opt_or_cmd,nil) #cmd.is_a?(String) @prog=SiSU_Env::InfoProgram.new @sys=InfoSystem.instance end @@ -746,14 +796,14 @@ module SiSU_Env program='identify' program_ref="\n\t\tsee <http://www.imagemagick.org/>" found=(program_found?(program)) ? true : false - STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" unless found + #STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" unless found found end def graphicksmagick #graphicsmagick is a image manipulation program program='gm' program_ref="\n\t\tsee <http://www.graphicsmagick.org/>" found=(program_found?(program)) ? true : false - STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" unless found + #STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" unless found found end def well_formed? #tidy - check for well formed xml xhtml etc. @@ -828,19 +878,23 @@ module SiSU_Env elsif @cmd =~/v/; 'v' else '' end - msg='' - msg=" && echo 'OK: #{@input} -> #{@output}'" unless @cmd =~/q/ + cX=SiSU_Screen::Ansi.new(@cmd).cX + msg=(@cmd =~/q/) ? '' : %{ && echo " #{cX.grey}OK: #{@input} -> #{@output}#{cX.off}"} + amp=(@opt \ + && @opt.files.length > 1) \ + ? '' + : ((@cmd =~/[vVM]/) ? '' : '&') rsync_cmd="rsync -az#{vb} #{action} #{@input} #{@output}" puts rsync_cmd if @cmd =~/[vVM]/ dir_change,dir_return='','' - if chdir \ + if not chdir.nil? \ && chdir != Dir.pwd dir_change=Dir.chdir(chdir) dir_return=Dir.pwd end dir_change system(" - #{rsync_cmd} #{msg} + #{rsync_cmd} #{msg} #{amp} ") dir_return else STDERR.puts "\t*WARN* #{program} not found" @@ -980,6 +1034,7 @@ module SiSU_Env @@fb,@@man_path=nil,nil def initialize(fns='',md=nil) super() #you may not want to re-execute this static info so frequently! + @init=SiSU_Env::GetInit.new @fns,@md=fns,md @env=SiSU_Env::EnvCall.new(fns) if fns fnb=if @md \ @@ -1027,6 +1082,9 @@ module SiSU_Env pt.split[-1].to_s elsif output_dir_structure.by_filename? '' + else + puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).set(:fuschia) + puts 'set output type, by: language, filetype or filename' end @stub_set_manifest=stub + '/manifest' end @@ -1101,6 +1159,52 @@ module SiSU_Env def stub_pod @stub_pod end + def sisupod_v4(opt) + #processing_path.processing + # sisupod + # doc/ + # manifest.txt + # en/content.sst [file content] + # fr/content.sst + # _sisu + # sisu_document_make + # image@ (ln -s ../../image) + # audio@ (ln -s ../../audio) + # video@ (ln -s ../../video) + # image/ [all images for specific document gathered here] + # audio/ + # video/ + spp="#{processing_path.processing}/#{Gt[:sisupod]}" + sppc="#{spp}/doc/_sisu" + lng_dirs=[] + if FileTest.directory?(spp) \ + or FileTest.file?(spp) + FileUtils::rm_rf(spp) + end + paths=[] + flv=SiSU_Env::EnvCall.new(opt.fns).document_language_versions_found + flv[:f].each {|l| lng_dirs << l[:l] } + lng_dirs.uniq.each do |lng| + paths << "#{spp}/doc/#{lng}" + end + paths \ + << "#{spp}/image" + #<< "#{spp}/audio" \ + #<< "#{spp}/video" \ + paths.each do |x| + unless FileTest.directory?(x) + FileUtils::mkdir_p(x) + end + end + if FileTest.directory?(sppc) + pwd=Dir.pwd + Dir.chdir(sppc) + FileUtils::ln_s('../../image', 'image') + #FileUtils::ln_s('../../audio', 'audio') + #FileUtils::ln_s('../../video', 'video') + Dir.chdir(pwd) + end + end def sisupod_v3(opt) #processing_path.processing # sisupod @@ -1378,9 +1482,9 @@ module SiSU_Env : false end def widget #needs (md) #move - @rc=SiSU_Env::GetInit.instance.sisu_yaml.rc - @ad=SiSU_Env::GetInit.instance.ads - @vz=SiSU_Env::GetInit.instance.skin + @rc=SiSU_Env::GetInit.new.sisu_yaml.rc + @ad=SiSU_Env::GetInit.new.ads + @vz=SiSU_Viz::Defaults.new @flag={ ad: false, md: false, sk: false, rc: false } def promo? @flag[:ad]=if @md.flag_promo && @ad[:flag_promo] @@ -1453,7 +1557,7 @@ module SiSU_Env end end def search_form(type='sisusearch',action=nil,db=nil,table=false) - rc=SiSU_Env::GetInit.instance.sisu_yaml.rc + rc=SiSU_Env::GetInit.new.sisu_yaml.rc create_form_sisu=if action \ and db \ and action =~/https?:\/\// \ @@ -1509,7 +1613,7 @@ WOK form end def search_form_static(action=nil,db=nil) - rc=SiSU_Env::GetInit.instance.sisu_yaml.rc + rc=SiSU_Env::GetInit.new.sisu_yaml.rc create_form=if rc['search']['sisu']['flag']==true \ and action \ and db \ @@ -1557,8 +1661,8 @@ WOK self end def widget_static - @rc=SiSU_Env::GetInit.instance.sisu_yaml.rc - @vz=SiSU_Env::GetInit.instance.skin + @rc=SiSU_Env::GetInit.new.sisu_yaml.rc + @vz=SiSU_Viz::Defaults.new @flag={ ad: false, md: false, sk: false, rc: false } def search? flag=if defined? @rc['search'] \ @@ -1566,8 +1670,6 @@ WOK and defined? @rc['search']['sisu']['action'] \ and @rc['search']['sisu']['action'] =~/https?:\/\// \ and defined? @rc['search']['sisu']['db'] \ - and @rc['search']['sisu']['db'] =~/\S+/ \ - and defined? @rc['search']['sisu']['db'] \ and @rc['search']['sisu']['db'] =~/\S+/ flag=if defined? @vz.widget_search \ and @vz.widget_search==true @@ -1605,7 +1707,7 @@ WOK end end def search_form(action=nil,db=nil) - rc=SiSU_Env::GetInit.instance.sisu_yaml.rc + rc=SiSU_Env::GetInit.new.sisu_yaml.rc create_form=if defined? rc['search']['sisu']['flag'] \ and rc['search']['sisu']['flag']==true \ and action \ @@ -1742,22 +1844,28 @@ WOK end self end + def read_source_file_array(fns) + fns_array=(fns !~/\.ssm.sst$/) \ + ? (IO.readlines(fns, mode: 'r:utf-8', cr_newline: true)) + : (IO.readlines("#{processing_path.composite_file}/#{fns}", mode: 'r:utf-8', cr_newline: true)) + end def read_source_file(fns) - fns_array=unless fns =~/\.ssm.sst$/ - IO.readlines(fns, mode: 'r:utf-8', cr_newline: true) - else - IO.readlines("#{processing_path.composite_file}/#{fns}", mode: 'r:utf-8', cr_newline: true) - end + read_source_file_array(fns) + end + def read_source_file_string(fns) + fns_str=(fns !~/\.ssm.sst$/) \ + ? (IO.read(fns, mode: 'r:utf-8', cr_newline: true)) + : (IO.read("#{processing_path.composite_file}/#{fns}", mode: 'r:utf-8', cr_newline: true)) end def source_file_processing_array(fns) - sf=read_source_file(fns).join.split(/\s*\n\s*\n/m) + sf=read_source_file_string(fns).split(/\s*\n\s*\n/m) end def path #dir def home @sys.home end def sisurc_path - GetInit.instance.sisu_yaml.rc_path + GetInit.new.sisu_yaml.rc_path end def pwd @sys.pwd @@ -1825,10 +1933,10 @@ WOK defaults[:sample_data_path] end def rc - @sys.rc_path + @init.rc_path end def yamlrc - GetInit.instance.sisu_yaml.rc_path + GetInit.new.sisu_yaml.rc_path end def man #check use (defined? @rc['webserv']['man']) \ @@ -1842,7 +1950,11 @@ WOK man_path=if @@man_path.nil? man_path=if defined? @rc['webserv']['path'] \ and @rc['webserv']['path'] =~/\S\S+/ + pwd=Dir.pwd + Dir.chdir(SiSU_Utils::Path.new.base_markup) man_path=@@man_path=File.expand_path(@rc['webserv']['path']) + Dir.chdir(pwd) + man_path else defaults[:webserv_path] end else @@man_path @@ -1922,7 +2034,8 @@ WOK and defined? @rc['image']['public'] pth="#{@rc['image']['path']}" "#{pth}/#{@rc['image']['public']}" - else "#{share}/image" + else + "#{share}/image" end end def image_source_sisu_includes @@ -1935,6 +2048,8 @@ WOK "#{@rc['image']['path']}/#{@rc['image']['public']}" elsif FileTest.directory?("#{@@pwd}/#{defaults[:image_stub]}")==true "#{@@pwd}/#{defaults[:image_stub]}" + elsif FileTest.directory?("#{SiSU_Utils::Path.new.base_markup}/#{defaults[:image_stub]}")==true + "#{SiSU_Utils::Path.new.base_markup}/#{defaults[:image_stub]}" else "#{share}/image" end @@ -2036,7 +2151,6 @@ WOK else sisupod_processing_path + '/' + Gt[:doc] end -#p sisup od_processing_path_lng unless FileTest.directory?(sisupod_processing_path_lng) #puts "a processing directory (#{sisupod_processing_path_lng}) is being created for use by sisu" FileUtils::mkdir_p(sisupod_processing_path_lng) @@ -2280,7 +2394,7 @@ WOK end end def webserv_cgi #web url for local webserv (localhost, or hostname) - if defined? @rc['webserv_cgi']['host'] \ + http=if defined? @rc['webserv_cgi']['host'] \ and @rc['webserv_cgi']['host'].is_a?(String) http=((@rc['webserv_cgi']['host'] =~ /https?:\/\//) ? '' : 'http://') #check https? missing if port.webserv_port_cgi @@ -2294,9 +2408,10 @@ WOK else "#{http}#{webserv_host_base}/#{@stub_pwd}" end end + http=http.strip end def webserv_base_cgi #web url for local webserv (localhost, or hostname) - if defined? @rc['webserv_cgi']['host'] \ + http=if defined? @rc['webserv_cgi']['host'] \ and @rc['webserv_cgi']['host'].is_a?(String) http=((@rc['webserv_cgi']['host'] =~ /https?:\/\//) ? '' : 'http://') if port.webserv_port_cgi @@ -2310,6 +2425,7 @@ WOK else "#{http}#{webserv_host_base}" end end + http=http.strip end def webrick #must have a port #REMOVE if defined? @rc['webserv_cgi']['host'] \ @@ -2365,12 +2481,13 @@ WOK else webserv_base_cgi end end - def sample_search_form_title - if defined? @rc['search']['sisu']['title'] \ + def sample_search_form_title(organised_by=:language) + title=if defined? @rc['search']['sisu']['title'] \ and @rc['search']['sisu']['title'] =~/\S+/ @rc['search']['sisu']['title'] - else %{(SiSU (generated sample) search form} + else %{SiSU (generated sample) search form} end + title=title + " (content organised by #{organised_by})" end def output_tell #BROKEN Revisit 2011-02 output_type=if defined? @rc['show_output_on'] \ @@ -2728,7 +2845,7 @@ WOK class InfoProcessingFlag attr_accessor :color,:cf_0,:cf_1,:cf_2,:cf_3,:cf_4,:cf_5 def initialize - @rc=GetInit.instance.sisu_yaml.rc + @rc=GetInit.new.sisu_yaml.rc end def color #processing flag shortcuts (defined? @rc['flag']['color']) ? @rc['flag']['color'] : false @@ -2796,121 +2913,124 @@ WOK @env=(@opt.fns && !(@opt.fns.empty?) \ ? (SiSU_Env::InfoEnv.new(@opt.fns)) : (SiSU_Env::InfoEnv.new('dummy.sst'))) - if @opt.cmd =~/m/; @md=SiSU_Param::Parameters.new(@opt).get - end ft=[] - if @md \ - and defined? @md.fn \ - and @md.fn # used for by_language_code? - if @md.opt.cmd =~ /[hH]/ - ft << @md.fn[:html] - end - if @md.opt.cmd =~ /w/ \ - and @md.opt.cmd !~ /[hH]/ - ft << @md.fn[:concordance] - end - if @md.opt.cmd =~ /y/ \ - and @md.opt.cmd !~ /[hH]/ - ft << @md.fn[:manifest] - end - if @md.opt.cmd =~ /[at]/; ft << @md.fn[:plain] - end - if @md.opt.cmd =~ /b/; ft << @md.fn[:xhtml] - end - if @md.opt.cmd =~ /e/; ft << @md.fn[:epub] - end - if @md.opt.cmd =~ /g/; ft << @md.fn[:wiki] - end - if @md.opt.cmd =~ /i/; ft << @md.fn[:manpage] - end - if @md.opt.cmd =~ /N/; ft << @md.fn[:digest] - end - if @md.opt.cmd =~ /o/; ft << @md.fn[:odf] - end - if @md.opt.cmd =~ /O/; ft << @md.fn[:oai_pmh] - end - if @md.opt.cmd =~ /p/; ft << @md.fn[:pdf_l] << @md.fn[:pdf_p] - end - if @md.opt.cmd =~ /s/; ft << @md.fns - end - if @md.opt.cmd =~ /S/; ft << @md.fn[:sisupod] << '.kdi' - end - if @md.opt.cmd =~ /x/; ft << @md.fn[:sax] - end - if @md.opt.cmd =~ /X/; ft << @md.fn[:dom] - end - if @md.opt.cmd =~ /G/; ft << @md.fn[:pot] - end - @fnb=@md.fnb - else # still needed where/when param is not parsed - if @opt.cmd =~ /[hH]/; ft << '.html' << '.html.??' - end - if @opt.cmd =~ /w/ \ - and @opt.cmd !~ /[hH]/ - ft << 'concordance.html' << '??.concordance.html' << 'concordance.??.html' - end - if @opt.cmd =~ /y/ \ - and @opt.cmd !~ /[hH]/ - ft << 'sisu_manifest.html' << '??.sisu_manifest.html' << 'sisu_manifest.??.html' - end - if @opt.cmd =~ /a/; ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt' - end - if @opt.cmd =~ /b/; ft << 'scroll.xhtml' << '??.scroll.xhtml' << 'scroll.??.xhtml' - end - if @opt.cmd =~ /e/; ft << @fnb << '.epub' - end - if @opt.cmd =~ /g/; ft << 'wiki.txt' << '??.wiki.txt' << 'wiki.??.txt' - end - if @opt.cmd =~ /i/; ft << '.1' << '??.man.1' << 'man.??.1' - end - if @opt.cmd =~ /N/; ft << 'digest.txt' << '??.digest.txt' << 'digest.??.txt' - end - if @opt.cmd =~ /o/; ft << 'opendocument.odt' << '??.opendocument.odt' << 'opendocument.??.odt' - end - if @opt.cmd =~ /O/; ft << 'oai_pmh.xml' - end - if @opt.cmd =~ /p/; ft << 'landscape.pdf' << 'portrait.pdf' << '.pdf' - end - if @opt.cmd =~ /s/; ft << '.sst' << '.ssi' << '.ssm' - end - if @opt.cmd =~ /S/; ft << '.zip' << '.kdi' - end - if @opt.cmd =~ /x/; ft << 'sax.xml' << '??.sax.xml' << 'sax.??.xml' - end - if @opt.cmd =~ /X/; ft << 'dom.xml' << '??.dom.xml' << 'dom.??.xml' - end - if @opt.mod.inspect =~ /sxm|sxs|xml/; ft << @fnb << '.sxs.xml' - end - if @opt.mod.inspect =~ /sxd/; ft << @fnb << '.sxd.xml' - end - if @opt.mod.inspect =~ /sxn/; ft << @fnb << '.sxn.xml' + if @opt.act[:dal][:set]==:on + @md=SiSU_Param::Parameters.new(@opt).get + if @md \ + and defined? @md.fn \ + and @md.fn # used for by_language_code? + if @md.opt.cmd =~ /[hH]/ + ft << @md.fn[:html] + end + if @md.opt.cmd =~ /w/ \ + and @md.opt.cmd !~ /[hH]/ + ft << @md.fn[:concordance] + end + if @md.opt.cmd =~ /y/ \ + and @md.opt.cmd !~ /[hH]/ + ft << @md.fn[:manifest] + end + if @md.opt.cmd =~ /[at]/; ft << @md.fn[:plain] + end + if @md.opt.cmd =~ /b/; ft << @md.fn[:xhtml] + end + if @md.opt.cmd =~ /e/; ft << @md.fn[:epub] + end + if @md.opt.cmd =~ /g/; ft << @md.fn[:wiki] + end + if @md.opt.cmd =~ /i/; ft << @md.fn[:manpage] + end + if @md.opt.cmd =~ /N/; ft << @md.fn[:digest] + end + if @md.opt.cmd =~ /o/; ft << @md.fn[:odf] + end + if @md.opt.cmd =~ /O/; ft << @md.fn[:oai_pmh] + end + if @md.opt.cmd =~ /p/; ft << @md.fn[:pdf_l] << @md.fn[:pdf_p] + end + if @md.opt.cmd =~ /s/; ft << @md.fns + end + if @md.opt.cmd =~ /S/; ft << @md.fn[:sisupod] << '.kdi' + end + if @md.opt.cmd =~ /x/; ft << @md.fn[:sax] + end + if @md.opt.cmd =~ /X/; ft << @md.fn[:dom] + end + if @md.opt.cmd =~ /G/; ft << @md.fn[:pot] + end + @fnb=@md.fnb + else # still needed where/when param is not parsed + if @opt.cmd =~ /[hH]/; ft << '.html' << '.html.??' + end + if @opt.cmd =~ /w/ \ + and @opt.cmd !~ /[hH]/ + ft << 'concordance.html' << '??.concordance.html' << 'concordance.??.html' + end + if @opt.cmd =~ /y/ \ + and @opt.cmd !~ /[hH]/ + ft << 'sisu_manifest.html' << '??.sisu_manifest.html' << 'sisu_manifest.??.html' + end + if @opt.cmd =~ /a/; ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt' + end + if @opt.cmd =~ /b/; ft << 'scroll.xhtml' << '??.scroll.xhtml' << 'scroll.??.xhtml' + end + if @opt.cmd =~ /e/; ft << @fnb << '.epub' + end + if @opt.cmd =~ /g/; ft << 'wiki.txt' << '??.wiki.txt' << 'wiki.??.txt' + end + if @opt.cmd =~ /i/; ft << '.1' << '??.man.1' << 'man.??.1' + end + if @opt.cmd =~ /N/; ft << 'digest.txt' << '??.digest.txt' << 'digest.??.txt' + end + if @opt.cmd =~ /o/; ft << 'opendocument.odt' << '??.opendocument.odt' << 'opendocument.??.odt' + end + if @opt.cmd =~ /O/; ft << 'oai_pmh.xml' + end + if @opt.cmd =~ /p/; ft << 'landscape.pdf' << 'portrait.pdf' << '.pdf' + end + if @opt.cmd =~ /s/; ft << '.sst' << '.ssi' << '.ssm' + end + if @opt.cmd =~ /S/; ft << '.zip' << '.kdi' + end + if @opt.cmd =~ /x/; ft << 'sax.xml' << '??.sax.xml' << 'sax.??.xml' + end + if @opt.cmd =~ /X/; ft << 'dom.xml' << '??.dom.xml' << 'dom.??.xml' + end + if @opt.mod.inspect =~ /sxm|sxs|xml/; ft << @fnb << '.sxs.xml' + end + if @opt.mod.inspect =~ /sxd/; ft << @fnb << '.sxd.xml' + end + if @opt.mod.inspect =~ /sxn/; ft << @fnb << '.sxn.xml' + end end + ft=ft.uniq + filetypes=ft.join(',') + @filetypes=if filetypes !~/..+/; '' # -r called alone, copy all + elsif @opt.cmd =~/u/; '' # -u added, copy all, (used to create remote directory tree see output path), not the usual function of -u + elsif filetypes =~/\S+?,\S+/; '*{' + filetypes + '}' # more than one relevant file type + else '*' + filetypes # one relevant file type + end + @source_path=(@fnb && !(@fnb.empty?) \ + ? "#{@env.path.output}/#{@fnb}" + : @env.path.output) + @source_path_epub=(@fnb && !(@fnb.empty?) \ + ? "#{@env.path.output}/epub" + : @env.path.output_epub) + @source_path_src=(@fnb && !(@fnb.empty?) \ + ? "#{@env.path.output}/src" + : @env.path.output_src) + @source_path_pod=(@fnb && !(@fnb.empty?) \ + ? "#{@env.path.output}/pod" + : @env.path.output_pod) + @source_path_harvest=(@fnb && !(@fnb.empty?) \ + ? "#{@env.path.output}/manifest" + : @env.path.output_harvest) + @local_sisu_source=(@filetypes =~/\S/) \ + ? "#{@source_path}/#{@filetypes}" + : @source_path + end + if @opt.act[:rsync][:set]==:on end - ft=ft.uniq - filetypes=ft.join(',') - @filetypes=if filetypes !~/..+/; '' # -r called alone, copy all - elsif @opt.cmd =~/u/; '' # -u added, copy all, (used to create remote directory tree see output path), not the usual function of -u - elsif filetypes =~/\S+?,\S+/; '*{' + filetypes + '}' # more than one relevant file type - else '*' + filetypes # one relevant file type - end - @source_path=(@fnb && !(@fnb.empty?) \ - ? "#{@env.path.output}/#{@fnb}" - : @env.path.output) - @source_path_epub=(@fnb && !(@fnb.empty?) \ - ? "#{@env.path.output}/epub" - : @env.path.output_epub) - @source_path_src=(@fnb && !(@fnb.empty?) \ - ? "#{@env.path.output}/src" - : @env.path.output_src) - @source_path_pod=(@fnb && !(@fnb.empty?) \ - ? "#{@env.path.output}/pod" - : @env.path.output_pod) - @source_path_harvest=(@fnb && !(@fnb.empty?) \ - ? "#{@env.path.output}/manifest" - : @env.path.output_harvest) - @local_sisu_source=(@filetypes =~/\S/) \ - ? "#{@source_path}/#{@filetypes}" - : @source_path end end class CleanOutput @@ -2918,52 +3038,78 @@ WOK include FileUtils::Verbose def initialize(opt) @opt=opt - z=SiSU_Env::FileMap.new(@opt) - @zap=z.local_sisu_source - if @opt.cmd =~ /[hH]/ - @zap=Dir.glob(@zap).join(' ') - @zap=if @opt.cmd !~ /w/ - @zap.gsub(/#{@source_path}\/concordance.html/,'') - else @zap + z=SiSU_Env::FileMap.new(opt) + zap=z.local_sisu_source + if opt.cmd =~ /h/i + zap=Dir.glob(zap).join(' ') + @zap=if opt.cmd !~ /w/ + zap.gsub(/#{@source_path}\/concordance.html/,'') + else zap end end @env=SiSU_Env::InfoEnv.new end def zap - def main_output - (@zap !~/\/\//) \ - ? (FileUtils::rm_rf(@zap) if FileTest.directory?(@zap)) - : (puts 'suspect zap request, ignored') - end - def site_map - if @opt.fnb \ - and not @opt.fnb.empty? - sm="#{@env.path.output}/sitemaps/sitemap_#{@opt.fnb}.xml" - FileUtils::rm(sm) if FileTest.file?(sm) - end - end - def epub - if @opt.fnb \ - and not @opt.fnb.empty? - sm="#{@env.path.output}/epub/#{@opt.fnb}.epub" - FileUtils::rm(sm) if FileTest.file?(sm) - end - end - def src # consider - if @opt.fnb \ - and not @opt.fnb.empty? - sm="#{@env.path.output}/src/pod/#{@opt.fns}.txz" - FileUtils::rm(sm) if FileTest.file?(sm) - sm="#{@env.path.output}/src/#{@opt.fns}" - FileUtils::rm(sm) if FileTest.file?(sm) - end + def deletion(fn) + if FileTest.file?(fn)==true + File.delete(fn) + tell=SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns, 'remove: ' + fn) + tell.warn unless @opt.cmd =~/q/ + end + end + def remove_output + if @opt.act[:maintenance][:set] == :on + m=InfoFile.new(@opt.fnc) + tell=SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns, 'remove maintenance files from: ' + @env.processing_path.dal) + tell.warn unless @opt.cmd =~/q/ + deletion(m.marshal.dal_content) + deletion(m.marshal.dal_idx_sst_rel_html_seg) + deletion(m.dal_idx_sst_rel) + deletion(m.dal_idx_html) + deletion(m.dal_idx_xhtml) + deletion(m.dal_metadata) + deletion(m.dal_map_nametags) + deletion(m.dal_map_ocn_htmlseg) + deletion(m.html_tune) + end + md=SiSU_Param::Parameters.new(@opt).get + f=SiSU_Env::FileOp.new(md) + deletion(f.place_file.html_segtoc.dir) + deletion(f.place_file.html_scroll.dir) + deletion(f.place_file.html_book_index.dir) + deletion(f.place_file.html_concordance.dir) + deletion(f.place_file.epub.dir) + deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_p_letter}") + deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_l_letter}") + deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_p_a4}") + deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_l_a4}") + deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_p_a5}") + deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_l_a5}") + deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_p_b5}") + deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_l_b5}") + deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_p_legal}") + deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_p_legal}") + deletion(f.place_file.odt.dir) + deletion(f.place_file.xhtml.dir) + deletion(f.place_file.xml_sax.dir) + deletion(f.place_file.xml_dom.dir) + deletion(f.place_file.info.dir) + deletion(f.place_file.manpage.dir) + deletion(f.place_file.sqlite_discrete.dir) + deletion(f.place_file.txt.dir) + deletion(f.place_file.hash_digest.dir) + deletion(f.place_file.manifest.dir) + deletion(f.place_file.qrcode_md.dir) + deletion(f.place_file.qrcode_title.dir) + deletion(f.place_file.src.dir) + deletion(f.place_file.sisupod.dir) end self end end class InfoRemoteHost def initialize - @rc=GetInit.instance.sisu_yaml.rc + @rc=GetInit.new.sisu_yaml.rc end def remote_host #see InfoRemote remote_host_base_general r=[] @@ -3047,7 +3193,7 @@ WOK def initialize(opt) super(opt) # @opt=opt - @rc=GetInit.instance.sisu_yaml.rc + @rc=GetInit.new.sisu_yaml.rc end def remote_host_base_general SiSU_Env::InfoRemoteHost.new.remote_host @@ -3149,194 +3295,195 @@ WOK end self end - def images_from_skin - skin=SiSU_Env::InfoSkin.new(@md).select - skin_array=nil - skin_images_array=[] - if skin - skin_array=IO.readlines(skin,"\n") - skin_array.each do |l| - if l !~/^#/ - if l =~/([a-z0-9._-]+\.(?:png|jpg|gif))/i - skin_images_array << $1 + def rsync + def document + f=(@opt.act[:dal][:set]==:on) \ + ? SiSU_Env::FileOp.new(@md) + : nil + if f + self.remote_host_base.each do |remote_conn| + local_gen=@source_path + #local_gen_image="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image" + #local_gen_image_external="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image_external" + remote_gen="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." + remote_rel=remote_conn[:name] + '/' + f.output_path.stub.rcp + src_txt=@opt.fnc + if (local_gen =~/\S/ \ + and local_gen !~/\/\//) \ + and (remote_gen =~/\S/ \ + and remote_gen !~/\/\//) \ + and @@flag_remote==true \ + and @opt.cmd !~/U/ +# SiSU_Env::SystemCall.new("#{local_src}/#{src_txt}",remote_src,@opt.cmd).rsync + delete_extra_files='--delete' # '--delete-after' + inp=[] + if (@opt.act[:html][:set]==:on \ + || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ + && FileTest.file?(f.place_file.html_scroll.dir) + inp << f.output_path.html_seg.rel << f.place_file.html_scroll.rel + end + if (@opt.act[:concordance][:set]==:on \ + || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ + && FileTest.file?(f.place_file.html_concordance.dir) + inp << f.place_file.html_concordance.rel + end + if (@opt.act[:epub][:set]==:on \ + || @opt.cmd =~/^-R[mqvVM]*$/) \ + && FileTest.file?(f.place_file.epub.dir) + inp << f.place_file.epub.rel + end + if (@opt.act[:odt][:set]==:on \ + || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ + && FileTest.file?(f.place_file.odt.dir) + inp << f.place_file.odt.rel + end + if (@opt.act[:xhtml][:set]==:on \ + || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ + && FileTest.file?(f.place_file.xhtml.dir) + inp << f.place_file.xhtml.rel + end + if (@opt.act[:xml_sax][:set]==:on \ + || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ + && FileTest.file?(f.place_file.xml_sax.dir) + inp << f.place_file.xml_sax.rel + end + if (@opt.act[:xml_dom][:set]==:on \ + || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ + && FileTest.file?(f.place_file.xml_dom.dir) + inp << f.place_file.xml_dom.rel + end + if (@opt.act[:txt][:set]==:on \ + || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ + && FileTest.file?(f.place_file.txt.dir) + inp << f.place_file.txt.rel + end + if (@opt.act[:manpage][:set]==:on \ + || @opt.cmd =~/^-[mqvVM]*i[mqvVM]*$/) \ + && FileTest.file?(f.place_file.manpage.dir) + inp << f.place_file.manpage.rel + end + if (@opt.act[:texinfo][:set]==:on \ + || @opt.cmd =~/^-[mqvVM]*I[mqvVM]*$/) \ + && FileTest.file?(f.place_file.info.dir) + inp << f.place_file.info.rel + end + if (@opt.act[:hash_digests][:set]==:on \ + || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ + && FileTest.file?(f.place_file.hash_digest.dir) + inp << f.place_file.hash_digest.rel + end + if (@opt.act[:share_source][:set]==:on \ + || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ + && FileTest.file?(f.place_file.src.dir) + inp << f.place_file.src.rel + end + if (@opt.act[:sisupod][:set]==:on \ + || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ + && FileTest.file?(f.place_file.sisupod.dir) + inp << f.place_file.sisupod.rel + end + if (@opt.act[:pdf][:set]==:on \ + || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) + inp <<=(@opt.dir_structure_by == :filename) \ + ? (f.output_path.pdf.rel + '/*.pdf') + : (f.output_path.pdf.rel + '/' + @opt.fnb + '*.pdf') + end + if (@opt.act[:sqlite_discrete][:set]==:on \ + || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ + && FileTest.file?(f.place_file.sqlite_discrete.dir) + inp << f.place_file.sqlite_discrete.rel + end + if (@opt.act[:qrcode][:set]==:on \ + || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ + && FileTest.file?(f.place_file.qrcode_md.dir) + inp << f.place_file.qrcode_md.rel << f.place_file.qrcode_title.rel + end + if (@opt.act[:manifest][:set]==:on \ + || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ + && FileTest.file?(f.place_file.manifest.dir) + inp << f.place_file.manifest.rel + end + local_gen=if inp.length > 0 + inp.join(' ') + else '' + end + local_css,images,images_external,images_system='','','','' + images_gen=images=images_skin=images_system=local_css='' + if @opt.cmd =~/[hwbxX]/ \ + && (defined? @md.ec[:image]) \ + && (@md.ec[:image].length > 0) + images=f.place_file.images.rel + '/' + @md.ec[:image].join(" #{f.output_path.images.rel}/") + end + if @opt.cmd =~/[yhwbxX]/ \ + && (defined? @md.ec[:image]) \ + && (@md.ec[:image].length > 0) + local_css=f.output_path.css.rel + images_system='_sisu/image_sys' + end + begin + ##create file structure without copying files?: + ##rsync -av -f"+ */" -f"- *" f.output_path.base.dir remote:./path/. + #local_dirs=%{-f"+ */" -f"- *" #{f.output_path.base.dir}/*} + #SiSU_Env::SystemCall.new(local_dirs,remote_gen,@opt.cmd).rsync + local=local_gen + ' ' + images + ' ' + images_skin + ' ' + images_system + ' ' + local_css + SiSU_Env::SystemCall.new(local,remote_rel,@opt.cmd).rsync('--relative',f.output_path.base.dir) + rescue + p __LINE__.to_s + ':' + __FILE__ + local_dirs=%{--include='*/' --exclude='*' #{f.output_path.base.dir}} + SiSU_Env::SystemCall.new(local_dirs,remote_gen,@opt.cmd).rsync + end + elsif @opt.cmd =~/U/ + puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ + puts "#{local_gen} -> #{remote_gen}" + if FileTest.file?("#{local_src}/#{src_doc}") \ + or FileTest.file?("#{local_src}/#{src_doc}.txz") + puts "#{local_src}/#{src_doc}* -> #{remote_src}" + end + else + puts 'suspect rsync request, ignored' + puts "#{local_gen} -> #{remote_gen} remote flag: #{@@flag_remote}" + puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ end end end end - skin_images_array - end - def rsync - @f=SiSU_Env::FileOp.new(@md) - def document + def site_harvest self.remote_host_base.each do |remote_conn| - local_gen=@source_path - #local_gen_image="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image" - #local_gen_image_external="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image_external" - remote_gen="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." - remote_rel=remote_conn[:name] + '/' + @f.output_path.stub.rcp - src_txt=@opt.fnc - if (local_gen =~/\S/ \ - and local_gen !~/\/\//) \ - and (remote_gen =~/\S/ \ - and remote_gen !~/\/\//) \ - and @@flag_remote==true \ - and @opt.cmd !~/U/ -# SiSU_Env::SystemCall.new("#{local_src}/#{src_txt}",remote_src,@opt.cmd).rsync - delete_extra_files='--delete' # '--delete-after' - inp=[] - if (@opt.act[:html][:set]==:on \ - || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ - && FileTest.file?(@f.place_file.html_scroll.dir) - inp << @f.output_path.html_seg.rel << @f.place_file.html_scroll.rel - end - if (@opt.act[:concordance][:set]==:on \ - || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ - && FileTest.file?(@f.place_file.html_concordance.dir) - inp << @f.place_file.html_concordance.rel - end - if (@opt.act[:epub][:set]==:on \ - || @opt.cmd =~/^-R[mqvVM]*$/) \ - && FileTest.file?(@f.place_file.epub.dir) - inp << @f.place_file.epub.rel - end - if (@opt.act[:odt][:set]==:on \ - || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ - && FileTest.file?(@f.place_file.odt.dir) - inp << @f.place_file.odt.rel - end - if (@opt.act[:xhtml][:set]==:on \ - || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ - && FileTest.file?(@f.place_file.xhtml.dir) - inp << @f.place_file.xhtml.rel - end - if (@opt.act[:xml_sax][:set]==:on \ - || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ - && FileTest.file?(@f.place_file.xml_sax.dir) - inp << @f.place_file.xml_sax.rel - end - if (@opt.act[:xml_dom][:set]==:on \ - || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ - && FileTest.file?(@f.place_file.xml_dom.dir) - inp << @f.place_file.xml_dom.rel - end - if (@opt.act[:txt][:set]==:on \ - || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ - && FileTest.file?(@f.place_file.txt.dir) - inp << @f.place_file.txt.rel - end - if (@opt.act[:manpage][:set]==:on \ - || @opt.cmd =~/^-[mqvVM]*i[mqvVM]*$/) \ - && FileTest.file?(@f.place_file.manpage.dir) - inp << @f.place_file.manpage.rel - end - if (@opt.act[:texinfo][:set]==:on \ - || @opt.cmd =~/^-[mqvVM]*I[mqvVM]*$/) \ - && FileTest.file?(@f.place_file.info.dir) - inp << @f.place_file.info.rel - end - if (@opt.act[:hash_digests][:set]==:on \ - || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ - && FileTest.file?(@f.place_file.hash_digest.dir) - inp << @f.place_file.hash_digest.rel - end - if (@opt.act[:share_source][:set]==:on \ - || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ - && FileTest.file?(@f.place_file.src.dir) - inp << @f.place_file.src.rel - end - if (@opt.act[:sisupod][:set]==:on \ - || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ - && FileTest.file?(@f.place_file.sisupod.dir) - inp << @f.place_file.sisupod.rel - end - if (@opt.act[:pdf][:set]==:on \ - || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) - inp << @f.output_path.pdf.rel + '/' + @opt.fnb + '*' - end - if (@opt.act[:sqlite_discrete][:set]==:on \ - || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ - && FileTest.file?(@f.place_file.sqlite_discrete.dir) - inp << @f.place_file.sqlite_discrete.rel - end - if (@opt.act[:qrcode][:set]==:on \ - || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ - && FileTest.file?(@f.place_file.qrcode_md.dir) - inp << @f.place_file.qrcode_md.rel << @f.place_file.qrcode_title.rel - end - if (@opt.act[:manifest][:set]==:on \ - || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ - && FileTest.file?(@f.place_file.manifest.dir) - inp << @f.place_file.manifest.rel - end - local_gen=if inp.length > 0 - inp.join(' ') - else '' - end - local_css,images,images_external,images_system='','','','' - images_gen=images=images_skin=images_system=local_css='' - if @opt.cmd =~/[hwbxX]/ \ - && (defined? @md.ec[:image]) \ - && (@md.ec[:image].length > 0) - images=@f.place_file.images.rel + '/' + @md.ec[:image].join(" #{@f.output_path.images.rel}/") - end - if @opt.cmd =~/[yhwbxX]/ \ - && (defined? @md.ec[:image]) \ - && (@md.ec[:image].length > 0) - local_css=@f.output_path.css.rel - images_system='_sisu/image_sys' - if @f.output_path.images.rel.length > 0 \ - && images_from_skin.length > 0 - images_skin=@f.place_file.images.rel + '/' + images_from_skin.join(" #{@f.output_path.images.rel}/") - end - end - begin - ##create file structure without copying files?: - ##rsync -av -f"+ */" -f"- *" @f.output_path.base.dir remote:./path/. - #local_dirs=%{-f"+ */" -f"- *" #{@f.output_path.base.dir}/*} - #SiSU_Env::SystemCall.new(local_dirs,remote_gen,@opt.cmd).rsync - local=local_gen + ' ' + images + ' ' + images_skin + ' ' + images_system + ' ' + local_css - SiSU_Env::SystemCall.new(local,remote_rel,@opt.cmd).rsync('--relative',@f.output_path.base.dir) - rescue - p __LINE__.to_s + ':' + __FILE__ - local_dirs=%{--include='*/' --exclude='*' #{@f.output_path.base.dir}} - SiSU_Env::SystemCall.new(local_dirs,remote_gen,@opt.cmd).rsync - end + local=@source_path_harvest + l_rel="#{@env.path.webserv}/#{@env.path.stub_pwd}" + lng='en' + if @env.output_dir_structure.by? == :language + ldest="#{lng}/manifest" + files="#{ldest}/authors.html #{ldest}/topics.html" + elsif @env.output_dir_structure.by? == :filetype + ldest="manifest" + files="#{ldest}/authors.#{lng}.html #{ldest}/topics.#{lng}.html" + elsif @env.output_dir_structure.by? == :filename + files="#{l_rel}/authors.#{lng}.html #{l_rel}/topics.#{lng}.html" + end + remote="#{remote_conn[:name]}/#{@opt.base_stub}" + if @opt.act[:harvest][:set] \ + && @opt.act[:rsync][:set] + (@env.output_dir_structure.by? == :filename) \ + ? (SiSU_Env::SystemCall.new(files,remote).rsync) + : (SiSU_Env::SystemCall.new(ldest,remote).rsync('--relative',l_rel)) elsif @opt.cmd =~/U/ puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ - puts "#{local_gen} -> #{remote_gen}" - if FileTest.file?("#{local_src}/#{src_doc}") \ - or FileTest.file?("#{local_src}/#{src_doc}.txz") - puts "#{local_src}/#{src_doc}* -> #{remote_src}" - end - else - puts 'suspect rsync request, ignored' - puts "#{local_gen} -> #{remote_gen} remote flag: #{@@flag_remote}" - puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ + puts "rsync_harvest: #{local} -> #{remote}" + else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ end end end def site_base #base site - ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu" + ldest='_sisu/*' + l_rel="#{@env.path.webserv}/#{@env.path.stub_pwd}" image_sys="#{@env.path.webserv}/_sisu/image_sys" images="#{@env.path.webserv}/_sisu/image" self.remote_host_base.each do |remote_conn| - remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." + remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}" remote_conf="#{remote_conn[:name]}/_sisu" - if defined? @rc['permission_set']['remote_base_site'] \ - and @rc['permission_set']['remote_base_site'] \ - and @@flag_remote==true \ - and @opt.cmd !~/U/ - SiSU_Env::SystemCall.new("#{image_sys}","#{remote_conf}").rsync - SiSU_Env::SystemCall.new("#{images}","#{remote_conf}").rsync - SiSU_Env::SystemCall.new("#{ldest}","#{remote}").rsync - elsif @opt.cmd =~/U/ - puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ - puts "rsync_base: #{local} -> #{remote}" - puts "#{local}/_sisu/image -> #{remote}" - puts "#{local}/_sisu/image_sys/ -> #{remote}" - puts "#{local}/#{@env.path.style}/ -> #{remote}" - else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ - end + SiSU_Env::SystemCall.new(image_sys,remote_conf).rsync + SiSU_Env::SystemCall.new(ldest,remote).rsync('--relative',l_rel) end end def site_base_sync @@ -3378,32 +3525,22 @@ WOK end end end - def rsync_harvest - self.remote_host_base.each do |remote_conn| - local=@source_path_harvest - remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." - if @@flag_remote - delete_extra_files='--delete' # '--delete-after' - SiSU_Env::SystemCall.new(local,remote).rsync(delete_extra_files) - elsif @opt.cmd =~/U/ - puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ - puts "rsync_sitemaps: #{local} -> #{remote}" - else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ - end - end - end end class InfoVersion <InfoEnv include Singleton require 'rbconfig' + require 'yaml' @@lib_path=nil def get_version @version={} @pwd=ENV['PWD'] - yst_ver="#{defaults[:sisu_share]}/#{SiSU_version_dir}/v/version.yml" + yst_ver=SiSU_path_specified_Version_ \ + ? SiSU_path_specified_Version_ + : "#{defaults[:sisu_share]}/#{SiSU_version_dir}/v/version.yml" lib_path=@@lib_path ? @@lib_path : `echo $RUBYLIB`.split(':') @@lib_path ||=lib_path - if File.exist?(yst_ver); @version=YAML::load(File::open(yst_ver)) #unless @@noyaml + if File.exist?(yst_ver) + @version=YAML::load(File::open(yst_ver)) #unless @@noyaml end @version end @@ -3497,7 +3634,7 @@ WOK @md=md end def cnf_rc #sisurc.yml - @rc=SiSU_Env::GetInit.instance.sisu_yaml.rc + @rc=SiSU_Env::GetInit.new.sisu_yaml.rc end def env_rc #env rc (including sisurc.yml) @env_rc ||=SiSU_Env::InfoEnv.new(@md.fns) @@ -3516,8 +3653,9 @@ WOK true elsif cmd_rc_act[:ocn][:set]==:off false - elsif defined? @md.make.ocn? \ - and @md.make.ocn? ==:off + elsif doc_rc.is_a?(Method) \ + and defined? doc_rc.ocn? \ + and doc_rc.toc? ==:off false elsif env_rc.build.ocn? ==:off false @@ -3530,8 +3668,9 @@ WOK true elsif cmd_rc_act[:toc][:set]==:off false - elsif defined? @md.make.toc? \ - and @md.make.toc? ==:off + elsif doc_rc.is_a?(Method) \ + and defined? doc_rc.toc? \ + and doc_rc.toc? ==:off false elsif env_rc.build.toc? ==:off false @@ -3544,8 +3683,9 @@ WOK true elsif cmd_rc_act[:manifest][:set]==:off false - elsif defined? @md.make.manifest? \ - and @md.make.manifest? ==:off + elsif doc_rc.is_a?(Method) \ + and defined? doc_rc.manifest? \ + and doc_rc.manifest? ==:off false elsif env_rc.build.manifest? ==:off false @@ -3558,8 +3698,9 @@ WOK true elsif cmd_rc_act[:links_to_manifest][:set]==:off false - elsif defined? @md.make.links_to_manifest? \ - and @md.make.links_to_manifest? ==:off + elsif doc_rc.is_a?(Method) \ + and defined? doc_rc.links_to_manifest? \ + and doc_rc.links_to_manifest? ==:off false elsif env_rc.build.links_to_manifest? ==:off false @@ -3572,8 +3713,9 @@ WOK true elsif cmd_rc_act[:metadata][:set]==:off false - elsif defined? @md.make.metadata? \ - and @md.make.metadata? ==:off + elsif doc_rc.is_a?(Method) \ + and defined? doc_rc.metadata? \ + and doc_rc.metadata? ==:off false elsif env_rc.build.metadata? ==:off false @@ -3588,8 +3730,9 @@ WOK true elsif cmd_rc_act[:minitoc][:set]==:off false - elsif defined? @md.make.minitoc? \ - and @md.make.minitoc? ==:off + elsif doc_rc.is_a?(Method) \ + and defined? doc_rc.minitoc? \ + and doc_rc.minitoc? ==:off false elsif env_rc.build.minitoc? ==:off false @@ -3606,9 +3749,10 @@ WOK elsif cmd_rc_act[:manifest_minitoc][:set]==:off \ || cmd_rc_act[:minitoc][:set]==:off false - elsif defined? @md.make.manifest_minitoc? \ - and (@md.make.manifest_minitoc? ==:off \ - || @md.make.minitoc? ==:off) + elsif doc_rc.is_a?(Method) \ + and defined? doc_rc.manifest_minitoc? \ + and (doc_rc.manifest_minitoc? ==:off \ + || doc_rc.minitoc? ==:off) false elsif env_rc.build.manifest_minitoc? ==:off \ || env_rc.build.minitoc? ==:off @@ -3628,9 +3772,10 @@ WOK elsif cmd_rc_act[:html_minitoc][:set]==:off \ || cmd_rc_act[:minitoc][:set]==:off false - elsif defined? @md.make.html_minitoc? \ - and (@md.make.html_minitoc? ==:off \ - || @md.make.minitoc? ==:off) + elsif doc_rc.is_a?(Method) \ + and defined? doc_rc.html_minitoc? \ + and (doc_rc.html_minitoc? ==:off \ + || doc_rc.minitoc? ==:off) false elsif env_rc.build.html_minitoc? ==:off \ || env_rc.build.minitoc? ==:off @@ -3646,8 +3791,9 @@ WOK true elsif cmd_rc_act[:html_top_band][:set]==:off false - elsif defined? @md.make.html_top_band? \ - and @md.make.html_top_band? ==:off + elsif doc_rc.is_a?(Method) \ + and defined? doc_rc.html_top_band? \ + and doc_rc.html_top_band? ==:off false elsif env_rc.build.html_top_band? ==:off false @@ -3660,8 +3806,9 @@ WOK true elsif cmd_rc_act[:html_navigation][:set]==:off false - elsif defined? @md.make.html_navigation? \ - and @md.make.html_navigation? ==:off + elsif doc_rc.is_a?(Method) \ + and defined? doc_rc.html_navigation? \ + and doc_rc.html_navigation? ==:off false elsif env_rc.build.html_navigation? ==:off false @@ -3674,8 +3821,9 @@ WOK true elsif cmd_rc_act[:html_navigation_bar][:set]==:off false - elsif defined? @md.make.html_navigation_bar? \ - and @md.make.html_navigation_bar? ==:off + elsif doc_rc.is_a?(Method) \ + and defined? doc_rc.html_navigation_bar? \ + and doc_rc.html_navigation_bar? ==:off false elsif env_rc.build.html_navigation_bar? ==:off false @@ -3688,8 +3836,9 @@ WOK true elsif cmd_rc_act[:search_form][:set]==:off false - elsif defined? @md.make.html_search_form? \ - and @md.make.search_form? ==:off + elsif doc_rc.is_a?(Method) \ + and defined? doc_rc.html_search_form? \ + and doc_rc.search_form? ==:off false elsif env_rc.build.search_form? ==:off false @@ -3704,9 +3853,10 @@ WOK elsif cmd_rc_act[:html_search_form][:set]==:off \ || cmd_rc_act[:search_form][:set]==:off false - elsif defined? @md.make.html_search_form? \ - and (@md.make.html_search_form? ==:off \ - || @md.make.search_form? ==:off) + elsif doc_rc.is_a?(Method) \ + and defined? doc_rc.html_search_form? \ + and (doc_rc.html_search_form? ==:off \ + || doc_rc.search_form? ==:off) false elsif env_rc.build.html_search_form? ==:off \ || env_rc.build.search_form? ==:off @@ -3722,8 +3872,9 @@ WOK true elsif cmd_rc_act[:html_right_pane][:set]==:off false - elsif defined? @md.make.html_right_pane? \ - and @md.make.html_right_pane? ==:off + elsif doc_rc.is_a?(Method) \ + and defined? doc_rc.html_right_pane? \ + and doc_rc.html_right_pane? ==:off false elsif env_rc.build.html_right_pane? ==:off false @@ -3736,8 +3887,9 @@ WOK true elsif cmd_rc_act[:segsubtoc][:set]==:off false - elsif defined? @md.make.segsubtoc? \ - and @md.make.segsubtoc? ==:off + elsif doc_rc.is_a?(Method) \ + and defined? doc_rc.segsubtoc? \ + and doc_rc.segsubtoc? ==:off false elsif env_rc.build.segsubtoc? ==:off false @@ -3827,14 +3979,13 @@ WOK class InfoDb < InfoEnv @@rc=nil def initialize - @@pwd ||=Dir.pwd - @pwd=Dir.pwd + @@pwd=@pwd=SiSU_Utils::Path.new.base_markup @env=SiSU_Env::InfoEnv.new pt=Pathname.new(@pwd) r=Px[:lng_lst_rgx] u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/ @pwd_stub=pt.realpath.to_s[u,1] - @rc=@@rc ||=GetInit.instance.sisu_yaml.rc + @rc=@@rc ||=GetInit.new.sisu_yaml.rc @defaults=SiSU_Env::InfoEnv.new.defaults end def share_source? @@ -4099,7 +4250,7 @@ WOK @@filename_html_scroll=File.new(p_fn,'w+') end def html_seg_index - pth=((by_filename?) \ + pth=((output_dir_structure.by_filename?) \ || (output_dir_structure.dump?)) \ ? "#{output_path.html.dir}" : "#{output_path.html.dir}/#{@md.fnb}" @@ -4109,7 +4260,7 @@ WOK @@filename_html_index=File.new(p_fn,'w+') end def html_segtoc - pth=((by_filename?) \ + pth=((output_dir_structure.by_filename?) \ || (output_dir_structure.dump?) \ || (output_dir_structure.redirect?)) \ ? "#{output_path.html.dir}" @@ -4818,7 +4969,7 @@ WOK if output_dir_structure.dump_or_redirect? '.' elsif output_dir_structure.by_language_code? - "../../#{@ft}/#{@md.opt.lng}" + "../../#{@ft}" else "../#{@ft}" end @@ -5303,6 +5454,17 @@ WOK def rel set_path(ft).rel.abc end + def rel_image + if output_dir_structure.dump_or_redirect? + './image' + elsif output_dir_structure.by_language_code? + '../../_sisu/image' + elsif output_dir_structure.by_filetype? + '../_sisu/image' + else + '../_sisu/image' + end + end def rcp set_path(ft).rcp.abc end @@ -5549,6 +5711,10 @@ WOK filename_index="#{@pth}/#{Ep[:d_oebps]}/index.xhtml" File.new(filename_index,'w+') end + def xhtml_cover_image + filename_index="#{@pth}/#{Ep[:d_oebps]}/cover_image.xhtml" + File.new(filename_index,'w+') + end def xhtml_segtoc filename_segtoc="#{@pth}/#{Ep[:d_oebps]}/toc.xhtml" File.new(filename_segtoc,'w+') @@ -5627,98 +5793,6 @@ WOK @editor,@wc,@tidy,@rexml,@pdflatex,@postgresql,@sqlite=prog.text_editor,prog.wc,prog.tidy,prog.rexml,prog.pdflatex,prog.postgresql,prog.sqlite end end - class InfoSkin - def initialize(md=nil,skin=nil) - @md=md - @d_sk=if skin.is_a?(String) - skin - elsif defined? md.doc_skin \ - and md.doc_skin - md.doc_skin - else nil - end - @home,@pwd=ENV['HOME'],ENV['PWD'] - m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m - @pwd_stub=@pwd[m,1] - @env=SiSU_Env::InfoEnv.new - end - def apply - if @m.respond_to?(:make) \ - and @md.make.respond_to(:skin) - skin_path=unless @md.opt.f_pth[:pth] =~/\/\S+?\/#{Gt[:sisupod]}\/\S+?\/#{Gt[:pod]}\/#{Gt[:doc]}/ - [ - "#{@env.path.pwd}/_sisu/skin", - "#{@env.path.home}/.sisu/skin", - '/etc/sisu/skin', - "#{@env.processing_path.processing_sisupod(@md.opt)}/external_document/skin" - ] - else #sisupod - pt=/(\/\S+?\/#{Gt[:sisupod]}\/\S+?\/#{Gt[:pod]}\/#{Gt[:doc]})/.match(@md.opt.f_pth[:pth])[1] - [ "#{pt}/_sisu/skin" ] - end - sk_doc,sk_dir="doc/#{@md.make.skin}.rb","dir/skin_#{@env.stub_pwd}.rb" - skin_path.each do |v| #document skin priority 1 - if FileTest.file?("#{v}/#{sk_doc}") - @skin_apply={ name: @md.make.skin, name_path: "#{v}/#{sk_doc}", type: :doc } - break - end - end - unless @skin_apply.length > 0 - skin_path.each do |v| #directory skin priority 2 - if FileTest.file?("#{v}/#{sk_dir}") - @skin_apply={ name: "skin_#{@env.stub_pwd}.rb", name_path: "#{v}/#{sk_dir}", type: :dir } - break - end - end - end - else nil - end - @skin_apply - end - def select # skin loading logic here - load "#{SiSU_lib}/defaults.rb" - skin_path=[] - @env.sys.rc_path.each {|x| skin_path << "#{x}/skin"} - skin_path << "#{@env.processing_path.processing}/external_document/skin" - skin=if @pwd_stub =~/^(?:doc|sisupod)$/ \ - and ((! @md.nil?) \ - && (defined? @md.opt) \ - && (defined? @md.opt.mod) \ - && @md.opt.mod.inspect !~/--trust/) - true # security only run skins on sisupod if --trust flag is provided - elsif @pwd_stub =~/^(?:doc|sisupod)$/ # consider/reconsider doc - false - else true - end - doc_skin,dir_skin=nil,nil - if skin - unless @d_sk.nil? - sk_doc="doc/#{@d_sk}.rb" - skin_path.each do |v| # document skin priority 1 - if FileTest.file?("#{v}/#{sk_doc}") - doc_skin="#{v}/#{sk_doc}" - load doc_skin - break - end - end - end - unless doc_skin - sk_dir="dir/skin_#{@pwd_stub}.rb" - skin_path.each do |v| # directory skin priority 2 - if FileTest.file?("#{v}/#{sk_dir}") - dir_skin="#{v}/#{sk_dir}" - load dir_skin - break - end - end - end - end - sk=if doc_skin; doc_skin - elsif dir_skin; dir_skin - else nil - end - end - end class CSS_Default def html 'html.css' @@ -5823,13 +5897,16 @@ WOK @file=SiSU_Env::FileOp.new(@md) end def html - %{ <link rel="stylesheet" href="#{@file.path_rel_links.html_scroll_css}#{@env.path.style}/#{@css.html}" type="text/css" />} + stylesheet="#{@file.path_rel_links.html_scroll_css}#{@env.path.style}/#{@css.html}" + %{ <link rel="stylesheet" href="#{stylesheet}" type="text/css" />} end def html_seg - %{ <link rel="stylesheet" href="#{@file.path_rel_links.html_seg_css}#{@env.path.style}/#{@css.html}" type="text/css" />} + stylesheet="#{@file.path_rel_links.html_seg_css}#{@env.path.style}/#{@css.html}" + %{ <link rel="stylesheet" href="#{stylesheet}" type="text/css" />} end def html_tables - %{ <link rel="stylesheet" href="#{@file.path_rel_links.html_seg_css}#{@env.path.style}/#{@css.html}" type="text/css" />} + stylesheet="#{@file.path_rel_links.html_seg_css}#{@env.path.style}/#{@css.html}" + %{ <link rel="stylesheet" href="#{stylesheet}" type="text/css" />} end def xhtml_epub %{ <link rel="stylesheet" href="css/xhtml.css" type="text/css" />} @@ -5838,13 +5915,16 @@ WOK xhtml_epub end def xhtml - %{<?xml-stylesheet type="text/css" href="#{@file.path_rel_links.xhtml_css}#{@env.path.style}/#{@css.xhtml}"?>} + stylesheet="#{@file.path_rel_links.xhtml_css}#{@env.path.style}/#{@css.xhtml}" + %{<?xml-stylesheet type="text/css" href="#{stylesheet}"?>} end def xml_sax - %{<?xml-stylesheet type="text/css" href="#{@file.path_rel_links.xml_css}#{@env.path.style}/#{@css.xml_sax}"?>} + stylesheet="#{@file.path_rel_links.xml_css}#{@env.path.style}/#{@css.xml_sax}" + %{<?xml-stylesheet type="text/css" href="#{stylesheet}"?>} end def xml_dom - %{<?xml-stylesheet type="text/css" href="#{@file.path_rel_links.xml_css}#{@env.path.style}/#{@css.xml_dom}"?>} + stylesheet="#{@file.path_rel_links.xml_css}#{@env.path.style}/#{@css.xml_dom}" + %{<?xml-stylesheet type="text/css" href="#{stylesheet}"?>} end end class CreateSite < InfoEnv @@ -5853,36 +5933,37 @@ WOK def initialize(cmd) @cmd=cmd @env=SiSU_Env::InfoEnv.new + @init=SiSU_Env::GetInit.new @home,@pwd=ENV['HOME'],ENV['PWD'] #@pwd=Dir.pwd - @rc=GetInit.instance.sisu_yaml.rc - @vz=SiSU_Env::GetInit.instance.skin + @rc=GetInit.new.sisu_yaml.rc + @vz=SiSU_Viz::Defaults.new @vz_home=SiSU_Viz::Home.new end - def homepage - home_pages_manually_created=nil - @env.sys.rc_path.each do |v| - home_pages_manually_created=Dir.glob("#{v}/home/*.html") - if home_pages_manually_created.length > 0 - break - end + def create_default_sisu_homepage(action=:none) + if action==:none + puts %{ place your homepages in directory:\n "#{@env.path.rc}/home/*.html"\n (no action taken)} + else + puts %{ place your homepages in directory:\n "#{@env.path.rc}/home/*.html"\n (in order to replace default sisu homepage)} + filename_homepage="#{@env.path.webserv}/#{@env.path.stub_pwd}/index.html" + filename_home_toc="#{@env.path.webserv}/#{@env.path.stub_pwd}/toc.html" + file_homepage=File.new(filename_homepage,'w') + file_home_toc=File.new(filename_home_toc,'w') + file_homepage << @vz_home.homepage + file_home_toc << @vz_home.homepage + file_homepage.close + file_home_toc.close end + end + def homepage + home_pages_manually_created=Dir.glob("#{@env.path.rc}/home/*.html") FileUtils::mkdir_p("#{@env.path.webserv}/#{@env.path.stub_pwd}") unless FileTest.directory?("#{@env.path.webserv}/#{@env.path.stub_pwd}") - if home_pages_manually_created - FileUtils.cp(home_pages_manually_created,"#{@env.path.webserv}/#{@env.path.stub_pwd}") - else - doc_skin=nil - sk_doc='doc/skin_sisu.rb' - @env.sys.rc_path.each do |v| #document skin priority 1 - if FileTest.file?("#{v}/skin/#{sk_doc}") - doc_skin="#{v}/skin/#{sk_doc}" - load doc_skin - break - end + if home_pages_manually_created.length > 0 + home_pages_manually_created.each do |homepage| + FileUtils.cp(homepage,"#{@env.path.webserv}/#{@env.path.stub_pwd}") end - filename_homepage=File.new("#{@env.path.webserv}/#{@env.path.stub_pwd}/index.html",'w') - filename_homepage_toc=File.new("#{@env.path.webserv}/#{@env.path.stub_pwd}/toc.html",'w') - filename_homepage << @vz_home.homepage - filename_homepage_toc << @vz_home.homepage + else + create_default_sisu_homepage(:none) + #create_default_sisu_homepage(:default) end end def cp_images(src_path,dest_path) @@ -5930,7 +6011,9 @@ WOK cp_images(src,dest) if FileTest.directory?(src) end def cp_base_images #fix images - src="#{@env.path.share}/image" + src=SiSU_path_base \ + ? SiSU_path_base + '/data/sisu/image' + : "#{@env.path.share}/image" dest_arr=[ "#{@env.path.webserv}/_sisu/image_sys", "#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image_sys" diff --git a/lib/sisu/v3/termsheet.rb b/lib/sisu/v5/termsheet.rb index d6f18987..e25673b4 100644 --- a/lib/sisu/v3/termsheet.rb +++ b/lib/sisu/v5/termsheet.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/termsheet.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/termsheet.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v3/texinfo.rb b/lib/sisu/v5/texinfo.rb index d2a96844..069d9166 100644 --- a/lib/sisu/v3/texinfo.rb +++ b/lib/sisu/v5/texinfo.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/texinfo.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/texinfo.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -82,7 +82,7 @@ module SiSU_TexInfo @opt=opt @md=SiSU_Param::Parameters.new(@opt).get @env=SiSU_Env::InfoEnv.new(@opt.fns) - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new end def directories begin @@ -138,7 +138,7 @@ module SiSU_TexInfo def initialize(md,data) @md,@data=md,data @env=SiSU_Env::InfoEnv.new(@md.fns) - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new @f=SiSU_Env::FileOp.new(@md) end def songsheet diff --git a/lib/sisu/v3/texinfo_format.rb b/lib/sisu/v5/texinfo_format.rb index af968cac..e4efdb3b 100644 --- a/lib/sisu/v3/texinfo_format.rb +++ b/lib/sisu/v5/texinfo_format.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/texinfo_format.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/texinfo_format.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -77,7 +77,7 @@ module SiSU_TexInfoFormat p dob.class p caller end - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new end def head t=Time.now @@ -175,14 +175,6 @@ WOK and @md.creator.author=~/\S+/ author=spec_char(@md.creator.author) end - if defined? @md.classify.subject \ - and @md.classify.subject=~/\S+/ - subject=spec_char(@md.classify.subject) - end - if defined? @md.notes.description \ - and @md.notes.description=~/\S+/ - description=spec_char(@md.description) - end if defined? @md.publisher \ and @md.publisher=~/\S+/ publisher=spec_char(@md.publisher) @@ -215,15 +207,31 @@ WOK and @md.date.modified=~/\S+/ date_modified=spec_char(@md.date.modified) end - type=spec_char(@md.type) if @md.type #dc - if defined? @md.classify.format \ - and @md.classify.format=~/\S+/ - format=spec_char(@md.classify.format) + if defined? @md.classify.subject \ + and @md.classify.subject=~/\S+/ + subject=spec_char(@md.classify.subject) + end + if defined? @md.notes.description \ + and @md.notes.description=~/\S+/ + description=spec_char(@md.description) end - if defined? @md.classify.identifier \ - and @md.classify.identifier=~/\S+/ - identifier=spec_char(@md.classify.identifier) + if defined? @md.notes.coverage \ + and @md.notes.coverage=~/\S+/ + coverage=spec_char(@md.notes.coverage) end + if defined? @md.notes.relation \ + and @md.notes.relation=~/\S+/ + relation=spec_char(@md.notes.relation) + end + #type=spec_char(@md.type) if @md.type #dc + if defined? @md.notes.format \ + and @md.notes.format=~/\S+/ + format=spec_char(@md.notes.format) + end + #if defined? @md.identifier.sisupod \ + #and @md.identifier.sisupod=~/\S+/ + # identifier=spec_char(@md.identifier.sisupod) + #end if defined? @md.original.source \ and @md.original.source=~/\S+/ source=spec_char(@md.original.source) @@ -232,14 +240,6 @@ WOK and @md.title.language=~/\S+/ language=spec_char(@md.title.language) end - if defined? @md.classify.relation \ - and @md.classify.relation=~/\S+/ - relation=spec_char(@md.classify.relation) - end - if defined? @md.classify.coverage \ - and @md.classify.coverage=~/\S+/ - coverage=spec_char(@md.classify.coverage) - end if defined? @md.rights.all \ and @md.rights.all=~/\S+/ rights=spec_char(@md.rights.all) diff --git a/lib/sisu/v3/texpdf.rb b/lib/sisu/v5/texpdf.rb index 1221d818..7a98d9fa 100644 --- a/lib/sisu/v3/texpdf.rb +++ b/lib/sisu/v5/texpdf.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/texpdf.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/texpdf.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -113,14 +113,17 @@ module SiSU_TeX SiSU_Screen::Ansi.new(@opt.cmd,'LaTeX/PDF',"[#{@opt.f_pth[:lng_is]}] #{@opt.fno}").green_title_hi unless @opt.cmd =~/q/ if @opt.cmd =~/[MVv]/ path=@env.url.output_tell - SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.program.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_l}pdf").flow - SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@opt.fns} #{@env.program.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_p}pdf").flow + if @md.opt.act[:pdf_l][:set]==:on + SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.program.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_l}pdf").flow + end + if @md.opt.act[:pdf_p][:set]==:on + SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@opt.fns} #{@env.program.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_p}pdf").flow + end end @md=@particulars.md $flag=@md.opt.cmd #introduced to pass 0 for no object citation numbers... to texpdf_format directories #% needed needs to be reprogrammed !!! - SiSU_Env::InfoSkin.new(@md).select dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here SiSU_TeX::Source::LaTeXcreate.new(@particulars).songsheet dal_array='' @@ -162,27 +165,35 @@ module SiSU_TeX def latex_do(texfilename,papersize) @texfilename=texfilename @@n_lpdf=@@n_lpdf+1 - SiSU_Screen::Ansi.new(@md.opt.cmd,"#{papersize} portrait ->").dark_grey_title_hi if @md.opt.cmd =~/[MVv]/ tex_fn_base=@texfilename.gsub(/\.tex$/,'') - cmd=SiSU_Env::SystemCall.new("#{tex_fn_base}.tex",'',@md.opt.cmd) tell=SiSU_Screen::Ansi.new(@md.opt.cmd) - tell.grey_open if @md.opt.cmd =~/[MVv]/ - if "#{tex_fn_base}" =~/\w+/ \ - and "#{papersize}" =~/\w+/ - 2.times { |i| cmd.latex2pdf(@md,papersize) } #comment out to skip processing of latex portrait - end - tell.p_off if @md.opt.cmd =~/[MVv]/ - SiSU_Screen::Ansi.new(@md.opt.cmd,"#{papersize} landscape ->").dark_grey_title_hi if @md.opt.cmd =~/[MVv]/ - cmd=SiSU_Env::SystemCall.new("#{tex_fn_base}.landscape.tex",'',@md.opt.cmd) - tell.grey_open if @md.opt.cmd =~/[MVv]/ - if "#{tex_fn_base}" =~/\w+/ \ - and "#{papersize}" =~/\w+/ - 2.times { |i| cmd.latex2pdf(@md,papersize) } #comment out to skip processing of latex landscape - end - tell.p_off if @md.opt.cmd =~/[MVv]/ + if @md.opt.act[:pdf_p][:set]==:on + SiSU_Screen::Ansi.new(@md.opt.cmd,"#{papersize} portrait ->").dark_grey_title_hi if @md.opt.cmd =~/[MVv]/ + cmd=SiSU_Env::SystemCall.new("#{tex_fn_base}.tex",'',@md.opt.cmd) + tell.grey_open if @md.opt.cmd =~/[MVv]/ + if "#{tex_fn_base}" =~/\w+/ \ + and "#{papersize}" =~/\w+/ + 2.times { |i| cmd.latex2pdf(@md,papersize) } #comment out to skip processing of latex portrait + end + tell.p_off if @md.opt.cmd =~/[MVv]/ + end + if @md.opt.act[:pdf_l][:set]==:on + SiSU_Screen::Ansi.new(@md.opt.cmd,"#{papersize} landscape ->").dark_grey_title_hi if @md.opt.cmd =~/[MVv]/ + cmd=SiSU_Env::SystemCall.new("#{tex_fn_base}.landscape.tex",'',@md.opt.cmd) + tell.grey_open if @md.opt.cmd =~/[MVv]/ + if "#{tex_fn_base}" =~/\w+/ \ + and "#{papersize}" =~/\w+/ + 2.times { |i| cmd.latex2pdf(@md,papersize) } #comment out to skip processing of latex landscape + end + tell.p_off if @md.opt.cmd =~/[MVv]/ + end pwd=Dir.pwd - portrait_pdf="#{pwd}/#{tex_fn_base}.pdf" - landscape_pdf="#{pwd}/#{tex_fn_base}.landscape.pdf" + if @md.opt.act[:pdf_p][:set]==:on + portrait_pdf="#{pwd}/#{tex_fn_base}.pdf" + end + if @md.opt.act[:pdf_l][:set]==:on + landscape_pdf="#{pwd}/#{tex_fn_base}.landscape.pdf" + end case papersize when /a4/; pdf_p=@f.pdf_p_a4; pdf_l=@f.pdf_l_a4 when /a5/; pdf_p=@f.pdf_p_a5; pdf_l=@f.pdf_l_a5 @@ -192,15 +203,24 @@ module SiSU_TeX else pdf_p=@f.pdf_p_a4; pdf_l=@f.pdf_l_a4 end FileUtils::mkdir_p(@md.file.output_path.pdf.dir) unless FileTest.directory?(@md.file.output_path.pdf.dir) - if FileTest.file?(portrait_pdf) - FileUtils::cp(portrait_pdf,"#{@md.file.output_path.pdf.dir}/#{pdf_p}") - FileUtils::rm(portrait_pdf) - else p "#{__FILE__}:#{__LINE__} NOT FOUND: #{portrait_pdf}" if @md.opt.cmd.inspect =~/M/ + cX=SiSU_Screen::Ansi.new(@md.opt.cmd).cX + if @md.opt.act[:pdf_p][:set]==:on + if FileTest.file?(portrait_pdf) + FileUtils::cp(portrait_pdf,"#{@md.file.output_path.pdf.dir}/#{pdf_p}") + FileUtils::rm(portrait_pdf) + else + STDERR.puts "#{cX.fuschia}pdf file not generated#{cX.off} <#{cX.blue}#{portrait_pdf.gsub(/.+?([^\/]+?\.pdf)$/,'\1')}#{cX.off}> (check texlive dependencies)" + STDERR.puts "#{__FILE__}:#{__LINE__} NOT FOUND: #{portrait_pdf}" if @md.opt.cmd.inspect =~/M/ + end end - if FileTest.file?(landscape_pdf) - FileUtils::cp(landscape_pdf,"#{@md.file.output_path.pdf.dir}/#{pdf_l}") - FileUtils::rm(landscape_pdf) - else p "#{__FILE__}:#{__LINE__} NOT FOUND: #{landscape_pdf}" if @md.opt.cmd.inspect =~/M/ + if @md.opt.act[:pdf_l][:set]==:on + if FileTest.file?(landscape_pdf) + FileUtils::cp(landscape_pdf,"#{@md.file.output_path.pdf.dir}/#{pdf_l}") + FileUtils::rm(landscape_pdf) + else + STDERR.puts "#{cX.fuschia}pdf file not generated#{cX.off} <#{cX.blue}#{landscape_pdf.gsub(/.+?([^\/]+?\.pdf)$/,'\1')}#{cX.off}> (check texlive dependencies)" + STDERR.puts "#{__FILE__}:#{__LINE__} NOT FOUND: #{landscape_pdf}" if @md.opt.cmd.inspect =~/M/ + end end SiSU_Screen::Ansi.new(@md.opt.cmd,@@n_lpdf,'processed (SiSU LaTeX to pdf - using pdfetex aka. pdftex or pdflatex)').generic_number if @md.opt.cmd =~/[MVv]/ end @@ -219,13 +239,18 @@ module SiSU_TeX Dir.chdir(@env.processing_path.tex) texfile=@md.fns.gsub(/$/,".#{ps}.tex"). gsub(/~/,'-') - if File.exist?(texfile) \ - and File.size(texfile) > 0 - @tex_f_no+=1 - #p "#{__FILE__}:#{__LINE__} texpdf generation disabled" if @md.opt.cmd.inspect =~/M/ #%% disable temporarily, re-enable + if @md.opt.act[:pdf_p][:set]==:on \ + or @md.opt.act[:pdf_l][:set]==:on latex_do(texfile,ps) - else - puts "\tzero file size #{@env.processing_path.tex}/#{texfile}" + if @md.opt.act[:pdf_p][:set]==:on + if File.exist?(texfile) \ + and File.size(texfile) > 0 + #@tex_f_no+=1 + else + puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).set(:fuchsia) + puts "\tzero file size #{@env.processing_path.tex}/#{texfile}" + end + end end end end @@ -239,31 +264,33 @@ module SiSU_TeX when /legal/; pdf_p=@f.pdf_p_legal; pdf_l=@f.pdf_l_legal else pdf_p=@f.pdf_p_a4; pdf_l=@f.pdf_l_a4 end - if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{pdf_p}") - mklnk=if @md.file.output_dir_structure.by_language_code? \ - or @md.file.output_dir_structure.by_filetype? - "#{@md.fnb}.portrait.pdf" - else 'portrait.pdf' + if @md.opt.act[:pdf_p][:set]==:on + if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{pdf_p}") + mklnk=((@md.file.output_dir_structure.by_language_code?) \ + || (@md.file.output_dir_structure.by_filetype?)) \ + ? "#{@md.fnb}.portrait.pdf" + : 'portrait.pdf' + if FileTest.directory?(@md.file.output_path.pdf.dir) + pwd=Dir.pwd + Dir.chdir(@md.file.output_path.pdf.dir) + FileUtils::rm_f(mklnk) + FileUtils::ln_s(pdf_p, mklnk) + Dir.chdir(pwd) + end end - if FileTest.directory?(@md.file.output_path.pdf.dir) - pwd=Dir.pwd + end + if @md.opt.act[:pdf_l][:set]==:on + if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{pdf_l}") + mklnk=((@md.file.output_dir_structure.by_language_code?) \ + || (@md.file.output_dir_structure.by_filetype?)) \ + ? "#{@md.fnb}.landscape.pdf" + : 'landscape.pdf' + pwd_set=Dir.pwd Dir.chdir(@md.file.output_path.pdf.dir) FileUtils::rm_f(mklnk) - FileUtils::ln_s(pdf_p, mklnk) - Dir.chdir(pwd) - end - end - if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{pdf_l}") - mklnk=if @md.file.output_dir_structure.by_language_code? \ - or @md.file.output_dir_structure.by_filetype? - "#{@md.fnb}.landscape.pdf" - else 'landscape.pdf' + FileUtils::ln_s(pdf_l, mklnk) + Dir.chdir(pwd_set) end - pwd_set=Dir.pwd - Dir.chdir(@md.file.output_path.pdf.dir) - FileUtils::rm_f(mklnk) - FileUtils::ln_s(pdf_l, mklnk) - Dir.chdir(pwd_set) end else SiSU_Screen::Ansi.new(@md.opt.cmd,"*WARN* FILE NOT FOUND: << #{@md.fns} >> - requested latex system processing skipped").warn @@ -294,9 +321,9 @@ module SiSU_TeX @data=@particulars.dal_array # dal file drawn here @st={ tex: {} } @tex_ml=SiSU_TeX_Pdf::UseTeX.new(@md) - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new @dp=@@dp ||=SiSU_Env::InfoEnv.new.digest.pattern - @brace_url=SiSU_Viz::Skin.new.url_decoration + @brace_url=SiSU_Viz::Defaults.new.url_decoration l=SiSU_Env::StandardiseLanguage.new(@md.opt.lng).language @language=l[:n] @translate=SiSU_Translate::Source.new(@md,@language) @@ -308,7 +335,18 @@ module SiSU_TeX data=@data @@tex_footnote_array=[] @@rights=nil - SiSU_Screen::Ansi.new(@md.opt.cmd,"pdfTex portrait & landscape").txt_grey if @md.opt.cmd=~/[MVvz]/ + txt_gen=if @md.opt.act[:pdf_l][:set]==:on \ + and @md.opt.act[:pdf_p][:set]==:on + 'pdfTex portrait & landscape' + elsif @md.opt.act[:pdf_l][:set]==:on + 'pdfTex landscape' + elsif @md.opt.act[:pdf_p][:set]==:on + 'pdfTex portrait' + else + puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).set(:fuchsia) + 'error: neither landscape nor portrait' + end + SiSU_Screen::Ansi.new(@md.opt.cmd,txt_gen).txt_grey if @md.opt.cmd=~/[MVvz]/ if defined? @md.rights.all \ and not @md.rights.all.empty? rght=@md.rights #.author.dup #dup is necessary, else contents of :rights changed @@ -365,6 +403,7 @@ module SiSU_TeX elsif dob.is ==:break if dob.obj==Mx[:br_page]; dob.tmp='\newpage' elsif dob.obj==Mx[:br_page_new]; dob.tmp='\clearpage' + elsif dob.obj==Mx[:br_page_line]; dob.tmp=' \\ \hline \\ ' elsif dob.obj==Mx[:br_obj]; dob.tmp='\parasep' end elsif dob.is==:comment \ @@ -612,7 +651,7 @@ module SiSU_TeX dob end def tex_box_listings - <<WOK + <<-WOK \\definecolor{listinggray}{gray}{0.9} \\definecolor{lbcolor}{rgb}{0.9,0.9,0.9} \\lstset{ @@ -637,10 +676,10 @@ module SiSU_TeX commentstyle=\\color[rgb]{0.133,0.545,0.133}, stringstyle=\\color[rgb]{0.627,0.126,0.941}, } -WOK + WOK end def tex_box_boites - <<WOK + <<-WOK \\def\\codeblockboitebox{% \\def\\bkvz@before@breakbox{\\ifhmode\\par\\fi\\vskip\\breakboxskip\\relax}% \\def\\bkvz@set@linewidth{\\advance\\linewidth -2\\fboxrule @@ -658,7 +697,7 @@ WOK \\def\\bkvz@bottom{\\hrule\\@height\\fboxrule}% \\breakbox} \\def\\endcodeblockboitebox{\\endbreakbox} -WOK + WOK end def tex_codeblock codeblock_box=if @codeblock_box=='listings' @@ -676,14 +715,18 @@ WOK home=@vz.txt_home.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}|#{Mx[:br_paragraph]}|\\\\/,' - ') #no line splitting in heading neither html nor latex title=@md.title.full.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}|#{Mx[:br_paragraph]}|\\\\/,' - ') #no line splitting in heading neither html nor latex @md.papersize_array.each do |ps| - txt_obj={ txt: "#{home}: - #{title}", paper_size: ps, orientation: 'portrait' } - orient_portrait=SiSU_TeX_Pdf::FormatHead.new(@md,txt_obj) - txt_obj={ txt: "#{home}: - #{title}", paper_size: ps, orientation: 'landscape' } - orient_landscape=SiSU_TeX_Pdf::FormatHead.new(@md,txt_obj) - @@tex_head[ps][:p]=orient_portrait.document_head_with_orientation(@codeblock_box) - @@tex_head[ps][:l]=orient_landscape.document_head_with_orientation(@codeblock_box) - end - @tex_file <<<<WOK + if @md.opt.act[:pdf_p][:set]==:on + txt_obj={ txt: "#{home}: - #{title}", paper_size: ps, orientation: 'portrait' } + orient_portrait=SiSU_TeX_Pdf::FormatHead.new(@md,txt_obj) + @@tex_head[ps][:p]=orient_portrait.document_head_with_orientation(@codeblock_box) + end + if @md.opt.act[:pdf_l][:set]==:on + txt_obj={ txt: "#{home}: - #{title}", paper_size: ps, orientation: 'landscape' } + orient_landscape=SiSU_TeX_Pdf::FormatHead.new(@md,txt_obj) + @@tex_head[ps][:l]=orient_landscape.document_head_with_orientation(@codeblock_box) + end + end + @tex_file <<<<-WOK #{@tex_ml.header}#{@tex_ml.footer} \\tolerance=300 \\clubpenalty=300 @@ -713,15 +756,19 @@ WOK % (tilde hash amp affected by http) % \\sloppy \\begin{document} -WOK + WOK sisu_rc_footnote=if @md.sc_info then @tex_ml.doc_sc_info_footnote_full else @tex_ml.doc_sc_info_footnote_brief end @copymark='' #check and remove as now is superflous x={} txt_obj={ title: @md.title.full } - x[:l]=SiSU_TeX_Pdf::FormatTextObject.new(@md,txt_obj).title_landscape - x[:p]=SiSU_TeX_Pdf::FormatTextObject.new(@md,txt_obj).title_portrait + if @md.opt.act[:pdf_l][:set]==:on + x[:l]=SiSU_TeX_Pdf::FormatTextObject.new(@md,txt_obj).title_landscape + end + if @md.opt.act[:pdf_p][:set]==:on + x[:p]=SiSU_TeX_Pdf::FormatTextObject.new(@md,txt_obj).title_portrait + end @tex_file << x x=nil if defined? @md.creator.author \ @@ -729,20 +776,34 @@ WOK sp_char=SiSU_TeX_Pdf::SpecialCharacters.new(@md,@md.creator.author) author=sp_char.special_characters @tex_file << if @md.author_home - <<WOK + <<-WOK \\author{\\href{#{@md.author_home}}{#{@copymark} \\textnormal{#{author}}}} -WOK + WOK else "\n\\author{#{@copymark} \\textnormal{#{author}}}" end end - @tex_file << unless @md.fnb =~/^mail\s*$/; @tex_ml.site - else '\date' + if defined? @md.make.cover_image \ + and not @md.make.cover_image.nil? \ + and @md.make.cover_image[:cover] =~/\S+/ + x={} + dir=SiSU_Env::InfoEnv.new(@md.fns) + x[:l] =<<-WOK +\\titlepic{\\includegraphics[width=0.3\\textwidth]{#{dir.path.image_source_include}/#{@md.make.cover_image[:cover]}}} + WOK + x[:p] =<<-WOK +\\titlepic{\\includegraphics[width=0.6\\textwidth]{#{dir.path.image_source_include}/#{@md.make.cover_image[:cover]}}} + WOK + @tex_file << x + x=nil end - @tex_file <<<<WOK + @tex_file << unless @md.fnb =~/^mail\s*$/ then @tex_ml.site + else '\date' + end + @tex_file <<<<-WOK \\pagenumbering{roman}\\maketitle \\pagestyle{fancy} -WOK + WOK if defined? @md.rights.all \ and @md.rights.all @tex_file << "\\newpage\n" @@ -751,24 +812,27 @@ WOK end x={} if (@make.build.toc?) - toc=<<WOK + toc=<<-WOK \\renewcommand{\\contentsname}{#{@translate.contents}} \\tableofcontents -WOK + WOK toc_pb={ l: @tex_ml.newpage('landscape'), p: @tex_ml.newpage('portrait') } else toc='' toc_pb={ l: '', p: '' } end - x[:l] =<<WOK + if @md.opt.act[:pdf_l][:set]==:on + x[:l] =<<-WOK #{@tex_ml.newpage('landscape')} \\pagestyle{fancy} #{toc}#{toc_pb[:l]} \\pagenumbering{arabic} #{@tex_ml.paraskip_normal} #{@tex_ml.newpage('landscape')} -WOK - x[:p] =<<WOK + WOK + end + if @md.opt.act[:pdf_p][:set]==:on + x[:p] =<<-WOK #{@tex_ml.newpage('portrait')} \\pagestyle{fancy} #{toc}#{toc_pb[:p]} @@ -776,7 +840,8 @@ WOK \\pagenumbering{arabic} #{@tex_ml.paraskip_normal} #{@tex_ml.newpage('portrait')} -WOK + WOK + end @tex_file << x x=nil data.each do |dob| #% case follows with levels 1-6 indents & graphics @@ -888,59 +953,77 @@ WOK def output_morph_hash(o) ps,h,fn=o[:ps],o[:h],o[:filename] if h[ps] \ - and (h[ps][:p] and h[ps][:l]) - if h[ps][:p] - h[ps][:p]=h[ps][:p].gsub(/[ ]+$/m,''). - gsub(/\n\n\n+/m,"\n\n") - end - if h[ps][:l] - h[ps][:l]=h[ps][:l].gsub(/[ ]+$/m,''). - gsub(/\n\n\n+/m,"\n\n") - end - #h[ps][:p].gsub!(/(?:^[ ]+|[ ]+$)/m,'') if h[ps][:p] - #h[ps][:l].gsub!(/(?:^[ ]+|[ ]+$)/m,'') if h[ps][:l] - if h[ps][:p] !~/\A\s*\Z/ - fn[:portrait].puts h[ps][:p],"\n" - end - if h[ps][:l] !~/\A\s*\Z/ - fn[:landscape].puts h[ps][:l],"\n" - end - elsif (h[:p] and h[:l]) - if h[:p] - h[:p]=h[:p].gsub(/[ ]+$/m,''). - gsub(/\n\n\n+/m,"\n\n") + and (h[ps][:p] or h[ps][:l]) + if @md.opt.act[:pdf_p][:set]==:on + if h[ps][:p] + h[ps][:p]=h[ps][:p].gsub(/[ ]+$/m,''). + gsub(/\n\n\n+/m,"\n\n") + end + if h[ps][:p] !~/\A\s*\Z/ + fn[:portrait].puts h[ps][:p],"\n" + end end - if h[:l] - h[:l]=h[:l].gsub(/[ ]+$/m,''). - gsub(/\n\n\n+/m,"\n\n") + if @md.opt.act[:pdf_l][:set]==:on + if h[ps][:l] + h[ps][:l]=h[ps][:l].gsub(/[ ]+$/m,''). + gsub(/\n\n\n+/m,"\n\n") + end + if h[ps][:l] !~/\A\s*\Z/ + fn[:landscape].puts h[ps][:l],"\n" + end end - #h[:p].gsub!(/(?:^[ ]+|[ ]+$)/m,'') if h[:p] - #h[:l].gsub!(/(?:^[ ]+|[ ]+$)/m,'') if h[:l] - if h[:p] !~/\A\s*\Z/ - fn[:portrait].puts h[:p],"\n" + elsif (h[:p] or h[:l]) + if @md.opt.act[:pdf_p][:set]==:on + if h[:p] + h[:p]=h[:p].gsub(/[ ]+$/m,''). + gsub(/\n\n\n+/m,"\n\n") + end + if h[:p] !~/\A\s*\Z/ + fn[:portrait].puts h[:p],"\n" + end end - if h[:l] !~/\A\s*\Z/ - fn[:landscape].puts h[:l],"\n" + if @md.opt.act[:pdf_l][:set]==:on + if h[:l] + h[:l]=h[:l].gsub(/[ ]+$/m,''). + gsub(/\n\n\n+/m,"\n\n") + end + if h[:l] !~/\A\s*\Z/ + fn[:landscape].puts h[:l],"\n" + end end else p "#{__FILE__}:#{__LINE__}" if @md.opt.cmd.inspect =~/M/ end end def output(array) @array=array=array.flatten.compact - fns_l=@md.fns.gsub(/~/,'-') #this is a sorry fix, but necessary as it appears latex programs like not ~ + fns=@md.fns.gsub(/~/,'-') #this is a sorry fix, but necessary as it appears latex programs like not ~ @md.papersize_array.each do |ps| + texfile_landscape=(@md.opt.act[:pdf_l][:set]==:on) \ + ? (File.new("#{@env.processing_path.tex}/#{fns}.#{ps}.landscape.tex",'w+')) + : nil + texfile_portrait=(@md.opt.act[:pdf_p][:set]==:on) \ + ? (File.new("#{@env.processing_path.tex}/#{fns}.#{ps}.tex",'w+')) + : nil file={ - landscape: File.new("#{@env.processing_path.tex}/#{fns_l}.#{ps}.landscape.tex",'w+'), - portrait: File.new("#{@env.processing_path.tex}/#{fns_l}.#{ps}.tex",'w+') + landscape: texfile_landscape, + portrait: texfile_portrait } - file[:portrait] << @@tex_head[ps][:p] - file[:landscape] << @@tex_head[ps][:l] + if @md.opt.act[:pdf_p][:set]==:on + file[:portrait] << @@tex_head[ps][:p] + end + if @md.opt.act[:pdf_l][:set]==:on + file[:landscape] << @@tex_head[ps][:l] + end array.each do |morph| if morph.is_a?(String) #morph.gsub!(/^\s+/,'') if morph !~/\A\s*\Z/ - file[:portrait].puts morph,"\n" - file[:landscape].puts morph,"\n" + if @md.opt.act[:pdf_p][:set]==:on + file[:portrait].puts morph,"\n" + end + if @md.opt.act[:pdf_l][:set]==:on + file[:landscape].puts morph,"\n" + end end elsif morph.class.inspect =~ /SiSU_DAL_DocumentStructure/ \ and morph.tmp \ @@ -952,8 +1035,12 @@ WOK end if (morph.tmp !~/\A\s*\Z/) \ || morph.is==:code - file[:portrait].puts morph.tmp,"\n" - file[:landscape].puts morph.tmp,"\n" + if @md.opt.act[:pdf_p][:set]==:on + file[:portrait].puts morph.tmp,"\n" + end + if @md.opt.act[:pdf_l][:set]==:on + file[:landscape].puts morph.tmp,"\n" + end end elsif morph.is_a?(Hash) #inserted headers and the like, only h={ ps: ps, h: morph, filename: file } @@ -964,8 +1051,12 @@ WOK end end array=@array - file[:portrait].close - file[:landscape].close + if @md.opt.act[:pdf_p][:set]==:on + file[:portrait].close + end + if @md.opt.act[:pdf_l][:set]==:on + file[:landscape].close + end end @@tex_head={ 'a4'=> { p: nil, l: nil }, diff --git a/lib/sisu/v3/texpdf_format.rb b/lib/sisu/v5/texpdf_format.rb index 30ccc862..df6c5a25 100644 --- a/lib/sisu/v3/texpdf_format.rb +++ b/lib/sisu/v5/texpdf_format.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/texpdf_format.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/texpdf_format.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -65,7 +65,7 @@ module SiSU_TeX_Pdf class BareUrls def initialize(md,dob=nil) @md,@dob=md,dob - @brace_url=SiSU_Viz::Skin.new.url_decoration + @brace_url=SiSU_Viz::Defaults.new.url_decoration end def bare_urls @dob.obj=@dob.obj.gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/, @@ -103,8 +103,8 @@ module SiSU_TeX_Pdf else @center_begin,@center_end='','' end @start_table='' - @tx=SiSU_Env::GetInit.instance.tex - @brace_rel=SiSU_Viz::Skin.new.rel_decoration + @tx=SiSU_Env::GetInit.new.tex + @brace_rel=SiSU_Viz::Defaults.new.rel_decoration @env ||=SiSU_Env::InfoEnv.new(@md.fns) @tex2pdf=@@tex3pdf ||=SiSU_Env::SystemCall.new.tex2pdf_engine @make ||=SiSU_Env::ProcessingSettings.new(@md) @@ -733,8 +733,8 @@ module SiSU_TeX_Pdf p t_o.class p caller end - @tx=SiSU_Env::GetInit.instance.tex - @brace_url=SiSU_Viz::Skin.new.url_decoration + @tx=SiSU_Env::GetInit.new.tex + @brace_url=SiSU_Viz::Defaults.new.url_decoration @tex2pdf=@@tex3pdf ||=SiSU_Env::SystemCall.new.tex2pdf_engine @ps=@txt if @txt=~/(?:a4|letter|legal|book|a5|b5)/i @lang ||=SiSU_i18n::Languages.new #.list[@md.opt.lng][:xlp] @@ -802,7 +802,7 @@ module SiSU_TeX_Pdf # fc-list :outline -f "%{family}\n" case @tex2pdf when /xe/ - <<WOK + <<-WOK \\usepackage{polyglossia, ucs, fontspec, xltxtra, xunicode} \\setmainlanguage{#{tex_head_lang[:mainlang]}} \\setotherlanguage{#{tex_head_lang[:otherlang]}} @@ -810,19 +810,19 @@ module SiSU_TeX_Pdf \\setmonofont[Scale=0.85]{#{texpdf_font_mono}} % \\setsansfont{#{texpdf_font_sans}} % \\setromanfont{#{texpdf_font_serif}} -WOK + WOK when /pdf/ if @md.file_encoding =~ /iso-?8859/i #% iso8859 - <<WOK + <<-WOK % \\usepackage[latin1]{inputenc} \\usepackage{fontspec} -WOK + WOK else #% utf-8 assumed - <<WOK + <<-WOK \\usepackage{babel} \\usepackage{ucs} \\usepackage[utf8x]{inputenc} -WOK + WOK end end end @@ -830,18 +830,18 @@ WOK generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version] lastdone="Last Generated on: #{Time.now}" rubyv="Ruby version: #{@md.ruby_version}" - <<WOK + <<-WOK %% SiSU (Linux & Ruby - \"better ways\") LaTeX output %% #{generator} %% #{rubyv} %% LaTeX output %% #{lastdone} %% SiSU http://www.jus.uio.no/sisu -WOK + WOK end def tex_head_paper_portrait(d) multicol=(@md.book_idx ? '\usepackage{multicol}' : '') - <<WOK + <<-WOK #{tex_head_info} \\documentclass[#{d[:fontsize]},#{d[:papertype]},titlepage]{scrartcl} %with titlepage \\setlength{\\textheight}{#{d[:textheight]}mm} \\setlength{\\textwidth}{#{d[:textwidth]}mm} @@ -851,10 +851,10 @@ WOK \\setlength{\\marginparsep}{#{d[:marginparsep]}} \\setlength{\\marginparwidth}{#{d[:marginparwidth]}} #{multicol} -WOK + WOK end def tex_head_paper_landscape(d) - <<WOK + <<-WOK #{tex_head_info} \\documentclass[#{d[:fontsize]},#{d[:papertype]},landscape,titlepage,twocolumn]{scrartcl} %with titlepage \\setlength{\\textheight}{#{d[:textheight]}mm} \\setlength{\\textwidth}{#{d[:textwidth]}mm} @@ -864,10 +864,10 @@ WOK \\setlength{\\columnsep}{#{d[:columnsep]}} \\setlength{\\marginparsep}{#{d[:marginparsep]}} \\setlength{\\marginparwidth}{#{d[:marginparwidth]}} -WOK + WOK end def tex_head_paper_portrait_dvi(d) - <<WOK + <<-WOK #{tex_head_info} \\documentclass[#{d[:fontsize]},#{d[:papertype]},titlepage]{scrartcl} %with titlepage \\setlength{\\textheight}{#{d[:textheight]}mm} \\setlength{\\textwidth}{#{d[:textwidth]}mm} @@ -876,7 +876,7 @@ WOK \\setlength{\\headsep}{#{d[:headsep]}} \\setlength{\\marginparsep}{#{d[:marginparsep]}} \\setlength{\\marginparwidth}{#{d[:marginparwidth]}} -WOK + WOK end def tex_head_paper_dimensions d={} @@ -950,22 +950,22 @@ WOK def tex_head_pdftex_dvi color=case @layout when /portrait/ - <<WOK + <<-WOK colorlinks=true, urlcolor=myblack, filecolor=myblack, linkcolor=myblack, -WOK + WOK when /landscape/ - <<WOK + <<-WOK colorlinks=true, urlcolor=myblue, % \\href{...}{...} external url filecolor=mygreen, % \\href{...} local file linkcolor=myred, % \\href{...} and \\pageref{...} -WOK + WOK end if @layout =~/portrait|landscape/ - <<WOK + <<-WOK \\usepackage{alltt} \\usepackage{thumbpdf} \\usepackage[#{@tex2pdf}, @@ -1004,9 +1004,9 @@ WOK \\definecolor{mywhite}{rgb}{1,1,1} \\usepackage{url} %\\usepackage{breakurl} -WOK + WOK elsif @txt =~/dvi/ - <<WOK + <<-WOK \\usepackage{alltt} #{color.strip} pageanchor=true, @@ -1025,16 +1025,16 @@ WOK \\definecolor{mywhite}{rgb}{1,1,1} \\usepackage{url} %\\usepackage{breakurl} -WOK + WOK end end def tex_head_codeblock(codeblock_box_type) codeblock_box=if codeblock_box_type=='listings' - <<WOK + <<-WOK \\usepackage{listings} \\usepackage{color} \\usepackage{textcomp} -WOK + WOK elsif codeblock_box_type=='boites' "\\usepackage{boites}" else @@ -1043,24 +1043,25 @@ WOK codeblock_box end def tex_head_misc - <<WOK + <<-WOK \\usepackage{textcomp} \\usepackage[parfill]{parskip} \\usepackage[normalem]{ulem} \\usepackage{soul} \\usepackage{longtable} +\\usepackage[tc]{titlepic} \\usepackage{graphicx} \\makeatletter \\parindent0pt %\\usepackage{mathptmx} \\usepackage{amssymb} % amssymb used for backslash -WOK + WOK end def document_head_with_orientation(codeblock_box_type) - endnotes=("\\usepackage{endnotes}" if @txt =~/endnotes?/)||'' #not implemented see also def endnotes + endnotes=("\\usepackage{endnotes}" if @txt =~/endnotes?/) || '' #not implemented see also def endnotes @lang.list[@md.i18n[0]][:xlp] - <<WOK + <<-WOK #{tex_head_paper} #{tex_head_encode} #{tex_head_pdftex_dvi} @@ -1137,7 +1138,7 @@ WOK {\\normalfont\\normalsize\\itshape\\raggedright}} % \\makeatother \\selectlanguage{#{@lang.list[@md.i18n[0]][:xlp]}} -WOK + WOK end def a4generic end @@ -1145,7 +1146,7 @@ WOK class SpecialCharacters def initialize(md,str,is=:default) @md,@txt,@is=md,str,is - @brace_url=SiSU_Viz::Skin.new.url_decoration + @brace_url=SiSU_Viz::Defaults.new.url_decoration @tex2pdf=@@tex3pdf ||=SiSU_Env::SystemCall.new.tex2pdf_engine end def xetex_code_listings(str,is=:default) # ~ ^ $ & % _ { } #LaTeX special characters - KEEP list @@ -1194,7 +1195,6 @@ WOK gsub(/\\copy(right|mark)?/,'<=copymark>') # ok problem with superscript end def xetex_special_characters_1(str,is=:default) # ~ ^ $ & % _ { } #LaTeX special characters - KEEP list - #str=Iconv.conv('ISO-8859-1', 'UTF-8', @txt) # `require': iconv will be deprecated in the future, use String#encode instead. word=str.scan(/\S+|\n/) #unless line =~/^(?:@\S|%+\s)/ para_array=[] str=if word @@ -1388,10 +1388,10 @@ WOK attr_accessor :url,:txt,:date def initialize(md) @md=md - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new @date=SiSU_Env::InfoDate.new # #{@date.year} @copymark='{\\begin{footnotesize}\\raisebox{1ex}{\\copyright}\\end{footnotesize}}' - @brace_url=SiSU_Viz::Skin.new.url_decoration + @brace_url=SiSU_Viz::Defaults.new.url_decoration end def skip "\n\\vspace*{\\smallskipamount} \n" @@ -1425,21 +1425,14 @@ WOK "\\rhead[ ]{ }\n" end def footer - base_prog_txt=if @md.base_program - case @md.base_program - when /kdissert/i; " \\\\ \\href{http://freehackers.org/~tnagy/kdissert/}{Kdissert}" - else '' - end - else '' - end - "\\lfoot[\\textrm{\\thepage}]{\\tiny \\href{#{@vz.url_footer_signature}}{#{@vz.txt_signature}}#{base_prog_txt}}\n" + - "\\cfoot[\\href{#{@vz.url_home}}{#{@vz.url_txt}}]{\\href{#{@vz.url_home}}{#{@vz.url_txt}}}\n" + - "\\rfoot[\\tiny \\href{#{@vz.url_sisu}}{#{@vz.txt_signature}}]{\\textrm{\\thepage}}\n" + f="\\lfoot[\\textrm{\\thepage}]{\\tiny \\href{#{@md.footer_links[:left][:url]}}{#{@md.footer_links[:left][:say]}}}\n" + + "\\cfoot{\\href{#{@md.footer_links[:center][:url]}}{#{@md.footer_links[:center][:say]}}}\n" + + "\\rfoot[\\tiny \\href{}{}]{\\textrm{\\thepage}}\n" end def site if not @vz.url_home.empty? \ and not @vz.url_txt.empty? - "\n\\date{\\begin{footnotesize} copy @ \\href{#{@vz.url_home}}{#{@vz.url_txt}} \\end{footnotesize}}" + "\n\\date{\\begin{tiny} \\end{tiny}}" else '' end end @@ -1453,13 +1446,13 @@ WOK def newpage(orientation) case orientation when /landscape/ # using longtable latex package -<<WOK + <<-WOK \\clearpage -WOK + WOK when /portrait/ -<<WOK + <<-WOK \\newpage -WOK + WOK end end def sisu_rights @@ -1471,7 +1464,7 @@ WOK end else '' end -<<WOK + <<-WOK \\\\ ~ {\\begin{footnotesize}#{base_prog_txt} \\\\ Generated by \\href{http://www.jus.uio.no/sisu}{SiSU} \\begin{tiny}[ #{v[:project]} #{v[:version]} of #{v[:date_stamp]} ]\\end{tiny} \\href{http://www.jus.uio.no/sisu}{www.jus.uio.no/sisu} @@ -1480,19 +1473,19 @@ WOK \\\\ SiSU is released under \\href{http://www.fsf.org/licenses/gpl.html}{GPL 3 } or later, #{@brace_url.tex_open}\\href{http://www.fsf.org/licenses/gpl.html}{http://www.fsf.org/licenses/gpl.html}#{@brace_url.tex_close}. {\\end{footnotesize} \\\\ -WOK + WOK end def doc_sc_info_footnote_full -<<WOK + <<-WOK \\footnote{%\nGenerated by \\href{http://www.jus.uio.no/sisu}{SiSU \\ www.jus.uio.no/sisu }\\ \\newline \\scriptsize{Document version information: \\emph{sourcefile} \\uline{#{@md.fnstex}}; \\emph{version} \\uline{#{@md.sc_number}}; \\emph{date} \\uline{#{@md.sc_date}}; \\emph{time} \\uline{#{@md.sc_time}}}} -WOK + WOK end def doc_sc_info_footnote_brief " \\footnote{%\nGenerated by \\href{http://www.jus.uio.no/sisu}{SiSU} \\ \\href{http://www.jus.uio.no/sisu}{www.jus.uio.no/sisu} \\newline \\href{http://www.sisudoc.org}{www.sisudoc.org} \\\n}" end def doc_sc_info v=SiSU_Env::InfoVersion.instance.get_version -<<WOK + <<-WOK \\\\ {\\begin{footnotesize} Document version information: \\\\ @@ -1500,11 +1493,11 @@ Document version information: \\\\ Generated by \\href{http://www.jus.uio.no/sisu}{SiSU www.jus.uio.no/sisu }\\- version information: \\\\ \\uline{ #{v[:project]} #{v[:version]} of #{v[:date_stamp]}} \\end{footnotesize}}& -WOK + WOK end def doc_no_sc_info v=SiSU_Env::InfoVersion.instance.get_version -<<WOK + <<-WOK \\\\ {\\begin{small} Document information: \\\\ @@ -1513,15 +1506,15 @@ Generated by \\href{http://www.jus.uio.no/sisu}{SiSU www.jus.uio.no/sisu } \\\\ \\uline{ #{v[:project]} #{v[:version]} of #{v[:date_stamp]}} \\end{small}}& -WOK + WOK end def endnotes #not used should be inserted before MetaData section which preceeds doc_tail, but is "part of document" -<<WOK + <<-WOK \\subsection*{Endnotes} \\addcontentsline{toc}{section}{Endnotes} \\ \\listofendnotes -WOK + WOK end def doc_tail dir=SiSU_Env::InfoEnv.new(@md.fns) @@ -1534,7 +1527,7 @@ WOK " SiSU " end url=@md.fnb.gsub(/(?:\\)*([$&~%_#}{^])/,'\\\\\1') -<<WOK + <<-WOK \\begin{english}[variant=british] \\subsection*{Information on this document copy and an unofficial List of Some web related information and sources} \\addcontentsline{toc}{section}{Information on this document copy and an unofficial List of Some web related information and sources} @@ -1561,11 +1554,11 @@ WOK #{sitename} found at: \\begin{scriptsize}#{site}\\end{scriptsize}\\subsubsection*{Links that may be of interest at #{@vz.txt_home} and elsewhere:} \\addcontentsline{toc}{subsection}{Links that may be of interest} \\end{english} -WOK + WOK end def mail_tail #not retested, the old mail_tail is commented out and appended to this program dir=SiSU_Env::InfoEnv.new(@md.fns) -<<WOK + <<-WOK \\subsection*{Mail sender details} \\addcontentsline{toc}{subsection}{Mail sender details} \\\\ @@ -1576,7 +1569,7 @@ Mail from: ralph@amissah.com\\\\ \"Support Open Standards and Open Sources for the Information Technology Infrastructure\" RA \\subsubsection*{Information on this document copy #{site}\\copyright} Presentations' look and feel generated by \\href{http://www.jus.uio.no/sisu/}{SiSU Scribe} \\href{http://www.jus.uio.no/sisu/}{http://www.jus.uio.no/sisu/} programmed in Ruby on Debian/Gnu/Linux by Copyright \\copyright Ralph Amissah, W3 since October 3 1993 \\href{http://www.jus.uio.no/sisu/}{\\includegraphics*[width=35pt]{#{dir.path.image_source_include}/sisu.png}}for #{sitename}. SiSU Scribe (sisu information structuring unit) produces Electronic Documents, i.e. it generates structured output for use in a number of file formats, including the pdf file produced here. -WOK + WOK end end end diff --git a/lib/sisu/v3/update.rb b/lib/sisu/v5/update.rb index 039dace8..c311b77c 100644 --- a/lib/sisu/v3/update.rb +++ b/lib/sisu/v5/update.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/update.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/update.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v3/urls.rb b/lib/sisu/v5/urls.rb index d04225cc..0a583f99 100644 --- a/lib/sisu/v3/urls.rb +++ b/lib/sisu/v5/urls.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/urls.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/urls.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -320,11 +320,17 @@ module SiSU_Urls show.epub(x) end if x=~/--html\b/ \ - and @opt.act[:html][:set]==:on + and (@opt.act[:html][:set]==:on \ + or @opt.act[:html_scroll][:set]==:on \ + or @opt.act[:html_seg][:set]==:on) if x =~/scroll/ - show.html.scroll(x) + if @opt.act[:html_scroll][:set]==:on + show.html.scroll(x) + end else - show.html.toc(x) + if @opt.act[:html_seg][:set]==:on + show.html.toc(x) + end end end if x=~/--texinfo\b/ \ @@ -353,11 +359,17 @@ module SiSU_Urls end end if x=~/--pdf\b/ \ - and @opt.act[:pdf][:set]==:on + and (@opt.act[:pdf][:set]==:on \ + or @opt.act[:pdf_p][:set]==:on \ + or @opt.act[:pdf_l][:set]==:on) if x =~/portrait/ - show.pdf.portrait(x) + if @opt.act[:pdf_p][:set]==:on + show.pdf.portrait(x) + end else - show.pdf.landscape(x) + if @opt.act[:pdf_l][:set]==:on + show.pdf.landscape(x) + end end end if x=~/--sisupod\b/ \ diff --git a/lib/sisu/v3/utils.rb b/lib/sisu/v5/utils.rb index 260e1883..eb707ee9 100644 --- a/lib/sisu/v3/utils.rb +++ b/lib/sisu/v5/utils.rb @@ -48,10 +48,9 @@ * Download: <http://www.sisudoc.org/sisu/en/SiSU/download.html> - * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/utils.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/utils.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -60,8 +59,8 @@ ** Description: system environment, debug related =end -module SiSU_Debug - class Mark +module SiSU_Utils + class CodeMarker def initialize(line,file,color=:red) @line,@file,@color=line.to_s,file,color end @@ -104,6 +103,17 @@ module SiSU_Debug @file.gsub(/([^\/]+$)/,"#{c[:on]}\\1#{c[:off]}") end end + class Path + def initialize(dir=Dir.pwd) + @dir=dir + end + def base_markup + (/(\S+?)(?:\/(?:#{Px[:lng_lst_rgx]}))?$/).match(Dir.pwd)[1] + end + def bmd + base_markup + end + end end __END__ puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).set(:red) diff --git a/lib/sisu/v3/webrick.rb b/lib/sisu/v5/webrick.rb index 7efc5414..67c44d50 100644 --- a/lib/sisu/v3/webrick.rb +++ b/lib/sisu/v5/webrick.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/webrick.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/webrick.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v3/wikispeak.rb b/lib/sisu/v5/wikispeak.rb index f7267705..e9ada3be 100644 --- a/lib/sisu/v3/wikispeak.rb +++ b/lib/sisu/v5/wikispeak.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/wikispeak.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/wikispeak.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -88,7 +88,6 @@ module SiSU_Wikispeak SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/#{@md.fnb}/#{@md.fn[:wiki]}").flow if @opt.cmd =~/[MV]/ @dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here SiSU_Wikispeak::Source::Scroll.new(@dal_array,@md).songsheet - SiSU_Env::InfoSkin.new(@md).select #watch rescue SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do __LINE__.to_s + ':' + __FILE__ @@ -153,7 +152,7 @@ module SiSU_Wikispeak @@dp=nil def initialize(data,md) @data,@md=data,md - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new @dp=@@dp ||=SiSU_Env::InfoEnv.new.digest.pattern @regx=/^(?:(?:#{Mx[:br_line]}\s*|#{Mx[:br_nl]}\s*)?#{Mx[:lv_o]}\d:(\S*?)#{Mx[:lv_c]}\s*)?(.+)/ #fix Mx[:lv_o] #m # 2004w18 pb pn removal added @tab="\t" @@ -181,8 +180,7 @@ WOK end end def wiki_tail - SiSU_Env::InfoSkin.new(@md).select - vz=SiSU_Env::GetInit.instance.skin + vz=SiSU_Viz::Defaults.new generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version] lastdone="Last Generated on: #{Time.now}" rubyv="Ruby version: #{@md.ruby_version}" diff --git a/lib/sisu/v3/xhtml.rb b/lib/sisu/v5/xhtml.rb index 95d5ab56..2b972e0e 100644 --- a/lib/sisu/v3/xhtml.rb +++ b/lib/sisu/v5/xhtml.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/xhtml.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/xhtml.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -93,7 +93,7 @@ module SiSU_XHTML else "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}" end @opt.cmd=~/[MVvz]/ \ - ? SiSU_Screen::Ansi.new(@opt.cmd,'invert','XHTML',tool).colorize + ? SiSU_Screen::Ansi.new(@opt.cmd,'XHTML',tool).green_hi_blue : SiSU_Screen::Ansi.new(@opt.cmd,'XHTML',tool).green_title_hi SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"/#{@md.file.output_path.xhtml.dir}/#{@md.file.base_filename.xhtml}").flow if @opt.cmd =~/[MV]/ end @@ -133,7 +133,7 @@ module SiSU_XHTML @@xml={ body: [], sisu: [], open: [], close: [], head: [] } def initialize(particulars) @env,@md,@dal_array=particulars.env,particulars.md,particulars.dal_array - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new @tab="\t" @trans=SiSU_XML_Munge::Trans.new(@md) @sys=SiSU_Env::SystemCall.new diff --git a/lib/sisu/v3/xhtml_table.rb b/lib/sisu/v5/xhtml_table.rb index c3bb84c4..1431306d 100644 --- a/lib/sisu/v3/xhtml_table.rb +++ b/lib/sisu/v5/xhtml_table.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/xhtml_table.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/xhtml_table.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -65,7 +65,7 @@ module SiSU_XHTML_Table @@tablehead=0 @@tablefoot=[] #watch def initialize(table) - @table_obj,@vz=table,SiSU_Env::GetInit.instance.skin + @table_obj,@vz=table,SiSU_Viz::Defaults.new end def table table_obj=@table_obj diff --git a/lib/sisu/v3/xml.rb b/lib/sisu/v5/xml.rb index 101b30d0..913d1afc 100644 --- a/lib/sisu/v3/xml.rb +++ b/lib/sisu/v5/xml.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/xml.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/xml.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -91,7 +91,7 @@ module SiSU_XML_SAX else "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}" end @opt.cmd=~/[MVvz]/ \ - ? SiSU_Screen::Ansi.new(@opt.cmd,'invert','XML SAX',tool).colorize + ? SiSU_Screen::Ansi.new(@opt.cmd,'XML SAX',tool).green_hi_blue : SiSU_Screen::Ansi.new(@opt.cmd,'XML SAX',tool).green_title_hi SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"file://#{@md.file.output_path.xml_sax.dir}/#{@md.file.base_filename.xml_sax}").flow if @opt.cmd =~/[MV]/ end @@ -132,7 +132,7 @@ module SiSU_XML_SAX @@xml={ body: [], open: [], close: [], head: [] } def initialize(particulars) @env,@md,@dal_array=particulars.env,particulars.md,particulars.dal_array - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new @trans=SiSU_XML_Munge::Trans.new(@md) @sys=SiSU_Env::SystemCall.new end diff --git a/lib/sisu/v3/xml_dom.rb b/lib/sisu/v5/xml_dom.rb index bc2affa5..80dc397d 100644 --- a/lib/sisu/v3/xml_dom.rb +++ b/lib/sisu/v5/xml_dom.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/xml_dom.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/xml_dom.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -92,7 +92,7 @@ module SiSU_XML_DOM else "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}" end @opt.cmd=~/[MVvz]/ \ - ? SiSU_Screen::Ansi.new(@opt.cmd,'invert','XML DOM',tool).colorize + ? SiSU_Screen::Ansi.new(@opt.cmd,'XML DOM',tool).green_hi_blue : SiSU_Screen::Ansi.new(@opt.cmd,'XML DOM',tool).green_title_hi SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"file://#{@md.file.output_path.xml_dom.dir}/#{@md.file.base_filename.xml_dom}").flow if @opt.cmd =~/[MV]/ end @@ -131,7 +131,7 @@ module SiSU_XML_DOM @@xml={ body: [], open: [], close: [], head: [], sc: [] } def initialize(particulars) @env,@md,@dal_array=particulars.env,particulars.md,particulars.dal_array - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new @trans=SiSU_XML_Munge::Trans.new(@md) @sys=SiSU_Env::SystemCall.new end diff --git a/lib/sisu/v3/xml_fictionbook.rb b/lib/sisu/v5/xml_fictionbook.rb index 7082d98d..6d0073c1 100644 --- a/lib/sisu/v3/xml_fictionbook.rb +++ b/lib/sisu/v5/xml_fictionbook.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/xml_fictionbook.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/xml_fictionbook.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v3/xml_format.rb b/lib/sisu/v5/xml_format.rb index 0e76d40a..cccfc59f 100644 --- a/lib/sisu/v3/xml_format.rb +++ b/lib/sisu/v5/xml_format.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/xml_format.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/xml_format.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -153,21 +153,31 @@ module SiSU_XML_Format @rdf_date_modified=%{ dc.date.modified="#{@md.date.modified}"\n} @date_modified=%{<meta name="dc.date.modified" content="#{@md.date.modified}" #{@md.date_modified_scheme} />\n} end - if defined? @md.type \ - and @md.type # DublinCore 8 - type (genre eg. report, convention etc) - @rdf_type=%{ dc.type="#{@md.type}"\n} - @type=%{<meta name="dc.type" content="#{@md.type}" />\n} + if defined? @md.notes.coverage \ + and @md.notes.coverage=~/\S+/ # DublinCore 14 - coverage + @rdf_coverage=%{ dc.coverage="#{@md.notes.coverage}"\n} + @coverage=%{<meta name="dc.coverage" content="#{@md.notes.coverage}" />\n} end - if defined? @md.classify.format \ - and @md.classify.format=~/\S+/ # DublinCore 9 - format (use your mime type) - @rdf_format=%{ dc.format="#{@md.classify.format}"\n} - @format=%{<meta name="dc.format" content="#{@md.classify.format}" />\n} + if defined? @md.notes.relation \ + and @md.notes.relation=~/\S+/ # DublinCore 13 - relation + @rdf_relation=%{ dc.relation="#{@md.notes.relation}"\n} + @relation=%{<meta name="dc.relation" content="#{@md.notes.relation}" />\n} end - if defined? @md.classify.identifier \ - and @md.classify.identifier=~/\S+/ # DublinCore 10 - identifier (your identifier, could use urn which is free) - @rdf_identifier=%{ dc.identifier="#{@md.classify.identifier}"\n} - @identifier=%{<meta name="dc.identifier" content="#{@md.identifier}" />\n} + if defined? @md.notes.type \ + and @md.notes.type # DublinCore 8 - type (genre eg. report, convention etc) + @rdf_type=%{ dc.type="#{@md.notes.type}"\n} + @type=%{<meta name="dc.type" content="#{@md.notes.type}" />\n} end + if defined? @md.notes.format \ + and @md.notes.format=~/\S+/ # DublinCore 9 - format (use your mime type) + @rdf_format=%{ dc.format="#{@md.notes.format}"\n} + @format=%{<meta name="dc.format" content="#{@md.notes.format}" />\n} + end + #if defined? @md.identifier.sisupod \ + #and @md.identifier.sisupod=~/\S+/ # DublinCore 10 - identifier (your identifier, could use urn which is free) + # @rdf_identifier=%{ dc.identifier="#{@md.identifier.sisupod}"\n} + # @identifier=%{<meta name="dc.identifier" content="#{@md.identifier.sisupod}" />\n} + #end if defined? @md.original.source \ and @md.original.source=~/\S+/ # DublinCore 11 - source (document source) @rdf_source=%{ dc.source="#{@md.original.source}"\n} @@ -178,16 +188,6 @@ module SiSU_XML_Format @rdf_language=%{ dc.language="#{@md.original.title}"\n} @language=%{<meta name="dc.language" content="#{@md.language[:name]}" />\n} end - if defined? @md.classify.relation \ - and @md.classify.relation=~/\S+/ # DublinCore 13 - relation - @rdf_relation=%{ dc.relation="#{@md.classify.relation}"\n} - @relation=%{<meta name="dc.relation" content="#{@md.classify.relation}" />\n} - end - if defined? @md.classify.coverage \ - and @md.classify.coverage=~/\S+/ # DublinCore 14 - coverage - @rdf_coverage=%{ dc.coverage="#{@md.classify.coverage}"\n} - @coverage=%{<meta name="dc.coverage" content="#{@md.classify.coverage}" />\n} - end if defined? @md.rights.all \ and @md.rights.all=~/\S+/ # DublinCore 15 - rights @rdf_rights=%{ dc.rights="#{@md.rights.all}"\n} @@ -196,7 +196,7 @@ module SiSU_XML_Format @copyright=%{<meta name="copyright" content="#{@md.rights.copyright.all}" />\n} if @md.rights.copyright.all # possibly redundant see dc.rights @owner=%{<meta name="owner" content="#{@md.owner}" />\n} if @md.owner @keywords=%{<meta name="keywords" content="#{@md.keywords}" />\n} if @md.keywords - @vz=SiSU_Env::GetInit.instance.skin #margin,paragraph,table,banner,url,png,txt,color,font,nav_txt,nav_png,credits,js,php + @vz=SiSU_Viz::Defaults.new #margin,paragraph,table,banner,url,png,txt,color,font,nav_txt,nav_png,credits,js,php @index='index' end def table_close @@ -283,7 +283,7 @@ WOK @lnk_url=@lnk_url.gsub(rgx,'') if @lnk_url =~rgx rgx=/~\{\d+\s+(.+?)\}~/ @lnk_url=@lnk_url.gsub(rgx,'\1') if @lnk_url =~rgx - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new end def scr_endnote_body "<endnote>#{@txt}</endnote> " @@ -361,7 +361,7 @@ WOK @md=md @rdf=SiSU_XML_Tags::RDF.new(md) # DublinCore 1 - title - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new @stylesheet=SiSU_Style::CSS_HeadInfo.new(md).stylesheet @seg_name_html=(SiSU_HTML::Source::Seg.new.seg_name_html || []) @seg_name_html_tracker=(SiSU_HTML::Source::Seg.new.seg_name_html_tracker || []) @@ -977,7 +977,7 @@ WOK end end class FormatTextObject - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new attr_accessor :md,:dob,:txt,:ocn,:format,:table,:link,:linkname,:paranum,:p_num,:headname,:banner,:url def initialize(md,t_o) @md,@t_o=md,t_o @@ -1023,7 +1023,7 @@ WOK end end @dob=t_o if defined? t_o.is - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new end def endnote_body %{ @@ -1200,7 +1200,7 @@ WOK class FormatScroll < FormatTextObject def initialize(md,txt) super(md,txt) - @vz=SiSU_Env::GetInit.instance.skin + @vz=SiSU_Viz::Defaults.new end end class FormatSeg < FormatTextObject diff --git a/lib/sisu/v3/xml_md_oai_pmh_dc.rb b/lib/sisu/v5/xml_md_oai_pmh_dc.rb index 81b22d16..e5857fb1 100644 --- a/lib/sisu/v3/xml_md_oai_pmh_dc.rb +++ b/lib/sisu/v5/xml_md_oai_pmh_dc.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/xml_md_oai_pmh_dc.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/xml_md_oai_pmh_dc.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -94,95 +94,96 @@ WOK @oai_pmh << %{ <dc:author>#{txt}</dc:author>\n} end if defined? @md.classify.subject \ - and @md.classify.subject=~/\S+/ # DublinCore 3 - subject (us library of congress, eric or udc, or schema???) + and @md.classify.subject=~/\S+/ # DublinCore 3 - subject (us library of congress, eric or udc, or schema???) txt=meta_content_clean(@md.classify.subject) @oai_pmh << %{ <dc:subject>#{txt}</dc:subject>\n} end - if defined? @md.notes.description \ - and @md.notes.description=~/\S+/ # DublinCore 4 - description - txt=meta_content_clean(@md.notes.description) - @oai_pmh << %{ <dc:description>#{txt}</dc:description>\n} + if defined? @md.classify.keywords \ + and @md.classify.keywords=~/\S+/ + txt=meta_content_clean(@md.classify.keywords) + @oai_pmh << %{ <dc:keywords>#{txt}</dc:keywords>\n} end - if @md.publisher # DublinCore 5 - publisher (current copy published by) + if @md.publisher # DublinCore 5 - publisher (current copy published by) txt=meta_content_clean(@md.publisher) @oai_pmh << %{ <dc:publisher>#{txt}</dc:publisher>\n} end if defined? @md.creator.contributor \ - and @md.creator.contributor=~/\S+/ # DublinCore 6 - contributor + and @md.creator.contributor=~/\S+/ # DublinCore 6 - contributor txt=meta_content_clean(@md.creator.contributor) @oai_pmh << %{ <dc:contributor>#{txt}</dc:contributor>\n} end if defined? @md.date.published \ - and @md.date.published=~/\S+/ # DublinCore 7 - date year-mm-dd + and @md.date.published=~/\S+/ # DublinCore 7 - date year-mm-dd @oai_pmh << %{ <dc:date>#{@md.date.published}</dc:date>\n} end if defined? @md.date.created \ - and @md.date.created=~/\S+/ # DublinCore 7 - date.created + and @md.date.created=~/\S+/ # DublinCore 7 - date.created @oai_pmh << %{ <dc:date_created>#{@md.date.created}</dc:date_created>\n} end if defined? @md.date.issued \ - and @md.date.issued=~/\S+/ # DublinCore 7 - date.issued + and @md.date.issued=~/\S+/ # DublinCore 7 - date.issued @oai_pmh << %{ <dc:date_issued>#{@md.date.issued}</dc:date_issued>\n} end if defined? @md.date.available \ - and @md.date.available=~/\S+/ # DublinCore 7 - date.available + and @md.date.available=~/\S+/ # DublinCore 7 - date.available @oai_pmh << %{ <dc:date_available>#{@md.date.available}</dc:date_available>\n} end if defined? @md.date.valid \ - and @md.date.valid=~/\S+/ # DublinCore 7 - date.valid + and @md.date.valid=~/\S+/ # DublinCore 7 - date.valid @oai_pmh << %{ <dc:date_valid>#{@md.date.valid}</dc:date_valid>\n} end if defined? @md.date.modified \ - and @md.date.modified=~/\S+/ # DublinCore 7 - date.modified + and @md.date.modified=~/\S+/ # DublinCore 7 - date.modified @oai_pmh << %{ <dc:date_modified>#{@md.date.modified}</dc:date_modified>\n} end - if @md.type # DublinCore 8 - type - txt=meta_content_clean(@md.type) + if defined? @md.notes.description \ + and @md.notes.description=~/\S+/ # DublinCore 4 - description + txt=meta_content_clean(@md.notes.description) + @oai_pmh << %{ <dc:description>#{txt}</dc:description>\n} + end + if defined? @md.notes.coverage \ + and @md.notes.coverage=~/\S+/ # DublinCore 14 - coverage + txt=meta_content_clean(@md.notes.coverage) + @oai_pmh << %{ <dc:coverage>#{txt}</dc:coverage>\n} + end + if defined? @md.notes.relation \ + and @md.notes.relation=~/\S+/ # DublinCore 13 - relation + txt=meta_content_clean(@md.notes.relation) + @oai_pmh << %{ <dc:relation>#{txt}</dc:relation>\n} + end + if defined? @md.notes.type \ + and @md.notes.type=~/\S+/ # DublinCore 8 - type + txt=meta_content_clean(@md.notes.type) @oai_pmh << %{ <dc:type>#{txt}</dc:type>\n} end - if defined? @md.classify.format \ - and @md.classify.format=~/\S+/ # DublinCore 9 - format - txt=meta_content_clean(@md.classify.format) + if defined? @md.notes.format \ + and @md.notes.format=~/\S+/ # DublinCore 9 - format + txt=meta_content_clean(@md.notes.format) @oai_pmh << %{ <dc:format>#{txt}</dc:format>\n} end - if defined? @md.classify.identifier \ - and @md.classify.identifier=~/\S+/ # DublinCore 10 - identifier - txt=meta_content_clean(@md.classify.identifier) - @oai_pmh << %{ <dc:identifier>#{txt}</dc:identifier>\n} - end + #if defined? @md.identifier.sisupod \ + #and @md.identifier.sisupod=~/\S+/ # DublinCore 10 - identifier + # txt=meta_content_clean(@md.identifier.sisupod) + # @oai_pmh << %{ <dc:identifier>#{txt}</dc:identifier>\n} + #end if defined? @md.original.source \ - and @md.original.source=~/\S+/ # DublinCore 11 - source + and @md.original.source=~/\S+/ # DublinCore 11 - source txt=meta_content_clean(@md.original.source) @oai_pmh << %{ <dc:source>#{txt}</dc:source>\n} end if defined? @md.title.language \ - and @md.title.language=~/\S+/ # DublinCore 12 - language (English) + and @md.title.language=~/\S+/ # DublinCore 12 - language (English) @oai_pmh << %{ <dc:language>#{@md.title.language}</dc:language>\n} end if defined? @md.original.language \ and @md.original.language=~/\S+/ @oai_pmh << %{ <dc:language>#{@md.original.language}</dc:language>\n} end - if defined? @md.classify.relation \ - and @md.classify.relation=~/\S+/ # DublinCore 13 - relation - txt=meta_content_clean(@md.relation) - @oai_pmh << %{ <dc:relation>#{txt}</dc:relation>\n} - end - if defined? @md.classify.coverage \ - and @md.classify.coverage=~/\S+/ # DublinCore 14 - coverage - txt=meta_content_clean(@md.classify.coverage) - @oai_pmh << %{ <dc:coverage>#{txt}</dc:coverage>\n} - end if defined? @md.rights.all \ - and @md.rights.all=~/\S+/ # DublinCore 15 - rights + and @md.rights.all=~/\S+/ # DublinCore 15 - rights txt=meta_content_clean(@md.rights.all) @oai_pmh << %{ <dc:rights>#{txt}</dc:rights>\n} end - if defined? @md.classify.keywords \ - and @md.classify.keywords=~/\S+/ - txt=meta_content_clean(@md.classify.keywords) - @oai_pmh << %{ <dc:keywords>#{txt}</dc:keywords>\n} - end @oai_pmh end def meta_content_clean(content='') diff --git a/lib/sisu/v3/xml_scaffold.rb b/lib/sisu/v5/xml_scaffold.rb index 352779f3..5b038edf 100644 --- a/lib/sisu/v3/xml_scaffold.rb +++ b/lib/sisu/v5/xml_scaffold.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/xml_scaffold.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/xml_scaffold.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> diff --git a/lib/sisu/v3/xml_tables.rb b/lib/sisu/v5/xml_tables.rb index 4f1ada1b..9cbf259b 100644 --- a/lib/sisu/v3/xml_tables.rb +++ b/lib/sisu/v5/xml_tables.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/xml_tables.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/xml_tables.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -66,7 +66,7 @@ module SiSU_Tables @@tablehead=0 @@tablefoot=[] #watch #bug??? #check was @@tablefoot def initialize(one,ocn='') - @one,@parablock,@ocn,@vz=one,one,ocn,SiSU_Env::GetInit.instance.skin + @one,@parablock,@ocn,@vz=one,one,ocn,SiSU_Viz::Defaults.new end def table_split #% used but, no longer operational, revisit @new_content=[] @@ -81,7 +81,7 @@ module SiSU_Tables @@tablehead=0 @@tablefoot=[] def initialize(one,ocn='') - @one,@parablock,@ocn,@vz=one,one,ocn,SiSU_Env::GetInit.instance.skin + @one,@parablock,@ocn,@vz=one,one,ocn,SiSU_Viz::Defaults.new end def table m=@parablock[/<!f(.+?)!>/,1] @@ -125,7 +125,7 @@ module SiSU_Tables @@tablehead=0 @@tablefoot=[] def initialize(one) - @one,@parablock,@vz=one,one,SiSU_Env::GetInit.instance.skin + @one,@parablock,@vz=one,one,SiSU_Viz::Defaults.new end def table_head(inf) %{<table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center"> diff --git a/lib/sisu/v3/zap.rb b/lib/sisu/v5/zap.rb index 86022abc..cc542f97 100644 --- a/lib/sisu/v3/zap.rb +++ b/lib/sisu/v5/zap.rb @@ -50,7 +50,7 @@ * Git <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> - <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v3/zap.rb;hb=HEAD> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/zap.rb;hb=HEAD> * Ralph Amissah <ralph@amissah.com> @@ -66,20 +66,23 @@ module SiSU_Zap class Source def initialize(opt) @opt=opt - @env=SiSU_Env::InfoEnv.new(@opt.fns) - @zap_path="#{@env.path.output}/#{@env.fnb}" - @zap=SiSU_Env::CleanOutput.new(@opt) + @env=SiSU_Env::InfoEnv.new(opt.fns) end def read + zap_path="#{@env.path.output}/#{@env.fnb}" + z=SiSU_Env::CleanOutput.new(@opt) if SiSU_Env::InfoSettings.new.permission?('zap') - tell=SiSU_Screen::Ansi.new(@opt.cmd,"Clean files related to processing #{@opt.cmd} ->","#{@opt.fns} -> #{@zap_path}") - @zap.zap.main_output - @zap.zap.site_map - @zap.zap.epub - @zap.zap.src - else tell=SiSU_Screen::Ansi.new(@opt.cmd,'use of -Z (zap) has not enabled in sisurc.yml') + unless @opt.cmd =~/q/ + tell=SiSU_Screen::Ansi.new(@opt.cmd,"Clean files related to processing #{@opt.cmd} ->","#{@opt.fns} -> #{zap_path}") + tell.warn + end + z.zap.remove_output + else + unless @opt.cmd =~/q/ + tell=SiSU_Screen::Ansi.new(@opt.cmd,'use of -Z (zap) has not enabled in sisurc.yml') + tell.warn + end end - tell.warn unless @opt.cmd =~/q/ end end end |