summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2012-10-03 04:11:08 +0000
committerRalph Amissah <ralph@amissah.com>2012-10-03 04:11:08 +0000
commit804a103722aa7731ca7f2062ee2ebf533607e6aa (patch)
treea480caebb78925848807692c57c017b3ae5e6839
parentv3: 3.3.3 version & changelog, dates touched (diff)
downloadsisu-804a103722aa7731ca7f2062ee2ebf533607e6aa.zip
sisu-804a103722aa7731ca7f2062ee2ebf533607e6aa.tar.xz
v4: 4.0.0 new branch & version & changelog "opened"
-rw-r--r--CHANGELOG34
l---------CHANGELOGS/CHANGELOG_v11
l---------CHANGELOGS/CHANGELOG_v21
l---------CHANGELOGS/CHANGELOG_v31
l---------CHANGELOGS/CHANGELOG_v41
l---------CHANGELOG_v11
l---------CHANGELOG_v21
l---------CHANGELOG_v31
-rw-r--r--README29
-rw-r--r--bin/sisu14
-rw-r--r--bin/sisu-git2
-rw-r--r--bin/sisu-po2
-rw-r--r--bin/sisu-webrick2
-rw-r--r--bin/sisu312
-rw-r--r--bin/sisu4 (renamed from bin/sisu2)16
-rw-r--r--bin/sisu_termsheet148
-rw-r--r--bin/sisu_webrick135
-rw-r--r--conf/sisu/v4/sisurc.yml (renamed from conf/sisu/v2/sisurc.yml)28
-rw-r--r--data/doc/sisu/CHANGELOG_v15
-rw-r--r--data/doc/sisu/CHANGELOG_v225
-rw-r--r--data/doc/sisu/CHANGELOG_v36
-rw-r--r--data/doc/sisu/CHANGELOG_v426
-rw-r--r--data/doc/sisu/markup-samples/sisu_manual/_sisu/v4/sisurc.yml (renamed from data/doc/sisu/markup-samples/sisu_manual/_sisu/v2/sisurc.yml)28
-rw-r--r--data/sisu/v2/conf/convert/modify.rb272
-rw-r--r--data/sisu/v2/v/version.yml5
-rw-r--r--data/sisu/v4/conf/cgi-bin/sisu_search_pgsql.cgi (renamed from data/sisu/v2/conf/cgi-bin/sisu_search_pgsql.cgi)0
-rw-r--r--data/sisu/v4/conf/cgi-bin/sisu_search_sqlite.cgi (renamed from data/sisu/v2/conf/cgi-bin/sisu_search_sqlite.cgi)0
-rw-r--r--data/sisu/v4/conf/completion/README (renamed from data/sisu/v2/conf/completion/README)0
-rw-r--r--data/sisu/v4/conf/completion/_sisu (renamed from data/sisu/v2/conf/completion/_sisu)0
-rw-r--r--data/sisu/v4/conf/convert/kdissert_to_sisu (renamed from data/sisu/v2/conf/convert/kdissert_to_sisu)0
-rw-r--r--data/sisu/v4/conf/convert/modify.rb376
-rw-r--r--data/sisu/v4/conf/convert/sisu_convert (renamed from data/sisu/v2/conf/convert/sisu_convert)0
-rw-r--r--data/sisu/v4/conf/convert/wvHtml.xml (renamed from data/sisu/v2/conf/convert/wvHtml.xml)0
-rw-r--r--data/sisu/v4/conf/convert/wvSiSU.xml (renamed from data/sisu/v2/conf/convert/wvSiSU.xml)0
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/README (renamed from data/sisu/v2/conf/editor-syntax-etc/README)0
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/diakonos/diakonos.conf (renamed from data/sisu/v2/conf/editor-syntax-etc/diakonos/diakonos.conf)0
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/emacs/README (renamed from data/sisu/v2/conf/editor-syntax-etc/emacs/README)0
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/emacs/sisu-mode.el (renamed from data/sisu/v2/conf/editor-syntax-etc/emacs/sisu-mode.el)12
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/gedit/sisu.lang (renamed from data/sisu/v2/conf/editor-syntax-etc/gedit/sisu.lang)0
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/kate/sisu.xml (renamed from data/sisu/v2/conf/editor-syntax-etc/kate/sisu.xml)0
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/nano/nanorc (renamed from data/sisu/v2/conf/editor-syntax-etc/nano/nanorc)0
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/nedit/sisu_nedit.pats (renamed from data/sisu/v2/conf/editor-syntax-etc/nedit/sisu_nedit.pats)0
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/vim/colors/8.vim (renamed from data/sisu/v2/conf/editor-syntax-etc/vim/colors/8.vim)0
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/vim/colors/frugal-cterm-ruby.vim (renamed from data/sisu/v2/conf/editor-syntax-etc/vim/colors/frugal-cterm-ruby.vim)0
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/vim/colors/frugal-cterm-sisu.vim (renamed from data/sisu/v2/conf/editor-syntax-etc/vim/colors/frugal-cterm-sisu.vim)0
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/vim/colors/frugal.vim (renamed from data/sisu/v2/conf/editor-syntax-etc/vim/colors/frugal.vim)0
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/vim/colors/slate.vim (renamed from data/sisu/v2/conf/editor-syntax-etc/vim/colors/slate.vim)0
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/vim/colors/sparse-cterm-ruby.vim (renamed from data/sisu/v2/conf/editor-syntax-etc/vim/colors/sparse-cterm-ruby.vim)0
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/vim/colors/sparse-cterm-sisu.vim (renamed from data/sisu/v2/conf/editor-syntax-etc/vim/colors/sparse-cterm-sisu.vim)0
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/vim/filetype.vim (renamed from data/sisu/v2/conf/editor-syntax-etc/vim/filetype.vim)0
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/vim/ftplugin/sisu.vim (renamed from data/sisu/v2/conf/editor-syntax-etc/vim/ftplugin/sisu.vim)9
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/vim/syntax/sisu.vim (renamed from data/sisu/v2/conf/editor-syntax-etc/vim/syntax/sisu.vim)149
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/vim/syntax/sisu_next.vim281
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/vim/templates/ssi.tpl (renamed from data/sisu/v2/conf/editor-syntax-etc/vim/templates/ssi.tpl)0
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/vim/templates/ssm.tpl (renamed from data/sisu/v2/conf/editor-syntax-etc/vim/templates/ssm.tpl)0
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/vim/templates/sst.tpl (renamed from data/sisu/v2/conf/editor-syntax-etc/vim/templates/sst.tpl)0
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/vim/vim-sisu.yaml (renamed from data/sisu/v2/conf/editor-syntax-etc/vim/vim-sisu.yaml)0
-rw-r--r--data/sisu/v4/conf/lighttpd/lighttpd.cfg.sisu (renamed from data/sisu/v2/conf/lighttpd/lighttpd.cfg.sisu)0
-rw-r--r--data/sisu/v4/conf/lighttpd/lighttpd.cfg.sisu_www (renamed from data/sisu/v2/conf/lighttpd/lighttpd.cfg.sisu_www)0
-rw-r--r--data/sisu/v4/conf/ruby/irbrc (renamed from data/sisu/v2/conf/ruby/irbrc)0
-rw-r--r--data/sisu/v4/v/version.yml5
-rw-r--r--lib/sisu/v2/character_encoding.rb379
-rw-r--r--lib/sisu/v2/constants.rb204
-rw-r--r--lib/sisu/v2/dal.rb475
-rw-r--r--lib/sisu/v2/dal_doc_objects.rb425
-rw-r--r--lib/sisu/v2/dal_doc_str.rb1184
-rw-r--r--lib/sisu/v2/dal_expand_insertions.rb198
-rw-r--r--lib/sisu/v2/dal_syntax.rb522
-rw-r--r--lib/sisu/v2/db_dbi.rb93
-rw-r--r--lib/sisu/v2/epub_tune.rb416
-rw-r--r--lib/sisu/v2/harvest.rb101
-rw-r--r--lib/sisu/v2/harvest_authors.rb316
-rw-r--r--lib/sisu/v2/harvest_topics.rb559
-rw-r--r--lib/sisu/v2/html_tune.rb371
-rw-r--r--lib/sisu/v2/hub.rb580
-rw-r--r--lib/sisu/v2/manifest.rb713
-rw-r--r--lib/sisu/v2/manpage.rb420
-rw-r--r--lib/sisu/v2/odf.rb735
-rw-r--r--lib/sisu/v2/odf_format.rb468
-rw-r--r--lib/sisu/v2/options.rb217
-rw-r--r--lib/sisu/v2/plaintext.rb419
-rw-r--r--lib/sisu/v2/shared_markup_alt.rb318
-rw-r--r--lib/sisu/v2/shared_metadata.rb800
-rw-r--r--lib/sisu/v2/shared_xml.rb706
-rw-r--r--lib/sisu/v2/sisupod_make.rb338
-rw-r--r--lib/sisu/v2/sysenv.rb3366
-rw-r--r--lib/sisu/v2/texpdf.rb830
-rw-r--r--lib/sisu/v2/update.rb130
-rw-r--r--lib/sisu/v2/urls.rb279
-rw-r--r--lib/sisu/v2/webrick.rb176
-rw-r--r--lib/sisu/v4/air.rb (renamed from lib/sisu/v2/air.rb)18
-rw-r--r--lib/sisu/v4/author_format.rb (renamed from lib/sisu/v2/author_format.rb)37
-rw-r--r--lib/sisu/v4/cgi.rb (renamed from lib/sisu/v2/cgi.rb)30
-rw-r--r--lib/sisu/v4/cgi_pgsql.rb (renamed from lib/sisu/v2/cgi_pgsql.rb)75
-rw-r--r--lib/sisu/v4/cgi_sql_common.rb (renamed from lib/sisu/v2/cgi_sql_common.rb)293
-rw-r--r--lib/sisu/v4/cgi_sqlite.rb (renamed from lib/sisu/v2/cgi_sqlite.rb)70
-rw-r--r--lib/sisu/v4/composite.rb (renamed from lib/sisu/v2/composite.rb)132
-rw-r--r--lib/sisu/v4/concordance.rb (renamed from lib/sisu/v2/concordance.rb)214
-rw-r--r--lib/sisu/v4/conf.rb (renamed from lib/sisu/v2/conf.rb)111
-rw-r--r--lib/sisu/v4/constants.rb294
-rw-r--r--lib/sisu/v4/css.rb (renamed from lib/sisu/v2/css.rb)1452
-rw-r--r--lib/sisu/v4/dal.rb510
-rw-r--r--lib/sisu/v4/dal_character_check.rb (renamed from lib/sisu/v2/dal_character_check.rb)51
-rw-r--r--lib/sisu/v4/dal_doc_objects.rb445
-rw-r--r--lib/sisu/v4/dal_doc_str.rb1044
-rw-r--r--lib/sisu/v4/dal_endnotes.rb (renamed from lib/sisu/v2/dal_endnotes.rb)31
-rw-r--r--lib/sisu/v4/dal_expand_insertions.rb378
-rw-r--r--lib/sisu/v4/dal_hash_digest.rb (renamed from lib/sisu/v2/dal_hash_digest.rb)60
-rw-r--r--lib/sisu/v4/dal_idx.rb (renamed from lib/sisu/v2/dal_idx.rb)158
-rw-r--r--lib/sisu/v4/dal_images.rb (renamed from lib/sisu/v2/dal_images.rb)47
-rw-r--r--lib/sisu/v4/dal_metadata.rb (renamed from lib/sisu/v2/dal_metadata.rb)27
-rw-r--r--lib/sisu/v4/dal_numbering.rb (renamed from lib/sisu/v2/dal_numbering.rb)182
-rw-r--r--lib/sisu/v4/dal_substitutions_and_insertions.rb (renamed from lib/sisu/v2/dal_substitutions_and_insertions.rb)59
-rw-r--r--lib/sisu/v4/dal_syntax.rb604
-rw-r--r--lib/sisu/v4/db_columns.rb (renamed from lib/sisu/v2/db_columns.rb)290
-rw-r--r--lib/sisu/v4/db_create.rb (renamed from lib/sisu/v2/db_create.rb)94
-rw-r--r--lib/sisu/v4/db_dbi.rb92
-rw-r--r--lib/sisu/v4/db_drop.rb (renamed from lib/sisu/v2/db_drop.rb)27
-rw-r--r--lib/sisu/v4/db_import.rb (renamed from lib/sisu/v2/db_import.rb)451
-rw-r--r--lib/sisu/v4/db_indexes.rb (renamed from lib/sisu/v2/db_indexes.rb)18
-rw-r--r--lib/sisu/v4/db_load_tuple.rb (renamed from lib/sisu/v2/db_load_tuple.rb)75
-rw-r--r--lib/sisu/v4/db_remove.rb (renamed from lib/sisu/v2/db_remove.rb)33
-rw-r--r--lib/sisu/v4/db_select.rb (renamed from lib/sisu/v2/db_select.rb)124
-rw-r--r--lib/sisu/v4/db_sqltxt.rb (renamed from lib/sisu/v2/db_sqltxt.rb)83
-rw-r--r--lib/sisu/v4/db_tests.rb (renamed from lib/sisu/v2/db_tests.rb)13
-rw-r--r--lib/sisu/v4/dbi.rb (renamed from lib/sisu/v2/dbi.rb)41
-rw-r--r--lib/sisu/v4/dbi_discreet.rb182
-rw-r--r--lib/sisu/v4/defaults.rb (renamed from lib/sisu/v2/defaults.rb)300
-rw-r--r--lib/sisu/v4/digests.rb (renamed from lib/sisu/v2/digests.rb)98
-rw-r--r--lib/sisu/v4/embedded.rb (renamed from lib/sisu/v2/embedded.rb)73
-rw-r--r--lib/sisu/v4/epub.rb (renamed from lib/sisu/v2/epub.rb)455
-rw-r--r--lib/sisu/v4/epub_concordance.rb (renamed from lib/sisu/v2/epub_concordance.rb)152
-rw-r--r--lib/sisu/v4/epub_format.rb (renamed from lib/sisu/v2/epub_format.rb)1377
-rw-r--r--lib/sisu/v4/epub_segments.rb (renamed from lib/sisu/v2/epub_segments.rb)340
-rw-r--r--lib/sisu/v4/epub_tune.rb409
-rw-r--r--lib/sisu/v4/errors.rb (renamed from lib/sisu/v2/errors.rb)38
-rw-r--r--lib/sisu/v4/git.rb (renamed from lib/sisu/v2/git.rb)142
-rw-r--r--lib/sisu/v4/harvest.rb112
-rw-r--r--lib/sisu/v4/harvest_authors.rb387
-rw-r--r--lib/sisu/v4/harvest_topics.rb808
-rw-r--r--lib/sisu/v4/help.rb (renamed from lib/sisu/v2/help.rb)364
-rw-r--r--lib/sisu/v4/html.rb (renamed from lib/sisu/v2/html.rb)373
-rw-r--r--lib/sisu/v4/html_format.rb (renamed from lib/sisu/v2/html_format.rb)522
-rw-r--r--lib/sisu/v4/html_minitoc.rb (renamed from lib/sisu/v2/html_minitoc.rb)114
-rw-r--r--lib/sisu/v4/html_promo.rb (renamed from lib/sisu/v2/html_promo.rb)56
-rw-r--r--lib/sisu/v4/html_scroll.rb (renamed from lib/sisu/v2/html_scroll.rb)136
-rw-r--r--lib/sisu/v4/html_segments.rb (renamed from lib/sisu/v2/html_segments.rb)417
-rw-r--r--lib/sisu/v4/html_table.rb (renamed from lib/sisu/v2/html_table.rb)19
-rw-r--r--lib/sisu/v4/html_tune.rb375
-rw-r--r--lib/sisu/v4/hub.rb713
-rw-r--r--lib/sisu/v4/i18n.rb697
-rw-r--r--lib/sisu/v4/manifest.rb909
-rw-r--r--lib/sisu/v4/manpage.rb432
-rw-r--r--lib/sisu/v4/manpage_format.rb (renamed from lib/sisu/v2/manpage_format.rb)26
-rw-r--r--lib/sisu/v4/odf.rb819
-rw-r--r--lib/sisu/v4/odf_format.rb658
-rw-r--r--lib/sisu/v4/options.rb876
-rw-r--r--lib/sisu/v4/param.rb (renamed from lib/sisu/v2/param.rb)922
-rw-r--r--lib/sisu/v4/param_identify_markup.rb (renamed from lib/sisu/v2/param_identify_markup.rb)15
-rw-r--r--lib/sisu/v4/particulars.rb (renamed from lib/sisu/v2/particulars.rb)104
-rw-r--r--lib/sisu/v4/plaintext.rb434
-rw-r--r--lib/sisu/v4/plaintext_format.rb (renamed from lib/sisu/v2/plaintext_format.rb)39
-rw-r--r--lib/sisu/v4/po4a.rb986
-rw-r--r--lib/sisu/v4/po4a_set.rb299
-rw-r--r--lib/sisu/v4/prog_text_translation.rb (renamed from lib/sisu/v2/i18n.rb)556
-rw-r--r--lib/sisu/v4/qrcode.rb745
-rw-r--r--lib/sisu/v4/relaxng.rb (renamed from lib/sisu/v2/relaxng.rb)21
-rw-r--r--lib/sisu/v4/remote.rb (renamed from lib/sisu/v2/remote.rb)63
-rw-r--r--lib/sisu/v4/response.rb (renamed from lib/sisu/v2/response.rb)17
-rw-r--r--lib/sisu/v4/rexml.rb (renamed from lib/sisu/v2/rexml.rb)38
-rw-r--r--lib/sisu/v4/screen_text_color.rb (renamed from lib/sisu/v2/screen_text_color.rb)130
-rw-r--r--lib/sisu/v4/share_src.rb (renamed from lib/sisu/v2/share_src.rb)48
-rw-r--r--lib/sisu/v4/share_src_kdissert.rb (renamed from lib/sisu/v2/share_src_kdissert.rb)23
-rw-r--r--lib/sisu/v4/shared_html.rb (renamed from lib/sisu/v2/shared_html.rb)19
-rw-r--r--lib/sisu/v4/shared_html_lite.rb (renamed from lib/sisu/v2/shared_html_lite.rb)147
-rw-r--r--lib/sisu/v4/shared_images.rb173
-rw-r--r--lib/sisu/v4/shared_markup_alt.rb321
-rw-r--r--lib/sisu/v4/shared_metadata.rb1360
-rw-r--r--lib/sisu/v4/shared_sem.rb (renamed from lib/sisu/v2/shared_sem.rb)26
-rw-r--r--lib/sisu/v4/shared_sisupod_source.rb376
-rw-r--r--lib/sisu/v4/shared_txt.rb (renamed from lib/sisu/v2/shared_txt.rb)29
-rw-r--r--lib/sisu/v4/shared_xhtml.rb (renamed from lib/sisu/v2/shared_xhtml.rb)19
-rw-r--r--lib/sisu/v4/shared_xml.rb717
-rw-r--r--lib/sisu/v4/sisupod_make.rb161
-rw-r--r--lib/sisu/v4/sitemaps.rb (renamed from lib/sisu/v2/sitemaps.rb)61
-rw-r--r--lib/sisu/v4/spell.rb (renamed from lib/sisu/v2/spell.rb)41
-rw-r--r--lib/sisu/v4/sst_convert_markup.rb (renamed from lib/sisu/v2/sst_convert_markup.rb)61
-rw-r--r--lib/sisu/v4/sst_do_inline_footnotes.rb (renamed from lib/sisu/v2/sst_do_inline_footnotes.rb)139
-rw-r--r--lib/sisu/v4/sst_from_xml.rb (renamed from lib/sisu/v2/sst_from_xml.rb)17
-rw-r--r--lib/sisu/v4/sst_identify_markup.rb (renamed from lib/sisu/v2/sst_identify_markup.rb)65
-rw-r--r--lib/sisu/v4/sst_to_s_xml_sax.rb (renamed from lib/sisu/v2/sst_to_s_xml_sax.rb)130
-rw-r--r--lib/sisu/v4/sysenv.rb6015
-rw-r--r--lib/sisu/v4/termsheet.rb (renamed from lib/sisu/v2/termsheet.rb)23
-rw-r--r--lib/sisu/v4/texinfo.rb (renamed from lib/sisu/v2/texinfo.rb)261
-rw-r--r--lib/sisu/v4/texinfo_format.rb (renamed from lib/sisu/v2/texinfo_format.rb)315
-rw-r--r--lib/sisu/v4/texpdf.rb979
-rw-r--r--lib/sisu/v4/texpdf_format.rb (renamed from lib/sisu/v2/texpdf_format.rb)948
-rw-r--r--lib/sisu/v4/update.rb138
-rw-r--r--lib/sisu/v4/urls.rb442
-rw-r--r--lib/sisu/v4/webrick.rb185
-rw-r--r--lib/sisu/v4/wikispeak.rb (renamed from lib/sisu/v2/wikispeak.rb)81
-rw-r--r--lib/sisu/v4/xhtml.rb (renamed from lib/sisu/v2/xhtml.rb)208
-rw-r--r--lib/sisu/v4/xhtml_table.rb (renamed from lib/sisu/v2/xhtml_table.rb)25
-rw-r--r--lib/sisu/v4/xml.rb (renamed from lib/sisu/v2/xml.rb)215
-rw-r--r--lib/sisu/v4/xml_dom.rb (renamed from lib/sisu/v2/xml_dom.rb)188
-rw-r--r--lib/sisu/v4/xml_fictionbook.rb (renamed from lib/sisu/v2/xml_fictionbook.rb)56
-rw-r--r--lib/sisu/v4/xml_format.rb (renamed from lib/sisu/v2/xml_format.rb)380
-rw-r--r--lib/sisu/v4/xml_md_oai_pmh_dc.rb (renamed from lib/sisu/v2/xml_md_oai_pmh_dc.rb)23
-rw-r--r--lib/sisu/v4/xml_scaffold.rb (renamed from lib/sisu/v2/xml_scaffold.rb)42
-rw-r--r--lib/sisu/v4/xml_tables.rb (renamed from lib/sisu/v2/xml_tables.rb)69
-rw-r--r--lib/sisu/v4/zap.rb (renamed from lib/sisu/v2/zap.rb)19
-rw-r--r--man/man1/sisu-concordance.16
-rw-r--r--man/man1/sisu-epub.16
-rw-r--r--man/man1/sisu-git.139
-rw-r--r--man/man1/sisu-harvest.16
-rw-r--r--man/man1/sisu-html.16
-rw-r--r--man/man1/sisu-odf.16
-rw-r--r--man/man1/sisu-pdf.16
-rw-r--r--man/man1/sisu-pg.16
-rw-r--r--man/man1/sisu-po.142
-rw-r--r--man/man1/sisu-sqlite.16
-rw-r--r--man/man1/sisu-txt.16
-rw-r--r--man/man1/sisu-webrick.1 (renamed from man/man1/sisu_webrick.1)0
-rw-r--r--man/man1/sisu.12
l---------man/man1/sisu4.1 (renamed from man/man1/sisu2.1)0
-rw-r--r--man/man1/sisu_termsheet.166
226 files changed, 33600 insertions, 22925 deletions
diff --git a/CHANGELOG b/CHANGELOG
index c13296b..49c5462 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,26 +1,30 @@
-%% SiSU versions 2 & 3, 2011
+%% SiSU versions 4 & 3 2012
Homepage: <http://www.jus.uio.no/sisu>
-* README CHANGELOG CHANGELOG_v1 CHANGELOG_v2 CHANGELOG_v3
+* README CHANGELOG CHANGELOG_v1 CHANGELOG_v2 CHANGELOG_v3 CHANGELOG_v4
-Herein (this package) reside SiSU versions 2 and 3.
+Herein (this package) reside SiSU versions 4 and 3.
-README CHANGELOG_1 CHANGELOG_v2 CHANGELOG_v3
+Changelogs are to be found in the CHANGELOGS directory:
-This tarball contains two versions of SiSU, the stable version 2 and the
-under-development version 3. For version 1 look to sisu 2.7 and earlier.
+CHANGELOGS/CHANGELOG_v4
+CHANGELOGS/CHANGELOG_v3
+CHANGELOGS/CHANGELOG_v2
+CHANGELOGS/CHANGELOG_v1
-The input for v2 & v3, a SiSU marked-up document is the same.
+you might also look at the README file
-As version 2 is the current implementation the source tarball is named after
-it, and the command sisu by default runs version 2. To run version 3 add the
-flag --v3, i.e. sisu --v3 [filename], or run sisu3
+* v1 sisu pretty mature in operation and syntax
+* v2 introduces new processing middle layer (document abstraction);
+ markup same except for minor changes to document headers;
+ epub output introduced
+* v3 introduces alternative (configurable) output structures
+* v4 retires what were referred to as sisu skins
-Compatibility Notes
-
-Versions 3 is experimental and attempts to introduce output more compatible
-with mobile devices and other non-web use and more internationalisation
-possibilities. Please see CHANGELOG_v3
+This tarball contains two versions of SiSU, version 4 and version 3 which it
+replaced
+The input for sisu v2, v3 & v4, a SiSU marked-up document is unchanged apart
+from document headers.
* homepage at: <http://www.jus.uio.no/sisu>
* <http://www.jus.uio.no/sisu/SiSU/download>
diff --git a/CHANGELOGS/CHANGELOG_v1 b/CHANGELOGS/CHANGELOG_v1
new file mode 120000
index 0000000..dce668b
--- /dev/null
+++ b/CHANGELOGS/CHANGELOG_v1
@@ -0,0 +1 @@
+../data/doc/sisu/CHANGELOG_v1 \ No newline at end of file
diff --git a/CHANGELOGS/CHANGELOG_v2 b/CHANGELOGS/CHANGELOG_v2
new file mode 120000
index 0000000..e87e244
--- /dev/null
+++ b/CHANGELOGS/CHANGELOG_v2
@@ -0,0 +1 @@
+../data/doc/sisu/CHANGELOG_v2 \ No newline at end of file
diff --git a/CHANGELOGS/CHANGELOG_v3 b/CHANGELOGS/CHANGELOG_v3
new file mode 120000
index 0000000..5fc15e3
--- /dev/null
+++ b/CHANGELOGS/CHANGELOG_v3
@@ -0,0 +1 @@
+../data/doc/sisu/CHANGELOG_v3 \ No newline at end of file
diff --git a/CHANGELOGS/CHANGELOG_v4 b/CHANGELOGS/CHANGELOG_v4
new file mode 120000
index 0000000..a587bc6
--- /dev/null
+++ b/CHANGELOGS/CHANGELOG_v4
@@ -0,0 +1 @@
+../data/doc/sisu/CHANGELOG_v4 \ No newline at end of file
diff --git a/CHANGELOG_v1 b/CHANGELOG_v1
deleted file mode 120000
index feac476..0000000
--- a/CHANGELOG_v1
+++ /dev/null
@@ -1 +0,0 @@
-data/doc/sisu/CHANGELOG_v1 \ No newline at end of file
diff --git a/CHANGELOG_v2 b/CHANGELOG_v2
deleted file mode 120000
index 48716b0..0000000
--- a/CHANGELOG_v2
+++ /dev/null
@@ -1 +0,0 @@
-data/doc/sisu/CHANGELOG_v2 \ No newline at end of file
diff --git a/CHANGELOG_v3 b/CHANGELOG_v3
deleted file mode 120000
index e29fe00..0000000
--- a/CHANGELOG_v3
+++ /dev/null
@@ -1 +0,0 @@
-data/doc/sisu/CHANGELOG_v3 \ No newline at end of file
diff --git a/README b/README
index dbf19ec..4fd0f77 100644
--- a/README
+++ b/README
@@ -1,8 +1,12 @@
-%% SiSU versions 2 & 3, 2011
+%% SiSU versions 4 & 3, 2011
Homepage: <http://www.jus.uio.no/sisu>
-* README CHANGELOG CHANGELOG_v1 CHANGELOG_v2 CHANGELOG_v3
+* README
+* CHANGELOGS/CHANGELOG_v4
+* CHANGELOGS/CHANGELOG_v3
+* CHANGELOGS/CHANGELOG_v2
+* CHANGELOGS/CHANGELOG_v1
-Herein (this package) reside SiSU versions 1 and 2.
+Herein (this package) reside SiSU versions 4 and 3.
%% Description
---------------
@@ -515,19 +519,14 @@ features within the ruby language suited to what the application does.
Development is curently on version 2, version 1 is likely to remain for some
time as a reference implementation.
-%% v1, v2 Compatibility Notes
----------------
-
-Versions 1 and 2 are not quite compatible, version 1 and version 2 will run
-against each other's documents but document metadata, and processing
-instructions may be lost.
-
-On the input side, version 1 and 2 headers are different, version 2 headers
-have been tidied, see document markup samples provided
+%% Versions
-On the output side, the sql databases produced if search is to be implemented
-are not the same and a database must be generated for each version, most other
-differences should be relatively cosmetic.
+* v1 sisu pretty mature in operation and syntax
+* v2 introduces new processing middle layer (document abstraction);
+ markup same except for minor changes to document headers;
+ epub output introduced
+* v3 introduces alternative (configurable) output structures
+* v4 retires what were referred to as sisu skins
%% License
---------------
diff --git a/bin/sisu b/bin/sisu
index f840f8b..9d27ad6 100644
--- a/bin/sisu
+++ b/bin/sisu
@@ -45,24 +45,22 @@ WOK
$KCODE='u' if RUBY_VERSION < '1.9'
argv=$*
SiSU_version_dir=case argv.inspect
- when /"(?:--v2)"/
- check_sisu_legacy_ruby_version?
- 'v2'
when /"(?:--v3)"/
check_sisu_stable_ruby_version?
'v3'
+ when /"(?:--v4)"/
+ check_sisu_stable_ruby_version?
+ 'v4'
when /"(?:--dev)"/
check_sisu_dev_ruby_version?
- 'v3'
+ 'v4'
else
check_sisu_stable_ruby_version?
- 'v3'
+ 'v4'
end
SiSU_lib="sisu/#{SiSU_version_dir}"
require "#{SiSU_lib}/hub"
- unless SiSU_version_dir == 'v2'
- SiSU::HubMaster.new(argv)
- end
+ SiSU::HubMaster.new(argv)
rescue
STDERR.puts 'ERROR'
STDERR.puts $!
diff --git a/bin/sisu-git b/bin/sisu-git
deleted file mode 100644
index d38b10c..0000000
--- a/bin/sisu-git
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-sisu -g ${@}
diff --git a/bin/sisu-po b/bin/sisu-po
deleted file mode 100644
index 9d0d1b9..0000000
--- a/bin/sisu-po
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-sisu --v3 --po4a ${@}
diff --git a/bin/sisu-webrick b/bin/sisu-webrick
new file mode 100644
index 0000000..75d9723
--- /dev/null
+++ b/bin/sisu-webrick
@@ -0,0 +1,2 @@
+#!/bin/sh
+sisu -W ${@}
diff --git a/bin/sisu3 b/bin/sisu3
index f840f8b..f479fed 100644
--- a/bin/sisu3
+++ b/bin/sisu3
@@ -45,24 +45,22 @@ WOK
$KCODE='u' if RUBY_VERSION < '1.9'
argv=$*
SiSU_version_dir=case argv.inspect
- when /"(?:--v2)"/
- check_sisu_legacy_ruby_version?
- 'v2'
when /"(?:--v3)"/
check_sisu_stable_ruby_version?
'v3'
+ when /"(?:--v4)"/
+ check_sisu_stable_ruby_version?
+ 'v4'
when /"(?:--dev)"/
check_sisu_dev_ruby_version?
- 'v3'
+ 'v4'
else
check_sisu_stable_ruby_version?
'v3'
end
SiSU_lib="sisu/#{SiSU_version_dir}"
require "#{SiSU_lib}/hub"
- unless SiSU_version_dir == 'v2'
- SiSU::HubMaster.new(argv)
- end
+ SiSU::HubMaster.new(argv)
rescue
STDERR.puts 'ERROR'
STDERR.puts $!
diff --git a/bin/sisu2 b/bin/sisu4
index d8aac3d..9d27ad6 100644
--- a/bin/sisu2
+++ b/bin/sisu4
@@ -45,24 +45,22 @@ WOK
$KCODE='u' if RUBY_VERSION < '1.9'
argv=$*
SiSU_version_dir=case argv.inspect
- when /"(?:--v2)"/
- check_sisu_legacy_ruby_version?
- 'v2'
when /"(?:--v3)"/
check_sisu_stable_ruby_version?
'v3'
+ when /"(?:--v4)"/
+ check_sisu_stable_ruby_version?
+ 'v4'
when /"(?:--dev)"/
check_sisu_dev_ruby_version?
- 'v3'
+ 'v4'
else
- check_sisu_legacy_ruby_version?
- 'v2'
+ check_sisu_stable_ruby_version?
+ 'v4'
end
SiSU_lib="sisu/#{SiSU_version_dir}"
require "#{SiSU_lib}/hub"
- unless SiSU_version_dir == 'v2'
- SiSU::HubMaster.new(argv)
- end
+ SiSU::HubMaster.new(argv)
rescue
STDERR.puts 'ERROR'
STDERR.puts $!
diff --git a/bin/sisu_termsheet b/bin/sisu_termsheet
deleted file mode 100644
index 73aa933..0000000
--- a/bin/sisu_termsheet
+++ /dev/null
@@ -1,148 +0,0 @@
-#!/usr/bin/env ruby
-# encoding: utf-8
-#SiSU: copyright (C) 1997 - 2012 Ralph Amissah; License GPL, see appended program information
-begin
- def ruby_version_ok?(base_version)
- @v ||=RUBY_VERSION.scan(/\d+/)
- vb=base_version.scan(/\d+/)
- if @v[0].to_i < vb[0].to_i \
- or @v[0].to_i == vb[0].to_i \
- && @v[1].to_i < vb[1].to_i \
- or @v[0].to_i == vb[0].to_i \
- && @v[1].to_i == vb[1].to_i \
- && @v[1].to_i < vb[2].to_i
- raise "Please, use Ruby#{vb} or later, current Ruby #{RUBY_VERSION}"
- else check_incompatible_ruby_build?
- end
- end
- def check_incompatible_ruby_build?
- require 'rbconfig'
- e=Config::CONFIG
- if RUBY_VERSION == '1.9.2' \
- && e['PATCHLEVEL'].to_i < 180
- raise <<WOK
-There are known issues with early versions of ruby1.9.2.
-Please, use Ruby 1.9.2p180 or later,
-current version #{e['RUBY_PROGRAM_VERSION']}p#{e['PATCHLEVEL']}
-#{%x{ruby -v}.strip.to_s}
-
-WOK
- end
- end
- def check_sisu_legacy_ruby_version?
- rbv_sisu_legacy='1.9.2' #'1.8.7'
- ruby_version_ok?(rbv_sisu_legacy)
- end
- def check_sisu_stable_ruby_version?
- rbv_sisu_stable='1.9.2'
- ruby_version_ok?(rbv_sisu_stable)
- end
- def check_sisu_dev_ruby_version?
- rbv_sisu_dev='1.9.2'
- ruby_version_ok?(rbv_sisu_dev)
- end
- $VERBOSE=nil
- argv=$*
- SiSU_version_dir=case argv.inspect
- when /--v2/
- check_sisu_legacy_ruby_version?
- 'v2'
- when /--v3/
- check_sisu_stable_ruby_version?
- 'v3'
- when /--dev/
- check_sisu_dev_ruby_version?
- 'v3' #'v3dv'
- else
- check_sisu_stable_ruby_version?
- 'v3'
- end
- SiSU_lib="sisu/#{SiSU_version_dir}"
- require "#{SiSU_lib}/termsheet"
-rescue
- STDERR.puts 'ERROR'
- STDERR.puts $!
- STDERR.puts $@
- require 'rbconfig'
- e=Config::CONFIG
- puts %{
- #{%x{ruby -v}.strip.to_s}
- #{RUBY_VERSION}
- ruby version: #{e['RUBY_PROGRAM_VERSION']}p#{e['PATCHLEVEL']}
- ruby named: #{e['ruby_version']}
- rubylib: #{e['rubylibdir']}
- rubylib local: #{e['sitelibdir']}
- }
- system(%{echo "
- system RUBYPATH: ${RUBYPATH}
- system RUBYLIB: ${RUBYLIB}
- "})
-end
-__END__
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.sisudoc.org/sisu/en/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: SiSU information Structuring Universe, specialised
- pre-processing wrapper
-
- sisu -t x_bank.and.*
- e.g. sisu -t x_bank.and.*.termsheet.rb
- e.g. sisu_termsheet.rb -t x_bank.and.c*.termsheet.rb
- program calls upon termsheet file with extension termsheet.rb
- termsheet.rb calls upon relevant standard form files (to be used) with extension .sForm.rb
- there is also a standard_terms.rb file - with terms/details that are constant
- the file produced is named after the termsheet.rb with that extension replaced with .er30
- from there scribbler.rb is called upon its usual metaVerse html and pdf creation
- ! :-)
- to test run
- termsheet.rb -f dev.export.import.trade.facility.termsheet.rb
- the term sheet calls the standard form or template that is to be run against it.
diff --git a/bin/sisu_webrick b/bin/sisu_webrick
deleted file mode 100644
index c14ec31..0000000
--- a/bin/sisu_webrick
+++ /dev/null
@@ -1,135 +0,0 @@
-#!/usr/bin/env ruby
-# encoding: utf-8
-#SiSU: copyright (C) 1997 - 2012 Ralph Amissah; License GPL, see appended program information
-begin
- def ruby_version_ok?(base_version)
- @v ||=RUBY_VERSION.scan(/\d+/)
- vb=base_version.scan(/\d+/)
- if @v[0].to_i < vb[0].to_i \
- or @v[0].to_i == vb[0].to_i \
- && @v[1].to_i < vb[1].to_i \
- or @v[0].to_i == vb[0].to_i \
- && @v[1].to_i == vb[1].to_i \
- && @v[1].to_i < vb[2].to_i
- raise "Please, use Ruby#{vb} or later, current Ruby #{RUBY_VERSION}"
- else check_incompatible_ruby_build?
- end
- end
- def check_incompatible_ruby_build?
- require 'rbconfig'
- e=Config::CONFIG
- if RUBY_VERSION == '1.9.2' \
- && e['PATCHLEVEL'].to_i < 180
- raise <<WOK
-There are known issues with early versions of ruby1.9.2.
-Please, use Ruby 1.9.2p180 or later,
-current version #{e['RUBY_PROGRAM_VERSION']}p#{e['PATCHLEVEL']}
-#{%x{ruby -v}.strip.to_s}
-
-WOK
- end
- end
- def check_sisu_legacy_ruby_version?
- rbv_sisu_legacy='1.9.2' #'1.8.7'
- ruby_version_ok?(rbv_sisu_legacy)
- end
- def check_sisu_stable_ruby_version?
- rbv_sisu_stable='1.9.2'
- ruby_version_ok?(rbv_sisu_stable)
- end
- def check_sisu_dev_ruby_version?
- rbv_sisu_dev='1.9.2'
- ruby_version_ok?(rbv_sisu_dev)
- end
- $VERBOSE=nil
- argv=$*
- SiSU_version_dir=case argv.inspect
- when /--v2/
- check_sisu_legacy_ruby_version?
- 'v2'
- when /--v3/
- check_sisu_stable_ruby_version?
- 'v3'
- when /--dev/
- check_sisu_dev_ruby_version?
- 'v3' #'v3dv'
- else
- check_sisu_stable_ruby_version?
- 'v3'
- end
- SiSU_lib="sisu/#{SiSU_version_dir}"
- require "#{SiSU_lib}/webrick"
-rescue
- STDERR.puts 'ERROR'
- STDERR.puts $!
- STDERR.puts $@
- require 'rbconfig'
- e=Config::CONFIG
- puts %{
- #{%x{ruby -v}.strip.to_s}
- #{RUBY_VERSION}
- ruby version: #{e['RUBY_PROGRAM_VERSION']}p#{e['PATCHLEVEL']}
- ruby named: #{e['ruby_version']}
- rubylib: #{e['rubylibdir']}
- rubylib local: #{e['sitelibdir']}
- }
- system(%{echo "
- system RUBYPATH: ${RUBYPATH}
- system RUBYLIB: ${RUBYLIB}
- "})
-end
-__END__
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.sisudoc.org/sisu/en/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: webrick share - note sisu by default does not link with file
- suffixes, see man pages for options
diff --git a/conf/sisu/v2/sisurc.yml b/conf/sisu/v4/sisurc.yml
index 86545f3..de2288f 100644
--- a/conf/sisu/v2/sisurc.yml
+++ b/conf/sisu/v4/sisurc.yml
@@ -49,24 +49,24 @@ show_output_on: 'filesystem_url'
#% flag - set (non-default) processing flag shortcuts -1, -2 etc. (here adding colour and verbosity as default)
flag:
color: true # making colour default -c is toggle, and will now toggle colour off
- default: '-NhewpotbxXyYv' # -m run by default; includes verbose
+ default: '-NhewpotbxXyYdv' # -m run by default; includes verbose
i: '-Nhewpoty' # -m run by default
- ii: '-NhewpotbxX' # -m run by default
- iii: '-NhewpotbxXY' # -m run by default
- iv: '-NhewpoabxXYD --update' # -m run by default
+ ii: '-NhewpotbxXd' # -m run by default
+ iii: '-NhewpotbxXYd' # -m run by default
+ iv: '-NhewpotbxXiIYd' # -m run by default
v: '-NhewpotbxXYDv --update' # -m run by default; includes verbose
-#% papersize, (LaTeX/pdf) available values: A4, US_letter, book_b5, book_a5, US_legal
+#% papersize, (LaTeX/pdf) available values: A4, US_letter, book_b5, book_a5, US_legal
default:
papersize: 'A4,letter'
- #texpdf_font: 'Liberation Serif' # 'Liberation Sans' 'Liberation Serif'
+ #language: 'en'
+ #texpdf_font: 'Liberation Sans' # 'Liberation Sans' 'Liberation Serif'
+ #texpdf_font_mono: 'Liberation Mono' #'Inconsolata'
#text_wrap: 78
#emphasis: 'bold' #make *{emphasis}* 'bold', 'italics' or 'underscore', default if not configured is 'bold'
#digest: 'sha' #sha is sha256, default is md5
#multilingual: false
#language_file: 2
- #language: 'English'
-
#% markup, make *{emphasis}* 'bold' or 'italics', default if not configured is 'bold'
#% settings used by ssh scp
@@ -95,9 +95,19 @@ default:
# sqlite:
# path: ~ # './sisu_sqlite.db'
# port: "**"
+
#html:
# quick_ref: true #default false
# seg_title_banner: true #default false
+#odt:
+# ocn: true
+#plaintext:
+# ocn: true
+
+#% output_dir_structure_by: language (language_and_filetype); filetype; or filename (original v1 & v2)
+#output_dir_structure_by: filename
+#output_dir_structure_by: filetype
+output_dir_structure_by: language
permission_set:
zap: false
@@ -132,5 +142,5 @@ program_set:
# action: http://search.sisudoc.org
# db: sisu
# title: sample search form
-
#promo: sisu_search_libre, sisu_icon, sisu, open_society, fsf, ruby
+#omit: minitoc
diff --git a/data/doc/sisu/CHANGELOG_v1 b/data/doc/sisu/CHANGELOG_v1
index 4af7664..611d5c9 100644
--- a/data/doc/sisu/CHANGELOG_v1
+++ b/data/doc/sisu/CHANGELOG_v1
@@ -1,4 +1,7 @@
%% SiSU version 1
+v1 branch is legacy: v2 branch supersedes & replaces it
+v1 sisu pretty mature in operation and syntax
+v1 branch removed from sisu 3.0 available in sisu =< 2.7
* homepage at: <http://www.jus.uio.no/sisu>
* <http://www.jus.uio.no/sisu/SiSU/download>
@@ -12,8 +15,6 @@ Reverse Chronological:
%% Legacy Branch, Reference
-%% v1 branch removed from sisu 3.0 available in < sisu 2.8 (2.7 and below)
-
%% 1.0.4.orig.tar.gz (2010-02-17:07/3) [2010-07-07]
http://www.jus.uio.no/sisu/pkg/src/sisu_1.0.3.orig.tar.gz
sisu_1.0.3.orig.tar.gz
diff --git a/data/doc/sisu/CHANGELOG_v2 b/data/doc/sisu/CHANGELOG_v2
index ba0af46..1404f6d 100644
--- a/data/doc/sisu/CHANGELOG_v2
+++ b/data/doc/sisu/CHANGELOG_v2
@@ -1,4 +1,10 @@
%% SiSU version 2
+v2 branch is legacy: v3 branch supersedes & replaces it
+v2 branch supersedes & replaces v1 branch
+v2 introduces new processing middle layer (document abstraction);
+ markup same except for minor changes to document headers;
+ epub output introduced
+v2 branch removed from sisu 4.0; it is available in sisu =< 3.3.2
* homepage at: <http://www.jus.uio.no/sisu>
* <http://www.jus.uio.no/sisu/SiSU/download>
@@ -8,9 +14,24 @@
* data/doc/sisu/sisu_markup_samples/sisu_manual/sisu_download.ssi
* CHANGELOG CHANGELOG_v2 CHANGELOG_v3 README data/doc/sisu/
-Reverse Chronological:
+%% Legacy Branch, Reference
-%% STABLE Branch
+* new middle layer (document abstraction) that uses ruby objects to
+ represent data (instead of strings)
+
+* downstream libraries updated to use v2 middle layer
+
+* sisu markup, changes to headers (metadata), input otherwise unchanged
+
+* output much the same as for version 1 with some tweaks
+ * search, sql table structure changed for version 2, incompatible
+ * internal linking of documents is once again supported
+ * LaTeX/pdf book indexes link within the pdf text rather than to HTML
+ version of document
+
+* EPUB output introduced using -e flag
+
+%% Reverse Chronological:
%% 2.9.12 (2012-02-14:07/2) [see 3.1.14.orig.tar.xz]
http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/sisu_3.1.14
diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3
index 261c104..a42f334 100644
--- a/data/doc/sisu/CHANGELOG_v3
+++ b/data/doc/sisu/CHANGELOG_v3
@@ -1,4 +1,8 @@
%% SiSU version 3
+v3 branch is legacy: v4 branch supersedes & replaces it
+v3 branch supersedes & replaces v2 branch
+v3 introduces alternative (configurable) output structures
+v1 branch is removed; it is available in sisu =< 2.7
* homepage at: <http://www.jus.uio.no/sisu>
* <http://www.jus.uio.no/sisu/SiSU/download>
@@ -8,6 +12,8 @@
* data/doc/sisu/sisu_markup_samples/sisu_manual/sisu_download.ssi
* CHANGELOG CHANGELOG_v2 CHANGELOG_v3 README data/doc/sisu/
+%% Legacy Branch, Reference
+
Version 3 introduced output directory structures nad filenames more
compatible with mobile devices and other non-web use and more
internationalisation possibilities.
diff --git a/data/doc/sisu/CHANGELOG_v4 b/data/doc/sisu/CHANGELOG_v4
new file mode 100644
index 0000000..c46b548
--- /dev/null
+++ b/data/doc/sisu/CHANGELOG_v4
@@ -0,0 +1,26 @@
+%% SiSU version 4
+v4 branch supersedes & replaces v3 branch
+ initial goals:
+ * remove/retire "skins"; replace some functionality with headers and/or yml
+ file (consider header like syntax for document and site appearance info)
+ * bin/sisu $0 make possible to run sisu command on/within project dir tree
+ * bin/sisu $*, hub, make possible to specify dir path for markup files
+v2 branch is removed; it is available in sisu =< 3.3.2
+
+* homepage at: <http://www.jus.uio.no/sisu>
+* <http://www.jus.uio.no/sisu/SiSU/download>
+* <http://www.jus.uio.no/sisu/SiSU/changelog>
+* <http://sisudoc.org/sisu/sisu_manual>
+* data/doc/sisu/sisu_markup_samples/sisu_manual/sisu_manual.ssm
+* data/doc/sisu/sisu_markup_samples/sisu_manual/sisu_download.ssi
+* CHANGELOG CHANGELOG_v2 CHANGELOG_v3 README data/doc/sisu/
+
+%% Reverse Chronological:
+
+%% 4.0.0.orig.tar.xz (2012-10-03:40/3)
+http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_4.0.0
+http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_4.0.0-1
+http://www.jus.uio.no/sisu/pkg/src/sisu_4.0.0.orig.tar.xz
+ sisu_4.0.0.orig.tar.xz
+ sisu_4.0.0-1.dsc
+ sisu_4.0.0-1.debian.tar.gz
diff --git a/data/doc/sisu/markup-samples/sisu_manual/_sisu/v2/sisurc.yml b/data/doc/sisu/markup-samples/sisu_manual/_sisu/v4/sisurc.yml
index 433c696..6d11656 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/_sisu/v2/sisurc.yml
+++ b/data/doc/sisu/markup-samples/sisu_manual/_sisu/v4/sisurc.yml
@@ -49,12 +49,12 @@ show_output_on: 'filesystem_url'
#% flag - set (non-default) processing flag shortcuts -1, -2 etc. (here adding colour and verbosity as default)
flag:
color: true # making colour default -c is toggle, and will now toggle colour off
- default: '-NhewpotbxXyYv' # -m run by default; includes verbose
- i: '-Nhewpoty' # -m run by default
- ii: '-NhewpotbxX' # -m run by default
- iii: '-NhewpotbxXY' # -m run by default
- iv: '-NhewpotbxXiIY' # -m run by default
- v: '-NhewpotbxXYDv --update' # -m run by default; includes verbose
+# default: '-NhewpotbxXyYv' # -m run by default; includes verbose
+# i: '-Nhewpoty' # -m run by default
+# ii: '-NhewpotbxX' # -m run by default
+# iii: '-NhewpotbxXY' # -m run by default
+# iv: '-NhewpotbxXiIY' # -m run by default
+# v: '-NhewpotbxXYDv --update' # -m run by default; includes verbose
#% papersize, (LaTeX/pdf) current values A4, US_letter, book_b5, book_a5, US_legal, easily extensible
default:
@@ -83,11 +83,9 @@ default:
db:
postgresql:
port: '5432' # '5432'
- #user: 'tst' # '[provide username]'
- #host: 'sisudoc.org'
- #user: 'ralph'
- ##port: '5433'
- #port: '5432'
+ #host: # '[if not localhost, provide host tcp/ip address or domain name]''
+ #user: # '[(if different from user) provide username]'
+ #password: # '[password if required]'
sqlite:
user: 'ralph'
path: ~ # './sisu_sqlite.db'
@@ -95,13 +93,18 @@ db:
multi: true
# single: true
+#% output_dir_structure_by: language (language_and_filetype); filetype; or filename (original v1 & v2)
+#output_dir_structure_by: filename
+#output_dir_structure_by: filetype
+output_dir_structure_by: language
+
permission_set:
zap: true
css_modify: true
remote_base_site: true
program_set:
- rmagick: false
+ rmagick: true
# wc: true
# editor: true
# postgresql: true
@@ -128,5 +131,4 @@ program_set:
# action: http://search.sisudoc.org
# db: sisu
# title: sample search form
-
#promo: sisu_search_libre, sisu_icon, sisu, open_society, fsf, ruby
diff --git a/data/sisu/v2/conf/convert/modify.rb b/data/sisu/v2/conf/convert/modify.rb
deleted file mode 100644
index c3fe47c..0000000
--- a/data/sisu/v2/conf/convert/modify.rb
+++ /dev/null
@@ -1,272 +0,0 @@
-#!/usr/bin/env ruby
-# encoding: utf-8
-=begin
- * Name: modify.rb
- * Author: Ralph Amissah
- * http://www.jus.uio.no/sisu
- * http://www.jus.uio.no/sisu/SiSU/download
- * Description: A conversion script for canned substitutions,
- a fairly generic simple tool that can be used to store other canned conversions,
- used here for altering SiSU markup
- * Copyright (C) 2004, 2006 Ralph Amissah
- * Packaged with: SiSU information Structuring Universe -
- Structured information, Serialized Units
- * SiSU Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Ralph Amissah
-
- * License: GPL 3 or later
-
- Summary of GPL 3
-
- 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, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- http://www.fsf.org/licenses/gpl.html
- http://www.gnu.org/copyleft/gpl.html
- http://www.jus.uio.no/sisu/gpl3.fsf
-
- (C) Ralph Amissah 1997, current 2009.
- All Rights Reserved.
-
- * Ralph Amissah: ralph@amissah.com
- ralph.amissah@gmail.com
-
-=end
-module SiSU_Modify
- class Convert_markup
- def initialize(cf,files)
- @cf,@files=cf,files
- @description="This is a script that contains canned text conversions for reuse"
- end
- def current_match_and_replace #Disable, edit manually
- clean_non_regular_characters
- #convert_pre_37_to_38_experimental
- end
- def message(text)
- response=''
- while response !~/yes/
- print %{
- #{text}
- to continue type "yes" [to exit type "no" or "quit"]: }
- response=File.new('/dev/tty').gets.strip
- exit if response =~/^(?:quit|no)$/
- end
- end
- def help
- print <<WOK
-
-#@description
-
-modify.rb --default [filename/wildcard]
- performs the current default conversion that is set
- [handle with care, (may be disabled)]
-
-modify.rb --to38 [filename/wildcard]
- converts pre 0.37 sisu markup to 0.38 experimental
-
-modify.rb --to37 [filename/wildcard]
- converts pre 0.37 sisu markup to 0.38 experimental
-
-note converting twice in a single direction will result
-in markup inconsistency
-
-An alternative script has been introduced,
-try 'sisu --convert'
-
-modify.rb --default
- performs the current default conversion that is set
- on the files matched in default the settings
- [handle with care, (may be disabled)]
-
-WOK
- exit
- end
- #%% substitutions to be made
- def clean_non_regular_characters
- #/[^ a-zA-Z0-9,.!?;:/={}()%@#~\[\]"'´&$_+^-]
- #/[^ a-zA-Z0-9,.!?;:/={}()%@#~\[\]"'´&$_+^•’‘`“”–ffifffflfifl-]
- #message(%w{[^ a-zA-Z0-9,.!?;:/={}()%@#~\[\]"'´&$_+^-]})
- message(%q{clean non regular characters})
- [
- [/’/, "'"],
- [/‘/, "'"],
- [/´/, "'"],
- [/`/, "'"],
- [/[“”]/, '"'],
- [/–/, '-'],
- [/ff/, 'ff'],
- [/ffi/, 'ffi'],
- [/ffl/, 'ffl'],
- [/fi/, 'fi'],
- [/fl/, 'fl'],
- [/^•/, '_* '],
- [/•/, '*']
- ]
- end
- def convert_pre_37_to_38_experimental
- message('convert sisu markup from 0.37 to 0.38 experimental (rad)')
- [
- [/^0~(\S+?)([+-])\s+/, "@\\1:\\2 "],
- [/^0~(\S+)\s+/, "@\\1: "],
- [/^@toc:\s+/, "@structure: "],
- [/^1~/, ':A~'],
- [/^2~/, ':B~'],
- [/^3~/, ':C~'],
- [/^4~/, '1~'],
- [/^5~/, '2~'],
- [/^6~/, '3~']
- ]
- end
- def convert_38_experimental_to_37
- message('convert sisu markup from 0.38 experimental (rad) to 0.37')
- [
- [/^@(\S+?):([+-])\s+/, "0~\\1\\2 "],
- [/^@(\S+?):\s+/, "0~\\1 "],
- [/^0~structure\s+/, "0~toc "],
- [/^1~/, '4~'],
- [/^2~/, '5~'],
- [/^3~/, '6~'],
- [/^:?A~/, '1~'],
- [/^:?B~/, '2~'],
- [/^:?C~/, '3~']
- ]
- end
- def markup_version?(i)
- file=File.open(i,'r')
- cont=file.readlines
- file.close
- markup_version=nil
- cont.each do |y|
- if y =~/^:?A~/
- markup_version='0.38'
- break
- end
- if y =~/^1~/
- markup_version='0.37'
- break
- end
- #if y =~/^1{~/
- # markup_version='0.16'
- # break
- #end
- markup_version='0.37'
- end
- markup_version
- end
- def conversion
- #%% do it -------------------------->
- if @files and @files.length > 0
- p @files
- mr=nil
- #%% changes to make m match, r replace -------------------------->
- if @cf =~/--help/; help
- else
- message("WARNING, proceed at your own risk,\npermanent changes requested for the above named files\n best that you check (manually) what this file is set to do\n conversions set are at the top of the file")
- mr=case @cf
- when /--convert|default/; current_match_and_replace
- when /--(?:(?:37)?to38|rad)/; convert_pre_37_to_38_experimental
- when /--(?:(?:38)?to37)/; convert_38_experimental_to_37
- else help
- end
- end
- match_and_replace=mr
- #start_processing =/not used in this example/i
- end_processing =/END\s+OF\s+FILE/
- @files.each do |i|
- @new,@matched,@flag_start,@flag_end,@empty1,@empty2=true,false,false,false,false,false
- o="#{i}.bk" #o is for old
- file=File.open(i,'r')
- cont=file.readlines
- file.close
- cont.each do |y|
- #p y
- #p y if y =~/^[1-6]~/
- match_and_replace.each do |m,r|
- if y =~m
- if @new
- @new=false
- File.unlink(o) if File.exists?(o)
- #system("lv #{i} > #{o}")
- File.rename(i,o)
- File.unlink(i) if File.exists?(i)
- @file=File.new(i,'w')
- @matched=true
- break
- end
- end
- end
- end
- if @matched
- puts "match in #{i}"
- @flag_start=true
- cont.each do |y|
- if y =~end_processing; @flag_end=true
- end
- if @flag_start and not @flag_end
- match_and_replace.each do |m,r|
- if y =~m
- p m.to_s + ' -> ' + r
- puts "in: #{y}"
- y.gsub!(m,r) if m and r
- puts "out: #{y}"
- end
- end
- end
- #if y =~start_processing: @flag_start=true
- #end
- #if y =~m1
- #end
- if y=~/^\s*$/; @empty1=true
- else @empty1=false
- end
- @file.puts y unless (@empty1==true and @empty2==true)
- if y=~/^\s*$/; @empty2=true
- else @empty2=false
- end
- #@file << y + "\n"
- end
- @file.close
- else puts "NO match in #{f}"
- end
- end
- else puts "this routine makes permanent changes to the contents of the files matched, as instructed within [no matches]"
- end
- end
- end
-end
-#%% files to match for this conversion set ------------------------->
-f=$*
-p $*
-cf=f[0].to_s
-f.shift
-match_and_replace=Array.new
-#unless cf and cf =~/--/
-# puts <<WOK
-#
-##@description
-#
-#usage:
-# modify.rb --convert [filename/wildcard]
-#for help
-# modify.rb --help
-#WOK
-# exit
-#end
-unless f.length > 0; f=Dir.glob("[a-z]*.ss?") #restricted to sisu type files, it need not be
-end
-#f=Dir.glob("{bin,conf,data,lib}/**/*.rb") #sisu development
-#f=Dir.glob("[^_]/**/*") #all files subdirectories beneath pwd except those starting with _
-SiSU_Modify::Convert_markup.new(cf,f).conversion
-__END__
diff --git a/data/sisu/v2/v/version.yml b/data/sisu/v2/v/version.yml
deleted file mode 100644
index 663c9bd..0000000
--- a/data/sisu/v2/v/version.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-:version: 2.9.12
-:date_stamp: 2012w07/2
-:date: "2012-02-14"
-:project: SiSU
diff --git a/data/sisu/v2/conf/cgi-bin/sisu_search_pgsql.cgi b/data/sisu/v4/conf/cgi-bin/sisu_search_pgsql.cgi
index c196c75..c196c75 100644
--- a/data/sisu/v2/conf/cgi-bin/sisu_search_pgsql.cgi
+++ b/data/sisu/v4/conf/cgi-bin/sisu_search_pgsql.cgi
diff --git a/data/sisu/v2/conf/cgi-bin/sisu_search_sqlite.cgi b/data/sisu/v4/conf/cgi-bin/sisu_search_sqlite.cgi
index 34bb374..34bb374 100644
--- a/data/sisu/v2/conf/cgi-bin/sisu_search_sqlite.cgi
+++ b/data/sisu/v4/conf/cgi-bin/sisu_search_sqlite.cgi
diff --git a/data/sisu/v2/conf/completion/README b/data/sisu/v4/conf/completion/README
index d723a14..d723a14 100644
--- a/data/sisu/v2/conf/completion/README
+++ b/data/sisu/v4/conf/completion/README
diff --git a/data/sisu/v2/conf/completion/_sisu b/data/sisu/v4/conf/completion/_sisu
index 076795c..076795c 100644
--- a/data/sisu/v2/conf/completion/_sisu
+++ b/data/sisu/v4/conf/completion/_sisu
diff --git a/data/sisu/v2/conf/convert/kdissert_to_sisu b/data/sisu/v4/conf/convert/kdissert_to_sisu
index 35921c3..35921c3 100644
--- a/data/sisu/v2/conf/convert/kdissert_to_sisu
+++ b/data/sisu/v4/conf/convert/kdissert_to_sisu
diff --git a/data/sisu/v4/conf/convert/modify.rb b/data/sisu/v4/conf/convert/modify.rb
new file mode 100644
index 0000000..8a4b907
--- /dev/null
+++ b/data/sisu/v4/conf/convert/modify.rb
@@ -0,0 +1,376 @@
+#!/usr/bin/env ruby
+# encoding: utf-8
+=begin
+
+ * Name: modify.rb
+
+ * Description: A conversion script for canned substitutions,
+ a fairly generic simple tool that can be used to store other canned conversions,
+ (used here for altering SiSU markup or the SiSU program)
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997 - 2012, Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ * Packaged with: SiSU a framework for document structuring, publishing & search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
+ <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
+ <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.jus.uio.no/sisu/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+=end
+module SiSU_Modify
+ class Operations
+ def initialize(cf,files)
+ @cf,@files=cf,files
+ @description="This is a script that contains canned text conversions for reuse"
+ pwd=Dir.pwd
+ @mod_inst='modify_instructions.rb'
+ @modify_instructions_script="#{pwd}/#{@mod_inst}"
+ if FileTest.file?(@modify_instructions_script) ==true
+ puts <<-WOK
+ autoload script: "#{@modify_instructions_script}"
+ used by "ruby #{__FILE__} --convert" if
+ "Extracted.new.modify.modules_and_classes" is used
+ (see "matches_and_replaces")
+ EDIT this file manually
+ [to rebuild run: "ruby #{__FILE__} --build-gsub"]
+
+ WOK
+ else
+ puts <<-WOK
+ autoload script does not exist: "#{@modify_instructions_script}"
+ needed for "ruby #{__FILE__} --convert" if
+ "Extracted.new.modify.modules_and_classes" is used
+ (see "matches_and_replaces")
+ try run: "ruby #{__FILE__} --build-gsub"
+
+ WOK
+ end
+ autoload :Extracted, "./#{@mod_inst}"
+ end
+ def matches_and_replaces #edit manually
+ [
+ #Extracted.new.modify.modules_and_classes,
+ #Extracted.new.modify.modules,
+ #Extracted.new.modify.classes,
+ #modify.dates,
+ #modify.modules,
+ #modify.classes,
+ #modify.misc,
+ ]
+ end
+ def message(text)
+ response=''
+ while response !~/yes/
+ print %{
+ #{text}
+ To continue type "yes" [to exit type "no" or "quit"]: }
+ response=File.new('/dev/tty').gets.strip
+ exit if response =~/^(?:quit|no)$/
+ end
+ end
+ def help
+ print <<WOK
+
+#{@description}
+
+note converting twice in a single direction will result
+in markup inconsistency
+
+modify.rb --convert
+ performs the current conversion that is set in method "matches_and_replaces",
+ this needs to be edited manually, as do the substitutions to be made on the
+ files matched in the settings [handle with care]
+
+modify.rb --report
+ reports on the names of modules and classes in each file requested
+ (the defalt is all)
+
+modify.rb --build-gsub
+ creates modify_instructions.rb methods for substitutions of methods and
+ classes for editing
+
+WOK
+ exit
+ end
+ #%% substitutions to be made
+ # [//, ''],
+ #def rename_default
+ # message(%q{rename SiSU modules, classes, date})
+ # [
+ # [/1997\s+-\s+2012/, '1997 - 2012'],
+ # ]
+ #end
+ def modify
+ def misc
+ [
+ #[//, ''],
+ ]
+ end
+ def dates
+ [
+ [/1997\s+-\s+2011/, '1997 - 2012'],
+ ]
+ end
+ def modules
+ [
+ #[//, ''],
+ ]
+ end
+ def classes
+ [
+ #[//, ''],
+ ]
+ end
+ self
+ end
+ def convert
+ message("WARNING, proceed at your own risk,\npermanent changes requested for the above named files\n best that you check (manually) what this file is set to do\n conversions set are at the top of the file")
+ if matches_and_replaces.length > 0
+ @files.each do |i|
+ @new,@matched,@empty1,@empty2=true,false,false,false
+ file=File.open(i,'r')
+ cont=file.readlines
+ file.close
+ @file=File.new(i,'w')
+ cont.each do |t|
+ matches_and_replaces.each do |match_and_replace|
+ match_and_replace.each do |m,r|
+ if t =~m
+ p m.to_s + ' -> ' + r
+ puts "in: #{t}"
+ t=t.gsub(m,r) if m and r
+ puts "out: #{t}"
+ end
+ end
+ end
+ if t=~/^\s*$/; @empty1=true
+ else @empty1=false
+ end
+ @file.puts t unless (@empty1==true and @empty2==true)
+ if t=~/^\s*$/; @empty2=true
+ else @empty2=false
+ end
+ end
+ @file.close
+ end
+ end
+ end
+ def report_modules_and_classes
+ @f=nil
+ @structure={}
+ @arr={mod: [], cl: []}
+ @files.each do |f|
+ @new,@matched,@empty1,@empty2=true,false,false,false
+ file=File.open(f,'r')
+ cont=file.readlines
+ file.close
+ cont.each do |t|
+ if f != @f
+ @f=f
+ @mod=nil
+ #puts "---\n#{@f}"
+ @structure[@f]={}
+ end
+ if t =~/^\s*module\s+\S+/
+ @mod=t.match(/^\s*module\s+(\S+)/)[1]
+ #puts ' ' + @mod
+ @arr[:mod] << @mod
+ @structure[@f].store(@mod,[])
+ #@structure[@f] = {@mod => []}
+ end
+ if t =~/^\s*class\s+\S+/
+ cl=t.match(/^\s*class\s+(\S+)/)[1]
+ #puts ' ' + cl
+ @arr[:cl] << cl
+ @structure[@f][@mod] << cl
+ end
+ end
+ end
+ @structure.sort.each do |fl,modules|
+ puts "---\n" + fl
+ modules.sort.each do |mod,classes|
+ puts ' ' + mod
+ classes.sort.each do |cl|
+ puts ' ' + cl
+ end
+ end
+ end
+ puts '---'
+ puts 'number of modules: ' + @arr[:mod].length.to_s + ', unique: ' + @arr[:mod].uniq.length.to_s
+ puts 'number of classes: ' + @arr[:cl].length.to_s + ', unique: ' + @arr[:cl].uniq.length.to_s
+ end
+ def build_search_and_replace_method_for_modules_and_classes
+ @f=nil
+ @structure={}
+ @arr={mod: [], cl: []}
+ @files.each do |f|
+ @new,@matched,@empty1,@empty2=true,false,false,false
+ file=File.open(f,'r')
+ cont=file.readlines
+ file.close
+ cont.each do |t|
+ if f != @f
+ @f=f
+ @mod=nil
+ #puts "---\n#{@f}"
+ @structure[@f]={}
+ end
+ if t =~/^\s*module\s+\S+/
+ @mod=t.match(/^\s*module\s+(\S+)/)[1]
+ #puts ' ' + @mod
+ @arr[:mod] << @mod
+ @structure[@f].store(@mod,[])
+ #@structure[@f] = {@mod => []}
+ end
+ if t =~/^\s*class\s+\S+/
+ cl=t.match(/^\s*class\s+(\S+)/)[1]
+ #puts ' ' + cl
+ @arr[:cl] << cl
+ @structure[@f][@mod] << cl
+ end
+ end
+ end
+ puts 'number of modules: ' + @arr[:mod].length.to_s + ', unique: ' + @arr[:mod].uniq.length.to_s
+ puts 'number of classes: ' + @arr[:cl].length.to_s + ', unique: ' + @arr[:cl].uniq.length.to_s
+ method_modules_and_classes=[]
+ method_modules_and_classes <<<<-WOK
+#module SiSU_MC
+ class Extracted
+ def modify
+ WOK
+ #% modules_and_classes
+ method_modules_and_classes <<<<-WOK
+ def modules_and_classes
+ [
+ WOK
+ @structure.sort.each do |fl,modules|
+ method_modules_and_classes << ' '*8 + "##% -- " + fl
+ modules.sort.each do |mod,classes|
+ method_modules_and_classes << ' '*8 + '# ' + "[/#{mod}/," + ' '*(67 - mod.length) + "'#{mod}'],"
+ classes.uniq.sort.each do |cl|
+ method_modules_and_classes << ' '*8 + '# ' + "[/#{cl}/," + ' '*(65 - cl.length) + "'#{cl}'],"
+ end
+ end
+ end
+ method_modules_and_classes <<<<-WOK
+ ]
+ end
+ WOK
+ #% modules
+ method_modules_and_classes <<<<-WOK
+ def modules
+ [
+ WOK
+ method_modules_and_classes << ' '*8 + '# ' + 'number of modules: ' + @arr[:mod].length.to_s +
+ ', unique: ' + @arr[:mod].uniq.length.to_s
+ @arr[:mod].uniq.sort.each do |mod|
+ method_modules_and_classes << ' '*8 + '# ' + "[/#{mod}/," + ' '*(67 - mod.length) + "'#{mod}'],"
+ end
+ method_modules_and_classes <<<<-WOK
+ ]
+ end
+ WOK
+ #% classes
+ method_modules_and_classes <<<<-WOK
+ def classes
+ [
+ WOK
+ method_modules_and_classes << ' '*8 + '# ' + 'number of classes: ' + @arr[:cl].length.to_s +
+ ', unique: ' + @arr[:cl].uniq.length.to_s
+ @arr[:cl].uniq.sort.each do |cl|
+ method_modules_and_classes << ' '*8 + '# ' + "[/#{cl}/," + ' '*(67 - cl.length) + "'#{cl}'],"
+ end
+ method_modules_and_classes <<<<-WOK
+ ]
+ end
+ WOK
+ method_modules_and_classes <<<<-WOK
+ self
+ end
+ end
+#end
+ WOK
+ #method_modules_and_classes.each{|x| puts x}
+ if FileTest.file?(@modify_instructions_script) ==true
+ message("WARNING << #{@mod_inst} >> exists (and may have been edited). The existing << #{@mod_inst} >> will be overwritten if you proceed.")
+ end
+ instructs=File.new(@modify_instructions_script,'w')
+ method_modules_and_classes.each do |x|
+ puts x
+ instructs.puts x
+ end
+ instructs.close
+ end
+ def action
+ if @files and @files.length > 0
+ p @files
+ mr=nil
+ #%% changes to make m match, r replace -------------------------->
+ if @cf =~/--help/; help
+ else
+ case @cf
+ when /--convert/; convert
+ when /--report/; report_modules_and_classes
+ when /--build-gsub/; build_search_and_replace_method_for_modules_and_classes
+ else help
+ end
+ #act
+ end
+ else puts "this routine makes permanent changes to the contents of the files matched, as instructed within [no matches]"
+ end
+ end
+ end
+end
+#% files to match for this conversion set ------------------------->
+f=$* #; p $*
+cf=f[0].to_s
+f.shift
+match_and_replace=Array.new
+unless f.length > 0
+ f=if cf == '--report' \
+ or cf == '--build-gsub'
+ Dir.glob("[a-zA-Z]*.rb") #restrict to ruby files
+ else
+ Dir.glob("[a-zA-Z]*")
+ end
+ f=f.sort.delete_if { |x| x == __FILE__ or x == 'modify_instructions.rb' }
+end
+SiSU_Modify::Operations.new(cf,f).action
+__END__
+#f=Dir.glob("{bin,conf,data,lib}/**/*.rb") #sisu development
+#f=Dir.glob("[^_]/**/*") #all files subdirectories beneath pwd except those starting with _
diff --git a/data/sisu/v2/conf/convert/sisu_convert b/data/sisu/v4/conf/convert/sisu_convert
index a3a1218..a3a1218 100644
--- a/data/sisu/v2/conf/convert/sisu_convert
+++ b/data/sisu/v4/conf/convert/sisu_convert
diff --git a/data/sisu/v2/conf/convert/wvHtml.xml b/data/sisu/v4/conf/convert/wvHtml.xml
index 3cc9dd2..3cc9dd2 100644
--- a/data/sisu/v2/conf/convert/wvHtml.xml
+++ b/data/sisu/v4/conf/convert/wvHtml.xml
diff --git a/data/sisu/v2/conf/convert/wvSiSU.xml b/data/sisu/v4/conf/convert/wvSiSU.xml
index 271b00f..271b00f 100644
--- a/data/sisu/v2/conf/convert/wvSiSU.xml
+++ b/data/sisu/v4/conf/convert/wvSiSU.xml
diff --git a/data/sisu/v2/conf/editor-syntax-etc/README b/data/sisu/v4/conf/editor-syntax-etc/README
index c03f356..c03f356 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/README
+++ b/data/sisu/v4/conf/editor-syntax-etc/README
diff --git a/data/sisu/v2/conf/editor-syntax-etc/diakonos/diakonos.conf b/data/sisu/v4/conf/editor-syntax-etc/diakonos/diakonos.conf
index a3c3afe..a3c3afe 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/diakonos/diakonos.conf
+++ b/data/sisu/v4/conf/editor-syntax-etc/diakonos/diakonos.conf
diff --git a/data/sisu/v2/conf/editor-syntax-etc/emacs/README b/data/sisu/v4/conf/editor-syntax-etc/emacs/README
index 24816c1..24816c1 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/emacs/README
+++ b/data/sisu/v4/conf/editor-syntax-etc/emacs/README
diff --git a/data/sisu/v2/conf/editor-syntax-etc/emacs/sisu-mode.el b/data/sisu/v4/conf/editor-syntax-etc/emacs/sisu-mode.el
index 8ea5c02..84e7cbe 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/emacs/sisu-mode.el
+++ b/data/sisu/v4/conf/editor-syntax-etc/emacs/sisu-mode.el
@@ -251,15 +251,23 @@
;;indented text
(cons "^_[1-9] " 'general-font-lock-red1)
+ (cons "^_[1-9]! " 'general-font-lock-red1)
+
+ ;hanging indented text [proposed enable when implemented]
+ (cons "^__[1-9] " 'general-font-lock-red1)
+ (cons "^_[0-9]_[0-9] " 'general-font-lock-red1)
+ (cons "^__[1-9]! " 'general-font-lock-red1)
+ (cons "^_[0-9]_[0-9]! " 'general-font-lock-red1)
;;url
(cons "\\(^\\|[ ]\\)http:[/][/][^ \t\n\r<]+" 'general-font-lock-blue2)
-;; \\|\$
-
;; Comment Lines
(cons "^% .*" 'general-font-lock-blue1)
+
;; line break
+ (cons " \\\\\\\\ " 'general-font-lock-red1)
+ ;; line break (depreciated)
(cons "<br>" 'general-font-lock-red1)
;; Section titles
diff --git a/data/sisu/v2/conf/editor-syntax-etc/gedit/sisu.lang b/data/sisu/v4/conf/editor-syntax-etc/gedit/sisu.lang
index b82d5f8..b82d5f8 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/gedit/sisu.lang
+++ b/data/sisu/v4/conf/editor-syntax-etc/gedit/sisu.lang
diff --git a/data/sisu/v2/conf/editor-syntax-etc/kate/sisu.xml b/data/sisu/v4/conf/editor-syntax-etc/kate/sisu.xml
index a8054f2..a8054f2 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/kate/sisu.xml
+++ b/data/sisu/v4/conf/editor-syntax-etc/kate/sisu.xml
diff --git a/data/sisu/v2/conf/editor-syntax-etc/nano/nanorc b/data/sisu/v4/conf/editor-syntax-etc/nano/nanorc
index 30ba439..30ba439 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/nano/nanorc
+++ b/data/sisu/v4/conf/editor-syntax-etc/nano/nanorc
diff --git a/data/sisu/v2/conf/editor-syntax-etc/nedit/sisu_nedit.pats b/data/sisu/v4/conf/editor-syntax-etc/nedit/sisu_nedit.pats
index ef01b2b..ef01b2b 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/nedit/sisu_nedit.pats
+++ b/data/sisu/v4/conf/editor-syntax-etc/nedit/sisu_nedit.pats
diff --git a/data/sisu/v2/conf/editor-syntax-etc/vim/colors/8.vim b/data/sisu/v4/conf/editor-syntax-etc/vim/colors/8.vim
index 46d618f..46d618f 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/vim/colors/8.vim
+++ b/data/sisu/v4/conf/editor-syntax-etc/vim/colors/8.vim
diff --git a/data/sisu/v2/conf/editor-syntax-etc/vim/colors/frugal-cterm-ruby.vim b/data/sisu/v4/conf/editor-syntax-etc/vim/colors/frugal-cterm-ruby.vim
index aad6de0..aad6de0 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/vim/colors/frugal-cterm-ruby.vim
+++ b/data/sisu/v4/conf/editor-syntax-etc/vim/colors/frugal-cterm-ruby.vim
diff --git a/data/sisu/v2/conf/editor-syntax-etc/vim/colors/frugal-cterm-sisu.vim b/data/sisu/v4/conf/editor-syntax-etc/vim/colors/frugal-cterm-sisu.vim
index 03f192d..03f192d 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/vim/colors/frugal-cterm-sisu.vim
+++ b/data/sisu/v4/conf/editor-syntax-etc/vim/colors/frugal-cterm-sisu.vim
diff --git a/data/sisu/v2/conf/editor-syntax-etc/vim/colors/frugal.vim b/data/sisu/v4/conf/editor-syntax-etc/vim/colors/frugal.vim
index 1ff26a5..1ff26a5 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/vim/colors/frugal.vim
+++ b/data/sisu/v4/conf/editor-syntax-etc/vim/colors/frugal.vim
diff --git a/data/sisu/v2/conf/editor-syntax-etc/vim/colors/slate.vim b/data/sisu/v4/conf/editor-syntax-etc/vim/colors/slate.vim
index 238b27d..238b27d 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/vim/colors/slate.vim
+++ b/data/sisu/v4/conf/editor-syntax-etc/vim/colors/slate.vim
diff --git a/data/sisu/v2/conf/editor-syntax-etc/vim/colors/sparse-cterm-ruby.vim b/data/sisu/v4/conf/editor-syntax-etc/vim/colors/sparse-cterm-ruby.vim
index 3d8f92e..3d8f92e 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/vim/colors/sparse-cterm-ruby.vim
+++ b/data/sisu/v4/conf/editor-syntax-etc/vim/colors/sparse-cterm-ruby.vim
diff --git a/data/sisu/v2/conf/editor-syntax-etc/vim/colors/sparse-cterm-sisu.vim b/data/sisu/v4/conf/editor-syntax-etc/vim/colors/sparse-cterm-sisu.vim
index 9704dbd..9704dbd 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/vim/colors/sparse-cterm-sisu.vim
+++ b/data/sisu/v4/conf/editor-syntax-etc/vim/colors/sparse-cterm-sisu.vim
diff --git a/data/sisu/v2/conf/editor-syntax-etc/vim/filetype.vim b/data/sisu/v4/conf/editor-syntax-etc/vim/filetype.vim
index 917c3e0..917c3e0 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/vim/filetype.vim
+++ b/data/sisu/v4/conf/editor-syntax-etc/vim/filetype.vim
diff --git a/data/sisu/v2/conf/editor-syntax-etc/vim/ftplugin/sisu.vim b/data/sisu/v4/conf/editor-syntax-etc/vim/ftplugin/sisu.vim
index 160444f..be3ff18 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/vim/ftplugin/sisu.vim
+++ b/data/sisu/v4/conf/editor-syntax-etc/vim/ftplugin/sisu.vim
@@ -1,6 +1,6 @@
"%% SiSU Vim ftplugin
" SiSU Maintainer: Ralph Amissah <ralph@amissah.com>
-" SiSU Markup: SiSU (sisu-2.0) 2010-06-05
+" SiSU Markup: SiSU (sisu-3.3) 2012-08-18
" an ftplugin setting defaults for editing sisu markup files
:syntax on
:filetype on
@@ -175,8 +175,15 @@
":command! Fp FMake ^\s*[A-Za-z0-9#]
:command! Fp FMake ^\s*\S
:command! Fo FMake ^[%\"]\s*[{>]
+"% linenumbering, on, relative, off
+:map <Leader>nn :set <c-r>={'00':'','01':'r','10':'nor'}[&rnu.&nu]<CR>nu<CR>
"% cursorline
:highlight CursorLine guibg=black ctermbg=black
:highlight CursorColumn guibg=black ctermbg=black
+:map <leader>cu :if &cursorcolumn <Bar>
+ \set nocursorline nocursorcolumn <Bar>
+ \else <Bar>
+ \set cursorline cursorcolumn <Bar>
+ \endif<cr>
:map <leader>cu- :set nocursorline nocursorcolumn<cr>
:map <leader>cu+ :set cursorline cursorcolumn<cr>
diff --git a/data/sisu/v2/conf/editor-syntax-etc/vim/syntax/sisu.vim b/data/sisu/v4/conf/editor-syntax-etc/vim/syntax/sisu.vim
index be92d62..49c7098 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/vim/syntax/sisu.vim
+++ b/data/sisu/v4/conf/editor-syntax-etc/vim/syntax/sisu.vim
@@ -1,7 +1,7 @@
" SiSU Vim syntax file
" SiSU Maintainer: Ralph Amissah <ralph@amissah.com>
-" SiSU Markup: SiSU (sisu-2.9.12)
-" Last Change: 2012-02-11
+" SiSU Markup: SiSU (sisu-3.3.3)
+" Last Change: 2012-08-08
" URL: <http://git.sisudoc.org/?p=code/sisu.git;a=blob;f=data/sisu/v3/conf/editor-syntax-etc/vim/syntax/sisu.vim;hb=HEAD>
"(originally looked at Ruby Vim by Mirko Nasato)
@@ -14,19 +14,15 @@ endif
let s:cpo_save = &cpo
set cpo&vim
-" Errors:
+"% "Errors:
syn match sisu_error contains=sisu_link,sisu_error_wspace "<![^ei]\S\+!>"
-" Markers Identifiers:
+
+"% "Markers Identifiers:
if !exists("sisu_no_identifiers")
syn match sisu_mark_endnote "\~^"
- syn match sisu_break contains=@NoSpell " \\\\\( \|$\)"
- syn match sisu_break contains=@NoSpell "<br>\|<br />"
- syn match sisu_control contains=@NoSpell "^<:p[bn]>\s*$"
- "syn match sisu_control contains=@NoSpell "^<\(br\)\?:\(pg\|pgn\|pn\)>\s*$"
- "syn match sisu_control contains=@NoSpell "^\[\(br\)\?:\(pg\|pgn\|pn\)\]\s*$"
+ syn match sisu_break contains=@NoSpell " \\\\\( \|$\)\|<br>\|<br />"
+ syn match sisu_control contains=@NoSpell "^\(-\\\\-\|=\\\\=\|<:p[bn]>\)\s*$"
syn match sisu_control contains=@NoSpell "^<:\(bo\|---\)>\s*$"
- "syn match sisu_control contains=@NoSpell "^<\(br\)\?:\(pr\|o\)>\s*$"
- "syn match sisu_control contains=@NoSpell "^\[\(br\)\?:\(pr\|o\)\]\s*$"
syn match sisu_marktail "[~-]#"
syn match sisu_control "\""
syn match sisu_underline "\(^\| \)_[a-zA-Z0-9]\+_\([ .,]\|$\)"
@@ -37,14 +33,18 @@ if !exists("sisu_no_identifiers")
syn match sisu_require contains=@NoSpell "^<<\s*[a-zA-Z0-9^._-]\+\.ss[it]$"
syn match sisu_require contains=@NoSpell "^<<{[a-zA-Z0-9^._-]\+\.ss[it]}$"
syn match sisu_structure "^:A\~$"
+
+"% "Document Sub Headers:
syn match sisu_sub_header_title "^\s\+:\(subtitle\|short\|edition\|language\|lang_char\|note\):\s" "group=sisu_header_content
- syn match sisu_sub_header_creator "^\s\+:\(author\|contributor\|illustrator\|photographer\|translator\|digitized_by\|prepared_by\|audio\|video\):\s" " &hon &institution
+ syn match sisu_sub_header_creator "^\s\+:\(author\|editor\|contributor\|illustrator\|photographer\|translator\|digitized_by\|prepared_by\|audio\|video\):\s" " &hon &institution
syn match sisu_sub_header_rights "^\s\+:\(copyright\|text\|translation\|illustrations\|photographs\|preparation\|digitization\|audio\|video\|license\|all\):\s" " access_rights license
syn match sisu_sub_header_classify "^\s\+:\(topic_register\|coverage\|format\|identifier\|keywords\|relation\|subject\|type\|dewey\|loc\|oclc\|pg\|isbn\):\s"
syn match sisu_sub_header_date "^\s\+:\(added_to_site\|available\|created\|issued\|modified\|published\|valid\|translated\|original_publication\):\s"
syn match sisu_sub_header_original "^\s\+:\(publisher\|date\|language\|lang_char\|institution\|nationality\|source\):\s"
- syn match sisu_sub_header_make "^\s\+:\(headings\|num_top\|breaks\|language\|italics\|bold\|emphasis\|plaintext_wrap\|texpdf_font\|skin\|stamp\|promo\|ad\|manpage\):\s"
+ syn match sisu_sub_header_make "^\s\+:\(headings\|num_top\|breaks\|language\|italics\|bold\|emphasis\|substitute\|omit\|plaintext_wrap\|texpdf_font_mono\|texpdf_font\|skin\|stamp\|promo\|ad\|manpage\):\s"
syn match sisu_sub_header_notes "^\s\+:\(abstract\|comment\|description\|history\|prefix\|prefix_[ab]\|suffix\):\s"
+
+"% "semantic markers: (ignore)
syn match sisu_sem_marker ";{\|};[a-z._]*[a-z]"
syn match sisu_sem_marker_block "\([a-z][a-z._]*\|\):{\|}:[a-z._]*[a-z]"
syn match sisu_sem_ex_marker ";\[\|\];[a-z._]*[a-z]"
@@ -55,77 +55,123 @@ if !exists("sisu_no_identifiers")
syn match sisu_sem_ex_content contains=sisu_error,sisu_error_wspace,sisu_content_alt,sisu_link,sisu_linked,sisu_break,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker ";\[[^}].\{-}\];[a-z]\+"
endif
-"URLs Numbers And ASCII Codes:
+"% "URLs Numbers And ASCII Codes:
syn match sisu_number "\<\(0x\x\+\|0b[01]\+\|0\o\+\|0\.\d\+\|0\|[1-9][\.0-9_]*\)\>"
syn match sisu_number "?\(\\M-\\C-\|\\c\|\\C-\|\\M-\)\=\(\\\o\{3}\|\\x\x\{2}\|\\\=\w\)"
-"Tuned Error: (is error if not already matched)
+"% "Tuned Error: (is error if not already matched)
syn match sisu_error contains=sisu_error "[\~/\*!_]{\|}[\~/\*!_]"
syn match sisu_error contains=sisu_error "<a href\|</a>]"
-"Simple Paired Enclosed Markup:
+"% "Simple Paired Enclosed Markup:
"url/link
syn region sisu_link contains=sisu_error,sisu_error_wspace matchgroup=sisu_action start="^<<\s*|[a-zA-Z0-9^._-]\+|@|[a-zA-Z0-9^._-]\+|"rs=s+2 end="$"
-"header
+
+"% "Document Header:
+" title
syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_title matchgroup=sisu_header start="^[@]title:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+" creator
syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_creator matchgroup=sisu_header start="^[@]creator:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+" dates
syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_date matchgroup=sisu_header start="^[@]date:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+" publisher
syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_publisher matchgroup=sisu_header start="^[@]publisher:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+" rights
syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_rights matchgroup=sisu_header start="^[@]rights:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+" classify document
syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_classify matchgroup=sisu_header start="^[@]classify:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+" original language (depreciated)
syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_original matchgroup=sisu_header start="^[@]original:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+" notes
syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_notes matchgroup=sisu_header start="^[@]notes:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+" links of interest
syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_linked,sisu_sub_header_links matchgroup=sisu_header start="^[@]links:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+" make, processing instructions
syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_make matchgroup=sisu_header start="^[@]make:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
-"headings
-syn region sisu_heading contains=sisu_mark_endnote,sisu_content_endnote,sisu_marktail,sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_ocn,sisu_error,sisu_error_wspace matchgroup=sisu_structure start="^\([1-8]\|:\?[A-C]\)\~\(\S\+\|[^-]\)" end="$"
-"block/group text
-syn region sisu_content_alt contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^table{.\+" end="}table"
-syn region sisu_content_alt contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^{\(t\|table\)\(\~h\)\?\(\sc[0-9]\+;\)\?[0-9; ]*}" end="\n$"
+
+"% "Headings:
+syn region sisu_heading contains=sisu_mark_endnote,sisu_content_endnote,sisu_marktail,sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_ocn,sisu_error,sisu_error_wspace matchgroup=sisu_structure start="^\([1-8]\|:\?[A-C]\)\~\(\S\+\|[^-]\)" end="$"
+
+"% "Block Group Text:
+" table
+syn region sisu_content_alt contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^table{.\+" end="}table"
+" table
+syn region sisu_content_alt contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^{\(t\|table\)\(\~h\)\?\(\sc[0-9]\+;\)\?[0-9; ]*}" end="\n$"
+" block, group, poem, alt
syn region sisu_content_alt contains=sisu_mark_endnote,sisu_content_endnote,sisu_link,sisu_mark,sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^\(block\|group\|poem\|alt\){" end="^}\(block\|group\|poem\|alt\)"
+" code
syn region sisu_content_alt contains=sisu_error matchgroup=sisu_contain start="^code{" end="^}code"
-"endnotes
-syn region sisu_content_endnote contains=sisu_link,sisu_strikeout,sisu_underline,sisu_number,sisu_control,sisu_identifier,sisu_error,sisu_error_wspace,sisu_mark,sisu_break,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker matchgroup=sisu_mark_endnote start="\~{[*+]*" end="}\~" skip="\n"
-syn region sisu_content_endnote contains=sisu_link,sisu_strikeout,sisu_underline,sisu_number,sisu_control,sisu_identifier,sisu_error,sisu_error_wspace,sisu_mark,sisu_break,sisu_sem_block,sisu_sem_content,sisu_sem_marker matchgroup=sisu_mark_endnote start="\~\[[*+]*" end="\]\~" skip="\n"
-syn region sisu_content_endnote contains=sisu_strikeout,sisu_number,sisu_control,sisu_link,sisu_identifier,sisu_error,sisu_error_wspace,sisu_mark,sisu_break matchgroup=sisu_mark_endnote start="\^\~" end="\n$"
-"links and images
-syn region sisu_linked contains=sisu_fontface,sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker,sisu_sem_block,sisu_error matchgroup=sisu_link start="{\(\~^\s\)\?" end="}\(https\?:/\/\|:\|\.\.\/\|#\)\S\+" oneline
-syn region sisu_linked contains=sisu_fontface,sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker,sisu_sem_block,sisu_error matchgroup=sisu_link start="{\(\~^\s\)\?" end="\[[1-5][sS]*\]}\S\+\.ss[tm]" oneline
-syn region sisu_linked contains=sisu_fontface,sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_link start="{" end="}image" oneline
-"some line operations
-syn region sisu_control contains=sisu_strikeout,sisu_identifier,sisu_content_endnote,sisu_mark_endnote,sisu_error,sisu_error_wspace matchgroup=sisu_control start="\(\(^\| \)!_ \|<:b>\)" end="$"
-syn region sisu_normal contains=sisu_fontface,sisu_control,sisu_identifier,sisu_content_endnote,sisu_mark_endnote,sisu_link,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker,sisu_linked,sisu_error,sisu_error_wspace matchgroup=sisu_markpara start="^_\([1-9*]\|[1-9]\*\) " end="$"
+
+"% "Endnotes:
+" regular endnote or asterisk or plus sign endnote
+syn region sisu_content_endnote contains=sisu_link,sisu_strikeout,sisu_underline,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error,sisu_error_wspace,sisu_mark,sisu_break,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker matchgroup=sisu_mark_endnote start="\~{[*+]*" end="}\~" skip="\n"
+" numbered asterisk or plus sign endnote
+syn region sisu_content_endnote contains=sisu_link,sisu_strikeout,sisu_underline,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error,sisu_error_wspace,sisu_mark,sisu_break,sisu_sem_block,sisu_sem_content,sisu_sem_marker matchgroup=sisu_mark_endnote start="\~\[[*+]*" end="\]\~" skip="\n"
+" endnote content marker (for binary content marking)
+syn region sisu_content_endnote contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_link,sisu_identifier,sisu_error,sisu_error_wspace,sisu_mark,sisu_break matchgroup=sisu_mark_endnote start="\^\~" end="\n$"
+
+"% "Links And Images:
+" image with url link (and possibly footnote of url)
+syn region sisu_linked contains=sisu_fontface,sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker,sisu_sem_block,sisu_error matchgroup=sisu_link start="{\(\~^\s\)\?" end="}\(https\?:/\/\|:\|\.\.\/\|#\)\S\+" oneline
+" sisu outputs, short notation
+syn region sisu_linked contains=sisu_fontface,sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker,sisu_sem_block,sisu_error matchgroup=sisu_link start="{\(\~^\s\)\?" end="\[[1-5][sS]*\]}\S\+\.ss[tm]" oneline
+" image
+syn region sisu_linked contains=sisu_fontface,sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_link start="{" end="}image" oneline
+
+"% "Some Line Operations:
+" bold line
+syn region sisu_bold contains=sisu_strikeout,sisu_identifier,sisu_content_endnote,sisu_mark_endnote,sisu_error,sisu_error_wspace matchgroup=sisu_markpara start="^!_ " end=" \\\\\|$"
+" indent and bullet paragraph
+syn region sisu_normal contains=sisu_fontface,sisu_bold,sisu_control,sisu_identifier,sisu_content_endnote,sisu_mark_endnote,sisu_link,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker,sisu_linked,sisu_error,sisu_error_wspace matchgroup=sisu_markpara start="^_\([1-9*]\|[1-9]\*\) " end="$"
+" indent and bullet (bold start) paragraph
+syn region sisu_bold contains=sisu_fontface,sisu_bold,sisu_control,sisu_identifier,sisu_content_endnote,sisu_mark_endnote,sisu_link,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker,sisu_linked,sisu_error,sisu_error_wspace matchgroup=sisu_markpara start="^_\([1-9*]\|[1-9]\*\)!_\? " end=" \\\\\|$"
+" hanging indent paragraph [proposed]
+syn region sisu_normal contains=sisu_fontface,sisu_bold,sisu_control,sisu_identifier,sisu_content_endnote,sisu_mark_endnote,sisu_link,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker,sisu_linked,sisu_error,sisu_error_wspace matchgroup=sisu_markpara start="^_[0-9]\?_[0-9] " end="$"
+" hanging indent (bold start/ definition) paragraph [proposed]
+syn region sisu_bold contains=sisu_fontface,sisu_bold,sisu_control,sisu_identifier,sisu_content_endnote,sisu_mark_endnote,sisu_link,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker,sisu_linked,sisu_error,sisu_error_wspace matchgroup=sisu_markpara start="^_[0-9]\?_[0-9]!_\? " end=" \\\\\|$"
+" list numbering
syn region sisu_normal contains=sisu_strikeout,sisu_identifier,sisu_content_endnote,sisu_mark_endnote,sisu_link,sisu_linked,sisu_error,sisu_error_wspace matchgroup=sisu_markpara start="^\(#[ 1]\|_# \)" end="$"
-"font face curly brackets
+
+"% "Font Face Curly Brackets:
"syn region sisu_identifier contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_sem start="\S\+:{" end="}:[^<>,.!?:; ]\+" oneline
+" book index:
syn region sisu_index matchgroup=sisu_index_block start="^={" end="}"
-syn region sisu_control contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="\*{" end="}\*"
-syn region sisu_control contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="!{" end="}!"
-syn region sisu_underline contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="_{" end="}_"
-syn region sisu_identifier contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="/{" end="}/"
-syn region sisu_underline contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="+{" end="}+"
-syn region sisu_identifier contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="\^{" end="}\^"
-syn region sisu_identifier contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start=",{" end="},"
-syn region sisu_identifier contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="#{" end="}#"
+" emphasis:
+syn region sisu_bold contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="\*{" end="}\*"
+" bold:
+syn region sisu_bold contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="!{" end="}!"
+" underscore:
+syn region sisu_underline contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="_{" end="}_"
+" italics:
+syn region sisu_identifier contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="/{" end="}/"
+" added:
+syn region sisu_underline contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="+{" end="}+"
+" superscript:
+syn region sisu_identifier contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="\^{" end="}\^"
+" subscript:
+syn region sisu_identifier contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start=",{" end="},"
+" monospace:
+syn region sisu_identifier contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="#{" end="}#"
+" strikethrough:
syn region sisu_strikeout contains=sisu_error matchgroup=sisu_fontface start="-{" end="}-"
-syn region sisu_html contains=sisu_error contains=sisu_strikeout matchgroup=sisu_contain start="<a href=\".\{-}\">" end="</a>" oneline
-"single words bold italicise etc. "workon
-syn region sisu_control contains=sisu_error matchgroup=sisu_control start="\([ (]\|^\)\*[^\|{\n\~\\]"hs=e-1 end="\*"he=e-0 skip="[a-zA-Z0-9']" oneline
+
+"% "Single Words Bold Italicise Etc: (depreciated)
+syn region sisu_bold contains=sisu_error matchgroup=sisu_bold start="\([ (]\|^\)\*[^\|{\n\~\\]"hs=e-1 end="\*"he=e-0 skip="[a-zA-Z0-9']" oneline
syn region sisu_identifier contains=sisu_error matchgroup=sisu_content_alt start="\([ ]\|^\)/[^{ \|\n\\]"hs=e-1 end="/\[ \.\]" skip="[a-zA-Z0-9']" oneline
"misc
syn region sisu_identifier contains=sisu_error matchgroup=sisu_fontface start="\^[^ {\|\n\\]"rs=s+1 end="\^[ ,.;:'})\\\n]" skip="[a-zA-Z0-9']" oneline
-"Expensive Mode:
+"% "Expensive Mode:
if !exists("sisu_no_expensive")
else " not Expensive
syn region sisu_content_alt matchgroup=sisu_control start="^\s*def\s" matchgroup=NONE end="[?!]\|\>" skip="\.\|\(::\)" oneline
endif " Expensive?
-"Headers And Headings: (Document Instructions)
+"% "Headers And Headings: (Document Instructions)
syn match sisu_control contains=sisu_error,sisu_error_wspace "4\~! \S\+"
syn region sisu_markpara contains=sisu_error,sisu_error_wspace start="^=begin" end="^=end.*$"
-"Errors:
+"% "Errors:
syn match sisu_error_wspace contains=sisu_error_wspace "^\s\+[^:]"
syn match sisu_error_wspace contains=sisu_error_wspace "\s\s\+"
syn match sisu_error_wspace contains=sisu_error_wspace "\s\+$"
@@ -149,16 +195,17 @@ syn match sisu_error contains=sisu_error "<dir>"
syn match sisu_error contains=sisu_error,sisu_match,sisu_strikeout,sisu_contain,sisu_content_alt,sisu_mark,sisu_break,sisu_number "<[a-zA-Z\/]\+>"
syn match sisu_error "/\?<\([biu]\)>[^(</\1>)]\{-}\n$"
-"Error Exceptions:
+"% "Error Exceptions:
syn match sisu_control "\n$" "contains=ALL
-syn match sisu_control " //"
+"syn match sisu_control " //"
syn match sisu_error "%{"
syn match sisu_error "<br>_\?https\?:\S\+\|_\?https\?:\S\+<br>"
syn match sisu_error "[><]_\?https\?:\S\+\|_\?https\?:\S\+[><]"
syn match sisu_comment "^%\{1,2\}.\+"
-"Definitions Default Highlighting:
+"% "Definitions Default Highlighting:
hi def link sisu_normal Normal
+hi def link sisu_bold Statement
hi def link sisu_header PreProc
hi def link sisu_header_content Normal
hi def link sisu_sub_header_title Statement
diff --git a/data/sisu/v4/conf/editor-syntax-etc/vim/syntax/sisu_next.vim b/data/sisu/v4/conf/editor-syntax-etc/vim/syntax/sisu_next.vim
new file mode 100644
index 0000000..257e1cb
--- /dev/null
+++ b/data/sisu/v4/conf/editor-syntax-etc/vim/syntax/sisu_next.vim
@@ -0,0 +1,281 @@
+" SiSU Vim syntax file
+" SiSU Maintainer: Ralph Amissah <ralph@amissah.com>
+" SiSU Markup: SiSU (sisu-3.1.0)
+" Last Change: 2011-10-03
+" URL: <http://git.sisudoc.org/?p=code/sisu.git;a=blob;f=data/sisu/v3/conf/editor-syntax-etc/vim/syntax/sisu.vim;hb=HEAD>
+"(originally looked at Ruby Vim by Mirko Nasato)
+
+if version < 600
+ syntax clear
+elseif exists("b:current_syntax")
+ finish
+else
+endif
+let s:cpo_save = &cpo
+set cpo&vim
+
+"% "Errors:
+syn match sisu_error contains=sisu_link,sisu_error_wspace "<![^ei]\S\+!>"
+
+"% "Markers Identifiers:
+if !exists("sisu_no_identifiers")
+ syn match sisu_mark_endnote "\~^"
+ syn match sisu_break contains=@NoSpell " \\\\\( \|$\)"
+ syn match sisu_break contains=@NoSpell "<br>\|<br />"
+ syn match sisu_control contains=@NoSpell "^<:p[bn]>\s*$"
+ "syn match sisu_control contains=@NoSpell "^<\(br\)\?:\(pg\|pgn\|pn\)>\s*$"
+ "syn match sisu_control contains=@NoSpell "^\[\(br\)\?:\(pg\|pgn\|pn\)\]\s*$"
+ syn match sisu_control contains=@NoSpell "^<:\(bo\|---\)>\s*$"
+ "syn match sisu_control contains=@NoSpell "^<\(br\)\?:\(pr\|o\)>\s*$"
+ "syn match sisu_control contains=@NoSpell "^\[\(br\)\?:\(pr\|o\)\]\s*$"
+ syn match sisu_marktail "[~-]#"
+ syn match sisu_control "\""
+ syn match sisu_underline "\(^\| \)_[a-zA-Z0-9]\+_\([ .,]\|$\)"
+ syn match sisu_number contains=@NoSpell "[0-9a-f]\{32\}\|[0-9a-f]\{64\}"
+ syn match sisu_link contains=@NoSpell "\(_\?https\?://\|\.\.\/\)\S\+"
+ syn match sisu_link " \*\~\S\+"
+ syn match sisu_action "^<:insert\d\+>"
+ syn match sisu_require contains=@NoSpell "^<<\s*[a-zA-Z0-9^._-]\+\.ss[it]$"
+ syn match sisu_require contains=@NoSpell "^<<{[a-zA-Z0-9^._-]\+\.ss[it]}$"
+ syn match sisu_structure "^:A\~$"
+
+"% "Document Sub Headers:
+ syn match sisu_sub_header_title "^\s\+:\(subtitle\|short\|edition\|language\|lang_char\|note\):\s" "group=sisu_header_content
+ syn match sisu_sub_header_creator "^\s\+:\(author\|editor\):\s" " &hon &institution
+ syn match sisu_sub_header_contributor "^\s\+:\(editor\|translator\|illustrator\|photographer\|audio\|video\|prepared_by\|digitized_by\):\s"
+ syn match sisu_sub_header_rights "^\s\+:\(copyright\|text\|translation\|illustrations\|photographs\|preparation\|digitization\|audio\|video\|license\|all\):\s" " access_rights license
+ syn match sisu_sub_header_classify "^\s\+:\(topic_register\|coverage\|identifier\|keywords\|relation\|subject\|type\|dewey\|loc\):\s"
+ syn match sisu_sub_header_identify "^\s\+:\(isbn\|urn\|oclc\|pg\):\s"
+ syn match sisu_sub_header_format "^\s\+:\(mimetype\):\s"
+ syn match sisu_sub_header_date "^\s\+:\(added_to_site\|available\|created\|issued\|modified\|published\|valid\|translated\|original_publication\):\s"
+ syn match sisu_sub_header_original "^\s\+:\(publisher\|date\|language\|lang_char\|institution\|nationality\|source\):\s"
+ syn match sisu_sub_header_make "^\s\+:\(headings\|num_top\|breaks\|language\|italics\|bold\|emphasis\|plaintext_wrap\|texpdf_font_mono\|texpdf_font\|skin\|stamp\|promo\|ad\|manpage\):\s"
+ syn match sisu_sub_header_notes "^\s\+:\(abstract\|comment\|description\|history\|prefix\|prefix_[ab]\|suffix\):\s"
+
+"% "semantic markers: (ignore)
+ syn match sisu_sem_marker ";{\|};[a-z._]*[a-z]"
+ syn match sisu_sem_marker_block "\([a-z][a-z._]*\|\):{\|}:[a-z._]*[a-z]"
+ syn match sisu_sem_ex_marker ";\[\|\];[a-z._]*[a-z]"
+ syn match sisu_sem_ex_marker_block "\([a-z][a-z._]*\|\):\[\|\]:[a-z._]*[a-z]"
+ syn match sisu_sem_block contains=sisu_error,sisu_error_wspace,sisu_content_alt,sisu_link,sisu_linked,sisu_break,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker,sisu_mark_endnote,sisu_content_endnote "\([a-z]*\):{[^}].\{-}}:\1"
+ syn match sisu_sem_content contains=sisu_error,sisu_error_wspace,sisu_content_alt,sisu_link,sisu_linked,sisu_break,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker ";{[^}].\{-}};[a-z]\+"
+ syn match sisu_sem_ex_block contains=sisu_error,sisu_error_wspace,sisu_content_alt,sisu_link,sisu_linked,sisu_break,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker,sisu_mark_endnote,sisu_content_endnote "\([a-z]*\):\[[^}].\{-}\]:\1"
+ syn match sisu_sem_ex_content contains=sisu_error,sisu_error_wspace,sisu_content_alt,sisu_link,sisu_linked,sisu_break,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker ";\[[^}].\{-}\];[a-z]\+"
+endif
+
+"% "URLs Numbers And ASCII Codes:
+syn match sisu_number "\<\(0x\x\+\|0b[01]\+\|0\o\+\|0\.\d\+\|0\|[1-9][\.0-9_]*\)\>"
+syn match sisu_number "?\(\\M-\\C-\|\\c\|\\C-\|\\M-\)\=\(\\\o\{3}\|\\x\x\{2}\|\\\=\w\)"
+
+"% "Tuned Error: (is error if not already matched)
+syn match sisu_error contains=sisu_error "[\~/\*!_]{\|}[\~/\*!_]"
+syn match sisu_error contains=sisu_error "<a href\|</a>]"
+
+"% "Simple Paired Enclosed Markup:
+"url/link
+syn region sisu_link contains=sisu_error,sisu_error_wspace matchgroup=sisu_action start="^<<\s*|[a-zA-Z0-9^._-]\+|@|[a-zA-Z0-9^._-]\+|"rs=s+2 end="$"
+
+"% "Document Header:
+" title
+syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_title matchgroup=sisu_header start="^[@]title:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+" creator
+syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_creator matchgroup=sisu_header start="^[@]creator:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+" contributor
+syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_contributor matchgroup=sisu_header start="^[@]contributor:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+" dates
+syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_date matchgroup=sisu_header start="^[@]date:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+" publisher
+syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_publisher matchgroup=sisu_header start="^[@]publisher:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+" rights
+syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_rights matchgroup=sisu_header start="^[@]rights:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+" classify document
+syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_classify matchgroup=sisu_header start="^[@]classify:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+" identifier
+syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_identifier matchgroup=sisu_header start="^[@]identifier:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+" format
+syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_format matchgroup=sisu_header start="^[@]format:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+" original language (depreciated)
+syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_original matchgroup=sisu_header start="^[@]original:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+" notes
+syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_notes matchgroup=sisu_header start="^[@]notes:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+" links of interest
+syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_linked,sisu_sub_header_links matchgroup=sisu_header start="^[@]links:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+" make, processing instructions
+syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_make matchgroup=sisu_header start="^[@]make:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+
+"% "Headings:
+syn region sisu_heading contains=sisu_mark_endnote,sisu_content_endnote,sisu_marktail,sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_ocn,sisu_error,sisu_error_wspace matchgroup=sisu_structure start="^\([1-8]\|:\?[A-C]\)\~\(\S\+\|[^-]\)" end="$"
+
+"% "Block Group Text:
+" table
+syn region sisu_content_alt contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^table{.\+" end="}table"
+" table
+syn region sisu_content_alt contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^{\(t\|table\)\(\~h\)\?\(\sc[0-9]\+;\)\?[0-9; ]*}" end="\n$"
+" block, group, poem, alt
+syn region sisu_content_alt contains=sisu_mark_endnote,sisu_content_endnote,sisu_link,sisu_mark,sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^\(block\|group\|poem\|alt\){" end="^}\(block\|group\|poem\|alt\)"
+" code
+syn region sisu_content_alt contains=sisu_error matchgroup=sisu_contain start="^code{" end="^}code"
+
+"% "Endnotes:
+" regular endnote or asterisk or plus sign endnote
+syn region sisu_content_endnote contains=sisu_link,sisu_strikeout,sisu_underline,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error,sisu_error_wspace,sisu_mark,sisu_break,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker matchgroup=sisu_mark_endnote start="\~{[*+]*" end="}\~" skip="\n"
+" numbered asterisk or plus sign endnote
+syn region sisu_content_endnote contains=sisu_link,sisu_strikeout,sisu_underline,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error,sisu_error_wspace,sisu_mark,sisu_break,sisu_sem_block,sisu_sem_content,sisu_sem_marker matchgroup=sisu_mark_endnote start="\~\[[*+]*" end="\]\~" skip="\n"
+" endnote content marker (for binary content marking)
+syn region sisu_content_endnote contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_link,sisu_identifier,sisu_error,sisu_error_wspace,sisu_mark,sisu_break matchgroup=sisu_mark_endnote start="\^\~" end="\n$"
+
+"% "Links And Images:
+" image with url link (and possibly footnote of url)
+syn region sisu_linked contains=sisu_fontface,sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker,sisu_sem_block,sisu_error matchgroup=sisu_link start="{\(\~^\s\)\?" end="}\(https\?:/\/\|:\|\.\.\/\|#\)\S\+" oneline
+" sisu outputs, short notation
+syn region sisu_linked contains=sisu_fontface,sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker,sisu_sem_block,sisu_error matchgroup=sisu_link start="{\(\~^\s\)\?" end="\[[1-5][sS]*\]}\S\+\.ss[tm]" oneline
+" image
+syn region sisu_linked contains=sisu_fontface,sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_link start="{" end="}image" oneline
+
+"% "Some Line Operations:
+" bold line
+syn region sisu_bold contains=sisu_strikeout,sisu_identifier,sisu_content_endnote,sisu_mark_endnote,sisu_error,sisu_error_wspace matchgroup=sisu_markpara start="^!_ " end=" \\\\\|$"
+" indent and bullet paragraph
+syn region sisu_normal contains=sisu_fontface,sisu_bold,sisu_control,sisu_identifier,sisu_content_endnote,sisu_mark_endnote,sisu_link,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker,sisu_linked,sisu_error,sisu_error_wspace matchgroup=sisu_markpara start="^_\([1-9*]\|[1-9]\*\) " end="$"
+" indent and bullet (bold start) paragraph
+syn region sisu_bold contains=sisu_fontface,sisu_bold,sisu_control,sisu_identifier,sisu_content_endnote,sisu_mark_endnote,sisu_link,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker,sisu_linked,sisu_error,sisu_error_wspace matchgroup=sisu_markpara start="^_\([1-9*]\|[1-9]\*\)!_\? " end=" \\\\\|$"
+" hanging indent paragraph [proposed]
+syn region sisu_normal contains=sisu_fontface,sisu_bold,sisu_control,sisu_identifier,sisu_content_endnote,sisu_mark_endnote,sisu_link,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker,sisu_linked,sisu_error,sisu_error_wspace matchgroup=sisu_markpara start="^_[0-9]\?_[0-9] " end="$"
+" hanging indent (bold start/ definition) paragraph [proposed]
+syn region sisu_bold contains=sisu_fontface,sisu_bold,sisu_control,sisu_identifier,sisu_content_endnote,sisu_mark_endnote,sisu_link,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker,sisu_linked,sisu_error,sisu_error_wspace matchgroup=sisu_markpara start="^_[0-9]\?_[0-9]!_\? " end=" \\\\\|$"
+" list numbering
+syn region sisu_normal contains=sisu_strikeout,sisu_identifier,sisu_content_endnote,sisu_mark_endnote,sisu_link,sisu_linked,sisu_error,sisu_error_wspace matchgroup=sisu_markpara start="^\(#[ 1]\|_# \)" end="$"
+
+"% "Font Face Curly Brackets:
+"syn region sisu_identifier contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_sem start="\S\+:{" end="}:[^<>,.!?:; ]\+" oneline
+" book index:
+syn region sisu_index matchgroup=sisu_index_block start="^={" end="}"
+" emphasis:
+syn region sisu_bold contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="\*{" end="}\*"
+" bold:
+syn region sisu_bold contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="!{" end="}!"
+" underscore:
+syn region sisu_underline contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="_{" end="}_"
+" italics:
+syn region sisu_identifier contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="/{" end="}/"
+" added:
+syn region sisu_underline contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="+{" end="}+"
+" superscript:
+syn region sisu_identifier contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="\^{" end="}\^"
+" subscript:
+syn region sisu_identifier contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start=",{" end="},"
+" monospace:
+syn region sisu_identifier contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="#{" end="}#"
+" strikethrough:
+syn region sisu_strikeout contains=sisu_error matchgroup=sisu_fontface start="-{" end="}-"
+" (depreciated remove, consider marking as error):
+" syn region sisu_html contains=sisu_error contains=sisu_strikeout matchgroup=sisu_contain start="<a href=\".\{-}\">" end="</a>" oneline
+
+"% "Single Words Bold Italicise Etc: (depreciated)
+syn region sisu_bold contains=sisu_error matchgroup=sisu_bold start="\([ (]\|^\)\*[^\|{\n\~\\]"hs=e-1 end="\*"he=e-0 skip="[a-zA-Z0-9']" oneline
+syn region sisu_identifier contains=sisu_error matchgroup=sisu_content_alt start="\([ ]\|^\)/[^{ \|\n\\]"hs=e-1 end="/\[ \.\]" skip="[a-zA-Z0-9']" oneline
+"misc
+syn region sisu_identifier contains=sisu_error matchgroup=sisu_fontface start="\^[^ {\|\n\\]"rs=s+1 end="\^[ ,.;:'})\\\n]" skip="[a-zA-Z0-9']" oneline
+
+"% "Expensive Mode:
+if !exists("sisu_no_expensive")
+else " not Expensive
+ syn region sisu_content_alt matchgroup=sisu_control start="^\s*def\s" matchgroup=NONE end="[?!]\|\>" skip="\.\|\(::\)" oneline
+endif " Expensive?
+
+"% "Headers And Headings: (Document Instructions)
+syn match sisu_control contains=sisu_error,sisu_error_wspace "4\~! \S\+"
+syn region sisu_markpara contains=sisu_error,sisu_error_wspace start="^=begin" end="^=end.*$"
+
+"% "Errors:
+syn match sisu_error_wspace contains=sisu_error_wspace "^\s\+[^:]"
+syn match sisu_error_wspace contains=sisu_error_wspace "\s\s\+"
+"syn match sisu_error_wspace contains=sisu_error_wspace "\s\s\+\|\t\+"
+syn match sisu_error_wspace contains=sisu_error_wspace "\s\+$"
+syn match sisu_error contains=sisu_error_wspace "\t\+"
+syn match sisu_error contains=sisu_error,sisu_error_wspace "\([^ (][_\\]\||[^ (}]\)https\?:\S\+"
+syn match sisu_error contains=sisu_error "_\?https\?:\S\+[}><]"
+syn match sisu_error contains=sisu_error "\([!*/_\+,^]\){\([^(\}\1)]\)\{-}\n$"
+syn match sisu_error contains=sisu_error "^[\~]{[^{]\{-}\n$"
+syn match sisu_error contains=sisu_error "\s\+.{{"
+syn match sisu_error contains=sisu_error "^\~\s*$"
+syn match sisu_error contains=sisu_error "^0\~.*"
+syn match sisu_error contains=sisu_error "^[1-9]\~\s*$"
+syn match sisu_error contains=sisu_error "^[1-9]\~\S\+\s*$"
+syn match sisu_error contains=sisu_error "[^{]\~\^[^ \)]"
+syn match sisu_error contains=sisu_error "\~\^\s\+\.\s*"
+syn match sisu_error contains=sisu_error "{\~^\S\+"
+syn match sisu_error contains=sisu_error "[_/\*!^]{[ .,:;?><]*}[_/\*!^]"
+syn match sisu_error contains=sisu_error "[^ (\"'(\[][_/\*!]{\|}[_/\*!][a-zA-Z0-9)\]\"']"
+syn match sisu_error contains=sisu_error "<dir>"
+"errors for filetype sisu, though not error in 'metaverse':
+syn match sisu_error contains=sisu_error,sisu_match,sisu_strikeout,sisu_contain,sisu_content_alt,sisu_mark,sisu_break,sisu_number "<[a-zA-Z\/]\+>"
+syn match sisu_error "/\?<\([biu]\)>[^(</\1>)]\{-}\n$"
+
+"% "Error Exceptions:
+syn match sisu_control "\n$" "contains=ALL
+"syn match sisu_control " //"
+syn match sisu_error "%{"
+syn match sisu_error "<br>_\?https\?:\S\+\|_\?https\?:\S\+<br>"
+syn match sisu_error "[><]_\?https\?:\S\+\|_\?https\?:\S\+[><]"
+syn match sisu_comment "^%\{1,2\}.\+"
+
+"% "Definitions Default Highlighting:
+hi def link sisu_normal Normal
+hi def link sisu_bold Statement
+hi def link sisu_header PreProc
+hi def link sisu_header_content Normal
+hi def link sisu_sub_header_title Statement
+hi def link sisu_sub_header_creator Statement
+hi def link sisu_sub_header_date Statement
+hi def link sisu_sub_header_publisher Statement
+hi def link sisu_sub_header_rights Statement
+hi def link sisu_sub_header_classify Statement
+hi def link sisu_sub_header_original Statement
+hi def link sisu_sub_header_links Statement
+hi def link sisu_sub_header_notes Statement
+hi def link sisu_sub_header_make Statement
+hi def link sisu_heading Title
+hi def link sisu_structure Operator
+hi def link sisu_contain Include
+hi def link sisu_mark_endnote Delimiter
+"hi def link sisu_mark_endnote Include
+hi def link sisu_require NonText
+hi def link sisu_link NonText
+hi def link sisu_linked String
+hi def link sisu_fontface Delimiter
+"hi def link sisu_fontface Include
+hi def link sisu_strikeout DiffDelete
+hi def link sisu_content_alt Special
+hi def link sisu_sem_content SpecialKey
+hi def link sisu_sem_block Special
+hi def link sisu_sem_marker Visual
+"hi def link sisu_sem_marker Structure
+hi def link sisu_sem_marker_block MatchParen
+hi def link sisu_sem_ex_marker FoldColumn
+hi def link sisu_sem_ex_marker_block Folded
+hi def link sisu_sem_ex_content Comment
+"hi def link sisu_sem_ex_content SpecialKey
+hi def link sisu_sem_ex_block Comment
+hi def link sisu_index SpecialKey
+hi def link sisu_index_block Visual
+hi def link sisu_content_endnote Special
+hi def link sisu_control Delimiter
+"hi def link sisu_control Define
+hi def link sisu_ocn Include
+hi def link sisu_number Number
+hi def link sisu_identifier Function
+hi def link sisu_underline Underlined
+hi def link sisu_markpara Include
+hi def link sisu_marktail Include
+hi def link sisu_mark Identifier
+hi def link sisu_break Structure
+hi def link sisu_html Type
+hi def link sisu_action Identifier
+hi def link sisu_comment Comment
+hi def link sisu_error_sem_marker Error
+hi def link sisu_error_wspace Error
+hi def link sisu_error Error
+let b:current_syntax = "sisu"
+let &cpo = s:cpo_save
+unlet s:cpo_save
diff --git a/data/sisu/v2/conf/editor-syntax-etc/vim/templates/ssi.tpl b/data/sisu/v4/conf/editor-syntax-etc/vim/templates/ssi.tpl
index a101dee..a101dee 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/vim/templates/ssi.tpl
+++ b/data/sisu/v4/conf/editor-syntax-etc/vim/templates/ssi.tpl
diff --git a/data/sisu/v2/conf/editor-syntax-etc/vim/templates/ssm.tpl b/data/sisu/v4/conf/editor-syntax-etc/vim/templates/ssm.tpl
index cbda505..cbda505 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/vim/templates/ssm.tpl
+++ b/data/sisu/v4/conf/editor-syntax-etc/vim/templates/ssm.tpl
diff --git a/data/sisu/v2/conf/editor-syntax-etc/vim/templates/sst.tpl b/data/sisu/v4/conf/editor-syntax-etc/vim/templates/sst.tpl
index dd19efb..dd19efb 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/vim/templates/sst.tpl
+++ b/data/sisu/v4/conf/editor-syntax-etc/vim/templates/sst.tpl
diff --git a/data/sisu/v2/conf/editor-syntax-etc/vim/vim-sisu.yaml b/data/sisu/v4/conf/editor-syntax-etc/vim/vim-sisu.yaml
index ca665bc..ca665bc 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/vim/vim-sisu.yaml
+++ b/data/sisu/v4/conf/editor-syntax-etc/vim/vim-sisu.yaml
diff --git a/data/sisu/v2/conf/lighttpd/lighttpd.cfg.sisu b/data/sisu/v4/conf/lighttpd/lighttpd.cfg.sisu
index 6647de9..6647de9 100644
--- a/data/sisu/v2/conf/lighttpd/lighttpd.cfg.sisu
+++ b/data/sisu/v4/conf/lighttpd/lighttpd.cfg.sisu
diff --git a/data/sisu/v2/conf/lighttpd/lighttpd.cfg.sisu_www b/data/sisu/v4/conf/lighttpd/lighttpd.cfg.sisu_www
index 0dd16c9..0dd16c9 100644
--- a/data/sisu/v2/conf/lighttpd/lighttpd.cfg.sisu_www
+++ b/data/sisu/v4/conf/lighttpd/lighttpd.cfg.sisu_www
diff --git a/data/sisu/v2/conf/ruby/irbrc b/data/sisu/v4/conf/ruby/irbrc
index cceffdf..cceffdf 100644
--- a/data/sisu/v2/conf/ruby/irbrc
+++ b/data/sisu/v4/conf/ruby/irbrc
diff --git a/data/sisu/v4/v/version.yml b/data/sisu/v4/v/version.yml
new file mode 100644
index 0000000..c5b927f
--- /dev/null
+++ b/data/sisu/v4/v/version.yml
@@ -0,0 +1,5 @@
+---
+:version: 4.0.0
+:date_stamp: 2012w40/3
+:date: "2012-10-03"
+:project: SiSU
diff --git a/lib/sisu/v2/character_encoding.rb b/lib/sisu/v2/character_encoding.rb
deleted file mode 100644
index 5d19a61..0000000
--- a/lib/sisu/v2/character_encoding.rb
+++ /dev/null
@@ -1,379 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: modules related to locales, character encoding for different
- output generators [requires kirbybase]
-
-=end
-module SiSU_character_encode
- require 'kirbybase'
- require "#{SiSU_lib}/sysenv" # sysenv.rb
- class Characters
- attr_accessor(:character_encoding,:glyph,:dec,:hex,:rb,:html,:html_name,:tex,:tex_licr,:tex_alt,:name)
- def initialize(&block)
- instance_eval(&block)
- end
- end
- class Create <Characters
- def initialize
- #NOTE places character_encoding.tbl in correct subdirectory ./_sisu_processing/encoding
- @db=KirbyBase.new #default database location, pwd
- @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.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]}"
- @ce_tbl.insert(c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], c[8], c[9])
- end
- end
- end
- class Query
- def initialize(find='',show='')
- #NOTE character_encoding.tbl not read from subdirectory ./_sisu_processing/encoding
- @db=KirbyBase.new #default database location, pwd
- @ce_tbl=@db.get_table(:character_encoding)
- @find=find
- end
- def selected(selected,show)
- @y=[]
- selected.each do |x|
- @y<<case show
- when 'glyph'; x.glyph
- when 'dec'; x.dec
- when 'hex'; x.hex
- when 'rb'; x.rb
- when 'html'; x.html
- when 'html_name'; x.html_name
- when 'tex'; x.tex
- when 'ot1'; x.ot1
- when 'ts1'; x.ts1
- when 'name'; x.name
- else x.hex
- end
- end
- #@ce_tbl.select(:glyph,:name) { |r| r.hex==hex }.each do |r|
- # puts '%s %s' % [r.glyph, r.name]
- #end
- #:glyph,:dec,:hex,:rb,:html,:html_name,:tex,:tex_licr,:tex_alt,:name
- #list=['number','glyph','html','hex','rb','tex','ot1','ts1','name']
- end
- def hex(hex,show)
- select=@ce_tbl.select(:glyph,:dec,:hex,:rb,:html,:html_name,:tex,:tex_licr,:tex_alt,:name) { |r| r.hex==hex }
- selected(select,show)
- @y
- end
- def dec(dec,show)
- select=@ce_tbl.select(:glyph,:dec,:hex,:rb,:html,:html_name,:tex,:tex_licr,:tex_alt,:name) { |r| r.dec==dec }
- selected(select,show)
- @y
- end
- def name(name,show)
- select=@ce_tbl.select(:glyph,:dec,:hex,:rb,:html,:html_name,:tex,:tex_licr,:tex_alt,:name) { |r| r.name =~ /#{name}/ }
- selected(select,show)
- @y
- end
- def report
- puts @ce_tbl.select(:glyph,:dec,:hex,:rb,:html,:html_name,:tex,:tex_licr,:tex_alt,:name).to_report
- end
- def table
- selected=@ce_tbl.select
- #selected=@ce_tbl.select(:glyph,:dec,:hex,:rb,:html,:html_name,:tex,:tex_licr,:tex_alt,:name)
- selected.each do |c|
- puts '%s %s %s %s %s %s %s %s %s %s' % [c.glyph,c.dec,c.hex,c.rb,c.html,c.html_name,c.tex,c.tex_licr,c.tex_alt,c.name]
- #puts "#{c.glyph}, #{c.dec}, #{c.hex}, #{c.rb}, #{c.html}, #{c.name}, #{c.tex}, #{c.tec_licr}, #{c.tex_alt}, #{c.c_name}"
- end
- end
- end
- class Character_encoding
- def table
- x=[]
-#:glyph, :dec,:hex, :rb, :xml , :html_name, :tex, :tex_licr, :tex_alt, :name
- x=[
- ['', 9, '', '', '&#009;', nil, '', '', '', 'Horizontal tab' ],
- ['', 15, '', '', '&#015;', nil, '', '', '', 'Line feed' ],
- ['', 17, '', '', '&#017;', nil, '', '', '', 'Carriage return' ],
- [' ', 32, '40', '\40', '&#032;', nil, '', '', '', 'Space' ],
- ['!', 33, '41', '\41', '&#033;', nil, '!', '!', '!', 'Punctuation Exclamation !' ],
- ['', 34, '42', '\42', '&#034;', '&quot;', '', '', '', 'Punctuation Quotation mark' ],
- ['#', 35, '43', '\43', '&#035;', nil, '{\#}', '\#', '', 'Hash mark #' ],
- ['$', 36, '44', '\44', '&#036;', nil, '{\$}', '\textdollar', '', 'Dollar sign $' ],
- ['%', 37, '45', '\45', '&#037;', nil, '{\%}', '\%', '', 'Percent sign %' ],
- ['&', 38, '46', '\46', '&#038;', '&amp;', '{\&}', '\&', '', 'Ampersand &' ],
- ['\'', 39, '47', '\47', '&#039;', nil, '', '', '', 'Apostrophe \''],
- ['(', 40, '50', '\50', '&#040;', nil, '', '', '', 'Left parenthesis (' ],
- [')', 41, '51', '\51', '&#041;', nil, '', '', '', 'Right parenthesis )' ],
- ['*', 42, '52', '\52', '&#042;', nil, '', '', '', 'Asterisk *' ],
- ['+', 43, '53', '\53', '&#043;', nil, '', '', '', 'Plus sign +' ],
- [',', 44, '54', '\54', '&#044;', nil, ',', ',', ',', 'Puncutation Comma ,' ],
- ['-', 45, '55', '\55', '&#045;', nil, '-', '-', '-', 'Puncutation Hyphen -' ],
- ['.', 46, '56', '\56', '&#046;', nil, '.', '.', '.', 'Puncutation Period .' ],
- ['/', 47, '57', '\57', '&#047;', nil, '/', '/', '/', 'Puncutation Slash /' ],
- ['0', 48, '60', '\60', '&#048;', nil, '0', '0', '0', 'Digit zero 0' ],
- ['1', 49, '61', '\61', '&#049;', nil, '1', '1', '1', 'Digit one 1' ],
- ['2', 50, '62', '\62', '&#050;', nil, '2', '2', '2', 'Digit two 2' ],
- ['3', 51, '63', '\63', '&#051;', nil, '3', '3', '3', 'Digit three 3' ],
- ['4', 52, '64', '\64', '&#052;', nil, '4', '4', '4', 'Digit four 4' ],
- ['5', 53, '65', '\65', '&#053;', nil, '5', '5', '5', 'Digit five 5' ],
- ['6', 54, '66', '\66', '&#054;', nil, '6', '6', '6', 'Digit six 6' ],
- ['7', 55, '67', '\67', '&#055;', nil, '7', '7', '7', 'Digit seven 7' ],
- ['8', 56, '70', '\70', '&#056;', nil, '8', '8', '8', 'Digit eight 8' ],
- ['9', 57, '71', '\71', '&#057;', nil, '9', '9', '9', 'Digit nine 9' ],
- [':', 58, '72', '\72', '&#058;', nil, '', '', '', 'Punctuation Colon :' ],
- [';', 59, '73', '\73', '&#059;', nil, '', '', '', 'Punctuation Semicolon ;' ],
- ['<', 60, '74', '\74', '&#060;', '&lt;', '', '', '', 'Less than <' ],
- ['=', 61, '75', '\75', '&#061;', nil, '', '', '', 'Equals sign =' ],
- ['>', 62, '76', '\76', '&#062;', '&gt;', '', '', '', 'Greater than >' ],
- ['?', 63, '77', '\77', '&#063;', nil, '?', '?', '?', 'Punctuation Question mark ?' ],
- ['@', 64, '100', '\100', '&#064;', nil, '', '', '', 'Commercial at sign @' ],
- ['A', 65, '101', '\101', '&#065;', nil, 'A', 'A', 'A', 'Captial A' ],
- ['B', 66, '102', '\102', '&#066;', nil, 'B', 'B', 'B', 'Captial B' ],
- ['C', 67, '103', '\103', '&#067;', nil, 'C', 'C', 'C', 'Captial C' ],
- ['D', 68, '104', '\104', '&#068;', nil, 'D', 'D', 'D', 'Captial D' ],
- ['E', 69, '105', '\105', '&#069;', nil, 'E', 'E', 'E', 'Captial E' ],
- ['F', 70, '106', '\106', '&#070;', nil, 'F', 'F', 'F', 'Captial F' ],
- ['G', 71, '107', '\107', '&#071;', nil, 'G', 'G', 'G', 'Captial G' ],
- ['H', 72, '110', '\110', '&#072;', nil, 'H', 'H', 'H', 'Captial H' ],
- ['I', 73, '111', '\111', '&#073;', nil, 'I', 'I', 'I', 'Captial I' ],
- ['J', 74, '112', '\112', '&#074;', nil, 'J', 'J', 'J', 'Captial J' ],
- ['K', 75, '113', '\113', '&#075;', nil, 'K', 'K', 'K', 'Captial K' ],
- ['L', 76, '114', '\114', '&#076;', nil, 'L', 'L', 'L', 'Captial L' ],
- ['M', 77, '115', '\115', '&#077;', nil, 'M', 'M', 'M', 'Captial M' ],
- ['N', 78, '116', '\116', '&#078;', nil, 'N', 'N', 'N', 'Captial N' ],
- ['O', 79, '117', '\117', '&#079;', nil, 'O', 'O', 'O', 'Captial O' ],
- ['P', 80, '120', '\120', '&#080;', nil, 'P', 'P', 'P', 'Captial P' ],
- ['Q', 81, '121', '\121', '&#081;', nil, 'Q', 'Q', 'Q', 'Captial Q' ],
- ['R', 82, '122', '\122', '&#082;', nil, 'R', 'R', 'R', 'Captial R' ],
- ['S', 83, '123', '\123', '&#083;', nil, 'S', 'S', 'S', 'Captial S' ],
- ['T', 84, '124', '\124', '&#084;', nil, 'T', 'T', 'T', 'Captial T' ],
- ['U', 85, '125', '\125', '&#085;', nil, 'U', 'U', 'U', 'Captial U' ],
- ['V', 86, '126', '\126', '&#086;', nil, 'V', 'V', 'V', 'Captial V' ],
- ['W', 87, '127', '\127', '&#087;', nil, 'W', 'W', 'W', 'Captial W' ],
- ['X', 88, '130', '\130', '&#088;', nil, 'X', 'X', 'X', 'Captial X' ],
- ['Y', 89, '131', '\131', '&#089;', nil, 'Y', 'Y', 'Y', 'Captial Y' ],
- ['Z', 90, '132', '\132', '&#090;', nil, 'Z', 'Z', 'Z', 'Captial Z' ],
- ['[', 91, '133', '\133', '&#091;', nil, '', '', '', 'Left square bracket [' ],
- ['\\', 92, '134', '\134', '&#092;', nil, '', '\textbackslash', '', 'Backslash \\'],
- [']', 93, '135', '\135', '&#093;', nil, '', '', '', 'Right square bracket ]' ],
- ['^', 94, '136', '\136', '&#094;', nil, '', '', '', 'Caret ^' ],
- ['_', 95, '137', '\137', '&#095;', nil, '{\_}', '\textunderscore', '', 'Underscore _' ],
- ['`', 96, '140', '\140', '&#096;', nil, '', '', '', 'Grave accent `' ],
- ['a', 97, '141', '\141', '&#097;', nil, 'a', 'a', 'a', 'Small a' ],
- ['b', 98, '142', '\142', '&#098;', nil, 'b', 'b', 'b', 'Small b' ],
- ['c', 99, '143', '\143', '&#099;', nil, 'c', 'c', 'c', 'Small c' ],
- ['d', 100, '144', '\144', '&#100;', nil, 'd', 'd', 'd', 'Small d' ],
- ['e', 101, '145', '\145', '&#101;', nil, 'e', 'e', 'e', 'Small e' ],
- ['f', 102, '146', '\146', '&#102;', nil, 'f', 'f', 'f', 'Small f' ],
- ['g', 103, '147', '\147', '&#103;', nil, 'g', 'g', 'g', 'Small g' ],
- ['h', 104, '150', '\150', '&#104;', nil, 'h', 'h', 'h', 'Small h' ],
- ['i', 105, '151', '\151', '&#105;', nil, 'i', 'i', 'i', 'Small i' ],
- ['j', 106, '152', '\152', '&#106;', nil, 'j', 'j', 'j', 'Small j' ],
- ['k', 107, '153', '\153', '&#107;', nil, 'k', 'k', 'k', 'Small k' ],
- ['l', 108, '154', '\154', '&#108;', nil, 'l', 'l', 'l', 'Small l' ],
- ['m', 109, '155', '\155', '&#109;', nil, 'm', 'm', 'm', 'Small m' ],
- ['n', 110, '156', '\156', '&#110;', nil, 'n', 'n', 'n', 'Small n' ],
- ['o', 111, '157', '\157', '&#111;', nil, 'o', 'o', 'o', 'Small o' ],
- ['p', 112, '160', '\160', '&#112;', nil, 'p', 'p', 'p', 'Small p' ],
- ['q', 113, '161', '\161', '&#113;', nil, 'q', 'q', 'q', 'Small q' ],
- ['r', 114, '162', '\162', '&#114;', nil, 'r', 'r', 'r', 'Small r' ],
- ['s', 115, '163', '\163', '&#115;', nil, 's', 's', 's', 'Small s' ],
- ['t', 116, '164', '\164', '&#116;', nil, 't', 't', 't', 'Small t' ],
- ['u', 117, '165', '\165', '&#117;', nil, 'u', 'u', 'u', 'Small u' ],
- ['v', 118, '166', '\166', '&#118;', nil, 'v', 'v', 'v', 'Small v' ],
- ['w', 119, '167', '\167', '&#119;', nil, 'w', 'w', 'w', 'Small w' ],
- ['x', 120, '170', '\170', '&#120;', nil, 'x', 'x', 'x', 'Small x' ],
- ['y', 121, '171', '\171', '&#121;', nil, 'y', 'y', 'y', 'Small y' ],
- ['z', 122, '172', '\172', '&#122;', nil, 'z', 'z', 'z', 'Small z' ],
- ['{', 123, '173', '\173', '&#123;', nil, '{\{}', '\{', '', 'Left curly brace {' ],
- ['|', 124, '174', '\174', '&#124;', nil, '', '', '', 'Vertical bar / pipe |' ],
- ['}', 125, '175', '\175', '&#125;', nil, '{\}}', '\}', '', 'Right curly brace }' ],
- ['~', 126, '176', '\176', '&#126;', nil, '', '', '', 'Tilde ~' ],
- ['', 127, '177', '', '&#127;', nil, '', '', '', ' ' ],
- ['', 128, '200', '', '&#128;', nil, '', '', '', ' ' ],
- ['', 129, '201', '', '&#129;', nil, '', '', '', ' ' ],
- ['\'', 130, '202', '', '&#130;', nil, '', '', '', 'Low left single quote \''],
- [' ', 131, '203', '', '&#131;', nil, '', '', '', 'Florin ' ],
- ['"', 132, '204', '', '&#132;', nil, '', '', '', 'Low left double quote "' ],
- ['…', 133, '205', '\342\200\246', '&#133;', nil, '…', '\textellipsis', '', 'Ellipsis …' ],
- ['†', 134, '206', '\342\200\240', '&#134;', nil, '†', '\textdagger', '', 'Dagger †' ],
- ['‡', 135, '207', '\342\200\241', '&#135;', nil, '‡', '\textdaggerbl', '', 'Double dagger ‡' ],
- ['^', 136, '210', '', '&#136;', nil, '', '', '', 'Circumflex ^' ],
- ['', 137, '211', '', '&#137;', nil, '', '', '', 'Permil ' ],
- ['', 138, '212', '', '&#138;', nil, '', '', '', 'Capital S, caron ' ],
- ['<', 139, '213', '', '&#139;', nil, '', '', '', 'Less than sign (see &060;) <' ],
- ['', 140, '214', '', '&#140;', nil, '', '', '', 'Capital OE ligature ' ],
- ['', 141, '215', '', '&#141;', nil, '', '', '', ' ' ],
- ['', 142, '216', '', '&#142;', nil, '', '', '', 'Capital Z, caron ' ],
- ['', 143, '217', '', '&#143;', nil, '', '', '', ' ' ],
- ['', 144, '220', '', '&#144;', nil, '', '', '', ' ' ],
- ['', 145, '221', '', '&#145;', nil, '', '', '', 'Left single quote ' ],
- ['', 146, '222', '', '&#146;', nil, '', '', '', 'Right single quote ' ],
- ['', 147, '223', '', '&#147;', nil, '', '', '', 'Left double quote ' ],
- ['', 148, '224', '', '&#148;', nil, '', '', '', 'Right double quote ' ],
- ['', 149, '225', '', '&#149;', nil, '', '', '', 'Bullet ' ],
- ['-', 150, '226', '', '&#150;', nil, '', '', '', 'En dash -' ],
- ['', 151, '227', '', '&#151;', nil, '', '', '', 'Em dash -' ],
- ['~', 152, '230', '', '&#152;', nil, '', '', '', 'Tilde (see &126;) ~' ],
- ['t', 153, '231', '', '&#153;', nil, '', '', '', 'Trademark t' ],
- ['', 154, '232', '', '&#154;', nil, '', '', '', 'small s, caron ' ],
- ['', 155, '233', '', '&#155;', nil, '', '', '', 'Greater than sign (see &062;) ' ],
- ['', 156, '234', '', '&#156;', nil, '', '', '', 'Small oe ligature ' ],
- ['', 157, '235', '', '&#157;', nil, '', '', '', ' ' ],
- ['', 158, '236', '', '&#158;', nil, '', '', '', 'Small z, caron ' ],
- ['', 159, '237', '', '&#159;', nil, '', '', '', 'Capital Y, umlaut ' ],
- ['', 160, '240', '', '&#160;', '&nbsp;', '', '', '', 'Non-breaking space ' ],
- ['¡', 161, '241', '\302\241', '&#161;', '&iexcl;', '¡', '', '', 'Inverted exclamation ' ],
- ['¢', 162, '242', '\302\242', '&#162;', '&cent;', '¢', '', '', 'Cent sign ¢' ],
- ['£', 163, '243', '\302\243', '&#163;', '&pound;', '£', '\textsterling', '', 'Pound sign £' ],
- ['¤', 164, '244', '\302\244', '&#164;', '&curren;', '¤', '\textcurrency', '', 'General currency sign ' ],
- ['¥', 165, '245', '\302\245', '&#165;', '&yen;', '¥', '', '', 'Yen sign ¥' ],
- ['¦', 166, '246', '\302\246', '&#166;', '&brvbar;', '¦', '', '', 'Broken vertical bar ' ],
- ['§', 167, '247', '\302\247', '&#167;', '&sect;', '§', '\textsection', '', 'Section sign §' ],
- ['¨', 168, '250', '\302\250', '&#168;', '&uml;', '¨', '\"', '', 'Umlaut ' ],
- ['©', 169, '251', '\302\251', '&#169;', '&copy;', '©', '\copyright', '\textcopyright', 'Copyright ©' ],
- ['ª', 170, '252', '\302\252', '&#170;', '&ordf;', 'ª', '', '', 'Feminine ordinal ª' ],
- ['«', 171, '253', '\302\253', '&#171;', '&laquo;', '«', '', '', 'Left angle quote «' ],
- ['¬', 172, '254', '\302\254', '&#172;', '&not;', '¬', '', '', 'Not sign ' ],
- ['­', 173, '255', '\302\255', '&#173;', '&shy;', '­', '', '', 'Soft hyphen ' ],
- ['®', 174, '256', '\302\256', '&#174;', '&reg;', '®', '', '', 'Registered trademark ®' ],
- ['¯', 175, '257', '\302\257', '&#175;', '&macr;', '¯', '', '', 'Macron accent ' ],
- ['°', 176, '260', '\302\260', '&#176;', '&deg;', '°', '', '', 'Degree sign °' ],
- ['±', 177, '261', '\302\261', '&#177;', '&plusmin;', '±', '', '', 'Plus or minus ±' ],
- ['²', 178, '262', '\302\262', '&#178;', '&sup2;', '²', '', '', 'Superscript 2 ²' ],
- ['³', 179, '263', '\302\263', '&#179;', '&sup3;', '³', '', '', 'Superscript 3 ³' ],
- ['', 180, '264', '\302\264', '&#180;', '&acute;', ''', '', '', 'Acute accent ' ],
- ['µ', 181, '265', '\302\265', '&#181;', '&micro;', 'µ', '', '', 'Micro sign (Greek mu) µ' ],
- ['¶', 182, '266', '\302\266', '&#182;', '&para;', '¶', '\textparagraph', '', 'Paragraph sign ¶' ],
- ['·', 183, '267', '\302\267', '&#183;', '&middot;', %q{·}, '', %q{}, 'Middle dot ' ],
- ['¸', 184, '270', '\302\270', '&#184;', '&cedil;', '¸', '', '', 'Cedilla ' ],
- ['¹', 185, '271', '\302\271', '&#185;', '&sup1;', '¹', '', '', 'Superscript 1 ¹' ],
- ['º', 186, '272', '\302\272', '&#186;', '&ordm;', 'º', '', '', 'Masculine ordinal º' ],
- ['»', 187, '273', '\302\273', '&#187;', '&raquo;', '»', '', '', 'Right angle quote ' ],
- ['¼', 188, '274', '\302\274', '&#188;', '&frac14;', '¼', '', '', 'Fraction one quarter ¼' ],
- ['½', 189, '275', '\302\275', '&#189;', '&frac12;', '½', '', '', 'Fraction on half ½' ],
- ['¾', 190, '276', '\302\276', '&#190;', '&frac34;', '¾', '', '', 'Fraction three quarters ¾' ],
- ['¿', 191, '277', '\302\277', '&#191;', '&iquest;', '¿', '', '', 'Inverted question mark ¿' ],
- ['À', 192, '300', '\303\200', '&#192;', '&Agrave;', 'À', '\`{A}', '', 'Capital A, grave accent À' ],
- ['Á', 193, '301', '\303\201', '&#193;', '&Aacute;', 'Á', %q{\'{A}}, '', 'Capital A, acute accent Á' ],
- ['Â', 194, '302', '\303\202', '&#194;', '&Acirc;', 'Â', '^{A}', '', 'Capital A, circumflex accent Â' ],
- ['Ã', 195, '303', '\303\203', '&#195;', '&Atilde;', 'Ã', '~{A}', '', 'Capital A, tilde Ã' ],
- ['Ä', 196, '304', '\303\204', '&#196;', '&Auml;', 'Ä', '"{A}', '', 'Capital A, umlaut Ä' ],
- ['Å', 197, '305', '\303\205', '&#197;', '&Aring;', 'Å', 'r{A}', '', 'Capital A, ring Å' ],
- ['Æ', 198, '306', '\303\206', '&#198;', '&AElig;', 'Æ', 'AE', '', 'Capital AE ligature Æ' ],
- ['Ç', 199, '307', '\303\207', '&#199;', '&Ccedil;', 'Ç', '', '', 'Capital C, cedilla Ç' ],
- ['È', 200, '310', '\303\210', '&#200;', '&Egrave;', 'È', '`{E}', '', 'Capital E, grave accent È' ],
- ['É', 201, '311', '\303\211', '&#201;', '&Eacute;', 'É', ''{E}', '', 'Capital E, acute accent É' ],
- ['Ê', 202, '312', '\303\212', '&#202;', '&Ecirc;', 'Ê', '^{E}', '', 'Capital E, circumflex accent Ê' ],
- ['Ë', 203, '313', '\303\213', '&#203;', '&Euml;', 'Ë', '"{E}', '', 'Capital E, umlaut Ë' ],
- ['Ì', 204, '314', '\303\214', '&#204;', '&Igrave;', 'Ì', '`{I}', '', 'Capital I, grave accent Ì' ],
- ['Í', 205, '315', '\303\215', '&#205;', '&Iacute;', 'Í', ''{I}', '', 'Capital I, acute accent Í' ],
- ['Î', 206, '316', '\303\216', '&#206;', '&Icirc;', 'Î', '^{I}', '', 'Capital I, circumflex accent Î' ],
- ['Ï', 207, '317', '\303\217', '&#207;', '&Iuml;', 'Ï', '"{I}', '', 'Capital I, umlaut Ï' ],
- ['Ð', 208, '320', '\303\220', '&#208;', '&ETH;', 'Ð', '', '', 'Capital eth, Icelandic ' ],
- ['Ñ', 209, '321', '\303\221', '&#209;', '&Ntilde;', 'Ñ', '', '', 'Capital N, tilde Ñ' ],
- ['Ò', 210, '322', '\303\222', '&#210;', '&Ograve;', 'Ò', '`{O}', '', 'Capital O, grave accent Ò' ],
- ['Ó', 211, '323', '\303\223', '&#211;', '&Oacute;', 'Ó', ''{O}', '', 'Capital O, acute accent Ó' ],
- ['Ô', 212, '324', '\303\224', '&#212;', '&Ocirc;', 'Ô', '^{O}', '', 'Capital O, circumflex accent Ô' ],
- ['Õ', 213, '325', '\303\225', '&#213;', '&Otilde;', 'Õ', '~{O}', '', 'Capital O, tilde Õ' ],
- ['Ö', 214, '326', '\303\226', '&#214;', '&Ouml;', 'Ö', '"{O}', '', 'Capital O, umlaut Ö' ],
- ['×', 215, '327', '\303\227', '&#215;', '&times;', '×', '', '', 'Multiply sign ×' ],
- ['Ø', 216, '330', '\303\230', '&#216;', '&Oslash;', 'Ø', 'O', '', 'Capital O, slash Ø' ],
- ['Ù', 217, '331', '\303\231', '&#217;', '&Ugrave;', 'Ù', '', '', 'Capital U, grave accent Ù' ],
- ['Ú', 218, '332', '\303\232', '&#218;', '&Uacute;', 'Ú', '', '', 'Capital U, acute accent Ú' ],
- ['Û', 219, '333', '\303\233', '&#219;', '&Ucirc;', 'Û', '', '', 'Capital U, circumflex accent Û' ],
- ['Ü', 220, '334', '\303\234', '&#220;', '&Uuml;', 'Ü', '', '', 'Capital U, umlaut Ü' ],
- ['Ý', 221, '335', '\303\235', '&#221;', '&Yacute;', 'Ý', '', '', 'Capital Y, acute accent Ý' ],
- ['Þ', 222, '336', '\303\236', '&#222;', '&THORN;', 'Þ', '', '', 'Capital thorn, Icelandic Þ' ],
- ['ß', 223, '337', '\303\237', '&#223;', '&szlig;', 'ß', '', '', 'Small sz ligature, German ß' ],
- ['à', 224, '340', '\303\240', '&#224;', '&agrave;', 'à', '\`{a}', '', 'Small a, grave accent à' ],
- ['á', 225, '341', '\303\241', '&#225;', '&aacute;', 'á', %q{\'{a}}, '', 'Small a, acute accent á' ],
- ['â', 226, '342', '\303\242', '&#226;', '&acirc;', 'â', '\^{a}', '', 'Small a, circumflex accent â' ],
- ['ã', 227, '343', '\303\243', '&#227;', '&atilde;', 'ã', '\~{a}', '', 'Small a, tilde ã' ],
- ['ä', 228, '344', '\303\244', '&#228;', '&auml;', 'ä', '\"{a}', '', 'Small a, umlaut ä' ],
- ['å', 229, '345', '\303\245', '&#229;', '&aring;', 'å', '\r{a}', '', 'Small a, ring å' ],
- ['æ', 230, '346', '\303\246', '&#230;', '&aelig;', 'æ', '\ae', '', 'Small ae ligature æ' ],
- ['ç', 231, '347', '\303\257', '&#231;', '&ccedil;', 'ç', '', '', 'Small c, cedilla ç' ],
- ['è', 232, '350', '\303\250', '&#232;', '&egrave;', 'è', '\`{e}', '', 'Small e, grave accent è' ],
- ['é', 233, '351', '\303\251', '&#233;', '&eacute;', 'é', %q{\'{e}}, '', 'Small e, acute accent é' ],
- ['ê', 234, '352', '\303\252', '&#234;', '&ecirc;', 'ê', '\^{e}', '', 'Small e, circumflex accent ê' ],
- ['ë', 235, '353', '\303\253', '&#235;', '&euml;', 'ë', '\"{e}', '', 'Small e, umlaut ë' ],
- ['ì', 236, '354', '\303\254', '&#236;', '&igrave;', 'ì', '\`{i}', '', 'Small i, grave accent ì' ],
- ['í', 237, '355', '\303\255', '&#237;', '&iacute;', 'í', '\'{i}', '', 'Small i, acute accent í' ],
- ['î', 238, '356', '\303\256', '&#238;', '&icirc;', 'î', '\^{i}', '', 'Small i, circumflex accent î' ],
- ['ï', 239, '357', '\303\257', '&#239;', '&iuml;', 'ï', '\"{i}', '', 'Small i, umlaut ï' ],
- ['ð', 240, '360', '\303\260', '&#240;', '&eth;', 'ð', '', '', 'Small eth, Icelandic ð' ],
- ['ñ', 241, '361', '\303\261', '&#241;', '&ntilde;', 'ñ', '', '', 'Small n, tilde ñ' ],
- ['ò', 242, '362', '\303\262', '&#242;', '&ograve;', 'ò', '\`{o}', '', 'Small o, grave accent ò' ],
- ['ó', 243, '363', '\303\263', '&#243;', '&oacute;', 'ó', %q{\'{o}}, '', 'Small o, acute accent ó' ],
- ['ô', 244, '364', '\303\264', '&#244;', '&ocirc;', 'ô', '\^{o}', '', 'Small o, circumflex accent ô' ],
- ['õ', 245, '365', '\303\265', '&#245;', '&otilde;', 'õ', '\^{o}', '', 'Small o, tilde õ' ],
- ['ö', 246, '366', '\303\266', '&#246;', '&ouml;', 'ö', '\"{o}', '', 'Small o, umlaut ö' ],
- ['÷', 247, '367', '\303\267', '&#247;', '&divide;', '÷', '', '', 'Divide sign ÷' ],
- ['ø', 248, '370', '\303\270', '&#248;', '&oslash;', 'ø', '', '', 'Small o, slash ø' ],
- ['ù', 249, '371', '\303\271', '&#249;', '&ugrave;', 'ù', '\`{u}', '', 'Small u, grave accent ù' ],
- ['ú', 250, '372', '\303\272', '&#250;', '&uacute;', 'ú', %q{\'{u}}, '', 'Small u, acute accent ú' ],
- ['û', 251, '373', '\303\273', '&#251;', '&ucirc;', 'û', '\^{u}', '', 'Small u, circumflex accent û' ],
- ['ü', 252, '374', '\303\274', '&#252;', '&uuml;', 'ü', '\"{u}', '', 'Small u, umlaut ü' ],
- ['ý', 253, '375', '\303\275', '&#253;', '&yacute;', 'ý', '', '', 'Small y, acute accent ý' ],
- ['þ', 254, '376', '\303\276', '&#254;', '&thorn;', 'þ', '', '', 'Small thorn, Icelandic þ' ],
- ['ÿ', 255, '377', '\303\277', '&#255;', '&yuml;', 'ÿ', '', '', 'Smally y, umlaut ÿ' ],
- ['∝', , '', '', '&#8733;', '&prop;', '∝', '', '', 'proportional to U+221D (8733) ∝' ],
- ['∞', , '', '', '&#8734;', '&infin;', '∞', '', '', 'infinity U+221E (8734) ∞' ],
-]
- end
- end
-end
-__END__
diff --git a/lib/sisu/v2/constants.rb b/lib/sisu/v2/constants.rb
deleted file mode 100644
index 6c949d5..0000000
--- a/lib/sisu/v2/constants.rb
+++ /dev/null
@@ -1,204 +0,0 @@
-# coding:utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
- constants
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/copyleft/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: system environment, resource control and configuration details
-
-=end
-Sfx={:txt=>'.txt',:html=>'.html',:xhtml=>'.xhtml',:xml=>'.xml',:epub=>'.epub',:epub_xhtml=>'.xhtml',:odt=>'.odt',:pdf=>'.pdf'}
-Ax,Xx,Mx,Rx,Hx,Dx,Px,Db,Gt,Tex=Array.new(10){{}}
-Ax[:tab]="\t"
-Xx[:protect]='☞'
-Xx[:segment]='Ф'
-Mx[:meta_o],Mx[:meta_c]='〔@','〕'
-Mx[:lv_o_1],Mx[:lv_o_2],Mx[:lv_o_3],Mx[:lv_o_4],Mx[:lv_o_5],Mx[:lv_o_6],Mx[:lv_o_7],Mx[:lv_o_8],Mx[:lv_o_9]=1,2,3,4,5,6,7,8,9;
-Mx[:lv_o],Mx[:lv_c]='〔','〕'
-Mx[:en_a_o]='【'; Mx[:en_a_c]='】' #endnote Mx[:en_a_o]='~{'; Mx[:en_a_c]='}~'
-Mx[:en_b_o]='〖'; Mx[:en_b_c]='〗' #endnote Mx[:en_b_o]='~['; Mx[:en_b_c]=']~'
-Mx[:gr_o]='〔'; Mx[:gr_c]='〕' #group text mark
-Mx[:id_o]='〔'; Mx[:id_c]='〕' #object id mark
-Mx[:tc_o]='『'; Mx[:tc_c]="』" #table row mark #Mx[:tc_c]="』\n"
-Mx[:tc_p]='┆' #table col/misc mark
-Mx[:pa_o]='〔'; Mx[:pa_c]='〕' #affects paragraph mark
-Mx[:mk_o]='〔'; Mx[:mk_c]='〕' #generic mark
-Mx[:gl_o]='〔'; Mx[:gl_c]='〕' #glyph
-Mx[:fa_o]='〔'; Mx[:fa_o_c]='¤'; Mx[:fa_c_o]='¤'; Mx[:fa_c]='〕'
-Mx[:fa_bold_o]= "#{Mx[:fa_o]}b#{Mx[:fa_o_c]}"; Mx[:fa_bold_c]= "#{Mx[:fa_c_o]}b#{Mx[:fa_c]}"
-Mx[:fa_italics_o]= "#{Mx[:fa_o]}i#{Mx[:fa_o_c]}"; Mx[:fa_italics_c]= "#{Mx[:fa_c_o]}i#{Mx[:fa_c]}"
-Mx[:fa_underscore_o]= "#{Mx[:fa_o]}u#{Mx[:fa_o_c]}"; Mx[:fa_underscore_c]= "#{Mx[:fa_c_o]}u#{Mx[:fa_c]}"
-Mx[:fa_cite_o]= "#{Mx[:fa_o]}cite#{Mx[:fa_o_c]}"; Mx[:fa_cite_c]= "#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}"
-Mx[:fa_insert_o]= "#{Mx[:fa_o]}ins#{Mx[:fa_o_c]}"; Mx[:fa_insert_c]= "#{Mx[:fa_c_o]}ins#{Mx[:fa_c]}"
-Mx[:fa_strike_o]= "#{Mx[:fa_o]}del#{Mx[:fa_o_c]}"; Mx[:fa_strike_c]= "#{Mx[:fa_c_o]}del#{Mx[:fa_c]}"
-Mx[:fa_superscript_o]="#{Mx[:fa_o]}sup#{Mx[:fa_o_c]}"; Mx[:fa_superscript_c]="#{Mx[:fa_c_o]}sup#{Mx[:fa_c]}"
-Mx[:fa_subscript_o]= "#{Mx[:fa_o]}sub#{Mx[:fa_o_c]}"; Mx[:fa_subscript_c]= "#{Mx[:fa_c_o]}sub#{Mx[:fa_c]}"
-Mx[:fa_hilite_o]= "#{Mx[:fa_o]}hi#{Mx[:fa_o_c]}"; Mx[:fa_hilite_c]= "#{Mx[:fa_c_o]}hi#{Mx[:fa_c]}"
-Mx[:fa_monospace_o]= "#{Mx[:fa_o]}mono#{Mx[:fa_o_c]}"; Mx[:fa_monospace_c]= "#{Mx[:fa_c_o]}mono#{Mx[:fa_c]}"
-Mx[:gl_bullet]= "#{Mx[:gl_o]}●#{Mx[:gl_c]}"
- Mx[:pa_non_object_dummy_heading]="#{Mx[:pa_o]}-##{Mx[:pa_c]}" #unnumbered paragraph, delete when not required [used in dummy headings, eg. for segmented html] (place marker at end of paragraph)
- Mx[:pa_non_object_no_heading]="#{Mx[:pa_o]}~##{Mx[:pa_c]}" #unnumbered paragraph (place marker at end of paragraph)
-Mx[:idx_o]='▢ '; Mx[:idx_c]='▢ ' #
-Mx[:nbsp]= '░' #'▭ '
-Mx[:br_line]= '▌' #lB ▌ 9612 #'┘' #'¶'
-Mx[:br_paragraph]= '█' #FB █ 9608 # PP ∥ 8741 #'▐' #'┘' #'¶' #FB █ 9608 lB ▌ 9612 RB ▐ 9616
-Mx[:br_nl]= '』' # '┘'
-Mx[:obj_ln_sep]= 'obj_ln_sep'; Hx[:obj_ln_sep]= {:obj=>Mx[:obj_ln_sep]} # line sep
-Mx[:br_page]= 'break_page'; Hx[:br_page]= {:obj=>Mx[:br_page]} # newpage
-Mx[:br_page_new]= 'break_page_new'; Hx[:br_page_new]= {:obj=>Mx[:br_page_new]} # clearpage
-Mx[:br_endnotes]= "#{Mx[:mk_o]}ENDNOTES#{Mx[:mk_c]}"
-Mx[:br_eof]= "#{Mx[:mk_o]}EOF#{Mx[:mk_c]}"
-Mx[:lnk_o]='⌠'; Mx[:lnk_c]='⌡' #'⌈' '⌋' '⌠' '⌡' #Mx[:lnk_o]='◁'; Mx[:lnk_c]='▷' #‹ ›
-Mx[:url_o]='「'; Mx[:url_c]='」'
-Mx[:rel_o]='⌈'; Mx[:rel_c]='⌋'
-Mx[:tag_o]='⌊'; Mx[:tag_c]='⌉'
-Mx[:sm_set_o]='《'; Mx[:sm_set_c]='》'
-Mx[:sm_subset_o]='《 '; Mx[:sm_subset_c]='》'
-Mx[:vline]='┆' # ¦ |
-#Mx[:sm_set_o]='∈ '; Mx[:sm_set_c]='∋ '
-#Mx[:sm_subset_o]='∈ '; Mx[:sm_subset_c]='∋ '
-Rx[:mx_fa_clean]= /#{Mx[:fa_o]}.+?#{Mx[:fa_c]}|#{Mx[:pa_o]}.+?#{Mx[:pa_c]}|#{Mx[:mk_o]}.+?#{Mx[:mk_c]}/
-Rx[:lv],Rx[:lv_1],Rx[:lv_2],Rx[:lv_3],Rx[:lv_4],Rx[:lv_5],Rx[:lv_6],Rx[:lv_7],Rx[:lv_8],Rx[:lv_9]=
- /〔([1-9]):(\S*?)〕/,/#{Mx[:lv_o_1]}(\S*?)#{Mx[:lv_c]}/,/#{Mx[:lv_o_2]}(\S*?)#{Mx[:lv_c]}/,/#{Mx[:lv_o_3]}(\S*?)#{Mx[:lv_c]}/,/#{Mx[:lv_o_4]}(\S*?)#{Mx[:lv_c]}/,/#{Mx[:lv_o_5]}(\S*?)#{Mx[:lv_c]}/,/#{Mx[:lv_o_6]}(\S*?)#{Mx[:lv_c]}/,/#{Mx[:lv_o_7]}(\S*?)#{Mx[:lv_c]}/,/#{Mx[:lv_o_8]}(\S*?)#{Mx[:lv_c]}/,/#{Mx[:lv_o_9]}(\S*?)#{Mx[:lv_c]}/
-Rx[:meta]=/#{Mx[:meta_o]}(\S+?)#{Mx[:meta_c]}/
-Dx[:url_o]='‹'; Dx[:url_c]='›'
-Dx[:url_o_xml]='&lt;'; Dx[:url_c_xml]='&gt;'
-Dx[:rel_o]='‹'; Dx[:rel_c]='›' # Dx[:rel_o]='「'; Dx[:rel_c]='」'
-Tex[:backslash]="\\\\"
-Tex[:backslash]="\\\\"
-Tex[:tilde]='\\\\\\~'
-#Px[:emphasis_o]= '*'; Px[:emphasis_c]= '*'
-#Px[:bold_o]= '!'; Px[:bold_c]= '!'
-Px[:bold_o]= '*'; Px[:bold_c]= '*'
-Px[:italics_o]= '/'; Px[:italics_c]= '/'
-Px[:underscore_o]= '_'; Px[:underscore_c]= '_'
-Px[:cite_o]= '"'; Px[:cite_c]= '"'
-Px[:insert_o]= '+'; Px[:insert_c]= '+'
-Px[:strike_o]= '-'; Px[:strike_c]= '-'
-Px[:superscript_o]='^'; Px[:superscript_c]='^'
-Px[:subscript_o]= '['; Px[:subscript_c]= ']'
-Px[:hilite_o]= '*'; Px[:hilite_c]= '*'
-Px[:monospace_o]= ''; Px[:monospace_c]= ''
-Px[:lv1]= '*'
-Px[:lv2]= '='
-Px[:lv3]= '='
-#Px[:lv2_3]= '='
-Px[:lv4]= '-'
-Px[:lv5]= '.'
-Px[:lv6]= '.'
-#Px[:lv5_6]= '.'
-Db[:name_prefix]="SiSU#{SiSU_version_dir}c_"
-Db[:name_prefix_db]="sisu_#{SiSU_version_dir}c_"
-Db[:col_title]=800
-Db[:col_title_part]=400
-Db[:col_title_edition]=10
-Db[:col_name]=600
-Db[:col_creator_misc_short]=100
-Db[:col_language]=100
-Db[:col_language_char]=3
-Db[:col_date_text]=10
-Db[:col_classify_txt_long]=600
-Db[:col_classify_txt_short]=600
-Db[:col_classify_short]=200
-Db[:col_classify_identify]=256
-Db[:col_classify_library]=30
-Db[:col_classify_small]=16
-Db[:col_filename]=256
-Db[:col_digest]=64
-Db[:col_filesize]=10
-Db[:col_info_note]=2500
-Gt[:grotto]='sisu:'
-Gt[:txt]='txt'
-Gt[:image]='images'
-Gt[:conf]='conf'
-__END__
-consider:
- 〔comment〕
- 〔links?????〕
- import document?
-check:
- bold line
-
-┆┆⋮┇┊┋
-『』
-「」
-〔〕
-【】
-
- #˝ " λ Ω β α π Ѫ Ж Я Ѳ ѳ Ф ㈣
- Ѳ ѳ Ф
- ♩ ♭  ✠  ▭ ▬ ▪
-【】〖〗《》「」
- ‹ › ∗ 
-'〔lv1〕','〔lv2〕','〔lv3〕','〔lv4〕','〔lv5〕','〔lv6〕','〔lv7〕','〔lv8〕','〔lv9〕'
-'〔 Ѳ1〕','〔 Ѳ2〕','〔 Ѳ3〕','〔 Ѳ4〕','〔 Ѳ5〕','〔Ѳ6〕','〔Ѳ7〕','〔Ѳ8〕','〔Ѳ9〕'
-◁▷
-◀this is text or an image▶ http://
-p __FILE__ +':'+ __LINE__.to_s
-p __FILE__ + ' ' + __LINE__.to_s + ' ' + html
-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'}
-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 ├
- 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 ├
- └ ┘
-Iu ⌠ 8992 Il ⌡ <7 ⌈ 8968 >7 ⌉ 8969 7< ⌊ 8970 7> ⌋ 8971
-<" 『 12302 >" 』 12303
-<' 「 12300 >' 」 12301
diff --git a/lib/sisu/v2/dal.rb b/lib/sisu/v2/dal.rb
deleted file mode 100644
index fd09f64..0000000
--- a/lib/sisu/v2/dal.rb
+++ /dev/null
@@ -1,475 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: preprocessing, (document abstraction), data abstraction used
- in subsequent processing
-
-=end
-module SiSU_DAL
- require "#{SiSU_lib}/defaults" # defaults.rb
- include SiSU_Viz
- require "#{SiSU_lib}/sysenv" # sysenv.rb
- include SiSU_Env
- require "#{SiSU_lib}/param" # param.rb
- include SiSU_Param
- require "#{SiSU_lib}/dal_doc_objects" # dal_doc_objects.rb
- require "#{SiSU_lib}/dal_syntax" # dal_syntax.rb
- include SiSU_Syntax
- require "#{SiSU_lib}/dal_doc_str" # dal_doc_str.rb
- require "#{SiSU_lib}/dal_idx" # dal_idx.rb
- require "#{SiSU_lib}/dal_numbering" # dal_numbering.rb
- require "#{SiSU_lib}/dal_hash_digest" # dal_hash_digest.rb
- require "#{SiSU_lib}/dal_endnotes" # dal_endnotes.rb
- require "#{SiSU_lib}/dal_images" # dal_images.rb
- require "#{SiSU_lib}/dal_metadata" # dal_metadata.rb
- require "#{SiSU_lib}/dal_character_check" # dal_character_check.rb
- require "#{SiSU_lib}/dal_substitutions_and_insertions" # dal_substitutions_and_insertions.rb
- require "#{SiSU_lib}/dal_expand_insertions" # dal_expand_insertions.rb
- require "#{SiSU_lib}/i18n" # i18n.rb
- require "#{SiSU_lib}/shared_sem" # shared_sem.rb
- class Instantiate < SiSU_Param::Parameters::Instructions
- def initialize
- @@flag_vocab=0
- @@line_mode=''
- end
- end
- class Source <Instantiate
- @@dal_array=[]
- @@idx_arr={:sst=>[],:tex=>[],:html=>[],:xhtml=>[]}
- @@map_arr={:nametags=>[],:ocn_htmlseg=>[]}
- @@fns=nil
- def initialize(opt)
- @opt=opt
- @@fns||@opt.fns
- @make_fns=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns)
- @fnm=@make_fns.marshal.dal_metadata
- @fnc=@make_fns.marshal.dal_content
- @idx_sst=@make_fns.marshal.dal_idx_sst_rel_html_seg
- @idx_tex=@make_fns.marshal.dal_idx_sst_rel
- @idx_html=@make_fns.marshal.dal_idx_html
- @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
- end
- def read #creates dal
- begin
- dal=[]
- @@dal_array=[]
- @@fns=@opt.fns
- create_dal
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- Instantiate.new
- end
- end
- def get #reads dal, unless does not exist then creates first
- begin
- dal=[]
- unless @@fns==@opt.fns
- @@fns=@opt.fns
- @@dal_array=[]
- end
- dal=(@@dal_array.empty?) ? read_fnc : @@dal_array.dup
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- Instantiate.new
- end
- end
- def get_idx_sst #reads dal idx.sst, #unless does not exist then creates first
- begin
- dal=[]
- unless @@fns==@opt.fns
- @@fns=@opt.fns
- @@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
- ensure
- Instantiate.new
- end
- end
- def get_idx_tex #reads dal idx.tex, #unless does not exist then creates first
- begin
- dal=[]
- unless @@fns==@opt.fns
- @@fns=@opt.fns
- @@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
- ensure
- Instantiate.new
- end
- end
- def get_idx_html #reads dal idx.html, #unless does not exist then creates first
- begin
- dal=[]
- unless @@fns==@opt.fns
- @@fns=@opt.fns
- @@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
- ensure
- Instantiate.new
- end
- end
- def get_idx_xhtml #reads dal idx.xhtml, #unless does not exist then creates first
- begin
- dal=[]
- unless @@fns==@opt.fns
- @@fns=@opt.fns
- @@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
- ensure
- Instantiate.new
- end
- end
- def get_map_nametags #reads dal map.nametags, #unless does not exist then creates first
- begin
- dal=[]
- unless @@fns==@opt.fns
- @@fns=@opt.fns
- @@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
- ensure
- Instantiate.new
- end
- end
- def get_map_ocn_htmlseg #reads dal map.ocn_htmlseg, #unless does not exist then creates first
- begin
- dal=[]
- unless @@fns==@opt.fns
- @@fns=@opt.fns
- @@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
- ensure
- Instantiate.new
- end
- end
- protected
- def create_dal
- dal_array=[]
- unless @opt.cmd =~/q/
- tell=(@opt.cmd=~/[vVM]/) \
- ? SiSU_Screen::Ansi.new(@opt.cmd,'Document Abstraction') \
- : SiSU_Screen::Ansi.new(@opt.cmd,'Document Abstraction',@opt.fns)
- tell.green_title_hi
- end
- file_array=@env.read_source_file(@opt.fns)
- file_array.each do |l|
- if l =~/\r\n/; l.gsub!(/\r\n/,"\n")
- end
- end
- meta=file_array.dup
- meta=meta.join.split("\n\n") #check whether can be eliminated, some of these are large objects to have twice
- @md=SiSU_Param::Parameters::Instructions.new(meta,@opt).extract
- meta=nil
- dal=SiSU_DAL::Make.new(@md,file_array).song
- if @opt.cmd =~/[vM]/
- 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 -> #{@make_fns.meta}").txt_grey if @opt.cmd =~/M/
- end
- dal.each{|s| dal_array << s}
- dal_array
- end
- def read_fnm
- dal=[]
- dal=if FileTest.file?(@fnm)
- (RUBY_VERSION < '1.9') \
- ? (File.open(@fnm){ |f| dal=Marshal.load(f)}) \
- : (File.open(@fnm,'r:utf-8'){ |f| dal=Marshal.load(f)})
- else SiSU_DAL::Source.new(@opt).create_dal
- end
- end
- def read_fnc
- dal=[]
- dal=if FileTest.file?(@fnc)
- (RUBY_VERSION < '1.9') \
- ? (File.open(@fnc){ |f| dal=Marshal.load(f)}) \
- : (File.open(@fnc,'r:utf-8'){ |f| dal=Marshal.load(f)})
- else SiSU_DAL::Source.new(@opt).create_dal
- end
- end
- def read_idx_sst
- m=[]
- m=if FileTest.file?(@idx_sst)
- (RUBY_VERSION < '1.9') \
- ? (File.open(@idx_sst){ |f| m=Marshal.load(f)}) \
- : (File.open(@idx_sst,'r:utf-8'){ |f| m=Marshal.load(f)})
- else nil
- end
- end
- def read_idx_tex
- m=[]
- m=if FileTest.file?(@idx_tex)
- (RUBY_VERSION < '1.9') \
- ? (File.open(@idx_tex){ |f| m=Marshal.load(f)}) \
- : (File.open(@idx_tex,'r:utf-8'){ |f| m=Marshal.load(f)})
- else nil
- end
- end
- def read_idx_html
- m=[]
- m=if FileTest.file?(@idx_html)
- (RUBY_VERSION < '1.9') \
- ? (File.open(@idx_html){ |f| m=Marshal.load(f)}) \
- : (File.open(@idx_html,'r:utf-8'){ |f| m=Marshal.load(f)})
- else nil
- end
- end
- def read_idx_xhtml
- m=[]
- m=if FileTest.file?(@idx_xhtml)
- (RUBY_VERSION < '1.9') \
- ? (File.open(@idx_xhtml){ |f| m=Marshal.load(f)}) \
- : (File.open(@idx_xhtml,'r:utf-8'){ |f| m=Marshal.load(f)})
- else nil
- end
- end
- def read_map_nametags
- m=[]
- m=if FileTest.file?(@map_nametags)
- (RUBY_VERSION < '1.9') \
- ? (File.open(@map_nametags){ |f| m=Marshal.load(f)}) \
- : (File.open(@map_nametags,'r:utf-8'){ |f| m=Marshal.load(f)})
- else nil
- end
- end
- def read_map_ocn_htmlseg
- m=[]
- m=if FileTest.file?(@map_ocn_htmlseg)
- (RUBY_VERSION < '1.9') \
- ? (File.open(@map_ocn_htmlseg){ |f| m=Marshal.load(f)}) \
- : (File.open(@map_ocn_htmlseg,'r:utf-8'){ |f| m=Marshal.load(f)})
- else nil
- end
- end
- end
- class Output
- def initialize(md,data)
- @md,@data=md,data
- @make=SiSU_Env::Create_file.new(@md.cmd,@md.fns)
- @dir=SiSU_Env::Info_env.new(@md.fns)
- end
- def screen_dump(o)
- if defined? o.of
- print %{OF: #{o.of}; }
- end
- if defined? o.is
- print %{IS: #{o.is}; }
- end
- if defined? o.ocn
- print %{OCN: #{o.ocn}; }
- end
- if defined? o.node
- print %{NODE: #{o.node}; }
- end
- if defined? o.parent
- print %{Parent: #{o.parent}; }
- end
- if defined? o.obj and not o.obj.empty?
- puts %{\n#{o.obj}; }
- else "\n"
- end
- end
- def screen_print(t_o)
- if defined? t_o
- print ' ' + t_o.to_s
- end
- end
- def screen_output(data)
- data.each do |o|
- print o.class
- screen_print(o.ocn)
- screen_print(o.obj)
- puts "\n"
- end
- end
- def hard_output
- if @md.cmd =~/M/
- filename_meta=@make.file_meta
- @data.each {|o| filename_meta.puts o.inspect.sub(/:0x[0-9a-f]{8}\s/,': ')} #to make diffing easier
- filename_txt=@make.file_txt
- @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}"
- end
- else
- filename_txt.puts case o.is
- when 'meta'
- "[m~#{o.tag}] #{o.obj}"
- else "[#{o.is}] #{o.obj}"
- end
- end
- end
- filename_debug=@make.file_debug
- @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}"
- end
- end
- end
- else
- hard="#{@dir.path.dal}/#{@md.fns}.meta"
- File.unlink(hard) if FileTest.file?(hard)
- hard="#{@dir.path.dal}/#{@md.fns}.txt"
- File.unlink(hard) if FileTest.file?(hard)
- hard="#{@dir.path.dal}/#{@md.fns}.debug.txt"
- File.unlink(hard) if FileTest.file?(hard)
- end
- end
- def make_marshal_content
- marshal_dal=@make.marshal.dal_content
- File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.class==Array
- end
- def make_marshal_metadata
- marshal_dal=@make.marshal.dal_metadata
- File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.class==Array
- end
- def idx_html_hard_output
- if @md.book_idx \
- and @md.cmd =~/M/
- filename_meta=@make.file_meta_idx_html
- unless @data.nil? #REMOVE earliest possible
- @data.each {|s| p s.inspect + "\n" unless s.class==String}
- @data.each {|s| filename_meta.puts s.strip + "\n" unless s.strip.empty?}
- end
- else
- hard_idx_html="#{@dir.path.dal}/#{@md.fns}.idx.html"
- File.unlink(hard_idx_html) if FileTest.file?(hard_idx_html)
- end
- end
- def make_marshal_idx_sst_html_seg
- marshal_dal=@make.marshal.dal_idx_sst_rel_html_seg
- File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.class==Array
- end
- def make_marshal_idx_sst_rel
- marshal_dal=@make.marshal.dal_idx_sst_rel
- File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.class==Array
- end
- def make_marshal_idx_html
- marshal_dal=@make.marshal.dal_idx_html
- File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.class==Array
- end
- def make_marshal_idx_xhtml
- marshal_dal=@make.marshal.dal_idx_xhtml
- File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.class==Array
- end
- def make_marshal_map_nametags
- marshal_dal=@make.marshal.dal_map_nametags
- File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.class==Hash
- end
- def make_marshal_map_name_ocn_htmlseg
- marshal_dal=@make.marshal.dal_map_ocn_htmlseg
- File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.class==Hash
- end
- end
- class Make
- def initialize(md,data)
- @md,@data=md,data
- @env=SiSU_Env::Info_env.new(@md.fns)
- end
- def reset
- @@flag_vocab=0
- @@line_mode=''
- end
- def song
- reset
- data=@data
- my_make_source_file=SiSU_Env::Create_file.new(@md.cmd,@md.fns)
- 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
- outputdata=data
- if @md.cmd =~/[mM]/
- SiSU_DAL::Output.new(@md,outputdata).hard_output
- SiSU_DAL::Output.new(@md,outputdata).make_marshal_content
- SiSU_DAL::Output.new(@md,metadata).make_marshal_metadata
- SiSU_DAL::Output.new(@md,html_idx).idx_html_hard_output
- SiSU_DAL::Output.new(@md,book_index_rel_html_seg).make_marshal_idx_sst_html_seg
- SiSU_DAL::Output.new(@md,book_index_rel).make_marshal_idx_sst_rel
- SiSU_DAL::Output.new(@md,html_idx).make_marshal_idx_html
- SiSU_DAL::Output.new(@md,xhtml_idx).make_marshal_idx_xhtml
- SiSU_DAL::Output.new(@md,tags_map).make_marshal_map_nametags
- SiSU_DAL::Output.new(@md,ocn_html_seg_map).make_marshal_map_name_ocn_htmlseg
- end
- reset
- outputdata
- end
- protected
- end
-end
-__END__
diff --git a/lib/sisu/v2/dal_doc_objects.rb b/lib/sisu/v2/dal_doc_objects.rb
deleted file mode 100644
index bc0020b..0000000
--- a/lib/sisu/v2/dal_doc_objects.rb
+++ /dev/null
@@ -1,425 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: document abstraction
-
-=end
-module SiSU_document_structure
- class Extract
- def extract(h,o)
- obj=h ? h : o
- end
- end
- class Object_metadata
- attr_accessor :is,:of,:tags,:obj,:digest
- def initialize
- @tags={}
- @is=@tmp=@digest=nil
- @of='meta'
- end
- def metadata(tags)
- of= @of #String, classification - group
- 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
- attr_accessor :obj,:is,:of,:tag,:digest,:tmp
- def initialize
- @is=@obj=@tag=@digest=@digest=@tmp=nil
- @of='meta'
- end
- def metadata(h,o=nil)
- of= @of #String, classification - group
- 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
- digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
- @of,@is,@tag,@obj,@digest,@tmp=of,is,tag,obj,digest,tmp
- self
- end
- end
- class Object_heading
- 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'
- @is=@obj=@lv=@ln=@toc_=@name=@idx=@size=@ocn=@odv=@osp=@node=@parent=@ocn_=@note_=@autonum_=@digest=@tmp=nil
- @tags=[]
- end
- def heading_ln(lv)
- ln=case lv
- when /A/; 1
- when /B/; 2
- when /C/; 3
- when /1/; 4
- when /2/; 5
- when /3/; 6
- when /4/; 7
- when /5/; 8
- when /6/; 9
- end
- end
- def heading_lv(ln)
- lv=case ln.to_s
- when /1/; 'A'
- when /2/; 'B'
- when /3/; 'C'
- when /4/; '1'
- when /5/; '2'
- when /6/; '3'
- when /7/; '4'
- when /8/; '5'
- when /9/; '6'
- end
- end
- def heading(h,o=nil)
- if not h[:ln] and (h[:lv] and h[:lv]=~/[1-6A-C]/)
- h[:ln]=heading_ln(h[:lv])
- elsif not h[:lv] and (h[:ln] and h[:ln].to_s=~/[1-9]/)
- h[:lv]=heading_lv(h[:ln])
- end
- of= @of #String, classification - group
- 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
- idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
- ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
- odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
- osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
- node= h[:node] || ((defined? o.node) ? o.node : nil) #[Node relationship doc structure info]
- parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
- lv= h[:lv] || ((defined? o.lv) ? o.lv : nil) #Alpha-numeric, document structure as used in markup, A-C then 1-6
- ln= h[:ln] || ((defined? o.ln) ? o.ln : nil) #Integer, document structure level, for convenience in processing 1-9
- toc_= h[:toc_] || ((defined? o.toc_) ? o.toc_ : false) #Bool, do not include in toc, (relevant to headings)
- ocn_=if h[:ocn_].nil?; ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
- else h[:ocn_]
- end
- autonum_= if h[:autonum_].nil?; ((defined? o.autonum_) ? o.autonum_ : true) #Bool? auto-numbering if requested default on, false suppresses
- else h[:autonum_]
- end
- note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
- digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@lv,@ln,@name,@tags,@obj,@idx,@ocn,@odv,@osp,@node,@parent,@toc_,@ocn_,@note_,@autonum_,@digest,@tmp=of,is,lv,ln,name,tags,obj,idx,ocn,odv,osp,node,parent,toc_,ocn_,note_,autonum_,digest,tmp
- self
- end
- def heading_insert(h,o=nil)
- heading(h,o=nil)
- @is= 'heading_insert' #String, classification - specific type
- self
- end
- end
- class Object_para
- attr_accessor :obj,:is,:tags,:of,:name,:idx,:bullet_,:indent,:ocn,:odv,:osp,:parent,:note_,:image_,:ocn_,:digest,:tmp
- def initialize
- @of='para'
- @is=@obj=@name=@idx=@bullet_=@indent=@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
- 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
- idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
- ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
- odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
- osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
- parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
- indent= h[:indent].to_s || ((defined? o.indent) ? o.indent.to_s : nil) #Integer, indent level
- bullet_=h[:bullet_] || ((defined? o.bullet_) ? o.bullet_ : false) #Bool, bulleted?
- note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
- image_= h[:image_] || ((defined? o.image_) ? o.image_ : false) #Bool, images? (processing optimization)
- ocn_=if h[:ocn_].nil?; ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
- else h[:ocn_]
- end
- digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@name,@tags,@obj,@indent,@bullet_,@idx,@ocn,@odv,@osp,@parent,@image_,@note_,@ocn_,@digest,@tmp=of,is,name,tags,obj,indent,bullet_,idx,ocn,odv,osp,parent,image_,note_,ocn_,digest,tmp
- self
- end
- def docinfo(h,o=nil)
- of= @of #String, classification - group
- 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
- idx= nil #String, book index provided?
- ocn= nil #Integer, sequential on substantive-content objects
- odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
- osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
- parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
- indent= nil #Integer, indent level
- bullet_=false #Bool, bulleted?
- note_= false #Bool, endnotes/footnotes? (processing optimization)
- image_= h[:image_] || ((defined? o.image_) ? o.image_ : false) #Bool, images? (processing optimization)
- ocn_=if h[:ocn_].nil?; ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
- else h[:ocn_]
- end
- digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@name,@tags,@obj,@indent,@bullet_,@idx,@ocn,@odv,@osp,@parent,@image_,@note_,@ocn_,@digest,@tmp=of,is,name,tags,obj,indent,bullet_,idx,ocn,odv,osp,parent,image_,note_,ocn_,digest,tmp
- self
- end
- end
- class Object_group
- attr_accessor :obj,:is,:of,:tags,:idx,:ocn,:odv,:osp,:parent,:note_,:number_,:ocn_,:digest,:tmp
- def initialize
- @of='group'
- @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
- 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?
- ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
- odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
- osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
- parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
- number_= h[:number_] || ((defined? o.number_) ? o.number_ : false) #Bool, numbered or not?
- note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
- ocn_= if h[:ocn_].nil?; ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
- else h[:ocn_]
- end
- digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@number_,@note_,@ocn_,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,number_,note_,ocn_,digest,tmp
- self
- end
- def group(h,o=nil)
- of= @of #String, classification - group
- 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?
- ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
- odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
- osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
- parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
- note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
- ocn_= if h[:ocn_].nil?; ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
- else h[:ocn_]
- end
- digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,note_,ocn_,digest,tmp
- self
- end
- def alt(h,o=nil) #see group
- of= @of #String, classification - group
- 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?
- ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
- odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
- osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
- parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
- note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
- ocn_= if h[:ocn_].nil?; ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
- else h[:ocn_]
- end
- digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,note_,ocn_,digest,tmp
- self
- 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
- 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?
- ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
- odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
- osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
- parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
- ocn_= if h[:ocn_].nil?; ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
- else h[:ocn_]
- end
- digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,note_,ocn_,digest,tmp
- @h=nil
- self
- end
- end
- class Object_table
- attr_accessor :obj,:is,:of,:lv,:tags,:name,:idx,:indent,:size,:ocn,:number,:head_,:cols,:widths,:odv,:osp,:parent,:note_,:ocn_,:digest,:tmp
- def initialize
- @of='group'
- @is=@obj=@lv=@name=@idx=@indent=@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
- 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)
- 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?
- ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
- odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
- osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
- parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
- head_= h[:head_] || ((defined? o.head_) ? o.head_ : false)
- note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
- ocn_=if h[:ocn_].nil?; ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
- else h[:ocn_]
- end
- digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@tags,@cols,@widths,@obj,@idx,@ocn,@odv,@osp,@parent,@head_,@note_,@ocn_,@digest,@tmp=of,is,tags,cols,widths,obj,idx,ocn,odv,osp,parent,head_,note_,ocn_,digest,tmp
- self
- end
- end
- class Object_image
- attr_accessor :obj,:is,:of,:lv,:idx,:size,:ocn,:parent,:note_,:ocn_,:digest,:tmp
- def initialize
- @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
- 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)
- idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
- ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
- odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
- osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
- parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
- note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
- ocn_=if h[:ocn_].nil?; ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
- else h[:ocn_]
- end
- digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@tags,@obj,@size,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@digest,@tmp=of,is,tags,obj,size,idx,ocn,odv,osp,parent,note_,ocn_,digest,tmp
- self
- end
- end
- class Object_structure
- attr_accessor :obj,:tag,:node,:lv,:ln,:status,:is,:of,:tmp
- def initialize
- @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
- 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
- node= h[:node] || ((defined? o.node) ? o.node : nil) #[Node relationship doc structure info]
- status= h[:status] || ((defined? o.status) ? o.status : nil) #tag status open or close
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@obj,@status,@node,@lv,@ln,@tmp=of,is,obj,status,node,lv,ln,tmp
- self
- end
- end
- class Object_comment
- attr_accessor :obj,:is,:of,:tmp
- def initialize
- @of='comment'
- @is=@obj=@tmp=nil
- end
- def comment(h,o=nil)
- of= @of #String, classification - group
- 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
- attr_accessor :obj,:is,:of,:tmp
- def initialize
- @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
- 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
- def insert(h,o=nil) #decide how to deal with, could mimic paragraph?
- of= @of #String, classification - group
- 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
- self
- end
- end
-end
-__END__
-# ~# |-# no paragraph number # -# not included in toc
diff --git a/lib/sisu/v2/dal_doc_str.rb b/lib/sisu/v2/dal_doc_str.rb
deleted file mode 100644
index 6fd7eff..0000000
--- a/lib/sisu/v2/dal_doc_str.rb
+++ /dev/null
@@ -1,1184 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: document abstraction
-
-=end
-module SiSU_document_structure_extract
- class Instantiate < SiSU_Param::Parameters::Instructions
- @@flag={} #Beware!!
- def initialize
- @@flag['table_to']=false
- @@counter=@@column=@@columns=0
- @@line_mode=''
- end
- end
- class Build
- @@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])
- end
- def ln_get(lv)
- ln=case lv
- when /A/; 1
- when /B/; 2
- when /C/; 3
- when /1/; 4
- when /2/; 5
- when /3/; 6
- when /4/; 7
- when /5/; 8
- when /6/; 9
- end
- end
- def image_test(str)
- boolean=(str=~/\{\s*\S+?\.png.+?\}https?:\/\/\S+/ ? true : false)
- end
- def bullet_test(str)
- bool=((str=~/\*/) ? true : false)
- end
- def indent_test(str)
- num=((str=~/^_([1-9])/) ? $1 : 0)
- end
- def endnote_test?(str)
- bool=((str=~/~\{.+?\}~|~\[.+?\]~/) ? true : false)
- end
- def extract_tags(str,nametag=nil)
- tags=[]
- 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,' ')
- 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?
- end
- tags=nametag ? (tags << nametag) : tags
- end
- [str,tags]
- end
- def identify_parts
- data=@data
- tuned_file=[]
- @tuned_group,@tuned_code=[],[]
- @@counter,@verse_count=0,0
- @metadata={}
- @data.each do |t_o|
- t_o.gsub!(/(?:\n\s*\n)+/m,"\n") unless @@flag['code']
- if t_o !~/^(?:code|poem|alt|group)\{|^\}(?:code|poem|alt|group)|^(?:table\{|\{table)[ ~]/ \
- and not @@flag['code'] \
- and not @@flag['poem'] \
- and not @@flag['group'] \
- and not @@flag['alt'] \
- 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,'')
- m
- else nil
- end
- end
- t_o=case t_o
- when /^#{Mx[:meta_o]}\S+?#{Mx[:meta_c]}/ #metadata, header
- if t_o=~/^#{Mx[:meta_o]}(\S+?)#{Mx[:meta_c]}\s*(.+)/m
- tag,obj=$1,$2
- @metadata[tag]=obj
- end
- t_o=nil
- when /^%+\s/ #comment
- t_o=if t_o=~/^%+\s+(.+)/
- h={:obj=>$1}
- SiSU_document_structure::Object_comment.new.comment(h)
- else nil
- end
- when /^:?([A-C1-6])\~/ #heading / lv
- lv=$1
- ln=ln_get(lv)
- t_o=if t_o=~/^:?[A-C1-6]\~\s+(.+)/m
- obj=$1
- 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)
- 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)
- 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)
- else nil
- end
- when /^(?:_[1-9]|_[1-9]?\*)\s+/ #indented and/or bullet paragraph
- t_o=if t_o=~/^(_(?:[1-9]?\*|[1-9])\s+)(.+)/m
- tst,obj=$1,$2
- indent=indent_test(tst)
- bullet=bullet_test(tst)
- image=image_test(obj)
- note=endnote_test?(obj)
- obj,tags=extract_tags(obj)
- unless obj=~/\A\s*\Z/m
- h={:bullet_=>bullet,:indent=>indent,:obj=>obj,:idx=>idx,:note_=>note,:image_=>image,:tags=>tags}
- SiSU_document_structure::Object_para.new.paragraph(h)
- end
- else nil
- end
- when /^<?:p[bn]>?\s*$/
- if t_o =~/^<?:pn>?\s*$/
- SiSU_document_structure::Object_layout.new.break(Hx[:br_page_new])
- else SiSU_document_structure::Object_layout.new.break(Hx[:br_page])
- end
- when /^<?:(?:ols|---)>?\s*$/
- SiSU_document_structure::Object_layout.new.break(Hx[:obj_ln_sep])
- 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,:obj=>obj,:idx=>idx,:note_=>note,:image_=>image,:tags=>tags}
- SiSU_document_structure::Object_para.new.paragraph(h)
- end
- end
- elsif not @@flag['code']
- if t_o =~/^code\{/
- @@flag['code']=true
- @@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)
- 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)
- 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)
- 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)
- 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)
- tuned_file << ins
- if t_o=~/^table\{(?:~h)?\s+/
- @@flag['table']=true
- @rows=''
- case t_o
- when /table\{~h\s+c(\d+);\s+(.+)/
- cols=$1
- col=$2.scan(/\d+/)
- heading=true
- when /table\{\s+c(\d+);\s+(.+)/
- cols=$1
- col=$2.scan(/\d+/)
- heading=false
- end
- @h={:head_=>heading,:cols=>cols,:widths=>col,:idx=>idx}
- elsif t_o=~/^\{table(?:~h)?(?:\s+\d+;?)?\}\n.+\Z/m
- m1,m2,hd=nil,nil,nil
- tbl=/^\{table(?:~h)?(?:\s+\d+;?)?\}\n(.+)\Z/m.match(t_o)[1] #two table representations should be consolidated as one
- hd=((t_o =~/^\{table~h/) ? true : false)
- tbl,tags=extract_tags(tbl)
- rws=tbl.split(/\n/)
- rows=''
- 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]}")
- rows += r + Mx[:tc_c]
- end
- col=[]
- if t_o =~/^\{table(?:~h)?\s+(\d+);?\}/ #width of col 1 given as %, usually when wider than rest that are even
- c1=$1.to_i
- width=(100 - c1)/(cols - 1)
- col=[ c1 ]
- (cols - 1).times { col << width }
- else #all columns of equal width
- width=100.00/cols
- 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?
- tuned_file << t_o
- h={:obj=>'table end'} #introduce a counter
- t_o=SiSU_document_structure::Object_comment.new.comment(h)
- t_o
- elsif t_o=~/^\{table(?:~h)?\s+/
- m1,m2,hd=nil,nil,nil
- h=case t_o
- when /\{table~h\s+(.+?)\}\n(.+)\Z/m #two table representations should be consolidated as one
- m1,tbl,hd=$1,$2,true
- when /\{table\s+(.+?)\}\n(.+)\Z/m #two table representations should be consolidated as one
- m1,tbl,hd=$1,$2,false
- else nil
- end
- tbl,tags=extract_tags(tbl)
- col=m1.scan(/\d+/)
- rws=tbl.split(/\n/)
- rows=''
- rws.each do |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?
- tuned_file << t_o
- h={:obj=>'table end'} #introduce a counter
- t_o=SiSU_document_structure::Object_comment.new.comment(h)
- t_o
- end
- end
- t_o
- end
- if @@flag['table']
- if @@flag['table'] \
- and t_o =~/^\}table/ #two table representations should be consolidated as one
- @@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)
- 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
- 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
- t_o.gsub!(/\n/m,"#{Mx[:tc_p]}")
- @rows += t_o + Mx[:tc_c]
- end
- t_o=nil
- end
- end
- if @@flag['code']
- if t_o =~/^\}code/
- @@flag['code']=false
- obj,tags=extract_tags(@tuned_code.join("\n"))
- h={:obj=>obj,:tags=>tags,:number_=>@codeblock_numbered}
- t_o=SiSU_document_structure::Object_group.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)
- end
- if @@flag['code'] \
- and t_o.class==String \
- and not t_o.nil? #you may need to introduce t_o.class==String test more widely
- sub_array=t_o.dup + "#{Mx[:br_nl]}"
- @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
- @tuned_code << t_o
- t_o=nil
- end
- elsif @@flag['poem'] \
- or @@flag['group'] \
- or @@flag['alt']
- if @@flag['poem'] \
- 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)
- elsif ( @@flag['group'] \
- and t_o =~/^\}group/ )
- @@flag['group']=false
- obj,tags=extract_tags(@tuned_group.join("\n"))
- h={:obj=>obj,:tags=>tags}
- @tuned_group=[]
- t_o=SiSU_document_structure::Object_group.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)
- elsif ( @@flag['alt'] \
- and t_o =~/^\}alt/ )
- @@flag['alt']=false
- obj,tags=extract_tags(@tuned_group.join("\n"))
- h={:obj=>obj,:tags=>tags}
- t_o=SiSU_document_structure::Object_group.new.alt(h)
- @tuned_group=[]
- 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)
- end
- if @@flag['poem'] \
- or @@flag['group'] \
- or @@flag['alt'] \
- and t_o =~/\S/ \
- and t_o !~/^(?:\}(?:verse|code|alt|group)|(?:verse|code|alt|group)\{)/ # fix logic
- 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
- poem=t_o.split(/\n\n/)
- poem.each do |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_group.new.verse(h)
- tuned_file << t_o
- end
- else 'group'
- end
- @verse_count+=1 if @@flag['poem']
- end
- end
- if not @@flag['code']
- if @@flag['poem'] \
- 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 + Mx[:br_nl] if t_o =~/\S+/
- elsif t_o.is=='group' \
- 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}")
- end
- @tuned_group << t_o if t_o =~/\S+/
- else tuned_file << t_o
- end
- else tuned_file << t_o
- end
- end
- 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)
- h={:ln=>4,:obj=>'Endnotes',:name=>'endnotes',:autonum_=>false}
- tuned_file << SiSU_document_structure::Object_heading.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)
- h={:ln=>4,:obj=>'Index',:name=>'book_index',:autonum_=>false}
- tuned_file << SiSU_document_structure::Object_heading.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)
- 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
- h={:obj=>'eof'}
- meta=SiSU_document_structure::Object_metadata.new.metadata(@metadata)
- [tuned_file,meta]
- end
- def table_rows_and_columns_array(table_str)
- table=[]
- table_str.split(/#{Mx[:tc_c]}/).each do |table_row|
- table_row_with_columns=table_row.split(/#{Mx[:tc_p]}/)
- table << table_row_with_columns
- end
- table
- 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)
- end
- def meta_para(str)
- h={:obj=>str,:ocn_=>false}
- SiSU_document_structure::Object_para.new.paragraph(h)
- end
- def metadata
- meta=[]
- dir=SiSU_Env::Info_env.new(@md.fns)
- base_html="#{dir.url.root}/#{@md.fnb}"
- l=SiSU_Env::Standardise_language.new.file_to_language(@md.fns)
- language=l[:l]
- tr=SiSU_Translate::Source.new(@md,language)
- meta << @pb
- h={:ln=>2,:obj=>'Metadata',:ocn_=>false}
- meta << SiSU_document_structure::Object_heading.new.heading(h)
- h={:ln=>4,:name=>'metadata',:obj=>'Metadata',:autonum_=>false,:ocn_=>false}
- meta << SiSU_document_structure::Object_heading.new.heading(h) #add ocnm
- s="Document Manifest @\n #{base_html}/#{@md.fn[:manifest]}"
- meta << meta_para(s)
- s="#{Mx[:fa_bold_o]}Dublin Core#{Mx[:fa_bold_c]} (DC)" #add ocnm
- meta << meta_para(s)
- s="#{Mx[:fa_italics_o]}DC tags included with this document are provided here.#{Mx[:fa_italics_c]}" #add ocnm
- meta << meta_para(s)
- if defined? @md.title.full \
- and @md.title.full=~/\S+/
- s="#{tr.full_title}: #{Mx[:fa_underscore_o]}#{@md.title.full}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.creator.author \
- and @md.creator.author=~/\S+/
- s="\n#{tr.author}: #{Mx[:fa_underscore_o]}#{@md.creator.author}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.creator.translator \
- and @md.creator.translator=~/\S+/
- s="#{tr.translator}: #{Mx[:fa_underscore_o]}#{@md.creator.translator}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.creator.illustrator \
- and @md.creator.illustrator=~/\S+/
- s="#{tr.illustrator}: #{Mx[:fa_underscore_o]}#{@md.creator.illustrator}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.creator.prepared_by \
- and @md.creator.prepared_by=~/\S+/
- s="\n#{tr.prepared_by}: #{Mx[:fa_underscore_o]}#{@md.creator.prepared_by}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.creator.digitized_by \
- and @md.creator.digitized_by=~/\S+/
- s="#{tr.digitized_by}: #{Mx[:fa_underscore_o]}#{@md.creator.digitized_by}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.rights.all \
- and @md.rights.all=~/\S+/
- s="\n#{tr.rights}: #{Mx[:fa_underscore_o]}#{@md.rights.all}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.notes.description \
- and @md.notes.description=~/\S+/
- s="#{tr.description}: #{Mx[:fa_underscore_o]}#{@md.notes.description}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.classify.subject \
- and @md.classify.subject=~/\S+/
- s="#{tr.subject}: #{Mx[:fa_underscore_o]}#{@md.classify.subject}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.publisher \
- and @md.publisher=~/\S+/
- s="\n#{tr.publisher}: #{Mx[:fa_underscore_o]}#{@md.publisher}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.creator.contributor \
- and @md.creator.contributor=~/\S+/
- s="\n#{tr.contributor}: #{Mx[:fa_underscore_o]}#{@md.creator.contributor}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.notes.abstract \
- and @md.notes.abstract=~/\S+/
- s="\n#{tr.abstract}: #{Mx[:fa_underscore_o]}#{@md.notes.abstract}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.date.created \
- and @md.date.created=~/\S+/
- s="\n#{tr.date_created}: #{Mx[:fa_underscore_o]}#{@md.date.created}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.date.issued \
- and @md.date.issued=~/\S+/
- s="\n#{tr.date_issued}: #{Mx[:fa_underscore_o]}#{@md.date.issued}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.date.available \
- and @md.date.available=~/\S+/
- s="\n#{tr.date_available}: #{Mx[:fa_underscore_o]}#{@md.date.available}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.date.modified \
- and @md.date.modified=~/\S+/
- s="\n#{tr.date_modified}: #{Mx[:fa_underscore_o]}#{@md.date.modified}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.date.valid \
- and @md.date.valid=~/\S+/
- s="\n#{tr.date_valid}: #{Mx[:fa_underscore_o]}#{@md.date.valid}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.date.published \
- and @md.date.published=~/\S+/
- s="\n#{tr.date}: #{Mx[:fa_underscore_o]}#{@md.date.published}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.classify.loc \
- and @md.classify.loc=~/\S+/
- s="\n#{tr.cls_loc}: #{Mx[:fa_underscore_o]}#{@md.classify.loc}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.classify.dewey \
- and @md.classify.dewey=~/\S+/
- s="\n#{@cls_dewey}: #{Mx[:fa_underscore_o]}#{@md.classify.dewey}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.classify.pg \
- and @md.classify.pg=~/\S+/
- s="\n#{tr.cls_gutenberg}: #{Mx[:fa_underscore_o]}#{@md.classify.pg}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.classify.isbn \
- and @md.classify.isbn=~/\S+/
- s="\n#{tr.cls_isbn}: #{Mx[:fa_underscore_o]}#{@md.classify.isbn}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.notes.comment \
- and @md.notes.comment=~/\S+/
- s="\n#{tr.comments}: #{Mx[:fa_underscore_o]}#{@md.notes.comment}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.notes.prefix_a \
- and @md.notes.prefix_a=~/\S+/
- s="\n#{tr.prefix_a}: #{Mx[:fa_underscore_o]}#{@md.notes.prefix_a}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.notes.prefix_b \
- and @md.notes.prefix_b=~/\S+/
- s="\n#{tr.prefix_b}: #{Mx[:fa_underscore_o]}#{@md.notes.prefix_b}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.classify.identifier \
- and @md.classify.identifier=~/\S+/
- s="\n#{tr.identifier}: #{Mx[:fa_underscore_o]}#{@md.classify.identifier}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.original.source \
- and @md.original.source=~/\S+/
- s="\n#{tr.source}: #{Mx[:fa_underscore_o]}#{@md.original.source}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.title.language \
- and @md.title.language=~/\S+/
- s="\n#{tr.language}: #{Mx[:fa_underscore_o]}#{@md.title.language}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.original.language \
- and @md.original.language=~/\S+/
- s="\n#{tr.language_original}: #{Mx[:fa_underscore_o]}#{@md.original.language}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.classify.format \
- and @md.classify.format=~/\S+/
- s="\n#{tr.format}: #{Mx[:fa_underscore_o]}#{@md.classify.format}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.classify.relation \
- and @md.classify.relation=~/\S+/
- s="\n#{tr.relation}: #{Mx[:fa_underscore_o]}#{@md.classify.relation}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.classify.coverage \
- and @md.classify.coverage=~/\S+/
- s="\n#{tr.coverage}: #{Mx[:fa_underscore_o]}#{@md.classify.coverage}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.classify.keywords \
- and @md.classify.keywords=~/\S+/
- s="\n#{tr.keywords}: #{Mx[:fa_underscore_o]}#{@md.classify.keywords}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- s="#{Mx[:fa_bold_o]}Version Information#{Mx[:fa_bold_c]}"
- meta << meta_para(s)
- if defined? @md.fns \
- and @md.fns=~/\S+/
- s="#{tr.sourcefile}: #{Mx[:fa_underscore_o]}#{@md.fns}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.file_encoding \
- and @md.file_encoding=~/\S+/
- s="Filetype: #{Mx[:fa_underscore_o]}#{@md.file_encoding}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.dgst \
- and @md.dgst.class==Array
- s="Source Digest: #{@md.dgst[0]} #{Mx[:fa_underscore_o]}#{@md.dgst[1]}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.dgst_skin \
- and @md.dgst_skin.class==Array
- s="Skin Digest: #{@md.dgst_skin[0]} #{Mx[:fa_underscore_o]}#{@md.dgst_skin[1]}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- s="#{Mx[:fa_bold_o]}Generated#{Mx[:fa_bold_c]}"
- meta << meta_para(s)
- s="#{tr.last_generated}: #{Mx[:fa_underscore_o]}#{Time.now}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- s="#{tr.sisu_version}: #{Mx[:fa_underscore_o]}#{@md.sisu_version[:project]}#{Mx[:fa_underscore_c]} #{Mx[:fa_underscore_o]}#{@md.sisu_version[:version]}#{Mx[:fa_underscore_c]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})"
- meta << meta_para(s)
- meta
- end
- def build_lines(type='')
- data=@data
- data.each do |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
- end
- elsif line =~/^\s*$/
- line.gsub!(/\s*$/,"#{Mx[:br_nl]}")
- end
- end
- data
- end
- end
- class Structure # this must happen early
- def initialize(md,dob)
- @md,@dob=md,dob
- end
- def structure
- structure_markup_normalize
- structure_markup
- @dob
- end
- def structure_markup #build structure where structure provided only in meta header
- @dob=if @dob.is =~/para/ \
- and @dob.indent !~/[1-9]/ \
- 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)
- when /^#{@md.lv2}/
- h={:lv=>'B',:ln=>2}
- SiSU_document_structure::Object_heading.new.heading(h,@dob)
- when /^#{@md.lv3}/
- h={:lv=>'C',:ln=>3}
- SiSU_document_structure::Object_heading.new.heading(h,@dob)
- when /^#{@md.lv4}/
- h={:lv=>'1',:ln=>4}
- SiSU_document_structure::Object_heading.new.heading(h,@dob)
- when /^#{@md.lv5}/
- h={:lv=>'2',:ln=>5}
- SiSU_document_structure::Object_heading.new.heading(h,@dob)
- when /^#{@md.lv6}/
- h={:lv=>'3',:ln=>6}
- SiSU_document_structure::Object_heading.new.heading(h,@dob)
- else @dob
- end
- else @dob
- end
- @dob
- 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=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
- else @dob
- end
- else @dob
- end
- 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
- else @t_o
- end
- end
- end
- class OCN
- def initialize(md,data)
- @md,@data=md,data
- end
- def ocn #and auto segment numbering increment
- data=@data
- @o_array=[]
- node=ocn=ocn_dv=ocn_sp=ocnh=ocnh1=ocnh2=ocnh3=ocnh4=ocnh5=ocnh6=ocno=ocnp=ocnt=ocnc=ocng=ocni=ocnm=ocnu=ocnk=nm=0 # h heading, o other, t table, g group, i image
- node_count_flag=false
- regex_exclude_ocn_and_node = /#{Rx[:meta]}|^@\S+?:\s|^4~endnotes|^#{Mx[:lv_o]}4:endnotes#{Mx[:lv_c]}|^\^~ |<:e[:_]\d+?>|^<:\#|<:- |<[:!]!4|<hr width|#{Mx[:br_endnotes]}|\A\s*\Z/mi #ocn here #&nbsp; added with Tune.code #¡
- parent=node1=node2=node3=node4=node5=node6=nil
- data.each do |dob|
- h={}
- if dob.obj !~ regex_exclude_ocn_and_node \
- and dob.of !~/(?:comment|layout|meta)/ \
- and dob.obj !~/#{Mx[:pa_non_object_no_heading]}|#{Mx[:pa_non_object_dummy_heading]}/ \
- and dob.ocn_
- #dob.ln now is determined, and set earlier, check how best to remove this -->
- if dob.is=='heading'
- ln=case dob.lv
- when 'A'; 1
- when 'B'; 2
- when 'C'; 3
- when '1'; 4
- when '2'; 5
- when '3'; 6
- when '4'; 7
- when '5'; 8
- when '6'; 9
- end
- end
- if not dob.obj =~/<:#>|~#|-#/ \
- or not dob.toc_ # fix this no longer in dob.obj
- ocn+=1
- if dob.is=='heading' \
- and (ln.to_s =~/^[1-9]/ \
- or ln.to_s =~@md.lv1 \
- or ln.to_s =~@md.lv2 \
- or ln.to_s =~@md.lv3 \
- or ln.to_s =~@md.lv4 \
- or ln.to_s =~@md.lv5 \
- or ln.to_s =~@md.lv6)
- ocnh+=1
- if ln==1 \
- or ln=~@md.lv1; ocnh1+=1 #heading
- node1="1:#{ocnh1};#{ocn}"
- node,ocn_sp,parent=node1,"h#{ocnh}",0 #FIX
- elsif ln==2 \
- or ln=~@md.lv2; ocnh2+=1
- node2="2:#{ocnh2};#{ocn}"
- node,ocn_sp,parent=node2,"h#{ocnh}",node1
- elsif ln==3 \
- or ln=~@md.lv3; ocnh3+=1
- node3="3:#{ocnh3};#{ocn}"
- node,ocn_sp,parent=node3,"h#{ocnh}",node2
- elsif ln==4 \
- or ln=~@md.lv4; ocnh4+=1
- node4="4:#{ocnh4};#{ocn}"
- node,ocn_sp,parent=node4,"h#{ocnh}",node3
- elsif ln==5 \
- or ln=~@md.lv5; ocnh5+=1
- node5="5:#{ocnh5};#{ocn}"
- node,ocn_sp,parent=node5,"h#{ocnh}",node4
- elsif ln==6 \
- or ln=~@md.lv6; ocnh6+=1
- node6="6:#{ocnh6};#{ocn}"
- node,ocn_sp,parent=node6,"h#{ocnh}",node5
- end
- else
- ocno+=1
- if dob.is=='table'
- ocnt+=1
- ocn_sp,parent="t#{ocnt}",node
- elsif dob.is=='code'
- ocnc+=1
- ocn_sp,parent="c#{ocnc}",node
- elsif dob.is=~/^(?:group|alt|verse)/
- ocng+=1 #group, poem
- ocn_sp,parent="g#{ocng}",node
- elsif dob.is=~/image|#{Mx[:lnk_o]}\S+?\.(?:png|jpg|gif)\s+/m
- ocni+=1
- ocn_sp,parent="i#{ocni}",node
- else ocnp+=1 #paragraph
- ocn_sp,parent="p#{ocnp}",node
- end
- end
- 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/
- 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
- 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'
- h={:obj=>dob.obj,:ocn_=>false,:ocn=>nil}
- dob=SiSU_document_structure::Object_para.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)
- end
- elsif dob.obj=~/#{Mx[:pa_non_object_dummy_heading]}/
- 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'
- h={:obj=>dob.obj,:ocn_=>false,:ocn=>nil,:toc_=>false}
- dob=SiSU_document_structure::Object_heading.new.heading(h,dob)
- end
- else dob
- end
- dob.obj.gsub!(/\n\n/,"\n") if dob.is =~/(?:code|verse|alt|group)/ #newlines taken out
- @o_array << dob
- end
- @o_array
- end
- end
- class XML
- def initialize(md,data)
- @data,@md=data,md
- end
- def dom
- @s=['0',
- 'A',
- 'B',
- 'C',
- '1',
- '2',
- '3'
- ]
- @sp=' '
- tuned_file=structure_build
- tuned_file
- end
- def structure_build
- data=@data
- tuned_file=[]
- hs=[0,false,false,false]
- t={:lv =>@s[0],:status =>'open'}
- tuned_file << tags(t)
- if @md.cmd =~/V/
- puts "\nXML sisu structure outline --->\n"
- puts "<#{@s[0]}>"
- end
- data.each_with_index do |o,i|
- if o.is =~/^heading/
- case o.ln
- when 1
- tuned_file << tag_close(o.ln,hs)
- tuned_file << tag_open(o,@s)
- if @md.cmd =~/V/
- puts_tag_close(o.ln,hs)
- puts_tag_open(o,@s)
- end
- hs=[1,true,false,false]
- when 2
- tuned_file << tag_close(o.ln,hs)
- tuned_file << tag_open(o,@s)
- if @md.cmd =~/V/
- puts_tag_close(o.ln,hs)
- puts_tag_open(o,@s)
- end
- hs=[2,true,true,false]
- when 3
- tuned_file << tag_close(o.ln,hs)
- tuned_file << tag_open(o,@s)
- if @md.cmd =~/V/
- puts_tag_close(o.ln,hs)
- puts_tag_open(o,@s)
- end
- hs=[3,true,true,true]
- when 4
- tuned_file << tag_close(o.ln,hs)
- tuned_file << tag_open(o,@s)
- if @md.cmd =~/V/
- puts_tag_close(o.ln,hs)
- puts_tag_open(o,@s)
- end
- hs[0]=4
- when 5
- tuned_file << tag_close(o.ln,hs)
- tuned_file << tag_open(o,@s)
- if @md.cmd =~/V/
- puts_tag_close(o.ln,hs)
- puts_tag_open(o,@s)
- end
- hs[0]=5
- when 6
- tuned_file << tag_close(o.ln,hs)
- tuned_file << tag_open(o,@s)
- if @md.cmd =~/V/
- puts_tag_close(o.ln,hs)
- puts_tag_open(o,@s)
- end
- hs[0]=6
- end
- end
- tuned_file << o
- end
- puts_tag_close(0,hs) if @md.cmd =~/V/
- tuned_file << tag_close(0,hs)
- tuned_file.flatten!
- tuned_file
- end
- def tags(o)
- tag=if o[:status]=='open'
- %{<#{o[:lv]} id="#{o[:node]}">}
- else "</#{o[:lv]}>"
- end
- ln=case o[:lv]
- when 'A'; 1
- when 'B'; 2
- when 'C'; 3
- when '1'; 4
- when '2'; 5
- when '3'; 6
- when '4'; 7
- when '5'; 8
- when '6'; 9
- 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
- end
- def tag_open(o,tag)
- t={:lv =>tag[o.ln],:node =>o.node,:status =>'open'}
- t_o=tags(t)
- t_o
- end
- def tag_close(lev,hs)
- ary=[]
- case hs[0]
- when 1
- if (lev <= 1) and hs[1]
- t={:lv =>@s[1],:status =>'close'}
- ary << tags(t)
- end
- if (lev==0)
- t={:lv =>@s[0],:status =>'close'}
- ary << tags(t)
- end
- when 2
- if (lev <= 2) and hs[2]
- t={:lv =>@s[2],:status =>'close'}
- ary << tags(t)
- end
- if (lev <= 1) and hs[1]
- t={:lv =>@s[1],:status =>'close'}
- ary << tags(t)
- end
- if (lev==0)
- t={:lv =>@s[0],:status =>'close'}
- ary << tags(t)
- end
- when 3
- if (lev <= 3) and hs[3]
- t={:lv =>@s[3],:status =>'close'}
- ary << tags(t)
- end
- if (lev <= 2) and hs[2]
- t={:lv =>@s[2],:status =>'close'}
- ary << tags(t)
- end
- if (lev <= 1) and hs[1]
- t={:lv =>@s[1],:status =>'close'}
- ary << tags(t)
- end
- if (lev==0)
- t={:lv =>@s[0],:status =>'close'}
- ary << tags(t)
- end
- when 4
- if (lev <= 4)
- t={:lv =>@s[4],:status =>'close'}
- ary << tags(t)
- end
- if (lev <= 3) and hs[3]
- t={:lv =>@s[3],:status =>'close'}
- ary << tags(t)
- end
- if (lev <= 2) and hs[2]
- t={:lv =>@s[2],:status =>'close'}
- ary << tags(t)
- end
- if (lev <= 1) and hs[1]
- t={:lv =>@s[1],:status =>'close'}
- ary << tags(t)
- end
- if (lev==0)
- t={:lv =>@s[0],:status =>'close'}
- ary << tags(t)
- end
- when 5
- if (lev <= 5)
- t={:lv =>@s[5],:status =>'close'}
- ary << tags(t)
- end
- if (lev <= 4)
- t={:lv =>@s[4],:status =>'close'}
- ary << tags(t)
- end
- if (lev <= 3) and hs[3]
- t={:lv =>@s[3],:status =>'close'}
- ary << tags(t)
- end
- if (lev <= 2) and hs[2]
- t={:lv =>@s[2],:status =>'close'}
- ary << tags(t)
- end
- if (lev <= 1) and hs[1]
- t={:lv =>@s[1],:status =>'close'}
- ary << tags(t)
- end
- if (lev==0)
- t={:lv =>@s[0],:status =>'close'}
- ary << tags(t)
- end
- when 6
- if (lev <= 6)
- t={:lv =>@s[6],:status =>'close'}
- ary << tags(t)
- end
- if (lev <= 5)
- t={:lv =>@s[5],:status =>'close'}
- ary << tags(t)
- end
- if (lev <= 4)
- t={:lv =>@s[4],:status =>'close'}
- ary << tags(t)
- end
- if (lev <= 3) and hs[3]
- t={:lv =>@s[3],:status =>'close'}
- ary << tags(t)
- end
- if (lev <= 2) and hs[2]
- t={:lv =>@s[2],:status =>'close'}
- ary << tags(t)
- end
- if (lev <= 1) and hs[1]
- t={:lv =>@s[1],:status =>'close'}
- ary << tags(t)
- end
- if (lev==0)
- t={:lv =>@s[0],:status =>'close'}
- ary << tags(t)
- end
- end
- ary
- end
- def puts_tag_open(o,tag)
- puts %{#{@sp*o.ln}<#{tag[o.ln]} id="#{o.node}">}
- end
- def puts_tag_close(lev,hs)
- case hs[0]
- when 1
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
- puts "</#{@s[0]}>" if (lev==0)
- when 2
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
- puts "</#{@s[0]}>" if (lev==0)
- when 3
- puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) and hs[3]
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
- puts "</#{@s[0]}>" if (lev==0)
- when 4
- puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4)
- puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) and hs[3]
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
- puts "</#{@s[0]}>" if (lev==0)
- when 5
- puts "#{@sp*5}</#{@s[5]}>" if (lev <= 5)
- puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4)
- puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) and hs[3]
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
- puts "</#{@s[0]}>" if (lev==0)
- when 6
- puts "#{@sp*6}</#{@s[6]}>" if (lev <= 6)
- puts "#{@sp*5}</#{@s[5]}>" if (lev <= 5)
- puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4)
- puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) and hs[3]
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
- puts "</#{@s[0]}>" if (lev==0)
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/v2/dal_expand_insertions.rb b/lib/sisu/v2/dal_expand_insertions.rb
deleted file mode 100644
index f7adb76..0000000
--- a/lib/sisu/v2/dal_expand_insertions.rb
+++ /dev/null
@@ -1,198 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/copyleft/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: system environment, resource control and configuration details
-
-=end
-module SiSU_insertions
- class Insertions
- def initialize(md,data)
- @md,@data=md,data
- end
- def output_filetypes_in_cmd(cmd_shortcut,source=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
- cmd_list=case cmd_shortcut.inspect
- when /0/; cf_defaults.cf_0
- when /1/; cf_defaults.cf_1
- when /2/; cf_defaults.cf_2
- when /3/; cf_defaults.cf_3
- when /4/; cf_defaults.cf_4
- when /5/; cf_defaults.cf_5
- end
- file_type_names={}
- file_type_names[:gen],file_type_names[:src]=[],[]
- file_type_names[:gen] <<= if cmd_list =~ /y/; 'sisu_manifest.html'
- end
- file_type_names[:gen] <<= if cmd_list =~ /h/; ['toc.html', 'doc.html']
- end
- file_type_names[:gen] <<= if cmd_list =~ /e/; ['.epub']
- end
- file_type_names[:gen] <<= if cmd_list =~ /p/; ['landscape.pdf', 'portrait.pdf']
- end
- file_type_names[:gen] <<= if cmd_list =~ /o/; 'opendocument.odt'
- end
- file_type_names[:gen] <<= if cmd_list =~ /b/; 'scroll.xhtml'
- end
- file_type_names[:gen] <<= if cmd_list =~ /x/; 'sax.xml'
- end
- file_type_names[:gen] <<= if cmd_list =~ /X/; 'dom.xml'
- end
- file_type_names[:gen] <<= if cmd_list =~ /a/; 'plain.txt'
- end
- file_type_names[:gen] <<= if cmd_list =~ /g/; 'wiki.txt'
- end
- file_type_names[:gen] <<= if cmd_list =~ /w/; 'concordance.html'
- end
- file_type_names[:gen] <<= if cmd_list =~ /N/; 'digest.txt'
- end
- file_type_names[:src] <<= if source and cmd_shortcut =~ /s/; source
- end
- file_type_names[:src] <<= if cmd_shortcut =~ /S/; "#{source}.zip"
- end
- file_type_names[:gen]=file_type_names[:gen].flatten
- file_type_names[:src]=file_type_names[:src].flatten
- file_type_names
- end
- def expand_insertions?
- data=@data
- tuned_file,tuned_file_tmp=[],[]
- data.each do |para|
- if para !~/^%+\s/ \
- and para =~/\{(?:~\^\s+)?(.+?)\s\[(?:\d(?:[sS]*))\]\}(?:\.\.\/\S+?\/|\S+?\.ss[tm]\b)/
- txt,cmd,source,url_dir,note,manifest=nil,nil,nil,nil,nil,nil
- @u=SiSU_Env::Info_env.new.url
- if defined? @u.remote
- if para =~/(.+?)\{(.+?)\s\[(\d[sS]*)\]\}((\S+?)\.ss[tm]\b)(.*)/m
- pre,txt,cmd,source,url_dir,note="#{$1.strip} ",$2,$3,$4,$5,$6
- elsif para =~/\{(.+?)\s\[(\d[sS]*)\]\}((\S+?)\.ss[tm]\b)(.*)/
- pre,txt,cmd,source,url_dir,note='',$1,$2,$3,$4,$5
- end
- manifest="#{pre}{#{txt} }#{@u.remote}/#{url_dir}/toc.html#{note}\n\n"
- 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__}"
- if para =~/\{(?:~\^\s+)?(.+?)\s\[(\d[sS]*)\]\}\.\.\/(\S+?)\/(\s+#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]})?/
- txt,cmd,url_dir,note=$1,$2,$3,$4
- manifest="{ #{txt} }../#{url_dir}/toc.html#{note}\n\n"
- end
- end
- tuned_file_tmp << manifest
- output_filetypes=output_filetypes_in_cmd(cmd,source)
- output_filetypes[:gen].each do |o_f|
- describe = case o_f
- when /sisu_manifest.html/; '~^ document manifest'
- when /toc.html/; ' html, segmented text'
- when /doc.html/; ' html, scroll, document in one'
- when /\.epub/; ' epub'
- when /landscape.pdf/; ' pdf, landscape'
- when /portrait.pdf/; ' pdf, portrait'
- when /opendocument.odt/; ' odf:odt, open document text'
- when /scroll.xhtml/; ' xhtml scroll'
- when /sax.xml/; ' xml, sax'
- when /dom.xml/; ' xml, dom'
- when /plain.txt/; ' plain text utf-8'
- #when /manpage.1/; ' man, 1'
- when /wiki.txt/; ' wiki text'
- when /concordance.html/; ' concordance'
- when /digest.txt/; ' dcc, document content certificate (digests)'
- else nil
- end
- if describe
- tuned_file_tmp << if @u.remote #to double space <:br> at beginning of entry
- if describe =~/epub/
- "#{Mx[:nbsp]*4} { #{describe} }#{@u.remote}/epub/#{url_dir}#{o_f} "
- elsif describe =~/^~\^ /
- "#{Mx[:nbsp]*4} {#{describe} }#{@u.remote}/#{url_dir}/#{o_f} "
- else "#{Mx[:nbsp]*4} { #{describe} }#{@u.remote}/#{url_dir}/#{o_f} "
- end
- else
- if describe =~/epub/
- "#{Mx[:nbsp]*4} { #{describe} }../epub/#{url_dir}#{o_f} "
- elsif describe =~/^~\^ /
- "#{Mx[:nbsp]*4} {#{describe} }../#{url_dir}/#{o_f} "
- else "#{Mx[:nbsp]*4} { #{describe} }../#{url_dir}/#{o_f} "
- end
- end
- end
- end
- output_filetypes[:src].each do |o_f|
- describe=case o_f
- when /#{source}\.zip/; ' markup source (zipped) pod'
- when /#{source}/; ' markup source text'
- else nil
- end
- if describe
- tuned_file_tmp << if @u.remote
- x=if describe =~/zip/
- "#{Mx[:nbsp]*4} {#{describe} }#{@u.src_pod}/#{o_f} "
- else "#{Mx[:nbsp]*4} {#{describe} }#{@u.src_txt}/#{o_f} "
- end
- else
- x=if describe =~/zip/
- "#{Mx[:nbsp]*4} { #{describe} }../pod/#{o_f} "
- else "#{Mx[:nbsp]*4} { #{describe} }../zip/#{o_f} "
- end
- end
- end
- end
- tuned_file << 'group{' << tuned_file_tmp.join("\n") << '}group'
- tuned_file_tmp=[]
- else tuned_file << para
- end
- end
- tuned_file
- end
- end
-end
-__END__
diff --git a/lib/sisu/v2/dal_syntax.rb b/lib/sisu/v2/dal_syntax.rb
deleted file mode 100644
index 35505d1..0000000
--- a/lib/sisu/v2/dal_syntax.rb
+++ /dev/null
@@ -1,522 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: Syntax for markup, input markup syntaxes, determined here
-
-=end
-module SiSU_Syntax
- class Words
- def initialize(line,md,mkp)
- @line,@md,@mkp=line,md,mkp
- end
- end
- class Markup
- def initialize(md='',data='')
- @data,@md=data,md
- @vz=SiSU_Env::Get_init.instance.skin
- @data_new=[]
- url_and_stub=SiSU_Env::Info_env.new.url
- @output_url="#{url_and_stub.remote}"
- @env=SiSU_Env::Info_env.new
- emph_set=if defined? @md.make.emphasis \
- and not @md.make.emphasis.nil?
- @md.make.emphasis
- else @env.markup_emphasis
- end
- @emph=case emph_set
- when /bold/
- emph_italics=false
- {:o =>Mx[:fa_bold_o], :c =>Mx[:fa_bold_c] }
- when /italics/
- emph_italics=true
- {:o =>Mx[:fa_italics_o], :c =>Mx[:fa_italics_c] }
- when /underscore/
- emph_italics=false
- {:o =>Mx[:fa_underscore_o], :c =>Mx[:fa_underscore_c] }
- else p __LINE__.to_s + '::' + __FILE__
- end
- @http_m=%r{\{.+?\}https?://\S+|https?:\S+|:\S+|\.\.\/\S+|#\S+|\S+?\.png\b|[*]~\S+|^#{Mx[:meta_o]}.+|#{Mx[:gr_o]}(?:code|group|alt|verse)(?:-end)?#{Mx[:gr_c]}|#{Mx[:fa_o]}:br#{Mx[:fa_c]}}
- @manmkp_ital=emph_italics \
- ? '[i/*]\\{.+?\\}[i/*]' \
- : '[i/]\\{.+?\\}[i/]'
- tail_m_ital=%q{(?:\s|[.,;:?!'")]|~\^|~\\\{\s|$)}
- tail_m_bold=%{(?:(?:#{Mx[:fa_italics_c]})?(?:\s|[.,;:?!'")]|~\^|~\\\{\s|$))?}
- bold_line=%{^!_\s.+?(?:#{Mx[:br_line]}|\n|$)}
- ital_line=%{^/_\s.+?(?:#{Mx[:br_line]}|\n|$)}
- @line_scan_ital=if defined? @md.make.italics[:str] \
- and defined? @vz.markup_make_italic[:str]
- /#{@http_m}|#{bold_line}|#{@manmkp_ital}#{tail_m_ital}|(?:#{@md.make.italics[:str]}|#{@vz.markup_make_italic[:str]})#{tail_m_ital}|\S+|\n/
- elsif defined? @md.make.italics[:str]
- /#{@http_m}|#{bold_line}|#{@manmkp_ital}#{tail_m_ital}|#{@md.make.italics[:str]}#{tail_m_ital}|\S+|\n/
- elsif defined? @vz.markup_make_italic[:str]
- /#{@http_m}|#{bold_line}|#{@manmkp_ital}#{tail_m_ital}|#{@vz.markup_make_italic[:str]}#{tail_m_ital}|\S+|\n/
- end
- @manmkp_bold=emph_italics \
- ? '^!_\s.+?(?:\n|$)|[!b]\\{.+?\\}[*!b]|[*!][a-zA-Z0-9\-_]+[!]' \
- : '^!_\s.+?(?:\n|$)|[*!b]\\{.+?\\}[*!b]|[*!][a-zA-Z0-9\-_]+[*!]'
- @line_scan_bold=if (defined? @md.make.bold[:str] \
- and @md.make.bold[:str]) \
- and (defined? @vz.markup_make_bold[:str] \
- and @vz.markup_make_bold[:str])
- /#{@http_m}|#{bold_line}|(?:#{@manmkp_bold}|#{@md.make.bold[:str]}|#{@vz.markup_make_bold[:str]})#{tail_m_bold}|\S+|\n/
- elsif defined? @md.make.bold[:str] \
- and @md.make.bold[:str]
- /#{@http_m}|#{bold_line}|(?:#{@manmkp_bold}|#{@md.make.bold[:str]})#{tail_m_bold}|\S+|\n/
- elsif defined? @vz.markup_make_bold[:str] \
- and @vz.markup_make_bold[:str]
- /#{@http_m}|#{bold_line}|(?:#{@manmkp_bold}|#{@vz.markup_make_bold[:str]})#{tail_m_bold}|\S+|\n/
- end
- end
- def songsheet
- @data.compact!
- @data.each do |dob|
- dob=breaks(dob)
- dob=if @md.sem_tag then sem(dob) else dob end #revisit
- dob=wordlist_italics(dob)
- dob=wordlist_bold(dob)
- dob=bodymarkup(dob)
- @data_new << dob unless dob.nil?
- end
- @data_new
- end
- def sem(dob) #revisit
- 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>|<br \/>)/,"#{Mx[:br_line]}") # depreciated
- end
- dob
- end
- def wordlist_italics(dob)
- dob=dob.dup
- if (defined? @md.make.italics[:str] \
- 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)/
- word=dob.obj.scan(@line_scan_ital)
- word.flatten!
- word.compact! #reinstated
- 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],
- "#{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,
- "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}")
- else w
- end
- end
- line_array << w
- end
- line_array.join(' ')
- else dob.obj
- end
- end
- 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]}")
- 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]}")
- end
- def wordlist_bold(dob)
- dob=dob.dup
- if (defined? @md.make.bold[:str] \
- 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)/
- line_array=[]
- word=dob.obj.scan(@line_scan_bold)
- word.flatten!
- word.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]}")
- 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]}")
- 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!
- elsif w =~/^\/_\s+/; italicise(w)
- else w
- end
- end
- line_array << w
- end
- line_array.join(' ')
- else dob.obj
- end
- else
- if dob.is !~/^(?:heading|comment|meta)/ \
- and dob.obj =~ /^!_\s+/
- embolden(dob.obj)
- elsif dob.is=='heading' \
- and dob.ln.to_s =~/[7-9]/
- embolden(dob.obj)
- end
- if dob.obj =~ /\/_\s+/
- 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
- end
- def bodymarkup(dob)
- # << http://www.jus.uio.no/sisu/sisu_markup_table/markup >>
- # See: data/sisu/sample/document_samples_sisu_markup/
- ## fontface
- # *{emphasis}* e{emphasis}e <strong>emphasis</strong>
- # !{bold text}! b{bold}b <b>bold text</b>
- # _{underline}_ u{underline}u <u>underline</u>
- # /{italics}/ i{italics}i <i>italics</i>
- # "{citation}" c{citation}c <cite>citation</cite> #blockquote?
- # ^{superscript}^ <sup>superscript</sup>
- # ,{subscript}, <sub>subscript</sub>
- # +{inserted text}+ <ins>inserted text</ins>
- # -{deleted text}- <del>deleted text</del>
- # #{monospace text}#
- #
- # {url address}:url
- # {image.png}imageurl
- # {image.png}png
- # ~{endnote}~ <!e endnote !>
- # !_ #bold/emphasise paragraph
- # _" #blockquote paragraph
- # _1 <:i1> #indent paragraph 1 step
- # _2 <:i2> #indent paragraph 2 steps
- # _3 <:i3> #indent paragraph 3 steps
- # _4 <:i4> #indent paragraph 4 steps
- # _* #bullet (list) ●
- # _1* #bullet (list) indented
- # _1* #bullet (list) indented
- # # #numbered (list) level 1
- # _# #numbered (list) level 2
- dob=dob.dup
- if dob.is !~/^(?:meta|comment|code|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
- 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
- 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' \
- and dob.ln ==1
- dob.obj.gsub!(/\s*@title\b/," #{@md.title.full}")
- 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)/,'')
- end
- end
- if dob.is =='heading'
- dob.obj.gsub!(/^\s*@title\s*$/,@md.title.full) if dob.lv =~/1/ #
- 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')
- end
- end
- dob.obj.gsub!(/<(https?:\/\/\S+?)>/,'< \1 >') #catch problem markup
- dob.obj.gsub!(/<:=(\S+?)>/,'{ c_\1.png 14x14 }http://www.jus.uio.no/sisu') #adjustment 2005w30
- dob.obj.gsub!(/<!(\S+)!>/,'<:\1>') #escaped special character
- dob.obj.gsub!(/&nbsp;/,"#{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]}#lt#{Mx[:gl_c]}#{Mx[:gl_o]}#lt#{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]}#lt#{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]}") #&amp; #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
- 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,
- "\\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,
- "\\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})
- 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,
- %{\\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#{Mx[:pa_c]}#{Mx[:gl_bullet]}") #bullets, shortcut
- dob.obj.gsub!(/^\s*_([1-9])\s+/,
- "#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}") #indent
- dob.obj.gsub!(/<:hi>/,"#{Mx[:fa_hilite_o]}") #'<span style="background-color: rgb(255,240,196)">') # bright yellow rgb(255,255,0) pale yellow rgb(255,255,200)
- dob.obj.gsub!(/<:\/hi>/,"#{Mx[:fa_hilite_c]}") #'</span>')
- 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=fontface(dob)
- elsif dob.is =='code'
- dob.obj.gsub!(/#{Mx[:meta_o]}(\S+?)#{Mx[:meta_c]}\s*/,'@\1: ')
- dob.obj.gsub!(/([<>])/,'_\1')
- dob.obj.gsub!(/_<:(\S+?)_>/,'<:\1>') #convert <:\S+> back, clumsy
- dob.obj.gsub!(/_<(br(?: \/)?)_>/,'<\1>') #convert <br> <br /> back, clumsy
- dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s)&lt;(br(?: \/)?)&gt;([\s,.]|$)/,'\1<\2>\3') #convert <br> <br /> back, clumsy
- if dob.number_
- codeline=[]
- ln=1
- dob.obj.split(/#{Mx[:gr_o]}codeline#{Mx[:gr_c]}|<br(?: \/)?>|\n/).each_with_index do |cl,i|
- unless i == 0
- cl.gsub!(Mx[:br_nl],'')
- w=3-ln.to_s.length
- cl = "#{ln}#{Mx[:nbsp]*w}#{Mx[:vline]}#{Mx[:nbsp]}#{Mx[:nbsp]}#{cl}#{Mx[:br_nl]}"
- ln +=1
- end
- codeline << cl
- end
- codeline= codeline.join("")
- dob.obj=codeline
- else
- dob.obj.gsub!(/#{Mx[:gr_o]}codeline#{Mx[:gr_c]}/,
- "\n#{Mx[:nbsp]}#{Mx[:nbsp]}") #temporary fix, prefer: #line.gsub!(/<:codeline>/,"\n")
- end
- dob
- else # @\S+?:
- end
- dob
- end
- def tech #script markup planned to be more strict for technical documents
- # *{emphasis}* e{emphasis}e <strong>emphasis</strong>
- # !{bold text}! b{bold}b <b>bold text</b>
- # _{underline}_ u{underline}u <u>underline</u>
- # /{italics}/ i{italics}i <i>italics</i>
- # "{citation}" c{citation}c <cite>citation</cite>
- # ^{superscript}^ <sup>superscript</sup>
- # ,{subscript}, <sub>subscript</sub>
- # +{inserted text}+ <ins>inserted text</ins>
- # -{deleted text}- <del>deleted text</del>
- # #{monospace text}#
- # {url address}:url
- # {image.png}imageurl
- # {image.png}png
- # ~{endnote}~ <!e endnote !>
- # +1 <!i1!>
- # +2 <!i2!>
- 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]}")
- line.gsub!(/#{Mx[:br_line]}\s*_[12]\s+/,
- "#{Mx[:br_line]} ") #indent used in endnotes, not implemented, replace when ready with: line.gsub!(/(?:<br>|<br \/>)\s*_([12])\s+/,'<br><:i\1> ')
- end
- @data
- end
- end
-end
-__END__
diff --git a/lib/sisu/v2/db_dbi.rb b/lib/sisu/v2/db_dbi.rb
deleted file mode 100644
index 1a3825b..0000000
--- a/lib/sisu/v2/db_dbi.rb
+++ /dev/null
@@ -1,93 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: modules shared by the different db types, dbi, postgresql,
- sqlite
-
-=end
-module SiSU_DB_DBI
- require "#{SiSU_lib}/db_columns" # db_columns.rb
- require "#{SiSU_lib}/db_tests" # db_tests.rb
- require "#{SiSU_lib}/db_create" # db_create.rb
- require "#{SiSU_lib}/db_select" # db_select.rb
- require "#{SiSU_lib}/db_indexes" # db_indexes.rb
- require "#{SiSU_lib}/db_drop" # db_drop.rb
- require "#{SiSU_lib}/db_remove" # db_remove.rb
- require "#{SiSU_lib}/db_load_tuple" # db_load_tuple.rb
- require "#{SiSU_lib}/db_import" # db_import.rb
- class Column_size < SiSU_DB_columns::Column_size # db_columns.rb
- end
- class Test < SiSU_DB_tests::Test # db_tests.rb
- end
- class Create <SiSU_DB_create::Create # db_create.rb
- end
- class Case <SiSU_DB_select::Case # db_select.rb
- end
- class Index <SiSU_DB_index::Index # db_indexes.rb
- end
- class Drop <SiSU_DB_drop::Drop # db_drop.rb
- end
- class Remove <SiSU_DB_remove::Remove # db_remove.rb
- end
- class Load_documents <SiSU_DB_tuple::Load_documents # db_load_tuple.rb
- end
- class Load_metadata <SiSU_DB_tuple::Load_metadata # db_load_tuple.rb
- end
- class Load_urls <SiSU_DB_tuple::Load_urls # db_update urls
- end
- class Import <SiSU_DB_import::Import #<SiSU_DB::Column_size # db_import.rb
- end
-end
-__END__
diff --git a/lib/sisu/v2/epub_tune.rb b/lib/sisu/v2/epub_tune.rb
deleted file mode 100644
index 9c9223a..0000000
--- a/lib/sisu/v2/epub_tune.rb
+++ /dev/null
@@ -1,416 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: epub generation, epub pre-processing
-
-=end
-require "#{SiSU_lib}/param"
-module SiSU_EPUB_Tune
- require "#{SiSU_lib}/sysenv" # sysenv.rb
- include SiSU_Env; include SiSU_Screen
- require "#{SiSU_lib}/epub_format" # epub_format.rb #watch
- @@line_mode=''
- @@endnote_array=[]
- @@endnote_call_counter=1
- @@table_align='<table summary='' width="96%" border="0" bgcolor="white" cellpadding="0" col="3">
-<tr ...><td width="2%" align="right">
-&nbsp\;</td>
-<td width="94%" valign="top" align="justify">'
- @@table_align_close='</td>
-<td width="4%" align="right" valign="top">
-<font size="1" color="#777777">
-&nbsp;&nbsp;&nbsp;</font> </td></tr></table>'
- @@counter,@@column,@columns=0,0,0
- class Output
- def initialize(data,md)
- @data,@md=data,md
- @cX=SiSU_Screen::Ansi.new(@md.cmd).cX
- end
- def hard_output
- my_make=SiSU_Env::Create_file.new(@md.cmd,@md.fns)
- @filename_tune=my_make.file_tune
- data=[]
- @data.each{|x| x.obj.strip; data << x if not x.obj.empty?} #1.9 array?
- data.each do |dob|
- @filename_tune.puts dob, "\n" #check
- end
- end
- def marshal
- my_make=SiSU_Env::Create_file.new(@md.cmd,@md.fns)
- @marshal_tune=my_make.marshal_tune
- File.open(@marshal_tune,'w') {|f| Marshal.dump(@data.to_a,f)}
- end
- end
- class Clean_xhtml
- def initialize(html='')
- @html=html
- end
- def clean
- html=@html
- str=if html.class==String
- 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,'&#042;') # &#042;
- str.gsub!(/\+/u,'&#043;') # &#043;
- str.gsub!(/¢/u,'&cent;') # &#162;
- str.gsub!(/£/u,'&pound;') # &#163;
- str.gsub!(/¥/u,'&yen;') # &#165;
- str.gsub!(/§/u,'&sect;') # &#167;
- str.gsub!(/©/u,'&copy;') # &#169;
- str.gsub!(/ª/u,'&ordf;') # &#170;
- str.gsub!(/«/u,'&laquo;') # &#171;
- str.gsub!(/®/u,'&reg;') # &#174;
- str.gsub!(/°/u,'&deg;') # &#176;
- str.gsub!(/±/u,'&plusmn;') # &#177;
- str.gsub!(/²/u,'&sup2;') # &#178;
- str.gsub!(/³/u,'&sup3;') # &#179;
- str.gsub!(/µ/u,'&micro;') # &#181;
- str.gsub!(/¶/u,'&para;') # &#182;
- str.gsub!(/¹/u,'&sup1;') # &#185;
- str.gsub!(/º/u,'&ordm;') # &#186;
- str.gsub!(/»/u,'&raquo;') # &#187;
- str.gsub!(/¼/u,'&frac14;') # &#188;
- str.gsub!(/½/u,'&frac12;') # &#189;
- str.gsub!(/¾/u,'&frac34;') # &#190;
- str.gsub!(/×/u,'&times;') # &#215;
- str.gsub!(/÷/u,'&divide;') # &#247;
- str.gsub!(/¿/u,'&iquest;') # &#191;
- str.gsub!(/À/u,'&Agrave;') # &#192;
- str.gsub!(/Á/u,'&Aacute;') # &#193;
- str.gsub!(/Â/u,'&Acirc;') # &#194;
- str.gsub!(/Ã/u,'&Atilde;') # &#195;
- str.gsub!(/Ä/u,'&Auml;') # &#196;
- str.gsub!(/Å/u,'&Aring;') # &#197;
- str.gsub!(/Æ/u,'&AElig;') # &#198;
- str.gsub!(/Ç/u,'&Ccedil;') # &#199;
- str.gsub!(/È/u,'&Egrave;') # &#200;
- str.gsub!(/É/u,'&Eacute;') # &#201;
- str.gsub!(/Ê/u,'&Ecirc;') # &#202;
- str.gsub!(/Ë/u,'&Euml;') # &#203;
- str.gsub!(/Ì/u,'&Igrave;') # &#204;
- str.gsub!(/Í/u,'&Iacute;') # &#205;
- str.gsub!(/Î/u,'&Icirc;') # &#206;
- str.gsub!(/Ï/u,'&Iuml;') # &#207;
- str.gsub!(/Ð/u,'&ETH;') # &#208;
- str.gsub!(/Ñ/u,'&Ntilde;') # &#209;
- str.gsub!(/Ò/u,'&Ograve;') # &#210;
- str.gsub!(/Ó/u,'&Oacute;') # &#211;
- str.gsub!(/Ô/u,'&Ocirc;') # &#212;
- str.gsub!(/Õ/u,'&Otilde;') # &#213;
- str.gsub!(/Ö/u,'&Ouml;') # &#214;
- str.gsub!(/Ø/u,'&Oslash;') # &#216;
- str.gsub!(/Ù/u,'&Ugrave;') # &#217;
- str.gsub!(/Ú/u,'&Uacute;') # &#218;
- str.gsub!(/Û/u,'&Ucirc;') # &#219;
- str.gsub!(/Ü/u,'&Uuml;') # &#220;
- str.gsub!(/Ý/u,'&Yacute;') # &#221;
- str.gsub!(/Þ/u,'&THORN;') # &#222;
- str.gsub!(/ß/u,'&szlig;') # &#223;
- str.gsub!(/à/u,'&agrave;') # &#224;
- str.gsub!(/á/u,'&aacute;') # &#225;
- str.gsub!(/â/u,'&acirc;') # &#226;
- str.gsub!(/ã/u,'&atilde;') # &#227;
- str.gsub!(/ä/u,'&auml;') # &#228;
- str.gsub!(/å/u,'&aring;') # &#229;
- str.gsub!(/æ/u,'&aelig;') # &#230;
- str.gsub!(/ç/u,'&ccedil;') # &#231;
- str.gsub!(/è/u,'&egrave;') # &#232;
- str.gsub!(/é/u,'&eacute;') # &#233;
- str.gsub!(/ê/u,'&ecirc;') # &#234;
- str.gsub!(/ë/u,'&euml;') # &#235;
- str.gsub!(/ì/u,'&igrave;') # &#236;
- str.gsub!(/í/u,'&iacute;') # &#237;
- str.gsub!(/î/u,'&icirc;') # &#238;
- str.gsub!(/ï/u,'&iuml;') # &#239;
- str.gsub!(/ð/u,'&eth;') # &#240;
- str.gsub!(/ñ/u,'&ntilde;') # &#241;
- str.gsub!(/ò/u,'&ograve;') # &#242;
- str.gsub!(/ó/u,'&oacute;') # &#243;
- str.gsub!(/ô/u,'&ocirc;') # &#244;
- str.gsub!(/õ/u,'&otilde;') # &#245;
- str.gsub!(/ö/u,'&ouml;') # &#246;
- str.gsub!(/ø/u,'&oslash;') # &#248;
- str.gsub!(/ù/u,'&ugrave;') # &#250;
- str.gsub!(/ú/u,'&uacute;') # &#251;
- str.gsub!(/û/u,'&ucirc;') # &#252;
- str.gsub!(/ü/u,'&uuml;') # &#253;
- str.gsub!(/þ/u,'&thorn;') # &#254;
- str.gsub!(/ÿ/u,'&yuml;') # &#255;
- str.gsub!(/ý/u,'&yacute;')
- str.gsub!(/<br>/u,'<br />')
- str.gsub(/#{Mx[:nbsp]}/u,'&nbsp;')
- str
- 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)
- @brace_url=SiSU_Viz::Skin.new.url_decoration
- end
- def songsheet
- begin
- @cX=SiSU_Screen::Ansi.new(@md.cmd).cX
- SiSU_Screen::Ansi.new(@md.cmd,'Tune').txt_grey if @md.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
- if @md.cmd =~/M/ #Hard Output Tune Optional on/off here
- data=Output.new(data,@md).hard_output
- Output.new(data,@md).marshal
- end
- tuned=Tune.new(@data,@md).output
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.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.&nbsp;') #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]}/,'<br />') unless dob.is=='table'
- dob.obj.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>')
- dob.obj.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>')
- dob.obj.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>')
- dob.obj.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>')
- dob.obj.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>')
- dob.obj.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'<ins>\1</ins>')
- dob.obj.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>')
- dob.obj.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>')
- dob.obj.gsub!(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>') # tt, kbd
- dob.obj.gsub!(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'')
- dob.obj.gsub!(/^#{Mx[:gl_bullet]}/m,'●&nbsp;&nbsp;')
- dob.obj.gsub!(/#{Mx[:nbsp]}/,'&nbsp;')
- dob.obj.gsub!(/<(p|br)>/,'<\1 />')
- dob=SiSU_EPUB_Tune::Clean_xhtml.new(dob).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
- 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
- if word =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/
- m,u=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/.match(word).captures
- elsif word =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/
- http_=false
- m,u=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}(\S+?)#{Mx[:rel_c]}/.match(word).captures
- elsif word =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}image/
- m,u=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}(image)/.match(word).captures
- end
- case m
- when /\.png|\.jpg|\.gif|c=|\s\d+x\d+/
- w,h=/\s(\d+)x(\d+)/.match(m).captures if m =~/\s\d+x\d+/
- w=%{width="#{w}"} if w
- h=%{height="#{h}"} if h
- c=m[/"(.+?)"/m,1]
- caption=%{<br /><p class="caption">#{c}</p>} if c
- png=m.scan(/\S+/)[0]
- image_path='./image'
- ins=if u \
- and u.strip !~/^image$/
- %{<a href="#{u}"><img src="#{@env.url.images_epub}/#{png}" #{w} #{h} naturalsizeflag="0" align="bottom" border="0" /></a>#{caption}}
- else %{<img src="#{@env.url.images_epub}/#{png}" #{w} #{h} naturalsizeflag="0" align="bottom" border="0" />#{caption}}
- end
- 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
- 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_
- end
- elsif u =~/^:/
- u.gsub!(/^:/,"#{@env.url.root}/")
- elsif u =~/^\.\.\//
- u.gsub!(/^\.\.\//,"#{@env.url.root}/")
- elsif u =~/https?:\/\//
- else p "NOT FOUND name_tags: #{u}"
- end
- ins=%{<a href="#{u}">#{link}</a>}
- 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)
- end
- word
- else word
- end
- word
- end
- @words=@words.join(' ')
- end
- def url_markup
- data=@data
- @tuned_file=[]
- data.each do |dob|
- unless dob.is=='code'
- if dob.obj =~/<::\s+/ #watch
- dob.obj.gsub!(/<::\s+(\S+?)\s+!>/,
- %{<img src="#{@env.url.images_epub}/c_\\1.png" alt="\\1" width="14" height="14" align="bottom" border="0" />})
- end
- if dob.obj =~/<:image\s+/
- dob.obj.gsub!(/<:image\s+(http\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+>/,
- %{<a href="\\1"><img src="#{@env.url.images_epub}/\\2" \\3 \\4 naturalsizeflag="0" align="bottom" border="0" /></a>})
- dob.obj.gsub!(/<:image\s+(http\S+)\s+(\S+)\s+>/,
- %{<a href="\\1"><img src="#{@env.url.images_epub}/\\2" naturalsizeflag="0" align="bottom" border="0" /></a>})
- dob.obj.gsub!(/<:image\s+(\S+)\s+(\S+)\s+(\S+)\s+>/,
- %{<img src="#{@env.url.images_epub}/\\1" \\2 \\3 naturalsizeflag="0" align="bottom" border="0" />})
- dob.obj.gsub!(/<:image\s+(\S+)\s+>/,
- %{<img src="#{@env.url.images_epub}/\\1" naturalsizeflag="0" align="bottom" border="0" />})
- 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)
- end
- dob.obj.gsub!(/\\copyright/i,%{<sup>&copy;</sup>})
- if (dob.obj !~/\<:ad\s+\.\.\//)
- dob.obj.gsub!(/\<:ad\s+(\S+)?\s+(\S+\.png)\s+(.+)?\;\s+(.+)?\;\s*!\>/,
- %{\n<center><a href="http:\/\/\\1" target="external"><img src="#{@env.url.images_epub}/\\2" alt="\\3" /></a></center>\n})
- else
- dob.obj.gsub!(/\<:ad\s+(\S+)?\s+(\S+\.png)\s+(.+)?\;\s+(.+)?\;\s*\>/,
- %{\n<center><a href="\\1" target="_top"><img src="#{@env.url.images_epub}/\\2" alt="\\3" /></a></center>\n})
- end
- dob.obj.gsub!(/!pick/,%{<img border="0" height="15" width="15" src="#{@env.url.images_epub}/#{@vz.icon_choice}" alt="stellar" />})
- dob.obj.gsub!(/!new/,%{&nbsp;<img border="0" height="15" width="15" src="#{@env.url.images_epub}/#{@vz.icon_new}" alt="new" />})
- dob.obj.gsub!(/<:h(.{1,7}?)>/,'<a href="#h\1">\1</a>')
- dob.obj.gsub!(/<:to(\d{1,7}?)>/,'<a href="#to\1">to&nbsp;{&nbsp;\1&nbsp;}</a> ')
- dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'<a href="\1" target="_top">\1</a>') #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}<a href="mailto:\\1">\\1</a>#{@brace_url.xml_close}})
- dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}<a href="\\1" target="_top">\\1</a>#{@brace_url.xml_close}}) #http ftp matches with decoration
- if dob.obj =~/..\/\S+/ \
- and dob.obj !~/(\"..\/\S+?\"|>\s*..\/\S+<)/
- dob.obj.gsub!(/(\.\.\/\S+)/,'<a href="\1">\1</a>')
- end
- dob.obj.gsub!(/<a href="\.\.\//,%{<a href="#{@vz.url_site}/})
- else
- dob.obj.gsub!(/(^|[^}])_</m,'\1&lt;'); dob.obj.gsub!(/(^|[^}])_>/m,'\1&gt;') #code-block: angle brackets special characters
- dob.obj.gsub!(/(^|[^}])_</m,'\1&lt;'); dob.obj.gsub!(/(^|[^}])_>/m,'\1&gt;')
- end
- @tuned_file << dob
- end
- end
- def amp_html
- data=@data
- data.each do |dob|
- dob.obj.gsub!(/&/u,'&amp;')
- end
- data
- end
- def endnotes_html
- data=@data
- @tuned_file=[]
- a,s='_a','_s'
- ast,pls='&#042;','&#043;'
- 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]}<a href="#note\\2">#{Mx[:nbsp]}<sup id="note_ref\\2">\\2</sup>#{Mx[:nbsp]}</a> } + #note- endnote-
- %{\\1\\2 <a href="#note_ref\\2">#{Mx[:nbsp]}<sup id="note\\2">\\2.</sup></a> \\3 \\4}) #endnote- note- (careful may have switched)
- dob.obj.gsub!(/(#{Mx[:en_b_o]})[*](\d+)\s+(.+?)(#{Mx[:en_b_c]})/,
- %{#{Mx[:nbsp]}<a href="#note_astx\\2">#{Mx[:nbsp]}<sup id="note_ref_astx\\2">#{ast}\\2</sup>#{Mx[:nbsp]}</a> } + #note- endnote-
- %{\\1#{ast}\\2 <a href="#note_ref_astx\\2">#{Mx[:nbsp]}<sup id="note_astx\\2">#{ast}\\2.</sup></a> \\3 \\4}) #endnote- note- (careful may have switched)
- dob.obj.gsub!(/(#{Mx[:en_b_o]})[+](\d+)\s+(.+?)(#{Mx[:en_b_c]})/,
- %{#{Mx[:nbsp]}<a href="#note_plus\\2">#{Mx[:nbsp]}<sup id="note_ref_plus\\2">#{pls}\\2</sup>#{Mx[:nbsp]}</a> } + #note- endnote-
- %{\\1#{pls}\\2 <a href="#note_ref_plus\\2">#{Mx[:nbsp]}<sup id="note_plus\\2">#{pls}\\2.</sup></a> \\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]}<a href="#note#{a*m}">#{Mx[:nbsp]}<sup id="note_ref#{a*m}">#{ast*m}</sup>#{Mx[:nbsp]}</a> } + #note- endnote-
- %{\\1#{ast*m} <a href="#note_ref#{a*m}">#{Mx[:nbsp]}<sup id="note#{a*m}">#{ast*m}</sup></a> \\2 \\3}) #endnote- note- (careful may have switched)
- dob.obj.gsub!(/(#{Mx[:en_a_o]})([+]+)\s+(.+?)(#{Mx[:en_a_c]})/,
- %{#{Mx[:nbsp]}<a href="#note#{s*m}">#{Mx[:nbsp]}<sup id="note_ref#{s*m}">#{pls*m}</sup>#{Mx[:nbsp]}</a> } + #note- endnote-
- %{\\1#{pls*m} <a href="#note_ref#{s*m}">#{Mx[:nbsp]}<sup id="note#{s*m}">#{pls*m}</sup></a> \\2 \\3}) #endnote- note- (careful may have switched)
- end
- end
- @tuned_file << dob
- end
- end
- def output
- data=@data
- @tuned_file=[]
- data.each do |dob|
- dob.obj.strip!
- dob.obj.chomp!
- @tuned_file << dob
- end
- @tuned_file << "\n<EOF>" if (@md.fns =~/\.sst0/) #remove
- @tuned_file
- end
- end
-end
-__END__
diff --git a/lib/sisu/v2/harvest.rb b/lib/sisu/v2/harvest.rb
deleted file mode 100644
index 2a01910..0000000
--- a/lib/sisu/v2/harvest.rb
+++ /dev/null
@@ -1,101 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
- harvest metadata from document corpus (suitable for medium sized sites)
- (concept example, [to remove size constraint: implement SQL equivalent])
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/copyleft/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: system environment, resource control and configuration details
-
-=end
-def help
- puts <<WOK
- harvest --harvest extracts document index metadata
-
-WOK
-end
-def css(opt)
- require "#{SiSU_lib}/css" # css.rb
- css=SiSU_Style::CSS.new
- fn_css=SiSU_Env::CSS_default.new
- style=File.new("#{@env.path.pwd}/#{fn_css.harvest}",'w')
- style << css.harvest
- style.close
-end
-def cases(opt)
- case opt.mod.inspect
- when/--harvest/i
- css(opt) if opt.cmd.inspect =~/M/
- HARVEST_authors::Songsheet.new(opt).songsheet
- HARVEST_topics::Songsheet.new(opt).songsheet
- if opt.cmd.inspect =~/R/
- require "#{SiSU_lib}/remote" # remote.rb
- SiSU_Remote::Put.new(opt).rsync_harvest
- end
- else
- help
- end
-end
-require "#{SiSU_lib}/options" # options.rb
-require "#{SiSU_lib}/harvest_topics" # harvest_topics.rb
-require "#{SiSU_lib}/harvest_authors" # harvest_authors.rb
-require "#{SiSU_lib}/sysenv" # sysenv.rb
- include SiSU_Env
-@env=SiSU_Env::Info_env.new
-@@the_idx_topics,@@the_idx_authors={},{}
-argv=$*
-opt=SiSU_commandline::Options.new(argv)
-argv.shift
-mkdir_p(@env.path.output_md_harvest) unless FileTest.directory?(@env.path.output_md_harvest)
-cases(opt)
-__END__
diff --git a/lib/sisu/v2/harvest_authors.rb b/lib/sisu/v2/harvest_authors.rb
deleted file mode 100644
index dfb2b65..0000000
--- a/lib/sisu/v2/harvest_authors.rb
+++ /dev/null
@@ -1,316 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
- metadata harvest, extract authors and their writings from document set
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: simple xml representation (sax style)
-
-=end
-module HARVEST_authors
- require "#{SiSU_lib}/author_format" # author_format.rb
- @@the_idx_authors=[]
- class Songsheet
- def initialize(opt)
- @opt=opt
- @file_list=opt.files
- @env=SiSU_Env::Info_env.new
- end
- def songsheet
- files,idx_array=[],[]
- @file_list.each do |f|
- (f =~/.+?\.ss[tm]$/) \
- ? (files << f[/(.+?\.ss[tm])$/,1]) \
- : (print "not .sst or .ssm ? << #{f} >> ")
- end
- files.each do |filename|
- file_array=[]
- File.open(filename,'r') do |file|
- file.each_line("\n\n") do |line|
- if line =~/^@(?:title|creator|date):(?:\s|$)/m
- file_array << line
- elsif line =~/^@\S+?:(?:\s|$)/m \
- or line =~/^(?:\s*\n|%+ )/
- else break
- end
- end
- end
- idx_array=HARVEST_authors::Harvest.new(file_array,filename,idx_array).extract_harvest
- end
- the_idx=HARVEST_authors::Index.new(idx_array,@@the_idx_authors).construct_book_author_index
- HARVEST_authors::Output_index.new(@opt,the_idx).html_print.html_songsheet
- puts "file://#{@env.path.output_md_harvest}/harvest_authors.html"
- puts "file://#{@env.path.pwd}/harvest_authors.html" if @opt.cmd.inspect =~/M/
- end
- end
- class Harvest
- def initialize(data,filename,idx_array)
- @data,@filename,@idx_array=data,filename,idx_array
- end
- def extract_harvest
- data,filename,idx_array=@data,@filename,@idx_array
- @title,@subtitle,@fulltitle,@author,@author_format,@date=nil,nil,nil,nil,nil,nil
- @authors=[]
- rgx={}
- rgx[:author]=/^@creator:(?:[ ]+|.+?:author:[ ]+)(.+?)(?:\||\n)/m
- rgx[:title]=/^@title:[ ]+(.+)/
- rgx[:subtitle]=/^@title:.+?:subtitle:[ ]+(.+?)\n/m
- rgx[:date]=/^@date:(?:[ ]+|.+?:published:[ ]+)(\d{4})/m
- data.each do |para|
- if para=~ rgx[:title]
- @title=rgx[:title].match(para)[1]
- end
- if para=~ rgx[:subtitle]
- @subtitle=rgx[:subtitle].match(para)[1]
- end
- if para=~ rgx[:author]
- @author_format=rgx[:author].match(para)[1]
- end
- if para=~ rgx[:date]
- @date=rgx[:date].match(para)[1]
- end
- break if @title and @subtitle and @author and @date
- end
- @fulltitle=@subtitle ? (@title + ' - ' + @subtitle) : @title
- if @title and @author_format
- creator=FORMAT::Author.new(@author_format.strip).author_details
- @authors,@authorship=creator[:authors],creator[:authorship]
- file=if filename=~/~[a-z]{2,3}\.ss[mt]$/
- lang='.' + /~([a-z]{2,3})\.ss[mt]$/.match(filename)[1]
- filename.sub(/~[a-z]{2,3}\.ss[mt]$/,'')
- else
- lang=''
- filename.sub(/\.ss[mt]$/,'')
- end
- page="sisu_manifest#{lang}.html"
- idx_array <<= { :filename => filename, :file => file, :date => @date, :title => @fulltitle, :author => creator, :page => page }
- else
- #p "missing author field: #{@filename} title: #{@title}; author: #{@author_format}"
- end
- idx_array.flatten!
- idx_array
- end
- end
- class Index
- def initialize(idx_array,the_idx)
- @idx_array,@the_idx=idx_array,the_idx
- @@the_idx_authors=@the_idx
- end
- def capital(txt)
- txt[0].chr.capitalize + txt[1,txt.length]
- end
- def construct_book_author_index
- idx_array=@idx_array
- idx_array.each do |idx|
- idx[:author][:last_first_format_a].each do |author|
- author.strip!
- if @@the_idx_authors[author].class==NilClass
- @@the_idx_authors[author]={:md => []}
- end
- @@the_idx_authors[author][:md] << { :filename => idx[:filename], :file => idx[:file], :author => idx[:author], :title => idx[:title], :date => idx[:date], :page => idx[:page] }
- end
- end
- @the_idx=@@the_idx_authors
- end
- end
- class Output_index
- def initialize(opt,the_idx)
- @opt,@the_idx=opt,the_idx
- @env=SiSU_Env::Info_env.new
- @rc=Get_init.instance.yamlrc
- @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
- end
- def html_file_open
- @output={}
- @output[:html]=File.new("#{@env.path.output_md_harvest}/harvest_authors.html",'w')
- @output[:html_mnt]=(@opt.cmd.inspect =~/M/) \
- ? File.new("#{@env.path.pwd}/harvest_authors.html",'w') \
- : nil
- end
- def html_file_close
- @output[:html].close
- @output[:html_mnt].close if @output[:html_mnt].class==File
- end
- def html_print
- def html_songsheet
- html_file_open
- html_head
- html_alph
- html_body
- html_tail
- html_file_close
- end
- def html_head_adjust(type='')
- css_path=(type !~/maintenance/) \
- ? '../_sisu/css/harvest.css' \
- : 'harvest.css'
- sv=SiSU_Env::Info_version.instance.get_version
- <<WOK
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<title>SiSU Metadata Harvest - Authors</title>
-<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
-<meta name="dc.title" content= "SiSU metadata harvest, Authors - SiSU information Structuring Universe, Structured information Serialised Units" />
-<meta name="dc.subject" content= "document structuring, ebook, publishing, PDF, LaTeX, XML, ODF, SQL, postgresql, sqlite, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, granular search, digital library" />
-<meta name="generator" content="#{sv[:project]} #{sv[:version]} of #{sv[:date_stamp]} (n*x and Ruby!)" />
-<link rel="generator" href="http://www.jus.uio.no/sisu/SiSU" />
-<link rel="stylesheet" href="#{css_path}" type="text/css" />
-<link rel="shortcut icon" href="../_sisu/image/rb7.ico" />
-</head>
-<body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en">
-<a name="top" id="top"></a>
-<a name="up" id="up"></a>
-<a name="start" id="start"></a>
-<h1>SiSU Metadata Harvest - Authors</h1>
-<p>[<a href="../index.html">&nbsp;HOME&nbsp;</a>] also see <a href="harvest_topics.html">SiSU Metadata Harvest - Topics</a></p>
-<p>#{@env.widget_static.search_form}</p>
-<hr />
-WOK
- end
- def html_head
- @output[:html_mnt] << html_head_adjust('maintenance') if @opt.cmd.inspect =~/M/
- @output[:html] << html_head_adjust
- end
- def html_alph
- a=[]
- a << '<p>'
- @alph.each do |x|
- a << ((x =~/[0-9]/) ? '' : %{<a href="##{x}">#{x}</a>,&nbsp;})
- end
- @output[:html_mnt] << a.join if @output[:html_mnt].class==File
- @output[:html] << a.join
- end
- def html_tail
- a=[]
- a <<<<WOK
-<hr />
-<a name="bottom" id="bottom"></a>
-<a name="down" id="down"></a>
-<a name="end" id="end"></a>
-<a name="finish" id="finish"></a>
-<a name="stop" id="stop"></a>
-<a name="credits"></a>
-#{@vz.credits_sisu}
-</body>
-</html>
-WOK
- @output[:html_mnt] << a if @output[:html_mnt].class==File
- @output[:html] << a
- end
- def do_html(html)
- @output[:html_mnt] << html if @output[:html_mnt].class==File
- @output[:html] << html
- end
- def do_string(attrib,string)
- html=%{<p class="#{attrib}">#{string}</p>}
- do_html(html)
- end
- def do_string_name(attrib,string)
- f=/^(\S)/.match(string[0])[1]
- if @letter < f
- while @letter < f
- if @alph.length > 0
- @letter=@alph.shift
- if @output[:html_mnt].class==File
- @output[:html_mnt] << %{\n<p class="letter"><a name="#{@letter}"></p>#{@letter}</a><p class="book_index_lev1"><a name="#{@letter.downcase}"></a></p>}
- end
- @output[:html] << %{\n<p class="letter"><a name="#{@letter}">#{@letter}</a></p><p class="book_index_lev1"><a name="#{@letter.downcase}"></a></p>}
- else break
- end
- end
- end
- end
- def html_body
- the_idx=@the_idx
- the_idx.sort.each do |a|
- do_string_name('',a)
- name=a[0].sub(/(.+?)(?:,.+|$)/,'\1').gsub(/\s+/,'_')
- x = %{<p class="author"><a name="#{name}">#{a[0]}</a></p>}
- if @output[:html_mnt].class==File
- @output[:html_mnt] << x
- end
- @output[:html] << x
- works=[]
- a[1][:md].each do |x|
- work=[ "#{x[:date]} #{x[:title]}", %{<p class="publication">#{x[:date]} <a href="../#{x[:file]}/#{x[:page]}">#{x[:title]}</a>, #{x[:author][:authors_s]}</p>} ]
- works<<=(@output[:html_mnt].class==File) \
- ? (work.concat([%{<p class="publication">[<a href="#{x[:file]}.sst">src</a>]&nbsp;&nbsp;#{x[:date]} <a href="file://#{@env.path.output}/#{x[:file]}/#{x[:page]}">#{x[:title]}</a>, #{x[:author][:authors_s]} -- [<a href="#{x[:file]}.sst">#{x[:file]}.sst</a>]</p>}])) \
- : work
- end
- works.sort_by {|x| x[0]}.each do |x|
- @output[:html] << x[1]
- @output[:html_mnt] << x[2] if @output[:html_mnt].class==File
- end
- end
- end
- self
- end
- def screen_print
- def cycle
- the_idx=@the_idx
- the_idx.sort.each do |a|
- puts a[0]
- a[1][:md].each do |x|
- puts "\t" + x[:file]
- end
- end
- end
- self
- end
- end
-end
-__END__
diff --git a/lib/sisu/v2/harvest_topics.rb b/lib/sisu/v2/harvest_topics.rb
deleted file mode 100644
index 45b1449..0000000
--- a/lib/sisu/v2/harvest_topics.rb
+++ /dev/null
@@ -1,559 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
- metadata harvest, extract topics and associated writings from document set
- (topics use topic_register header)
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: simple xml representation (sax style)
-
-=end
-module HARVEST_topics
- require "#{SiSU_lib}/author_format" # author_format.rb
- class Songsheet
- def initialize(opt)
- @opt=opt
- @file_list=opt.files
- @env=SiSU_Env::Info_env.new
- end
- def songsheet
- files,idx_array=[],[]
- @file_list.each do |f|
- (f =~/.+?\.ss[tm]$/) \
- ? (files << f[/(.+?\.ss[tm])$/,1]) \
- : (print "not .sst or .ssm ? << #{f} >> ")
- end
- files.each do |filename|
- file_array=[]
- File.open(filename,'r') do |file|
- file.each_line("\n\n") do |line|
- if line =~/^@(?:title|creator|classify):(?:\s|$)/m
- file_array << line
- elsif line =~/^@\S+?:(?:\s|$)/m \
- or line =~/^(?:\s*\n|%+ )/
- else break
- end
- end
- end
- idx_array=HARVEST_topics::Harvest.new(@opt,file_array,filename,idx_array).extract_harvest
- end
- the_idx=HARVEST_topics::Index.new(idx_array,@@the_idx_topics).construct_book_topic_index
- #HARVEST_topics::Output_index.new('',the_idx).screen_print.cycle if @opt.cmd.inspect =~/[VM]/
- HARVEST_topics::Output_index.new(@opt,the_idx).html_print.html_songsheet
- puts "file://#{@env.path.output_md_harvest}/harvest_topics.html"
- puts "file://#{@env.path.pwd}/harvest_topics.html" if @opt.cmd.inspect =~/M/
- end
- end
- class Harvest
- def initialize(opt,data,filename,idx_array)
- @opt,@data,@filename,@idx_array=opt,data,filename,idx_array
- end
- def extract_harvest
- data,filename,idx_array=@data,@filename,@idx_array
- @idx_lst,@title,@subtitle,@fulltitle,@author,@author_format=nil,nil,nil,nil,nil,nil
- rgx={}
- rgx[:author]=/^@creator:(?:[ ]+|.+?:author:[ ]+)(.+?)(?:\||\n)/m
- rgx[:title]=/^@title:[ ]+(.+)/
- rgx[:subtitle]=/^@title:.+?:subtitle:[ ]+(.+?)\n/m
- rgx[:idx]=/^@classify:.+?:topic_register:[ ]+(.+?)\n/m
- data.each do |para|
- if para=~ rgx[:idx]
- @idx_list=rgx[:idx].match(para)[1]
- end
- if para=~ rgx[:title]
- @title=rgx[:title].match(para)[1]
- end
- if para=~ rgx[:subtitle]
- @subtitle=rgx[:subtitle].match(para)[1]
- end
- if para=~ rgx[:author]
- @author_format=rgx[:author].match(para)[1]
- end
- break if @title and @subtitle and @author and @idx_lst
- end
- @fulltitle=@subtitle ? (@title + ' - ' + @subtitle) : @title
- if @title \
- and @author_format \
- and @idx_list
- creator=FORMAT::Author.new(@author_format.strip).author_details
- @authors,@authorship=creator[:authors],creator[:authorship]
- file=if filename=~/~[a-z]{2,3}\.ss[mt]$/
- lang='.' + /~([a-z]{2,3})\.ss[mt]$/.match(filename)[1]
- filename.sub(/~[a-z]{2,3}\.ss[mt]$/,'')
- else
- lang=''
- filename.sub(/\.ss[mt]$/,'')
- end
- page="sisu_manifest#{lang}.html"
- idx_array <<=if @idx_list =~/;/
- g=@idx_list.scan(/[^;]+/)
- idxl=[]
- g.each do |i|
- i.strip!
- idxl << { :filename =>filename,:file =>file,:rough_idx =>i,:title =>@fulltitle,:author =>creator,:page =>page}
- end
- idxl
- else { :filename =>filename,:file =>file,:rough_idx =>@idx_list,:title =>@fulltitle,:author =>creator,:page =>page}
- end
- else
- p "missing required field in #{@filename} - [title]: <<#{@title}>>; [author]: <<#{@author_format}>>; [idx]: <<#{@idx_list}>>" if @opt.cmd.inspect =~/[VM]/
- end
- idx_array.flatten!
- idx_array
- end
- end
- class Index
- def initialize(idx_array,the_idx)
- @idx_array,@the_idx=idx_array,the_idx
- @@the_idx_topics=@the_idx
- end
- def capital(txt)
- txt[0].chr.capitalize + txt[1,txt.length]
- end
- def contents(hash,idx)
- names=''
- idx[:author][:last_first_format_a].each do |n|
- s=n.sub(/(.+?)(?:,.+|$)/,'\1').gsub(/\s+/,'_')
- names += %{<a href="harvest_authors.html##{s}">#{n}</a>, }
- end
- hash << { :filename =>idx[:filename],:file =>idx[:file],:author =>names,:title =>idx[:title],:page =>idx[:page]}
- end
- def construct_book_topic_index
- idx_array=@idx_array
- idx_array.each do |idx|
- @lv0,@lv1,@lv2,@lv3,@lv4={},{},{},{},{}
- if idx[:rough_idx]
- idx_lst=idx[:rough_idx].scan(/[^:]+/)
- else
- puts "no topic register in: << #{idx[:filename]} >>"
- next
- end
- idx_lst_alt=[]
- idx_lst.each {|lev| idx_lst_alt << lev.scan(/[^|]+/)}
- depth = idx_lst_alt.length - 1
- range = 0..depth
- range.each do |t|
- if idx_lst_alt[t]
- case t
- when 0
- lev0=idx_lst_alt[t]
- lev0.each do |lv0|
- lv0=capital(lv0)
- if @@the_idx_topics[lv0].class==NilClass
- @@the_idx_topics[lv0]={:md => []}
- end
- @lv0=lv0 if lev0.length==1
- j=@@the_idx_topics[lv0][:md]
- contents(j,idx) if idx_lst_alt.length - 1 == t
- end
- when 1
- lev1=idx_lst_alt[t]
- lev1.each do |lv1|
- lv1=capital(lv1)
- if @@the_idx_topics[@lv0][lv1].class==NilClass
- @@the_idx_topics[@lv0][lv1]={:md => []}
- end
- @lv1=lv1 if lev1.length==1
- j=@@the_idx_topics[@lv0][lv1][:md]
- contents(j,idx) if idx_lst_alt.length - 1 == t
- end
- when 2
- lev2=idx_lst_alt[t]
- lev2.each do |lv2|
- lv2=capital(lv2)
- if @@the_idx_topics[@lv0][@lv1][lv2].class==NilClass
- @@the_idx_topics[@lv0][@lv1][lv2]={:md => []}
- end
- @lv2=lv2 if lev2.length==1
- j=@@the_idx_topics[@lv0][@lv1][lv2][:md]
- contents(j,idx) if idx_lst_alt.length - 1 == t
- end
- when 3
- lev3=idx_lst_alt[t]
- lev3.each do |lv3|
- lv3=capital(lv3)
- if @@the_idx_topics[@lv0][@lv1][@lv2][lv3].class==NilClass
- @@the_idx_topics[@lv0][@lv1][@lv2][lv3]={:md => []}
- end
- @lv3=lv3 if lev3.length==1
- j=@@the_idx_topics[@lv0][@lv1][@lv2][lv3][:md]
- contents(j,idx) if idx_lst_alt.length - 1 == t
- end
- when 4
- lev4=idx_lst_alt[t]
- lev4.each do |lv4|
- lv4=capital(lv4)
- if @@the_idx_topics[@lv0][@lv1][@lv2][@lv3][lv4].class==NilClass
- @@the_idx_topics[@lv0][@lv1][@lv2][@lv3][lv4]={:md => []}
- end
- @lv4=lv4 if lev4.length==1
- j=@@the_idx_topics[@lv0][@lv1][@lv2][@lv3][lv4][:md]
- contents(j,idx) if idx_lst_alt.length - 1 == t
- end
- end
- end
- end
- end
- @the_idx
- end
- end
- class Output_index
- def initialize(opt,the_idx)
- @opt,@the_idx=opt,the_idx
- @env=SiSU_Env::Info_env.new
- @rc=Get_init.instance.yamlrc
- @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
- end
- def html_file_open
- @output={}
- @output[:html]=File.new("#{@env.path.output_md_harvest}/harvest_topics.html",'w')
- if @opt.cmd.inspect =~/-M/
- @output[:html_mnt]=File.new("#{@env.path.pwd}/harvest_topics.html",'w')
- end
- end
- def html_file_close
- @output[:html].close
- @output[:html_mnt].close if @output[:html_mnt].class==File
- end
- def html_print
- def html_songsheet
- html_file_open
- html_head
- html_alph
- html_body
- html_tail
- html_file_close
- end
- def html_head_adjust(type='')
- css_path=(type !~/maintenance/) \
- ? '../_sisu/css/harvest.css' \
- : 'harvest.css'
- sv=SiSU_Env::Info_version.instance.get_version
- <<WOK
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<title>SiSU Metadata Harvest - Topics</title>
-<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
-<meta name="dc.title" content= "SiSU metadata harvest, Topics - SiSU information Structuring Universe, Structured information Serialised Units" />
-<meta name="dc.subject" content= "document structuring, ebook, publishing, PDF, LaTeX, XML, ODF, SQL, postgresql, sqlite, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, granular search, digital library" />
-<meta name="generator" content="#{sv[:project]} #{sv[:version]} of #{sv[:date_stamp]} (n*x and Ruby!)" />
-<link rel="generator" href="http://www.jus.uio.no/sisu/SiSU" />
-<link rel="stylesheet" href="#{css_path}" type="text/css" />
-<link rel="shortcut icon" href="../_sisu/image/rb7.ico" />
-</head>
-<body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en">
-<a name="top" id="top"></a>
-<a name="up" id="up"></a>
-<a name="start" id="start"></a>
-<h1>SiSU Metadata Harvest - Topics</h1>
-<p>[<a href="../index.html">&nbsp;HOME&nbsp;</a>] also see <a href="harvest_authors.html">SiSU Metadata Harvest - Authors</a></p>
-<p>#{@env.widget_static.search_form}</p>
-<hr />
-WOK
- end
- def html_head
- @output[:html_mnt] << html_head_adjust('maintenance') if @opt.cmd.inspect =~/M/
- @output[:html] << html_head_adjust
- end
- def html_alph
- a=[]
- a << '<p>'
- @alph.each do |x|
- a << (x =~/[0-9]/) \
- ? '' \
- : %{<a href="##{x}">#{x}</a>,&nbsp;}
- end
- @output[:html_mnt] << a if @opt.cmd.inspect =~/M/
- @output[:html] << a.join
- end
- def html_tail
- a=[]
- a <<<<WOK
-<hr />
-<a name="bottom" id="bottom"></a>
-<a name="down" id="down"></a>
-<a name="end" id="end"></a>
-<a name="finish" id="finish"></a>
-<a name="stop" id="stop"></a>
-<a name="credits"></a>
-#{@vz.credits_sisu}
-</body>
-</html>
-WOK
- @output[:html_mnt] << a if @output[:html_mnt].class==File
- @output[:html] << a
- end
- def do_html(html)
- @output[:html] << html
- end
- def do_html_maintenance(html)
- @output[:html_mnt] << html if @output[:html_mnt].class==File
- end
- def do_string(attrib,string)
- html=%{<p class="#{attrib}">#{string}</p>}
- do_html(html)
- do_html_maintenance(html) if @output[:html_mnt].class==File
- end
- def do_string_default(attrib,string)
- html=%{<p class="#{attrib}">#{string}</p>}
- do_html(html)
- end
- def do_string_maintenance(attrib,string)
- html=%{<p class="#{attrib}">#{string}</p>}
- do_html_maintenance(html) if @output[:html_mnt].class==File
- end
- def do_string_name(attrib,string)
- f=/^(\S)/.match(string)[1]
- if @letter < f
- while @letter < f
- if @alph.length > 0
- @letter=@alph.shift
- if @output[:html_mnt].class==File
- @output[:html_mnt] << %{\n<p class="letter"><a name="#{@letter}">#{@letter}</a></p><p class="book_index_lev1"><a name="#{@letter.downcase}"></a></p>}
- end
- @output[:html] << %{\n<p class="letter"><a name="#{@letter}">#{@letter}</a></p><p class="book_index_lev1"><a name="#{@letter.downcase}"></a></p>}
- else break
- end
- end
- end
- name=string.strip.gsub(/\s+/,'_')
- html=%{<p class="#{attrib}"><a name="#{name}">#{string}</a></p>}
- do_html(html)
- do_html_maintenance(html) if @output[:html_mnt].class==File
- end
- def do_array(lv,array)
- lv+=1
- array.each do |b|
- do_case(lv,b)
- end
- end
- def do_hash_md(attrib,hash)
- html=%{<a href="../#{hash[:file]}/#{hash[:page]}">#{hash[:title]}</a> - #{hash[:author]}}
- do_string_default(attrib,html)
- end
- def do_hash_md_maintenance(attrib,hash)
- if @output[:html_mnt].class==File #should not be run for presentation output
- html=%{[<a href="#{hash[:file]}.sst">src</a>]&nbsp;&nbsp;<a href="file://#{@env.path.output}/#{hash[:file]}/#{hash[:page]}">#{hash[:title]}</a> - #{hash[:author]}}
- do_string_maintenance(attrib,html)
- end
- end
- def do_hash(lv,hash)
- lv+=1
- key=[]
- hash.each_key do |m|
- if m == :md
- do_case(lv,hash[m])
- elsif m != :title and m != :author and m != :filename and m != :file and m != :rough_idx and m != :page
- key << m
- elsif m == :title
- do_hash_md('work',hash)
- do_hash_md_maintenance('work',hash)
- end
- end
- if key.length > 0
- key.sort.each do |m|
- attrib="lev#{lv}"
- lv==0 ? do_string_name(attrib,m) : do_string(attrib,m)
- do_case(lv,hash[m])
- end
- end
- end
- def do_case(lv,a)
- y = a.class
- case
- when y==String
- attrib="lev#{lv}"
- lv==0 ? do_string_name(attrib,a) : do_string(attrib,a)
- when y==Array
- do_array(lv,a)
- when y==Hash
- do_hash(lv,a)
- end
- end
- def html_body
- the_idx=@the_idx
- the_idx.sort.each do |a|
- do_case(-1,a)
- end
- end
- self
- end
- def screen_print
- def do_string(lv,string)
- s=' '*4
- puts s*lv + string
- end
- def do_array(lv,array)
- lv+=1
- array.each do |b|
- do_case(lv,b)
- end
- end
- def do_hash_md(lv,hash)
- string=hash[:title] + ' - ' + hash[:author]
- do_string(lv,string)
- end
- def do_hash(lv,hash)
- lv+=1
- key=[]
- hash.each_key do |m|
- if m == :md
- do_case(lv,hash[m])
- elsif m != :title and m != :author and m != :filename and m != :file and m != :rough_idx and m != :page
- key << m
- elsif m == :title
- do_hash_md(lv,hash)
- end
- end
- if key.length > 0
- key.sort.each do |m|
- do_string(lv,m)
- do_case(lv,hash[m])
- end
- end
- end
- def do_case(lv,a)
- s=' '*4
- y = a.class
- case
- when y==String
- do_string(lv,a)
- when y==Array
- do_array(lv,a)
- when y==Hash
- do_hash(lv,a)
- end
- end
- def cycle
- the_idx=@the_idx
- the_idx.each do |a|
- do_case(-1,a)
- end
- end
- self
- end
- def screen_print_unsorted
- def do_string(lv,string)
- s=' '*4
- puts s*lv + string
- end
- def do_array(lv,array)
- lv+=1
- array.each do |b|
- do_case(lv,b)
- end
- end
- def do_hash_md(lv,hash)
- string=hash[:title] + ' - ' + hash[:author]
- do_string(lv,string)
- end
- def do_hash(lv,hash)
- lv+=1
- hash.each_key do |m|
- if m == :md
- do_case(lv,hash[m])
- else
- if m != :title and m != :author and m != :filename and m != :file and m != :rough_idx and m != :page
- do_string(lv,m)
- do_case(lv,hash[m])
- elsif m == :title
- do_hash_md(lv,hash)
- else
- end
- end
- end
- end
- def do_case(lv,a)
- s=' '*4
- y = a.class
- case
- when y==String
- do_string(lv,a)
- when y==Array
- do_array(lv,a)
- when y==Hash
- do_hash(lv,a)
- end
- end
- def cycle
- the_idx=@the_idx
- the_idx.each do |a|
- do_case(-1,a)
- end
- end
- self
- end
- end
-end
-__END__
-terms -|_ t{tl1} -|_ {fa}[fa]{filenames and other details}
- | |_ {tl2} -|_ {fa}[fa]{filenames and other details}
- | | |_{tl3} -|_ {fa}[fa]{filenames and other details}
- | | | |_{tl4} - {fa}[fa]{filenames and other details}
- | | | |
- | | | |_{tl4a} - {fa}[fa]{filenames and other details}
- | | | |
- | | | |_{tl4b} - {fa}[fa]{filenames and other details}
- | | | |
- | | | |_ ...
- | | |
- | | |_{tl3a} - {fa}[fa]{filenames and other details}
- | |
- | |_{tl2a} - {fa}[fa]{filenames and other details}
- |
- |_ t{tl1a} -|_ {fa}[fa]{filenames and other details}
- |_ ...
diff --git a/lib/sisu/v2/html_tune.rb b/lib/sisu/v2/html_tune.rb
deleted file mode 100644
index 99ce1b0..0000000
--- a/lib/sisu/v2/html_tune.rb
+++ /dev/null
@@ -1,371 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: html generation, html pre-processing
-
-=end
-require "#{SiSU_lib}/param"
-module SiSU_HTML_Tune
- require "#{SiSU_lib}/sysenv" # sysenv.rb
- include SiSU_Env; include SiSU_Screen
- require "#{SiSU_lib}/html_format" # html_format.rb #watch
- @@line_mode=''
- @@endnote_array=[]
- @@endnote_call_counter=1
- @@table_align='<table summary='' width="96%" border="0" bgcolor="white" cellpadding="0" col="3">
-<tr ...><td width="2%" align="right">
-&nbsp\;</td>
-<td width="94%" valign="top" align="justify">'
- @@table_align_close='</td>
-<td width="4%" align="right" valign="top">
-<font size="1" color="#777777">
-&nbsp;&nbsp;&nbsp;</font> </td></tr></table>'
- @@counter,@@column,@columns=0,0,0
- class Output
- def initialize(data,md)
- @data,@md=data,md
- @cX=SiSU_Screen::Ansi.new(@md.cmd).cX
- end
- def hard_output
- my_make=SiSU_Env::Create_file.new(@md.cmd,@md.fns)
- @filename_tune=my_make.file_tune
- data=[]
- @data.each{|x| x.obj.strip; data << x if not x.obj.empty?} #1.9 array?
- data.each do |dob|
- @filename_tune.puts dob, "\n"
- end
- end
- def marshal
- my_make=SiSU_Env::Create_file.new(@md.cmd,@md.fns)
- @marshal_tune=my_make.marshal_tune
- File.open(@marshal_tune,'w') {|f| Marshal.dump(@data.to_a,f)}
- end
- end
- class Clean_html
- def initialize(html='')
- @html=html
- end
- def clean
- html=@html
- str=if html.class==String
- 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,'&cent;') # &#162;
- str.gsub!(/£/u,'&pound;') # &#163;
- str.gsub!(/¥/u,'&yen;') # &#165;
- str.gsub!(/§/u,'&sect;') # &#167;
- str.gsub!(/©/u,'&copy;') # &#169;
- str.gsub!(/ª/u,'&ordf;') # &#170;
- str.gsub!(/«/u,'&laquo;') # &#171;
- str.gsub!(/®/u,'&reg;') # &#174;
- str.gsub!(/°/u,'&deg;') # &#176;
- str.gsub!(/±/u,'&plusmn;') # &#177;
- str.gsub!(/²/u,'&sup2;') # &#178;
- str.gsub!(/³/u,'&sup3;') # &#179;
- str.gsub!(/µ/u,'&micro;') # &#181;
- str.gsub!(/¶/u,'&para;') # &#182;
- str.gsub!(/¹/u,'&sup1;') # &#185;
- str.gsub!(/º/u,'&ordm;') # &#186;
- str.gsub!(/»/u,'&raquo;') # &#187;
- str.gsub!(/¼/u,'&frac14;') # &#188;
- str.gsub!(/½/u,'&frac12;') # &#189;
- str.gsub!(/¾/u,'&frac34;') # &#190;
- str.gsub!(/×/u,'&times;') # &#215;
- str.gsub!(/÷/u,'&divide;') # &#247;
- str.gsub!(/¿/u,'&iquest;') # &#191;
- str.gsub!(/À/u,'&Agrave;') # &#192;
- str.gsub!(/Á/u,'&Aacute;') # &#193;
- str.gsub!(/Â/u,'&Acirc;') # &#194;
- str.gsub!(/Ã/u,'&Atilde;') # &#195;
- str.gsub!(/Ä/u,'&Auml;') # &#196;
- str.gsub!(/Å/u,'&Aring;') # &#197;
- str.gsub!(/Æ/u,'&AElig;') # &#198;
- str.gsub!(/Ç/u,'&Ccedil;') # &#199;
- str.gsub!(/È/u,'&Egrave;') # &#200;
- str.gsub!(/É/u,'&Eacute;') # &#201;
- str.gsub!(/Ê/u,'&Ecirc;') # &#202;
- str.gsub!(/Ë/u,'&Euml;') # &#203;
- str.gsub!(/Ì/u,'&Igrave;') # &#204;
- str.gsub!(/Í/u,'&Iacute;') # &#205;
- str.gsub!(/Î/u,'&Icirc;') # &#206;
- str.gsub!(/Ï/u,'&Iuml;') # &#207;
- str.gsub!(/Ð/u,'&ETH;') # &#208;
- str.gsub!(/Ñ/u,'&Ntilde;') # &#209;
- str.gsub!(/Ò/u,'&Ograve;') # &#210;
- str.gsub!(/Ó/u,'&Oacute;') # &#211;
- str.gsub!(/Ô/u,'&Ocirc;') # &#212;
- str.gsub!(/Õ/u,'&Otilde;') # &#213;
- str.gsub!(/Ö/u,'&Ouml;') # &#214;
- str.gsub!(/Ø/u,'&Oslash;') # &#216;
- str.gsub!(/Ù/u,'&Ugrave;') # &#217;
- str.gsub!(/Ú/u,'&Uacute;') # &#218;
- str.gsub!(/Û/u,'&Ucirc;') # &#219;
- str.gsub!(/Ü/u,'&Uuml;') # &#220;
- str.gsub!(/Ý/u,'&Yacute;') # &#221;
- str.gsub!(/Þ/u,'&THORN;') # &#222;
- str.gsub!(/ß/u,'&szlig;') # &#223;
- str.gsub!(/à/u,'&agrave;') # &#224;
- str.gsub!(/á/u,'&aacute;') # &#225;
- str.gsub!(/â/u,'&acirc;') # &#226;
- str.gsub!(/ã/u,'&atilde;') # &#227;
- str.gsub!(/ä/u,'&auml;') # &#228;
- str.gsub!(/å/u,'&aring;') # &#229;
- str.gsub!(/æ/u,'&aelig;') # &#230;
- str.gsub!(/ç/u,'&ccedil;') # &#231;
- str.gsub!(/è/u,'&egrave;') # &#232;
- str.gsub!(/é/u,'&eacute;') # &#233;
- str.gsub!(/ê/u,'&ecirc;') # &#234;
- str.gsub!(/ë/u,'&euml;') # &#235;
- str.gsub!(/ì/u,'&igrave;') # &#236;
- str.gsub!(/í/u,'&iacute;') # &#237;
- str.gsub!(/î/u,'&icirc;') # &#238;
- str.gsub!(/ï/u,'&iuml;') # &#239;
- str.gsub!(/ð/u,'&eth;') # &#240;
- str.gsub!(/ñ/u,'&ntilde;') # &#241;
- str.gsub!(/ò/u,'&ograve;') # &#242;
- str.gsub!(/ó/u,'&oacute;') # &#243;
- str.gsub!(/ô/u,'&ocirc;') # &#244;
- str.gsub!(/õ/u,'&otilde;') # &#245;
- str.gsub!(/ö/u,'&ouml;') # &#246;
- str.gsub!(/ø/u,'&oslash;') # &#248;
- str.gsub!(/ù/u,'&ugrave;') # &#250;
- str.gsub!(/ú/u,'&uacute;') # &#251;
- str.gsub!(/û/u,'&ucirc;') # &#252;
- str.gsub!(/ü/u,'&uuml;') # &#253;
- str.gsub!(/þ/u,'&thorn;') # &#254;
- str.gsub!(/ÿ/u,'&yuml;') # &#255;
- str.gsub!(/ý/u,'&yacute;')
- str
- 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)
- @brace_url=SiSU_Viz::Skin.new.url_decoration
- end
- def songsheet
- begin
- @cX=SiSU_Screen::Ansi.new(@md.cmd).cX
- SiSU_Screen::Ansi.new(@md.cmd,'Tune').txt_grey if @md.cmd =~/[MVv]/
- data=Tune.new(@data,@md).endnotes_html
- data=Tune.new(data,@md).url_markup
- data=Tune.new(data,@md).markup
- if @md.cmd =~/M/ #Hard Output Tune Optional on/off here
- data=Output.new(data,@md).hard_output
- Output.new(data,@md).marshal
- end
- tuned=Tune.new(@data,@md).output
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.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<a name="H#\1">#\1.</a>&nbsp;') #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]}/,'<br />') unless dob.is=='table'
- dob.obj.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>')
- dob.obj.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>')
- dob.obj.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>')
- dob.obj.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>')
- dob.obj.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>')
- dob.obj.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'<ins>\1</ins>')
- dob.obj.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>')
- dob.obj.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>')
- dob.obj.gsub!(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>') # tt, kbd
- dob.obj.gsub!(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'<a name="\1"></a>')
- dob.obj.gsub!(/^#{Mx[:gl_bullet]}/m,'●&nbsp;&nbsp;')
- dob.obj.gsub!(/#{Mx[:nbsp]}/,'&nbsp;')
- dob.obj.gsub!(/<(p|br)>/,'<\1 />')
- dob=SiSU_HTML_Tune::Clean_html.new(dob).clean
- @tuned_file << dob
- end
- end
- def urls(data)
- @words=[]
- data.each do |word|
- @words << if word=~/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/
- http_=true
- if word =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/
- m,u=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/.match(word).captures
- elsif word =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}:\S+?#{Mx[:rel_c]}/
- #http_=false
- m,u=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}:(\S+?)#{Mx[:rel_c]}/.match(word).captures
- u='../' + u
- elsif word =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/
- http_=false
- m,u=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}(\S+?)#{Mx[:rel_c]}/.match(word).captures
- elsif word =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}image/
- m,u=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}(image)/.match(word).captures
- end
- case m
- when /\.png|\.jpg|\.gif|c=|\s\d+x\d+/
- w,h=/\s(\d+)x(\d+)/.match(m).captures if m =~/\s\d+x\d+/
- w=%{width="#{w}"} if w
- h=%{height="#{h}"} if h
- c=m[/"(.+?)"/m,1]
- caption=%{<br /><p class="caption">#{c}</p>} if c
- png=m.scan(/\S+/)[0]
- image_path=if @md.fns =~/\.-ss[tm]$/; @env.url.images_external
- else @env.url.images_local
- end
- ins=if u \
- and u.strip !~/^image$/
- %{<a href="#{u}"><img src="#{image_path}/#{png}" #{w} #{h} naturalsizeflag="0" align="bottom" border="0"></a>#{caption}}
- else %{<img src="#{image_path}/#{png}" #{w} #{h} naturalsizeflag="0" align="bottom" border="0">#{caption}}
- end
- 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.gsub!(/(\S+)/,"#{Xx[:segment]}#\\1") if u !~/\// unless http_ #marker: in scroll remove; in seg replace
- ins=%{<a href="#{u}">#{link}</a>}
- 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)
- end
- word
- else word
- end
- word
- end
- @words=@words.join(' ')
- end
- def url_markup
- data=@data
- @tuned_file=[]
- data.each do |dob|
- unless dob.is=='code'
- 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)
- end #consider change, do a while loop
- dob.obj.gsub!(/\\copyright/i,%{<sup>&copy;</sup>})
- if (dob.obj !~/\<:ad\s+\.\.\//)
- dob.obj.gsub!(/\<:ad\s+(\S+)?\s+(\S+\.png)\s+(.+)?\;\s+(.+)?\;\s*!\>/,
- %{\n<center><a href="http:\/\/\\1" target="external"><img src="#{@env.url.images_local}/\\2" alt="\\3"></a></center>\n})
- else
- dob.obj.gsub!(/\<:ad\s+(\S+)?\s+(\S+\.png)\s+(.+)?\;\s+(.+)?\;\s*\>/,
- %{\n<center><a href="\\1" target="_top"><img src="#{@env.url.images_local}/\\2" alt="\\3"></a></center>\n})
- end
- dob.obj.gsub!(/!pick/,%{<img border="0" height="15" width="15" src="#{@env.url.images}/#{@vz.icon_choice}" alt="stellar">})
- dob.obj.gsub!(/!new/,%{&nbsp;<img border="0" height="15" width="15" src="#{@env.url.images}/#{@vz.icon_new}" alt="new">})
- dob.obj.gsub!(/<:h(.{1,7}?)>/,'<a href="#h\1">\1</a>')
- dob.obj.gsub!(/<:to(\d{1,7}?)>/,'<a href="#to\1">to&nbsp;{&nbsp;\1&nbsp;}</a> ')
- dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'<a href="\1" target="_top">\1</a>') #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}<a href="mailto:\\1">\\1</a>#{@brace_url.xml_close}})
- dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}<a href="\\1" target="_top">\\1</a>#{@brace_url.xml_close}}) #http ftp matches with decoration
- if dob.obj =~/..\/\S+/ \
- and dob.obj !~/(\"..\/\S+?\"|>\s*..\/\S+<)/
- dob.obj.gsub!(/(\.\.\/\S+)/,'<a href="\1">\1</a>')
- end
- dob.obj.gsub!(/<a href=":/,%{<a href="#{@vz.url_site}/})
- dob.obj.gsub!(/<a href="\.\.\//,%{<a href="#{@vz.url_site}/})
- else
- dob.obj.gsub!(/(^|[^}])_</m,'\1&lt;'); dob.obj.gsub!(/(^|[^}])_>/m,'\1&gt;') #code-block: angle brackets special characters
- dob.obj.gsub!(/(^|[^}])_</m,'\1&lt;'); dob.obj.gsub!(/(^|[^}])_>/m,'\1&gt;')
- end
- @tuned_file << dob
- end
- end
- def endnotes_html
- data=@data
- @tuned_file=[]
- 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]})/,
- '&nbsp;<a name="-\2" href="#_\2">&nbsp;<sup>\2</sup>&nbsp;</a> ' + #note- endnote-
- '\1\2 <a name="_\2" href="#-\2">&nbsp;<sup>\2.</sup></a> \3 \4') #endnote- note- (careful may have switched)
- dob.obj.gsub!(/(#{Mx[:en_b_o]})([*+]\d+)\s+(.+?)(#{Mx[:en_b_c]})/,
- '&nbsp;<a name="-\2" href="#_\2">&nbsp;<sup>\2</sup>&nbsp;</a> ' + #note- endnote-
- '\1\2 <a name="_\2" href="#-\2">&nbsp;<sup>\2.</sup></a> \3 \4') #endnote- note- (careful may have switched)
- dob.obj.gsub!(/(#{Mx[:en_a_o]})([*+]+)\s+(.+?)(#{Mx[:en_a_c]})/,
- '&nbsp;<a name="-\2" href="#_\2">&nbsp;<sup>\2</sup>&nbsp;</a> ' + #note- endnote-
- '\1\2 <a name="_\2" href="#-\2">&nbsp;<sup>\2</sup></a> \3 \4') #endnote- note- (careful may have switched)
- end
- @tuned_file << dob
- end
- end
- def output
- data=@data
- @tuned_file=[]
- data.each do |dob|
- dob.obj.strip!
- dob.obj.chomp!
- @tuned_file << dob
- end
- @tuned_file << "\n<EOF>" if (@md.fns =~/\.sst0/) #remove
- @tuned_file
- end
- end
-end
-__END__
diff --git a/lib/sisu/v2/hub.rb b/lib/sisu/v2/hub.rb
deleted file mode 100644
index 9c4fb71..0000000
--- a/lib/sisu/v2/hub.rb
+++ /dev/null
@@ -1,580 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: SiSU information Structuring Universe, text structuring,
- processing, publishing, search
-
-=end
-module SiSU
- require "#{SiSU_lib}/constants" # constants.rb
- require "#{SiSU_lib}/sysenv" # sysenv.rb
- include SiSU_Screen
- @@pwd=Dir.pwd
- class Op
- @@env=SiSU_Env::Info_env.new
- def initialize(opt,req,message)
- @opt,@req,@message=opt,req,message
- @n_do=0
- end
- def pod_output(fns_pod)
- dir_pwd=@@env.path.pwd
- dir_pod=@@env.sisupod_gen(fns_pod)
- Dir.chdir(dir_pod)
- content=Dir.glob("*.ss[mt]").join(' ')
- if content =~/\.ss[mt]/
- Dir.chdir(dir_pwd)
- @opt.fns=content #check
- system("cd #{dir_pod}
- sisu -CC #{@opt.cmd} #{@opt.mod.join(' ')} #{content}
- cd -
- ")
- end
- @pwd=`pwd`.strip
- Dir.chdir(@pwd)
- end
- def select
- require "#{SiSU_lib}/#{@req}"
- if @req =~/^conf$/ # -C
- SiSU_Initialize::Source.new(@opt).read
- end
- if not @opt.files.empty?
- @opt.files.each do |fns|
- env=SiSU_Env::Info_env.new(fns)
- if fns =~ /sisupod(?:\.zip)?|\S+?(?:\.ss[mt]\.zip|\.ssp)$/
- require "#{SiSU_lib}/remote" # remote.rb #check
- pod_name=SiSU_Remote::Remote_download.new(fns).pod.name
- SiSU_Screen::Ansi.new(@opt.cmd,pod_name).puts_blue unless @opt.cmd =~/q/
- @opt.files.shift
- pod_output(pod_name)
- break
- else
- put=fns.gsub(/(.+)?\.ssm\.sst$/,'\1.ssm')
- @opt.fns=fns
- if @req !~/(?:urls|remote)$/
- if @req=~/^dal$/ \
- and FileTest.file?(@opt.fns) \
- and @opt.fns =~ /\.(?:(?:-|ssm\.)?sst|ssm)$/
- if fns =~ /\.ssm$/
- require "#{SiSU_lib}/composite" # composite.rb #pre-processing
- SiSU_Assemble::Composite.new(@opt).read
- @opt.fns=fns.gsub(/\.ssm$/,'.ssm.sst')
- end
- SiSU_DAL::Source.new(@opt).read # -m
- elsif FileTest.file?(env.source_file_with_path)
- case @opt.fns
- when /\.(?:(?:-|ssm\.)?sst|ssm)$/
- case @req
- when /^dal$/
- if fns =~ /\.ssm$/
- require "#{SiSU_lib}/composite" # composite.rb #pre-processing
- SiSU_Assemble::Composite.new(@opt).read
- @opt.fns=fns.gsub(/\.ssm$/,'.ssm.sst')
- end
- SiSU_DAL::Source.new(@opt).read # -m
- when /^git$/; SiSU_Git::Source.new(@opt).read # -g
- when /^concordance$/; SiSU_Concordance::Source.new(@opt).read # -w
- when /^share_src$/; SiSU_Markup::Source.new(@opt).read # -s
- when /^sisupod_make$/; SiSU_Doc::Source.new(@opt).read # -S
- when /^source_kdissert$/; SiSU_Kdi_source::Source.new(@opt).read ## -S
- when /^digests$/; SiSU_Digest_view::Source.new(@opt).read # -N
- when /^xml_scaffold$/; SiSU_XML_scaffold::Source.new(@opt).read # -k
- when /^plaintext$/; SiSU_Plaintext::Source.new(@opt).read # -t -a
- #when /^wikispeak$/; SiSU_Wikispeak::Source.new(@opt).read # -g
- when /^epub$/; SiSU_EPUB::Source.new(@opt).read # -e
- when /^odf$/; SiSU_ODF::Source.new(@opt).read # -o
- when /^xml_md_oai_pmh_dc$/; SiSU_XML_metadata::OAI_PMH.new(@opt).read # -O
- when /^texpdf$/; SiSU_TeX::Source.new(@opt).read # -p
- when /^manpage$/; SiSU_Manpage::Source.new(@opt).read # -i
- when /^texinfo$/; SiSU_TexInfo::Source.new(@opt).read # -I
- when /^html$/; SiSU_HTML::Source.new(@opt).read # -h -H
- when /^xml$/; SiSU_XML_SAX::Source.new(@opt).read # -x
- when /^xml_dom$/; SiSU_XML_DOM::Source.new(@opt).read # -X
- when /^xml_fictionbook$/; SiSU_XML_Fictionbook::Source.new(@opt).read # -f
- when /^xhtml$/; SiSU_XHTML::Source.new(@opt).read # -b
- when /^embedded$/; SiSU_Embedded::Source.new(@opt).read # -m (image and other content)
- when /^manifest$/; SiSU_Manifest::Source.new(@opt).read # -y
- when /^sitemaps$/; SiSU_Sitemaps::Source.new(@opt).read # -Y
- when /^zap$/; SiSU_Zap::Source.new(@opt).read # -Z
- when /^dbi$/; SiSU_DBI::SiSU_SQL.new(@opt).connect # -D -d
- end
- @n_do=@n_do+1
- SiSU_Screen::Ansi.new(@opt.cmd,@n_do,"#{@req.upcase} processed").files_processed if @opt.cmd =~/[MVv]/
- ObjectSpace.garbage_collect
- else #print "not processed --> ", fns, "\n"
- end
- else
- if @req !~/^conf$/ \
- and @opt.fns !~/http:\/\//
- Operations.new(@opt).not_found
- end
- end
- elsif FileTest.file?(put)
- if @opt.mod.inspect !~/harvest/ #decide whether should permit harvest in single operation
- case @req
- when /^urls$/; SiSU_urls::Source.new(@opt).read # -u -v -V -M
- when /^remote$/
- case @message
- when /scp/; SiSU_Remote::Put.new(@opt).scp # -r
- when /rsync/; SiSU_Remote::Put.new(@opt).rsync # -R
- else #SiSU_Remote::Put.new(put,@opt.cmd).scp
- end
- end
- @n_do=@n_do+1
- SiSU_Screen::Ansi.new(@opt.cmd,@n_do,"#{@req.upcase} processed").files_processed if @opt.cmd =~/[MVv]/
- end
- else Operations.new(@opt).not_found
- end
- end
- end
- elsif @req =~/^dbi$/; SiSU_DBI::SiSU_SQL.new(@opt).connect # -D -d
- elsif @req=~/^sisupod_make$/; SiSU_Doc::Source.new(@opt).read # -S
- end
- Operations.new.counter
- end
- end
- class Operations
- @@n_do=0
- def initialize(opt='')
- @opt=opt
- @cX=SiSU_Screen::Ansi.new(@opt).cX
- end
- def counter
- @@n_do=0
- end
- def remote_put_base_site_rsync # -CR
-p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
- require "#{SiSU_lib}/remote" # remote.rb
- SiSU_Remote::Put.new(@opt).rsync_base
- end
- def remote_put_base_site_rsync_match # -CCRZ
-p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
- require "#{SiSU_lib}/remote" # remote.rb
- SiSU_Remote::Put.new(@opt).rsync_base_sync
- end
- def remote_put_base_site # -Cr
-p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
- require "#{SiSU_lib}/remote" # remote.rb
- SiSU_Remote::Put.new(@opt).scp_base
- end
- def remote_put_base_site_all # -CCr
-p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
- require "#{SiSU_lib}/remote" # remote.rb
- SiSU_Remote::Put.new(@opt).scp_base_all
- end
- def cgi # -F
- require "#{SiSU_lib}/cgi" # cgi.rb
- SiSU_CGI::SiSU_search.new(@opt).read
- end
- def encoding # -K build character encoding db (uses KirbyBase)
- require "#{SiSU_lib}/character_encoding" # character_encoding.rb
- SiSU_character_encode::Create.new.db
- end
- def termsheet # -t
- system("sisu_termsheet #{@opt.cmd} #{@opt.fns}\n")
- @@n_do=@@n_do+1
- SiSU_Screen::Ansi.new(@opt.cmd,@@n_do,'Termsheet(s) processed').term_sheet_title unless @opt.cmd =~/q/
- end
- def webrick # -W
- port=prt=@fns
- prt=if prt !~/\d+/
- 'webrick default (sysenv)'
- else "webrick port set to #{prt}"
- end
- puts %{#{@cX.blue}<<#{@cX.off}#{@cX.green}Start Webrick web server on port: #{prt}#{@cX.off}#{@cX.blue}>> #{@cX.off*2} }
- system("sisu_webrick #{port}&\n")
- end
- def not_found
- puts "\n#{@cX.fuschia}FILE NOT FOUND:#{@cX.off} << #{@opt.fns} >> - requested #{@opt.cmd} processing skipped\n"
- end
- def convert_name_message(fns,type,i,o,rune)
- %{\nIn filename: "#{@cX.fuschia}#{fns}#{@cX.off}" << #{type} >> #{@cX.fuschia}is apre 0.36 markup filename.#{@cX.off} #{@cX.brown}Please rename your file.#{@cX.off}\n\tAs of sisu-0.37, SiSU markup files with #{@cX.brown}the extensions #{i} should be re-named #{o}#{@cX.off}\n\tif you have the program called 'rename' installed, the following rune should do the trick:\n\t\t#{rune}\n\talternatively try:\n\t\tsisu --convert --36to37 #{fns}\n\trequested #{@opt.cmd} processing skipped\n}
- end
- def not_recognised
- case @opt.fns
- when /(\.s[123])$/
- type=@opt.fns.gsub(/\S+?(#{$1})/,'\1')
- rune=%q{rename 's/\.s[123]$/\.sst/' *.s{1,2,3}}
- puts convert_name_message(@opt.fns,type,'.s1 .s2 and .s3','.sst',rune)
- when /(\.r[123])$/
- type=@opt.fns.gsub(/\S+?(#{$1})/,'\1')
- rune=%q{rename 's/\.r[123]$/\.ssm/' *.r{1,2,3}}
- puts convert_name_message(@opt.fns,type,'.r1 .r2 and .r3','.sst',rune)
- puts %{\n\tNote also that you will need to change the names of the files called/required\n\twithin the document text to build the composite document\n\t\t.s1 .s2 .s3 should be .sst \n\t\t.si should be .ssi\n\trequested #{@opt.cmd} processing skipped\n}
- when /(\.ssi)$/
- puts "\n#{@cX.fuschia}component filetype:#{@cX.off} << #{@opt.fns} >> - is not a processed filetype, (it may be used as a component of a .ssm markup file)\n\trequested #{@opt.cmd} processing skipped\n"
- else
- puts "\n#{@cX.fuschia}FILETYPE NOT RECOGNISED:#{@cX.off} << #{@opt.fns} >> - is not a recognized filetype,\n\trequested #{@opt.cmd} processing skipped\n"
- end
- end
- end
- class Processing
- require 'fileutils'
- include FileUtils
- @@env=SiSU_Env::Info_env.new
- attr_accessor :op
- def initialize(opt)
- @opt=opt
- @msg,@msgs='',nil
- @tell=lambda { SiSU_Screen::Ansi.new(@opt.cmd,@msg,"#{@msgs.inspect if @msgs}") }
- end
- def op(req,msg)
- Op.new(@opt,req,msg).select if req and msg
- end
- def actions
- if @opt.cmd =~/P/
- require 'profile'
- end
- if @opt.mod.inspect =~/--harvest/
- require "#{SiSU_lib}/harvest" # harvest.rb
- end
- if @opt.mod.inspect =~/--convert|--to|--from/
- require "#{SiSU_lib}/sst_convert_markup" # sst_convert_markup.rb
- end
- if @opt.cmd =~/([AabCcDdeFfgGHhIiJjkLMmNnOopQqrRSsTtUuVvwWXxYyZ_0-9])/ \
- and @opt.cmd =~/^-/ \
- and @opt.mod.inspect !~/--(?:sitemaps|query|identify)/ \
- or @opt.mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/ #and
- @@tell=SiSU_Screen::Ansi.new(@opt.cmd)
- @cX=SiSU_Screen::Ansi.new(@opt.cmd).cX
- flag=SiSU_Env::Info_processing_flag.new
- extra=''
- if @opt.cmd !~/[mn]/
- extra+=if @opt.cmd =~/[abegHhIiNOopTtwXxyz]/ \
- and @opt.cmd !~/[mn]/
- 'm' #% add dal
- elsif ((@opt.cmd =~/[Dd]/ \
- or (@opt.mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/)) \
- and @opt.mod.inspect !~/(?:remove|(?:(?:re)?create(?:all)?|dropall|drop)$)/) \
- and @opt.cmd !~/[mn]/
- 'm' #% add dal
- else ''
- end
- end
- if @opt.cmd !~/y/
- extra+=if @opt.cmd =~/[abeHhIiNopsSstwXxz]/ \
- and @opt.cmd !~/y/
- 'ym' #% add manifest
- elsif (@opt.cmd =~/[Dd]/ \
- or @opt.mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/) \
- and @opt.files[0] !~/^remove$/ \
- and @opt.cmd !~/y/
- 'ym' #% add manifest
- else ''
- end
- end
- @opt.cmd=@opt.cmd + extra
- opt=@opt.cmd.scan(/CC|\S/)
- @opt.cmd=opt.uniq.join
- if @opt.cmd =~/[vVM]/ #% version information
- if @opt.cmd =~/V/ \
- and @opt.files.empty? #% environment
- SiSU_Help::Help.new('env',@opt).environment
- else SiSU_Help::Help.new('env',@opt).sisu_version
- end
- end
- if @opt.cmd =~/^-L$/ #% version information
- SiSU_Help::Help.new('license',@opt).help_request
- end
- if @opt.cmd =~/m/i #% -m for -C
- path={}
- path[:css]=@@env.path.output + '/_sisu/css'
- path[:xml]=@@env.path.output + '/_sisu/xml'
- path[:xsd]=path[:xml] + '/xsd'
- path[:xsd]=path[:xml] + '/rnc'
- path[:xsd]=path[:xml] + '/rng'
- re_p=/(sisupod(?:\.zip)?|\S+?\.ss[mt]\.zip|[^\/]+?\.ssp)$/
- unless @opt.files.join(',') =~ re_p #do not mix pods with source markup files in command line
- unless ( FileTest.directory?(path[:css]) \
- and FileTest.directory?(path[:xsd]) )
- @opt.cmd=@opt.cmd +='C' unless @opt.cmd =~/C/ #FIX
- end
- if @opt.cmd =~/M/
- $VERBOSE=false #debug $VERBOSE=true
- end
- end
- end
- if @opt.cmd =~/C/ #% -C initialize/configure
- op('conf','configure site')
- if @opt.cmd =~/R/
- if @opt.mod.inspect =~/--init(?:ialize)?=site/ \
- and @opt.cmd =~/RZ/
- Operations.new(@opt).remote_put_base_site_rsync_match
- else Operations.new(@opt).remote_put_base_site_rsync
- end
- elsif @opt.cmd =~/r/
- if @opt.mod.inspect =~/--init(?:ialize)?=site/ \
- and @opt.cmd =~/CCr/
- Operations.new(@opt).remote_put_base_site_all
- else Operations.new(@opt).remote_put_base_site
- end
- end
- end
- if @opt.cmd =~/F/ #% -F cgi sample search form
- Operations.new(@opt).cgi
- end
- if @opt.cmd =~/W/ #% -W webrick #@argv==port
- Operations.new(@opt).webrick
- end
- if @opt.cmd =~/Z/ #% -Z wipe previous output clean
- op('zap','Zap, deletions')
- end
- if @opt.cmd =~/s/ #% -s sisu source
- op('share_src','SiSU markup source')
- end
- if @opt.cmd =~/g/ #% -g sisu git
- op('git','SiSU Git')
- end
- if @opt.cmd =~/m/ #% -m is remote url requested? (download if)
- @retry_count= -1
- begin
- path_image='./_sisu/processing/external_document/image'
- path_skin='./_sisu/processing/external_document/skin/doc'
- @get_s,@get_p=[],[]
- re_s=/((?:https?|file):\/\/\S+?\.sst)$/
- re_p=/((?:https?|file):\/\/\S+?(?:\/\S+?\.ss[mt]\.zip|sisupod(?:\.zip)?|\.ssp))/
- @opt.files.each do |fns|
- if fns =~re_s
- @get_s << re_s.match(fns)[1] if re_s
- end
- if fns =~re_p
- @get_p << re_p.match(fns)[1] if re_p
- end
- end
- if @get_s.length > 0 #% remote markup file .sst
- require "#{SiSU_lib}/remote" # remote.rb
- SiSU_Remote::Get.new(@opt,@get_s).fns
- Operations.new.counter
- end
- if @get_p.length > 0 #% remote sisupod
- require "#{SiSU_lib}/remote" # remote.rb
- SiSU_Remote::Get.new(@opt,@get_p).sisupod
- end
- rescue
- SiSU_Errors::Info_error.new($!,$@,@opt,@fns).error #ok
- @retry_count +=1
- retry unless @retry_count > 1
- ensure
- end
- @opt.files=@opt.files.collect {|x| x=x.gsub(/(?:https?|file):\/\/\S+\/(\S+)\.sst$/,'\1.-sst') }
- end
- if @opt.cmd=~/m/ #% -m dal
- op('dal','dal')
- end
- @opt.files=@opt.files.collect {|x| x=x.gsub(/\.ssm$/,'.ssm.sst') }
- if @opt.cmd =~/S/
- op('sisupod_make','sisupod (zip)') #% -S make sisupod
- if @opt.fns=~/\.kdi._sst/
- op('share_src_kdissert','kdissert (kdi)') #% -S share kdissert source
- end
- end
- if @opt.cmd =~/N/; op('digests','digests') #% -N digest tree
- end
- if @opt.cmd =~/[hHz]/; op('html','html') #% -h -H -z html css
- end
- if @opt.cmd =~/[at]/; op('plaintext','plaintext') #% -t -a #-A -f -e -E plaintext -a creates ms-dos type; -A creates unix type, plaintext file
- end
- #if @opt.cmd =~/g/; op('git','git') #% -g git
- #end
- #if @opt.cmd =~/g/; op('wikispeak','wikispeak') #% -g wiki
- #end
- if @opt.cmd =~/e/; op('epub','ePub') #% -e epub
- end
- if @opt.cmd =~/o/; op('odf','OpenDocument') #% -o opendocument
- end
- if @opt.cmd =~/x/; op('xml','xml sax') #% -x xml sax type
- end
- if @opt.cmd =~/X/; op('xml_dom','xml dom') #% -X xml dom type
- end
- if @opt.cmd =~/f/; op('xml_fictionbook','xml fictionbook') #% -f xml fictionbook
- end
- if @opt.cmd =~/b/; op('xhtml','xhtml sax') #% -b xhtml sax type
- end
- if @opt.cmd =~/w/; op('concordance','Concordance') #% -w concordance
- end
- if @opt.cmd =~/O/; op('xml_md_oai_pmh_dc','OAI PMH') #% -O open archive initiative, metadata harvesting
- end
- if @opt.cmd =~/T/ #% -T termsheet/standard form
- SiSU_Help::Help.new('termsheet').help_request
- @opt.files.each do |fns|
- if FileTest.file?(fns)
- @opt.fns=fns
- case @opt.fns
- when /\.(termsheet.rb)$/; Operations.new(@opt).termsheet
- else #print "not processed --> ", fns, "\n"
- end
- else Operations.new(@opt).not_found
- end
- end
- Operations.new.counter
- end
- if @opt.cmd =~/k/; op('xml_scaffold','XML scaffold') #% -T temporary tests
- end
- if @opt.cmd =~/p/; op('texpdf','LaTeX pdf') #% -p latex/ texpdf
- end
- if @opt.cmd =~/i/; op('manpage','manpage') #% -i manpage
- end
- if @opt.cmd =~/I/; op('texinfo','TeX Info') #% -I texinfo (i taken by db import)
- end
- if @opt.cmd =~/D/ \
- or @opt.mod.inspect =~/--pgsql/; op('dbi','postgresql') #% -D DB postgresql
- end
- if @opt.cmd =~/d/ \
- or @opt.mod.inspect =~/--sqlite/; op('dbi','sqlite') #% -d DB sqlite
- end
- if @opt.cmd =~/G/; Operations.new(@opt).cgi #% -G cgi - used to make dbi intecface
- end
- if @opt.cmd=~/m/; op('embedded','Embedded Content') #% -m embedded content
- end
- if @opt.cmd =~/y/; op('manifest','Manifest') #% -y manifest
- end
- if @opt.cmd =~/Y/; op('sitemaps','Sitemap') #% -Y sitemap
- end
- if @opt.mod.inspect !~/--harvest/
- if @opt.cmd =~/r/; op('remote','scp') #% -r copy to remote server
- end
- if @opt.cmd =~/R/; op('remote','rsync') #% -R copy to remote server
- end
- else
- end
- op('urls','urls')
- @msg,@msgs="\tsisu -W [to start ruby web-server on output directory]\n",nil unless @opt.cmd =~/q/
- @tell.call.print_brown if @opt.cmd =~/[uUvVM]/ unless @opt.files.join.empty?
- if defined? @@env.path.processing \
- and @@env.user \
- and FileTest.directory?(@@env.path.processing) \
- and @@env.path.processing =~/#{@@env.user}$/ #clean temporary processing directory of content as is located in public area
- cd(@@env.path.processing_base_tmp) do
- rm_rf(@@env.user) unless @opt.cmd =~/M/
- end end
- elsif @opt.mod.inspect =~/--query/
- require "#{SiSU_lib}/sst_identify_markup" # sst_identify_markup.rb
- puts SiSU_Markup::Markup_history.new(@opt).query
- elsif @opt.mod.inspect =~/--identify/
- require "#{SiSU_lib}/sst_identify_markup" # sst_identify_markup.rb
- markup_version=SiSU_Markup::Markup_identify.new(@opt).markup_version?
- elsif @opt.mod.inspect =~/--about/ #% help instructions
- if @opt.mod.inspect =~/--about/ \
- and not @opt.what.empty?
- SiSU_Help::Help.new(@opt.what,'color_off').help_request
- else SiSU_Help::Help.new('list','color_off').help_request
- end
- elsif @opt.mod.inspect =~/--sitemaps/ #% sitemaps
- require "#{SiSU_lib}/sitemaps" # sitemaps.rb
- SiSU_Sitemaps::Source.new(@opt).read
- if @opt.cmd =~/R/
- require "#{SiSU_lib}/remote" # remote.rb
- SiSU_Remote::Put.new(@opt).rsync_sitemaps
- end
- else #% help instructions
- unless @opt.mod.inspect =~/--convert|--to|--from|--harvest/
- if @opt.mod.inspect =~/--help/ \
- and not @opt.what.empty?
- SiSU_Help::Help.new(@opt.what).help_request
- elsif @opt.mod.inspect =~/--help/; SiSU_Help::Help.new('list').help_request
- else SiSU_Help::Help.new('env',@opt).sisu_version
- tell=SiSU_Screen::Ansi.new(''," for HELP type:\n\tsisu --help [help request]\n\tman sisu\n or see the system or online documentation on SiSU:\n #{Config::CONFIG['datadir']}/doc/sisu/\n <http://www.jus.uio.no/sisu/>\n <http://sisudoc.org/>"); tell.puts_grey
- end
- end
- end
- @opt.files.each do |fns|
- if FileTest.file?(fns)
- @opt.fns=fns
- unless @opt.fns =~ /(?:\.(?:(?:-|ssm\.)?sst|ssm|ssp|sx[sdn]\.xml|termsheet.rb)|\S+?\.ss[mt]\.zip|sisupod(?:\.zip)?|\S+?\.ssp)$/
- if @opt.fns=~/\.kdi$/ \
- and @opt.mod.inspect =~/--(?:convert(?:-from)?|from)[=-]kdi/
- elsif @opt.fns=~/\.sx[sdn]\.xml$/ \
- and @opt.mod.inspect =~/--(?:(?:convert(?:-from)?|from)[=-])?(?:xml2sst|sxml)/
- elsif @opt.fns=~/\.ssi$/ \
- and @opt.mod.inspect =~/--identify/
- else Operations.new(@opt).not_recognised
- end
- end
- if @opt.fns =~/\.ssm\.sst$/ \
- and @opt.cmd !~/[S_M]/ # rework necessry, revist, the _ flag is a hack, to keep ._sst files
- @msg,@msgs='temporary file removed',nil
- @tell.call.warn unless @opt.cmd =~/V/
- File.unlink(@opt.fns) if File.exist?(@opt.fns) #CONSIDER
- end
- else #Operations.new(fns,'html').not_found
- end
- end
- end
- end
- begin #% select what to do
- if RUBY_VERSION < '1.9'
- require 'jcode'
- $KCODE='UTF8'
- end
- require "#{SiSU_lib}/constants" # constants.rb
- require "#{SiSU_lib}/options" # options.rb
- require "#{SiSU_lib}/sysenv" # sysenv.rb
- include SiSU_Env; include SiSU_Screen
- require "#{SiSU_lib}/param" # param.rb
- include SiSU_Param
- require "#{SiSU_lib}/defaults" # defaults.rb
- include SiSU_Viz
- require "#{SiSU_lib}/help" # help.rb
- include SiSU_Help
- require 'uri'
- home=ENV['HOME']
- argv=$*
- @opt=SiSU_commandline::Options.new(argv)
- Processing.new(@opt).actions
- rescue; STDERR.puts SiSU_Screen::Ansi.new(@opt,$!,$@,nil).rescue #fix
- ensure
- Dir.chdir(@@pwd)
- end
-end
-__END__
diff --git a/lib/sisu/v2/manifest.rb b/lib/sisu/v2/manifest.rb
deleted file mode 100644
index 82756e6..0000000
--- a/lib/sisu/v2/manifest.rb
+++ /dev/null
@@ -1,713 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: summary of generated outputs and metadata
-
-=end
-module SiSU_Manifest
- require "#{SiSU_lib}/sysenv" # sysenv.rb
- include SiSU_Env
- require "#{SiSU_lib}/i18n" # i18n.rb
- require "#{SiSU_lib}/particulars" # particulars.rb
- include SiSU_Particulars
- require "#{SiSU_lib}/html_minitoc" # html_minitoc.rb
- require "#{SiSU_lib}/html" # html.rb
- include SiSU_HTML_Format
- require "#{SiSU_lib}/param" # param.rb
- include SiSU_Param
- include SiSU_Viz
- class Source
- def initialize(opt)
- @opt=opt
- @particulars=SiSU_Particulars::Combined_singleton.instance.get_all(opt)
- l=SiSU_Env::Standardise_language.new.file_to_language(@opt.fns)
- @doc_language=l[:l]
- end
- def read
- begin
- @env=SiSU_Env::Info_env.new(@opt.fns)
- @md=SiSU_Param::Parameters.new(@opt).get
- SiSU_Env::Info_skin.new(@md).select
- xbrowser=@env.program.web_browser
- browser=@env.program.console_web_browser
- webserv_url=@env.path.url.output_tell
- unless @opt.cmd =~/q/
- url_html="#{webserv_url}/#{@md.fnb}/#{@md.fn[:manifest]}"
- @opt.cmd=~/[MVvz]/ \
- ? SiSU_Screen::Ansi.new(@opt.cmd,'Manifest',"#{xbrowser} #{url_html}").green_hi_blue \
- : SiSU_Screen::Ansi.new(@opt.cmd,'Manifest',@opt.fns).green_title_hi
- SiSU_Screen::Ansi.new(@opt.cmd,"#{browser} #{url_html}").grey_tab if @opt.cmd =~/v/i
- end
- data=SiSU_HTML::Source::Html_environment.new(@particulars).tuned_file_instructions
- Output_Info.new(@md).check_output(data)
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- end
- end
- private
- class Output_Info <Source
- def initialize(md)
- @manifest={ :txt=>[],:html=>[] }
- @md,@fns=md,md.fns
- @env=SiSU_Env::Info_env.new(@md.fns)
- @fnb=@md.fnb
- @base_url,@base_url_src,@base_url_pod,@base_url_epub="#{@env.url.root}/#{@fnb}",@env.url.src_txt,@env.url.src_pod,@env.url.epub
- @base_path,@base_path_src,@base_path_pod,@base_path_epub="#{@env.path.output}/#{@fnb}",@env.path.output_src,@env.path.output_pod,@env.path.output_epub
- @@dg ||=SiSU_Env::Info_env.new.digest.type
- @dg=@@dg
- l=SiSU_Env::Standardise_language.new.file_to_language(@md.fns)
- @language=l[:l]
- @translate=SiSU_Translate::Source.new(@md,@language)
- @brace_url=SiSU_Viz::Skin.new.url_decoration
- end
- def output
- SiSU_Env::SiSU_file.new(@md).mkdir
- manifest=SiSU_Env::SiSU_file.new(@md,@md.fn[:manifest]).mkfile
- @manifest[:html].each do |x|
- manifest << x
- end
- end
- def summarize(id,file,img='● ')
- size=(File.size("#{@base_path}/#{file}")/1024.00).to_s
- kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1]
- @manifest[:txt] << "#{file} #{id} #{kb}\n"
- @manifest[:html] << %{<tr><th class="left"><p class="norm"><a href="#{file}">#{img}#{id}</a></p></th><td><p class="small"><a href="#{file}">#{file}</a></p><p class="tiny">#{@brace_url.xml_open}<a href="#{@base_url}/#{file}">#{@base_url}/#{file}</a>#{@brace_url.xml_close}</p></td><td class="right"><p class="right">#{kb}</p></td></tr>\n}
- end
- def summarize_epub(id,file,img='● ')
- size=(File.size("#{@base_path_epub}/#{file}")/1024.00).to_s
- kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1]
- @manifest[:txt] << "#{file} #{id} #{kb}\n"
- @manifest[:html] << %{<tr><th class="left"><p class="norm"><a href="../epub/#{file}">#{img}#{id}</a></p></th><td><p class="small"><a href="../epub/#{file}">#{file}</a></p><p class="tiny">#{@brace_url.xml_open}<a href="#{@base_url_epub}/#{file}">#{@base_url_epub}/#{file}</a>#{@brace_url.xml_close}</p></td><td class="right"><p class="right">#{kb}</p></td></tr>\n}
- end
- def summarize_source(id,file)
- sys=SiSU_Env::System_call.new
- dgst =if @dg =~/^sha(?:2|256)$/; sys.sha256("#{@base_path_src}/#{file}")
- else sys.md5("#{@base_path_src}/#{file}")
- end
- SiSU_Screen::Ansi.new(@md.cmd,"#{dgst[1]} #{file}").warn if @md.cmd =~/[vVM]/
- size=(File.size("#{@base_path_src}/#{file}")/1024.00).to_s
- kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1]
- @manifest[:txt] << "#{file} #{id} #{kb}\n"
- @manifest[:html] << %{<tr><th class="left"><p class="norm"><a href="../src/#{file}">#{id}</a></p></th><td class="right"><p class="tiny"><a href="../src/#{file}">#{file}</a> &nbsp;&nbsp;#{dgst[1]}<br />#{@brace_url.xml_open}<a href="#{@base_url_src}/#{file}">#{@base_url_src}/#{file}</a>#{@brace_url.xml_close}</p></td><td class="right"><p class="right">#{kb}</p>
- </td></tr>\n} if kb and kb =~/\d+/
- end
- def summarize_pod(id,file)
- sys=SiSU_Env::System_call.new
- dgst =if @dg =~/^sha(?:2|256)$/; sys.sha256("#{@base_path_pod}/#{file}")
- else sys.md5("#{@base_path_pod}/#{file}")
- end
- SiSU_Screen::Ansi.new(@md.cmd,"#{dgst[1]} #{file}").warn if @md.cmd =~/[vVM]/
- size=(File.size("#{@base_path_pod}/#{file}")/1024.00).to_s
- kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1]
- @manifest[:txt] << "#{file} #{id} #{kb}\n"
- @manifest[:html] << %{<tr><th class="left"><p class="norm"><a href="../pod/#{file}">#{id}</a></p></th><td class="right"><p class="tiny"><a href="../pod/#{file}">#{file}</a> &nbsp;&nbsp;#{dgst[1]}<br />#{@brace_url.xml_open}<a href="#{@base_url_pod}/#{file}">#{@base_url_pod}/#{file}</a>#{@brace_url.xml_close}</p></td><td class="right"><p class="right">#{kb}</p>
- </td></tr>\n} if kb and kb =~/\d+/
- end
- def languages(id,file)
- flv=@env.published_manifests?(@base_path)
- @manifest[:html] << %{<tr><th class="left"><div id="horizontal_links"><ul id="horizontal">\n}
- flv.each do |l|
- lang=SiSU_Translate::Source.new(@md,@language,l[:l]).language_list
- @manifest[:txt] << "#{l[:m]} #{lang}\n"
- @manifest[:html] << %{<li class="norm"><a href="#{l[:m]}">#{lang}</a>&nbsp;&nbsp;&nbsp;</li>}
- end
- @manifest[:html] << %{</ul></div></th></tr>\n}
- end
- def published_languages(id,file)
- flv=@env.published_manifests?(@base_path)
- flv.each do |l|
- lang=SiSU_Translate::Source.new(@md,@language,l[:l]).language_list
- @manifest[:txt] << "#{l[:m]} #{lang}\n"
- @manifest[:html] << %{<tr><th class="left"><p class="bold"><a href="#{l[:m]}">#{lang}</a></p></th><td><p class="norm">#{lang}</p><p class="tiny">#{@brace_url.xml_open}<a href="#{@base_url}/#{l[:m]}">#{@base_url}/#{l[:m]}</a>#{@brace_url.xml_close}</p></td><td class="right"><p class="right">&nbsp;</p></td></tr>\n}
- end
- end
- def metadata(id,info)
- info.to_s.gsub!(/#{Mx[:br_line]}/,'<br />')
- @manifest[:html] << %{<tr><th class="left"><p class="bold_left">#{id}:</p></th><td><p class="left">#{info}</p></td></tr>\n}
- end
- def links(url,lnk,target)
- static=if url =~/^\.\//; url.gsub(/^\.(\.)?/,@base_url)
- elsif url =~/^\.\.\//; url.gsub(/^\.(\.)?/,@env.url.root)
- else url
- end
- @manifest[:html] << %{<tr><th class="right" width=5%><p class="norm">●</p></th><td class="left"><p class="norm"><a href="#{url}">#{lnk}</a></p><p class="tiny">&nbsp;&nbsp;#{@brace_url.xml_open}<a href="#{static}">#{static}</a>#{@brace_url.xml_close}</p></td></tr>\n}
- end
- def output_tests
- if FileTest.file?("#{@base_path}/#{@md.fn[:toc]}")==true
- img='<img border="0" height="18" width="15" src="../_sisu/image_sys/b_toc.png" alt="TOC linked" /> '
- id,file='HTML, table of contents (for segmented text)',@md.fn[:toc]
- summarize(id,file,img)
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:doc]}")==true
- img='<img border="0" height="15" width="15" src="../_sisu/image_sys/b_doc.png" alt="Full Text" /> '
- id,file='HTML, full length document',@md.fn[:doc]
- summarize(id,file,img)
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:book_index]}")==true
- id,file='HTML, (book type) index',@md.fn[:book_index]
- summarize(id,file)
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:concordance]}")==true
- id,file='HTML, concordance file',@md.fn[:concordance]
- summarize(id,file)
- end
- if FileTest.file?("#{@base_path_epub}/#{@md.fn[:epub]}")==true
- img='<img border="0" height="18" width="18" src="../_sisu/image_sys/b_epub.png" alt="EPUB" /> '
- id,file='EPUB (Electronic Publication, e-book standard)',@md.fn[:epub]
- summarize_epub(id,file,img)
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:pdf_p_letter]}")==true
- img='<img border="0" height="18" width="15" src="../_sisu/image_sys/b_pdf.png" alt="PDF portrait" /> '
- id,file="PDF, U.S. letter size, portrait/vertical document (recommended for printing)",@md.fn[:pdf_p_letter]
- summarize(id,file,img)
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:pdf_l_letter]}")==true
- img='<img border="0" height="15" width="18" src="../_sisu/image_sys/b_pdf.png" alt="PDF landscape" /> '
- id,file="PDF, U.S. letter size, landscape/horizontal document (recommended for screen viewing)",@md.fn[:pdf_l_letter]
- summarize(id,file,img)
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:pdf_p_a4]}")==true
- img='<img border="0" height="18" width="15" src="../_sisu/image_sys/b_pdf.png" alt="PDF portrait" /> '
- id,file="PDF, A4 size, portrait/vertical document (recommended for printing)",@md.fn[:pdf_p_a4]
- summarize(id,file,img)
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:pdf_l_a4]}")==true
- img='<img border="0" height="15" width="18" src="../_sisu/image_sys/b_pdf.png" alt="PDF landscape" /> '
- id,file="PDF, A4 size, landscape/horizontal document (recommended for screen viewing)",@md.fn[:pdf_l_a4]
- summarize(id,file,img)
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:pdf_p_a5]}")==true
- img='<img border="0" height="18" width="15" src="../_sisu/image_sys/b_pdf.png" alt="PDF portrait" /> '
- id,file="PDF, A5 (book) size, portrait/vertical document (recommended for printing)",@md.fn[:pdf_p_a5]
- summarize(id,file,img)
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:pdf_l_a5]}")==true
- img='<img border="0" height="15" width="18" src="../_sisu/image_sys/b_pdf.png" alt="PDF landscape" /> '
- id,file="PDF, A5 (book) size, landscape/horizontal document (recommended for screen viewing)",@md.fn[:pdf_l_a5]
- summarize(id,file,img)
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:pdf_p_b5]}")==true
- img='<img border="0" height="18" width="15" src="../_sisu/image_sys/b_pdf.png" alt="PDF portrait" /> '
- id,file="PDF, B5 (book) size, portrait/vertical document (recommended for printing)",@md.fn[:pdf_p_b5]
- summarize(id,file,img)
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:pdf_l_b5]}")==true
- img='<img border="0" height="15" width="18" src="../_sisu/image_sys/b_pdf.png" alt="PDF landscape" /> '
- id,file="PDF, B5 (book) size, landscape/horizontal document (recommended for screen viewing)",@md.fn[:pdf_l_b5]
- summarize(id,file,img)
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:pdf_p_legal]}")==true
- img='<img border="0" height="18" width="15" src="../_sisu/image_sys/b_pdf.png" alt="PDF portrait" /> '
- id,file="PDF, U.S. legal size, portrait/vertical document (recommended for printing)",@md.fn[:pdf_p_legal]
- summarize(id,file,img)
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:pdf_l_legal]}")==true
- img='<img border="0" height="15" width="18" src="../_sisu/image_sys/b_pdf.png" alt="PDF landscape" /> '
- id,file="PDF, U.S. legal size, landscape/horizontal document (recommended for screen viewing)",@md.fn[:pdf_l_legal]
- summarize(id,file,img)
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:odf]}")==true
- img='<img border="0" height="18" width="18" src="../_sisu/image_sys/b_odf.png" alt="ODF/ODT" /> '
- id,file='ODF:ODT (Open Document Format)',@md.fn[:odf]
- summarize(id,file,img)
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:xhtml]}")==true
- id,file='XHTML',@md.fn[:xhtml]
- summarize(id,file)
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:sax]}")==true
- id,file='XML SAX',@md.fn[:sax]
- summarize(id,file)
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:dom]}")==true
- id,file='XML DOM',@md.fn[:dom]
- summarize(id,file)
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:plain]}")==true
- if @md.cmd =~/a/; id,file='Plaintext (Unix (UTF-8) with footnotes)',@md.fn[:plain]
- elsif @md.cmd =~/e/; id,file='Plaintext (Unix (UTF-8) with endnotes)',@md.fn[:plain]
- elsif @md.cmd =~/A/; id,file='Plaintext (dos (UTF-8) with footnotes)',@md.fn[:plain]
- elsif @md.cmd =~/E/; id,file='Plaintext (dos (UTF-8) with endnotes)',@md.fn[:plain]
- else id,file='Plaintext (UTF-8)',@md.fn[:plain]
- end
- summarize(id,file)
- end
- if FileTest.file?("#{@base_path}/#{@md.fns}.tex")==true
- id,file='LaTeX (portrait)',"#{@md.fns}.tex"
- summarize(id,file)
- end
- if FileTest.file?("#{@base_path}/#{@md.fns}.tex")==true
- id,file='LaTeX (landscape)',"#{@md.fns}.landscape.tex"
- summarize(id,file)
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:digest]}")==true
- id,file="Digest/DCC - Document Content Certificate (#{@dg})",@md.fn[:digest]
- summarize(id,file)
- end
- end
- def published_versions
- if FileTest.file?("#{@base_path}/sisu_manifest.html")==true
- id,file='Markup (SiSU source)',@md.fns
- languages(id,file)
- end
- end
- def language_versions
- if FileTest.file?("#{@base_path}/sisu_manifest.html")==true
- id,file='Markup (SiSU source)',@md.fns
- published_languages(id,file)
- end
- end
- def source_tests
- if @md.fns =~/\.ssm\.sst$/ #% decide whether to extract and include requested/required documents
- req=@md.fns
- if FileTest.file?("#{@base_path_src}/#{req}")==true
- id,file='Markup Composite File (SiSU source)',req
- summarize_source(id,file)
- end
- else
- if FileTest.file?("#{@base_path_src}/#{@md.fns}")==true
- id,file='Markup (SiSU source)',@md.fns
- summarize_source(id,file)
- end
- end
- if FileTest.file?("#{@base_path_pod}/#{@md.fn[:sisupod]}")==true
- id,file='SiSU doc (zip)',@md.fn[:sisupod]
- summarize_pod(id,file)
- end
- if FileTest.file?("#{@base_path}/#{@md.fnb}")==true \
- and @md.fnb =~/\.kdi$/
- id,file='Kdissert (.kdi source)',@md.fnb
- summarize_pod(id,file)
- end
- end
- def metadata_tests
- if defined? @md.title.full \
- and @md.title.full=~/\S+/
- id,info=@translate.full_title,@md.title.full
- metadata(id,info)
- end
- if defined? @md.creator.author \
- and @md.creator.author=~/\S+/
- id,info=@translate.author,@md.creator.author
- metadata(id,info)
- end
- if defined? @md.creator.contributor \
- and @md.creator.contributor=~/\S+/
- id,info=@translate.contributor,@md.creator.contributor
- metadata(id,info)
- end
- if defined? @md.creator.translator \
- and @md.creator.translator=~/\S+/
- id,info=@translate.translator,@md.creator.translator
- metadata(id,info)
- end
- if defined? @md.creator.illustrator \
- and @md.creator.illustrator=~/\S+/
- id,info=@translate.illustrator,@md.creator.illustrator
- metadata(id,info)
- end
- if defined? @md.publisher \
- and @md.publisher=~/\S+/ #dc
- id,info=@translate.publisher,@md.publisher
- metadata(id,info)
- end
- if defined? @md.creator.prepared_by \
- and @md.creator.prepared_by=~/\S+/
- id,info=@translate.prepared_by,@md.creator.prepared_by
- metadata(id,info)
- end
- if defined? @md.creator.digitized_by \
- and @md.creator.digitized_by=~/\S+/
- id,info=@translate.digitized_by,@md.creator.digitized_by
- metadata(id,info)
- end
- if defined? @md.classify.subject \
- and @md.classify.subject=~/\S+/
- id,info=@translate.subject,@md.classify.subject
- metadata(id,info)
- end
- if defined? @md.notes.description \
- and @md.notes.description=~/\S+/
- id,info=@translate.description,@md.notes.description
- metadata(id,info)
- end
- if defined? @md.notes.abstract \
- and @md.notes.abstract=~/\S+/
- id,info=@translate.abstract,@md.notes.abstract
- metadata(id,info)
- end
- if defined? @md.type \
- and @md.type=~/\S+/ #dc
- id,info=@translate.type,@md.type
- metadata(id,info)
- end
- if defined? @md.rights.all \
- and @md.rights.all=~/\S+/ #dc
- id,info=@translate.rights,@md.rights.all
- metadata(id,info)
- end
- if defined? @md.date.published
- if defined? @md.date.published \
- and @md.date.published=~/\S+/ #dc
- id,info=@translate.date,@md.date.published
- metadata(id,info)
- end
- if defined? @md.date.created \
- and @md.date.created=~/\S+/ #dc
- id,info=@translate.date_created,@md.date.created
- metadata(id,info)
- end
- if defined? @md.date.issued \
- and @md.date.issued=~/\S+/ #dc
- id,info=@translate.date_issued,@md.date.issued
- metadata(id,info)
- end
- if defined? @md.date.available \
- and @md.date.available=~/\S+/ #dc
- id,info=@translate.date_available,@md.date.available
- metadata(id,info)
- end
- if defined? @md.date.modified \
- and @md.date.modified=~/\S+/ #dc
- id,info=@translate.date_modified,@md.date.modified
- metadata(id,info)
- end
- if defined? @md.date.valid \
- and @md.date.valid=~/\S+/ #dc
- id,info=@translate.date_valid,@md.date.valid
- metadata(id,info)
- end
- end
- if defined? @md.title.language \
- and @md.title.language=~/\S+/
- id,info=@translate.language,@md.title.language
- metadata(id,info)
- end
- if defined? @md.original.language \
- and @md.original.language=~/\S+/
- id,info=@translate.language_original,@md.original.language
- metadata(id,info)
- end
- if defined? @md.classify.format \
- and @md.classify.format=~/\S+/
- id,info=@transate.format,@md.classify.format
- metadata(id,info)
- end
- if defined? @md.classify.identifier \
- and @md.classify.identifier=~/\S+/
- id,info=@translate.identifier,@md.classify.identifier
- metadata(id,info)
- end
- if defined? @md.original.source \
- and @md.original.source=~/\S+/
- id,info=@translate.source,@md.original.source
- metadata(id,info)
- end
- if defined? @md.classify.relation \
- and @md.classify.relation=~/\S+/
- id,info=@translate.relation,@md.classify.relation
- metadata(id,info)
- end
- if defined? @md.classify.coverage \
- and @md.classify.coverage=~/\S+/
- id,info=@translate.coverage,@md.classify.coverage
- metadata(id,info)
- end
- if defined? @md.classify.keywords \
- and @md.classify.keywords=~/\S+/
- id,info=@translate.keywords,@md.classify.keywords
- metadata(id,info)
- end
- if defined? @md.notes.comment \
- and @md.notes.comment=~/\S+/
- id,info=@translate.comments,@md.notes.comment
- metadata(id,info)
- end
- if defined? @md.classify.loc \
- and @md.classify.loc=~/\S+/
- id,info=@translate.cls_loc,@md.classify.loc
- metadata(id,info)
- end
- if defined? @md.classify.dewey \
- and @md.classify.dewey=~/\S+/
- id,info=@translate.cls_dewey,@md.classify.dewey
- metadata(id,info)
- end
- if defined? @md.classify.oclc \
- and @md.classify.oclc=~/\S+/
- id,info=@translate.cls_oclc,@md.classify.oclc
- @manifest[:html] << %{<tr><th class="left"><p class="bold_left">#{id}:</p></th><td>\n}
- @manifest[:html] << %{<p class="left"><a href="http://worldcat.org/oclc/#{info}">#{info}</a></p>\n}
- @manifest[:html] << %{</td></tr>\n}
- end
- if defined? @md.classify.pg \
- and @md.classify.pg=~/\S+/
- id,info=@translate.cls_gutenberg,@md.classify.pg
- metadata(id,info)
- end
- if defined? @md.classify.isbn \
- and @md.classify.isbn=~/\S+/
- id,info=@translate.cls_isbn,@md.classify.isbn
- metadata(id,info)
- end
- if defined? @md.notes.prefix_a \
- and @md.notes.prefix_a=~/\S+/
- id,info=@translate.prefix_a,@md.notes.prefix_a
- metadata(id,info)
- end
- if defined? @md.notes.prefix_b \
- and @md.notes.prefix_b=~/\S+/
- id,info=@translate.prefix_b,@md.notes.prefix_b
- metadata(id,info)
- end
- if defined? @md.topic_register_array \
- and @md.topic_register_array.length > 0
- @manifest[:html] << %{<tr><th class="left"><p class="bold_left">#{@translate.topic_register}:</p></th><td>\n}
- @md.topic_register_array.each do |t|
- t.each_with_index do |st,i|
- if st.class==Array
- st.each do |v|
- @manifest[:html] << %{<p class="it#{i}">#{v}</p>\n}
- end
- else @manifest[:html] << %{<p class="it#{i}">#{st}</p>\n}
- end
- end
- end
- @manifest[:html] << %{</td></tr>\n}
- end
- if @md.fns
- id,info=@translate.sourcefile,@md.fns
- metadata(id,info)
- end
- if @md.en[:mismatch] > 0
- id,info='WARNING document error in endnote markup, number mismatch',"endnotes: #{@md.en[:note]} != endnote reference marks: #{@md.en[:mark]} (difference = #{@md.en[:mismatch]})"
- metadata(id,info)
- end
- if @md.wc_words
- id,info=@translate.word_count,@md.wc_words
- metadata(id,info)
- end
- if @md.dgst
- id,info="#{@translate.sourcefile_digest} (#{@dg})",@md.dgst[1]
- metadata(id,info)
- end
- if @md.sc_number
- id,info=@translate.sc_number,@md.sc_number
- metadata(id,info)
- end
- if @md.sc_date
- id,info=@translate.sc_date,"#{@md.sc_date} at #{@md.sc_time}"
- metadata(id,info)
- end
- if @md.generated
- id,info=@translate.last_generated,@md.generated
- metadata(id,info)
- end
- if @md.sisu_version
- id,info=@translate.sisu_version,"#{@md.sisu_version[:project]} #{@md.sisu_version[:version]} #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})"
- metadata(id,info)
- end
- if @md.ruby_version
- id,info=@translate.ruby_version,@md.ruby_version
- metadata(id,info)
- end
- end
- def links_tests
- if defined? @md.lnk \
- and @md.lnk
- @md.lnk.each do |l|
- if defined? l[:say]
- target=if l[:url] !~/^\.(\.)?\//; 'external'
- else '_top'
- end
- url,lnk=l[:url],l[:say]
- unless url.nil? \
- or url.empty?
- links(url,lnk,target)
- end
- end
- end
- end
- end
- def check_output(data)
- begin
- minitoc=SiSU_HTML_minitoc::Toc_mini.new(@md,data).songsheet.join("\n")
- id,file='',''
- vz=SiSU_Env::Get_init.instance.skin
- banner_table=if vz.banner_home_button_only !~ /http:\/\/www\.jus\.uio\.no\/sisu/ \
- and vz.banner_home_button_only !~ /sisu\.home\.png/
-<<WOK
-<table summary="band" border="0" cellpadding="3" cellspacing="0">
-<tr><td align="left" width="15%" bgcolor="#ffffff">#{vz.banner_band}</td>
-<td width="70%"><p class="tiny">#{@brace_url.xml_open}<a href="#{@base_url}/#{file}">#{@base_url}/#{file}</a>#{@brace_url.xml_close}</p></td>
-<td>#{@env.widget_static.search_form}</td></tr>
-</table>
-WOK
-#<<WOK
-#<table summary="band" width="100%" border="0" cellpadding="3" cellspacing="0">
-#<tr><td align="left" bgcolor="#ffffff">#{vz.banner_band}</td><td width="60%"><p class="tiny">#{@brace_url.xml_open}<a href="#{@base_url}/#{file}">#{@base_url}/#{file}</a>#{@brace_url.xml_close}</p></td><td width="20%">#{@env.widget_static.search_form}</td><td><a href="http://www.jus.uio.no/sisu/" target="_top"><img border="0" src="#{vz.url_path_image_sys}/sisu.png" alt="SiSU --&gt;" /></a></td></tr>
-#</table>
-#WOK
- else
-<<WOK
-<table summary="band" border="0" cellpadding="3" cellspacing="0">
-<tr><td align="left" bgcolor="#ffffff"><a href="http://www.jus.uio.no/sisu/" target="_top"><img border="0" src="#{vz.url_path_image_sys}/sisu.png" alt="SiSU --&gt;" /></a></td>
-<td><p class="tiny">#{@brace_url.xml_open}<a href="#{@base_url}/#{file}">#{@base_url}/#{file}</a>#{@brace_url.xml_close}</p></td>
-<td>#{@env.widget_static.search_form}</td></tr>
-</table>
-WOK
- end
- @manifest[:html] <<<<WOK
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<title>
-SiSU manifest: #{@md.title.full}
-</title>
-<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
-<meta name="sourcefile" content="#{@md.fns}" />
-<link rel="generator" href="http://www.jus.uio.no/sisu" />
-<link rel="shortcut icon" href="../_sisu/image_sys/rb7.ico" />
-<link rel="stylesheet" href="../#{@env.path.style}/html.css" type="text/css" />
-</head>
-<body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en">
-#{banner_table}
-WOK
- if @env.manifest_minitoc?
- @manifest[:html] <<<<WOK
-<div class="toc">
-#{minitoc.to_s}
-</div>
-<div class="content">
-WOK
- else
- @manifest[:html] <<<<WOK
-<div>
-WOK
- end
- @manifest[:html] <<<<WOK
-<h1 class="small">#{@translate.manifest_description}</h1>
-<h2 class="small">#{@md.title.full}</h2>
-<p class="bold">#{@md.author}</p>
-<p class="small">
-&nbsp;&nbsp;<a href="#output">Document, Available Filetypes</a>
-</p>
-<p class="small">
-&nbsp;&nbsp;<a href="#metadata">Document Metadata</a>
-</p>
-<p class="tiny">
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#links">(metadata suggested links (if any)</a>
-</p>
-<table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">
-WOK
- published_versions
- @manifest[:html] << '</table>'
- @manifest[:html] <<<<WOK
-<h2 class="small"><a name="output">#{@translate.manifest_description_output}</a></h2>
-<table summary="available output/filetypes" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">
-<tr> <th class="left"><p class="bold">#{@translate.filetype_description}</p></th><th class="left"><p class="bold">#{@translate.filename}</p></th><th class="right"><p class="right"><b>#{@translate.file_size}</b></p><p class="tiny_right">(kB)</p></th></tr>
-
-WOK
- output_tests
- @manifest[:html] << '</table>'
- @manifest[:html] <<<<WOK
-<table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">
-WOK
- source_tests
- @manifest[:html] << '</table>'
- @manifest[:html] <<<<WOK
-<h2 class="small"><a name="metadata">#{@translate.manifest_description_metadata}</a></h2>
-<table summary="document metadata" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">
-<tr> <th class="left"><p class="bold">#{@translate.metadata}</p></th><th class="left"><p class="bold">#{@translate.description}</p></th></tr>
-WOK
- metadata_tests
- @manifest[:html] <<<<WOK
-</table>
-WOK
- @manifest[:html] <<<<WOK
-<p class="bold"><a name="links">#{@translate.suggested_links}:</a></p>
-<table summary="suggested links" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">
-WOK
- links_tests
- @manifest[:html] <<<<WOK
-</table>
-WOK
- @manifest[:html] <<<<WOK
-<h2 class="small"><a name="languages">#{@translate.language_version_list}</a></h2>
-<table summary="language versions" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">
-<tr> <th class="left"><p class="bold">#{@translate.filename}</p></th><th class="left"><p class="bold">#{@translate.description}</p></th><th class="right"><p class="right">&nbsp;</p></th></tr>
-
-WOK
- language_versions
- @manifest[:html] <<<<WOK
-</table>
-</div>
-<div>
-<br />
-#{vz.credits_sisu_manifest}
-</div>
-</body>
-</html>
-WOK
- output
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error
- ensure
- end
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/v2/manpage.rb b/lib/sisu/v2/manpage.rb
deleted file mode 100644
index f9c7522..0000000
--- a/lib/sisu/v2/manpage.rb
+++ /dev/null
@@ -1,420 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: manpage text generation, stripped manpage output (unix,
- linefeed)
-
-=end
-module SiSU_Manpage
- require "#{SiSU_lib}/dal" # dal.rb
- require "#{SiSU_lib}/sysenv" # sysenv.rb
- include SiSU_Env
- include SiSU_Param
- include SiSU_Viz
- require "#{SiSU_lib}/manpage_format" # manpage_format.rb
- include SiSU_Manpage_format
- require "#{SiSU_lib}/shared_metadata" # shared_metadata.rb
- require "#{SiSU_lib}/shared_txt" # shared_txt.rb
- pwd=Dir.pwd
- @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0
- @@tablefoot=''
- class Source
- def initialize(opt)
- @opt=opt
- if @opt.fns =~/(.+?)\.(?:-|ssm\.)?sst$/
- @@dostype='unix endnotes'
- else puts "#{sf} not a processed file type"
- end
- end
- def read
- begin
- @md=SiSU_Param::Parameters.new(@opt).get
- @env=SiSU_Env::Info_env.new(@opt.fns)
- path=@env.path.output_tell
- tool=(@opt.cmd =~/[MVv]/) \
- ? "#{@env.program.text_editor} #{path}/man/#{@md.fn[:manpage]}" \
- : ''
- SiSU_Screen::Ansi.new(@opt.cmd,'Manpage',tool).green_hi_blue unless @opt.cmd =~/q/
- SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/man/#{@md.fn[:manpage]}").flow if @opt.cmd =~/[MV]/
- my_make=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns)
- @dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here
- SiSU_Manpage::Source::Scroll.new(@md,@dal_array).songsheet
- SiSU_Env::Info_skin.new(@md).select #watch
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- end
- end
- private
- class Scroll <Source
- require "#{SiSU_lib}/defaults" # defaults.rb
- require "#{SiSU_lib}/shared_txt" # shared_txt.rb
- include SiSU_text_utils
- @@endnotes={ :para=>[],:end=>[] }
- def initialize(md,data)
- @md,@data=md,data
- @brace_url=SiSU_Viz::Skin.new.url_decoration
- @vz=SiSU_Env::Get_init.instance.skin
- @tab="\t"
- @br="\n"
- @@dostype='unix endnotes'
- @manpage={ :body=>[],:open=>[],:close=>[],:head=>[],:metadata=>[],:tail=>[],:endnotes=>[] }
- end
- def songsheet
- manpage=markup(@data)
- publish(manpage)
- end
- # Used for extraction of endnotes from paragraphs
- def extract_endnotes(para='')
- notes=para.scan(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})([\d*+]+\s+.+?)\s*(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m)
- @n=[]
- notes.each do |n| #high cost to deal with <br> appropriately within manpage, consider
- n=n.dup.to_s
- if n =~/#{Mx[:br_line]}/
- fix = n.split(/\s*#{Mx[:br_line]}+\s*/) #watch #added
- fix.each do |x|
- unless x.empty?; @n << x
- end
- end
- else @n << n
- end
- end
- notes=@n.flatten
- notes.each do |e|
- util=if e.to_s =~/^\[[\d*+]+\]:/; SiSU_text_utils::Wrap.new(e.to_s,78,4,1)
- else SiSU_text_utils::Wrap.new(e.to_s,78,0,1)
- end
- wrap=util.line_wrap
- if wrap =~ /^\s*[\d*+]+\s+.+?\s*\Z/m
- wrap.gsub!(/(^|&nbsp;|#{Mx[:nbsp]}|\s|\*)\\\*/,'\1\\\\\*') #man page requires
- wrap.gsub!(/\s\.(\S+)/,' \\.\1')
- wrap.gsub!(/^\s*([\d*+]+)\s+(.+?)\s*\Z/m, <<GSUB
-.TP
-.BI \\1.
-\\2
-GSUB
- )
- else
- wrap.gsub!(/^\s*(.+)\Z/m, <<GSUB
-\\1
-GSUB
- )
- end
- @@endnotes[:para] << wrap
- @@endnotes[:end] << wrap << "\n.br"
- @@endnotes
- end
- end
- def manpage_metadata
- @manpage[:metadata]=Metadata::Summary.new(@md).manpage.metadata
- end
- def manpage_tail
- SiSU_Env::Info_skin.new(@md).select
- vz=SiSU_Env::Get_init.instance.skin
- generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version]
- lastdone="Last Generated on: #{Time.now}"
- rubyv="Ruby version: #{@md.ruby_version}"
- sc=if @md.sc_info
- "Source file: #{@md.sc_filename}#{@br}Version number: #{@md.sc_number}#{@br}Version date: #{@md.sc_date}#{@br}"
- else ''
- end
- @manpage[:tail] <<<<WOK
-#{@br}
-.TP
-Other versions of this document:
-.TP
-manifest: <#{vz.url_root_http}/#{@md.fnb}/#{@md.fn[:manifest]}>
-.TP
-at: <#{vz.url_site}>
-.TP
-#{sc}
-.TP
-* #{generator}
-.TP
-* #{rubyv}
-.TP
-* #{lastdone}
-.TP
-* SiSU #{vz.url_sisu}
-WOK
- end
- def manpage_structure(dob='',hname='') #% Used to extract the structure of a document
- if dob.is=='heading'
- lv=dob.ln
- n=dob.ln - 1
- n3=dob.ln + 2
- else lv=nil
- end
- wrapped=if dob.is=='para' \
- or dob.is=='heading'
- paragraph=dob.obj
- if dob.is=='para'
- if dob.indent =~/[1-9]/
- util=if dob.bullet_
- SiSU_text_utils::Wrap.new("* #{paragraph}",78,dob.indent.to_i*2)
- else SiSU_text_utils::Wrap.new(paragraph,78,dob.indent.to_i*2)
- end
- else
- util=if dob.bullet_
- SiSU_text_utils::Wrap.new("* #{paragraph}",78,0)
- else SiSU_text_utils::Wrap.new(paragraph,78,0)
- end
- end
- else util=SiSU_text_utils::Wrap.new(paragraph,78,0)
- end
- w=util.line_wrap
- w.gsub!(/^(\\\.)/,' \1')
- w
- end
- if lv
- times=wrapped.length
- times=78 if times > 78
- @manpage[:body] << case lv
- when 1; '.SH ' << wrapped.upcase << @br << '.br'
- when 2..3; '.SH ' << wrapped.upcase << @br << '.br'
- when 4; '.SH ' << wrapped.upcase << @br << '.br'
- when 5..6; '.SH ' << wrapped.upcase << @br
- end
- else
- @manpage[:body] << if wrapped =~/^\.BI\s/ # main text, contents, body KEEP
- '.TP' << @br << wrapped.gsub!(/^\.BI\s/,'.B ') # sleight ... simpler output
- else
- '.br' << @br << wrapped
- end
- end
- if @@endnotes[:para] \
- and @@dostype =~/footnote/ #edit out to switch off endnotes following paragraph to which they belong
- @manpage[:body] << @br
- @@endnotes[:para].each { |e| @manpage[:body] << e << @br }
- elsif @@endnotes[:para] \
- and @@dostype =~/endnote/
- @manpage[:body] << @br*2
- end
- @@endnotes[:para]=[]
- end
- def markup(data) # Used for major markup instructions
- dir=SiSU_Env::Info_env.new(@md.fns)
- @data_mod,@endnotes,@level,@cont,@copen,@manpage_contents_close=Array.new(6){[]}
- (0..6).each { |x| @cont[x]=@level[x]=false }
- (4..6).each { |x| @manpage_contents_close[x]='' }
- manpage_tail #($1,$2)
- table_message='[table omitted, see other document formats]'
- fix=[]
- manpage_metadata
- data.each do |dob|
- if dob.is=='comment' \
- or dob.is=='heading_insert'
- dob.obj=''
- end
- dob.obj.gsub!(/.+?<-#>/,'') # remove dummy headings (used by html) #check
- 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_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'--\1--')
- dob.obj.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'"\1"')
- dob.obj.gsub!(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'\1')
- dob.obj.gsub!(/\A\s*#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}#{Mx[:br_line]}/m,"#{Mx[:br_line]}.I \\1#{Mx[:br_line]}")
- dob.obj.gsub!(/\s*#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/m,"#{Mx[:br_line]}.I \\1#{Mx[:br_line]}")
- dob.obj.gsub!(/\A\s*#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}#{Mx[:br_line]}/m,"#{Mx[:br_line]}.BI \\1#{Mx[:br_line]}")
- dob.obj.gsub!(/\s*#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,"#{Mx[:br_line]}.B \\1#{Mx[:br_line]}")
- dob.obj.gsub!(/\s*#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,"#{Mx[:br_line]}.I \\1#{Mx[:br_line]}")
- unless dob.is=='code'
- dob.obj.gsub!(/(?:^|\s)#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,"\\1 #{@brace_url.txt_open}\\2#{@brace_url.txt_close}")
- dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s)#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,"\\1#{@brace_url.txt_open}\\2#{@brace_url.txt_close}")
- @manpage[:endnotes]=extract_endnotes(dob.obj)
- dob.obj.gsub!(/#{Mx[:en_a_o]}([\d*+]+)\s*(?:.+?)#{Mx[:en_a_c]}/m,'[^\1]') # endnote marker marked up
- dob.obj.gsub!(/#{Mx[:en_b_o]}([\d*+]+)\s*(?:.+?)#{Mx[:en_b_c]}/m,'[^\1]') # endnote marker marked up
- dob.obj.gsub!(/#{Mx[:gl_o]}#amp#{Mx[:gl_c]}/,'&') ##{Mx[:gl_o]}#095#{Mx[:gl_c]}
- dob.obj.gsub!(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!')
- dob.obj.gsub!(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#')
- dob.obj.gsub!(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*')
- dob.obj.gsub!(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-')
- dob.obj.gsub!(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/')
- dob.obj.gsub!(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_')
- dob.obj.gsub!(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{')
- dob.obj.gsub!(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}')
- dob.obj.gsub!(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~')
- dob.obj.gsub!(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'©')
- else
- dob.obj.gsub!(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})+\s*/,"\n") # watch
- end
- dob.obj.gsub!(/(^|&nbsp;|#{Mx[:nbsp]}|\s|\*)\\\*/,'\1\\\\\*') #man page requires
- dob.obj.gsub!(/┆/,'|')
- dob.obj.gsub!(/\s\.(\S+)/,' \\.\1')
- dob.obj.gsub!(/(\n\.)(\S\S\S+)/m,'\1\\.\2')
- dob.obj.gsub!(/-/,'\-') #manpages use this
- dob.obj.gsub!(/&#126;/,'~') if dob.obj #manpages use this
- if dob.is =~/group|verse|alt|code/
- if dob.is =='code'
- dob.obj.gsub!(/(^|[^}])_([<>])/m,'\1\2') # _> _<
- dob.obj.gsub!(/(^|[^}])_([<>])/m,'\1\2') # _<_<
- dob.obj.gsub!(/\A(.+)?\Z/m,".nf\n\n\\1\n\n.fi")
- end
- else
- dob.obj.gsub!(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*/,"\n\n") #unless para =~/#{Mx[:lv_o]}\d:/ #watch introduces a bug
- end
- dob.obj.gsub!(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})+\s*/,"\n\n.br\n\n") # watch
- blit=dob.obj.scan(/\[[^\]]+\]|[^\[]+/)
- blit_array=[]
- blit.each do |x|
- if x =~/^\[/
- x.gsub!(/\s+/,' \ ') #manpages use this
- else x
- end
- blit_array << x
- end
- dob.obj=blit_array.join
- dob.obj.gsub!(/#{Mx[:gl_o]}:name#\S+?#{Mx[:gl_c]}/mi,'') #added
- dob.obj.gsub!(/\s\\\s+(#{Mx[:br_line]}|#{Mx[:br_nl]})/,'\1') #a messy solution
- dob.obj.gsub!(/#{Mx[:br_page]}\s*|#{Mx[:br_page_new]}/,'') # remove page breaks
- dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s)#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1\2')
- dob.obj.gsub!(/<a href=".+?">(.+?)<\/a>/m,'\1')
- dob.obj.gsub!(/#{Mx[:mk_o]}name#\S+?#{Mx[:mk_c]}/,'') # remove name links
- dob.obj.gsub!(/&nbsp;|#{Mx[:nbsp]}/,' ') # decide on
- dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,' [ \1 ]') #"[ #{dir.url.images_local}\/\\1 ]")
- dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}image/,' [ \1 ]') #"[ #{dir.url.images_local}\/\\1 ]")
- dob.obj.gsub!(/^(?:^|[^_\\])#{Mx[:lnk_o]}\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*#{Mx[:lnk_c]}\S+/,'[image: "\1"]')
- wordlist=dob.obj.scan(/\S+/)
- if dob.obj !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/
- if dob.obj =~@regx #/.+?<~\d+;\w\d+;\w\d+>.*/ #watch change
- paranum=dob.obj[@regx,3]
- @p_num=SiSU_Manpage_format::Paragraph_number.new(paranum)
- end
- x=SiSU_Manpage_format::Format_text_object.new(@md,dob)
- if dob.is=='heading'
- manpage_structure(dob)
- dob.obj=case dob.ln
- when 1; x.heading_body1
- when 2; x.heading_body2
- when 3; x.heading_body3
- when 4; x.heading_body4
- when 5; x.heading_body5
- when 6; x.heading_body6
- end
- elsif dob.is=='para'
- manpage_structure(dob)
- else
- if dob.obj =~/#{table_message}/
- @manpage[:body] << dob.obj << @br
- end
- end
- if (dob.obj =~/<a name="n\d+">/ \
- and dob.obj =~/^(-\{{2}~\d+|<!e[:_]\d+!>)/) # -endnote
- dob.obj=''
- end
- if dob.obj
- dob.obj.gsub!(/\s(\[)/m,' \ \1')
- dob.obj.gsub!(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})/,"\n\n")
- dob.obj.gsub!(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~')
- dob.obj.gsub!(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{')
- dob.obj.gsub!(/#{Mx[:pa_o]}\S+#{Mx[:pa_c]}/,' ')
- dob.obj.gsub!(/<!.+!>/,' ')
- dob.obj.gsub!(/<:\S+>/,' ')
- end
- dob
- end
- end
- @manpage
- end
- def publish(manpage)
- divider='='
- content=[]
- date=if defined? @md.date.modified \
- and @md.date.modified
- @md.date.modified
- elsif defined? @md.date.published \
- and @md.date.published
- @md.date.published
- else SiSU_Env::Info_date.new.year #date missing decide on action
- end
- manpage_name,manpage_synopsis='',''
- manpg={}
- proj=SiSU_Env::Info_version.instance.get_version
- manpage[:open] = %{.TH "#{@md.fnb}" "#{@md.make.manpage['section']}" "#{date}" "#{proj[:version]}" "#{@md.title.main}"#{@md.make.manpage['name']}#{@md.make.manpage['synopsis']}}
- content << manpage[:open]
- content << manpage[:head]
- content << manpage[:body]
- content << @@endnotes[:end] if @@dostype =~/endnotes/
- content << manpage[:metadata]
- content << manpage[:tail]
- Output.new(@md,content).manpage
- @@endnotes={ :para=>[],:end=>[] }
- end
- end
- class Output <Source
- include SiSU_Param
- include SiSU_Env
- def initialize(md,content)
- @md,@content=md,content
- end
- def manpage #%manpage output
- SiSU_Env::SiSU_file.new(@md).mkdir
- filename_manpage=SiSU_Env::SiSU_file.new(@md,@md.fn[:manpage]).mkfile_man
- @sisu=[]
- @content.each do |para| # this is a hack
- if para.class==Array \
- and para.length > 0
- para.each do |line|
- line.gsub!(/\s+$/m,'')
- filename_manpage.puts line #unix manpage
- end
- else filename_manpage.puts para #unix manpage # /^([*=-]|\.){5}/
- end
- end
- filename_manpage.close
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/v2/odf.rb b/lib/sisu/v2/odf.rb
deleted file mode 100644
index 2880cdf..0000000
--- a/lib/sisu/v2/odf.rb
+++ /dev/null
@@ -1,735 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: opendocument text generation
-
-=end
-module SiSU_ODF
- require "#{SiSU_lib}/particulars" # particulars.rb
- include SiSU_Particulars
- require "#{SiSU_lib}/dal" # dal.rb
- require "#{SiSU_lib}/sysenv" # sysenv.rb
- include SiSU_Env
- include SiSU_Viz
- require "#{SiSU_lib}/odf_format" # odf_format.rb
- include SiSU_ODF_format
- require "#{SiSU_lib}/shared_metadata" # shared_metadata.rb
- require "#{SiSU_lib}/shared_txt" # shared_txt.rb
- @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0
- class Source
- require 'zlib'
- require 'find'
- require 'fileutils'
- include FileUtils
- def initialize(opt)
- @opt=opt
- @particulars=SiSU_Particulars::Combined_singleton.instance.get_all(opt)
- @@endnotes_para=[]
- end
- def read
- begin
- @env,@md,@dal_array=@particulars.env,@particulars.md,@particulars.dal_array
- opendoc=@md.fn[:odf]
- path=@env.path.output_tell
- unless @opt.cmd =~/q/
- tool=(@opt.cmd =~/[MVv]/) \
- ? "#{@env.program.odf_viewer} #{path}/#{@md.fnb}/#{opendoc}" \
- : @opt.fns
- @opt.cmd=~/[MVvz]/ \
- ? SiSU_Screen::Ansi.new(@opt.cmd,'Opendocument (ODF:ODT)',tool).green_hi_blue \
- : SiSU_Screen::Ansi.new(@opt.cmd,'Opendocument (ODF:ODT)',tool).green_title_hi
- SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/#{@md.fnb}/#{opendoc}").flow if @opt.cmd =~/[MV]/
- end
- my_make=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns)
- SiSU_ODF::Source::Scroll.new(@particulars).songsheet
- SiSU_Env::Info_skin.new(@md).select
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- end
- end
- private
- class Scroll <Source
- require "#{SiSU_lib}/defaults" # defaults.rb
- require "#{SiSU_lib}/shared_txt" # shared_txt.rb
- @@img_count=0
- @@odf={ :body=>[],:open=>[],:close=>[],:head=>[],:metadata=>[],:tail=>[],:endnotes=>[] }
- @@docstart=true
- @@fns=nil
- def initialize(particulars)
- @env,@md,@dal_array=particulars.env,particulars.md,particulars.dal_array
- @vz=SiSU_Env::Get_init.instance.skin
- @tab="\t"
- @brace_url=SiSU_Viz::Skin.new.url_decoration
- @br=(@md.cmd =~/M/) ? '' : ''
- #@br=(@md.cmd =~/M/) ? "\n" : ''
- end
- def songsheet
- pre
- @data=markup(@dal_array)
- post
- publish
- end
- # Used for extraction of endnotes from paragraphs
- def extract_endnotes(dob='')
- notes=dob.obj.scan(/#{Mx[:en_a_o]}(\d+\s+.+?)#{Mx[:en_a_c]}/)[1] #FIX
- @n=[]
- notes.each do |n| #high cost to deal with <br> appropriately within odf, consider
- n=n.dup.to_s
- if n =~/#{Mx[:br_line]}/
- fix=n.split(/#{Mx[:br_line]}/) #watch #added
- fix.each do |x|
- if x =~/\S+/; @n << x
- end
- end
- else @n << n
- end
- end
- end
- def odf_metadata
- @@odf[:metadata]=Metadata::Summary.new(@md).odf.metadata
- end
- def odf_tail
- generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version]
- lastdone="Last Generated on: #{Time.now}"
- rubyv="Ruby version: #{@md.ruby_version}"
- sc=if @md.sc_info
- "Source file: #{@md.sc_filename}\nVersion number: #{@md.sc_number}\nVersion date: #{@md.sc_date}\n"
- else ''
- end
- url=@md.fnb
- fn=@md.fn[:manifest]
- manifest="#{@env.url.root}/#{@md.fnb}/#{@md.fn[:manifest]}"
- @@odf[:tail] << %{<text:p text:style-name="P1">Available document outputs: <br /> &lt;<text:a xlink:type="simple" xlink:href="#{manifest}">#{manifest}</text:a>&gt;</text:p>}
- @@odf[:tail] << %{\n<text:p text:style-name="P1">SiSU: &lt;<text:a xlink:type="simple" xlink:href="http://www.jus.uio.no/lm">www.jus.uio.no/sisu</text:a>&gt; and &lt;<text:a xlink:type="simple" xlink:href="http://www.sisudoc.org">www.sisudoc.org</text:a>&gt;</text:p>}
- @@odf[:tail] << "\n</office:text></office:body></office:document-content>"
- end
- def heading(dob)
- dob.obj.gsub!(/#{Mx[:tag_o]}\S+?#{Mx[:tag_c]}/,'') #check
- m=/#{$1}/
- breakpage=''
- if @md.fns \
- and @md.fns != '' \
- and @md.fns !=@@fns
- @@docstart=true
- @@fns=@md.fns
- end
- unless @@docstart
- breakpage=if (@md.pagenew or @md.pagebreak) \
- and (@md.pagenew =~ m or @md.pagebreak =~m)
- '<text:p text:style-name="P9"> </text:p>'
- else ''
- end
- end
- @@docstart=false
- dob.obj=%{#{breakpage}<text:h text:style-name="Heading_20_#{dob.ln}" text:outline-level="#{dob.ln}">#{dob.obj}</text:h>}
- dob
- end
- def image_src(i)
- image_source=if @md.fns =~/\.ss[tm]$/ \
- and FileTest.file?("#{@env.path.image_source_local_tex}/#{i}") #review
- @env.path.image_source_local_tex
- elsif @md.fns =~/\.-ss[tm]$/ \
- and FileTest.file?("#{@env.path.image_source_remote_tex}/#{i}")
- @env.path.image_source_remote_tex
- elsif FileTest.file?("#{@env.path.image_source_tex}/#{i}")
- @env.path.image_source_tex
- else
- SiSU_Screen::Ansi.new(@md.cmd,"ERROR - image:",%{"#{i}" missing},"search locations: #{@env.path.image_source_local_tex},#{@env.path.image_source_remote_tex} and #{@env.path.image_source_tex}").error2 unless @md.cmd =~/q/
- nil
- end
- end
- def image_odf(img)
- # copy image to od image directory (unless exists)
- # divide pixel dimension by 37.79485 and retain 3 decimal places
- m,u=img[1],img[2]
- i=/^(\S+?\.(?:png|jpg|gif))/.match(m).captures.join if m =~/^(\S+?\.(?:png|jpg|gif))/
- c=/^\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"/.match(m).captures.join if m =~/^\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"/
- w,h=/\s(\d+)x(\d+)/.match(m).captures if m =~/\s\d+x\d+/
- w=(w.to_i/37.79485).to_s
- h=(h.to_i/37.79485).to_s
- h=/([0-9]+\.\d{0,3})/.match(h).captures.join
- w=/([0-9]+\.\d{0,3})/.match(w).captures.join
- image_source=image_src(i)
- pwd=Dir.pwd
- cp("#{image_source}/#{i}","#{@env.path.odf}/Pictures/#{i}") if image_source
- img=if i.to_s =~/jpg|png|gif/ \
- and h.to_s =~/\d/ \
- and w.to_s =~/\d/
- @@img_count +=1
- %{<draw:frame draw:style-name="fr1" draw:name="graphics#{@@img_count}" text:anchor-type="as-char" svg:width="#{w}cm" svg:height="#{h}cm" draw:z-index="2"><draw:image xlink:href="Pictures/#{i}" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/></draw:frame>#{c}} #anchor-type: as-char or paragraph or char or ...
- else %{<text:p text:style-name="P1">[image omitted]</text:p>}
- end
- end
- def image(dob)
- m=if dob.obj =~/#{Mx[:lnk_o]}[ ]*(.+?)[ ]*#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/
- dob.obj.scan(/(#{Mx[:lnk_o]}[ ]*(.+?)[ ]*#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]})/)
- elsif dob.obj =~/#{Mx[:lnk_o]}[ ]*(.+?)[ ]*#{Mx[:lnk_c]}image/
- dob.obj.scan(/(#{Mx[:lnk_o]}[ ]*(.+?)[ ]*#{Mx[:lnk_c]}(image))/)
- else nil
- end
- if m; m.each do |i|
- cont,url=i[1],i[2]
- cont.gsub!(/([)(\]\[])/,"\\\\\\1")
- cont.gsub!(/([+?])/,"\\\\\\1") # incorrect handling of +
- url.gsub!(/([+?])/,"\\\\\\1")
- dob.obj.sub!(/#{Mx[:lnk_o]}[ ]*#{cont}[ ]*#{Mx[:lnk_c]}image/m,image_odf(i))
- dob.obj.sub!(/#{Mx[:lnk_o]}[ ]*#{cont}[ ]*#{Mx[:lnk_c]}#{Mx[:url_o]}#{url}#{Mx[:url_c]}/m,image_odf(i))
- dob.obj.gsub!(/\\([)(\]\[?])/,'\1') #clumsy fix
- end
- m=nil
- end
- dob
- end
- def text_link_odf(txt,url,trail)
- txt.gsub!(/(\\\+)/,'+') #this is convoluted, and risky :-(
- url.gsub!(/(\\\+)/,'+') #this is convoluted, and risky :-(
- map_nametags=SiSU_Particulars::Combined_singleton.instance.get_map_nametags(@md).nametags_map
- t=case url
- when /^https?:/
- %{<text:a xlink:type="simple" xlink:href="#{url}">#{txt.strip}</text:a>#{trail}}
- when /^:/ # site same document collection html link
- url.gsub!(/^:/,"#{@env.url.root}/")
- %{<text:a xlink:type="simple" xlink:href="#{url}">#{txt.strip}</text:a>#{trail}}
- when /^\.\.\// # site same document collection html link
- url.gsub!(/^\.\.\//,"#{@env.url.root}/")
- %{<text:a xlink:type="simple" xlink:href="#{url}">#{txt.strip}</text:a>#{trail}}
- else # document internal link
- if map_nametags[url] \
- and map_nametags[url][:segname]
- else p "NOT FOUND name_tags: #{url}"
- end
- t=map_nametags[url] \
- && map_nametags[url][:segname] \
- ? %{<text:a xlink:type="simple" xlink:href="#{@env.url.root}/#{@md.fnb}/#{map_nametags[url][:segname]}#{Sfx[:html]}##{url}">#{txt.strip}</text:a>#{trail}} \
- : %{#{txt.strip}#{trail}}
- end
- t
- end
- def text_link(dob)
- m=dob.obj.scan(/(#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]})/) #sort
- if m
- m.each do |i|
- txt,url,trail=i[1],i[2]
- txt.gsub!(/([)(\]\[])/,"\\\\\\1")
- txt.gsub!(/([+?*])/,"\\\\\\1") # problems with +
- url.gsub!(/([+?])/,"\\\\\\1") # problems with +
- dob.obj.gsub!(/#{Mx[:lnk_o]}[ ]*#{txt}#{Mx[:lnk_c]}#{Mx[:url_o]}#{url}#{Mx[:url_c]}/m,text_link_odf(txt,url,trail)) #make sure trailing ']' are not caught in url
- dob.obj.gsub!(/\\([)(\]\[?])/,'\1') #clumsy fix
- end
- m=nil
- end
- dob
- end
- def text_link_relative(dob)
- m=dob.obj.scan(/(#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}(\S+?)#{Mx[:rel_c]})/) #sort
- if m
- m.each do |i|
- txt,url,trail=i[1],i[2]
- txt.gsub!(/([)(\]\[])/,"\\\\\\1")
- txt.gsub!(/([+?*])/,"\\\\\\1") # problems with +
- url.gsub!(/([+?])/,"\\\\\\1") # problems with +
- dob.obj.gsub!(/#{Mx[:lnk_o]}[ ]*#{txt}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{url}#{Mx[:rel_c]}/m,text_link_odf(txt,url,trail)) #make sure trailing ']' are not caught in url
- dob.obj.gsub!(/\\([)(\]\[?])/,'\1') #clumsy fix
- end
- m=nil
- end
- dob
- end
- def normal(dob) #P1 - P3
- dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,
- '<text:a xlink:type="simple" xlink:href="\1">\1</text:a>') #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}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{@brace_url.xml_close}})
- dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
- %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{@brace_url.xml_close}}) #http ftp matches with decoration
- dob.obj= if dob.is=='para' and dob.indent.to_s =~/[0-9]/ # and t_o.bullet_==true
- %{<text:p text:style-name="P1#{dob.indent}">#{dob.obj}</text:p>}
- else %{<text:p text:style-name="P1">#{dob.obj}</text:p>}
- end
- dob
- end
- def fontface(dob)
- end
- def footnote_urls(str)
- str.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
- %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{@brace_url.xml_close}})
- str=text_link(str) if str =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/
- str=text_link_relative(str) if str =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/
- str
- end
- def footnote(t_o)
- str=if defined? t_o.obj; t_o.obj
- elsif t_o.class==String; t_o
- end
- if str
- @astx||=10000
- @astxs||=20000
- if str =~/#{Mx[:en_a_o]}\d+\s+/
- str.gsub!(/#{Mx[:en_a_o]}(\d+)\s+(.+?)#{Mx[:en_a_c]}/,'<text:note text:id="ftn\1" text:note-class="footnote"><text:note-citation>\1</text:note-citation><text:note-body><text:p text:style-name="Footnote"> \2</text:p><text:p text:style-name="Footnote"/></text:note-body></text:note>')
- end
- if str =~/#{Mx[:en_a_o]}([*]+)\s+/
- a=$1.gsub(/([*])/,"\\\\\\1")
- str.gsub!(/#{Mx[:en_a_o]}([*]+)\s+(.+?)#{Mx[:en_a_c]}/,%{<text:note text:id="ftn#{@astx.to_s}" text:note-class="footnote"><text:note-citation text:label="\\1">\\1</text:note-citation><text:note-body><text:p text:style-name="Footnote"> \\2</text:p><text:p text:style-name="Footnote"/></text:note-body></text:note>})
- @astxs+=1
- end
- if str=~/#{Mx[:en_a_o]}[*+]+\s/
- asterisk=str.scan(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)#{Mx[:en_a_c]}/)
- asterisk.each do |x|
- a=x[0].gsub(/([*+])/,"\\\\\\1")
- str=group_clean(str)
- str=footnote_urls(str)
- str.gsub!(/#{Mx[:en_a_o]}(#{a})\s+(.+?)#{Mx[:en_a_c]}/,%{<text:note text:id="ftn#{@astx.to_s}" text:note-class="footnote"><text:note-citation text:label="\\1">\\1</text:note-citation><text:note-body><text:p text:style-name="Footnote"> \\2</text:p><text:p text:style-name="Footnote"/></text:note-body></text:note>})
- @astx+=1
- end
- end
- if str=~/#{Mx[:en_b_o]}[*+]\d+\s/
- asterisk=str.scan(/#{Mx[:en_b_o]}([*+]\d+)\s+(.+?)#{Mx[:en_b_c]}/)
- asterisk.each do |x|
- a=x[0].gsub(/([*+])/,"\\\\\\1")
- str=group_clean(str)
- str=footnote_urls(str)
- str.gsub!(/#{Mx[:en_b_o]}(#{a})\s+(.+?)#{Mx[:en_b_c]}/,%{<text:note text:id="ftn#{@astx.to_s}" text:note-class="footnote"><text:note-citation text:label="\\1">\\1</text:note-citation><text:note-body><text:p text:style-name="Footnote"> \\2</text:p><text:p text:style-name="Footnote"/></text:note-body></text:note>})
- @astx+=1
- end
- end
- end
- if defined? t_o.obj; t_o.obj=str
- elsif t_o.class==String; t_o=str
- end
- t_o
- end
- def group_clean(str)
- str.gsub!(/&amp;nbsp;|&nbsp;|#{Mx[:nbsp]}/,'&#160;')
- str.gsub!(/</,'&lt;'); str.gsub!(/>/,'&gt;')
- str.gsub!(/&lt;(text:span text:style-name="T[1-5]"|\/text:span)&gt;/,'<\1>') #works, not ideal
- str.gsub!(/#{Mx[:br_line]}/,'<br />')
- str.gsub!(/&lt;br(?:\s+\/)?&gt;/,'<br />')
- str
- end
- def poem(dob) #P4 #same as group
- parray=[]
- dob.obj.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/).each do |parablock|
- parablock=group_clean(parablock)
- parray << %{<text:p text:style-name="P4">#{parablock}</text:p>} if parablock =~/\S+/
- end
- dob.obj=parray.join + '<text:p text:style-name="Standard"/>'
- dob
- end
- def group(dob) #P4 #same as verse
- parray=[]
- dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,
- '<text:a xlink:type="simple" xlink:href="\1">\1</text:a>') #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}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{@brace_url.xml_close}})
- dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
- %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{@brace_url.xml_close}}) #http ftp matches with decoration
- dob.obj.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/).each do |parablock|
- parablock=group_clean(parablock)
- parablock.gsub!(/&lt;text:a xlink:type="simple" xlink:href="(.+?)"&gt;/m,'<text:a xlink:type="simple" xlink:href="\1">')
- parablock.gsub!(/&lt;(\/text:a)&gt;/,'<\1>')
- parablock.gsub!(/&lt;(text:note text:id=.+?)&gt;/,'<\1>')
- parablock.gsub!(/&lt;(text:p text:style-name="Footnote")&gt;/,'<\1>')
- parablock.gsub!(/&lt;(\/?text:(?:note-citation|note-body|note|p))&gt;/,'<\1>')
- parablock=footnote(parablock)
- parray << %{<text:p text:style-name="P4">#{parablock}</text:p>} if parablock =~/\S+/
- end
- dob.obj=parray.join + '<text:p text:style-name="Standard"/>'
- dob
- end
- def code(dob) #P5
- if dob.is=='code'
- dob.obj.gsub!(/\s\s/,'&#160;&#160;')
- parray=[]
- dob.obj.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/).each do |parablock|
- parablock=group_clean(parablock)
- parablock.gsub!(/^\s*$/,'<br />')
- parablock.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,
- '<text:a xlink:type="simple" xlink:href="\1">\1</text:a>') #http ftp matches escaped, no decoration
- parray << %{<text:p text:style-name="P20">#{parablock}</text:p>} if parablock =~/\S+/
- end
- dob.obj=parray.join + '<text:p text:style-name="Standard"/>'
- end
- dob
- end
- def table(dob) #
- if dob.is =='table'
- table=SiSU_ODF_format::Table.new(@md,dob)
- dob=table.table
- end
- dob
- end
- def obj_break(dob)
- if dob.is =='break'
- br=SiSU_ODF_format::Format_obj_break.new(@md,dob)
- if dob.obj==Mx[:br_page] \
- or dob.obj==Mx[:br_page_new]
- dob=br.br_page
- elsif dob.obj==Mx[:obj_ln_sep]
- dob=br.obj_sep
- end
- end
- dob
- end
- def odf_structure(md,dob)
- @md,@dob=md,dob
- dob=if dob.is !='code'
- dob=image(dob) if dob.obj =~/#{Mx[:lnk_o]}[ ]*\S+?\.(?:png|jpg|gif)\s.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/
- dob=text_link(dob) if dob.obj =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/
- dob=text_link_relative(dob) if dob.obj =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/
- dob
- else dob
- end
- dob=footnote(dob)
- if dob.is=='heading'
- @@odf[:body] << heading(dob).obj << @br*2
- elsif dob.is =='verse'
- @@odf[:body] << poem(dob).obj << @br*2
- elsif dob.is=='group'
- @@odf[:body] << group(dob).obj << @br*2
- elsif dob.is=='code'
- @@odf[:body] << code(dob).obj << @br*2
- elsif dob.is=='table' #elsif dob.obj =~ /<!Th?¡/u
- @@odf[:body] << table(dob).obj << @br*2
- elsif dob.is=='break'
- @@odf[:body] << obj_break(dob).obj << @br*2
- else
- @@odf[:body] << normal(dob).obj << @br*2 # main text, contents, body KEEP
- end
- @@endnotes_para=[]
- end
- def tidywords(wordlist)
- wordlist
- end
- def markup(data) # Used for major markup instructions
- safe_characters=/[^a-zA-Z0-9}{\/?,."';:)(><\-_&!@%~#\]\[*=$| \n+`#{Mx[:tc_p]}]/u
- dir=SiSU_Env::Info_env.new(@md.fns)
- dir.path.odf_bld
- @data_mod,@endnotes,@level,@cont,@copen,@odf_contents_close=Array.new(6){[]}
- @rcdc=false
- (0..6).each { |x| @cont[x]=@level[x]=false }
- (4..6).each { |x| @odf_contents_close[x]='' }
- odf_tail #($1,$2)
- fix=[]
- bullet=image_src('bullet_09.png')
- cp("#{bullet}/bullet_09.png","#{@env.path.odf}/Pictures/.") #if image_src('bullet_09.png')
- odf_metadata
- data.each do |dob|
- #p dob.obj if dob.obj =~safe_characters and @md.cmd =~/V/ #KEEP
- dob.obj='' if dob.obj =~/#{Mx[:lv_o]}\d+:.*?#{Mx[:lv_c]}.+?#{Mx[:pa_non_object_dummy_heading]}/ #fix Mx[:lv_o]
- para_array=[]
- dob.obj.gsub!(/</,'&lt;'); dob.obj.gsub!(/>/,'&gt;')
- word=dob.obj.scan(/\S+|\n/)
- if word
- word.each do |w| # _ - / # | : ! ^ ~
- unless dob =~/^(?:#{Rx[:meta]}|%+ )/m
- w.gsub!(/&#(?:126|152);/,'~') #126 usual
- w.gsub!(/&nbsp;/,'&#160;')
- if w !~/&\S{2,7}?;/
- w.gsub!(/&/,'&amp;')
- end
- w.gsub!(/(&\S{1,7};)+&/,'\1&amp;') #could break things
- end
- para_array << w
- end
- dob.obj=para_array.join(' ')
- dob.obj=dob.obj.strip
- end
- if dob.is=='code' #{Mx[:gr_o]}code#{Mx[:gr_c]}/ #fix #code-block: angle brackets special characters #fix
- dob.obj.gsub!(/(^|[^}])_(?:<|&lt;)/m,'\1&lt;'); dob.obj.gsub!(/(^|[^}])_(?:>|&gt;)/m,'\1&gt;')
- dob.obj.gsub!(/(^|[^}])_(?:<|&lt;)/m,'\1&lt;'); dob.obj.gsub!(/(^|[^}])_(?:>|&gt;)/m,'\1&gt;')
- end
- if dob.of=='group'
- dob.obj.gsub!(/#{Mx[:gl_bullet]}/,'● ')
- end
- dob.obj.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>')
- dob.obj.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'<ins>\1</ins>')
- dob.obj.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>')
- dob.obj.gsub!(/#{Mx[:tag_o]}\S+?#{Mx[:tag_c]}/,'') #check
- 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[:mk_o]}[~-]##{Mx[:mk_c]}/,'')
- if dob.is=='para' \
- and dob.bullet_
- dob.obj='<draw:frame draw:style-name="gr1" text:anchor-type="as-char" svg:width="0.22cm" svg:height="0.22cm" draw:z-index="2"><draw:image xlink:href="Pictures/bullet_09.png" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/></draw:frame> ' +
- dob.obj
- end
- dob.obj.gsub!(/#{Mx[:br_line]}/,'<br />')
- dob.obj.gsub!(/&#169;/,'©') #too arbitrary
- dob.obj.gsub!(/.+?<-#>/,'') # remove dummy headings (used by html) #check
- dob.obj.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,
- '<text:span text:style-name="T1">\1</text:span>')
- dob.obj.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,
- '<text:span text:style-name="T2">\1</text:span>')
- dob.obj.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,
- '<text:span text:style-name="T3">\1</text:span>')
- dob.obj.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,
- '<text:span text:style-name="T4">\1</text:span>')
- dob.obj.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,
- '<text:span text:style-name="T5">\1</text:span>')
- dob.obj.gsub!(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,
- '<text:span text:style-name="T7">\1</text:span>')
- dob.obj.gsub!(/­/u,'-')
- dob.obj.gsub!(/ /u, ' ') # space identify
- dob.obj.gsub!(/ /u, ' ') # space identify
- dob.obj.gsub!(/·/u,'*')
- dob.obj.gsub!(/[­–—]/u,'-') #— – chk
- dob.obj.gsub!(/ < /i,'&#060;')
- dob.obj.gsub!(/\\copy(?:right)?\b/,'&#169;')
- dob.obj.gsub!(/\\trademark\b|\\tm\b/,'&#174;')
- dob.obj.gsub!(/\44/,'&#36;') #$ watch
- dob.obj.gsub!(/<a href=".+?">(.+?)<\/a>/,'\1')
- dob.obj.gsub!(/#{Mx[:mk_o]}name#\S+?#{Mx[:mk_c]}/,'') # remove name links
- wordlist=dob.obj.scan(/\S+/)
- dob.obj=tidywords(wordlist).join(' ').strip
- @rcdc=true if @rcdc==false \
- and (dob.obj =~/~metadata/ or dob =~/#{Mx[:lv_o]}1:meta#{Mx[:lv_x]}\s*Document Information/) #fix Mx[:lv_o]
- if dob.is !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/
- if defined? dob.ocn and dob.ocn =~/\d+/
- @p_num=SiSU_ODF_format::Paragraph_number.new(dob.ocn)
- end
- if dob.is=~/heading|para|group|verse|code|table|break/ # extend, include other types
- odf_structure(@md,dob)
- end
- dob.obj.gsub!(/<!.+!>/,' ') if dob.obj ## Clean Prepared Text
- dob.obj.gsub!(/#{Mx[:tc_o]}.+?#{Mx[:tc_c]}/,' ') if dob.obj ## CHECK Clean Prepared Text
- dob.obj.gsub!(/<:\S+>/,' ') if dob.obj ## Clean Prepared Text
- end
- end
- end
- def pre
- table=if @md.flag_tables
- x=<<WOK
- <style:style style:name="Table1" style:family="table"><style:table-properties style:width="16.999cm" table:align="margins"/></style:style>
- <style:style style:name="Table1.A" style:family="table-column"><style:table-column-properties style:column-width="16.999cm" style:rel-column-width="65535*"/></style:style>
- <style:style style:name="Table1.B" style:family="table-column"><style:table-column-properties style:column-width="8.499cm" style:rel-column-width="32767*"/></style:style>
- <style:style style:name="Table1.C" style:family="table-column"><style:table-column-properties style:column-width="5.666cm" style:rel-column-width="21845*"/></style:style>
- <style:style style:name="Table1.D" style:family="table-column"><style:table-column-properties style:column-width="4.349cm" style:rel-column-width="16383*"/></style:style>
- <style:style style:name="Table1.E" style:family="table-column"><style:table-column-properties style:column-width="3.399cm" style:rel-column-width="13107*"/></style:style>
- <style:style style:name="Table1.F" style:family="table-column"><style:table-column-properties style:column-width="2.833cm" style:rel-column-width="10922*"/></style:style>
- <style:style style:name="Table1.G" style:family="table-column"><style:table-column-properties style:column-width="2.428cm" style:rel-column-width="9362*"/></style:style>
- <style:style style:name="Table1.H" style:family="table-column"><style:table-column-properties style:column-width="2.124cm" style:rel-column-width="8191*"/></style:style>
- <style:style style:name="Table2" style:family="table"><style:table-properties style:width="16.999cm" table:align="margins"/></style:style>
- <style:style style:name="Table2.A" style:family="table-column"><style:table-column-properties style:column-width="16.999cm" style:rel-column-width="65535*"/></style:style>
- <style:style style:name="Table2.B" style:family="table-column"><style:table-column-properties style:column-width="8.499cm" style:rel-column-width="32767*"/></style:style>
- <style:style style:name="Table2.C" style:family="table-column"><style:table-column-properties style:column-width="5.666cm" style:rel-column-width="21845*"/></style:style>
- <style:style style:name="Table2.D" style:family="table-column"><style:table-column-properties style:column-width="4.349cm" style:rel-column-width="16383*"/></style:style>
- <style:style style:name="Table2.E" style:family="table-column"><style:table-column-properties style:column-width="3.999cm" style:rel-column-width="13107*"/></style:style>
- <style:style style:name="Table2.F" style:family="table-column"><style:table-column-properties style:column-width="2.833cm" style:rel-column-width="10922*"/></style:style>
- <style:style style:name="Table2.G" style:family="table-column"><style:table-column-properties style:column-width="2.428cm" style:rel-column-width="9362*"/></style:style>
- <style:style style:name="Table2.H" style:family="table-column"><style:table-column-properties style:column-width="2.124cm" style:rel-column-width="8191*"/></style:style>
- <style:style style:name="Table2.I" style:family="table-column"><style:table-column-properties style:column-width="1.8887cm" style:rel-column-width="7281*"/></style:style>
- <style:style style:name="Table2.J" style:family="table-column"><style:table-column-properties style:column-width="1.6999cm" style:rel-column-width="6553*"/></style:style>
- <style:style style:name="Table2.K" style:family="table-column"><style:table-column-properties style:column-width="1.5453cm" style:rel-column-width="5957*"/></style:style>
- <style:style style:name="Table2.L" style:family="table-column"><style:table-column-properties style:column-width="1.416cm" style:rel-column-width="5461*"/></style:style>
- <style:style style:name="Table2.M" style:family="table-column"><style:table-column-properties style:column-width="1.307" style:rel-column-width="5041*"/></style:style>
- <style:style style:name="Table2.N" style:family="table-column"><style:table-column-properties style:column-width="1.214cm" style:rel-column-width="4681*"/></style:style>
-WOK
- x.strip!
- x.gsub!(/\n+/m,'') unless @md.opt.cmd=~/M/
- x
- else ''
- end
- breakpage=if @md.pagenew \
- or @md.pagebreak
- ' fo:break-before="page"'
- else ''
- end
- x=<<WOK
-<?xml version="1.0" encoding="UTF-8"?>
-<office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" office:version="1.0"><office:scripts/>
-<office:font-face-decls><style:font-face style:name="DejaVu Sans Mono" svg:font-family="'DejaVu Sans Mono'" style:font-adornments="Book" style:font-family-generic="modern" style:font-pitch="fixed"/><style:font-face style:name="Inconsolata" svg:font-family="Inconsolata" style:font-adornments="Regular" style:font-pitch="fixed"/><style:font-face style:name="Liberation Mono" svg:font-family="'Liberation Mono'" style:font-adornments="Regular" style:font-family-generic="modern" style:font-pitch="fixed"/><style:font-face style:name="DejaVu Sans" svg:font-family="'DejaVu Sans'" style:font-adornments="ExtraLight" style:font-family-generic="swiss" style:font-pitch="variable"/><style:font-face style:name="Nimbus Sans L" svg:font-family="&apos;Nimbus Sans L&apos;" style:font-pitch="variable"/><style:font-face style:name="Tahoma" svg:font-family="Tahoma, Lucidasans, &apos;Lucida Sans&apos;, &apos;Arial Unicode MS&apos;" style:font-pitch="variable"/><style:font-face style:name="DejaVu Serif" svg:font-family="'DejaVu Sans'" style:font-adornments="ExtraLight" style:font-family-generic="swiss" style:font-pitch="variable"/><style:font-face style:name="Nimbus Roman No9 L" svg:font-family="&apos;Nimbus Roman No9 L&apos;" style:font-family-generic="roman" style:font-pitch="variable"/><style:font-face style:name="Bitstream Vera Sans" svg:font-family="&apos;Bitstream Vera Sans&apos;" style:font-family-generic="swiss" style:font-pitch="variable"/></office:font-face-decls>
-<office:automatic-styles>
-#{table}
- <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:text-align="justify" style:justify-single-word="false"/></style:style>
- <style:style style:name="P2" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:text-align="justify" style:justify-single-word="false"/></style:style>
- <style:style style:name="P3" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:text-align="justify" style:justify-single-word="false"/></style:style>
- <style:style style:name="P4" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0cm" fo:line-height="100%" fo:text-align="justify" style:justify-single-word="false"/></style:style>
- <style:style style:name="P5" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0cm" fo:line-height="100%" fo:text-align="start" style:justify-single-word="false"/></style:style>
- <style:style style:name="P6" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:break-before="page"/></style:style>
- <style:style style:name="P7" style:family="paragraph" style:parent-style-name="Table_20_Contents"><style:paragraph-properties fo:text-align="justify" style:justify-single-word="false"/></style:style>
- <style:style style:name="P8" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:break-before="page"/></style:style>
- <style:style style:name="P9" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:break-after="page"/></style:style>
- <style:style style:name="P10" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:text-align="justify" style:justify-single-word="false"/></style:style>
- <style:style style:name="P11" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:margin-left="1cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/></style:style>
- <style:style style:name="P12" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:margin-left="2cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/></style:style>
- <style:style style:name="P13" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:margin-left="3cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/></style:style>
- <style:style style:name="P14" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:margin-left="4cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/></style:style>
- <style:style style:name="P15" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:margin-left="5cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/></style:style>
- <style:style style:name="P16" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:margin-left="6cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/></style:style>
- <style:style style:name="P17" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:margin-left="7cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/></style:style>
- <style:style style:name="P18" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:margin-left="8cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/></style:style>
- <style:style style:name="P19" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:margin-left="8cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/></style:style>
- <style:style style:name="P20" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0cm" fo:line-height="100%" fo:text-align="start" style:justify-single-word="false"/><style:text-properties style:font-name="DejaVu Sans Mono" fo:font-size="9pt" fo:font-weight="normal" fo:background-color="#e6e6e6"/></style:style>
- <style:style style:name="T1" style:family="text"><style:text-properties fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold"/></style:style>
- <style:style style:name="T2" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic"/></style:style>
- <style:style style:name="T3" style:family="text"><style:text-properties style:text-underline-style="solid" style:text-underline-width="auto" style:text-underline-color="font-color"/></style:style>
- <style:style style:name="T4" style:family="text"><style:text-properties style:text-position="super 58%"/></style:style>
- <style:style style:name="T5" style:family="text"><style:text-properties style:text-position="sub 58%"/></style:style>
- <style:style style:name="T6" style:family="text"><style:text-properties style:font-name="Courier 10 Pitch" fo:font-size="12pt"/></style:style>
- <style:style style:name="T7" style:family="text"><style:text-properties style:font-name="DejaVu Sans Mono" fo:font-size="10pt" fo:font-weight="normal" fo:background-color="#e6e6e6"/></style:style>
- <style:style style:name="fr1" style:family="graphic" style:parent-style-name="Graphics"><style:graphic-properties style:wrap="none" style:horizontal-pos="left" style:horizontal-rel="paragraph" style:mirror="none" fo:clip="rect(0cm 0cm 0cm 0cm)" draw:luminance="0%" draw:contrast="0%" draw:red="0%" draw:green="0%" draw:blue="0%" draw:gamma="100%" draw:color-inversion="false" draw:image-opacity="100%" draw:color-mode="standard"/></style:style>
- <style:style style:name="gr1" style:family="graphic"><style:graphic-properties draw:stroke="none" draw:fill="none" draw:textarea-horizontal-align="center" draw:textarea-vertical-align="middle" draw:color-mode="standard" draw:luminance="0%" draw:contrast="0%" draw:gamma="100%" draw:red="0%" draw:green="0%" draw:blue="0%" fo:clip="rect(0cm 0cm 0cm 0cm)" draw:image-opacity="100%" style:mirror="none" style:run-through="background" style:wrap="none" style:vertical-pos="top" style:vertical-rel="baseline" style:horizontal-pos="left" style:horizontal-rel="paragraph" draw:wrap-influence-on-position="once-concurrent" style:flow-with-text="false"/></style:style>
- <style:style style:name="gr2" style:family="graphic"><style:graphic-properties draw:stroke="none" draw:fill="none" draw:textarea-horizontal-align="center" draw:textarea-vertical-align="middle" draw:color-mode="standard" draw:luminance="0%" draw:contrast="0%" draw:gamma="100%" draw:red="0%" draw:green="0%" draw:blue="0%" fo:clip="rect(0cm 0cm 0cm 0cm)" draw:image-opacity="100%" style:mirror="none" style:run-through="background" style:wrap="none" style:vertical-pos="middle" style:vertical-rel="baseline" style:horizontal-pos="left" style:horizontal-rel="paragraph" draw:wrap-influence-on-position="once-concurrent" style:flow-with-text="false"/></style:style>
-</office:automatic-styles>
-<office:body>
- <office:text><office:forms form:automatic-focus="false" form:apply-design-mode="false"/>
- <text:sequence-decls><text:sequence-decl text:display-outline-level="0" text:name="Illustration"/><text:sequence-decl text:display-outline-level="0" text:name="Table"/><text:sequence-decl text:display-outline-level="0" text:name="Text"/><text:sequence-decl text:display-outline-level="0" text:name="Drawing"/></text:sequence-decls>
-WOK
- x.strip!
- x.gsub!(/\n+/m,'') unless @md.opt.cmd=~/M/
- @@odf[:head] << x
- end
- def post
- end
- def publish
- divider='='
- content=[]
- data=@data
- content << @@odf[:open]
- content << @@odf[:head]
- content << @@odf[:body]
- content << @@odf[:metadata]
- content << @@odf[:tail]
- Output.new(content,@md,@env).odf
- @@odf[:head],@@odf[:body],@@odf[:tail],@@odf[:metadata]=[],[],[],[]
- end
- end
- class Output <Source
- def initialize(content,md,env)
- @content,@md,@env=content,md,env
- end
- def odf #%odf output
- SiSU_Env::SiSU_file.new(@md).mkdir
- header=SiSU_ODF_format::ODT_head.new(@md)
- filename="#{@env.path.odf}/META-INF/manifest.xml"
- od=File.new(filename,'w+')
- od << header.meta_inf_manifest_xml
- od.close
- filename="#{@env.path.odf}/meta.xml"
- od=File.new(filename,'w+')
- od << header.meta_xml
- od.close
- filename="#{@env.path.odf}/settings.xml"
- od=File.new(filename,'w+')
- od << header.settings_xml
- od.close
- filename="#{@env.path.odf}/styles.xml"
- od=File.new(filename,'w+')
- od << header.styles_xml
- od.close
- filename="#{@env.path.odf}/mimetype"
- od=File.new(filename,'w+')
- od << header.mimetype
- od.close
- filename="#{@env.path.odf}/content.xml"
- od=File.new(filename,'w+')
- @content.each do |para| # this is a hack
- od.puts para unless para =~/\A\s*\Z/
- end
- od.close
- opendoc=@md.fn[:odf]
- system("
- cd #{@env.path.odf}
- zip -qr #{opendoc} *
- mv #{opendoc} #{@env.path.output}/#{@md.fnb}/.
- cd #{Dir.pwd}
- ")
- end
- end
- end
-end
-__END__
-todo:
-* table of contents
-* page header/footer?
-
-done:
-headings *
-footnotes *
-bold underscore italics strikethrough *
-superscript subscript *
-extended ascii set *
-indents *
- [autonomy_markup0.sst] *
-groups
- poem *
- code *
- tables
-images
-bullet
-line break
-page break
-
-notes?? [you could add a note number for every object/paragraph!]
-
- cd(@env.path.odf)
- structure=[]
- Find.find(@env.path.odf) do |f|
- structure << puts f
- end
- open(opendoc,'wb') do |f|
- zip=Zlib::ZipWriter.new(f)
- structure.each |z| do
- zip << z
- end
- zip.close
- end
- #zip -qr #{opendoc} *
- mv(opendoc,"#{@env.path.output}/#{@md.fnb}/.")
- cd(Dir.pwd)
-●
-<text:span text:style-name="T6">●</text:span> #bullet
-dob.obj.gsub!(/^(#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]})\s*#{Mx[:gl_bullet]}/,'\1 <text:span text:style-name="T6">·</text:span> ') #bullet
-dob.obj.gsub!(/^#{Mx[:gl_bullet]}/,'<text:span text:style-name="T6">·</text:span> ') #bullet
diff --git a/lib/sisu/v2/odf_format.rb b/lib/sisu/v2/odf_format.rb
deleted file mode 100644
index 1b5f2e9..0000000
--- a/lib/sisu/v2/odf_format.rb
+++ /dev/null
@@ -1,468 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: opendocument formatting, default opendocument template
-
-=end
-module SiSU_ODF_format
- require "#{SiSU_lib}/param" # param.rb
- include SiSU_Param
- include SiSU_Viz
- class Paragraph_number
- def initialize(paranum)
- @paranum=/(\d+)/m.match(paranum)[1]
- end
- def display
- @paranum.gsub(/(\d+)/,'<font size="1" color="#777777">&nbsp;&nbsp;\1</font>')
- end
- def name
- @paranum.gsub(/(\d+)/,'<a name="\1"></a>')
- end
- def goto
- @paranum.gsub(/(\d+)/,'<a href="#\1">')
- end
- end
- class Format_text_object
- def initialize(md,t_o)
- @md,@t_o=md,t_o
- if t_o.class==Hash
- @txt =t_o[:txt] || nil
- else
- p t_o.class
- p caller
- end
- rgx=/#{Mx[:en_a_o]}\d+\s+(.+?)#{Mx[:en_a_c]}/
- @txt.gsub!(rgx,'\1') if @txt =~rgx
- @vz=SiSU_Env::Get_init.instance.skin
- end
- def scr_endnote_body
- "<endnote>#{@txt}</endnote> "
- end
- def heading_body1
- end
- def heading_body2
- end
- def heading_body3
- end
- def heading_body4
- end
- def heading_body5
- end
- def heading_body6
- end
- end
- class Table
- @@tablehead,@@table_counter=0,0 #reinitialise on new file
- @@tablefoot=[] #watch
- @@fns=''
- def initialize(md,dob)
- @md,@dob,@txt,@vz=md,dob,dob.obj,SiSU_Env::Get_init.instance.skin
- if @md.fns != @@fns
- @@table_counter=0
- @@fns=@md.fns
- end
- end
- def table_head_open(count)
- type=if @dob.head_; 1
- else 2
- end
- alpha=case @dob.cols
- when 1; 'A'
- when 2; 'B'
- when 3; 'C'
- when 4; 'D'
- when 5; 'E'
- when 6; 'F'
- when 7; 'G'
- when 8; 'H'
- when 9; 'I'
- when 10; 'J'
- when 11; 'K'
- when 12; 'L'
- when 13; 'M'
- when 14; 'N'
- else 'D'
- end
- %{<table:table table:name="Table#{count}" table:style-name="Table#{type}">#{@br}} +
- %{<table:table-column table:style-name="Table#{type}.#{alpha}" table:number-columns-repeated="#{@dob.cols}"/>#{@br}}
- end
- def table_close(tablefoot='')
- '</table:table>'
- end
- def table_tag_cell(str,i)
- txt_name_cell=if i==0 \
- and @dob.head_
- 'Table_20_Heading'
- else 'P7'
- end
- str.gsub!(/^~$/,'') # tilde / empty cell
- %{<table:table-cell office:value-type="string">#{@br}} +
- %{<text:p text:style-name="#{txt_name_cell}">#{@br}} +
- %{#{str}} +
- %{</text:p>#{@br}} +
- %{</table:table-cell>#{@br}}
- end
- def table_tag_row(str,i)
- %{<table:table-row>#{@br}} +
- %{#{str}} +
- %{</table:table-row>#{@br}}
- end
- def table_tag_row_dump(str,i)
- txt_name_row=if i==0 \
- and @dob.head_
- 'Table_20_Heading'
- else 'P7'
- end
- %{<table:table-row>#{@br}} +
- %{<table:table-cell office:value-type="string">#{@br}} +
- %{<text:p text:style-name="#{txt_name_row}">#{@br}}
- %{#{str}} +
- %{</text:p>#{@br}} +
- %{</table:table-cell>#{@br}} +
- %{</table:table-row>#{@br}}
- end
- def table_row(row,i)
- row='' if row =~/^<!$/
- m=row[/<!f(.+?)!>/,1]
- @@tablefoot << m if m
- row.gsub!(/<!f.+?!>/,'')
- @cells=[]
- row.split(/\s*#{Mx[:tc_p]}/).each do |cell|
- @cells << table_tag_cell(cell,i)
- end
- row=@cells.join
- row=table_tag_row(row,i)
- row
- end
- def table
- @@table_counter+=1
- table_head_open(@@table_counter)
- @table=[]
- @dob.obj.split(/\s*#{Mx[:tc_c]}/).each_with_index do |r,i|
- @table << table_row(r,i)
- end
- @dob.obj= table_head_open(@@table_counter) + @table.join + table_close
- @dob
- end
- end
- class ODT_head
- def initialize(md)
- @md=md
- @generator="#{@md.sisu_version[:project]} #{@md.sisu_version[:version]} #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})"
- end
- def meta_inf_manifest_xml
- x=<<WOK
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE manifest:manifest PUBLIC "-//OpenOffice.org//DTD Manifest 1.0//EN" "Manifest.dtd">
-<manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0">
- <manifest:file-entry manifest:media-type="application/vnd.oasis.opendocument.text" manifest:full-path="/"/>
- <manifest:file-entry manifest:media-type="application/vnd.sun.xml.ui.configuration" manifest:full-path="Configurations2/"/>
- <manifest:file-entry manifest:media-type="" manifest:full-path="Pictures/"/>
- <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="content.xml"/>
- <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="styles.xml"/>
- <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="meta.xml"/>
- <manifest:file-entry manifest:media-type="" manifest:full-path="Thumbnails/thumbnail.png"/>
- <manifest:file-entry manifest:media-type="" manifest:full-path="Thumbnails/"/>
- <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="settings.xml"/>
-</manifest:manifest>
-WOK
- x.strip!
- x.gsub!(/\n+/m,'') unless @md.opt.cmd=~/M/
- x
- end
- def meta_xml
- x=<<WOK
-<?xml version="1.0" encoding="UTF-8"?>
-<office:document-meta xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:ooo="http://openoffice.org/2004/office" office:version="1.0">
- <office:meta>
- <meta:generator>#{@generator}</meta:generator>
- <meta:creation-date>#{@md.generated}</meta:creation-date>
- <dc:date>#{@md.generated}</dc:date>
- <dc:language>en-US</dc:language>
- <meta:editing-cycles>4</meta:editing-cycles>
- </office:meta>
-</office:document-meta>
-WOK
- x.strip!
- x.gsub!(/\n+/m,'') unless @md.opt.cmd=~/M/
- x
- end
- def settings_xml
- x=<<WOK
-<?xml version="1.0" encoding="UTF-8"?>
-<office:document-settings xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" office:version="1.0">
- <office:settings>
- <config:config-item-set config:name="ooo:view-settings">
- <config:config-item config:name="ViewAreaTop" config:type="int">0</config:config-item>
- <config:config-item config:name="ViewAreaLeft" config:type="int">0</config:config-item>
- <config:config-item config:name="ViewAreaWidth" config:type="int">21459</config:config-item>
- <config:config-item config:name="ViewAreaHeight" config:type="int">22068</config:config-item>
- <config:config-item config:name="ShowRedlineChanges" config:type="boolean">true</config:config-item>
- <config:config-item config:name="InBrowseMode" config:type="boolean">false</config:config-item>
- <config:config-item-map-indexed config:name="Views">
- <config:config-item-map-entry>
- <config:config-item config:name="ViewId" config:type="string">view2</config:config-item>
- <config:config-item config:name="ViewLeft" config:type="int">3002</config:config-item>
- <config:config-item config:name="ViewTop" config:type="int">11008</config:config-item>
- <config:config-item config:name="VisibleLeft" config:type="int">0</config:config-item>
- <config:config-item config:name="VisibleTop" config:type="int">0</config:config-item>
- <config:config-item config:name="VisibleRight" config:type="int">21458</config:config-item>
- <config:config-item config:name="VisibleBottom" config:type="int">22066</config:config-item>
- <config:config-item config:name="ZoomType" config:type="short">0</config:config-item>
- <config:config-item config:name="ZoomFactor" config:type="short">100</config:config-item>
- <config:config-item config:name="IsSelectedFrame" config:type="boolean">false</config:config-item>
- </config:config-item-map-entry>
- </config:config-item-map-indexed>
- </config:config-item-set>
- <config:config-item-set config:name="ooo:configuration-settings">
- <config:config-item config:name="AddParaTableSpacing" config:type="boolean">true</config:config-item>
- <config:config-item config:name="PrintReversed" config:type="boolean">false</config:config-item>
- <config:config-item config:name="LinkUpdateMode" config:type="short">1</config:config-item>
- <config:config-item config:name="IgnoreFirstLineIndentInNumbering" config:type="boolean">false</config:config-item>
- <config:config-item config:name="CharacterCompressionType" config:type="short">0</config:config-item>
- <config:config-item config:name="PrintSingleJobs" config:type="boolean">false</config:config-item>
- <config:config-item config:name="UpdateFromTemplate" config:type="boolean">false</config:config-item>
- <config:config-item config:name="PrintPaperFromSetup" config:type="boolean">false</config:config-item>
- <config:config-item config:name="AddFrameOffsets" config:type="boolean">false</config:config-item>
- <config:config-item config:name="PrintLeftPages" config:type="boolean">true</config:config-item>
- <config:config-item config:name="RedlineProtectionKey" config:type="base64Binary"/>
- <config:config-item config:name="PrintTables" config:type="boolean">true</config:config-item>
- <config:config-item config:name="ChartAutoUpdate" config:type="boolean">true</config:config-item>
- <config:config-item config:name="PrintControls" config:type="boolean">true</config:config-item>
- <config:config-item config:name="PrinterSetup" config:type="base64Binary"/>
- <config:config-item config:name="PrintAnnotationMode" config:type="short">0</config:config-item>
- <config:config-item config:name="LoadReadonly" config:type="boolean">false</config:config-item>
- <config:config-item config:name="AddParaSpacingToTableCells" config:type="boolean">true</config:config-item>
- <config:config-item config:name="AddExternalLeading" config:type="boolean">true</config:config-item>
- <config:config-item config:name="ApplyUserData" config:type="boolean">true</config:config-item>
- <config:config-item config:name="FieldAutoUpdate" config:type="boolean">true</config:config-item>
- <config:config-item config:name="SaveVersionOnClose" config:type="boolean">false</config:config-item>
- <config:config-item config:name="SaveGlobalDocumentLinks" config:type="boolean">false</config:config-item>
- <config:config-item config:name="IsKernAsianPunctuation" config:type="boolean">false</config:config-item>
- <config:config-item config:name="AlignTabStopPosition" config:type="boolean">true</config:config-item>
- <config:config-item config:name="CurrentDatabaseDataSource" config:type="string"/>
- <config:config-item config:name="PrinterName" config:type="string"/>
- <config:config-item config:name="PrintFaxName" config:type="string"/>
- <config:config-item config:name="ConsiderTextWrapOnObjPos" config:type="boolean">false</config:config-item>
- <config:config-item config:name="PrintRightPages" config:type="boolean">true</config:config-item>
- <config:config-item config:name="IsLabelDocument" config:type="boolean">false</config:config-item>
- <config:config-item config:name="UseFormerLineSpacing" config:type="boolean">false</config:config-item>
- <config:config-item config:name="AddParaTableSpacingAtStart" config:type="boolean">true</config:config-item>
- <config:config-item config:name="UseFormerTextWrapping" config:type="boolean">false</config:config-item>
- <config:config-item config:name="PrintProspect" config:type="boolean">false</config:config-item>
- <config:config-item config:name="PrintGraphics" config:type="boolean">true</config:config-item>
- <config:config-item config:name="AllowPrintJobCancel" config:type="boolean">true</config:config-item>
- <config:config-item config:name="CurrentDatabaseCommandType" config:type="int">0</config:config-item>
- <config:config-item config:name="DoNotJustifyLinesWithManualBreak" config:type="boolean">false</config:config-item>
- <config:config-item config:name="UseFormerObjectPositioning" config:type="boolean">false</config:config-item>
- <config:config-item config:name="PrinterIndependentLayout" config:type="string">high-resolution</config:config-item>
- <config:config-item config:name="UseOldNumbering" config:type="boolean">false</config:config-item>
- <config:config-item config:name="PrintPageBackground" config:type="boolean">true</config:config-item>
- <config:config-item config:name="CurrentDatabaseCommand" config:type="string"/>
- <config:config-item config:name="PrintDrawings" config:type="boolean">true</config:config-item>
- <config:config-item config:name="PrintBlackFonts" config:type="boolean">false</config:config-item>
- </config:config-item-set>
- </office:settings>
-</office:document-settings>
-WOK
- x.strip!
- x.gsub!(/\n+/m,'') unless @md.opt.cmd=~/M/
- x
- end
- def styles_xml
- x=<<WOK
-<?xml version="1.0" encoding="UTF-8"?>
-<office:document-styles xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" office:version="1.0">
- <office:font-face-decls>
- <style:font-face style:name="HG Mincho Light J" svg:font-family="'HG Mincho Light J', 'MS Mincho', 'HG Mincho J', 'HG Mincho L', 'HG Mincho', Mincho, 'MS PMincho', 'HG Mincho Light J', 'MS Gothic', 'HG Gothic J', 'HG Gothic B', 'HG Gothic', Gothic, 'MS PGothic', 'Andale Sans UI', 'Arial Unicode MS', 'Lucida Sans Unicode', Tahoma" style:font-pitch="variable"/>
- <style:font-face style:name="Nimbus Sans L" svg:font-family="'Nimbus Sans L'" style:font-pitch="variable"/>
- <style:font-face style:name="Tahoma" svg:font-family="Tahoma, Lucidasans, 'Lucida Sans', 'Arial Unicode MS'" style:font-pitch="variable"/>
- <style:font-face style:name="Nimbus Roman No9 L" svg:font-family="'Nimbus Roman No9 L'" style:font-family-generic="roman" style:font-pitch="variable"/>
- <style:font-face style:name="Bitstream Vera Sans" svg:font-family="'Bitstream Vera Sans'" style:font-family-generic="swiss" style:font-pitch="variable"/>
- </office:font-face-decls>
- <office:styles>
- <style:default-style style:family="graphic">
- <style:graphic-properties draw:shadow-offset-x="0.3cm" draw:shadow-offset-y="0.3cm" draw:start-line-spacing-horizontal="0.283cm" draw:start-line-spacing-vertical="0.283cm" draw:end-line-spacing-horizontal="0.283cm" draw:end-line-spacing-vertical="0.283cm" style:flow-with-text="false"/>
- <style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" style:writing-mode="lr-tb" style:font-independent-line-spacing="false">
- <style:tab-stops/>
- </style:paragraph-properties>
- <style:text-properties style:use-window-font-color="true" fo:font-size="12pt" fo:language="en" fo:country="US" style:font-size-asian="12pt" style:language-asian="none" style:country-asian="none" style:font-size-complex="12pt" style:language-complex="none" style:country-complex="none"/>
- </style:default-style>
- <style:default-style style:family="paragraph">
- <style:paragraph-properties fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="1.251cm" style:writing-mode="page"/>
- <style:text-properties style:use-window-font-color="true" style:font-name="Nimbus Roman No9 L" fo:font-size="12pt" fo:language="en" fo:country="US" style:font-name-asian="Nimbus Sans L" style:font-size-asian="12pt" style:language-asian="none" style:country-asian="none" style:font-name-complex="Nimbus Sans L" style:font-size-complex="12pt" style:language-complex="none" style:country-complex="none" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2"/>
- </style:default-style>
- <style:default-style style:family="table">
- <style:table-properties table:border-model="collapsing"/>
- </style:default-style>
- <style:default-style style:family="table-row">
- <style:table-row-properties fo:keep-together="auto"/>
- </style:default-style>
- <style:style style:name="Standard" style:family="paragraph" style:class="text"/>
- <style:style style:name="Text_20_body" style:display-name="Text body" style:family="paragraph" style:parent-style-name="Standard" style:class="text">
- <style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0.212cm"/>
- </style:style>
- <style:style style:name="Heading" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Text_20_body" style:class="text">
- <style:paragraph-properties fo:margin-top="0.423cm" fo:margin-bottom="0.212cm" fo:keep-with-next="always"/>
- <style:text-properties style:font-name="Bitstream Vera Sans" fo:font-size="14pt" style:font-name-asian="HG Mincho Light J" style:font-size-asian="14pt" style:font-name-complex="Tahoma" style:font-size-complex="14pt"/>
- </style:style>
- <style:style style:name="Heading_20_1" style:display-name="Heading 1" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:class="text" style:default-outline-level="1">
- <style:text-properties fo:font-size="120%" fo:font-weight="bold" style:font-size-asian="120%" style:font-weight-asian="bold" style:font-size-complex="115%" style:font-weight-complex="bold"/>
- </style:style>
- <style:style style:name="Heading_20_2" style:display-name="Heading 2" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:class="text" style:default-outline-level="2">
- <style:text-properties fo:font-size="115%" fo:font-weight="bold" style:font-size-asian="115%" style:font-weight-asian="bold" style:font-size-complex="115%" style:font-weight-complex="bold"/>
- </style:style>
- <style:style style:name="Heading_20_3" style:display-name="Heading 3" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:class="text" style:default-outline-level="3">
- <style:text-properties fo:font-size="110%" fo:font-weight="bold" style:font-size-asian="110%" style:font-weight-asian="bold" style:font-size-complex="115%" style:font-weight-complex="bold"/>
- </style:style>
- <style:style style:name="Heading_20_4" style:display-name="Heading 4" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:class="text" style:default-outline-level="4">
- <style:text-properties fo:font-size="100%" fo:font-style="italic" fo:font-weight="bold" style:font-size-asian="100%" style:font-style-asian="italic" style:font-weight-asian="bold" style:font-size-complex="100%" style:font-style-complex="italic" style:font-weight-complex="bold"/>
- </style:style>
- <style:style style:name="Heading_20_5" style:display-name="Heading 5" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:class="text" style:default-outline-level="5">
- <style:text-properties fo:font-size="90%" fo:font-style="italic" fo:font-weight="bold" style:font-size-asian="90%" style:font-style-asian="italic" style:font-weight-asian="bold" style:font-size-complex="90%" style:font-style-complex="italic" style:font-weight-complex="bold"/>
- </style:style>
- <style:style style:name="Heading_20_6" style:display-name="Heading 6" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:class="text" style:default-outline-level="6">
- <style:text-properties fo:font-size="80%" fo:font-style="italic" fo:font-weight="bold" style:font-size-asian="80%" style:font-style-asian="italic" style:font-weight-asian="bold" style:font-size-complex="80%" style:font-style-complex="italic" style:font-weight-complex="bold"/>
- </style:style>
- <style:style style:name="Footnote" style:family="paragraph" style:parent-style-name="Standard" style:class="extra">
- <style:paragraph-properties fo:margin-left="0.499cm" fo:margin-right="0cm" fo:text-indent="-0.499cm" style:auto-text-indent="false" text:number-lines="false" text:line-number="0"/>
- <style:text-properties fo:font-size="10pt" style:font-size-asian="10pt" style:font-size-complex="10pt"/>
- </style:style>
- <style:style style:name="Footnote_20_Symbol" style:display-name="Footnote Symbol" style:family="text"/>
- <style:style style:name="Footnote_20_anchor" style:display-name="Footnote anchor" style:family="text">
- <style:text-properties style:text-position="super 58%"/>
- </style:style>
- <style:style style:name="Graphics" style:family="graphic">
- <style:graphic-properties text:anchor-type="paragraph" svg:x="0cm" svg:y="0cm" style:wrap="dynamic" style:number-wrapped-paragraphs="no-limit" style:wrap-contour="false" style:vertical-pos="top" style:vertical-rel="paragraph" style:horizontal-pos="center" style:horizontal-rel="paragraph"/>
- </style:style>
- <text:outline-style>
- <text:outline-level-style text:level="1" style:num-format="">
- <style:list-level-properties text:min-label-distance="0.381cm"/>
- </text:outline-level-style>
- <text:outline-level-style text:level="2" style:num-format="">
- <style:list-level-properties text:min-label-distance="0.381cm"/>
- </text:outline-level-style>
- <text:outline-level-style text:level="3" style:num-format="">
- <style:list-level-properties text:min-label-distance="0.381cm"/>
- </text:outline-level-style>
- <text:outline-level-style text:level="4" style:num-format="">
- <style:list-level-properties text:min-label-distance="0.381cm"/>
- </text:outline-level-style>
- <text:outline-level-style text:level="5" style:num-format="">
- <style:list-level-properties text:min-label-distance="0.381cm"/>
- </text:outline-level-style>
- <text:outline-level-style text:level="6" style:num-format="">
- <style:list-level-properties text:min-label-distance="0.381cm"/>
- </text:outline-level-style>
- <text:outline-level-style text:level="7" style:num-format="">
- <style:list-level-properties text:min-label-distance="0.381cm"/>
- </text:outline-level-style>
- <text:outline-level-style text:level="8" style:num-format="">
- <style:list-level-properties text:min-label-distance="0.381cm"/>
- </text:outline-level-style>
- <text:outline-level-style text:level="9" style:num-format="">
- <style:list-level-properties text:min-label-distance="0.381cm"/>
- </text:outline-level-style>
- <text:outline-level-style text:level="10" style:num-format="">
- <style:list-level-properties text:min-label-distance="0.381cm"/>
- </text:outline-level-style>
- </text:outline-style>
- <text:notes-configuration text:note-class="footnote" text:citation-style-name="Footnote_20_Symbol" text:citation-body-style-name="Footnote_20_anchor" style:num-format="1" text:start-value="0" text:footnotes-position="page" text:start-numbering-at="document"/>
- <text:notes-configuration text:note-class="endnote" style:num-format="i" text:start-value="0"/>
- <text:linenumbering-configuration text:number-lines="false" text:offset="0.499cm" style:num-format="1" text:number-position="left" text:increment="5"/>
- </office:styles>
- <office:automatic-styles>
- <style:page-layout style:name="pm1">
- <style:page-layout-properties fo:page-width="20.999cm" fo:page-height="29.699cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:footnote-max-height="0cm">
- <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
- </style:page-layout-properties>
- <style:header-style/>
- <style:footer-style/>
- </style:page-layout>
- </office:automatic-styles>
- <office:master-styles>
- <style:master-page style:name="Standard" style:page-layout-name="pm1"/>
- </office:master-styles>
-</office:document-styles>
-WOK
- x.strip!
- x.gsub!(/\n+/m,'') unless @md.opt.cmd=~/M/
- x
- end
- def mimetype
- x=<<WOK
-application/vnd.oasis.opendocument.text
-WOK
- x.strip!
- end
- end
- class Format_obj_break
- def initialize(md,t_o)
- @md,@t_o=md,t_o
- end
- def br_page
- @t_o.obj='<text:p text:style-name="P8"> </text:p>'
- @t_o
- end
- def obj_sep #center later
- sep='--- '
- @t_o.obj=%{<text:p text:style-name="P1">#{sep*20}</text:p>}
- @t_o
- end
- end
- class XML
- end
-end
-__END__
diff --git a/lib/sisu/v2/options.rb b/lib/sisu/v2/options.rb
deleted file mode 100644
index 4997e35..0000000
--- a/lib/sisu/v2/options.rb
+++ /dev/null
@@ -1,217 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: SiSU information Structuring Universe, command line options
- parsing
-
-=end
-module SiSU_commandline
- require "#{SiSU_lib}/sysenv" # sysenv.rb
- class Options
- attr_accessor :cmd,:mod,:files,:fns,:fnb,:fnc,:fncb,:what
- def initialize(a)
- @cmd,@files,@fns,@fnb,@fnc,@fncb,@what,c,w,s='','','','','','','','','','',''
- @files,@mod,m,f,z,ca=[],[],[],[],[],[]
- @env=SiSU_Env::Info_env.new
- shortcut=SiSU_Env::Info_processing_flag.new
- a.each do |x|
- y=case x
- when /0/
- (x=~/^-1\S+/) \
- ? x.gsub(/^-0(\S+)/,shortcut.cf_0 + ' -\1') \
- : x.gsub(/^-0/,shortcut.cf_0 + ' ')
- when /1/
- (x=~/^-1\S+/) \
- ? x.gsub(/^-1(\S+)/,shortcut.cf_1 + ' -\1') \
- : x.gsub(/^-1/,shortcut.cf_1 + ' ')
- when /2/
- (x=~/^-2\S+/) \
- ? x.gsub(/^-2(\S+)/,shortcut.cf_2 + ' -\1') \
- : x.gsub(/^-2/,shortcut.cf_2 + ' ')
- when /3/
- (x=~/^-3\S+/) \
- ? x.gsub(/^-3(\S+)/,shortcut.cf_3 + ' -\1') \
- : x.gsub(/^-3/,shortcut.cf_3 + ' ')
- when /4/
- (x=~/^-4\S+/) \
- ? x.gsub(/^-4(\S+)/,shortcut.cf_4 + ' -\1') \
- : x.gsub(/^-4/,shortcut.cf_4 + ' ')
- when /5/
- (x=~/^-5\S+/) \
- ? x.gsub(/^-5(\S+)/,shortcut.cf_5 + ' -\1') \
- : x.gsub(/^-5/,shortcut.cf_5 + ' ')
- when /6/
- (x=~/^-6\S+/) \
- ? x.gsub(/^-6(\S+)/,shortcut.cf_5 + ' -\1') \
- : x.gsub(/^-6/,shortcut.cf_5 + ' ')
- else x
- end
- s << " #{y}" unless y.empty?
- end
- s.strip!
- a=s.split(/\s+/)
- a.each do |x|
- if x =~/^-[a-z0-5]+/i \
- or x =~/^--\S+/
- if x =~/^-([a-z0-5]+)/i; c << $1
- end
- if x =~/^--\S+/; m << x
- end
- elsif x =~ /(?:\.(?:(?:-|ssm\.)?sst(?:\.xml)?|ssm|ssi|sx[sdn]\.xml|s[1-3]|kdi|ssp)|\S+?\.ss[mt]\.zip|sisupod(\.zip)?)$/
- if x =~/^(?:https?|file):\/\/\S+/; f << x
- elsif FileTest.file?(x); f << x
- else puts "file not found: #{x}"
- end
- elsif x =~ /\.termsheet\.rb$/
- if FileTest.file?(x); f << x
- else puts "file not found: #{x}"
- end
- else w=x
- puts "#{x} in #{a.join(' ')}?"
- end
- end
- unless m.empty?
- m.each do |m|
- case m
- when /^--(?:color-toggle)$/; c=c+'c'
- when /^--(?:configure)$/; c=c+'CC'
- when /^--(?:dal?|machine|abstraction|abs)$/; c=c+'m'
- when /^--(?:txt|text|plaintext)$/; c=c+'t'
- when /^--(?:html)$/; c=c+'h'
- when /^--(?:epub)$/; c=c+'e'
- when /^--(?:od[ft])$/; c=c+'o'
- when /^--(?:pdf)$/; c=c+'p'
- when /^--(?:concordance|wordmap)$/; c=c+'w'
- when /^--(?:manpage)$/; c=c+'i'
- when /^--(?:texinfo)$/; c=c+'I'
- when /^--(?:xhtml)$/; c=c+'b'
- when /^--(?:xml-sax)$/; c=c+'x'
- when /^--(?:xml-dom)$/; c=c+'X'
- when /^--(?:digest)$/; c=c+'N'
- when /^--(?:termsheet)$/; c=c+'T'
- when /^--(?:manifest)$/; c=c+'y'
- when /^--(?:sqlite)$/; c=c+'d'
- when /^--(?:pg|pg?sql|postgresql)$/; c=c+'D'
- when /^--(?:remote|rsync)$/; c=c+'R'
- when /^--(?:scp)$/; c=c+'r'
- when /^--(?:source)$/; c=c+'s'
- when /^--(?:sisupod|pod)$/; c=c+'S'
- when /^--(?:git)$/; c=c+'g'
- when /^--(?:urls)$/; c=c+'U'
- when /^--(?:zap|delete)$/; c=c+'Z'
- when /^--(?:sample-search-form)$/; c=c+'F'
- when /^--(?:webserv|webrick)$/; c=c+'W'
- when /^--(?:maintenance|keep-processing-files)$/; c=c+'M'
- when /^--(?:verbose[=-]3)$/; c=c+'VM'
- when /^--(?:verbose[=-]2|Verbose|VERBOSE)$/; c=c+'V'
- when /^--(?:verbose(?:[=-]1)?)$/; c=c+'v'
- when /^--(?:verbose[=-]0|quiet|silent)$/; c=c+'q'
- else @mod << m
- end
- end
- end
- unless c.empty?
- c.gsub!(/-/,'')
- c.scan(/CC|\S/) {|x| ca << x}
- @cmd= '-' + ca.uniq.join
- end
- unless w.empty? ; @what=w
- end
- @files << f
- @files.flatten!
- if @files.length > 0 \
- and @cmd.empty? \
- and @mod.length==0 #% if no other action called on filename given, default is sisu -0 [filename(s)] configured as flag default
- @cmd=shortcut.cf_0
- end
- SiSU_Screen::Ansi.new(@cmd,"\tsisu " + @cmd + ' ' + @mod.join(' ') + ' ' + @files.join(' ') + "\n").print_brown if @cmd =~/[vVM]/
- @files.uniq!
- end
- def cmd
- @cmd
- end
- def mod
- @mod
- end
- def fns
- @fns
- end
- def what
- @what
- end
- def fnb
- unless fns.empty?
- fns[/(.+?)\.(?:(?:-|ssm\.)?sst|ssm)$/,1]
- end
- end
- def fnc
- @fnc=if @fns =~/\.(?:ssm\.sst|ssm)$/; fnb + '.ssm.sst'
- else @fns
- end
- end
- def fncb
- @fncb=if @fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/; fnb + '.ssm.sst'
- else @fns.gsub(/(?:\~\S{2,3})?(\.sst)$/,'\1')
- end
- end
- end
-end
-__END__
-note usually named @opt
-is carried in Param usually as @md
-@opt is a subset of @md
-where @md is passed, contents of @opt are available
-passing @opt as well is duplication
-check for fns & fnb
diff --git a/lib/sisu/v2/plaintext.rb b/lib/sisu/v2/plaintext.rb
deleted file mode 100644
index ba14697..0000000
--- a/lib/sisu/v2/plaintext.rb
+++ /dev/null
@@ -1,419 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: plaintext text generation, stripped plaintext output (unix,
- linefeed)
-
-=end
-module SiSU_Plaintext
- require "#{SiSU_lib}/dal" # dal.rb
- require "#{SiSU_lib}/sysenv" # sysenv.rb
- include SiSU_Env
- require "#{SiSU_lib}/plaintext_format" # plaintext_format.rb
- include SiSU_Plaintext_format
- require "#{SiSU_lib}/shared_metadata" # shared_metadata.rb
- require "#{SiSU_lib}/shared_txt" # shared_txt.rb
- include SiSU_Param
- include SiSU_Viz
- pwd=Dir.pwd
- @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0
- @@tablefoot=''
- class Source
- def initialize(opt)
- @opt=opt
- unless @opt.fns =~/(.+?)\.(?:-|ssm\.)?sst$/
- puts "#{sf} not a processed file type"
- end
- end
- def read
- begin
- md=SiSU_Param::Parameters.new(@opt).get
- env=SiSU_Env::Info_env.new(@opt.fns)
- unless @opt.cmd =~/q/
- path=env.path.output_tell
- tool=(@opt.cmd =~/[MVv]/) \
- ? "#{env.program.text_editor} #{path}/#{md.fnb}/#{md.fn[:plain]}" \
- : @opt.fns
- @opt.cmd=~/[MVvz]/ \
- ? SiSU_Screen::Ansi.new(@opt.cmd,'Plaintext',tool).green_hi_blue \
- : SiSU_Screen::Ansi.new(@opt.cmd,'Plaintext',tool).green_title_hi
- SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{path}/#{md.fnb}/#{md.fn[:plain]}").flow if @opt.cmd =~/[MV]/
- end
- my_make=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns)
- dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here
- wrap_width=if defined? md.make.plaintext_wrap \
- and md.make.plaintext_wrap
- md.make.plaintext_wrap
- elsif defined? env.plaintext_wrap \
- and env.plaintext_wrap
- env.plaintext_wrap
- else 78
- end
- #wrap_width=(defined? md.make.plaintext_wrap) ? md.make.plaintext_wrap : 78
- SiSU_Plaintext::Source::Scroll.new(dal_array,md,wrap_width).songsheet
- SiSU_Env::Info_skin.new(md).select #watch
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- end
- end
- private
- class Scroll <Source
- require "#{SiSU_lib}/defaults" # defaults.rb
- require "#{SiSU_lib}/shared_txt" # shared_txt.rb
- include SiSU_text_utils
- @@endnotes={ :para=>[],:end=>[] }
- def initialize(data,md,wrap_width)
- @data,@md,@wrap_width=data,md,wrap_width
- @brace_url=SiSU_Viz::Skin.new.url_decoration
- @tab="\t"
- @@endnotes_=case md.mod.inspect
- when /--footnote/; false
- when /--endnote/; true
- else true
- end
- @br=case md.mod.inspect
- when /--dos/; "\r\n"
- when /--unix/; "\n"
- else "\n"
- end
- @plaintext={ :body=>[],:open=>[],:close=>[],:head=>[],:metadata=>[],:tail=>[] }
- end
- def songsheet
- plaintext=markup(@data)
- publish(plaintext)
- end
- # Used for extraction of endnotes from paragraphs
- def extract_endnotes(dob='')
- notes=dob.obj.scan(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})([\d*+]+\s+.+?)(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/)
- @n=[]
- notes.flatten.each do |n| #high cost to deal with <br> appropriately within plaintext, consider
- n=n.dup.to_s
- if n =~/#{Mx[:br_line]}|#{Mx[:br_nl]}/
- fix = n.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/) #watch #added
- fix.each do |x|
- unless x.empty?; @n << x
- end
- end
- else @n << n
- end
- end
- notes=@n.flatten
- notes.each do |e|
- util=(e.to_s =~/^\[[\d*+]+\]:/) \
- ? (SiSU_text_utils::Wrap.new(e.to_s,@wrap_width,4,1)) \
- : (SiSU_text_utils::Wrap.new(e.to_s,@wrap_width,1,1))
- wrap=util.line_wrap
- if wrap =~ /^\s*[\d*+]+\s+.+?\s*\Z/m
- wrap.gsub!(/^(\s*)([\d*+]+)\s+(.+?)\s*\Z/m, <<GSUB
-\\1[\\2]: \\3
-GSUB
- )
- else
- wrap.gsub!(/^(.+)\Z/m, <<GSUB
-\\1
-GSUB
- )
- end
- @@endnotes[:para] << "-#{wrap}"
- @@endnotes[:end] << '' << wrap
- end
- @@endnotes
- end
- def plaintext_metadata
- array=Metadata::Summary.new(@md).plaintext.metadata
- array.each do |meta|
- tag,inf=meta.scan(/^.+?:\s|.+/)
- if tag and inf
- util=SiSU_text_utils::Wrap.new(inf,@wrap_width,15,1)
- txt=util.line_wrap
- @plaintext[:metadata] <<<<WOK
-
-#{@tab}#{tag}#{txt}
-WOK
- end
- end
- end
- def plaintext_tail
- SiSU_Env::Info_skin.new(@md).select
- env=SiSU_Env::Info_env.new(@md.fns)
- vz=SiSU_Env::Get_init.instance.skin
- base_url="#{env.url.root}/#{@md.fnb}"
- generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version]
- lastdone="Last Generated on: #{Time.now}"
- rubyv="Ruby version: #{@md.ruby_version}"
- sc=if @md.sc_info
- "Source file: #{@md.sc_filename}#{@br}Version number: #{@md.sc_number}#{@br}Version date: #{@md.sc_date}#{@br}"
- else ''
- end
- @plaintext[:tail] <<<<WOK
-#{@br}
-plaintext (plain text):
- #{base_url}/#{@md.fn[:plain]}#{@br}
-Other versions of this document: #{@br}
-manifest:
- #{base_url}/#{@md.fn[:manifest]}#{@br}
-at:
- #{env.url.root}#{@br}
-
-#{sc}
-* #{generator}
-* #{rubyv}
-* #{lastdone}
-* SiSU #{vz.url_sisu}
-WOK
- end
- def plaintext_structure(dob='') #% Used to extract the structure of a document
- lv=n=n3=nil
- if dob.is=='heading'
- lv=dob.ln
- n=lv - 1
- n3=lv + 2
- end
- util=nil
- wrapped=if dob.is =='para' \
- or dob.is=='heading'
- if dob.is=='para'
- if dob.indent =~/[1-9]/
- util=if dob.bullet_
- SiSU_text_utils::Wrap.new("* #{dob.obj}",@wrap_width,dob.indent.to_i*2)
- else SiSU_text_utils::Wrap.new(dob.obj,@wrap_width,dob.indent.to_i*2)
- end
- else
- util=if dob.bullet_
- SiSU_text_utils::Wrap.new("* #{dob.obj}",@wrap_width,0)
- else SiSU_text_utils::Wrap.new(dob.obj,@wrap_width,0)
- end
- end
- else util=SiSU_text_utils::Wrap.new(dob.obj,@wrap_width,0)
- end
- util.line_wrap
- end
- if lv
- times=wrapped.length
- times=@wrap_width if times > @wrap_width
- @plaintext[:body] << case lv
- when 1; wrapped.upcase << @br << Px[:lv1]*times << @br
- when 2; wrapped.upcase << @br << Px[:lv2]*times << @br
- when 3; wrapped.upcase << @br << Px[:lv3]*times << @br
- #when 2..3; wrapped.upcase << @br << Px[:lv2_3]*times << @br
- when 4; wrapped.upcase << @br << Px[:lv4]*times << @br
- when 5; wrapped.upcase << @br << Px[:lv5]*times << @br
- when 6; wrapped.upcase << @br << Px[:lv6]*times << @br
- #when 5..6; wrapped.upcase << @br << Px[:lv5_6]*times << @br
- end
- else
- @plaintext[:body] << wrapped << @br # main text, contents, body KEEP
- end
- if @@endnotes[:para] \
- and not @@endnotes_
- @plaintext[:body] << @br
- @@endnotes[:para].each {|e| @plaintext[:body] << e << @br}
- elsif @@endnotes[:para] \
- and @@endnotes_
- @plaintext[:body] << @br*2
- end
- @@endnotes[:para]=[]
- end
- def markup(data) # Used for major markup instructions
- dir=SiSU_Env::Info_env.new(@md.fns)
- @data_mod,@endnotes,@level,@cont,@copen,@plaintext_contents_close=Array.new(6){[]}
- (0..6).each { |x| @cont[x]=@level[x]=false }
- (4..6).each { |x| @plaintext_contents_close[x]='' }
- plaintext_tail #($1,$2)
- plaintext_metadata
- table_message='[table omitted, see other document formats]'
- fix=[]
- data.each do |dob|
- dob.obj.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+/um,"#{@br}#{table_message}") #fix
- dob.obj.gsub!(/.+?#{Mx[:gl_o]}-##{Mx[:gl_c]}/,'') # remove dummy headings (used by html) #check also [~-]#
- dob.obj.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,
- "#{Px[:bold_o]}\\1#{Px[:bold_c]}")
- dob.obj.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,
- "#{Px[:italics_o]}\\1#{Px[:italics_c]}")
- dob.obj.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,
- "#{Px[:underscore_o]}\\1#{Px[:underscore_c]}")
- dob.obj.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,
- "#{Px[:subscript_o]}\\1#{Px[:subscript_c]}")
- dob.obj.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,
- "#{Px[:superscript_o]}\\1#{Px[:superscript_c]}")
- dob.obj.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,
- "#{Px[:insert_o]}\\1#{Px[:insert_c]}")
- dob.obj.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,
- "#{Px[:cite_o]}\\1#{Px[:cite_c]}")
- dob.obj.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,
- "#{Px[:strike_o]}\\1#{Px[:strike_c]}")
- dob.obj.gsub!(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,
- "#{Px[:monospace_o]}\\1#{Px[:monospace_c]}")
- unless dob.is=='code'
- dob.obj.gsub!(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/,'\1')
- dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1')
- dob.obj.gsub!(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1 [link: <\2>]')
- dob.obj.gsub!(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}image/,'\1 [link: local image]')
- dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,"#{@brace_url.txt_open}\\1#{@brace_url.txt_close}")
- extract_endnotes(dob)
- dob.obj.gsub!(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'[^\1]') # endnote marker marked up
- dob.obj.gsub!(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'[^\1]') # endnote marker marked up
- dob.obj.gsub!(/#{Mx[:gl_o]}(?:#lt|#060)#{Mx[:gl_c]}/,'<')
- dob.obj.gsub!(/#{Mx[:gl_o]}(?:#gt|#062)#{Mx[:gl_c]}/,'>')
- dob.obj.gsub!(/#{Mx[:gl_o]}#(?:038|amp)#{Mx[:gl_c]}/,'&')
- dob.obj.gsub!(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!')
- dob.obj.gsub!(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#')
- dob.obj.gsub!(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*')
- dob.obj.gsub!(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-')
- dob.obj.gsub!(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/')
- dob.obj.gsub!(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_')
- dob.obj.gsub!(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{')
- dob.obj.gsub!(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}')
- dob.obj.gsub!(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~')
- dob.obj.gsub!(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'©')
- end
- if dob.of=='group' # watch
- dob.obj.gsub!(/#{Mx[:gl_o]}●#{Mx[:gl_c]}/,"* ")
- dob.obj.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"\n")
- else dob.obj.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"\n\n")
- end
- if dob.is=='code'
- dob.obj.gsub!(/(^|[^}])_([<>])/m,'\1\2') # _> _<
- dob.obj.gsub!(/(^|[^}])_([<>])/m,'\1\2') # _<_<
- end
- dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1')
- dob.obj.gsub!(/<a href=".+?">(.+?)<\/a>/m,'\1')
- dob.obj.gsub!(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'') # remove name links
- dob.obj.gsub!(/&nbsp;|#{Mx[:nbsp]}/,' ') # decide on
- dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,' [ \1 ]') #"[ #{dir.url.images_local}\/\\1 ]")
- dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}image/,' [ \1 ]')
- dob.obj.gsub!(/(?:^|[^_\\])\{\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*\}\S+/,'[image: "\1"]')
- wordlist=dob.obj.scan(/\S+/)
- if dob.obj !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/
- if defined? dob.ocn and dob.ocn.to_s =~/\d+/
- paranum=dob.ocn.to_s
- @p_num=SiSU_Plaintext_format::Paragraph_number.new(paranum)
- end
- if dob.is=='heading' \
- or dob.is=='para'
- plaintext_structure(dob)
- elsif dob.is=='group' \
- or dob.is=='verse' \
- or dob.is=='code' \
- or dob.is=='table'
- @plaintext[:body] << dob.obj << @br
- elsif dob.is=='break'
- sp=' '
- ln='-'
- @plaintext[:body] <<=if dob.obj==Mx[:br_page] \
- or dob.obj==Mx[:br_page_new]
- "#{@br}#{ln*40}#{@br*2}"
- elsif dob.obj ==Mx[:obj_ln_sep]
- "#{@br}#{sp*20}* * *#{@br*2}"
- end # following empty line (@br) missing, fix
- end
- dob='' if (dob.obj =~/<a name="n\d+">/ \
- and dob.obj =~/^(-\{{2}~\d+|<!e[:_]\d+!>)/) # -endnote
- dob.obj.gsub!(/<!.+!>/,' ') if dob ## Clean Prepared Text
- dob.obj.gsub!(/<:\S+>/,' ') if dob ## Clean Prepared Text
- end
- end
- @plaintext
- end
- def publish(plaintext)
- divider='='
- content=[]
- content << plaintext[:open]
- content << plaintext[:head]
- content << plaintext[:body]
- content << @@endnotes[:end] if @@endnotes_
- content << "#{@br}#{divider*@wrap_width}#{@br}"
- content << plaintext[:metadata]
- content << "#{@br}#{divider*@wrap_width}#{@br}" if @md.stmp =~/\w+/ #not used?
- content << plaintext[:tail]
- Output.new(content,@md).plaintext
- @@endnotes={ :para=>[],:end=>[] }
- end
- end
- class Output <Source
- include SiSU_Param
- include SiSU_Env
- def initialize(content,md)
- @content,@md=content,md
- end
- def plaintext #%plaintext output
- SiSU_Env::SiSU_file.new(@md).mkdir
- file_plaintext=SiSU_Env::SiSU_file.new(@md,@md.fn[:plain]).mkfile
- @sisu=[]
- emptyline=0
- @content.each do |para| # this is a hack
- if para.class==Array \
- and para.length > 0
- para.each do |line|
- if line
- line.gsub!(/\s+$/m,'')
- line.gsub!(/^\A[ ]*\Z/m,'')
- if line=~/^\A[ ]*\Z/m
- emptyline+=1
- else emptyline=0
- end
- file_plaintext.puts line if emptyline < 2 #remove extra line spaces (fix upstream)
- end
- end
- else file_plaintext.puts para #unix plaintext # /^([*=-]|\.){5}/
- end
- end
- file_plaintext.close
- end
- end
- end
-end
-__END__
-&#033;\|&#035;\|&&#042;\|&#045;\|&#047;\|&#095;\|&#123;\|&#125;\|&#126;\|&#
diff --git a/lib/sisu/v2/shared_markup_alt.rb b/lib/sisu/v2/shared_markup_alt.rb
deleted file mode 100644
index 52ecfe2..0000000
--- a/lib/sisu/v2/shared_markup_alt.rb
+++ /dev/null
@@ -1,318 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
- #___#
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/copyleft/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: system environment, resource control and configuration details
-
-=end
-module SiSU_text_representation
- class Alter
- def initialize(x)
- if x.class==String
- @t_o,@s=nil,x
- else
- @t_o,@s=x,x.obj.dup
- end
- end
- def strip_clean_of_extra_spaces # 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')
- end
- def strip_clean_of_markup # text form used in sql db search, used for digest, define rules, make same as in db clean
- @s=@s.dup #% same as db clean -->
- @s=@s.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\1')
- @s=@s.gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\1')
- @s=@s.gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\1')
- @s=@s.gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'\1')
- @s=@s.gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'\1')
- @s=@s.gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strke_c]}/,'\1')
- @s=@s.gsub(/#{Mx[:fa_superscript_o]}(\d+)#{Mx[:fa_superscript_c]}/,'[\1]')
- @s=@s.gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'\1')
- @s=@s.gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'\1')
- @s=@s.gsub(/#{Mx[:fa_hilite_o]}(.+?)#{Mx[:fa_hilite_c]}/,'\1')
- @s=@s.gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/i,'~')
- @s=@s.gsub(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'') # endnote removed
- @s=@s.gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'') # endnote removed
- @s=@s.gsub(/(?:#{Mx[:nbsp]})+/,' ')
- @s=@s.gsub(/(?:#{Mx[:br_nl]})+/,"\n")
- @s=@s.gsub(/(?:#{Mx[:br_paragraph]})+/,"\n")
- @s=@s.gsub(/(?:#{Mx[:br_line]})+/,"\n")
- @s=@s.gsub(/#{Mx[:gl_o]}(?:#lt|#060)#{Mx[:gl_c]}/,'<')
- @s=@s.gsub(/#{Mx[:gl_o]}(?:#gt|#062)#{Mx[:gl_c]}/,'>')
- @s=@s.gsub(/#{Mx[:gl_o]}#(?:038|amp)#{Mx[:gl_c]}/,'&')
- @s=@s.gsub(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!')
- @s=@s.gsub(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#')
- @s=@s.gsub(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*')
- @s=@s.gsub(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-')
- @s=@s.gsub(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/')
- @s=@s.gsub(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_')
- @s=@s.gsub(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{')
- @s=@s.gsub(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}')
- @s=@s.gsub(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~')
- @s=@s.gsub(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'©')
- @s=@s.gsub(/\s\s+/,' ')
- @s=@s.gsub(/\s\s+/,' ')
- @s=@s.strip
- end
- def semi_revert_markup # used for digest, define rules, make same as in db clean
- if @t_o
- @s=@s.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'*{\1}*')
- @s=@s.gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'/{\1}/')
- @s=@s.gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'_{\1}_')
- @s=@s.gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'"{\1}"')
- @s=@s.gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'+{\1}+')
- @s=@s.gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strke_c]}/,'-{\1}-')
- @s=@s.gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'^{\1}^')
- @s=@s.gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,',{\1},')
- @s=@s.gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/i,'~')
- @s=@s.gsub(/#{Mx[:en_a_o]}([\d*+]+\s+.+?)#{Mx[:en_a_c]}/,'~{\1}~') # endnote marker marked up
- @s=@s.gsub(/#{Mx[:en_b_o]}([\d*+]+\s+.+?)#{Mx[:en_b_c]}/,'~[\1]~') # endnote marker marked up
- if @t_o.is=='heading' or @t_o.is=='para'
- @s=@s.gsub(/ [ ]+/,' ')
- @s=@s.gsub(/(?:#{Mx[:nbsp]})+/,' ')
- if @t_o.is=='heading'
- @s=@t_o.lv + '~ ' + @s
- end
- if @t_o.is=='para'
- if @t_o.bullet_
- @s='_* ' + @s
- end
- if @t_o.indent.to_i > 0
- @s="_#{@t_o.indent} " + @s
- @s=@s.gsub(/^(_[1-9])\s_\*\s/,'\1* ')
- end
- end
- end
- if @t_o.is=='group' or @t_o.is=='code'
- @s=@s.gsub(/#{Mx[:nbsp]}/,' ')
- @s="#{@t_o.is}{\n\n#{@s}\n\n}#{@t_o.is}"
- @s=@s.gsub(/(?:#{Mx[:br_nl]}|\n)+/m,"\n\n")
- end
- #dealing with poem and verse calls for change in dal, where start and end verse of poem are marked as such
- @s=@s.strip
- end
- @s
- end
- def html_lite #test whether eventually can be used in db_import replacing shared_html_lite (search for SiSU_Format_Shared)
- if @t_o
- @s=@s.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>')
- @s=@s.gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>')
- @s=@s.gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>')
- @s=@s.gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'"\1"')
- @s=@s.gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'+{\1}+')
- @s=@s.gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strke_c]}/,'-{\1}-')
- @s=@s.gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>')
- @s=@s.gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>')
- @s=@s.gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/i,'~')
- if @t_o.is !='code'
- if @s =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/
- wm=@s.scan(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)|\S+/)
- words=urls(wm)
- @s=@s.gsub(/.+/m,words)
- end
- @s=@s.gsub(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;')
- @s=@s.gsub(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;')
- @s=@s.gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'<a href="\1" target="_top">\1</a>') #http ftp matches escaped, no decoration
- @s=@s.gsub(/(#{Mx[:lnk_c]})#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1<a href="\2" target="_top">\2</a>\3') #special case \{ e.g. \}http://url
- @s=@s.gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{@url_brace.xml_open}<a href="\\1" target="_top">\\1</a>#{@url_brace.xml_close}}) #http ftp matches with decoration
- else
- @s=@s.gsub(/(^|[^}])_</m,'\1&lt;'); @s.gsub(/(^|[^}])_>/m,'\1&gt;') #code-block: angle brackets special characters
- @s=@s.gsub(/(^|[^}])_</m,'\1&lt;'); @s.gsub(/(^|[^}])_>/m,'\1&gt;')
- end
- if @t_o.is=='paragraph'
- if @t_o.bullet_
- @s=@s
- end
- if @t_o.indent > 0
- @s=@s
- end
- end
- if @t_o.is=='heading'
- @s=@s
- end
- else
- p __FILE__ +':'+ __LINE__.to_s
- end
- @s
- end
- end
- class Modified_text_plus_Hash_digest
- def initialize(md,x)
- @md=md
- if x.class==String
- @t_o,@s=nil,x
- else
- @t_o,@s=x,x.obj.dup
- end
- @env ||=SiSU_Env::Info_env.new(@md.fns)
- @sha_ =((@env.digest.type =='sha256') ? true : false)
- @sha_ ? (require 'digest/sha2') : (require 'digest/md5')
- end
- def digest(txt)
- d=nil
- if @sha_
- for hash_class in [ Digest::SHA256 ]
- d=hash_class.hexdigest(txt)
- end
- else
- for hash_class in [ Digest::MD5 ]
- d=hash_class.hexdigest(txt)
- end
- end
- d
- end
- def strip_clean_of_markup
- def txt
- SiSU_text_representation::Alter.new(@s).strip_clean_of_markup
- end
- def dgst
- en_dgst,img_dgst={},{}
- txt_dgst=digest(txt)
- {:txt=>txt,:dgst_txt=>txt_dgst}
- end
- self
- end
- def semi_revert_markup
- def txt
- SiSU_text_representation::Alter.new(@s).semi_revert_markup
- end
- def dgst
- txt_dgst=digest(txt)
- {:txt=>txt,:dgst_txt=>txt_dgst}
- end
- self
- end
- def composite
- def stripped_clean(txt)
- SiSU_text_representation::Alter.new(txt).strip_clean_of_markup
- end
- def markup_reverted(txt)
- SiSU_text_representation::Alter.new(txt).semi_revert_markup
- end
- def images(imgs)
- sys=SiSU_Env::System_call.new
- line_image=[]
- img_dgst={}
- if imgs and imgs.length > 0
- @image_name,@image_dgst,@img=[],[],[]
- imgs.each do |i|
- image_source=if FileTest.file?("#{@env.path.image_source_local_tex}/#{i}")
- @env.path.image_source_local_tex
- elsif FileTest.file?("#{@env.path.image_source_remote_tex}/#{i}")
- @env.path.image_source_remote_tex
- elsif FileTest.file?("#{@env.path.image_source_tex}/#{i}")
- @env.path.image_source_tex
- else
- SiSU_Screen::Ansi.new(@md.cmd,"ERROR - image:", %{"#{i}" missing}, "search locations: #{@env.path.image_source_local_tex}, #{@env.path.image_source_remote_tex} and #{@env.path.image_source_tex}").error2 unless @md.cmd =~/q/
- nil
- end
- img_type = /\S+\.(png|jpg|gif)/.match(i)[1]
- not_found_msg='image not found'
- if image_source
- para_image = image_source + '/' + i
- image_name = i
- image_dgst =(@sha_ ? sys.sha256(para_image) : sys.md5(para_image))
- else
- image_name = i + ' [image missing]'
- image_dgst = ''
- end
- line_image << {:img_dgst=>image_dgst[1],:img_name=>image_name,:img_type=>img_type}
- end
- end
- line_image
- end
- def endnotes(en)
- en_dgst=[]
- if en and en.length > 0
- en.flatten.each do |e|
- note_no=e.gsub(/^([\d*+]+)\s+.+/,'\1')
- e=digest(stripped_clean(e))
- note_dgst=digest(e)
- en_dgst << {:note_number=>note_no,:note_dgst=>note_dgst}
- end
- end
- en_dgst
- end
- def dgst
- if @t_o.of !='comment' and @t_o.of !='structure' and @t_o.of !='layout'
- en_dgst,img_dgst={},{}
- txt_stripped_dgst=digest(stripped_clean(@t_o))
- txt_markup_reverted_dgst=digest(markup_reverted(@t_o))
- endnotes_dgst=[]
- rgx_notes=/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})([\d*+]+\s+.+?)(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/
- notes=@t_o.obj.scan(rgx_notes)
- endnotes_dgst=endnotes(notes)
- rgx_image=/#{Mx[:lnk_o]}(\S+\.(?:png|jpg|gif))\s.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/
- imgs=if (@t_o.is=='para' or @t_o.is=='image') \
- and @t_o.obj =~rgx_image
- imgs=@t_o.obj.scan(rgx_image).flatten
- line_image=images(imgs)
- end
- dgst={:is=>@t_o.is,:ocn=>@t_o.ocn,:dgst_stripped_txt=>txt_stripped_dgst,:dgst_markedup_txt=>txt_markup_reverted_dgst}
- dgst[:endnotes]=endnotes_dgst if endnotes_dgst and endnotes_dgst.length > 0
- dgst[:images]=line_image if line_image and line_image.length > 0
- end
- dgst
- end
- self
- end
- end
-end
-__END__
diff --git a/lib/sisu/v2/shared_metadata.rb b/lib/sisu/v2/shared_metadata.rb
deleted file mode 100644
index f27cf5b..0000000
--- a/lib/sisu/v2/shared_metadata.rb
+++ /dev/null
@@ -1,800 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/copyleft/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: system environment, resource control and configuration details
-
-=end
-module Metadata
- class Summary
- attr_accessor :tag,:inf,:class,:attrib
- def initialize(md,display_heading=false)
- @md,@display_heading=md,display_heading
- @tag,@inf,@class,@attrib=nil
- end
- def metadata_base
- meta,tag=[],[]
- dir=SiSU_Env::Info_env.new(@md.fns)
- base_html="#{dir.url.root}/#{@md.fnb}"
- l=SiSU_Env::Standardise_language.new.file_to_language(@md.fns)
- language=l[:l]
- tr=SiSU_Translate::Source.new(@md,language)
- @attrib='md'
- if @display_heading
- @tag,@inf=%{<b><u>Document Metadata</u></b>},''
- meta << self.meta_para
- end
- if defined? @md.title.full \
- and @md.title.full=~/\S+/
- @tag,@inf,@class=tr.full_title,@md.title.full,'dc' #1
- meta << self.meta_para
- end
- if defined? @md.creator.author \
- and @md.creator.author=~/\S+/
- @tag,@inf,@class=tr.author,@md.creator.author,'dc' #2
- meta << self.meta_para
- end
- if defined? @md.creator.translator \
- and @md.creator.translator=~/\S+/
- @tag,@inf,@class=tr.translator,@md.creator.translator,'ext'
- meta << self.meta_para
- end
- if defined? @md.creator.illustrator \
- and @md.creator.illustrator=~/\S+/
- @tag,@inf,@class=tr.illustrator,@md.creator.illustrator,'ext'
- meta << self.meta_para
- end
- if defined? @md.creator.prepared_by \
- and @md.creator.prepared_by=~/\S+/
- @tag,@inf,@class=tr.prepared_by,@md.creator.prepared_by,'ext'
- meta << self.meta_para
- end
- if defined? @md.creator.digitized_by \
- and @md.creator.digitized_by=~/\S+/
- @tag,@inf,@class=tr.digitized_by,@md.creator.digitized_by,'ext'
- meta << self.meta_para
- end
- if defined? @md.rights.all \
- and @md.rights.all=~/\S+/
- @tag,@inf,@class=tr.rights,@md.rights.all,'dc' #15
- meta << self.meta_para
- end
- if defined? @md.classify.subject \
- and @md.classify.subject=~/\S+/
- @tag,@inf,@class=tr.subject,@md.classify.subject,'dc' #3
- meta << self.meta_para
- end
- if defined? @md.notes.description \
- and @md.notes.description=~/\S+/
- @tag,@inf,@class=tr.description,@md.notes.description,'dc' #4
- meta << self.meta_para
- end
- if defined? @md.publisher \
- and @md.publisher=~/\S+/
- @tag,@inf,@class=tr.publisher,@md.publisher,'dc' #5
- meta << self.meta_para
- end
- if defined? @md.creator.contributor \
- and @md.creator.contributor=~/\S+/
- @tag,@inf,@class=tr.contributor,@md.creator.contributor,'dc' #6
- meta << self.meta_para
- end
- if defined? @md.notes.abstract \
- and @md.notes.abstract=~/\S+/
- @tag,@inf,@class=tr.abstract,@md.notes.abstract,'ext'
- meta << self.meta_para
- end
- if defined? @md.date.created \
- and @md.date.created=~/\S+/
- @tag,@inf,@class=tr.date_created,@md.date.created,'dc' #7
- meta << self.meta_para
- end
- if defined? @md.date.issued \
- and @md.date.issued=~/\S+/
- @tag,@inf,@class=tr.date_issued,@md.date.issued,'dc' #7
- meta << self.meta_para
- end
- if defined? @md.date.available \
- and @md.date.available=~/\S+/
- @tag,@inf,@class=tr.date_available,@md.date.available,'dc' #7
- meta << self.meta_para
- end
- if defined? @md.date.modified \
- and @md.date.modified=~/\S+/
- @tag,@inf,@class=tr.date_modified,@md.date.modified,'dc' #7
- meta << self.meta_para
- end
- if defined? @md.date.valid \
- and @md.date.valid=~/\S+/
- @tag,@inf,@class=tr.date_valid,@md.date.valid,'dc' #7
- meta << self.meta_para
- end
- if defined? @md.date.published \
- and @md.date.published=~/\S+/
- @tag,@inf,@class=tr.date,@md.date.published,'dc' #7
- meta << self.meta_para
- end
- if defined? @md.type \
- and @md.date=~/\S+/
- @tag,@inf,@class=tr.type,@md.type,'dc' #8
- meta << self.meta_para
- end
- if defined? @md.classify.loc \
- and @md.classify.loc=~/\S+/
- @tag,@inf,@class=tr.cls_loc,@md.classify.loc,'id'
- meta << self.meta_para
- end
- if defined? @md.classify.dewey \
- and @md.classify.dewey=~/\S+/
- @tag,@inf,@class=tr.cls_dewey,@md.classify.dewey,'id'
- meta << self.meta_para
- end
- if defined? @md.classify.pg \
- and @md.classify.pg=~/\S+/
- @tag,@inf,@class=tr.cls_gutenberg,@md.classify.pg,'id'
- meta << self.meta_para
- end
- if defined? @md.classify.isbn \
- and @md.classify.isbn=~/\S+/
- @tag,@inf,@class=tr.cls_isbn,@md.classify.isbn,'id'
- meta << self.meta_para
- end
- if defined? @md.notes.comment \
- and @md.notes.comment=~/\S+/
- @tag,@inf,@class=tr.comments,@md.notes.comment,'ext'
- meta << self.meta_para
- end
- if defined? @md.notes.prefix_a \
- and @md.notes.prefix_a=~/\S+/
- @tag,@inf,@class=tr.prefix_a,@md.notes.prefix_a,'inf'
- meta << self.meta_para
- end
- if defined? @md.notes.prefix_b \
- and @md.notes.prefix_b=~/\S+/
- @tag,@inf,@class=tr.prefix_b,@md.notes.prefix_b,'inf'
- meta << self.meta_para
- end
- if defined? @md.classify.identifier \
- and @md.classify.identifier=~/\S+/
- @tag,@inf,@class=tr.identifier,@md.classify.identifier,'dc' #10
- meta << self.meta_para
- end
- if defined? @md.original.source \
- and @md.original.source=~/\S+/
- @tag,@inf,@class=tr.source,@md.original.source,'dc' #11
- meta << self.meta_para
- end
- if defined? @md.title.language \
- and @md.title.language=~/\S+/
- @tag,@inf,@class=tr.language,@md.title.language,'dc' #12
- meta << self.meta_para
- end
- if defined? @md.original.language \
- and @md.original.language=~/\S+/
- @tag,@inf,@class=tr.language_original,@md.original.language,'ext'
- meta << self.meta_para
- end
- if defined? @md.classify.format \
- and @md.classify.format=~/\S+/
- @tag,@inf,@class=tr.format,@md.classify.format,'dc' #9
- meta << self.meta_para
- end
- if defined? @md.classify.relation \
- and @md.classify.relation=~/\S+/
- @tag,@inf,@class=tr.relation,@md.classify.relation,'dc' #13
- meta << self.meta_para
- end
- if defined? @md.classify.coverage \
- and @md.classify.coverage=~/\S+/
- @tag,@inf,@class=tr.coverage,@md.classify.coverage,'dc' #14
- meta << self.meta_para
- end
- if defined? @md.classify.keywords \
- and @md.classify.keywords=~/\S+/
- @tag,@inf,@class=tr.keywords,@md.classify.keywords,'ext'
- meta << self.meta_para
- end
- if @display_heading
- @tag,@inf=%{<b><u>Version Information</u></b>},''
- meta << self.meta_para
- end
- if defined? @md.fns \
- and @md.fns=~/\S+/
- @tag,@inf,@class=tr.sourcefile,@md.fns,'src'
- meta << self.meta_para
- end
- if defined? @md.file_encoding \
- and @md.file_encoding=~/\S+/
- @tag,@inf,@class='Filetype',@md.file_encoding,'src'
- meta << self.meta_para
- end
- if defined? @md.dgst \
- and @md.dgst.class==Array
- @tag,@inf,@class='Source Digest',"#{@md.dgst[0]} #{@md.dgst[1]}",'src'
- meta << self.meta_para
- end
- if defined? @md.dgst_skin \
- and @md.dgst_skin.class==Array
- @tag,@inf,@class='Skin Digest',"#{@md.dgst_skin[0]} #{@md.dgst_skin[1]}",'src'
- meta << self.meta_para
- end
- if @display_heading
- @tag,@inf=%{<b><u>Generated</u></b>},''
- meta << self.meta_para
- end
- if defined? @md.sisu_version \
- and @md.sisu_version[:version]=~/\S+/
- v="#{tr.sisu_version}: " +
- "#{@md.sisu_version[:project]} " +
- "#{@md.sisu_version[:version]} " +
- "of #{@md.sisu_version[:date_stamp]} " +
- "(#{@md.sisu_version[:date]})"
- @tag,@inf,@class='Generated by',v,'ver'
- meta << self.meta_para
- end
- if defined? @md.ruby_version \
- and @md.ruby_version=~/\S+/
- @tag,@inf,@class=tr.ruby_version,@md.ruby_version,'ver'
- meta << self.meta_para
- end
- if defined? @md.generated \
- and @md.generated.class==Time
- @tag,@inf,@class=tr.last_generated,@md.generated,'date'
- meta << self.meta_para
- end
- meta
- end
- def char_enc(str)
- @s=str
- def utf8
- if @s \
- and @s.class==String
- @s.gsub!(/<br(?: \/)?>/u,Mx[:br_paragraph])
- @s.gsub!(/</um,'&#60;') # '&lt;' # &#060;
- @s.gsub!(/</um,'&#60;') # '&lt;' # &#060;
- @s.gsub!(/>/um,'&#62;') # '&gt;' # &#062;
- @s.gsub!(/¢/um,'&#162;') # '&cent;' # &#162;
- @s.gsub!(/£/um,'&#163;') # '&pound;' # &#163;
- @s.gsub!(/¥/um,'&#165;') # '&yen;' # &#165;
- @s.gsub!(/§/um,'&#167;') # '&sect;' # &#167;
- @s.gsub!(/©/um,'&#169;') # '&copy;' # &#169;
- @s.gsub!(/ª/um,'&#170;') # '&ordf;' # &#170;
- @s.gsub!(/«/um,'&#171;') # '&laquo;' # &#171;
- @s.gsub!(/®/um,'&#174;') # '&reg;' # &#174;
- @s.gsub!(/°/um,'&#176;') # '&deg;' # &#176;
- @s.gsub!(/±/um,'&#177;') # '&plusmn;' # &#177;
- @s.gsub!(/²/um,'&#178;') # '&sup2;' # &#178;
- @s.gsub!(/³/um,'&#179;') # '&sup3;' # &#179;
- @s.gsub!(/µ/um,'&#181;') # '&micro;' # &#181;
- @s.gsub!(/¶/um,'&#182;') # '&para;' # &#182;
- @s.gsub!(/¹/um,'&#185;') # '&sup1;' # &#185;
- @s.gsub!(/º/um,'&#186;') # '&ordm;' # &#186;
- @s.gsub!(/»/um,'&#187;') # '&raquo;' # &#187;
- @s.gsub!(/¼/um,'&#188;') # '&frac14;' # &#188;
- @s.gsub!(/½/um,'&#189;') # '&frac12;' # &#189;
- @s.gsub!(/¾/um,'&#190;') # '&frac34;' # &#190;
- @s.gsub!(/×/um,'&#215;') # '&times;' # &#215;
- @s.gsub!(/÷/um,'&#247;') # '&divide;' # &#247;
- @s.gsub!(/¿/um,'&#191;') # '&iquest;' # &#191;
- @s.gsub!(/À/um,'&#192;') # '&Agrave;' # &#192;
- @s.gsub!(/Á/um,'&#193;') # '&Aacute;' # &#193;
- @s.gsub!(/Â/um,'&#194;') # '&Acirc;' # &#194;
- @s.gsub!(/Ã/um,'&#195;') # '&Atilde;' # &#195;
- @s.gsub!(/Ä/um,'&#196;') # '&Auml;' # &#196;
- @s.gsub!(/Å/um,'&#197;') # '&Aring;' # &#197;
- @s.gsub!(/Æ/um,'&#198;') # '&AElig;' # &#198;
- @s.gsub!(/Ç/um,'&#199;') # '&Ccedil;' # &#199;
- @s.gsub!(/È/um,'&#200;') # '&Egrave;' # &#200;
- @s.gsub!(/É/um,'&#201;') # '&Eacute;' # &#201;
- @s.gsub!(/Ê/um,'&#202;') # '&Ecirc;' # &#202;
- @s.gsub!(/Ë/um,'&#203;') # '&Euml;' # &#203;
- @s.gsub!(/Ì/um,'&#204;') # '&Igrave;' # &#204;
- @s.gsub!(/Í/um,'&#205;') # '&Iacute;' # &#205;
- @s.gsub!(/Î/um,'&#206;') # '&Icirc;' # &#206;
- @s.gsub!(/Ï/um,'&#207;') # '&Iuml;' # &#207;
- @s.gsub!(/Ð/um,'&#208;') # '&ETH;' # &#208;
- @s.gsub!(/Ñ/um,'&#209;') # '&Ntilde;' # &#209;
- @s.gsub!(/Ò/um,'&#210;') # '&Ograve;' # &#210;
- @s.gsub!(/Ó/um,'&#211;') # '&Oacute;' # &#211;
- @s.gsub!(/Ô/um,'&#212;') # '&Ocirc;' # &#212;
- @s.gsub!(/Õ/um,'&#213;') # '&Otilde;' # &#213;
- @s.gsub!(/Ö/um,'&#214;') # '&Ouml;' # &#214;
- @s.gsub!(/Ø/um,'&#216;') # '&Oslash;' # &#216;
- @s.gsub!(/Ù/um,'&#217;') # '&Ugrave;' # &#217;
- @s.gsub!(/Ú/um,'&#218;') # '&Uacute;' # &#218;
- @s.gsub!(/Û/um,'&#219;') # '&Ucirc;' # &#219;
- @s.gsub!(/Ü/um,'&#220;') # '&Uuml;' # &#220;
- @s.gsub!(/Ý/um,'&#221;') # '&Yacute;' # &#221;
- @s.gsub!(/Þ/um,'&#222;') # '&THORN;' # &#222;
- @s.gsub!(/ß/um,'&#223;') # '&szlig;' # &#223;
- @s.gsub!(/à/um,'&#224;') # '&agrave;' # &#224;
- @s.gsub!(/á/um,'&#225;') # '&aacute;' # &#225;
- @s.gsub!(/â/um,'&#226;') # '&acirc;' # &#226;
- @s.gsub!(/ã/um,'&#227;') # '&atilde;' # &#227;
- @s.gsub!(/ä/um,'&#228;') # '&auml;' # &#228;
- @s.gsub!(/å/um,'&#229;') # '&aring;' # &#229;
- @s.gsub!(/æ/um,'&#230;') # '&aelig;' # &#230;
- @s.gsub!(/ç/um,'&#231;') # '&ccedil;' # &#231;
- @s.gsub!(/è/um,'&#232;') # '&egrave;' # &#232;
- @s.gsub!(/é/um,'&#233;') # '&acute;' # &#233;
- @s.gsub!(/ê/um,'&#234;') # '&circ;' # &#234;
- @s.gsub!(/ë/um,'&#235;') # '&euml;' # &#235;
- @s.gsub!(/ì/um,'&#236;') # '&igrave;' # &#236;
- @s.gsub!(/í/um,'&#237;') # '&acute;' # &#237;
- @s.gsub!(/î/um,'&#238;') # '&icirc;' # &#238;
- @s.gsub!(/ï/um,'&#239;') # '&iuml;' # &#239;
- @s.gsub!(/ð/um,'&#240;') # '&eth;' # &#240;
- @s.gsub!(/ñ/um,'&#241;') # '&ntilde;' # &#241;
- @s.gsub!(/ò/um,'&#242;') # '&ograve;' # &#242;
- @s.gsub!(/ó/um,'&#243;') # '&oacute;' # &#243;
- @s.gsub!(/ô/um,'&#244;') # '&ocirc;' # &#244;
- @s.gsub!(/õ/um,'&#245;') # '&otilde;' # &#245;
- @s.gsub!(/ö/um,'&#246;') # '&ouml;' # &#246;
- @s.gsub!(/ø/um,'&#248;') # '&oslash;' # &#248;
- @s.gsub!(/ù/um,'&#250;') # '&ugrave;' # &#250;
- @s.gsub!(/ú/um,'&#251;') # '&uacute;' # &#251;
- @s.gsub!(/û/um,'&#252;') # '&ucirc;' # &#252;
- @s.gsub!(/ü/um,'&#253;') # '&uuml;' # &#253;
- @s.gsub!(/þ/um,'&#254;') # '&thorn;' # &#254;
- @s.gsub!(/ÿ/um,'&#255;') # '&yuml;' # &#255;
- @s.gsub!(/‘/um,'&#8216;') # '&lsquo;' # &#8216;
- @s.gsub!(/’/um,'&#8217;') # '&rsquo;' # &#8217;
- @s.gsub!(/“/um,'&#8220;') # &ldquo; # &#8220;
- @s.gsub!(/”/um,'&#8221;') # &rdquo; # &#8221;
- @s.gsub!(/–/um,'&#8211;') # &ndash; # &#8211;
- @s.gsub!(/—/um,'&#8212;') # &mdash; # &#8212;
- @s.gsub!(/∝/um,'&#8733;') # &prop; # &#8733;
- @s.gsub!(/∞/um,'&#8734;') # &infin; # &#8734;
- @s.gsub!(/™/um,'&#8482;') # &trade; # &#8482;
- @s.gsub!(/✠/um,'&#10016;') # &cross; # &#10016;
- @s.gsub!(/ /um,' ') # space identify
- @s.gsub!(/ /um,' ') # space identify
- @s.gsub!(/#{Mx[:br_paragraph]}/u,'<br />')
- end
- @s
- end
- self
- end
- def xml_sax
- def meta_para
- inf_xml=char_enc(@inf).utf8
- <<WOK
-<metadata>
-#{Ax[:tab]}<meta>#{@tag.capitalize}:</meta>
-#{Ax[:tab]}<data class="#{@attrib}">
-#{Ax[:tab]*2}#{inf_xml}
-#{Ax[:tab]}</data>
-</metadata>
-WOK
- end
- def metadata
- Metadata::Summary.new(@md).metadata_base
- end
- self
- end
- def xml_dom
- def meta_para
- inf_xml=char_enc(@inf).utf8
- <<WOK
-#{Ax[:tab]}<header>
-#{Ax[:tab]*2}<meta>#{@tag.capitalize}:</meta>
-#{Ax[:tab]*2}<#{@attrib}>
-#{Ax[:tab]*3}#{inf_xml}
-#{Ax[:tab]*2}</#{@attrib}>
-#{Ax[:tab]}</header>
-WOK
- end
- def metadata
- Metadata::Summary.new(@md).metadata_base
- end
- self
- end
- def xhtml_scroll
- def meta_para
- inf_xml=char_enc(@inf).utf8
- <<WOK
-#{Ax[:tab]}<metadata>
-#{Ax[:tab]}<meta>#{@tag.capitalize}:</meta>
-#{Ax[:tab]}<#{@attrib} class="#{@class}">
-#{Ax[:tab]*2}#{inf_xml}
-#{Ax[:tab]}</#{@attrib}>
-#{Ax[:tab]}</metadata>
- <br />
-WOK
- end
- def metadata
- Metadata::Summary.new(@md).metadata_base
- end
- self
- end
- def xhtml_display
- def meta_para
- inf_xml=char_enc(@inf).utf8
- %{<p class="norm">
- <b>#{@tag}</b>: #{inf_xml}
-</p>}
- end
- def metadata
- Metadata::Summary.new(@md,true).metadata_base
- end
- self
- end
- def odf
- def meta_para
- url_brace=SiSU_Viz::Skin.new.url_decoration
- if @inf.class==String
- @inf.gsub!(/</,'&lt;'); @inf.gsub!(/>/,'&gt;')
- @inf.gsub!(/&lt;br(?: \/)?&gt;/,'<br />')
- if @inf =~/&/
- inf_array=[]
- word=@inf.scan(/\S+|\n/)
- word.each do |w| # _ - / # | : ! ^ ~
- w.gsub!(/&nbsp;/,'&#160;')
- if w !~/&\S{2,7}?;/
- w.gsub!(/&/,'&amp;')
- end
- inf_array << w
- end
- @inf=inf_array.join(' ')
- end
- @inf.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,
- '<text:a xlink:type="simple" xlink:href="\1">\1</text:a>') #http ftp matches escaped, no decoration
- @inf.gsub!(/(#{Mx[:lnk_c]})#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
- '\1<text:a xlink:type="simple" xlink:href="\2">\2</text:a>') #special case \{ e.g. \}http://url
- if @inf =~/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/
- @inf.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
- %{#{url_brace.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{url_brace.xml_close}}) #http ftp matches with decoration
- else
- @inf.gsub!(/(https?:\/\/[^<>()'"\s]+)/,
- %{#{url_brace.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{url_brace.xml_close}}) #http ftp matches with decoration
- end
- @inf.gsub!(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+)/,
- %{#{url_brace.xml_open}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{url_brace.xml_close}}) if @inf !~/http:\/\// # improve upon, document crash where url contains '@' symbol
- end
- <<WOK
-<text:p text:style-name="P1">#{@tag.capitalize}: #{@inf}</text:p>
-WOK
- end
- def metadata
- Metadata::Summary.new(@md).metadata_base
- end
- self
- end
- def plaintext
- def meta_para
- <<WOK
-
-#{@tag.capitalize}: #{@inf}
-WOK
- end
- def metadata
- Metadata::Summary.new(@md).metadata_base
- end
- self
- end
- def manpage
- def meta_para
- <<WOK
-
-.TP
-#{@tag.capitalize}:
-.I #{@inf}
-WOK
- end
- def metadata
- Metadata::Summary.new(@md).metadata_base
- end
- self
- end
- end
- class TeX_metadata
- def initialize(md)
- @md=md
- @br="\\\\\n"
- end
- def meta_para(tag,inf,sc=true)
- inf=((inf.class==String && sc) ? spec_char(inf) : inf)
- %{\\begin\{bfseries\}#{tag}:\\end\{bfseries\} #{inf}
-}
- end
- def spec_char(inf)
- SiSU_TeX_Pdf::Special_characters.new(@md,inf).special_characters
- end
- def word_break_points(inf)
- SiSU_TeX_Pdf::Special_characters.new(@md,inf).special_word_break_points
- end
- def number_break_points(inf)
- SiSU_TeX_Pdf::Special_characters.new(@md,inf).special_number_break_points
- end
- def metadata_tex
- meta=[]
- dir=SiSU_Env::Info_env.new(@md.fns)
- base_html="#{dir.url.root}/#{@md.fnb}"
- l=SiSU_Env::Standardise_language.new.file_to_language(@md.fns)
- language=l[:l]
- tr=SiSU_Translate::Source.new(@md,language)
- tag="Document Manifest @"
- inf="#{@br}#{base_html}/#{@md.fn[:manifest]}"
- meta << meta_para(tag,inf)
- if defined? @md.title.full \
- and @md.title.full=~/\S+/
- tag,inf=tr.full_title,@md.title.full
- meta << meta_para(tag,inf)
- end
- if defined? @md.creator.author \
- and @md.creator.author=~/\S+/
- tag,inf=tr.author,@md.creator.author
- meta << meta_para(tag,inf)
- end
- if defined? @md.creator.translator \
- and @md.creator.translator=~/\S+/
- tag,inf=tr.translator,@md.creator.translator
- meta << meta_para(tag,inf)
- end
- if defined? @md.creator.illustrator \
- and @md.creator.illustrator=~/\S+/
- tag,inf=tr.illustrator,@md.creator.illustrator
- meta << meta_para(tag,inf)
- end
- if defined? @md.creator.prepared_by \
- and @md.creator.prepared_by=~/\S+/
- tag,inf=tr.prepared_by,@md.creator.prepared_by
- meta << meta_para(tag,inf)
- end
- if defined? @md.creator.digitized_by \
- and @md.creator.digitized_by=~/\S+/
- tag,inf=tr.digitized_by,@md.creator.digitized_by
- meta << meta_para(tag,inf)
- end
- if defined? @md.rights.all \
- and @md.rights.all=~/\S+/
- tag,inf=tr.rights,@md.rights.all
- meta << meta_para(tag,inf)
- end
- if defined? @md.notes.description \
- and @md.notes.description=~/\S+/
- tag,inf=tr.description,@md.notes.description
- meta << meta_para(tag,inf)
- end
- if defined? @md.classify.subject \
- and @md.classify.subject=~/\S+/
- tag,inf=tr.subject,@md.classify.subject
- meta << meta_para(tag,inf)
- end
- if defined? @md.publisher \
- and @md.publisher=~/\S+/
- tag,inf=tr.publisher,@md.publisher
- meta << meta_para(tag,inf)
- end
- if defined? @md.creator.contributor \
- and @md.creator.contributor=~/\S+/
- tag,inf=tr.contributor,@md.creator.contributor
- meta << meta_para(tag,inf)
- end
- if defined? @md.notes.abstract \
- and @md.notes.abstract=~/\S+/
- tag,inf=tr.abstract,@md.notes.abstract
- meta << meta_para(tag,inf)
- end
- if defined? @md.date.created \
- and @md.date.created=~/\S+/
- tag,inf=tr.date_created,@md.date.created
- meta << meta_para(tag,inf)
- end
- if defined? @md.date.issued \
- and @md.date.issued=~/\S+/
- tag,inf=tr.date_issued,@md.date.issued
- meta << meta_para(tag,inf)
- end
- if defined? @md.date.available \
- and @md.date.available=~/\S+/
- tag,inf=tr.date_available,@md.date.available
- meta << meta_para(tag,inf)
- end
- if defined? @md.date.modified \
- and @md.date.modified=~/\S+/
- tag,inf=tr.date_modified,@md.date.modified
- meta << meta_para(tag,inf)
- end
- if defined? @md.date.valid \
- and @md.date.valid=~/\S+/
- tag,inf=tr.date_valid,@md.date.valid
- meta << meta_para(tag,inf)
- end
- if defined? @md.date.published \
- and @md.date.published=~/\S+/
- tag,inf=tr.date,@md.date.published
- meta << meta_para(tag,inf)
- end
- if defined? @md.classify.topic_register \
- and @md.classify.topic_register=~/\S+/
- tag,inf=tr.topic_register,@md.classify.topic_register
- inf=word_break_points(inf)
- meta << meta_para(tag,inf)
- end
- if defined? @md.classify.loc \
- and @md.classify.loc=~/\S+/
- tag,inf=tr.cls_loc,@md.classify.loc
- meta << meta_para(tag,inf)
- end
- if defined? @md.classify.dewey \
- and @md.classify.dewey=~/\S+/
- tag,inf=tr.cls_dewey,@md.classify.dewey
- meta << meta_para(tag,inf)
- end
- if defined? @md.classify.oclc \
- and @md.classify.oclc=~/\S+/
- tag,inf=tr.cls_oclc,@md.classify.oclc
- meta << meta_para(tag,inf)
- end
- if defined? @md.classify.pg \
- and @md.classify.pg=~/\S+/
- tag,inf=tr.cls_gutenberg,@md.classify.pg
- meta << meta_para(tag,inf)
- end
- if defined? @md.classify.isbn \
- and @md.classify.isbn=~/\S+/
- tag,inf=tr.cls_isbn,@md.classify.isbn
- meta << meta_para(tag,inf)
- end
- if defined? @md.notes.comment \
- and @md.notes.comment=~/\S+/
- tag,inf=tr.comments,@md.notes.comment
- meta << meta_para(tag,inf)
- end
- if defined? @md.notes.prefix_a \
- and @md.notes.prefix_a=~/\S+/
- tag,inf=tr.prefix_a,@md.notes.prefix_a
- meta << meta_para(tag,inf)
- end
- if defined? @md.notes.prefix_b \
- and @md.notes.prefix_b=~/\S+/
- tag,inf=tr.prefix_b,@md.notes.prefix_b
- meta << meta_para(tag,inf)
- end
- if defined? @md.classify.identifier \
- and @md.classify.identifier=~/\S+/
- tag,inf=tr.identifier,@md.classify.identifier
- meta << meta_para(tag,inf)
- end
- if defined? @md.original.source \
- and @md.original.source=~/\S+/
- tag,inf=tr.source,@md.original.source
- meta << meta_para(tag,inf)
- end
- if defined? @md.title.language \
- and @md.title.language=~/\S+/
- tag,inf=tr.language,@md.title.language
- meta << meta_para(tag,inf)
- end
- if defined? @md.original.language \
- and @md.original.language=~/\S+/
- tag,inf=tr.language_original,@md.original.language
- meta << meta_para(tag,inf)
- end
- if defined? @md.classify.format \
- and @md.classify.format=~/\S+/
- tag,inf=tr.format,@md.classify.format
- meta << meta_para(tag,inf)
- end
- if defined? @md.classify.relation \
- and @md.classify.relation=~/\S+/
- tag,inf=tr.relation,@md.classify.relation
- meta << meta_para(tag,inf)
- end
- if defined? @md.classify.coverage \
- and @md.classify.coverage=~/\S+/
- tag,inf=tr.coverage,@md.classify.coverage
- meta << meta_para(tag,inf)
- end
- if defined? @md.classify.keywords \
- and @md.classify.keywords=~/\S+/
- tag,inf=tr.keywords,@md.classify.keywords
- meta << meta_para(tag,inf)
- end
- meta << %{#{@br}\\begin\{bfseries\}Version Information \\end\{bfseries\}}
- if defined? @md.fns \
- and @md.fns=~/\S+/
- fn=spec_char(@md.fns)
- fn=word_break_points(fn)
- fn="\\begin\{footnotesize\}#{fn}\\end\{footnotesize\}"
- tag,inf=tr.sourcefile,fn
- meta << meta_para(tag,inf,false)
- end
- if defined? @md.file_encoding \
- and @md.file_encoding=~/\S+/
- tag,inf='Filetype',@md.file_encoding
- meta << meta_para(tag,inf)
- end
- if defined? @md.dgst \
- and @md.dgst.class==Array
- hash_of=spec_char(@md.dgst[0])
- hash_of=word_break_points(hash_of)
- dgst=number_break_points(@md.dgst[1])
- tag,inf='Source Digest',"\\begin\{footnotesize\}#{hash_of}\\end\{footnotesize\}\\-\\begin\{scriptsize\}#{dgst}\\end\{scriptsize\}"
- meta << meta_para(tag,inf,false)
- end
- if defined? @md.dgst_skin \
- and @md.dgst_skin.class==Array
- hash_of=spec_char(@md.dgst_skin[0])
- hash_of=word_break_points(hash_of)
- dgst=number_break_points(@md.dgst_skin[1])
- tag,inf='Skin Digest',"\\begin\{footnotesize\}#{hash_of}\\end\{footnotesize\}\\-\\begin\{scriptsize\}#{dgst}\\end\{scriptsize\}"
- meta << meta_para(tag,inf,false)
- end
- meta << %{#{@br}\\begin\{bfseries\}Generated \\end\{bfseries\}}
- if defined? @md.generated \
- and @md.generated.class==Time
- tag,inf=tr.last_generated,@md.generated
- meta << meta_para(tag,inf)
- end
- if defined? @md.sisu_version \
- and @md.sisu_version[:version]=~/\S+/
- tag=tr.sisu_version
- inf="#{@md.sisu_version[:project]} " +
- "#{@md.sisu_version[:version]} " +
- "of #{@md.sisu_version[:date_stamp]} " +
- "(#{@md.sisu_version[:date]})"
- meta << meta_para(tag,inf)
- end
- if defined? @md.ruby_version \
- and @md.ruby_version=~/\S+/
- tag,inf=tr.ruby_version,@md.ruby_version
- meta << meta_para(tag,inf)
- end
- meta
- end
- end
-end
-__END__
diff --git a/lib/sisu/v2/shared_xml.rb b/lib/sisu/v2/shared_xml.rb
deleted file mode 100644
index e82f51b..0000000
--- a/lib/sisu/v2/shared_xml.rb
+++ /dev/null
@@ -1,706 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: common file for xml generation
-=end
-module SiSU_XML_munge
- class Trans
- require "#{SiSU_lib}/defaults" # defaults.rb
- def initialize(md)
- @md=md
- @sys=SiSU_Env::System_call.new
- @dir=SiSU_Env::Info_env.new(@md.fns)
- @brace_url=SiSU_Viz::Skin.new.url_decoration
- if @md.sem_tag
- @ab ||=semantic_tags.default
- end
- end
- def semantic_tags
- def default
- {
- :pub => 'publication',
- :conv => 'convention',
- :vol => 'volume',
- :pg => 'page',
- :cty => 'city',
- :org => 'organization',
- :uni => 'university',
- :dept => 'department',
- :fac => 'faculty',
- :inst => 'institute',
- :co => 'company',
- :com => 'company',
- :conv => 'convention',
- :dt => 'date',
- :y => 'year',
- :m => 'month',
- :d => 'day',
- :ti => 'title',
- :au => 'author',
- :ed => 'editor', #editor?
- :v => 'version', #edition
- :n => 'name',
- :fn => 'firstname',
- :mn => 'middlename',
- :ln => 'lastname',
- :in => 'initials',
- :qt => 'quote',
- :ct => 'cite',
- :ref => 'reference',
- :ab => 'abreviation',
- :def => 'define',
- :desc => 'description',
- :trans => 'translate',
- }
- end
- self
- end
- def char_enc #character encode
- def utf8(dob='')
- if @sys.locale =~/utf-?8/i # instead ucs for utf8 #require 'iconv' ? Iñtërnâtiônàlizætiøn
- str=if defined? dob.obj; dob.obj
- elsif dob.class==String; dob
- end
- if str
- #¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûü
- #¢£¥§©ª«®°±²³µ¶¹º»¼½¾×÷
- str.gsub!(/</um,'&#60;') # '&lt;' # &#060;
- str.gsub!(/>/um,'&#62;') # '&gt;' # &#062;
- str.gsub!(/¢/um,'&#162;') # '&cent;' # &#162;
- str.gsub!(/£/um,'&#163;') # '&pound;' # &#163;
- str.gsub!(/¥/um,'&#165;') # '&yen;' # &#165;
- str.gsub!(/§/um,'&#167;') # '&sect;' # &#167;
- str.gsub!(/©/um,'&#169;') # '&copy;' # &#169;
- str.gsub!(/ª/um,'&#170;') # '&ordf;' # &#170;
- str.gsub!(/«/um,'&#171;') # '&laquo;' # &#171;
- str.gsub!(/®/um,'&#174;') # '&reg;' # &#174;
- str.gsub!(/°/um,'&#176;') # '&deg;' # &#176;
- str.gsub!(/±/um,'&#177;') # '&plusmn;' # &#177;
- str.gsub!(/²/um,'&#178;') # '&sup2;' # &#178;
- str.gsub!(/³/um,'&#179;') # '&sup3;' # &#179;
- str.gsub!(/µ/um,'&#181;') # '&micro;' # &#181;
- str.gsub!(/¶/um,'&#182;') # '&para;' # &#182;
- str.gsub!(/¹/um,'&#185;') # '&sup1;' # &#185;
- str.gsub!(/º/um,'&#186;') # '&ordm;' # &#186;
- str.gsub!(/»/um,'&#187;') # '&raquo;' # &#187;
- str.gsub!(/¼/um,'&#188;') # '&frac14;' # &#188;
- str.gsub!(/½/um,'&#189;') # '&frac12;' # &#189;
- str.gsub!(/¾/um,'&#190;') # '&frac34;' # &#190;
- str.gsub!(/×/um,'&#215;') # '&times;' # &#215;
- str.gsub!(/÷/um,'&#247;') # '&divide;' # &#247;
- str.gsub!(/¿/um,'&#191;') # '&iquest;' # &#191;
- str.gsub!(/À/um,'&#192;') # '&Agrave;' # &#192;
- str.gsub!(/Á/um,'&#193;') # '&Aacute;' # &#193;
- str.gsub!(/Â/um,'&#194;') # '&Acirc;' # &#194;
- str.gsub!(/Ã/um,'&#195;') # '&Atilde;' # &#195;
- str.gsub!(/Ä/um,'&#196;') # '&Auml;' # &#196;
- str.gsub!(/Å/um,'&#197;') # '&Aring;' # &#197;
- str.gsub!(/Æ/um,'&#198;') # '&AElig;' # &#198;
- str.gsub!(/Ç/um,'&#199;') # '&Ccedil;' # &#199;
- str.gsub!(/È/um,'&#200;') # '&Egrave;' # &#200;
- str.gsub!(/É/um,'&#201;') # '&Eacute;' # &#201;
- str.gsub!(/Ê/um,'&#202;') # '&Ecirc;' # &#202;
- str.gsub!(/Ë/um,'&#203;') # '&Euml;' # &#203;
- str.gsub!(/Ì/um,'&#204;') # '&Igrave;' # &#204;
- str.gsub!(/Í/um,'&#205;') # '&Iacute;' # &#205;
- str.gsub!(/Î/um,'&#206;') # '&Icirc;' # &#206;
- str.gsub!(/Ï/um,'&#207;') # '&Iuml;' # &#207;
- str.gsub!(/Ð/um,'&#208;') # '&ETH;' # &#208;
- str.gsub!(/Ñ/um,'&#209;') # '&Ntilde;' # &#209;
- str.gsub!(/Ò/um,'&#210;') # '&Ograve;' # &#210;
- str.gsub!(/Ó/um,'&#211;') # '&Oacute;' # &#211;
- str.gsub!(/Ô/um,'&#212;') # '&Ocirc;' # &#212;
- str.gsub!(/Õ/um,'&#213;') # '&Otilde;' # &#213;
- str.gsub!(/Ö/um,'&#214;') # '&Ouml;' # &#214;
- str.gsub!(/Ø/um,'&#216;') # '&Oslash;' # &#216;
- str.gsub!(/Ù/um,'&#217;') # '&Ugrave;' # &#217;
- str.gsub!(/Ú/um,'&#218;') # '&Uacute;' # &#218;
- str.gsub!(/Û/um,'&#219;') # '&Ucirc;' # &#219;
- str.gsub!(/Ü/um,'&#220;') # '&Uuml;' # &#220;
- str.gsub!(/Ý/um,'&#221;') # '&Yacute;' # &#221;
- str.gsub!(/Þ/um,'&#222;') # '&THORN;' # &#222;
- str.gsub!(/ß/um,'&#223;') # '&szlig;' # &#223;
- str.gsub!(/à/um,'&#224;') # '&agrave;' # &#224;
- str.gsub!(/á/um,'&#225;') # '&aacute;' # &#225;
- str.gsub!(/â/um,'&#226;') # '&acirc;' # &#226;
- str.gsub!(/ã/um,'&#227;') # '&atilde;' # &#227;
- str.gsub!(/ä/um,'&#228;') # '&auml;' # &#228;
- str.gsub!(/å/um,'&#229;') # '&aring;' # &#229;
- str.gsub!(/æ/um,'&#230;') # '&aelig;' # &#230;
- str.gsub!(/ç/um,'&#231;') # '&ccedil;' # &#231;
- str.gsub!(/è/um,'&#232;') # '&egrave;' # &#232;
- str.gsub!(/é/um,'&#233;') # '&acute;' # &#233;
- str.gsub!(/ê/um,'&#234;') # '&circ;' # &#234;
- str.gsub!(/ë/um,'&#235;') # '&euml;' # &#235;
- str.gsub!(/ì/um,'&#236;') # '&igrave;' # &#236;
- str.gsub!(/í/um,'&#237;') # '&acute;' # &#237;
- str.gsub!(/î/um,'&#238;') # '&icirc;' # &#238;
- str.gsub!(/ï/um,'&#239;') # '&iuml;' # &#239;
- str.gsub!(/ð/um,'&#240;') # '&eth;' # &#240;
- str.gsub!(/ñ/um,'&#241;') # '&ntilde;' # &#241;
- str.gsub!(/ò/um,'&#242;') # '&ograve;' # &#242;
- str.gsub!(/ó/um,'&#243;') # '&oacute;' # &#243;
- str.gsub!(/ô/um,'&#244;') # '&ocirc;' # &#244;
- str.gsub!(/õ/um,'&#245;') # '&otilde;' # &#245;
- str.gsub!(/ö/um,'&#246;') # '&ouml;' # &#246;
- str.gsub!(/ø/um,'&#248;') # '&oslash;' # &#248;
- str.gsub!(/ù/um,'&#250;') # '&ugrave;' # &#250;
- str.gsub!(/ú/um,'&#251;') # '&uacute;' # &#251;
- str.gsub!(/û/um,'&#252;') # '&ucirc;' # &#252;
- str.gsub!(/ü/um,'&#253;') # '&uuml;' # &#253;
- str.gsub!(/þ/um,'&#254;') # '&thorn;' # &#254;
- str.gsub!(/ÿ/um,'&#255;') # '&yuml;' # &#255;
- str.gsub!(/‘/um,'&#8216;') # '&lsquo;' # &#8216;
- str.gsub!(/’/um,'&#8217;') # '&rsquo;' # &#8217;
- str.gsub!(/“/um,'&#8220;') # &ldquo; # &#8220;
- str.gsub!(/”/um,'&#8221;') # &rdquo; # &#8221;
- str.gsub!(/–/um,'&#8211;') # &ndash; # &#8211;
- str.gsub!(/—/um,'&#8212;') # &mdash; # &#8212;
- str.gsub!(/∝/um,'&#8733;') # &prop; # &#8733;
- str.gsub!(/∞/um,'&#8734;') # &infin; # &#8734;
- str.gsub!(/™/um,'&#8482;') # &trade; # &#8482;
- str.gsub!(/✠/um,'&#10016;') # &cross; # &#10016;
- str.gsub!(/ /um,' ') # space identify
- str.gsub!(/ /um,' ') # space identify
- end
- dob=if defined? dob.obj
- dob.obj=str
- dob
- elsif dob.class==String; dob
- end
- dob
- end
- end
- def html(dob='')
- if @sys.locale =~/utf-?8/i # instead ucs for utf8 #require 'iconv' ? Iñtërnâtiônàlizætiøn
- dob.obj.gsub!(/ /u,' ') # space identify
- dob.obj.gsub!(/ /u,' ') # space identify
- else
- dob.obj.gsub!(/¢/u,'&cent;') # &#162;
- dob.obj.gsub!(/£/u,'&pound;') # &#163;
- dob.obj.gsub!(/¥/u,'&yen;') # &#165;
- dob.obj.gsub!(/§/u,'&sect;') # &#167;
- dob.obj.gsub!(/©/u,'&copy;') # &#169;
- dob.obj.gsub!(/ª/u,'&ordf;') # &#170;
- dob.obj.gsub!(/«/u,'&laquo;') # &#171;
- dob.obj.gsub!(/®/u,'&reg;') # &#174;
- dob.obj.gsub!(/°/u,'&deg;') # &#176;
- dob.obj.gsub!(/±/u,'&plusmn;') # &#177;
- dob.obj.gsub!(/²/u,'&sup2;') # &#178;
- dob.obj.gsub!(/³/u,'&sup3;') # &#179;
- dob.obj.gsub!(/µ/u,'&micro;') # &#181;
- dob.obj.gsub!(/¶/u,'&para;') # &#182;
- dob.obj.gsub!(/¹/u,'&sup1;') # &#185;
- dob.obj.gsub!(/º/u,'&ordm;') # &#186;
- dob.obj.gsub!(/»/u,'&raquo;') # &#187;
- dob.obj.gsub!(/¼/u,'&frac14;') # &#188;
- dob.obj.gsub!(/½/u,'&frac12;') # &#189;
- dob.obj.gsub!(/¾/u,'&frac34;') # &#190;
- dob.obj.gsub!(/×/u,'&times;') # &#215;
- dob.obj.gsub!(/÷/u,'&divide;') # &#247;
- dob.obj.gsub!(/¿/u,'&iquest;') # &#191;
- dob.obj.gsub!(/À/u,'&Agrave;') # &#192;
- dob.obj.gsub!(/Á/u,'&Aacute;') # &#193;
- dob.obj.gsub!(/Â/u,'&Acirc;') # &#194;
- dob.obj.gsub!(/Ã/u,'&Atilde;') # &#195;
- dob.obj.gsub!(/Ä/u,'&Auml;') # &#196;
- dob.obj.gsub!(/Å/u,'&Aring;') # &#197;
- dob.obj.gsub!(/Æ/u,'&AElig;') # &#198;
- dob.obj.gsub!(/Ç/u,'&Ccedil;') # &#199;
- dob.obj.gsub!(/È/u,'&Egrave;') # &#200;
- dob.obj.gsub!(/É/u,'&Eacute;') # &#201;
- dob.obj.gsub!(/Ê/u,'&Ecirc;') # &#202;
- dob.obj.gsub!(/Ë/u,'&Euml;') # &#203;
- dob.obj.gsub!(/Ì/u,'&Igrave;') # &#204;
- dob.obj.gsub!(/Í/u,'&Iacute;') # &#205;
- dob.obj.gsub!(/Î/u,'&Icirc;') # &#206;
- dob.obj.gsub!(/Ï/u,'&Iuml;') # &#207;
- dob.obj.gsub!(/Ð/u,'&ETH;') # &#208;
- dob.obj.gsub!(/Ñ/u,'&Ntilde;') # &#209;
- dob.obj.gsub!(/Ò/u,'&Ograve;') # &#210;
- dob.obj.gsub!(/Ó/u,'&Oacute;') # &#211;
- dob.obj.gsub!(/Ô/u,'&Ocirc;') # &#212;
- dob.obj.gsub!(/Õ/u,'&Otilde;') # &#213;
- dob.obj.gsub!(/Ö/u,'&Ouml;') # &#214;
- dob.obj.gsub!(/Ø/u,'&Oslash;') # &#216;
- dob.obj.gsub!(/Ù/u,'&Ugrave;') # &#217;
- dob.obj.gsub!(/Ú/u,'&Uacute;') # &#218;
- dob.obj.gsub!(/Û/u,'&Ucirc;') # &#219;
- dob.obj.gsub!(/Ü/u,'&Uuml;') # &#220;
- dob.obj.gsub!(/Ý/u,'&Yacute;') # &#221;
- dob.obj.gsub!(/Þ/u,'&THORN;') # &#222;
- dob.obj.gsub!(/ß/u,'&szlig;') # &#223;
- dob.obj.gsub!(/à/u,'&agrave;') # &#224;
- dob.obj.gsub!(/á/u,'&aacute;') # &#225;
- dob.obj.gsub!(/â/u,'&acirc;') # &#226;
- dob.obj.gsub!(/ã/u,'&atilde;') # &#227;
- dob.obj.gsub!(/ä/u,'&auml;') # &#228;
- dob.obj.gsub!(/å/u,'&aring;') # &#229;
- dob.obj.gsub!(/æ/u,'&aelig;') # &#230;
- dob.obj.gsub!(/ç/u,'&ccedil;') # &#231;
- dob.obj.gsub!(/è/u,'&egrave;') # &#232;
- dob.obj.gsub!(/é/u,'&acute;') # &#233;
- dob.obj.gsub!(/ê/u,'&circ;') # &#234;
- dob.obj.gsub!(/ë/u,'&euml;') # &#235;
- dob.obj.gsub!(/ì/u,'&igrave;') # &#236;
- dob.obj.gsub!(/í/u,'&acute;') # &#237;
- dob.obj.gsub!(/î/u,'&icirc;') # &#238;
- dob.obj.gsub!(/ï/u,'&iuml;') # &#239;
- dob.obj.gsub!(/ð/u,'&eth;') # &#240;
- dob.obj.gsub!(/ñ/u,'&ntilde;') # &#241;
- dob.obj.gsub!(/ò/u,'&ograve;') # &#242;
- dob.obj.gsub!(/ó/u,'&oacute;') # &#243;
- dob.obj.gsub!(/ô/u,'&ocirc;') # &#244;
- dob.obj.gsub!(/õ/u,'&otilde;') # &#245;
- dob.obj.gsub!(/ö/u,'&ouml;') # &#246;
- dob.obj.gsub!(/ø/u,'&oslash;') # &#248;
- dob.obj.gsub!(/ù/u,'&ugrave;') # &#250;
- dob.obj.gsub!(/ú/u,'&uacute;') # &#251;
- dob.obj.gsub!(/û/u,'&ucirc;') # &#252;
- dob.obj.gsub!(/ü/u,'&uuml;') # &#253;
- dob.obj.gsub!(/þ/u,'&thorn;') # &#254;
- dob.obj.gsub!(/ÿ/u,'&yuml;') # &#255;
- dob.obj.gsub!(/‘/u,'&#lsquo;') # &lsquo; # &#8216;
- dob.obj.gsub!(/’/u,'&#rsquo;') # &rsquo; # &#8217;
- dob.obj.gsub!(/“/u,'&ldquo;') # &ldquo; # &#8220;
- dob.obj.gsub!(/”/u,'&rdquo;') # &rdquo; # &#8221;
- dob.obj.gsub!(/–/u,'&ndash;') # &ndash; # &#8211;
- dob.obj.gsub!(/—/u,'&mdash;') # &mdash; # &#8212;
- dob.obj.gsub!(/∝/u,'&prop;') # &prop; # &#8733;
- dob.obj.gsub!(/∞/u,'&infin;') # &infin; # &#8734;
- dob.obj.gsub!(/™/u,'&trade;') # &trade; # &#8482;
- dob.obj.gsub!(/✠/u,'&#10016;') # &#10016;
- #par.obja.gsub!(/✠/u '&dagger;') # &dagger; # &#8224; incorrect replacement †
- dob.obj.gsub!(/ /u,' ') # space identify
- dob.obj.gsub!(/ /u,' ') # space identify
- end
- end
- self
- end
- def tidywords(wordlist)
- wordlist.each do |x|
- #imperfect solution will not catch all possible cases
- x.gsub!(/&/,'&amp;') unless x =~/&\S+;/
- x.gsub!(/&([A-Z])/,'&amp;\1')
- end
- end
- def markup(dob='')
- wordlist=dob.obj.scan(/&[#0-9a-z]+;|\S+|\n/) #\n needed for tables, check though added 2005w17
- dob.obj=tidywords(wordlist).join(' ').strip
- unless dob.is=='table'
- dob.obj.gsub!(/#{Mx[:br_line]}/u,'<br />')
- dob.obj.gsub!(/#{Mx[:br_paragraph]}/u,'<br />')
- dob.obj.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />')
- end
- dob.obj.gsub!(/#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}/,'')
- 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[:gl_c]}|\s+)<\s+/,'\1&lt; '); dob.obj.gsub!(/\s+>(\s+|$)/,' &gt;\1')
- #dob.obj.gsub!(/#{Mx[:fa_emphasis_o]}(.+?)#{Mx[:fa_emphasis_c]}/,'<em>\1</em>') #reinstate
- dob.obj.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/m,'<b>\1</b>')
- dob.obj.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/m,'<i>\1</i>')
- dob.obj.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>')
- dob.obj.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>')
- dob.obj.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>')
- dob.obj.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'<ins>\1</ins>')
- dob.obj.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>')
- dob.obj.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>')
- dob.obj.gsub!(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>')
- dob.obj.gsub!(/<:pb>\s*/,'') #Fix
- dob.obj.gsub!(/<+[-~]#>+/,'')
- if dob.is !~/^code/
- #embeds a red-bullet image -->
- dob.obj.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>')
- dob.obj.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>')
- dob.obj.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>')
- dob.obj.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>')
- dob.obj.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />') unless dob.is=='table'
- dob.obj.gsub!(/#{Mx[:br_page]}\s*/,'')
- dob.obj.gsub!(/#{Mx[:br_page_new]}\s*/,'')
- dob.obj.gsub!(/#{Mx[:pa_non_object_no_heading]}|#{Mx[:pa_non_object_dummy_heading]}/,''); dob.obj.gsub!(/<[-~]#>/,'')
- dob.obj.gsub!(/href="#{Xx[:segment]}/m,'href="')
- dob.obj.gsub!(/#{Mx[:lnk_o]}([^#{Mx[:lnk_o]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{Mx[:rel_c]}]+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}(\.\.\/\S+?)#{Mx[:rel_c]}/,
- '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\2">\1</link>')
- dob.obj.gsub!(/#{Mx[:lnk_o]}([^#{Mx[:lnk_o]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{Mx[:rel_c]}]+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}:(\S+?)#{Mx[:rel_c]}/,
- '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="../\2">\1</link>')
- dob.obj.gsub!(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}(\S+?)#{Mx[:rel_c]}/,
- '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="#\2">\1</link>')
- dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))[ ]+(\d+)x(\d+)(\s+[^}]+)?#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
- %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@dir.url.images_local}/\\1" width="\\2" height="\\3" />[\\1] \\4})
- dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))([ ]+[^}]+)?#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
- %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@dir.url.images_local}/\\1"/>\\1})
- dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))[ ]+(\d+)x(\d+)(\s+[^}]+)?#{Mx[:lnk_c]}image/,
- %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@dir.url.images_local}/\\1" width="\\2" height="\\3" />[\\1] \\4})
- dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))([ ]+[^}]+)?#{Mx[:lnk_c]}image/,
- %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@dir.url.images_local}/\\1"/>\\1})
- dob.obj.gsub!(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
- '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\2">\1</link>') #watch, compare html_tune
- dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
- %{#{@brace_url.xml_open}<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\\1">\\1</link>#{@brace_url.xml_close}})
- dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,
- '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\1">\1</link>') #escaped urls not linked, deal with later
- else
- dob.obj.gsub!(/(^|[^}])_</m,'\1&lt;'); dob.obj.gsub!(/(^|[^}])_>/m,'\1&gt;') #code-block: angle brackets special characters
- dob.obj.gsub!(/(^|[^}])_</m,'\1&lt;'); dob.obj.gsub!(/(^|[^}])_>/m,'\1&gt;')
- end
- if dob.of=='group'
- dob.obj.gsub!(/#{Mx[:gl_bullet]}/,'● ')
- end
- 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!(/#{Dx[:url_o]}/,"#{Dx[:url_o_xml]}")
- dob.obj.gsub!(/#{Dx[:url_c]}/,"#{Dx[:url_c_xml]}")
- dob.obj.gsub!(/&nbsp;|#{Mx[:nbsp]}/m,'&#160;')
- dob
- end
- def markup_light(dob='')
- dob.obj.gsub!(/\/\{(.+?)\}\//,'<i>\1</i>')
- dob.obj.gsub!(/[*!]\{(.+?)\}[*!]/,'<b>\1</b>')
- dob.obj.gsub!(/_\{(.+?)\}_/,'<u>\1</u>')
- dob.obj.gsub!(/-\{(.+?)\}-/,'<del>\1</del>')
- dob.obj.gsub!(/<br(\s*\/)?>/,'<br />')
- dob.obj.gsub!(/<:pb>\s*/,'')
- dob.obj.gsub!(/<[-~]#>/,'')
- dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s)&\s+/,'\1&amp; ') #sort
- dob.obj.gsub!(/&([^;]{1,5})/,'&amp;\1') #sort, rough estimate, revisit #WATCH found in node not sax
- dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif))[ ]+.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/,
- "<image.path>#{@dir.url.images_local}\/\\1</image.path>")
- dob.obj.gsub!(/&nbsp;|#{Mx[:nbsp]}/,'&#160;')
- wordlist=dob.obj.scan(/&[#0-9a-z]+;|\S+|\n/) #\n needed for tables, check though added 2005w17
- dob.obj=tidywords(wordlist).join(' ').strip
- dob
- end
- def markup_fictionbook(dob='')
- dob.obj.gsub!(/~\{([\d*+]+).+?\}~/,'[\1]')
- dob.obj.gsub!(/\/\{(.+?)\}\//,'<i>\1</i>')
- dob.obj.gsub!(/[*!]\{(.+?)\}[*!]/,'<b>\1</b>')
- dob.obj.gsub!(/_\{(.+?)\}_/,'<u>\1</u>')
- dob.obj.gsub!(/-\{(.+?)\}-/,'<del>\1</del>')
- dob.obj.gsub!(/<br(?:\s*\/)?>/,'<br />')
- dob.obj.gsub!(/<:pb>\s*/,'')
- dob.obj.gsub!(/<[-~]#>/,'')
- #temporary -->
- dob.obj.gsub!(/<:\S+?>/,'')
- #<-- temporary
- dob.obj.gsub!(/<[-~]#>/,'')
- dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s)&\s+/,'\1&amp; ') #sort
- dob.obj.gsub!(/&([^;]{1,5})/,'&amp;\1') #sort, rough estimate, revisit #WATCH found in node not sax
- dob.obj.gsub!(/(#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif))[ ]+.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/,
- "<image.path>#{@dir.url.images_local}\/\\1</image.path>")
- dob.obj.gsub!(/&nbsp;|#{Mx[:nbsp]}/,'&#160;')
- wordlist=dob.obj.scan(/&[#0-9a-z]+;|\S+|\n/) #\n needed for tables, check though added 2005w17
- dob.obj=tidywords(wordlist).join(' ').strip
- dob
- end
- def markup_group(dob='')
- dob.obj.gsub!(/</,'&lt;'); dob.obj.gsub!(/>/,'&gt;')
- dob.obj.gsub!(/&lt;:?br(?:\s+\/)?&gt;/,'<br />')
- dob.obj.gsub!(/&lt;(link xmlns:xlink=".+?")&gt;/,'<\1>')
- dob.obj.gsub!(/&lt;(\/link)&gt;/,'<\1>')
- dob.obj.gsub!(/&lt;(\/?en)&gt;/,'<\1>')
- dob
- end
- def xml_sem_block_paired(matched) # colon depth: many, recurs
- matched.gsub!(/\b(au):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:au]} depth="many">\\2</sem:#{@ab[:au]}>})
- matched.gsub!(/\b(vol):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:vol]} depth="many">\\2</sem:#{@ab[:vol]}>})
- matched.gsub!(/\b(pub):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:pub]} depth="many">\\2</sem:#{@ab[:pub]}>})
- matched.gsub!(/\b(ref):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:ref]} depth="many">\\2</sem:#{@ab[:ref]}>})
- matched.gsub!(/\b(desc):\{(.+?)\}:\1\b/m,%{<sem:#{@ab[:desc]} depth="many">\\2</sem:#{@ab[:desc]}>})
- matched.gsub!(/\b(conv):\{(.+?)\}:\1\b/m,%{<sem:#{@ab[:conv]} depth="many">\\2</sem:#{@ab[:conv]}>})
- matched.gsub!(/\b(ct):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:ct]} depth="many">\\2</sem:#{@ab[:ct]}>})
- matched.gsub!(/\b(cty):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:cty]} depth="many">\\2</sem:#{@ab[:cty]}>})
- matched.gsub!(/\b(org):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:org]} depth="many">\\2</sem:#{@ab[:org]}>})
- matched.gsub!(/\b(dt):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:dt]} depth="many">\\2</sem:#{@ab[:dt]}>})
- matched.gsub!(/\b(n):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:n]} depth="many">\\2</sem:#{@ab[:n]}>})
- matched.gsub!(/([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\1)/m,'<sem:\1 depth="many">\2</sem:\1>')
- end
- def xml_semantic_tags(dob)
- if @md.sem_tag
- dob.obj.gsub!(/([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\1)/m) {|c| xml_sem_block_paired(c) }
- dob.obj.gsub!(/([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\1)/m) {|c| xml_sem_block_paired(c) }
- dob.obj.gsub!(/([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\1)/m) {|c| xml_sem_block_paired(c) }
- dob.obj.gsub!(/:\{(.+?)\}:au\b/m, %{<sem:#{@ab[:au]} depth="one">\\1</sem:#{@ab[:au]}>})
- dob.obj.gsub!(/:\{(.+?)\}:n\b/m, %{<sem:#{@ab[:n]} depth="one">\\1</sem:#{@ab[:n]}>})
- dob.obj.gsub!(/:\{(.+?)\}:ti\b/m, %{<sem:#{@ab[:ti]} depth="one">\\1</sem:#{@ab[:ti]}>})
- dob.obj.gsub!(/:\{(.+?)\}:ref\b/m, %{<sem:#{@ab[:ref]} depth="one">\\1</sem:#{@ab[:ref]}>})
- dob.obj.gsub!(/:\{(.+?)\}:desc\b/m, %{<sem:#{@ab[:desc]} depth="one">\\1</sem:#{@ab[:desc]}>})
- dob.obj.gsub!(/:\{(.+?)\}:cty\b/m, %{<sem:#{@ab[:cty]} depth="one">\\1</sem:#{@ab[:cty]}>})
- dob.obj.gsub!(/:\{(.+?)\}:org\b/m, %{<sem:#{@ab[:org]} depth="one">\\1</sem:#{@ab[:org]}>})
- dob.obj.gsub!(/:\{(.+?)\}:([a-z]+(?:[_:.][a-z]+)*)/m,'<sem:\2 depth="one">\1</sem:\2>')
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};ti\b/m, %{<sem:#{@ab[:ti]} depth="zero">\\1</sem:#{@ab[:ti]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};qt\b/m, %{<sem:#{@ab[:qt]} depth="zero">\\1</sem:#{@ab[:qt]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};ref\b/m, %{<sem:#{@ab[:ref]} depth="zero">\\1</sem:#{@ab[:ref]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};ed\b/m, %{<sem:#{@ab[:ed]} depth="zero">\\1</sem:#{@ab[:ed]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};v\b/m, %{<sem:#{@ab[:v]} depth="zero">\\1</sem:#{@ab[:v]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};desc\b/m, %{<sem:#{@ab[:desc]} depth="zero">\\1</sem:#{@ab[:desc]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};def\b/m, %{<sem:#{@ab[:def]} depth="zero">\\1</sem:#{@ab[:def]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};trans\b/m, %{<sem:#{@ab[:trans]} depth="zero">\\1</sem:#{@ab[:trans]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};y\b/m, %{<sem:#{@ab[:y]} depth="zero">\\1</sem:#{@ab[:y]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};ab\b/m, %{<sem:#{@ab[:ab]} depth="zero">\\1</sem:#{@ab[:ab]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};pg\b/m, %{<sem:#{@ab[:pg]} depth="zero">\\1</sem:#{@ab[:pg]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};fn?\b/m, %{<sem:#{@ab[:fn]} depth="zero">\\1</sem:#{@ab[:fn]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};mn?\b/m, %{<sem:#{@ab[:mn]} depth="zero">\\1</sem:#{@ab[:mn]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};ln?\b/m, %{<sem:#{@ab[:ln]} depth="zero">\\1</sem:#{@ab[:ln]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};in\b/m, %{<sem:#{@ab[:in]} depth="zero">\\1</sem:#{@ab[:in]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};uni\b/m, %{<sem:#{@ab[:uni]} depth="zero">\\1</sem:#{@ab[:uni]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};fac\b/m, %{<sem:#{@ab[:fac]} depth="zero">\\1</sem:#{@ab[:fac]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};inst\b/m, %{<sem:#{@ab[:inst]} depth="zero">\\1</sem:#{@ab[:inst]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};dept\b/m, %{<sem:#{@ab[:dpt]} depth="zero">\\1</sem:#{@ab[:dept]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};org\b/m, %{<sem:#{@ab[:org]} depth="zero">\\1</sem:#{@ab[:org]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};com?\b/m, %{<sem:#{@ab[:com]} depth="zero">\\1</sem:#{@ab[:com]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};cty\b/m, %{<sem:#{@ab[:cty]} depth="zero">\\1</sem:#{@ab[:cty]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};([a-z]+(?:[_:.][a-z]+)*)/m,'<sem:\2 depth="zero">\1</sem:\2>')
- end
- dob
- end
- end
-end
-module SiSU_XML_tags #Format
- require "#{SiSU_lib}/param" # param.rb
- include SiSU_Param
- include SiSU_Viz
- class RDF
- def initialize(md='',seg_name=[],tracker=0)
- @full_title=@subtitle=@author=@subject=@description=@publisher=@contributor=@date=@date_created=@date_issued=@date_available=@date_valid=@date_modified=@type=@format=@identifier=@source=@language=@relation=@coverage=@rights=@copyright=@owner=@keywords=''
- @md=md
- @rdfurl=%{ rdf:about="http://www.jus.uio.no/lm/toc"\n}
- if defined? @md.title.full \
- and @md.title.full # DublinCore 1 - title
- @rdf_title=%{ dc.title="#{seg_name}#{@md.title.full}"\n}
- @full_title=%{ <meta name="dc.title" content="#{@md.title.full}" />\n}
- end
- if defined? @md.creator.author \
- and @md.creator.author=~/\S+/ # DublinCore 2 - creator/author (author)
- @rdf_author=%{ dc.author="#{@md.creator.author}"\n}
- content=meta_content_clean(@md.creator.author)
- @author=%{ <meta name="dc.author" content="#{content}" />\n}
- end
- if defined? @md.classify.subject \
- and @md.classify.subject=~/\S+/ # DublinCore 3 - subject (us library of congress, eric or udc, or schema???)
- @rdf_subject=%{ dc.subject="#{@md.classify.subject}"\n}
- content=meta_content_clean(@md.classify.subject)
- @subject=%{ <meta name="dc.subject" content="#{content}" />\n}
- end
- if defined? @md.notes.description \
- and @md.notes.description=~/\S+/ # DublinCore 4 - description
- @rdf_description=%{ dc.description="#{@md.notes.description}"\n}
- content=meta_content_clean(@md.notes.description)
- @description=%{ <meta name="dc.description" content="#{content}" />\n}
- end
- if defined? @md.publisher \
- and @md.publisher # DublinCore 5 - publisher (current copy published by)
- @rdf_publisher=%{ dc.publisher="#{@md.publisher}"\n}
- content=meta_content_clean(@md.publisher)
- @publisher=%{ <meta name="dc.publisher" content="#{content}" />\n}
- end
- if defined? @md.creator.contributor \
- and @md.creator.contributor=~/\S+/ # DublinCore 6 - contributor
- @rdf_contributor=%{ dc.contributor="#{@md.creator.contributor}"\n}
- content=meta_content_clean(@md.creator.contributor)
- @contributor=%{ <meta name="dc.contributor" content="#{content}" />\n}
- end
- if defined? @md.date.published \
- and @md.date.published=~/\S+/ # DublinCore 7 - date year-mm-dd
- @rdf_date=%{ dc.date="#{@md.date.published}"\n}
- @date=%{ <meta name="dc.date" content="#{@md.date.published}" #{@md.date_scheme} />\n} # fix @md.date_scheme
- end
- if defined? @md.date.created \
- and @md.date.created=~/\S+/ # DublinCore 7 - date.created year-mm-dd
- @rdf_date_created=%{ dc.date.created="#{@md.date.created}"\n}
- @date_created=%{ <meta name="dc.date.created" content="#{@md.date.created}" #{@md.date_scheme} />\n}
- end
- if defined? @md.date.issued \
- and @md.date.issued=~/\S+/ # DublinCore 7 - date.issued year-mm-dd
- @rdf_date_issued=%{ dc.date.issued="#{@md.date.issued}"\n}
- @date_issued=%{ <meta name="dc.date.issued" content="#{@md.date.issued}" #{@md.date_scheme} />\n}
- end
- if defined? @md.date.available \
- and @md.date.available=~/\S+/ # DublinCore 7 - date.available year-mm-dd
- @rdf_date_available=%{ dc.date.available="#{@md.date.available}"\n}
- @date_available=%{ <meta name="dc.date.available" content="#{@md.date.available}" #{@md.date_scheme} />\n}
- end
- if defined? @md.date.valid \
- and @md.date.valid=~/\S+/ # DublinCore 7 - date.valid year-mm-dd
- @rdf_date_valid=%{ dc.date.valid="#{@md.date.valid}"\n}
- @date_valid=%{ <meta name="dc.date.valid" content="#{@md.date.valid}" #{@md.date_scheme} />\n}
- end
- if defined? @md.date.modified \
- and @md.date.modified=~/\S+/ # DublinCore 7 - date.modified year-mm-dd
- @rdf_date_modified=%{ dc.date.modified="#{@md.date.modified}"\n}
- @date_modified=%{ <meta name="dc.date.modified" content="#{@md.date.modified}" #{@md.date_scheme} />\n}
- end
- if defined? @md.type \
- and @md.type # DublinCore 8 - type (genre eg. report, convention etc)