summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/sisu.rb (renamed from lib/sisu/current/zap.rb)62
-rw-r--r--lib/sisu/air.rb (renamed from lib/sisu/current/air.rb)2
-rw-r--r--lib/sisu/ao.rb (renamed from lib/sisu/current/ao.rb)2
-rw-r--r--lib/sisu/ao_character_check.rb (renamed from lib/sisu/current/ao_character_check.rb)2
-rw-r--r--lib/sisu/ao_composite.rb (renamed from lib/sisu/develop/ao_composite.rb)2
-rw-r--r--lib/sisu/ao_doc_objects.rb (renamed from lib/sisu/current/ao_doc_objects.rb)2
-rw-r--r--lib/sisu/ao_doc_str.rb (renamed from lib/sisu/current/ao_doc_str.rb)2
-rw-r--r--lib/sisu/ao_endnotes.rb (renamed from lib/sisu/current/ao_endnotes.rb)2
-rw-r--r--lib/sisu/ao_expand_insertions.rb (renamed from lib/sisu/current/ao_expand_insertions.rb)2
-rw-r--r--lib/sisu/ao_hash_digest.rb (renamed from lib/sisu/develop/ao_hash_digest.rb)2
-rw-r--r--lib/sisu/ao_idx.rb (renamed from lib/sisu/current/ao_idx.rb)2
-rw-r--r--lib/sisu/ao_images.rb (renamed from lib/sisu/develop/ao_images.rb)2
-rw-r--r--lib/sisu/ao_metadata.rb (renamed from lib/sisu/develop/ao_metadata.rb)2
-rw-r--r--lib/sisu/ao_misc_arrange.rb (renamed from lib/sisu/develop/ao_misc_arrange.rb)2
-rw-r--r--lib/sisu/ao_numbering.rb (renamed from lib/sisu/current/ao_numbering.rb)2
-rw-r--r--lib/sisu/ao_persist.rb (renamed from lib/sisu/current/ao_persist.rb)2
-rw-r--r--lib/sisu/ao_references.rb (renamed from lib/sisu/develop/ao_references.rb)2
-rw-r--r--lib/sisu/ao_syntax.rb (renamed from lib/sisu/develop/ao_syntax.rb)2
-rw-r--r--lib/sisu/cgi.rb (renamed from lib/sisu/develop/cgi.rb)2
-rw-r--r--lib/sisu/cgi_pgsql.rb (renamed from lib/sisu/current/cgi_pgsql.rb)2
-rw-r--r--lib/sisu/cgi_sql_common.rb (renamed from lib/sisu/current/cgi_sql_common.rb)2
-rw-r--r--lib/sisu/cgi_sqlite.rb (renamed from lib/sisu/develop/cgi_sqlite.rb)2
-rw-r--r--lib/sisu/conf.rb (renamed from lib/sisu/current/conf.rb)2
-rw-r--r--lib/sisu/constants.rb (renamed from lib/sisu/current/constants.rb)6
-rw-r--r--lib/sisu/css.rb (renamed from lib/sisu/current/css.rb)2
-rw-r--r--lib/sisu/current/ao_composite.rb286
-rw-r--r--lib/sisu/current/ao_hash_digest.rb174
-rw-r--r--lib/sisu/current/ao_images.rb187
-rw-r--r--lib/sisu/current/ao_metadata.rb86
-rw-r--r--lib/sisu/current/ao_misc_arrange.rb207
-rw-r--r--lib/sisu/current/ao_references.rb502
-rw-r--r--lib/sisu/current/ao_syntax.rb640
-rw-r--r--lib/sisu/current/cgi.rb84
-rw-r--r--lib/sisu/current/cgi_sqlite.rb244
-rw-r--r--lib/sisu/current/db_create.rb689
-rw-r--r--lib/sisu/current/db_drop.rb207
-rw-r--r--lib/sisu/current/db_indexes.rb146
-rw-r--r--lib/sisu/current/db_load_tuple.rb323
-rw-r--r--lib/sisu/current/db_remove.rb182
-rw-r--r--lib/sisu/current/db_select.rb230
-rw-r--r--lib/sisu/current/db_sqltxt.rb173
-rw-r--r--lib/sisu/current/dbi.rb166
-rw-r--r--lib/sisu/current/dp.rb1606
-rw-r--r--lib/sisu/current/dp_identify_markup.rb161
-rw-r--r--lib/sisu/current/dp_make.rb668
-rw-r--r--lib/sisu/current/html.rb775
-rw-r--r--lib/sisu/current/html_harvest.rb109
-rw-r--r--lib/sisu/current/html_harvest_topics.rb893
-rw-r--r--lib/sisu/current/html_manifest.rb1032
-rw-r--r--lib/sisu/current/html_persist.rb237
-rw-r--r--lib/sisu/current/html_promo.rb440
-rw-r--r--lib/sisu/current/html_scroll.rb235
-rw-r--r--lib/sisu/current/html_segments.rb716
-rw-r--r--lib/sisu/current/html_shared.rb62
-rw-r--r--lib/sisu/current/html_table.rb64
-rw-r--r--lib/sisu/current/html_tune.rb301
-rw-r--r--lib/sisu/current/hub_actions.rb1122
-rw-r--r--lib/sisu/current/i18n.rb702
-rw-r--r--lib/sisu/current/manpage.rb377
-rw-r--r--lib/sisu/current/object_munge.rb307
-rw-r--r--lib/sisu/current/remote.rb246
-rw-r--r--lib/sisu/current/se.rb158
-rw-r--r--lib/sisu/current/se_cleanoutput.rb145
-rw-r--r--lib/sisu/current/se_clear.rb105
-rw-r--r--lib/sisu/current/se_date.rb92
-rw-r--r--lib/sisu/current/se_db.rb214
-rw-r--r--lib/sisu/current/se_filemap.rb247
-rw-r--r--lib/sisu/current/se_load.rb108
-rw-r--r--lib/sisu/current/se_programs.rb394
-rw-r--r--lib/sisu/current/shared_markup_alt.rb336
-rw-r--r--lib/sisu/current/shared_sem.rb156
-rw-r--r--lib/sisu/current/sitemaps.rb224
-rw-r--r--lib/sisu/current/src_po4a_share.rb309
-rw-r--r--lib/sisu/current/src_po4a_shelf.rb1217
-rw-r--r--lib/sisu/current/src_po4a_shelf_set.rb297
-rw-r--r--lib/sisu/current/src_po4a_sst_ao_sst.rb893
-rw-r--r--lib/sisu/current/src_po4a_sst_ao_sst_set.rb284
-rw-r--r--lib/sisu/current/src_po4a_sstm.rb135
-rw-r--r--lib/sisu/current/src_sisupod_make.rb171
-rw-r--r--lib/sisu/current/src_sisupod_sstm.rb109
-rw-r--r--lib/sisu/current/sst_from_xml.rb178
-rw-r--r--lib/sisu/current/sst_identify_markup.rb482
-rw-r--r--lib/sisu/current/termsheet.rb163
-rw-r--r--lib/sisu/current/texinfo.rb430
-rw-r--r--lib/sisu/current/texinfo_format.rb541
-rw-r--r--lib/sisu/current/texpdf.rb1162
-rw-r--r--lib/sisu/current/texpdf_format.rb1689
-rw-r--r--lib/sisu/current/texpdf_parts.rb235
-rw-r--r--lib/sisu/current/txt_asciidoc.rb354
-rw-r--r--lib/sisu/current/txt_asciidoc_decorate.rb207
-rw-r--r--lib/sisu/current/txt_markdown.rb389
-rw-r--r--lib/sisu/current/txt_markdown_decorate.rb207
-rw-r--r--lib/sisu/current/txt_orgmode.rb376
-rw-r--r--lib/sisu/current/txt_rst.rb371
-rw-r--r--lib/sisu/current/txt_rst_decorate.rb186
-rw-r--r--lib/sisu/current/txt_shared.rb241
-rw-r--r--lib/sisu/current/txt_textile_decorate.rb186
-rw-r--r--lib/sisu/current/urls.rb696
-rw-r--r--lib/sisu/current/utils.rb232
-rw-r--r--lib/sisu/current/utils_response.rb114
-rw-r--r--lib/sisu/current/utils_screen_text_color.rb472
-rw-r--r--lib/sisu/current/webrick.rb191
-rw-r--r--lib/sisu/current/xhtml_epub2_concordance.rb322
-rw-r--r--lib/sisu/current/xhtml_epub2_format.rb2272
-rw-r--r--lib/sisu/current/xhtml_epub2_tune.rb330
-rw-r--r--lib/sisu/current/xhtml_table.rb97
-rw-r--r--lib/sisu/current/xml_docbook5.rb376
-rw-r--r--lib/sisu/current/xml_odf_odt.rb885
-rw-r--r--lib/sisu/current/xml_odf_odt_format.rb674
-rw-r--r--lib/sisu/current/xml_persist.rb126
-rw-r--r--lib/sisu/current/xml_scaffold_structure_collapsed.rb198
-rw-r--r--lib/sisu/current/xml_scaffold_structure_sisu.rb201
-rw-r--r--lib/sisu/db_columns.rb (renamed from lib/sisu/current/db_columns.rb)2
-rw-r--r--lib/sisu/db_create.rb (renamed from lib/sisu/develop/db_create.rb)2
-rw-r--r--lib/sisu/db_dbi.rb (renamed from lib/sisu/current/db_dbi.rb)2
-rw-r--r--lib/sisu/db_drop.rb (renamed from lib/sisu/develop/db_drop.rb)2
-rw-r--r--lib/sisu/db_import.rb (renamed from lib/sisu/current/db_import.rb)2
-rw-r--r--lib/sisu/db_indexes.rb (renamed from lib/sisu/develop/db_indexes.rb)2
-rw-r--r--lib/sisu/db_load_tuple.rb (renamed from lib/sisu/develop/db_load_tuple.rb)2
-rw-r--r--lib/sisu/db_remove.rb (renamed from lib/sisu/develop/db_remove.rb)2
-rw-r--r--lib/sisu/db_select.rb (renamed from lib/sisu/develop/db_select.rb)2
-rw-r--r--lib/sisu/db_sqltxt.rb (renamed from lib/sisu/develop/db_sqltxt.rb)2
-rw-r--r--lib/sisu/db_tests.rb (renamed from lib/sisu/current/db_tests.rb)2
-rw-r--r--lib/sisu/dbi.rb (renamed from lib/sisu/develop/dbi.rb)2
-rw-r--r--lib/sisu/dbi_discrete.rb (renamed from lib/sisu/current/dbi_discrete.rb)2
-rw-r--r--lib/sisu/develop/air.rb80
-rw-r--r--lib/sisu/develop/ao.rb590
-rw-r--r--lib/sisu/develop/ao_character_check.rb102
-rw-r--r--lib/sisu/develop/ao_doc_objects.rb565
-rw-r--r--lib/sisu/develop/ao_doc_str.rb2269
-rw-r--r--lib/sisu/develop/ao_endnotes.rb136
-rw-r--r--lib/sisu/develop/ao_expand_insertions.rb514
-rw-r--r--lib/sisu/develop/ao_idx.rb422
-rw-r--r--lib/sisu/develop/ao_numbering.rb720
-rw-r--r--lib/sisu/develop/ao_persist.rb194
-rw-r--r--lib/sisu/develop/cgi_pgsql.rb270
-rw-r--r--lib/sisu/develop/cgi_sql_common.rb986
-rw-r--r--lib/sisu/develop/conf.rb287
-rw-r--r--lib/sisu/develop/constants.rb388
-rw-r--r--lib/sisu/develop/css.rb3484
-rw-r--r--lib/sisu/develop/db_columns.rb1997
-rw-r--r--lib/sisu/develop/db_dbi.rb90
-rw-r--r--lib/sisu/develop/db_import.rb877
-rw-r--r--lib/sisu/develop/db_tests.rb114
-rw-r--r--lib/sisu/develop/dbi_discrete.rb206
-rw-r--r--lib/sisu/develop/digests.rb306
-rw-r--r--lib/sisu/develop/embedded.rb149
-rw-r--r--lib/sisu/develop/errors.rb84
-rw-r--r--lib/sisu/develop/generic_parts.rb131
-rw-r--r--lib/sisu/develop/git.rb277
-rw-r--r--lib/sisu/develop/html_concordance.rb391
-rw-r--r--lib/sisu/develop/html_format.rb1348
-rw-r--r--lib/sisu/develop/html_harvest_author_format.rb111
-rw-r--r--lib/sisu/develop/html_harvest_authors.rb466
-rw-r--r--lib/sisu/develop/html_lite_shared.rb324
-rw-r--r--lib/sisu/develop/html_minitoc.rb230
-rw-r--r--lib/sisu/develop/html_parts.rb437
-rw-r--r--lib/sisu/develop/hub.rb277
-rw-r--r--lib/sisu/develop/hub_loop_markup_files.rb170
-rw-r--r--lib/sisu/develop/hub_options.rb1695
-rw-r--r--lib/sisu/develop/manpage_format.rb85
-rw-r--r--lib/sisu/develop/prog_text_translation.rb1702
-rw-r--r--lib/sisu/develop/qrcode.rb754
-rw-r--r--lib/sisu/develop/relaxng.rb1153
-rw-r--r--lib/sisu/develop/rexml.rb148
-rw-r--r--lib/sisu/develop/se_createsite.rb273
-rw-r--r--lib/sisu/develop/se_css.rb221
-rw-r--r--lib/sisu/develop/se_envcall.rb326
-rw-r--r--lib/sisu/develop/se_file_op.rb2758
-rw-r--r--lib/sisu/develop/se_get_init.rb258
-rw-r--r--lib/sisu/develop/se_hub_particulars.rb234
-rw-r--r--lib/sisu/develop/se_info_env.rb2179
-rw-r--r--lib/sisu/develop/se_info_port.rb70
-rw-r--r--lib/sisu/develop/se_info_system.rb202
-rw-r--r--lib/sisu/develop/se_processing.rb659
-rw-r--r--lib/sisu/develop/se_remotes.rb553
-rw-r--r--lib/sisu/develop/se_standardise_lang.rb176
-rw-r--r--lib/sisu/develop/se_version.rb183
-rw-r--r--lib/sisu/develop/shared_images.rb137
-rw-r--r--lib/sisu/develop/shared_metadata.rb1361
-rw-r--r--lib/sisu/develop/sisu_thor_lib.rb407
-rw-r--r--lib/sisu/develop/src_kdissert_share.rb102
-rw-r--r--lib/sisu/develop/src_shared.rb347
-rw-r--r--lib/sisu/develop/sst_convert_markup.rb323
-rw-r--r--lib/sisu/develop/sst_do_inline_footnotes.rb440
-rw-r--r--lib/sisu/develop/sst_to_s_xml_sax.rb471
-rw-r--r--lib/sisu/develop/txt_orgmode_decorate.rb186
-rw-r--r--lib/sisu/develop/txt_output.rb86
-rw-r--r--lib/sisu/develop/txt_plain.rb410
-rw-r--r--lib/sisu/develop/txt_plain_decorate.rb189
-rw-r--r--lib/sisu/develop/txt_read.rb109
-rw-r--r--lib/sisu/develop/txt_textile.rb367
-rw-r--r--lib/sisu/develop/update.rb141
-rw-r--r--lib/sisu/develop/utils_composite.rb115
-rw-r--r--lib/sisu/develop/utils_spell.rb99
-rw-r--r--lib/sisu/develop/wikispeak.rb375
-rw-r--r--lib/sisu/develop/xhtml.rb472
-rw-r--r--lib/sisu/develop/xhtml_epub2.rb890
-rw-r--r--lib/sisu/develop/xhtml_epub2_persist.rb278
-rw-r--r--lib/sisu/develop/xhtml_epub2_segments.rb599
-rw-r--r--lib/sisu/develop/xhtml_parts.rb183
-rw-r--r--lib/sisu/develop/xhtml_shared.rb62
-rw-r--r--lib/sisu/develop/xml_dom.rb624
-rw-r--r--lib/sisu/develop/xml_fictionbook2.rb389
-rw-r--r--lib/sisu/develop/xml_format.rb865
-rw-r--r--lib/sisu/develop/xml_md_oai_pmh_dc.rb229
-rw-r--r--lib/sisu/develop/xml_parts.rb191
-rw-r--r--lib/sisu/develop/xml_sax.rb521
-rw-r--r--lib/sisu/develop/xml_shared.rb665
-rw-r--r--lib/sisu/develop/xml_tables.rb261
-rw-r--r--lib/sisu/digests.rb (renamed from lib/sisu/current/digests.rb)2
-rw-r--r--lib/sisu/dp.rb (renamed from lib/sisu/develop/dp.rb)2
-rw-r--r--lib/sisu/dp_identify_markup.rb (renamed from lib/sisu/develop/dp_identify_markup.rb)2
-rw-r--r--lib/sisu/dp_make.rb (renamed from lib/sisu/develop/dp_make.rb)2
-rw-r--r--lib/sisu/embedded.rb (renamed from lib/sisu/current/embedded.rb)2
-rw-r--r--lib/sisu/errors.rb (renamed from lib/sisu/current/errors.rb)2
-rw-r--r--lib/sisu/generic_parts.rb (renamed from lib/sisu/current/generic_parts.rb)2
-rw-r--r--lib/sisu/git.rb (renamed from lib/sisu/current/git.rb)2
-rw-r--r--lib/sisu/html.rb (renamed from lib/sisu/develop/html.rb)2
-rw-r--r--lib/sisu/html_concordance.rb (renamed from lib/sisu/current/html_concordance.rb)2
-rw-r--r--lib/sisu/html_format.rb (renamed from lib/sisu/current/html_format.rb)2
-rw-r--r--lib/sisu/html_harvest.rb (renamed from lib/sisu/develop/html_harvest.rb)2
-rw-r--r--lib/sisu/html_harvest_author_format.rb (renamed from lib/sisu/current/html_harvest_author_format.rb)2
-rw-r--r--lib/sisu/html_harvest_authors.rb (renamed from lib/sisu/current/html_harvest_authors.rb)2
-rw-r--r--lib/sisu/html_harvest_topics.rb (renamed from lib/sisu/develop/html_harvest_topics.rb)2
-rw-r--r--lib/sisu/html_lite_shared.rb (renamed from lib/sisu/current/html_lite_shared.rb)2
-rw-r--r--lib/sisu/html_manifest.rb (renamed from lib/sisu/develop/html_manifest.rb)2
-rw-r--r--lib/sisu/html_minitoc.rb (renamed from lib/sisu/current/html_minitoc.rb)2
-rw-r--r--lib/sisu/html_parts.rb (renamed from lib/sisu/current/html_parts.rb)2
-rw-r--r--lib/sisu/html_persist.rb (renamed from lib/sisu/develop/html_persist.rb)2
-rw-r--r--lib/sisu/html_promo.rb (renamed from lib/sisu/develop/html_promo.rb)2
-rw-r--r--lib/sisu/html_scroll.rb (renamed from lib/sisu/develop/html_scroll.rb)2
-rw-r--r--lib/sisu/html_segments.rb (renamed from lib/sisu/develop/html_segments.rb)2
-rw-r--r--lib/sisu/html_shared.rb (renamed from lib/sisu/develop/html_shared.rb)2
-rw-r--r--lib/sisu/html_table.rb (renamed from lib/sisu/develop/html_table.rb)2
-rw-r--r--lib/sisu/html_tune.rb (renamed from lib/sisu/develop/html_tune.rb)2
-rw-r--r--lib/sisu/hub.rb (renamed from lib/sisu/current/hub.rb)6
-rw-r--r--lib/sisu/hub_actions.rb (renamed from lib/sisu/develop/hub_actions.rb)2
-rw-r--r--lib/sisu/hub_loop_markup_files.rb (renamed from lib/sisu/current/hub_loop_markup_files.rb)2
-rw-r--r--lib/sisu/hub_options.rb (renamed from lib/sisu/current/hub_options.rb)2
-rw-r--r--lib/sisu/i18n.rb (renamed from lib/sisu/develop/i18n.rb)2
-rw-r--r--lib/sisu/manpage.rb (renamed from lib/sisu/develop/manpage.rb)2
-rw-r--r--lib/sisu/manpage_format.rb (renamed from lib/sisu/current/manpage_format.rb)2
-rw-r--r--lib/sisu/object_munge.rb (renamed from lib/sisu/develop/object_munge.rb)2
-rw-r--r--lib/sisu/prog_text_translation.rb (renamed from lib/sisu/current/prog_text_translation.rb)2
-rw-r--r--lib/sisu/qrcode.rb (renamed from lib/sisu/current/qrcode.rb)2
-rw-r--r--lib/sisu/relaxng.rb (renamed from lib/sisu/current/relaxng.rb)2
-rw-r--r--lib/sisu/remote.rb (renamed from lib/sisu/develop/remote.rb)2
-rw-r--r--lib/sisu/rexml.rb (renamed from lib/sisu/current/rexml.rb)2
-rw-r--r--lib/sisu/se.rb (renamed from lib/sisu/develop/se.rb)2
-rw-r--r--lib/sisu/se_cleanoutput.rb (renamed from lib/sisu/develop/se_cleanoutput.rb)2
-rw-r--r--lib/sisu/se_clear.rb (renamed from lib/sisu/develop/se_clear.rb)2
-rw-r--r--lib/sisu/se_createsite.rb (renamed from lib/sisu/current/se_createsite.rb)2
-rw-r--r--lib/sisu/se_css.rb (renamed from lib/sisu/current/se_css.rb)2
-rw-r--r--lib/sisu/se_date.rb (renamed from lib/sisu/develop/se_date.rb)2
-rw-r--r--lib/sisu/se_db.rb (renamed from lib/sisu/develop/se_db.rb)2
-rw-r--r--lib/sisu/se_envcall.rb (renamed from lib/sisu/current/se_envcall.rb)2
-rw-r--r--lib/sisu/se_file_op.rb (renamed from lib/sisu/current/se_file_op.rb)2
-rw-r--r--lib/sisu/se_filemap.rb (renamed from lib/sisu/develop/se_filemap.rb)2
-rw-r--r--lib/sisu/se_get_init.rb (renamed from lib/sisu/current/se_get_init.rb)38
-rw-r--r--lib/sisu/se_hub_particulars.rb (renamed from lib/sisu/current/se_hub_particulars.rb)2
-rw-r--r--lib/sisu/se_info_env.rb (renamed from lib/sisu/current/se_info_env.rb)2
-rw-r--r--lib/sisu/se_info_port.rb (renamed from lib/sisu/current/se_info_port.rb)2
-rw-r--r--lib/sisu/se_info_system.rb (renamed from lib/sisu/current/se_info_system.rb)4
-rw-r--r--lib/sisu/se_load.rb (renamed from lib/sisu/develop/se_load.rb)2
-rw-r--r--lib/sisu/se_processing.rb (renamed from lib/sisu/current/se_processing.rb)2
-rw-r--r--lib/sisu/se_programs.rb (renamed from lib/sisu/develop/se_programs.rb)2
-rw-r--r--lib/sisu/se_remotes.rb (renamed from lib/sisu/current/se_remotes.rb)2
-rw-r--r--lib/sisu/se_standardise_lang.rb (renamed from lib/sisu/current/se_standardise_lang.rb)2
-rw-r--r--lib/sisu/se_version.rb (renamed from lib/sisu/current/se_version.rb)17
-rw-r--r--lib/sisu/shared_images.rb (renamed from lib/sisu/current/shared_images.rb)2
-rw-r--r--lib/sisu/shared_markup_alt.rb (renamed from lib/sisu/develop/shared_markup_alt.rb)2
-rw-r--r--lib/sisu/shared_metadata.rb (renamed from lib/sisu/current/shared_metadata.rb)2
-rw-r--r--lib/sisu/shared_sem.rb (renamed from lib/sisu/develop/shared_sem.rb)2
-rw-r--r--lib/sisu/sisu_thor_lib.rb (renamed from lib/sisu/current/sisu_thor_lib.rb)0
-rw-r--r--lib/sisu/sitemaps.rb (renamed from lib/sisu/develop/sitemaps.rb)2
-rw-r--r--lib/sisu/src_kdissert_share.rb (renamed from lib/sisu/current/src_kdissert_share.rb)2
-rw-r--r--lib/sisu/src_po4a_share.rb (renamed from lib/sisu/develop/src_po4a_share.rb)2
-rw-r--r--lib/sisu/src_po4a_shelf.rb (renamed from lib/sisu/develop/src_po4a_shelf.rb)2
-rw-r--r--lib/sisu/src_po4a_shelf_set.rb (renamed from lib/sisu/develop/src_po4a_shelf_set.rb)2
-rw-r--r--lib/sisu/src_po4a_sst_ao_sst.rb (renamed from lib/sisu/develop/src_po4a_sst_ao_sst.rb)2
-rw-r--r--lib/sisu/src_po4a_sst_ao_sst_set.rb (renamed from lib/sisu/develop/src_po4a_sst_ao_sst_set.rb)2
-rw-r--r--lib/sisu/src_po4a_sstm.rb (renamed from lib/sisu/develop/src_po4a_sstm.rb)2
-rw-r--r--lib/sisu/src_shared.rb (renamed from lib/sisu/current/src_shared.rb)2
-rw-r--r--lib/sisu/src_sisupod_make.rb (renamed from lib/sisu/develop/src_sisupod_make.rb)2
-rw-r--r--lib/sisu/src_sisupod_sstm.rb (renamed from lib/sisu/develop/src_sisupod_sstm.rb)2
-rw-r--r--lib/sisu/sst_convert_markup.rb (renamed from lib/sisu/current/sst_convert_markup.rb)2
-rw-r--r--lib/sisu/sst_do_inline_footnotes.rb (renamed from lib/sisu/current/sst_do_inline_footnotes.rb)2
-rw-r--r--lib/sisu/sst_from_xml.rb (renamed from lib/sisu/develop/sst_from_xml.rb)2
-rw-r--r--lib/sisu/sst_identify_markup.rb (renamed from lib/sisu/develop/sst_identify_markup.rb)2
-rw-r--r--lib/sisu/sst_to_s_xml_sax.rb (renamed from lib/sisu/current/sst_to_s_xml_sax.rb)2
-rw-r--r--lib/sisu/termsheet.rb (renamed from lib/sisu/develop/termsheet.rb)2
-rw-r--r--lib/sisu/texinfo.rb (renamed from lib/sisu/develop/texinfo.rb)2
-rw-r--r--lib/sisu/texinfo_format.rb (renamed from lib/sisu/develop/texinfo_format.rb)2
-rw-r--r--lib/sisu/texpdf.rb (renamed from lib/sisu/develop/texpdf.rb)2
-rw-r--r--lib/sisu/texpdf_format.rb (renamed from lib/sisu/develop/texpdf_format.rb)2
-rw-r--r--lib/sisu/texpdf_parts.rb (renamed from lib/sisu/develop/texpdf_parts.rb)2
-rw-r--r--lib/sisu/txt_asciidoc.rb (renamed from lib/sisu/develop/txt_asciidoc.rb)2
-rw-r--r--lib/sisu/txt_asciidoc_decorate.rb (renamed from lib/sisu/develop/txt_asciidoc_decorate.rb)2
-rw-r--r--lib/sisu/txt_markdown.rb (renamed from lib/sisu/develop/txt_markdown.rb)2
-rw-r--r--lib/sisu/txt_markdown_decorate.rb (renamed from lib/sisu/develop/txt_markdown_decorate.rb)2
-rw-r--r--lib/sisu/txt_orgmode.rb (renamed from lib/sisu/develop/txt_orgmode.rb)2
-rw-r--r--lib/sisu/txt_orgmode_decorate.rb (renamed from lib/sisu/current/txt_orgmode_decorate.rb)2
-rw-r--r--lib/sisu/txt_output.rb (renamed from lib/sisu/current/txt_output.rb)2
-rw-r--r--lib/sisu/txt_plain.rb (renamed from lib/sisu/current/txt_plain.rb)2
-rw-r--r--lib/sisu/txt_plain_decorate.rb (renamed from lib/sisu/current/txt_plain_decorate.rb)2
-rw-r--r--lib/sisu/txt_read.rb (renamed from lib/sisu/current/txt_read.rb)2
-rw-r--r--lib/sisu/txt_rst.rb (renamed from lib/sisu/develop/txt_rst.rb)2
-rw-r--r--lib/sisu/txt_rst_decorate.rb (renamed from lib/sisu/develop/txt_rst_decorate.rb)2
-rw-r--r--lib/sisu/txt_shared.rb (renamed from lib/sisu/develop/txt_shared.rb)2
-rw-r--r--lib/sisu/txt_textile.rb (renamed from lib/sisu/current/txt_textile.rb)2
-rw-r--r--lib/sisu/txt_textile_decorate.rb (renamed from lib/sisu/develop/txt_textile_decorate.rb)2
-rw-r--r--lib/sisu/update.rb (renamed from lib/sisu/current/update.rb)2
-rw-r--r--lib/sisu/urls.rb (renamed from lib/sisu/develop/urls.rb)2
-rw-r--r--lib/sisu/utils.rb (renamed from lib/sisu/develop/utils.rb)2
-rw-r--r--lib/sisu/utils_composite.rb (renamed from lib/sisu/current/utils_composite.rb)2
-rw-r--r--lib/sisu/utils_response.rb (renamed from lib/sisu/develop/utils_response.rb)2
-rw-r--r--lib/sisu/utils_screen_text_color.rb (renamed from lib/sisu/develop/utils_screen_text_color.rb)2
-rw-r--r--lib/sisu/utils_spell.rb (renamed from lib/sisu/current/utils_spell.rb)2
-rw-r--r--lib/sisu/webrick.rb (renamed from lib/sisu/develop/webrick.rb)2
-rw-r--r--lib/sisu/wikispeak.rb (renamed from lib/sisu/current/wikispeak.rb)2
-rw-r--r--lib/sisu/xhtml.rb (renamed from lib/sisu/current/xhtml.rb)2
-rw-r--r--lib/sisu/xhtml_epub2.rb (renamed from lib/sisu/current/xhtml_epub2.rb)2
-rw-r--r--lib/sisu/xhtml_epub2_concordance.rb (renamed from lib/sisu/develop/xhtml_epub2_concordance.rb)2
-rw-r--r--lib/sisu/xhtml_epub2_format.rb (renamed from lib/sisu/develop/xhtml_epub2_format.rb)2
-rw-r--r--lib/sisu/xhtml_epub2_persist.rb (renamed from lib/sisu/current/xhtml_epub2_persist.rb)2
-rw-r--r--lib/sisu/xhtml_epub2_segments.rb (renamed from lib/sisu/current/xhtml_epub2_segments.rb)2
-rw-r--r--lib/sisu/xhtml_epub2_tune.rb (renamed from lib/sisu/develop/xhtml_epub2_tune.rb)2
-rw-r--r--lib/sisu/xhtml_parts.rb (renamed from lib/sisu/current/xhtml_parts.rb)2
-rw-r--r--lib/sisu/xhtml_shared.rb (renamed from lib/sisu/current/xhtml_shared.rb)2
-rw-r--r--lib/sisu/xhtml_table.rb (renamed from lib/sisu/develop/xhtml_table.rb)2
-rw-r--r--lib/sisu/xml_docbook5.rb (renamed from lib/sisu/develop/xml_docbook5.rb)2
-rw-r--r--lib/sisu/xml_dom.rb (renamed from lib/sisu/current/xml_dom.rb)2
-rw-r--r--lib/sisu/xml_fictionbook2.rb (renamed from lib/sisu/current/xml_fictionbook2.rb)2
-rw-r--r--lib/sisu/xml_format.rb (renamed from lib/sisu/current/xml_format.rb)2
-rw-r--r--lib/sisu/xml_md_oai_pmh_dc.rb (renamed from lib/sisu/current/xml_md_oai_pmh_dc.rb)2
-rw-r--r--lib/sisu/xml_odf_odt.rb (renamed from lib/sisu/develop/xml_odf_odt.rb)18
-rw-r--r--lib/sisu/xml_odf_odt_format.rb (renamed from lib/sisu/develop/xml_odf_odt_format.rb)2
-rw-r--r--lib/sisu/xml_parts.rb (renamed from lib/sisu/current/xml_parts.rb)2
-rw-r--r--lib/sisu/xml_persist.rb (renamed from lib/sisu/develop/xml_persist.rb)2
-rw-r--r--lib/sisu/xml_sax.rb (renamed from lib/sisu/current/xml_sax.rb)2
-rw-r--r--lib/sisu/xml_scaffold_structure_collapsed.rb (renamed from lib/sisu/develop/xml_scaffold_structure_collapsed.rb)2
-rw-r--r--lib/sisu/xml_scaffold_structure_sisu.rb (renamed from lib/sisu/develop/xml_scaffold_structure_sisu.rb)2
-rw-r--r--lib/sisu/xml_shared.rb (renamed from lib/sisu/current/xml_shared.rb)2
-rw-r--r--lib/sisu/xml_tables.rb (renamed from lib/sisu/current/xml_tables.rb)2
-rw-r--r--lib/sisu/zap.rb (renamed from lib/sisu/develop/zap.rb)2
346 files changed, 230 insertions, 79524 deletions
diff --git a/lib/sisu/current/zap.rb b/lib/sisu.rb
index 6e1e0fb..b4dee16 100644
--- a/lib/sisu/current/zap.rb
+++ b/lib/sisu.rb
@@ -4,7 +4,7 @@
* Name: SiSU
** Description: documents, structuring, processing, publishing, search
-*** zap wipe clean previous output of the type specified
+*** hub
** Author: Ralph Amissah
<ralph@amissah.com>
@@ -51,38 +51,42 @@
** Git
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/zap.rb;hb=HEAD>
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu.rb;hb=HEAD>
=end
-module SiSU_Zap
- require_relative 'se' # se.rb
- include SiSU_Env
- class Source
- def initialize(opt)
- @opt=opt
- @env=SiSU_Env::InfoEnv.new(opt.fns)
- end
- def read
- zap_path="#{@env.path.output}/#{@env.fnb}"
- z=SiSU_Env::CleanOutput.new(@opt)
- if SiSU_Env::InfoSettings.new.permission?('zap')
- unless @opt.act[:quiet][:set]==:on
- tell=SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- "Clean files related to processing #{@opt.selections.str} ->",
- "#{@opt.fns} -> #{zap_path}"
- )
- tell.warn
+module SiSU_libs
+ require_relative 'sisu/hub' # sisu/hub.rb
+ require_relative 'sisu/se' # sisu/se.rb
+ require_relative 'sisu/utils' # sisu/utils.rb
+ class CallHubMaster
+ def initialize(argv,sisu_runtime)
+ begin
+ SiSU::HubMaster.new(argv,sisu_runtime)
+ rescue
+ SiSU_Screen::Ansi.new(argv).rescue do
+ __LINE__.to_s + ':' + __FILE__
end
- z.zap.remove_output
- else
- unless @opt.act[:quiet][:set]==:on
- tell=SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- 'use of -Z (zap) has not enabled in sisurc.yml'
- )
- tell.warn
+ ensure
+ Dir.chdir(sisu_runtime[:call_path])
+ end
+ end
+ end
+ class HubClose
+ def initialize(argv,call_path)
+ begin
+ env=SiSU_Env::InfoEnv.new
+ rescue
+ ensure
+ if FileTest.directory?(env.processing_path.processing) \
+ and FileTest.directory?(env.processing_path.processing_base_tmp) \
+ and env.processing_path.processing_base_tmp =~/#{env.processing_path.processing}/ \
+ and env.processing_path.processing_base_tmp =~/^\/tmp\/\S+/ \
+ and not argv.inspect =~/"--maintenance"|"-M"/
+ FileUtils::cd(env.processing_path.processing_base_tmp) do
+ FileUtils::rm_rf('.')
+ end
end
+ Dir.chdir(call_path)
end
end
end
diff --git a/lib/sisu/current/air.rb b/lib/sisu/air.rb
index 1876a0e..ad1d3a4 100644
--- a/lib/sisu/current/air.rb
+++ b/lib/sisu/air.rb
@@ -51,7 +51,7 @@
** Git
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/air.rb;hb=HEAD>
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/air.rb;hb=HEAD>
=end
module SiSU_Air
diff --git a/lib/sisu/current/ao.rb b/lib/sisu/ao.rb
index b7878db..3e5f506 100644
--- a/lib/sisu/current/ao.rb
+++ b/lib/sisu/ao.rb
@@ -52,7 +52,7 @@
** Git
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/ao.rb;hb=HEAD>
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/ao.rb;hb=HEAD>
=end
module SiSU_AO
diff --git a/lib/sisu/current/ao_character_check.rb b/lib/sisu/ao_character_check.rb
index 9d91baa..7cd8f17 100644
--- a/lib/sisu/current/ao_character_check.rb
+++ b/lib/sisu/ao_character_check.rb
@@ -51,7 +51,7 @@
** Git
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/ao_character_check.rb;hb=HEAD>
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/ao_character_check.rb;hb=HEAD>
=end
module SiSU_AO_CharacterCheck
diff --git a/lib/sisu/develop/ao_composite.rb b/lib/sisu/ao_composite.rb
index 8a59f06..d110e52 100644
--- a/lib/sisu/develop/ao_composite.rb
+++ b/lib/sisu/ao_composite.rb
@@ -52,7 +52,7 @@
** Git
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/develop/ao_composite.rb;hb=HEAD>
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/ao_composite.rb;hb=HEAD>
=end
module SiSU_Assemble
diff --git a/lib/sisu/current/ao_doc_objects.rb b/lib/sisu/ao_doc_objects.rb
index a4b2fa8..6cb824e 100644
--- a/lib/sisu/current/ao_doc_objects.rb
+++ b/lib/sisu/ao_doc_objects.rb
@@ -51,7 +51,7 @@
** Git
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/ao_doc_objects.rb;hb=HEAD>
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/ao_doc_objects.rb;hb=HEAD>
=end
module SiSU_AO_DocumentStructure
diff --git a/lib/sisu/current/ao_doc_str.rb b/lib/sisu/ao_doc_str.rb
index fba1724..9da488b 100644
--- a/lib/sisu/current/ao_doc_str.rb
+++ b/lib/sisu/ao_doc_str.rb
@@ -51,7 +51,7 @@
** Git
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/ao_doc_str.rb;hb=HEAD>
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/ao_doc_str.rb;hb=HEAD>
=end
module SiSU_AO_DocumentStructureExtract
diff --git a/lib/sisu/current/ao_endnotes.rb b/lib/sisu/ao_endnotes.rb
index 508d798..bcb09e1 100644
--- a/lib/sisu/current/ao_endnotes.rb
+++ b/lib/sisu/ao_endnotes.rb
@@ -51,7 +51,7 @@
** Git
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/ao_doc_endnotes.rb;hb=HEAD>
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/ao_doc_endnotes.rb;hb=HEAD>
=end
module SiSU_AO_Endnotes
diff --git a/lib/sisu/current/ao_expand_insertions.rb b/lib/sisu/ao_expand_insertions.rb
index 3d4ea8c..2d93f93 100644
--- a/lib/sisu/current/ao_expand_insertions.rb
+++ b/lib/sisu/ao_expand_insertions.rb
@@ -51,7 +51,7 @@
** Git
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/ao_expand_insertions.rb;hb=HEAD>
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/ao_expand_insertions.rb;hb=HEAD>
=end
module SiSU_AO_Insertions
diff --git a/lib/sisu/develop/ao_hash_digest.rb b/lib/sisu/ao_hash_digest.rb
index 39f34f8..ccfd156 100644
--- a/lib/sisu/develop/ao_hash_digest.rb
+++ b/lib/sisu/ao_hash_digest.rb
@@ -51,7 +51,7 @@
** Git
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/develop/ao_hash_digest.rb;hb=HEAD>
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/ao_hash_digest.rb;hb=HEAD>
=end
module SiSU_AO_Hash
diff --git a/lib/sisu/current/ao_idx.rb b/lib/sisu/ao_idx.rb
index defad2c..494b939 100644
--- a/lib/sisu/current/ao_idx.rb
+++ b/lib/sisu/ao_idx.rb
@@ -51,7 +51,7 @@
** Git
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/ao_idx.rb;hb=HEAD>
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/ao_idx.rb;hb=HEAD>
=end
module SiSU_AO_BookIndex
diff --git a/lib/sisu/develop/ao_images.rb b/lib/sisu/ao_images.rb
index f6ef8e1..06aec13 100644
--- a/lib/sisu/develop/ao_images.rb
+++ b/lib/sisu/ao_images.rb
@@ -51,7 +51,7 @@
** Git
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/develop/ao_images.rb;hb=HEAD>
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/ao_images.rb;hb=HEAD>
=end
module SiSU_AO_Images
diff --git a/lib/sisu/develop/ao_metadata.rb b/lib/sisu/ao_metadata.rb
index 9574321..1a9418c 100644
--- a/lib/sisu/develop/ao_metadata.rb
+++ b/lib/sisu/ao_metadata.rb
@@ -51,7 +51,7 @@
** Git
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/develop/ao_metadata.rb;hb=HEAD>
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/ao_metadata.rb;hb=HEAD>
=end
module SiSU_AO_Metadata
diff --git a/lib/sisu/develop/ao_misc_arrange.rb b/lib/sisu/ao_misc_arrange.rb
index 8f8fe36..da54bb8 100644
--- a/lib/sisu/develop/ao_misc_arrange.rb
+++ b/lib/sisu/ao_misc_arrange.rb
@@ -51,7 +51,7 @@
** Git
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/develop/ao_misc_arrange.rb;hb=HEAD>
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/ao_misc_arrange.rb;hb=HEAD>
=end
module SiSU_AO_MiscArrangeText
diff --git a/lib/sisu/current/ao_numbering.rb b/lib/sisu/ao_numbering.rb
index 861bbf0..fdf5460 100644
--- a/lib/sisu/current/ao_numbering.rb
+++ b/lib/sisu/ao_numbering.rb
@@ -51,7 +51,7 @@
** Git
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/ao_numbering.rb;hb=HEAD>
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/ao_numbering.rb;hb=HEAD>
=end
module SiSU_AO_Numbering
diff --git a/lib/sisu/current/ao_persist.rb b/lib/sisu/ao_persist.rb
index 72126c9..6111cc4 100644
--- a/lib/sisu/current/ao_persist.rb
+++ b/lib/sisu/ao_persist.rb
@@ -51,7 +51,7 @@
** Git
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/ao_persist.rb;hb=HEAD>
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/ao_persist.rb;hb=HEAD>
=end
module SiSU_AO_Persist
diff --git a/lib/sisu/develop/ao_references.rb b/lib/sisu/ao_references.rb
index 5ef94c6..cd410f7 100644
--- a/lib/sisu/develop/ao_references.rb
+++ b/lib/sisu/ao_references.rb
@@ -51,7 +51,7 @@
** Git
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/develop/ao_references.rb;hb=HEAD>
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/ao_references.rb;hb=HEAD>
=end
module SiSU_AO_References
diff --git a/lib/sisu/develop/ao_syntax.rb b/lib/sisu/ao_syntax.rb
index 4632fb2..010e928 100644
--- a/lib/sisu/develop/ao_syntax.rb
+++ b/lib/sisu/ao_syntax.rb
@@ -51,7 +51,7 @@
** Git
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/develop/ao_syntax.rb;hb=HEAD>
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/ao_syntax.rb;hb=HEAD>
=end
module SiSU_AO_Syntax
diff --git a/lib/sisu/develop/cgi.rb b/lib/sisu/cgi.rb
index 23df361..6d8d8e0 100644
--- a/lib/sisu/develop/cgi.rb
+++ b/lib/sisu/cgi.rb
@@ -51,7 +51,7 @@
** Git
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/develop/cgi.rb;hb=HEAD>
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/cgi.rb;hb=HEAD>
=end
module SiSU_CGI #% database building documents
diff --git a/lib/sisu/current/cgi_pgsql.rb b/lib/sisu/cgi_pgsql.rb
index 9a4c555..0011d18 100644
--- a/lib/sisu/current/cgi_pgsql.rb
+++ b/lib/sisu/cgi_pgsql.rb
@@ -51,7 +51,7 @@
** Git
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/cgi_pgsql.rb;hb=HEAD>
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/cgi_pgsql.rb;hb=HEAD>
=end
module SiSU_CGI_PgSQL #% database building documents
diff --git a/lib/sisu/current/cgi_sql_common.rb b/lib/sisu/cgi_sql_common.rb
index 62bec04..2d599bf 100644
--- a/lib/sisu/current/cgi_sql_common.rb
+++ b/lib/sisu/cgi_sql_common.rb
@@ -51,7 +51,7 @@
** Git
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/cgi_sql_common.rb;hb=HEAD>
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/cgi_sql_common.rb;hb=HEAD>
=end
module SiSU_CGI_SQL
diff --git a/lib/sisu/develop/cgi_sqlite.rb b/lib/sisu/cgi_sqlite.rb
index 7b3a5b0..6668028 100644
--- a/lib/sisu/develop/cgi_sqlite.rb
+++ b/lib/sisu/cgi_sqlite.rb
@@ -51,7 +51,7 @@
** Git
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/develop/cgi_sql_sqlite.rb;hb=HEAD>
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/cgi_sql_sqlite.rb;hb=HEAD>
=end
module SiSU_CGI_SQLite #% database building documents
diff --git a/lib/sisu/current/conf.rb b/lib/sisu/conf.rb
index 2bc71ce..009dd71 100644
--- a/lib/sisu/current/conf.rb
+++ b/lib/sisu/conf.rb
@@ -51,7 +51,7 @@
** Git
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/conf.rb;hb=HEAD>
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/conf.rb;hb=HEAD>
=end
module SiSU_Initialize
diff --git a/lib/sisu/current/constants.rb b/lib/sisu/constants.rb
index 175c2e7..d6978a0 100644
--- a/lib/sisu/current/constants.rb
+++ b/lib/sisu/constants.rb
@@ -51,7 +51,7 @@
** Git
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/constants.rb;hb=HEAD>
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/constants.rb;hb=HEAD>
=end
#Ax,Xx,Mx,Rx,Hx,Dx,Px,Ep,Db,Gt,Tex=Array.new(11){{}}
@@ -271,8 +271,8 @@ else
}
end
Db={
- name_prefix: "SiSU#{SiSU_is.branch_version?}c_",
- name_prefix_db: "sisu_#{SiSU_is.branch_version?}c_",
+ name_prefix: "SiSU#{SiSU_is.version_major?}a_",
+ name_prefix_db: "sisu_#{SiSU_is.version_major?}a_",
col_title: 800,
col_title_part: 400,
col_title_edition: 10,
diff --git a/lib/sisu/current/css.rb b/lib/sisu/css.rb
index 1832b66..80f7585 100644
--- a/lib/sisu/current/css.rb
+++ b/lib/sisu/css.rb
@@ -51,7 +51,7 @@
** Git
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/css.rb;hb=HEAD>
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/css.rb;hb=HEAD>
=end
module SiSU_Style
diff --git a/lib/sisu/current/ao_composite.rb b/lib/sisu/current/ao_composite.rb
deleted file mode 100644
index 24683cb..0000000
--- a/lib/sisu/current/ao_composite.rb
+++ /dev/null
@@ -1,286 +0,0 @@
-# encoding: utf-8
-=begin
-
-* Name: SiSU
-
-** Description: documents, structuring, processing, publishing, search
-*** composite documents, assemble/build documents from other documents
- or parts of marked up text
-
-** Author: Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
-** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
- All Rights Reserved.
-
-** License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
-** SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
-** Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
-** Git
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/ao_composite.rb;hb=HEAD>
-
-=end
-module SiSU_Assemble
- require_relative 'se' # se.rb
- require_relative 'utils_composite' # utils_composite.rb
- class RemoteImage
- def initialize
- @env=SiSU_Env::InfoEnv.new
- end
- def image(dir)
- images=[]
- images[0]=dir
- images
- end
- def download_images(images_info)
- path="#{@env.processing_path.processing}/external_document/image"
- FileUtils::mkdir_p(path) \
- unless FileTest.directory?(path)
- download_from=images_info.shift
- images_info.each do |i|
- image="#{path}/#{i}"
- imagefile=File.new(image,'w+')
- open("#{download_from}/#{i}") do |g|
- imagefile << g.read
- end
- imagefile.close
- end
- output_path="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image_external"
- FileUtils::mkdir_p(output_path) \
- unless FileTest.directory?(output_path)
- SiSU_Env::SystemCall.new("#{path}/*",output_path,'q').rsync
- end
- end
- class Composite
- include SiSU_Composite_Doc_Utils # composite doc, .ssm, extract all related insert files, array of filenames test
- def initialize(opt)
- @opt=opt
- @env=SiSU_Env::InfoEnv.new
- end
- def read
- begin
- pwd=Dir.pwd
- Dir.chdir(@opt.f_pth[:pth])
- if @opt.fno =~/\S+?\.ssm$/
- SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- 'Composite Document',
- "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}",
- ).grey_title_hi unless @opt.act[:quiet][:set]==:on
- composite_and_imported_filenames_array(@opt.fno) # composite doc, .ssm, extract all related insert files, array of filenames test
- assembled=loadfile(@opt.fno)
- write(assembled)
- end
- Dir.chdir(pwd)
- rescue
- SiSU_Errors::Rescued.new($!,$@,@opt.selections.str,@opt.fns).
- location do
- __LINE__.to_s + ':' + __FILE__
- end
- ensure
- end
- end
- def insert?(para)
- if para =~ /^<<\s+((?:https?|file):\/\/\S+?\.ss[it])$/ # and NetTest
- url($1.strip)
- elsif para =~/^<<\s+(\S+?\.ss[it])$/
- loadfilename=$1.strip
- insert_array=loadfile(loadfilename)
- file=insertion(loadfilename,insert_array)
- file[:prepared]
- else para
- end
- end
- def loadfile(loadfilename)
- begin
- if FileTest.file?(loadfilename)
- insert_array=IO.readlines(loadfilename,'')
- if loadfilename =~/\S+?\.ss[itm]$/
- if (@opt.act[:verbose][:set]==:on \
- || @opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- 'loading:',
- loadfilename,
- ).txt_grey
- end
- tuned_file=if loadfilename =~/\S+?\.ss[im]$/
- insert_array.each.map do |para|
- insert?(para)
- end
- elsif loadfilename =~/\S+?\.sst$/
- insert_array.each.map do |para|
- para
- end
- end.flatten.compact
- end
- end
- rescue
- SiSU_Errors::Rescued.new($!,$@,@opt.selections.str,@opt.fns).location do
- __LINE__.to_s + ':' + __FILE__
- end
- ensure
- end
- end
- def url(loadfilename)
- if loadfilename =~ /((?:https?|file):\/\/\S+?\.ss[it])$/ # and NetTest
- loadfilename=$1
- begin
- require 'uri'
- require 'open-uri'
- require 'pp'
- rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
- error('uri, open-uri or pp NOT FOUND (LoadError)')
- end
- insert=open(loadfilename)
- insert_array=insert.dup
- insert.close
- file=insertion(loadfilename,insert_array)
- file[:prepared]
- end
- end
- def write(assembled)
- assembled_file=File.new("#{@env.processing_path.composite_file}/#{@opt.fnb}.ssm.sst",'w+')
- assembled.each {|a| assembled_file << a }
- assembled_file.close
- end
- def download_images(download_from,images_array)
- path="#{@env.processing_path.processing}/external_document/image"
- FileUtils::mkdir_p(path) unless FileTest.directory?(path)
- images_array.each do |i|
- image="#{path}/#{i}"
- unless FileTest.exists?(image)
- imagefile=File.new(image,'w+')
- open("#{download_from}/#{i}") do |g|
- imagefile << g.read
- end
- imagefile.close
- end
- end
- end
- def insertion(fni,insert_array)
- file={ prepared: [], images: [] }
- rgx_image=/(?:^|[^_\\])\{\s*(\S+?\.(?:png|jpg|gif))/
- file[:prepared] << "\n% |#{fni}|@|^|>>ok\n\n"
- @code_flag=false
- insert_array.each do |i|
- @code_flag=if i =~/^code\{/ then true
- elsif i =~/^\}code/ then false
- else @code_flag
- end
- if not @code_flag \
- and i !~/^%+\s/
- i=i.
- gsub(/^([123]|:?[ABCD])~\? /,
- '% [conditional heading:] \1~ ') #off conditional heading (consider syntax)
- if i =~/^@\S+?:/
- i=i.gsub(/\n/m,"\n% ").
- gsub(/\n%\s+$/m,'').
- gsub(/^@\S+?:/m,"\n% [imported header:] ") #off imported headers
- end
- end
- file[:prepared] << i
- if i !~/^%+\s/ \
- and i =~rgx_image
- file[:images] << i.scan(rgx_image).uniq
- end
- end
- file[:prepared] << "\n% end import" << "\n\n"
- if file[:images].length > 0
- file[:images]=file[:images].flatten.uniq
- file[:images].delete_if {|x| x =~/https?:\/\// }
- end
- file
- end
- end
- class CompositeFileList
- def initialize(opt)
- @opt=opt
- @env=SiSU_Env::InfoEnv.new
- end
- def read
- begin
- @opt.fns=@opt.fns.gsub(/\.ssm\.sst$/,'.ssm') #FIX earlier, hub
- fns_array=IO.readlines(@opt.fns,'')
- insertions?(fns_array)
- rescue
- SiSU_Errors::Rescued.new($!,$@,@opt.selections.str,@opt.fns).location do
- __LINE__.to_s + ':' + __FILE__
- end
- ensure
- end
- end
- def insertions?(fns_array)
- tuned_file=[]
- SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- 'Composite Document',
- @opt.fno
- ).grey_title_hi unless @opt.act[:quiet][:set]==:on
- @ssm=[@opt.fns]
- fns_array.each do |para|
- if para =~/^<<\s+(\S+?\.ss[it])$/
- loadfilename=$1.strip
- if (@opt.act[:verbose][:set]==:on \
- || @opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- 'loading:',
- loadfilename,
- ).txt_grey
- end
- tuned_file << if loadfilename =~ /(?:https?|file):\/\/\S+?\.ss[it]$/
- @ssm << loadfilename
- elsif loadfilename =~ /\.ss[it]$/ \
- and FileTest.file?(loadfilename)
- @ssm << loadfilename
- else
- STDERR.puts %{SKIPPED processing file: [#{@opt.lng}] "#{@opt.fns}" it requires an invalid or non-existent file: "#{loadfilename}"}
- $process_document = :skip; break #remove this line to continue processing documents that have missing include files
- para
- end
- end
- end
- @ssm
- end
- end
-end
-__END__
diff --git a/lib/sisu/current/ao_hash_digest.rb b/lib/sisu/current/ao_hash_digest.rb
deleted file mode 100644
index 0864989..0000000
--- a/lib/sisu/current/ao_hash_digest.rb
+++ /dev/null
@@ -1,174 +0,0 @@
-# encoding: utf-8
-=begin
-
-* Name: SiSU
-
-** Description: documents, structuring, processing, publishing, search
-*** system environment, resource control and configuration details
-
-** Author: Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
-** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
- All Rights Reserved.
-
-** License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
-** SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
-** Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
-** Git
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/ao_hash_digest.rb;hb=HEAD>
-
-=end
-module SiSU_AO_Hash
- require_relative 'shared_markup_alt.rb' #shared_markup_alt.rb
- class ObjectDigest
- def initialize(md,data,env=nil)
- @md,@data,@env=md,data,env
- @env ||=SiSU_Env::InfoEnv.new(@md.fns,@md)
- end
- def object_digest
- # 1. clean/stripped text without any markup, paragraph, headings etc. without endnotes
- # 2. endnotes clean/stripped text digest only (there may be several endnotes within a paragraph)
- # 3. whole object, text with markup and any endnotes, (question: with or without the endnote digests??? presumption better without, [however may be easier to check with?])
- # [digests should not include other digests]
- data=@data.compact
- @tuned_file=[]
- sha_ =@env.digest(@md.opt).type
- begin
- sha_ ? (require 'digest/sha2') : (require 'digest/md5')
- rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error(sha_ + ' NOT FOUND')
- end
- data.each do |t_o|
- unless t_o.obj.is_a?(Array)
- t_o.obj=t_o.obj.strip
- end
- if (t_o.of !=:structure \
- && t_o.of !=:comment \
- && t_o.of !=:layout) \
- && t_o.ocn.is_a?(Fixnum)
- case sha_
- when :sha512
- for hash_class in [ Digest::SHA512 ]
- @tuned_file << stamped(t_o,hash_class)
- end
- when :sha256
- for hash_class in [ Digest::SHA256 ]
- @tuned_file << stamped(t_o,hash_class)
- end
- when :md5
- for hash_class in [ Digest::MD5 ]
- @tuned_file << stamped(t_o,hash_class)
- end
- end
- else @tuned_file << t_o unless t_o.nil?
- end
- end
- @tuned_file=@tuned_file.flatten
- #use md5 or to create hash of each ao object including ocn, & add into to each ao object
- end
- def endnote_digest(data)
- data.each.map do |en_plus|
- case en_plus
- when /#{Mx[:en_a_o]}|#{Mx[:en_b_o]}/
- if en_plus =~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/
- t_o_txt,en_open,en_txt,en_close=
- /(.*?)(#{Mx[:en_a_o]}|#{Mx[:en_b_o]})(.+?)(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m.
- match(en_plus)[1..4]
- stripped_en=SiSU_TextRepresentation::Alter.new(en_txt).strip_clean_of_markup
- digest_en_strip=case @env.digest(@md.opt).type
- when :sha512
- Digest::SHA512.hexdigest(stripped_en)
- when :sha256
- Digest::SHA256.hexdigest(stripped_en)
- when :md5
- Digest::MD5.hexdigest(stripped_en)
- else
- Digest::SHA256.hexdigest(stripped_en)
- end
- t_o_txt +
- en_open +
- en_txt +
- Mx[:id_o] +
- digest_en_strip +
- Mx[:id_c] +
- en_close
- else STDERR.puts "Error Exception - problem encountered with:\n#{en_plus}" #arbitrary exception, tidy up
- end
- else en_plus
- end
- end.join
- end
- def stamped(t_o,hash_class) #decide what hash information is most useful, is compromise necessary?
- t_o.obj=SiSU_TextRepresentation::Alter.new(t_o).strip_clean_of_extra_spaces
- #SiSU_TextRepresentation::Alter.new(t_o).strip_clean_of_markup #check
- #SiSU_TextRepresentation::Alter.new(t_o).semi_revert_markup #check
- #SiSU_TextRepresentation::ModifiedTextPlusHashDigest.new(@md,t_o).composite.dgst #check
- unless t_o.is==:code
- case t_o.obj
- when /#{Mx[:en_a_o]}[\d*+]+\s+.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}[*+]\d+\s+.+?#{Mx[:en_b_c]}/m
- en_and_t_o_digest=[]
- t_o.obj=t_o.obj.
- gsub(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m,' \1') #watch
- t_o_plus_en=t_o.obj.
- scan(/.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/m)
- t_o_tail=if t_o.obj =~/(?:.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})+([\s\S]+)/m
- /(?:.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})+.*/m.match(t_o.obj)[1]
- else ''
- end
- t_o_plus_en << t_o_tail
- en_and_t_o_digest << endnote_digest(t_o_plus_en)
- en_and_t_o_digest.join(' ')
- else #@tuned << t_o + Mx[:id_o] + digest_strip + ':' + digest_all + Mx[:id_c] unless t_o.nil?
- end
- else #@tuned << t_o + Mx[:id_o] + digest_strip + ':' + digest_all + Mx[:id_c] unless t_o.nil?
- end
- t_o #KEEP intact
- end
- def strip_clean_extra_spaces(s) # ao output tuned
- s=s.dup
- s=s.gsub(/[ ]+([,.;:?](?:$|\s))/,'\1') unless s =~/#{Mx[:en_a_o]}|#{Mx[:en_b_o]}/
- s=s.gsub(/ [ ]+/,' ').
- gsub(/^ [ ]+/,'').
- gsub(/ [ ]+$/,'').
- gsub(/((?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})')[ ]+(s )/,'\1\2').
- gsub(/((?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})')[ ]+(s )/,'\1\2')
- end
- end
-end
-__END__
diff --git a/lib/sisu/current/ao_images.rb b/lib/sisu/current/ao_images.rb
deleted file mode 100644
index 38fde81..0000000
--- a/lib/sisu/current/ao_images.rb
+++ /dev/null
@@ -1,187 +0,0 @@
-# encoding: utf-8
-=begin
-
-* Name: SiSU
-
-** Description: documents, structuring, processing, publishing, search
-*** system environment, resource control and configuration details
-
-** Author: Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
-** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
- All Rights Reserved.
-
-** License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
-** SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
-** Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
-** Git
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/ao_images.rb;hb=HEAD>
-
-=end
-module SiSU_AO_Images
- class Images
- begin
- require 'RMagick'
- include Magick
- rescue LoadError
- #SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).mark('RMagic NOT FOUND')
- end
- def initialize(md,data)
- @md,@data=md,data
- end
- def images
- data=@data
- @rmgk=false
- imagemagick_=true #imagemagick_=SiSU_Env::InfoSettings.new.program?('rmagick')
- if imagemagick_
- begin
- @rmgk=SiSU_Env::Load.new('RMagick').prog
- rescue
- @rmgk=false
- end
- else
- if (@md.opt.act[:verbose_plus][:set]==:on \
- || @md.opt.act[:maintenance][:set]==:on)
- SiSU_Screen::Ansi.new(
- @md.opt.act[:color_state][:set],
- '*WARN* use of RMagick is not enabled in sisurc.yml'
- ).warn
- end
- end
- data.select do |dob|
- unless dob.is ==:table
- dob.obj=dob.obj.strip
- if dob.obj =~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif)(?:\s*|\s+.+)?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/
- if dob.obj !~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif)\s+\d+x\d+/
- m=/#{Mx[:lnk_o]}\s*(\S+\.(?:png|jpg|gif))/
- if imagemagick_
- imgs=dob.obj.scan(m).flatten
- img_col=img_row=nil
- images=imgs.each do |image|
- dir=SiSU_Env::InfoEnv.new(@md.fns)
- path_image=[
- dir.path.image_source_include_local,
- dir.path.image_source_include_remote,
- dir.path.image_source_include
- ]
- image_path=nil
- path_image.each do |img_pth|
- image_path=img_pth
- break if FileTest.exist?("#{img_pth}/#{image}")
- end
- if FileTest.exist?("#{image_path}/#{image}")
- if @rmgk
- img=Magick::ImageList.new("#{image_path}/#{image}")
- img_col,img_row=img.columns,img.rows
- else
- if (@md.opt.act[:verbose_plus][:set]==:on \
- || @md.opt.act[:maintenance][:set]==:on)
- SiSU_Screen::Ansi.new(
- @md.opt.act[:color_state][:set],
- '*WARN* RMagick not present, will attempt to use imagemagick (identify) directly'
- ).warn
- end
- imgk=SiSU_Env::SystemCall.new.imagemagick
- gmgk=SiSU_Env::SystemCall.new.graphicsmagick
- if imgk or gmgk
- if imgk
- imgsys=`identify #{image_path}/#{image}`.strip #system call
- elsif gmgk
- imgsys=`gm identify #{image_path}/#{image}`.strip #system call
- end
- img_col,img_row=/(\d+)x(\d+)/m.match(imgsys)[1,2]
- img_col,img_row=img_col.to_i,img_row.to_i
- else
- errmsg='imagemagick or graphicsmagick are required to process images'
- if @md.opt.act[:no_stop][:set]==:on
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
- error("#{errmsg}, proceeding (as requested) without image processing")
- break
- else
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
- error("#{errmsg}, STOPPING")
- exit
- end
- end
- end
- row=((img && defined? img.rows) ? img.rows : img_row)
- col=((img && defined? img.columns) ? img.columns : img_col)
- if img_col > img_row #landscape
- if img_col> 640
- img_col=640
- img_row=((1.00*img_col/col)*row).round
- end
- else #portrait
- if img_col> 640
- img_col=640
- img_row=((1.00*img_col/col)*row).round
- end
- if img_row > 640
- img_row=640
- img_col=((1.00*img_row/row)*col).round
- end
- end
- dob.obj=dob.obj.gsub(/(#{image})/,"#{image} #{img_col}x#{img_row}")
- else
- dob.obj=dob.obj.
- gsub(/#{Mx[:lnk_o]}\s*(\S+)\.(png|jpg|gif).+?#{Mx[:lnk_c]}(#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/,
- '[ \1 (\2 missing) ]')
- end
- end
- else
- images=dob.obj.scan(m) do |image|
- SiSU_Screen::Ansi.new(
- @md.opt.act[:color_state][:set],
- '*WARN* where image dimensions have not been provided RMagick or imagemagick is required',image
- ).warn unless @md.opt.act[:quiet][:set]==:on
- end
- end
- end
- end
- if dob.obj =~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/
- dob.obj=dob.obj.gsub(/(#{Mx[:lnk_o]})\s*(\S+\.(?:png|jpg|gif))\s+/i,'\1\2 ')
- end
- end
- dob unless dob.nil?
- end
- end
- end
-end
-__END__
-imgsys=`identify #{image_path}/#{image}`.strip
diff --git a/lib/sisu/current/ao_metadata.rb b/lib/sisu/current/ao_metadata.rb
deleted file mode 100644
index 46e80a7..0000000
--- a/lib/sisu/current/ao_metadata.rb
+++ /dev/null
@@ -1,86 +0,0 @@
-# encoding: utf-8
-=begin
-
-* Name: SiSU
-
-** Description: documents, structuring, processing, publishing, search
-*** system environment, resource control and configuration details
-
-** Author: Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
-** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
- All Rights Reserved.
-
-** License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
-** SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
-** Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
-** Git
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/ao_metadata.rb;hb=HEAD>
-
-=end
-module SiSU_AO_Metadata
- class Metadata
- def initialize(md,metad)
- @md,@metadata=md,metad
- l=SiSU_Env::StandardiseLanguage.new(@md.opt.lng).language
- language=l[:n]
- @tr=SiSU_Translate::Source.new(md,language)
- end
- def make_para(obj,ocn)
- h={
- obj: obj,
- ocn: 0
- }
- SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h)
- end
- def make_heading(obj,ocn,name,lv,ln)
- h={
- lv: lv,
- ln: ln,
- name: name,
- obj: obj,
- ocn: 0
- }
- SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h)
- end
- def metadata
- end
- end
-end
-__END__
diff --git a/lib/sisu/current/ao_misc_arrange.rb b/lib/sisu/current/ao_misc_arrange.rb
deleted file mode 100644
index d023c44..0000000
--- a/lib/sisu/current/ao_misc_arrange.rb
+++ /dev/null
@@ -1,207 +0,0 @@
-# encoding: utf-8
-=begin
-
-* Name: SiSU
-
-** Description: documents, structuring, processing, publishing, search
-*** system environment, resource control and configuration details
-
-** Author: Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
-** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
- All Rights Reserved.
-
-** License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
-** SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
-** Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
-** Git
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/ao_misc_arrange.rb;hb=HEAD>
-
-=end
-module SiSU_AO_MiscArrangeText
- class SI
- def initialize(md,data)
- @md,@data=md,data
- end
- def conditional_headings(para)
- para=para.gsub(/^(:?A~)\s*$/,'\1~ @title @author'). #conditional header
- gsub(/^((?:[1-9]|:?[A-D])~\S*)\s*$/,
- '\1~ [Note: heading marker::required title missing]~#') #conditional header for incorporated document 2004w12
- if para =~/^@\S+?:/
- para=para.gsub(/^@(\S+?):(\s+|$)/,
- "#{Mx[:meta_o]}\\1#{Mx[:meta_c]}\\2").
- gsub(/^@(\S+?):([+-])(\s+|$)/,
- "#{Mx[:meta_o]}\\1\\2#{Mx[:meta_c]}\\3")
- end
- para
- end
- def markup_blocks(para)
- def ticks(para)
- block_open,block_close,text=nil,nil,nil
- if para =~/\A```[ ]+(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table).*?\n.+?\n```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*\Z/m
- @flag=:close
- block_open,text,block_close=
- /\A(```[ ]+(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table).*?)\n(.+?)\n(```([ ]+[~-][#]|\s+\~\{.+?\}\~)?)\s*\Z/m.
- match(para)[1..3]
- ((para=~/^```[ ]+table(?:~h)?\s+/) \
- and (para !~/^```[ ]+table(?:~h)?\s+c\d+/)) \
- ? para
- : (para=[]; para << block_open << text << block_close)
- elsif para =~/\A```[ ]+(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table).*?\n.*?\Z/m #look at, study
- @flag=:open
- block_open,text=/\A(```(?:[ ]+.+?))\n(.*?)\Z/m.match(para)[1,2]
- para=[]
- if not text.to_s.empty?
- para << block_open << text
- else
- para << block_open
- end
- elsif para =~/\A.+?\n```(?:\s+\~\{.+?\}\~)?(?:\s+[~-][#])?(\s*=\{.+?\})?\s*\Z/m \
- and @flag==:open
- @flag=:close
- text,block_close=
- /\A(.+?)\n(```(?:\s+\~\{.+?\}\~)?(?:\s+[~-][#])?(?:\s+=\{.+?\})?)\s*\Z/m.match(para)[1,2]
- para=[]
- if not text.to_s.empty?
- para << text.to_s << block_close
- else
- para << block_close
- end
- else para
- end
- para
- end
- def ticks_remove(para)
- unless @md.opt.act[:quiet][:set] ==:on
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
- mark("ticks not recognized, ticks removed from pargraph\n#{para}")
- end
- para=para.gsub(/```[ ]+\S+[ ]*/m,'').
- gsub(/```\s*/m,'').
- strip
- end
- def ticks_quote(para)
- @flag=:quote_open
- text=para
- para=[]
- if text =~ /```[ ]+quote/m
- para << '`:quote_open`'
- text=text.gsub(/```[ ]+quote/m,'')
- end
- text=if text =~/(?:\n|\A)=\{.+?\}/m #exclude book index from indent markup
- txt,bkidx,tail=/(.+?)((?:\n|\A)=\{.+?\}$)(.*)/m.match(text).captures
- txt=txt.gsub(/(?:\n|\A)([^`\n]+)/m,'_1 \1')
- txt + bkidx + tail
- else text.gsub(/(?:\n|\A)([^`\n]+)/m,'_1 \1')
- end
- para << text.gsub(/```/m,'')
- if text =~/```/m
- @flag=:quote_close
- para << '`:quote_close`'
- end
- para
- end
- def curly_braces(para)
- block_open,block_close,text=nil,nil,nil
- para=if para =~/\A(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table)\{ .+?\n.+?\n\}(?:code|box|poem|alt|group|block|table)(?: [~-][#])?\s*\Z/m
- block_open,text,block_close=
- /\A((?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table)\{ .+?)\n(.+?)\n(\}(?:code|box|poem|alt|group|block|table)(?: [~-][#])?)\s*\Z/m.
- match(para)[1..3]
- para=[]
- para << block_open << text << block_close
- elsif para =~/\A(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table)\{ .+?\n.+?\Z/m
- block_open,text=
- /\A((?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table)\{ .+?)\n(.+?)\Z/m.
- match(para)[1,2]
- para=[]
- if not text.to_s.empty?
- para << block_open << text
- else
- para << block_open
- end
- elsif para =~/\A.+?\n\}(?:code|box|poem|alt|group|block|table)(?: [~-][#])?\s*\Z/m
- text,block_close=
- /\A(.+?)\n(\}(?:code|box|poem|alt|group|block|table)(?: [~-][#])?)\s*\Z/m.
- match(para)[1,2]
- para=[]
- if not text.to_s.empty?
- para << text.to_s << block_close
- else
- para << block_close
- end
- else para
- end
- para
- end
- para=if (para =~/\A```[ ]+quote/m \
- and @flag !=:open) \
- or @flag==:quote_open
- ticks_quote(para)
- elsif para =~/\A```[ ]+(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table).*?\n.*?\Z/m \
- or @flag==:open
- ticks(para)
- elsif para =~/```/m
- ticks_remove(para)
- else
- para
- end
- para=if para =~/^(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table)\{|^\}(?:code|box|poem|alt|group|block|table)/m
- curly_braces(para)
- else
- para
- end
- end
- def prepare_text
- data=@data
- if data[0] =~ /^#!\s*(?:\/usr\/bin\/env sisu|\/usr\/bin\/sisu)/ # remove bang from top #! (however file is stripped, so will be removed provided no content precedes it)
- data[0]=data[0].gsub(/^#!\s*\/usr\/bin\/sisu/,'').
- gsub(/^#!\s*\/usr\/bin\/env sisu/,'')
- end
- if data[0] =~ /^(SiSU\s+[\d.]*|sisu-[\d.]+)$/ # SiSU identifier
- data[0]=data[0].gsub(/^(SiSU\s*[\d.]*)$/,'% \1').
- gsub(/^(sisu-[\d.]+)$/,'% \1')
- end
- data.each.map do |para|
- para=conditional_headings(para)
- markup_blocks(para)
- end.flatten
- end
- end
-end
-__END__
diff --git a/lib/sisu/current/ao_references.rb b/lib/sisu/current/ao_references.rb
deleted file mode 100644
index 9a5e195..0000000
--- a/lib/sisu/current/ao_references.rb
+++ /dev/null
@@ -1,502 +0,0 @@
-# encoding: utf-8
-=begin
-
-* Name: SiSU
-
-** Description: documents, structuring, processing, publishing, search
-*** system environment, resource control and configuration details
-
-** Author: Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
-** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
- All Rights Reserved.
-
-** License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
-** SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
-** Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
-** Git
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/ao_references.rb;hb=HEAD>
-
-=end
-module SiSU_AO_References
- class Bibliography
- def initialize(md,data)
- @md,@data=md,data
- end
- def sort_bibliography_array_by_author_year_title(bib)
- if bib
- bib.compact.sort_by do |c|
- [c[:author_arr][0],c[:year],c[:title]]
- end
- end
- end
- def citation_in_prepared_bibliography(cite)
- @cite=cite
- def article
- {
- is: :article,
- author_raw: nil,
- author: nil,
- author_arr: nil,
- title: nil,
- language: nil,
- journal: nil,
- volume: nil,
- editor: nil,
- year: nil,
- where: nil,
- url: nil,
- note: nil,
- short_name: nil,
- id: nil,
- }
- end
- def book
- {
- is: :book,
- author_raw: nil,
- author: nil,
- author_arr: nil,
- #editor: nil,
- title: nil,
- subtitle: nil,
- fulltitle: nil,
- language: nil,
- publisher: nil,
- edition: nil,
- year: nil,
- where: nil,
- url: nil,
- note: nil,
- short_name: nil,
- id: nil,
- }
- end
- def citation_metadata
- type=if @cite =~/^jo: \S+/m
- :article
- elsif @cite =~/^au: \S+/m
- :book
- end
- if type
- citeblock=@cite.split("\n")
- if type == :article
- citation=article
- citeblock.select do |meta|
- case meta
- when /^((?:au|author):\s+)\S+/ #req
- citation[:author_raw]=/^#{$1}(.+)/.match(meta)[1]
- when /^((?:ti|title):\s+)\S+/ #req
- citation[:title]=/^#{$1}(.+)/.match(meta)[1]
- when /^((?:lng|language):\s+)\S+/
- citation[:language]=/^#{$1}(.+)/.match(meta)[1]
- when /^((?:jo|journal):\s+)\S+/ #req?
- citation[:journal]=/^#{$1}(.+)/.match(meta)[1]
- when /^((?:vo|volume):\s+)\S+/
- citation[:volume]=/^#{$1}(.+)/.match(meta)[1]
- when /^((?:edr|editor):\s+)\S+/
- citation[:editor]=/^#{$1}(.+)/.match(meta)[1]
- when /^((?:yr|year):\s+)\S+/ #req?
- citation[:year]=/^#{$1}(.+)/.match(meta)[1]
- when /^((?:pst|publisher_state):\s+)\S+/
- citation[:where]=/^#{$1}(.+)/.match(meta)[1]
- when /^(url:\s+)\S+/
- citation[:url]=/^#{$1}(.+)/.match(meta)[1]
- when /^(note:\s+)\S+/
- citation[:note]=/^#{$1}(.+)/.match(meta)[1]
- when /^((?:sn|shortname):\s+)\S+/
- citation[:short_name]=/^#{$1}(.+)/.match(meta)[1]
- when /^(id:\s+)\S+/
- citation[:id]=/^#{$1}(.+)/.match(meta)[1]
- end
- end
- end
- if type == :book
- citation=book
- citeblock.select do |meta|
- case meta
- when /^((?:au|author):\s+)\S+/ #req
- citation[:author_raw]=/^#{$1}(.+)/.match(meta)[1]
- when /^((?:ti|title):\s+)\S+/ #req
- citation[:title]=/^#{$1}(.+)/.match(meta)[1]
- when /^((?:st|subtitle):\s+)\S+/
- citation[:subtitle]=/^#{$1}(.+)/.match(meta)[1]
- when /^((?:lng|language):\s+)\S+/
- citation[:language]=/^#{$1}(.+)/.match(meta)[1]
- when /^((?:pb|publisher):\s+)\S+/
- citation[:publisher]=/^#{$1}(.+)/.match(meta)[1]
- when /^((?:edn|edition):\s+)\S+/
- citation[:edition]=/^#{$1}(.+)/.match(meta)[1]
- when /^((?:yr|year):\s+)\S+/ #req?
- citation[:year]=/^#{$1}(.+)/.match(meta)[1]
- when /^((?:pst|publisher_state):\s+)\S+/
- citation[:where]=/^#{$1}(.+)/.match(meta)[1]
- when /^(url:\s+)\S+/
- citation[:url]=/^#{$1}(.+)/.match(meta)[1]
- when /^(note:\s+)\S+/
- citation[:note]=/^#{$1}(.+)/.match(meta)[1]
- when /^((?:sn|shortname):\s+)\S+/
- citation[:short_name]=/^#{$1}(.+)/.match(meta)[1]
- when /^(id:\s+)\S+/
- citation[:id]=/^#{$1}(.+)/.match(meta)[1]
- end
- end
- end
- if citation[:is]==:book
- if citation[:subtitle]
- citation[:fulltitle] = citation[:title] \
- + ' - ' \
- + citation[:subtitle]
- else
- citation[:fulltitle] = citation[:title]
- end
- end
- citation[:author_arr]=citation[:author_raw].split(/;\s*/)
- citation[:author]=citation[:author_arr].map do |author|
- author.gsub(/(.+?),\s+(.+)/,'\2 \1').strip
- end.join(', ').strip
- unless citation[:short_name]
- citation[:short_name]=%{#{c[:author]}, "#{c[:short_name]}" (#{c[:date]})}
- end
- end
- citation
- end
- self
- end
- def biblio_extraction
- bibliography=[]
- biblioflag=false
- code_flag=false
- flag_code_curly=:not_code_curly
- flag_code_tics=:not_code_tics
- @data=@data.select do |t_o|
- if t_o =~/^code\{/
- flag_code_curly=:code_curly
- elsif t_o =~/^\}code/
- flag_code_curly=:not_code_curly
- elsif t_o =~/^``` code/
- flag_code_tics=:code_tics
- elsif flag_code_tics ==:code_tics \
- and t_o =~/^```/
- flag_code_tics=:not_code_tics
- end
- code_flag=if flag_code_curly==:code_curly \
- or flag_code_tics==:code_tics
- true
- else false
- end
- unless code_flag
- if @md.flag_auto_biblio
- if t_o =~/^1~biblio(?:graphy)?/
- biblioflag = true
- t_o
- elsif t_o =~/^:?[B-D1]~/
- biblioflag = false
- t_o
- elsif biblioflag
- if t_o !~/\A%+ /
- bibliography << citation_in_prepared_bibliography(t_o).citation_metadata
- next
- else
- t_o
- end
- else t_o
- end
- elsif @md.flag_biblio
- if t_o =~/^1~biblio(?:graphy)?/
- biblioflag = true
- next
- elsif t_o =~/^:?[B-D]~/
- next
- elsif t_o =~/^:?[B-D1]~/
- biblioflag = false
- t_o
- elsif biblioflag
- if t_o !~/\A%+ /
- bibliography << t_o
- next
- else
- t_o
- end
- else t_o
- end
- else t_o
- end
- else t_o
- end
- end.compact
- if @md.flag_auto_biblio \
- and bibliography.length > 0
- data_new=[]
- bibliography=sort_bibliography_array_by_author_year_title(bibliography)
- @data.select do |t_o|
- if t_o =~/^1~biblio(?:graphy)?/
- bibliography.each do |c|
- if c[:is]==:book
- <<-WOK
-
-!_ #{c[:author]}
-/{"#{c[:fulltitle]}"}/ #{c[:publisher]} (#{c[:year]})
- WOK
- elsif c[:is]==:article
- <<-WOK
-
-!_ #{c[:author]}
-/{"#{c[:title]}"}/ #{c[:journal]} (#{c[:year]})
- WOK
- end
- end
- else data_new << t_o
- end
- end
- @data=data_new
- end
- [@data,bibliography]
- end
- end
- class Citations
- def initialize(md='',data='')
- @md,@data=md,data
- #@biblio=[]
- end
- def songsheet
- tuned_file,citations=citations_scan(@data)
- [tuned_file,citations]
- end
- def sort_bibliography_array_by_author_year(bib)
- bib.sort_by do |c|
- [c[:author_raw],c[:year]]
- #[c[:author_arr][0],c[:year],c[:title]]
- end
- end
- def citations_regex
- def pages_pattern
- %r{(?:[,.:]?\s+(?:p{1,2}\.?\s+)?(?:\d+--?\d+)[,.]?\s+)?}
- end
- def editor_pattern
- %r{(?<editor>(?:editor|edited by)\s+.+?)}
- end
- def year_pattern
- %r{[(\[]?(?<year>\d{4})[\])]?[.,]?}
- end
- def authors_year_title_publication_editor_pages
- /(?<authors>.+?)\s+#{year_pattern}\s+"(?<title>.+?)"\s+(?:#{Mx[:fa_italics_o]}|#{Mx[:srcrgx_italics_o]})(?<publication>.+?)(?:#{Mx[:fa_italics_c]}|#{Mx[:srcrgx_italics_c]})\s+#{editor_pattern}#{pages_pattern}/m # note ed. is usually edition rather than editor
- end
- def authors_title_publication_year_editor_pages
- /(?<authors>.+?)\s+"(?<title>.+?)"\s+(?:#{Mx[:fa_italics_o]}|#{Mx[:srcrgx_italics_o]})(?<publication>.+?)(?:#{Mx[:fa_italics_c]}|#{Mx[:srcrgx_italics_c]})\s+#{year_pattern}\s+#{editor_pattern}#{pages_pattern}/m # note ed. is usually edition rather than editor
- end
- def authors_title_publication_editor_year_pages ###
- /(?<authors>.+?)\s+"(?<title>.+?)"\s+(?:#{Mx[:fa_italics_o]}|#{Mx[:srcrgx_italics_o]})(?<publication>.+?)(?:#{Mx[:fa_italics_c]}|#{Mx[:srcrgx_italics_c]})\s+ed.\s+#{editor_pattern}#{year_pattern}#{pages_pattern}/m
- # note ed. is usually edition rather than editor
- end
- def authors_title_publication_editor_pages_year ###
- /(?<authors>.+?)\s+"(?<title>.+?)"\s+(?:#{Mx[:fa_italics_o]}|#{Mx[:srcrgx_italics_o]})(?<publication>.+?)(?:#{Mx[:fa_italics_c]}|#{Mx[:srcrgx_italics_c]})\s+#{editor_pattern}#{pages_pattern}#{year_pattern}/m # note ed. is usually edition rather than editor
- end
- def authors_year_title_publication_pages
- /(?<authors>.+?)\s+#{year_pattern}\s+"(?<title>.+?)"\s+(?:#{Mx[:fa_italics_o]}|#{Mx[:srcrgx_italics_o]})(?<publication>.+?)(?:#{Mx[:fa_italics_c]}|#{Mx[:srcrgx_italics_c]})[,.;]?#{pages_pattern}/m
- end
- def authors_title_publication_year_pages
- /(?<authors>.+?)\s+"(?<title>.+?)"\s+(?:#{Mx[:fa_italics_o]}|#{Mx[:srcrgx_italics_o]})(?<publication>.+?)(?:#{Mx[:fa_italics_c]}|#{Mx[:srcrgx_italics_c]})\s+#{year_pattern}\s+#{pages_pattern}/m
- end
- def authors_title_publication_pages_year ###
- /(?<authors>.+?)\s+"(?<title>.+?)"\s+(?:#{Mx[:fa_italics_o]}|#{Mx[:srcrgx_italics_o]})(?<publication>.+?)(?:#{Mx[:fa_italics_c]}|#{Mx[:srcrgx_italics_c]})#{pages_pattern}#{year_pattern}/m
- end
- def authors_year_publication_pages
- /(?<authors>.+?)\s+#{year_pattern}\s+(?:#{Mx[:fa_italics_o]}|#{Mx[:srcrgx_italics_o]})(?<publication>.+?)(?:#{Mx[:fa_italics_c]}|#{Mx[:srcrgx_italics_c]})#{pages_pattern}/m
- end
- def authors_publication_year_pages
- /(?<authors>.+?)\s+(?:#{Mx[:fa_italics_o]}|#{Mx[:srcrgx_italics_o]})(?<publication>.+?)(?:#{Mx[:fa_italics_c]}|#{Mx[:srcrgx_italics_c]})[,.;]?\s+(?<publisher>.+?)?#{year_pattern}#{pages_pattern}[.;]?/m
- end
- self
- end
- def authors?(citations)
- citations.each.map do |b|
- if b =~ /^.+\s+::.+?:$/
- c=/^(?<citation>.+?)\s+::(?<shortref>.+?):$/.match(b)
- {
- citation: c[:citation],
- shortref: c[:shortref],
- c[:shortref].to_s => c[:citation]
- }
- else { citation: b }
- end
- end
- end
- def long_and_short_ref?(citations) #could be useful, keep ... ectract shortref
- citations.each.map do |b|
- if b =~ /^.+\s+::.+?:$/
- c=/^(?<citation>.+?)\s+::(?<shortref>.+?):$/.match(b)
- {
- citation: c[:citation],
- shortref: c[:shortref],
- c[:shortref].to_s => c[:citation]
- }
- else { citation: b }
- end
- end
- end
- def citation_detail(citations) #could be useful, keep ... extract shortref
- bibahash=[]
- number=0
- missed=0
- citations.select do |b|
- z=if b =~citations_regex.authors_year_title_publication_editor_pages
- c=citations_regex.authors_year_title_publication_editor_pages.match(b)
- {
- is: :article,
- author_raw: c[:authors],
- year: c[:year],
- title: c[:title],
- publication: c[:publication],
- editor: c[:editor],
- }
- elsif b =~citations_regex.authors_title_publication_year_editor_pages
- c=citations_regex.authors_title_publication_year_editor_pages.match(b)
- {
- is: :article,
- author_raw: c[:authors],
- year: c[:year],
- title: c[:title],
- publication: c[:publication],
- editor: c[:editor],
- }
- elsif b =~citations_regex.authors_title_publication_editor_year_pages
- c=citations_regex.authors_title_publication_editor_year_pages.match(b)
- {
- is: :article,
- author_raw: c[:authors],
- year: c[:year],
- title: c[:title],
- publication: c[:publication],
- editor: c[:editor],
- }
- elsif b =~citations_regex.authors_title_publication_editor_pages_year
- c=citations_regex.authors_title_publication_editor_pages_year.match(b)
- {
- is: :article,
- author_raw: c[:authors],
- year: c[:year],
- title: c[:title],
- publication: c[:publication],
- editor: c[:editor],
- }
- elsif b =~citations_regex.authors_year_title_publication_pages
- c=citations_regex.authors_year_title_publication_pages.match(b)
- {
- is: :article,
- author_raw: c[:authors],
- year: c[:year],
- title: c[:title],
- publication: c[:publication],
- }
- elsif b =~citations_regex.authors_title_publication_year_pages
- c=citations_regex.authors_title_publication_year_pages.match(b)
- {
- is: :article,
- author_raw: c[:authors],
- year: c[:year],
- title: c[:title],
- publication: c[:publication],
- }
- elsif b =~citations_regex.authors_year_publication_pages
- c=citations_regex.authors_year_publication_pages.match(b)
- {
- is: :book,
- author_raw: c[:authors],
- year: c[:year],
- publication: c[:publication],
- }
- elsif b =~citations_regex.authors_publication_year_pages
- c=citations_regex.authors_publication_year_pages.match(b)
- {
- is: :book,
- author_raw: c[:authors],
- year: c[:year],
- publication: c[:publication],
- }
- else b
- end
- if not z.is_a?(NilClass) \
- and z.is_a?(Hash) \
- and z[:author_raw].length > 0
- z[:author_arr]=z[:author_raw].split(/;\s*/)
- z[:author]=z[:author_arr].map do |author|
- author.gsub(/(.+?),\s+(.+)/,'\2 \1').strip
- end.join(', ').strip
- if @md.opt.act[:verbose_plus][:set]==:on \
- || @md.opt.act[:maintenance][:set]==:on
- number +=1 if z.is_a?(Hash)
- missed +=1 if z.is_a?(String)
- (z.is_a?(Hash)) \
- ? (p '[' + number.to_s + '] ' + z.to_s)
- : (p '<' + missed.to_s + '> ' + z.to_s)
- end
- end
- bibahash << z if z.is_a?(Hash)
- end
- bibahash=sort_bibliography_array_by_author_year(bibahash.compact)
- bibahash
- end
- def citations_scan(data)
- citations=[]
- #short_ref=[]
- tuned_file = data.compact.select do |dob|
- if dob.is !=:meta \
- && dob.is !=:comment \
- && dob.is !=:code \
- && dob.is !=:table
- if dob.obj =~/\.:.+?:\./
- citations << dob.obj.scan(/\.:\s*(.+?)\s*:\./m)
- #short_ref << dob.obj.scan(/\.:\s+(.+?)\s+::([^:]+)::\./m) #look at later
- ##short_ref << dob.obj.scan(/\.:\s+(.+?)\s+::(.+?)::\./m) #look at later
- #short_ref << dob.obj.scan(/\.:\s*(.+?)\s*(::(.+?):)?:\./m) #look at later
- citations=citations.flatten.compact
- dob.obj=dob.obj. #remove citations delimiter & helpers from text
- gsub(/\.:|:\./,'')
- end
- end
- dob if dob.is_a?(Object)
- end
- #bib=long_and_short_ref?(citations) #could be useful, keep ... extract shortref
- citations=citation_detail(citations)
- [tuned_file,citations]
- end
- end
-end
-__END__
diff --git a/lib/sisu/current/ao_syntax.rb b/lib/sisu/current/ao_syntax.rb
deleted file mode 100644
index c310866..0000000
--- a/lib/sisu/current/ao_syntax.rb
+++ /dev/null
@@ -1,640 +0,0 @@
-# encoding: utf-8
-=begin
-
-* Name: SiSU
-
-** Description: documents, structuring, processing, publishing, search
-*** Syntax for markup, input markup syntaxes, determined here
-
-** Author: Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
-** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
- All Rights Reserved.
-
-** License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
-** SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
-** Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
-** Git
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/ao_syntax.rb;hb=HEAD>
-
-=end
-module SiSU_AO_Syntax
- class Words
- def initialize(line,md,mkp)
- @line,@md,@mkp=line,md,mkp
- end
- end
- class Markup
- def initialize(md='',data='',biblio=[])
- @md,@data,@bibliography=md,data,biblio
- @data_new=[]
- url_and_stub=SiSU_Env::InfoEnv.new.url
- @output_url="#{url_and_stub.remote}"
- @env=SiSU_Env::InfoEnv.new
- emph_set=if defined? @md.emphasis_set_to \
- and not @md.emphasis_set_to.nil?
- @md.emphasis_set_to
- else @env.markup_emphasis
- end
- @emph=case emph_set
- 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(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|block|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\b|[.,;:?!'")]|~\^|~\\\{\s|$)}
- tail_m_bold=%{(?:(?:#{Mx[:fa_italics_c]})?(?:\s|'s\b|[.,;:?!'")]|~\^|~\\\{\s|$))?}
- bold_line=%{^!_\s.+?(?:#{Mx[:br_line]}|\n|$)}
- #ital_line=%{^/_\s.+?(?:#{Mx[:br_line]}|\n|$)} #not implemented
- @line_scan_ital=if defined? @md.italics_match_list[:str]
- /#{@http_m}|#{bold_line}|#{@manmkp_ital}#{tail_m_ital}|#{@md.italics_match_list[:str]}#{tail_m_ital}|\S+|\n/i
- 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.bold_match_list[:str] \
- and @md.bold_match_list[:str]
- /#{@http_m}|#{bold_line}|(?:#{@manmkp_bold}|#{@md.bold_match_list[:str]})#{tail_m_bold}|\S+|\n/i
- end
- end
- def songsheet
- @data=@data.compact
- @data.each do |dob|
- dob=breaks(dob)
- dob=if @md.sem_tag then sem(dob) else dob end #revisit
- dob=line_actions(dob)
- dob=paragraph_set(dob)
- dob=substitutions(dob)
- 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 \
- && dob.is !=:comment \
- && dob.is !=:code \
- && dob.is !=:table
- dob.obj=dob.obj.
- gsub(/^-\\\\-\s*$/,"#{Mx[:br_page]}").
- gsub(/^=\\\\=\s*$/,"#{Mx[:br_page_new]}").
- gsub(/ \\\\(?: |$)/,"#{Mx[:br_line]}").
- gsub(/(?:<:?pb>)/,"#{Mx[:br_page]}"). # depreciated
- gsub(/(?:<:?pn>)/,"#{Mx[:br_page_new]}"). # depreciated
- gsub(/(?:<:?br>|<br \/>)/,"#{Mx[:br_line]}"). # depreciated
- gsub(/(?:^-\.\.-\s*$)/,"#{Mx[:br_page_line]}")
- end
- dob
- end
- def wordlist_italics(dob)
- dob=dob.dup
- if (defined? @md.italics_match_list[:str] \
- and @md.italics_match_list[:str])
- dob.obj=if dob.is !=:meta \
- && dob.is !=:heading \
- && dob.is !=:heading_insert \
- && dob.is !=:code \
- && dob.is !=:layout \
- && dob.is !=:comment
- word=dob.obj.scan(@line_scan_ital)
- word=word.flatten.compact
- line_array=[]
- word.each do |w|
- unless /#{@manmkp_ital}|#{@http_m}/.match(w)
- if defined? @md.italics_match_list[:regx] \
- and @md.italics_match_list[:regx]
- w=w.gsub(@md.italics_match_list[:regx],
- "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}")
- else w
- end
- end
- line_array << w
- end
- line_array.join(' ')
- else dob.obj
- end
- end
- dob
- end
- def embolden(given)
- given=given.
- gsub(/^!_\s+((?:\{|#{Mx[:lnk_o]})(?:~^ )?.+?(?:\}|#{Mx[:lnk_o]})https?:\/\/\S+.*?)([#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/,
- "#{Mx[:fa_bold_o]} \\1 #{Mx[:fa_bold_c]}\\2").
- gsub(/^!_\s+((?:\{|#{Mx[:lnk_o]})(?:~^ )?.+?(?:\}|#{Mx[:lnk_o]})https?:\/\/\S+.*)/,
- "#{Mx[:fa_bold_o]} \\1 #{Mx[:fa_bold_c]}").
- gsub(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)([#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/,
- "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2").
- gsub(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)\s+((?:[*]~\S+\s*)+)/,
- "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2").
- gsub(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)\s*([~-]#)$/,
- "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2").
- gsub(/(?:^!_\s+|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]}\s*)(.*)?\s*$/,
- "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}")
- end
- def italicise(given)
- given=given.
- gsub(/^\/_\s*(.+?)([#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/,
- "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2").
- gsub(/^\/_\s*(.+?)\s+((?:[*]~\S+\s*)+)/,
- "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2").
- gsub(/^\/_\s*(.+?)\s*([~-]#)$/,
- "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2").
- gsub(/^\/_\s+(.*)?\s*$/,
- "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}")
- end
- def line_actions(dob)
- dob.obj=if (dob.is !=:heading \
- && dob.is !=:heading_insert \
- && dob.is !=:comment \
- && dob.is !=:meta) \
- and dob.obj =~ /^!_\s+/
- embolden(dob.obj)
- elsif dob.obj =~ /^\/_\s+/
- italicise(dob.obj)
- else dob.obj
- end
- dob
- end
- def paragraph_set(dob)
- dob.obj=if dob.is !=:meta \
- && dob.is !=:heading \
- && dob.is !=:heading_insert \
- && dob.is !=:code \
- && dob.is !=:comment \
- && dob.is !=:table
- dob.obj.gsub(/\n/m,' ').
- gsub(/ \s+/m,' ')
- else dob.obj
- end
- dob
- end
- def substitutions(dob)
- dob=dob.dup
- dob=if @md.flag_auto_biblio \
- and @bibliography.length > 0
- dob=if dob.is !=:meta \
- && dob.is !=:heading_insert \
- && dob.is !=:code \
- && dob.is !=:comment \
- && dob.is !=:table
- @bibliography.each do |c|
- if c[:id] and not c[:id].nil? and not c[:id].empty?
- dob.obj=dob.obj.gsub(/#{c[:id]}/mi,c[:short_name])
- end
- end
- dob
- else dob
- end
- dob
- else dob
- end
- dob=if defined? @md.substitution_match_list[:match_and_replace] \
- and @md.substitution_match_list[:match_and_replace].is_a?(Array)
- dob=if dob.is !=:meta \
- && dob.is !=:heading_insert \
- && dob.is !=:code \
- && dob.is !=:comment \
- && dob.is !=:table
- if dob.obj =~/#{@md.substitution_match_list[:matches]}/
- @md.substitution_match_list[:match_and_replace].each do |x|
- dob.obj=if x[:case_s]==:i
- dob.obj.gsub(/#{x[:match]}/mi,x[:replace])
- else
- dob.obj.gsub(/#{x[:match]}/m,x[:replace])
- end
- end
- end
- dob
- else dob
- end
- dob
- else dob
- end
- end
- def wordlist_bold(dob)
- dob=dob.dup
- if (defined? @md.bold_match_list[:str] \
- and @md.bold_match_list[:str])
- dob.obj=if dob.is !=:meta \
- && dob.is !=:heading \
- && dob.is !=:heading_insert \
- && dob.is !=:code \
- && dob.is !=:comment \
- && dob.is !=:table
- line_array=[]
- word=dob.obj.scan(@line_scan_bold)
- word=word.flatten.compact
- word.each do |w|
- unless /#{@manmkp_bold}|#{@http_m}/.match(w)
- if defined? @md.bold_match_list[:regx] \
- and @md.bold_match_list[:regx] #document header: @bold: [bold word list]
- w=w.gsub(@md.bold_match_list[:regx],
- "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}")
- end
- else
- w=if w =~ /(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s+/
- embolden(w) #bold paragraph/emphasize #may wish to remove think about 7{ 8{ conversion not satisfactory, as information is lost!
- elsif w =~/^\/_\s+/
- italicise(w)
- else w
- end
- end
- line_array << w
- end
- line_array.join(' ')
- else dob.obj
- end
- else
- dob.obj=if dob.is==:heading \
- and dob.ln.to_s =~/[7-9]/
- embolden(dob.obj)
- else dob.obj
- end
- end
- dob
- end
- def fontface_lines(dob,leader)
- while (dob.obj =~/#{Mx[:br_nl]}/ \
- and dob.obj =~/(?:#{leader})([*!\/_#])\{(.+?)\}\1/m) \
- and $2 =~/#{Mx[:br_nl]}/
- dob=if dob.obj =~/#{Mx[:br_nl]}/ \
- and dob.obj =~/(#{leader})([*!\/_#])\{(.+?)\}\2/m
- lead,fce,txt=$1,$2,$3
- dob=if txt =~/#{Mx[:br_nl]}/
- lead_break=if dob.obj =~/^#{Mx[:br_nl]}/
- dob.obj=dob.obj.sub(/^#{Mx[:br_nl]}/,'')
- Mx[:br_nl]
- else ''
- end
- txt="#{lead_break}#{fce}\{" + txt.split(Mx[:br_nl]).join("\}#{fce}#{Mx[:br_nl]}#{fce}\{") + "\}#{fce}"
- dob.obj=dob.obj.
- sub(/(?:^|#{Mx[:gl_c]}|\s+|['"]|[#{Mx[:nbsp]}#{Mx[:fa_o_c]}#{Mx[:fa_c]}#{Mx[:lnk_o]}#{Mx[:br_nl]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:tc_c]}#{Mx[:tc_p]}]|[\(\[\{]|\>)([*!\/_#])\{.+?\}\1/m,
- "#{lead}#{txt}")
- dob
- else dob
- end
- end
- dob
- end
- dob
- end
- def fontface(dob)
- leader=/^|#{Mx[:gl_c]}|\s+|['"]|[#{Mx[:nbsp]}#{Mx[:fa_o_c]}#{Mx[:fa_c]}#{Mx[:lnk_o]}#{Mx[:br_nl]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:tc_c]}#{Mx[:tc_p]}]|[\(\[\{]|[、。「‹«¿¡]|\>/
- dob=fontface_lines(dob,leader)
- dob.obj=dob.obj.
- gsub(/(#{leader})\*\{(.+?)\}\*/m,
- "\\1#{@emph[:o]}\\2#{@emph[:c]}"). #emphasis
- gsub(/(#{leader})!\{(.+?)\}!/m,
- "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}"). #bold
- gsub(/(#{leader})\/\{(.+?)\}\//m,
- "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}"). #italics
- gsub(/(#{leader})_\{(.+?)\}_/m,
- "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}"). #underscore
- gsub(/(#{leader})#\{(.+?)\}#/m,
- "\\1#{Mx[:fa_monospace_o]}\\2#{Mx[:fa_monospace_c]}"). #monospace
- gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|[#{Mx[:nbsp]}#{Mx[:fa_o_c]}#{Mx[:fa_c]}]|\(|\>)\"\{(.+?)\}\"/m,
- "\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}"). #cite /blockquote?
- gsub(/(^|[^\\])\^\{(.+?)\}\^/m,
- "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}"). #superscript
- gsub(/(^|[^\\]),\{(.+?)\},/m,
- "\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}"). #subscript
- gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\+\{(.+?)\}\+/m,
- "\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}"). #inserted text
- gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)-\{(.+?)\}-/m,
- "\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}"). #strikethrough - deleted text
- gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>|\d+)\^(\S+?)\^/,
- "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") #superscript single word, watch digit added
- dob
- end
- def bodymarkup(dob)
- # << 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}~
- # !_ #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 \
- && dob.is !=:comment \
- && dob.is !=:code \
- && dob.is !=:table
- line_array=[]
- word=dob.obj.scan(/\S+|\n/) #unless line =~/^(?:#{Mx[:meta_o]}|%+\s)/ #visit
- if word
- word.each do |w| # _ - / # | : ! ^ ~
- unless w =~/~\{|\}~|~\[|\]~|^\^~|~\^|\*~\S+|~#|\{t?~|\{table|https?:\/\/\S+/ # do something earlier about table!!
- w=w.gsub(/\\?~/,"#{Mx[:gl_o]}#126#{Mx[:gl_c]}") #escaped special character
- end
- w=w.gsub(/^\<$/,
- "#{Mx[:gl_o]}#lt#{Mx[:gl_c]}").gsub(/^\>$/,"#{Mx[:gl_o]}#gt#{Mx[:gl_c]}") #escaped special character
- line_array << w
- end
- dob.obj=line_array.join(' ')
- dob.obj=dob.obj.strip
- end
- dob.obj=dob.obj.
- gsub(/^([*#.-]{1,12})$/,'\1 ~#'). #ocn off for these paragraph separators
- gsub(/~\{(.+?)\}~/m,Mx[:en_a_o] + '\1' + Mx[:en_a_c]).
- gsub(/~\[([^*+].+?)\]~/m,Mx[:en_b_o] + '* \1' + Mx[:en_b_c]). #default if markup does not specify
- gsub(/~\[(.+?)\]~/m,Mx[:en_b_o] + '\1' + Mx[:en_b_c])
- if dob.is ==:heading \
- and dob.ln ==0
- dob.obj=dob.obj.gsub(/\s*@title\b/," #{@md.title.full}")
- dob.obj=if defined? @md.creator.author \
- and @md.creator.author
- dob.obj.gsub(/\s+(?:@creator|@author)/,",#{Mx[:br_line]}#{@md.creator.author}")
- else dob.obj.gsub(/\s+(?:@creator|@author)/,'')
- end
- end
- if defined? @md.title \
- and @md.title \
- and defined? @md.title.full \
- and defined? @md.creator \
- and @md.creator
- if dob.is ==:heading
- dob.obj=dob.obj.gsub(/^\s*@title\s*$/,@md.title.full) if dob.lv =~/1/
- dob.obj=if dob.lv =~/[23]/ \
- and defined? @md.creator.author \
- and @md.creator.author
- dob.obj.
- gsub(/^\s*(?:(by\s+)?(?:@creator|@author))\s*$/,
- "\\1#{@md.creator.author}")
- else dob.obj.gsub(/^\s*(?:(by\s+)?(?:@creator|@author))\s*$/,'\1')
- end
- end
- end
- dob.obj=dob.obj.gsub(/<(https?:\/\/\S+?)>/,'< \1 >'). #catch problem markup
- gsub(/<:=(\S+?)>/,'{ c_\1.png 14x14 }image').
- gsub(/<!(\S+)!>/,'<:\1>'). #escaped special character
- gsub(/&nbsp;/,"#{Mx[:nbsp]}"). #escaped special character
- gsub(/\\~/,"#{Mx[:gl_o]}#126#{Mx[:gl_c]}"). #escaped special character
- gsub(/\\\{/,"#{Mx[:gl_o]}#123#{Mx[:gl_c]}"). #escaped special character
- gsub(/\\\}/,"#{Mx[:gl_o]}#125#{Mx[:gl_c]}"). #escaped special character
- gsub(/\\\<</,"#{Mx[:gl_o]}#lt#{Mx[:gl_c]}#{Mx[:gl_o]}#lt#{Mx[:gl_c]}"). #escaped special character
- gsub(/\\\>>/,"#{Mx[:gl_o]}#gt#{Mx[:gl_c]}#{Mx[:gl_o]}#gt#{Mx[:gl_c]}"). #escaped special character
- gsub(/\\\</,"#{Mx[:gl_o]}#lt#{Mx[:gl_c]}"). #escaped special character
- gsub(/\\\>/,"#{Mx[:gl_o]}#gt#{Mx[:gl_c]}"). #escaped special character
- gsub(/\\\_/,"#{Mx[:gl_o]}#095#{Mx[:gl_c]}"). #escaped special character
- gsub(/\\\-/,"#{Mx[:gl_o]}#045#{Mx[:gl_c]}"). #escaped special character
- gsub(/\\\+/,"#{Mx[:gl_o]}#043#{Mx[:gl_c]}"). #escaped special character
- gsub(/\\\//,"#{Mx[:gl_o]}#047#{Mx[:gl_c]}"). #escaped special character
- gsub(/\\\#/,"#{Mx[:gl_o]}#035#{Mx[:gl_c]}"). #escaped special character
- gsub(/\\\&/,"#{Mx[:gl_o]}#038#{Mx[:gl_c]}"). #&amp; #escaped special character
- gsub(/\\\|/,"#{Mx[:gl_o]}#124#{Mx[:gl_c]}"). #not really a sisu special character but made available as possibility
- gsub(/\\\:/,"#{Mx[:gl_o]}#058#{Mx[:gl_c]}"). #not really a sisu special character but made available as possibility
- gsub(/\\\!/,"#{Mx[:gl_o]}#033#{Mx[:gl_c]}"). #not really a sisu special character but made available as possibility
- gsub(/\\\^/,"#{Mx[:gl_o]}#094#{Mx[:gl_c]}"). #not really a sisu special character but made available as possibility
- gsub(/\\\,/,"#{Mx[:gl_o]}#044#{Mx[:gl_c]}"). #not really a sisu special character but made available as possibility
- gsub(/\\\\/,"#{Mx[:gl_o]}#092#{Mx[:gl_c]}"). #escaped special character
- gsub(/\\\*/,"#{Mx[:gl_o]}#042#{Mx[:gl_c]}"). #escaped special character
- gsub(/\\\!/,"#{Mx[:gl_o]}#033#{Mx[:gl_c]}") #escaped special character
- if dob.obj=~/(?:https?:|ftp:|\{([^{}]+?)\}(?:#|:|[.]{1,2}\/))\S+/m
- if dob.obj=~/(?:^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ (?:.+?)\s*\}(?:(?:https?:|ftp:|:|[.]{1,2}\/)\S+?)\s*#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/m
- dob.obj=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=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=dob.obj.
- gsub(/(^|[^#])\{\s*([^{}]+?)\s*\}((?:https?:|:|[.]{2}\/|#)\S+?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/,
- "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3"). #linked (text or image, however text cannot include modified face, e.g. bold, ital, underline)
- gsub(/(^|[#{Mx[:gl_c]}#{Mx[:lnk_c]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}(\s])((?:https?|ftp):\/\/\S+?\.[^>< ]+?)([,.;'"]?)(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m,
- %{\\1#{Mx[:url_o]}\\2#{Mx[:url_c]}\\3}).
- gsub(/#{Mx[:lnk_c]}#(\S+?[^>< ]+?)([()\[\]]*[,.;:!?'"]{0,2})(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m,
- %{#{Mx[:lnk_c]}#{Mx[:rel_o]}\\1#{Mx[:rel_c]}\\2}).
- gsub(/#{Mx[:lnk_c]}:(\S+?[^>< ]+?)([()\[\]]*[,.;:!?'"]{0,2})(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m,
- %{#{Mx[:lnk_c]}#{Mx[:rel_o]}:\\1#{Mx[:rel_c]}\\2}).
- gsub(/#{Mx[:lnk_c]}[.]{2}\/(\S+?[^>< ]+?)([()\[\]]*[,.;:!?'"]{0,2})(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m,
- %{#{Mx[:lnk_c]}#{Mx[:rel_o]}:\\1#{Mx[:rel_c]}\\2})
- end
- if dob.obj=~/_(?:https?|ftp):\S+/m # _http://url #CHECK
- dob.obj=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=dob.obj.
- gsub(/<[:e]\s+(.+?)!?>/,
- "#{Mx[:en_a_o]}\\1#{Mx[:en_a_c]}"). #not tested
- gsub(/(^|#{Mx[:br_nl]})\s*_\*\s*/,
- "\\1#{Mx[:gl_bullet]}"). #bullets, shortcut
- gsub(/=\{(.+?)\}/,
- "#{Mx[:idx_o]}\\1#{Mx[:idx_c]}").
- gsub(/^\s*_([1-9])\*\s*/,
- "#{Mx[:pa_o]}:i\\1:\\1#{Mx[:pa_c]}#{Mx[:gl_bullet]}"). #bullets, shortcut
- gsub(/^\s*_([1-9])\s+/,
- "#{Mx[:pa_o]}:i\\1:\\1#{Mx[:pa_c]}"). #indent
- gsub(/^\s*_([1-9])!\s+(.+?)\s*$/,
- "#{Mx[:pa_o]}:i\\1:\\1#{Mx[:pa_c]}#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]} "). #indent bold
- gsub(/^\s*__([1-9])\s+/,
- "#{Mx[:pa_o]}:i0:\\1#{Mx[:pa_c]}"). #hang
- gsub(/^\s*__([1-9])!\s+(.+?)\s*$/,
- "#{Mx[:pa_o]}:i0:\\1#{Mx[:pa_c]}#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]} "). #hangdef
- gsub(/^\s*_([0-9])_([0-9])\s+/,
- "#{Mx[:pa_o]}:i\\1:\\2#{Mx[:pa_c]}"). #hang
- gsub(/^\s*_([0-9])_([0-9])!\s+(.+?)\s*$/,
- "#{Mx[:pa_o]}:i\\1:\\2#{Mx[:pa_c]}#{Mx[:fa_bold_o]}\\3#{Mx[:fa_bold_c]} "). #hangdef
- gsub(/<:hi>/,"#{Mx[:fa_hilite_o]}"). #'<span style="background-color: rgb(255,240,196)">'). # bright yellow rgb(255,255,0) pale yellow rgb(255,255,200)
- gsub(/<:\/hi>/,"#{Mx[:fa_hilite_c]}"). #'</span>').
- gsub(/(#{Mx[:gr_o]}verse#{Mx[:gr_c]}.+)/m,"\\1\n").
- gsub(/[ ]+($)/,'\1').
- gsub(/\{\s*(.+?)\s*\}(https?:\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/,
- "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}#{Mx[:url_o]}\\2#{Mx[:url_c]}\\3"). #any remaining linked text or image
- gsub(/\{\s*(.+?)\s*\}(#{Mx[:url_o]}\S+?#{Mx[:url_c]})/,
- "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2"). #any remaining linked text or image
- gsub(/(^|\s)([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)/,"\\1#{Mx[:url_o]}\\2#{Mx[:url_c]}").
- gsub(/(^|[ ])\{\s*(.+?)\s*\}(\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/,
- "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3\\4"). #any remaining linked text or image
- gsub(/\{\s*(.+?)\s*\}#([a-zA-Z0-9][a-zA-Z0-9_-]*)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/,
- "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}#{Mx[:rel_o]}\\2#{Mx[:rel_c]}\\3"). #any remaining linked text or image, check need
- gsub(/\{\s*(.+?)\s*\}(#{Mx[:rel_o]}\S+?#{Mx[:rel_c]})/,
- "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2"). #any remaining linked text or image, check need
- gsub(/\{\s*(.+?)\s*\}(image)/,
- "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2") #linked image
- elsif dob.is==:table
- dob=fontface(dob)
- elsif dob.is ==:code
- dob.obj=dob.obj.
- gsub(/#{Mx[:meta_o]}(\S+?)#{Mx[:meta_c]}\s*/,'@\1: ').
- gsub(/(^|#{Mx[:gl_c]}|\s)&lt;(?:br(?: \/)?)&gt;([\s,.]|$)/,'\1<br>\2') #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=cl.gsub(Mx[:br_nl],'')
- w=3-ln.to_s.length
- cl = "#{ln}#{Mx[:nbsp]*w}#{Mx[:vline]}#{cl}#{Mx[:br_nl]}"
- ln +=1
- end
- codeline << cl
- end
- codeline= codeline.join("")
- dob.obj=codeline
- else
- dob.obj=dob.obj.gsub(/#{Mx[:gr_o]}codeline#{Mx[:gr_c]}/,"\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}~
- # +1 <!i1!>
- # +2 <!i2!>
- puts 'tech'
- @data.each do |line|
- line=line.
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)e\{(.+?)\}e/,
- "\\1#{@emph[:o]}\\2#{@emph[:c]}"). #emphasis
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)b\{(.+?)\}b/,
- "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}"). #bold
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)u\{(.+?)\}u/,
- "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}"). #underscore
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)c\{(.+?)\}c/,
- "\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}"). #cite
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)i\{(.+?)\}i/,
- "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}"). #italics
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)!\{(.+?)\}!/,
- "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}"). #bold
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)\*\{(.+?)\}\*/,
- "\\1#{@emph[:o]}\\2#{@emph[:c]}"). #emphasis
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)_\{(.+?)\}_/,
- "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}"). #underscore
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\(|\>)\/\{(.+?)\}\//,
- "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}"). #italics
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\"\{(.+?)\}\"/,
- "\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}").
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\^\{(.+?)\}\^/,
- "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}").
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)9\{(.+?)\}9/,
- "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}").
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>),\{(.+?)\},/,
- "\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}").
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)6\{(.+?)\}6/,
- "\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}").
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\+\{(.+?)\}\+/,
- "\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}").
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)v\{(.+?)\}v/,
- "\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}").
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)-\{(.+?)\}-/,
- "\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}").
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)x\{(.+?)\}x/,
- "\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}").
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\*(\S+?)\*/,
- "\\1#{@emph[:o]}\\2#{@emph[:c]}"). #emphasise single word, watch
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\!(\S+?)\!/,
- "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}"). #bold single word, watch
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\/([\(\)a-zA-Z0-9']+?)\/([ ,.;:'"~$]|[^a-zA-Z0-9])/,
- "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}\\3"). #italics single word, watch
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)_(\S+?)_/,
- "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}"). #underscore single word, watch
- gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\^(\S+?)\^/,
- "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}"). #check #superscript single word, watch digit added
- gsub(/^\s*_\([1-9]\)\(\*\+\)\s*/,
- "#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}#{Mx[:fa_o]}\\2#{Mx[:fa_c_o]}"). #bullets, shortcut
- gsub(/^\s*_\([1-9]\)\s+/,
- "#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}"). #watch
- gsub(/^\s*__\([1-9]\)\s+/,
- "#{Mx[:pa_o]}:h\\1#{Mx[:pa_c]}"). #watch
- #line.gsub(/^\s*__\([1-9]\)!\s+/,
- # "#{Mx[:pa_o]}:hd\\1#{Mx[:pa_c]}"). #watch
- gsub(/#{Mx[:br_line]}\s*_[12]\s+/,
- "#{Mx[:br_line]} ") #indent used in endnotes, not implemented, replace when ready with: line.gsub(/(?:<br>|<br \/>)\s*_([12])\s+/,'<br><:i\1> ')
- end
- @data
- end
- end
-end
-__END__
diff --git a/lib/sisu/current/cgi.rb b/lib/sisu/current/cgi.rb
deleted file mode 100644
index 99f2e98..0000000
--- a/lib/sisu/current/cgi.rb
+++ /dev/null
@@ -1,84 +0,0 @@
-# encoding: utf-8
-=begin
-
-* Name: SiSU
-
-** Description: documents, structuring, processing, publishing, search
-*** generates naive cgi search form for search of sisu database (pgsql sqlite)
-
-** Author: Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
-** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
- All Rights Reserved.
-
-** License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
-** SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
-** Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
-** Git
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/cgi.rb;hb=HEAD>
-
-=end
-module SiSU_CGI #% database building documents
- require_relative 'se' # se.rb
- require_relative 'cgi_pgsql' # cgi_pgsql.rb
- require_relative 'cgi_sqlite' # cgi_sqlite.rb
- class SearchSQL
- def initialize(opt)
- @opt=opt
- @webserv=@opt.files[0].to_s.strip
- end
- def read
- if @opt.act[:sample_search_form][:db]==:pg # cgi_pgsql.rb
- SiSU_CGI_PgSQL::SearchPgSQL.new(@opt,@webserv).pgsql
- elsif @opt.act[:sample_search_form][:db]==:sqlite # cgi_sqlite.rb
- SiSU_CGI_SQLite::SearchSQLite.new(@opt,@webserv).sqlite
- else
- puts <<-WOK
- please select database type for which sample search form should be built (pgsql or sqlite)
- sisu --sample-search-form --db=sqlite
- sisu --sample-search-form --db=pg
- other options include
- --webserv-cgi='[cgi-server-name]'
- --webserv-output='[sisu-output-server-with-base-path]'
- WOK
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/current/cgi_sqlite.rb b/lib/sisu/current/cgi_sqlite.rb
deleted file mode 100644
index 9144423..0000000
--- a/lib/sisu/current/cgi_sqlite.rb
+++ /dev/null
@@ -1,244 +0,0 @@
-# encoding: utf-8
-=begin
-
-* Name: SiSU
-
-** Description: documents, structuring, processing, publishing, search
-*** generates naive cgi search form for search of sisu database (sqlite)
-
-** Author: Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
-** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
- All Rights Reserved.
-
-** License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
-** SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
-** Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
-** Git
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/cgi_sql_sqlite.rb;hb=HEAD>
-
-=end
-module SiSU_CGI_SQLite #% database building documents
- require_relative 'se' # se.rb
- require_relative 'cgi_sql_common' # cgi_sql_common.rb
- include SiSU_CGI_SQL
- class SearchSQLite < CGI_Common
- def initialize(opt,webserv)
- @opt,@webserv=opt,webserv
- @cX=SiSU_Screen::Ansi.new(opt.act[:color_state][:set]).cX
- @env=SiSU_Env::InfoEnv.new('',opt)
- @image_src="#{@env.url.webserv_cgi(opt)}/_sisu/image_sys"
- @name_of={}
- @name_of[:output_dir_structure]=if opt.dir_structure_by.to_s =~/(?:language|filetype|filename)/
- opt.dir_structure_by.to_s
- else 'language'
- end
- @name_of[:lingual]=if opt.lingual.to_s =~/(?:mono|multi)/
- opt.lingual.to_s
- else 'multi'
- end
- @name_of[:host_url_cgi]=%q{http://#{ENV['HTTP_HOST']}#{ENV['PATH_INFO']}}
- @name_of[:host_url_docs]=%q{http://#{ENV['HTTP_HOST']}}
- @name_of[:cgi_script]=%q{#{ENV['SCRIPT_NAME']}}
- @image_src=%q{http://#{ENV['HTTP_HOST']}/_sisu/image_sys}
- @common=SiSU_CGI_SQL::CGI_Common.new(@webserv,opt,@image_src,@env)
- @cgi_file_name=@env.url.cgi_sample_search_form_name(opt)
- @name_of_sqlite_db_file='sisu_sqlite.db'
- end
- def sqlite
- serve=[]
- Dir.foreach(@env.path.webserv) do |x|
- if x !~/^\./ \
- and FileTest.directory?("#{@env.path.webserv}/#{x}")
- if FileTest.file?("#{@env.path.webserv}/#{x}/#{@name_of_sqlite_db_file}")
- serve << x unless x =~/^_\S+/
- end
- end
- end
- serve=serve.sort
- f1,f2,f3='','',''
- serve.each do |x|
- f1 << %{ <option value="#{Db[:name_prefix]}#{x}">#{x}</option>\n}
- end
- f2 << %{ selected_db=case cgi['db']\n}
- serve.each do |x|
- f2 << %{ when /#{Db[:name_prefix]}#{x}/ then '<option value="#{Db[:name_prefix]}#{x}">#{x}</option>'\n}
- end
- f2 << " end\n"
- f3 << %{ db_name='#{@name_of_sqlite_db_file}'\n}
- f3 << %{ db_sqlite=case cgi['db']\n}
- serve.each do |x|
- f3 << %{ when /#{Db[:name_prefix]}#{x}/ then "#{@env.path.webserv}/#{x}/\#{db_name}"\n}
- end
- f3 << %{ else "#{@env.path.webserv}/#{serve[0]}/\#{db_name}"\n end\n}
- if FileTest.writable?('.')
- output=File.open(@cgi_file_name,'w')
- output << header0 << header1 << header_desc << header2 << f1 << buttons1 << buttons2 << search_request << search_statement << search_statement_common << search_query1 << @common.pages << search_query2 << @common.tail << @common.main1 << f2 << f3 << dbi_connect << @common.main2 << @common.dir_structure << @common.main3
- puts <<-WOK
- generated sample search form: #{@cX.green}#{@cgi_file_name}#{@cX.off}
- default database name: #{@cX.green}#{Db[:name_prefix]}#{@env.path.base_markup_dir_stub}#{@cX.off} (#{@env.path.base_markup_dir_stub})
- cgi & db host on: #{@cX.blue}#{@env.url.webserv_base_cgi(@opt)}#{@cX.off}
- to modify use: #{@cX.brown}sisu --db-sqlite --webserv-search='#{@env.url.webserv_base_cgi(@opt)}'#{@cX.off}
- sisu output on: #{@cX.blue}#{@env.url.webserv_files_from_db(@opt)}#{@cX.off}
- to modify use: #{@cX.brown}sisu --db-sqlite --webserv-output='#{@env.url.webserv_files_from_db(@opt)}'#{@cX.off}
- cgi search form link name: #{@cX.green}#{@env.url.cgi_sample_search_form_name(@opt)}#{@cX.off}
- to modify use: #{@cX.brown}sisu --db-sqlite --cgi-search-form-name='#{@env.url.cgi_sample_search_form_name(@opt)}'#{@cX.off}
- #{@cX.fuchsia}(settings priority: command line; sisurc.yml; else defaults)#{@cX.off}
-
- #{@cX.fuchsia}NOTE it is first necessary to create the database and tables and populate it#{@cX.off}
-
- sisu --sqlite --dropall # removes existing postgresql db & tables
- sisu --sqlite --createall -v # creates postgresql db & tables
- sisu --sqlite --update -v *.sst *.ssm # populate the db
- sisu --sample-search-form --sqlite # creates the postgresql search form
- # this should be done after creating the db
- # to be searched
- sisu --webrick & # starts ruby webrick web server
-
- # if necessary make the directory '/usr/lib/cgi-bin'
- # here we copy the postgresql search form to cgi-bin
- # (copy #{@cgi_file_name} to your cgi directory)
- # set file permissions to 755
- WOK
- a=case @webserv
- when /pwd/ then ''
- else <<-WOK
-
- sudo cp -vi #{Dir.pwd}/#{@cgi_file_name} /usr/lib/cgi-bin/.; \\
- sudo chmod -v 755 /usr/lib/cgi-bin/#{@cgi_file_name}
- WOK
- end
- b='(to create and populate sisu sqlite database see "man sisu" and in particular the -d flag)'
- SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],a,b).warn
- a=<<-WOK
-
- #{@env.webserv_base_cgi(@opt)}/cgi-bin/#{@cgi_file_name}
-
- WOK
- SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],a).print_blue
- else puts "failed in attempt to write #{@cgi_file_name} to present directory, is directory writable?"
- end
- end
- def header0
- <<-WOK_SQL
-#!/usr/bin/env ruby
-=begin
-#{about}
- * Description: generates naive cgi search form for search of sisu database (sqlite)
-#{gpl}
-=end
- begin
- require 'cgi'
- require 'fcgi'
- require 'sqlite3'
- rescue LoadError
- puts 'cgi, fcgi or sqlite3 NOT FOUND (LoadError)'
- end
- @stub_default='sisu_sqlite'
- @image_src="#{@image_src}"
- @hosturl_cgi="#{@name_of[:host_url_cgi]}"
- @hosturl_files="#{@name_of[:host_url_docs]}"
- @output_dir_structure_by='#{@name_of[:output_dir_structure]}'
- @lingual='#{@name_of[:lingual]}'
- @db_name_prefix='#{Db[:name_prefix]}'
- @base="#{@name_of[:host_url_cgi]}#{@name_of[:cgi_script]}"
- WOK_SQL
- end
- def search_statement
- <<-'WOK_SQL'
- class DBI_SearchString
- def initialize(l,t,q,cse=false)
- @l,@t,@q=l,t,q
- end
- def string
- search={ search: [], flag: false }
- if @t =~/\S+/ or @q =~/\S+/
- if @t =~/\S+/ then unescaped_search=CGI.unescape(@t)
- elsif @q =~/\S+/ then unescaped_search=CGI.unescape(@q)
- end
- search_construct=[]
- unescaped_search=unescaped_search.gsub(/\s*(AND|OR)\s*/,"%' \) \\1 #{@l} LIKE \( '%").
- gsub(/(.+)/,"#{@l} LIKE \( '%\\1%' \)")
- search_construct << unescaped_search
- search_construct=search_construct.join(' ')
- search[:search] << search_construct
- search[:flag]=true
- search
- end
- search
- end
- end
- WOK_SQL
- end
- def search_query1
- <<-'WOK_SQL'
- @search_text=''
- @search_text=search[:text].flatten.join(' AND ')
- @search_text=@search_text.gsub(/(doc_objects\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+doc_objects\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)')
- end
- WOK_SQL
- end
- def search_query2
- <<-'WOK_SQL'
- def sql_select_body
- limit ||=@@limit
- offset ||=@@offset
- @sql_statement[:body]=%{SELECT metadata_and_text.title, metadata_and_text.creator_author, metadata_and_text.src_filename, metadata_and_text.language_document_char, metadata_and_text.notes_suffix, doc_objects.body, doc_objects.seg, doc_objects.ocn, metadata_and_text.tid FROM doc_objects, metadata_and_text WHERE #{@search_text} AND doc_objects.metadata_tid = metadata_and_text.tid ORDER BY metadata_and_text.language_document_char, metadata_and_text.title, metadata_and_text.src_filename, doc_objects.ocn}
- @sql_statement[:range]=%{LIMIT #{limit} OFFSET #{offset} ;}
- select=@sql_statement[:body] + ' ' + @sql_statement[:range]
- select
- end
- def sql_select_body_format
- %{<font color="#666666" size="2">#{sql_select_body}</font>}
- end
- def contents
- @conn.execute(sql_select_body)
- end
- end
- WOK_SQL
- end
- def dbi_connect
- <<-'WOK_SQL'
- @conn=SQLite3::Database.new(db_sqlite)
- @conn.results_as_hash=true
- WOK_SQL
- end
- end
-end
-__END__
diff --git a/lib/sisu/current/db_create.rb b/lib/sisu/current/db_create.rb
deleted file mode 100644
index df8983d..0000000
--- a/lib/sisu/current/db_create.rb
+++ /dev/null
@@ -1,689 +0,0 @@
-# encoding: utf-8
-=begin
-
-* Name: SiSU
-
-** Description: documents, structuring, processing, publishing, search
-*** modules shared by the different db types, dbi, postgresql, sqlite
-
-** Author: Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
-** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
- All Rights Reserved.
-
-** License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
-** SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
-** Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
-** Git
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/db_create.rb;hb=HEAD>
-
-=end
-module SiSU_DbCreate
- require_relative 'db_columns' # db_columns.rb
- class Create < SiSU_DbColumns::Columns
- require_relative 'se' # se.rb
- @@dl=nil
- def initialize(opt,conn,file,sql_type=:pg)
- @opt,@conn,@file,@sql_type=opt,conn,file,sql_type
- @cX=SiSU_Screen::Ansi.new(@opt.act[:color_state][:set]).cX
- @comment=(@sql_type==:pg) \
- ? (SiSU_DbCreate::Comment.new(@conn,@sql_type))
- : nil
- @@dl ||=SiSU_Env::InfoEnv.new.digest.length
- end
- def available
- DBI.available_drivers.each do |driver|
- puts "Driver: #{driver}"
- DBI.data_sources(driver).each do |dsn|
- puts "\tDatasource: #{dsn}"
- end
- end
- end
- def create_db
- @env=SiSU_Env::InfoEnv.new(@opt.fns)
- tell=(@sql_type==:sqlite) \
- ? SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- 'Create SQLite db tables in:',
- %{"#{@file}"}
- )
- : SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- 'Create pgSQL db tables in:',
- %{"#{Db[:name_prefix]}#{@env.path.base_markup_dir_stub}"}
- )
- if (@opt.act[:verbose][:set]==:on \
- || @opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- tell.dark_grey_title_hi
- end
- SiSU_Env::SystemCall.new.create_pg_db(@env.path.base_markup_dir_stub) if @sql_type==:pg #watch use of path.base_markup_dir_stub instead of stub
- end
- def output_dir?
- dir=SiSU_Env::InfoEnv.new('')
- if @opt.act[:sqlite][:set]==:on
- dir.path.webserv_stub_ensure
- end
- end
- def create_table
- def conn_exec(sql)
- if @sql_type==:pg
- conn_exec_pg(sql)
- elsif @sql_type==:sqlite
- conn_exec_sqlite(sql)
- end
- end
- def conn_exec_pg(sql)
- begin
- @conn.exec_params(sql)
- rescue
- if @conn.is_a?(NilClass)
- errmsg="No pg connection (check pg dependencies)"
- if @opt.act[:no_stop][:set]==:on
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
- error("#{errmsg}, proceeding without pg output (as requested)")
- else
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
- error("#{errmsg}, STOPPING")
- exit
- end
- end
- end
- end
- def conn_exec_sqlite(sql)
- begin
- @conn.execute(sql)
- rescue
- if @conn.is_a?(NilClass)
- errmsg="No sqlite3 connection (check sqlite3 dependencies)"
- if @opt.act[:no_stop][:set]==:on
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
- error("#{errmsg}, proceeding without sqlite output (as requested)")
- else
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
- error("#{errmsg}, STOPPING")
- exit
- end
- end
- end
- end
- def metadata_and_text
- if (@opt.act[:verbose_plus][:set]==:on \
- or @opt.act[:maintenance][:set]==:on)
- print %{
- currently using sisu_dbi module
- to be populated from document files
- create tables metadata_and_text
- data import through ruby transfer
- }
- end
- create_metadata_and_text=%{
- CREATE TABLE metadata_and_text (
- tid BIGINT PRIMARY KEY,
- /* title */
- #{column.title.create_column}
- #{column.title_main.create_column}
- #{column.title_sub.create_column}
- #{column.title_short.create_column}
- #{column.title_edition.create_column}
- #{column.title_note.create_column}
- #{column.title_language.create_column}
- #{column.title_language_char.create_column}
- /* creator */
- #{column.creator_author.create_column}
- #{column.creator_author_honorific.create_column}
- #{column.creator_author_nationality.create_column}
- #{column.creator_editor.create_column}
- #{column.creator_contributor.create_column}
- #{column.creator_illustrator.create_column}
- #{column.creator_photographer.create_column}
- #{column.creator_translator.create_column}
- #{column.creator_prepared_by.create_column}
- #{column.creator_digitized_by.create_column}
- #{column.creator_audio.create_column}
- #{column.creator_video.create_column}
- /* language */
- #{column.language_document.create_column}
- #{column.language_document_char.create_column}
- #{column.language_original.create_column}
- #{column.language_original_char.create_column}
- /* date */
- #{column.date_added_to_site.create_column}
- #{column.date_available.create_column}
- #{column.date_created.create_column}
- #{column.date_issued.create_column}
- #{column.date_modified.create_column}
- #{column.date_published.create_column}
- #{column.date_valid.create_column}
- #{column.date_translated.create_column}
- #{column.date_original_publication.create_column}
- #{column.date_generated.create_column}
- /* publisher */
- #{column.publisher.create_column}
- /* original */
- #{column.original_publisher.create_column}
- #{column.original_language.create_column}
- #{column.original_language_char.create_column}
- #{column.original_source.create_column}
- #{column.original_institution.create_column}
- #{column.original_nationality.create_column}
- /* rights */
- #{column.rights_all.create_column}
- #{column.rights_copyright_text.create_column}
- #{column.rights_copyright_translation.create_column}
- #{column.rights_copyright_illustrations.create_column}
- #{column.rights_copyright_photographs.create_column}
- #{column.rights_copyright_preparation.create_column}
- #{column.rights_copyright_digitization.create_column}
- #{column.rights_copyright_audio.create_column}
- #{column.rights_copyright_video.create_column}
- #{column.rights_license.create_column}
- /* classify */
- #{column.classify_topic_register.create_column}
- #{column.classify_subject.create_column}
- #{column.classify_loc.create_column}
- #{column.classify_dewey.create_column}
- #{column.classify_keywords.create_column}
- /* identifier */
- #{column.identifier_oclc.create_column}
- #{column.identifier_isbn.create_column}
- /* notes */
- #{column.notes_abstract.create_column}
- #{column.notes_description.create_column}
- #{column.notes_comment.create_column}
- #{column.notes_history.create_column}
- #{column.notes_coverage.create_column}
- #{column.notes_relation.create_column}
- /* column.notes_source.create_column */
- #{column.notes_type.create_column}
- #{column.notes_format.create_column}
- #{column.notes_prefix.create_column}
- #{column.notes_prefix_a.create_column}
- #{column.notes_prefix_b.create_column}
- #{column.notes_suffix.create_column}
- /* src */
- #{column.src_filename.create_column}
- #{column.src_fingerprint.create_column}
- #{column.src_filesize.create_column}
- #{column.src_word_count.create_column}
- #{column.src_txt.create_column}
- /* misc */
- #{column.fulltext.create_column}
- #{column.links.create_column.gsub(/,$/,'')}
-/* subj VARCHAR(64) NULL, */
-/* contact VARCHAR(100) NULL, */
-/* information VARCHAR(100) NULL, */
-/* types CHAR(1) NULL, */
-/* writing_focus_nationality VARCHAR(100) NULL, */
- );
- }
- conn_exec(create_metadata_and_text)
- @comment.psql.metadata_and_text if @comment
- end
- def doc_objects # create doc_objects base
- if (@opt.act[:verbose_plus][:set]==:on \
- or @opt.act[:maintenance][:set]==:on)
- print %{
- to be populated from documents files
- create tables doc_objects
- data import through ruby transfer
- }
- end
- create_doc_objects=%{
- CREATE TABLE doc_objects (
- lid BIGINT PRIMARY KEY,
- metadata_tid BIGINT REFERENCES metadata_and_text,
- ocn SMALLINT,
- ocnd VARCHAR(6),
- ocns VARCHAR(6),
- clean TEXT NULL,
- body TEXT NULL,
- book_idx TEXT NULL,
- seg VARCHAR(256) NULL,
- lev_an VARCHAR(1),
- lev SMALLINT NULL,
- lev0 SMALLINT,
- lev1 SMALLINT,
- lev2 SMALLINT,
- lev3 SMALLINT,
- lev4 SMALLINT,
- lev5 SMALLINT,
- lev6 SMALLINT,
- lev7 SMALLINT,
- en_a SMALLINT NULL,
- en_z SMALLINT NULL,
- en_a_asterisk SMALLINT NULL,
- en_z_asterisk SMALLINT NULL,
- en_a_plus SMALLINT NULL,
- en_z_plus SMALLINT NULL,
- t_of VARCHAR(16),
- t_is VARCHAR(16),
- node VARCHAR(16) NULL,
- parent VARCHAR(16) NULL,
- digest_clean CHAR(#{@@dl}),
- digest_all CHAR(#{@@dl}),
- types CHAR(1) NULL
- );
- }
- conn_exec(create_doc_objects)
- @comment.psql.doc_objects if @comment
- end
- def endnotes
- if (@opt.act[:verbose_plus][:set]==:on \
- or @opt.act[:maintenance][:set]==:on)
- print %{
- to be populated from document files
- create tables endnotes
- data import through ruby transfer
- }
- end
- create_endnotes=%{
- CREATE TABLE endnotes (
- nid BIGINT PRIMARY KEY,
- document_lid BIGINT REFERENCES doc_objects,
- nr SMALLINT,
- clean TEXT NULL,
- body TEXT NULL,
- ocn SMALLINT,
- ocnd VARCHAR(6),
- ocns VARCHAR(6),
- digest_clean CHAR(#{@@dl}),
- metadata_tid BIGINT REFERENCES metadata_and_text
- );
- }
- conn_exec(create_endnotes)
- @comment.psql.endnotes if @comment
- end
- def endnotes_asterisk
- if (@opt.act[:verbose_plus][:set]==:on \
- or @opt.act[:maintenance][:set]==:on)
- print %{
- to be populated from document files
- create tables endnotes_asterisk
- data import through ruby transfer
- }
- end
- create_endnotes_asterisk=%{
- CREATE TABLE endnotes_asterisk (
- nid BIGINT PRIMARY KEY,
- document_lid BIGINT REFERENCES doc_objects,
- nr SMALLINT,
- clean TEXT NULL,
- body TEXT NULL,
- ocn SMALLINT,
- ocnd VARCHAR(6),
- ocns VARCHAR(6),
- digest_clean CHAR(#{@@dl}),
- metadata_tid BIGINT REFERENCES metadata_and_text
- );
- }
- conn_exec(create_endnotes_asterisk)
- @comment.psql.endnotes_asterisk if @comment
- end
- def endnotes_plus
- if (@opt.act[:verbose_plus][:set]==:on \
- or @opt.act[:maintenance][:set]==:on)
- print %{
- to be populated from document files
- create tables endnotes_plus
- data import through ruby transfer
- }
- end
- create_endnotes_plus=%{
- CREATE TABLE endnotes_plus (
- nid BIGINT PRIMARY KEY,
- document_lid BIGINT REFERENCES doc_objects,
- nr SMALLINT,
- clean TEXT NULL,
- body TEXT NULL,
- ocn SMALLINT,
- ocnd VARCHAR(6),
- ocns VARCHAR(6),
- digest_clean CHAR(#{@@dl}),
- metadata_tid BIGINT REFERENCES metadata_and_text
- );
- }
- conn_exec(create_endnotes_plus)
- @comment.psql.endnotes_plus if @comment
- end
- def urls # create doc_objects file links mapping
- if (@opt.act[:verbose_plus][:set]==:on \
- or @opt.act[:maintenance][:set]==:on)
- print %{
- currently using sisu_dbi module
- to be populated from doc_objects files
- create tables urls
- data import through ruby transfer
- }
- end
- create_urls=%{
- CREATE TABLE urls (
- metadata_tid BIGINT REFERENCES metadata_and_text,
- plaintext varchar(512),
- html_toc varchar(512),
- html_doc varchar(512),
- xhtml varchar(512),
- xml_sax varchar(512),
- xml_dom varchar(512),
- odf varchar(512),
- pdf_p varchar(512),
- pdf_l varchar(512),
- concordance varchar(512),
- latex_p varchar(512),
- latex_l varchar(512),
- digest varchar(512),
- manifest varchar(512),
- markup varchar(512),
- sisupod varchar(512)
- );
- }
- conn_exec(create_urls)
- @comment.psql.urls if @comment
- end
- self
- end
- end
- class Comment < SiSU_DbColumns::Columns
- def initialize(conn,sql_type=:pg)
- @conn=conn
- if sql_type == :pg then psql
- end
- end
- def psql
- def conn_execute_array(sql_arr)
- @conn.transaction do |conn|
- sql_arr.each do |sql|
- conn.exec_params(sql)
- end
- end
- end
- def metadata_and_text
- sql_arr=[
- %{COMMENT ON Table metadata_and_text
- IS 'contains SiSU metadata and fulltext for search (including source .sst if shared)';},
- %{COMMENT ON COLUMN metadata_and_text.tid
- IS 'unique';},
- %{#{column.title.column_comment}},
- %{#{column.title_main.column_comment}},
- %{#{column.title_sub.column_comment}},
- %{#{column.title_short.column_comment}},
- %{#{column.title_edition.column_comment}},
- %{#{column.title_note.column_comment}},
- %{#{column.title_language.column_comment}},
- %{#{column.title_language_char.column_comment}},
- %{#{column.creator_author.column_comment}},
- %{#{column.creator_author_honorific.column_comment}},
- %{#{column.creator_author_nationality.column_comment}},
- %{#{column.creator_editor.column_comment}},
- %{#{column.creator_contributor.column_comment}},
- %{#{column.creator_illustrator.column_comment}},
- %{#{column.creator_photographer.column_comment}},
- %{#{column.creator_translator.column_comment}},
- %{#{column.creator_prepared_by.column_comment}},
- %{#{column.creator_digitized_by.column_comment}},
- %{#{column.creator_audio.column_comment}},
- %{#{column.creator_video.column_comment}},
- %{#{column.language_document.column_comment}},
- %{#{column.language_document_char.column_comment}},
- %{#{column.language_original.column_comment}},
- %{#{column.language_original_char.column_comment}},
- %{#{column.date_added_to_site.column_comment}},
- %{#{column.date_available.column_comment}},
- %{#{column.date_created.column_comment}},
- %{#{column.date_issued.column_comment}},
- %{#{column.date_modified.column_comment}},
- %{#{column.date_published.column_comment}},
- %{#{column.date_valid.column_comment}},
- %{#{column.date_translated.column_comment}},
- %{#{column.date_original_publication.column_comment}},
- %{#{column.date_generated.column_comment}},
- %{#{column.publisher.column_comment}},
- %{#{column.original_publisher.column_comment}},
- %{#{column.original_language.column_comment}},
- %{#{column.original_language_char.column_comment}},
- %{#{column.original_source.column_comment}},
- %{#{column.original_institution.column_comment}},
- %{#{column.original_nationality.column_comment}},
- %{#{column.rights_all.column_comment}},
- %{#{column.rights_copyright_text.column_comment}},
- %{#{column.rights_copyright_translation.column_comment}},
- %{#{column.rights_copyright_illustrations.column_comment}},
- %{#{column.rights_copyright_photographs.column_comment}},
- %{#{column.rights_copyright_preparation.column_comment}},
- %{#{column.rights_copyright_digitization.column_comment}},
- %{#{column.rights_copyright_audio.column_comment}},
- %{#{column.rights_copyright_video.column_comment}},
- %{#{column.rights_license.column_comment}},
- %{#{column.classify_topic_register.column_comment}},
- %{#{column.classify_subject.column_comment}},
- %{#{column.classify_loc.column_comment}},
- %{#{column.classify_dewey.column_comment}},
- %{#{column.classify_keywords.column_comment}},
- %{#{column.identifier_oclc.column_comment}},
- %{#{column.identifier_isbn.column_comment}},
- %{#{column.notes_abstract.column_comment}},
- %{#{column.notes_comment.column_comment}},
- %{#{column.notes_description.column_comment}},
- %{#{column.notes_history.column_comment}},
- %{#{column.notes_coverage.column_comment}},
- %{#{column.notes_relation.column_comment}},
- %{#{column.notes_type.column_comment}},
- %{#{column.notes_format.column_comment}},
- %{#{column.notes_prefix.column_comment}},
- %{#{column.notes_prefix_a.column_comment}},
- %{#{column.notes_prefix_b.column_comment}},
- %{#{column.notes_suffix.column_comment}},
- %{#{column.src_filename.column_comment}},
- %{#{column.src_fingerprint.column_comment}},
- %{#{column.src_filesize.column_comment}},
- %{#{column.src_word_count.column_comment}},
- %{#{column.src_txt.column_comment}},
- %{#{column.fulltext.column_comment}},
- %{#{column.links.column_comment}},
- ]
- conn_execute_array(sql_arr)
- end
- def doc_objects
- sql_arr=[
- %{COMMENT ON Table doc_objects
- IS 'contains searchable text of SiSU document objects';},
- %{COMMENT ON COLUMN doc_objects.lid
- IS 'unique';},
- %{COMMENT ON COLUMN doc_objects.metadata_tid
- IS 'tie to title in metadata_and_text';},
- %{COMMENT ON COLUMN doc_objects.lev_an
- IS 'doc level A-D 1-4';},
- %{COMMENT ON COLUMN doc_objects.lev
- IS 'doc level 0-7 \d\~';},
- %{COMMENT ON COLUMN doc_objects.seg
- IS 'segment name from level number 4 (lv 1)';},
- %{COMMENT ON COLUMN doc_objects.ocn
- IS 'object citation number';},
- %{COMMENT ON COLUMN doc_objects.en_a
- IS 'first endnote number in text object (eg. NULL or 34) (used with en_z to create range)';},
- %{COMMENT ON COLUMN doc_objects.en_z
- IS 'last endnote number within text object (eg. NULL, 34 or say 47) (used with en_a to create range)';},
- %{COMMENT ON COLUMN doc_objects.en_a_asterisk
- IS 'first endnote number in text object (eg. NULL or 34) (used with en_z_asterisk to create range)';},
- %{COMMENT ON COLUMN doc_objects.en_z_asterisk
- IS 'last endnote number within text object (eg. NULL, 34 or say 47) (used with en_a_asterisk to create range)';},
- %{COMMENT ON COLUMN doc_objects.en_a_plus
- IS 'first endnote number in text object (eg. NULL or 34) (used with en_z_plus to create range)';},
- %{COMMENT ON COLUMN doc_objects.en_z_plus
- IS 'last endnote number within text object (eg. NULL, 34 or say 47) (used with en_a_plus to create range)';},
- %{COMMENT ON COLUMN doc_objects.types
- IS 'document types seg scroll';},
- %{COMMENT ON COLUMN doc_objects.clean
- IS 'text object - substantive text: clean, stripped of markup';},
- %{COMMENT ON COLUMN doc_objects.body
- IS 'text object - substantive text: light html markup';},
- %{COMMENT ON COLUMN doc_objects.book_idx
- IS 'book index creation information for paragraph, if provided';},
- %{COMMENT ON COLUMN doc_objects.lev0
- IS 'document structure, level number 0';},
- %{COMMENT ON COLUMN doc_objects.lev1
- IS 'document structure, level number 1';},
- %{COMMENT ON COLUMN doc_objects.lev2
- IS 'document structure, level number 2';},
- %{COMMENT ON COLUMN doc_objects.lev3
- IS 'document structure, level number 3';},
- %{COMMENT ON COLUMN doc_objects.lev4
- IS 'document structure, level number 4';},
- %{COMMENT ON COLUMN doc_objects.lev5
- IS 'document structure, level number 5';},
- %{COMMENT ON COLUMN doc_objects.lev6
- IS 'document structure, level number 6';},
- %{COMMENT ON COLUMN doc_objects.lev7
- IS 'document structure, level number 7';},
- %{COMMENT ON COLUMN doc_objects.t_of
- IS 'document structure, type of object (object is of)';},
- %{COMMENT ON COLUMN doc_objects.t_is
- IS 'document structure, object is';},
- %{COMMENT ON COLUMN doc_objects.node
- IS 'document structure, object node if heading';},
- %{COMMENT ON COLUMN doc_objects.parent
- IS 'document structure, object parent (is a heading)';}
- ]
- conn_execute_array(sql_arr)
- end
- def endnotes
- sql_arr=[
- %{COMMENT ON Table endnotes
- IS 'contains searchable text of SiSU documents endnotes';},
- %{COMMENT ON COLUMN endnotes.nid
- IS 'unique';},
- %{COMMENT ON COLUMN endnotes.document_lid
- IS 'ties to text block from which referenced';},
- %{COMMENT ON COLUMN endnotes.nr
- IS 'endnote number <!e_(\d+)!>';},
- %{COMMENT ON COLUMN endnotes.clean
- IS 'endnote substantive content, stripped of markup';},
- %{COMMENT ON COLUMN endnotes.body
- IS 'endnote substantive content';},
- %{COMMENT ON COLUMN endnotes.ocn
- IS 'object citation no# <\~(\d+)> from which endnote is referenced';},
- %{COMMENT ON COLUMN doc_objects.metadata_tid
- IS 'tie to title in metadata_and_text - unique for each document';}
- ]
- conn_execute_array(sql_arr)
- end
- def endnotes_asterisk
- sql_arr=[
- %{COMMENT ON Table endnotes_asterisk
- IS 'contains searchable text of SiSU documents endnotes marked with asterisk';},
- %{COMMENT ON COLUMN endnotes_asterisk.nid
- IS 'unique';},
- %{COMMENT ON COLUMN endnotes_asterisk.document_lid
- IS 'ties to text block from which referenced';},
- %{COMMENT ON COLUMN endnotes_asterisk.nr
- IS 'endnote number <!e_(\d+)!>';},
- %{COMMENT ON COLUMN endnotes_asterisk.clean
- IS 'endnote substantive content, stripped of markup';},
- %{COMMENT ON COLUMN endnotes_asterisk.body
- IS 'endnote substantive content';},
- %{COMMENT ON COLUMN endnotes_asterisk.ocn
- IS 'object citation no# <\~(\d+)> from which endnote is referenced';},
- %{COMMENT ON COLUMN doc_objects.metadata_tid
- IS 'tie to title in metadata_and_text - unique for each document';}
- ]
- conn_execute_array(sql_arr)
- end
- def endnotes_plus
- sql_arr=[
- %{COMMENT ON Table endnotes_plus
- IS 'contains searchable text of SiSU documents endnotes marked with plus';},
- %{COMMENT ON COLUMN endnotes_plus.nid
- IS 'unique';},
- %{COMMENT ON COLUMN endnotes_plus.document_lid
- IS 'ties to text block from which referenced';},
- %{COMMENT ON COLUMN endnotes_plus.nr
- IS 'endnote number <!e_(\d+)!>';},
- %{COMMENT ON COLUMN endnotes_plus.clean
- IS 'endnote substantive content, stripped of markup';},
- %{COMMENT ON COLUMN endnotes_plus.body
- IS 'endnote substantive content';},
- %{COMMENT ON COLUMN endnotes_plus.ocn
- IS 'object citation no# <\~(\d+)> from which endnote is referenced';},
- %{COMMENT ON COLUMN doc_objects.metadata_tid
- IS 'tie to title in metadata_and_text - unique for each document';},
- ]
- conn_execute_array(sql_arr)
- end
- def urls
- sql_arr=[
- %{COMMENT ON Table urls
- IS 'contains base url links to different SiSU output';},
- %{COMMENT ON COLUMN doc_objects.metadata_tid
- IS 'tie to title in metadata_and_text - unique for each document, the mapping of rows is one to one';},
- %{COMMENT ON COLUMN urls.plaintext
- IS 'plaintext utf-8';},
- %{COMMENT ON COLUMN urls.html_toc
- IS 'table of contents for segmented html document';},
- %{COMMENT ON COLUMN urls.html_doc
- IS 'html document (scroll)';},
- %{COMMENT ON COLUMN urls.xhtml
- IS 'xhtml document (scroll)';},
- %{COMMENT ON COLUMN urls.xml_sax
- IS 'xml sax oriented document (scroll)';},
- %{COMMENT ON COLUMN urls.xml_dom
- IS 'xml dom oriented document (scroll)';},
- %{COMMENT ON COLUMN urls.odf
- IS 'opendocument format text';},
- %{COMMENT ON COLUMN urls.pdf_p
- IS 'pdf portrait';},
- %{COMMENT ON COLUMN urls.pdf_l
- IS 'pdf landscape';},
- %{COMMENT ON COLUMN urls.concordance
- IS 'rudimentary document index linked to html';},
- %{COMMENT ON COLUMN urls.latex_p
- IS 'latex portrait';},
- %{COMMENT ON COLUMN urls.latex_l
- IS 'latex_landscape';},
- %{COMMENT ON COLUMN urls.markup
- IS 'markup';},
- %{COMMENT ON COLUMN urls.sisupod
- IS 'SiSU document format .tgz (all SiSU information on document)';},
- ]
- conn_execute_array(sql_arr)
- end
- self
- end
- end
-end
-__END__
diff --git a/lib/sisu/current/db_drop.rb b/lib/sisu/current/db_drop.rb
deleted file mode 100644
index b90a81e..0000000
--- a/lib/sisu/current/db_drop.rb
+++ /dev/null
@@ -1,207 +0,0 @@
-# encoding: utf-8
-=begin
-
-* Name: SiSU
-
-** Description: documents, structuring, processing, publishing, search
-*** modules shared by the different db types, dbi, postgresql, sqlite
-
-** Author: Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
-** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
- All Rights Reserved.
-
-** License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
-** SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
-** Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
-** Git
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/db_drop.rb;hb=HEAD>
-
-=end
-module SiSU_DbDrop
- require_relative 'utils_response' # utils_response.rb
- class Drop
- include SiSU_Response
- def initialize(opt,conn,db_info,sql_type)
- @opt,@conn,@db_info,@sql_type=opt,conn,db_info,sql_type
- case @sql_type
- when :sqlite
- cascade=''
- else
- cascade='CASCADE'
- end
- @drop_table=[
- "DROP TABLE metadata_and_text #{cascade};",
- "DROP TABLE doc_objects #{cascade};",
- "DROP TABLE urls #{cascade};",
- "DROP TABLE endnotes #{cascade};",
- "DROP TABLE endnotes_asterisk #{cascade};",
- "DROP TABLE endnotes_plus #{cascade};",
- ]
- end
- def drop
- def tables #% drop all tables
- begin
- msg_sqlite="as not all disk space is recovered after dropping the database << #{@db_info.sqlite.db} >>, you may be better off deleting the file, and recreating it as necessary"
- case @sql_type
- when :sqlite
- puts msg_sqlite
- ans=response?('remove sql database?')
- if ans \
- and File.exist?(@db_info.sqlite.db)
- @conn.close
- File.unlink(@db_info.sqlite.db)
- db=SiSU_Env::InfoDb.new
- conn=db.sqlite.conn_sqlite3
- sdb=SiSU_DbDBI::Create.new(@opt,conn,@db_info,@sql_type)
- sdb_index=SiSU_DbDBI::Index.new(@opt,conn,@db_info,@sql_type)
- sdb.output_dir?
- begin
- sdb.create_db
- sdb.create_table.metadata_and_text
- sdb.create_table.doc_objects
- sdb.create_table.endnotes
- sdb.create_table.endnotes_asterisk
- sdb.create_table.endnotes_plus
- sdb.create_table.urls
- sdb_index.create_indexes
- rescue
- SiSU_Errors::Rescued.new($!,$@,'-D').location do
- __LINE__.to_s + ':' + __FILE__
- end
- sdb.output_dir?
- end
- exit
- else
- @conn.transaction
- @drop_table.each do |d|
- begin
- @conn.exec_params(d)
- rescue
- next
- end
- end
- @conn.commit
- end
- when :pg
- @conn.transaction
- @drop_table.each do |d|
- begin
- @conn.exec_params(d)
- rescue
- next
- end
- end
- @conn.commit
- end
- rescue
- case @sql_type
- when :sqlite
- ans=response?('remove sql database?')
- if ans and File.exist?(@db_info.sqlite.db); File.unlink(@db_info.sqlite.db)
- end
- else
- @drop_table.each do |d|
- begin
- @conn.exec_params(d)
- rescue
- next
- end
- end
- end
- ensure
- end
- end
- def indexes
- def conn_execute_array(sql_arr)
- @conn.transaction do |conn|
- sql_arr.each do |sql|
- begin
- conn.exec_params(sql)
- rescue
- next
- end
- end
- end
- end
- def base #% drop base indexes
- print "\n drop documents common indexes\n" unless @opt.act[:quiet][:set]==:on
- sql_arr=[
- %{DROP INDEX idx_title;},
- %{DROP INDEX idx_author;},
- %{DROP INDEX idx_filename;},
- %{DROP INDEX idx_topics;},
- %{DROP INDEX idx_ocn;},
- %{DROP INDEX idx_digest_clean;},
- %{DROP INDEX idx_digest_all;},
- %{DROP INDEX idx_lev0;},
- %{DROP INDEX idx_lev1;},
- %{DROP INDEX idx_lev2;},
- %{DROP INDEX idx_lev3;},
- %{DROP INDEX idx_lev4;},
- %{DROP INDEX idx_lev5;},
- %{DROP INDEX idx_lev6;},
- %{DROP INDEX idx_endnote_nr;},
- %{DROP INDEX idx_digest_en;},
- %{DROP INDEX idx_endnote_nr_asterisk;},
- %{DROP INDEX idx_endnote_asterisk;},
- %{DROP INDEX idx_digest_en_asterisk;},
- %{DROP INDEX idx_endnote_nr_plus;},
- %{DROP INDEX idx_endnote_plus;},
- %{DROP INDEX idx_digest_en_plus},
- ]
- conn_execute_array(sql_arr)
- end
- def text #% drop TEXT indexes, sqlite
- print "\n drop documents TEXT indexes\n" unless @opt.act[:quiet][:set]==:on
- sql_arr=[
- %{DROP INDEX idx_clean;},
- %{DROP INDEX idx_endnote},
- ]
- conn_execute_array(sql_arr)
- end
- self
- end
- indexes.base
- @opt.act[:psql][:set]==:on ? '' : indexes.text
- self
- end
- end
-end
-__END__
diff --git a/lib/sisu/current/db_indexes.rb b/lib/sisu/current/db_indexes.rb
deleted file mode 100644
index 25373bf..0000000
--- a/lib/sisu/current/db_indexes.rb
+++ /dev/null
@@ -1,146 +0,0 @@
-# encoding: utf-8
-=begin
-
-* Name: SiSU
-
-** Description: documents, structuring, processing, publishing, search
-*** modules shared by the different db types, dbi, postgresql, sqlite
-
-** Author: Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
-** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
- All Rights Reserved.
-
-** License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
-** SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
-** Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
-** Git
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/db_indexes.rb;hb=HEAD>
-
-=end
-module SiSU_DbIndex
- class Index # create documents Indexes def initialize(opt,conn='',sql_type)
- def initialize(opt,conn,file,sql_type)
- @opt,@conn,@file,@sql_type=opt,conn,file,sql_type
- end
- def create_indexes # check added from pg not tested
- def conn_execute_sql_pg(conn,sql)
- conn.exec_params(sql)
- end
- def conn_execute_sql_sqlite(conn,sql)
- conn.execute(sql)
- end
- def conn_execute_sql(conn,sql)
- if @sql_type==:pg
- conn_execute_sql_pg(conn,sql)
- elsif @sql_type==:sqlite
- conn_execute_sql_sqlite(conn,sql)
- else
- end
- end
- def conn_execute_array(sql_arr)
- begin
- @conn.transaction do |conn|
- sql_arr.each do |sql|
- conn_execute_sql(conn,sql)
- end
- end
- rescue
- if @conn.is_a?(NilClass)
- errmsg="No sqlite3 connection (check sqlite3 dependencies)"
- if @opt.act[:no_stop][:set]==:on
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
- error("#{errmsg}, proceeding without sqlite output (as requested)")
- else
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
- error("#{errmsg}, STOPPING")
- exit
- end
- end
- end
- end
- def base
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- print "\n create documents common indexes\n"
- end
- sql_arr=[
- %{CREATE INDEX idx_ocn ON doc_objects(ocn);},
- %{CREATE INDEX idx_digest_clean ON doc_objects(digest_clean);},
- %{CREATE INDEX idx_digest_all ON doc_objects(digest_all);},
- %{CREATE INDEX idx_lev0 ON doc_objects(lev0);},
- %{CREATE INDEX idx_lev1 ON doc_objects(lev1);},
- %{CREATE INDEX idx_lev2 ON doc_objects(lev2);},
- %{CREATE INDEX idx_lev3 ON doc_objects(lev3);},
- %{CREATE INDEX idx_lev4 ON doc_objects(lev4);},
- %{CREATE INDEX idx_lev5 ON doc_objects(lev5);},
- %{CREATE INDEX idx_lev6 ON doc_objects(lev6);},
- %{CREATE INDEX idx_endnote_nr ON endnotes(nr);},
- %{CREATE INDEX idx_digest_en ON endnotes(digest_clean);},
- %{CREATE INDEX idx_endnote_nr_asterisk ON endnotes_asterisk(nr);},
- %{CREATE INDEX idx_endnote_asterisk ON endnotes_asterisk(clean);},
- %{CREATE INDEX idx_digest_en_asterisk ON endnotes_asterisk(digest_clean);},
- %{CREATE INDEX idx_endnote_nr_plus ON endnotes_plus(nr);},
- %{CREATE INDEX idx_endnote_plus ON endnotes_plus(clean);},
- %{CREATE INDEX idx_digest_en_plus ON endnotes_plus(digest_clean);},
- %{CREATE INDEX idx_title ON metadata_and_text(title);},
- %{CREATE INDEX idx_author ON metadata_and_text(creator_author);},
- %{CREATE INDEX idx_filename ON metadata_and_text(src_filename);},
- %{CREATE INDEX idx_language ON metadata_and_text(language_document_char);},
- %{CREATE INDEX idx_topics ON metadata_and_text(classify_topic_register)},
- ]
- conn_execute_array(sql_arr)
- end
- def text
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- print "\n create documents TEXT indexes\n"
- end
- sql_arr=[
- %{CREATE INDEX idx_clean ON doc_objects(clean);},
- %{CREATE INDEX idx_endnote ON endnotes(clean);}
- ]
- conn_execute_array(sql_arr)
- end
- base
- @opt.act[:psql][:set]==:on ? '' : text
- end
- end
-end
-__END__
diff --git a/lib/sisu/current/db_load_tuple.rb b/lib/sisu/current/db_load_tuple.rb
deleted file mode 100644
index ebf7a45..0000000
--- a/lib/sisu/current/db_load_tuple.rb
+++ /dev/null
@@ -1,323 +0,0 @@
-# encoding: utf-8
-=begin
-
-* Name: SiSU
-
-** Description: documents, structuring, processing, publishing, search
-*** modules shared by the different db types, dbi, postgresql, sqlite
-
-** Author: Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
-** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
- All Rights Reserved.
-
-** License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
-** SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
-** Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
-** Git
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/db_load_tuple.rb;hb=HEAD>
-
-=end
-module SiSU_DbTuple
- require_relative 'db_columns' # db_columns.rb
- class LoadDocuments
- require_relative 'dp' # dp.rb
- include SiSU_Param
- def initialize(conn,col,opt,file_maint)
- @conn,@col,@opt,@file_maint=conn,col,opt,file_maint
- @col[:lev]=@col[:lev].to_i
- unless @col[:lev].inspect=~/^[0-7]/ \
- or @col[:lev]==0..7
- @col[:lev]=9
- end
- @col[:ocn]=0 unless @col[:ocn].inspect=~/\d+/
- @cX=SiSU_Screen::Ansi.new(@opt.act[:color_state][:set]).cX
- end
- def tuple #% import line
- sql_entry=if @col[:en_a]
- "INSERT INTO doc_objects (lid, metadata_tid, lev, lev_an, clean, body, book_idx, ocn, ocnd, ocns, seg, lev0, lev1, lev2, lev3, lev4, lev5, lev6, lev7, en_a, en_z, t_of, t_is, node, parent, digest_clean, digest_all) " +
- "VALUES (#{@col[:lid]}, #{@col[:tid]}, #{@col[:lev]}, '#{@col[:lev_an]}', '#{@col[:plaintext]}', '#{@col[:body]}', '#{@col[:book_idx]}', '#{@col[:ocn]}', '#{@col[:ocnd]}', '#{@col[:ocns]}', '#{@col[:seg]}', '#{@col[:lv0]}', '#{@col[:lv1]}', '#{@col[:lv2]}', '#{@col[:lv3]}', '#{@col[:lv4]}', '#{@col[:lv5]}', '#{@col[:lv6]}', '#{@col[:lv7]}', '#{@col[:en_a]}', '#{@col[:en_z]}', '#{@col[:t_of]}', '#{@col[:t_is]}', '#{@col[:node]}', '#{@col[:parent]}', '#{@col[:digest_clean]}', '#{@col[:digest_all]}');"
- else
- "INSERT INTO doc_objects (lid, metadata_tid, lev, lev_an, clean, body, book_idx, ocn, ocnd, ocns, seg, lev0, lev1, lev2, lev3, lev4, lev5, lev6, lev7, t_of, t_is, node, parent, digest_clean, digest_all) " +
- "VALUES (#{@col[:lid]}, #{@col[:tid]}, #{@col[:lev]}, '#{@col[:lev_an]}', '#{@col[:plaintext]}', '#{@col[:body]}', '#{@col[:book_idx]}', '#{@col[:ocn]}', '#{@col[:ocnd]}', '#{@col[:ocns]}', '#{@col[:seg]}', '#{@col[:lv0]}', '#{@col[:lv1]}', '#{@col[:lv2]}', '#{@col[:lv3]}', '#{@col[:lv4]}', '#{@col[:lv5]}', '#{@col[:lv6]}', '#{@col[:lv7]}', '#{@col[:t_of]}', '#{@col[:t_is]}', '#{@col[:node]}', '#{@col[:parent]}', '#{@col[:digest_clean]}', '#{@col[:digest_all]}');"
- end
- if @opt.act[:verbose_plus][:set]==:on
- if @opt.act[:maintenance][:set]==:on
- puts @file_maint.inspect
- puts sql_entry
- end
- @file_maint.puts sql_entry
- else
- if @opt.act[:verbose_plus][:set]==:on
- puts sql_entry
- @file_maint.puts sql_entry
- end
- end
- if @opt.act[:verbose][:set]==:on
- if @col[:lev].inspect =~/[0-35-7]/
- lev=case @col[:lev].inspect
- when /0/ then ':A'
- when /1/ then ':B'
- when /2/ then ':C'
- when /3/ then ':D'
- when /5/ then ' 2'
- when /6/ then ' 3'
- when /7/ then ' 4'
- end
- puts %{#{lev}>\t#{@col[:lv0]}\t#{@col[:lv1]}\t#{@col[:lv2]}\t#{@col[:lv3]}\t#{@col[:lv4]}\t#{@col[:lv5]}\t#{@col[:lv6]}\t#{@col[:lv7]}\t#{@col[:ocn]}\t#{@col[:node]}\t#{@col[:ocns]}}
- elsif @col[:lev].inspect =~/[4]/
- puts %{ #{@cX.green}1>#{@cX.off}\t#{@col[:lv0]}\t#{@col[:lv1]}\t#{@col[:lv2]}\t#{@col[:lv3]}\t#{@col[:lv4]}\t#{@col[:lv5]}\t#{@col[:lv6]}\t#{@col[:lv7]}\t#{@col[:ocn]}\t#{@col[:node]}\t#{@col[:ocns]}\t#{@col[:seg]}}
- end
- end
- sql_entry
- end
- end
- class LoadMetadata #< SiSU_DbColumns::Columns
- def initialize(conn,id,md,file_maint)
- @conn,@id,@md,@file_maint=conn,id,md,file_maint
- @tp=SiSU_DbColumns::Columns.new(md)
- end
- def tuple
- sql_entry="INSERT INTO metadata_and_text (
-#{@tp.column.title.tuple[0]}
-#{@tp.column.title_main.tuple[0]}
-#{@tp.column.title_sub.tuple[0]}
-#{@tp.column.title_short.tuple[0]}
-#{@tp.column.title_edition.tuple[0]}
-#{@tp.column.title_note.tuple[0]}
-#{@tp.column.title_language.tuple[0]}
-#{@tp.column.title_language_char.tuple[0]}
-#{@tp.column.creator_author.tuple[0]}
-#{@tp.column.creator_author_honorific.tuple[0]}
-#{@tp.column.creator_author_nationality.tuple[0]}
-#{@tp.column.creator_editor.tuple[0]}
-#{@tp.column.creator_contributor.tuple[0]}
-#{@tp.column.creator_illustrator.tuple[0]}
-#{@tp.column.creator_photographer.tuple[0]}
-#{@tp.column.creator_translator.tuple[0]}
-#{@tp.column.creator_prepared_by.tuple[0]}
-#{@tp.column.creator_digitized_by.tuple[0]}
-#{@tp.column.creator_audio.tuple[0]}
-#{@tp.column.creator_video.tuple[0]}
-#{@tp.column.language_document.tuple[0]}
-#{@tp.column.language_document_char.tuple[0]}
-#{@tp.column.language_original.tuple[0]}
-#{@tp.column.language_original_char.tuple[0]}
-#{@tp.column.date_added_to_site.tuple[0]}
-#{@tp.column.date_available.tuple[0]}
-#{@tp.column.date_created.tuple[0]}
-#{@tp.column.date_issued.tuple[0]}
-#{@tp.column.date_modified.tuple[0]}
-#{@tp.column.date_published.tuple[0]}
-#{@tp.column.date_valid.tuple[0]}
-#{@tp.column.date_translated.tuple[0]}
-#{@tp.column.date_original_publication.tuple[0]}
-#{@tp.column.date_generated.tuple[0]}
-#{@tp.column.publisher.tuple[0]}
-#{@tp.column.original_publisher.tuple[0]}
-#{@tp.column.original_language.tuple[0]}
-#{@tp.column.original_language_char.tuple[0]}
-#{@tp.column.original_source.tuple[0]}
-#{@tp.column.original_institution.tuple[0]}
-#{@tp.column.original_nationality.tuple[0]}
-#{@tp.column.rights_all.tuple[0]}
-#{@tp.column.rights_copyright_text.tuple[0]}
-#{@tp.column.rights_copyright_translation.tuple[0]}
-#{@tp.column.rights_copyright_illustrations.tuple[0]}
-#{@tp.column.rights_copyright_photographs.tuple[0]}
-#{@tp.column.rights_copyright_preparation.tuple[0]}
-#{@tp.column.rights_copyright_digitization.tuple[0]}
-#{@tp.column.rights_copyright_audio.tuple[0]}
-#{@tp.column.rights_copyright_video.tuple[0]}
-#{@tp.column.rights_license.tuple[0]}
-#{@tp.column.classify_topic_register.tuple[0]}
-#{@tp.column.classify_subject.tuple[0]}
-#{@tp.column.classify_loc.tuple[0]}
-#{@tp.column.classify_dewey.tuple[0]}
-#{@tp.column.classify_keywords.tuple[0]}
-#{@tp.column.identifier_oclc.tuple[0]}
-#{@tp.column.identifier_isbn.tuple[0]}
-#{@tp.column.notes_abstract.tuple[0]}
-#{@tp.column.notes_description.tuple[0]}
-#{@tp.column.notes_comment.tuple[0]}
-#{@tp.column.notes_history.tuple[0]}
-#{@tp.column.notes_format.tuple[0]}
-#{@tp.column.notes_relation.tuple[0]}
-#{@tp.column.notes_coverage.tuple[0]}
-#{@tp.column.notes_type.tuple[0]}
-#{@tp.column.notes_prefix.tuple[0]}
-#{@tp.column.notes_prefix_a.tuple[0]}
-#{@tp.column.notes_prefix_b.tuple[0]}
-#{@tp.column.notes_suffix.tuple[0]}
-#{@tp.column.src_filename.tuple[0]}
-#{@tp.column.src_fingerprint.tuple[0]}
-#{@tp.column.src_filesize.tuple[0]}
-#{@tp.column.src_word_count.tuple[0]}
-#{@tp.column.src_txt.tuple[0]}
-#{@tp.column.fulltext.tuple[0]}
-#{@tp.column.links.tuple[0]}
-tid)
-" +
- "VALUES (
-#{@tp.column.title.tuple[1]}
-#{@tp.column.title_main.tuple[1]}
-#{@tp.column.title_sub.tuple[1]}
-#{@tp.column.title_short.tuple[1]}
-#{@tp.column.title_edition.tuple[1]}
-#{@tp.column.title_note.tuple[1]}
-#{@tp.column.title_language.tuple[1]}
-#{@tp.column.title_language_char.tuple[1]}
-#{@tp.column.creator_author.tuple[1]}
-#{@tp.column.creator_author_honorific.tuple[1]}
-#{@tp.column.creator_author_nationality.tuple[1]}
-#{@tp.column.creator_editor.tuple[1]}
-#{@tp.column.creator_contributor.tuple[1]}
-#{@tp.column.creator_illustrator.tuple[1]}
-#{@tp.column.creator_photographer.tuple[1]}
-#{@tp.column.creator_translator.tuple[1]}
-#{@tp.column.creator_prepared_by.tuple[1]}
-#{@tp.column.creator_digitized_by.tuple[1]}
-#{@tp.column.creator_audio.tuple[1]}
-#{@tp.column.creator_video.tuple[1]}
-#{@tp.column.language_document.tuple[1]}
-#{@tp.column.language_document_char.tuple[1]}
-#{@tp.column.language_original.tuple[1]}
-#{@tp.column.language_original_char.tuple[1]}
-#{@tp.column.date_added_to_site.tuple[1]}
-#{@tp.column.date_available.tuple[1]}
-#{@tp.column.date_created.tuple[1]}
-#{@tp.column.date_issued.tuple[1]}
-#{@tp.column.date_modified.tuple[1]}
-#{@tp.column.date_published.tuple[1]}
-#{@tp.column.date_valid.tuple[1]}
-#{@tp.column.date_translated.tuple[1]}
-#{@tp.column.date_original_publication.tuple[1]}
-#{@tp.column.date_generated.tuple[1]}
-#{@tp.column.publisher.tuple[1]}
-#{@tp.column.original_publisher.tuple[1]}
-#{@tp.column.original_language.tuple[1]}
-#{@tp.column.original_language_char.tuple[1]}
-#{@tp.column.original_source.tuple[1]}
-#{@tp.column.original_institution.tuple[1]}
-#{@tp.column.original_nationality.tuple[1]}
-#{@tp.column.rights_all.tuple[1]}
-#{@tp.column.rights_copyright_text.tuple[1]}
-#{@tp.column.rights_copyright_translation.tuple[1]}
-#{@tp.column.rights_copyright_illustrations.tuple[1]}
-#{@tp.column.rights_copyright_photographs.tuple[1]}
-#{@tp.column.rights_copyright_preparation.tuple[1]}
-#{@tp.column.rights_copyright_digitization.tuple[1]}
-#{@tp.column.rights_copyright_audio.tuple[1]}
-#{@tp.column.rights_copyright_video.tuple[1]}
-#{@tp.column.rights_license.tuple[1]}
-#{@tp.column.classify_topic_register.tuple[1]}
-#{@tp.column.classify_subject.tuple[1]}
-#{@tp.column.classify_loc.tuple[1]}
-#{@tp.column.classify_dewey.tuple[1]}
-#{@tp.column.classify_keywords.tuple[1]}
-#{@tp.column.identifier_oclc.tuple[1]}
-#{@tp.column.identifier_isbn.tuple[1]}
-#{@tp.column.notes_abstract.tuple[1]}
-#{@tp.column.notes_comment.tuple[1]}
-#{@tp.column.notes_description.tuple[1]}
-#{@tp.column.notes_history.tuple[1]}
-#{@tp.column.notes_format.tuple[1]}
-#{@tp.column.notes_relation.tuple[1]}
-#{@tp.column.notes_coverage.tuple[1]}
-#{@tp.column.notes_type.tuple[1]}
-#{@tp.column.notes_prefix.tuple[1]}
-#{@tp.column.notes_prefix_a.tuple[1]}
-#{@tp.column.notes_prefix_b.tuple[1]}
-#{@tp.column.notes_suffix.tuple[1]}
-#{@tp.column.src_filename.tuple[1]}
-#{@tp.column.src_fingerprint.tuple[1]}
-#{@tp.column.src_filesize.tuple[1]}
-#{@tp.column.src_word_count.tuple[1]}
-#{@tp.column.src_txt.tuple[1]}
-#{@tp.column.fulltext.tuple[1]}
-#{@tp.column.links.tuple[1]}
-#{@id}
-);"
- if @md.opt.act[:maintenance][:set]==:on
- puts "maintenance mode on: creating sql transaction file (for last transaction set (document) only):\n\t#{@file_maint.inspect}"
- @file_maint.puts sql_entry
- else
- if @md.opt.act[:verbose_plus][:set]==:on
- @file_maint.puts sql_entry
- end
- end
- sql_entry
- end
- end
- class LoadUrls
- def initialize(conn,f,u,id,opt,file_maint)
- @conn,@f,@u,@id,@opt,@file_maint=conn,f,u,id,opt,file_maint
- end
- def tuple
- sql_entry="INSERT INTO urls (#{@f[:txt]} #{@f[:html_toc]} #{@f[:html_doc]} #{@f[:xhtml]} #{@f[:xml_sax]} #{@f[:xml_dom]} #{@f[:odf]} #{@f[:pdf_p]} #{@f[:pdf_l]} #{@f[:concordance]} #{@f[:latex_p]} #{@f[:latex_l]} #{@f[:manifest]} #{@f[:digest]} #{@f[:markup]} #{@f[:sisupod]} metadata_tid) " +
- "VALUES (#{@u[:txt]} #{@u[:html_toc]} #{@u[:html_doc]} #{@u[:xhtml]} #{@u[:xml_sax]} #{@u[:xml_dom]} #{@u[:odf]} #{@u[:pdf_p]} #{@u[:pdf_l]} #{@u[:concordance]} #{@u[:latex_p]} #{@u[:latex_l]} #{@u[:manifest]} #{@u[:digest]} #{@u[:markup]} #{@u[:sisupod]} #{@id});"
- if @opt.act[:maintenance][:set]==:on
- @file_maint.puts sql_entry
- else
- if @opt.act[:verbose_plus][:set]==:on
- @file_maint.puts sql_entry
- end
- end
- sql_entry
- end
- end
- class LoadEndnotes
- def initialize(conn,en,opt,file_maint)
- @conn,@en,@opt,@file_maint=conn,en,opt,file_maint
- end
- def tuple
- sql_entry="INSERT INTO #{@en[:type]} (nid, document_lid, nr, clean, body, ocn, ocnd, ocns, metadata_tid, digest_clean) " +
- "VALUES ('#{@en[:id]}', '#{@en[:lid]}', '#{@en[:nr]}', '#{@en[:txt]}', '#{@en[:body]}', '#{@en[:ocn]}', '#{@en[:ocnd]}', '#{@en[:ocns]}', '#{@en[:id_t]}', '#{@en[:hash]}');"
- if @opt.act[:maintenance][:set]==:on
- @file_maint.puts sql_entry
- else
- if @opt.act[:verbose_plus][:set]==:on
- @file_maint.puts sql_entry
- end
- end
- sql_entry
- end
- end
-end
-__END__
diff --git a/lib/sisu/current/db_remove.rb b/lib/sisu/current/db_remove.rb
deleted file mode 100644
index c8287aa..0000000
--- a/lib/sisu/current/db_remove.rb
+++ /dev/null
@@ -1,182 +0,0 @@
-# encoding: utf-8
-=begin
-
-* Name: SiSU
-
-** Description: documents, structuring, processing, publishing, search
-*** modules shared by the different db types, dbi, postgresql, sqlite
-
-** Author: Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
-** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
- All Rights Reserved.
-
-** License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
-** SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
-** Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
-** Git
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/db_remove.rb;hb=HEAD>
-
-=end
-module SiSU_DbRemove
- class Remove
- include SiSU_DbAction
- def initialize(opt,conn,file,sql_type)
- @opt,@conn,@file,@sql_type=opt,conn,file,sql_type
- @md=SiSU_Param::Parameters.new(@opt).get
- @fnb=@md.fnb
- @db=SiSU_Env::InfoDb.new
- end
- def remove
- driver_sqlite3=if @sql_type==:sqlite
- (@conn.inspect.match(/^(.{10})/)[1]==@db.sqlite.conn_sqlite3.inspect.match(/^(.{10})/)[1]) \
- ? true
- : false
- end
- del_id=if driver_sqlite3
- begin
- remove_selected=%{
- SELECT tid
- FROM metadata_and_text
- WHERE src_filename = '#{@md.fns}'
- AND metadata_and_text.language_document_char = '#{@opt.lng}'
- ;} # note, for .ssm: @md.fns (is set during runtime & is) != @opt.fns @md.opt.fns
- @conn.get_first_value(remove_selected).to_i
- rescue SQLite3::Exception => e
- #not tested
- puts "Exception occurred"
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).mark(e.inspect)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).mark(
- "\n" \
- + 'Attempting to initialize db' + "\n" \
- + 'Creating db tables'
- )
- sdb={
- create: SiSU_DbDBI::Create.new(@opt,@conn,@file_maint,@sql_type),
- index: SiSU_DbDBI::Index.new(@opt,@conn,@file_maint,@sql_type),
- }
- db_action(sdb).create
- end
- else
- begin
- remove_selected=%{
- SELECT metadata_and_text.tid
- FROM metadata_and_text
- WHERE metadata_and_text.src_filename = '#{@md.fns}'
- AND metadata_and_text.language_document_char = '#{@opt.lng}'
- ;} # note, for .ssm: @md.fns (is set during runtime & is) != @opt.fns @md.opt.fns
- x=@conn.exec(remove_selected)
- x.field_values("tid")[0]
- rescue PG::Error => e
- err=[
- e.result.error_field( PG::Result::PG_DIAG_SEVERITY ),
- e.result.error_field( PG::Result::PG_DIAG_SQLSTATE ),
- e.result.error_field( PG::Result::PG_DIAG_MESSAGE_PRIMARY ),
- e.result.error_field( PG::Result::PG_DIAG_MESSAGE_DETAIL ),
- e.result.error_field( PG::Result::PG_DIAG_MESSAGE_HINT ),
- e.result.error_field( PG::Result::PG_DIAG_STATEMENT_POSITION ),
- e.result.error_field( PG::Result::PG_DIAG_INTERNAL_POSITION ),
- e.result.error_field( PG::Result::PG_DIAG_INTERNAL_QUERY ),
- e.result.error_field( PG::Result::PG_DIAG_CONTEXT ),
- e.result.error_field( PG::Result::PG_DIAG_SOURCE_FILE ),
- e.result.error_field( PG::Result::PG_DIAG_SOURCE_LINE ),
- e.result.error_field( PG::Result::PG_DIAG_SOURCE_FUNCTION ),
- ]
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).mark("\n" + err.inspect)
- if err[2] =~/relation "\S+?" does not exist/ \
- or err.inspect =~/relation "\S+?" does not exist/
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).mark(
- "\n" \
- + err[2] + "\n" \
- + 'Attempting to initialize db' + "\n" \
- + 'Creating db tables'
- )
- sdb={
- create: SiSU_DbDBI::Create.new(@opt,@conn,@file_maint,@sql_type),
- index: SiSU_DbDBI::Index.new(@opt,@conn,@file_maint,@sql_type),
- }
- db_action(sdb).create
- end
- end
- end
- if del_id
- sql_entry=[
- "DELETE FROM endnotes WHERE metadata_tid = '#{del_id}';",
- "DELETE FROM endnotes_asterisk WHERE metadata_tid = '#{del_id}';",
- "DELETE FROM endnotes_plus WHERE metadata_tid = '#{del_id}';",
- "DELETE FROM doc_objects WHERE metadata_tid = '#{del_id}';",
- "DELETE FROM urls WHERE metadata_tid = '#{del_id}';",
- "DELETE FROM metadata_and_text WHERE metadata_and_text.tid = '#{del_id}';",
- ]
- if driver_sqlite3
- @conn.transaction
- sql_entry.each do |s|
- begin
- @conn.execute(s)
- rescue
- next
- end
- end
- @conn.commit if driver_sqlite3
- else
- sql_entry.each do |s|
- begin
- @conn.exec_params(s)
- rescue
- next
- end
- end
- end
- if @opt.act[:maintenance][:set]==:on
- @file.puts sql_entry
- end
- else
- if (@opt.act[:verbose][:set]==:on \
- || @opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Screen::Ansi.new(
- @opt.selections.str,
- "no such file in database #{@db.psql.db}::#{@opt.fns}"
- ).puts_grey
- end
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/current/db_select.rb b/lib/sisu/current/db_select.rb
deleted file mode 100644
index 284bd13..0000000
--- a/lib/sisu/current/db_select.rb
+++ /dev/null
@@ -1,230 +0,0 @@
-# encoding: utf-8
-=begin
-
-* Name: SiSU
-
-** Description: documents, structuring, processing, publishing, search
-*** modules shared by the different db types, dbi, postgresql, sqlite
-
-** Author: Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
-** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
- All Rights Reserved.
-
-** License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
-** SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
-** Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
-** Git
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/db_select.rb;hb=HEAD>
-
-=end
-module SiSU_DbAction
- def db_action(sdb)
- @sdb=sdb
- def createdb
- @sdb[:create].output_dir?
- begin
- @sdb[:create].create_db
- rescue
- @sdb[:create].output_dir?
- end
- end
- def drop
- @sdb[:drop].drop.tables
- end
- def create
- @sdb[:create].output_dir?
- begin
- @sdb[:create].create_table.metadata_and_text
- @sdb[:create].create_table.doc_objects
- @sdb[:create].create_table.endnotes
- @sdb[:create].create_table.endnotes_asterisk
- @sdb[:create].create_table.endnotes_plus
- @sdb[:create].create_table.urls
- @sdb[:index].create_indexes
- rescue
- SiSU_Errors::Rescued.new($!,$@,'--sqlite').location
- @sdb[:create].output_dir? do
- __LINE__.to_s + ':' + __FILE__
- end
- end
- end
- def import
- db_exist?
- @sdb[:import].marshal_load
- tell=case @sql_type
- when :sqlite
- SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- "sqlite3 #{@db.sqlite.db} database?"
- )
- when :pg
- SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- "pgaccess or psql #{@db.psql.db} database?"
- )
- else '???'
- end
- tell.puts_grey if @opt.act[:verbose][:set]==:on
- end
- def remove
- db_exist?
- @sdb[:remove_doc].remove
- end
- def update
- remove
- import
- end
- self
- end
-end
-module SiSU_DbSelect
- class Case
- include SiSU_DbAction
- def initialize(opt,conn='',sql_type=:pg)
- @opt,@conn,@sql_type=opt,conn,sql_type
- @db=SiSU_Env::InfoDb.new
- @file_maint=sql_maintenance_file
- @sdb={
- create: SiSU_DbDBI::Create.new(@opt,@conn,@file_maint,@sql_type),
- index: SiSU_DbDBI::Index.new(@opt,@conn,@file_maint,@sql_type),
- drop: SiSU_DbDBI::Drop.new(@opt,@conn,@db,@sql_type),
- }
- if (@opt.act[:psql_import][:set]==:on \
- || @opt.act[:psql_update][:set]==:on) \
- or (@opt.act[:sqlite_import][:set]==:on \
- || @opt.act[:sqlite_update][:set]==:on)
- @sdb[:import]=SiSU_DbDBI::Import.new(@opt,@conn,@file_maint,@sql_type)
- @sdb[:remove_doc]=SiSU_DbDBI::Remove.new(@opt,@conn,@file_maint,@sql_type)
- elsif (@opt.act[:psql_remove][:set]==:on \
- or @opt.act[:sqlite_remove][:set]==:on)
- @sdb[:remove_doc]=SiSU_DbDBI::Remove.new(@opt,@conn,@file_maint,@sql_type)
- end
- end
- def db_exist?
- if @sql_type==:sqlite \
- and (not (FileTest.file?(@db.sqlite.db)) \
- or FileTest.zero?(@db.sqlite.db))
- puts %{no connection with sqlite database established, you may need to run:\n} \
- + %{ sisu --sqlite --createall\n} \
- + %{ before attempting to populate the database}
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).mark(
- "\n" \
- + 'Attempting to initialize db' + "\n" \
- + 'Creating db tables'
- )
- db_action(@sdb).create
- end
- if @conn.is_a?(NilClass)
- if @sql_type==:sqlite
- puts %{no connection with sqlite database established, you may need to run:\n} \
- + %{ sisu --sqlite --createall\n} \
- + %{ before attempting to populate the database}
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).mark(
- "\n" \
- + 'Attempting to initialize db' + "\n" \
- + 'Creating db tables'
- )
- db_action(@sdb).create
- @db.sqlite.db
- else
- puts %{no connection with pg database established, you may need to run:\n} \
- + %{ createdb "#{@db.psql.db}"\n} \
- + %{ after that don't forget to run:\n} \
- + %{ sisu --pg --createall\n} \
- + %{ before attempting to populate the database}
- @db.psql.db
- end
- exit
- end
- end
- def sql_maintenance_file
- file=if @opt.act[:maintenance][:set]==:on
- if @opt.fns and not @opt.fns.empty?
- @env=SiSU_Env::InfoEnv.new(@opt.fns) if @opt.fns
- if @sql_type ==:sqlite
- puts "\n#{@env.processing_path.sqlite}/#{@opt.fns}.sql"
- end
- @db=SiSU_Env::InfoDb.new
- @job="sqlite3 #{@db.sqlite.db} < #{@env.processing_path.sqlite}/#{@opt.fns}.sql"
- if @sql_type ==:sqlite
- File.new("#{@env.processing_path.sqlite}/#{@opt.fns}.sql",'w+')
- else
- File.new("#{@env.processing_path.postgresql}/#{@opt.fns}.sql",'w+')
- end
- elsif @opt.fns \
- and (@opt.act[:sqlite_create][:set] ==:on \
- || @opt.act[:psql_create][:set] ==:on)
- nil #sort variations later
- else nil
- end
- else nil
- end
- file
- end
- def cases
- if @opt.act[:psql_drop][:set] ==:on \
- or @opt.act[:sqlite_drop][:set] ==:on
- db_action(@sdb).drop
- end
- if @opt.act[:psql_createdb][:set] ==:on \
- or @opt.act[:sqlite_createdb][:set] ==:on
- db_action(@sdb).createdb
- end
- if @opt.act[:psql_create][:set] ==:on \
- or @opt.act[:sqlite_create][:set] ==:on
- db_action(@sdb).create
- end
- if @opt.act[:psql_update][:set] ==:on \
- or @opt.act[:sqlite_update][:set] ==:on
- db_action(@sdb).update
- else
- if @opt.act[:psql_remove][:set] ==:on \
- or @opt.act[:sqlite_remove][:set] ==:on
- db_action(@sdb).remove
- end
- if @opt.act[:psql_import][:set] ==:on \
- or @opt.act[:sqlite_import][:set] ==:on
- db_action(@sdb).import
- end
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/current/db_sqltxt.rb b/lib/sisu/current/db_sqltxt.rb
deleted file mode 100644
index de717cc..0000000
--- a/lib/sisu/current/db_sqltxt.rb
+++ /dev/null
@@ -1,173 +0,0 @@
-# encoding: utf-8
-=begin
-
-* Name: SiSU
-
-** Description: documents, structuring, processing, publishing, search
-*** system environment, resource control and configuration details
-
-** Author: Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
-** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
- All Rights Reserved.
-
-** License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
-** SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
-** Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
-** Git
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/db_sqltxt.rb;hb=HEAD>
-
-=end
-module SiSU_DbText
- class Prepare
- def special_character_escape(str)
- str=str.gsub(/'/m,"''"). #string.gsub!(/'/,"\047") #string.gsub!(/'/,"\\'")
- gsub(/(\\)/m,'\1\1'). #ok but with warnings, double backslash on sqlite #str.gsub!(/[\\]/m,'\\x5C') #ok but with warnings, but not for sqlite #str.gsub!(/(\\)/m,'\1') #ok for sqlite not for pgsql
- gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/m,"<br>\n").
- gsub(/#{Mx[:tag_o]}\S+?#{Mx[:tag_c]}/m,''). #check
- gsub(/#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg))(?:\s+\d+x\d+)?(.+?)#{Mx[:lnk_c]}\S+/m,'[image: \1] \2').
- gsub(/#{Mx[:lnk_o]}\s*(.+?)\s*#{Mx[:lnk_c]}(?:file|ftp):\/\/\S+?([.,!?]?(?:\s|$))/m,'\1\2').
- gsub(/#{Mx[:lnk_o]}\s*(.+?)\s*#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/m,'\1')
- end
- def clean_searchable_text_from_document_objects(arr)
- en=[]
- arr=(arr.is_a?(String)) ? [ arr ] : arr
- txt_arr=arr.each.map do |s|
- s=s.gsub(/#{Mx[:fa_o]}[a-z]{1,4}#{Mx[:fa_o_c]}/m,'').
- gsub(/#{Mx[:fa_c_o]}[a-z]{1,4}#{Mx[:fa_c]}/m,'').
- gsub(/<br>/m,' ')
- en << s.scan(/#{Mx[:en_a_o]}\s*(.+?)\s*#{Mx[:en_a_c]}/m)
- s=s.gsub(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/m,'').
- gsub(/#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/m,'').
- gsub(/ \s+/m,' ')
- #p s if s =~/[^ \nA-Za-z0-9'"`?!#@$%^&*=+,.;:\[\]()<>{}‹›|\\\/~_-]/
- s
- end
- txt_arr=txt_arr << en
- txt=txt_arr.flatten.join("\n")
- special_character_escape(txt)
- end
- def clean_document_objects_body(arr)
- en=[]
- arr=(arr.is_a?(String)) ? [ arr ] : arr
- txt_arr=arr.each.map do |s|
- en << s.scan(/#{Mx[:en_a_o]}\s*(.+?)\s*#{Mx[:en_a_c]}/m)
- s=s.
- gsub(/#{Mx[:en_a_o]}\s*(\d+).+?#{Mx[:en_a_c]}/m,
- '<sup>\1</sup>').
- gsub(/#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/m,'').
- gsub(/ \s+/m,' ')
- s
- end
- en_arr=en.flatten.each.map do |e|
- e.sub(/^(\d+)\s*/,'<sup>\1</sup> ')
- end
- txt_arr=txt_arr << en_arr
- txt=txt_arr.flatten.join("\n<br>")
- special_character_escape(txt)
- end
- def clean_searchable_text_from_document_source(arr)
- txt_arr,en=[],[]
- arr=(arr.is_a?(String)) ? arr.split(/\n+/m) : arr
- arr.each do |s|
- s=s.gsub(/([*\/_-])\{(.+?)\}\1/m,'\2').
- gsub(/^(?:block|group|poem|code)\{/m,'').
- gsub(/^\}(?:block|group|poem|code)/m,'').
- gsub(/\A(?:@\S+:\s+.+)\Z/m,'')
- if s =~/^:A~/
- if defined? @md.creator \
- and defined? @md.creator.author \
- and not @md.creator.author.empty?
- s=s.gsub(/@author/,@md.creator.author)
- else
- SiSU_Screen::Ansi.new(
- 'v',
- 'WARNING Document Author information missing; provide @creator: :author:',
- @md.fnb
- ).warn unless @md.opt.act[:quiet][:set]==:on
- end
- if defined? @md.title \
- and defined? @md.title.full \
- and not @md.title.full.empty?
- s=s.gsub(/@title/,@md.title.full)
- else
- SiSU_Screen::Ansi.new(
- 'v',
- 'WARNING Document Title missing; provide @title:',
- @md.fnb
- ).warn unless @md.opt.act[:quiet][:set]==:on
- end
- end
- s=s.gsub(/^(?:_[1-9]\*?|_\*)\s+/m,'').
- gsub(/^(?:[1-9]\~(\S+)?)\s+/m,'').
- gsub(/^(?::?[A-C]\~(\S+)?)\s+/m,'').
- gsub(/^%{1,3} .+/m,''). #removed even if contained in code block
- gsub(/<br>/m,' ')
- #en << s.scan(/~\{\s*(.+?)\s*\}~/m)
- s=s.gsub(/~\{.+?\}~/m,'').
- gsub(/ \s+/m,' ')
- ##special_character_escape(s)
- #p s if s =~/[^ \nA-Za-z0-9'"`?!#@$%^&*=+,.;:\[\]()<>{}‹›|\\\/~_-]/
- s
- end
- txt_arr << arr << en
- txt=txt_arr.flatten.join("\n")
- txt=special_character_escape(txt)
- txt
- end
- def strip_markup(str) #define rules, make same as in dal clean
- str=str.gsub(/#{Mx[:fa_superscript_o]}(\d+)#{Mx[:fa_superscript_c]}/,'[\1]').
- gsub(/(?:&nbsp\\;|#{Mx[:nbsp]})+/,' ').
- gsub(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}\d+(.+)#{Mx[:tc_c]}/u,'\1'). #tables
- gsub(/#{Mx[:tc_p]}#{Mx[:tc_p]}\d+#{Mx[:tc_p]}/u,' '). #tables
- gsub(/#{Mx[:tc_p]}/u,' '). #tables tidy later
- gsub(/<.+?>/,'').
- gsub(/#{Mx[:lnk_o]}.+?\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:file|ftp)\/\/:\S+ /,' [image] '). # else image names found in search
- gsub(/#{Mx[:lnk_o]}.+?\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,' [image]'). # else image names found in search
- gsub(/\s\s+/,' ').
- strip
- end
- def unique_words(str)
- a=str.scan(/[a-zA-Z0-9\\\/_-]{2,}/) #a=str.scan(/\S+{2,}/)
- str=a.uniq.sort.join(' ')
- str
- end
- end
-end
-__END__
diff --git a/lib/sisu/current/dbi.rb b/lib/sisu/current/dbi.rb
deleted file mode 100644
index 93e4769..0000000
--- a/lib/sisu/current/dbi.rb
+++ /dev/null
@@ -1,166 +0,0 @@
-# encoding: utf-8
-=begin
-
-* Name: SiSU
-
-** Description: documents, structuring, processing, publishing, search
-*** postgresql module, dbi import frame
-
-** Author: Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
-** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
- All Rights Reserved.
-
-** License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
-** SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
-** Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
-** Git
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/dbi.rb;hb=HEAD>
-
-=end
-module SiSU_DBI #% database building
- require_relative 'se' # se.rb
- include SiSU_Env; include SiSU_Screen
- require_relative 'dp' # dp.rb
- include SiSU_Param
- require_relative 'db_dbi' # db_dbi.rb
- include SiSU_DbDBI
- require_relative 'html_lite_shared' # html_lite_shared.rb
- include SiSU_FormatShared
- class SQL
- def initialize(opt)
- @opt=opt
- @db=SiSU_Env::InfoDb.new
- if @opt.act[:psql][:set]==:on \
- or @opt.act[:sqlite][:set]==:on
- @sql_type=if @opt.act[:psql][:set]==:on
- maintenance_check(@opt,__FILE__,__LINE__) if @opt.act[:maintenance][:set]==:on
- :pg
- elsif @opt.act[:psql][:set]==:on
- maintenance_check(@opt,__FILE__,__LINE__) if @opt.act[:maintenance][:set]==:on
- :pg
- elsif @opt.act[:sqlite][:set]==:on
- maintenance_check(@opt,__FILE__,__LINE__) if @opt.act[:maintenance][:set]==:on
- :sqlite
- elsif @opt.act[:sqlite][:set]==:on
- maintenance_check(@opt,__FILE__,__LINE__) if @opt.act[:maintenance][:set]==:on
- :sqlite
- else
- maintenance_check(@opt,__FILE__,__LINE__) if @opt.act[:maintenance][:set]==:on
- :sqlite
- end
- if @sql_type==:pg then SiSU_Env::Load.new('pg',true).prog
- elsif @sql_type==:sqlite then SiSU_Env::Load.new('sqlite3',true).prog
- end
- end
- end
- def maintenance_check(opt,file,line)
- p opt.selections.str
- p "at #{file} #{line}"
- end
- def read_psql
- begin
- begin
- require 'pg'
- rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
- error('pg NOT FOUND (LoadError)')
- end
- @conn=@db.psql.conn_pg
- rescue
- if @opt.act[:psql_create][:set]==:on
- cX=SiSU_Screen::Ansi.new(@opt.act[:color_state][:set]).cX
- puts <<-WOK
-manually create the database: "#{cX.green}#{@db.db}#{cX.off}" if it does not yet exist
- #{cX.yellow}createdb #{@db.db}#{cX.off}
- WOK
- #sudo su -p postgres; createdb #{@db.db}; #[createuser?]
- end
- ensure
- end
- end
- def read_sqlite
- begin
- begin
- begin
- require 'sqlite3'
- rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
- error('sqlite3 NOT FOUND (LoadError)')
- end
- @conn=@db.sqlite.conn_sqlite3
- rescue LoadError
- errmsg='sqlite3 NOT FOUND (LoadError)'
- if @opt.act[:no_stop][:set]==:on
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
- error(errmsg + ', ' + 'attempt to proceed without sqlite output (as requested)')
- else
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
- error(errmsg + ', ' + 'STOPPING')
- exit
- end
- end
- end
- end
- def connect
- case @sql_type
- when :pg then read_psql #read_pg
- when :sqlite then read_sqlite
- end
- SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- "SQL DB #{@sql_type.upcase}",
- @opt.fno
- ).dbi_title unless @opt.act[:quiet][:set]==:on
- begin
- SiSU_DbDBI::Case.new(@opt,@conn,@sql_type).cases
- rescue
- SiSU_Errors::Rescued.new($!,$@,@cf,@opt.fns).location do
- __LINE__.to_s + ':' + __FILE__
- end
- ensure
- end
- begin
- rescue
- connect
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/current/dp.rb b/lib/sisu/current/dp.rb
deleted file mode 100644
index 8526477..0000000
--- a/lib/sisu/current/dp.rb
+++ /dev/null
@@ -1,1606 +0,0 @@
-# encoding: utf-8
-=begin
-
-* Name: SiSU
-
-** Description: documents, structuring, processing, publishing, search
-*** document parameters extracted from input files for program use
-
-** Author: Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
-** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
- All Rights Reserved.
-
-** License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
-** SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
-** Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
-** Git
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/dp.rb;hb=HEAD>
-
-=end
-module SiSU_Param
- begin
- require 'uri'
- require 'pstore'
- rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
- error('uri or pstore NOT FOUND (LoadError)')
- end
- require_relative 'se' # se.rb
- include SiSU_Env
- require_relative 'dp_make' # dp_make.rb
- require_relative 'dp_identify_markup' # dp_identify_markup.rb
- @@date=SiSU_Env::InfoDate.new
- @doc={
- initialise: nil,
- markup: '',
- lnks: '',
- stmp: '',
- req: {},
- }
- @@trigger=nil
- @@lv,@@flag={},{}
- @@tex_backslash="\\\\"
- class Parameters
- @@publisher='SiSU scribe'
- @@md=@@fns=@@pth=nil
- def initialize(opt)
- @opt=opt
- @cX||=SiSU_Screen::Ansi.new(@opt.act[:color_state][:set])
- @fns=if @opt.act[:psql][:set] == [:on] #revisit CHECK
- opt.fns
- else opt.fns.gsub(/\.ssm$/,'.ssm.sst')
- end
- SiSU_Param::Instantiate.new.param_instantiate
- @env=SiSU_Env::InfoEnv.new(@fns)
- @pstorefile="#{@env.processing_path.ao}/#{@fns}.pstore"
- end
- def get
- if @opt.f_pth \
- and @opt.f_pth[:pth] != Dir.pwd #BUG check
- # you may need to change Dir.pwd to @opt.f_pth[:pth] where the latter
- # has a path value that is different, however, f_pth is not always set!
- Dir.chdir(@opt.f_pth[:pth])
- end
- if @@fns !=@fns \
- or @@pth !=Dir.pwd #@opt.f_pth[:pth]
- @@fns,@@pth=@fns,Dir.pwd #@opt.f_pth[:pth]
- @@md=nil
- end
- if @@md.nil? \
- or @opt.act[:maintenance][:set]==:on #not particularly helpful, as current cycle is through output types, with files changing, only helpful if deal with a file all output types before going to next file
- if File.exist?(@pstorefile)
- param_msg='Parameters from pstore'
- store=PStore.new(@pstorefile)
- store.transaction do
- @md=store['md']
- end
- @md
- else
- param_msg='Parameters extracted'
- fns_array=@env.read_source_file(@opt.fns)
- @md=SiSU_Param::Parameters::Instructions.new(fns_array,@opt).extract
- @md
- end
- if defined? @md.title.main # on removal check problems with -U
- if (@opt.act[:verbose][:set]==:on \
- || @opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- param_msg,
- @md.title.main
- ).txt_grey
- end
- end
- @@md=@md
- else @@md
- end
- begin
- @@md.opt=@opt
- @@md
- rescue
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
- mark('has an existing option been selected?')
- exit
- end
- end
- class MdDefault
- def rights(author,date)
- @author,@date=author,date
- def assignment(author)
- 'copyright not explicitly stated, ' \
- + 'program "assigning" copyright to author: ' \
- + author
- end
- def all
- s=nil
- if @author
- #puts assignment(@author)
- s ||=((@date =~/((?:1[4-9]|2[01])\d{2})/ ) \
- ? ("Copyright (C) #{$1} #{@author}")
- : ('Copyright (C)' + @author)) #matches years 1400 through 21\d\d
- end
- s
- end
- def copyright_and_license
- s=nil
- if @author
- #puts assignment(@author)
- s ||=((@date =~/((?:1[4-9]|2[01])\d{2})/ ) \
- ? ("Copyright (C) #{$1} #{@author}")
- : ('Copyright (C)' + @author)) #matches years 1400 through 21\d\d
- end
- s
- end
- def text
- all
- end
- def copyright
- def all
- s=nil
- if @author
- s ||=((@date =~/((?:1[4-9]|2[01])\d{2})/ ) \
- ? ("Copyright (C) #{$1} #{@author}")
- : ('Copyright (C)' + @author)) #matches years 1400 through 21\d\d
- end
- s
- end
- def text
- all
- end
- self
- end
- self
- end
- end
- class MdMake < SiSU_Param_Make::MdMake
- end
- class Md
- def initialize(str,opt,env)
- @s,@opt,@env=str,opt,env
- end
- def validate_length(s,l,n)
- #s=(s.length <= l) ? s : nil
- s=if s.is_a?(String) \
- and s.length <= l
- s
- elsif s.is_a?(NilClass)
- nil
- elsif s.class !=String
- STDERR.puts "#{n} is #{s.class}: programming error, String expected #{__FILE__}:#{__LINE__}"
- s
- else
- SiSU_Screen::Ansi.new(
- 'v',
- "*WARN* #{n} length #{s.length} exceeds set db field length #{l}, metadata dropped",
- @opt.fns
- ).warn unless @opt.act[:quiet][:set]==:on
- nil
- end
- end
- def name_format(name)
- if name
- name=name.strip
- @name_a_h=[]
- authors=name.scan(/[^;]+/)
- authors.each_with_index do |a,i|
- b=((a =~/\s*\|\s*/) ? (a.split(/\|/)) : [a])
- if b[0] =~/"(.+?)"/
- @name_a_h << { the: $1 }
- else
- x=b[0].scan(/[^,]+/)
- if x.length==1
- @name_a_h << { the: x[0].strip }
- elsif x.length==2
- @name_a_h << { the: x[0].strip, others: x[1].strip }
- else #p x.length
- end
- end
- b.delete_at(0)
- b.each do |d|
- k,c=nil
- k,c=/^(\S+)\s+(.*)/.match(d)[1,2] if d
- @name_a_h[i][:hon]=c.strip if k=='hon'
- @name_a_h[i][:affiliation]=c.strip if k=='affiliation'
- @name_a_h[i][:nationality]=c.strip if k=='nationality'
- end
- end
- l=@name_a_h.length
- name_str=''
- @name_a_h.each_with_index do |a,i|
- name_str += if a[:others]
- z=(((l - i) > 1) ? ', ' : '')
- "#{a[:others].strip} #{a[:the].strip}" + z
- else
- z=(((l - i) > 2) ? ', ' : '')
- "#{a[:the].strip}" + z
- end
- end
- { name_a_h: @name_a_h, name_str: name_str }
- else nil
- end
- end
- def build_hash(arr)
- @h={}
- arr.each_with_index do |x,i|
- a,b=nil,nil
- if x =~/^%\s/ #ignore comment
- elsif x =~/:(\S+?):\s+(.+)/
- a,b=/:(\S+?):\s+(.+)\Z/m.match(x)[1,2]
- b=b.gsub(/\s*<br(?: \/)?>\s*/,' \\\\\\ ')
- b=if b =~/\n/m
- (b =~/;\n/m) \
- ? (b.split(/;\s*\n\s*/).join(';'))
- : (b.split(/\s*\n\s*/).join(' '))
- else
- b
- end
- elsif i == 0
- a='main'
- b=x
- else
- end
- @h[a]=b
- end
- @h
- end
- def title
- a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m)
- @h=build_hash(a)
- def main
- s=@h['main']
- l,n=Db[:col_title_part],'title.main'
- validate_length(s,l,n)
- end
- def sub
- s=@h['subtitle']
- l,n=Db[:col_title_part],'title.subtitle'
- validate_length(s,l,n)
- end
- def edition
- s=@h['edition']
- l,n=Db[:col_title_edition],'title.edition'
- validate_length(s,l,n)
- end
- def note
- s=@h['note']
- l,n=Db[:col_info_note],'title.note'
- validate_length(s,l,n)
- end
- def short
- s=@h['short'] \
- ? @h['short']
- : @h['main']
- l,n=Db[:col_title_part],'title.short'
- validate_length(s,l,n)
- end
- def full
- s=@h['subtitle'] \
- ? (@h['main'] + ' - ' + @h['subtitle'])
- : @h['main']
- l,n=Db[:col_title],'title.full'
- validate_length(s,l,n)
- end
- def language
- s=@h['language']
- l,n=Db[:col_language],'title.language'
- validate_length(s,l,n)
- end
- def language_char # look into, this must be set, from 1 directory stub (.fi), 2 filename (~fi), [3 (not used) document header (@title:\n :language_char: fi)]
- s=@h['language_char']
- l,n=Db[:col_language_char],'title.language_char'
- validate_length(s,l,n)
- end
- self
- end
- def creator #there are sub categories that need to be catered for and sometimes more than one author etc.; implement array.to_s.length validation test later, current test on string approximate as string is not used
- a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m)
- @h=build_hash(a)
- def author
- @h['author']=(@h['author'] \
- ? @h['author']
- : @h['main'])
- names=name_format(@h['author'])
- s=names[:name_str]
- l,n=Db[:col_name],'creator.author'
- validate_length(s,l,n)
- end
- def author_detail
- s=@h['author'] \
- ? @h['author']
- : @h['main']
- names=name_format(s)
- names[:name_a_h]
- end
- def editor
- names=@h['editor'] \
- ? name_format(@h['editor'])
- : nil
- s=(names.is_a?(Hash)) \
- ? names[:name_str]
- : nil
- s=if s
- l,n=Db[:col_name],'creator.editor'
- validate_length(s,l,n)
- else nil
- end
- end
- def editor_detail
- names=@h['editor'] \
- ? name_format(@h['editor'])
- : nil
- (names.is_a?(Hash)) \
- ? names[:name_a_h]
- : nil
- end
- def contributor
- names=@h['contributor'] \
- ? name_format(@h['contributor'])
- : nil
- s=(names.is_a?(Hash)) \
- ? names[:name_str]
- : nil
- s=if s
- l,n=Db[:col_name],'creator.author'
- validate_length(s,l,n)
- else nil
- end
- end
- def contributor_detail
- names=@h['contributor'] \
- ? name_format(@h['contributor'])
- : nil
- (names.is_a?(Hash)) \
- ? names[:name_a_h]
- : nil
- end
- def illustrator
- names=@h['illustrator'] \
- ? name_format(@h['illustrator'])
- : nil
- s=(names.is_a?(Hash)) \
- ? names[:name_str]
- : nil
- s=if s
- l,n=Db[:col_name],'creator.illustrator'
- validate_length(s,l,n)
- else nil
- end
- end
- def illustrator_detail
- names=@h['illustrator'] \
- ? name_format(@h['illustrator'])
- : nil
- (names.is_a?(Hash)) \
- ? names[:name_a_h]
- : nil
- end
- def photographer
- names=@h['photographer'] \
- ? name_format(@h['photographer'])
- : nil
- s=(names.is_a?(Hash)) \
- ? names[:name_str]
- : nil
- s=if s
- l,n=Db[:col_name],'creator.photographer'
- validate_length(s,l,n)
- else nil
- end
- end
- def photographer_detail
- names=@h['photographer'] \
- ? name_format(@h['photographer'])
- : nil
- (names.is_a?(Hash)) \
- ? names[:name_a_h]
- : nil
- end
- def translator
- names=@h['translator'] \
- ? name_format(@h['translator'])
- : nil
- s=(names.is_a?(Hash)) \
- ? names[:name_str]
- : nil
- s=if s
- l,n=Db[:col_name],'creator.translator'
- validate_length(s,l,n)
- else nil
- end
- end
- def translator_detail
- names=@h['translator'] \
- ? name_format(@h['translator'])
- : nil
- (names.is_a?(Hash)) \
- ? names[:name_a_h]
- : nil
- end
- def audio
- names=@h['audio'] \
- ? name_format(@h['audio'])
- : nil
- s=(names.is_a?(Hash)) \
- ? names[:name_str]
- : nil
- s=if s
- l,n=Db[:col_name],'creator.audio'
- validate_length(s,l,n)
- else nil
- end
- end
- def audio_detail
- names=@h['audio'] \
- ? name_format(@h['audio'])
- : nil
- (names.is_a?(Hash)) \
- ? names[:name_a_h]
- : nil
- end
- def digitized_by
- names=@h['digitized_by'] \
- ? name_format(@h['digitized_by'])
- : nil
- s=(names.is_a?(Hash)) \
- ? names[:name_str]
- : nil
- s=if s
- l,n=Db[:col_name],'creator.digitized_by'
- validate_length(s,l,n)
- else nil
- end
- end
- def digitized_by_detail
- names=@h['digitized_by'] \
- ? name_format(@h['digitized_by'])
- : nil
- (names.is_a?(Hash)) \
- ? names[:name_a_h]
- : nil
- end
- def prepared_by
- names=@h['prepared_by'] \
- ? name_format(@h['prepared_by'])
- : nil
- s=(names.is_a?(Hash)) \
- ? names[:name_str]
- : nil
- s=if s
- l,n=Db[:col_name],'creator.prepared_by'
- validate_length(s,l,n)
- else nil
- end
- end
- def prepared_by_detail
- names=@h['prepared_by'] \
- ? name_format(@h['prepared_by'])
- : nil
- names=name_format(@h['prepared_by'])
- (names.is_a?(Hash)) \
- ? names[:name_a_h]
- : nil
- end
- self
- end
- def rights
- a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m)
- @h=build_hash(a)
- def copyright
- def text #you may wish to expand to take from all
- s=if @h['copyright'] then @h['copyright']
- elsif @h['text'] then @h['text']
- elsif @h['main'] then @h['main']
- else
- SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- 'WARNING Document Copyright missing; provide @rights: :copyright:'
- ).warn if (@opt.act[:verbose][:set]==:on \
- || @opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- ''
- end
- l,n=Db[:col_info_note],'rights.copyright.text'
- validate_length(s,l,n)
- end
- def translation
- s=@h['translation'] \
- ? @h['translation']
- : nil
- l,n=Db[:col_info_note],'rights.copyright.translation'
- validate_length(s,l,n)
- end
- def illustrations
- s=@h['illustrations'] \
- ? @h['illustrations']
- : nil
- l,n=Db[:col_info_note],'rights.copyright.illustrations'
- validate_length(s,l,n)
- end
- def photographs
- s=@h['photographs'] \
- ? @h['photographs']
- : nil
- l,n=Db[:col_info_note],'rights.copyright.photographs'
- validate_length(s,l,n)
- end
- def digitization
- s=@h['digitization'] \
- ? @h['digitization']
- : nil
- l,n=Db[:col_info_note],'rights.copyright.digitization'
- validate_length(s,l,n)
- end
- def audio
- s=@h['audio'] \
- ? @h['audio']
- : nil
- l,n=Db[:col_info_note],'rights.copyright.audio'
- validate_length(s,l,n)
- end
- self
- end
- def license
- s=@h['license'] \
- ? @h['license']
- : nil
- l,n=Db[:col_info_note],'rights.license'
- validate_length(s,l,n)
- end
- def sep(str)
- ' \\\\ '
- end
- def copyright_and_license
- s=if @h['copyright_and_license'] then @h['copyright_and_license']
- else
- s=''
- if defined? copyright.text \
- and copyright.text \
- and not copyright.text.empty?
- v=sep(copyright.text)
- s +=copyright.text + v
- end
- if defined? copyright.license \
- and copyright.license \
- and not copyright.license.empty?
- s +=copyright.license
- end
- if s.empty?
- SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- 'WARNING Document Rights information missing; provide @rights: :copyright:'
- ).warn if (@opt.act[:verbose][:set]==:on \
- || @opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- else
- l,n=Db[:col_info_note],'rights.all'
- validate_length(s,l,n)
- end
- s=s.gsub(/ [\\]+\s+$/,'')
- end
- s
- end
- def all
- s=if @h['all'] then @h['all']
- else
- s=''
- if defined? copyright.text \
- and copyright.text \
- and not copyright.text.empty?
- v=sep(copyright.text)
- s +='Copyright: ' + copyright.text + v
- end
- if defined? copyright.translation \
- and copyright.translation \
- and not copyright.translation.empty?
- v=sep(copyright.translation)
- s +='translation: ' + copyright.translation + v
- end
- if defined? copyright.illustrations \
- and copyright.illustrations \
- and not copyright.illustrations.empty?
- v=sep(copyright.illustrations)
- s +='illustrations: ' + copyright.illustrations + v
- end
- if defined? copyright.photographs \
- and copyright.photographs \
- and not copyright.photographs.empty?
- v=sep(copyright.photographs)
- s +='photographs: ' + copyright.photographs + v
- end
- if defined? copyright.digitization \
- and copyright.digitization \
- and not copyright.digitization.empty?
- v=sep(copyright.digitization)
- s +='digitization: ' + copyright.digitization + v
- end
- if defined? copyright.audio \
- and copyright.audio \
- and not copyright.audio.empty?
- v=sep(copyright.audio)
- s +='audio: ' + copyright.audio + v
- end
- if defined? copyright.license \
- and copyright.license \
- and not copyright.license.empty?
- s +='License: ' + copyright.license
- end
- if s.empty?
- SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- 'WARNING Document Rights information missing; provide @rights: :copyright:'
- ).warn if (@opt.act[:verbose][:set]==:on \
- || @opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- else
- l,n=Db[:col_info_note],'rights.all'
- validate_length(s,l,n)
- end
- s=s.gsub(/ [\\]+\s+$/,'')
- end
- s
- end
- self
- end
- def identifier
- a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m)
- @h=build_hash(a)
- def oclc
- s=@h['oclc']
- l,n=Db[:col_library],'identifier.oclc'
- validate_length(s,l,n)
- end
- def isbn
- s=@h['isbn']
- l,n=Db[:col_small],'identifier.isbn'
- validate_length(s,l,n)
- end
- def pg
- s=@h['pg']
- l,n=Db[:col_small],'identifier.pg'
- validate_length(s,l,n)
- end
- self
- end
- def classify
- a=@s.split(/(\n%\s.+?$|[ ]*)(?:\n[ ]*(?=:)|\Z)/m)
- @h=build_hash(a)
- def topic_register
- s=@h['topic_register']
- l,n=Db[:col_info_note],'classify.topic_register'
- validate_length(s,l,n)
- end
- def subject
- s=@h['subject']
- l,n=Db[:col_txt_long],'classify.subject'
- validate_length(s,l,n)
- end
- def keywords
- s=@h['keywords']
- l,n=Db[:col_txt_long],'classify.keywords'
- validate_length(s,l,n)
- end
- def loc
- s=@h['loc']
- l,n=Db[:col_library],'classify.loc'
- validate_length(s,l,n)
- end
- def dewey
- s=@h['dewey']
- l,n=Db[:col_library],'classify.dewey'
- validate_length(s,l,n)
- end
- self
- end
- def publisher
- a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m)
- @h=build_hash(a)
- s=@h['main']
- l,n=Db[:col_name],'publisher'
- validate_length(s,l,n)
- end
- def date
- a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m)
- @h=build_hash(a)
- def added_to_site
- s=@h['added_to_site']
- l,n=Db[:col_date_text],'date.added_to_site'
- validate_length(s,l,n)
- end
- def available
- s=@h['available']
- l,n=Db[:col_date_text],'date.available'
- validate_length(s,l,n)
- end
- def created
- s=@h['created']
- l,n=Db[:col_date_text],'date.created'
- validate_length(s,l,n)
- end
- def issued
- s=@h['issued']
- l,n=Db[:col_date_text],'date.issued'
- validate_length(s,l,n)
- end
- def modified
- s=@h['modified']
- l,n=Db[:col_date_text],'date.modified'
- validate_length(s,l,n)
- end
- def published
- s=@h['published']=(@h['published'] ? @h['published'] : @h['main'])
- l,n=Db[:col_date_text],'date.published'
- validate_length(s,l,n)
- end
- def valid
- s=@h['valid']
- l,n=Db[:col_date_text],'date.valid'
- validate_length(s,l,n)
- end
- self
- end
- #def language # as things stand this should really be populated from title.language and original.language, resolve
- # a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m)
- # @h=build_hash(a)
- # def document
- # s=@h['document']=(@h['document'] ? @h['document'] : @h['main'])
- # l,n=Db[:col_language],'language.document'
- # validate_length(s,l,n)
- # end
- # def document_char
- # s=@h['document_char']=(@h['document_char'] ? @h['document_char'] : nil)
- # l,n=Db[:col_language_char],'language.document_char'
- # validate_length(s,l,n)
- # end
- # def original
- # s=@h['original']
- # l,n=Db[:col_language],'language.original'
- # validate_length(s,l,n)
- # end
- # def original_char
- # s=@h['original_char']
- # l,n=Db[:col_language_char],'language.original_char'
- # validate_length(s,l,n)
- # end
- # self
- #end
- def current_publisher
- @s
- end
- def original
- a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m)
- @h=build_hash(a)
- def publisher
- s=@h['publisher']
- l,n=Db[:col_name],'original.publisher'
- validate_length(s,l,n)
- end
- def language
- s=@h['language']
- l,n=Db[:col_language],'original.language'
- validate_length(s,l,n)
- end
- def language_char
- s=@h['language_char']
- l,n=Db[:col_language_char],'original.language_char'
- validate_length(s,l,n)
- end
- def source
- s=@h['source']
- l,n=Db[:col_name],'original.source'
- validate_length(s,l,n)
- end
- def institution
- s=@h['institution']
- l,n=Db[:col_name],'original.institution'
- validate_length(s,l,n)
- end
- def nationality
- s=@h['nationality']
- l,n=Db[:col_language],'original.nationality'
- validate_length(s,l,n)
- end
- self
- end
- def notes
- a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m)
- @h=build_hash(a)
- def description
- s=@h['description']
- l,n=Db[:col_info_note],'notes.description'
- validate_length(s,l,n)
- end
- def abstract
- s=@h['abstract']
- l,n=Db[:col_info_note],'notes.abstract'
- validate_length(s,l,n)
- end
- def comment
- s=@h['comment']
- l,n=Db[:col_info_note],'notes.comment'
- validate_length(s,l,n)
- end
- def coverage
- s=@h['coverage']
- l,n=Db[:col_info_note],'notes.coverage'
- validate_length(s,l,n)
- end
- def relation
- s=@h['relation']
- l,n=Db[:col_info_note],'notes.relation'
- validate_length(s,l,n)
- end
- def source
- s=@h['source']
- l,n=Db[:col_txt_long],'notes.source'
- validate_length(s,l,n)
- end
- def history
- s=@h['history']
- l,n=Db[:col_txt_long],'notes.history'
- validate_length(s,l,n)
- end
- def type
- s=@h['type']
- l,n=Db[:col_txt_long],'notes.relation'
- validate_length(s,l,n)
- end
- def format
- s=@h['format']
- l,n=Db[:col_txt_short],'notes.format'
- validate_length(s,l,n)
- end
- def prefix
- @h['prefix']
- end
- self
- end
- end
- class Instructions
- @doc={ lv: [] }
- @doc[:fns],@doc[:fnb],@doc[:scr_suffix]='','',''
- @@publisher='SiSU scribe'
- attr_accessor :make,:env,:path,:file,:fn,:fns,:fno,:fnb,:fnn,:fnt,:fnl,:flv,:fnz,:fnstex,:ocn,:sfx_src,:pdf,:file_type,:dir_out,:dir_tex,:dir_lout,:txt_path,:sisu,:project_details,:ruby_version,:title,:subtitle,:full_title,:html_title,:subtitle_tex,:creator,:classify,:author_home,:author,:author_title,:author_nationality,:authors,:authorship,:translator,:illustrator,:prepared_by,:digitized_by,:subject,:description,:publisher,:current_publisher,:contributor,:date,:date_created,:date_issued,:date_available,:date_valid,:date_modified,:date_translated,:date_added_to_site,:date_scheme,:date_created_scheme,:date_issued_scheme,:date_available_scheme,:date_valid_scheme,:date_modified_scheme,:type,:format,:identifier,:source,:language,:language_original,:relation,:coverage,:rights,:keywords,:comments,:abstract,:cls_loc,:cls_dewey,:cls_pg,:cls_isbn,:papersize,:papersize_array,:toc,:lv0,:lv1,:lv2,:lv3,:lv4,:lv5,:lv6,:lvs,:pagenew,:pagebreak,:pageline,:num_top,:bold_match_list,:italics_match_list,:substitution_match_list,:emphasis_set_to,:toc_lev_limit,:flag_biblio,:flag_auto_biblio,:flag_endnotes,:flag_auto_endnotes,:flag_separate_endnotes,:flag_separate_endnotes_make,:markup,:markup_instruction,:flag_tables,:vocabulary,:doc_css,:yaml,:lnk,:links,:prefix_a,:prefix_b,:suffix,:information,:contact,:icon,:image,:ad_url,:ad_png,:ad_alt,:ad_began,:flag_promo,:promo,:ad_home,:stmp,:stmpd,:sc_filename,:sc_number,:sc_date,:sc_time,:sc_info,:yamladdr,:locale,:wc_lines,:wc_words,:wc_bytes,:file_encoding,:filesize,:user,:home,:hostname,:pwd,:firstseg,:programs,:author_copymark,:i18n,:lang,:lang_code_insert,:en,:notes,:dgst,:generated,:tags,:tag_array,:concord_make,:seg_names,:seg_autoname_safe,:set_header_title,:set_heading_top,:set_heading_seg,:heading_seg_first,:heading_seg_first_flag,:base_program,:ec,:opt,:sem_tag,:book_idx,:topic_register,:topic_register_array,:original,:writing_focus,:audio,:daisy,:home_button_image,:home_button_links,:footer_links,:cover_image,:man_section
- def initialize(fns_array,opt)
- @env=@path,@file=@fn=@fns=@fno=@fnb=@fnn=@fnt=@fnl=@flv=@fnz=@fnstex=@ocn=@sfx_src=@pdf=@file_type=@dir_out=@dir_tex=@dir_lout=@txt_path=@make=@flag_biblio=@flag_auto_biblio=@flag_endnotes=@flag_auto_endnotes=@flag_separate_endnotes=@flag_separate_endnotes_make=@sisu=@project_details=@ruby_version=@title=@subtitle=@full_title=@html_title=@subtitle_tex=@creator=@classify=@author_home=@author=@author_title=@author_nationality=@translator=@illustrator=@prepared_by=@digitized_by=@subject=@description=@publisher=@current_publisher=@contributor=@date=@date_created=@date_issued=@date_available=@date_valid=@date_modified=@date_translated=@date_added_to_site=@date_scheme=@date_created_scheme=@date_issued_scheme=@date_available_scheme=@date_valid_scheme=@date_modified_scheme=@type=@format=@identifier=@source=@language=@language_original=@relation=@coverage=@rights=@keywords=@comments=@abstract=@cls_loc=@cls_dewey=@cls_pg=@cls_isbn=@papersize=@toc=@lv0=@lv1=@lv2=@lv3=@lv4=@lv5=@lv6=@pagenew=@pagebreak=@pageline=@num_top=@bold_match_list=@italics_match_list=@substitution_match_list=@emphasis_set_to=@toc_lev_limit=@flag_tables=@vocabulary=@doc_css=@yaml=@lnk=@links=@prefix_a=@prefix_b=@suffix=@information=@contact=@icon=@ad_url=@ad_png=@ad_alt=@ad_began=@promo=@ad_home=@stmp=@stmpd=@sc_filename=@sc_number=@sc_date=@sc_time=@sc_info=@yamladdr=@locale=@wc_lines=@wc_words=@wc_bytes=@file_encoding=@filesize=@firstseg=@programs=@author_copymark=@i18n=@lang=@lang_code_insert=@en=@notes=@dgst=@generated=@heading_seg_first=@base_program=@topic_register=@original=@writing_focus=@audio=@home_button_image=@home_button_links=@cover_image=@man_section=nil
- @data, @path, @fns, @fno, @opt=
- fns_array,opt.pth,opt.fns,opt.fno,opt #@data used as data
- @flag_tables,@set_header_title,@set_heading_top,@set_heading_seg,@heading_seg_first_flag,@flag_promo,@book_idx=
- false, false, false, false, false, false, false
- @seg_autoname_safe=true
- @daisy,@sem_tag=false,false
- @authorship,@markup_instruction,@image='','','','' #check which other values should be set to empty rather than nil
- @markup=@markup_instruction #use @markup_instruction
- @doc,@fn,@make_italic,@tag_hash,@ec={},{},{},{},{},{}
- @flv,@lang,@seg_names,@tags,@tag_array,@tag_a,@ec[:image],@ec[:audio],@ec[:multimedia]=Array.new(9){[]}
- @authors,@topic_register_array,@papersize_array=[],[],[]
- @lvs=[nil,0,0,0,0,0,0]
- @emphasis_set_to='bold'
- @lang_code_insert=SiSU_Env::FilenameLanguageCodeInsert.new(@opt).language_code_insert
- @footer_links= { left: { say: '', url: '' }, center: { say: '', url: '' } }
- @rgx_image=/(?:^|[^_\\])\{(?:\s*|\~\^\s+)(\S+?\.(?:png|jpg|gif)\b)/m
- @rgx_audio=/\{\s*(\S+?\.(?:mp3|ogg))/
- @rgx_mm=/\{\s*(\S+?\.(?:ogg|mpeg))/ #expand and distinguish ogg
- Dir.chdir(@opt.f_pth[:pth])
- begin
- rescue
- SiSU_Errors::Rescued.new($!,$@,@opt.selections.str,@fns).location do
- __LINE__.to_s + ':' + __FILE__
- end
- ensure
- end
- @header_make_links_append=:no
- common_makes=(defined? @opt.make_instructions_pod) \
- && @opt.make_instructions_pod !=nil \
- && @opt.make_instructions_pod[:makeset]==true \
- ? @opt.make_instructions_pod
- : @opt.make_instructions
- if common_makes[:makeset]
- @pagenew=common_makes[:pagenew]
- @pagebreak=common_makes[:pagebreak]
- @pageline=common_makes[:pageline]
- @toc=common_makes[:toc]
- @lv0=common_makes[:lv0]
- @lv1=common_makes[:lv1]
- @lv2=common_makes[:lv2]
- @lv3=common_makes[:lv3]
- @lv4=common_makes[:lv4]
- @lv5=common_makes[:lv5]
- @lv6=common_makes[:lv6]
- @num_top=common_makes[:num_top]
- @i18n=common_makes[:i18n]
- @man_section=common_makes[:man_section]
- @emphasis_set_to=common_makes[:emphasis_set_to]
- @bold_match_list=common_makes[:bold_match_list]
- @italics_match_list=common_makes[:italics_match_list]
- @substitution_match_list=common_makes[:substitution_match_list]
- @footer_links=common_makes[:footer_links]
- @home_button_links=common_makes[:home_button_links]
- @home_button_image=common_makes[:home_button_image]
- @cover_image=common_makes[:cover_image]
- @lnk=@links=common_makes[:links]
- @header_make_links_append=common_makes[:links_append]
- end
- end
- #protected
- def extract
- begin
- @user,@home,@hostname,@pwd=ENV['USER'],ENV['HOME'],ENV['HOSTNAME'],ENV['PWD']
- @programs,@wc,@language,@language_original={},{},{},{}
- @en={ sum: 0, mark: 0, note: 0, mismatch: 0 }
- @prog=SiSU_Env::InfoSettings.new
- @sys=SiSU_Env::SystemCall.new
- @env=SiSU_Env::InfoEnv.new(@fns) #watch
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- puts 'system locale: ' + @sys.locale
- end
- if @prog.wc \
- and @sys.wc
- wc=%x{wc #{fns}}
- wca=wc.scan(/\d+/)
- @wc_lines,@wc_words,@wc_bytes=wca[0].to_i,wca[1].to_i,wca[2].to_i
- else
- fns_a=@data.dup
- tmp=fns_a.join
- fns_a=tmp.scan(/\S+/)
- @wc_words=fns_a.length
- fns_a=tmp=nil
- end
- @concord_make=(@wc_words > @env.concord_max) ? false : true
- @locale=@sys.locale
- @file_encoding=@sys.file_encoding(fns,@opt.act)
- # programs set here for things that affect output appearance only
- @programs[:pdf]=SiSU_Env::SystemCall.new.program_found?('pdflatex')
- if @opt.act[:psql][:set] == [:ok]
- m=/((.+?)(?:\~\w\w(?:_\w\w)?)?)\.((?:-|ssm\.)?sst|ssm|ssi)$/ #watch added match for sss
- @fnn,@fnb,@fnt=@fns[m,1],@fns[m,2],@fns[m,3]
- @flv=@env.document_language_versions_found[:f]
- else
- m=/((.+?)(?:\~\w\w(?:_\w\w)?)?)\.((?:-|ssm\.)?sst|ssm)$/ #watch added match for sss
- @fnn,@fnb,@fnt=@fns[m,1],@fns[m,2],@fns[m,3]
- @flv=@env.document_language_versions_found[:f]
- @fnz=(@fns =~/\.(?:ssm\.sst|ssm)$/) ? (@fnn + '.ssm.txz') : (@fnn + '.sst.txz')
- end
- @papersize=@env.papersize #'A4' #default size #get first from SiSU_Env:: # @env is probably no longer most appropriate name! as default info is more general
- @sfx_src=@fns[m,2]
- if @fns =~ /(?:-|ssm\.)?sst$/ \
- and not @opt.act[:psql][:set] == [:ok]
- @env_out_root=@env.path.output
- @dir_out="#{@env.path.output}/#{@fnb}"
- @dir_tex=@env.processing_path.tex
- @dir_lout=@env.processing_path.lout
- @@publisher='SiSU http://www.jus.uio.no/sisu'
- end
- @txt_path=@txt_path ||= @env.path.output
- @stmp=%{#{@fns}}[/^(.+?)\..*/m,1]
- @fnstex=@fns.gsub(/_/,'\_\-').gsub(/\./,'.\-')
- @flag_endnotes,@flag_auto_endnotes,@flag_separate_endnotes=false,false,false
- @flag_separate_endnotes_make=true
- @flag_biblio,@flag_auto_biblio=false,false
- ver=SiSU_Env::InfoVersion.instance
- @project_details=ver.get_version
- @ruby_version=ver.rbversion
- @generated=Time.now
- fns_array=@data.dup
- skip unless fns_array # consider
- @code_flag=false
- flag_code_curly=:not_code_curly
- flag_code_tics=:not_code_tics
- fns_array.each do |para| #% scan document
- if para !~/^%+\s/ \
- and para =~/<![abcdeghijklmnopqrstuvwxyz]/i # <!f not included
- raise "Old markup style in file #{@fns}, current version #{@project_details.project} #{@project_details.version} #{@project_details.date_stamp} #{@project_details.date}:\n\t\t#{para}\n\n"
- end
- if para =~/^code\{/
- flag_code_curly=:code_curly
- elsif para =~/^\}code/
- flag_code_curly=:not_code_curly
- elsif para =~/^``` code/
- flag_code_tics=:code_tics
- elsif flag_code_tics ==:code_tics \
- and para =~/^```/
- flag_code_tics=:not_code_tics
- end
- @code_flag=if flag_code_curly==:code_curly \
- or flag_code_tics==:code_tics
- true
- else false
- end
- regx_header=/^@\S+?:[+-]?\s/
- if para =~regx_header \
- and not @code_flag #or para=~/^(?:1|:?A)~/
- case para
- when /^@title:(.+)/m #% * header metadata - title
- @title=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).title
- when /^@creator:(.+)/m #% * header metadata - creator
- @creator=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).creator
- @authorship=@author=@creator.author
- @authors=@creator.author_detail
- when /^@date:(.+)/m #% * header metadata - date
- @date=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).date
- when /^@publisher:\s+(.+)/m #% * header metadata - publisher
- @publisher=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).current_publisher
- @current_publisher=@publisher
- when /^@rights:(.+)/m #% * header metadata - rights
- @rights=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).rights
- when /^@classify:(.+)/m #% * header metadata - classify
- @classify=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).classify
- when /^@identifier:(.+)/m #% * header metadata - identifier
- @identifier=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).identifier
- when /^@original:(.+)/m #% * header metadata - original (document)
- @original=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).original
- @source=@original.source
- when /^@notes?:\s(.+)\Z/m #% * header metadata - notes
- @notes=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).notes
- when /^@links:\s+(.+?)\Z/m #% * header metadata - links
- links=SiSU_Param::Parameters::MdMake.new($1.strip,@opt,@env).make_links.links
- @lnk=@links=if @header_make_links_append == :yes
- (links) \
- ? (links + @links)
- : @links
- else
- (links) \
- ? (links)
- : @links
- end
- when /^@make:(.+)/m #% * header processing - make
- @make=SiSU_Param::Parameters::MdMake.new($1.strip,@opt,@env).make
- makes=SiSU_Param_Make::MakeHead.new(@make).make_instruct
- @pagenew=(makes[:pagenew]) \
- ? (makes[:pagenew]) \
- : @pagenew
- @pagebreak=(makes[:pagebreak]) \
- ? (makes[:pagebreak]) \
- : @pagebreak
- @pageline=(makes[:pageline]) \
- ? (makes[:pageline]) \
- : @pageline
- @toc=(makes[:toc]) ? (makes[:toc]) : @toc
- @lv0=(makes[:lv0]) ? (makes[:lv0]) : @lv0
- @lv1=(makes[:lv1]) ? (makes[:lv1]) : @lv1
- @lv2=(makes[:lv2]) ? (makes[:lv2]) : @lv2
- @lv3=(makes[:lv3]) ? (makes[:lv3]) : @lv3
- @lv4=(makes[:lv4]) ? (makes[:lv4]) : @lv4
- @lv5=(makes[:lv5]) ? (makes[:lv5]) : @lv5
- @lv6=(makes[:lv6]) ? (makes[:lv6]) : @lv6
- @num_top=
- (makes[:num_top]) \
- ? (makes[:num_top]) \
- : @num_top
- @substitution_match_list=
- (makes[:substitution_match_list]) \
- ? (makes[:substitution_match_list]) \
- : @substitution_match_list
- @bold_match_list=
- (makes[:bold_match_list]) \
- ? (makes[:bold_match_list]) \
- : @bold_match_list
- @italics_match_list=
- (makes[:italics_match_list]) \
- ? (makes[:italics_match_list]) \
- : @italics_match_list
- @emphasis_set_to=
- (makes[:emphasis_set_to]) \
- ? (makes[:emphasis_set_to]) \
- : @emphasis_set_to
- @i18n=
- (makes[:i18n]) \
- ? (makes[:i18n]) \
- : @i18n
- @man_section=
- (makes[:man_section]) \
- ? (makes[:man_section]) \
- : @man_section
- @footer_links=
- (makes[:footer_links]) \
- ? (makes[:footer_links]) \
- : @footer_links
- @home_button_links=
- (makes[:home_button_links]) \
- ? (makes[:home_button_links]) \
- : @home_button_links
- @home_button_image=
- (makes[:home_button_image]) \
- ? (makes[:home_button_image]) \
- : @home_button_image
- @cover_image=
- (makes[:cover_image]) \
- ? (makes[:cover_image]) \
- : @cover_image
- end
- @lv0 ||=/^0~/
- @lv1 ||=/^1~/
- @lv2 ||=/^2~/
- @lv3 ||=/^3~/
- @lv4 ||=/^4~/
- @lv5 ||=/^5~/
- @lv6 ||=/^6~/
- else #% *
- l_0=l_1=l_2=l_3=l_4=l_5=''
- if defined? @make.headings[0]
- l_0=if defined? @make.headings[0][0] \
- and @make.headings[0][0] =~/\S+/
- "|^#{@make.headings[0][0]}"
- end
- l_1=if defined? @make.headings[0][1] \
- and @make.headings[0][1] =~/\S+/
- "|^#{@make.headings[0][1]}"
- end
- l_2=if defined? @make.headings[0][2] \
- and @make.headings[0][2] =~/\S+/
- "|^#{@make.headings[0][2]}"
- end
- l_3=if defined? @make.headings[0][3] \
- and @make.headings[0][3] =~/\S+/
- "|^#{@make.headings[0][3]}"
- end
- l_4=if defined? @make.headings[0][4] \
- and @make.headings[0][4] =~/\S+/
- "|^#{@make.headings[0][4]}"
- end
- l_5=if defined? @make.headings[0][5] \
- and @make.headings[0][5] =~/\S+/
- "|^#{@make.headings[0][5]}"
- end
- end
- case para
- #when /^:?A~/
- when /^:?B~#{l_0}/
- @lvs[1]=1
- when /^:?C~#{l_1}/
- @lvs[2]=1
- when /^:?D~#{l_2}/
- @lvs[3]=1
- when /^1~#{l_3}/
- @lvs[4]=1
- when /^2~#{l_4}/
- @lvs[5]=1
- when /^3~#{l_5}/
- @lvs[6]=1
- end
- if para =~ /^:?A~/ #% processing
- if not defined? @title.full.nil?
- tf=para[/^:A~\S*(.+)$/m,1]
- tf="@title: #{tf}"
- @title=SiSU_Param::Parameters::Md.new(tf.strip,@opt,@env).title
- end
- creator=(@creator.is_a?(SiSU_Param::Parameters::Md) \
- && defined? @creator.author \
- && @creator.author.is_a?(String)) \
- ? " #{@creator.author}"
- : ''
- title=@title.full.gsub(/\s*(?:<p>|<p \/>|<br>|<br \/>)\s*/,' ').
- gsub(/~\{.+?\}~/,'')
- SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- 'Document Parameters',
- %{#{title}#{creator}}
- ).txt_grey if @opt.act[:verbose][:set]==:on
- end
- unless @code_flag
- if para =~/^1~biblio(?:graphy)?/
- @flag_auto_biblio,@flag_biblio=false,true
- #@flag_biblio=true
- elsif @flag_biblio ==true \
- and @flag_auto_biblio ==false \
- and para =~/^(?:au|author):/m
- @flag_auto_biblio =true
- end
- end
- if not @book_idx \
- and para =~/^=\{(.+?)\}[\s`]*\Z/m
- @book_idx=true
- end
- unless @code_flag
- case para
- when /~\{\s+.+?\}~/m #% processing
- en=para.scan(/~\{.+?\}~/m)
- en.each { |e| @en[:sum] +=1 }
- when /~\^(?:\s|$)/m #% processing
- mk=para.scan(/~\^(?:\s|$)/)
- mk.each { |e| @en[:mark] +=1 }
- when /^\^~\s+\S/ then @en[:note] +=1 #% processing
- end
- end
- if para =~/~\{|\^~ |~\^|\{.+?\[[1-6]\]\}\S+?\.ss[tm]/m
- @flag_auto_endnotes,@flag_endnotes=true,true
- end
- if para =~/^(?:table\{|\{table)/i
- @flag_tables=true
- end
- end
- if para =~/^:?A~/
- @set_heading_top=true
- end
- if para =~/^1~/
- m=nil
- if para =~/^1~(\S+)\s+(.+)$/
- m,t=$1,$2
- elsif para =~/^1~\s+(.+)$/
- t=$1
- end
- unless @heading_seg_first_flag # extract first segment name
- @heading_seg_first=t
- @heading_seg_first_flag=true
- end
- if m # list all segment names
- @seg_names << m
- @set_heading_seg=true
- if m=~/^\d{1,3}/ \
- and m !~/^0/
- @seg_autoname_safe=false
- end
- end
- end
- para=para.gsub(/<:=(\S+?)>/,'{ c_\1.png 14x14 }image') # embedded symbol (image)
- if para !~/^%+\s/ \
- and para =~@rgx_image
- @ec[:image] << para.scan(@rgx_image).uniq
- end
- @ec[:audio] << para.scan(@rgx_audio).uniq if para =~@rgx_audio #embedded content
- @ec[:multimedia] << para.scan(@rgx_mm).uniq if para =~@rgx_mm #embedded content
- unless @sem_tag
- @sem_tag=true if para=~/[:;]\{.+?\}[:;][a-z+]/ #refix later
- end
- end #% here endeth the document loop
- unless @make
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- '@make:',
- 'header absent'
- ).warn
- end
- @make=SiSU_Param::Parameters::MdMake.new('@make: ',@opt,@env).make
- end
- if @cover_image \
- and @cover_image.is_a?(Hash) \
- and (@cover_image[:cover] =~@rgx_image \
- or @cover_image[:cover] =~/\S+?.(?:jpg|png|gif)/)
- @ec[:image] << @cover_image[:cover]
- end
- if @home_button_image \
- and @home_button_image.is_a?(Hash) \
- and (@home_button_image =~@rgx_image \
- or @home_button_image =~/\S+?\.(?:jpg|png|gif)/)
- @ec[:image] << @home_button_image
- end
- if @ec[:image].length > 0
- @ec[:image]=@ec[:image].flatten.uniq
- @ec[:image].delete_if {|x| x =~/https?:\/\// }
- @ec[:image]=@ec[:image].sort
- end
- @ec[:audio]=@ec[:audio].uniq.flatten.sort
- @ec[:multimedia]=@ec[:multimedia].uniq.flatten.sort
- unless @rights
- if defined? @creator.author \
- and @creator.author.is_a?(String) \
- and defined? @date.published \
- and @date.published.is_a?(String)
- @rights=SiSU_Param::Parameters::MdDefault.new.rights(@creator.author,@date.published)
- elsif defined? @creator.author \
- and @creator.author.is_a?(String)
- @rights=SiSU_Param::Parameters::MdDefault.new.rights("[#{@creator.author}]",'')
- end
- end
- if defined? @classify.topic_register \
- and @classify.topic_register.is_a?(String) \
- and @classify.topic_register.length >3
- topic_register=@classify.topic_register
- u=topic_register.scan(/[^;]+/m).sort
- v=[]
- u.each do |l|
- v << l.scan(/[^:]+/m)
- end
- v.each do |s|
- s[-1]=s[-1].scan(/[^|]+/m) if s[-1] =~/[|]/m
- @topic_register_array << s
- end
- @topic_register_array
- end
- if @i18n
- @i18n=@i18n.uniq
- @i18n << 'en' unless @i18n.find_index("en")
- else
- @i18n=[ 'en' ]
- end
- translated=[]
- translate_list=[@pagenew,@pagebreak,@pageline,@num_top,@toc_lev_limit]
- translate_list.each do |t|
- translate=t.to_s if t
- translated << if translate
- translate.gsub!(/3/,'6')
- translate.gsub!(/2/,'5')
- translate.gsub!(/1/,'4')
- translate.gsub!(/:?C/,'3')
- translate.gsub!(/:?B/,'2')
- translate.gsub!(/:?A/,'1')
- # looks like an ok substituion for the above but is not, causes problems, check why
- #translate=translate.gsub(/3/,'6').
- # gsub(/2/,'5').
- # gsub(/1/,'4').
- # gsub(/:?C/,'3').
- # gsub(/:?B/,'2').
- # gsub(/:?A/,'1')
- translate=(translate =~/^\d+$/) \
- ? translate.to_i
- : translate
- else nil
- end
- end
- @pagenew,@pagebreak,@pageline,@num_top,@toc_lev_limit=translated
- @markup=@markup.gsub(/page_new\s*=\s*([\dA-C])/,"page_new=#{@pagenew}").
- gsub(/page_break\s*=\s*([\dA-C])/,"page_break=#{@pagebreak}").
- gsub(/page_line\s*=\s*([\dA-C])/,"page_line=#{@pageline}").
- gsub(/num_top\s*=\s*([\dA-C])/,"num_top=#{@num_top}").
- gsub(/toc_lev_limit\s*=\s*([\dA-C])/,"toc_lev_limit=#{@toc_lev_limit}")
- papersize_array_rc=@papersize.downcase.scan(/(?:a4|letter|legal|book|a5|b5)/)
- papersize_array_opt=[
- ((@opt.act[:pdf_a4][:set]==:on) ? 'a4' : ''),
- ((@opt.act[:pdf_a5][:set]==:on) ? 'a5' : ''),
- ((@opt.act[:pdf_b5][:set]==:on) ? 'b5' : ''),
- ((@opt.act[:pdf_letter][:set]==:on) ? 'letter' : ''),
- ((@opt.act[:pdf_legal][:set]==:on) ? 'legal' : ''),
- ] - [""]
- @papersize_array=(papersize_array_opt.length > 0) \
- ? papersize_array_opt
- : papersize_array_rc
- fn=@opt.fno #decide what to do a filesize on .ssm tells very little about actual document size
- @filesize=(File.size(fn)).to_s
- if @sys.openssl !=false \
- and FileTest.file?(@env.source_file_with_path)
- @dgst=[]
- case @env.digest(@opt).type
- when :sha512
- dgst=@sys.sha512(@env.source_file_with_path)
- @dgst=dgst[1].length==128 ? dgst : nil
- puts 'check document (sha512) digest' if not @dgst
- when :sha256
- dgst=@sys.sha256(@env.source_file_with_path)
- @dgst=dgst[1].length==64 ? dgst : nil
- puts 'check document (sha256) digest' if not @dgst
- when :md5
- dgst=@sys.md5(@env.source_file_with_path)
- @dgst=dgst[1].length==32 ? dgst : nil
- puts 'check document (md5) digest' if not @dgst
- else
- dgst=@sys.sha256(@env.source_file_with_path)
- @dgst=dgst[1].length==64 ? dgst : nil
- puts 'check document (sha256) digest' if not @dgst
- end
- elsif not FileTest.file?(@env.source_file_with_path)
- #puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).set(:fuchsia)
- end
- @publisher ||= "#{@@publisher} (this copy)"
- fn_set_lang=SiSU_Env::StandardiseLanguage.new(@opt.lng).language
- unless @language[:code] \
- and @language[:name]
- lang=@env.i18n.language #default language settings for directory by name, or in sysrc.yml
- @language[:code] ||= lang.code
- @language[:name] ||= lang.title
- end
- unless fn_set_lang[:d]==true #decide, naming convention overrides other settings, within document, etc.
- @language[:code]=fn_set_lang[:c]
- @language[:name]=fn_set_lang[:n]
- end
- @fnl=@env.i18n.lang_filename(fn_set_lang[:c])
- @lang=@lang.uniq
- @fn=SiSU_Env::EnvCall.new(@fns).lang(fn_set_lang[:c])
- if @en[:note] > 0 \
- and @en[:sum] > 0
- if @en[:sum] > 0
- else
- SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- '*WARN* both endnote styles used',
- "~{ #{@en[:sum]} }~ and ^~ #{@en[:mark]}"
- ).warn unless @opt.act[:quiet][:set]==:on
- end
- end
- if @en[:mark] != @en[:note] \
- and @en[:note] > 0
- @en[:mismatch]=@en[:note] - @en[:mark]
- SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- '*WARN* endnote number mismatch',
- "endnotes: #{@en[:note]} != endnote reference marks: #{@en[:mark]} " \
- + "(difference = #{@en[:mismatch]})"
- ).warn unless @opt.act[:quiet][:set]==:on
- footnote_conversion_errors=File.new("#{Dir.pwd}/footnote_conversion_errors.txt",'a')
- footnote_conversion_errors <<
- "#{@fns}:\n\tendnotes: #{@en[:note]} != endnote reference marks: #{@en[:mark]} " \
- + "(difference = #{@en[:mismatch]})\n"
- end
- if not @title \
- or not defined? @title.main \
- or @title.main !~/[\S]/
- if @fns =~/\.ssm$/ \
- and @opt.inspect =~/P/
- #@title=Md.new('Text Insert',@opt,@env).title
- else
- SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- 'WARNING: Document Title missing',
- 'please provide @title:'
- ).warn if (@opt.act[:verbose][:set]==:on \
- || @opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- end
- end
- if @author !~/[\S]/
- if @fns =~/\.ssm$/ \
- and @opt.inspect =~/P/
- #@creator=SiSU_Param::Md.new('Text Insert',@opt,@env).creator
- else
- SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- 'WARNING: Document Author missing',
- 'please provide @creator: :author:'
- ).warn if (@opt.act[:verbose][:set]==:on \
- || @opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- end
- end
- @struct={}
- doc_struct=Hash.new(0)
- if @lv1.nil?
- fns_array.each do |para|
- if para =~/^(Part|Chapter|Section|Article)\b/i
- case para
- when /^(Part|PART)\b/
- @struct[:part]=doc_struct[:part]
- doc_struct[:part]=doc_struct[:part] + 1
- when /^(Chapter|CHAPTER)\b/
- @struct[:chapter]=doc_struct[:chapter]
- doc_struct[:chapter]=doc_struct[:chapter] + 1
- when /^(Section|SECTION)\b/
- @struct[:section]=doc_struct[:section]
- doc_struct[:section]=doc_struct[:section] + 1
- when /^(Article|ARTICLE)\b/
- @struct[:article]=doc_struct[:article]
- doc_struct[:article]=doc_struct[:article] + 1
- when /^(Clause|CLAUSE)\b/
- @struct[:clause]=doc_struct[:clause]
- doc_struct[:clause]=doc_struct[:clause] + 1
- when /^\d\..*[^\.]$/
- @struct[:number]=doc_struct[:number]
- doc_struct[:number]=doc_struct[:number] + 1
- end
- end
- end
- if doc_struct[:article] > 2 #%~level 4
- @lv4=/^(?:Article|ARTICLE)\b/
- elsif doc_struct[:chapter] > 2 \
- and doc_struct[:article] \
- and doc_struct[:article] < 3
- @lv4=/^(?:Chapter|CHAPTER)\b/
- elsif doc_struct[:clause] > 2
- @lv4=/^(?:Clause|CLAUSE)\b/
- elsif doc_struct[:number] > 2
- @lv4="^\d\..*[^\.]$"
- end
- if doc_struct[:section] > 2 #%~level 3
- @lv3=/^(?:Section|SECTION)\b/
- end
- if doc_struct[:chapter] > 2 \
- and doc_struct[:article] \
- and doc_struct[:article] > 2
- @lv2=/^(?:Chapter|CHAPTER)\b/
- end
- if doc_struct[:part] > 2 \
- and @lv[2].nil?
- @lv2=/^(?:Part|PART)\b/
- end
- if doc_struct[:part] > 2 \
- and @lv[2].inspect !~/Part/ \
- and @lv[1].nil?
- @lv1=/^(Part|PART)\b/
- end
- end
- @lnk=@lnk.compact if @lnk
- @lv0 ||=/^0~/
- @lv1 ||=/^1~/
- @lv2 ||=/^2~/
- @lv3 ||=/^3~/
- @lv4 ||=/^4~/
- @lv5 ||=/^5~/
- @lv6 ||=/^6~/
- @data=nil #else whole file's contents are stored in md pstore & is not required to be... big waste actually
- @file=SiSU_Env::FileOp.new(self) #watch
- Store.new(self,@env).store #% pstore
- self
- rescue
- if @opt.act[:harvest][:set]==:on
- exit
- end
- end
- end
- private
- class Store
- def initialize(md,env)
- @md,@env=md,env
- end
- def store
- begin
- pstorefile="#{@env.processing_path.ao}/#{@md.fns}.pstore"
- File.unlink(pstorefile) if FileTest.file?(pstorefile)
- if (@md.opt.act[:verbose_plus][:set]==:on \
- || @md.opt.act[:maintenance][:set]==:on)
- SiSU_Screen::Ansi.new(
- @md.opt.act[:color_state][:set],
- "PStore -> #{pstorefile}"
- ).txt_grey
- end
- store=PStore.new(pstorefile)
- store.transaction do
- store['md']=@md
- store.commit
- end
- @@md=@md=nil
- rescue
- SiSU_Errors::Rescued.new($!,$@,@md.opt.selections.str,@md.fns).location do
- __LINE__.to_s + ':' + __FILE__
- end
- ensure
- end
- end
- end
- end
- end
- class Instantiate
- def param_instantiate
- @@date=SiSU_Env::InfoDate.new
- @doc={
- initialise: nil,
- markup: '',
- lnks: '',
- stmp: '',
- prefix_a: '',
- prefix_b: '',
- req: {}
- }
- @@flag={}
- @@publisher='SiSU scribe'
- end
- end
-end
-__END__
diff --git a/lib/sisu/current/dp_identify_markup.rb b/lib/sisu/current/dp_identify_markup.rb
deleted file mode 100644
index acb6070..0000000
--- a/lib/sisu/current/dp_identify_markup.rb
+++ /dev/null
@@ -1,161 +0,0 @@
-# encoding: utf-8
-=begin
-
-* Name: SiSU
-
-** Description: documents, structuring, processing, publishing, search
-*** 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
-
-** Author: Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
-** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
- All Rights Reserved.
-
-** License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
-** SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
-** Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
-** Git
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/dp_identify_markup.rb;hb=HEAD>
-
-=end
-module SiSU_MarkupType
- class MarkupIdentify
- @@version={}
- @@fns,@@version[:determined],@@version[:declared],@@declared_doc_type='','','','[text?]'
- attr_accessor :version,:declared_doc_type
- def initialize(content,opt)
- @cont,@opt=content,opt
- end
- def identify
- @version,@declared_doc_type=@@version,@@declared_doc_type
- if @opt.fns != @@fns
- if @cont[0] =~ /^(?:%\s+)?SiSU\s+(text|master|insert)\s+([0-9](?:\.[0-9]+){1,2})/ \
- or @cont[0] =~ /^(?:%\s+)?sisu-([0-9](?:\.[0-9]+){1,2})/
- @declared_doc_type,@version[:declared]=$1,$2
- elsif @cont[0] =~ /^(?:%\s+)?SiSU\s+([0-9](?:\.[0-9]+){1,2})/ \
- or @cont[0] =~ /^(?:%\s+)?sisu-([0-9](?:\.[0-9]+){1,2})/
- @version[:declared]=$1
- end
- @flag_2_0,@flag_66,@flag_57,@flag_38=false,false,false,false
- @cont.each_with_index do |y,i|
- if y =~/^@make:|^@classify|^\s\s?:\S+?:\s+\S/
- version=2.0.to_f
- @version[:determined]=version
- @flag_2_0=true
- break
- end
- unless @flag_38
- if y =~/^:?A~/
- version=0.38.to_f
- @version[:determined]=version
- @flag_38=true
- end
- end
- if @flag_38
- if @flag_69 \
- or y =~/^=\{.+?\}\s*$/
- version=0.69.to_f
- @flag_69=true
- @version[:determined]=version
- break
- end
- if @flag_66 \
- or y =~/[:;]\{.+?\}[:;][a-z+]/
- version=0.66.to_f
- @flag_66=true
- @version[:determined]=version
- break
- end
- end
- end
- @flag_57,@flag_38=false,false
- unless @flag_2_0 \
- or @flag_66 \
- or @flag_69
- @cont.each_with_index do |y,i|
- if @flag_57 \
- or y =~/^:?A~\?? @title/
- @version[:determined]=0.57.to_f
- @flag_57=true
- break
- end
- if @flag_38 \
- or y =~/^:?A~/
- @version[:determined]=0.38.to_f
- @flag_38=true
- break if i >= 200
- if y =~ /(?:~{\*+|~\[\*|~\[\+)\s/
- @version[:determined]=0.42 #0.38 can safely be treated as 0.42
- break
- end
- end
- if y =~/^0~/ \
- and not @flag_38
- @version[:determined]=0.16.to_f
- break
- end
- end
- end
- @@fns=@opt.fns
- @@version,@@declared_doc_type=@version,@declared_doc_type
- end
- self
- end
- def markup_version?
- def determined
- identify.version[:determined].to_f
- end
- def series
- s=case identify.version[:determined].to_s
- when /^[01]\./ then '1.0'
- when /^[2]\./ then '2.0'
- else '2.0'
- end
- "series #{s}"
- end
- def declared
- identify.version[:declared].to_f
- end
- self
- end
- end
-end
-__END__
diff --git a/lib/sisu/current/dp_make.rb b/lib/sisu/current/dp_make.rb
deleted file mode 100644
index f65717b..0000000
--- a/lib/sisu/current/dp_make.rb
+++ /dev/null
@@ -1,668 +0,0 @@
-# encoding: utf-8
-=begin
-
-* Name: SiSU
-
-** Description: documents, structuring, processing, publishing, search
-*** document parameters make extracted for program use
-
-** Author: Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
-** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
- All Rights Reserved.
-
-** License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public Lic/home/ralph/live-manual/build/manual/manifest/live-manual.ca.htmlense for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
-** SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
-** Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
-** Git
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/dp_make.rb;hb=HEAD>
-
-=end
-
-module SiSU_Param_Make
- class MdMake
- def initialize(str,opt,env)
- @s,@opt,@env=str,opt,env
- end
- def validate_length(s,l,n)
- #s=(s.length <= l) ? s : nil
- s=if s.is_a?(String) \
- and s.length <= l
- s
- elsif s.is_a?(NilClass)
- nil
- elsif s.class !=String
- STDERR.puts "#{n} is #{s.class}: programming error, String expected #{__FILE__}:#{__LINE__}"
- s
- else
- SiSU_Screen::Ansi.new(
- 'v',
- "*WARN* #{n} length #{s.length} exceeds set db field length #{l}, metadata dropped",
- @opt.fns
- ).warn unless @opt.act[:quiet][:set]==:on
- nil
- end
- end
- def name_format(name)
- if name
- name=name.strip
- @name_a_h=[]
- authors=name.scan(/[^;]+/)
- authors.each_with_index do |a,i|
- b=((a =~/\s*\|\s*/) ? (a.split(/\|/)) : [a])
- if b[0] =~/"(.+?)"/
- @name_a_h << { the: $1 }
- else
- x=b[0].scan(/[^,]+/)
- if x.length==1
- @name_a_h << { the: x[0].strip }
- elsif x.length==2
- @name_a_h << { the: x[0].strip, others: x[1].strip }
- else #p x.length
- end
- end
- b.delete_at(0)
- b.each do |d|
- k,c=nil
- k,c=/^(\S+)\s+(.*)/.match(d)[1,2] if d
- @name_a_h[i][:hon]=c.strip if k=='hon'
- @name_a_h[i][:affiliation]=c.strip if k=='affiliation'
- @name_a_h[i][:nationality]=c.strip if k=='nationality'
- end
- end
- l=@name_a_h.length
- name_str=''
- @name_a_h.each_with_index do |a,i|
- name_str += if a[:others]
- z=(((l - i) > 1) ? ', ' : '')
- "#{a[:others].strip} #{a[:the].strip}" + z
- else
- z=(((l - i) > 2) ? ', ' : '')
- "#{a[:the].strip}" + z
- end
- end
- { name_a_h: @name_a_h, name_str: name_str }
- else nil
- end
- end
- def build_hash(arr)
- @h={}
- arr.each_with_index do |x,i|
- a,b=nil,nil
- if x =~/^%[:\s]/ #ignore comment
- elsif x =~/:(\S+?):\s+(.+)/
- a,b=/:(\S+?):\s+(.+)\Z/m.match(x)[1,2]
- elsif i == 0
- a='main'
- b=x
- else
- end
- @h[a]=b
- end
- @h
- end
- def make
- a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m)
- @h=build_hash(a)
- def headings
- lv=[]
- x=@h['headings']
- x=((x =~/;/) ? (x.split(/;\s*/)) : [ x ])
- lv[0]=x
- lv0 ||='A~ ' #root level, single document apex, document title
- lv1=x[0] ||='B~ '
- lv[1]=/^#{lv1}/
- lv2=x[1] ||='C~ '
- lv[2]=/^#{lv2}/
- lv3=x[2] ||='D~ '
- lv[3]=/^#{lv3}/
- lv4=x[3] ||='1~ '
- lv[4]=/^#{lv4}/
- lv5=x[4] ||='2~ '
- lv[5]=/^#{lv5}/
- lv6=x[5] ||='3~ '
- lv[6]=/^#{lv6}/
- lv
- end
- def num_top
- @h['num_top']
- end
- def breaks
- pagebreaks=((@h['breaks'] =~/;/) \
- ? (@h['breaks'].split(/;\s*/))
- : [ @h['breaks'] ])
- page_new,page_break,page_line=nil,nil,nil
- pagebreaks.each do |x|
- page_new=x[/(:?[\dA-C],?)+/] if x=~/new|clear/
- page_break=x[/(:?[\dA-C],?)+/] if x =~/break/
- page_line=x[/(:?[\dA-C],?)+/] if x =~/line/
- end
- { page_new: page_new, page_break: page_break, page_line: page_line }
- end
- def language
- if @h['language'] && (@h['language']=~/\S{2,}/)
- ((@h['language'] =~/,/) \
- ? (@h['language'].split(/,\s*/))
- : [ @h['language'] ])
- else [ 'en' ]
- end
- end
- def bold
- m=@h['bold']
- i=(m=~/\/i$/)? 'i' : ''
- if m
- x=m.gsub(/^\/(.+?)\/i?/,'\1').
- gsub(/\((?:\?:)?/,'(?:') # avoid need to escape use of brackets within regex provided
- rgx='\b(' + x + ')\b'
- y=((i =~/i/) ? (/#{rgx}/i) : (/#{rgx}/))
- { str: '\b(?:' + x + ')\b', regx: y, i: i }
- else nil
- end
- end
- def italics
- m=@h['italics']
- i=((m=~/\/i$/) ? 'i' : '')
- if m
- x=m.gsub(/^\/(.+?)\/i?/,'\1').
- gsub(/\((?:\?:)?/,'(?:') # avoid need to escape use of brackets within regex provided
- rgx='\b(' + x + ')\b'
- y=((i =~/i/) ? (/#{rgx}/i) : (/#{rgx}/))
- { str: '\b(?:' + x + ')\b', regx: y, i: i }
- else nil
- end
- end
- def emphasis
- if @h['emphasis'] =~/bold/ then 'bold'
- elsif @h['emphasis'] =~/italics?/ then 'italics'
- elsif @h['emphasis'] =~/under(?:line|score)/ then 'underscore'
- else nil
- end
- end
- def substitute
- m=@h['substitute']
- if m
- w=m.scan(/\/(.+?)\/(i?,)\s*'(.+?)'(?:\s+|\s*;\s*|$)/)
- arr_hash=[]
- matches=''
- w.each do |x|
- c=(x[1] =~/[i],/) ? :i : :s
- matches=matches + x[0].gsub(/([${}])/,'\\\\\1') + '|'
- arr_hash << {
- match: x[0].gsub(/([${}])/,'\\\\\1'),
- replace: x[2],
- case_s: c
- }
- end
- matches.chop!
- { match_and_replace: arr_hash, matches: matches }
- else nil
- end
- end
- def plaintext_wrap
- if @h['plaintext_wrap'].to_s =~/\d\d+/ \
- and @h['plaintext_wrap'].to_i > 19 \
- and @h['plaintext_wrap'].to_i < 201
- @h['plaintext_wrap'].to_i
- else nil
- end
- end
- def omit
- m=@h['omit']
- @m=m ? (m.split(/,\s+/)) : nil
- def list
- @m
- end
- self
- end
- def ocn?
- (omit.list.inspect =~/"ocn"/) \
- ? :off
- : :na
- end
- def toc?
- (omit.list.inspect =~/"toc"/) \
- ? :off
- : :na
- end
- def manifest?
- (omit.list.inspect =~/"manifest"/) \
- ? :off
- : :na
- end
- def links_to_manifest?
- (omit.list.inspect =~/"manifest_links"|"links_to_manifest"/) \
- ? :off
- : :na
- end
- def metadata?
- (omit.list.inspect =~/"metadata"/) \
- ? :off
- : :na
- end
- def minitoc?
- (omit.list.inspect =~/"minitoc"/) \
- ? :off
- : :na
- end
- def html_minitoc?
- (omit.list.inspect =~/"html_minitoc"/) \
- ? :off
- : :na
- end
- def html_top_band?
- (omit.list.inspect =~/"html_top_band"/) \
- ? :off
- : :na
- end
- def html_navigation?
- (omit.list.inspect =~/"html_navigation"/) \
- ? :off
- : :na
- end
- def html_navigation_bar?
- (omit.list.inspect =~/"html_navigation_bar"/) \
- ? :off
- : :na
- end
- def segsubtoc?
- (omit.list.inspect =~/"segsubtoc"/) \
- ? :off
- : :na
- end
- def search_form?
- (omit.list.inspect =~/"search_form"/) \
- ? :off
- : :na
- end
- def html_search_form?
- (omit.list.inspect =~/"html_search_form"/) \
- ? :off
- : :na
- end
- def html_right_pane?
- (omit.list.inspect =~/"html_right_column"|"html_right_pane"/) \
- ? :off
- : :na
- end
- def manifest_minitoc?
- (omit.list.inspect =~/"manifest_minitoc"/) \
- ? :off
- : :na
- end
- def cover_image?
- (omit.list.inspect =~/"cover_image"/) \
- ? :off
- : :na
- end
- def home_button_image?
- (omit.list.inspect =~/"home_button_image"/) \
- ? :off
- : :na
- end
- def texpdf_font
- def main
- @h['texpdf_font'] \
- && (@h['texpdf_font']=~/\S{3,}/) \
- ? @h['texpdf_font']
- : @env.font.texpdf.main
- end
- def sans # not used
- @h['texpdf_font_sans'] \
- && (@h['texpdf_font_sans']=~/\S{3,}/) \
- ? @h['texpdf_font_sans']
- : @env.font.texpdf.sans
- end
- def serif # not used
- @h['texpdf_font_serif'] \
- && (@h['texpdf_font_serif']=~/\S{3,}/) \
- ? @h['texpdf_font_serif']
- : @env.font.texpdf.serif
- end
- def mono
- @h['texpdf_font_mono'] \
- && (@h['texpdf_font_mono']=~/\S{3,}/) \
- ? @h['texpdf_font_mono']
- : @env.font.texpdf.mono
- end
- def cjk
- @h['texpdf_font_cjk'] \
- && (@h['texpdf_font_cjk']=~/\S{3,}/) \
- ? @h['texpdf_font_cjk']
- : @env.font.texpdf.cjk
- end
- def cjk_zh
- @h['texpdf_font_cjk_zh'] \
- && (@h['texpdf_font_cjk_zh']=~/\S{3,}/) \
- ? @h['texpdf_font_cjk_zh']
- : @env.font.texpdf.cjk_zh
- end
- def cjk_ja
- @h['texpdf_font_cjk_ja'] \
- && (@h['texpdf_font_cjk_ja']=~/\S{3,}/) \
- ? @h['texpdf_font_cjk_ja']
- : @env.font.texpdf.cjk_ja
- end
- def cjk_ko
- @h['texpdf_font_cjk_ko'] \
- && (@h['texpdf_font_cjk_ko']=~/\S{3,}/) \
- ? @h['texpdf_font_cjk_ko']
- : @env.font.texpdf.cjk_ko
- end
- self
- end
- def promo
- @h['promo']
- end
- def ad
- @h['ad']
- end
- def manpage
- manpage={}
- if @h['manpage']
- if @h['manpage'] =~/;/m
- man=@h['manpage'].split(/;/m)
- man.each do |x|
- m=(x=~/=/m) ? x.split(/=/m) : nil
- if m
- manpage[m[0].strip] = m[1].split(/ \. /)
- end
- end
- end
- end
- if manpage['name']
- manpage['name']=manpage['name'].join("\n.br\n").
- gsub(/(-)/m,"\\\\\\1").
- gsub(/\A/,"\n.br\n.SH NAME\n.br\n")
- else
- manpage['name']='man page "name/whatis" information not provided, set in header @man: name=[whatis information]'
- end
- if manpage['synopsis']
- manpage['synopsis']=manpage['synopsis'].join("\n\n.br\n").
- gsub(/(-)/m,"\\\\\\1").
- gsub(/\A/,"\n.br\n.SH SYNOPSIS\n.br\n")
- else
- manpage['synopsis']=''
- end
- unless manpage['section']
- manpage['section']=1
- end
- manpage
- end
- def get_image_dimensions(img)
- imgk=SiSU_Env::SystemCall.new.imagemagick
- gmgk=SiSU_Env::SystemCall.new.graphicsmagick
- img_pth={
- sst: @env.path.image_source_include,
- pod: File.expand_path("../../../sisupod/image" )
- }
- path_img=if FileTest.file?("#{img_pth[:pod]}/#{img}")
- "#{img_pth[:pod]}/#{img}"
- elsif FileTest.file?("#{img_pth[:sst]}/#{img}")
- "#{img_pth[:sst]}/#{img}"
- else nil
- end
- if path_img
- if imgk or gmgk
- if imgk
- imgsys=`identify #{path_img}`.strip #system call
- elsif gmgk
- imgsys=`gm identify #{path_img}`.strip #system call
- end
- w,h=/(\d+)x(\d+)/m.match(imgsys)[1,2]
- else
- w,h='600','800'
- end
- else
- w,h=nil,nil
- end
- {w: w, h: h}
- end
- def home_button_text
- if @h['home_button_text']
- @h['home_button_text'].split(/\s*;\s*/)
- else nil
- end
- end
- def home_button_image
- s=nil
- s=if @h['home_button_image']
- s=@h['home_button_image'].split(/\s*;\s*/)
- s0=s[0] #if
- image={}
- s=if s0 =~/{(\S+\.(?:jpg|png|gif))(?:\s+(\d+x\d+))?\s*}(?:(http:\/\/\S+)|image)/
- image[:home_button]=$1
- if $2
- image[:dimensions]=$2
- image[:w],image[:h]=/(\d+)x(\d+)/m.match(image[:dimensions])[1,2]
- else
- d=get_image_dimensions(image[:home_button])
- image[:w],image[:h]=d[:w],d[:h]
- image[:dimensions]="#{d[:w]}x#{d[:h]}"
- end
- image[:link]=$3
- image
- end
- else nil
- end
- end
- def cover_image
- s=nil
- if @h['cover_image']
- s=@h['cover_image'].split(/\s*;\s*/)
- s=s[0] #if
- image={}
- if s =~/{\s*(\S+\.(?:jpg|png|gif))(?:\s+(\d+x\d+))?(?:\s+"(.+?)")?\s*}image/
- image[:cover]=$1
- if $2
- image[:dimensions]=$2
- image[:w],image[:h]=/(\d+)x(\d+)/m.match(image[:dimensions])[1,2]
- else
- d=get_image_dimensions(image[:cover])
- image[:w],image[:h]=d[:w],d[:h]
- image[:dimensions]="#{d[:w]}x#{d[:h]}"
- end
- image[:note]=$3
- elsif s =~/(\S+\.(?:jpg|png|gif))/
- image[:cover]=$1
- d=get_image_dimensions(image[:cover])
- image[:w],image[:h]=d[:w],d[:h]
- image[:dimensions]="#{d[:w]}x#{d[:h]}"
- image[:note]=nil
- end
- image
- else nil
- end
- end
- def footer
- if @h['footer']
- @h['footer'].split(/\s*;\s*/)
- else nil
- end
- end
- self
- end
- def make_links
- @doc_links=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m)
- def links
- lnks,a_idx=[],0
- @doc_links.each do |doc_link|
- if doc_link=~/\{.+?\}(?:(?:https?|file|ftp):\/|\.\.)\/\S+(?:\s|$)/
- say,url=/\{\s*(.+?)\s*\}((?:(?:https?|file|ftp):\/|\.\.)\/\S+)/im.match(doc_link)[1,2]
- lnks[a_idx]={ say: say, url: url }
- a_idx +=1
- end
- end
- lnks
- end
- def append?
- (@doc_links[0]=='+') \
- ? :yes
- : :no
- end
- self
- end
- end
- class MakeHead
- attr_accessor :pagenew,:pagebreak,:pageline,:toc,:lv1,:lv2,:lv3,:lv4,:lv5,:lv6,:num_top,:i18n,:man_section,:substitution_match_list,:bold_match_list,:italics_match_list,:emphasis_set_to,:footer_links,:home_button_links,:home_button_image,:cover_image
- def initialize(make)
- @make=make
- end
- def clear
- @pagenew=@pagebreak=@pageline=@toc=@lv1=@lv2=@lv3=@lv4=@lv5=@lv6=@num_top=@i18n=@man_section=@footer_links=@substitution_match_list=@bold_match_list=@italics_match_list=@emphasis_set_to=@home_button_links=@home_button_image=@cover_image=nil
- end
- def make_instruct
- clear
- if defined? @make.breaks \
- and @make.breaks[:page_new] #clearpage
- @pagenew=@make.breaks[:page_new]
- end
- if defined? @make.breaks \
- and @make.breaks[:page_break] #newpage
- @pagebreak=@make.breaks[:page_break]
- end
- if defined? @make.breaks \
- and @make.breaks[:page_line] #page line across
- @pagebreak=@make.breaks[:page_line]
- end
- if defined? @make.headings \
- and @make.headings
- @toc=@make.headings[0]
- @lv1=@make.headings[1]
- @lv2=@make.headings[2]
- @lv3=@make.headings[3]
- @lv4=@make.headings[4]
- @lv5=@make.headings[5]
- @lv6=@make.headings[6]
- end
- if defined? @make.num_top \
- and @make.num_top
- @num_top=@make.num_top # remove @num_top
- end
- if defined? @make.language \
- and @make.language[0]
- @i18n=@make.language
- end
- if defined? @make.manpage \
- and @make.manpage
- @man_section=(defined? @make.manpage.section) \
- ? @make.manpage.section
- : 1
- end
- if defined? @make.substitute \
- and @make.substitute
- @substitution_match_list=@make.substitute
- end
- if defined? @make.bold \
- and @make.bold
- @bold_match_list=@make.bold
- end
- if defined? @make.italics \
- and @make.italics
- @italics_match_list=@make.italics
- end
- if defined? @make.emphasis \
- and @make.emphasis
- @emphasis_set_to=@make.emphasis
- end
- if defined? @make.footer \
- and @make.footer.is_a?(Array)
- @footer_links= { left: { say: '', url: '' }, center: { say: '', url: '' } } #already set
- @footer_links[:left]=if @make.footer[0]=~/\{.+?\}(?:(?:https?|file|ftp):\/|\.\.)\/\S+(?:\s|$)/
- say,url=/\{\s*(.+?)\s*\}((?:(?:https?|file|ftp):\/|\.\.)\/\S+)/im.match(@make.footer[0])[1,2]
- { say: say, url: url }
- else
- { say: '', url: '' }
- end
- @footer_links[:center]=if @make.footer[1]=~/\{.+?\}(?:(?:https?|file|ftp):\/|\.\.)\/\S+(?:\s|$)/
- say,url=/\{\s*(.+?)\s*\}((?:(?:https?|file|ftp):\/|\.\.)\/\S+)/im.match(@make.footer[1])[1,2]
- { say: say, url: url }
- else
- { say: '', url: '' }
- end
- @footer_links
- else #already set
- @footer_links= { left: { say: '', url: '' }, center: { say: '', url: '' } }
- end
- if defined? @make.home_button_text \
- and @make.home_button_text.is_a?(Array)
- a_idx=0
- @home_button_links=[]
- @make.home_button_text.each do |doc_link|
- if doc_link=~/\{.+?\}(?:(?:https?|file|ftp):\/|\.\.)\/\S+(?:\s|$)/
- say,url=/\{\s*(.+?)\s*\}((?:(?:https?|file|ftp):\/|\.\.)\/\S+)/im.match(doc_link)[1,2]
- @home_button_links[a_idx]= { say: say, url: url }
- a_idx +=1
- end
- end
- @home_button_links
- end
- if defined? @make.home_button_image \
- and @make.home_button_image.is_a?(Hash)
- @home_button_image=@make.home_button_image
- end
- if defined? @make.cover_image \
- and @make.cover_image.is_a?(Hash)
- @cover_image=@make.cover_image
- end
- { pagenew: @pagenew,
- pagebreak: @pagebreak,
- pageline: @pageline,
- toc: @toc,
- lv1: @lv1,
- lv2: @lv2,
- lv3: @lv3,
- lv4: @lv4,
- lv5: @lv5,
- lv6: @lv6,
- num_top: @num_top,
- i18n: @i18n,
- emphasis_set_to: @emphasis_set_to,
- bold_match_list: @bold_match_list,
- italics_match_list: @italics_match_list,
- substitution_match_list: @substitution_match_list,
- man_section: @man_section,
- footer_links: @footer_links,
- home_button_links: @home_button_links,
- home_button_image: @home_button_image,
- cover_image: @cover_image,
- }
- end
- end
-end
-__END__
diff --git a/lib/sisu/current/html.rb b/lib/sisu/current/html.rb
deleted file mode 100644
index 3aab3be..0000000
--- a/lib/sisu/current/html.rb
+++ /dev/null
@@ -1,775 +0,0 @@
-# encoding: utf-8
-=begin
-
-* Name: SiSU
-
-** Description: documents, structuring, processing, publishing, search
-*** html generation, processing
-
-** Author: Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
-** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
- All Rights Reserved.
-
-** License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
-** SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
-** Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
-** Git
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/html.rb;hb=HEAD>
-
-=end
-module SiSU_HTML
- begin
- require 'pstore'
- rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
- error('pstore NOT FOUND (LoadError)')
- end
- require_relative 'se_hub_particulars' # se_hub_particulars.rb
- include SiSU_Particulars
- require_relative 'html_table' # html_table.rb
- require_relative 'html_parts' # html_parts.rb
- require_relative 'html_format' # html_format.rb
- include SiSU_HTML_Format
- require_relative 'html_segments' # html_segments.rb
- include SiSU_HTML_Seg
- require_relative 'html_scroll' # html_scroll.rb
- require_relative 'html_promo' # html_promo.rb
- include SiSU_HTML_Promo
- require_relative 'html_tune' # html_tune.rb
- include SiSU_HTML_Tune
- class Source
- def initialize(opt)
- @opt=opt
- @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)
- end
- def read
- begin
- songsheet
- ensure
- SiSU_Env::CreateSite.new(@opt).cp_css
- SiSU_Env::CreateSite.new(@opt).cp_base_images
- Dir.chdir(@opt.f_pth[:pth])
- end
- end
- def songsheet
- begin
- @md=@particulars.md
- @fnb=@md.fnb
- @env=@particulars.env
- primary_output_file=(@opt.act[:html_seg][:set]==:on) \
- ? (@md.file.output_path.html_seg.dir + '/' + @md.file.base_filename.html_segtoc)
- : (@md.file.output_path.html_scroll.dir + '/' + @md.file.base_filename.html_scroll)
- unless @opt.act[:quiet][:set]==:on
- tool=(@opt.act[:verbose][:set]==:on \
- || @opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on) \
- ? ("#{@env.program.web_browser} file://#{primary_output_file}")
- : ("[#{@opt.f_pth[:lng_is]}] #{@opt.fno}")
- (@opt.act[:verbose][:set]==:on \
- || @opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on) \
- ? SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- 'HTML',
- tool
- ).green_hi_blue
- : SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- 'HTML',
- tool
- ).green_title_hi
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- @opt.fns,
- "file://#{primary_output_file}"
- ).flow
- end
- end
- data=nil
- tuned_file_array=SiSU_HTML::Source::HTML_Environment.new(@particulars).tuned_file_instructions
- data=tuned_file_array
- if @opt.act[:html_scroll][:set]==:on
- scr_endnotes=SiSU_HTML::Source::Endnotes.new(data,@md).scroll
- end
- toc=SiSU_HTML::Source::Toc.new(@md,data).songsheet
- links_guide=SiSU_HTML::Source::LinksGuide.new(data,@md).toc
- data=tuned_file_array
- scr_toc=SiSU_HTML::Source::ScrollHeadAndSegToc.new(@md,toc,links_guide).in_common #watch
- if @opt.act[:html_seg][:set]==:on
- SiSU_HTML::Source::Seg.new(@md,data).songsheet
- end
- data=tuned_file_array
- if @opt.act[:html_scroll][:set]==:on
- scr=SiSU_HTML::Source::Scroll.new(@md,data,scr_endnotes).songsheet
- scroll=SiSU_HTML::Source::ScrollOutput.new(
- scr_toc,
- scr[:body],
- scr[:metadata],
- scr[:owner_details],
- scr[:tails],
- @md
- ).publish
- SiSU_HTML::Source::Output.new(scroll,@md).scroll
- end
- rescue
- SiSU_Errors::Rescued.new($!,$@,@opt.selections.str,@opt.fns).location do
- __LINE__.to_s + ':' + __FILE__
- end
- ensure
- unless (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- texfiles=Dir["#{@env.processing_path.tune}/#{@opt.fns}*"]
- texfiles.each do |f|
- if FileTest.file?(f)
- File.unlink(f)
- end
- end
- end
- SiSU_Env::Clear.new(@opt.selections.str,@opt.fns,@md).param_instantiate
- @@flag,@@scr,@@seg,@@seg_endnotes,@@seg_subtoc={},{},{},{},{}
- @@tracker=0
- @@seg_name,@@seg_name_x,@@seg_subtoc_array,@@seg_endnotes_array,@@tablefoot=Array.new(5){[]}
- @@filename_seg,@@seg_url,@@to_lev4,@@get_hash_to,@@get_hash_fn='','','','',''
- end
- end
- private
- class HTML_Environment
- def initialize(particulars)
- @particulars=particulars
- @md,@env=particulars.md,particulars.env
- @env,@css=particulars.env,SiSU_Style::CSS.new
- end
- def tuned_file_instructions
- @tell=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set])
- ao_array=@particulars.ao_array # ao file drawn here
- tuned_file_array=SiSU_HTML_Tune::Tune.new(ao_array,@md).songsheet
- tuned_file_array
- end
- end
- class LinksGuide
- @links_guide_toc=[]
- def initialize(data,md)
- @data,@md=data,md
- @links_guide_=SiSU_Env::CreateSite.new(@md.opt).html_quick_ref?
- end
- def toc
- @links_guide_toc=[]
- if @links_guide_
- format_head_toc=SiSU_HTML_Format::HeadToc.new(@md)
- guide_type='horzontal' #values: horizontal or vertical
- @links_guide_toc << format_head_toc.links_guide_open(guide_type)
- if defined? @md.lnk \
- and @md.lnk
- @md.lnk.each do |l|
- if defined? l[:say]
- target=(l[:url] !~/^\.(\.)?\//) \
- ? 'external'
- : '_top'
- s_lnk_url,s_lnk_lnk=l[:url],l[:say]
- txt_obj={
- lnk_url: s_lnk_url,
- lnk_txt: s_lnk_lnk,
- target: target,
- }
- lev_dob_ocn=SiSU_HTML_Format::FormatToc.new(@md,txt_obj)
- @links_guide_toc << lev_dob_ocn.links_guide if s_lnk_lnk
- end
- end
- end
- format_head_toc=SiSU_HTML_Format::HeadToc.new(@md)
- @links_guide_toc << format_head_toc.links_guide_close #(guide_type)
- @links_guide_toc
- else ''
- end
- end
- end
- class Endnotes
- include SiSU_HTML_Format
- def initialize(data,md)
- @data,@md=data,md
- end
- def scroll
- @scr_endnotes=[]
- SiSU_HTML_Format::HeadScroll.new(@md)
- @data.each do |dob|
- pg=dob.dup
- unless pg.is ==:code
- if pg.obj =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[\d*+]+ /
- endnote_array=[]
- if pg.obj=~/#{Mx[:en_a_o]}[\d*+].+?#{Mx[:en_a_c]}/m
- endnote_array = pg.obj.scan(/#{Mx[:en_a_o]}[\d*+]+(.+?)#{Mx[:en_a_c]}/m)
- end
- if pg.obj=~/#{Mx[:en_b_o]}[\d*]+\s.+?#{Mx[:en_b_c]}/m
- endnote_array = pg.obj.scan(/#{Mx[:en_b_o]}[\d*]+(.+?)#{Mx[:en_b_c]}/m)
- end
- if pg.obj=~/#{Mx[:en_b_o]}[\d+]+\s.+?#{Mx[:en_b_c]}/m
- endnote_array = pg.obj.scan(/#{Mx[:en_b_o]}[\d+]+(.+?)#{Mx[:en_b_c]}/m)
- end
- endnote_array.flatten.each do |note|
- txt_obj={ txt: note }
- format_scroll=SiSU_HTML_Format::FormatScroll.new(@md,txt_obj)
- @scr_endnotes << format_scroll.endnote_body
- end
- end
- end
- end
- @scr_endnotes
- end
- end
- class Toc <LinksGuide
- @@toc={ seg: [], seg_mini: [], scr: [] }
- @@seg_url=''
- @@firstseg=nil
- def initialize(md=nil,data='')
- @data,@md=data,md
- @tell=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set]) if @md
- end
- def songsheet #extracts toc for scroll & seg
- if (@md.opt.act[:verbose][:set]==:on \
- || @md.opt.act[:verbose_plus][:set]==:on \
- || @md.opt.act[:maintenance][:set]==:on)
- SiSU_Screen::Ansi.new(
- @md.opt.act[:color_state][:set],
- 'Toc'
- ).txt_grey
- end
- toc=nil
- @@firstseg=nil
- @@toc={ seg: [], seg_mini: [], scr: [] }
- @data.each do |dob|
- if dob.is==:heading \
- || dob.is==:heading_insert
- dob_toc=dob.dup
- toc=if dob_toc.is ==:heading \
- || dob.is==:heading_insert
- toc=case dob_toc.ln
- when 0 then SiSU_HTML::Source::Toc.new(@md,dob_toc).level_0
- when 1 then SiSU_HTML::Source::Toc.new(@md,dob_toc).level_1
- when 2 then SiSU_HTML::Source::Toc.new(@md,dob_toc).level_2
- when 3 then SiSU_HTML::Source::Toc.new(@md,dob_toc).level_3
- when 4 then SiSU_HTML::Source::Toc.new(@md,dob_toc).level_4
- when 5 then SiSU_HTML::Source::Toc.new(@md,dob_toc).level_5
- when 6 then SiSU_HTML::Source::Toc.new(@md,dob_toc).level_6
- else nil
- end
- end
- toc.each do |k,d|
- d.gsub!(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ')
- end if toc
- if @@firstseg.nil? \
- and dob.ln==4 \
- and dob.name =~/\S+/
- @@firstseg=dob.name
- end
- if toc
- begin
- @@toc[:seg] << toc[:seg] if toc[:seg]
- @@toc[:seg_mini] << toc[:seg_mini] if toc[:seg_mini]
- @@toc[:scr] << toc[:scr] if toc[:scr]
- rescue
- SiSU_Errors::Rescued.new($!,$@,@md.opt.selections.str,@md.fns).location do
- __LINE__.to_s + ':' + __FILE__
- end
- end
- end
- end
- end
- @md.firstseg=@@firstseg
- @@toc
- end
- def minitoc
- minitoc=@@toc[:seg_mini].join("\n")
- '<div class="toc">' + minitoc + '</div>'
- end
- protected
- def rss #sort all wrong, disabled but kept
- @@toc[:seg] <<<<WOK
-<center>
-<table><tr><td>
-<p><font color="#222222" #{the_font.set_face} size="2">
-(relatively static) RSS feeds for DOCUMENTS:<br>
-<a href="../rssfeed/documents.xml"><img border="0" height="14" width="36" src="../_sisu/image/rss.png" alt="RSS feed"></a>&nbsp;http://www.jus.uio.no/lm/rssfeed/documents.xml<br>
-<a href="../rssfeed/tradelaw.xml"><img border="0" height="14" width="36" src="../_sisu/image/rss.png" alt="RSS feed"></a>&nbsp;http://www.jus.uio.no/lm/rssfeed/tradelaw.xml<br>
-<a href="../rssfeed/environmental.xml"><img border="0" height="14" width="36" src="../_sisu/image/rss.png" alt="RSS feed"></a>&nbsp;http://www.jus.uio.no/lm/rssfeed/environmental.xml<br>
-<center><a href="mailto:info@address.com" target="_top">info@address.com</a></center>
-</font></p>
-</td></tr></table>
-WOK
- end
-#not used -->
- def level_endnotes
- if @md.flag_endnotes
- format_head_scroll=SiSU_HTML_Format::HeadScroll.new(@md)
- @@toc[:scr] << format_head_scroll.toc_endnote
- end
- end
- def level_concordance
- format_head_toc=SiSU_HTML_Format::HeadToc.new(@md)
- @@toc[:seg_mini] << format_head_toc.mini_seg_concordance
- end
- def level_metadata
- format_head_toc=SiSU_HTML_Format::HeadToc.new(@md)
- @@toc[:scr] << format_head_toc.metadata
- @@toc[:seg] << format_head_toc.seg_metadata
- @@toc[:seg_mini] << format_head_toc.mini_seg_metadata
- end
- def level_word_index
- format_head_toc=SiSU_HTML_Format::HeadToc.new(@d0c)
- @@toc[:scr] << format_head_toc.concordance
- @@toc[:seg] << format_head_toc.concordance
- @@toc[:seg_mini] << format_head_toc.mini_concordance
- end
-# <-- not used
- def level_0
- dob=@data
- linkname,link=dob.obj.strip,dob.ocn
- if link \
- and link !~/#/ #% keep eye on link
- SiSU_HTML_Format::ParagraphNumber.new(@md,link)
- end
- title=linkname
- toc={}
- txt_obj={ txt: title }
- format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj)
- toc[:seg]=format_toc.lev0
- toc[:seg_mini]=format_toc.mini_lev0
- title=if dob.ocn ==0 then linkname
- else
- @@toc[:scr] << '<br>'
- %{<b><a href="##{dob.ocn}">#{linkname}</a></b>}
- end
- txt_obj={ txt: title }
- format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj)
- toc[:scr]=format_toc.lev0
- toc
- end
- def level_1
- dob=@data
- linkname,link=dob.obj.strip,dob.ocn
- if link \
- and link !~/#/ #% keep eye on link
- SiSU_HTML_Format::ParagraphNumber.new(@md,link)
- end
- title=if dob.obj !~/^Metadata$/ then linkname
- else
- link='metadata'
- %{<b><a href="#{link}#{@md.lang_code_insert}#{Sfx[:html]}">#{linkname}</a></b>}
- end
- toc={}
- txt_obj={ txt: title }
- format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj)
- toc[:seg]=if dob.name =~/^meta/ \
- and dob.obj =~/Document Information/
- format_toc.lev0
- else format_toc.lev1
- end
- toc[:seg_mini]=if dob.name =~/^meta/ \
- and dob.obj =~/Document Information/
- @md.concord_make \
- ? format_toc.mini_concord_tail
- : format_toc.mini_tail
- else format_toc.mini_lev1
- end
- title=if dob.ocn ==0
- if dob.name =~/^meta/ \
- and dob.obj =~/Document Information/
- %{<a href="#docinfo">#{linkname}</a>}
- else linkname
- end
- else
- @@toc[:scr] << '<br>'
- %{<b><a href="##{dob.ocn}">#{linkname}</a></b>}
- end
- txt_obj={ txt: title }
- format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj)
- toc[:scr]=if dob.obj =~/^Metadata$/ then ''
- elsif txt_obj[:txt] =~/<a href="#">/
- format_toc.lev1.gsub(/<a href="#">|<\/a>/,'')
- else format_toc.lev1
- end
- toc
- end
- def level_2
- dob=@data
- linkname,ocn=dob.obj.strip,dob.ocn
- p_num=if ocn \
- and ocn !~/#/
- SiSU_HTML_Format::ParagraphNumber.new(@md,ocn)
- else nil
- end
- txt_obj={ txt: linkname }
- format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj)
- toc={}
- toc[:seg]=format_toc.lev2
- toc[:seg_mini]=format_toc.mini_lev2
- if p_num
- title=%{#{p_num.goto}#{linkname}</a>}
- txt_obj={ txt: title }
- format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj)
- toc[:scr]=if txt_obj[:txt] =~/<a href="#">/
- format_toc.lev2.gsub(/<a href="#">|<\/a>/,'')
- else format_toc.lev2
- end
- end
- toc
- end
- def level_3
- dob=@data
- linkname,ocn=dob.obj.strip,dob.ocn
- p_num=if ocn \
- and ocn !~/#/
- SiSU_HTML_Format::ParagraphNumber.new(@md,ocn)
- else nil
- end
- txt_obj={ txt: linkname }
- format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj)
- toc={}
- toc[:seg]=format_toc.lev3
- toc[:seg_mini]=format_toc.mini_lev3
- if p_num
- title=%{#{p_num.goto}#{linkname}</a>}
- txt_obj={ txt: title }
- format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj)
- toc[:scr]=if txt_obj[:txt] =~/<a href="#">/
- format_toc.lev3.gsub(/<a href="#">|<\/a>/,'')
- else format_toc.lev3
- end
- end
- toc
- end
- def level_4
- dob=@data
- linkname,ocn=dob.obj.strip,dob.ocn
- p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn) if ocn
- if dob.ln ==4
- fnh={
- fn: dob.name,
- }
- f=@md.file.base_filename.html_seg(fnh)
- seg_link=%{ <a href="#{f}" target="_top">
- #{dob.obj}
- </a> }
- @@seg_url=dob.name
- elsif dob.obj =~/\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+/
- fn,hd=/^(\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+)(.*)/.match(dob.obj)[1,2]
- fnh={
- fn: fn,
- }
- f=@md.file.base_filename.html_seg(fnh)
- seg_link=%{<a href="#{f}" target="_top">#{fn} #{hd}</a> }
- end
- p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn) if ocn
- @file=SiSU_Env::FileOp.new(@md) if @md
- txt_obj=if seg_link=~/sisu_manifest\.html/
- man_link=if @file.output_dir_structure.by_language_code? \
- or @file.output_dir_structure.by_filetype?
- seg_link.gsub(/sisu_manifest\.html/,"../../manifest/#{@file.base_filename.manifest}")
- else seg_link
- end
- { txt: man_link }
- else { txt: seg_link }
- end
- format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj)
- toc={}
- toc[:seg]=format_toc.lev4
- toc[:seg_mini]=format_toc.mini_lev4
- title=%{#{p_num.goto}#{linkname}</a>} if p_num
- txt_obj=if title=~/sisu_manifest.html/
- man_link=title.gsub(/sisu_manifest.html/,"../manifest/#{@file.base_filename.manifest}")
- { txt: man_link }
- else { txt: title }
- end
- format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj)
- toc[:scr]=format_toc.lev4
- toc
- #end
- end
- def level_5
- dob=@data
- linkname,ocn=dob.obj.strip,dob.ocn
- toc={}
- if ocn \
- and ocn !~/#/
- fnh={
- fn: @@seg_url,
- }
- f=@md.file.base_filename.html_seg(fnh)
- p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn)
- lnk_n_txt=%{ <a href="#{f}##{ocn}">
- #{linkname}
- </a>}
- txt_obj={ txt: lnk_n_txt }
- format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj)
- toc[:seg]=format_toc.lev5
- toc[:seg_mini]=format_toc.mini_lev5
- title=%{#{p_num.goto}#{linkname}</a>}
- txt_obj={ txt: title }
- format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj)
- toc[:scr]=format_toc.lev5
- end
- toc
- end
- def level_6
- dob=@data
- linkname,ocn=dob.obj.strip,dob.ocn
- toc={}
- if ocn \
- and ocn !~/#/
- fnh={
- fn: @@seg_url,
- }
- f=@md.file.base_filename.html_seg(fnh)
- p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn)
- lnk_n_txt=%{ <a href="#{f}##{ocn}">
- #{linkname}
-</a>}
- txt_obj={ txt: lnk_n_txt }
- format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj)
- toc[:seg]=format_toc.lev6
- toc[:seg_mini]=format_toc.mini_lev6
- title=%{#{p_num.goto}#{linkname}</a>}
- txt_obj={ txt: title }
- format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj)
- toc[:scr]=format_toc.lev6
- end
- toc
- end
- def level_crosslink
- dob=@data
- dob=if dob !~/^4~!/
- dob.gsub(/^4~!\s+(\S+)\s+(.+)/,
- %{<table><tr><td width =\"80\"></td>
- <td><a href="http://\\1" target="_top">
- #{@png.crosslink_ext}
- &nbsp;&nbsp;\\2
- <\/a>
- </td></tr></table>
-})
- else
- dob.gsub(/^4~!\s+(\S+)\s+(.+)/,
- %{<table><tr><td width ="80">
- </td><td>
- <a href="\\1" target="_top">
- #{@png.crosslink}
- &nbsp;&nbsp;\\2
- <\/a>
- </td></tr></table>
-})
- end
- end
- end
- class ScrollHeadAndSegToc < Toc
- include SiSU_Parts_HTML
- def initialize(md='',toc='',links_guide_toc='')
- @md,@toc,@links_guide_toc=md,toc,links_guide_toc
- @make=SiSU_Env::ProcessingSettings.new(@md)
- end
- def in_common
- toc_shared=[]
- @segtoc=[]
- if (@md.opt.act[:verbose][:set]==:on \
- || @md.opt.act[:verbose_plus][:set]==:on \
- || @md.opt.act[:maintenance][:set]==:on)
- SiSU_Screen::Ansi.new(
- @md.opt.act[:color_state][:set],
- 'Scroll & Segtoc'
- ).txt_grey
- end
- format_head_toc=SiSU_HTML_Format::HeadToc.new(@md)
- dochead=format_head_toc.head
- dochead=dochead.gsub(/toc\.(html)/,'doc.\1') #kludge
- toc_shared << dochead
- @segtoc << format_head_toc.head
- if @make.build.html_top_band?
- toc_shared << format_head_toc.scroll_head_navigation_band
- end
- if defined? @md.rights.all
- rights=format_head_toc.rights.all
- rights=SiSU_HTML_Tune::CleanHTML.new(rights).clean
- end
- if @md.prefix_b
- prefix_b=format_head_toc.notes.prefix_b
- prefix_b=SiSU_HTML_Tune::CleanHTML.new(prefix_b).clean
- end
- if @make.build.html_top_band?
- @segtoc << format_head_toc.seg_head_navigation_band
- end
- toc_shared << format_head_toc.scroll_head_title_banner_open
- @segtoc << format_head_toc.seg_head_title_banner_open
- tmp_head=nil
- doc_title_endnote=@md.title.full.gsub(/(\*+)/,
- '<sup><a href="#endnotes">\1</a></sup>')
- tmp_head=doc_title_endnote + "\n"
- txt_obj={ txt: tmp_head }
- format_txt_obj=SiSU_HTML_Format::FormatTextObject.new(@md,txt_obj)
- toc_shared << format_txt_obj.center_bold
- @segtoc << format_txt_obj.center_bold
- if defined? @md.creator.author
- creator=SiSU_HTML_Tune::CleanHTML.new(@md.creator.author).clean_for_html
- creator_endnote=creator.gsub(/(\*+)/,
- %{&nbsp;<sup><a href="#notes">\\1</a></sup>})
- tmp_head=creator_endnote + "\n"
- txt_obj={ txt: tmp_head }
- format_txt_obj=SiSU_HTML_Format::FormatTextObject.new(@md,txt_obj)
- toc_shared << format_txt_obj.center_bold
- @segtoc << format_txt_obj.center_bold
- end
- toc_shared << "#{the_table_close*1}\n"
- @segtoc << "#{the_table_close*1}\n"
- tmp_head=nil
- if @md.prefix_a
- tmp_head ||= %{<p>#{@md.prefix_a}\n}
- toc_shared << tmp_head.dup
- @segtoc << tmp_head.dup
- end
- tmp_head=nil
- toc_shared << @links_guide_toc
- if defined? @md.rights.all #and ? @md.rights.all
- toc_shared << rights
- end
- if defined? @md.prefix_b
- toc_shared << prefix_b
- end
- if @make.build.toc? #Table of Contents added/appended here
- toc_shared << @toc[:scr]
- end
- @segtoc << @links_guide_toc
- @segtoc << @toc[:seg]
- if defined? @md.rights.all \
- and not @md.rights.all.empty?
- @segtoc << rights
- end
- @segtoc << prefix_b if @md.prefix_b
- #Segtoc tail added here
- @segtoc << "</p>\n" #bugfix sort later DEBUGNOW
- @segtoc << @seg_toc_band_bottom
- @segtoc << format_head_toc.seg_navigation_tail << format_head_toc.html_close
- @segtoc=@segtoc.flatten.compact #watch
- if @md.opt.act[:html_seg][:set]==:on
- SiSU_HTML::Source::Output.new(@segtoc,@md).segtoc
- end
- @segtoc=[]
- @toc[:scr],@toc[:seg]=[],[]
- toc_shared
- end
- end
- class Table < SiSU_HTML_Table::TableHTML
- end
- class Scroll < SiSU_HTML_Scroll::Scroll
- end
- class ScrollOutput
- def initialize(scr_toc,scr_body,scr_metadata,scr_owner_details,scr_tails,md)
- @scr_toc,@scr_body,@scr_metadata,@scr_owner_details,@scr_tails,@md=scr_toc,scr_body,scr_metadata,scr_owner_details,scr_tails,md
- end
- def publish
- scroll=[]
- scroll << @scr_toc << '<div class="scroll">' << @scr_body << @scr_endnotes << @scr_owner_details << '</div>' << @scr_tails
- scroll=scroll.flatten.compact #watch
- end
- end
- class Seg < SiSU_HTML_Seg::Seg
- end
- class Output
- def initialize(data='',md='')
- @data,@md=data,md
- @file=SiSU_Env::FileOp.new(md)
- @o_str ||=SiSU_Env::ProcessingSettings.new(md).output_dir_structure
- end
- def scroll
- if @md.opt.act[:html_scroll][:set]==:on
- begin
- @filename_html_scroll=@file.write_file.html_scroll
- @data.each do |para|
- para=para.strip.
- gsub(/<:.+?>/,'').
- gsub(Xx[:html_relative2],@file.path_rel_links.html_scroll_2).
- gsub(Xx[:html_relative1],@file.path_rel_links.html_scroll_1).
- #gsub(/#{Xx[:html_relative]}/,@file.path_rel_links.html_scroll).
- gsub(/#{Rx[:mx_fa_clean]}/,'')
- unless para =~/\A\s*\Z/
- @filename_html_scroll.puts para,"\n"
- end
- end
- rescue
- SiSU_Errors::Rescued.new($!,$@,@md.opt.selections.str,@md.fns).location do
- __LINE__.to_s + ':' + __FILE__
- end
- ensure
- @filename_html_scroll.close
- end
- end
- end
- def segtoc
- if @md.opt.act[:html_seg][:set]==:on
- begin
- @filename_html_segtoc=@file.write_file.html_segtoc
- @data.each do |para|
- para=para.strip.
- gsub(/<!.+?!>/,'').
- gsub(Xx[:html_relative2],@file.path_rel_links.html_seg_2).
- gsub(Xx[:html_relative1],@file.path_rel_links.html_seg_1)
- unless para =~/\A\s*\Z/
- @filename_html_segtoc.puts para,"\n"
- end
- end
- rescue
- SiSU_Errors::Rescued.new($!,$@,@md.opt.selections.str,@md.fns).location do
- __LINE__.to_s + ':' + __FILE__
- end
- ensure
- @filename_html_segtoc.close
- pwd_set=Dir.pwd
- idx_lnk=(@o_str.dump_or_redirect?) \
- ? @file.base_filename.manifest
- : @file.base_filename.html_segtoc
- mlnk=@file.base_filename.html_seg_index
- Dir.chdir(@file.output_path.html_seg.dir)
- FileUtils::rm_f(mlnk)
- FileUtils::ln_s(idx_lnk,mlnk)
- Dir.chdir(pwd_set)
- end
- end
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/current/html_harvest.rb b/lib/sisu/current/html_harvest.rb
deleted file mode 100644
index 0ac5c95..0000000
--- a/lib/sisu/current/html_harvest.rb
+++ /dev/null
@@ -1,109 +0,0 @@
-# encoding: utf-8
-=begin
-
-* Name: SiSU
-
-** Description: documents, structuring, processing, publishing, search
-*** metadata harvest, harvest metadata from document corpus
-
-** Author: Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
-** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
- All Rights Reserved.
-
-** License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
-** SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
-** Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
-** Git
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/harvest.rb;hb=HEAD>
-
-=end
-module SiSU_Harvest
- @@the_idx_topics,@@the_idx_authors={},{}
- class Source
- require_relative 'hub_options' # hub_options.rb
- require_relative 'html_harvest_topics' # html_harvest_topics.rb
- require_relative 'html_harvest_authors' # html_harvest_authors.rb
- require_relative 'se' # se.rb
- include SiSU_Env
- def initialize(opt)
- @opt=opt
- @env=SiSU_Env::InfoEnv.new
- end
- def read
- begin
- harvest_pth=@env.path.webserv + '/' + @opt.base_stub
- FileUtils::mkdir_p(harvest_pth) unless FileTest.directory?(harvest_pth)
- cases(@opt,@env)
- rescue
- ensure
- SiSU_Env::CreateSite.new(@opt).cp_css
- end
- end
- def help
- puts <<WOK
- harvest --harvest extracts document index metadata
-
-WOK
- end
- def css(opt)
- require_relative '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,env)
- case opt.selections.str.inspect
- when/--harvest/i
- css(opt) if @opt.act[:maintenance][:set]==:on
- SiSU_HarvestAuthors::Songsheet.new(opt,env).songsheet
- SiSU_HarvestTopics::Songsheet.new(opt,env).songsheet
- if @opt.act[:rsync][:set]==:on
- require_relative 'remote' # remote.rb
- SiSU_Remote::Put.new(opt).rsync_harvest
- end
- else
- help
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/current/html_harvest_topics.rb b/lib/sisu/current/html_harvest_topics.rb
deleted file mode 100644
index 4b6f493..0000000
--- a/lib/sisu/current/html_harvest_topics.rb
+++ /dev/null
@@ -1,893 +0,0 @@
-# encoding: utf-8
-=begin
-
-* Name: SiSU
-
-** Description: documents, structuring, processing, publishing, search
-*** metadata harvest, extract topics and associated writings from document set
- (topics use topic_register header)
-
-** Author: Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
-** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
- All Rights Reserved.
-
-** License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
-** SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
-** Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
-** Git
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/harvest_topics.rb;hb=HEAD>
-
-=end
-module SiSU_HarvestTopics
- require_relative 'html_harvest_author_format' # html_harvest_author_format.rb
- require_relative 'html_parts' # html_parts.rb
- class Songsheet
- @@the_idx_topics={}
- def initialize(opt,env)
- @opt,@env=opt,env
- @file_list=opt.files
- end
- def songsheet
- idx_array={}
- @opt.f_pths.each do |y|
- lang_hash_file_array={}
- name=y[:f]
- filename=y[:pth] + '/' + y[:f]
- File.open(filename,'r') do |file|
- file.each_line("\n\n") do |line|
- if line =~/^@(?:title|creator|classify):(?:\s|$)/m
- lang_hash_file_array[y[:lng_is]] ||= []
- lang_hash_file_array[y[:lng_is]] << line
- elsif line =~/^@\S+?:(?:\s|$)/m \
- or line =~/^(?:\s*\n|\s*$|%+ )/
- else break
- end
- end
- end
- lang_hash_file_array.each_pair do |lang,a|
- idx_array[lang] ||=[]
- idx_array=SiSU_HarvestTopics::Harvest.new(
- @opt,
- @env,
- a,
- filename,
- name,
- idx_array,
- lang
- ).extract_harvest
- end
- end
- the_hash=SiSU_HarvestTopics::Index.new(
- @opt,
- @env,
- idx_array,
- @@the_idx_topics
- ).song
- SiSU_HarvestTopics::OutputIndex.new(
- @opt,
- the_hash
- ).html_print.html_songsheet
- end
- end
- class Mix
- def spaces
- Ax[:spaces]
- end
- end
- class Harvest
- def initialize(opt,env,data,filename,name,idx_array,lang)
- @opt, @env,@data,@filename,@name,@idx_array,@lang=
- opt,env, data, filename, name, idx_array, lang
- end
- def extract_harvest
- data, filename, name, idx_array, lang=
- @data,@filename,@name,@idx_array,@lang
- @idx_lst=@title=@subtitle=@fulltitle=@author=@author_format=nil
- rgx={}
- rgx[:author]=/^@creator:(?:[ ]+|.+?:author:[ ]+)(.+?)(?:\||\n)/m
- rgx[:title]=/^@title:[ ]+(.+)/
- rgx[:subtitle]=/^@title:.+?:subtitle:[ ]+(.+?)\n/m
- rgx[:idx]=/^@classify:.+?:topic_register:[ ]+(.+?)(?:\n\n|\n\s+:\S|\n%)/m
- data.each do |para|
- if para=~ rgx[:idx]
- @idx_list=(rgx[:idx].match(para)[1]).split(/\s*\n\s*/).join
- 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 && @subtitle && @author && @idx_lst
- end
- @fulltitle=@subtitle ? (@title + ' - ' + @subtitle) : @title
- if @title \
- and @author_format \
- and @idx_list
- creator=SiSU_FormatAuthor::Author.new(@author_format.strip).author_details
- @authors,@authorship=creator[:authors],creator[:authorship]
- file=if name=~/~[a-z]{2,3}\.ss[mt]$/
- name.sub(/~[a-z]{2,3}\.ss[mt]$/,'')
- else
- name.sub(/\.ss[mt]$/,'')
- end
- page=if @env.output_dir_structure.by? == :language
- "#{lang}/sisu_manifest.html"
- else
- "sisu_manifest.#{lang}.html"
- end
- idx_array[lang] <<=if @idx_list =~/;/
- g=@idx_list.scan(/[^;]+/)
- g.each.map do |i|
- i=i.strip
- {
- filename: filename,
- file: file,
- rough_idx: i,
- title: @fulltitle,
- author: creator,
- page: page,
- lang: lang
- }
- end
- else {
- filename: filename,
- file: file,
- rough_idx: @idx_list,
- title: @fulltitle,
- author: creator,
- page: page,
- lang: lang,
- }
- end
- else
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- p "missing required field in #{@filename} - [title]: <<#{@title}>>; [author]: <<#{@author_format}>>; [idx]: <<#{@idx_list}>>"
- end
- end
- idx_array[lang]=idx_array[lang].flatten
- idx_array
- end
- end
- class Index < Mix
- def initialize(opt,env,idx_array,the_idx)
- @opt, @env,@idx_array,@the_idx=
- opt,env, idx_array, the_idx
- @@the_idx_topics=@the_idx
- end
- def song
- the_idx=construct_book_topic_keys
- construct_book_topic_hash(the_idx)
- end
- def capital(txt)
- txt_a=txt.scan(/\S+/)
- tx=''
- txt_a.each do |t|
- tx += t[0].chr.capitalize + t[1,txt.length] + ' '
- end
- tx.strip
- end
- def capital_(txt)
- txt[0].chr.capitalize + txt[1,txt.length]
- end
- def contents(idx,lang)
- names=''
- idx[:author][:last_first_format_a].each do |n|
- s=n.sub(/(.+?)(?:,.+|$)/,'\1').gsub(/\s+/,'_')
- names=if @env.output_dir_structure.by? == :language
- names += %{<a href="authors.html##{s}">#{n}</a>, }
- else
- names += %{<a href="authors.#{lang}.html##{s}">#{n}</a>, }
- end
- end
- {
- filename: idx[:filename],
- file: idx[:file],
- author: names,
- title: idx[:title],
- page: idx[:page]
- }
- end
- def capital_(txt)
- txt[0].chr.capitalize + txt[1,txt.length]
- end
- def key_create(c,alt)
- x=nil
- x=if c.length==6
- c[0].to_s + '|' +
- capital(c[1][0].to_s) + '|' +
- capital(c[2][0].to_s) + '|' +
- capital(c[3][0].to_s) + '|' +
- capital(alt.to_s)
- elsif c.length==5
- c[0].to_s + '|' +
- capital(c[1][0].to_s) + '|' +
- capital(c[2][0].to_s) + '|' +
- capital(alt.to_s)
- elsif c.length==4
- c[0].to_s + '|' +
- capital(c[1][0].to_s) + '|' +
- capital(alt.to_s)
- elsif c.length==3
- c[0].to_s + '|' +
- capital(alt.to_s)
- end
- end
- def construct_book_topic_keys
- idx_array=@idx_array
- @idx_a=[]
- @the_a=[]
- idx_array.each_pair do |lang,idx_arr|
- @@the_idx_topics[lang] ||= {}
- idx_arr.each do |idx|
- if idx[:rough_idx]
- idx_lst=idx[:rough_idx].scan(/[^:]+/)
- else
- puts "no topic register in: << #{idx[:filename]} >>"
- next
- end
- idx_a=[]
- idx_lst.each do |c|
- idx_a << c.scan(/[^|\n]+/m)
- end
- idx_a << contents(idx,lang)
- @idx_a << [lang] + idx_a
- end
- end
- @idx_a.each do |c|
- if c.length > 1 \
- and c.is_a?(Array)
- if c[2].is_a?(Hash)
- c[1].each do |alt|
- v=key_create(c,alt)
- @the_a << [v, c[2]] if v
- end
- end
- end
- if c.length > 2 \
- and c.is_a?(Array)
- if c[3].is_a?(Hash)
- c[2].each do |alt|
- v=key_create(c,alt)
- @the_a << [v, c[3]] if v
- end
- end
- end
- if c.length > 3 \
- and c.is_a?(Array)
- if c[4].is_a?(Hash)
- c[3].each do |alt|
- v=key_create(c,alt)
- @the_a << [v, c[4]] if v
- end
- end
- end
- if c.length > 4 \
- and c.is_a?(Array)
- if c[5].is_a?(Hash)
- c[4].each do |alt|
- v=key_create(c,alt)
- @the_a << [v, c[5]] if v
- end
- end
- end
- if c.length > 5 \
- and c.is_a?(Array)
- if c[6].is_a?(Hash)
- c[5].each do |alt|
- v=key_create(c,alt)
- @the_a << [v, c[6]] if v
- end
- end
- end
- end
- @the_a.sort_by { |x| x[0] } #; y.each {|z| puts z}
- end
- def construct_book_topic_hash(t)
- @the_h={}
- t.each do |z|
- x=z[0].scan(/[^|]+/)
- depth=x.length
- extract=(depth-1)
- k=case extract
- when 4
- { x[0] => { x[1] => { x[2] => { x[3] => { x[4] => z[1] } } } } }
- when 3
- { x[0] => { x[1] => { x[2] => { x[3] => z[1] } } } }
- when 2
- { x[0] => { x[1] => { x[2] => z[1] } } }
- when 1
- { x[0] => { x[1] => z[1] } }
- when 0
- { x[0] => z[1] }
- end
- if extract >= 0
- k.each_pair do |x0,y0|
- if extract == 0
- @the_h[x0] ||={ md: [] }
- @the_h[x0][:md] << y0
- else
- @the_h[x0] ||={}
- end
- #puts spaces*0 + x0
- if extract >= 1
- y0.each_pair do |x1,y1|
- if extract == 1
- @the_h[x0][x1] ||={ md: [] }
- @the_h[x0][x1][:md] << y1
- else
- @the_h[x0][x1] ||={}
- end
- #puts spaces*1 + x1
- if extract >= 2
- y1.each_pair do |x2,y2|
- if extract == 2
- @the_h[x0][x1][x2] ||={ md: [] }
- @the_h[x0][x1][x2][:md] << y2
- else
- @the_h[x0][x1][x2] ||={}
- end
- #puts spaces*2 + x2
- if extract >= 3
- y2.each_pair do |x3,y3|
- if extract == 3
- @the_h[x0][x1][x2][x3] ||={ md: [] }
- @the_h[x0][x1][x2][x3][:md] << y3
- else
- @the_h[x0][x1][x2][x3] ||={}
- end
- #puts spaces*3 + x3
- if extract == 4
- y3.each_pair do |x4,y4|
- if extract == 4
- @the_h[x0][x1][x2][x3][x4] ||={ md: [] }
- @the_h[x0][x1][x2][x3][x4][:md] << y4
- else
- @the_h[x0][x1][x2][x3][x4] ||={}
- end
- #puts spaces*4 + x4
- if extract == 5
- y4.each_pair do |x5,y5|
- if extract == 5
- @the_h[x0][x1][x2][x3][x4][x5] ||={ md: [] }
- @the_h[x0][x1][x2][x3][x4][x5][:md] << y5
- end
- #puts spaces*5 + x5
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- #@the_h.each_pair { |x,y| p x; p y }
- @the_h
- end
- def traverse_base
- @the_h.each_pair do |x0,y0|
- puts spaces*0 + x0 if x0.is_a?(String)
- if y0.is_a?(Hash)
- y0.each_pair do |x1,y1|
- puts spaces*1 + x1 if x1.is_a?(String)
- if y1.is_a?(Hash)
- y1.each_pair do |x2,y2|
- puts spaces*2 + x2 if x2.is_a?(String)
- if y2.is_a?(Hash)
- y2.each_pair do |x3,y3|
- puts spaces*3 + x3 if x3.is_a?(String)
- if y3.is_a?(Hash)
- y3.each_pair do |x4,y4|
- puts spaces*4 + x4 if x4.is_a?(String)
- if y4.is_a?(Hash)
- y4.each_pair do |x5,y5|
- puts spaces*5 + x5 if x5.is_a?(String)
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- def traverse
- @the_h.each_pair do |x0,y0|
- puts spaces*0 + x0 if x0.is_a?(String)
- if y0.is_a?(Hash)
- if y0.has_key?(:md)
- y0[:md].each { |x| puts spaces*5 + x[:title] }
- end
- y0.each_pair do |x1,y1|
- puts spaces*1 + x1 if x1.is_a?(String)
- if y1.is_a?(Hash)
- if y1.has_key?(:md)
- y1[:md].each { |x| puts spaces*5 + x[:title] }
- end
- y1.each_pair do |x2,y2|
- puts spaces*2 + x2 if x2.is_a?(String)
- if y2.is_a?(Hash)
- if y2.has_key?(:md)
- y2[:md].each { |x| puts spaces*5 + x[:title] }
- end
- y2.each_pair do |x3,y3|
- puts spaces*3 + x3 if x3.is_a?(String)
- if y3.is_a?(Hash)
- if y3.has_key?(:md)
- y3[:md].each { |x| puts spaces*5 + x[:title] }
- end
- y3.each_pair do |x4,y4|
- puts spaces*4 + x4 if x4.is_a?(String)
- if y4.is_a?(Hash)
- if y4.has_key?(:md)
- y4[:md].each { |x| puts spaces*5 + x[:title] }
- end
- y4.each_pair do |x5,y5|
- puts spaces*5 + x4 if x4.is_a?(String)
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- class OutputIndex < Mix
- require_relative 'i18n' # i18n.rb
- def initialize(opt,the_idx)
- @opt,@the_idx=opt,the_idx
- @env=SiSU_Env::InfoEnv.new
- @rc=SiSU_Env::GetInit.new.sisu_yaml.rc
- @alphabet_list=%W[9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z]
- @alph=@alphabet_list.dup
- @letter=@alph.shift
- end
- def html_file_open
- @the_idx.keys.each do |lng|
- @output ||={}
- @output[lng] ||={}
- harvest_pth,file='',''
- if @env.output_dir_structure.by? == :language
- harvest_pth=@env.path.webserv + '/' \
- + @opt.base_stub + '/' \
- + lng + '/' \
- + 'manifest'
- file=harvest_pth + '/' + 'topics.html'
- elsif @env.output_dir_structure.by? == :filetype
- harvest_pth=@env.path.webserv + '/' \
- + @opt.base_stub + '/' \
- + 'manifest'
- file=harvest_pth + '/' + 'topics.' + lng + '.html'
- elsif @env.output_dir_structure.by? == :filename
- harvest_pth=@env.path.webserv + '/' \
- + @opt.base_stub
- file=harvest_pth + '/' + 'topics.' + lng + '.html'
- end
- FileUtils::mkdir_p(harvest_pth) \
- unless FileTest.directory?(harvest_pth)
- fileinfo=(@opt.act[:verbose][:set]==:on \
- || @opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:urls_selected][:set]==:on \
- || @opt.act[:maintenance][:set]==:on) \
- ? ("file://#{file}")
- : ''
- SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- "harvest topics(#{@opt.files.length} files)",
- fileinfo
- ).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on
- @output[lng][:html]=File.new(file,'w')
- if @opt.act[:maintenance][:set]==:on
- @output[lng][:html_mnt]=File.new("#{@env.path.pwd}/topics.html",'w')
- end
- end
- end
- def html_file_close
- @the_idx.keys.each do |lng|
- @output[lng][:html].close
- @output[lng][:html_mnt].close if @output[lng][:html_mnt].is_a?(File)
- end
- end
- def html_print
- def html_songsheet
- #traverse
- html_file_open
- html_head
- html_alph
- html_body_traverse
- html_tail
- html_file_close
- end
- def html_body_traverse
- @the_idx.each_pair do |x0,y0|
- lng=x0
- if x0.is_a?(String)
- #do_string_name(lng,'lev0',x0)
- #puts spaces*0 + x0
- end
- if y0.is_a?(Hash)
- if y0.has_key?(:md)
- y0[:md].each do |x|
- #do_hash(lng,attrib,x) #lv==0 ?
- #puts spaces*5 + x[:title]
- end
- end
- y0.each_pair do |x1,y1|
- if x1.is_a?(String)
- do_string_name(lng,'lev0',x1)
- #puts spaces*1 + x1
- end
- if y1.is_a?(Hash)
- if y1.has_key?(:md)
- y1[:md].each do |x|
- do_hash(lng,0,x)
- #puts spaces*5 + x[:title]
- end
- end
- y1.each_pair do |x2,y2|
- if x2.is_a?(String)
- do_string(lng,'lev1',x2)
- #puts spaces*2 + x2
- end
- if y2.is_a?(Hash)
- if y2.has_key?(:md)
- y2[:md].each do |x|
- do_hash(lng,1,x)
- #puts spaces*5 + x[:title]
- end
- end
- y2.each_pair do |x3,y3|
- if x3.is_a?(String)
- do_string(lng,'lev2',x3)
- #puts spaces*3 + x3
- end
- if y3.is_a?(Hash)
- if y3.has_key?(:md)
- y3[:md].each do |x|
- do_hash(lng,2,x)
- #puts spaces*5 + x[:title]
- end
- end
- y3.each_pair do |x4,y4|
- if x4.is_a?(String)
- do_string(lng,'lev3',x4)
- #puts spaces*4 + x4
- end
- if y4.is_a?(Hash)
- if y4.has_key?(:md)
- y4[:md].each do |x|
- do_hash(lng,3,x)
- #puts spaces*5 + x[:title]
- end
- end
- y4.each_pair do |x5,y5|
- if x5.is_a?(String)
- do_string(lng,'lev4',x5)
- #puts spaces*5 + x5
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- def html_head_adjust(lng,type='')
- css_path,authors='',''
- if @env.output_dir_structure.by? == :language
- css_path=(type !~/maintenance/) \
- ? '../../_sisu/css/harvest.css'
- : 'harvest.css'
- authors='authors.html'
- elsif @env.output_dir_structure.by? == :filetype
- css_path=(type !~/maintenance/) \
- ? '../_sisu/css/harvest.css'
- : 'harvest.css'
- authors="authors.#{lng}.html"
- elsif @env.output_dir_structure.by? == :filename
- css_path=(type !~/maintenance/) \
- ? './_sisu/css/harvest.css'
- : 'harvest.css'
- authors="authors.#{lng}.html"
- end
- ln=SiSU_i18n::Languages.new.language.list
- harvest_languages=''
- @the_idx.keys.each do |lg|
- if @env.output_dir_structure.by? == :language
- harvest_pth="../../#{lg}/manifest"
- file=harvest_pth + '/' + 'topics.html'
- elsif @env.output_dir_structure.by? == :filetype
- harvest_pth='.'
- file=harvest_pth + '/' + 'topics.' + lg + '.html'
- elsif @env.output_dir_structure.by? == :filename
- harvest_pth='.'
- file=harvest_pth + '/topics.' + lg + '.html'
- end
- l=ln[lg][:t]
- harvest_languages +=
- %{<a href="#{file}">#{l}</a>&nbsp;&nbsp;&nbsp;}
- end
- sv=SiSU_Env::InfoVersion.instance.get_version
- if @env.output_dir_structure.by? == :language
- home_pth='../..'
- output_structure_by='(output organised by language &amp; filetype)'
- elsif @env.output_dir_structure.by? == :filetype
- home_pth='..'
- output_structure_by='(output organised by filetype)'
- elsif @env.output_dir_structure.by? == :filename
- home_pth='.'
- output_structure_by='(output organised by filename)'
- else
- home_pth='.'
- output_structure_by='(output organised by ?)'
- end
- <<WOK
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="utf-8">
-<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 href="#{css_path}" rel="stylesheet">
-<link rel="shortcut icon" href="../_sisu/image/rb7.ico" />
-</head>
-<body 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 #{output_structure_by}</h1>
-<p>[<a href="#{home_pth}/index.html">&nbsp;HOME&nbsp;</a>] also see <a href="#{authors}">SiSU Metadata Harvest - Authors</a></p>
-<p>#{@env.widget_static.search_form}</p>
-<hr />
-<p class="tiny">#{harvest_languages}</p>
-<hr />
-WOK
- end
- def html_head
- @the_idx.keys.each do |lng|
- @output[lng][:html_mnt] \
- << html_head_adjust(lng,'maintenance') \
- if @opt.act[:maintenance][:set]==:on
- @output[lng][:html] << html_head_adjust(lng)
- end
- end
- def html_alph
- a=[]
- a << '<p>'
- @alph.each do |x|
- a << ((x =~/[0-9]/) \
- ? ''
- : %{<a href="##{x}">#{x}</a>,&nbsp;})
- end
- a=a.join
- @the_idx.keys.each do |lng|
- @output[lng][:html_mnt] << a \
- if @opt.act[:maintenance][:set]==:on
- @output[lng][:html] << a
- end
- end
- def html_tail
- 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>
-#{SiSU_Proj_HTML::Bits.new.credits_sisu}
-</body>
-</html>
-WOK
- @the_idx.keys.each do |lng|
- @output[lng][:html_mnt] << a \
- if @output[lng][:html_mnt].is_a?(File)
- @output[lng][:html] << a
- end
- end
- def do_html(lng,html)
- @output[lng][:html] << html
- end
- def do_html_maintenance(lng,html)
- @output[lng][:html_mnt] << html \
- if @output[lng][:html_mnt].is_a?(File)
- end
- def do_string(lng,attrib,string)
- html=%{<p class="#{attrib}">#{string}</p>}
- do_html(lng,html)
- do_html_maintenance(lng,html) \
- if @output[lng][:html_mnt].is_a?(File)
- end
- def do_string_default(lng,attrib,string)
- html=%{<p class="#{attrib}">#{string}</p>}
- do_html(lng,html)
- end
- def do_string_maintenance(lng,attrib,string)
- html=%{<p class="#{attrib}">#{string}</p>}
- do_html_maintenance(lng,html) \
- if @output[lng][:html_mnt].is_a?(File)
- end
- def do_string_name(lng,attrib,string)
- f=/^(\S)/.match(string)[1]
- if @lng != lng
- @alph=@alphabet_list.dup
- @letter=@alph.shift
- @lng = lng
- end
- if @letter < f
- while @letter < f
- if @alph.length > 0
- @letter=@alph.shift
- if @output[lng][:html_mnt].is_a?(File)
- @output[lng][: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[lng][: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(lng,html)
- do_html_maintenance(lng,html) \
- if @output[lng][:html_mnt].is_a?(File)
- end
- def do_array(lng,lv,array)
- lv+=1
- array.each do |b|
- do_case(lng,lv,b)
- end
- end
- def do_hash_md(lng,attrib,hash)
- lang_code_insert=SiSU_Env::FilenameLanguageCodeInsert.new(@opt,lng).language_code_insert
- manifest_at=if @env.output_dir_structure.by? == :language
- hash[:file] + Sfx[:html]
- elsif @env.output_dir_structure.by? == :filetype
- hash[:file] + lang_code_insert + Sfx[:html]
- elsif @env.output_dir_structure.by? == :filename
- "./#{hash[:file]}/#{hash[:page]}"
- else '' #error
- end
- html=%{<a href="#{manifest_at}">#{hash[:title]}</a> - #{hash[:author]}}
- do_string_default(lng,attrib,html)
- end
- def do_hash_md_maintenance(lng,attrib,hash)
- if @output[lng][:html_mnt].is_a?(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(lng,attrib,html)
- end
- end
- def do_hash(lng,lv,hash)
- lv+=1
- key=[]
- hash.each_key do |m|
- if m == :md
- do_case(lng,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(lng,'work',hash)
- do_hash_md_maintenance(lng,'work',hash)
- end
- end
- if key.length > 0
- key.sort.each do |m|
- attrib="lev#{lv}"
- lv==0 ? do_string_name(lng,attrib,m) : do_string(lng,attrib,m)
- do_case(lng,lv,hash[m])
- end
- end
- end
- def do_case(lng,lv,a)
- case a
- when String
- attrib="lev#{lv}"
- if a=~/S/
- lv==0 ? do_string_name(lng,attrib,a) : do_string(lng,attrib,a)
- end
- when Array
- do_array(lng,lv,a)
- when Hash
- do_hash(lng,lv,a)
- end
- end
- #def html_body
- # the_idx=@the_idx
- # the_idx.each_pair do |lng,lng_array|
- # lng_array.sort.each do |a|
- # do_case(lng,-1,a)
- # end
- # 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/current/html_manifest.rb b/lib/sisu/current/html_manifest.rb
deleted file mode 100644
index 7cffad7..0000000
--- a/lib/sisu/current/html_manifest.rb
+++ /dev/null
@@ -1,1032 +0,0 @@
-# encoding: utf-8
-=begin
-
-* Name: SiSU
-
-** Description: documents, structuring, processing, publishing, search
-*** summary of generated outputs and metadata
-
-** Author: Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
-** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
- All Rights Reserved.
-
-** License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
-** SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
-** Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
-** Git
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/html_manifest.rb;hb=HEAD>
-
-=end
-module SiSU_Manifest
- require_relative 'se' # se.rb
- include SiSU_Env
- require_relative 'prog_text_translation' # prog_text_translation.rb
- require_relative 'se_hub_particulars' # se_hub_particulars.rb
- include SiSU_Particulars
- require_relative 'html_parts' # html_parts.rb
- require_relative 'html_minitoc' # html_minitoc.rb
- require_relative 'html' # html.rb
- include SiSU_HTML_Format
- require_relative 'dp' # dp.rb
- include SiSU_Param
- require_relative 'i18n' # i18n.rb
- class Source
- def initialize(opt)
- @opt=opt
- @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)
- l=SiSU_Env::StandardiseLanguage.new(opt.lng).language
- @doc_language=l[:n]
- end
- def read
- begin
- @env=SiSU_Env::InfoEnv.new(@opt.fns)
- @md=SiSU_Param::Parameters.new(@opt).get
- xbrowser=@env.program.web_browser
- browser=@env.program.console_web_browser
-# webserv_url=@env.path.url.output_tell #fix in sysenv
- unless @opt.act[:quiet][:set]==:on
- url_html='file://' \
- + @md.file.output_path.manifest.dir + '/' \
- + @md.file.base_filename.manifest
- (@opt.act[:verbose][:set]==:on \
- || @opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on) \
- ? SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- 'Manifest',
- "#{xbrowser} #{url_html}"
- ).green_hi_blue
- : SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- 'Manifest',
- "[#{@opt.f_pth[:lng_is]}]",
- "#{url_html}"
- ).grey_title_grey_blue
- if (@md.opt.act[:verbose][:set]==:on \
- || @md.opt.act[:verbose_plus][:set]==:on)
- SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- "#{browser} #{url_html}"
- ).grey_tab
- end
- end
- data=SiSU_HTML::Source::HTML_Environment.new(@particulars).tuned_file_instructions
- SiSU_Manifest::Source::Output.new(@md).check_output(data)
- rescue
- SiSU_Errors::Rescued.new($!,$@,@opt.selections.str,@opt.fns).location do
- __LINE__.to_s + ':' + __FILE__
- end
- ensure
- SiSU_Env::CreateSite.new(@opt).cp_css
- Dir.chdir(@opt.f_pth[:pth])
- end
- end
- private
- class Output <Source
- include SiSU_Parts_HTML
- def initialize(md)
- @manifest={ txt: [], html: [] }
- @md,@fns=md,md.fns
- @env=SiSU_Env::InfoEnv.new(md.fns)
- @f=SiSU_Env::FileOp.new(md)
- @fnb=md.fnb
- @base_url="#{@env.url.root}/#{@fnb}"
- @o_str=SiSU_Env::FileOp.new(md).output_dir_structure
- @image_path=(@o_str.dump_or_redirect?) \
- ? './image'
- : %{#{@f.path_rel_links.html_scroll_2}_sisu/image_sys}
- @base_path=@f.output_path.manifest.dir
- @@dg ||=SiSU_Env::InfoEnv.new(md.fns,md).digest(md.opt).type
- @dg=@@dg
- l=SiSU_Env::StandardiseLanguage.new(md.opt.lng).language
- @language=l[:n]
- @translate=SiSU_Translate::Source.new(md,@language)
- @stylesheet=SiSU_Style::CSS_HeadInfo.new(md).stylesheet
- @fn_lng=(@f.output_dir_structure.by_language_code?) \
- ? ''
- : ('.' + md.opt.lng)
- end
- def output
- manifest=@f.write_file.manifest
- @manifest[:html].each do |x|
- x=x.gsub(Xx[:html_relative2],@f.path_rel_links.html_scroll_2).
- gsub(Xx[:html_relative1],@f.path_rel_links.html_scroll_1)
- manifest << x
- end
- end
- def url_make(url,file,src=nil)
- if @o_str.dump_or_redirect?
- ''
- elsif src==:src #check
- %{<br>#{the_url_decoration.xml_open}<a href="#{url}/#{file}">#{url}/#{file}</a>#{the_url_decoration.xml_close}}
- else
- %{<p class="tiny">#{the_url_decoration.xml_open}<a href="#{url}/#{file}">#{url}/#{file}</a>#{the_url_decoration.xml_close}</p>}
- end
- end
- def summarize(desc,id,file,pth='',rel='',url='',img='● ')
- size=(File.size("#{pth}/#{file}")/1024.00).to_s
- kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1]
- @manifest[:txt] << "#{file} #{desc} #{kb}\n"
- @manifest[:html] << %{<tr><th class="left"><p class="norm"><a href="#{rel}/#{file}">#{img}#{desc}</a></p></th><td><p class="small"><a href="#{rel}/#{file}">#{file}</a></p>#{url_make(url,file)}</td><td class="right"><p class="right">#{kb}</p></td></tr>\n}
- end
- def summarize_html_seg(desc,id,file,pth='',rel='',url='',img='● ')
- size=(File.size("#{pth}/#{file}")/1024.00).to_s
- kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1]
- @manifest[:txt] << "#{file} #{desc} #{kb}\n"
- @manifest[:html] << %{<tr><th class="left"><p class="norm"><a href="#{rel}/#{file}">#{img}#{desc}</a></p></th><td><p class="small"><a href="#{rel}/#{file}">#{file}</a></p>#{url_make(url,file)}</td><td class="right"><p class="right">#{kb}</p></td></tr>\n}
- end
- def summarize_sources(desc,id,file,pth,rel,url)
- sys=SiSU_Env::SystemCall.new
- dgst=case @dg
- when :sha512
- sys.sha512("#{pth}/#{file}")
- when :sha256
- sys.sha256("#{pth}/#{file}")
- when :md5
- sys.md5("#{pth}/#{file}")
- else
- end
- dgst=dgst ? dgst : [ '', 'n/a' ]
- if (@md.opt.act[:verbose][:set]==:on \
- || @md.opt.act[:verbose_plus][:set]==:on \
- || @md.opt.act[:maintenance][:set]==:on)
- SiSU_Screen::Ansi.new(
- @md.opt.act[:color_state][:set],
- "#{dgst[1]} #{file}"
- ).warn
- end
- size=(File.size("#{pth}/#{file}")/1024.00).to_s
- kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1]
- @manifest[:txt] << "#{file} #{desc} #{kb}\n"
- @manifest[:html] << %{<tr>} \
- + %{<th class="left"><p class="norm" id="#{id}"><a href="#{rel}/#{file}">#{desc}</a></p></th>} \
- + %{<td class="right"><p class="tiny"><a href="#{rel}/#{file}">#{file}</a> &nbsp;&nbsp;#{dgst[1]}#{url_make(url,file,:src)}</p></td>} \
- + %{<td class="right"><p class="right">#{kb}</p></td>} \
- + %{</tr>\n} \
- if kb and kb =~/\d+/
- end
- def published_manifests?
- @f=SiSU_Env::FileOp.new(@md) #.base_filename
- @m=[]
- url=@f.output_path.base.url
- manifests={}
- mp,mn,mt,mr=nil,nil,nil,nil
- ln=SiSU_i18n::Languages.new.language.list
- Px[:lng_lst].each do |lc|
- lngc=SiSU_Env::FilenameLanguageCodeInsert.new(@md.opt,lc).language_code_insert
- fnh={
- fn: @md.fnb,
- lng: lngc,
- }
- mn=@f.base_filename.manifest(fnh)
- if @o_str.dump_or_redirect? #does not work for --redirect or --dump
- mp="#{@f.output_path.base.dir}"
- mt="#{mp}/#{mn}"
- mr="../../#{lc}/manifest/#{mn}"
- mu="#{url}/#{mn}"
- elsif @f.output_dir_structure.by_language_code?
- mp="#{@f.output_path.base.dir}/#{lc}/manifest"
- mt="#{mp}/#{mn}"
- mr="../../#{lc}/manifest/#{mn}"
- mu="#{url}/#{lc}/manifest/#{mn}"
- elsif @f.output_dir_structure.by_filetype?
- mp="#{@f.output_path.base.dir}/manifest"
- mt="#{mp}/#{mn}"
- mr=mn
- mu="#{url}/manifest/#{mn}"
- else
- mp="#{@f.output_path.base.dir}/#{@md.fnb}"
- mt="#{mp}/#{mn}"
- mr=mn
- mu="#{url}/#{mn}"
- end
- if FileTest.directory?(mp) \
- && FileTest.file?(mt)
- lng=ln[lc][:t]
- manifests[lc]={ ln: lng, fn: mn, rel: mr }
- @m << { mu: mu, l: lng, rel: mr }
- end
- end
- @m=@m.uniq
- end
- def languages(desc,file)
- @manifest[:html] << %{<tr><th class="left"><div id="horizontal_links"><ul id="horizontal">\n}
- published_manifests?.each do |l|
- SiSU_Translate::Source.new(@md,@language,l[:n]).language_list
- @manifest[:txt] << "#{l[:mu]} #{l[:l]}\n"
- @manifest[:html] << %{<li class="norm"><a href="#{l[:rel]}">#{l[:l]}</a>&nbsp;&nbsp;&nbsp;</li>}
- end
- @manifest[:html] << %{</ul></div></th></tr>\n}
- end
- def published_languages(desc)
- published_manifests?.each do |l|
- @manifest[:txt] << "#{l[:mu]} #{l[:l]}\n"
- @manifest[:html] << %{<tr><th class="left"><p class="bold"><a href="#{l[:mu]}">#{l[:l]}</a></p></th><td><p class="norm">#{l[:l]}</p><p class="tiny">#{the_url_decoration.xml_open}<a href="#{l[:mu]}">#{l[:mu]}</a>#{the_url_decoration.xml_close}</p></td><td class="right"><p class="right">&nbsp;</p></td></tr>\n}
- end
- end
- def metadata(desc,id,info)
- info=info.to_s.gsub(/(?:#{Mx[:br_line]}|\\)+/,'<br>')
- @manifest[:html] << %{<tr><th class="left"><p class="bold_left" id="#{id}">#{desc}:</p></th><td><p class="left">#{info}</p></td></tr>\n}
- end
- def links(url,lnk,target)
- static=if url =~/^\.\// then url.gsub(/^\.(\.)?/,@base_url)
- elsif url =~/^\.\.\// then 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;#{the_url_decoration.xml_open}<a href="#{static}">#{static}</a>#{the_url_decoration.xml_close}</p></td></tr>\n}
- end
- def output_tests
- if FileTest.file?(@f.place_file.html_segtoc.dir)==true
- img=%{<img border="0" height="18" width="15" src="#{@image_path}/b_toc.png" alt="TOC linked" /> }
- pth=@f.output_path.html_seg.dir
- rel=@f.output_path.html_seg.rel_sm
- url=@f.output_path.html_seg.url
- desc,id,file='HTML, table of contents (for segmented text)','html',@f.base_filename.html_segtoc
- summarize_html_seg(desc,id,file,pth,rel,url,img)
- end
- if FileTest.file?(@f.place_file.html_scroll.dir)==true
- img=%{<img border="0" height="15" width="15" src="#{@image_path}/b_doc.png" alt="Full Text" /> }
- pth=@f.output_path.html_scroll.dir
- rel=@f.output_path.html_scroll.rel_sm
- url=@f.output_path.html_scroll.url
- desc,id,file='HTML, full length document','html_scroll',@f.base_filename.html_scroll
- summarize(desc,id,file,pth,rel,url,img)
- end
- if FileTest.file?(@f.place_file.html_book_index.dir)==true
- pth=@f.output_path.html_seg.dir
- rel=@f.output_path.html_seg.rel_sm
- url=@f.output_path.html_seg.url
- desc,id,file='HTML, (book type) index','html_book',@f.base_filename.html_book_index
- summarize(desc,id,file,pth,rel,url)
- end
- if FileTest.file?(@f.place_file.html_concordance.dir)==true
- pth=@f.output_path.html_seg.dir
- rel=@f.output_path.html_seg.rel_sm
- url=@f.output_path.html_seg.url
- desc,id,file='HTML, concordance file','concordance',@f.base_filename.html_concordance
- summarize(desc,id,file,pth,rel,url)
- end
- if FileTest.file?(@f.place_file.epub.dir)==true
- img=%{<img border="0" height="18" width="18" src="#{@image_path}/b_epub.png" alt="EPUB" /> }
- desc,id,file='EPUB (Electronic Publication, e-book standard)','epub',@f.base_filename.epub
- pth=@f.output_path.epub.dir
- rel=@f.output_path.epub.rel_sm
- url=@f.output_path.epub.url
- summarize(desc,id,file,pth,rel,url,img)
- end
- if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_letter}")==true
- img=%{<img border="0" height="18" width="15" src="#{@image_path}/b_pdf.png" alt="PDF portrait" /> }
- pth=@f.output_path.pdf.dir
- rel=@f.output_path.pdf.rel_sm
- url=@f.output_path.pdf.url
- desc,id,file="PDF, U.S. letter size, portrait/vertical document (recommended for printing)",'pdf_letter',"#{@f.base_filename.pdf_p_letter}"
- summarize(desc,id,file,pth,rel,url,img)
- end
- if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_letter}")==true
- img=%{<img border="0" height="15" width="18" src="#{@image_path}/b_pdf.png" alt="PDF landscape" /> }
- pth=@f.output_path.pdf.dir
- rel=@f.output_path.pdf.rel_sm
- url=@f.output_path.pdf.url
- desc,id,file="PDF, U.S. letter size, landscape/horizontal document (recommended for screen viewing)",'pdf_letter_landscape',"#{@f.base_filename.pdf_l_letter}"
- summarize(desc,id,file,pth,rel,url,img)
- end
- if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_a4}")==true
- img=%{<img border="0" height="18" width="15" src="#{@image_path}/b_pdf.png" alt="PDF portrait" /> }
- pth=@f.output_path.pdf.dir
- rel=@f.output_path.pdf.rel_sm
- url=@f.output_path.pdf.url
- desc,id,file="PDF, A4 size, portrait/vertical document (recommended for printing)",'pdf_a4',"#{@f.base_filename.pdf_p_a4}"
- summarize(desc,id,file,pth,rel,url,img)
- end
- if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_a4}")==true
- img=%{<img border="0" height="15" width="18" src="#{@image_path}/b_pdf.png" alt="PDF landscape" /> }
- pth=@f.output_path.pdf.dir
- rel=@f.output_path.pdf.rel_sm
- url=@f.output_path.pdf.url
- desc,id,file="PDF, A4 size, landscape/horizontal document (recommended for screen viewing)",'pdf_a4_landscape',"#{@f.base_filename.pdf_l_a4}"
- summarize(desc,id,file,pth,rel,url,img)
- end
- if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_a5}")==true
- img=%{<img border="0" height="18" width="15" src="#{@image_path}/b_pdf.png" alt="PDF portrait" /> }
- pth=@f.output_path.pdf.dir
- rel=@f.output_path.pdf.rel_sm
- url=@f.output_path.pdf.url
- desc,id,file="PDF, A5 (book) size, portrait/vertical document (recommended for printing)",'pdf_a5',"#{@f.base_filename.pdf_p_a5}"
- summarize(desc,id,file,pth,rel,url,img)
- end
- if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_a5}")==true
- img=%{<img border="0" height="15" width="18" src="#{@image_path}/b_pdf.png" alt="PDF landscape" /> }
- pth=@f.output_path.pdf.dir
- rel=@f.output_path.pdf.rel_sm
- url=@f.output_path.pdf.url
- desc,id,file="PDF, A5 (book) size, landscape/horizontal document (recommended for screen viewing)",'pdf_a5_landscape',"#{@f.base_filename.pdf_l_a5}"
- summarize(desc,id,file,pth,rel,url,img)
- end
- if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_b5}")==true
- img=%{<img border="0" height="18" width="15" src="#{@image_path}/b_pdf.png" alt="PDF portrait" /> }
- pth=@f.output_path.pdf.dir
- rel=@f.output_path.pdf.rel_sm
- url=@f.output_path.pdf.url
- desc,id,file="PDF, B5 (book) size, portrait/vertical document (recommended for printing)",'pdf_b5',"#{@f.base_filename.pdf_p_b5}"
- summarize(desc,id,file,pth,rel,url,img)
- end
- if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_b5}")==true
- img=%{<img border="0" height="15" width="18" src="#{@image_path}/b_pdf.png" alt="PDF landscape" /> }
- pth=@f.output_path.pdf.dir
- rel=@f.output_path.pdf.rel_sm
- url=@f.output_path.pdf.url
- desc,id,file="PDF, B5 (book) size, landscape/horizontal document (recommended for screen viewing)",'pdf_a5_landscape',"#{@f.base_filename.pdf_l_b5}"
- summarize(desc,id,file,pth,rel,url,img)
- end
- if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_legal}")==true
- img=%{<img border="0" height="18" width="15" src="#{@image_path}/b_pdf.png" alt="PDF portrait" /> }
- pth=@f.output_path.pdf.dir
- rel=@f.output_path.pdf.rel_sm
- url=@f.output_path.pdf.url
- desc,id,file="PDF, U.S. legal size, portrait/vertical document (recommended for printing)",'pdf_legal',"#{@f.base_filename.pdf_p_legal}"
- summarize(desc,id,file,pth,rel,url,img)
- end
- if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_legal}")==true
- img=%{<img border="0" height="15" width="18" src="#{@image_path}/b_pdf.png" alt="PDF landscape" /> }
- pth=@f.output_path.pdf.dir
- rel=@f.output_path.pdf.rel_sm
- url=@f.output_path.pdf.url
- desc,id,file="PDF, U.S. legal size, landscape/horizontal document (recommended for screen viewing)",'pdf_legal_landscape',"#{@f.base_filename.pdf_l_legal}"
- summarize(desc,id,file,pth,rel,url,img)
- end
- if FileTest.file?(@f.place_file.odt.dir)==true
- img=%{<img border="0" height="18" width="18" src="#{@image_path}/b_odf.png" alt="ODF/ODT" /> }
- pth=@f.output_path.odt.dir
- rel=@f.output_path.odt.rel_sm
- url=@f.output_path.odt.url
- desc,id,file='ODF:ODT (Open Document Format)','odt',@f.base_filename.odt
- summarize(desc,id,file,pth,rel,url,img)
- end
- if FileTest.file?(@f.place_file.xhtml.dir)==true
- pth=@f.output_path.xhtml.dir
- rel=@f.output_path.xhtml.rel_sm
- url=@f.output_path.xhtml.url
- desc,id,file='XHTML','xhtml',@f.base_filename.xhtml
- summarize(desc,id,file,pth,rel,url)
- end
- if FileTest.file?(@f.place_file.xml_sax.dir)==true
- pth=@f.output_path.xml_sax.dir
- rel=@f.output_path.xml_sax.rel_sm
- url=@f.output_path.xml_sax.url
- desc,id,file='XML SAX','xml_sax',@f.base_filename.xml_sax
- summarize(desc,id,file,pth,rel,url)
- end
- if FileTest.file?(@f.place_file.xml_dom.dir)==true
- pth=@f.output_path.xml_dom.dir
- rel=@f.output_path.xml_dom.rel_sm
- url=@f.output_path.xml_dom.url
- desc,id,file='XML DOM','xml_dom',@f.base_filename.xml_dom
- summarize(desc,id,file,pth,rel,url)
- end
- if FileTest.file?(@f.place_file.xml_docbook_article.dir)==true
- pth=@f.output_path.xml_docbook_article.dir
- rel=@f.output_path.xml_docbook_article.rel_sm
- url=@f.output_path.xml_docbook_article.url
- desc,id,file='XML Docbook Article','docbook_article',@f.base_filename.xml_docbook_article
- summarize(desc,id,file,pth,rel,url)
- end
- if FileTest.file?(@f.place_file.xml_docbook_book.dir)==true
- pth=@f.output_path.xml_docbook_book.dir
- rel=@f.output_path.xml_docbook_book.rel_sm
- url=@f.output_path.xml_docbook_book.url
- desc,id,file='XML Docbook Book','docbook',@f.base_filename.xml_docbook_book
- summarize(desc,id,file,pth,rel,url)
- end
- if FileTest.file?(@f.place_file.xml_fictionbook.dir)==true
- pth=@f.output_path.xml_fictionbook.dir
- rel=@f.output_path.xml_fictionbook.rel_sm
- url=@f.output_path.xml_fictionbook.url
- desc,id,file='XML Fictionbook','fictionbook',@f.base_filename.xml_fictionbook
- summarize(desc,id,file,pth,rel,url)
- end
- if FileTest.file?(@f.place_file.xml_scaffold_structure_sisu.dir)==true
- pth=@f.output_path.xml_scaffold_structure_sisu.dir
- rel=@f.output_path.xml_scaffold_structure_sisu.rel_sm
- url=@f.output_path.xml_scaffold_structure_sisu.url
- desc,id,file='XML Scaffold sisu structure','xml_scaffold',@f.base_filename.xml_scaffold_structure_sisu
- summarize(desc,id,file,pth,rel,url)
- end
- if FileTest.file?(@f.place_file.xml_scaffold_structure_collapse.dir)==true
- pth=@f.output_path.xml_scaffold_structure_collapse.dir
- rel=@f.output_path.xml_scaffold_structure_collapse.rel_sm
- url=@f.output_path.xml_scaffold_structure_collapse.url
- desc,id,file='XML Scaffold collapsed structure','xml_collapsed',@f.base_filename.xml_scaffold_structure_collapse
- summarize(desc,id,file,pth,rel,url)
- end
- if FileTest.file?(@f.place_file.info.dir)==true
- pth=@f.output_path.texinfo.dir
- rel=@f.output_path.texinfo.rel_sm
- url=@f.output_path.texinfo.url
- desc,id,file='Info file','info',@f.base_filename.info
- summarize(desc,id,file,pth,rel,url)
- end
- if FileTest.file?(@f.place_file.manpage.dir)==true
- pth=@f.output_path.manpage.dir
- rel=@f.output_path.manpage.rel_sm
- url=@f.output_path.manpage.url
- desc,id,file='Manpage','manpage',@f.base_filename.manpage
- summarize(desc,id,file,pth,rel,url)
- end
- if FileTest.file?(@f.place_file.sqlite_discrete.dir)==true
- desc,id,file='SQLite3 file','sqlite',@f.base_filename.sqlite_discrete
- pth=@f.output_path.sqlite_discrete.dir
- rel=@f.output_path.sqlite_discrete.rel_sm
- url=@f.output_path.sqlite_discrete.url
- summarize(desc,id,file,pth,rel,url)
- end
- if FileTest.file?(@f.place_file.txt.dir)==true
- desc,id='Plaintext (UTF-8)','text'
- pth=@f.output_path.txt.dir
- rel=@f.output_path.txt.rel_sm
- url=@f.output_path.txt.url
- file=@f.base_filename.txt
- summarize(desc,id,file,pth,rel,url)
- end
- if FileTest.file?(@f.place_file.textile.dir)==true
- desc,id='Textile text (UTF-8)','textile'
- pth=@f.output_path.textile.dir
- rel=@f.output_path.textile.rel_sm
- url=@f.output_path.textile.url
- file=@f.base_filename.textile
- summarize(desc,id,file,pth,rel,url)
- end
- if FileTest.file?(@f.place_file.asciidoc.dir)==true
- desc,id='AsciiDoc text (UTF-8)','asciidoc'
- pth=@f.output_path.asciidoc.dir
- rel=@f.output_path.asciidoc.rel_sm
- url=@f.output_path.asciidoc.url
- file=@f.base_filename.asciidoc
- summarize(desc,id,file,pth,rel,url)
- end
- if FileTest.file?(@f.place_file.markdown.dir)==true
- desc,id='Markdown text (UTF-8)','markdown'
- pth=@f.output_path.markdown.dir
- rel=@f.output_path.markdown.rel_sm
- url=@f.output_path.markdown.url
- file=@f.base_filename.markdown
- summarize(desc,id,file,pth,rel,url)
- end
- if FileTest.file?(@f.place_file.rst.dir)==true
- desc,id='rST text (UTF-8)','rst'
- pth=@f.output_path.rst.dir
- rel=@f.output_path.rst.rel_sm
- url=@f.output_path.rst.url
- file=@f.base_filename.rst
- summarize(desc,id,file,pth,rel,url)
- end
- if FileTest.file?(@f.place_file.orgmode.dir)==true
- desc,id='OrgMode structure text (UTF-8)','org'
- pth=@f.output_path.orgmode.dir
- rel=@f.output_path.orgmode.rel_sm
- url=@f.output_path.orgmode.url
- file=@f.base_filename.orgmode
- summarize(desc,id,file,pth,rel,url)
- end
- if FileTest.file?("#{@base_path}/#{@md.fns}.tex")==true
- desc,id,file='LaTeX (portrait)','latex',"#{@md.fns}.tex"
- pth,rel,url='','',''
- summarize(desc,id,file,pth,rel,url)
- end
- if FileTest.file?("#{@base_path}/#{@md.fns}.tex")==true
- desc,id,file='LaTeX (landscape)','latex_landscape',"#{@md.fns}.landscape.tex"
- pth,rel,url='','',''
- summarize(desc,id,file,pth,rel,url)
- end
- if FileTest.file?(@f.place_file.hash_digest.dir)==true
- pth=@f.output_path.hash_digest.dir
- rel=@f.output_path.hash_digest.rel_sm
- url=@f.output_path.hash_digest.url
- desc,id,file="Digest/DCC - Document Content Certificate (#{@dg})",'digests',@f.base_filename.hash_digest
- summarize(desc,id,file,pth,rel,url)
- end
- end
- def published_versions
- desc,file='Markup (SiSU source)','source',@md.fns
- languages(desc,file)
- end
- def language_versions
- if FileTest.file?(@f.place_file.manifest.dir)==true
- desc='Markup (SiSU source)'
- published_languages(desc)
- end
- end
- def qrc_image
- fn=(@f.output_dir_structure.by_filename?) \
- ? 'sisu_manifest'
- : @md.fnb
- pth=((@o_str.dump_or_redirect?) \
- || (@f.output_dir_structure.by_filename?)) \
- ? '.'
- : 'qrcode'
- img_md="#{pth}/#{fn}#{@fn_lng}.md.png"
- img_title="#{pth}/#{fn}#{@fn_lng}.title.png"
- if FileTest.file?(@f.place_file.qrcode_md.dir)==true
- @manifest[:html] <<<<WOK
-<tr><td class="left">
- <p class="tiny">QR code SiSU document metadata:</p>
- <p class="tiny">
- <img border="0" src="#{img_md}" alt="qrcode metadata" />
- </p>
-</td></tr>
-WOK
- end
- if FileTest.file?(@f.place_file.qrcode_title.dir)==true
- @manifest[:html] <<<<WOK
-<tr><td class="left">
- <p class="tiny">QR code document title info:</p>
- <p class="tiny">
- <img border="0" src="#{img_title}" alt="qrcode title" />
- </p>
-</td></tr>
-WOK
- end
- end
- def source_tests
- if @md.fno =~/\.ssm$/ #% decide whether to extract and include requested/required documents
- if FileTest.file?(@f.place_file.src.dir)==true
- pth=@f.output_path.src.dir
- rel=@f.output_path.src.rel_sm
- url=@f.output_path.src.url
- desc,id,file='Markup Composite File (SiSU source)','source',@f.base_filename.src
- summarize_sources(desc,id,file,pth,rel,url)
- end
- else
- if FileTest.file?(@f.place_file.src.dir)==true
- pth=@f.output_path.src.dir
- rel=@f.output_path.src.rel_sm
- url=@f.output_path.src.url
- desc,id,file='Markup (SiSU source)','composite',@f.base_filename.src
- summarize_sources(desc,id,file,pth,rel,url)
- end
- end
- if FileTest.file?(@f.place_file.sisupod.dir)==true
- pth=@f.output_path.sisupod.dir
- rel=@f.output_path.sisupod.rel_sm
- url=@f.output_path.sisupod.url
- desc,id,file='SiSUdoc pod (tar.xz)','sisupod',@f.base_filename.sisupod
- summarize_sources(desc,id,file,pth,rel,url)
- end
- if FileTest.file?(@f.place_file.pot.dir)==true
- pth=@f.output_path.pot.dir
- rel=@f.output_path.pot.rel_sm
- url=@f.output_path.pot.url
- desc,id,file='SiSU pot','pot',@f.base_filename.pot
- summarize_sources(desc,id,file,pth,rel,url)
- end
- end
- def metadata_tests
- if defined? @md.title #%
- if defined? @md.title.full \
- and @md.title.full=~/\S+/
- desc,id,info=@translate.full_title,'title',@md.title.full
- metadata(desc,id,info)
- end
- end
- if defined? @md.creator #%
- if defined? @md.creator.author \
- and @md.creator.author=~/\S+/
- desc,id,info=@translate.author,'author',@md.creator.author
- metadata(desc,id,info)
- end
- if defined? @md.creator.editor \
- and @md.creator.editor=~/\S+/
- desc,id,info=@translate.editor,'editor',@md.creator.editor
- metadata(desc,id,info)
- end
- if defined? @md.creator.contributor \
- and @md.creator.contributor=~/\S+/
- desc,id,info=@translate.contributor,'contributor',@md.creator.contributor
- metadata(desc,id,info)
- end
- if defined? @md.creator.translator \
- and @md.creator.translator=~/\S+/
- desc,id,info=@translate.translator,'creator',@md.creator.translator
- metadata(desc,id,info)
- end
- if defined? @md.creator.illustrator \
- and @md.creator.illustrator=~/\S+/
- desc,id,info=@translate.illustrator,'illustrator',@md.creator.illustrator
- metadata(desc,id,info)
- end
- if defined? @md.creator.prepared_by \
- and @md.creator.prepared_by=~/\S+/
- desc,id,info=@translate.prepared_by,'prepared_by',@md.creator.prepared_by
- metadata(desc,id,info)
- end
- if defined? @md.creator.digitized_by \
- and @md.creator.digitized_by=~/\S+/
- desc,id,info=@translate.digitized_by,'designed_by',@md.creator.digitized_by
- metadata(desc,id,info)
- end
- end
- if defined? @md.rights
- if defined? @md.rights.all \
- and @md.rights.all=~/\S+/ #dc
- desc,id,info=@translate.rights,'rights',@md.rights.all
- metadata(desc,id,info)
- end
- end
- if defined? @md.date #%
- if defined? @md.date.published \
- and @md.date.published=~/\S+/ #dc
- desc,id,info=@translate.date,'date',@md.date.published
- metadata(desc,id,info)
- end
- if defined? @md.date.created \
- and @md.date.created=~/\S+/ #dc
- desc,id,info=@translate.date_created,'date_created',@md.date.created
- metadata(desc,id,info)
- end
- if defined? @md.date.issued \
- and @md.date.issued=~/\S+/ #dc
- desc,id,info=@translate.date_issued,'date_issued',@md.date.issued
- metadata(desc,id,info)
- end
- if defined? @md.date.available \
- and @md.date.available=~/\S+/ #dc
- desc,id,info=@translate.date_available,'date_available',@md.date.available
- metadata(desc,id,info)
- end
- if defined? @md.date.modified \
- and @md.date.modified=~/\S+/ #dc
- desc,id,info=@translate.date_modified,'date_modified',@md.date.modified
- metadata(desc,id,info)
- end
- if defined? @md.date.valid \
- and @md.date.valid=~/\S+/ #dc
- desc,id,info=@translate.date_valid,'date_valid',@md.date.valid
- metadata(desc,id,info)
- end
- end
- if defined? @md.publisher \
- and @md.publisher=~/\S+/ #dc
- desc,id,info=@translate.publisher,'publisher',@md.publisher
- metadata(desc,id,info)
- end
- if defined? @md.notes #%
- if defined? @md.notes.description \
- and @md.notes.description=~/\S+/
- desc,id,info=@translate.description,'description',@md.notes.description
- metadata(desc,id,info)
- end
- if defined? @md.notes.abstract \
- and @md.notes.abstract=~/\S+/
- desc,id,info=@translate.abstract,'abstract',@md.notes.abstract
- metadata(desc,id,info)
- end
- if defined? @md.notes.comment \
- and @md.notes.comment=~/\S+/
- desc,id,info=@translate.comments,'comment',@md.notes.comment
- metadata(desc,id,info)
- end
- if defined? @md.notes.prefix_a \
- and @md.notes.prefix_a=~/\S+/
- desc,id,info=@translate.prefix_a,'prefix',@md.notes.prefix_a
- metadata(desc,id,info)
- end
- if defined? @md.notes.prefix_b \
- and @md.notes.prefix_b=~/\S+/
- desc,id,info=@translate.prefix_b,'prefix_b',@md.notes.prefix_b
- metadata(desc,id,info)
- end
- end
- if defined? @md.title #%
- if defined? @md.title.language \
- and @md.title.language=~/\S+/
- desc,id,info=@translate.language,'language',@md.title.language
- metadata(desc,id,info)
- end
- if defined? @md.original.language \
- and @md.original.language=~/\S+/
- desc,id,info=@translate.language_original,'language_original',@md.original.language
- metadata(desc,id,info)
- end
- end
- if defined? @md.classify #%
- if defined? @md.topic_register_array \
- and @md.topic_register_array.length > 0
- @manifest[:html] << %{<tr><th class="left"><p class="bold_left" id="topics">#{@translate.topic_register}:</p></th><td>\n}
- @md.topic_register_array.each do |t|
- t.each_with_index do |st,i|
- if st.is_a?(Array)
- st.each do |v|
- if v.is_a?(Array)
- v.each do |w|
- @manifest[:html] << %{<p class="it#{i}">#{w}</p>\n}
- end
- else
- @manifest[:html] << %{<p class="it#{i}">#{v}</p>\n}
- end
- end
- else @manifest[:html] << %{<p class="it#{i}">#{st}</p>\n}
- end
- end
- end
- @manifest[:html] << %{</td></tr>\n}
- end
- if defined? @md.classify.subject \
- and @md.classify.subject=~/\S+/
- desc,id,info=@translate.subject,'subject',@md.classify.subject
- metadata(desc,id,info)
- end
- if defined? @md.classify.keywords \
- and @md.classify.keywords=~/\S+/
- desc,id,info=@translate.keywords,'keywords',@md.classify.keywords
- metadata(desc,id,info)
- end
- if defined? @md.classify.loc \
- and @md.classify.loc=~/\S+/
- desc,id,info=@translate.cls_loc,'loc',@md.classify.loc
- metadata(desc,id,info)
- end
- if defined? @md.classify.dewey \
- and @md.classify.dewey=~/\S+/
- desc,id,info=@translate.cls_dewey,'dewey',@md.classify.dewey
- metadata(desc,id,info)
- end
- if defined? @md.notes.coverage \
- and @md.notes.coverage=~/\S+/
- desc,id,info=@translate.coverage,'coverage',@md.notes.coverage
- metadata(desc,id,info)
- end
- if defined? @md.notes.relation \
- and @md.notes.relation=~/\S+/
- desc,id,info=@translate.relation,'relation',@md.notes.relation
- metadata(desc,id,info)
- end
- if defined? @md.notes.type \
- and @md.notes.type=~/\S+/ #dc
- desc,id,info=@translate.type,'type',@md.notes.type
- metadata(desc,id,info)
- end
- if defined? @md.notes.format \
- and @md.notes.format=~/\S+/
- desc,id,info=@transate.format,'format',@md.notes.format
- metadata(desc,id,info)
- end
- end
- if defined? @md.identifier #%
- if defined? @md.identifier.oclc \
- and @md.identifier.oclc=~/\S+/
- desc,id,info=@translate.cls_oclc,'',@md.identifier.oclc
- @manifest[:html] << %{<tr><th class="left"><p class="bold_left">#{desc}:</p></th><td>\n}
- @manifest[:html] << %{<p class="left"><a href="http://worldcat.org/oclc/#{info}">#{info}</a></p>\n}
- @manifest[:html] << %{</td></tr>\n}
- end
- if defined? @md.identifier.pg \
- and @md.identifier.pg=~/\S+/
- desc,id,info=@translate.cls_gutenberg,'ocalc',@md.identifier.pg
- metadata(desc,id,info)
- end
- if defined? @md.identifier.isbn \
- and @md.identifier.isbn=~/\S+/
- desc,id,info=@translate.cls_isbn,'isbn',@md.identifier.isbn
- metadata(desc,id,info)
- end
- end
- if defined? @md.original.source \
- and @md.original.source=~/\S+/
- desc,id,info=@translate.source,'source_original',@md.original.source
- metadata(desc,id,info)
- end
- if @md.fns
- desc,id,info=@translate.sourcefile,'source_filename',@md.fns
- metadata(desc,id,info)
- end
- if @md.en[:mismatch] > 0
- desc,id,info='WARNING document error in endnote markup, number mismatch','',"endnotes: #{@md.en[:note]} != endnote reference marks: #{@md.en[:mark]} (difference = #{@md.en[:mismatch]})"
- metadata(desc,id,info)
- end
- if @md.wc_words
- desc,id,info=@translate.word_count,'wordcount',@md.wc_words
- metadata(desc,id,info)
- end
- if @md.dgst
- desc,id,info="#{@translate.sourcefile_digest} (#{@dg})",'digests',@md.dgst[1]
- metadata(desc,id,info)
- end
- if @md.sc_number
- desc,id,info=@translate.sc_number,'sc_number',@md.sc_number
- metadata(desc,id,info)
- end
- if @md.sc_date
- desc,id,info=@translate.sc_date,'sc_date',"#{@md.sc_date} at #{@md.sc_time}"
- metadata(desc,id,info)
- end
- if @md.generated
- desc,id,info=@translate.last_generated,'generated',@md.generated
- metadata(desc,id,info)
- end
- if @md.project_details
- desc,id,info=@translate.sisu_version,'project',"#{@md.project_details.project} #{@md.project_details.version} #{@md.project_details.date_stamp} (#{@md.project_details.date})#{@md.project_details.install_method}"
- metadata(desc,id,info)
- end
- if @md.ruby_version
- desc,id,info=@translate.ruby_version,'ruby',@md.ruby_version
- metadata(desc,id,info)
- end
- end
- def links_tests
- if defined? @md.lnk \
- and @md.lnk
- @md.lnk.each do |l|
- if defined? l[:say]
- target=(l[:url] !~/^\.(\.)?\//) \
- ? 'external'
- : '_top'
- 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
- make=SiSU_Env::ProcessingSettings.new(@md)
- minitoc=SiSU_HTML_MiniToc::TocMini.new(@md,data).songsheet.join("\n")
- format_head_toc=SiSU_HTML_Format::HeadToc.new(@md)
- @manifest[:html] <<<<WOK
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="utf-8">
-<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="#{@f.path_rel_links.html_scroll_css}_sisu/image_sys/rb7.ico" />
-#{@stylesheet.css_head}
-</head>
-<body lang="#{@md.opt.lng}">
-#{format_head_toc.seg_head_navigation_band(:manifest)}
-WOK
- if make.build.manifest_minitoc?
- if @o_str.dump_or_redirect?
- elsif @f.output_dir_structure.by_language_code? \
- or @f.output_dir_structure.by_filetype?
- minitoc=minitoc.gsub(/<a href="(\S+?)"/m,%{<a href="../html/#{@md.fnb}/\\1"}).
- gsub(/<a href="\.\.\/html\/#{@md.fnb}\/(?:sisu_manifest\.html|#{@f.base_filename.manifest})"/m,
- %{<a href="#{@f.base_filename.manifest}"})
- end
- @manifest[:html] <<<<WOK
-<div class="toc">
-#{minitoc.to_s}
-</div>
-<div class="content">
-WOK
- else
- @manifest[:html] <<<<WOK
-<div>
-WOK
- end
- if @o_str.dump_or_redirect?
- elsif @f.output_dir_structure.by_language_code? \
- or @f.output_dir_structure.by_filetype?
- pth_local=@f.output_path.manifest.dir
- pth_rel='.'
- else
- pth_local=@f.output_path.base.dir
- pth_rel='..'
- end
- pth_rel_home=if @env.output_dir_structure.by? == :language
- '../..'
- elsif @env.output_dir_structure.by? == :filetype
- '..'
- elsif @env.output_dir_structure.by? == :filename
- '..'
- else '..'
- end
- output_organised_by="(output organised by #{@env.output_dir_structure.by?})"
- harvest=(FileTest.file?("#{pth_local}/authors#{@fn_lng}.html") \
- && FileTest.file?("#{pth_local}/topics#{@fn_lng}.html")) \
- ? %{<p class="small"><a href="#{pth_rel_home}/index.html">.:</a> other document manifests: [<a href="#{pth_rel}/authors#{@fn_lng}.html">authors</a>] [<a href="#{pth_rel}/topics#{@fn_lng}.html">topics</a>] #{output_organised_by}</p>}
- : %{<p class="small"><a href="#{pth_rel_home}">#{output_organised_by}</a></p>}
- manifest_title=%{<p class="bold">#{@translate.manifest_description}</p>#{harvest}}
- @manifest[:html] <<<<WOK
-<div id="horizontal_links">
-#{manifest_title}
-</div>
-<h1 class="small">#{@md.title.full}</h1>
-<p class="bold">#{@md.author}</p>
-<div id="horizontal_links"><p class="bold">
-<p class="small">
-&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>
-</div>
-<table summary="normal text css" width="100%" border="0" 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" 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" 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" cellpadding="2" align="center">
-<tr> <th class="left"><p class="bold" id="metadata">#{@translate.metadata}</p></th><th class="left"><p class="bold">#{@translate.description}</p></th></tr>
-WOK
- metadata_tests
- @manifest[:html] <<<<WOK
-</table>
-WOK
- @manifest[:html] <<<<WOK
-<p class="bold"><a name="links">#{@translate.suggested_links}:</a></p>
-<table summary="suggested links" width="100%" border="0" 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" 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
- qrc_image
- @manifest[:html] <<<<WOK
-</table>
-</div>
-<div>
-<br>
-#{SiSU_Proj_HTML::Bits.new.credits_sisu_manifest}
-</div>
-</body>
-</html>
-WOK
- output
- rescue
- SiSU_Errors::Rescued.new($!,$@,@md.opt.selections.str,@md.fns).location do
- __LINE__.to_s + ':' + __FILE__
- end
- ensure
- end
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/current/html_persist.rb b/lib/sisu/current/html_persist.rb
deleted file mode 100644
index ff151ef..0000000
--- a/lib/sisu/current/html_persist.rb
+++ /dev/null
@@ -1,237 +0,0 @@
-# encoding: utf-8
-=begin
-
-* Name: SiSU
-
-** Description: documents, structuring, processing, publishing, search
-*** html segment generation, processing
-
-** Author: Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
-** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
- All Rights Reserved.
-
-** License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
-** SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
-** Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
-** Git
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/html_persist.rb;hb=HEAD>
-
-=end
-module SiSU_HTML_Persist
- class Persist
- @@persist=nil
- attr_accessor :is0,:is1,:is2,:is3,:is4,:heading0,:heading1,:heading2,:heading3,:heading4, :title, :dot_nav, :tocband_banner, :tocband_bannerless, :headings, :heading_endnotes, :main, :endnote_all, :tail, :credits, :heading_idx, :idx, :seg_endnotes, :seg_endnotes_array, :segtocband, :get_hash_fn, :get_hash_to, :seg_subtoc, :seg_subtoc_array, :fn, :seg_name ,:seg_name_x,:seg_name_x_tracker
- def initialize(args=nil)
- @@persist=args=(args ? args : (@@persist || persist_init_hash_values))
- @is0=args[:is0]
- @is1=args[:is1]
- @is2=args[:is2]
- @is3=args[:is3]
- @is4=args[:is4]
- @heading0=args[:heading0]
- @heading1=args[:heading1]
- @heading2=args[:heading2]
- @heading3=args[:heading3]
- @heading4=args[:heading4]
- @title=args[:title]
- @dot_nav=args[:dot_nav]
- @tocband_banner=args[:tocband_banner]
- @tocband_bannerless=args[:tocband_bannerless]
- @headings=args[:headings]
- @heading_endnotes=args[:heading_endnotes]
- @main=args[:main]
- @endnote_all=args[:endnote_all]
- @tail=args[:tail]
- @credits=args[:credits]
- @heading_idx=args[:heading_idx]
- @idx=args[:idx]
- @seg_endnotes=args[:seg_endnotes]
- @seg_endnotes_array=args[:seg_endnotes_array]
- @get_hash_to=args[:get_hash_to]
- @get_hash_fn=args[:get_hash_fn]
- @seg_subtoc=args[:seg_subtoc]
- @seg_subtoc_array=args[:seg_subtoc_array]
- @segtocband=args[:fn]
- @fn=args[:fn]
- @seg_name=args[:seg_name]
- @seg_name_x=args[:seg_name_x]
- @seg_name_x_tracker=args[:seg_name_x_tracker]
- end
- def is0
- @is0
- end
- def is1
- @is1
- end
- def is2
- @is2
- end
- def is3
- @is3
- end
- def is4
- @is4
- end
- def heading0
- @heading0
- end
- def heading1
- @heading1
- end
- def heading2
- @heading2
- end
- def heading3
- @heading3
- end
- def heading4
- @heading4
- end
- def title
- @title
- end
- def dot_nav
- @dot_nav
- end
- def tocband_banner
- @tocband_banner
- end
- def tocband_bannerless
- @tocband_bannerless
- end
- def headings
- @headings
- end
- def heading_endnotes
- @heading_endnotes
- end
- def main
- @main
- end
- def endnote_all
- @endnote_all
- end
- def tail
- @tail
- end
- def credits
- @credits
- end
- def heading_idx
- @heading_idx
- end
- def idx
- @idx
- end
- def seg_endnotes
- @seg_endnotes
- end
- def seg_endnotes_array
- @seg_endnotes_array
- end
- def get_hash_to
- @get_hash_to
- end
- def get_hash_fn
- @get_hash_fn
- end
- def seg_subtoc
- @seg_subtoc
- end
- def seg_subtoc_array
- @seg_subtoc_array
- end
- def segtocband
- @segtocband
- end
- def fn
- @fn
- end
- def seg_name
- @seg_name
- end
- def seg_name_x
- @seg_name_x
- end
- def seg_name_x_tracker
- @seg_name_x_tracker
- end
- def persist_init_hash_values
- {
- is0: 0,
- is1: 0,
- is2: 0,
- is3: 0,
- is4: 0,
- heading0: '',
- heading1: '',
- heading2: '',
- heading3: '',
- heading4: '',
- tocband_banner: [],
- tocband_bannerless: [],
- title: [],
- headings: [],
- main: [],
- idx: [],
- tail: [],
- credits: [],
- endnote_all: [],
- heading_endnotes: '',
- seg_endnotes: {},
- seg_endnotes_array: [],
- get_hash_fn: '',
- get_hash_to: '',
- seg_subtoc: {},
- seg_subtoc_array: [],
- segtocband: '',
- fn: '',
- seg_name: [],
- seg_name_x: [],
- seg_name_x_tracker: 0,
- }
- end
- def persist_init
- @@persist=nil
- Persist.new(persist_init_hash_values)
- end
- end
-end
-__END__
diff --git a/lib/sisu/current/html_promo.rb b/lib/sisu/current/html_promo.rb
deleted file mode 100644
index 28b4e35..0000000
--- a/lib/sisu/current/html_promo.rb
+++ /dev/null
@@ -1,440 +0,0 @@
-# encoding: utf-8
-=begin
-
-* Name: SiSU
-
-** Description: documents, structuring, processing, publishing, search
-*** html advertising component, build here, mockup
-
-** Author: Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
-** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
- All Rights Reserved.
-
-** License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
-** SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
-** Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
-** Git
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/html_promo.rb;hb=HEAD>
-
-=end
-module SiSU_HTML_Promo
- require_relative 'se' # se.rb
- include SiSU_Env
- class Ad
- def initialize(md)
- @md=md
- @env=SiSU_Env::InfoEnv.new(@md.fns,@md)
- @rc=SiSU_Env::GetInit.new.sisu_yaml.rc
- @ad=SiSU_Env::GetInit.new.ads
- @flag=@env.widget.promo?
- @make=SiSU_Env::ProcessingSettings.new(@md)
- end
- def div
- def major
- (@make.build.html_right_pane? \
- && @flag[:ad]) \
- ? '<div id="pane_major">'
- : ''
- end
- def minor
- (@make.build.html_right_pane? \
- && @flag[:ad]) \
- ? '<div id="pane_minor">'
- : ''
- end
- def close
- (@make.build.html_right_pane? \
- && @flag[:ad]) \
- ? '</div>'
- : ''
- end
- self
- end
- def display
- ads_array,promo_array=[],[]
- if @make.build.html_right_pane? \
- && @flag[:ad]
- ads=if @md.promo && @md.promo.length > 0 #promo set in document
- promo_array=@md.promo
- elsif @flag[:rc] #promo set in rc file
- promo_array=if @rc['html']['promo'].is_a?(String)
- @rc['html']['promo'].split(/[,;]\s*/)
- else @rc['html']['promo']
- end
- else advert_extract_all
- end
- ads=if promo_array.length > 0
- promo_array.each do |x|
- ads_array << advert_extract_subject(x)
- end
- ads_array
- end
- adverts(ads.join)
- end
- end
- def cell(prod,id)
- @prod,@id=prod,id
- def title
- @prod['title'] ? %{<b>#{@prod['title']}</b>} : ''
- end
- def subtitle
- @prod['subtitle'] ? %{ - #{@prod['subtitle']}} : ''
- end
- def author
- @prod['author'] ? %{<p class="pane">#{@prod['author']}</p>} : ''
- end
- def editor
- @prod['editor'] ? %{<p class="pane">#{@prod['editor']}</p>} : ''
- end
- def year
- @prod['year'] ? %{<p class="pane">#{@prod['year']}</p>} : ''
- end
- def date
- @prod['date'] ? %{<p class="pane">On: #{@prod['date']}</p>} : ''
- end
- def location
- @prod['at'] ? %{<p class="pane">At: #{@prod['at']}</p>} : ''
- end
- def pages
- @prod['pages'] ? %{<p class="pane">Pages: #{@prod['pages']} pages</p>} : ''
- end
- def form
- @prod['form'] ? %{<p class="pane">#{@prod['form']}</p>} : ''
- end
- def nick
- @prod['nick'] ? %{(#{@prod['nick']})<br>} : ''
- end
- def update
- @prod['update'] ? %{<p class="pane">Updated: #{@prod['update']}</p>} : ''
- end
- def issn
- @prod['issn'] ? %{<p class="pane">issn: #{@prod['issn']}</p>} : ''
- end
- def blurb
- @prod['blurb'] ? %{<p class="pane_blurb">#{@prod['blurb']}</p>} : ''
- end
- def search_form_sisu(table=true)
- db=if @prod['db']=~/\S+/
- (@prod['db']=~/^#{Db[:name_prefix]}\S+/) ? @prod['db'] : "#{Db[:name_prefix]}#{@prod['db']}"
- elsif defined? @rc['search']['sisu']['db'] \
- and @rc['search']['sisu']['db'] =~/\S+/
- (@rc['search']['sisu']['db']=~/^#{Db[:name_prefix]}\S+/) \
- ? @prod['search']['sisu']['db']
- : "#{Db[:name_prefix]}#{@prod['db']}"
- else nil
- end
- action=if @prod['action']=~/^https?:\/\//
- @prod['action']
- elsif defined? @rc['search']['sisu']['action'] \
- and @rc['search']['sisu']['action'] =~/^https?:\/\//
- @rc['search']['sisu']['action']
- else nil
- end
- if action \
- and db
- @env.widget.search_form('sisusearch',action,db,table)
- else ''
- end
- end
- def search_form_hyperestraier(table=true)
- action=if defined? @rc['search']['hyperestraier']['action'] \
- and @rc['search']['hyperestraier']['action'] =~/^https?:\/\//
- @rc['search']['hyperestraier']['action']
- else nil
- end
- form=if action
- '<br>' + @env.widget.search_form('hyperestraier',action,'',table)
- else ''
- end
- form
- end
- def links
- if @prod['links'] #and @prod['links']==Array
- links_a=[]
- @prod['links'].each do |x|
- if x \
- and x['url'] \
- and x['title']
- subtitle=x['subtitle'] ? %{ - #{x['subtitle']}} : ''
- url_=(x['url'] =~/https?:/) ? x['url'] : "../#{x['url']}"
- links_a << %{<p class="pane_link"><a href="#{url_}">#{x['title']}#{subtitle}</a></p>\n}
- end
- end
- links_a.join
- else ''
- end
- end
- def image
- @prod['image'] ? %{<img border="0" src="../_sisu/image/#{@prod['image']}" /><br>} : ''
- end
- def url_link
- @url_=if @prod['url'] =~/https?:/
- "#{@prod['url']}"
- else "../#{@prod['url']}" # "#{@env.url.root}/#{@prod['url']}"
- end
- def show
- @prod['url'] ? %{<p class="pane_link"><a href="#{@url_}">#{@url_}</a></p>} : ''
- end
- def url
- @prod['url'] ? %{<a href="#{@url_}">} : ''
- end
- def url_relative
- @prod['url'] ? %{<a href="../#{@prod['url']}/toc.html">} : ''
- end
- self
- end
- def flyer
- if @prod['flyer']
- %{<p class="pane"><a href="../man/pdf/#{@id}.pdf"><img border="0" height="18" width="15" src="../_sisu/image/b_pdf.png">&nbsp;PDF&nbsp;flyer</a></p>}
- else ''
- end
- end
- def price
- def gbp
- if defined? @prod['price']['gbp'] \
- and @prod['price']['gbp']
- " &nbsp;&pound;&nbsp;#{@prod['price']['gbp']}&nbsp;(GBP)&nbsp;"
- else ''
- end
- end
- def euro
- if defined? @prod['price']['euro'] \
- and @prod['price']['euro']
- " &nbsp;&euro;&nbsp;#{@prod['price']['euro']}&nbsp;(Euro)&nbsp;"
- else ''
- end
- end
- def usd
- if defined? @prod['price']['usd'] \
- and @prod['price']['usd']
- " &nbsp;$&nbsp;#{@prod['price']['usd']}&nbsp;(USD)&nbsp;"
- else ''
- end
- end
- %{<p class="pane">Price:#{gbp}#{euro}#{usd}</p>}
- end
- def adsense #draw content from a configuration file
- def column_right
- if defined? @ad[:promo]['ad']['adsense']['column_right']
- @ad[:promo]['ad']['adsense']['column_right'].join("\n")
- else ''
- end
- end
- def line_single
- if defined? @ad[:promo]['ad']['adsense']['line_single']
- @ad[:promo]['ad']['adsense']['line_single'].join("\n")
- else ''
- end
- end
- self
- end
- def site_link #Work area
- if url_link.url
- <<-WOK
-<p class="pane">
-#{url_link.url}
-#{image}
-#{title}
-#{subtitle}
-</a>#{nick}</p>
- WOK
- else
- <<-WOK
-<p class="pane">
-#{image}
-#{title}
-#{subtitle}
-</p>
- WOK
- end
- end
- self
- end
- def output_form_sponsor(type,id)
- cell=cell(@ad[:promo][type][id],prod_id)
- <<-WOK
-<br>
-#{cell.site_link}
-#{cell.blurb}
-#{cell.links}
- WOK
- end
- def output_form_link(type,id)
- prod_id=id.gsub(/id_/,'')
- cell=cell(@ad[:promo][type][id],prod_id)
- <<WOK
-<br>
-#{cell.site_link}
-#{cell.author}
-#{cell.year}
-#{cell.blurb}
-#{cell.links}
-WOK
- end
- def output_form_search_sisu(type,id)
- prod_id=id.gsub(/id_/,'')
- cell=cell(@ad[:promo][type][id],prod_id)
- cell.search_form_sisu(false)
- end
- def output_form_search_hyperestraier(type,id)
- prod_id=id.gsub(/id_/,'')
- cell=cell(@ad[:promo][type][id],prod_id)
- cell.search_form_hyperestraier(false)
- end
- def output_form_book(type,id)
- prod_id=id.gsub(/id_/,'')
- cell=cell(@ad[:promo][type][id],prod_id)
- prod_type=((id=~/id_(?:[0-9x]){10,13}/i) ? 'isbn' : 'id')
- id_detail=%{<p class="pane">#{prod_type}: #{prod_id}</p>}
- <<WOK
-<br>
-#{cell.site_link}
-#{cell.author}
-#{cell.year}
-#{id_detail}
-#{cell.pages}#{cell.form}
-#{cell.price}
-#{cell.flyer}
-#{cell.blurb}
-#{cell.links}
-WOK
- end
- def output_form_journal(type,id)
- prod_id=id.gsub(/id_/,'')
- cell=cell(@ad[:promo][type][id],prod_id)
- <<WOK
-<br>
-#{cell.site_link}
-#{cell.editor}
-#{cell.issn}
-#{cell.update}
-#{cell.form}
-#{cell.price.gsub(/Price:/,'Subscription:')}
-#{cell.flyer}
-#{cell.blurb}
-#{cell.links}
-WOK
- end
- def output_form_conference(type,id)
- prod_id=id.gsub(/id_/,'')
- cell=cell(@ad[:promo][type][id],prod_id)
-#translate date (dd month yyyy) from 2007-03-04 and ruby conversion
- <<WOK
-<br>
-#{cell.site_link}
-#{cell.date}
-#{cell.location}
-#{cell.price}
-#{cell.flyer}
-#{cell.blurb}
-#{cell.links}
-WOK
- end
- def output_form_select(type,id)
- case type
- when /site/
- output_form_link(type,id)
- when /sponsor/
- output_form_sponsor(type,id)
- when /search/
- if id=~/hyperestraier/
- output_form_search_hyperestraier(type,id)
- else output_form_search_sisu(type,id)
- end
- when /book/
- output_form_book(type,id)
- when /journal/
- output_form_journal(type,id)
- when /conference/
- output_form_conference(type,id)
- end
- end
- def advert_extract_subject(category) #extracts products from category/subject list
- adverts=[]
- if defined? @ad[:promo_list][category] \
- and @ad[:promo_list][category]
- @ad[:promo_list][category].keys.each do |type|
- @ad[:promo_list][category][type].each do |i|
- if i
- id=((i.inspect =~/^\d/) ? "id_#{i.to_s.strip}" : i.to_s.strip) #watch remove .to_s ?
- if defined? @ad[:promo][type][id] \
- and not @ad[:promo][type][id].nil?
- adverts << output_form_select(type,id)
- else
- if defined? @ad[:promo][category][type][id] \
- and @ad[:promo][category][type][id].is_a?(Array) \
- and @ad[:promo][category][type][id].length > 0
- adverts << @ad[:promo][category][type][id].join("\n")
- end
- end
- end
- end
- end
- else
- SiSU_Screen::Ansi.new(
- @md.opt.act[:color_state][:set],
- "*WARN* category not found: #{category}"
- ).warn unless @md.opt.act[:quiet][:set]==:on
- end
- adverts.join
- end
- def advert_extract_all #extracts all products from list (which is broken down into categories)
- adverts=[]
- @ad[:promo_list].keys.each do |category|
- adverts << advert_extract_subject(category)
- end
- adverts.flatten
- end
- def adverts(ads)
- <<WOK
-#{div.minor}
-#{ads}
-#{div.close}
-WOK
- end
- def no_adverts
- <<WOK
-#{div.minor}
-#{div.close}
-WOK
- end
- end
-end
-__END__
diff --git a/lib/sisu/current/html_scroll.rb b/lib/sisu/current/html_scroll.rb
deleted file mode 100644
index 4751a01..0000000
--- a/lib/sisu/current/html_scroll.rb
+++ /dev/null
@@ -1,235 +0,0 @@
-# encoding: utf-8
-=begin
-
-* Name: SiSU
-
-** Description: documents, structuring, processing, publishing, search
-*** html scroll generation, processing
-
-** Author: Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
-** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
- All Rights Reserved.
-
-** License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
-** SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
-** Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
-** Git
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/html_scroll.rb;hb=HEAD>
-
-=end
-module SiSU_HTML_Scroll
- require_relative 'html_shared' # html_shared.rb
- require_relative 'html' # html.rb
- require_relative 'shared_metadata' # shared_metadata.rb
- require_relative 'html_promo' # html_promo.rb
- class Scroll
- def initialize(md='',data='',endnotes='')
- @md,@data,@endnotes=md,data,endnotes
- end
- def songsheet
- begin
- scr=SiSU_HTML_Scroll::Scroll.new(@md,@data,@endnotes).markup
- scr[:tails]=SiSU_HTML_Scroll::Scroll.new(@md).tails
- scr
- rescue
- SiSU_Errors::Rescued.new($!,$@,@md.opt.selections.str,@md.fns).location do
- __LINE__.to_s + ':' + __FILE__
- end
- ensure
- end
- end
- protected
- def markup
- data=@data
- @rcdc=false
- @scr={ body: [], metadata: [], owner_details: [] }
- data.each do |dob|
- dob.obj=dob.obj.gsub(/#{@md.file.output_path.html_seg.rel_image}/m,
- @md.file.output_path.html_scroll.rel_image)
- if defined? dob.name and dob.name =~/^meta/ \
- and dob.obj =~/Document Information/
- dob.obj=dob.obj.
- gsub(/(Document Information(?: \(metadata\))?)/,
- '\1<a name="docinfo"></a>')
- end
- if dob.obj =~/^Metadata$/ \
- and dob.lv =='B'
- dob.obj=dob.obj.gsub(/Metadata/,'') #dob.obj=''
- end
- if defined? dob.name \
- and dob.name =~/^metadata/ \
- and dob.lv =='1' \
- and dob.obj =~/SiSU Metadata, document information/
- @rcdc=true
- end
- dob.obj=dob.obj.gsub(/href="[a-z0-9._-]+(#\S+?")/m,'href="\1'). # internal document links
- gsub(/href="#{Xx[:segment]}/m,'href="')
- if dob.obj !~/(^#{Rx[:meta]}|#{Mx[:br_eof]})/
- unless dob.is ==:code
- dob.obj=dob.obj.
- gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ')
- end
- if defined? dob.ocn
- @p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,dob.ocn)
- end
- sto=SiSU_HTML_Format::FormatTextObject.new(@md,dob)
- para_html=if dob.is==:heading
- x=if dob.ln==0
- sto.heading_body0
- elsif dob.ln==1
- sto.heading_body1
- elsif dob.ln==2
- sto.heading_body2
- elsif dob.ln==3
- sto.heading_body3
- elsif dob.ln==4
- sto.heading_body4
- elsif dob.ln==5
- sto.heading_body5
- elsif dob.ln==6
- sto.heading_body6
- elsif dob.ln==7
- sto.heading_body7
- end
- elsif dob.is==:break \
- and dob.from==:markup
- '<br><hr width=90% /><br>'
- elsif dob.is==:heading_insert
- x=if dob.ln==0
- unless dob.obj.empty?
- sto.heading_body0
- end
- elsif dob.ln==1
- unless dob.obj.empty?
- sto.heading_body1
- end
- elsif dob.ln==2
- unless dob.obj.empty?
- sto.heading_body2
- end
- elsif dob.ln==3
- unless dob.obj.empty?
- sto.heading_body3
- end
- elsif dob.ln==4 \
- and dob.obj !~/^(?:Endnotes|Index|Metadata|Manifest)$/
- unless dob.obj.empty?
- sto.heading_body4
- end
- elsif dob.ln==4 \
- and dob.obj=='Endnotes'
- sto.heading_body4
- @endnotes.join("\n")
- elsif dob.ln==4 \
- and dob.obj=='Index'
- sto.heading_body4
- book_idx=SiSU_Particulars::CombinedSingleton.
- instance.get_idx_html(@md.opt).html_idx
- book_idx.each do |y| #takes book index prepared for segments & strips segment identifying info
- y.gsub!(/<a href="\S+?\.html#(\d+)">(\1(?:-\d+)?)<\/a>/,
- '<a href="#\1">\2</a>')
- end
- book_idx.join("\n")
- elsif dob.ln==5
- unless dob.obj.empty?
- sto.heading_body5
- end
- elsif dob.ln==6
- unless dob.obj.empty?
- sto.heading_body6
- end
- elsif dob.ln==7
- unless dob.obj.empty?
- sto.heading_body7
- end
- end
- elsif dob.is==:para
- if dob.indent \
- and dob.hang \
- and dob.indent =~/[0-9]/ \
- and dob.hang =~/[0-9]/
- if dob.bullet_
- (dob.indent =~/[1-9]/) \
- ? sto.format('li',"i#{dob.indent}")
- : sto.format('li','bullet')
- elsif dob.indent == dob.hang
- sto.format('p',"i#{dob.indent}")
- elsif dob.indent != dob.hang
- sto.format('p',"h#{dob.hang}i#{dob.indent}")
- else sto.para
- end
- else sto.para
- end
- elsif dob.is==:block
- sto.block
- elsif dob.is==:group
- sto.group
- elsif dob.is==:alt
- sto.alt
- elsif dob.is==:verse
- sto.verse
- elsif dob.is==:code
- sto.code
- elsif dob.is==:table
- sto.table
- elsif dob.is==:break
- end
- if dob =~/<a name="n\d+">/ \
- and dob =~/^(?:\^~\d+\s|<!e[:_]\d+!>)/ # hmmm re-adjusted 200507, for alt endnote which should again be matched ^~ ... not in response to problem though
- dob=''
- end
- unless @rcdc
- @scr[:body] << para_html unless para_html =~/\A\s*\Z/
- end
- end
- end
- @scr
- end
- def tails
- scr_tail=[]
- format_head_scroll=SiSU_HTML_Format::HeadToc.new(@md)
- scr_tail \
- << format_head_scroll.scroll_tail \
- << format_head_scroll.html_close
- scr_tail
- end
- end
-end
-__END__
diff --git a/lib/sisu/current/html_segments.rb b/lib/sisu/current/html_segments.rb
deleted file mode 100644
index 4b413b0..0000000
--- a/lib/sisu/current/html_segments.rb
+++ /dev/null
@@ -1,716 +0,0 @@
-# encoding: utf-8
-=begin
-
-* Name: SiSU
-
-** Description: documents, structuring, processing, publishing, search
-*** html segment generation, processing
-
-** Author: Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
-** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
- All Rights Reserved.
-
-** License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
-** SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
-** Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
-** Git
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/html_segments.rb;hb=HEAD>
-
-=end
-module SiSU_HTML_Seg
- require_relative 'html_shared' # html_shared.rb
- require_relative 'html' # html.rb
- require_relative 'html_persist' # html_persist.rb
- require_relative 'html_promo' # html_promo.rb
- require_relative 'shared_metadata' # shared_metadata.rb
- class Output
- def initialize(md,outputfile,per,minitoc,type='')
- @md, @output_seg_file,@per,@minitoc,@type=
- md,outputfile, per,minitoc, type
- @title_banner_=SiSU_Env::CreateSite.new(@md.opt).html_seg_title_banner?
- @file=SiSU_Env::FileOp.new(@md)
- @make=SiSU_Env::ProcessingSettings.new(@md)
- @cl=(@make.build.html_minitoc?) \
- ? 'content'
- : 'content0'
- end
- def output
- if @per.title =~/\S/
- filename_seg=[]
- if @make.build.html_top_band?
- filename_seg \
- << @per.title \
- << @per.tocband_banner
- else
- filename_seg \
- << @per.title
- end
- if @type=='endnotes'
- @per.headings=[]
- format_head_seg=SiSU_HTML_Format::HeadSeg.new(@md)
- if @title_banner_
- @per.headings \
- << format_head_seg.
- title_banner(@md.title.main,@md.title.sub,@author)
- end
- txt_obj={ txt: 'Endnotes', ocn_display: '' }
- format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj)
- @per.headings \
- << format_seg.title_heading1
- filename_seg \
- << @per.heading_endnotes \
- << @minitoc << @per.headings \
- << %{\n<div class="#{@cl}">\n} \
- << @per.endnote_all \
- << '</div>' # << '</div>'
- elsif @type=='idx'
- @per.headings=[]
- format_head_seg=SiSU_HTML_Format::HeadSeg.new(@md)
- if @title_banner_
- @per.headings \
- << format_head_seg.
- title_banner(@md.title.main,@md.title.sub,@author)
- end
- txt_obj={ txt: 'Index', ocn_display: '' }
- format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj)
- @per.headings << format_seg.title_heading1
- filename_seg \
- << @per.heading_idx \
- << @minitoc << @per.headings \
- << %{\n<div class="#{@cl}">\n} \
- << @per.idx \
- << '</div>' # << '</div>'
- elsif @type=='metadata'
- metadata=SiSU_Metadata::Summary.new(@md).html_display.metadata
- @per.headings=[]
- format_head_seg=SiSU_HTML_Format::HeadSeg.new(@md)
- if @title_banner_
- @per.headings \
- << format_head_seg.
- title_banner(@md.title.main,@md.title.sub,@author)
- end
- txt_obj={ txt: 'Metadata', ocn_display: '' }
- format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj)
- @per.headings \
- << format_seg.title_heading1
- filename_seg \
- << @per.heading_idx \
- << @minitoc \
- << @per.headings \
- << %{\n<div class="#{@cl}">\n} \
- << metadata \
- << '</div>' # << '</div>'
- else
- if @make.build.html_top_band?
- filename_seg \
- << @minitoc \
- << @per.headings \
- << @per.main \
- << "\n</div>\n"
- else
- filename_seg \
- << @minitoc \
- << @per.main \
- << "\n</div>\n"
- end
- end
- filename_seg <<=if @make.build.html_top_band?
- @per.tail \
- << @per.tocband_bannerless \
- << @per.credits
- else
- @per.tail \
- << @per.credits
- end
- filename_seg=filename_seg.flatten.compact #watch
- filename_seg.each do |str|
- unless str =~/\A\s*\Z/
- str=str.strip.
- gsub(Xx[:html_relative2],
- @file.path_rel_links.html_seg_2).
- gsub(Xx[:html_relative1],
- @file.path_rel_links.html_seg_1)
- @output_seg_file << str
- end
- end
- @output_seg_file.close
- end
- end
- end
- class Seg
- @@seg_url=''
- @@tracker=0
- @@seg_name=[]
- attr_reader :seg_name_x,:seg_name_x_tracker
- def initialize(md=nil,data='')
- @md,@data=md,data
- @per=SiSU_HTML_Persist::Persist.new
- @seg_name_x=@per.seg_name_x=(@@seg_name || [])
- @seg_name_x_tracker=@per.seg_name_x_tracker=(@@tracker || 0)
- @env=SiSU_Env::InfoEnv.new(@md.fns) if @md
- if @md
- @make=SiSU_Env::ProcessingSettings.new(@md)
- @cl=(@make.build.html_minitoc?) \
- ? 'content'
- : 'content0'
- else @cl='content'
- end
- if @md
- @title_banner_=SiSU_Env::CreateSite.new(@md.opt).html_seg_title_banner?
- end
- end
- def songsheet
- begin
- @minitoc=SiSU_HTML::Source::Toc.new(@md,@data).minitoc
- @per=SiSU_HTML_Persist::Persist.new
- data=get_subtoc_endnotes(@data,@per)
- data=articles(data,@per)
- cleanup(@md,@per) # (((( added ))))
- #### (((( END )))) ####
- rescue
- SiSU_Errors::Rescued.new($!,$@,@md.opt.selections.str,@md.fns).location do
- __LINE__.to_s + ':' + __FILE__
- end
- ensure
- SiSU_HTML_Persist::Persist.new.persist_init
- @@seg_name=@per.seg_name=[]
- end
- end
- protected
- def articles(data,per)
- @per=per
- tracking,newfile=0,0
- printed_endnote_seg='n'
- idx_html=nil
- if @md.book_idx
- #my_make_source_file=SiSU_Env::CreateFile.new(@md.fns)
- idx_html=SiSU_Particulars::CombinedSingleton.
- instance.get_idx_html(@md.opt).html_idx
- idx_html.each do |x|
- @per.idx << x
- end
- @per.heading_idx=''
- end
- data.each do |dob|
- if (dob.is == :heading \
- || dob.is == :heading_insert) \
- && dob.ln == 4
- @@seg_name << dob.name
- @per.seg_name = @@seg_name
- dob.name
- end
- end
- @per.seg_name_x=@per.seg_name
- @per.seg_name.length
- testforartnum=@per.seg_name_x
- if (@md.opt.act[:verbose][:set]==:on \
- || @md.opt.act[:verbose_plus][:set]==:on \
- || @md.opt.act[:maintenance][:set]==:on)
- SiSU_Screen::Ansi.new(
- @md.opt.act[:color_state][:set],
- @per.seg_name.length
- ).segmented
- end
- map_nametags=SiSU_Particulars::CombinedSingleton.
- instance.get_map_nametags(@md).nametags_map #p map_nametags
- data.each do |dob|
- if defined? dob.obj \
- and dob.obj =~/href="#{Xx[:segment]}#+\S+?"/
- while dob.obj =~/href="#{Xx[:segment]}#+(\S+?)"/
- m=$1
- if map_nametags[m] \
- and map_nametags[m][:segname]
- inf=SiSU_Env::FileOp.new(@md) if @md
- lng=(inf.output_dir_structure.by_language_code?) \
- ? ''
- : '.' + @md.opt.lng
- dob.obj.sub!(/href="#{Xx[:segment]}#+(\S+?)"/,
- %{href="#{map_nametags[m][:segname]}#{lng}#{Sfx[:html]}#\\1"})
- else
- p "NOT FOUND name_tags: #{m}"
- dob.obj.sub!(/href="#{Xx[:segment]}#+(\S+?)"/,
- %{href="#\\1"}) # not satisfactory
- end
- end
- end
- if (dob.is==:heading \
- || dob.is==:heading_insert) \
- && dob.ln==4
- @per.heading4=dob.obj
- @per.is4=newfile=1
- end
- if (dob.is==:heading \
- || dob.is==:heading_insert) \
- && dob.ln==3
- @per.heading3=dob.obj
- @per.is4,@per.is3=0,1
- end
- if (dob.is==:heading \
- || dob.is==:heading_insert) \
- && dob.ln==2
- @per.heading2=dob.obj
- @per.is4,@per.is3,@per.is2=0,0,1
- end
- if (dob.is==:heading \
- || dob.is==:heading_insert) \
- && dob.ln==1
- @per.heading1=dob.obj
- @per.is4,@per.is3,@per.is2,@per.is1=0,0,0,1
- end
- if (dob.is==:heading \
- || dob.is==:heading_insert) \
- && dob.ln==0
- @per.heading0=dob.obj
- @per.is4,@per.is3,@per.is2,@per.is1,@per.is0=0,0,0,0,1
- end
- if (@per.is1 && !@per.is2 && !@per.is3 && !@per.is4)
- if not (dob.is==:heading \
- || dob.is==:heading_insert) \
- && dob.ln==0
- $_ #; check
- end
- end
- if @per.is4==1
- if newfile==1 \
- or dob.obj =~/^#{Mx[:br_endnotes]}|^#{Mx[:br_eof]}/
- newfile=0
- if (dob.is==:heading \
- || dob.is==:heading_insert) \
- && dob.ln==4
- if tracking != 0
- @file=SiSU_Env::FileOp.new(@md)
- unless FileTest.directory?(@file.output_path.html_seg.dir)
- FileUtils::mkdir_p(@file.output_path.html_seg.dir) \
- if File.writable?("#{@file.output_path.base.dir}/.")
- end
- tail(@md,@per)
- #SiSU_HTML_Seg::Seg.new(@md,@per).tail
- fnh={
- fn: @per.seg_name_x[tracking-1],
- }
- fn=@md.file.base_filename.html_seg(fnh)
- segfilename="#{@file.output_path.html_seg.dir}/#{fn}"
- output_seg_file=File.new(segfilename,'w') if @per.seg_name_x[tracking-1]
- minitoc=(@make.build.html_minitoc?) ? @minitoc : ''
- if dob.is==:heading \
- || (@per.seg_name_x[tracking-1] !~/endnotes|book_index|metadata/)
- SiSU_HTML_Seg::Output.new(@md,output_seg_file,@per,minitoc).output
- elsif dob.is==:heading_insert
- if @per.seg_name_x[tracking-1]=='endnotes'
- SiSU_HTML_Seg::Output.new(@md,output_seg_file,@per,minitoc,'endnotes').output
- elsif @per.seg_name_x[tracking-1]=='book_index'
- SiSU_HTML_Seg::Output.new(@md,output_seg_file,@per,minitoc,'idx').output
- @per.idx=[]
- elsif @per.seg_name_x[tracking-1]=='metadata'
- SiSU_HTML_Seg::Output.new(@md,output_seg_file,@per,minitoc,'metadata').output
- else puts "#{__FILE__}::#{__LINE__}"
- end
- else puts "#{__FILE__}::#{__LINE__}"
- end
- SiSU_HTML_Seg::Seg.new.reinitialise(per)
- #per=persist_init
- heading_art(dob)
- head(dob)
- #keep use for last segment, eg if metadata is last segment
- if @per.seg_name_x[tracking] =='metadata' # this is for metadata
- fnh={
- fn: @per.seg_name_x[tracking],
- }
- fn=@md.file.base_filename.html_seg(fnh)
- segfilename="#{@file.output_path.html_seg.dir}/#{fn}"
- output_seg_file=File.new(segfilename,'w')
- SiSU_HTML_Seg::Output.new(@md,output_seg_file,@per,minitoc,'metadata').output
- #per=persist_init
- Seg.new.reinitialise(per)
- end
- end
- if tracking==0
- heading_art(dob)
- head(dob)
- end
- end
- tracking=tracking+1
- end
- if (dob.is==:heading \
- || dob.is==:heading_insert) \
- && dob.ln==4 \
- && dob.name
- @per.get_hash_to=dob.name
- @per.get_hash_fn=dob.name
- end
- if dob.obj.is_a?(String)
- markup(dob)
- elsif dob.obj.is_a?(Array)
- dob.obj.each do |pg|
- markup(pg)
- end
- end
- if testforartnum[tracking-1] =~/endnote/
- if printed_endnote_seg=='n'
- printed_endnote_seg='y'
- end
- end
- end
- end
- data
- end
- def heading_art(dob)
- format_head_seg=SiSU_HTML_Format::HeadSeg.new(@md)
- @per.dot_nav=if (@make.build.html_navigation?) \
- && (@make.build.html_navigation_bar?)
- x=if (dob.is==:heading \
- || dob.is==:heading_insert) \
- && (dob.ln.to_s =~/^[0-7]/)
- x=if @@tracker < @per.seg_name.length-1
- format_head_seg.dot_control_pre_next
- else
- format_head_seg.dot_control_pre
- end
- else @per.dot_nav
- end
- else @per.dot_nav=''
- end
- ads=SiSU_HTML_Promo::Ad.new(@md)
- @per.title=format_head_seg.head_seg << ads.div.major
- end
- def head(dob)
- clean=/<!.*?!>|<:.*?>/
- format_head_seg=SiSU_HTML_Format::HeadSeg.new(@md)
- if @make.build.html_navigation?
- if @@tracker < @per.seg_name.length-1
- @per.segtocband=if @@tracker==0
- format_head_seg.toc_next2
- else
- format_head_seg.toc_pre_next2
- end
- else @per.segtocband=format_head_seg.toc_pre2
- end
- else @per.segtocband=''
- end
- @p_num ||= ''
- if @per.is0==1
- @author=%{<b>#{@md.author}</b>\n} if @md.author.to_s =~/\S/
- @per.tocband_banner \
- << format_head_seg.navigation_band(@per.segtocband,@per.dot_nav)
- @per.tocband_bannerless \
- << '<br>' \
- << format_head_seg.navigation_band_bottom(@per.segtocband,@per.dot_nav)
- if @title_banner_
- @per.headings \
- << format_head_seg.title_banner(@md.title.main,@md.title.sub,@author).gsub(clean,'')
- end
- ocn=(@per.heading0[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \
- ? $1
- : ''
- @p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn)
- txt_obj={ txt: @per.heading0, ocn_display: @p_num.ocn_display }
- format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj)
- @per.headings \
- << format_seg.title_heading0.gsub(clean,'')
- @per.heading0=@per.heading0.
- gsub(/&nbsp;<a name="-[\d*+]+" href="#_[\d*+]+">&nbsp;<sup>[\d*+]+<\/sup>&nbsp;<\/a>/,'')
- end
- if @per.is1==1
- heading1=@per.heading1
- ocn=(heading1[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \
- ? $1
- : ''
- @p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn)
- txt_obj={ txt: heading1, ocn_display: @p_num.ocn_display }
- format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj)
- @per.headings \
- << format_seg.title_heading1.gsub(clean,'')
- @per.heading1=@per.heading1.
- gsub(/&nbsp;<a name="-[\d*+]+" href="#_[\d*+]+">&nbsp;<sup>[\d*+]+<\/sup>&nbsp;<\/a>/,'')
- end
- if @per.is2==1
- heading2=@per.heading2
- ocn=(heading2[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \
- ? $1
- : ''
- @p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn)
- txt_obj={ txt: heading2, ocn_display: @p_num.ocn_display }
- format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj)
- @per.headings \
- << format_seg.title_heading2.gsub(clean,'')
- @per.heading2=@per.heading2.
- gsub(/&nbsp;<a name="-[\d*+]+" href="#_[\d*+]+">&nbsp;<sup>[\d*+]+<\/sup>&nbsp;<\/a>/,'')
- end
- if @per.is3==1
- heading3=@per.heading3
- ocn=(heading3[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \
- ? $1
- : ''
- @p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn)
- txt_obj={ txt: heading3, ocn_display: @p_num.ocn_display }
- format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj)
- @per.headings \
- << format_seg.title_heading3.gsub(clean,'')
- @per.heading3=@per.heading3.
- gsub(/&nbsp;<a name="-[\d*+]+" href="#_[\d*+]+">&nbsp;<sup>[\d*+]+<\/sup>&nbsp;<\/a>/,'')
- end
- if @per.is4==1
- heading4=@per.heading4
- ocn=(heading4[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \
- ? $1
- : ''
- @p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn)
- txt_obj={ txt: heading4, ocn_display: @p_num.ocn_display }
- format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj)
- @per.headings \
- << format_seg.title_heading4.gsub(clean,'')
- end
- @@tracker=@@tracker+1
- end
- def markup(dob)
- @debug=[]
- SiSU_HTML_Format::HeadSeg.new(@md)
- if dob.is !=:meta
- if dob.is==:heading \
- || dob.is==:heading_insert \
- || dob.is == :para
- @p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,dob.ocn)
- end
- sto=SiSU_HTML_Format::FormatTextObject.new(@md,dob)
- dob_html=if dob.is == :heading \
- || dob.is==:heading_insert \
- || dob.is==:para
- dob_html=if dob.is==:heading \
- || dob.is==:heading_insert
- if dob.ln==4
- sto.seg_heading4
- elsif dob.ln==5
- sto.seg_heading5
- elsif dob.ln==6
- sto.seg_heading6
- elsif dob.ln==7
- sto.seg_heading6
- end
- elsif dob.is==:para
- if dob.indent \
- and dob.hang \
- and dob.indent =~/[0-9]/ \
- and dob.hang =~/[0-9]/
- if dob.bullet_
- if dob.indent =~/[1-9]/
- sto.format('li',"i#{dob.indent}")
- else
- sto.format('li','bullet')
- end
- elsif dob.indent == dob.hang
- sto.format('p',"i#{dob.indent}")
- elsif dob.indent != dob.hang
- sto.format('p',"h#{dob.hang}i#{dob.indent}")
- else sto.para
- end
- else sto.para
- end
- end
- elsif dob.is==:block
- sto.block
- elsif dob.is==:group
- sto.group
- elsif dob.is==:alt
- sto.alt
- elsif dob.is==:verse
- sto.verse
- elsif dob.is==:code
- sto.code
- elsif dob.is==:table
- sto.table
- elsif dob.is==:break \
- and dob.from==:markup
- '<br><hr width=90% /><br>'
- end
- if @md.flag_separate_endnotes
- dob.obj=dob.obj.gsub(/"\s+href="#(#{Mx[:note]}\d+)">/,%{" href=\"endnotes#{Sfx[:html]}#\\1">}) #endnote- twice #removed file type
- end
- if (dob.is==:heading \
- || dob.is==:heading_insert \
- || dob.is==:para) \
- && (not dob.ocn \
- || (dob.ocn.to_s.empty?))
- format_seg=SiSU_HTML_Format::FormatSeg.new(@md,dob)
- end
- dob.obj=dob.obj.gsub(/\s*(-\{{2}~\d+|<:e[:_]\d+>).*/,'') #potentially dagerous - removes all paragraphs with <!e_!> #?? workpoint
- if dob.obj =~/<a name="_\d+" href="#-\d+">&nbsp;<sup>/ #endnote- note-
- format_seg=SiSU_HTML_Format::FormatSeg.new(@md,dob)
- dob=format_seg.no_paranum
- end
- if (dob.is==:heading \
- || dob.is==:heading_insert) \
- && dob.ln==4
- @per.main << %{\n<div class="#{@cl}">\n}
- @per.main << dob_html
- if @make.build.segsubtoc?
- @per.main << @per.seg_subtoc[@per.get_hash_fn] #% insertion of sub-toc
- end
- else
- @per.main << dob_html #unless @@flag_alt==true
- end
- end
- end
- def tail(md,per)
- @md,@per=md,per
- format_head_seg=SiSU_HTML_Format::HeadSeg.new(@md)
- if @md.flag_auto_endnotes \
- and @per.seg_endnotes[@per.get_hash_fn]
- @per.tail << %{\n<div class="#{@cl}">\n<div class="endnote">\n}
- if @per.seg_endnotes[@per.get_hash_fn].flatten.length > 0
- @per.tail << format_head_seg.endnote_mark
- @per.tail << @per.seg_endnotes[@per.get_hash_fn].flatten #endnotes deposited at end of individual segments ||@|EXTRACTION OF ENDNOTES|
- end
- @per.tail << '</div>'
- @per.tail << '</div>' #this div closes div class content
- end
- ads=SiSU_HTML_Promo::Ad.new(@md)
- @per.credits \
- << format_head_seg.credit \
- << ads.div.close \
- << ads.display \
- << format_head_seg.html_close
- end
- def reinitialise(per)
- per.title,per.dot_nav,per.tocband_banner,per.tocband_bannerless,per.headings,per.main,per.tail,per.credits=Array.new(8){[]}
- @per.segtocband=nil
- end
- def cleanup(md,per)
- #per=persist_init
- reinitialise(per)
- @@tracker=0
- @per.seg_endnotes,@per.seg_subtoc={},{}
- @per.seg_endnotes_array,@per.seg_subtoc_array=[],[]
- per.endnote_all=[]
- end
- def get_subtoc_endnotes(data,per) #get endnotes & sub-table of contents subtoc
- @per=per
- data.each do |dob|
- dob.obj=dob.obj.gsub(/<a name=\"h\d.*?\">(.+?)<\/a>/mi,'\1')
- if @md.flag_auto_endnotes
- if (dob.is==:heading \
- || dob.is==:heading_insert) \
- && (dob.ln.to_s =~/^[0-4]/) \
- and not @per.fn.to_s.empty?
- @per.seg_endnotes[@per.fn]=[]
- @per.seg_endnotes[@per.fn] << @per.seg_endnotes_array
- @per.seg_endnotes_array=[] if dob.ln==4
- end
- if (dob.is==:heading \
- || dob.is==:heading_insert) \
- && dob.ln==4 #% EXTRACTION OF SUB-TOCs & SEGMENT NAME, after EXTRACTION OF ENDNOTES & SUB-TOCs
- @per.seg_subtoc[@per.fn]=@per.seg_subtoc_array
- @per.seg_subtoc_array=[]
- if dob.name \
- and dob.obj
- @per.fn=dob.name
- else
- if dob.name =~/\S+/
- @per.fn=dob.name
- else @per.fn=''
- end
- end
- end
- end
- if dob.is==:heading \
- && (dob.ln.to_s =~/^[5-7]/)
- case dob.ln
- when 5
- txt_obj={ txt: dob.obj.strip, ocn: dob.ocn }
- format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj)
- subtoc=format_seg.subtoc_lev5 #keep and make available, this is the subtoc
- when 6
- txt_obj={ txt: dob.obj.strip, ocn: dob.ocn }
- format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj)
- subtoc=format_seg.subtoc_lev6 #keep and make available, this is the subtoc
- when 7
- txt_obj={ txt: dob.obj.strip, ocn: dob.ocn }
- format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj)
- subtoc=format_seg.subtoc_lev7 #keep and make available, this is the subtoc
- end
- @per.seg_subtoc_array << subtoc
- end
- if @md.flag_auto_endnotes
- if (dob.obj =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[\d*+]+\s*<a href="##{Mx[:note_ref]}[\d*+]+"/) \
- && dob.is !=:code # endnote-
- endnote_array=[]
- if dob.obj=~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/m
- endnote_array << dob.obj.scan(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/m)
- end
- if dob.obj=~/#{Mx[:en_b_o]}[*]\d+\s.+?#{Mx[:en_b_c]}/m
- endnote_array \
- << dob.obj.scan(/#{Mx[:en_b_o]}[*]\d+\s.+?#{Mx[:en_b_c]}/m)
- end
- if dob.obj=~/#{Mx[:en_b_o]}[+]\d+\s.+?#{Mx[:en_b_c]}/m
- endnote_array \
- << dob.obj.scan(/#{Mx[:en_b_o]}[+]\d+\s.+?#{Mx[:en_b_c]}/m)
- end
- endnote_array=endnote_array.flatten.compact #watch, check compacting
- endnote_array.each do |note|
- note_match=note.dup
- note_match_seg=note.dup
- e_n=note_match_seg[/(?:#{Mx[:en_a_o]}[\d*+]+|#{Mx[:en_b_o]}[*+]\d+)\s+(.+?)(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m,1]
- try=e_n.split(/<br(?: \/)?>/)
- try.each do |e|
- txt_obj={ txt: e }
- format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj)
- note_match=if e =~/#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]}/
- format_seg.endnote_body_indent
- else format_seg.endnote_body
- end
- @per.seg_endnotes_array << note_match
- end
- try.join('<br>')
- #% creation of separate end segment/page of all endnotes referenced back to reference segment
- m=/(?:#{Mx[:en_a_o]}[\d*+]+|#{Mx[:en_b_o]}[*+]\d+)\s+(.+?href=")(##{Mx[:note_ref]}[\d*+]+".+)(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/mi
- endnote_part_a=note_match_seg[m,1]
- endnote_part_b=note_match_seg[m,2]
- txt_obj={ endnote_part_a: endnote_part_a, endnote_part_b: endnote_part_b }
- format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj)
- note_match_all_seg=format_seg.endnote_seg_body(@per.fn) #BUG WATCH 200408
- @per.endnote_all << note_match_all_seg
- end
- dob.obj=dob.obj.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ')
- end
- end
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/current/html_shared.rb b/lib/sisu/current/html_shared.rb
deleted file mode 100644
index 883467b..0000000
--- a/lib/sisu/current/html_shared.rb
+++ /dev/null
@@ -1,62 +0,0 @@
-# encoding: utf-8
-=begin
-
-* Name: SiSU
-
-** Description: documents, structuring, processing, publishing, search
-*** shared html parts
-
-** Author: Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
-** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
- All Rights Reserved.
-
-** License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
-** SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
-** Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
-** Git
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/html_shared.rb;hb=HEAD>
-
-=end
-module SiSU_HTML_Shared
- require_relative 'html_table' # html_table.rb
- class TableHTML < SiSU_HTML_Table::TableHTML
- end
-end
-__END__
diff --git a/lib/sisu/current/html_table.rb b/lib/sisu/current/html_table.rb
deleted file mode 100644
index ddcb513..0000000
--- a/lib/sisu/current/html_table.rb
+++ /dev/null
@@ -1,64 +0,0 @@
-# encoding: utf-8
-=begin
-
-* Name: SiSU
-
-** Description: documents, structuring, processing, publishing, search
-*** shared html parts, table
-
-** Author: Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
-** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
- All Rights Reserved.
-
-** License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
-** SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
-** Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
-** Git
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/html_table.rb;hb=HEAD>
-
-=end
-module SiSU_HTML_Table
- require_relative 'xhtml_table' # xhtml_table.rb
- require_relative 'html_parts' # html_parts.rb
- class TableHTML < SiSU_XHTML_Table::TableXHTML
- include SiSU_Parts_HTML
- end
-end
-__END__
diff --git a/lib/sisu/current/html_tune.rb b/lib/sisu/current/html_tune.rb
deleted file mode 100644
index c02fc49..0000000
--- a/lib/sisu/current/html_tune.rb
+++ /dev/null
@@ -1,301 +0,0 @@
-# encoding: utf-8
-=begin
-
-* Name: SiSU
-
-** Description: documents, structuring, processing, publishing, search
-*** html generation, html pre-processing
-
-** Author: Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
-** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
- All Rights Reserved.
-
-** License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
-** SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
-** Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
-** Git
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/html_tune.rb;hb=HEAD>
-
-=end
-require_relative 'dp' # dp.rb
-module SiSU_HTML_Tune
- require_relative 'se' # se.rb
- include SiSU_Env; include SiSU_Screen
- require_relative 'html_parts' # html_parts.rb
- require_relative 'html_format' # html_format.rb #watch
- @@line_mode=''
- @@endnote_array=[]
- @@endnote_call_counter=1
- @@table_align='<table summary='' width="96%" border="0" 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
- @file=SiSU_Env::InfoFile.new(@md.fns)
- @cX=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set]).cX
- end
- def hard_output
- @filename_tune=@file.write_file_processing.html_tune
- data=[]
- @data.each do |x|
- unless x.obj.empty?
- x.obj=x.obj.strip
- data << x
- end
- end
- data.each do |dob|
- @filename_tune.puts dob, "\n"
- end
- end
- def marshal
- File.open(@file.marshal.html_tune,'w') {|f| Marshal.dump(@data.to_a,f)}
- end
- end
- class CleanHTML
- def initialize(html='')
- @html=html
- end
- def clean_for_html
- html=@html
- str=if html.is_a?(String)
- html
- else html.obj
- end
- str=str.gsub(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;').
- gsub(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;').
- gsub(/[<]/m,'&lt;').gsub(/[>]/m,'&gt;')
- end
- def clean
- html=@html
- str=if html.is_a?(String)
- html
- else html.obj
- end
- str=str.gsub(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;').
- gsub(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;').
- gsub(/[\\]{2}/m,'<br>')
- end
- end
- class Tune
- include SiSU_Parts_HTML
- def initialize(data,md)
- @data,@md=data,md
- @sys=SiSU_Env::SystemCall.new
- @env=SiSU_Env::InfoEnv.new(@md.fns,@md)
- end
- def songsheet
- begin
- @cX=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set]).cX
- if (@md.opt.act[:verbose][:set]==:on \
- || @md.opt.act[:verbose_plus][:set]==:on \
- || @md.opt.act[:maintenance][:set]==:on)
- SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'Tune').txt_grey
- end
- songsheet_array(@data)
- #data=songsheet_array(@data)
- if @md.opt.act[:maintenance][:set]==:on #Hard Output Tune Optional on/off here
- SiSU_HTML_Tune::Output.new(@data,@md).hard_output
- SiSU_HTML_Tune::Output.new(@data,@md).marshal
- end
- SiSU_HTML_Tune::Tune.new(@data,@md).output
- rescue
- SiSU_Errors::Rescued.new($!,$@,@md.opt.selections.str,@md.fns).location do
- __LINE__.to_s + ':' + __FILE__
- end
- ensure
- end
- end
- def songsheet_array(data)
- data_tuned=[]
- data.each do |dob|
- dob=amp_angle_brackets(dob)
- dob=endnotes_html(dob)
- dob=url_markup(dob)
- dob=markup(dob)
- data_tuned << dob
- end
- data_tuned
- end
- def urls(data)
- @words=data.each.map do |word|
- if word=~/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/
- http_=true
- if word =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/
- m,u=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/.match(word).captures
- 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="#{Xx[:html_relative2]}/" + 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=@md.file.output_path.html_seg.rel_image
- #image_path=(@md.fns =~/\.-ss[tm]$/) \
- #? @env.url.images_external
- #: @env.url.images_local
- 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=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=u.gsub(/(\S+)/,"#{Xx[:segment]}#\\1") if u !~/\// unless http_ #marker: in scroll remove; in seg replace
- ins=%{<a href="#{u}">#{link}</a>}
- word=word.gsub(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,ins).
- gsub(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/,ins)
- end
- word
- else word
- end
- end.join(' ')
- end
- def url_markup(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=dob.obj.gsub(/.+/m,words)
- end #consider change, do a while loop
- dob.obj=dob.obj.gsub(/\\copyright/i,%{<sup>&copy;</sup>})
- if (dob.obj !~/\<:ad\s+\.\.\//)
- dob.obj=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=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=dob.obj.gsub(/!pick/,%{<img border="0" height="15" width="15" src="#{@env.url.images}/#{the_icon.i_choice}" alt="stellar">}).
- gsub(/!new/,%{&nbsp;<img border="0" height="15" width="15" src="#{@env.url.images}/#{the_icon.i_new}" alt="new">}).
- gsub(/<:h(.{1,7}?)>/,'<a href="#h\1">\1</a>').
- gsub(/<:to(\d{1,7}?)>/,'<a href="#to\1">to&nbsp;{&nbsp;\1&nbsp;}</a> ').
- gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'<a href="\1" target="_top">\1</a>'). #http ftp matches escaped, no decoration
- gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,%{#{the_url_decoration.xml_open}<a href="mailto:\\1">\\1</a>#{the_url_decoration.xml_close}}).
- gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{the_url_decoration.xml_open}<a href="\\1" target="_top">\\1</a>#{the_url_decoration.xml_close}}) #http ftp matches with decoration
- if dob.obj =~/#{Xx[:html_relative2]}\/\S+/ \
- and dob.obj !~/(\"#{Xx[:html_relative2]}\/\S+?\"|>\s*#{Xx[:html_relative2]}\/\S+<)/
- dob.obj=dob.obj.gsub(/(#{Xx[:html_relative2]}\/\S+)/,'<a href="\1">\1</a>')
- end
- if dob.obj =~/..\/\S+/ \
- and dob.obj !~/(\"..\/\S+?\"|>\s*..\/\S+<)/
- dob.obj=dob.obj.gsub(/\.\.(\/\S+)/,%{<a href="#{Xx[:html_relative2]}\1">\1</a>})
- end
- dob.obj=dob.obj.gsub(/<a href=":/,%{<a href="#{the_url.site}/}).
- gsub(/<a href="\.\.\//,%{<a href="#{the_url.site}/}).
- gsub(/<a href="#{Xx[:html_relative2]}\//,%{<a href="#{the_url.site}/})
- else
- dob.obj=dob.obj.gsub(/</m,'&lt;').gsub(/>/m,'&gt;')
- end
- dob
- end
- def amp_angle_brackets(dob)
- dob.obj=dob.obj.
- gsub(/&/u,'&amp;').
- gsub(/<([a-z:\/]+)>/,"#{Dx[:lt_xml]}\\1#{Dx[:gt_xml]}").
- gsub(/</u,'&lt;').gsub(/>/u,'&gt;')
- dob
- end
- def endnotes_html(dob)
- unless dob.is ==:code
- dob.obj=dob.obj.gsub(/(#{Mx[:en_a_o]}|#{Mx[:en_b_o]})(\d+)\s+(.+?)(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/,
- %{&nbsp;<a href="##{Mx[:note]}\\2"><note id="#{Mx[:note_ref]}\\2">&nbsp;<sup>\\2</sup>&nbsp;</note></a> } +
- %{\\1\\2 <a href="##{Mx[:note_ref]}\\2"><note id="#{Mx[:note]}\\2">&nbsp;<sup>\\2.</sup></note></a> \\3 \\4}).
- gsub(/(#{Mx[:en_b_o]})([*+]\d+)\s+(.+?)(#{Mx[:en_b_c]})/,
- %{&nbsp;<a href="##{Mx[:note]}\\2"><note id="#{Mx[:note_ref]}\\2">&nbsp;<sup>\\2</sup>&nbsp;</note></a> } +
- %{\\1\\2 <a href="##{Mx[:note_ref]}\\2"><note id="#{Mx[:note]}\\2">&nbsp;<sup>\\2.</sup></note></a> \\3 \\4}).
- gsub(/(#{Mx[:en_a_o]})([*+]+)\s+(.+?)(#{Mx[:en_a_c]})/,
- %{&nbsp;<a href="##{Mx[:note]}\\2"><note id="#{Mx[:note_ref]}\\2">&nbsp;<sup>\\2</sup>&nbsp;</note></a> } +
- %{\\1\\2 <a href="##{Mx[:note_ref]}\\2"><note id="#{Mx[:note]}\\2">&nbsp;<sup>\\2</sup></note></a> \\3 \\4})
- end
- dob
- end
- def markup(dob)
- dob.obj=dob.obj.gsub(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;').
- gsub(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;')
- dob.obj=dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br>') unless dob.is==:table
- dob.obj=dob.obj.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>').
- gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>').
- gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>').
- gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>').
- gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>').
- gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'<ins>\1</ins>').
- gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>').
- gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>').
- gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>'). # tt, kbd
- gsub(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'<a name="\1"></a>').
- gsub(/#{Mx[:gl_bullet]}/m,'●&nbsp;&nbsp;').
- gsub(/#{Mx[:nbsp]}/,'&nbsp;').
- gsub(/<(p|br) \/>/,'<\1>')
- dob=SiSU_HTML_Tune::CleanHTML.new(dob).clean
- dob
- end
- def output
- data=@data
- @tuned_file=data.each.map do |dob|
- dob.obj=dob.obj.strip.chomp
- dob
- end
- @tuned_file << "\n<EOF>" if (@md.fns =~/\.sst0/) #remove
- @tuned_file
- end
- end
-end
-__END__
diff --git a/lib/sisu/current/hub_actions.rb b/lib/sisu/current/hub_actions.rb
deleted file mode 100644
index 1ea67bf..0000000
--- a/lib/sisu/current/hub_actions.rb
+++ /dev/null
@@ -1,1122 +0,0 @@
-# encoding: utf-8
-=begin
-
-* Name: SiSU
-
-** Description: documents, structuring, processing, publishing, search
-*** hub, perform selected actions
-
-** Author: Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
-** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
- All Rights Reserved.
-
-** License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
-** SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
-** Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
-** Git
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/hub_actions.rb;hb=HEAD>
-
-=end
-module SiSU_Hub_Actions
- class HubActions
- require_relative 'utils_composite' # utils_composite.rb
- include SiSU_Composite_Doc_Utils # composite doc, .ssm, extract all related insert files, array of filenames test
- def initialize(opt)
- @opt=opt
- end
- def report
- def version_info?
- if @opt.act[:version_info][:set]==:on
- SiSU_Env::InfoAbout.new(@opt).sisu_version
- end
- end
- def version_number_git?
- if @opt.act[:version_info][:set]==:on \
- || @opt.act[:verbose][:set]==:on \
- || @opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on
- SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- ' ' + SiSU_is.git_version_info?
- ).grey
- end
- end
- def version_dir?
- if @opt.act[:version_info][:set]==:on \
- || @opt.act[:verbose][:set]==:on \
- || @opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on
- SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- ' ' + File.dirname(__FILE__)
- ).grey
- end
- end
- def version_info_extra?
- if @opt.act[:version_info][:set]==:on \
- || @opt.act[:verbose][:set]==:on \
- || @opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on
- if SiSU_is.git_version_info?
- SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- ' ' + File.dirname(__FILE__) + \
- ' vcr: ' + SiSU_is.git_version_info?
- ).grey
- else
- SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- ' ' + File.dirname(__FILE__)
- ).grey
- end
- end
- end
- self
- end
- def prepare
- def site?
- if @opt.act[:site_init][:set]==:on #% --init-site, -C initialize/configure
- require_relative 'conf' #% --init-site, -C initialize/configure
- SiSU_Initialize::Source.new(@opt).read
- if @opt.act[:rsync][:set]==:on
- if @opt.selections.str =~/--init(?:ialize)?=site/ \
- and @opt.selections.str =~/RZ/
- SiSU_Hub_Actions::Operations.new(@opt).remote_put_base_site_rsync_match
- else SiSU_Hub_Actions::Operations.new(@opt).remote_put_base_site_rsync
- end
- elsif @opt.act[:scp][:set]==:on
- if @opt.selections.str =~/--init(?:ialize)?=site/ \
- and @opt.selections.str =~/CCr/
- SiSU_Hub_Actions::Operations.new(@opt).remote_put_base_site_all
- else SiSU_Hub_Actions::Operations.new(@opt).remote_put_base_site
- end
- end
- end
- end
- def remote_site?
- if @opt.act[:site_init][:set]==:on
- if @opt.act[:site_init][:set]==:on #% --init-site, -C initialize/configure
- #require_relative 'conf' #% --init-site, -C initialize/configure
- #SiSU_Initialize::Source.new(@opt).read
- #if @opt.act[:rsync][:set]==:on
- # if @opt.selections.str =~/--init(?:ialize)?=site/ \
- # and @opt.selection =~/RZ/
- # SiSU_Hub_Actions::Operations.new(@opt).remote_put_base_site_rsync_match
- # else SiSU_Hub_Actions::Operations.new(@opt).remote_put_base_site_rsync
- # end
- #elsif @opt.act[:scp][:set]==:on
- # if @opt.selections.str =~/--init(?:ialize)?=site/ \
- # and @opt.selection =~/CCr/
- # SiSU_Hub_Actions::Operations.new(@opt).remote_put_base_site_all
- # else SiSU_Hub_Actions::Operations.new(@opt).remote_put_base_site
- # end
- #end
- end
- end
- end
- def sql?
- if @opt.act[:psql_createdb][:set]==:on \
- or @opt.act[:psql_create][:set]==:on \
- or @opt.act[:psql_drop][:set]==:on
- done=:ok
- if @opt.act[:psql][:set]==:on
- require_relative 'dbi'
- SiSU_DBI::SQL.new(@opt).connect
- end
- end
- if @opt.act[:sqlite_createdb][:set]==:on \
- or @opt.act[:sqlite_create][:set]==:on \
- or @opt.act[:sqlite_drop][:set]==:on
- done=:ok
- if @opt.act[:sqlite][:set]==:on
- require_relative 'dbi'
- SiSU_DBI::SQL.new(@opt).connect
- end
- end
- end
- def search_form?
- if @opt.act[:sample_search_form][:set]==:on #% --sample-search-form, -F cgi sample search form
- SiSU_Hub_Actions::Operations.new(@opt).cgi
- end
- end
- def webrick?
- if @opt.act[:webrick][:set]==:on #% --webrick, -W webrick
- SiSU_Hub_Actions::Operations.new(@opt).webrick
- end
- end
- self
- end
- def outputs
- def each_file
- def abstract_objects?
- if @opt.act[:ao][:set]==:on #% --ao --dal, -m
- if @opt.f_pths.length > 0
- unless @opt.act[:po4a_shelf][:set]==:on # --po4a-shelf
- if @opt.fno =~ /\.ssm$/
- require_relative 'ao_composite' # ao_composite.rb #pre-processing
- SiSU_Assemble::Composite.new(@opt).read
- end
- require_relative 'ao' # ao.rb
- SiSU_AO::Source.new(@opt).read
- end
- else
- msg='document abstraction request requires sisu markup files'
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
- mark(msg)
- else puts msg
- end
- end
- end
- end
- def qrcode?
- if @opt.act[:qrcode][:set]==:on #% --qrcode, -Q
- if @opt.f_pths.length > 0
- require_relative 'qrcode' # qrcode.rb
- SiSU_QRcode::Source.new(@opt).read
- else
- msg='qrcode request requires sisu markup files'
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
- mark(msg)
- else puts msg
- end
- end
- end
- end
- def hash_digests?
- if @opt.act[:hash_digests][:set]==:on #% --hash-digests, -N digest tree
- if @opt.f_pths.length > 0
- require_relative 'digests' # digests.rb
- SiSU_DigestView::Source.new(@opt).read
- else
- msg='hash digest request requires sisu markup files'
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
- mark(msg)
- else puts msg
- end
- end
- end
- end
- def text?
- if @opt.act[:txt][:set]==:on #% --txt, -t -a
- if @opt.f_pths.length > 0
- require_relative 'txt_plain' # txt_plain.rb
- SiSU_Txt_Plain::Source.new(@opt).read
- else
- msg='text request requires sisu markup files'
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
- mark(msg)
- else puts msg
- end
- end
- end
- if @opt.act[:txt_textile][:set]==:on #% --textile
- if @opt.f_pths.length > 0
- require_relative 'txt_textile' #txt_textile.rb
- SiSU_Txt_Textile::Source.new(@opt).read
- else
- msg='textile request requires sisu markup files'
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
- mark(msg)
- else puts msg
- end
- end
- end
- if @opt.act[:txt_asciidoc][:set]==:on #% --asciidoc
- if @opt.f_pths.length > 0
- require_relative 'txt_asciidoc' # txt_asciidoc.rb
- SiSU_Txt_AsciiDoc::Source.new(@opt).read
- else
- msg='asciidoc request requires sisu markup files'
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
- mark(msg)
- else puts msg
- end
- end
- end
- if @opt.act[:txt_markdown][:set]==:on #% --markdown
- if @opt.f_pths.length > 0
- require_relative 'txt_markdown' # txt_markdown.rb
- SiSU_Txt_Markdown::Source.new(@opt).read
- else
- msg='markdown request requires sisu markup files'
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
- mark(msg)
- else puts msg
- end
- end
- end
- if @opt.act[:txt_rst][:set]==:on #% --rst, --rest
- if @opt.f_pths.length > 0
- require_relative 'txt_rst' # txt_rst.rb
- SiSU_Txt_rST::Source.new(@opt).read
- else
- msg='rst request requires sisu markup files'
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
- mark(msg)
- else puts msg
- end
- end
- end
- if @opt.act[:txt_orgmode][:set]==:on #% --orgmode
- if @opt.f_pths.length > 0
- require_relative 'txt_orgmode' # txt_orgmode.rb
- SiSU_Txt_OrgMode::Source.new(@opt).read
- else
- msg='orgmode request requires sisu markup files'
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
- mark(msg)
- else puts msg
- end
- end
- end
- end
- def html?
- if @opt.act[:html][:set]==:on #% --html, -h
- if @opt.f_pths.length > 0
- require_relative 'html' # html.rb
- SiSU_HTML::Source.new(@opt).read
- else
- msg='html request requires sisu markup files'
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
- mark(msg)
- else puts msg
- end
- end
- else
- if @opt.act[:html_seg][:set]==:on #% --html-seg
- if @opt.f_pths.length > 0
- require_relative 'html' # html.rb
- SiSU_HTML::Source.new(@opt).read
- else
- msg='html seg request requires sisu markup files'
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
- mark(msg)
- else puts msg
- end
- end
- end
- if @opt.act[:html_scroll][:set]==:on #% --html-scroll
- if @opt.f_pths.length > 0
- require_relative 'html' # html.rb
- SiSU_HTML::Source.new(@opt).read
- else
- msg='html scroll request requires sisu markup files'
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
- mark(msg)
- else puts msg
- end
- end
- end
- end
- if @opt.act[:concordance][:set]==:on #% --concordance, -w
- if @opt.f_pths.length > 0
- require_relative 'html_concordance' # html_concordance.rb
- SiSU_Concordance::Source.new(@opt).read
- else
- msg='concordance request requires sisu markup files'
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
- mark(msg)
- else puts msg
- end
- end
- end
- end
- def xhtml?
- if @opt.act[:xhtml][:set]==:on #% --xhtml, -b
- if @opt.f_pths.length > 0
- require_relative 'xhtml' # xhtml.rb
- SiSU_XHTML::Source.new(@opt).read
- else
- msg='xhtml request requires sisu markup files'
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
- mark(msg)
- else puts msg
- end
- end
- end
- if @opt.act[:epub][:set]==:on #% --epub, -e
- if @opt.f_pths.length > 0
- require_relative 'xhtml_epub2' # xhtml_epub2.rb
- SiSU_XHTML_EPUB2::Source.new(@opt).read
- else
- msg='epub request requires sisu markup files'
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
- mark(msg)
- else puts msg
- end
- end
- end
- end
- def xml?
- if @opt.act[:odt][:set]==:on #% --odt, -o
- if @opt.f_pths.length > 0
- require_relative 'xml_odf_odt' # xml_odf_odt.rb
- SiSU_XML_ODF_ODT::Source.new(@opt).read
- else
- msg='odt request requires sisu markup files'
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
- mark(msg)
- else puts msg
- end
- end
- end
- if @opt.act[:xml_scaffold_structure_sisu][:set]==:on #% --xml-scaffold --xml-scaffold-sisu
- if @opt.f_pths.length > 0
- require_relative 'xml_scaffold_structure_sisu' # xml_scaffold_structure_sisu.rb
- SiSU_XML_Scaffold_Structure_Sisu::Source.new(@opt).read
- else
- msg='xml scaffold request requires sisu markup files'
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
- mark(msg)
- else puts msg
- end
- end
- end
- if @opt.act[:xml_scaffold_structure_collapse][:set]==:on #% --xml-scaffold-collapse
- if @opt.f_pths.length > 0
- require_relative 'xml_scaffold_structure_collapsed' # xml_scaffold_structure_collapsed.rb
- SiSU_XML_Scaffold_Structure_Collapse::Source.new(@opt).read
- else
- msg='xml scaffold request requires sisu markup files'
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
- mark(msg)
- else puts msg
- end
- end
- end
- if @opt.act[:xml_docbook_book][:set]==:on #% --xml-docbook
- if @opt.f_pths.length > 0
- require_relative 'xml_docbook5' # xml_docbook5.rb
- SiSU_XML_Docbook_Book::Source.new(@opt).read
- else
- msg='docbook request requires sisu markup files'
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
- mark(msg)
- else puts msg
- end
- end
- end
- if @opt.act[:xml_fictionbook][:set]==:on #% --xml-fictionbook
- if @opt.f_pths.length > 0
- require_relative 'xml_fictionbook2' # xml_fictionbook2.rb
- SiSU_XML_Fictionbook::Source.new(@opt).read
- else
- msg='fictionbook request requires sisu markup files'
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
- mark(msg)
- else puts msg
- end
- end
- end
- if @opt.act[:xml_sax][:set]==:on #% --xml-sax, -x
- if @opt.f_pths.length > 0
- require_relative 'xml_sax' # xml_sax.rb
- SiSU_XML_SAX::Source.new(@opt).read
- else
- msg='xml sax request requires sisu markup files'
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
- mark(msg)
- else puts msg
- end
- end
- end
- if @opt.act[:xml_dom][:set]==:on #% --xml-dom, -X
- if @opt.f_pths.length > 0
- require_relative 'xml_dom' # xml_dom.rb
- SiSU_XML_DOM::Source.new(@opt).read
- else
- msg='xml dom request requires sisu markup files'
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
- mark(msg)
- else puts msg
- end
- end
- end
- end
- def pdf?
- if @opt.act[:pdf][:set]==:on \
- or @opt.act[:pdf_p][:set]==:on \
- or @opt.act[:pdf_l][:set]==:on #% --pdf-l --pdf, -p
- if @opt.f_pths.length > 0
- require_relative 'texpdf' # texpdf.rb
- SiSU_TeX::Source.new(@opt).read
- else
- msg='pdf request requires sisu markup files'
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
- mark(msg)
- else puts msg
- end
- end
- end
- end
- def man_or_info?
- if @opt.act[:manpage][:set]==:on #% --manpage, -i
- if @opt.f_pths.length > 0
- require_relative 'manpage' # manpage.rb
- SiSU_Manpage::Source.new(@opt).read
- else
- msg='manpage request requires sisu markup files'
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
- mark(msg)
- else puts msg
- end
- end
- end
- if @opt.act[:texinfo][:set]==:on #% --texinfo, -I
- if @opt.f_pths.length > 0
- require_relative 'texinfo' # texinfo.rb
- SiSU_TexInfo::Source.new(@opt).read
- else
- msg='texinfo request requires sisu markup files'
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
- mark(msg)
- else puts msg
- end
- end
- end
- end
- def sqlite_discrete?
- if @opt.act[:sqlite_discrete][:set]==:on #% --sqlite, -d
- if @opt.f_pths.length > 0
- require_relative 'dbi_discrete' # dbi_discrete.rb
- SiSU_DBI_Discrete::SQL.new(@opt).build
- else
- msg='sqlite (discrete) request requires sisu markup files'
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
- mark(msg)
- else puts msg
- end
- end
- end
- end
- def po4a_make?
- if @opt.act[:po4a_sst_ao_sst][:set]==:on #% --po4a-ao
- if @opt.f_pths.length > 0
- require_relative 'src_po4a_sst_ao_sst'
- SiSU_SStm_AO_SStm::Source.new(@opt).read_process_src_files # src_po4a_sst_ao_sst.rb
- else
- msg='sst request requires sisu markup files'
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan).
- mark(msg)
- else puts msg
- end
- end
- end
- end
- def elasticsearch?
- if @opt.act[:elasticsearch][:set]==:on #% --elastic, -x
- if @opt.f_pths.length > 0
- require_relative 'json_elastic' # json_elastic.rb
- SiSU_Elastic::Source.new(@opt).read
- else
- msg='easticsearch request requires sisu markup files'
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
- mark(msg)
- else puts msg
- end
- end
- end
- end
- def manifest?
- if @opt.act[:manifest][:set]==:on #% --manifest, -y
- if @opt.f_pths.length > 0
- begin
- require_relative 'html_manifest' # html_manifest.rb
- ((@opt.act[:sisupod][:set]==:on \
- || @opt.act[:share_source][:set]==:on \
- || @opt.act[:po4a_sstm][:set]==:on) \
- && @opt.f_pths.length < 2 ) \
- ? nil
- : SiSU_Manifest::Source.new(@opt).read
- rescue
- end
- else
- msg='manifest request requires sisu markup files'
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
- mark(msg)
- else puts msg
- end
- end
- end
- end
- def harvest?
- if @opt.act[:harvest][:set]==:on #% --harvest
- if @opt.f_pths.length > 0
- require_relative 'html_harvest' # html_harvest.rb
- SiSU_Harvest::Source.new(@opt).read
- else
- msg='harvest request requires sisu markup files'
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
- mark(msg)
- else puts msg
- end
- end
- end
- end
- self
- end
- def loop_files
- def share_source?
- if @opt.act[:sisupod][:set]==:on \
- or @opt.act[:share_source][:set]==:on \
- or @opt.act[:po4a_sstm][:set]==:on \
- or @opt.act[:git][:set]==:on
- begin
- if @opt.f_pths.length > 0
- require_relative 'src_shared'
- SiSU_Hub_Loops::OptionLoopFiles.new(@opt).
- loop_files_on_given_option do
- SiSU_Source::SiSUpodSource.new(@opt).read
- end
- else
- msg='share markup source request requires sisu markup files'
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan).
- mark(msg)
- else puts msg
- end
- end
- if @opt.act[:sisupod][:set]==:on #% --sisupod, -S
- if @opt.f_pths.length > 0
- require_relative 'src_sisupod_make' # src_sisupod_make.rb
- begin
- SiSU_Hub_Loops::OptionLoopFiles.new(@opt).
- loop_files_on_given_option_bundle do
- SiSU_Doc::Source.new(@opt).sisupod_tar_xz
- end
- ensure
- end
- else
- msg='sisupod (share markup source) request requires sisu markup files'
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan).
- mark(msg)
- else puts msg
- end
- end
- end
- if @opt.act[:git][:set]==:on #% --git, -g
- if @opt.f_pths.length > 0
- require_relative 'git' # git.rb
- begin
- SiSU_Hub_Loops::OptionLoopFiles.new(@opt).
- loop_files_on_given_option do
- SiSU_Git::Source.new(@opt).read
- end
- ensure
- SiSU_Hub_Loops::OptionLoopFiles.new(@opt).
- loop_files_on_given_option_bundle do
- SiSU_Git::Source.new(@opt).git_commit
- end
- end
- else
- msg='git request requires sisu markup files'
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan).
- mark(msg)
- else puts msg
- end
- end
- end
- if (@opt.act[:sisupod][:set]==:on \
- || @opt.act[:share_source][:set]==:on \
- || @opt.act[:po4a_sstm][:set]==:on) \
- and @opt.act[:manifest][:set]==:on #% --manifest, -y
- if @opt.f_pths.length > 0
- require_relative 'html_manifest' # html_manifest.rb
- begin
- ensure
- SiSU_Hub_Loops::OptionLoopFiles.new(@opt).
- loop_files_on_given_option_bundle do
- SiSU_Manifest::Source.new(@opt).read
- end
- end
- else
- msg='manifest request requires sisu markup files'
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan).
- mark(msg)
- else puts msg
- end
- end
- end
- ensure
- if @opt.f_pths.length > 0
- env=SiSU_Env::InfoEnv.new(@opt.fns)
- path_pod=env.processing_path.processing_sisupod(@opt).paths
- unless @opt.act[:maintenance][:set]==:on
- FileUtils::rm_rf("#{path_pod[:sisupod]}/*") \
- if FileTest.directory?(path_pod[:sisupod])
- end
- else
- #SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan).
- # mark('*** request requires sisu markup files')
- end
- end
- end
- if @opt.act[:share_source][:set]==:on
- if @opt.f_pths.length > 0
- require_relative 'src_sisupod_sstm' # src_sisupod_sstm.rb
- begin
- ensure
- SiSU_Hub_Loops::OptionLoopFiles.new(@opt).
- loop_files_on_given_option_bundle do
- SiSU_Markup::Source_Sisupod.new(@opt).read
- end
- end
- else
- msg='share markup source request requires sisu markup files'
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan).
- mark(msg)
- else puts msg
- end
- end
- end
- if @opt.act[:po4a_sstm][:set]==:on #% --po4a-sst
- if @opt.f_pths.length > 0
- require_relative 'src_po4a_sstm'
- begin
- SiSU_Hub_Loops::OptionLoopFiles.new(@opt).
- loop_files_on_given_option do
- SiSU_Markup::Source_Po4a.new(@opt).read # src_po4a_sstm.rb
- end
- ensure
- end
- else
- msg='sst request requires sisu markup files'
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan).
- mark(msg)
- else puts msg
- end
- end
- end
- if @opt.act[:po4a_sst_ao_sst][:set]==:on #% --po4a-ao
- if @opt.f_pths.length > 0
- require_relative 'src_po4a_sst_ao_sst'
- begin
- SiSU_Hub_Loops::OptionLoopFiles.new(@opt).
- loop_files_on_given_option do
- SiSU_SStm_AO_SStm::Source.new(@opt).read_setup # src_po4a_sst_ao_sst.rb
- end
- ensure
- end
- else
- msg='sst request requires sisu markup files'
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan).
- mark(msg)
- else puts msg
- end
- end
- end
- if @opt.act[:po4a_shelf][:set]==:on #% --po4a-shelf
- if @opt.f_pths.length > 0
- require_relative 'src_po4a_shelf'
- begin
- SiSU_Hub_Loops::OptionLoopFiles.new(@opt).
- loop_files_on_given_option do
- SiSU_Po4a::Source.new(@opt).read # src_po4a_shelf.rb
- end
- ensure
- end
- else
- msg='src_po4a_shelf request requires sisu markup files'
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan).
- mark(msg)
- else puts msg
- end
- end
- end
- if @opt.act[:images][:set]==:on #% --images, -j
- if @opt.f_pths.length > 0
- require_relative 'shared_images'
- SiSU_Hub_Loops::OptionLoopFiles.new(@opt).
- loop_files_on_given_option do
- SiSU_Images::Source.new(@opt).read # shared_images.rb
- end
- else
- msg='place images request requires sisu markup files'
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan).
- mark(msg)
- else puts msg
- end
- end
- end
- end
- def run_termsheet? #broken, revisit later
- if @opt.selections.str =~/--termsheet/ #% -T termsheet/standard form #fix later
- if @opt.f_pths.length > 0
- @opt.files.each do |fns|
- if FileTest.file?(fns)
- @opt.fns=fns
- case @opt.fns
- when /\.(termsheet.rb)$/
- SiSU_Hub_Actions::Operations.new(@opt).termsheet
- else #print "not processed --> ", fns, "\n"
- end
- else SiSU_Hub_Actions::Operations.new(@opt).not_found
- end
- end
- else
- msg='process termsheet request requires sisu markup files'
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan).
- mark(msg)
- else puts msg
- end
- end
- end
- end
- def sql?
- if @opt.act[:psql][:set]==:on #% --pg, -D
- if @opt.f_pths.length > 0
- require_relative 'dbi'
- SiSU_Hub_Loops::OptionLoopFiles.new(@opt).
- loop_files_on_given_option do
- SiSU_DBI::SQL.new(@opt).connect # dbi.rb
- end
- else
- msg='pgsql request requires sisu markup files'
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan).
- mark(msg)
- else puts msg
- end
- end
- end
- if @opt.act[:sqlite][:set]==:on #% --sqlite, -d
- if @opt.f_pths.length > 0
- require_relative 'dbi'
- SiSU_Hub_Loops::OptionLoopFiles.new(@opt).
- loop_files_on_given_option do
- SiSU_DBI::SQL.new(@opt).connect # dbi.rb
- end
- else
- msg='sqlite request requires sisu markup files'
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan).
- mark(msg)
- else puts msg
- end
- end
- end
- end
- def manifest?
- if @opt.act[:manifest][:set]==:on #% --manifest, -y
- if @opt.f_pths.length > 1
- require_relative 'html_manifest'
- SiSU_Hub_Loops::OptionLoopFiles.new(@opt).manifest_on_files_translated do
- SiSU_Manifest::Source.new(@opt).read # html_manifest.rb
- end
- end
- end
- end
- def sitemaps?
- if @opt.act[:sitemap][:set]==:on #% --sitemap, -Y
- if @opt.f_pths.length > 0
- require_relative 'sitemaps'
- SiSU_Hub_Loops::OptionLoopFiles.new(@opt).
- loop_files_on_given_option do
- SiSU_Sitemaps::Source.new(@opt).read # sitemaps.rb
- end
- end
- end
- end
- def remote_placement?
- if @opt.act[:harvest][:set] !=:on
- if @opt.act[:scp][:set]==:on #% -r copy to remote server
- if @opt.f_pths.length > 0
- require_relative 'remote' # remote.rb
- SiSU_Hub_Loops::OptionLoopFiles.new(@opt).
- loop_files_on_given_option do
- SiSU_Remote::Put.new(@opt).scp
- end
- end
- end
- if @opt.act[:rsync][:set]==:on #% -R copy to remote server
- if @opt.f_pths.length > 0
- require_relative 'remote' # remote.rb
- SiSU_Hub_Loops::OptionLoopFiles.new(@opt).
- loop_files_on_given_option do
- SiSU_Remote::Put.new(@opt).rsync
- end
- end
- end
- else
- end
- end
- def urls?
- if @opt.act[:urls_selected][:set]==:on #% --urls
- if @opt.f_pths.length > 0
- require_relative 'urls'
- SiSU_Hub_Loops::OptionLoopFiles.new(@opt).
- loop_files_on_given_option do
- SiSU_Urls::Source.new(@opt).read #% urls.rb
- end
- else
- msg='urls request requires sisu markup files'
- if (@opt.act[:verbose_plus][:set]==:on \
- || @opt.act[:maintenance][:set]==:on)
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan).
- mark(msg)
- else puts msg
- end
- end
- end
- end
- self
- end
- def init?
- SiSU_Env::InfoProcessingFlag.new
- if @opt.act[:ao][:set]==:on \
- or @opt.act[:maintenance][:set]==:on #% --maintenance, -M
- env=SiSU_Env::InfoEnv.new(@opt.fns)
- 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_p3=/(sisupod(?:\.txz)?|\S+?\.ss[mt]\.txz|[^\/]+?\.ssp)$/
- unless @opt.files.join(',') =~ re_p3 #do not mix pods with source markup files in command line
- if @opt.act[:maintenance][:set] ==:on
- $VERBOSE=false #debug $VERBOSE=true
- end
- end
- re_p2=/(sisupod(?:\.zip)?|\S+?\.ss[mt]\.zip)$/
- unless @opt.files.join(',') =~ re_p2 #do not mix pods with source markup files in command line
- if @opt.act[:maintenance][:set] ==:on
- $VERBOSE=false #debug $VERBOSE=true
- end
- end
- end
- if @opt.act[:ao][:set]==:on
- @retry_count= -1
- begin
- @get_s,@get_p,@get_pl=[],[],[]
- re_s=/(\S+?\.-sst)$/
- re_p3=/((?:https?|file):\/\/\S+?(?:\/\S+?\.ss[mt]\.txz|sisupod(?:\.txz)?|\.ssp))/
- re_pl3=/^(\/\S+?\.ss[mt]\.txz)/
- @opt.files.each do |fns|
- if fns =~re_s
- @get_s << @opt.f_pths[0][:url]
- end
- if fns =~re_p3
- @get_p << re_p3.match(fns)[1] if re_p3
- end
- if fns =~re_pl3
- @get_pl << re_pl3.match(fns)[1] if re_p3
- end
- end
- if @get_s.length > 0 #% remote markup file .sst
- require_relative 'remote' # remote.rb
- SiSU_Remote::Get.new(@opt,@get_s).fns
- SiSU_Hub_Actions::Operations.new.counter
- end
- if @get_p.length > 0 #% remote sisupod
- require_relative 'remote' # remote.rb
- SiSU_Remote::Get.new(@opt,@get_p).sisupod
- end
- rescue
- SiSU_Errors::Rescued.new($!,$@,@opt,@fns).location do
- __LINE__.to_s + ':' + __FILE__
- end
- @retry_count +=1
- retry unless @retry_count > 1
- ensure
- end
- end
- end
- self
- 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
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).mark(:cyan) \
- if @opt.act[:maintenance][:set] ==:on
- require_relative 'remote' # remote.rb
- SiSU_Remote::Put.new(@opt).rsync_base
- end
- def remote_put_base_site_rsync_match # -CCRZ
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).mark(:cyan) \
- if @opt.act[:maintenance][:set] ==:on
- require_relative 'remote' # remote.rb
- SiSU_Remote::Put.new(@opt).rsync_base_sync
- end
- def remote_put_base_site # -Cr
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).mark(:cyan) \
- if @opt.act[:maintenance][:set] ==:on
- require_relative 'remote' # remote.rb
- SiSU_Remote::Put.new(@opt).scp_base
- end
- def remote_put_base_site_all # -CCr
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).mark(:cyan) \
- if @opt.act[:maintenance][:set] ==:on
- require_relative 'remote' # remote.rb
- SiSU_Remote::Put.new(@opt).scp_base_all
- end
- def cgi # -F
- require_relative 'cgi' # cgi.rb
- SiSU_CGI::SearchSQL.new(@opt).read
- end
- def termsheet # -t
- system("sisu_termsheet #{@opt.selections.str} #{@opt.fns}\n")
- @@n_do=@@n_do+1
- SiSU_Screen::Ansi.new(
- @opt.selections.str,@@n_do,
- 'Termsheet(s) processed'
- ).term_sheet_title unless @opt.act[:quiet][:set] ==:on
- end
- def webrick # -W
- prt=SiSU_Env::InfoEnv.new(@fns).port.webrick_port
- puts %{#{@cX.blue}<<#{@cX.off}#{@cX.green}Start Webrick web server on port: #{prt}#{@cX.off}#{@cX.blue}>> #{@cX.off*2} }
- require_relative 'webrick'
- SiSU_Webserv::WebrickStart.new
- end
- def not_found
- puts "\n#{@cX.fuchsia}FILE NOT FOUND:#{@cX.off} << #{@opt.fns} >> - requested #{@opt.selections.str} processing skipped\n"
- end
- def convert_name_message(fns,type,i,o,rune)
- %{\nIn filename: "#{@cX.fuchsia}#{fns}#{@cX.off}" << #{type} >> #{@cX.fuchsia}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.selections.str} 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.selections.str} processing skipped\n}
- when /(\.ssi)$/
- puts "\n#{@cX.fuchsia}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.selections.str} processing skipped\n"
- else
- puts "\n#{@cX.fuchsia}FILETYPE NOT RECOGNISED:#{@cX.off} << #{@opt.fns} >> - is not a recognized filetype,\n\trequested #{@opt.selections.str} processing skipped\n"
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/current/i18n.rb b/lib/sisu/current/i18n.rb
deleted file mode 100644
index 0413bb8..0000000
--- a/lib/sisu/current/i18n.rb
+++ /dev/null
@@ -1,702 +0,0 @@
-# encoding: utf-8
-=begin
-
-* Name: SiSU
-
-** Description: documents, structuring, processing, publishing, search
-*** internationalisation
-
-** Author: Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
-** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
- All Rights Reserved.
-
-** License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
-** SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
-** Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
-** Git
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/i18n.rb;hb=HEAD>
-
-=end
-module SiSU_i18n
- @@language_table,@@language_list=nil,nil
- class Languages
- def language
- def table
- @@language_table ||= {
- am: { c: 'am', n: 'Amharic', t: 'Amharic', xlp: 'amharic' },
- bg: { c: 'bg', n: 'Bulgarian', t: 'Български (Bəlgarski)', xlp: 'bulgarian' },
- bn: { c: 'bn', n: 'Bengali', t: 'Bengali', xlp: 'bengali' },
- br: { c: 'br', n: 'Breton', t: 'Breton', xlp: 'breton' },
- ca: { c: 'ca', n: 'Catalan', t: 'catalan', xlp: 'catalan' },
- cs: { c: 'cs', n: 'Czech', t: 'česky', xlp: 'czech' },
- cy: { c: 'cy', n: 'Welsh', t: 'Welsh', xlp: 'welsh' },
- da: { c: 'da', n: 'Danish', t: 'dansk', xlp: 'danish' },
- de: { c: 'de', n: 'German', t: 'Deutsch', xlp: 'german' },
- el: { c: 'el', n: 'Greek', t: 'Ελληνικά (Ellinika)', xlp: 'greek' },
- en: { c: 'en', n: 'English', t: 'English', xlp: 'english' },
- eo: { c: 'eo', n: 'Esperanto', t: 'Esperanto', xlp: 'esperanto' },
- es: { c: 'es', n: 'Spanish', t: 'español', xlp: 'spanish' },
- et: { c: 'et', n: 'Estonian', t: 'Estonian', xlp: 'estonian' },
- eu: { c: 'eu', n: 'Basque', t: 'basque', xlp: 'basque' },
- fi: { c: 'fi', n: 'Finnish', t: 'suomi', xlp: 'finnish' },
- fr: { c: 'fr', n: 'French', t: 'français', xlp: 'french' },
- ga: { c: 'ga', n: 'Irish', t: 'Irish', xlp: 'irish' },
- gl: { c: 'gl', n: 'Galician', t: 'Galician', xlp: 'galician' },
- he: { c: 'he', n: 'Hebrew', t: 'Hebrew', xlp: 'hebrew' },
- hi: { c: 'hi', n: 'Hindi', t: 'Hindi', xlp: 'hindi' },
- hr: { c: 'hr', n: 'Croatian', t: 'Croatian', xlp: 'croatian' },
- hy: { c: 'hy', n: 'Armenian', t: 'Armenian', xlp: 'armenian' },
- ia: { c: 'ia', n: 'Interlingua', t: 'Interlingua', xlp: 'interlingua' },
- is: { c: 'is', n: 'Icelandic', t: 'Icelandic', xlp: 'icelandic' },
- it: { c: 'it', n: 'Italian', t: 'Italiano', xlp: 'italian' },
- ja: { c: 'ja', n: 'Japanese', t: '日本語 (Nihongo)', xlp: 'japanese' },
- ko: { c: 'ko', n: 'Korean', t: 'Korean', xlp: 'korean' },
- la: { c: 'la', n: 'Latin', t: 'Latin', xlp: 'latin' },
- lo: { c: 'lo', n: 'Lao', t: 'Lao', xlp: 'lao' },
- lt: { c: 'lt', n: 'Lithuanian', t: 'Lithuanian', xlp: 'lithuanian' },
- lv: { c: 'lv', n: 'Latvian', t: 'Latvian', xlp: 'latvian' },
- ml: { c: 'ml', n: 'Malayalam', t: 'Malayalam', xlp: 'malayalam' },
- mr: { c: 'mr', n: 'Marathi', t: 'Marathi', xlp: 'marathi' },
- nl: { c: 'nl', n: 'Dutch', t: 'Nederlands', xlp: 'dutch' },
- no: { c: 'no', n: 'Norwegian', t: 'norsk', xlp: 'norsk' },
- nn: { c: 'nn', n: 'Norwegian Nynorsk', t: 'nynorsk', xlp: 'nynorsk' },
- oc: { c: 'oc', n: 'Occitan', t: 'Occitan', xlp: 'occitan' },
- pl: { c: 'pl', n: 'Polish', t: 'polski', xlp: 'polish' },
- pt: { c: 'pt', n: 'Portuguese', t: 'Português', xlp: 'portuges' },
- pt_BR: { c: 'pt_BR', n: 'Portuguese Brazil', t: 'Brazilian Português', xlp: 'brazilian' },
- ro: { c: 'ro', n: 'Romanian', t: 'română', xlp: 'romanian' },
- ru: { c: 'ru', n: 'Russian', t: 'Русский (Russkij)', xlp: 'russian' },
- sa: { c: 'sa', n: 'Sanskrit', t: 'Sanskrit', xlp: 'sanskrit' },
- se: { c: 'se', n: 'Sami', t: 'Samin', xlp: 'samin' },
- sk: { c: 'sk', n: 'Slovak', t: 'slovensky', xlp: 'slovak' },
- sl: { c: 'sl', n: 'Slovenian', t: 'Slovenian', xlp: 'slovenian' },
- sq: { c: 'sq', n: 'Albanian', t: 'Albanian', xlp: 'albanian' },
- sr: { c: 'sr', n: 'Serbian', t: 'Serbian', xlp: 'serbian' },
- sv: { c: 'sv', n: 'Swedish', t: 'svenska', xlp: 'swedish' },
- ta: { c: 'ta', n: 'Tamil', t: 'Tamil', xlp: 'tamil' },
- te: { c: 'te', n: 'Telugu', t: 'Telugu', xlp: 'telugu' },
- th: { c: 'th', n: 'Thai', t: 'Thai', xlp: 'thai' },
- tk: { c: 'tk', n: 'Turkmen', t: 'Turkmen', xlp: 'turkmen' },
- tr: { c: 'tr', n: 'Turkish', t: 'Türkçe', xlp: 'turkish' },
- uk: { c: 'uk', n: 'Ukranian', t: 'українська (ukrajins\'ka)', xlp: 'ukrainian' },
- ur: { c: 'ur', n: 'Urdu', t: 'Urdu', xlp: 'urdu' },
- us: { c: 'en', n: 'English (American)',t: 'English', xlp: 'english' },
- vi: { c: 'vi', n: 'Vietnamese', t: 'Vietnamese', xlp: 'vietnamese' },
- zh: { c: 'zh', n: 'Chinese', t: '中文', xlp: 'chinese' },
- en: { c: 'en', n: 'English', t: 'English', xlp: 'english' },
- xx: { c: 'xx', n: 'Default', t: 'English', xlp: 'english' },
- }
- end
- def list
- @@language_list ||= {
- 'am' => table[:am],
- 'bg' => table[:bg],
- 'bn' => table[:bn],
- 'br' => table[:br],
- 'ca' => table[:ca],
- 'cs' => table[:cs],
- 'cy' => table[:cy],
- 'da' => table[:da],
- 'de' => table[:de],
- 'el' => table[:el],
- 'en' => table[:en],
- 'eo' => table[:eo],
- 'es' => table[:es],
- 'et' => table[:et],
- 'eu' => table[:eu],
- 'fi' => table[:fi],
- 'fr' => table[:fr],
- 'ga' => table[:ga],
- 'gl' => table[:gl],
- 'he' => table[:he],
- 'hi' => table[:hi],
- 'hr' => table[:hr],
- 'hy' => table[:hy],
- 'ia' => table[:ia],
- 'is' => table[:is],
- 'it' => table[:it],
- 'ja' => table[:ja],
- 'ko' => table[:ko],
- 'la' => table[:la],
- 'lo' => table[:lo],
- 'lt' => table[:lt],
- 'lv' => table[:lv],
- 'ml' => table[:ml],
- 'mr' => table[:mr],
- 'nl' => table[:nl],
- 'no' => table[:no],
- 'nn' => table[:nn],
- 'oc' => table[:oc],
- 'pl' => table[:pl],
- 'pt' => table[:pt],
- 'pt_BR' => table[:pt_BR],
- 'ro' => table[:ro],
- 'ru' => table[:ru],
- 'sa' => table[:sa],
- 'se' => table[:se],
- 'sk' => table[:sk],
- 'sl' => table[:sl],
- 'sq' => table[:sq],
- 'sr' => table[:sr],
- 'sv' => table[:sv],
- 'ta' => table[:ta],
- 'te' => table[:te],
- 'th' => table[:th],
- 'tk' => table[:tk],
- 'tr' => table[:tr],
- 'uk' => table[:uk],
- 'ur' => table[:ur],
- 'us' => table[:en],
- 'vi' => table[:vi],
- 'zh' => table[:zh],
- 'en' => table[:en],
- 'xx' => table[:en]
- }
- end
- self
- end
- end
- class Alphabet
- def initialize(lng_code)
- @lng_code=lng_code
- end
- def hash_arrays
- @alph=case @lng_code
- when /en/ #english
- {
- u: %w[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z],
- l: %w[a b c d e f g h i j k l m n o p q r s t u v w x y z]
- }
- when /da|no|nn/ #danish, norwegian
- {
- u: %w[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Å Æ Ø],
- l: %w[a b c d e f g h i j k l m n o p q r s t u v w x y z å æ ø]
- #u: %W[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Æ Ø Å],
- #l: %w[a b c d e f g h i j k l m n o p q r s t u v w x y z æ ø å]
- }
- when /sv/ #swedish
- {
- u: %w[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Å Ä Ö],
- l: %w[a b c d e f g h i j k l m n o p q r s t u v w x y z å ä ö]
- }
- else #english default
- {
- u: %w[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z],
- l: %w[a b c d e f g h i j k l m n o p q r s t u v w x y z]
- }
- end
- end
- def hash_strings
- { u: hash_arrays[:u].join, l: hash_arrays[:l].join }
- end
- end
-end
-__END__
-Language Lists
-* po4a c:
- <http://www.debian.org/international/l10n/po/>
- Px[:lng_lst] see constants.rb
-* polyglossia xlp:
- <http://mirrors.ctan.org/macros/xetex/latex/polyglossia/polyglossia.pdf>
- missing from (:c) list:
- arabic asturian bahasai bahasam coptic divehi farsi lsorbian magyar scottish syriac usorbian
-note ISO_639-1
- <http://en.wikipedia.org/wiki/ISO_639-1>
- <http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes>
-also note ISO_639-2
- <http://en.wikipedia.org/wiki/ISO_639-2>
- <http://en.wikipedia.org/wiki/List_of_ISO_639-2_codes>
-
-Px[:lng_lst] # constants.rb
-
-module SiSU_TextTranslation
- class Language
- def initialize(md)
- @md=md
- end
- def tex_name(char)
- @lang=if char
- case char
- when 'sq' then 'albanian'
- when 'am' then 'amharic'
- #when 'ar' then 'arabic' # see polyglossia
- when 'hy' then 'armenian'
- #when '' then 'asturian' # polyglossia
- #when '' then 'bahasai' # polyglossia
- #when '' then 'bahasam' # polyglossia
- when 'eu' then 'basque'
- when 'bn' then 'bengali'
- when 'pt_BR' then 'brazilian'
- when 'br' then 'breton'
- when 'bg' then 'bulgarian'
- when 'ca' then 'catalan' # see polyglossia
- #when '' then 'coptic' # polyglossia
- when 'hr' then 'croatian'
- when 'cs' then 'czech'
- when 'da' then 'danish'
- #when '' then 'divehi' # polyglossia
- when 'nl' then 'dutch' # see polyglossia
- when 'en' then 'english' # see polyglossia
- when 'eo' then 'esperanto' # see polyglossia
- when 'et' then 'estonian'
- when 'gl' then 'galician'
- when 'de' then 'german'
- when 'el' then 'greek' #gl ?
- when 'he' then 'hebrew'
- when 'hi' then 'hindi'
- when 'is' then 'icelandic'
- when 'ia' then 'interlingua'
- when 'ga' then 'irish'
- when 'it' then 'italian'
- #when '' then 'farsi' # polyglossia
- when 'fi' then 'finnish'
- when 'fr' then 'french'
- when 'lo' then 'lao'
- when 'la' then 'latin'
- when 'lv' then 'latvian'
- when 'lt' then 'lithuanian'
- #when '' then 'lsorbian' # polyglossia
- #when '' then 'magyar' # polyglossia
- when 'ml' then 'malayalam'
- when 'mr' then 'marathi'
- #when 'hu' then 'magyar'
- when 'no' then 'norske'
- when 'nn' then 'nynorsk'
- when 'oc' then 'occitan'
- when 'pl' then 'polish'
- when 'pt' then 'portuges'
- when 'ro' then 'romanian'
- when 'ru' then 'russian'
- when 'se' then 'samin' #(check sami?)
- when 'sa' then 'sanskrit'
- when 'sr' then 'serbian'
- #when '' then 'scottish' # polyglossia (gd (Gaelic (Scots)))
- when 'sk' then 'slovak'
- when 'sl' then 'slovenian'
- when 'es' then 'spanish'
- when 'sv' then 'swedish'
- when 'ta' then 'tamil'
- when 'te' then 'telugu'
- when 'th' then 'thai'
- when 'tr' then 'turkish'
- when 'tk' then 'turkmen'
- when 'uk' then 'ukrainian'
- when 'ur' then 'urdu'
- #when '' then 'usorbian' # polyglossia
- when 'vi' then 'vietnamese'
- when 'cy' then 'welsh'
- when 'us' then 'USenglish' # depreciated, see iso-639-2
- else then 'english'
- end
- else 'english'
- end
- end
- end
-end
-#% Language List po4a
-http://www.debian.org/international/l10n/po/
-see polyglossia for subset
-* CSB (Unknown language)
-* KAB (Unknown language)
-* TLH (Unknown language)
-* aa (Afar)
-* ab (Abkhazian)
-* af (Afrikaans)
-* af_ZA (Afrikaans, as spoken in South Africa)
-* am (Amharic)
-* an (Unknown language)
-* ang (Unknown language)
-* ar (Arabic)
-* ar_AR (Arabic, as spoken in Argentina)
-* ar_EG (Arabic, as spoken in Egypt)
-* ar_OM (Arabic, as spoken in Oman)
-* ar_PS (Arabic, as spoken in Palestinian Territory, Occupied)
-* ar_SA (Arabic, as spoken in Saudi Arabia)
-* ar_SY (Arabic, as spoken in Syrian Arab Republic)
-* as (Assamese)
-* ast (Unknown language)
-* ay (Aymara)
-* az (Azerbaijani)
-* az_IR (Azerbaijani, as spoken in Iran)
-* be (Belarusian)
-* be@latin (Unknown language)
-* be@tarask (Unknown language)
-* bem (Unknown language)
-* bg (Bulgarian)
-* bg_BG (Bulgarian, as spoken in Bulgaria)
-* bi (Bislama)
-* bn (Bengali)
-* bn_BD (Bengali, as spoken in Bangladesh)
-* bn_IN (Bengali, as spoken in India)
-* bo (Tibetan)
-* br (Breton)
-* bs (Bosnian)
-* bs_BA (Bosnian, as spoken in Bosnia and Herzegovina)
-* bs_BS (Bosnian, as spoken in Bahamas)
-* byn (Unknown language)
-* ca (Catalan)
-* ca@valencia (Unknown language)
-* ca_AD (Catalan, as spoken in Andorra)
-* ca_ES (Catalan, as spoken in Spain)
-* ca_ES@valencia (Unknown language)
-* ca_FR (Catalan, as spoken in France)
-* ca_IT (Catalan, as spoken in Italy)
-* co (Corsican)
-* crh (Unknown language)
-* cs (Czech)
-* cs_CZ (Czech, as spoken in Czech Republic)
-* csb (Unknown language)
-* cy (Welsh)
-* cy_GB (Welsh, as spoken in Great Britain)
-* cz (Unknown language)
-* da (Danish)
-* da_DK (Danish, as spoken in Denmark)
-* de (German)
-* de_AT (German, as spoken in Austria)
-* de_CH (German, as spoken in Switzerland)
-* de_DE (German, as spoken in Germany)
-* dk (Unknown language)
-* dz (Dzongkha)
-* el (Greek)
-* el_GR (Greek, as spoken in Greece)
-* en (English)
-* en@boldquot (Unknown language)
-* en@quot (Unknown language)
-* en@shaw (Unknown language)
-* en_AU (English, as spoken in Australia)
-* en_CA (English, as spoken in Canada)
-* en_GB (English, as spoken in Great Britain)
-* en_NZ (English, as spoken in New Zealand)
-* en_US (English, as spoken in United States)
-* en_US@piglatin (Unknown language)
-* en_ZA (English, as spoken in South Africa)
-* eo (Esperanto)
-* es (Spanish)
-* es_AR (Spanish, as spoken in Argentina)
-* es_CL (Spanish, as spoken in Chile)
-* es_CO (Spanish, as spoken in Colombia)
-* es_CR (Spanish, as spoken in Costa Rica)
-* es_DO (Spanish, as spoken in Dominican Republic)
-* es_EC (Spanish, as spoken in Ecuador)
-* es_ES (Spanish, as spoken in Spain)
-* es_GA (Spanish, as spoken in Gabon)
-* es_GT (Spanish, as spoken in Guatemala)
-* es_HN (Spanish, as spoken in Honduras)
-* es_LA (Spanish, as spoken in Lao People''s Democratic Republic)
-* es_MX (Spanish, as spoken in Mexico)
-* es_NI (Spanish, as spoken in Nicaragua)
-* es_PA (Spanish, as spoken in Panama)
-* es_PE (Spanish, as spoken in Peru)
-* es_PR (Spanish, as spoken in Puerto Rico)
-* es_SV (Spanish, as spoken in El Salvador)
-* es_UY (Spanish, as spoken in Uruguay)
-* es_VE (Spanish, as spoken in Venezuela)
-* et (Estonian)
-* et_EE (Estonian, as spoken in Estonia)
-* eu (Basque)
-* eu_ES (Basque, as spoken in Spain)
-* fa (Persian)
-* fa_AF (Persian, as spoken in Afghanistan)
-* fa_IR (Persian, as spoken in Iran)
-* fi (Finnish)
-* fi_FI (Finnish, as spoken in Finland)
-* fil (Unknown language)
-* fo (Faeroese)
-* fo_FO (Faeroese, as spoken in Faroe Islands)
-* fr (French)
-* fr_BE (French, as spoken in Belgium)
-* fr_CA (French, as spoken in Canada)
-* fr_CH (French, as spoken in Switzerland)
-* fr_FR (French, as spoken in France)
-* fr_FX (French, as spoken in France, Metropolitan)
-* fr_LU (French, as spoken in Luxembourg)
-* frp (Unknown language)
-* fur (Unknown language)
-* fy (Frisian)
-* fy_NL (Frisian, as spoken in Netherlands)
-* ga (Irish)
-* gd (Gaelic (Scots))
-* gez (Unknown language)
-* gl (Galician)
-* gl_ES (Galician, as spoken in Spain)
-* gn (Guarani)
-* gu (Gujarati)
-* gv (Manx)
-* ha (Hausa)
-* he (Hebrew)
-* he_IL (Hebrew, as spoken in Israel)
-* hi (Hindi)
-* hne (Unknown language)
-* hr (Croatian)
-* hr_HR (Croatian, as spoken in Croatia)
-* ht (Unknown language)
-* hu (Hungarian)
-* hu_HU (Hungarian, as spoken in Hungary)
-* hy (Armenian)
-* ia (Interlingua)
-* id (Indonesian)
-* id_ID (Indonesian, as spoken in Indonesia)
-* ig (Unknown language)
-* io (Unknown language)
-* is (Icelandic)
-* is_IS (Icelandic, as spoken in Iceland)
-* it (Italian)
-* it_CH (Italian, as spoken in Switzerland)
-* it_IT (Italian, as spoken in Italy)
-* iu (Inuktitut)
-* ja (Japanese)
-* ja_JP (Japanese, as spoken in Japan)
-* jv (Unknown language)
-* jv_ID (Unknown language)
-* ka (Georgian)
-* kab (Unknown language)
-* kk (Kazakh)
-* kl (Kalaallisut)
-* km (Khmer)
-* km_KH (Khmer, as spoken in Cambodia)
-* kn (Kannada)
-* ko (Korean)
-* ko_KR (Korean, as spoken in Korea)
-* ks (Kashmiri)
-* ku (Kurdish)
-* kw (Cornish)
-* ky (Kirghiz)
-* la (Latin)
-* lb (Letzeburgesch)
-* lg (Unknown language)
-* li (Unknown language)
-* ln (Lingala)
-* lo (Lao)
-* lt (Lithuanian)
-* lt_LT (Lithuanian, as spoken in Lithuania)
-* lv (Latvian)
-* lv_LV (Latvian, as spoken in Latvia)
-* mai (Unknown language)
-* mal (Unknown language)
-* mg (Malagasy)
-* mi (Maori)
-* mk (Macedonian)
-* mk_MK (Macedonian, as spoken in Macedonia, the Former Yugoslav Republic of)
-* ml (Malayalam)
-* ml_IN (Malayalam, as spoken in India)
-* ml_ML (Malayalam, as spoken in Mali)
-* mn (Mongolian)
-* mr (Marathi)
-* ms (Malay)
-* ms_MY (Malay, as spoken in Malaysia)
-* mt (Maltese)
-* my (Burmese)
-* my_MM (Burmese, as spoken in Myanmar)
-* na (Nauru)
-* nb (Norwegian Bokmål)
-* nb_NO (Norwegian Bokmål, as spoken in Norway)
-* nds (Unknown language)
-* ne (Nepali)
-* new (Unknown language)
-* nl (Dutch)
-* nl_BE (Dutch, as spoken in Belgium)
-* nl_NL (Dutch, as spoken in Netherlands)
-* nn (Norwegian Nynorsk)
-* nn_NO (Norwegian Nynorsk, as spoken in Norway)
-* no (Norwegian)
-* no_NO (Norwegian, as spoken in Norway)
-* nr (Ndebele, South)
-* nso (Unknown language)
-* oc (Occitan (post 1500))
-* oc_FR (Occitan (post 1500), as spoken in France)
-* om (Oromo)
-* or (Oriya)
-* pa (Panjabi)
-* pl (Polish)
-* pl_PL (Polish, as spoken in Poland)
-* pms (Unknown language)
-* ps (Pushto)
-* pt (Portuguese)
-* pt_BR (Portuguese, as spoken in Brazil)
-* pt_PT (Portuguese, as spoken in Portugal)
-* qu (Quechua)
-* rm (Rhaeto-Romance)
-* ro (Romanian)
-* ro_RO (Romanian, as spoken in Romania)
-* ru (Russian)
-* ru_RU (Russian, as spoken in Russia)
-* rw (Kinyarwanda)
-* sa (Sanskrit)
-* sc (Sardinian)
-* sd (Sindhi)
-* se (Sami)
-* se_NO (Sami, as spoken in Norway)
-* si (Sinhalese)
-* si_LK (Sinhalese, as spoken in Sri Lanka)
-* si_SI (Sinhalese, as spoken in Slovenia)
-* sk (Slovak)
-* sk_SK (Slovak, as spoken in Slovakia)
-* sl (Slovenian)
-* sl_SI (Slovenian, as spoken in Slovenia)
-* sl_SL (Slovenian, as spoken in Sierra Leone)
-* so (Somali)
-* sp (Unknown language)
-* sq (Albanian)
-* sq_AL (Albanian, as spoken in Albania)
-* sr (Serbian)
-* sr@Latn (Unknown language)
-* sr@ije (Unknown language)
-* sr@ijekavian (Unknown language)
-* sr@ijekavianlatin (Unknown language)
-* sr@latin (Unknown language)
-* sr_SR (Serbian, as spoken in Suriname)
-* sr_YU (Serbian, as spoken in Yugoslavia)
-* st (Sotho)
-* su (Sundanese)
-* su_ID (Sundanese, as spoken in Indonesia)
-* sv (Swedish)
-* sv_SE (Swedish, as spoken in Sweden)
-* sw (Swahili)
-* ta (Tamil)
-* ta_LK (Tamil, as spoken in Sri Lanka)
-* te (Telugu)
-* tg (Tajik)
-* th (Thai)
-* th_TH (Thai, as spoken in Thailand)
-* ti (Tigrinya)
-* tig (Unknown language)
-* tk (Turkmen)
-* tl (Tagalog)
-* tlh (Unknown language)