summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/sisu203
l---------bin/sisu51
l---------bin/sisu61
-rw-r--r--conf/sisu/sisurc.yml163
l---------conf/sisu/v5/sisurc.yml1
l---------conf/sisu/v6/sisurc.yml1
-rw-r--r--data/doc/sisu/CHANGELOG_v518
-rw-r--r--data/doc/sisu/CHANGELOG_v69
-rw-r--r--data/doc/sisu/markup-samples/manual/_sisu/sisu_document_make2
-rw-r--r--data/doc/sisu/markup-samples/manual/_sisu/sisurc.yml148
l---------data/doc/sisu/markup-samples/manual/_sisu/v5/sisurc.yml1
l---------data/doc/sisu/markup-samples/manual/_sisu/v6/sisurc.yml1
-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/current/ao_composite.rb)2
-rw-r--r--lib/sisu/ao_doc_objects.rb (renamed from lib/sisu/develop/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/develop/ao_endnotes.rb)2
-rw-r--r--lib/sisu/ao_expand_insertions.rb (renamed from lib/sisu/develop/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/develop/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/current/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/develop/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/develop/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_doc_objects.rb565
-rw-r--r--lib/sisu/current/ao_endnotes.rb136
-rw-r--r--lib/sisu/current/ao_expand_insertions.rb514
-rw-r--r--lib/sisu/current/ao_hash_digest.rb174
-rw-r--r--lib/sisu/current/ao_idx.rb422
-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_persist.rb194
-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/conf.rb287
-rw-r--r--lib/sisu/current/db_create.rb689
-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/dbi_discrete.rb206
-rw-r--r--lib/sisu/current/dp.rb1606
-rw-r--r--lib/sisu/current/dp_make.rb668
-rw-r--r--lib/sisu/current/git.rb277
-rw-r--r--lib/sisu/current/html.rb775
-rw-r--r--lib/sisu/current/html_concordance.rb391
-rw-r--r--lib/sisu/current/html_harvest.rb109
-rw-r--r--lib/sisu/current/html_harvest_author_format.rb111
-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_minitoc.rb230
-rw-r--r--lib/sisu/current/html_parts.rb437
-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.rb277
-rw-r--r--lib/sisu/current/hub_actions.rb1122
-rw-r--r--lib/sisu/current/hub_loop_markup_files.rb170
-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/relaxng.rb1153
-rw-r--r--lib/sisu/current/remote.rb246
-rw-r--r--lib/sisu/current/se.rb158
-rw-r--r--lib/sisu/current/se_clear.rb105
-rw-r--r--lib/sisu/current/se_createsite.rb273
-rw-r--r--lib/sisu/current/se_date.rb92
-rw-r--r--lib/sisu/current/se_envcall.rb326
-rw-r--r--lib/sisu/current/se_get_init.rb258
-rw-r--r--lib/sisu/current/se_hub_particulars.rb234
-rw-r--r--lib/sisu/current/se_info_system.rb202
-rw-r--r--lib/sisu/current/se_load.rb108
-rw-r--r--lib/sisu/current/se_programs.rb394
-rw-r--r--lib/sisu/current/se_standardise_lang.rb176
-rw-r--r--lib/sisu/current/se_version.rb183
-rw-r--r--lib/sisu/current/shared_images.rb137
-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_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_sstm.rb135
-rw-r--r--lib/sisu/current/src_shared.rb347
-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_convert_markup.rb323
-rw-r--r--lib/sisu/current/sst_do_inline_footnotes.rb440
-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/wikispeak.rb375
-rw-r--r--lib/sisu/current/xhtml_epub2_format.rb2272
-rw-r--r--lib/sisu/current/xhtml_epub2_persist.rb278
-rw-r--r--lib/sisu/current/xhtml_parts.rb183
-rw-r--r--lib/sisu/current/xml_docbook5.rb376
-rw-r--r--lib/sisu/current/xml_dom.rb624
-rw-r--r--lib/sisu/current/xml_fictionbook2.rb389
-rw-r--r--lib/sisu/current/xml_md_oai_pmh_dc.rb229
-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_parts.rb191
-rw-r--r--lib/sisu/current/xml_persist.rb126
-rw-r--r--lib/sisu/current/xml_tables.rb261
-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/current/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/current/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/current/dbi.rb)2
-rw-r--r--lib/sisu/dbi_discrete.rb (renamed from lib/sisu/develop/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_composite.rb286
-rw-r--r--lib/sisu/develop/ao_doc_str.rb2269
-rw-r--r--lib/sisu/develop/ao_misc_arrange.rb207
-rw-r--r--lib/sisu/develop/ao_numbering.rb720
-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/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_drop.rb207
-rw-r--r--lib/sisu/develop/db_import.rb877
-rw-r--r--lib/sisu/develop/db_sqltxt.rb173
-rw-r--r--lib/sisu/develop/db_tests.rb114
-rw-r--r--lib/sisu/develop/dbi.rb166
-rw-r--r--lib/sisu/develop/digests.rb306
-rw-r--r--lib/sisu/develop/dp_identify_markup.rb161
-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/html_format.rb1348
-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/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/rexml.rb148
-rw-r--r--lib/sisu/develop/se_cleanoutput.rb145
-rw-r--r--lib/sisu/develop/se_css.rb221
-rw-r--r--lib/sisu/develop/se_db.rb214
-rw-r--r--lib/sisu/develop/se_file_op.rb2758
-rw-r--r--lib/sisu/develop/se_filemap.rb247
-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_processing.rb659
-rw-r--r--lib/sisu/develop/se_remotes.rb553
-rw-r--r--lib/sisu/develop/shared_markup_alt.rb336
-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_po4a_share.rb309
-rw-r--r--lib/sisu/develop/src_po4a_sst_ao_sst_set.rb284
-rw-r--r--lib/sisu/develop/sst_from_xml.rb178
-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/webrick.rb191
-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_concordance.rb322
-rw-r--r--lib/sisu/develop/xhtml_epub2_segments.rb599
-rw-r--r--lib/sisu/develop/xhtml_epub2_tune.rb330
-rw-r--r--lib/sisu/develop/xhtml_shared.rb62
-rw-r--r--lib/sisu/develop/xhtml_table.rb97
-rw-r--r--lib/sisu/develop/xml_format.rb865
-rw-r--r--lib/sisu/develop/xml_sax.rb521
-rw-r--r--lib/sisu/develop/xml_scaffold_structure_collapsed.rb198
-rw-r--r--lib/sisu/develop/xml_scaffold_structure_sisu.rb201
-rw-r--r--lib/sisu/develop/xml_shared.rb665
-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/current/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/develop/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/develop/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/develop/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/develop/html_minitoc.rb)2
-rw-r--r--lib/sisu/html_parts.rb (renamed from lib/sisu/develop/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/develop/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/develop/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/develop/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/current/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/develop/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/current/se_db.rb)2
-rw-r--r--lib/sisu/se_envcall.rb (renamed from lib/sisu/develop/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/current/se_filemap.rb)2
-rw-r--r--lib/sisu/se_get_init.rb (renamed from lib/sisu/develop/se_get_init.rb)38
-rw-r--r--lib/sisu/se_hub_particulars.rb (renamed from lib/sisu/develop/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/develop/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/develop/se_standardise_lang.rb)2
-rw-r--r--lib/sisu/se_version.rb (renamed from lib/sisu/develop/se_version.rb)17
-rw-r--r--lib/sisu/shared_images.rb (renamed from lib/sisu/develop/shared_images.rb)2
-rw-r--r--lib/sisu/shared_markup_alt.rb (renamed from lib/sisu/current/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/current/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/current/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/develop/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/develop/sst_convert_markup.rb)2
-rw-r--r--lib/sisu/sst_do_inline_footnotes.rb (renamed from lib/sisu/develop/sst_do_inline_footnotes.rb)2
-rw-r--r--lib/sisu/sst_from_xml.rb (renamed from lib/sisu/current/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/current/webrick.rb)2
-rw-r--r--lib/sisu/wikispeak.rb (renamed from lib/sisu/develop/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/current/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/develop/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/current/xhtml_epub2_tune.rb)2
-rw-r--r--lib/sisu/xhtml_parts.rb (renamed from lib/sisu/develop/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/current/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/develop/xml_dom.rb)2
-rw-r--r--lib/sisu/xml_fictionbook2.rb (renamed from lib/sisu/develop/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/develop/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/develop/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/current/xml_scaffold_structure_collapsed.rb)2
-rw-r--r--lib/sisu/xml_scaffold_structure_sisu.rb (renamed from lib/sisu/current/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/develop/xml_tables.rb)2
-rw-r--r--lib/sisu/zap.rb (renamed from lib/sisu/develop/zap.rb)2
l---------man/man1/sisu5.11
l---------man/man1/sisu6.11
-rwxr-xr-xqi81
-rw-r--r--setup/qi_libs.rb243
-rw-r--r--setup/qi_libs_base.rb31
-rw-r--r--setup/rbuild80
-rw-r--r--setup/rbuild_libs.rb145
365 files changed, 787 insertions, 80098 deletions
diff --git a/bin/sisu b/bin/sisu
index f7c36bb..6b18e59 100755
--- a/bin/sisu
+++ b/bin/sisu
@@ -8,23 +8,8 @@ class Orient
super()
@called_as,@argv=$0,$*
end
- def version
- def stable
- '5'
- end
- def unstable
- '6'
- end
- def default
- unstable
- end
- def current
- 'current'
- end
- def next
- 'next'
- end
- self
+ def version_major
+ '7'
end
def sisu_called_from_directory
@@sisu_called_from_directory ||= Dir.pwd
@@ -35,7 +20,7 @@ class Orient
:full_path_to_sisu_bin_in_sisu_dir_tree
elsif processing.sisu_runtime_path =~/\/gems\// \
and processing.sisu_runtime_path \
- =~ /\/sisu-[#{version.stable}#{version.unstable}]\.(?:\d+|[a-z])\.(?:\d+|[a-z])\//
+ =~ /\/sisu-(?:\d+|[a-z])\.(?:\d+|[a-z])\.(?:\d+|[a-z])\//
:gem_install
else
:system_install
@@ -54,112 +39,34 @@ class Orient
def sisu_runtime_path
__FILE__
end
- def stable
- 'v' + version.stable
- end
- def unstable
- 'v' + version.unstable
- end
- def default
- 'v' + version.default
- end
- def current
- 'current'
- end
- def next
- 'develop'
- end
- def stable_bin_file_regex
- %r{\bsisu#{version.stable}$}
+ def bin_file_regex
+ %r{\bsisu$}
end
- def unstable_bin_file_regex
- %r{\bsisu#{version.unstable}$}
- end
- def stable_gem_regex
- %r{\/sisu-#{version.stable}\.(?:\d+|[a-z])\.(?:\d+|[a-z])\/}
- end
- def unstable_gem_regex
- %r{\/sisu-#{version.unstable}\.(?:\d+|[a-z])\.(?:\d+|[a-z])\/}
- end
- def stable_modifier_regex
- %r{"(?:--v#{version.stable}|--current|--stable|--release)"}
- end
- def unstable_modifier_regex
- %r{"(?:--v#{version.unstable}|--next|--unstable|--dev)"}
+ def gem_regex
+ %r{\/sisu-(?:\d+|[a-z])\.(?:\d+|[a-z])\.(?:\d+|[a-z])\/}
end
self
end
def sisu_lib
- "sisu/#{branch_name_}"
- end
- def sisu_path_lib
- if sisu_path_specified_lib \
- && FileTest.file?("#{sisu_path_specified_lib}/#{sisu_lib}/hub.rb")
- "#{sisu_path_specified_lib}/#{sisu_lib}"
- else sisu_lib
- end
+ 'sisu'
end
def sisu_version_info_path
- "#{sisu_path_base_system_data}/version/#{branch_name?}.yml"
- end
- def branch_name_
- if sisu_run_from? == :full_path_to_sisu_bin_in_sisu_dir_tree \
- or sisu_run_from? == :system_install
- case processing.called_as
- when processing.stable_bin_file_regex then processing.current
- when processing.unstable_bin_file_regex then processing.next
- else
- case processing.argv_str
- when processing.stable_modifier_regex then processing.current
- when processing.unstable_modifier_regex then processing.next
- else processing.current
- end
- end
- elsif sisu_run_from? == :gem_install
- case processing.sisu_runtime_path
- when processing.stable_gem_regex then processing.current
- when processing.unstable_gem_regex then processing.next
- else processing.current
- end
- else processing.current
- end
- end
- def branch_version_
- if sisu_run_from? == :full_path_to_sisu_bin_in_sisu_dir_tree \
- or sisu_run_from? == :system_install
- case processing.called_as
- when processing.stable_bin_file_regex then processing.stable
- when processing.unstable_bin_file_regex then processing.unstable
- else
- case processing.argv_str
- when processing.stable_modifier_regex then processing.stable
- when processing.unstable_modifier_regex then processing.unstable
- else processing.stable
- end
- end
- elsif sisu_run_from? == :gem_install
- case processing.sisu_runtime_path
- when processing.stable_gem_regex then processing.stable
- when processing.unstable_gem_regex then processing.unstable
- else processing.stable
- end
- else processing.stable
- end
+ "#{sisu_path_base_system_data}/version.yml"
end
def paths_set
if sisu_run_from? == :system_install \
and processing.called_as \
- =~ /^#{RbConfig::CONFIG['bindir']}\/sisu[#{version.stable}#{version.unstable}]?$/
+ =~ /^#{RbConfig::CONFIG['bindir']}\/sisu$/
:set_path_system
elsif sisu_run_from? == :full_path_to_sisu_bin_in_sisu_dir_tree \
and processing.called_as \
- !~ /^#{RbConfig::CONFIG['bindir']}\/sisu[#{version.stable}#{version.unstable}]?$/ \
+ !~ /^#{RbConfig::CONFIG['bindir']}\/sisu$/ \
&& File.expand_path(processing.called_as) \
- =~ /bin\/sisu[#{version.stable}#{version.unstable}]?$/ \
+ =~ /bin\/sisu$/ \
&& FileTest.file?(processing.called_as)
:set_dir_tree_full_path
elsif sisu_run_from? ==:gem_install
- :set_gem_path
+ :set_path_gem
else nil
end
end
@@ -188,8 +95,8 @@ class Orient
RbConfig::CONFIG['datadir'] + '/sisu'
when :set_dir_tree_full_path
File.expand_path(processing.called_as).
- sub(/\/bin\/sisu[#{version.stable}#{version.unstable}]?$/,'')
- when :set_gem_path
+ sub(/\/bin\/sisu$/,'')
+ when :set_path_gem
Gem::Specification.find_by_name("sisu").gem_dir
else nil
end
@@ -200,18 +107,44 @@ class Orient
RbConfig::CONFIG['datadir'] + '/sisu'
when :set_dir_tree_full_path
File.expand_path(processing.called_as).
- sub(/\/bin\/sisu[#{version.stable}#{version.unstable}]?$/,'/data/sisu')
- when :set_gem_path
+ sub(/\/bin\/sisu$/,'/data/sisu')
+ when :set_path_gem
Gem::Specification.find_by_name("sisu").gem_dir + '/data/sisu'
else nil
end
end
- def sisu_path_specified_lib
+ def sisu_this_lib
+ if processing.sisu_runtime_path =~/\/gems\// \
+ and processing.sisu_runtime_path \
+ =~ /\/sisu-(?:\d+|[a-z])\.(?:\d+|[a-z])\.(?:\d+|[a-z])\//
+ # gem sought
+ processing.sisu_runtime_path.
+ gsub(/\/bin\/sisu[a-z0-7_-]*$/,'/lib/sisu')
+ elsif (processing.called_as \
+ !~ /^#{RbConfig::CONFIG['bindir']}\/sisu$/)
+ # called off file system, project directory tree
+ File.expand_path(processing.called_as).
+ sub(/bin\/sisu\S*/,'lib/sisu')
+ else
+ # distro installation
+ sisulib={
+ vendorlib: RbConfig::CONFIG['vendordir'] + '/sisu',
+ sitelib: RbConfig::CONFIG['sitelibdir'] + '/sisu',
+ }
+ if FileTest.directory?(sisulib[:sitelib]) # Arch Linux; Debian local
+ sisulib[:sitelib]
+ elsif FileTest.directory?(sisulib[:vendorlib]) # Debian GNU Linux system
+ sisulib[:vendorlib]
+ else 'sisu' # assume lib paths work
+ end
+ end
+ end
+ def sisu_this_lib_
if (processing.called_as \
- !~ /^#{RbConfig::CONFIG['bindir']}\/sisu[#{version.stable}#{version.unstable}]?$/)
+ !~ /^#{RbConfig::CONFIG['bindir']}\/sisu$/)
File.expand_path(processing.called_as).
- sub(/bin\/sisu[#{version.stable}#{version.unstable}]?$/,'lib')
- else nil
+ sub(/bin\/sisu\S*/,'lib/sisu')
+ else 'sisu'
end
end
def language_list
@@ -224,8 +157,11 @@ class Orient
self
end
def sisu_is
+ def version_major?
+ version_major
+ end
def runtime_path?
- sisu_runtime_path
+ processing.sisu_runtime_path
end
def runtime_type?
sisu_run_from?
@@ -233,21 +169,12 @@ class Orient
def called_from?
sisu_called_from_directory
end
- def branch_name?
- branch_name_
- end
- def branch_version?
- branch_version_
- end
def path_base?
sisu_path_base
end
def path_base_system_data?
sisu_path_base_system_data
end
- def path_lib?
- sisu_path_lib
- end
def version_info_path?
sisu_version_info_path
end
@@ -309,7 +236,7 @@ class Orient
self
end
def control
- require "#{sisu_is.path_lib?}/hub"
+ require sisu_this_lib
sisu_called_from_directory
begin
if get_processing_info.processing_files.length > 0
@@ -322,7 +249,7 @@ class Orient
Dir.chdir(markup_dir)
$sisu_document_markup_directory_base_fixed_path=
Dir.pwd.gsub(/\/(?:#{language_list.regex})$/,'')
- SiSU::HubMaster.new(argv_sub,sisu_is.runtime?)
+ SiSU_libs::CallHubMaster.new(argv_sub,sisu_is.runtime?)
elsif markup_dir =~/https?:/
markup_file.each do |mf|
(FileTest.file?(mf)) \
@@ -333,7 +260,7 @@ class Orient
$sisu_document_markup_directory_base_fixed_path=
Dir.pwd.gsub(/\/(?:#{language_list.regex})$/,'')
argv_sub=command_line_modifiers + markup_file
- SiSU::HubMaster.new(argv_sub,sisu_is.runtime?)
+ SiSU_libs::CallHubMaster.new(argv_sub,sisu_is.runtime?)
else p "Error directory specified #{markup_dir} not found"
end
ensure
@@ -345,11 +272,11 @@ class Orient
$sisu_document_markup_directory=Dir.pwd.gsub(/\/$/,'')
$sisu_document_markup_directory_base_fixed_path=
Dir.pwd.gsub(/(^|\/)(?:#{language_list.regex})$/,'')
- SiSU::HubMaster.new(processing.argv,sisu_is.runtime?)
+ SiSU_libs::CallHubMaster.new(processing.argv,sisu_is.runtime?)
end
rescue
ensure
- SiSU::HubClose.new(sisu_called_from_directory,@argv)
+ SiSU_libs::HubClose.new(@argv,sisu_called_from_directory)
Dir.chdir(sisu_called_from_directory)
system("cd #{sisu_called_from_directory}")
end
@@ -358,7 +285,6 @@ end
#% sisu select source & branch, begin
$VERBOSE=nil
require 'rbconfig'
-require 'rubygems'
begin
require 'singleton'
s=Orient.instance
@@ -369,14 +295,15 @@ rescue #% -
STDERR.puts $!
STDERR.puts $@
puts %{
- #{%x{ruby -v}.strip.to_s}
- #{RUBY_VERSION}
- ruby version: #{RbConfig::CONFIG['RUBY_PROGRAM_VERSION']}p#{RbConfig::CONFIG['PATCHLEVEL']}
- ruby named: #{RbConfig::CONFIG['ruby_version']}
- rubylib: #{RbConfig::CONFIG['rubylibdir']}
- rubylib local: #{RbConfig::CONFIG['sitelibdir']}
- gem dir: #{Gem.dir}
- gem path: #{Gem.path}
+ #{%x{ruby -v}.strip.to_s}
+ #{RUBY_VERSION}
+ ruby version: #{RbConfig::CONFIG['RUBY_PROGRAM_VERSION']}p#{RbConfig::CONFIG['PATCHLEVEL']}
+ ruby named: #{RbConfig::CONFIG['ruby_version']}
+ rubylib: #{RbConfig::CONFIG['rubylibdir']}
+ vendor lib #{RbConfig::CONFIG['vendordir']}
+ site lib local: #{RbConfig::CONFIG['sitelibdir']}
+ gem dir: #{Gem.dir}
+ gem path: #{Gem.path}
}
system(%{echo "
system RUBYPATH: ${RUBYPATH}
diff --git a/bin/sisu5 b/bin/sisu5
deleted file mode 120000
index b4999d5..0000000
--- a/bin/sisu5
+++ /dev/null
@@ -1 +0,0 @@
-sisu \ No newline at end of file
diff --git a/bin/sisu6 b/bin/sisu6
deleted file mode 120000
index b4999d5..0000000
--- a/bin/sisu6
+++ /dev/null
@@ -1 +0,0 @@
-sisu \ No newline at end of file
diff --git a/conf/sisu/sisurc.yml b/conf/sisu/sisurc.yml
new file mode 100644
index 0000000..790eb31
--- /dev/null
+++ b/conf/sisu/sisurc.yml
@@ -0,0 +1,163 @@
+# Name: SiSU
+# Author: ralph@amissah.com
+# Description: Site wide environment defaults set here
+# system environment info / resource configuration file, for sisu
+# License: GPL v3 or later
+# site environment configuration file
+# this file should be configured and live in
+# /etc/sisu #per environment settings, overridden by:
+# ~/.sisu #per user settings, overridden by:
+# ./_sisu #per local markup directory settings
+#% #image source directory, main path and subdirectories
+#image:
+# path: 'sisu_working'
+# public: '_sisu/image'
+# #all: 'image'
+#% presentation/web directory, main path and subdirectories (most subdirectories are created automatically based on markup directory name)
+#webserv:
+# url_root: 'http://www.your.url' #without dir stub
+# path: '/var/www' #either (i) / [full path from root] or (ii) ~/ [home] or (iii) ./ [pwd] or (iv) will be made from home
+# images: '_sisu/image'
+# man: 'man'
+# cgi: '/usr/lib/cgi-bin'
+# feed: 'feed'
+# sqlite: 'sisu/sqlite'
+# webrick_url: true
+#show_output_on: 'filesystem' #for -v and -u url information, alternatives: 'filesystem','webserver','remote_webserver','local:8111','localhost','localhost:8080','webrick','path'
+#show_output_on: 'local:8111'
+#webserv_cgi:
+# host: localhost
+# base_path: ~
+# port: '8081'
+# user: ~
+
+show_output_on: 'filesystem_url'
+#texinfo display output
+#texinfo:
+# stub: 'texinfo'
+
+#% output_dir_structure_by:
+# language (language and filetype directories);
+# filetype (filetype directories, language code added to filename includes language code);
+# filetype_mono or monolingual (filetype drectories, no language codes in filenames)
+# filename (directory output similar to original v1 v2, filename includes language code);
+# filename_mono (directory output similar to original v1 v2, filename without language code);
+output_dir_structure_by: language # language filetype filetype_mono filename filename_mono
+
+##% processing directories, main path and subdirectories (appended to $HOME), using defaults set in sysenv
+#processing:
+# path: '~'
+# dir: '.sisu_processing~'
+# metaverse: 'metaverse'
+# tune: 'tune'
+# latex: 'tex'
+# texinfo: 'texinfo'
+# concord_max: 400000
+
+#% flag - set (non-default) processing flag shortcuts -1, -2 etc. (here adding colour and verbosity as default)
+flag:
+ color: true # making colour default -c is toggle, and will now toggle colour off
+# act0: '--manifest --digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --sqlite --verbose'
+# act1: '--manifest --text --html'
+# act2: '--manifest --text --html --epub --pdf'
+# act3: '--manifest --qrcode --text --html --epub --concordance --pdf'
+# act4: '--manifest --digest --qrcode --text --html --epub --concordance --pdf --odf --docbook'
+# act5: '--manifest --digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --sqlite'
+# act6: '--manifest --digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --sqlite'
+# act7: '--manifest --digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --sqlite --source --sisupod'
+# act8: '--manifest --digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --pg --update'
+# act9: '--manifest --digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --pg --update --source --sisupod'
+## default: '--digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --sqlite --manifest --verbose'
+## i: '--digest --qrcode --text --html --epub --concordance --pdf --manifest'
+## ii: '--digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --manifest'
+## iii: '--digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --sqlite --manifest'
+## iv: '--digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --pg --update --manifest'
+## v: '--digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --sqlite --source --sisupod --manifest'
+
+#% papersize, (LaTeX/pdf) available values: A4, US_letter, book_b5, book_a5, US_legal
+default:
+ papersize: 'a4,letter' #'a4,letter,b5,a5,legal'
+ #language: 'en'
+ #texpdf_font: 'Liberation Sans' # 'Liberation Sans' 'Liberation Serif'
+ #texpdf_font_mono: 'Liberation Mono' #'Inconsolata'
+ #text_wrap: 78
+ #emphasis: 'bold' #make *{emphasis}* 'bold', 'italics' or 'underscore', default if not configured is 'bold'
+ #digest: 'sha' #sha is sha256, default is md5
+ #multilingual: false
+ #language_file: 2
+#% markup, make *{emphasis}* 'bold' or 'italics', default if not configured is 'bold'
+
+#% settings used by ssh scp
+#remote:
+# -
+# user: '[usrname]'
+# host: '[remote.hostname]'
+# path: '.' #no trailing slash eg 'sisu/www'
+# -
+# user: '[usrname]'
+# host: '[remote.hostname]'
+# path: '.' #no trailing slash eg 'sisu/www'
+
+#% webrick information
+#webrick:
+# port: '8081'
+
+#% sql database info, postgresql and sqlite
+#db:
+# share_source: false # boolean, default is false
+# postgresql:
+# port: # '[port (default is 5432)]'
+# host: # '[if not localhost, provide host tcp/ip address or domain name]''
+# user: # '[(if different from user) provide username]'
+# password: # '[password if required]'
+# sqlite:
+# path: ~ # './sisu_sqlite.db'
+# port: "**"
+
+#html:
+# quick_ref: true #default false
+# seg_title_banner: true #default false
+#odt:
+# ocn: true
+#plaintext:
+# ocn: true
+
+permission_set:
+ zap: true
+ css_modify: true
+# remote_base_site: true
+
+program_set:
+ rmagick: false
+# wc: true
+# editor: true
+# postgresql: true
+# sqlite: true
+# tidy: true
+# rexml: true
+# pdflatex: true
+
+#program_select:
+# editor: 'vim' #'gvim -c :R'
+# pdf_viewer: 'evince'
+# web_browser: 'iceweasel'
+# console_web_browser: 'w3m' #'links2' #'elinks' #'w3m' #'lynx' #'links'
+# odf_viewer: 'lowriter' #'oowriter' #'abiword'
+# xml_viewer: 'xml-viewer'
+# epub_viewer: 'ebook-viewer' #'calibre' #'fbreader' #'okular'
+# info_viewer: 'pinfo -f'
+# man: 'man' #'groff -man -Tascii' # 'nroff -man'
+
+#search:
+# sisu:
+# flag: true
+# action: http://www.sisudoc.org/cgi-bin/sisu_v6c_sqlite.cgi
+# action: http://localhost:8081/cgi-bin/sisu_pgsql.cgi
+# action: http://192.168.1.108/cgi-bin/sisu_pgsql.cgi
+# action: http://search.sisudoc.org
+# db: sisu
+# title: sample search form
+
+#promo: sisu_search_libre, sisu_icon, sisu, open_society, fsf, ruby
+
+#omit: minitoc
diff --git a/conf/sisu/v5/sisurc.yml b/conf/sisu/v5/sisurc.yml
deleted file mode 120000
index 53d8590..0000000
--- a/conf/sisu/v5/sisurc.yml
+++ /dev/null
@@ -1 +0,0 @@
-../rc/sisurc_default.yml \ No newline at end of file
diff --git a/conf/sisu/v6/sisurc.yml b/conf/sisu/v6/sisurc.yml
deleted file mode 120000
index 53d8590..0000000
--- a/conf/sisu/v6/sisurc.yml
+++ /dev/null
@@ -1 +0,0 @@
-../rc/sisurc_default.yml \ No newline at end of file
diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5
index af735e3..a6d552b 100644
--- a/data/doc/sisu/CHANGELOG_v5
+++ b/data/doc/sisu/CHANGELOG_v5
@@ -5,20 +5,8 @@ SiSU CHANGELOG -*- mode: org; -*-
* debian/changelog
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob_plain;f=debian/changelog;hb=refs/heads/debian/sid>
-v5 stable branch (v6 development branch)
- markup rule change, document structure rule introduced:
- [v5 branch to become stable shortly, posted with 5.2.3, 2014-01-20]
- * single document root == document title == heading level A~
- * adds possible level D~
- (from 5.2 on (earlier v5 development branch insulated from v4))
-v4 stable branch supersedes & replaces v3 branch
- [v4 branch closure imminent, v5 to become stable, posted with 4.2.20,
- 2014-01-20]
- initial goals:
- * remove/retire "skins"; replace some functionality with headers and/or yml
- file (consider header like syntax for document and site appearance info)
- * bin/sisu $0 make possible to run sisu command on/within project dir tree
- * bin/sisu $*, hub, make possible to specify dir path for markup files
+v5 branch is removed; it is available in sisu < 5.9.0
+v4 branch is removed; it is available in sisu < 5.3.0
v3 branch is removed; it is available in sisu < 4.1.0
v2 branch is removed; it is available in sisu =< 3.3.2
@@ -32,7 +20,7 @@ v2 branch is removed; it is available in sisu =< 3.3.2
* Reverse Chronological:
---- HEAD ---
+--- HEAD --- [closed]
** 5.9.0.orig.tar.xz (2015-04-21:16/2)
http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/sisu_5.9.0
diff --git a/data/doc/sisu/CHANGELOG_v6 b/data/doc/sisu/CHANGELOG_v6
index e260b31..3b167c7 100644
--- a/data/doc/sisu/CHANGELOG_v6
+++ b/data/doc/sisu/CHANGELOG_v6
@@ -5,10 +5,9 @@ SiSU CHANGELOG -*- mode: org; -*-
* debian/changelog
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob_plain;f=debian/changelog;hb=refs/heads/debian/sid>
-v6 branch for development and testing prior to roll-into v5, to provide v5 with
- some insulation
-v5 stable branch
-v4 branch is removed; it is available in sisu < 4.2.20
+v6 branch is removed; it is available in sisu =< 6.5.0
+v5 branch is removed; it is available in sisu < 5.9.0
+v4 branch is removed; it is available in sisu < 5.3.0
v3 branch is removed; it is available in sisu < 4.1.0
v2 branch is removed; it is available in sisu =< 3.3.2
@@ -22,7 +21,7 @@ v2 branch is removed; it is available in sisu =< 3.3.2
* Reverse Chronological:
---- HEAD ---
+--- HEAD --- [closed]
** 6.5.0.orig.tar.xz (2015-04-21:16/2)
http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/sisu_6.4.1
diff --git a/data/doc/sisu/markup-samples/manual/_sisu/sisu_document_make b/data/doc/sisu/markup-samples/manual/_sisu/sisu_document_make
index 5ffd7d1..080786e 100644
--- a/data/doc/sisu/markup-samples/manual/_sisu/sisu_document_make
+++ b/data/doc/sisu/markup-samples/manual/_sisu/sisu_document_make
@@ -3,7 +3,7 @@
:breaks: new=C; break=1
:bold: /Debian|Ruby|SiSU/
:italics: /Linux|GPL|GPLv3|LaTeX|PostgreSQL|SQLite|SQL|Vim|ascii|plaintext|UTF-?8|HTML|XHTML|XML|EPUB|OpenDocument|ODF|ODT|PDF|pgSQL|TeXinfo|YAML|YML|OCN|object citation system|object citation numbering|granular search|Dublin Core/
- :substitute: /${sisu_stable}/,'5.6.2' /${sisu_dev}/,'6.2.3' /${debian_stable}/,'*{Wheezy}*' /${debian_testing}/,'*{Jessie}*'
+ :substitute: /${sisu_stable}/,'7.0.0' /${sisu_dev}/,'7.0.0' /${debian_stable}/,'*{Jessie}*' /${debian_testing}/,'*{Stretch}*'
:home_button_text: {SiSU}http://sisudoc.org; {git}http://git.sisudoc.org
:footer: {SiSU}http://sisudoc.org; {git}http://git.sisudoc.org
diff --git a/data/doc/sisu/markup-samples/manual/_sisu/sisurc.yml b/data/doc/sisu/markup-samples/manual/_sisu/sisurc.yml
new file mode 100644
index 0000000..3cb4989
--- /dev/null
+++ b/data/doc/sisu/markup-samples/manual/_sisu/sisurc.yml
@@ -0,0 +1,148 @@
+# Name: SiSU - Simple information Structuring Universe
+# Author: ralph@amissah.com
+# Description: Site wide environment defaults set here
+# system environment info / resource configuration file, for sisu
+# License: GPL v3 or later
+# site environment configuration file
+# this file should be configured and live in
+# /etc/sisu #per environment settings, overridden by:
+# ~/.sisu #per user settings, overridden by:
+# ./_sisu #per local markup directory settings
+#% #image source directory, main path and subdirectories
+#image:
+# path: 'sisu_working'
+# public: '_sisu/image'
+# #all: 'image'
+#% presentation/web directory, main path and subdirectories (most subdirectories are created automatically based on markup directory name)
+#webserv:
+# url_root: 'http://www.your.url' #url to document root, without dir stub
+# path: '/srv/www' #'/var/www' '/srv/www.sisudoc.org/web' #either (i) / [full path from root] or (ii) ~/ [home] or (iii) ./ [pwd] or (iv) will be made from home
+# url_root: 'http://www.sisudoc.org' #without dir stub, e.g. this dir would map to http://www.sisudoc.org/samples
+# images: '_sisu/image'
+# man: 'man'
+# cgi: '/usr/local/lib/sisu-cgi'
+# feed: 'feed'
+# sqlite: 'sisu/sqlite'
+# webrick_url: true
+#show_output_on: 'filesystem' #for -v and -u url information, alternatives: 'filesystem','webserver','remote_webserver','local:8111','localhost','localhost:8080','webrick','path'
+#show_output_on: 'local:8111'
+#webserv_cgi:
+# host: localhost
+# base_path: ~
+# port: '8081'
+# user: ~
+# file_links: www.sisudoc.org
+
+#show_output_on: 'filesystem_url'
+#texinfo display output
+#texinfo:
+# stub: 'texinfo'
+
+#% output_dir_structure_by:
+# language (language and filetype directories);
+# filetype (filetype directories, language code added to filename includes language code);
+# filetype_mono or monolingual (filetype drectories, no language codes in filenames)
+# filename (directory output similar to original v1 v2, filename includes language code);
+# filename_mono (directory output similar to original v1 v2, filename without language code);
+output_dir_structure_by: language # language filetype filetype_mono filename filename_mono
+#% language_default: lng_lst: %w[am bg bn br ca cs cy da de el en eo es et eu fi fr ga gl he hi hr hy ia is it ja ko la lo lt lv ml mr nl nn no oc pl pt pt_BR ro ru sa se sk sl sq sr sv ta te th tk tr uk ur us vi zh] ('en' default)
+#language_default: 'en'
+
+##% processing directories, main path and subdirectories (appended to $HOME), using defaults set in sysenv
+#processing:
+# path: 'sisu_processing'
+# metaverse: 'metaverse'
+# tune: 'tune'
+# latex: 'tex'
+# texinfo: 'texinfo'
+# concord_max: 400000
+
+#% flag - set (non-default) processing flag shortcuts -1, -2 etc. (here adding colour and verbosity as default)
+flag:
+ color: true # making colour default -c is toggle, and will now toggle colour off
+# act0: '--manifest --digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --sqlite --verbose'
+# act1: '--manifest --text --html'
+# act2: '--manifest --text --html --epub --pdf'
+# act3: '--manifest --qrcode --text --html --epub --concordance --pdf'
+# act4: '--manifest --digest --qrcode --text --html --epub --concordance --pdf --odf --docbook'
+# act5: '--manifest --digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --sqlite'
+# act6: '--manifest --digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --sqlite'
+# act7: '--manifest --digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --sqlite --source --sisupod'
+# act8: '--manifest --digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --pg --update'
+# act9: '--manifest --digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --pg --update --source --sisupod'
+
+#% papersize, (LaTeX/pdf) available values: A4, US_letter, book_b5, book_a5, US_legal
+default:
+ papersize: 'a4,letter' #'a4,letter,b5,a5,legal'
+ #language: 'en'
+ #texpdf_font: 'Liberation Sans' # 'Liberation Sans' 'Liberation Serif'
+ #texpdf_font_mono: 'Liberation Mono' #'Inconsolata'
+ #text_wrap: 78
+ #emphasis: 'bold' #make *{emphasis}* 'bold', 'italics' or 'underscore', default if not configured is 'bold'
+ #digest: 'sha' #sha is sha256, default is md5
+ #language: 'English'
+ #emphasis: 'italics'
+
+#% settings used by ssh scp
+#remote:
+# -
+# user: '[usrname]'
+# host: '[remote.hostname]'
+# path: '.' #no trailing slash eg 'sisu/www'
+# -
+# user: '[usrname]'
+# host: '[remote.hostname]'
+# path: '.' #no trailing slash eg 'sisu/www'
+
+#% webrick information
+#webrick:
+# port: '8081'
+
+#sql database info, postgresql and sqlite
+db:
+ postgresql:
+ port: '5432' # '5432'
+ #host: # '[if not localhost, provide host tcp/ip address or domain name]''
+ #user: # '[(if different from user) provide username]'
+ #password: # '[password if required]'
+# sqlite:
+# path: ~ # './sisu_sqlite.db'
+# port: "**"
+
+permission_set:
+ zap: true
+ css_modify: true
+ remote_base_site: true
+
+program_set:
+ rmagick: true
+# wc: true
+# editor: true
+# postgresql: true
+# sqlite: true
+# tidy: true
+# rexml: true
+# pdflatex: true
+
+#program_select:
+# editor: 'vim' #'gvim -c :R'
+# pdf_viewer: 'evince'
+# web_browser: 'iceweasel'
+# console_web_browser: 'w3m' #'links2' #'elinks' #'w3m' #'lynx' #'links'
+# odf_viewer: 'lowriter' #'oowriter' #'abiword'
+# xml_viewer: 'xml-viewer'
+# epub_viewer: 'ebook-viewer' #'calibre' #'fbreader' #'okular'
+# info_viewer: 'pinfo -f'
+# man: 'man' #'groff -man -Tascii' # 'nroff -man'
+
+#search:
+# sisu:
+# flag: true
+# action: http://www.sisudoc.org/cgi-bin/sisu_v6c_sqlite.cgi
+# action: http://search.sisudoc.org
+# db: manual
+# title: 'SiSU search form (sample)'
+
+#promo: sisu_search_libre, sisu_icon, sisu, open_society, fsf, ruby
+
+#omit: minitoc
diff --git a/data/doc/sisu/markup-samples/manual/_sisu/v5/sisurc.yml b/data/doc/sisu/markup-samples/manual/_sisu/v5/sisurc.yml
deleted file mode 120000
index 53d8590..0000000
--- a/data/doc/sisu/markup-samples/manual/_sisu/v5/sisurc.yml
+++ /dev/null
@@ -1 +0,0 @@
-../rc/sisurc_default.yml \ No newline at end of file
diff --git a/data/doc/sisu/markup-samples/manual/_sisu/v6/sisurc.yml b/data/doc/sisu/markup-samples/manual/_sisu/v6/sisurc.yml
deleted file mode 120000
index 53d8590..0000000
--- a/data/doc/sisu/markup-samples/manual/_sisu/v6/sisurc.yml
+++ /dev/null
@@ -1 +0,0 @@
-../rc/sisurc_default.yml \ No newline at end of file
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/current/ao_composite.rb b/lib/sisu/ao_composite.rb
index 24683cb..d110e52 100644
--- a/lib/sisu/current/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/current/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/develop/ao_doc_objects.rb b/lib/sisu/ao_doc_objects.rb
index 5a59af7..6cb824e 100644
--- a/lib/sisu/develop/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/develop/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/develop/ao_endnotes.rb b/lib/sisu/ao_endnotes.rb
index c523345..bcb09e1 100644
--- a/lib/sisu/develop/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/develop/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/develop/ao_expand_insertions.rb b/lib/sisu/ao_expand_insertions.rb
index 897cb7e..2d93f93 100644
--- a/lib/sisu/develop/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/develop/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/develop/ao_idx.rb b/lib/sisu/ao_idx.rb
index cbe3f00..494b939 100644
--- a/lib/sisu/develop/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/develop/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/current/ao_misc_arrange.rb b/lib/sisu/ao_misc_arrange.rb
index d023c44..da54bb8 100644
--- a/lib/sisu/current/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/current/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/develop/ao_persist.rb b/lib/sisu/ao_persist.rb
index 51ff6e0..6111cc4 100644
--- a/lib/sisu/develop/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/develop/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/develop/conf.rb b/lib/sisu/conf.rb
index 9036489..009dd71 100644
--- a/lib/sisu/develop/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/develop/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_doc_objects.rb b/lib/sisu/current/ao_doc_objects.rb
deleted file mode 100644
index a4b2fa8..0000000
--- a/lib/sisu/current/ao_doc_objects.rb
+++ /dev/null
@@ -1,565 +0,0 @@
-# encoding: utf-8
-=begin
-
-* Name: SiSU
-
-** Description: documents, structuring, processing, publishing, search
-*** document abstraction
-
-** Author: Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
-** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
- All Rights Reserved.
-
-** License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
-** SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
-** Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
-** Git
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/ao_doc_objects.rb;hb=HEAD>
-
-=end
-module SiSU_AO_DocumentStructure
- class Extract
- def extract(h,o)
- h ? h : o
- end
- end
- class ObjectMetadata
- attr_accessor :is,:of,:tags,:obj,:digest
- def initialize
- @tags={}
- @is=@tmp=@digest=nil
- @of=:meta
- end
- def metadata(tags)
- of = @of #Symbol, classification - group
- is = :meta #Symbol, classification - specific type
- tags = tags || ((defined? o.tags) ? o.tags : {}) #String, metadata type/tag
- obj = nil
- @of,@is,@tags,@obj=of,is,tags,obj
- self
- end
- end
- class ObjectMeta
- attr_accessor :obj,:is,:of,:tag,:digest,:tmp
- def initialize
- @is=@obj=@tag=@digest=@digest=@tmp=nil
- @of=:meta
- end
- def metadata(h,o=nil)
- of = @of #Symbol, classification - group
- is = :meta #Symbol, classification - specific type
- tag = h[:tag] || ((defined? o.tag) ? o.tag : nil) #String, metadata type/tag
- obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5
- @of,@is,@tag,@obj,@digest,@tmp=of,is,tag,obj,digest,tmp
- self
- end
- end
- class ObjectHeading
- attr_accessor :obj,:is,:tags,:of,:lv,:ln,:lc,:use_,:name,:idx,:ocn,:odv,:osp,:node,:parent,:ocn_,:note_,:autonum_,:digest,:tmp
- def initialize
- @of=:para
- @is=@obj=@lv=@ln=@lc=@use_=@name=@idx=@size=@ocn=@odv=@osp=@node=@parent=@ocn_=@note_=@autonum_=@digest=@tmp=nil
- @tags=[]
- end
- def heading_ln(lv)
- case lv
- when /A/ then 0
- when /B/ then 1
- when /C/ then 2
- when /D/ then 3
- when /1/ then 4
- when /2/ then 5
- when /3/ then 6
- when /4/ then 7
- when /5/ then 8
- when /6/ then 9
- end
- end
- def heading_lv(ln)
- case ln.to_s
- when /0/ then 'A'
- when /1/ then 'B'
- when /2/ then 'C'
- when /3/ then 'D'
- when /4/ then '1'
- when /5/ then '2'
- when /6/ then '3'
- when /7/ then '4'
- when /8/ then '5'
- when /9/ then '6'
- end
- end
- def heading(h,o=nil)
- if not h[:ln] \
- and (h[:lv] and h[:lv]=~/[1-6A-D]/)
- h[:ln]=heading_ln(h[:lv])
- elsif not h[:lv] \
- and (h[:ln] and h[:ln].to_s=~/[0-9]/)
- h[:lv]=heading_lv(h[:ln])
- end
- of = @of #Symbol, classification - group
- is = :heading #Symbol, classification - specific type
- name = h[:name] || ((defined? o.name) ? o.name : nil) #String, named object?
- tags = h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
- obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- idx = h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
- ocn = h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
- odv = h[:odv] || ((defined? o.odv) ? o.odv : nil)
- osp = h[:osp] || ((defined? o.osp) ? o.osp : nil)
- node = h[:node] || ((defined? o.node) ? o.node : nil) #[Node relationship doc structure info]
- parent = h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
- lv = h[:lv] || ((defined? o.lv) ? o.lv : nil) #Alpha-numeric, document structure as used in markup, A-D then 1-6
- ln = h[:ln] || ((defined? o.ln) ? o.ln : nil) #Integer, document structure level, for convenience in processing 1-9
- lc = h[:lc] || ((defined? o.lc) ? o.lc : nil) #Integer, document structure collapsed level, convenience (collapse sisu's dual level document structure for markup with simple linear structure)
- use_ = if lv \
- and lv == '1'
- h[:use_] || ((defined? o.use_) ? o.use_ : :ok)
- elsif not lv.empty? \
- and lv =~ /[A-D2-3]/
- :ok
- else
- h[:use_] || ((defined? o.use_) ? o.use_ : :ok)
- end
- ocn_ = if h[:ocn_].nil?
- ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
- else h[:ocn_]
- end
- autonum_ = if h[:autonum_].nil?
- ((defined? o.autonum_) ? o.autonum_ : true) #Bool? auto-numbering if requested default on, false suppresses
- else h[:autonum_]
- end
- note_ = h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
- digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5
- tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@lv,@ln,@lc,@name,@tags,@obj,@idx,@ocn,@odv,@osp,@node,@parent,@use_,@ocn_,@note_,@autonum_,@digest,@tmp=
- of, is, lv, ln, lc, name, tags, obj, idx, ocn, odv, osp, node, parent, use_, ocn_, note_, autonum_, digest, tmp
- self
- end
- def heading_insert(h,o=nil)
- heading(h,o=nil)
- @is = :heading_insert #String, classification - specific type
- self
- end
- end
- class ObjectPara
- attr_accessor :obj,:is,:tags,:of,:name,:idx,:quote_,:bullet_,:indent,:hang,:ocn,:odv,:osp,:parent,:note_,:image_,:ocn_,:digest,:tmp
- def initialize
- @of=:para
- @is=@obj=@name=@idx=@quote_=@bullet_=@indent=@hang=@size=@ocn=@odv=@osp=@parent=@note_=@image_=@ocn_=@digest=@tmp=nil
- @tags=[]
- end
- def paragraph(h,o=nil)
- of = @of #Symbol, classification - group
- is = :para #Symbol, classification - specific type
- name = h[:name] || ((defined? o.name) ? o.name : nil) #String, named object?
- tags = h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
- obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- idx = h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
- ocn = h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
- odv = h[:odv] || ((defined? o.odv) ? o.odv : nil)
- osp = h[:osp] || ((defined? o.osp) ? o.osp : nil)
- parent = h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
- indent = h[:indent].to_s || ((defined? o.indent) ? o.indent.to_s : nil) #Integer, indent level
- hang = h[:hang].to_s || ((defined? o.hang) ? o.hang.to_s : nil) #Integer, hanging indent level
- bullet_ = h[:bullet_] || ((defined? o.bullet_) ? o.bullet_ : false) #Bool, bulleted?
- quote_ = h[:quote_] || ((defined? o.quote_) ? o.quote_ : false) #Bool, quote (blockquote)?
- note_ = h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
- image_ = h[:image_] || ((defined? o.image_) ? o.image_ : false) #Bool, images? (processing optimization)
- ocn_ = if h[:ocn_].nil?
- ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
- else h[:ocn_]
- end
- digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5
- tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@name,@tags,@obj,@indent,@hang,@bullet_,@quote_,@idx,@ocn,@odv,@osp,@parent,@image_,@note_,@ocn_,@digest,@tmp=
- of, is, name, tags, obj, indent, hang, bullet_, quote_, idx, ocn, odv, osp, parent, image_, note_, ocn_, digest, tmp
- self
- end
- def docinfo(h,o=nil)
- of = @of #String, classification - group
- is = :docinfo #String, classification - specific type
- name = h[:name] || ((defined? o.name) ? o.name : nil) #String, named object?
- tags = h[:tags] || ((defined? o.tags) ? o.tags : nil) #Array, associated object tags, names if any
- obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- idx = nil #String, book index provided?
- ocn = nil #Integer, sequential on substantive-content objects
- odv = h[:odv] || ((defined? o.odv) ? o.odv : nil)
- osp = h[:osp] || ((defined? o.osp) ? o.osp : nil)
- parent = h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
- indent = nil #Integer, indent level
- hang = nil #Integer, indent level
- bullet_ = false #Bool, bulleted?
- note_ = false #Bool, endnotes/footnotes? (processing optimization)
- image_ = h[:image_] || ((defined? o.image_) ? o.image_ : false) #Bool, images? (processing optimization)
- ocn_ = if h[:ocn_].nil?
- ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
- else h[:ocn_]
- end
- digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5
- tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@name,@tags,@obj,@indent,@hang,@bullet_,@idx,@ocn,@odv,@osp,@parent,@image_,@note_,@ocn_,@digest,@tmp=
- of, is, name, tags, obj, indent, hang, bullet_, idx, ocn, odv, osp, parent, image_, note_, ocn_, digest, tmp
- self
- end
- end
- class ObjectBlockTxt
- attr_accessor :obj,:is,:of,:tags,:lngsyn,:idx,:ocn,:odv,:osp,:parent,:note_,:number_,:ocn_,:digest,:tmp
- def initialize
- @of=:block
- @is=@obj=@lngsyn=@idx=@ocn=@odv=@osp=@parent=@note_=@number_=@ocn_=@digest=@tmp=nil
- @tags=[]
- end
- def code(h,o=nil)
- of = @of #Symbol, classification - group #alt 'code'
- is = :code #Symbol, classification - specific type
- tags = h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
- obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- lngsyn = h[:lngsyn] || ((defined? o.lngsyn) ? o.lngsyn : :txt) #symbol, code lngsyn
- idx = h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
- ocn = h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
- odv = h[:odv] || ((defined? o.odv) ? o.odv : nil)
- osp = h[:osp] || ((defined? o.osp) ? o.osp : nil)
- parent = h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
- number_ = h[:number_] || ((defined? o.number_) ? o.number_ : false) #Bool, numbered or not?
- note_ = h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
- ocn_ = if h[:ocn_].nil?
- ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
- else h[:ocn_]
- end
- num = h[:num] || ((defined? o.num) ? o.num : nil)
- digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5
- tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@tags,@obj,@lngsyn,@idx,@ocn,@odv,@osp,@parent,@number_,@note_,@ocn_,@num,@digest,@tmp=
- of, is, tags, obj, lngsyn, idx, ocn, odv, osp, parent, number_, note_, ocn_, num, digest, tmp
- self
- end
- def box(h,o=nil)
- of = @of #Symbol, classification - group
- is = :box #Symbol, classification - specific type
- tags = h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
- obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- idx = h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
- ocn = h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
- odv = h[:odv] || ((defined? o.odv) ? o.odv : nil)
- osp = h[:osp] || ((defined? o.osp) ? o.osp : nil)
- parent = h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
- note_ = h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
- ocn_ = if h[:ocn_].nil?
- ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
- else h[:ocn_]
- end
- num = h[:num] || ((defined? o.num) ? o.num : nil)
- digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5
- tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@num,@digest,@tmp=
- of, is, tags, obj, idx, ocn, odv, osp, parent, note_, ocn_, num, digest, tmp
- self
- end
- def block(h,o=nil)
- of = @of #Symbol, classification - group
- is = :block #Symbol, classification - specific type
- tags = h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
- obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- idx = h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
- ocn = h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
- odv = h[:odv] || ((defined? o.odv) ? o.odv : nil)
- osp = h[:osp] || ((defined? o.osp) ? o.osp : nil)
- parent = h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
- note_ = h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
- ocn_ = if h[:ocn_].nil?
- ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
- else h[:ocn_]
- end
- num = h[:num] || ((defined? o.num) ? o.num : nil)
- digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5
- tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@num,@digest,@tmp=
- of, is, tags, obj, idx, ocn, odv, osp, parent, note_, ocn_, num, digest, tmp
- self
- end
- def group(h,o=nil)
- of = @of #Symbol, classification - group
- is = :group #Symbol, classification - specific type
- tags = h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
- obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- idx = h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
- ocn = h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
- odv = h[:odv] || ((defined? o.odv) ? o.odv : nil)
- osp = h[:osp] || ((defined? o.osp) ? o.osp : nil)
- parent = h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
- note_ = h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
- ocn_ = if h[:ocn_].nil?
- ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
- else h[:ocn_]
- end
- num = h[:num] || ((defined? o.num) ? o.num : nil)
- digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5
- tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@num,@digest,@tmp=
- of, is, tags, obj, idx, ocn, odv, osp, parent, note_, ocn_, num, digest, tmp
- self
- end
- def alt(h,o=nil) #see block
- of = @of #Symbol, classification - group
- is = :alt #Symbol, classification - specific type
- tags = h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
- obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- idx = h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
- ocn = h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
- odv = h[:odv] || ((defined? o.odv) ? o.odv : nil)
- osp = h[:osp] || ((defined? o.osp) ? o.osp : nil)
- parent = h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
- note_ = h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
- ocn_ = if h[:ocn_].nil?
- ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
- else h[:ocn_]
- end
- num = h[:num] || ((defined? o.num) ? o.num : nil)
- digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5
- tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@num,@digest,@tmp=
- of, is, tags, obj, idx, ocn, odv, osp, parent, note_, ocn_, num, digest, tmp
- self
- end
- def verse(h,o=nil) #part of poem decide how you deal with this
- of = @of #Symbol, classification - group
- is = :verse #Symbol, classification - specific type
- tags = h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
- obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- idx = h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
- ocn = h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
- odv = h[:odv] || ((defined? o.odv) ? o.odv : nil)
- osp = h[:osp] || ((defined? o.osp) ? o.osp : nil)
- parent = h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
- ocn_ = if h[:ocn_].nil?
- ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
- else h[:ocn_]
- end
- num = h[:num] || ((defined? o.num) ? o.num : nil)
- digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5
- tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@num,@digest,@tmp=
- of, is, tags, obj, idx, ocn, odv, osp, parent, note_, ocn_, num, digest, tmp
- @h=nil
- self
- end
- end
- class ObjectTable
- attr_accessor :obj,:is,:of,:lv,:tags,:name,:idx,:indent,:hang,:size,:ocn,:num,:head_,:cols,:widths,:odv,:osp,:parent,:note_,:ocn_,:digest,:tmp
- def initialize
- @of=:block
- @is=@obj=@lv=@name=@idx=@indent=@hang=@size=@ocn,@num,@head_,@cols,@widths=@odv=@osp=@parent=@note_=@ocn_=@num=@digest=@tmp=nil
- @tags=[]
- end
- def table(h,o=nil)
- of = @of #Symbol, classification - group
- is = :table #Symbol, classification - specific type
- tags = h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
- cols = h[:cols] || ((defined? o.cols) ? o.cols : nil)
- widths = h[:widths] || ((defined? o.widths) ? o.widths : nil)
- obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- idx = h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
- ocn = h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
- odv = h[:odv] || ((defined? o.odv) ? o.odv : nil)
- osp = h[:osp] || ((defined? o.osp) ? o.osp : nil)
- parent = h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
- head_ = h[:head_] || ((defined? o.head_) ? o.head_ : false)
- note_ = h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
- ocn_ = if h[:ocn_].nil?
- ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
- else h[:ocn_]
- end
- num = h[:num] || ((defined? o.num) ? o.num : nil)
- digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5
- tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@tags,@cols,@widths,@obj,@idx,@ocn,@odv,@osp,@parent,@head_,@note_,@ocn_,@num,@digest,@tmp=
- of, is, tags, cols, widths, obj, idx, ocn, odv, osp, parent, head_, note_, ocn_, num, digest, tmp
- self
- end
- end
- class ObjectImage
- attr_accessor :obj,:is,:of,:lv,:idx,:size,:ocn,:parent,:note_,:ocn_,:digest,:tmp
- def initialize
- @of=:image
- @is=@obj=@lv=@idx=@size=@ocn=@parent=@note_=@ocn_=@tmp=@digest=nil
- @tags=[]
- end
- def image(h,o=nil) #not yet used, and what of a paragraph containing several images, consider
- of= @of #Symbol, classification - group
- is= :image #Symbol, classification - specific type
- tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
- obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- size= h[:size] || ((defined? o.size) ? o.size : nil)
- idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
- ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
- odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
- osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
- parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
- note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
- ocn_=if h[:ocn_].nil?
- ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
- else h[:ocn_]
- end
- digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@tags,@obj,@size,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@digest,@tmp=of,is,tags,obj,size,idx,ocn,odv,osp,parent,note_,ocn_,digest,tmp
- self
- end
- end
- class ObjectStructure
- attr_accessor :obj,:tag,:node,:lv,:ln,:lc,:status,:is,:of,:tmp
- def initialize
- @of=:structure
- @is=@obj=@node=@lv=@ln=@lc=@status=@tmp=nil
- end
- def xml_dom(h,o=nil)
- of= @of #Symbol, classification - group
- is= :xml_dom #Symbol, classification - specific type
- obj= h[:obj] || ((defined? o.obj) ? o.obj : '') #String, text content
- lv= h[:lv] || ((defined? o.lv) ? o.lv : nil) #Alpha-numeric, document structure as used in markup, A-D then 1-6
- ln= h[:ln] || ((defined? o.ln) ? o.ln : nil) #Integer, document structure level, for convenience in processing 1-9
- lc= h[:lc] || ((defined? o.lc) ? o.lc : nil) #Integer, document structure collapsed level, convenience (collapse sisu's dual level document structure for markup with simple linear structure)
- node= h[:node] || ((defined? o.node) ? o.node : nil) #[Node relationship doc structure info]
- status= h[:status] || ((defined? o.status) ? o.status : nil) #tag status Symbol :open or :close
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@obj,@status,@node,@lv,@ln,@lc,@tmp=of,is,obj,status,node,lv,ln,lc,tmp
- self
- end
- end
- class ObjectFlag
- attr_accessor :obj,:is,:of,:flag,:act,:selections,:tmp
- def initialize
- @of=:flag
- @is=@obj=@flag=@act=@selections=@tmp=nil
- end
- def flag(h,o=nil)
- of= @of #Symbol, classification - group
- is= :flag #Symbol, classification - specific type
- obj= nil #String, text content
- flag= h[:flag] || ((defined? o.flag) ? o.flag : nil) #String, text content
- act= h[:act] || ((defined? o.act) ? o.act : nil) #String, text content
- selections= h[:selections] || ((defined? o.selections) ? o.selections : nil) #String, text content
- tmp= h[:flag] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of, @is,@obj,@flag,@act,@selections,@tmp=
- of,is, obj, flag, act, selections, tmp
- self
- end
- def flag_ocn(h,o=nil)
- of= @of #Symbol, classification - group
- is= :flag_ocn #Symbol, classification - specific type
- obj= nil #String, text content
- flag= h[:flag] || ((defined? o.flag) ? o.flag : nil) #String, text content
- act= h[:act] || ((defined? o.act) ? o.act : nil) #String, text content
- selections= h[:selections] || ((defined? o.selections) ? o.selections : nil) #String, text content
- tmp= h[:flag] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of, @is,@obj,@flag,@act,@selections,@tmp=
- of,is, obj, flag, act, selections,tmp
- self
- end
- def flag_lng(h,o=nil)
- of= @of #Symbol, classification - group
- is= :flag_lng
- obj= nil #String, text content
- flag= h[:flag] || ((defined? o.flag) ? o.flag : nil) #Symbol, :lng_on or :lng_off
- act= h[:act] || ((defined? o.act) ? o.act : nil) #Symbol, language set to :en etc.
- selections= h[:selections] || ((defined? o.selections) ? o.selections : nil) #String, text content
- tmp= h[:act] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of, @is,@obj,@flag,@act,@selections,@tmp=
- of,is, obj, flag, act, selections,tmp
- self
- end
- end
- class ObjectLayout
- attr_accessor :obj,:sym,:attr,:is,:is_for,:of,:from,:tmp,:num
- def initialize
- @of=:layout
- @is=@is_for=@obj=@from=@tmp=@num=nil
- end
- def break(h,f=nil) #decide how to deal with
- of= @of #Symbol, classification - group
- is= :break #Symbol, classification - specific type
- obj= h[:obj] #String, text content
- from= f
- tmp= h[:tmp] #available for processing, empty after use
- @of,@is,@obj,@from,@tmp=of,is,obj,from,tmp
- self
- end
- def insert(h,o=nil) #decide how to deal with, could mimic paragraph?
- of= @of #Symbol, classification - group
- is= :insert #Symbol, classification - specific type
- obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@obj,@tmp=of,is,obj,tmp
- self
- end
- def open_close(h,o=nil) #useful for poem & quote
- of= @of #Symbol, classification - group
- is= :open_close_tags #Symbol, classification - specific type
- is_for= h[:is_for] || ((defined? o.is_for) ? o.is_for : nil) #String, text content
- obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- sym= h[:sym] || ((defined? o.sym) ? o.sym : nil) #Symbol tag_open, tag_close
- attr= h[:attr] || ((defined? o.attr) ? o.attr : nil) #String, text content
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- num= h[:num] || ((defined? o.num) ? o.num : nil)
- @of,@is,@is_for,@obj,@sym,@attr,@tmp,@num=
- of, is, is_for, obj, sym, attr, tmp, num
- self
- end
- end
- class ObjectComment
- attr_accessor :obj,:is,:of,:tmp
- def initialize
- @of=:comment
- @is=@obj=@tmp=nil
- end
- def comment(h,o=nil)
- of= @of #Symbol, classification - group
- is= :comment #Symbol, classification - specific type
- obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@obj,@tmp=of,is,obj,tmp
- self
- end
- end
-end
-__END__
-# ~# |-# no paragraph number # -# not included in toc
diff --git a/lib/sisu/current/ao_endnotes.rb b/lib/sisu/current/ao_endnotes.rb
deleted file mode 100644
index 508d798..0000000
--- a/lib/sisu/current/ao_endnotes.rb
+++ /dev/null
@@ -1,136 +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_doc_endnotes.rb;hb=HEAD>
-
-=end
-module SiSU_AO_Endnotes
- class Endnotes
- def initialize(md,data,endnote_array=nil)
- @md,@data,@endnote_array=
- md, data, endnote_array
- @endnote_counter,
- @endnote_counter_asterisk,
- @endnote_counter_dag=
- 1,1,1
- end
- def endnotes
- data=@data
- endnote_ref=1
- @tuned_file=data.each.map do |dob|
- # manually numbered endnotes <!e(\d)!> <!e_(\d)!> -->
- if @md.opt.selections.str =~/--no-asterisk|--no-annotate/
- dob.obj=dob.obj.
- gsub(/#{Mx[:en_b_o]}\s.+?#{Mx[:en_b_c]}/,'')
- end
- if @md.opt.selections.str =~/--no-dagger|--no-annotate/
- dob.obj=dob.obj.
- gsub(/#{Mx[:en_b_o]}[+]\s.+?#{Mx[:en_b_c]}/,'')
- end
- if (defined? dob.obj) \
- && (defined? dob.is) \
- && dob.is !=:code
- case dob.obj # auto-numbered endnotes <!e!> <!e_!> -->
- when /#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}[*+]\s+.+?#{Mx[:en_b_c]}/
- dob.obj=dob.obj.
- gsub(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/,'\1')
- word_mode=dob.obj.scan(/\S+/m)
- word_mode=endnote_call_number(word_mode)
- dob.obj=word_mode.join(' ')
- endnote_ref+=1
- when /~\^(?:\s|$)/ #%note inserts endnotes previously gathered from /^(<!e[:_]!>|[-~]\{{3})/ (in earlier loop)
- word_mode=dob.obj.scan(/\S+/m)
- word_mode=endnote_call_number(word_mode)
- dob.obj=word_mode.join(' ')
- endnote_ref+=1
- end
- end
- dob
- end.flatten
- @endnote_counter,
- @endnote_counter_asterisk,
- @endnote_counter_dag=
- 1,1,1
- @tuned_file
- end
- def endnote_call_number(words)
- words.each do |word|
- case word
- when /#{Mx[:en_a_o]}/
- unless word =~/#{Mx[:en_a_o]}[*+]+/
- word.gsub!(/#{Mx[:en_a_o]}/,
- "#{Mx[:en_a_o]}#{@endnote_counter} ")
- @endnote_counter+=1
- end
- when /#{Mx[:en_b_o]}/
- if word =~/#{Mx[:en_b_o]}[+]/
- word.gsub!(/#{Mx[:en_b_o]}[+]/,
- "#{Mx[:en_b_o]}\+#{@endnote_counter_dag} ")
- @endnote_counter_dag+=1
- else
- word.gsub!(/#{Mx[:en_b_o]}[*]?/,
- "#{Mx[:en_b_o]}\*#{@endnote_counter_asterisk} ")
- @endnote_counter_asterisk+=1
- end
- when /~\^/
- if @endnote_array
- word.gsub!(/~\^/,
- "#{@endnote_array[@endnote_counter-1]}")
- @endnote_counter+=1
- end
- end
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/current/ao_expand_insertions.rb b/lib/sisu/current/ao_expand_insertions.rb
deleted file mode 100644
index 3d4ea8c..0000000
--- a/lib/sisu/current/ao_expand_insertions.rb
+++ /dev/null
@@ -1,514 +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_expand_insertions.rb;hb=HEAD>
-
-=end
-module SiSU_AO_Insertions
- class Insertions
- def initialize(md,data)
- @md,@data=md,data
- end
- def output_filetypes_in_cmd(cmd_shortcut,lnk=nil) #make list of file types in shortcut command (as configured), e.g. when sisu -3 is used
- act_defaults=SiSU_Env::InfoProcessingFlag.new
- cmd_list=case cmd_shortcut.inspect #check on expectation, string v array
- when /0/ then act_defaults.act_0.str
- when /1/ then act_defaults.act_1.str
- when /2/ then act_defaults.act_2.str
- when /3/ then act_defaults.act_3.str
- when /4/ then act_defaults.act_4.str
- when /5/ then act_defaults.act_5.str
- when /6/ then act_defaults.act_6.str
- when /7/ then act_defaults.act_7.str
- when /8/ then act_defaults.act_8.str
- when /9/ then act_defaults.act_9.str
- end
- file_type_names={}
- file_type_names[:gen],file_type_names[:src]=[],[]
- file_type_names[:gen] <<= if cmd_list =~ /\b--manifest\b/
- "~^ { document manifest }#{lnk[:manifest]}"
- end
- file_type_names[:gen] <<= if cmd_list =~ /\b--html\b/
- [
- " { html, segmented text }#{lnk[:html_toc]}",
- " { html, scroll, document in one }#{lnk[:html_doc]}",
- ]
- end
- file_type_names[:gen] <<= if cmd_list =~ /\b--epub\b/
- [" { epub }#{lnk[:epub]}"]
- end
- file_type_names[:gen] <<= if cmd_list =~ /\b--pdf\b/ \
- or cmd_list =~ /--pdf-landscape/
- [
- " { pdf, landscape }#{lnk[:pdf_landscape]}",
- ]
- end
- file_type_names[:gen] <<= if cmd_list =~ /\b--pdf\b/ \
- or cmd_list =~ /--pdf-portrait/
- [
- " { pdf, portrait }#{lnk[:pdf_portrait]}",
- ]
- end
- file_type_names[:gen] <<= if cmd_list =~ /\b(?:--odt|--odf)\b/
- " { odf:odt, open document text }#{lnk[:odt]}"
- end
- file_type_names[:gen] <<= if cmd_list =~ /\b--xhtml\b/
- " { xhtml scroll }#{lnk[:xhtml]}"
- end
- file_type_names[:gen] <<= if cmd_list =~ /\b--docbook\b/
- " { docbook }#{lnk[:docbook]}" #CHECK
- end
- file_type_names[:gen] <<= if cmd_list =~ /\b--xml-sax\b/
- " { xml, sax }#{lnk[:xml_sax]}"
- end
- file_type_names[:gen] <<= if cmd_list =~ /\b--xml-dom\b/
- " { xml, dom }#{lnk[:xml_dom]}"
- end
- file_type_names[:gen] <<= if cmd_list =~ /\b(?:--txt|--text|--plaintext)\b/
- " { plain text utf-8 }#{lnk[:txt]}"
- end
- #file_type_names[:gen] <<= if cmd_list =~ /g/
- # 'wiki.txt'
- #end
- file_type_names[:gen] <<= if cmd_list =~ /\b--concordance\b/
- " { concordance }#{lnk[:html_concordance]}"
- end
- file_type_names[:gen] <<= if cmd_list =~ /\b--digest\b/
- " { dcc, document content certificate (digests) }#{lnk[:digest]}"
- end
- file_type_names[:src] <<= if source and cmd_shortcut =~ /\b--source\b/
- " { markup source text }#{lnk[:source]}"
- end
- file_type_names[:src] <<= if cmd_shortcut =~ /\b--sisupod\b/
- " { markup source (zipped) pod }#{lnk[:sisupod]}"
- end
- file_type_names[:gen]=file_type_names[:gen].flatten
- file_type_names[:src]=file_type_names[:src].flatten
- file_type_names
- end
- def by_language(linked_doc,lng,src=nil)
- @linked_doc,@lng,@src=linked_doc,lng,src
- @base_path="#{@md.file.output_path.base.url}/#{lng}"
- def fnh
- {
- fn: @linked_doc,
- }
- end
- def path_and_file(fn,pth)
- @base_path + '/' + pth + '/' + fn
- end
- def manifest
- fn=@md.file.base_filename.manifest(fnh)
- path_and_file(fn,'manifest')
- end
- def html_toc
- fn=@md.file.base_filename.html_segtoc(fnh)
- @base_path + '/html/' + @linked_doc + '/' + fn
- end
- def html_doc
- fn=@md.file.base_filename.html_scroll(fnh)
- path_and_file(fn,'html')
- end
- def html_concordance
- fn=@md.file.base_filename.html_concordance
- @base_path + '/html/' + @linked_doc + '/' + fn
- end
- def epub
- fn=@md.file.base_filename.epub(fnh)
- path_and_file(fn,'epub')
- end
- def pdf_landscape
- fn=@md.file.base_filename.pdf_l_a4(fnh)
- path_and_file(fn,'pdf')
- end
- def pdf_portrait
- fn=@md.file.base_filename.pdf_p_a4(fnh)
- path_and_file(fn,'pdf')
- end
- def odt
- fn=@md.file.base_filename.odt(fnh)
- path_and_file(fn,'odt')
- end
- def xhtml
- fn=@md.file.base_filename.xhtml(fnh)
- path_and_file(fn,'xhtml')
- end
- def docbook
- fn=@md.file.base_filename.xml_docbook_book(fnh)
- path_and_file(fn,'docbook')
- end
- def xml_sax
- fn=@md.file.base_filename.xml_sax(fnh)
- path_and_file(fn,'xml_sax')
- end
- def xml_dom
- fn=@md.file.base_filename.xml_dom(fnh)
- path_and_file(fn,'xml_dom')
- end
- def txt
- fn=@md.file.base_filename.txt(fnh)
- path_and_file(fn,'txt')
- end
- def digest
- fn=@md.file.base_filename.hash_digest(fnh)
- path_and_file(fn,'digest')
- end
- def source
- @base_path + '/src/' + @src
- end
- def sisupod
- @base_path + '/src/' + @src + '.zip'
- end
- self
- end
- def by_filetype(linked_doc,lng,src=nil)
- @linked_doc,@lng,@src=linked_doc,lng,src
- @lc=SiSU_Env::FilenameLanguageCodeInsert.new(@md.opt,lng).
- language_code_insert
- @base_path="#{@md.file.output_path.base.url}"
- def fnh
- {
- fn: @linked_doc,
- lng: @lc,
- }
- end
- def path_and_file(fn,pth)
- @base_path + '/' + pth + '/' + fn
- end
- def manifest
- fn=@md.file.base_filename.manifest(fnh)
- path_and_file(fn,'manifest')
- end
- def html_toc
- fn=@md.file.base_filename.html_segtoc(fnh)
- path_and_file(fn,'html')
- end
- def html_doc
- fn=@md.file.base_filename.html_scroll(fnh)
- path_and_file(fn,'html')
- end
- def html_concordance
- fn=@md.file.base_filename.html_concordance
- path_and_file(fn,'html')
- end
- def epub
- fn=@md.file.base_filename.epub(fnh)
- path_and_file(fn,'epub')
- end
- def pdf_landscape
- fn=@md.file.base_filename.pdf_l_a4(fnh)
- path_and_file(fn,'pdf')
- end
- def pdf_portrait
- fn=@md.file.base_filename.pdf_p_a4(fnh)
- path_and_file(fn,'pdf')
- end
- def odt
- fn=@md.file.base_filename.odt(fnh)
- path_and_file(fn,'odt')
- end
- def xhtml
- fn=@md.file.base_filename.xhtml(fnh)
- path_and_file(fn,'xhtml')
- end
- def docbook
- fn=@md.file.base_filename.xml_docbook_book(fnh)
- path_and_file(fn,'docbook')
- end
- def xml_sax
- fn=@md.file.base_filename.xml_sax(fnh)
- path_and_file(fn,'xml_sax')
- end
- def xml_dom
- fn=@md.file.base_filename.xml_dom(fnh)
- path_and_file(fn,'xml_dom')
- end
- def txt
- fn=@md.file.base_filename.txt(fnh)
- path_and_file(fn,'txt')
- end
- def digest
- fn=@md.file.base_filename.hash_digest(fnh)
- path_and_file(fn,'digest')
- end
- def source
- @base_path + '/src/' + @src
- end
- def sisupod
- @base_path + '/src/' + @src + '.zip'
- end
- self
- end
- def by_filename(linked_doc,lng,src=nil)
- @linked_doc,@lng,@src=linked_doc,lng,src
- @lc=SiSU_Env::FilenameLanguageCodeInsert.new(@md.opt,lng).language_code_insert
- @base_path="#{@md.file.output_path.base.url}/#{@linked_doc}"
- def fnh
- {
- fn: @linked_doc,
- lng: @lc,
- }
- end
- def path_and_file(fn,pth=nil)
- (pth.nil?) \
- ? @base_path + '/' + fn
- : @base_path + '/' + pth + '/' + fn
- end
- def manifest
- fn=@md.file.base_filename.manifest(fnh)
- path_and_file(fn)
- end
- def html_toc
- fn=@md.file.base_filename.html_segtoc(fnh)
- path_and_file(fn)
- end
- def html_doc
- fn=@md.file.base_filename.html_scroll(fnh)
- path_and_file(fn)
- end
- def html_concordance
- fn=@md.file.base_filename.html_concordance
- path_and_file(fn)
- end
- def epub
- fn=@md.file.base_filename.epub(fnh)
- path_and_file(fn,'epub')
- end
- def pdf_landscape
- fn=@md.file.base_filename.pdf_l_a4(fnh)
- path_and_file(fn)
- end
- def pdf_portrait
- fn=@md.file.base_filename.pdf_p_a4(fnh)
- path_and_file(fn)
- end
- def odt
- fn=@md.file.base_filename.odt(fnh)
- path_and_file(fn)
- end
- def xhtml
- fn=@md.file.base_filename.xhtml(fnh)
- path_and_file(fn)
- end
- def docbook
- fn=@md.file.base_filename.xml_docbook_book(fnh)
- path_and_file(fn)
- end
- def xml_sax
- fn=@md.file.base_filename.xml_sax(fnh)
- path_and_file(fn)
- end
- def xml_dom
- fn=@md.file.base_filename.xml_dom(fnh)
- path_and_file(fn)
- end
- def txt
- fn=@md.file.base_filename.txt(fnh)
- path_and_file(fn)
- end
- def digest
- fn=@md.file.base_filename.hash_digest(fnh)
- path_and_file(fn)
- end
- def source
- @base_path + '/' + @src
- end
- def sisupod
- @base_path + '/' + @src + '.zip'
- end
- self
- end
- def expand_insertions?
- data=@data
- tuned_file,tuned_file_tmp=[],[]
- codeblock_={
- status: :false,
- type: :na,
- }
- data.each do |para|
- codeblock_=if para =~/^code(?:\.[a-z][0-9a-z_]+)?\{/ \
- and codeblock_[:status]==:false
- {
- status: :true,
- type: :curl,
- }
- elsif para =~/^```[ ]+code(?:\.[a-z][0-9a-z_]+)?/ \
- and codeblock_[:status]==:false
- {
- status: :true,
- type: :tics,
- }
- elsif codeblock_[:type]==:curl \
- and para =~/^\}code/m
- {
- status: :false,
- type: :na,
- }
- elsif codeblock_[:type]==:tics \
- and para =~/^```(?:\s|$)/m
- {
- status: :false,
- type: :na,
- }
- else codeblock_
- end
- if para !~/^%+\s/ \
- and codeblock_[:status] != :true \
- and para =~/\{(?:~\^\s+)?(.+?)\s\[(?:\d(?:[sS]*))\]\}(?:\.\.\/\S+?\/|\S+?\.ss[tm]\b)/
- @u=SiSU_Env::InfoEnv.new.url
- m_cmd=''
- if defined? @u.remote
- if /(?<m_pre>.+?)\{(?<m_txt>.+?)\s\[(?<m_cmd>\d[sS]*)\]\}(?<m_source>(?<m_linked_doc>\S+?)\.ss[tm]\b)(?<m_note>.*)/m =~ para
- m_pre=m_pre.strip
- elsif /\{(?<m_txt>.+?)\s\[(?<m_cmd>\d[sS]*)\]\}(?<m_source>(?<m_linked_doc>\S+?)\.ss[tm]\b)(?<m_note>.*)/m =~ para
- end
- if m_linked_doc =~ /(\S+?)\/(\S+)/
- m_linked_doc,m_linked_doc_lang=$1,$2
- else
- m_linked_doc,m_linked_doc_lang=m_linked_doc,@md.opt.lng_base
- end
- else
- puts "error, does currently support relative paths (reltive paths were removed, as had problems for citation, and was not suited to all output types should possibly reconsider) #{__FILE__} #{__LINE__}"
- if /\{(?:~\^\s+)?(?<m_txt>.+?)\s\[(?<m_cmd>\d[sS]*)\]\}\.\.\/(?<m_linked_doc>\S+?)\/(?<m_note>\s+#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]})?/ =~ para
- end
- end
- lnk=case @md.opt.dir_structure_by
- when :language
- {
- manifest: by_language(m_linked_doc,m_linked_doc_lang).manifest,
- html_toc: by_language(m_linked_doc,m_linked_doc_lang).html_toc,
- html_doc: by_language(m_linked_doc,m_linked_doc_lang).html_doc,
- epub: by_language(m_linked_doc,m_linked_doc_lang).epub,
- pdf_landscape: by_language(m_linked_doc,m_linked_doc_lang).pdf_landscape,
- pdf_portrait: by_language(m_linked_doc,m_linked_doc_lang).pdf_landscape,
- odt: by_language(m_linked_doc,m_linked_doc_lang).odt,
- xhtml: by_language(m_linked_doc,m_linked_doc_lang).xhtml,
- docbook: by_language(m_linked_doc,m_linked_doc_lang).docbook,
- xml_sax: by_language(m_linked_doc,m_linked_doc_lang).xml_sax,
- xml_dom: by_language(m_linked_doc,m_linked_doc_lang).xml_dom,
- txt: by_language(m_linked_doc,m_linked_doc_lang).txt,
- html_concordance: by_language(m_linked_doc,m_linked_doc_lang).html_concordance,
- digest: by_language(m_linked_doc,m_linked_doc_lang).digest,
- sisupod: by_language(m_linked_doc,m_linked_doc_lang,m_source).sisupod,
- source: by_language(m_linked_doc,m_linked_doc_lang,m_source).source,
- }
- when :filetype
- {
- manifest: by_filetype(m_linked_doc,m_linked_doc_lang).manifest,
- html_toc: by_filetype(m_linked_doc,m_linked_doc_lang).html_toc,
- html_doc: by_filetype(m_linked_doc,m_linked_doc_lang).html_doc,
- epub: by_filetype(m_linked_doc,m_linked_doc_lang).epub,
- pdf_landscape: by_filetype(m_linked_doc,m_linked_doc_lang).pdf_landscape,
- pdf_portrait: by_filetype(m_linked_doc,m_linked_doc_lang).pdf_landscape,
- odt: by_filetype(m_linked_doc,m_linked_doc_lang).odt,
- xhtml: by_filetype(m_linked_doc,m_linked_doc_lang).xhtml,
- docbook: by_filetype(m_linked_doc,m_linked_doc_lang).docbook,
- xml_sax: by_filetype(m_linked_doc,m_linked_doc_lang).xml_sax,
- xml_dom: by_filetype(m_linked_doc,m_linked_doc_lang).xml_dom,
- txt: by_filetype(m_linked_doc,m_linked_doc_lang).txt,
- html_concordance: by_filetype(m_linked_doc,m_linked_doc_lang).html_concordance,
- digest: by_filetype(m_linked_doc,m_linked_doc_lang).digest,
- sisupod: by_filetype(m_linked_doc,m_linked_doc_lang,m_source).sisupod,
- source: by_filetype(m_linked_doc,m_linked_doc_lang,m_source).source,
- }
- else
- {
- manifest: by_filename(m_linked_doc,m_linked_doc_lang).manifest,
- html_toc: by_filename(m_linked_doc,m_linked_doc_lang).html_toc,
- html_doc: by_filename(m_linked_doc,m_linked_doc_lang).html_doc,
- epub: by_filename(m_linked_doc,m_linked_doc_lang).epub,
- pdf_landscape: by_filename(m_linked_doc,m_linked_doc_lang).pdf_landscape,
- pdf_portrait: by_filename(m_linked_doc,m_linked_doc_lang).pdf_landscape,
- odt: by_filename(m_linked_doc,m_linked_doc_lang).odt,
- xhtml: by_filename(m_linked_doc,m_linked_doc_lang).xhtml,
- docbook: by_filename(m_linked_doc,m_linked_doc_lang).docbook,
- xml_sax: by_filename(m_linked_doc,m_linked_doc_lang).xml_sax,
- xml_dom: by_filename(m_linked_doc,m_linked_doc_lang).xml_dom,
- txt: by_filename(m_linked_doc,m_linked_doc_lang).txt,
- html_concordance: by_filename(m_linked_doc,m_linked_doc_lang).html_concordance,
- digest: by_filename(m_linked_doc,m_linked_doc_lang).digest,
- sisupod: by_filename(m_linked_doc,m_linked_doc_lang,m_source).sisupod,
- source: by_filename(m_linked_doc,m_linked_doc_lang,m_source).source,
- }
- end
- linked_title="#{m_pre}{#{m_txt} }#{lnk[:manifest]}#{m_note}\n\n"
- tuned_file_tmp << linked_title
- output_filetypes=output_filetypes_in_cmd(m_cmd,lnk)
- output_filetypes[:gen].each do |desc|
- if desc
- tuned_file_tmp << if @u.remote
- "#{Mx[:nbsp]*4} #{desc} "
- else # remove ...
- "[provide document placement host location]"
- end
- end
- end
- output_filetypes[:src].each do |desc|
- if desc
- tuned_file_tmp << if @u.remote
- "#{Mx[:nbsp]*4} #{desc} "
- else
- "[provide document placement host location]"
- end
- end
- end
- tuned_file << 'group{' << tuned_file_tmp.join("\n") << '}group'
- tuned_file_tmp=[]
- else tuned_file << para
- end
- end
- tuned_file
- end
- end
-end
-__END__
diff --git a/lib/sisu/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_idx.rb b/lib/sisu/current/ao_idx.rb
deleted file mode 100644
index defad2c..0000000
--- a/lib/sisu/current/ao_idx.rb
+++ /dev/null
@@ -1,422 +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_idx.rb;hb=HEAD>
-
-=end
-module SiSU_AO_BookIndex
- class BookIndex
- def initialize(md,data,env=nil)
- @md,@data,@env=md,data,env
- @rgx_idx=/#{Mx[:idx_o]}(?:.+?)#{Mx[:idx_c]}\s*/
- @rgx_idx_ocn_seg=/(.+?)~(\d+)~(\S+)/
- @rgx_idx_ocn=/(.+?)~(\d+)/
- @env ||=SiSU_Env::InfoEnv.new(@md.fns)
- end
- def indexing_song
- data=@data
- data,
- sisu_markup_idx_rel,
- sisu_markup_idx_rel_html_seg,
- html_idx,xhtml_idx=
- extract_book_index(data)
- data=
- clean_and_insert_index(
- data,
- sisu_markup_idx_rel_html_seg
- )
- [
- data,
- sisu_markup_idx_rel,
- sisu_markup_idx_rel_html_seg,
- html_idx,
- xhtml_idx,
- ]
- end
- def extract_book_index(data)
- tuned_file=[]
- idx_array=[]
- data.each do |dob|
- if (dob.is ==:heading \
- || dob.is ==:heading_insert) \
- && dob.ln==4
- @seg=dob.name
- end
- if defined? dob.idx \
- and dob.idx.is_a?(Hash)
- idx_array << {
- idx: dob.idx,
- ocn: dob.ocn,
- seg: @seg
- }
- end
- tuned_file << dob if dob
- end
- if idx_array.length > 0
- the_idx=construct_book_index(idx_array)
- if @md.book_idx
- idx=index(the_idx)
- sisu_markup_idx_rel,sisu_markup_idx_rel_html_seg,html_idx, xhtml_idx=
- idx[:sst_rel], idx[:sst_rel_html_seg], idx[:html],idx[:xhtml]
- else
- sisu_markup_idx_rel=
- sisu_markup_idx_rel_html_seg=
- html_idx=
- xhtml_idx=
- nil
- end
- end
- [
- tuned_file,
- sisu_markup_idx_rel,
- sisu_markup_idx_rel_html_seg,
- html_idx,
- xhtml_idx,
- ]
- end
- def construct_book_index(idx_array)
- the_idx={}
- idx_array.each do |idx|
- idx[:idx].each_pair do |term,term_info|
- location=(term_info[:plus].to_i > 0) \
- ? (%{#{idx[:ocn]}-#{idx[:ocn].to_i + term_info[:plus].to_i}})
- : idx[:ocn].to_s
- the_idx[term]={} \
- unless the_idx[term] \
- and defined? the_idx[term]
- the_idx[term]['node_0_terms']=[] \
- unless the_idx[term]['node_0_terms'] \
- and defined? the_idx[term]['node_0_terms']
- the_idx[term]['node_0_terms'] << { ocn: idx[:ocn], range: location, seg: idx[:seg] }
- if term_info[:sub].is_a?(Array) \
- and term_info[:sub].length > 0
- term_info[:sub].each do |y|
- y.each_pair do |subterm,subterm_info|
- location=(subterm_info[:plus].to_i > 0) \
- ? (%{#{idx[:ocn]}-#{idx[:ocn].to_i + subterm_info[:plus].to_i}})
- : idx[:ocn].to_s
- the_idx[term]={} \
- unless the_idx[term] \
- and defined? the_idx[term]
- the_idx[term]['node_0_terms']=[] \
- unless the_idx[term]['node_0_terms']\
- and defined? the_idx[term]['node_0_terms']
- the_idx[term]['node_1_subterms']={} \
- unless the_idx[term]['node_1_subterms'] \
- and defined? the_idx[term]['node_1_subterms']
- the_idx[term]['node_1_subterms'][subterm]=[] \
- unless the_idx[term]['node_1_subterms'][subterm] \
- and defined? the_idx[term]['node_1_subterms'][subterm]
- the_idx[term]['node_1_subterms'][subterm] <<
- { ocn: idx[:ocn], range: location, seg: idx[:seg] }
- end
- end
- end
- end
- end
- the_idx=the_idx.sort
- the_idx
- end
- def clean_xml(str)
- str=str.gsub(/&/,'&amp;')
- str
- end
- def index(the_idx)
- @x=1
- idx={}
- idx[:sst_rel_html_seg],idx[:sst_rel],idx[:html],idx[:xhtml]=
- [], [], [], []
- h={
- obj: Mx[:br_page]
- }
- o=SiSU_AO_DocumentStructure::ObjectLayout.new.break(h)
- idx[:sst_rel_html_seg] << o
- idx[:sst_rel] << o
- h={
- lv: '1',
- name: 'index',
- obj: "Index"
- }
- o=SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h)
- idx[:sst_rel_html_seg] << o
- idx[:sst_rel] << o
- h={
- lv: '4',
- name: 'idx',
- obj: " [Index] #{Mx[:pa_non_object_dummy_heading]}"
- }
- o=SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h)
- idx[:sst_rel_html_seg] << o
- idx[:sst_rel] << o
- alph=%W[9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z]
- idx[:html] << '<p>'
- idx[:xhtml] << '<p>'
- alph.each do |x|
- if x =~/[0-9]/
- idx[:html] << ''
- idx[:xhtml] << ''
- else
- idx[:html] <<
- %{<a href="##{x}">#{x}</a>,#{$ep[:hsp]}}
- idx[:xhtml] <<
- %{<a href="##{x.downcase}">#{x}</a>,#{$ep[:hsp]}}
- end
- end
- idx[:html] << '</p>'
- idx[:xhtml] << '</p>'
- letter=alph.shift
- idx[:html] <<
- %{\n<p class="book_index_lev1"><a name="numeral"></a></p>}
- idx[:xhtml] <<
- %{\n<p class="letter" id="numeral">0 - 9</p>}
- the_idx.each do |i|
- i.each do |x|
- if x.is_a?(String)
- f=/^(\S)/.match(x)[1]
- if letter < f
- while letter < f
- if alph.length > 0
- letter=alph.shift
- idx[:html] <<
- %{\n<p class="letter"><a name="#{letter}">#{letter}</a></p><p class="book_index_lev1"><a name="#{letter.downcase}"> </a></p>}
- idx[:xhtml] <<
- %{\n<p class="letter" id="#{letter.downcase}">#{letter}</p>}
- else break
- end
- end
- end
- idx[:sst_rel_html_seg] <<
- %{\n\n#{Mx[:fa_bold_o]}#{x},#{Mx[:fa_bold_c]} }
- idx[:sst_rel] <<
- %{\n\n#{Mx[:fa_bold_o]}#{x},#{Mx[:fa_bold_c]} }
- aname=x.gsub(/\s+/,'_')
- idx[:html] <<
- %{\n<p class="book_index_lev1"><a name="#{aname}"><b>#{x}</b></a>, }
- c=clean_xml(x.dup)
- idx[:xhtml] <<
- %{\n<p class="book_index_lev1"><b>#{c}</b>, }
- @o=idx[:sst_rel_html_seg].index(idx[:sst_rel_html_seg].last)
- @t=idx[:sst_rel].index(idx[:sst_rel].last)
- @q=idx[:html].index(idx[:html].last)
- @r=idx[:xhtml].index(idx[:xhtml].last)
- print "\n" + x + ', ' if @md.opt.act[:verbose_plus][:set]==:on
- elsif x.is_a?(Array)
- p 'array error? -->'
- print x
- elsif x.is_a?(Hash)
- if x['node_0_terms'].is_a?(Array)
- x['node_0_terms'].each do |a|
- if a[:range]
- idx[:sst_rel_html_seg][@o]=
- idx[:sst_rel_html_seg][@o] +
- %{#{Mx[:lnk_o]}#{a[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}/#{a[:seg]}.html##{a[:ocn]}#{Mx[:rel_c]}, }
- idx[:sst_rel][@t]=
- idx[:sst_rel][@t] +
- %{#{Mx[:lnk_o]}#{a[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{a[:ocn]}#{Mx[:rel_c]}, }
- idx[:html][@q]=
- idx[:html][@q] +
- %{<a href="#{a[:seg]}.html##{a[:ocn]}">#{a[:range]}</a>, }
- idx[:xhtml][@q]=
- idx[:xhtml][@q] +
- %{<a href="#{a[:seg]}.xhtml#o#{a[:ocn]}">#{a[:range]}</a>, }
- print a[:range] + ', ' if @md.opt.act[:verbose_plus][:set]==:on
- elsif a[:ocn]
- idx[:sst_rel_html_seg][@o]=
- idx[:sst_rel_html_seg][@o] +
- %{#{Mx[:lnk_o]}#{a[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{a[:seg]}.html##{a[:ocn]}#{Mx[:rel_c]}, }
- idx[:sst_rel][@t]=
- idx[:sst_rel][@t] +
- %{#{Mx[:lnk_o]}#{a[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{a[:ocn]}#{Mx[:rel_c]}, }
- idx[:html][@q]=
- idx[:html][@q] +
- %{<a href="#{a[:seg]}.html##{a[:ocn]}">#{a[:ocn]}</a>, }
- idx[:xhtml][@q]=
- idx[:xhtml][@q] +
- %{<a href="#{a[:seg]}.xhtml#o#{a[:ocn]}">#{a[:ocn]}</a>, }
- print a[:ocn] + ', ' if @md.opt.act[:verbose_plus][:set]==:on
- else p 'error'
- end
- end
- idx[:html][@q]=idx[:html][@q] + '</p>'
- idx[:xhtml][@r]=idx[:xhtml][@r] + '</p>'
- end
- if x['node_1_subterms']
- x['node_1_subterms'].sort.each do |k,y|
- if k !~/node_0_terms/
- idx[:sst_rel_html_seg][@o]=
- idx[:sst_rel_html_seg][@o] +
- %{#{k}, }
- idx[:sst_rel][@t]=
- idx[:sst_rel][@t] +
- %{#{k}, }
- idx[:html][@q]=
- idx[:html][@q] +
- %{\n<p class="book_index_lev2">#{k}, }
- c=clean_xml(k.dup)
- idx[:xhtml][@r]=
- idx[:xhtml][@r] +
- %{\n<p class="book_index_lev2">#{c}, }
- print "\n\t" + k + ', ' if @md.opt.act[:verbose_plus][:set]==:on
- y.each do |z|
- if z[:range]
- idx[:sst_rel_html_seg][@o]=
- idx[:sst_rel_html_seg][@o] +
- %{#{Mx[:lnk_o]}#{z[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:seg]}.html##{z[:ocn]}#{Mx[:rel_c]}, }
- idx[:sst_rel][@t]=
- idx[:sst_rel][@t] +
- %{#{Mx[:lnk_o]}#{z[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:ocn]}#{Mx[:rel_c]}, }
- idx[:html][@q]=
- idx[:html][@q] +
- %{<a href="#{z[:seg]}.html##{z[:ocn]}">#{z[:range]}</a>, }
- idx[:xhtml][@q]=
- idx[:xhtml][@q] +
- %{<a href="#{z[:seg]}.xhtml#o#{z[:ocn]}">#{z[:range]}</a>, }
- print z[:range] + ', ' if @md.opt.act[:verbose_plus][:set]==:on
- elsif z[:ocn]
- idx[:sst_rel_html_seg][@o]=
- idx[:sst_rel_html_seg][@o] +
- %{#{Mx[:lnk_o]}#{z[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:seg]}.html##{z[:ocn]}#{Mx[:rel_c]}, }
- idx[:sst_rel][@t]=
- idx[:sst_rel][@t] +
- %{#{Mx[:lnk_o]}#{z[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:ocn]}#{Mx[:rel_c]}, }
- idx[:html][@q]=
- idx[:html][@q] +
- %{<a href="#{z[:seg]}.html##{z[:ocn]}">#{z[:ocn]}</a>, }
- idx[:xhtml][@q]=
- idx[:xhtml][@q] +
- %{<a href="#{z[:seg]}.xhtml#o#{z[:ocn]}">#{z[:ocn]}</a>, }
- print z[:ocn] + ', ' if @md.opt.act[:verbose_plus][:set]==:on
- else p 'error'
- end
- end
- idx[:html][@q]=idx[:html][@q] + '</p>'
- idx[:xhtml][@r]=idx[:xhtml][@r] + '</p>'
- end
- end
- end
- @x +=1
- end
- end
- end
- print "\n" if @md.opt.act[:verbose_plus][:set]==:on
- idx
- end
- def screen_print(the_idx)
- the_idx.each do |i|
- i.each do |x|
- if x.is_a?(String)
- print "\n" + x + ', '
- elsif x.is_a?(Array)
- p 'array error? -->'
- print x
- elsif x.is_a?(Hash)
- if x['node_0_terms'].is_a?(Array)
- x['node_0_terms'].each do |a|
- if a[:range]
- print a[:range] + ', '
- elsif a[:ocn]
- print a[:ocn] + ', '
- else p 'error'
- end
- end
- end
- if x['node_1_subterms']
- x['node_1_subterms'].sort.each do |k,y|
- if k !~/node_0_terms/
- print "\n\t" + k + ', '
- y.each do |z|
- if z[:range]
- print z[:range] + ', '
- elsif z[:ocn]
- print z[:ocn] + ', '
- else p 'error'
- end
- end
- end
- end
- end
- end
- end
- end
- end
- def output_idx(idx)
- if @md.book_idx
- path="#{@env.path.output}/#{@md.fnb}"
- Dir.mkdir(path) unless FileTest.directory?(path)
- puts "#{path}/#{@md.fn[:book_idx_html]} #{__FILE__}::#{__LINE__}"
- html_index_file=File.new("#{path}/#{@md.fn[:book_idx_html]}",'w')
- idx[:html].each {|x| html_index_file << x }
- html_index_file.close
- end
- end
- def clean_and_insert_index(data,sisu_markup_idx)
- tuned_file=[]
- data.each do |dob|
- tuned_file << dob
- if dob.obj =~/#{Mx[:br_endnotes]}/ \
- and sisu_markup_idx
- sisu_markup_idx.each do |idx|
- tuned_file << idx
- end
- end
- end
- tuned_file
- end
- def clean_index(data) #check on use of dob
- data.each.map do |para|
- para.gsub(/\n*#{@rgx_idx}/m,'')
- end
- 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_persist.rb b/lib/sisu/current/ao_persist.rb
deleted file mode 100644
index 72126c9..0000000
--- a/lib/sisu/current/ao_persist.rb
+++ /dev/null
@@ -1,194 +0,0 @@
-# encoding: utf-8
-=begin
-
-* Name: SiSU
-
-** Description: documents, structuring, processing, publishing, search
-*** document abstraction
-
-** Author: Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
-** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
- All Rights Reserved.
-
-** License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
-** SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
-** Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
-** Git
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/current/ao_persist.rb;hb=HEAD>
-
-=end
-module SiSU_AO_Persist
- class Persist
- @@persistance=nil
- attr_accessor :fns, :ao_arr, :idx_arr_sst, :idx_arr_tex, :idx_arr_html, :idx_arr_xhtml, :map_arr_nametags, :map_arr_ocn_htmlseg
- def initialize(args=nil)
- @@persistance=args=(args ? args : (@@persistance || persist_init_hash_values))
- @fns=args[:fns]
- @ao_arr=args[:ao_arr]
- @idx_arr_sst=args[:idx_arr_sst]
- @idx_arr_tex=args[:idx_arr_tex]
- @idx_arr_html=args[:idx_arr_html]
- @idx_arr_xhtml=args[:idx_arr_xhtml]
- @map_arr_nametags=args[:map_arr_nametags]
- @map_arr_ocn_htmlseg=args[:map_arr_ocn_htmlseg]
- end
- def fns
- @fns
- end
- def ao_arr
- @ao_arr
- end
- def idx_arr_sst
- @idx_arr_sst
- end
- def idx_arr_tex
- @idx_arr_tex
- end
- def idx_arr_html
- @idx_arr_html
- end
- def idx_arr_xhtml
- @idx_arr_xhtml
- end
- def map_arr_nametags
- @map_arr_nametags
- end
- def map_arr_ocn_htmlseg
- @map_arr_ocn_htmlseg
- end
- def persist_init_hash_values
- {
- fns: nil,
- ao_arr: [],
- idx_arr_sst: [],
- idx_arr_tex: [],
- idx_arr_html: [],
- idx_arr_xhtml: [],
- map_arr_nametags: [],
- map_arr_ocn_htmlseg: [],
- }
- end
- def persist_init
- @@persistance=nil
- Persist.new(persist_init_hash_values)
- end
- end
- class PersistDocStructExt
- @@persist=nil
- attr_accessor :ocn, :lng, :lng_is, :code, :lngsyn, :poem, :block, :box, :group, :alt, :quote, :table, :table_to
- def initialize(args=nil)
- @@persist=args=(args ? args : (@@persist || persist_init_hash_values))
- @ocn=args[:ocn]
- @lng=args[:lng]
- @lng_is=args[:lng_is]
- @code=args[:code]
- @lngsyn=args[:lngsyn]
- @poem=args[:poem]
- @block=args[:block]
- @box=args[:box]
- @group=args[:group]
- @alt=args[:alt]
- @quote=args[:quote]
- @table=args[:table]
- @table_to=args[:table_to]
- end
- def ocn
- @ocn
- end
- def lng
- @lng
- end
- def lng_is
- @lng_is
- end
- def code
- @code
- end
- def lngsyn
- @lngsyn
- end
- def poem
- @poem
- end
- def block
- @block
- end
- def box
- @box
- end
- def group
- @group
- end
- def alt
- @alt
- end
- def quote
- @quote
- end
- def table
- @table
- end
- def table_to
- @table_to
- end
- def persist_init_hash_values
- {
- ocn: :on,
- lng: :off,
- lng_is: :doc_default,
- code: :off,
- lngsyn: :txt,
- poem: :off,
- block: :off,
- box: :off,
- group: :off,
- alt: :off,
- quote: :off,
- table: :off,
- table_to: :off,
- }
- end
- def persist_init
- @@persist=nil
- PersistDocStructExt.new(persist_init_hash_values)
- end
- end
-end
-__END__
diff --git a/lib/sisu/current/ao_references.rb b/lib/sisu/current/ao_references.rb
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/conf.rb b/lib/sisu/current/conf.rb
deleted file mode 100644
index 2bc71ce..0000000
--- a/lib/sisu/current/conf.rb
+++ /dev/null
@@ -1,287 +0,0 @@
-# encoding: utf-8
-=begin
-
-* Name: SiSU
-
-** Description: documents, structuring, processing, publishing, search
-*** configuration
-
-** 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/conf.rb;hb=HEAD>
-
-=end
-module SiSU_Initialize
- require_relative 'se' # se.rb
- include SiSU_Env
- include SiSU_Screen
- require_relative 'relaxng' # relaxng.rb
- include SiSU_Relaxng
- require_relative 'css' # css.rb
- include SiSU_Style
- class Source
- def initialize(opt)
- @opt=opt
- end
- def read
- ConfigSite.new(@opt).make_homepage
- ConfigSite.new(@opt).css
- ConfigSite.new(@opt).dtd
- ConfigSite.new(@opt).cp_local_images
- ConfigSite.new(@opt).cp_external_images
- ConfigSite.new(@opt).cp_webserver_images
- end
- end
- class ConfigSite #config files such as css are not updated if they already exist unless forced using the --init=site modifier
- require_relative 'se' # se.rb
- def initialize(opt)
- @opt=opt
- @env=SiSU_Env::InfoEnv.new(@opt.fns)
- @suffix={
- rnc: 'rnc',
- rng: 'rng',
- xsd: 'xsd',
- }
- @path={
- xml: @env.path.output + '/_sisu/xml',
- xsd: @env.path.output + '/_sisu/xml/xsd',
- rnc: @env.path.output + '/_sisu/xml/rnc',
- rng: @env.path.output + '/_sisu/xml/rng',
- style: @env.path.output + '/' + @env.path.style,
- }
- @pwd,@home=Dir.pwd,@env.path.home
- end
- def make_homepage
- SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- 'invert',
- 'Make homepage',
- ''
- ).colorize unless @opt.act[:quiet][:set]==:on
- SiSU_Env::CreateSite.new(@opt).homepage
- end
- def cp_local_images
- SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- 'invert',
- 'Copy images',
- ''
- ).colorize unless @opt.act[:quiet][:set]==:on
- SiSU_Env::CreateSite.new(@opt).cp_local_images
- SiSU_Env::CreateSite.new(@opt).cp_webserver_images_local #this should not have been necessary
- SiSU_Env::CreateSite.new(@opt).cp_base_images #base images (nav etc.) used by all html
- end
- def cp_external_images
- SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- 'invert',
- 'Copy external images',
- ''
- ).colorize if @opt.act[:verbose_plus][:set]==:on
- SiSU_Env::CreateSite.new(@opt).cp_external_images
- end
- def cp_webserver_images
- SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- 'invert',
- 'Copy webserver/output file images',
- ''
- ).colorize unless @opt.act[:quiet][:set]==:on
- SiSU_Env::CreateSite.new(@opt).cp_webserver_images
- end
- def css
- SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- 'invert',
- 'Configuring CSSs',
- ''
- ).colorize unless @opt.act[:quiet][:set]==:on
- SiSU_Env::CreateSite.new(@opt).cp_css
- end
- def dtd
- SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- 'invert',
- 'Configuring DTDs',
- ''
- ).colorize unless @opt.act[:quiet][:set]==:on
- @rxng=SiSU_Relaxng::RelaxNG.new
- @path.each { |d| FileUtils::mkdir_p(d[1]) \
- unless FileTest.directory?(d[1]) }
- #ugly code, sort later
- if @rxng.methods.join =~/[^_]dtd_sax\b/
- if @rxng.dtd_sax.length > 200
- dtd=File.new("#{@path[:style]}/#{@rxng.rng_name.output_sax}",'w')
- dtd << @rxng.dtd_sax
- dtd.close
- else trang_rnc_model_output_sax
- end
- else trang_rnc_model_output_sax
- end
- if @rxng.methods.join =~/[^_]dtd_dom\b/
- if @rxng.dtd_dom.length > 200
- dtd=File.new("#{@path[:style]}/#{@rxng.rng_name.output_dom}",'w')
- dtd << @rxng.dtd_dom
- dtd.close
- else trang_rnc_model_output_dom
- end
- else trang_rnc_model_output_dom
- end
- if @rxng.methods.join =~/[^_]dtd_node\b/
- if @rxng.dtd_node.length > 200
- dtd=File.new("#{@path[:style]}/#{@rxng.rng_name.input_node}",'w')
- dtd << @rxng.dtd_node
- dtd.close
- else trang_rnc_model_input_node
- end
- else trang_rnc_model_input_node
- end
- if @rxng.methods.join =~/[^_]dtd_xhtml\b/
- if @rxng.dtd_xhtml.length > 200
- dtd=File.new("#{@path[:style]}/#{@rxng.rng_name.output_xhtml}",'w')
- dtd << @rxng.dtd_xhtml
- dtd.close
- else trang_rnc_model_output_xhtml
- end
- else trang_rnc_model_output_xhtml
- end
- end
- def trang_rnc_model_output_sax
- s=@suffix
- rnc_src=@env.processing_path.ao + '/sax.' + s[:rnc]
- rnc_file=@path[:rnc] + '/' + @rxng.rnc_name.output_sax
- rng_file=@path[:rng] + '/' + @rxng.rng_name.output_sax
- xsd_file=@path[:xsd] + '/' + @rxng.xsd_name.output_sax
- rnc=File.new(rnc_src,'w')
- rnc << @rxng.rnc_model_output_sax
- rnc.close
- #xsd
- schema=SiSU_Env::SystemCall.new(rnc_src,xsd_file)
- schema.relaxng(@opt.selections.str)
- #rng
- schema=SiSU_Env::SystemCall.new(rnc_src,rng_file)
- schema.relaxng(@opt.selections.str)
- #rnc
- if FileTest.file?(rnc_src)
- FileUtils::cp(rnc_src,rnc_file)
- FileUtils::chmod(0644,rnc_file)
- else STDERR.puts %{\t*WARN* did not find rnc - "#{rnc_src}" [#{__FILE__}:#{__LINE__}]}
- end
- end
- def trang_rnc_model_output_dom
- s=@suffix
- rnc_src=@env.processing_path.ao + '/dom.' + s[:rnc]
- rnc_file=@path[:rnc] + '/' + @rxng.rnc_name.output_dom
- rng_file=@path[:rng] + '/' + @rxng.rng_name.output_dom
- xsd_file=@path[:xsd] + '/' + @rxng.xsd_name.output_dom
- rnc=File.new(rnc_src,'w')
- rnc << @rxng.rnc_model_output_dom
- rnc.close
- #xsd
- schema=SiSU_Env::SystemCall.new(rnc_src,xsd_file)
- schema.relaxng(@opt.selections.str)
- #rng
- schema=SiSU_Env::SystemCall.new(rnc_src,rng_file)
- schema.relaxng(@opt.selections.str)
- #rnc
- if FileTest.file?(rnc_src)
- FileUtils::cp(rnc_src,rnc_file)
- FileUtils::chmod(0644,rnc_file)
- else STDERR.puts %{\t*WARN* did not find rnc - "#{rnc_src}" [#{__FILE__}:#{__LINE__}]}
- end
- end
- def trang_rnc_model_output_xhtml
- s=@suffix
- rnc_src=@env.processing_path.ao + '/xhtml.' + s[:rnc]
- rnc_file=@path[:rnc] + '/' + @rxng.rnc_name.output_xhtml
- rng_file=@path[:rng] + '/' + @rxng.rng_name.output_xhtml
- xsd_file=@path[:xsd] + '/' + @rxng.xsd_name.output_xhtml
- rnc=File.new(rnc_src,'w')
- rnc << @rxng.rnc_model_output_xhtml
- rnc.close
- #xsd
- schema=SiSU_Env::SystemCall.new(rnc_src,xsd_file)
- schema.relaxng(@opt.selections.str)
- #rng
- schema=SiSU_Env::SystemCall.new(rnc_src,rng_file)
- schema.relaxng(@opt.selections.str)
- #rnc
- if FileTest.file?(rnc_src)
- FileUtils::cp(rnc_src,rnc_file)
- FileUtils::chmod(0644,rnc_file)
- else STDERR.puts %{\t*WARN* did not find rnc - "#{rnc_src}" [#{__FILE__}:#{__LINE__}]}
- end
- end
- def trang_rnc_model_input_sax
- rnc_file=@env.processing_path.ao + '/sax.rnc'
- dtd_file=@path[:xsd] + '/' + @rxng.rng_name.input_sax
- rnc=File.new(rnc_file,'w')
- rnc << @rxng.rnc_model_output_sax
- rnc.close
- schema=SiSU_Env::SystemCall.new(rnc_file,dtd_file)
- schema.relaxng(@opt.selections.str)
- end
- def trang_rnc_model_input_dom
- rnc_file=@env.processing_path.ao + '/dom.rnc'
- dtd_file=@path[:xsd] + '/' + @rxng.rng_name.input_dom
- rnc=File.new(rnc_file,'w')
- rnc << @rxng.rnc_model_output_dom
- rnc.close
- schema=SiSU_Env::SystemCall.new(rnc_file,dtd_file)
- schema.relaxng(@opt.selections.str)
- end
- def trang_rnc_model_input_node
- rnc_file=@env.processing_path.ao + '/node.rnc'
- dtd_file=@path[:xsd] + '/' + @rxng.rng_name.input_node
- rnc=File.new(rnc_file,'w')
- rnc << @rxng.rnc_model_input_node
- rnc.close
- schema=SiSU_Env::SystemCall.new(rnc_file,dtd_file)
- schema.relaxng(@opt.selections.str)
- 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_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/dbi_discrete.rb b/lib/sisu/current/dbi_discrete.rb
deleted file mode 100644
index f62204c..0000000
--- a/lib/sisu/current/dbi_discrete.rb
+++ /dev/null
@@ -1,206 +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_discrete.rb;hb=HEAD>
-
-=end
-module SiSU_DBI_Discrete #% 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
- begin
- require 'fileutils'
- include FileUtils::Verbose
- rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
- error('fileutils NOT FOUND (LoadError)')
- end
- class SQL
- def initialize(opt)
- SiSU_Env::Load.new('sqlite3',true).prog
- @opt=opt
- @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)
- @md=@particulars.md
- if @opt.act[:sqlite][:set]==:on
- @sql_type=:sqlite
- if @opt.act[:maintenance][:set]==:on
- maintenance_check(@opt,__FILE__,__LINE__)
- end
- end
- @output_path=@md.file.output_path.sqlite_discrete.dir
- @filename=@md.file.base_filename.sqlite_discrete
- @file_maint=sql_maintenance_file
- @file="#{@output_path}/#{@filename}"
- end
- def build
- prepare
- create_and_populate
- end
- def maintenance_check(opt,file,line)
- #p opt.selections.str
- p "at #{file} #{line}"
- end
- def prepare
- if not FileTest.directory?(@output_path)
- FileUtils::mkdir_p(@output_path)
- elsif @file
- FileUtils::rm_rf(@file)
- end
- end
- def db_exist?(db,conn)
- msg=%{no connection with sqlite database established, createdb "#{db.sqlite.db}"?}
- if (not (FileTest.file?(db.sqlite.db)) \
- or FileTest.zero?(db.sqlite.db))
- puts msg
- exit
- end
- if conn.is_a?(NilClass)
- puts msg
- exit
- end
- end
- def create_and_populate
- db=SiSU_Env::DbOp.new(@md)
- conn=db.sqlite_discrete.conn_sqlite3
- sdb=SiSU_DbDBI::Create.new(@opt,conn,@file,:sqlite)
- sdb_index=SiSU_DbDBI::Index.new(@opt,conn,@file,:sqlite)
- sdb.output_dir?
- begin
- SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- 'SQLite (discrete)',
- "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}"
- ).green_title_hi unless @opt.act[:quiet][:set]==:on
- sdb.create_db
- sdb.create_table.metadata_and_text
- sdb.create_table.doc_objects
- sdb.create_table.endnotes
- sdb.create_table.endnotes_asterisk
- sdb.create_table.endnotes_plus
- sdb.create_table.urls
- sdb_index.create_indexes
- db_exist?(db,conn)
- sdb_import=SiSU_DbDBI::Import.new(@opt,conn,@file_maint,:sqlite)
- sdb_import.marshal_load
- tell=SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- "sqlite3 #{db.sqlite.db} database?"
- )
- tell.puts_grey if @opt.act[:verbose][:set]==:on
- rescue
- SiSU_Errors::Rescued.new($!,$@,'-d').location do
- __LINE__.to_s + ':' + __FILE__
- end
- sdb.output_dir?
- end
- end
- def read_sqlite
- begin
- begin
- require 'sqlite3'
- @conn=@db.sqlite.conn_sqlite3
- rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('sqlite3 not available')
- ensure
- Dir.chdir(@opt.f_pth[:pth])
- end
- end
- end
- def connect
- begin
- SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- "DBI (#{@sql_type}) #{@opt.selections.str}",
- @opt.fns
- ).dbi_title unless @opt.act[:quiet][:set]==:on
- @db.sqlite_discrete.conn_sqlite3
- rescue
- SiSU_Errors::Rescued.new($!,$@,@cf,@opt.fns).location do
- __LINE__.to_s + ':' + __FILE__
- end
- ensure
- end
- end
- def populate
- 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.fns.inspect =~/create/
- nil #sort variations later
- else nil
- end
- else nil
- end
- file
- 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_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/git.rb b/lib/sisu/current/git.rb
deleted file mode 100644
index b8b5f10..0000000
--- a/lib/sisu/current/git.rb
+++ /dev/null
@@ -1,277 +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/git.rb;hb=HEAD>
-
-=end
-module SiSU_Git
- require_relative 'dp' # dp.rb
- require_relative 'se' # se.rb
- require_relative 'ao' # ao.rb
- class Source
- def initialize(opt,process=:complete)
- @opt,@process=opt,process
- @env=SiSU_Env::InfoEnv.new
- @md=SiSU_Param::Parameters.new(@opt).get
- @file=SiSU_Env::FileOp.new(@md)
- l=SiSU_Env::StandardiseLanguage.new(@md.opt.lng).language
- unless @opt.lng==l[:c] # @md.i18n[0]==l[:c]
- p "using: #{@opt.lng} (@make: :language:); filename #{@md.fns} filename language: #{l[:c]}, mismatch"
- end
- if @env.output_dir_structure.multilingual?
- m=/((.+?)(?:\~\w{2,3})?)\.((?:-|ssm\.)?sst|ssm)$/ #watch added match for sss
- fnb,fnt=@opt.fns[m,2],@opt.fns[m,3]
- else m=/(.+?)\.((?:-|ssm\.)?sst|ssm)$/
- fnb=@fnn=@opt.fns[m,1]
- fnt=@opt.fns[m,2]
- end
- git_path_fnb=@env.processing_path.git + '/' + fnb
- lng=(@md.opt.lng) ? (@md.opt.lng) : (@md.i18n[0])
- @git_path={
- fnb: git_path_fnb,
- doc: git_path_fnb + '/' + Gt[:sisupod] + '/' + Gt[:doc] + '/' + lng,
- po: git_path_fnb + '/' + Gt[:po] + '/' + lng,
- pot: git_path_fnb + '/' + Gt[:pot],
- conf: git_path_fnb + '/' + Gt[:sisupod] + '/' + Gt[:conf],
- image: git_path_fnb + '/' + Gt[:sisupod] + '/' + Gt[:image],
- audio: git_path_fnb + '/' + Gt[:sisupod] + '/' + Gt[:audio],
- video: git_path_fnb + '/' + Gt[:sisupod] + '/' + Gt[:video],
- conf: git_path_fnb + '/' + Gt[:sisupod] + '/' + Gt[:conf]
- }
- SiSU_AO::Source.new(@opt,nil,@process).read # -m
- end
- def create_file_structure_git
- make_dir_fnb
- if program_found?
- git_init
- end
- end
- def read
- create_file_structure_git
- populate.sisusrc_files
- #if program_found?
- # git_commit
- #end
- unless @opt.act[:quiet][: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],
- 'Git path',
- @git_path[:fnb]
- ).green_hi_blue
- : SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- 'Git path',
- @git_path[:fnb]
- ).green_title_hi
- 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],
- "Git path",
- "#{@opt.fns} -> #{@git_path[:fnb]}"
- ).warn
- end
- end
- end
- def program_found?
- found=`whereis git`
- (found =~/bin\/git\b/) ? true : false
- end
- def make_dir_fnb
- FileUtils::mkdir_p(@git_path[:fnb]) \
- unless FileTest.directory?(@git_path[:fnb])
- FileUtils::mkdir_p(@git_path[:doc]) \
- unless FileTest.directory?(@git_path[:doc])
- FileUtils::mkdir_p(@git_path[:po]) \
- unless FileTest.directory?(@git_path[:po])
- FileUtils::mkdir_p(@git_path[:pot]) \
- unless FileTest.directory?(@git_path[:pot])
- FileUtils::mkdir_p(@git_path[:conf]) \
- unless FileTest.directory?(@git_path[:conf])
- FileUtils::mkdir_p(@git_path[:image]) \
- unless FileTest.directory?(@git_path[:image])
- #FileUtils::mkdir_p(@git_path[:audio]) \
- # unless FileTest.directory?(@git_path[:audio])
- #FileUtils::mkdir_p(@git_path[:video]) \
- # unless FileTest.directory?(@git_path[:video])
- end
- def git_init
- unless FileTest.directory?("#{@git_path[:fnb]}/.git")
- pwd=Dir.pwd
- Dir.chdir(@git_path[:fnb])
- system("git init ")
- Dir.chdir(pwd)
- end
- end
- def git_commit
- if program_found?
- if FileTest.directory?("#{@git_path[:fnb]}")
- pwd=Dir.pwd
- Dir.chdir(@git_path[:fnb])
- system("
- git add . \
- && git commit -a
- ")
- Dir.chdir(pwd)
- end
- end
- end
- def populate
- def identify_language_versions
- print __FILE__ + ':'
- p __LINE__
- end
- def copy_src_head
- if @opt.f_pth[:lng] \
- and File.exist?("#{@env.path.pwd}/#{@opt.f_pth[:lng]}/#{@opt.fns}")
- FileUtils::cp_r(
- "#{@env.path.pwd}/#{@opt.f_pth[:lng]}/#{@opt.fns}",
- @git_path[:doc]
- )
- elsif @opt.fns =~/\.ssm\.sst/
- ssm=@opt.fns.gsub(/\.ssm\.sst/,'.ssm')
- FileUtils::cp_r(
- "#{@env.path.pwd}/#{ssm}",
- @git_path[:doc]
- )
- elsif File.exist?("#{@env.path.pwd}/#{@opt.fns}")
- FileUtils::cp_r(
- "#{@env.path.pwd}/#{@opt.fns}",
- @git_path[:doc]
- )
- end
- end
- def copy_related_sst_ssi
- doc_import=[]
- @rgx_doc_import=/^<<\s(\S+?\.ss[ti])/
- file_array=IO.readlines(@opt.fns,'')
- file_array.each do |f|
- if f =~@rgx_doc_import
- doc_import = doc_import \
- + f.scan(@rgx_doc_import).uniq.flatten
- end
- end
- doc_import.each do |f|
- if @opt.f_pth[:lng]
- FileUtils::cp_r(
- "#{@env.path.pwd}/#{@opt.f_pth[:lng]}/#{f}",
- @git_path[:doc]
- )
- else
- FileUtils::cp_r(
- "#{@env.path.pwd}/#{f}",
- @git_path[:doc]
- )
- end
- end
- end
- def locate_parse_file
- composite_src=@opt.fns=~/\.ssm$/ ? true : false
- if composite_src \
- and not @opt.act[:ao][:set]==:on
- ##SiSU_Assemble::Composite.new(@opt).read
- #SiSU_AO::Source.new(@opt).read # -m
- @env.processing_path.composite_file \
- + '/' \
- + @opt.fnb \
- + '.ssm.sst'
- elsif composite_src
- @env.processing_path.composite_file \
- + '/' \
- + @opt.fnb \
- + '.ssm.sst'
- else
- @env.path.pwd
- + '/' \
- + @opt.fns
- end
- end
- def read_composite
- #print __FILE__ + ':'
- #p __LINE__
- end
- def sisuyaml_rc
- sisurc=@env.path.sisurc_path
- if FileTest.file?(sisurc)
- FileUtils::cp_r(sisurc,@git_path[:conf])
- end
- end
- def read_src
- print __FILE__ + ':'
- p __LINE__
- end
- def composite_src?
- @opt.fns=~/\.ssm$/ ? true : false
- end
- def sisusrc_files
- populate.copy_src_head
- if composite_src?
- populate.copy_related_sst_ssi
- end
- #parse_file_name=locate_parse_file
- #parse_file=IO.readlines(parse_file_name,'')
- populate.sisuyaml_rc #(parse_file)
- #populate.extract_composite_source
- #populate.read_composite # or read_each_composite
- populate.identify_language_versions
- end
- self
- end
- end
-end
-__END__
-@file.output_path.sisugit
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_concordance.rb b/lib/sisu/current/html_concordance.rb
deleted file mode 100644
index 3b3275e..0000000
--- a/lib/sisu/current/html_concordance.rb
+++ /dev/null
@@ -1,391 +0,0 @@
-# encoding: utf-8
-=begin
-
-* Name: SiSU
-
-** Description: documents, structuring, processing, publishing, search
-*** concordance file (html, wordmap, linked index of words in document)
-
-** 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_concordance.rb;hb=HEAD>
-
-=end
-module SiSU_Concordance
- require_relative 'se_hub_particulars' # se_hub_particulars.rb
- include SiSU_Particulars
- require_relative 'se' # se.rb
- include SiSU_Env
- require_relative 'html_format' # html_format.rb
- include SiSU_HTML_Format
- require_relative 'html_minitoc' # html_minitoc.rb
- class Source
- def initialize(opt)
- @opt=opt
- @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)
- end
- def read
- begin
- @env,@md=@particulars.env,@particulars.md
- @env.url.output_tell
- unless @md.opt.act[:quiet][:set]==:on
- tool=(@md.opt.act[:verbose][:set]==:on \
- || @md.opt.act[:verbose_plus][:set]==:on \
- || @md.opt.act[:maintenance][:set]==:on) \
- ? "#{@env.program.web_browser} #{@md.file.output_path.html_concordance.dir}/#{@md.file.base_filename.html_concordance}"
- : "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}"
- (@md.opt.act[:verbose][:set]==:on \
- || @md.opt.act[:verbose_plus][:set]==:on \
- || @md.opt.act[:maintenance][:set]==:on) \
- ? SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- "Concordance",
- tool
- ).green_hi_blue
- : SiSU_Screen::Ansi.new(
- @opt.act[:color_state][:set],
- 'Concordance',
- tool
- ).green_title_hi
- end
- wordmax=@env.concord_max
- unless @md.wc_words.nil?
- if @md.wc_words < wordmax
- SiSU_Concordance::Source::Words.new(@particulars).songsheet
- else
- SiSU_Screen::Ansi.new(
- @md.opt.act[:color_state][:set],
- "concordance skipped, large document has over #{wordmax} words (#{@md.wc_words})"
- ).warn unless @md.opt.act[:quiet][:set]==:on
- end
- else
- SiSU_Screen::Ansi.new(
- @md.opt.act[:color_state][:set],
- "wc (word count) is off, concordance will be processed for all files including those over the max set size of: #{wordmax} words"
- ).warn unless @md.opt.act[:quiet][:set]==:on
- SiSU_Concordance::Source::Words.new(@particulars).songsheet
- end
- rescue
- SiSU_Errors::Rescued.new($!,$@,@md.opt.selections.str,@md.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 DocTitle
- #revisit, both requires (html & xml_shared) needed for stand alone operation (sisu -w [filename])
- require_relative 'xml_shared' # xml_shared.rb
- require_relative 'html' # html.rb
- def initialize(particulars)
- @particulars,@md=particulars,particulars.md
- @data=SiSU_HTML::Source::HTML_Environment.new(particulars).tuned_file_instructions
- @file=SiSU_Env::FileOp.new(@md)
- @fnb=@md.fnb
- @lex_button=%{<a href="http://www.jus.uio.no/sisu/" target="_top"><img border="0" height="44" width="144" valign="center" src="#{@file.path_rel_links.html_seg_2}_sisu/image/sisu.png" alt="SiSU home --&gt;"></a>}
- @doc_details =<<WOK
-<table summary="links to text related to this rudimentary index" width="96%" border="0" cellpadding="0" align="center"><tr><td width="2%" align="right">&nbsp;</td><td width="94%" valign="top" align="justify"><h1 class="small"><a href="#{@md.file.base_filename.html_segtoc}"><b>#{@md.title.full}</b></a></h1><p class="bold">#{@md.author}</p></td></tr></table>
-WOK
- @make=SiSU_Env::ProcessingSettings.new(@md)
- end
- def create
- head_banner=SiSU_HTML_Format::HeadToc.new(@md)
- minitoc=SiSU_HTML_MiniToc::TocMini.new(@md,@data).songsheet.join("\n")
- stylesheet=SiSU_Style::CSS_HeadInfo.new(@md).stylesheet
- if @make.build.manifest_minitoc?
- toc='<div class="toc">' + minitoc + '</div>'
- div_class='content'
- else
- toc=''
- div_class='content0'
- end
- top_band=if @make.build.html_top_band?
- head_banner.concordance_navigation_band
- else ''
- end
- <<WOK
-<!DOCTYPE html>
-<html>
-<head>
- <meta charset="utf-8">
- <title>
- SiSU created WordIndex for: #{@md.title.full}
- </title>
- <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
- <meta name="Description" content="&nbsp;SiSU created">
- <meta name="keywords" content="word index for #{@md.title.full}">
- <meta name="generator" content="SiSU (Linux &amp; Ruby!)">
- <link rel="generator" href="http://www.jus.uio.no/sisu" />
- <link rel="shortcut icon" href="../_sisu/image/rb7.ico" />
- #{stylesheet.css_head_seg}
-</head>
-<body>
- #{top_band}
- #{toc}
-<div class="#{div_class}">
- #{@doc_details}
-<p>Word index links are to html versions of the text the segmented version followed by the scroll (single document) version.<br>[For segmented text references [T1], [T2] or [T3] appearing without a link, indicates that the word appears in a title (or subtitle) of the text (that is identifiable by the appended object citation number).]</p>
-<p>(The word listing/index is Case sensitive: Capitalized words appear before lower case)</p>
- <p>
- <b>word</b> (number of occurences)<br>linked references to word within document <br>
- [if number of occurences exceed number of references - word occurs more than once in at least one reference. Footnote/endnotes are either assigned to the paragraph from which they are referenced or ignored, so it is relevant to check the footnotes referenced from within a paragraph as well.]
- </p>
- <p>
- (After the page is fully loaded) you can jump directly to a word by appending a hash (#) and the word to the url for this text, (do not forget that words are case sensitive, and may be listed twice (starting with and without an upper case letter)), #your_word # [&nbsp;http://[web host]/#{@fnb}/concordance.html#your_word&nbsp;]
- </p>
-WOK
- end
- end
- class Word
- @@word_previous=''
- def initialize(word,freq)
- @word,@freq=word,freq
- end
- def html
- w=if @word.capitalize==@@word_previous
- %{\n<p class="concordance_word">#{@word}</p><p class="concordance_count">(#{@freq})</p>\n\t<p class="concordance_object"> }
- else n=@word.strip.gsub(/\s+/,'_') #also need to convert extended character set to html
- %{\n<p class="concordance_word"><a name="#{n}">#{@word}</a></p><p class="concordance_count">(#{@freq})</p>\n\t<p class="concordance_object"> }
- end
- @@word_previous=@word.capitalize
- w
- end
- end
- class Words
- require_relative 'i18n' # i18n.rb
- include SiSU_i18n
- require_relative 'html_format' # html_format.rb
- include SiSU_HTML_Format
- require_relative 'se' # se.rb
- include SiSU_Screen
- @@dp=nil
- def initialize(particulars)
- @particulars=particulars
- begin
- @env,@md,@ao_array=particulars.env,particulars.md,particulars.ao_array
- @file=SiSU_Env::FileOp.new(@md)
- @freq=Hash.new(0)
- @dp=@@dp ||=SiSU_Env::InfoEnv.new.digest.pattern
- @rxp_lv1=/^#{Mx[:lv_o]}1:/ #fix @rxp_lv # Mx[:lv_o]
- @rxp_lv2=/^#{Mx[:lv_o]}2:/ #fix @rxp_lv # Mx[:lv_o]
- @rxp_lv3=/^#{Mx[:lv_o]}3:/ #fix @rxp_lv # Mx[:lv_o]
- @rxp_title=Regexp.new("^#{Mx[:meta_o]}title#{Mx[:meta_c]}\s*(.+?)\s*$")
- @rxp_t1=Regexp.new('^T1')
- @rxp_t2=Regexp.new('^T2')
- @rxp_t3=Regexp.new('^T3')
- @rxp_excluded1=/#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/
- @rxp_excluded0=/^(?:#{Mx[:fa_bold_o]}|#{Mx[:fa_italics_o]})?(?:to\d+|\d+|&nbsp;|#{Mx[:br_endnotes]}|EOF|#{Mx[:br_eof]}|thumb_\S+|snap_\S+|_+|-+|[(]?(?:ii+|iv|vi+|ix|xi+|xiv|xv|xvi+|xix|xx)[).]?|\S+?_\S+|[\d_]+\w\S+|[\w\d]{1,2}|\d{1,3}\w?|#{@dp}|[0-9a-f]{16,64}|\d{2,3}x\d{2,3}|\S{0,2}sha\d|\S{0,3}\d{4}w\d\d|\b\w\d+|\d_all\b|e\.?g\.?)(?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})?$/mi #this regex causes and cures a stack dump in ruby 1.9 !!!
- @rgx_splitlist=%r{[—.,;:#{Mx[:nbsp]}-]}mi
- @alph=SiSU_i18n::Alphabet.new(@md.opt.lng).hash_arrays
- @alphlst=SiSU_i18n::Alphabet.new(@md.opt.lng).hash_strings
- @rgx_scanlist=%r{#{Mx[:fa_italics_o]}[#{@alphlst[:l]}#{@alphlst[:u]}0-9"\s]{2,12}#{Mx[:fa_italics_c]}|#{Mx[:fa_bold_o]}[#{@alphlst[:l]}#{@alphlst[:u]}0-9"\s]{2,12}#{Mx[:fa_bold_c]}|(?:https?|file)://\S+|<\S+?>|[#{@alphlst[:l]}#{@alphlst[:u]}]+|\w+}mi
- rescue
- SiSU_Errors::Rescued.new($!,$@,@md.opt.selections.str,@md.fns).location do
- __LINE__.to_s + ':' + __FILE__
- end
- end
- end
- def songsheet
- begin
- FileUtils::mkdir_p(@file.output_path.html_concordance.dir) \
- unless FileTest.directory?(@file.output_path.html_concordance.dir)
- @file_concordance=File.open(@file.place_file.html_concordance.dir,'w')
- map_para
- rescue
- SiSU_Errors::Rescued.new($!,$@,@md.opt.selections.str,@md.fns).location do
- __LINE__.to_s + ':' + __FILE__
- end
- ensure
- @file_concordance.close
- end
- end
- protected
- def location_scroll(wordlocation,show) # not used
- %{<a href="doc#{@md.lang_code_insert}#{Sfx[:html]}\##{Mx[:ocn_id_char]}#{wordlocation}">#{wordlocation}</a>; }
- end
- def location_seg(wordlocation,show)
- unless wordlocation.nil?
- wl=wordlocation.gsub(/(.+?)\#(\d+)/,
- "\\1#{@md.lang_code_insert}#{Sfx[:html]}##{Mx[:ocn_id_char]}\\2") # id="o\d+" always available; a name="\d+" not available if html strict used
- case wordlocation
- when /#{@rxp_t1}|@rxp_t2}|#{@rxp_t3}/
- %{[<a href="doc#{@md.lang_code_insert}#{Sfx[:html]}##{show}">H</a>]#{show}, }
- when /(.+?)\#(\d+)/
- %{<a href="#{wl}">#{show}</a>, }
- end
- end
- end
- def map_para
- @seg,ocn=nil,nil
- @word_map={}
- @ao_array.each do |line|
- if defined? line.ocn \
- and line.ocn.to_s =~/\d/
- if (line.is ==:heading \
- || line.is ==:heading_insert) \
- && line.ln==4
- @seg=line.name
- end
- ocn=line.ocn.to_s
- if ocn =~/\d+/ \
- and ocn !~/^0$/
- line.obj=line.obj.gsub(/#{@rxp_excluded1}/,' ')
- line.obj=line.obj.split(@rgx_splitlist).join(' ') #%take in word or other match
- for word in line.obj.scan(@rgx_scanlist) #%take in word or other match
- if word =~ /^([#{@alphlst[:l]}])/
- firstletter=$1
- flu=firstletter.tr(@alphlst[:l],@alphlst[:u])
- word=word.gsub(/^#{firstletter}/,flu )
- end
- word=word.gsub(/#{Mx[:lnk_o]}|#{Mx[:lnk_c]}|#{Mx[:url_o]}|#{Mx[:url_c]}/,'').
- gsub(/#{Mx[:fa_o]}\S+?#{Mx[:fa_o_c]}/,'').
- gsub(/#{Mx[:fa_c_o]}\S+?#{Mx[:fa_c]}/,'').
- gsub(/#{Mx[:gl_o]}#[a-z]+#{Mx[:gl_c]}/,'').
- gsub(/#{Mx[:gl_o]}#[0-9]+#{Mx[:gl_c]}/,'')
- word=word.gsub(/[0-9a-f]{10,}/,' ') if word =~/[0-9]/
- word=word.gsub(/#{Mx[:br_line]}/,' ').
- gsub(/^ +/,'').
- gsub(/^\S$/,'')
- word=nil if word.empty?
- word=nil if word =~@rxp_excluded0 #watch
- word=nil if word =~/^\S$/
- if word
- word=word.gsub(/#{Mx[:br_nl]}|#{Mx[:br_line]}/,' ').
- gsub(/#{Mx[:fa_o]}[a-z]{1,7}#{Mx[:fa_o_c]}|#{Mx[:fa_c_o]}[a-z]{1,7}#{Mx[:fa_c]}/,'').
- gsub(/#{Mx[:en_a_o]}(?:\d|[*+])*|#{Mx[:en_b_o]}(?:\d|[*+])*|#{Mx[:en_a_c]}|#{Mx[:en_b_c]}/mi,'').
- gsub(/#{Mx[:fa_o]}\S+?#{Mx[:fa_o_c]}/,'').
- gsub(/#{Mx[:fa_c_o]}\S+?#{Mx[:fa_c]}/,'').
- gsub(/<\/?\S+?>/,'').
- gsub(/^\@+/,'').
- strip.
- gsub(/#{Mx[:tc_p]}.+/,'').
- gsub(/[\.,;:"]$/,'').
- gsub(/["]/,'').
- gsub(/^\s*[\(]/,'').
- gsub(/[\(]\s*$/,'').
- gsub(/^(?:See|e\.?g\.?).+/,'').
- gsub(/^\s*[.,;:]\s*/,'').
- strip.
- gsub(/^\(?[a-zA-Z]\)$/,'').
- gsub(/^\d+(st|nd|rd|th)$/,'').
- gsub(/^(\d+\.?)+$/, '').
- gsub(/#{Mx[:mk_o]}|#{Mx[:mk_c]}/,'').
- gsub(/:name#\S+/,'').
- gsub(/^\S$/,'')
- word=nil if word =~/^\S$/
- word=nil if word =~/^\s*$/ #watch
- if word
- unless word =~/[A-Z][A-Z]/ \
- or word =~/\w+\s\w+/
- word=word.capitalize
- end
- @freq[word] +=1
- @word_map[word] ||= []
- if line !~ /#{@rxp_lv1}|#{@rxp_lv2}|#{@rxp_lv3}/
- loc_=%{#{location_seg("#{@seg}\##{ocn}",ocn).to_s}}
- unless loc_.empty?
- @word_map[word] << loc_
- end
- else
- @word_map[word] << case line
- when @rxp_lv1 then location_seg('T1',ocn) #fix @rxp_lv # Mx[:lv_o]
- when @rxp_lv2 then location_seg('T2',ocn) #fix @rxp_lv # Mx[:lv_o]
- when @rxp_lv3 then location_seg('T3',ocn) #fix @rxp_lv # Mx[:lv_o]
- end
- end
- end
- end
- end
- end
- end
- end
- seg=''
- head=SiSU_Concordance::Source::DocTitle.new(@particulars).create
- head=head.gsub(/#{Xx[:html_relative2]}/m,@file.path_rel_links.html_seg_2).
- gsub(/#{Xx[:html_relative1]}/m,@file.path_rel_links.html_seg_1)
- @file_concordance << head
- @file_concordance << '<p>'
- alph=@alph[:u]
- alph.each {|x| @file_concordance << %{<a href="##{x}">#{x}</a>,&nbsp;}}
- @file_concordance << '</p>'
- letter=alph.shift
- @file_concordance << %{\n<p class="letter"><a name="A">A</a></p>}
- for word in @freq.keys.sort! {|a,b| a.downcase<=>b.downcase}
- f=/^(\S)/.match(word)[1]
- if letter < f.upcase
- while letter < f.upcase
- if alph.length > 0
- letter=alph.shift
- @file_concordance << %{\n<p class="letter"><a name="#{letter}">#{letter}</a></p>}
- else break
- end
- end
- end
- keyword=SiSU_Concordance::Source::Word.new(word,@freq[word]).html
- if keyword !~ @rxp_excluded0
- if @word_map[word][0] =~ /\d+/
- @file_concordance << %{#{keyword}#{seg}#{@word_map[word].uniq.compact.join}}
- end
- @file_concordance << '</p>'
- end
- # special cases endnotes and header levels 1 - 3
- end
- @file_concordance << %{</div></body>\n</html>} # footer
- if @md.opt.act[:verbose_plus][:set]==:on \
- || @md.opt.act[:maintenance][:set]==:on
- SiSU_Screen::Ansi.new(
- @md.opt.act[:color_state][:set],
- @md.fns,
- "#{@md.file.output_path.html_concordance.dir}/#{@md.file.base_filename.html_concordance}"
- ).flow
- 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_author_format.rb b/lib/sisu/current/html_harvest_author_format.rb
deleted file mode 100644
index db71b01..0000000
--- a/lib/sisu/current/html_harvest_author_format.rb
+++ /dev/null
@@ -1,111 +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/harvest_author_format.rb;hb=HEAD>
-
-=end
-module SiSU_FormatAuthor
- class Author
- def initialize(author_param)
- @author_param=author_param
- end
- def author_details
- @authors,@author_array=[],[]
- authors=@author_param.scan(/[^;]+/)
- authors.each do |a|
- a=a.strip
- if a =~/"(.+?)"/
- @authors << { the: $1 }
- @author_array << $1.upcase
- else #if a =~/,/
- x=a.scan(/[^,]+/)
- x[0]=x[0].strip
- x[1]=x[1].strip if x[1]
- if x.length==1
- @authors << { the: x[0] }
- @author_array << x[0].upcase
- elsif x.length==2
- @authors << { the: x[0], others: x[1] }
- @author_array << "#{x[0].upcase}, #{x[1]}"
- else #p x.length
- end
- end
- end
- l = @authors.length
- authors_string=''
- @authors.each_with_index do |a,i|
- authors_string += if a[:others]
- if (l - i) > 1
- "#{a[:others]} #{a[:the]}, "
- else
- "#{a[:others]} #{a[:the]}"
- end
- else
- if (l - i) > 2
- "#{a[:the]}, "
- else
- "#{a[:the]}"
- end
- end
- end
- {
- last_first_a: authors,
- last_first_format_a: @author_array,
- authors_h: @authors,
- authors_s: authors_string,
- authors_param: @author_param
- }
- 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_minitoc.rb b/lib/sisu/current/html_minitoc.rb
deleted file mode 100644
index d2d890c..0000000
--- a/lib/sisu/current/html_minitoc.rb
+++ /dev/null
@@ -1,230 +0,0 @@
-# encoding: utf-8
-=begin
-
-* Name: SiSU
-
-** Description: documents, structuring, processing, publishing, search
-*** html minitoc
-
-** 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_minitoc.rb;hb=HEAD>
-
-=end
- module SiSU_HTML_MiniToc
- require_relative 'html_tune' # html_tune.rb
- include SiSU_HTML_Tune
- class TocMini
- @@seg_mini=nil
- @@seg_url=''
- @@firstseg=nil
- def initialize(md,data)
- @md,@data=md,data
- @pat_strip_heading_name=/<a name="h?\d.*?">(.+?)<\/a>/
- @tell=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set]) if @md
- end
- def songsheet
- 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
- @toc=[]
- @data.each do |txt|
- if txt.is ==:heading \
- || txt.is ==:heading_insert
- txt.obj=txt.obj.gsub(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]}).+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m,''). #remove endnotes from toc
- gsub(/<a name="-\d+" href="#_\d+">&nbsp;<sup>\d+<\/sup>&nbsp;<\/a>/,'').
- gsub(@pat_strip_heading_name,'\1')
- #gsub(/(.*?)<a name="(\d+)"><\/a>(.*)/,'\1') #2002w42 altered gsub - problematic? - suspect
- toc=case txt.ln
- when 0 then SiSU_HTML_MiniToc::TocMini.new(@md,txt).level_0
- when 1 then SiSU_HTML_MiniToc::TocMini.new(@md,txt).level_1
- when 2 then SiSU_HTML_MiniToc::TocMini.new(@md,txt).level_2
- when 3 then SiSU_HTML_MiniToc::TocMini.new(@md,txt).level_3
- when 4 then SiSU_HTML_MiniToc::TocMini.new(@md,txt).level_4
- when 5 then SiSU_HTML_MiniToc::TocMini.new(@md,txt).level_5
- when 6 then SiSU_HTML_MiniToc::TocMini.new(@md,txt).level_6
- else
- end
- @toc << toc
- end
- end
- @toc
- end
- protected
- def level_concordance
- format_head_toc=SiSU_HTML_Format::HeadToc.new(@md)
- @@seg_mini << format_head_toc.mini_seg_concordance
- end
- def level_metadata
- format_head_toc=SiSU_HTML_Format::HeadToc.new(@md)
- @@seg_mini << format_head_toc.mini_seg_metadata
- end
- def level_word_index
- format_head_toc=SiSU_HTML_Format::HeadToc.new(@d0c)
- @@seg_mini << format_head_toc.mini_concordance
- end
- def level_0
- txt=@data
- if (txt.is ==:heading \
- || txt.is ==:heading_insert) \
- && txt.ocn !=0
- txt.obj=txt.obj.gsub(@pat_strip_heading_name,'\1')
- end
- txt_obj={ txt: txt.obj }
- format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj)
- toc_mini=format_toc.mini_lev0
- toc_mini
- end
- def level_1
- txt=@data
- if (txt.is ==:heading \
- || txt.is ==:heading_insert) \
- && txt.ocn !=0
- txt.obj=txt.obj.gsub(@pat_strip_heading_name,'\1')
- end
- title=unless txt.obj =~/Document Information/ then txt.obj
- else
- link='metadata'
- %{<b><a href="#{link}#{@md.lang_code_insert}#{Sfx[:html]}">#{txt.obj}</a></b>}
- end
- txt_obj={ txt: title }
- format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj)
- toc_mini=if txt.name =~/^meta/ \
- and txt.obj=~/Document Information/
- format_toc.mini_tail
- else format_toc.mini_lev1
- end
- toc_mini
- end
- def level_2
- txt=@data
- if (txt.is ==:heading \
- || txt.is ==:heading_insert) \
- && txt.ocn !=0
- txt.obj=txt.obj.gsub(@pat_strip_heading_name,'\1')
- end
- txt_obj={ txt: txt.obj }
- format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj)
- toc_mini=format_toc.mini_lev2
- toc_mini
- end
- def level_3
- txt=@data
- txt_obj={ txt: txt.obj }
- format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj)
- toc_mini=format_toc.mini_lev3
- toc_mini
- end
- def level_4
- txt=@data
- unless txt =~/~metadata/
- if txt.ln ==4
- fnh={
- fn: txt.name,
- }
- f=@md.file.base_filename.html_seg(fnh)
- seg_link=%{ <a href="#{f}" target="_top">
- #{txt.obj}
- </a> }
- @@seg_url=txt.name
- elsif txt.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
- txt_obj={ txt: seg_link }
- format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj)
- toc_mini=format_toc.mini_lev4
- toc_mini
- end
- end
- def level_5
- txt=@data
- if (txt.is ==:heading \
- || txt.is ==:heading_insert) \
- && txt.ocn !=0
- txt.obj=txt.obj.gsub(@pat_strip_heading_name,'\1')
- end
- fnh={
- fn: @@seg_url,
- }
- f=@md.file.base_filename.html_seg(fnh)
- lnk_n_txt=%{ <a href="#{f}##{txt.ocn}">
- #{txt.obj}
- </a>}
- txt_obj={ txt: lnk_n_txt }
- format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj)
- toc_mini=format_toc.mini_lev5
- toc_mini
- end
- def level_6
- txt=@data
- if (txt.is ==:heading \
- || txt.is ==:heading_insert) \
- && txt.ocn !=0
- txt.obj=txt.obj.gsub(@pat_strip_heading_name,'\1')
- end
- fnh={
- fn: @@seg_url,
- }
- f=@md.file.base_filename.html_seg(fnh)
- lnk_n_txt=%{ <a href="#{f}##{txt.ocn}">
- #{txt.obj}
- </a>}
- txt_obj={ txt: lnk_n_txt }
- format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj)
- toc_mini=format_toc.mini_lev6
- toc_mini
- end
- end
- end
-__END__
diff --git a/lib/sisu/current/html_parts.rb b/lib/sisu/current/html_parts.rb
deleted file mode 100644
index ae828ed..0000000
--- a/lib/sisu/current/html_parts.rb
+++ /dev/null
@@ -1,437 +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_parts.rb;hb=HEAD>
-
-=end
-module SiSU_Parts_HTML
- require_relative 'generic_parts' # generic_parts.rb
- include SiSU_Parts_Generic
- def the_line_break
- '<br>'
- end
- def the_table_close
- '</td></tr>
-</table>'
- end
- def the_table_cellpad_box
- '"20"'
- end
- def the_color
- def white
- '#ffffff'
- end
- def black
- '#000000'
- end
- def grey_pale
- '#eeeeee'
- end
- def grey_medium
- '#cccccc'
- end
- def grey
- '#999999'
- end
- def blue_ink
- '#003399'
- end
- def blue_tinge
- '#e3ecef'
- end
- def yellow_light
- '#fff3b6'
- end
- def table1
- 'ffffcc'
- end
- def table2
- 'c0d0f0'
- end
- def band1
- %{"#{white}"}
- end
- def band2
- %{"#{white}"}
- end
- self
- end
- def the_url_decoration
- #def tex_open #'{\UseTextSymbol{OML}{<}}'
- # Dx[:url_o]
- #end
- #def tex_close #'{\UseTextSymbol{OML}{>}}'
- # Dx[:url_c]
- #end
- def xml_open #'&lt;'
- Dx[:url_o]
- end
- def xml_close #'&gt;'
- Dx[:url_c]
- end
- def txt_open
- '<'
- end
- def txt_close
- '>'
- end
- self
- end
- def the_width
- def table1
- '"100%"'
- end
- def table2
- '"99%"'
- end
- def table_txt
- '"94%"'
- end
- def table_txt_r
- '"96%"'
- end
- self
- end
- def the_png
- def _url_path_image_base #used for html image display
- "#{Xx[:html_relative2]}_sisu/image"
- end
- def ico
- %{ <link rel="shortcut icon" href="../_sisu/image/#{the_icon.i_ico}" />}
- end
- def png_home
- %{<img border="0" src="#{_url_path_image_base}/#{the_icon.home_button}" alt="#{the_text.home} --&gt;" />}
- end
- def png_home_button
- rel=@dir.path_rel_links.html_scroll_2
- %{<img border="0" src="#{rel}/#{the_icon.home_button}" alt="#{the_text.home} --&gt;" />}
- end
- self
- end
- def the_font
- def set_fonts
- 'verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman'
- #'verdana, arial, georgia, tahoma, sans-serif, helvetica, "times new roman", times, roman'
- end
- def set_face
- %{face="#{set_fonts}"}
- end
- def set_color
- 'color="#000000"'
- end
- def set_size_endnote
- 'size="3"'
- end
- def set_small
- 'size="3"'
- end
- def set_tiny
- 'size="2"'
- end
- def paragraph_font_tiny
- %{<font #{set_tiny} #{set_face}>}
- end
- def paragraph_font_small
- %{<font #{set_small} #{set_face}>}
- end
- self
- end
- def the_nav
- def txt_homepage
- %{ <font face="#{the_font.set_fonts}" size="2">
- &nbsp;home&nbsp;
- </font> }
- end
- def txt_toc_link
- %{ <font face="#{the_font.set_fonts}" size="2">
- &nbsp;&nbsp;toc&nbsp;
- </font> }
- end
- def txt_doc_link
- %{ <font face="#{the_font.set_fonts}" size="2">
- &nbsp;scroll&nbsp;
- </font> }
- end
- def txt_manifest
- #{png_manifest}&nbsp;document&nbsp;manifest
- %{ <font face="#{the_font.set_fonts}" size="2">
- [&nbsp;document&nbsp;manifest&nbsp;]
- </font> }
- end
- def txt_concordance
- %{ <font face="#{the_font.set_fonts}" size="2">
- &nbsp;&nbsp;A-Z&nbsp;
- </font> }
- end
- self
- end
- def the_banner
- def home_button_only
- %{<a href="#{url.site}/">
- #{the_png.png_home_button}
- </a>}
- end
- def banner_band
- %{<table summary="home button" width="100%" border="0" cellpadding="3" align="center">
-<tr><td align="left" valign="middle">
- <a href="#{url.site}/" target="_top">
- #{the_png.png_home}
- </a>
-</td>
-<td width="90%">
-#{the_table_close}}
- end
- def instrument_cover_band_scr
- '<table summary="scroll instrument cover band" width="100%" border="0" cellpadding="8" align="center">
-<tr><td align="center">'
- end
- def instrument_cover_band_seg
- '<table summary="segment instrument cover band, title, author, location" width="100%" border="0" cellpadding="8" align="center">
-<tr><td align="center">'
- end
- self
- end
- def the_margin
- def txt_0
- %{<table summary="" width=#{the_width.table_txt} border="0" cellpadding="2" align="center">
-<tr><td width=#{indent_level_0} align="right">
-</td><td valign="top" align="justify">}
- end
- def txt_1
- %{<table summary="" width=#{the_width.table_txt} border="0" cellpadding="2" align="center">
-<tr><td width=#{indent_level_1} align="right"></td><td valign="top" align="justify">}
- end
- def txt_2
- %{<table summary="" width=#{the_width.table_txt} border="0" cellpadding="2" align="center">
-<tr><td width=#{indent_level_2} align="right">
-</td>
-<td valign="top" align="justify">}
- end
- def txt_3
- %{<table summary="" width=#{the_width.table_txt} border="0" cellpadding="2" align="center">
-<tr><td width=#{indent_level_3} align="right">
-</td>
-<td valign="top" align="justify">}
- end
- def css
- '<table summary="normal text css" width="100%" border="0" cellpadding="2" align="center">
-<tr><td valign="top" align="justify"> '
- end
- def num
- '</p> </td><td width="4%" align="right" valign="top">'
- end
- def numless
- '</td><td width="4%" align="right" valign="top">'
- end
- def num_css
- '</td>
-<td width="2%" align="right" valign="top"> '
- end
- self
- end
-end
-module SiSU_Proj_HTML
- require_relative 'se' # se.rb
- include SiSU_Env
- #require_relative 'css' # css.rb
- # include SiSU_Style
- class Bits
- include SiSU_Parts_HTML
- def initialize
- @v=SiSU_Env::InfoVersion.instance.get_version
- #@dir=SiSU_Env::InfoEnv.new
- #@date=SiSU_Env::InfoDate.new #{@date.year}
- end
- def txt_generator
- %{ <meta name="generator" content="#{@v.project} #{@v.version} of #{@v.date_stamp} (#{@v.date}) (n*x and Ruby!)" />
- <link rel="generator" href="http://www.sisudoc.org/" />}
- end
- def widget_sisu_text
-<<WOK
- <p class="tiny"><font color="#666666" size="2">
- Output generated by
- <a href="#{the_url.sisu}">
- #{@v.project}
- </a>
- #{@v.version} #{@v.date} (#{@v.date_stamp})
- </font></p>
-WOK
- end
- def credits_sisu_manifest
- widget_sisu_text
- end
- def widget_sisu
-<<WOK
-<!-- widget sisu -->
-<tr><td valign="top" width="100%">
-<!-- SiSU Rights -->
-#{widget_sisu_text}
-</td></tr>
-WOK
- end
- def credits_sisu
- %{<div class="substance">
-<table summary="SiSU summary" cellpadding="4" border="0">
-<tr><td>
- #{widget_sisu}
-</table></div>}
- ''
- end
- def widget_promo # Array used to build promo from list.yml and promo.yml
- # ['sisu_icon','sisu','sisu_search_libre','open_society','fsf','ruby']
- end
- end
- class Home
- def initialize
- @v=SiSU_Env::InfoVersion.instance.get_version
- @dir=SiSU_Env::InfoEnv.new
- @date=SiSU_Env::InfoDate.new #{@date.year}
- end
- def redirect
- <<WOK
-<html><head>
-<title>SiSU</title>
-<meta http-equiv="refresh" content="0, url=http://www.sisudoc.org/sisu/SiSU/">
-</head>
-<body>
-SiSU informtion provided at <a href="http://www.sisudoc.org/sisu/SiSU/">www.sisudoc.org/sisu/SiSU</a><p />
-If your browser supports redirection, you will be escorted there shortly.
-</body>
-</html>
-WOK
- end
- def homepage
- <<WOK
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
-<title>SiSU information Structuring Universe - Structured information, Serialized Units - software for electronic texts, documents, books, digital libraries in plaintext, HTML, EPUB, XHTML, XML, ODF (OpenDocument), LaTeX, PDF, SQL (PostgreSQL and SQLite), and for search</title>
-<meta name="dc.title" content="SiSU - SiSU information Structuring Universe, Structured information Serialised Units, #{@date.year_static}" />
-<meta name="dc.creator" content="Ralph Amissah" />
-<meta name="dc.subject" content= "document structuring, ebook, publishing, PDF, LaTeX, XML, ODF, EPUB, SQL, postgresql, sqlite, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, granular search, digital library" />
-<meta name="dc.publisher" content= "SiSU http://www.sisudoc.org/" />
-<meta name="dc.language" content="en" />
-<meta name="dc.rights" content="Copyright Ralph Amissah" />
-<meta name="generator" content="#{@v.project} #{@v.version} of #{@v.date_stamp} (#{@v.date}) (n*x and Ruby!)" />
-<link rel="generator" href="http://www.sisudoc.org/" />
-<link rel="stylesheet" href="./#{@dir.path.style}/harvest.css" type="text/css" />
-<link rel="shortcut icon" href="./_sisu/image/rb7.ico" />
-</head>
-
-<body lang="en" xml:lang="en">
-<a name="top" id="top"></a>
-<a name="up" id="up"></a>
-<a name="start" id="start"></a>
-
-<h1>SiSU</h1>
-<p>
-[<a href="http://sisudoc.org/sisu_manual/en/html/sisu/toc.html">Manual</a>]
-</p>
-<p>
-[<a href="http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary">Source</a>]
-[<a href="http://lists.sisudoc.org/listinfo/sisu">List Info (sisu@lists.sisudoc.org)</a>]
-</p>
-
-<h1>SiSU Markup Samples</h1>
-<p>
-[<a href="http://git.sisudoc.org/gitweb/?p=doc/sisu-markup-samples.git;a=summary">Source</a>]
-[<a href="http://sisudoc.org/sisu_markup_samples.html">Output</a>]
-</p>
-
-<hr />
-
-<h2 class="top_band_tiny">
- Structured information, Serialized Units
- &nbsp;&nbsp;
- <a href="http://www.sisudoc.org" target="_top">
- &lt;www.sisudoc.org&gt;
- </a>
- &nbsp;&nbsp;or&nbsp;&nbsp;
- <a href="http://www.jus.uio.no/sisu/" target="_top">
- &lt;www.jus.uio.no/sisu/&gt;
- </a>
-software for electronic texts, document collections, books, digital libraries &amp; search, with "atomic search" &amp; text locating system (shared object citation numbering: "<i>ocn</i>").
-Outputs include: plaintext, HTML, EPUB, ODT (OpenDocumentText), (XHTML, XML,) LaTeX, PDF, SQL (PostgreSQL and SQLite).
-</h2>
-<p class="small">
-<a href="mailto:sisu@lists.sisudoc.org">
-&lt;sisu@lists.sisudoc.org&gt;
-</a>
-<a href="http://lists.sisudoc.org/listinfo/sisu">
-&lt;http://lists.sisudoc.org/listinfo/sisu&gt;
-</a>
-</p>
-<p class="small">
-<a href="mailto:ralph@amissah.com">
-&lt;ralph@amissah.com&gt;
-</a>
-<a href="mailto:ralph.amissah@gmail.com">
-&lt;ralph.amissah@gmail.com&gt;
-</a>
-</p>
-<p class="tiny">
-#{@v.project} #{@v.version} of #{@v.date_stamp} (#{@v.date}) (n*x and Ruby!), #{@date.year_static}.
-</p>
-<p class="tiny">
-w3 since October 3 1993.
-</p>
-</body>
-</html>
-WOK
- end
- def home_toc
- ' '
- end
- end
-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