From 6811ac91f21a434fc7d967c11e1b20f33918c6ea Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 19 Mar 2012 22:07:29 -0400 Subject: v3: 3.2 branch is main (v3dv --> v3); dev (v3dv) branch directories removed * v3dv (3.2) "merged" into v3 (previously 3.1) (& removed) * conf/sisu/v3dv --> conf/sisu/v3 * data/sisu/v3dv --> data/sisu/v3 * lib/sisu/v3dv --> lib/sisu/v3 * bin/sisu* (v3dv references changed to v3) * (--dev modifier (superfluous for the time being) runs main v3 branch) --- lib/sisu/v3/author_format.rb | 8 +- lib/sisu/v3/cgi.rb | 6 +- lib/sisu/v3/cgi_pgsql.rb | 38 +- lib/sisu/v3/cgi_sql_common.rb | 88 +- lib/sisu/v3/cgi_sqlite.rb | 28 +- lib/sisu/v3/character_encoding.rb | 6 +- lib/sisu/v3/composite.rb | 35 +- lib/sisu/v3/concordance.rb | 127 +- lib/sisu/v3/conf.rb | 54 +- lib/sisu/v3/constants.rb | 4 +- lib/sisu/v3/css.rb | 104 +- lib/sisu/v3/dal.rb | 86 +- lib/sisu/v3/dal_character_check.rb | 35 +- lib/sisu/v3/dal_doc_objects.rb | 76 +- lib/sisu/v3/dal_doc_str.rb | 320 +- lib/sisu/v3/dal_endnotes.rb | 14 +- lib/sisu/v3/dal_expand_insertions.rb | 20 +- lib/sisu/v3/dal_hash_digest.rb | 41 +- lib/sisu/v3/dal_idx.rb | 40 +- lib/sisu/v3/dal_images.rb | 22 +- lib/sisu/v3/dal_metadata.rb | 8 +- lib/sisu/v3/dal_numbering.rb | 121 +- lib/sisu/v3/dal_substitutions_and_insertions.rb | 30 +- lib/sisu/v3/dal_syntax.rb | 456 +- lib/sisu/v3/db_columns.rb | 188 +- lib/sisu/v3/db_create.rb | 20 +- lib/sisu/v3/db_dbi.rb | 24 +- lib/sisu/v3/db_drop.rb | 10 +- lib/sisu/v3/db_import.rb | 236 +- lib/sisu/v3/db_indexes.rb | 2 +- lib/sisu/v3/db_load_tuple.rb | 12 +- lib/sisu/v3/db_remove.rb | 4 +- lib/sisu/v3/db_select.rb | 73 +- lib/sisu/v3/db_sqltxt.rb | 62 +- lib/sisu/v3/db_tests.rb | 2 +- lib/sisu/v3/dbi.rb | 16 +- lib/sisu/v3/dbi_discreet.rb | 158 + lib/sisu/v3/defaults.rb | 30 +- lib/sisu/v3/digests.rb | 36 +- lib/sisu/v3/embedded.rb | 20 +- lib/sisu/v3/epub.rb | 213 +- lib/sisu/v3/epub_concordance.rb | 93 +- lib/sisu/v3/epub_format.rb | 314 +- lib/sisu/v3/epub_segments.rb | 221 +- lib/sisu/v3/epub_tune.rb | 370 +- lib/sisu/v3/errors.rb | 4 +- lib/sisu/v3/git.rb | 8 +- lib/sisu/v3/harvest.rb | 10 +- lib/sisu/v3/harvest_authors.rb | 28 +- lib/sisu/v3/harvest_topics.rb | 28 +- lib/sisu/v3/help.rb | 26 +- lib/sisu/v3/html.rb | 215 +- lib/sisu/v3/html_format.rb | 314 +- lib/sisu/v3/html_minitoc.rb | 73 +- lib/sisu/v3/html_promo.rb | 31 +- lib/sisu/v3/html_scroll.rb | 59 +- lib/sisu/v3/html_segments.rb | 307 +- lib/sisu/v3/html_table.rb | 4 +- lib/sisu/v3/html_tune.rb | 308 +- lib/sisu/v3/hub.rb | 93 +- lib/sisu/v3/i18n.rb | 2 +- lib/sisu/v3/manifest.rb | 135 +- lib/sisu/v3/manpage.rb | 204 +- lib/sisu/v3/manpage_format.rb | 8 +- lib/sisu/v3/odf.rb | 297 +- lib/sisu/v3/odf_format.rb | 42 +- lib/sisu/v3/options.rb | 334 +- lib/sisu/v3/param.rb | 209 +- lib/sisu/v3/param_identify_markup.rb | 4 +- lib/sisu/v3/particulars.rb | 26 +- lib/sisu/v3/plaintext.rb | 198 +- lib/sisu/v3/plaintext_format.rb | 12 +- lib/sisu/v3/po4a.rb | 246 +- lib/sisu/v3/po4a_set.rb | 22 +- lib/sisu/v3/qrcode.rb | 46 +- lib/sisu/v3/relaxng.rb | 2 +- lib/sisu/v3/remote.rb | 23 +- lib/sisu/v3/rexml.rb | 6 +- lib/sisu/v3/screen_text_color.rb | 2 +- lib/sisu/v3/share_src.rb | 4 +- lib/sisu/v3/share_src_kdissert.rb | 4 +- lib/sisu/v3/shared_html.rb | 4 +- lib/sisu/v3/shared_html_lite.rb | 108 +- lib/sisu/v3/shared_images.rb | 126 + lib/sisu/v3/shared_markup_alt.rb | 174 +- lib/sisu/v3/shared_metadata.rb | 274 +- lib/sisu/v3/shared_sem.rb | 2 +- lib/sisu/v3/shared_txt.rb | 10 +- lib/sisu/v3/shared_xhtml.rb | 4 +- lib/sisu/v3/shared_xml.rb | 701 +-- lib/sisu/v3/sisupod_make.rb | 21 +- lib/sisu/v3/sitemaps.rb | 24 +- lib/sisu/v3/spell.rb | 30 +- lib/sisu/v3/sst_convert_markup.rb | 18 +- lib/sisu/v3/sst_do_inline_footnotes.rb | 44 +- lib/sisu/v3/sst_from_xml.rb | 4 +- lib/sisu/v3/sst_identify_markup.rb | 36 +- lib/sisu/v3/sst_to_s_xml_sax.rb | 64 +- lib/sisu/v3/sysenv.rb | 1372 +++-- lib/sisu/v3/termsheet.rb | 4 +- lib/sisu/v3/texinfo.rb | 197 +- lib/sisu/v3/texinfo_format.rb | 294 +- lib/sisu/v3/texpdf.rb | 289 +- lib/sisu/v3/texpdf_format.rb | 514 +- lib/sisu/v3/update.rb | 14 +- lib/sisu/v3/urls.rb | 18 +- lib/sisu/v3/webrick.rb | 10 +- lib/sisu/v3/wikispeak.rb | 48 +- lib/sisu/v3/xhtml.rb | 124 +- lib/sisu/v3/xhtml_table.rb | 10 +- lib/sisu/v3/xml.rb | 127 +- lib/sisu/v3/xml_dom.rb | 107 +- lib/sisu/v3/xml_fictionbook.rb | 24 +- lib/sisu/v3/xml_format.rb | 120 +- lib/sisu/v3/xml_md_oai_pmh_dc.rb | 8 +- lib/sisu/v3/xml_scaffold.rb | 14 +- lib/sisu/v3/xml_tables.rb | 54 +- lib/sisu/v3/zap.rb | 6 +- lib/sisu/v3dv/air.rb | 82 - lib/sisu/v3dv/author_format.rb | 113 - lib/sisu/v3dv/cgi.rb | 83 - lib/sisu/v3dv/cgi_pgsql.rb | 230 - lib/sisu/v3dv/cgi_sql_common.rb | 1073 ---- lib/sisu/v3dv/cgi_sqlite.rb | 217 - lib/sisu/v3dv/character_encoding.rb | 379 -- lib/sisu/v3dv/composite.rb | 272 - lib/sisu/v3dv/concordance.rb | 369 -- lib/sisu/v3dv/conf.rb | 247 - lib/sisu/v3dv/constants.rb | 285 - lib/sisu/v3dv/css.rb | 3424 ------------ lib/sisu/v3dv/dal.rb | 506 -- lib/sisu/v3dv/dal_character_check.rb | 104 - lib/sisu/v3dv/dal_doc_objects.rb | 446 -- lib/sisu/v3dv/dal_doc_str.rb | 1047 ---- lib/sisu/v3dv/dal_endnotes.rb | 125 - lib/sisu/v3dv/dal_expand_insertions.rb | 379 -- lib/sisu/v3dv/dal_hash_digest.rb | 156 - lib/sisu/v3dv/dal_idx.rb | 357 -- lib/sisu/v3dv/dal_images.rb | 158 - lib/sisu/v3dv/dal_metadata.rb | 79 - lib/sisu/v3dv/dal_numbering.rb | 470 -- lib/sisu/v3dv/dal_substitutions_and_insertions.rb | 156 - lib/sisu/v3dv/dal_syntax.rb | 554 -- lib/sisu/v3dv/db_columns.rb | 2108 -------- lib/sisu/v3dv/db_create.rb | 614 --- lib/sisu/v3dv/db_dbi.rb | 93 - lib/sisu/v3dv/db_drop.rb | 187 - lib/sisu/v3dv/db_import.rb | 690 --- lib/sisu/v3dv/db_indexes.rb | 114 - lib/sisu/v3dv/db_load_tuple.rb | 333 -- lib/sisu/v3dv/db_remove.rb | 119 - lib/sisu/v3dv/db_select.rb | 216 - lib/sisu/v3dv/db_sqltxt.rb | 130 - lib/sisu/v3dv/db_tests.rb | 117 - lib/sisu/v3dv/dbi.rb | 143 - lib/sisu/v3dv/dbi_discreet.rb | 158 - lib/sisu/v3dv/defaults.rb | 2267 -------- lib/sisu/v3dv/digests.rb | 388 -- lib/sisu/v3dv/embedded.rb | 142 - lib/sisu/v3dv/epub.rb | 669 --- lib/sisu/v3dv/epub_concordance.rb | 316 -- lib/sisu/v3dv/epub_format.rb | 2223 -------- lib/sisu/v3dv/epub_segments.rb | 532 -- lib/sisu/v3dv/epub_tune.rb | 407 -- lib/sisu/v3dv/errors.rb | 81 - lib/sisu/v3dv/git.rb | 281 - lib/sisu/v3dv/harvest.rb | 108 - lib/sisu/v3dv/harvest_authors.rb | 378 -- lib/sisu/v3dv/harvest_topics.rb | 650 --- lib/sisu/v3dv/help.rb | 1923 ------- lib/sisu/v3dv/html.rb | 664 --- lib/sisu/v3dv/html_format.rb | 1484 ------ lib/sisu/v3dv/html_minitoc.rb | 203 - lib/sisu/v3dv/html_promo.rb | 445 -- lib/sisu/v3dv/html_scroll.rb | 210 - lib/sisu/v3dv/html_segments.rb | 613 --- lib/sisu/v3dv/html_table.rb | 65 - lib/sisu/v3dv/html_tune.rb | 373 -- lib/sisu/v3dv/hub.rb | 683 --- lib/sisu/v3dv/i18n.rb | 698 --- lib/sisu/v3dv/manifest.rb | 900 ---- lib/sisu/v3dv/manpage.rb | 430 -- lib/sisu/v3dv/manpage_format.rb | 108 - lib/sisu/v3dv/odf.rb | 786 --- lib/sisu/v3dv/odf_format.rb | 607 --- lib/sisu/v3dv/options.rb | 795 --- lib/sisu/v3dv/param.rb | 1623 ------ lib/sisu/v3dv/param_identify_markup.rb | 168 - lib/sisu/v3dv/particulars.rb | 210 - lib/sisu/v3dv/plaintext.rb | 432 -- lib/sisu/v3dv/plaintext_format.rb | 113 - lib/sisu/v3dv/po4a.rb | 984 ---- lib/sisu/v3dv/po4a_set.rb | 300 -- lib/sisu/v3dv/prog_text_translation.rb | 1704 ------ lib/sisu/v3dv/qrcode.rb | 738 --- lib/sisu/v3dv/relaxng.rb | 1161 ---- lib/sisu/v3dv/remote.rb | 211 - lib/sisu/v3dv/response.rb | 75 - lib/sisu/v3dv/rexml.rb | 121 - lib/sisu/v3dv/screen_text_color.rb | 487 -- lib/sisu/v3dv/share_src.rb | 95 - lib/sisu/v3dv/share_src_kdissert.rb | 88 - lib/sisu/v3dv/shared_html.rb | 65 - lib/sisu/v3dv/shared_html_lite.rb | 321 -- lib/sisu/v3dv/shared_images.rb | 126 - lib/sisu/v3dv/shared_markup_alt.rb | 322 -- lib/sisu/v3dv/shared_metadata.rb | 1361 ----- lib/sisu/v3dv/shared_sem.rb | 156 - lib/sisu/v3dv/shared_txt.rb | 232 - lib/sisu/v3dv/shared_xhtml.rb | 65 - lib/sisu/v3dv/shared_xml.rb | 718 --- lib/sisu/v3dv/sisupod_make.rb | 368 -- lib/sisu/v3dv/sitemaps.rb | 215 - lib/sisu/v3dv/spell.rb | 101 - lib/sisu/v3dv/sst_convert_markup.rb | 312 -- lib/sisu/v3dv/sst_do_inline_footnotes.rb | 472 -- lib/sisu/v3dv/sst_from_xml.rb | 169 - lib/sisu/v3dv/sst_identify_markup.rb | 474 -- lib/sisu/v3dv/sst_to_s_xml_sax.rb | 453 -- lib/sisu/v3dv/sysenv.rb | 5853 --------------------- lib/sisu/v3dv/termsheet.rb | 166 - lib/sisu/v3dv/texinfo.rb | 415 -- lib/sisu/v3dv/texinfo_format.rb | 573 -- lib/sisu/v3dv/texpdf.rb | 963 ---- lib/sisu/v3dv/texpdf_format.rb | 1621 ------ lib/sisu/v3dv/update.rb | 136 - lib/sisu/v3dv/urls.rb | 427 -- lib/sisu/v3dv/webrick.rb | 174 - lib/sisu/v3dv/wikispeak.rb | 373 -- lib/sisu/v3dv/xhtml.rb | 432 -- lib/sisu/v3dv/xhtml_table.rb | 99 - lib/sisu/v3dv/xml.rb | 466 -- lib/sisu/v3dv/xml_dom.rb | 539 -- lib/sisu/v3dv/xml_fictionbook.rb | 300 -- lib/sisu/v3dv/xml_format.rb | 1443 ----- lib/sisu/v3dv/xml_md_oai_pmh_dc.rb | 230 - lib/sisu/v3dv/xml_scaffold.rb | 199 - lib/sisu/v3dv/xml_tables.rb | 203 - lib/sisu/v3dv/zap.rb | 83 - 239 files changed, 6729 insertions(+), 70371 deletions(-) create mode 100644 lib/sisu/v3/dbi_discreet.rb create mode 100644 lib/sisu/v3/shared_images.rb delete mode 100644 lib/sisu/v3dv/air.rb delete mode 100644 lib/sisu/v3dv/author_format.rb delete mode 100644 lib/sisu/v3dv/cgi.rb delete mode 100644 lib/sisu/v3dv/cgi_pgsql.rb delete mode 100644 lib/sisu/v3dv/cgi_sql_common.rb delete mode 100644 lib/sisu/v3dv/cgi_sqlite.rb delete mode 100644 lib/sisu/v3dv/character_encoding.rb delete mode 100644 lib/sisu/v3dv/composite.rb delete mode 100644 lib/sisu/v3dv/concordance.rb delete mode 100644 lib/sisu/v3dv/conf.rb delete mode 100644 lib/sisu/v3dv/constants.rb delete mode 100644 lib/sisu/v3dv/css.rb delete mode 100644 lib/sisu/v3dv/dal.rb delete mode 100644 lib/sisu/v3dv/dal_character_check.rb delete mode 100644 lib/sisu/v3dv/dal_doc_objects.rb delete mode 100644 lib/sisu/v3dv/dal_doc_str.rb delete mode 100644 lib/sisu/v3dv/dal_endnotes.rb delete mode 100644 lib/sisu/v3dv/dal_expand_insertions.rb delete mode 100644 lib/sisu/v3dv/dal_hash_digest.rb delete mode 100644 lib/sisu/v3dv/dal_idx.rb delete mode 100644 lib/sisu/v3dv/dal_images.rb delete mode 100644 lib/sisu/v3dv/dal_metadata.rb delete mode 100644 lib/sisu/v3dv/dal_numbering.rb delete mode 100644 lib/sisu/v3dv/dal_substitutions_and_insertions.rb delete mode 100644 lib/sisu/v3dv/dal_syntax.rb delete mode 100644 lib/sisu/v3dv/db_columns.rb delete mode 100644 lib/sisu/v3dv/db_create.rb delete mode 100644 lib/sisu/v3dv/db_dbi.rb delete mode 100644 lib/sisu/v3dv/db_drop.rb delete mode 100644 lib/sisu/v3dv/db_import.rb delete mode 100644 lib/sisu/v3dv/db_indexes.rb delete mode 100644 lib/sisu/v3dv/db_load_tuple.rb delete mode 100644 lib/sisu/v3dv/db_remove.rb delete mode 100644 lib/sisu/v3dv/db_select.rb delete mode 100644 lib/sisu/v3dv/db_sqltxt.rb delete mode 100644 lib/sisu/v3dv/db_tests.rb delete mode 100644 lib/sisu/v3dv/dbi.rb delete mode 100644 lib/sisu/v3dv/dbi_discreet.rb delete mode 100644 lib/sisu/v3dv/defaults.rb delete mode 100644 lib/sisu/v3dv/digests.rb delete mode 100644 lib/sisu/v3dv/embedded.rb delete mode 100644 lib/sisu/v3dv/epub.rb delete mode 100644 lib/sisu/v3dv/epub_concordance.rb delete mode 100644 lib/sisu/v3dv/epub_format.rb delete mode 100644 lib/sisu/v3dv/epub_segments.rb delete mode 100644 lib/sisu/v3dv/epub_tune.rb delete mode 100644 lib/sisu/v3dv/errors.rb delete mode 100644 lib/sisu/v3dv/git.rb delete mode 100644 lib/sisu/v3dv/harvest.rb delete mode 100644 lib/sisu/v3dv/harvest_authors.rb delete mode 100644 lib/sisu/v3dv/harvest_topics.rb delete mode 100644 lib/sisu/v3dv/help.rb delete mode 100644 lib/sisu/v3dv/html.rb delete mode 100644 lib/sisu/v3dv/html_format.rb delete mode 100644 lib/sisu/v3dv/html_minitoc.rb delete mode 100644 lib/sisu/v3dv/html_promo.rb delete mode 100644 lib/sisu/v3dv/html_scroll.rb delete mode 100644 lib/sisu/v3dv/html_segments.rb delete mode 100644 lib/sisu/v3dv/html_table.rb delete mode 100644 lib/sisu/v3dv/html_tune.rb delete mode 100644 lib/sisu/v3dv/hub.rb delete mode 100644 lib/sisu/v3dv/i18n.rb delete mode 100644 lib/sisu/v3dv/manifest.rb delete mode 100644 lib/sisu/v3dv/manpage.rb delete mode 100644 lib/sisu/v3dv/manpage_format.rb delete mode 100644 lib/sisu/v3dv/odf.rb delete mode 100644 lib/sisu/v3dv/odf_format.rb delete mode 100644 lib/sisu/v3dv/options.rb delete mode 100644 lib/sisu/v3dv/param.rb delete mode 100644 lib/sisu/v3dv/param_identify_markup.rb delete mode 100644 lib/sisu/v3dv/particulars.rb delete mode 100644 lib/sisu/v3dv/plaintext.rb delete mode 100644 lib/sisu/v3dv/plaintext_format.rb delete mode 100644 lib/sisu/v3dv/po4a.rb delete mode 100644 lib/sisu/v3dv/po4a_set.rb delete mode 100644 lib/sisu/v3dv/prog_text_translation.rb delete mode 100644 lib/sisu/v3dv/qrcode.rb delete mode 100644 lib/sisu/v3dv/relaxng.rb delete mode 100644 lib/sisu/v3dv/remote.rb delete mode 100644 lib/sisu/v3dv/response.rb delete mode 100644 lib/sisu/v3dv/rexml.rb delete mode 100644 lib/sisu/v3dv/screen_text_color.rb delete mode 100644 lib/sisu/v3dv/share_src.rb delete mode 100644 lib/sisu/v3dv/share_src_kdissert.rb delete mode 100644 lib/sisu/v3dv/shared_html.rb delete mode 100644 lib/sisu/v3dv/shared_html_lite.rb delete mode 100644 lib/sisu/v3dv/shared_images.rb delete mode 100644 lib/sisu/v3dv/shared_markup_alt.rb delete mode 100644 lib/sisu/v3dv/shared_metadata.rb delete mode 100644 lib/sisu/v3dv/shared_sem.rb delete mode 100644 lib/sisu/v3dv/shared_txt.rb delete mode 100644 lib/sisu/v3dv/shared_xhtml.rb delete mode 100644 lib/sisu/v3dv/shared_xml.rb delete mode 100644 lib/sisu/v3dv/sisupod_make.rb delete mode 100644 lib/sisu/v3dv/sitemaps.rb delete mode 100644 lib/sisu/v3dv/spell.rb delete mode 100644 lib/sisu/v3dv/sst_convert_markup.rb delete mode 100644 lib/sisu/v3dv/sst_do_inline_footnotes.rb delete mode 100644 lib/sisu/v3dv/sst_from_xml.rb delete mode 100644 lib/sisu/v3dv/sst_identify_markup.rb delete mode 100644 lib/sisu/v3dv/sst_to_s_xml_sax.rb delete mode 100644 lib/sisu/v3dv/sysenv.rb delete mode 100644 lib/sisu/v3dv/termsheet.rb delete mode 100644 lib/sisu/v3dv/texinfo.rb delete mode 100644 lib/sisu/v3dv/texinfo_format.rb delete mode 100644 lib/sisu/v3dv/texpdf.rb delete mode 100644 lib/sisu/v3dv/texpdf_format.rb delete mode 100644 lib/sisu/v3dv/update.rb delete mode 100644 lib/sisu/v3dv/urls.rb delete mode 100644 lib/sisu/v3dv/webrick.rb delete mode 100644 lib/sisu/v3dv/wikispeak.rb delete mode 100644 lib/sisu/v3dv/xhtml.rb delete mode 100644 lib/sisu/v3dv/xhtml_table.rb delete mode 100644 lib/sisu/v3dv/xml.rb delete mode 100644 lib/sisu/v3dv/xml_dom.rb delete mode 100644 lib/sisu/v3dv/xml_fictionbook.rb delete mode 100644 lib/sisu/v3dv/xml_format.rb delete mode 100644 lib/sisu/v3dv/xml_md_oai_pmh_dc.rb delete mode 100644 lib/sisu/v3dv/xml_scaffold.rb delete mode 100644 lib/sisu/v3dv/xml_tables.rb delete mode 100644 lib/sisu/v3dv/zap.rb (limited to 'lib') diff --git a/lib/sisu/v3/author_format.rb b/lib/sisu/v3/author_format.rb index 481674d0..cfc485f3 100644 --- a/lib/sisu/v3/author_format.rb +++ b/lib/sisu/v3/author_format.rb @@ -56,7 +56,7 @@ ** Description: system environment, resource control and configuration details =end -module FORMAT +module SiSU_FormatAuthor class Author def initialize(author_param) @author_param=author_param @@ -65,14 +65,14 @@ module FORMAT @authors,@author_array=[],[] authors=@author_param.scan(/[^;]+/) authors.each do |a| - a.strip! + a=a.strip if a =~/"(.+?)"/ @authors << { the: $1 } @author_array << $1.upcase else #if a =~/,/ x=a.scan(/[^,]+/) - x[0].strip! - x[1].strip! if x[1] + x[0]=x[0].strip + x[1]=x[1].strip if x[1] if x.length==1 @authors << { the: x[0] } @author_array << x[0].upcase diff --git a/lib/sisu/v3/cgi.rb b/lib/sisu/v3/cgi.rb index 779ee35a..b2a9c0b3 100644 --- a/lib/sisu/v3/cgi.rb +++ b/lib/sisu/v3/cgi.rb @@ -61,7 +61,7 @@ module SiSU_CGI require_relative 'sysenv' # sysenv.rb require_relative 'cgi_pgsql' # cgi_pgsql.rb require_relative 'cgi_sqlite' # cgi_sqlite.rb - class SiSU_search + class SearchSQL def initialize(opt) @opt=opt @webserv=@opt.files[0].to_s.strip @@ -74,8 +74,8 @@ module SiSU_CGI SiSU_Screen::Ansi.new(@opt.cmd,a).print_grey end def read - SiSU_CGI_sqlite::SiSU_search_sqlite.new(@opt,@webserv).sqlite - SiSU_CGI_pgsql::SiSU_search_pgsql.new(@opt,@webserv).pgsql + SiSU_CGI_SQLite::SearchSQLite.new(@opt,@webserv).sqlite + SiSU_CGI_PgSQL::SearchPgSQL.new(@opt,@webserv).pgsql search_info unless @opt.cmd =~/q/ end end diff --git a/lib/sisu/v3/cgi_pgsql.rb b/lib/sisu/v3/cgi_pgsql.rb index 6fb35714..8b3f0224 100644 --- a/lib/sisu/v3/cgi_pgsql.rb +++ b/lib/sisu/v3/cgi_pgsql.rb @@ -56,19 +56,19 @@ ** Description: generates naive cgi search form for search of sisu database (pgsql sqlite) =end -module SiSU_CGI_pgsql #% database building documents +module SiSU_CGI_PgSQL #% database building documents require_relative 'sysenv' # sysenv.rb require_relative 'cgi_sql_common' # cgi_sql_common.rb - include SiSU_CGI_sql - class SiSU_search_pgsql < SiSU_CGI_common + include SiSU_CGI_SQL + class SearchPgSQL < CGI_Common def initialize(opt,webserv) @opt,@webserv=opt,webserv - @env=SiSU_Env::Info_env.new('',opt) - @sys=SiSU_Env::System_call.new + @env=SiSU_Env::InfoEnv.new('',opt) + @sys=SiSU_Env::SystemCall.new @image_src="#{@env.url.webserv_cgi}/_sisu/image_sys" - @common=SiSU_CGI_sql::SiSU_CGI_common.new(@webserv,@opt,@image_src,@env) - @db=SiSU_Env::Info_db.new - @cgi_file_name="#{Db[:name_prefix_db]}by_#{opt.dir_structure_by}_pgsql.cgi" + @common=SiSU_CGI_SQL::CGI_Common.new(@webserv,@opt,@image_src,@env) + @db=SiSU_Env::InfoDb.new + @cgi_file_name="#{Db[:name_prefix_db]}by_#{opt.dir_structure_by.to_s}_pgsql.cgi" end def pgsql serve=[] @@ -82,7 +82,7 @@ module SiSU_CGI_pgsql end else put "WARNING: no postgresql database available, (have you created one?)" end - serve.sort! + serve=serve.sort f1,f2,f3='','','' serve.each do |x| f1 << %{ \n} unless x =~/apache|sisu\/image/ #check @@ -140,7 +140,7 @@ module SiSU_CGI_pgsql end def search_statement <<-'WOK_SQL' - class Dbi_search_string + class DBI_SearchString def initialize(l,t,q,cse=false) @l,@t,@q,@c=l,t,q,cse end @@ -151,12 +151,12 @@ module SiSU_CGI_pgsql elsif @q =~/\S+/; unescaped_search=CGI.unescape(@q) end search_construct=[] - if @c - unescaped_search.gsub!(/\s*(AND|OR)\s*/,"' \) \\1 #{@l}~\( '") - unescaped_search.gsub!(/(.+)/,"#{@l}~\( '\\1' \)") + unescaped_search=if @c + unescaped_search.gsub(/\s*(AND|OR)\s*/,"' \) \\1 #{@l}~\( '"). + gsub(/(.+)/,"#{@l}~\( '\\1' \)") else - unescaped_search.gsub!(/\s*(AND|OR)\s*/,"' \) \\1 #{@l}~*\( '") - unescaped_search.gsub!(/(.+)/,"#{@l}~*\( '\\1' \)") + unescaped_search.gsub(/\s*(AND|OR)\s*/,"' \) \\1 #{@l}~*\( '"). + gsub(/(.+)/,"#{@l}~*\( '\\1' \)") end search_construct << unescaped_search search_construct=search_construct.join(' ') @@ -173,11 +173,11 @@ module SiSU_CGI_pgsql <<-'WOK_SQL' @search_text,@search_endnotes='','' search[:text].flatten.each {|x| @search_text << "#{x} AND " } - @search_text=@search_text.gsub!(/AND\s+$/m,'') #watch - @search_text.gsub!(/(doc_objects\.clean~[*]?\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+doc_objects\.clean~[*]?\(\s*'[^']+'\s*\))+)/,'(\1)') + @search_text=@search_text.gsub(/AND\s+$/m,''). #watch + gsub(/(doc_objects\.clean~[*]?\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+doc_objects\.clean~[*]?\(\s*'[^']+'\s*\))+)/,'(\1)') search[:endnotes].flatten.each {|x| @search_endnotes << "#{x} AND " } - @search_endnotes=@search_endnotes.gsub!(/AND\s+$/m,'') #watch - @search_endnotes.gsub!(/(endnotes\.clean~\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean~\(\s*'[^']+'\s*\))+)/,'(\1)') + @search_endnotes=@search_endnotes.gsub(/AND\s+$/m,''). #watch + gsub(/(endnotes\.clean~\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean~\(\s*'[^']+'\s*\))+)/,'(\1)') end WOK_SQL end diff --git a/lib/sisu/v3/cgi_sql_common.rb b/lib/sisu/v3/cgi_sql_common.rb index 9f4dd457..8a7c126f 100644 --- a/lib/sisu/v3/cgi_sql_common.rb +++ b/lib/sisu/v3/cgi_sql_common.rb @@ -56,8 +56,8 @@ ** Description: generates naive cgi search form for search of sisu database (pgsql sqlite) =end -module SiSU_CGI_sql - class SiSU_CGI_common +module SiSU_CGI_SQL + class CGI_Common def initialize(webserv,opt,image_src,dir) @webserv,@opt,@image_src,@env=webserv,opt,image_src,dir @cmd=opt.cmd @@ -230,7 +230,7 @@ module SiSU_CGI_sql end def search_request <<-'WOK_SQL' - class Search_request #% search_for + class SearchRequest #% search_for attr_accessor :text1,:fulltext,:keywords,:title,:author,:topic_register,:subject,:description,:publisher,:editor,:contributor,:date,:type,:format,:identifier,:source,:language,:relation,:coverage,:rights,:comment,:abstract,:owner,:date_created,:date_issued,:date_modified,:date_available,:date_valid,:filename def initialize(search_field='',q='') @search_field,@q=search_field,q @@ -311,12 +311,10 @@ module SiSU_CGI_sql elsif @search_field =~m[:string]; m[:string].match(@search_field)[1] else str=m[:word].match(@search_field)[1] - str.gsub!(/[()]/,'') + str=str.gsub(/[()]/,'') str end - search_string.strip! - search_string.gsub!(/\s+/,'+') - search_string + search_string=search_string.strip.search_string.gsub(/\s+/,'+') #else # "__" end @@ -326,7 +324,7 @@ module SiSU_CGI_sql end def search_statement_common <<-'WOK_SQL' - class Dbi_search_statement + class DBI_SearchStatement attr_reader :text_search_flag,:sql_select_body_format,:sql_select_endnotes_format,:sql_offset,:sql_limit def initialize(conn,search_for,q,c) @conn=conn @@ -336,114 +334,114 @@ module SiSU_CGI_sql #@offset+=@@limit search={ :text => [], :endnotes => [] } cse=(c =~/\S/) ? true : false - st=Dbi_search_string.new('doc_objects.clean',search_for.text1,q['s1'],cse).string - se=Dbi_search_string.new('endnotes.clean',search_for.text1,q['s1'],cse).string + st=DBI_SearchString.new('doc_objects.clean',search_for.text1,q['s1'],cse).string + se=DBI_SearchString.new('endnotes.clean',search_for.text1,q['s1'],cse).string @text_search_flag=st[:flag] if st[:flag] search[:text] << st[:search] search[:endnotes] << se[:search] end - st=Dbi_search_string.new('metadata_and_text.fulltext',search_for.fulltext,q['ft'],cse).string + st=DBI_SearchString.new('metadata_and_text.fulltext',search_for.fulltext,q['ft'],cse).string if st[:flag] search[:text] << st[:search] search[:endnotes] << st[:search] end - st=Dbi_search_string.new('metadata_and_text.classify_keywords',search_for.keywords,q['key'],cse).string + 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_search_string.new('metadata_and_text.title',search_for.title,q['ti'],cse).string + st=DBI_SearchString.new('metadata_and_text.title',search_for.title,q['ti'],cse).string if st[:flag] search[:text] << st[:search] search[:endnotes] << st[:search] end - st=Dbi_search_string.new('metadata_and_text.creator_author',search_for.author,q['au'],cse).string + st=DBI_SearchString.new('metadata_and_text.creator_author',search_for.author,q['au'],cse).string if st[:flag] search[:text] << st[:search] search[:endnotes] << st[:search] end - st=Dbi_search_string.new('metadata_and_text.classify_topic_register',search_for.topic_register,q['tr'],cse).string + st=DBI_SearchString.new('metadata_and_text.classify_topic_register',search_for.topic_register,q['tr'],cse).string if st[:flag] search[:text] << st[:search] search[:endnotes] << st[:search] end - st=Dbi_search_string.new('metadata_and_text.classify_subject',search_for.subject,q['sj'],cse).string + st=DBI_SearchString.new('metadata_and_text.classify_subject',search_for.subject,q['sj'],cse).string if st[:flag] search[:text] << st[:search] search[:endnotes] << st[:search] end - st=Dbi_search_string.new('metadata_and_text.notes_description',search_for.description,q['dsc'],cse).string + st=DBI_SearchString.new('metadata_and_text.notes_description',search_for.description,q['dsc'],cse).string if st[:flag] search[:text] << st[:search] search[:endnotes] << st[:search] end - st=Dbi_search_string.new('metadata_and_text.publisher',search_for.publisher,q['pb'],cse).string + st=DBI_SearchString.new('metadata_and_text.publisher',search_for.publisher,q['pb'],cse).string if st[:flag] search[:text] << st[:search] search[:endnotes] << st[:search] end - st=Dbi_search_string.new('metadata_and_text.creator_editor',search_for.editor,q['cntr'],cse).string + st=DBI_SearchString.new('metadata_and_text.creator_editor',search_for.editor,q['cntr'],cse).string if st[:flag] search[:text] << st[:search] search[:endnotes] << st[:search] end - st=Dbi_search_string.new('metadata_and_text.creator_contributor',search_for.contributor,q['cntr'],cse).string + st=DBI_SearchString.new('metadata_and_text.creator_contributor',search_for.contributor,q['cntr'],cse).string if st[:flag] search[:text] << st[:search] search[:endnotes] << st[:search] end - st=Dbi_search_string.new('metadata_and_text.date_published',search_for.date,q['dt'],cse).string + st=DBI_SearchString.new('metadata_and_text.date_published',search_for.date,q['dt'],cse).string if st[:flag] search[:text] << st[:search] search[:endnotes] << st[:search] end - st=Dbi_search_string.new('metadata_and_text.classify_type',search_for.type,q['ty'],cse).string + 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_search_string.new('metadata_and_text.classify_identifier',search_for.identifier,q['id'],cse).string + st=DBI_SearchString.new('metadata_and_text.classify_identifier',search_for.identifier,q['id'],cse).string if st[:flag] search[:text] << st[:search] search[:endnotes] << st[:search] end - st=Dbi_search_string.new('metadata_and_text.original_source',search_for.source,q['src'],cse).string + st=DBI_SearchString.new('metadata_and_text.original_source',search_for.source,q['src'],cse).string if st[:flag] search[:text] << st[:search] search[:endnotes] << st[:search] end - st=Dbi_search_string.new('metadata_and_text.language_document_char',search_for.language,q['lang'],cse).string + st=DBI_SearchString.new('metadata_and_text.language_document_char',search_for.language,q['lang'],cse).string if st[:flag] search[:text] << st[:search] search[:endnotes] << st[:search] end - st=Dbi_search_string.new('metadata_and_text.classify_relation',search_for.relation,q['rel'],cse).string + st=DBI_SearchString.new('metadata_and_text.classify_relation',search_for.relation,q['rel'],cse).string if st[:flag] search[:text] << st[:search] search[:endnotes] << st[:search] end - st=Dbi_search_string.new('metadata_and_text.classify_coverage',search_for.coverage,q['cov'],cse).string + st=DBI_SearchString.new('metadata_and_text.classify_coverage',search_for.coverage,q['cov'],cse).string if st[:flag] search[:text] << st[:search] search[:endnotes] << st[:search] end - st=Dbi_search_string.new('metadata_and_text.rights_all',search_for.rights,q['cr'],cse).string + st=DBI_SearchString.new('metadata_and_text.rights_all',search_for.rights,q['cr'],cse).string if st[:flag] search[:text] << st[:search] search[:endnotes] << st[:search] end - st=Dbi_search_string.new('metadata_and_text.notes_comment',search_for.comment,q['co'],cse).string + st=DBI_SearchString.new('metadata_and_text.notes_comment',search_for.comment,q['co'],cse).string if st[:flag] search[:text] << st[:search] search[:endnotes] << st[:search] end - st=Dbi_search_string.new('metadata_and_text.notes_abstract',search_for.abstract,q['ab'],cse).string + st=DBI_SearchString.new('metadata_and_text.notes_abstract',search_for.abstract,q['ab'],cse).string if st[:flag] search[:text] << st[:search] search[:endnotes] << st[:search] end - st=Dbi_search_string.new('metadata_and_text.src_filename',search_for.filename,q['fns'],cse).string + st=DBI_SearchString.new('metadata_and_text.src_filename',search_for.filename,q['fns'],cse).string if st[:flag] search[:text] << st[:search] search[:endnotes] << st[:search] @@ -539,7 +537,7 @@ module SiSU_CGI_sql WOK_SQL end def tail - v=SiSU_Env::Info_version.instance.get_version + v=SiSU_Env::InfoVersion.instance.get_version <<-WOK_SQL def tail <<-'WOK' @@ -703,7 +701,7 @@ module SiSU_CGI_sql def main2 <<-'WOK_SQL' search_field=cgi['find'] if cgi['find'] # =~/\S+/ - @search_for=Search_request.new(search_field,q) #.analyze #% search_for + @search_for=SearchRequest.new(search_field,q) #.analyze #% search_for #% searches #Canned_search.new(@base,@search_for.text1,cgi) if @search_for.text1=~/\S+/ or @search_for.fulltext=~/\S+/ or @search_for.author=~/\S+/ or @search_for.topic_register=~/\S+/ #and search_field =~/\S/ @@ -756,13 +754,13 @@ module SiSU_CGI_sql elsif checked_all =~/checked/ or checked_url =~/checked/ canned_search=@@canned_search_url.scan(/(?:s1|ft|au|ti|fns|tr)=[^&]+/) af=canned_search.join('; ') - af.gsub!(/s1=/,'text: ') - af.gsub!(/ft=/,'fulltxt: ') - af.gsub!(/au=/,'author: ') - af.gsub!(/ti=/,'title: ') - af.gsub!(/fns=/,'filename: ') - af.gsub!(/tr=/,'topic_register: ') - af.gsub!(/%2B/,' ') + af=af.gsub(/s1=/,'text: '). + gsub(/ft=/,'fulltxt: '). + gsub(/au=/,'author: '). + gsub(/ti=/,'title: '). + gsub(/fns=/,'filename: '). + gsub(/tr=/,'topic_register: '). + gsub(/%2B/,' ') analyze_format=af st=af.split(/\s*;\s*/) search_field=st.join("\n") @@ -819,7 +817,7 @@ module SiSU_CGI_sql @search[:endnotes]<<%{endnotes.clean~*'#{CGI.unescape(s1)}'} end #% dbi_request - dbi_statement=Dbi_search_statement.new(@conn,@search_for,q,checked_case) + dbi_statement=DBI_SearchStatement.new(@conn,@search_for,q,checked_case) @text_search_flag=false @text_search_flag=dbi_statement.text_search_flag s_contents=dbi_statement.contents @@ -843,7 +841,7 @@ module SiSU_CGI_sql end def dir_structure case @opt.dir_structure_by - when /language/ + when :language <<-'WOK_SQL' def path_manifest(fn,ln=nil) "#{@hostpath}/#{ln}/manifest/#{fn}.html" @@ -864,7 +862,7 @@ module SiSU_CGI_sql "#{@hostpath}/#{ln}/html/#{fn}.html" end WOK_SQL - when /filetype/ + when :filetype <<-'WOK_SQL' def path_manifest(fn,ln=nil) "#{@hostpath}/manifest/#{fn}.#{ln}.html" @@ -916,7 +914,7 @@ module SiSU_CGI_sql file_suffix=c['src_filename'][/.+?\.(_?sst|ssm)$/,1] lang=if location =~ /\S+?~(\S\S\S?)$/ l=location[/\S+?~(\S\S\S?)$/,1] - location.gsub!(/(\S+?)~\S\S\S?/,'\1') + location=location.gsub(/(\S+?)~\S\S\S?/,'\1') l=".#{l}" else '' end @@ -1008,7 +1006,7 @@ module SiSU_CGI_sql file_suffix=e['src_filename'][/.+?\.(_?sst|ssm)$/,1] lang=if location =~ /\S+?~(\S\S\S?)$/ l=location[/\S+?~(\S\S\S?)$/,1] - location.gsub!(/(\S+?)~\S\S\S?/,'\1') + location=location.gsub(/(\S+?)~\S\S\S?/,'\1') l=".#{l}" else '' end diff --git a/lib/sisu/v3/cgi_sqlite.rb b/lib/sisu/v3/cgi_sqlite.rb index a046fe31..9c2a6a8d 100644 --- a/lib/sisu/v3/cgi_sqlite.rb +++ b/lib/sisu/v3/cgi_sqlite.rb @@ -56,17 +56,17 @@ ** Description: generates naive cgi search form for search of sisu database (pgsql sqlite) =end -module SiSU_CGI_sqlite #% database building documents +module SiSU_CGI_SQLite #% database building documents require_relative 'sysenv' # sysenv.rb require_relative 'cgi_sql_common' # cgi_sql_common.rb - include SiSU_CGI_sql - class SiSU_search_sqlite < SiSU_CGI_common + include SiSU_CGI_SQL + class SearchSQLite < CGI_Common def initialize(opt,webserv) @opt,@webserv=opt,webserv - @env=SiSU_Env::Info_env.new('',opt) + @env=SiSU_Env::InfoEnv.new('',opt) @image_src="#{@env.url.webserv_cgi}/_sisu/image_sys" - @common=SiSU_CGI_sql::SiSU_CGI_common.new(@webserv,@opt,@image_src,@env) - @cgi_file_name="#{Db[:name_prefix_db]}by_#{opt.dir_structure_by}_sqlite.cgi" + @common=SiSU_CGI_SQL::CGI_Common.new(@webserv,@opt,@image_src,@env) + @cgi_file_name="#{Db[:name_prefix_db]}by_#{opt.dir_structure_by.to_s}_sqlite.cgi" end def sqlite serve=[] @@ -78,7 +78,7 @@ module SiSU_CGI_sqlite end end end - serve.sort! + serve=serve.sort f1,f2,f3='','','' serve.each do |x| f1 << %{ \n} @@ -137,7 +137,7 @@ module SiSU_CGI_sqlite end def search_statement <<-'WOK_SQL' - class Dbi_search_string + class DBI_SearchString def initialize(l,t,q,cse=false) @l,@t,@q=l,t,q end @@ -148,8 +148,8 @@ module SiSU_CGI_sqlite elsif @q =~/\S+/; unescaped_search=CGI.unescape(@q) end search_construct=[] - unescaped_search.gsub!(/\s*(AND|OR)\s*/,"%' \) \\1 #{@l} LIKE \( '%") - unescaped_search.gsub!(/(.+)/,"#{@l} LIKE \( '%\\1%' \)") + unescaped_search=unescaped_search.gsub(/\s*(AND|OR)\s*/,"%' \) \\1 #{@l} LIKE \( '%"). + gsub(/(.+)/,"#{@l} LIKE \( '%\\1%' \)") search_construct << unescaped_search search_construct=search_construct.join(' ') search[:search] << search_construct @@ -165,11 +165,11 @@ module SiSU_CGI_sqlite <<-'WOK_SQL' @search_text,@search_endnotes='','' search[:text].flatten.each {|x| @search_text << "#{x} AND " } - @search_text=@search_text.gsub!(/AND\s+$/m,'') - @search_text.gsub!(/(doc_objects\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+doc_objects\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)') + @search_text=@search_text.gsub(/AND\s+$/m,''). + gsub(/(doc_objects\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+doc_objects\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)') search[:endnotes].flatten.each {|x| @search_endnotes << "#{x} AND " } - @search_endnotes=@search_endnotes.gsub!(/AND\s+$/m,'') - @search_endnotes.gsub!(/(endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)') + @search_endnotes=@search_endnotes.gsub(/AND\s+$/m,''). + gsub(/(endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)') end WOK_SQL end diff --git a/lib/sisu/v3/character_encoding.rb b/lib/sisu/v3/character_encoding.rb index 0b565fb9..1931c466 100644 --- a/lib/sisu/v3/character_encoding.rb +++ b/lib/sisu/v3/character_encoding.rb @@ -57,7 +57,7 @@ output generators [requires kirbybase] =end -module SiSU_character_encode +module SiSU_CharacterEncode require 'kirbybase' require_relative 'sysenv' # sysenv.rb class Characters @@ -73,7 +73,7 @@ module SiSU_character_encode @ce_tbl=@db.create_table.documents(:character_encoding, :glyph,:String, :dec,:Integer, :hex,:String, :rb,:String, :html,:String, :html_name,:String, :tex,:String, :tex_licr,:String, :tex_alt,:String, :name,:String) end def db - x=Character_encoding.new.table + x=CharacterEncoding.new.table #x.each {|y| puts y[2].inspect} x.each do |c| #puts "#{c[0]}, #{c[1]}, #{c[2]}, #{c[3]}, #{c[4]}, #{c[5]}, #{c[6]}, #{c[7]}, #{c[8]}, #{c[9]}" @@ -138,7 +138,7 @@ module SiSU_character_encode end end end - class Character_encoding + class CharacterEncoding def table x=[] #:glyph, :dec,:hex, :rb, :xml , :html_name, :tex, :tex_licr, :tex_alt, :name diff --git a/lib/sisu/v3/composite.rb b/lib/sisu/v3/composite.rb index 95be6d1e..21adb030 100644 --- a/lib/sisu/v3/composite.rb +++ b/lib/sisu/v3/composite.rb @@ -59,9 +59,9 @@ =end module SiSU_Assemble require_relative 'sysenv' # sysenv.rb - class Remote_image + class RemoteImage def initialize - @env=SiSU_Env::Info_env.new + @env=SiSU_Env::InfoEnv.new end def image(dir) images=[] @@ -82,7 +82,7 @@ module SiSU_Assemble end output_path="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image_external" FileUtils::mkdir_p(output_path) unless FileTest.directory?(output_path) - SiSU_Env::System_call.new("#{path}/*",output_path,'q').rsync + 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" @@ -104,14 +104,14 @@ module SiSU_Assemble @@imager={} def initialize(opt) @opt=opt - @env=SiSU_Env::Info_env.new + @env=SiSU_Env::InfoEnv.new end def read begin @fns_array=IO.readlines(@opt.fns,'') assembled=insertions? write(assembled) - rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error + rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error ensure end end @@ -161,11 +161,11 @@ module SiSU_Assemble end if not @code_flag \ and i !~/^%+\s/ - i.gsub!(/^([123]|:?[ABC])~\? /,'% [conditional heading:] \1~ ') #off conditional heading (consider syntax) + i=i.gsub(/^([123]|:?[ABC])~\? /,'% [conditional heading:] \1~ ') #off conditional heading (consider syntax) if i =~/^@\S+?:/ - i.gsub!(/\n/m,"\n% ") - i.gsub!(/\n%\s+$/m,'') - i.gsub!(/^@\S+?:/m,"\n% [imported header:] ") #off imported headers + i=i.gsub(/\n/m,"\n% "). + gsub(/\n%\s+$/m,''). + gsub(/^@\S+?:/m,"\n% [imported header:] ") #off imported headers end end file[:prepared] << i @@ -176,8 +176,7 @@ module SiSU_Assemble end file[:prepared] << "\n% end import" << "\n\n" if file[:images].length > 0 - file[:images].flatten! - file[:images].uniq! + file[:images]=file[:images].flatten.uniq file[:images].delete_if {|x| x =~/https?:\/\// } end file @@ -218,32 +217,30 @@ module SiSU_Assemble end else tuned_file << para end - tuned_file.flatten! - tuned_file.compact! + tuned_file=tuned_file.flatten.compact end if @@imager.length >0 @@imager.each do |d,i| - i.flatten! - i.uniq! + i=i.flatten.uniq image_info=d + i - download_images(mage_info.flatten) + download_images(image_info.flatten) end end tuned_file end end - class Composite_file_list + class CompositeFileList @@imager={} def initialize(opt) @opt=opt - @env=SiSU_Env::Info_env.new + @env=SiSU_Env::InfoEnv.new end def read begin @opt.fns=@opt.fns.gsub(/\.ssm\.sst$/,'.ssm') #FIX earlier, hub @fns_array=IO.readlines(@opt.fns,'') files=insertions? - rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error + rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error ensure end end diff --git a/lib/sisu/v3/concordance.rb b/lib/sisu/v3/concordance.rb index 96101585..3d8ab38a 100644 --- a/lib/sisu/v3/concordance.rb +++ b/lib/sisu/v3/concordance.rb @@ -70,7 +70,7 @@ module SiSU_Concordance class Source def initialize(opt) @opt=opt - @particulars=SiSU_Particulars::Combined_singleton.instance.get_all(opt) + @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt) end def read begin @@ -95,23 +95,23 @@ module SiSU_Concordance SiSU_Screen::Ansi.new(@md.opt.cmd,"wc (word count) is off, concordance will be processed for all files including those over the max set size of: #{wordmax} words").warn unless @md.opt.cmd =~/q/ SiSU_Concordance::Source::Words.new(@particulars).songsheet end - rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error + rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error ensure end end private - class Doc_title + class DocTitle include SiSU_Viz #revisit, both requires (html & shared_xml) needed for stand alone operation (sisu -w [filename]) require_relative 'shared_xml' # shared_xml.rb require_relative 'html' # html.rb def initialize(particulars) @particulars,@md=particulars,particulars.md - @data=SiSU_HTML::Source::Html_environment.new(particulars).tuned_file_instructions - @file=SiSU_Env::SiSU_file.new(@md) - @vz=SiSU_Env::Get_init.instance.skin + @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::Info_skin.new(@md).select + SiSU_Env::InfoSkin.new(@md).select @fnb=@md.fnb @lex_button=%{SiSU home -->} @doc_details =<' + 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? + toc='
' + minitoc + '
' + div_class='content' + else + toc='' + div_class='content0' + end + top_band=if make.build.html_top_band? + head_banner.concordance_navigation_band('pdf') + else '' + end < @@ -136,14 +147,14 @@ WOK - #{@css.html_seg} + #{stylesheet.css_head_seg} #{@vz.js_head} #{@vz.js_top} - #{head_banner.concordance_navigation_band('pdf')} + #{top_band} #{toc} -
+
#{@doc_details}

Word index links are to html versions of the text the segmented version followed by the scroll (single document) version.
[For segmented text references [T1], [T2] or [T3] appearing without a link, indicates that the word appears in a title (or subtitle) of the text (that is identifiable by the appended object citation number).]

(The word listing/index is Case sensitive: Capitalized words appear before lower case)

@@ -185,11 +196,11 @@ WOK def initialize(particulars) @particulars=particulars begin - @vz=SiSU_Env::Get_init.instance.skin + @vz=SiSU_Env::GetInit.instance.skin @env,@md,@dal_array=particulars.env,particulars.md,particulars.dal_array - @file=SiSU_Env::SiSU_file.new(@md) + @file=SiSU_Env::FileOp.new(@md) @freq=Hash.new(0) - @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern + @dp=@@dp ||=SiSU_Env::InfoEnv.new.digest.pattern @rxp_lv1=/^#{Mx[:lv_o]}1:/ #fix @rxp_lv # Mx[:lv_o] @rxp_lv2=/^#{Mx[:lv_o]}2:/ #fix @rxp_lv # Mx[:lv_o] @rxp_lv3=/^#{Mx[:lv_o]}3:/ #fix @rxp_lv # Mx[:lv_o] @@ -203,7 +214,7 @@ WOK @alph=SiSU_i18n::Alphabet.new(@md.opt.lng).hash_arrays @alphlst=SiSU_i18n::Alphabet.new(@md.opt.lng).hash_strings @rgx_scanlist=%r{#{Mx[:fa_italics_o]}[#{@alphlst[:l]}#{@alphlst[:u]}0-9"\s]{2,12}#{Mx[:fa_italics_c]}|#{Mx[:fa_bold_o]}[#{@alphlst[:l]}#{@alphlst[:u]}0-9"\s]{2,12}#{Mx[:fa_bold_c]}|(?:https?|file)://\S+|<\S+?>|[#{@alphlst[:l]}#{@alphlst[:u]}]+|\w+}mi - rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error + rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error end end def songsheet @@ -211,7 +222,7 @@ WOK FileUtils::mkdir_p(@file.output_path.html_concordance.dir) unless FileTest.directory?(@file.output_path.html_concordance.dir) @file_concordance=File.open(@file.place_file.html_concordance.dir,'w') map_para - rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error + rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error ensure @file_concordance.close end @@ -238,61 +249,63 @@ WOK @dal_array.each do |line| if defined? line.ocn \ and line.ocn.to_s =~/\d/ - if line.is =~/heading/ \ - and line.ln==4 + if (line.is ==:heading \ + || line.is ==:heading_insert) \ + && line.ln==4 @seg=line.name end ocn=line.ocn.to_s if ocn =~/\d+/ \ and ocn !~/^0$/ - line.obj.gsub!(/#{@rxp_excluded1}/,' ') + line.obj=line.obj.gsub(/#{@rxp_excluded1}/,' ') line.obj=line.obj.split(@rgx_splitlist).join(' ') #%take in word or other match for word in line.obj.scan(@rgx_scanlist) #%take in word or other match if word =~ /^([#{@alphlst[:l]}])/ firstletter=$1 flu=firstletter.tr(@alphlst[:l],@alphlst[:u]) - word.gsub!(/^#{firstletter}/,flu ) + word=word.gsub(/^#{firstletter}/,flu ) end - word.gsub!(/#{Mx[:lnk_o]}|#{Mx[:lnk_c]}|#{Mx[:url_o]}|#{Mx[:url_c]}/,'') - word.gsub!(/#{Mx[:fa_o]}\S+?#{Mx[:fa_o_c]}/,'') - word.gsub!(/#{Mx[:fa_c_o]}\S+?#{Mx[:fa_c]}/,'') - word.gsub!(/#{Mx[:gl_o]}#[a-z]+#{Mx[:gl_c]}/,'') - word.gsub!(/#{Mx[:gl_o]}#[0-9]+#{Mx[:gl_c]}/,'') - word.gsub!(/[0-9a-f]{10,}/,' ') if word =~/[0-9]/ - word.gsub!(/#{Mx[:br_line]}/,' ') - word.gsub!(/^ +/,'') - word.gsub!(/^\S$/,'') + word=word.gsub(/#{Mx[:lnk_o]}|#{Mx[:lnk_c]}|#{Mx[:url_o]}|#{Mx[:url_c]}/,''). + gsub(/#{Mx[:fa_o]}\S+?#{Mx[:fa_o_c]}/,''). + gsub(/#{Mx[:fa_c_o]}\S+?#{Mx[:fa_c]}/,''). + gsub(/#{Mx[:gl_o]}#[a-z]+#{Mx[:gl_c]}/,''). + gsub(/#{Mx[:gl_o]}#[0-9]+#{Mx[:gl_c]}/,'') + word=word.gsub(/[0-9a-f]{10,}/,' ') if word =~/[0-9]/ + word=word.gsub(/#{Mx[:br_line]}/,' '). + gsub(/^ +/,''). + gsub(/^\S$/,'') word=nil if word.empty? word=nil if word =~@rxp_excluded0 #watch word=nil if word =~/^\S$/ if word - word.gsub!(/#{Mx[:br_nl]}|#{Mx[:br_line]}/,' ') - word.gsub!(/#{Mx[:fa_o]}[a-z]{1,7}#{Mx[:fa_o_c]}|#{Mx[:fa_c_o]}[a-z]{1,7}#{Mx[:fa_c]}/,'') - word.gsub!(/#{Mx[:en_a_o]}(?:\d|[*+])*|#{Mx[:en_b_o]}(?:\d|[*+])*|#{Mx[:en_a_c]}|#{Mx[:en_b_c]}/mi,'') - word.gsub!(/#{Mx[:fa_o]}\S+?#{Mx[:fa_o_c]}/,''); word.gsub!(/#{Mx[:fa_c_o]}\S+?#{Mx[:fa_c]}/,'') - word.gsub!(/<\/?\S+?>/,'') - word.gsub!(/^\@+/,'') - word.strip! - word.gsub!(/#{Mx[:tc_p]}.+/,'') - word.gsub!(/[\.,;:"]$/,'') - word.gsub!(/["]/,'') - word.gsub!(/^\s*[\(]/,'') - word.gsub!(/[\(]\s*$/,'') - word.gsub!(/^(?:See|e\.?g\.?).+/,'') - word.gsub!(/^\s*[.,;:]\s*/,'') - word.strip! - word.gsub!(/^\(?[a-zA-Z]\)$/,'') - word.gsub!(/^\d+(st|nd|rd|th)$/,'') - word.gsub!(/^(\d+\.?)+$/, '') - word.gsub!(/#{Mx[:mk_o]}|#{Mx[:mk_c]}/,'') - word.gsub!(/:name#\S+/,'') - word.gsub!(/^\S$/,'') + word=word.gsub(/#{Mx[:br_nl]}|#{Mx[:br_line]}/,' '). + gsub(/#{Mx[:fa_o]}[a-z]{1,7}#{Mx[:fa_o_c]}|#{Mx[:fa_c_o]}[a-z]{1,7}#{Mx[:fa_c]}/,''). + gsub(/#{Mx[:en_a_o]}(?:\d|[*+])*|#{Mx[:en_b_o]}(?:\d|[*+])*|#{Mx[:en_a_c]}|#{Mx[:en_b_c]}/mi,''). + gsub(/#{Mx[:fa_o]}\S+?#{Mx[:fa_o_c]}/,''). + gsub(/#{Mx[:fa_c_o]}\S+?#{Mx[:fa_c]}/,''). + gsub(/<\/?\S+?>/,''). + gsub(/^\@+/,''). + strip. + gsub(/#{Mx[:tc_p]}.+/,''). + gsub(/[\.,;:"]$/,''). + gsub(/["]/,''). + gsub(/^\s*[\(]/,''). + gsub(/[\(]\s*$/,''). + gsub(/^(?:See|e\.?g\.?).+/,''). + gsub(/^\s*[.,;:]\s*/,''). + strip. + gsub(/^\(?[a-zA-Z]\)$/,''). + gsub(/^\d+(st|nd|rd|th)$/,''). + gsub(/^(\d+\.?)+$/, ''). + gsub(/#{Mx[:mk_o]}|#{Mx[:mk_c]}/,''). + gsub(/:name#\S+/,''). + gsub(/^\S$/,'') word=nil if word =~/^\S$/ word=nil if word =~/^\s*$/ #watch if word unless word =~/[A-Z][A-Z]/ \ or word =~/\w+\s\w+/ - word.capitalize! + word=word.capitalize end @freq[word] +=1 @word_map[word] ||= [] @@ -315,9 +328,9 @@ WOK end scr='Full Text scroll: doc#  ' seg='' - head=SiSU_Concordance::Source::Doc_title.new(@particulars).create - head.gsub!(/#{Xx[:html_relative2]}/m,@file.path_rel_links.html_seg_2) - head.gsub!(/#{Xx[:html_relative1]}/m,@file.path_rel_links.html_seg_1) + head=SiSU_Concordance::Source::DocTitle.new(@particulars).create + head=head.gsub(/#{Xx[:html_relative2]}/m,@file.path_rel_links.html_seg_2). + gsub(/#{Xx[:html_relative1]}/m,@file.path_rel_links.html_seg_1) @file_concordance << head @file_concordance << '

' alph=@alph[:u] diff --git a/lib/sisu/v3/conf.rb b/lib/sisu/v3/conf.rb index 05bc8608..5eb1b116 100644 --- a/lib/sisu/v3/conf.rb +++ b/lib/sisu/v3/conf.rb @@ -61,7 +61,7 @@ module SiSU_Initialize include SiSU_Env include SiSU_Screen require_relative 'relaxng' # relaxng.rb - include SiSU_relaxng + include SiSU_Relaxng require_relative 'css' # css.rb include SiSU_Style class Source @@ -69,19 +69,19 @@ module SiSU_Initialize @opt=opt end def read - SiSU_Config.new(@opt).make_homepage - SiSU_Config.new(@opt).css - SiSU_Config.new(@opt).dtd - SiSU_Config.new(@opt).cp_local_images - SiSU_Config.new(@opt).cp_external_images - SiSU_Config.new(@opt).cp_webserver_images #if @opt.mod.inspect =~/--init(?:ialize)?=site/ + ConfigSite.new(@opt).make_homepage + ConfigSite.new(@opt).css + ConfigSite.new(@opt).dtd + ConfigSite.new(@opt).cp_local_images + ConfigSite.new(@opt).cp_external_images + ConfigSite.new(@opt).cp_webserver_images #if @opt.mod.inspect =~/--init(?:ialize)?=site/ end end - class SiSU_Config #config files such as css are not updated if they already exist unless forced using the --init=site modifier + class ConfigSite #config files such as css are not updated if they already exist unless forced using the --init=site modifier require_relative 'sysenv' # sysenv.rb def initialize(opt) @opt=opt - @env=SiSU_Env::Info_env.new(@opt.fns) + @env=SiSU_Env::InfoEnv.new(@opt.fns) @suffix,@path={},{} @suffix[:rnc]='rnc' @suffix[:rng]='rng' @@ -94,30 +94,30 @@ module SiSU_Initialize end def make_homepage SiSU_Screen::Ansi.new(@opt.cmd,'invert','Make homepage','').colorize unless @opt.cmd =~/q/ - SiSU_Env::Create_site.new(@opt.cmd).homepage + SiSU_Env::CreateSite.new(@opt.cmd).homepage end def cp_local_images SiSU_Screen::Ansi.new(@opt.cmd,'invert','Copy images','').colorize unless @opt.cmd =~/q/ - SiSU_Env::Create_site.new(@opt.cmd).cp_local_images - SiSU_Env::Create_site.new(@opt.cmd).cp_webserver_images_local #this should not have been necessary - SiSU_Env::Create_site.new(@opt.cmd).cp_base_images #base images (nav etc.) used by all html + SiSU_Env::CreateSite.new(@opt.cmd).cp_local_images + SiSU_Env::CreateSite.new(@opt.cmd).cp_webserver_images_local #this should not have been necessary + SiSU_Env::CreateSite.new(@opt.cmd).cp_base_images #base images (nav etc.) used by all html end def cp_external_images SiSU_Screen::Ansi.new(@opt.cmd,'invert','Copy external images','').colorize if @opt.cmd =~/V/ - SiSU_Env::Create_site.new(@opt.cmd).cp_external_images + SiSU_Env::CreateSite.new(@opt.cmd).cp_external_images end def cp_webserver_images SiSU_Screen::Ansi.new(@opt.cmd,'invert','Copy webserver/output file images','').colorize unless @opt.cmd =~/q/ - SiSU_Env::Create_site.new(@opt.cmd).cp_webserver_images - SiSU_Env::Create_system_link.new.images + SiSU_Env::CreateSite.new(@opt.cmd).cp_webserver_images + SiSU_Env::CreateSystemLink.new.images end def css SiSU_Screen::Ansi.new(@opt.cmd,'invert','Configuring CSSs','').colorize unless @opt.cmd =~/q/ - SiSU_Env::Create_site.new(@opt.cmd).cp_css + SiSU_Env::CreateSite.new(@opt.cmd).cp_css end def dtd SiSU_Screen::Ansi.new(@opt.cmd,'invert','Configuring DTDs','').colorize unless @opt.cmd =~/q/ - @rxng=SiSU_relaxng::RelaxNG.new + @rxng=SiSU_Relaxng::RelaxNG.new @path.each { |d| FileUtils::mkdir_p(d[1]) unless FileTest.directory?(d[1]) } #ugly code, sort later if @rxng.methods.join =~/[^_]dtd_sax\b/ @@ -167,10 +167,10 @@ module SiSU_Initialize rnc << @rxng.rnc_model_output_sax rnc.close #xsd - schema=SiSU_Env::System_call.new(rnc_src,xsd_file) + schema=SiSU_Env::SystemCall.new(rnc_src,xsd_file) schema.relaxng(@opt.cmd) #rng - schema=SiSU_Env::System_call.new(rnc_src,rng_file) + schema=SiSU_Env::SystemCall.new(rnc_src,rng_file) schema.relaxng(@opt.cmd) #rnc FileUtils::cp(rnc_src,rnc_file) @@ -186,10 +186,10 @@ module SiSU_Initialize rnc << @rxng.rnc_model_output_dom rnc.close #xsd - schema=SiSU_Env::System_call.new(rnc_src,xsd_file) + schema=SiSU_Env::SystemCall.new(rnc_src,xsd_file) schema.relaxng(@opt.cmd) #rng - schema=SiSU_Env::System_call.new(rnc_src,rng_file) + schema=SiSU_Env::SystemCall.new(rnc_src,rng_file) schema.relaxng(@opt.cmd) #rnc FileUtils::cp(rnc_src,rnc_file) @@ -205,10 +205,10 @@ module SiSU_Initialize rnc << @rxng.rnc_model_output_xhtml rnc.close #xsd - schema=SiSU_Env::System_call.new(rnc_src,xsd_file) + schema=SiSU_Env::SystemCall.new(rnc_src,xsd_file) schema.relaxng(@opt.cmd) #rng - schema=SiSU_Env::System_call.new(rnc_src,rng_file) + schema=SiSU_Env::SystemCall.new(rnc_src,rng_file) schema.relaxng(@opt.cmd) #rnc FileUtils::cp(rnc_src,rnc_file) @@ -220,7 +220,7 @@ module SiSU_Initialize rnc=File.new(rnc_file,'w') rnc << @rxng.rnc_model_output_sax rnc.close - schema=SiSU_Env::System_call.new(rnc_file,dtd_file) + schema=SiSU_Env::SystemCall.new(rnc_file,dtd_file) schema.relaxng(@opt.cmd) end def trang_rnc_model_input_dom @@ -229,7 +229,7 @@ module SiSU_Initialize rnc=File.new(rnc_file,'w') rnc << @rxng.rnc_model_output_dom rnc.close - schema=SiSU_Env::System_call.new(rnc_file,dtd_file) + schema=SiSU_Env::SystemCall.new(rnc_file,dtd_file) schema.relaxng(@opt.cmd) end def trang_rnc_model_input_node @@ -239,7 +239,7 @@ module SiSU_Initialize rnc=File.new(rnc_file,'w') rnc << @rxng.rnc_model_input_node rnc.close - schema=SiSU_Env::System_call.new(rnc_file,dtd_file) + schema=SiSU_Env::SystemCall.new(rnc_file,dtd_file) schema.relaxng(@opt.cmd) end end diff --git a/lib/sisu/v3/constants.rb b/lib/sisu/v3/constants.rb index d39c56ea..439dee68 100644 --- a/lib/sisu/v3/constants.rb +++ b/lib/sisu/v3/constants.rb @@ -273,8 +273,8 @@ puts "#{__FILE__} #{__LINE__} #{o.inspect}" puts __FILE__ + ' ' + __LINE__.to_s + '--> ' + o.inspect puts %{-\t#{__FILE__}::#{__LINE__}::#{caller}:\n"#{name}"} p "\t" + txt.obj + " << #{__FILE__} #{__LINE__} >>" -p (__FILE__ + ' ' + __LINE__.to_s + '--> ' + dob.inspect) if dob.is=='heading' -data.each {|o| p (__FILE__ + ' ' + __LINE__.to_s + '--> ' + o.inspect) if o.is=='heading'} +p (__FILE__ + ' ' + __LINE__.to_s + '--> ' + dob.inspect) if dob.is==:heading +data.each {|o| p (__FILE__ + ' ' + __LINE__.to_s + '--> ' + o.inspect) if o.is==:heading} puts "#{__FILE__} #{__LINE__} #{para}" if @opt.cmd =~/M/ puts "#{__FILE__} #{__LINE__} #{t_o}" if @opt.cmd =~/M/ dr ┌ 9484 dR ┍ 9485 Dr ┎ 9486 DR ┏ 9487 dl ┐ 9488 dL ┑ 9489 Dl ┒ 9490 LD ┓ 9491 ur └ 9492 uR ┕ 9493 Ur ┖ 9494 UR ┗ 9495 ul ┘ 9496 uL ┙ 9497 Ul ┚ 9498 UL ┛ 9499 vr ├ diff --git a/lib/sisu/v3/css.rb b/lib/sisu/v3/css.rb index 348c89e7..cbbd05ca 100644 --- a/lib/sisu/v3/css.rb +++ b/lib/sisu/v3/css.rb @@ -59,9 +59,101 @@ module SiSU_Style require_relative 'sysenv' # sysenv.rb require_relative 'defaults' # defaults.rb + class CSS_HeadInfo + def initialize(md,ft='html') + @md,@ft=md,ft + @env=SiSU_Env::InfoEnv.new('',md) + @fn_css ||=SiSU_Env::CSS_Default.new + @o_str ||=SiSU_Env::ProcessingSettings.new(md).output_dir_structure + css_copy + end + def stylesheet + def css_path + SiSU_Env::CSS_Stylesheet.new(@md) + end + def css_embed_content + @css_embed_content ||=SiSU_Style::CSS.new + end + def css_embed? + if @ft=='html' \ + && @o_str.dump_or_redirect? + true + else + false + end + end + def css_embed(css) + <<-WOK + + WOK + end + def css_action + style_css=SiSU_Style::CSS.new + css=case @ft + when 'html' + css=css_embed_content.html + css_embed(css) + when 'xhtml' + css_path.xhtml + when 'xml_sax' + css_path.xml_sax + when 'xml_dom' + css_path.xml_dom + else + css_embed_content.html + end + end + def css_head + (css_embed?) \ + ? css_action + : "#{css_path.html}#{css_path.html_seg}" + end + def css_head_seg + (css_embed?) \ + ? css_action + : css_path.html_seg + end + def css_head_xml + css_action + end + self + end + def css_copy + if @o_str.dump_or_redirect? + css=SiSU_Style::CSS.new + if @o_str.dump? + css_pth="#{@md.opt.opt_act[:dump][:inst]}/#{@env.path.style}" + elsif @o_str.redirect? + css_pth="#{@md.opt.opt_act[:redirect][:inst]}/#{@md.fnb}/#{@env.path.style}" + end + FileUtils::mkdir_p(css_pth) unless FileTest.directory?(css_pth) + case @ft + when 'html' + style=File.new("#{css_pth}/#{@fn_css.html}",'w') + style << css.html + style.close + when 'xhtml' + style=File.new("#{css_pth}/#{@fn_css.xhtml}",'w') + style << css.xhtml + style.close + when 'xml_sax' + style=File.new("#{css_pth}/#{@fn_css.xml_sax}",'w') + style << css.xml_sax + style.close + when 'xml_dom' + style=File.new("#{css_pth}/#{@fn_css.xml_dom}",'w') + style << css.xml_dom + style.close + css_path.xml_dom + end + end + end + end class CSS def initialize - @vz=SiSU_Env::Get_init.instance.skin + @vz=SiSU_Env::GetInit.instance.skin end def fonts @vz.font_fonts @@ -1442,12 +1534,12 @@ WOK padding-left: 1em; padding-right: 1em; } -/* - div.content { - margin-left: 1em; - margin-right: 1em; + div.content0, div.main_column0 { + margin: 0; + padding: 0; + border-left: 0% solid #ffffff; + padding-left: 5%; } -*/ div.scroll { margin: 0; padding: 0; diff --git a/lib/sisu/v3/dal.rb b/lib/sisu/v3/dal.rb index 50cf94f9..bd8d32dd 100644 --- a/lib/sisu/v3/dal.rb +++ b/lib/sisu/v3/dal.rb @@ -66,7 +66,7 @@ module SiSU_DAL include SiSU_Param require_relative 'dal_doc_objects' # dal_doc_objects.rb require_relative 'dal_syntax' # dal_syntax.rb - include SiSU_Syntax + include SiSU_DAL_Syntax require_relative 'dal_doc_str' # dal_doc_str.rb require_relative 'dal_idx' # dal_idx.rb require_relative 'dal_numbering' # dal_numbering.rb @@ -94,9 +94,9 @@ module SiSU_DAL @opt,@fnx=opt,fnx @@fns||@opt.fns @make_fns=if @fnx and @fnx =~/\.ss[tmi]$/ - SiSU_Env::Info_file.new(@fnx) + SiSU_Env::InfoFile.new(@fnx) else - SiSU_Env::Info_file.new(@opt.fns) + SiSU_Env::InfoFile.new(@opt.fns) end @fnm=@make_fns.marshal.dal_metadata @fnc=@make_fns.marshal.dal_content @@ -106,8 +106,8 @@ module SiSU_DAL @idx_xhtml=@make_fns.marshal.dal_idx_xhtml @map_nametags=@make_fns.marshal.dal_map_nametags @map_ocn_htmlseg=@make_fns.marshal.dal_map_ocn_htmlseg - SiSU_Env::Create_system_link.new.images - @env=SiSU_Env::Info_env.new + SiSU_Env::CreateSystemLink.new.images + @env=SiSU_Env::InfoEnv.new end def read #creates dal begin @@ -117,9 +117,9 @@ module SiSU_DAL ? @fnx : @opt.fns create_dal - rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@@fns).error + rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@@fns).error ensure - Instantiate.new + SiSU_DAL::Instantiate.new end end def get #reads dal, unless does not exist then creates first @@ -133,9 +133,9 @@ module SiSU_DAL @@dal_array=[] end dal=(@@dal_array.empty?) ? read_fnc : @@dal_array.dup - rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error + rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error ensure - Instantiate.new + SiSU_DAL::Instantiate.new end end def get_idx_sst #reads dal idx.sst, #unless does not exist then creates first @@ -149,9 +149,9 @@ module SiSU_DAL @@idx_arr[:sst]=[] end dal=(@@idx_arr[:sst].empty?) ? read_idx_sst : @@idx_arr[:sst].dup #check - rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error + rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error ensure - Instantiate.new + SiSU_DAL::Instantiate.new end end def get_idx_tex #reads dal idx.tex, #unless does not exist then creates first @@ -165,9 +165,9 @@ module SiSU_DAL @@idx_arr[:tex]=[] end dal=(@@idx_arr[:tex].empty?) ? read_idx_tex : @@idx_arr[:tex].dup #check - rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error + rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error ensure - Instantiate.new + SiSU_DAL::Instantiate.new end end def get_idx_html #reads dal idx.html, #unless does not exist then creates first @@ -181,9 +181,9 @@ module SiSU_DAL @@idx_arr[:html]=[] end dal=(@@idx_arr[:html].empty?) ? read_idx_html : @@idx_arr[:html].dup - rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error + rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error ensure - Instantiate.new + SiSU_DAL::Instantiate.new end end def get_idx_xhtml #reads dal idx.xhtml, #unless does not exist then creates first @@ -197,9 +197,9 @@ module SiSU_DAL @@idx_arr[:xthml]=[] end dal=(@@idx_arr[:xhtml].empty?) ? read_idx_xhtml : @@idx_arr[:xhtml].dup - rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error + rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error ensure - Instantiate.new + SiSU_DAL::Instantiate.new end end def get_map_nametags #reads dal map.nametags, #unless does not exist then creates first @@ -213,9 +213,9 @@ module SiSU_DAL @@map_arr[:nametags]=[] end dal=(@@map_arr[:nametags].empty?) ? read_map_nametags : @@map_arr[:nametags].dup - rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error + rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error ensure - Instantiate.new + SiSU_DAL::Instantiate.new end end def get_map_ocn_htmlseg #reads dal map.ocn_htmlseg, #unless does not exist then creates first @@ -229,9 +229,9 @@ module SiSU_DAL @@map_arr[:ocn_htmlseg]=[] end dal=(@@map_arr[:ocn_htmlseg].empty?) ? read_map_ocn_htmlseg : @@map_arr[:ocn_htmlseg].dup - rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error + rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error ensure - Instantiate.new + SiSU_DAL::Instantiate.new end end protected @@ -257,7 +257,7 @@ module SiSU_DAL meta=nil dal=SiSU_DAL::Make.new(fn,@md,file_array).song if @opt.cmd =~/[vM]/ - cf=SiSU_Env::Create_file.new(fn) + cf=SiSU_Env::CreateFile.new(fn) SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"~meta/#{@opt.fns}.meta").output if @opt.cmd =~/v/i SiSU_Screen::Ansi.new(@opt.cmd,"dal -> #{cf.meta}").txt_grey if @opt.cmd =~/M/ end @@ -340,16 +340,16 @@ module SiSU_DAL class Output def initialize(fn,md,data) @fn,@md,@data=fn,md,data - @cf=SiSU_Env::Create_file.new(@fn) - @make=SiSU_Env::Info_file.new(@fn) - @dir=SiSU_Env::Info_env.new(@fn) + @cf=SiSU_Env::CreateFile.new(@fn) + @make=SiSU_Env::InfoFile.new(@fn) + @dir=SiSU_Env::InfoEnv.new(@fn) end def screen_dump(o) if defined? o.of print %{OF: #{o.of}; } end if defined? o.is - print %{IS: #{o.is}; } + print %{IS: #{o.is.to_s}; } end if defined? o.ocn print %{OCN: #{o.ocn}; } @@ -386,15 +386,15 @@ module SiSU_DAL @data.each do |o| if defined? o.ocn filename_txt.puts case o.is - when 'heading' - "[#{o.is} #{o.lv}~#{o.name} [#{o.ocn}]] #{o.obj}" - else "[#{o.is} [#{o.ocn}]] #{o.obj}" + when :heading + "[#{o.is.to_s} #{o.lv}~#{o.name} [#{o.ocn}]] #{o.obj}" + else "[#{o.is.to_s} [#{o.ocn}]] #{o.obj}" end else filename_txt.puts case o.is - when 'meta' + when :meta "[m~#{o.tag}] #{o.obj}" - else "[#{o.is}] #{o.obj}" + else "[#{o.is.to_s}] #{o.obj}" end end end @@ -402,8 +402,8 @@ module SiSU_DAL @data.each do |o| if defined? o.ocn case o.is - when 'heading' - filename_debug.puts "#{o.is} #{o.lv}~#{o.name} odv=#{o.odv} osp=#{o.osp} [#{o.ocn}] -->\n\t#{o.obj}" + when :heading + filename_debug.puts "#{o.is.to_s} #{o.lv}~#{o.name} odv=#{o.odv} osp=#{o.osp} [#{o.ocn}] -->\n\t#{o.obj}" end end end @@ -465,7 +465,7 @@ module SiSU_DAL class Make def initialize(fn,md,data) @fn,@md,@data=fn,md,data - @env=SiSU_Env::Info_env.new(@md.fns) + @env=SiSU_Env::InfoEnv.new(@md.fns) end def reset @@flag_vocab=0 @@ -475,15 +475,15 @@ module SiSU_DAL reset data=@data data=data.join.split("\n\n") - data=SiSU_insertions::Insertions.new(@md,data).expand_insertions? # dal_expand_insertions.rb - data=SiSU_substitute_and_insert::SI.new(@md,data).substitutions_and_insertions? # dal_substitutions_and_insertions.rb - data,metadata=SiSU_document_structure_extract::Build.new(@md,data).identify_parts # dal_doc_str.rb - data=SiSU_Syntax::Markup.new(@md,data).songsheet # dal_syntax.rb - data,endnote_array=SiSU_character_check::Check.new(data).character_check_and_oldstyle_endnote_array # dal_character_check.rb - data=SiSU_images::Images.new(@md,data).images # dal_images.rb - data,tags_map,ocn_html_seg_map=SiSU_numbering::Numbering.new(@md,data).numbering_song # dal_numbering.rb - data,book_index_rel,book_index_rel_html_seg,html_idx,xhtml_idx=SiSU_book_index::Book_index.new(@md,data,@env).indexing_song if @md.book_idx # dal_idx.rb - data=SiSU_endnotes::Endnotes.new(@md,data,endnote_array).endnotes # dal_endnotes.rb + data=SiSU_DAL_Insertions::Insertions.new(@md,data).expand_insertions? # dal_expand_insertions.rb + data=SiSU_DAL_SubstituteAndInsert::SI.new(@md,data).substitutions_and_insertions? # dal_substitutions_and_insertions.rb + data,metadata=SiSU_DAL_DocumentStructureExtract::Build.new(@md,data).identify_parts # dal_doc_str.rb + data=SiSU_DAL_Syntax::Markup.new(@md,data).songsheet # dal_syntax.rb + data,endnote_array=SiSU_DAL_CharacterCheck::Check.new(data).character_check_and_oldstyle_endnote_array # dal_character_check.rb + data=SiSU_DAL_Images::Images.new(@md,data).images # dal_images.rb + data,tags_map,ocn_html_seg_map=SiSU_DAL_Numbering::Numbering.new(@md,data).numbering_song # dal_numbering.rb + data,book_index_rel,book_index_rel_html_seg,html_idx,xhtml_idx=SiSU_DAL_BookIndex::BookIndex.new(@md,data,@env).indexing_song if @md.book_idx # dal_idx.rb + data=SiSU_DAL_Endnotes::Endnotes.new(@md,data,endnote_array).endnotes # dal_endnotes.rb outputdata=data if @md.opt.cmd =~/[mM]/ SiSU_DAL::Output.new(@fn,@md,outputdata).hard_output diff --git a/lib/sisu/v3/dal_character_check.rb b/lib/sisu/v3/dal_character_check.rb index 70cddf91..e5ab7578 100644 --- a/lib/sisu/v3/dal_character_check.rb +++ b/lib/sisu/v3/dal_character_check.rb @@ -56,7 +56,7 @@ ** Description: system environment, resource control and configuration details =end -module SiSU_character_check +module SiSU_DAL_CharacterCheck class Check def initialize(data) @data=data @@ -68,26 +68,27 @@ module SiSU_character_check @tuned_file,@endnote_array=[],[] endnote_no=1 data.each do |dob| - unless dob.is =='table' - dob.obj.strip! - dob.obj.gsub!(/^[{~}]\s*$/,'') - dob.obj.gsub!(/~#\s*/,"#{Mx[:pa_non_object_no_heading]}") - dob.obj.gsub!(/-#\s*/,"#{Mx[:pa_non_object_dummy_heading]}") - dob.obj.gsub!(/(#{Mx[:en_a_o]})\s*\s+/,'\1 '); dob.obj.gsub!(/(~\{\s*)\s+/,'\1 ') - dob.obj.gsub!(/ \/\//,"#{Mx[:br_line]}") - dob.obj.gsub!(/
/,"#{Mx[:br_line]}") #needed by xml, xhtml etc. - dob.obj.gsub!(/\t/,' ') - dob.obj.gsub!(/\342\200\231/u,"'") #if dob =~/’/ #Avoid #‘ ’ #“ ” - dob.obj.gsub!(/�/u,' ') #watch, replace with char code - dob.obj.gsub!(/·/u,'*') - dob.obj.gsub!(/\\copy(?:right)?\b/,'©') - dob.obj.gsub!(/\\trademark\b|\\tm\b/,'®') + unless dob.is ==:table + dob.obj=dob.obj.strip. + gsub(/^[{~}]\s*$/,''). + gsub(/~#\s*/,"#{Mx[:pa_non_object_no_heading]}"). + gsub(/-#\s*/,"#{Mx[:pa_non_object_dummy_heading]}"). + gsub(/(#{Mx[:en_a_o]})\s*\s+/,'\1 '). + gsub(/(~\{\s*)\s+/,'\1 '). + gsub(/ \/\//,"#{Mx[:br_line]}"). + gsub(/
/,"#{Mx[:br_line]}"). #needed by xml, xhtml etc. + gsub(/\t/,' '). + gsub(/\342\200\231/u,"'"). #if dob =~/’/ #Avoid #‘ ’ #“ ” + gsub(/�/u,' '). #watch, replace with char code + gsub(/·/u,'*'). + gsub(/\\copy(?:right)?\b/,'©'). + gsub(/\\trademark\b|\\tm\b/,'®') dob.obj=dob.obj + "\n" - unless dob.is =~/^code/ + unless dob.is ==:code case dob.obj when /\^~/ #% Note must do this first (earlier loop) and then enter gathered data into ~^\d+ sub_dob=dob.obj.dup - @endnote_array << sub_dob.gsub!(/\n/,'').gsub!(/\^~\s+(.+)\s*/,%{#{Mx[:en_a_o]}#{endnote_no} \\1 #{Mx[:en_a_c]}}).strip + @endnote_array << sub_dob.gsub(/\n/,'').gsub(/\^~\s+(.+)\s*/,%{#{Mx[:en_a_o]}#{endnote_no} \\1 #{Mx[:en_a_c]}}).strip endnote_no+=1 dob=nil if dob.obj =~/\^~ .+/ #watch, removes 'binary' endnote now in endnote array for later insertion end diff --git a/lib/sisu/v3/dal_doc_objects.rb b/lib/sisu/v3/dal_doc_objects.rb index 4e8b5c0f..e413993a 100644 --- a/lib/sisu/v3/dal_doc_objects.rb +++ b/lib/sisu/v3/dal_doc_objects.rb @@ -56,37 +56,37 @@ ** Description: document abstraction =end -module SiSU_document_structure +module SiSU_DAL_DocumentStructure class Extract def extract(h,o) obj=h ? h : o end end - class Object_metadata + class ObjectMetadata attr_accessor :is,:of,:tags,:obj,:digest def initialize @tags={} @is=@tmp=@digest=nil - @of='meta' + @of=:meta end def metadata(tags) of= @of #String, classification - group - is= 'meta' #String, classification - specific type + is= :meta #String, classification - specific type tags= tags || ((defined? o.tags) ? o.tags : {}) #String, metadata type/tag obj= nil @of,@is,@tags,@obj=of,is,tags,obj self end end - class Object_meta + class ObjectMeta attr_accessor :obj,:is,:of,:tag,:digest,:tmp def initialize @is=@obj=@tag=@digest=@digest=@tmp=nil - @of='meta' + @of=:meta end def metadata(h,o=nil) of= @of #String, classification - group - is= 'meta' #String, classification - specific type + is= :meta #String, classification - specific type tag= h[:tag] || ((defined? o.tag) ? o.tag : nil) #String, metadata type/tag obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use @@ -95,10 +95,10 @@ module SiSU_document_structure self end end - class Object_heading + class ObjectHeading attr_accessor :obj,:is,:tags,:of,:lv,:ln,:toc_,:name,:idx,:ocn,:odv,:osp,:node,:parent,:ocn_,:note_,:autonum_,:digest,:tmp def initialize - @of='para' + @of=:para @is=@obj=@lv=@ln=@toc_=@name=@idx=@size=@ocn=@odv=@osp=@node=@parent=@ocn_=@note_=@autonum_=@digest=@tmp=nil @tags=[] end @@ -135,7 +135,7 @@ module SiSU_document_structure h[:lv]=heading_lv(h[:ln]) end of= @of #String, classification - group - is= 'heading' #String, classification - specific type + is= :heading #String, classification - specific type name= h[:name] || ((defined? o.name) ? o.name : nil) #String, named object? tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content @@ -162,20 +162,20 @@ module SiSU_document_structure end def heading_insert(h,o=nil) heading(h,o=nil) - @is= 'heading_insert' #String, classification - specific type + @is= :heading_insert #String, classification - specific type self end end - class Object_para + class ObjectPara attr_accessor :obj,:is,:tags,:of,:name,:idx,:bullet_,:indent,:hang,:ocn,:odv,:osp,:parent,:note_,:image_,:ocn_,:digest,:tmp def initialize - @of='para' + @of=:para @is=@obj=@name=@idx=@bullet_=@indent=@hang=@size=@ocn=@odv=@osp=@parent=@note_=@image_=@ocn_=@digest=@tmp=nil @tags=[] end def paragraph(h,o=nil) of= @of #String, classification - group - is= 'para' #String, classification - specific type + is= :para #String, classification - specific type name= h[:name] || ((defined? o.name) ? o.name : nil) #String, named object? tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content @@ -199,7 +199,7 @@ module SiSU_document_structure end def docinfo(h,o=nil) of= @of #String, classification - group - is= 'docinfo' #String, classification - specific type + is= :docinfo #String, classification - specific type name= h[:name] || ((defined? o.name) ? o.name : nil) #String, named object? tags= h[:tags] || ((defined? o.tags) ? o.tags : nil) #Array, associated object tags, names if any obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content @@ -222,16 +222,16 @@ module SiSU_document_structure self end end - class Object_block_txt + class ObjectBlockTxt attr_accessor :obj,:is,:of,:tags,:idx,:ocn,:odv,:osp,:parent,:note_,:number_,:ocn_,:digest,:tmp def initialize - @of='block' + @of=:block @is=@obj=@idx=@ocn=@odv=@osp=@parent=@note_=@number_=@ocn_=@digest=@tmp=nil @tags=[] end def code(h,o=nil) of= @of #String, classification - group #alt 'code' - is= 'code' #String, classification - specific type + is= :code #String, classification - specific type tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? @@ -251,7 +251,7 @@ module SiSU_document_structure end def block(h,o=nil) of= @of #String, classification - group - is= 'block' #String, classification - specific type + is= :block #String, classification - specific type tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? @@ -270,7 +270,7 @@ module SiSU_document_structure end def group(h,o=nil) of= @of #String, classification - group - is= 'group' #String, classification - specific type + is= :group #String, classification - specific type tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? @@ -289,7 +289,7 @@ module SiSU_document_structure end def alt(h,o=nil) #see block of= @of #String, classification - group - is= 'alt' #String, classification - specific type + is= :alt #String, classification - specific type tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? @@ -308,7 +308,7 @@ module SiSU_document_structure end def verse(h,o=nil) #part of poem decide how you deal with this of= @of #String, classification - group - is= 'verse' #String, classification - specific type + is= :verse #String, classification - specific type tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? @@ -326,16 +326,16 @@ module SiSU_document_structure self end end - class Object_table + class ObjectTable attr_accessor :obj,:is,:of,:lv,:tags,:name,:idx,:indent,:hang,:size,:ocn,:number,:head_,:cols,:widths,:odv,:osp,:parent,:note_,:ocn_,:digest,:tmp def initialize - @of='block' + @of=:block @is=@obj=@lv=@name=@idx=@indent=@hang=@size=@ocn,@number,@head_,@cols,@widths=@odv=@osp=@parent=@note_=@ocn_=@digest=@tmp=nil @tags=[] end def table(h,o=nil) of= @of #String, classification - group - is= 'table' #String, classification - specific type + is= :table #String, classification - specific type tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any cols= h[:cols] || ((defined? o.cols) ? o.cols : nil) widths= h[:widths] || ((defined? o.widths) ? o.widths : nil) @@ -356,16 +356,16 @@ module SiSU_document_structure self end end - class Object_image + class ObjectImage attr_accessor :obj,:is,:of,:lv,:idx,:size,:ocn,:parent,:note_,:ocn_,:digest,:tmp def initialize - @of='image' + @of=:image @is=@obj=@lv=@idx=@size=@ocn=@parent=@note_=@ocn_=@tmp=@digest=nil @tags=[] end def image(h,o=nil) #not yet used, and what of a paragraph containing several images, consider of= @of #String, classification - group - is= 'image' #String, classification - specific type + is= :image #String, classification - specific type tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content size= h[:size] || ((defined? o.size) ? o.size : nil) @@ -384,15 +384,15 @@ module SiSU_document_structure self end end - class Object_structure + class ObjectStructure attr_accessor :obj,:tag,:node,:lv,:ln,:status,:is,:of,:tmp def initialize - @of='structure' + @of=:structure @is=@obj=@node=@lv=@ln=@status=@tmp=nil end def xml_dom(h,o=nil) of= @of #String, classification - group - is= 'xml_dom' #String, classification - specific type + is= :xml_dom #String, classification - specific type obj= h[:obj] || ((defined? o.obj) ? o.obj : '') #String, text content lv= h[:lv] || ((defined? o.lv) ? o.lv : nil) #Alpha-numeric, document structure as used in markup, A-C then 1-6 ln= h[:ln] || ((defined? o.ln) ? o.ln : nil) #Integer, document structure level, for convenience in processing 1-9 @@ -403,30 +403,30 @@ module SiSU_document_structure self end end - class Object_comment + class ObjectComment attr_accessor :obj,:is,:of,:tmp def initialize - @of='comment' + @of=:comment @is=@obj=@tmp=nil end def comment(h,o=nil) of= @of #String, classification - group - is= 'comment' #String, classification - specific type + is= :comment #String, classification - specific type obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use @of,@is,@obj,@tmp=of,is,obj,tmp self end end - class Object_layout + class ObjectLayout attr_accessor :obj,:is,:of,:tmp def initialize - @of='layout' + @of=:layout @is=@obj=@tmp=nil end def break(h,o=nil) #decide how to deal with, perhaps no obj? of= @of #String, classification - group - is= 'break' #String, classification - specific type + is= :break #String, classification - specific type obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use @of,@is,@obj,@tmp=of,is,obj,tmp @@ -434,7 +434,7 @@ module SiSU_document_structure end def insert(h,o=nil) #decide how to deal with, could mimic paragraph? of= @of #String, classification - group - is= 'insert' #String, classification - specific type + is= :insert #String, classification - specific type obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use @of,@is,@obj,@tmp=of,is,obj,tmp diff --git a/lib/sisu/v3/dal_doc_str.rb b/lib/sisu/v3/dal_doc_str.rb index 7bc36e11..b4a98edd 100644 --- a/lib/sisu/v3/dal_doc_str.rb +++ b/lib/sisu/v3/dal_doc_str.rb @@ -56,7 +56,7 @@ ** Description: document abstraction =end -module SiSU_document_structure_extract +module SiSU_DAL_DocumentStructureExtract class Instantiate < SiSU_Param::Parameters::Instructions @@flag={} #Beware!! def initialize @@ -69,9 +69,9 @@ module SiSU_document_structure_extract @@flag={} #Beware!! def initialize(md,data) @md,@data=md,data - Instantiate.new - @pb=SiSU_document_structure::Object_layout.new.break(Hx[:br_page]) - @pbn=SiSU_document_structure::Object_layout.new.break(Hx[:br_page_new]) + 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]) end def ln_get(lv) ln=case lv @@ -131,11 +131,11 @@ module SiSU_document_structure_extract if str.nil? else if str =~/(?:^|[ ])\*~([a-z0-9._-]+)(?=[ #{Mx[:br_nl]}]|$)/ - str.gsub!(/(^|[ ])\*~([a-z0-9._-]+)(?=[ #{Mx[:br_nl]}]|$)/i, - "\\1#{Mx[:tag_o]}\\2#{Mx[:tag_c]}") - str.gsub!(/ [ ]+/i,' ') + str=str.gsub(/(^|[ ])\*~([a-z0-9._-]+)(?=[ #{Mx[:br_nl]}]|$)/i, + "\\1#{Mx[:tag_o]}\\2#{Mx[:tag_c]}"). + gsub(/ [ ]+/i,' ') tags=str.scan(/#{Mx[:tag_o]}(\S+?)#{Mx[:tag_c]}/).flatten - str.gsub!(/[ ]?#{Mx[:tag_o]}\S+?#{Mx[:tag_c]}[ ]?/,' ') #may be issues with spaces would leave one, but "code" blocks? + str=str.gsub(/[ ]?#{Mx[:tag_o]}\S+?#{Mx[:tag_c]}[ ]?/,' ') #may be issues with spaces would leave one, but "code" blocks? end tags=nametag ? (tags << nametag) : tags end @@ -148,7 +148,7 @@ module SiSU_document_structure_extract @@counter,@verse_count=0,0 @metadata={} @data.each do |t_o| - t_o.gsub!(/(?:\n\s*\n)+/m,"\n") unless @@flag['code'] + t_o=t_o.gsub(/(?:\n\s*\n)+/m,"\n") unless @@flag['code'] if t_o !~/^(?:code|poem|alt|group|block)\{|^\}(?:code|poem|alt|group|block)|^(?:table\{|\{table)[ ~]/ \ and not @@flag['code'] \ and not @@flag['poem'] \ @@ -158,7 +158,7 @@ module SiSU_document_structure_extract and not @@flag['table'] unless t_o =~/^(?:@\S+?:|%+)\s/ # extract book index for paragraph if any idx=if t_o=~/^=\{(.+)\}\s*$\Z/m; m=$1 - t_o.gsub!(/\n=\{.+\}\s*$\Z/m,'') + t_o=t_o.gsub(/\n=\{.+\}\s*$\Z/m,'') m else nil end @@ -173,7 +173,7 @@ module SiSU_document_structure_extract when /^%+\s/ #comment t_o=if t_o=~/^%+\s+(.+)/ h={obj: $1} - SiSU_document_structure::Object_comment.new.comment(h) + SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h) else nil end when /^:?([A-C1-6])\~/ #heading / lv @@ -184,19 +184,19 @@ module SiSU_document_structure_extract note=endnote_test?(obj) obj,tags=extract_tags(obj) h={ lv: lv, ln: ln, obj: obj, idx: idx, tags: tags } - SiSU_document_structure::Object_heading.new.heading(h) + SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h) elsif t_o=~/^:?[A-C1-6]\~(\S+?)-\s+(.+)/m name,obj=$1,$2 note=endnote_test?(obj) obj,tags=extract_tags(obj) h={ lv: lv, name: name, obj: obj, idx: idx, autonum_: false, tags: tags} - SiSU_document_structure::Object_heading.new.heading(h) + SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h) elsif t_o=~/^:?[A-C1-6]\~(\S+)\s+(.+)/m name,obj=$1,$2 note=endnote_test?(obj) obj,tags=extract_tags(obj,name) h={ lv: lv, name: name, obj: obj, idx: idx, tags: tags } - SiSU_document_structure::Object_heading.new.heading(h) + SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h) else nil end when /^_(?:[1-9]!?|[1-9]?\*)\s+/ #indented and/or bullet paragraph @@ -213,7 +213,7 @@ module SiSU_document_structure_extract obj,tags=extract_tags(obj) unless obj=~/\A\s*\Z/m h={ bullet_: bullet, hang: hang, indent: indent, obj: obj, idx: idx, note_: note, image_: image, tags: tags } - SiSU_document_structure::Object_para.new.paragraph(h) + SiSU_DAL_DocumentStructure::ObjectPara.new.paragraph(h) end else nil end @@ -230,23 +230,23 @@ module SiSU_document_structure_extract obj,tags=extract_tags(obj) unless obj=~/\A\s*\Z/m h={ hang: hang, indent: indent, obj: obj, idx: idx, note_: note, image_: image, tags: tags } - SiSU_document_structure::Object_para.new.paragraph(h) + SiSU_DAL_DocumentStructure::ObjectPara.new.paragraph(h) end else nil end when /^[<\[](?:br)?:(?:pa?r|o(?:bj|---)?)[>\]]\s*$/ #[br:par] #[br:obj] - SiSU_document_structure::Object_layout.new.break(Hx[:br_obj]) + SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_obj]) when /^(?:[<\[](?:br)?:pg[>\]]|?)\s*$/ #[br:pg] - SiSU_document_structure::Object_layout.new.break(Hx[:br_page]) + SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page]) when /^[<\[](?:br)?:pg?n[>\]]\s*$/ #[br:pgn] - SiSU_document_structure::Object_layout.new.break(Hx[:br_page_new]) + SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_new]) else #paragraph image=image_test(t_o) note=endnote_test?(t_o) obj,tags=extract_tags(t_o) unless obj=~/\A\s*\Z/m h={ bullet_: false, indent: 0, hang: 0, obj: obj, idx: idx, note_: note, image_: image, tags: tags } - SiSU_document_structure::Object_para.new.paragraph(h) + SiSU_DAL_DocumentStructure::ObjectPara.new.paragraph(h) end end elsif not @@flag['code'] @@ -255,30 +255,30 @@ module SiSU_document_structure_extract @@counter=1 @codeblock_numbered=(t_o =~/^code\{#/) ? true : false h={ obj: 'code block start' } #introduce a counter - t_o=SiSU_document_structure::Object_comment.new.comment(h) #t_o=SiSU_document_structure::Object_layout.new.insert(h) + t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h) #t_o=SiSU_DAL_DocumentStructure::ObjectLayout.new.insert(h) elsif t_o =~/^poem\{/ @@flag['poem']=true h={ obj: 'poem start' } #introduce a counter - t_o=SiSU_document_structure::Object_comment.new.comment(h) #t_o=SiSU_document_structure::Object_layout.new.insert(h) + t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h) #t_o=SiSU_DAL_DocumentStructure::ObjectLayout.new.insert(h) tuned_file << t_o elsif t_o =~/^group\{/ @@flag['group']=true h={ obj: 'group text start' } #introduce a counter - t_o=SiSU_document_structure::Object_comment.new.comment(h) #t_o=SiSU_document_structure::Object_layout.new.insert(h) + t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h) #t_o=SiSU_DAL_DocumentStructure::ObjectLayout.new.insert(h) tuned_file << t_o elsif t_o =~/^block\{/ @@flag['block']=true h={ obj: 'block text start' } #introduce a counter - t_o=SiSU_document_structure::Object_comment.new.comment(h) #t_o=SiSU_document_structure::Object_layout.new.insert(h) + t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h) #t_o=SiSU_DAL_DocumentStructure::ObjectLayout.new.insert(h) tuned_file << t_o elsif t_o =~/^alt\{/ @@flag['alt']=true h={ obj: 'alt text start' } #introduce a counter - t_o=SiSU_document_structure::Object_comment.new.comment(h) #t_o=SiSU_document_structure::Object_layout.new.insert(h) + t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h) #t_o=SiSU_DAL_DocumentStructure::ObjectLayout.new.insert(h) tuned_file << t_o elsif t_o =~/^(?:table\{|\{table)[ ~]/ h={ obj: 'table start' } #introduce a counter - ins=SiSU_document_structure::Object_comment.new.comment(h) #ins=SiSU_document_structure::Object_layout.new.insert(h) + ins=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h) #ins=SiSU_DAL_DocumentStructure::ObjectLayout.new.insert(h) tuned_file << ins if t_o=~/^table\{(?:~h)?\s+/ @@flag['table']=true @@ -304,7 +304,7 @@ module SiSU_document_structure_extract cols=nil rws.each do |r| cols=(cols ? cols : (r.scan('|').length) +1) - r.gsub!(/\s*\|\s*/m,"#{Mx[:tc_p]}") #r.gsub!(/\|/m,"#{Mx[:tc_p]}") + r=r.gsub(/\s*\|\s*/m,"#{Mx[:tc_p]}") #r.gsub!(/\|/m,"#{Mx[:tc_p]}") rows += r + Mx[:tc_c] end col=[] @@ -318,10 +318,10 @@ module SiSU_document_structure_extract cols.times { col << width } end h={ head_: hd, cols: cols, widths: col, obj: rows, idx: idx, tags: tags } - t_o=SiSU_document_structure::Object_table.new.table(h) unless h.nil? + t_o=SiSU_DAL_DocumentStructure::ObjectTable.new.table(h) unless h.nil? tuned_file << t_o h={ obj: 'table end' } #introduce a counter - t_o=SiSU_document_structure::Object_comment.new.comment(h) + t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h) t_o elsif t_o=~/^\{table(?:~h)?\s+/ m1,m2,hd=nil,nil,nil @@ -337,14 +337,14 @@ module SiSU_document_structure_extract rws=tbl.split(/\n/) rows='' rws.each do |r| - r.gsub!(/\s*\|\s*/m,"#{Mx[:tc_p]}") #r.gsub!(/\|/m,"#{Mx[:tc_p]}") + r=r.gsub(/\s*\|\s*/m,"#{Mx[:tc_p]}") #r.gsub!(/\|/m,"#{Mx[:tc_p]}") rows += r + Mx[:tc_c] end h={ head_: hd, cols: col.length, widths: col, obj: rows, idx: idx, tags: tags } - t_o=SiSU_document_structure::Object_table.new.table(h) unless h.nil? + t_o=SiSU_DAL_DocumentStructure::ObjectTable.new.table(h) unless h.nil? tuned_file << t_o h={ obj: 'table end' } #introduce a counter - t_o=SiSU_document_structure::Object_comment.new.comment(h) + t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h) t_o end end @@ -356,18 +356,18 @@ module SiSU_document_structure_extract @@flag['table']=false headings,columns,widths,idx=@h[:head_],@h[:cols],@h[:widths],@h[:idx] @h={ head_: headings, cols: columns, widths: widths, idx: idx, obj: @rows } - t_o=SiSU_document_structure::Object_table.new.table(@h) + t_o=SiSU_DAL_DocumentStructure::ObjectTable.new.table(@h) tuned_file << t_o @h,@rows=nil,'' t_o h={ obj: 'table end' } #introduce a counter - t_o=SiSU_document_structure::Object_comment.new.comment(h) #t_o=SiSU_document_structure::Object_layout.new.insert(h) + t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h) #t_o=SiSU_DAL_DocumentStructure::ObjectLayout.new.insert(h) t_o else if t_o !~/^table\{/ \ and not t_o.nil? - t_o.gsub!(/^\n+/m,'') #check added for ruby 1.9.2 not needed in 1.8 series (tested in v2) - t_o.gsub!(/\n+/m,"#{Mx[:tc_p]}") + t_o=t_o.gsub(/^\n+/m,''). #check added for ruby 1.9.2 not needed in 1.8 series (tested in v2) + gsub(/\n+/m,"#{Mx[:tc_p]}") @rows += t_o + Mx[:tc_c] end t_o=nil @@ -379,11 +379,11 @@ module SiSU_document_structure_extract obj=@tuned_code.join("\n") tags=[] h={ obj: obj, tags: tags, number_: @codeblock_numbered } - t_o=SiSU_document_structure::Object_block_txt.new.code(h) + t_o=SiSU_DAL_DocumentStructure::ObjectBlockTxt.new.code(h) @tuned_code=[] tuned_file << t_o h={ obj: 'code block end' } #introduce a counter - t_o=SiSU_document_structure::Object_comment.new.comment(h) #t_o=SiSU_document_structure::Object_layout.new.insert(h) + t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h) #t_o=SiSU_DAL_DocumentStructure::ObjectLayout.new.insert(h) end if @@flag['code'] \ and t_o.class==String \ @@ -392,7 +392,7 @@ module SiSU_document_structure_extract @line_mode=sub_array.scan(/.+/) @line_mode=[] sub_array.scan(/.+/) {|w| @line_mode << w if w =~/[\S]+/} - t_o=SiSU_document_structure_extract::Build.new(@md,@line_mode).build_lines('code').join + t_o=SiSU_DAL_DocumentStructureExtract::Build.new(@md,@line_mode).build_lines('code').join @tuned_code << t_o t_o=nil end @@ -404,37 +404,37 @@ module SiSU_document_structure_extract and t_o =~/^\}poem/ @@flag['poem']=false h={ obj: 'poem end' } #introduce a counter - t_o=SiSU_document_structure::Object_comment.new.comment(h) #t_o=SiSU_document_structure::Object_layout.new.insert(h) + t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h) #t_o=SiSU_DAL_DocumentStructure::ObjectLayout.new.insert(h) elsif ( @@flag['group'] \ and t_o =~/^\}group/ ) @@flag['group']=false obj,tags=extract_tags(@tuned_block.join("\n")) h={ obj: obj, tags: tags } @tuned_block=[] - t_o=SiSU_document_structure::Object_block_txt.new.group(h) + t_o=SiSU_DAL_DocumentStructure::ObjectBlockTxt.new.group(h) tuned_file << t_o h={ obj: 'group text end' } #introduce a counter - t_o=SiSU_document_structure::Object_comment.new.comment(h) #t_o=SiSU_document_structure::Object_layout.new.insert(h) + t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h) #t_o=SiSU_DAL_DocumentStructure::ObjectLayout.new.insert(h) elsif ( @@flag['block'] \ and t_o =~/^\}block/ ) @@flag['block']=false obj,tags=extract_tags(@tuned_block.join("\n")) h={ obj: obj, tags: tags } @tuned_block=[] - t_o=SiSU_document_structure::Object_block_txt.new.block(h) + t_o=SiSU_DAL_DocumentStructure::ObjectBlockTxt.new.block(h) tuned_file << t_o h={ obj: 'block text end' } #introduce a counter - t_o=SiSU_document_structure::Object_comment.new.comment(h) #t_o=SiSU_document_structure::Object_layout.new.insert(h) + t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h) #t_o=SiSU_DAL_DocumentStructure::ObjectLayout.new.insert(h) elsif ( @@flag['alt'] \ and t_o =~/^\}alt/ ) @@flag['alt']=false obj,tags=extract_tags(@tuned_block.join("\n")) h={ obj: obj, tags: tags } - t_o=SiSU_document_structure::Object_block_txt.new.alt(h) + t_o=SiSU_DAL_DocumentStructure::ObjectBlockTxt.new.alt(h) @tuned_block=[] tuned_file << t_o h={ obj: 'alt text end' } #introduce a counter - t_o=SiSU_document_structure::Object_comment.new.comment(h) #t_o=SiSU_document_structure::Object_layout.new.insert(h) + t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h) #t_o=SiSU_DAL_DocumentStructure::ObjectLayout.new.insert(h) end if @@flag['poem'] \ or @@flag['group'] \ @@ -444,13 +444,13 @@ module SiSU_document_structure_extract sub_array=t_o.dup @line_mode=sub_array.scan(/.+/) type=if @@flag['poem']; 'poem' - t_o=SiSU_document_structure_extract::Build.new(@md,@line_mode).build_lines(type).join + t_o=SiSU_DAL_DocumentStructureExtract::Build.new(@md,@line_mode).build_lines(type).join poem=t_o.split(/\n\n/) poem.each do |v| - v.gsub!(/\n/m,"#{Mx[:br_nl]}\n") + v=v.gsub(/\n/m,"#{Mx[:br_nl]}\n") obj,tags=extract_tags(v) h={ obj: obj, tags: tags } - t_o=SiSU_document_structure::Object_block_txt.new.verse(h) + t_o=SiSU_DAL_DocumentStructure::ObjectBlockTxt.new.verse(h) tuned_file << t_o end else 'group' @@ -463,17 +463,17 @@ module SiSU_document_structure_extract or @@flag['group'] \ or @@flag['alt'] if t_o.class==String - t_o.gsub!(/\n/m,"#{Mx[:br_nl]}") - t_o.gsub!(/[ ][ ]/m,"#{Mx[:nbsp]*2}") - t_o.gsub!(/#{Mx[:nbsp]}\s/,"#{Mx[:nbsp]*2}") + t_o=t_o.gsub(/\n/m,"#{Mx[:br_nl]}"). + gsub(/[ ][ ]/m,"#{Mx[:nbsp]*2}"). + gsub(/#{Mx[:nbsp]}\s/,"#{Mx[:nbsp]*2}") t_o=t_o + Mx[:br_nl] if t_o =~/\S+/ - elsif t_o.is=='group' \ - or t_o.is=='block' \ - or t_o.is=='alt' \ - or t_o.is=='verse' - t_o.obj.gsub!(/\n/m,"#{Mx[:br_nl]}") - t_o.obj.gsub!(/[ ][ ]/m,"#{Mx[:nbsp]*2}") - t_o.obj.gsub!(/#{Mx[:nbsp]}\s/,"#{Mx[:nbsp]*2}") + elsif t_o.is==:group \ + || t_o.is==:block \ + || t_o.is==:alt \ + || t_o.is==:verse + t_o.obj=t_o.obj.gsub(/\n/m,"#{Mx[:br_nl]}"). + gsub(/[ ][ ]/m,"#{Mx[:nbsp]*2}"). + gsub(/#{Mx[:nbsp]}\s/,"#{Mx[:nbsp]*2}") end @tuned_block << t_o if t_o =~/\S+/ else tuned_file << t_o @@ -484,32 +484,27 @@ module SiSU_document_structure_extract if @md.flag_endnotes tuned_file << @pb h={ ln: 2, obj: 'Endnotes', autonum_: false } - tuned_file << SiSU_document_structure::Object_heading.new.heading_insert(h) + tuned_file << SiSU_DAL_DocumentStructure::ObjectHeading.new.heading_insert(h) h={ ln: 4, obj: 'Endnotes', name: 'endnotes', autonum_: false } - tuned_file << SiSU_document_structure::Object_heading.new.heading_insert(h) + tuned_file << SiSU_DAL_DocumentStructure::ObjectHeading.new.heading_insert(h) h={ obj: 'Endnotes' } end if @md.book_idx tuned_file << @pb h={ ln: 2, obj: 'Index', autonum_: false } - tuned_file << SiSU_document_structure::Object_heading.new.heading_insert(h) + tuned_file << SiSU_DAL_DocumentStructure::ObjectHeading.new.heading_insert(h) h={ ln: 4, obj: 'Index', name: 'book_index', autonum_: false } - tuned_file << SiSU_document_structure::Object_heading.new.heading_insert(h) + tuned_file << SiSU_DAL_DocumentStructure::ObjectHeading.new.heading_insert(h) h={ obj: 'Index' } end tuned_file << @pb h={ ln: 2, obj: 'Metadata', autonum_: false, ocn_: false } - tuned_file << SiSU_document_structure::Object_heading.new.heading_insert(h) + tuned_file << SiSU_DAL_DocumentStructure::ObjectHeading.new.heading_insert(h) h={ ln: 4, obj: 'SiSU Metadata, document information', name: 'metadata', autonum_: false, ocn_: false } - tuned_file << SiSU_document_structure::Object_heading.new.heading_insert(h) - tuned_file << @pb - h={ ln: 2, obj: 'Manifest', autonum_: false, ocn_: false } - tuned_file << SiSU_document_structure::Object_heading.new.heading_insert(h) - h={ ln: 4, obj: 'SiSU Manifest, alternative outputs etc.', name: 'sisu_manifest', autonum_: false, ocn_: false } - tuned_file << SiSU_document_structure::Object_heading.new.heading_insert(h) + tuned_file << SiSU_DAL_DocumentStructure::ObjectHeading.new.heading_insert(h) tuned_file h={ obj: 'eof' } - meta=SiSU_document_structure::Object_metadata.new.metadata(@metadata) + meta=SiSU_DAL_DocumentStructure::ObjectMetadata.new.metadata(@metadata) [tuned_file,meta] end def table_rows_and_columns_array(table_str) @@ -522,33 +517,33 @@ module SiSU_document_structure_extract end def meta_heading(h) h={ lv: h[:lv], ln: h[:ln], name: h[:name], obj: h[:obj], ocn: '0' } - SiSU_document_structure::Object_heading.new.heading(h) + SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h) end def meta_para(str) h={ obj: str, ocn_: false } - SiSU_document_structure::Object_para.new.paragraph(h) + SiSU_DAL_DocumentStructure::ObjectPara.new.paragraph(h) end def build_lines(type='') - data=@data - data.each do |line| - if line =~/\S/ \ + lines,lines_new=@data,[] + lines.each do |line| + line=if line =~/\S/ \ and line !~/^code\{|^\}code/ \ and line.class != Hash - line.gsub!(/\s\s/,"#{Mx[:nbsp]*2}") - line.gsub!(/#{Mx[:nbsp]}\s/,"#{Mx[:nbsp]*2}") - line.gsub!(/^/,"#{Mx[:gr_o]}codeline#{Mx[:gr_c]}") if type=='code' # REMOVE try sort for texpdf special case - if line =~/(?:https?|file|ftp):\/\/\S+$/ - line.gsub!(/\s*$/," #{Mx[:br_nl]}") - else line.gsub!(/\s*$/,"#{Mx[:br_nl]}") #unless type=='code' - end - if @@flag['code']; @@counter+=1 - else + @@counter+=1 if @@flag['code'] + line=line.gsub(/\s\s/,"#{Mx[:nbsp]*2}"). + gsub(/#{Mx[:nbsp]}\s/,"#{Mx[:nbsp]*2}") + line=line.gsub(/^/,"#{Mx[:gr_o]}codeline#{Mx[:gr_c]}") if type=='code' # REMOVE try sort for texpdf special case + line=if line =~/(?:https?|file|ftp):\/\/\S+$/ + line.gsub(/\s*$/," #{Mx[:br_nl]}") + else line.gsub(/\s*$/,"#{Mx[:br_nl]}") #unless type=='code' end elsif line =~/^\s*$/ - line.gsub!(/\s*$/,"#{Mx[:br_nl]}") + line.gsub(/\s*$/,"#{Mx[:br_nl]}") + else line end + lines_new << line end - data + lines_new end end class Structure # this must happen early @@ -561,29 +556,29 @@ module SiSU_document_structure_extract @dob end def structure_markup #build structure where structure provided only in meta header - @dob=if @dob.is =~/para/ \ - and ((@dob.hang !~/[1-9]/ and @dob.indent !~/[1-9]/) \ - or (@dob.hang != @dob.indent)) \ + @dob=if @dob.is ==:para \ + && (((@dob.hang !~/[1-9]/) && (@dob.indent !~/[1-9]/)) \ + || (@dob.hang != @dob.indent)) \ and not @dob.bullet_ @dob=case @dob.obj when /^#{@md.lv1}/ h={ lv: 'A', ln: 1 } - SiSU_document_structure::Object_heading.new.heading(h,@dob) + SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h,@dob) when /^#{@md.lv2}/ h={ lv: 'B', ln: 2 } - SiSU_document_structure::Object_heading.new.heading(h,@dob) + SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h,@dob) when /^#{@md.lv3}/ h={ lv: 'C', ln: 3 } - SiSU_document_structure::Object_heading.new.heading(h,@dob) + SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h,@dob) when /^#{@md.lv4}/ h={ lv: '1', ln: 4 } - SiSU_document_structure::Object_heading.new.heading(h,@dob) + SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h,@dob) when /^#{@md.lv5}/ h={ lv: '2', ln: 5 } - SiSU_document_structure::Object_heading.new.heading(h,@dob) + SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h,@dob) when /^#{@md.lv6}/ h={ lv: '3', ln: 6 } - SiSU_document_structure::Object_heading.new.heading(h,@dob) + SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h,@dob) else @dob end else @dob @@ -592,26 +587,26 @@ module SiSU_document_structure_extract end def structure_markup_normalize #needs a bit of thinking dob=if @md.markup_version.determined < 0.38 #%convert internal representation, consider making 0.38 structure default ([A-C1-6] instead of [1-9]), requires downstream changes - @dob.gsub!(/^[456]~/,'!_') - @dob.gsub!(/^3~(\S+)/,"#{Mx[:lv_o]}6:\\1#{Mx[:lv_c]}") - @dob.gsub!(/^3~\s+/,"#{Mx[:lv_o]}6:#{Mx[:lv_c]}") - @dob.gsub!(/^2~(\S+)/,"#{Mx[:lv_o]}5:\\1#{Mx[:lv_c]}") - @dob.gsub!(/^2~\s+/,"#{Mx[:lv_o]}5:#{Mx[:lv_c]}") - @dob.gsub!(/^1~(\S+)/,"#{Mx[:lv_o]}4:\\1#{Mx[:lv_c]}") - @dob.gsub!(/^1~\s+/,"#{Mx[:lv_o]}4:#{Mx[:lv_c]}") - @dob.gsub!(/^:?C~(\S+)/,"#{Mx[:lv_o]}3:\\1#{Mx[:lv_c]}") - @dob.gsub!(/^:?C~\s+/,"#{Mx[:lv_o]}3:#{Mx[:lv_c]}") - @dob.gsub!(/^:?B~(\S+)/,"#{Mx[:lv_o]}2:\\1#{Mx[:lv_c]}") - @dob.gsub!(/^:?B~\s+/,"#{Mx[:lv_o]}2:#{Mx[:lv_c]}") - @dob.gsub!(/^:?A~(\S+)/,"#{Mx[:lv_o]}1:\\1#{Mx[:lv_c]}") - @dob.gsub!(/^:?A~\s+/,"#{Mx[:lv_o]}1:#{Mx[:lv_c]}") + @dob=@dob.gsub(/^[456]~/,'!_'). + gsub(/^3~(\S+)/,"#{Mx[:lv_o]}6:\\1#{Mx[:lv_c]}"). + gsub(/^3~\s+/,"#{Mx[:lv_o]}6:#{Mx[:lv_c]}"). + gsub(/^2~(\S+)/,"#{Mx[:lv_o]}5:\\1#{Mx[:lv_c]}"). + gsub(/^2~\s+/,"#{Mx[:lv_o]}5:#{Mx[:lv_c]}"). + gsub(/^1~(\S+)/,"#{Mx[:lv_o]}4:\\1#{Mx[:lv_c]}"). + gsub(/^1~\s+/,"#{Mx[:lv_o]}4:#{Mx[:lv_c]}"). + gsub(/^:?C~(\S+)/,"#{Mx[:lv_o]}3:\\1#{Mx[:lv_c]}"). + gsub(/^:?C~\s+/,"#{Mx[:lv_o]}3:#{Mx[:lv_c]}"). + gsub(/^:?B~(\S+)/,"#{Mx[:lv_o]}2:\\1#{Mx[:lv_c]}"). + gsub(/^:?B~\s+/,"#{Mx[:lv_o]}2:#{Mx[:lv_c]}"). + gsub(/^:?A~(\S+)/,"#{Mx[:lv_o]}1:\\1#{Mx[:lv_c]}"). + gsub(/^:?A~\s+/,"#{Mx[:lv_o]}1:#{Mx[:lv_c]}") @dob=if @dob =~/^@(?:level|markup):\s/ - @dob.gsub!(/3/,'6') - @dob.gsub!(/2/,'5') - @dob.gsub!(/1/,'4') - @dob.gsub!(/:?C/,'3') - @dob.gsub!(/:?B/,'2') - @dob.gsub!(/:?A/,'1') + @dob=@dob.gsub(/3/,'6'). + gsub(/2/,'5'). + gsub(/1/,'4'). + gsub(/:?C/,'3'). + gsub(/:?B/,'2'). + gsub(/:?A/,'1') @dob else @dob end @@ -620,19 +615,19 @@ module SiSU_document_structure_extract end def structure_marks t_o=if @md.markup_version.determined < 0.38 - @t_o.gsub!(/^1~(\S+)/,"#{Mx[:lv_o]}1:\\1#{Mx[:lv_c]}") - @t_o.gsub!(/^1~\s+/,"#{Mx[:lv_o]}1:#{Mx[:lv_c]}") - @t_o.gsub!(/^2~(\S+)/,"#{Mx[:lv_o]}2:\\1#{Mx[:lv_c]}") - @t_o.gsub!(/^2~\s+/,"#{Mx[:lv_o]}2:#{Mx[:lv_c]}") - @t_o.gsub!(/^3~(\S+)/,"#{Mx[:lv_o]}3:\\1#{Mx[:lv_c]}") - @t_o.gsub!(/^3~\s+/,"#{Mx[:lv_o]}3:#{Mx[:lv_c]}") - @t_o.gsub!(/^4~(\S+)/,"#{Mx[:lv_o]}4:\\1#{Mx[:lv_c]}") - @t_o.gsub!(/^4~\s+/,"#{Mx[:lv_o]}4:#{Mx[:lv_c]}") - @t_o.gsub!(/^5~(\S+)/,"#{Mx[:lv_o]}5:\\1#{Mx[:lv_c]}") - @t_o.gsub!(/^5~\s+/,"#{Mx[:lv_o]}5:#{Mx[:lv_c]}") - @t_o.gsub!(/^6~(\S+)/,"#{Mx[:lv_o]}6:\\1#{Mx[:lv_c]}") - @t_o.gsub!(/^6~\s+/,"#{Mx[:lv_o]}6:#{Mx[:lv_c]}") - @t_o.gsub!(/^[789]~/,'!_') + @t_o=@t_o.gsub(/^1~(\S+)/,"#{Mx[:lv_o]}1:\\1#{Mx[:lv_c]}"). + gsub(/^1~\s+/,"#{Mx[:lv_o]}1:#{Mx[:lv_c]}"). + gsub(/^2~(\S+)/,"#{Mx[:lv_o]}2:\\1#{Mx[:lv_c]}"). + gsub(/^2~\s+/,"#{Mx[:lv_o]}2:#{Mx[:lv_c]}"). + gsub(/^3~(\S+)/,"#{Mx[:lv_o]}3:\\1#{Mx[:lv_c]}"). + gsub(/^3~\s+/,"#{Mx[:lv_o]}3:#{Mx[:lv_c]}"). + gsub(/^4~(\S+)/,"#{Mx[:lv_o]}4:\\1#{Mx[:lv_c]}"). + gsub(/^4~\s+/,"#{Mx[:lv_o]}4:#{Mx[:lv_c]}"). + gsub(/^5~(\S+)/,"#{Mx[:lv_o]}5:\\1#{Mx[:lv_c]}"). + gsub(/^5~\s+/,"#{Mx[:lv_o]}5:#{Mx[:lv_c]}"). + gsub(/^6~(\S+)/,"#{Mx[:lv_o]}6:\\1#{Mx[:lv_c]}"). + gsub(/^6~\s+/,"#{Mx[:lv_o]}6:#{Mx[:lv_c]}"). + gsub(/^[789]~/,'!_') @t_o else @t_o end @@ -651,12 +646,14 @@ module SiSU_document_structure_extract parent=node1=node2=node3=node4=node5=node6=nil data.each do |dob| h={} - if (dob.obj !~ regex_exclude_ocn_and_node || dob.is =='code') \ - and dob.of !~/(?:comment|layout|meta)/ \ - and dob.obj !~/#{Mx[:pa_non_object_no_heading]}|#{Mx[:pa_non_object_dummy_heading]}/ \ - and dob.ocn_ + if (dob.obj !~ regex_exclude_ocn_and_node || dob.is ==:code) \ + && (dob.of !=:comment \ + && dob.of !=:layout \ + && dob.of !=:meta) \ + && dob.obj !~/#{Mx[:pa_non_object_no_heading]}|#{Mx[:pa_non_object_dummy_heading]}/ \ + && dob.ocn_ #dob.ln now is determined, and set earlier, check how best to remove this --> - if dob.is=='heading' + if dob.is==:heading ln=case dob.lv when 'A'; 1 when 'B'; 2 @@ -672,7 +669,7 @@ module SiSU_document_structure_extract if not dob.obj =~/<:#>|~#|-#/ \ or not dob.toc_ # fix this no longer in dob.obj ocn+=1 - if dob.is=='heading' \ + if dob.is==:heading \ and (ln.to_s =~/^[1-9]/ \ or ln.to_s =~@md.lv1 \ or ln.to_s =~@md.lv2 \ @@ -708,56 +705,67 @@ module SiSU_document_structure_extract end else ocno+=1 - if dob.is=='table' + if dob.is==:table ocnt+=1 ocn_sp,parent="t#{ocnt}",node - elsif dob.is=='code' + elsif dob.is==:code ocnc+=1 ocn_sp,parent="c#{ocnc}",node - elsif dob.is=~/^(?:group|block|alt|verse)/ + elsif dob.is==:group \ + || dob.is==:block \ + || dob.is==:alt \ + || dob.is==:verse ocng+=1 #group, poem ocn_sp,parent="g#{ocng}",node - elsif dob.is=~/image|#{Mx[:lnk_o]}\S+?\.(?:png|jpg|gif)\s+/m + elsif dob.is==:image #check ocni+=1 ocn_sp,parent="i#{ocni}",node else ocnp+=1 #paragraph ocn_sp,parent="p#{ocnp}",node end end - if dob.is=='heading' + if dob.is==:heading dob.ln,dob.node,dob.ocn,dob.odv,dob.osp,dob.parent=ln,node,ocn,ocn_dv,ocn_sp,parent else - unless dob.of=~/meta|comment|layout/ + if dob.of !=:meta \ + && dob.of !=:comment \ + && dob.of !=:layout dob.ocn,dob.odv,dob.osp,dob.parent=ocn,ocn_dv,ocn_sp,parent end end else ocnu+=1 - dob.obj.gsub!(/#{Mx[:fa_o]}~##{Mx[:fa_c]}/,'') if dob.obj + dob.obj=dob.obj.gsub(/#{Mx[:fa_o]}~##{Mx[:fa_c]}/,'') if dob.obj ocn_dv,ocn_sp="u#{ocnu}","u#{ocnu}" dob.ocn,dob.odv,dob.osp=ocn,ocn_dv,ocn_sp end h elsif dob.obj=~/#{Mx[:pa_non_object_no_heading]}/ - dob.obj.gsub!(/#{Mx[:pa_non_object_no_heading]}/,'') - if dob.is=='para' + dob.obj=dob.obj.gsub(/#{Mx[:pa_non_object_no_heading]}/,'') + if dob.is==:para h={ obj: dob.obj, ocn_: false, ocn: nil } - dob=SiSU_document_structure::Object_para.new.paragraph(h,dob) - elsif dob.is=='heading' + dob=SiSU_DAL_DocumentStructure::ObjectPara.new.paragraph(h,dob) + elsif dob.is==:heading h={ obj: dob.obj, ocn_: false, ocn: nil, toc_: true } - dob=SiSU_document_structure::Object_heading.new.heading(h,dob) + dob=SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h,dob) end elsif dob.obj=~/#{Mx[:pa_non_object_dummy_heading]}/ - dob.obj.gsub!(/#{Mx[:pa_non_object_dummy_heading]}/,'') - if dob.is=='para' + dob.obj=dob.obj.gsub(/#{Mx[:pa_non_object_dummy_heading]}/,'') + if dob.is==:para h={ obj: dob.obj, ocn_: false, ocn: nil } - dob=SiSU_document_structure::Object_para.new.paragraph(h,dob) - elsif dob.is=='heading' + dob=SiSU_DAL_DocumentStructure::ObjectPara.new.paragraph(h,dob) + elsif dob.is==:heading h={ obj: dob.obj, ocn_: false, ocn: nil, toc_: false } - dob=SiSU_document_structure::Object_heading.new.heading(h,dob) + dob=SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h,dob) end else dob end - dob.obj.gsub!(/\n\n/,"\n") if dob.is =~/(?:code|verse|alt|group|block)/ #newlines taken out + if dob.is==:code \ + || dob.is==:verse \ + || dob.is==:alt \ + || dob.is==:group \ + || dob.is==:block + dob.obj=dob.obj.gsub(/\n\n/,"\n") #newlines taken out + end @o_array << dob end @o_array @@ -791,7 +799,8 @@ module SiSU_document_structure_extract puts "<#{@s[0]}>" end data.each_with_index do |o,i| - if o.is =~/^heading/ + if o.is ==:heading \ + || o.is ==:heading_insert case o.ln when 1 tuned_file << tag_close(o.ln,hs) @@ -847,8 +856,7 @@ module SiSU_document_structure_extract end puts_tag_close(0,hs) if @md.opt.cmd =~/V/ tuned_file << tag_close(0,hs) - tuned_file.flatten! - tuned_file + tuned_file=tuned_file.flatten end def tags(o) tag=if o[:status]=='open' @@ -867,7 +875,7 @@ module SiSU_document_structure_extract when '6'; 9 end h={ tag: tag, node: o[:node], lv: o[:lv], ln: ln, status: o[:status] } - SiSU_document_structure::Object_structure.new.xml_dom(h) #downstream code utilise else ignore like comments + SiSU_DAL_DocumentStructure::ObjectStructure.new.xml_dom(h) #downstream code utilise else ignore like comments end def tag_open(o,tag) t={ lv: tag[o.ln], node: o.node, status: 'open' } diff --git a/lib/sisu/v3/dal_endnotes.rb b/lib/sisu/v3/dal_endnotes.rb index 53b6e8d3..191260c4 100644 --- a/lib/sisu/v3/dal_endnotes.rb +++ b/lib/sisu/v3/dal_endnotes.rb @@ -56,7 +56,7 @@ ** Description: system environment, resource control and configuration details =end -module SiSU_endnotes +module SiSU_DAL_Endnotes class Endnotes def initialize(md,data,endnote_array=nil) @md,@data,@endnote_array=md,data,endnote_array @@ -69,17 +69,17 @@ module SiSU_endnotes data.each do |dob| # manually numbered endnotes --> if @md.opt.mod.inspect =~/--no-asterisk|--no-annotate/ - dob.obj.gsub!(/#{Mx[:en_b_o]}\s.+?#{Mx[:en_b_c]}/,'') + dob.obj=dob.obj.gsub(/#{Mx[:en_b_o]}\s.+?#{Mx[:en_b_c]}/,'') end if @md.opt.mod.inspect =~/--no-dagger|--no-annotate/ - dob.obj.gsub!(/#{Mx[:en_b_o]}[+]\s.+?#{Mx[:en_b_c]}/,'') + dob.obj=dob.obj.gsub(/#{Mx[:en_b_o]}[+]\s.+?#{Mx[:en_b_c]}/,'') end - if defined? dob.obj \ - and defined? dob.is \ - and dob.is !~/^code/ + if (defined? dob.obj) \ + && (defined? dob.is) \ + && dob.is !=:code case dob.obj # auto-numbered endnotes --> when /#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}[*+]\s+.+?#{Mx[:en_b_c]}/ - dob.obj.gsub!(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/,' \1') # required 2003w31 + dob.obj=dob.obj.gsub(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/,' \1') # required 2003w31 word_mode=dob.obj.scan(/\S+/m) word_mode=endnote_call_number(word_mode) dob.obj=word_mode.join(' ') diff --git a/lib/sisu/v3/dal_expand_insertions.rb b/lib/sisu/v3/dal_expand_insertions.rb index e48acd47..ef25fcdd 100644 --- a/lib/sisu/v3/dal_expand_insertions.rb +++ b/lib/sisu/v3/dal_expand_insertions.rb @@ -56,13 +56,13 @@ ** Description: system environment, resource control and configuration details =end -module SiSU_insertions +module SiSU_DAL_Insertions class Insertions def initialize(md,data) @md,@data=md,data end def output_filetypes_in_cmd(cmd_shortcut,lnk=nil) #make list of file types in shortcut command (as configured), e.g. when sisu -3 is used - cf_defaults=SiSU_Env::Info_processing_flag.new + cf_defaults=SiSU_Env::InfoProcessingFlag.new cmd_list=case cmd_shortcut.inspect when /0/; cf_defaults.cf_0 when /1/; cf_defaults.cf_1 @@ -141,7 +141,7 @@ module SiSU_insertions def xml_dom "#{@base_path}/xml/#{@linked_doc}.xml" end - def txt + def txt "#{@base_path}/txt/#{@linked_doc}.txt" end def digest @@ -241,7 +241,7 @@ module SiSU_insertions def xml_dom "#{@base_path}/scroll.#{@lng}.dom.xml" end - def txt + def txt "#{@base_path}/plain.#{@lng}.txt" end def digest @@ -270,17 +270,17 @@ module SiSU_insertions and not codeblock_ \ and para =~/\{(?:~\^\s+)?(.+?)\s\[(?:\d(?:[sS]*))\]\}(?:\.\.\/\S+?\/|\S+?\.ss[tm]\b)/ txt,cmd,source,linked_doc,note,manifest=nil,nil,nil,nil,nil,nil - @u=SiSU_Env::Info_env.new.url + @u=SiSU_Env::InfoEnv.new.url pre=txt=cmd=source=linked_doc=note='' if defined? @u.remote if /(?

.+?)\{(?.+?)\s\[(?\d[sS]*)\]\}(?(?\S+?)\.ss[tm]\b)(?.*)/m =~ para
-              pre.strip!
+              pre=pre.strip
             elsif /\{(?.+?)\s\[(?\d[sS]*)\]\}(?(?\S+?)\.ss[tm]\b)(?.*)/m =~ para
             end
-            if linked_doc =~ /(\S+?)\/(\S+)/ 
+            if linked_doc =~ /(\S+?)\/(\S+)/
               linked_doc,linked_doc_lang=$1,$2
             else
-              linked_doc,linked_doc_lang=linked_doc,@md.opt.lng_base 
+              linked_doc,linked_doc_lang=linked_doc,@md.opt.lng_base
             end
           else
             puts "error, does currently support relative paths (reltive paths were removed, as had problems for citation, and was not suited to all output types should possibly reconsider) #{__FILE__} #{__LINE__}"
@@ -289,7 +289,7 @@ module SiSU_insertions
           end
           lnk={}
           case @md.opt.dir_structure_by
-          when /language/
+          when :language
             lnk={
               manifest:         by_language(linked_doc,linked_doc_lang).manifest,
               html_toc:         by_language(linked_doc,linked_doc_lang).html_toc,
@@ -307,7 +307,7 @@ module SiSU_insertions
               sisupod:          by_language(linked_doc,linked_doc_lang,source).sisupod,
               source:           by_language(linked_doc,linked_doc_lang,source).source,
             }
-          when /filetype/
+          when :filetype
             lnk={
               manifest:         by_filetype(linked_doc,linked_doc_lang).manifest,
               html_toc:         by_filetype(linked_doc,linked_doc_lang).html_toc,
diff --git a/lib/sisu/v3/dal_hash_digest.rb b/lib/sisu/v3/dal_hash_digest.rb
index 2c983919..ad201752 100644
--- a/lib/sisu/v3/dal_hash_digest.rb
+++ b/lib/sisu/v3/dal_hash_digest.rb
@@ -56,29 +56,30 @@
  ** Description: system environment, resource control and configuration details
 
 =end
-module SiSU_hash
+module SiSU_DAL_Hash
   require_relative 'shared_markup_alt.rb'               #shared_markup_alt.rb
-  class Object_digest
+  class ObjectDigest
     def initialize(md,data,env=nil)
       @md,@data,@env=md,data,env
-      @env ||=SiSU_Env::Info_env.new(@md.fns)
+      @env ||=SiSU_Env::InfoEnv.new(@md.fns)
     end
     def object_digest
     # 1. clean/stripped text without any markup, paragraph, headings etc. without endnotes
     # 2. endnotes clean/stripped text digest only (there may be several endnotes within a paragraph)
     # 3. whole object, text with markup and any endnotes, (question: with or without the endnote digests??? presumption better without, [however may be easier to check with?])
     # [digests should not include other digests]
-      data=@data
+      data=@data.compact
       @tuned_file=[]
-      data.compact!
       sha_ =(@env.digest.type=='sha256' ? true : false)
       sha_ ? (require 'digest/sha2') : (require 'digest/md5')
       data.each do |t_o|
         unless t_o.obj.class==Array
-          t_o.obj.strip!
+          t_o.obj=t_o.obj.strip
         end
-        if t_o.of !~/structure|comment|layout/ \
-        and t_o.ocn.class==Fixnum
+        if (t_o.of !=:structure \
+        && t_o.of !=:comment \
+        && t_o.of !=:layout) \
+        && t_o.ocn.class==Fixnum
           if sha_
             for hash_class in [ Digest::SHA256 ]
               @tuned_file << stamped(t_o,hash_class)
@@ -101,7 +102,7 @@ module SiSU_hash
         when /#{Mx[:en_a_o]}|#{Mx[:en_b_o]}/
           if en_plus =~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/
             t_o_txt,en_open,en_txt,en_close=/(.*?)(#{Mx[:en_a_o]}|#{Mx[:en_b_o]})(.+?)(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m.match(en_plus)[1..4]
-            stripped_en=SiSU_text_representation::Alter.new(en_txt).strip_clean_of_markup
+            stripped_en=SiSU_TextRepresentation::Alter.new(en_txt).strip_clean_of_markup
             digest_en_strip=if @env.digest.type =~/sha256/
               Digest::SHA256.hexdigest(stripped_en)
             else
@@ -116,16 +117,16 @@ module SiSU_hash
       t_o_bit.join
     end
     def stamped(t_o,hash_class) #decide what hash information is most useful, is compromise necessary?
-      t_o.obj=SiSU_text_representation::Alter.new(t_o).strip_clean_of_extra_spaces
+      t_o.obj=SiSU_TextRepresentation::Alter.new(t_o).strip_clean_of_extra_spaces
       t_obj=t_o.inspect.sub(/:0x[0-9a-f]{8}\s/,': ')
-      stripped=SiSU_text_representation::Alter.new(t_o).strip_clean_of_markup
-      markup=SiSU_text_representation::Alter.new(t_o).semi_revert_markup
-      digests=SiSU_text_representation::Modified_text_plus_Hash_digest.new(@md,t_o).composite.dgst
-      unless t_o.is=='code'
+      stripped=SiSU_TextRepresentation::Alter.new(t_o).strip_clean_of_markup
+      markup=SiSU_TextRepresentation::Alter.new(t_o).semi_revert_markup
+      digests=SiSU_TextRepresentation::ModifiedTextPlusHashDigest.new(@md,t_o).composite.dgst
+      unless t_o.is==:code
         case t_o.obj
         when /#{Mx[:en_a_o]}[\d*+]+\s+.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}[*+]\d+\s+.+?#{Mx[:en_b_c]}/m
           en_and_t_o,en_and_t_o_digest=[],[]
-          t_o.obj.gsub!(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m,' \1') #watch
+          t_o.obj=t_o.obj.gsub(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m,' \1') #watch
           t_o_plus_en=t_o.obj.scan(/.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/m)
           t_o_tail=if t_o.obj =~/(?:.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})+([\s\S]+)/m
             /(?:.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})+.*/m.match(t_o.obj)[1]
@@ -144,11 +145,11 @@ module SiSU_hash
     def strip_clean_extra_spaces(s)                                            # dal output tuned
       s=s.dup
       s=s.gsub(/[ ]+([,.;:?](?:$|\s))/,'\1') unless s =~/#{Mx[:en_a_o]}|#{Mx[:en_b_o]}/
-      s=s.gsub(/ [ ]+/,' ')
-      s=s.gsub(/^ [ ]+/,'')
-      s=s.gsub(/ [ ]+$/,'')
-      s=s.gsub(/((?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})')[ ]+(s )/,'\1\2')
-      s=s.gsub(/((?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})')[ ]+(s )/,'\1\2')
+      s=s.gsub(/ [ ]+/,' ').
+        gsub(/^ [ ]+/,'').
+        gsub(/ [ ]+$/,'').
+        gsub(/((?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})')[ ]+(s )/,'\1\2').
+        gsub(/((?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})')[ ]+(s )/,'\1\2')
     end
   end
 end
diff --git a/lib/sisu/v3/dal_idx.rb b/lib/sisu/v3/dal_idx.rb
index 5845437e..21567c14 100644
--- a/lib/sisu/v3/dal_idx.rb
+++ b/lib/sisu/v3/dal_idx.rb
@@ -56,14 +56,14 @@
  ** Description: system environment, resource control and configuration details
 
 =end
-module SiSU_book_index
-  class Book_index
+module SiSU_DAL_BookIndex
+  class BookIndex
     def initialize(md,data,env=nil)
       @md,@data,@env=md,data,env
       @rgx_idx=/#{Mx[:idx_o]}(?:.+?)#{Mx[:idx_c]}\s*/
       @rgx_idx_ocn_seg=/(.+?)~(\d+)~(\S+)/
       @rgx_idx_ocn=/(.+?)~(\d+)/
-      @env ||=SiSU_Env::Info_env.new(@md.fns)
+      @env ||=SiSU_Env::InfoEnv.new(@md.fns)
     end
     def indexing_song
       data=@data
@@ -75,8 +75,9 @@ module SiSU_book_index
       tuned_file=[]
       idx_array=[]
       data.each do |dob|
-        if dob.is =~/heading/ \
-        and dob.ln==4
+        if (dob.is ==:heading \
+        || dob.is ==:heading_insert) \
+        && dob.ln==4
           @seg=dob.name
         end
         idx_array << "#{dob.idx}~#{dob.ocn}~#{@seg}" if defined? dob.idx and not (dob.idx.nil? or dob.idx.empty?)
@@ -101,21 +102,20 @@ module SiSU_book_index
           g=idx_list.scan(/[^;]+/)
           idxl=[]
           g.each do |i|
-            i.strip!
+            i=i.strip
             idxl << { rough_idx: i, ocn: ocn, seg: seg }
           end
           idxl
         else { rough_idx: idx_list, ocn: ocn, seg: seg }
         end
       end
-      idx_lst.flatten!
-      idx_lst
+      idx_lst=idx_lst.flatten
     end
     def construct_book_index(idx_array)
       the_idx={}
       idx_array.each do |idx|
         idx_lst=idx[:rough_idx].scan(/[^|:]+/)
-        idx_lst[0].strip!
+        idx_lst[0]=idx_lst[0].strip
         if idx_lst[0] =~/.+?\+\d+/
           use,plus=/(.+?)\+(\d+)/.match(idx_lst[0])[1,2]
         else use=idx_lst[0]
@@ -123,7 +123,7 @@ module SiSU_book_index
         use=use[0].chr.capitalize + use[1,use.length]
         the_idx[use]={} unless the_idx[use] and defined? the_idx[use]
         idx_lst.each do |i|
-          i.strip!
+          i=i.strip
           i,r=/(.+?)\+(\d+)/.match(i)[1,2] if i =~/.+?\+\d+/
           x=if idx_lst.length==1 or idx_lst[0].gsub(/\+\d+/,'')==i
             the_idx[use]['term_node_lev1']=[] unless the_idx[use]['term_node_lev1'] and defined? the_idx[use]['term_node_lev1']
@@ -151,12 +151,12 @@ module SiSU_book_index
       the_idx
     end
     def clean_xml(str)
-      str.gsub!(/&/,'&')
-      str.gsub!(/\(/,'(')
-      str.gsub!(/\)/,')')
-      str.gsub!(/\*/,'*')
-      str.gsub!(/\+/,'+')
-      str.gsub!(/,/,',')
+      str=str.gsub(/&/,'&').
+        gsub(/\(/,'(').
+        gsub(/\)/,')').
+        gsub(/\*/,'*').
+        gsub(/\+/,'+').
+        gsub(/,/,',')
       str
     end
     def index(the_idx)
@@ -164,15 +164,15 @@ module SiSU_book_index
       idx={}
       idx[:sst_rel_html_seg],idx[:sst_rel],idx[:html],idx[:xhtml]=[],[],[],[]
       h={obj: Mx[:br_page]}
-      o=SiSU_document_structure::Object_layout.new.break(h)
+      o=SiSU_DAL_DocumentStructure::ObjectLayout.new.break(h)
       idx[:sst_rel_html_seg] << o
       idx[:sst_rel] << o
       h={lv: '2', name: 'index', obj: "Index"}
-      o=SiSU_document_structure::Object_heading.new.heading(h)
+      o=SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h)
       idx[:sst_rel_html_seg] << o
       idx[:sst_rel] << o
       h={lv: '4', name: 'idx', obj: " [Index] #{Mx[:pa_non_object_dummy_heading]}"}
-      o=SiSU_document_structure::Object_heading.new.heading(h)
+      o=SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h)
       idx[:sst_rel_html_seg] << o
       idx[:sst_rel] << o
       alph=%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]
@@ -347,7 +347,7 @@ module SiSU_book_index
     def clean_index(data)                                  #check on use of dob
       tuned_file=[]
       data.each do |para|
-        para.gsub!(/\n*#{@rgx_idx}/m,'')
+        para=para.gsub(/\n*#{@rgx_idx}/m,'')
         tuned_file << para
       end
       tuned_file
diff --git a/lib/sisu/v3/dal_images.rb b/lib/sisu/v3/dal_images.rb
index 34157f74..6455daf1 100644
--- a/lib/sisu/v3/dal_images.rb
+++ b/lib/sisu/v3/dal_images.rb
@@ -56,7 +56,7 @@
  ** Description: system environment, resource control and configuration details
 
 =end
-module SiSU_images
+module SiSU_DAL_Images
   class Images
     #require 'RMagick'
     #include Magick
@@ -67,7 +67,7 @@ module SiSU_images
       data=@data
       tuned_file=[]
       @rmgk=false
-      imagemagick_=true      #imagemagick_=SiSU_Env::Info_settings.new.program?('rmagick')
+      imagemagick_=true      #imagemagick_=SiSU_Env::InfoSettings.new.program?('rmagick')
       if imagemagick_
         begin
           @rmgk=SiSU_Env::Load.new('RMagick').prog
@@ -80,8 +80,8 @@ module SiSU_images
         end
       end
       data.each do |dob|
-        unless dob.is =~/^table/
-          dob.obj.strip!
+        unless dob.is ==:table
+          dob.obj=dob.obj.strip
           if dob.obj =~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif)(?:\s*|\s+.+)?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/
             if dob.obj !~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif)\s+\d+x\d+/
               m=/#{Mx[:lnk_o]}\s*(\S+\.(?:png|jpg|gif))/
@@ -89,7 +89,7 @@ module SiSU_images
                 imgs=dob.obj.scan(m).flatten
                 img_col=img_row=nil
                 images=imgs.each do |image|
-                  dir=SiSU_Env::Info_env.new(@md.fns)
+                  dir=SiSU_Env::InfoEnv.new(@md.fns)
                   path_image=[dir.path.image_source_include_local,dir.path.image_source_include_remote,dir.path.image_source_include]
                   image_path=nil
                   path_image.each do |img_pth|
@@ -104,8 +104,8 @@ module SiSU_images
                       if @md.opt.cmd =~/[vVM]/
                         SiSU_Screen::Ansi.new(@md.opt.cmd,'RMagick not present, will attempt to use imagemagick (identify) directly').warn
                       end
-                      imgk=SiSU_Env::System_call.new.imagemagick
-                      gmgk=SiSU_Env::System_call.new.graphicksmagick
+                      imgk=SiSU_Env::SystemCall.new.imagemagick
+                      gmgk=SiSU_Env::SystemCall.new.graphicksmagick
                       if imgk or gmgk
                         if imgk
                           imgsys=`identify #{image_path}/#{image}`.strip                           #system call
@@ -133,8 +133,8 @@ module SiSU_images
                         img_col=((1.00*img_row/row)*col).round
                       end
                     end
-                    dob.obj.gsub!(/(#{image})/,"#{image} #{img_col}x#{img_row}")
-                  else dob.obj.gsub!(/#{Mx[:lnk_o]}\s*(\S+)\.(png|jpg|gif).+?#{Mx[:lnk_c]}(#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/,'[ \1 (\2 missing) ]')
+                    dob.obj=dob.obj.gsub(/(#{image})/,"#{image} #{img_col}x#{img_row}")
+                  else dob.obj=dob.obj.gsub(/#{Mx[:lnk_o]}\s*(\S+)\.(png|jpg|gif).+?#{Mx[:lnk_c]}(#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/,'[ \1 (\2 missing) ]')
                   end
                 end
               else
@@ -144,7 +144,9 @@ module SiSU_images
               end
             end
           end
-          dob.obj.gsub!(/(#{Mx[:lnk_o]})\s*(\S+\.(?:png|jpg|gif))\s+/i,'\1\2 ') if dob.obj =~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/
+          if dob.obj =~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/
+            dob.obj=dob.obj.gsub(/(#{Mx[:lnk_o]})\s*(\S+\.(?:png|jpg|gif))\s+/i,'\1\2 ')
+          end
         end
         tuned_file << dob unless dob.nil?
       end
diff --git a/lib/sisu/v3/dal_metadata.rb b/lib/sisu/v3/dal_metadata.rb
index 8647a075..f7dc9579 100644
--- a/lib/sisu/v3/dal_metadata.rb
+++ b/lib/sisu/v3/dal_metadata.rb
@@ -56,21 +56,21 @@
  ** Description: system environment, resource control and configuration details
 
 =end
-module SiSU_metadata
+module SiSU_DAL_Metadata
   class Metadata
     def initialize(md,metad)
       @md,@metadata=md,metad
-      l=SiSU_Env::Standardise_language.new(@md.opt.lng).language
+      l=SiSU_Env::StandardiseLanguage.new(@md.opt.lng).language
       language=l[:n]
       @tr=SiSU_Translate::Source.new(md,language)
     end
     def make_para(obj,ocn)
       h={ obj: obj, ocn: 0 }
-      SiSU_document_structure::Object_para.new.paragraph(h)
+      SiSU_DAL_DocumentStructure::ObjectPara.new.paragraph(h)
     end
     def make_heading(obj,ocn,name,lv,ln)
       h={ lv: lv, ln: ln, name: name, obj: obj, ocn: 0 }
-      SiSU_document_structure::Object_heading.new.heading(h)
+      SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h)
     end
     def metadata
     end
diff --git a/lib/sisu/v3/dal_numbering.rb b/lib/sisu/v3/dal_numbering.rb
index 4b12793f..f5a09ef6 100644
--- a/lib/sisu/v3/dal_numbering.rb
+++ b/lib/sisu/v3/dal_numbering.rb
@@ -56,7 +56,7 @@
  ** Description: system environment, resource control and configuration details
 
 =end
-module SiSU_numbering
+module SiSU_DAL_Numbering
   class Numbering
     attr_accessor :obj,:osp,:ocn,:lv,:name,:index,:comment
     def initialize(md,data)
@@ -77,12 +77,15 @@ module SiSU_numbering
     def number_plaintext_para(data)
       @tuned_file=[]
       data.each do |dob|
-        if dob.of !~/(?:block|comment|layout)/ and dob.ocn_ #and dob.obj !~ /#{Mx[:gr_o]}Th|#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}/ #FIX
-          dob.obj.gsub!(/(.+)\n/,'\1 ') #messy, but idea is that tables should retain breaks
+        if (dob.of !=:block \
+        && dob.of !=:comment \
+        && dob.of !=:layout) \
+        && dob.ocn_ #and dob.obj !~ /#{Mx[:gr_o]}Th|#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}/ #FIX
+          dob.obj=dob.obj.gsub(/(.+)\n/,'\1 ') #messy, but idea is that tables should retain breaks
         end
         unless dob.obj.class==Array
-          dob.obj.gsub!(/^\s+/,'')
-          dob.obj.gsub!(/\s$/,"\n")
+          dob.obj=dob.obj.gsub(/^\s+/,'').
+            gsub(/\s$/,"\n")
         end
         @tuned_file << dob
       end
@@ -90,37 +93,35 @@ module SiSU_numbering
     end
     def number_sub_heading(dob,num,title_no)
       unless dob.obj =~/\d+\.|(?:chapter|article|section|clause)\s+\d+/i #name selection arbitrary, fix
-        case dob.name
-        when /-/;  dob.obj.gsub!(/^/,"#{title_no} ")
-        when /^#/; dob.obj.gsub!(/^/,"#{title_no} ")
-        when /^[a-z_\.]+/
-          dob.obj.gsub!(/^/,"#{title_no} ")
+        dob.obj=case dob.name
+        when /-/;  dob.obj.gsub(/^/,"#{title_no} ")
+        when /^#/; dob.obj.gsub(/^/,"#{title_no} ")
+        when /^[a-z_\.]+/; dob.obj.gsub(/^/,"#{title_no} ")
         else
           dob.name=title_no if dob.name=~/^$/ #where title contains title number
-          dob.obj.gsub!(/^/,"#{title_no} ") if title_no =~/\d+/ #main, where title number is to be provided #watch changed placement
+          dob.obj.gsub(/^/,"#{title_no} ") if title_no =~/\d+/ #main, where title number is to be provided #watch changed placement
         end
         if @md.toc_lev_limit \
         and @md.toc_lev_limit < num
-          dob.obj.gsub!(/^/,'!_ ') #bold line, watch
+          dob.obj=dob.obj.gsub(/^/,'!_ ') #bold line, watch
         end
       end
       dob
     end
     def heading_tag_clean(heading_tag)
-      heading_tag.gsub!(/[ ]+/,'_')
-      heading_tag.gsub!(/["']/,'')
-      heading_tag.gsub!(/[\/]/,'-')
-      heading_tag.gsub!(/#{Mx[:fa_bold_o]}|#{Mx[:fa_bold_c]}/,'')
-      heading_tag.gsub!(/#{Mx[:fa_italics_o]}|#{Mx[:fa_italics_c]}/,'')
-      heading_tag.gsub!(/#{Mx[:fa_underscore_o]}|#{Mx[:fa_underscore_c]}/,'')
-      heading_tag.gsub!(/#{Mx[:fa_cite_o]}|#{Mx[:fa_cite_c]}/,'')
-      heading_tag.gsub!(/#{Mx[:fa_insert_o]}|#{Mx[:fa_insert_c]}/,'')
-      heading_tag.gsub!(/#{Mx[:fa_strike_o]}|#{Mx[:fa_strike_c]}/,'')
-      heading_tag.gsub!(/#{Mx[:fa_superscript_o]}|#{Mx[:fa_superscript_c]}/,'')
-      heading_tag.gsub!(/#{Mx[:fa_subscript_o]}|#{Mx[:fa_subscript_c]}/,'')
-      heading_tag.gsub!(/#{Mx[:fa_hilite_o]}|#{Mx[:fa_hilite_c]}/,'')
-      heading_tag.gsub!(/#{Mx[:gl_bullet]}/,'')
-      heading_tag
+      heading_tag=heading_tag.gsub(/[ ]+/,'_').
+        gsub(/["']/,'').
+        gsub(/[\/]/,'-').
+        gsub(/#{Mx[:fa_bold_o]}|#{Mx[:fa_bold_c]}/,'').
+        gsub(/#{Mx[:fa_italics_o]}|#{Mx[:fa_italics_c]}/,'').
+        gsub(/#{Mx[:fa_underscore_o]}|#{Mx[:fa_underscore_c]}/,'').
+        gsub(/#{Mx[:fa_cite_o]}|#{Mx[:fa_cite_c]}/,'').
+        gsub(/#{Mx[:fa_insert_o]}|#{Mx[:fa_insert_c]}/,'').
+        gsub(/#{Mx[:fa_strike_o]}|#{Mx[:fa_strike_c]}/,'').
+        gsub(/#{Mx[:fa_superscript_o]}|#{Mx[:fa_superscript_c]}/,'').
+        gsub(/#{Mx[:fa_subscript_o]}|#{Mx[:fa_subscript_c]}/,'').
+        gsub(/#{Mx[:fa_hilite_o]}|#{Mx[:fa_hilite_c]}/,'').
+        gsub(/#{Mx[:gl_bullet]}/,'')
     end
     def auto_number_heading_ie_title(data)                                             #also does some segment naming
       @tuned_file=[]
@@ -135,20 +136,20 @@ module SiSU_numbering
         no1=num_top; no2=(num_top + 1); no3=(num_top + 2);  no4=(num_top + 3)
       end
       t_not=0
-      data.compact!
       chapter_number_counter=0
+      data=data.compact
       data.each do |dob| #@md.seg_names << [additions to segment names]
         title_no=nil
-        dob=SiSU_document_structure_extract::Structure.new(@md,dob).structure_markup #must happen earlier, node info etc. require
-        if dob.is =='heading' \
-        and dob.autonum_ \
+        dob=SiSU_DAL_DocumentStructureExtract::Structure.new(@md,dob).structure_markup #must happen earlier, node info etc. require
+        if dob.is ==:heading \
+        && dob.autonum_ \
         and defined? @md.make.num_top \
         and @md.make.num_top !~/^$/
           if  dob.lv=='1' \
           and dob.obj =~/^#\s|\s#(?:\s|$)/
             chapter_number_counter +=1
-            dob.obj.gsub!(/^#\s/,"#{chapter_number_counter} ")
-            dob.obj.gsub!(/#([:,]?\s|[.]?$)/,"#{chapter_number_counter}\\1")
+            dob.obj=dob.obj.gsub(/^#\s/,"#{chapter_number_counter} ").
+              gsub(/#([:,]?\s|[.]?$)/,"#{chapter_number_counter}\\1")
           end
           if dob.ln==no1
             @subnumber=1
@@ -168,15 +169,15 @@ module SiSU_numbering
                   tag=dob.obj.gsub(/(Article|Clause|Section|Chapter)\s+/,"\\1_#{title_no}").downcase
                   tag=heading_tag_clean(tag)
                   dob.tags=[tag,dob.tags].flatten if tag !~/^\d+$/ #check whether will work across file types with stop signs
-                  (dob.obj =~/(Article|Clause|Section)\s+/) \
-                  ? (dob.obj.gsub!(/(Article|Clause|Section)\s+/,"\\1 #{title_no} "))
-                  : (dob.obj.gsub!(/^/,"#{title_no}. ")) #fix stop later
+                  dob.obj=(dob.obj =~/(Article|Clause|Section)\s+/) \
+                  ? (dob.obj.gsub(/(Article|Clause|Section)\s+/,"\\1 #{title_no} "))
+                  : (dob.obj.gsub(/^/,"#{title_no}. ")) #fix stop later
                 end
                 if dob.ln !=no1 \
                 and dob.obj =~/^[\d.]+\s/ #fix -> if the title starts with a numbering scheme, do not auto-number, review
                   dob.name ="#{title_no}" if not dob.name
                   dob.tags=[title_no,dob.tags].flatten if title_no !~/^\d+$/ #check whether will work across file types with stop signs
-                  dob.obj.gsub!(/^/,"#{title_no}. ")
+                  dob.obj=dob.obj.gsub(/^/,"#{title_no}. ")
                 end
                 @md.seg_names << title_no
               end
@@ -184,7 +185,7 @@ module SiSU_numbering
               and dob.name!~/^[a-z_\.]+$/ \
               and dob.obj !~/[A-Z]\.?\s/ #bug -> tmp fix, excludes A. B. C. lettering, but not roman numerals, is arbitrary, review required # not fixed, work on
                 dob.tags=[title_no,dob.tags].flatten if title_no !~/^\d+$/ #check whether will work across file types with stop signs
-                dob.obj.gsub!(/^/i,"#{title_no}. ")
+                dob.obj=dob.obj.gsub(/^/i,"#{title_no}. ")
               end
             end
             if dob.ln==no1         #watch because here you change dob.name
@@ -207,7 +208,7 @@ module SiSU_numbering
             dob.tags=[dob.name,dob.tags].flatten if dob.name !~/^\d+$/  #check whether will work across file types with stop signs
             dob.name.gsub(/^([a-z_\.]+)-$/,'\1')
           end
-        elsif dob.is =='heading' \
+        elsif dob.is ==:heading \
         and dob.autonum_ \
         and @md.markup =~/num_extract/ #AS DANGEROUS force enable with document, note already does this type of numbering for cisg, locate and coordinate logic, is currently misplaced in code, chengwei inspired 2004w23/4
           #here lies a bug, as is nil when run from -Dv --update, FIX
@@ -229,11 +230,11 @@ module SiSU_numbering
       @tuned_file=@tuned_file.flatten
     end
     def ocn(data)                                                                      #and auto segment numbering increment
-      @tuned_file=SiSU_document_structure_extract::OCN.new(@md,data).ocn
+      @tuned_file=SiSU_DAL_DocumentStructureExtract::OCN.new(@md,data).ocn
       @tuned_file
     end
     def xml(data)
-      @tuned_file=SiSU_document_structure_extract::XML.new(@md,data).dom
+      @tuned_file=SiSU_DAL_DocumentStructureExtract::XML.new(@md,data).dom
       @tuned_file
     end
     def minor_numbering(data)                                                          #and auto segment numbering increment
@@ -241,20 +242,23 @@ module SiSU_numbering
       number_small,letter_small=0,0
       letter=%w( a b c d e f g h i j k l m n o p q r s t u v w x y z )
       data.each do |dob|
-        if dob.of =~/heading|para|block/
-          if dob.is =='heading' \
+        if dob.of ==:heading \
+        || dob.of ==:heading_insert \
+        || dob.of ==:para \
+        || dob.of ==:block
+          if dob.is ==:heading \
           and dob.ln.to_s=~/^[1-9]/                                                    #% sub-number system, (baby numbering) reset with any change of major number (more obviously should be placed in number titles, but that is conditionally executed, check and move later)
             number_small,letter_small=0,0
-          elsif dob.is =~/para/
+          elsif dob.is ==:para
             if dob.obj =~/^#[ 1]/ \
             and dob.obj !~/^#\s+(?:~#)?$/
               letter_small=0
               number_small=0 if dob.obj =~ /^#1/
               number_small+=1
-              dob.obj.gsub!(/^#[ 1]/,"#{number_small}. ") #change 2004
+              dob.obj=dob.obj.gsub(/^#[ 1]/,"#{number_small}. ")
             end
             if dob.obj =~/^_# /
-              dob.obj.gsub!(/^_# /,"#{letter[letter_small]}. ") #change 2004
+              dob.obj=dob.obj.gsub(/^_# /,"#{letter[letter_small]}. ")
               dob.indent='1'
               letter_small+=1
             end
@@ -287,8 +291,8 @@ module SiSU_numbering
       end
       ocn_html_seg=[]
       data.each do |dob|
-        if dob.is=='heading' \
-        and dob.ln \
+        if dob.is==:heading \
+        && dob.ln \
         and dob.ln.to_s =~/^[456]/
           if dob.ln==4 \
           and not dob.name \
@@ -298,8 +302,8 @@ module SiSU_numbering
           if dob.name !~/^\S+/ \
           and dob.obj =~/^\s*(?:\S+\s+)?([\d.,:-]+)/m      #heading starts with a recognised numeric or word followed by a recognised numerical construct, use that as name
             possible_seg_name=$1
-            possible_seg_name.gsub!(/(?:[:,-]|\W)/,'.')
-            possible_seg_name.gsub!(/\.$/,'')
+            possible_seg_name=possible_seg_name.gsub(/(?:[:,-]|\W)/,'.').
+              gsub(/\.$/,'')
             if not @md.seg_names.nil? \
             and not @md.seg_names.include?(possible_seg_name)
               dob.name=possible_seg_name
@@ -334,18 +338,19 @@ module SiSU_numbering
             puts "e r r o r -\t#{__FILE__}::#{__LINE__}\n#{dob.inspect}"
           end
         end
-        if dob.is =~/heading/ \
-        and dob.ln==4
+        if (dob.is ==:heading \
+        || dob.is ==:heading_insert) \
+        && dob.ln==4
           @seg=dob.name
         end
-        @tuned_file << if dob.is=='heading' \
-        and (@md.pagenew or @md.pagebreak)
+        @tuned_file << if dob.is==:heading \
+        && (@md.pagenew || @md.pagebreak)
           m=dob.ln.to_s
           dob_tmp=[]
           if @md.pagenew.inspect =~/#{m}/
-            dob_tmp << SiSU_document_structure::Object_layout.new.break(Hx[:br_page_new]) << dob
+            dob_tmp << SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_new]) << dob
           elsif @md.pagebreak.inspect =~/#{m}/
-            dob_tmp << SiSU_document_structure::Object_layout.new.break(Hx[:br_page]) << dob
+            dob_tmp << SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page]) << dob
           end
           para_result=unless dob_tmp.length > 0; dob
           else                                   dob_tmp
@@ -354,11 +359,11 @@ module SiSU_numbering
         end
         if defined? dob.ocn \
         and dob.ocn
-          @segname=((dob.is=='heading'|| dob.is=='heading_insert') && dob.ln==4 && (defined? dob.name)) \
+          @segname=((dob.is==:heading || dob.is==:heading_insert) && dob.ln==4 && (defined? dob.name)) \
           ? (dob.name)
           : @segname
           tags["#{dob.ocn}"]={ segname: @segname }
-          ocn_html_seg[dob.ocn]=if dob.is =~/heading/
+          ocn_html_seg[dob.ocn]=if (dob.is==:heading || dob.is==:heading_insert)
             x=if dob.ln =~/[1-3]/
               { seg: nil, level: dob.ln }
             else #elsif dob.ln =~/[4-6]/
@@ -429,7 +434,7 @@ module SiSU_numbering
           unless @md.set_heading_seg
             if defined? dob.ln and dob.ln.to_s !~/^[123]/m \
             and dob.obj !~/\A\s*\Z/m \
-            and dob.is !='layout'
+            and dob.is !=:layout
               @md.set_heading_seg=true
               head=if @md.title.main ; dob.ln,dob.name,dob.obj=4,'seg',@md.title.main
               else                dob.ln,dob.name,dob.obj=4,'seg','[segment]'
diff --git a/lib/sisu/v3/dal_substitutions_and_insertions.rb b/lib/sisu/v3/dal_substitutions_and_insertions.rb
index 5844071f..2ae365be 100644
--- a/lib/sisu/v3/dal_substitutions_and_insertions.rb
+++ b/lib/sisu/v3/dal_substitutions_and_insertions.rb
@@ -56,22 +56,22 @@
  ** Description: system environment, resource control and configuration details
 
 =end
-module SiSU_substitute_and_insert
+module SiSU_DAL_SubstituteAndInsert
   class SI
     def initialize(md,data)
       @md,@data=md,data
-      @skin=SiSU_Env::Info_skin.new(@md)
+      @skin=SiSU_Env::InfoSkin.new(@md)
     end
     def substitutions_and_insertions?
       data=@data
       data_expand=[]
       if data[0] =~ /^#!\s*(?:\/usr\/bin\/env sisu|\/usr\/bin\/sisu)/ # remove bang from top #! (however file is stripped, so will be removed provided no content precedes it)
-        data[0].gsub!(/^#!\s*\/usr\/bin\/sisu/,'')
-        data[0].gsub!(/^#!\s*\/usr\/bin\/env sisu/,'')
+        data[0]=data[0].gsub(/^#!\s*\/usr\/bin\/sisu/,'').
+          gsub(/^#!\s*\/usr\/bin\/env sisu/,'')
       end
       if data[0] =~ /^(SiSU\s+[\d.]*|sisu-[\d.]+)$/ # SiSU identifier
-        data[0].gsub!(/^(SiSU\s*[\d.]*)$/,'% \1')
-        data[0].gsub!(/^(sisu-[\d.]+)$/,'% \1')
+        data[0]=data[0].gsub(/^(SiSU\s*[\d.]*)$/,'% \1').
+          gsub(/^(sisu-[\d.]+)$/,'% \1')
       end
       data.each do |para|
         if para =~/<:(insert\d+)!?>/ \
@@ -132,22 +132,24 @@ module SiSU_substitute_and_insert
           para.each {|x| data_expand << x }
         else data_expand << para
         end
-        data_expand.flatten!
-        data_expand.compact!
+        data_expand=data_expand.flatten.compact
       end
+      data_new=[]
       data_expand.each do |para|
         para=if @md.markup_version.determined >= 0.38
-          SiSU_document_structure_extract::Structure.new(@md,para).structure_markup_normalize
+          SiSU_DAL_DocumentStructureExtract::Structure.new(@md,para).structure_markup_normalize
         else
-          SiSU_document_structure_extract::Structure.new(@md,para).structure_marks
+          SiSU_DAL_DocumentStructureExtract::Structure.new(@md,para).structure_marks
         end
-        para.gsub!(/^(:?A~)\s*$/,'\1~ @title @author')                                    #conditional header
-        para.gsub!(/^((?:[1-9]|:?[A-C])~\S*)\s*$/,'\1~ [Note: heading marker::required title missing]~#')    #conditional header for incorporated document 2004w12
+        para=para.gsub(/^(:?A~)\s*$/,'\1~ @title @author').                                    #conditional header
+          gsub(/^((?:[1-9]|:?[A-C])~\S*)\s*$/,'\1~ [Note: heading marker::required title missing]~#')    #conditional header for incorporated document 2004w12
         if para =~/^@\S+?:/
-          para.gsub!(/^@(\S+?):(\s+|$)/,"#{Mx[:meta_o]}\\1#{Mx[:meta_c]}\\2")
-          para.gsub!(/^@(\S+?):([+-])(\s+|$)/,"#{Mx[:meta_o]}\\1\\2#{Mx[:meta_c]}\\3")
+          para=para.gsub(/^@(\S+?):(\s+|$)/,"#{Mx[:meta_o]}\\1#{Mx[:meta_c]}\\2").
+            gsub(/^@(\S+?):([+-])(\s+|$)/,"#{Mx[:meta_o]}\\1\\2#{Mx[:meta_c]}\\3")
         end
+        data_new << para
       end
+      data_new
     end
   end
 end
diff --git a/lib/sisu/v3/dal_syntax.rb b/lib/sisu/v3/dal_syntax.rb
index 2d2a8430..73bb6a64 100644
--- a/lib/sisu/v3/dal_syntax.rb
+++ b/lib/sisu/v3/dal_syntax.rb
@@ -56,7 +56,7 @@
  ** Description: Syntax for markup, input markup syntaxes, determined here
 
 =end
-module SiSU_Syntax
+module SiSU_DAL_Syntax
   class Words
     def initialize(line,md,mkp)
       @line,@md,@mkp=line,md,mkp
@@ -65,11 +65,11 @@ module SiSU_Syntax
   class Markup
     def initialize(md='',data='')
       @data,@md=data,md
-      @vz=SiSU_Env::Get_init.instance.skin
+      @vz=SiSU_Env::GetInit.instance.skin
       @data_new=[]
-      url_and_stub=SiSU_Env::Info_env.new.url
+      url_and_stub=SiSU_Env::InfoEnv.new.url
       @output_url="#{url_and_stub.remote}"
-      @env=SiSU_Env::Info_env.new
+      @env=SiSU_Env::InfoEnv.new
       emph_set=if defined? @md.make.emphasis \
       and not @md.make.emphasis.nil?
         @md.make.emphasis
@@ -120,7 +120,7 @@ module SiSU_Syntax
       end
     end
     def songsheet
-      @data.compact!
+      @data=@data.compact
       @data.each do |dob|
         dob=breaks(dob)
         dob=if @md.sem_tag then sem(dob) else dob end #revisit
@@ -132,12 +132,15 @@ module SiSU_Syntax
       @data_new
     end
     def sem(dob) #revisit
-      dob=SiSU_sem::Tags.new(dob,@md).rm.all
+      dob=SiSU_Sem::Tags.new(dob,@md).rm.all
     end
     def breaks(dob)
-      if dob.is !~/^(?:meta|comment|code|table)/
-        dob.obj.gsub!(/ \\\\(?: |$)/,"#{Mx[:br_line]}")
-        dob.obj.gsub!(/(?:<:?br>|
)/,"#{Mx[:br_line]}") # depreciated + if dob.is !=:meta \ + && dob.is !=:comment \ + && dob.is !=:code \ + && dob.is !=:table + dob.obj=dob.obj.gsub(/ \\\\(?: |$)/,"#{Mx[:br_line]}"). + gsub(/(?:<:?br>|
)/,"#{Mx[:br_line]}") # depreciated end dob end @@ -147,20 +150,23 @@ module SiSU_Syntax and @md.make.italics[:str]) \ or (defined? @vz.markup_make_italic[:str] \ and @vz.markup_make_italic[:str]) - dob.obj=if dob.is !~/^(?:meta|heading|code|comment)/ + dob.obj=if dob.is !=:meta \ + && dob.is !=:heading \ + && dob.is !=:heading_insert \ + && dob.is !=:code \ + && dob.is !=:comment word=dob.obj.scan(@line_scan_ital) - word.flatten! - word.compact! #reinstated + word=word.flatten.compact 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.gsub!(@md.make.italics[:regx], + w=w.gsub(@md.make.italics[:regx], "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}") elsif defined? @vz.markup_make_italic \ and @vz.markup_make_italic - w.gsub!(@vz.markup_make_italic, + w=w.gsub(@vz.markup_make_italic, "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}") else w end @@ -174,28 +180,28 @@ module SiSU_Syntax dob end def embolden(given) - given.gsub!(/^!_\s+((?:\{|#{Mx[:lnk_o]})(?:~^ )?.+?(?:\}|#{Mx[:lnk_o]})https?:\/\/\S+.*?)([#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/, - "#{Mx[:fa_bold_o]} \\1 #{Mx[:fa_bold_c]}\\2") - given.gsub!(/^!_\s+((?:\{|#{Mx[:lnk_o]})(?:~^ )?.+?(?:\}|#{Mx[:lnk_o]})https?:\/\/\S+.*)/, - "#{Mx[:fa_bold_o]} \\1 #{Mx[:fa_bold_c]}") - given.gsub!(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)([#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/, - "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2") - given.gsub!(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)\s+((?:[*]~\S+\s*)+)/, - "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2") - given.gsub!(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)\s*([~-]#)$/, - "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2") - given.gsub!(/(?:^!_\s+|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]}\s*)(.*)?\s*$/, - "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}") + given=given.gsub(/^!_\s+((?:\{|#{Mx[:lnk_o]})(?:~^ )?.+?(?:\}|#{Mx[:lnk_o]})https?:\/\/\S+.*?)([#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/, + "#{Mx[:fa_bold_o]} \\1 #{Mx[:fa_bold_c]}\\2"). + gsub(/^!_\s+((?:\{|#{Mx[:lnk_o]})(?:~^ )?.+?(?:\}|#{Mx[:lnk_o]})https?:\/\/\S+.*)/, + "#{Mx[:fa_bold_o]} \\1 #{Mx[:fa_bold_c]}"). + gsub(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)([#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/, + "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2"). + gsub(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)\s+((?:[*]~\S+\s*)+)/, + "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2"). + gsub(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)\s*([~-]#)$/, + "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2"). + gsub(/(?:^!_\s+|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]}\s*)(.*)?\s*$/, + "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}") end def italicise(given) - given.gsub!(/^\/_\s*(.+?)([#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/, - "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2") - given.gsub!(/^\/_\s*(.+?)\s+((?:[*]~\S+\s*)+)/, - "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2") - given.gsub!(/^\/_\s*(.+?)\s*([~-]#)$/, - "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2") - given.gsub!(/^\/_\s+(.*)?\s*$/, - "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}") + given=given.gsub(/^\/_\s*(.+?)([#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/, + "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2"). + gsub(/^\/_\s*(.+?)\s+((?:[*]~\S+\s*)+)/, + "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2"). + gsub(/^\/_\s*(.+?)\s*([~-]#)$/, + "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2"). + gsub(/^\/_\s+(.*)?\s*$/, + "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}") end def wordlist_bold(dob) dob=dob.dup @@ -203,22 +209,26 @@ module SiSU_Syntax and @md.make.bold[:str]) \ or (defined? @vz.markup_make_bold[:str] \ and @vz.markup_make_bold[:str]) - dob.obj=if dob.is !~/^(?:meta|heading|code|comment|table)/ + dob.obj=if dob.is !=:meta \ + && dob.is !=:heading \ + && dob.is !=:heading_insert \ + && dob.is !=:code \ + && dob.is !=:comment \ + && dob.is !=:table line_array=[] word=dob.obj.scan(@line_scan_bold) - word.flatten! - word.compact! + 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.gsub!(@md.make.bold[:regx],"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}") + w=w.gsub(@md.make.bold[: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 - w.gsub!(@vz.markup_make_bold,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}") + w=w.gsub(@vz.markup_make_bold,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}") end else - if w =~ /(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s+/; embolden(w) #bold paragraph/emphasize #may wish to remove think about 7{ 8{ conversion not satisfactory, as information is lost! + w=if w =~ /(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s+/; embolden(w) #bold paragraph/emphasize #may wish to remove think about 7{ 8{ conversion not satisfactory, as information is lost! elsif w =~/^\/_\s+/; italicise(w) else w end @@ -229,42 +239,46 @@ module SiSU_Syntax else dob.obj end else - if dob.is !~/^(?:heading|comment|meta)/ \ + dob.obj=if (dob.is !=:heading \ + && dob.is !=:heading_insert \ + && dob.is !=:comment \ + && dob.is !=:meta) \ and dob.obj =~ /^!_\s+/ embolden(dob.obj) - elsif dob.is=='heading' \ + elsif dob.is==:heading \ and dob.ln.to_s =~/[7-9]/ embolden(dob.obj) + else dob.obj end if dob.obj =~ /\/_\s+/ - italicise(dob.obj) + dob.obj=italicise(dob.obj) end end dob end def fontface(dob) - dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[\{]|\>)\*\{(.+?)\}\*/m, - "\\1#{@emph[:o]}\\2#{@emph[:c]}") #emphasis - dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[\{]|\>)!\{(.+?)\}!/m, - "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold - dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[\{]|\(|\>)\/\{(.+?)\}\//m, - "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}") #italics - dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[\{]|\>)_\{(.+?)\}_/m, - "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}") #underscore - dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[\{]|\>)#\{(.+?)\}#/m, - "\\1#{Mx[:fa_monospace_o]}\\2#{Mx[:fa_monospace_c]}") #monospace - dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\"\{(.+?)\}\"/m, - "\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}") #cite /blockquote? - dob.obj.gsub!(/(^|[^\\])\^\{(.+?)\}\^/m, - "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") #superscript - dob.obj.gsub!(/(^|[^\\]),\{(.+?)\},/m, - "\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}") #subscript - dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\+\{(.+?)\}\+/m, - "\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}") #inserted text - dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)-\{(.+?)\}-/m, - "\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}") #strikethrough - deleted text - dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>|\d+)\^(\S+?)\^/, - "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") #superscript single word, watch digit added + dob.obj=dob.obj.gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[\{]|\>)\*\{(.+?)\}\*/m, + "\\1#{@emph[:o]}\\2#{@emph[:c]}"). #emphasis + gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[\{]|\>)!\{(.+?)\}!/m, + "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}"). #bold + gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[\{]|\(|\>)\/\{(.+?)\}\//m, + "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}"). #italics + gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[\{]|\>)_\{(.+?)\}_/m, + "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}"). #underscore + gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[\{]|\>)#\{(.+?)\}#/m, + "\\1#{Mx[:fa_monospace_o]}\\2#{Mx[:fa_monospace_c]}"). #monospace + gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\"\{(.+?)\}\"/m, + "\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}"). #cite /blockquote? + gsub(/(^|[^\\])\^\{(.+?)\}\^/m, + "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}"). #superscript + gsub(/(^|[^\\]),\{(.+?)\},/m, + "\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}"). #subscript + gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\+\{(.+?)\}\+/m, + "\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}"). #inserted text + gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)-\{(.+?)\}-/m, + "\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}"). #strikethrough - deleted text + gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>|\d+)\^(\S+?)\^/, + "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") #superscript single word, watch digit added dob end def bodymarkup(dob) @@ -298,32 +312,34 @@ module SiSU_Syntax # # #numbered (list) level 1 # _# #numbered (list) level 2 dob=dob.dup - if dob.is !~/^(?:meta|comment|code|table)/ + if dob.is !=:meta \ + && dob.is !=:comment \ + && dob.is !=:code \ + && dob.is !=:table line_array=[] word=dob.obj.scan(/\S+|\n/) #unless line =~/^(?:#{Mx[:meta_o]}|%+\s)/ #visit if word word.each do |w| # _ - / # | : ! ^ ~ unless w =~/~\{|\}~|~\[|\]~|^\^~|~\^|\*~\S+|~#|\{t?~|\{table|https?:\/\/\S+/ # do something earlier about table!! - w.gsub!(/\\?~/,"#{Mx[:gl_o]}#126#{Mx[:gl_c]}") #escaped special character + w=w.gsub(/\\?~/,"#{Mx[:gl_o]}#126#{Mx[:gl_c]}") #escaped special character end - w.gsub!(/^\<$/,"#{Mx[:gl_o]}#lt#{Mx[:gl_c]}") #escaped special character - w.gsub!(/^\>$/,"#{Mx[:gl_o]}#gt#{Mx[:gl_c]}") #escaped special character + w=w.gsub(/^\<$/,"#{Mx[:gl_o]}#lt#{Mx[:gl_c]}").gsub(/^\>$/,"#{Mx[:gl_o]}#gt#{Mx[:gl_c]}") #escaped special character line_array << w end dob.obj=line_array.join(' ') dob.obj=dob.obj.strip end - dob.obj.gsub!(/^([*#-.]{1,12})$/,'\1 ~#') #ocn off for these paragraph separators - dob.obj.gsub!(/~\{(.+?)\}~/m,Mx[:en_a_o] + '\1' + Mx[:en_a_c]) - dob.obj.gsub!(/~\[([^*+].+?)\]~/m,Mx[:en_b_o] + '* \1' + Mx[:en_b_c]) #default if markup does not specify - dob.obj.gsub!(/~\[(.+?)\]~/m,Mx[:en_b_o] + '\1' + Mx[:en_b_c]) - if dob.is =='heading' \ + dob.obj=dob.obj.gsub(/^([*#-.]{1,12})$/,'\1 ~#'). #ocn off for these paragraph separators + gsub(/~\{(.+?)\}~/m,Mx[:en_a_o] + '\1' + Mx[:en_a_c]). + gsub(/~\[([^*+].+?)\]~/m,Mx[:en_b_o] + '* \1' + Mx[:en_b_c]). #default if markup does not specify + gsub(/~\[(.+?)\]~/m,Mx[:en_b_o] + '\1' + Mx[:en_b_c]) + if dob.is ==:heading \ and dob.ln ==1 - dob.obj.gsub!(/\s*@title\b/," #{@md.title.full}") - if defined? @md.creator.author \ + dob.obj=dob.obj.gsub(/\s*@title\b/," #{@md.title.full}") + dob.obj=if defined? @md.creator.author \ and @md.creator.author - dob.obj.gsub!(/\s+(?:@creator|@author)/,",#{Mx[:br_line]}#{@md.creator.author}") - else dob.obj.gsub!(/\s+(?:@creator|@author)/,'') + dob.obj.gsub(/\s+(?:@creator|@author)/,",#{Mx[:br_line]}#{@md.creator.author}") + else dob.obj.gsub(/\s+(?:@creator|@author)/,'') end end if defined? @md.title \ @@ -331,114 +347,114 @@ module SiSU_Syntax and defined? @md.title.full \ and defined? @md.creator \ and @md.creator - if dob.is =='heading' - dob.obj.gsub!(/^\s*@title\s*$/,@md.title.full) if dob.lv =~/1/ - if dob.lv =~/[23]/ \ + if dob.is ==:heading + dob.obj=dob.obj.gsub(/^\s*@title\s*$/,@md.title.full) if dob.lv =~/1/ + dob.obj=if dob.lv =~/[23]/ \ and defined? @md.creator.author \ and @md.creator.author - dob.obj.gsub!(/^\s*(?:(by\s+)?(?:@creator|@author))\s*$/,"\\1#{@md.creator.author}") - else dob.obj.gsub!(/^\s*(?:(by\s+)?(?:@creator|@author))\s*$/,'\1') + dob.obj.gsub(/^\s*(?:(by\s+)?(?:@creator|@author))\s*$/,"\\1#{@md.creator.author}") + else dob.obj.gsub(/^\s*(?:(by\s+)?(?:@creator|@author))\s*$/,'\1') end end end - dob.obj.gsub!(/<(https?:\/\/\S+?)>/,'< \1 >') #catch problem markup - dob.obj.gsub!(/<:=(\S+?)>/,'{ c_\1.png 14x14 }image') - dob.obj.gsub!(//,'<:\1>') #escaped special character - dob.obj.gsub!(/ /,"#{Mx[:nbsp]}") #escaped special character - dob.obj.gsub!(/\\~/,"#{Mx[:gl_o]}#126#{Mx[:gl_c]}") #escaped special character - dob.obj.gsub!(/\\\{/,"#{Mx[:gl_o]}#123#{Mx[:gl_c]}") #escaped special character - dob.obj.gsub!(/\\\}/,"#{Mx[:gl_o]}#125#{Mx[:gl_c]}") #escaped special character - dob.obj.gsub!(/\\\<>/,"#{Mx[:gl_o]}#gt#{Mx[:gl_c]}#{Mx[:gl_o]}#gt#{Mx[:gl_c]}") #escaped special character - dob.obj.gsub!(/\\\/,"#{Mx[:gl_o]}#gt#{Mx[:gl_c]}") #escaped special character - dob.obj.gsub!(/\\\_/,"#{Mx[:gl_o]}#095#{Mx[:gl_c]}") #escaped special character - dob.obj.gsub!(/\\\-/,"#{Mx[:gl_o]}#045#{Mx[:gl_c]}") #escaped special character - dob.obj.gsub!(/\\\+/,"#{Mx[:gl_o]}#043#{Mx[:gl_c]}") #escaped special character - dob.obj.gsub!(/\\\//,"#{Mx[:gl_o]}#047#{Mx[:gl_c]}") #escaped special character - dob.obj.gsub!(/\\\#/,"#{Mx[:gl_o]}#035#{Mx[:gl_c]}") #escaped special character - dob.obj.gsub!(/\\\&/,"#{Mx[:gl_o]}#038#{Mx[:gl_c]}") #& #escaped special character - dob.obj.gsub!(/\\\|/,"#{Mx[:gl_o]}#124#{Mx[:gl_c]}") #not really a sisu special character but made available as possibility - dob.obj.gsub!(/\\\:/,"#{Mx[:gl_o]}#058#{Mx[:gl_c]}") #not really a sisu special character but made available as possibility - dob.obj.gsub!(/\\\!/,"#{Mx[:gl_o]}#033#{Mx[:gl_c]}") #not really a sisu special character but made available as possibility - dob.obj.gsub!(/\\\^/,"#{Mx[:gl_o]}#094#{Mx[:gl_c]}") #not really a sisu special character but made available as possibility - dob.obj.gsub!(/\\\,/,"#{Mx[:gl_o]}#044#{Mx[:gl_c]}") #not really a sisu special character but made available as possibility - dob.obj.gsub!(/\\\\/,"#{Mx[:gl_o]}#092#{Mx[:gl_c]}") #escaped special character - dob.obj.gsub!(/\\\*/,"#{Mx[:gl_o]}#042#{Mx[:gl_c]}") #escaped special character - dob.obj.gsub!(/\\\!/,"#{Mx[:gl_o]}#033#{Mx[:gl_c]}") #escaped special character + dob.obj=dob.obj.gsub(/<(https?:\/\/\S+?)>/,'< \1 >'). #catch problem markup + gsub(/<:=(\S+?)>/,'{ c_\1.png 14x14 }image'). + gsub(//,'<:\1>'). #escaped special character + gsub(/ /,"#{Mx[:nbsp]}"). #escaped special character + gsub(/\\~/,"#{Mx[:gl_o]}#126#{Mx[:gl_c]}"). #escaped special character + gsub(/\\\{/,"#{Mx[:gl_o]}#123#{Mx[:gl_c]}"). #escaped special character + gsub(/\\\}/,"#{Mx[:gl_o]}#125#{Mx[:gl_c]}"). #escaped special character + gsub(/\\\<>/,"#{Mx[:gl_o]}#gt#{Mx[:gl_c]}#{Mx[:gl_o]}#gt#{Mx[:gl_c]}"). #escaped special character + gsub(/\\\/,"#{Mx[:gl_o]}#gt#{Mx[:gl_c]}"). #escaped special character + gsub(/\\\_/,"#{Mx[:gl_o]}#095#{Mx[:gl_c]}"). #escaped special character + gsub(/\\\-/,"#{Mx[:gl_o]}#045#{Mx[:gl_c]}"). #escaped special character + gsub(/\\\+/,"#{Mx[:gl_o]}#043#{Mx[:gl_c]}"). #escaped special character + gsub(/\\\//,"#{Mx[:gl_o]}#047#{Mx[:gl_c]}"). #escaped special character + gsub(/\\\#/,"#{Mx[:gl_o]}#035#{Mx[:gl_c]}"). #escaped special character + gsub(/\\\&/,"#{Mx[:gl_o]}#038#{Mx[:gl_c]}"). #& #escaped special character + gsub(/\\\|/,"#{Mx[:gl_o]}#124#{Mx[:gl_c]}"). #not really a sisu special character but made available as possibility + gsub(/\\\:/,"#{Mx[:gl_o]}#058#{Mx[:gl_c]}"). #not really a sisu special character but made available as possibility + gsub(/\\\!/,"#{Mx[:gl_o]}#033#{Mx[:gl_c]}"). #not really a sisu special character but made available as possibility + gsub(/\\\^/,"#{Mx[:gl_o]}#094#{Mx[:gl_c]}"). #not really a sisu special character but made available as possibility + gsub(/\\\,/,"#{Mx[:gl_o]}#044#{Mx[:gl_c]}"). #not really a sisu special character but made available as possibility + gsub(/\\\\/,"#{Mx[:gl_o]}#092#{Mx[:gl_c]}"). #escaped special character + gsub(/\\\*/,"#{Mx[:gl_o]}#042#{Mx[:gl_c]}"). #escaped special character + gsub(/\\\!/,"#{Mx[:gl_o]}#033#{Mx[:gl_c]}") #escaped special character if dob.obj=~/(?:https?:|ftp:|\{([^{}]+?)\}(?:#|:|[.]{1,2}\/))\S+/m if dob.obj=~/(?:^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ (?:.+?)\s*\}(?:(?:https?:|ftp:|:|[.]{1,2}\/)\S+?)\s*#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/m - dob.obj.gsub!(/(^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ ([^}]+?)\s*\}((?:https?:|ftp:|:|[.]{1,2}\/)\S+?)\s*#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/m, + dob.obj=dob.obj.gsub(/(^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ ([^}]+?)\s*\}((?:https?:|ftp:|:|[.]{1,2}\/)\S+?)\s*#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/m, "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3 #{Mx[:en_a_o]}\\3 \\4#{Mx[:en_a_c]}") # watch end if dob.obj=~/(?:^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ (?:.+?)\s*\}(?:(?:https?:|ftp:|:|[.]{1,2}\/)\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m - dob.obj.gsub!(/(^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ (.+?)\s*\}((?:https?:|ftp:|:|[.]{1,2}\/)\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m, + dob.obj=dob.obj.gsub(/(^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ (.+?)\s*\}((?:https?:|ftp:|:|[.]{1,2}\/)\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m, "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3\\4 #{Mx[:en_a_o]}\\3#{Mx[:en_a_c]} ") end - dob.obj.gsub!(/(^|[^#])\{\s*([^{}]+?)\s*\}((?:https?:|:|[.]{2}\/|#)\S+?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/, - "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3") #linked (text or image, however text cannot include modified face, e.g. bold, ital, underline) - dob.obj.gsub!(/(^|[#{Mx[:gl_c]}#{Mx[:lnk_c]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}(\s])((?:https?|ftp):\/\/\S+?\.[^>< ]+?)([,.;'"]?)(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m, - %{\\1#{Mx[:url_o]}\\2#{Mx[:url_c]}\\3}) - dob.obj.gsub!(/#{Mx[:lnk_c]}#(\S+?[^>< ]+?)([()\[\]]*[,.;:!?'"]{0,2})(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m, - %{#{Mx[:lnk_c]}#{Mx[:rel_o]}\\1#{Mx[:rel_c]}\\2}) - dob.obj.gsub!(/#{Mx[:lnk_c]}:(\S+?[^>< ]+?)([()\[\]]*[,.;:!?'"]{0,2})(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m, - %{#{Mx[:lnk_c]}#{Mx[:rel_o]}:\\1#{Mx[:rel_c]}\\2}) - dob.obj.gsub!(/#{Mx[:lnk_c]}[.]{2}\/(\S+?[^>< ]+?)([()\[\]]*[,.;:!?'"]{0,2})(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m, - %{#{Mx[:lnk_c]}#{Mx[:rel_o]}:\\1#{Mx[:rel_c]}\\2}) + dob.obj=dob.obj.gsub(/(^|[^#])\{\s*([^{}]+?)\s*\}((?:https?:|:|[.]{2}\/|#)\S+?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/, + "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3"). #linked (text or image, however text cannot include modified face, e.g. bold, ital, underline) + gsub(/(^|[#{Mx[:gl_c]}#{Mx[:lnk_c]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}(\s])((?:https?|ftp):\/\/\S+?\.[^>< ]+?)([,.;'"]?)(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m, + %{\\1#{Mx[:url_o]}\\2#{Mx[:url_c]}\\3}). + gsub(/#{Mx[:lnk_c]}#(\S+?[^>< ]+?)([()\[\]]*[,.;:!?'"]{0,2})(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m, + %{#{Mx[:lnk_c]}#{Mx[:rel_o]}\\1#{Mx[:rel_c]}\\2}). + gsub(/#{Mx[:lnk_c]}:(\S+?[^>< ]+?)([()\[\]]*[,.;:!?'"]{0,2})(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m, + %{#{Mx[:lnk_c]}#{Mx[:rel_o]}:\\1#{Mx[:rel_c]}\\2}). + gsub(/#{Mx[:lnk_c]}[.]{2}\/(\S+?[^>< ]+?)([()\[\]]*[,.;:!?'"]{0,2})(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m, + %{#{Mx[:lnk_c]}#{Mx[:rel_o]}:\\1#{Mx[:rel_c]}\\2}) end if dob.obj=~/_(?:https?|ftp):\S+/m # _http://url #CHECK - dob.obj.gsub!(/(^|[#{Mx[:gl_c]}#{Mx[:lnk_c]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}(\s])(_(?:https?|ftp):\/\/\S+?\.[^>< ]+?)([,.;'"]?)(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m, + dob.obj=dob.obj.gsub(/(^|[#{Mx[:gl_c]}#{Mx[:lnk_c]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}(\s])(_(?:https?|ftp):\/\/\S+?\.[^>< ]+?)([,.;'"]?)(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m, %{\\1#{Mx[:url_o]}\\2#{Mx[:url_c]}\\3}) end dob=fontface(dob) - dob.obj.gsub!(/<[:e]\s+(.+?)!?>/, - "#{Mx[:en_a_o]}\\1#{Mx[:en_a_c]}") #not tested - dob.obj.gsub!(/^\s*_\*\s*/, - "#{Mx[:gl_bullet]}") #bullets, shortcut - dob.obj.gsub!(/=\{(.+?)\}/, - "#{Mx[:idx_o]}\\1#{Mx[:idx_c]}") - dob.obj.gsub!(/^\s*_([1-9])\*\s*/, - "#{Mx[:pa_o]}:i\\1:\\1#{Mx[:pa_c]}#{Mx[:gl_bullet]}") #bullets, shortcut - dob.obj.gsub!(/^\s*_([1-9])\s+/, - "#{Mx[:pa_o]}:i\\1:\\1#{Mx[:pa_c]}") #indent - dob.obj.gsub!(/^\s*_([1-9])!\s+(.+?)\s*$/, - "#{Mx[:pa_o]}:i\\1:\\1#{Mx[:pa_c]}#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]} ") #indent bold - dob.obj.gsub!(/^\s*__([1-9])\s+/, - "#{Mx[:pa_o]}:i0:\\1#{Mx[:pa_c]}") #hang - dob.obj.gsub!(/^\s*__([1-9])!\s+(.+?)\s*$/, - "#{Mx[:pa_o]}:i0:\\1#{Mx[:pa_c]}#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]} ") #hangdef - dob.obj.gsub!(/^\s*_([0-9])_([0-9])\s+/, - "#{Mx[:pa_o]}:i\\1:\\2#{Mx[:pa_c]}") #hang - dob.obj.gsub!(/^\s*_([0-9])_([0-9])!\s+(.+?)\s*$/, - "#{Mx[:pa_o]}:i\\1:\\2#{Mx[:pa_c]}#{Mx[:fa_bold_o]}\\3#{Mx[:fa_bold_c]} ") #hangdef - dob.obj.gsub!(/<:hi>/,"#{Mx[:fa_hilite_o]}") #'') # bright yellow rgb(255,255,0) pale yellow rgb(255,255,200) - dob.obj.gsub!(/<:\/hi>/,"#{Mx[:fa_hilite_c]}") #'') - dob.obj.gsub!(/(#{Mx[:gr_o]}verse#{Mx[:gr_c]}.+)/m,"\\1\n") - dob.obj.gsub!(/[ ]+($)/,'\1') - dob.obj.gsub!(/\{\s*(.+?)\s*\}(https?:\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/, - "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}#{Mx[:url_o]}\\2#{Mx[:url_c]}\\3") #any remaining linked text or image - dob.obj.gsub!(/\{\s*(.+?)\s*\}(#{Mx[:url_o]}\S+?#{Mx[:url_c]})/, - "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2") #any remaining linked text or image - dob.obj.gsub!(/(^|\s)([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)/,"\\1#{Mx[:url_o]}\\2#{Mx[:url_c]}") - dob.obj.gsub!(/(^|[ ])\{\s*(.+?)\s*\}(\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/, - "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3\\4") #any remaining linked text or image - dob.obj.gsub!(/\{\s*(.+?)\s*\}#([a-zA-Z0-9][a-zA-Z0-9_-]*)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/, - "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}#{Mx[:rel_o]}\\2#{Mx[:rel_c]}\\3") #any remaining linked text or image, check need - dob.obj.gsub!(/\{\s*(.+?)\s*\}(#{Mx[:rel_o]}\S+?#{Mx[:rel_c]})/, - "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2") #any remaining linked text or image, check need - dob.obj.gsub!(/\{\s*(.+?)\s*\}(image)/, - "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2") #linked image - elsif dob.is=='table' + dob.obj=dob.obj.gsub(/<[:e]\s+(.+?)!?>/, + "#{Mx[:en_a_o]}\\1#{Mx[:en_a_c]}"). #not tested + gsub(/^\s*_\*\s*/, + "#{Mx[:gl_bullet]}"). #bullets, shortcut + gsub(/=\{(.+?)\}/, + "#{Mx[:idx_o]}\\1#{Mx[:idx_c]}"). + gsub(/^\s*_([1-9])\*\s*/, + "#{Mx[:pa_o]}:i\\1:\\1#{Mx[:pa_c]}#{Mx[:gl_bullet]}"). #bullets, shortcut + gsub(/^\s*_([1-9])\s+/, + "#{Mx[:pa_o]}:i\\1:\\1#{Mx[:pa_c]}"). #indent + gsub(/^\s*_([1-9])!\s+(.+?)\s*$/, + "#{Mx[:pa_o]}:i\\1:\\1#{Mx[:pa_c]}#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]} "). #indent bold + gsub(/^\s*__([1-9])\s+/, + "#{Mx[:pa_o]}:i0:\\1#{Mx[:pa_c]}"). #hang + gsub(/^\s*__([1-9])!\s+(.+?)\s*$/, + "#{Mx[:pa_o]}:i0:\\1#{Mx[:pa_c]}#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]} "). #hangdef + gsub(/^\s*_([0-9])_([0-9])\s+/, + "#{Mx[:pa_o]}:i\\1:\\2#{Mx[:pa_c]}"). #hang + gsub(/^\s*_([0-9])_([0-9])!\s+(.+?)\s*$/, + "#{Mx[:pa_o]}:i\\1:\\2#{Mx[:pa_c]}#{Mx[:fa_bold_o]}\\3#{Mx[:fa_bold_c]} "). #hangdef + gsub(/<:hi>/,"#{Mx[:fa_hilite_o]}"). #'') # bright yellow rgb(255,255,0) pale yellow rgb(255,255,200) + gsub(/<:\/hi>/,"#{Mx[:fa_hilite_c]}"). #'') + gsub(/(#{Mx[:gr_o]}verse#{Mx[:gr_c]}.+)/m,"\\1\n"). + gsub(/[ ]+($)/,'\1'). + gsub(/\{\s*(.+?)\s*\}(https?:\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/, + "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}#{Mx[:url_o]}\\2#{Mx[:url_c]}\\3"). #any remaining linked text or image + gsub(/\{\s*(.+?)\s*\}(#{Mx[:url_o]}\S+?#{Mx[:url_c]})/, + "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2"). #any remaining linked text or image + gsub(/(^|\s)([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)/,"\\1#{Mx[:url_o]}\\2#{Mx[:url_c]}"). + gsub(/(^|[ ])\{\s*(.+?)\s*\}(\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/, + "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3\\4"). #any remaining linked text or image + gsub(/\{\s*(.+?)\s*\}#([a-zA-Z0-9][a-zA-Z0-9_-]*)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/, + "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}#{Mx[:rel_o]}\\2#{Mx[:rel_c]}\\3"). #any remaining linked text or image, check need + gsub(/\{\s*(.+?)\s*\}(#{Mx[:rel_o]}\S+?#{Mx[:rel_c]})/, + "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2"). #any remaining linked text or image, check need + gsub(/\{\s*(.+?)\s*\}(image)/, + "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2") #linked image + elsif dob.is==:table dob=fontface(dob) - elsif dob.is =='code' - dob.obj.gsub!(/#{Mx[:meta_o]}(\S+?)#{Mx[:meta_c]}\s*/,'@\1: ') - dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s)<(br(?: \/)?)>([\s,.]|$)/,'\1<\2>\3') #convert

back, clumsy + elsif dob.is ==:code + dob.obj=dob.obj.gsub(/#{Mx[:meta_o]}(\S+?)#{Mx[:meta_c]}\s*/,'@\1: '). + gsub(/(^|#{Mx[:gl_c]}|\s)<(br(?: \/)?)>([\s,.]|$)/,'\1<\2>\3') #convert

back, clumsy if dob.number_ codeline=[] ln=1 dob.obj.split(/#{Mx[:gr_o]}codeline#{Mx[:gr_c]}||\n/).each_with_index do |cl,i| unless i == 0 - cl.gsub!(Mx[:br_nl],'') + cl=cl.gsub(Mx[:br_nl],'') w=3-ln.to_s.length cl = "#{ln}#{Mx[:nbsp]*w}#{Mx[:vline]}#{cl}#{Mx[:br_nl]}" ln +=1 @@ -448,7 +464,7 @@ module SiSU_Syntax codeline= codeline.join("") dob.obj=codeline else - dob.obj.gsub!(/#{Mx[:gr_o]}codeline#{Mx[:gr_c]}/,"\n") + dob.obj=dob.obj.gsub(/#{Mx[:gr_o]}codeline#{Mx[:gr_c]}/,"\n") end dob else # @\S+?: @@ -474,62 +490,62 @@ module SiSU_Syntax # +2 puts 'tech' @data.each do |line| - line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)e\{(.+?)\}e/, - "\\1#{@emph[:o]}\\2#{@emph[:c]}") #emphasis - line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)b\{(.+?)\}b/, - "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold - line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)u\{(.+?)\}u/, - "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}") #underscore - line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)c\{(.+?)\}c/, - "\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}") #cite - line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)i\{(.+?)\}i/, - "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}") #italics - line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)!\{(.+?)\}!/, - "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold - line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)\*\{(.+?)\}\*/, - "\\1#{@emph[:o]}\\2#{@emph[:c]}") #emphasis - line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)_\{(.+?)\}_/, - "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}") #underscore - line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\(|\>)\/\{(.+?)\}\//, - "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}") #italics - line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\"\{(.+?)\}\"/, - "\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}") - line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\^\{(.+?)\}\^/, - "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") - line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)9\{(.+?)\}9/, - "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") - line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>),\{(.+?)\},/, - "\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}") - line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)6\{(.+?)\}6/, - "\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}") - line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\+\{(.+?)\}\+/, - "\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}") - line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)v\{(.+?)\}v/, - "\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}") - line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)-\{(.+?)\}-/, - "\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}") - line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)x\{(.+?)\}x/, - "\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}") - line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\*(\S+?)\*/, - "\\1#{@emph[:o]}\\2#{@emph[:c]}") #emphasise single word, watch - line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\!(\S+?)\!/, - "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold single word, watch - line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\/([\(\)a-zA-Z0-9']+?)\/([ ,.;:'"~$]|[^a-zA-Z0-9])/, - "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}\\3") #italics single word, watch - line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)_(\S+?)_/, - "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}") #underscore single word, watch - line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\^(\S+?)\^/, - "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") #check #superscript single word, watch digit added - line.gsub!(/^\s*_\([1-9]\)\(\*\+\)\s*/, - "#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}#{Mx[:fa_o]}\\2#{Mx[:fa_c_o]}") #bullets, shortcut - line.gsub!(/^\s*_\([1-9]\)\s+/, - "#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}") #watch - line.gsub!(/^\s*__\([1-9]\)\s+/, - "#{Mx[:pa_o]}:h\\1#{Mx[:pa_c]}") #watch - #line.gsub!(/^\s*__\([1-9]\)!\s+/, - # "#{Mx[:pa_o]}:hd\\1#{Mx[:pa_c]}") #watch - line.gsub!(/#{Mx[:br_line]}\s*_[12]\s+/, - "#{Mx[:br_line]} ") #indent used in endnotes, not implemented, replace when ready with: line.gsub!(/(?:
|
)\s*_([12])\s+/,'
<:i\1> ') + line=line.gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)e\{(.+?)\}e/, + "\\1#{@emph[:o]}\\2#{@emph[:c]}"). #emphasis + gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)b\{(.+?)\}b/, + "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}"). #bold + gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)u\{(.+?)\}u/, + "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}"). #underscore + gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)c\{(.+?)\}c/, + "\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}"). #cite + gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)i\{(.+?)\}i/, + "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}"). #italics + gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)!\{(.+?)\}!/, + "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}"). #bold + gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)\*\{(.+?)\}\*/, + "\\1#{@emph[:o]}\\2#{@emph[:c]}"). #emphasis + gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)_\{(.+?)\}_/, + "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}"). #underscore + gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\(|\>)\/\{(.+?)\}\//, + "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}"). #italics + gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\"\{(.+?)\}\"/, + "\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}"). + gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\^\{(.+?)\}\^/, + "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}"). + gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)9\{(.+?)\}9/, + "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}"). + gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>),\{(.+?)\},/, + "\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}"). + gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)6\{(.+?)\}6/, + "\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}"). + gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\+\{(.+?)\}\+/, + "\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}"). + gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)v\{(.+?)\}v/, + "\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}"). + gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)-\{(.+?)\}-/, + "\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}"). + gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)x\{(.+?)\}x/, + "\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}"). + gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\*(\S+?)\*/, + "\\1#{@emph[:o]}\\2#{@emph[:c]}"). #emphasise single word, watch + gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\!(\S+?)\!/, + "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}"). #bold single word, watch + gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\/([\(\)a-zA-Z0-9']+?)\/([ ,.;:'"~$]|[^a-zA-Z0-9])/, + "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}\\3"). #italics single word, watch + gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)_(\S+?)_/, + "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}"). #underscore single word, watch + gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\^(\S+?)\^/, + "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}"). #check #superscript single word, watch digit added + gsub(/^\s*_\([1-9]\)\(\*\+\)\s*/, + "#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}#{Mx[:fa_o]}\\2#{Mx[:fa_c_o]}"). #bullets, shortcut + gsub(/^\s*_\([1-9]\)\s+/, + "#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}"). #watch + gsub(/^\s*__\([1-9]\)\s+/, + "#{Mx[:pa_o]}:h\\1#{Mx[:pa_c]}"). #watch + #line.gsub(/^\s*__\([1-9]\)!\s+/, + # "#{Mx[:pa_o]}:hd\\1#{Mx[:pa_c]}"). #watch + gsub(/#{Mx[:br_line]}\s*_[12]\s+/, + "#{Mx[:br_line]} ") #indent used in endnotes, not implemented, replace when ready with: line.gsub(/(?:
|
)\s*_([12])\s+/,'
<:i\1> ') end @data end diff --git a/lib/sisu/v3/db_columns.rb b/lib/sisu/v3/db_columns.rb index 10b9635f..cf4ba9c7 100644 --- a/lib/sisu/v3/db_columns.rb +++ b/lib/sisu/v3/db_columns.rb @@ -57,13 +57,13 @@ sqlite =end -module SiSU_DB_columns +module SiSU_DbColumns require_relative 'sysenv' # sysenv.rb require_relative 'db_sqltxt' # db_sqltxt.rb - class Columns < SiSU_DB_text::Prepare + class Columns < SiSU_DbText::Prepare def initialize(md=nil) @md=md - @db=SiSU_Env::Info_db.new #watch + @db=SiSU_Env::InfoDb.new #watch @lang ||=SiSU_i18n::Languages.new if defined? md.opt.mod \ and md.opt.mod.inspect=~/import|update/ \ @@ -109,7 +109,7 @@ module SiSU_DB_columns t=if defined? @md.title.full \ and @md.title.full=~/\S+/ txt=@md.title.full - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -131,7 +131,7 @@ module SiSU_DB_columns t=if defined? @md.title.main \ and @md.title.main=~/\S+/ txt=@md.title.main - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -153,7 +153,7 @@ module SiSU_DB_columns t=if defined? @md.title.sub \ and @md.title.sub=~/\S+/ txt=@md.title.sub - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -175,7 +175,7 @@ module SiSU_DB_columns t=if defined? @md.title.short \ and @md.title.short=~/\S+/ txt=@md.title.short - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -197,7 +197,7 @@ module SiSU_DB_columns t=if defined? @md.title.edition \ and @md.title.edition=~/\S+/ txt=@md.title.edition - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -219,7 +219,7 @@ module SiSU_DB_columns t=if defined? @md.title.note \ and @md.title.note=~/\S+/ txt=@md.title.note - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -240,7 +240,7 @@ module SiSU_DB_columns def tuple t=if @lang.list[@md.opt.lng][:n] txt=@lang.list[@md.opt.lng][:n] - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -262,7 +262,7 @@ module SiSU_DB_columns t=if defined? @md.opt.lng \ and @md.opt.lng=~/\S+/ txt=@md.opt.lng - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -302,8 +302,8 @@ module SiSU_DB_columns @md.creator.author_detail.each do |h| txt=txt + %{#{h[:the]}, #{h[:others]}; } end - txt.gsub!(/[;, ]+\s*$/,'') - special_character_escape(txt) + txt=txt.gsub(/[;, ]+\s*$/,'') + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -325,7 +325,7 @@ module SiSU_DB_columns t=if defined? @md.creator.author_hon \ and @md.creator.author_hon=~/\S+/ txt=@md.creator.author_hon - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -347,7 +347,7 @@ module SiSU_DB_columns t=if defined? @md.creator.author_nationality_detail \ and @md.creator.author_nationality=~/\S+/ txt=@md.creator.author_nationality_detail - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -374,8 +374,8 @@ module SiSU_DB_columns @md.creator.editor_detail.each do |h| txt=txt + %{#{h[:the]}, #{h[:others]}; } end - txt.gsub!(/[;, ]+\s*$/,'') - special_character_escape(txt) + txt=txt.gsub(/[;, ]+\s*$/,'') + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -402,8 +402,8 @@ module SiSU_DB_columns @md.creator.contributor_detail.each do |h| txt=txt + %{#{h[:the]}, #{h[:others]}; } end - txt.gsub!(/[;, ]+\s*$/,'') - special_character_escape(txt) + txt=txt.gsub(/[;, ]+\s*$/,'') + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -430,8 +430,8 @@ module SiSU_DB_columns @md.creator.illustrator_detail.each do |h| txt=txt + %{#{h[:the]}, #{h[:others]}; } end - txt.gsub!(/[;, ]+\s*$/,'') - special_character_escape(txt) + txt=txt.gsub(/[;, ]+\s*$/,'') + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -458,8 +458,8 @@ module SiSU_DB_columns @md.creator.photographer_detail.each do |h| txt=txt + %{#{h[:the]}, #{h[:others]}; } end - txt.gsub!(/[;, ]+\s*$/,'') - special_character_escape(txt) + txt=txt.gsub(/[;, ]+\s*$/,'') + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -485,8 +485,8 @@ module SiSU_DB_columns @md.creator.translator_detail.each do |h| txt=txt + %{#{h[:the]}, #{h[:others]}; } end - txt.gsub!(/[;, ]+\s*$/,'') - special_character_escape(txt) + txt=txt.gsub(/[;, ]+\s*$/,'') + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -513,8 +513,8 @@ module SiSU_DB_columns @md.creator.prepared_by_detail.each do |h| txt=txt + %{#{h[:the]}, #{h[:others]}; } end - txt.gsub!(/[;, ]+\s*$/,'') - special_character_escape(txt) + txt=txt.gsub(/[;, ]+\s*$/,'') + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -541,8 +541,8 @@ module SiSU_DB_columns @md.creator.digitized_by_detail.each do |h| txt=txt + %{#{h[:the]}, #{h[:others]}; } end - txt.gsub!(/[;, ]+\s*$/,'') - special_character_escape(txt) + txt=txt.gsub(/[;, ]+\s*$/,'') + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -569,8 +569,8 @@ module SiSU_DB_columns @md.creator.audio_detail.each do |h| txt=txt + %{#{h[:the]}, #{h[:others]}; } end - txt.gsub!(/[;, ]+\s*$/,'') - special_character_escape(txt) + txt=txt.gsub(/[;, ]+\s*$/,'') + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -596,8 +596,8 @@ module SiSU_DB_columns @md.creator.video_detail.each do |h| txt=txt + %{#{h[:the]}, #{h[:others]}; } end - txt.gsub!(/[;, ]+\s*$/,'') - special_character_escape(txt) + txt=txt.gsub(/[;, ]+\s*$/,'') + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -630,7 +630,7 @@ module SiSU_DB_columns def tuple t=if @lang.list[@md.opt.lng][:n] txt=@lang.list[@md.opt.lng][:n] - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -653,7 +653,7 @@ module SiSU_DB_columns t=if defined? @md.opt.lng \ and @md.opt.lng=~/\S+/ txt=@md.opt.lng - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -675,7 +675,7 @@ module SiSU_DB_columns t=if defined? @md.language.original \ and @md.language.original=~/\S+/ txt=@md.language.original - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -697,7 +697,7 @@ module SiSU_DB_columns t=if defined? @md.language.original_char \ and @md.language.original_char=~/\S+/ txt=@md.language.original_char - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -733,7 +733,7 @@ module SiSU_DB_columns t=if defined? @md.date.added_to_site \ and @md.date.added_to_site=~/\S+/ txt=@md.date.added_to_site - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -755,7 +755,7 @@ module SiSU_DB_columns t=if defined? @md.date.available \ and @md.date.available=~/\S+/ txt=@md.date.available - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -777,7 +777,7 @@ module SiSU_DB_columns t=if defined? @md.date.created \ and @md.date.created=~/\S+/ txt=@md.date.created - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -799,7 +799,7 @@ module SiSU_DB_columns t=if defined? @md.date.issued \ and @md.date.issued=~/\S+/ txt=@md.date.issued - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -821,7 +821,7 @@ module SiSU_DB_columns t=if defined? @md.date.modified \ and @md.date.modified=~/\S+/ txt=@md.date.modified - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -843,7 +843,7 @@ module SiSU_DB_columns t=if defined? @md.date.published \ and @md.date.published=~/\S+/ txt=@md.date.published - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -865,7 +865,7 @@ module SiSU_DB_columns t=if defined? @md.date.valid \ and @md.date.valid=~/\S+/ txt=@md.date.valid - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -887,7 +887,7 @@ module SiSU_DB_columns t=if defined? @md.date.translated \ and @md.date.translated=~/\S+/ txt=@md.date.translated - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -909,7 +909,7 @@ module SiSU_DB_columns t=if defined? @md.date.original_publication \ and @md.date.original_publication=~/\S+/ txt=@md.date.original_publication - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -932,7 +932,7 @@ module SiSU_DB_columns t=if defined? @md.generated \ and @md.generated.to_s=~/\S+/ txt=@md.generated.to_s - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -958,7 +958,7 @@ module SiSU_DB_columns t=if defined? @md.publisher \ and @md.publisher=~/\S+/ txt=@md.publisher - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -980,7 +980,7 @@ module SiSU_DB_columns # t=if defined? @md.current.publisher \ # and @md.current.publisher=~/\S+/ # txt=@md.current.publisher -# special_character_escape(txt) +# txt=special_character_escape(txt) # "'#{txt}', " # end # end @@ -1011,7 +1011,7 @@ module SiSU_DB_columns t=if defined? @md.original.publisher \ and @md.original.publisher=~/\S+/ txt=@md.original.publisher - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -1033,7 +1033,7 @@ module SiSU_DB_columns t=if defined? @md.original.language \ and @md.original.language=~/\S+/ txt=@md.original.language - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -1055,7 +1055,7 @@ module SiSU_DB_columns t=if defined? @md.original.language_char \ and @md.original.language_char=~/\S+/ txt=@md.original.language_char - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -1077,7 +1077,7 @@ module SiSU_DB_columns t=if defined? @md.original.source \ and @md.original.source=~/\S+/ txt=@md.original.source - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -1099,7 +1099,7 @@ module SiSU_DB_columns t=if defined? @md.original.institution \ and @md.original.institution=~/\S+/ txt=@md.original.institution - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -1121,7 +1121,7 @@ module SiSU_DB_columns t=if defined? @md.original.nationality \ and @md.original.nationality=~/\S+/ txt=@md.original.nationality - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -1158,7 +1158,7 @@ module SiSU_DB_columns t=if defined? @md.rights.all \ and @md.rights.all=~/\S+/ txt=@md.rights.all - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -1180,7 +1180,7 @@ module SiSU_DB_columns t=if defined? @md.rights.copyright_text \ and @md.rights.copyright_text=~/\S+/ txt=@md.rights.copyright_text - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -1202,7 +1202,7 @@ module SiSU_DB_columns t=if defined? @md.rights.copyright_translation \ and @md.rights.copyright_translation=~/\S+/ txt=@md.rights.copyright_translation - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -1224,7 +1224,7 @@ module SiSU_DB_columns t=if defined? @md.rights.copyright_illustrations \ and @md.rights.copyright_illustrations=~/\S+/ txt=@md.rights.copyright_illustrations - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -1246,7 +1246,7 @@ module SiSU_DB_columns t=if defined? @md.rights.copyright_photographs \ and @md.rights.copyright_photographs=~/\S+/ txt=@md.rights.copyright_photographs - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -1268,7 +1268,7 @@ module SiSU_DB_columns t=if defined? @md.rights.copyright_preparation \ and @md.rights.copyright_preparation=~/\S+/ txt=@md.rights.copyright_preparation - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -1290,7 +1290,7 @@ module SiSU_DB_columns t=if defined? @md.rights.copyright_digitization \ and @md.rights.copyright_digitization=~/\S+/ txt=@md.rights.copyright_digitization - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -1312,7 +1312,7 @@ module SiSU_DB_columns t=if defined? @md.rights.copyright_audio \ and @md.rights.copyright_audio=~/\S+/ txt=@md.rights.copyright_audio - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -1334,7 +1334,7 @@ module SiSU_DB_columns t=if defined? @md.rights.copyright_video \ and @md.rights.copyright_video=~/\S+/ txt=@md.rights.copyright_video - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -1356,7 +1356,7 @@ module SiSU_DB_columns t=if defined? @md.rights.license \ and @md.rights.license=~/\S+/ txt=@md.rights.license - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -1394,7 +1394,7 @@ module SiSU_DB_columns t=if defined? @md.classify.topic_register \ and @md.classify.topic_register=~/\S+/ txt=@md.classify.topic_register - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -1416,7 +1416,7 @@ module SiSU_DB_columns t=if defined? @md.classify.subject \ and @md.classify.subject=~/\S+/ txt=@md.classify.subject - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -1438,7 +1438,7 @@ module SiSU_DB_columns t=if defined? @md.classify.type \ and @md.classify.type=~/\S+/ txt=@md.classify.type - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -1460,7 +1460,7 @@ module SiSU_DB_columns t=if defined? @md.classify.loc \ and @md.classify.loc=~/\S+/ txt=@md.classify.loc - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -1482,7 +1482,7 @@ module SiSU_DB_columns t=if defined? @md.classify.dewey \ and @md.classify.dewey=~/\S+/ txt=@md.classify.dewey - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -1504,7 +1504,7 @@ module SiSU_DB_columns t=if defined? @md.classify.oclc \ and @md.classify.oclc=~/\S+/ txt=@md.classify.oclc - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -1526,7 +1526,7 @@ module SiSU_DB_columns t=if defined? @md.classify.pg \ and @md.classify.pg=~/\S+/ txt=@md.classify.pg - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -1548,7 +1548,7 @@ module SiSU_DB_columns t=if defined? @md.classify.isbn \ and @md.classify.isbn=~/\S+/ txt=@md.classify.isbn - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -1570,7 +1570,7 @@ module SiSU_DB_columns t=if defined? @md.classify.format \ and @md.classify.format=~/\S+/ txt=@md.classify.format - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -1592,7 +1592,7 @@ module SiSU_DB_columns t=if defined? @md.classify.identifier \ and @md.classify.identifier=~/\S+/ txt=@md.classify.identifier - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -1614,7 +1614,7 @@ module SiSU_DB_columns t=if defined? @md.classify.relation \ and @md.classify.relation=~/\S+/ txt=@md.classify.relation - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -1636,7 +1636,7 @@ module SiSU_DB_columns t=if defined? @md.classify.coverage \ and @md.classify.coverage=~/\S+/ txt=@md.classify.coverage - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -1658,7 +1658,7 @@ module SiSU_DB_columns t=if defined? @md.classify.keywords \ and @md.classify.keywords=~/\S+/ txt=@md.classify.keywords - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -1692,7 +1692,7 @@ module SiSU_DB_columns t=if defined? @md.notes.abstract \ and @md.notes.abstract=~/\S+/ txt=@md.notes.abstract - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -1714,7 +1714,7 @@ module SiSU_DB_columns t=if defined? @md.notes.comment \ and @md.notes.comment=~/\S+/ txt=@md.notes.comment - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -1736,7 +1736,7 @@ module SiSU_DB_columns t=if defined? @md.notes.description \ and @md.notes.description=~/\S+/ txt=@md.notes.description - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -1758,7 +1758,7 @@ module SiSU_DB_columns t=if defined? @md.notes.history \ and @md.notes.history=~/\S+/ txt=@md.notes.history - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -1780,7 +1780,7 @@ module SiSU_DB_columns t=if defined? @md.notes.prefix \ and @md.notes.prefix=~/\S+/ txt=@md.notes.prefix - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -1802,7 +1802,7 @@ module SiSU_DB_columns t=if defined? @md.notes.prefix_a \ and @md.notes.prefix_a=~/\S+/ txt=@md.notes.prefix_a - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -1824,7 +1824,7 @@ module SiSU_DB_columns t=if defined? @md.notes.prefix_b \ and @md.notes.prefix_b=~/\S+/ txt=@md.notes.prefix_b - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -1846,7 +1846,7 @@ module SiSU_DB_columns t=if defined? @md.notes.suffix \ and @md.notes.suffix=~/\S+/ txt=@md.notes.suffix - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -1871,7 +1871,7 @@ module SiSU_DB_columns t=if defined? @md.fns \ and @md.fns=~/\S+/ txt=@md.fns - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -1916,7 +1916,7 @@ module SiSU_DB_columns t=if defined? @md.filesize \ and @md.filesize=~/\S+/ txt=@md.filesize - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -1938,7 +1938,7 @@ module SiSU_DB_columns t=if defined? @md.wc_words \ and @md.wc_words=~/\S+/ txt=@md.wc_words - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -2006,7 +2006,7 @@ module SiSU_DB_columns t=if defined? @md.skin_name \ and @md.skin_name=~/\S+/ txt=@md.skin_name - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -2029,7 +2029,7 @@ module SiSU_DB_columns and @md.dgst_skin.class==Array \ and @md.dgst_skin[1]=~/\S+/ txt=@md.dgst_skin[1] - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -2051,7 +2051,7 @@ module SiSU_DB_columns t=if defined? @md.skin \ and @md.skin=~/\S+/ txt=@md.skin - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -2074,7 +2074,7 @@ module SiSU_DB_columns t=if defined? @md.links \ and @md.links=~/\S+/ txt=@md.links - special_character_escape(txt) + txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] else ['',''] end @@ -2084,7 +2084,7 @@ module SiSU_DB_columns self end end - class Column_size + class ColumnSize def document_clean # restriction not necessary 60000 end diff --git a/lib/sisu/v3/db_create.rb b/lib/sisu/v3/db_create.rb index 71d0ce09..627f0ea5 100644 --- a/lib/sisu/v3/db_create.rb +++ b/lib/sisu/v3/db_create.rb @@ -57,18 +57,18 @@ sqlite =end -module SiSU_DB_create +module SiSU_DbCreate require_relative 'db_columns' # db_columns.rb - class Create < SiSU_DB_columns::Columns + class Create < SiSU_DbColumns::Columns require_relative 'sysenv' # sysenv.rb @@dl=nil def initialize(opt,conn,file,sql_type='pg') @opt,@conn,@file,@sql_type=opt,conn,file,sql_type @cX=SiSU_Screen::Ansi.new(@opt.cmd).cX @comment=(@sql_type=='pg') \ - ? (Comment.new(@conn,@sql_type)) + ? (SiSU_DbCreate::Comment.new(@conn,@sql_type)) : nil - @@dl ||=SiSU_Env::Info_env.new.digest.length + @@dl ||=SiSU_Env::InfoEnv.new.digest.length end def available DBI.available_drivers.each do |driver| @@ -79,15 +79,15 @@ module SiSU_DB_create end end def create_db - @env=SiSU_Env::Info_env.new(@opt.fns) + @env=SiSU_Env::InfoEnv.new(@opt.fns) tell=(@sql_type=='sqlite') \ - ? SiSU_Screen::Ansi.new(@opt.cmd,'invert','Create Sqlite db tables in:',%{"#{@env.path.output}/sisu_sqlite.db"}) + ? 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_Env::System_call.new.create_pg_db(@env.path.stub_pwd) if @sql_type=='pg' #watch use of path.stub_pwd instead of stub + tell.colorize 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? - dir=SiSU_Env::Info_env.new('') + dir=SiSU_Env::InfoEnv.new('') if @opt.cmd =~/d/ dir.path.webserv_stub_ensure end @@ -345,7 +345,7 @@ module SiSU_DB_create self end end - class Comment < SiSU_DB_columns::Columns + class Comment < SiSU_DbColumns::Columns def initialize(conn,sql_type='pg') @conn=conn if sql_type =~ /pg/; psql diff --git a/lib/sisu/v3/db_dbi.rb b/lib/sisu/v3/db_dbi.rb index c290c9e3..0c19578f 100644 --- a/lib/sisu/v3/db_dbi.rb +++ b/lib/sisu/v3/db_dbi.rb @@ -57,7 +57,7 @@ sqlite =end -module SiSU_DB_DBI +module SiSU_DbDBI require_relative 'db_columns' # db_columns.rb require_relative 'db_tests' # db_tests.rb require_relative 'db_create' # db_create.rb @@ -67,27 +67,27 @@ module SiSU_DB_DBI require_relative 'db_remove' # db_remove.rb require_relative 'db_load_tuple' # db_load_tuple.rb require_relative 'db_import' # db_import.rb - class Column_size < SiSU_DB_columns::Column_size # db_columns.rb + class ColumnSize < SiSU_DbColumns::ColumnSize # db_columns.rb end - class Test < SiSU_DB_tests::Test # db_tests.rb + class Test < SiSU_DbTests::Test # db_tests.rb end - class Create (SiSU_DB_columns::Column_size.new.document_clean - 1) #% examine pg build & remove limitation + and txt.size > (SiSU_DbColumns::ColumnSize.new.document_clean - 1) #% examine pg build & remove limitation puts "\n\nTOO LARGE (TXT - see error log)\n\n" open("#{Dir.pwd}/pg_documents_error_log",'a') do |error| error.puts("\n#{@opt.fns}\nTEXT BODY\n#{@col[:body].size} object #{@col[:ocn]} -> #{@col[:body].slice(0..500)}") @@ -389,28 +402,28 @@ module SiSU_DB_import @en_a,@en_z=@en[0].first,@en[0].last if @en[0] @en_a_asterisk,@en_z_asterisk=@en_ast[0].first,@en_ast[0].last if @en_ast[0] @en_a_plus,@en_z_plus=@en_pls[0].first,@en_pls[0].last if @en_pls[0] - @col[:body]=if data.is=='table' - SiSU_Format_Shared::CSS_Format.new(@md,data).html_table - elsif data.is=='code' - SiSU_Format_Shared::CSS_Format.new(@md,data).code + @col[:body]=if data.is==:table + SiSU_FormatShared::CSS_Format.new(@md,data).html_table + elsif data.is==:code + SiSU_FormatShared::CSS_Format.new(@md,data).code elsif defined? data.indent \ and defined? data.hang \ and data.indent =~/[1-9]/ \ and data.indent == data.hang - SiSU_Format_Shared::CSS_Format.new(@md,data).indent(data.indent) + SiSU_FormatShared::CSS_Format.new(@md,data).indent(data.indent) elsif defined? data.indent \ and defined? data.hang \ and data.hang =~/[0-9]/ \ and data.indent != data.hang - SiSU_Format_Shared::CSS_Format.new(@md,data).hang_indent(data.hang,data.indent) + SiSU_FormatShared::CSS_Format.new(@md,data).hang_indent(data.hang,data.indent) else - SiSU_Format_Shared::CSS_Format.new(@md,data).norm + SiSU_FormatShared::CSS_Format.new(@md,data).norm end - special_character_escape(@col[:body]) + @col[:body]=special_character_escape(@col[:body]) @col[:plaintext]=@col[:body].dup @col[:plaintext]=strip_markup(@col[:plaintext]) @col[:plaintext]=clean_searchable_text(@col[:plaintext]) - t=SiSU_DB_tuple::Load_documents.new(@conn,@col,@opt,@file) + t=SiSU_DbTuple::LoadDocuments.new(@conn,@col,@opt,@file) @tuple_array << t.tuple @en,@en_ast,@en_pls=[],[],[] @col[:en_a]=@col[:en_z]=nil @@ -424,10 +437,10 @@ module SiSU_DB_import nr,txt,digest_clean=$1,$2.strip,0 end @id_n+=1 - special_character_escape(txt) - body=SiSU_Format_Shared::CSS_Format.new(@md,data).endnote(nr,txt) - strip_markup(txt) - if txt.size > (SiSU_DB_columns::Column_size.new.endnote_clean - 1) + txt=special_character_escape(txt) + body=SiSU_FormatShared::CSS_Format.new(@md,data).endnote(nr,txt) + txt=strip_markup(txt) + if txt.size > (SiSU_DbColumns::ColumnSize.new.endnote_clean - 1) puts "\n\nTOO LARGE (ENDNOTE - see error log)\n\n" open("#{Dir.pwd}/pg_documents_error_log",'a') do |error| error.puts("\n#{@opt.fns}\nENDNOTE\n#{txt.size} object #{@col[:ocn]},#{@col[:ocnd]},#{@col[:ocns]} -> #{txt.slice(0..500)}") @@ -448,7 +461,7 @@ module SiSU_DB_import id_t: @@id_t, hash: digest_clean } - t=SiSU_DB_tuple::Load_endnotes.new(@conn,en,@opt,@file) + t=SiSU_DbTuple::LoadEndnotes.new(@conn,en,@opt,@file) @tuple_array << t.tuple end end @@ -463,10 +476,10 @@ module SiSU_DB_import nr,txt,digest_clean=$1,$2.strip,0 end @id_n+=1 - special_character_escape(txt) - body=SiSU_Format_Shared::CSS_Format.new(@md,data).endnote(nr,txt) - strip_markup(txt) - if txt.size > (SiSU_DB_columns::Column_size.new.endnote_clean - 1) + txt=special_character_escape(txt) + body=SiSU_FormatShared::CSS_Format.new(@md,data).endnote(nr,txt) + txt=strip_markup(txt) + if txt.size > (SiSU_DbColumns::ColumnSize.new.endnote_clean - 1) puts "\n\nTOO LARGE (ENDNOTE - see error log)\n\n" open("#{Dir.pwd}/pg_documents_error_log",'a') do |error| error.puts("\n#{@opt.fns}\nENDNOTE\n#{txt.size} object #{@col[:ocn]},#{@col[:ocnd]},#{@col[:ocns]} -> #{txt.slice(0..500)}") @@ -487,7 +500,7 @@ module SiSU_DB_import id_t: @@id_t, hash: digest_clean } - t=SiSU_DB_tuple::Load_endnotes.new(@conn,en,@opt,@file) + t=SiSU_DbTuple::LoadEndnotes.new(@conn,en,@opt,@file) @tuple_array << t.tuple end end @@ -502,10 +515,10 @@ module SiSU_DB_import nr,txt,digest_clean=$1,$2.strip,0 end @id_n+=1 - special_character_escape(txt) - body=SiSU_Format_Shared::CSS_Format.new(@md,data).endnote(nr,txt) - strip_markup(txt) - if txt.size > (SiSU_DB_columns::Column_size.new.endnote_clean - 1) + txt=special_character_escape(txt) + body=SiSU_FormatShared::CSS_Format.new(@md,data).endnote(nr,txt) + txt=strip_markup(txt) + if txt.size > (SiSU_DbColumns::ColumnSize.new.endnote_clean - 1) puts "\n\nTOO LARGE (ENDNOTE - see error log)\n\n" open("#{Dir.pwd}/pg_documents_error_log",'a') do |error| error.puts("\n#{@opt.fns}\nENDNOTE\n#{txt.size} object #{@col[:ocn]},#{@col[:ocnd]},#{@col[:ocns]} -> #{txt.slice(0..500)}") @@ -526,7 +539,7 @@ module SiSU_DB_import id_t: @@id_t, hash: digest_clean } - t=SiSU_DB_tuple::Load_endnotes.new(@conn,en,@opt,@file) + t=SiSU_DbTuple::LoadEndnotes.new(@conn,en,@opt,@file) @tuple_array << t.tuple end end @@ -535,7 +548,7 @@ module SiSU_DB_import end end end - rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error + rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error ensure end @tuple_array @@ -568,14 +581,14 @@ module SiSU_DB_import : nil end def clean_text(base_url=nil) - if base_url - @txt.gsub!(/#{Mx[:en_a_o]}(\d+).+?#{Mx[:en_a_c]}/,%{\\1}) - @txt.gsub!(/#{Mx[:en_b_o]}([*]\d+).+?#{Mx[:en_b_c]}/,%{\\1}) - @txt.gsub!(/#{Mx[:en_b_o]}([+]\d+).+?#{Mx[:en_b_c]}/,%{\\1}) + @txt=if base_url + @txt.gsub(/#{Mx[:en_a_o]}(\d+).+?#{Mx[:en_a_c]}/,%{\\1}). + gsub(/#{Mx[:en_b_o]}([*]\d+).+?#{Mx[:en_b_c]}/,%{\\1}). + gsub(/#{Mx[:en_b_o]}([+]\d+).+?#{Mx[:en_b_c]}/,%{\\1}) else - @txt.gsub!(/#{Mx[:en_a_o]}(\d+).+?#{Mx[:en_a_c]}/,'\1') - @txt.gsub!(/#{Mx[:en_b_o]}([*]\d+).+?#{Mx[:en_b_c]}/,'\1') - @txt.gsub!(/#{Mx[:en_b_o]}([+]\d+).+?#{Mx[:en_b_c]}/,'\1') + @txt.gsub(/#{Mx[:en_a_o]}(\d+).+?#{Mx[:en_a_c]}/,'\1'). + gsub(/#{Mx[:en_b_o]}([*]\d+).+?#{Mx[:en_b_c]}/,'\1'). + gsub(/#{Mx[:en_b_o]}([+]\d+).+?#{Mx[:en_b_c]}/,'\1') end @txt end @@ -598,7 +611,7 @@ module SiSU_DB_import def db_import_urls(dbi_unit,content) #% import documents OID - populate database begin @fnc=content - @env=SiSU_Env::Info_env.new(@opt.fns) + @env=SiSU_Env::InfoEnv.new(@opt.fns) base=@env.url.root out=@env.path.output f,u={},{} @@ -606,57 +619,68 @@ module SiSU_DB_import or @fnb.nil? p 'file output path error' #remove end - if FileTest.file?("#{out}/#{@fnb}/#{@md.fn[:plain]}")==true - f[:txt],u[:txt]='plaintext,', "'#{base}/#{@fnb}/#{@md.fn[:plain]}'," + if FileTest.file?("#{@md.file.output_path.txt.dir}/#{@md.file.base_filename.txt}")==true + f[:txt],u[:txt]='plaintext,', "'#{@md.file.output_path.txt.url}/#{@md.file.base_filename.txt}'," end - if FileTest.file?("#{out}/#{@fnb}/#{@md.fn[:toc]}")==true - f[:html_toc],u[:html_toc]='html_toc,', "'#{base}/#{@fnb}/#{@md.fn[:toc]}'," + if FileTest.file?("#{@md.file.output_path.html_seg.dir}/#{@md.file.base_filename.html_seg}")==true + f[:html_toc],u[:html_toc]='html_toc,', "'#{@md.file.output_path.html_seg.url}/#{@md.file.base_filename.html_seg}'," end - if FileTest.file?("#{out}/#{@fnb}/#{@md.fn[:doc]}")==true - f[:html_doc],u[:html_doc]='html_doc,', "'#{base}/#{@fnb}/#{@md.fn[:doc]}'," + if FileTest.file?("#{@md.file.output_path.html_scroll.dir}/#{@md.file.base_filename.html_scroll}")==true + f[:html_doc],u[:html_doc]='html_doc,', "'#{@md.file.output_path.html_scroll.url}/#{@md.file.base_filename.html_scroll}'," end - if FileTest.file?("#{out}/#{@fnb}/#{@md.fn[:xhtml]}")==true - f[:xhtml],u[:xhtml]='xhtml,', "'#{base}/#{@fnb}/#{@md.fn[:xhtml]}'," + if FileTest.file?("#{@md.file.output_path.xhtml.dir}/#{@md.file.base_filename.xhtml}")==true + f[:xhtml],u[:xhtml]='xhtml,', "'#{@md.file.output_path.xhtml.url}/#{@md.file.base_filename.xhtml}'," end - if FileTest.file?("#{out}/#{@fnb}/#{@md.fn[:sax]}")==true - f[:xml_sax],u[:xml_sax]='xml_sax,', "'#{base}/#{@fnb}/#{@md.fn[:sax]}'," + if FileTest.file?("#{@md.file.output_path.xml_sax.dir}/#{@md.file.base_filename.xml_sax}")==true + f[:xml_sax],u[:xml_sax]='xml_sax,', "'#{@md.file.output_path.xml_sax.url}/#{@md.file.base_filename.xml_sax}'," end - if FileTest.file?("#{out}/#{@fnb}/#{@md.fn[:dom]}")==true - f[:xml_dom],u[:xml_dom]='xml_dom,', "'#{base}/#{@fnb}/#{@md.fn[:dom]}'," + if FileTest.file?("#{@md.file.output_path.xml_dom.dir}/#{@md.file.base_filename.xml_dom}")==true + f[:xml_dom],u[:xml_dom]='xml_dom,', "'#{@md.file.output_path.xml_dom.url}/#{@md.file.base_filename.xml_dom}'," end - if FileTest.file?("#{out}/#{@fnb}/#{@md.fn[:odf]}")==true - f[:odf],u[:odf]='odf,', "'#{base}/#{@fnb}/#{@md.fn[:odf]}'," + if FileTest.file?("#{@md.file.output_path.epub.dir}/#{@md.file.base_filename.epub}")==true + f[:epub],u[:epub]='epub,', "'#{@md.file.output_path.epub.url}/#{@md.file.base_filename.epub}'," end - if FileTest.file?("#{out}/#{@fnb}/#{@md.fn[:pdf_p]}")==true - f[:pdf_p],u[:pdf_p]='pdf_p,', "'#{base}/#{@fnb}/#{@md.fn[:pdf_p]}'," + if FileTest.file?("#{@md.file.output_path.odt.dir}/#{@md.file.base_filename.odt}")==true + f[:odf],u[:odf]='odf,', "'#{@md.file.output_path.odt.url}/#{@md.file.base_filename.odt}'," end - if FileTest.file?("#{out}/#{@fnb}/#{@md.fn[:pdf_l]}")==true - f[:pdf_l],u[:pdf_l]='pdf_l,', "'#{base}/#{@fnb}/#{@md.fn[:pdf_l]}'," + if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@pdf_fn.pdf_p_a4}")==true #\ + #or FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@pdf_fn.pdf_p_letter}")==true + f[:pdf_p],u[:pdf_p]='pdf_p,', "'#{@md.file.output_path.pdf.url}/#{@pdf_fn.pdf_p_a4}'," end - if FileTest.file?("#{out}/#{@fnb}/#{@md.fn[:concordance]}")==true - f[:concordance],u[:concordance]='concordance,', "'#{base}/#{@fnb}/#{@md.fn[:concordance]}'," + if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@pdf_fn.pdf_l_a4}")==true #\ + #or FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@pdf_fn.pdf_l_letter}")==true + f[:pdf_l],u[:pdf_l]='pdf_l,', "'#{@md.file.output_path.pdf.url}/#{@pdf_fn.pdf_l_a4}'," end - if FileTest.file?("#{out}/#{@fnb}/#{@opt.fns}.tex")==true - f[:latex_p],u[:latex_p]='latex_p,', "'#{base}/#{@fnb}/#{@opt.fns}.tex'," + if FileTest.file?("#{@md.file.output_path.html_concordance.dir}/#{@md.file.base_filename.html_concordance}")==true + f[:concordance],u[:concordance]='concordance,', "'#{@md.file.output_path.html_concordance.url}/#{@md.file.base_filename.html_concordance}'," end - if FileTest.file?("#{out}/#{@fnb}/#{@opt.fns}.landscape.tex")==true - f[:latex_l],u[:latex_l]='latex_l,', "'#{base}/#{@fnb}/#{@opt}.fns}.landscape.tex'," + #if FileTest.file?("#{@md.file.output_path.x.dir}/#{@md.file.base_filename.x}")==true + # f[:latex_p],u[:latex_p]='latex_p,', "'#{@md.file.output_path.x.url}/#{@md.file.base_filename.x}'," + #end + ##if FileTest.file?("#{out}/#{@fnb}/#{@opt.fns}.tex")==true + ## f[:latex_p],u[:latex_p]='latex_p,', "'#{base}/#{@fnb}/#{@opt.fns}.tex'," + ##end + #if FileTest.file?("#{@md.file.output_path.x.dir}/#{@md.file.base_filename.x}")==true + # f[:latex_l],u[:latex_l]='latex_l,', "'#{@md.file.output_path.x.url}/#{@md.file.base_filename.x}'," + #end + ##if FileTest.file?("#{out}/#{@fnb}/#{@opt.fns}.landscape.tex")==true + ## f[:latex_l],u[:latex_l]='latex_l,', "'#{base}/#{@fnb}/#{@opt}.fns}.landscape.tex'," + ##end + if FileTest.file?("#{@md.file.output_path.digest.dir}/#{@md.file.base_filename.digest}")==true + f[:digest],u[:digest]='digest,', "'#{@md.file.output_path.digest.url}/#{@md.file.base_filename.digest}'," end - if FileTest.file?("#{out}/#{@fnb}/#{@md.fn[:digest]}")==true - f[:digest],u[:digest]='digest,', "'#{base}/#{@fnb}/#{@md.fn[:digest]}'," + if FileTest.file?("#{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}")==true #revisit, was to be text, this is html + f[:manifest],u[:manifest]='manifest,', "'#{@md.file.output_path.manifest.url}/#{@md.file.base_filename.manifest}'," end - if FileTest.file?("#{out}/#{@fnb}/#{@md.fn[:manifest]}")==true #revisit, was to be text, this is html - f[:manifest],u[:manifest]='manifest,', "'#{base}/#{@fnb}/#{@md.fn[:manifest]}'," + if FileTest.file?("#{@md.file.output_path.src.dir}/#{@md.file.base_filename.src}")==true + f[:markup],u[:markup]='markup,', "'#{@md.file.output_path.src.url}/#{@md.file.base_filename.src}'," end - if FileTest.file?("#{out}/#{@fnb}/#{@opt.fns}.meta")==true - f[:markup],u[:markup]='markup,', "'#{base}/#{@fnb}/#{@opt.fns}.meta'," + if FileTest.file?("#{@md.file.output_path.sisupod.dir}/#{@md.file.base_filename.sisupod}")==true + f[:sisupod],u[:sisupod]='sisupod,', "'#{@md.file.output_path.sisupod.url}/#{@md.file.base_filename.sisupod}'," end - if FileTest.file?("#{out}/#{@fnb}/#{@opt.fns}.tgz")==true - f[:sisupod],u[:sisupod]='sisupod,', "'#{base}/#{@fnb}/#{@opt.fns}.tgz'," - end - t=SiSU_DB_tuple::Load_urls.new(@conn,f,u,@@id_t,@opt,@file) + t=SiSU_DbTuple::LoadUrls.new(@conn,f,u,@@id_t,@opt,@file) tuple=t.tuple - rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error + rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error ensure end tuple diff --git a/lib/sisu/v3/db_indexes.rb b/lib/sisu/v3/db_indexes.rb index 5e387e27..f61c584f 100644 --- a/lib/sisu/v3/db_indexes.rb +++ b/lib/sisu/v3/db_indexes.rb @@ -57,7 +57,7 @@ sqlite =end -module SiSU_DB_index +module SiSU_DbIndex class Index # create documents Indexes def initialize(opt,conn='',sql_type='') def initialize(opt,conn,file,sql_type='') @opt,@conn,@file,@sql_type=opt,conn,file,sql_type diff --git a/lib/sisu/v3/db_load_tuple.rb b/lib/sisu/v3/db_load_tuple.rb index 812e8e5a..c3273ace 100644 --- a/lib/sisu/v3/db_load_tuple.rb +++ b/lib/sisu/v3/db_load_tuple.rb @@ -57,9 +57,9 @@ sqlite =end -module SiSU_DB_tuple +module SiSU_DbTuple require_relative 'db_columns' # db_columns.rb - class Load_documents + class LoadDocuments require_relative 'param' # param.rb include SiSU_Param def initialize(conn,col,opt,file) @@ -114,10 +114,10 @@ module SiSU_DB_tuple sql_entry end end - class Load_metadata #< SiSU_DB_columns::Columns + class LoadMetadata #< SiSU_DbColumns::Columns def initialize(conn,id,md,file) @conn,@id,@md,@file=conn,id,md,file - @tp=SiSU_DB_columns::Columns.new(md) + @tp=SiSU_DbColumns::Columns.new(md) end def tuple sql_entry="INSERT INTO metadata_and_text ( @@ -299,7 +299,7 @@ tid) sql_entry end end - class Load_urls + class LoadUrls def initialize(conn,f,u,id,opt,file) @conn,@f,@u,@id,@opt,@file=conn,f,u,id,opt,file end @@ -314,7 +314,7 @@ tid) sql_entry end end - class Load_endnotes + class LoadEndnotes def initialize(conn,en,opt,file) @conn,@en,@opt,@file=conn,en,opt,file end diff --git a/lib/sisu/v3/db_remove.rb b/lib/sisu/v3/db_remove.rb index 8147cda1..e34a0a93 100644 --- a/lib/sisu/v3/db_remove.rb +++ b/lib/sisu/v3/db_remove.rb @@ -57,13 +57,13 @@ sqlite =end -module SiSU_DB_remove +module SiSU_DbRemove class Remove def initialize(opt,conn,file,sql_type) @opt,@conn,@file,@sql_type=opt,conn,file,sql_type @md=SiSU_Param::Parameters.new(@opt).get @fnb=@md.fnb - @db=SiSU_Env::Info_db.new + @db=SiSU_Env::InfoDb.new end def remove driver_sqlite3=if @sql_type=='sqlite' diff --git a/lib/sisu/v3/db_select.rb b/lib/sisu/v3/db_select.rb index bce2b21c..52fbe8ba 100644 --- a/lib/sisu/v3/db_select.rb +++ b/lib/sisu/v3/db_select.rb @@ -57,20 +57,20 @@ sqlite =end -module SiSU_DB_select +module SiSU_DbSelect class Case def initialize(opt,conn='',sql_type='pg') @opt,@conn,@sql_type=opt,conn,sql_type - @db=SiSU_Env::Info_db.new + @db=SiSU_Env::InfoDb.new @file=sql_maintenance_file - @sdb=SiSU_DB_DBI::Create.new(@opt,@conn,@file,@sql_type) # db_dbi.rb - @sdb_index=SiSU_DB_DBI::Index.new(@opt,@conn,@file,@sql_type) # db_dbi.rb - @sdb_no=SiSU_DB_DBI::Drop.new(@opt,@conn,@db,@sql_type) # db_dbi.rb + @sdb=SiSU_DbDBI::Create.new(@opt,@conn,@file,@sql_type) # db_dbi.rb + @sdb_index=SiSU_DbDBI::Index.new(@opt,@conn,@file,@sql_type) # db_dbi.rb + @sdb_no=SiSU_DbDBI::Drop.new(@opt,@conn,@db,@sql_type) # db_dbi.rb if @opt.mod.inspect =~/update|import/ - @sdb_import=SiSU_DB_DBI::Import.new(@opt,@conn,@file,@sql_type) - @sdb_remove_doc=SiSU_DB_DBI::Remove.new(@opt,@conn,@file,@sql_type) + @sdb_import=SiSU_DbDBI::Import.new(@opt,@conn,@file,@sql_type) + @sdb_remove_doc=SiSU_DbDBI::Remove.new(@opt,@conn,@file,@sql_type) elsif @opt.mod.inspect =~/remove/ - @sdb_remove_doc=SiSU_DB_DBI::Remove.new(@opt,@conn,@file,@sql_type) + @sdb_remove_doc=SiSU_DbDBI::Remove.new(@opt,@conn,@file,@sql_type) end end def db_exist? @@ -90,9 +90,9 @@ module SiSU_DB_select def sql_maintenance_file file=if @opt.inspect =~/M/ x=if @opt.fns and not @opt.fns.empty? - @env=SiSU_Env::Info_env.new(@opt.fns) if @opt.fns + @env=SiSU_Env::InfoEnv.new(@opt.fns) if @opt.fns puts "\n#{@env.processing_path.sqlite}/#{@opt.fns}.sql" if @sql_type =~/sqlite/ and @opt.cmd =~/M/ - @db=SiSU_Env::Info_db.new + @db=SiSU_Env::InfoDb.new @job="sqlite3 #{@db.sqlite.db} < #{@env.processing_path.sqlite}/#{@opt.fns}.sql" File.new("#{@env.processing_path.sqlite}/#{@opt.fns}.sql",'w+') elsif @opt.fns and @opt.fns.inspect =~/create/; nil #sort variations later @@ -108,56 +108,56 @@ module SiSU_DB_select when /^--createdb$/ @sdb.output_dir? begin - @sdb.create_db + @sdb.create_db rescue; @sdb.output_dir? end when /^--(?:init(?:ialize)?|create(?:all)?)$/ @sdb.output_dir? begin - @sdb.create_table.metadata_and_text - @sdb.create_table.doc_objects - @sdb.create_table.endnotes - @sdb.create_table.endnotes_asterisk - @sdb.create_table.endnotes_plus - @sdb.create_table.urls - @sdb_index.create_indexes - rescue; SiSU_Errors::Info_error.new($!,$@,'-D').error; @sdb.output_dir? + @sdb.create_table.metadata_and_text + @sdb.create_table.doc_objects + @sdb.create_table.endnotes + @sdb.create_table.endnotes_asterisk + @sdb.create_table.endnotes_plus + @sdb.create_table.urls + @sdb_index.create_indexes + rescue; SiSU_Errors::InfoError.new($!,$@,'-D').error; @sdb.output_dir? end when /^--createtables?$/ @sdb.output_dir? begin - @sdb.create_table.metadata_and_text - @sdb.create_table.doc_objects - @sdb.create_table.endnotes - @sdb.create_table.endnotes_asterisk - @sdb.create_table.endnotes_plus - @sdb.create_table.urls - @sdb_index.create_indexes + @sdb.create_table.metadata_and_text + @sdb.create_table.doc_objects + @sdb.create_table.endnotes + @sdb.create_table.endnotes_asterisk + @sdb.create_table.endnotes_plus + @sdb.create_table.urls + @sdb_index.create_indexes rescue; @sdb.output_dir? end when /^--recreate$/ @sdb.output_dir? begin - @sdb_no.drop.tables - @sdb.create_table.metadata_and_text - @sdb.create_table.doc_objects - @sdb.create_table.endnotes - @sdb.create_table.endnotes_asterisk - @sdb.create_table.endnotes_plus - @sdb.create_table.urls - @sdb_index.create_indexes + @sdb_no.drop.tables + @sdb.create_table.metadata_and_text + @sdb.create_table.doc_objects + @sdb.create_table.endnotes + @sdb.create_table.endnotes_asterisk + @sdb.create_table.endnotes_plus + @sdb.create_table.urls + @sdb_index.create_indexes rescue; @sdb.output_dir? end when /^--cr(eate)?lex$/ @sdb.output_dir? begin - @sdb.create_table.doc_objects + @sdb.create_table.doc_objects rescue; @sdb.output_dir? end when /^--cr(eate)?metadata$/ @sdb.output_dir? begin - @sdb.create_table.metadata_and_text + @sdb.create_table.metadata_and_text rescue; @sdb.output_dir? end when /^--import$/ @@ -196,6 +196,7 @@ module SiSU_DB_select db_exist? @sdb_no.drop.tables when /^--(?:db=)?(?:(?:sq)?lite|pg(?:sql)?|my(?:sql)?)$/ + when /^--(?:v\d+|dev)$/ else help=SiSU_Help::Help.new help.summary diff --git a/lib/sisu/v3/db_sqltxt.rb b/lib/sisu/v3/db_sqltxt.rb index d1705c2b..e65a8521 100644 --- a/lib/sisu/v3/db_sqltxt.rb +++ b/lib/sisu/v3/db_sqltxt.rb @@ -56,49 +56,48 @@ ** Description: system environment, resource control and configuration details =end -module SiSU_DB_text +module SiSU_DbText class Prepare def special_character_escape(str) - str.gsub!(/'/,"''") #string.gsub!(/'/,"\047") #string.gsub!(/'/,"\\'") - str.gsub!(/(\\)/m,'\1\1') #ok but with warnings, double backslash on sqlite #str.gsub!(/[\\]/m,'\\x5C') #ok but with warnings, but not for sqlite #str.gsub!(/(\\)/m,'\1') #ok for sqlite not for pgsql - str.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"
\n") - str.gsub!(/#{Mx[:tag_o]}\S+?#{Mx[:tag_c]}/,'') #check - str.gsub!(/#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg))(?:\s+\d+x\d+)?(.+?)#{Mx[:lnk_c]}\S+/,'[image: \1] \2') - str.gsub!(/#{Mx[:lnk_o]}\s*(.+?)\s*#{Mx[:lnk_c]}(?:file|ftp):\/\/\S+?([.,!?]?(?:\s|$))/,'\1\2') - str.gsub!(/#{Mx[:lnk_o]}\s*(.+?)\s*#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,'\1') - str + str=str.gsub(/'/,"''"). #string.gsub!(/'/,"\047") #string.gsub!(/'/,"\\'") + gsub(/(\\)/m,'\1\1'). #ok but with warnings, double backslash on sqlite #str.gsub!(/[\\]/m,'\\x5C') #ok but with warnings, but not for sqlite #str.gsub!(/(\\)/m,'\1') #ok for sqlite not for pgsql + gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"
\n"). + gsub(/#{Mx[:tag_o]}\S+?#{Mx[:tag_c]}/,''). #check + gsub(/#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg))(?:\s+\d+x\d+)?(.+?)#{Mx[:lnk_c]}\S+/,'[image: \1] \2'). + gsub(/#{Mx[:lnk_o]}\s*(.+?)\s*#{Mx[:lnk_c]}(?:file|ftp):\/\/\S+?([.,!?]?(?:\s|$))/,'\1\2'). + gsub(/#{Mx[:lnk_o]}\s*(.+?)\s*#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,'\1') end def clean_searchable_text(arr) #produce clean, searchable, plaintext from document source txt_arr,en=[],[] arr=arr.class==String ? arr.split(/\n+/m) : arr arr.each do |s| - s.gsub!(/([*\/_-])\{(.+?)\}\1/m,'\2') - s.gsub!(/^(?:block|group|poem|code)\{/m,''); s.gsub!(/^\}(?:block|group|poem|code)/m,'') - s.gsub!(/\A(?:@\S+:\s+.+)\Z/m,'') + s=s.gsub(/([*\/_-])\{(.+?)\}\1/m,'\2'). + gsub(/^(?:block|group|poem|code)\{/m,'').gsub(/^\}(?:block|group|poem|code)/m,''). + gsub(/\A(?:@\S+:\s+.+)\Z/m,'') if s =~/^:A~/ if defined? @md.creator \ and defined? @md.creator.author \ and not @md.creator.author.empty? - s.gsub!(/@author/,@md.creator.author) + s=s.gsub(/@author/,@md.creator.author) else SiSU_Screen::Ansi.new('v','WARNING Document Author information missing; provide @creator: :author:',@md.fnb).warn unless @md.opt.cmd.inspect =~/q/ end if defined? @md.title \ and defined? @md.title.full \ and not @md.title.full.empty? - s.gsub!(/@title/,@md.title.full) + s=s.gsub(/@title/,@md.title.full) else SiSU_Screen::Ansi.new('v','WARNING Document Title missing; provide @title:',@md.fnb).warn unless @md.opt.cmd.inspect =~/q/ end end - s.gsub!(/^(?:_[1-9]\*?|_\*)\s+/m,'') - s.gsub!(/^(?:[1-9]\~(\S+)?)\s+/m,'') - s.gsub!(/^(?::?[A-C]\~(\S+)?)\s+/m,'') - s.gsub!(/^%{1,3} .+/m,'') #removed even if contained in code block - s.gsub!(/
/m,' ') + s=s.gsub(/^(?:_[1-9]\*?|_\*)\s+/m,''). + gsub(/^(?:[1-9]\~(\S+)?)\s+/m,''). + gsub(/^(?::?[A-C]\~(\S+)?)\s+/m,''). + gsub(/^%{1,3} .+/m,''). #removed even if contained in code block + gsub(/
/m,' ') en << s.scan(/~\{\s*(.+?)\s*\}~/m) - s.gsub!(/~\{.+?\}~/m,'') - s.gsub!(/ \s+/m,' ') + s=s.gsub(/~\{.+?\}~/m,''). + gsub(/ \s+/m,' ') #special_character_escape(s) s end @@ -109,17 +108,16 @@ module SiSU_DB_text txt end def strip_markup(str) #define rules, make same as in dal clean - str.gsub!(/#{Mx[:fa_superscript_o]}(\d+)#{Mx[:fa_superscript_c]}/,'[\1]') - str.gsub!(/(?: \\;|#{Mx[:nbsp]})+/,' ') - str.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}\d+(.+)#{Mx[:tc_c]}/u,'\1') #tables - str.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}\d+#{Mx[:tc_p]}/u,' ') #tables - str.gsub!(/#{Mx[:tc_p]}/u,' ') #tables tidy later - str.gsub!(/<.+?>/,'') - str.gsub!(/#{Mx[:lnk_o]}.+?\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:file|ftp)\/\/:\S+ /,' [image] ') # else image names found in search - str.gsub!(/#{Mx[:lnk_o]}.+?\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,' [image]') # else image names found in search - str.gsub!(/\s\s+/,' ') - str.strip! - str + str=str.gsub(/#{Mx[:fa_superscript_o]}(\d+)#{Mx[:fa_superscript_c]}/,'[\1]'). + gsub(/(?: \\;|#{Mx[:nbsp]})+/,' '). + gsub(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}\d+(.+)#{Mx[:tc_c]}/u,'\1'). #tables + gsub(/#{Mx[:tc_p]}#{Mx[:tc_p]}\d+#{Mx[:tc_p]}/u,' '). #tables + gsub(/#{Mx[:tc_p]}/u,' '). #tables tidy later + gsub(/<.+?>/,''). + gsub(/#{Mx[:lnk_o]}.+?\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:file|ftp)\/\/:\S+ /,' [image] '). # else image names found in search + gsub(/#{Mx[:lnk_o]}.+?\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,' [image]'). # else image names found in search + gsub(/\s\s+/,' '). + strip end def unique_words(str) a=str.scan(/[a-zA-Z0-9\\\/_-]{2,}/) #a=str.scan(/\S+{2,}/) diff --git a/lib/sisu/v3/db_tests.rb b/lib/sisu/v3/db_tests.rb index 0fe1370b..3bef2f5f 100644 --- a/lib/sisu/v3/db_tests.rb +++ b/lib/sisu/v3/db_tests.rb @@ -57,7 +57,7 @@ sqlite =end -module SiSU_DB_tests +module SiSU_DbTests class Test def initialize(info,opt) @ck,@opt=info,opt diff --git a/lib/sisu/v3/dbi.rb b/lib/sisu/v3/dbi.rb index 008ac5d4..f11d9e81 100644 --- a/lib/sisu/v3/dbi.rb +++ b/lib/sisu/v3/dbi.rb @@ -63,15 +63,15 @@ module SiSU_DBI require_relative 'param' # param.rb include SiSU_Param require_relative 'db_dbi' # db_dbi.rb - include SiSU_DB_DBI + include SiSU_DbDBI require_relative 'shared_html_lite' # shared_html_lite.rb - include SiSU_Format_Shared - class SiSU_SQL + include SiSU_FormatShared + class SQL def initialize(opt) SiSU_Env::Load.new('dbi',true).prog @opt=opt - @db=SiSU_Env::Info_db.new - if @opt.cmd =~/d/i \ + @db=SiSU_Env::InfoDb.new + if @opt.cmd =~/[Dd]/ \ or @opt.mod.inspect =~/--(pg(?:sql)?|(?:sq)?lite)/ @sql_type=if @opt.cmd=~/D/ \ or @opt.mod.inspect =~/--pg(?:sql)?/ @@ -108,7 +108,7 @@ module SiSU_DBI puts %{manually create the database: "#{@db.db}" if it does not yet exist} #sudo su -p postgres; createdb #{@db.db}; #[createuser?] end - SiSU_DB_DBI::Case.new(@opt,@conn,@sql_type).cases + SiSU_DbDBI::Case.new(@opt,@conn,@sql_type).cases @conn=DBI.connect(@db.dbi,@db.user,@db.db) ensure end @@ -128,9 +128,9 @@ module SiSU_DBI end SiSU_Screen::Ansi.new(@opt.cmd,"DBI (#{@sql_type}) #{@opt.mod}",@opt.fns).dbi_title unless @opt.cmd =~/q/ begin - SiSU_DB_DBI::Case.new(@opt,@conn,@sql_type).cases + SiSU_DbDBI::Case.new(@opt,@conn,@sql_type).cases rescue - SiSU_Errors::Info_error.new($!,$@,@cf,@opt.fns).error + SiSU_Errors::InfoError.new($!,$@,@cf,@opt.fns).error ensure end begin diff --git a/lib/sisu/v3/dbi_discreet.rb b/lib/sisu/v3/dbi_discreet.rb new file mode 100644 index 00000000..d9ecd8e7 --- /dev/null +++ b/lib/sisu/v3/dbi_discreet.rb @@ -0,0 +1,158 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997 - 2012, Ralph Amissah, All Rights Reserved. + + * License: GPL 3 or later: + + SiSU, a framework for document structuring, publishing and search + + Copyright (C) Ralph Amissah + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program. If not, see . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: postgresql module, dbi import frame + +=end +module SiSU_DBI_Discreet #% database building + require_relative 'help' # help.rb + require_relative 'sysenv' # sysenv.rb + include SiSU_Env; include SiSU_Screen + require_relative 'param' # param.rb + include SiSU_Param + require_relative 'db_dbi' # db_dbi.rb + include SiSU_DbDBI + require_relative 'shared_html_lite' # shared_html_lite.rb + include SiSU_FormatShared + require 'fileutils' + include FileUtils::Verbose + class SQL + def initialize(opt) + SiSU_Env::Load.new('dbi',true).prog + @opt=opt + @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt) + @md=@particulars.md + if @opt.cmd =~/[d]/ \ + or @opt.mod.inspect =~/--((?:sq)?lite)/ + @sql_type='sqlite' + maintenance_check(@opt,__FILE__,__LINE__) if @opt.cmd.inspect =~/M/ + end + @output_path=@md.file.output_path.sqlite_discreet.dir + @filename=@md.file.base_filename.sqlite_discreet + @file="#{@output_path}/#{@filename}" + end + def build + prepare + create_and_populate + end + def maintenance_check(opt,file,line) + p opt.mod + p opt.cmd + p "at #{file} #{line}" + end + def prepare + if not FileTest.directory?(@output_path) + FileUtils::mkdir_p(@output_path) + elsif @file + FileUtils::rm_rf(@file) + end + end + def db_exist?(db,conn) + msg=%{no connection with sqlite database established, createdb "#{db.sqlite.db}"?} + if (not (FileTest.file?(db.sqlite.db)) \ + or FileTest.zero?(db.sqlite.db)) + puts msg + exit + end + if conn.class==NilClass + puts msg + exit + end + end + def create_and_populate + db=SiSU_Env::DbOp.new(@md) + conn=db.sqlite_discreet.conn_sqlite3 + sdb=SiSU_DbDBI::Create.new(@opt,conn,@file,'sqlite') + sdb_index=SiSU_DbDBI::Index.new(@opt,conn,@file,'sqlite') + sdb.output_dir? + begin + sdb.create_db + sdb.create_table.metadata_and_text + sdb.create_table.doc_objects + sdb.create_table.endnotes + sdb.create_table.endnotes_asterisk + sdb.create_table.endnotes_plus + sdb.create_table.urls + sdb_index.create_indexes + db_exist?(db,conn) + sdb_import=SiSU_DbDBI::Import.new(@opt,conn,@file,'sqlite') + sdb_import.marshal_load + tell=SiSU_Screen::Ansi.new(@opt.cmd,"sqlite3 #{db.sqlite.db} database?") + tell.puts_grey if @opt.cmd =~/v/ + rescue; SiSU_Errors::InfoError.new($!,$@,'-d').error; sdb.output_dir? + end + end + def read_sqlite + begin + @conn=@db.sqlite.conn_sqlite3 + rescue + ensure + end + end + def connect + begin + sql_type='sqlite' + SiSU_Screen::Ansi.new(@opt.cmd,"DBI (#{@sql_type}) #{@opt.mod}",@opt.fns).dbi_title unless @opt.cmd =~/q/ + @db.sqlite_discreet.conn_sqlite3 + rescue + SiSU_Errors::InfoError.new($!,$@,@cf,@opt.fns).error + ensure + end + end + def populate + end + end +end +__END__ diff --git a/lib/sisu/v3/defaults.rb b/lib/sisu/v3/defaults.rb index 7278c5f9..e74ff83c 100644 --- a/lib/sisu/v3/defaults.rb +++ b/lib/sisu/v3/defaults.rb @@ -66,9 +66,9 @@ module SiSU_Viz 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::Info_env.new - @date=SiSU_Env::Info_date.new #{@date.year} - @v=SiSU_Env::Info_version.instance.get_version + @dir=SiSU_Env::InfoEnv.new + @date=SiSU_Env::InfoDate.new #{@date.year} + @v=SiSU_Env::InfoVersion.instance.get_version end #% glyph def glyph_bullet # • @@ -735,8 +735,8 @@ module SiSU_Viz when /\/i$/; 'i' else '' end - r.gsub!(/^\/(.+?)\/i?/,'\1') - r.gsub!(/\(/,'(?:') # avoid need to escape use of brackets within regex provided + r=r.gsub(/^\/(.+?)\/i?/,'\1'). + gsub(/\(/,'(?:') # avoid need to escape use of brackets within regex provided m='\b(' + r + ')\b' make[:str] make[:regx]=if x =~/i/; /#{m}/i @@ -756,8 +756,8 @@ module SiSU_Viz when /\/i$/; 'i' else '' end - r.gsub!(/^\/(.+?)\/i?/,'\1') - r.gsub!(/\(/,'(?:') # avoid need to escape use of brackets within regex provided + r.gsub(/^\/(.+?)\/i?/,'\1'). + gsub(/\(/,'(?:') # avoid need to escape use of brackets within regex provided m='\b(' + r + ')\b' make[:str] make[:regx]=if x =~/i/; /#{m}/i @@ -957,7 +957,7 @@ module SiSU_Viz } end def png_hp - dir=SiSU_Env::Info_env.new #(@fns) + dir=SiSU_Env::InfoEnv.new #(@fns) %{ #{txt_home} } @@ -1029,7 +1029,7 @@ module SiSU_Viz %{lateral hop} end def png_home - #dir=SiSU_Env::Info_env.new #(@fns) + #dir=SiSU_Env::InfoEnv.new #(@fns) %{#{txt_home} -->} #%{#{txt_home} -->} end @@ -1040,7 +1040,7 @@ module SiSU_Viz def png_book %{Cameron May Books} end - #% png_nav + #% png_nav #not currently used def png_nav_home end def png_nav_toc @@ -1724,9 +1724,9 @@ WOK end class Home < Skin def initialize - @v=SiSU_Env::Info_version.instance.get_version - @dir=SiSU_Env::Info_env.new - @date=SiSU_Env::Info_date.new #{@date.year} + @v=SiSU_Env::InfoVersion.instance.get_version + @dir=SiSU_Env::InfoEnv.new + @date=SiSU_Env::InfoDate.new #{@date.year} end def redirect <

- License, SiSU is licensed under + License, SiSU is licensed under GPLv3 or later @@ -2032,7 +2032,7 @@ as a developers tool it is flexible and extensible


-SiSU at <www.sisudoc.org> or <www.jus.uio.no/sisu/>

+SiSU at <www.sisudoc.org> or <www.jus.uio.no/sisu/>

diff --git a/lib/sisu/v3/digests.rb b/lib/sisu/v3/digests.rb index 4062b029..bc4a37e5 100644 --- a/lib/sisu/v3/digests.rb +++ b/lib/sisu/v3/digests.rb @@ -56,7 +56,7 @@ ** Description: document digests (md5|sha256) and structure processing =end -module SiSU_Digest_view +module SiSU_DigestView require_relative 'particulars' # particulars.rb require_relative 'prog_text_translation' # prog_text_translation.rb require_relative 'shared_markup_alt.rb' # shared_markup_alt.rb @@ -68,8 +68,8 @@ module SiSU_Digest_view @fnb=@opt.fnb @@endnotes_para=[] @@dg=nil - @dg=@@dg ||=SiSU_Env::Info_env.new.digest.type - @particulars=SiSU_Particulars::Combined_singleton.instance.get_all(opt) + @dg=@@dg ||=SiSU_Env::InfoEnv.new.digest.type + @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt) end def read begin @@ -83,9 +83,9 @@ module SiSU_Digest_view : SiSU_Screen::Ansi.new(@opt.cmd,"Document #{@dg} Digests",tool).green_title_hi 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_Digest_view::Source::Scroll.new(@particulars).songsheet - SiSU_Env::Info_skin.new(@md).select - rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error + SiSU_DigestView::Source::Scroll.new(@particulars).songsheet + SiSU_Env::InfoSkin.new(@md).select + rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error ensure end end @@ -97,11 +97,11 @@ module SiSU_Digest_view def initialize(particulars) #data='',md='') @particulars=particulars @data,@env,@md=@particulars.dal_array,@particulars.env,@particulars.md - SiSU_Env::SiSU_file.new(@md).mkdir + SiSU_Env::FileOp.new(@md).mkdir @@dg ||=@env.digest.type @@dl ||=@env.digest.length @dg,@dl=@@dg,@@dl - l=SiSU_Env::Standardise_language.new(@md.opt.lng).language + l=SiSU_Env::StandardiseLanguage.new(@md.opt.lng).language @language=l[:n] @tr=SiSU_Translate::Source.new(@md,@language) @sp=' ' @@ -134,7 +134,7 @@ module SiSU_Digest_view @@sc_info << f << e end def output - file=SiSU_Env::SiSU_file.new(@md) + file=SiSU_Env::FileOp.new(@md) filename_digest=file.write_file.hash_digest filename_digest << @@description.join << @@ds[:digests].join << @@ds[:tree].join << @@ds[:summary].join << @@sc_info.join end @@ -143,7 +143,7 @@ module SiSU_Digest_view end def message_digest data=@data - sys=SiSU_Env::System_call.new + sys=SiSU_Env::SystemCall.new l=Hash.new(0) @p=[] @g,@v,@r='','','' @@ -153,9 +153,9 @@ module SiSU_Digest_view if para =~/#{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]}/ ocn,h1,h2,d_clean,d_all=$1,$2,$3,$4,$5 @ocn=ocn unless ocn.to_i==0 - para.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\1') - para.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\1') - para.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\1') + para=para.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\1'). + gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\1'). + gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\1') if para=~/#{Mx[:en_a_o]}[\d*+]+.+?#{Mx[:id_o]}[0-9a-f]{#{@dl}}#{Mx[:id_c]}#{Mx[:en_a_c]}/ para_endnotes << para.scan(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})([\d*+]+).+?#{Mx[:id_o]}([0-9a-f]{#{@dl}})#{Mx[:id_c]}(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/) end @@ -298,11 +298,11 @@ module SiSU_Digest_view data=@data endnotes=nil data.each do |t_o| - dgst=SiSU_text_representation::Modified_text_plus_Hash_digest.new(@md,t_o).composite.dgst + dgst=SiSU_TextRepresentation::ModifiedTextPlusHashDigest.new(@md,t_o).composite.dgst if dgst - if t_o.is=='heading' + if t_o.is==:heading digests("#{@sp*0}#{dgst[:ocn]}#{@sp*(8-dgst[:ocn].to_s.length)}#{dgst[:dgst_stripped_txt]} #{dgst[:dgst_markedup_txt]} #{dgst[:is]} #{t_o.lv}") - elsif t_o.is=='heading_insert' + elsif t_o.is==:heading_insert digests("#{@sp*0}[#{dgst[:ocn]}]#{@sp*(6-dgst[:ocn].to_s.length)}#{dgst[:dgst_stripped_txt]} #{dgst[:dgst_markedup_txt]} #{dgst[:is]} #{t_o.lv}") else digests("#{@sp*0}#{dgst[:ocn]}#{@sp*(8-dgst[:ocn].to_s.length)}#{dgst[:dgst_stripped_txt]} #{dgst[:dgst_markedup_txt]} #{dgst[:is]}") @@ -325,7 +325,7 @@ module SiSU_Digest_view dal_structure_tree("------------\n") dal_structure_tree("document structure[*]\n") data.each do |t_o| - if t_o.is=='heading' + if t_o.is==:heading x=case t_o.ln when 1; l[1] +=1 #fix Mx[:lv_o] ' '*0 +':A' @@ -342,7 +342,7 @@ module SiSU_Digest_view else nil end end - ocn=t_o.ocn if defined? t_o.ocn and t_o.is !='heading_insert' + ocn=t_o.ocn if defined? t_o.ocn and t_o.is !=:heading_insert dal_structure_tree("#{x}\n") if x and not x.empty? end dal_structure_tree(" [*] heading levels\n") diff --git a/lib/sisu/v3/embedded.rb b/lib/sisu/v3/embedded.rb index 1dcc4fac..0c73e9e3 100644 --- a/lib/sisu/v3/embedded.rb +++ b/lib/sisu/v3/embedded.rb @@ -65,10 +65,10 @@ module SiSU_Embedded def initialize(opt) @opt=opt @md=SiSU_Param::Parameters.new(@opt).get - @env=SiSU_Env::Info_env.new(@md.fns) - @rhost=SiSU_Env::Info_remote.new(@opt).remote_host_base + @env=SiSU_Env::InfoEnv.new(@md.fns) + @rhost=SiSU_Env::InfoRemote.new(@opt).remote_host_base @base_src_dir=@opt.f_pth[:pth].sub(/\/#{@opt.f_pth[:lng]}$/,'') - @f=SiSU_Env::SiSU_file.new(@md) + @f=SiSU_Env::FileOp.new(@md) end def read songsheet @@ -78,7 +78,7 @@ module SiSU_Embedded audio multimedia begin - rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error + rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error ensure end end @@ -95,9 +95,9 @@ module SiSU_Embedded FileUtils::mkdir_p(img_dir) unless FileTest.directory?(img_dir) src_ec=@f.place_file.images.rel + '/' + @md.ec[:image].join(" #{@f.output_path.images.rel}/") unless @opt.fns =~/\.-sst$/ - SiSU_Env::System_call.new(src_ec,ldest,'q').rsync('--relative',@opt.base_path) + SiSU_Env::SystemCall.new(src_ec,ldest,'q').rsync('--relative',@opt.base_path) #if @md.opt.cmd.inspect =~/R/ #rsync to remote image directory - # SiSU_Env::System_call.new(src_ec,remote_rel,'q').rsync('--relative') + # SiSU_Env::SystemCall.new(src_ec,remote_rel,'q').rsync('--relative') #end end end @@ -113,9 +113,9 @@ module SiSU_Embedded and FileTest.directory?(src) FileUtils::mkdir_p(ldest) unless FileTest.directory?(ldest) src_ec="#{src}/" + @md.ec[:audio].join(" #{src}/") - SiSU_Env::System_call.new(src_ec,"#{ldest}/.",'q').rsync + SiSU_Env::SystemCall.new(src_ec,"#{ldest}/.",'q').rsync if @md.opt.cmd.inspect =~/R/ #rsync to remote audio directory - SiSU_Env::System_call.new(src_ec,"#{rdest}/.",'q').rsync + SiSU_Env::SystemCall.new(src_ec,"#{rdest}/.",'q').rsync end end end @@ -130,9 +130,9 @@ module SiSU_Embedded and FileTest.directory?(src) FileUtils::mkdir_p(ldest) unless FileTest.directory?(ldest) src_ec="#{src}/" + @md.ec[:multimedia].join(" #{src}/") - SiSU_Env::System_call.new(src_ec,"#{ldest}/.",'q').rsync + SiSU_Env::SystemCall.new(src_ec,"#{ldest}/.",'q').rsync if @md.opt.cmd.inspect =~/R/ #rsync to remote video directory - SiSU_Env::System_call.new(src_ec,"#{rdest}/.",'q').rsync + SiSU_Env::SystemCall.new(src_ec,"#{rdest}/.",'q').rsync end end end diff --git a/lib/sisu/v3/epub.rb b/lib/sisu/v3/epub.rb index e0a1d219..e9aeb4de 100644 --- a/lib/sisu/v3/epub.rb +++ b/lib/sisu/v3/epub.rb @@ -66,14 +66,14 @@ module SiSU_EPUB require_relative 'epub_format' # epub_format.rb include SiSU_EPUB_Format require_relative 'epub_segments' # epub_segments.rb - include SiSU_EPUB_seg + include SiSU_EPUB_Seg require_relative 'epub_tune' # epub_tune.rb include SiSU_EPUB_Tune require_relative 'epub_concordance' # epub_concordance.rb class Source def initialize(opt) @opt=opt - @particulars=SiSU_Particulars::Combined_singleton.instance.get_all(opt) + @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt) end def read songsheet @@ -96,18 +96,18 @@ module SiSU_EPUB @env.processing_path.epub_bld #(@md) @env.processing_path.epub_cp_images(@md) dir_epub=@env.processing_path.epub - SiSU_Env::Info_skin.new(@md).select + SiSU_Env::InfoSkin.new(@md).select data=nil - SiSU_Env::SiSU_file.new(@md).mkdir.output.epub - @tuned_file_array=SiSU_EPUB::Source::XHtml_environment.new(@particulars).tuned_file_instructions + SiSU_Env::FileOp.new(@md).mkdir.output.epub + @tuned_file_array=SiSU_EPUB::Source::XHTML_Environment.new(@particulars).tuned_file_instructions data=@tuned_file_array scr_endnotes=SiSU_EPUB::Source::Endnotes.new(@md,data).scroll toc=SiSU_EPUB::Source::Toc.new(@md,data).songsheet data=@tuned_file_array - scr_toc=SiSU_EPUB::Source::Scroll_head_and_segtoc.new(@md,toc).in_common #watch + scr_toc=SiSU_EPUB::Source::ScrollHeadAndSegToc.new(@md,toc).in_common #watch SiSU_EPUB::Source::Seg.new(@md,data).songsheet - SiSU_EPUB::Source::Epub_output.new(@md).songsheet - rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error + SiSU_EPUB::Source::Output.new(@md).songsheet + rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error ensure unless @opt.cmd =~/[MV]/ #check maintenance flag texfiles=Dir["#{@env.processing_path.tune}/#{@opt.fns}*"] @@ -126,19 +126,19 @@ module SiSU_EPUB end end private - class XHtml_environment + class XHTML_Environment def initialize(particulars) @particulars=particulars @md,@env=particulars.md,particulars.env - @vz=SiSU_Env::Get_init.instance.skin - @env,@css,@symlnk=particulars.env,SiSU_Style::CSS.new,SiSU_Env::Create_system_link.new #home + @vz=SiSU_Env::GetInit.instance.skin + @env,@css,@symlnk=particulars.env,SiSU_Style::CSS.new,SiSU_Env::CreateSystemLink.new #home end def link_images @symlnk.images end def directories title=File.basename(@md.fns,'.rb') - SiSU_Env::SiSU_file.new(@md).mkdir.output.epub + SiSU_Env::FileOp.new(@md).mkdir.output.epub end def tuned_file_instructions @tell=SiSU_Screen::Ansi.new(@md.opt.cmd) @@ -157,10 +157,10 @@ module SiSU_EPUB end def scroll @scr_endnotes=[] - format_head_scroll=SiSU_EPUB_Format::Head_scroll.new(@md) + format_head_scroll=SiSU_EPUB_Format::HeadScroll.new(@md) @data.each do |dob| pg=dob.dup - unless pg.is =~/^code/ + unless pg.is ==:code if pg.obj =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[\d*+]+ / endnote_array=[] if pg.obj=~/#{Mx[:en_a_o]}[\d*+].+?#{Mx[:en_a_c]}/m @@ -174,7 +174,7 @@ module SiSU_EPUB end endnote_array.flatten.each do |note| txt_obj={ txt: note } - format_scroll=SiSU_EPUB_Format::Format_scroll.new(@md,txt_obj) + format_scroll=SiSU_EPUB_Format::FormatScroll.new(@md,txt_obj) @scr_endnotes << format_scroll.endnote_body end end @@ -189,9 +189,10 @@ module SiSU_EPUB @@firstseg=nil def initialize(md=nil,data='') @md,@data=md,data - @vz=SiSU_Env::Get_init.instance.skin - @epub=SiSU_EPUB_Format::Head_information.new(@md) + @vz=SiSU_Env::GetInit.instance.skin + @epub=SiSU_EPUB_Format::HeadInformation.new(@md) @tell=SiSU_Screen::Ansi.new(@md.opt.cmd) if @md + @make=SiSU_Env::ProcessingSettings.new(@md) end def songsheet #extracts toc for scroll & seg SiSU_Screen::Ansi.new(@md.opt.cmd,'Toc').txt_grey if @md.opt.cmd =~/[MVv]/ @@ -211,15 +212,17 @@ module SiSU_EPUB @@toc[:seg] << %{

\n
} @@toc[:scr] << %{
\n
} md_opf_a_content << @epub.metadata_opf.manifest_content_sisu_toc - md_opf_a_spine << @epub.metadata_opf.spine_sisu_toc - md_opf_a_guide << @epub.metadata_opf.guide_sisu_toc + if @make.build.toc? + md_opf_a_spine << @epub.metadata_opf.spine_sisu_toc + md_opf_a_guide << @epub.metadata_opf.guide_sisu_toc + end @ncxo=[nil,false,false,false,false,false,false] @dob_toc2,@dob_toc3=nil,nil @ncx_cls=[] @level_a_first_occurrence=true @data.each do |dob| - if dob.is=='heading' \ - or dob.is=='heading_insert' + if dob.is==:heading \ + || dob.is==:heading_insert dob_toc=dob.dup toc=case dob_toc.ln when 1 @@ -234,7 +237,8 @@ module SiSU_EPUB @ncxo[1],@ncxo[2],@ncxo[3],@ncxo[4]=true,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 - if @level_a_first_occurrence + 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 @@ -242,7 +246,7 @@ module SiSU_EPUB 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) - Toc.new(@md,dob_toc).level_1 + 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 @@ -257,7 +261,7 @@ module SiSU_EPUB 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) - Toc.new(@md,dob_toc).level_2 + 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 @@ -271,7 +275,7 @@ module SiSU_EPUB 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) - Toc.new(@md,dob_toc).level_3 + SiSU_EPUB::Source::Toc.new(@md,dob_toc).level_3 when 4 @ncx_cls=[] @nav_no+=1 @@ -281,9 +285,9 @@ module SiSU_EPUB 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.new(@md,dob_toc).level_4 - when 5; Toc.new(@md,dob_toc).level_5 - when 6; Toc.new(@md,dob_toc).level_6 + SiSU_EPUB::Source::Toc.new(@md,dob_toc).level_4 + when 5; SiSU_EPUB::Source::Toc.new(@md,dob_toc).level_5 + when 6; SiSU_EPUB::Source::Toc.new(@md,dob_toc).level_6 else nil end toc.each do |k,d| @@ -298,8 +302,7 @@ module SiSU_EPUB begin @@toc[:seg] << toc[:seg] @@toc[:scr] << toc[:seg] - @@toc[:seg_mini] << toc[:seg_mini] if toc[:seg_mini] - rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error + rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error end end end @@ -318,22 +321,18 @@ module SiSU_EPUB @@toc[:opf] << @epub.metadata_opf.guide_open << md_opf_a_guide << @epub.metadata_opf.guide_close @@toc[:opf] << @epub.metadata_opf.package_close @@toc[:opf]=@@toc[:opf].flatten - Epub_output.new(@md,@@toc[:opf]).epub_metadata_opf - Epub_output.new(@md,@@toc[:ncx]).epub_toc_ncx + SiSU_EPUB::Source::Output.new(@md,@@toc[:opf]).epub_metadata_opf + SiSU_EPUB::Source::Output.new(@md,@@toc[:ncx]).epub_toc_ncx @md.firstseg=@@firstseg @@toc end - def minitoc - minitoc=@@toc[:seg_mini].join("\n") - '
' + minitoc + '
' - end protected def level_1 dob=@data linkname,link=dob.obj.strip,dob.ocn if link \ and link !~/#/ #% keep eye on link - p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,link) + p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,link) end title=if dob.obj !~/Document Information/; linkname else @@ -342,20 +341,12 @@ module SiSU_EPUB end toc={} txt_obj={ txt: title } - format_toc=SiSU_EPUB_Format::Format_toc.new(@md,txt_obj) + format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj) toc[:seg]=if dob.name =~/^meta/ \ and dob.obj =~/Document Information/ #check format_toc.lev0 else format_toc.lev1 end - toc[:seg_mini]=if dob.name =~/^meta/ \ - and dob.obj =~/Document Information/ #check - x=if @md.concord_make - format_toc.mini_concord_tail - else format_toc.mini_tail - end - else format_toc.mini_lev1 - end title=if dob.ocn ==0 if dob.name =~/^meta/ \ and dob.obj =~/Document Information/ @@ -370,7 +361,7 @@ module SiSU_EPUB %{#{linkname}} end txt_obj={ txt: title } - format_toc=SiSU_EPUB_Format::Format_toc.new(@md,txt_obj) + format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj) toc[:scr]=if dob.name =~/^meta/ \ and dob.obj =~/Document Information/ format_toc.lev0 @@ -383,17 +374,16 @@ module SiSU_EPUB linkname,ocn=dob.obj.strip,dob.ocn if ocn \ and ocn !~/#/ - p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,ocn) + p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn) end txt_obj={ txt: linkname } - format_toc=SiSU_EPUB_Format::Format_toc.new(@md,txt_obj) + format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj) toc={} toc[:seg]=format_toc.lev2 - toc[:seg_mini]=format_toc.mini_lev2 if p_num title=%{#{p_num.goto}#{linkname}} txt_obj={ txt: title } - format_toc=SiSU_EPUB_Format::Format_toc.new(@md,txt_obj) + format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj) toc[:scr]=format_toc.lev2 end toc @@ -403,17 +393,16 @@ module SiSU_EPUB linkname,ocn=dob.obj.strip,dob.ocn if ocn \ and ocn !~/#/ - p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,ocn) + p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn) end txt_obj={ txt: linkname } - format_toc=SiSU_EPUB_Format::Format_toc.new(@md,txt_obj) + format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj) toc={} toc[:seg]=format_toc.lev3 - toc[:seg_mini]=format_toc.mini_lev3 if p_num title=%{#{p_num.goto}#{linkname}} txt_obj={ txt: title } - format_toc=SiSU_EPUB_Format::Format_toc.new(@md,txt_obj) + format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj) toc[:scr]=format_toc.lev3 end toc @@ -421,7 +410,7 @@ module SiSU_EPUB def level_4 dob=@data linkname,ocn=dob.obj.strip,dob.ocn - p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,ocn) if ocn + p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn) if ocn if dob.ln==4 seg_link=%{ #{dob.obj} @@ -432,15 +421,14 @@ module SiSU_EPUB %{} + %{\\1 \\2 }) end - p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,ocn) if ocn + p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn) if ocn txt_obj={ txt: seg_link } - format_toc=SiSU_EPUB_Format::Format_toc.new(@md,txt_obj) + format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj) toc={} toc[:seg]=format_toc.lev4 - toc[:seg_mini]=format_toc.mini_lev4 title=%{#{p_num.goto}#{linkname}} if p_num txt_obj={ txt: title } - format_toc=SiSU_EPUB_Format::Format_toc.new(@md,txt_obj) + format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj) toc[:scr]=format_toc.lev4 toc end @@ -450,17 +438,16 @@ module SiSU_EPUB toc={} if ocn \ and ocn !~/#/ - p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,ocn) + p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn) lnk_n_txt=%{ #{linkname} } txt_obj={ txt: lnk_n_txt } - format_toc=SiSU_EPUB_Format::Format_toc.new(@md,txt_obj) + format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj) toc[:seg]=format_toc.lev5 - toc[:seg_mini]=format_toc.mini_lev5 title=%{#{p_num.goto}#{linkname}} txt_obj={ txt: title } - format_toc=SiSU_EPUB_Format::Format_toc.new(@md,txt_obj) + format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj) toc[:scr]=format_toc.lev5 end toc @@ -471,72 +458,48 @@ module SiSU_EPUB toc={} if ocn \ and ocn !~/#/ - p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,ocn) + p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn) lnk_n_txt=%{ #{linkname} } txt_obj={ txt: lnk_n_txt } - format_toc=SiSU_EPUB_Format::Format_toc.new(@md,txt_obj) + format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj) toc[:seg]=format_toc.lev6 - toc[:seg_mini]=format_toc.mini_lev6 title=%{#{p_num.goto}#{linkname}} txt_obj={ txt: title } - format_toc=SiSU_EPUB_Format::Format_toc.new(@md,txt_obj) + format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj) toc[:scr]=format_toc.lev6 end toc end - def level_crosslink - dob=@data - if dob !~/^4~!/ - dob.gsub!(/^4~!\s+(\S+)\s+(.+)/, - %{ -
- #{@png.crosslink_ext} -   \\2 - <\/a> -
-}) - else - dob.gsub!(/^4~!\s+(\S+)\s+(.+)/, - %{
- - - #{@png.crosslink} -   \\2 - <\/a> -
-}) - end - end end - class Scroll_head_and_segtoc < Toc + class ScrollHeadAndSegToc < Toc def initialize(md='',toc='',links_guide_toc='') @md,@toc,@links_guide_toc=md,toc,links_guide_toc - @vz=SiSU_Env::Get_init.instance.skin + @vz=SiSU_Env::GetInit.instance.skin end def in_common toc_shared=[] segtoc=[] SiSU_Screen::Ansi.new(@md.opt.cmd,'Scroll & Segtoc').txt_grey if @md.opt.cmd =~/[MVv]/ - format_head_toc=SiSU_EPUB_Format::Head_toc.new(@md) + format_head_toc=SiSU_EPUB_Format::HeadToc.new(@md) dochead=format_head_toc.head - dochead.gsub!(/toc\.(html)/,'doc.\1') #kludge + dochead=dochead.gsub(/toc\.(html)/,'doc.\1') #kludge toc_shared << dochead #<< ads.div.major segtoc << format_head_toc.head #<< ads.div.major - if SiSU_EPUB_Format::Head_toc.method_defined? :toc_head_escript + if SiSU_EPUB_Format::HeadToc.method_defined? :toc_head_escript toc_shared << format_head_toc.toc_head_escript segtoc << format_head_toc.toc_head_escript end if defined? @md.rights.all \ and @md.rights.all rights=format_head_toc.rights.all - rights=SiSU_EPUB_Tune::Clean_xhtml.new(rights).clean + rights=SiSU_EPUB_Tune::CleanXHTML.new(rights).clean end if defined? @md.notes.prefix_b \ and @md.notes.prefix_b prefix_b=format_head_toc.prefix_b - prefix_b=SiSU_EPUB_Tune::Clean_xhtml.new(prefix_b).clean + prefix_b=SiSU_EPUB_Tune::CleanXHTML.new(prefix_b).clean end seg_toc_band=format_head_toc.seg_head_navigation_band seg_toc_band_bottom=format_head_toc.seg_head_navigation_band_bottom @@ -544,7 +507,7 @@ module SiSU_EPUB doc_title_endnote=@md.title.full.gsub(/(\*+)/,'\1') tmp_head=doc_title_endnote + "\n" txt_obj={ txt: tmp_head } - format_txt_obj=SiSU_EPUB_Format::Format_text_object.new(@md,txt_obj) + format_txt_obj=SiSU_EPUB_Format::FormatTextObject.new(@md,txt_obj) toc_shared << format_txt_obj.center_bold segtoc << format_txt_obj.center_bold if defined? @md.creator.author \ @@ -552,7 +515,7 @@ module SiSU_EPUB creator_endnote=@md.creator.author.gsub(/(\*+)/,%{ \\1}) tmp_head=creator_endnote + "\n" txt_obj={ txt: tmp_head } - format_txt_obj=SiSU_EPUB_Format::Format_text_object.new(@md,txt_obj) + format_txt_obj=SiSU_EPUB_Format::FormatTextObject.new(@md,txt_obj) toc_shared << format_txt_obj.center_bold segtoc << format_txt_obj.center_bold end @@ -589,23 +552,24 @@ module SiSU_EPUB #Segtoc tail added here segtoc << seg_toc_band_bottom segtoc << format_head_toc.xhtml_close - segtoc.flatten!.compact! - Epub_output.new(@md,segtoc).segtoc + segtoc=segtoc.flatten.compact #watch + SiSU_EPUB::Source::Output.new(@md,segtoc).segtoc segtoc=[] @toc[:scr],@toc[:seg]=[],[] toc_shared end end - class Table < SiSU_XHTML_table::Table_xhtml + class Table < SiSU_XHTML_Table::TableXHTML end - class Seg < SiSU_EPUB_seg::Seg + class Seg < SiSU_EPUB_Seg::Seg end - class Epub_output + class Output def initialize(md,output='') @md,@output=md,output @epub_doc="#{@md.fnb}.epub" - @epub_header=SiSU_EPUB_Format::Head_information.new(@md) - @make=SiSU_Env::Create_file.new(@md.fns) + @epub_header=SiSU_EPUB_Format::HeadInformation.new(@md) + @make=SiSU_Env::ProcessingSettings.new(@md) + @make_file=SiSU_Env::CreateFile.new(@md.fns) end def songsheet mimetype @@ -616,42 +580,42 @@ module SiSU_EPUB output_zip end def mimetype - out=@make.epub.mimetype + out=@make_file.epub.mimetype out<<@epub_header.mimetype out.close end def metainf_container #container.xml file in META-INF directory - out=@make.epub.metainf_cont + out=@make_file.epub.metainf_cont out<<@epub_header.metainf_container out.close end def css - out=@make.epub.xhtml_css - out << SiSU_EPUB_Format::Css.new.css_epub_xhtml + out=@make_file.epub.xhtml_css + out << SiSU_EPUB_Format::CSS.new.css_epub_xhtml out.close end def epub_toc_ncx begin - out=@make.epub.toc_ncx + out=@make_file.epub.toc_ncx @output.each do |para| unless para =~/\A\s*\Z/ out.puts para end end out.close - rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error + rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error end end def epub_metadata_opf begin - out=@make.epub.metadata + out=@make_file.epub.metadata @output.each do |para| unless para =~/\A\s*\Z/ out.puts para end end out.close - rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error + rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error end end def images @@ -686,18 +650,17 @@ module SiSU_EPUB end def segtoc begin - filename_html_segtoc=@make.epub.xhtml_segtoc - filename_html_index=@make.epub.xhtml_index - @output.each do |para| - para.strip! - unless para =~/\A\s*\Z/ - filename_html_segtoc.puts para,"\n" - filename_html_index.puts para,"\n" + if @make.build.toc? + filename_html_index=@make_file.epub.xhtml_index + @output.each do |para| + para=para.strip + unless para =~/\A\s*\Z/ + filename_html_index.puts para,"\n" + end end + filename_html_index.close end - filename_html_segtoc.close - filename_html_index.close - rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error + rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error end end end diff --git a/lib/sisu/v3/epub_concordance.rb b/lib/sisu/v3/epub_concordance.rb index c2a289a2..e2e5bb5c 100644 --- a/lib/sisu/v3/epub_concordance.rb +++ b/lib/sisu/v3/epub_concordance.rb @@ -69,7 +69,7 @@ module SiSU_EPUB_Concordance class Source def initialize(opt) @opt=opt - @particulars=SiSU_Particulars::Combined_singleton.instance.get_all(opt) + @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt) end def read begin @@ -85,21 +85,21 @@ module SiSU_EPUB_Concordance SiSU_Screen::Ansi.new(@md.opt.cmd,"wc (word count) is off, concordance will be processed for all files including those over the max set size of: #{wordmax} words").warn unless @md.opt.cmd =~/q/ SiSU_EPUB_Concordance::Source::Words.new(@particulars).songsheet end - rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error + rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error ensure end end private - class Doc_title + class DocTitle include SiSU_Viz #revisit, both requires (html & shared_xml) needed for stand alone operation (sisu -w [filename]) require_relative 'epub' # epub.rb def initialize(particulars) @particulars,@md=particulars,particulars.md - @data=SiSU_EPUB::Source::XHtml_environment.new(particulars).tuned_file_instructions - @vz=SiSU_Env::Get_init.instance.skin + @data=SiSU_EPUB::Source::XHTML_Environment.new(particulars).tuned_file_instructions + @vz=SiSU_Env::GetInit.instance.skin txt_path=%{#{@md.dir_out}} - SiSU_Env::Info_skin.new(@md).select + SiSU_Env::InfoSkin.new(@md).select @fnb=@md.fnb @lex_button=%{SiSU home -->} @doc_details =<|\w+|[a-zA-Z]+}mi - rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error + rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error end end def songsheet begin + #fix to use + p __LINE__.to_s + ':' + __FILE__ + p "#{@path}/content/#{@md.fn[:epub_concord]}" + p "#{@md.file.output_path.epub.dir}/#{@md.file.base_filename.epub}" @file_concordance=File.open("#{@path}/content/#{@md.fn[:epub_concord]}",'w') map_para - rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error + rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error ensure @file_concordance.close end @@ -202,7 +206,10 @@ WOK @word_map={} @dal_array.each do |line| if defined? line.ocn - if line.is =~/heading/ and line.ln==4; @seg=line.name + if (line.is ==:heading \ + || line.is ==:heading_insert) \ + && line.ln==4 + @seg=line.name end if line.ocn.to_s =~/\d+/; toy=line.ocn.to_s end @@ -210,46 +217,46 @@ WOK and toy !~/^0$/ line.obj=line.obj.split(@rgx_splitlist).join(' ') #%take in word or other match for word in line.obj.scan(@rgx_scanlist) #%take in word or other match - word.gsub!(/#{Mx[:lnk_o]}|#{Mx[:lnk_c]}|#{Mx[:url_o]}|#{Mx[:url_c]}/,'') - word.gsub!(/#{Mx[:fa_o]}\S+?#{Mx[:fa_o_c]}/,'') - word.gsub!(/#{Mx[:fa_c_o]}\S+?#{Mx[:fa_c]}/,'') - word.gsub!(/#{Mx[:gl_o]}#[a-z]+#{Mx[:gl_c]}/,'') - word.gsub!(/#{Mx[:gl_o]}#[0-9]+#{Mx[:gl_c]}/,'') - word.gsub!(/^\S$/,'') + word=word.gsub(/#{Mx[:lnk_o]}|#{Mx[:lnk_c]}|#{Mx[:url_o]}|#{Mx[:url_c]}/,''). + gsub(/#{Mx[:fa_o]}\S+?#{Mx[:fa_o_c]}/,''). + gsub(/#{Mx[:fa_c_o]}\S+?#{Mx[:fa_c]}/,''). + gsub(/#{Mx[:gl_o]}#[a-z]+#{Mx[:gl_c]}/,''). + gsub(/#{Mx[:gl_o]}#[0-9]+#{Mx[:gl_c]}/,''). + gsub(/^\S$/,'') word=nil if word.empty? word=nil if word =~@rxp_excluded0 #watch word=nil if word =~@rxp_excluded1 #watch word=nil if word =~/^\S$/ if word - word.gsub!(/#{Mx[:br_nl]}|#{Mx[:br_line]}/,' ') - word.gsub!(/#{Mx[:fa_o]}[a-z]{1,7}#{Mx[:fa_o_c]}|#{Mx[:fa_c_o]}[a-z]{1,7}#{Mx[:fa_c]}/,'') - word.gsub!(/#{Mx[:mk_o]}(?:[0-9a-f]{32}:[0-9a-f]{32}|[0-9a-f]{64}:[0-9a-f]{64})#{Mx[:mk_c]}/,'') - word.gsub!(/#{Mx[:mk_o]}(?:[0-9a-f]{32}|[0-9a-f]{64})#{Mx[:mk_c]}/,'') - word.gsub!(/#{Mx[:en_a_o]}(?:\d|[*+])*|#{Mx[:en_b_o]}(?:\d|[*+])*|#{Mx[:en_a_c]}|#{Mx[:en_b_c]}/mi,'') - word.gsub!(/#{Mx[:fa_o]}\S+?#{Mx[:fa_o_c]}/,''); word.gsub!(/#{Mx[:fa_c_o]}\S+?#{Mx[:fa_c]}/,'') - word.gsub!(/<\/?\S+?>/,'') - word.gsub!(/^\@+/,'') - word.strip! - word.gsub!(/#{Mx[:tc_p]}.+/,'') - word.gsub!(/[\.,;:"]$/,'') - word.gsub!(/["]/,'') - word.gsub!(/^\s*[\(]/,'') - word.gsub!(/[\(]\s*$/,'') - word.gsub!(/^(?:See|e\.?g\.?).+/,'') - word.gsub!(/^\s*[.,;:]\s*/,'') - word.strip! - word.gsub!(/^\(?[a-zA-Z]\)$/,'') - word.gsub!(/^\d+(st|nd|rd|th)$/,'') - word.gsub!(/^(\d+\.?)+$/, '') - word.gsub!(/#{Mx[:mk_o]}|#{Mx[:mk_c]}/,'') - word.gsub!(/:name#\S+/,'') - word.gsub!(/^\S$/,'') + word=word.gsub(/#{Mx[:br_nl]}|#{Mx[:br_line]}/,' '). + gsub(/#{Mx[:fa_o]}[a-z]{1,7}#{Mx[:fa_o_c]}|#{Mx[:fa_c_o]}[a-z]{1,7}#{Mx[:fa_c]}/,''). + gsub(/#{Mx[:mk_o]}(?:[0-9a-f]{32}:[0-9a-f]{32}|[0-9a-f]{64}:[0-9a-f]{64})#{Mx[:mk_c]}/,''). + gsub(/#{Mx[:mk_o]}(?:[0-9a-f]{32}|[0-9a-f]{64})#{Mx[:mk_c]}/,''). + gsub(/#{Mx[:en_a_o]}(?:\d|[*+])*|#{Mx[:en_b_o]}(?:\d|[*+])*|#{Mx[:en_a_c]}|#{Mx[:en_b_c]}/mi,''). + gsub(/#{Mx[:fa_o]}\S+?#{Mx[:fa_o_c]}/,'').gsub(/#{Mx[:fa_c_o]}\S+?#{Mx[:fa_c]}/,''). + gsub(/<\/?\S+?>/,''). + gsub(/^\@+/,''). + strip. + gsub(/#{Mx[:tc_p]}.+/,''). + gsub(/[\.,;:"]$/,''). + gsub(/["]/,''). + gsub(/^\s*[\(]/,''). + gsub(/[\(]\s*$/,''). + gsub(/^(?:See|e\.?g\.?).+/,''). + gsub(/^\s*[.,;:]\s*/,''). + strip. + gsub(/^\(?[a-zA-Z]\)$/,''). + gsub(/^\d+(st|nd|rd|th)$/,''). + gsub(/^(\d+\.?)+$/, ''). + gsub(/#{Mx[:mk_o]}|#{Mx[:mk_c]}/,''). + gsub(/:name#\S+/,''). + gsub(/^\S$/,'') word=nil if word =~/^\S$/ word=nil if word =~/^\s*$/ #watch if word unless word =~/[A-Z][A-Z]/ \ or word =~/\w+\s\w+/ - word.capitalize! + word=word.capitalize end @freq[word] +=1 @word_map[word] ||= [] @@ -272,7 +279,7 @@ WOK end scr='Full Text scroll: doc#  ' seg='' - @file_concordance << SiSU_EPUB_Concordance::Source::Doc_title.new(@particulars).create + @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 << '

' alph.each {|x| @file_concordance << %{#{x}, }} diff --git a/lib/sisu/v3/epub_format.rb b/lib/sisu/v3/epub_format.rb index 31bae51b..e11f5d3d 100644 --- a/lib/sisu/v3/epub_format.rb +++ b/lib/sisu/v3/epub_format.rb @@ -58,31 +58,27 @@ =end module SiSU_EPUB_Format include SiSU_Viz - class Paragraph_number + class ParagraphNumber def initialize(md,ocn) @md,@ocn=md,ocn.to_s @ocn ||='' - vz=SiSU_Env::Get_init.instance.skin - @skin_no_ocn=if defined? vz.ocn_display_off \ - and vz.ocn_display_off==true - true - else false - end + vz=SiSU_Env::GetInit.instance.skin end def ocn_display - if @md.markup.inspect =~/no_ocn/ \ - or @md.opt.mod.inspect =~/--no-ocn/ \ - or @skin_no_ocn - ocn_class='ocn_off' - @ocn.gsub(/^(\d+|)$/, - %{}) - elsif @ocn.to_i==0 - @ocn.gsub(/^(\d+|)$/, - %{}) - else + @make=SiSU_Env::ProcessingSettings.new(@md) + if @make.build.ocn? ocn_class='ocn' + if @ocn.to_i==0 + @ocn.gsub(/^(\d+|)$/, + %{}) + else + @ocn.gsub(/^(\d+|)$/, + %{}) + end + else + ocn_class='ocn_off' @ocn.gsub(/^(\d+|)$/, - %{}) + %{}) end end def name @@ -95,7 +91,7 @@ module SiSU_EPUB_Format %{} end end - class Css + class CSS def css_epub_xhtml </,'>') - m.gsub!(/<br(?: \/)?>/,';') + m=m.gsub(//,'>'). + gsub(/<br(?: \/)?>/,';') end x=@md.creator.author.dup - x.gsub!(//,'>') - x.gsub!(/<br(?: \/)?>/,'
') + x=x.gsub(//,'>'). + gsub(/<br(?: \/)?>/,'
') %{\n #{x}} else '' end @@ -1515,12 +1481,12 @@ WOK m=(m.empty?) \ ? (surname + other_names) : (m + '; ' + surname + ', ' + other_names) - m.gsub!(//,'>') - m.gsub!(/<br(?: \/)?>/,';') + m=m.gsub(//,'>'). + gsub(/<br(?: \/)?>/,';') end x=@md.creator.editor.dup - x.gsub!(//,'>') - x.gsub!(/<br(?: \/)?>/,'
') + x=x.gsub(//,'>'). + gsub(/<br(?: \/)?>/,'
') %{\n #{x}} else '' end @@ -1537,12 +1503,12 @@ WOK m=(m.empty?) \ ? (surname + other_names) : (m + '; ' + surname + ', ' + other_names) - m.gsub!(//,'>') - m.gsub!(/<br(?: \/)?>/,';') + m=m.gsub(//,'>'). + gsub(/<br(?: \/)?>/,';') end x=@md.creator.translator.dup - x.gsub!(//,'>') - x.gsub!(/<br(?: \/)?>/,'
') + x=x.gsub(//,'>'). + gsub(/<br(?: \/)?>/,'
') %{\n #{x}} else '' end @@ -1559,28 +1525,28 @@ WOK m=(m.empty?) \ ? (surname + other_names) : (m + '; ' + surname + ', ' + other_names) - m.gsub!(//,'>') - m.gsub!(/<br(?: \/)?>/,';') + m=m.gsub(//,'>'). + gsub(/<br(?: \/)?>/,';') end x=@md.creator.illustrator.dup - x.gsub!(//,'>') - x.gsub!(/<br(?: \/)?>/,'
') + x=x.gsub(//,'>'). + gsub(/<br(?: \/)?>/,'
') %{\n #{x}} else '' end date_published=if defined? @md.date.published \ and @md.date.published =~/\S+/ x=@md.date.published.dup - x.gsub!(//,'>') - x.gsub!(/<br(?: \/)?>/,'
') + x=x.gsub(//,'>'). + gsub(/<br(?: \/)?>/,'
') %{\n #{x}} else '' end subject=if defined? @md.classify.subject \ and @md.classify.subject =~/\S+/ x=@md.classify.subject.dup - x.gsub!(//,'>') - x.gsub!(/<br(?: \/)?>/,'
') + x=x.gsub(//,'>'). + gsub(/<br(?: \/)?>/,'
') %{\n #{x}} else '' end @@ -1596,7 +1562,7 @@ WOK %{\n #{rights}} else '' end - f=SiSU_Env::SiSU_file.new(@md) + f=SiSU_Env::FileOp.new(@md) <} end end - class Head_toc < Head_information + class HeadToc < HeadInformation def initialize(md) super(md) @md=md @@ -1743,7 +1709,7 @@ WOK def manifest_link(text) %{
#{text}} end - def concordance_link(text) #watch fix removed font size 2 + def concordance_link(text) if @md.concord_make %{ #{text} @@ -1829,7 +1795,7 @@ WOK #{@vz.table_close}} end end - class Head_seg < Head_information + class HeadSeg < HeadInformation def initialize(md) super(md) end @@ -1850,10 +1816,8 @@ WOK


} end - def title_banner(title,subtitle,creator) - end end - class Head_scroll < Head_toc + class HeadScroll < HeadToc def initialize(md) super(md) end @@ -1870,8 +1834,8 @@ WOK #{@vz.table_close}} end end - class Format_text_object - @vz=SiSU_Env::Get_init.instance.skin + class FormatTextObject + @vz=SiSU_Env::GetInit.instance.skin 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 @@ -1903,7 +1867,7 @@ WOK @named=nametags_seg(@dob) @txt=((defined? t_o.obj) ? t_o.obj : nil) @ocn=((defined? t_o.ocn) ? t_o.ocn.to_s : nil) - @headname=((t_o.is=='heading' and defined? t_o.name) ? t_o.name : nil) + @headname=((t_o.is==:heading and defined? t_o.name) ? t_o.name : nil) else if @md.opt.cmd =~/M/ p __FILE__ +':'+ __LINE__.to_s @@ -1912,10 +1876,10 @@ WOK end end if @txt and not @txt.empty? - @txt.gsub!(/#{Mx[:mk_o]}[-~]##{Mx[:mk_c]}/,'') + @txt=@txt.gsub(/#{Mx[:mk_o]}[-~]##{Mx[:mk_c]}/,'') end - @p_num=Paragraph_number.new(@md,@ocn) - @vz=SiSU_Env::Get_init.instance.skin + @p_num=ParagraphNumber.new(@md,@ocn) + @vz=SiSU_Env::GetInit.instance.skin end def nametags_seg(dob) #FIX tags='' @@ -1951,60 +1915,60 @@ WOK
} end - def para_form_css(tag,attrib) # regular paragraphs shaped here + def para_form_css(tag,attrib,txt) # regular paragraphs shaped here ul=ulc='' ul,ulc="
    \n ","\n
" if @tag =~/li/ %{
#{@p_num.ocn_display} #{ul}<#{tag} class="#{attrib}" #{@p_num.id}> - #{@named}#{@txt} + #{@named}#{txt} #{ulc}
} end def para - para_form_css('p','norm') + para_form_css('p','norm',@txt) end def group - para_form_css('p','group') + para_form_css('p','group',@txt) end def block - para_form_css('p','block') + para_form_css('p','block',@txt) end def alt - para_form_css('p','alt') + para_form_css('p','alt',@txt) end def verse - para_form_css('p','verse') + para_form_css('p','verse',@txt) end def code - para_form_css('p','code') + para_form_css('p','code',@txt) end def center - para_form_css('p','center') + para_form_css('p','center',@txt) end def bold - para_form_css('p','bold') + para_form_css('p','bold',@txt) end def bullet - para_form_css('li','bullet') + para_form_css('li','bullet',@txt) end def table @txt=if @t_o.obj !~/^
') - @txt.gsub!(/#{Mx[:br_obj]}/,'

') - para_form_css('p','norm') + @txt=@txt.gsub(/#{Mx[:br_page_new]}|#{Mx[:br_page]}/,'

'). + gsub(/#{Mx[:br_obj]}/,'

') + para_form_css('p','norm',@txt) end def format(tag,attrib) - para_form_css(tag,attrib) + para_form_css(tag,attrib,@txt) end def title_heading(tag,attrib) %{ @@ -2033,8 +1997,8 @@ WOK def title_heading4 '' end - def seg_heading_sub(tag,attrib) - @txt.gsub!(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ') + def seg_heading_sub(tag,attrib,txt) + txt=txt.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ') %{
#{@p_num.ocn_display} @@ -2055,10 +2019,10 @@ WOK } end def seg_heading5 - seg_heading_sub('p','bold') + seg_heading_sub('p','bold',@txt) end def seg_heading6 - seg_heading_sub('p','bold') + seg_heading_sub('p','bold',@txt) end def dl #check :trailer "
#{@txt} #{@trailer}
" @@ -2068,18 +2032,19 @@ WOK

' end - def gsub_body - case @txt + def gsub_body #unused + @txt=case @txt when /^(?:#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]}\s*)?\((i+|iv|v|vi+|ix|x|xi+)\)/ - @txt.gsub!(/^\((i+|iv|v|vi+|ix|x|xi+)\)/,'(\1)') - @txt.gsub!(/^(#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]})\s*\((i+|iv|v|vi+|ix|x|xi+)\)/,'\1(\2)') + @txt.gsub(/^\((i+|iv|v|vi+|ix|x|xi+)\)/,'(\1)'). + gsub(/^(#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]})\s*\((i+|iv|v|vi+|ix|x|xi+)\)/,'\1(\2)') when /^(?:#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]}\s*)?\(?(\d|[a-z])+\)/ - @txt.gsub!(/^\((\d+|[a-z])+\)/,'(\1)') - @txt.gsub!(/^(#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]})\s*\((\d+|[a-z])+\)/,'\1(\2)') + @txt.gsub(/^\((\d+|[a-z])+\)/,'(\1)'). + gsub(/^(#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]})\s*\((\d+|[a-z])+\)/,'\1(\2)') when /^\s*\d{1,3}\.\s/ - @txt.gsub!(/^\s*(\d+\.)/,'\1') + @txt.gsub(/^\s*(\d+\.)/,'\1') when /^\s*[A-Z]\.\s/ - @txt.gsub!(/^\s*([A-Z]\.)/,'\1') + @txt.gsub(/^\s*([A-Z]\.)/,'\1') + else @txt end end def bold_para @@ -2091,9 +2056,9 @@ WOK     #{@vz.table_close}} end - def bold_heading - @txt.gsub!(/[1-9]~\S+/,'') - @txt.gsub!(/[1-9]~/,'') + def bold_heading #unused + @txt=@txt.gsub(/[1-9]~\S+/,''). + gsub(/[1-9]~/,'') %{

#{@txt}

@@ -2114,62 +2079,16 @@ WOK %{

#{@txt}

\n} end end - class Format_scroll < Format_text_object + class FormatScroll < FormatTextObject def initialize(md,txt) super(md,txt) - @vz=SiSU_Env::Get_init.instance.skin + @vz=SiSU_Env::GetInit.instance.skin end end - class Format_seg < Format_text_object + class FormatSeg < FormatTextObject def initialize(md,txt) super(md,txt) end - def navigation_toc_lev1_advert - %{#{@banner.home_button}\n -

-#{@txt} -#{@two} -

} - end - def navigation_toc_lev1 - %{#{@banner.nav_toc}} - end - def navigation_toc_lev2 #change bold use css - %{ - -
- - - #{@txt} - -

-#{@vz.table_close}} - end - def navigation_toc_lev3 #change bold use css - %{ - -
- - - #{@txt} - -

-#{@vz.table_close}} - end - def navigation_toc_lev4 - %{ - -
- -

- #{@txt} -

-#{@vz.table_close}} - end - def navigation_toc_lev5 - end - def navigation_toc_lev6 - end def endnote_seg_body(fn='') #FIX #url construction keep within single line... BUG WATCH 200408 fn='doc' if fn.to_s.empty? #you may wish to reconsider, sends to 'doc' where no segment info %{ @@ -2179,9 +2098,8 @@ WOK } end def clean(txt) - txt.gsub!(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/,'') - txt.gsub!(/#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/,'') - txt + txt=txt.gsub(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/,''). + gsub(/#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/,'') end def subtoc_lev(tag,attrib) @txt=clean(@txt) @@ -2193,10 +2111,10 @@ WOK note='' if txt =~/(#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})/m # had \s* at end note=$1 - note.gsub!(/[\n\s]+/m,' ') - txt.gsub!(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ') - txt.gsub!(/ \d+<\/sup> /m,'') - txt.gsub!(/#{Mx[:nbsp]}\d+<\/sup>#{Mx[:nbsp]}/m,'') #remove + 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(/ \d+<\/sup> /m,''). + gsub(/#{Mx[:nbsp]}\d+<\/sup>#{Mx[:nbsp]}/m,'') #remove end %{<#{tag} class="#{attrib}"> #{txt} #{note} @@ -2208,8 +2126,8 @@ WOK def subtoc_lev6 subtoc_lev('h6','subtoc') if @txt end - def heading_sub(tag,attrib) - @txt.gsub!(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ') + def heading_sub(tag,attrib,txt) + txt=txt.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ') %{
#{@p_num.ocn_display} @@ -2231,10 +2149,10 @@ WOK } end def heading5 - heading_sub('p','bold') + heading_sub('p','bold',@txt) end def heading6 - heading_sub('p','bold') + heading_sub('p','bold',@txt) end def navigation_heading4 %{ @@ -2258,7 +2176,7 @@ WOK %{

#{@txt}

} end end - class Format_toc < Format_text_object + class FormatToc < FormatTextObject def initialize(md,txt) super(md,txt) end @@ -2300,44 +2218,6 @@ WOK def lev0 #docinfo lev('h0','toc') end - def mini_lev1 - lev('h1','minitoc') - end - def mini_lev2 - lev('h2','minitoc') - end - def mini_lev3 - lev('h3','minitoc') - end - def mini_lev4 - lev('h4','minitoc') - end - def mini_lev5 - lev('h5','minitoc') - end - def mini_lev6 - lev('h6','minitoc') - end - def mini_lev0 #docinfo - lev('h0','minitoc') - end - def mini_tail - %{ -

- Manifest (alternative outputs) -

-} - end - def mini_concord_tail - %{ -

- Concordance (wordlist) -

-

- Manifest (alternative outputs) -

-} - end end end __END__ diff --git a/lib/sisu/v3/epub_segments.rb b/lib/sisu/v3/epub_segments.rb index 5e08968a..262fde3c 100644 --- a/lib/sisu/v3/epub_segments.rb +++ b/lib/sisu/v3/epub_segments.rb @@ -56,41 +56,38 @@ ** Description: epub segment generation, processing =end -module SiSU_EPUB_seg +module SiSU_EPUB_Seg require_relative 'shared_xhtml' # shared_xhtml.rb require_relative 'epub' # epub.rb require_relative 'shared_metadata' # shared_metadata.rb - class Seg_output - def initialize(md,outputfile,seg,minitoc,type='') - @md,@output_epub_cont_seg,@seg,@minitoc,@type=md,outputfile,seg,minitoc,type + class Output + def initialize(md,outputfile,seg,type='') + @md,@output_epub_cont_seg,@seg,@type=md,outputfile,seg,type end def output #CONSIDER if @seg[:title] =~/\S/ filename_seg=[] filename_seg << @seg[:title] << @seg[:nav] if @type=='endnotes' - @seg[:headings]=[] + @seg[:headings]=[] #watch txt_obj={ txt: 'Endnotes', ocn_display: ''} - format_seg=SiSU_EPUB_Format::Format_seg.new(@md,txt_obj) + format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj) @seg[:headings] << format_seg.title_heading1 filename_seg << @seg[:heading_endnotes] << @seg[:headings] << %{\n
\n} << @seg[:endnote_all] << '
' elsif @type=='idx' @seg[:headings]=[] - format_head_seg=SiSU_EPUB_Format::Head_seg.new(@md) - format_seg=SiSU_EPUB_Format::Format_seg.new(@md,txt_obj) + format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj) @seg[:headings] << format_seg.title_heading1 filename_seg << @seg[:heading_idx] << @seg[:headings] << %{\n
\n} << @seg[:idx] << '
' elsif @type=='metadata' - metadata=Metadata::Summary.new(@md).xhtml_display.metadata + metadata=SiSU_Metadata::Summary.new(@md).xhtml_display.metadata @seg[:headings]=[] - format_head_seg=SiSU_EPUB_Format::Head_seg.new(@md) - @seg[:headings] << format_head_seg.title_banner(@md.title.main,@md.title.sub,@author) txt_obj={ txt: 'Metadata', ocn_display: ''} - format_seg=SiSU_EPUB_Format::Format_seg.new(@md,txt_obj) + format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj) @seg[:headings] << format_seg.title_heading1 filename_seg << @seg[:heading_idx] << @seg[:headings] << %{\n
\n} << metadata << '
' elsif @type=='sisu_manifest' - env=SiSU_Env::Info_env.new(@md.fns) + env=SiSU_Env::InfoEnv.new(@md.fns) path_and_name,url_and_name="#{env.path.output}/#{@md.fnb}/sisu_manifest.html","#{env.url.root}/#{@md.fnb}/sisu_manifest.html" manifest=if FileTest.file?("#{path_and_name}")==true <\n} << manifest << '' else filename_seg << @seg[:headings] << @seg[:main] << "\n\n" end filename_seg << @seg[:tail] << @seg[:nav] << @seg[:close] - filename_seg.flatten!.compact! + filename_seg=filename_seg.flatten.compact #watch filename_seg.each do |str| unless str =~/\A\s*\Z/ - str.strip! - @output_epub_cont_seg << str + @output_epub_cont_seg << str.strip end end @output_epub_cont_seg.close @@ -128,25 +122,25 @@ WOK @@loop_count=@@seg_total=@@tracker=0 @@is4=@@is3=@@is2=@@is1=0 @@heading1=@@heading2=@@heading3=@@heading4=0 - @@seg[:title],@@seg[:headings],@@seg[:main],@@seg[:idx],@@seg[:tail],@@seg_subtoc_array,@@seg_endnotes_array,@@seg[:endnote_all]=Array.new(8){[]} + @@seg[:headings],@@seg[:main],@@seg[:idx],@@seg[:tail],@@seg_subtoc_array,@@seg_endnotes_array,@@seg[:endnote_all]=Array.new(7){[]} @@seg[:heading_endnotes]='' @@tablehead,@@number_of_cols=0,0 @@fns_previous='' attr_reader :seg_name_xhtml,:seg_name_xhtml_tracker def initialize(md='',data='') @md,@data=md,data - @vz=SiSU_Env::Get_init.instance.skin + @vz=SiSU_Env::GetInit.instance.skin @seg_name_xhtml=@@seg_name_xhtml || nil @seg_name_xhtml_tracker=@@tracker || nil + @make=SiSU_Env::ProcessingSettings.new(@md) if @md end def songsheet begin - @minitoc=SiSU_EPUB::Source::Toc.new(@md,@data).minitoc data=get_subtoc_endnotes(@data) data=articles(data) - Seg.new.cleanup # (((( added )))) + SiSU_EPUB_Seg::Seg.new.cleanup # (((( added )))) #### (((( END )))) #### - rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error + rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error ensure @@seg_name=[] end @@ -158,13 +152,13 @@ WOK printed_endnote_seg='n' idx_xhtml=nil if @md.book_idx - idx_xhtml=SiSU_Particulars::Combined_singleton.instance.get_idx_xhtml(@md).xhtml_idx + idx_xhtml=SiSU_Particulars::CombinedSingleton.instance.get_idx_xhtml(@md).xhtml_idx idx_xhtml.each {|x| @@seg[:idx] << x } @@seg[:heading_idx]='' end data.each do |dob| - if (dob.is=='heading' \ - || dob.is=='heading_insert') \ + if (dob.is==:heading \ + || dob.is==:heading_insert) \ and dob.ln==4 @@seg_name << dob.name seg_name=dob.name @@ -174,7 +168,7 @@ WOK @@seg_total=@@seg_name.length testforartnum=@@seg_name_xhtml SiSU_Screen::Ansi.new(@md.opt.cmd,@@seg_name.length) if @md.opt.cmd =~/[MVv]/ - map_nametags=SiSU_Particulars::Combined_singleton.instance.get_map_nametags(@md).nametags_map #p map_nametags + map_nametags=SiSU_Particulars::CombinedSingleton.instance.get_map_nametags(@md).nametags_map #p map_nametags data.each do |dob| #if defined? dob.obj \ #and dob.obj =~/href="#{Xx[:segment]}#+\S+?"/ @@ -182,15 +176,15 @@ WOK # #while dob.obj =~/href="#{Xx[:segment]}#+(\S+?)"/ # # m=$1 # # if map_nametags[m][:segname] - # # dob.obj.sub!(/href="#{Xx[:segment]}#+(\S+?)"/,%{href="#{map_nametags[m][:segname]}#{Sfx[:html]}#\\1"}) + # # dob.obj=dob.obj.sub(/href="#{Xx[:segment]}#+(\S+?)"/,%{href="#{map_nametags[m][:segname]}#{Sfx[:html]}#\\1"}) # # else # # p "NOT FOUND name_tags: #{m}" - # # dob.obj.sub!(/href="#{Xx[:segment]}#+(\S+?)"/,%{href="#\\1"}) # not satisfactory + # # dob.obj=dob.obj.sub(/href="#{Xx[:segment]}#+(\S+?)"/,%{href="#\\1"}) # not satisfactory # # end # #end #end - if (dob.is=='heading' \ - || dob.is=='heading_insert') \ + if (dob.is==:heading \ + || dob.is==:heading_insert) \ and dob.ln==4 if dob.ocn==0 @@heading4=dob.obj @@ -198,27 +192,27 @@ WOK end @@is4=newfile=1 end - if (dob.is=='heading' \ - || dob.is=='heading_insert') \ + if (dob.is==:heading \ + || dob.is==:heading_insert) \ and dob.ln==3 @@heading3=dob.obj @@is4,@@is3=0,1 end - if (dob.is=='heading' \ - || dob.is=='heading_insert') \ + if (dob.is==:heading \ + || dob.is==:heading_insert) \ and dob.ln==2 @@heading2=dob.obj @@is4,@@is3,@@is2=0,0,1 end - if (dob.is=='heading' \ - || dob.is=='heading_insert') \ + if (dob.is==:heading \ + || dob.is==:heading_insert) \ and dob.ln==1 @@heading1=dob.obj @@is4,@@is3,@@is2,@@is1=0,0,0,1 end if (@@is1 && !@@is2 && !@@is3 && !@@is4) - if not (dob.is=='heading' \ - || dob.is=='heading_insert') \ + if not (dob.is==:heading \ + || dob.is==:heading_insert) \ and dob.ln==1 head1=$_ #; check end @@ -228,36 +222,36 @@ WOK if newfile==1 \ or dob.obj =~/^#{Mx[:br_endnotes]}|^#{Mx[:br_eof]}/ newfile=0 - if (dob.is=='heading' \ - || dob.is=='heading_insert') \ + if (dob.is==:heading \ + || dob.is==:heading_insert) \ and dob.ln==4 if tracking != 0 - Seg.new(@md).tail + SiSU_EPUB_Seg::Seg.new(@md).tail segfilename="#{dir_epub_cont}/#{@@seg_name_xhtml[tracking-1]}#{Sfx[:epub_xhtml]}" output_epub_cont_seg=File.new(segfilename,'w') if @@seg_name_xhtml[tracking-1] - if dob.is=='heading' \ + if dob.is==:heading \ or @@seg_name_xhtml[tracking-1] !~/endnotes|book_index|metadata/ - Seg_output.new(@md,output_epub_cont_seg,@@seg,@minitoc).output - elsif dob.is=='heading_insert' + SiSU_EPUB_Seg::Output.new(@md,output_epub_cont_seg,@@seg).output + elsif dob.is==:heading_insert if @@seg_name_xhtml[tracking-1]=='endnotes' - Seg_output.new(@md,output_epub_cont_seg,@@seg,@minitoc,'endnotes').output + SiSU_EPUB_Seg::Output.new(@md,output_epub_cont_seg,@@seg,'endnotes').output elsif @@seg_name_xhtml[tracking-1]=='book_index' - Seg_output.new(@md,output_epub_cont_seg,@@seg,@minitoc,'idx').output + SiSU_EPUB_Seg::Output.new(@md,output_epub_cont_seg,@@seg,'idx').output @@seg[:idx]=[] elsif @@seg_name_xhtml[tracking-1]=='metadata' # navigation bug FIX - Seg_output.new(@md,output_epub_cont_seg,@@seg,@minitoc,'metadata').output + SiSU_EPUB_Seg::Output.new(@md,output_epub_cont_seg,@@seg,'metadata').output else puts "#{__FILE__}::#{__LINE__}" end else puts "#{__FILE__}::#{__LINE__}" end - Seg.new.reinitialise + SiSU_EPUB_Seg::Seg.new.reinitialise heading_art(dob) head(dob) - if @@seg_name_xhtml[tracking]=='sisu_manifest' # this is for manifest, includes navigation bug + if @@seg_name_xhtml[tracking] =='metadata' segfilename="#{dir_epub_cont}/#{@@seg_name_xhtml[tracking]}#{Sfx[:epub_xhtml]}" output_epub_cont_seg=File.new(segfilename,'w') - Seg_output.new(@md,output_epub_cont_seg,@@seg,@minitoc,'sisu_manifest').output - Seg.new.reinitialise #BUG navigation bug with items following metadata, and occurring before manifest, this becomes a bug ... work area for book index, FIX + SiSU_EPUB_Seg::Output.new(@md,output_epub_cont_seg,@@seg,'metadata').output + SiSU_EPUB_Seg::Seg.new.reinitialise #BUG navigation bug with items following metadata, and occurring before manifest, this becomes a bug ... work area for book index, FIX end #@output_epub_cont_seg.close #%(((( EOF )))) --> end @@ -268,8 +262,8 @@ WOK end tracking=tracking+1 end - if (dob.is=='heading' \ - || dob.is=='heading_insert') \ + if (dob.is==:heading \ + || dob.is==:heading_insert) \ and dob.ln==4 \ and dob.name @@get_hash_to=dob.name @@ -292,8 +286,7 @@ WOK data end def heading_art(dob) - format_head_seg=SiSU_EPUB_Format::Head_seg.new(@md) - @@seg[:title]=format_head_seg.head + @@seg[:title]=SiSU_EPUB_Format::HeadSeg.new(@md).head end def head(dob) clean=/|<:.*?>$/ @@ -306,65 +299,67 @@ WOK ocn=if @@heading1[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]; $1 #fix else '' end - @p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,ocn) + @p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn) txt_obj={ txt: @@heading1, ocn_display: @p_num.ocn_display } - format_seg=SiSU_EPUB_Format::Format_seg.new(@md,txt_obj) + format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj) @@seg[:headings] << format_seg.title_heading1.gsub(clean,'') - @@heading1.gsub!(/  [\d*+]+<\/sup> <\/a>/,'') + @@heading1=@@heading1.gsub(/  [\d*+]+<\/sup> <\/a>/,'') end if @@is2==1 heading2=@@heading2 ocn=if heading2[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]; $1 #fix else '' end - @p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,ocn) + @p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn) txt_obj={ txt: heading2, ocn_display: @p_num.ocn_display } - format_seg=SiSU_EPUB_Format::Format_seg.new(@md,txt_obj) + format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj) @@seg[:headings] << format_seg.title_heading2.gsub(clean,'') - @@heading2.gsub!(/  [\d*+]+<\/sup> <\/a>/,'') + @@heading2=@@heading2.gsub(/  [\d*+]+<\/sup> <\/a>/,'') end if @@is3==1 heading3=@@heading3 ocn=if heading3[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]; $1 #fix else '' end - @p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,ocn) + @p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn) txt_obj={ txt: heading3, ocn_display: @p_num.ocn_display } - format_seg=SiSU_EPUB_Format::Format_seg.new(@md,txt_obj) + format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj) @@seg[:headings] << format_seg.title_heading3.gsub(clean,'') - @@heading3.gsub!(/  [\d*+]+<\/sup> <\/a>/,'') + @@heading3=@@heading3.gsub(/  [\d*+]+<\/sup> <\/a>/,'') end if @@is4==1 heading4=@@heading4 ocn=if heading4[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]; $1 #fix else '' end - @p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,ocn) + @p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn) txt_obj={ txt: heading4, ocn_display: @p_num.ocn_display } - format_seg=SiSU_EPUB_Format::Format_seg.new(@md,txt_obj) + format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj) @@seg[:headings] << format_seg.title_heading4.gsub(clean,'') end @@tracker=@@tracker+1 end def markup(dob) @debug=[] - format_head_seg=SiSU_EPUB_Format::Head_seg.new(@md) - if dob.is =~/(?:heading|para)/ #extend as necessary FIX - @p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,dob.ocn) + if dob.is ==:heading \ + || dob.is ==:heading_insert \ + || dob.is ==:para + #extend as necessary FIX + @p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,dob.ocn) end - sto=SiSU_EPUB_Format::Format_text_object.new(@md,dob) - dob_xhtml=if dob.is=='heading' \ - or dob.is=='heading_insert' \ - or dob.is=='para' - dob_xhtml=if dob.is=='heading' \ - or dob.is=='heading_insert' + sto=SiSU_EPUB_Format::FormatTextObject.new(@md,dob) + dob_xhtml=if dob.is==:heading \ + || dob.is==:heading_insert \ + || dob.is==:para + dob_xhtml=if dob.is==:heading \ + or dob.is==:heading_insert if dob.ln==4 - sto.seg_heading4 # work on see Split_text_object + sto.seg_heading4 # work on see SplitTextObject elsif dob.ln==5 sto.seg_heading5 elsif dob.ln==6; sto.seg_heading6 end - elsif dob.is=='para' + elsif dob.is==:para if dob.indent \ and dob.hang \ and dob.indent =~/[0-9]/ \ @@ -382,43 +377,49 @@ WOK else sto.para end end - elsif dob.is =~/^(?:block|group|alt)$/ + elsif dob.is ==:block \ + || dob.is ==:group \ + || dob.is ==:alt sto.para #fix this should be block type specific #FIX - elsif dob.is=='verse' + elsif dob.is==:verse sto.verse - elsif dob.is=='code' + elsif dob.is==:code sto.code - elsif dob.is=='table' + elsif dob.is==:table sto.table - elsif dob.is=='break' + elsif dob.is==:break sto.break end if @md.flag_separate_endnotes # may need to revisit, check - dob.obj.gsub!(/"\s+href="#note_ref(\d+)">/,%{" href=\"endnotes#{Sfx[:epub_xhtml]}#note_ref\\1">}) #endnote- twice #removed file type + dob.obj=dob.obj.gsub(/"\s+href="#note_ref(\d+)">/,%{" href=\"endnotes#{Sfx[:epub_xhtml]}#note_ref\\1">}) #endnote- twice #removed file type end - if dob.is =~/heading|para/ \ - and (not dob.ocn or dob.ocn.to_s.empty?) - format_seg=SiSU_EPUB_Format::Format_seg.new(@md,dob) + if (dob.is ==:heading \ + || dob.is==:heading_insert \ + || dob.is==:para) \ + && (not dob.ocn or dob.ocn.to_s.empty?) + format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,dob) end - if (dob.is=='heading' \ - || dob.is=='heading_insert' \ - || dob.is=='para') \ + if (dob.is==:heading \ + || dob.is==:heading_insert \ + || dob.is==:para) \ and dob.note_ #dob.obj =~/ \n} @@seg[:main] << dob_xhtml - @@seg[:main] << @@seg_subtoc[@@get_hash_fn] #% insertion of sub-toc + if @make.build.segsubtoc? + @@seg[:main] << @@seg_subtoc[@@get_hash_fn] #% insertion of sub-toc + end else @@seg[:main] << dob_xhtml end end def tail - format_head_seg=SiSU_EPUB_Format::Head_seg.new(@md) + format_head_seg=SiSU_EPUB_Format::HeadSeg.new(@md) if @md.flag_auto_endnotes \ and @@seg_endnotes[@@get_hash_fn] @@seg[:tail] << %{\n
\n
\n} @@ -433,7 +434,7 @@ WOK @@seg[:close] << format_head_seg.xhtml_close end def reinitialise - @@seg[:title],@@seg[:headings],@@seg[:main],@@seg[:tail],@@seg[:credits]=Array.new(5){[]} + @@seg[:headings],@@seg[:main],@@seg[:tail],@@seg[:credits]=Array.new(4){[]} end def cleanup reinitialise @@ -444,10 +445,10 @@ WOK end def get_subtoc_endnotes(data) #get endnotes & sub-table of contents subtoc data.each do |dob| - dob.obj.gsub!(/(.+?)<\/a>/mi,'\1') + dob.obj=dob.obj.gsub(/(.+?)<\/a>/mi,'\1') if @md.flag_auto_endnotes - if (dob.is=='heading' \ - || dob.is=='heading_insert') \ + if (dob.is==:heading \ + || dob.is==:heading_insert) \ and dob.ln.to_s =~/^[1234]/ \ and not @@fn.to_s.empty? @@seg_endnotes[@@fn]=[] @@ -455,8 +456,8 @@ WOK @@seg_endnotes_array=[] if dob.ln==4 @@fns_previous=@md.fns if dob.ln==4 and dob.name =~/^meta/ end - if (dob.is=='heading' \ - || dob.is=='heading_insert') \ + if (dob.is==:heading \ + || dob.is==:heading_insert) \ and dob.ln==4 #% EXTRACTION OF SUB-TOCs & SEGMENT NAME, after EXTRACTION OF ENDNOTES & SUB-TOCs @@seg_subtoc[@@fn]=@@seg_subtoc_array @@seg_subtoc_array=[] @@ -470,14 +471,14 @@ WOK end end end - if dob.is=='heading' \ + if dob.is==:heading \ and dob.ln.to_s =~/^[56]/ case dob.ln when 5 - format_seg=SiSU_EPUB_Format::Format_seg.new(@md,dob) + format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,dob) subtoc=format_seg.subtoc_lev5 #keep and make available, this is the subtoc when 6 - format_seg=SiSU_EPUB_Format::Format_seg.new(@md,dob) + format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,dob) subtoc=format_seg.subtoc_lev6 #keep and make available, this is the subtoc end @@seg_subtoc_array << subtoc @@ -485,7 +486,7 @@ WOK if @md.flag_auto_endnotes ast,pls='*','+' if dob.obj =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})(?:\d|#{ast}|#{pls})+ / \ - and dob.is !~/^code/ # endnote- + and dob.is !=:code # endnote- endnote_array=[] if dob.obj=~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/m endnote_array << dob.obj.scan(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/m) @@ -496,7 +497,7 @@ WOK if dob.obj=~/#{Mx[:en_b_o]}#{pls}\d+\s.+?#{Mx[:en_b_c]}/m endnote_array << dob.obj.scan(/#{Mx[:en_b_o]}#{pls}\d+\s.+?#{Mx[:en_b_c]}/m) end - endnote_array.flatten! #.compact! #check compacting + endnote_array=endnote_array.flatten #.compact #check compacting endnote_array.each do |note| note_match=note.dup note_match_seg=note.dup @@ -504,7 +505,7 @@ WOK try=e_n.split(/
/) try.each do |e| txt_obj={ txt: e } - format_seg=SiSU_EPUB_Format::Format_seg.new(@md,txt_obj) + format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj) note_match=if e =~/#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]}/ format_seg.endnote_body_indent else format_seg.endnote_body @@ -517,11 +518,11 @@ WOK endnote_part_a=note_match_seg[m,1] endnote_part_b=note_match_seg[m,2] txt_obj={ endnote_part_a: endnote_part_a, endnote_part_b: endnote_part_b } - format_seg=SiSU_EPUB_Format::Format_seg.new(@md,txt_obj) + format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj) note_match_all_seg=format_seg.endnote_seg_body(@@fn) #BUG WATCH 200408 @@seg[:endnote_all] << note_match_all_seg end - dob.obj.gsub!(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ') + dob.obj=dob.obj.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ') end end end diff --git a/lib/sisu/v3/epub_tune.rb b/lib/sisu/v3/epub_tune.rb index b348a7bf..34466926 100644 --- a/lib/sisu/v3/epub_tune.rb +++ b/lib/sisu/v3/epub_tune.rb @@ -76,7 +76,7 @@ module SiSU_EPUB_Tune class Output def initialize(data,md) @data,@md=data,md - @file=SiSU_Env::SiSU_file.new(@md) + @file=SiSU_Env::FileOp.new(@md) @cX=SiSU_Screen::Ansi.new(@md.opt.cmd).cX end def hard_output @@ -91,7 +91,7 @@ module SiSU_EPUB_Tune File.open(@file.marshal.html_tune,'w') {|f| Marshal.dump(@data.to_a,f)} end end - class Clean_xhtml + class CleanXHTML def initialize(html='') @html=html end @@ -101,160 +101,151 @@ module SiSU_EPUB_Tune html else html.obj end - str.gsub!(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;') - str.gsub!(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;') - str.gsub!(/\*/u,'*') # * - str.gsub!(/\+/u,'+') # + - str.gsub!(/¢/u,'¢') # ¢ - str.gsub!(/£/u,'£') # £ - str.gsub!(/¥/u,'¥') # ¥ - str.gsub!(/§/u,'§') # § - str.gsub!(/©/u,'©') # © - str.gsub!(/ª/u,'ª') # ª - str.gsub!(/«/u,'«') # « - str.gsub!(/®/u,'®') # ® - str.gsub!(/°/u,'°') # ° - str.gsub!(/±/u,'±') # ± - str.gsub!(/²/u,'²') # ² - str.gsub!(/³/u,'³') # ³ - str.gsub!(/µ/u,'µ') # µ - str.gsub!(/¶/u,'¶') # ¶ - str.gsub!(/¹/u,'¹') # ¹ - str.gsub!(/º/u,'º') # º - str.gsub!(/»/u,'»') # » - str.gsub!(/¼/u,'¼') # ¼ - str.gsub!(/½/u,'½') # ½ - str.gsub!(/¾/u,'¾') # ¾ - str.gsub!(/×/u,'×') # × - str.gsub!(/÷/u,'÷') # ÷ - str.gsub!(/¿/u,'¿') # ¿ - str.gsub!(/À/u,'À') # À - str.gsub!(/Á/u,'Á') # Á - str.gsub!(/Â/u,'Â') # Â - str.gsub!(/Ã/u,'Ã') # Ã - str.gsub!(/Ä/u,'Ä') # Ä - str.gsub!(/Å/u,'Å') # Å - str.gsub!(/Æ/u,'Æ') # Æ - str.gsub!(/Ç/u,'Ç') # Ç - str.gsub!(/È/u,'È') # È - str.gsub!(/É/u,'É') # É - str.gsub!(/Ê/u,'Ê') # Ê - str.gsub!(/Ë/u,'Ë') # Ë - str.gsub!(/Ì/u,'Ì') # Ì - str.gsub!(/Í/u,'Í') # Í - str.gsub!(/Î/u,'Î') # Î - str.gsub!(/Ï/u,'Ï') # Ï - str.gsub!(/Ð/u,'Ð') # Ð - str.gsub!(/Ñ/u,'Ñ') # Ñ - str.gsub!(/Ò/u,'Ò') # Ò - str.gsub!(/Ó/u,'Ó') # Ó - str.gsub!(/Ô/u,'Ô') # Ô - str.gsub!(/Õ/u,'Õ') # Õ - str.gsub!(/Ö/u,'Ö') # Ö - str.gsub!(/Ø/u,'Ø') # Ø - str.gsub!(/Ù/u,'Ù') # Ù - str.gsub!(/Ú/u,'Ú') # Ú - str.gsub!(/Û/u,'Û') # Û - str.gsub!(/Ü/u,'Ü') # Ü - str.gsub!(/Ý/u,'Ý') # Ý - str.gsub!(/Þ/u,'Þ') # Þ - str.gsub!(/ß/u,'ß') # ß - str.gsub!(/à/u,'à') # à - str.gsub!(/á/u,'á') # á - str.gsub!(/â/u,'â') # â - str.gsub!(/ã/u,'ã') # ã - str.gsub!(/ä/u,'ä') # ä - str.gsub!(/å/u,'å') # å - str.gsub!(/æ/u,'æ') # æ - str.gsub!(/ç/u,'ç') # ç - str.gsub!(/è/u,'è') # è - str.gsub!(/é/u,'é') # é - str.gsub!(/ê/u,'ê') # ê - str.gsub!(/ë/u,'ë') # ë - str.gsub!(/ì/u,'ì') # ì - str.gsub!(/í/u,'í') # í - str.gsub!(/î/u,'î') # î - str.gsub!(/ï/u,'ï') # ï - str.gsub!(/ð/u,'ð') # ð - str.gsub!(/ñ/u,'ñ') # ñ - str.gsub!(/ò/u,'ò') # ò - str.gsub!(/ó/u,'ó') # ó - str.gsub!(/ô/u,'ô') # ô - str.gsub!(/õ/u,'õ') # õ - str.gsub!(/ö/u,'ö') # ö - str.gsub!(/ø/u,'ø') # ø - str.gsub!(/ù/u,'ù') # ú - str.gsub!(/ú/u,'ú') # û - str.gsub!(/û/u,'û') # ü - str.gsub!(/ü/u,'ü') # ý - str.gsub!(/þ/u,'þ') # þ - str.gsub!(/ÿ/u,'ÿ') # ÿ - str.gsub!(/ý/u,'ý') - str.gsub!(/
/u,'
') - str.gsub(/#{Mx[:nbsp]}/u,' ') - str + 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(/\*/u,'*'). # * + gsub(/\+/u,'+'). # + + gsub(/¢/u,'¢'). # ¢ + gsub(/£/u,'£'). # £ + gsub(/¥/u,'¥'). # ¥ + gsub(/§/u,'§'). # § + gsub(/©/u,'©'). # © + gsub(/ª/u,'ª'). # ª + gsub(/«/u,'«'). # « + gsub(/®/u,'®'). # ® + gsub(/°/u,'°'). # ° + gsub(/±/u,'±'). # ± + gsub(/²/u,'²'). # ² + gsub(/³/u,'³'). # ³ + gsub(/µ/u,'µ'). # µ + gsub(/¶/u,'¶'). # ¶ + gsub(/¹/u,'¹'). # ¹ + gsub(/º/u,'º'). # º + gsub(/»/u,'»'). # » + gsub(/¼/u,'¼'). # ¼ + gsub(/½/u,'½'). # ½ + gsub(/¾/u,'¾'). # ¾ + gsub(/×/u,'×'). # × + gsub(/÷/u,'÷'). # ÷ + gsub(/¿/u,'¿'). # ¿ + gsub(/À/u,'À'). # À + gsub(/Á/u,'Á'). # Á + gsub(/Â/u,'Â'). # Â + gsub(/Ã/u,'Ã'). # Ã + gsub(/Ä/u,'Ä'). # Ä + gsub(/Å/u,'Å'). # Å + gsub(/Æ/u,'Æ'). # Æ + gsub(/Ç/u,'Ç'). # Ç + gsub(/È/u,'È'). # È + gsub(/É/u,'É'). # É + gsub(/Ê/u,'Ê'). # Ê + gsub(/Ë/u,'Ë'). # Ë + gsub(/Ì/u,'Ì'). # Ì + gsub(/Í/u,'Í'). # Í + gsub(/Î/u,'Î'). # Î + gsub(/Ï/u,'Ï'). # Ï + gsub(/Ð/u,'Ð'). # Ð + gsub(/Ñ/u,'Ñ'). # Ñ + gsub(/Ò/u,'Ò'). # Ò + gsub(/Ó/u,'Ó'). # Ó + gsub(/Ô/u,'Ô'). # Ô + gsub(/Õ/u,'Õ'). # Õ + gsub(/Ö/u,'Ö'). # Ö + gsub(/Ø/u,'Ø'). # Ø + gsub(/Ù/u,'Ù'). # Ù + gsub(/Ú/u,'Ú'). # Ú + gsub(/Û/u,'Û'). # Û + gsub(/Ü/u,'Ü'). # Ü + gsub(/Ý/u,'Ý'). # Ý + gsub(/Þ/u,'Þ'). # Þ + gsub(/ß/u,'ß'). # ß + gsub(/à/u,'à'). # à + gsub(/á/u,'á'). # á + gsub(/â/u,'â'). # â + gsub(/ã/u,'ã'). # ã + gsub(/ä/u,'ä'). # ä + gsub(/å/u,'å'). # å + gsub(/æ/u,'æ'). # æ + gsub(/ç/u,'ç'). # ç + gsub(/è/u,'è'). # è + gsub(/é/u,'é'). # é + gsub(/ê/u,'ê'). # ê + gsub(/ë/u,'ë'). # ë + gsub(/ì/u,'ì'). # ì + gsub(/í/u,'í'). # í + gsub(/î/u,'î'). # î + gsub(/ï/u,'ï'). # ï + gsub(/ð/u,'ð'). # ð + gsub(/ñ/u,'ñ'). # ñ + gsub(/ò/u,'ò'). # ò + gsub(/ó/u,'ó'). # ó + gsub(/ô/u,'ô'). # ô + gsub(/õ/u,'õ'). # õ + gsub(/ö/u,'ö'). # ö + gsub(/ø/u,'ø'). # ø + gsub(/ù/u,'ù'). # ú + gsub(/ú/u,'ú'). # û + gsub(/û/u,'û'). # ü + gsub(/ü/u,'ü'). # ý + gsub(/þ/u,'þ'). # þ + gsub(/ÿ/u,'ÿ'). # ÿ + gsub(/ý/u,'ý'). + gsub(/
/u,'
'). + gsub(/#{Mx[:nbsp]}/u,' ') end end class Tune def initialize(data,md) @data,@md=data,md - @vz=SiSU_Env::Get_init.instance.skin - @env=SiSU_Env::Info_env.new(@md.fns) - @sys=SiSU_Env::System_call.new - @env=SiSU_Env::Info_env.new(@md.fns) + @vz=SiSU_Env::GetInit.instance.skin + @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 end def songsheet begin @cX=SiSU_Screen::Ansi.new(@md.opt.cmd).cX SiSU_Screen::Ansi.new(@md.opt.cmd,'Tune').txt_grey if @md.opt.cmd =~/[MVv]/ - data=Tune.new(@data,@md).amp_html - data=Tune.new(data,@md).endnotes_html - data=Tune.new(data,@md).url_markup - data=Tune.new(data,@md).markup + data=SiSU_EPUB_Tune::Tune.new(@data,@md).amp_html + data=SiSU_EPUB_Tune::Tune.new(data,@md).endnotes_html + data=SiSU_EPUB_Tune::Tune.new(data,@md).url_markup + data=SiSU_EPUB_Tune::Tune.new(data,@md).markup if @md.opt.cmd =~/M/ #Hard Output Tune Optional on/off here - data=Output.new(data,@md).hard_output - Output.new(data,@md).marshal + data=SiSU_EPUB_Tune::Output.new(data,@md).hard_output + SiSU_EPUB_Tune::Output.new(data,@md).marshal end - tuned=Tune.new(@data,@md).output - rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error + tuned=SiSU_EPUB_Tune::Tune.new(@data,@md).output + rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error ensure end end - def para_numbers - data=@data - @tuned_file=[] - data.each do |dob| - dob.gsub!(/#{Mx[:lv_o]}\d:(\S?)#{Mx[:lv_c]}/,'\0#\1. ') #fix Mx[:lv_o] - @tuned_file << dob - end - end def markup @tuned_file=[] @data.each do |dob| - dob.obj.gsub!(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;') - dob.obj.gsub!(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;') - dob.obj.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'
') unless dob.is=='table' - dob.obj.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\1') - dob.obj.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\1') - dob.obj.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\1') - dob.obj.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'\1') - dob.obj.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'\1') - dob.obj.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'\1') - dob.obj.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'\1') - dob.obj.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'\1') - dob.obj.gsub!(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'\1') # tt, kbd - dob.obj.gsub!(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'') - dob.obj.gsub!(/^#{Mx[:gl_bullet]}/m,'●  ') - dob.obj.gsub!(/#{Mx[:nbsp]}/,' ') - dob.obj.gsub!(/<(p|br)>/,'<\1 />') - dob=SiSU_EPUB_Tune::Clean_xhtml.new(dob).clean + dob.obj=dob.obj.gsub(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;'). + gsub(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;') + dob.obj=dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'
') unless dob.is==:table + dob.obj=dob.obj.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\1'). + gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\1'). + gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\1'). + gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'\1'). + gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'\1'). + gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'\1'). + gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'\1'). + gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'\1'). + gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'\1'). # tt, kbd + gsub(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,''). + gsub(/^#{Mx[:gl_bullet]}/m,'●  '). + gsub(/#{Mx[:nbsp]}/,' '). + gsub(/<(p|br)>/,'<\1 />') + dob.obj=SiSU_EPUB_Tune::CleanXHTML.new(dob.obj).clean @tuned_file << dob end end def urls(data) @words=[] - map_nametags=SiSU_Particulars::Combined_singleton.instance.get_map_nametags(@md).nametags_map #p map_nametags + map_nametags=SiSU_Particulars::CombinedSingleton.instance.get_map_nametags(@md).nametags_map #p map_nametags data.each do |word| @words << if word=~/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/ http_=true @@ -280,29 +271,32 @@ module SiSU_EPUB_Tune %{
#{caption}} else %{#{caption}} end - word.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/,ins) + word=word.gsub(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/,ins) else link=m[/(.+)/m] png=m.scan(/\S+/)[0].strip link=link.strip - u.sub!(/^#*/,'') #make neater + u=u.sub(/^#*/,'') #make neater if map_nametags[u] \ and map_nametags[u][:segname] - if u=~/^\d+$/ - u.gsub!(/^(\d+)$/,"#{map_nametags[u][:segname]}#{Sfx[:xhtml]}#o\\1") if u !~/\// unless http_ - else - u.gsub!(/(\S+)/,"#{map_nametags[u][:segname]}#{Sfx[:xhtml]}#\\1") if u !~/\// unless http_ + u=unless http_ + u=if u=~/^\d+$/ + u.gsub(/^(\d+)$/,"#{map_nametags[u][:segname]}#{Sfx[:xhtml]}#o\\1") if u !~/\// + else + u.gsub(/(\S+)/,"#{map_nametags[u][:segname]}#{Sfx[:xhtml]}#\\1") if u !~/\// + end + else u end elsif u =~/^:/ - u.gsub!(/^:/,"#{@env.url.root}/") + u=u.gsub(/^:/,"#{@env.url.root}/") elsif u =~/^\.\.\// - u.gsub!(/^\.\.\//,"#{@env.url.root}/") + u=u.gsub(/^\.\.\//,"#{@env.url.root}/") elsif u =~/https?:\/\// else p "NOT FOUND name_tags: #{u}" end ins=%{#{link}} - word.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,ins) - word.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/,ins) + word=word.gsub(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,ins). + gsub(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/,ins) end word else word @@ -315,58 +309,59 @@ module SiSU_EPUB_Tune data=@data @tuned_file=[] data.each do |dob| - unless dob.is=='code' + unless dob.is==:code if dob.obj =~/<::\s+/ #watch - dob.obj.gsub!(/<::\s+(\S+?)\s+!>/, + dob.obj=dob.obj.gsub(/<::\s+(\S+?)\s+!>/, %{\\1}) end if dob.obj =~/<:image\s+/ - dob.obj.gsub!(/<:image\s+(http\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+>/, - %{}) - dob.obj.gsub!(/<:image\s+(http\S+)\s+(\S+)\s+>/, - %{}) - dob.obj.gsub!(/<:image\s+(\S+)\s+(\S+)\s+(\S+)\s+>/, - %{}) - dob.obj.gsub!(/<:image\s+(\S+)\s+>/, - %{}) + dob.obj=dob.obj.gsub(/<:image\s+(http\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+>/, + %{}). + gsub(/<:image\s+(http\S+)\s+(\S+)\s+>/, + %{}). + gsub(/<:image\s+(\S+)\s+(\S+)\s+(\S+)\s+>/, + %{}). + gsub(/<:image\s+(\S+)\s+>/, + %{}) end if dob.obj =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/ @word_mode=dob.obj.scan(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)[()\[\]]*[,.;:!?'"]{0,2}|(?:#{Mx[:gl_o]}\S+?#{Mx[:gl_c]})+|[^#{Mx[:lnk_o]}#{Mx[:lnk_c]}]+/mu) words=urls(@word_mode) - dob.obj.gsub!(/.+/m,words) + dob.obj=dob.obj.gsub(/.+/m,words) end - dob.obj.gsub!(/\\copyright/i,%{©}) - if (dob.obj !~/\<:ad\s+\.\.\//) - dob.obj.gsub!(/\<:ad\s+(\S+)?\s+(\S+\.png)\s+(.+)?\;\s+(.+)?\;\s*!\>/, + dob.obj=dob.obj.gsub(/\\copyright/i,%{©}) + dob.obj=if (dob.obj !~/\<:ad\s+\.\.\//) + dob.obj.gsub(/\<:ad\s+(\S+)?\s+(\S+\.png)\s+(.+)?\;\s+(.+)?\;\s*!\>/, %{\n
\\3
\n}) else - dob.obj.gsub!(/\<:ad\s+(\S+)?\s+(\S+\.png)\s+(.+)?\;\s+(.+)?\;\s*\>/, + dob.obj.gsub(/\<:ad\s+(\S+)?\s+(\S+\.png)\s+(.+)?\;\s+(.+)?\;\s*\>/, %{\n
\\3
\n}) end - dob.obj.gsub!(/!pick/,%{stellar}) - dob.obj.gsub!(/!new/,%{ new}) - dob.obj.gsub!(/<:h(.{1,7}?)>/,'\1') - dob.obj.gsub!(/<:to(\d{1,7}?)>/,'to { \1 } ') - dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1') #http ftp matches escaped, no decoration - dob.obj.gsub!(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) - dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) #http ftp matches with decoration + dob.obj=dob.obj.gsub(/!pick/,%{stellar}). + gsub(/!new/,%{ new}). + gsub(/<:h(.{1,7}?)>/,'\1'). + gsub(/<:to(\d{1,7}?)>/,'to { \1 } '). + gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1'). #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}\\1#{@brace_url.xml_close}}). + gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) #http ftp matches with decoration if dob.obj =~/..\/\S+/ \ and dob.obj !~/(\"..\/\S+?\"|>\s*..\/\S+<)/ - dob.obj.gsub!(/(\.\.\/\S+)/,'\1') + dob.obj=dob.obj.gsub(/(\.\.\/\S+)/,'\1') end - dob.obj.gsub!(//m,'>') + dob.obj=dob.obj.gsub(//m,'>') end @tuned_file << dob end end def amp_html - data=@data + data,data_new=@data,[] data.each do |dob| - dob.obj.gsub!(/&/u,'&') + dob.obj=dob.obj.gsub(/&/u,'&') + data_new << dob end - data + data_new end def endnotes_html data=@data @@ -374,24 +369,24 @@ module SiSU_EPUB_Tune a,s='_a','_s' ast,pls='*','+' data.each do |dob| - unless dob.is =~/^code/ - dob.obj.gsub!(/(#{Mx[:en_a_o]}|#{Mx[:en_b_o]})(\d+)\s+(.+?)(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/, - %{#{Mx[:nbsp]}#{Mx[:nbsp]}\\2#{Mx[:nbsp]} } + #note- endnote- - %{\\1\\2 #{Mx[:nbsp]}\\2. \\3 \\4}) #endnote- note- (careful may have switched) - dob.obj.gsub!(/(#{Mx[:en_b_o]})[*](\d+)\s+(.+?)(#{Mx[:en_b_c]})/, - %{#{Mx[:nbsp]}#{Mx[:nbsp]}#{ast}\\2#{Mx[:nbsp]} } + #note- endnote- - %{\\1#{ast}\\2 #{Mx[:nbsp]}#{ast}\\2. \\3 \\4}) #endnote- note- (careful may have switched) - dob.obj.gsub!(/(#{Mx[:en_b_o]})[+](\d+)\s+(.+?)(#{Mx[:en_b_c]})/, - %{#{Mx[:nbsp]}#{Mx[:nbsp]}#{pls}\\2#{Mx[:nbsp]} } + #note- endnote- - %{\\1#{pls}\\2 #{Mx[:nbsp]}#{pls}\\2. \\3 \\4}) #endnote- note- (careful may have switched) # double-check there may here be a bug + unless dob.is ==:code + dob.obj=dob.obj.gsub(/(#{Mx[:en_a_o]}|#{Mx[:en_b_o]})(\d+)\s+(.+?)(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/, + %{#{Mx[:nbsp]}#{Mx[:nbsp]}\\2#{Mx[:nbsp]} } + #note- endnote- + %{\\1\\2 #{Mx[:nbsp]}\\2. \\3 \\4}). #endnote- note- (careful may have switched) + gsub(/(#{Mx[:en_b_o]})[*](\d+)\s+(.+?)(#{Mx[:en_b_c]})/, + %{#{Mx[:nbsp]}#{Mx[:nbsp]}#{ast}\\2#{Mx[:nbsp]} } + #note- endnote- + %{\\1#{ast}\\2 #{Mx[:nbsp]}#{ast}\\2. \\3 \\4}). #endnote- note- (careful may have switched) + gsub(/(#{Mx[:en_b_o]})[+](\d+)\s+(.+?)(#{Mx[:en_b_c]})/, + %{#{Mx[:nbsp]}#{Mx[:nbsp]}#{pls}\\2#{Mx[:nbsp]} } + #note- endnote- + %{\\1#{pls}\\2 #{Mx[:nbsp]}#{pls}\\2. \\3 \\4}) #endnote- note- (careful may have switched) # double-check there may here be a bug if dob.obj =~/#{Mx[:en_a_o]}([*+]+)\s+.+?#{Mx[:en_a_c]}/ m=$1.length.to_i - dob.obj.gsub!(/(#{Mx[:en_a_o]})[*]+\s+(.+?)(#{Mx[:en_a_c]})/, - %{#{Mx[:nbsp]}#{Mx[:nbsp]}#{ast*m}#{Mx[:nbsp]} } + #note- endnote- - %{\\1#{ast*m} #{Mx[:nbsp]}#{ast*m} \\2 \\3}) #endnote- note- (careful may have switched) - dob.obj.gsub!(/(#{Mx[:en_a_o]})([+]+)\s+(.+?)(#{Mx[:en_a_c]})/, - %{#{Mx[:nbsp]}#{Mx[:nbsp]}#{pls*m}#{Mx[:nbsp]} } + #note- endnote- - %{\\1#{pls*m} #{Mx[:nbsp]}#{pls*m} \\2 \\3}) #endnote- note- (careful may have switched) + dob.obj=dob.obj.gsub(/(#{Mx[:en_a_o]})[*]+\s+(.+?)(#{Mx[:en_a_c]})/, + %{#{Mx[:nbsp]}#{Mx[:nbsp]}#{ast*m}#{Mx[:nbsp]} } + #note- endnote- + %{\\1#{ast*m} #{Mx[:nbsp]}#{ast*m} \\2 \\3}). #endnote- note- (careful may have switched) + gsub(/(#{Mx[:en_a_o]})([+]+)\s+(.+?)(#{Mx[:en_a_c]})/, + %{#{Mx[:nbsp]}#{Mx[:nbsp]}#{pls*m}#{Mx[:nbsp]} } + #note- endnote- + %{\\1#{pls*m} #{Mx[:nbsp]}#{pls*m} \\2 \\3}) #endnote- note- (careful may have switched) end end @tuned_file << dob @@ -401,8 +396,7 @@ module SiSU_EPUB_Tune data=@data @tuned_file=[] data.each do |dob| - dob.obj.strip! - dob.obj.chomp! + dob.obj=dob.obj.strip.chomp @tuned_file << dob end @tuned_file << "\n" if (@md.fns =~/\.sst0/) #remove diff --git a/lib/sisu/v3/errors.rb b/lib/sisu/v3/errors.rb index 70ab4666..25ef688c 100644 --- a/lib/sisu/v3/errors.rb +++ b/lib/sisu/v3/errors.rb @@ -59,7 +59,7 @@ module SiSU_Errors require_relative 'sysenv' # sysenv.rb include SiSU_Env; include SiSU_Screen - class Info_error #{l}   } end - sv=SiSU_Env::Info_version.instance.get_version + sv=SiSU_Env::InfoVersion.instance.get_version < diff --git a/lib/sisu/v3/harvest_topics.rb b/lib/sisu/v3/harvest_topics.rb index de03b615..dd7ec8c2 100644 --- a/lib/sisu/v3/harvest_topics.rb +++ b/lib/sisu/v3/harvest_topics.rb @@ -58,7 +58,7 @@ ** Description: simple xml representation (sax style) =end -module HARVEST_topics +module SiSU_Harvest_Topics require_relative 'author_format' # author_format.rb include SiSU_Viz class Songsheet @@ -72,8 +72,8 @@ module HARVEST_topics idx_array={} @opt.f_pths.each do |y| lang_hash_file_array={} - name=y[:f] - filename=y[:pth] + '/' + y[:f] + name=y[:f] + filename=y[:pth] + '/' + y[:f] File.open(filename,'r') do |file| file.each_line("\n\n") do |line| if line =~/^@(?:title|creator|classify):(?:\s|$)/m @@ -87,11 +87,11 @@ module HARVEST_topics end lang_hash_file_array.each_pair do |lang,a| idx_array[lang] ||= [] - idx_array=HARVEST_topics::Harvest.new(@opt,@env,a,filename,name,idx_array,lang).extract_harvest + idx_array=SiSU_Harvest_Topics::Harvest.new(@opt,@env,a,filename,name,idx_array,lang).extract_harvest end end - the_idx=HARVEST_topics::Index.new(@opt,@env,idx_array,@@the_idx_topics).construct_book_topic_index - HARVEST_topics::Output_index.new(@opt,the_idx).html_print.html_songsheet + the_idx=SiSU_Harvest_Topics::Index.new(@opt,@env,idx_array,@@the_idx_topics).construct_book_topic_index + SiSU_Harvest_Topics::OutputIndex.new(@opt,the_idx).html_print.html_songsheet end end class Harvest @@ -125,7 +125,7 @@ module HARVEST_topics if @title \ and @author_format \ and @idx_list - creator=FORMAT::Author.new(@author_format.strip).author_details + creator=SiSU_FormatAuthor::Author.new(@author_format.strip).author_details @authors,@authorship=creator[:authors],creator[:authorship] file=if name=~/~[a-z]{2,3}\.ss[mt]$/ name.sub(/~[a-z]{2,3}\.ss[mt]$/,'') @@ -144,7 +144,7 @@ module HARVEST_topics g=@idx_list.scan(/[^;]+/) idxl=[] g.each do |i| - i.strip! + i=i.strip idxl << { filename: filename, file: file, rough_idx: i, title: @fulltitle, author: creator, page: page, lang: lang } end idxl @@ -153,7 +153,7 @@ module HARVEST_topics else p "missing required field in #{@filename} - [title]: <<#{@title}>>; [author]: <<#{@author_format}>>; [idx]: <<#{@idx_list}>>" if @opt.cmd.inspect =~/[VM]/ end - idx_array[lang].flatten! + idx_array[lang]=idx_array[lang].flatten idx_array end end @@ -259,15 +259,15 @@ module HARVEST_topics @the_idx end end - class Output_index + class OutputIndex require_relative 'i18n' # i18n.rb def initialize(opt,the_idx) @opt,@the_idx=opt,the_idx - @env=SiSU_Env::Info_env.new - @rc=SiSU_Env::Get_init.instance.sisu_yaml.rc + @env=SiSU_Env::InfoEnv.new + @rc=SiSU_Env::GetInit.instance.sisu_yaml.rc @alph=%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] @letter=@alph.shift - @vz=SiSU_Env::Get_init.instance.skin + @vz=SiSU_Env::GetInit.instance.skin end def html_file_open @the_idx.keys.each do |lng| @@ -335,7 +335,7 @@ module HARVEST_topics l=ln[lng][:t] harvest_languages += %{#{l}   } end - sv=SiSU_Env::Info_version.instance.get_version + sv=SiSU_Env::InfoVersion.instance.get_version < diff --git a/lib/sisu/v3/help.rb b/lib/sisu/v3/help.rb index 9dc26aec..35a96170 100644 --- a/lib/sisu/v3/help.rb +++ b/lib/sisu/v3/help.rb @@ -68,8 +68,8 @@ module SiSU_Help else @cX=SiSU_Screen::Ansi.new('yes').cX end fns='help_example_dummy_file_name.sst' - @env=SiSU_Env::Info_env.new(fns) - @db=SiSU_Env::Info_db.new + @env=SiSU_Env::InfoEnv.new(fns) + @db=SiSU_Env::InfoDb.new m=/.+\/(?:src\/)?(\S+)/im # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m @output_stub=Dir.pwd[m,1] end @@ -337,7 +337,7 @@ WOK WOK end def shortcuts - cf_defaults=SiSU_Env::Info_processing_flag.new + cf_defaults=SiSU_Env::InfoProcessingFlag.new print < def level_endnotes if @md.flag_endnotes - format_head_scroll=SiSU_HTML_Format::Head_scroll.new(@md) + format_head_scroll=SiSU_HTML_Format::HeadScroll.new(@md) @@toc[:scr] << format_head_scroll.toc_endnote end end def level_concordance - format_head_toc=SiSU_HTML_Format::Head_toc.new(@md) + format_head_toc=SiSU_HTML_Format::HeadToc.new(@md) @@toc[:seg_mini] << format_head_toc.mini_seg_concordance end def level_metadata - format_head_toc=SiSU_HTML_Format::Head_toc.new(@md) + format_head_toc=SiSU_HTML_Format::HeadToc.new(@md) @@toc[:scr] << format_head_toc.metadata @@toc[:seg] << format_head_toc.seg_metadata @@toc[:seg_mini] << format_head_toc.mini_seg_metadata end def level_word_index - format_head_toc=SiSU_HTML_Format::Head_toc.new(@d0c) + format_head_toc=SiSU_HTML_Format::HeadToc.new(@d0c) @@toc[:scr] << format_head_toc.concordance @@toc[:seg] << format_head_toc.concordance @@toc[:seg_mini] << format_head_toc.mini_concordance @@ -317,7 +313,7 @@ WOK linkname,link=dob.obj.strip,dob.ocn if link \ and link !~/#/ #% keep eye on link - p_num=SiSU_HTML_Format::Paragraph_number.new(@md,link) + p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,link) end title=if dob.obj !~/Metadata/; linkname else @@ -326,7 +322,7 @@ WOK end toc={} txt_obj={ txt: title } - format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) + format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj) toc[:seg]=if dob.name =~/^meta/ \ and dob.obj =~/Document Information/ format_toc.lev0 @@ -354,7 +350,7 @@ WOK %{#{linkname}} end txt_obj={ txt: title } - format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) + format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj) toc[:scr]=if dob.name =~/^meta/ \ and dob.obj =~/Document Information/ format_toc.lev0 @@ -367,18 +363,18 @@ WOK linkname,ocn=dob.obj.strip,dob.ocn p_num=if ocn \ and ocn !~/#/ - SiSU_HTML_Format::Paragraph_number.new(@md,ocn) + SiSU_HTML_Format::ParagraphNumber.new(@md,ocn) else nil end txt_obj={ txt: linkname } - format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) + format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj) toc={} toc[:seg]=format_toc.lev2 toc[:seg_mini]=format_toc.mini_lev2 if p_num title=%{#{p_num.goto}#{linkname}} txt_obj={ txt: title } - format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) + format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj) toc[:scr]=format_toc.lev2 end toc @@ -388,18 +384,18 @@ WOK linkname,ocn=dob.obj.strip,dob.ocn p_num=if ocn \ and ocn !~/#/ - SiSU_HTML_Format::Paragraph_number.new(@md,ocn) + SiSU_HTML_Format::ParagraphNumber.new(@md,ocn) else nil end txt_obj={ txt: linkname } - format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) + format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj) toc={} toc[:seg]=format_toc.lev3 toc[:seg_mini]=format_toc.mini_lev3 if p_num title=%{#{p_num.goto}#{linkname}} txt_obj={ txt: title } - format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) + format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj) toc[:scr]=format_toc.lev3 end toc @@ -407,7 +403,7 @@ WOK def level_4 dob=@data linkname,ocn=dob.obj.strip,dob.ocn - p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) if ocn + p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn) if ocn if dob.ln ==4 seg_link=%{ #{dob.obj} @@ -418,8 +414,8 @@ WOK %{\\1 \\2 }) end - p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) if ocn - @file=SiSU_Env::SiSU_file.new(@md) if @md + p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn) if ocn + @file=SiSU_Env::FileOp.new(@md) if @md txt_obj=if seg_link=~/sisu_manifest\.html/ man_link=if @file.output_dir_structure.by_language_code? \ or @file.output_dir_structure.by_filetype? @@ -429,7 +425,7 @@ WOK { txt: man_link } else { txt: seg_link } end - format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) + format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj) toc={} toc[:seg]=format_toc.lev4 toc[:seg_mini]=format_toc.mini_lev4 @@ -439,7 +435,7 @@ WOK { txt: man_link } else { txt: title } end - format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) + format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj) toc[:scr]=format_toc.lev4 toc #end @@ -450,17 +446,17 @@ WOK toc={} if ocn \ and ocn !~/#/ - p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) + p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn) lnk_n_txt=%{ #{linkname} } txt_obj={ txt: lnk_n_txt } - format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) + format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj) toc[:seg]=format_toc.lev5 toc[:seg_mini]=format_toc.mini_lev5 title=%{#{p_num.goto}#{linkname}} txt_obj={ txt: title } - format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) + format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj) toc[:scr]=format_toc.lev5 end toc @@ -471,25 +467,25 @@ WOK toc={} if ocn \ and ocn !~/#/ - p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) + p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn) lnk_n_txt=%{ #{linkname} } txt_obj={ txt: lnk_n_txt } - format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) + format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj) toc[:seg]=format_toc.lev6 toc[:seg_mini]=format_toc.mini_lev6 title=%{#{p_num.goto}#{linkname}} txt_obj={ txt: title } - format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) + format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj) toc[:scr]=format_toc.lev6 end toc end def level_crosslink dob=@data - if dob !~/^4~!/ - dob.gsub!(/^4~!\s+(\S+)\s+(.+)/, + dob=if dob !~/^4~!/ + dob.gsub(/^4~!\s+(\S+)\s+(.+)/, %{
#{@png.crosslink_ext} @@ -498,7 +494,7 @@ WOK
}) else - dob.gsub!(/^4~!\s+(\S+)\s+(.+)/, + dob.gsub(/^4~!\s+(\S+)\s+(.+)/, %{} + else '' + end end def pdf #retired 2.7.9 pdf=if @md.programs[:pdf] \ @@ -263,44 +317,49 @@ module SiSU_HTML_Format end class XML end - class Head_toc < Head_information + class HeadToc < HeadInformation def initialize(md) super(md) @md=md + @o_str ||=SiSU_Env::ProcessingSettings.new(md).output_dir_structure + @make=SiSU_Env::ProcessingSettings.new(@md) end def scroll_head_navigation_band - pdf=if @md.programs[:pdf] - < - #{make_seg_scroll_pdf} + #{make_scroll_search_form_and_manifest_link} WOK - else '' - end - %{
@@ -510,31 +506,32 @@ WOK end end end - class Scroll_head_and_segtoc < Toc + class ScrollHeadAndSegToc < Toc def initialize(md='',toc='',links_guide_toc='') @md,@toc,@links_guide_toc=md,toc,links_guide_toc - @vz=SiSU_Env::Get_init.instance.skin + @vz=SiSU_Env::GetInit.instance.skin + @make=SiSU_Env::ProcessingSettings.new(@md) end def in_common toc_shared=[] @segtoc=[] SiSU_Screen::Ansi.new(@md.opt.cmd,'Scroll & Segtoc').txt_grey if @md.opt.cmd =~/[MVv]/ - format_head_toc=SiSU_HTML_Format::Head_toc.new(@md) + format_head_toc=SiSU_HTML_Format::HeadToc.new(@md) dochead=format_head_toc.head - dochead.gsub!(/toc\.(html)/,'doc.\1') #kludge - ads=SiSU_HTML_promo::Ad.new(@md) + dochead=dochead.gsub(/toc\.(html)/,'doc.\1') #kludge + ads=SiSU_HTML_Promo::Ad.new(@md) toc_shared << dochead << ads.div.major @segtoc << format_head_toc.head << ads.div.major - toc_shared << format_head_toc.toc_head_escript if SiSU_HTML_Format::Head_toc.method_defined? :toc_head_escript - @segtoc << format_head_toc.toc_head_escript if SiSU_HTML_Format::Head_toc.method_defined? :toc_head_escript + toc_shared << format_head_toc.toc_head_escript if SiSU_HTML_Format::HeadToc.method_defined? :toc_head_escript + @segtoc << format_head_toc.toc_head_escript if SiSU_HTML_Format::HeadToc.method_defined? :toc_head_escript toc_shared << format_head_toc.scroll_head_navigation_band if defined? @md.rights.all rights=format_head_toc.rights.all - rights=SiSU_HTML_Tune::Clean_html.new(rights).clean + rights=SiSU_HTML_Tune::CleanHTML.new(rights).clean end if @md.prefix_b prefix_b=format_head_toc.notes.prefix_b - prefix_b=SiSU_HTML_Tune::Clean_html.new(prefix_b).clean + prefix_b=SiSU_HTML_Tune::CleanHTML.new(prefix_b).clean end @segtoc << format_head_toc.seg_head_navigation_band toc_shared << format_head_toc.scroll_head_title_banner_open @@ -543,14 +540,14 @@ WOK doc_title_endnote=@md.title.full.gsub(/(\*+)/,'\1') tmp_head=doc_title_endnote + "\n" txt_obj={ txt: tmp_head } - format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,txt_obj) + format_txt_obj=SiSU_HTML_Format::FormatTextObject.new(@md,txt_obj) toc_shared << format_txt_obj.center_bold @segtoc << format_txt_obj.center_bold if defined? @md.creator.author creator_endnote=@md.creator.author.gsub(/(\*+)/,%{ \\1}) tmp_head=creator_endnote + "\n" txt_obj={ txt: tmp_head } - format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,txt_obj) + format_txt_obj=SiSU_HTML_Format::FormatTextObject.new(@md,txt_obj) toc_shared << format_txt_obj.center_bold @segtoc << format_txt_obj.center_bold end @@ -570,8 +567,9 @@ WOK if defined? @md.prefix_b toc_shared << prefix_b end - #Table of Contents added/appended here - toc_shared << @toc[:scr] + scr_toc=if @make.build.toc? #Table of Contents added/appended here + toc_shared << @toc[:scr] + end @segtoc << @links_guide_toc @segtoc << @toc[:seg] if defined? @md.rights.all \ @@ -582,20 +580,20 @@ WOK #Segtoc tail added here @segtoc << "

\n" #bugfix sort later DEBUGNOW @segtoc << @seg_toc_band_bottom - ads=SiSU_HTML_promo::Ad.new(@md) + 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.flatten!.compact! - Output.new(@segtoc,@md).segtoc + @segtoc=@segtoc.flatten.compact #watch + SiSU_HTML::Source::Output.new(@segtoc,@md).segtoc @segtoc=[] @toc[:scr],@toc[:seg]=[],[] toc_shared end end - class Table < SiSU_HTML_table::Table_html + class Table < SiSU_HTML_Table::TableHTML end - class Scroll < SiSU_HTML_scroll::Scroll + class Scroll < SiSU_HTML_Scroll::Scroll end - class Scroll_output + class ScrollOutput def initialize(scr_toc,scr_body,scr_metadata,scr_owner_details,scr_tails,md) @scr_toc,@scr_body,@scr_metadata,@scr_owner_details,@scr_tails,@md=scr_toc,scr_body,scr_metadata,scr_owner_details,scr_tails,md end @@ -603,31 +601,32 @@ WOK scroll=[] hr='

' scroll << @scr_toc << '
' << hr << @scr_body << @scr_endnotes << hr << @scr_owner_details << '
' << @scr_tails - scroll.flatten!.compact! + scroll=scroll.flatten.compact #watch end end - class Seg < SiSU_HTML_seg::Seg + class Seg < SiSU_HTML_Seg::Seg end class Output def initialize(data='',md='') @data,@md=data,md - @file=SiSU_Env::SiSU_file.new(@md) + @file=SiSU_Env::FileOp.new(md) + @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.strip! - para.gsub!(/<:.+?>/,'') - para.gsub!(Xx[:html_relative2],@file.path_rel_links.html_scroll_2) - para.gsub!(Xx[:html_relative1],@file.path_rel_links.html_scroll_1) - #para.gsub!(/#{Xx[:html_relative]}/,@file.path_rel_links.html_scroll) - para.gsub!(/#{Rx[:mx_fa_clean]}/,'') + 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::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error + rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error ensure; @filename_html_scroll.close end end @@ -635,26 +634,28 @@ WOK begin @filename_html_segtoc=@file.write_file.html_segtoc @data.each do |para| - para.strip! - para.gsub!(//,'') - para.gsub!(Xx[:html_relative2],@file.path_rel_links.html_seg_2) - para.gsub!(Xx[:html_relative1],@file.path_rel_links.html_seg_1) + 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::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error + rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error ensure @filename_html_segtoc.close - unless FileTest.file?("#{@file.output_path.html_seg.dir}/#{@md.file.base_filename.html_seg_index}") - pwd_set=Dir.pwd - idx_lnk=@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) + pwd_set=Dir.pwd + idx_lnk=if @o_str.dump_or_redirect? + @file.base_filename.manifest + else + @file.base_filename.html_segtoc end + 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/v3/html_format.rb index 3dd0cecc..56360455 100644 --- a/lib/sisu/v3/html_format.rb +++ b/lib/sisu/v3/html_format.rb @@ -58,31 +58,26 @@ =end module SiSU_HTML_Format include SiSU_Viz - class Paragraph_number + class ParagraphNumber def initialize(md,ocn) @md,@ocn=md,ocn.to_s @ocn ||='' - vz=SiSU_Env::Get_init.instance.skin - @skin_no_ocn=if defined? vz.ocn_display_off \ - and vz.ocn_display_off==true - true - else false - end end def ocn_display - if @md.markup.inspect =~/no_ocn/ \ - or @md.opt.mod.inspect =~/--no-ocn/ \ - or @skin_no_ocn - ocn_class='ocn_off' - @ocn.gsub(/^(\d+|)$/, - %{}) - elsif @ocn.to_i==0 - @ocn.gsub(/^(\d+|)$/, - %{}) - else + @make=SiSU_Env::ProcessingSettings.new(@md) + if @make.build.ocn? ocn_class='ocn' + if @ocn.to_i==0 + @ocn.gsub(/^(\d+|)$/, + %{}) + else + @ocn.gsub(/^(\d+|)$/, + %{}) + end + else + ocn_class='ocn_off' @ocn.gsub(/^(\d+|)$/, - %{}) + %{}) end end def name @@ -95,24 +90,74 @@ module SiSU_HTML_Format %{} end end - class Head_information + class HeadInformation + require_relative 'css' # css.rb require_relative 'shared_xml' # shared_xml.rb include SiSU_Viz attr_reader :md,:rdf,:vz def initialize(md) @md=md # DublinCore 1 - title - @vz=SiSU_Env::Get_init.instance.skin - @css=SiSU_Env::CSS_stylesheet.new(md) + @vz=SiSU_Env::GetInit.instance.skin @seg_name_html=(SiSU_HTML::Source::Seg.new.seg_name_html || []) @seg_name_html_tracker=(SiSU_HTML::Source::Seg.new.seg_name_html_tracker || []) - @toc,@index='toc','index' @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}" + end + def url_path_image_sys + (@o_str.dump_or_redirect?) \ + ? './image' + : "#{Xx[:html_relative2]}_sisu/image_sys" + end + def icon + def up + 'arrow_up_red.png' + end + def next + 'arrow_next_red.png' + end + def previous + 'arrow_prev_red.png' + end + def dot_clear + 'dot_clear.png' + end + def dot_white + 'dot_white.png' + end + def dot + dot_white + end + self + end + def png_nav + def toc + %{TOC} + end + def pre + %{<< previous} + end + def nxt + %{next >>} + end + def dot_toc + %{^} + end + def dot_pre + %{<} + end + def dot_nxt + %{>} + end + self end def doc_types #used in toc & seg_nav_band scroll=seg='' - wgt=Widget.new(@md) + wgt=SiSU_HTML_Format::Widget.new(@md) %{ @@ -122,7 +167,7 @@ module SiSU_HTML_Format
} end def rdf - SiSU_XML_tags::RDF.new(md) + SiSU_XML_Tags::RDF.new(md) end def doc_type %{} end end - class Widget < Head_information + class Widget < HeadInformation def initialize(md) super(md) @md=md - @cf_defaults=SiSU_Env::Info_processing_flag.new - @env=SiSU_Env::Info_env.new(@md.fns) - @file=SiSU_Env::SiSU_file.new(@md) + @cf_defaults=SiSU_Env::InfoProcessingFlag.new + @env=SiSU_Env::InfoEnv.new(md.fns) + @file=SiSU_Env::FileOp.new(md) + @o_str ||=SiSU_Env::ProcessingSettings.new(md).output_dir_structure + @make=SiSU_Env::ProcessingSettings.new(@md) end def home %{
@@ -183,20 +230,27 @@ module SiSU_HTML_Format } end def search - env=SiSU_Env::Info_env.new(@md.fns,@md) - env.widget.search_form('sisusearch',nil,nil,true) + if @make.build.html_search_form? + env=SiSU_Env::InfoEnv.new(@md.fns,@md) + env.widget.search_form('sisusearch',nil,nil,true) + else '' + end end def manifest - manifest_lnk=if @file.output_dir_structure.by_language_code? \ - or @file.output_dir_structure.by_filetype? - "#{Xx[:html_relative1]}manifest/#{@file.base_filename.manifest}" - else @file.base_filename.manifest - end + if @make.build.links_to_manifest? \ + and not @o_str.dump_or_redirect? + manifest_lnk=if @file.output_dir_structure.by_language_code? \ + or @file.output_dir_structure.by_filetype? + "#{Xx[:html_relative1]}manifest/#{@file.base_filename.manifest}" + else @file.base_filename.manifest + end %{ #{@vz.nav_txt_manifest}
+ %{
#{pdf} +#{search_and_manifest}
#{@vz.banner_band} -   #{@vz.table_close}

} + else '' + end end def concordance_navigation_band(type='') - %{ + if @make.build.html_top_band? + %{
#{@vz.banner_band}   - #{@vz.png_nav_toc} + #{png_nav.toc}   #{@vz.table_close}

} + else '' + end end def seg_head_navigation_band(type='') firstseg=%{ - #{@vz.png_nav_nxt} + #{png_nav.nxt} } if @md.firstseg =~/\S+/ %{
@@ -312,29 +371,10 @@ WOK  #{firstseg}  #{@vz.table_close} -

} - end - def seg_head_navigation_band_bottom(type='') #retired 2.7.9 - if type=~/pdf/ - @tocband_segtoc=make_scroll_seg_pdf - end - firstseg=%{ - #{@vz.png_nav_nxt} - } if @md.firstseg =~/\S+/ - %{ - - - @@ -363,7 +403,7 @@ WOK end def make_scroll_seg_pdf manifest=scroll=seg='' - wgt=Widget.new(@md) + wgt=SiSU_HTML_Format::Widget.new(@md) seg=%{ @@ -377,7 +417,7 @@ WOK end def make_concordance manifest=scroll=seg='' - wgt=Widget.new(@md) + wgt=SiSU_HTML_Format::Widget.new(@md) %{
-   - - #{@tocband_segtoc} - -  #{firstseg}  -#{@vz.table_close}

} end def manifest_link(text) -# @file=SiSU_Env::SiSU_file.new(@md) if @md +# @file=SiSU_Env::FileOp.new(@md) if @md %{ #{text} } @@ -349,8 +389,8 @@ WOK else '' end end - def make_seg_scroll_pdf - wgt=Widget.new(@md) + def make_scroll_search_form_and_manifest_link + wgt=SiSU_HTML_Format::Widget.new(@md) scroll=%{

#{@vz.nav_txt_doc_link} #{@vz.nav_txt_toc_link}
@@ -386,7 +426,7 @@ WOK
} end def head - rdf=SiSU_XML_tags::RDF.new(@md) + rdf=SiSU_XML_Tags::RDF.new(@md) %{#{doc_type} @@ -394,7 +434,7 @@ WOK #{rdf.metatag_html} -#{@css.html}#{@css.html_seg} +#{@stylesheet.css_head} #{@vz.color_body} @@ -417,7 +457,7 @@ WOK end end def links_guide_vertical_open -# @file=SiSU_Env::SiSU_file.new(@md) if @md +# @file=SiSU_Env::FileOp.new(@md) if @md url=((defined? @vz.url_hp) && @vz.url_hp =~/^https?:\/\/\S+$/ ? @vz.url_hp : @vz.url_home) %{