aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG34
l---------CHANGELOGS/CHANGELOG_v11
l---------CHANGELOGS/CHANGELOG_v21
l---------CHANGELOGS/CHANGELOG_v31
l---------CHANGELOGS/CHANGELOG_v41
l---------CHANGELOG_v11
l---------CHANGELOG_v21
l---------CHANGELOG_v31
-rw-r--r--README29
-rw-r--r--bin/sisu113
-rw-r--r--bin/sisu-git2
-rw-r--r--bin/sisu-po2
-rw-r--r--bin/sisu-webrick2
-rw-r--r--bin/sisu2136
l---------[-rw-r--r--]bin/sisu3137
l---------bin/sisu41
-rw-r--r--bin/sisu_termsheet148
-rw-r--r--bin/sisu_webrick135
-rw-r--r--conf/sisu/v4/sisurc.yml (renamed from conf/sisu/v2/sisurc.yml)28
-rw-r--r--data/doc/sisu/CHANGELOG_v15
-rw-r--r--data/doc/sisu/CHANGELOG_v225
-rw-r--r--data/doc/sisu/CHANGELOG_v36
-rw-r--r--data/doc/sisu/CHANGELOG_v470
-rw-r--r--data/doc/sisu/html/sisu.1.html9352
-rw-r--r--data/doc/sisu/html/sisu4.1.html3693
-rw-r--r--data/doc/sisu/markup-samples/README8
-rw-r--r--data/doc/sisu/markup-samples/sisu_manual/sisu_hyperestraier.ssi95
-rw-r--r--data/doc/sisu/markup-samples/v3/samples/_sisu/image/Gnu_Debian_Linux_Ruby_Way_Better.png (renamed from data/doc/sisu/markup-samples/samples/_sisu/image/Gnu_Debian_Linux_Ruby_Way_Better.png)bin37629 -> 37629 bytes
-rw-r--r--data/doc/sisu/markup-samples/v3/samples/_sisu/image/b_doc.png (renamed from data/doc/sisu/markup-samples/samples/_sisu/image/b_doc.png)bin274 -> 274 bytes
-rw-r--r--data/doc/sisu/markup-samples/v3/samples/_sisu/image/c_Copyleft.png (renamed from data/doc/sisu/markup-samples/samples/_sisu/image/c_Copyleft.png)bin668 -> 668 bytes
-rw-r--r--data/doc/sisu/markup-samples/v3/samples/_sisu/image/c_Euro.png (renamed from data/doc/sisu/markup-samples/samples/_sisu/image/c_Euro.png)bin514 -> 514 bytes
-rw-r--r--data/doc/sisu/markup-samples/v3/samples/_sisu/image/debian_home.png (renamed from data/doc/sisu/markup-samples/samples/_sisu/image/debian_home.png)bin7746 -> 7746 bytes
-rw-r--r--data/doc/sisu/markup-samples/v3/samples/_sisu/image/free_as_in_freedom.png (renamed from data/doc/sisu/markup-samples/samples/_sisu/image/free_as_in_freedom.png)bin31223 -> 31223 bytes
-rw-r--r--data/doc/sisu/markup-samples/v3/samples/_sisu/image/free_as_in_freedom_01_rms.png (renamed from data/doc/sisu/markup-samples/samples/_sisu/image/free_as_in_freedom_01_rms.png)bin81111 -> 81111 bytes
-rw-r--r--data/doc/sisu/markup-samples/v3/samples/_sisu/image/free_as_in_freedom_02_rms_snr_year_report.png (renamed from data/doc/sisu/markup-samples/samples/_sisu/image/free_as_in_freedom_02_rms_snr_year_report.png)bin65996 -> 65996 bytes
-rw-r--r--data/doc/sisu/markup-samples/v3/samples/_sisu/image/free_as_in_freedom_03_rms_st_ignucius.png (renamed from data/doc/sisu/markup-samples/samples/_sisu/image/free_as_in_freedom_03_rms_st_ignucius.png)bin34409 -> 34409 bytes
-rw-r--r--data/doc/sisu/markup-samples/v3/samples/_sisu/image/free_as_in_freedom_04_rms_pleasure_card.png (renamed from data/doc/sisu/markup-samples/samples/_sisu/image/free_as_in_freedom_04_rms_pleasure_card.png)bin17364 -> 17364 bytes
-rw-r--r--data/doc/sisu/markup-samples/v3/samples/_sisu/image/free_as_in_freedom_2_01_pdp_1_processor_with_kl_10.png (renamed from data/doc/sisu/markup-samples/samples/_sisu/image/free_as_in_freedom_2_01_pdp_1_processor_with_kl_10.png)bin242735 -> 242735 bytes
-rw-r--r--data/doc/sisu/markup-samples/v3/samples/_sisu/image/free_as_in_freedom_2_02_rms_st_ignucius.png (renamed from data/doc/sisu/markup-samples/samples/_sisu/image/free_as_in_freedom_2_02_rms_st_ignucius.png)bin187827 -> 187827 bytes
-rw-r--r--data/doc/sisu/markup-samples/v3/samples/_sisu/image/levitating_gnu.png (renamed from data/doc/sisu/markup-samples/samples/_sisu/image/levitating_gnu.png)bin66279 -> 66279 bytes
-rw-r--r--data/doc/sisu/markup-samples/v3/samples/_sisu/image/philosophical_gnu.png (renamed from data/doc/sisu/markup-samples/samples/_sisu/image/philosophical_gnu.png)bin2695 -> 2695 bytes
-rw-r--r--data/doc/sisu/markup-samples/v3/samples/_sisu/image/sisu.png (renamed from data/doc/sisu/markup-samples/samples/_sisu/image/sisu.png)bin3260 -> 3260 bytes
-rw-r--r--data/doc/sisu/markup-samples/v3/samples/_sisu/skin/dir/skin_sisu.rb (renamed from data/doc/sisu/markup-samples/samples/_sisu/skin/dir/skin_sisu.rb)0
-rw-r--r--data/doc/sisu/markup-samples/v3/samples/_sisu/skin/doc/skin_gnu.rb (renamed from data/doc/sisu/markup-samples/samples/_sisu/skin/doc/skin_gnu.rb)0
-rw-r--r--data/doc/sisu/markup-samples/v3/samples/_sisu/skin/doc/skin_rms.rb (renamed from data/doc/sisu/markup-samples/samples/_sisu/skin/doc/skin_rms.rb)0
-rw-r--r--data/doc/sisu/markup-samples/v3/samples/_sisu/skin/doc/skin_rms2.rb (renamed from data/doc/sisu/markup-samples/samples/_sisu/skin/doc/skin_rms2.rb)0
-rw-r--r--data/doc/sisu/markup-samples/v3/samples/_sisu/skin/site/skin_sisu.rb (renamed from data/doc/sisu/markup-samples/samples/_sisu/skin/site/skin_sisu.rb)0
-rw-r--r--data/doc/sisu/markup-samples/v3/samples/_sisu/skin/yml/list.yml (renamed from data/doc/sisu/markup-samples/samples/_sisu/skin/yml/list.yml)0
-rw-r--r--data/doc/sisu/markup-samples/v3/samples/_sisu/skin/yml/promo.yml (renamed from data/doc/sisu/markup-samples/samples/_sisu/skin/yml/promo.yml)0
-rw-r--r--data/doc/sisu/markup-samples/v3/samples/_sisu/skin/yml/skin_countries.yml (renamed from data/doc/sisu/markup-samples/samples/_sisu/skin/yml/skin_countries.yml)0
-rw-r--r--data/doc/sisu/markup-samples/v3/samples/_sisu/skin/yml/skin_country.yml (renamed from data/doc/sisu/markup-samples/samples/_sisu/skin/yml/skin_country.yml)0
-rw-r--r--data/doc/sisu/markup-samples/v3/samples/free_as_in_freedom.richard_stallman_crusade_for_free_software.sam_williams.sst2474
-rw-r--r--data/doc/sisu/markup-samples/v3/samples/free_as_in_freedom_2.richard_stallman_and_the_free_software_revolution.sam_williams.richard_stallman.sst (renamed from data/doc/sisu/markup-samples/samples/free_as_in_freedom_2.richard_stallman_and_the_free_software_revolution.sam_williams.richard_stallman.sst)16
-rw-r--r--data/doc/sisu/markup-samples/v3/samples/sisu_output_overview.ssi (renamed from data/doc/sisu/markup-samples/samples/sisu_output_overview.ssi)0
-rw-r--r--data/doc/sisu/markup-samples/v3/sisu_manual/_sisu/image/GnuDebianLinuxRubyBetterWay.png (renamed from data/doc/sisu/markup-samples/sisu_manual/_sisu/image/GnuDebianLinuxRubyBetterWay.png)bin33396 -> 33396 bytes
-rw-r--r--data/doc/sisu/markup-samples/v3/sisu_manual/_sisu/image/ruby_logo.png (renamed from data/doc/sisu/markup-samples/sisu_manual/_sisu/image/ruby_logo.png)bin8634 -> 8634 bytes
-rw-r--r--data/doc/sisu/markup-samples/v3/sisu_manual/_sisu/image/sisu.home.png (renamed from data/doc/sisu/markup-samples/sisu_manual/_sisu/image/sisu.home.png)bin3260 -> 3260 bytes
-rw-r--r--data/doc/sisu/markup-samples/v3/sisu_manual/_sisu/image/sisu.png (renamed from data/doc/sisu/markup-samples/sisu_manual/_sisu/image/sisu.png)bin3260 -> 3260 bytes
-rw-r--r--data/doc/sisu/markup-samples/v3/sisu_manual/_sisu/image/tux.png (renamed from data/doc/sisu/markup-samples/sisu_manual/_sisu/image/tux.png)bin6297 -> 6297 bytes
-rw-r--r--data/doc/sisu/markup-samples/v3/sisu_manual/_sisu/skin/yml/list.yml (renamed from data/doc/sisu/markup-samples/sisu_manual/_sisu/skin/yml/list.yml)0
-rw-r--r--data/doc/sisu/markup-samples/v3/sisu_manual/_sisu/skin/yml/promo.yml (renamed from data/doc/sisu/markup-samples/sisu_manual/_sisu/skin/yml/promo.yml)0
-rw-r--r--data/doc/sisu/markup-samples/v3/sisu_manual/_sisu/v3/sisurc.yml (renamed from data/doc/sisu/markup-samples/sisu_manual/_sisu/v3/sisurc.yml)0
-rw-r--r--data/doc/sisu/markup-samples/v3/sisu_manual/sisu.ssm (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu.ssm)0
-rw-r--r--data/doc/sisu/markup-samples/v3/sisu_manual/sisu_commands.sst (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_commands.sst)20
-rw-r--r--data/doc/sisu/markup-samples/v3/sisu_manual/sisu_config.ssi (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_config.ssi)0
-rw-r--r--data/doc/sisu/markup-samples/v3/sisu_manual/sisu_content_directories.ssi (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_content_directories.ssi)0
-rw-r--r--data/doc/sisu/markup-samples/v3/sisu_manual/sisu_css.ssi (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_css.ssi)0
-rw-r--r--data/doc/sisu/markup-samples/v3/sisu_manual/sisu_description.sst (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_description.sst)44
-rw-r--r--data/doc/sisu/markup-samples/v3/sisu_manual/sisu_download.ssi (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_download.ssi)18
-rw-r--r--data/doc/sisu/markup-samples/v3/sisu_manual/sisu_examples.ssi (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_examples.ssi)0
-rw-r--r--data/doc/sisu/markup-samples/v3/sisu_manual/sisu_faq.sst (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_faq.sst)0
-rw-r--r--data/doc/sisu/markup-samples/v3/sisu_manual/sisu_filetypes.sst (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_filetypes.sst)0
-rw-r--r--data/doc/sisu/markup-samples/v3/sisu_manual/sisu_help.sst (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_help.sst)0
-rw-r--r--data/doc/sisu/markup-samples/v3/sisu_manual/sisu_help_sources.sst (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_help_sources.sst)0
-rw-r--r--data/doc/sisu/markup-samples/v3/sisu_manual/sisu_homepages.ssi (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_homepages.ssi)0
-rw-r--r--data/doc/sisu/markup-samples/v3/sisu_manual/sisu_how.ssi (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_how.ssi)0
-rw-r--r--data/doc/sisu/markup-samples/v3/sisu_manual/sisu_howto.sst (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_howto.sst)2
-rw-r--r--data/doc/sisu/markup-samples/v3/sisu_manual/sisu_installation.ssi (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_installation.ssi)0
-rw-r--r--data/doc/sisu/markup-samples/v3/sisu_manual/sisu_interesting_to_whom.ssi (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_interesting_to_whom.ssi)0
-rw-r--r--data/doc/sisu/markup-samples/v3/sisu_manual/sisu_introduction.sst (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_introduction.sst)11
-rw-r--r--data/doc/sisu/markup-samples/v3/sisu_manual/sisu_manual.ssm (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_manual.ssm)2
-rw-r--r--data/doc/sisu/markup-samples/v3/sisu_manual/sisu_markup.sst (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_markup.sst)3
-rw-r--r--data/doc/sisu/markup-samples/v3/sisu_manual/sisu_output_overview.sst (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_output_overview.sst)0
-rw-r--r--data/doc/sisu/markup-samples/v3/sisu_manual/sisu_postgresql.sst (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_postgresql.sst)0
-rw-r--r--data/doc/sisu/markup-samples/v3/sisu_manual/sisu_quickstart.sst (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_quickstart.sst)0
-rw-r--r--data/doc/sisu/markup-samples/v3/sisu_manual/sisu_remote.sst (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_remote.sst)0
-rw-r--r--data/doc/sisu/markup-samples/v3/sisu_manual/sisu_search.ssm (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_search.ssm)2
-rw-r--r--data/doc/sisu/markup-samples/v3/sisu_manual/sisu_search_cgi.ssi (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_search_cgi.ssi)3
-rw-r--r--data/doc/sisu/markup-samples/v3/sisu_manual/sisu_search_intro.ssi (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_search_intro.ssi)0
-rw-r--r--data/doc/sisu/markup-samples/v3/sisu_manual/sisu_short_feature_summary.ssi (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_short_feature_summary.ssi)0
-rw-r--r--data/doc/sisu/markup-samples/v3/sisu_manual/sisu_skin.sst (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_skin.sst)0
-rw-r--r--data/doc/sisu/markup-samples/v3/sisu_manual/sisu_sql.ssi (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_sql.ssi)0
-rw-r--r--data/doc/sisu/markup-samples/v3/sisu_manual/sisu_sqlite.sst (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_sqlite.sst)0
-rw-r--r--data/doc/sisu/markup-samples/v3/sisu_manual/sisu_synopsis.ssi (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_synopsis.ssi)0
-rw-r--r--data/doc/sisu/markup-samples/v3/sisu_manual/sisu_syntax_highlighting.sst (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_syntax_highlighting.sst)0
-rw-r--r--data/doc/sisu/markup-samples/v3/sisu_manual/sisu_webrick.sst (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_webrick.sst)0
-rw-r--r--data/doc/sisu/markup-samples/v3/sisu_manual/sisu_work_needed_and_wishlist.ssi (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_work_needed_and_wishlist.ssi)0
-rw-r--r--data/doc/sisu/markup-samples/v4/samples/_sisu/image/Gnu_Debian_Linux_Ruby_Way_Better.pngbin0 -> 37629 bytes
-rw-r--r--data/doc/sisu/markup-samples/v4/samples/_sisu/image/b_doc.pngbin0 -> 274 bytes
-rw-r--r--data/doc/sisu/markup-samples/v4/samples/_sisu/image/c_Copyleft.pngbin0 -> 668 bytes
-rw-r--r--data/doc/sisu/markup-samples/v4/samples/_sisu/image/c_Euro.pngbin0 -> 514 bytes
-rw-r--r--data/doc/sisu/markup-samples/v4/samples/_sisu/image/debian_home.pngbin0 -> 7746 bytes
-rw-r--r--data/doc/sisu/markup-samples/v4/samples/_sisu/image/free_as_in_freedom.pngbin0 -> 31223 bytes
-rw-r--r--data/doc/sisu/markup-samples/v4/samples/_sisu/image/free_as_in_freedom_01_rms.pngbin0 -> 81111 bytes
-rw-r--r--data/doc/sisu/markup-samples/v4/samples/_sisu/image/free_as_in_freedom_02_rms_snr_year_report.pngbin0 -> 65996 bytes
-rw-r--r--data/doc/sisu/markup-samples/v4/samples/_sisu/image/free_as_in_freedom_03_rms_st_ignucius.pngbin0 -> 34409 bytes
-rw-r--r--data/doc/sisu/markup-samples/v4/samples/_sisu/image/free_as_in_freedom_04_rms_pleasure_card.pngbin0 -> 17364 bytes
-rw-r--r--data/doc/sisu/markup-samples/v4/samples/_sisu/image/free_as_in_freedom_2_01_pdp_1_processor_with_kl_10.pngbin0 -> 242735 bytes
-rw-r--r--data/doc/sisu/markup-samples/v4/samples/_sisu/image/free_as_in_freedom_2_02_rms_st_ignucius.pngbin0 -> 187827 bytes
-rw-r--r--data/doc/sisu/markup-samples/v4/samples/_sisu/image/levitating_gnu.pngbin0 -> 66279 bytes
-rw-r--r--data/doc/sisu/markup-samples/v4/samples/_sisu/image/philosophical_gnu.pngbin0 -> 2695 bytes
-rw-r--r--data/doc/sisu/markup-samples/v4/samples/_sisu/image/sisu.pngbin0 -> 3260 bytes
-rw-r--r--data/doc/sisu/markup-samples/v4/samples/_sisu/sisu_document_make9
-rw-r--r--data/doc/sisu/markup-samples/v4/samples/free_as_in_freedom.richard_stallman_crusade_for_free_software.sam_williams.sst (renamed from data/doc/sisu/markup-samples/samples/free_as_in_freedom.richard_stallman_crusade_for_free_software.sam_williams.sst)131
-rw-r--r--data/doc/sisu/markup-samples/v4/samples/free_as_in_freedom_2.richard_stallman_and_the_free_software_revolution.sam_williams.richard_stallman.sst2548
-rw-r--r--data/doc/sisu/markup-samples/v4/samples/sisu_output_overview.ssi61
-rw-r--r--data/doc/sisu/markup-samples/v4/sisu_manual/_sisu/image/GnuDebianLinuxRubyBetterWay.pngbin0 -> 33396 bytes
-rw-r--r--data/doc/sisu/markup-samples/v4/sisu_manual/_sisu/image/ruby_logo.pngbin0 -> 8634 bytes
-rw-r--r--data/doc/sisu/markup-samples/v4/sisu_manual/_sisu/image/sisu.home.pngbin0 -> 3260 bytes
-rw-r--r--data/doc/sisu/markup-samples/v4/sisu_manual/_sisu/image/sisu.pngbin0 -> 3260 bytes
-rw-r--r--data/doc/sisu/markup-samples/v4/sisu_manual/_sisu/image/tux.pngbin0 -> 6297 bytes
-rw-r--r--data/doc/sisu/markup-samples/v4/sisu_manual/_sisu/sisu_document_make20
-rw-r--r--data/doc/sisu/markup-samples/v4/sisu_manual/_sisu/v4/sisurc.yml (renamed from data/doc/sisu/markup-samples/sisu_manual/_sisu/v2/sisurc.yml)28
-rw-r--r--data/doc/sisu/markup-samples/v4/sisu_manual/sisu.ssm73
-rw-r--r--data/doc/sisu/markup-samples/v4/sisu_manual/sisu_commands.sst421
-rw-r--r--data/doc/sisu/markup-samples/v4/sisu_manual/sisu_config.ssi75
-rw-r--r--data/doc/sisu/markup-samples/v4/sisu_manual/sisu_content_directories.ssi264
-rw-r--r--data/doc/sisu/markup-samples/v4/sisu_manual/sisu_css.ssi42
-rw-r--r--data/doc/sisu/markup-samples/v4/sisu_manual/sisu_description.sst527
-rw-r--r--data/doc/sisu/markup-samples/v4/sisu_manual/sisu_download.ssi133
-rw-r--r--data/doc/sisu/markup-samples/v4/sisu_manual/sisu_examples.ssi97
-rw-r--r--data/doc/sisu/markup-samples/v4/sisu_manual/sisu_faq.sst200
-rw-r--r--data/doc/sisu/markup-samples/v4/sisu_manual/sisu_filetypes.sst143
-rw-r--r--data/doc/sisu/markup-samples/v4/sisu_manual/sisu_help.sst95
-rw-r--r--data/doc/sisu/markup-samples/v4/sisu_manual/sisu_help_sources.sst108
-rw-r--r--data/doc/sisu/markup-samples/v4/sisu_manual/sisu_homepages.ssi39
-rw-r--r--data/doc/sisu/markup-samples/v4/sisu_manual/sisu_how.ssi26
-rw-r--r--data/doc/sisu/markup-samples/v4/sisu_manual/sisu_howto.sst1326
-rw-r--r--data/doc/sisu/markup-samples/v4/sisu_manual/sisu_installation.ssi368
-rw-r--r--data/doc/sisu/markup-samples/v4/sisu_manual/sisu_interesting_to_whom.ssi32
-rw-r--r--data/doc/sisu/markup-samples/v4/sisu_manual/sisu_introduction.sst55
-rw-r--r--data/doc/sisu/markup-samples/v4/sisu_manual/sisu_manual.ssm96
-rw-r--r--data/doc/sisu/markup-samples/v4/sisu_manual/sisu_markup.sst1268
-rw-r--r--data/doc/sisu/markup-samples/v4/sisu_manual/sisu_markup_syntax_history.sst260
-rw-r--r--data/doc/sisu/markup-samples/v4/sisu_manual/sisu_output_overview.sst142
-rw-r--r--data/doc/sisu/markup-samples/v4/sisu_manual/sisu_postgresql.sst82
-rw-r--r--data/doc/sisu/markup-samples/v4/sisu_manual/sisu_quickstart.sst256
-rw-r--r--data/doc/sisu/markup-samples/v4/sisu_manual/sisu_remote.sst88
-rw-r--r--data/doc/sisu/markup-samples/v4/sisu_manual/sisu_search.ssm35
-rw-r--r--data/doc/sisu/markup-samples/v4/sisu_manual/sisu_search_cgi.ssi75
-rw-r--r--data/doc/sisu/markup-samples/v4/sisu_manual/sisu_search_intro.ssi31
-rw-r--r--data/doc/sisu/markup-samples/v4/sisu_manual/sisu_short_feature_summary.ssi81
-rw-r--r--data/doc/sisu/markup-samples/v4/sisu_manual/sisu_sql.ssi50
-rw-r--r--data/doc/sisu/markup-samples/v4/sisu_manual/sisu_sqlite.sst82
-rw-r--r--data/doc/sisu/markup-samples/v4/sisu_manual/sisu_synopsis.ssi48
-rw-r--r--data/doc/sisu/markup-samples/v4/sisu_manual/sisu_syntax_highlighting.sst155
-rw-r--r--data/doc/sisu/markup-samples/v4/sisu_manual/sisu_webrick.sst59
-rw-r--r--data/doc/sisu/markup-samples/v4/sisu_manual/sisu_work_needed_and_wishlist.ssi59
-rw-r--r--data/sisu/v2/conf/convert/modify.rb272
-rw-r--r--data/sisu/v2/v/version.yml5
-rw-r--r--data/sisu/v4/conf/cgi-bin/sisu_search_pgsql.cgi (renamed from data/sisu/v2/conf/cgi-bin/sisu_search_pgsql.cgi)0
-rw-r--r--data/sisu/v4/conf/cgi-bin/sisu_search_sqlite.cgi (renamed from data/sisu/v2/conf/cgi-bin/sisu_search_sqlite.cgi)0
-rw-r--r--data/sisu/v4/conf/completion/README (renamed from data/sisu/v2/conf/completion/README)0
-rw-r--r--data/sisu/v4/conf/completion/_sisu (renamed from data/sisu/v2/conf/completion/_sisu)0
-rw-r--r--data/sisu/v4/conf/convert/kdissert_to_sisu (renamed from data/sisu/v2/conf/convert/kdissert_to_sisu)0
-rw-r--r--data/sisu/v4/conf/convert/modify.rb376
-rw-r--r--data/sisu/v4/conf/convert/sisu_convert (renamed from data/sisu/v2/conf/convert/sisu_convert)0
-rw-r--r--data/sisu/v4/conf/convert/wvHtml.xml (renamed from data/sisu/v2/conf/convert/wvHtml.xml)0
-rw-r--r--data/sisu/v4/conf/convert/wvSiSU.xml (renamed from data/sisu/v2/conf/convert/wvSiSU.xml)0
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/README (renamed from data/sisu/v2/conf/editor-syntax-etc/README)0
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/diakonos/diakonos.conf (renamed from data/sisu/v2/conf/editor-syntax-etc/diakonos/diakonos.conf)0
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/emacs/README (renamed from data/sisu/v2/conf/editor-syntax-etc/emacs/README)0
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/emacs/sisu-mode.el (renamed from data/sisu/v2/conf/editor-syntax-etc/emacs/sisu-mode.el)12
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/gedit/sisu.lang (renamed from data/sisu/v2/conf/editor-syntax-etc/gedit/sisu.lang)0
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/kate/sisu.xml (renamed from data/sisu/v2/conf/editor-syntax-etc/kate/sisu.xml)0
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/nano/nanorc (renamed from data/sisu/v2/conf/editor-syntax-etc/nano/nanorc)0
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/nedit/sisu_nedit.pats (renamed from data/sisu/v2/conf/editor-syntax-etc/nedit/sisu_nedit.pats)0
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/vim/colors/8.vim (renamed from data/sisu/v2/conf/editor-syntax-etc/vim/colors/8.vim)0
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/vim/colors/frugal-cterm-ruby.vim (renamed from data/sisu/v2/conf/editor-syntax-etc/vim/colors/frugal-cterm-ruby.vim)0
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/vim/colors/frugal-cterm-sisu.vim (renamed from data/sisu/v2/conf/editor-syntax-etc/vim/colors/frugal-cterm-sisu.vim)0
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/vim/colors/frugal.vim (renamed from data/sisu/v2/conf/editor-syntax-etc/vim/colors/frugal.vim)0
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/vim/colors/slate.vim (renamed from data/sisu/v2/conf/editor-syntax-etc/vim/colors/slate.vim)0
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/vim/colors/sparse-cterm-ruby.vim (renamed from data/sisu/v2/conf/editor-syntax-etc/vim/colors/sparse-cterm-ruby.vim)0
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/vim/colors/sparse-cterm-sisu.vim (renamed from data/sisu/v2/conf/editor-syntax-etc/vim/colors/sparse-cterm-sisu.vim)0
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/vim/filetype.vim (renamed from data/sisu/v2/conf/editor-syntax-etc/vim/filetype.vim)0
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/vim/ftplugin/sisu.vim (renamed from data/sisu/v2/conf/editor-syntax-etc/vim/ftplugin/sisu.vim)9
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/vim/syntax/sisu.vim (renamed from data/sisu/v2/conf/editor-syntax-etc/vim/syntax/sisu.vim)159
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/vim/syntax/sisu_next.vim281
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/vim/templates/ssi.tpl (renamed from data/sisu/v2/conf/editor-syntax-etc/vim/templates/ssi.tpl)0
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/vim/templates/ssm.tpl (renamed from data/sisu/v2/conf/editor-syntax-etc/vim/templates/ssm.tpl)0
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/vim/templates/sst.tpl (renamed from data/sisu/v2/conf/editor-syntax-etc/vim/templates/sst.tpl)0
-rw-r--r--data/sisu/v4/conf/editor-syntax-etc/vim/vim-sisu.yaml (renamed from data/sisu/v2/conf/editor-syntax-etc/vim/vim-sisu.yaml)0
-rw-r--r--data/sisu/v4/conf/lighttpd/lighttpd.cfg.sisu (renamed from data/sisu/v2/conf/lighttpd/lighttpd.cfg.sisu)0
-rw-r--r--data/sisu/v4/conf/lighttpd/lighttpd.cfg.sisu_www (renamed from data/sisu/v2/conf/lighttpd/lighttpd.cfg.sisu_www)0
-rw-r--r--data/sisu/v4/conf/ruby/irbrc (renamed from data/sisu/v2/conf/ruby/irbrc)0
-rw-r--r--data/sisu/v4/v/version.yml5
-rw-r--r--lib/sisu/v2/character_encoding.rb379
-rw-r--r--lib/sisu/v2/constants.rb204
-rw-r--r--lib/sisu/v2/dal.rb475
-rw-r--r--lib/sisu/v2/dal_doc_objects.rb425
-rw-r--r--lib/sisu/v2/dal_doc_str.rb1184
-rw-r--r--lib/sisu/v2/dal_expand_insertions.rb198
-rw-r--r--lib/sisu/v2/dal_syntax.rb522
-rw-r--r--lib/sisu/v2/db_dbi.rb93
-rw-r--r--lib/sisu/v2/epub.rb678
-rw-r--r--lib/sisu/v2/epub_tune.rb416
-rw-r--r--lib/sisu/v2/git.rb230
-rw-r--r--lib/sisu/v2/harvest.rb101
-rw-r--r--lib/sisu/v2/harvest_authors.rb316
-rw-r--r--lib/sisu/v2/harvest_topics.rb559
-rw-r--r--lib/sisu/v2/html_tune.rb371
-rw-r--r--lib/sisu/v2/hub.rb580
-rw-r--r--lib/sisu/v2/manifest.rb713
-rw-r--r--lib/sisu/v2/manpage.rb420
-rw-r--r--lib/sisu/v2/odf.rb735
-rw-r--r--lib/sisu/v2/odf_format.rb468
-rw-r--r--lib/sisu/v2/options.rb217
-rw-r--r--lib/sisu/v2/plaintext.rb419
-rw-r--r--lib/sisu/v2/shared_markup_alt.rb318
-rw-r--r--lib/sisu/v2/shared_metadata.rb800
-rw-r--r--lib/sisu/v2/shared_xml.rb706
-rw-r--r--lib/sisu/v2/sisupod_make.rb338
-rw-r--r--lib/sisu/v2/sysenv.rb3366
-rw-r--r--lib/sisu/v2/texpdf.rb830
-rw-r--r--lib/sisu/v2/update.rb130
-rw-r--r--lib/sisu/v2/urls.rb279
-rw-r--r--lib/sisu/v2/webrick.rb176
-rw-r--r--lib/sisu/v4/air.rb (renamed from lib/sisu/v2/air.rb)18
-rw-r--r--lib/sisu/v4/author_format.rb (renamed from lib/sisu/v2/author_format.rb)37
-rw-r--r--lib/sisu/v4/cgi.rb (renamed from lib/sisu/v2/cgi.rb)30
-rw-r--r--lib/sisu/v4/cgi_pgsql.rb (renamed from lib/sisu/v2/cgi_pgsql.rb)75
-rw-r--r--lib/sisu/v4/cgi_sql_common.rb (renamed from lib/sisu/v2/cgi_sql_common.rb)288
-rw-r--r--lib/sisu/v4/cgi_sqlite.rb (renamed from lib/sisu/v2/cgi_sqlite.rb)70
-rw-r--r--lib/sisu/v4/composite.rb (renamed from lib/sisu/v2/composite.rb)154
-rw-r--r--lib/sisu/v4/concordance.rb (renamed from lib/sisu/v2/concordance.rb)212
-rw-r--r--lib/sisu/v4/conf.rb (renamed from lib/sisu/v2/conf.rb)111
-rw-r--r--lib/sisu/v4/constants.rb296
-rw-r--r--lib/sisu/v4/css.rb (renamed from lib/sisu/v2/css.rb)1469
-rw-r--r--lib/sisu/v4/dal.rb510
-rw-r--r--lib/sisu/v4/dal_character_check.rb (renamed from lib/sisu/v2/dal_character_check.rb)51
-rw-r--r--lib/sisu/v4/dal_doc_objects.rb445
-rw-r--r--lib/sisu/v4/dal_doc_str.rb1044
-rw-r--r--lib/sisu/v4/dal_endnotes.rb (renamed from lib/sisu/v2/dal_endnotes.rb)31
-rw-r--r--lib/sisu/v4/dal_expand_insertions.rb378
-rw-r--r--lib/sisu/v4/dal_hash_digest.rb (renamed from lib/sisu/v2/dal_hash_digest.rb)60
-rw-r--r--lib/sisu/v4/dal_idx.rb (renamed from lib/sisu/v2/dal_idx.rb)158
-rw-r--r--lib/sisu/v4/dal_images.rb (renamed from lib/sisu/v2/dal_images.rb)47
-rw-r--r--lib/sisu/v4/dal_metadata.rb (renamed from lib/sisu/v2/dal_metadata.rb)27
-rw-r--r--lib/sisu/v4/dal_numbering.rb (renamed from lib/sisu/v2/dal_numbering.rb)182
-rw-r--r--lib/sisu/v4/dal_substitutions_and_insertions.rb (renamed from lib/sisu/v2/dal_substitutions_and_insertions.rb)66
-rw-r--r--lib/sisu/v4/dal_syntax.rb601
-rw-r--r--lib/sisu/v4/db_columns.rb (renamed from lib/sisu/v2/db_columns.rb)640
-rw-r--r--lib/sisu/v4/db_create.rb (renamed from lib/sisu/v2/db_create.rb)132
-rw-r--r--lib/sisu/v4/db_dbi.rb92
-rw-r--r--lib/sisu/v4/db_drop.rb (renamed from lib/sisu/v2/db_drop.rb)27
-rw-r--r--lib/sisu/v4/db_import.rb (renamed from lib/sisu/v2/db_import.rb)451
-rw-r--r--lib/sisu/v4/db_indexes.rb (renamed from lib/sisu/v2/db_indexes.rb)18
-rw-r--r--lib/sisu/v4/db_load_tuple.rb (renamed from lib/sisu/v2/db_load_tuple.rb)111
-rw-r--r--lib/sisu/v4/db_remove.rb (renamed from lib/sisu/v2/db_remove.rb)33
-rw-r--r--lib/sisu/v4/db_select.rb (renamed from lib/sisu/v2/db_select.rb)124
-rw-r--r--lib/sisu/v4/db_sqltxt.rb (renamed from lib/sisu/v2/db_sqltxt.rb)83
-rw-r--r--lib/sisu/v4/db_tests.rb (renamed from lib/sisu/v2/db_tests.rb)13
-rw-r--r--lib/sisu/v4/dbi.rb (renamed from lib/sisu/v2/dbi.rb)41
-rw-r--r--lib/sisu/v4/dbi_discreet.rb182
-rw-r--r--lib/sisu/v4/defaults.rb (renamed from lib/sisu/v2/defaults.rb)995
-rw-r--r--lib/sisu/v4/digests.rb (renamed from lib/sisu/v2/digests.rb)101
-rw-r--r--lib/sisu/v4/embedded.rb (renamed from lib/sisu/v2/embedded.rb)73
-rw-r--r--lib/sisu/v4/epub.rb723
-rw-r--r--lib/sisu/v4/epub_concordance.rb (renamed from lib/sisu/v2/epub_concordance.rb)151
-rw-r--r--lib/sisu/v4/epub_format.rb (renamed from lib/sisu/v2/epub_format.rb)1404
-rw-r--r--lib/sisu/v4/epub_segments.rb (renamed from lib/sisu/v2/epub_segments.rb)340
-rw-r--r--lib/sisu/v4/epub_tune.rb409
-rw-r--r--lib/sisu/v4/errors.rb (renamed from lib/sisu/v2/errors.rb)38
-rw-r--r--lib/sisu/v4/git.rb232
-rw-r--r--lib/sisu/v4/harvest.rb112
-rw-r--r--lib/sisu/v4/harvest_authors.rb387
-rw-r--r--lib/sisu/v4/harvest_topics.rb808
-rw-r--r--lib/sisu/v4/help.rb (renamed from lib/sisu/v2/help.rb)662
-rw-r--r--lib/sisu/v4/html.rb (renamed from lib/sisu/v2/html.rb)372
-rw-r--r--lib/sisu/v4/html_format.rb (renamed from lib/sisu/v2/html_format.rb)582
-rw-r--r--lib/sisu/v4/html_minitoc.rb (renamed from lib/sisu/v2/html_minitoc.rb)114
-rw-r--r--lib/sisu/v4/html_promo.rb (renamed from lib/sisu/v2/html_promo.rb)58
-rw-r--r--lib/sisu/v4/html_scroll.rb (renamed from lib/sisu/v2/html_scroll.rb)136
-rw-r--r--lib/sisu/v4/html_segments.rb (renamed from lib/sisu/v2/html_segments.rb)417
-rw-r--r--lib/sisu/v4/html_table.rb (renamed from lib/sisu/v2/html_table.rb)19
-rw-r--r--lib/sisu/v4/html_tune.rb375
-rw-r--r--lib/sisu/v4/hub.rb712
-rw-r--r--lib/sisu/v4/i18n.rb697
-rw-r--r--lib/sisu/v4/manifest.rb900
-rw-r--r--lib/sisu/v4/manpage.rb435
-rw-r--r--lib/sisu/v4/manpage_format.rb (renamed from lib/sisu/v2/manpage_format.rb)26
-rw-r--r--lib/sisu/v4/odf.rb818
-rw-r--r--lib/sisu/v4/odf_format.rb658
-rw-r--r--lib/sisu/v4/options.rb966
-rw-r--r--lib/sisu/v4/param.rb (renamed from lib/sisu/v2/param.rb)1105
-rw-r--r--lib/sisu/v4/param_identify_markup.rb (renamed from lib/sisu/v2/param_identify_markup.rb)15
-rw-r--r--lib/sisu/v4/param_make.rb636
-rw-r--r--lib/sisu/v4/particulars.rb (renamed from lib/sisu/v2/particulars.rb)104
-rw-r--r--lib/sisu/v4/plaintext.rb432
-rw-r--r--lib/sisu/v4/plaintext_format.rb (renamed from lib/sisu/v2/plaintext_format.rb)39
-rw-r--r--lib/sisu/v4/po4a.rb979
-rw-r--r--lib/sisu/v4/po4a_set.rb298
-rw-r--r--lib/sisu/v4/prog_text_translation.rb (renamed from lib/sisu/v2/i18n.rb)556
-rw-r--r--lib/sisu/v4/qrcode.rb744
-rw-r--r--lib/sisu/v4/relaxng.rb (renamed from lib/sisu/v2/relaxng.rb)24
-rw-r--r--lib/sisu/v4/remote.rb (renamed from lib/sisu/v2/remote.rb)67
-rw-r--r--lib/sisu/v4/response.rb (renamed from lib/sisu/v2/response.rb)17
-rw-r--r--lib/sisu/v4/rexml.rb (renamed from lib/sisu/v2/rexml.rb)38
-rw-r--r--lib/sisu/v4/screen_text_color.rb (renamed from lib/sisu/v2/screen_text_color.rb)130
-rw-r--r--lib/sisu/v4/share_src.rb (renamed from lib/sisu/v2/share_src.rb)48
-rw-r--r--lib/sisu/v4/share_src_kdissert.rb (renamed from lib/sisu/v2/share_src_kdissert.rb)23
-rw-r--r--lib/sisu/v4/shared_html.rb (renamed from lib/sisu/v2/shared_html.rb)19
-rw-r--r--lib/sisu/v4/shared_html_lite.rb (renamed from lib/sisu/v2/shared_html_lite.rb)149
-rw-r--r--lib/sisu/v4/shared_images.rb137
-rw-r--r--lib/sisu/v4/shared_markup_alt.rb321
-rw-r--r--lib/sisu/v4/shared_metadata.rb1344
-rw-r--r--lib/sisu/v4/shared_sem.rb (renamed from lib/sisu/v2/shared_sem.rb)26
-rw-r--r--lib/sisu/v4/shared_sisupod_source.rb305
-rw-r--r--lib/sisu/v4/shared_txt.rb (renamed from lib/sisu/v2/shared_txt.rb)30
-rw-r--r--lib/sisu/v4/shared_xhtml.rb (renamed from lib/sisu/v2/shared_xhtml.rb)19
-rw-r--r--lib/sisu/v4/shared_xml.rb717
-rw-r--r--lib/sisu/v4/sisupod_make.rb149
-rw-r--r--lib/sisu/v4/sitemaps.rb (renamed from lib/sisu/v2/sitemaps.rb)61
-rw-r--r--lib/sisu/v4/spell.rb (renamed from lib/sisu/v2/spell.rb)41
-rw-r--r--lib/sisu/v4/sst_convert_markup.rb (renamed from lib/sisu/v2/sst_convert_markup.rb)61
-rw-r--r--lib/sisu/v4/sst_do_inline_footnotes.rb (renamed from lib/sisu/v2/sst_do_inline_footnotes.rb)139
-rw-r--r--lib/sisu/v4/sst_from_xml.rb (renamed from lib/sisu/v2/sst_from_xml.rb)17
-rw-r--r--lib/sisu/v4/sst_identify_markup.rb (renamed from lib/sisu/v2/sst_identify_markup.rb)65
-rw-r--r--lib/sisu/v4/sst_to_s_xml_sax.rb (renamed from lib/sisu/v2/sst_to_s_xml_sax.rb)130
-rw-r--r--lib/sisu/v4/sysenv.rb6014
-rw-r--r--lib/sisu/v4/termsheet.rb (renamed from lib/sisu/v2/termsheet.rb)23
-rw-r--r--lib/sisu/v4/texinfo.rb (renamed from lib/sisu/v2/texinfo.rb)261
-rw-r--r--lib/sisu/v4/texinfo_format.rb (renamed from lib/sisu/v2/texinfo_format.rb)361
-rw-r--r--lib/sisu/v4/texpdf.rb992
-rw-r--r--lib/sisu/v4/texpdf_format.rb (renamed from lib/sisu/v2/texpdf_format.rb)974
-rw-r--r--lib/sisu/v4/update.rb138
-rw-r--r--lib/sisu/v4/urls.rb442
-rw-r--r--lib/sisu/v4/webrick.rb185
-rw-r--r--lib/sisu/v4/wikispeak.rb (renamed from lib/sisu/v2/wikispeak.rb)79
-rw-r--r--lib/sisu/v4/xhtml.rb (renamed from lib/sisu/v2/xhtml.rb)208
-rw-r--r--lib/sisu/v4/xhtml_table.rb (renamed from lib/sisu/v2/xhtml_table.rb)25
-rw-r--r--lib/sisu/v4/xml.rb (renamed from lib/sisu/v2/xml.rb)215
-rw-r--r--lib/sisu/v4/xml_dom.rb (renamed from lib/sisu/v2/xml_dom.rb)188
-rw-r--r--lib/sisu/v4/xml_fictionbook.rb (renamed from lib/sisu/v2/xml_fictionbook.rb)56
-rw-r--r--lib/sisu/v4/xml_format.rb (renamed from lib/sisu/v2/xml_format.rb)424
-rw-r--r--lib/sisu/v4/xml_md_oai_pmh_dc.rb (renamed from lib/sisu/v2/xml_md_oai_pmh_dc.rb)106
-rw-r--r--lib/sisu/v4/xml_scaffold.rb (renamed from lib/sisu/v2/xml_scaffold.rb)42
-rw-r--r--lib/sisu/v4/xml_tables.rb (renamed from lib/sisu/v2/xml_tables.rb)69
-rw-r--r--lib/sisu/v4/zap.rb (renamed from lib/sisu/v2/zap.rb)19
-rw-r--r--man/man1/sisu-concordance.16
-rw-r--r--man/man1/sisu-epub.16
-rw-r--r--man/man1/sisu-git.139
-rw-r--r--man/man1/sisu-harvest.16
-rw-r--r--man/man1/sisu-html.16
-rw-r--r--man/man1/sisu-odf.16
-rw-r--r--man/man1/sisu-pdf.16
-rw-r--r--man/man1/sisu-pg.16
-rw-r--r--man/man1/sisu-po.142
-rw-r--r--man/man1/sisu-sqlite.16
-rw-r--r--man/man1/sisu-txt.16
-rw-r--r--man/man1/sisu-webrick.1 (renamed from man/man1/sisu_webrick.1)0
-rw-r--r--man/man1/sisu.12807
l---------man/man1/sisu4.1 (renamed from man/man1/sisu2.1)0
-rw-r--r--man/man1/sisu_termsheet.166
364 files changed, 55278 insertions, 33639 deletions
diff --git a/CHANGELOG b/CHANGELOG
index c13296bf..49c5462a 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,26 +1,30 @@
-%% SiSU versions 2 & 3, 2011
+%% SiSU versions 4 & 3 2012
Homepage: <http://www.jus.uio.no/sisu>
-* README CHANGELOG CHANGELOG_v1 CHANGELOG_v2 CHANGELOG_v3
+* README CHANGELOG CHANGELOG_v1 CHANGELOG_v2 CHANGELOG_v3 CHANGELOG_v4
-Herein (this package) reside SiSU versions 2 and 3.
+Herein (this package) reside SiSU versions 4 and 3.
-README CHANGELOG_1 CHANGELOG_v2 CHANGELOG_v3
+Changelogs are to be found in the CHANGELOGS directory:
-This tarball contains two versions of SiSU, the stable version 2 and the
-under-development version 3. For version 1 look to sisu 2.7 and earlier.
+CHANGELOGS/CHANGELOG_v4
+CHANGELOGS/CHANGELOG_v3
+CHANGELOGS/CHANGELOG_v2
+CHANGELOGS/CHANGELOG_v1
-The input for v2 & v3, a SiSU marked-up document is the same.
+you might also look at the README file
-As version 2 is the current implementation the source tarball is named after
-it, and the command sisu by default runs version 2. To run version 3 add the
-flag --v3, i.e. sisu --v3 [filename], or run sisu3
+* v1 sisu pretty mature in operation and syntax
+* v2 introduces new processing middle layer (document abstraction);
+ markup same except for minor changes to document headers;
+ epub output introduced
+* v3 introduces alternative (configurable) output structures
+* v4 retires what were referred to as sisu skins
-Compatibility Notes
-
-Versions 3 is experimental and attempts to introduce output more compatible
-with mobile devices and other non-web use and more internationalisation
-possibilities. Please see CHANGELOG_v3
+This tarball contains two versions of SiSU, version 4 and version 3 which it
+replaced
+The input for sisu v2, v3 & v4, a SiSU marked-up document is unchanged apart
+from document headers.
* homepage at: <http://www.jus.uio.no/sisu>
* <http://www.jus.uio.no/sisu/SiSU/download>
diff --git a/CHANGELOGS/CHANGELOG_v1 b/CHANGELOGS/CHANGELOG_v1
new file mode 120000
index 00000000..dce668b5
--- /dev/null
+++ b/CHANGELOGS/CHANGELOG_v1
@@ -0,0 +1 @@
+../data/doc/sisu/CHANGELOG_v1 \ No newline at end of file
diff --git a/CHANGELOGS/CHANGELOG_v2 b/CHANGELOGS/CHANGELOG_v2
new file mode 120000
index 00000000..e87e244c
--- /dev/null
+++ b/CHANGELOGS/CHANGELOG_v2
@@ -0,0 +1 @@
+../data/doc/sisu/CHANGELOG_v2 \ No newline at end of file
diff --git a/CHANGELOGS/CHANGELOG_v3 b/CHANGELOGS/CHANGELOG_v3
new file mode 120000
index 00000000..5fc15e3e
--- /dev/null
+++ b/CHANGELOGS/CHANGELOG_v3
@@ -0,0 +1 @@
+../data/doc/sisu/CHANGELOG_v3 \ No newline at end of file
diff --git a/CHANGELOGS/CHANGELOG_v4 b/CHANGELOGS/CHANGELOG_v4
new file mode 120000
index 00000000..a587bc66
--- /dev/null
+++ b/CHANGELOGS/CHANGELOG_v4
@@ -0,0 +1 @@
+../data/doc/sisu/CHANGELOG_v4 \ No newline at end of file
diff --git a/CHANGELOG_v1 b/CHANGELOG_v1
deleted file mode 120000
index feac476b..00000000
--- a/CHANGELOG_v1
+++ /dev/null
@@ -1 +0,0 @@
-data/doc/sisu/CHANGELOG_v1 \ No newline at end of file
diff --git a/CHANGELOG_v2 b/CHANGELOG_v2
deleted file mode 120000
index 48716b0c..00000000
--- a/CHANGELOG_v2
+++ /dev/null
@@ -1 +0,0 @@
-data/doc/sisu/CHANGELOG_v2 \ No newline at end of file
diff --git a/CHANGELOG_v3 b/CHANGELOG_v3
deleted file mode 120000
index e29fe00f..00000000
--- a/CHANGELOG_v3
+++ /dev/null
@@ -1 +0,0 @@
-data/doc/sisu/CHANGELOG_v3 \ No newline at end of file
diff --git a/README b/README
index dbf19ecb..4fd0f772 100644
--- a/README
+++ b/README
@@ -1,8 +1,12 @@
-%% SiSU versions 2 & 3, 2011
+%% SiSU versions 4 & 3, 2011
Homepage: <http://www.jus.uio.no/sisu>
-* README CHANGELOG CHANGELOG_v1 CHANGELOG_v2 CHANGELOG_v3
+* README
+* CHANGELOGS/CHANGELOG_v4
+* CHANGELOGS/CHANGELOG_v3
+* CHANGELOGS/CHANGELOG_v2
+* CHANGELOGS/CHANGELOG_v1
-Herein (this package) reside SiSU versions 1 and 2.
+Herein (this package) reside SiSU versions 4 and 3.
%% Description
---------------
@@ -515,19 +519,14 @@ features within the ruby language suited to what the application does.
Development is curently on version 2, version 1 is likely to remain for some
time as a reference implementation.
-%% v1, v2 Compatibility Notes
----------------
-
-Versions 1 and 2 are not quite compatible, version 1 and version 2 will run
-against each other's documents but document metadata, and processing
-instructions may be lost.
-
-On the input side, version 1 and 2 headers are different, version 2 headers
-have been tidied, see document markup samples provided
+%% Versions
-On the output side, the sql databases produced if search is to be implemented
-are not the same and a database must be generated for each version, most other
-differences should be relatively cosmetic.
+* v1 sisu pretty mature in operation and syntax
+* v2 introduces new processing middle layer (document abstraction);
+ markup same except for minor changes to document headers;
+ epub output introduced
+* v3 introduces alternative (configurable) output structures
+* v4 retires what were referred to as sisu skins
%% License
---------------
diff --git a/bin/sisu b/bin/sisu
index f840f8bb..f8123e8c 100644
--- a/bin/sisu
+++ b/bin/sisu
@@ -41,26 +41,111 @@ WOK
rbv_sisu_dev='1.9.2'
ruby_version_ok?(rbv_sisu_dev)
end
+ def require_hub_path(sisu_path_specified_lib_)
+ 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
+ end
+#% sisu branch
$VERBOSE=nil
$KCODE='u' if RUBY_VERSION < '1.9'
argv=$*
- SiSU_version_dir=case argv.inspect
- when /"(?:--v2)"/
- check_sisu_legacy_ruby_version?
- 'v2'
- when /"(?:--v3)"/
- check_sisu_stable_ruby_version?
- 'v3'
- when /"(?:--dev)"/
- check_sisu_dev_ruby_version?
- 'v3'
+ SiSU_called_from_directory=Dir.pwd
+ if $0 !~/\bsisu[34]$/
+ SiSU_version_dir=case argv.inspect
+ when /"(?:--v3)"/
+ check_sisu_stable_ruby_version?
+ 'v3'
+ when /"(?:--v4)"/
+ check_sisu_stable_ruby_version?
+ 'v4'
+ when /"(?:--dev)"/
+ check_sisu_dev_ruby_version?
+ 'v4'
+ else
+ check_sisu_stable_ruby_version?
+ 'v4'
+ end
else
- check_sisu_stable_ruby_version?
- 'v3'
+ SiSU_version_dir=case $0
+ when /\bsisu3$/
+ check_sisu_stable_ruby_version?
+ 'v3'
+ when /\bsisu4$/
+ check_sisu_stable_ruby_version?
+ 'v4'
+ else
+ check_sisu_stable_ruby_version?
+ 'v4'
+ end
end
+#% $0
+ e=Config::CONFIG
SiSU_lib="sisu/#{SiSU_version_dir}"
- require "#{SiSU_lib}/hub"
- unless SiSU_version_dir == 'v2'
+ sisu_path_specified_lib_=if $0 =~ /^#{e['bindir']}\/sisu[34]?$/
+ nil
+ elsif $0 !~ /^#{e['bindir']}\/sisu[34]?$/ \
+ && $0 =~/bin\/sisu[34]?$/ \
+ && FileTest.file?($0)
+ $0.sub(/bin\/sisu[34]?$/,'lib').
+ sub(/^lib$/,"#{Dir.pwd}/lib")
+ elsif $0 !~ /^#{e['bindir']}\/sisu[34]?$/ \
+ && $0 =~/^sisu[34]?$/ \
+ && FileTest.file?($0)
+ $0.sub(/sisu[34]?$/,'../lib')
+ #bug, relative path does not work for sisu version information
+ else
+ nil
+ end
+ SiSU_path_specified_Version_=if sisu_path_specified_lib_
+ sisu_path_specified_lib_.sub(/\/lib/,
+ "/data/sisu/#{SiSU_version_dir}/v/version.yml")
+ else
+ nil
+ end
+ SiSU_path_lib="#{require_hub_path(sisu_path_specified_lib_)}"
+#% $*
+ require "#{SiSU_path_lib}/hub"
+ 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 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]
+ lng_lst_rgx=lng_lst.join('|')
+ argv_sub_files={}
+ argv_sub_mods=[]
+ argv.each do |x|
+ if x =~/^-+/
+ argv_sub_mods << x
+ elsif x =~/\.ss[tm]/
+ if x =~/\//
+ markup_path,markup_file =(/(\S+\/)((?:#{lng_lst_rgx})?[^\/]+)/).match(x)[1,2]
+ if not argv_sub_files[markup_path]
+ argv_sub_files[markup_path]=[]
+ end
+ argv_sub_files[markup_path] << markup_file
+ else
+ if not argv_sub_files['./']
+ argv_sub_files['./']=[]
+ end
+ argv_sub_files['./'] << x
+ end
+ end
+ end
+ if argv_sub_files.length > 0
+ argv_sub_files.each_pair do |markup_dir,markup_file|
+ $sisu_document_markup_directory=markup_dir.gsub(/\/$/,'')
+ argv_sub=argv_sub_mods + markup_file
+ if FileTest.directory?(markup_dir)
+ system("cd #{markup_dir}")
+ Dir.chdir(markup_dir)
+ SiSU::HubMaster.new(argv_sub)
+ Dir.chdir(SiSU_called_from_directory)
+ system("cd #{SiSU_called_from_directory}")
+ else p "Error directory specified #{markup_dir} not found"
+ end
+ end
+ else
+ $sisu_document_markup_directory=Dir.pwd.gsub(/\/$/,'')
SiSU::HubMaster.new(argv)
end
rescue
diff --git a/bin/sisu-git b/bin/sisu-git
deleted file mode 100644
index d38b10c5..00000000
--- a/bin/sisu-git
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-sisu -g ${@}
diff --git a/bin/sisu-po b/bin/sisu-po
deleted file mode 100644
index 9d0d1b95..00000000
--- a/bin/sisu-po
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-sisu --v3 --po4a ${@}
diff --git a/bin/sisu-webrick b/bin/sisu-webrick
new file mode 100644
index 00000000..75d97238
--- /dev/null
+++ b/bin/sisu-webrick
@@ -0,0 +1,2 @@
+#!/bin/sh
+sisu -W ${@}
diff --git a/bin/sisu2 b/bin/sisu2
deleted file mode 100644
index d8aac3dd..00000000
--- a/bin/sisu2
+++ /dev/null
@@ -1,136 +0,0 @@
-#!/usr/bin/env ruby
-# encoding: utf-8
-#SiSU: copyright (C) 1997 - 2012 Ralph Amissah; License GPL, see appended program information
-begin
- def ruby_version_ok?(base_version)
- @v ||=RUBY_VERSION.scan(/\d+/)
- vb=base_version.scan(/\d+/)
- if @v[0].to_i < vb[0].to_i \
- or @v[0].to_i == vb[0].to_i \
- && @v[1].to_i < vb[1].to_i \
- or @v[0].to_i == vb[0].to_i \
- && @v[1].to_i == vb[1].to_i \
- && @v[1].to_i < vb[2].to_i
- raise "Please, use Ruby#{vb} or later, current Ruby #{RUBY_VERSION}"
- else check_incompatible_ruby_build?
- end
- end
- def check_incompatible_ruby_build?
- require 'rbconfig'
- e=Config::CONFIG
- if RUBY_VERSION == '1.9.2' \
- && e['PATCHLEVEL'].to_i < 180
- raise <<WOK
-There are known issues with early versions of ruby1.9.2.
-Please, use Ruby 1.9.2p180 or later,
-current version #{e['RUBY_PROGRAM_VERSION']}p#{e['PATCHLEVEL']}
-#{%x{ruby -v}.strip.to_s}
-
-WOK
- end
- end
- def check_sisu_legacy_ruby_version?
- rbv_sisu_legacy='1.9.2' #'1.8.7'
- ruby_version_ok?(rbv_sisu_legacy)
- end
- def check_sisu_stable_ruby_version?
- rbv_sisu_stable='1.9.2'
- ruby_version_ok?(rbv_sisu_stable)
- end
- def check_sisu_dev_ruby_version?
- rbv_sisu_dev='1.9.2'
- ruby_version_ok?(rbv_sisu_dev)
- end
- $VERBOSE=nil
- $KCODE='u' if RUBY_VERSION < '1.9'
- argv=$*
- SiSU_version_dir=case argv.inspect
- when /"(?:--v2)"/
- check_sisu_legacy_ruby_version?
- 'v2'
- when /"(?:--v3)"/
- check_sisu_stable_ruby_version?
- 'v3'
- when /"(?:--dev)"/
- check_sisu_dev_ruby_version?
- 'v3'
- else
- check_sisu_legacy_ruby_version?
- 'v2'
- end
- SiSU_lib="sisu/#{SiSU_version_dir}"
- require "#{SiSU_lib}/hub"
- unless SiSU_version_dir == 'v2'
- SiSU::HubMaster.new(argv)
- end
-rescue
- STDERR.puts 'ERROR'
- STDERR.puts $!
- STDERR.puts $@
- require 'rbconfig'
- e=Config::CONFIG
- puts %{
- #{%x{ruby -v}.strip.to_s}
- #{RUBY_VERSION}
- ruby version: #{e['RUBY_PROGRAM_VERSION']}p#{e['PATCHLEVEL']}
- ruby named: #{e['ruby_version']}
- rubylib: #{e['rubylibdir']}
- rubylib local: #{e['sitelibdir']}
- }
- system(%{echo "
- system RUBYPATH: ${RUBYPATH}
- system RUBYLIB: ${RUBYLIB}
- "})
-end
-__END__
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.sisudoc.org/sisu/en/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
diff --git a/bin/sisu3 b/bin/sisu3
index f840f8bb..b4999d51 100644..120000
--- a/bin/sisu3
+++ b/bin/sisu3
@@ -1,136 +1 @@
-#!/usr/bin/env ruby
-# encoding: utf-8
-#SiSU: copyright (C) 1997 - 2012 Ralph Amissah; License GPL, see appended program information
-begin
- def ruby_version_ok?(base_version)
- @v ||=RUBY_VERSION.scan(/\d+/)
- vb=base_version.scan(/\d+/)
- if @v[0].to_i < vb[0].to_i \
- or @v[0].to_i == vb[0].to_i \
- && @v[1].to_i < vb[1].to_i \
- or @v[0].to_i == vb[0].to_i \
- && @v[1].to_i == vb[1].to_i \
- && @v[1].to_i < vb[2].to_i
- raise "Please, use Ruby#{vb} or later, current Ruby #{RUBY_VERSION}"
- else check_incompatible_ruby_build?
- end
- end
- def check_incompatible_ruby_build?
- require 'rbconfig'
- e=Config::CONFIG
- if RUBY_VERSION == '1.9.2' \
- && e['PATCHLEVEL'].to_i < 180
- raise <<WOK
-There are known issues with early versions of ruby1.9.2.
-Please, use Ruby 1.9.2p180 or later,
-current version #{e['RUBY_PROGRAM_VERSION']}p#{e['PATCHLEVEL']}
-#{%x{ruby -v}.strip.to_s}
-
-WOK
- end
- end
- def check_sisu_legacy_ruby_version?
- rbv_sisu_legacy='1.9.2' #'1.8.7'
- ruby_version_ok?(rbv_sisu_legacy)
- end
- def check_sisu_stable_ruby_version?
- rbv_sisu_stable='1.9.2'
- ruby_version_ok?(rbv_sisu_stable)
- end
- def check_sisu_dev_ruby_version?
- rbv_sisu_dev='1.9.2'
- ruby_version_ok?(rbv_sisu_dev)
- end
- $VERBOSE=nil
- $KCODE='u' if RUBY_VERSION < '1.9'
- argv=$*
- SiSU_version_dir=case argv.inspect
- when /"(?:--v2)"/
- check_sisu_legacy_ruby_version?
- 'v2'
- when /"(?:--v3)"/
- check_sisu_stable_ruby_version?
- 'v3'
- when /"(?:--dev)"/
- check_sisu_dev_ruby_version?
- 'v3'
- else
- check_sisu_stable_ruby_version?
- 'v3'
- end
- SiSU_lib="sisu/#{SiSU_version_dir}"
- require "#{SiSU_lib}/hub"
- unless SiSU_version_dir == 'v2'
- SiSU::HubMaster.new(argv)
- end
-rescue
- STDERR.puts 'ERROR'
- STDERR.puts $!
- STDERR.puts $@
- require 'rbconfig'
- e=Config::CONFIG
- puts %{
- #{%x{ruby -v}.strip.to_s}
- #{RUBY_VERSION}
- ruby version: #{e['RUBY_PROGRAM_VERSION']}p#{e['PATCHLEVEL']}
- ruby named: #{e['ruby_version']}
- rubylib: #{e['rubylibdir']}
- rubylib local: #{e['sitelibdir']}
- }
- system(%{echo "
- system RUBYPATH: ${RUBYPATH}
- system RUBYLIB: ${RUBYLIB}
- "})
-end
-__END__
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.sisudoc.org/sisu/en/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
+sisu \ No newline at end of file
diff --git a/bin/sisu4 b/bin/sisu4
new file mode 120000
index 00000000..b4999d51
--- /dev/null
+++ b/bin/sisu4
@@ -0,0 +1 @@
+sisu \ No newline at end of file
diff --git a/bin/sisu_termsheet b/bin/sisu_termsheet
deleted file mode 100644
index 73aa933e..00000000
--- a/bin/sisu_termsheet
+++ /dev/null
@@ -1,148 +0,0 @@
-#!/usr/bin/env ruby
-# encoding: utf-8
-#SiSU: copyright (C) 1997 - 2012 Ralph Amissah; License GPL, see appended program information
-begin
- def ruby_version_ok?(base_version)
- @v ||=RUBY_VERSION.scan(/\d+/)
- vb=base_version.scan(/\d+/)
- if @v[0].to_i < vb[0].to_i \
- or @v[0].to_i == vb[0].to_i \
- && @v[1].to_i < vb[1].to_i \
- or @v[0].to_i == vb[0].to_i \
- && @v[1].to_i == vb[1].to_i \
- && @v[1].to_i < vb[2].to_i
- raise "Please, use Ruby#{vb} or later, current Ruby #{RUBY_VERSION}"
- else check_incompatible_ruby_build?
- end
- end
- def check_incompatible_ruby_build?
- require 'rbconfig'
- e=Config::CONFIG
- if RUBY_VERSION == '1.9.2' \
- && e['PATCHLEVEL'].to_i < 180
- raise <<WOK
-There are known issues with early versions of ruby1.9.2.
-Please, use Ruby 1.9.2p180 or later,
-current version #{e['RUBY_PROGRAM_VERSION']}p#{e['PATCHLEVEL']}
-#{%x{ruby -v}.strip.to_s}
-
-WOK
- end
- end
- def check_sisu_legacy_ruby_version?
- rbv_sisu_legacy='1.9.2' #'1.8.7'
- ruby_version_ok?(rbv_sisu_legacy)
- end
- def check_sisu_stable_ruby_version?
- rbv_sisu_stable='1.9.2'
- ruby_version_ok?(rbv_sisu_stable)
- end
- def check_sisu_dev_ruby_version?
- rbv_sisu_dev='1.9.2'
- ruby_version_ok?(rbv_sisu_dev)
- end
- $VERBOSE=nil
- argv=$*
- SiSU_version_dir=case argv.inspect
- when /--v2/
- check_sisu_legacy_ruby_version?
- 'v2'
- when /--v3/
- check_sisu_stable_ruby_version?
- 'v3'
- when /--dev/
- check_sisu_dev_ruby_version?
- 'v3' #'v3dv'
- else
- check_sisu_stable_ruby_version?
- 'v3'
- end
- SiSU_lib="sisu/#{SiSU_version_dir}"
- require "#{SiSU_lib}/termsheet"
-rescue
- STDERR.puts 'ERROR'
- STDERR.puts $!
- STDERR.puts $@
- require 'rbconfig'
- e=Config::CONFIG
- puts %{
- #{%x{ruby -v}.strip.to_s}
- #{RUBY_VERSION}
- ruby version: #{e['RUBY_PROGRAM_VERSION']}p#{e['PATCHLEVEL']}
- ruby named: #{e['ruby_version']}
- rubylib: #{e['rubylibdir']}
- rubylib local: #{e['sitelibdir']}
- }
- system(%{echo "
- system RUBYPATH: ${RUBYPATH}
- system RUBYLIB: ${RUBYLIB}
- "})
-end
-__END__
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.sisudoc.org/sisu/en/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: SiSU information Structuring Universe, specialised
- pre-processing wrapper
-
- sisu -t x_bank.and.*
- e.g. sisu -t x_bank.and.*.termsheet.rb
- e.g. sisu_termsheet.rb -t x_bank.and.c*.termsheet.rb
- program calls upon termsheet file with extension termsheet.rb
- termsheet.rb calls upon relevant standard form files (to be used) with extension .sForm.rb
- there is also a standard_terms.rb file - with terms/details that are constant
- the file produced is named after the termsheet.rb with that extension replaced with .er30
- from there scribbler.rb is called upon its usual metaVerse html and pdf creation
- ! :-)
- to test run
- termsheet.rb -f dev.export.import.trade.facility.termsheet.rb
- the term sheet calls the standard form or template that is to be run against it.
diff --git a/bin/sisu_webrick b/bin/sisu_webrick
deleted file mode 100644
index c14ec31e..00000000
--- a/bin/sisu_webrick
+++ /dev/null
@@ -1,135 +0,0 @@
-#!/usr/bin/env ruby
-# encoding: utf-8
-#SiSU: copyright (C) 1997 - 2012 Ralph Amissah; License GPL, see appended program information
-begin
- def ruby_version_ok?(base_version)
- @v ||=RUBY_VERSION.scan(/\d+/)
- vb=base_version.scan(/\d+/)
- if @v[0].to_i < vb[0].to_i \
- or @v[0].to_i == vb[0].to_i \
- && @v[1].to_i < vb[1].to_i \
- or @v[0].to_i == vb[0].to_i \
- && @v[1].to_i == vb[1].to_i \
- && @v[1].to_i < vb[2].to_i
- raise "Please, use Ruby#{vb} or later, current Ruby #{RUBY_VERSION}"
- else check_incompatible_ruby_build?
- end
- end
- def check_incompatible_ruby_build?
- require 'rbconfig'
- e=Config::CONFIG
- if RUBY_VERSION == '1.9.2' \
- && e['PATCHLEVEL'].to_i < 180
- raise <<WOK
-There are known issues with early versions of ruby1.9.2.
-Please, use Ruby 1.9.2p180 or later,
-current version #{e['RUBY_PROGRAM_VERSION']}p#{e['PATCHLEVEL']}
-#{%x{ruby -v}.strip.to_s}
-
-WOK
- end
- end
- def check_sisu_legacy_ruby_version?
- rbv_sisu_legacy='1.9.2' #'1.8.7'
- ruby_version_ok?(rbv_sisu_legacy)
- end
- def check_sisu_stable_ruby_version?
- rbv_sisu_stable='1.9.2'
- ruby_version_ok?(rbv_sisu_stable)
- end
- def check_sisu_dev_ruby_version?
- rbv_sisu_dev='1.9.2'
- ruby_version_ok?(rbv_sisu_dev)
- end
- $VERBOSE=nil
- argv=$*
- SiSU_version_dir=case argv.inspect
- when /--v2/
- check_sisu_legacy_ruby_version?
- 'v2'
- when /--v3/
- check_sisu_stable_ruby_version?
- 'v3'
- when /--dev/
- check_sisu_dev_ruby_version?
- 'v3' #'v3dv'
- else
- check_sisu_stable_ruby_version?
- 'v3'
- end
- SiSU_lib="sisu/#{SiSU_version_dir}"
- require "#{SiSU_lib}/webrick"
-rescue
- STDERR.puts 'ERROR'
- STDERR.puts $!
- STDERR.puts $@
- require 'rbconfig'
- e=Config::CONFIG
- puts %{
- #{%x{ruby -v}.strip.to_s}
- #{RUBY_VERSION}
- ruby version: #{e['RUBY_PROGRAM_VERSION']}p#{e['PATCHLEVEL']}
- ruby named: #{e['ruby_version']}
- rubylib: #{e['rubylibdir']}
- rubylib local: #{e['sitelibdir']}
- }
- system(%{echo "
- system RUBYPATH: ${RUBYPATH}
- system RUBYLIB: ${RUBYLIB}
- "})
-end
-__END__
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.sisudoc.org/sisu/en/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: webrick share - note sisu by default does not link with file
- suffixes, see man pages for options
diff --git a/conf/sisu/v2/sisurc.yml b/conf/sisu/v4/sisurc.yml
index 86545f32..de2288f9 100644
--- a/conf/sisu/v2/sisurc.yml
+++ b/conf/sisu/v4/sisurc.yml
@@ -49,24 +49,24 @@ show_output_on: 'filesystem_url'
#% flag - set (non-default) processing flag shortcuts -1, -2 etc. (here adding colour and verbosity as default)
flag:
color: true # making colour default -c is toggle, and will now toggle colour off
- default: '-NhewpotbxXyYv' # -m run by default; includes verbose
+ default: '-NhewpotbxXyYdv' # -m run by default; includes verbose
i: '-Nhewpoty' # -m run by default
- ii: '-NhewpotbxX' # -m run by default
- iii: '-NhewpotbxXY' # -m run by default
- iv: '-NhewpoabxXYD --update' # -m run by default
+ ii: '-NhewpotbxXd' # -m run by default
+ iii: '-NhewpotbxXYd' # -m run by default
+ iv: '-NhewpotbxXiIYd' # -m run by default
v: '-NhewpotbxXYDv --update' # -m run by default; includes verbose
-#% papersize, (LaTeX/pdf) available values: A4, US_letter, book_b5, book_a5, US_legal
+#% papersize, (LaTeX/pdf) available values: A4, US_letter, book_b5, book_a5, US_legal
default:
papersize: 'A4,letter'
- #texpdf_font: 'Liberation Serif' # 'Liberation Sans' 'Liberation Serif'
+ #language: 'en'
+ #texpdf_font: 'Liberation Sans' # 'Liberation Sans' 'Liberation Serif'
+ #texpdf_font_mono: 'Liberation Mono' #'Inconsolata'
#text_wrap: 78
#emphasis: 'bold' #make *{emphasis}* 'bold', 'italics' or 'underscore', default if not configured is 'bold'
#digest: 'sha' #sha is sha256, default is md5
#multilingual: false
#language_file: 2
- #language: 'English'
-
#% markup, make *{emphasis}* 'bold' or 'italics', default if not configured is 'bold'
#% settings used by ssh scp
@@ -95,9 +95,19 @@ default:
# sqlite:
# path: ~ # './sisu_sqlite.db'
# port: "**"
+
#html:
# quick_ref: true #default false
# seg_title_banner: true #default false
+#odt:
+# ocn: true
+#plaintext:
+# ocn: true
+
+#% output_dir_structure_by: language (language_and_filetype); filetype; or filename (original v1 & v2)
+#output_dir_structure_by: filename
+#output_dir_structure_by: filetype
+output_dir_structure_by: language
permission_set:
zap: false
@@ -132,5 +142,5 @@ program_set:
# action: http://search.sisudoc.org
# db: sisu
# title: sample search form
-
#promo: sisu_search_libre, sisu_icon, sisu, open_society, fsf, ruby
+#omit: minitoc
diff --git a/data/doc/sisu/CHANGELOG_v1 b/data/doc/sisu/CHANGELOG_v1
index 4af76649..611d5c97 100644
--- a/data/doc/sisu/CHANGELOG_v1
+++ b/data/doc/sisu/CHANGELOG_v1
@@ -1,4 +1,7 @@
%% SiSU version 1
+v1 branch is legacy: v2 branch supersedes & replaces it
+v1 sisu pretty mature in operation and syntax
+v1 branch removed from sisu 3.0 available in sisu =< 2.7
* homepage at: <http://www.jus.uio.no/sisu>
* <http://www.jus.uio.no/sisu/SiSU/download>
@@ -12,8 +15,6 @@ Reverse Chronological:
%% Legacy Branch, Reference
-%% v1 branch removed from sisu 3.0 available in < sisu 2.8 (2.7 and below)
-
%% 1.0.4.orig.tar.gz (2010-02-17:07/3) [2010-07-07]
http://www.jus.uio.no/sisu/pkg/src/sisu_1.0.3.orig.tar.gz
sisu_1.0.3.orig.tar.gz
diff --git a/data/doc/sisu/CHANGELOG_v2 b/data/doc/sisu/CHANGELOG_v2
index ba0af469..1404f6d2 100644
--- a/data/doc/sisu/CHANGELOG_v2
+++ b/data/doc/sisu/CHANGELOG_v2
@@ -1,4 +1,10 @@
%% SiSU version 2
+v2 branch is legacy: v3 branch supersedes & replaces it
+v2 branch supersedes & replaces v1 branch
+v2 introduces new processing middle layer (document abstraction);
+ markup same except for minor changes to document headers;
+ epub output introduced
+v2 branch removed from sisu 4.0; it is available in sisu =< 3.3.2
* homepage at: <http://www.jus.uio.no/sisu>
* <http://www.jus.uio.no/sisu/SiSU/download>
@@ -8,9 +14,24 @@
* data/doc/sisu/sisu_markup_samples/sisu_manual/sisu_download.ssi
* CHANGELOG CHANGELOG_v2 CHANGELOG_v3 README data/doc/sisu/
-Reverse Chronological:
+%% Legacy Branch, Reference
-%% STABLE Branch
+* new middle layer (document abstraction) that uses ruby objects to
+ represent data (instead of strings)
+
+* downstream libraries updated to use v2 middle layer
+
+* sisu markup, changes to headers (metadata), input otherwise unchanged
+
+* output much the same as for version 1 with some tweaks
+ * search, sql table structure changed for version 2, incompatible
+ * internal linking of documents is once again supported
+ * LaTeX/pdf book indexes link within the pdf text rather than to HTML
+ version of document
+
+* EPUB output introduced using -e flag
+
+%% Reverse Chronological:
%% 2.9.12 (2012-02-14:07/2) [see 3.1.14.orig.tar.xz]
http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/sisu_3.1.14
diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3
index 261c1042..a42f334b 100644
--- a/data/doc/sisu/CHANGELOG_v3
+++ b/data/doc/sisu/CHANGELOG_v3
@@ -1,4 +1,8 @@
%% SiSU version 3
+v3 branch is legacy: v4 branch supersedes & replaces it
+v3 branch supersedes & replaces v2 branch
+v3 introduces alternative (configurable) output structures
+v1 branch is removed; it is available in sisu =< 2.7
* homepage at: <http://www.jus.uio.no/sisu>
* <http://www.jus.uio.no/sisu/SiSU/download>
@@ -8,6 +12,8 @@
* data/doc/sisu/sisu_markup_samples/sisu_manual/sisu_download.ssi
* CHANGELOG CHANGELOG_v2 CHANGELOG_v3 README data/doc/sisu/
+%% Legacy Branch, Reference
+
Version 3 introduced output directory structures nad filenames more
compatible with mobile devices and other non-web use and more
internationalisation possibilities.
diff --git a/data/doc/sisu/CHANGELOG_v4 b/data/doc/sisu/CHANGELOG_v4
new file mode 100644
index 00000000..c58ff43f
--- /dev/null
+++ b/data/doc/sisu/CHANGELOG_v4
@@ -0,0 +1,70 @@
+%% SiSU version 4
+v4 branch supersedes & replaces v3 branch
+ initial goals:
+ * remove/retire "skins"; replace some functionality with headers and/or yml
+ file (consider header like syntax for document and site appearance info)
+ * bin/sisu $0 make possible to run sisu command on/within project dir tree
+ * bin/sisu $*, hub, make possible to specify dir path for markup files
+v2 branch is removed; it is available in sisu =< 3.3.2
+
+* homepage at: <http://www.jus.uio.no/sisu>
+* <http://www.jus.uio.no/sisu/SiSU/download>
+* <http://www.jus.uio.no/sisu/SiSU/changelog>
+* <http://sisudoc.org/sisu/sisu_manual>
+* data/doc/sisu/sisu_markup_samples/sisu_manual/sisu_manual.ssm
+* data/doc/sisu/sisu_markup_samples/sisu_manual/sisu_download.ssi
+* CHANGELOG CHANGELOG_v2 CHANGELOG_v3 README data/doc/sisu/
+
+%% Reverse Chronological:
+
+%% 4.0.0.orig.tar.xz (2012-12-12:50/3)
+http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_4.0.0
+http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_4.0.0-1
+http://www.jus.uio.no/sisu/pkg/src/sisu_4.0.0.orig.tar.xz
+ sisu_4.0.0.orig.tar.xz
+ sisu_4.0.0-1.dsc
+ sisu_4.0.0-1.debian.tar.gz
+
+* v4: bin/sisu $0 make possible to run sisu command on/within project dir tree
+ (previously sisu needed to be correctly installed with system paths honored)
+ NOTE: loading of skins turned off
+
+* v4: bin/sisu $*, hub, make possible to specify dir path for markup files
+ (previously sisu needed to be invoked and run on files within the selected
+ markup file directory)
+ run sisu on markup in given path (or relative path), e.g.:
+ sisu ~/path1/filename.ssm ~/path2/*.ss[tm]
+
+* v4: defaults, some cleaning
+
+* v4: skins (remove)
+ * remove skins
+ * defaults, rename class Defaults (was InfoSkin)
+ * sisupod, remove skin, fix path
+
+* v4: db
+ * no skin info to store, omitted from structure
+ * change prefix name (structure changed)
+
+* v4 (&v3): markup samples, for v4 remove skins, separate (v3 & v4) directories
+
+* v4: param (header make)
+ * epub, pdf, book cover images
+ * html, home button
+ * text button
+ * image/icon button
+ * pdf, footer
+
+* v4: param_make, options, read common make instruction header for documents,
+ _sisu/v4/sisu_document_make
+ * @make:
+ * @links:
+
+* v4: sisupod, use common make instruction header for documents
+ * sisupod make instruction header file, write & read
+
+* v4: document headers, metadata rearranged, wide-ranging effect
+
+* v4: vim syntax, sisu.vim, make new headers
+
+* v4: documentation; markup samples & help
diff --git a/data/doc/sisu/html/sisu.1.html b/data/doc/sisu/html/sisu.1.html
index 61535580..345e574b 100644
--- a/data/doc/sisu/html/sisu.1.html
+++ b/data/doc/sisu/html/sisu.1.html
@@ -1,2150 +1,1750 @@
-Content-type: text/html
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<HTML><HEAD><TITLE>Man page of sisu</TITLE>
-</HEAD><BODY>
-<H1>sisu</H1>
-Section: SiSU (1)<BR>Updated: 2012-05-25<BR><A HREF="#index">Index</A>
-<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
-
-<BR>
-
-<A NAME="lbAB">&nbsp;</A>
-<H2>NAME</H2>
-
-<BR>
-
-sisu - documents: markup, structuring, publishing in multiple standard formats, and search
-<BR>
-
-<A NAME="lbAC">&nbsp;</A>
-<H2>SYNOPSIS</H2>
-
-<BR>
-
+<!-- manual page source format generated by PolyglotMan v3.2, -->
+<!-- available at http://polyglotman.sourceforge.net/ -->
+
+<html>
+<head>
+<title>"sisu"("1") manual page</title>
+</head>
+<body bgcolor='white'>
+<a href='#toc'>Table of Contents</a><p>
+<br>
+
+<h2><a name='sect0' href='#toc0'>Name</a></h2>
+<br>
+sisu - documents: markup, structuring, publishing in multiple standard formats,
+and search <br>
+
+<h2><a name='sect1' href='#toc1'>Synopsis</a></h2>
+<br>
+sisu [-short-options|--long-options] [filename/wildcard]
+<p> <br>
sisu [-abCcDdeFGghIikLMmNnoPpQqRrSsTtUuVvWwXxYyZ_0-9] [filename/wildcard]
-<BR>
+<p> <br>
+sisu --txt --html --epub --odt --pdf --wordmap --sqlite --manpage --texinfo --sisupod --source
+--qrcode [filename/wildcard]
+<p> <br>
sisu [-Ddcv] [instruction] [filename/wildcard]
-<P> <BR>
-
-sisu [-CcFLSVvW]
-<P> <BR>
-
+<p> <br>
+sisu --pg (--createdb|update [filename/wildcard]|--dropall)
+<p> <br>
sisu [operations]
-<P> <BR>
-
-sisu --v3 [operations]
-<P> <BR>
-
-sisu --v2 [operations]
-<P> <BR>
-
-sisu2 [operations]
-<A NAME="lbAD">&nbsp;</A>
-<H2>SISU - MANUAL,</H2>
-
-RALPH AMISSAH
-<BR>
-
-<P>
-<A NAME="lbAE">&nbsp;</A>
-<H2>WHAT IS SISU?</H2>
-
-<BR>
-<P>
-<A NAME="lbAF">&nbsp;</A>
-<H2>1. INTRODUCTION - WHAT IS SISU?</H2>
-
-<BR> <P> <BR>
-
-<B>SiSU</B>
-
-is a framework for document structuring, publishing (in multiple open standard
-formats) and search, comprising of: (a) a lightweight document structure and
-presentation markup syntax; and (b) an accompanying engine for generating
-standard document format outputs from documents prepared in sisu markup syntax,
-which is able to produce multiple standard outputs (including the population of
-sql databases) that (can) share a common numbering system for the citation of
-text within a document.
-<P> <BR>
-
-<B>SiSU</B> is developed under an open source, software libre license (GPL3).
-Its use case for development is work with medium to large document sets and
-cope with evolving document formats/ representation technologies. Documents are
-prepared once, and generated as need be to update the technical presentation or
-add additional output formats. Various output formats (including search related
-output) share a common mechanism for cross-output-format citation.
-<P> <BR>
-
-<B>SiSU</B>
-both defines a markup syntax and provides an engine that produces open
-standards format outputs from documents prepared with
-<B>SiSU</B>
-markup. From a single lightly prepared document sisu custom builds several
-standard output formats which share a common (text object) numbering system for
+<p> <br>
+sisu [-CcFLSVvW]
+<p> <br>
+sisu (--configure|--webrick|--sample-search-form)
+<h2><a name='sect2' href='#toc2'>Sisu - Manual,</a></h2>
+RALPH AMISSAH <br>
+
+<p>
+<h2><a name='sect3' href='#toc3'>What is Sisu?</a></h2>
+<br>
+
+<p>
+<h2><a name='sect4' href='#toc4'>Introduction - What is Sisu?</a></h2>
+<br>
+
+<p> <br>
+<b>SiSU</b> is a framework for document structuring, publishing (in multiple open
+standard formats) and search, comprising of: (a) a lightweight document
+structure and presentation markup syntax; and (b) an accompanying engine
+for generating standard document format outputs from documents prepared
+in sisu markup syntax, which is able to produce multiple standard outputs
+(including the population of sql databases) that (can) share a common numbering
+system for the citation of text within a document.
+<p> <br>
+<b>SiSU</b> is developed under an open source, software libre license ( <i>GPLv3</i>
+). Its use case for development is work with medium to large document sets
+and cope with evolving document formats/ representation technologies. Documents
+are prepared once, and generated as need be to update the technical presentation
+or add additional output formats. Various output formats (including search
+related output) share a common mechanism for cross-output-format citation.
+
+<p> <br>
+<b>SiSU</b> both defines a markup syntax and provides an engine that produces
+open standards format outputs from documents prepared with <b>SiSU</b> markup.
+From a single lightly prepared document sisu custom builds several standard
+output formats which share a common (text object) numbering system for
citation of content within a document (that also has implications for search).
-The sisu engine works with an abstraction of the document's structure and
+The sisu engine works with an abstraction of the document&rsquo;s structure and
content from which it is possible to generate different forms of representation
-of the document. Significantly
-<B>SiSU</B>
-markup is more sparse than html and outputs which include html, EPUB, LaTeX,
-landscape and portrait pdfs, Open Document Format (ODF), all of which can be
-added to and updated.
-<B>SiSU</B>
-is also able to populate SQL type databases at an object level, which means
+of the document. Significantly <b>SiSU</b> markup is more sparse than html and
+outputs which include <i>HTML,</i> <i>EPUB,</i> <i>ODT</i> (Open Document Format text), <i>LaTeX,</i>
+landscape and portrait <i>PDF,</i> all of which can be added to and updated. <b>SiSU</b>
+is also able to populate <i>SQL</i> type databases at an object level, which means
that searches can be made with that degree of granularity.
-<P> <BR>
-
-Source document preparation and output generation is a two step process: (i)
-document source is prepared, that is, marked up in sisu markup syntax and (ii)
-the desired output subsequently generated by running the sisu engine against
-document source. Output representations if updated (in the sisu engine) can be
-generated by re-running the engine against the prepared source. Using
-<B>SiSU</B> markup applied to a document, <B>SiSU</B> custom builds (to take
-advantage of the strengths of different ways of representing documents) various
-standard open output formats including plain text, HTML, XHTML, XML, EPUB,
-OpenDocument, LaTeX or PDF files, and populate an SQL database with objects[^1]
-(equating generally to paragraph-sized chunks) so searches may be performed and
-matches returned with that degree of granularity ( e.g. your search criteria is
-met by these documents and at these locations within each document). Document
-output formats share a common object numbering system for locating content.
-This is particularly suitable for &quot;published&quot; works (finalized texts
-as opposed to works that are frequently changed or updated) for which it
-provides a fixed means of reference of content.
-
-<P> <BR>
-
-In preparing a <B>SiSU</B> document you optionally provide semantic information
+<p> <br>
+Source document preparation and output generation is a two step process:
+(i) document source is prepared, that is, marked up in sisu markup syntax
+and (ii) the desired output subsequently generated by running the sisu
+engine against document source. Output representations if updated (in the
+sisu engine) can be generated by re-running the engine against the prepared
+source. Using <b>SiSU</b> markup applied to a document, <b>SiSU</b> custom builds (to
+take advantage of the strengths of different ways of representing documents)
+various standard open output formats including plain text, <i>HTML,</i> <i>XHTML,</i>
+<i>XML,</i> <i>EPUB,</i> <i>ODT,</i> <i>LaTeX</i> or <i>PDF</i> files, and populate an <i>SQL</i> database with objects[^1]
+(equating generally to paragraph-sized chunks) so searches may be performed
+and matches returned with that degree of granularity ( e.g. your search criteria
+is met by these documents and at these locations within each document).
+Document output formats share a common object numbering system for locating
+content. This is particularly suitable for "published" works (finalized
+texts as opposed to works that are frequently changed or updated) for which
+it provides a fixed means of reference of content.
+<p> <br>
+In preparing a <b>SiSU</b> document you optionally provide semantic information
related to the document in a document header, and in marking up the substantive
text provide information on the structure of the document, primarily indicating
heading levels and footnotes. You also provide information on basic text
-attributes where used. The rest is automatic, sisu from this information
+attributes where used. The rest is automatic, sisu from this information
custom builds[^2] the different forms of output requested.
-
-<P> <BR>
-
-<B>SiSU</B> works with an abstraction of the document based on its structure
-which is comprised of its headings[^3] and objects[^4], which enables
-<B>SiSU</B> to represent the document in many different ways, and to take
-advantage of the strengths of different ways of presenting documents. The
-objects are numbered, and these numbers can be used to provide a common basis
-for citing material within a document across the different output format types.
-This is significant as page numbers are not well suited to the digital age, in
-web publishing, changing a browser's default font or using a different browser
-can mean that text will appear on a different page; and publishing in different
+<p> <br>
+<b>SiSU</b> works with an abstraction of the document based on its structure which
+is comprised of its headings[^3] and objects[^4], which enables <b>SiSU</b> to represent
+the document in many different ways, and to take advantage of the strengths
+of different ways of presenting documents. The objects are numbered, and
+these numbers can be used to provide a common basis for citing material
+within a document across the different output format types. This is significant
+as page numbers are not well suited to the digital age, in web publishing,
+changing a browser&rsquo;s default font or using a different browser can mean
+that text will appear on a different page; and publishing in different
formats, html, landscape and portrait pdf etc. again page numbers are not
-useful to cite text. Dealing with documents at an object level together with
-object numbering also has implications for search that <B>SiSU</B> is able to
-take advantage of.
-
-<P> <BR>
-
-One of the challenges of maintaining documents is to keep them in a format that
-allows use of them independently of proprietary platforms. Consider issues
-related to dealing with legacy proprietary formats today and what guarantee you
-have that old proprietary formats will remain (or can be read without
-proprietary software/equipment) in 15 years time, or the way the way in which
-html has evolved over its relatively short span of existence. <B>SiSU</B>
-provides the flexibility of producing documents in multiple non-proprietary
-open formats including html, pdf[^5] ODF,[^6] and EPUB.[^7] Whilst <B>SiSU</B>
-relies on software, the markup is uncomplicated and minimalistic which
+useful to cite text. Dealing with documents at an object level together
+with object numbering also has implications for search that <b>SiSU</b> is able
+to take advantage of.
+<p> <br>
+One of the challenges of maintaining documents is to keep them in a format
+that allows use of them independently of proprietary platforms. Consider
+issues related to dealing with legacy proprietary formats today and what
+guarantee you have that old proprietary formats will remain (or can be
+read without proprietary software/equipment) in 15 years time, or the way
+the way in which html has evolved over its relatively short span of existence.
+<b>SiSU</b> provides the flexibility of producing documents in multiple non-proprietary
+open formats including <i>HTML,</i> <i>EPUB,</i> [^5] <i>ODT,</i> [^6] <i>PDF</i> [^7] <i>ODF,</i> [^8]. Whilst
+<b>SiSU</b> relies on software, the markup is uncomplicated and minimalistic which
guarantees that future engines can be written to run against it. It is also
-easily converted to other formats, which means documents prepared in
-<B>SiSU</B> can be migrated to other document formats. Further security is
-provided by the fact that the software itself, <B>SiSU</B> is available under
-GPL3 a licence that guarantees that the source code will always be open, and
-free as in libre, which means that that code base can be used, updated and
-further developed as required under the terms of its license. Another
-challenge is to keep up with a moving target. <B>SiSU</B> permits new forms of
-output to be added as they become important, (Open Document Format text was
-added in 2006 when it became an ISO standard for office applications and the
-archival of documents), EPUB was introduced in 2009; and allows the technical
-representations existing output to be updated (html has evolved and the related
-module has been updated repeatedly over the years, presumably when the World
-Wide Web Consortium (w3c) finalises html 5 which is currently under
-development, the html module will again be updated allowing all existing
-documents to be regenerated as html 5).
-
-<P> <BR>
-
+easily converted to other formats, which means documents prepared in <b>SiSU</b>
+can be migrated to other document formats. Further security is provided
+by the fact that the software itself, <b>SiSU</b> is available under <i>GPLv3</i> a licence
+that guarantees that the source code will always be open, and free as in
+libre, which means that that code base can be used, updated and further
+developed as required under the terms of its license. Another challenge
+is to keep up with a moving target. <b>SiSU</b> permits new forms of output to
+be added as they become important, (Open Document Format text was added
+in 2006 when it became an ISO standard for office applications and the
+archival of documents), <i>EPUB</i> was introduced in 2009; and allows the technical
+representations existing output to be updated ( <i>HTML</i> has evolved and the
+related module has been updated repeatedly over the years, presumably when
+the World Wide Web Consortium (w3c) finalises <i>HTML</i> 5 which is currently
+under development, the <i>HTML</i> module will again be updated allowing all existing
+documents to be regenerated as <i>HTML</i> 5).
+<p> <br>
The document formats are written to the file-system and available for indexing
-by independent indexing tools, whether off the web like Google and Yahoo or on
-the site like Lucene and Hyperestraier.
-
-<P> <BR>
-
-<B>SiSU</B> also provides other features such as concordance files and document
+by independent indexing tools, whether off the web like Google and Yahoo
+or on the site like Lucene and Hyperestraier.
+<p> <br>
+<b>SiSU</b> also provides other features such as concordance files and document
content certificates, and the working against an abstraction of document
-structure has further possibilities for the research and development of other
-document representations, the availability of objects is useful for example for
-topic maps and thesauri, together with the flexibility of <B>SiSU</B> offers
-great possibilities.
-
-<P> <BR>
-
-<B>SiSU</B> is primarily for published works, which can take advantage of the
-citation system to reliably reference its documents. <B>SiSU</B> works well in
-a complementary manner with such collaborative technologies as Wikis, which can
-take advantage of and be used to discuss the substance of content prepared in
-<B>SiSU.</B>
-
-<P> <BR>
-
-&lt;<A HREF="http://www.sisudoc.org/">http://www.sisudoc.org/</A>&gt;
-
-<P> <BR>
-
-&lt;<A HREF="http://www.jus.uio.no/sisu">http://www.jus.uio.no/sisu</A>&gt;
-
-<P>
-<A NAME="lbAG">&nbsp;</A>
-<H2>2. COMMANDS SUMMARY</H2>
-
-<BR> <P>
-
-<A NAME="lbAH">&nbsp;</A>
-<H2>2.1 DESCRIPTION</H2>
-
-<P> <BR>
-
-<B>SiSU</B> is a document publishing system, that from a simple single
-marked-up document, produces multiple output formats including: plaintext,
-html, xhtml, XML, epub, odt (odf text), LaTeX, pdf, info, and SQL (PostgreSQL
-and SQLite), which share text object numbers (&quot;object citation
-numbering&quot;) and the same document structure information. For more see:
-&lt;<A HREF="http://www.jus.uio.no/sisu">http://www.jus.uio.no/sisu</A>&gt;
-
-<P>
-<A NAME="lbAI">&nbsp;</A>
-<H2>2.2 DOCUMENT PROCESSING COMMAND FLAGS</H2>
-
-<P>
-<DL COMPACT>
-<DT><B>-a [filename/wildcard]</B>
-
-<DD>
-produces plaintext with Unix linefeeds and without markup, (object numbers are
-omitted), has footnotes at end of each paragraph that contains them [ &nbsp;-A for &nbsp;equivalent &nbsp;dos &nbsp;(linefeed) &nbsp;output &nbsp;file] [see &nbsp;-e &nbsp;for endnotes]. (Options include: --endnotes for endnotes --footnotes for
-footnotes at the end of each paragraph --unix for unix linefeed (default)
---msdos for msdos linefeed)
-<P>
-
-<DT><B>-b [filename/wildcard]</B>
-
-<DD>
-see --xhtml
-<P>
-<DT><B>--by-*</B>
-
-<DD>
-see --output-by-*
-<P>
-<DT><B>-C</B>
-
-<DD>
-configure/initialise shared output directory files initialize shared output
-directory (config files such as css and dtd files are not updated if they
-already exist unless modifier is used). -C --init-site configure/initialise
-site more extensive than -C on its own, shared output directory files/force
-update, existing shared output config files such as css and dtd files are
-updated if this modifier is used.
-<P>
-<DT><B>-CC</B>
-
-<DD>
-see --configure
-<P>
-<DT><B>-c [filename/wildcard]</B>
-
-<DD>
-see --color-toggle
-<P>
-<DT><B>--color-toggle [filename/wildcard]</B>
-
-<DD>
-screen toggle ansi screen colour on or off depending on default set (unless -c
-flag is used: if sisurc colour default is set to 'true', output to screen will
-be with colour, if sisurc colour default is set to 'false' or is undefined
-screen output will be without colour). Alias -c
-<P>
-<DT><B>--configure</B>
-
-<DD>
-configure/initialise shared output directory files initialize shared output
-directory (config files such as css and dtd files are not updated if they
-already exist unless modifier is used). The equivalent of: -C --init-site
-configure/initialise site, more extensive than -C on its own, shared output
-directory files/force update, existing shared output config files such as css
-and dtd files are updated if -CC is used.
-<P>
-<DT><B>--concordance [filename/wildcard]</B>
-
-<DD>
-produces concordance (wordmap) a rudimentary index of all the words in a
-document. (Concordance files are not generated for documents of over 260,000
-words unless this limit is increased in the file sisurc.yml). Alias -w
-<P>
-<DT><B>-D [instruction] [filename]</B>
-
-<DD>
-see --pg
-<P>
-<DT><B>-d [--db-[database &nbsp;type &nbsp;(sqlite|pg)]] --[instruction] [filename]</B>
-
-<DD>
-see --sqlite
-<P>
-<DT><B>--dal [filename/wildcard/url]</B>
-
-<DD>
-assumed for most other flags, creates new intermediate files for processing
+structure has further possibilities for the research and development of
+other document representations, the availability of objects is useful for
+example for topic maps and thesauri, together with the flexibility of <b>SiSU</b>
+offers great possibilities.
+<p> <br>
+<b>SiSU</b> is primarily for published works, which can take advantage of the
+citation system to reliably reference its documents. <b>SiSU</b> works well in
+a complementary manner with such collaborative technologies as Wikis, which
+can take advantage of and be used to discuss the substance of content prepared
+in <b>SiSU.</b>
+<p> <br>
+&lt;<a href='http://www.sisudoc.org/'>http://www.sisudoc.org/</a>
+&gt;
+<p> <br>
+&lt;<a href='http://www.jus.uio.no/sisu'>http://www.jus.uio.no/sisu</a>
+&gt;
+<p>
+<h2><a name='sect5' href='#toc5'>Commands Summary</a></h2>
+<br>
+
+<p>
+<h2><a name='sect6' href='#toc6'>Description</a></h2>
+
+<p> <br>
+<b>SiSU</b> is a document publishing system, that from a simple single marked-up
+document, produces multiple output formats including: <i>plaintext,</i> <i>HTML,</i>
+<i>XHTML,</i> <i>XML,</i> <i>EPUB,</i> <i>ODT</i> ( <i>OpenDocument</i> ( <i>ODF</i> ) text), <i>LaTeX,</i> <i>PDF,</i> info, and
+<i>SQL</i> ( <i>PostgreSQL</i> and <i>SQLite</i> ) , which share text object numbers ("object
+citation numbering") and the same document structure information. For more
+see: &lt;<a href='http://sisudoc.org'>http://sisudoc.org</a>
+&gt; or &lt;<a href='http://www.jus.uio.no/sisu'>http://www.jus.uio.no/sisu</a>
+&gt;
+<p>
+<h2><a name='sect7' href='#toc7'>Document Processing
+Command Flags</a></h2>
+
+<p>
+<dl>
+
+<dt><b>-a [filename/wildcard]</b> </dt>
+<dd>produces <i>plaintext</i> with Unix linefeeds
+and without markup, (object numbers are omitted), has footnotes at end
+of each paragraph that contains them [ &nbsp;-A &nbsp;for &nbsp;output &nbsp;file] [see &nbsp;-e &nbsp;for &nbsp;endnotes].
+(Options include: --endnotes for endnotes --footnotes for footnotes at the
+end of each paragraph --unix for unix linefeed (default) --msdos for msdos
+linefeed)
+<p> </dd>
+
+<dt><b>-b [filename/wildcard]</b> </dt>
+<dd>see --xhtml
+<p> </dd>
+
+<dt><b>--by-*</b> </dt>
+<dd>see --output-by-*
+<p> </dd>
+
+<dt><b>-C</b> </dt>
+<dd>configure/initialise
+shared output directory files initialize shared output directory (config
+files such as css and dtd files are not updated if they already exist unless
+modifier is used). -C --init-site configure/initialise site more extensive than
+-C on its own, shared output directory files/force update, existing shared
+output config files such as css and dtd files are updated if this modifier
+is used.
+<p> </dd>
+
+<dt><b>-CC</b> </dt>
+<dd>see --configure
+<p> </dd>
+
+<dt><b>-c [filename/wildcard]</b> </dt>
+<dd>see --color-toggle
+<p> </dd>
+
+<dt><b>--color-toggle
+[filename/wildcard]</b> </dt>
+<dd>screen toggle ansi screen colour on or off depending
+on default set (unless -c flag is used: if sisurc colour default is set
+to &rsquo;true&rsquo;, output to screen will be with colour, if sisurc colour default
+is set to &rsquo;false&rsquo; or is undefined screen output will be without colour). Alias
+
+<p>-
+<p>c
+<p> </dd>
+
+<dt><b>--configure</b> </dt>
+<dd>configure/initialise shared output directory files initialize
+shared output directory (config files such as css and dtd files are not
+updated if they already exist unless modifier is used). The equivalent of:
+-C --init-site configure/initialise site, more extensive than -C on its own,
+shared output directory files/force update, existing shared output config
+files such as css and dtd files are updated if -CC is used.
+<p> </dd>
+
+<dt><b>--concordance
+[filename/wildcard]</b> </dt>
+<dd>produces concordance (wordmap) a rudimentary index
+of all the words in a document. (Concordance files are not generated for
+documents of over 260,000 words unless this limit is increased in the file
+sisurc.yml). Alias -w
+<p> </dd>
+
+<dt><b>-D [instruction] [filename]</b> </dt>
+<dd>see --pg
+<p> </dd>
+
+<dt><b>-d [--db-[database &nbsp;type
+&nbsp;(sqlite|pg)]] --[instruction] [filename]</b> </dt>
+<dd>see --sqlite
+<p> </dd>
+
+<dt><b>--dal [filename/wildcard/url]</b>
+</dt>
+<dd>assumed for most other flags, creates new intermediate files for processing
(document abstraction) that is used in all subsequent processing of other
output. This step is assumed for most processing flags. To skip it see -n.
-Alias -m
-<P>
-<DT><B>--delete [filename/wildcard]</B>
-<DD>
-see --zap
-<P>
-<DT><B>--dump[=directory_path] [filename/wildcard]</B>
+<p>Alias -m
+<p> </dd>
+
+<dt><b>--delete [filename/wildcard]</b> </dt>
+<dd>see --zap
+<p> </dd>
-<DD>
-places output in directory specified, if none is specified in the current
+<dt><b>--dump[=directory_path] [filename/wildcard]</b>
+</dt>
+<dd>places output in directory specified, if none is specified in the current
directory (pwd). Compare --redirect
-<P>
-<DT><B>-e [filename/wildcard]</B>
-
-<DD>
-see --epub
-<P>
-<DT><B>--epub [filename/wildcard]</B>
-
-<DD>
-produces an epub document, [sisu &nbsp;version &nbsp;&gt;=2 &nbsp;] (filename.epub). Alias -e
-<P>
-<DT><B>--exc-*</B>
-
-<DD>
-exclude output feature, overrides configuration settings --exc-ocn, (exclude
-object citation numbering, (switches off object citation numbering), affects
-html (seg, scroll), epub, xhtml, xml, pdf); --exc-toc, (exclude table of
-contents, affects html (scroll), epub, pdf); --exc-links-to-manifest,
---exc-manifest-links, (exclude links to manifest, affects html (seg,
-scroll)); --exc-search-form, (exclude search form, affects html (seg,
-scroll), manifest); --exc-minitoc, (exclude mini table of contents, affects
-html (seg), concordance, manifest); --exc-manifest-minitoc, (exclude mini
-table of contents, affects manifest); --exc-html-minitoc, (exclude mini
-table of contents, affects html (seg), concordance); --exc-html-navigation,
-(exclude navigation, affects html (seg)); --exc-html-navigation-bar,
-(exclude navigation bar, affects html (seg)); --exc-html-search-form,
-(exclude search form, affects html (seg, scroll)); --exc-html-right-pane,
-(exclude right pane/column, affects html (seg, scroll));
---exc-html-top-band, (exclude top band, affects html (seg, scroll),
-concordance (minitoc forced on to provide seg navigation)); --exc-segsubtoc
-(exclude sub table of contents, affects html (seg), epub); see also --inc-*
-<P>
-<DT><B>-F [--webserv=webrick]</B>
-
-<DD>
-see --sample-search-form
-<P>
-<DT><B>-f [optional &nbsp;string &nbsp;part &nbsp;of &nbsp;filename]</B>
-
-<DD>
-see --find
-<P>
-<DT><B>--find [optional &nbsp;string &nbsp;part &nbsp;of &nbsp;filename]</B>
-
-<DD>
-without match string, glob all .sst .ssm files in directory (including
-language subdirectories). With match string, find files that match given string
-in directory (including language subdirectories). Alias -f, --glob, -G
-<P>
-<DT><B>-G [optional &nbsp;string &nbsp;part &nbsp;of &nbsp;filename]</B>
-
-<DD>
-see --find
-<P>
-<DT><B>-g [filename/wildcard]</B>
-
-<DD>
-see --git
-<P>
-<DT><B>--git [filename/wildcard]</B>
-
-<DD>
-produces or updates markup source file structure in a git repo (experimental
-and subject to change). Alias -g
-<P>
-<DT><B>--glob [optional &nbsp;string &nbsp;part &nbsp;of &nbsp;filename]</B>
-
-<DD>
-see --find
-<P>
-<DT><B>-h [filename/wildcard]</B>
-
-<DD>
-see --html
-<P>
-<DT><B>--harvest *.ss[tm]</B>
-
-<DD>
-makes two lists of sisu output based on the sisu markup documents in a
-directory: list of author and authors works (year and titles), and; list by
-topic with titles and author. Makes use of header metadata fields (author,
-title, date, topic_register). Can be used with maintenance (-M) and remote
-placement (-R) flags.
-<P>
-<DT><B>--help [topic]</B>
-
-<DD>
-provides help on the selected topic, where topics (keywords) include: list,
-(com)mands, short(cuts), (mod)ifiers, (env)ironment, markup, syntax, headers,
-headings, endnotes, tables, example, customise, skin, (dir)ectories, path,
-(lang)uage, db, install, setup, (conf)igure, convert, termsheet, search, sql,
-features, license.
-<P>
-<DT><B>--html [filename/wildcard]</B>
-
-<DD>
-produces html output, segmented text with table of contents (toc.html and
-index.html) and the document in a single file (scroll.html). Alias -h
-<P>
-<DT><B>-I [filename/wildcard]</B>
-
-<DD>
-see --texinfo
-<P>
-<DT><B>-i [filename/wildcard]</B>
-
-<DD>
-see --manpage
-<P>
-<DT><B>--inc-*</B>
-
-<DD>
-include output feature, overrides configuration settings, (usually the default
-if none set), has precedence over --exc-* (exclude output feature). Some
-detail provided under --exc-*, see --exc-*
-<P>
-<DT><B>-j [filename/wildcard]</B>
-
-<DD>
-copies images associated with a file for use by html, xhtml &amp; xml outputs
+<p> </dd>
+
+<dt><b>-e [filename/wildcard]</b> </dt>
+<dd>see --epub
+<p> </dd>
+
+<dt><b>--epub
+[filename/wildcard]</b> </dt>
+<dd>produces an epub document, [sisu &nbsp;version &nbsp;&gt;=2 &nbsp;] (filename.epub).
+
+<p>Alias -e
+<p> </dd>
+
+<dt><b>--exc-*</b> </dt>
+<dd>exclude output feature, overrides configuration settings
+--exc- <i>ocn,</i> (exclude <i>object</i> citation numbering, (switches off <i>object</i> citation
+numbering ) , affects html (seg, scroll), epub, xhtml, xml, pdf) ; --exc-toc,
+(exclude table of contents, affects html (scroll), epub, pdf) ; --exc-links-to-manifest,
+--exc-manifest-links, (exclude links to manifest, affects html (seg, scroll));
+--exc-search-form, (exclude search form, affects html (seg, scroll), manifest);
+--exc-minitoc, (exclude mini table of contents, affects html (seg), concordance,
+manifest); --exc-manifest-minitoc, (exclude mini table of contents, affects
+manifest); --exc-html-minitoc, (exclude mini table of contents, affects html
+(seg), concordance); --exc-html-navigation, (exclude navigation, affects html
+(seg)); --exc-html-navigation-bar, (exclude navigation bar, affects html (seg));
+--exc-html-search-form, (exclude search form, affects html (seg, scroll)); --exc-html-right-pane,
+(exclude right pane/column, affects html (seg, scroll)); --exc-html-top-band,
+(exclude top band, affects html (seg, scroll), concordance (minitoc forced
+on to provide seg navigation)); --exc-segsubtoc (exclude sub table of contents,
+affects html (seg), epub) ; see also --inc-*
+<p> </dd>
+
+<dt><b>-F [--webserv=webrick]</b> </dt>
+<dd>see --sample-search-form
+
+<p> </dd>
+
+<dt><b>-f [optional &nbsp;string &nbsp;part &nbsp;of &nbsp;filename]</b> </dt>
+<dd>see --find
+<p> </dd>
+
+<dt><b>--find [optional &nbsp;string &nbsp;part
+&nbsp;of &nbsp;filename]</b> </dt>
+<dd>without match string, glob all .sst .ssm files in directory
+(including language subdirectories). With match string, find files that
+match given string in directory (including language subdirectories). Alias
+-f, --glob, -G
+<p> </dd>
+
+<dt><b>-G [optional &nbsp;string &nbsp;part &nbsp;of &nbsp;filename]</b> </dt>
+<dd>see --find
+<p> </dd>
+
+<dt><b>-g [filename/wildcard]</b>
+</dt>
+<dd>
+<p>see --git
+<p> </dd>
+
+<dt><b>--git [filename/wildcard]</b> </dt>
+<dd>produces or updates markup source file
+structure in a git repo (experimental and subject to change). Alias -g
+<p> </dd>
+
+<dt><b>--glob
+[optional &nbsp;string &nbsp;part &nbsp;of &nbsp;filename]</b> </dt>
+<dd>see --find
+<p> </dd>
+
+<dt><b>-h [filename/wildcard]</b> </dt>
+<dd>see
+
+<p>-
+<p>-
+<p>html
+<p> </dd>
+
+<dt><b>--harvest *.ss[tm]</b> </dt>
+<dd>makes two lists of sisu output based on the sisu
+markup documents in a directory: list of author and authors works (year
+and titles), and; list by topic with titles and author. Makes use of header
+metadata fields (author, title, date, topic_register). Can be used with
+maintenance (-M) and remote placement (-R) flags.
+<p> </dd>
+
+<dt><b>--help [topic]</b> </dt>
+<dd>provides help
+on the selected topic, where topics (keywords) include: list, (com)mands,
+short(cuts), (mod)ifiers, (env)ironment, markup, syntax, headers, headings,
+endnotes, tables, example, customise, skin, (dir)ectories, path, (lang)uage,
+db, install, setup, (conf)igure, convert, termsheet, search, sql, features,
+license.
+<p> </dd>
+
+<dt><b>--html [filename/wildcard]</b> </dt>
+<dd>produces html output, segmented text
+with table of contents (toc.html and index.html) and the document in a single
+file (scroll.html). Alias -h
+<p> </dd>
+
+<dt><b>-I [filename/wildcard]</b> </dt>
+<dd>see --texinfo
+<p> </dd>
+
+<dt><b>-i [filename/wildcard]</b>
+</dt>
+<dd>
+<p>see --manpage
+<p> </dd>
+
+<dt><b>--inc-*</b> </dt>
+<dd>include output feature, overrides configuration settings,
+(usually the default if none set), has precedence over --exc-* (exclude output
+feature). Some detail provided under --exc-*, see --exc-*
+<p> </dd>
+
+<dt><b>-j [filename/wildcard]</b>
+</dt>
+<dd>copies images associated with a file for use by html, xhtml &amp; xml outputs
(automatically invoked by --dump &amp; redirect).
-<P>
-<DT><B>--keep-processing-files [filename/wildcard/url]</B>
-
-<DD>
-see --maintenance
-<P>
-<DT><B>-L</B>
-
-<DD>
-prints license information.
-<P>
-<DT><B>-M [filename/wildcard/url]</B>
-
-<DD>
-see --maintenance
-<P>
-<DT><B>-m [filename/wildcard/url]</B>
-
-<DD>
-see --dal (document abstraction level/layer)
-<P>
-<DT><B>--machine [filename/wildcard/url]</B>
-
-<DD>
-see --dal (document abstraction level/layer)
-<P>
-<DT><B>--maintenance [filename/wildcard/url]</B>
-
-<DD>
-maintenance mode, interim processing files are preserved and their locations
-indicated. (also see -V). Aliases -M and --keep-processing-files.
-<P>
-<DT><B>--manpage [filename/wildcard]</B>
-
-<DD>
-produces man page of file, not suitable for all outputs. Alias -i
-<P>
-<DT><B>-N [filename/wildcard/url]</B>
-
-<DD>
-document digest or document content certificate ( DCC ) as md5 digest tree of
-the document: the digest for the document, and digests for each object
+<p> </dd>
+
+<dt><b>--keep-processing-files [filename/wildcard/url]</b>
+</dt>
+<dd>
+<p>see --maintenance
+<p> </dd>
+
+<dt><b>-L</b> </dt>
+<dd>prints license information.
+<p> </dd>
+
+<dt><b>-M [filename/wildcard/url]</b>
+</dt>
+<dd>
+<p>see --maintenance
+<p> </dd>
+
+<dt><b>-m [filename/wildcard/url]</b> </dt>
+<dd>see --dal (document abstraction
+level/layer)
+<p> </dd>
+
+<dt><b>--machine [filename/wildcard/url]</b> </dt>
+<dd>see --dal (document abstraction
+level/layer)
+<p> </dd>
+
+<dt><b>--maintenance [filename/wildcard/url]</b> </dt>
+<dd>maintenance mode, interim
+processing files are preserved and their locations indicated. (also see
+-V). Aliases -M and --keep-processing-files.
+<p> </dd>
+
+<dt><b>--manpage [filename/wildcard]</b> </dt>
+<dd>produces
+man page of file, not suitable for all outputs. Alias -i
+<p> </dd>
+
+<dt><b>-N [filename/wildcard/url]</b>
+</dt>
+<dd>document digest or document content certificate ( DCC ) as md5 digest tree
+of the document: the digest for the document, and digests for each object
contained within the document (together with information on software versions
that produced it) (digest.txt). -NV for verbose digest output to screen.
-<P>
-<DT><B>-n [filename/wildcard/url]</B>
-
-<DD>
-skip the creation of intermediate processing files (document abstraction) if
-they already exist, this skips the equivalent of -m which is otherwise assumed
-by most processing flags.
-<P>
-<DT><B>--no-*</B>
-
-<DD>
-see --exc-*
-<P>
-<DT><B>-o [filename/wildcard/url]</B>
-
-<DD>
-see --odt
-<P>
-<DT><B>--odf [filename/wildcard/url]</B>
-
-<DD>
-see --odt
-<P>
-<DT><B>--odt [filename/wildcard/url]</B>
-
-<DD>
-output basic document in opendocument file format (opendocument.odt). Alias -o
-<P>
-<DT><B>--output-by-*</B>
-
-<DD>
-select output directory structure from 3 alternatives:
---output-by-language, (language directory (based on language code) with
-filetype (html, epub, pdf etc.) subdirectories); --output-by-filetype,
-(filetype directories with language code as part of filename);
---output-by-filename, (filename directories with language code as part of
-filename). This is configurable. Alias --by-*
-<P>
-<DT><B>-P [language_directory/filename &nbsp;language_directory]</B>
-
-<DD>
-see --po4a
-<P>
-<DT><B>-p [filename/wildcard]</B>
-
-<DD>
-see --pdf
-<P>
-<DT><B>--pdf [filename/wildcard]</B>
-
-<DD>
-produces LaTeX pdf (portrait.pdf &amp; landscape.pdf). Default paper size is set in
-config file, or document header, or provided with additional command line
-parameter, e.g. --papersize-a4 preset sizes include: 'A4', U.S. 'letter' and
-
-<P>
-<DT><B>--pg [instruction] [filename]</B>
-
-<DD>
-database postgresql ( --pgsql may be used instead) possible instructions,
-include: --createdb; --create; --dropall; --import [filename];
---update [filename]; --remove [filename]; see database section below. Alias
--D
-<P>
-<DT><B>--po [language_directory/filename &nbsp;language_directory]</B>
-
-<DD>
-see --po4a
-<P>
-<DT><B>--po4a [language_directory/filename &nbsp;language_directory]</B>
-
-<DD>
-produces .pot and po files for the file in the languages specified by the
-language directory.
-<B>SiSU</B>
-
-markup is placed in subdirectories named with the language code, e.g. en/ fr/
-es/. The sisu config file must set the output directory structure to
-multilingual. v3, experimental
-<P>
-<DT><B>-Q [filename/wildcard]</B>
-
-<DD>
-see --qrcode
-<P>
-<DT><B>-q [filename/wildcard]</B>
-
-<DD>
-see --quiet
-<P>
-<DT><B>--qrcode [filename/wildcard]</B>
-
-<DD>
-generate QR code image of metadata (used in manifest). v3 only.
-<P>
-<DT><B>--quiet [filename/wildcard]</B>
-
-<DD>
-quiet less output to screen.
-<P>
-<DT><B>-R [filename/wildcard]</B>
-
-<DD>
-see --rsync
-<P>
-<DT><B>-r [filename/wildcard]</B>
-
-<DD>
-see --scp
-<P>
-<DT><B>--redirect[=directory_path] [filename/wildcard]</B>
-
-<DD>
-places output in subdirectory under specified directory, subdirectory uses the
-filename (without the suffix). If no output directory is specified places the
-subdirectory under the current directory (pwd). Compare --dump
-<P>
-<DT><B>--rsync [filename/wildcard]</B>
-
-<DD>
-copies sisu output files to remote host using rsync. This requires that
-sisurc.yml has been provided with information on hostname and username, and
-that you have your &quot;keys&quot; and ssh agent in place. Note the behavior of rsync
-different if -R is used with other flags from if used alone. Alone the rsync
---delete parameter is sent, useful for cleaning the remote directory (when
--R is used together with other flags, it is not). Also see --scp. Alias -R
-<P>
-<DT><B>-S</B>
-
-<DD>
-see --sisupod
-<P>
-<DT><B>-S [filename/wildcard]</B>
-
-<DD>
-see --sisupod
-<P>
-<DT><B>-s [filename/wildcard]</B>
-
-<DD>
-see --source
-<P>
-<DT><B>--sample-search-form [--webserv=webrick]</B>
-
-<DD>
-generate examples of (naive) cgi search form for sqlite and pgsql depends on
-your already having used sisu to populate an sqlite and/or pgsql database, (the
-sqlite version scans the output directories for existing sisu_sqlite databases,
-so it is first necessary to create them, before generating the search form) see
--d -D and the database section below. If the optional parameter
---webserv=webrick is passed, the cgi examples created will be set up to use
-the default port set for use by the webrick server, (otherwise the port is left
-blank and the system setting used, usually 80). The samples are dumped in the
-present work directory which must be writable, (with screen instructions given
+<p> </dd>
+
+<dt><b>-n
+[filename/wildcard/url]</b> </dt>
+<dd>skip the creation of intermediate processing files
+(document abstraction) if they already exist, this skips the equivalent
+of -m which is otherwise assumed by most processing flags.
+<p> </dd>
+
+<dt><b>--no-*</b> </dt>
+<dd>see --exc-*
+
+<p> </dd>
+
+<dt><b>-o [filename/wildcard/url]</b> </dt>
+<dd>see --odt
+<p> </dd>
+
+<dt><b>--odf [filename/wildcard/url]</b> </dt>
+<dd>see --odt
+
+<p> </dd>
+
+<dt><b>--odt [filename/wildcard/url]</b> </dt>
+<dd>output basic document in opendocument file
+format (opendocument.odt). Alias -o
+<p> </dd>
+
+<dt><b>--output-by-*</b> </dt>
+<dd>select output directory structure
+from 3 alternatives: --output-by-language, (language directory (based on language
+code) with filetype (html, epub, pdf etc.) subdirectories); --output-by-filetype,
+(filetype directories with language code as part of filename); --output-by-filename,
+(filename directories with language code as part of filename). This is configurable.
+Alias --by-*
+<p> </dd>
+
+<dt><b>-P [language_directory/filename &nbsp;language_directory]</b> </dt>
+<dd>see --po4a
+
+<p> </dd>
+
+<dt><b>-p [filename/wildcard]</b> </dt>
+<dd>see --pdf
+<p> </dd>
+
+<dt><b>--pdf [filename/wildcard]</b> </dt>
+<dd>produces <i>LaTeX</i>
+pdf (portrait.pdf &amp; landscape.pdf). Default paper size is set in config file,
+or document header, or provided with additional command line parameter,
+e.g. --papersize-a4 preset sizes include: &rsquo;A4&rsquo;, U.S. &rsquo;letter&rsquo; and &rsquo;legal&rsquo; and book sizes
+&rsquo;A5&rsquo; and &rsquo;B5&rsquo; (system defaults to A4). Alias -p
+<p> </dd>
+
+<dt><b>--pg [instruction] [filename]</b>
+</dt>
+<dd>database <i>PostgreSQL</i> ( --pgsql may be used instead) possible instructions,
+include: --createdb; --create; --dropall; --import [filename]; --update [filename];
+--remove [filename]; see database section below. Alias -D
+<p> </dd>
+
+<dt><b>--po [language_directory/filename
+&nbsp;language_directory]</b> </dt>
+<dd>see --po4a
+<p> </dd>
+
+<dt><b>--po4a [language_directory/filename &nbsp;language_directory]</b>
+</dt>
+<dd>produces .pot and po files for the file in the languages specified by the
+language directory. <b>SiSU</b> markup is placed in subdirectories named with the
+language code, e.g. en/ fr/ es/. The sisu config file must set the output
+directory structure to multilingual. v3, experimental
+<p> </dd>
+
+<dt><b>-Q [filename/wildcard]</b>
+</dt>
+<dd>
+<p>see --qrcode
+<p> </dd>
+
+<dt><b>-q [filename/wildcard]</b> </dt>
+<dd>see --quiet
+<p> </dd>
+
+<dt><b>--qrcode [filename/wildcard]</b>
+</dt>
+<dd>generate QR code image of metadata (used in manifest). v3 only.
+<p> </dd>
+
+<dt><b>--quiet [filename/wildcard]</b>
+</dt>
+<dd>quiet less output to screen.
+<p> </dd>
+
+<dt><b>-R [filename/wildcard]</b> </dt>
+<dd>see --rsync
+<p> </dd>
+
+<dt><b>-r [filename/wildcard]</b>
+</dt>
+<dd>
+<p>see --scp
+<p> </dd>
+
+<dt><b>--redirect[=directory_path] [filename/wildcard]</b> </dt>
+<dd>places output in
+subdirectory under specified directory, subdirectory uses the filename
+(without the suffix). If no output directory is specified places the subdirectory
+under the current directory (pwd). Compare --dump
+<p> </dd>
+
+<dt><b>--rsync [filename/wildcard]</b>
+</dt>
+<dd>copies sisu output files to remote host using rsync. This requires that
+sisurc.yml has been provided with information on hostname and username,
+and that you have your "keys" and ssh agent in place. Note the behavior
+of rsync different if -R is used with other flags from if used alone. Alone
+the rsync --delete parameter is sent, useful for cleaning the remote directory
+(when -R is used together with other flags, it is not). Also see --scp. Alias
+
+<p>-
+<p>R
+<p> </dd>
+
+<dt><b>-S</b> </dt>
+<dd>see --sisupod
+<p> </dd>
+
+<dt><b>-S [filename/wildcard]</b> </dt>
+<dd>see --sisupod
+<p> </dd>
+
+<dt><b>-s [filename/wildcard]</b>
+</dt>
+<dd>
+<p>see --source
+<p> </dd>
+
+<dt><b>--sample-search-form [--webserv=webrick]</b> </dt>
+<dd>generate examples of (naive)
+cgi search form for <i>SQLite</i> and PgSQL depends on your already having used
+sisu to populate an <i>SQLite</i> and/or PgSQL database, (the <i>SQLite</i> version scans
+the output directories for existing sisu_sqlite databases, so it is first
+necessary to create them, before generating the search form) see -d -D and
+the database section below. If the optional parameter --webserv=webrick is
+passed, the cgi examples created will be set up to use the default port
+set for use by the webrick server, (otherwise the port is left blank and
+the system setting used, usually 80). The samples are dumped in the present
+work directory which must be writable, (with screen instructions given
that they be copied to the cgi-bin directory). Alias -F
-<P>
-<DT><B>--scp [filename/wildcard]</B>
-
-<DD>
-copies sisu output files to remote host using scp. This requires that
-sisurc.yml has been provided with information on hostname and username, and
-that you have your &quot;keys&quot; and ssh agent in place. Also see --rsync. Alias -r
-<P>
-<DT><B>--sqlite --[instruction] [filename]</B>
-
-<DD>
-database type set to sqlite, this produces one of two possible databases,
-without additional database related instructions it produces a discreet sqlite
-file for the document processed; with additional instructions it produces a
-common sqlite database of all processed documents that (come from the same
-document preparation directory and as a result) share the same output directory
-base path (possible instructions include: --createdb; --create;
---dropall; --import [filename]; --update [filename]; --remove
+<p> </dd>
+
+<dt><b>--scp [filename/wildcard]</b>
+</dt>
+<dd>copies sisu output files to remote host using scp. This requires that sisurc.yml
+has been provided with information on hostname and username, and that you
+have your "keys" and ssh agent in place. Also see --rsync. Alias -r
+<p> </dd>
+
+<dt><b>--sqlite
+--[instruction] [filename]</b> </dt>
+<dd>database type set to <i>SQLite,</i> this produces one
+of two possible databases, without additional database related instructions
+it produces a discreet <i>SQLite</i> file for the document processed; with additional
+instructions it produces a common <i>SQLite</i> database of all processed documents
+that (come from the same document preparation directory and as a result)
+share the same output directory base path (possible instructions include:
+--createdb; --create; --dropall; --import [filename]; --update [filename]; --remove
[filename]); see database section below. Alias -d
-<P>
-<DT><B>--sisupod</B>
-
-<DD>
-produces a sisupod a zipped sisu directory of markup files including sisu
-markup source files and the directories local configuration file, images and
-skins. Note: this only includes the configuration files or skins contained in
-<BR>&nbsp;./_sisu&nbsp;not&nbsp;those&nbsp;in&nbsp;~/.sisu&nbsp;-S&nbsp;[filename/wildcard]&nbsp;option.&nbsp;Note:&nbsp;(this
-option is tested only with zsh). Alias -S
-<P>
-<DT><B>--sisupod [filename/wildcard]</B>
-
-<DD>
-produces a zipped file of the prepared document specified along with associated
-images, by default named sisupod.zip they may alternatively be named with the
-filename extension .ssp This provides a quick way of gathering the relevant
+<p> </dd>
+
+<dt><b>--sisupod</b> </dt>
+<dd>produces a sisupod
+a zipped sisu directory of markup files including sisu markup source files
+and the directories local configuration file, images and skins. Note: this
+only includes the configuration files or skins contained in ./_sisu not
+those in ~/.sisu -S [filename/wildcard] option. Note: (this<br>
+ option is tested only with zsh). Alias -S
+<p> </dd>
+
+<dt><b>--sisupod [filename/wildcard]</b> </dt>
+<dd>produces
+a zipped file of the prepared document specified along with associated
+images, by default named sisupod.zip they may alternatively be named with
+the filename extension .ssp This provides a quick way of gathering the relevant
parts of a sisu document which can then for example be emailed. A sisupod
-includes sisu markup source file, (along with associated documents if a master
-file, or available in multilingual versions), together with related images and
-skin.
-<B>SiSU</B>
-
-commands can be run directly against a sisupod contained in a local directory,
-or provided as a url on a remote site. As there is a security issue with skins
-provided by other users, they are not applied unless the flag --trust or
---trusted is added to the command instruction, it is recommended that file
-that are not your own are treated as untrusted. The directory structure of the
-unzipped file is understood by sisu, and sisu commands can be run within it.
-Note: if you wish to send multiple files, it quickly becomes more space
-efficient to zip the sisu markup directory, rather than the individual files
-for sending). See the -S option without [filename/wildcard]. Alias -S
-<P>
-<DT><B>--source [filename/wildcard]</B>
-
-<DD>
-copies sisu markup file to output directory. Alias -s
-<P>
-<DT><B>-T [filename/wildcard &nbsp;(*.termsheet.rb)]</B>
-
-<DD>
-standard form document builder, preprocessing feature
-<P>
-<DT><B>-t [filename/wildcard]</B>
-
-<DD>
-see --txt
-<P>
-<DT><B>--texinfo [filename/wildcard]</B>
-
-<DD>
-produces texinfo and info file, (view with pinfo). Alias -I
-<P>
-<DT><B>--txt [filename/wildcard]</B>
-
-<DD>
-produces plaintext with Unix linefeeds and without markup, (object numbers are
-omitted), has footnotes at end of each paragraph that contains them [ &nbsp;-A for &nbsp;equivalent &nbsp;dos &nbsp;(linefeed) &nbsp;output &nbsp;file] [see &nbsp;-e &nbsp;for endnotes]. (Options include: --endnotes for endnotes --footnotes for
-footnotes at the end of each paragraph --unix for unix linefeed (default)
---msdos for msdos linefeed). Alias -t
-<P>
-<DT><B>-U [filename/wildcard]</B>
-
-<DD>
-see --urls
-<P>
-<DT><B>-u [filename/wildcard]</B>
-
-<DD>
-provides url mapping of output files for the flags requested for processing,
-also see -U
-<P>
-<DT><B>--urls [filename/wildcard]</B>
-
-<DD>
-prints url output list/map for the available processing flags options and
-resulting files that could be requested, (can be used to get a list of
-processing options in relation to a file, together with information on the
-output that would be produced), -u provides url output mapping for those flags
-requested for processing. The default assumes sisu_webrick is running and
-provides webrick url mappings where appropriate, but these can be switched to
-file system paths in sisurc.yml. Alias -U
-<P>
-<DT><B>-V</B>
-
-<DD>
-on its own, provides
-<B>SiSU</B>
-
-version and environment information (sisu --help env)
-<P>
-<DT><B>-V [filename/wildcard]</B>
-
-<DD>
-even more verbose than the -v flag.
-<P>
-<DT><B>-v</B>
-
-<DD>
-on its own, provides
-<B>SiSU</B>
-
-version information
-<P>
-<DT><B>-v [filename/wildcard]</B>
-
-<DD>
-see --verbose
-<P>
-<DT><B>--v2 [filename/wildcard]</B>
-
-<DD>
-invokes the sisu v2 document parser/generator. This is the default and is
-normally omitted.
-<P>
-<DT><B>--v3 [filename/wildcard]</B>
-
-<DD>
-invokes the sisu v3 document parser/generator. Currently under development and
-incomplete, v3 requires &gt;= ruby1.9.2p180. You may run sisu3 instead.
-<P>
-<DT><B>--verbose [filename/wildcard]</B>
-
-<DD>
-provides verbose output of what is being generated, where output is placed (and
-error messages if any), as with -u flag provides a url mapping of files
+includes sisu markup source file, (along with associated documents if a
+master file, or available in multilingual versions), together with related
+images and skin. <b>SiSU</b> commands can be run directly against a sisupod contained
+in a local directory, or provided as a url on a remote site. As there is
+a security issue with skins provided by other users, they are not applied
+unless the flag --trust or --trusted is added to the command instruction, it
+is recommended that file that are not your own are treated as untrusted.
+The directory structure of the unzipped file is understood by sisu, and
+sisu commands can be run within it. Note: if you wish to send multiple files,
+it quickly becomes more space efficient to zip the sisu markup directory,
+rather than the individual files for sending). See the -S option without
+[filename/wildcard]. Alias -S
+<p> </dd>
+
+<dt><b>--source [filename/wildcard]</b> </dt>
+<dd>copies sisu markup
+file to output directory. Alias -s
+<p> </dd>
+
+<dt><b>-T [filename/wildcard &nbsp;(*.termsheet.rb)]</b>
+</dt>
+<dd>standard form document builder, preprocessing feature
+<p> </dd>
+
+<dt><b>-t [filename/wildcard]</b>
+</dt>
+<dd>
+<p>see --txt
+<p> </dd>
+
+<dt><b>--texinfo [filename/wildcard]</b> </dt>
+<dd>produces texinfo and info file, (view
+with pinfo). Alias -I
+<p> </dd>
+
+<dt><b>--txt [filename/wildcard]</b> </dt>
+<dd>produces <i>plaintext</i> with Unix
+linefeeds and without markup, (object numbers are omitted), has footnotes
+at end of each paragraph that contains them [ &nbsp;-A &nbsp;for &nbsp;output &nbsp;file] [see &nbsp;-e
+&nbsp;for &nbsp;endnotes]. (Options include: --endnotes for endnotes --footnotes for footnotes
+at the end of each paragraph --unix for unix linefeed (default) --msdos for
+msdos linefeed). Alias -t
+<p> </dd>
+
+<dt><b>-U [filename/wildcard]</b> </dt>
+<dd>see --urls
+<p> </dd>
+
+<dt><b>-u [filename/wildcard]</b>
+</dt>
+<dd>provides url mapping of output files for the flags requested for processing,
+
+<p>also see -U
+<p> </dd>
+
+<dt><b>--urls [filename/wildcard]</b> </dt>
+<dd>prints url output list/map for the
+available processing flags options and resulting files that could be requested,
+(can be used to get a list of processing options in relation to a file,
+together with information on the output that would be produced), -u provides
+url output mapping for those flags requested for processing. The default
+assumes sisu_webrick is running and provides webrick url mappings where
+appropriate, but these can be switched to file system paths in sisurc.yml.
+
+<p>Alias -U
+<p> </dd>
+
+<dt><b>-V</b> </dt>
+<dd>on its own, provides <b>SiSU</b> version and environment information
+(sisu --help env)
+<p> </dd>
+
+<dt><b>-V [filename/wildcard]</b> </dt>
+<dd>even more verbose than the -v flag.
+
+<p> </dd>
+
+<dt><b>-v</b> </dt>
+<dd>on its own, provides <b>SiSU</b> version information
+<p> </dd>
+
+<dt><b>-v [filename/wildcard]</b>
+</dt>
+<dd>
+<p>see --verbose
+<p> </dd>
+
+<dt><b>--v3 [filename/wildcard]</b> </dt>
+<dd>invokes the sisu v3 document parser/generator.
+You may run sisu3 instead.
+<p> </dd>
+
+<dt><b>--v4 [filename/wildcard]</b> </dt>
+<dd>invokes the sisu v4 document
+parser/generator. This is the default and is normally omitted.
+<p> </dd>
+
+<dt><b>--verbose [filename/wildcard]</b>
+</dt>
+<dd>provides verbose output of what is being generated, where output is placed
+(and error messages if any), as with -u flag provides a url mapping of files
created for each of the processing flag requests. Alias -v
-<P>
-<DT><B>-W</B>
-
-<DD>
-see --webrick
-<P>
-<DT><B>-w [filename/wildcard]</B>
-
-<DD>
-see --concordance
-<P>
-<DT><B>--webrick</B>
-
-<DD>
-starts ruby's webrick webserver points at sisu output directories, the default
-port is set to 8081 and can be changed in the resource configuration files.
-[tip: &nbsp;the &nbsp;webrick &nbsp;server &nbsp;requires &nbsp;link &nbsp;suffixes, &nbsp;so &nbsp;html output &nbsp;should &nbsp;be &nbsp;created &nbsp;using &nbsp;the &nbsp;-h &nbsp;option &nbsp;rather &nbsp;than -H &nbsp;; &nbsp;also, &nbsp;note &nbsp;-F &nbsp;webrick &nbsp;]. Alias -W
-<P>
-<DT><B>--wordmap [filename/wildcard]</B>
-
-<DD>
-see --concordance
-<P>
-<DT><B>--xhtml [filename/wildcard]</B>
-
-<DD>
-produces xhtml/XML output for browser viewing (sax parsing). Alias -b
-<P>
-<DT><B>--xml-dom [filename/wildcard]</B>
-
-<DD>
-produces XML output with deep document structure, in the nature of dom. Alias
--X
-<P>
-<DT><B>--xml-sax [filename/wildcard]</B>
-
-<DD>
-produces XML output shallow structure (sax parsing). Alias -x
-<P>
-<DT><B>-X [filename/wildcard]</B>
-
-<DD>
-see --xml-dom
-<P>
-<DT><B>-x [filename/wildcard]</B>
-
-<DD>
-see --xml-sax
-<P>
-<DT><B>-Y [filename/wildcard]</B>
-
-<DD>
-produces a short sitemap entry for the document, based on html output and the
-sisu_manifest. --sitemaps generates/updates the sitemap index of existing
-sitemaps. (Experimental, [g,y,m &nbsp;announcement &nbsp;this &nbsp;week])
-<P>
-<DT><B>-y [filename/wildcard]</B>
-
-<DD>
-produces an html summary of output generated (hyperlinked to content) and
-document specific metadata (sisu_manifest.html). This step is assumed for most
-processing flags.
-<P>
-<DT><B>-Z [filename/wildcard]</B>
-
-<DD>
-see --zap
-<P>
-<DT><B>--zap [filename/wildcard]</B>
-
-<DD>
-Zap, if used with other processing flags deletes output files of the type about
-to be processed, prior to processing. If -Z is used as the lone processing
-related flag (or in conjunction with a combination of -[mMvVq]), will remove
-the related document output directory. Alias -Z
-<P>
-</DL>
-<A NAME="lbAJ">&nbsp;</A>
-<H2>3. COMMAND LINE MODIFIERS</H2>
-
-<BR>
-
-<P>
-<DL COMPACT>
-<DT><B>--no-ocn</B>
-
-<DD>
-[with &nbsp;--html &nbsp;--pdf &nbsp;or &nbsp;--epub] switches off object citation
-numbering. Produce output without identifying numbers in margins of html or
-LaTeX/pdf output.
-<P>
-<DT><B>--no-annotate</B>
-
-<DD>
-strips output text of editor endnotes[^*1] denoted by asterisk or dagger/plus
-sign
-<P>
-<DT><B>--no-asterisk</B>
-
-<DD>
-strips output text of editor endnotes[^*2] denoted by asterisk sign
-<P>
-<DT><B>--no-dagger</B>
-
-<DD>
-strips output text of editor endnotes[^+1] denoted by dagger/plus sign
-<P>
-</DL>
-<A NAME="lbAK">&nbsp;</A>
-<H2>4. DATABASE COMMANDS</H2>
-
-<BR>
-
-<P>
-<BR>
-
-dbi - database interface
-<P>
-<BR>
-
--D or --pgsql set for postgresql -d or --sqlite default set for sqlite
--d is modifiable with --db=[database &nbsp;type &nbsp;(pgsql &nbsp;or &nbsp;sqlite)]
-<P>
-<DL COMPACT>
-<DT><B>--pg -v --createall</B>
-
-<DD>
-initial step, creates required relations (tables, indexes) in existing
-postgresql database (a database should be created manually and given the same
-name as working directory, as requested) (rb.dbi) [ &nbsp;-dv &nbsp;--createall sqlite &nbsp;equivalent] it may be necessary to run sisu -Dv --createdb
-initially NOTE: at the present time for postgresql it may be necessary to
-manually create the database. The command would be 'createdb [database &nbsp;name]'
-where database name would be SiSU_[present &nbsp;working &nbsp;directory &nbsp;name (without &nbsp;path)]. Please use only alphanumerics and underscores.
-<P>
-<DT><B>--pg -v --import</B>
-
-<DD>
-[filename/wildcard] imports data specified to postgresql db (rb.dbi) [ &nbsp;-dv --import &nbsp;sqlite &nbsp;equivalent]
-<P>
-<DT><B>--pg -v --update</B>
-
-<DD>
-[filename/wildcard] updates/imports specified data to postgresql db (rb.dbi) [
-&nbsp;-dv &nbsp;--update &nbsp;sqlite &nbsp;equivalent]
-<P>
-<DT><B>--pg --remove</B>
-
-<DD>
-[filename/wildcard] removes specified data to postgresql db (rb.dbi) [ &nbsp;-d --remove &nbsp;sqlite &nbsp;equivalent]
-<P>
-<DT><B>--pg --dropall</B>
-
-<DD>
-kills data&quot; and drops (postgresql or sqlite) db, tables &amp; indexes [ &nbsp;-d --dropall &nbsp;sqlite &nbsp;equivalent]
-<P>
-<BR>
-
+<p> </dd>
+
+<dt><b>-W</b> </dt>
+<dd>see --webrick
+
+<p> </dd>
+
+<dt><b>-w [filename/wildcard]</b> </dt>
+<dd>see --concordance
+<p> </dd>
+
+<dt><b>--webrick</b> </dt>
+<dd>starts ruby&rsquo; s webrick webserver
+points at sisu output directories, the default port is set to 8081 and
+can be changed in the resource configuration files. [tip: &nbsp;the &nbsp;webrick &nbsp;server
+&nbsp;requires &nbsp;link &nbsp;suffixes, &nbsp;so &nbsp;html output &nbsp;should &nbsp;be &nbsp;created &nbsp;using &nbsp;the &nbsp;-h &nbsp;option
+&nbsp;rather &nbsp;than &nbsp;also, &nbsp;note &nbsp;-F &nbsp;webrick &nbsp;]. Alias -W
+<p> </dd>
+
+<dt><b>--wordmap [filename/wildcard]</b>
+</dt>
+<dd>
+<p>see --concordance
+<p> </dd>
+
+<dt><b>--xhtml [filename/wildcard]</b> </dt>
+<dd>produces xhtml/ <i>XML</i> output for
+browser viewing (sax parsing). Alias -b
+<p> </dd>
+
+<dt><b>--xml-dom [filename/wildcard]</b> </dt>
+<dd>produces
+<i>XML</i> output with deep document structure, in the nature of dom. Alias -X
+<p>
+</dd>
+
+<dt><b>--xml-sax [filename/wildcard]</b> </dt>
+<dd>produces <i>XML</i> output shallow structure (sax parsing).
+
+<p>Alias -x
+<p> </dd>
+
+<dt><b>-X [filename/wildcard]</b> </dt>
+<dd>see --xml-dom
+<p> </dd>
+
+<dt><b>-x [filename/wildcard]</b> </dt>
+<dd>see --xml-sax
+
+<p> </dd>
+
+<dt><b>-Y [filename/wildcard]</b> </dt>
+<dd>produces a short sitemap entry for the document,
+based on html output and the sisu_manifest. --sitemaps generates/updates the
+sitemap index of existing sitemaps. (Experimental, [g,y,m &nbsp;announcement &nbsp;this
+&nbsp;week])
+<p> </dd>
+
+<dt><b>-y [filename/wildcard]</b> </dt>
+<dd>produces an html summary of output generated
+(hyperlinked to content) and document specific metadata (sisu_manifest.html).
+This step is assumed for most processing flags.
+<p> </dd>
+
+<dt><b>-Z [filename/wildcard]</b> </dt>
+<dd>see
+
+<p>-
+<p>-
+<p>zap
+<p> </dd>
+
+<dt><b>--zap [filename/wildcard]</b> </dt>
+<dd>Zap, if used with other processing flags deletes
+output files of the type about to be processed, prior to processing. If
+-Z is used as the lone processing related flag (or in conjunction with a
+combination of -[mMvVq]), will remove the related document output directory.
+
+<p>Alias -Z
+<p> </dd>
+</dl>
+
+<h2><a name='sect8' href='#toc8'>Command Line Modifiers</a></h2>
+<br>
+
+<p>
+<dl>
+
+<dt><b>--no-</b> </dt>
+<dd><i>ocn</i> [with &nbsp;--html &nbsp;--pdf &nbsp;or &nbsp;--epub] switches off <i>object</i> citation numbering.
+Produce output without identifying numbers in margins of html or <i>LaTeX</i>
+/pdf output.
+<p> </dd>
+
+<dt><b>--no-annotate</b> </dt>
+<dd>strips output text of editor endnotes[^*1] denoted
+
+<p>by asterisk or dagger/plus sign
+<p> </dd>
+
+<dt><b>--no-asterisk</b> </dt>
+<dd>strips output text of editor
+endnotes[^*2] denoted by asterisk sign
+<p> </dd>
+
+<dt><b>--no-dagger</b> </dt>
+<dd>strips output text of editor
+endnotes[^+1] denoted by dagger/plus sign
+<p> </dd>
+</dl>
+
+<h2><a name='sect9' href='#toc9'>Database Commands</a></h2>
+<br>
+
+<p> <br>
+<b>dbi - database interface</b>
+<p> <br>
+<b>-D or --pgsql</b> set for <i>PostgreSQL</i> <b>-d or --sqlite</b> default set for <i>SQLite</i> -d is modifiable
+with --db=[database &nbsp;type &nbsp;(PgSQL &nbsp;or &nbsp;.I &nbsp;SQLite &nbsp;) &nbsp;]
+<p>
+<dl>
+
+<dt><b>--pg -v --createall</b> </dt>
+<dd>initial step,
+creates required relations (tables, indexes) in existing <i>PostgreSQL</i> database
+(a database should be created manually and given the same name as working
+directory, as requested) (rb.dbi) [ &nbsp;-dv &nbsp;--createall &nbsp;.I SQLite &nbsp;equivalent] it
+may be necessary to run sisu -Dv --createdb initially NOTE: at the present
+time for <i>PostgreSQL</i> it may be necessary to manually create the database.
+The command would be working &nbsp;directory &nbsp;name &nbsp;(without &nbsp;path)]. Please use
+only alphanumerics and underscores.
+<p> </dd>
+
+<dt><b>--pg -v --import</b> </dt>
+<dd>[filename/wildcard] imports
+data specified to <i>PostgreSQL</i> db (rb.dbi) [ &nbsp;-dv &nbsp;--import &nbsp;.I &nbsp;SQLite &nbsp;equivalent]
+
+<p> </dd>
+
+<dt><b>--pg -v --update</b> </dt>
+<dd>[filename/wildcard] updates/imports specified data to <i>PostgreSQL</i>
+db (rb.dbi) [ &nbsp;-dv &nbsp;--update &nbsp;.I &nbsp;SQLite &nbsp;equivalent]
+<p> </dd>
+
+<dt><b>--pg --remove</b> </dt>
+<dd>[filename/wildcard]
+removes specified data to <i>PostgreSQL</i> db (rb.dbi) [ &nbsp;-d &nbsp;--remove &nbsp;.I &nbsp;SQLite &nbsp;equivalent]
+
+<p> </dd>
+
+<dt><b>--pg --dropall</b> </dt>
+<dd>kills data" and drops ( <i>PostgreSQL</i> or <i>SQLite</i> ) db, tables &amp;
+indexes [ &nbsp;-d &nbsp;--dropall &nbsp;.I &nbsp;SQLite &nbsp;equivalent]
+<p> <br>
The -v is for verbose output.
-<P>
-</DL>
-<A NAME="lbAL">&nbsp;</A>
-<H2>5. SHORTCUTS, SHORTHAND FOR MULTIPLE FLAGS</H2>
-
-<BR>
-
-<P>
-<DL COMPACT>
-<DT><B>--update [filename/wildcard]</B>
-
-<DD>
-Checks existing file output and runs the flags required to update this output.
-This means that if only html and pdf output was requested on previous runs,
-only the -hp files will be applied, and only these will be generated this
-time, together with the summary. This can be very convenient, if you offer
-different outputs of different files, and just want to do the same again.
-<P>
-<DT><B>-0 to -5 [filename &nbsp;or &nbsp;wildcard]</B>
-
-<DD>
-Default shorthand mappings (for v3, note that the defaults can be
-changed/configured in the sisurc.yml file):
-<P>
-<DT><B>-0</B>
-
-<DD>
--NQhewpotbxXyYv [this &nbsp;is &nbsp;the &nbsp;default &nbsp;action &nbsp;run &nbsp;when &nbsp;no options &nbsp;are &nbsp;give, &nbsp;i.e. &nbsp;on &nbsp;'sisu &nbsp;[filename]']
-<P>
-<DT><B>-1</B>
-
-<DD>
--Qhewpoty
-<P>
-<DT><B>-2</B>
-
-<DD>
--NQhewpotbxXy
-<P>
-<DT><B>-3</B>
-
-<DD>
--NQhewpotbxXyY
-<P>
-<DT><B>-4</B>
-
-<DD>
--NQhewpotbxXDyY --update
-<P>
-<DT><B>-5</B>
-
-<DD>
--NQhewpotbxXDyYv --update
-<P>
-<BR>
-
-add -v for verbose mode and -c to toggle color state, e.g. sisu -2vc
-[filename &nbsp;or &nbsp;wildcard]
-<P>
-<BR>
-
-consider -u for appended url info or -v for verbose output
-<P>
-</DL>
-<A NAME="lbAM">&nbsp;</A>
-<H2>5.1 COMMAND LINE WITH FLAGS - BATCH PROCESSING</H2>
-
-<P>
-<BR>
-
-In the data directory run sisu -mh filename or wildcard eg. &quot;sisu -h
-cisg.sst&quot; or &quot;sisu -h *.{sst,ssm}&quot; to produce html version of all documents.
-<P>
-<BR>
-
-Running sisu (alone without any flags, filenames or wildcards) brings up the
-interactive help, as does any sisu command that is not recognised. Enter to
-escape.
-<P>
-<A NAME="lbAN">&nbsp;</A>
-<H2>6. HELP</H2>
-
-<BR>
-
-<P>
-<A NAME="lbAO">&nbsp;</A>
-<H2>6.1 SISU MANUAL</H2>
-
-<P>
-<BR>
-
+<p> </dd>
+</dl>
+
+<h2><a name='sect10' href='#toc10'>Shortcuts, Shorthand for Multiple Flags</a></h2>
+<br>
+
+<p>
+<dl>
+
+<dt><b>--update [filename/wildcard]</b> </dt>
+<dd>Checks existing file output and runs the flags
+required to update this output. This means that if only html and pdf output
+was requested on previous runs, only the -hp files will be applied, and
+only these will be generated this time, together with the summary. This
+can be very convenient, if you offer different outputs of different files,
+and just want to do the same again.
+<p> </dd>
+
+<dt><b>-0 to -5 [filename &nbsp;or &nbsp;wildcard]</b> </dt>
+<dd>Default
+shorthand mappings (for v3, note that the defaults can be changed/configured
+in the sisurc.yml file):
+<p> </dd>
+
+<dt><b>-0</b> </dt>
+<dd>-NQhewpotbxXyYv [this &nbsp;is &nbsp;the &nbsp;default &nbsp;action &nbsp;run
+&nbsp;when &nbsp;no options &nbsp;are &nbsp;give, &nbsp;i.e. &nbsp;on &nbsp;&rsquo;sisu &nbsp;[filename]&rsquo;]
+<p> </dd>
+
+<dt><b>-1</b> </dt>
+<dd>-Qhewpoty
+<p> </dd>
+
+<dt><b>-2</b> </dt>
+<dd>-NQhewpotbxXy
+
+<p> </dd>
+
+<dt><b>-3</b> </dt>
+<dd>-NQhewpotbxXyY
+<p> </dd>
+
+<dt><b>-4</b> </dt>
+<dd>-NQhewpotbxXDyY --update
+<p> </dd>
+
+<dt><b>-5</b> </dt>
+<dd>-NQhewpotbxXDyYv --update
+<p> <br>
+add -v for verbose mode and -c to toggle color state, e.g. sisu -2vc [filename
+&nbsp;or &nbsp;wildcard]
+<p> <br>
+
+<p>consider -u for appended url info or -v for verbose output
+<p> </dd>
+</dl>
+
+<h2><a name='sect11' href='#toc11'>Command Line
+with Flags - Batch Processing</a></h2>
+
+<p> <br>
+In the data directory run sisu -mh filename or wildcard eg. "sisu -h cisg.sst"
+or "sisu -h *.{sst,ssm}" to produce html version of all documents.
+<p> <br>
+Running sisu (alone without any flags, filenames or wildcards) brings up
+the interactive help, as does any sisu command that is not recognised. Enter
+to escape.
+<p>
+<h2><a name='sect12' href='#toc12'>Help</a></h2>
+<br>
+
+<p>
+<h2><a name='sect13' href='#toc13'>Sisu Manual</a></h2>
+
+<p> <br>
The most up to date information on sisu should be contained in the sisu_manual,
available at:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;&lt;<A HREF="http://sisudoc.org/sisu/sisu_manual/">http://sisudoc.org/sisu/sisu_manual/</A>&gt;
-<P>
-<BR>
+<p> <br>
+ &lt;<a href='http://sisudoc.org/sisu/sisu_manual/'>http://sisudoc.org/sisu/sisu_manual/</a>
+&gt;<br>
-The manual can be generated from source, found respectively, either within the
-<B>SiSU</B>
+<p> <br>
+The manual can be generated from source, found respectively, either within
+the <b>SiSU</b> tarball or installed locally at:
+<p> <br>
+ ./data/doc/sisu/markup-samples/sisu_manual<br>
-tarball or installed locally at:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;./data/doc/sisu/markup-samples/sisu_manual
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;/usr/share/doc/sisu/markup-samples/sisu_manual
-<P>
-<BR>
+<p> <br>
+ /usr/share/doc/sisu/markup-samples/sisu_manual<br>
+<p> <br>
move to the respective directory and type e.g.:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;sisu&nbsp;sisu_manual.ssm
-<P>
-<A NAME="lbAP">&nbsp;</A>
-<H2>6.2 SISU MAN PAGES</H2>
-
-<P>
-<BR>
-
-If
-<B>SiSU</B>
-
-is installed on your system usual man commands should be available, try:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;man&nbsp;sisu
-<P>
-<BR>
-
-Most
-<B>SiSU</B>
-
-man pages are generated directly from sisu documents that are used to prepare
-the sisu manual, the sources files for which are located within the
-<B>SiSU</B>
-
-tarball at:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;./data/doc/sisu/markup-samples/sisu_manual
-<P>
-<BR>
-
+<p> <br>
+ sisu sisu_manual.ssm<br>
+
+<p>
+<h2><a name='sect14' href='#toc14'>Sisu Man Pages</a></h2>
+
+<p> <br>
+If <b>SiSU</b> is installed on your system usual man commands should be available,
+try:
+<p> <br>
+ man sisu<br>
+
+<p> <br>
+Most <b>SiSU</b> man pages are generated directly from sisu documents that are
+used to prepare the sisu manual, the sources files for which are located
+within the <b>SiSU</b> tarball at:
+<p> <br>
+ ./data/doc/sisu/markup-samples/sisu_manual<br>
+
+<p> <br>
Once installed, directory equivalent to:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;/usr/share/doc/sisu/markup-samples/sisu_manual
-<P>
-<BR>
+<p> <br>
+ /usr/share/doc/sisu/markup-samples/sisu_manual<br>
+<p> <br>
Available man pages are converted back to html using man2html:
-<P>
-<BR>
+<p> <br>
+ /usr/share/doc/sisu/html/<br>
-<BR>&nbsp;&nbsp;/usr/share/doc/sisu/html/
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;./data/doc/sisu/html
-<P>
-<BR>
+<p> <br>
+ ./data/doc/sisu/html<br>
+<p> <br>
An online version of the sisu man page is available here:
-<P>
-<BR>
-
-* various sisu man pages &lt;<A HREF="http://www.jus.uio.no/sisu/man/">http://www.jus.uio.no/sisu/man/</A>&gt; [^8]
-<P>
-<BR>
-
-* sisu.1 &lt;<A HREF="http://www.jus.uio.no/sisu/man/sisu.1.html">http://www.jus.uio.no/sisu/man/sisu.1.html</A>&gt; [^9]
-<P>
-<A NAME="lbAQ">&nbsp;</A>
-<H2>6.3 SISU BUILT-IN INTERACTIVE HELP</H2>
-
-<P>
-<BR>
-
+<p> <br>
+* various sisu man pages &lt;<a href='http://www.jus.uio.no/sisu/man/'>http://www.jus.uio.no/sisu/man/</a>
+&gt; [^9]
+<p> <br>
+* sisu.1 &lt;<a href='http://www.jus.uio.no/sisu/man/sisu.1.html'>http://www.jus.uio.no/sisu/man/sisu.1.html</a>
+&gt; [^10]
+<p>
+<h2><a name='sect15' href='#toc15'>Sisu Built-in Interactive
+Help</a></h2>
+
+<p> <br>
This is particularly useful for getting the current sisu setup/environment
information:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;sisu&nbsp;--help
-<P>
-<BR>
+<p> <br>
+ sisu --help<br>
-<BR>&nbsp;&nbsp;sisu&nbsp;--help&nbsp;[subject]
-<P>
-<BR>
+<p> <br>
+ sisu --help [subject]<br>
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;sisu&nbsp;--help&nbsp;commands
-<P>
-<BR>
+<p> <br>
+ sisu --help commands<br>
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;sisu&nbsp;--help&nbsp;markup
-<P>
-<BR>
+<p> <br>
+ sisu --help markup<br>
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;sisu&nbsp;--help&nbsp;env&nbsp;[for&nbsp;&nbsp;feedback&nbsp;&nbsp;on&nbsp;&nbsp;the&nbsp;&nbsp;way&nbsp;&nbsp;your&nbsp;&nbsp;system&nbsp;&nbsp;is&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setup&nbsp;&nbsp;with&nbsp;&nbsp;regard&nbsp;&nbsp;to&nbsp;&nbsp;sisu]
-<P>
-<BR>
+<p> <br>
+ sisu --help env [for &nbsp;feedback &nbsp;on &nbsp;the &nbsp;way &nbsp;your &nbsp;system &nbsp;is <br>
+ setup &nbsp;with &nbsp;regard &nbsp;to &nbsp;sisu &nbsp;]<br>
-<BR>&nbsp;&nbsp;sisu&nbsp;-V&nbsp;[environment&nbsp;&nbsp;information,&nbsp;&nbsp;same&nbsp;&nbsp;as&nbsp;&nbsp;above&nbsp;&nbsp;command]
-<P>
-<BR>
+<p> <br>
+ sisu -V [environment &nbsp;information, &nbsp;same &nbsp;as &nbsp;above &nbsp;command]<br>
-<BR>&nbsp;&nbsp;sisu&nbsp;(on&nbsp;its&nbsp;own&nbsp;provides&nbsp;version&nbsp;and&nbsp;some&nbsp;help&nbsp;information)
-<P>
-<BR>
-
-Apart from real-time information on your current configuration the
-<B>SiSU</B>
+<p> <br>
+ sisu (on its own provides version and some help information)<br>
+<p> <br>
+Apart from real-time information on your current configuration the <b>SiSU</b>
manual and man pages are likely to contain more up-to-date information than
the sisu interactive help (for example on commands and markup).
-<P>
-<BR>
-
-NOTE: Running the command sisu (alone without any flags, filenames or
-wildcards) brings up the interactive help, as does any sisu command that is not
-recognised. Enter to escape.
-<P>
-<A NAME="lbAR">&nbsp;</A>
-<H2>7. INTRODUCTION TO SISU MARKUP[^10]</H2>
-
-<BR>
-
-<P>
-<A NAME="lbAS">&nbsp;</A>
-<H2>7.1 SUMMARY</H2>
-
-<P>
-<BR>
-
-<B>SiSU</B>
-
-source documents are plaintext (UTF-8)[^11] files
-<P>
-<BR>
-
+<p> <br>
+NOTE: Running the command sisu (alone without any flags, filenames or wildcards)
+brings up the interactive help, as does any sisu command that is not recognised.
+Enter to escape.
+<p>
+<h2><a name='sect16' href='#toc16'>Introduction to Sisu Markup[^11]</a></h2>
+<br>
+
+<p>
+<h2><a name='sect17' href='#toc17'>Summary</a></h2>
+
+<p> <br>
+<b>SiSU</b> source documents are <i>plaintext</i> ( <i>UTF-8</i> )[^12] files
+<p> <br>
All paragraphs are separated by an empty line.
-<P>
-<BR>
-
+<p> <br>
Markup is comprised of:
-<P>
-<BR>
-
+<p> <br>
* at the top of a document, the document header made up of semantic meta-data
-about the document and if desired additional processing instructions (such an
-instruction to automatically number headings from a particular level down)
-<P>
-<BR>
-
-* followed by the prepared substantive text of which the most important single
-characteristic is the markup of different heading levels, which define the
-primary outline of the document structure. Markup of substantive text includes:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;*&nbsp;heading&nbsp;levels&nbsp;defines&nbsp;document&nbsp;structure
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;*&nbsp;text&nbsp;basic&nbsp;attributes,&nbsp;italics,&nbsp;bold&nbsp;etc.
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;*&nbsp;grouped&nbsp;text&nbsp;(objects),&nbsp;which&nbsp;are&nbsp;to&nbsp;be&nbsp;treated&nbsp;differently,&nbsp;such&nbsp;as&nbsp;code
-<BR>&nbsp;&nbsp;blocks&nbsp;or&nbsp;poems.
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;*&nbsp;footnotes/endnotes
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;*&nbsp;linked&nbsp;text&nbsp;and&nbsp;images
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;*&nbsp;paragraph&nbsp;actions,&nbsp;such&nbsp;as&nbsp;indent,&nbsp;bulleted,&nbsp;numbered-lists,&nbsp;etc.
-<P>
-<BR>
-
+about the document and if desired additional processing instructions (such
+an instruction to automatically number headings from a particular level
+down)
+<p> <br>
+* followed by the prepared substantive text of which the most important
+single characteristic is the markup of different heading levels, which
+define the primary outline of the document structure. Markup of substantive
+text includes:
+<p> <br>
+ * heading levels defines document structure<br>
+
+<p> <br>
+ * text basic attributes, italics, bold etc.<br>
+
+<p> <br>
+ * grouped text (objects), which are to be treated differently, such as
+code<br>
+ blocks or poems.<br>
+
+<p> <br>
+ * footnotes/endnotes<br>
+
+<p> <br>
+ * linked text and images<br>
+
+<p> <br>
+ * paragraph actions, such as indent, bulleted, numbered-lists, etc.<br>
+
+<p> <br>
Some interactive help on markup is available, by typing sisu and selecting
-markup or sisu --help markup
-<P>
-<BR>
+<p>markup or sisu --help markup
+<p> <br>
To check the markup in a file:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;sisu&nbsp;--identify&nbsp;[filename].sst
-<P>
-<BR>
+<p> <br>
+ sisu --identify [filename].sst<br>
-For brief descriptive summary of markup history
-<P>
-<BR>
+<p> <br>
-<BR>&nbsp;&nbsp;sisu&nbsp;--query-history
-<P>
-<BR>
+<p>For brief descriptive summary of markup history
+<p> <br>
+ sisu --query-history<br>
+<p> <br>
or if for a particular version:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;sisu&nbsp;--query-0.38
-<P>
-<A NAME="lbAT">&nbsp;</A>
-<H2>7.2 MARKUP EXAMPLES</H2>
+<p> <br>
+ sisu --query-0.38<br>
-<P>
-<A NAME="lbAU">&nbsp;</A>
-<H2>7.2.1 ONLINE</H2>
+<p>
+<h2><a name='sect18' href='#toc18'>Markup Examples</a></h2>
-<P>
-<BR>
+<p>
+<h2><a name='sect19' href='#toc19'>Online</a></h2>
+<p> <br>
Online markup examples are available together with the respective outputs
-produced from &lt;<A HREF="http://www.jus.uio.no/sisu/SiSU/examples.html">http://www.jus.uio.no/sisu/SiSU/examples.html</A>&gt; or from
-&lt;<A HREF="http://www.jus.uio.no/sisu/sisu_examples/">http://www.jus.uio.no/sisu/sisu_examples/</A>&gt;
-<P>
-<BR>
-
-There is of course this document, which provides a cursory overview of sisu
-markup and the respective output produced:
-&lt;<A HREF="http://www.jus.uio.no/sisu/sisu_markup/">http://www.jus.uio.no/sisu/sisu_markup/</A>&gt;
-<P>
-<BR>
-
-an alternative presentation of markup syntax:
-/usr/share/doc/sisu/on_markup.txt.gz
-<P>
-<A NAME="lbAV">&nbsp;</A>
-<H2>7.2.2 INSTALLED</H2>
-
-<P>
-<BR>
-
-With
-<B>SiSU</B>
-
-installed sample skins may be found in: /usr/share/doc/sisu/markup-samples (or
-equivalent directory) and if sisu-markup-samples is installed also under:
-/usr/share/doc/sisu/markup-samples-non-free
-<P>
-<A NAME="lbAW">&nbsp;</A>
-<H2>8. MARKUP OF HEADERS</H2>
-
-<BR>
-
-<P>
-<BR>
-
-Headers contain either: semantic meta-data about a document, which can be used
-by any output module of the program, or; processing instructions.
-<P>
-<BR>
-
+produced from &lt;<a href='http://www.jus.uio.no/sisu/SiSU/examples.html'>http://www.jus.uio.no/sisu/SiSU/examples.html</a>
+&gt; or from &lt;<a href='http://www.jus.uio.no/sisu/sisu_examples/'>http://www.jus.uio.no/sisu/sisu_examples/</a>
+&gt;
+
+<p> <br>
+There is of course this document, which provides a cursory overview of
+sisu markup and the respective output produced: &lt;<a href='http://www.jus.uio.no/sisu/sisu_markup/'>http://www.jus.uio.no/sisu/sisu_markup/</a>
+&gt;
+
+<p> <br>
+an alternative presentation of markup syntax: /usr/share/doc/sisu/on_markup.txt.gz
+
+<p>
+<h2><a name='sect20' href='#toc20'>Installed</a></h2>
+
+<p> <br>
+With <b>SiSU</b> installed sample skins may be found in: /usr/share/doc/sisu/markup-samples
+(or equivalent directory) and if sisu -markup-samples is installed also under:
+
+<p>/usr/share/doc/sisu/markup-samples-non-free
+<p>
+<h2><a name='sect21' href='#toc21'>Markup of Headers</a></h2>
+<br>
+
+<p> <br>
+Headers contain either: semantic meta-data about a document, which can be
+used by any output module of the program, or; processing instructions.
+<p>
+<br>
Note: the first line of a document may include information on the markup
-version used in the form of a comment. Comments are a percentage mark at the
-start of a paragraph (and as the first character in a line of text) followed by
-a space and the comment:
-<P>
-<PRE>
-% this would be a comment
-</PRE>
-
-<P>
-<A NAME="lbAX">&nbsp;</A>
-<H2>8.1 SAMPLE HEADER</H2>
-
-<P>
-<BR>
-
-This current document is loaded by a master document that has a header similar
-to this one:
-<P>
-<PRE>
-% SiSU master 2.0
+version used in the form of a comment. Comments are a percentage mark at
+the start of a paragraph (and as the first character in a line of text)
+followed by a space and the comment:
+<p> <br>
+<pre>% this would be a comment
+</pre>
+<p>
+<h2><a name='sect22' href='#toc22'>Sample Header</a></h2>
+
+<p> <br>
+This current document is loaded by a master document that has a header
+similar to this one:
+<p> <br>
+<pre>% SiSU master 2.0
@title: SiSU
- :subtitle: Manual
+:subtitle: Manual
@creator:
- :author: Amissah, Ralph
-@publisher: &nbsp;[publisher &nbsp;name]
-@rights: Copyright (C) Ralph Amissah 2007, License GPL 3
+:author: Amissah, Ralph
+@publisher: [publisher &nbsp;name]
+@rights: Copyright (C) Ralph Amissah 2007, part of SiSU documentation,
+License GPL 3
@classify:
- :type: information
- :topic_register: SiSU:manual;electronic documents:SiSU:manual
- :subject: ebook, epublishing, electronic book, electronic publishing,
+:type: information
+:topic_register: SiSU:manual;electronic documents:SiSU:manual
+:subject: ebook, epublishing, electronic book, electronic publishing,
electronic document, electronic citation, data structure,
citation systems, search
% used_by: manual
@date:
- :published: 2008-05-22
- :created: 2002-08-28
- :issued: 2002-08-28
- :available: 2002-08-28
- :modified: 2010-03-03
+:published: 2008-05-22
+:created: 2002-08-28
+:issued: 2002-08-28
+:available: 2002-08-28
+:modified: 2010-03-03
@make:
- :num_top: 1
- :breaks: new=C; break=1
- :skin: skin_sisu_manual
- :bold: /Gnu|Debian|Ruby|SiSU/
- :manpage: name=sisu - documents: markup, structuring, publishing
- in multiple standard formats, and search;
- synopsis=sisu &nbsp;[-abcDdeFhIiMmNnopqRrSsTtUuVvwXxYyZz0-9] &nbsp;[filename/wildcard &nbsp;]
- . sisu &nbsp;[-Ddcv] &nbsp;[instruction]
- . sisu &nbsp;[-CcFLSVvW]
- . sisu --v2 &nbsp;[operations]
- . sisu --v3 &nbsp;[operations]
+:num_top: 1
+:breaks: new=C; break=1
+:bold: /Gnu|Debian|Ruby|SiSU/
+:home_button_text: {SiSU}http://sisudoc.org; {git}http://git.sisudoc.org
+:footer: {SiSU}http://sisudoc.org; {git}http://git.sisudoc.org
+:manpage: name=sisu - documents: markup, structuring, publishing in multiple
+standard formats, and search;
+ synopsis=sisu [-abcDdeFhIiMmNnopqRrSsTtUuVvwXxYyZz0-9] [filename/wildcard
+&nbsp;]
+ . sisu [-Ddcv] [instruction]
+ . sisu [-CcFLSVvW]
+ . sisu --v4 [operations]
+ . sisu --v3 [operations]
@links:
- { SiSU Homepage }<A HREF="http://www.sisudoc.org/">http://www.sisudoc.org/</A>
- { SiSU Manual }<A HREF="http://www.sisudoc.org/sisu/sisu_manual/">http://www.sisudoc.org/sisu/sisu_manual/</A>
- { Book Samples &amp; Markup Examples }<A HREF="http://www.jus.uio.no/sisu/SiSU/examples.html">http://www.jus.uio.no/sisu/SiSU/examples.html</A>
- { SiSU Download }<A HREF="http://www.jus.uio.no/sisu/SiSU/download.html">http://www.jus.uio.no/sisu/SiSU/download.html</A>
- { SiSU Changelog }<A HREF="http://www.jus.uio.no/sisu/SiSU/changelog.html">http://www.jus.uio.no/sisu/SiSU/changelog.html</A>
- { SiSU Git repo }<A HREF="http://git.sisudoc.org/?p=code/sisu.git;a=summary">http://git.sisudoc.org/?p=code/sisu.git;a=summary</A>
- { SiSU List Archives }<A HREF="http://lists.sisudoc.org/pipermail/sisu/">http://lists.sisudoc.org/pipermail/sisu/</A>
- { SiSU @ Debian }<A HREF="http://packages.qa.debian.org/s/sisu.html">http://packages.qa.debian.org/s/sisu.html</A>
- { SiSU Project @ Debian }<A HREF="http://qa.debian.org/developer.php?login=sisu@lists.sisudoc.org">http://qa.debian.org/developer.php?login=sisu@lists.sisudoc.org</A>
- { SiSU @ Wikipedia }<A HREF="http://en.wikipedia.org/wiki/SiSU">http://en.wikipedia.org/wiki/SiSU</A>
-</PRE>
-
-<P>
-<A NAME="lbAY">&nbsp;</A>
-<H2>8.2 AVAILABLE HEADERS</H2>
-
-<P>
-<BR>
-
+{ SiSU Homepage }http://www.sisudoc.org/
+{ SiSU Manual }http://www.sisudoc.org/sisu/sisu_manual/
+{ Book Samples &amp; Markup Examples }http://www.jus.uio.no/sisu/SiSU/examples.html
+{ SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html
+{ SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html
+{ SiSU Git repo }http://git.sisudoc.org/?p=code/sisu.git;a=summary
+{ SiSU List Archives }http://lists.sisudoc.org/pipermail/sisu/
+{ SiSU @ Debian }http://packages.qa.debian.org/s/sisu.html
+{ SiSU Project @ Debian }http://qa.debian.org/developer.php?login=sisu@lists.sisudoc.org
+{ SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU
+</pre>
+<p>
+<h2><a name='sect23' href='#toc23'>Available Headers</a></h2>
+
+<p> <br>
Header tags appear at the beginning of a document and provide meta information
-on the document (such as the Dublin Core), or information as to how the
-document as a whole is to be processed. All header instructions take the form
-@headername: or on the next line and indented by once space :subheadername: All
-Dublin Core meta tags are available
-<P>
-<BR>
-
-<B>@indentifier:</B>
-
-information or instructions
-<P>
-<BR>
-
-where the &quot;identifier&quot; is a tag recognised by the program, and the
-&quot;information&quot; or &quot;instructions&quot; belong to the tag/indentifier specified
-<P>
-<BR>
-
+on the document (such as the <i>Dublin</i> Core ) , or information as to how the
+document as a whole is to be processed. All header instructions take the
+form @headername: or on the next line and indented by once space :subheadername:
+
+<p>All <i>Dublin</i> Core meta tags are available
+<p> <br>
+<b>@indentifier:</b> information or instructions
+<p> <br>
+where the "identifier" is a tag recognised by the program, and the "information"
+or "instructions" belong to the tag/indentifier specified
+<p> <br>
Note: a header where used should only be used once; all headers apart from
@title: are optional; the @structure: header is used to describe document
structure, and can be useful to know.
-<P>
-<BR>
-
-This is a sample header
-<P>
-<PRE>
-% SiSU 2.0 &nbsp;[declared &nbsp;file-type &nbsp;identifier &nbsp;with &nbsp;markup &nbsp;version]
-</PRE>
-
-<P>
-<PRE>
-@title: &nbsp;[title &nbsp;text] &nbsp;[this &nbsp;header &nbsp;is &nbsp;the &nbsp;only &nbsp;one &nbsp;that &nbsp;is &nbsp;mandatory]
- :subtitle: &nbsp;[subtitle &nbsp;if &nbsp;any]
+<p> <br>
+
+<p>This is a sample header
+<p> <br>
+<pre>% SiSU 2.0 [declared &nbsp;file-type &nbsp;identifier &nbsp;with &nbsp;markup &nbsp;version]
+</pre>
+<p> <br>
+<pre>@title: [title &nbsp;text] [this &nbsp;header &nbsp;is &nbsp;the &nbsp;only &nbsp;one &nbsp;that &nbsp;is &nbsp;mandatory]
+ :subtitle: [subtitle &nbsp;if &nbsp;any]
:language: English
-</PRE>
-
-<P>
-<PRE>
-@creator:
- :author: &nbsp;[Lastname, &nbsp;First &nbsp;names]
- :illustrator: &nbsp;[Lastname, &nbsp;First &nbsp;names]
- :translator: &nbsp;[Lastname, &nbsp;First &nbsp;names]
- :prepared_by: &nbsp;[Lastname, &nbsp;First &nbsp;names]
-</PRE>
-
-<P>
-<PRE>
-@date:
- :published: &nbsp;[year &nbsp;or &nbsp;yyyy-mm-dd]
- :created: &nbsp;[year &nbsp;or &nbsp;yyyy-mm-dd]
- :issued: &nbsp;[year &nbsp;or &nbsp;yyyy-mm-dd]
- :available: &nbsp;[year &nbsp;or &nbsp;yyyy-mm-dd]
- :modified: &nbsp;[year &nbsp;or &nbsp;yyyy-mm-dd]
- :valid: &nbsp;[year &nbsp;or &nbsp;yyyy-mm-dd]
- :added_to_site: &nbsp;[year &nbsp;or &nbsp;yyyy-mm-dd]
- :translated: &nbsp;[year &nbsp;or &nbsp;yyyy-mm-dd]
-</PRE>
-
-<P>
-<PRE>
-@rights:
- :copyright: Copyright (C) &nbsp;[Year &nbsp;and &nbsp;Holder]
- :license: &nbsp;[Use &nbsp;License &nbsp;granted]
- :text: &nbsp;[Year &nbsp;and &nbsp;Holder]
- :translation: &nbsp;[Name, &nbsp;Year]
- :illustrations: &nbsp;[Name, &nbsp;Year]
-</PRE>
-
-<P>
-<PRE>
-@classify:
- :topic_register: SiSU:markup sample:book;book:novel:fantasy
- :type:
- :subject:
- :description:
- :keywords:
- :abstract:
- :isbn: &nbsp;[ISBN]
- :loc: &nbsp;[Library &nbsp;of &nbsp;Congress &nbsp;classification]
- :dewey: &nbsp;[Dewey &nbsp;classification]
- :pg: &nbsp;[Project &nbsp;Gutenberg &nbsp;text &nbsp;number]
-</PRE>
-
-<P>
-<PRE>
-@links: { SiSU }<A HREF="http://www.sisudoc.org">http://www.sisudoc.org</A>
- { FSF }<A HREF="http://www.fsf.org">http://www.fsf.org</A>
-</PRE>
-
-<P>
-<PRE>
-@make:
- :skin: skin_name
- [skins change default settings related to the appearance of documents generated]
- :num_top: 1
- :headings: &nbsp;[text &nbsp;to &nbsp;match &nbsp;for &nbsp;each &nbsp;level
- (e.g. PART; Chapter; Section; Article;
- or another: none; BOOK|FIRST|SECOND; none; CHAPTER;)
- :breaks: new=:C; break=1
- :promo: sisu, ruby, sisu_search_libre, open_society
- :bold: [regular expression of words/phrases to be made bold]
- :italics: &nbsp;[regular &nbsp;expression &nbsp;of &nbsp;words/phrases &nbsp;to &nbsp;italicise]
-</PRE>
-
-<P>
-<PRE>
-@original:
- :language: &nbsp;[language]
-</PRE>
-
-<P>
-<PRE>
-@notes:
- :comment:
- :prefix: &nbsp;[prefix &nbsp;is &nbsp;placed &nbsp;just &nbsp;after &nbsp;table &nbsp;of &nbsp;contents]
-</PRE>
-
-<P>
-<A NAME="lbAZ">&nbsp;</A>
-<H2>9. MARKUP OF SUBSTANTIVE TEXT</H2>
-
-<BR>
-
-<P>
-<A NAME="lbBA">&nbsp;</A>
-<H2>9.1 HEADING LEVELS</H2>
-
-<P>
-<BR>
-
+</pre>
+<p> <br>
+<pre>@creator:
+:author: [Lastname, &nbsp;First &nbsp;names]
+:illustrator: [Lastname, &nbsp;First &nbsp;names]
+:translator: [Lastname, &nbsp;First &nbsp;names]
+:prepared_by: [Lastname, &nbsp;First &nbsp;names]
+</pre>
+<p> <br>
+<pre>@date:
+:published: [year &nbsp;or &nbsp;yyyy-mm-dd]
+:created: [year &nbsp;or &nbsp;yyyy-mm-dd]
+:issued: [year &nbsp;or &nbsp;yyyy-mm-dd]
+:available: [year &nbsp;or &nbsp;yyyy-mm-dd]
+:modified: [year &nbsp;or &nbsp;yyyy-mm-dd]
+:valid: [year &nbsp;or &nbsp;yyyy-mm-dd]
+:added_to_site: [year &nbsp;or &nbsp;yyyy-mm-dd]
+:translated: [year &nbsp;or &nbsp;yyyy-mm-dd]
+</pre>
+<p> <br>
+<pre>@rights:
+:copyright: Copyright (C) [Year &nbsp;and &nbsp;Holder]
+:license: [Use &nbsp;License &nbsp;granted]
+:text: [Year &nbsp;and &nbsp;Holder]
+:translation: [Name, &nbsp;Year]
+:illustrations: [Name, &nbsp;Year]
+</pre>
+<p> <br>
+<pre>@classify:
+:topic_register: SiSU:markup sample:book;book:novel:fantasy
+:type:
+:subject:
+:description:
+:keywords:
+:abstract:
+:loc: [Library &nbsp;of &nbsp;Congress &nbsp;classification]
+:dewey: Dewey classification
+</pre>
+<p> <br>
+<pre>@identify:
+:isbn: [ISBN]
+:oclc:
+</pre>
+<p> <br>
+<pre>@links: { SiSU }http://www.sisudoc.org
+ { FSF }http://www.fsf.org
+</pre>
+<p> <br>
+<pre>@make:
+:num_top: 1
+:headings: [text &nbsp;to &nbsp;match &nbsp;for &nbsp;each &nbsp;level &nbsp; (e.g. &nbsp;PART; &nbsp;Chapter; &nbsp;Section;
+&nbsp;Article; &nbsp;or &nbsp;another: &nbsp;none; &nbsp;BOOK|FIRST|SECOND; &nbsp;none; &nbsp;CHAPTER;) &nbsp;:breaks: &nbsp;new=:C;
+&nbsp;break=1 &nbsp;:promo: &nbsp;sisu, &nbsp;ruby, &nbsp;sisu_search_libre, &nbsp;open_society &nbsp;:bold: &nbsp;[regular
+&nbsp;expression &nbsp;of &nbsp;words/phrases &nbsp;to &nbsp;be &nbsp;made &nbsp;bold]
+:italics: [regular &nbsp;expression &nbsp;of &nbsp;words/phrases &nbsp;to &nbsp;italicise]
+:home_button_text: {SiSU}http://sisudoc.org; {git}http://git.sisudoc.org
+:footer: {SiSU}http://sisudoc.org; {git}http://git.sisudoc.org
+</pre>
+<p> <br>
+<pre>@original:
+:language: [language]
+</pre>
+<p> <br>
+<pre>@notes:
+:comment:
+:prefix: [prefix &nbsp;is &nbsp;placed &nbsp;just &nbsp;after &nbsp;table &nbsp;of &nbsp;contents]
+</pre>
+<p>
+<h2><a name='sect24' href='#toc24'>Markup of Substantive Text</a></h2>
+<br>
+
+<p>
+<h2><a name='sect25' href='#toc25'>Heading Levels</a></h2>
+
+<p> <br>
Heading levels are :A~ ,:B~ ,:C~ ,1~ ,2~ ,3~ ... :A - :C being part / section
headings, followed by other heading levels, and 1 -6 being headings followed
by substantive text or sub-headings. :A~ usually the title :A~? conditional
level 1 heading (used where a stand-alone document may be imported into
another)
-<P>
-<BR>
-
-<B>:A~ [heading &nbsp;text]</B>
-
-Top level heading [this &nbsp;usually &nbsp;has &nbsp;similar &nbsp;content &nbsp;to &nbsp;the &nbsp;title
-&nbsp;@title: &nbsp;] NOTE: the heading levels described here are in 0.38 notation, see
-heading
-<P>
-<BR>
-
-<B>:B~ [heading &nbsp;text]</B>
-
-Second level heading [this &nbsp;is &nbsp;a &nbsp;heading &nbsp;level &nbsp;divider]
-<P>
-<BR>
-
-<B>:C~ [heading &nbsp;text]</B>
-
-Third level heading [this &nbsp;is &nbsp;a &nbsp;heading &nbsp;level &nbsp;divider]
-<P>
-<BR>
-
-<B>1~ [heading &nbsp;text]</B>
-
-Top level heading preceding substantive text of document or sub-heading 2, the
-heading level that would normally be marked 1. or 2. or 3. etc. in a document,
-and the level on which sisu by default would break html output into named
-segments, names are provided automatically if none are given (a number),
-otherwise takes the form 1~my_filename_for_this_segment
-<P>
-<BR>
-
-<B>2~ [heading &nbsp;text]</B>
-
-Second level heading preceding substantive text of document or sub-heading 3,
-the heading level that would normally be marked 1.1 or 1.2 or 1.3 or 2.1 etc.
-in a document.
-<P>
-<BR>
-
-<B>3~ [heading &nbsp;text]</B>
-
-Third level heading preceding substantive text of document, that would normally
-be marked 1.1.1 or 1.1.2 or 1.2.1 or 2.1.1 etc. in a document
-<P>
-<PRE>
-1~filename level 1 heading,
-% the primary division such as Chapter that is followed by substantive text,
-% and may be further subdivided (this is the level on which by default html
-% segments are made)
-</PRE>
-
-<P>
-<A NAME="lbBB">&nbsp;</A>
-<H2>9.2 FONT ATTRIBUTES</H2>
-
-<P>
-<BR>
-
-<B>markup example:</B>
-
-<P>
-<PRE>
-normal text, *{emphasis}*, !{bold text}!, /{italics}/, _{underscore}_, &quot;{citation}&quot;,
+<p> <br>
+<b>:A~ [heading &nbsp;text]</b> Top level heading [this &nbsp;usually &nbsp;has &nbsp;similar &nbsp;content
+&nbsp;to &nbsp;the &nbsp;title &nbsp;@title: &nbsp;] NOTE: the heading levels described here are in 0.38
+notation, see heading
+<p> <br>
+<b>:B~ [heading &nbsp;text]</b> Second level heading [this &nbsp;is &nbsp;a &nbsp;heading &nbsp;level &nbsp;divider]
+
+<p> <br>
+<b>:C~ [heading &nbsp;text]</b> Third level heading [this &nbsp;is &nbsp;a &nbsp;heading &nbsp;level &nbsp;divider]
+
+<p> <br>
+<b>1~ [heading &nbsp;text]</b> Top level heading preceding substantive text of document
+or sub-heading 2, the heading level that would normally be marked 1. or 2.
+or 3. etc. in a document, and the level on which sisu by default would break
+html output into named segments, names are provided automatically if none
+are given (a number), otherwise takes the form 1~my_filename_for_this_segment
+
+<p> <br>
+<b>2~ [heading &nbsp;text]</b> Second level heading preceding substantive text of document
+or sub-heading 3 , the heading level that would normally be marked 1.1 or
+1.2 or 1.3 or 2.1 etc. in a document.
+<p> <br>
+<b>3~ [heading &nbsp;text]</b> Third level heading preceding substantive text of document,
+that would normally be marked 1.1.1 or 1.1.2 or 1.2.1 or 2.1.1 etc. in a document
+
+<p> <br>
+<pre>1~filename level 1 heading,
+% the primary division such as Chapter that is followed by substantive
+text, and may be further subdivided (this is the level on which by default
+html segments are made)
+</pre>
+<p>
+<h2><a name='sect26' href='#toc26'>Font Attributes</a></h2>
+
+<p> <br>
+<b>markup example:</b>
+<p> <br>
+<pre>normal text, *{emphasis}*, !{bold text}!, /{italics}/, _{underscore}_,
+"{citation}",
^{superscript}^, ,{subscript},, +{inserted text}+, -{strikethrough}-, #{monospace}#
normal text
-<BR>
-*{emphasis}* &nbsp;[note: &nbsp;can &nbsp;be &nbsp;configured &nbsp;to &nbsp;be &nbsp;represented &nbsp;by &nbsp;bold, &nbsp;italics &nbsp;or &nbsp;underscore]
-<BR>
+*{emphasis}* [note: &nbsp;can &nbsp;be &nbsp;configured &nbsp;to &nbsp;be &nbsp;represented &nbsp;by &nbsp;bold, &nbsp;italics
+&nbsp;or &nbsp;underscore]
!{bold text}!
-<BR>
-_{underscore}_
-<BR>
/{italics}/
-<BR>
-&quot;{citation}&quot;
-<BR>
+_{underscore}_
+"{citation}"
^{superscript}^
-<BR>
,{subscript},
-<BR>
+{inserted text}+
-<BR>
-{strikethrough}-
-<BR>
#{monospace}#
-</PRE>
-
-<P>
-<BR>
-
-<B>resulting output:</B>
-
-<P>
-<BR>
-
-normal text,
-<B>emphasis,</B>
-
-<B>bold text,</B>
-
-<I>italics,</I>
-
-<I>underscore,</I>
-
-&quot;citation&quot;, ^superscript^, [subscript], ++inserted text++,
---strikethrough--, monospace
-<P>
-<BR>
-
-normal text
-<P>
-<BR>
-
-<B>emphasis</B>
-
-[note: &nbsp;can &nbsp;be &nbsp;configured &nbsp;to &nbsp;be &nbsp;represented &nbsp;by &nbsp;bold, &nbsp;italics or &nbsp;underscore]
-<P>
-<BR>
-
-<B>bold text</B>
-
-<P>
-<BR>
-
-<I>italics</I>
-
-<P>
-<BR>
-
-<I>underscore</I>
-
-<P>
-<BR>
-
-&quot;citation&quot;
-<P>
-<BR>
-
+</pre>
+<p> <br>
+<b>resulting output:</b>
+<p> <br>
+normal text, <b>emphasis,</b> <b>bold text</b> , <i>italics,</i> <i>underscore,</i> "citation", ^superscript^,
+[subscript], ++inserted text++, --strikethrough--, monospace
+<p> <br>
+
+<p>normal text
+<p> <br>
+<b>emphasis</b> [note: &nbsp;can &nbsp;be &nbsp;configured &nbsp;to &nbsp;be &nbsp;represented &nbsp;by &nbsp;bold, &nbsp;italics &nbsp;italics
+&nbsp;or &nbsp;underscore] or &nbsp;underscore]
+<p> <br>
+
+<p><b>bold text</b>
+<p> <br>
+
+<p><i>italics</i>
+<p> <br>
+
+<p><i>underscore</i>
+<p> <br>
+"citation"
+<p> <br>
^superscript^
-<P>
-<BR>
-
+<p> <br>
[subscript]
-<P>
-<BR>
-
+<p> <br>
++inserted text++
-<P>
-<BR>
-
+<p> <br>
--strikethrough--
-<P>
-<BR>
-
-monospace
-<P>
-<A NAME="lbBC">&nbsp;</A>
-<H2>9.3 INDENTATION AND BULLETS</H2>
+<p> <br>
-<P>
-<BR>
+<p>monospace
+<p>
+<h2><a name='sect27' href='#toc27'>Indentation and Bullets</a></h2>
-<B>markup example:</B>
-
-<P>
-<PRE>
-ordinary paragraph
-<BR>
+<p> <br>
+<b>markup example:</b>
+<p> <br>
+<pre>ordinary paragraph
_1 indent paragraph one step
-<BR>
_2 indent paragraph two steps
-<BR>
_9 indent paragraph nine steps
-</PRE>
-
-<P>
-<BR>
-
-<B>resulting output:</B>
-
-<P>
-<BR>
-
-ordinary paragraph
-<P>
-<BR>
+</pre>
+<p> <br>
+<b>resulting output:</b>
+<p> <br>
-<BR>&nbsp;&nbsp;indent&nbsp;paragraph&nbsp;one&nbsp;step
-<P>
-<BR>
+<p>ordinary paragraph
+<p> <br>
+ indent paragraph one step<br>
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;indent&nbsp;paragraph&nbsp;two&nbsp;steps
-<P>
-<BR>
+<p> <br>
+ indent paragraph two steps<br>
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;indent&nbsp;paragraph&nbsp;nine&nbsp;steps
-<P>
-<BR>
+<p> <br>
+ indent paragraph nine steps<br>
-<B>markup example:</B>
-
-<P>
-<PRE>
-_* bullet text
-<BR>
+<p> <br>
+<b>markup example:</b>
+<p> <br>
+<pre>_* bullet text
_1* bullet text, first indent
-<BR>
_2* bullet text, two step indent
-</PRE>
-
-<P>
-<BR>
-
-<B>resulting output:</B>
-
-<P>
-<BR>
-
+</pre>
+<p> <br>
+<b>resulting output:</b>
+<p> <br>
* bullet text
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;*&nbsp;bullet&nbsp;text,&nbsp;first&nbsp;indent
-<P>
-<BR>
+<p> <br>
+ * bullet text, first indent<br>
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;bullet&nbsp;text,&nbsp;two&nbsp;step&nbsp;indent
-<P>
-<BR>
+<p> <br>
+ * bullet text, two step indent<br>
+<p> <br>
Numbered List (not to be confused with headings/titles, (document structure))
-<P>
-<BR>
-<B>markup example:</B>
-
-<P>
-<PRE>
-# numbered list numbered list 1., 2., 3, etc.
-<BR>
+<p> <br>
+<b>markup example:</b>
+<p> <br>
+<pre># numbered list numbered list 1., 2., 3, etc.
_# numbered list numbered list indented a., b., c., d., etc.
-</PRE>
-
-<P>
-<A NAME="lbBD">&nbsp;</A>
-<H2>9.4 HANGING INDENTS</H2>
-
-<P>
-<BR>
-
-<B>markup example:</B>
-
-<P>
-<PRE>
-_0_1 first line no indent,
+</pre>
+<p>
+<h2><a name='sect28' href='#toc28'>Hanging Indents</a></h2>
+
+<p> <br>
+<b>markup example:</b>
+<p> <br>
+<pre>_0_1 first line no indent,
rest of paragraph indented one step
_1_0 first line indented,
rest of paragraph no indent
in each case level may be 0-9
-</PRE>
-
-<P>
-<BR>
-
-<B>resulting output:</B>
-
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;first&nbsp;line&nbsp;no&nbsp;indent,&nbsp;rest&nbsp;of&nbsp;paragraph&nbsp;indented&nbsp;one&nbsp;step
-<P>
-<BR>
+</pre>
+<p> <br>
+<b>resulting output:</b>
+<p> <br>
+ first line no indent, rest of paragraph indented one step<br>
+<p> <br>
first line indented, rest of paragraph no indent
-<P>
-<BR>
-
-in each case level may be 0-9
-<P>
-<A NAME="lbBE">&nbsp;</A>
-<H2>9.5 FOOTNOTES / ENDNOTES</H2>
+<p> <br>
-<P>
-<BR>
+<p>in each case level may be 0-9
+<p>
+<h2><a name='sect29' href='#toc29'>Footnotes / Endnotes</a></h2>
+<p> <br>
Footnotes and endnotes are marked up at the location where they would be
indicated within a text. They are automatically numbered. The output type
-determines whether footnotes or endnotes will be produced
-<P>
-<BR>
-
-<B>markup example:</B>
-
-<P>
-<PRE>
-~{ a footnote or endnote }~
-</PRE>
-<P>
-<BR>
-
-<B>resulting output:</B>
-
-<P>
-<BR>
-
-[^12]
-<P>
-<BR>
-
-<B>markup example:</B>
-
-<P>
-<PRE>
-normal text~{ self contained endnote marker &amp; endnote in one }~ continues
-</PRE>
-
-<P>
-<BR>
-
-<B>resulting output:</B>
-
-<P>
-<BR>
-
-normal text[^13] continues
-<P>
-<BR>
-
-<B>markup example:</B>
-
-<P>
-<PRE>
-normal text ~{* unnumbered asterisk footnote/endnote, insert multiple asterisks if required }~ continues
-<BR>
+<p>determines whether footnotes or endnotes will be produced
+<p> <br>
+<b>markup example:</b>
+<p> <br>
+<pre>~{ a footnote or endnote }~
+</pre>
+<p> <br>
+<b>resulting output:</b>
+<p> <br>
+[^13]
+<p> <br>
+<b>markup example:</b>
+<p> <br>
+<pre>normal text~{ self contained endnote marker &amp; endnote in one }~ continues
+</pre>
+<p> <br>
+<b>resulting output:</b>
+<p> <br>
+normal text[^14] continues
+<p> <br>
+<b>markup example:</b>
+<p> <br>
+<pre>normal text ~{* unnumbered asterisk footnote/endnote, insert multiple asterisks
+if required }~ continues
normal text ~{** another unnumbered asterisk footnote/endnote }~ continues
-</PRE>
-
-<P>
-<BR>
-
-<B>resulting output:</B>
-
-<P>
-<BR>
-
+</pre>
+<p> <br>
+<b>resulting output:</b>
+<p> <br>
normal text [^*] continues
-<P>
-<BR>
-
+<p> <br>
normal text [^**] continues
-<P>
-<BR>
-
-<B>markup example:</B>
-
-<P>
-<PRE>
-normal text ~[* &nbsp;editors &nbsp;notes, &nbsp;numbered &nbsp;asterisk &nbsp;footnote/endnote &nbsp;series &nbsp;]~ continues
-<BR>
-normal text ~[+ &nbsp;editors &nbsp;notes, &nbsp;numbered &nbsp;asterisk &nbsp;footnote/endnote &nbsp;series &nbsp;]~ continues
-</PRE>
-
-<P>
-<BR>
-
-<B>resulting output:</B>
-
-<P>
-<BR>
-
+<p> <br>
+<b>markup example:</b>
+<p> <br>
+<pre>normal text ~[* &nbsp;editors &nbsp;notes, &nbsp;numbered &nbsp;asterisk &nbsp;footnote/endnote &nbsp;series
+&nbsp;]~ continues
+normal text ~[+ &nbsp;editors &nbsp;notes, &nbsp;numbered &nbsp;asterisk &nbsp;footnote/endnote &nbsp;series
+&nbsp;]~ continues
+</pre>
+<p> <br>
+<b>resulting output:</b>
+<p> <br>
normal text [^*3] continues
-<P>
-<BR>
-
+<p> <br>
normal text [^+2] continues
-<P>
-<BR>
-
-<B>Alternative endnote pair notation for footnotes/endnotes:</B>
-
-<P>
-<PRE>
-% note the endnote marker &quot;~^&quot;
+<p> <br>
+<b>Alternative endnote pair notation for footnotes/endnotes:</b>
+<p> <br>
+<pre>% note the endnote marker "~^"
normal text~^ continues
-<BR>
^~ endnote text following the paragraph in which the marker occurs
-</PRE>
-
-<P>
-<BR>
+</pre>
+<p> <br>
-the standard and pair notation cannot be mixed in the same document
-<P>
-<A NAME="lbBF">&nbsp;</A>
-<H2>9.6 LINKS</H2>
+<p>the standard and pair notation cannot be mixed in the same document
+<p>
+<h2><a name='sect30' href='#toc30'>Links</a></h2>
-<P>
-<A NAME="lbBG">&nbsp;</A>
-<H2>9.6.1 NAKED URLS WITHIN TEXT, DEALING WITH URLS</H2>
+<p>
-<P>
-<BR>
+<h2><a name='sect31' href='#toc31'>Naked Urls Within Text, Dealing with Urls</a></h2>
+<p> <br>
urls found within text are marked up automatically. A url within text is
automatically hyperlinked to itself and by default decorated with angled
-braces, unless they are contained within a code block (in which case they are
-passed as normal text), or escaped by a preceding underscore (in which case the
-decoration is omitted).
-<P>
-<BR>
-
-<B>markup example:</B>
-
-<P>
-<PRE>
-normal text <A HREF="http://www.sisudoc.org/">http://www.sisudoc.org/</A> continues
-</PRE>
-
-<P>
-<BR>
-
-<B>resulting output:</B>
-
-<P>
-<BR>
-
-normal text &lt;<A HREF="http://www.sisudoc.org/">http://www.sisudoc.org/</A>&gt; continues
-<P>
-<BR>
-
-An escaped url without decoration
-<P>
-<BR>
-
-<B>markup example:</B>
-
-<P>
-<PRE>
-normal text _<A HREF="http://www.sisudoc.org/">http://www.sisudoc.org/</A> continues
-deb _<A HREF="http://www.jus.uio.no/sisu/archive">http://www.jus.uio.no/sisu/archive</A> unstable main non-free
-</PRE>
-
-<P>
-<BR>
-
-<B>resulting output:</B>
-
-<P>
-<BR>
-
-normal text &lt;_<A HREF="http://www.sisudoc.org/">http://www.sisudoc.org/</A>&gt; continues
-<P>
-<BR>
-
-deb &lt;_<A HREF="http://www.jus.uio.no/sisu/archive">http://www.jus.uio.no/sisu/archive</A>&gt; unstable main non-free
-<P>
-<BR>
-
-where a code block is used there is neither decoration nor hyperlinking, code
-blocks are discussed later in this document
-<P>
-<BR>
-
-<B>resulting output:</B>
-
-<P>
-<PRE>
-deb <A HREF="http://www.jus.uio.no/sisu/archive">http://www.jus.uio.no/sisu/archive</A> unstable main non-free
-<BR>
-deb-src <A HREF="http://www.jus.uio.no/sisu/archive">http://www.jus.uio.no/sisu/archive</A> unstable main non-free
-</PRE>
-
-<P>
-<A NAME="lbBH">&nbsp;</A>
-<H2>9.6.2 LINKING TEXT</H2>
-
-<P>
-<BR>
-
-To link text or an image to a url the markup is as follows
-<P>
-<BR>
-
-<B>markup example:</B>
-
-<P>
-<PRE>
-about { SiSU }<A HREF="http://url.org">http://url.org</A> markup
-</PRE>
-
-<P>
-<BR>
-
-<B>resulting output:</B>
-
-<P>
-<BR>
-
-aboutSiSU &lt;<A HREF="http://www.sisudoc.org/">http://www.sisudoc.org/</A>&gt; markup
-<P>
-<BR>
-
-A shortcut notation is available so the url link may also be provided
-automatically as a footnote
-<P>
-<BR>
-
-<B>markup example:</B>
-
-<P>
-<PRE>
-about {~^ SiSU }<A HREF="http://url.org">http://url.org</A> markup
-</PRE>
-
-<P>
-<BR>
-
-<B>resulting output:</B>
-
-<P>
-<BR>
-
-about SiSU &lt;<A HREF="http://www.sisudoc.org/">http://www.sisudoc.org/</A>&gt; [^14] markup
-<P>
-<BR>
-
-Internal document links to a tagged location, including an ocn
-<P>
-<BR>
-
-<B>markup example:</B>
-
-<P>
-<PRE>
- { tux.png 64x80 }image
-<BR>
- % various url linked images
-<BR>
- {tux.png 64x80 &quot;a better way&quot; }<A HREF="http://www.sisudoc.org/">http://www.sisudoc.org/</A>
-<BR>
-<BR>
- {GnuDebianLinuxRubyBetterWay.png 100x101 &quot;Way Better - with Gnu/Linux, Debian and Ruby&quot; }<A HREF="http://www.sisudoc.org/">http://www.sisudoc.org/</A>
-<BR>
-<BR>
- {~^ ruby_logo.png &quot;Ruby&quot; }<A HREF="http://www.ruby-lang.org/en/">http://www.ruby-lang.org/en/</A>
-<BR>
-<BR>
-<B>markup example:</B>
-
-{ tux.png 64x80 }image
+braces, unless they are contained within a code block (in which case they
+are passed as normal text), or escaped by a preceding underscore (in which
+case the decoration is omitted).
+<p> <br>
+<b>markup example:</b>
+<p> <br>
+<pre>normal text http://www.sisudoc.org/ continues
+</pre>
+<p> <br>
+<b>resulting output:</b>
+<p> <br>
+normal text &lt;<a href='http://www.sisudoc.org/'>http://www.sisudoc.org/</a>
+&gt; continues
+<p> <br>
+
+<p>An escaped url without decoration
+<p> <br>
+<b>markup example:</b>
+<p> <br>
+<pre>normal text _http://www.sisudoc.org/ continues
+deb _http://www.jus.uio.no/sisu/archive unstable main non-free
+</pre>
+<p> <br>
+<b>resulting output:</b>
+<p> <br>
+normal text &lt;_<a href='http://www.sisudoc.org/'>http://www.sisudoc.org/</a>
+&gt; continues
+<p> <br>
+deb &lt;_<a href='http://www.jus.uio.no/sisu/archive'>http://www.jus.uio.no/sisu/archive</a>
+&gt; unstable main non-free
+<p> <br>
+where a code block is used there is neither decoration nor hyperlinking,
+
+<p>code blocks are discussed later in this document
+<p> <br>
+<b>resulting output:</b>
+<p> <br>
+<pre>deb http://www.jus.uio.no/sisu/archive unstable main non-free
+deb-src http://www.jus.uio.no/sisu/archive unstable main non-free
+</pre>
+<p>
+<h2><a name='sect32' href='#toc32'>Linking Text</a></h2>
+
+<p> <br>
+
+<p>To link text or an image to a url the markup is as follows
+<p> <br>
+<b>markup example:</b>
+<p> <br>
+<pre>about { SiSU }http://url.org markup
+</pre>
+<p> <br>
+<b>resulting output:</b>
+<p> <br>
+aboutSiSU &lt;<a href='http://www.sisudoc.org/'>http://www.sisudoc.org/</a>
+&gt; markup
+<p> <br>
+
+<p>A shortcut notation is available so the url link may also be provided automatically
+
+<p>as a footnote
+<p> <br>
+<b>markup example:</b>
+<p> <br>
+<pre>about {~^ SiSU }http://url.org markup
+</pre>
+<p> <br>
+<b>resulting output:</b>
+<p> <br>
+aboutSiSU &lt;<a href='http://www.sisudoc.org/'>http://www.sisudoc.org/</a>
+&gt; [^15] markup
+<p> <br>
+Internal document links to a tagged location, including an <i>ocn</i>
+<p> <br>
+<b>markup example:</b>
+<p> <br>
+<pre>about { text links }#link_text
+</pre>
+<p> <br>
+<b>resulting output:</b>
+<p> <br>
+about ⌠text links⌡⌈link_text⌋
+<p> <br>
+
+<p>Shared document collection link
+<p> <br>
+<b>markup example:</b>
+<p> <br>
+<pre>about { SiSU book markup examples }:SiSU/examples.html
+</pre>
+<p> <br>
+<b>resulting output:</b>
+<p> <br>
+about ⌠ <b>SiSU</b> book markup examples⌡⌈:SiSU/examples.html⌋
+<p>
+<h2><a name='sect33' href='#toc33'>Linking
+Images</a></h2>
+
+<p> <br>
+<b>markup example:</b>
+<p> <br>
+<pre>{ tux.png 64x80 }image
% various url linked images
-{tux.png 64x80 &quot;a better way&quot; }<A HREF="http://www.sisudoc.org/">http://www.sisudoc.org/</A>
-{GnuDebianLinuxRubyBetterWay.png 100x101 &quot;Way Better - with Gnu/Linux, Debian and Ruby&quot; }<A HREF="http://www.sisudoc.org/">http://www.sisudoc.org/</A>
-{~^ ruby_logo.png &quot;Ruby&quot; }<A HREF="http://www.ruby-lang.org/en/">http://www.ruby-lang.org/en/</A>
-</PRE>
-
-<P>
-<BR>
-
-<B>resulting output:</B>
-
-<P>
-<BR>
-
+{tux.png 64x80 "a better way" }http://www.sisudoc.org/
+{GnuDebianLinuxRubyBetterWay.png 100x101 "Way Better - with Gnu/Linux, Debian
+and Ruby" }http://www.sisudoc.org/
+{~^ ruby_logo.png "Ruby" }http://www.ruby-lang.org/en/
+</pre>
+<p> <br>
+<b>resulting output:</b>
+<p> <br>
[ tux.png ]
-<P>
-<BR>
-
-tux.png 64x80 &quot;Gnu/Linux - a better way&quot; &lt;<A HREF="http://www.sisudoc.org/">http://www.sisudoc.org/</A>&gt;
-<P>
-<BR>
-
-GnuDebianLinuxRubyBetterWay.png 100x101 &quot;Way Better - with Gnu/Linux, Debian
-and Ruby&quot; &lt;<A HREF="http://www.sisudoc.org/">http://www.sisudoc.org/</A>&gt;
-<P>
-<BR>
-
-[ &nbsp;ruby_logo &nbsp;(png &nbsp;missing) &nbsp;] [^15]
-<P>
-<BR>
-
-<B>linked url footnote shortcut</B>
-
-<P>
-<PRE>
-{~^ &nbsp;[text &nbsp;to &nbsp;link] }<A HREF="http://url.org">http://url.org</A>
-% maps to: { &nbsp;[text &nbsp;to &nbsp;link] }<A HREF="http://url.org">http://url.org</A> ~{ <A HREF="http://url.org">http://url.org</A> }~
-% which produces hyper-linked text within a document/paragraph,
-% with an endnote providing the url for the text location used in the hyperlink
-</PRE>
-
-<P>
-<PRE>
-text marker *~name
-</PRE>
-
-<P>
-<BR>
-
-note at a heading level the same is automatically achieved by providing names
-to headings 1, 2 and 3 i.e. 2~[name] and 3~[name] or in the case of
+<p> <br>
+tux.png 64x80 "Gnu/Linux - a better way" &lt;<a href='http://www.sisudoc.org/'>http://www.sisudoc.org/</a>
+&gt;
+<p> <br>
+GnuDebianLinuxRubyBetterWay.png 100x101 "Way Better - with Gnu/Linux, Debian
+and Ruby" &lt;<a href='http://www.sisudoc.org/'>http://www.sisudoc.org/</a>
+&gt;
+<p> <br>
+ruby_logo.png 70x90 "Ruby" &lt;<a href='http://www.ruby-lang.org/en/'>http://www.ruby-lang.org/en/</a>
+&gt; [^16]
+<p> <br>
+
+<p><b>linked url footnote shortcut</b>
+<p> <br>
+<pre>{~^ [text &nbsp;to &nbsp;link] }http://url.org
+% maps to: { [text &nbsp;to &nbsp;link] }http://url.org ~{ http://url.org }~
+% which produces hyper-linked text within a document/paragraph, with an
+endnote providing the url for the text location used in the hyperlink
+</pre>
+<p> <br>
+<pre>text marker *~name
+</pre>
+<p> <br>
+note at a heading level the same is automatically achieved by providing
+names to headings 1, 2 and 3 i.e. 2~[name] and 3~[name] or in the case of
auto-heading numbering, without further intervention.
-<P>
-<A NAME="lbBI">&nbsp;</A>
-<H2>9.7 GROUPED TEXT</H2>
-
-<P>
-<A NAME="lbBJ">&nbsp;</A>
-<H2>9.7.1 TABLES</H2>
-
-<P>
-<BR>
-
-Tables may be prepared in two either of two forms
-<P>
-<BR>
-
-<B>markup example:</B>
-
-<P>
-<PRE>
-table{ c3; 40; 30; 30;
+<p>
+<h2><a name='sect34' href='#toc34'>Link Shortcut for
+Multiple Versions of a Sisu Document in the Same Directory</a></h2>
+TREE
+<p> <br>
+<b>markup example:</b>
+<p> <br>
+<pre>!_ /{"Viral Spiral"}/, David Bollier
+{ "Viral Spiral", David Bollier [3sS]}viral_spiral.david_bollier.sst
+</pre>
+<p> <br>
+<b></b> <i>Viral Spiral</i>, David Bollier
+<p> "Viral Spiral", David Bollier &lt;<a href='http://corundum/sisu_manual/en/manifest/viral_spiral.david_bollier.html'>http://corundum/sisu_manual/en/manifest/viral_spiral.david_bollier.html</a>
+&gt;
+ document manifest &lt;<a href='http://corundum/sisu_manual/en/manifest/viral_spiral.david_bollier.html'>http://corundum/sisu_manual/en/manifest/viral_spiral.david_bollier.html</a>
+&gt;<br>
+ ⌠html, segmented text⌡「<a href='http://corundum/sisu_manual/en/html/viral_spiral.david_bollier.html」'>http://corundum/sisu_manual/en/html/viral_spiral.david_bollier.html」</a>
+<br>
+ ⌠html, scroll, document in one⌡「<a href='http://corundum/sisu_manual/en/html/viral_spiral.david_bollier.html」'>http://corundum/sisu_manual/en/html/viral_spiral.david_bollier.html」</a>
+<br>
+ ⌠epub⌡「<a href='http://corundum/sisu_manual/en/epub/viral_spiral.david_bollier.epub」'>http://corundum/sisu_manual/en/epub/viral_spiral.david_bollier.epub」</a>
+<br>
+ ⌠pdf, landscape⌡「<a href='http://corundum/sisu_manual/en/pdf/viral_spiral.david_bollier.pdf」'>http://corundum/sisu_manual/en/pdf/viral_spiral.david_bollier.pdf」</a>
+<br>
+ ⌠pdf, portrait⌡「<a href='http://corundum/sisu_manual/en/pdf/viral_spiral.david_bollier.pdf」'>http://corundum/sisu_manual/en/pdf/viral_spiral.david_bollier.pdf」</a>
+<br>
+ ⌠odf: odt, open document text⌡「<a href='http://corundum/sisu_manual/en/odt/viral_spiral.david_bollier.odt」'>http://corundum/sisu_manual/en/odt/viral_spiral.david_bollier.odt」</a>
+<br>
+ ⌠xhtml scroll⌡「<a href='http://corundum/sisu_manual/en/xhtml/viral_spiral.david_bollier.xhtml」'>http://corundum/sisu_manual/en/xhtml/viral_spiral.david_bollier.xhtml」</a>
+<br>
+ ⌠xml, sax⌡「<a href='http://corundum/sisu_manual/en/xml/viral_spiral.david_bollier.xml」'>http://corundum/sisu_manual/en/xml/viral_spiral.david_bollier.xml」</a>
+<br>
+ ⌠xml, dom⌡「<a href='http://corundum/sisu_manual/en/xml/viral_spiral.david_bollier.xml」'>http://corundum/sisu_manual/en/xml/viral_spiral.david_bollier.xml」</a>
+<br>
+ ⌠concordance⌡「<a href='http://corundum/sisu_manual/en/html/viral_spiral.david_bollier.html」'>http://corundum/sisu_manual/en/html/viral_spiral.david_bollier.html」</a>
+<br>
+ ⌠dcc, document content certificate (digests)⌡「<a href='http://corundum/sisu_manual/en/digest/viral_spiral.david_bollier.txt」'>http://corundum/sisu_manual/en/digest/viral_spiral.david_bollier.txt」</a>
+<br>
+ ⌠markup source text⌡「<a href='http://corundum/sisu_manual/en/src/viral_spiral.david_bollier.sst」'>http://corundum/sisu_manual/en/src/viral_spiral.david_bollier.sst」</a>
+<br>
+ ⌠markup source (zipped) pod⌡「<a href='http://corundum/sisu_manual/en/pod/viral_spiral.david_bollier.sst.zip」'>http://corundum/sisu_manual/en/pod/viral_spiral.david_bollier.sst.zip」</a>
+<br>
+
+<p>
+<h2><a name='sect35' href='#toc35'>Grouped Text</a></h2>
+
+<p>
+<h2><a name='sect36' href='#toc36'>Tables</a></h2>
+
+<p> <br>
+
+<p>Tables may be prepared in two either of two forms
+<p> <br>
+<b>markup example:</b>
+<p> <br>
+<pre>table{ c3; 40; 30; 30;
This is a table
this would become column two of row one
column three of row one is here
@@ -2152,101 +1752,83 @@ And here begins another row
column two of row two
column three of row two, and so on
}table
-</PRE>
-
-<P>
-<BR>
-
-<B>resulting output:</B>
-
-<P>
-<BR>&nbsp;&nbsp;[table&nbsp;&nbsp;omitted,&nbsp;&nbsp;see&nbsp;&nbsp;other&nbsp;&nbsp;document&nbsp;&nbsp;formats]
-<P>
-<BR>
-
-a second form may be easier to work with in cases where there is not much
-information in each column
-<P>
-<BR>
-
-<B>markup example:</B>
-
-[^17]
-<P>
-<PRE>
-!_ Table 3.1: Contributors to Wikipedia, January 2001 - June 2005
+</pre>
+<p> <br>
+<b>resulting output:</b>
+<p> This is a table|this would become column two of row one|column
+three of row one is here』And here begins another row|column two of row
+two|column three of row two, and so on』
+<p> <br>
+
+<p>a second form may be easier to work with in cases where there is not much
+
+<p>information in each column
+<p> <br>
+<b>markup example:</b> [^18]
+<p> <br>
+<pre>!_ Table 3.1: Contributors to Wikipedia, January 2001 - June 2005
{table~h 24; 12; 12; 12; 12; 12; 12;}
- |Jan. 2001|Jan. 2002|Jan. 2003|Jan. 2004|July 2004|June 2006
-Contributors* | 10| 472| 2,188| 9,653| 25,011| 48,721
-Active contributors** | 9| 212| 846| 3,228| 8,442| 16,945
-Very active contributors*** | 0| 31| 190| 692| 1,639| 3,016
-No. of English language articles| 25| 16,000| 101,000| 190,000| 320,000| 630,000
+ |Jan. 2001|Jan. 2002|Jan. 2003|Jan. 2004|July 2004|June
+2006
+Contributors* | 10| 472| 2,188| 9,653|
+25,011| 48,721
+Active contributors** | 9| 212| 846| 3,228|
+ 8,442| 16,945
+Very active contributors*** | 0| 31| 190| 692|
+ 1,639| 3,016
+No. of English language articles| 25| 16,000| 101,000| 190,000| 320,000|
+ 630,000
No. of articles, all languages | 25| 19,000| 138,000| 490,000| 862,000|1,600,000
-* Contributed at least ten times; ** at least 5 times in last month; *** more than 100 times in last month.
-</PRE>
-
-<P>
-<BR>
-
-<B>resulting output:</B>
-
-<P>
-<BR>
-
-<B>Table 3.1: Contributors to Wikipedia, January 2001 - June 2005</B>
-
-<P>
-<BR>&nbsp;&nbsp;[table&nbsp;&nbsp;omitted,&nbsp;&nbsp;see&nbsp;&nbsp;other&nbsp;&nbsp;document&nbsp;&nbsp;formats]
-<P>
-<BR>
-
-* Contributed at least ten times; ** at least 5 times in last month; *** more
-than 100 times in last month.
-<P>
-<A NAME="lbBK">&nbsp;</A>
-<H2>9.7.2 POEM</H2>
-
-<P>
-<BR>
-
-<B>basic markup:</B>
-
-<P>
-<PRE>
-poem{
+* Contributed at least ten times; ** at least 5 times in last month; ***
+more than 100 times in last month.
+</pre>
+<p> <br>
+<b>resulting output:</b>
+<p> <br>
+<b>Table 3.1: Contributors to Wikipedia, January 2001 - June 2005</b>
+<p> |Jan. 2001|Jan.
+2002|Jan. 2003|Jan. 2004|July 2004|June 2006』Contributors*|10|472|2,188|9,653|25,011|48,721』Active
+contributors**|9|212|846|3,228|8,442|16,945』Very active contributors***|0|31|190|692|1,639|3,016』No.
+of English language articles|25|16,000|101,000|190,000|320,000|630,000』No. of
+articles, all languages|25|19,000|138,000|490,000|862,000|1,600,000』
+<p> <br>
+* Contributed at least ten times; ** at least 5 times in last month; ***
+more than 100 times in last month.
+<p>
+<h2><a name='sect37' href='#toc37'>Poem</a></h2>
+
+<p> <br>
+<b>basic markup:</b>
+<p> <br>
+<pre>poem{
Your poem here
}poem
Each verse in a poem is given an object number.
-</PRE>
-
-<P>
-<BR>
-
-<B>markup example:</B>
-
-<P>
-<PRE>
-poem{
- `Fury said to a
+</pre>
+<p> <br>
+<b>markup example:</b>
+<p> <br>
+<pre>poem{
+ &lsquo;Fury said to a
mouse, That he
met in the
house,
- &quot;Let us
+ "Let us
both go to
law: I will
prosecute
YOU. --Come,
- I'll take no
+ I&rsquo;ll take no
denial; We
must have a
trial: For
really this
- morning I've
+ morning I&rsquo;ve
nothing
- to do.&quot;
+ to do."
Said the
mouse to the
- cur, &quot;Such
+ cur, "Such
a trial,
dear Sir,
With
@@ -2255,14 +1837,14 @@ poem{
would be
wasting
our
- breath.&quot;
- &quot;I'll be
- judge, I'll
- be jury,&quot;
+ breath."
+ "I&rsquo;ll be
+ judge, I&rsquo;ll
+ be jury,"
Said
cunning
old Fury:
- &quot;I'll
+ "I&rsquo;ll
try the
whole
cause,
@@ -2270,196 +1852,91 @@ poem{
condemn
you
to
- death.&quot;'
+ death."&rsquo;
}poem
-</PRE>
-
-<P>
-<BR>
-
-<B>resulting output:</B>
-
-<P>
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`Fury&nbsp;said&nbsp;to&nbsp;a
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mouse,&nbsp;That&nbsp;he
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;met&nbsp;in&nbsp;the
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;house,
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;Let&nbsp;us
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;both&nbsp;go&nbsp;to
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;law:&nbsp;&nbsp;I&nbsp;will
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;prosecute
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;YOU.&nbsp;&nbsp;--Come,
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;I'll&nbsp;take&nbsp;no
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;denial;&nbsp;We
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;must&nbsp;have&nbsp;a
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;trial:&nbsp;&nbsp;For
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;really&nbsp;this
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;morning&nbsp;I've
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nothing
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;do.&quot;
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Said&nbsp;the
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mouse&nbsp;to&nbsp;the
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cur,&nbsp;&quot;Such
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a&nbsp;trial,
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dear&nbsp;Sir,
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;With
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;no&nbsp;jury
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or&nbsp;judge,
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;would&nbsp;be
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wasting
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;our
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;breath.&quot;
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;I'll&nbsp;be
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;judge,&nbsp;I'll
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;be&nbsp;jury,&quot;
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Said
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cunning
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;old&nbsp;Fury:
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;I'll
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;try&nbsp;the
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;whole
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cause,
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;and
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;condemn
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;you
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;death.&quot;'
-<BR>
-
-<P>
-<A NAME="lbBL">&nbsp;</A>
-<H2>9.7.3 GROUP</H2>
-
-<P>
-<BR>
-
-<B>basic markup:</B>
-
-<P>
-<PRE>
-group{
-<BR>
+</pre>
+<p> <br>
+<b>resulting output:</b>
+<p> &lsquo;Fury said to a<br>
+ mouse, That he<br>
+ met in the<br>
+ house,<br>
+ "Let us<br>
+ both go to<br>
+ law: I will<br>
+ prosecute<br>
+ YOU. --Come,<br>
+ I&rsquo;ll take no<br>
+ denial; We<br>
+ must have a<br>
+ trial: For<br>
+ really this<br>
+ morning I&rsquo;ve<br>
+ nothing<br>
+ to do."<br>
+ Said the<br>
+ mouse to the<br>
+ cur, "Such<br>
+ a trial,<br>
+ dear Sir,<br>
+ With<br>
+ no jury<br>
+ or judge,<br>
+ would be<br>
+ wasting<br>
+ our<br>
+ breath."<br>
+ "I&rsquo;ll be<br>
+ judge, I&rsquo;ll<br>
+ be jury,"<br>
+ Said<br>
+ cunning<br>
+ old Fury:<br>
+ "I&rsquo;ll<br>
+ try the<br>
+ whole<br>
+ cause,<br>
+ and<br>
+ condemn<br>
+ you<br>
+ to<br>
+ death."&rsquo;<br>
+
+<p>
+<h2><a name='sect38' href='#toc38'>Group</a></h2>
+
+<p> <br>
+<b>basic markup:</b>
+<p> <br>
+<pre>group{
Your grouped text here
-<BR>
}group
-<BR>
A group is treated as an object and given a single object number.
-</PRE>
-
-<P>
-<BR>
-
-<B>markup example:</B>
-
-<P>
-<PRE>
-group{
- 'Fury said to a
+</pre>
+<p> <br>
+<b>markup example:</b>
+<p> <br>
+<pre>group{
+ &lsquo;Fury said to a
mouse, That he
met in the
house,
- &quot;Let us
+ "Let us
both go to
law: I will
prosecute
YOU. --Come,
- I'll take no
+ I&rsquo;ll take no
denial; We
must have a
trial: For
really this
- morning I've
+ morning I&rsquo;ve
nothing
- to do.&quot;
+ to do."
Said the
mouse to the
- cur, &quot;Such
+ cur, "Such
a trial,
dear Sir,
With
@@ -2468,14 +1945,14 @@ group{
would be
wasting
our
- breath.&quot;
- &quot;I'll be
- judge, I'll
- be jury,&quot;
+ breath."
+ "I&rsquo;ll be
+ judge, I&rsquo;ll
+ be jury,"
Said
cunning
old Fury:
- &quot;I'll
+ "I&rsquo;ll
try the
whole
cause,
@@ -2483,193 +1960,92 @@ group{
condemn
you
to
- death.&quot;'
+ death."&rsquo;
}group
-</PRE>
-
-<P>
-<BR>
-
-<B>resulting output:</B>
-
-<P>
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`Fury&nbsp;said&nbsp;to&nbsp;a
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mouse,&nbsp;That&nbsp;he
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;met&nbsp;in&nbsp;the
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;house,
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;Let&nbsp;us
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;both&nbsp;go&nbsp;to
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;law:&nbsp;&nbsp;I&nbsp;will
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;prosecute
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;YOU.&nbsp;&nbsp;--Come,
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;I'll&nbsp;take&nbsp;no
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;denial;&nbsp;We
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;must&nbsp;have&nbsp;a
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;trial:&nbsp;&nbsp;For
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;really&nbsp;this
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;morning&nbsp;I've
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nothing
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;do.&quot;
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Said&nbsp;the
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mouse&nbsp;to&nbsp;the
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cur,&nbsp;&quot;Such
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a&nbsp;trial,
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dear&nbsp;Sir,
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;With
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;no&nbsp;jury
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or&nbsp;judge,
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;would&nbsp;be
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wasting
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;our
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;breath.&quot;
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;I'll&nbsp;be
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;judge,&nbsp;I'll
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;be&nbsp;jury,&quot;
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Said
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cunning
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;old&nbsp;Fury:
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;I'll
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;try&nbsp;the
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;whole
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cause,
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;and
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;condemn
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;you
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;death.&quot;'
-<BR>
-
-<P>
-<A NAME="lbBM">&nbsp;</A>
-<H2>9.7.4 CODE</H2>
-
-<P>
-<BR>
-
-Code tags code{ ... }code (used as with other group tags described above) are
-used to escape regular sisu markup, and have been used extensively within this
-document to provide examples of
-<B>SiSU</B>
-
-markup. You cannot however use code tags to escape code tags. They are however
-used in the same way as group or poem tags.
-<P>
-<BR>
-
-A code-block is treated as an object and given a single object number. [an option &nbsp;to &nbsp;number &nbsp;each &nbsp;line &nbsp;of &nbsp;code &nbsp;may &nbsp;be &nbsp;considered &nbsp;at some &nbsp;later &nbsp;time]
-<P>
-<BR>
-
-<B>use of code tags instead of poem compared, resulting output:</B>
-
-<P>
-<PRE>
- `Fury said to a
+</pre>
+<p> <br>
+<b>resulting output:</b>
+<p> &lsquo;Fury said to a<br>
+ mouse, That he<br>
+ met in the<br>
+ house,<br>
+ "Let us<br>
+ both go to<br>
+ law: I will<br>
+ prosecute<br>
+ YOU. --Come,<br>
+ I&rsquo;ll take no<br>
+ denial; We<br>
+ must have a<br>
+ trial: For<br>
+ really this<br>
+ morning I&rsquo;ve<br>
+ nothing<br>
+ to do."<br>
+ Said the<br>
+ mouse to the<br>
+ cur, "Such<br>
+ a trial,<br>
+ dear Sir,<br>
+ With<br>
+ no jury<br>
+ or judge,<br>
+ would be<br>
+ wasting<br>
+ our<br>
+ breath."<br>
+ "I&rsquo;ll be<br>
+ judge, I&rsquo;ll<br>
+ be jury,"<br>
+ Said<br>
+ cunning<br>
+ old Fury:<br>
+ "I&rsquo;ll<br>
+ try the<br>
+ whole<br>
+ cause,<br>
+ and<br>
+ condemn<br>
+ you<br>
+ to<br>
+ death."&rsquo;<br>
+
+<p>
+<h2><a name='sect39' href='#toc39'>Code</a></h2>
+
+<p> <br>
+Code tags code{ ... }code (used as with other group tags described above)
+are used to escape regular sisu markup, and have been used extensively
+within this document to provide examples of <b>SiSU</b> markup. You cannot however
+use code tags to escape code tags. They are however used in the same way
+as group or poem tags.
+<p> <br>
+A code-block is treated as an object and given a single object number. [an
+option &nbsp;to &nbsp;number &nbsp;each &nbsp;line &nbsp;of &nbsp;code &nbsp;may &nbsp;be &nbsp;considered &nbsp;at some &nbsp;later &nbsp;time]
+
+<p> <br>
+<b>use of code tags instead of poem compared, resulting output:</b>
+<p> <br>
+<pre> &lsquo;Fury said to a
mouse, That he
met in the
house,
- &quot;Let us
+ "Let us
both go to
law: I will
prosecute
YOU. --Come,
- I'll take no
+ I&rsquo;ll take no
denial; We
must have a
trial: For
really this
- morning I've
+ morning I&rsquo;ve
nothing
- to do.&quot;
+ to do."
Said the
mouse to the
- cur, &quot;Such
+ cur, "Such
a trial,
dear Sir,
With
@@ -2678,14 +2054,14 @@ A code-block is treated as an object and given a single object number. [an optio
would be
wasting
our
- breath.&quot;
- &quot;I'll be
- judge, I'll
- be jury,&quot;
+ breath."
+ "I&rsquo;ll be
+ judge, I&rsquo;ll
+ be jury,"
Said
cunning
old Fury:
- &quot;I'll
+ "I&rsquo;ll
try the
whole
cause,
@@ -2693,39 +2069,32 @@ A code-block is treated as an object and given a single object number. [an optio
condemn
you
to
- death.&quot;'
-</PRE>
-
-<P>
-<BR>
-
-From
-<B>SiSU</B>
-
-2.7.7 on you can number codeblocks by placing a hash after the opening code tag
-code{# as demonstrated here:
-<P>
-<PRE>
-1 | `Fury said to a
+ death."&rsquo;
+</pre>
+<p> <br>
+From <b>SiSU</b> 2.7.7 on you can number codeblocks by placing a hash after the
+opening code tag code{# as demonstrated here:
+<p> <br>
+<pre>1 | &lsquo;Fury said to a
2 | mouse, That he
3 | met in the
4 | house,
-5 | &quot;Let us
+5 | "Let us
6 | both go to
7 | law: I will
8 | prosecute
9 | YOU. --Come,
-10 | I'll take no
+10 | I&rsquo;ll take no
11 | denial; We
12 | must have a
13 | trial: For
14 | really this
-15 | morning I've
+15 | morning I&rsquo;ve
16 | nothing
-17 | to do.&quot;
+17 | to do."
18 | Said the
19 | mouse to the
-20 | cur, &quot;Such
+20 | cur, "Such
21 | a trial,
22 | dear Sir,
23 | With
@@ -2734,14 +2103,14 @@ code{# as demonstrated here:
26 | would be
27 | wasting
28 | our
-29 | breath.&quot;
-30 | &quot;I'll be
-31 | judge, I'll
-32 | be jury,&quot;
+29 | breath."
+30 | "I&rsquo;ll be
+31 | judge, I&rsquo;ll
+32 | be jury,"
33 | Said
34 | cunning
35 | old Fury:
-36 | &quot;I'll
+36 | "I&rsquo;ll
37 | try the
38 | whole
39 | cause,
@@ -2749,1284 +2118,454 @@ code{# as demonstrated here:
41 | condemn
42 | you
43 | to
-44 | death.&quot;'
-</PRE>
-
-<P>
-<A NAME="lbBN">&nbsp;</A>
-<H2>9.8 ADDITIONAL BREAKS - LINEBREAKS WITHIN OBJECTS, COLUMN AND PAGE-BREAKS</H2>
-
-<P>
-<A NAME="lbBO">&nbsp;</A>
-<H2>9.8.1 LINE-BREAKS</H2>
-
-<P>
-<BR>
-
-To break a line within a &quot;paragraph object&quot;, two backslashes \\
-with a space before and a space or newline after them
-may be used.
-<P>
-<PRE>
-To break a line within a &quot;paragraph object&quot;,
+44 | death."&rsquo;
+</pre>
+<p>
+<h2><a name='sect40' href='#toc40'>Additional Breaks - Linebreaks Within Objects, Column and Page-breaks</a></h2>
+
+<p>
+<h2><a name='sect41' href='#toc41'>Line-breaks</a></h2>
+
+<p>
+<br>
+To break a line within a "paragraph object", two backslashes \\ with a space
+before and a space or newline after them may be used.
+<p> <br>
+<pre>To break a line within a "paragraph object",
two backslashes \\ with a space before
and a space or newline after them \\
may be used.
-</PRE>
-
-<P>
-<BR>
-
+</pre>
+<p> <br>
The html break br enclosed in angle brackets (though undocumented) is available
in versions prior to 3.0.13 and 2.9.7 (it remains available for the time being,
but is depreciated).
-<P>
-<A NAME="lbBP">&nbsp;</A>
-<H2>9.8.2 PAGE BREAKS</H2>
-
-<P>
-<BR>
-
-Page breaks are only relevant and honored in some output formats. A page break
-or a new page may be inserted manually using the following markup on a line on
-its own:
-<P>
-<PRE>
+<p>
+<h2><a name='sect42' href='#toc42'>Page Breaks</a></h2>
+
+<p> <br>
+Page breaks are only relevant and honored in some output formats. A page
+break or a new page may be inserted manually using the following markup
+on a line on its own:
+<p> <br>
+page new =\= or breaks the page, starts a new page.
+<p> <br>
+page break -\- or breaks a column, starts a new column, if using columns,
+else breaks the page, starts a new page.
+<p> <br>
+<pre>-\\-
+or
&lt;:pb&gt;
-</PRE>
-
-<P>
-<BR>
+</pre>
+<p> <br>
+<p>or
+<p> <br>
+<pre>=\\=
or
-<P>
-<PRE>
&lt;:pn&gt;
-</PRE>
-
-<P>
-<BR>
-
-page new &lt;:pn&gt; breaks the page, starts a new page.
-<P>
-<BR>
-
-page break &lt;:pb&gt; breaks a column, starts a new column, if using columns, else
-breaks the page, starts a new page.
-<P>
-<A NAME="lbBQ">&nbsp;</A>
-<H2>9.9 BOOK INDEX</H2>
-
-<P>
-<BR>
-
-To make an index append to paragraph the book index term relates to it, using
-an equal sign and curly braces.
-<P>
-<BR>
-
+</pre>
+<p>
+<h2><a name='sect43' href='#toc43'>Book Index</a></h2>
+
+<p> <br>
+To make an index append to paragraph the book index term relates to it,
+using an equal sign and curly braces.
+<p> <br>
Currently two levels are provided, a main term and if needed a sub-term.
Sub-terms are separated from the main term by a colon.
-<P>
-<PRE>
- Paragraph containing main term and sub-term.
+<p> <br>
+<pre> Paragraph containing main term and sub-term.
={Main term:sub-term}
-</PRE>
-
-<P>
-<BR>
-
-The index syntax starts on a new line, but there should not be an empty line
-between paragraph and index markup.
-<P>
-<BR>
-
+</pre>
+<p> <br>
+The index syntax starts on a new line, but there should not be an empty
+line between paragraph and index markup.
+<p> <br>
The structure of the resulting index would be:
-<P>
-<PRE>
- Main term, 1
+<p> <br>
+<pre> Main term, 1
sub-term, 1
-</PRE>
+</pre>
+<p> <br>
+Several terms may relate to a paragraph, they are separated by a semicolon.
+If the term refers to more than one paragraph, indicate the number of paragraphs.
-<P>
-<BR>
-
-Several terms may relate to a paragraph, they are separated by a semicolon. If
-the term refers to more than one paragraph, indicate the number of paragraphs.
-<P>
-<PRE>
- Paragraph containing main term, second term and sub-term.
+<p> <br>
+<pre> Paragraph containing main term, second term and sub-term.
={first term; second term: sub-term}
-</PRE>
-
-<P>
-<BR>
-
+</pre>
+<p> <br>
The structure of the resulting index would be:
-<P>
-<PRE>
- First term, 1,
+<p> <br>
+<pre> First term, 1,
Second term, 1,
sub-term, 1
-</PRE>
-
-<P>
-<BR>
-
-If multiple sub-terms appear under one paragraph, they are separated under the
-main term heading from each other by a pipe symbol.
-<P>
-<PRE>
- Paragraph containing main term, second term and sub-term.
+</pre>
+<p> <br>
+If multiple sub-terms appear under one paragraph, they are separated under
+the main term heading from each other by a pipe symbol.
+<p> <br>
+<pre> Paragraph containing main term, second term and sub-term.
={Main term:sub-term+1|second sub-term}
A paragraph that continues discussion of the first sub-term
-</PRE>
-
-<P>
-<BR>
-
-The plus one in the example provided indicates the first sub-term spans one
-additional paragraph. The logical structure of the resulting index would be:
-<P>
-<PRE>
- Main term, 1,
+</pre>
+<p> <br>
+The plus one in the example provided indicates the first sub-term spans
+one additional paragraph. The logical structure of the resulting index would
+be:
+<p> <br>
+<pre> Main term, 1,
sub-term, 1-3,
second sub-term, 1,
-</PRE>
-
-<P>
-<A NAME="lbBR">&nbsp;</A>
-<H2>10. COMPOSITE DOCUMENTS MARKUP</H2>
-
-<BR>
-
-<P>
-<BR>
+</pre>
+<p>
+<h2><a name='sect44' href='#toc44'>Composite Documents Markup</a></h2>
+<br>
+<p> <br>
It is possible to build a document by creating a master document that requires
-other documents. The documents required may be complete documents that could be
-generated independently, or they could be markup snippets, prepared so as to be
-easily available to be placed within another text. If the calling document is a
-master document (built from other documents), it should be named with the
-suffix
-<B>.ssm</B>
-
-Within this document you would provide information on the other documents that
-should be included within the text. These may be other documents that would be
-processed in a regular way, or markup bits prepared only for inclusion within a
-master document
-<B>.sst</B>
-
-regular markup file, or
-<B>.ssi</B>
-
-(insert/information) A secondary file of the composite document is built prior
-to processing with the same prefix and the suffix
-<B>._sst</B>
-
-<P>
-<BR>
-
-basic markup for importing a document into a master document
-<P>
-<PRE>
-&lt;&lt; filename1.sst
+other documents. The documents required may be complete documents that could
+be generated independently, or they could be markup snippets, prepared
+so as to be easily available to be placed within another text. If the calling
+document is a master document (built from other documents), it should be
+named with the suffix <b>.ssm</b> Within this document you would provide information
+on the other documents that should be included within the text. These may
+be other documents that would be processed in a regular way, or markup
+bits prepared only for inclusion within a master document <b>.sst</b> regular markup
+file, or <b>.ssi</b> (insert/information) A secondary file of the composite document
+
+<p>is built prior to processing with the same prefix and the suffix <b>._sst</b>
+<p>
+<br>
+
+<p>basic markup for importing a document into a master document
+<p> <br>
+<pre>&lt;&lt; filename1.sst
&lt;&lt; filename2.ssi
-</PRE>
-
-<P>
-<BR>
-
-The form described above should be relied on. Within the Vim editor it results
-in the text thus linked becoming hyperlinked to the document it is calling in
-which is convenient for editing. Alternative markup for importation of
-documents under consideration, and occasionally supported have been.
-<P>
-<PRE>
-&lt;&lt; filename.ssi
-&lt;&lt;{filename.ssi}
-% using textlink alternatives
-&lt;&lt; |filename.ssi|@|^|
-</PRE>
-
-<P>
-<A NAME="lbBS">&nbsp;</A>
-<H2>11. MARKUP SYNTAX HISTORY</H2>
-
-<BR>
-
-<P>
-<A NAME="lbBT">&nbsp;</A>
-<H2>11.1 NOTES RELATED TO FILES-TYPES AND MARKUP SYNTAX</H2>
-
-<BR>
-
-<P>
-2.0 introduced new headers and is therefore incompatible with 1.0 though
-otherwise the same with the addition of a couple of tags (i.e. a superset)
-<P>
-<BR>
-
-0.38 is substantially current for version 1.0
-<P>
-<BR>
-
-depreciated 0.16 supported, though file names were changed at 0.37
-<P>
-<BR>
-
-* sisu --query=[sisu &nbsp;version &nbsp;[0.38] or 'history]
-<P>
-<BR>
-
-provides a short history of changes to
-<B>SiSU</B>
-
-markup
-<P>
-<BR>
-
-<B>SiSU 2.0</B>
-
-(2010-03-06:09/6) same as 1.0, apart from the changing of headers and the
-addition of a monospace tag related headers now grouped, e.g.
-<P>
-<PRE>
-@title:
- :subtitle:
-
-@creator:
- :author:
- :translator:
- :illustrator:
-
-@rights:
- :text:
- :illustrations:
-</PRE>
-
-<P>
-<BR>
-
-see document markup samples, and sisu --help headers
-<P>
-<BR>
-
-the monospace tag takes the form of a hash '#'
-<P>
-<PRE>
-#{ this enclosed text would be monospaced }#
-</PRE>
-
-<P>
-<BR>
-
-<B>1.0</B>
-
-(2009-12-19:50/6) same as 0.69
-<P>
-<BR>
-
-<B>0.69</B>
-
-(2008-09-16:37/2) (same as 1.0) and as previous (0.57) with the addition of
-book index tags
-<P>
-<PRE>
-/^={.+?}$/
-</PRE>
-
-<P>
-<BR>
-
-e.g. appended to a paragraph, on a new-line (without a blank line in between)
-logical structure produced assuming this is the first text &quot;object&quot;
-<P>
-<PRE>
-={GNU/Linux community distribution:Debian+2|Fedora|Gentoo;Free Software Foundation+5}
-</PRE>
-
-<P>
-<PRE>
-Free Software Foundation, 1-6
-GNU/Linux community distribution, 1
- Debian, 1-3
- Fedora, 1
- Gentoo,
-</PRE>
-
-<P>
-<BR>
-
-<B>0.66</B>
-
-(2008-02-24:07/7) same as previous, adds semantic tags, [experimental &nbsp;and not-used]
-<P>
-<PRE>
-/[:;]{.+?}[:;][a-z+]/
-</PRE>
-
-<P>
-<BR>
-
-<B>0.57</B>
-
-(2007w34/4)
-<B>SiSU</B>
-
-0.57 is the same as 0.42 with the introduction of some a shortcut to use the
-headers @title and @creator in the first heading [expanded &nbsp;using &nbsp;the contents &nbsp;of &nbsp;the &nbsp;headers &nbsp;@title: &nbsp;and &nbsp;@author:]
-<P>
-<PRE>
-:A~ @title by @author
-</PRE>
-
-<P>
-<BR>
-
-<B>0.52</B>
-
-(2007w14/6) declared document type identifier at start of text/document:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;.B&nbsp;SiSU
-0.52
-<P>
-<BR>
-
-or, backward compatible using the comment marker:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;%
-<B>SiSU</B>
-
-0.38
-<P>
-<BR>
-
-variations include '
-<B>SiSU</B>
-
-(text|master|insert) [version]' and 'sisu-[version]'
-<P>
-<BR>
-
-<B>0.51</B>
-
-(2007w13/6) skins changed (simplified), markup unchanged
-<P>
-<BR>
-
-<B>0.42</B>
-
-(2006w27/4) * (asterisk) type endnotes, used e.g. in relation to author
-<P>
-<BR>
-
-<B>SiSU</B>
-
-0.42 is the same as 0.38 with the introduction of some additional endnote
-types,
-<P>
-<BR>
-
-Introduces some variations on endnotes, in particular the use of the asterisk
-<P>
-<PRE>
-~{* for example for describing an author }~ and ~{** for describing a second author }~
-</PRE>
-
-<P>
-<BR>
-
-* for example for describing an author
-<P>
-<BR>
-
-** for describing a second author
-<P>
-<BR>
-
-and
-<P>
-<PRE>
-~[* &nbsp;my &nbsp;note &nbsp;]~ or ~[+ &nbsp;another &nbsp;note &nbsp;]~
-</PRE>
-
-<P>
-<BR>
-
-which numerically increments an asterisk and plus respectively
-<P>
-<BR>
-
-*1 my note +1 another note
-<P>
-<BR>
-
-<B>0.38</B>
-
-(2006w15/7) introduced new/alternative notation for headers, e.g. @title:
-(instead of 0~title), and accompanying document structure markup,
-:A,:B,:C,1,2,3 (maps to previous 1,2,3,4,5,6)
-<P>
-<BR>
-
-<B>SiSU</B>
-
-0.38 introduced alternative experimental header and heading/structure markers,
-<P>
-<PRE>
-@headername: and headers :A~ :B~ :C~ 1~ 2~ 3~
-</PRE>
-
-<P>
-<BR>
-
-as the equivalent of:
-<P>
-<PRE>
-0~headername and headers 1~ 2~ 3~ 4~ 5~ 6~
-</PRE>
-
-<P>
-<BR>
-
-The internal document markup of
-<B>SiSU</B>
-
-0.16 remains valid and standard Though note that
-<B>SiSU</B>
-
-0.37 introduced a new file naming convention
-<P>
-<BR>
-
-<B>SiSU</B>
-
-has in effect two sets of levels to be considered, using 0.38 notation A-C
-headings/levels, pre-ordinary paragraphs /pre-substantive text, and 1-3
-headings/levels, levels which are followed by ordinary text. This may be
-conceptualised as levels A,B,C, 1,2,3, and using such letter number notation,
-in effect: A must exist, optional B and C may follow in sequence (not strict) 1
-must exist, optional 2 and 3 may follow in sequence i.e. there are two
-independent heading level sequences A,B,C and 1,2,3 (using the 0.16 standard
-notation 1,2,3 and 4,5,6) on the positive side: the 0.38 A,B,C,1,2,3
-alternative makes explicit an aspect of structuring documents in
-<B>SiSU</B>
-
-that is not otherwise obvious to the newcomer (though it appears more
-complicated, is more in your face and likely to be understood fairly quickly);
-the substantive text follows levels 1,2,3 and it is 'nice' to do most work in
-those levels
-<P>
-<BR>
-
-<B>0.37</B>
-
-(2006w09/7) introduced new file naming convention, .sst (text), .ssm
-(master), .ssi (insert), markup syntax unchanged
-<P>
-<BR>
-
-<B>SiSU</B>
-
-0.37 introduced new file naming convention, using the file extensions .sst
-<BR>&nbsp;.ssm&nbsp;and&nbsp;.ssi&nbsp;to&nbsp;replace&nbsp;.s1&nbsp;.s2&nbsp;.s3&nbsp;.r1&nbsp;.r2&nbsp;.r3&nbsp;and&nbsp;.si
-<P>
-<BR>
-
-this is captured by the following file 'rename' instruction:
-<P>
-<PRE>
-rename 's/\.s[123]$/\.sst/' *.s{1,2,3}
-rename 's/\.r[123]$/\.ssm/' *.r{1,2,3}
-rename 's/\.si$/\.ssi/' *.si
-</PRE>
-
-<P>
-<BR>
-
-The internal document markup remains unchanged, from
-<B>SiSU</B>
-
-0.16
-<P>
-<BR>
-
-<B>0.35</B>
-
-(2005w52/3) sisupod, zipped content file introduced
-<P>
-<BR>
-
-<B>0.23</B>
-
-(2005w36/2) utf-8 for markup file
-<P>
-<BR>
-
-<B>0.22</B>
-
-(2005w35/3) image dimensions may be omitted if rmagick is available to be
-relied upon
-<P>
-<BR>
-
-<B>0.20.4</B>
-
-(2005w33/4) header 0~links
-<P>
-<BR>
-
-<B>0.16</B>
-
-(2005w25/2) substantial changes introduced to make markup cleaner, header
-0~title type, and headings [1-6]~ introduced, also percentage sign (%) at
-start of a text line as comment marker
-<P>
-<BR>
-
-<B>SiSU</B>
-
-0.16 (0.15 development branch) introduced the use of
-<P>
-<BR>
-
-the header 0~ and headings/structure 1~ 2~ 3~ 4~ 5~ 6~
-<P>
-<BR>
-
-in place of the 0.1 header, heading/structure notation
-<P>
-<BR>
-
-<B>SiSU</B>
-
-0.1 headers and headings structure represented by header 0{~ and
-headings/structure 1{ 2{ 3{ 4{~ 5{ 6{
-<P>
-<A NAME="lbBU">&nbsp;</A>
-<H2>12. SISU FILETYPES</H2>
-
-<BR>
-
-<P>
-<BR>
-
-<B>SiSU</B>
-
-has plaintext and binary filetypes, and can process either type of document.
-<P>
-<A NAME="lbBV">&nbsp;</A>
-<H2>12.1 .SST .SSM .SSI MARKED UP PLAIN TEXT</H2>
-
-<P>
-<BR>
-
-<B>SiSU</B>
-
-documents are prepared as plain-text (utf-8) files with
-<B>SiSU</B>
-
-markup. They may make reference to and contain images (for example), which are
-stored in the directory beneath them _sisu/image.
-<B>SiSU</B>
-
-plaintext markup files are of three types that may be distinguished by the file
-extension used: regular text .sst; master documents, composite documents that
-incorporate other text, which can be any regular text or text insert; and
-inserts the contents of which are like regular text except these are marked
-<BR>&nbsp;.ssi&nbsp;and&nbsp;are&nbsp;not&nbsp;processed.
-<P>
-<BR>
-
-<B>SiSU</B>
-
-processing can be done directly against a sisu documents; which may be located
-locally or on a remote server for which a url is provided.
-<P>
-<BR>
-
-<B>SiSU</B>
-
-source markup can be shared with the command:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;sisu&nbsp;-s&nbsp;[filename]
-<P>
-<A NAME="lbBW">&nbsp;</A>
-<H2>12.1.1 SISU TEXT - REGULAR FILES (.SST)</H2>
-
-<P>
-<BR>
-
-The most common form of document in
-<B>SiSU,</B>
-
-see the section on
-<B>SiSU</B>
-
-markup.
-<P>
-<BR>
-
-&lt;<A HREF="http://www.sisudoc.org/sisu/sisu_markup">http://www.sisudoc.org/sisu/sisu_markup</A>&gt;
-<P>
-<BR>
-
-&lt;<A HREF="http://www.sisudoc.org/sisu/sisu_manual">http://www.sisudoc.org/sisu/sisu_manual</A>&gt;
-<P>
-<A NAME="lbBX">&nbsp;</A>
-<H2>12.1.2 SISU MASTER FILES (.SSM)</H2>
-
-<P>
-<BR>
-
-Composite documents which incorporate other
-<B>SiSU</B>
-
-documents which may be either regular
-<B>SiSU</B>
-
-text .sst which may be generated independently, or inserts prepared solely for
-the purpose of being incorporated into one or more master documents.
-<P>
-<BR>
-
-The mechanism by which master files incorporate other documents is described as
-one of the headings under under
-<B>SiSU</B>
-
-markup in the
-<B>SiSU</B>
-
-manual.
-<P>
-<BR>
-
+</pre>
+<p> <br>
+The form described above should be relied on. Within the <i>Vim</i> editor it results
+in the text thus linked becoming hyperlinked to the document it is calling
+in which is convenient for editing.
+<p>
+<h2><a name='sect45' href='#toc45'>Sisu Filetypes</a></h2>
+<br>
+
+<p> <br>
+<b>SiSU</b> has <i>plaintext</i> and binary filetypes, and can process either type of
+document.
+<p>
+<h2><a name='sect46' href='#toc46'>.sst .ssm .ssi Marked Up Plain Text</a></h2>
+
+<p>
+<dl>
+
+<dt><b>SiSU¤b〕 documents are prepared
+as plain-text (utf-8) files with</b> </dt>
+<dd><b>SiSU</b> markup. They may make reference to and
+contain images (for example), which are stored in the directory beneath
+them _sisu/image. 〔b¤SiSU <i>plaintext</i> markup files are of three types that
+may be distinguished by the file extension used: regular text .sst; master
+documents, composite documents that incorporate other text, which can be
+any regular text or text insert; and inserts the contents of which are
+like regular text except these are marked .ssi and are not processed.<br>
+
+<p> <br>
+<b>SiSU</b> processing can be done directly against a sisu documents; which may
+be located locally or on a remote server for which a url is provided.
+<p> <br>
+<b>SiSU</b> source markup can be shared with the command:
+<p> <br>
+ sisu -s [filename]<br>
+
+<p> </dd>
+</dl>
+
+<h2><a name='sect47' href='#toc47'>Sisu Text - Regular Files (.sst)</a></h2>
+
+<p> <br>
+The most common form of document in <b>SiSU,</b> see the section on <b>SiSU</b> markup.
+
+<p>
+<h2><a name='sect48' href='#toc48'>Sisu Master Files (.ssm)</a></h2>
+
+<p> <br>
+Composite documents which incorporate other <b>SiSU</b> documents which may be
+either regular <b>SiSU</b> text .sst which may be generated independently, or inserts
+prepared solely for the purpose of being incorporated into one or more
+master documents.
+<p> <br>
+The mechanism by which master files incorporate other documents is described
+as one of the headings under under <b>SiSU</b> markup in the <b>SiSU</b> manual.
+<p> <br>
Note: Master documents may be prepared in a similar way to regular documents,
and processing will occur normally if a .sst file is renamed .ssm without
requiring any other documents; the .ssm marker flags that the document may
contain other documents.
-<P>
-<BR>
-
+<p> <br>
Note: a secondary file of the composite document is built prior to processing
-with the same prefix and the suffix ._sst [^18]
-<P>
-<BR>
-
-&lt;<A HREF="http://www.sisudoc.org/sisu/sisu_markup">http://www.sisudoc.org/sisu/sisu_markup</A>&gt;
-<P>
-<BR>
-
-&lt;<A HREF="http://www.sisudoc.org/sisu/sisu_manual">http://www.sisudoc.org/sisu/sisu_manual</A>&gt;
-<P>
-<A NAME="lbBY">&nbsp;</A>
-<H2>12.1.3 SISU INSERT FILES (.SSI)</H2>
-
-<P>
-<BR>
+with the same prefix and the suffix ._sst [^19]
+<p>
+<h2><a name='sect49' href='#toc49'>Sisu Insert Files (.ssi)</a></h2>
+<p>
+<br>
Inserts are documents prepared solely for the purpose of being incorporated
-into one or more master documents. They resemble regular
-<B>SiSU</B>
-
-text files except they are ignored by the
-<B>SiSU</B>
-
-processor. Making a file a .ssi file is a quick and convenient way of flagging
-that it is not intended that the file should be processed on its own.
-<P>
-<A NAME="lbBZ">&nbsp;</A>
-<H2>12.2 SISUPOD, ZIPPED BINARY CONTAINER (SISUPOD.ZIP, .SSP)</H2>
-
-<P>
-<BR>
-
-A sisupod is a zipped
-<B>SiSU</B>
-
-text file or set of
-<B>SiSU</B>
-
-text files and any associated images that they contain (this will be extended
-to include sound and multimedia-files)
-<P>
-<BR>
-
-<B>SiSU</B>
-
-plaintext files rely on a recognised directory structure to find contents such
-as images associated with documents, but all images for example for all
-documents contained in a directory are located in the sub-directory
-_sisu/image. Without the ability to create a sisupod it can be inconvenient to
-manually identify all other files associated with a document. A sisupod
-automatically bundles all associated files with the document that is turned
-into a pod.
-<P>
-<BR>
-
-The structure of the sisupod is such that it may for example contain a single
-document and its associated images; a master document and its associated
-documents and anything else; or the zipped contents of a whole directory of
-prepared
-<B>SiSU</B>
-
-documents.
-<P>
-<BR>
-
+into one or more master documents. They resemble regular <b>SiSU</b> text files
+except they are ignored by the <b>SiSU</b> processor. Making a file a .ssi file
+is a quick and convenient way of flagging that it is not intended that
+the file should be processed on its own.
+<p>
+<h2><a name='sect50' href='#toc50'>Sisupod, Zipped Binary Container
+(sisupod.zip, .ssp)</a></h2>
+
+<p> <br>
+A sisupod is a zipped <b>SiSU</b> text file or set of <b>SiSU</b> text files and any
+associated images that they contain (this will be extended to include sound
+and multimedia-files)
+<p>
+<dl>
+
+<dt><b>SiSU</b> </dt>
+<dd><i>plaintext</i> files rely on a recognised directory
+structure to find contents such as images associated with documents, but
+all images for example for all documents contained in a directory are located
+in the sub-directory _sisu/image. Without the ability to create a sisupod
+it can be inconvenient to manually identify all other files associated
+with a document. A sisupod automatically bundles all associated files with
+the document that is turned into a pod.
+<p> <br>
+The structure of the sisupod is such that it may for example contain a
+single document and its associated images; a master document and its associated
+documents and anything else; or the zipped contents of a whole directory
+of prepared <b>SiSU</b> documents.
+<p> <br>
The command to create a sisupod is:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;sisu&nbsp;-S&nbsp;[filename]
-<P>
-<BR>
+<p> <br>
+ sisu -S [filename]<br>
+<p> <br>
Alternatively, make a pod of the contents of a whole directory:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;sisu&nbsp;-S
-<P>
-<BR>
-
-<B>SiSU</B>
-
-processing can be done directly against a sisupod; which may be located locally
-or on a remote server for which a url is provided.
-<P>
-<BR>
-
-&lt;<A HREF="http://www.sisudoc.org/sisu/sisu_commands">http://www.sisudoc.org/sisu/sisu_commands</A>&gt;
-<P>
-<BR>
-
-&lt;<A HREF="http://www.sisudoc.org/sisu/sisu_manual">http://www.sisudoc.org/sisu/sisu_manual</A>&gt;
-<P>
-<A NAME="lbCA">&nbsp;</A>
-<H2>13. EXPERIMENTAL ALTERNATIVE INPUT REPRESENTATIONS</H2>
-
-<BR>
-
-<P>
-<A NAME="lbCB">&nbsp;</A>
-<H2>13.1 ALTERNATIVE XML</H2>
-
-<P>
-<BR>
-
-<B>SiSU</B>
-
-offers alternative XML input representations of documents as a proof of
-concept, experimental feature. They are however not strictly maintained, and
-incomplete and should be handled with care.
-<P>
-<BR>
-
-<B>convert from sst to simple xml representations (sax, dom and node):</B>
-
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;sisu&nbsp;--to-sax&nbsp;[filename/wildcard]&nbsp;or&nbsp;sisu&nbsp;--to-sxs&nbsp;[filename/wildcard]
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;sisu&nbsp;--to-dom&nbsp;[filename/wildcard]&nbsp;or&nbsp;sisu&nbsp;--to-sxd&nbsp;[filename/wildcard]
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;sisu&nbsp;--to-node&nbsp;[filename/wildcard]&nbsp;or&nbsp;sisu&nbsp;--to-sxn&nbsp;[filename/wildcard]
-<P>
-<BR>
-
-<B>convert to sst from any sisu xml representation (sax, dom and node):</B>
-
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;sisu&nbsp;--from-xml2sst&nbsp;[filename/wildcard&nbsp;&nbsp;[.sxs.xml,.sxd.xml,sxn.xml]]
-<P>
-<BR>
-
-or the same:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;sisu&nbsp;--from-sxml&nbsp;[filename/wildcard&nbsp;&nbsp;[.sxs.xml,.sxd.xml,sxn.xml]]
-<P>
-<A NAME="lbCC">&nbsp;</A>
-<H2>13.1.1 XML SAX REPRESENTATION</H2>
-
-<P>
-<BR>
-
-To convert from sst to simple xml (sax) representation:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;sisu&nbsp;--to-sax&nbsp;[filename/wildcard]&nbsp;or&nbsp;sisu&nbsp;--to-sxs&nbsp;[filename/wildcard]
-<P>
-<BR>
-
-To convert from any sisu xml representation back to sst
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;sisu&nbsp;--from-xml2sst&nbsp;[filename/wildcard&nbsp;&nbsp;[.sxs.xml,.sxd.xml,sxn.xml]]
-<P>
-<BR>
-
-or the same:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;sisu&nbsp;--from-sxml&nbsp;[filename/wildcard&nbsp;&nbsp;[.sxs.xml,.sxd.xml,sxn.xml]]
-<P>
-<A NAME="lbCD">&nbsp;</A>
-<H2>13.1.2 XML DOM REPRESENTATION</H2>
-
-<P>
-<BR>
-
-To convert from sst to simple xml (dom) representation:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;sisu&nbsp;--to-dom&nbsp;[filename/wildcard]&nbsp;or&nbsp;sisu&nbsp;--to-sxd&nbsp;[filename/wildcard]
-<P>
-<BR>
-
-To convert from any sisu xml representation back to sst
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;sisu&nbsp;--from-xml2sst&nbsp;[filename/wildcard&nbsp;&nbsp;[.sxs.xml,.sxd.xml,sxn.xml]]
-<P>
-<BR>
-
-or the same:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;sisu&nbsp;--from-sxml&nbsp;[filename/wildcard&nbsp;&nbsp;[.sxs.xml,.sxd.xml,sxn.xml]]
-<P>
-<A NAME="lbCE">&nbsp;</A>
-<H2>13.1.3 XML NODE REPRESENTATION</H2>
-
-<P>
-<BR>
-
-To convert from sst to simple xml (node) representation:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;sisu&nbsp;--to-node&nbsp;[filename/wildcard]&nbsp;or&nbsp;sisu&nbsp;--to-sxn&nbsp;[filename/wildcard]
-<P>
-<BR>
-
-To convert from any sisu xml representation back to sst
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;sisu&nbsp;--from-xml2sst&nbsp;[filename/wildcard&nbsp;&nbsp;[.sxs.xml,.sxd.xml,sxn.xml]]
-<P>
-<BR>
-
-or the same:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;sisu&nbsp;--from-sxml&nbsp;[filename/wildcard&nbsp;&nbsp;[.sxs.xml,.sxd.xml,sxn.xml]]
-<P>
-<A NAME="lbCF">&nbsp;</A>
-<H2>14. CONFIGURATION</H2>
-
-<BR>
-
-<P>
-<A NAME="lbCG">&nbsp;</A>
-<H2>14.1 DETERMINING THE CURRENT CONFIGURATION</H2>
-
-<P>
-<BR>
-
-Information on the current configuration of
-<B>SiSU</B>
-
-should be available with the help command:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;sisu&nbsp;-v
-<P>
-<BR>
-
-which is an alias for:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;sisu&nbsp;--help&nbsp;env
-<P>
-<BR>
-
-Either of these should be executed from within a directory that contains sisu
-markup source documents.
-<P>
-<A NAME="lbCH">&nbsp;</A>
-<H2>14.2 CONFIGURATION FILES (CONFIG.YML)</H2>
-
-<P>
-<BR>
-
-<B>SiSU</B>
-
-configration parameters are adjusted in the configuration file, which can be
-used to override the defaults set. This includes such things as which directory
-interim processing should be done in and where the generated output should be
-placed.
-<P>
-<BR>
-
-The
-<B>SiSU</B>
-
-configuration file is a yaml file, which means indentation is significant.
-<P>
-<BR>
-
-<B>SiSU</B>
-
-resource configuration is determined by looking at the following files if they
-exist:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;./_sisu/sisurc.yml
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;~/.sisu/sisurc.yml
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;/etc/sisu/sisurc.yml
-<P>
-<BR>
+<p> <br>
+ sisu -S<br>
+<p> <br>
+<b>SiSU</b> processing can be done directly against a sisupod; which may be located
+locally or on a remote server for which a url is provided.
+<p> <br>
+&lt;<a href='http://www.sisudoc.org/sisu/sisu_commands'>http://www.sisudoc.org/sisu/sisu_commands</a>
+&gt;
+<p> <br>
+&lt;<a href='http://www.sisudoc.org/sisu/sisu_manual'>http://www.sisudoc.org/sisu/sisu_manual</a>
+&gt;
+<p> </dd>
+</dl>
+
+<h2><a name='sect51' href='#toc51'>Configuration</a></h2>
+<br>
+
+<p>
+<h2><a name='sect52' href='#toc52'>Configuration Files</a></h2>
+
+<p>
+<h2><a name='sect53' href='#toc53'>Config.yml</a></h2>
+
+<p> <br>
+<b>SiSU</b> configration parameters are adjusted in the configuration file, which
+can be used to override the defaults set. This includes such things as which
+directory interim processing should be done in and where the generated
+output should be placed.
+<p> <br>
+The <b>SiSU</b> configuration file is a yaml file, which means indentation is
+significant.
+<p> <br>
+<b>SiSU</b> resource configuration is determined by looking at the following files
+if they exist:
+<p> <br>
+ ./_sisu/v4/sisurc.yml<br>
+
+<p> <br>
+ ./_sisu/sisurc.yml<br>
+
+<p> <br>
+ ~/.sisu/v4/sisurc.yml<br>
+
+<p> <br>
+ ~/.sisu/sisurc.yml<br>
+
+<p> <br>
+ /etc/sisu/v4/sisurc.yml<br>
+
+<p> <br>
+ /etc/sisu/sisurc.yml<br>
+
+<p> <br>
The search is in the order listed, and the first one found is used.
-<P>
-<BR>
-
+<p> <br>
In the absence of instructions in any of these it falls back to the internal
program defaults.
-<P>
-<BR>
-
-Configuration determines the output and processing directories and the database
-access details.
-<P>
-<BR>
-
-If
-<B>SiSU</B>
-
-is installed a sample sisurc.yml may be found in /etc/sisu/sisurc.yml
-<P>
-<A NAME="lbCI">&nbsp;</A>
-<H2>15. SKINS</H2>
-
-<BR>
-
-<P>
-<BR>
-
-Skins modify the default appearance of document output on a document,
-directory, or site wide basis. Skins are looked for in the following locations:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;./_sisu/skin
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;~/.sisu/skin
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;/etc/sisu/skin
-<P>
-<BR>
-
-<B>Within the skin directory</B>
-
-are the following the default sub-directories for document skins:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;./skin/doc
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;./skin/dir
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;./skin/site
-<P>
-<BR>
-
-A skin is placed in the appropriate directory and the file named skin_[name].rb
-<P>
-<BR>
-
-The skin itself is a ruby file which modifies the default appearances set in
-the program.
-<P>
-<A NAME="lbCJ">&nbsp;</A>
-<H2>15.1 DOCUMENT SKIN</H2>
-
-<P>
-<BR>
-
-Documents take on a document skin, if the header of the document specifies a
-skin to be used.
-<P>
-<PRE>
-@skin: skin_united_nations
-</PRE>
-
-<P>
-<A NAME="lbCK">&nbsp;</A>
-<H2>15.2 DIRECTORY SKIN</H2>
-
-<P>
-<BR>
-
-A directory may be mapped on to a particular skin, so all documents within that
-directory take on a particular appearance. If a skin exists in the skin/dir
-with the same name as the document directory, it will automatically be used for
-each of the documents in that directory, (except where a document specifies the
-use of another skin, in the skin/doc directory).
-<P>
-<BR>
-
-A personal habit is to place all skins within the doc directory, and symbolic
-links as needed from the site, or dir directories as required.
-<P>
-<A NAME="lbCL">&nbsp;</A>
-<H2>15.3 SITE SKIN</H2>
-
-<P>
-<BR>
-
-A site skin, modifies the program default skin.
-<P>
-<A NAME="lbCM">&nbsp;</A>
-<H2>15.4 SAMPLE SKINS</H2>
-
-<P>
-<BR>
-
-With
-<B>SiSU</B>
-
-installed sample skins may be found in:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;/etc/sisu/skin/doc&nbsp;and
-<BR>&nbsp;&nbsp;/usr/share/doc/sisu/markup-samples/samples/_sisu/skin/doc
-<P>
-<BR>
-
-(or equivalent directory) and if sisu-markup-samples is installed also under:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;/usr/share/doc/sisu/markup-samples-non-free/samples/_sisu/skin/doc
-<P>
-<BR>
-
-Samples of list.yml and promo.yml (which are used to create the right column
-list) may be found in:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;/usr/share/doc/sisu/markup-samples-non-free/samples/_sisu/skin/yml&nbsp;(or
-<BR>&nbsp;&nbsp;equivalent&nbsp;directory)
-<P>
-<A NAME="lbCN">&nbsp;</A>
-<H2>16. CSS - CASCADING STYLE SHEETS (FOR HTML, XHTML AND XML)</H2>
-
-<BR>
-
-<P>
-<BR>
-
-CSS files to modify the appearance of
-<B>SiSU</B>
-
-html, XHTML or XML may be placed in the configuration directory: ./_sisu/css;
-~/.sisu/css or; /etc/sisu/css and these will be copied to the output
-directories with the command sisu -CC.
-<P>
-<BR>
-
-The basic CSS file for html output is html.css, placing a file of that name in
-directory _sisu/css or equivalent will result in the default file of that name
-being overwritten.
-<P>
-<BR>
-
-HTML: html.css
-<P>
-<BR>
-
-XML DOM: dom.css
-<P>
-<BR>
-
-XML SAX: sax.css
-<P>
-<BR>
-
-XHTML: xhtml.css
-<P>
-<BR>
-
-The default homepage may use homepage.css or html.css
-<P>
-<BR>
-
+<p> <br>
+Configuration determines the output and processing directories and the
+database access details.
+<p> <br>
+
+<p>If <b>SiSU</b> is installed a sample sisurc.yml may be found in /etc/sisu/sisurc.yml
+
+<p>
+<h2><a name='sect54' href='#toc54'>Sisu_document_make</a></h2>
+
+<p> <br>
+Most sisu document headers relate to metadata, the exception is the @make:
+header which provides processing related information. The default contents
+of the @make header may be set by placing them in a file sisu_document_make.
+
+<p> <br>
+The search order is as for resource configuration:
+<p> <br>
+ ./_sisu/v4/sisu_document_make<br>
+
+<p> <br>
+ ./_sisu/sisu_document_make<br>
+
+<p> <br>
+ ~/.sisu/v4/sisu_document_make<br>
+
+<p> <br>
+ ~/.sisu/sisu_document_make<br>
+
+<p> <br>
+ /etc/sisu/v4/sisu_document_make<br>
+
+<p> <br>
+ /etc/sisu/sisu_document_make<br>
+
+<p> <br>
+A sample sisu_document_make can be found in the _sisu/ directory under
+along with the provided sisu markup samples.
+<p>
+<h2><a name='sect55' href='#toc55'>Css - Cascading Style Sheets
+(for Html, Xhtml and Xml)</a></h2>
+<br>
+
+<p> <br>
+CSS files to modify the appearance of <b>SiSU</b> html, <i>XHTML</i> or <i>XML</i> may be placed
+in the configuration directory: ./_sisu/css ; ~/.sisu/css or; /etc/sisu/css
+and these will be copied to the output directories with the command sisu
+-CC.
+<p> <br>
+The basic CSS file for html output is html. css, placing a file of that
+name in directory _sisu/css or equivalent will result in the default file
+of that name being overwritten.
+<p> <br>
+<i>HTML:</i> html. css
+<p> <br>
+<i>XML</i> DOM: dom.css
+<p> <br>
+<i>XML</i> SAX: sax.css
+<p> <br>
+<i>XHTML:</i> xhtml. css
+<p> <br>
+The default homepage may use homepage.css or html. css
+<p> <br>
Under consideration is to permit the placement of a CSS file with a different
-name in directory _sisu/css directory or equivalent, and change the default CSS
-file that is looked for in a skin.[^19]
-<P>
-<A NAME="lbCO">&nbsp;</A>
-<H2>17. ORGANISING CONTENT - DIRECTORY STRUCTURE AND MAPPING</H2>
-
-<BR>
-
-<P>
-<BR>
-
-<B>SiSU</B>
-
-v3 has new options for the source directory tree, and output directory
+name in directory _sisu/css directory or equivalent.[^20]
+<p>
+<h2><a name='sect56' href='#toc56'>Organising Content
+- Directory Structure and Mapping</a></h2>
+<br>
+
+<p> <br>
+<b>SiSU</b> v3 has new options for the source directory tree, and output directory
structures of which there are 3 alternatives.
-<P>
-<A NAME="lbCP">&nbsp;</A>
-<H2>17.1 DOCUMENT SOURCE DIRECTORY</H2>
-
-<P>
-<BR>
+<p>
+<h2><a name='sect57' href='#toc57'>Document Source Directory</a></h2>
+<p>
+<br>
The document source directory is the directory in which sisu processing
commands are given. It contains the sisu source files (.sst .ssm .ssi), or
-(for sisu v3 may contain) subdirectories with language codes which contain the
-sisu source files, so all English files would go in subdirectory en/, French in
-fr/, Spanish in es/ and so on. ISO 639-1 codes are used (as varied by po4a). A
-list of available languages (and possible sub-directory names) can be obtained
-with the command &quot;sisu --help lang&quot; The list of languages is limited to
-langagues supported by XeTeX polyglosia.
-<P>
-<A NAME="lbCQ">&nbsp;</A>
-<H2>17.1.1 GENERAL DIRECTORIES</H2>
-
-<P>
-<PRE>
-% files stored at this level e.g. sisu_manual.sst or
+(for sisu v3 may contain) subdirectories with language codes which contain
+the sisu source files, so all English files would go in subdirectory en/,
+French in fr/, Spanish in es/ and so on. ISO 639-1 codes are used (as varied
+by po4a). A list of available languages (and possible sub-directory names)
+can be obtained with the command "sisu --help lang" The list of languages
+is limited to langagues supported by XeTeX polyglosia.
+<p>
+<h2><a name='sect58' href='#toc58'>General Directories</a></h2>
+
+<p>
+<br>
+<pre>% files stored at this level e.g. sisu_manual.sst or
% for sisu v3 may be under language sub-directories
% e.g.
-% configuration file e.g. sisurc.yml
-% skins in various skin directories doc, dir, site, yml
-</PRE>
-
-<P>
-<A NAME="lbCR">&nbsp;</A>
-<H2>17.2 DOCUMENT OUTPUT DIRECTORY STRUCTURES</H2>
-
-<P>
-<A NAME="lbCS">&nbsp;</A>
-<H2>17.2.1 OUTPUT DIRECTORY ROOT</H2>
+ ./subject_name/en
+ ./subject_name/fr
+ ./subject_name/es
+ ./subject_name/_sisu
+ ./subject_name/_sisu/css
+ ./subject_name/_sisu/image
+</pre>
+<p>
+<h2><a name='sect59' href='#toc59'>Document Output Directory Structures</a></h2>
-<P>
-<BR>
+<p>
+<h2><a name='sect60' href='#toc60'>Output Directory Root</a></h2>
+<p> <br>
The output directory root can be set in the sisurc.yml file. Under the root,
-subdirectories are made for each directory in which a document set resides. If
-you have a directory named poems or conventions, that directory will be created
-under the output directory root and the output for all documents contained in
-the directory of a particular name will be generated to subdirectories beneath
-that directory (poem or conventions). A document will be placed in a
-subdirectory of the same name as the document with the filetype identifier
+subdirectories are made for each directory in which a document set resides.
+If you have a directory named poems or conventions, that directory will
+be created under the output directory root and the output for all documents
+contained in the directory of a particular name will be generated to subdirectories
+beneath that directory (poem or conventions). A document will be placed
+in a subdirectory of the same name as the document with the filetype identifier
stripped (.sst .ssm)
-<P>
-<BR>
-
-The last part of a directory path, representing the sub-directory in which a
-document set resides, is the directory name that will be used for the output
-directory. This has implications for the organisation of document collections
-as it could make sense to place documents of a particular subject, or type
-within a directory identifying them. This grouping as suggested could be by
-subject (sales_law, english_literature); or just as conveniently by some other
-classification (X University). The mapping means it is also possible to place
-in the same output directory documents that are for organisational purposes
-kept separately, for example documents on a given subject of two different
-institutions may be kept in two different directories of the same name, under a
-directory named after each institution, and these would be output to the same
-output directory. Skins could be associated with each institution on a
-directory basis and resulting documents will take on the appropriate different
-appearance.
-<P>
-<A NAME="lbCT">&nbsp;</A>
-<H2>17.2.2 ALTERNATIVE OUTPUT STRUCTURES</H2>
-
-<P>
-<BR>
-
-There are 3 possibile output structures described as being, by language, by
-filetype or by filename, the selection is made in sisurc.yml
-<P>
-<PRE>
-#% output_dir_structure_by: language; filetype; or filename
+<p> <br>
+The last part of a directory path, representing the sub-directory in which
+a document set resides, is the directory name that will be used for the
+output directory. This has implications for the organisation of document
+collections as it could make sense to place documents of a particular subject,
+or type within a directory identifying them. This grouping as suggested
+could be by subject (sales_law, english_literature); or just as conveniently
+by some other classification (X University). The mapping means it is also
+possible to place in the same output directory documents that are for organisational
+purposes kept separately, for example documents on a given subject of two
+different institutions may be kept in two different directories of the
+same name, under a directory named after each institution, and these would
+be output to the same output directory. Skins could be associated with each
+institution on a directory basis and resulting documents will take on the
+appropriate different appearance.
+<p>
+<h2><a name='sect61' href='#toc61'>Alternative Output Structures</a></h2>
+
+<p> <br>
+There are 3 possibile output structures described as being, by language,
+by filetype or by filename, the selection is made in sisurc.yml
+<p> <br>
+<pre>#% output_dir_structure_by: language; filetype; or filename
output_dir_structure_by: language #(language &amp; filetype, preferred?)
#output_dir_structure_by: filetype
-#output_dir_structure_by: filename #(default, closest to original v1 &amp; v2)
-</PRE>
-
-<P>
-<A NAME="lbCU">&nbsp;</A>
-<H2>17.2.3 BY LANGUAGE</H2>
-
-<P>
-<BR>
-
-The by language directory structure places output files
-<P>
-<BR>
-
-The by language directory structure separates output files by language code
-(all files of a given language), and within the language directory by filetype.
-<P>
-<BR>
-
-Its selection is configured in sisurc.yml
-<P>
-<BR>
-
+#output_dir_structure_by: filename #(default, closest to original v1 &amp;
+v2)
+</pre>
+<p>
+<h2><a name='sect62' href='#toc62'>by Language</a></h2>
+
+<p> <br>
+
+<p>The by language directory structure places output files
+<p> <br>
+The by language directory structure separates output files by language
+code (all files of a given language), and within the language directory
+by filetype.
+<p> <br>
+
+<p>Its selection is configured in sisurc.yml
+<p> <br>
output_dir_structure_by: language
-<P>
-<PRE>
- |-- en
+<p> <br>
+<pre> |-- en
|-- epub
|-- hashes
|-- html
@@ -4038,47 +2577,37 @@ output_dir_structure_by: language
| |-- sitemaps
| |-- txt
| |-- xhtml
- | `-- xml
+ | &lsquo;-- xml
|-- po4a
- | `-- live-manual
+ | &lsquo;-- live-manual
| |-- po
| |-- fr
- | `-- pot
- `-- _sisu
+ | &lsquo;-- pot
+ &lsquo;-- _sisu
|-- css
|-- image
|-- image_sys -&gt; ../../_sisu/image_sys
- `-- xml
+ &lsquo;-- xml
|-- rnc
|-- rng
- `-- xsd
-</PRE>
-
-<P>
-<BR>
-
+ &lsquo;-- xsd
+</pre>
+<p> <br>
#by: language subject_dir/en/manifest/filename.html
-<P>
-<A NAME="lbCV">&nbsp;</A>
-<H2>17.2.4 BY FILETYPE</H2>
+<p>
+<h2><a name='sect63' href='#toc63'>by Filetype</a></h2>
-<P>
-<BR>
-
-The by filetype directory structure separates output files by filetype, all
-html files in one directory pdfs in another and so on. Filenames are given a
-language extension.
-<P>
-<BR>
-
-Its selection is configured in sisurc.yml
-<P>
-<BR>
+<p> <br>
+The by filetype directory structure separates output files by filetype,
+all html files in one directory pdfs in another and so on. Filenames are
+given a language extension.
+<p> <br>
+<p>Its selection is configured in sisurc.yml
+<p> <br>
output_dir_structure_by: filetype
-<P>
-<PRE>
- |-- epub
+<p> <br>
+<pre> |-- epub
|-- hashes
|-- html
|-- viral_spiral.david_bollier
@@ -4090,76 +2619,61 @@ output_dir_structure_by: filetype
|-- live-manual
| |-- po
| |-- fr
- | `-- pot
+ | &lsquo;-- pot
|-- _sisu
| |-- css
| |-- image
| |-- image_sys -&gt; ../../_sisu/image_sys
- | `-- xml
+ | &lsquo;-- xml
| |-- rnc
| |-- rng
- | `-- xsd
+ | &lsquo;-- xsd
|-- sitemaps
|-- txt
|-- xhtml
- `-- xml
-</PRE>
-
-<P>
-<BR>
-
+ &lsquo;-- xml
+</pre>
+<p> <br>
#by: filetype subject_dir/html/filename/manifest.en.html
-<P>
-<A NAME="lbCW">&nbsp;</A>
-<H2>17.2.5 BY FILENAME</H2>
-
-<P>
-<BR>
+<p>
+<h2><a name='sect64' href='#toc64'>by Filename</a></h2>
-The by filename directory structure places most output of a particular file
-(the different filetypes) in a common directory.
-<P>
-<BR>
-
-Its selection is configured in sisurc.yml
-<P>
-<BR>
+<p> <br>
+The by filename directory structure places most output of a particular
+file (the different filetypes) in a common directory.
+<p> <br>
+<p>Its selection is configured in sisurc.yml
+<p> <br>
output_dir_structure_by: filename
-<P>
-<PRE>
- |-- epub
+<p> <br>
+<pre> |-- epub
|-- po4a
|-- live-manual
| |-- po
| |-- fr
- | `-- pot
+ | &lsquo;-- pot
|-- _sisu
| |-- css
| |-- image
| |-- image_sys -&gt; ../../_sisu/image_sys
- | `-- xml
+ | &lsquo;-- xml
| |-- rnc
| |-- rng
- | `-- xsd
+ | &lsquo;-- xsd
|-- sitemaps
|-- src
|-- pod
- `-- viral_spiral.david_bollier
-</PRE>
-
-<P>
-<BR>
-
+ &lsquo;-- viral_spiral.david_bollier
+</pre>
+<p> <br>
#by: filename subject_dir/filename/manifest.en.html
-<P>
-<A NAME="lbCX">&nbsp;</A>
-<H2>17.2.6 REMOTE DIRECTORIES</H2>
-
-<P>
-<PRE>
-./subject_name/
-% containing sub_directories named after the generated files from which they are made
+<p>
+<h2><a name='sect65' href='#toc65'>Remote Directories</a></h2>
+
+<p> <br>
+<pre>% containing sub_directories named after the generated files from which
+they are made
./subject_name/src
% contains shared source files text and binary e.g. sisu_manual.sst and sisu_manual.sst.zip
./subject_name/_sisu
@@ -4170,16 +2684,12 @@ output_dir_structure_by: filename
./subject_name/_sisu/image
% images for documents contained in this directory
./subject_name/_sisu/mm
-</PRE>
-
-<P>
-<A NAME="lbCY">&nbsp;</A>
-<H2>17.2.7 SISUPOD</H2>
+</pre>
+<p>
+<h2><a name='sect66' href='#toc66'>Sisupod</a></h2>
-<P>
-<PRE>
-./sisupod/
-% files stored at this level e.g. sisu_manual.sst
+<p> <br>
+<pre>% files stored at this level e.g. sisu_manual.sst
./sisupod/_sisu
% configuration file e.g. sisurc.yml
./sisupod/_sisu/skin
@@ -4188,528 +2698,460 @@ output_dir_structure_by: filename
./sisupod/_sisu/image
% images for documents contained in this directory
./sisupod/_sisu/mm
-</PRE>
-
-<P>
-<A NAME="lbCZ">&nbsp;</A>
-<H2>17.3 ORGANISING CONTENT</H2>
+</pre>
+<p>
+<h2><a name='sect67' href='#toc67'>Organising Content</a></h2>
-<P>
-<A NAME="lbDA">&nbsp;</A>
-<H2>18. HOMEPAGES</H2>
-
-<BR>
-
-<P>
-<BR>
-
-<B>SiSU</B>
-
-is about the ability to auto-generate documents. Home pages are regarded as
-custom built items, and are not created by
-<B>SiSU.</B>
-
-More accurately,
-<B>SiSU</B>
+<p>
+<h2><a name='sect68' href='#toc68'>Homepages</a></h2>
+<br>
+<p> <br>
+<b>SiSU</b> is about the ability to auto-generate documents. Home pages are regarded
+as custom built items, and are not created by <b>SiSU.</b> More accurately, <b>SiSU</b>
has a default home page, which will not be appropriate for use with other
-sites, and the means to provide your own home page instead in one of two ways
-as part of a site's configuration, these being:
-<P>
-<BR>
-
+sites, and the means to provide your own home page instead in one of two
+ways as part of a site&rsquo;s configuration, these being:
+<p> <br>
1. through placing your home page and other custom built documents in the
subdirectory _sisu/home/ (this probably being the easier and more convenient
option)
-<P>
-<BR>
-
+<p> <br>
2. through providing what you want as the home page in a skin,
-<P>
-<BR>
-
+<p> <br>
Document sets are contained in directories, usually organised by site or
-subject. Each directory can/should have its own homepage. See the section on
-directory structure and organisation of content.
-<P>
-<A NAME="lbDB">&nbsp;</A>
-<H2>18.1 HOME PAGE AND OTHER CUSTOM BUILT PAGES IN A SUB-DIRECTORY</H2>
-
-<P>
-<BR>
-
-Custom built pages, including the home page index.html may be placed within the
-configuration directory _sisu/home/ in any of the locations that is searched
-for the configuration directory, namely ./_sisu ; ~/_sisu ; /etc/sisu From
-there they are copied to the root of the output directory with the command:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;sisu&nbsp;-CC
-<P>
-<A NAME="lbDC">&nbsp;</A>
-<H2>18.2 HOME PAGE WITHIN A SKIN</H2>
-
-<P>
-<BR>
-
-Skins are described in a separate section, but basically are a file written in
-the programming language
-<B>Ruby</B>
-
-that may be provided to change the defaults that are provided with sisu with
-respect to individual documents, a directories contents or for a site.
-<P>
-<BR>
-
-If you wish to provide a homepage within a skin the skin should be in the
-directory _sisu/skin/dir and have the name of the directory for which it is to
-become the home page. Documents in the directory commercial_law would have the
-homepage modified in skin_commercial law.rb; or the directory poems in
-skin_poems.rb
-<P>
-<PRE>
- class Home
- def homepage
- # place the html content of your homepage here, this will become index.html
- &lt;&lt;HOME &lt;html&gt;
-&lt;head&gt;&lt;/head&gt;
-&lt;doc&gt;
-&lt;p&gt;this is my new homepage.&lt;/p&gt;
-&lt;/doc&gt;
-&lt;/html&gt;
-HOME
- end
- end
-</PRE>
-
-<P>
-<A NAME="lbDD">&nbsp;</A>
-<H2>19. MARKUP AND OUTPUT EXAMPLES</H2>
-
-<BR>
-
-<P>
-<A NAME="lbDE">&nbsp;</A>
-<H2>19.1 MARKUP EXAMPLES</H2>
-
-<P>
-<BR>
-
-Current markup examples and document output samples are provided at
-&lt;<A HREF="http://www.jus.uio.no/sisu/SiSU/examples.html">http://www.jus.uio.no/sisu/SiSU/examples.html</A>&gt;
-<P>
-<BR>
-
-For some documents hardly any markup at all is required at all, other than a
-header, and an indication that the levels to be taken into account by the
-program in generating its output are.
-<P>
-<A NAME="lbDF">&nbsp;</A>
-<H2>20. SISU SEARCH - INTRODUCTION</H2>
-
-<BR>
-
-<P>
-<BR>
-
-<B>SiSU</B>
-
-output can easily and conveniently be indexed by a number of standalone
+subject. Each directory can/should have its own homepage. See the section
+on directory structure and organisation of content.
+<p>
+<h2><a name='sect69' href='#toc69'>Home Page and Other
+Custom Built Pages in a Sub-directory</a></h2>
+
+<p> <br>
+Custom built pages, including the home page index.html may be placed within
+the configuration directory _sisu/home/ in any of the locations that is
+searched for the configuration directory, namely ./_sisu ; ~/_sisu ; /etc/sisu
+From there they are copied to the root of the output directory with the
+command:
+<p> <br>
+ sisu -CC<br>
+
+<p>
+<h2><a name='sect70' href='#toc70'>Markup and Output Examples</a></h2>
+<br>
+
+<p>
+<h2><a name='sect71' href='#toc71'>Markup Examples</a></h2>
+
+<p> <br>
+Current markup examples and document output samples are provided off &lt;<a href='http://sisudoc.org'>http://sisudoc.org</a>
+&gt;
+or &lt;<a href='http://www.jus.uio.no/sisu'>http://www.jus.uio.no/sisu</a>
+&gt; and in the sisu -markup-sample package available
+off &lt;<a href='http://sources.sisudoc.org'>http://sources.sisudoc.org</a>
+&gt;
+<p> <br>
+For some documents hardly any markup at all is required at all, other than
+a header, and an indication that the levels to be taken into account by
+the program in generating its output are.
+<p>
+<h2><a name='sect72' href='#toc72'>Sisu Markup Samples</a></h2>
+
+<p> <br>
+A few additional sample books prepared as sisu markup samples, output formats
+to be generated using <b>SiSU</b> are contained in a separate package sisu -markup-samples.
+sisu -markup-samples contains books (prepared using sisu markup), that were
+released by their authors various licenses mostly different Creative Commons
+licences that do not permit inclusion in the <b>Debian</b> Project as they have
+requirements that do not meet the <b>Debian</b> Free Software Guidelines for various
+reasons, most commonly that they require that the original substantive
+text remain unchanged, and sometimes that the works be used only non-commercially.
+
+<p> <br>
+<i>Accelerando,</i> Charles Stross (2005) accelerando.charles_stross.sst
+<p> <br>
+<i>Alice&rsquo;s</i> Adventures in Wonderland, Lewis Carroll (1865) alices_adventures_in_wonderland.lewis_carroll.sst
+
+<p> <br>
+<i>CONTENT,</i> Cory Doctorow (2008) content.cory_doctorow.sst
+<p> <br>
+<i>Democratizing</i> Innovation, Eric von Hippel (2005) democratizing_innovation.eric_von_hippel.sst
+
+<p> <br>
+<i>Down</i> and Out in the Magic Kingdom, Cory Doctorow (2003) down_and_out_in_the_magic_kingdom.cory_doctorow.sst
+
+<p> <br>
+<i>For</i> the Win, Cory Doctorow (2010) for_the_win.cory_doctorow.sst
+<p> <br>
+<i>Free</i> as in Freedom - Richard Stallman&rsquo;s Crusade for Free Software, Sam Williams
+(2002) free_as_in_freedom.richard_stallman_crusade_for_free_software.sam_williams.sst
+
+<p> <br>
+<i>Free</i> as in Freedom 2.0 - Richard Stallman and the Free Software Revolution,
+Sam Williams (2002), Richard M. Stallman (2010) free_as_in_freedom_2.richard_stallman_and_the_free_software_revolution.sam_williams.richard_stallman.sst
+
+<p> <br>
+<i>Free</i> Culture - How Big Media Uses Technology and the Law to Lock Down Culture
+and Control Creativity, Lawrence Lessig (2004) free_culture.lawrence_lessig.sst
+
+<p> <br>
+<i>Free</i> For All - How Linux and the Free Software Movement Undercut the High
+Tech Titans, Peter Wayner (2002) free_for_all.peter_wayner.sst
+<p> <br>
+<i>GNU</i> GENERAL PUBLIC LICENSE v2, Free Software Foundation (1991) gpl2.fsf.sst
+
+<p> <br>
+<i>GNU</i> GENERAL PUBLIC LICENSE v3, Free Software Foundation (2007) gpl3.fsf.sst
+
+<p> <br>
+<i>Gulliver&rsquo;s</i> Travels, Jonathan Swift (1726 / 1735) gullivers_travels.jonathan_swift.sst
+
+<p> <br>
+<i>Little</i> Brother, Cory Doctorow (2008) little_brother.cory_doctorow.sst
+<p> <br>
+<i>The</i> Cathederal and the Bazaar, Eric Raymond (2000) the_cathedral_and_the_bazaar.eric_s_raymond.sst
+
+<p> <br>
+<i>The</i> Public Domain - Enclosing the Commons of the Mind, James Boyle (2008)
+
+<p>the_public_domain.james_boyle.sst
+<p> <br>
+<i>The</i> Wealth of Networks - How Social Production Transforms Markets and Freedom,
+Yochai Benkler (2006) the_wealth_of_networks.yochai_benkler.sst
+<p> <br>
+<i>Through</i> the Looking Glass, Lewis Carroll (1871) through_the_looking_glass.lewis_carroll.sst
+
+<p> <br>
+<i>Two</i> Bits - The Cultural Significance of Free Software, Christopher Kelty
+(2008) two_bits.christopher_kelty.sst
+<p> <br>
+<i>UN</i> Contracts for International Sale of Goods, UN (1980) un_contracts_international_sale_of_goods_convention_1980.sst
+
+<p> <br>
+<i>Viral</i> Spiral, David Bollier (2008) viral_spiral.david_bollier.sst
+<p>
+<h2><a name='sect73' href='#toc73'>Sisu Search
+- Introduction</a></h2>
+<br>
+
+<p> <br>
+<b>SiSU</b> output can easily and conveniently be indexed by a number of standalone
indexing tools, such as Lucene, Hyperestraier.
-<P>
-<BR>
-
-Because the document structure of sites created is clearly defined, and the
-text object citation system is available hypothetically at least, for all forms
-of output, it is possible to search the sql database, and either read results
-from that database, or just as simply map the results to the html output, which
-has richer text markup.
-<P>
-<BR>
-
-In addition to this
-<B>SiSU</B>
-
-has the ability to populate a relational sql type database with documents at an
-object level, with objects numbers that are shared across different output
-types, which make them searchable with that degree of granularity. Basically,
-your match criteria is met by these documents and at these locations within
-each document, which can be viewed within the database directly or in various
-output formats.
-<P>
-<A NAME="lbDG">&nbsp;</A>
-<H2>21. SQL</H2>
-
-<BR>
-
-<P>
-<A NAME="lbDH">&nbsp;</A>
-<H2>21.1 POPULATING SQL TYPE DATABASES</H2>
-
-<P>
-<BR>
-
-<B>SiSU</B>
-
-feeds sisu markupd documents into sql type databases PostgreSQL[^20] and/or
-SQLite[^21] database together with information related to document structure.
-<P>
-<BR>
-
-This is one of the more interesting output forms, as all the structural data of
-the documents are retained (though can be ignored by the user of the database
-should they so choose). All site texts/documents are (currently) streamed to
-four tables:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;*&nbsp;one&nbsp;containing&nbsp;semantic&nbsp;(and&nbsp;other)&nbsp;headers,&nbsp;including,&nbsp;title,&nbsp;author,
-<BR>&nbsp;&nbsp;subject,&nbsp;(the&nbsp;Dublin&nbsp;Core...);
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;*&nbsp;another&nbsp;the&nbsp;substantive&nbsp;texts&nbsp;by&nbsp;individual&nbsp;&quot;paragraph&quot;&nbsp;(or&nbsp;object)&nbsp;-
-<BR>&nbsp;&nbsp;along&nbsp;with&nbsp;structural&nbsp;information,&nbsp;each&nbsp;paragraph&nbsp;being&nbsp;identifiable&nbsp;by&nbsp;its
-<BR>&nbsp;&nbsp;paragraph&nbsp;number&nbsp;(if&nbsp;it&nbsp;has&nbsp;one&nbsp;which&nbsp;almost&nbsp;all&nbsp;of&nbsp;them&nbsp;do),&nbsp;and&nbsp;the
-<BR>&nbsp;&nbsp;substantive&nbsp;text&nbsp;of&nbsp;each&nbsp;paragraph&nbsp;quite&nbsp;naturally&nbsp;being&nbsp;searchable&nbsp;(both&nbsp;in
-<BR>&nbsp;&nbsp;formatted&nbsp;and&nbsp;clean&nbsp;text&nbsp;versions&nbsp;for&nbsp;searching);&nbsp;and
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;*&nbsp;a&nbsp;third&nbsp;containing&nbsp;endnotes&nbsp;cross-referenced&nbsp;back&nbsp;to&nbsp;the&nbsp;paragraph&nbsp;from
-<BR>&nbsp;&nbsp;which&nbsp;they&nbsp;are&nbsp;referenced&nbsp;(both&nbsp;in&nbsp;formatted&nbsp;and&nbsp;clean&nbsp;text&nbsp;versions&nbsp;for
-<BR>&nbsp;&nbsp;searching).
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;*&nbsp;a&nbsp;fourth&nbsp;table&nbsp;with&nbsp;a&nbsp;one&nbsp;to&nbsp;one&nbsp;relation&nbsp;with&nbsp;the&nbsp;headers&nbsp;table&nbsp;contains
-<BR>&nbsp;&nbsp;full&nbsp;text&nbsp;versions&nbsp;of&nbsp;output,&nbsp;eg.&nbsp;pdf,&nbsp;html,&nbsp;xml,&nbsp;and&nbsp;ascii.
-<P>
-<BR>
-
+<p> <br>
+Because the document structure of sites created is clearly defined, and
+the text <i>object</i> citation system is available hypothetically at least, for
+all forms of output, it is possible to search the sql database, and either
+read results from that database, or just as simply map the results to the
+html output, which has richer text markup.
+<p> <br>
+In addition to this <b>SiSU</b> has the ability to populate a relational sql type
+database with documents at an object level, with objects numbers that are
+shared across different output types, which make them searchable with that
+degree of granularity. Basically, your match criteria is met by these documents
+and at these locations within each document, which can be viewed within
+the database directly or in various output formats.
+<p>
+<h2><a name='sect74' href='#toc74'>Sql</a></h2>
+<br>
+
+<p>
+<h2><a name='sect75' href='#toc75'>Populating Sql Type Databases</a></h2>
+
+<p> <br>
+<b>SiSU</b> feeds sisu markupd documents into sql type databases <i>PostgreSQL</i> [^21]
+and/or <i>SQLite</i> [^22] database together with information related to document
+structure.
+<p> <br>
+This is one of the more interesting output forms, as all the structural
+data of the documents are retained (though can be ignored by the user of
+the database should they so choose). All site texts/documents are (currently)
+streamed to four tables:
+<p> <br>
+ * one containing semantic (and other) headers, including, title, author,<br>
+ subject, (the<br>
+ .I Dublin Core.<br>
+ ..);<br>
+
+<p> <br>
+ * another the substantive texts by individual "paragraph" (or object)
+-<br>
+ along with structural information, each paragraph being identifiable
+by its<br>
+ paragraph number (if it has one which almost all of them do), and the<br>
+ substantive text of each paragraph quite naturally being searchable
+(both in<br>
+ formatted and clean text versions for searching); and<br>
+
+<p> <br>
+ * a third containing endnotes cross-referenced back to the paragraph from<br>
+ which they are referenced (both in formatted and clean text versions
+for<br>
+ searching).<br>
+
+<p> <br>
+ * a fourth table with a one to one relation with the headers table contains<br>
+ full text versions of output, eg. pdf, html, xml, and<br>
+ .I ascii.<br>
+
+<p> <br>
There is of course the possibility to add further structures.
-<P>
-<BR>
-
-At this level
-<B>SiSU</B>
-
-loads a relational database with documents chunked into objects, their smallest
-logical structurally constituent parts, as text objects, with their object
-citation number and all other structural information needed to construct the
-document. Text is stored (at this text object level) with and without
-elementary markup tagging, the stripped version being so as to facilitate ease
-of searching.
-<P>
-<BR>
-
+<p> <br>
+At this level <b>SiSU</b> loads a relational database with documents chunked into
+objects, their smallest logical structurally constituent parts, as text
+objects, with their object citation number and all other structural information
+needed to construct the document. Text is stored (at this text object level)
+with and without elementary markup tagging, the stripped version being
+so as to facilitate ease of searching.
+<p> <br>
Being able to search a relational database at an object level with the
-<B>SiSU</B>
-
-citation system is an effective way of locating content generated by
-<B>SiSU.</B>
-
-As individual text objects of a document stored (and indexed) together with
-object numbers, and all versions of the document have the same numbering,
+<b>SiSU</b> citation system is an effective way of locating content generated
+by <b>SiSU.</b> As individual text objects of a document stored (and indexed) together
+with object numbers, and all versions of the document have the same numbering,
complex searches can be tailored to return just the locations of the search
results relevant for all available output formats, with live links to the
precise locations in the database or in html/xml documents; or, the structural
information provided makes it possible to search the full contents of the
-database and have headings in which search content appears, or to search only
-headings etc. (as the Dublin Core is incorporated it is easy to make use of
-that as well).
-<P>
-<A NAME="lbDI">&nbsp;</A>
-<H2>22. POSTGRESQL</H2>
-
-<BR>
-
-<P>
-<A NAME="lbDJ">&nbsp;</A>
-<H2>22.1 NAME</H2>
-
-<P>
-<BR>
-
-<B>SiSU</B>
-
-- Structured information, Serialized Units - a document publishing system,
-postgresql dependency package
-<P>
-<A NAME="lbDK">&nbsp;</A>
-<H2>22.2 DESCRIPTION</H2>
-
-<P>
-<BR>
-
-Information related to using postgresql with sisu (and related to the
-sisu_postgresql dependency package, which is a dummy package to install
-dependencies needed for
-<B>SiSU</B>
-
-to populate a postgresql database, this being part of
-<B>SiSU</B>
-
-- man sisu).
-<P>
-<A NAME="lbDL">&nbsp;</A>
-<H2>22.3 SYNOPSIS</H2>
-
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;sisu&nbsp;-D&nbsp;[instruction]&nbsp;[filename/wildcard&nbsp;&nbsp;if&nbsp;&nbsp;required]
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;sisu&nbsp;-D&nbsp;--pg&nbsp;--[instruction]&nbsp;[filename/wildcard&nbsp;&nbsp;if&nbsp;&nbsp;required]
-<P>
-<A NAME="lbDM">&nbsp;</A>
-<H2>22.4 COMMANDS</H2>
-
-<P>
-<BR>
-
-Mappings to two databases are provided by default, postgresql and sqlite, the
-same commands are used within sisu to construct and populate databases however
--d (lowercase) denotes sqlite and -D (uppercase) denotes postgresql,
-alternatively --sqlite or --pgsql may be used
-<P>
-<BR>
-
-<B>-D or --pgsql</B>
-
-may be used interchangeably.
-<P>
-<A NAME="lbDN">&nbsp;</A>
-<H2>22.4.1 CREATE AND DESTROY DATABASE</H2>
-
-<P>
-<DL COMPACT>
-<DT><B>--pgsql --createall</B>
-
-<DD>
-initial step, creates required relations (tables, indexes) in existing
-(postgresql) database (a database should be created manually and given the same
-name as working directory, as requested) (rb.dbi)
-<P>
-<DT><B>sisu -D --createdb</B>
-
-<DD>
-creates database where no database existed before
-<P>
-<DT><B>sisu -D --create</B>
-
-<DD>
-creates database tables where no database tables existed before
-<P>
-<DT><B>sisu -D --Dropall</B>
-
-<DD>
-destroys database (including all its content)! kills data and drops tables,
-indexes and database associated with a given directory (and directories of the
-same name).
-<P>
-<DT><B>sisu -D --recreate</B>
-
-<DD>
-destroys existing database and builds a new empty database structure
-<P>
-</DL>
-<A NAME="lbDO">&nbsp;</A>
-<H2>22.4.2 IMPORT AND REMOVE DOCUMENTS</H2>
-
-<P>
-<DL COMPACT>
-<DT><B>sisu -D --import -v [filename/wildcard]</B>
-
-<DD>
-populates database with the contents of the file. Imports documents(s)
-specified to a postgresql database (at an object level).
-<P>
-<DT><B>sisu -D --update -v [filename/wildcard]</B>
-
-<DD>
-updates file contents in database
-<P>
-<DT><B>sisu -D --remove -v [filename/wildcard]</B>
-
-<DD>
-removes specified document from postgresql database.
-<P>
-</DL>
-<A NAME="lbDP">&nbsp;</A>
-<H2>23. SQLITE</H2>
-
-<BR>
-
-<P>
-<A NAME="lbDQ">&nbsp;</A>
-<H2>23.1 NAME</H2>
-
-<P>
-<BR>
-
-<B>SiSU</B>
-
-- Structured information, Serialized Units - a document publishing system.
-<P>
-<A NAME="lbDR">&nbsp;</A>
-<H2>23.2 DESCRIPTION</H2>
-
-<P>
-<BR>
+database and have headings in which search content appears, or to search
+only headings etc. (as the <i>Dublin</i> Core is incorporated it is easy to make
+use of that as well).
+<p>
+<h2><a name='sect76' href='#toc76'>Postgresql</a></h2>
+<br>
+
+<p>
+<h2><a name='sect77' href='#toc77'>Name</a></h2>
+
+<p> <br>
+<b>SiSU</b> - Structured information, Serialized Units - a document publishing system,
+
+<p>postgresql dependency package
+<p>
+<h2><a name='sect78' href='#toc78'>Description</a></h2>
+
+<p> <br>
+Information related to using postgresql with sisu (and related to the sisu_postgresql
+dependency package, which is a dummy package to install dependencies needed
+for <b>SiSU</b> to populate a postgresql database, this being part of <b>SiSU</b> - man
+sisu) .
+<p>
+<h2><a name='sect79' href='#toc79'>Synopsis</a></h2>
+
+<p> <br>
+ sisu -D [instruction] [filename/wildcard &nbsp;if &nbsp;required]<br>
+
+<p> <br>
+ sisu -D --pg --[instruction] [filename/wildcard &nbsp;if &nbsp;required]<br>
+
+<p>
+<h2><a name='sect80' href='#toc80'>Commands</a></h2>
+
+<p> <br>
+Mappings to two databases are provided by default, postgresql and sqlite,
+the same commands are used within sisu to construct and populate databases
+however -d (lowercase) denotes sqlite and -D (uppercase) denotes postgresql,
+
+<p>alternatively --sqlite or --pgsql may be used
+<p> <br>
+<b>-D or --pgsql</b> may be used interchangeably.
+<p>
+<h2><a name='sect81' href='#toc81'>Create and Destroy Database</a></h2>
+
+<p>
+<dl>
+
+<dt><b>--pgsql
+--createall</b> </dt>
+<dd>initial step, creates required relations (tables, indexes) in
+existing (postgresql) database (a database should be created manually and
+given the same name as working directory, as requested) (rb.dbi)
+<p> </dd>
+
+<dt><b>sisu -D
+--createdb</b> </dt>
+<dd>creates database where no database existed before
+<p> </dd>
+
+<dt><b>sisu -D --create</b>
+</dt>
+<dd>
+<p>creates database tables where no database tables existed before
+<p> </dd>
+
+<dt><b>sisu -D
+--Dropall</b> </dt>
+<dd>destroys database (including all its content)! kills data and drops
+tables, indexes and database associated with a given directory (and directories
+of the same name).
+<p> </dd>
+
+<dt><b>sisu -D --recreate</b> </dt>
+<dd>destroys existing database and builds
+
+<p>a new empty database structure
+<p> </dd>
+</dl>
+
+<h2><a name='sect82' href='#toc82'>Import and Remove Documents</a></h2>
+
+<p>
+<dl>
+
+<dt><b>sisu -D --import
+-v [filename/wildcard]</b> </dt>
+<dd>populates database with the contents of the file.
+Imports documents(s) specified to a postgresql database (at an object level).
+
+<p> </dd>
+
+<dt><b>sisu -D --update -v [filename/wildcard]</b> </dt>
+<dd>updates file contents in database
+
+<p> </dd>
+
+<dt><b>sisu -D --remove -v [filename/wildcard]</b> </dt>
+<dd>removes specified document from postgresql
+database.
+<p> </dd>
+</dl>
-Information related to using sqlite with sisu (and related to the sisu_sqlite
-dependency package, which is a dummy package to install dependencies needed for
-<B>SiSU</B>
-
-to populate an sqlite database, this being part of
-<B>SiSU</B>
-
-- man sisu).
-<P>
-<A NAME="lbDS">&nbsp;</A>
-<H2>23.3 SYNOPSIS</H2>
-
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;sisu&nbsp;-d&nbsp;[instruction]&nbsp;[filename/wildcard&nbsp;&nbsp;if&nbsp;&nbsp;required]
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;sisu&nbsp;-d&nbsp;--(sqlite|pg)&nbsp;--[instruction]&nbsp;[filename/wildcard&nbsp;&nbsp;if&nbsp;&nbsp;&nbsp;required]
-<P>
-<A NAME="lbDT">&nbsp;</A>
-<H2>23.4 COMMANDS</H2>
-
-<P>
-<BR>
-
-Mappings to two databases are provided by default, postgresql and sqlite, the
-same commands are used within sisu to construct and populate databases however
--d (lowercase) denotes sqlite and -D (uppercase) denotes postgresql,
-alternatively --sqlite or --pgsql may be used
-<P>
-<BR>
-
-<B>-d or --sqlite</B>
-
-may be used interchangeably.
-<P>
-<A NAME="lbDU">&nbsp;</A>
-<H2>23.4.1 CREATE AND DESTROY DATABASE</H2>
-
-<P>
-<DL COMPACT>
-<DT><B>--sqlite --createall</B>
-
-<DD>
-initial step, creates required relations (tables, indexes) in existing (sqlite)
-database (a database should be created manually and given the same name as
-working directory, as requested) (rb.dbi)
-<P>
-<DT><B>sisu -d --createdb</B>
-
-<DD>
-creates database where no database existed before
-<P>
-<DT><B>sisu -d --create</B>
-
-<DD>
-creates database tables where no database tables existed before
-<P>
-<DT><B>sisu -d --dropall</B>
-
-<DD>
-destroys database (including all its content)! kills data and drops tables,
-indexes and database associated with a given directory (and directories of the
-same name).
-<P>
-<DT><B>sisu -d --recreate</B>
-
-<DD>
-destroys existing database and builds a new empty database structure
-<P>
-</DL>
-<A NAME="lbDV">&nbsp;</A>
-<H2>23.4.2 IMPORT AND REMOVE DOCUMENTS</H2>
-
-<P>
-<DL COMPACT>
-<DT><B>sisu -d --import -v [filename/wildcard]</B>
-
-<DD>
-populates database with the contents of the file. Imports documents(s)
-specified to an sqlite database (at an object level).
-<P>
-<DT><B>sisu -d --update -v [filename/wildcard]</B>
-
-<DD>
-updates file contents in database
-<P>
-<DT><B>sisu -d --remove -v [filename/wildcard]</B>
-
-<DD>
-removes specified document from sqlite database.
-<P>
-</DL>
-<A NAME="lbDW">&nbsp;</A>
-<H2>24. INTRODUCTION</H2>
-
-<BR>
-
-<P>
-<A NAME="lbDX">&nbsp;</A>
-<H2>24.1 SEARCH - DATABASE FRONTEND SAMPLE, UTILISING DATABASE AND SISU FEATURES,</H2>
-
-INCLUDING OBJECT CITATION NUMBERING (BACKEND CURRENTLY POSTGRESQL)
-<P>
-<BR>
-
-Sample search frontend &lt;<A HREF="http://search.sisudoc.org">http://search.sisudoc.org</A>&gt; [^22] A small database and
-sample query front-end (search from) that makes use of the citation system,
-<I>object citation numbering</I>
+<h2><a name='sect83' href='#toc83'>Sqlite</a></h2>
+<br>
-to demonstrates functionality.[^23]
-<P>
-<BR>
+<p>
+<h2><a name='sect84' href='#toc84'>Name</a></h2>
-<B>SiSU</B>
+<p> <br>
+<b>SiSU</b> - Structured information, Serialized Units - a document publishing system.
-can provide information on which documents are matched and at what locations
-within each document the matches are found. These results are relevant across
-all outputs using object citation numbering, which includes html, XML, EPUB,
-LaTeX, PDF and indeed the SQL database. You can then refer to one of the other
-outputs or in the SQL database expand the text within the matched objects
-(paragraphs) in the documents matched.
-<P>
-<BR>
+<p>
+<h2><a name='sect85' href='#toc85'>Description</a></h2>
+<p> <br>
+Information related to using sqlite with sisu (and related to the sisu_sqlite
+dependency package, which is a dummy package to install dependencies needed
+for <b>SiSU</b> to populate an sqlite database, this being part of <b>SiSU</b> - man sisu)
+.
+<p>
+<h2><a name='sect86' href='#toc86'>Synopsis</a></h2>
+
+<p> <br>
+ sisu -d [instruction] [filename/wildcard &nbsp;if &nbsp;required]<br>
+
+<p> <br>
+ sisu -d --(sqlite|pg) --[instruction] [filename/wildcard &nbsp;if <br>
+ required]<br>
+
+<p>
+<h2><a name='sect87' href='#toc87'>Commands</a></h2>
+
+<p> <br>
+Mappings to two databases are provided by default, postgresql and sqlite,
+the same commands are used within sisu to construct and populate databases
+however -d (lowercase) denotes sqlite and -D (uppercase) denotes postgresql,
+
+<p>alternatively --sqlite or --pgsql may be used
+<p> <br>
+<b>-d or --sqlite</b> may be used interchangeably.
+<p>
+<h2><a name='sect88' href='#toc88'>Create and Destroy Database</a></h2>
+
+<p>
+<dl>
+
+<dt><b>--sqlite
+--createall</b> </dt>
+<dd>initial step, creates required relations (tables, indexes) in
+existing (sqlite) database (a database should be created manually and given
+the same name as working directory, as requested) (rb.dbi)
+<p> </dd>
+
+<dt><b>sisu -d --createdb</b>
+</dt>
+<dd>
+<p>creates database where no database existed before
+<p> </dd>
+
+<dt><b>sisu -d --create</b> </dt>
+<dd>creates
+
+<p>database tables where no database tables existed before
+<p> </dd>
+
+<dt><b>sisu -d --dropall</b>
+</dt>
+<dd>destroys database (including all its content)! kills data and drops tables,
+indexes and database associated with a given directory (and directories
+of the same name).
+<p> </dd>
+
+<dt><b>sisu -d --recreate</b> </dt>
+<dd>destroys existing database and builds
+
+<p>a new empty database structure
+<p> </dd>
+</dl>
+
+<h2><a name='sect89' href='#toc89'>Import and Remove Documents</a></h2>
+
+<p>
+<dl>
+
+<dt><b>sisu -d --import
+-v [filename/wildcard]</b> </dt>
+<dd>populates database with the contents of the file.
+Imports documents(s) specified to an sqlite database (at an object level).
+
+<p> </dd>
+
+<dt><b>sisu -d --update -v [filename/wildcard]</b> </dt>
+<dd>updates file contents in database
+
+<p> </dd>
+
+<dt><b>sisu -d --remove -v [filename/wildcard]</b> </dt>
+<dd>removes specified document from sqlite
+database.
+<p> </dd>
+</dl>
+
+<h2><a name='sect90' href='#toc90'>Introduction</a></h2>
+<br>
+
+<p>
+<h2><a name='sect91' href='#toc91'>Search - Database Frontend Sample, Utilising Database and Sisu Features,</a></h2>
+INCLUDING
+OBJECT CITATION NUMBERING (BACKEND CURRENTLY POSTGRESQL)
+<p> <br>
+Sample search frontend &lt;<a href='http://search.sisudoc.org'>http://search.sisudoc.org</a>
+&gt; [^23] A small database and
+sample query front-end (search from) that makes use of the citation system,
+<i>object</i> citation numbering to demonstrates functionality.[^24]
+<p> <br>
+<b>SiSU</b> can provide information on which documents are matched and at what
+locations within each document the matches are found. These results are
+relevant across all outputs using <i>object</i> citation numbering, which includes
+html, <i>XML,</i> <i>EPUB,</i> <i>LaTeX,</i> <i>PDF</i> and indeed the <i>SQL</i> database. You can then refer
+to one of the other outputs or in the <i>SQL</i> database expand the text within
+the matched objects (paragraphs) in the documents matched.
+<p> <br>
Note you may set results either for documents matched and object number
-locations within each matched document meeting the search criteria; or display
-the names of the documents matched along with the objects (paragraphs) that
-meet the search criteria.[^24]
-<P>
-<DL COMPACT>
-<DT><B>sisu -F --webserv-webrick</B>
-
-<DD>
-builds a cgi web search frontend for the database created
-<P>
-<BR>
+locations within each matched document meeting the search criteria; or
+display the names of the documents matched along with the objects (paragraphs)
+that meet the search criteria.[^25]
+<p>
+<dl>
+<dt><b>sisu -F --webserv-webrick</b> </dt>
+<dd>builds a cgi web
+
+<p>search frontend for the database created
+<p> <br>
The following is feedback on the setup on a machine provided by the help
command:
-<P>
-<BR>
+<p> <br>
+ sisu --help sql<br>
-<BR>&nbsp;&nbsp;sisu&nbsp;--help&nbsp;sql
-<P>
-<PRE>
-Postgresql
+<p> <br>
+<pre>Postgresql
user: ralph
current db set: SiSU_sisu
port: 5432
@@ -4717,1937 +3159,535 @@ Postgresql
sqlite
current db set: /home/ralph/sisu_www/sisu/sisu_sqlite.db
dbi connect DBI:SQLite:/home/ralph/sisu_www/sisu/sisu_sqlite.db
-</PRE>
-
-<P>
-<BR>
-
-Note on databases built
-<P>
-<BR>
+</pre>
+<p> <br>
+<p>Note on databases built
+<p> <br>
By default, [unless &nbsp;otherwise &nbsp;specified] databases are built on a directory
-basis, from collections of documents within that directory. The name of the
-directory you choose to work from is used as the database name, i.e. if you are
-working in a directory called /home/ralph/ebook the database SiSU_ebook is
-used. [otherwise &nbsp;a &nbsp;manual &nbsp;mapping &nbsp;for &nbsp;the &nbsp;collection &nbsp;is necessary]
-<P>
-</DL>
-<A NAME="lbDY">&nbsp;</A>
-<H2>24.2 SEARCH FORM</H2>
-
-<P>
-<DL COMPACT>
-<DT><B>sisu -F</B>
-
-<DD>
-generates a sample search form, which must be copied to the web-server cgi
-directory
-<P>
-<DT><B>sisu -F --webserv-webrick</B>
-
-<DD>
-generates a sample search form for use with the webrick server, which must be
-copied to the web-server cgi directory
-<P>
-<DT><B>sisu -Fv</B>
-
-<DD>
-as above, and provides some information on setting up hyperestraier
-<P>
-<DT><B>sisu -W</B>
-
-<DD>
-starts the webrick server which should be available wherever sisu is properly
-installed
-<P>
-<BR>
-
-The generated search form must be copied manually to the webserver directory as
-instructed
-<P>
-</DL>
-<A NAME="lbDZ">&nbsp;</A>
-<H2>25. SISU_WEBRICK</H2>
-
-<BR>
-
-<P>
-<A NAME="lbEA">&nbsp;</A>
-<H2>25.1 NAME</H2>
-
-<P>
-<BR>
-
-<B>SiSU</B>
-
-- Structured information, Serialized Units - a document publishing system
-<P>
-<A NAME="lbEB">&nbsp;</A>
-<H2>25.2 SYNOPSIS</H2>
-
-<P>
-<BR>
-
-sisu_webrick [port]
-<P>
-<BR>
-
-or
-<P>
-<BR>
-
-sisu -W [port]
-<P>
-<A NAME="lbEC">&nbsp;</A>
-<H2>25.3 DESCRIPTION</H2>
-
-<P>
-<BR>
-
-sisu_webrick is part of
-<B>SiSU</B>
-
-(man sisu) sisu_webrick starts
-<B>Ruby</B>
-
-
-<B>SiSU</B>
-
-output is written, providing a list of these directories (assuming
-<B>SiSU</B>
-
-is in use and they exist).
-<P>
-<BR>
-
-The default port for sisu_webrick is set to 8081, this may be modified in the
-yaml file: ~/.sisu/sisurc.yml a sample of which is provided as
-/etc/sisu/sisurc.yml (or in the equivalent directory on your system).
-<P>
-<A NAME="lbED">&nbsp;</A>
-<H2>25.4 SUMMARY OF MAN PAGE</H2>
-
-<P>
-<BR>
-
-sisu_webrick, may be started on it's own with the command: sisu_webrick [port]
-or using the sisu command with the -W flag: sisu -W [port]
-<P>
-<BR>
-
-where no port is given and settings are unchanged the default port is 8081
-<P>
-<A NAME="lbEE">&nbsp;</A>
-<H2>25.5 DOCUMENT PROCESSING COMMAND FLAGS</H2>
-
-<P>
-<BR>
-
-sisu -W [port] starts
-<B>Ruby</B>
-
-Webrick web-server, serving
-<B>SiSU</B>
-
-output directories, on the port provided, or if no port is provided and the
-defaults have not been changed in ~/.sisu/sisurc.yaml then on port 8081
-<P>
-<A NAME="lbEF">&nbsp;</A>
-<H2>25.6 FURTHER INFORMATION</H2>
+basis, from collections of documents within that directory. The name of
+the directory you choose to work from is used as the database name, i.e.
+if you are working in a directory called /home/ralph/ebook the database
+SiSU_ebook is used. [otherwise &nbsp;a &nbsp;manual &nbsp;mapping &nbsp;for &nbsp;the &nbsp;collection &nbsp;is
+<p> </dd>
+</dl>
-<P>
-<BR>
+<h2><a name='sect92' href='#toc92'>Search
+Form</a></h2>
-For more information on
-<B>SiSU</B>
+<p>
+<dl>
-see: &lt;<A HREF="http://www.sisudoc.org/">http://www.sisudoc.org/</A>&gt; or &lt;<A HREF="http://www.jus.uio.no/sisu">http://www.jus.uio.no/sisu</A>&gt;
-<P>
-<BR>
+<dt><b>sisu -F</b> </dt>
+<dd>generates a sample search form, which must be copied to the
-or man sisu
-<P>
-<A NAME="lbEG">&nbsp;</A>
-<H2>25.7 AUTHOR</H2>
+<p>web-server cgi directory
+<p> </dd>
-<P>
-<BR>
+<dt><b>sisu -F --webserv-webrick</b> </dt>
+<dd>generates a sample search
+form for use with the webrick server, which must be copied to the web-server
-Ralph Amissah &lt;<A HREF="mailto:ralph@amissah.com">ralph@amissah.com</A>&gt; or &lt;<A HREF="mailto:ralph.amissah@gmail.com">ralph.amissah@gmail.com</A>&gt;
-<P>
-<A NAME="lbEH">&nbsp;</A>
-<H2>25.8 SEE ALSO</H2>
+<p>cgi directory
+<p> </dd>
-<P>
-<BR>
+<dt><b>sisu -W</b> </dt>
+<dd>starts the webrick server which should be available
-<BR>&nbsp;&nbsp;<A HREF="/cgi-bin/man/man2html?1+sisu">sisu</A>(1)
-<P>
-<BR>
+<p>wherever sisu is properly installed
+<p> <br>
-<BR>&nbsp;&nbsp;<A HREF="/cgi-bin/man/man2html?7+sisu_vim">sisu_vim</A>(7)
-<P>
-<A NAME="lbEI">&nbsp;</A>
-<H2>26. REMOTE SOURCE DOCUMENTS</H2>
+<p>The generated search form must be copied manually to the webserver directory
-<BR>
+<p>as instructed
+<p> </dd>
+</dl>
-<P>
-<BR>
+<h2><a name='sect93' href='#toc93'>Sisu_webrick</a></h2>
+<br>
-<B>SiSU</B>
+<p>
+<h2><a name='sect94' href='#toc94'>Name</a></h2>
-processing instructions can be run against remote source documents by providing
-the url of the documents against which the processing instructions are to be
-carried out. The remote
-<B>SiSU</B>
+<p> <br>
+<b>SiSU</b> - Structured information, Serialized Units - a document publishing system
-documents can either be sisu marked up files in plaintext .sst or .ssm or;
-zipped sisu files, sisupod.zip or filename.ssp
-<P>
-<BR>
+<p>
+<h2><a name='sect95' href='#toc95'>Synopsis</a></h2>
-<B>.sst / .ssm - sisu text files</B>
-
-<P>
-<BR>
-
-<B>SiSU</B>
-
-can be run against source text files on a remote machine, provide the
-processing instruction and the url. The source file and any associated parts
-(such as images) will be downloaded and generated locally.
-<P>
-<PRE>
-sisu -3 <A HREF="http://[provide">http://[provide</A> &nbsp;url &nbsp;to &nbsp;valid &nbsp;.sst &nbsp;or &nbsp;.ssm &nbsp;file]
-</PRE>
-
-<P>
-<BR>
-
-Any of the source documents in the sisu examples page can be used in this way,
-see &lt;<A HREF="http://www.jus.uio.no/sisu/SiSU/examples.html">http://www.jus.uio.no/sisu/SiSU/examples.html</A>&gt; and use the url to the
-<BR>&nbsp;.sst&nbsp;for&nbsp;the&nbsp;desired&nbsp;document.
-<P>
-<BR>
-
-NOTE: to set up a remote machine to serve
-<B>SiSU</B>
-
-documents in this way, images should be in the directory relative to the
-document source ../_sisu/image
-<P>
-<BR>
-
-<B>sisupod - zipped sisu files</B>
-
-<P>
-<BR>
-
-A sisupod is the zipped content of a sisu marked up text or texts and any other
-associated parts to the document such as images.
-<P>
-<BR>
-
-<B>SiSU</B>
-
-can be run against a sisupod on a (local or) remote machine, provide the
-processing instruction and the url, the sisupod will be downloaded and the
-documents it contains generated locally.
-<P>
-<PRE>
-sisu -3 <A HREF="http://[provide">http://[provide</A> &nbsp;url &nbsp;to &nbsp;valid &nbsp;sisupod.zip &nbsp;or &nbsp;.ssp &nbsp;file]
-</PRE>
-
-<P>
-<BR>
-
-Any of the source documents in the sisu examples page can be used in this way,
-see &lt;<A HREF="http://www.jus.uio.no/sisu/SiSU/examples.html">http://www.jus.uio.no/sisu/SiSU/examples.html</A>&gt; and use the url for the
-desired document.
-<P>
-<A NAME="lbEJ">&nbsp;</A>
-<H2>REMOTE DOCUMENT OUTPUT</H2>
-
-<BR>
-
-<P>
-<A NAME="lbEK">&nbsp;</A>
-<H2>27. REMOTE OUTPUT</H2>
-
-<BR>
-
-<P>
-<BR>
-
-Once properly configured
-<B>SiSU</B>
-
-output can be automatically posted once generated to a designated remote
-machine using either rsync, or scp.
-<P>
-<BR>
-
-In order to do this some ssh authentication agent and keychain or similar tool
-will need to be configured. Once that is done the placement on a remote host
-can be done seamlessly with the -r (for scp) or -R (for rsync) flag, which
-may be used in conjunction with other processing flags, e.g.
-<P>
-<PRE>
-sisu -3R sisu_remote.sst
-</PRE>
-
-<P>
-<A NAME="lbEL">&nbsp;</A>
-<H2>27.1 COMMANDS</H2>
-
-<P>
-<DL COMPACT>
-<DT><B>-R [filename/wildcard]</B>
-
-<DD>
-copies sisu output files to remote host using rsync. This requires that
-sisurc.yml has been provided with information on hostname and username, and
-that you have your &quot;keys&quot; and ssh agent in place. Note the behavior of rsync
-different if -R is used with other flags from if used alone. Alone the rsync
---delete parameter is sent, useful for cleaning the remote directory (when
--R is used together with other flags, it is not). Also see -r
-<P>
-<DT><B>-r [filename/wildcard]</B>
-
-<DD>
-copies sisu output files to remote host using scp. This requires that
-sisurc.yml has been provided with information on hostname and username, and
-that you have your &quot;keys&quot; and ssh agent in place. Also see -R
-<P>
-</DL>
-<A NAME="lbEM">&nbsp;</A>
-<H2>27.2 CONFIGURATION</H2>
-
-<P>
-<BR>
-
-[expand &nbsp;on &nbsp;the &nbsp;setting &nbsp;up &nbsp;of &nbsp;an &nbsp;ssh-agent &nbsp;/ &nbsp;keychain]
-<P>
-<A NAME="lbEN">&nbsp;</A>
-<H2>28. REMOTE SERVERS</H2>
-
-<BR>
-
-<P>
-<BR>
-
-As
-<B>SiSU</B>
-
-is generally operated using the command line, and works within a Unix type
-environment,
-<B>SiSU</B>
-
-the program and all documents can just as easily be on a remote server, to
-which you are logged on using a terminal, and commands and operations would be
-pretty much the same as they would be on your local machine.
-<P>
-<A NAME="lbEO">&nbsp;</A>
-<H2>29. QUICKSTART - GETTING STARTED HOWTO</H2>
-
-<BR>
-
-<P>
-<A NAME="lbEP">&nbsp;</A>
-<H2>29.1 INSTALLATION</H2>
-
-<P>
-<BR>
-
-Installation is currently most straightforward and tested on the
-<B>Debian</B>
-
-platform, as there are packages for the installation of sisu and all
-requirements for what it does.
-<P>
-<A NAME="lbEQ">&nbsp;</A>
-<H2>29.1.1 DEBIAN INSTALLATION</H2>
-
-<P>
-<BR>
-
-<B>SiSU</B>
-
-is available directly from the
-<B>Debian</B>
-
-Sid and testing archives (and possibly Ubuntu), assuming your
-/etc/apt/sources.list is set accordingly:
-<P>
-<PRE>
- aptitude update
- aptitude install sisu-complete
-</PRE>
-
-<P>
-<BR>
-
-The following /etc/apt/sources.list setting permits the download of additional
-markup samples:
-<P>
-<PRE>
- #/etc/apt/sources.list
-<BR>
- deb <A HREF="http://ftp.fi.debian.org/debian/">http://ftp.fi.debian.org/debian/</A> unstable main non-free contrib
-<BR>
- deb-src <A HREF="http://ftp.fi.debian.org/debian/">http://ftp.fi.debian.org/debian/</A> unstable main non-free contrib
-<BR>
-
-</PRE>
-
-<P>
-<BR>
-
-The aptitude commands become:
-<P>
-<PRE>
- aptitude update
-<BR>
- aptitude install sisu-complete sisu-markup-samples
-</PRE>
-
-<P>
-<BR>
-
-If there are newer versions of
-<B>SiSU</B>
-
-upstream of the
-<B>Debian</B>
-
-archives, they will be available by adding the following to your
-/etc/apt/sources.list
-<P>
-<PRE>
-#/etc/apt/sources.list
- deb <A HREF="http://www.jus.uio.no/sisu/archive">http://www.jus.uio.no/sisu/archive</A> unstable main non-free
- deb-src <A HREF="http://www.jus.uio.no/sisu/archive">http://www.jus.uio.no/sisu/archive</A> unstable main non-free
-</PRE>
-
-<P>
-<BR>
-
-repeat the aptitude commands
-<P>
-<PRE>
- aptitude update
- aptitude install sisu-complete sisu-markup-samples
-</PRE>
-
-<P>
-<BR>
-
-Note however that it is not necessary to install sisu-complete if not all
-components of sisu are to be used. Installing just the package sisu will
-provide basic functionality.
-<P>
-<A NAME="lbER">&nbsp;</A>
-<H2>29.1.2 RPM INSTALLATION</H2>
-
-<P>
-<BR>
-
-RPMs are provided though untested, they are prepared by running alien against
-the source package, and against the debs.
-<P>
-<BR>
-
-They may be downloaded from:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;&lt;<A HREF="http://www.jus.uio.no/sisu/SiSU/download.html#rpm">http://www.jus.uio.no/sisu/SiSU/download.html#rpm</A>&gt;
-<P>
-<BR>
-
-as root type:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;rpm&nbsp;-i&nbsp;[rpm&nbsp;&nbsp;package&nbsp;&nbsp;name]
-<P>
-<A NAME="lbES">&nbsp;</A>
-<H2>29.1.3 INSTALLATION FROM SOURCE</H2>
-
-<P>
-<BR>
-
-To install
-<B>SiSU</B>
-
-from source check information at:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;&lt;<A HREF="http://www.jus.uio.no/sisu/SiSU/download.html#current">http://www.jus.uio.no/sisu/SiSU/download.html#current</A>&gt;
-<P>
-<BR>
-
-* download the source package
-<P>
-<BR>
-
-* Unpack the source
-<P>
-<BR>
-
-Two alternative modes of installation from source are provided, setup.rb (by
-Minero Aoki) and a rant(by Stefan Lang) built install file, in either case: the
-first steps are the same, download and unpack the source file:
-<P>
-<BR>
-
-For basic use
-<B>SiSU</B>
-
-is only dependent on the programming language in which it is written
-<B>Ruby,</B>
-
-and
-<B>SiSU</B>
-
-will be able to generate html, EPUB, various XMLs, including ODF (and will also
-produce LaTeX). Dependencies required for further actions, though it relies on
-the installation of additional dependencies which the source tarball does not
-take care of, for things like using a database (postgresql or sqlite)[^25] or
-converting LaTeX to pdf.
-<P>
-<BR>
-
-<B>setup.rb</B>
-
-<P>
-<BR>
-
-This is a standard ruby installer, using setup.rb is a three step process. In
-the root directory of the unpacked
-<B>SiSU</B>
-
-as root type:
-<P>
-<PRE>
- ruby setup.rb config
- ruby setup.rb setup
- #[and &nbsp;as &nbsp;root:]
- ruby setup.rb install
-</PRE>
-
-<P>
-<BR>
-
-further information on setup.rb is available from:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;&lt;<A HREF="http://i.loveruby.net/en/projects/setup/">http://i.loveruby.net/en/projects/setup/</A>&gt;
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;&lt;<A HREF="http://i.loveruby.net/en/projects/setup/doc/usage.html">http://i.loveruby.net/en/projects/setup/doc/usage.html</A>&gt;
-<P>
-<BR>
-
-<B>install</B>
-
-<P>
-<BR>
-
-The &quot;install&quot; file provided is an installer prepared using &quot;rant&quot;. In the root
-directory of the unpacked
-<B>SiSU</B>
-
-as root type:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;ruby&nbsp;install&nbsp;base
-<P>
-<BR>
-
-or for a more complete installation:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;ruby&nbsp;install
-<P>
-<BR>
-
-or
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;ruby&nbsp;install&nbsp;base
-<P>
-<BR>
-
-This makes use of Rant (by Stefan Lang) and the provided Rantfile. It has been
-configured to do post installation setup setup configuration and generation of
-first test file. Note however, that additional external package dependencies,
-such as tetex-extra are not taken care of for you.
-<P>
-<BR>
-
-Further information on &quot;rant&quot; is available from:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;&lt;<A HREF="http://make.rubyforge.org/">http://make.rubyforge.org/</A>&gt;
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;&lt;<A HREF="http://rubyforge.org/frs/?group_id=615">http://rubyforge.org/frs/?group_id=615</A>&gt;
-<P>
-<BR>
-
-For a list of alternative actions you may type:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;ruby&nbsp;install&nbsp;help
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;ruby&nbsp;install&nbsp;-T
-<P>
-<A NAME="lbET">&nbsp;</A>
-<H2>29.2 TESTING SISU, GENERATING OUTPUT</H2>
-
-<P>
-<BR>
-
-To check which version of sisu is installed:
-<P>
-<BR>
-
-sisu -v
-<P>
-<BR>
-
-Depending on your mode of installation one or a number of markup sample files
-may be found either in the directory:
-<P>
-<BR>
-
-
-<P>
-<BR>
-
-or
-<P>
-<BR>
-
-
-<P>
-<BR>
-
-change directory to the appropriate one:
-<P>
-<BR>
-
-cd /usr/share/doc/sisu/markup-samples/samples
-<P>
-<A NAME="lbEU">&nbsp;</A>
-<H2>29.2.1 BASIC TEXT, PLAINTEXT, HTML, XML, ODF, EPUB</H2>
-
-<P>
-<BR>
-
-Having moved to the directory that contains the markup samples (see
-instructions above if necessary), choose a file and run sisu against it
-<P>
-<BR>
-
-sisu -NhwoabxXyv free_as_in_freedom.rms_and_free_software.sam_williams.sst
-<P>
-<BR>
-
-this will generate html including a concordance file, opendocument text format,
-plaintext, XHTML and various forms of XML, and OpenDocument text
-<P>
-<A NAME="lbEV">&nbsp;</A>
-<H2>29.2.2 LATEX / PDF</H2>
-
-<P>
-<BR>
-
-Assuming a LaTeX engine such as tetex or texlive is installed with the required
-modules (done automatically on selection of sisu-pdf in
-<B>Debian</B>
-
-)
-<P>
-<BR>
-
-Having moved to the directory that contains the markup samples (see
-instructions above if necessary), choose a file and run sisu against it
-<P>
-<BR>
-
-sisu -pv free_as_in_freedom.rms_and_free_software.sam_williams.sst
-<P>
-<BR>
-
-sisu -3 free_as_in_freedom.rms_and_free_software.sam_williams.sst
-<P>
-<BR>
-
-should generate most available output formats: html including a concordance
-file, opendocument text format, plaintext, XHTML and various forms of XML, and
-OpenDocument text and pdf
-<P>
-<A NAME="lbEW">&nbsp;</A>
-<H2>29.2.3 RELATIONAL DATABASE - POSTGRESQL, SQLITE</H2>
-
-<P>
-<BR>
-
-Relational databases need some setting up - you must have permission to create
-the database and write to it when you run sisu.
-<P>
-<BR>
-
-Assuming you have the database installed and the requisite permissions
-<P>
-<BR>
-
-sisu --sqlite --recreate
-<P>
-<BR>
-
-sisu --sqlite -v --import
-free_as_in_freedom.rms_and_free_software.sam_williams.sst
-<P>
-<BR>
-
-sisu --pgsql --recreate
-<P>
-<BR>
-
-sisu --pgsql -v --import
-free_as_in_freedom.rms_and_free_software.sam_williams.sst
-<P>
-<A NAME="lbEX">&nbsp;</A>
-<H2>29.3 GETTING HELP</H2>
-
-<P>
-<A NAME="lbEY">&nbsp;</A>
-<H2>29.3.1 THE MAN PAGES</H2>
-
-<P>
-<BR>
-
-Type:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;man&nbsp;sisu
-<P>
-<BR>
-
-The man pages are also available online, though not always kept as up to date
-as within the package itself:
-<P>
-<BR>
-
-* sisu.1 &lt;<A HREF="http://www.jus.uio.no/sisu/man/sisu.1.html">http://www.jus.uio.no/sisu/man/sisu.1.html</A>&gt; [^26]
-<P>
-<BR>
-
-* sisu.8 &lt;<A HREF="http://www.jus.uio.no/sisu/man/sisu.8.html">http://www.jus.uio.no/sisu/man/sisu.8.html</A>&gt; [^27]
-<P>
-<BR>
-
-* man directory &lt;<A HREF="http://www.jus.uio.no/sisu/man">http://www.jus.uio.no/sisu/man</A>&gt; [^28]
-<P>
-<A NAME="lbEZ">&nbsp;</A>
-<H2>29.3.2 BUILT IN HELP</H2>
-
-<P>
-<BR>
-
-sisu --help
-<P>
-<BR>
-
-sisu --help --env
-<P>
-<BR>
-
-sisu --help --commands
-<P>
-<BR>
-
-sisu --help --markup
-<P>
-<A NAME="lbFA">&nbsp;</A>
-<H2>29.3.3 THE HOME PAGE</H2>
-
-<P>
-<BR>
-
-&lt;<A HREF="http://www.sisudoc.org/">http://www.sisudoc.org/</A>&gt;
-<P>
-<BR>
-
-&lt;<A HREF="http://www.jus.uio.no/sisu">http://www.jus.uio.no/sisu</A>&gt;
-<P>
-<BR>
-
-&lt;<A HREF="http://www.jus.uio.no/sisu/SiSU">http://www.jus.uio.no/sisu/SiSU</A>&gt;
-<P>
-<A NAME="lbFB">&nbsp;</A>
-<H2>29.4 MARKUP SAMPLES</H2>
-
-<P>
-<BR>
-
-A number of markup samples (along with output) are available off:
-<P>
-<BR>
-
-&lt;<A HREF="http://www.jus.uio.no/sisu/SiSU/examples.html">http://www.jus.uio.no/sisu/SiSU/examples.html</A>&gt;
-<P>
-<BR>
-
-Additional markup samples are packaged separately in the file:
-<P>
-<BR>
-
-***
-<P>
-<BR>
-
-On
-<B>Debian</B>
-
-they are available in non-free[^29] to include them it is necessary to include
-non-free in your /etc/apt/source.list or obtain them from the sisu home site.
-<P>
-<A NAME="lbFC">&nbsp;</A>
-<H2>30. EDITOR FILES, SYNTAX HIGHLIGHTING</H2>
-
-<BR>
-
-<P>
-<BR>
-
-The directory:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;./data/sisu/v2/conf/editor-syntax-etc/
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;./data/sisu/v3/conf/editor-syntax-etc/
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;/usr/share/sisu/v2/conf/editor-syntax-etc
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;/usr/share/sisu/v3/conf/editor-syntax-etc
-<P>
-<BR>
-
-contains rudimentary sisu syntax highlighting files for:
-<P>
-<BR>
-
-* (g)vim &lt;<A HREF="http://www.vim.org">http://www.vim.org</A>&gt;
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;package:&nbsp;sisu-vim
-<P>
-<BR>
-
-status: largely done
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;there&nbsp;is&nbsp;a&nbsp;vim&nbsp;syntax&nbsp;highlighting&nbsp;and&nbsp;folds&nbsp;component
-<P>
-<BR>
-
-* gedit &lt;<A HREF="http://www.gnome.org/projects/gedit">http://www.gnome.org/projects/gedit</A>&gt;
-<P>
-<BR>
-
-* gobby &lt;<A HREF="http://gobby.0x539.de/">http://gobby.0x539.de/</A>&gt;
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;file:&nbsp;sisu.lang
-<P>
-<BR>
-
-place in:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;/usr/share/gtksourceview-1.0/language-specs
-<P>
-<BR>
-
-or
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;~/.gnome2/gtksourceview-1.0/language-specs
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;status:&nbsp;very&nbsp;basic&nbsp;syntax&nbsp;highlighting
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;comments:&nbsp;this&nbsp;editor&nbsp;features&nbsp;display&nbsp;line&nbsp;wrap&nbsp;and&nbsp;is&nbsp;used&nbsp;by&nbsp;Goby!
-<P>
-<BR>
-
-* nano &lt;<A HREF="http://www.nano-editor.org">http://www.nano-editor.org</A>&gt;
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;file:&nbsp;nanorc
-<P>
-<BR>
-
-save as:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;~/.nanorc
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;status:&nbsp;basic&nbsp;syntax&nbsp;highlighting
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;comments:&nbsp;assumes&nbsp;dark&nbsp;background;&nbsp;no&nbsp;display&nbsp;line-wrap;&nbsp;does&nbsp;line&nbsp;breaks
-<P>
-<BR>
-
-* diakonos (an editor written in ruby) &lt;<A HREF="http://purepistos.net/diakonos">http://purepistos.net/diakonos</A>&gt;
-<P>
-<BR>
-
-file: diakonos.conf
-<P>
-<BR>
-
-save as:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;~/.diakonos/diakonos.conf
-<P>
-<BR>
-
-includes:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;status:&nbsp;basic&nbsp;syntax&nbsp;highlighting
-<P>
-<BR>
-
-comments: assumes dark background; no display line-wrap
-<P>
-<BR>
-
-* kate &amp; kwrite &lt;<A HREF="http://kate.kde.org">http://kate.kde.org</A>&gt;
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;file:&nbsp;sisu.xml
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;place&nbsp;in:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;/usr/share/apps/katepart/syntax
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;or
-<P>
-<BR>
+<p> <br>
+sisu_webrick [port]
+<p> <br>
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;~/.kde/share/apps/katepart/syntax
-<P>
-<BR>
+<p>or
+<p> <br>
+sisu -W [port]
+<p>
+<h2><a name='sect96' href='#toc96'>Description</a></h2>
-<BR>&nbsp;&nbsp;[settings::configure&nbsp;&nbsp;kate::{highlighting,filetypes}]
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;[tools::highlighting::{markup,scripts}::&nbsp;&nbsp;.B&nbsp;&nbsp;SiSU&nbsp;&nbsp;]
-<P>
-<BR>
-
-* nedit &lt;<A HREF="http://www.nedit.org">http://www.nedit.org</A>&gt;
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;file:&nbsp;sisu_nedit.pats
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;nedit&nbsp;-import&nbsp;sisu_nedit.pats
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;status:&nbsp;a&nbsp;very&nbsp;clumsy&nbsp;first&nbsp;attempt&nbsp;[not&nbsp;&nbsp;really&nbsp;&nbsp;done]
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;comments:&nbsp;this&nbsp;editor&nbsp;features&nbsp;display&nbsp;line&nbsp;wrap
-<P>
-<BR>
-
-* emacs &lt;<A HREF="http://www.gnu.org/software/emacs/emacs.html">http://www.gnu.org/software/emacs/emacs.html</A>&gt;
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;files:&nbsp;sisu-mode.el
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;to&nbsp;file&nbsp;~/.emacs&nbsp;add&nbsp;the&nbsp;following&nbsp;2&nbsp;lines:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;(add-to-list&nbsp;'load-path
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&quot;/usr/share/sisu/v2/conf/editor-syntax-etc/emacs&quot;)
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;(require&nbsp;'sisu-mode.el)
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;[not&nbsp;&nbsp;done&nbsp;&nbsp;/&nbsp;&nbsp;not&nbsp;&nbsp;yet&nbsp;&nbsp;included]
-<P>
-<BR>
-
-* vim &amp; gvim &lt;<A HREF="http://www.vim.org">http://www.vim.org</A>&gt;
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;files:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;package&nbsp;is&nbsp;the&nbsp;most&nbsp;comprehensive&nbsp;sisu&nbsp;syntax&nbsp;highlighting&nbsp;and&nbsp;editor
-<BR>&nbsp;&nbsp;environment&nbsp;provided&nbsp;to&nbsp;date&nbsp;(is&nbsp;for&nbsp;vim/&nbsp;gvim,&nbsp;and&nbsp;is&nbsp;separate&nbsp;from&nbsp;the
-<BR>&nbsp;&nbsp;contents&nbsp;of&nbsp;this&nbsp;directory)
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;status:&nbsp;this&nbsp;includes:&nbsp;syntax&nbsp;highlighting;&nbsp;vim&nbsp;folds;&nbsp;some&nbsp;error&nbsp;checking
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;comments:&nbsp;this&nbsp;editor&nbsp;features&nbsp;display&nbsp;line&nbsp;wrap
-<P>
-<BR>
-
-NOTE:
-<P>
-<BR>
-
-[ &nbsp;.B &nbsp;SiSU &nbsp;parses &nbsp;files &nbsp;with &nbsp;long &nbsp;lines &nbsp;or &nbsp;line &nbsp;breaks, but, &nbsp;display &nbsp;linewrap &nbsp;(without &nbsp;line-breaks) &nbsp;is &nbsp;a &nbsp;convenient editor &nbsp;feature &nbsp;to &nbsp;have &nbsp;for &nbsp;sisu &nbsp;markup]
-<P>
-<A NAME="lbFD">&nbsp;</A>
-<H2>31. HOW DOES SISU WORK?</H2>
-
-<BR>
-
-<P>
-<BR>
-
-<B>SiSU</B>
-
-markup is fairly minimalistic, it consists of: a (largely optional) document
-header, made up of information about the document (such as when it was
-published, who authored it, and granting what rights) and any processing
-instructions; and markup within the substantive text of the document, which is
-related to document structure and typeface.
-<B>SiSU</B>
-
-must be able to discern the structure of a document, (text headings and their
-levels in relation to each other), either from information provided in the
-document header or from markup within the text (or from a combination of both).
-Processing is done against an abstraction of the document comprising of
-information on the document's structure and its objects,[2] which the program
-serializes (providing the object numbers) and which are assigned hash sum
-values based on their content. This abstraction of information about document
-structure, objects, (and hash sums), provides considerable flexibility in
-representing documents different ways and for different purposes (e.g. search,
-document layout, publishing, content certification, concordance etc.), and
-makes it possible to take advantage of some of the strengths of established
-ways of representing documents, (or indeed to create new ones).
-<P>
-<A NAME="lbFE">&nbsp;</A>
-<H2>32. SUMMARY OF FEATURES</H2>
-
-<BR>
-
-<P>
-<BR>
-
-* sparse/minimal markup (clean utf-8 source texts). Documents are prepared in
-a single UTF-8 file using a minimalistic mnemonic syntax. Typical literature,
-documents like &quot;War and Peace&quot; require almost no markup, and most of the
+<p> <br>
+sisu_webrick is part of <b>SiSU</b> (man sisu) sisu_webrick starts <b>Ruby</b> <b>SiSU</b>
+output is written, providing a list of these directories (assuming <b>SiSU</b>
+is in use and they exist).
+<p> <br>
+The default port for sisu_webrick is set to 8081, this may be modified
+in the yaml file: ~/.sisu/sisurc.yml a sample of which is provided as /etc/sisu/sisurc.yml
+(or in the equivalent directory on your system).
+<p>
+<h2><a name='sect97' href='#toc97'>Summary of Man Page</a></h2>
+
+<p> <br>
+sisu_webrick, may be started on it&rsquo;s own with the command: sisu_webrick
+[port] or using the sisu command with the -W flag: sisu -W [port]
+<p> <br>
+
+<p>where no port is given and settings are unchanged the default port is 8081
+
+<p>
+<h2><a name='sect98' href='#toc98'>Document Processing Command Flags</a></h2>
+
+<p> <br>
+sisu -W [port] starts <b>Ruby</b> Webrick web-server, serving <b>SiSU</b> output directories,
+on the port provided, or if no port is provided and the defaults have not
+
+<p>been changed in ~/.sisu/sisurc.yaml then on port 8081
+<p>
+<h2><a name='sect99' href='#toc99'>Summary of Features</a></h2>
+<br>
+
+<p> <br>
+* sparse/minimal markup (clean utf-8 source texts). Documents are prepared
+in a single <i>UTF-8</i> file using a minimalistic mnemonic syntax. Typical literature,
+documents like "War and Peace" require almost no markup, and most of the
headers are optional.
-<P>
-<BR>
-
-* markup is easily readable/parsable by the human eye, (basic markup is simpler
-and more sparse than the most basic HTML), [this &nbsp;may &nbsp;also &nbsp;be &nbsp;converted
-&nbsp;to &nbsp;XML &nbsp;representations &nbsp;of &nbsp;the &nbsp;same &nbsp;input/source &nbsp;document].
-<P>
-<BR>
-
+<p> <br>
+* markup is easily readable/parsable by the human eye, (basic markup is
+simpler and more sparse than the most basic <i>HTML</i> ) , [this &nbsp;may &nbsp;also &nbsp;be
+&nbsp;converted &nbsp;to &nbsp;.I &nbsp;XML &nbsp;representations &nbsp;of &nbsp;the &nbsp;same &nbsp;input/source &nbsp;document].
+<p>
+<br>
* markup defines document structure (this may be done once in a header
pattern-match description, or for heading levels individually); basic text
-attributes (bold, italics, underscore, strike-through etc.) as required; and
-semantic information related to the document (header information, extended
+attributes (bold, italics, underscore, strike-through etc.) as required;
+and semantic information related to the document (header information, extended
beyond the Dublin core and easily further extended as required); the headers
-may also contain processing instructions.
-<B>SiSU</B>
-
-markup is primarily an abstraction of document structure and document metadata
-to permit taking advantage of the basic strengths of existing alternative
-practical standard ways of representing documents [be &nbsp;that &nbsp;browser viewing, &nbsp;paper &nbsp;publication, &nbsp;sql &nbsp;search &nbsp;etc.] (html, epub, xml, odf,
-latex, pdf, sql)
-<P>
-<BR>
-
-* for output produces reasonably elegant output of established industry and
-institutionally accepted open standard formats.[3] takes advantage of the
-different strengths of various standard formats for representing documents,
+may also contain processing instructions. <b>SiSU</b> markup is primarily an abstraction
+of document structure and document metadata to permit taking advantage
+of the basic strengths of existing alternative practical standard ways
+of representing documents [be &nbsp;that &nbsp;browser viewing, &nbsp;paper &nbsp;publication,
+&nbsp;sql &nbsp;search &nbsp;etc.] (html, epub, xml, odf, latex, pdf, sql)
+<p> <br>
+* for output produces reasonably elegant output of established industry
+and institutionally accepted open standard formats.[3] takes advantage of
+the different strengths of various standard formats for representing documents,
amongst the output formats currently supported are:
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;*&nbsp;html&nbsp;-&nbsp;both&nbsp;as&nbsp;a&nbsp;single&nbsp;scrollable&nbsp;text&nbsp;and&nbsp;a&nbsp;segmented&nbsp;document
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;*&nbsp;xhtml
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;*&nbsp;epub
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;*&nbsp;XML&nbsp;-&nbsp;both&nbsp;in&nbsp;sax&nbsp;and&nbsp;dom&nbsp;style&nbsp;xml&nbsp;structures&nbsp;for&nbsp;further&nbsp;development&nbsp;as
-<BR>&nbsp;&nbsp;required
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;*&nbsp;ODF&nbsp;-&nbsp;open&nbsp;document&nbsp;format,&nbsp;the&nbsp;iso&nbsp;standard&nbsp;for&nbsp;document&nbsp;storage
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;*&nbsp;LaTeX&nbsp;-&nbsp;used&nbsp;to&nbsp;generate&nbsp;pdf
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;*&nbsp;pdf&nbsp;(via&nbsp;LaTeX)
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;*&nbsp;sql&nbsp;-&nbsp;population&nbsp;of&nbsp;an&nbsp;sql&nbsp;database,&nbsp;(at&nbsp;the&nbsp;same&nbsp;object&nbsp;level&nbsp;that&nbsp;is
-<BR>&nbsp;&nbsp;used&nbsp;to&nbsp;cite&nbsp;text&nbsp;within&nbsp;a&nbsp;document)
-<P>
-<BR>
-
-Also produces: concordance files; document content certificates (md5 or sha256
-digests of headings, paragraphs, images etc.) and html manifests (and sitemaps
-of content). (b) takes advantage of the strengths implicit in these very
-different output types, (e.g. PDFs produced using typesetting of LaTeX,
-databases populated with documents at an individual object/paragraph level,
-making possible granular search (and related possibilities))
-<P>
-<BR>
-
+<p> <br>
+* <i>HTML</i> - both as a single scrollable text and a segmented document
+<p> <br>
+* <i>XHTML</i>
+<p> <br>
+* <i>EPUB</i>
+<p> <br>
+* <i>XML</i> - both in sax and dom style xml structures for further development
+
+<p>as required
+<p> <br>
+* <i>ODT</i> - Open Document Format text, the iso standard for document storage
+
+<p> <br>
+* <i>LaTeX</i> - used to generate pdf
+<p> <br>
+* <i>PDF</i> (via <i>LaTeX</i> )
+<p> <br>
+* <i>SQL</i> - population of an sql database ( <i>PostgreSQL</i> or <i>SQLite</i> ) , (at the
+same object level that is used to cite text within a document)
+<p> <br>
+Also produces: concordance files; document content certificates (md5 or
+sha256 digests of headings, paragraphs, images etc.) and html manifests
+(and sitemaps of content). (b) takes advantage of the strengths implicit
+in these very different output types, (e.g. PDFs produced using typesetting
+of <i>LaTeX,</i> databases populated with documents at an individual object/paragraph
+level, making possible <i>granular</i> search (and related possibilities))
+<p> <br>
* ensuring content can be cited in a meaningful way regardless of selected
output format. Online publishing (and publishing in multiple document formats)
-lacks a useful way of citing text internally within documents (important to
-academics generally and to lawyers) as page numbers are meaningless across
-browsers and formats. sisu seeks to provide a common way of pinpoint the text
-within a document, (which can be utilized for citation and by search engines).
-The outputs share a common numbering system that is meaningful (to man and
-machine) across all digital outputs whether paper, screen, or database
-oriented, (pdf, HTML, EPUB, xml, sqlite, postgresql), this numbering system can
-be used to reference content.
-<P>
-<BR>
-
-* Granular search within documents. SQL databases are populated at an object
-level (roughly headings, paragraphs, verse, tables) and become searchable with
-that degree of granularity, the output information provides the
-object/paragraph numbers which are relevant across all generated outputs; it is
-also possible to look at just the matching paragraphs of the documents in the
-database; [output &nbsp;indexing &nbsp;also &nbsp;work &nbsp;well &nbsp;with &nbsp;search &nbsp;indexing tools &nbsp;like &nbsp;hyperestraier].
-<P>
-<BR>
-
+lacks a useful way of citing text internally within documents (important
+to academics generally and to lawyers) as page numbers are meaningless
+across browsers and formats. sisu seeks to provide a common way of pinpoint
+the text within a document, (which can be utilized for citation and by
+search engines). The outputs share a common numbering system that is meaningful
+(to man and machine) across all digital outputs whether paper, screen,
+or database oriented, (pdf, <i>HTML,</i> <i>EPUB,</i> xml, sqlite, postgresql) , this
+numbering system can be used to reference content.
+<p> <br>
+* Granular search within documents. <i>SQL</i> databases are populated at an object
+level (roughly headings, paragraphs, verse, tables) and become searchable
+with that degree of granularity, the output information provides the object/paragraph
+numbers which are relevant across all generated outputs; it is also possible
+to look at just the matching paragraphs of the documents in the database;
+[output &nbsp;indexing &nbsp;also &nbsp;work
+<p> <br>
* long term maintainability of document collections in a world of changing
-formats, having a very sparsely marked-up source document base. there is a
-considerable degree of future-proofing, output representations are
-&quot;upgradeable&quot;, and new document formats may be added. e.g. addition of odf
-(open document text) module in 2006, epub in 2009 and in future html5 output
-sometime in future, without modification of existing prepared texts
-<P>
-<BR>
-
-* SQL search aside, documents are generated as required and static once
+formats, having a very sparsely marked-up source document base. there is
+a considerable degree of future-proofing, output representations are "upgradeable",
+and new document formats may be added. e.g. addition of odf (open document
+text) module in 2006, epub in 2009 and in future html5 output sometime
+in future, without modification of existing prepared texts
+<p> <br>
+* <i>SQL</i> search aside, documents are generated as required and static once
generated.
-<P>
-<BR>
-
-* documents produced are static files, and may be batch processed, this needs
-to be done only once but may be repeated for various reasons as desired
+<p> <br>
+* documents produced are static files, and may be batch processed, this
+needs to be done only once but may be repeated for various reasons as desired
(updated content, addition of new output formats, updated technology document
presentations/representations)
-<P>
-<BR>
-
-* document source (plaintext utf-8) if shared on the net may be used as input
-and processed locally to produce the different document outputs
-<P>
-<BR>
+<p> <br>
+* document source ( <i>plaintext</i> utf-8) if shared on the net may be used as
+<p>input and processed locally to produce the different document outputs
+<p>
+<br>
* document source may be bundled together (automatically) with associated
-documents (multiple language versions or master document with inclusions) and
-images and sent as a zip file called a sisupod, if shared on the net these too
-may be processed locally to produce the desired document outputs
-<P>
-<BR>
-
-* generated document outputs may automatically be posted to remote sites.
-<P>
-<BR>
+documents (multiple language versions or master document with inclusions)
+and images and sent as a zip file called a sisupod, if shared on the net
-* for basic document generation, the only software dependency is
-<B>Ruby,</B>
+<p>these too may be processed locally to produce the desired document outputs
-and a few standard Unix tools (this covers plaintext, HTML, EPUB, XML, ODF,
-LaTeX). To use a database you of course need that, and to convert the LaTeX
-generated to pdf, a latex processor like tetex or texlive.
-<P>
-<BR>
+<p> <br>
+* generated document outputs may automatically be posted to remote sites.
+<p> <br>
+* for basic document generation, the only software dependency is <b>Ruby,</b>
+and a few standard Unix tools (this covers <i>plaintext,</i> <i>HTML,</i> <i>EPUB,</i> <i>XML,</i>
+<i>ODF,</i> <i>LaTeX</i> ) . To use a database you of course need that, and to convert
+the <i>LaTeX</i> generated to pdf, a latex processor like tetex or texlive.
+<p> <br>
* as a developers tool it is flexible and extensible
-<P>
-<BR>
-
-Syntax highlighting for
-<B>SiSU</B>
-
-markup is available for a number of text editors.
-<P>
-<BR>
-
-<B>SiSU</B>
-
-is less about document layout than about finding a way with little markup to be
-able to construct an abstract representation of a document that makes it
-possible to produce multiple representations of it which may be rather
-different from each other and used for different purposes, whether layout and
-publishing, or search of content
-<P>
-<BR>
-
-i.e. to be able to take advantage from this minimal preparation starting point
-of some of the strengths of rather different established ways of representing
-documents for different purposes, whether for search (relational database, or
-indexed flat files generated for that purpose whether of complete documents, or
-say of files made up of objects), online viewing (e.g. html, xml, pdf), or
-paper publication (e.g. pdf)...
-<P>
-<BR>
-
+<p> <br>
+Syntax highlighting for <b>SiSU</b> markup is available for a number of text editors.
+
+<p> <br>
+<b>SiSU</b> is less about document layout than about finding a way with little
+markup to be able to construct an abstract representation of a document
+that makes it possible to produce multiple representations of it which
+may be rather different from each other and used for different purposes,
+whether layout and publishing, or search of content
+<p> <br>
+i.e. to be able to take advantage from this minimal preparation starting
+point of some of the strengths of rather different established ways of
+representing documents for different purposes, whether for search (relational
+database, or indexed flat files generated for that purpose whether of complete
+documents, or say of files made up of objects), online viewing (e.g. html,
+xml, pdf) , or paper publication (e.g. pdf) ...
+<p> <br>
the solution arrived at is by extracting structural information about the
document (about headings within the document) and by tracking objects (which
are serialized and also given hash values) in the manner described. It makes
possible representations that are quite different from those offered at
-present. For example objects could be saved individually and identified by
-their hashes, with an index of how the objects relate to each other to form a
-document.
-<P>
-<A NAME="lbFF">&nbsp;</A>
-<H2>33. HELP SOURCES</H2>
-
-<BR>
-
-<P>
-<A NAME="lbFG">&nbsp;</A>
-<H2>33.1 MAN PAGES</H2>
-
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;man&nbsp;sisu
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;man&nbsp;sisu-concordance
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;man&nbsp;sisu-epub
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;man&nbsp;sisu-git
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;man&nbsp;sisu-harvest
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;man&nbsp;sisu-html
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;man&nbsp;sisu-odf
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;man&nbsp;sisu-pdf
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;man&nbsp;sisu-pg
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;man&nbsp;sisu-po
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;man&nbsp;sisu-sqlite
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;man&nbsp;sisu-txt
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;man&nbsp;7&nbsp;sisu_complete
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;man&nbsp;7&nbsp;sisu_pdf
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;man&nbsp;7&nbsp;sisu_postgresql
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;man&nbsp;7&nbsp;sisu_sqlite
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;man&nbsp;sisu_termsheet
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;man&nbsp;sisu_webrick
-<P>
-<A NAME="lbFH">&nbsp;</A>
-<H2>33.2 SISU GENERATED OUTPUT - LINKS TO HTML</H2>
-
-<P>
-<BR>
-
-Note
-<B>SiSU</B>
-
-documentation is prepared in
-<B>SiSU</B>
-
-and output is available in multiple formats including amongst others html, pdf,
-odf and epub, which may be also be accessed via the html pages[^30]
-<P>
-<A NAME="lbFI">&nbsp;</A>
-<H2>33.2.1 WWW.SISUDOC.ORG</H2>
-
-<P>
-<BR>
-
-&lt;<A HREF="http://sisudoc.org/sisu/sisu_manual/index.html">http://sisudoc.org/sisu/sisu_manual/index.html</A>&gt;
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;&lt;<A HREF="http://sisudoc.org/sisu/sisu_manual/index.html">http://sisudoc.org/sisu/sisu_manual/index.html</A>&gt;
-<P>
-<A NAME="lbFJ">&nbsp;</A>
-<H2>33.3 MAN2HTML</H2>
-
-<P>
-<A NAME="lbFK">&nbsp;</A>
-<H2>33.3.1 LOCALLY INSTALLED</H2>
-
-<P>
-<BR>
-
-<A HREF="file:///usr/share/doc/sisu/html/sisu.1.html">file:///usr/share/doc/sisu/html/sisu.1.html</A>
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;<A HREF="file:///usr/share/doc/sisu/html/sisu.1.html">file:///usr/share/doc/sisu/html/sisu.1.html</A>
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;/usr/share/doc/sisu/html/sisu_pdf.7.html
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;/usr/share/doc/sisu/html/sisu_postgresql.7.html
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;/usr/share/doc/sisu/html/sisu_sqlite.7.html
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;/usr/share/doc/sisu/html/sisu_webrick.1.html
-<P>
-<A NAME="lbFL">&nbsp;</A>
-<H2>33.3.2 WWW.JUS.UIO.NO/SISU</H2>
-
-<P>
-<BR>
-
-&lt;<A HREF="http://www.jus.uio.no/sisu/man/sisu.1.html">http://www.jus.uio.no/sisu/man/sisu.1.html</A>&gt;
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;&lt;<A HREF="http://www.jus.uio.no/sisu/man/sisu.1.html">http://www.jus.uio.no/sisu/man/sisu.1.html</A>&gt;
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;&lt;<A HREF="http://www.jus.uio.no/sisu/man/sisu_complete.7.html">http://www.jus.uio.no/sisu/man/sisu_complete.7.html</A>&gt;
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;&lt;<A HREF="http://www.jus.uio.no/sisu/man/sisu_pdf.7.html">http://www.jus.uio.no/sisu/man/sisu_pdf.7.html</A>&gt;
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;&lt;<A HREF="http://www.jus.uio.no/sisu/man/sisu_postgresql.7.html">http://www.jus.uio.no/sisu/man/sisu_postgresql.7.html</A>&gt;
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;&lt;<A HREF="http://www.jus.uio.no/sisu/man/sisu_sqlite.7.html">http://www.jus.uio.no/sisu/man/sisu_sqlite.7.html</A>&gt;
-<P>
-<BR>
-
-<BR>&nbsp;&nbsp;&lt;<A HREF="http://www.jus.uio.no/sisu/man/sisu_webrick.1.html">http://www.jus.uio.no/sisu/man/sisu_webrick.1.html</A>&gt;
-<P>
-<DL COMPACT>
-<DT><B>1.</B>
-
-<DD>
-objects include: headings, paragraphs, verse, tables, images, but not
-footnotes/endnotes which are numbered separately and tied to the object from
-which they are referenced.
-<P>
-<BR>
-
-<DT><B>2.</B>
-
-<DD>
-i.e. the html, pdf, epub, odf outputs are each built individually and
-optimised for that form of presentation, rather than for example the html being
-a saved version of the odf, or the pdf being a saved version of the html.
-<P>
-<BR>
-
-<DT><B>3.</B>
-
-<DD>
-the different heading levels
-<P>
-<BR>
-
-<DT><B>4.</B>
-
-<DD>
-units of text, primarily paragraphs and headings, also any tables, poems,
-code-blocks
-<P>
-<BR>
-
-<DT><B>5.</B>
-
-<DD>
-Specification submitted by Adobe to ISO to become a full open ISO
-specification
-<P>
-<BR>
-
-&lt;<A HREF="http://www.linux-watch.com/news/NS7542722606.html">http://www.linux-watch.com/news/NS7542722606.html</A>&gt;
-<P>
-<BR>
-
-<DT><B>6.</B>
-
-<DD>
-ISO standard ISO/IEC 26300:2006
-<P>
-<BR>
-
-<DT><B>7.</B>
-
-<DD>
-An open standard format for e-books
-<P>
-<BR>
-
-<DT><B>*1.</B>
-
-<DD>
-square brackets
-<P>
-<BR>
-
-<DT><B>*2.</B>
-
-<DD>
-square brackets
-<P>
-<BR>
-
-<DT><B>+1.</B>
-
-<DD>
-square brackets
-<P>
-<BR>
-
-<DT><B>8.</B>
-
-<DD>
-&lt;<A HREF="http://www.jus.uio.no/sisu/man/">http://www.jus.uio.no/sisu/man/</A>&gt;
-<P>
-<BR>
-
-<DT><B>9.</B>
-
-<DD>
-&lt;<A HREF="http://www.jus.uio.no/sisu/man/sisu.1.html">http://www.jus.uio.no/sisu/man/sisu.1.html</A>&gt;
-<P>
-<BR>
-
-<DT><B>10.</B>
-
-<DD>
-From sometime after SiSU 0.58 it should be possible to describe SiSU markup
+present. For example objects could be saved individually and identified
+by their hashes, with an index of how the objects relate to each other
+to form a document.
+<p>
+<ol>
+<b>.</b><li>objects include: headings, paragraphs, verse, tables,
+images, but not footnotes/endnotes which are numbered separately and tied
+to the object from which they are referenced.
+<p> <br>
+</li><b>.</b><li>i.e. the
+<p> <br>
+<i>HTML,</i>
+<p> <br>
+<i>PDF,</i>
+<p> <br>
+<i>EPUB,</i>
+<p> <br>
+
+<p><i>ODT</i>
+<p> <br>
+outputs are each built individually and optimised for that form of presentation,
+rather than for example the html being a saved version of the odf, or the
+pdf being a saved version of the html.
+<p> <br>
+</li><b>.</b><li>
+<p>the different heading levels
+<p> <br>
+</li><b>.</b><li>units of text, primarily paragraphs and headings, also any tables, poems,
+
+<p>code-blocks
+<p> <br>
+</li><b>.</b><li>
+<p>An open standard format for e-books
+<p> <br>
+</li><b>.</b><li>Open Document Format (
+<p> <br>
+
+<p><i>ODF</i>
+<p> <br>
+) text
+<p> <br>
+</li><b>.</b><li>
+<p>Specification submitted by Adobe to ISO to become a full open ISO specification
+
+<p> <br>
+&lt;<a href='http://www.linux-watch.com/news/NS7542722606.html'>http://www.linux-watch.com/news/NS7542722606.html</a>
+&gt;
+<p> <br>
+</li><b>.</b><li>
+<p>ISO standard ISO/IEC 26300:2006
+<p> <br>
+</dd>
+
+<dt><b>*1.</b> </dt>
+<dd>square brackets
+<p> <br>
+</dd>
+
+<dt><b>*2.</b> </dt>
+<dd>square brackets
+<p> <br>
+</dd>
+
+<dt><b>+1.</b> </dt>
+<dd>square brackets
+<p> <br>
+</li><b>.</b><li>&lt;<a href='http://www.jus.uio.no/sisu/man/'>http://www.jus.uio.no/sisu/man/</a>
+&gt;
+<p> <br>
+</li><b>.</b><li>&lt;<a href='http://www.jus.uio.no/sisu/man/sisu.1.html'>http://www.jus.uio.no/sisu/man/sisu.1.html</a>
+&gt;
+<p> <br>
+</li><b>.</b><li>From sometime after SiSU 0.58 it should be possible to describe SiSU markup
using SiSU, which though not an original design goal is useful.
-<P>
-<BR>
-
-<DT><B>11.</B>
-
-<DD>
-files should be prepared using UTF-8 character encoding
-<P>
-<BR>
-
-<DT><B>12.</B>
-
-<DD>
-a footnote or endnote
-<P>
-<BR>
-
-<DT><B>13.</B>
-
-<DD>
-self contained endnote marker &amp; endnote in one
-<P>
-<BR>
-
-<DT><B>*.</B>
-
-<DD>
-unnumbered asterisk footnote/endnote, insert multiple asterisks if required
-<P>
-<BR>
-
-<DT><B>**.</B>
-
-<DD>
-another unnumbered asterisk footnote/endnote
-<P>
-<BR>
-
-<DT><B>*3.</B>
-
-<DD>
-editors notes, numbered asterisk footnote/endnote series
-<P>
-<BR>
-
-<DT><B>+2.</B>
-
-<DD>
-editors notes, numbered asterisk footnote/endnote series
-<P>
-<BR>
-
-<DT><B>14.</B>
-
-<DD>
-&lt;<A HREF="http://www.sisudoc.org/">http://www.sisudoc.org/</A>&gt;
-<P>
-<BR>
-
-<DT><B>15.</B>
-
-<DD>
-&lt;<A HREF="http://www.ruby-lang.org/en/">http://www.ruby-lang.org/en/</A>&gt;
-<P>
-<BR>
-
-<DT><B>17.</B>
-
-<DD>
-Table from the Wealth of Networks by Yochai Benkler
-<P>
-<BR>
-
-&lt;<A HREF="http://www.jus.uio.no/sisu/the_wealth_of_networks.yochai_benkler">http://www.jus.uio.no/sisu/the_wealth_of_networks.yochai_benkler</A>&gt;
-<P>
-<BR>
-
-<DT><B>18.</B>
-
-<DD>
-.ssc (for composite) is under consideration but ._sst makes clear that this
-is not a regular file to be worked on, and thus less likely that people will
-have &quot;accidents&quot;, working on a .ssc file that is overwritten by subsequent
-processing. It may be however that when the resulting file is shared .ssc is an
-appropriate suffix to use.
-<P>
-<BR>
-
-<DT><B>20.</B>
-
-<DD>
-&lt;<A HREF="http://www.postgresql.org/">http://www.postgresql.org/</A>&gt;
-<P>
-<BR>
-
-&lt;<A HREF="http://advocacy.postgresql.org/">http://advocacy.postgresql.org/</A>&gt;
-<BR>
-
-&lt;<A HREF="http://en.wikipedia.org/wiki/Postgresql">http://en.wikipedia.org/wiki/Postgresql</A>&gt;
-<BR>
-
-<DT><B>21.</B>
-
-<DD>
-&lt;<A HREF="http://www.hwaci.com/sw/sqlite/">http://www.hwaci.com/sw/sqlite/</A>&gt;
-<P>
-<BR>
-
-&lt;<A HREF="http://en.wikipedia.org/wiki/Sqlite">http://en.wikipedia.org/wiki/Sqlite</A>&gt;
-<BR>
-
-<DT><B>22.</B>
-
-<DD>
-&lt;<A HREF="http://search.sisudoc.org">http://search.sisudoc.org</A>&gt;
-<P>
-<BR>
-
-<DT><B>23.</B>
-
-<DD>
-(which could be extended further with current back-end). As regards scaling
+<p> <br>
+</li><b>.</b><li>
+<p>files should be prepared using
+<p> <br>
+
+<p><i>UTF-8</i>
+<p> <br>
+
+<p>character encoding
+<p> <br>
+</li><b>.</b><li>
+<p>a footnote or endnote
+<p> <br>
+</li><b>.</b><li>self contained endnote marker &amp; endnote in one
+<p> <br>
+</dd>
+
+<dt><b>*.</b> </dt>
+<dd>unnumbered asterisk footnote/endnote, insert multiple asterisks if required
+
+<p> <br>
+</dd>
+
+<dt><b>**.</b> </dt>
+<dd>another unnumbered asterisk footnote/endnote
+<p> <br>
+</dd>
+
+<dt><b>*3.</b> </dt>
+<dd>editors notes, numbered asterisk footnote/endnote series
+<p> <br>
+</dd>
+
+<dt><b>+2.</b> </dt>
+<dd>editors notes, numbered asterisk footnote/endnote series
+<p> <br>
+</li><b>.</b><li>&lt;<a href='http://www.sisudoc.org/'>http://www.sisudoc.org/</a>
+&gt;
+<p> <br>
+</li><b>.</b><li>&lt;<a href='http://www.ruby-lang.org/en/'>http://www.ruby-lang.org/en/</a>
+&gt;
+<p> <br>
+</li><b>.</b><li>
+<p>Table from the Wealth of Networks by Yochai Benkler
+<p> <br>
+&lt;<a href='http://www.jus.uio.no/sisu/the_wealth_of_networks.yochai_benkler'>http://www.jus.uio.no/sisu/the_wealth_of_networks.yochai_benkler</a>
+&gt;
+<p> <br>
+</li><b>.</b><li>.ssc (for composite) is under consideration but ._sst makes clear that this
+is not a regular file to be worked on, and thus less likely that people
+will have "accidents", working on a .ssc file that is overwritten by subsequent
+processing. It may be however that when the resulting file is shared .ssc
+is an appropriate suffix to use.
+<p> <br>
+</li><b>.</b><li>&lt;<a href='http://www.postgresql.org/'>http://www.postgresql.org/</a>
+&gt;
+<p> <br>
+&lt;<a href='http://advocacy.postgresql.org/'>http://advocacy.postgresql.org/</a>
+&gt;
+<p> <br>
+&lt;<a href='http://en.wikipedia.org/wiki/Postgresql'>http://en.wikipedia.org/wiki/Postgresql</a>
+&gt;
+<p> <br>
+</li><b>.</b><li>&lt;<a href='http://www.hwaci.com/sw/sqlite/'>http://www.hwaci.com/sw/sqlite/</a>
+&gt;
+<p> <br>
+&lt;<a href='http://en.wikipedia.org/wiki/Sqlite'>http://en.wikipedia.org/wiki/Sqlite</a>
+&gt;
+<p> <br>
+</li><b>.</b><li>&lt;<a href='http://search.sisudoc.org'>http://search.sisudoc.org</a>
+&gt;
+<p> <br>
+</li><b>.</b><li>(which could be extended further with current back-end). As regards scaling
of the database, it is as scalable as the database (here Postgresql) and
hardware allow.
-<P>
-<BR>
-
-<DT><B>24.</B>
-
-<DD>
-of this feature when demonstrated to an IBM software innovations evaluator
-in 2004 he said to paraphrase: this could be of interest to us. We have large
-document management systems, you can search hundreds of thousands of documents
-and we can tell you which documents meet your search criteria, but there is no
-way we can tell you without opening each document where within each your
-matches are found.
-<P>
-<BR>
-
-<DT><B>25.</B>
-
-<DD>
-There is nothing to stop MySQL support being added in future.
-<P>
-<BR>
-
-<DT><B>26.</B>
-
-<DD>
-&lt;<A HREF="http://www.jus.uio.no/sisu/man/sisu.1.html">http://www.jus.uio.no/sisu/man/sisu.1.html</A>&gt;
-<P>
-<BR>
-
-<DT><B>27.</B>
-
-<DD>
-&lt;<A HREF="http://www.jus.uio.no/sisu/man/sisu.8.html">http://www.jus.uio.no/sisu/man/sisu.8.html</A>&gt;
-<P>
-<BR>
-
-<DT><B>28.</B>
-
-<DD>
-&lt;<A HREF="http://www.jus.uio.no/sisu/man">http://www.jus.uio.no/sisu/man</A>&gt;
-<P>
-<BR>
-
-29. the
-<B>Debian</B>
-
-Free Software guidelines require that everything distributed within
-<B>Debian</B>
-
-can be changed - and the documents are authors' works that while freely
-distributable are not freely changeable.
-<P>
-<BR>
-
-30. named index.html or more extensively through sisu_manifest.html
-<BR>
-
-<P>
-</DL>
-<A NAME="lbFM">&nbsp;</A>
-<H2>SEE ALSO</H2>
-
-<BR>
-
-<I><A HREF="/cgi-bin/man/man2html?1+sisu">sisu</A></I>(1),
-<BR>
-
-<I><A HREF="/cgi-bin/man/man2html?1+sisu-epub">sisu-epub</A></I>(1),
-<BR>
-
-<I><A HREF="/cgi-bin/man/man2html?1+sisu-harvest">sisu-harvest</A></I>(1),
-<BR>
-
-<I><A HREF="/cgi-bin/man/man2html?1+sisu-html">sisu-html</A></I>(1),
-<BR>
-
-<I><A HREF="/cgi-bin/man/man2html?1+sisu-odf">sisu-odf</A></I>(1),
-<BR>
-
-<I><A HREF="/cgi-bin/man/man2html?1+sisu-pdf">sisu-pdf</A></I>(1),
-<BR>
-
-<I><A HREF="/cgi-bin/man/man2html?1+sisu-pg">sisu-pg</A></I>(1),
-<BR>
-
-<I><A HREF="/cgi-bin/man/man2html?1+sisu-sqlite">sisu-sqlite</A></I>(1),
-<BR>
-
-<I><A HREF="/cgi-bin/man/man2html?1+sisu-txt">sisu-txt</A></I>(1).
-<BR>
-
-<I><A HREF="/cgi-bin/man/man2html?7+sisu_vim">sisu_vim</A></I>(7)
-<P>
-<A NAME="lbFN">&nbsp;</A>
-<H2>HOMEPAGE</H2>
-
-<BR>
-
-More information about <B>SiSU</B> can be found at &lt;<I><A HREF="http://www.sisudoc.org/">http://www.sisudoc.org/</A></I>&gt; or &lt;<I><A HREF="http://www.jus.uio.no/sisu/">http://www.jus.uio.no/sisu/</A></I>&gt;.
-<P>
-<A NAME="lbFO">&nbsp;</A>
-<H2>AUTHOR</H2>
-
-<B>SiSU</B> is written by Ralph Amissah &lt;<I><A HREF="mailto:ralph@amissah.com">ralph@amissah.com</A></I>&gt;.
-<P>
-
-<HR>
-<A NAME="index">&nbsp;</A><H2>Index</H2>
-<DL>
-<DT><A HREF="#lbAB">NAME</A><DD>
-<DT><A HREF="#lbAC">SYNOPSIS</A><DD>
-<DT><A HREF="#lbAD">SISU - MANUAL,</A><DD>
-<DT><A HREF="#lbAE">WHAT IS SISU?</A><DD>
-<DT><A HREF="#lbAF">1. INTRODUCTION - WHAT IS SISU?</A><DD>
-<DT><A HREF="#lbAG">2. COMMANDS SUMMARY</A><DD>
-<DT><A HREF="#lbAH">2.1 DESCRIPTION</A><DD>
-<DT><A HREF="#lbAI">2.2 DOCUMENT PROCESSING COMMAND FLAGS</A><DD>
-<DT><A HREF="#lbAJ">3. COMMAND LINE MODIFIERS</A><DD>
-<DT><A HREF="#lbAK">4. DATABASE COMMANDS</A><DD>
-<DT><A HREF="#lbAL">5. SHORTCUTS, SHORTHAND FOR MULTIPLE FLAGS</A><DD>
-<DT><A HREF="#lbAM">5.1 COMMAND LINE WITH FLAGS - BATCH PROCESSING</A><DD>
-<DT><A HREF="#lbAN">6. HELP</A><DD>
-<DT><A HREF="#lbAO">6.1 SISU MANUAL</A><DD>
-<DT><A HREF="#lbAP">6.2 SISU MAN PAGES</A><DD>
-<DT><A HREF="#lbAQ">6.3 SISU BUILT-IN INTERACTIVE HELP</A><DD>
-<DT><A HREF="#lbAR">7. INTRODUCTION TO SISU MARKUP[^10]</A><DD>
-<DT><A HREF="#lbAS">7.1 SUMMARY</A><DD>
-<DT><A HREF="#lbAT">7.2 MARKUP EXAMPLES</A><DD>
-<DT><A HREF="#lbAU">7.2.1 ONLINE</A><DD>
-<DT><A HREF="#lbAV">7.2.2 INSTALLED</A><DD>
-<DT><A HREF="#lbAW">8. MARKUP OF HEADERS</A><DD>
-<DT><A HREF="#lbAX">8.1 SAMPLE HEADER</A><DD>
-<DT><A HREF="#lbAY">8.2 AVAILABLE HEADERS</A><DD>
-<DT><A HREF="#lbAZ">9. MARKUP OF SUBSTANTIVE TEXT</A><DD>
-<DT><A HREF="#lbBA">9.1 HEADING LEVELS</A><DD>
-<DT><A HREF="#lbBB">9.2 FONT ATTRIBUTES</A><DD>
-<DT><A HREF="#lbBC">9.3 INDENTATION AND BULLETS</A><DD>
-<DT><A HREF="#lbBD">9.4 HANGING INDENTS</A><DD>
-<DT><A HREF="#lbBE">9.5 FOOTNOTES / ENDNOTES</A><DD>
-<DT><A HREF="#lbBF">9.6 LINKS</A><DD>
-<DT><A HREF="#lbBG">9.6.1 NAKED URLS WITHIN TEXT, DEALING WITH URLS</A><DD>
-<DT><A HREF="#lbBH">9.6.2 LINKING TEXT</A><DD>
-<DT><A HREF="#lbBI">9.7 GROUPED TEXT</A><DD>
-<DT><A HREF="#lbBJ">9.7.1 TABLES</A><DD>
-<DT><A HREF="#lbBK">9.7.2 POEM</A><DD>
-<DT><A HREF="#lbBL">9.7.3 GROUP</A><DD>
-<DT><A HREF="#lbBM">9.7.4 CODE</A><DD>
-<DT><A HREF="#lbBN">9.8 ADDITIONAL BREAKS - LINEBREAKS WITHIN OBJECTS, COLUMN AND PAGE-BREAKS</A><DD>
-<DT><A HREF="#lbBO">9.8.1 LINE-BREAKS</A><DD>
-<DT><A HREF="#lbBP">9.8.2 PAGE BREAKS</A><DD>
-<DT><A HREF="#lbBQ">9.9 BOOK INDEX</A><DD>
-<DT><A HREF="#lbBR">10. COMPOSITE DOCUMENTS MARKUP</A><DD>
-<DT><A HREF="#lbBS">11. MARKUP SYNTAX HISTORY</A><DD>
-<DT><A HREF="#lbBT">11.1 NOTES RELATED TO FILES-TYPES AND MARKUP SYNTAX</A><DD>
-<DT><A HREF="#lbBU">12. SISU FILETYPES</A><DD>
-<DT><A HREF="#lbBV">12.1 .SST .SSM .SSI MARKED UP PLAIN TEXT</A><DD>
-<DT><A HREF="#lbBW">12.1.1 SISU TEXT - REGULAR FILES (.SST)</A><DD>
-<DT><A HREF="#lbBX">12.1.2 SISU MASTER FILES (.SSM)</A><DD>
-<DT><A HREF="#lbBY">12.1.3 SISU INSERT FILES (.SSI)</A><DD>
-<DT><A HREF="#lbBZ">12.2 SISUPOD, ZIPPED BINARY CONTAINER (SISUPOD.ZIP, .SSP)</A><DD>
-<DT><A HREF="#lbCA">13. EXPERIMENTAL ALTERNATIVE INPUT REPRESENTATIONS</A><DD>
-<DT><A HREF="#lbCB">13.1 ALTERNATIVE XML</A><DD>
-<DT><A HREF="#lbCC">13.1.1 XML SAX REPRESENTATION</A><DD>
-<DT><A HREF="#lbCD">13.1.2 XML DOM REPRESENTATION</A><DD>
-<DT><A HREF="#lbCE">13.1.3 XML NODE REPRESENTATION</A><DD>
-<DT><A HREF="#lbCF">14. CONFIGURATION</A><DD>
-<DT><A HREF="#lbCG">14.1 DETERMINING THE CURRENT CONFIGURATION</A><DD>
-<DT><A HREF="#lbCH">14.2 CONFIGURATION FILES (CONFIG.YML)</A><DD>
-<DT><A HREF="#lbCI">15. SKINS</A><DD>
-<DT><A HREF="#lbCJ">15.1 DOCUMENT SKIN</A><DD>
-<DT><A HREF="#lbCK">15.2 DIRECTORY SKIN</A><DD>
-<DT><A HREF="#lbCL">15.3 SITE SKIN</A><DD>
-<DT><A HREF="#lbCM">15.4 SAMPLE SKINS</A><DD>
-<DT><A HREF="#lbCN">16. CSS - CASCADING STYLE SHEETS (FOR HTML, XHTML AND XML)</A><DD>
-<DT><A HREF="#lbCO">17. ORGANISING CONTENT - DIRECTORY STRUCTURE AND MAPPING</A><DD>
-<DT><A HREF="#lbCP">17.1 DOCUMENT SOURCE DIRECTORY</A><DD>
-<DT><A HREF="#lbCQ">17.1.1 GENERAL DIRECTORIES</A><DD>
-<DT><A HREF="#lbCR">17.2 DOCUMENT OUTPUT DIRECTORY STRUCTURES</A><DD>
-<DT><A HREF="#lbCS">17.2.1 OUTPUT DIRECTORY ROOT</A><DD>
-<DT><A HREF="#lbCT">17.2.2 ALTERNATIVE OUTPUT STRUCTURES</A><DD>
-<DT><A HREF="#lbCU">17.2.3 BY LANGUAGE</A><DD>
-<DT><A HREF="#lbCV">17.2.4 BY FILETYPE</A><DD>
-<DT><A HREF="#lbCW">17.2.5 BY FILENAME</A><DD>
-<DT><A HREF="#lbCX">17.2.6 REMOTE DIRECTORIES</A><DD>
-<DT><A HREF="#lbCY">17.2.7 SISUPOD</A><DD>
-<DT><A HREF="#lbCZ">17.3 ORGANISING CONTENT</A><DD>
-<DT><A HREF="#lbDA">18. HOMEPAGES</A><DD>
-<DT><A HREF="#lbDB">18.1 HOME PAGE AND OTHER CUSTOM BUILT PAGES IN A SUB-DIRECTORY</A><DD>
-<DT><A HREF="#lbDC">18.2 HOME PAGE WITHIN A SKIN</A><DD>
-<DT><A HREF="#lbDD">19. MARKUP AND OUTPUT EXAMPLES</A><DD>
-<DT><A HREF="#lbDE">19.1 MARKUP EXAMPLES</A><DD>
-<DT><A HREF="#lbDF">20. SISU SEARCH - INTRODUCTION</A><DD>
-<DT><A HREF="#lbDG">21. SQL</A><DD>
-<DT><A HREF="#lbDH">21.1 POPULATING SQL TYPE DATABASES</A><DD>
-<DT><A HREF="#lbDI">22. POSTGRESQL</A><DD>
-<DT><A HREF="#lbDJ">22.1 NAME</A><DD>
-<DT><A HREF="#lbDK">22.2 DESCRIPTION</A><DD>
-<DT><A HREF="#lbDL">22.3 SYNOPSIS</A><DD>
-<DT><A HREF="#lbDM">22.4 COMMANDS</A><DD>
-<DT><A HREF="#lbDN">22.4.1 CREATE AND DESTROY DATABASE</A><DD>
-<DT><A HREF="#lbDO">22.4.2 IMPORT AND REMOVE DOCUMENTS</A><DD>
-<DT><A HREF="#lbDP">23. SQLITE</A><DD>
-<DT><A HREF="#lbDQ">23.1 NAME</A><DD>
-<DT><A HREF="#lbDR">23.2 DESCRIPTION</A><DD>
-<DT><A HREF="#lbDS">23.3 SYNOPSIS</A><DD>
-<DT><A HREF="#lbDT">23.4 COMMANDS</A><DD>
-<DT><A HREF="#lbDU">23.4.1 CREATE AND DESTROY DATABASE</A><DD>
-<DT><A HREF="#lbDV">23.4.2 IMPORT AND REMOVE DOCUMENTS</A><DD>
-<DT><A HREF="#lbDW">24. INTRODUCTION</A><DD>
-<DT><A HREF="#lbDX">24.1 SEARCH - DATABASE FRONTEND SAMPLE, UTILISING DATABASE AND SISU FEATURES,</A><DD>
-<DT><A HREF="#lbDY">24.2 SEARCH FORM</A><DD>
-<DT><A HREF="#lbDZ">25. SISU_WEBRICK</A><DD>
-<DT><A HREF="#lbEA">25.1 NAME</A><DD>
-<DT><A HREF="#lbEB">25.2 SYNOPSIS</A><DD>
-<DT><A HREF="#lbEC">25.3 DESCRIPTION</A><DD>
-<DT><A HREF="#lbED">25.4 SUMMARY OF MAN PAGE</A><DD>
-<DT><A HREF="#lbEE">25.5 DOCUMENT PROCESSING COMMAND FLAGS</A><DD>
-<DT><A HREF="#lbEF">25.6 FURTHER INFORMATION</A><DD>
-<DT><A HREF="#lbEG">25.7 AUTHOR</A><DD>
-<DT><A HREF="#lbEH">25.8 SEE ALSO</A><DD>
-<DT><A HREF="#lbEI">26. REMOTE SOURCE DOCUMENTS</A><DD>
-<DT><A HREF="#lbEJ">REMOTE DOCUMENT OUTPUT</A><DD>
-<DT><A HREF="#lbEK">27. REMOTE OUTPUT</A><DD>
-<DT><A HREF="#lbEL">27.1 COMMANDS</A><DD>
-<DT><A HREF="#lbEM">27.2 CONFIGURATION</A><DD>
-<DT><A HREF="#lbEN">28. REMOTE SERVERS</A><DD>
-<DT><A HREF="#lbEO">29. QUICKSTART - GETTING STARTED HOWTO</A><DD>
-<DT><A HREF="#lbEP">29.1 INSTALLATION</A><DD>
-<DT><A HREF="#lbEQ">29.1.1 DEBIAN INSTALLATION</A><DD>
-<DT><A HREF="#lbER">29.1.2 RPM INSTALLATION</A><DD>
-<DT><A HREF="#lbES">29.1.3 INSTALLATION FROM SOURCE</A><DD>
-<DT><A HREF="#lbET">29.2 TESTING SISU, GENERATING OUTPUT</A><DD>
-<DT><A HREF="#lbEU">29.2.1 BASIC TEXT, PLAINTEXT, HTML, XML, ODF, EPUB</A><DD>
-<DT><A HREF="#lbEV">29.2.2 LATEX / PDF</A><DD>
-<DT><A HREF="#lbEW">29.2.3 RELATIONAL DATABASE - POSTGRESQL, SQLITE</A><DD>
-<DT><A HREF="#lbEX">29.3 GETTING HELP</A><DD>
-<DT><A HREF="#lbEY">29.3.1 THE MAN PAGES</A><DD>
-<DT><A HREF="#lbEZ">29.3.2 BUILT IN HELP</A><DD>
-<DT><A HREF="#lbFA">29.3.3 THE HOME PAGE</A><DD>
-<DT><A HREF="#lbFB">29.4 MARKUP SAMPLES</A><DD>
-<DT><A HREF="#lbFC">30. EDITOR FILES, SYNTAX HIGHLIGHTING</A><DD>
-<DT><A HREF="#lbFD">31. HOW DOES SISU WORK?</A><DD>
-<DT><A HREF="#lbFE">32. SUMMARY OF FEATURES</A><DD>
-<DT><A HREF="#lbFF">33. HELP SOURCES</A><DD>
-<DT><A HREF="#lbFG">33.1 MAN PAGES</A><DD>
-<DT><A HREF="#lbFH">33.2 SISU GENERATED OUTPUT - LINKS TO HTML</A><DD>
-<DT><A HREF="#lbFI">33.2.1 WWW.SISUDOC.ORG</A><DD>
-<DT><A HREF="#lbFJ">33.3 MAN2HTML</A><DD>
-<DT><A HREF="#lbFK">33.3.1 LOCALLY INSTALLED</A><DD>
-<DT><A HREF="#lbFL">33.3.2 WWW.JUS.UIO.NO/SISU</A><DD>
-<DT><A HREF="#lbFM">SEE ALSO</A><DD>
-<DT><A HREF="#lbFN">HOMEPAGE</A><DD>
-<DT><A HREF="#lbFO">AUTHOR</A><DD>
-</DL>
-<HR>
-This document was created by
-<A HREF="/cgi-bin/man/man2html">man2html</A>,
-using the manual pages.<BR>
-Time: 04:10:50 GMT, May 26, 2012
-</BODY>
-</HTML>
+<p> <br>
+</li><b>.</b><li>of this feature when demonstrated to an IBM software innovations evaluator
+in 2004 he said to paraphrase: this could be of interest to us. We have
+large document management systems, you can search hundreds of thousands
+of documents and we can tell you which documents meet your search criteria,
+but there is no way we can tell you without opening each document where
+within each your matches are found.
+<p> <br>
+
+<p> </li>
+</ol>
+
+<h2><a name='sect100' href='#toc100'>See Also</a></h2>
+ <a href='http:~/bin/man2html?sisu:1'>sisu(1)</a>
+,<br>
+ <a href='http:~/bin/man2html?sisu-epub:1'>sisu-epub(1)</a>
+,<br>
+ <a href='http:~/bin/man2html?sisu-harvest:1'>sisu-harvest(1)</a>
+,<br>
+ <a href='http:~/bin/man2html?sisu-html:1'>sisu-html(1)</a>
+,<br>
+ <a href='http:~/bin/man2html?sisu-odf:1'>sisu-odf(1)</a>
+,<br>
+ <a href='http:~/bin/man2html?sisu-pdf:1'>sisu-pdf(1)</a>
+,<br>
+ <a href='http:~/bin/man2html?sisu-pg:1'>sisu-pg(1)</a>
+,<br>
+ <a href='http:~/bin/man2html?sisu-sqlite:1'>sisu-sqlite(1)</a>
+,<br>
+ <a href='http:~/bin/man2html?sisu-txt:1'>sisu-txt(1)</a>
+.<br>
+ <a href='http:~/bin/man2html?sisu_vim:7'>sisu_vim(7)</a>
+<br>
+
+<h2><a name='sect101' href='#toc101'>Homepage</a></h2>
+ More information about SiSU can be found at &lt;<a href='http://www.sisudoc.org/'>http://www.sisudoc.org/</a>
+&gt;
+or &lt;<a href='http://www.jus.uio.no/sisu/'>http://www.jus.uio.no/sisu/</a>
+&gt;<br>
+
+<h2><a name='sect102' href='#toc102'>Source</a></h2>
+ &lt;<a href='http://sources.sisudoc.org/'>http://sources.sisudoc.org/</a>
+&gt;<br>
+
+<h2><a name='sect103' href='#toc103'>Author</a></h2>
+ SiSU is written by Ralph Amissah &lt;ralph@amissah.com&gt;<br>
+ <p>
+
+<hr><p>
+<a name='toc'><b>Table of Contents</b></a><p>
+<ul>
+<li><a name='toc0' href='#sect0'>Name</a></li>
+<li><a name='toc1' href='#sect1'>Synopsis</a></li>
+<li><a name='toc2' href='#sect2'>Sisu - Manual,</a></li>
+<li><a name='toc3' href='#sect3'>What is Sisu?</a></li>
+<li><a name='toc4' href='#sect4'>Introduction - What is Sisu?</a></li>
+<li><a name='toc5' href='#sect5'>Commands Summary</a></li>
+<li><a name='toc6' href='#sect6'>Description</a></li>
+<li><a name='toc7' href='#sect7'>Document Processing Command Flags</a></li>
+<li><a name='toc8' href='#sect8'>Command Line Modifiers</a></li>
+<li><a name='toc9' href='#sect9'>Database Commands</a></li>
+<li><a name='toc10' href='#sect10'>Shortcuts, Shorthand for Multiple Flags</a></li>
+<li><a name='toc11' href='#sect11'>Command Line with Flags - Batch Processing</a></li>
+<li><a name='toc12' href='#sect12'>Help</a></li>
+<li><a name='toc13' href='#sect13'>Sisu Manual</a></li>
+<li><a name='toc14' href='#sect14'>Sisu Man Pages</a></li>
+<li><a name='toc15' href='#sect15'>Sisu Built-in Interactive Help</a></li>
+<li><a name='toc16' href='#sect16'>Introduction to Sisu Markup[^11]</a></li>
+<li><a name='toc17' href='#sect17'>Summary</a></li>
+<li><a name='toc18' href='#sect18'>Markup Examples</a></li>
+<li><a name='toc19' href='#sect19'>Online</a></li>
+<li><a name='toc20' href='#sect20'>Installed</a></li>
+<li><a name='toc21' href='#sect21'>Markup of Headers</a></li>
+<li><a name='toc22' href='#sect22'>Sample Header</a></li>
+<li><a name='toc23' href='#sect23'>Available Headers</a></li>
+<li><a name='toc24' href='#sect24'>Markup of Substantive Text</a></li>
+<li><a name='toc25' href='#sect25'>Heading Levels</a></li>
+<li><a name='toc26' href='#sect26'>Font Attributes</a></li>
+<li><a name='toc27' href='#sect27'>Indentation and Bullets</a></li>
+<li><a name='toc28' href='#sect28'>Hanging Indents</a></li>
+<li><a name='toc29' href='#sect29'>Footnotes / Endnotes</a></li>
+<li><a name='toc30' href='#sect30'>Links</a></li>
+<li><a name='toc31' href='#sect31'>Naked Urls Within Text, Dealing with Urls</a></li>
+<li><a name='toc32' href='#sect32'>Linking Text</a></li>
+<li><a name='toc33' href='#sect33'>Linking Images</a></li>
+<li><a name='toc34' href='#sect34'>Link Shortcut for Multiple Versions of a Sisu Document in the Same Directory</a></li>
+<li><a name='toc35' href='#sect35'>Grouped Text</a></li>
+<li><a name='toc36' href='#sect36'>Tables</a></li>
+<li><a name='toc37' href='#sect37'>Poem</a></li>
+<li><a name='toc38' href='#sect38'>Group</a></li>
+<li><a name='toc39' href='#sect39'>Code</a></li>
+<li><a name='toc40' href='#sect40'>Additional Breaks - Linebreaks Within Objects, Column and Page-breaks</a></li>
+<li><a name='toc41' href='#sect41'>Line-breaks</a></li>
+<li><a name='toc42' href='#sect42'>Page Breaks</a></li>
+<li><a name='toc43' href='#sect43'>Book Index</a></li>
+<li><a name='toc44' href='#sect44'>Composite Documents Markup</a></li>
+<li><a name='toc45' href='#sect45'>Sisu Filetypes</a></li>
+<li><a name='toc46' href='#sect46'>.sst .ssm .ssi Marked Up Plain Text</a></li>
+<li><a name='toc47' href='#sect47'>Sisu Text - Regular Files (.sst)</a></li>
+<li><a name='toc48' href='#sect48'>Sisu Master Files (.ssm)</a></li>
+<li><a name='toc49' href='#sect49'>Sisu Insert Files (.ssi)</a></li>
+<li><a name='toc50' href='#sect50'>Sisupod, Zipped Binary Container (sisupod.zip, .ssp)</a></li>
+<li><a name='toc51' href='#sect51'>Configuration</a></li>
+<li><a name='toc52' href='#sect52'>Configuration Files</a></li>
+<li><a name='toc53' href='#sect53'>Config.yml</a></li>
+<li><a name='toc54' href='#sect54'>Sisu_document_make</a></li>
+<li><a name='toc55' href='#sect55'>Css - Cascading Style Sheets (for Html, Xhtml and Xml)</a></li>
+<li><a name='toc56' href='#sect56'>Organising Content - Directory Structure and Mapping</a></li>
+<li><a name='toc57' href='#sect57'>Document Source Directory</a></li>
+<li><a name='toc58' href='#sect58'>General Directories</a></li>
+<li><a name='toc59' href='#sect59'>Document Output Directory Structures</a></li>
+<li><a name='toc60' href='#sect60'>Output Directory Root</a></li>
+<li><a name='toc61' href='#sect61'>Alternative Output Structures</a></li>
+<li><a name='toc62' href='#sect62'>by Language</a></li>
+<li><a name='toc63' href='#sect63'>by Filetype</a></li>
+<li><a name='toc64' href='#sect64'>by Filename</a></li>
+<li><a name='toc65' href='#sect65'>Remote Directories</a></li>
+<li><a name='toc66' href='#sect66'>Sisupod</a></li>
+<li><a name='toc67' href='#sect67'>Organising Content</a></li>
+<li><a name='toc68' href='#sect68'>Homepages</a></li>
+<li><a name='toc69' href='#sect69'>Home Page and Other Custom Built Pages in a Sub-directory</a></li>
+<li><a name='toc70' href='#sect70'>Markup and Output Examples</a></li>
+<li><a name='toc71' href='#sect71'>Markup Examples</a></li>
+<li><a name='toc72' href='#sect72'>Sisu Markup Samples</a></li>
+<li><a name='toc73' href='#sect73'>Sisu Search - Introduction</a></li>
+<li><a name='toc74' href='#sect74'>Sql</a></li>
+<li><a name='toc75' href='#sect75'>Populating Sql Type Databases</a></li>
+<li><a name='toc76' href='#sect76'>Postgresql</a></li>
+<li><a name='toc77' href='#sect77'>Name</a></li>
+<li><a name='toc78' href='#sect78'>Description</a></li>
+<li><a name='toc79' href='#sect79'>Synopsis</a></li>
+<li><a name='toc80' href='#sect80'>Commands</a></li>
+<li><a name='toc81' href='#sect81'>Create and Destroy Database</a></li>
+<li><a name='toc82' href='#sect82'>Import and Remove Documents</a></li>
+<li><a name='toc83' href='#sect83'>Sqlite</a></li>
+<li><a name='toc84' href='#sect84'>Name</a></li>
+<li><a name='toc85' href='#sect85'>Description</a></li>
+<li><a name='toc86' href='#sect86'>Synopsis</a></li>
+<li><a name='toc87' href='#sect87'>Commands</a></li>
+<li><a name='toc88' href='#sect88'>Create and Destroy Database</a></li>
+<li><a name='toc89' href='#sect89'>Import and Remove Documents</a></li>
+<li><a name='toc90' href='#sect90'>Introduction</a></li>
+<li><a name='toc91' href='#sect91'>Search - Database Frontend Sample, Utilising Database and Sisu Features,</a></li>
+<li><a name='toc92' href='#sect92'>Search Form</a></li>
+<li><a name='toc93' href='#sect93'>Sisu_webrick</a></li>
+<li><a name='toc94' href='#sect94'>Name</a></li>
+<li><a name='toc95' href='#sect95'>Synopsis</a></li>
+<li><a name='toc96' href='#sect96'>Description</a></li>
+<li><a name='toc97' href='#sect97'>Summary of Man Page</a></li>
+<li><a name='toc98' href='#sect98'>Document Processing Command Flags</a></li>
+<li><a name='toc99' href='#sect99'>Summary of Features</a></li>
+<li><a name='toc100' href='#sect100'>See Also</a></li>
+<li><a name='toc101' href='#sect101'>Homepage</a></li>
+<li><a name='toc102' href='#sect102'>Source</a></li>
+<li><a name='toc103' href='#sect103'>Author</a></li>
+</ul>
+</body>
+</html>
diff --git a/data/doc/sisu/html/sisu4.1.html b/data/doc/sisu/html/sisu4.1.html
new file mode 100644
index 00000000..345e574b
--- /dev/null
+++ b/data/doc/sisu/html/sisu4.1.html
@@ -0,0 +1,3693 @@
+<!-- manual page source format generated by PolyglotMan v3.2, -->
+<!-- available at http://polyglotman.sourceforge.net/ -->
+
+<html>
+<head>
+<title>"sisu"("1") manual page</title>
+</head>
+<body bgcolor='white'>
+<a href='#toc'>Table of Contents</a><p>
+<br>
+
+<h2><a name='sect0' href='#toc0'>Name</a></h2>
+<br>
+sisu - documents: markup, structuring, publishing in multiple standard formats,
+and search <br>
+
+<h2><a name='sect1' href='#toc1'>Synopsis</a></h2>
+<br>
+sisu [-short-options|--long-options] [filename/wildcard]
+<p> <br>
+sisu [-abCcDdeFGghIikLMmNnoPpQqRrSsTtUuVvWwXxYyZ_0-9] [filename/wildcard]
+
+<p> <br>
+sisu --txt --html --epub --odt --pdf --wordmap --sqlite --manpage --texinfo --sisupod --source
+--qrcode [filename/wildcard]
+<p> <br>
+sisu [-Ddcv] [instruction] [filename/wildcard]
+<p> <br>
+sisu --pg (--createdb|update [filename/wildcard]|--dropall)
+<p> <br>
+sisu [operations]
+<p> <br>
+sisu [-CcFLSVvW]
+<p> <br>
+sisu (--configure|--webrick|--sample-search-form)
+<h2><a name='sect2' href='#toc2'>Sisu - Manual,</a></h2>
+RALPH AMISSAH <br>
+
+<p>
+<h2><a name='sect3' href='#toc3'>What is Sisu?</a></h2>
+<br>
+
+<p>
+<h2><a name='sect4' href='#toc4'>Introduction - What is Sisu?</a></h2>
+<br>
+
+<p> <br>
+<b>SiSU</b> is a framework for document structuring, publishing (in multiple open
+standard formats) and search, comprising of: (a) a lightweight document
+structure and presentation markup syntax; and (b) an accompanying engine
+for generating standard document format outputs from documents prepared
+in sisu markup syntax, which is able to produce multiple standard outputs
+(including the population of sql databases) that (can) share a common numbering
+system for the citation of text within a document.
+<p> <br>
+<b>SiSU</b> is developed under an open source, software libre license ( <i>GPLv3</i>
+). Its use case for development is work with medium to large document sets
+and cope with evolving document formats/ representation technologies. Documents
+are prepared once, and generated as need be to update the technical presentation
+or add additional output formats. Various output formats (including search
+related output) share a common mechanism for cross-output-format citation.
+
+<p> <br>
+<b>SiSU</b> both defines a markup syntax and provides an engine that produces
+open standards format outputs from documents prepared with <b>SiSU</b> markup.
+From a single lightly prepared document sisu custom builds several standard
+output formats which share a common (text object) numbering system for
+citation of content within a document (that also has implications for search).
+The sisu engine works with an abstraction of the document&rsquo;s structure and
+content from which it is possible to generate different forms of representation
+of the document. Significantly <b>SiSU</b> markup is more sparse than html and
+outputs which include <i>HTML,</i> <i>EPUB,</i> <i>ODT</i> (Open Document Format text), <i>LaTeX,</i>
+landscape and portrait <i>PDF,</i> all of which can be added to and updated. <b>SiSU</b>
+is also able to populate <i>SQL</i> type databases at an object level, which means
+that searches can be made with that degree of granularity.
+<p> <br>
+Source document preparation and output generation is a two step process:
+(i) document source is prepared, that is, marked up in sisu markup syntax
+and (ii) the desired output subsequently generated by running the sisu
+engine against document source. Output representations if updated (in the
+sisu engine) can be generated by re-running the engine against the prepared
+source. Using <b>SiSU</b> markup applied to a document, <b>SiSU</b> custom builds (to
+take advantage of the strengths of different ways of representing documents)
+various standard open output formats including plain text, <i>HTML,</i> <i>XHTML,</i>
+<i>XML,</i> <i>EPUB,</i> <i>ODT,</i> <i>LaTeX</i> or <i>PDF</i> files, and populate an <i>SQL</i> database with objects[^1]
+(equating generally to paragraph-sized chunks) so searches may be performed
+and matches returned with that degree of granularity ( e.g. your search criteria
+is met by these documents and at these locations within each document).
+Document output formats share a common object numbering system for locating
+content. This is particularly suitable for "published" works (finalized
+texts as opposed to works that are frequently changed or updated) for which
+it provides a fixed means of reference of content.
+<p> <br>
+In preparing a <b>SiSU</b> document you optionally provide semantic information
+related to the document in a document header, and in marking up the substantive
+text provide information on the structure of the document, primarily indicating
+heading levels and footnotes. You also provide information on basic text
+attributes where used. The rest is automatic, sisu from this information
+custom builds[^2] the different forms of output requested.
+<p> <br>
+<b>SiSU</b> works with an abstraction of the document based on its structure which
+is comprised of its headings[^3] and objects[^4], which enables <b>SiSU</b> to represent
+the document in many different ways, and to take advantage of the strengths
+of different ways of presenting documents. The objects are numbered, and
+these numbers can be used to provide a common basis for citing material
+within a document across the different output format types. This is significant
+as page numbers are not well suited to the digital age, in web publishing,
+changing a browser&rsquo;s default font or using a different browser can mean
+that text will appear on a different page; and publishing in different
+formats, html, landscape and portrait pdf etc. again page numbers are not
+useful to cite text. Dealing with documents at an object level together
+with object numbering also has implications for search that <b>SiSU</b> is able
+to take advantage of.
+<p> <br>
+One of the challenges of maintaining documents is to keep them in a format
+that allows use of them independently of proprietary platforms. Consider
+issues related to dealing with legacy proprietary formats today and what
+guarantee you have that old proprietary formats will remain (or can be
+read without proprietary software/equipment) in 15 years time, or the way
+the way in which html has evolved over its relatively short span of existence.
+<b>SiSU</b> provides the flexibility of producing documents in multiple non-proprietary
+open formats including <i>HTML,</i> <i>EPUB,</i> [^5] <i>ODT,</i> [^6] <i>PDF</i> [^7] <i>ODF,</i> [^8]. Whilst
+<b>SiSU</b> relies on software, the markup is uncomplicated and minimalistic which
+guarantees that future engines can be written to run against it. It is also
+easily converted to other formats, which means documents prepared in <b>SiSU</b>
+can be migrated to other document formats. Further security is provided
+by the fact that the software itself, <b>SiSU</b> is available under <i>GPLv3</i> a licence
+that guarantees that the source code will always be open, and free as in
+libre, which means that that code base can be used, updated and further
+developed as required under the terms of its license. Another challenge
+is to keep up with a moving target. <b>SiSU</b> permits new forms of output to
+be added as they become important, (Open Document Format text was added
+in 2006 when it became an ISO standard for office applications and the
+archival of documents), <i>EPUB</i> was introduced in 2009; and allows the technical
+representations existing output to be updated ( <i>HTML</i> has evolved and the
+related module has been updated repeatedly over the years, presumably when
+the World Wide Web Consortium (w3c) finalises <i>HTML</i> 5 which is currently
+under development, the <i>HTML</i> module will again be updated allowing all existing
+documents to be regenerated as <i>HTML</i> 5).
+<p> <br>
+The document formats are written to the file-system and available for indexing
+by independent indexing tools, whether off the web like Google and Yahoo
+or on the site like Lucene and Hyperestraier.
+<p> <br>
+<b>SiSU</b> also provides other features such as concordance files and document
+content certificates, and the working against an abstraction of document
+structure has further possibilities for the research and development of
+other document representations, the availability of objects is useful for
+example for topic maps and thesauri, together with the flexibility of <b>SiSU</b>
+offers great possibilities.
+<p> <br>
+<b>SiSU</b> is primarily for published works, which can take advantage of the
+citation system to reliably reference its documents. <b>SiSU</b> works well in
+a complementary manner with such collaborative technologies as Wikis, which
+can take advantage of and be used to discuss the substance of content prepared
+in <b>SiSU.</b>
+<p> <br>
+&lt;<a href='http://www.sisudoc.org/'>http://www.sisudoc.org/</a>
+&gt;
+<p> <br>
+&lt;<a href='http://www.jus.uio.no/sisu'>http://www.jus.uio.no/sisu</a>
+&gt;
+<p>
+<h2><a name='sect5' href='#toc5'>Commands Summary</a></h2>
+<br>
+
+<p>
+<h2><a name='sect6' href='#toc6'>Description</a></h2>
+
+<p> <br>
+<b>SiSU</b> is a document publishing system, that from a simple single marked-up
+document, produces multiple output formats including: <i>plaintext,</i> <i>HTML,</i>
+<i>XHTML,</i> <i>XML,</i> <i>EPUB,</i> <i>ODT</i> ( <i>OpenDocument</i> ( <i>ODF</i> ) text), <i>LaTeX,</i> <i>PDF,</i> info, and
+<i>SQL</i> ( <i>PostgreSQL</i> and <i>SQLite</i> ) , which share text object numbers ("object
+citation numbering") and the same document structure information. For more
+see: &lt;<a href='http://sisudoc.org'>http://sisudoc.org</a>
+&gt; or &lt;<a href='http://www.jus.uio.no/sisu'>http://www.jus.uio.no/sisu</a>
+&gt;
+<p>
+<h2><a name='sect7' href='#toc7'>Document Processing
+Command Flags</a></h2>
+
+<p>
+<dl>
+
+<dt><b>-a [filename/wildcard]</b> </dt>
+<dd>produces <i>plaintext</i> with Unix linefeeds
+and without markup, (object numbers are omitted), has footnotes at end
+of each paragraph that contains them [ &nbsp;-A &nbsp;for &nbsp;output &nbsp;file] [see &nbsp;-e &nbsp;for &nbsp;endnotes].
+(Options include: --endnotes for endnotes --footnotes for footnotes at the
+end of each paragraph --unix for unix linefeed (default) --msdos for msdos
+linefeed)
+<p> </dd>
+
+<dt><b>-b [filename/wildcard]</b> </dt>
+<dd>see --xhtml
+<p> </dd>
+
+<dt><b>--by-*</b> </dt>
+<dd>see --output-by-*
+<p> </dd>
+
+<dt><b>-C</b> </dt>
+<dd>configure/initialise
+shared output directory files initialize shared output directory (config
+files such as css and dtd files are not updated if they already exist unless
+modifier is used). -C --init-site configure/initialise site more extensive than
+-C on its own, shared output directory files/force update, existing shared
+output config files such as css and dtd files are updated if this modifier
+is used.
+<p> </dd>
+
+<dt><b>-CC</b> </dt>
+<dd>see --configure
+<p> </dd>
+
+<dt><b>-c [filename/wildcard]</b> </dt>
+<dd>see --color-toggle
+<p> </dd>
+
+<dt><b>--color-toggle
+[filename/wildcard]</b> </dt>
+<dd>screen toggle ansi screen colour on or off depending
+on default set (unless -c flag is used: if sisurc colour default is set
+to &rsquo;true&rsquo;, output to screen will be with colour, if sisurc colour default
+is set to &rsquo;false&rsquo; or is undefined screen output will be without colour). Alias
+
+<p>-
+<p>c
+<p> </dd>
+
+<dt><b>--configure</b> </dt>
+<dd>configure/initialise shared output directory files initialize
+shared output directory (config files such as css and dtd files are not
+updated if they already exist unless modifier is used). The equivalent of:
+-C --init-site configure/initialise site, more extensive than -C on its own,
+shared output directory files/force update, existing shared output config
+files such as css and dtd files are updated if -CC is used.
+<p> </dd>
+
+<dt><b>--concordance
+[filename/wildcard]</b> </dt>
+<dd>produces concordance (wordmap) a rudimentary index
+of all the words in a document. (Concordance files are not generated for
+documents of over 260,000 words unless this limit is increased in the file
+sisurc.yml). Alias -w
+<p> </dd>
+
+<dt><b>-D [instruction] [filename]</b> </dt>
+<dd>see --pg
+<p> </dd>
+
+<dt><b>-d [--db-[database &nbsp;type
+&nbsp;(sqlite|pg)]] --[instruction] [filename]</b> </dt>
+<dd>see --sqlite
+<p> </dd>
+
+<dt><b>--dal [filename/wildcard/url]</b>
+</dt>
+<dd>assumed for most other flags, creates new intermediate files for processing
+(document abstraction) that is used in all subsequent processing of other
+output. This step is assumed for most processing flags. To skip it see -n.
+
+<p>Alias -m
+<p> </dd>
+
+<dt><b>--delete [filename/wildcard]</b> </dt>
+<dd>see --zap
+<p> </dd>
+
+<dt><b>--dump[=directory_path] [filename/wildcard]</b>
+</dt>
+<dd>places output in directory specified, if none is specified in the current
+directory (pwd). Compare --redirect
+<p> </dd>
+
+<dt><b>-e [filename/wildcard]</b> </dt>
+<dd>see --epub
+<p> </dd>
+
+<dt><b>--epub
+[filename/wildcard]</b> </dt>
+<dd>produces an epub document, [sisu &nbsp;version &nbsp;&gt;=2 &nbsp;] (filename.epub).
+
+<p>Alias -e
+<p> </dd>
+
+<dt><b>--exc-*</b> </dt>
+<dd>exclude output feature, overrides configuration settings
+--exc- <i>ocn,</i> (exclude <i>object</i> citation numbering, (switches off <i>object</i> citation
+numbering ) , affects html (seg, scroll), epub, xhtml, xml, pdf) ; --exc-toc,
+(exclude table of contents, affects html (scroll), epub, pdf) ; --exc-links-to-manifest,
+--exc-manifest-links, (exclude links to manifest, affects html (seg, scroll));
+--exc-search-form, (exclude search form, affects html (seg, scroll), manifest);
+--exc-minitoc, (exclude mini table of contents, affects html (seg), concordance,
+manifest); --exc-manifest-minitoc, (exclude mini table of contents, affects
+manifest); --exc-html-minitoc, (exclude mini table of contents, affects html
+(seg), concordance); --exc-html-navigation, (exclude navigation, affects html
+(seg)); --exc-html-navigation-bar, (exclude navigation bar, affects html (seg));
+--exc-html-search-form, (exclude search form, affects html (seg, scroll)); --exc-html-right-pane,
+(exclude right pane/column, affects html (seg, scroll)); --exc-html-top-band,
+(exclude top band, affects html (seg, scroll), concordance (minitoc forced
+on to provide seg navigation)); --exc-segsubtoc (exclude sub table of contents,
+affects html (seg), epub) ; see also --inc-*
+<p> </dd>
+
+<dt><b>-F [--webserv=webrick]</b> </dt>
+<dd>see --sample-search-form
+
+<p> </dd>
+
+<dt><b>-f [optional &nbsp;string &nbsp;part &nbsp;of &nbsp;filename]</b> </dt>
+<dd>see --find
+<p> </dd>
+
+<dt><b>--find [optional &nbsp;string &nbsp;part
+&nbsp;of &nbsp;filename]</b> </dt>
+<dd>without match string, glob all .sst .ssm files in directory
+(including language subdirectories). With match string, find files that
+match given string in directory (including language subdirectories). Alias
+-f, --glob, -G
+<p> </dd>
+
+<dt><b>-G [optional &nbsp;string &nbsp;part &nbsp;of &nbsp;filename]</b> </dt>
+<dd>see --find
+<p> </dd>
+
+<dt><b>-g [filename/wildcard]</b>
+</dt>
+<dd>
+<p>see --git
+<p> </dd>
+
+<dt><b>--git [filename/wildcard]</b> </dt>
+<dd>produces or updates markup source file
+structure in a git repo (experimental and subject to change). Alias -g
+<p> </dd>
+
+<dt><b>--glob
+[optional &nbsp;string &nbsp;part &nbsp;of &nbsp;filename]</b> </dt>
+<dd>see --find
+<p> </dd>
+
+<dt><b>-h [filename/wildcard]</b> </dt>
+<dd>see
+
+<p>-
+<p>-
+<p>html
+<p> </dd>
+
+<dt><b>--harvest *.ss[tm]</b> </dt>
+<dd>makes two lists of sisu output based on the sisu
+markup documents in a directory: list of author and authors works (year
+and titles), and; list by topic with titles and author. Makes use of header
+metadata fields (author, title, date, topic_register). Can be used with
+maintenance (-M) and remote placement (-R) flags.
+<p> </dd>
+
+<dt><b>--help [topic]</b> </dt>
+<dd>provides help
+on the selected topic, where topics (keywords) include: list, (com)mands,
+short(cuts), (mod)ifiers, (env)ironment, markup, syntax, headers, headings,
+endnotes, tables, example, customise, skin, (dir)ectories, path, (lang)uage,
+db, install, setup, (conf)igure, convert, termsheet, search, sql, features,
+license.
+<p> </dd>
+
+<dt><b>--html [filename/wildcard]</b> </dt>
+<dd>produces html output, segmented text
+with table of contents (toc.html and index.html) and the document in a single
+file (scroll.html). Alias -h
+<p> </dd>
+
+<dt><b>-I [filename/wildcard]</b> </dt>
+<dd>see --texinfo
+<p> </dd>
+
+<dt><b>-i [filename/wildcard]</b>
+</dt>
+<dd>
+<p>see --manpage
+<p> </dd>
+
+<dt><b>--inc-*</b> </dt>
+<dd>include output feature, overrides configuration settings,
+(usually the default if none set), has precedence over --exc-* (exclude output
+feature). Some detail provided under --exc-*, see --exc-*
+<p> </dd>
+
+<dt><b>-j [filename/wildcard]</b>
+</dt>
+<dd>copies images associated with a file for use by html, xhtml &amp; xml outputs
+(automatically invoked by --dump &amp; redirect).
+<p> </dd>
+
+<dt><b>--keep-processing-files [filename/wildcard/url]</b>
+</dt>
+<dd>
+<p>see --maintenance
+<p> </dd>
+
+<dt><b>-L</b> </dt>
+<dd>prints license information.
+<p> </dd>
+
+<dt><b>-M [filename/wildcard/url]</b>
+</dt>
+<dd>
+<p>see --maintenance
+<p> </dd>
+
+<dt><b>-m [filename/wildcard/url]</b> </dt>
+<dd>see --dal (document abstraction
+level/layer)
+<p> </dd>
+
+<dt><b>--machine [filename/wildcard/url]</b> </dt>
+<dd>see --dal (document abstraction
+level/layer)
+<p> </dd>
+
+<dt><b>--maintenance [filename/wildcard/url]</b> </dt>
+<dd>maintenance mode, interim
+processing files are preserved and their locations indicated. (also see
+-V). Aliases -M and --keep-processing-files.
+<p> </dd>
+
+<dt><b>--manpage [filename/wildcard]</b> </dt>
+<dd>produces
+man page of file, not suitable for all outputs. Alias -i
+<p> </dd>
+
+<dt><b>-N [filename/wildcard/url]</b>
+</dt>
+<dd>document digest or document content certificate ( DCC ) as md5 digest tree
+of the document: the digest for the document, and digests for each object
+contained within the document (together with information on software versions
+that produced it) (digest.txt). -NV for verbose digest output to screen.
+<p> </dd>
+
+<dt><b>-n
+[filename/wildcard/url]</b> </dt>
+<dd>skip the creation of intermediate processing files
+(document abstraction) if they already exist, this skips the equivalent
+of -m which is otherwise assumed by most processing flags.
+<p> </dd>
+
+<dt><b>--no-*</b> </dt>
+<dd>see --exc-*
+
+<p> </dd>
+
+<dt><b>-o [filename/wildcard/url]</b> </dt>
+<dd>see --odt
+<p> </dd>
+
+<dt><b>--odf [filename/wildcard/url]</b> </dt>
+<dd>see --odt
+
+<p> </dd>
+
+<dt><b>--odt [filename/wildcard/url]</b> </dt>
+<dd>output basic document in opendocument file
+format (opendocument.odt). Alias -o
+<p> </dd>
+
+<dt><b>--output-by-*</b> </dt>
+<dd>select output directory structure
+from 3 alternatives: --output-by-language, (language directory (based on language
+code) with filetype (html, epub, pdf etc.) subdirectories); --output-by-filetype,
+(filetype directories with language code as part of filename); --output-by-filename,
+(filename directories with language code as part of filename). This is configurable.
+Alias --by-*
+<p> </dd>
+
+<dt><b>-P [language_directory/filename &nbsp;language_directory]</b> </dt>
+<dd>see --po4a
+
+<p> </dd>
+
+<dt><b>-p [filename/wildcard]</b> </dt>
+<dd>see --pdf
+<p> </dd>
+
+<dt><b>--pdf [filename/wildcard]</b> </dt>
+<dd>produces <i>LaTeX</i>
+pdf (portrait.pdf &amp; landscape.pdf). Default paper size is set in config file,
+or document header, or provided with additional command line parameter,
+e.g. --papersize-a4 preset sizes include: &rsquo;A4&rsquo;, U.S. &rsquo;letter&rsquo; and &rsquo;legal&rsquo; and book sizes
+&rsquo;A5&rsquo; and &rsquo;B5&rsquo; (system defaults to A4). Alias -p
+<p> </dd>
+
+<dt><b>--pg [instruction] [filename]</b>
+</dt>
+<dd>database <i>PostgreSQL</i> ( --pgsql may be used instead) possible instructions,
+include: --createdb; --create; --dropall; --import [filename]; --update [filename];
+--remove [filename]; see database section below. Alias -D
+<p> </dd>
+
+<dt><b>--po [language_directory/filename
+&nbsp;language_directory]</b> </dt>
+<dd>see --po4a
+<p> </dd>
+
+<dt><b>--po4a [language_directory/filename &nbsp;language_directory]</b>
+</dt>
+<dd>produces .pot and po files for the file in the languages specified by the
+language directory. <b>SiSU</b> markup is placed in subdirectories named with the
+language code, e.g. en/ fr/ es/. The sisu config file must set the output
+directory structure to multilingual. v3, experimental
+<p> </dd>
+
+<dt><b>-Q [filename/wildcard]</b>
+</dt>
+<dd>
+<p>see --qrcode
+<p> </dd>
+
+<dt><b>-q [filename/wildcard]</b> </dt>
+<dd>see --quiet
+<p> </dd>
+
+<dt><b>--qrcode [filename/wildcard]</b>
+</dt>
+<dd>generate QR code image of metadata (used in manifest). v3 only.
+<p> </dd>
+
+<dt><b>--quiet [filename/wildcard]</b>
+</dt>
+<dd>quiet less output to screen.
+<p> </dd>
+
+<dt><b>-R [filename/wildcard]</b> </dt>
+<dd>see --rsync
+<p> </dd>
+
+<dt><b>-r [filename/wildcard]</b>
+</dt>
+<dd>
+<p>see --scp
+<p> </dd>
+
+<dt><b>--redirect[=directory_path] [filename/wildcard]</b> </dt>
+<dd>places output in
+subdirectory under specified directory, subdirectory uses the filename
+(without the suffix). If no output directory is specified places the subdirectory
+under the current directory (pwd). Compare --dump
+<p> </dd>
+
+<dt><b>--rsync [filename/wildcard]</b>
+</dt>
+<dd>copies sisu output files to remote host using rsync. This requires that
+sisurc.yml has been provided with information on hostname and username,
+and that you have your "keys" and ssh agent in place. Note the behavior
+of rsync different if -R is used with other flags from if used alone. Alone
+the rsync --delete parameter is sent, useful for cleaning the remote directory
+(when -R is used together with other flags, it is not). Also see --scp. Alias
+
+<p>-
+<p>R
+<p> </dd>
+
+<dt><b>-S</b> </dt>
+<dd>see --sisupod
+<p> </dd>
+
+<dt><b>-S [filename/wildcard]</b> </dt>
+<dd>see --sisupod
+<p> </dd>
+
+<dt><b>-s [filename/wildcard]</b>
+</dt>
+<dd>
+<p>see --source
+<p> </dd>
+
+<dt><b>--sample-search-form [--webserv=webrick]</b> </dt>
+<dd>generate examples of (naive)
+cgi search form for <i>SQLite</i> and PgSQL depends on your already having used
+sisu to populate an <i>SQLite</i> and/or PgSQL database, (the <i>SQLite</i> version scans
+the output directories for existing sisu_sqlite databases, so it is first
+necessary to create them, before generating the search form) see -d -D and
+the database section below. If the optional parameter --webserv=webrick is
+passed, the cgi examples created will be set up to use the default port
+set for use by the webrick server, (otherwise the port is left blank and
+the system setting used, usually 80). The samples are dumped in the present
+work directory which must be writable, (with screen instructions given
+that they be copied to the cgi-bin directory). Alias -F
+<p> </dd>
+
+<dt><b>--scp [filename/wildcard]</b>
+</dt>
+<dd>copies sisu output files to remote host using scp. This requires that sisurc.yml
+has been provided with information on hostname and username, and that you
+have your "keys" and ssh agent in place. Also see --rsync. Alias -r
+<p> </dd>
+
+<dt><b>--sqlite
+--[instruction] [filename]</b> </dt>
+<dd>database type set to <i>SQLite,</i> this produces one
+of two possible databases, without additional database related instructions
+it produces a discreet <i>SQLite</i> file for the document processed; with additional
+instructions it produces a common <i>SQLite</i> database of all processed documents
+that (come from the same document preparation directory and as a result)
+share the same output directory base path (possible instructions include:
+--createdb; --create; --dropall; --import [filename]; --update [filename]; --remove
+[filename]); see database section below. Alias -d
+<p> </dd>
+
+<dt><b>--sisupod</b> </dt>
+<dd>produces a sisupod
+a zipped sisu directory of markup files including sisu markup source files
+and the directories local configuration file, images and skins. Note: this
+only includes the configuration files or skins contained in ./_sisu not
+those in ~/.sisu -S [filename/wildcard] option. Note: (this<br>
+ option is tested only with zsh). Alias -S
+<p> </dd>
+
+<dt><b>--sisupod [filename/wildcard]</b> </dt>
+<dd>produces
+a zipped file of the prepared document specified along with associated
+images, by default named sisupod.zip they may alternatively be named with
+the filename extension .ssp This provides a quick way of gathering the relevant
+parts of a sisu document which can then for example be emailed. A sisupod
+includes sisu markup source file, (along with associated documents if a
+master file, or available in multilingual versions), together with related
+images and skin. <b>SiSU</b> commands can be run directly against a sisupod contained
+in a local directory, or provided as a url on a remote site. As there is
+a security issue with skins provided by other users, they are not applied
+unless the flag --trust or --trusted is added to the command instruction, it
+is recommended that file that are not your own are treated as untrusted.
+The directory structure of the unzipped file is understood by sisu, and
+sisu commands can be run within it. Note: if you wish to send multiple files,
+it quickly becomes more space efficient to zip the sisu markup directory,
+rather than the individual files for sending). See the -S option without
+[filename/wildcard]. Alias -S
+<p> </dd>
+
+<dt><b>--source [filename/wildcard]</b> </dt>
+<dd>copies sisu markup
+file to output directory. Alias -s
+<p> </dd>
+
+<dt><b>-T [filename/wildcard &nbsp;(*.termsheet.rb)]</b>
+</dt>
+<dd>standard form document builder, preprocessing feature
+<p> </dd>
+
+<dt><b>-t [filename/wildcard]</b>
+</dt>
+<dd>
+<p>see --txt
+<p> </dd>
+
+<dt><b>--texinfo [filename/wildcard]</b> </dt>
+<dd>produces texinfo and info file, (view
+with pinfo). Alias -I
+<p> </dd>
+
+<dt><b>--txt [filename/wildcard]</b> </dt>
+<dd>produces <i>plaintext</i> with Unix
+linefeeds and without markup, (object numbers are omitted), has footnotes
+at end of each paragraph that contains them [ &nbsp;-A &nbsp;for &nbsp;output &nbsp;file] [see &nbsp;-e
+&nbsp;for &nbsp;endnotes]. (Options include: --endnotes for endnotes --footnotes for footnotes
+at the end of each paragraph --unix for unix linefeed (default) --msdos for
+msdos linefeed). Alias -t
+<p> </dd>
+
+<dt><b>-U [filename/wildcard]</b> </dt>
+<dd>see --urls
+<p> </dd>
+
+<dt><b>-u [filename/wildcard]</b>
+</dt>
+<dd>provides url mapping of output files for the flags requested for processing,
+
+<p>also see -U
+<p> </dd>
+
+<dt><b>--urls [filename/wildcard]</b> </dt>
+<dd>prints url output list/map for the
+available processing flags options and resulting files that could be requested,
+(can be used to get a list of processing options in relation to a file,
+together with information on the output that would be produced), -u provides
+url output mapping for those flags requested for processing. The default
+assumes sisu_webrick is running and provides webrick url mappings where
+appropriate, but these can be switched to file system paths in sisurc.yml.
+
+<p>Alias -U
+<p> </dd>
+
+<dt><b>-V</b> </dt>
+<dd>on its own, provides <b>SiSU</b> version and environment information
+(sisu --help env)
+<p> </dd>
+
+<dt><b>-V [filename/wildcard]</b> </dt>
+<dd>even more verbose than the -v flag.
+
+<p> </dd>
+
+<dt><b>-v</b> </dt>
+<dd>on its own, provides <b>SiSU</b> version information
+<p> </dd>
+
+<dt><b>-v [filename/wildcard]</b>
+</dt>
+<dd>
+<p>see --verbose
+<p> </dd>
+
+<dt><b>--v3 [filename/wildcard]</b> </dt>
+<dd>invokes the sisu v3 document parser/generator.
+You may run sisu3 instead.
+<p> </dd>
+
+<dt><b>--v4 [filename/wildcard]</b> </dt>
+<dd>invokes the sisu v4 document
+parser/generator. This is the default and is normally omitted.
+<p> </dd>
+
+<dt><b>--verbose [filename/wildcard]</b>
+</dt>
+<dd>provides verbose output of what is being generated, where output is placed
+(and error messages if any), as with -u flag provides a url mapping of files
+created for each of the processing flag requests. Alias -v
+<p> </dd>
+
+<dt><b>-W</b> </dt>
+<dd>see --webrick
+
+<p> </dd>
+
+<dt><b>-w [filename/wildcard]</b> </dt>
+<dd>see --concordance
+<p> </dd>
+
+<dt><b>--webrick</b> </dt>
+<dd>starts ruby&rsquo; s webrick webserver
+points at sisu output directories, the default port is set to 8081 and
+can be changed in the resource configuration files. [tip: &nbsp;the &nbsp;webrick &nbsp;server
+&nbsp;requires &nbsp;link &nbsp;suffixes, &nbsp;so &nbsp;html output &nbsp;should &nbsp;be &nbsp;created &nbsp;using &nbsp;the &nbsp;-h &nbsp;option
+&nbsp;rather &nbsp;than &nbsp;also, &nbsp;note &nbsp;-F &nbsp;webrick &nbsp;]. Alias -W
+<p> </dd>
+
+<dt><b>--wordmap [filename/wildcard]</b>
+</dt>
+<dd>
+<p>see --concordance
+<p> </dd>
+
+<dt><b>--xhtml [filename/wildcard]</b> </dt>
+<dd>produces xhtml/ <i>XML</i> output for
+browser viewing (sax parsing). Alias -b
+<p> </dd>
+
+<dt><b>--xml-dom [filename/wildcard]</b> </dt>
+<dd>produces
+<i>XML</i> output with deep document structure, in the nature of dom. Alias -X
+<p>
+</dd>
+
+<dt><b>--xml-sax [filename/wildcard]</b> </dt>
+<dd>produces <i>XML</i> output shallow structure (sax parsing).
+
+<p>Alias -x
+<p> </dd>
+
+<dt><b>-X [filename/wildcard]</b> </dt>
+<dd>see --xml-dom
+<p> </dd>
+
+<dt><b>-x [filename/wildcard]</b> </dt>
+<dd>see --xml-sax
+
+<p> </dd>
+
+<dt><b>-Y [filename/wildcard]</b> </dt>
+<dd>produces a short sitemap entry for the document,
+based on html output and the sisu_manifest. --sitemaps generates/updates the
+sitemap index of existing sitemaps. (Experimental, [g,y,m &nbsp;announcement &nbsp;this
+&nbsp;week])
+<p> </dd>
+
+<dt><b>-y [filename/wildcard]</b> </dt>
+<dd>produces an html summary of output generated
+(hyperlinked to content) and document specific metadata (sisu_manifest.html).
+This step is assumed for most processing flags.
+<p> </dd>
+
+<dt><b>-Z [filename/wildcard]</b> </dt>
+<dd>see
+
+<p>-
+<p>-
+<p>zap
+<p> </dd>
+
+<dt><b>--zap [filename/wildcard]</b> </dt>
+<dd>Zap, if used with other processing flags deletes
+output files of the type about to be processed, prior to processing. If
+-Z is used as the lone processing related flag (or in conjunction with a
+combination of -[mMvVq]), will remove the related document output directory.
+
+<p>Alias -Z
+<p> </dd>
+</dl>
+
+<h2><a name='sect8' href='#toc8'>Command Line Modifiers</a></h2>
+<br>
+
+<p>
+<dl>
+
+<dt><b>--no-</b> </dt>
+<dd><i>ocn</i> [with &nbsp;--html &nbsp;--pdf &nbsp;or &nbsp;--epub] switches off <i>object</i> citation numbering.
+Produce output without identifying numbers in margins of html or <i>LaTeX</i>
+/pdf output.
+<p> </dd>
+
+<dt><b>--no-annotate</b> </dt>
+<dd>strips output text of editor endnotes[^*1] denoted
+
+<p>by asterisk or dagger/plus sign
+<p> </dd>
+
+<dt><b>--no-asterisk</b> </dt>
+<dd>strips output text of editor
+endnotes[^*2] denoted by asterisk sign
+<p> </dd>
+
+<dt><b>--no-dagger</b> </dt>
+<dd>strips output text of editor
+endnotes[^+1] denoted by dagger/plus sign
+<p> </dd>
+</dl>
+
+<h2><a name='sect9' href='#toc9'>Database Commands</a></h2>
+<br>
+
+<p> <br>
+<b>dbi - database interface</b>
+<p> <br>
+<b>-D or --pgsql</b> set for <i>PostgreSQL</i> <b>-d or --sqlite</b> default set for <i>SQLite</i> -d is modifiable
+with --db=[database &nbsp;type &nbsp;(PgSQL &nbsp;or &nbsp;.I &nbsp;SQLite &nbsp;) &nbsp;]
+<p>
+<dl>
+
+<dt><b>--pg -v --createall</b> </dt>
+<dd>initial step,
+creates required relations (tables, indexes) in existing <i>PostgreSQL</i> database
+(a database should be created manually and given the same name as working
+directory, as requested) (rb.dbi) [ &nbsp;-dv &nbsp;--createall &nbsp;.I SQLite &nbsp;equivalent] it
+may be necessary to run sisu -Dv --createdb initially NOTE: at the present
+time for <i>PostgreSQL</i> it may be necessary to manually create the database.
+The command would be working &nbsp;directory &nbsp;name &nbsp;(without &nbsp;path)]. Please use
+only alphanumerics and underscores.
+<p> </dd>
+
+<dt><b>--pg -v --import</b> </dt>
+<dd>[filename/wildcard] imports
+data specified to <i>PostgreSQL</i> db (rb.dbi) [ &nbsp;-dv &nbsp;--import &nbsp;.I &nbsp;SQLite &nbsp;equivalent]
+
+<p> </dd>
+
+<dt><b>--pg -v --update</b> </dt>
+<dd>[filename/wildcard] updates/imports specified data to <i>PostgreSQL</i>
+db (rb.dbi) [ &nbsp;-dv &nbsp;--update &nbsp;.I &nbsp;SQLite &nbsp;equivalent]
+<p> </dd>
+
+<dt><b>--pg --remove</b> </dt>
+<dd>[filename/wildcard]
+removes specified data to <i>PostgreSQL</i> db (rb.dbi) [ &nbsp;-d &nbsp;--remove &nbsp;.I &nbsp;SQLite &nbsp;equivalent]
+
+<p> </dd>
+
+<dt><b>--pg --dropall</b> </dt>
+<dd>kills data" and drops ( <i>PostgreSQL</i> or <i>SQLite</i> ) db, tables &amp;
+indexes [ &nbsp;-d &nbsp;--dropall &nbsp;.I &nbsp;SQLite &nbsp;equivalent]
+<p> <br>
+The -v is for verbose output.
+<p> </dd>
+</dl>
+
+<h2><a name='sect10' href='#toc10'>Shortcuts, Shorthand for Multiple Flags</a></h2>
+<br>
+
+<p>
+<dl>
+
+<dt><b>--update [filename/wildcard]</b> </dt>
+<dd>Checks existing file output and runs the flags
+required to update this output. This means that if only html and pdf output
+was requested on previous runs, only the -hp files will be applied, and
+only these will be generated this time, together with the summary. This
+can be very convenient, if you offer different outputs of different files,
+and just want to do the same again.
+<p> </dd>
+
+<dt><b>-0 to -5 [filename &nbsp;or &nbsp;wildcard]</b> </dt>
+<dd>Default
+shorthand mappings (for v3, note that the defaults can be changed/configured
+in the sisurc.yml file):
+<p> </dd>
+
+<dt><b>-0</b> </dt>
+<dd>-NQhewpotbxXyYv [this &nbsp;is &nbsp;the &nbsp;default &nbsp;action &nbsp;run
+&nbsp;when &nbsp;no options &nbsp;are &nbsp;give, &nbsp;i.e. &nbsp;on &nbsp;&rsquo;sisu &nbsp;[filename]&rsquo;]
+<p> </dd>
+
+<dt><b>-1</b> </dt>
+<dd>-Qhewpoty
+<p> </dd>
+
+<dt><b>-2</b> </dt>
+<dd>-NQhewpotbxXy
+
+<p> </dd>
+
+<dt><b>-3</b> </dt>
+<dd>-NQhewpotbxXyY
+<p> </dd>
+
+<dt><b>-4</b> </dt>
+<dd>-NQhewpotbxXDyY --update
+<p> </dd>
+
+<dt><b>-5</b> </dt>
+<dd>-NQhewpotbxXDyYv --update
+<p> <br>
+add -v for verbose mode and -c to toggle color state, e.g. sisu -2vc [filename
+&nbsp;or &nbsp;wildcard]
+<p> <br>
+
+<p>consider -u for appended url info or -v for verbose output
+<p> </dd>
+</dl>
+
+<h2><a name='sect11' href='#toc11'>Command Line
+with Flags - Batch Processing</a></h2>
+
+<p> <br>
+In the data directory run sisu -mh filename or wildcard eg. "sisu -h cisg.sst"
+or "sisu -h *.{sst,ssm}" to produce html version of all documents.
+<p> <br>
+Running sisu (alone without any flags, filenames or wildcards) brings up
+the interactive help, as does any sisu command that is not recognised. Enter
+to escape.
+<p>
+<h2><a name='sect12' href='#toc12'>Help</a></h2>
+<br>
+
+<p>
+<h2><a name='sect13' href='#toc13'>Sisu Manual</a></h2>
+
+<p> <br>
+The most up to date information on sisu should be contained in the sisu_manual,
+available at:
+<p> <br>
+ &lt;<a href='http://sisudoc.org/sisu/sisu_manual/'>http://sisudoc.org/sisu/sisu_manual/</a>
+&gt;<br>
+
+<p> <br>
+The manual can be generated from source, found respectively, either within
+the <b>SiSU</b> tarball or installed locally at:
+<p> <br>
+ ./data/doc/sisu/markup-samples/sisu_manual<br>
+
+<p> <br>
+ /usr/share/doc/sisu/markup-samples/sisu_manual<br>
+
+<p> <br>
+move to the respective directory and type e.g.:
+<p> <br>
+ sisu sisu_manual.ssm<br>
+
+<p>
+<h2><a name='sect14' href='#toc14'>Sisu Man Pages</a></h2>
+
+<p> <br>
+If <b>SiSU</b> is installed on your system usual man commands should be available,
+try:
+<p> <br>
+ man sisu<br>
+
+<p> <br>
+Most <b>SiSU</b> man pages are generated directly from sisu documents that are
+used to prepare the sisu manual, the sources files for which are located
+within the <b>SiSU</b> tarball at:
+<p> <br>
+ ./data/doc/sisu/markup-samples/sisu_manual<br>
+
+<p> <br>
+Once installed, directory equivalent to:
+<p> <br>
+ /usr/share/doc/sisu/markup-samples/sisu_manual<br>
+
+<p> <br>
+Available man pages are converted back to html using man2html:
+<p> <br>
+ /usr/share/doc/sisu/html/<br>
+
+<p> <br>
+ ./data/doc/sisu/html<br>
+
+<p> <br>
+An online version of the sisu man page is available here:
+<p> <br>
+* various sisu man pages &lt;<a href='http://www.jus.uio.no/sisu/man/'>http://www.jus.uio.no/sisu/man/</a>
+&gt; [^9]
+<p> <br>
+* sisu.1 &lt;<a href='http://www.jus.uio.no/sisu/man/sisu.1.html'>http://www.jus.uio.no/sisu/man/sisu.1.html</a>
+&gt; [^10]
+<p>
+<h2><a name='sect15' href='#toc15'>Sisu Built-in Interactive
+Help</a></h2>
+
+<p> <br>
+This is particularly useful for getting the current sisu setup/environment
+information:
+<p> <br>
+ sisu --help<br>
+
+<p> <br>
+ sisu --help [subject]<br>
+
+<p> <br>
+ sisu --help commands<br>
+
+<p> <br>
+ sisu --help markup<br>
+
+<p> <br>
+ sisu --help env [for &nbsp;feedback &nbsp;on &nbsp;the &nbsp;way &nbsp;your &nbsp;system &nbsp;is <br>
+ setup &nbsp;with &nbsp;regard &nbsp;to &nbsp;sisu &nbsp;]<br>
+
+<p> <br>
+ sisu -V [environment &nbsp;information, &nbsp;same &nbsp;as &nbsp;above &nbsp;command]<br>
+
+<p> <br>
+ sisu (on its own provides version and some help information)<br>
+
+<p> <br>
+Apart from real-time information on your current configuration the <b>SiSU</b>
+manual and man pages are likely to contain more up-to-date information than
+the sisu interactive help (for example on commands and markup).
+<p> <br>
+NOTE: Running the command sisu (alone without any flags, filenames or wildcards)
+brings up the interactive help, as does any sisu command that is not recognised.
+Enter to escape.
+<p>
+<h2><a name='sect16' href='#toc16'>Introduction to Sisu Markup[^11]</a></h2>
+<br>
+
+<p>
+<h2><a name='sect17' href='#toc17'>Summary</a></h2>
+
+<p> <br>
+<b>SiSU</b> source documents are <i>plaintext</i> ( <i>UTF-8</i> )[^12] files
+<p> <br>
+All paragraphs are separated by an empty line.
+<p> <br>
+Markup is comprised of:
+<p> <br>
+* at the top of a document, the document header made up of semantic meta-data
+about the document and if desired additional processing instructions (such
+an instruction to automatically number headings from a particular level
+down)
+<p> <br>
+* followed by the prepared substantive text of which the most important
+single characteristic is the markup of different heading levels, which
+define the primary outline of the document structure. Markup of substantive
+text includes:
+<p> <br>
+ * heading levels defines document structure<br>
+
+<p> <br>
+ * text basic attributes, italics, bold etc.<br>
+
+<p> <br>
+ * grouped text (objects), which are to be treated differently, such as
+code<br>
+ blocks or poems.<br>
+
+<p> <br>
+ * footnotes/endnotes<br>
+
+<p> <br>
+ * linked text and images<br>
+
+<p> <br>
+ * paragraph actions, such as indent, bulleted, numbered-lists, etc.<br>
+
+<p> <br>
+Some interactive help on markup is available, by typing sisu and selecting
+
+<p>markup or sisu --help markup
+<p> <br>
+To check the markup in a file:
+<p> <br>
+ sisu --identify [filename].sst<br>
+
+<p> <br>
+
+<p>For brief descriptive summary of markup history
+<p> <br>
+ sisu --query-history<br>
+
+<p> <br>
+or if for a particular version:
+<p> <br>
+ sisu --query-0.38<br>
+
+<p>
+<h2><a name='sect18' href='#toc18'>Markup Examples</a></h2>
+
+<p>
+<h2><a name='sect19' href='#toc19'>Online</a></h2>
+
+<p> <br>
+Online markup examples are available together with the respective outputs
+produced from &lt;<a href='http://www.jus.uio.no/sisu/SiSU/examples.html'>http://www.jus.uio.no/sisu/SiSU/examples.html</a>
+&gt; or from &lt;<a href='http://www.jus.uio.no/sisu/sisu_examples/'>http://www.jus.uio.no/sisu/sisu_examples/</a>
+&gt;
+
+<p> <br>
+There is of course this document, which provides a cursory overview of
+sisu markup and the respective output produced: &lt;<a href='http://www.jus.uio.no/sisu/sisu_markup/'>http://www.jus.uio.no/sisu/sisu_markup/</a>
+&gt;
+
+<p> <br>
+an alternative presentation of markup syntax: /usr/share/doc/sisu/on_markup.txt.gz
+
+<p>
+<h2><a name='sect20' href='#toc20'>Installed</a></h2>
+
+<p> <br>
+With <b>SiSU</b> installed sample skins may be found in: /usr/share/doc/sisu/markup-samples
+(or equivalent directory) and if sisu -markup-samples is installed also under:
+
+<p>/usr/share/doc/sisu/markup-samples-non-free
+<p>
+<h2><a name='sect21' href='#toc21'>Markup of Headers</a></h2>
+<br>
+
+<p> <br>
+Headers contain either: semantic meta-data about a document, which can be
+used by any output module of the program, or; processing instructions.
+<p>
+<br>
+Note: the first line of a document may include information on the markup
+version used in the form of a comment. Comments are a percentage mark at
+the start of a paragraph (and as the first character in a line of text)
+followed by a space and the comment:
+<p> <br>
+<pre>% this would be a comment
+</pre>
+<p>
+<h2><a name='sect22' href='#toc22'>Sample Header</a></h2>
+
+<p> <br>
+This current document is loaded by a master document that has a header
+similar to this one:
+<p> <br>
+<pre>% SiSU master 2.0
+@title: SiSU
+:subtitle: Manual
+@creator:
+:author: Amissah, Ralph
+@publisher: [publisher &nbsp;name]
+@rights: Copyright (C) Ralph Amissah 2007, part of SiSU documentation,
+License GPL 3
+@classify:
+:type: information
+:topic_register: SiSU:manual;electronic documents:SiSU:manual
+:subject: ebook, epublishing, electronic book, electronic publishing,
+ electronic document, electronic citation, data structure,
+ citation systems, search
+% used_by: manual
+@date:
+:published: 2008-05-22
+:created: 2002-08-28
+:issued: 2002-08-28
+:available: 2002-08-28
+:modified: 2010-03-03
+@make:
+:num_top: 1
+:breaks: new=C; break=1
+:bold: /Gnu|Debian|Ruby|SiSU/
+:home_button_text: {SiSU}http://sisudoc.org; {git}http://git.sisudoc.org
+:footer: {SiSU}http://sisudoc.org; {git}http://git.sisudoc.org
+:manpage: name=sisu - documents: markup, structuring, publishing in multiple
+standard formats, and search;
+ synopsis=sisu [-abcDdeFhIiMmNnopqRrSsTtUuVvwXxYyZz0-9] [filename/wildcard
+&nbsp;]
+ . sisu [-Ddcv] [instruction]
+ . sisu [-CcFLSVvW]
+ . sisu --v4 [operations]
+ . sisu --v3 [operations]
+@links:
+{ SiSU Homepage }http://www.sisudoc.org/
+{ SiSU Manual }http://www.sisudoc.org/sisu/sisu_manual/
+{ Book Samples &amp; Markup Examples }http://www.jus.uio.no/sisu/SiSU/examples.html
+{ SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html
+{ SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html
+{ SiSU Git repo }http://git.sisudoc.org/?p=code/sisu.git;a=summary
+{ SiSU List Archives }http://lists.sisudoc.org/pipermail/sisu/
+{ SiSU @ Debian }http://packages.qa.debian.org/s/sisu.html
+{ SiSU Project @ Debian }http://qa.debian.org/developer.php?login=sisu@lists.sisudoc.org
+{ SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU
+</pre>
+<p>
+<h2><a name='sect23' href='#toc23'>Available Headers</a></h2>
+
+<p> <br>
+Header tags appear at the beginning of a document and provide meta information
+on the document (such as the <i>Dublin</i> Core ) , or information as to how the
+document as a whole is to be processed. All header instructions take the
+form @headername: or on the next line and indented by once space :subheadername:
+
+<p>All <i>Dublin</i> Core meta tags are available
+<p> <br>
+<b>@indentifier:</b> information or instructions
+<p> <br>
+where the "identifier" is a tag recognised by the program, and the "information"
+or "instructions" belong to the tag/indentifier specified
+<p> <br>
+Note: a header where used should only be used once; all headers apart from
+@title: are optional; the @structure: header is used to describe document
+structure, and can be useful to know.
+<p> <br>
+
+<p>This is a sample header
+<p> <br>
+<pre>% SiSU 2.0 [declared &nbsp;file-type &nbsp;identifier &nbsp;with &nbsp;markup &nbsp;version]
+</pre>
+<p> <br>
+<pre>@title: [title &nbsp;text] [this &nbsp;header &nbsp;is &nbsp;the &nbsp;only &nbsp;one &nbsp;that &nbsp;is &nbsp;mandatory]
+ :subtitle: [subtitle &nbsp;if &nbsp;any]
+ :language: English
+</pre>
+<p> <br>
+<pre>@creator:
+:author: [Lastname, &nbsp;First &nbsp;names]
+:illustrator: [Lastname, &nbsp;First &nbsp;names]
+:translator: [Lastname, &nbsp;First &nbsp;names]
+:prepared_by: [Lastname, &nbsp;First &nbsp;names]
+</pre>
+<p> <br>
+<pre>@date:
+:published: [year &nbsp;or &nbsp;yyyy-mm-dd]
+:created: [year &nbsp;or &nbsp;yyyy-mm-dd]
+:issued: [year &nbsp;or &nbsp;yyyy-mm-dd]
+:available: [year &nbsp;or &nbsp;yyyy-mm-dd]
+:modified: [year &nbsp;or &nbsp;yyyy-mm-dd]
+:valid: [year &nbsp;or &nbsp;yyyy-mm-dd]
+:added_to_site: [year &nbsp;or &nbsp;yyyy-mm-dd]
+:translated: [year &nbsp;or &nbsp;yyyy-mm-dd]
+</pre>
+<p> <br>
+<pre>@rights:
+:copyright: Copyright (C) [Year &nbsp;and &nbsp;Holder]
+:license: [Use &nbsp;License &nbsp;granted]
+:text: [Year &nbsp;and &nbsp;Holder]
+:translation: [Name, &nbsp;Year]
+:illustrations: [Name, &nbsp;Year]
+</pre>
+<p> <br>
+<pre>@classify:
+:topic_register: SiSU:markup sample:book;book:novel:fantasy
+:type:
+:subject:
+:description:
+:keywords:
+:abstract:
+:loc: [Library &nbsp;of &nbsp;Congress &nbsp;classification]
+:dewey: Dewey classification
+</pre>
+<p> <br>
+<pre>@identify:
+:isbn: [ISBN]
+:oclc:
+</pre>
+<p> <br>
+<pre>@links: { SiSU }http://www.sisudoc.org
+ { FSF }http://www.fsf.org
+</pre>
+<p> <br>
+<pre>@make:
+:num_top: 1
+:headings: [text &nbsp;to &nbsp;match &nbsp;for &nbsp;each &nbsp;level &nbsp; (e.g. &nbsp;PART; &nbsp;Chapter; &nbsp;Section;
+&nbsp;Article; &nbsp;or &nbsp;another: &nbsp;none; &nbsp;BOOK|FIRST|SECOND; &nbsp;none; &nbsp;CHAPTER;) &nbsp;:breaks: &nbsp;new=:C;
+&nbsp;break=1 &nbsp;:promo: &nbsp;sisu, &nbsp;ruby, &nbsp;sisu_search_libre, &nbsp;open_society &nbsp;:bold: &nbsp;[regular
+&nbsp;expression &nbsp;of &nbsp;words/phrases &nbsp;to &nbsp;be &nbsp;made &nbsp;bold]
+:italics: [regular &nbsp;expression &nbsp;of &nbsp;words/phrases &nbsp;to &nbsp;italicise]
+:home_button_text: {SiSU}http://sisudoc.org; {git}http://git.sisudoc.org
+:footer: {SiSU}http://sisudoc.org; {git}http://git.sisudoc.org
+</pre>
+<p> <br>
+<pre>@original:
+:language: [language]
+</pre>
+<p> <br>
+<pre>@notes:
+:comment:
+:prefix: [prefix &nbsp;is &nbsp;placed &nbsp;just &nbsp;after &nbsp;table &nbsp;of &nbsp;contents]
+</pre>
+<p>
+<h2><a name='sect24' href='#toc24'>Markup of Substantive Text</a></h2>
+<br>
+
+<p>
+<h2><a name='sect25' href='#toc25'>Heading Levels</a></h2>
+
+<p> <br>
+Heading levels are :A~ ,:B~ ,:C~ ,1~ ,2~ ,3~ ... :A - :C being part / section
+headings, followed by other heading levels, and 1 -6 being headings followed
+by substantive text or sub-headings. :A~ usually the title :A~? conditional
+level 1 heading (used where a stand-alone document may be imported into
+another)
+<p> <br>
+<b>:A~ [heading &nbsp;text]</b> Top level heading [this &nbsp;usually &nbsp;has &nbsp;similar &nbsp;content
+&nbsp;to &nbsp;the &nbsp;title &nbsp;@title: &nbsp;] NOTE: the heading levels described here are in 0.38
+notation, see heading
+<p> <br>
+<b>:B~ [heading &nbsp;text]</b> Second level heading [this &nbsp;is &nbsp;a &nbsp;heading &nbsp;level &nbsp;divider]
+
+<p> <br>
+<b>:C~ [heading &nbsp;text]</b> Third level heading [this &nbsp;is &nbsp;a &nbsp;heading &nbsp;level &nbsp;divider]
+
+<p> <br>
+<b>1~ [heading &nbsp;text]</b> Top level heading preceding substantive text of document
+or sub-heading 2, the heading level that would normally be marked 1. or 2.
+or 3. etc. in a document, and the level on which sisu by default would break
+html output into named segments, names are provided automatically if none
+are given (a number), otherwise takes the form 1~my_filename_for_this_segment
+
+<p> <br>
+<b>2~ [heading &nbsp;text]</b> Second level heading preceding substantive text of document
+or sub-heading 3 , the heading level that would normally be marked 1.1 or
+1.2 or 1.3 or 2.1 etc. in a document.
+<p> <br>
+<b>3~ [heading &nbsp;text]</b> Third level heading preceding substantive text of document,
+that would normally be marked 1.1.1 or 1.1.2 or 1.2.1 or 2.1.1 etc. in a document
+
+<p> <br>
+<pre>1~filename level 1 heading,
+% the primary division such as Chapter that is followed by substantive
+text, and may be further subdivided (this is the level on which by default
+html segments are made)
+</pre>
+<p>
+<h2><a name='sect26' href='#toc26'>Font Attributes</a></h2>
+
+<p> <br>
+<b>markup example:</b>
+<p> <br>
+<pre>normal text, *{emphasis}*, !{bold text}!, /{italics}/, _{underscore}_,
+"{citation}",
+^{superscript}^, ,{subscript},, +{inserted text}+, -{strikethrough}-, #{monospace}#
+normal text
+*{emphasis}* [note: &nbsp;can &nbsp;be &nbsp;configured &nbsp;to &nbsp;be &nbsp;represented &nbsp;by &nbsp;bold, &nbsp;italics
+&nbsp;or &nbsp;underscore]
+!{bold text}!
+/{italics}/
+_{underscore}_
+"{citation}"
+^{superscript}^
+,{subscript},
++{inserted text}+
+-{strikethrough}-
+#{monospace}#
+</pre>
+<p> <br>
+<b>resulting output:</b>
+<p> <br>
+normal text, <b>emphasis,</b> <b>bold text</b> , <i>italics,</i> <i>underscore,</i> "citation", ^superscript^,
+[subscript], ++inserted text++, --strikethrough--, monospace
+<p> <br>
+
+<p>normal text
+<p> <br>
+<b>emphasis</b> [note: &nbsp;can &nbsp;be &nbsp;configured &nbsp;to &nbsp;be &nbsp;represented &nbsp;by &nbsp;bold, &nbsp;italics &nbsp;italics
+&nbsp;or &nbsp;underscore] or &nbsp;underscore]
+<p> <br>
+
+<p><b>bold text</b>
+<p> <br>
+
+<p><i>italics</i>
+<p> <br>
+
+<p><i>underscore</i>
+<p> <br>
+"citation"
+<p> <br>
+^superscript^
+<p> <br>
+[subscript]
+<p> <br>
+++inserted text++
+<p> <br>
+--strikethrough--
+<p> <br>
+
+<p>monospace
+<p>
+<h2><a name='sect27' href='#toc27'>Indentation and Bullets</a></h2>
+
+<p> <br>
+<b>markup example:</b>
+<p> <br>
+<pre>ordinary paragraph
+_1 indent paragraph one step
+_2 indent paragraph two steps
+_9 indent paragraph nine steps
+</pre>
+<p> <br>
+<b>resulting output:</b>
+<p> <br>
+
+<p>ordinary paragraph
+<p> <br>
+ indent paragraph one step<br>
+
+<p> <br>
+ indent paragraph two steps<br>
+
+<p> <br>
+ indent paragraph nine steps<br>
+
+<p> <br>
+<b>markup example:</b>
+<p> <br>
+<pre>_* bullet text
+_1* bullet text, first indent
+_2* bullet text, two step indent
+</pre>
+<p> <br>
+<b>resulting output:</b>
+<p> <br>
+* bullet text
+<p> <br>
+ * bullet text, first indent<br>
+
+<p> <br>
+ * bullet text, two step indent<br>
+
+<p> <br>
+Numbered List (not to be confused with headings/titles, (document structure))
+
+<p> <br>
+<b>markup example:</b>
+<p> <br>
+<pre># numbered list numbered list 1., 2., 3, etc.
+_# numbered list numbered list indented a., b., c., d., etc.
+</pre>
+<p>
+<h2><a name='sect28' href='#toc28'>Hanging Indents</a></h2>
+
+<p> <br>
+<b>markup example:</b>
+<p> <br>
+<pre>_0_1 first line no indent,
+rest of paragraph indented one step
+_1_0 first line indented,
+rest of paragraph no indent
+in each case level may be 0-9
+</pre>
+<p> <br>
+<b>resulting output:</b>
+<p> <br>
+ first line no indent, rest of paragraph indented one step<br>
+
+<p> <br>
+first line indented, rest of paragraph no indent
+<p> <br>
+
+<p>in each case level may be 0-9
+<p>
+<h2><a name='sect29' href='#toc29'>Footnotes / Endnotes</a></h2>
+
+<p> <br>
+Footnotes and endnotes are marked up at the location where they would be
+indicated within a text. They are automatically numbered. The output type
+
+<p>determines whether footnotes or endnotes will be produced
+<p> <br>
+<b>markup example:</b>
+<p> <br>
+<pre>~{ a footnote or endnote }~
+</pre>
+<p> <br>
+<b>resulting output:</b>
+<p> <br>
+[^13]
+<p> <br>
+<b>markup example:</b>
+<p> <br>
+<pre>normal text~{ self contained endnote marker &amp; endnote in one }~ continues
+</pre>
+<p> <br>
+<b>resulting output:</b>
+<p> <br>
+normal text[^14] continues
+<p> <br>
+<b>markup example:</b>
+<p> <br>
+<pre>normal text ~{* unnumbered asterisk footnote/endnote, insert multiple asterisks
+if required }~ continues
+normal text ~{** another unnumbered asterisk footnote/endnote }~ continues
+</pre>
+<p> <br>
+<b>resulting output:</b>
+<p> <br>
+normal text [^*] continues
+<p> <br>
+normal text [^**] continues
+<p> <br>
+<b>markup example:</b>
+<p> <br>
+<pre>normal text ~[* &nbsp;editors &nbsp;notes, &nbsp;numbered &nbsp;asterisk &nbsp;footnote/endnote &nbsp;series
+&nbsp;]~ continues
+normal text ~[+ &nbsp;editors &nbsp;notes, &nbsp;numbered &nbsp;asterisk &nbsp;footnote/endnote &nbsp;series
+&nbsp;]~ continues
+</pre>
+<p> <br>
+<b>resulting output:</b>
+<p> <br>
+normal text [^*3] continues
+<p> <br>
+normal text [^+2] continues
+<p> <br>
+<b>Alternative endnote pair notation for footnotes/endnotes:</b>
+<p> <br>
+<pre>% note the endnote marker "~^"
+normal text~^ continues
+^~ endnote text following the paragraph in which the marker occurs
+</pre>
+<p> <br>
+
+<p>the standard and pair notation cannot be mixed in the same document
+<p>
+<h2><a name='sect30' href='#toc30'>Links</a></h2>
+
+<p>
+
+<h2><a name='sect31' href='#toc31'>Naked Urls Within Text, Dealing with Urls</a></h2>
+
+<p> <br>
+urls found within text are marked up automatically. A url within text is
+automatically hyperlinked to itself and by default decorated with angled
+braces, unless they are contained within a code block (in which case they
+are passed as normal text), or escaped by a preceding underscore (in which
+case the decoration is omitted).
+<p> <br>
+<b>markup example:</b>
+<p> <br>
+<pre>normal text http://www.sisudoc.org/ continues
+</pre>
+<p> <br>
+<b>resulting output:</b>
+<p> <br>
+normal text &lt;<a href='http://www.sisudoc.org/'>http://www.sisudoc.org/</a>
+&gt; continues
+<p> <br>
+
+<p>An escaped url without decoration
+<p> <br>
+<b>markup example:</b>
+<p> <br>
+<pre>normal text _http://www.sisudoc.org/ continues
+deb _http://www.jus.uio.no/sisu/archive unstable main non-free
+</pre>
+<p> <br>
+<b>resulting output:</b>
+<p> <br>
+normal text &lt;_<a href='http://www.sisudoc.org/'>http://www.sisudoc.org/</a>
+&gt; continues
+<p> <br>
+deb &lt;_<a href='http://www.jus.uio.no/sisu/archive'>http://www.jus.uio.no/sisu/archive</a>
+&gt; unstable main non-free
+<p> <br>
+where a code block is used there is neither decoration nor hyperlinking,
+
+<p>code blocks are discussed later in this document
+<p> <br>
+<b>resulting output:</b>
+<p> <br>
+<pre>deb http://www.jus.uio.no/sisu/archive unstable main non-free
+deb-src http://www.jus.uio.no/sisu/archive unstable main non-free
+</pre>
+<p>
+<h2><a name='sect32' href='#toc32'>Linking Text</a></h2>
+
+<p> <br>
+
+<p>To link text or an image to a url the markup is as follows
+<p> <br>
+<b>markup example:</b>
+<p> <br>
+<pre>about { SiSU }http://url.org markup
+</pre>
+<p> <br>
+<b>resulting output:</b>
+<p> <br>
+aboutSiSU &lt;<a href='http://www.sisudoc.org/'>http://www.sisudoc.org/</a>
+&gt; markup
+<p> <br>
+
+<p>A shortcut notation is available so the url link may also be provided automatically
+
+<p>as a footnote
+<p> <br>
+<b>markup example:</b>
+<p> <br>
+<pre>about {~^ SiSU }http://url.org markup
+</pre>
+<p> <br>
+<b>resulting output:</b>
+<p> <br>
+aboutSiSU &lt;<a href='http://www.sisudoc.org/'>http://www.sisudoc.org/</a>
+&gt; [^15] markup
+<p> <br>
+Internal document links to a tagged location, including an <i>ocn</i>
+<p> <br>
+<b>markup example:</b>
+<p> <br>
+<pre>about { text links }#link_text
+</pre>
+<p> <br>
+<b>resulting output:</b>
+<p> <br>
+about ⌠text links⌡⌈link_text⌋
+<p> <br>
+
+<p>Shared document collection link
+<p> <br>
+<b>markup example:</b>
+<p> <br>
+<pre>about { SiSU book markup examples }:SiSU/examples.html
+</pre>
+<p> <br>
+<b>resulting output:</b>
+<p> <br>
+about ⌠ <b>SiSU</b> book markup examples⌡⌈:SiSU/examples.html⌋
+<p>
+<h2><a name='sect33' href='#toc33'>Linking
+Images</a></h2>
+
+<p> <br>
+<b>markup example:</b>
+<p> <br>
+<pre>{ tux.png 64x80 }image
+% various url linked images
+{tux.png 64x80 "a better way" }http://www.sisudoc.org/
+{GnuDebianLinuxRubyBetterWay.png 100x101 "Way Better - with Gnu/Linux, Debian
+and Ruby" }http://www.sisudoc.org/
+{~^ ruby_logo.png "Ruby" }http://www.ruby-lang.org/en/
+</pre>
+<p> <br>
+<b>resulting output:</b>
+<p> <br>
+[ tux.png ]
+<p> <br>
+tux.png 64x80 "Gnu/Linux - a better way" &lt;<a href='http://www.sisudoc.org/'>http://www.sisudoc.org/</a>
+&gt;
+<p> <br>
+GnuDebianLinuxRubyBetterWay.png 100x101 "Way Better - with Gnu/Linux, Debian
+and Ruby" &lt;<a href='http://www.sisudoc.org/'>http://www.sisudoc.org/</a>
+&gt;
+<p> <br>
+ruby_logo.png 70x90 "Ruby" &lt;<a href='http://www.ruby-lang.org/en/'>http://www.ruby-lang.org/en/</a>
+&gt; [^16]
+<p> <br>
+
+<p><b>linked url footnote shortcut</b>
+<p> <br>
+<pre>{~^ [text &nbsp;to &nbsp;link] }http://url.org
+% maps to: { [text &nbsp;to &nbsp;link] }http://url.org ~{ http://url.org }~
+% which produces hyper-linked text within a document/paragraph, with an
+endnote providing the url for the text location used in the hyperlink
+</pre>
+<p> <br>
+<pre>text marker *~name
+</pre>
+<p> <br>
+note at a heading level the same is automatically achieved by providing
+names to headings 1, 2 and 3 i.e. 2~[name] and 3~[name] or in the case of
+auto-heading numbering, without further intervention.
+<p>
+<h2><a name='sect34' href='#toc34'>Link Shortcut for
+Multiple Versions of a Sisu Document in the Same Directory</a></h2>
+TREE
+<p> <br>
+<b>markup example:</b>
+<p> <br>
+<pre>!_ /{"Viral Spiral"}/, David Bollier
+{ "Viral Spiral", David Bollier [3sS]}viral_spiral.david_bollier.sst
+</pre>
+<p> <br>
+<b></b> <i>Viral Spiral</i>, David Bollier
+<p> "Viral Spiral", David Bollier &lt;<a href='http://corundum/sisu_manual/en/manifest/viral_spiral.david_bollier.html'>http://corundum/sisu_manual/en/manifest/viral_spiral.david_bollier.html</a>
+&gt;
+ document manifest &lt;<a href='http://corundum/sisu_manual/en/manifest/viral_spiral.david_bollier.html'>http://corundum/sisu_manual/en/manifest/viral_spiral.david_bollier.html</a>
+&gt;<br>
+ ⌠html, segmented text⌡「<a href='http://corundum/sisu_manual/en/html/viral_spiral.david_bollier.html」'>http://corundum/sisu_manual/en/html/viral_spiral.david_bollier.html」</a>
+<br>
+ ⌠html, scroll, document in one⌡「<a href='http://corundum/sisu_manual/en/html/viral_spiral.david_bollier.html」'>http://corundum/sisu_manual/en/html/viral_spiral.david_bollier.html」</a>
+<br>
+ ⌠epub⌡「<a href='http://corundum/sisu_manual/en/epub/viral_spiral.david_bollier.epub」'>http://corundum/sisu_manual/en/epub/viral_spiral.david_bollier.epub」</a>
+<br>
+ ⌠pdf, landscape⌡「<a href='http://corundum/sisu_manual/en/pdf/viral_spiral.david_bollier.pdf」'>http://corundum/sisu_manual/en/pdf/viral_spiral.david_bollier.pdf」</a>
+<br>
+ ⌠pdf, portrait⌡「<a href='http://corundum/sisu_manual/en/pdf/viral_spiral.david_bollier.pdf」'>http://corundum/sisu_manual/en/pdf/viral_spiral.david_bollier.pdf」</a>
+<br>
+ ⌠odf: odt, open document text⌡「<a href='http://corundum/sisu_manual/en/odt/viral_spiral.david_bollier.odt」'>http://corundum/sisu_manual/en/odt/viral_spiral.david_bollier.odt」</a>
+<br>
+ ⌠xhtml scroll⌡「<a href='http://corundum/sisu_manual/en/xhtml/viral_spiral.david_bollier.xhtml」'>http://corundum/sisu_manual/en/xhtml/viral_spiral.david_bollier.xhtml」</a>
+<br>
+ ⌠xml, sax⌡「<a href='http://corundum/sisu_manual/en/xml/viral_spiral.david_bollier.xml」'>http://corundum/sisu_manual/en/xml/viral_spiral.david_bollier.xml」</a>
+<br>
+ ⌠xml, dom⌡「<a href='http://corundum/sisu_manual/en/xml/viral_spiral.david_bollier.xml」'>http://corundum/sisu_manual/en/xml/viral_spiral.david_bollier.xml」</a>
+<br>
+ ⌠concordance⌡「<a href='http://corundum/sisu_manual/en/html/viral_spiral.david_bollier.html」'>http://corundum/sisu_manual/en/html/viral_spiral.david_bollier.html」</a>
+<br>
+ ⌠dcc, document content certificate (digests)⌡「<a href='http://corundum/sisu_manual/en/digest/viral_spiral.david_bollier.txt」'>http://corundum/sisu_manual/en/digest/viral_spiral.david_bollier.txt」</a>
+<br>
+ ⌠markup source text⌡「<a href='http://corundum/sisu_manual/en/src/viral_spiral.david_bollier.sst」'>http://corundum/sisu_manual/en/src/viral_spiral.david_bollier.sst」</a>
+<br>
+ ⌠markup source (zipped) pod⌡「<a href='http://corundum/sisu_manual/en/pod/viral_spiral.david_bollier.sst.zip」'>http://corundum/sisu_manual/en/pod/viral_spiral.david_bollier.sst.zip」</a>
+<br>
+
+<p>
+<h2><a name='sect35' href='#toc35'>Grouped Text</a></h2>
+
+<p>
+<h2><a name='sect36' href='#toc36'>Tables</a></h2>
+
+<p> <br>
+
+<p>Tables may be prepared in two either of two forms
+<p> <br>
+<b>markup example:</b>
+<p> <br>
+<pre>table{ c3; 40; 30; 30;
+This is a table
+this would become column two of row one
+column three of row one is here
+And here begins another row
+column two of row two
+column three of row two, and so on
+}table
+</pre>
+<p> <br>
+<b>resulting output:</b>
+<p> This is a table|this would become column two of row one|column
+three of row one is here』And here begins another row|column two of row
+two|column three of row two, and so on』
+<p> <br>
+
+<p>a second form may be easier to work with in cases where there is not much
+
+<p>information in each column
+<p> <br>
+<b>markup example:</b> [^18]
+<p> <br>
+<pre>!_ Table 3.1: Contributors to Wikipedia, January 2001 - June 2005
+{table~h 24; 12; 12; 12; 12; 12; 12;}
+ |Jan. 2001|Jan. 2002|Jan. 2003|Jan. 2004|July 2004|June
+2006
+Contributors* | 10| 472| 2,188| 9,653|
+25,011| 48,721
+Active contributors** | 9| 212| 846| 3,228|
+ 8,442| 16,945
+Very active contributors*** | 0| 31| 190| 692|
+ 1,639| 3,016
+No. of English language articles| 25| 16,000| 101,000| 190,000| 320,000|
+ 630,000
+No. of articles, all languages | 25| 19,000| 138,000| 490,000| 862,000|1,600,000
+* Contributed at least ten times; ** at least 5 times in last month; ***
+more than 100 times in last month.
+</pre>
+<p> <br>
+<b>resulting output:</b>
+<p> <br>
+<b>Table 3.1: Contributors to Wikipedia, January 2001 - June 2005</b>
+<p> |Jan. 2001|Jan.
+2002|Jan. 2003|Jan. 2004|July 2004|June 2006』Contributors*|10|472|2,188|9,653|25,011|48,721』Active
+contributors**|9|212|846|3,228|8,442|16,945』Very active contributors***|0|31|190|692|1,639|3,016』No.
+of English language articles|25|16,000|101,000|190,000|320,000|630,000』No. of
+articles, all languages|25|19,000|138,000|490,000|862,000|1,600,000』
+<p> <br>
+* Contributed at least ten times; ** at least 5 times in last month; ***
+more than 100 times in last month.
+<p>
+<h2><a name='sect37' href='#toc37'>Poem</a></h2>
+
+<p> <br>
+<b>basic markup:</b>
+<p> <br>
+<pre>poem{
+ Your poem here
+}poem
+Each verse in a poem is given an object number.
+</pre>
+<p> <br>
+<b>markup example:</b>
+<p> <br>
+<pre>poem{
+ &lsquo;Fury said to a
+ mouse, That he
+ met in the
+ house,
+ "Let us
+ both go to
+ law: I will
+ prosecute
+ YOU. --Come,
+ I&rsquo;ll take no
+ denial; We
+ must have a
+ trial: For
+ really this
+ morning I&rsquo;ve
+ nothing
+ to do."
+ Said the
+ mouse to the
+ cur, "Such
+ a trial,
+ dear Sir,
+ With
+ no jury
+ or judge,
+ would be
+ wasting
+ our
+ breath."
+ "I&rsquo;ll be
+ judge, I&rsquo;ll
+ be jury,"
+ Said
+ cunning
+ old Fury:
+ "I&rsquo;ll
+ try the
+ whole
+ cause,
+ and
+ condemn
+ you
+ to
+ death."&rsquo;
+}poem
+</pre>
+<p> <br>
+<b>resulting output:</b>
+<p> &lsquo;Fury said to a<br>
+ mouse, That he<br>
+ met in the<br>
+ house,<br>
+ "Let us<br>
+ both go to<br>
+ law: I will<br>
+ prosecute<br>
+ YOU. --Come,<br>
+ I&rsquo;ll take no<br>
+ denial; We<br>
+ must have a<br>
+ trial: For<br>
+ really this<br>
+ morning I&rsquo;ve<br>
+ nothing<br>
+ to do."<br>
+ Said the<br>
+ mouse to the<br>
+ cur, "Such<br>
+ a trial,<br>
+ dear Sir,<br>
+ With<br>
+ no jury<br>
+ or judge,<br>
+ would be<br>
+ wasting<br>
+ our<br>
+ breath."<br>
+ "I&rsquo;ll be<br>
+ judge, I&rsquo;ll<br>
+ be jury,"<br>
+ Said<br>
+ cunning<br>
+ old Fury:<br>
+ "I&rsquo;ll<br>
+ try the<br>
+ whole<br>
+ cause,<br>
+ and<br>
+ condemn<br>
+ you<br>
+ to<br>
+ death."&rsquo;<br>
+
+<p>
+<h2><a name='sect38' href='#toc38'>Group</a></h2>
+
+<p> <br>
+<b>basic markup:</b>
+<p> <br>
+<pre>group{
+ Your grouped text here
+}group
+A group is treated as an object and given a single object number.
+</pre>
+<p> <br>
+<b>markup example:</b>
+<p> <br>
+<pre>group{
+ &lsquo;Fury said to a
+ mouse, That he
+ met in the
+ house,
+ "Let us
+ both go to
+ law: I will
+ prosecute
+ YOU. --Come,
+ I&rsquo;ll take no
+ denial; We
+ must have a
+ trial: For
+ really this
+ morning I&rsquo;ve
+ nothing
+ to do."
+ Said the
+ mouse to the
+ cur, "Such
+ a trial,
+ dear Sir,
+ With
+ no jury
+ or judge,
+ would be
+ wasting
+ our
+ breath."
+ "I&rsquo;ll be
+ judge, I&rsquo;ll
+ be jury,"
+ Said
+ cunning
+ old Fury:
+ "I&rsquo;ll
+ try the
+ whole
+ cause,
+ and
+ condemn
+ you
+ to
+ death."&rsquo;
+}group
+</pre>
+<p> <br>
+<b>resulting output:</b>
+<p> &lsquo;Fury said to a<br>
+ mouse, That he<br>
+ met in the<br>
+ house,<br>
+ "Let us<br>
+ both go to<br>
+ law: I will<br>
+ prosecute<br>
+ YOU. --Come,<br>
+ I&rsquo;ll take no<br>
+ denial; We<br>
+ must have a<br>
+ trial: For<br>
+ really this<br>
+ morning I&rsquo;ve<br>
+ nothing<br>
+ to do."<br>
+ Said the<br>
+ mouse to the<br>
+ cur, "Such<br>
+ a trial,<br>
+ dear Sir,<br>
+ With<br>
+ no jury<br>
+ or judge,<br>
+ would be<br>
+ wasting<br>
+ our<br>
+ breath."<br>
+ "I&rsquo;ll be<br>
+ judge, I&rsquo;ll<br>
+ be jury,"<br>
+ Said<br>
+ cunning<br>
+ old Fury:<br>
+ "I&rsquo;ll<br>
+ try the<br>
+ whole<br>
+ cause,<br>
+ and<br>
+ condemn<br>
+ you<br>
+ to<br>
+ death."&rsquo;<br>
+
+<p>
+<h2><a name='sect39' href='#toc39'>Code</a></h2>
+
+<p> <br>
+Code tags code{ ... }code (used as with other group tags described above)
+are used to escape regular sisu markup, and have been used extensively
+within this document to provide examples of <b>SiSU</b> markup. You cannot however
+use code tags to escape code tags. They are however used in the same way
+as group or poem tags.
+<p> <br>
+A code-block is treated as an object and given a single object number. [an
+option &nbsp;to &nbsp;number &nbsp;each &nbsp;line &nbsp;of &nbsp;code &nbsp;may &nbsp;be &nbsp;considered &nbsp;at some &nbsp;later &nbsp;time]
+
+<p> <br>
+<b>use of code tags instead of poem compared, resulting output:</b>
+<p> <br>
+<pre> &lsquo;Fury said to a
+ mouse, That he
+ met in the
+ house,
+ "Let us
+ both go to
+ law: I will
+ prosecute
+ YOU. --Come,
+ I&rsquo;ll take no
+ denial; We
+ must have a
+ trial: For
+ really this
+ morning I&rsquo;ve
+ nothing
+ to do."
+ Said the
+ mouse to the
+ cur, "Such
+ a trial,
+ dear Sir,
+ With
+ no jury
+ or judge,
+ would be
+ wasting
+ our
+ breath."
+ "I&rsquo;ll be
+ judge, I&rsquo;ll
+ be jury,"
+ Said
+ cunning
+ old Fury:
+ "I&rsquo;ll
+ try the
+ whole
+ cause,
+ and
+ condemn
+ you
+ to
+ death."&rsquo;
+</pre>
+<p> <br>
+From <b>SiSU</b> 2.7.7 on you can number codeblocks by placing a hash after the
+opening code tag code{# as demonstrated here:
+<p> <br>
+<pre>1 | &lsquo;Fury said to a
+2 | mouse, That he
+3 | met in the
+4 | house,
+5 | "Let us
+6 | both go to
+7 | law: I will
+8 | prosecute
+9 | YOU. --Come,
+10 | I&rsquo;ll take no
+11 | denial; We
+12 | must have a
+13 | trial: For
+14 | really this
+15 | morning I&rsquo;ve
+16 | nothing
+17 | to do."
+18 | Said the
+19 | mouse to the
+20 | cur, "Such
+21 | a trial,
+22 | dear Sir,
+23 | With
+24 | no jury
+25 | or judge,
+26 | would be
+27 | wasting
+28 | our
+29 | breath."
+30 | "I&rsquo;ll be
+31 | judge, I&rsquo;ll
+32 | be jury,"
+33 | Said
+34 | cunning
+35 | old Fury:
+36 | "I&rsquo;ll
+37 | try the
+38 | whole
+39 | cause,
+40 | and
+41 | condemn
+42 | you
+43 | to
+44 | death."&rsquo;
+</pre>
+<p>
+<h2><a name='sect40' href='#toc40'>Additional Breaks - Linebreaks Within Objects, Column and Page-breaks</a></h2>
+
+<p>
+<h2><a name='sect41' href='#toc41'>Line-breaks</a></h2>
+
+<p>
+<br>
+To break a line within a "paragraph object", two backslashes \\ with a space
+before and a space or newline after them may be used.
+<p> <br>
+<pre>To break a line within a "paragraph object",
+two backslashes \\ with a space before
+and a space or newline after them \\
+may be used.
+</pre>
+<p> <br>
+The html break br enclosed in angle brackets (though undocumented) is available
+in versions prior to 3.0.13 and 2.9.7 (it remains available for the time being,
+but is depreciated).
+<p>
+<h2><a name='sect42' href='#toc42'>Page Breaks</a></h2>
+
+<p> <br>
+Page breaks are only relevant and honored in some output formats. A page
+break or a new page may be inserted manually using the following markup
+on a line on its own:
+<p> <br>
+page new =\= or breaks the page, starts a new page.
+<p> <br>
+page break -\- or breaks a column, starts a new column, if using columns,
+else breaks the page, starts a new page.
+<p> <br>
+<pre>-\\-
+or
+&lt;:pb&gt;
+</pre>
+<p> <br>
+
+<p>or
+<p> <br>
+<pre>=\\=
+or
+&lt;:pn&gt;
+</pre>
+<p>
+<h2><a name='sect43' href='#toc43'>Book Index</a></h2>
+
+<p> <br>
+To make an index append to paragraph the book index term relates to it,
+using an equal sign and curly braces.
+<p> <br>
+Currently two levels are provided, a main term and if needed a sub-term.
+Sub-terms are separated from the main term by a colon.
+<p> <br>
+<pre> Paragraph containing main term and sub-term.
+ ={Main term:sub-term}
+</pre>
+<p> <br>
+The index syntax starts on a new line, but there should not be an empty
+line between paragraph and index markup.
+<p> <br>
+The structure of the resulting index would be:
+<p> <br>
+<pre> Main term, 1
+ sub-term, 1
+</pre>
+<p> <br>
+Several terms may relate to a paragraph, they are separated by a semicolon.
+If the term refers to more than one paragraph, indicate the number of paragraphs.
+
+<p> <br>
+<pre> Paragraph containing main term, second term and sub-term.
+ ={first term; second term: sub-term}
+</pre>
+<p> <br>
+The structure of the resulting index would be:
+<p> <br>
+<pre> First term, 1,
+ Second term, 1,
+ sub-term, 1
+</pre>
+<p> <br>
+If multiple sub-terms appear under one paragraph, they are separated under
+the main term heading from each other by a pipe symbol.
+<p> <br>
+<pre> Paragraph containing main term, second term and sub-term.
+ ={Main term:sub-term+1|second sub-term}
+ A paragraph that continues discussion of the first sub-term
+</pre>
+<p> <br>
+The plus one in the example provided indicates the first sub-term spans
+one additional paragraph. The logical structure of the resulting index would
+be:
+<p> <br>
+<pre> Main term, 1,
+ sub-term, 1-3,
+ second sub-term, 1,
+</pre>
+<p>
+<h2><a name='sect44' href='#toc44'>Composite Documents Markup</a></h2>
+<br>
+
+<p> <br>
+It is possible to build a document by creating a master document that requires
+other documents. The documents required may be complete documents that could
+be generated independently, or they could be markup snippets, prepared
+so as to be easily available to be placed within another text. If the calling
+document is a master document (built from other documents), it should be
+named with the suffix <b>.ssm</b> Within this document you would provide information
+on the other documents that should be included within the text. These may
+be other documents that would be processed in a regular way, or markup
+bits prepared only for inclusion within a master document <b>.sst</b> regular markup
+file, or <b>.ssi</b> (insert/information) A secondary file of the composite document
+
+<p>is built prior to processing with the same prefix and the suffix <b>._sst</b>
+<p>
+<br>
+
+<p>basic markup for importing a document into a master document
+<p> <br>
+<pre>&lt;&lt; filename1.sst
+&lt;&lt; filename2.ssi
+</pre>
+<p> <br>
+The form described above should be relied on. Within the <i>Vim</i> editor it results
+in the text thus linked becoming hyperlinked to the document it is calling
+in which is convenient for editing.
+<p>
+<h2><a name='sect45' href='#toc45'>Sisu Filetypes</a></h2>
+<br>
+
+<p> <br>
+<b>SiSU</b> has <i>plaintext</i> and binary filetypes, and can process either type of
+document.
+<p>
+<h2><a name='sect46' href='#toc46'>.sst .ssm .ssi Marked Up Plain Text</a></h2>
+
+<p>
+<dl>
+
+<dt><b>SiSU¤b〕 documents are prepared
+as plain-text (utf-8) files with</b> </dt>
+<dd><b>SiSU</b> markup. They may make reference to and
+contain images (for example), which are stored in the directory beneath
+them _sisu/image. 〔b¤SiSU <i>plaintext</i> markup files are of three types that
+may be distinguished by the file extension used: regular text .sst; master
+documents, composite documents that incorporate other text, which can be
+any regular text or text insert; and inserts the contents of which are
+like regular text except these are marked .ssi and are not processed.<br>
+
+<p> <br>
+<b>SiSU</b> processing can be done directly against a sisu documents; which may
+be located locally or on a remote server for which a url is provided.
+<p> <br>
+<b>SiSU</b> source markup can be shared with the command:
+<p> <br>
+ sisu -s [filename]<br>
+
+<p> </dd>
+</dl>
+
+<h2><a name='sect47' href='#toc47'>Sisu Text - Regular Files (.sst)</a></h2>
+
+<p> <br>
+The most common form of document in <b>SiSU,</b> see the section on <b>SiSU</b> markup.
+
+<p>
+<h2><a name='sect48' href='#toc48'>Sisu Master Files (.ssm)</a></h2>
+
+<p> <br>
+Composite documents which incorporate other <b>SiSU</b> documents which may be
+either regular <b>SiSU</b> text .sst which may be generated independently, or inserts
+prepared solely for the purpose of being incorporated into one or more
+master documents.
+<p> <br>
+The mechanism by which master files incorporate other documents is described
+as one of the headings under under <b>SiSU</b> markup in the <b>SiSU</b> manual.
+<p> <br>
+Note: Master documents may be prepared in a similar way to regular documents,
+and processing will occur normally if a .sst file is renamed .ssm without
+requiring any other documents; the .ssm marker flags that the document may
+contain other documents.
+<p> <br>
+Note: a secondary file of the composite document is built prior to processing
+with the same prefix and the suffix ._sst [^19]
+<p>
+<h2><a name='sect49' href='#toc49'>Sisu Insert Files (.ssi)</a></h2>
+
+<p>
+<br>
+Inserts are documents prepared solely for the purpose of being incorporated
+into one or more master documents. They resemble regular <b>SiSU</b> text files
+except they are ignored by the <b>SiSU</b> processor. Making a file a .ssi file
+is a quick and convenient way of flagging that it is not intended that
+the file should be processed on its own.
+<p>
+<h2><a name='sect50' href='#toc50'>Sisupod, Zipped Binary Container
+(sisupod.zip, .ssp)</a></h2>
+
+<p> <br>
+A sisupod is a zipped <b>SiSU</b> text file or set of <b>SiSU</b> text files and any
+associated images that they contain (this will be extended to include sound
+and multimedia-files)
+<p>
+<dl>
+
+<dt><b>SiSU</b> </dt>
+<dd><i>plaintext</i> files rely on a recognised directory
+structure to find contents such as images associated with documents, but
+all images for example for all documents contained in a directory are located
+in the sub-directory _sisu/image. Without the ability to create a sisupod
+it can be inconvenient to manually identify all other files associated
+with a document. A sisupod automatically bundles all associated files with
+the document that is turned into a pod.
+<p> <br>
+The structure of the sisupod is such that it may for example contain a
+single document and its associated images; a master document and its associated
+documents and anything else; or the zipped contents of a whole directory
+of prepared <b>SiSU</b> documents.
+<p> <br>
+The command to create a sisupod is:
+<p> <br>
+ sisu -S [filename]<br>
+
+<p> <br>
+Alternatively, make a pod of the contents of a whole directory:
+<p> <br>
+ sisu -S<br>
+
+<p> <br>
+<b>SiSU</b> processing can be done directly against a sisupod; which may be located
+locally or on a remote server for which a url is provided.
+<p> <br>
+&lt;<a href='http://www.sisudoc.org/sisu/sisu_commands'>http://www.sisudoc.org/sisu/sisu_commands</a>
+&gt;
+<p> <br>
+&lt;<a href='http://www.sisudoc.org/sisu/sisu_manual'>http://www.sisudoc.org/sisu/sisu_manual</a>
+&gt;
+<p> </dd>
+</dl>
+
+<h2><a name='sect51' href='#toc51'>Configuration</a></h2>
+<br>
+
+<p>
+<h2><a name='sect52' href='#toc52'>Configuration Files</a></h2>
+
+<p>
+<h2><a name='sect53' href='#toc53'>Config.yml</a></h2>
+
+<p> <br>
+<b>SiSU</b> configration parameters are adjusted in the configuration file, which
+can be used to override the defaults set. This includes such things as which
+directory interim processing should be done in and where the generated
+output should be placed.
+<p> <br>
+The <b>SiSU</b> configuration file is a yaml file, which means indentation is
+significant.
+<p> <br>
+<b>SiSU</b> resource configuration is determined by looking at the following files
+if they exist:
+<p> <br>
+ ./_sisu/v4/sisurc.yml<br>
+
+<p> <br>
+ ./_sisu/sisurc.yml<br>
+
+<p> <br>
+ ~/.sisu/v4/sisurc.yml<br>
+
+<p> <br>
+ ~/.sisu/sisurc.yml<br>
+
+<p> <br>
+ /etc/sisu/v4/sisurc.yml<br>
+
+<p> <br>
+ /etc/sisu/sisurc.yml<br>
+
+<p> <br>
+The search is in the order listed, and the first one found is used.
+<p> <br>
+In the absence of instructions in any of these it falls back to the internal
+program defaults.
+<p> <br>
+Configuration determines the output and processing directories and the
+database access details.
+<p> <br>
+
+<p>If <b>SiSU</b> is installed a sample sisurc.yml may be found in /etc/sisu/sisurc.yml
+
+<p>
+<h2><a name='sect54' href='#toc54'>Sisu_document_make</a></h2>
+
+<p> <br>
+Most sisu document headers relate to metadata, the exception is the @make:
+header which provides processing related information. The default contents
+of the @make header may be set by placing them in a file sisu_document_make.
+
+<p> <br>
+The search order is as for resource configuration:
+<p> <br>
+ ./_sisu/v4/sisu_document_make<br>
+
+<p> <br>
+ ./_sisu/sisu_document_make<br>
+
+<p> <br>
+ ~/.sisu/v4/sisu_document_make<br>
+
+<p> <br>
+ ~/.sisu/sisu_document_make<br>
+
+<p> <br>
+ /etc/sisu/v4/sisu_document_make<br>
+
+<p> <br>
+ /etc/sisu/sisu_document_make<br>
+
+<p> <br>
+A sample sisu_document_make can be found in the _sisu/ directory under
+along with the provided sisu markup samples.
+<p>
+<h2><a name='sect55' href='#toc55'>Css - Cascading Style Sheets
+(for Html, Xhtml and Xml)</a></h2>
+<br>
+
+<p> <br>
+CSS files to modify the appearance of <b>SiSU</b> html, <i>XHTML</i> or <i>XML</i> may be placed
+in the configuration directory: ./_sisu/css ; ~/.sisu/css or; /etc/sisu/css
+and these will be copied to the output directories with the command sisu
+-CC.
+<p> <br>
+The basic CSS file for html output is html. css, placing a file of that
+name in directory _sisu/css or equivalent will result in the default file
+of that name being overwritten.
+<p> <br>
+<i>HTML:</i> html. css
+<p> <br>
+<i>XML</i> DOM: dom.css
+<p> <br>
+<i>XML</i> SAX: sax.css
+<p> <br>
+<i>XHTML:</i> xhtml. css
+<p> <br>
+The default homepage may use homepage.css or html. css
+<p> <br>
+Under consideration is to permit the placement of a CSS file with a different
+name in directory _sisu/css directory or equivalent.[^20]
+<p>
+<h2><a name='sect56' href='#toc56'>Organising Content
+- Directory Structure and Mapping</a></h2>
+<br>
+
+<p> <br>
+<b>SiSU</b> v3 has new options for the source directory tree, and output directory
+structures of which there are 3 alternatives.
+<p>
+<h2><a name='sect57' href='#toc57'>Document Source Directory</a></h2>
+
+<p>
+<br>
+The document source directory is the directory in which sisu processing
+commands are given. It contains the sisu source files (.sst .ssm .ssi), or
+(for sisu v3 may contain) subdirectories with language codes which contain
+the sisu source files, so all English files would go in subdirectory en/,
+French in fr/, Spanish in es/ and so on. ISO 639-1 codes are used (as varied
+by po4a). A list of available languages (and possible sub-directory names)
+can be obtained with the command "sisu --help lang" The list of languages
+is limited to langagues supported by XeTeX polyglosia.
+<p>
+<h2><a name='sect58' href='#toc58'>General Directories</a></h2>
+
+<p>
+<br>
+<pre>% files stored at this level e.g. sisu_manual.sst or
+% for sisu v3 may be under language sub-directories
+% e.g.
+ ./subject_name/en
+ ./subject_name/fr
+ ./subject_name/es
+ ./subject_name/_sisu
+ ./subject_name/_sisu/css
+ ./subject_name/_sisu/image
+</pre>
+<p>
+<h2><a name='sect59' href='#toc59'>Document Output Directory Structures</a></h2>
+
+<p>
+<h2><a name='sect60' href='#toc60'>Output Directory Root</a></h2>
+
+<p> <br>
+The output directory root can be set in the sisurc.yml file. Under the root,
+subdirectories are made for each directory in which a document set resides.
+If you have a directory named poems or conventions, that directory will
+be created under the output directory root and the output for all documents
+contained in the directory of a particular name will be generated to subdirectories
+beneath that directory (poem or conventions). A document will be placed
+in a subdirectory of the same name as the document with the filetype identifier
+stripped (.sst .ssm)
+<p> <br>
+The last part of a directory path, representing the sub-directory in which
+a document set resides, is the directory name that will be used for the
+output directory. This has implications for the organisation of document
+collections as it could make sense to place documents of a particular subject,
+or type within a directory identifying them. This grouping as suggested
+could be by subject (sales_law, english_literature); or just as conveniently
+by some other classification (X University). The mapping means it is also
+possible to place in the same output directory documents that are for organisational
+purposes kept separately, for example documents on a given subject of two
+different institutions may be kept in two different directories of the
+same name, under a directory named after each institution, and these would
+be output to the same output directory. Skins could be associated with each
+institution on a directory basis and resulting documents will take on the
+appropriate different appearance.
+<p>
+<h2><a name='sect61' href='#toc61'>Alternative Output Structures</a></h2>
+
+<p> <br>
+There are 3 possibile output structures described as being, by language,
+by filetype or by filename, the selection is made in sisurc.yml
+<p> <br>
+<pre>#% output_dir_structure_by: language; filetype; or filename
+output_dir_structure_by: language #(language &amp; filetype, preferred?)
+#output_dir_structure_by: filetype
+#output_dir_structure_by: filename #(default, closest to original v1 &amp;
+v2)
+</pre>
+<p>
+<h2><a name='sect62' href='#toc62'>by Language</a></h2>
+
+<p> <br>
+
+<p>The by language directory structure places output files
+<p> <br>
+The by language directory structure separates output files by language
+code (all files of a given language), and within the language directory
+by filetype.
+<p> <br>
+
+<p>Its selection is configured in sisurc.yml
+<p> <br>
+output_dir_structure_by: language
+<p> <br>
+<pre> |-- en
+ |-- epub
+ |-- hashes
+ |-- html
+ | |-- viral_spiral.david_bollier
+ | |-- manifest
+ | |-- qrcode
+ | |-- odt
+ | |-- pdf
+ | |-- sitemaps
+ | |-- txt
+ | |-- xhtml
+ | &lsquo;-- xml
+ |-- po4a
+ | &lsquo;-- live-manual
+ | |-- po
+ | |-- fr
+ | &lsquo;-- pot
+ &lsquo;-- _sisu
+ |-- css
+ |-- image
+ |-- image_sys -&gt; ../../_sisu/image_sys
+ &lsquo;-- xml
+ |-- rnc
+ |-- rng
+ &lsquo;-- xsd
+</pre>
+<p> <br>
+#by: language subject_dir/en/manifest/filename.html
+<p>
+<h2><a name='sect63' href='#toc63'>by Filetype</a></h2>
+
+<p> <br>
+The by filetype directory structure separates output files by filetype,
+all html files in one directory pdfs in another and so on. Filenames are
+given a language extension.
+<p> <br>
+
+<p>Its selection is configured in sisurc.yml
+<p> <br>
+output_dir_structure_by: filetype
+<p> <br>
+<pre> |-- epub
+ |-- hashes
+ |-- html
+ |-- viral_spiral.david_bollier
+ |-- manifest
+ |-- qrcode
+ |-- odt
+ |-- pdf
+ |-- po4a
+ |-- live-manual
+ | |-- po
+ | |-- fr
+ | &lsquo;-- pot
+ |-- _sisu
+ | |-- css
+ | |-- image
+ | |-- image_sys -&gt; ../../_sisu/image_sys
+ | &lsquo;-- xml
+ | |-- rnc
+ | |-- rng
+ | &lsquo;-- xsd
+ |-- sitemaps
+ |-- txt
+ |-- xhtml
+ &lsquo;-- xml
+</pre>
+<p> <br>
+#by: filetype subject_dir/html/filename/manifest.en.html
+<p>
+<h2><a name='sect64' href='#toc64'>by Filename</a></h2>
+
+<p> <br>
+The by filename directory structure places most output of a particular
+file (the different filetypes) in a common directory.
+<p> <br>
+
+<p>Its selection is configured in sisurc.yml
+<p> <br>
+output_dir_structure_by: filename
+<p> <br>
+<pre> |-- epub
+ |-- po4a
+ |-- live-manual
+ | |-- po
+ | |-- fr
+ | &lsquo;-- pot
+ |-- _sisu
+ | |-- css
+ | |-- image
+ | |-- image_sys -&gt; ../../_sisu/image_sys
+ | &lsquo;-- xml
+ | |-- rnc
+ | |-- rng
+ | &lsquo;-- xsd
+ |-- sitemaps
+ |-- src
+ |-- pod
+ &lsquo;-- viral_spiral.david_bollier
+</pre>
+<p> <br>
+#by: filename subject_dir/filename/manifest.en.html
+<p>
+<h2><a name='sect65' href='#toc65'>Remote Directories</a></h2>
+
+<p> <br>
+<pre>% containing sub_directories named after the generated files from which
+they are made
+ ./subject_name/src
+% contains shared source files text and binary e.g. sisu_manual.sst and sisu_manual.sst.zip
+ ./subject_name/_sisu
+% configuration file e.g. sisurc.yml
+ ./subject_name/_sisu/skin
+% skins in various skin directories doc, dir, site, yml
+ ./subject_name/_sisu/css
+ ./subject_name/_sisu/image
+% images for documents contained in this directory
+ ./subject_name/_sisu/mm
+</pre>
+<p>
+<h2><a name='sect66' href='#toc66'>Sisupod</a></h2>
+
+<p> <br>
+<pre>% files stored at this level e.g. sisu_manual.sst
+ ./sisupod/_sisu
+% configuration file e.g. sisurc.yml
+ ./sisupod/_sisu/skin
+% skins in various skin directories doc, dir, site, yml
+ ./sisupod/_sisu/css
+ ./sisupod/_sisu/image
+% images for documents contained in this directory
+ ./sisupod/_sisu/mm
+</pre>
+<p>
+<h2><a name='sect67' href='#toc67'>Organising Content</a></h2>
+
+<p>
+<h2><a name='sect68' href='#toc68'>Homepages</a></h2>
+<br>
+
+<p> <br>
+<b>SiSU</b> is about the ability to auto-generate documents. Home pages are regarded
+as custom built items, and are not created by <b>SiSU.</b> More accurately, <b>SiSU</b>
+has a default home page, which will not be appropriate for use with other
+sites, and the means to provide your own home page instead in one of two
+ways as part of a site&rsquo;s configuration, these being:
+<p> <br>
+1. through placing your home page and other custom built documents in the
+subdirectory _sisu/home/ (this probably being the easier and more convenient
+option)
+<p> <br>
+2. through providing what you want as the home page in a skin,
+<p> <br>
+Document sets are contained in directories, usually organised by site or
+subject. Each directory can/should have its own homepage. See the section
+on directory structure and organisation of content.
+<p>
+<h2><a name='sect69' href='#toc69'>Home Page and Other
+Custom Built Pages in a Sub-directory</a></h2>
+
+<p> <br>
+Custom built pages, including the home page index.html may be placed within
+the configuration directory _sisu/home/ in any of the locations that is
+searched for the configuration directory, namely ./_sisu ; ~/_sisu ; /etc/sisu
+From there they are copied to the root of the output directory with the
+command:
+<p> <br>
+ sisu -CC<br>
+
+<p>
+<h2><a name='sect70' href='#toc70'>Markup and Output Examples</a></h2>
+<br>
+
+<p>
+<h2><a name='sect71' href='#toc71'>Markup Examples</a></h2>
+
+<p> <br>
+Current markup examples and document output samples are provided off &lt;<a href='http://sisudoc.org'>http://sisudoc.org</a>
+&gt;
+or &lt;<a href='http://www.jus.uio.no/sisu'>http://www.jus.uio.no/sisu</a>
+&gt; and in the sisu -markup-sample package available
+off &lt;<a href='http://sources.sisudoc.org'>http://sources.sisudoc.org</a>
+&gt;
+<p> <br>
+For some documents hardly any markup at all is required at all, other than
+a header, and an indication that the levels to be taken into account by
+the program in generating its output are.
+<p>
+<h2><a name='sect72' href='#toc72'>Sisu Markup Samples</a></h2>
+
+<p> <br>
+A few additional sample books prepared as sisu markup samples, output formats
+to be generated using <b>SiSU</b> are contained in a separate package sisu -markup-samples.
+sisu -markup-samples contains books (prepared using sisu markup), that were
+released by their authors various licenses mostly different Creative Commons
+licences that do not permit inclusion in the <b>Debian</b> Project as they have
+requirements that do not meet the <b>Debian</b> Free Software Guidelines for various
+reasons, most commonly that they require that the original substantive
+text remain unchanged, and sometimes that the works be used only non-commercially.
+
+<p> <br>
+<i>Accelerando,</i> Charles Stross (2005) accelerando.charles_stross.sst
+<p> <br>
+<i>Alice&rsquo;s</i> Adventures in Wonderland, Lewis Carroll (1865) alices_adventures_in_wonderland.lewis_carroll.sst
+
+<p> <br>
+<i>CONTENT,</i> Cory Doctorow (2008) content.cory_doctorow.sst
+<p> <br>
+<i>Democratizing</i> Innovation, Eric von Hippel (2005) democratizing_innovation.eric_von_hippel.sst
+
+<p> <br>
+<i>Down</i> and Out in the Magic Kingdom, Cory Doctorow (2003) down_and_out_in_the_magic_kingdom.cory_doctorow.sst
+
+<p> <br>
+<i>For</i> the Win, Cory Doctorow (2010) for_the_win.cory_doctorow.sst
+<p> <br>
+<i>Free</i> as in Freedom - Richard Stallman&rsquo;s Crusade for Free Software, Sam Williams
+(2002) free_as_in_freedom.richard_stallman_crusade_for_free_software.sam_williams.sst
+
+<p> <br>
+<i>Free</i> as in Freedom 2.0 - Richard Stallman and the Free Software Revolution,
+Sam Williams (2002), Richard M. Stallman (2010) free_as_in_freedom_2.richard_stallman_and_the_free_software_revolution.sam_williams.richard_stallman.sst
+
+<p> <br>
+<i>Free</i> Culture - How Big Media Uses Technology and the Law to Lock Down Culture
+and Control Creativity, Lawrence Lessig (2004) free_culture.lawrence_lessig.sst
+
+<p> <br>
+<i>Free</i> For All - How Linux and the Free Software Movement Undercut the High
+Tech Titans, Peter Wayner (2002) free_for_all.peter_wayner.sst
+<p> <br>
+<i>GNU</i> GENERAL PUBLIC LICENSE v2, Free Software Foundation (1991) gpl2.fsf.sst
+
+<p> <br>
+<i>GNU</i> GENERAL PUBLIC LICENSE v3, Free Software Foundation (2007) gpl3.fsf.sst
+
+<p> <br>
+<i>Gulliver&rsquo;s</i> Travels, Jonathan Swift (1726 / 1735) gullivers_travels.jonathan_swift.sst
+
+<p> <br>
+<i>Little</i> Brother, Cory Doctorow (2008) little_brother.cory_doctorow.sst
+<p> <br>
+<i>The</i> Cathederal and the Bazaar, Eric Raymond (2000) the_cathedral_and_the_bazaar.eric_s_raymond.sst
+
+<p> <br>
+<i>The</i> Public Domain - Enclosing the Commons of the Mind, James Boyle (2008)
+
+<p>the_public_domain.james_boyle.sst
+<p> <br>
+<i>The</i> Wealth of Networks - How Social Production Transforms Markets and Freedom,
+Yochai Benkler (2006) the_wealth_of_networks.yochai_benkler.sst
+<p> <br>
+<i>Through</i> the Looking Glass, Lewis Carroll (1871) through_the_looking_glass.lewis_carroll.sst
+
+<p> <br>
+<i>Two</i> Bits - The Cultural Significance of Free Software, Christopher Kelty
+(2008) two_bits.christopher_kelty.sst
+<p> <br>
+<i>UN</i> Contracts for International Sale of Goods, UN (1980) un_contracts_international_sale_of_goods_convention_1980.sst
+
+<p> <br>
+<i>Viral</i> Spiral, David Bollier (2008) viral_spiral.david_bollier.sst
+<p>
+<h2><a name='sect73' href='#toc73'>Sisu Search
+- Introduction</a></h2>
+<br>
+
+<p> <br>
+<b>SiSU</b> output can easily and conveniently be indexed by a number of standalone
+indexing tools, such as Lucene, Hyperestraier.
+<p> <br>
+Because the document structure of sites created is clearly defined, and
+the text <i>object</i> citation system is available hypothetically at least, for
+all forms of output, it is possible to search the sql database, and either
+read results from that database, or just as simply map the results to the
+html output, which has richer text markup.
+<p> <br>
+In addition to this <b>SiSU</b> has the ability to populate a relational sql type
+database with documents at an object level, with objects numbers that are
+shared across different output types, which make them searchable with that
+degree of granularity. Basically, your match criteria is met by these documents
+and at these locations within each document, which can be viewed within
+the database directly or in various output formats.
+<p>
+<h2><a name='sect74' href='#toc74'>Sql</a></h2>
+<br>
+
+<p>
+<h2><a name='sect75' href='#toc75'>Populating Sql Type Databases</a></h2>
+
+<p> <br>
+<b>SiSU</b> feeds sisu markupd documents into sql type databases <i>PostgreSQL</i> [^21]
+and/or <i>SQLite</i> [^22] database together with information related to document
+structure.
+<p> <br>
+This is one of the more interesting output forms, as all the structural
+data of the documents are retained (though can be ignored by the user of
+the database should they so choose). All site texts/documents are (currently)
+streamed to four tables:
+<p> <br>
+ * one containing semantic (and other) headers, including, title, author,<br>
+ subject, (the<br>
+ .I Dublin Core.<br>
+ ..);<br>
+
+<p> <br>
+ * another the substantive texts by individual "paragraph" (or object)
+-<br>
+ along with structural information, each paragraph being identifiable
+by its<br>
+ paragraph number (if it has one which almost all of them do), and the<br>
+ substantive text of each paragraph quite naturally being searchable
+(both in<br>
+ formatted and clean text versions for searching); and<br>
+
+<p> <br>
+ * a third containing endnotes cross-referenced back to the paragraph from<br>
+ which they are referenced (both in formatted and clean text versions
+for<br>
+ searching).<br>
+
+<p> <br>
+ * a fourth table with a one to one relation with the headers table contains<br>
+ full text versions of output, eg. pdf, html, xml, and<br>
+ .I ascii.<br>
+
+<p> <br>
+There is of course the possibility to add further structures.
+<p> <br>
+At this level <b>SiSU</b> loads a relational database with documents chunked into
+objects, their smallest logical structurally constituent parts, as text
+objects, with their object citation number and all other structural information
+needed to construct the document. Text is stored (at this text object level)
+with and without elementary markup tagging, the stripped version being
+so as to facilitate ease of searching.
+<p> <br>
+Being able to search a relational database at an object level with the
+<b>SiSU</b> citation system is an effective way of locating content generated
+by <b>SiSU.</b> As individual text objects of a document stored (and indexed) together
+with object numbers, and all versions of the document have the same numbering,
+complex searches can be tailored to return just the locations of the search
+results relevant for all available output formats, with live links to the
+precise locations in the database or in html/xml documents; or, the structural
+information provided makes it possible to search the full contents of the
+database and have headings in which search content appears, or to search
+only headings etc. (as the <i>Dublin</i> Core is incorporated it is easy to make
+use of that as well).
+<p>
+<h2><a name='sect76' href='#toc76'>Postgresql</a></h2>
+<br>
+
+<p>
+<h2><a name='sect77' href='#toc77'>Name</a></h2>
+
+<p> <br>
+<b>SiSU</b> - Structured information, Serialized Units - a document publishing system,
+
+<p>postgresql dependency package
+<p>
+<h2><a name='sect78' href='#toc78'>Description</a></h2>
+
+<p> <br>
+Information related to using postgresql with sisu (and related to the sisu_postgresql
+dependency package, which is a dummy package to install dependencies needed
+for <b>SiSU</b> to populate a postgresql database, this being part of <b>SiSU</b> - man
+sisu) .
+<p>
+<h2><a name='sect79' href='#toc79'>Synopsis</a></h2>
+
+<p> <br>
+ sisu -D [instruction] [filename/wildcard &nbsp;if &nbsp;required]<br>
+
+<p> <br>
+ sisu -D --pg --[instruction] [filename/wildcard &nbsp;if &nbsp;required]<br>
+
+<p>
+<h2><a name='sect80' href='#toc80'>Commands</a></h2>
+
+<p> <br>
+Mappings to two databases are provided by default, postgresql and sqlite,
+the same commands are used within sisu to construct and populate databases
+however -d (lowercase) denotes sqlite and -D (uppercase) denotes postgresql,
+
+<p>alternatively --sqlite or --pgsql may be used
+<p> <br>
+<b>-D or --pgsql</b> may be used interchangeably.
+<p>
+<h2><a name='sect81' href='#toc81'>Create and Destroy Database</a></h2>
+
+<p>
+<dl>
+
+<dt><b>--pgsql
+--createall</b> </dt>
+<dd>initial step, creates required relations (tables, indexes) in
+existing (postgresql) database (a database should be created manually and
+given the same name as working directory, as requested) (rb.dbi)
+<p> </dd>
+
+<dt><b>sisu -D
+--createdb</b> </dt>
+<dd>creates database where no database existed before
+<p> </dd>
+
+<dt><b>sisu -D --create</b>
+</dt>
+<dd>
+<p>creates database tables where no database tables existed before
+<p> </dd>
+
+<dt><b>sisu -D
+--Dropall</b> </dt>
+<dd>destroys database (including all its content)! kills data and drops
+tables, indexes and database associated with a given directory (and directories
+of the same name).
+<p> </dd>
+
+<dt><b>sisu -D --recreate</b> </dt>
+<dd>destroys existing database and builds
+
+<p>a new empty database structure
+<p> </dd>
+</dl>
+
+<h2><a name='sect82' href='#toc82'>Import and Remove Documents</a></h2>
+
+<p>
+<dl>
+
+<dt><b>sisu -D --import
+-v [filename/wildcard]</b> </dt>
+<dd>populates database with the contents of the file.
+Imports documents(s) specified to a postgresql database (at an object level).
+
+<p> </dd>
+
+<dt><b>sisu -D --update -v [filename/wildcard]</b> </dt>
+<dd>updates file contents in database
+
+<p> </dd>
+
+<dt><b>sisu -D --remove -v [filename/wildcard]</b> </dt>
+<dd>removes specified document from postgresql
+database.
+<p> </dd>
+</dl>
+
+<h2><a name='sect83' href='#toc83'>Sqlite</a></h2>
+<br>
+
+<p>
+<h2><a name='sect84' href='#toc84'>Name</a></h2>
+
+<p> <br>
+<b>SiSU</b> - Structured information, Serialized Units - a document publishing system.
+
+<p>
+<h2><a name='sect85' href='#toc85'>Description</a></h2>
+
+<p> <br>
+Information related to using sqlite with sisu (and related to the sisu_sqlite
+dependency package, which is a dummy package to install dependencies needed
+for <b>SiSU</b> to populate an sqlite database, this being part of <b>SiSU</b> - man sisu)
+.
+<p>
+<h2><a name='sect86' href='#toc86'>Synopsis</a></h2>
+
+<p> <br>
+ sisu -d [instruction] [filename/wildcard &nbsp;if &nbsp;required]<br>
+
+<p> <br>
+ sisu -d --(sqlite|pg) --[instruction] [filename/wildcard &nbsp;if <br>
+ required]<br>
+
+<p>
+<h2><a name='sect87' href='#toc87'>Commands</a></h2>
+
+<p> <br>
+Mappings to two databases are provided by default, postgresql and sqlite,
+the same commands are used within sisu to construct and populate databases
+however -d (lowercase) denotes sqlite and -D (uppercase) denotes postgresql,
+
+<p>alternatively --sqlite or --pgsql may be used
+<p> <br>
+<b>-d or --sqlite</b> may be used interchangeably.
+<p>
+<h2><a name='sect88' href='#toc88'>Create and Destroy Database</a></h2>
+
+<p>
+<dl>
+
+<dt><b>--sqlite
+--createall</b> </dt>
+<dd>initial step, creates required relations (tables, indexes) in
+existing (sqlite) database (a database should be created manually and given
+the same name as working directory, as requested) (rb.dbi)
+<p> </dd>
+
+<dt><b>sisu -d --createdb</b>
+</dt>
+<dd>
+<p>creates database where no database existed before
+<p> </dd>
+
+<dt><b>sisu -d --create</b> </dt>
+<dd>creates
+
+<p>database tables where no database tables existed before
+<p> </dd>
+
+<dt><b>sisu -d --dropall</b>
+</dt>
+<dd>destroys database (including all its content)! kills data and drops tables,
+indexes and database associated with a given directory (and directories
+of the same name).
+<p> </dd>
+
+<dt><b>sisu -d --recreate</b> </dt>
+<dd>destroys existing database and builds
+
+<p>a new empty database structure
+<p> </dd>
+</dl>
+
+<h2><a name='sect89' href='#toc89'>Import and Remove Documents</a></h2>
+
+<p>
+<dl>
+
+<dt><b>sisu -d --import
+-v [filename/wildcard]</b> </dt>
+<dd>populates database with the contents of the file.
+Imports documents(s) specified to an sqlite database (at an object level).
+
+<p> </dd>
+
+<dt><b>sisu -d --update -v [filename/wildcard]</b> </dt>
+<dd>updates file contents in database
+
+<p> </dd>
+
+<dt><b>sisu -d --remove -v [filename/wildcard]</b> </dt>
+<dd>removes specified document from sqlite
+database.
+<p> </dd>
+</dl>
+
+<h2><a name='sect90' href='#toc90'>Introduction</a></h2>
+<br>
+
+<p>
+<h2><a name='sect91' href='#toc91'>Search - Database Frontend Sample, Utilising Database and Sisu Features,</a></h2>
+INCLUDING
+OBJECT CITATION NUMBERING (BACKEND CURRENTLY POSTGRESQL)
+<p> <br>
+Sample search frontend &lt;<a href='http://search.sisudoc.org'>http://search.sisudoc.org</a>
+&gt; [^23] A small database and
+sample query front-end (search from) that makes use of the citation system,
+<i>object</i> citation numbering to demonstrates functionality.[^24]
+<p> <br>
+<b>SiSU</b> can provide information on which documents are matched and at what
+locations within each document the matches are found. These results are
+relevant across all outputs using <i>object</i> citation numbering, which includes
+html, <i>XML,</i> <i>EPUB,</i> <i>LaTeX,</i> <i>PDF</i> and indeed the <i>SQL</i> database. You can then refer
+to one of the other outputs or in the <i>SQL</i> database expand the text within
+the matched objects (paragraphs) in the documents matched.
+<p> <br>
+Note you may set results either for documents matched and object number
+locations within each matched document meeting the search criteria; or
+display the names of the documents matched along with the objects (paragraphs)
+that meet the search criteria.[^25]
+<p>
+<dl>
+
+<dt><b>sisu -F --webserv-webrick</b> </dt>
+<dd>builds a cgi web
+
+<p>search frontend for the database created
+<p> <br>
+The following is feedback on the setup on a machine provided by the help
+command:
+<p> <br>
+ sisu --help sql<br>
+
+<p> <br>
+<pre>Postgresql
+ user: ralph
+ current db set: SiSU_sisu
+ port: 5432
+ dbi connect: DBI:Pg:database=SiSU_sisu;port=5432
+sqlite
+ current db set: /home/ralph/sisu_www/sisu/sisu_sqlite.db
+ dbi connect DBI:SQLite:/home/ralph/sisu_www/sisu/sisu_sqlite.db
+</pre>
+<p> <br>
+
+<p>Note on databases built
+<p> <br>
+By default, [unless &nbsp;otherwise &nbsp;specified] databases are built on a directory
+basis, from collections of documents within that directory. The name of
+the directory you choose to work from is used as the database name, i.e.
+if you are working in a directory called /home/ralph/ebook the database
+SiSU_ebook is used. [otherwise &nbsp;a &nbsp;manual &nbsp;mapping &nbsp;for &nbsp;the &nbsp;collection &nbsp;is
+<p> </dd>
+</dl>
+
+<h2><a name='sect92' href='#toc92'>Search
+Form</a></h2>
+
+<p>
+<dl>
+
+<dt><b>sisu -F</b> </dt>
+<dd>generates a sample search form, which must be copied to the
+
+<p>web-server cgi directory
+<p> </dd>
+
+<dt><b>sisu -F --webserv-webrick</b> </dt>
+<dd>generates a sample search
+form for use with the webrick server, which must be copied to the web-server
+
+<p>cgi directory
+<p> </dd>
+
+<dt><b>sisu -W</b> </dt>
+<dd>starts the webrick server which should be available
+
+<p>wherever sisu is properly installed
+<p> <br>
+
+<p>The generated search form must be copied manually to the webserver directory
+
+<p>as instructed
+<p> </dd>
+</dl>
+
+<h2><a name='sect93' href='#toc93'>Sisu_webrick</a></h2>
+<br>
+
+<p>
+<h2><a name='sect94' href='#toc94'>Name</a></h2>
+
+<p> <br>
+<b>SiSU</b> - Structured information, Serialized Units - a document publishing system
+
+<p>
+<h2><a name='sect95' href='#toc95'>Synopsis</a></h2>
+
+<p> <br>
+sisu_webrick [port]
+<p> <br>
+
+<p>or
+<p> <br>
+sisu -W [port]
+<p>
+<h2><a name='sect96' href='#toc96'>Description</a></h2>
+
+<p> <br>
+sisu_webrick is part of <b>SiSU</b> (man sisu) sisu_webrick starts <b>Ruby</b> <b>SiSU</b>
+output is written, providing a list of these directories (assuming <b>SiSU</b>
+is in use and they exist).
+<p> <br>
+The default port for sisu_webrick is set to 8081, this may be modified
+in the yaml file: ~/.sisu/sisurc.yml a sample of which is provided as /etc/sisu/sisurc.yml
+(or in the equivalent directory on your system).
+<p>
+<h2><a name='sect97' href='#toc97'>Summary of Man Page</a></h2>
+
+<p> <br>
+sisu_webrick, may be started on it&rsquo;s own with the command: sisu_webrick
+[port] or using the sisu command with the -W flag: sisu -W [port]
+<p> <br>
+
+<p>where no port is given and settings are unchanged the default port is 8081
+
+<p>
+<h2><a name='sect98' href='#toc98'>Document Processing Command Flags</a></h2>
+
+<p> <br>
+sisu -W [port] starts <b>Ruby</b> Webrick web-server, serving <b>SiSU</b> output directories,
+on the port provided, or if no port is provided and the defaults have not
+
+<p>been changed in ~/.sisu/sisurc.yaml then on port 8081
+<p>
+<h2><a name='sect99' href='#toc99'>Summary of Features</a></h2>
+<br>
+
+<p> <br>
+* sparse/minimal markup (clean utf-8 source texts). Documents are prepared
+in a single <i>UTF-8</i> file using a minimalistic mnemonic syntax. Typical literature,
+documents like "War and Peace" require almost no markup, and most of the
+headers are optional.
+<p> <br>
+* markup is easily readable/parsable by the human eye, (basic markup is
+simpler and more sparse than the most basic <i>HTML</i> ) , [this &nbsp;may &nbsp;also &nbsp;be
+&nbsp;converted &nbsp;to &nbsp;.I &nbsp;XML &nbsp;representations &nbsp;of &nbsp;the &nbsp;same &nbsp;input/source &nbsp;document].
+<p>
+<br>
+* markup defines document structure (this may be done once in a header
+pattern-match description, or for heading levels individually); basic text
+attributes (bold, italics, underscore, strike-through etc.) as required;
+and semantic information related to the document (header information, extended
+beyond the Dublin core and easily further extended as required); the headers
+may also contain processing instructions. <b>SiSU</b> markup is primarily an abstraction
+of document structure and document metadata to permit taking advantage
+of the basic strengths of existing alternative practical standard ways
+of representing documents [be &nbsp;that &nbsp;browser viewing, &nbsp;paper &nbsp;publication,
+&nbsp;sql &nbsp;search &nbsp;etc.] (html, epub, xml, odf, latex, pdf, sql)
+<p> <br>
+* for output produces reasonably elegant output of established industry
+and institutionally accepted open standard formats.[3] takes advantage of
+the different strengths of various standard formats for representing documents,
+amongst the output formats currently supported are:
+<p> <br>
+* <i>HTML</i> - both as a single scrollable text and a segmented document
+<p> <br>
+* <i>XHTML</i>
+<p> <br>
+* <i>EPUB</i>
+<p> <br>
+* <i>XML</i> - both in sax and dom style xml structures for further development
+
+<p>as required
+<p> <br>
+* <i>ODT</i> - Open Document Format text, the iso standard for document storage
+
+<p> <br>
+* <i>LaTeX</i> - used to generate pdf
+<p> <br>
+* <i>PDF</i> (via <i>LaTeX</i> )
+<p> <br>
+* <i>SQL</i> - population of an sql database ( <i>PostgreSQL</i> or <i>SQLite</i> ) , (at the
+same object level that is used to cite text within a document)
+<p> <br>
+Also produces: concordance files; document content certificates (md5 or
+sha256 digests of headings, paragraphs, images etc.) and html manifests
+(and sitemaps of content). (b) takes advantage of the strengths implicit
+in these very different output types, (e.g. PDFs produced using typesetting
+of <i>LaTeX,</i> databases populated with documents at an individual object/paragraph
+level, making possible <i>granular</i> search (and related possibilities))
+<p> <br>
+* ensuring content can be cited in a meaningful way regardless of selected
+output format. Online publishing (and publishing in multiple document formats)
+lacks a useful way of citing text internally within documents (important
+to academics generally and to lawyers) as page numbers are meaningless
+across browsers and formats. sisu seeks to provide a common way of pinpoint
+the text within a document, (which can be utilized for citation and by
+search engines). The outputs share a common numbering system that is meaningful
+(to man and machine) across all digital outputs whether paper, screen,
+or database oriented, (pdf, <i>HTML,</i> <i>EPUB,</i> xml, sqlite, postgresql) , this
+numbering system can be used to reference content.
+<p> <br>
+* Granular search within documents. <i>SQL</i> databases are populated at an object
+level (roughly headings, paragraphs, verse, tables) and become searchable
+with that degree of granularity, the output information provides the object/paragraph
+numbers which are relevant across all generated outputs; it is also possible
+to look at just the matching paragraphs of the documents in the database;
+[output &nbsp;indexing &nbsp;also &nbsp;work
+<p> <br>
+* long term maintainability of document collections in a world of changing
+formats, having a very sparsely marked-up source document base. there is
+a considerable degree of future-proofing, output representations are "upgradeable",
+and new document formats may be added. e.g. addition of odf (open document
+text) module in 2006, epub in 2009 and in future html5 output sometime
+in future, without modification of existing prepared texts
+<p> <br>
+* <i>SQL</i> search aside, documents are generated as required and static once
+generated.
+<p> <br>
+* documents produced are static files, and may be batch processed, this
+needs to be done only once but may be repeated for various reasons as desired
+(updated content, addition of new output formats, updated technology document
+presentations/representations)
+<p> <br>
+* document source ( <i>plaintext</i> utf-8) if shared on the net may be used as
+
+<p>input and processed locally to produce the different document outputs
+<p>
+<br>
+* document source may be bundled together (automatically) with associated
+documents (multiple language versions or master document with inclusions)
+and images and sent as a zip file called a sisupod, if shared on the net
+
+<p>these too may be processed locally to produce the desired document outputs
+
+<p> <br>
+* generated document outputs may automatically be posted to remote sites.
+
+<p> <br>
+* for basic document generation, the only software dependency is <b>Ruby,</b>
+and a few standard Unix tools (this covers <i>plaintext,</i> <i>HTML,</i> <i>EPUB,</i> <i>XML,</i>
+<i>ODF,</i> <i>LaTeX</i> ) . To use a database you of course need that, and to convert
+the <i>LaTeX</i> generated to pdf, a latex processor like tetex or texlive.
+<p> <br>
+* as a developers tool it is flexible and extensible
+<p> <br>
+Syntax highlighting for <b>SiSU</b> markup is available for a number of text editors.
+
+<p> <br>
+<b>SiSU</b> is less about document layout than about finding a way with little
+markup to be able to construct an abstract representation of a document
+that makes it possible to produce multiple representations of it which
+may be rather different from each other and used for different purposes,
+whether layout and publishing, or search of content
+<p> <br>
+i.e. to be able to take advantage from this minimal preparation starting
+point of some of the strengths of rather different established ways of
+representing documents for different purposes, whether for search (relational
+database, or indexed flat files generated for that purpose whether of complete
+documents, or say of files made up of objects), online viewing (e.g. html,
+xml, pdf) , or paper publication (e.g. pdf) ...
+<p> <br>
+the solution arrived at is by extracting structural information about the
+document (about headings within the document) and by tracking objects (which
+are serialized and also given hash values) in the manner described. It makes
+possible representations that are quite different from those offered at
+present. For example objects could be saved individually and identified
+by their hashes, with an index of how the objects relate to each other
+to form a document.
+<p>
+<ol>
+<b>.</b><li>objects include: headings, paragraphs, verse, tables,
+images, but not footnotes/endnotes which are numbered separately and tied
+to the object from which they are referenced.
+<p> <br>
+</li><b>.</b><li>i.e. the
+<p> <br>
+<i>HTML,</i>
+<p> <br>
+<i>PDF,</i>
+<p> <br>
+<i>EPUB,</i>
+<p> <br>
+
+<p><i>ODT</i>
+<p> <br>
+outputs are each built individually and optimised for that form of presentation,
+rather than for example the html being a saved version of the odf, or the
+pdf being a saved version of the html.
+<p> <br>
+</li><b>.</b><li>
+<p>the different heading levels
+<p> <br>
+</li><b>.</b><li>units of text, primarily paragraphs and headings, also any tables, poems,
+
+<p>code-blocks
+<p> <br>
+</li><b>.</b><li>
+<p>An open standard format for e-books
+<p> <br>
+</li><b>.</b><li>Open Document Format (
+<p> <br>
+
+<p><i>ODF</i>
+<p> <br>
+) text
+<p> <br>
+</li><b>.</b><li>
+<p>Specification submitted by Adobe to ISO to become a full open ISO specification
+
+<p> <br>
+&lt;<a href='http://www.linux-watch.com/news/NS7542722606.html'>http://www.linux-watch.com/news/NS7542722606.html</a>
+&gt;
+<p> <br>
+</li><b>.</b><li>
+<p>ISO standard ISO/IEC 26300:2006
+<p> <br>
+</dd>
+
+<dt><b>*1.</b> </dt>
+<dd>square brackets
+<p> <br>
+</dd>
+
+<dt><b>*2.</b> </dt>
+<dd>square brackets
+<p> <br>
+</dd>
+
+<dt><b>+1.</b> </dt>
+<dd>square brackets
+<p> <br>
+</li><b>.</b><li>&lt;<a href='http://www.jus.uio.no/sisu/man/'>http://www.jus.uio.no/sisu/man/</a>
+&gt;
+<p> <br>
+</li><b>.</b><li>&lt;<a href='http://www.jus.uio.no/sisu/man/sisu.1.html'>http://www.jus.uio.no/sisu/man/sisu.1.html</a>
+&gt;
+<p> <br>
+</li><b>.</b><li>From sometime after SiSU 0.58 it should be possible to describe SiSU markup
+using SiSU, which though not an original design goal is useful.
+<p> <br>
+</li><b>.</b><li>
+<p>files should be prepared using
+<p> <br>
+
+<p><i>UTF-8</i>
+<p> <br>
+
+<p>character encoding
+<p> <br>
+</li><b>.</b><li>
+<p>a footnote or endnote
+<p> <br>
+</li><b>.</b><li>self contained endnote marker &amp; endnote in one
+<p> <br>
+</dd>
+
+<dt><b>*.</b> </dt>
+<dd>unnumbered asterisk footnote/endnote, insert multiple asterisks if required
+
+<p> <br>
+</dd>
+
+<dt><b>**.</b> </dt>
+<dd>another unnumbered asterisk footnote/endnote
+<p> <br>
+</dd>
+
+<dt><b>*3.</b> </dt>
+<dd>editors notes, numbered asterisk footnote/endnote series
+<p> <br>
+</dd>
+
+<dt><b>+2.</b> </dt>
+<dd>editors notes, numbered asterisk footnote/endnote series
+<p> <br>
+</li><b>.</b><li>&lt;<a href='http://www.sisudoc.org/'>http://www.sisudoc.org/</a>
+&gt;
+<p> <br>
+</li><b>.</b><li>&lt;<a href='http://www.ruby-lang.org/en/'>http://www.ruby-lang.org/en/</a>
+&gt;
+<p> <br>
+</li><b>.</b><li>
+<p>Table from the Wealth of Networks by Yochai Benkler
+<p> <br>
+&lt;<a href='http://www.jus.uio.no/sisu/the_wealth_of_networks.yochai_benkler'>http://www.jus.uio.no/sisu/the_wealth_of_networks.yochai_benkler</a>
+&gt;
+<p> <br>
+</li><b>.</b><li>.ssc (for composite) is under consideration but ._sst makes clear that this
+is not a regular file to be worked on, and thus less likely that people
+will have "accidents", working on a .ssc file that is overwritten by subsequent
+processing. It may be however that when the resulting file is shared .ssc
+is an appropriate suffix to use.
+<p> <br>
+</li><b>.</b><li>&lt;<a href='http://www.postgresql.org/'>http://www.postgresql.org/</a>
+&gt;
+<p> <br>
+&lt;<a href='http://advocacy.postgresql.org/'>http://advocacy.postgresql.org/</a>
+&gt;
+<p> <br>
+&lt;<a href='http://en.wikipedia.org/wiki/Postgresql'>http://en.wikipedia.org/wiki/Postgresql</a>
+&gt;
+<p> <br>
+</li><b>.</b><li>&lt;<a href='http://www.hwaci.com/sw/sqlite/'>http://www.hwaci.com/sw/sqlite/</a>
+&gt;
+<p> <br>
+&lt;<a href='http://en.wikipedia.org/wiki/Sqlite'>http://en.wikipedia.org/wiki/Sqlite</a>
+&gt;
+<p> <br>
+</li><b>.</b><li>&lt;<a href='http://search.sisudoc.org'>http://search.sisudoc.org</a>
+&gt;
+<p> <br>
+</li><b>.</b><li>(which could be extended further with current back-end). As regards scaling
+of the database, it is as scalable as the database (here Postgresql) and
+hardware allow.
+<p> <br>
+</li><b>.</b><li>of this feature when demonstrated to an IBM software innovations evaluator
+in 2004 he said to paraphrase: this could be of interest to us. We have
+large document management systems, you can search hundreds of thousands
+of documents and we can tell you which documents meet your search criteria,
+but there is no way we can tell you without opening each document where
+within each your matches are found.
+<p> <br>
+
+<p> </li>
+</ol>
+
+<h2><a name='sect100' href='#toc100'>See Also</a></h2>
+ <a href='http:~/bin/man2html?sisu:1'>sisu(1)</a>
+,<br>
+ <a href='http:~/bin/man2html?sisu-epub:1'>sisu-epub(1)</a>
+,<br>
+ <a href='http:~/bin/man2html?sisu-harvest:1'>sisu-harvest(1)</a>
+,<br>
+ <a href='http:~/bin/man2html?sisu-html:1'>sisu-html(1)</a>
+,<br>
+ <a href='http:~/bin/man2html?sisu-odf:1'>sisu-odf(1)</a>
+,<br>
+ <a href='http:~/bin/man2html?sisu-pdf:1'>sisu-pdf(1)</a>
+,<br>
+ <a href='http:~/bin/man2html?sisu-pg:1'>sisu-pg(1)</a>
+,<br>
+ <a href='http:~/bin/man2html?sisu-sqlite:1'>sisu-sqlite(1)</a>
+,<br>
+ <a href='http:~/bin/man2html?sisu-txt:1'>sisu-txt(1)</a>
+.<br>
+ <a href='http:~/bin/man2html?sisu_vim:7'>sisu_vim(7)</a>
+<br>
+
+<h2><a name='sect101' href='#toc101'>Homepage</a></h2>
+ More information about SiSU can be found at &lt;<a href='http://www.sisudoc.org/'>http://www.sisudoc.org/</a>
+&gt;
+or &lt;<a href='http://www.jus.uio.no/sisu/'>http://www.jus.uio.no/sisu/</a>
+&gt;<br>
+
+<h2><a name='sect102' href='#toc102'>Source</a></h2>
+ &lt;<a href='http://sources.sisudoc.org/'>http://sources.sisudoc.org/</a>
+&gt;<br>
+
+<h2><a name='sect103' href='#toc103'>Author</a></h2>
+ SiSU is written by Ralph Amissah &lt;ralph@amissah.com&gt;<br>
+ <p>
+
+<hr><p>
+<a name='toc'><b>Table of Contents</b></a><p>
+<ul>
+<li><a name='toc0' href='#sect0'>Name</a></li>
+<li><a name='toc1' href='#sect1'>Synopsis</a></li>
+<li><a name='toc2' href='#sect2'>Sisu - Manual,</a></li>
+<li><a name='toc3' href='#sect3'>What is Sisu?</a></li>
+<li><a name='toc4' href='#sect4'>Introduction - What is Sisu?</a></li>
+<li><a name='toc5' href='#sect5'>Commands Summary</a></li>
+<li><a name='toc6' href='#sect6'>Description</a></li>
+<li><a name='toc7' href='#sect7'>Document Processing Command Flags</a></li>
+<li><a name='toc8' href='#sect8'>Command Line Modifiers</a></li>
+<li><a name='toc9' href='#sect9'>Database Commands</a></li>
+<li><a name='toc10' href='#sect10'>Shortcuts, Shorthand for Multiple Flags</a></li>
+<li><a name='toc11' href='#sect11'>Command Line with Flags - Batch Processing</a></li>
+<li><a name='toc12' href='#sect12'>Help</a></li>
+<li><a name='toc13' href='#sect13'>Sisu Manual</a></li>
+<li><a name='toc14' href='#sect14'>Sisu Man Pages</a></li>
+<li><a name='toc15' href='#sect15'>Sisu Built-in Interactive Help</a></li>
+<li><a name='toc16' href='#sect16'>Introduction to Sisu Markup[^11]</a></li>
+<li><a name='toc17' href='#sect17'>Summary</a></li>
+<li><a name='toc18' href='#sect18'>Markup Examples</a></li>
+<li><a name='toc19' href='#sect19'>Online</a></li>
+<li><a name='toc20' href='#sect20'>Installed</a></li>
+<li><a name='toc21' href='#sect21'>Markup of Headers</a></li>
+<li><a name='toc22' href='#sect22'>Sample Header</a></li>
+<li><a name='toc23' href='#sect23'>Available Headers</a></li>
+<li><a name='toc24' href='#sect24'>Markup of Substantive Text</a></li>
+<li><a name='toc25' href='#sect25'>Heading Levels</a></li>
+<li><a name='toc26' href='#sect26'>Font Attributes</a></li>
+<li><a name='toc27' href='#sect27'>Indentation and Bullets</a></li>
+<li><a name='toc28' href='#sect28'>Hanging Indents</a></li>
+<li><a name='toc29' href='#sect29'>Footnotes / Endnotes</a></li>
+<li><a name='toc30' href='#sect30'>Links</a></li>
+<li><a name='toc31' href='#sect31'>Naked Urls Within Text, Dealing with Urls</a></li>
+<li><a name='toc32' href='#sect32'>Linking Text</a></li>
+<li><a name='toc33' href='#sect33'>Linking Images</a></li>
+<li><a name='toc34' href='#sect34'>Link Shortcut for Multiple Versions of a Sisu Document in the Same Directory</a></li>
+<li><a name='toc35' href='#sect35'>Grouped Text</a></li>
+<li><a name='toc36' href='#sect36'>Tables</a></li>
+<li><a name='toc37' href='#sect37'>Poem</a></li>
+<li><a name='toc38' href='#sect38'>Group</a></li>
+<li><a name='toc39' href='#sect39'>Code</a></li>
+<li><a name='toc40' href='#sect40'>Additional Breaks - Linebreaks Within Objects, Column and Page-breaks</a></li>
+<li><a name='toc41' href='#sect41'>Line-breaks</a></li>
+<li><a name='toc42' href='#sect42'>Page Breaks</a></li>
+<li><a name='toc43' href='#sect43'>Book Index</a></li>
+<li><a name='toc44' href='#sect44'>Composite Documents Markup</a></li>
+<li><a name='toc45' href='#sect45'>Sisu Filetypes</a></li>
+<li><a name='toc46' href='#sect46'>.sst .ssm .ssi Marked Up Plain Text</a></li>
+<li><a name='toc47' href='#sect47'>Sisu Text - Regular Files (.sst)</a></li>
+<li><a name='toc48' href='#sect48'>Sisu Master Files (.ssm)</a></li>
+<li><a name='toc49' href='#sect49'>Sisu Insert Files (.ssi)</a></li>
+<li><a name='toc50' href='#sect50'>Sisupod, Zipped Binary Container (sisupod.zip, .ssp)</a></li>
+<li><a name='toc51' href='#sect51'>Configuration</a></li>
+<li><a name='toc52' href='#sect52'>Configuration Files</a></li>
+<li><a name='toc53' href='#sect53'>Config.yml</a></li>
+<li><a name='toc54' href='#sect54'>Sisu_document_make</a></li>
+<li><a name='toc55' href='#sect55'>Css - Cascading Style Sheets (for Html, Xhtml and Xml)</a></li>
+<li><a name='toc56' href='#sect56'>Organising Content - Directory Structure and Mapping</a></li>
+<li><a name='toc57' href='#sect57'>Document Source Directory</a></li>
+<li><a name='toc58' href='#sect58'>General Directories</a></li>
+<li><a name='toc59' href='#sect59'>Document Output Directory Structures</a></li>
+<li><a name='toc60' href='#sect60'>Output Directory Root</a></li>
+<li><a name='toc61' href='#sect61'>Alternative Output Structures</a></li>
+<li><a name='toc62' href='#sect62'>by Language</a></li>
+<li><a name='toc63' href='#sect63'>by Filetype</a></li>
+<li><a name='toc64' href='#sect64'>by Filename</a></li>
+<li><a name='toc65' href='#sect65'>Remote Directories</a></li>
+<li><a name='toc66' href='#sect66'>Sisupod</a></li>
+<li><a name='toc67' href='#sect67'>Organising Content</a></li>
+<li><a name='toc68' href='#sect68'>Homepages</a></li>
+<li><a name='toc69' href='#sect69'>Home Page and Other Custom Built Pages in a Sub-directory</a></li>
+<li><a name='toc70' href='#sect70'>Markup and Output Examples</a></li>
+<li><a name='toc71' href='#sect71'>Markup Examples</a></li>
+<li><a name='toc72' href='#sect72'>Sisu Markup Samples</a></li>
+<li><a name='toc73' href='#sect73'>Sisu Search - Introduction</a></li>
+<li><a name='toc74' href='#sect74'>Sql</a></li>
+<li><a name='toc75' href='#sect75'>Populating Sql Type Databases</a></li>
+<li><a name='toc76' href='#sect76'>Postgresql</a></li>
+<li><a name='toc77' href='#sect77'>Name</a></li>
+<li><a name='toc78' href='#sect78'>Description</a></li>
+<li><a name='toc79' href='#sect79'>Synopsis</a></li>
+<li><a name='toc80' href='#sect80'>Commands</a></li>
+<li><a name='toc81' href='#sect81'>Create and Destroy Database</a></li>
+<li><a name='toc82' href='#sect82'>Import and Remove Documents</a></li>
+<li><a name='toc83' href='#sect83'>Sqlite</a></li>
+<li><a name='toc84' href='#sect84'>Name</a></li>
+<li><a name='toc85' href='#sect85'>Description</a></li>
+<li><a name='toc86' href='#sect86'>Synopsis</a></li>
+<li><a name='toc87' href='#sect87'>Commands</a></li>
+<li><a name='toc88' href='#sect88'>Create and Destroy Database</a></li>
+<li><a name='toc89' href='#sect89'>Import and Remove Documents</a></li>
+<li><a name='toc90' href='#sect90'>Introduction</a></li>
+<li><a name='toc91' href='#sect91'>Search - Database Frontend Sample, Utilising Database and Sisu Features,</a></li>
+<li><a name='toc92' href='#sect92'>Search Form</a></li>
+<li><a name='toc93' href='#sect93'>Sisu_webrick</a></li>
+<li><a name='toc94' href='#sect94'>Name</a></li>
+<li><a name='toc95' href='#sect95'>Synopsis</a></li>
+<li><a name='toc96' href='#sect96'>Description</a></li>
+<li><a name='toc97' href='#sect97'>Summary of Man Page</a></li>
+<li><a name='toc98' href='#sect98'>Document Processing Command Flags</a></li>
+<li><a name='toc99' href='#sect99'>Summary of Features</a></li>
+<li><a name='toc100' href='#sect100'>See Also</a></li>
+<li><a name='toc101' href='#sect101'>Homepage</a></li>
+<li><a name='toc102' href='#sect102'>Source</a></li>
+<li><a name='toc103' href='#sect103'>Author</a></li>
+</ul>
+</body>
+</html>
diff --git a/data/doc/sisu/markup-samples/README b/data/doc/sisu/markup-samples/README
index ac71cc50..5e7b6944 100644
--- a/data/doc/sisu/markup-samples/README
+++ b/data/doc/sisu/markup-samples/README
@@ -1,5 +1,6 @@
The package sisu contains a few documents published under the GPL or that are
-Debian Free Software Guideline license compatible, noteably:
+Debian Free Software Guideline license compatible, in the v4 and legacy v3
+directories below, notably:
Text: Free as in Freedom - Richard Stallman's Crusade for Free Software
URL: <http://faifzilla.org/>
@@ -152,6 +153,11 @@ remain unchanged, and sometimes that the works be used only non-commercially.
License: Attribution-Noncommercial-Share Alike (CC-BY-NC-SA) 3.0
URL: <http://creativecommons.org/licenses/by-nc-sa/3.0/>
Markup: little_brother.cory_doctorow.sst
+ Cover: cover_image_wordle_little_brother.png
+ URL: <http://craphound.com/littlebrother/2009/09/09/cool-free-cover-image-for-little-brother-from-wordle/>
+ Copyright: Wordle, Cory Doctorow, 2011
+ License: Attribution United States (CC BY) 3.0
+ URL: <http://creativecommons.org/licenses/by/3.0/us/>
Illustration: little_brother_doctorow.png
URL: <http://commons.wikimedia.org/wiki/File:Little_Brother_illustration_by_Richard_Wilkinson_04.jpg>
Copyright: Richard Wilkinson
diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_hyperestraier.ssi b/data/doc/sisu/markup-samples/sisu_manual/sisu_hyperestraier.ssi
deleted file mode 100644
index 8cef8faa..00000000
--- a/data/doc/sisu/markup-samples/sisu_manual/sisu_hyperestraier.ssi
+++ /dev/null
@@ -1,95 +0,0 @@
-% SiSU insert 2.0
-
-@title: SiSU
- :subtitle: Hyperestraier Search
-
-@creator:
- :author: Amissah, Ralph
-
-@rights:
- :copyright: Copyright (C) Ralph Amissah 2007, part of SiSU documentation, License GPL 3
-
-% used_by: sisu_manual
-
-@date:
- :created: 2002-08-28
- :issued: 2002-08-28
- :available: 2002-08-28
- :published: 2007-09-16
- :modified: 2011-02-07
-
-:A~? @title @creator
-
-:B~? SiSU Search - Hyperestraier
-
-:C~? Search
-
-1~search_hyperestraier Hyperestraier
-
-See the documentation for hyperestraier:
-
-_1 http://hyperestraier.sourceforge.net/
-
-_1 /usr/share/doc/hyperestraier/index.html
-
-_1 man estcmd
-
-on sisu_hyperestraier:
-
-_1 man sisu_hyperestraier
-
-_1 /usr/share/doc/sisu/sisu-markup/sisu_hyperestraier/index.html
-
-NOTE: the examples that follow assume that sisu output is placed in the directory /home/ralph/sisu_www
-
-(A) to generate the index within the webserver directory to be indexed:
-
-_1 estcmd gather -sd [index name] [directory path to index]
-
-the following are examples that will need to be tailored according to your needs:
-
-_1 cd /home/ralph/sisu_www
-
-_1 estcmd gather -sd casket /home/ralph/sisu_www
-
-you may use the 'find' command together with 'egrep' to limit indexing to particular document collection directories within the web server directory:
-
-_1 find /home/ralph/sisu_www -type f | egrep '/home/ralph/sisu_www/sisu/.+?.html$' |estcmd gather -sd casket -
-
-Check which directories in the webserver/output directory (~/sisu_www or elsewhere depending on configuration) you wish to include in the search index.
-
-As sisu duplicates output in multiple file formats, it it is probably preferable to limit the estraier index to html output, and as it may also be desirable to exclude files 'plain.txt', 'toc.html' and 'concordance.html', as these duplicate information held in other html output e.g.
-
-_1 find /home/ralph/sisu_www -type f | egrep '/sisu_www/(sisu|bookmarks)/.+?.html$' | egrep -v '(doc|concordance).html$' |estcmd gather -sd casket -
-
-from your current document preparation/markup directory, you would construct a rune along the following lines:
-
-_1 find /home/ralph/sisu_www -type f | egrep '/home/ralph/sisu_www/([specify first directory for inclusion]|[specify second directory for inclusion]|[another directory for inclusion? ...])/.+?.html$' | egrep -v '(doc|concordance).html$' |estcmd gather -sd /home/ralph/sisu_www/casket -
-
-(B) to set up the search form
-
-(i) copy estseek.cgi to your cgi directory and set file permissions to 755:
-
-_1 sudo cp -vi /usr/lib/estraier/estseek.cgi /usr/lib/cgi-bin
-
-_1 sudo chmod -v 755 /usr/lib/cgi-bin/estseek.cgi
-
-_1 sudo cp -v /usr/share/hyperestraier/estseek.* /usr/lib/cgi-bin
-
-_1 [see estraier documentation for paths]
-
-(ii) edit estseek.conf, with attention to the lines starting 'indexname:' and 'replace:':
-
-_1 indexname: /home/ralph/sisu_www/casket
-
-_1 replace: ^file:///home/ralph/sisu_www{{!}}http://localhost
-
-_1 replace: /index.html?${{!}}/
-
-(C) to test using webrick, start webrick:
-
-_1 sisu -W
-
-and try open the url: http://localhost:8081/cgi-bin/estseek.cgi
-
-
diff --git a/data/doc/sisu/markup-samples/samples/_sisu/image/Gnu_Debian_Linux_Ruby_Way_Better.png b/data/doc/sisu/markup-samples/v3/samples/_sisu/image/Gnu_Debian_Linux_Ruby_Way_Better.png
index 0f3f4a16..0f3f4a16 100644
--- a/data/doc/sisu/markup-samples/samples/_sisu/image/Gnu_Debian_Linux_Ruby_Way_Better.png
+++ b/data/doc/sisu/markup-samples/v3/samples/_sisu/image/Gnu_Debian_Linux_Ruby_Way_Better.png
Binary files differ
diff --git a/data/doc/sisu/markup-samples/samples/_sisu/image/b_doc.png b/data/doc/sisu/markup-samples/v3/samples/_sisu/image/b_doc.png
index 13ca8ebe..13ca8ebe 100644
--- a/data/doc/sisu/markup-samples/samples/_sisu/image/b_doc.png
+++ b/data/doc/sisu/markup-samples/v3/samples/_sisu/image/b_doc.png
Binary files differ
diff --git a/data/doc/sisu/markup-samples/samples/_sisu/image/c_Copyleft.png b/data/doc/sisu/markup-samples/v3/samples/_sisu/image/c_Copyleft.png
index 5b3865b8..5b3865b8 100644
--- a/data/doc/sisu/markup-samples/samples/_sisu/image/c_Copyleft.png
+++ b/data/doc/sisu/markup-samples/v3/samples/_sisu/image/c_Copyleft.png
Binary files differ
diff --git a/data/doc/sisu/markup-samples/samples/_sisu/image/c_Euro.png b/data/doc/sisu/markup-samples/v3/samples/_sisu/image/c_Euro.png
index 8e5c13a9..8e5c13a9 100644
--- a/data/doc/sisu/markup-samples/samples/_sisu/image/c_Euro.png
+++ b/data/doc/sisu/markup-samples/v3/samples/_sisu/image/c_Euro.png
Binary files differ
diff --git a/data/doc/sisu/markup-samples/samples/_sisu/image/debian_home.png b/data/doc/sisu/markup-samples/v3/samples/_sisu/image/debian_home.png
index cee42aa0..cee42aa0 100644
--- a/data/doc/sisu/markup-samples/samples/_sisu/image/debian_home.png
+++ b/data/doc/sisu/markup-samples/v3/samples/_sisu/image/debian_home.png
Binary files differ
diff --git a/data/doc/sisu/markup-samples/samples/_sisu/image/free_as_in_freedom.png b/data/doc/sisu/markup-samples/v3/samples/_sisu/image/free_as_in_freedom.png
index ad4c05b2..ad4c05b2 100644
--- a/data/doc/sisu/markup-samples/samples/_sisu/image/free_as_in_freedom.png
+++ b/data/doc/sisu/markup-samples/v3/samples/_sisu/image/free_as_in_freedom.png
Binary files differ
diff --git a/data/doc/sisu/markup-samples/samples/_sisu/image/free_as_in_freedom_01_rms.png b/data/doc/sisu/markup-samples/v3/samples/_sisu/image/free_as_in_freedom_01_rms.png
index 3b4563b0..3b4563b0 100644
--- a/data/doc/sisu/markup-samples/samples/_sisu/image/free_as_in_freedom_01_rms.png
+++ b/data/doc/sisu/markup-samples/v3/samples/_sisu/image/free_as_in_freedom_01_rms.png
Binary files differ
diff --git a/data/doc/sisu/markup-samples/samples/_sisu/image/free_as_in_freedom_02_rms_snr_year_report.png b/data/doc/sisu/markup-samples/v3/samples/_sisu/image/free_as_in_freedom_02_rms_snr_year_report.png
index 5d5a57aa..5d5a57aa 100644
--- a/data/doc/sisu/markup-samples/samples/_sisu/image/free_as_in_freedom_02_rms_snr_year_report.png
+++ b/data/doc/sisu/markup-samples/v3/samples/_sisu/image/free_as_in_freedom_02_rms_snr_year_report.png
Binary files differ
diff --git a/data/doc/sisu/markup-samples/samples/_sisu/image/free_as_in_freedom_03_rms_st_ignucius.png b/data/doc/sisu/markup-samples/v3/samples/_sisu/image/free_as_in_freedom_03_rms_st_ignucius.png
index d84bf568..d84bf568 100644
--- a/data/doc/sisu/markup-samples/samples/_sisu/image/free_as_in_freedom_03_rms_st_ignucius.png
+++ b/data/doc/sisu/markup-samples/v3/samples/_sisu/image/free_as_in_freedom_03_rms_st_ignucius.png
Binary files differ
diff --git a/data/doc/sisu/markup-samples/samples/_sisu/image/free_as_in_freedom_04_rms_pleasure_card.png b/data/doc/sisu/markup-samples/v3/samples/_sisu/image/free_as_in_freedom_04_rms_pleasure_card.png
index 2ab79e1c..2ab79e1c 100644
--- a/data/doc/sisu/markup-samples/samples/_sisu/image/free_as_in_freedom_04_rms_pleasure_card.png
+++ b/data/doc/sisu/markup-samples/v3/samples/_sisu/image/free_as_in_freedom_04_rms_pleasure_card.png
Binary files differ
diff --git a/data/doc/sisu/markup-samples/samples/_sisu/image/free_as_in_freedom_2_01_pdp_1_processor_with_kl_10.png b/data/doc/sisu/markup-samples/v3/samples/_sisu/image/free_as_in_freedom_2_01_pdp_1_processor_with_kl_10.png
index 679c22a5..679c22a5 100644
--- a/data/doc/sisu/markup-samples/samples/_sisu/image/free_as_in_freedom_2_01_pdp_1_processor_with_kl_10.png
+++ b/data/doc/sisu/markup-samples/v3/samples/_sisu/image/free_as_in_freedom_2_01_pdp_1_processor_with_kl_10.png
Binary files differ
diff --git a/data/doc/sisu/markup-samples/samples/_sisu/image/free_as_in_freedom_2_02_rms_st_ignucius.png b/data/doc/sisu/markup-samples/v3/samples/_sisu/image/free_as_in_freedom_2_02_rms_st_ignucius.png
index 9ed7b355..9ed7b355 100644
--- a/data/doc/sisu/markup-samples/samples/_sisu/image/free_as_in_freedom_2_02_rms_st_ignucius.png
+++ b/data/doc/sisu/markup-samples/v3/samples/_sisu/image/free_as_in_freedom_2_02_rms_st_ignucius.png
Binary files differ
diff --git a/data/doc/sisu/markup-samples/samples/_sisu/image/levitating_gnu.png b/data/doc/sisu/markup-samples/v3/samples/_sisu/image/levitating_gnu.png
index 9a25319a..9a25319a 100644
--- a/data/doc/sisu/markup-samples/samples/_sisu/image/levitating_gnu.png
+++ b/data/doc/sisu/markup-samples/v3/samples/_sisu/image/levitating_gnu.png
Binary files differ
diff --git a/data/doc/sisu/markup-samples/samples/_sisu/image/philosophical_gnu.png b/data/doc/sisu/markup-samples/v3/samples/_sisu/image/philosophical_gnu.png
index ebd239ef..ebd239ef 100644
--- a/data/doc/sisu/markup-samples/samples/_sisu/image/philosophical_gnu.png
+++ b/data/doc/sisu/markup-samples/v3/samples/_sisu/image/philosophical_gnu.png
Binary files differ
diff --git a/data/doc/sisu/markup-samples/samples/_sisu/image/sisu.png b/data/doc/sisu/markup-samples/v3/samples/_sisu/image/sisu.png
index b449fa6b..b449fa6b 100644
--- a/data/doc/sisu/markup-samples/samples/_sisu/image/sisu.png
+++ b/data/doc/sisu/markup-samples/v3/samples/_sisu/image/sisu.png
Binary files differ
diff --git a/data/doc/sisu/markup-samples/samples/_sisu/skin/dir/skin_sisu.rb b/data/doc/sisu/markup-samples/v3/samples/_sisu/skin/dir/skin_sisu.rb
index bd2e2a53..bd2e2a53 100644
--- a/data/doc/sisu/markup-samples/samples/_sisu/skin/dir/skin_sisu.rb
+++ b/data/doc/sisu/markup-samples/v3/samples/_sisu/skin/dir/skin_sisu.rb
diff --git a/data/doc/sisu/markup-samples/samples/_sisu/skin/doc/skin_gnu.rb b/data/doc/sisu/markup-samples/v3/samples/_sisu/skin/doc/skin_gnu.rb
index 8ac38227..8ac38227 100644
--- a/data/doc/sisu/markup-samples/samples/_sisu/skin/doc/skin_gnu.rb
+++ b/data/doc/sisu/markup-samples/v3/samples/_sisu/skin/doc/skin_gnu.rb
diff --git a/data/doc/sisu/markup-samples/samples/_sisu/skin/doc/skin_rms.rb b/data/doc/sisu/markup-samples/v3/samples/_sisu/skin/doc/skin_rms.rb
index 0f3e7d34..0f3e7d34 100644
--- a/data/doc/sisu/markup-samples/samples/_sisu/skin/doc/skin_rms.rb
+++ b/data/doc/sisu/markup-samples/v3/samples/_sisu/skin/doc/skin_rms.rb
diff --git a/data/doc/sisu/markup-samples/samples/_sisu/skin/doc/skin_rms2.rb b/data/doc/sisu/markup-samples/v3/samples/_sisu/skin/doc/skin_rms2.rb
index c97c5b87..c97c5b87 100644
--- a/data/doc/sisu/markup-samples/samples/_sisu/skin/doc/skin_rms2.rb
+++ b/data/doc/sisu/markup-samples/v3/samples/_sisu/skin/doc/skin_rms2.rb
diff --git a/data/doc/sisu/markup-samples/samples/_sisu/skin/site/skin_sisu.rb b/data/doc/sisu/markup-samples/v3/samples/_sisu/skin/site/skin_sisu.rb
index bd2e2a53..bd2e2a53 100644
--- a/data/doc/sisu/markup-samples/samples/_sisu/skin/site/skin_sisu.rb
+++ b/data/doc/sisu/markup-samples/v3/samples/_sisu/skin/site/skin_sisu.rb
diff --git a/data/doc/sisu/markup-samples/samples/_sisu/skin/yml/list.yml b/data/doc/sisu/markup-samples/v3/samples/_sisu/skin/yml/list.yml
index 388ef360..388ef360 100644
--- a/data/doc/sisu/markup-samples/samples/_sisu/skin/yml/list.yml
+++ b/data/doc/sisu/markup-samples/v3/samples/_sisu/skin/yml/list.yml
diff --git a/data/doc/sisu/markup-samples/samples/_sisu/skin/yml/promo.yml b/data/doc/sisu/markup-samples/v3/samples/_sisu/skin/yml/promo.yml
index 8fc37137..8fc37137 100644
--- a/data/doc/sisu/markup-samples/samples/_sisu/skin/yml/promo.yml
+++ b/data/doc/sisu/markup-samples/v3/samples/_sisu/skin/yml/promo.yml
diff --git a/data/doc/sisu/markup-samples/samples/_sisu/skin/yml/skin_countries.yml b/data/doc/sisu/markup-samples/v3/samples/_sisu/skin/yml/skin_countries.yml
index 274e19fa..274e19fa 100644
--- a/data/doc/sisu/markup-samples/samples/_sisu/skin/yml/skin_countries.yml
+++ b/data/doc/sisu/markup-samples/v3/samples/_sisu/skin/yml/skin_countries.yml
diff --git a/data/doc/sisu/markup-samples/samples/_sisu/skin/yml/skin_country.yml b/data/doc/sisu/markup-samples/v3/samples/_sisu/skin/yml/skin_country.yml
index dc835465..dc835465 100644
--- a/data/doc/sisu/markup-samples/samples/_sisu/skin/yml/skin_country.yml
+++ b/data/doc/sisu/markup-samples/v3/samples/_sisu/skin/yml/skin_country.yml
diff --git a/data/doc/sisu/markup-samples/v3/samples/free_as_in_freedom.richard_stallman_crusade_for_free_software.sam_williams.sst b/data/doc/sisu/markup-samples/v3/samples/free_as_in_freedom.richard_stallman_crusade_for_free_software.sam_williams.sst
new file mode 100644
index 00000000..16de9266
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v3/samples/free_as_in_freedom.richard_stallman_crusade_for_free_software.sam_williams.sst
@@ -0,0 +1,2474 @@
+% SiSU 2.0
+
+@title: Free as in Freedom
+ :subtitle: Richard Stallman's Crusade for Free Software
+
+@creator:
+ :author: Williams, Sam
+
+@date:
+ :published: 2002
+
+@rights:
+ :copyright: Copyright (C) Sam Williams 2002.
+ :license: Published under the GNU Free Documentation License. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Document License, Version 1.1 or any later version published by the Free Software Foundation; with the Invariant Sections being no invariant sections, with the Front-Cover Texts being no invariant sections, and with the Back-Cover Texts being no invariant sections. A copy of the license is included in Appendix C, GNU Free Documentation License. All images are to be included verbatim when the document is copied, distributed, or modified under the terms of the GFDL.
+
+@classify:
+ :topic_register: SiSU markup sample:book:biography;book:biography;copyright;GNU/Linux:GPL|copyleft|free software;free software;Software:Software Libré;GPL;Linux:GNU|Software Libré;programming
+ :oclc: 49044520
+ :isbn: 9780596002879
+
+@links:
+ { Home and Source }http://faifzilla.org/
+ { @ Wikipedia }http://en.wikipedia.org/wiki/Free_as_in_Freedom:_Richard_Stallman%27s_Crusade_for_Free_Software
+ { @ Amazon.com }http://www.amazon.com/gp/product/0596002874
+ { @ Barnes & Noble }http://search.barnesandnoble.com/booksearch/isbnInquiry.asp?isbn=0596002874
+ { SiSU }http://sisudoc.org/
+ { sources / git }http://sources.sisudoc.org/
+
+@make:
+ :breaks: new=:A,:B,:C,1
+ :skin: skin_rms
+
+:A~ @title @author
+
+1~preface Preface
+
+The work of Richard M. Stallman literally speaks for itself. From the documented source code to the published papers to the recorded speeches, few people have expressed as much willingness to lay their thoughts and their work on the line.
+
+Such openness-if one can pardon a momentary un-Stallman adjective-is refreshing. After all, we live in a society that treats information, especially personal information, as a valuable commodity. The question quickly arises. Why would anybody want to part with so much information and yet appear to demand nothing in return?
+
+As we shall see in later chapters, Stallman does not part with his words or his work altruistically. Every program, speech, and on-the-record bon mot comes with a price, albeit not the kind of price most people are used to paying.
+
+I bring this up not as a warning, but as an admission. As a person who has spent the last year digging up facts on Stallman's personal history, it's more than a little intimidating going up against the Stallman oeuvre. "Never pick a fight with a man who buys his ink by the barrel," goes the old Mark Twain adage. In the case of Stallman, never attempt the definitive biography of a man who trusts his every thought to the public record.
+
+For the readers who have decided to trust a few hours of their time to exploring this book, I can confidently state that there are facts and quotes in here that one won't find in any Slashdot story or Google search. Gaining access to these facts involves paying a price, however. In the case of the book version, you can pay for these facts the traditional manner, i.e., by purchasing the book. In the case of the electronic versions, you can pay for these facts in the free software manner. Thanks to the folks at O'Reilly & Associates, this book is being distributed under the GNU Free Documentation License, meaning you can help to improve the work or create a personalized version and release that version under the same license.
+
+If you are reading an electronic version and prefer to accept the latter payment option, that is, if you want to improve or expand this book for future readers, I welcome your input. Starting in June, 2002, I will be publishing a bare bones HTML version of the book on the web site, http://www.faifzilla.org. My aim is to update it regularly and expand the Free as in Freedom story as events warrant. If you choose to take the latter course, please review Appendix C of this book. It provides a copy of your rights under the GNU Free Documentation License.
+
+For those who just plan to sit back and read, online or elsewhere, I consider your attention an equally valuable form of payment. Don't be surprised, though, if you, too, find yourself looking for other ways to reward the good will that made this work possible.
+
+One final note: this is a work of journalism, but it is also a work of technical documentation. In the process of writing and editing this book, the editors and I have weighed the comments and factual input of various participants in the story, including Richard Stallman himself. We realize there are many technical details in this story that may benefit from additional or refined information. As this book is released under the GFDL, we are accepting patches just like we would with any free software program. Accepted changes will be posted electronically and will eventually be incorporated into future printed versions of this work. If you would like to contribute to the further improvement of this book, you can reach me at sam@inow.com
+={patches, inserting into source code}
+
+% patches index ref added
+
+2~ Comments and Questions
+
+Please address comments and questions concerning this book to the publisher:
+
+group{
+
+ O'Reilly & Associates, Inc.
+ 1005 Gravenstein Highway North
+ Sebastopol, CA 95472
+ (800) 998-9938 (in the United States or Canada)
+ (707) 829-0515 (international/local)
+ (707) 829-0104 (fax)
+
+}group
+
+There is a web page for this book, which lists errata, examples, or any additional information. The site also includes a link to a forum where you can discuss the book with the author and other readers. You can access this site at:
+
+_1 http://www.oreilly.com/catalog/freedom/
+
+To comment or ask technical questions about this book, send email to:
+
+_1 bookquestions@oreilly.com
+
+For more information about books, conferences, Resource Centers, and the O'Reilly Network, see the O'Reilly web site at:
+
+_1 http://www.oreilly.com
+
+2~ Acknowledgments
+
+Special thanks to Henning Gutmann for sticking by this book. Special thanks to Aaron Oas for suggesting the idea to Tracy in the first place. Thanks to Laurie Petrycki, Jeffrey Holcomb, and all the others at O'Reilly & Associates. Thanks to Tim O'Reilly for backing this book. Thanks to all the first-draft reviewers: Bruce Perens, Eric Raymond, Eric Allman, Jon Orwant, Julie and Gerald Jay Sussman, Hal Abelson, and Guy Steele. I hope you enjoy this typo-free version. Thanks to Alice Lippman for the interviews, cookies, and photographs. Thanks to my family, Steve, Jane, Tish, and Dave. And finally, last but not least: thanks to Richard Stallman for having the guts and endurance to "show us the code."
+
+Sam Williams
+
+1~ Chapter 1 - For Want of a Printer
+={Stallman, Richard M.:AI Lab, as a programmer+47}
+
+group{
+
+I fear the Greeks. Even when they bring gifts.
+ ---Virgil
+ The Aeneid
+
+}group
+
+The new printer was jammed, again.
+
+Richard M. Stallman, a staff software programmer at the Massachusetts Institute of Technology's Artificial Intelligence Laboratory (AI Lab), discovered the malfunction the hard way. An hour after sending off a 50-page file to the office laser printer, Stallman, 27, broke off a productive work session to retrieve his documents. Upon arrival, he found only four pages in the printer's tray. To make matters even more frustrating, the four pages belonged to another user, meaning that Stallman's print job and the unfinished portion of somebody else's print job were still trapped somewhere within the electrical plumbing of the lab's computer network.
+={AI Lab (Artificial Intelligence Laboratory);MIT Massachusetts Institute of Technology}
+
+Waiting for machines is an occupational hazard when you're a software programmer, so Stallman took his frustration with a grain of salt. Still, the difference between waiting for a machine and waiting on a machine is a sizable one. It wasn't the first time he'd been forced to stand over the printer, watching pages print out one by one. As a person who spent the bulk of his days and nights improving the efficiency of machines and the software programs that controlled them, Stallman felt a natural urge to open up the machine, look at the guts, and seek out the root of the problem.
+
+Unfortunately, Stallman's skills as a computer programmer did not extend to the mechanical-engineering realm. As freshly printed documents poured out of the machine, Stallman had a chance to reflect on other ways to circumvent the printing jam problem.
+
+How long ago had it been that the staff members at the AI Lab had welcomed the new printer with open arms? Stallman wondered. The machine had been a donation from the Xerox Corporation. A cutting edge prototype, it was a modified version of the popular Xerox photocopier. Only instead of making copies, it relied on software data piped in over a computer network to turn that data into professional-looking documents. Created by engineers at the world-famous Xerox Palo Alto Research Facility, it was, quite simply, an early taste of the desktop-printing revolution that would seize the rest of the computing industry by the end of the decade.
+={Xerox Corporation+10:Palo Alto Research Center}
+
+Driven by an instinctual urge to play with the best new equipment, programmers at the AI Lab promptly integrated the new machine into the lab's sophisticated computing infrastructure. The results had been immediately pleasing. Unlike the lab's old laser printer, the new Xerox machine was fast. Pages came flying out at a rate of one per second, turning a 20-minute print job into a 2-minute print job. The new machine was also more precise. Circles came out looking like circles, not ovals. Straight lines came out looking like straight lines, not low-amplitude sine waves.
+
+It was, for all intents and purposes, a gift too good to refuse.
+
+It wasn't until a few weeks after its arrival that the machine's flaws began to surface. Chief among the drawbacks was the machine's inherent susceptibility to paper jams. Engineering-minded programmers quickly understood the reason behind the flaw. As a photocopier, the machine generally required the direct oversight of a human operator. Figuring that these human operators would always be on hand to fix a paper jam, if it occurred, Xerox engineers had devoted their time and energies to eliminating other pesky problems. In engineering terms, user diligence was built into the system.
+
+In modifying the machine for printer use, Xerox engineers had changed the user-machine relationship in a subtle but profound way. Instead of making the machine subservient to an individual human operator, they made it subservient to an entire networked population of human operators. Instead of standing directly over the machine, a human user on one end of the network sent his print command through an extended bucket-brigade of machines, expecting the desired content to arrive at the targeted destination and in proper form. It wasn't until he finally went to check up on the final output that he realized how little of the desired content had made it through.
+
+Stallman himself had been of the first to identify the problem and the first to suggest a remedy. Years before, when the lab was still using its old printer, Stallman had solved a similar problem by opening up the software program that regulated the printer on the lab's PDP-11 machine. Stallman couldn't eliminate paper jams, but he could insert a software command that ordered the PDP-11 to check the printer periodically and report back to the PDP-10, the lab's central computer. To ensure that one user's negligence didn't bog down an entire line of print jobs, Stallman also inserted a software command that instructed the PDP-10 to notify every user with a waiting print job that the printer was jammed. The notice was simple, something along the lines of "The printer is jammed, please fix it," and because it went out to the people with the most pressing need to fix the problem, chances were higher that the problem got fixed in due time.
+={PDP-10 computer;PDP-11 computer}
+
+% extra ref to pdp-10 & pdp-11 computer
+
+As fixes go, Stallman's was oblique but elegant. It didn't fix the mechanical side of the problem, but it did the next best thing by closing the information loop between user and machine. Thanks to a few additional lines of software code, AI Lab employees could eliminate the 10 or 15 minutes wasted each week in running back and forth to check on the printer. In programming terms, Stallman's fix took advantage of the amplified intelligence of the overall network.
+
+"If you got that message, you couldn't assume somebody else would fix it," says Stallman, recalling the logic. "You had to go to the printer. A minute or two after the printer got in trouble, the two or three people who got messages arrive to fix the machine. Of those two or three people, one of them, at least, would usually know how to fix the problem."
+
+Such clever fixes were a trademark of the AI Lab and its indigenous population of programmers. Indeed, the best programmers at the AI Lab disdained the term programmer, preferring the more slangy occupational title of hacker instead. The job title covered a host of activities-everything from creative mirth making to the improvement of existing software and computer systems. Implicit within the title, however, was the old-fashioned notion of Yankee ingenuity. To be a hacker, one had to accept the philosophy that writing a software program was only the beginning. Improving a program was the true test of a hacker's skills.~{ For more on the term "hacker," see **Appendix B. }~
+
+Such a philosophy was a major reason why companies like Xerox made it a policy to donate their machines and software programs to places where hackers typically congregated. If hackers improved the software, companies could borrow back the improvements, incorporating them into update versions for the commercial marketplace. In corporate terms, hackers were a leveragable community asset, an auxiliary research-and-development division available at minimal cost.
+={hackers:philosophy of donating software+7;software:companies donating;source code:Xerox Corporation publishing+32}
+
+It was because of this give-and-take philosophy that when Stallman spotted the print-jam defect in the Xerox laser printer, he didn't panic. He simply looked for a way to update the old fix or " hack" for the new system. In the course of looking up the Xerox laser-printer software, however, Stallman made a troubling discovery. The printer didn't have any software, at least nothing Stallman or a fellow programmer could read. Until then, most companies had made it a form of courtesy to publish source-code files-readable text files that documented the individual software commands that told a machine what to do. Xerox, in this instance, had provided software files in precompiled, or binary, form. Programmers were free to open the files up if they wanted to, but unless they were an expert in deciphering an endless stream of ones and zeroes, the resulting text was pure gibberish.
+={Xerox Corporation:source code, publishing+31;text file source code, publishing}
+
+Although Stallman knew plenty about computers, he was not an expert in translating binary files. As a hacker, however, he had other resources at his disposal. The notion of information sharing was so central to the hacker culture that Stallman knew it was only a matter of time before some hacker in some university lab or corporate computer room proffered a version of the laser-printer source code with the desired source-code files.
+={binary files}
+
+After the first few printer jams, Stallman comforted himself with the memory of a similar situation years before. The lab had needed a cross-network program to help the PDP-11 work more efficiently with the PDP-10. The lab's hackers were more than up to the task, but Stallman, a Harvard alumnus, recalled a similar program written by programmers at the Harvard computer-science department. The Harvard computer lab used the same model computer, the PDP-10, albeit with a different operating system. The Harvard computer lab also had a policy requiring that all programs installed on the PDP-10 had to come with published source-code files.
+={Harvard University:computer labs+2}
+
+Taking advantage of his access to the Harvard computer lab, Stallman dropped in, made a copy of the cross-network source code, and brought it back to the AI Lab. He then rewrote the source code to make it more suitable for the AI Lab's operating system. With no muss and little fuss, the AI Lab shored up a major gap in its software infrastructure. Stallman even added a few features not found in the original Harvard program, making the program even more useful. "We wound up using it for several years," Stallman says.
+
+From the perspective of a 1970s-era programmer, the transaction was the software equivalent of a neighbor stopping by to borrow a power tool or a cup of sugar from a neighbor. The only difference was that in borrowing a copy of the software for the AI Lab, Stallman had done nothing to deprive Harvard hackers the use of their original program. If anything, Harvard hackers gained in the process, because Stallman had introduced his own additional features to the program, features that hackers at Harvard were perfectly free to borrow in return. Although nobody at Harvard ever came over to borrow the program back, Stallman does recall a programmer at the private engineering firm, Bolt, Beranek & Newman, borrowing the program and adding a few additional features, which Stallman eventually reintegrated into the AI Lab's own source-code archive.
+={AI Lab (Artificial Intelligence Laboratory):borrowing source code for;Bolt, Beranek & Newman engineering firm}
+
+"A program would develop the way a city develops," says Stallman, recalling the software infrastructure of the AI Lab. "Parts would get replaced and rebuilt. New things would get added on. But you could always look at a certain part and say, `Hmm, by the style, I see this part was written back in the early 60s and this part was written in the mid-1970s.'"
+
+Through this simple system of intellectual accretion, hackers at the AI Lab and other places built up robust creations. On the west coast, computer scientists at UC Berkeley, working in cooperation with a few low-level engineers at AT&T, had built up an entire operating system using this system. Dubbed Unix, a play on an older, more academically respectable operating system called Multics, the software system was available to any programmer willing to pay for the cost of copying the program onto a new magnetic tape and shipping it. Not every programmer participating in this culture described himself as a hacker, but most shared the sentiments of Richard M. Stallman. If a program or software fix was good enough to solve your problems, it was good enough to solve somebody else's problems. Why not share it out of a simple desire for good karma?
+={AT&T;Multics operating system;UC Berkeley:building Unix;Unix operating system}
+
+The fact that Xerox had been unwilling to share its source-code files seemed a minor annoyance at first. In tracking down a copy of the source-code files, Stallman says he didn't even bother contacting Xerox. "They had already given us the laser printer," Stallman says. "Why should I bug them for more?"
+
+When the desired files failed to surface, however, Stallman began to grow suspicious. The year before, Stallman had experienced a blow up with a doctoral student at Carnegie Mellon University. The student, Brian Reid, was the author of a useful text-formatting program dubbed Scribe. One of the first programs that gave a user the power to define fonts and type styles when sending a document over a computer network, the program was an early harbinger of HTML, the lingua franca of the World Wide Web. In 1979, Reid made the decision to sell Scribe to a Pittsburgh-area software company called Unilogic. His graduate-student career ending, Reid says he simply was looking for a way to unload the program on a set of developers that would take pains to keep it from slipping into the public domain. To sweeten the deal, Reid also agreed to insert a set of time-dependent functions- "time bombs" in software-programmer parlance-that deactivated freely copied versions of the program after a 90-day expiration date. To avoid deactivation, users paid the software company, which then issued a code that defused the internal time-bomb feature.
+={Carnegie Mellon University+17;Unilogic software company+1;time bombs, in software;Scribe text-formatting program+1}
+
+% "time bombs" should be in quotes, but that messes up sorting 0.69.1
+
+For Reid, the deal was a win-win. Scribe didn't fall into the public domain, and Unilogic recouped on its investment. For Stallman, it was a betrayal of the programmer ethos, pure and simple. Instead of honoring the notion of share-and-share alike, Reid had inserted a way for companies to compel programmers to pay for information access.
+
+As the weeks passed and his attempts to track down Xerox laser-printer source code hit a brick wall, Stallman began to sense a similar money-for-code scenario at work. Before Stallman could do or say anything about it, however, good news finally trickled in via the programmer grapevine. Word had it that a scientist at the computer-science department at Carnegie Mellon University had just departed a job at the Xerox Palo Alto Research Center. Not only had the scientist worked on the laser printer in question, but according to rumor, he was still working on it as part of his research duties at Carnegie Mellon.
+={Xerox Corporation:Palo Alto Research Center}
+
+Casting aside his initial suspicion, Stallman made a firm resolution to seek out the person in question during his next visit to the Carnegie Mellon campus.
+
+He didn't have to wait long. Carnegie Mellon also had a lab specializing in artificial-intelligence research, and within a few months, Stallman had a business-related reason to visit the Carnegie Mellon campus. During that visit, he made sure to stop by the computer-science department. Department employees directed him to the office of the faculty member leading the Xerox project. When Stallman reached the office, he found the professor working there.
+
+In true engineer-to-engineer fashion, the conversation was cordial but blunt. After briefly introducing himself as a visitor from MIT, Stallman requested a copy of the laser-printer source code so that he could port it to the PDP-11. To his surprise, the professor refused to grant his request.
+
+"He told me that he had promised not to give me a copy," Stallman says.
+
+Memory is a funny thing. Twenty years after the fact, Stallman's mental history tape is notoriously blank in places. Not only does he not remember the motivating reason for the trip or even the time of year during which he took it, he also has no recollection of the professor or doctoral student on the other end of the conversation. According to Reid, the person most likely to have fielded Stallman's request is Robert Sproull, a former Xerox PARC researcher and current director of Sun Laboratories, a research division of the computer-technology conglomerate Sun Microsystems. During the 1970s, Sproull had been the primary developer of the laser-printer software in question while at Xerox PARC. Around 1980, Sproull took a faculty research position at Carnegie Mellon where he continued his laser-printer work amid other projects.
+={Sproull, Robert (Xerox PARC researcher);Sun Laboratories}
+
+% xerox parc spelt incorrectly in book's original index
+
+"The code that Stallman was asking for was leading-edge state-of-the-art code that Sproull had written in the year or so before going to Carnegie Mellon," recalls Reid. "I suspect that Sproull had been at Carnegie Mellon less than a month before this request came in."
+
+When asked directly about the request, however, Sproull draws a blank. "I can't make a factual comment," writes Sproull via email. "I have absolutely no recollection of the incident."
+
+With both participants in the brief conversation struggling to recall key details-including whether the conversation even took place-it's hard to gauge the bluntness of Sproull's refusal, at least as recalled by Stallman. In talking to audiences, Stallman has made repeated reference to the incident, noting that Sproull's unwillingness to hand over the source code stemmed from a nondisclosure agreement, a contractual agreement between Sproull and the Xerox Corporation giving Sproull, or any other signatory, access the software source code in exchange for a promise of secrecy. Now a standard item of business in the software industry, the nondisclosure agreement, or NDA, was a novel development at the time, a reflection of both the commercial value of the laser printer to Xerox and the information needed to run it. "Xerox was at the time trying to make a commercial product out of the laser printer," recalls Reid. "They would have been insane to give away the source code."
+={NDAs (nondisclosure agreements): for source code+13;nondisclosure agreements (NDAs):for source code+13}
+
+For Stallman, however, the NDA was something else entirely. It was a refusal on the part of Xerox and Sproull, or whomever the person was that turned down his source-code request that day, to participate in a system that, until then, had encouraged software programmers to regard programs as communal resources. Like a peasant whose centuries-old irrigation ditch had grown suddenly dry, Stallman had followed the ditch to its source only to find a brand-spanking-new hydroelectric dam bearing the Xerox logo.
+
+For Stallman, the realization that Xerox had compelled a fellow programmer to participate in this newfangled system of compelled secrecy took a while to sink in. At first, all he could focus on was the personal nature of the refusal. As a person who felt awkward and out of sync in most face-to-face encounters, Stallman's attempt to drop in on a fellow programmer unannounced had been intended as a demonstration of neighborliness. Now that the request had been refused, it felt like a major blunder. "I was so angry I couldn't think of a way to express it. So I just turned away and walked out without another word," Stallman recalls. "I might have slammed the door. Who knows? All I remember is wanting to get out of there."
+
+Twenty years after the fact, the anger still lingers, so much so that Stallman has elevated the event into a major turning point. Within the next few months, a series of events would befall both Stallman and the AI Lab hacker community that would make 30 seconds worth of tension in a remote Carnegie Mellon office seem trivial by comparison. Nevertheless, when it comes time to sort out the events that would transform Stallman from a lone hacker, instinctively suspicious of centralized authority, to a crusading activist applying traditional notions of liberty, equality, and fraternity to the world of software development, Stallman singles out the Carnegie Mellon encounter for special attention.
+
+"It encouraged me to think about something that I'd already been thinking about," says Stallman. "I already had an idea that software should be shared, but I wasn't sure how to think about that. My thoughts weren't clear and organized to the point where I could express them in a concise fashion to the rest of the world."
+
+Although previous events had raised Stallman's ire, he says it wasn't until his Carnegie Mellon encounter that he realized the events were beginning to intrude on a culture he had long considered sacrosanct. As an elite programmer at one of the world's elite institutions, Stallman had been perfectly willing to ignore the compromises and bargains of his fellow programmers just so long as they didn't interfere with his own work. Until the arrival of the Xerox laser printer, Stallman had been content to look down on the machines and programs other computer users grimly tolerated. On the rare occasion that such a program breached the AI Lab's walls-when the lab replaced its venerable Incompatible Time Sharing operating system with a commercial variant, the TOPS 20, for example-Stallman and his hacker colleagues had been free to rewrite, reshape, and rename the software according to personal taste.
+
+Now that the laser printer had insinuated itself within the AI Lab's network, however, something had changed. The machine worked fine, barring the occasional paper jam, but the ability to modify according to personal taste had disappeared. From the viewpoint of the entire software industry, the printer was a wake-up call. Software had become such a valuable asset that companies no longer felt the need to publicize source code, especially when publication meant giving potential competitors a chance to duplicate something cheaply. From Stallman's viewpoint, the printer was a Trojan Horse. After a decade of failure, privately owned software-future hackers would use the term " proprietary" software-had gained a foothold inside the AI Lab through the sneakiest of methods. It had come disguised as a gift.
+={proprietary software}
+
+That Xerox had offered some programmers access to additional gifts in exchange for secrecy was also galling, but Stallman takes pains to note that, if presented with such a quid pro quo bargain at a younger age, he just might have taken the Xerox Corporation up on its offer. The awkwardness of the Carnegie Mellon encounter, however, had a firming effect on Stallman's own moral lassitude. Not only did it give him the necessary anger to view all future entreaties with suspicion, it also forced him to ask the uncomfortable question: what if a fellow hacker dropped into Stallman's office someday and it suddenly became Stallman's job to refuse the hacker's request for source code?
+
+"It was my first encounter with a nondisclosure agreement, and it immediately taught me that nondisclosure agreements have victims," says Stallman, firmly. "In this case I was the victim. [My lab and I] were victims."
+
+It was a lesson Stallman would carry with him through the tumultuous years of the 1980s, a decade during which many of his MIT colleagues would depart the AI Lab and sign nondisclosure agreements of their own. Because most nondisclosure aggreements (NDAs) had expiration dates, few hackers who did sign them saw little need for personal introspection. Sooner or later, they reasoned, the software would become public knowledge. In the meantime, promising to keep the software secret during its earliest development stages was all a part of the compromise deal that allowed hackers to work on the best projects. For Stallman, however, it was the first step down a slippery slope.
+
+"When somebody invited me to betray all my colleagues in that way, I remembered how angry I was when somebody else had done that to me and my whole lab," Stallman says. "So I said, `Thank you very much for offering me this nice software package, but I can't accept it on the conditions that you're asking for, so I'm going to do without it.'"
+
+As Stallman would quickly learn, refusing such requests involved more than personal sacrifice. It involved segregating himself from fellow hackers who, though sharing a similar distaste for secrecy, tended to express that distaste in a more morally flexible fashion. It wasn't long before Stallman, increasingly an outcast even within the AI Lab, began billing himself as "the last true hacker," isolating himself further and further from a marketplace dominated by proprietary software. Refusing another's request for source code, Stallman decided, was not only a betrayal of the scientific mission that had nurtured software development since the end of World War II, it was a violation of the Golden Rule, the baseline moral dictate to do unto others as you would have them do unto you.
+
+Hence the importance of the laser printer and the encounter that resulted from it. Without it, Stallman says, his life might have followed a more ordinary path, one balancing the riches of a commercial programmer with the ultimate frustration of a life spent writing invisible software code. There would have been no sense of clarity, no urgency to address a problem others weren't addressing. Most importantly, there would have been no righteous anger, an emotion that, as we soon shall see, has propelled Stallman's career as surely as any political ideology or ethical belief.
+
+"From that day forward, I decided this was something I could never participate in," says Stallman, alluding to the practice of trading personal liberty for the sake of convenience-Stallman's description of the NDA bargain-as well as the overall culture that encouraged such ethically suspect deal-making in the first place. "I decided never to make other people victims just like I had been a victim."
+
+1~ Chapter 2 - 2001: A Hacker's Odyssey
+
+The New York University computer-science department sits inside Warren Weaver Hall, a fortress-like building located two blocks east of Washington Square Park. Industrial-strength air-conditioning vents create a surrounding moat of hot air, discouraging loiterers and solicitors alike. Visitors who breach the moat encounter another formidable barrier, a security check-in counter immediately inside the building's single entryway.
+={Warren Weaver Hall+2;New York University computer science department+44}
+
+Beyond the security checkpoint, the atmosphere relaxes somewhat. Still, numerous signs scattered throughout the first floor preach the dangers of unsecured doors and propped-open fire exits. Taken as a whole, the signs offer a reminder: even in the relatively tranquil confines of pre-September 11, 2001, New York, one can never be too careful or too suspicious.
+
+The signs offer an interesting thematic counterpoint to the growing number of visitors gathering in the hall's interior atrium. A few look like NYU students. Most look like shaggy-aired concert-goers milling outside a music hall in anticipation of the main act. For one brief morning, the masses have taken over Warren Weaver Hall, leaving the nearby security attendant with nothing better to do but watch Ricki Lake on TV and shrug her shoulders toward the nearby auditorium whenever visitors ask about "the speech."
+
+Once inside the auditorium, a visitor finds the person who has forced this temporary shutdown of building security procedures. The person is Richard M. Stallman, founder of the GNU Project, original president of the Free Software Foundation, winner of the 1990 MacArthur Fellowship, winner of the Association of Computing Machinery's Grace Murray Hopper Award (also in 1990), corecipient of the Takeda Foundation's 2001 Takeda Award, and former AI Lab hacker. As announced over a host of hacker-related web sites, including the GNU Project's own http://www.gnu.org site, Stallman is in Manhattan, his former hometown, to deliver a much anticipated speech in rebuttal to the Microsoft Corporation's recent campaign against the GNU General Public License.
+={Free Software Foundation (FSF)+1;FSF (Free Software Foundation);GNU General Public License+1;GNU Project:web site for;GPL+1;MacArthur Fellowship Program;Microsoft Corporation+8}
+
+% extended range for Microsoft
+
+The subject of Stallman's speech is the history and future of the free software movement. The location is significant. Less than a month before, Microsoft senior vice president Craig Mundie appeared at the nearby NYU Stern School of Business, delivering a speech blasting the General Public License, or GPL, a legal device originally conceived by Stallman 16 years before. Built to counteract the growing wave of software secrecy overtaking the computer industry-a wave first noticed by Stallman during his 1980 troubles with the Xerox laser printer-the GPL has evolved into a central tool of the free software community. In simplest terms, the GPL locks software programs into a form of communal ownership-what today's legal scholars now call the "digital commons"-through the legal weight of copyright. Once locked, programs remain unremovable. Derivative versions must carry the same copyright protection-even derivative versions that bear only a small snippet of the original source code. For this reason, some within the software industry have taken to calling the GPL a "viral" license, because it spreads itself to every software program it touches.~{ Actually, the GPL's powers are not quite that potent. According to section 10 of the GNU General Public License, Version 2 (1991), the viral nature of the license depends heavily on the Free Software Foundation's willingness to view a program as a derivative work, not to mention the existing license the GPL would replace. \\ If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software that is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. \\ "To compare something to a virus is very harsh," says Stallman. "A spider plant is a more accurate comparison; it goes to another place if you actively take a cutting." \\ For more information on the GNU General Public License, visit http://www.gnu.org/copyleft/gpl.html }~
+={Mundie, Craig+2;NYU Stern School of Business;Stern School of Business (NYU)}
+
+In an information economy increasingly dependent on software and increasingly beholden to software standards, the GPL has become the proverbial "big stick." Even companies that once laughed it off as software socialism have come around to recognize the benefits. Linux, the Unix-like kernel developed by Finnish college student Linus Torvalds in 1991, is licensed under the GPL, as are many of the world's most popular programming tools: GNU Emacs, the GNU Debugger, the GNU C Compiler, etc. Together, these tools form the components of a free software operating system developed, nurtured, and owned by the worldwide hacker community. Instead of viewing this community as a threat, high-tech companies like IBM, Hewlett Packard, and Sun Microsystems have come to rely upon it, selling software applications and services built to ride atop the ever-growing free software infrastructure.
+={C Compiler (GNU);GNU Debugger (GDB);GDB (GNU Debugger);Debugger;Emacs text editor;GNU Emacs;GNU C Compiler (GCC)+9;GCC (GNU C Compiler);Hewlett Packard:free software community and;IBM:free software community and;Linux;Torvalds, Linus;Sun Microsystems: free software community and}
+
+They've also come to rely upon it as a strategic weapon in the hacker community's perennial war against Microsoft, the Redmond, Washington-based company that, for better or worse, has dominated the PC-software marketplace since the late 1980s. As owner of the popular Windows operating system, Microsoft stands to lose the most in an industry-wide shift to the GPL license. Almost every line of source code in the Windows colossus is protected by copyrights reaffirming the private nature of the underlying source code or, at the very least, reaffirming Microsoft's legal ability to treat it as such. From the Microsoft viewpoint, incorporating programs protected by the "viral" GPL into the Windows colossus would be the software equivalent of Superman downing a bottle of Kryptonite pills. Rival companies could suddenly copy, modify, and sell improved versions of Windows, rendering the company's indomitable position as the No. 1 provider of consumer-oriented software instantly vulnerable. Hence the company's growing concern over the GPL's rate of adoption. Hence the recent Mundie speech blasting the GPL and the "open source" approach to software development and sales. And hence Stallman's decision to deliver a public rebuttal to that speech on the same campus here today.
+={Windows (Microsoft):source code and;open source:software development, approach to;Redmond (Washington)}
+
+20 years is a long time in the software industry. Consider this: in 1980, when Richard Stallman was cursing the AI Lab's Xerox laser printer, Microsoft, the company modern hackers view as the most powerful force in the worldwide software industry, was still a privately held startup. IBM, the company hackers used to regard as the most powerful force in the worldwide software industry, had yet to to introduce its first personal computer, thereby igniting the current low-cost PC market. Many of the technologies we now take for granted-the World Wide Web, satellite television, 32-bit video-game consoles-didn't even exist. The same goes for many of the companies that now fill the upper echelons of the corporate establishment, companies like AOL, Sun Microsystems, Amazon.com, Compaq, and Dell. The list goes on and on.
+={Amazon.com;AOL (America OnLine);Compaq computers;Dell computers;PCs (personal computers);personal computers (PCs)}
+
+The fact that the high-technology marketplace has come so far in such little time is fuel for both sides of the GPL debate. GPL-proponents point to the short lifespan of most computer hardware platforms. Facing the risk of buying an obsolete product, consumers tend to flock to companies with the best long-term survival. As a result, the software marketplace has become a winner-take-all arena.~{ See Shubha Ghosh, "Revealing the Microsoft Windows Source Code," Gigalaw.com (January, 2000). \\ http://www.gigalaw.com/articles/ghosh-2000-01-p1.html }~ The current, privately owned software environment, GPL-proponents say, leads to monopoly abuse and stagnation. Strong companies suck all the oxygen out of the marketplace for rival competitors and innovative startups.
+
+GPL-opponents argue just the opposite. Selling software is just as risky, if not more risky, than buying software, they say. Without the legal guarantees provided by private software licenses, not to mention the economic prospects of a privately owned "killer app" (i.e., a breakthrough technology that launches an entirely new market),~{ Killer apps don't have to be proprietary. Witness, of course, the legendary Mosaic browser, a program whose copyright permits noncommercial derivatives with certain restrictions. Still, I think the reader gets the point: the software marketplace is like the lottery. The bigger the potential payoff, the more people want to participate. For a good summary of the killer-app phenomenon, see Philip Ben-David, "Whatever Happened to the `Killer App'?" e-Commerce News (December 7, 2000). \\ http://www.ecommercetimes.com/perl/story/5893.html }~ companies lose the incentive to participate. Once again, the market stagnates and innovation declines. As Mundie himself noted in his May 3 address on the same campus, the GPL's "viral" nature "poses a threat" to any company that relies on the uniqueness of its software as a competitive asset. Added Mundie:
+={Mundie, Craig+2}
+
+_1 It also fundamentally undermines the independent commercial software sector because it effectively makes it impossible to distribute software on a basis where recipients pay for the product rather than just the cost of distribution.~{ See Craig Mundie, "The Commercial Software Model," senior vice president, Microsoft Corp. Excerpted from an online transcript of Mundie's May 3, 2001, speech to the New York University Stern School of Business. \\ http://www.microsoft.com/presspass/exec/craig/05-03sharedsource.asp }~
+
+The mutual success of GNU/Linux, the amalgamated operating system built around the GPL-protected Linux kernel, and Windows over the last 10 years reveals the wisdom of both perspectives. Nevertheless, the battle for momentum is an important one in the software industry. Even powerful vendors such as Microsoft rely on the support of third-party software developers whose tools, programs, and computer games make an underlying software platform such as Windows more attractive to the mainstream consumer. Citing the rapid evolution of the technology marketplace over the last 20 years, not to mention his own company's admirable track record during that period, Mundie advised listeners to not get too carried away by the free software movement's recent momentum:
+={GNU Project:Linux and, mutual success of;Linux:GNU Project and;third-party software developers supporting Microsoft}
+
+_1 Two decades of experience have shown that an economic model that protects intellectual property and a business model that recoups research and development costs can create impressive economic benefits and distribute them very broadly. ^5^
+
+Such admonitions serve as the backdrop for Stallman's speech today. Less than a month after their utterance, Stallman stands with his back to one of the chalk boards at the front of the room, edgy to begin.
+
+If the last two decades have brought dramatic changes to the software marketplace, they have brought even more dramatic changes to Stallman himself. Gone is the skinny, clean-shaven hacker who once spent his entire days communing with his beloved PDP-10. In his place stands a heavy-set middle-aged man with long hair and rabbinical beard, a man who now spends the bulk of his time writing and answering email, haranguing fellow programmers, and giving speeches like the one today. Dressed in an aqua-colored T-shirt and brown polyester pants, Stallman looks like a desert hermit who just stepped out of a Salvation Army dressing room.
+
+The crowd is filled with visitors who share Stallman's fashion and grooming tastes. Many come bearing laptop computers and cellular modems, all the better to record and transmit Stallman's words to a waiting Internet audience. The gender ratio is roughly 15 males to 1 female, and 1 of the 7 or 8 females in the room comes in bearing a stuffed penguin, the official Linux mascot, while another carries a stuffed teddy bear.
+
+{free_as_in_freedom_01_rms.png 381x321 "Richard Stallman, circa 2000. 'I decided I would develop a free software operating system or die trying ... of old age of course.' Photo courtesy of http://www.stallman.org " }http://en.wikipedia.org/wiki/Richard_stallman
+
+Agitated, Stallman leaves his post at the front of the room and takes a seat in a front-row chair, tapping a few commands into an already-opened laptop. For the next 10 minutes Stallman is oblivious to the growing number of students, professors, and fans circulating in front of him at the foot of the auditorium stage.
+
+Before the speech can begin, the baroque rituals of academic formality must be observed. Stallman's appearance merits not one but two introductions. Mike Uretsky, codirector of the Stern School's Center for Advanced Technology, provides the first.
+={Uretsky, Mike+5}
+
+"The role of a university is to foster debate and to have interesting discussions," Uretsky says. "This particular presentation, this seminar falls right into that mold. I find the discussion of open source particularly interesting."
+
+Before Uretsky can get another sentence out, Stallman is on his feet waving him down like a stranded motorist.
+
+"I do free software," Stallman says to rising laughter. "Open source is a different movement."
+
+The laughter gives way to applause. The room is stocked with Stallman partisans, people who know of his reputation for verbal exactitude, not to mention his much publicized 1998 falling out with the open source software proponents. Most have come to anticipate such outbursts the same way radio fans once waited for Jack Benny's trademark, "Now cut that out!" phrase during each radio program.
+
+Uretsky hastily finishes his introduction and cedes the stage to Edmond Schonberg, a professor in the NYU computer-science department. As a computer programmer and GNU Project contributor, Schonberg knows which linguistic land mines to avoid. He deftly summarizes Stallman's career from the perspective of a modern-day programmer.
+={Schonberg, Ed.+2}
+
+"Richard is the perfect example of somebody who, by acting locally, started thinking globally [about] problems concerning the unavailability of source code," says Schonberg. "He has developed a coherent philosophy that has forced all of us to reexamine our ideas of how software is produced, of what intellectual property means, and of what the software community actually represents."
+
+Schonberg welcomes Stallman to more applause. Stallman takes a moment to shut off his laptop, rises out of his chair, and takes the stage.
+
+At first, Stallman's address seems more Catskills comedy routine than political speech. "I'd like to thank Microsoft for providing me the opportunity to be on this platform," Stallman wisecracks. "For the past few weeks, I have felt like an author whose book was fortuitously banned somewhere."
+
+For the uninitiated, Stallman dives into a quick free software warm-up analogy. He likens a software program to a cooking recipe. Both provide useful step-by-step instructions on how to complete a desired task and can be easily modified if a user has special desires or circumstances. "You don't have to follow a recipe exactly," Stallman notes. "You can leave out some ingredients. Add some mushrooms, 'cause you like mushrooms. Put in less salt because your doctor said you should cut down on salt-whatever."
+
+Most importantly, Stallman says, software programs and recipes are both easy to share. In giving a recipe to a dinner guest, a cook loses little more than time and the cost of the paper the recipe was written on. Software programs require even less, usually a few mouse-clicks and a modicum of electricity. In both instances, however, the person giving the information gains two things: increased friendship and the ability to borrow interesting recipes in return.
+
+"Imagine what it would be like if recipes were packaged inside black boxes," Stallman says, shifting gears. "You couldn't see what ingredients they're using, let alone change them, and imagine if you made a copy for a friend. They would call you a pirate and try to put you in prison for years. That world would create tremendous outrage from all the people who are used to sharing recipes. But that is exactly what the world of proprietary software is like. A world in which common decency towards other people is prohibited or prevented."
+
+With this introductory analogy out of the way, Stallman launches into a retelling of the Xerox laser-printer episode. Like the recipe analogy, the laser-printer story is a useful rhetorical device. With its parable-like structure, it dramatizes just how quickly things can change in the software world. Drawing listeners back to an era before Amazon.com one-click shopping, Microsoft Windows, and Oracle databases, it asks the listener to examine the notion of software ownership free of its current corporate logos.
+
+Stallman delivers the story with all the polish and practice of a local district attorney conducting a closing argument. When he gets to the part about the Carnegie Mellon professor refusing to lend him a copy of the printer source code, Stallman pauses.
+
+"He had betrayed us," Stallman says. "But he didn't just do it to us. Chances are he did it to you."
+
+On the word "you," Stallman points his index finger accusingly at an unsuspecting member of the audience. The targeted audience member's eyebrows flinch slightly, but Stallman's own eyes have moved on. Slowly and deliberately, Stallman picks out a second listener to nervous titters from the crowd. "And I think, mostly likely, he did it to you, too," he says, pointing at an audience member three rows behind the first.
+
+By the time Stallman has a third audience member picked out, the titters have given away to general laughter. The gesture seems a bit staged, because it is. Still, when it comes time to wrap up the Xerox laser-printer story, Stallman does so with a showman's flourish. "He probably did it to most of the people here in this room-except a few, maybe, who weren't born yet in 1980," Stallman says, drawing more laughs. "[That's] because he had promised to refuse to cooperate with just about the entire population of the planet Earth."
+
+Stallman lets the comment sink in for a half-beat. "He had signed a nondisclosure agreement," Stallman adds.
+
+Richard Matthew Stallman's rise from frustrated academic to political leader over the last 20 years speaks to many things. It speaks to Stallman's stubborn nature and prodigious will. It speaks to the clearly articulated vision and values of the free software movement Stallman helped build. It speaks to the high-quality software programs Stallman has built, programs that have cemented Stallman's reputation as a programming legend. It speaks to the growing momentum of the GPL, a legal innovation that many Stallman observers see as his most momentous accomplishment.
+
+Most importantly, it speaks to the changing nature of political power in a world increasingly beholden to computer technology and the software programs that power that technology.
+
+Maybe that's why, even at a time when most high-technology stars are on the wane, Stallman's star has grown. Since launching the GNU Project in 1984,~{ The acronym GNU stands for "GNU's not Unix." In another portion of the May 29, 2001, NYU speech, Stallman summed up the acronym's origin: \\ _1 We hackers always look for a funny or naughty name for a program, because naming a program is half the fun of writing the program. We also had a tradition of recursive acronyms, to say that the program that you're writing is similar to some existing program . . . I looked for a recursive acronym for Something Is Not UNIX. And I tried all 26 letters and discovered that none of them was a word. I decided to make it a contraction. That way I could have a three-letter acronym, for Something's Not UNIX. And I tried letters, and I came across the word "GNU." That was it. \\ _1 Although a fan of puns, Stallman recommends that software users pronounce the "g" at the beginning of the acronym (i.e., "gah-new"). Not only does this avoid confusion with the word "gnu," the name of the African antelope, Connochaetes gnou, it also avoids confusion with the adjective "new." "We've been working on it for 17 years now, so it is not exactly new any more," Stallman says. \\ Source: author notes and online transcript of "Free Software: Freedom and Cooperation," Richard Stallman's May 29, 2001, speech at New York University. \\ http://www.gnu.org/events/rms-nyu-2001-transcript.txt }~ Stallman has been at turns ignored, satirized, vilified, and attacked-both from within and without the free software movement. Through it all, the GNU Project has managed to meet its milestones, albeit with a few notorious delays, and stay relevant in a software marketplace several orders of magnitude more complex than the one it entered 18 years ago. So too has the free software ideology, an ideology meticulously groomed by Stallman himself.
+
+To understand the reasons behind this currency, it helps to examine Richard Stallman both in his own words and in the words of the people who have collaborated and battled with him along the way. The Richard Stallman character sketch is not a complicated one. If any person exemplifies the old adage "what you see is what you get," it's Stallman.
+
+"I think if you want to understand Richard Stallman the human being, you really need to see all of the parts as a consistent whole," advises Eben Moglen, legal counsel to the Free Software Foundation and professor of law at Columbia University Law School. "All those personal eccentricities that lots of people see as obstacles to getting to know Stallman really are Stallman: Richard's strong sense of personal frustration, his enormous sense of principled ethical commitment, his inability to compromise, especially on issues he considers fundamental. These are all the very reasons Richard did what he did when he did."
+={Columbia University;Moglen, Eben+2}
+
+Explaining how a journey that started with a laser printer would eventually lead to a sparring match with the world's richest corporation is no easy task. It requires a thoughtful examination of the forces that have made software ownership so important in today's society. It also requires a thoughtful examination of a man who, like many political leaders before him, understands the malleability of human memory. It requires an ability to interpret the myths and politically laden code words that have built up around Stallman over time. Finally, it requires an understanding of Stallman's genius as a programmer and his failures and successes in translating that genius to other pursuits.
+
+When it comes to offering his own summary of the journey, Stallman acknowledges the fusion of personality and principle observed by Moglen. "Stubbornness is my strong suit," he says. "Most people who attempt to do anything of any great difficulty eventually get discouraged and give up. I never gave up."
+
+He also credits blind chance. Had it not been for that run-in over the Xerox laser printer, had it not been for the personal and political conflicts that closed out his career as an MIT employee, had it not been for a half dozen other timely factors, Stallman finds it very easy to picture his life following a different career path. That being said, Stallman gives thanks to the forces and circumstances that put him in the position to make a difference.
+
+"I had just the right skills," says Stallman, summing up his decision for launching the GNU Project to the audience. "Nobody was there but me, so I felt like, `I'm elected. I have to work on this. If not me , who?'"
+
+1~ Chapter 3 - A Portrait of the Hacker as a Young Man
+={Stallman, Richard M.:childhood+61}
+
+Richard Stallman's mother, Alice Lippman, still remembers the moment she realized her son had a special gift.
+={Lippman, Alice+60}
+
+"I think it was when he was eight," Lippman recalls.
+
+The year was 1961, and Lippman, a recently divorced single mother, was wiling away a weekend afternoon within the family's tiny one-bedroom apartment on Manhattan's Upper West Side. Leafing through a copy of Scientific American, Lippman came upon her favorite section, the Martin Gardner-authored column titled "Mathematical Games." A substitute art teacher, Lippman always enjoyed Gardner's column for the brain-teasers it provided. With her son already ensconced in a book on the nearby sofa, Lippman decided to take a crack at solving the week's feature puzzle.
+
+"I wasn't the best person when it came to solving the puzzles," she admits. "But as an artist, I found they really helped me work through conceptual barriers."
+
+Lippman says her attempt to solve the puzzle met an immediate brick wall. About to throw the magazine down in disgust, Lippman was surprised by a gentle tug on her shirt sleeve.
+
+"It was Richard," she recalls, "He wanted to know if I needed any help."
+
+Looking back and forth, between the puzzle and her son, Lippman says she initially regarded the offer with skepticism. "I asked Richard if he'd read the magazine," she says. "He told me that, yes, he had and what's more he'd already solved the puzzle. The next thing I know, he starts explaining to me how to solve it."
+
+Hearing the logic of her son's approach, Lippman's skepticism quickly gave way to incredulity. "I mean, I always knew he was a bright boy," she says, "but this was the first time I'd seen anything that suggested how advanced he really was."
+
+Thirty years after the fact, Lippman punctuates the memory with a laugh. "To tell you the truth, I don't think I ever figured out how to solve that puzzle," she says. "All I remember is being amazed he knew the answer."
+
+Seated at the dining-room table of her second Manhattan apartment-the same spacious three-bedroom complex she and her son moved to following her 1967 marriage to Maurice Lippman, now deceased-Alice Lippman exudes a Jewish mother's mixture of pride and bemusement when recalling her son's early years. The nearby dining-room credenza offers an eight-by-ten photo of Stallman glowering in full beard and doctoral robes. The image dwarfs accompanying photos of Lippman's nieces and nephews, but before a visitor can make too much of it, Lippman makes sure to balance its prominent placement with an ironic wisecrack.
+={Lippman, Maurice}
+
+"Richard insisted I have it after he received his honorary doctorate at the University of Glasgow," says Lippman. "He said to me, `Guess what, mom? It's the first graduation I ever attended.'"~{ See Michael Gross, "Richard Stallman: High School Misfit, Symbol of Free Software, MacArthur-certified Genius" (1999). This interview is one of the most candid Stallman interviews on the record. I recommend it highly. \\ http://www.mgross.com/interviews/stallman1.html }~
+={University of Glasgow}
+
+Such comments reflect the sense of humor that comes with raising a child prodigy. Make no mistake, for every story Lippman hears and reads about her son's stubbornness and unusual behavior, she can deliver at least a dozen in return.
+
+"He used to be so conservative," she says, throwing up her hands in mock exasperation. "We used to have the worst arguments right here at this table. I was part of the first group of public city school teachers that struck to form a union, and Richard was very angry with me. He saw unions as corrupt. He was also very opposed to social security. He thought people could make much more money investing it on their own. Who knew that within 10 years he would become so idealistic? All I remember is his stepsister coming to me and saying, `What is he going to be when he grows up? A fascist?'"
+
+As a single parent for nearly a decade-she and Richard's father, Daniel Stallman, were married in 1948, divorced in 1958, and split custody of their son afterwards-Lippman can attest to her son's aversion to authority. She can also attest to her son's lust for knowledge. It was during the times when the two forces intertwined, Lippman says, that she and her son experienced their biggest battles.
+={Stallman, Daniel}
+
+"It was like he never wanted to eat," says Lippman, recalling the behavior pattern that set in around age eight and didn't let up until her son's high-school graduation in 1970. "I'd call him for dinner, and he'd never hear me. I'd have to call him 9 or 10 times just to get his attention. He was totally immersed."
+
+Stallman, for his part, remembers things in a similar fashion, albeit with a political twist.
+
+"I enjoyed reading," he says. "If I wanted to read, and my mother told me to go to the kitchen and eat or go to sleep, I wasn't going to listen. I saw no reason why I couldn't read. No reason why she should be able to tell me what to do, period. Essentially, what I had read about, ideas such as democracy and individual freedom, I applied to myself. I didn't see any reason to exclude children from these principles."
+
+The belief in individual freedom over arbitrary authority extended to school as well. Two years ahead of his classmates by age 11, Stallman endured all the usual frustrations of a gifted public-school student. It wasn't long after the puzzle incident that his mother attended the first in what would become a long string of parent-teacher conferences.
+
+"He absolutely refused to write papers," says Lippman, recalling an early controversy. "I think the last paper he wrote before his senior year in high school was an essay on the history of the number system in the west for a fourth-grade teacher."
+
+Gifted in anything that required analytical thinking, Stallman gravitated toward math and science at the expense of his other studies. What some teachers saw as single-mindedness, however, Lippman saw as impatience. Math and science offered simply too much opportunity to learn, especially in comparison to subjects and pursuits for which her son seemed less naturally inclined. Around age 10 or 11, when the boys in Stallman's class began playing a regular game of touch football, she remembers her son coming home in a rage. "He wanted to play so badly, but he just didn't have the coordination skills," Lippman recalls. "It made him so angry."
+
+The anger eventually drove her son to focus on math and science all the more. Even in the realm of science, however, her son's impatience could be problematic. Poring through calculus textbooks by age seven, Stallman saw little need to dumb down his discourse for adults. Sometime, during his middle-school years, Lippman hired a student from nearby Columbia University to play big brother to her son. The student left the family's apartment after the first session and never came back. "I think what Richard was talking about went over his head," Lippman speculates.
+
+Another favorite maternal anecdote dates back to the early 1960s, shortly after the puzzle incident. Around age seven, two years after the divorce and relocation from Queens, Richard took up the hobby of launching model rockets in nearby Riverside Drive Park. What started as aimless fun soon took on an earnest edge as her son began recording the data from each launch. Like the interest in mathematical games, the pursuit drew little attention until one day, just before a major NASA launch, Lippman checked in on her son to see if he wanted to watch.
+
+"He was fuming," Lippman says. "All he could say to me was, `But I'm not published yet.' Apparently he had something that he really wanted to show NASA."
+
+Such anecdotes offer early evidence of the intensity that would become Stallman's chief trademark throughout life. When other kids came to the table, Stallman stayed in his room and read. When other kids played Johnny Unitas, Stallman played Werner von Braun. "I was weird," Stallman says, summing up his early years succinctly in a 1999 interview. "After a certain age, the only friends I had were teachers." ^7^
+
+Although it meant courting more run-ins at school, Lippman decided to indulge her son's passion. By age 12, Richard was attending science camps during the summer and private school during the school year. When a teacher recommended her son enroll in the Columbia Science Honors Program, a post-Sputnik program designed for gifted middle- and high-school students in New York City, Stallman added to his extracurriculars and was soon commuting uptown to the Columbia University campus on Saturdays.
+={Columbia University;Science Honors Program (Columbia)+2}
+
+% extra reference to Columbia University
+
+Dan Chess, a fellow classmate in the Columbia Science Honors Program, recalls Richard Stallman seeming a bit weird even among the students who shared a similar lust for math and science. "We were all geeks and nerds, but he was unusually poorly adjusted," recalls Chess, now a mathematics professor at Hunter College. "He was also smart as shit. I've known a lot of smart people, but I think he was the smartest person I've ever known."
+={Chess, Dan;Hunter College}
+
+Seth Breidbart, a fellow Columbia Science Honors Program alumnus, offers bolstering testimony. A computer programmer who has kept in touch with Stallman thanks to a shared passion for science fiction and science-fiction conventions, he recalls the 15-year-old, buzz-cut-wearing Stallman as "scary," especially to a fellow 15-year-old.
+={Breidbart, Seth+1}
+
+"It's hard to describe," Breidbart says. "It wasn't like he was unapproachable. He was just very intense. [He was] very knowledgeable but also very hardheaded in some ways."
+
+Such descriptions give rise to speculation: are judgment-laden adjectives like "intense" and "hardheaded" simply a way to describe traits that today might be categorized under juvenile behavioral disorder? A December, 2001, /{Wired}/ magazine article titled "The Geek Syndrome" paints the portrait of several scientifically gifted children diagnosed with high-functioning autism or Asperger Syndrome. In many ways, the parental recollections recorded in the Wired article are eerily similar to the ones offered by Lippman. Even Stallman has indulged in psychiatric revisionism from time to time. During a 2000 profile for the /{Toronto Star}/, Stallman described himself to an interviewer as "borderline autistic,"~{ See Judy Steed, /{Toronto Star}/, BUSINESS, (October 9, 2000): C03. \\ His vision of free software and social cooperation stands in stark contrast to the isolated nature of his private life. A Glenn Gould-like eccentric, the Canadian pianist was similarly brilliant, articulate, and lonely. Stallman considers himself afflicted, to some degree, by autism: a condition that, he says, makes it difficult for him to interact with people. }~ a description that goes a long way toward explaining a lifelong tendency toward social and emotional isolation and the equally lifelong effort to overcome it.
+={Asperger Syndrome+1;autism+5;Geek Syndrome, The (Silberman)+1;Wired magazine;Toronto Star;Silberman, Steve+1;Stallman, Richard M.:behavioral disorders+1}
+
+Such speculation benefits from the fast and loose nature of most so-called "behavioral disorders" nowadays, of course. As Steve Silberman, author of "The Geek Syndrome," notes, American psychiatrists have only recently come to accept Asperger Syndrome as a valid umbrella term covering a wide set of behavioral traits. The traits range from poor motor skills and poor socialization to high intelligence and an almost obsessive affinity for numbers, computers, and ordered systems.~{ See Steve Silberman, "The Geek Syndrome," Wired (December, 2001). \\ http://www.wired.com/wired/archive/9.12/aspergers_pr.html }~ Reflecting on the broad nature of this umbrella, Stallman says its possible that, if born 40 years later, he might have merited just such a diagnosis. Then again, so would many of his computer-world colleagues.
+={Stallman, Richard M.:childhood, behavioral disorders}
+
+"It's possible I could have had something like that," he says. "On the other hand, one of the aspects of that syndrome is difficulty following rhythms. I can dance. In fact, I love following the most complicated rhythms. It's not clear cut enough to know."
+
+Chess, for one, rejects such attempts at back-diagnosis. "I never thought of him [as] having that sort of thing," he says. "He was just very unsocialized, but then, we all were."
+={Chess, Dan}
+
+Lippman, on the other hand, entertains the possibility. She recalls a few stories from her son's infancy, however, that provide fodder for speculation. A prominent symptom of autism is an oversensitivity to noises and colors, and Lippman recalls two anecdotes that stand out in this regard. "When Richard was an infant, we'd take him to the beach," she says. "He would start screaming two or three blocks before we reached the surf. It wasn't until the third time that we figured out what was going on: the sound of the surf was hurting his ears." She also recalls a similar screaming reaction in relation to color: "My mother had bright red hair, and every time she'd stoop down to pick him up, he'd let out a wail."
+
+In recent years, Lippman says she has taken to reading books about autism and believes that such episodes were more than coincidental. "I do feel that Richard had some of the qualities of an autistic child," she says. "I regret that so little was known about autism back then."
+
+Over time, however, Lippman says her son learned to adjust. By age seven, she says, her son had become fond of standing at the front window of subway trains, mapping out and memorizing the labyrinthian system of railroad tracks underneath the city. It was a hobby that relied on an ability to accommodate the loud noises that accompanied each train ride. "Only the initial noise seemed to bother him," says Lippman. "It was as if he got shocked by the sound but his nerves learned how to make the adjustment."
+
+For the most part, Lippman recalls her son exhibiting the excitement, energy, and social skills of any normal boy. It wasn't until after a series of traumatic events battered the Stallman household, she says, that her son became introverted and emotionally distant.
+
+The first traumatic event was the divorce of Alice and Daniel Stallman, Richard's father. Although Lippman says both she and her ex-husband tried to prepare their son for the blow, she says the blow was devastating nonetheless. "He sort of didn't pay attention when we first told him what was happening," Lippman recalls. "But the reality smacked him in the face when he and I moved into a new apartment. The first thing he said was, `Where's Dad's furniture?'"
+={divorce of Alice and Daniel Stallman;Stallman, Daniel}
+
+For the next decade, Stallman would spend his weekdays at his mother's apartment in Manhattan and his weekends at his father's home in Queens. The shuttling back and forth gave him a chance to study a pair of contrasting parenting styles that, to this day, leaves Stallman firmly opposed to the idea of raising children himself. Speaking about his father, a World War II vet who passed away in early 2001, Stallman balances respect with anger. On one hand, there is the man whose moral commitment led him to learn French just so he could be more helpful to Allies when they'd finally come. On the other hand, there was the parent who always knew how to craft a put-down for cruel effect.~{ Regrettably, I did not get a chance to interview Daniel Stallman for this book. During the early research for this book, Stallman informed me that his father suffered from Alzheimer's. When I resumed research in late 2001, I learned, sadly, that Daniel Stallman had died earlier in the year. }~
+
+"My father had a horrible temper," Stallman says. "He never screamed, but he always found a way to criticize you in a cold, designed-to-crush way."
+
+As for life in his mother's apartment, Stallman is less equivocal. "That was war," he says. "I used to say in my misery, `I want to go home,' meaning to the nonexistent place that I'll never have."
+
+For the first few years after the divorce, Stallman found the tranquility that eluded him in the home of his paternal grandparents. Then, around age 10 his grandparents passed away in short succession. For Stallman, the loss was devastating. "I used to go and visit and feel I was in a loving, gentle environment," Stallman recalls. "It was the only place I ever found one, until I went away to college."
+
+Lippman lists the death of Richard's paternal grandparents as the second traumatic event. "It really upset him," she says. He was very close to both his grandparents. Before they died, he was very outgoing, almost a leader-of-the-pack type with the other kids. After they died, he became much more emotionally withdrawn."
+
+From Stallman's perspective, the emotional withdrawal was merely an attempt to deal with the agony of adolescence. Labeling his teenage years a "pure horror," Stallman says he often felt like a deaf person amid a crowd of chattering music listeners.
+
+"I often had the feeling that I couldn't understand what other people were saying," says Stallman, recalling the emotional bubble that insulated him from the rest of the adolescent and adult world. "I could understand the words, but something was going on underneath the conversations that I didn't understand. I couldn't understand why people were interested in the things other people said."
+
+For all the agony it produced, adolescence would have a encouraging effect on Stallman's sense of individuality. At a time when most of his classmates were growing their hair out, Stallman preferred to keep his short. At a time when the whole teenage world was listening to rock and roll, Stallman preferred classical music. A devoted fan of science fiction, Mad magazine, and late-night TV, Stallman cultivated a distinctly off-the-wall personality that fed off the incomprehension of parents and peers alike.
+
+"Oh, the puns," says Lippman, still exasperated by the memory of her son's teenage personality. "There wasn't a thing you could say at the dinner table that he couldn't throw back at you as a pun."
+
+Outside the home, Stallman saved the jokes for the adults who tended to indulge his gifted nature. One of the first was a summer-camp counselor who handed Stallman a print-out manual for the IBM 7094 computer during his 12th year. To a preteenager fascinated with numbers and science, the gift was a godsend.~{ Stallman, an atheist, would probably quibble with this description. Suffice it to say, it was something Stallman welcomed. See previous note 1: "As soon as I heard about computers, I wanted to see one and play with one." }~ By the end of summer, Stallman was writing out paper programs according to the 7094's internal specifications, anxiously anticipating getting a chance to try them out on a real machine.
+={IBM 7094 computer+1}
+
+With the first personal computer still a decade away, Stallman would be forced to wait a few years before getting access to his first computer. His first chance finally came during his junior year of high school. Hired on at the IBM New York Scientific Center, a now-defunct research facility in downtown Manhattan, Stallman spent the summer after high-school graduation writing his first program, a pre-processor for the 7094 written in the programming language PL/I. "I first wrote it in PL/I, then started over in assembler language when the PL/I program was too big to fit in the computer," he recalls.
+={assembler language;IBM:New York Scientific Center;IBM New York Scientific Center;PL/I programming language;Stallman, Richard M.:childhood, first computer program}
+
+After that job at the IBM Scientific Center, Stallman had held a laboratory-assistant position in the biology department at Rockefeller University. Although he was already moving toward a career in math or physics, Stallman's analytical mind impressed the lab director enough that a few years after Stallman departed for college, Lippman received an unexpected phone call. "It was the professor at Rockefeller," Lippman says. "He wanted to know how Richard was doing. He was surprised to learn that he was working in computers. He'd always thought Richard had a great future ahead of him as a biologist."
+={Rockefeller University}
+
+Stallman's analytical skills impressed faculty members at Columbia as well, even when Stallman himself became a target of their ire. "Typically once or twice an hour [Stallman] would catch some mistake in the lecture," says Breidbart. "And he was not shy about letting the professors know it immediately. It got him a lot of respect but not much popularity."
+
+Hearing Breidbart's anecdote retold elicits a wry smile from Stallman. "I may have been a bit of a jerk sometimes," he admits. "But I found kindred spirits among the teachers, because they, too, liked to learn. Kids, for the most part, didn't. At least not in the same way."
+={Breidbart, Seth}
+
+Hanging out with the advanced kids on Saturday nevertheless encouraged Stallman to think more about the merits of increased socialization. With college fast approaching, Stallman, like many in his Columbia Science Honors Program, had narrowed his list of desired schools down to two choices: Harvard and MIT. Hearing of her son's desire to move on to the Ivy League, Lippman became concerned. As a 15-year-old high-school junior, Stallman was still having run-ins with teachers and administrators. Only the year before, he had pulled straight A's in American History, Chemistry, French, and Algebra, but a glaring F in English reflected the ongoing boycott of writing assignments. Such miscues might draw a knowing chuckle at MIT, but at Harvard, they were a red flag.
+={Harvard University+7;MIT Massachusetts Institute of Technology}
+
+During her son's junior year, Lippman says she scheduled an appointment with a therapist. The therapist expressed instant concern over Stallman's unwillingness to write papers and his run-ins with teachers. Her son certainly had the intellectual wherewithal to succeed at Harvard, but did he have the patience to sit through college classes that required a term paper? The therapist suggested a trial run. If Stallman could make it through a full year in New York City public schools, including an English class that required term papers, he could probably make it at Harvard. Following the completion of his junior year, Stallman promptly enrolled in summer school at Louis D. Brandeis High School, a public school located on 84th Street, and began making up the mandatory art classes he had shunned earlier in his high-school career.
+={Louis D. Brandeis High School+3}
+
+By fall, Stallman was back within the mainstream population of New York City high-school students. It wasn't easy sitting through classes that seemed remedial in comparison with his Saturday studies at Columbia, but Lippman recalls proudly her son's ability to toe the line.
+
+"He was forced to kowtow to a certain degree, but he did it," Lippman says. "I only got called in once, which was a bit of a miracle. It was the calculus teacher complaining that Richard was interrupting his lesson. I asked how he was interrupting. He said Richard was always accusing the teacher of using a false proof. I said, `Well, is he right?' The teacher said, `Yeah, but I can't tell that to the class. They wouldn't understand.'"
+
+By the end of his first semester at Brandeis, things were falling into place. A 96 in English wiped away much of the stigma of the 60 earned 2 years before. For good measure, Stallman backed it up with top marks in American History, Advanced Placement Calculus, and Microbiology. The crowning touch was a perfect 100 in Physics. Though still a social outcast, Stallman finished his 11 months at Brandeis as the fourth-ranked student in a class of 789.
+
+{free_as_in_freedom_02_rms_snr_year_report.png 381x286 "Stallman's senior-year transcript at Louis D. Brandeis H.S., November, 1969. Note turnaround in English class performance. 'He was forced to kowtow to a certain degree,' says his mother, 'but he did it.'" }http://en.wikipedia.org/wiki/Richard_stallman
+
+Outside the classroom, Stallman pursued his studies with even more diligence, rushing off to fulfill his laboratory-assistant duties at Rockefeller University during the week and dodging the Vietnam protesters on his way to Saturday school at Columbia. It was there, while the rest of the Science Honors Program students sat around discussing their college choices, that Stallman finally took a moment to participate in the preclass bull session.
+
+Recalls Breidbart, "Most of the students were going to Harvard and MIT, of course, but you had a few going to other Ivy League schools. As the conversation circled the room, it became apparent that Richard hadn't said anything yet. I don't know who it was, but somebody got up the courage to ask him what he planned to do."
+={Breidbart, Seth+2}
+
+Thirty years later, Breidbart remembers the moment clearly. As soon as Stallman broke the news that he, too, would be attending Harvard University in the fall, an awkward silence filled the room. Almost as if on cue, the corners of Stallman's mouth slowly turned upward into a self-satisfied smile.
+
+Says Breidbart, "It was his silent way of saying, `That's right. You haven't got rid of me yet.'"
+
+1~ Chapter 4 - Impeach God
+
+Although their relationship was fraught with tension, Richard Stallman would inherit one noteworthy trait from his mother: a passion for progressive politics.
+
+It was an inherited trait that would take several decades to emerge, however. For the first few years of his life, Stallman lived in what he now admits was a "political vacuum."~{ See Michael Gross, "Richard Stallman: High School Misfit, Symbol of Free Software, MacArthur-certified Genius" (1999). }~ Like most Americans during the Eisenhower age, the Stallman family spent the 50s trying to recapture the normalcy lost during the wartime years of the 1940s.
+
+"Richard's father and I were Democrats but happy enough to leave it at that," says Lippman, recalling the family's years in Queens. "We didn't get involved much in local or national politics."
+={Lippman, Alice:political identity of+11}
+
+That all began to change, however, in the late 1950s when Alice divorced Daniel Stallman. The move back to Manhattan represented more than a change of address; it represented a new, independent identity and a jarring loss of tranquility.
+={Stallman, Daniel}
+
+"I think my first taste of political activism came when I went to the Queens public library and discovered there was only a single book on divorce in the whole library," recalls Lippman. "It was very controlled by the Catholic church, at least in Elmhurst, where we lived. I think that was the first inkling I had of the forces that quietly control our lives."
+={Elmhurst (New York);Queens public library}
+
+Returning to her childhood neighborhood, Manhattan's Upper West Side, Lippman was shocked by the changes that had taken place since her departure to Hunter College a decade and a half before. The skyrocketing demand for postwar housing had turned the neighborhood into a political battleground. On one side stood the pro-development city-hall politicians and businessmen hoping to rebuild many of the neighborhood's blocks to accommodate the growing number of white-collar workers moving into the city. On the other side stood the poor Irish and Puerto Rican tenants who had found an affordable haven in the neighborhood.
+={Hunter College}
+
+At first, Lippman didn't know which side to choose. As a new resident, she felt the need for new housing. As a single mother with minimal income, however, she shared the poorer tenants' concern over the growing number of development projects catering mainly to wealthy residents. Indignant, Lippman began looking for ways to combat the political machine that was attempting to turn her neighborhood into a clone of the Upper East Side.
+
+Lippman says her first visit to the local Democratic party headquarters came in 1958. Looking for a day-care center to take care of her son while she worked, she had been appalled by the conditions encountered at one of the city-owned centers that catered to low-income residents. "All I remember is the stench of rotten milk, the dark hallways, the paucity of supplies. I had been a teacher in private nursery schools. The contrast was so great. We took one look at that room and left. That stirred me up."
+={Democratic party+3}
+
+The visit to the party headquarters proved disappointing, however. Describing it as "the proverbial smoke-filled room," Lippman says she became aware for the first time that corruption within the party might actually be the reason behind the city's thinly disguised hostility toward poor residents. Instead of going back to the headquarters, Lippman decided to join up with one of the many clubs aimed at reforming the Democratic party and ousting the last vestiges of the Tammany Hall machine. Dubbed the Woodrow Wilson/FDR Reform Democratic Club, Lippman and her club began showing up at planning and city-council meetings, demanding a greater say.
+={Woodrow Wilson/FDR Reform Democratic Club;Tammany Hall+1}
+
+"Our primary goal was to fight Tammany Hall, Carmine DeSapio and his henchman,"~{ Carmine DeSapio holds the dubious distinction of being the first Italian-American boss of Tammany Hall, the New York City political machine. For more information on DeSapio and the politics of post-war New York, see John Davenport, "Skinning the Tiger: Carmine DeSapio and the End of the Tammany Era," New York Affairs (1975): 3:1. }~ says Lippman. "I was the representative to the city council and was very much involved in creating a viable urban-renewal plan that went beyond simply adding more luxury housing to the neighborhood."
+={DeSapio, Carmine}
+
+Such involvement would blossom into greater political activity during the 1960s. By 1965, Lippman had become an "outspoken" supporter for political candidates like William Fitts Ryan, a Democratic elected to Congress with the help of reform clubs and one of the first U.S. representatives to speak out against the Vietnam War.
+={Vietnam War+10;Ryan, William Fitts}
+
+It wasn't long before Lippman, too, was an outspoken opponent of U.S. involvement in Indochina. "I was against the Vietnam war from the time Kennedy sent troops," she says. "I had read the stories by reporters and journalists sent to cover the early stages of the conflict. I really believed their forecast that it would become a quagmire."
+={Indochina}
+
+Such opposition permeated the Stallman-Lippman household. In 1967, Lippman remarried. Her new husband, Maurice Lippman, a major in the Air National Guard, resigned his commission to demonstrate his opposition to the war. Lippman's stepson, Andrew Lippman, was at MIT and temporarily eligible for a student deferment. Still, the threat of induction should that deferment disappear, as it eventually did, made the risk of U.S. escalation all the more immediate. Finally, there was Richard who, though younger, faced the prospect of choosing between Vietnam or Canada when the war lasted into the 1970s.
+={Lippman, Andrew;Lippman, Maurice;MIT Massachusetts Institute of Technology}
+
+"Vietnam was a major issue in our household," says Lippman. "We talked about it constantly: what would we do if the war continued, what steps Richard or his stepbrother would take if they got drafted. We were all opposed to the war and the draft. We really thought it was immoral."
+
+For Stallman, the Vietnam War elicited a complex mixture of emotions: confusion, horror, and, ultimately, a profound sense of political impotence. As a kid who could barely cope in the mild authoritarian universe of private school, Stallman experienced a shiver whenever the thought of Army boot camp presented itself.
+={draft (Vietnam War)+6}
+
+"I was devastated by the fear, but I couldn't imagine what to do and didn't have the guts to go demonstrate," recalls Stallman, whose March 18th birthday earned him a dreaded low number in the draft lottery when the federal government finally eliminated college deferments in 1971. "I couldn't envision moving to Canada or Sweden. The idea of getting up by myself and moving somewhere. How could I do that? I didn't know how to live by myself. I wasn't the kind of person who felt confident in approaching things like that."
+
+Stallman says he was both impressed and shamed by the family members who did speak out. Recalling a bumper sticker on his father's car likening the My Lai massacre to similar Nazi atrocities in World War II, he says he was "excited" by his father's gesture of outrage. "I admired him for doing it," Stallman says. "But I didn't imagine that I could do anything. I was afraid that the juggernaut of the draft was going to destroy me."
+
+Although descriptions of his own unwillingness to speak out carry a tinge of nostalgic regret, Stallman says he was ultimately turned off by the tone and direction of the anti-war movement. Like other members of the Science Honors Program, he saw the weekend demonstrations at Columbia as little more than a distracting spectacle.~{ Chess, another Columbia Science Honors Program alum, describes the protests as "background noise." "We were all political," he says, "but the SHP was imporant. We would never have skipped it for a demonstration." }~ Ultimately, Stallman says, the irrational forces driving the anti-war movement became indistinguishable from the irrational forces driving the rest of youth culture. Instead of worshiping the Beatles, girls in Stallman's age group were suddenly worshiping firebrands like Abbie Hoffman and Jerry Rubin. To a kid already struggling to comprehend his teenage peers, escapist slogans like "make love not war" had a taunting quality. Not only was it a reminder that Stallman, the short-haired outsider who hated rock 'n' roll, detested drugs, and didn't participate in campus demonstrations, wasn't getting it politically; he wasn't "getting it" sexually either.
+={Beatles;Hoffman, Abbie;Rubin, Jerry;Science Honors Program (Columbia)}
+
+% science honors program, columbia added
+
+"I didn't like the counter culture much," Stallman admits. "I didn't like the music. I didn't like the drugs. I was scared of the drugs. I especially didn't like the anti-intellectualism, and I didn't like the prejudice against technology. After all, I loved a computer. And I didn't like the mindless anti-Americanism that I often encountered. There were people whose thinking was so simplistic that if they disapproved of the conduct of the U.S. in the Vietnam War, they had to support the North Vietnamese. They couldn't imagine a more complicated position, I guess."
+
+Such comments alleviate feelings of timidity. They also underline a trait that would become the key to Stallman's own political maturation. For Stallman, political confidence was directly proportionate to personal confidence. By 1970, Stallman had become confident in few things outside the realm of math and science. Nevertheless, confidence in math gave him enough of a foundation to examine the anti-war movement in purely logical terms. In the process of doing so, Stallman had found the logic wanting. Although opposed to the war in Vietnam, Stallman saw no reason to disavow war as a means for defending liberty or correcting injustice. Rather than widen the breach between himself and his peers, however, Stallman elected to keep the analysis to himself.
+
+In 1970, Stallman left behind the nightly dinnertime conversations about politics and the Vietnam War as he departed for Harvard. Looking back, Stallman describes the transition from his mother's Manhattan apartment to life in a Cambridge dorm as an "escape." Peers who watched Stallman make the transition, however, saw little to suggest a liberating experience.
+={Harvard University+22}
+
+"He seemed pretty miserable for the first while at Harvard," recalls Dan Chess, a classmate in the Science Honors Program who also matriculated at Harvard. "You could tell that human interaction was really difficult for him, and there was no way of avoiding it at Harvard. Harvard was an intensely social kind of place."
+={Chess, Dan;Science Honors Program (Columbia)+1}
+
+To ease the transition, Stallman fell back on his strengths: math and science. Like most members of the Science Honors Program, Stallman breezed through the qualifying exam for Math 55, the legendary "boot camp" class for freshman mathematics "concentrators" at Harvard. Within the class, members of the Science Honors Program formed a durable unit. "We were the math mafia," says Chess with a laugh. "Harvard was nothing, at least compared with the SHP."
+={Math 55 (Harvard University)+9}
+
+To earn the right to boast, however, Stallman, Chess, and the other SHP alumni had to get through Math 55. Promising four years worth of math in two semesters, the course favored only the truly devout. "It was an amazing class," says David Harbater, a former "math mafia" member and now a professor of mathematics at the University of Pennsylvania. "It's probably safe to say there has never been a class for beginning college students that was that intense and that advanced. The phrase I say to people just to get it across is that, among other things, by the second semester we were discussing the differential geometry of Banach manifolds. That's usually when their eyes bug out, because most people don't start talking about Banach manifolds until their second year of graduate school."
+={Harbater, David+2;University of Pennsylvania}
+
+Starting with 75 students, the class quickly melted down to 20 by the end of the second semester. Of that 20, says Harbater, "only 10 really knew what they were doing." Of that 10, 8 would go on to become future mathematics professors, 1 would go on to teach physics.
+
+"The other one," emphasizes Harbater, "was Richard Stallman."
+
+Seth Breidbart, a fellow Math 55 classmate, remembers Stallman distinguishing himself from his peers even then.
+={Breidbart, Seth+14}
+
+"He was a stickler in some very strange ways," says Breidbart. There is a standard technique in math which everybody does wrong. It's an abuse of notation where you have to define a function for something and what you do is you define a function and then you prove that it's well defined. Except the first time he did and presented it, he defined a relation and proved that it's a function. It's the exact same proof, but he used the correct terminology, which no one else did. That's just the way he was."
+
+It was in Math 55 that Richard Stallman began to cultivate a reputation for brilliance. Breidbart agrees, but Chess, whose competitive streak refused to yield, says the realization that Stallman might be the best mathematician in the class didn't set in until the next year. "It was during a class on Real Analysis, which I took with Richard the next year," says Chess, now a math professor at Hunter College. "I actually remember in a proof about complex valued measures that Richard came up with an idea that was basically a metaphor from the calculus of variations. It was the first time I ever saw somebody solve a problem in a brilliantly original way."
+={Hunter College}
+
+Chess makes no bones about it: watching Stallman's solution unfold on the chalkboard was a devastating blow. As a kid who'd always taken pride in being the smartest mathematician the room, it was like catching a glimpse of his own mortality. Years later, as Chess slowly came to accept the professional rank of a good-but-not-great mathematician, he had Stallman's sophomore-year proof to look back on as a taunting early indicator.
+
+"That's the thing about mathematics," says Chess. "You don't have to be a first-rank mathematician to recognize first-rate mathematical talent. I could tell I was up there, but I could also tell I wasn't at the first rank. If Richard had chosen to be a mathematician, he would have been a first-rank mathematician."
+
+For Stallman, success in the classroom was balanced by the same lack of success in the social arena. Even as other members of the math mafia gathered to take on the Math 55 problem sets, Stallman preferred to work alone. The same went for living arrangements. On the housing application for Harvard, Stallman clearly spelled out his preferences. "I said I preferred an invisible, inaudible, intangible roommate," he says. In a rare stroke of bureaucratic foresight, Harvard's housing office accepted the request, giving Stallman a one-room single for his freshman year.
+
+Breidbart, the only math-mafia member to share a dorm with Stallman that freshman year, says Stallman slowly but surely learned how to interact with other students. He recalls how other dorm mates, impressed by Stallman's logical acumen, began welcoming his input whenever an intellectual debate broke out in the dining club or dorm commons.
+
+"We had the usual bull sessions about solving the world's problems or what would be the result of something," recalls Breidbart. "Say somebody discovers an immortality serum. What do you do? What are the political results? If you give it to everybody, the world gets overcrowded and everybody dies. If you limit it, if you say everyone who's alive now can have it but their children can't, then you end up with an underclass of people without it. Richard was just better able than most to see the unforeseen circumstances of any decision."
+
+Stallman remembers the discussions vividly. "I was always in favor of immortality," he says. "I was shocked that most people regarded immortality as a bad thing. How else would we be able to see what the world is like 200 years from now?"
+
+Although a first-rank mathematician and first-rate debater, Stallman shied away from clear-cut competitive events that might have sealed his brilliant reputation. Near the end of freshman year at Harvard, Breidbart recalls how Stallman conspicuously ducked the Putnam exam, a prestigious test open to math students throughout the U.S. and Canada. In addition to giving students a chance to measure their knowledge in relation to their peers, the Putnam served as a chief recruiting tool for academic math departments. According to campus legend, the top scorer automatically qualified for a graduate fellowship at any school of his choice, including Harvard.
+={Putnam exam+1}
+
+Like Math 55, the Putnam was a brutal test of merit. A six-hour exam in two parts, it seemed explicitly designed to separate the wheat from the chaff. Breidbart, a veteran of both the Science Honors Program and Math 55, describes it as easily the most difficult test he ever took. "Just to give you an idea of how difficult it was," says Breidbart, "the top score was a 120, and my score the first year was in the 30s. That score was still good enough to place me 101st in the country."
+
+Surprised that Stallman, the best student in the class, had passed on the test, Breidbart says he and a fellow classmate cornered him in the dining common and demanded an explanation. "He said he was afraid of not doing well," Breidbart recalls.
+
+Breidbart and the friend quickly wrote down a few problems from memory and gave them to Stallman. "He solved all of them," Breidbart says, "leading me to conclude that by not doing well, he either meant coming in second or getting something wrong."
+
+Stallman remembers the episode a bit differently. "I remember that they did bring me the questions and it's possible that I solved one of them, but I'm pretty sure I didn't solve them all," he says. Nevertheless, Stallman agrees with Breidbart's recollection that fear was the primary reason for not taking the test. Despite a demonstrated willingness to point out the intellectual weaknesses of his peers and professors in the classroom, Stallman hated the notion of head-to-head competition.
+
+"It's the same reason I never liked chess," says Stallman. "Whenever I'd play, I would become so consumed by the fear of making a single mistake that I would start making stupid mistakes very early in the game. The fear became a self-fulfilling prophecy."
+
+Whether such fears ultimately prompted Stallman to shy away from a mathematical career is a moot issue. By the end of his freshman year at Harvard, Stallman had other interests pulling him away from the field. Computer programming, a latent fascination throughout Stallman's high-school years, was becoming a full-fledged passion. Where other math students sought occasional refuge in art and history classes, Stallman sought it in the computer-science laboratory.
+
+For Stallman, the first taste of real computer programming at the IBM New York Scientific Center had triggered a desire to learn more. "Toward the end of my first year at Harvard school, I started to have enough courage to go visit computer labs and see what they had. I'd ask them if they had extra copies of any manuals that I could read."
+
+Taking the manuals home, Stallman would examine machine specifications, compare them with other machines he already knew, and concoct a trial program, which he would then bring back to the lab along with the borrowed manual. Although some labs balked at the notion of a strange kid coming off the street and working on the lab machinery, most recognized competence when they saw it and let Stallman run the programs he had created.
+
+One day, near the end of freshman year, Stallman heard about a special laboratory near MIT. The laboratory was located on the ninth floor an off-campus building in Tech Square, the newly built facility dedicated to advanced research. According to the rumors, the lab itself was dedicated to the cutting-edge science of artificial intelligence and boasted the cutting-edge machines and software programs to match.
+={artificial intelligence;MIT Massachusetts Institute of Technology:first visit to+2}
+
+Intrigued, Stallman decided to pay a visit.
+
+The trip was short, about 2 miles on foot, 10 minutes by train, but as Stallman would soon find out, MIT and Harvard can feel like opposite poles of the same planet. With its maze-like tangle of interconnected office buildings, the Institute's campus offered an aesthetic yin to Harvard's spacious colonial-village yang. The same could be said for the student body, a geeky collection of ex-high school misfits known more for its predilection for pranks than its politically powerful alumni.
+
+The yin-yang relationship extended to the AI Lab as well. Unlike Harvard computer labs, there was no grad-student gatekeeper, no clipboard waiting list for terminal access, no explicit atmosphere of "look but don't touch." Instead, Stallman found only a collection of open terminals and robotic arms, presumably the artifacts of some A.I. experiment.
+={AI Lab (Artificial Intelligence Laboratory)+40}
+
+Although the rumors said anybody could sit down at the terminals, Stallman decided to stick with the original plan. When he encountered a lab employee, he asked if the lab had any spare manuals it could loan to an inquisitive student. "They had some, but a lot of things weren't documented," Stallman recalls. "They were hackers after all."
+
+Stallman left with something even better than a manual: a job. Although he doesn't remember what the first project was, he does remember coming back to the AI Lab the next week, grabbing an open terminal and writing software code.
+
+Looking back, Stallman sees nothing unusual in the AI Lab's willingness to accept an unproven outsider at first glance. "That's the way it was back then," he says. "That's the way it still is now. I'll hire somebody when I meet him if I see he's good. Why wait? Stuffy people who insist on putting bureaucracy into everything really miss the point. If a person is good, he shouldn't have to go through a long, detailed hiring process; he should be sitting at a computer writing code."
+
+To get a taste of "bureaucratic and stuffy," Stallman need only visit the computer labs at Harvard. There, access to the terminals was doled out according to academic rank. As an undergrad, Stallman usually had to sign up or wait until midnight, about the time most professors and grad students finished their daily work assignments. The waiting wasn't difficult, but it was frustrating. Waiting for a public terminal, knowing all the while that a half dozen equally usable machines were sitting idle inside professors' locked offices, seemed the height of illogic. Although Stallman paid the occasional visit to the Harvard computer labs, he preferred the more egalitarian policies of the AI Lab. "It was a breath of fresh air," he says. "At the AI Lab, people seemed more concerned about work than status."
+={Harvard University:computer labs}
+
+Stallman quickly learned that the AI Lab's first-come, first-served policy owed much to the efforts of a vigilant few. Many were holdovers from the days of Project MAC, the Department of Defense-funded research program that had given birth to the first time-share operating systems. A few were already legends in the computing world. There was Richard Greenblatt, the lab's in-house Lisp expert and author of MacHack, the computer chess program that had once humbled A.I. critic Hubert Dreyfus. There was Gerald Sussman, original author of the robotic block-stacking program HACKER. And there was Bill Gosper, the in-house math whiz already in the midst of an 18-month hacking bender triggered by the philosophical implications of the computer game LIFE.~{ See Steven Levy, Hackers (Penguin USA [paperback], 1984): 144. \\ Levy devotes about five pages to describing Gosper's fascination with LIFE, a math-based software game first created by British mathematician John Conway. I heartily recommend this book as a supplement, perhaps even a prerequisite, to this one. }~
+={Dreyfus, Hubert;Gosper, Bill;Greenblat, Richard;LIFE mathematical game;LISP programming language;MacHack;Project MAC;Sussman, Gerald+2}
+
+Members of the tight-knit group called themselves "hackers." Over time, they extended the "hacker" description to Stallman as well. In the process of doing so, they inculcated Stallman in the ethical traditions of the "hacker ethic ." To be a hacker meant more than just writing programs, Stallman learned. It meant writing the best possible programs. It meant sitting at a terminal for 36 hours straight if that's what it took to write the best possible programs. Most importantly, it meant having access to the best possible machines and the most useful information at all times. Hackers spoke openly about changing the world through software, and Stallman learned the instinctual hacker disdain for any obstacle that prevented a hacker from fulfilling this noble cause. Chief among these obstacles were poor software, academic bureaucracy, and selfish behavior.
+={ethics of hacking;hackers+7:ethics of}
+
+Stallman also learned the lore, stories of how hackers, when presented with an obstacle, had circumvented it in creative ways. Stallman learned about "lock hacking," the art of breaking into professors' offices to "liberate" sequestered terminals. Unlike their pampered Harvard counterparts, MIT faculty members knew better than to treat the AI Lab's terminal as private property. If a faculty member made the mistake of locking away a terminal for the night, hackers were quick to correct the error. Hackers were equally quick to send a message if the mistake repeated itself. "I was actually shown a cart with a heavy cylinder of metal on it that had been used to break down the door of one professor's office,"~{ Gerald Sussman, an MIT faculty member and hacker whose work at the AI Lab predates Stallman's, disputes this memory. According to Sussman, the hackers never broke any doors to retrieve terminals. }~ Stallman says.
+={AI Lab (Artificial Intelligence Laboratory):lock hacking at+31}
+
+Such methods, while lacking in subtlety, served a purpose. Although professors and administrators outnumbered hackers two-to-one inside the AI Lab, the hacker ethic prevailed. Indeed, by the time of Stallman's arrival at the AI Lab, hackers and the AI Lab administration had coevolved into something of a symbiotic relationship. In exchange for fixing the machines and keeping the software up and running, hackers earned the right to work on favorite pet projects. Often, the pet projects revolved around improving the machines and software programs even further. Like teenage hot-rodders, most hackers viewed tinkering with machines as its own form of entertainment.
+
+Nowhere was this tinkering impulse better reflected than in the operating system that powered the lab's central PDP-6 mini-computer. Dubbed ITS, short for the Incompatible Time Sharing system, the operating system incorporated the hacking ethic into its very design. Hackers had built it as a protest to Project MAC's original operating system, the Compatible Time Sharing System, CTSS, and named it accordingly. At the time, hackers felt the CTSS design too restrictive, limiting programmers' power to modify and improve the program's own internal architecture if needed. According to one legend passed down by hackers, the decision to build ITS had political overtones as well. Unlike CTSS, which had been designed for the IBM 7094, ITS was built specifically for the PDP-6. In letting hackers write the systems themselves, AI Lab administrators guaranteed that only hackers would feel comfortable using the PDP-6. In the feudal world of academic research, the gambit worked. Although the PDP-6 was co-owned in conjunction with other departments, A.I. researchers soon had it to themselves.~{ I apologize for the whirlwind summary of ITS' genesis, an operating system many hackers still regard as the epitome of the hacker ethos. For more information on the program's political significance, see Simson Garfinkel, Architects of the Information Society: Thirty-Five Years of the Laboratory for Computer Science at MIT (MIT Press, 1999). }~
+={Compatible Time Sharing System (CTSS);CTSS (Compatible Time Sharing System);IBM 7094 computer;Incompatible Timesharing System (ITS)+5;PDP-6 computer+1;Project MAC:Incompatible Time Sharing system and}
+
+ITS boasted features most commercial operating systems wouldn't offer for years, features such as multitasking, debugging, and full-screen editing capability. Using it and the PDP-6 as a foundation, the Lab had been able to declare independence from Project MAC shortly before Stallman's arrival. ^17^
+
+As an apprentice hacker, Stallman quickly became enamored with ITS. Although forbidding to most newcomers, the program contained many built-in features that provided a lesson in software development to hacker apprentices such as himself.
+
+"ITS had a very elegant internal mechanism for one program to examine another," says Stallman, recalling the program. "You could examine all sorts of status about another program in a very clean, well-specified way."
+
+Using this feature, Stallman was able to watch how programs written by hackers processed instructions as they ran. Another favorite feature would allow the monitoring program to freeze the monitored program's job between instructions. In other operating systems, such a command would have resulted in half-computed gibberish or an automatic systems crash. In ITS, it provided yet another way to monitor the step-by-step performance.
+
+"If you said, `Stop the job,' it would always be stopped in user mode. It would be stopped between two user-mode instructions, and everything about the job would be consistent for that point," Stallman says. "If you said, `Resume the job,' it would continue properly. Not only that, but if you were to change the status of the job and then change it back, everything would be consistent. There was no hidden status anywhere."
+
+By the end of 1970, hacking at the AI Lab had become a regular part of Stallman's weekly schedule. From Monday to Thursday, Stallman devoted his waking hours to his Harvard classes. As soon as Friday afternoon arrived, however, he was on the T, heading down to MIT for the weekend. Stallman usually timed his arrival to coincide with the ritual food run. Joining five or six other hackers in their nightly quest for Chinese food, he would jump inside a beat-up car and head across the Harvard Bridge into nearby Boston. For the next two hours, he and his hacker colleagues would discuss everything from ITS to the internal logic of the Chinese language and pictograph system. Following dinner, the group would return to MIT and hack code until dawn.
+
+For the geeky outcast who rarely associated with his high-school peers, it was a heady experience, suddenly hanging out with people who shared the same predilection for computers, science fiction, and Chinese food. "I remember many sunrises seen from a car coming back from Chinatown," Stallman would recall nostalgically, 15 years after the fact in a speech at the Swedish Royal Technical Institute. "It was actually a very beautiful thing to see a sunrise, 'cause that's such a calm time of day. It's a wonderful time of day to get ready to go to bed. It's so nice to walk home with the light just brightening and the birds starting to chirp; you can get a real feeling of gentle satisfaction, of tranquility about the work that you have done that night."~{ See Richard Stallman, "RMS lecture at KTH (Sweden)," (October 30, 1986). \\ http://www.gnu.org/philosophy/stallman-kth.html }~
+={Swedish Royal Technical Institute}
+
+The more Stallman hung out with the hackers, the more he adopted the hacker worldview. Already committed to the notion of personal liberty, Stallman began to infuse his actions with a sense of communal responsibility. When others violated the communal code, Stallman was quick to speak out. Within a year of his first visit, Stallman was the one breaking into locked offices, trying to recover the sequestered terminals that belonged to the lab community as a whole. In true hacker fashion, Stallman also sought to make his own personal contribution to the art of lock hacking. One of the most artful door-opening tricks, commonly attributed to Greenblatt, involved bending a stiff wire into a cane and attaching a loop of tape to the long end. Sliding the wire under the door, a hacker could twist and rotate the wire so that the long end touched the door knob. Provided the adhesive on the tape held, a hacker could open the doorknob with a few sharp twists.
+={Greenblat, Richard:lock-hacking and}
+
+When Stallman tried the trick, he found it good but wanting in a few places. Getting the tape to stick wasn't always easy, and twisting the wire in a way that turned the doorknob was similarly difficult. Stallman remembered that the hallway ceiling possessed tiles that could be slid away. Some hackers, in fact, had used the false ceiling as a way to get around locked doors, an approach that generally covered the perpetrator in fiberglass but got the job done.
+
+Stallman considered an alternative approach. What if, instead of slipping a wire under the door, a hacker slid away one of the panels and stood over the door jamb?
+
+Stallman took it upon himself to try it out. Instead of using a wire, Stallman draped out a long U-shaped loop of magnetic tape, fastening a loop of adhesive tape at the base of the U. Standing over the door jamb, he dangled the tape until it looped under the doorknob. Lifting the tape until the adhesive fastened, he then pulled on the left end of the tape, twisting the doorknob counter-clockwise. Sure enough, the door opened. Stallman had added a new twist to the art of lock hacking.
+
+"Sometimes you had to kick the door after you turned the door knob," says Stallman, recalling the lingering bugginess of the new method. "It took a little bit of balance to pull it off."
+
+Such activities reflected a growing willingness on Stallman's part to speak and act out in defense of political beliefs. The AI Lab's spirit of direct action had proved inspirational enough for Stallman to break out of the timid impotence of his teenage years. Breaking into an office to free a terminal wasn't the same as taking part in a protest march, but it was effective in ways that most protests weren't. It solved the problem at hand.
+
+By the time of his last years at Harvard, Stallman was beginning to apply the whimsical and irreverent lessons of the AI Lab back at school.
+
+"Did he tell you about the snake?" his mother asks at one point during an interview. "He and his dorm mates put a snake up for student election. Apparently it got a considerable number of votes."
+
+Stallman verifies the snake candidacy with a few caveats. The snake was a candidate for election within Currier House, Stallman's dorm, not the campus-wide student council. Stallman does remember the snake attracting a fairly significant number of votes, thanks in large part to the fact that both the snake and its owner both shared the same last name. "People may have voted for it, because they thought they were voting for the owner," Stallman says. "Campaign posters said that the snake was `slithering for' the office. We also said it was an `at large' candidate, since it had climbed into the wall through the ventilating unit a few weeks before and nobody knew where it was."
+
+Running a snake for dorm council was just one of several election-related pranks. In a later election, Stallman and his dorm mates nominated the house master's son. "His platform was mandatory retirement at age seven," Stallman recalls. Such pranks paled in comparison to the fake-candidate pranks on the MIT campus, however. One of the most successful fake-candidate pranks was a cat named Woodstock, which actually managed to outdraw most of the human candidates in a campus-wide election. "They never announced how many votes Woodstock got, and they treated those votes as spoiled ballots," Stallman recalls. "But the large number of spoiled ballots in that election suggested that Woodstock had actually won. A couple of years later, Woodstock was suspiciously run over by a car. Nobody knows if the driver was working for the MIT administration." Stallman says he had nothing to do with Woodstock's candidacy, "but I admired it."~{ In an email shortly after this book went into its final edit cycle, Stallman says he drew political inspiration from the Harvard campus as well. "In my first year of Harvard, in a Chinese History class, I read the story of the first revolt against the Chin dynasty," he says. "The story is not reliable history, but it was very moving." }~
+
+At the AI Lab, Stallman's political activities had a sharper-edged tone. During the 1970s, hackers faced the constant challenge of faculty members and administrators pulling an end-run around ITS and its hacker-friendly design. One of the first attempts came in the mid-1970s, as more and more faculty members began calling for a file security system to protect research data. Most other computer labs had installed such systems during late 1960s, but the AI Lab, through the insistence of Stallman and other hackers, remained a security-free zone.
+={Incompatible Timesharing System (ITS)+1}
+
+For Stallman, the opposition to security was both ethical and practical. On the ethical side, Stallman pointed out that the entire art of hacking relied on intellectual openness and trust. On the practical side, he pointed to the internal structure of ITS being built to foster this spirit of openness, and any attempt to reverse that design required a major overhaul.
+={security (computer), opposition to}
+
+"The hackers who wrote the Incompatible Timesharing System decided that file protection was usually used by a self-styled system manager to get power over everyone else," Stallman would later explain. "They didn't want anyone to be able to get power over them that way, so they didn't implement that kind of a feature. The result was, that whenever something in the system was broken, you could always fix it."~{ See Richard Stallman (1986). }~
+
+Through such vigilance, hackers managed to keep the AI Lab's machines security-free. Over at the nearby MIT Laboratory for Computer Sciences, however, security-minded faculty members won the day. The LCS installed its first password-based system in 1977. Once again, Stallman took it upon himself to correct what he saw as ethical laxity. Gaining access to the software code that controlled the password system, Stallman implanted a software command that sent out a message to any LCS user who attempted to choose a unique password. If a user entered "starfish," for example, the message came back something like:
+={password-based systems, hacking into+5}
+
+_1 I see you chose the password "starfish." I suggest that you switch to the password "carriage return." It's much easier to type, and also it stands up to the principle that there should be no passwords.~{ See Steven Levy, Hackers (Penguin USA [paperback], 1984): 417. I have modified this quote, which Levy also uses as an excerpt, to illustrate more directly how the program might reveal the false security of the system. Levy uses the placeholder "[such and such]." }~
+
+Users who did enter "carriage return"-that is, users who simply pressed the Enter or Return button, entering a blank string instead of a unique password-left their accounts accessible to the world at large. As scary as that might have been for some users, it reinforced the hacker notion that Institute computers, and even Institute computer files, belonged to the public, not private individuals. Stallman, speaking in an interview for the 1984 book Hackers, proudly noted that one-fifth of the LCS staff accepted this argument and employed the blank-string password.~{ See Steven Levy, Hackers (Penguin USA [paperback], 1984): 417. }~
+={Hackers (Levy)}
+
+Stallman's null-string crusade would prove ultimately futile. By the early 1980s, even the AI Lab's machines were sporting password-based security systems. Even so, it represents a major milestone in terms of Stallman's personal and political maturation. To the objective observer familiar with Stallman's later career, it offers a convenient inflection point between the timid teenager afraid to speak out even on issues of life-threatening importance and the adult activist who would soon turn needling and cajoling into a full-time occupation.
+
+In voicing his opposition to computer security, Stallman drew on many of the forces that had shaped his early life: hunger for knowledge, distaste for authority, and frustration over hidden procedures and rules that rendered some people clueless outcasts. He would also draw on the ethical concepts that would shape his adult life: communal responsibility, trust, and the hacker spirit of direct action. Expressed in software-computing terms, the null string represents the 1.0 version of the Richard Stallman political worldview-incomplete in a few places but, for the most part, fully mature.
+={computer security, opposition to}
+
+Looking back, Stallman hesitates to impart too much significance to an event so early in his hacking career. "In that early stage there were a lot of people who shared my feelings," he says. "The large number of people who adopted the null string as their password was a sign that many people agreed that it was the proper thing to do. I was simply inclined to be an activist about it."
+
+Stallman does credit the AI Lab for awakening that activist spirit, however. As a teenager, Stallman had observed political events with little idea as to how a single individual could do or say anything of importance. As a young adult, Stallman was speaking out on matters in which he felt supremely confident, matters such as software design, communal responsibility, and individual freedom. "I joined this community which had a way of life which involved respecting each other's freedom," he says. "It didn't take me long to figure out that that was a good thing. It took me longer to come to the conclusion that this was a moral issue."
+
+Hacking at the AI Lab wasn't the only activity helping to boost Stallman's esteem. During the middle of his sophomore year at Harvard, Stallman had joined up with a dance troupe that specialized in folk dances . What began as a simple attempt to meet women and expand his social horizons soon expanded into yet another passion alongside hacking. Dancing in front of audiences dressed in the native garb of a Balkan peasant, Stallman no longer felt like the awkward, uncoordinated 10-year-old whose attempts to play football had ended in frustration. He felt confident, agile, and alive. For a brief moment, he even felt a hint of emotional connection. He soon found being in front of an audience fun, and it wasn't long thereafter that he began craving the performance side of dancing almost as much as the social side.
+={folk dancing;Stallman, Richard M.:folk dancing}
+
+Although the dancing and hacking did little to improve Stallman's social standing, they helped him overcome the feelings of weirdness that had clouded his pre-Harvard life. Instead of lamenting his weird nature, Stallman found ways to celebrate it. In 1977, while attending a science-fiction convention, he came across a woman selling custom-made buttons. Excited, Stallman ordered a button with the words "Impeach God" emblazoned on it.
+
+For Stallman, the "Impeach God" message worked on many levels. An atheist since early childhood, Stallman first saw it as an attempt to set a "second front" in the ongoing debate on religion. "Back then everybody was arguing about God being dead or alive," Stallman recalls. "`Impeach God' approached the subject of God from a completely different viewpoint. If God was so powerful as to create the world and yet do nothing to correct the problems in it, why would we ever want to worship such a God? Wouldn't it be better to put him on trial?"
+
+At the same time, "Impeach God" was a satirical take on America and the American political system. The Watergate scandal of the 1970s affected Stallman deeply. As a child, Stallman had grown up mistrusting authority. Now, as an adult, his mistrust had been solidified by the culture of the AI Lab hacker community. To the hackers, Watergate was merely a Shakespearean rendition of the daily power struggles that made life such a hassle for those without privilege. It was an outsized parable for what happened when people traded liberty and openness for security and convenience.
+
+Buoyed by growing confidence, Stallman wore the button proudly. People curious enough to ask him about it received the same well-prepared spiel. "My name is Jehovah," Stallman would say. "I have a special plan to save the universe, but because of heavenly security reasons I can't tell you what that plan is. You're just going to have to put your faith in me, because I see the picture and you don't. You know I'm good because I told you so. If you don't believe me, I'll throw you on my enemies list and throw you in a pit where Infernal Revenue Service will audit your taxes for eternity."
+
+Those who interpreted the spiel as a word-for-word parody of the Watergate hearings only got half the message. For Stallman, the other half of the message was something only his fellow hackers seemed to be hearing. One hundred years after Lord Acton warned about absolute power corrupting absolutely, Americans seemed to have forgotten the first part of Acton's truism: power, itself, corrupts. Rather than point out the numerous examples of petty corruption, Stallman felt content voicing his outrage toward an entire system that trusted power in the first place.
+
+"I figured why stop with the small fry," says Stallman, recalling the button and its message. "If we went after Nixon, why not going after Mr. Big. The way I see it, any being that has power and abuses it deserves to have that power taken away."
+
+1~ Chapter 5 - Small Puddle of Freedom
+
+Ask anyone who's spent more than a minute in Richard Stallman's presence, and you'll get the same recollection: forget the long hair. Forget the quirky demeanor. The first thing you notice is the gaze. One look into Stallman's green eyes, and you know you're in the presence of a true believer.
+
+To call the Stallman gaze intense is an understatement. Stallman's eyes don't just look at you; they look through you. Even when your own eyes momentarily shift away out of simple primate politeness, Stallman's eyes remain locked-in, sizzling away at the side of your head like twin photon beams.
+
+Maybe that's why most writers, when describing Stallman, tend to go for the religious angle. In a 1998 Salon.com article titled "The Saint of Free Software," Andrew Leonard describes Stallman's green eyes as "radiating the power of an Old Testament prophet."~{ See Andrew Leonard, "The Saint of Free Software," Salon.com (August 1998). \\ http://www.salon.com/21st/feature/1998/08/cov_31feature.html }~ A 1999 /{Wired}/ magazine article describes the Stallman beard as "Rasputin-like,"~{ See Leander Kahney, "Linux's Forgotten Man," Wired News (March 5, 1999). \\ http://www.wired.com/news/print/0,1294,18291,00.html }~ while a /{London Guardian}/ profile describes the Stallman smile as the smile of "a disciple seeing Jesus."~{ See "Programmer on moral high ground; Free software is a moral issue for Richard Stallman believes in freedom and free software." London Guardian (November 6, 1999). \\ These are just a small sampling of the religious comparisons. To date, the most extreme comparison has to go to Linus Torvalds, who, in his autobiography-see Linus Torvalds and David Diamond, Just For Fun: The Story of an Accidentaly Revolutionary (HarperCollins Publishers, Inc., 2001): 58-writes "Richard Stallman is the God of Free Software." \\ Honorable mention goes to Larry Lessig, who, in a footnote description of Stallman in his book-see Larry Lessig, The Future of Ideas (Random House, 2001): 270-likens Stallman to Moses: \\ _1 ... as with Moses, it was another leader, Linus Torvalds, who finally carried the movement into the promised land by facilitating the development of the final part of the OS puzzle. Like Moses, too, Stallman is both respected and reviled by allies within the movement. He is [an] unforgiving, and hence for many inspiring, leader of a critically important aspect of modern culture. I have deep respect for the principle and commitment of this extraordinary individual, though I also have great respect for those who are courageous enough to question his thinking and then sustain his wrath. \\ In a final interview with Stallman, I asked him his thoughts about the religious comparisons. "Some people do compare me with an Old Testament prophent, and the reason is Old Testament prophets said certain social practices were wrong. They wouldn't compromise on moral issues. They couldn't be bought off, and they were usually treated with contempt." }~
+={Wired magazine;Leonard, Andrew;London Guardian;Salon.com}
+
+Such analogies serve a purpose, but they ultimately fall short. That's because they fail to take into account the vulnerable side of the Stallman persona. Watch the Stallman gaze for an extended period of time, and you will begin to notice a subtle change. What appears at first to be an attempt to intimidate or hypnotize reveals itself upon second and third viewing as a frustrated attempt to build and maintain contact. If, as Stallman himself has suspected from time to time, his personality is the product of autism or Asperger Syndrome, his eyes certainly confirm the diagnosis. Even at their most high-beam level of intensity, they have a tendency to grow cloudy and distant, like the eyes of a wounded animal preparing to give up the ghost.
+={Asperger Syndrome;autism}
+
+My own first encounter with the legendary Stallman gaze dates back to the March, 1999, LinuxWorld Convention and Expo in San Jose, California. Billed as a "coming out party" for the Linux software community, the convention also stands out as the event that reintroduced Stallman to the technology media. Determined to push for his proper share of credit, Stallman used the event to instruct spectators and reporters alike on the history of the GNU Project and the project's overt political objectives.
+={GNU Project:GNOME 1.0+1;Linux+6;LinuxWorld+8}
+
+As a reporter sent to cover the event, I received my own Stallman tutorial during a press conference announcing the release of GNOME 1.0, a free software graphic user interface. Unwittingly, I push an entire bank of hot buttons when I throw out my very first question to Stallman himself: do you think GNOME's maturity will affect the commercial popularity of the Linux operating system?
+={GNOME 1.0}
+
+"I ask that you please stop calling the operating system Linux," Stallman responds, eyes immediately zeroing in on mine. "The Linux kernel is just a small part of the operating system. Many of the software programs that make up the operating system you call Linux were not developed by Linus Torvalds at all. They were created by GNU Project volunteers, putting in their own personal time so that users might have a free operating system like the one we have today. To not acknowledge the contribution of those programmers is both impolite and a misrepresentation of history. That's why I ask that when you refer to the operating system, please call it by its proper name, GNU/Linux."
+={GNU Project:Linux and|kernel;Torvalds, Linus+3}
+
+% GNU Project linus/kernel index ref added
+
+Taking the words down in my reporter's notebook, I notice an eerie silence in the crowded room. When I finally look up, I find Stallman's unblinking eyes waiting for me. Timidly, a second reporter throws out a question, making sure to use the term " GNU/Linux" instead of Linux. Miguel de Icaza, leader of the GNOME project, fields the question. It isn't until halfway through de Icaza's answer, however, that Stallman's eyes finally unlock from mine. As soon as they do, a mild shiver rolls down my back. When Stallman starts lecturing another reporter over a perceived error in diction, I feel a guilty tinge of relief. At least he isn't looking at me, I tell myself.
+={de Icaza, Miguel;GNU/Linux}
+
+For Stallman, such face-to-face moments would serve their purpose. By the end of the first LinuxWorld show, most reporters know better than to use the term "Linux" in his presence, and wired.com is running a story comparing Stallman to a pre-Stalinist revolutionary erased from the history books by hackers and entrepreneurs eager to downplay the GNU Project's overly political objectives. ^24^ Other articles follow, and while few reporters call the operating system GNU/Linux in print, most are quick to credit Stallman for launching the drive to build a free software operating system 15 years before.
+
+I won't meet Stallman again for another 17 months. During the interim, Stallman will revisit Silicon Valley once more for the August, 1999 LinuxWorld show. Although not invited to speak, Stallman does managed to deliver the event's best line. Accepting the show's Linus Torvalds Award for Community Service-an award named after Linux creator Linus Torvalds-on behalf of the Free Software Foundation, Stallman wisecracks, "Giving the Linus Torvalds Award to the Free Software Foundation is a bit like giving the Han Solo Award to the Rebel Alliance."
+
+This time around, however, the comments fail to make much of a media dent. Midway through the week, Red Hat, Inc., a prominent GNU/Linux vendor, goes public. The news merely confirms what many reporters such as myself already suspect: "Linux" has become a Wall Street buzzword, much like "e-commerce" and "dot-com" before it. With the stock market approaching the Y2K rollover like a hyperbola approaching its vertical asymptote, all talk of free software or open source as a political phenomenon falls by the wayside.
+={Red Hat Inc.:going public}
+
+% Red Hat added
+
+Maybe that's why, when LinuxWorld follows up its first two shows with a third LinuxWorld show in August, 2000, Stallman is conspicuously absent.
+
+My second encounter with Stallman and his trademark gaze comes shortly after that third LinuxWorld show. Hearing that Stallman is going to be in Silicon Valley, I set up a lunch interview in Palo Alto, California. The meeting place seems ironic, not only because of the recent no-show but also because of the overall backdrop. Outside of Redmond, Washington, few cities offer a more direct testament to the economic value of proprietary software. Curious to see how Stallman, a man who has spent the better part of his life railing against our culture's predilection toward greed and selfishness, is coping in a city where even garage-sized bungalows run in the half-million-dollar price range, I make the drive down from Oakland.
+={Redmond (Washington);Palo Alto (California);Silicon Valley+1}
+
+I follow the directions Stallman has given me, until I reach the headquarters of Art.net, a nonprofit "virtual artists collective." Located in a hedge-shrouded house in the northern corner of the city, the Art.net headquarters are refreshingly run-down. Suddenly, the idea of Stallman lurking in the heart of Silicon Valley doesn't seem so strange after all.
+={Art.net}
+
+I find Stallman sitting in a darkened room, tapping away on his gray laptop computer. He looks up as soon as I enter the room, giving me a full blast of his 200-watt gaze. When he offers a soothing "Hello," I offer a return greeting. Before the words come out, however, his eyes have already shifted back to the laptop screen.
+
+"I'm just finishing an article on the spirit of hacking," Stallman says, fingers still tapping. "Take a look."
+
+I take a look. The room is dimly lit, and the text appears as greenish-white letters on a black background, a reversal of the color scheme used by most desktop word-processing programs, so it takes my eyes a moment to adjust. When they do, I find myself reading Stallman's account of a recent meal at a Korean restaurant. Before the meal, Stallman makes an interesting discovery: the person setting the table has left six chopsticks instead of the usual two in front of Stallman's place setting. Where most restaurant goers would have ignored the redundant pairs, Stallman takes it as challenge: find a way to use all six chopsticks at once. Like many software hacks, the successful solution is both clever and silly at the same time. Hence Stallman's decision to use it as an illustration.
+
+As I read the story, I feel Stallman watching me intently. I look over to notice a proud but child-like half smile on his face. When I praise the essay, my comment barely merits a raised eyebrow.
+
+"I'll be ready to go in a moment," he says.
+
+Stallman goes back to tapping away at his laptop. The laptop is gray and boxy, not like the sleek, modern laptops that seemed to be a programmer favorite at the recent LinuxWorld show. Above the keyboard rides a smaller, lighter keyboard, a testament to Stallman's aging hands. During the late 1980s, when Stallman was putting in 70- and 80-hour work weeks writing the first free software tools and programs for the GNU Project, the pain in Stallman's hands became so unbearable that he had to hire a typist. Today, Stallman relies on a keyboard whose keys require less pressure than a typical computer keyboard.
+
+Stallman has a tendency to block out all external stimuli while working. Watching his eyes lock onto the screen and his fingers dance, one quickly gets the sense of two old friends locked in deep conversation.
+
+The session ends with a few loud keystrokes and the slow disassembly of the laptop.
+
+"Ready for lunch?" Stallman asks.
+
+We walk to my car. Pleading a sore ankle, Stallman limps along slowly. Stallman blames the injury on a tendon in his left foot. The injury is three years old and has gotten so bad that Stallman, a huge fan of folk dancing, has been forced to give up all dancing activities. "I love folk dancing inherently," Stallman laments. "Not being able to dance has been a tragedy for me."
+={folk dancing;Stallman, Richard M.:folk dancing}
+
+Stallman's body bears witness to the tragedy. Lack of exercise has left Stallman with swollen cheeks and a pot belly that was much less visible the year before. You can tell the weight gain has been dramatic, because when Stallman walks, he arches his back like a pregnant woman trying to accommodate an unfamiliar load.
+
+The walk is further slowed by Stallman's willingness to stop and smell the roses, literally. Spotting a particularly beautiful blossom, he tickles the innermost petals with his prodigious nose, takes a deep sniff and steps back with a contented sigh.
+
+"Mmm, rhinophytophilia,"~{ At the time, I thought Stallman was referring to the flower's scientific name. Months later, I would learn that rhinophytophilia was in fact a humorous reference to the activity, i.e., Stallman sticking his nose into a flower and enjoying the moment. For another humorous Stallman flower incident, visit: \\ http://www.stallman.org/texas.html }~ he says, rubbing his back.
+
+The drive to the restaurant takes less than three minutes. Upon recommendation from Tim Ney, former executive director of the Free Software Foundation, I have let Stallman choose the restaurant. While some reporters zero in on Stallman's monk-like lifestyle, the truth is, Stallman is a committed epicure when it comes to food. One of the fringe benefits of being a traveling missionary for the free software cause is the ability to sample delicious food from around the world. "Visit almost any major city in the world, and chances are Richard knows the best restaurant in town," says Ney. "Richard also takes great pride in knowing what's on the menu and ordering for the entire table."
+={Ney, Tim}
+
+For today's meal, Stallman has chosen a Cantonese-style dim sum restaurant two blocks off University Avenue, Palo Alto's main drag. The choice is partially inspired by Stallman's recent visit to China, including a lecture stop in Guangdong province, in addition to Stallman's personal aversion to spicier Hunanese and Szechuan cuisine. "I'm not a big fan of spicy," Stallman admits.
+
+We arrive a few minutes after 11 a.m. and find ourselves already subject to a 20-minute wait. Given the hacker aversion to lost time, I hold my breath momentarily, fearing an outburst. Stallman, contrary to expectations, takes the news in stride.
+
+"It's too bad we couldn't have found somebody else to join us," he tells me. "It's always more fun to eat with a group of people."
+
+During the wait, Stallman practices a few dance steps. His moves are tentative but skilled. We discuss current events. Stallman says his only regret about not attending LinuxWorld was missing out on a press conference announcing the launch of the GNOME Foundation. Backed by Sun Microsystems and IBM, the foundation is in many ways a vindication for Stallman, who has long championed that free software and free-market economics need not be mutually exclusive. Nevertheless, Stallman remains dissatisfied by the message that came out.
+
+"The way it was presented, the companies were talking about Linux with no mention of the GNU Project at all," Stallman says.
+={GNU Project:Linux and;Linux:GNU Project and}
+
+Such disappointments merely contrast the warm response coming from overseas, especially Asia, Stallman notes. A quick glance at the Stallman 2000 travel itinerary bespeaks the growing popularity of the free software message. Between recent visits to India, China, and Brazil, Stallman has spent 12 of the last 115 days on United States soil. His travels have given him an opportunity to see how the free software concept translates into different languages of cultures.
+
+"In India many people are interested in free software, because they see it as a way to build their computing infrastructure without spending a lot of money," Stallman says. "In China, the concept has been much slower to catch on. Comparing free software to free speech is harder to do when you don't have any free speech. Still, the level of interest in free software during my last visit was profound."
+
+The conversation shifts to Napster, the San Mateo, California software company, which has become something of a media cause cÈlËbre in recent months. The company markets a controversial software tool that lets music fans browse and copy the music files of other music fans. Thanks to the magnifying powers of the Internet, this so-called "peer-to-peer" program has evolved into a de facto online juke box, giving ordinary music fans a way to listen to MP3 music files over the computer without paying a royalty or fee, much to record companies' chagrin.
+={Napster+4;San Mateo (California)+2}
+
+Although based on proprietary software, the Napster system draws inspiration from the long-held Stallman contention that once a work enters the digital realm-in other words, once making a copy is less a matter of duplicating sounds or duplicating atoms and more a matter of duplicating information-the natural human impulse to share a work becomes harder to restrict. Rather than impose additional restrictions, Napster execs have decided to take advantage of the impulse. Giving music listeners a central place to trade music files, the company has gambled on its ability to steer the resulting user traffic toward other commercial opportunities.
+
+The sudden success of the Napster model has put the fear in traditional record companies, with good reason. Just days before my Palo Alto meeting with Stallman, U.S. District Court Judge Marilyn Patel granted a request filed by the Recording Industry Association of America for an injunction against the file-sharing service. The injunction was subsequently suspended by the U.S. Ninth District Court of Appeals, but by early 2001, the Court of Appeals, too, would find the San Mateo-based company in breach of copyright law,~{ See Cecily Barnes and Scott Ard, "Court Grants Stay of Napster Injunction," News.com (July 28, 2000). \\ http://news.cnet.com/news/0-1005-200-2376465.html }~ a decision RIAA spokesperson Hillary Rosen would later proclaim proclaim a "clear victory for the creative content community and the legitimate online marketplace."~{ See "A Clear Victory for Recording Industry in Napster Case," RIAA press release (February 12, 2001). \\ http://www.riaa.com/PR_story.cfm?id=372 }~
+
+For hackers such as Stallman, the Napster business model is scary in different ways. The company's eagerness to appropriate time-worn hacker principles such as file sharing and communal information ownership, while at the same time selling a service based on proprietary software, sends a distressing mixed message. As a person who already has a hard enough time getting his own carefully articulated message into the media stream, Stallman is understandably reticent when it comes to speaking out about the company. Still, Stallman does admit to learning a thing or two from the social side of the Napster phenomenon.
+
+"Before Napster, I thought it might be OK for people to privately redistribute works of entertainment," Stallman says. "The number of people who find Napster useful, however, tells me that the right to redistribute copies not only on a neighbor-to-neighbor basis, but to the public at large, is essential and therefore may not be taken away."
+
+No sooner does Stallman say this than the door to the restaurant swings open and we are invited back inside by the host. Within a few seconds, we are seated in a side corner of the restaurant next to a large mirrored wall.
+
+The restaurant's menu doubles as an order form, and Stallman is quickly checking off boxes before the host has even brought water to the table. "Deep-fried shrimp roll wrapped in bean-curd skin," Stallman reads. "Bean-curd skin. It offers such an interesting texture. I think we should get it."
+
+This comment leads to an impromptu discussion of Chinese food and Stallman's recent visit to China. "The food in China is utterly exquisite," Stallman says, his voice gaining an edge of emotion for the first time this morning. "So many different things that I've never seen in the U.S., local things made from local mushrooms and local vegetables. It got to the point where I started keeping a journal just to keep track of every wonderful meal."
+
+The conversation segues into a discussion of Korean cuisine. During the same June, 2000, Asian tour, Stallman paid a visit to South Korea. His arrival ignited a mini-firestorm in the local media thanks to a Korean software conference attended by Microsoft founder and chairman Bill Gates that same week. Next to getting his photo above Gates's photo on the front page of the top Seoul newspaper, Stallman says the best thing about the trip was the food. "I had a bowl of naeng myun, which is cold noodles," says Stallman. "These were a very interesting feeling noodle. Most places don't use quite the same kind of noodles for your naeng myun, so I can say with complete certainty that this was the most exquisite naeng myun I ever had."
+={Gates, Bill;South Korea}
+
+The term "exquisite" is high praise coming from Stallman. I know this, because a few moments after listening to Stallman rhapsodize about naeng myun, I feel his laser-beam eyes singeing the top of my right shoulder.
+
+"There is the most exquisite woman sitting just behind you," Stallman says.
+
+I turn to look, catching a glimpse of a woman's back. The woman is young, somewhere in her mid-20s, and is wearing a white sequinned dress. She and her male lunch companion are in the final stages of paying the check. When both get up from the table to leave the restaurant, I can tell without looking, because Stallman's eyes suddenly dim in intensity.
+
+"Oh, no," he says. "They're gone. And to think, I'll probably never even get to see her again."
+
+After a brief sigh, Stallman recovers. The moment gives me a chance to discuss Stallman's reputation vis-ý-vis the fairer sex. The reputation is a bit contradictory at times. A number of hackers report Stallman's predilection for greeting females with a kiss on the back of the hand.~{ See Mae Ling Mak, "Mae Ling's Story" (December 17, 1998). \\ http://www.crackmonkey.org/pipermail/crackmonkey/1998q4/003006.htm \\ So far, Mak is the only person I've found willing to speak on the record in regard to this practice, although I've heard this from a few other female sources. Mak, despite expressing initial revulsion at it, later managed to put aside her misgivings and dance with Stallman at a 1999 LinuxWorld show. \\ http://www.linux.com/interact/potd.phtml?potd_id=44 }~ A May 26, 2000 Salon.com article, meanwhile, portrays Stallman as a bit of a hacker lothario. Documenting the free software-free love connection, reporter Annalee Newitz presents Stallman as rejecting traditional family values, telling her, "I believe in love, but not monogamy."~{ See Annalee Newitz, "If Code is Free Why Not Me?" Salon.com (May 26, 2000). \\ http://www.salon.com/tech/feature/2000/05/26/free_love/print.html }~
+={Newitz, Annalee;Salon.com}
+
+Stallman lets his menu drop a little when I bring this up. "Well, most men seem to want sex and seem to have a rather contemptuous attitude towards women," he says. "Even women they're involved with. I can't understand it at all."
+
+I mention a passage from the 1999 book Open Sources in which Stallman confesses to wanting to name the ill-fated GNU kernel after a girlfriend at the time. The girlfriend's name was Alix, a name that fit perfectly with the Unix developer convention of putting an "x" at the end of any new kernel name-e.g., "Linux." Because the woman was a Unix system administrator, Stallman says it would have been an even more touching tribute. Unfortunately, Stallman notes, the kernel project's eventual main developer renamed the kernel HURD.~{ See Richard Stallman, "The GNU Operating System and the Free Software Movement," Open Sources (O'Reilly & Associates, Inc., 1999): 65. }~ Although Stallman and the girlfriend later broke up, the story triggers an automatic question: for all the media imagery depicting him as a wild-eyed fanatic, is Richard Stallman really just a hopeless romantic, a wandering Quixote tilting at corporate windmills in an effort to impress some as-yet-unidentified Dulcinea?
+={HURD kernel;Open Sources (DiBona, et al)}
+
+"I wasn't really trying to be romantic," Stallman says, recalling the Alix story. "It was more of a teasing thing. I mean, it was romantic, but it was also teasing, you know? It would have been a delightful surprise."
+
+For the first time all morning, Stallman smiles. I bring up the hand kissing. "Yes, I do do that," Stallman says. "I've found it's a way of offering some affection that a lot of women will enjoy. It's a chance to give some affection and to be appreciated for it."
+
+Affection is a thread that runs clear through Richard Stallman's life, and he is painfully candid about it when questions arise. "There really hasn't been much affection in my life, except in my mind," he says. Still, the discussion quickly grows awkward. After a few one-word replies, Stallman finally lifts up his menu, cutting off the inquiry.
+
+"Would you like some shimai?" he asks.
+
+When the food comes out, the conversation slaloms between the arriving courses. We discuss the oft-noted hacker affection for Chinese food, the weekly dinner runs into Boston's Chinatown district during Stallman's days as a staff programmer at the AI Lab, and the underlying logic of the Chinese language and its associated writing system. Each thrust on my part elicits a well-informed parry on Stallman's part.
+
+"I heard some people speaking Shanghainese the last time I was in China," Stallman says. "It was interesting to hear. It sounded quite different [from Mandarin]. I had them tell me some cognate words in Mandarin and Shanghainese. In some cases you can see the resemblance, but one question I was wondering about was whether tones would be similar. They're not. That's interesting to me, because there's a theory that the tones evolved from additional syllables that got lost and replaced. Their effect survives in the tone. If that's true, and I've seen claims that that happened within historic times, the dialects must have diverged before the loss of these final syllables."
+
+The first dish, a plate of pan-fried turnip cakes, has arrived. Both Stallman and I take a moment to carve up the large rectangular cakes, which smell like boiled cabbage but taste like potato latkes fried in bacon.
+
+I decide to bring up the outcast issue again, wondering if Stallman's teenage years conditioned him to take unpopular stands, most notably his uphill battle since 1994 to get computer users and the media to replace the popular term "Linux" with "GNU/Linux."
+
+"I believe it did help me," Stallman says, chewing on a dumpling. "I have never understood what peer pressure does to other people. I think the reason is that I was so hopelessly rejected that for me, there wasn't anything to gain by trying to follow any of the fads. It wouldn't have made any difference. I'd still be just as rejected, so I didn't try."
+
+Stallman points to his taste in music as a key example of his contrarian tendencies. As a teenager, when most of his high school classmates were listening to Motown and acid rock, Stallman preferred classical music. The memory leads to a rare humorous episode from Stallman's middle-school years. Following the Beatles' 1964 appearance on the Ed Sullivan Show, most of Stallman's classmates rushed out to purchase the latest Beatles albums and singles. Right then and there, Stallman says, he made a decision to boycott the Fab Four.
+={Beatles+2;music+4}
+
+"I liked some of the pre-Beatles popular music," Stallman says. "But I didn't like the Beatles. I especially disliked the wild way people reacted to them. It was like: who was going to have a Beatles assembly to adulate the Beatles the most?"
+
+When his Beatles boycott failed to take hold, Stallman looked for other ways to point out the herd-mentality of his peers. Stallman says he briefly considered putting together a rock band himself dedicated to satirizing the Liverpool group.
+
+"I wanted to call it Tokyo Rose and the Japanese Beetles."
+
+Given his current love for international folk music, I ask Stallman if he had a similar affinity for Bob Dylan and the other folk musicians of the early 1960s. Stallman shakes his head. "I did like Peter, Paul and Mary," he says. "That reminds me of a great filk."
+={Dylan, Bob;Peter, Paul and Mary}
+
+When I ask for a definition of "filk," Stallman explains the concept. A filk, he says, is a popular song whose lyrics have been replaced with parody lyrics. The process of writing a filk is called filking, and it is a popular activity among hackers and science-fiction aficionados. Classic filks include "On Top of Spaghetti," a rewrite of "On Top of Old Smokey," and "Yoda," filk-master "Weird" Al Yankovic's Star Wars-oriented rendition of the Kinks tune, "Lola."
+
+Stallman asks me if I would be interested in hearing the folk filk. As soon as I say yes, Stallman's voice begins singing in an unexpectedly clear tone:
+
+_1 How much wood could a woodchuck chuck,If a woodchuck could chuck wood? How many poles could a polak lock,If a polak could lock poles? How many knees could a negro grow, If a negro could grow knees? The answer, my dear, is stick it in your ear.The answer is to stick it in your ear.
+
+The singing ends, and Stallman's lips curl into another child-like half smile. I glance around at the nearby tables. The Asian families enjoying their Sunday lunch pay little attention to the bearded alto in their midst.~{ For more Stallman filks, visit \\ http://www.stallman.org/doggerel.html. To hear Stallman singing "The Free Software Song," visit \\ http://www.gnu.org/music/free-software-song.html. }~ After a few moments of hesitation, I finally smile too.
+
+"Do you want that last cornball?" Stallman asks, eyes twinkling. Before I can screw up the punch line, Stallman grabs the corn-encrusted dumpling with his two chopsticks and lifts it proudly. "Maybe I'm the one who should get the cornball," he says.
+
+The food gone, our conversation assumes the dynamics of a normal interview. Stallman reclines in his chair and cradles a cup of tea in his hands. We resume talking about Napster and its relation to the free software movement. Should the principles of free software be extended to similar arenas such as music publishing? I ask.
+
+"It's a mistake to transfer answers from one thing to another," says Stallman, contrasting songs with software programs. "The right approach is to look at each type of work and see what conclusion you get."
+
+When it comes to copyrighted works, Stallman says he divides the world into three categories. The first category involves "functional" works-e.g., software programs, dictionaries, and textbooks. The second category involves works that might best be described as "testimonial"-e.g., scientific papers and historical documents. Such works serve a purpose that would be undermined if subsequent readers or authors were free to modify the work at will. The final category involves works of personal expression-e.g., diaries, journals, and autobiographies. To modify such documents would be to alter a person's recollections or point of view-action Stallman considers ethically unjustifiable.
+={copyrighted works, categories of}
+
+Of the three categories, the first should give users the unlimited right to make modified versions, while the second and third should regulate that right according to the will of the original author. Regardless of category, however, the freedom to copy and redistribute noncommercially should remain unabridged at all times, Stallman insists. If that means giving Internet users the right to generate a hundred copies of an article, image, song, or book and then email the copies to a hundred strangers, so be it. "It's clear that private occasional redistribution must be permitted, because only a police state can stop that," Stallman says. "It's antisocial to come between people and their friends. Napster has convinced me that we also need to permit, must permit, even noncommercial redistribution to the public for the fun of it. Because so many people want to do that and find it so useful."
+={Napster}
+
+When I ask whether the courts would accept such a permissive outlook, Stallman cuts me off.
+
+"That's the wrong question," he says. "I mean now you've changed the subject entirely from one of ethics to one of interpreting laws. And those are two totally different questions in the same field. It's useless to jump from one to the other. How the courts would interpret the existing laws is mainly in a harsh way, because that's the way these laws have been bought by publishers."
+
+The comment provides an insight into Stallman's political philosophy: just because the legal system currently backs up businesses' ability to treat copyright as the software equivalent of land title doesn't mean computer users have to play the game according to those rules. Freedom is an ethical issue, not a legal issue. "I'm looking beyond what the existing laws are to what they should be," Stallman says. "I'm not trying to draft legislation. I'm thinking about what should the law do? I consider the law prohibiting the sharing of copies with your friend the moral equivalent of Jim Crow. It does not deserve respect."
+
+The invocation of Jim Crow prompts another question. How much influence or inspiration does Stallman draw from past political leaders? Like the civil-rights movement of the 1950s and 1960s, his attempt to drive social change is based on an appeal to timeless values: freedom, justice, and fair play.
+
+Stallman divides his attention between my analogy and a particularly tangled strand of hair. When I stretch the analogy to the point where I'm comparing Stallman with Dr. Martin Luther King, Jr., Stallman, after breaking off a split end and popping it into his mouth, cuts me off.
+
+% ={King, Dr. Martin Luther, Jr.+3}
+
+"I'm not in his league, but I do play the same game," he says, chewing.
+
+I suggest Malcolm X as another point of comparison. Like the former Nation of Islam spokesperson, Stallman has built up a reputation for courting controversy, alienating potential allies, and preaching a message favoring self-sufficiency over cultural integration.
+
+Chewing on another split end, Stallman rejects the comparison. "My message is closer to King's message," he says. "It's a universal message. It's a message of firm condemnation of certain practices that mistreat others. It's not a message of hatred for anyone. And it's not aimed at a narrow group of people. I invite anyone to value freedom and to have freedom."
+
+Even so, a suspicious attitude toward political alliances remains a fundamental Stallman character trait. In the case of his well-publicized distaste for the term "open source," the unwillingness to participate in recent coalition-building projects seems understandable. As a man who has spent the last two decades stumping on the behalf of free software, Stallman's political capital is deeply invested in the term. Still, comments such as the "Han Solo" wisecrack at the 1999 LinuxWorld have only reinforced the Stallman's reputation in the software industry as a disgrunted mossback unwilling to roll with political or marketing trends.
+
+"I admire and respect Richard for all the work he's done," says Red Hat president Robert Young, summing up Stallman's paradoxical political nature. "My only critique is that sometimes Richard treats his friends worse than his enemies."
+={Young, Robert;Red Hat Inc.}
+
+Stallman's unwillingness to seek alliances seems equally perplexing when you consider his political interests outside of the free software movement. Visit Stallman's offices at MIT, and you instantly find a clearinghouse of left-leaning news articles covering civil-rights abuses around the globe. Visit his web site, and you'll find diatribes on the Digital Millennium Copyright Act, the War on Drugs, and the World Trade Organization.
+={Digital Millennium Copyright Act;War on Drugs;World Trade Organization}
+
+Given his activist tendencies, I ask, why hasn't Stallman sought a larger voice? Why hasn't he used his visibility in the hacker world as a platform to boost rather than reduce his political voice.
+
+Stallman lets his tangled hair drop and contemplates the question for a moment.
+
+"I hesitate to exaggerate the importance of this little puddle of freedom," he says. "Because the more well-known and conventional areas of working for freedom and a better society are tremendously important. I wouldn't say that free software is as important as they are. It's the responsibility I undertook, because it dropped in my lap and I saw a way I could do something about it. But, for example, to end police brutality, to end the war on drugs, to end the kinds of racism we still have, to help everyone have a comfortable life, to protect the rights of people who do abortions, to protect us from theocracy, these are tremendously important issues, far more important than what I do. I just wish I knew how to do something about them."
+
+Once again, Stallman presents his political activity as a function of personal confidence. Given the amount of time it has taken him to develop and hone the free software movement's core tenets, Stallman is hesitant to jump aboard any issues or trends that might transport him into uncharted territory.
+
+"I wish I knew I how to make a major difference on those bigger issues, because I would be tremendously proud if I could, but they're very hard and lots of people who are probably better than I am have been working on them and have gotten only so far," he says. "But as I see it, while other people were defending against these big visible threats, I saw another threat that was unguarded. And so I went to defend against that threat. It may not be as big a threat, but I was the only one there."
+
+Chewing a final split end, Stallman suggests paying the check. Before the waiter can take it away, however, Stallman pulls out a white-colored dollar bill and throws it on the pile. The bill looks so clearly counterfeit, I can't help but pick it up and read it. Sure enough, it is counterfeit. Instead of bearing the image of a George Washington or Abe Lincoln, the bill's front side bears the image of a cartoon pig. Instead of the United States of America, the banner above the pig reads "United Swines of Avarice." The bill is for zero dollars, and when the waiter picks up the money, Stallman makes sure to tug on his sleeve.
+
+"I added an extra zero to your tip," Stallman says, yet another half smile creeping across his lips.
+
+The waiter, uncomprehending or fooled by the look of the bill, smiles and scurries away.
+
+"I think that means we're free to go," Stallman says.
+
+1~ Chapter 6 - The Emacs Commune
+={Emacs Commune+52;Stallman, Richard M.:AI Lab, as a programmer+18;Stallman, Richard M.:Emacs Commune and+52}
+
+The AI Lab of the 1970s was by all accounts a special place. Cutting-edge projects and top-flight researchers gave it an esteemed position in the world of computer science. The internal hacker culture and its anarchic policies lent a rebellious mystique as well. Only later, when many of the lab's scientists and software superstars had departed, would hackers fully realize the unique and ephemeral world they had once inhabited.
+={AI Lab (Artificial Intelligence Laboratory)+17}
+
+"It was a bit like the Garden of Eden," says Stallman, summing up the lab and its software-sharing ethos in a 1998 Forbes article. "It hadn't occurred to us not to cooperate."~{ See Josh McHugh, "For the Love of Hacking," Forbes (August 10, 1998). \\ http://www.forbes.com/forbes/1998/0810/6203094a.html }~
+
+Such mythological descriptions, while extreme, underline an important fact. The ninth floor of 545 Tech Square was more than a workplace for many. For hackers such as Stallman, it was home.
+
+The word "home" is a weighted term in the Stallman lexicon. In a pointed swipe at his parents, Stallman, to this day, refuses to acknowledge any home before Currier House, the dorm he lived in during his days at Harvard. He has also been known to describe leaving that home in tragicomic terms. Once, while describing his years at Harvard, Stallman said his only regret was getting kicked out. It wasn't until I asked Stallman what precipitated his ouster, that I realized I had walked into a classic Stallman setup line.
+={Currier House (Harvard University)}
+
+"At Harvard they have this policy where if you pass too many classes they ask you to leave," Stallman says.
+
+With no dorm and no desire to return to New York, Stallman followed a path blazed by Greenblatt, Gosper, Sussman, and the many other hackers before him. Enrolling at MIT as a grad student, Stallman rented an apartment in nearby Cambridge but soon viewed the AI Lab itself as his de facto home. In a 1986 speech, Stallman recalled his memories of the AI Lab during this period:
+={Gosper, Bill;Greenblat, Richard;Sussman, Gerald}
+
+_1 I may have done a little bit more living at the lab than most people, because every year or two for some reason or other I'd have no apartment and I would spend a few months living at the lab. And I've always found it very comfortable, as well as nice and cool in the summer. But it was not at all uncommon to find people falling asleep at the lab, again because of their enthusiasm; you stay up as long as you possibly can hacking, because you just don't want to stop. And then when you're completely exhausted, you climb over to the nearest soft horizontal surface. A very informal atmosphere.~{ See Stallman (1986). }~
+
+The lab's home-like atmosphere could be a problem at times. What some saw as a dorm, others viewed as an electronic opium den. In the 1976 book Computer Power and Human Reason, MIT researcher Joseph Weizenbaum offered a withering critique of the " computer bum," Weizenbaum's term for the hackers who populated computer rooms such as the AI Lab. "Their rumpled clothes, their unwashed hair and unshaved faces, and their uncombed hair all testify that they are oblivious to their bodies and to the world in which they move," Weizenbaum wrote. "[Computer bums] exist, at least when so engaged, only through and for the computers."~{ See Joseph Weizenbaum, Computer Power and Human Reason: From Judgment to Calculation (W. H. Freeman, 1976): 116. }~
+={computer bums;Computer Power and Human Reason (Weizenbaum);Weizenbaum, Joseph+1}
+
+Almost a quarter century after its publication, Stallman still bristles when hearing Weizenbaum's "computer bum" description, discussing it in the present tense as if Weizenbaum himself was still in the room. "He wants people to be just professionals, doing it for the money and wanting to get away from it and forget about it as soon as possible," Stallman says. "What he sees as a normal state of affairs, I see as a tragedy."
+
+Hacker life, however, was not without tragedy. Stallman characterizes his transition from weekend hacker to full-time AI Lab denizen as a series of painful misfortunes that could only be eased through the euphoria of hacking. As Stallman himself has said, the first misfortune was his graduation from Harvard. Eager to continue his studies in physics, Stallman enrolled as a graduate student at MIT. The choice of schools was a natural one. Not only did it give Stallman the chance to follow the footsteps of great MIT alumni: William Shockley ('36), Richard P. Feynman ('39), and Murray Gell-Mann ('51), it also put him two miles closer to the AI Lab and its new PDP-10 computer. "My attention was going toward programming, but I still thought, well, maybe I can do both," Stallman says.
+={Feynman, Richard;Gell-Mann, Murray;Harvard University:graduation from;Shockley, William}
+
+Toiling in the fields of graduate-level science by day and programming in the monastic confines of the AI Lab by night, Stallman tried to achieve a perfect balance. The fulcrum of this geek teeter-totter was his weekly outing with the folk-dance troupe, his one social outlet that guaranteed at least a modicum of interaction with the opposite sex. Near the end of that first year at MIT, however, disaster struck. A knee injury forced Stallman to drop out of the troupe. At first, Stallman viewed the injury as a temporary problem, devoting the spare time he would have spent dancing to working at the AI Lab even more. By the end of the summer, when the knee still ached and classes reconvened, Stallman began to worry. "My knee wasn't getting any better," Stallman recalls, "which meant I had to stop dancing completely. I was heartbroken."
+
+With no dorm and no dancing, Stallman's social universe imploded. Like an astronaut experiencing the aftereffects of zero-gravity, Stallman found that his ability to interact with nonhackers, especially female nonhackers, had atrophied significantly. After 16 weeks in the AI Lab, the self confidence he'd been quietly accumulating during his 4 years at Harvard was virtually gone.
+
+"I felt basically that I'd lost all my energy," Stallman recalls. "I'd lost my energy to do anything but what was most immediately tempting. The energy to do something else was gone. I was in total despair."
+
+Stallman retreated from the world even further, focusing entirely on his work at the AI Lab. By October, 1975, he dropped out of MIT, never to go back. Software hacking, once a hobby, had become his calling.
+
+Looking back on that period, Stallman sees the transition from full-time student to full-time hacker as inevitable. Sooner or later, he believes, the siren's call of computer hacking would have overpowered his interest in other professional pursuits. "With physics and math, I could never figure out a way to contribute," says Stallman, recalling his struggles prior to the knee injury. "I would have been proud to advance either one of those fields, but I could never see a way to do that. I didn't know where to start. With software, I saw right away how to write things that would run and be useful. The pleasure of that knowledge led me to want to do it more."
+
+Stallman wasn't the first to equate hacking with pleasure. Many of the hackers who staffed the AI Lab boasted similar, incomplete academic rÈsumÈs. Most had come in pursuing degrees in math or electrical engineering only to surrender their academic careers and professional ambitions to the sheer exhilaration that came with solving problems never before addressed. Like St. Thomas Aquinas, the scholastic known for working so long on his theological summae that he sometimes achieved spiritual visions, hackers reached transcendent internal states through sheer mental focus and physical exhaustion. Although Stallman shunned drugs, like most hackers, he enjoyed the "high" that came near the end of a 20-hour coding bender.
+={Thomas Aquinas, saint}
+
+Perhaps the most enjoyable emotion, however, was the sense of personal fulfillment. When it came to hacking, Stallman was a natural. A childhood's worth of late-night study sessions gave him the ability to work long hours with little sleep. As a social outcast since age 10, he had little difficulty working alone. And as a mathematician with built-in gift for logic and foresight, Stallman possessed the ability to circumvent design barriers that left most hackers spinning their wheels.
+
+"He was special," recalls Gerald Sussman, an MIT faculty member and former AI Lab researcher. Describing Stallman as a "clear thinker and a clear designer," Sussman employed Stallman as a research-project assistant beginning in 1975. The project was complex, involving the creation of an AI program that could analyze circuit diagrams. Not only did it involve an expert's command of Lisp, a programming language built specifically for AI applications, but it also required an understanding of how a human might approach the same task.
+={LISP programming language;Sussman, Gerald}
+
+When he wasn't working on official projects such as Sussman's automated circuit-analysis program, Stallman devoted his time to pet projects. It was in a hacker's best interest to improve the lab's software infrastructure, and one of Stallman's biggest pet projects during this period was the lab's editor program TECO.
+={TECO editor program+23}
+
+The story of Stallman's work on TECO during the 1970s is inextricably linked with Stallman's later leadership of the free software movement. It is also a significant stage in the history of computer evolution, so much so that a brief recapitulation of that evolution is necessary. During the 1950s and 1960s, when computers were first appearing at universities, computer programming was an incredibly abstract pursuit. To communicate with the machine, programmers created a series of punch cards, with each card representing an individual software command. Programmers would then hand the cards over to a central system administrator who would then insert them, one by one, into the machine, waiting for the machine to spit out a new set of punch cards, which the programmer would then decipher as output. This process, known as "batch processing," was cumbersome and time consuming. It was also prone to abuses of authority. One of the motivating factors behind hackers' inbred aversion to centralization was the power held by early system operators in dictating which jobs held top priority.
+={batch processing;Free Software Foundation (FSF):TECO text-editor and;punch cards, for batch processing}
+
+% teco and fsf link tenuous
+
+In 1962, computer scientists and hackers involved in MIT's Project MAC, an early forerunner of the AI Lab, took steps to alleviate this frustration. Time-sharing, originally known as "time stealing," made it possible for multiple programs to take advantage of a machine's operational capabilities. Teletype interfaces also made it possible to communicate with a machine not through a series of punched holes but through actual text. A programmer typed in commands and read the line-by-line output generated by the machine.
+={Project MAC;teletype interfaces vs. batch processing+3}
+
+During the late 1960s, interface design made additional leaps. In a famous 1968 lecture, Doug Engelbart, a scientist then working at the Stanford Research Institute, unveiled a prototype of the modern graphical interface. Rigging up a television set to the computer and adding a pointer device which Engelbart dubbed a "mouse," the scientist created a system even more interactive than the time-sharing system developed a MIT. Treating the video display like a high-speed printer, Engelbart's system gave a user the ability to move the cursor around the screen and see the cursor position updated by the computer in real time. The user suddenly had the ability to position text anywhere on the screen.
+={Engelbart, Doug;graphial interfaces;mice, as video pointers;Stanford Research Institute}
+
+Such innovations would take another two decades to make their way into the commercial marketplace. Still, by the 1970s, video screens had started to replace teletypes as display terminals, creating the potential for full-screen-as opposed to line-by-line-editing capabilities.
+={display terminals, replacing teletypes;video screens}
+
+One of the first programs to take advantage of this full-screen capability was the MIT AI Lab's TECO. Short for Text Editor and COrrector, the program had been upgraded by hackers from an old teletype line editor for the lab's PDP-6 machine.~{ According to the Jargon File, TECO's name originally stood for Tape Editor and Corrector. \\ http://www.tuxedo.org/~esr/jargon/html/entry/TECO.html }~
+
+TECO was a substantial improvement over old editors, but it still had its drawbacks. To create and edit a document, a programmer had to enter a series of software commands specifying each edit. It was an abstract process. Unlike modern word processors, which update text with each keystroke, TECO demanded that the user enter an extended series of editing instructions followed by an "end of command" sequence just to change the text.Over time, a hacker grew proficient enough to write entire documents in edit mode, but as Stallman himself would later point out, the process required "a mental skill like that of blindfold chess."~{ See Richard Stallman, "EMACS: The Extensible, Customizable, Display Editor," AI Lab Memo (1979). An updated HTML version of this memo, from which I am quoting, is available at \\ http://www.gnu.org/software/emacs/emacs-paper.html }~
+
+To facilitate the process, AI Lab hackers had built a system that displayed both the "source" and "display" modes on a split screen. Despite this innovative hack, switching from mode to mode was still a nuisance.
+
+TECO wasn't the only full-screen editor floating around the computer world at this time. During a visit to the Stanford Artificial Intelligence Lab in 1976, Stallman encountered an edit program named E. The program contained an internal feature, which allowed a user to update display text after each command keystroke. In the language of 1970s programming, E was one of the first rudimentary WYSIWYG editors. Short for "what you see is what you get," WYSIWYG meant that a user could manipulate the file by moving through the displayed text, as opposed to working through a back-end editor program."~{ See Richard Stallman, "Emacs the Full Screen Editor" (1987). \\ http://www.lysator.liu.se/history/garb/txt/87-1-emacs.txt }~
+={E edit program;Stanford Artificial Intelligence Laboratory}
+
+Impressed by the hack, Stallman looked for ways to expand TECO's functionality in similar fashion upon his return to MIT. He found a TECO feature called Control-R, written by Carl Mikkelson and named after the two-key combination that triggered it. Mikkelson's hack switched TECO from its usual abstract command-execution mode to a more intuitive keystroke-by-keystroke mode. Stallman revised the feature in a subtle but significant way. He made it possible to trigger other TECO command strings, or "macros," using other, two-key combinations. Where users had once entered command strings and discarded them after entering then, Stallman's hack made it possible to save macro tricks on file and call them up at will. Mikkelson's hack had raised TECO to the level of a WYSIWYG editor. Stallman's hack had raised it to the level of a user-programmable WYSIWYG editor. "That was the real breakthrough," says Guy Steele, a fellow AI Lab hacker at the time. ^39^
+={macro modes, adding to TECO+11;Steele, Guy+13}
+
+By Stallman's own recollection, the macro hack touched off an explosion of further innovation. "Everybody and his brother was writing his own collection of redefined screen-editor commands, a command for everything he typically liked to do," Stallman would later recall. "People would pass them around and improve them, making them more powerful and more general. The collections of redefinitions gradually became system programs in their own right." ^39^
+
+So many people found the macro innovations useful and had incorporated it into their own TECO programs that the TECO editor had become secondary to the macro mania it inspired. "We started to categorize it mentally as a programming language rather than as an editor," Stallman says. Users were experiencing their own pleasure tweaking the software and trading new ideas. ^39^
+
+Two years after the explosion, the rate of innovation began to exhibit dangerous side effects. The explosive growth had provided an exciting validation of the collaborative hacker approach, but it had also led to over-complexity. "We had a Tower of Babel effect," says Guy Steele.
+
+The effect threatened to kill the spirit that had created it, Steele says. Hackers had designed ITS to facilitate programmers' ability to share knowledge and improve each other's work. That meant being able to sit down at another programmer's desk, open up a programmer's work and make comments and modifications directly within the software. "Sometimes the easiest way to show somebody how to program or debug something was simply to sit down at the terminal and do it for them," explains Steele.
+
+The macro feature, after its second year, began to foil this capability. In their eagerness to embrace the new full-screen capabilities, hackers had customized their versions of TECO to the point where a hacker sitting down at another hacker's terminal usually had to spend the first hour just figuring out what macro commands did what.
+
+Frustrated, Steele took it upon himself to the solve the problem. He gathered together the four different macro packages and began assembling a chart documenting the most useful macro commands. In the course of implementing the design specified by the chart, Steele says he attracted Stallman's attention.
+
+"He started looking over my shoulder, asking me what I was doing," recalls Steele.
+
+For Steele, a soft-spoken hacker who interacted with Stallman infrequently, the memory still sticks out. Looking over another hacker's shoulder while he worked was a common activity at the AI Lab. Stallman, the TECO maintainer at the lab, deemed Steele's work "interesting" and quickly set off to complete it.
+
+"As I like to say, I did the first 0.001 percent of the implementation, and Stallman did the rest," says Steele with a laugh.
+
+The project's new name, Emacs, came courtesy of Stallman. Short for "editing macros," it signified the evolutionary transcendence that had taken place during the macros explosion two years before. It also took advantage of a gap in the software programming lexicon. Noting a lack of programs on ITS starting with the letter "E," Stallman chose Emacs, making it possible to reference the program with a single letter. Once again, the hacker lust for efficiency had left its mark. ^39^
+={Emacs text editor+11;GNU Emacs+11}
+
+In the course of developing a standard system of macro commands, Stallman and Steele had to traverse a political tightrope. In creating a standard program, Stallman was in clear violation of the fundamental hacker tenet-"promote decentralization." He was also threatening to hobble the very flexibility that had fueled TECO's explosive innovation in the first place.
+
+"On the one hand, we were trying to make a uniform command set again; on the other hand, we wanted to keep it open ended, because the programmability was important," recalls Steele.
+
+To solve the problem, Stallman, Steele, and fellow hackers David Moon and Dan Weinreib limited their standardization effort to the WYSIWYG commands that controlled how text appeared on-screen. The rest of the Emacs effort would be devoted to retaining the program's Tinker Toy-style extensibility.
+
+Stallman now faced another conundrum: if users made changes but didn't communicate those changes back to the rest of the community, the Tower of Babel effect would simply emerge in other places. Falling back on the hacker doctrine of sharing innovation, Stallman embedded a statement within the source code that set the terms of use. Users were free to modify and redistribute the code on the condition that they gave back all the extensions they made. Stallman dubbed it the " Emacs Commune." Just as TECO had become more than a simple editor, Emacs had become more than a simple software program. To Stallman, it was a social contract. In an early memo documenting the project, Stallman spelled out the contract terms. "EMACS," he wrote, "was distributed on a basis of communal sharing, which means that all improvements must be given back to me to be incorporated and distributed."~{ See Stallman (1979): #SEC34. }~
+={Emacs Commune}
+
+Not everybody accepted the contract. The explosive innovation continued throughout the decade, resulting in a host of Emacs-like programs with varying degrees of cross-compatibility. A few cited their relation to Stallman's original Emacs with humorously recursive names: Sine (Sine is not Emacs), Eine (Eine is not Emacs), and Zwei (Zwei was Eine initially). As a devoted exponent of the hacker ethic, Stallman saw no reason to halt this innovation through legal harassment. Still, the fact that some people would so eagerly take software from the community chest, alter it, and slap a new name on the resulting software displayed a stunning lack of courtesy.
+={Eine (Eine is not Emacs) text editor;Zwei (Zwei was Eine initially) text editor;Sine (Sine is not Emacs) text editor}
+
+Such rude behavior was reflected against other, unsettling developments in the hacker community. Brian Reid's 1979 decision to embed "time bombs" in Scribe, making it possible for Unilogic to limit unpaid user access to the software, was a dark omen to Stallman. "He considered it the most Nazi thing he ever saw in his life," recalls Reid. Despite going on to later Internet fame as the cocreator of the Usenet alt heirarchy, Reid says he still has yet to live down that 1979 decision, at least in Stallman's eyes. "He said that all software should be free and the prospect of charging money for software was a crime against humanity."~{ In a 1996 interview with online magazine MEME, Stallman cited Scribe's sale as irksome, but hesitated to mention Reid by name. "The problem was nobody censured or punished this student for what he did," Stallman said. "The result was other people got tempted to follow his example." See MEME 2.04. \\ http://memex.org/meme2-04.html }~
+={Reid, Brian+1;Unilogic software company;time bombs, in software;Scribe text-formatting program}
+
+% additional reference to Unilogic; also time bombs; also scribe text-formatting program
+
+Although Stallman had been powerless to head off Reid's sale, he did possess the ability to curtail other forms of behavior deemed contrary to the hacker ethos. As central source-code maintainer for the Emacs "commune," Stallman began to wield his power for political effect. During his final stages of conflict with the administrators at the Laboratory for Computer Science over password systems, Stallman initiated a software "strike,"~{ See Steven Levy, Hackers (Penguin USA [paperback], 1984): 419. }~ refusing to send lab members the latest version of Emacs until they rejected the security system on the lab's computers. The move did little to improve Stallman's growing reputation as an extremist, but it got the point across: commune members were expected to speak up for basic hacker values.
+={security (computer), opposition to;strike, at the Laboratory for Computer Science}
+
+"A lot of people were angry with me, saying I was trying to hold them hostage or blackmail them, which in a sense I was," Stallman would later tell author Steven Levy. "I was engaging in violence against them because I thought they were engaging in violence to everyone at large." ^42^
+
+Over time, Emacs became a sales tool for the hacker ethic. The flexibility Stallman and built into the software not only encouraged collaboration, it demanded it. Users who didn't keep abreast of the latest developments in Emacs evolution or didn't contribute their contributions back to Stallman ran the risk of missing out on the latest breakthroughs. And the breakthroughs were many. Twenty years later, users had modified Emacs for so many different uses-using it as a spreadsheet, calculator, database, and web browser-that later Emacs developers adopted an overflowing sink to represent its versatile functionality. "That's the idea that we wanted to convey," says Stallman. "The amount of stuff it has contained within it is both wonderful and awful at the same time."
+
+Stallman's AI Lab contemporaries are more charitable. Hal Abelson, an MIT grad student who worked with Stallman during the 1970s and would later assist Stallman as a charter boardmember of the Free Software Foundation, describes Emacs as "an absolutely brilliant creation." In giving programmers a way to add new software libraries and features without messing up the system, Abelson says, Stallman paved the way for future large-scale collaborative software projects. "Its structure was robust enough that you'd have people all over the world who were loosely collaborating [and] contributing to it," Abelson says. "I don't know if that had been done before."~{ In writing this chapter, I've elected to focus more on the social significance of Emacs than the software significance. To read more about the software side, I recommend Stallman's 1979 memo. I particularly recommend the section titled "Research Through Development of Installed Tools" (#SEC27). Not only is it accessible to the nontechnical reader, it also sheds light on how closely intertwined Stallman's political philosophies are with his software-design philosophies. A sample excerpt follows: \\ EMACS could not have been reached by a process of careful design, because such processes arrive only at goals which are visible at the outset, and whose desirability is established on the bottom line at the outset. Neither I nor anyone else visualized an extensible editor until I had made one, nor appreciated its value until he had experienced it. EMACS exists because I felt free to make individually useful small improvements on a path whose end was not in sight. }~
+={Abelson, Hal}
+
+Guy Steele expresses similar admiration. Currently a research scientist for Sun Microsystems, he remembers Stallman primarily as a "brilliant programmer with the ability to generate large quantities of relatively bug-free code." Although their personalities didn't exactly mesh, Steele and Stallman collaborated long enough for Steele to get a glimpse of Stallman's intense coding style. He recalls a notable episode in the late 1970s when the two programmers banded together to write the editor's "pretty print" feature. Originally conceived by Steele, pretty print was another keystroke-triggerd feature that reformatted Emacs' source code so that it was both more readable and took up less space, further bolstering the program's WYSIWIG qualities. The feature was strategic enough to attract Stallman's active interest, and it wasn't long before Steele wrote that he and Stallman were planning an improved version.
+={Steele, Guy+3;Sun Microsystems}
+
+"We sat down one morning," recalls Steele. "I was at the keyboard, and he was at my elbow," says Steele. "He was perfectly willing to let me type, but he was also telling me what to type.
+
+The programming session lasted 10 hours. Throughout that entire time, Steele says, neither he nor Stallman took a break or made any small talk. By the end of the session, they had managed to hack the pretty print source code to just under 100 lines. "My fingers were on the keyboard the whole time," Steele recalls, "but it felt like both of our ideas were flowing onto the screen. He told me what to type, and I typed it."
+
+The length of the session revealed itself when Steele finally left the AI Lab. Standing outside the building at 545 Tech Square, he was surprised to find himself surrounded by nighttime darkness. As a programmer, Steele was used to marathon coding sessions. Still, something about this session was different. Working with Stallman had forced Steele to block out all external stimuli and focus his entire mental energies on the task at hand. Looking back, Steele says he found the Stallman mind-meld both exhilarating and scary at the same time. "My first thought afterward was: it was a great experience, very intense, and that I never wanted to do it again in my life."
+
+1~ Chapter 7 - A Stark Moral Choice
+={Stallman, Richard M.:GNU Project+72}
+
+On September 27, 1983, computer programmers logging on to the Usenet newsgroup net.unix-wizards encountered an unusual message. Posted in the small hours of the morning, 12:30 a.m. to be exact, and signed by rms@mit-oz, the message's subject line was terse but attention-grabbing. "New UNIX implementation," it read. Instead of introducing a newly released version of Unix, however, the message's opening paragraph issued a call to arms:
+={GNU Project:new UNIX implementation;net.unix-wizards newsgroup}
+
+_1 Starting this Thanksgiving I am going to write a complete Unix-compatible software system called GNU (for Gnu's Not Unix), and give it away free to everyone who can use it. Contributions of time, money, programs and equipment are greatly needed.~{ See Richard Stallman, "Initial GNU Announcement" (September 1983). \\ http://www.gnu.ai.mit.edu/gnu/initial-announcement.html }~
+={Unix operating system:GNU system and}
+
+To an experienced Unix developer, the message was a mixture of idealism and hubris. Not only did the author pledge to rebuild the already mature Unix operating system from the ground up, he also proposed to improve it in places. The new GNU system, the author predicted, would carry all the usual components-a text editor, a shell program to run Unix-compatible applications, a compiler, "and a few other things." ^44^ It would also contain many enticing features that other Unix systems didn't yet offer: a graphic user interface based on the Lisp programming language, a crash-proof file system, and networking protocols built according to MIT's internal networking system.
+={LISP programming language:GNU system and}
+
+"GNU will be able to run Unix programs, but will not be identical to Unix," the author wrote. "We will make all improvements that are convenient, based on our experience with other operating systems."
+
+Anticipating a skeptical response on some readers' part, the author made sure to follow up his operating-system outline with a brief biographical sketch titled, "Who am I?":
+
+_1 I am Richard Stallman, inventor of the original much-imitated EMACS editor, now at the Artificial Intelligence Lab at MIT. I have worked extensively on compilers, editors, debuggers, command interpreters, the Incompatible Timesharing System and the Lisp Machine operating system. I pioneered terminal-independent display support in ITS. In addition I have implemented one crashproof file system and two window systems for Lisp machines. ^44^
+
+As fate would have it, Stallman's fanciful GNU Project missed its Thanksgiving launch date. By January, 1984, however, Stallman made good on his promise and fully immersed himself in the world of Unix software development. For a software architect raised on ITS, it was like designing suburban shopping malls instead of Moorish palaces. Even so, building a Unix-like operating system had its hidden advantages. ITS had been powerful, but it also possessed an Achilles' heel: MIT hackers had designed it to take specific advantage of the DEC-built PDP line. When AI Lab administrators elected to phase out the lab's powerful PDP-10 machine in the early 1980s, the operating system that hackers once likened to a vibrant city became an instant ghost town. Unix, on the other hand, was designed for mobility and long-term survival. Originally developed by junior scientists at AT&T, the program had slipped out under corporate-management radar, finding a happy home in the cash-strapped world of academic computer systems. With fewer resources than their MIT brethren, Unix developers had customized the software to ride atop a motley assortment of hardware systems: everything from the 16-bit PDP-11-a machine considered fit for only small tasks by most AI Lab hackers-to 32-bit mainframes such as the VAX 11/780. By 1983, a few companies, most notably Sun Microsystems, were even going so far as to develop a new generation of microcomputers, dubbed "workstations," to take advantage of the increasingly ubiquitous operating system.
+={AT&T;Incompatible Timesharing System (ITS)+5;VAX 11/780;PDP-10 computer;PDP-11 computer;Sun Microsystems:developing workstations}
+
+% original index refers to VAX 11/750 rather than 11/780, check inconsistency
+
+To facilitate this process, the developers in charge of designing the dominant Unix strains made sure to keep an extra layer of abstraction between the software and the machine. Instead of tailoring the operating system to take advantage of a specific machine's resources-as the AI Lab hackers had done with ITS and the PDP-10-Unix developers favored a more generic, off-the-rack approach. Focusing more on the interlocking standards and specifications that held the operating system's many subcomponents together, rather than the actual components themselves, they created a system that could be quickly modified to suit the tastes of any machine. If a user quibbled with a certain portion, the standards made it possible to pull out an individual subcomponent and either fix it or replace it with something better. Simply put, what the Unix approach lacked in terms of style or aesthetics, it more than made up for in terms of flexibility and economy, hence its rapid adoption.~{ See Marshall Kirk McKusick, "Twenty Years of Berkeley Unix," Open Sources (O'Reilly & Associates, Inc., 1999): 38. }~
+={abstraction:designing Unix;Unix operating system:adoption through flexibility}
+
+Stallman's decision to start developing the GNU system was triggered by the end of the ITS system that the AI Lab hackers had nurtured for so long. The demise of ITS had been a traumatic blow to Stallman. Coming on the heels of the Xerox laser printer episode, it offered further evidence that the AI Lab hacker culture was losing its immunity to business practices in the outside world.
+={AI Lab (Artificial Intelligence Laboratory):ITS demise+3}
+
+Like the software code that composed it, the roots of ITS' demise stretched way back. Defense spending, long a major font for computer-science research, had dried up during the post-Vietnam years. In a desperate quest for new funds, laboratories and universities turned to the private sector. In the case of the AI Lab, winning over private investors was an easy sell. Home to some of the most ambitious computer-science projects of the post-war era, the lab became a quick incubator of technology. Indeed, by 1980, most of the lab's staff, including many hackers, were dividing its time between Institute and commercial projects.
+
+What at first seemed like a win-win deal-hackers got to work on the best projects, giving the lab first look at many of the newest computer technologies coming down the pike-soon revealed itself as a Faustian bargain. The more time hackers devoted to cutting-edge commercial projects, the less time they had to devote to general maintenance on the lab's baroque software infrastructure. Soon, companies began hiring away hackers outright in an attempt to monopolize their time and attention. With fewer hackers to mind the shop, programs and machines took longer to fix. Even worse, Stallman says, the lab began to undergo a "demographic change." The hackers who had once formed a vocal minority within the AI Lab were losing membership while "the professors and the students who didn't really love the [PDP-10] were just as numerous as before."3
+={PDP-10 computer+4}
+
+The breaking point came in 1982. That was the year the lab's administration decided to upgrade its main computer, the PDP-10. Digital, the corporation that manufactured the PDP-10, had discontinued the line. Although the company still offered a high-powered mainframe, dubbed the KL-10, the new machine required a drastic rewrite or "port" of ITS if hackers wanted to continue running the same operating system. Fearful that the lab had lost its critical mass of in-house programming talent, AI Lab faculty members pressed for Twenex, a commercial operating system developed by Digital. Outnumbered, the hackers had no choice but to comply.
+={KL-10 mainframe+11;Twenex operating systems+4}
+
+"Without hackers to maintain the system, [faculty members] said, `We're going to have a disaster; we must have commercial software,'" Stallman would recall a few years later. "They said, `We can expect the company to maintain it.' It proved that they were utterly wrong, but that's what they did."~{ See Richard Stallman (1986). }~
+
+At first, hackers viewed the Twenex system as yet another authoritarian symbol begging to be subverted. The system's name itself was a protest. Officially dubbed TOPS-20 by DEC, it was a successor to TOPS-10, a commercial operating system DEC marketed for the PDP-10. Bolt Beranek Newman had deveoped an improved version, dubbed Tenex, which TOPS-20 drew upon.~{ Multiple sources: see Richard Stallman interview, Gerald Sussman email, and Jargon File 3.0.0. \\ http://www.clueless.com/jargon3.0.0/TWENEX.html }~ Stallman, the hacker who coined the Twenex term, says he came up with the name as a way to avoid using the TOPS-20 name. "The system was far from tops, so there was no way I was going to call it that," Stallman recalls. "So I decided to insert a `w' in the Tenex name and call it Twenex."
+={DEC (Digital Equipment Corporation);TOPS-20 operating system+1}
+
+% ={Bolt, Beranek & Newman engineering firm;Tenex}
+
+The machine that ran the Twenex/TOPS-20 system had its own derisive nickname: Oz. According to one hacker legend, the machine got its nickname because it required a smaller PDP-11 machine to power its terminal. One hacker, upon viewing the KL-10-PDP-11 setup for the first time, likened it to the wizard's bombastic onscreen introduction in the Wizard of Oz. "I am the great and powerful Oz," the hacker intoned. "Pay no attention to the PDP-11 behind that console."~{ See http://www.as.cmu.edu/~geek/humor/See_Figure_1.txt }~
+={Oz+8;PDP-11 computer}
+
+If hackers laughed when they first encountered the KL-10, their laughter quickly died when they encountered Twenex. Not only did Twenex boast built-in security, but the system's software engineers had designed the tools and applications with the security system in mind. What once had been a cat-and-mouse game over passwords in the case of the Laboratory for Computer Science's security system, now became an out-and-out battle over system management. System administrators argued that without security, the Oz system was more prone to accidental crashes. Hackers argued that crashes could be better prevented by overhauling the source code. Unfortunately, the number of hackers with the time and inclination to perform this sort of overhaul had dwindled to the point that the system-administrator argument prevailed.
+={security (computer), opposition to:Twenex operating systems and}
+
+Cadging passwords and deliberately crashing the system in order to glean evidence from the resulting wreckage, Stallman successfully foiled the system administrators' attempt to assert control. After one foiled "coup d'etat," Stallman issued an alert to the entire AI staff. ^46^
+
+"There has been another attempt to seize power," Stallman wrote. "So far, the aristocratic forces have been defeated." To protect his identity, Stallman signed the message "Radio Free OZ."
+
+The disguise was a thin one at best. By 1982, Stallman's aversion to passwords and secrecy had become so well known that users outside the AI Laboratory were using his account as a stepping stone to the ARPAnet, the research-funded computer network that would serve as a foundation for today's Internet. One such "tourist" during the early 1980s was Don Hopkins, a California programmer who learned through the hacking grapevine that all an outsider needed to do to gain access to MIT's vaunted ITS system was to log in under the initials RMS and enter the same three-letter monogram when the system requested a password.
+={ARPAnet+2;Hopkins, Don}
+
+"I'm eternally grateful that MIT let me and many other people use their computers for free," says Hopkins. "It meant a lot to many people."
+
+This so-called "tourist" policy, which had been openly tolerated by MIT management during the ITS years,~{ See "MIT AI Lab Tourist Policy." \\ http://catalog.com/hopkins/text/tourist-policy.html }~ fell by the wayside when Oz became the lab's primary link to the ARPAnet. At first, Stallman continued his policy of repeating his login ID as a password so outside users could follow in his footsteps. Over time, however, the Oz's fragility prompted administrators to bar outsiders who, through sheer accident or malicious intent, might bring down the system. When those same administrators eventually demanded that Stallman stop publishing his password, Stallman, citing personal ethics, refused to do so and ceased using the Oz system altogether. ^46^
+
+"[When] passwords first appeared at the MIT AI Lab I [decided] to follow my belief that there should be no passwords," Stallman would later say. "Because I don't believe that it's really desirable to have security on a computer, I shouldn't be willing to help uphold the security regime." ^46^
+
+Stallman's refusal to bow before the great and powerful Oz symbolized the growing tension between hackers and AI Lab management during the early 1980s. This tension paled in comparison to the conflict that raged within the hacker community itself. By the time the KL-10 arrived, the hacker community had already divided into two camps. The first centered around a software company called Symbolics, Inc. The second centered around Symbolics chief rival, Lisp Machines, Inc. (LMI). Both companies were in a race to market the Lisp Machine, a device built to take full advantage of the Lisp programming language.
+={Symbolics+15;LISP programming language+1}
+
+Created by artificial-intelligence research pioneer John McCarthy, a MIT artificial-intelligence researcher during the late 1950s, Lisp is an elegant language well-suited for programs charged with heavy-duty sorting and processing. The language's name is a shortened version of LISt Processing. Following McCarthy's departure to the Stanford Artificial Intelligence Laboratory, MIT hackers refined the language into a local dialect dubbed MACLISP. The "MAC" stood for Project MAC, the DARPA-funded research project that gave birth to the AI Lab and the Laboratory for Computer Science. Led by AI Lab arch-hacker Richard Greenblatt, AI Lab programmers during the 1970s built up an entire Lisp-based operating system, dubbed the Lisp Machine operating system. By 1980, the Lisp Machine project had generated two commercial spin-offs. Symbolics was headed by Russell Noftsker, a former AI Lab administrator, and Lisp Machines, Inc., was headed by Greenblatt.
+={DARPA;Greenblat, Richard;LISP programming language:operating system for+4;MACLISP language;McCarthy, John;Project MAC;Stanford Artificial Intelligence Laboratory}
+
+% Greenblat index ref added; additional Project MAC ref
+
+The Lisp Machine software was hacker-built, meaning it was owned by MIT but available for anyone to copy as per hacker custom. Such a system limited the marketing advantage of any company hoping to license the software from MIT and market it as unique. To secure an advantage, and to bolster the aspects of the operating system that customers might consider attractive, the companies recruited various AI Lab hackers and set them working on various components of the Lisp Machine operating system outside the auspices of the AI Lab.
+
+The most aggressive in this strategy was Symbolics. By the end of 1980, the company had hired 14 AI Lab staffers as part-time consultants to develop its version of the Lisp Machine. Apart from Stallman, the rest signed on to help LMI.~{ See H. P. Newquist, The Brain Makers: Genius, Ego, and Greed in the Quest for Machines that Think (Sams Publishing, 1994): 172. }~
+={AI Lab (Artificial Intelligence Laboratory):Symbolics and+10}
+
+% Symbolics AI Lab longer range marked
+
+At first, Stallman accepted both companies' attempt to commercialize the Lisp machine, even though it meant more work for him. Both licensed the Lisp Machine OS source code from MIT, and it was Stallman's job to update the lab's own Lisp Machine to keep pace with the latest innovations. Although Symbolics' license with MIT gave Stallman the right to review, but not copy, Symbolics' source code, Stallman says a "gentleman's agreement" between Symbolics management and the AI Lab made it possible to borrow attractive snippets in traditional hacker fashion.
+={LISP Machines Inc. (LMI):Symbolics and+13;LMI (LISP Machines Inc.):Symbolics and+13}
+
+On March 16, 1982, a date Stallman remembers well because it was his birthday, Symbolics executives decided to end this gentlemen's agreement. The move was largely strategic. LMI, the primary competition in the Lisp Machine marketplace, was essentially using a copy of the AI Lab Lisp Machine. Rather than subsidize the development of a market rival, Symbolics executives elected to enforce the letter of the license. If the AI Lab wanted its operating system to stay current with the Symbolics operating system, the lab would have to switch over to a Symbolics machine and sever its connection to LMI.
+
+As the person responsible for keeping up the lab's Lisp Machine, Stallman was incensed. Viewing this announcement as an "ultimatum," he retaliated by disconnecting Symbolics' microwave communications link to the laboratory. He then vowed never to work on a Symbolics machine and pledged his immediate allegiance to LMI. "The way I saw it, the AI Lab was a neutral country, like Belgium in World War I," Stallman says. "If Germany invades Belgium, Belgium declares war on Germany and sides with Britain and France."
+
+The circumstances of the so-called "Symbolics War" of 1982-1983 depend heavily on the source doing the telling. When Symbolics executives noticed that their latest features were still appearing in the AI Lab Lisp Machine and, by extension, the LMI Lisp machine, they installed a "spy" program on Stallman's computer terminal. Stallman says he was rewriting the features from scratch, taking advantage of the license's review clause but also taking pains to make the source code as different as possible. Symbolics executives argued otherwise and took their case to MIT administration. According to 1994 book, The Brain Makers: Genius, Ego, and Greed, and the Quest for Machines That Think, written by Harvey Newquist, the administration responded with a warning to Stallman to "stay away" from the Lisp Machine project.~{ Ibid.: 196. }~ According to Stallman, MIT administrators backed Stallman up. "I was never threatened," he says. "I did make changes in my practices, though. Just to be ultra safe, I no longer read their source code. I used only the documentation and wrote the code from that."
+={Brain Makers: Genius, Ego, and Greed in the Quest for Machines that Think, The Newquist;Newquist, Harvey}
+
+Whatever the outcome, the bickering solidified Stallman's resolve. With no source code to review, Stallman filled in the software gaps according to his own tastes and enlisted members of the AI Lab to provide a continuous stream of bug reports. He also made sure LMI programmers had direct access to the changes. "I was going to punish Symbolics if it was the last thing I did," Stallman says.
+
+Such statements are revealing. Not only do they shed light on Stallman's nonpacifist nature, they also reflect the intense level of emotion triggered by the conflict. According to another Newquist-related story, Stallman became so irate at one point that he issued an email threatening to "wrap myself in dynamite and walk into Symbolics' offices."~{ Ibid. Newquist, who says this anecdote was confirmed by several Symbolics executives, writes, "The message caused a brief flurry of excitement and speculation on the part of Symbolics' employees, but ultimately, no one took Stallman's outburst that seriously." }~ Although Stallman would deny any memory of the email and still describes its existence as a "vicious rumor," he acknowledges that such thoughts did enter his head. "I definitely did have fantasies of killing myself and destroying their building in the process," Stallman says. "I thought my life was over." ^48^
+
+The level of despair owed much to what Stallman viewed as the "destruction" of his "home"-i.e., the demise of the AI Lab's close-knit hacker subculture. In a later email interview with Levy, Stallman would liken himself to the historical figure Ishi, the last surviving member of the Yahi, a Pacific Northwest tribe wiped out during the Indian wars of the 1860s and 1870s. The analogy casts Stallman's survival in epic, almost mythical, terms. In reality, however, it glosses over the tension between Stallman and his fellow AI Lab hackers prior to the Symbolics-LMI schism. Instead of seeing Symbolics as an exterminating force, many of Stallman's colleagues saw it as a belated bid for relevance. In commercializing the Lisp Machine, the company pushed hacker principles of engineer-driven software design out of the ivory-tower confines of the AI Lab and into the corporate marketplace where manager-driven design principles held sway. Rather than viewing Stallman as a holdout, many hackers saw him as a troubling anachronism.
+={Ishi;Yahi}
+
+Stallman does not dispute this alternate view of historical events. In fact, he says it was yet another reason for the hostility triggered by the Symbolics "ultimatum." Even before Symbolics hired away most of the AI Lab's hacker staff, Stallman says many of the hackers who later joined Symbolics were shunning him. "I was no longer getting invited to go to Chinatown," Stallman recalls. "The custom started by Greenblatt was that if you went out to dinner, you went around or sent a message asking anybody at the lab if they also wanted to go. Sometime around 1980-1981, I stopped getting asked. They were not only not inviting me, but one person later confessed that he had been pressured to lie to me to keep their going away to dinner without me a secret."
+={Greenblat, Richard}
+
+% Greenblat index ref added
+
+Although Stallman felt anger toward the hackers who orchestrated this petty form of ostracism, the Symbolics controversy dredged up a new kind of anger, the anger of a person about to lose his home. When Symbolics stopped sending over its source-code changes, Stallman responded by holing up in his MIT offices and rewriting each new software feature and tool from scratch. Frustrating as it may have been, it guaranteed that future Lisp Machine users had unfettered access to the same features as Symbolics users.
+
+It also guaranteed Stallman's legendary status within the hacker community. Already renowned for his work with Emacs, Stallman's ability to match the output of an entire team of Symbolics programmers-a team that included more than a few legendary hackers itself-still stands has one of the major human accomplishments of the Information Age, or of any age for that matter. Dubbing it a "master hack" and Stallman himself a "virtual John Henry of computer code," author Steven Levy notes that many of his Symbolics-employed rivals had no choice but to pay their idealistic former comrade grudging respect. Levy quotes Bill Gosper, a hacker who eventually went to work for Symbolics in the company's Palo Alto office, expressing amazement over Stallman's output during this period:
+={Gosper, Bill}
+
+_1 I can see something Stallman wrote, and I might decide it was bad (probably not, but somebody could convince me it was bad), and I would still say, "But wait a minute-Stallman doesn't have anybody to argue with all night over there. He's working alone! It's incredible anyone could do this alone!"~{ See Steven Levy, Hackers (Penguin USA [paperback], 1984): 426. }~
+
+For Stallman, the months spent playing catch up with Symbolics evoke a mixture of pride and profound sadness. As a dyed-in-the-wool liberal whose father had served in World War II, Stallman is no pacifist. In many ways, the Symbolics war offered the rite of passage toward which Stallman had been careening ever since joining the AI Lab staff a decade before. At the same time, however, it coincided with the traumatic destruction of the AI Lab hacker culture that had nurtured Stallman since his teenage years. One day, while taking a break from writing code, Stallman experienced a traumatic moment passing through the lab's equipment room. There, Stallman encountered the hulking, unused frame of the PDP-10 machine. Startled by the dormant lights, lights that once actively blinked out a silent code indicating the status of the internal program, Stallman says the emotional impact was not unlike coming across a beloved family member's well-preserved corpse.
+={PDP-10 computer}
+
+"I started crying right there in the equipment room," he says. "Seeing the machine there, dead, with nobody left to fix it, it all drove home how completely my community had been destroyed."
+
+Stallman would have little opportunity to mourn. The Lisp Machine, despite all the furor it invoked and all the labor that had gone into making it, was merely a sideshow to the large battles in the technology marketplace. The relentless pace of computer miniaturization was bringing in newer, more powerful microprocessors that would soon incorporate the machine's hardware and software capabilities like a modern metropolis swallowing up an ancient desert village.
+
+Riding atop this microprocessor wave were hundreds-thousands-of commercial software programs, each protected by a patchwork of user licenses and nondisclosure agreements that made it impossible for hackers to review or share source code. The licenses were crude and ill-fitting, but by 1983 they had become strong enough to satisfy the courts and scare away would-be interlopers. Software, once a form of garnish most hardware companies gave away to make their expensive computer systems more flavorful, was quickly becoming the main dish. In their increasing hunger for new games and features, users were putting aside the traditional demand to review the recipe after every meal.
+
+Nowhere was this state of affairs more evident than in the realm of personal computer systems. Companies such as Apple Computer and Commodore were minting fresh millionaires selling machines with built-in operating systems. Unaware of the hacker culture and its distaste for binary-only software, many of these users saw little need to protest when these companies failed to attach the accompanying source-code files. A few anarchic adherents of the hacker ethic helped propel that ethic into this new marketplace, but for the most part, the marketplace rewarded the programmers speedy enough to write new programs and savvy enough to copyright them as legally protected works.
+={Apple Computers; Commodore computers;software+10}
+
+One of the most notorious of these programmers was Bill Gates, a Harvard dropout two years Stallman's junior. Although Stallman didn't know it at the time, seven years before sending out his message to the net.unix-wizards newsgroup, Gates, a budding entrepreneur and general partner with the Albuquerque-based software firm Micro-Soft, later spelled as Microsoft, had sent out his own open letter to the software-developer community. Written in response to the PC users copying Micro-Soft's software programs, Gates' " Open Letter to Hobbyists" had excoriated the notion of communal software development.
+={Gates, Bill+2;Micro-Soft;net.unix-wizards newsgroup;Open Letter to Hobbyists (Gates)+1}
+
+"Who can afford to do professional work for nothing?" asked Gates. "What hobbyist can put three man-years into programming, finding all bugs, documenting his product, and distributing it for free?"~{ See Bill Gates, "An Open Letter to Hobbyists" (February 3, 1976). \\ To view an online copy of this letter, go to \\ http://www.blinkenlights.com/classiccmp/gateswhine.html. }~
+
+Although few hackers at the AI Lab saw the missive, Gates' 1976 letter nevertheless represented the changing attitude toward software both among commercial software companies and commercial software developers. Why treat software as a zero-cost commodity when the market said otherwise? As the 1970s gave way to the 1980s, selling software became more than a way to recoup costs; it became a political statement. At a time when the Reagan Administration was rushing to dismantle many of the federal regulations and spending programs that had been built up during the half century following the Great Depression, more than a few software programmers saw the hacker ethic as anticompetitive and, by extension, un-American. At best, it was a throwback to the anticorporate attitudes of the late 1960s and early 1970s. Like a Wall Street banker discovering an old tie-dyed shirt hiding between French-cuffed shirts and double-breasted suits, many computer programmers treated the hacker ethic as an embarrassing reminder of an idealistic age.
+
+For a man who had spent the entire 1960s as an embarrassing throwback to the 1950s, Stallman didn't mind living out of step with his peers. As a programmer used to working with the best machines and the best software, however, Stallman faced what he could only describe as a "stark moral choice": either get over his ethical objection for " proprietary" software-the term Stallman and his fellow hackers used to describe any program that carried private copyright or end-user license that restricted copying and modification-or dedicate his life to building an alternate, nonproprietary system of software programs. Given his recent months-long ordeal with Symbolics, Stallman felt more comfortable with the latter option. "I suppose I could have stopped working on computers altogether," Stallman says. "I had no special skills, but I'm sure I could have become a waiter. Not at a fancy restaurant, probably, but I could've been a waiter somewhere."
+={proprietary software+3}
+
+Being a waiter-i.e., dropping out of programming altogether-would have meant completely giving up an activity, computer programming, that had given him so much pleasure. Looking back on his life since moving to Cambridge, Stallman finds it easy to identify lengthy periods when software programming provided the only pleasure. Rather than drop out, Stallman decided to stick it out.
+
+An atheist, Stallman rejects notions such as fate, dharma, or a divine calling in life. Nevertheless, he does feel that the decision to shun proprietary software and build an operating system to help others do the same was a natural one. After all, it was Stallman's own personal combination of stubbornness, foresight, and coding virtuosity that led him to consider a fork in the road most others didn't know existed. In describing the decision in a chapter for the 1999 book, Open Sources, Stallman cites the spirit encapsulated in the words of the Jewish sage Hillel:
+={Hillel+1;Open Sources (DiBona, et al)+1}
+
+group{
+
+ If I am not for myself, who will be for me?
+
+ If I am only for myself, what am I?
+
+ If not now, when?
+
+}group ~{ See Richard Stallman, Open Sources (O'Reilly & Associates, Inc., 1999): 56. \\ Stallman adds his own footnote to this statement, writing, "As an atheist, I don't follow any religious leaders, but I sometimes find I admire something one of them has said." }~
+
+Speaking to audiences, Stallman avoids the religious route and expresses the decision in pragmatic terms. "I asked myself: what could I, an operating-system developer, do to improve the situation? It wasn't until I examined the question for a while that I realized an operating-system developer was exactly what was needed to solve the problem."
+
+Once he reached that decision, Stallman says, everything else "fell into place." He would abstain from using software programs that forced him to compromise his ethical beliefs, while at the same time devoting his life to the creation of software that would make it easier for others to follow the same path. Pledging to build a free software operating system "or die trying-of old age, of course," Stallman quips, he resigned from the MIT staff in January, 1984, to build GNU.
+
+The resignation distanced Stallman's work from the legal auspices of MIT. Still, Stallman had enough friends and allies within the AI Lab to retain rent-free access to his MIT office. He also had the ability to secure outside consulting gigs to underwrite the early stages of the GNU Project. In resigning from MIT, however, Stallman negated any debate about conflict of interest or Institute ownership of the software. The man whose early adulthood fear of social isolation had driven him deeper and deeper into the AI Lab's embrace was now building a legal firewall between himself and that environment.
+={GNU Project}
+
+For the first few months, Stallman operated in isolation from the Unix community as well. Although his announcement to the net.unix-wizards group had attracted sympathetic responses, few volunteers signed on to join the crusade in its early stages.
+={net.unix-wizards newsgroup}
+
+"The community reaction was pretty much uniform," recalls Rich Morin, leader of a Unix user group at the time. "People said, `Oh, that's a great idea. Show us your code. Show us it can be done.'"
+
+In true hacker fashion, Stallman began looking for existing programs and tools that could be converted into GNU programs and tools. One of the first was a compiler named VUCK, which converted programs written in the popular C programming language into machine-readable code. Translated from the Dutch, the program's acronym stood for the Free University Compiler Kit. Optimistic, Stallman asked the program's author if the program was free. When the author informed him that the words "Free University" were a reference to the Vrije Universiteit in Amsterdam, Stallman was chagrined.
+={C programming language:VUCK compiler for;VUCK compiler}
+
+"He responded derisively, stating that the university was free but the compiler was not," recalls Stallman. "I therefore decided that my first program for the GNU Project would be a multi-language, multi-platform compiler." ^46^
+={GNU Project}
+
+% GNU Project added
+
+Eventually Stallman found a Pastel language compiler written by programmers at Lawrence Livermore National Lab. According to Stallman's knowledge at the time, the compiler was free to copy and modify. Unfortunately, the program possessed a sizable design flaw: it saved each program into core memory, tying up precious space for other software activities. On mainframe systems this design flaw had been forgivable. On Unix systems it was a crippling barrier, since the machines that ran Unix were too small to handle the large files generated. Stallman made substantial progress at first, building a C-compatible frontend to the compiler. By summer, however, he had come to the conclusion that he would have to build a totally new compiler from scratch.
+={Lawrence Livermore National Lab;Pastel compiler;Unix operating system:Pastel compiler and}
+
+In September of 1984, Stallman shelved compiler development for the near term and began searching for lower-lying fruit. He began development of a GNU version of Emacs, the program he himself had been supervising for a decade. The decision was strategic. Within the Unix community, the two native editor programs were vi, written by Sun Microsystems cofounder Bill Joy, and ed, written by Bell Labs scientist (and Unix cocreator) Ken Thompson. Both were useful and popular, but neither offered the endlessly expandable nature of Emacs. In rewriting Emacs for the Unix audience, Stallman stood a better chance of showing off his skills. It also stood to reason that Emacs users might be more attuned to the Stallman mentality.
+={Bell Labs;Emacs text editor:rewriting for Unix+2;GNU Emacs:rewriting for Unix+2;Joy, Bill;vi text editor;Thompson, Ken}
+
+Looking back, Stallman says he didn't view the decision in strategic terms. "I wanted an Emacs, and I had a good opportunity to develop one."
+
+Once again, the notion of reinventing the wheel grated on Stallman's efficient hacker sensibilities. In writing a Unix version of Emacs, Stallman was soon following the footsteps of Carnegie Mellon graduate student James Gosling, author of a C-based version dubbed Gosling Emacs or GOSMACS. Gosling's version of Emacs included an interpreter that exploited a simplified offshoot of the Lisp language called MOCKLISP. Determined to build GNU Emacs on a similar Lisp foundation, Stallman borrowed copiously from Gosling's innovations. Although Gosling had put GOSMACS under copyright and had sold the rights to UniPress, a privately held software company, Stallman cited the assurances of a fellow developer who had participated in the early MOCKLISP interpreter. According to the developer, Gosling, while a Ph.D. student at Carnegie Mellon, had assured early collaborators that their work would remain accessible. When UniPress caught wind of Stallman's project, however, the company threatened to enforce the copyright. Once again, Stallman faced the prospect of building from the ground up.
+={Carnegie Mellon University;Gosling, James+3;GOSMACS (Gosling Emacs);interpreters for LISP+1;LISP programming language:EMACS and+1;MOCKLISP language;UniPress software company+1}
+
+In the course of reverse-engineering Gosling's interpreter, Stallman would create a fully functional Lisp interpreter, rendering the need for Gosling's original interpreter moot. Nevertheless, the notion of developers selling off software rights-indeed, the very notion of developers having software rights to sell in the first place-rankled Stallman. In a 1986 speech at the Swedish Royal Technical Institute, Stallman cited the UniPress incident as yet another example of the dangers associated with proprietary software.
+={proprietary software:Emacs and+4;Swedish Royal Technical Institute}
+
+"Sometimes I think that perhaps one of the best things I could do with my life is find a gigantic pile of proprietary software that was a trade secret, and start handing out copies on a street corner so it wouldn't be a trade secret any more," said Stallman. "Perhaps that would be a much more efficient way for me to give people new free software than actually writing it myself; but everyone is too cowardly to even take it."^3^
+
+Despite the stress it generated, the dispute over Gosling's innovations would assist both Stallman and the free software movement in the long term. It would force Stallman to address the weaknesses of the Emacs Commune and the informal trust system that had allowed problematic offshoots to emerge. It would also force Stallman to sharpen the free software movement's political objectives. Following the release of GNU Emacs in 1985, Stallman issued " The GNU Manifesto," an expansion of the original announcement posted in September, 1983. Stallman included within the document a lengthy section devoted to the many arguments used by commercial and academic programmers to justify the proliferation of proprietary software programs. One argument, "Don't programmers deserve a reward for their creativity," earned a response encapsulating Stallman's anger over the recent Gosling Emacs episode:
+={Emacs Commune:proprietary software and;Emacs text editor;GNU Emacs;GNU Manifesto}
+
+"If anything deserves a reward, it is social contribution," Stallman wrote. "Creativity can be a social contribution, but only in so far [sic] as society is free to use the results. If programmers deserve to be rewarded for creating innovative programs, by the same token they deserve to be punished if they restrict the use of these programs."~{ See Richard Stallman, "The GNU Manifesto" (1985). \\ http://www.gnu.org/manifesto.html }~
+
+With the release of GNU Emacs, the GNU Project finally had code to show. It also had the burdens of any software-based enterprise. As more and more Unix developers began playing with the software, money, gifts, and requests for tapes began to pour in. To address the business side of the GNU Project, Stallman drafted a few of his colleagues and formed the Free Software Foundation (FSF), a nonprofit organization dedicated to speeding the GNU Project towards its goal. With Stallman as president and various hacker allies as board members, the FSF helped provide a corporate face for the GNU Project.
+={Free Software Foundation (FSF):GNU Project and;GNU Project:Emacs, release of}
+
+Robert Chassell, a programmer then working at Lisp Machines, Inc., became one of five charter board members at the Free Software Foundation following a dinner conversation with Stallman. Chassell also served as the organization's treasurer, a role that started small but quickly grew.
+={Chassell, Robert+6;LISP Machines Inc. (LMI);LMI (LISP Machines Inc.)}
+
+"I think in '85 our total expenses and revenue were something in the order of $23,000, give or take," Chassell recalls. "Richard had his office, and we borrowed space. I put all the stuff, especially the tapes, under my desk. It wasn't until sometime later LMI loaned us some space where we could store tapes and things of that sort."
+
+In addition to providing a face, the Free Software Foundation provided a center of gravity for other disenchanted programmers. The Unix market that had seemed so collegial even at the time of Stallman's initial GNU announcement was becoming increasingly competitive. In an attempt to tighten their hold on customers, companies were starting to close off access to Unix source code, a trend that only speeded the number of inquiries into ongoing GNU software projects. The Unix wizards who once regarded Stallman as a noisy kook were now beginning to see him as a software Cassandra.
+
+"A lot of people don't realize, until they've had it happen to them, how frustrating it can be to spend a few years working on a software program only to have it taken away," says Chassell, summarizing the feelings and opinions of the correspondents writing in to the FSF during the early years. "After that happens a couple of times, you start to say to yourself, `Hey, wait a minute.'"
+
+For Chassell, the decision to participate in the Free Software Foundation came down to his own personal feelings of loss. Prior to LMI, Chassell had been working for hire, writing an introductory book on Unix for Cadmus, Inc., a Cambridge-area software company. When Cadmus folded, taking the rights to the book down with it, Chassell says he attempted to buy the rights back with no success.
+
+"As far as I know, that book is still sitting on shelf somewhere, unusable, uncopyable, just taken out of the system," Chassell says. "It was quite a good introduction if I may say so myself. It would have taken maybe three or four months to convert [the book] into a perfectly usable introduction to GNU/Linux today. The whole experience, aside from what I have in my memory, was lost."
+
+Forced to watch his work sink into the mire while his erstwhile employer struggled through bankruptcy, Chassell says he felt a hint of the anger that drove Stallman to fits of apoplexy. "The main clarity, for me, was the sense that if you want to have a decent life, you don't want to have bits of it closed off," Chassell says. "This whole idea of having the freedom to go in and to fix something and modify it, whatever it may be, it really makes a difference. It makes one think happily that after you've lived a few years that what you've done is worthwhile. Because otherwise it just gets taken away and thrown out or abandoned or, at the very least, you no longer have any relation to it. It's like losing a bit of your life."
+
+1~ Chapter 8 - St. Ignucius
+={Ignucius, (St.);St. Ignucius}
+
+The Maui High Performance Computing Center is located in a single-story building in the dusty red hills just above the town of Kihei. Framed by million-dollar views and the multimillion dollar real estate of the Silversword Golf Course, the center seems like the ultimate scientific boondoggle. Far from the boxy, sterile confines of Tech Square or even the sprawling research metropolises of Argonne, Illinois and Los Alamos, New Mexico, the MHPCC seems like the kind of place where scientists spend more time on their tans than their post-doctoral research projects.
+={Argonne (Illinois);Los Alamos (New Mexico);Maui High Performance Computing Center (MHPCC);MHPCC (Maui High Performance Computing Center)}
+
+The image is only half true. Although researchers at the MHPCC do take advantage of the local recreational opportunities, they also take their work seriously. According to Top500.org, a web site that tracks the most powerful supercomputers in the world, the IBM SP Power3 supercomputer housed within the MHPCC clocks in at 837 billion floating-point operations per second, making it one of 25 most powerful computers in the world. Co-owned and operated by the University of Hawaii and the U.S. Air Force, the machine divides its computer cycles between the number crunching tasks associated with military logistics and high-temperature physics research.
+={IBM SP Power3 supercomputer;U.S Air Force;University of Hawaii;Top500.org}
+
+Simply put, the MHPCC is a unique place, a place where the brainy culture of science and engineering and the laid-back culture of the Hawaiian islands coexist in peaceful equilibrium. A slogan on the lab's 2000 web site sums it up: "Computing in paradise."
+
+It's not exactly the kind of place you'd expect to find Richard Stallman, a man who, when taking in the beautiful view of the nearby Maui Channel through the picture windows of a staffer's office, mutters a terse critique: "Too much sun." Still, as an emissary from one computing paradise to another, Stallman has a message to deliver, even if it means subjecting his pale hacker skin to the hazards of tropical exposure.
+
+The conference room is already full by the time I arrive to catch Stallman's speech. The gender breakdown is a little better than at the New York speech, 85% male, 15% female, but not by much. About half of the audience members wear khaki pants and logo-encrusted golf shirts. The other half seems to have gone native. Dressed in the gaudy flower-print shirts so popular in this corner of the world, their faces are a deep shade of ochre. The only residual indication of geek status are the gadgets: Nokia cell phones, Palm Pilots, and Sony VAIO laptops.
+
+Needless to say, Stallman, who stands in front of the room dressed in plain blue T-shirt, brown polyester slacks, and white socks, sticks out like a sore thumb. The fluorescent lights of the conference room help bring out the unhealthy color of his sun-starved skin. His beard and hair are enough to trigger beads of sweat on even the coolest Hawaiian neck. Short of having the words "mainlander" tattooed on his forehead, Stallman couldn't look more alien if he tried.
+
+As Stallman putters around the front of the room, a few audience members wearing T-shirts with the logo of the Maui FreeBSD Users Group (MFUG) race to set up camera and audio equipment. FreeBSD, a free software offshoot of the Berkeley Software Distribution, the venerable 1970s academic version of Unix, is technically a competitor to the GNU/Linux operating system. Still, in the hacking world, Stallman speeches are documented with a fervor reminiscent of the Grateful Dead and its legendary army of amateur archivists. As the local free software heads, it's up to the MFUG members to make sure fellow programmers in Hamburg, Mumbai, and Novosibirsk don't miss out on the latest pearls of RMS wisdom.
+={Berkely Software Distribution (BSD);BSD (Berkely Software Distribution);Grateful Dead, The+1;Maui FreeBSD Users Group}
+
+The analogy to the Grateful Dead is apt. Often, when describing the business opportunities inherent within the free software model, Stallman has held up the Grateful Dead as an example. In refusing to restrict fans' ability to record live concerts, the Grateful Dead became more than a rock group. They became the center of a tribal community dedicated to Grateful Dead music. Over time, that tribal community became so large and so devoted that the band shunned record contracts and supported itself solely through musical tours and live appearances. In 1994, the band's last year as a touring act, the Grateful Dead drew $52 million in gate receipts alone.~{ See "Grateful Dead Time Capsule: 1985-1995 North American Tour Grosses." \\ http://www.accessplace.com/gdtc/1197.htm }~
+
+While few software companies have been able to match that success, the tribal aspect of the free software community is one reason many in the latter half of the 1990s started to accept the notion that publishing software source code might be a good thing. Hoping to build their own loyal followings, companies such as IBM, Sun Microsystems, and Hewlett Packard have come to accept the letter, if not the spirit, of the Stallman free software message. Describing the GPL as the information-technology industry's "Magna Carta," ZDNet software columnist Evan Leibovitch sees the growing affection for all things GNU as more than just a trend. "This societal shift is letting users take back control of their futures," Leibovitch writes. "Just as the Magna Carta gave rights to British subjects, the GPL enforces consumer rights and freedoms on behalf of the users of computer software."~{ See Evan Leibovitch, "Who's Afraid of Big Bad Wolves," ZDNet Tech Update (December 15, 2000). \\ http://techupdate.zdnet.com/techupdate/stories/main/0,14179,2664992,00.html }~
+={Hewlett Packard;IBM;Sun Microsystems}
+
+The tribal aspect of the free software community also helps explain why 40-odd programmers, who might otherwise be working on physics projects or surfing the Web for windsurfing buoy reports, have packed into a conference room to hear Stallman speak.
+
+Unlike the New York speech, Stallman gets no introduction. He also offers no self-introduction. When the FreeBSD people finally get their equipment up and running, Stallman simply steps forward, starts speaking, and steamrolls over every other voice in the room.
+={FreeBSD}
+
+"Most of the time when people consider the question of what rules society should have for using software, the people considering it are from software companies, and they consider the question from a self-serving perspective," says Stallman, opening his speech. "What rules can we impose on everybody else so they have to pay us lots of money? I had the good fortune in the 1970s to be part of a community of programmers who shared software. And because of this I always like to look at the same issue from a different direction to ask: what kind of rules make possible a good society that is good for the people who are in it? And therefore I reach completely different answers."
+
+Once again, Stallman quickly segues into the parable of the Xerox laser printer, taking a moment to deliver the same dramatic finger-pointing gestures to the crowd. He also devotes a minute or two to the GNU/Linux name.
+
+"Some people say to me, `Why make such a fuss about getting credit for this system? After all, the important thing is the job is done, not whether you get recognition for it.' Well, this would be wise advice if it were true. But the job wasn't to build an operating system; the job is to spread freedom to the users of computers. And to do that we have to make it possible to do everything with computers in freedom."~{ For narrative purposes, I have hesitated to go in-depth when describing Stallman's full definition of software "freedom." The GNU Project web site lists four fundamental components: \\ The freedom to run a program, for any purpose (freedom 0). \\ The freedom to study how a program works, and adapt it to your needs (freedom 1). \\ The freedom to redistribute copies of a program so you can help your neighbor (freedom 2). \\ The freedom to improve the program, and release your improvements to the public, so that the whole community benefits (freedom 3). \\ For more information, please visit "The Free Software Definition" at http://www.gnu.org/philosophy/free-sw.html }~
+
+Adds Stallman, "There's a lot more work to do."
+
+For some in the audience, this is old material. For others, it's a little arcane. When a member of the golf-shirt contingent starts dozing off, Stallman stops the speech and asks somebody to wake the person up.
+
+"Somebody once said my voice was so soothing, he asked if I was some kind of healer," says Stallman, drawing a quick laugh from the crowd. "I guess that probably means I can help you drift gently into a blissful, relaxing sleep. And some of you might need that. I guess I shouldn't object if you do. If you need to sleep, by all means do."
+
+The speech ends with a brief discussion of software patents, a growing issue of concern both within the software industry and within the free software community. Like Napster, software patents reflect the awkward nature of applying laws and concepts written for the physical world to the frictionless universe of information technology. The difference between protecting a program under copyright and protecting a program under software patents is subtle but significant. In the case of copyright, a software creator can restrict duplication of the source code but not duplication of the idea or functionality that the source code addresses. In other words, if a developer chooses not to use a software program under the original developer's terms, that second developer is still free to reverse-engineer the program-i.e., duplicate the software program's functionality by rewriting the source code from scratch. Such duplication of ideas is common within the commercial software industry, where companies often isolate reverse-engineering teams to head off accusations of corporate espionage or developer hanky-panky. In the jargon of modern software development, companies refer to this technique as "clean room" engineering.
+
+Software patents work differently. According to the U.S. Patent Office, companies and individuals may secure patents for innovative algorithms provided they submit their claims to a public review. In theory, this allows the patent-holder to trade off disclosure of their invention for a limited monopoly of a minimum of 20 years after the patent filing. In practice, the disclosure is of limited value, since the operation of the program is often self-evident. Unlike copyright, a patent gives its holder the ability to head off the independent development of software programs with the same or similar functionality.
+={U.S. Patent Office}
+
+In the software industry, where 20 years can cover the entire life cycle of a marketplace, patents take on a strategic weight. Where companies such as Microsoft and Apple once battled over copyright and the "look and feel" of various technologies, today's Internet companies use patents as a way to stake out individual applications and business models, the most notorious example being Amazon.com's 2000 attempt to patent the company's "one-click" online shopping process. For most companies, however, software patents have become a defensive tool, with cross-licensing deals balancing one set of corporate patents against another in a tense form of corporate detente. Still, in a few notable cases of computer encryption and graphic imaging algorithms, software vendors have successfully stifled rival technologies.
+
+For Stallman, the software-patent issue dramatizes the need for eternal hacker vigilance. It also underlines the importance of stressing the political benefits of free software programs over the competitive benefits. Pointing to software patents' ability to create sheltered regions in the marketplace, Stallman says competitive performance and price, two areas where free software operating systems such as GNU/Linux and FreeBSD already hold a distinct advantage over their proprietary counterparts, are red herrings compared to the large issues of user and developer freedom.
+={FreeBSD+2}
+
+% add index reference
+
+"It's not because we don't have the talent to make better software," says Stallman. "It's because we don't have the right. Somebody has prohibited us from serving the public. So what's going to happen when users encounter these gaps in free software? Well, if they have been persuaded by the open source movement that these freedoms are good because they lead to more-powerful reliable software, they're likely to say, `You didn't deliver what you promised. This software's not more powerful. It's missing this feature. You lied to me.' But if they have come to agree with the free software movement, that the freedom is important in itself, then they will say, `How dare those people stop me from having this feature and my freedom too.' And with that kind of response, we may survive the hits that we're going to take as these patents explode."
+
+Such comments involve a hefty dose of spin, of course. Most open source advocates are equally, if not more, vociferous as Stallman when it comes to opposing software patents. Still, the underlying logic of Stallman's argument-that open source advocates emphasize the utilitarian advantages of free software over the political advantages-remains uncontested. Rather than stress the political significance of free software programs, open source advocates have chosen to stress the engineering integrity of the hacker development model. Citing the power of peer review, the open source argument paints programs such as GNU/Linux or FreeBSD as better built, better inspected and, by extension, more trushworthy to the average user.
+
+That's not to say the term "open source" doesn't have its political implications. For open source advocates, the term open source serves two purposes. First, it eliminates the confusion associated with the word "free," a word many businesses interpret as meaning "zero cost." Second, it allows companies to examine the free software phenomenon on a technological, rather than ethical, basis. Eric Raymond, cofounder of the Open Source Initiative and one of the leading hackers to endorse the term, effectively summed up the frustration of following Stallman down the political path in a 1999 essay, titled "Shut Up and Show Them the Code":
+={OSI (Open Source Initiative);Open Source Initiative (OSI);Raymond, Eric;Shut Up and Show Them the Code (Raymond)+1}
+
+_1 RMS's rhetoric is very seductive to the kind of people we are. We hackers are thinkers and idealists who readily resonate with appeals to "principle" and "freedom" and "rights." Even when we disagree with bits of his program, we want RMS's rhetorical style to work; we think it ought to work; we tend to be puzzled and disbelieving when it fails on the 95% of people who aren't wired like we are.~{ See Eric Raymond, "Shut Up and Show Them the Code," online essay, (June 28, 1999). }~
+
+Included among that 95%, Raymond writes, are the bulk of business managers, investors, and nonhacker computer users who, through sheer weight of numbers, tend to decide the overall direction of the commercial software marketplace. Without a way to win these people over, Raymond argues, programmers are doomed to pursue their ideology on the periphery of society:
+
+_1 When RMS insists that we talk about "computer users' rights," he's issuing a dangerously attractive invitation to us to repeat old failures. It's one we should reject-not because his principles are wrong, but because that kind of language, applied to software, simply does not persuade anybody but us. In fact, it confuses and repels most people outside our culture. ^60^
+
+Watching Stallman deliver his political message in person, it is hard to see anything confusing or repellent. Stallman's appearance may seem off-putting, but his message is logical. When an audience member asks if, in shunning proprietary software, free software proponents lose the ability to keep up with the latest technological advancements, Stallman answers the question in terms of his own personal beliefs. "I think that freedom is more important than mere technical advance," he says. "I would always choose a less advanced free program rather than a more advanced nonfree program, because I won't give up my freedom for something like that. My rule is, if I can't share it with you, I won't take it."
+
+Such answers, however, reinforce the quasi-religious nature of the Stallman message. Like a Jew keeping kosher or a Mormon refusing to drink alcohol, Stallman paints his decision to use free software in the place of proprietary in the color of tradition and personal belief. As software evangelists go, Stallman avoids forcing those beliefs down listeners' throats. Then again, a listener rarely leaves a Stallman speech not knowing where the true path to software righteousness lies.
+
+As if to drive home this message, Stallman punctuates his speech with an unusual ritual. Pulling a black robe out of a plastic grocery bag, Stallman puts it on. Out of a second bag, he pulls a reflective yellow computer disk and places it on his head. The crowd lets out a startled laugh.
+
+"I am St. Ignucius of the Church of Emacs," says Stallman, raising his right hand in mock-blessing. "I bless your computer, my child."
+={Ignucius, (St.);St. Ignucius}
+
+{free_as_in_freedom_03_rms_st_ignucius.png 188x209 "Stallman dressed as St. Ignucius. Photo by Wouter van Oortmerssen." }http://en.wikipedia.org/wiki/Richard_stallman
+
+The laughter turns into full-blown applause after a few seconds. As audience members clap, the computer disk on Stallman's head catches the glare of an overhead light, eliciting a perfect halo effect. In the blink of an eye, Stallman goes from awkward haole to Russian religious icon.
+
+"Emacs was initially a text editor," says Stallman, explaining the getup. "Eventually it became a way of life for many and a religion for some. We call this religion the Church of Emacs."
+={Church of Emacs+8;Emacs text editor+11;GNU Emacs+11}
+
+The skit is a lighthearted moment of self-pardoy, a humorous return-jab at the many people who might see Stallman's form of software asceticism as religious fanaticism in disguise. It is also the sound of the other shoe dropping-loudly. It's as if, in donning his robe and halo, Stallman is finally letting listeners of the hook, saying, "It's OK to laugh. I know I'm weird."
+
+Discussing the St. Ignucius persona afterward, Stallman says he first came up with it in 1996, long after the creation of Emacs but well before the emergence of the "open source" term and the struggle for hacker-community leadership that precipitated it. At the time, Stallman says, he wanted a way to "poke fun at himself," to remind listeners that, though stubborn, Stallman was not the fanatic some made him out to be. It was only later, Stallman adds, that others seized the persona as a convenient way to play up his reputation as software ideologue, as Eric Raymond did in an 1999 interview with the linux.com web site:
+={linux.com;Raymond, Eric:St. Ignucius and+2}
+
+_1 When I say RMS calibrates what he does, I'm not belittling or accusing him of insincerity. I'm saying that like all good communicators he's got a theatrical streak. Sometimes it's conscious-have you ever seen him in his St. Ignucius drag, blessing software with a disk platter on his head? Mostly it's unconscious; he's just learned the degree of irritating stimulus that works, that holds attention without (usually) freaking people out.~{ See "Guest Interview: Eric S. Raymond," Linux.com (May 18, 1999). \\ http://www.linux.com/interviews/19990518/8/ }~
+
+Stallman takes issue with the Raymond analysis. "It's simply my way of making fun of myself," he says. "The fact that others see it as anything more than that is a reflection of their agenda, not mine."
+
+That said, Stallman does admit to being a ham. "Are you kidding?" he says at one point. "I love being the center of attention." To facilitate that process, Stallman says he once enrolled in Toastmasters, an organization that helps members bolster their public-speaking skills and one Stallman recommends highly to others. He possesses a stage presence that would be the envy of most theatrical performers and feels a link to vaudevillians of years past. A few days after the Maui High Performance Computing Center speech, I allude to the 1999 LinuxWorld performace and ask Stallman if he has a Groucho Marx complex-i.e., the unwillingness to belong to any club that would have him as a member. Stallman's response is immediate: "No, but I admire Groucho Marx in a lot of ways and certainly have been in some things I say inspired by him. But then I've also been inspired in some ways by Harpo."
+={Marx, Groucho+1}
+
+The Groucho Marx influence is certainly evident in Stallman's lifelong fondness for punning. Then again, punning and wordplay are common hacker traits. Perhaps the most Groucho-like aspect of Stallman's personality, however, is the deadpan manner in which the puns are delivered. Most come so stealthily-without even the hint of a raised eyebrow or upturned smile-you almost have to wonder if Stallman's laughing at his audience more than the audience is laughing at him.
+
+Watching members of the Maui High Performance Computer Center laugh at the St. Ignucius parody, such concerns evaporate. While not exactly a standup act, Stallman certainly possesses the chops to keep a roomful of engineers in stitches. "To be a saint in the Church of Emacs does not require celibacy, but it does require making a commitment to living a life of moral purity," he tells the Maui audience. "You must exorcise the evil proprietary operating system from all your computer and then install a wholly [holy] free operating system. And then you must install only free software on top of that. If you make this commitment and live by it, then you too will be a saint in the Church of Emacs, and you too may have a halo."
+
+The St. Ignucius skit ends with a brief inside joke. On most Unix systems and Unix-related offshoots, the primary competitor program to Emacs is vi, a text-editing program developed by former UC Berkeley student and current Sun Microsystems chief scientist, Bill Joy. Before doffing his "halo," Stallman pokes fun at the rival program. "People sometimes ask me if it is a sin in the Church of Emacs to use vi," he says. "Using a free version of vi is not a sin; it is a penance. So happy hacking."
+={Joy, Bill;vi text editor:as an Emacs competitor;UC Berkeley;Sun Microsystems}
+
+After a brief question-and-answer session, audience members gather around Stallman. A few ask for autographs. "I'll sign this," says Stallman, holding up one woman's print out of the GNU General Public License, "but only if you promise me to use the term GNU/Linux instead of Linux and tell all your friends to do likewise."
+={GNU General Public License;GPL}
+
+The comment merely confirms a private observation. Unlike other stage performers and political figures, Stallman has no "off" mode. Aside from the St. Ignucius character, the ideologue you see onstage is the ideologue you meet backstage. Later that evening, during a dinner conversation in which a programmer mentions his affinity for "open source" programs, Stallman, between bites, upbraids his tablemate: "You mean free software. That's the proper way to refer to it."
+
+During the question-and-answer session, Stallman admits to playing the pedagogue at times. "There are many people who say, `Well, first let's invite people to join the community, and then let's teach them about freedom.' And that could be a reasonable strategy, but what we have is almost everybody's inviting people to join the community, and hardly anybody's teaching them about freedom once they come in."
+
+The result, Stallman says, is something akin to a third-world city. People move in, hoping to strike it rich or at the very least to take part in a vibrant, open culture, and yet those who hold the true power keep evolving new tricks and strategies-i.e., software patents-to keep the masses out. "You have millions of people moving in and building shantytowns, but nobody's working on step two: getting them out of those shantytowns. If you think talking about software freedom is a good strategy, please join in doing step two. There are plenty working on step one. We need more people working on step two."
+
+Working on "step two" means driving home the issue that freedom, not acceptance, is the root issue of the free software movement. Those who hope to reform the proprietary software industry from the inside are on a fool's errand. "Change from the inside is risky," Stallman stays. "Unless you're working at the level of a Gorbachev, you're going to be neutralized."
+
+Hands pop up. Stallman points to a member of the golf shirt-wearing contingent. "Without patents, how would you suggest dealing with commercial espionage?"
+
+"Well, those two questions have nothing to do with each other, really," says Stallman.
+
+"But I mean if someone wants to steal another company's piece of software."
+
+Stallman's recoils as if hit by a poisonous spray. "Wait a second," Stallman says. "Steal? I'm sorry, there's so much prejudice in that statement that the only thing I can say is that I reject that prejudice. Companies that develop nonfree software and other things keep lots and lots of trade secrets, and so that's not really likely to change. In the old days-even in the 1980s-for the most part programmers were not aware that there were even software patents and were paying no attention to them. What happened was that people published the interesting ideas, and if they were not in the free software movement, they kept secret the little details. And now they patent those broad ideas and keep secret the little details. So as far as what you're describing, patents really make no difference to it one way or another."
+
+"But if it doesn't affect their publication," a new audience member jumps in, his voice trailing off almost as soon as he starts speaking.
+
+"But it does," Stallman says. "Their publication is telling you that this is an idea that's off limits to the rest of the community for 20 years. And what the hell good is that? Besides, they've written it in such a hard way to read, both to obfuscate the idea and to make the patent as broad as possible, that it's basically useless looking at the published information to learn anything anyway. The only reason to look at patents is to see the bad news of what you can't do."
+
+The audience falls silent. The speech, which began at 3:15, is now nearing the 5:00 whistle, and most listeners are already squirming in their seats, antsy to get a jump start on the weekend. Sensing the fatigue, Stallman glances around the room and hastily shuts things down. "So it looks like we're done," he says, following the observation with an auctioneer's "going, going, gone" to flush out any last-minute questioners. When nobody throws their hand up, Stallman signs off with a traditional exit line.
+
+"Happy hacking," he says.
+
+1~ Chapter 9 - The GNU General Public License
+={GNU General Public License+82;GPL+82;Stallman, Richard M.:childhood:GNU General Public License+82}
+
+By the spring of 1985, Richard Stallman had settled on the GNU Project's first milestone-a Lisp-based free software version of Emacs. To meet this goal, however, he faced two challenges. First, he had to rebuild Emacs in a way that made it platform independent. Second, he had to rebuild the Emacs Commune in a similar fashion.
+={Emacs Commune+7;Emacs text editor:Lisp-based free software version;GNU Emacs:List-based free software version}
+
+The dispute with UniPress had highlighted a flaw in the Emacs Commune social contract. Where users relied on Stallman's expert insight, the Commune's rules held. In areas where Stallman no longer held the position of alpha hacker-pre-1984 Unix systems, for example-individuals and companies were free to make their own rules.
+={UniPress software company}
+
+The tension between the freedom to modify and the freedom to exert authorial privilege had been building before GOSMACS. The Copyright Act of 1976 had overhauled U.S. copyright law, extending the legal protection of copyright to software programs. According to Section 102(b) of the Act, individuals and companies now possessed the ability to copyright the "expression" of a software program but not the "actual processes or methods embodied in the program."~{ See Hal Abelson, Mike Fischer, and Joanne Costello, "Software and Copyright Law," updated version (1998). \\ http://www.swiss.ai.mit.edu/6805/articles/int-prop/software-copyright.html }~ Translated, programmers and companies had the ability to treat software programs like a story or song. Other programmers could take inspiration from the work, but to make a direct copy or nonsatirical derivative, they first had to secure permission from the original creator. Although the new law guaranteed that even programs without copyright notices carried copyright protection, programmers quickly asserted their rights, attaching coypright notices to their software programs.
+={Copyright Act of 1976;copyright laws;GOSMACS (Gosling Emacs);software:copyright laws on}
+
+At first, Stallman viewed these notices with alarm. Rare was the software program that didn't borrow source code from past programs, and yet, with a single stroke of the president's pen, Congress had given programmers and companies the power to assert individual authorship over communally built programs. It also injected a dose of formality into what had otherwise been an informal system. Even if hackers could demonstrate how a given program's source-code bloodlines stretched back years, if not decades, the resources and money that went into battling each copyright notice were beyond most hackers' means. Simply put, disputes that had once been settled hacker-to-hacker were now settled lawyer-to-lawyer. In such a system, companies, not hackers, held the automatic advantage.
+={source code:copy rights for}
+
+Proponents of software copyright had their counter-arguments: without copyright, works might otherwise slip into the public domain. Putting a copyright notice on a work also served as a statement of quality. Programmers or companies who attached their name to the copyright attached their reputations as well. Finally, it was a contract, as well as a statement of ownership. Using copyright as a flexible form of license, an author could give away certain rights in exchange for certain forms of behavior on the part of the user. For example, an author could give away the right to suppress unauthorized copies just so long as the end user agreed not to create a commercial offshoot.
+
+It was this last argument that eventually softened Stallman's resistance to software copyright notices. Looking back on the years leading up to the GNU Project, Stallman says he began to sense the beneficial nature of copyright sometime around the release of Emacs 15.0, the last significant pre-GNU Project upgrade of Emacs. "I had seen email messages with copyright notices plus simple `verbatim copying permitted' licenses," Stallman recalls. "Those definitely were [an] inspiration."
+
+For Emacs 15, Stallman drafted a copyright that gave users the right to make and distribute copies. It also gave users the right to make modified versions, but not the right to claim sole ownership of those modified versions, as in the case of GOSMACS.
+={Emacs text editor:copyrights and|GNU Emacs License and;GNU Emacs:copyrights and|GNU Emacs License and;GOSMACS (Gosling Emacs):copyrights and;licenses+15}
+
+Although helpful in codifying the social contract of the Emacs Commune, the Emacs 15 license remained too "informal" for the purposes of the GNU Project, Stallman says. Soon after starting work on a GNU version of Emacs, Stallman began consulting with the other members of the Free Software Foundation on how to shore up the license's language. He also consulted with the attorneys who had helped him set up the Free Software Foundation.
+
+Mark Fischer, a Boston attorney specializing in intellectual-property law, recalls discussing the license with Stallman during this period. "Richard had very strong views about how it should work," Fischer says, "He had two principles. The first was to make the software absolutely as open as possible. The second was to encourage others to adopt the same licensing practices."
+={Fischer, Mark+2}
+
+Encouraging others to adopt the same licensing practices meant closing off the escape hatch that had allowed privately owned versions of Emacs to emerge. To close that escape hatch, Stallman and his free software colleagues came up with a solution: users would be free to modify GNU Emacs just so long as they published their modifications. In addition, the resulting "derivative" works would also have carry the same GNU Emacs License.
+
+The revolutionary nature of this final condition would take a while to sink in. At the time, Fischer says, he simply viewed the GNU Emacs License as a simple contract. It put a price tag on GNU Emacs' use. Instead of money, Stallman was charging users access to their own later modifications. That said, Fischer does remember the contract terms as unique.
+
+"I think asking other people to accept the price was, if not unique, highly unusual at that time," he says.
+
+The GNU Emacs License made its debut when Stallman finally released GNU Emacs in 1985. Following the release, Stallman welcomed input from the general hacker community on how to improve the license's language. One hacker to take up the offer was future software activist John Gilmore, then working as a consultant to Sun Microsystems. As part of his consulting work, Gilmore had ported Emacs over to SunOS, the company's in-house version of Unix. In the process of doing so, Gilmore had published the changes as per the demands of the GNU Emacs License. Instead of viewing the license as a liability, Gilmore saw it as clear and concise expression of the hacker ethos. "Up until then, most licenses were very informal," Gilmore recalls.
+={Gilmore, John+6;SunOS:porting Emacs to;Sun Microsystems}
+
+As an example of this informality, Gilmore cites a copyright notice for trn, a Unix utility. Written by Larry Wall, future creator of the Perl programming language, patch made it simple for Unix programmers to insert source-code fixes - "patches" in hacker jargon-into any large program. Recognizing the utility of this feature, Wall put the following copyright notice in the program's accompanying README file:
+={Wall, Larry+1;patches, inserting into source code;Perl programming language;source code:patches}
+
+% previous markup as 'poem' with footnote not satisfactory
+
+Copyright (c) 1985, Larry Wall \\
+You may copy the trn kit in whole or in part as long as you don't try to make money off it, or pretend that you wrote it.~{ See Trn Kit README. \\ http://www.za.debian.org/doc/trn/trn-readme }~
+
+Such statements, while reflective of the hacker ethic, also reflected the difficulty of translating the loose, informal nature of that ethic into the rigid, legal language of copyright. In writing the GNU Emacs License, Stallman had done more than close up the escape hatch that permitted proprietary offshoots. He had expressed the hacker ethic in a manner understandable to both lawyer and hacker alike.
+
+It wasn't long, Gilmore says, before other hackers began discussing ways to "port" the GNU Emacs License over to their own programs. Prompted by a conversation on Usenet, Gilmore sent an email to Stallman in November, 1986, suggesting modification:
+
+_1 You should probably remove "EMACS" from the license and replace it with "SOFTWARE" or something. Soon, we hope, Emacs will not be the biggest part of the GNU system, and the license applies to all of it.~{ See John Gilmore, quoted from email to author. }~
+
+Gilmore wasn't the only person suggesting a more general approach. By the end of 1986, Stallman himself was at work with GNU Project's next major milestone, a source-code debugger, and was looking for ways to revamp the Emacs license so that it might apply to both programs. Stallman's solution: remove all specific references to Emacs and convert the license into a generic copyright umbrella for GNU Project software. The GNU General Public License, GPL for short, was born.
+={GNU Debugger (GDB)+1;GDB (GNU Debugger);Debugger+1}
+
+In fashioning the GPL, Stallman followed the software convention of using decimal numbers to indicate prototype versions and whole numbers to indicate mature versions. Stallman published Version 1.0 of the GPL in 1989 (a project Stallman was developing in 1985), almost a full year after the release of the GNU Debugger, Stallman's second major foray into the realm of Unix programming. The license contained a preamble spelling out its political intentions:
+
+poem{
+
+The General Public License is designed to make sure that you have
+the freedom to give away or sell copies of free software, that you
+receive source code or can get it if you want it, that you can change
+the software or use pieces of it in new free programs; and that you
+know you can do these things.
+
+To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the software, or if you modify it.
+
+}poem ~{ See Richard Stallman, et al., "GNU General Public License: Version 1," (February, 1989). \\ http://www.gnu.org/copyleft/copying-1.0.html }~
+
+In fashioning the GPL, Stallman had been forced to make an additional adjustment to the informal tenets of the old Emacs Commune. Where he had once demanded that Commune members publish any and all changes, Stallman now demanded publication only in instances when programmers circulated their derivative versions in the same public manner as Stallman. In other words, programmers who simply modified Emacs for private use no longer needed to send the source-code changes back to Stallman. In what would become a rare compromise of free software doctrine, Stallman slashed the price tag for free software. Users could innovate without Stallman looking over their shoulders just so long as they didn't bar Stallman and the rest of the hacker community from future exchanges of the same program.
+={Emacs Commune+1}
+
+% additional reference to emacs commune
+
+Looking back, Stallman says the GPL compromise was fueled by his own dissatisfaction with the Big Brother aspect of the original Emacs Commune social contract. As much as he liked peering into other hackers' systems, the knowledge that some future source-code maintainer might use that power to ill effect forced him to temper the GPL.
+
+"It was wrong to require people to publish all changes," says Stallman. "It was wrong to require them to be sent to one privileged developer. That kind of centralization and privilege for one was not consistent with a society in which all had equal rights."
+
+As hacks go, the GPL stands as one of Stallman's best. It created a system of communal ownership within the normally proprietary confines of copyright law. More importantly, it demonstrated the intellectual similarity between legal code and software code. Implicit within the GPL's preamble was a profound message: instead of viewing copyright law with suspicion, hackers should view it as yet another system begging to be hacked.
+
+"The GPL developed much like any piece of free software with a large community discussing its structure, its respect or the opposite in their observation, needs for tweaking and even to compromise it mildly for greater acceptance," says Jerry Cohen, another attorney who helped Stallman with the creation of the license. "The process worked very well and GPL in its several versions has gone from widespread skeptical and at times hostile response to widespread acceptance."
+
+In a 1986 interview with Byte magazine, Stallman summed up the GPL in colorful terms. In addition to proclaiming hacker values, Stallman said, readers should also "see it as a form of intellectual jujitsu, using the legal system that software hoarders have set up against them."~{ See David Betz and Jon Edwards, "Richard Stallman discusses his public-domain [sic] Unix-compatible software system with BYTE editors," BYTE (July, 1996). (Reprinted on the GNU Project web site: http://www.gnu.org/gnu/byte-interview.html ) \\ This interview offers an interesting, not to mention candid, glimpse at Stallman's political attitudes during the earliest days of the GNU Project. It is also helpful in tracing the evolution of Stallman's rhetoric. \\ Describing the purpose of the GPL, Stallman says, "I'm trying to change the way people approach knowledge and information in general. I think that to try to own knowledge, to try to control whether people are allowed to use it, or to try to stop other people from sharing it, is sabotage." \\ Contrast this with a statement to the author in August 2000: "I urge you not to use the term `intellectual property' in your thinking. It will lead you to misunderstand things, because that term generalizes about copyrights, patents, and trademarks. And those things are so different in their effects that it is entirely foolish to try to talk about them at once. If you hear somebody saying something about intellectual property, without quotes, then he's not thinking very clearly and you shouldn't join." }~ Years later, Stallman would describe the GPL's creation in less hostile terms. "I was thinking about issues that were in a sense ethical and in a sense political and in a sense legal," he says. "I had to try to do what could be sustained by the legal system that we're in. In spirit the job was that of legislating the basis for a new society, but since I wasn't a government, I couldn't actually change any laws. I had to try to do this by building on top of the existing legal system, which had not been designed for anything like this."
+={Byte magazine}
+
+About the time Stallman was pondering the ethical, political, and legal issues associated with free software, a California hacker named Don Hopkins mailed him a manual for the 68000 microprocessor. Hopkins, a Unix hacker and fellow science-fiction buff, had borrowed the manual from Stallman a while earlier. As a display of gratitude, Hopkins decorated the return envelope with a number of stickers obtained at a local science-fiction convention. One sticker in particular caught Stallman's eye. It read, "Copyleft (L), All Rights Reversed." Following the release of the first version of GPL, Stallman paid tribute to the sticker, nicknaming the free software license "Copyleft." Over time, the nickname and its shorthand symbol, a backwards "C," would become an official Free Software Foundation synonym for the GPL.
+={copyleft;Hopkins, Don}
+
+The German sociologist Max Weber once proposed that all great religions are built upon the "routinization" or "institutionalization" of charisma. Every successful religion, Weber argued, converts the charisma or message of the original religious leader into a social, political, and ethical apparatus more easily translatable across cultures and time.
+={Weber, Max}
+
+While not religious per se, the GNU GPL certainly qualifies as an interesting example of this "routinization" process at work in the modern, decentralized world of software development. Since its unveiling, programmers and companies who have otherwise expressed little loyalty or allegiance to Stallman have willingly accepted the GPL bargain at face value. A few have even accepted the GPL as a preemptive protective mechanism for their own software programs. Even those who reject the GPL contract as too compulsory, still credit it as influential.
+
+One hacker falling into this latter group was Keith Bostic, a University of California employee at the time of the GPL 1.0 release. Bostic's department, the Computer Systems Research Group (SRG), had been involved in Unix development since the late 1970s and was responsible for many key parts of Unix, including the TCP/IP networking protocol, the cornerstone of modern Internet communications. By the late 1980s, AT&T, the original owner of the Unix brand name, began to focus on commercializing Unix and began looking to the Berkeley Software Distribution, or BSD, the academic version of Unix developed by Bostic and his Berkeley peers, as a key source of commercial technology.
+={AT&T+1;Berkely Software Distribution (BSD)+6;Bostic, Keith+5;BSD (Berkely Software Distribution)+6;Computer Systems Research Group;University of California+4;TCP/IP}
+
+% SRG referred to as CSRG below? ; additional TCP/IP ref included
+
+Although the Berkeley BSD source code was shared among researchers and commercial programmers with a source-code license, this commercialization presented a problem. The Berkeley code was intermixed with proprietary AT&T code. As a result, Berkeley distributions were available only to institutions that already had a Unix source license from AT&T. As AT&T raised its license fees, this arrangement, which had at first seemed innocuous, became increasingly burdensome.
+={licenses:AT&T UNIX source code and+2}
+
+Hired in 1986, Bostic had taken on the personal project of porting BSD over to the Digital Equipment Corporation's PDP-11 computer. It was during this period, Bostic says, that he came into close interaction with Stallman during Stallman's occasional forays out to the west coast. "I remember vividly arguing copyright with Stallman while he sat at borrowed workstations at CSRG," says Bostic. "We'd go to dinner afterward and continue arguing about copyright over dinner."
+={DEC (Digital Equipment Corporation);PDP-11 computer}
+
+% CSRG abbreviated to SRG above?
+
+The arguments eventually took hold, although not in the way Stallman would have liked. In June, 1989, Berkeley separated its networking code from the rest of the AT&T-owned operating system and distributed it under a University of California license. The contract terms were liberal. All a licensee had to do was give credit to the university in advertisements touting derivative programs.~{ The University of California's "obnoxious advertising clause" would later prove to be a problem. Looking for a less restrictive alternative to the GPL, some hackers used the University of California, replacing "University of California" with the name of their own instution. The result: free software programs that borrowed from dozens of other programs would have to cite dozens of institutions in advertisements. In 1999, after a decade of lobbying on Stallman's part, the University of California agreed to drop this clause. \\ See "The BSD License Problem" at http://www.gnu.org/philosophy/bsd.html. }~ In contrast to the GPL, proprietary offshoots were permissible. Only one problem hampered the license's rapid adoption: the BSD Networking release wasn't a complete operating system. People could study the code, but it could only be run in conjunction with other proprietary-licensed code.
+={AT&T+1}
+
+Over the next few years, Bostic and other University of California employees worked to replace the missing components and turn BSD into a complete, freely redistributable operating system. Although delayed by a legal challenge from Unix Systems Laboratories-the AT&T spin-off that retained ownership of the Unix brand name-the effort would finally bear fruit in the early 1990s. Even before then, however, many of the Berkeley utilities would make their way into Stallman's GNU Project.
+
+"I think it's highly unlikely that we ever would have gone as strongly as we did without the GNU influence," says Bostic, looking back. "It was clearly something where they were pushing hard and we liked the idea."
+
+By the end of the 1980s, the GPL was beginning to exert a gravitational effect on the free software community. A program didn't have to carry the GPL to qualify as free software-witness the case of the BSD utilities-but putting a program under the GPL sent a definite message. "I think the very existence of the GPL inspired people to think through whether they were making free software, and how they would license it," says Bruce Perens, creator of Electric Fence, a popular Unix utility, and future leader of the Debian GNU/Linux development team. A few years after the release of the GPL, Perens says he decided to discard Electric Fence's homegrown license in favor of Stallman's lawyer-vetted copyright. "It was actually pretty easy to do," Perens recalls.
+={Perens, Bruce}
+
+% extra Perens index ref added
+
+% ={Electric Fence Unix utility}
+
+Rich Morin, the programmer who had viewed Stallman's initial GNU announcement with a degree of skepticism, recalls being impressed by the software that began to gather under the GPL umbrella. As the leader of a SunOS user group, one of Morin's primary duties during the 1980s had been to send out distribution tapes containing the best freeware or free software utilities. The job often mandated calling up original program authors to verify whether their programs were copyright protected or whether they had been consigned to the public domain. Around 1989, Morin says, he began to notice that the best software programs typically fell under the GPL license. "As a software distributor, as soon as I saw the word GPL, I knew I was home free," recalls Morin.
+={SunOS}
+
+To compensate for the prior hassles that went into compiling distribution tapes to the Sun User Group, Morin had charged recipients a convenience fee. Now, with programs moving over to the GPL, Morin was suddenly getting his tapes put together in half the time, turning a tidy profit in the process. Sensing a commercial opportunity, Morin rechristened his hobby as a business: Prime Time Freeware.
+={Sun User Group}
+
+Such commercial exploitation was completely within the confines of the free software agenda. "When we speak of free software, we are referring to freedom, not price," advised Stallman in the GPL's preamble. By the late 1980s, Stallman had refined it to a more simple mnemonic: "Don't think free as in free beer; think free as in free speech."
+
+For the most part, businesses ignored Stallman's entreaties. Still, for a few entrepreneurs, the freedom associated with free software was the same freedom associated with free markets. Take software ownership out of the commercial equation, and you had a situation where even the smallest software company was free to compete against the IBMs and DECs of the world.
+
+One of the first entrepreneurs to grasp this concept was Michael Tiemann, a software programmer and graduate student at Stanford University. During the 1980s, Tiemann had followed the GNU Project like an aspiring jazz musician following a favorite artist. It wasn't until the release of the GNU C Compiler in 1987, however, that he began to grasp the full potential of free software. Dubbing GCC a "bombshell," Tiemann says the program's own existence underlined Stallman's determination as a programmer.
+={C Compiler (GNU)+9;GNU C Compiler (GCC)+9;GCC (GNU C Compiler)+9;Tiemann, Michael+8;Stanford University}
+
+"Just as every writer dreams of writing the great American novel, every programmer back in the 1980s talked about writing the great American compiler," Tiemman recalls. "Suddenly Stallman had done it. It was very humbling."
+
+"You talk about single points of failure, GCC was it," echoes Bostic. "Nobody had a compiler back then, until GCC came along."
+
+% ={Bostic, Keith}
+
+Rather than compete with Stallman, Tiemann decided to build on top of his work. The original version of GCC weighed in at 110,000 lines of code, but Tiemann recalls the program as surprisingly easy to understand. So easy in fact that Tiemann says it took less than five days to master and another week to port the software to a new hardware platform, National Semiconductor's 32032 microchip. Over the next year, Tiemann began playing around with the source code, creating a native compiler for the C+ programming language. One day, while delivering a lecture on the program at Bell Labs, Tiemann ran into some AT&T developers struggling to pull off the same thing.
+={C+ programming language}
+
+"There were about 40 or 50 people in the room, and I asked how many people were working on the native code compiler," Tiemann recalls. "My host said the information was confidential but added that if I took a look around the room I might get a good general idea."
+
+It wasn't long after, Tiemann says, that the light bulb went off in his head. "I had been working on that project for six months," Tiemann says. I just thought to myself, whether it's me or the code this is a level of efficiency that the free market should be ready to reward."
+
+Tiemann found added inspiration in the GNU Manifesto, which, while excoriating the greed of some software vendors, encourages other vendors to consider the advantages of free software from a consumer point of view. By removing the power of monopoly from the commerical software question, the GPL makes it possible for the smartest vendors to compete on the basis of service and consulting, the two most profit-rich corners of the software marketplace.
+={GNU Manifesto}
+
+% added GNU Manifesto
+
+In a 1999 essay, Tiemann recalls the impact of Stallman's Manifesto. "It read like a socialist polemic, but I saw something different. I saw a business plan in disguise."~{ See Michael Tiemann, "Future of Cygnus Solutions: An Entrepreneur's Account," Open Sources (O'Reilly & Associates, Inc., 1999): 139. }~
+
+Teaming up with John Gilmore, another GNU Project fan, Tiemann launched a software consulting service dedicated to customizing GNU programs. Dubbed Cygnus Support, the company signed its first development contract in February, 1990. By the end of the year, the company had $725,000 worth of support and development contracts.
+={Gilmore, John}
+
+% added Gilmore
+
+GNU Emacs, GDB, and GCC were the "big three" of developer-oriented tools, but they weren't the only ones developed by Stallman during the GNU Project's first half decade. By 1990, Stallman had also generated GNU versions of the Bourne Shell (rechristened the Bourne Again Shell, or BASH), YACC (rechristened Bison), and awk (rechristened gawk). Like GCC , every GNU program had to be designed to run on multiple systems, not just a single vendor's platform. In the process of making programs more flexible, Stallman and his collaborators often made them more useful as well.
+
+Recalling the GNU universalist approach, Prime Time Freeware's Morin points to a critical, albeit mundane, software package called hello. "It's the hello world program which is five lines of C, packaged up as if it were a GNU distribution," Morin says. "And so it's got the Texinfo stuff and the configure stuff. It's got all the other software engineering goo that the GNU Project has come up with to allow packages to port to all these different environments smoothly. That's tremendously important work, and it affects not only all of [Stallman's] software, but also all of the other GNU Project software."
+
+According to Stallman, improving software programs was secondary to building them in the first place. "With each piece I may or may not find a way to improve it," said Stallman to Byte. "To some extent I am getting the benefit of reimplementation, which makes many systems much better. To some extent it's because I have been in the field a long time and worked on many other systems. I therefore have many ideas to bring to bear."~{ See Richard Stallman, BYTE (1986). }~
+={Byte magazine}
+
+Nevertheless, as GNU tools made their mark in the late 1980s, Stallman's AI Lab-honed reputation for design fastidiousness soon became legendary throughout the entire software-development community.
+
+Jeremy Allison, a Sun user during the late 1980s and programmer destined to run his own free software project, Samba, in the 1990s, recalls that reputation with a laugh. During the late 1980s, Allison began using Emacs. Inspired by the program's community-development model, Allison says he sent in a snippet of source code only to have it rejected by Stallman.
+={Allison, Jeramy+1}
+
+"It was like the Onion headline," Allison says. "`Child's prayers to God answered: No.'"
+={Onion, The}
+
+Stallman's growing stature as a software programmer, however, was balanced by his struggles as a project manager. Although the GNU Project moved from success to success in creation of developer-oriented tools, its inability to generate a working kernel-the central "traffic cop" program in all Unix systems that determines which devices and applications get access to the microprocessor and when-was starting to elicit grumbles as the 1980s came to a close. As with most GNU Project efforts, Stallman had started kernel development by looking for an existing program to modify. According to a January 1987 "Gnusletter," Stallman was already working to overhaul TRIX, a Unix kernel developed at MIT.
+
+A review of GNU Project "GNUsletters" of the late 1980s reflects the management tension. In January, 1987, Stallman announced to the world that the GNU Project was working to overhaul TRIX, a Unix kernel developed at MIT. A year later, in February of 1988, the GNU Project announced that it had shifted its attentions to Mach, a lightweight "micro-kernel" developed at Carnegie Mellon. All told, however, official GNU Project kernel development wouldn't commence until 1990.~{ See "HURD History." \\ http://www.gnu.org/software/hurd/history.html }~
+
+% ={Carnegie Mellon University}
+
+The delays in kernel development were just one of many concerns weighing on Stallman during this period. In 1989, Lotus Development Corporation filed suit against rival software company, Paperback Software International, for copying menu commands in Lotus' popular 1-2-3 Spreadsheet program. Lotus' suit, coupled with the Apple-Microsoft "look and feel" battle, provided a troublesome backdrop for the GNU Project. Although both suits fell outside the scope of the GNU Project, both revolved around operating systems and software applications developed for the personal computer, not Unix-compatible hardware systems-they threatened to impose a chilling effect on the entire culture of software development. Determined to do something, Stallman recruited a few programmer friends and composed a magazine ad blasting the lawsuits. He then followed up the ad by helping to organize a group to protest the corporations filing the suit. Calling itself the League of Programming Freedom, the group held protests outside the offices of Lotus, Inc. and the Boston courtroom hosting the Lotus trial.
+={Apple Computers;Lotus Development Corp.;Microsoft Corporation:Apple Computer lawsuit;Paperback Software International}
+
+The protests were notable.~{ According to a League of Programming Freedom Press, the protests were notable for featuring the first hexadecimal protest chant: \\ 1-2-3-4, toss the lawyers out the door; \\ 5-6-7-8, innovate don't litigate; \\ 9-A-B-C, 1-2-3 is not for me; \\ D-E-F-O, look and feel have got to go \\ http://lpf.ai.mit.edu/Links/prep.ai.mit.edu/demo.final.release }~ They document the evolving nature of software industry. Applications had quietly replaced operating systems as the primary corporate battleground. In its unfulfilled quest to build a free software operating system, the GNU Project seemed hopelessly behind the times. Indeed, the very fact that Stallman had felt it necessary to put together an entirely new group dedicated to battling the "look and feel" lawsuits reinforced that obsolescence in the eyes of some observers.
+
+In 1990, the John D. and Catherine T. MacArthur Foundation cerified Stallman's genius status when it granted Stallman a MacArthur fellowship, therefore making him a recipient for the organization's so-called "genius grant." The grant, a $240,000 reward for launching the GNU Project and giving voice to the free software philosophy, relieved a number of short-term concerns. First and foremost, it gave Stallman, a nonsalaried employee of the FSF who had been supporting himself through consulting contracts, the ability to devote more time to writing GNU code.~{ I use the term "writing" here loosely. About the time of the MacArthur award, Stallman began suffering chronic pain in his hands and was dictating his work to FSF-employed typists. Although some have speculated that the hand pain was the result of repetitive stress injury, or RSI, an injury common among software programmers, Stallman is not 100% sure. "It was NOT carpal tunnel syndrome," he writes. "My hand problem was in the hands themselves, not in the wrists." Stallman has since learned to work without typists after switching to a keyboard with a lighter touch. }~
+
+Ironically, the award also made it possible for Stallman to vote. Months before the award, a fire in Stallman's apartment house had consumed his few earthly possessions. By the time of the award, Stallman was listing himself as a "squatter"~{ See Reuven Lerner, "Stallman wins $240,000 MacArthur award," MIT, The Tech (July 18, 1990).
+http://the-tech.mit.edu/V110/N30/rms.30n.html }~ at 545 Technology Square. "[The registrar of voters] didn't want to accept that as my address," Stallman would later recall. "A newspaper article about the MacArthur grant said that and then they let me register."~{ See Michael Gross, "Richard Stallman: High School Misfit, Symbol of Free Software, MacArthur-certified Genius" (1999). }~
+
+Most importantly, the MacArthur money gave Stallman more freedom. Already dedicated to the issue of software freedom, Stallman chose to use the additional freedom to increase his travels in support of the GNU Project mission.
+
+Interestingly, the ultimate success of the GNU Project and the free software movement in general would stem from one of these trips. In 1990, Stallman paid a visit to the Polytechnic University in Helsinki, Finland. Among the audience members was 21-year-old Linus Torvalds, future developer of the Linux kernel-the free software kernel destined to fill the GNU Project's most sizable gap.
+={Helsinki, Finland+3;Polytechnic University (Finland);Torvalds, Linus+16}
+
+A student at the nearby University of Helsinki at the time, Torvalds regarded Stallman with bemusement. "I saw, for the first time in my life, the stereotypical long-haired, bearded hacker type," recalls Torvalds in his 2001 autobiography Just for Fun. "We don't have much of them in Helsinki."~{ See Linus Torvalds and David Diamond, Just For Fun: The Story of an Accidentaly Revolutionary (HarperCollins Publishers, Inc., 2001): 58-59. }~
+={University of Helsinki+2}
+
+While not exactly attuned to the "sociopolitical" side of the Stallman agenda, Torvalds nevertheless appreciated the agenda's underlying logic: no programmer writes error-free code. By sharing software, hackers put a program's improvement ahead of individual motivations such as greed or ego protection.
+
+Like many programmers of his generation, Torvalds had cut his teeth not on mainframe computers like the IBM 7094, but on a motley assortment of home-built computer systems. As university student, Torvalds had made the step up from C programming to Unix, using the university's MicroVAX. This ladder-like progression had given Torvalds a different perspective on the barriers to machine access. For Stallman, the chief barriers were bureaucracy and privilege. For Torvalds, the chief barriers were geography and the harsh Helsinki winter. Forced to trek across the University of Helsinki just to log in to his Unix account, Torvalds quickly began looking for a way to log in from the warm confines of his off-campus apartment.
+={IBM 7094 computer;MicroVAX+1}
+
+The search led Torvalds to the operating system Minix, a lightweight version of Unix developed for instructional purposes by Dutch university professor Andrew Tanenbaum. The program fit within the memory confines of a 386 PC, the most powerful machine Torvalds could afford, but still lacked a few necessary features. It most notably lacked terminal emulation, the feature that allowed Torvalds' machine to mimic a university terminal, making it possible to log in to the MicroVAX from home.
+={Minix operating system+2;Unix operating system:Minix and;Tanenbaum, Andrew}
+
+During the summer of 1991, Torvalds rewrote Minix from the ground up, adding other features as he did so. By the end of the summer, Torvalds was referring to his evolving work as the "GNU/Emacs of terminal emulation programs."~{ See Linus Torvalds and David Diamond, Just For Fun: The Story of an Accidentaly Revolutionary (HarperCollins Publishers, Inc., 2001): 78. }~ Feeling confident, he solicited a Minix newsgroup for copies of the POSIX standards, the software blue prints that determined whether a program was Unix compatible. A few weeks later, Torvalds was posting a message eerily reminiscent of Stallman's original 1983 GNU posting:
+={Linux:001 version of+6;POSIX standards}
+
+poem{
+
+Hello everybody out there using minix-
+
+I'm doing a (free) operating system (just a hobby, won't be big and
+professional like gnu for 386 (486) AT clones). This has been brewing
+since April, and is starting to get ready. I'd like any feedback on
+things people like/dislike in minix, as my OS resembles it somewhat
+(same physical layout of the file-system (due to practical reasons)
+among other things).
+
+}poem~{ See "Linux 10th Anniversary." \\ http://www.linux10.org/history/ }~
+
+The posting drew a smattering of responses and within a month, Torvalds had posted a 0.01 version of the operating system-i.e., the earliest possible version fit for outside review-on an Internet FTP site. In the course of doing so, Torvalds had to come up with a name for the new system. On his own PC hard drive, Torvalds had saved the program as Linux, a name that paid its respects to the software convention of giving each Unix variant a name that ended with the letter X. Deeming the name too "egotistical," Torvalds changed it to Freax, only to have the FTP site manager change it back.
+={Freax}
+
+Although Torvalds had set out build a full operating system, both he and other developers knew at the time that most of the functional tools needed to do so were already available, thanks to the work of GNU, BSD, and other free software developers. One of the first tools the Linux development team took advantage of was the GNU C Compiler, a tool that made it possible to process programs written in the C programming language.
+={C Compiler (GNU):Linux development and+3;GNU C Compiler (GCC):Linux development and;GCC (GNU C Compiler):Linux development and}}
+
+Integrating GCC improved the performance of Linux. It also raised issues. Although the GPL's "viral" powers didn't apply to the Linux kernel, Torvald's willingness to borrow GCC for the purposes of his own free software operating system indicated a certain obligation to let other users borrow back. As Torvalds would later put it: "I had hoisted myself up on the shoulders of giants."~{ See Linus Torvalds and David Diamond, Just For Fun: The Story of an Accidentaly Revolutionary (HarperCollins Publishers, Inc., 2001): 96-97. }~ Not surprisingly, he began to think about what would happen when other people looked to him for similar support. A decade after the decision, Torvalds echoes the Free Software Foundation's Robert Chassel when he sums up his thoughts at the time:
+
+_1 You put six months of your life into this thing and you want to make it available and you want to get something out of it, but you don't want people to take advantage of it. I wanted people to be able to see [Linux], and to make changes and improvements to their hearts' content. But I also wanted to make sure that what I got out of it was to see what they were doing. I wanted to always have access to the sources so that if they made improvements, I could make those improvements myself.~{ See Linus Torvalds and David Diamond, Just For Fun: The Story of an Accidentaly Revolutionary (HarperCollins Publishers, Inc., 2001): 94-95. }~
+
+When it was time to release the 0.12 version of Linux, the first to include a fully integrated version of GCC, Torvalds decided to voice his allegiance with the free software movement. He discarded the old kernel license and replaced it with the GPL. The decision triggered a porting spree, as Torvalds and his collaborators looked to other GNU programs to fold into the growing Linux stew. Within three years, Linux developers were offering their first production release, Linux 1.0, including fully modified versions of GCC, GDB, and a host of BSD tools.
+
+By 1994, the amalgamated operating system had earned enough respect in the hacker world to make some observers wonder if Torvalds hadn't given away the farm by switching to the GPL in the project's initial months. In the first issue of Linux Journal, publisher Robert Young sat down with Torvalds for an interview. When Young asked the Finnish programmer if he felt regret at giving up private ownership of the Linux source code, Torvalds said no. "Even with 20/20 hindsight," Torvalds said, he considered the GPL "one of the very best design decisions" made during the early stages of the Linux project.~{ See Robert Young, "Interview with Linus, the Author of Linux," Linux Journal (March 1, 1994). \\ http://www.linuxjournal.com/article.php?sid=2736 }~
+={Young, Robert}
+
+% robert young entry added
+
+That the decision had been made with zero appeal or deference to Stallman and the Free Software Foundation speaks to the GPL's growing portability. Although it would take a few years to be recognized by Stallman, the explosiveness of Linux development conjured flashbacks of Emacs. This time around, however, the innovation triggering the explosion wasn't a software hack like Control-R but the novelty of running a Unix-like system on the PC architecture. The motives may have been different, but the end result certainly fit the ethical specifications: a fully functional operating system composed entirely of free software.
+={Control-R (^R)}
+
+As his initial email message to the comp.os.minix newsgroup indicates, it would take a few months before Torvalds saw Linux as anything less than a holdover until the GNU developers delivered on the HURD kernel. This initial unwillingness to see Linux in political terms would represent a major blow to the Free Software Foundation.
+={HURD kernel}
+
+% HURD kernel added reference
+
+As far as Torvalds was concerned, he was simply the latest in a long line of kids taking apart and reassembling things just for fun. Nevertheless, when summing up the runaway success of a project that could have just as easily spent the rest of its days on an abandoned computer hard drive, Torvalds credits his younger self for having the wisdom to give up control and accept the GPL bargain.
+
+"I may not have seen the light," writes Torvalds, reflecting on Stallman's 1991 Polytechnic University speech and his subsequent decision to switch to the GPL. "But I guess something from his speech sunk in ."~{ See Linus Torvalds and David Diamond, Just For Fun: The Story of an Accidentaly Revolutionary (HarperCollins Publishers, Inc., 2001): 59. }~
+
+1~ Chapter 10 - GNU/Linux
+={GNU/Linux+45;Linux+45;Stallman, Richard M.:GNU Linux+46}
+
+% extended Linux reference as with GNU/Linux to chapter
+
+By 1993, the free software movement was at a crossroads. To the optimistically inclined, all signs pointed toward success for the hacker culture. Wired magazine, a funky, new publication offering stories on data encryption, Usenet, and software freedom, was flying off magazine racks. The Internet, once a slang term used only by hackers and research scientists, had found its way into mainstream lexicon. Even President Clinton was using it. The personal computer, once a hobbyist's toy, had grown to full-scale respectability, giving a whole new generation of computer users access to hacker-built software. And while the GNU Project had not yet reached its goal of a fully intact, free software operating system, curious users could still try Linux in the interim.
+={Internet+3;Wired magazine;PCs (personal computers)+2;personal computers (PCs)+2}
+
+Any way you sliced it, the news was good, or so it seemed. After a decade of struggle, hackers and hacker values were finally gaining acceptance in mainstream society. People were getting it.
+
+Or were they? To the pessimistically inclined, each sign of acceptance carried its own troubling countersign. Sure, being a hacker was suddenly cool, but was cool good for a community that thrived on alienation? Sure, the White House was saying all the right things about the Internet, even going so far as to register its own domain name, whitehouse.gov, but it was also meeting with the companies, censorship advocates, and law-enforcement officials looking to tame the Internet's Wild West culture. Sure, PCs were more powerful, but in commoditizing the PC marketplace with its chips, Intel had created a situation in which proprietary software vendors now held the power. For every new user won over to the free software cause via Linux, hundreds, perhaps thousands, were booting up Microsoft Windows for the first time.
+={Intel}
+
+% Intel index ref added
+
+Finally, there was the curious nature of Linux itself. Unrestricted by design bugs (like GNU) and legal disputes (like BSD), Linux' high-speed evolution had been so unplanned, its success so accidental, that programmers closest to the software code itself didn't know what to make of it. More compilation album than operating system, it was comprised of a hacker medley of greatest hits: everything from GCC, GDB, and glibc (the GNU Project's newly developed C Library) to X (a Unix-based graphic user interface developed by MIT's Laboratory for Computer Science) to BSD-developed tools such as BIND (the Berkeley Internet Naming Daemon, which lets users substitute easy-to-remember Internet domain names for numeric IP addresses) and TCP/IP. The arch's capstone, of course, was the Linux kernel-itself a bored-out, super-charged version of Minix. Rather than building their operating system from scratch, Torvalds and his rapidly expanding Linux development team had followed the old Picasso adage, "good artists borrow; great artists steal." Or as Torvalds himself would later translate it when describing the secret of his success: "I'm basically a very lazy person who likes to take credit for things other people actually do."~{ Torvalds has offered this quote in many different settings. To date, however, the quote's most notable appearance is in the Eric Raymond essay, "The Cathedral and the Bazaar" (May, 1997). \\ http://www.tuxedo.org/~esr/writings/cathedral-bazaar/cathedral-bazaar/index.html }~
+={BIND (Berkely Internet Naming Daemon);Berkely Internet Naming Daemon (BIND);C programming language:glibc;GNU Debugger (GDB):Linux and;GDB (GNU Debugger): Linux and;glibc (GNU C Library);GNU C Library (glibc);kernel (Linux);X graphic user interface;Laboratory for Computer Science:X, developing;Minix operating system:kernel, used for Linux;TCP/IP;Torvalds, Linus:Minix, reworking for Linux+2}
+
+Such laziness, while admirable from an efficiency perspective, was troubling from a political perspective. For one thing, it underlined the lack of an ideological agenda on Torvalds' part. Unlike the GNU developers, Torvalds hadn't built an operating system out of a desire to give his fellow hackers something to work with; he'd built it to have something he himself could play with. Like Tom Sawyer whitewashing a fence, Torvalds' genius lay less in the overall vision and more in his ability to recruit other hackers to speed the process.
+
+That Torvalds and his recruits had succeeded where others had not raised its own troubling question: what, exactly, was Linux? Was it a manifestation of the free software philosophy first articulated by Stallman in the GNU Manifesto? Or was it simply an amalgamation of nifty software tools that any user, similarly motivated, could assemble on his own home system?
+={GNU Manifesto}
+
+% added GNU Manifesto
+
+By late 1993, a growing number of Linux users had begun to lean toward the latter definition and began brewing private variations on the Linux theme. They even became bold enough to bottle and sell their variations-or "distributions"-to fellow Unix aficionados. The results were spotty at best.
+
+"This was back before Red Hat and the other commercial distributions," remembers Ian Murdock, then a computer science student at Purdue University. "You'd flip through Unix magazines and find all these business card-sized ads proclaiming `Linux.' Most of the companies were fly-by-night operations that saw nothing wrong with slipping a little of their own source code into the mix."
+={Murdock, Ian+38;Red Hat Inc.;Purdue University}
+
+Murdock, a Unix programmer, remembers being "swept away" by Linux when he first downloaded and installed it on his home PC system. "It was just a lot of fun," he says. "It made me want to get involved." The explosion of poorly built distributions began to dampen his early enthusiasm, however. Deciding that the best way to get involved was to build a version of Linux free of additives, Murdock set about putting a list of the best free software tools available with the intention of folding them into his own distribution. "I wanted something that would live up to the Linux name," Murdock says.
+
+In a bid to "stir up some interest," Murdock posted his intentions on the Internet, including Usenet's comp.os.linux newsgroup. One of the first responding email messages was from rms@ai.mit.edu. As a hacker, Murdock instantly recognized the address. It was Richard M. Stallman, founder of the GNU Project and a man Murdock knew even back then as "the hacker of hackers." Seeing the address in his mail queue, Murdock was puzzled. Why on Earth would Stallman, a person leading his own operating-system project, care about Murdock's gripes over Linux?
+
+Murdock opened the message.
+
+"He said the Free Software Foundation was starting to look closely at Linux and that the FSF was interested in possibly doing a Linux system, too. Basically, it looked to Stallman like our goals were in line with their philosophy."
+={Free Software Foundation (FSF):Linux and+3}
+
+The message represented a dramatic about-face on Stallman's part. Until 1993, Stallman had been content to keep his nose out of the Linux community's affairs. In fact, he had all but shunned the renegade operating system when it first appeared on the Unix programming landscape in 1991. After receiving the first notification of a Unix-like operating system that ran on PCs, Stallman says he delegated the task of examining the new operating system to a friend. Recalls Stallman, "He reported back that the software was modeled after System V, which was the inferior version of Unix. He also told me it wasn't portable."
+={System V}
+
+The friend's report was correct. Built to run on 386-based machines, Linux was firmly rooted to its low-cost hardware platform. What the friend failed to report, however, was the sizable advantage Linux enjoyed as the only freely modifiable operating system in the marketplace. In other words, while Stallman spent the next three years listening to bug reports from his HURD team, Torvalds was winning over the programmers who would later uproot and replant the operating system onto new platforms.
+
+By 1993, the GNU Project's inability to deliver a working kernel was leading to problems both within the GNU Project and within the free software movement at large. A March, 1993, a Wired magazine article by Simson Garfinkel described the GNU Project as "bogged down" despite the success of the project's many tools.~{ See Simson Garfinkel, "Is Stallman Stalled?" Wired (March, 1993). }~ Those within the project and its nonprofit adjunct, the Free Software Foundation, remember the mood as being even worse than Garfinkel's article let on. "It was very clear, at least to me at the time, that there was a window of opportunity to introduce a new operating system," says Chassell. "And once that window was closed, people would become less interested. Which is in fact exactly what happened."~{ Chassel's concern about there being a 36-month "window" for a new operating system is not unique to the GNU Project. During the early 1990s, free software versions of the Berkeley Software Distribution were held up by Unix System Laboratories' lawsuit restricting the release of BSD-derived software. While many users consider BSD offshoots such as FreeBSD and OpenBSD to be demonstrably superior to GNU/Linux both in terms of performance and security, the number of FreeBSD and OpenBSD users remains a fraction of the total GNU/Linux user population. \\ To view a sample analysis of the relative success of GNU/Linux in relation to other free software operating systems, see the essay by New Zealand hacker, Liam Greenwood, "Why is Linux Successful" (1999). }~
+={Garfinkel, Simson;GNU Project:kernel;Wired magazine:GNU Project and}
+
+% ={Chassell, Robert}
+
+% note difference in spelling of name Chasell/Chassel in footnote
+
+Much has been made about the GNU Project's struggles during the 1990-1993 period. While some place the blame on Stallman for those struggles, Eric Raymond, an early member of the GNU Emacs team and later Stallman critic, says the problem was largely institutional. "The FSF got arrogant," Raymond says. "They moved away from the goal of doing a production-ready operating system to doing operating-system research." Even worse, "They thought nothing outside the FSF could affect them."
+={HURD kernel+4;Raymond, Eric}
+
+Murdock, a person less privy to the inner dealings of the GNU Project, adopts a more charitable view. "I think part of the problem is they were a little too ambitious and they threw good money after bad," he says. "Micro-kernels in the late 80s and early 90s were a hot topic. Unfortunately, that was about the time that the GNU Project started to design their kernel. They ended up with alot of baggage and it would have taken a lot of backpedaling to lose it."
+
+Stallman cites a number of issues when explaining the delay. The Lotus and Apple lawsuits had provided political distractions, which, coupled with Stallman's inability to type, made it difficult for Stallman to lend a helping hand to the HURD team. Stallman also cites poor communication between various portions of the GNU Project. "We had to do a lot of work to get the debugging environment to work," he recalls. "And the people maintaining GDB at the time were not that cooperative." Mostly, however, Stallman says he and the other members of the GNU Project team underestimated the difficulty of expanding the Mach microkernal into a full-fledged Unix kernel.
+
+"I figured, OK, the [Mach] part that has to talk to the machine has already been debugged," Stallman says, recalling the HURD team's troubles in a 2000 speech. "With that head start, we should be able to get it done faster. But instead, it turned out that debugging these asynchronous multithreaded programs was really hard. There were timing books that would clobber the files, and that's no fun. The end result was that it took many, many years to produce a test version."~{ See Maui High Performance Computing Center Speech. }~
+
+Whatever the excuse, or excuses, the concurrent success of the Linux-kernel team created a tense situation. Sure, the Linux kernel had been licensed under the GPL, but as Murdock himself had noted, the desire to treat Linux as a purely free software operating system was far from uniform. By late 1993, the total Linux user population had grown from a dozen or so Minix enthusiasts to somewhere between 20,000 and 100,000.~{ GNU/Linux user-population numbers are sketchy at best, which is why I've provided such a broad range. The 100,000 total comes from the Red Hat "Milestones" site, \\ http://www.redhat.com/about/corporate/milestones.html }~ What had once been a hobby was now a marketplace ripe for exploitation. Like Winston Churchill watching Soviet troops sweep into Berlin, Stallman felt an understandable set of mixed emotions when it came time to celebrate the Linux "victory."~{ I wrote this Winston Churchill analogy before Stallman himself sent me his own unsolicited comment on Churchill: \\ _1 World War II and the determination needed to win it was a very strong memory as I was growing up. Statements such as Churchill's, "We will fight them in the landing zones, we will fight them on the beaches . . . we will never surrender," have always resonated for me. }~
+
+Although late to the party, Stallman still had clout. As soon as the FSF announced that it would lend its money and moral support to Murdock's software project, other offers of support began rolling in. Murdock dubbed the new project Debian-a compression of his and his wife, Deborah's, names-and within a few weeks was rolling out the first distribution. "[Richard's support] catapulted Debian almost overnight from this interesting little project to something people within the community had to pay attention to," Murdock says.
+={Debian+19}
+
+In January of 1994, Murdock issued the " Debian Manifesto." Written in the spirit of Stallman's "GNU Manifesto" from a decade before, it explained the importance of working closely with the Free Software Foundation. Murdock wrote:
+={Debian Manifesto+3;Free Software Foundation (FSF):Debian Manifesto and;GNU Manifesto:Debian Manifesto and}
+
+% added GNU Manifesto
+
+_1 The Free Software Foundation plays an extremely important role in the future of Debian. By the simple fact that they will be distributing it, a message is sent to the world that Linux is not a commercial product and that it never should be, but that this does not mean that Linux will never be able to compete commercially. For those of you who disagree, I challenge you to rationalize the success of GNU Emacs and GCC, which are not commercial software but which have had quite an impact on the commercial market regardless of that fact.
+
+_1 The time has come to concentrate on the future of Linux rather than on the destructive goal of enriching oneself at the expense of the entire Linux community and its future. The development and distribution of Debian may not be the answer to the problems that I have outlined in the Manifesto, but I hope that it will at least attract enough attention to these problems to allow them to be solved.~{ See Ian Murdock, "A Brief History of Debian," (January 6, 1994): Appendix A, "The Debian Manifesto." \\ http://www.debian.org/doc/manuals/project-history/apA.html }~
+
+Shortly after the Manifesto's release, the Free Software Foundation made its first major request. Stallman wanted Murdock to call its distribution "GNU/Linux." At first, Murdock says, Stallman had wanted to use the term " Lignux"-"as in Linux with GNU at the heart of it"-but a sample testing of the term on Usenet and in various impromptu hacker focus groups had merited enough catcalls to convince Stallman to go with the less awkward GNU/Linux.
+={Lignux (Linux with GNU)}
+
+Although some would dismiss Stallman's attempt to add the "GNU" prefix as a belated quest for credit, Murdock saw it differently. Looking back, Murdock saw it as an attempt to counteract the growing tension between GNU Project and Linux-kernel developers. "There was a split emerging," Murdock recalls. "Richard was concerned."
+
+The deepest split, Murdock says, was over glibc. Short for GNU C Library, glibc is the package that lets programmers make "system calls" directed at the kernel. Over the course of 1993-1994, glibc emerged as a troublesome bottleneck in Linux development. Because so many new users were adding new functions to the Linux kernel, the GNU Project's glibc maintainers were soon overwhelmed with suggested changes. Frustrated by delays and the GNU Project's growing reputation for foot-dragging, some Linux developers suggested creating a " fork"-i.e., a Linux-specific C Library parallel to glibc.
+={C programming language:glibc+3;glibc (GNU C Library)+3;GNU C Library (glibc)+3}
+
+In the hacker world, forks are an interesting phenomenon. Although the hacker ethic permits a programmer to do anything he wants with a given program's source code, most hackers prefer to pour their innovations into a central source-code file or "tree" to ensure compatibility with other people's programs. To fork glibc this early in the development of Linux would have meant losing the potential input of hundreds, even thousands, of Linux developers. It would also mean growing incompatibility between Linux and the GNU system that Stallman and the GNU team still hoped to develop.
+={forks (code)+3;tree (source code)}
+
+As leader of the GNU Project, Stallman had already experienced the negative effects of a software fork in 1991. A group of Emacs developers working for a software company named Lucid had a falling out over Stallman's unwillingness to fold changes back into the GNU Emacs code base. The fork had given birth to a parallel version, Lucid Emacs, and hard feelings all around.~{ Jamie Zawinski, a former Lucid programmer who would go on to head the Mozilla development team, has a web site that documents the Lucid/GNU Emacs fork, titled, "The Lemacs/FSFmacs Schism." \\ http://www.jwz.org/doc/lemacs.html }~
+={Emacs text editor:Lucid software company and;GNU Emacs:Lucid software company and;Lucid software company}
+
+Murdock says Debian was mounting work on a similar fork in glibc source code that motivated Stallman to insist on adding the GNU prefix when Debian rolled out its software distribution. "The fork has since converged. Still, at the time, there was a concern that if the Linux community saw itself as a different thing as the GNU community, it might be a force for disunity."
+
+Stallman seconds Murdock's recollection. In fact, he says there were nascent forks appearing in relation to every major GNU component. At first, Stallman says he considered the forks to be a product of sour grapes. In contrast to the fast and informal dynamics of the Linux-kernel team, GNU source-code maintainers tended to be slower and more circumspect in making changes that might affect a program's long-term viability. They also were unafraid of harshly critiquing other people's code. Over time, however, Stallman began to sense that there was an underlying lack of awareness of the GNU Project and its objectives when reading Linux developers' emails.
+
+"We discovered that the people who considered themselves Linux users didn't care about the GNU Project," Stallman says. "They said, `Why should I bother doing these things? I don't care about the GNU Project. It's working for me. It's working for us Linux users, and nothing else matters to us.' And that was quite surprising given that people were essentially using a variant of the GNU system, and they cared so little. They cared less than anybody else about GNU."
+
+While some viewed descriptions of Linux as a "variant" of the GNU Project as politically grasping, Murdock, already sympathetic to the free software cause, saw Stallman's request to call Debian's version GNU/Linux as reasonable. "It was more for unity than for credit," he says.
+
+Requests of a more technical nature quickly followed. Although Murdock had been accommodating on political issues, he struck a firmer pose when it came to the design and development model of the actual software. What had begun as a show of solidarity soon became of model of other GNU projects.
+
+"I can tell you that I've had my share of disagreements with him," says Murdock with a laugh. "In all honesty Richard can be a fairly difficult person to work with."
+
+In 1996, Murdock, following his graduation from Purdue, decided to hand over the reins of the growing Debian project. He had already been ceding management duties to Bruce Perens, the hacker best known for his work on Electric Fence, a Unix utility released under the GPL. Perens, like Murdock, was a Unix programmer who had become enamored of GNU/Linux as soon as the program's Unix-like abilities became manifest. Like Murdock, Perens sympathized with the political agenda of Stallman and the Free Software Foundation, albeit from afar.
+={Electric Fence Unix utility; Perens, Bruce+3}
+
+"I remember after Stallman had already come out with the GNU Manifesto, GNU Emacs, and GCC, I read an article that said he was working as a consultant for Intel," says Perens, recalling his first brush with Stallman in the late 1980s. "I wrote him asking how he could be advocating free software on the one hand and working for Intel on the other. He wrote back saying, `I work as a consultant to produce free software.' He was perfectly polite about it, and I thought his answer made perfect sense."
+
+As a prominent Debian developer, however, Perens regarded Murdock's design battles with Stallman with dismay. Upon assuming leadership of the development team, Perens says he made the command decision to distance Debian from the Free Software Foundation. "I decided we did not want Richard's style of micro-management," he says.
+
+According to Perens, Stallman was taken aback by the decision but had the wisdom to roll with it. "He gave it some time to cool off and sent a message that we really needed a relationship. He requested that we call it GNU/Linux and left it at that. I decided that was fine. I made the decision unilaterally. Everybody breathed a sigh of relief."
+
+Over time, Debian would develop a reputation as the hacker's version of Linux, alongside Slackware, another popular distribution founded during the same 1993-1994 period. Outside the realm of hacker-oriented systems, however, Linux was picking up steam in the commercial Unix marketplace. In North Carolina, a Unix company billing itself as Red Hat was revamping its business to focus on Linux. The chief executive officer was Robert Young, the former Linux Journal editor who in 1994 had put the question to Linus Torvalds, asking whether he had any regrets about putting the kernel under the GPL. To Young, Torvalds' response had a "profound" impact on his own view toward Linux. Instead of looking for a way to corner the GNU/Linux market via traditional software tactics, Young began to consider what might happen if a company adopted the same approach as Debian-i.e., building an operating system completely out of free software parts. Cygnus Solutions, the company founded by Michael Tiemann and John Gilmore in 1990, was already demonstrating the ability to sell free software based on quality and customizability. What if Red Hat took the same approach with GNU/Linux?
+={Gilmore, John; Young, Robert+2;Red Hat Inc.;Teimann, Michael;Slackware}
+
+% added Gilmore and Robert Young, Teimann
+
+"In the western scientific tradition we stand on the shoulders of giants," says Young, echoing both Torvalds and Sir Isaac Newton before him. "In business, this translates to not having to reinvent wheels as we go along. The beauty of [the GPL] model is you put your code into the public domain.~{ Young uses the term "public domain" incorrectly here. Public domain means not protected by copyright. GPL-protected programs are by definition protected by copyright. }~ If you're an independent software vendor and you're trying to build some application and you need a modem-dialer, well, why reinvent modem dialers? You can just steal PPP off of Red Hat Linux and use that as the core of your modem-dialing tool. If you need a graphic tool set, you don't have to write your own graphic library. Just download GTK. Suddenly you have the ability to reuse the best of what went before. And suddenly your focus as an application vendor is less on software management and more on writing the applications specific to your customer's needs."
+
+Young wasn't the only software executive intrigued by the business efficiencies of free software. By late 1996, most Unix companies were starting to wake up and smell the brewing source code. The Linux sector was still a good year or two away from full commercial breakout mode, but those close enough to the hacker community could feel it: something big was happening. The Intel 386 chip, the Internet, and the World Wide Web had hit the marketplace like a set of monster waves, and Linux-and the host of software programs that echoed it in terms of source-code accessibility and permissive licensing-seemed like the largest wave yet.
+
+For Ian Murdock, the programmer courted by Stallman and then later turned off by Stallman's micromanagement style, the wave seemed both a fitting tribute and a fitting punishment for the man who had spent so much time giving the free software movement an identity. Like many Linux aficionados, Murdock had seen the original postings. He'd seen Torvalds's original admonition that Linux was "just a hobby." He'd also seen Torvalds's admission to Minix creator Andrew Tanenbaum: "If the GNU kernel had been ready last spring, I'd not have bothered to even start my project."~{ This quote is taken from the much-publicized Torvalds-Tanenbaum "flame war" following the initial release of Linux. In the process of defending his choice of a nonportable monolithic kernel design, Torvalds says he started working on Linux as a way to learn more about his new 386 PC. "If the GNU kernel had been ready last spring, I'd not have bothered to even start my project." See Chris DiBona et al., Open Sources (O'Reilly & Associates, Inc., 1999): 224. }~ Like many, Murdock knew the opportunities that had been squandered. He also knew the excitement of watching new opportunities come seeping out of the very fabric of the Internet.
+={Tanenbaum, Andrew}
+
+"Being involved with Linux in those early days was fun," recalls Murdock. "At the same time, it was something to do, something to pass the time. If you go back and read those old [comp.os.minix] exchanges, you'll see the sentiment: this is something we can play with until the HURD is ready. People were anxious. It's funny, but in a lot of ways, I suspect that Linux would never have happened if the HURD had come along more quickly."
+
+By the end of 1996, however, such "what if" questions were already moot. Call it Linux, call it GNU/Linux; the users had spoken. The 36-month window had closed, meaning that even if the GNU Project had rolled out its HURD kernel, chances were slim anybody outside the hard-core hacker community would have noticed. The first Unix-like free software operating system was here, and it had momentum. All hackers had left to do was sit back and wait for the next major wave to come crashing down on their heads. Even the shaggy-haired head of one Richard M. Stallman.
+={HURD kernel}
+
+% HURD kernel added reference
+
+Ready or not.
+
+1~ Chapter 11 - Open Source
+={GNU Project:open source movement and+59;open source+59;Stallman, Richard M.:open source and+59}
+
+In November , 1995, Peter Salus, a member of the Free Software Foundation and author of the 1994 book, A Quarter Century of Unix, issued a call for papers to members of the GNU Project's "system-discuss" mailing list. Salus, the conference's scheduled chairman, wanted to tip off fellow hackers about the upcoming Conference on Freely Redistributable Software in Cambridge, Massachusetts. Slated for February, 1996 and sponsored by the Free Software Foundation, the event promised to be the first engineering conference solely dedicated to free software and, in a show of unity with other free software programmers, welcomed papers on "any aspect of GNU, Linux, NetBSD, 386BSD, FreeBSD, Perl, Tcl/tk, and other tools for which the code is accessible and redistributable." Salus wrote:
+={Free Software Foundation (FSF);FSF (Free Software Foundation);FreeBSD;Conference on Freely Redistributable Software+1;Linux;NetBSD;Perl programming language;386BSD;Salus, Peter+4}
+
+_1 Over the past 15 years, free and low-cost software has become ubiquitous. This conference will bring together implementers of several different types of freely redistributable software and publishers of such software (on various media). There will be tutorials and refereed papers, as well as keynotes by Linus Torvalds and Richard Stallman.~{ See Peter Salus, "FYI-Conference on Freely Redistributable Software, 2/2, Cambridge" (1995) (archived by Terry Winograd). \\ http://hci.stanford.edu/pcd-archives/pcd-fyi/1995/0078.html }~
+
+One of the first people to receive Salus' email was conference committee member Eric S. Raymond. Although not the leader of a project or company like the various other members of the list, Raymond had built a tidy reputation within the hacker community as a major contributor to GNU Emacs and as editor of /{The New Hacker Dictionary}/, a book version of the hacking community's decade-old Jargon File.
+={New Hacker Dictionary, The;Raymond, Eric:open source and+56}
+
+For Raymond, the 1996 conference was a welcome event. Active in the GNU Project during the 1980s, Raymond had distanced himself from the project in 1992, citing, like many others before him, Stallman's "micro-management" style. "Richard kicked up a fuss about my making unauthorized modifications when I was cleaning up the Emacs LISP libraries," Raymond recalls. "It frustrated me so much that I decided I didn't want to work with him anymore."
+
+Despite the falling out, Raymond remained active in the free software community. So much so that when Salus suggested a conference pairing Stallman and Torvalds as keynote speakers, Raymond eagerly seconded the idea. With Stallman representing the older, wiser contingent of ITS/Unix hackers and Torvalds representing the younger, more energetic crop of Linux hackers, the pairing indicated a symbolic show of unity that could only be beneficial, especially to ambitious younger (i.e., below 40) hackers such as Raymond. "I sort of had a foot in both camps," Raymond says.
+
+By the time of the conference, the tension between those two camps had become palpable. Both groups had one thing in common, though: the conference was their first chance to meet the Finnish wunderkind in the flesh. Surprisingly, Torvalds proved himself to be a charming, affable speaker. Possessing only a slight Swedish accent, Torvalds surprised audience members with his quick, self-effacing wit.~{ Although Linus Torvalds is Finnish, his mother tongue is Swedish. "The Rampantly Unofficial Linus FAQ" offers a brief explanation: \\ _1 Finland has a significant (about 6%) Swedish-speaking minority population. They call themselves "finlandssvensk" or "finlandssvenskar" and consider themselves Finns; many of their families have lived in Finland for centuries. Swedish is one of Finland's two official languages. \\ http://tuxedo.org/~esr/faqs/linus/ }~ Even more surprising, says Raymond, was Torvalds' equal willingness to take potshots at other prominent hackers, including the most prominent hacker of all, Richard Stallman. By the end of the conference, Torvalds' half-hacker, half-slacker manner was winning over older and younger conference-goers alike.
+
+"It was a pivotal moment," recalls Raymond. "Before 1996, Richard was the only credible claimant to being the ideological leader of the entire culture. People who dissented didn't do so in public. The person who broke that taboo was Torvalds."
+
+The ultimate breach of taboo would come near the end of the show. During a discussion on the growing market dominance of Microsoft Windows or some similar topic, Torvalds admitted to being a fan of Microsoft's PowerPoint slideshow software program. From the perspective of old-line software purists, it was like a Mormon bragging in church about his fondness of whiskey. From the perspective of Torvalds and his growing band of followers, it was simply common sense. Why shun worthy proprietary software programs just to make a point? Being a hacker wasn't about suffering, it was about getting the job done.
+={Windows (Microsoft);Microsoft Corporation+3;PowerPoint (Microsoft)+3;proprietary software:Torvalds, Linus and;Torvalds, Linus:PowerPoint and+3}
+
+"That was a pretty shocking thing to say," Raymond remembers. "Then again, he was able to do that, because by 1995 and 1996, he was rapidly acquiring clout."
+
+Stallman, for his part, doesn't remember any tension at the 1996 conference, but he does remember later feeling the sting of Torvalds' celebrated cheekiness. "There was a thing in the Linux documentation which says print out the GNU coding standards and then tear them up," says Stallman, recalling one example. "OK, so he disagrees with some of our conventions. That's fine, but he picked a singularly nasty way of saying so. He could have just said `Here's the way I think you should indent your code.' Fine. There should be no hostility there."
+
+For Raymond, the warm reception other hackers gave to Torvalds' comments merely confirmed his suspicions. The dividing line separating Linux developers from GNU/Linux developers was largely generational. Many Linux hackers, like Torvalds, had grown up in a world of proprietary software. Unless a program was clearly inferior, most saw little reason to rail against a program on licensing issues alone. Somewhere in the universe of free software systems lurked a program that hackers might someday turn into a free software alternative to PowerPoint. Until then, why begrudge Microsoft the initiative of developing the program and reserving the rights to it?
+
+As a former GNU Project member, Raymond sensed an added dynamic to the tension between Stallman and Torvalds. In the decade since launching the GNU Project, Stallman had built up a fearsome reputation as a programmer. He had also built up a reputation for intransigence both in terms of software design and people management. Shortly before the 1996 conference, the Free Software Foundation would experience a full-scale staff defection, blamed in large part on Stallman. Brian Youmans, a current FSF staffer hired by Salus in the wake of the resignations, recalls the scene: "At one point, Peter [Salus] was the only staff member working in the office."
+
+For Raymond, the defection merely confirmed a growing suspicion: recent delays such as the HURD and recent troubles such as the Lucid-Emacs schism reflected problems normally associated with software project management, not software code development. Shortly after the Freely Redistributable Software Conference, Raymond began working on his own pet software project, a popmail utility called "fetchmail." Taking a cue from Torvalds, Raymond issued his program with a tacked-on promise to update the source code as early and as often as possible. When users began sending in bug reports and feature suggestions, Raymond, at first anticipating a tangled mess, found the resulting software surprisingly sturdy. Analyzing the success of the Torvalds approach, Raymond issued a quick analysis: using the Internet as his "petri dish" and the harsh scrutiny of the hacker community as a form of natural selection, Torvalds had created an evolutionary model free of central planning.
+={fetchmail;FreeBSD;Conference on Freely Redistributable Software;Internet}
+
+What's more, Raymond decided, Torvalds had found a way around Brooks' Law. First articulated by Fred P. Brooks, manager of IBM's OS/360 project and author of the 1975 book, The Mythical Man-Month, Brooks' Law held that adding developers to a project only resulted in further project delays. Believing as most hackers that software, like soup, benefits from a limited number of cooks, Raymond sensed something revolutionary at work. In inviting more and more cooks into the kitchen, Torvalds had actually found away to make the resulting software better.~{ Brooks' Law is the shorthand summary of the following quote taken from Brooks' book: \\ _1 Since software construction is inherently a systems effort-an exercise in complex interrelationships-communication effort is great, and it quickly dominates the decrease in individual task time brought about by partitioning. Adding more men then lengthens, not shortens, the schedule. \\ See Fred P. Brooks, The Mythical Man-Month (Addison Wesley Publishing, 1995) }~
+={Brooks, Fred P.;Mythical Man-Month, The (Brooks)}
+
+Raymond put his observations on paper. He crafted them into a speech, which he promptly delivered before a group of friends and neighbors in Chester County, Pennsylvania. Dubbed " The Cathedral and the Bazaar," the speech contrasted the management styles of the GNU Project with the management style of Torvalds and the kernel hackers. Raymond says the response was enthusiastic, but not nearly as enthusiastic as the one he received during the 1997 Linux Kongress, a gathering of Linux users in Germany the next spring.
+={Cathedral and the Bazaar, The (Raymond)+10;Linux Kongress+6}
+
+"At the Kongress, they gave me a standing ovation at the end of the speech," Raymond recalls. "I took that as significant for two reasons. For one thing, it meant they were excited by what they were hearing. For another thing, it meant they were excited even after hearing the speech delivered through a language barrier."
+
+Eventually, Raymond would convert the speech into a paper, also titled "The Cathedral and the Bazaar." The paper drew its name from Raymond's central analogy. GNU programs were "cathedrals," impressive, centrally planned monuments to the hacker ethic, built to stand the test of time. Linux, on the other hand, was more like "a great babbling bazaar," a software program developed through the loose decentralizing dynamics of the Internet.
+
+Implicit within each analogy was a comparison of Stallman and Torvalds. Where Stallman served as the classic model of the cathedral architect-i.e., a programming "wizard" who could disappear for 18 months and return with something like the GNU C Compiler-Torvalds was more like a genial dinner-party host. In letting others lead the Linux design discussion and stepping in only when the entire table needed a referee, Torvalds had created a development model very much reflective of his own laid-back personality. From the Torvalds' perspective, the most important managerial task was not imposing control but keeping the ideas flowing.
+
+Summarized Raymond, "I think Linus's cleverest and most consequential hack was not the construction of the Linux kernel itself, but rather his invention of the Linux development model."~{ See Eric Raymond, "The Cathredral and the Bazaar" (1997). }~
+
+In summarizing the secrets of Torvalds' managerial success, Raymond himself had pulled off a coup. One of the audience members at the Linux Kongress was Tim O'Reilly, publisher of O'Reilly & Associates, a company specializing in software manuals and software-related books (and the publisher of this book). After hearing Raymond's Kongress speech, O'Reilly promptly invited Raymond to deliver it again at the company's inaugural Perl Conference later that year in Monterey, California.
+={Monterey (California);O'Reilly, Tim;O'Reilly & Associates}
+
+Although the conference was supposed to focus on Perl, a scripting language created by Unix hacker Larry Wall, O'Reilly assured Raymond that the conference would address other free software technologies. Given the growing commercial interest in Linux and Apache, a popular free software web server, O'Reilly hoped to use the event to publicize the role of free software in creating the entire infrastructure of the Internet. From web-friendly languages such as Perl and Python to back-room programs such as BIND (the Berkeley Internet Naming Daemon), a software tool that lets users replace arcane IP numbers with the easy-to-remember domain-name addresses (e.g., amazon.com), and sendmail, the most popular mail program on the Internet, free software had become an emergent phenomenon. Like a colony of ants creating a beautiful nest one grain of sand at a time, the only thing missing was the communal self-awareness. O'Reilly saw Raymond's speech as a good way to inspire that self-awareness, to drive home the point that free software development didn't start and end with the GNU Project. Programming languages, such as Perl and Python, and Internet software, such as BIND, sendmail, and Apache, demonstrated that free software was already ubiquitous and influential. He also assured Raymond an even warmer reception than the one at Linux Kongress.
+={Apache web server;BIND (Berkely Internet Naming Daemon);Berkely Internet Naming Daemon (BIND);Wall, Larry;Perl programming language;Python programming language;sendmail Unix mail program}
+
+O'Reilly was right. "This time, I got the standing ovation before the speech," says Raymond, laughing.
+
+As predicted, the audience was stocked not only with hackers, but with other people interested in the growing power of the free software movement. One contingent included a group from Netscape, the Mountain View, California startup then nearing the end game of its three-year battle with Microsoft for control of the web-browser market.
+={Mountain View (California);Netscape+8}
+
+Intrigued by Raymond's speech and anxious to win back lost market share, Netscape executives took the message back to corporate headquarters. A few months later, in January, 1998, the company announced its plan to publish the source code of its flagship Navigator web browser in the hopes of enlisting hacker support in future development.
+={source code:Mozilla (Netscape)+1}
+
+When Netscape CEO Jim Barksdale cited Raymond's "Cathedral and the Bazaar" essay as a major influence upon the company's decision, the company instantly elevated Raymond to the level of hacker celebrity. Determined not to squander the opportunity, Raymond traveled west to deliver interviews, advise Netscape executives, and take part in the eventual party celebrating the publication of Netscape Navigator's source code. The code name for Navigator's source code was "Mozilla": a reference both to the program's gargantuan size-30 million lines of code-and to its heritage. Developed as a proprietary offshoot of Mosaic, the web browser created by Marc Andreessen at the University of Illinois, Mozilla was proof, yet again, that when it came to building new programs, most programmers preferred to borrow on older, modifiable programs.
+={Andreessen, Marc;Barksdale, Jim}
+
+While in California, Raymond also managed to squeeze in a visit to VA Research, a Santa Clara-based company selling workstations with the GNU/Linux operating system preinstalled. Convened by Raymond, the meeting was small. The invite list included VA founder Larry Augustin, a few VA employees, and Christine Peterson, president of the Foresight Institute, a Silicon Valley think tank specializing in nanotechnology.
+={Augustin, Larry;Foresight Institute;VA Research;Peterson, Christine+4}
+
+"The meeting's agenda boiled down to one item: how to take advantage of Netscape's decision so that other companies might follow suit?" Raymond doesn't recall the conversation that took place, but he does remember the first complaint addressed. Despite the best efforts of Stallman and other hackers to remind people that the word "free" in free software stood for freedom and not price, the message still wasn't getting through. Most business executives, upon hearing the term for the first time, interpreted the word as synonymous with "zero cost," tuning out any follow up messages in short order. Until hackers found a way to get past this cognitive dissonance, the free software movement faced an uphill climb, even after Netscape.
+
+Peterson, whose organization had taken an active interest in advancing the free software cause, offered an alternative: open source.
+
+Looking back, Peterson says she came up with the open source term while discussing Netscape's decision with a friend in the public relations industry. She doesn't remember where she came upon the term or if she borrowed it from another field, but she does remember her friend disliking the term.~{ See Malcolm Maclachlan, "Profit Motive Splits Open Source Movement," TechWeb News (August 26, 1998). \\ http://content.techweb.com/wire/story/TWB19980824S0012 }~
+
+At the meeting, Peterson says, the response was dramatically different. "I was hesitant about suggesting it," Peterson recalls. "I had no standing with the group, so started using it casually, not highlighting it as a new term." To Peterson's surprise, the term caught on. By the end of the meeting, most of the attendees, including Raymond, seemed pleased by it.
+
+Raymond says he didn't publicly use the term "open source" as a substitute for free software until a day or two after the Mozilla launch party, when O'Reilly had scheduled a meeting to talk about free software. Calling his meeting "the Freeware Summit," O'Reilly says he wanted to direct media and community attention to the other deserving projects that had also encouraged Netscape to release Mozilla. "All these guys had so much in common, and I was surprised they didn't all know each other," says O'Reilly. "I also wanted to let the world know just how great an impact the free software culture had already made. People were missing out on a large part of the free software tradition."
+={Freeware Summit;O'Reilly, Tim:open source and+8}
+
+In putting together the invite list, however, O'Reilly made a decision that would have long-term political consequences. He decided to limit the list to west-coast developers such as Wall, Eric Allman, creator of sendmail, and Paul Vixie, creator of BIND. There were exceptions, of course: Pennsylvania-resident Raymond, who was already in town thanks to the Mozilla launch, earned a quick invite. So did Virginia-resident Guido van Rossum, creator of Python. "Frank Willison, my editor in chief and champion of Python within the company, invited him without first checking in with me," O'Reilly recalls. "I was happy to have him there, but when I started, it really was just a local gathering."
+={van Rossum, Guido;Python programming language}
+
+% names not in index allman of sendmail, allman of bind
+
+For some observers, the unwillingness to include Stallman's name on the list qualified as a snub. "I decided not to go to the event because of it," says Perens, remembering the summit. Raymond, who did go, says he argued for Stallman's inclusion to no avail. The snub rumor gained additional strength from the fact that O'Reilly, the event's host, had feuded publicly with Stallman over the issue of software-manual copyrights. Prior to the meeting, Stallman had argued that free software manuals should be as freely copyable and modifiable as free software programs. O'Reilly, meanwhile, argued that a value-added market for nonfree books increased the utility of free software by making it more accessible to a wider community. The two had also disputed the title of the event, with Stallman insisting on "Free Software" over the less politically laden "Freeware."
+
+Looking back, O'Reilly doesn't see the decision to leave Stallman's name off the invite list as a snub. "At that time, I had never met Richard in person, but in our email interactions, he'd been inflexible and unwilling to engage in dialogue. I wanted to make sure the GNU tradition was represented at the meeting, so I invited John Gilmore and Michael Tiemann, whom I knew personally, and whom I knew were passionate about the value of the GPL but seemed more willing to engage in a frank back-and-forth about the strengths and weaknesses of the various free software projects and traditions. Given all the later brouhaha, I do wish I'd invited Richard as well, but I certainly don't think that my failure to do so should be interpreted as a lack of respect for the GNU Project or for Richard personally."
+={Gilmore, John;Tiemann, Michael+7}
+
+Snub or no snub, both O'Reilly and Raymond say the term "open source" won over just enough summit-goers to qualify as a success. The attendees shared ideas and experiences and brainstormed on how to improve free software's image. Of key concern was how to point out the successes of free software, particularly in the realm of Internet infrastructure, as opposed to playing up the GNU/Linux challenge to Microsoft Windows. But like the earlier meeting at VA, the discussion soon turned to the problems associated with the term "free software." O'Reilly, the summit host, remembers a particularly insightful comment from Torvalds, a summit attendee.
+
+"Linus had just moved to Silicon Valley at that point, and he explained how only recently that he had learned that the word `free' had two meanings-free as in `libre' and free as in `gratis'-in English."
+
+Michael Tiemann, founder of Cygnus, proposed an alternative to the troublesome "free software" term: sourceware. "Nobody got too excited about it," O'Reilly recalls. "That's when Eric threw out the term `open source.'"
+
+Although the term appealed to some, support for a change in official terminology was far from unanimous. At the end of the one-day conference, attendees put the three terms-free software, open source, or sourceware-to a vote. According to O'Reilly, 9 out of the 15 attendees voted for "open source." Although some still quibbled with the term, all attendees agreed to use it in future discussions with the press. "We wanted to go out with a solidarity message," O'Reilly says.
+
+The term didn't take long to enter the national lexicon. Shortly after the summit, O'Reilly shepherded summit attendees to a press conference attended by reporters from the New York Times, the Wall Street Journal, and other prominent publications. Within a few months, Torvalds' face was appearing on the cover of Forbes magazine, with the faces of Stallman, Perl creator Larry Wall, and Apache team leader Brian Behlendorf featured in the interior spread. Open source was open for business.
+={Wall, Larry}
+
+% Larry Wall entry added
+
+For summit attendees such as Tiemann, the solidarity message was the most important thing. Although his company had achieved a fair amount of success selling free software tools and services, he sensed the difficulty other programmers and entrepreneurs faced.
+
+"There's no question that the use of the word free was confusing in a lot of situations," Tiemann says. "Open source positioned itself as being business friendly and business sensible. Free software positioned itself as morally righteous. For better or worse we figured it was more advantageous to align with the open source crowd.
+
+For Stallman, the response to the new "open source" term was slow in coming. Raymond says Stallman briefly considered adopting the term, only to discard it. "I know because I had direct personal conversations about it," Raymond says.
+
+By the end of 1998, Stallman had formulated a position: open source, while helpful in communicating the technical advantages of free software, also encouraged speakers to soft-pedal the issue of software freedom. Given this drawback, Stallman would stick with the term free software.
+
+Summing up his position at the 1999 LinuxWorld Convention and Expo, an event billed by Torvalds himself as a "coming out party" for the Linux community, Stallman implored his fellow hackers to resist the lure of easy compromise.
+={LinuxWorld Conventions+2}
+
+"Because we've shown how much we can do, we don't have to be desperate to work with companies or compromise our goals," Stallman said during a panel discussion. "Let them offer and we'll accept. We don't have to change what we're doing to get them to help us. You can take a single step towards a goal, then another and then more and more and you'll actually reach your goal. Or, you can take a half measure that means you don't ever take another step and you'll never get there."
+
+Even before the LinuxWorld show, however, Stallman was showing an increased willingness to alienate his more conciliatory peers. A few months after the Freeware Summit, O'Reilly hosted its second annual Perl Conference. This time around, Stallman was in attendance. During a panel discussion lauding IBM's decision to employ the free software Apache web server in its commercial offerings, Stallman, taking advantage of an audience microphone, disrupted the proceedings with a tirade against panelist John Ousterhout, creator of the Tcl scripting language. Stallman branded Ousterhout a "parasite" on the free software community for marketing a proprietary version of Tcl via Ousterhout's startup company, Scriptics. "I don't think Scriptics is necessary for the continued existence of Tcl," Stallman said to hisses from the fellow audience members. ^98^
+={Apache web server;IBM:Apache web server and;Ousterhout, John;Tcl scripting language+1;Scriptics}
+
+"It was a pretty ugly scene," recalls Prime Time Freeware's Rich Morin. "John's done some pretty respectable things: Tcl, Tk, Sprite. He's a real contributor."
+={Morin, Rich+1;Prime Time Freeware;Sprite}
+
+Despite his sympathies for Stallman and Stallman's position, Morin felt empathy for those troubled by Stallman's discordant behavior.
+
+Stallman's Perl Conference outburst would momentarily chase off another potential sympathizer, Bruce Perens. In 1998, Eric Raymond proposed launching the Open Source Initiative, or OSI, an organization that would police the use of the term "open source" and provide a definition for companies interested in making their own programs. Raymond recruited Perens to draft the definition.~{ See Bruce Perens et al., "The Open Source Definition," The Open Source Initiative (1998).
+http://www.opensource.org/docs/definition.html }~
+={OSI (Open Source Initiative);Open Source Initiative (OSI);Perens, Bruce+1}
+
+Perens would later resign from the OSI, expressing regret that the organization had set itself up in opposition to Stallman and the FSF. Still, looking back on the need for a free software definition outside the Free Software Foundation's auspices, Perens understands why other hackers might still feel the need for distance. "I really like and admire Richard," says Perens. "I do think Richard would do his job better if Richard had more balance. That includes going away from free software for a couple of months."
+
+Stallman's monomaniacal energies would do little to counteract the public-relations momentum of open source proponents. In August of 1998, when chip-maker Intel purchased a stake in GNU/Linux vendor Red Hat, an accompanying New York Times article described the company as the product of a movement "known alternatively as free software and open source."~{ See Amy Harmon, "For Sale: Free Operating System," New York Times (September 28, 1998). \\ http://www.nytimes.com/library/tech/98/09/biztech/articles/28linux.html }~ Six months later, a John Markoff article on Apple Computer was proclaiming the company's adoption of the "open source" Apache server in the article headline.~{ See John Markoff, "Apple Adopts `Open Source' for its Server Computers," New York Times (March 17, 1999). \\ http://www.nytimes.com/library/tech/99/03/biztech/articles/17apple.html }~
+={Apache web server;Apple Computers:open source software and;Intel;Markoff, John;Red Hat Inc.:success of+1}
+
+Such momentum would coincide with the growing momentum of companies that actively embraced the "open source" term. By August of 1999, Red Hat, a company that now eagerly billed itself as "open source," was selling shares on Nasdaq. In December, VA Linux-formerly VA Research-was floating its own IPO to historical effect. Opening at $30 per share, the company's stock price exploded past the $300 mark in initial trading only to settle back down to the $239 level. Shareholders lucky enough to get in at the bottom and stay until the end experienced a 698% increase in paper wealth, a Nasdaq record.
+={VA Linux+1;VA Research}
+
+% VA Research added to index
+
+Among those lucky shareholders was Eric Raymond, who, as a company board member since the Mozilla launch, had received 150,000 shares of VA Linux stock. Stunned by the realization that his essay contrasting the Stallman-Torvalds managerial styles had netted him $36 million in potential wealth, Raymond penned a follow-up essay. In it, Raymond mused on the relationship between the hacker ethic and monetary wealth:
+
+_1 Reporters often ask me these days if I think the open-source community will be corrupted by the influx of big money. I tell them what I believe, which is this: commercial demand for programmers has been so intense for so long that anyone who can be seriously distracted by money is already gone. Our community has been self-selected for caring about other things-accomplishment, pride, artistic passion, and each other.~{ See Eric Raymond, "Surprised by Wealth," Linux Today (December 10, 1999). \\ http://linuxtoday.com/news_story.php3?ltsn=1999-12-10-001-05-NW-LF }~
+
+Whether or not such comments allayed suspicions that Raymond and other open source proponents had simply been in it for the money, they drove home the open source community's ultimate message: all you needed to sell the free software concept is a friendly face and a sensible message. Instead of fighting the marketplace head-on as Stallman had done, Raymond, Torvalds, and other new leaders of the hacker community had adopted a more relaxed approach-ignoring the marketplace in some areas, leveraging it in others. Instead of playing the role of high-school outcasts, they had played the game of celebrity, magnifying their power in the process.
+
+"On his worst days Richard believes that Linus Torvalds and I conspired to hijack his revolution," Raymond says. "Richard's rejection of the term open source and his deliberate creation of an ideological fissure in my view comes from an odd mix of idealism and territoriality. There are people out there who think it's all Richard's personal ego. I don't believe that. It's more that he so personally associates himself with the free software idea that he sees any threat to that as a threat to himself."
+
+Ironically, the success of open source and open source advocates such as Raymond would not diminish Stallman's role as a leader. If anything, it gave Stallman new followers to convert. Still, the Raymond territoriality charge is a damning one. There are numerous instances of Stallman sticking to his guns more out of habit than out of principle: his initial dismissal of the Linux kernel, for example, and his current unwillingness as a political figure to venture outside the realm of software issues.
+
+Then again, as the recent debate over open source also shows, in instances when Stallman has stuck to his guns, he's usually found a way to gain ground because of it. "One of Stallman's primary character traits is the fact he doesn't budge," says Ian Murdock. "He'll wait up to a decade for people to come around to his point of view if that's what it takes."
+
+Murdock, for one, finds that unbudgeable nature both refreshing and valuable. Stallman may no longer be the solitary leader of the free software movement, but he is still the polestar of the free software community. "You always know that he's going to be consistent in his views," Murdock says. "Most people aren't like that. Whether you agree with him or not, you really have to respect that."
+
+1~ Chapter 12 - A Brief Journey Through Hacker Hell
+
+Richard Stallman stares, unblinking, through the windshield of a rental car, waiting for the light to change as we make our way through downtown Kihei.
+={Kihei (Hawaii)+15}
+
+The two of us are headed to the nearby town of Pa'ia, where we are scheduled to meet up with some software programmers and their wives for dinner in about an hour or so.
+={Pa'ia (Hawaii)+2}
+
+It's about two hours after Stallman's speech at the Maui High Performance Center, and Kihei, a town that seemed so inviting before the speech, now seems profoundly uncooperative. Like most beach cities, Kihei is a one-dimensional exercise in suburban sprawl. Driving down its main drag, with its endless succession of burger stands, realty agencies, and bikini shops, it's hard not to feel like a steel-coated morsel passing through the alimentary canal of a giant commercial tapeworm. The feeling is exacerbated by the lack of side roads. With nowhere to go but forward, traffic moves in spring-like lurches. 200 yards ahead, a light turns green. By the time we are moving, the light is yellow again.
+
+For Stallman, a lifetime resident of the east coast, the prospect of spending the better part of a sunny Hawaiian afternoon trapped in slow traffic is enough to trigger an embolism. Even worse is the knowledge that, with just a few quick right turns a quarter mile back, this whole situation easily could have been avoided. Unfortunately, we are at the mercy of the driver ahead of us, a programmer from the lab who knows the way and who has decided to take us to Pa'ia via the scenic route instead of via the nearby Pilani Highway.
+
+"This is terrible," says Stallman between frustrated sighs. "Why didn't we take the other route?"
+
+Again, the light a quarter mile ahead of us turns green. Again, we creep forward a few more car lengths. This process continues for another 10 minutes, until we finally reach a major crossroad promising access to the adjacent highway.
+
+The driver ahead of us ignores it and continues through the intersection.
+
+"Why isn't he turning?" moans Stallman, throwing up his hands in frustration. "Can you believe this?"
+
+I decide not to answer either. I find the fact that I am sitting in a car with Stallman in the driver seat, in Maui no less, unbelievable enough. Until two hours ago, I didn't even know Stallman knew how to drive. Now, listening to Yo-Yo Ma's cello playing the mournful bass notes of "Appalachian Journey" on the car stereo and watching the sunset pass by on our left, I do my best to fade into the upholstery.
+
+When the next opportunity to turn finally comes up, Stallman hits his right turn signal in an attempt to cue the driver ahead of us. No such luck. Once again, we creep slowly through the intersection, coming to a stop a good 200 yards before the next light. By now, Stallman is livid.
+
+"It's like he's deliberately ignoring us," he says, gesturing and pantomiming like an air craft carrier landing-signals officer in a futile attempt to catch our guide's eye. The guide appears unfazed, and for the next five minutes all we see is a small portion of his head in the rearview mirror.
+
+I look out Stallman's window. Nearby Kahoolawe and Lanai Islands provide an ideal frame for the setting sun. It's a breathtaking view, the kind that makes moments like this a bit more bearable if you're a Hawaiian native, I suppose. I try to direct Stallman's attention to it, but Stallman, by now obsessed by the inattentiveness of the driver ahead of us, blows me off.
+={Lanai Islands (Hawaii)}
+
+When the driver passes through another green light, completely ignoring a "Pilani Highway Next Right," I grit my teeth. I remember an early warning relayed to me by BSD programmer Keith Bostic. "Stallman does not suffer fools gladly," Bostic warned me. "If somebody says or does something stupid, he'll look them in the eye and say, `That's stupid.'"
+={Bostic, Keith}
+
+Looking at the oblivious driver ahead of us, I realize that it's the stupidity, not the inconvenience, that's killing Stallman right now.
+
+"It's as if he picked this route with absolutely no thought on how to get there efficiently," Stallman says.
+
+The word "efficiently" hangs in the air like a bad odor. Few things irritate the hacker mind more than inefficiency. It was the inefficiency of checking the Xerox laser printer two or three times a day that triggered Stallman's initial inquiry into the printer source code. It was the inefficiency of rewriting software tools hijacked by commercial software vendors that led Stallman to battle Symbolics and to launch the GNU Project. If, as Jean Paul Sartre once opined, hell is other people, hacker hell is duplicating other people's stupid mistakes, and it's no exaggeration to say that Stallman's entire life has been an attempt to save mankind from these fiery depths.
+={Sartre, Jean Paul}
+
+This hell metaphor becomes all the more apparent as we take in the slowly passing scenery. With its multitude of shops, parking lots, and poorly timed street lights, Kihei seems less like a city and more like a poorly designed software program writ large. Instead of rerouting traffic and distributing vehicles through side streets and expressways, city planners have elected to run everything through a single main drag. From a hacker perspective, sitting in a car amidst all this mess is like listening to a CD rendition of nails on a chalkboard at full volume.
+
+"Imperfect systems infuriate hackers," observes Steven Levy, another warning I should have listened to before climbing into the car with Stallman. "This is one reason why hackers generally hate driving cars-the system of randomly programmed red lights and oddly laid out one-way streets causes delays which are so goddamn unnecessary [Levy's emphasis] that the impulse is to rearrange signs, open up traffic-light control boxes . . . redesign the entire system."~{ See Steven Levy, Hackers (Penguin USA [paperback], 1984): 40. }~
+
+% ={Hackers (Levy)}
+
+More frustrating, however, is the duplicity of our trusted guide. Instead of searching out a clever shortcut-as any true hacker would do on instinct-the driver ahead of us has instead chosen to play along with the city planners' game. Like Virgil in Dante's Inferno, our guide is determined to give us the full guided tour of this hacker hell whether we want it or not.
+
+Before I can make this observation to Stallman, the driver finally hits his right turn signal. Stallman's hunched shoulders relax slightly, and for a moment the air of tension within the car dissipates. The tension comes back, however, as the driver in front of us slows down. "Construction Ahead" signs line both sides of the street, and even though the Pilani Highway lies less than a quarter mile off in the distance, the two-lane road between us and the highway is blocked by a dormant bulldozer and two large mounds of dirt.
+
+It takes Stallman a few seconds to register what's going on as our guide begins executing a clumsy five-point U-turn in front of us. When he catches a glimpse of the bulldozer and the "No Through Access" signs just beyond, Stallman finally boils over.
+
+"Why, why, why?" he whines, throwing his head back. "You should have known the road was blocked. You should have known this way wouldn't work. You did this deliberately."
+
+The driver finishes the turn and passes us on the way back toward the main drag. As he does so, he shakes his head and gives us an apologetic shrug. Coupled with a toothy grin, the driver's gesture reveals a touch of mainlander frustration but is tempered with a protective dose of islander fatalism. Coming through the sealed windows of our rental car, it spells out a succinct message: "Hey, it's Maui; what are you gonna do?"
+
+Stallman can take it no longer.
+
+"Don't you fucking smile!" he shouts, fogging up the glass as he does so. "It's your fucking fault. This all could have been so much easier if we had just done it my way."
+
+Stallman accents the words "my way" by gripping the steering wheel and pulling himself towards it twice. The image of Stallman's lurching frame is like that of a child throwing a temper tantrum in a car seat, an image further underlined by the tone of Stallman's voice. Halfway between anger and anguish, Stallman seems to be on the verge of tears.
+
+Fortunately, the tears do not arrive. Like a summer cloudburst, the tantrum ends almost as soon as it begins. After a few whiny gasps, Stallman shifts the car into reverse and begins executing his own U-turn. By the time we are back on the main drag, his face is as impassive as it was when we left the hotel 30 minutes earlier.
+
+It takes less than five minutes to reach the next cross-street. This one offers easy highway access, and within seconds, we are soon speeding off toward Pa'ia at a relaxing rate of speed. The sun that once loomed bright and yellow over Stallman's left shoulder is now burning a cool orange-red in our rearview mirror. It lends its color to the gauntlet wili wili trees flying past us on both sides of the highway.
+={Pa'ia (Hawaii)}
+
+For the next 20 minutes, the only sound in our vehicle, aside from the ambient hum of the car's engine and tires, is the sound of a cello and a violin trio playing the mournful strains of an Appalachian folk tune.
+
+1~ Chapter 13 - Continuing the Fight
+
+For Richard Stallman, time may not heal all wounds, but it does provide a convenient ally.
+
+Four years after " The Cathedral and the Bazaar," Stallman still chafes over the Raymond critique. He also grumbles over Linus Torvalds' elevation to the role of world's most famous hacker. He recalls a popular T-shirt that began showing at Linux tradeshows around 1999. Designed to mimic the original promotional poster for Star Wars, the shirt depicted Torvalds brandishing a lightsaber like Luke Skywalker, while Stallman's face rides atop R2D2. The shirt still grates on Stallmans nerves not only because it depicts him as a Torvalds' sidekick, but also because it elevates Torvalds to the leadership role in the free software/open source community, a role even Torvalds himself is loath to accept. "It's ironic," says Stallman mournfully. "Picking up that sword is exactly what Linus refuses to do. He gets everybody focusing on him as the symbol of the movement, and then he won't fight. What good is it?"
+={Cathedral and the Bazaar, The (Raymond);Luke Skywalker;R2D2;Torvalds, Linus+1;Star Wars}
+
+Then again, it is that same unwillingness to "pick up the sword," on Torvalds part, that has left the door open for Stallman to bolster his reputation as the hacker community's ethical arbiter. Despite his grievances, Stallman has to admit that the last few years have been quite good, both to himself and to his organization. Relegated to the periphery by the unforeseen success of GNU/Linux, Stallman has nonetheless successfully recaptured the initiative. His speaking schedule between January 2000 and December 2001 included stops on six continents and visits to countries where the notion of software freedom carries heavy overtones-China and India, for example.
+
+Outside the bully pulpit, Stallman has also learned how to leverage his power as costeward of the GNU General Public License (GPL). During the summer of 2000, while the air was rapidly leaking out of the 1999 Linux IPO bubble, Stallman and the Free Software Foundation scored two major victories. In July, 2000, Troll Tech, a Norwegian software company and developer of Qt, a valuable suite of graphics tools for the GNU/Linux operating system, announced it was licensing its software under the GPL. A few weeks later, Sun Microsystems, a company that, until then, had been warily trying to ride the open source bandwagon without giving up total control of its software properties, finally relented and announced that it, too, was dual licensing its new OpenOffice application suite under the Lesser GNU Public License (LGPL) and the Sun Industry Standards Source License (SISSL).
+={Free Software Foundation (FSF):QT graphic tools and;GNU General Public License:QT graphics tools and;Lesser GNU Public License (LGPL);OpenOffice application suite+4;Qt+1;Troll Tech+1;SISSL (Sun Industry Standards Source Licence);Sun Industry Standards Source License (SISSL);Sun Microsystems:OpenOffice application suite}
+
+Underlining each victory was the fact that Stallman had done little to fight for them. In the case of Troll Tech, Stallman had simply played the role of free software pontiff. In 1999, the company had come up with a license that met the conditions laid out by the Free Software Foundation, but in examining the license further, Stallman detected legal incompatibles that would make it impossible to bundle Qt with GPL-protected software programs. Tired of battling Stallman, Troll Tech management finally decided to split the Qt into two versions, one GPL-protected and one QPL-protected, giving developers a way around the compatibility issues cited by Stallman.
+
+In the case of Sun, they desired to play according to the Free Software Foundation's conditions. At the 1999 O'Reilly Open Source Conference, Sun Microsystems cofounder and chief scientist Bill Joy defended his company's "community source" license, essentially a watered-down compromise letting users copy and modify Sun-owned software but not charge a fee for said software without negotiating a royalty agreement with Sun. A year after Joy's speech, Sun Microsystems vice president Marco Boerries was appearing on the same stage spelling out the company's new licensing compromise in the case of OpenOffice, an office-application suite designed specifically for the GNU/Linux operating system.
+={Boerries, Marco+2;community source, license of Sun Microsystems;Joy, Bill;O'Reilly & Associates:Open Source Conferences}
+
+% ={"community source" license of Sun Microsystems} would be sorted incorrectly
+
+"I can spell it out in three letters," said Boerries. "GPL."
+
+At the time, Boerries said his company's decision had little to do with Stallman and more to do with the momentum of GPL-protected programs. "What basically happened was the recognition that different products attracted different communities, and the license you use depends on what type of community you want to attract," said Boerries. "With [OpenOffice], it was clear we had the highest correlation with the GPL community."~{ See Marco Boerries, interview with author (July, 2000). }~
+
+Such comments point out the under-recognized strength of the GPL and, indirectly, the political genius of man who played the largest role in creating it. "There isn't a lawyer on earth who would have drafted the GPL the way it is," says Eben Moglen, Columbia University law professor and Free Software Foundation general counsel. "But it works. And it works because of Richard's philosophy of design."
+={Columbia University;Moglen, Eben+35}
+
+A former professional programmer, Moglen traces his pro bono work with Stallman back to 1990 when Stallman requested Moglen's legal assistance on a private affair. Moglen, then working with encryption expert Phillip Zimmerman during Zimmerman's legal battles with the National Security Administration, says he was honored by the request. "I told him I used Emacs every day of my life, and it would take an awful lot of lawyering on my part to pay off the debt."
+={Zimmerman, Phillip;National Security Administration}
+
+Since then, Moglen, perhaps more than any other individual, has had the best chance to observe the crossover of Stallman's hacker philosophies into the legal realm. Moglen says the difference between Stallman's approach to legal code and software code are largely the same. "I have to say, as a lawyer, the idea that what you should do with a legal document is to take out all the bugs doesn't make much sense," Moglen says. "There is uncertainty in every legal process, and what most lawyers want to do is to capture the benefits of uncertainty for their client. Richard's goal is the complete opposite. His goal is to remove uncertainty, which is inherently impossible. It is inherently impossible to draft one license to control all circumstances in all legal systems all over the world. But if you were to go at it, you would have to go at it his way. And the resulting elegance, the resulting simplicity in design almost achieves what it has to achieve. And from there a little lawyering will carry you quite far."
+
+As the person charged with pushing the Stallman agenda, Moglen understands the frustration of would-be allies. "Richard is a man who does not want to compromise over matters that he thinks of as fundamental," Moglen says, "and he does not take easily the twisting of words or even just the seeking of artful ambiguity, which human society often requires from a lot of people."
+
+Because of the Free Software Foundation's unwillingness to weigh in on issues outside the purview of GNU development and GPL enforcement, Moglen has taken to devoting his excess energies to assisting the Electronic Frontier Foundation, the organization providing legal aid to recent copyright defendants such as Dmitri Skylarov. In 2000, Moglen also served as direct counsel to a collection of hackers that were joined together from circulating the DVD decryption program deCSS. Despite the silence of his main client in both cases, Moglen has learned to appreciate the value of Stallman's stubbornness. "There have been times over the years where I've gone to Richard and said, `We have to do this. We have to do that. Here's the strategic situation. Here's the next move. Here's what he have to do.' And Richard's response has always been, `We don't have to do anything.' Just wait. What needs doing will get done."
+={Electronic Frontier Foundation;Skylarov, Dmitri}
+
+"And you know what?" Moglen adds. "Generally, he's been right."
+
+Such comments disavow Stallman's own self-assessment: "I'm not good at playing games," Stallman says, addressing the many unseen critics who see him as a shrewd strategist. "I'm not good at looking ahead and anticipating what somebody else might do. My approach has always been to focus on the foundation, to say `Let's make the foundation as strong as we can make it.'"
+
+The GPL's expanding popularity and continuing gravitational strength are the best tributes to the foundation laid by Stallman and his GNU colleagues. While no longer capable of billing himself as the "last true hacker," Stallman nevertheless can take sole credit for building the free software movement's ethical framework. Whether or not other modern programmers feel comfortable working inside that framework is immaterial. The fact that they even have a choice at all is Stallman's greatest legacy.
+
+Discussing Stallman's legacy at this point seems a bit premature. Stallman, 48 at the time of this writing, still has a few years left to add to or subtract from that legacy. Still, the autopilot nature of the free software movement makes it tempting to examine Stallman's life outside the day-to-day battles of the software industry and within a more august, historical setting.
+
+To his credit, Stallman refuses all opportunities to speculate. "I've never been able to work out detailed plans of what the future was going to be like," says Stallman, offering his own premature epitaph. "I just said `I'm going to fight. Who knows where I'll get?'"
+
+There's no question that in picking his fights, Stallman has alienated the very people who might otherwise have been his greatest champions. It is also a testament to his forthright, ethical nature that many of Stallman's erstwhile political opponents still manage to put in a few good words for him when pressed. The tension between Stallman the ideologue and Stallman the hacker genius, however, leads a biographer to wonder: how will people view Stallman when Stallman's own personality is no longer there to get in the way?
+
+In early drafts of this book, I dubbed this question the "100 year" question. Hoping to stimulate an objective view of Stallman and his work, I asked various software-industry luminaries to take themselves out of the current timeframe and put themselves in a position of a historian looking back on the free software movement 100 years in the future. From the current vantage point, it is easy to see similarities between Stallman and past Americans who, while somewhat marginal during their lifetime, have attained heightened historical importance in relation to their age. Easy comparisons include Henry David Thoreau, transcendentalist philosopher and author of On Civil Disobedience, and John Muir, founder of the Sierra Club and progenitor of the modern environmental movement. It is also easy to see similarities in men like William Jennings Bryan, a.k.a. "The Great Commoner," leader of the populist movement, enemy of monopolies, and a man who, though powerful, seems to have faded into historical insignificance.
+={Bryan, Willliam Jennings;Muir, John;On Civil Disobedience (Thoreau);Thoreau, Henry David;Sierra Club}
+
+Although not the first person to view software as public property, Stallman is guaranteed a footnote in future history books thanks to the GPL. Given that fact, it seems worthwhile to step back and examine Richard Stallman's legacy outside the current time frame. Will the GPL still be something software programmers use in the year 2102, or will it have long since fallen by the wayside? Will the term "free software" seem as politically quaint as "free silver" does today, or will it seem eerily prescient in light of later political events?
+
+Predicting the future is risky sport, but most people, when presented with the question, seemed eager to bite. "One hundred years from now, Richard and a couple of other people are going to deserve more than a footnote," says Moglen. "They're going to be viewed as the main line of the story."
+
+The "couple other people" Moglen nominates for future textbook chapters include John Gilmore, Stallman's GPL advisor and future founder of the Electronic Frontier Foundation, and Theodor Holm Nelson, a.k.a. Ted Nelson, author of the 1982 book, Literary Machines. Moglen says Stallman, Nelson, and Gilmore each stand out in historically significant, nonoverlapping ways. He credits Nelson, commonly considered to have coined the term "hypertext," for identifying the predicament of information ownership in the digital age. Gilmore and Stallman, meanwhile, earn notable credit for identifying the negative political effects of information control and building organizations-the Electronic Frontier Foundation in the case of Gilmore and the Free Software Foundation in the case of Stallman-to counteract those effects. Of the two, however, Moglen sees Stallman's activities as more personal and less political in nature.
+={Electronic Frontier Foundation;Gilmore, John;Nelson, Theodor Holm+2;Nelson, Ted+2}
+
+"Richard was unique in that the ethical implications of unfree software were particularly clear to him at an early moment," says Moglen. "This has a lot to do with Richard's personality, which lots of people will, when writing about him, try to depict as epiphenomenal or even a drawback in Richard Stallman's own life work."
+
+Gilmore, who describes his inclusion between the erratic Nelson and the irascible Stallman as something of a "mixed honor," nevertheless seconds the Moglen argument. Writes Gilmore:
+
+_1 My guess is that Stallman's writings will stand up as well as Thomas Jefferson's have; he's a pretty clear writer and also clear on his principles . . . Whether Richard will be as influential as Jefferson will depend on whether the abstractions we call "civil rights" end up more important a hundred years from now than the abstractions that we call "software" or "technically imposed restrictions."
+={Jefferson, Thomas}
+
+Another element of the Stallman legacy not to be overlooked, Gilmore writes, is the collaborative software-development model pioneered by the GNU Project. Although flawed at times, the model has nevertheless evolved into a standard within the software-development industry. All told, Gilmore says, this collaborative software-development model may end up being even more influential than the GNU Project, the GPL License, or any particular software program developed by Stallman:
+
+_1 Before the Internet, it was quite hard to collaborate over distance on software, even among teams that know and trust each other. Richard pioneered collaborative development of software, particularly by disorganized volunteers who seldom meet each other. Richard didn't build any of the basic tools for doing this (the TCP protocol, email lists, diff and patch, tar files, RCS or CVS or remote-CVS), but he used the ones that were available to form social groups of programmers who could effectively collaborate.
+
+Lawrence Lessig, Stanford law professor and author of the 2001 book, The Future of Ideas, is similarly bullish. Like many legal scholars, Lessig sees the GPL as a major bulwark of the current so-called "digital commons," the vast agglomeration of community-owned software programs, network and telecommunication standards that have triggered the Internet's exponential growth over the last three decades. Rather than connect Stallman with other Internet pioneers, men such as Vannevar Bush, Vinton Cerf, and J. C. R. Licklider who convinced others to see computer technology on a wider scale, Lessig sees Stallman's impact as more personal, introspective, and, ultimately, unique:
+={Future of Ideas, The (Lessig)}
+
+_1 [Stallman] changed the debate from is to ought. He made people see how much was at stake, and he built a device to carry these ideals forward . . . That said, I don't quite know how to place him in the context of Cerf or Licklider. The innovation is different. It is not just about a certain kind of code, or enabling the Internet. [It's] much more about getting people to see the value in a certain kind of Internet. I don't think there is anyone else in that class, before or after.
+
+Not everybody sees the Stallman legacy as set in stone, of course. Eric Raymond, the open source proponent who feels that Stallman's leadership role has diminished significantly since 1996, sees mixed signals when looking into the 2102 crystal ball:
+
+_1 I think Stallman's artifacts (GPL, Emacs, GCC) will be seen as revolutionary works, as foundation-stones of the information world. I think history will be less kind to some of the theories from which RMS operated, and not kind at all to his personal tendency towards territorial, cult-leader behavior.
+
+As for Stallman himself, he, too, sees mixed signals:
+
+_1 What history says about the GNU Project, twenty years from now, will depend on who wins the battle of freedom to use public knowledge. If we lose, we will be just a footnote. If we win, it is uncertain whether people will know the role of the GNU operating system-if they think the system is "Linux," they will build a false picture of what happened and why.
+
+_1 But even if we win, what history people learn a hundred years from now is likely to depend on who dominates politically.
+
+Searching for his own 19th-century historical analogy, Stallman summons the figure of John Brown, the militant abolitionist regarded as a hero on one side of the Mason Dixon line and a madman on the other.
+
+John Brown's slave revolt never got going, but during his subsequent trial he effectively roused national demand for abolition. During the Civil War, John Brown was a hero; 100 years after, and for much of the 1900s, history textbooks taught that he was crazy. During the era of legal segregation, while bigotry was shameless, the US partly accepted the story that the South wanted to tell about itself, and history textbooks said many untrue things about the Civil War and related events.
+
+Such comparisons document both the self-perceived peripheral nature of Stallman's current work and the binary nature of his current reputation. Although it's hard to see Stallman's reputation falling to the level of infamy as Brown's did during the post-Reconstruction period-Stallman, despite his occasional war-like analogies, has done little to inspire violence-it's easy to envision a future in which Stallman's ideas wind up on the ash-heap. In fashioning the free software cause not as a mass movement but as a collection of private battles against the forces of proprietary temptation, Stallman seems to have created a unwinnable situation, especially for the many acolytes with the same stubborn will.
+
+Then again, it is that very will that may someday prove to be Stallman's greatest lasting legacy. Moglen, a close observer over the last decade, warns those who mistake the Stallman personality as counter-productive or epiphenomenal to the "artifacts" of Stallman's life. Without that personality, Moglen says, there would be precious few artifiacts to discuss. Says Moglen, a former Supreme Court clerk:
+
+_1 Look, the greatest man I ever worked for was Thurgood Marshall. I knew what made him a great man. I knew why he had been able to change the world in his possible way. I would be going out on a limb a little bit if I were to make a comparison, because they could not be more different. Thurgood Marshall was a man in society, representing an outcast society to the society that enclosed it, but still a man in society. His skill was social skills. But he was all of a piece, too. Different as they were in every other respect, that the person I most now compare him to in that sense, all of a piece, compact, made of the substance that makes stars, all the way through, is Stallman.
+={Marshall, Thurgood}
+
+In an effort to drive that image home, Moglen reflects on a shared moment in the spring of 2000. The success of the VA Linux IPO was still resonating in the business media, and a half dozen free software-related issues were swimming through the news. Surrounded by a swirling hurricane of issues and stories each begging for comment, Moglen recalls sitting down for lunch with Stallman and feeling like a castaway dropped into the eye of the storm. For the next hour, he says, the conversation calmly revolved around a single topic: strengthening the GPL.
+={VA Linux}
+
+"We were sitting there talking about what we were going to do about some problems in Eastern Europe and what we were going to do when the problem of the ownership of content began to threaten free software," Moglen recalls. "As we were talking, I briefly thought about how we must have looked to people passing by. Here we are, these two little bearded anarchists, plotting and planning the next steps. And, of course, Richard is plucking the knots from his hair and dropping them in the soup and behaving in his usual way. Anybody listening in on our conversation would have thought we were crazy, but I knew: I knew the revolution's right here at this table. This is what's making it happen. And this man is the person making it happen."
+
+Moglen says that moment, more than any other, drove home the elemental simplicity of the Stallman style.
+
+"It was funny," recalls Moglen. "I said to him, `Richard, you know, you and I are the two guys who didn't make any money out of this revolution.' And then I paid for the lunch, because I knew he didn't have the money to pay for it .'"
+
+1~ Chapter 14 - Epilogue: Crushing Loneliness
+
+Writing the biography of a living person is a bit like producing a play. The drama in front of the curtain often pales in comparison to the drama backstage.
+
+In The Autobiography of Malcolm X, Alex Haley gives readers a rare glimpse of that backstage drama. Stepping out of the ghostwriter role, Haley delivers the book's epilogue in his own voice. The epilogue explains how a freelance reporter originally dismissed as a "tool" and "spy" by the Nation of Islam spokesperson managed to work through personal and political barriers to get Malcolm X's life story on paper.
+={Autobiography of Malcolm X, The (Haley)+1;Haley, Alex}
+
+While I hesitate to compare this book with The Autobiography of Malcolm X, I do owe a debt of gratitude to Haley for his candid epilogue. Over the last 12 months, it has served as a sort of instruction manual on how to deal with a biographical subject who has built an entire career on being disagreeable. From the outset, I envisioned closing this biography with a similar epilogue, both as an homage to Haley and as a way to let readers know how this book came to be.
+
+The story behind this story starts in an Oakland apartment, winding its way through the various locales mentioned in the book-Silicon Valley, Maui, Boston, and Cambridge. Ultimately, however, it is a tale of two cities: New York, New York, the book-publishing capital of the world, and Sebastopol, California, the book-publishing capital of Sonoma County.
+
+The story starts in April, 2000. At the time, I was writing stories for the ill-fated BeOpen web site ( http://www.beopen.com/ ). One of my first assignments was a phone interview with Richard M. Stallman. The interview went well, so well that Slashdot ( http://www.slashdot.org/ ), the popular "news for nerds" site owned by VA Software, Inc. (formerly VA Linux Systems and before that, VA Research), gave it a link in its daily list of feature stories. Within hours, the web servers at BeOpen were heating up as readers clicked over to the site.
+={BeOpen.com+3;VA Linux;VA Research;VA Software, Inc.;Slashdot}
+
+For all intents and purposes, the story should have ended there. Three months after the interview, while attending the O'Reilly Open Source Conference in Monterey, California, I received the following email message from Tracy Pattison, foreign-rights manager at a large New York publishing house:
+={Monterey (California);O'Reilly & Associates:Open Source Conferences;Pattison, Tracy}
+
+poem{
+
+To: sam@BeOpen.com Subject:
+
+RMS InterviewDate: Mon, 10 Jul 2000 15:56:37 -0400Dear Mr. Williams,
+
+I read your interview with Richard Stallman on BeOpen with great
+interest. I've been intrigued by RMS and his work for some time now
+and was delighted to find your piece which I really think you did a
+great job of capturing some of the spirit of what Stallman is trying
+to do with GNU-Linux and the Free Software Foundation.
+
+What I'd love to do, however, is read more - and I don't think I'm
+alone. Do you think there is more information and/or sources out there
+to expand and update your interview and adapt it into more of a
+profile of Stallman? Perhaps including some more anecdotal information
+about his personality and background that might really interest and
+enlighten readers outside the more hardcore programming scene?
+
+}poem
+
+The email asked that I give Tracy a call to discuss the idea further. I did just that. Tracy told me her company was launching a new electronic book line, and it wanted stories that appealed to an early-adopter audience. The e-book format was 30,000 words, about 100 pages, and she had pitched her bosses on the idea of profiling a major figure in the hacker community. Her bosses liked the idea, and in the process of searching for interesting people to profile, she had come across my BeOpen interview with Stallman. Hence her email to me.
+
+That's when Tracy asked me: would I be willing to expand the interview into a full-length feature profile?
+
+My answer was instant: yes. Before accepting it, Tracy suggested I put together a story proposal she could show her superiors. Two days later, I sent her a polished proposal. A week later, Tracy sent me a follow up email. Her bosses had given it the green light.
+
+I have to admit, getting Stallman to participate in an e-book project was an afterthought on my part. As a reporter who covered the open source beat, I knew Stallman was a stickler. I'd already received a half dozen emails at that point upbraiding me for the use of "Linux" instead of "GNU/Linux."
+
+Then again, I also knew Stallman was looking for ways to get his message out to the general public. Perhaps if I presented the project to him that way, he would be more receptive. If not, I could always rely upon the copious amounts of documents, interviews, and recorded online conversations Stallman had left lying around the Internet and do an unauthorized biography.
+
+During my research, I came across an essay titled "Freedom-Or Copyright?" Written by Stallman and published in the June, 2000, edition of the MIT Technology Review, the essay blasted e-books for an assortment of software sins. Not only did readers have to use proprietary software programs to read them, Stallman lamented, but the methods used to prevent unauthorized copying were overly harsh. Instead of downloading a transferable HTML or PDF file, readers downloaded an encrypted file. In essence, purchasing an e-book meant purchasing a nontransferable key to unscramble the encrypted content. Any attempt to open a book's content without an authorized key constituted a criminal violation of the Digital Millennium Copyright Act, the 1998 law designed to bolster copyright enforcement on the Internet. Similar penalties held for readers who converted a book's content into an open file format, even if their only intention was to read the book on a different computer in their home. Unlike a normal book, the reader no longer held the right to lend, copy, or resell an e-book. They only had the right to read it on an authorized machine, warned Stallman:
+={Digital Millennium Copyright Act}
+
+% additional reference to the Digital Millenium Copyright Act
+
+_1 We still have the same old freedoms in using paper books. But if e-books replace printed books, that exception will do little good. With "electronic ink," which makes it possible to download new text onto an apparently printed piece of paper, even newspapers could become ephemeral. Imagine: no more used book stores; no more lending a book to your friend; no more borrowing one from the public library-no more "leaks" that might give someone a chance to read without paying. (And judging from the ads for Microsoft Reader, no more anonymous purchasing of books either.) This is the world publishers have in mind for us.~{ See "Safari Tech Books Online; Subscriber Agreement: Terms of Service." \\ http://safari.oreilly.com/mainhlp.asp?help=service }~
+
+Needless to say, the essay caused some concern. Neither Tracy nor I had discussed the software her company would use nor had we discussed the type of copyright that would govern the e-book's usage. I mentioned the Technology Review article and asked if she could give me information on her company's e-book policies. Tracy promised to get back to me.
+
+Eager to get started, I decided to call Stallman anyway and mention the book idea to him. When I did, he expressed immediate interest and immediate concern. "Did you read my essay on e-books?" he asked.
+
+When I told him, yes, I had read the essay and was waiting to hear back from the publisher, Stallman laid out two conditions: he didn't want to lend support to an e-book licensing mechanism he fundamentally opposed, and he didn't want to come off as lending support. "I don't want to participate in anything that makes me look like a hypocrite," he said.
+
+For Stallman, the software issue was secondary to the copyright issue. He said he was willing to ignore whatever software the publisher or its third-party vendors employed just so long as the company specified within the copyright that readers were free to make and distribute verbatim copies of the e-book's content. Stallman pointed to Stephen King's /{The Plant}/ as a possible model. In June, 2000, King announced on his official web site that he was self-publishing /{The Plant}/ in serial form. According to the announcement, the book's total cost would be $13, spread out over a series of $1 installments. As long as at least 75% of the readers paid for each chapter, King promised to continue releasing new installments. By August, the plan seemed to be working, as King had published the first two chapters with a third on the way.
+={King, Stephen;open source+4;Plant, The (King)}
+
+"I'd be willing to accept something like that," Stallman said. "As long as it also permitted verbatim copying."
+
+I forwarded the information to Tracy. Feeling confident that she and I might be able to work out an equitable arrangement, I called up Stallman and set up the first interview for the book. Stallman agreed to the interview without making a second inquiry into the status issue. Shortly after the first interview, I raced to set up a second interview (this one in Kihei), squeezing it in before Stallman headed off on a 14-day vacation to Tahiti.
+
+% ={Kihei (Hawaii)}
+
+It was during Stallman's vacation that the bad news came from Tracy. Her company's legal department didn't want to adjust its copyright notice on the e-books. Readers who wanted to make their books transferable would either have to crack the encryption code or convert the book to an open format such as HTML. Either way, the would be breaking the law and facing criminal penalties.
+
+With two fresh interviews under my belt, I didn't see any way to write the book without resorting to the new material. I quickly set up a trip to New York to meet with my agent and with Tracy to see if there was a compromise solution.
+
+When I flew to New York, I met my agent, Henning Guttman. It was our first face-to-face meeting, and Henning seemed pessimistic about our chances of forcing a compromise, at least on the publisher's end. The large, established publishing houses already viewed the e-book format with enough suspicion and weren't in the mood to experiment with copyright language that made it easier for readers to avoid payment. As an agent who specialized in technology books, however, Henning was intrigued by the novel nature of my predicament. I told him about the two interviews I'd already gathered and the promise not to publish the book in a way that made Stallman "look like a hypocrite." Agreeing that I was in an ethical bind, Henning suggested we make that our negotiating point.
+={Guttman, Henning}
+
+Barring that, Henning said, we could always take the carrot-and-stick approach. The carrot would be the publicity that came with publishing an e-book that honored the hacker community's internal ethics. The stick would be the risks associated with publishing an e-book that didn't. Nine months before Dmitri Skylarov became an Internet cause cÈlËbre, we knew it was only a matter of time before an enterprising programmer revealed how to hack e-books. We also knew that a major publishing house releasing an encryption-protected e-book on Richard M. Stallman was the software equivalent of putting "Steal This E-Book" on the cover.
+={Skylarov, Dmitri}
+
+After my meeting with Henning, I put a call into Stallman. Hoping to make the carrot more enticing, I discussed a number of potential compromises. What if the publisher released the book's content under a split license, something similar to what Sun Microsystems had done with Open Office, the free software desktop applications suite? The publisher could then release commercial versions of the e-book under a normal format, taking advantage of all the bells and whistles that went with the e-book software, while releasing the copyable version under a less aesthetically pleasing HTML format.
+
+Stallman told me he didn't mind the split-license idea, but he did dislike the idea of making the freely copyable version inferior to the restricted version. Besides, he said, the idea was too cumbersome. Split licenses worked in the case of Sun's Open Office only because he had no control over the decision making. In this case, Stallman said, he did have a way to control the outcome. He could refuse to cooperate.
+
+I made a few more suggestions with little effect. About the only thing I could get out of Stallman was a concession that the e-book's copyright restrict all forms of file sharing to "noncommercial redistribution."
+
+Before I signed off, Stallman suggested I tell the publisher that I'd promised Stallman that the work would be free. I told Stallman I couldn't agree to that statement but that I did view the book as unfinishable without his cooperation. Seemingly satisfied, Stallman hung up with his usual sign-off line: "Happy hacking."
+
+Henning and I met with Tracy the next day. Tracy said her company was willing to publish copyable excerpts in a unencrypted format but would limit the excerpts to 500 words. Henning informed her that this wouldn't be enough for me to get around my ethical obligation to Stallman. Tracy mentioned her own company's contractual obligation to online vendors such as Amazon.com. Even if the company decided to open up its e-book content this one time, it faced the risk of its partners calling it a breach of contract. Barring a change of heart in the executive suite or on the part of Stallman, the decision was up to me. I could use the interviews and go against my earlier agreement with Stallman, or I could plead journalistic ethics and back out of the verbal agreement to do the book.
+={Amazon.com}
+
+Following the meeting, my agent and I relocated to a pub on Third Ave. I used his cell phone to call Stallman, leaving a message when nobody answered. Henning left for a moment, giving me time to collect my thoughts. When he returned, he was holding up the cell phone.
+
+"It's Stallman," Henning said.
+
+The conversation got off badly from the start. I relayed Tracy's comment about the publisher's contractual obligations.
+
+"So," Stallman said bluntly. "Why should I give a damn about their contractual obligations?"
+
+Because asking a major publishing house to risk a legal battle with its vendors over a 30,000 word e-book is a tall order, I suggested.
+
+"Don't you see?" Stallman said. "That's exactly why I'm doing this. I want a signal victory. I want them to make a choice between freedom and business as usual."
+
+As the words "signal victory" echoed in my head, I felt my attention wander momentarily to the passing foot traffic on the sidewalk. Coming into the bar, I had been pleased to notice that the location was less than half a block away from the street corner memorialized in the 1976 Ramones song, "53rd and 3rd," a song I always enjoyed playing in my days as a musician. Like the perpetually frustrated street hustler depicted in that song, I could feel things falling apart as quickly as they had come together. The irony was palpable. After weeks of gleefully recording other people's laments, I found myself in the position of trying to pull off the rarest of feats: a Richard Stallman compromise.
+
+When I continued hemming and hawing, pleading the publisher's position and revealing my growing sympathy for it, Stallman, like an animal smelling blood, attacked.
+
+"So that's it? You're just going to screw me? You're just going to bend to their will?"
+
+I brought up the issue of a dual-copyright again.
+
+"You mean license," Stallman said curtly.
+
+"Yeah, license. Copyright. Whatever," I said, feeling suddenly like a wounded tuna trailing a rich plume of plasma in the water.
+
+"Aw, why didn't you just fucking do what I told you to do!" he shouted.
+
+I must have been arguing on behalf of the publisher to the very end, because in my notes I managed to save a final Stallman chestnut: "I don't care. What they're doing is evil. I can't support evil. Good-bye."
+
+As soon as I put the phone down, my agent slid a freshly poured Guinness to me. "I figured you might need this," he said with a laugh. "I could see you shaking there towards the end."
+
+I was indeed shaking. The shaking wouldn't stop until the Guinness was more than halfway gone. It felt weird, hearing myself characterized as an emissary of "evil." It felt weirder still, knowing that three months before, I was sitting in an Oakland apartment trying to come up with my next story idea. Now, I was sitting in a part of the world I'd only known through rock songs, taking meetings with publishing executives and drinking beer with an agent I'd never even laid eyes on until the day before. It was all too surreal, like watching my life reflected back as a movie montage.
+
+About that time, my internal absurdity meter kicked in. The initial shaking gave way to convulsions of laughter. To my agent, I must have looked like a another fragile author undergoing an untimely emotional breakdown. To me, I was just starting to appreciate the cynical beauty of my situation. Deal or no deal, I already had the makings of a pretty good story. It was only a matter of finding a place to tell it. When my laughing convulsions finally subsided, I held up my drink in a toast.
+
+"Welcome to the front lines, my friend," I said, clinking pints with my agent. "Might as well enjoy it."
+
+If this story really were a play, here's where it would take a momentary, romantic interlude. Disheartened by the tense nature of our meeting, Tracy invited Henning and I to go out for drinks with her and some of her coworkers. We left the bar on Third Ave., headed down to the East Village, and caught up with Tracy and her friends.
+
+Once there, I spoke with Tracy, careful to avoid shop talk. Our conversation was pleasant, relaxed. Before parting, we agreed to meet the next night. Once again, the conversation was pleasant, so pleasant that the Stallman e-book became almost a distant memory.
+
+When I got back to Oakland, I called around to various journalist friends and acquaintances. I recounted my predicament. Most upbraided me for giving up too much ground to Stallman in the preinterview negotiation. A former j-school professor suggested I ignore Stallman's "hypocrite" comment and just write the story. Reporters who knew of Stallman's media-savviness expressed sympathy but uniformly offered the same response: it's your call.
+
+I decided to put the book on the back burner. Even with the interviews, I wasn't making much progress. Besides, it gave me a chance to speak with Tracy without running things past Henning first. By Christmas we had traded visits: she flying out to the west coast once, me flying out to New York a second time. The day before New Year's Eve, I proposed. Deciding which coast to live on, I picked New York. By February, I packed up my laptop computer and all my research notes related to the Stallman biography, and we winged our way to JFK Airport. Tracy and I were married on May 11. So much for failed book deals.
+
+During the summer, I began to contemplate turning my interview notes into a magazine article. Ethically, I felt in the clear doing so, since the original interview terms said nothing about traditional print media. To be honest, I also felt a bit more comfortable writing about Stallman after eight months of radio silence. Since our telephone conversation in September, I'd only received two emails from Stallman. Both chastised me for using "Linux" instead of "GNU/Linux" in a pair of articles for the web magazine /{Upside Today}/. Aside from that, I had enjoyed the silence. In June, about a week after the New York University speech, I took a crack at writing a 5,000-word magazine-length story about Stallman. This time, the words flowed. The distance had helped restore my lost sense of emotional perspective, I suppose.
+={Upside Today web magazine}
+
+In July, a full year after the original email from Tracy, I got a call from Henning. He told me that O'Reilly & Associates, a publishing house out of Sebastopol, California, was interested in the running the Stallman story as a biography. The news pleased me. Of all the publishing houses in the world, O'Reilly, the same company that had published Eric Raymond's The Cathedral and the Bazaar, seemed the most sensitive to the issues that had killed the earlier e-book. As a reporter, I had relied heavily on the O'Reilly book Open Sources as a historical reference. I also knew that various chapters of the book, including a chapter written by Stallman, had been published with copyright notices that permitted redistribution. Such knowledge would come in handy if the issue of electronic publication ever came up again.
+={Cathedral and the Bazaar, The (Raymond);O'Reilly & Associates;Open Sources (DiBona, et al)+2;Raymond, Eric}
+
+Sure enough, the issue did come up. I learned through Henning that O'Reilly intended to publish the biography both as a book and as part of its new Safari Tech Books Online subscription service. The Safari user license would involve special restrictions,1 Henning warned, but O'Reilly was willing to allow for a copyright that permitted users to copy and share and the book's text regardless of medium. Basically, as author, I had the choice between two licenses: the Open Publication License or the GNU Free Documentation License.
+={Open Publication License (OPL)+8;OPL (Open Publication License)+8;Safari Tech Books Online subscription service}
+
+I checked out the contents and background of each license. The Open Publication License (OPL)~{ See "The Open Publication License: Draft v1.0" (June 8, 1999). \\ http://opencontent.org/openpub/ }~ gives readers the right to reproduce and distribute a work, in whole or in part, in any medium "physical or electronic," provided the copied work retains the Open Publication License. It also permits modification of a work, provided certain conditions are met. Finally, the Open Publication License includes a number of options, which, if selected by the author, can limit the creation of "substantively modified" versions or book-form derivatives without prior author approval.
+
+The GNU Free Documentation License (GFDL),~{ See "The GNU Free Documentation License: Version 1.1" (March, 2000). \\ http://www.gnu.org/copyleft/fdl.html }~ meanwhile, permits the copying and distribution of a document in any medium, provided the resulting work carries the same license. It also permits the modification of a document provided certain conditions. Unlike the OPL, however, it does not give authors the option to restrict certain modifications. It also does not give authors the right to reject modifications that might result in a competitive book product. It does require certain forms of front- and back-cover information if a party other than the copyright holder wishes to publish more than 100 copies of a protected work, however.
+={GFDL (GNU Free Documentation License)+1;GNU Free Documentation License (GFDL)+1}
+
+In the course of researching the licenses, I also made sure to visit the GNU Project web page titled "Various Licenses and Comments About Them."~{ See http://www.gnu.org/philosophy/license-list.html }~ On that page, I found a Stallman critique of the Open Publication License. Stallman's critique related to the creation of modified works and the ability of an author to select either one of the OPL's options to restrict modification. If an author didn't want to select either option, it was better to use the GFDL instead, Stallman noted, since it minimized the risk of the nonselected options popping up in modified versions of a document.
+
+The importance of modification in both licenses was a reflection of their original purpose-namely, to give software-manual owners a chance to improve their manuals and publicize those improvements to the rest of the community. Since my book wasn't a manual, I had little concern about the modification clause in either license. My only concern was giving users the freedom to exchange copies of the book or make copies of the content, the same freedom they would have enjoyed if they purchased a hardcover book. Deeming either license suitable for this purpose, I signed the O'Reilly contract when it came to me.
+
+Still, the notion of unrestricted modification intrigued me. In my early negotiations with Tracy, I had pitched the merits of a GPL-style license for the e-book's content. At worst, I said, the license would guarantee a lot of positive publicity for the e-book. At best, it would encourage readers to participate in the book-writing process. As an author, I was willing to let other people amend my work just so long as my name always got top billing. Besides, it might even be interesting to watch the book evolve. I pictured later editions looking much like online versions of the Talmud, my original text in a central column surrounded by illuminating, third-party commentary in the margins.
+
+My idea drew inspiration from Project Xanadu ( http://www.xanadu.com/ ), the legendary software concept originally conceived by Ted Nelson in 1960. During the O'Reilly Open Source Conference in 1999, I had seen the first demonstration of the project's open source offshoot Udanax and had been wowed by the result. In one demonstration sequence, Udanax displayed a parent document and a derivative work in a similar two-column, plain-text format. With a click of the button, the program introduced lines linking each sentence in the parent to its conceptual offshoot in the derivative. An e-book biography of Richard M. Stallman didn't have to be Udanax-enabled, but given such technological possibilities, why not give users a chance to play around?~{ Anybody willing to "port" this book over to Udanax, the free software version of Xanadu, will receive enthusiastic support from me. To find out more about this intriguing technology, visit http://www.udanax.com/. }~
+={Nelson, Ted;O'Reilly & Associates:Open Source Conferences;Project Xanadu;Udanax}
+
+When Laurie Petrycki, my editor at O'Reilly, gave me a choice between the OPL or the GFDL, I indulged the fantasy once again. By September of 2001, the month I signed the contract, e-books had become almost a dead topic. Many publishing houses, Tracy's included, were shutting down their e-book imprints for lack of interest. I had to wonder. If these companies had treated e-books not as a form of publication but as a form of community building, would those imprints have survived?
+={GFDL (GNU Free Documentation License)+1;GNU Free Documentation License (GFDL)+1;Petrycki, Laurie}
+
+After I signed the contract, I notified Stallman that the book project was back on. I mentioned the choice O'Reilly was giving me between the Open Publication License and the GNU Free Documentation License. I told him I was leaning toward the OPL, if only for the fact I saw no reason to give O'Reilly's competitors a chance to print the same book under a different cover. Stallman wrote back, arguing in favor of the GFDL, noting that O'Reilly had already used it several times in the past. Despite the events of the past year, I suggested a deal. I would choose the GFDL if it gave me the possibility to do more interviews and if Stallman agreed to help O'Reilly publicize the book. Stallman agreed to participate in more interviews but said that his participation in publicity-related events would depend on the content of the book. Viewing this as only fair, I set up an interview for December 17, 2001 in Cambridge.
+
+I set up the interview to coincide with a business trip my wife Tracy was taking to Boston. Two days before leaving, Tracy suggested I invite Stallman out to dinner.
+
+"After all," she said, "he is the one who brought us together."
+
+I sent an email to Stallman, who promptly sent a return email accepting the offer. When I drove up to Boston the next day, I met Tracy at her hotel and hopped the T to head over to MIT. When we got to Tech Square, I found Stallman in the middle of a conversation just as we knocked on the door.
+
+"I hope you don't mind," he said, pulling the door open far enough so that Tracy and I could just barely hear Stallman's conversational counterpart. It was a youngish woman, mid-20s I'd say, named Sarah.
+
+"I took the liberty of inviting somebody else to have dinner with us," Stallman said, matter-of-factly, giving me the same cat-like smile he gave me back in that Palo Alto restaurant.
+
+To be honest, I wasn't too surprised. The news that Stallman had a new female friend had reached me a few weeks before, courtesy of Stallman's mother. "In fact, they both went to Japan last month when Richard went over to accept the Takeda Award," Lippman told me at the time.~{ Alas, I didn't find out about the Takeda Foundation's decision to award Stallman, along with Linus Torvalds and Ken Sakamura, with its first-ever award for "Techno-Entrepreneurial Achievement for Social/Economic Well-Being" until after Stallman had made the trip to Japan to accept the award. For more information about the award and its accompanying $1 million prize, visit the Takeda site, http://www.takeda-foundation.jp/ }~
+={Takeda Awards}
+
+On the way over to the restaurant, I learned the circumstances of Sarah and Richard's first meeting. Interestingly, the circumstances were very familiar. Working on her own fictional book, Sarah said she heard about Stallman and what an interesting character he was. She promptly decided to create a character in her book on Stallman and, in the interests of researching the character, set up an interview with Stallman. Things quickly went from there. The two had been dating since the beginning of 2001, she said.
+
+"I really admired the way Richard built up an entire political movement to address an issue of profound personal concern," Sarah said, explaining her attraction to Stallman.
+
+My wife immediately threw back the question: "What was the issue?"
+
+"Crushing loneliness."
+
+During dinner, I let the women do the talking and spent most of the time trying to detect clues as to whether the last 12 months had softened Stallman in any significant way. I didn't see anything to suggest they had. Although more flirtatious than I remembered-a flirtatiousness spoiled somewhat by the number of times Stallman's eyes seemed to fixate on my wife's chest-Stallman retained the same general level of prickliness. At one point, my wife uttered an emphatic "God forbid" only to receive a typical Stallman rebuke.
+
+"I hate to break it to you, but there is no God," Stallman said.
+
+Afterwards, when the dinner was complete and Sarah had departed, Stallman seemed to let his guard down a little. As we walked to a nearby bookstore, he admitted that the last 12 months had dramatically changed his outlook on life. "I thought I was going to be alone forever," he said. "I'm glad I was wrong."
+
+Before parting, Stallman handed me his "pleasure card," a business card listing Stallman's address, phone number, and favorite pastimes ("sharing good books, good food and exotic music and dance") so that I might set up a final interview.
+
+{free_as_in_freedom_04_rms_pleasure_card.png 355x207 "Stallman's 'pleasure' card, handed to me the night of our dinner." }http://en.wikipedia.org/wiki/Richard_stallman
+
+The next day, over another meal of dim sum, Stallman seemed even more lovestruck than the night before. Recalling his debates with Currier House dorm maters over the benefits and drawbacks of an immortality serum, Stallman expressed hope that scientists might some day come up with the key to immortality. "Now that I'm finally starting to have happiness in my life, I want to have more," he said.
+
+When I mentioned Sarah's "crushing loneliness" comment, Stallman failed to see a connection between loneliness on a physical or spiritual level and loneliness on a hacker level. "The impulse to share code is about friendship but friendship at a much lower level," he said. Later, however, when the subject came up again, Stallman did admit that loneliness, or the fear of perpetual loneliness, had played a major role in fueling his determination during the earliest days of the GNU Project.
+
+"My fascination with computers was not a consequence of anything else," he said. "I wouldn't have been less fascinated with computers if I had been popular and all the women flocked to me. However, it's certainly true the experience of feeling I didn't have a home, finding one and losing it, finding another and having it destroyed, affected me deeply. The one I lost was the dorm. The one that was destroyed was the AI Lab. The precariousness of not having any kind of home or community was very powerful. It made me want to fight to get it back."
+
+After the interview, I couldn't help but feel a certain sense of emotional symmetry. Hearing Sarah describe what attracted her to Stallman and hearing Stallman himself describe the emotions that prompted him to take up the free software cause, I was reminded of my own reasons for writing this book. Since July, 2000, I have learned to appreciate both the seductive and the repellent sides of the Richard Stallman persona. Like Eben Moglen before me, I feel that dismissing that persona as epiphenomenal or distracting in relation to the overall free software movement would be a grievous mistake. In many ways the two are so mutually defining as to be indistinguishable.
+
+While I'm sure not every reader feels the same level of affinity for Stallman-indeed, after reading this book, some might feel zero affinity-I'm sure most will agree. Few individuals offer as singular a human portrait as Richard M. Stallman. It is my sincere hope that, with this initial portrait complete and with the help of the GFDL, others will feel a similar urge to add their own perspective to that portrait.
+
+1~appendix_a Appendix A - Terminology
+
+For the most part, I have chosen to use the term GNU/Linux in reference to the free software operating system and Linux when referring specifically to the kernel that drives the operating system. The most notable exception to this rule comes in Chapter 9. In the final part of that chapter, I describe the early evolution of Linux as an offshoot of Minix. It is safe to say that during the first two years of the project's development, the operating system Torvalds and his colleagues were working on bore little similarity to the GNU system envisioned by Stallman, even though it gradually began to share key components, such as the GNU C Compiler and the GNU Debugger.
+
+This decision further benefits from the fact that, prior to 1993, Stallman saw little need to insist on credit.
+
+Some might view the decision to use GNU/Linux for later versions of the same operating system as arbitrary. I would like to point out that it was in no way a prerequisite for gaining Stallman's cooperation in the making of this book. I came to it of my own accord, partly because of the operating system's modular nature and the community surrounding it, and partly because of the apolitical nature of the Linux name. Given that this is a biography of Richard Stallman, it seemed inappropriate to define the operating system in apolitical terms.
+
+In the final phases of the book, when it became clear that O'Reilly & Associates would be the book's publisher, Stallman did make it a condition that I use "GNU/Linux" instead of Linux if O'Reilly expected him to provide promotional support for the book after publication. When informed of this, I relayed my earlier decision and left it up to Stallman to judge whether the resulting book met this condition or not. At the time of this writing, I have no idea what Stallman's judgment will be.
+
+A similar situation surrounds the terms "free software" and "open source." Again, I have opted for the more politically laden "free software" term when describing software programs that come with freely copyable and freely modifiable source code. Although more popular, I have chosen to use the term "open source" only when referring to groups and businesses that have championed its usage. But for a few instances, the terms are completely interchangeable, and in making this decision I have followed the advice of Christine Peterson, the person generally credited with coining the term. "The `free software' term should still be used in circumstances where it works better," Peterson writes. "[`Open source'] caught on mainly because a new term was greatly needed, not because it's ideal."
+={Peterson, Christine}
+
+1~appendix_b Appendix B - Hack, Hackers, and Hacking
+={hackers+18}
+
+To understand the full meaning of the word " hacker," it helps to examine the word's etymology over the years.
+
+/{The New Hacker Dictionary}/, an online compendium of software-programmer jargon, officially lists nine different connotations of the word "hack" and a similar number for "hacker." Then again, the same publication also includes an accompanying essay that quotes Phil Agre, an MIT hacker who warns readers not to be fooled by the word's perceived flexibility. "Hack has only one meaning," argues Agre. "An extremely subtle and profound one which defies articulation."
+={Agre, Phil;New Hacker Dictionary, The}
+
+Regardless of the width or narrowness of the definition, most modern hackers trace the word back to MIT, where the term bubbled up as popular item of student jargon in the early 1950s. In 1990 the MIT Museum put together a journal documenting the hacking phenomenon. According to the journal, students who attended the institute during the fifties used the word "hack" the way a modern student might use the word "goof." Hanging a jalopy out a dormitory window was a "hack," but anything harsh or malicious-e.g., egging a rival dorm's windows or defacing a campus statue-fell outside the bounds. Implicit within the definition of "hack" was a spirit of harmless, creative fun.
+={MIT Museum}
+
+This spirit would inspire the word's gerund form: "hacking." A 1950s student who spent the better part of the afternoon talking on the phone or dismantling a radio might describe the activity as "hacking." Again, a modern speaker would substitute the verb form of "goof"-"goofing" or "goofing off"-to describe the same activity.
+
+As the 1950s progressed, the word "hack" acquired a sharper, more rebellious edge. The MIT of the 1950s was overly competitive, and hacking emerged as both a reaction to and extension of that competitive culture. Goofs and pranks suddenly became a way to blow off steam, thumb one's nose at campus administration, and indulge creative thinking and behavior stifled by the Institute's rigorous undergraduate curriculum. With its myriad hallways and underground steam tunnels, the Institute offered plenty of exploration opportunities for the student undaunted by locked doors and "No Trespassing" signs. Students began to refer to their off-limits explorations as "tunnel hacking." Above ground, the campus phone system offered similar opportunities. Through casual experimentation and due diligence, students learned how to perform humorous tricks. Drawing inspiration from the more traditional pursuit of tunnel hacking, students quickly dubbed this new activity "phone hacking."
+
+The combined emphasis on creative play and restriction-free exploration would serve as the basis for the future mutations of the hacking term. The first self-described computer hackers of the 1960s MIT campus originated from a late 1950s student group called the Tech Model Railroad Club. A tight clique within the club was the Signals and Power (S&P) Committee-the group behind the railroad club's electrical circuitry system. The system was a sophisticated assortment of relays and switches similar to the kind that controlled the local campus phone system. To control it, a member of the group simply dialed in commands via a connected phone and watched the trains do his bidding.
+={Tech Model Railroad Club;S&P (Signals and Power) Committee+2;Signals and Power (S&P) Committee+2}
+
+The nascent electrical engineers responsible for building and maintaining this system saw their activity as similar in spirit to phone hacking. Adopting the hacking term, they began refining it even further. From the S&P hacker point of view, using one less relay to operate a particular stretch of track meant having one more relay for future play. Hacking subtly shifted from a synonym for idle play to a synonym for idle play that improved the overall performance or efficiency of the club's railroad system at the same time. Soon S&P committee members proudly referred to the entire activity of improving and reshaping the track's underlying circuitry as "hacking" and to the people who did it as "hackers."
+
+Given their affinity for sophisticated electronics-not to mention the traditional MIT-student disregard for closed doors and "No Trespassing" signs-it didn't take long before the hackers caught wind of a new machine on campus. Dubbed the TX-0, the machine was one of the first commercially marketed computers. By the end of the 1950s, the entire S&P clique had migrated en masse over to the TX-0 control room, bringing the spirit of creative play with them. The wide-open realm of computer programming would encourage yet another mutation in etymology. "To hack" no longer meant soldering unusual looking circuits, but cobbling together software programs with little regard to "official" methods or software-writing procedures. It also meant improving the efficiency and speed of already-existing programs that tended to hog up machine resources. True to the word's roots, it also meant writing programs that served no other purpose than to amuse or entertain.
+={TX-0 computer}
+
+A classic example of this expanded hacking definition is the game Spacewar, the first interactive video game. Developed by MIT hackers in the early 1960s, Spacewar had all the traditional hacking definitions: it was goofy and random, serving little useful purpose other than providing a nightly distraction for the dozen or so hackers who delighted in playing it. From a software perspective, however, it was a monumental testament to innovation of programming skill. It was also completely free. Because hackers had built it for fun, they saw no reason to guard their creation, sharing it extensively with other programmers. By the end of the 1960s, Spacewar had become a favorite diversion for mainframe programmers around the world.
+
+This notion of collective innovation and communal software ownership distanced the act of computer hacking in the 1960s from the tunnel hacking and phone hacking of the 1950s. The latter pursuits tended to be solo or small-group activities. Tunnel and phone hackers relied heavily on campus lore, but the off-limits nature of their activity discouraged the open circulation of new discoveries. Computer hackers, on the other hand, did their work amid a scientific field biased toward collaboration and the rewarding of innovation. Hackers and "official" computer scientists weren't always the best of allies, but in the rapid evolution of the field, the two species of computer programmer evolved a cooperative-some might say symbiotic-relationship.
+
+It is a testament to the original computer hackers' prodigious skill that later programmers, including Richard M. Stallman, aspired to wear the same hacker mantle. By the mid to late 1970s, the term "hacker" had acquired elite connotations. In a general sense, a computer hacker was any person who wrote software code for the sake of writing software code. In the particular sense, however, it was a testament to programming skill. Like the term "artist," the meaning carried tribal overtones. To describe a fellow programmer as hacker was a sign of respect. To describe oneself as a hacker was a sign of immense personal confidence. Either way, the original looseness of the computer-hacker appellation diminished as computers became more common.
+
+As the definition tightened, "computer" hacking acquired additional semantic overtones. To be a hacker, a person had to do more than write interesting software; a person had to belong to the hacker "culture" and honor its traditions the same way a medieval wine maker might pledge membership to a vintners' guild. The social structure wasn't as rigidly outlined as that of a guild, but hackers at elite institutions such as MIT, Stanford, and Carnegie Mellon began to speak openly of a "hacker ethic": the yet-unwritten rules that governed a hacker's day-to-day behavior. In the 1984 book Hackers, author Steven Levy, after much research and consultation, codified the hacker ethic as five core hacker tenets.
+={Hackers (Levy)+1}
+
+% ={Carnegie Mellon University}
+
+In many ways, the core tenets listed by Levy continue to define the culture of computer hacking. Still, the guild-like image of the hacker community was undermined by the overwhelmingly populist bias of the software industry. By the early 1980s, computers were popping up everywhere, and programmers who once would have had to travel to top-rank institutions or businesses just to gain access to a machine suddenly had the ability to rub elbows with major-league hackers via the ARPAnet. The more these programmers rubbed elbows, the more they began to appropriate the anarchic philosophies of the hacker culture in places like MIT. Lost within the cultural transfer, however, was the native MIT cultural taboo against malicious behavior. As younger programmers began employing their computer skills to harmful ends-creating and disseminating computer viruses, breaking into military computer systems, deliberately causing machines such as MIT Oz, a popular ARPAnet gateway, to crash-the term "hacker" acquired a punk, nihilistic edge. When police and businesses began tracing computer-related crimes back to a few renegade programmers who cited convenient portions of the hacking ethic in defense of their activities, the word "hacker" began appearing in newspapers and magazine stories in a negative light. Although books like Hackers did much to document the original spirit of exploration that gave rise to the hacking culture, for most news reporters, "computer hacker" became a synonym for "electronic burglar."
+={ARPAnet}
+
+Although hackers have railed against this perceived misusage for nearly two decades, the term's rebellious connotations dating back to the 1950s make it hard to discern the 15-year-old writing software programs that circumvent modern encryption programs from the 1960s college student, picking locks and battering down doors to gain access to the lone, office computer terminal. One person's creative subversion of authority is another person's security headache, after all. Even so, the central taboo against malicious or deliberately harmful behavior remains strong enough that most hackers prefer to use the term "cracker"-i.e., a person who deliberately cracks a computer security system to steal or vandalize data-to describe the subset of hackers who apply their computing skills maliciously.
+={crackers}
+
+This central taboo against maliciousness remains the primary cultural link between the notion of hacking in the early 21st century and hacking in the 1950s. It is important to note that, as the idea of computer hacking has evolved over the last four decades, the original notion of hacking-i.e., performing pranks or exploring underground tunnels-remains intact. In the fall of 2000, the MIT Museum paid tradition to the Institute's age-old hacking tradition with a dedicated exhibit, the Hall of Hacks. The exhibit includes a number of photographs dating back to the 1920s, including one involving a mock police cruiser. In 1993, students paid homage to the original MIT notion of hacking by placing the same police cruiser, lights flashing, atop the Institute's main dome. The cruiser's vanity license plate read IHTFP, a popular MIT acronym with many meanings. The most noteworthy version, itself dating back to the pressure-filled world of MIT student life in the 1950s, is "I hate this fucking place." In 1990, however, the Museum used the acronym as a basis for a journal on the history of hacks. Titled, The Institute for Hacks Tomfoolery and Pranks, the journal offers an adept summary of the hacking.
+={Hall of Hacks}
+
+"In the culture of hacking, an elegant, simple creation is as highly valued as it is in pure science," writes /{Boston Globe}/ reporter Randolph Ryan in a 1993 article attached to the police car exhibit. "A Hack differs from the ordinary college prank in that the event usually requires careful planning, engineering and finesse, and has an underlying wit and inventiveness," Ryan writes. "The unwritten rule holds that a hack should be good-natured, non-destructive and safe. In fact, hackers sometimes assist in dismantling their own handiwork."
+={Boston Globe;Ryan, Randolph}
+
+The urge to confine the culture of computer hacking within the same ethical boundaries is well-meaning but impossible. Although most software hacks aspire to the same spirit of elegance and simplicity, the software medium offers less chance for reversibility. Dismantling a police cruiser is easy compared with dismantling an idea, especially an idea whose time has come. Hence the growing distinction between "black hat" and "white hat"-i.e., hackers who turn new ideas toward destructive, malicious ends versus hackers who turn new ideas toward positive or, at the very least, informative ends.
+
+Once a vague item of obscure student jargon, the word "hacker" has become a linguistic billiard ball, subject to political spin and ethical nuances. Perhaps this is why so many hackers and journalists enjoy using it. Where that ball bounces next, however, is anybody's guess.
+
+1~appendix_c Appendix C - GNU Free Documentation License (GFDL)
+={GFDL (GNU Free Documentation License)+64;GNU Free Documentation License (GFDL)+64}
+
+GNU Free Documentation License Version 1.1, March 2000 Copyright (C) 2000 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,~{ FSF address changed from: 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA }~ USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
+
+!_ PREAMBLE
+
+The purpose of this License is to make a manual, textbook, or other written document "free" in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others.
+
+This License is a kind of "copyleft," which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software.
+
+We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference.
+
+!_ APPLICABILITY AND DEFINITIONS
+
+This License applies to any manual or other work that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License. The "Document", below, refers to any such manual or work. Any member of the public is a licensee, and is addressed as "you."
+
+A "Modified Version" of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language.
+
+A "Secondary Section" is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document's overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (For example, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial, philosophical, ethical or political position regarding them.
+
+The "Invariant Sections" are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License.
+
+The "Cover Texts" are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License.
+
+A "Transparent" copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, whose contents can be viewed and edited directly and straightforwardly with generic text editors or (for images composed of pixels) generic paint programs or (for drawings) some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose markup has been designed to thwart or discourage subsequent modification by readers is not Transparent. A copy that is not "Transparent" is called "Opaque."
+
+Examples of suitable formats for Transparent copies include plain ASCII without markup, Texinfo input format, LaTeX input format, SGML or XML using a publicly available DTD, and standard-conforming simple HTML designed for human modification. Opaque formats include PostScript, PDF, proprietary formats that can be read and edited only by proprietary word processors, SGML or XML for which the DTD and/or processing tools are not generally available, and the machine-generated HTML produced by some word processors for output purposes only.
+
+The "Title Page" means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For works in formats which do not have any title page as such, "Title Page" means the text near the most prominent appearance of the work's title, preceding the beginning of the body of the text.
+
+!_ VERBATIM COPYING
+
+You may copy and distribute the Document in any medium, either commercially or noncommercially, provided that this License, the copyright notices, and the license notice saying this License applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough number of copies you must also follow the conditions in section 3.
+
+You may also lend copies, under the same conditions stated above, and you may publicly display copies.
+
+!_ COPYING IN QUANTITY
+
+If you publish printed copies of the Document numbering more than 100, and the Document's license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The front cover must present the full title with all words of the title equally prominent and visible. You may add other material on the covers in addition. Copying with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects.
+
+If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages.
+
+If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a publicly-accessible computer-network location containing a complete Transparent copy of the Document, free of added material, which the general network-using public has access to download anonymously at no charge using public-standard network protocols. If you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that edition to the public.
+
+It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document.
+
+!_ MODIFICATIONS
+
+You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it. In addition, you must do these things in the Modified Version:
+
+_1 1. Use in the Title Page (and on the covers, if any) a title distinct from that of the Document, and from those of previous versions (which should, if there were any, be listed in the History section of the Document). You may use the same title as a previous version if the original publisher of that version gives permission.
+
+_1 2. List on the Title Page, as authors, one or more persons or entities responsible for authorship of the modifications in the Modified Version, together with at least five of the principal authors of the Document (all of its principal authors, if it has less than five).
+
+_1 3. State on the Title page the name of the publisher of the Modified Version, as the publisher.
+
+_1 4. Preserve all the copyright notices of the Document.
+
+_1 5. Add an appropriate copyright notice for your modifications adjacent to the other copyright notices.
+
+_1 6. Include, immediately after the copyright notices, a license notice giving the public permission to use the Modified Version under the terms of this License, in the form shown in the Addendum below.
+
+_1 7. Preserve in that license notice the full lists of Invariant Sections and required Cover Texts given in the Document's license notice.
+
+_1 8. Include an unaltered copy of this License.
+
+_1 9. Preserve the section entitled "History," and its title, and add to it an item stating at least the title, year, new authors, and publisher of the Modified Version as given on the Title Page. If there is no section entitled "History" in the Document, create one stating the title, year, authors, and publisher of the Document as given on its Title Page, then add an item describing the Modified Version as stated in the previous sentence.
+
+_1 10. Preserve the network location, if any, given in the Document for public access to a Transparent copy of the Document, and likewise the network locations given in the Document for previous versions it was based on. These may be placed in the "History" section. You may omit a network location for a work that was published at least four years before the Document itself, or if the original publisher of the version it refers to gives permission.
+
+_1 11. In any section entitled "Acknowledgements" or "Dedications," preserve the section's title, and preserve in the section all the substance and tone of each of the contributor acknowledgements and/or dedications given therein.
+
+_1 12. Preserve all the Invariant Sections of the Document, unaltered in their text and in their titles. Section numbers or the equivalent are not considered part of the section titles.
+
+_1 13. Delete any section entitled "Endorsements." Such a section may not be included in the Modified Version.
+
+_1 14. Do not retitle any existing section as "Endorsements" or to conflict in title with any Invariant Section.
+
+If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version's license notice. These titles must be distinct from any other section titles.
+
+You may add a section entitled "Endorsements," provided it contains nothing but endorsements of your Modified Version by various parties-for example, statements of peer review or that the text has been approved by an organization as the authoritative definition of a standard.
+
+You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on explicit permission from the previous publisher that added the old one.
+
+The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version.
+
+!_ COMBINING DOCUMENTS
+
+You may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice.
+
+The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number. Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work.
+
+In the combination, you must combine any sections entitled "History" in the various original documents, forming one section entitled "History"; likewise combine any sections entitled "Acknowledgements," and any sections entitled "Dedications." You must delete all sections entitled "Endorsements."
+
+!_ COLLECTIONS OF DOCUMENTS
+
+You may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects.
+
+You may extract a single document from such a collection, and distribute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document.
+
+!_ AGGREGATION WITH INDEPENDENT WORKS
+
+A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, does not as a whole count as a Modified Version of the Document, provided no compilation copyright is claimed for the compilation. Such a compilation is called an "aggregate," and this License does not apply to the other self-contained works thus compiled with the Document, on account of their being thus compiled, if they are not themselves derivative works of the Document.
+
+If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one quarter of the entire aggregate, the Document's Cover Texts may be placed on covers that surround only the Document within the aggregate. Otherwise they must appear on covers around the whole aggregate.
+
+!_ TRANSLATION
+
+Translation is considered a kind of modification, so you may distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections. You may include a translation of this License provided that you also include the original English version of this License. In case of a disagreement between the translation and the original English version of this License, the original English version will prevail.
+
+!_ TERMINATION
+
+You may not copy, modify, sublicense, or distribute the Document except as expressly provided for under this License. Any other attempt to copy, modify, sublicense or distribute the Document is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
+
+!_ FUTURE REVISIONS OF THIS LICENSE
+
+The Free Software Foundation may publish new, revised versions of the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See http://www.gnu.org/copyleft/
+
+Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License "or any later version" applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation.
+
+!_ ADDENDUM: How to Use This License for Your Documents
+
+To use this License in a document you have written, include a copy of the License in the document and put the following copyright and license notices just after the title page:
+
+_1 Copyright (C) YEAR YOUR NAME.Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with the Invariant Sections being LIST THEIR TITLES, with the Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST. A copy of the license is included in the section entitled "GNU Free Documentation License".
+
+If you have no Invariant Sections, write "with no Invariant Sections" instead of saying which ones are invariant. If you have no Front-Cover Texts, write "no Front-Cover Texts" instead of "Front-Cover Texts being LIST"; likewise for Back-Cover Texts.
+
+If your document contains nontrivial examples of program code, we recommend releasing these examples in parallel under your choice of free software license, such as the GNU General Public License, to permit their use in free software.
+
+%% SiSU markup sample Notes:
+% SiSU http://www.jus.uio.no/sisu
+% SiSU markup for 0.16 and later:
+% 0.20.4 header 0~links
+% 0.22 may drop image dimensions (rmagick)
+% 0.23 utf-8 ß
+% 0.38 or later, may use alternative notation for headers, e.g. @title: (instead of 0~title)
+% 0.38 document structure alternative markup, experimental (rad) A,B,C,1,2,3 maps to 1,2,3,4,5,6
+% Output: http://www.jus.uio.no/sisu/free_as_in_freedom.richard_stallman_crusade_for_free_software.sam_williams/sisu_manifest.html
+% SiSU 0.38 experimental (alternative structure) markup used for this document
diff --git a/data/doc/sisu/markup-samples/samples/free_as_in_freedom_2.richard_stallman_and_the_free_software_revolution.sam_williams.richard_stallman.sst b/data/doc/sisu/markup-samples/v3/samples/free_as_in_freedom_2.richard_stallman_and_the_free_software_revolution.sam_williams.richard_stallman.sst
index 43d64ab4..4b040a75 100644
--- a/data/doc/sisu/markup-samples/samples/free_as_in_freedom_2.richard_stallman_and_the_free_software_revolution.sam_williams.richard_stallman.sst
+++ b/data/doc/sisu/markup-samples/v3/samples/free_as_in_freedom_2.richard_stallman_and_the_free_software_revolution.sam_williams.richard_stallman.sst
@@ -14,19 +14,19 @@
:license: Published under the GNU Free Documentation License. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License."
@classify:
- :topic_register: SiSU:markup sample:book;copyright;GNU/Linux:GPL|copyleft|free software;free software;Software:Software Libré;GPL;Linux:GNU|Software Libré;book:biography;programming
+ :topic_register: SiSU markup sample:book:biography;book:biography;copyright;GNU/Linux:GPL|copyleft|free software;free software;Software:Software Libré;GPL;Linux:GNU|Software Libré;programming
@links:
- {Home and Source}http://faifzilla.org/
- {@ Wikipedia}http://en.wikipedia.org/wiki/Free_as_in_Freedom:_Richard_Stallman%27s_Crusade_for_Free_Software
- {@ Amazon.com}http://www.amazon.com/gp/product/0596002874
- {@ Barnes & Noble}http://search.barnesandnoble.com/booksearch/isbnInquiry.asp?isbn=0596002874
- {SiSU}http://sisudoc.org/
- {sources / git}http://sources.sisudoc.org/
+ { Home and Source }http://faifzilla.org/
+ { @ Wikipedia }http://en.wikipedia.org/wiki/Free_as_in_Freedom:_Richard_Stallman%27s_Crusade_for_Free_Software
+ { @ Amazon.com }http://www.amazon.com/gp/product/0596002874
+ { @ Barnes & Noble }http://search.barnesandnoble.com/booksearch/isbnInquiry.asp?isbn=0596002874
+ { SiSU }http://sisudoc.org/
+ { sources / git }http://sources.sisudoc.org/
@make:
- :skin: skin_rms2
:breaks: new=:A,:B,:C,1
+ :skin: skin_rms2
% http://static.fsf.org/nosvn/faif-2.0.pdf
% http://www.scribd.com/doc/55232810/Free-as-in-Freedom-Richard-Stallman
diff --git a/data/doc/sisu/markup-samples/samples/sisu_output_overview.ssi b/data/doc/sisu/markup-samples/v3/samples/sisu_output_overview.ssi
index e2c90529..e2c90529 100644
--- a/data/doc/sisu/markup-samples/samples/sisu_output_overview.ssi
+++ b/data/doc/sisu/markup-samples/v3/samples/sisu_output_overview.ssi
diff --git a/data/doc/sisu/markup-samples/sisu_manual/_sisu/image/GnuDebianLinuxRubyBetterWay.png b/data/doc/sisu/markup-samples/v3/sisu_manual/_sisu/image/GnuDebianLinuxRubyBetterWay.png
index ce5b8830..ce5b8830 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/_sisu/image/GnuDebianLinuxRubyBetterWay.png
+++ b/data/doc/sisu/markup-samples/v3/sisu_manual/_sisu/image/GnuDebianLinuxRubyBetterWay.png
Binary files differ
diff --git a/data/doc/sisu/markup-samples/sisu_manual/_sisu/image/ruby_logo.png b/data/doc/sisu/markup-samples/v3/sisu_manual/_sisu/image/ruby_logo.png
index 829e2458..829e2458 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/_sisu/image/ruby_logo.png
+++ b/data/doc/sisu/markup-samples/v3/sisu_manual/_sisu/image/ruby_logo.png
Binary files differ
diff --git a/data/doc/sisu/markup-samples/sisu_manual/_sisu/image/sisu.home.png b/data/doc/sisu/markup-samples/v3/sisu_manual/_sisu/image/sisu.home.png
index b449fa6b..b449fa6b 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/_sisu/image/sisu.home.png
+++ b/data/doc/sisu/markup-samples/v3/sisu_manual/_sisu/image/sisu.home.png
Binary files differ
diff --git a/data/doc/sisu/markup-samples/sisu_manual/_sisu/image/sisu.png b/data/doc/sisu/markup-samples/v3/sisu_manual/_sisu/image/sisu.png
index b449fa6b..b449fa6b 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/_sisu/image/sisu.png
+++ b/data/doc/sisu/markup-samples/v3/sisu_manual/_sisu/image/sisu.png
Binary files differ
diff --git a/data/doc/sisu/markup-samples/sisu_manual/_sisu/image/tux.png b/data/doc/sisu/markup-samples/v3/sisu_manual/_sisu/image/tux.png
index 15fd152b..15fd152b 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/_sisu/image/tux.png
+++ b/data/doc/sisu/markup-samples/v3/sisu_manual/_sisu/image/tux.png
Binary files differ
diff --git a/data/doc/sisu/markup-samples/sisu_manual/_sisu/skin/yml/list.yml b/data/doc/sisu/markup-samples/v3/sisu_manual/_sisu/skin/yml/list.yml
index 0d4235ab..0d4235ab 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/_sisu/skin/yml/list.yml
+++ b/data/doc/sisu/markup-samples/v3/sisu_manual/_sisu/skin/yml/list.yml
diff --git a/data/doc/sisu/markup-samples/sisu_manual/_sisu/skin/yml/promo.yml b/data/doc/sisu/markup-samples/v3/sisu_manual/_sisu/skin/yml/promo.yml
index 2971ff81..2971ff81 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/_sisu/skin/yml/promo.yml
+++ b/data/doc/sisu/markup-samples/v3/sisu_manual/_sisu/skin/yml/promo.yml
diff --git a/data/doc/sisu/markup-samples/sisu_manual/_sisu/v3/sisurc.yml b/data/doc/sisu/markup-samples/v3/sisu_manual/_sisu/v3/sisurc.yml
index 6d11656d..6d11656d 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/_sisu/v3/sisurc.yml
+++ b/data/doc/sisu/markup-samples/v3/sisu_manual/_sisu/v3/sisurc.yml
diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu.ssm b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu.ssm
index 666b2575..666b2575 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/sisu.ssm
+++ b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu.ssm
diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_commands.sst b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_commands.sst
index 6a86aabb..17f1c22a 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/sisu_commands.sst
+++ b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_commands.sst
@@ -48,7 +48,7 @@
2~ Description
-SiSU is a document publishing system, that from a simple single marked-up document, produces multiple output formats including: plaintext, html, xhtml, XML, epub, odt (odf text), LaTeX, pdf, info, and SQL (PostgreSQL and SQLite), which share text object numbers ("object citation numbering") and the same document structure information. For more see: http://www.jus.uio.no/sisu
+SiSU is a document publishing system, that from a simple single marked-up document, produces multiple output formats including: plaintext, HTML, XHTML, XML, EPUB, ODT (OpenDocument (ODF) text), LaTeX, PDF, info, and SQL (PostgreSQL and SQLite), which share text object numbers ("object citation numbering") and the same document structure information. For more see: http://sisudoc.org or http://www.jus.uio.no/sisu
% 2~ Summary of man page
@@ -223,7 +223,7 @@ see --pdf
produces LaTeX pdf (portrait.pdf & landscape.pdf). Default paper size is set in config file, or document header, or provided with additional command line parameter, e.g. --papersize-a4 preset sizes include: 'A4', U.S. 'letter' and 'legal' and book sizes 'A5' and 'B5' (system defaults to A4). Alias -p
!_ --pg [instruction] [filename] \\
-database postgresql ( --pgsql may be used instead) possible instructions, include: --createdb; --create; --dropall; --import [filename]; --update [filename]; --remove [filename]; see database section below. Alias -D
+database PostgreSQL ( --pgsql may be used instead) possible instructions, include: --createdb; --create; --dropall; --import [filename]; --update [filename]; --remove [filename]; see database section below. Alias -D
!_ --po [language_directory/filename language_directory] \\
see --po4a
@@ -265,13 +265,13 @@ see --sisupod
see --source
!_ --sample-search-form [--webserv=webrick] \\
-generate examples of (naive) cgi search form for sqlite and pgsql depends on your already having used sisu to populate an sqlite and/or pgsql database, (the sqlite version scans the output directories for existing sisu_sqlite databases, so it is first necessary to create them, before generating the search form) see -d -D and the database section below. If the optional parameter --webserv=webrick is passed, the cgi examples created will be set up to use the default port set for use by the webrick server, (otherwise the port is left blank and the system setting used, usually 80). The samples are dumped in the present work directory which must be writable, (with screen instructions given that they be copied to the cgi-bin directory). Alias -F
+generate examples of (naive) cgi search form for SQLite and PgSQL depends on your already having used sisu to populate an SQLite and/or PgSQL database, (the SQLite version scans the output directories for existing sisu_sqlite databases, so it is first necessary to create them, before generating the search form) see -d -D and the database section below. If the optional parameter --webserv=webrick is passed, the cgi examples created will be set up to use the default port set for use by the webrick server, (otherwise the port is left blank and the system setting used, usually 80). The samples are dumped in the present work directory which must be writable, (with screen instructions given that they be copied to the cgi-bin directory). Alias -F
!_ --scp [filename/wildcard] \\
copies sisu output files to remote host using scp. This requires that sisurc.yml has been provided with information on hostname and username, and that you have your "keys" and ssh agent in place. Also see --rsync. Alias -r
!_ --sqlite --[instruction] [filename] \\
-database type set to sqlite, this produces one of two possible databases, without additional database related instructions it produces a discreet sqlite file for the document processed; with additional instructions it produces a common sqlite database of all processed documents that (come from the same document preparation directory and as a result) share the same output directory base path (possible instructions include: --createdb; --create; --dropall; --import [filename]; --update [filename]; --remove [filename]); see database section below. Alias -d
+database type set to SQLite, this produces one of two possible databases, without additional database related instructions it produces a discreet SQLite file for the document processed; with additional instructions it produces a common SQLite database of all processed documents that (come from the same document preparation directory and as a result) share the same output directory base path (possible instructions include: --createdb; --create; --dropall; --import [filename]; --update [filename]; --remove [filename]); see database section below. Alias -d
!_ --sisupod \\
produces a sisupod a zipped sisu directory of markup files including sisu markup source files and the directories local configuration file, images and skins. Note: this only includes the configuration files or skins contained in ./_sisu not those in ~/.sisu -S [filename/wildcard] option. Note: (this option is tested only with zsh). Alias -S
@@ -381,22 +381,22 @@ strips output text of editor endnotes~[+ square brackets ]~ denoted by dagger/pl
dbi - database interface
--D or --pgsql set for postgresql -d or --sqlite default set for sqlite -d is modifiable with --db=[database type (pgsql or sqlite)]
+-D or --pgsql set for PostgreSQL -d or --sqlite default set for SQLite -d is modifiable with --db=[database type (PgSQL or SQLite)]
!_ --pg -v --createall \\
-initial step, creates required relations (tables, indexes) in existing postgresql database (a database should be created manually and given the same name as working directory, as requested) (rb.dbi) [ -dv --createall sqlite equivalent] it may be necessary to run sisu -Dv --createdb initially NOTE: at the present time for postgresql it may be necessary to manually create the database. The command would be 'createdb [database name]' where database name would be SiSU_[present working directory name (without path)]. Please use only alphanumerics and underscores.
+initial step, creates required relations (tables, indexes) in existing PostgreSQL database (a database should be created manually and given the same name as working directory, as requested) (rb.dbi) [ -dv --createall SQLite equivalent] it may be necessary to run sisu -Dv --createdb initially NOTE: at the present time for PostgreSQL it may be necessary to manually create the database. The command would be 'createdb [database name]' where database name would be SiSU_[present working directory name (without path)]. Please use only alphanumerics and underscores.
!_ --pg -v --import \\
-[filename/wildcard] imports data specified to postgresql db (rb.dbi) [ -dv --import sqlite equivalent]
+[filename/wildcard] imports data specified to PostgreSQL db (rb.dbi) [ -dv --import SQLite equivalent]
!_ --pg -v --update \\
-[filename/wildcard] updates/imports specified data to postgresql db (rb.dbi) [ -dv --update sqlite equivalent]
+[filename/wildcard] updates/imports specified data to PostgreSQL db (rb.dbi) [ -dv --update SQLite equivalent]
!_ --pg --remove \\
-[filename/wildcard] removes specified data to postgresql db (rb.dbi) [ -d --remove sqlite equivalent]
+[filename/wildcard] removes specified data to PostgreSQL db (rb.dbi) [ -d --remove SQLite equivalent]
!_ --pg --dropall \\
-kills data" and drops (postgresql or sqlite) db, tables & indexes [ -d --dropall sqlite equivalent]
+kills data" and drops (PostgreSQL or SQLite) db, tables & indexes [ -d --dropall SQLite equivalent]
The -v is for verbose output.
diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_config.ssi b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_config.ssi
index 853580b3..853580b3 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/sisu_config.ssi
+++ b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_config.ssi
diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_content_directories.ssi b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_content_directories.ssi
index 514e0439..514e0439 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/sisu_content_directories.ssi
+++ b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_content_directories.ssi
diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_css.ssi b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_css.ssi
index 9eb680ed..9eb680ed 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/sisu_css.ssi
+++ b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_css.ssi
diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_description.sst b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_description.sst
index 840d6338..ec16f4f6 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/sisu_description.sst
+++ b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_description.sst
@@ -39,7 +39,7 @@
:breaks: new=C; break=1
:skin: skin_sisu
:bold: /Debian|Ruby|SiSU|ocn|object citation numbering|granular search|rant|utf-?8|WARNING/
- :italics: /Linux|FreeBSD|Dragonfly|Perl|LaTeX|Postgresql|PostgreSQL|Postgres|sqlite|SQL|Reiserfs|PHP|xml|XML|Ion|g?vim|ascii|pdf|xhtml|pdflatex|pgsql|Postscript|texinfo|metadata|metatags|metaverse|rant|rake|YAML|object citation system|ocn|object citation numbering|granular search|Dublin Core|Lex Mercatoria|Project Gutenberg|Slashdot/i
+ :italics: /Linux|FreeBSD|Dragonfly|Perl|LaTeX|Postgresql|PostgreSQL|Postgres|sqlite|SQL|PHP|xml|XML|Ion|g?vim|ascii|pdf|xhtml|pdflatex|pgsql|Postscript|texinfo|metadata|metatags|metaverse|rant|rake|YAML|object citation system|ocn|object citation numbering|granular search|Dublin Core|Lex Mercatoria/i
:A~? @title @creator
@@ -55,27 +55,27 @@ SiSU ("SiSU information Structuring Universe" or "Structured information, Serial
Using markup applied to a document, SiSU can produce plain text, HTML, XHTML, XML, OpenDocument, EPUB, LaTeX or PDF files, and populate an SQL database with objects~{ objects include: headings, paragraphs, verse, tables, images, but not footnotes/endnotes which are numbered separately and tied to the object from which they are referenced. }~ (equating generally to paragraph-sized chunks) so searches may be performed and matches returned with that degree of granularity (e.g. your search criteria is met by these documents and at these locations within each document). Document output formats share a common object numbering system for locating content. This is particularly suitable for "published" works (finalized texts as opposed to works that are frequently changed or updated) for which it provides a fixed means of reference of content.
-SiSU is the data/information structuring and transforming tool, that has resulted from work on one of the oldest law web projects. It makes possible the one time, simple human readable markup of documents, that SiSU can then publish in various forms, suitable for paper~{ pdf via LaTeX }~, web~{ currently html (two forms of html presentation one based on css the other on tables), and /PHP/; potentially structured XML }~ and relational database~{ any SQL - currently PostgreSQL and /sqlite/ (for portability, testing and development) }~ presentations, retaining common data-structure and meta-information across the output/presentation formats. Several requirements of legal and scholarly publication on the web have been addressed, including the age old need to be able to reliably cite/pinpoint text within a document, to easily make footnotes/endnotes, to allow for semantic document meta-tagging, and to keep required markup to a minimum. These and other features of interest are listed and described below. A few points are worth making early (and will be repeated a number of times):
+SiSU is the data/information structuring and transforming tool, that has resulted from work on one of the oldest law web projects. It makes possible the one time, simple human readable markup of documents, that SiSU can then publish in various forms, suitable for paper~{ PDF via LaTeX }~, web~{ currently HTML (two forms of HTML presentation one based on css the other on tables), and /PHP/; potentially structured XML }~ and relational database~{ any SQL - currently PostgreSQL and SQLite (for portability, testing and development) }~ presentations, retaining common data-structure and meta-information across the output/presentation formats. Several requirements of legal and scholarly publication on the web have been addressed, including the age old need to be able to reliably cite/pinpoint text within a document, to easily make footnotes/endnotes, to allow for semantic document meta-tagging, and to keep required markup to a minimum. These and other features of interest are listed and described below. A few points are worth making early (and will be repeated a number of times):
_1 (i) The SiSU document generator was the first to place material on the web with a system that makes possible citation across different document types, with paragraph, or rather object citation numbering~{ previously called "text object numbering" }~ a text positioning system, available for the pinpointing of text, 1997, a simple idea from which much benefit, and SiSU remains today, to the best of my knowledge, the only multiple format e-book/ electronic-document system on the web that gives you this possibility (including for relational databases).
_1 (ii) Markup is done once for the multiple formats produced.
-_1 (iii) Markup is simple, and human readable (with a little practice), in almost all cases there is less and simpler markup required than basic html. In any event the markup required is very much simpler than the html, EPUB, LaTeX, [lout], structured XML, ODF (OpenDocument), PostgreSQL or SQLite feed etc. that you can have SiSU generate for you.
+_1 (iii) Markup is simple, and human readable (with a little practice), in almost all cases there is less and simpler markup required than basic HTML. In any event the markup required is very much simpler than the HTML, EPUB, LaTeX, [lout], structured XML, ODT (Open Document Format text), PostgreSQL or SQLite feed etc. that you can have SiSU generate for you.
_1 (iv) SiSU is a batch processor, dealing with as many files as you need to generate at a time.
-_1 (v) Scalability is dependent on your file system (in my case Reiserfs), the database (currently Postgresql and/or SQLite) and your hardware.
+_1 (v) Scalability is dependent on your file system, the database (currently PostgreSQL and/or SQLite) and your hardware.
-SiSU Sabaki~{ SiSU Sabaki, release version. Pre-release version SiSU Scribe, and version prior to that SiSU nicknamed Scribbler. Pre-release versions go back several years. Both Scribbler and Scribe (still maintained) made system calls to SiSU's various parts, instead of using libraries. }~ (or just SiSU) is the provisional name given to the software described here that helps structure documents for web and other publication. The name SiSU is a loose anagram for something along the lines of *{/{"SiSU is structuring unit"}/}*, or /{"SiSU, information structuring unit"}/ or the more descriptive /{"Structured information, Serialized Units"}/ or *{/{"simple - information structuring unit"}/}* or the more descriptive /{"Structured information, Serialized Units"}/ or what it may be directed towards /{"*semantic* and *{information structuring universe}*"}/,~{ A little universe it may be, but semantic you may have a hard time getting away with, given the meaning the word has taken on with markup. On a document wide basis semantic information may be provided, which can be really useful, (and meaningful, especially) if you have a large document set, and use this with rss feeds or in an sql database etc. On a markup level, I have little inclination to add semantic markup formally beyond references, title, author [Dublin Core entities? addresses?] etc. Actually this deserves a bit of thought possibly use letter tags (including letter alias/synonyms for font faces) to create a small set of default semantic tags, with the possibility for per document adjustments. Will seek to permit XML entity tagging, within SiSU markup and have that ignored/removed by the parts of the program that have no use for it. }~ tongue in cheek, only just. Guess I'll get away with *{/{"Simple - information Structuring Universe"}/}*. SiSU is also a Finnish word roughly meaning guts, inner strength and perseverance.~{ "Sisu refers not to the courage of optimism, but to a concept of life that says, 'I may not win, but I will gladly give my life for what I believe.'" Aini Rajanen, Of Finnish Ways, 1981, p. 10.<br> http://www.humanlanguages.com/finnishenglish/rlfs.htm <br>"Every Finn has his own pet definition. To me, sisu means patience without passion. But there are many varieties of sisu. Sisu can be a sudden outburst or it can be the kind that lasts. A man can have both kinds. It is outside reason. It is something in the soul. It comes from oneself. For instance, it makes a soldier do things because he himself must, not because he has been told." Paavo Nurmi<br> http://personalweb.smcvt.edu/tmatikainen/finnishtraditions.htm }~
+SiSU Sabaki~{ SiSU Sabaki, release version. Pre-release version SiSU Scribe, and version prior to that SiSU nicknamed Scribbler. Pre-release versions go back several years. Both Scribbler and Scribe (still maintained) made system calls to SiSU's various parts, instead of using libraries. }~ (or just SiSU) is the provisional name given to the software described here that helps structure documents for web and other publication. The name SiSU is a loose anagram for something along the lines of *{/{"SiSU is structuring unit"}/}*, or /{"SiSU, information structuring unit"}/ or the more descriptive /{"Structured information, Serialized Units"}/ or *{/{"simple - information structuring unit"}/}* or the more descriptive /{"Structured information, Serialized Units"}/ or what it may be directed towards /{"*semantic* and *{information structuring universe}*"}/,~{ A little universe it may be, but semantic you may have a hard time getting away with, given the meaning the word has taken on with markup. On a document wide basis semantic information may be provided, which can be really useful, (and meaningful, especially) if you have a large document set, and use this with rss feeds or in an sql database etc. On a markup level, I have little inclination to add semantic markup formally beyond references, title, author [Dublin Core entities? addresses?] etc. Actually this deserves a bit of thought possibly use letter tags (including letter alias/synonyms for font faces) to create a small set of default semantic tags, with the possibility for per document adjustments. Will seek to permit XML entity tagging, within SiSU markup and have that ignored/removed by the parts of the program that have no use for it. }~ tongue in cheek, only just. Guess I'll get away with *{/{"Simple - information Structuring Universe"}/}*. SiSU is also a Finnish word roughly meaning guts, inner strength and perseverance.~{ "Sisu refers not to the courage of optimism, but to a concept of life that says, 'I may not win, but I will gladly give my life for what I believe.'" Aini Rajanen, Of Finnish Ways, 1981, p. 10. \\ http://www.humanlanguages.com/finnishenglish/rlfs.htm \\ "Every Finn has his own pet definition. To me, sisu means patience without passion. But there are many varieties of sisu. Sisu can be a sudden outburst or it can be the kind that lasts. A man can have both kinds. It is outside reason. It is something in the soul. It comes from oneself. For instance, it makes a soldier do things because he himself must, not because he has been told." Paavo Nurmi \\ http://personalweb.smcvt.edu/tmatikainen/finnishtraditions.htm }~
SiSU was born of the need to find a way, with minimal effort, and for as wide a range of document types as possible, to produce high quality publishing output in a variety of document formats. As such it was necessary to find a simple document representation that would work across a large number of document types, and the most convenient way(s) to produce acceptable output formats. The project leading to this program was started in 1993 (together with the trade law project now known as Lex Mercatoria) as an investigation of how to effectively/efficiently place documents on the web. The unified document handling, together with features such as paragraph numbering, endnote handling and tables... appeared in 1996/97. SiSU was originally written in Perl,~{ http://www.perl.org/ }~ and converted to Ruby,~{ http://www.ruby-lang.org/en/ }~ in 2000, one of the most impressive programming languages in existence! In its current form it has been written to run on the Gnu/Linux platform, and in particular on Debian,~{ http://www.debian.org/ }~ taking advantage of many of the wonderful projects that are available there.
-SiSU markup is based on requiring the minimum markup needed to determine the structure of a document. (This can be as little as saying in a header to look for the word Book at a specified level and the word Chapter at another level). SiSU then breaks a document into its smallest parts (at a heading, and paragraph level) while retaining all structural information. This break up of the document and information on its structure is taken advantage of in the transformations made in generating the very different output types that can be created, and in providing as much as can be for what each output type is best at doing, e.g. LaTeX (professional document typesetting, easy conversion to pdf or Postscript), EPUB, XML (in this case, structural representation), ODF (OpenDocument [experimental]), SQL (e.g. document search; representing constituent parts of documents based on their structure, headings, chapters, paragraphs as required; user control).~{ where explicit structure is provided through the use of tagging headings, it could be reduced (still) further, for example by reducing the number of characters used to identify heading levels; but in many cases even that information is not required as regular expressions can be used to extract the implicit structure. }~
+SiSU markup is based on requiring the minimum markup needed to determine the structure of a document. (This can be as little as saying in a header to look for the word Book at a specified level and the word Chapter at another level). SiSU then breaks a document into its smallest parts (at a heading, and paragraph level) while retaining all structural information. This break up of the document and information on its structure is taken advantage of in the transformations made in generating the very different output types that can be created, and in providing as much as can be for what each output type is best at doing, e.g. LaTeX (professional document typesetting, easy conversion to PDF or Postscript), EPUB, XML (in this case, structural representation), ODF (Open Document Format text), SQL (e.g. document search; representing constituent parts of documents based on their structure, headings, chapters, paragraphs as required; user control).~{ where explicit structure is provided through the use of tagging headings, it could be reduced (still) further, for example by reducing the number of characters used to identify heading levels; but in many cases even that information is not required as regular expressions can be used to extract the implicit structure. }~
-From markup that is simpler and more sparse than html you get:
+From markup that is simpler and more sparse than HTML you get:
-_* far greater output possibilities, including html, EPUB, XML, ODF (OpenDocument), LaTeX (pdf), and SQL;
+_* far greater output possibilities, including HTML, EPUB, XML, ODF (Open Document Format text), LaTeX (PDF), and SQL;
_* the advantages implicit in the very different output possibilities;
@@ -83,9 +83,9 @@ _* a common citation system (for all outputs - including the relational database
For more see the short summary of features provided below.
-SiSU processes files with minimal tagging to produce various document outputs including html, EPUB, ODF, LaTeX (which is converted to pdf) and if required loads the structured information into an SQL database (PostgreSQL and SQLite have been used for this). SiSU produces an intermediate processing format.~{ This proved to be the easiest way to develop syntax, changes could be made, or alternatives provided for the markup syntax whilst the intermediate markup syntax was largely held constant. There is actually an optional second intermediate markup format in YAML http://www.yaml.org/ }~
+SiSU processes files with minimal tagging to produce various document outputs including HTML, EPUB, ODF, LaTeX (which is converted to PDF) and if required loads the structured information into an SQL database (PostgreSQL and SQLite have been used for this). SiSU produces an intermediate processing format.~{ This proved to be the easiest way to develop syntax, changes could be made, or alternatives provided for the markup syntax whilst the intermediate markup syntax was largely held constant. There is actually an optional second intermediate markup format in YAML http://www.yaml.org/ }~
-SiSU was originally used in constructing Lex Mercatoria http://lexmercatoria.org/ or http://www.jus.uio.no/lm/ (one of the oldest law web sites), and considerable thought went into producing output that would be suitable for legal and academic writings (that do not have formulae) given the limitations of html, and publication in a wide variety of "formats", in particular in relation to the convenient and accurate citation of text. However, the construction of Lex Mercatoria uses only a fraction of the features available from SiSU today, /vis/ generation of flat file structures, rather than in addition the building of ("granular") SQL database content, (at an object level with relevant relational tables, and other outputs also available).
+SiSU was originally used in constructing Lex Mercatoria http://lexmercatoria.org/ or http://www.jus.uio.no/lm/ (one of the oldest law web sites), and considerable thought went into producing output that would be suitable for legal and academic writings (that do not have formulae) given the limitations of HTML, and publication in a wide variety of "formats", in particular in relation to the convenient and accurate citation of text. However, the construction of Lex Mercatoria uses only a fraction of the features available from SiSU today, /vis/ generation of flat file structures, rather than in addition the building of ("granular") SQL database content, (at an object level with relevant relational tables, and other outputs also available).
2~ Short summary of features *~summary
@@ -107,7 +107,7 @@ notes:
(a) multiple outputs primarily industry established and institutionally accepted open standard formats, include amongst others: plaintext (UTF-8); html; EPUB; (structured) XML; ODF (Open Document text)l; LaTeX; PDF (via LaTeX); SQL type databases (currently PostgreSQL and SQLite). Also produces: concordance files; document content certificates (md5 or sha256 digests of headings, paragraphs, images etc.) and html manifests (and sitemaps of content). (b) takes advantage of the strengths implicit in these very different output types, (e.g. PDFs produced using typesetting of LaTeX, databases populated with documents at an individual object/paragraph level, making possible granular search (and related possibilities))
!_ (iv)
-outputs share a common numbering system (dubbed "object citation numbering" (ocn)) that is meaningful (to man and machine) across various digital outputs whether paper, screen, or database oriented, (PDF, html, EPUB, XML, Opendocument, sqlite, postgresql), this numbering system can be used to reference content.
+outputs share a common numbering system (dubbed "object citation numbering" (ocn)) that is meaningful (to man and machine) across various digital outputs whether paper, screen, or database oriented, (PDF, html, EPUB, XML, Opendocument, SQLite, PostgreSQL), this numbering system can be used to reference content.
!_ (v)
SQL databases are populated at an object level (roughly headings, paragraphs, verse, tables) and become searchable with that degree of granularity, the output information provides the object/paragraph numbers which are relevant across all generated outputs; it is also possible to look at just the matching paragraphs of the documents in the database; [output indexing also work well with search indexing tools like hyperesteier].
@@ -145,7 +145,7 @@ there is a considerable degree of future-proofing, output representations are "u
there is a considerable degree of future-proofing, output representations are "upgradeable", and new document formats may be added: (a) modular, (thanks in no small part to Ruby) another output format required, write another module.... (b) easy to update output formats (eg html, XHTML, EPUB, LaTeX/PDF produced can be updated in program and run against whole document set), (c) easy to add, modify, or have alternative syntax rules for input, should you need to,
!_ (xvi)
-scalability, dependent on your file-system (ext3, Reiserfs, XFS, whatever) and on the relational database used (currently Postgresql and SQLite), and your hardware,
+scalability, dependent on your file-system and on the relational database used (currently PostgreSQL and SQLite), and your hardware,
!_ (xvii)
only marked up files need be backed up, to secure the larger document set produced,
@@ -189,7 +189,7 @@ This is a basic markup example:
_* { basic markup example, text file - an international convention }http://www.jus.uio.no/sisu/src/un_contracts_international_sale_of_goods_convention_1980.sst ~{ http://www.jus.uio.no/sisu/src/un_contracts_international_sale_of_goods_convention_1980.sst output provided as example in the next section }~
-Emphasis has been on simplicity and minimalism in markup requirements. Design philosophy is to try keep the amount of markup required low, for whatever has been determined to be acceptable output.~{ seems there are several "smart ASCIIs" available, primarily for ascii to html conversion, that make this, and reasonable looking ascii their goal<br /> http://webseitz.fluxent.com/wiki/SmartAscii <br> http://daringfireball.net/projects/markdown/ <br> http://www.textism.com/tools/textile/ }~
+Emphasis has been on simplicity and minimalism in markup requirements. Design philosophy is to try keep the amount of markup required low, for whatever has been determined to be acceptable output.~{ seems there are several "smart ASCIIs" available, primarily for ascii to html conversion, that make this, and reasonable looking ascii their goal \\ http://webseitz.fluxent.com/wiki/SmartAscii \\ http://daringfireball.net/projects/markdown/ \\ http://www.textism.com/tools/textile/ }~
SiSU's markup is more minimalistic and simpler than (the equivalent) html and for it, you get considerably more than just html, as this preparation gives you all available output formats, upon request.
@@ -229,7 +229,7 @@ _* {~^ Concordance }http://www.jus.uio.no/sisu/un_contracts_international_sale_o
3~ Syntax relatively easy to read and remember
-Syntax is kept simple and mnemonic.~{ SiSU markup syntax, an incomplete summary: http://www.jus.uio.no/sisu/sisu_markup/toc.html <br>Visual check of elementary font face modifiers: *bold* *{bold}* !{emphasis}! /{italics}/ _{underscore}_ -{strikethrough}- ^{superscript}^ ,{subscript}, }~
+Syntax is kept simple and mnemonic.~{ SiSU markup syntax, an incomplete summary: http://www.jus.uio.no/sisu/sisu_markup/toc.html \\ Visual check of elementary font face modifiers: *bold* *{bold}* !{emphasis}! /{italics}/ _{underscore}_ -{strikethrough}- ^{superscript}^ ,{subscript}, }~
3~ Kept simple by having a limited publishing feature set, and features identified as most important, are available across several document types
@@ -267,7 +267,7 @@ The object citation number markers contain additional numbering information with
An advantage is that the numbering remains the same regardless of document structure.
-Text object ("paragraph") numbering is the same for all output versions of the same document, vis html, epub, pdf, pgsql, etc.
+Text object ("paragraph") numbering is the same for all output versions of the same document, vis HTML, EPUB, PDF, PgSQL, etc.
In the relational database, as individual text objects of a document stored (and indexed) together with object numbers, and all versions of the document have the same numbering, the results of searches may be tailored just to provide the location of the search result in all available document formats.
@@ -354,13 +354,13 @@ Whilst it is skinnable, the default output styles are selected to work across th
From markup that is simpler and more sparse than html you get:
-_* far greater output possibilities, including multiple html types, XML (different structured types), LaTeX (pdf landscape, portrait), and SQL (Postgresql or SQLite or other);
+_* far greater output possibilities, including multiple html types, XML (different structured types), LaTeX (pdf landscape, portrait), and SQL (PostgreSQL or SQLite or other);
_* the advantages implicit in these very different output possibilities;~{ e.g. LaTeX (professional document typesetting, easy conversion to pdf or Postscript), XML (in this case, structural representation), SQL (e.g. document set searches; representation of the constituent parts of documents based on their structure, headings, chapters, paragraphs as desired; control of use) }~
_* a common citation system
-As many output formats/presentations as one cares to write modules for - several types of html (e.g. structure based on css, or structure based on tables); /{LaTeX/pdf}/ and /{Lout/pdf}/; pgsql other databases easily added; yaml...
+As many output formats/presentations as one cares to write modules for - several types of html (e.g. structure based on css, or structure based on tables); /{LaTeX/pdf}/ and /{Lout/pdf}/; PgSQL other databases easily added; yaml...
3~ html - several presentations: full length & segmented; css & table based
@@ -368,7 +368,7 @@ Most documents are produced in single and segmented html versions, described bel
!_ The Scroll (full length text presentations)
-The full length of the text in a single scrollable document.~{ CISG http://www.jus.uio.no/lm/un.contracts.international.sale.of.goods.convention.1980/doc.html <br> The Unidroit Contract Principles http://www.jus.uio.no/lm/unidroit.contract.principles.1994/doc.html or <br> The Autonomous Contract http://www.jus.uio.no/lm/autonomous.contract.2000.amissah/doc.html }~ As a rule the files they are saved in are named: /doc/ or more precisely /{doc.html}/
+The full length of the text in a single scrollable document.~{ CISG http://www.jus.uio.no/lm/un.contracts.international.sale.of.goods.convention.1980/doc.html \\ The Unidroit Contract Principles http://www.jus.uio.no/lm/unidroit.contract.principles.1994/doc.html or \\ The Autonomous Contract http://www.jus.uio.no/lm/autonomous.contract.2000.amissah/doc.html }~ As a rule the files they are saved in are named: /doc/ or more precisely /{doc.html}/
For various reasons texts may only be provided in this form (such as this one which is short), though most are also provided as segmented texts.
@@ -376,7 +376,7 @@ For various reasons texts may only be provided in this form (such as this one wh
!_ The Segmented Text
-The text divided into segments (such as articles or chapters depending on the text)~{ CISG http://www.jus.uio.no/lm/un.contracts.international.sale.of.goods.convention.1980/toc.html <br>The Unidroit Principles http://www.jus.uio.no/lm/unidroit.contract.principles.1994/toc.html <br> The Autonomous Contract http://www.jus.uio.no/lm/autonomous.contract.2000.amissah/toc.html or <br> WTA 1994 http://www.jus.uio.no/lm/wta.1994 }~ As a rule the files they are saved in are named: /toc/ and /index/ or more precisely /{toc.html}/ and /{index.html}/
+The text divided into segments (such as articles or chapters depending on the text)~{ CISG http://www.jus.uio.no/lm/un.contracts.international.sale.of.goods.convention.1980/toc.html \\ The Unidroit Principles http://www.jus.uio.no/lm/unidroit.contract.principles.1994/toc.html \\ The Autonomous Contract http://www.jus.uio.no/lm/autonomous.contract.2000.amissah/toc.html or \\ WTA 1994 http://www.jus.uio.no/lm/wta.1994 }~ As a rule the files they are saved in are named: /toc/ and /index/ or more precisely /{toc.html}/ and /{index.html}/
If you know exactly what you are looking for, loading a segment of text is faster (the segments being smaller). Occasionally longer documents such as the WTA 1994 http://www.jus.uio.no/lm/wta.1994/toc are only provided in segmented form.
@@ -452,9 +452,9 @@ _* {~^ xpdf }http://www.foolabs.com/xpdf/
3~ Search - loading/populating of relational database while retaining document structure information, object citation numbering and other features (currently PostgreSQL and/or SQLite)
-SiSU (from the same markup input file) automatically feeds into PostgreSQL~{ http://www.postgresql.org/ <br> http://advocacy.postgresql.org/ <br> http://en.wikipedia.org/wiki/Postgresql }~ and/or SQLite~{ http://www.hwaci.com/sw/sqlite/ <br> http://en.wikipedia.org/wiki/Sqlite }~ database (could be any other of the better relational databases)~{ Relational database features retaining document structure and citation introduced 15^th^ July 2002 }~ - together with all additional information related to document structure, and the alternative ways in which it is generated on the site retained. As regards scaling of the database, it is as scalable as the database (here Postgresql or SQLite) and hardware allow. I will prune the images later.
+SiSU (from the same markup input file) automatically feeds into PostgreSQL~{ http://www.postgresql.org/ \\ http://advocacy.postgresql.org/ \\ http://en.wikipedia.org/wiki/Postgresql }~ and/or SQLite~{ http://www.hwaci.com/sw/sqlite/ \\ http://en.wikipedia.org/wiki/Sqlite }~ database (could be any other of the better relational databases)~{ Relational database features retaining document structure and citation introduced 15^th^ July 2002 }~ - together with all additional information related to document structure, and the alternative ways in which it is generated on the site retained. As regards scaling of the database, it is as scalable as the database (here Postgresql or SQLite) and hardware allow. I will prune the images later.
-This is one of the more interesting output forms, as all the structural data for the documents are retained (though can be ignored by the user of the database should they so choose). All site texts/documents are (currently) streamed to four pgsql database tables:
+This is one of the more interesting output forms, as all the structural data for the documents are retained (though can be ignored by the user of the database should they so choose). All site texts/documents are (currently) streamed to four PgSQL database tables:
_1* one containing semantic (and other) headers, including, title, author, subject, (the Dublin Core...);
@@ -477,7 +477,7 @@ This is a larger scale project, (with little development on the front end largel
3~ Search - database frontend sample, utilising database and SiSU features, including object citation numbering (backend currently PostgreSQL) *~search
{~^ Sample search frontend }http://search.sisudoc.org
-A small database and sample query front-end (search from) that makes use of the citation system, _{object citation numbering}_ to demonstrates functionality.~{ (which could be extended further with current back-end). As regards scaling of the database, it is as scalable as the database (here Postgresql) and hardware allow. }~
+A small database and sample query front-end (search from) that makes use of the citation system, _{object citation numbering}_ to demonstrates functionality.~{ (which could be extended further with current back-end). As regards scaling of the database, it is as scalable as the database (here PostgreSQL) and hardware allow. }~
SiSU can provide information on which documents are matched and at what locations within each document the matches are found. These results are relevant across all outputs using object citation numbering, which includes html, EPUB, XML, LaTeX, PDF and indeed the SQL database. You can then refer to one of the other outputs or in the SQL database expand the text within the matched objects (paragraphs) in the documents matched.
diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_download.ssi b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_download.ssi
index 25bcd93b..7ab3fb28 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/sisu_download.ssi
+++ b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_download.ssi
@@ -90,15 +90,15 @@ group{
*{Debs}*
-{~^ sisu_[version]_all.deb }http://www.jus.uio.no/sisu/archive/pool/main/s/sisu/ ~{ <br>sisu, the base code, (the main package on which the others depend), without any dependencies other than ruby (and for convenience the ruby webrick web server), this generates a number of types of output on its own, other packages provide additional functionality, and have their dependencies <br>Depends: ruby (>=1.8.7), libwebrick-ruby<br>Recommends: sisu-pdf, sisu-sqlite, sisu-postgresql, sisu-examples, vim-sisu, librmagick-ruby, trang, tidy, libtidy, librexml-ruby, zip, unzip, openssl }~
+{~^ sisu_[version]_all.deb }http://www.jus.uio.no/sisu/archive/pool/main/s/sisu/ ~{ \\ sisu, the base code, (the main package on which the others depend), without any dependencies other than ruby (and for convenience the ruby webrick web server), this generates a number of types of output on its own, other packages provide additional functionality, and have their dependencies \\ Depends: ruby (>=1.8.7), libwebrick-ruby \\ Recommends: sisu-pdf, sisu-sqlite, sisu-postgresql, sisu-examples, vim-sisu, librmagick-ruby, trang, tidy, libtidy, librexml-ruby, zip, unzip, openssl }~
-{~^ sisu-complete_[version]_all.deb }http://www.jus.uio.no/sisu/archive/pool/main/s/sisu/ ~{ <br>a package that pulls in other packages to build the whole of sisu (excluding sisu-examples) <br>Depends: ruby (>=1.8.7), sisu, sisu-pdf, sisu-postgresql, sisu-remote, sisu-sqlite, vim-sisu<br>Recommends: sisu-examples }~
+{~^ sisu-complete_[version]_all.deb }http://www.jus.uio.no/sisu/archive/pool/main/s/sisu/ ~{ \\ a package that pulls in other packages to build the whole of sisu (excluding sisu-examples) \\ Depends: ruby (>=1.8.7), sisu, sisu-pdf, sisu-postgresql, sisu-remote, sisu-sqlite, vim-sisu \\ Recommends: sisu-examples }~
-{~^ sisu-pdf_[version]_all.deb }http://www.jus.uio.no/sisu/archive/pool/main/s/sisu/ ~{ <br>dependencies used by sisu to produce pdf from LaTeX generated <br>Depends: sisu, tetex-bin, tetex-extra, latex-ucs<br>Suggests: evince, xpdf }~
+{~^ sisu-pdf_[version]_all.deb }http://www.jus.uio.no/sisu/archive/pool/main/s/sisu/ ~{ \\ dependencies used by sisu to produce PDF from LaTeX generated \\ Depends: sisu, tetex-bin, tetex-extra, latex-ucs \\ Suggests: evince, xpdf }~
-{~^ sisu-postgresql_[version]_all.deb }http://www.jus.uio.no/sisu/archive/pool/main/s/sisu/ ~{ <br>dependencies used by sisu to populate postgresql database (further configuration is necessary) <br>Depends: sisu, postgresql, libdbi-ruby, libdbm-ruby, libdbd-pg-ruby<br>Suggests: pgaccess, libdbd-pgsql, postgresql-contrib }~
+{~^ sisu-postgresql_[version]_all.deb }http://www.jus.uio.no/sisu/archive/pool/main/s/sisu/ ~{ \\ dependencies used by sisu to populate postgresql database (further configuration is necessary) \\ Depends: sisu, postgresql, libdbi-ruby, libdbm-ruby, libdbd-pg-ruby \\ Suggests: pgaccess, libdbd-pgsql, postgresql-contrib }~
-{~^ sisu-sqlite_[version]_all.deb }http://www.jus.uio.no/sisu/archive/pool/main/s/sisu/ ~{ <br>dependencies used by sisu to populate sqlite database <br>Depends: sisu, sqlite, libdbi-ruby, libdbm-ruby, libdbd-sqlite-ruby<br>Suggests: libdbd-sqlite }~
+{~^ sisu-sqlite_[version]_all.deb }http://www.jus.uio.no/sisu/archive/pool/main/s/sisu/ ~{ \\ dependencies used by sisu to populate sqlite database \\ Depends: sisu, sqlite, libdbi-ruby, libdbm-ruby, libdbd-sqlite-ruby \\ Suggests: libdbd-sqlite }~
}group
@@ -112,9 +112,9 @@ _1 http://www.jus.uio.no/sisu/SiSU/changelog.html
Book markup samples have been moved to non-free as the substantive text of the documents are available under the author or original publisher's license, and usually do not comply with the Debian Free Software Guidelines.
-_* {~^ sisu-markup-samples_[version]_all.deb }http://www.jus.uio.no/sisu/archive/pool/non-free/s/sisu-markup-samples/ ~{ <br>marked up documents and other examples related to sisu, a larger package containing a number of texts <br>Depends: sisu }~
+_* {~^ sisu-markup-samples_[version]_all.deb }http://www.jus.uio.no/sisu/archive/pool/non-free/s/sisu-markup-samples/ ~{ \\ marked up documents and other examples related to sisu, a larger package containing a number of texts \\ Depends: sisu }~
-_* {~^ sisu-markup-samples_[version].dsc }http://www.jus.uio.no/sisu/pkg/src/ ~{ <br>sisu-markup-samples_[version].dsc }~
+_* {~^ sisu-markup-samples_[version].dsc }http://www.jus.uio.no/sisu/pkg/src/ ~{ \\ sisu-markup-samples_[version].dsc }~
For changelogs see:
@@ -126,9 +126,9 @@ The RPM is generated from the source file using Alien.~{ http://www.kitenet.net/
sudo rpm -i [package name]
-_* {~^ sisu-[version].noarch.rpm }http://www.jus.uio.no/sisu/pkg/rpm/ ~{ <br>created using alien }~
+_* {~^ sisu-[version].noarch.rpm }http://www.jus.uio.no/sisu/pkg/rpm/ ~{ \\ created using alien }~
-_* {~^ sisu-markup-samples_[version].noarch.rpm }http://www.jus.uio.no/sisu/pkg/rpm/ ~{ <br> http://www.jus.uio.no/sisu/archive/pool/non-free/s/sisu-markup-samples/ <br> created using: alien -r sisu_[version]_all.deb }~
+_* {~^ sisu-markup-samples_[version].noarch.rpm }http://www.jus.uio.no/sisu/pkg/rpm/ ~{ \\ http://www.jus.uio.no/sisu/archive/pool/non-free/s/sisu-markup-samples/ \\ created using: alien -r sisu_[version]_all.deb }~
For changelogs see:
diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_examples.ssi b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_examples.ssi
index ebe4c1ea..ebe4c1ea 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/sisu_examples.ssi
+++ b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_examples.ssi
diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_faq.sst b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_faq.sst
index bfc6023c..bfc6023c 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/sisu_faq.sst
+++ b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_faq.sst
diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_filetypes.sst b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_filetypes.sst
index f8378e9d..f8378e9d 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/sisu_filetypes.sst
+++ b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_filetypes.sst
diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_help.sst b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_help.sst
index b2938efb..b2938efb 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/sisu_help.sst
+++ b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_help.sst
diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_help_sources.sst b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_help_sources.sst
index cf94b763..cf94b763 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/sisu_help_sources.sst
+++ b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_help_sources.sst
diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_homepages.ssi b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_homepages.ssi
index 58dc0937..58dc0937 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/sisu_homepages.ssi
+++ b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_homepages.ssi
diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_how.ssi b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_how.ssi
index 3372bcd4..3372bcd4 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/sisu_how.ssi
+++ b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_how.ssi
diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_howto.sst b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_howto.sst
index ef6cc674..3d3a0f0c 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/sisu_howto.sst
+++ b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_howto.sst
@@ -681,7 +681,7 @@ SiSU can be used for Internet, Intranet, local filesystem or cd publishing.
SiSU can be used directly off the filesystem, or from a database.
-SiSU's scalability, is be dependent on your hardware, and filesystem (in my case Reiserfs), and/or database Postgresql.
+SiSU's scalability, is dependent on your hardware, and filesystem, and/or database Postgresql.
Amongst it's characteristics are:
diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_installation.ssi b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_installation.ssi
index f908bb6e..f908bb6e 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/sisu_installation.ssi
+++ b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_installation.ssi
diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_interesting_to_whom.ssi b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_interesting_to_whom.ssi
index 750c46ea..750c46ea 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/sisu_interesting_to_whom.ssi
+++ b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_interesting_to_whom.ssi
diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_introduction.sst b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_introduction.sst
index 28fc83c3..08cd8574 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/sisu_introduction.sst
+++ b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_introduction.sst
@@ -49,17 +49,17 @@
SiSU is a framework for document structuring, publishing (in multiple open standard formats) and search, comprising of: (a) a lightweight document structure and presentation markup syntax; and (b) an accompanying engine for generating standard document format outputs from documents prepared in sisu markup syntax, which is able to produce multiple standard outputs (including the population of sql databases) that (can) share a common numbering system for the citation of text within a document.
-SiSU is developed under an open source, software libre license (GPL3). Its use case for development is work with medium to large document sets and cope with evolving document formats/ representation technologies. Documents are prepared once, and generated as need be to update the technical presentation or add additional output formats. Various output formats (including search related output) share a common mechanism for cross-output-format citation.
+SiSU is developed under an open source, software libre license (GPLv3). Its use case for development is work with medium to large document sets and cope with evolving document formats/ representation technologies. Documents are prepared once, and generated as need be to update the technical presentation or add additional output formats. Various output formats (including search related output) share a common mechanism for cross-output-format citation.
-SiSU both defines a markup syntax and provides an engine that produces open standards format outputs from documents prepared with SiSU markup. From a single lightly prepared document sisu custom builds several standard output formats which share a common (text object) numbering system for citation of content within a document (that also has implications for search). The sisu engine works with an abstraction of the document's structure and content from which it is possible to generate different forms of representation of the document. Significantly SiSU markup is more sparse than html and outputs which include html, EPUB, LaTeX, landscape and portrait pdfs, Open Document Format (ODF), all of which can be added to and updated. SiSU is also able to populate SQL type databases at an object level, which means that searches can be made with that degree of granularity.
+SiSU both defines a markup syntax and provides an engine that produces open standards format outputs from documents prepared with SiSU markup. From a single lightly prepared document sisu custom builds several standard output formats which share a common (text object) numbering system for citation of content within a document (that also has implications for search). The sisu engine works with an abstraction of the document's structure and content from which it is possible to generate different forms of representation of the document. Significantly SiSU markup is more sparse than html and outputs which include HTML, EPUB, ODT (Open Document Format text), LaTeX, landscape and portrait PDF, all of which can be added to and updated. SiSU is also able to populate SQL type databases at an object level, which means that searches can be made with that degree of granularity.
-Source document preparation and output generation is a two step process: (i) document source is prepared, that is, marked up in sisu markup syntax and (ii) the desired output subsequently generated by running the sisu engine against document source. Output representations if updated (in the sisu engine) can be generated by re-running the engine against the prepared source. Using SiSU markup applied to a document, SiSU custom builds (to take advantage of the strengths of different ways of representing documents) various standard open output formats including plain text, HTML, XHTML, XML, EPUB, OpenDocument, LaTeX or PDF files, and populate an SQL database with objects~{ objects include: headings, paragraphs, verse, tables, images, but not footnotes/endnotes which are numbered separately and tied to the object from which they are referenced. }~ (equating generally to paragraph-sized chunks) so searches may be performed and matches returned with that degree of granularity ( e.g. your search criteria is met by these documents and at these locations within each document). Document output formats share a common object numbering system for locating content. This is particularly suitable for "published" works (finalized texts as opposed to works that are frequently changed or updated) for which it provides a fixed means of reference of content.
+Source document preparation and output generation is a two step process: (i) document source is prepared, that is, marked up in sisu markup syntax and (ii) the desired output subsequently generated by running the sisu engine against document source. Output representations if updated (in the sisu engine) can be generated by re-running the engine against the prepared source. Using SiSU markup applied to a document, SiSU custom builds (to take advantage of the strengths of different ways of representing documents) various standard open output formats including plain text, HTML, XHTML, XML, EPUB, ODT, LaTeX or PDF files, and populate an SQL database with objects~{ objects include: headings, paragraphs, verse, tables, images, but not footnotes/endnotes which are numbered separately and tied to the object from which they are referenced. }~ (equating generally to paragraph-sized chunks) so searches may be performed and matches returned with that degree of granularity ( e.g. your search criteria is met by these documents and at these locations within each document). Document output formats share a common object numbering system for locating content. This is particularly suitable for "published" works (finalized texts as opposed to works that are frequently changed or updated) for which it provides a fixed means of reference of content.
-In preparing a SiSU document you optionally provide semantic information related to the document in a document header, and in marking up the substantive text provide information on the structure of the document, primarily indicating heading levels and footnotes. You also provide information on basic text attributes where used. The rest is automatic, sisu from this information custom builds~{ i.e. the html, pdf, epub, odf outputs are each built individually and optimised for that form of presentation, rather than for example the html being a saved version of the odf, or the pdf being a saved version of the html. }~ the different forms of output requested.
+In preparing a SiSU document you optionally provide semantic information related to the document in a document header, and in marking up the substantive text provide information on the structure of the document, primarily indicating heading levels and footnotes. You also provide information on basic text attributes where used. The rest is automatic, sisu from this information custom builds~{ i.e. the HTML, PDF, EPUB, ODT outputs are each built individually and optimised for that form of presentation, rather than for example the html being a saved version of the odf, or the pdf being a saved version of the html. }~ the different forms of output requested.
SiSU works with an abstraction of the document based on its structure which is comprised of its headings~{ the different heading levels }~ and objects~{ units of text, primarily paragraphs and headings, also any tables, poems, code-blocks }~, which enables SiSU to represent the document in many different ways, and to take advantage of the strengths of different ways of presenting documents. The objects are numbered, and these numbers can be used to provide a common basis for citing material within a document across the different output format types. This is significant as page numbers are not well suited to the digital age, in web publishing, changing a browser's default font or using a different browser can mean that text will appear on a different page; and publishing in different formats, html, landscape and portrait pdf etc. again page numbers are not useful to cite text. Dealing with documents at an object level together with object numbering also has implications for search that SiSU is able to take advantage of.
-One of the challenges of maintaining documents is to keep them in a format that allows use of them independently of proprietary platforms. Consider issues related to dealing with legacy proprietary formats today and what guarantee you have that old proprietary formats will remain (or can be read without proprietary software/equipment) in 15 years time, or the way the way in which html has evolved over its relatively short span of existence. SiSU provides the flexibility of producing documents in multiple non-proprietary open formats including html, pdf~{ Specification submitted by Adobe to ISO to become a full open ISO specification <br> http://www.linux-watch.com/news/NS7542722606.html }~ ODF,~{ ISO standard ISO/IEC 26300:2006 }~ and EPUB.~{ An open standard format for e-books }~ Whilst SiSU relies on software, the markup is uncomplicated and minimalistic which guarantees that future engines can be written to run against it. It is also easily converted to other formats, which means documents prepared in SiSU can be migrated to other document formats. Further security is provided by the fact that the software itself, SiSU is available under GPL3 a licence that guarantees that the source code will always be open, and free as in libre, which means that that code base can be used, updated and further developed as required under the terms of its license. Another challenge is to keep up with a moving target. SiSU permits new forms of output to be added as they become important, (Open Document Format text was added in 2006 when it became an ISO standard for office applications and the archival of documents), EPUB was introduced in 2009; and allows the technical representations existing output to be updated (html has evolved and the related module has been updated repeatedly over the years, presumably when the World Wide Web Consortium (w3c) finalises html 5 which is currently under development, the html module will again be updated allowing all existing documents to be regenerated as html 5).
+One of the challenges of maintaining documents is to keep them in a format that allows use of them independently of proprietary platforms. Consider issues related to dealing with legacy proprietary formats today and what guarantee you have that old proprietary formats will remain (or can be read without proprietary software/equipment) in 15 years time, or the way the way in which html has evolved over its relatively short span of existence. SiSU provides the flexibility of producing documents in multiple non-proprietary open formats including HTML, EPUB,~{ An open standard format for e-books }~ ODT,~{ Open Document Format (ODF) text }~ PDF~{ Specification submitted by Adobe to ISO to become a full open ISO specification <br> http://www.linux-watch.com/news/NS7542722606.html }~ ODF,~{ ISO standard ISO/IEC 26300:2006 }~. Whilst SiSU relies on software, the markup is uncomplicated and minimalistic which guarantees that future engines can be written to run against it. It is also easily converted to other formats, which means documents prepared in SiSU can be migrated to other document formats. Further security is provided by the fact that the software itself, SiSU is available under GPLv3 a licence that guarantees that the source code will always be open, and free as in libre, which means that that code base can be used, updated and further developed as required under the terms of its license. Another challenge is to keep up with a moving target. SiSU permits new forms of output to be added as they become important, (Open Document Format text was added in 2006 when it became an ISO standard for office applications and the archival of documents), EPUB was introduced in 2009; and allows the technical representations existing output to be updated (HTML has evolved and the related module has been updated repeatedly over the years, presumably when the World Wide Web Consortium (w3c) finalises HTML 5 which is currently under development, the HTML module will again be updated allowing all existing documents to be regenerated as HTML 5).
The document formats are written to the file-system and available for indexing by independent indexing tools, whether off the web like Google and Yahoo or on the site like Lucene and Hyperestraier.
@@ -72,4 +72,3 @@ http://www.sisudoc.org/
http://www.jus.uio.no/sisu
% SiSU is a way of preparing, publishing, managing and searching documents.
-
diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_manual.ssm b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_manual.ssm
index a1879767..0e927713 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/sisu_manual.ssm
+++ b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_manual.ssm
@@ -90,8 +90,6 @@
<< sisu_search_cgi.ssi
-<< sisu_hyperestraier.ssi
-
<< sisu_webrick.sst
<< sisu_remote.sst
diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_markup.sst b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_markup.sst
index b99ccaa6..e3fbb226 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/sisu_markup.sst
+++ b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_markup.sst
@@ -247,7 +247,6 @@ code{
:isbn: [ISBN]
:loc: [Library of Congress classification]
:dewey: [Dewey classification
- :pg: [Project Gutenberg text number]
}code
@@ -1285,6 +1284,8 @@ code{
2~ Notes related to Files-types and Markup Syntax
+3.0 very minor additions to markup added, substantially the same as version 2.0
+
2.0 introduced new headers and is therefore incompatible with 1.0 though otherwise the same with the addition of a couple of tags (i.e. a superset)
0.38 is substantially current for version 1.0
diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_output_overview.sst b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_output_overview.sst
index 2fc6cb3f..2fc6cb3f 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/sisu_output_overview.sst
+++ b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_output_overview.sst
diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_postgresql.sst b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_postgresql.sst
index 7987296d..7987296d 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/sisu_postgresql.sst
+++ b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_postgresql.sst
diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_quickstart.sst b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_quickstart.sst
index 7f78e645..7f78e645 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/sisu_quickstart.sst
+++ b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_quickstart.sst
diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_remote.sst b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_remote.sst
index 042fd506..042fd506 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/sisu_remote.sst
+++ b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_remote.sst
diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_search.ssm b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_search.ssm
index 4c764f5b..316771a1 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/sisu_search.ssm
+++ b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_search.ssm
@@ -52,5 +52,3 @@
<< sisu_sqlite.sst
<< sisu_search_cgi.ssi
-
-<< sisu_hyperestraier.ssi
diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_search_cgi.ssi b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_search_cgi.ssi
index 49a87ade..03eef9ff 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/sisu_search_cgi.ssi
+++ b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_search_cgi.ssi
@@ -69,9 +69,6 @@ generates a sample search form, which must be copied to the web-server cgi direc
!_ sisu -F --webserv-webrick<br>
generates a sample search form for use with the webrick server, which must be copied to the web-server cgi directory
-!_ sisu -Fv<br>
-as above, and provides some information on setting up hyperestraier
-
!_ sisu -W<br>
starts the webrick server which should be available wherever sisu is properly installed
diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_search_intro.ssi b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_search_intro.ssi
index 7cb096f5..7cb096f5 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/sisu_search_intro.ssi
+++ b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_search_intro.ssi
diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_short_feature_summary.ssi b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_short_feature_summary.ssi
index c8099fb0..c8099fb0 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/sisu_short_feature_summary.ssi
+++ b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_short_feature_summary.ssi
diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_skin.sst b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_skin.sst
index 02858593..02858593 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/sisu_skin.sst
+++ b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_skin.sst
diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_sql.ssi b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_sql.ssi
index 902a4a3b..902a4a3b 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/sisu_sql.ssi
+++ b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_sql.ssi
diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_sqlite.sst b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_sqlite.sst
index 3bb2e278..3bb2e278 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/sisu_sqlite.sst
+++ b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_sqlite.sst
diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_synopsis.ssi b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_synopsis.ssi
index 0c165f72..0c165f72 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/sisu_synopsis.ssi
+++ b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_synopsis.ssi
diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_syntax_highlighting.sst b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_syntax_highlighting.sst
index ddca75ee..ddca75ee 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/sisu_syntax_highlighting.sst
+++ b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_syntax_highlighting.sst
diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_webrick.sst b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_webrick.sst
index 81401189..81401189 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/sisu_webrick.sst
+++ b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_webrick.sst
diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_work_needed_and_wishlist.ssi b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_work_needed_and_wishlist.ssi
index 20e774ac..20e774ac 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/sisu_work_needed_and_wishlist.ssi
+++ b/data/doc/sisu/markup-samples/v3/sisu_manual/sisu_work_needed_and_wishlist.ssi
diff --git a/data/doc/sisu/markup-samples/v4/samples/_sisu/image/Gnu_Debian_Linux_Ruby_Way_Better.png b/data/doc/sisu/markup-samples/v4/samples/_sisu/image/Gnu_Debian_Linux_Ruby_Way_Better.png
new file mode 100644
index 00000000..0f3f4a16
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/samples/_sisu/image/Gnu_Debian_Linux_Ruby_Way_Better.png
Binary files differ
diff --git a/data/doc/sisu/markup-samples/v4/samples/_sisu/image/b_doc.png b/data/doc/sisu/markup-samples/v4/samples/_sisu/image/b_doc.png
new file mode 100644
index 00000000..13ca8ebe
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/samples/_sisu/image/b_doc.png
Binary files differ
diff --git a/data/doc/sisu/markup-samples/v4/samples/_sisu/image/c_Copyleft.png b/data/doc/sisu/markup-samples/v4/samples/_sisu/image/c_Copyleft.png
new file mode 100644
index 00000000..5b3865b8
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/samples/_sisu/image/c_Copyleft.png
Binary files differ
diff --git a/data/doc/sisu/markup-samples/v4/samples/_sisu/image/c_Euro.png b/data/doc/sisu/markup-samples/v4/samples/_sisu/image/c_Euro.png
new file mode 100644
index 00000000..8e5c13a9
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/samples/_sisu/image/c_Euro.png
Binary files differ
diff --git a/data/doc/sisu/markup-samples/v4/samples/_sisu/image/debian_home.png b/data/doc/sisu/markup-samples/v4/samples/_sisu/image/debian_home.png
new file mode 100644
index 00000000..cee42aa0
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/samples/_sisu/image/debian_home.png
Binary files differ
diff --git a/data/doc/sisu/markup-samples/v4/samples/_sisu/image/free_as_in_freedom.png b/data/doc/sisu/markup-samples/v4/samples/_sisu/image/free_as_in_freedom.png
new file mode 100644
index 00000000..ad4c05b2
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/samples/_sisu/image/free_as_in_freedom.png
Binary files differ
diff --git a/data/doc/sisu/markup-samples/v4/samples/_sisu/image/free_as_in_freedom_01_rms.png b/data/doc/sisu/markup-samples/v4/samples/_sisu/image/free_as_in_freedom_01_rms.png
new file mode 100644
index 00000000..3b4563b0
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/samples/_sisu/image/free_as_in_freedom_01_rms.png
Binary files differ
diff --git a/data/doc/sisu/markup-samples/v4/samples/_sisu/image/free_as_in_freedom_02_rms_snr_year_report.png b/data/doc/sisu/markup-samples/v4/samples/_sisu/image/free_as_in_freedom_02_rms_snr_year_report.png
new file mode 100644
index 00000000..5d5a57aa
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/samples/_sisu/image/free_as_in_freedom_02_rms_snr_year_report.png
Binary files differ
diff --git a/data/doc/sisu/markup-samples/v4/samples/_sisu/image/free_as_in_freedom_03_rms_st_ignucius.png b/data/doc/sisu/markup-samples/v4/samples/_sisu/image/free_as_in_freedom_03_rms_st_ignucius.png
new file mode 100644
index 00000000..d84bf568
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/samples/_sisu/image/free_as_in_freedom_03_rms_st_ignucius.png
Binary files differ
diff --git a/data/doc/sisu/markup-samples/v4/samples/_sisu/image/free_as_in_freedom_04_rms_pleasure_card.png b/data/doc/sisu/markup-samples/v4/samples/_sisu/image/free_as_in_freedom_04_rms_pleasure_card.png
new file mode 100644
index 00000000..2ab79e1c
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/samples/_sisu/image/free_as_in_freedom_04_rms_pleasure_card.png
Binary files differ
diff --git a/data/doc/sisu/markup-samples/v4/samples/_sisu/image/free_as_in_freedom_2_01_pdp_1_processor_with_kl_10.png b/data/doc/sisu/markup-samples/v4/samples/_sisu/image/free_as_in_freedom_2_01_pdp_1_processor_with_kl_10.png
new file mode 100644
index 00000000..679c22a5
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/samples/_sisu/image/free_as_in_freedom_2_01_pdp_1_processor_with_kl_10.png
Binary files differ
diff --git a/data/doc/sisu/markup-samples/v4/samples/_sisu/image/free_as_in_freedom_2_02_rms_st_ignucius.png b/data/doc/sisu/markup-samples/v4/samples/_sisu/image/free_as_in_freedom_2_02_rms_st_ignucius.png
new file mode 100644
index 00000000..9ed7b355
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/samples/_sisu/image/free_as_in_freedom_2_02_rms_st_ignucius.png
Binary files differ
diff --git a/data/doc/sisu/markup-samples/v4/samples/_sisu/image/levitating_gnu.png b/data/doc/sisu/markup-samples/v4/samples/_sisu/image/levitating_gnu.png
new file mode 100644
index 00000000..9a25319a
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/samples/_sisu/image/levitating_gnu.png
Binary files differ
diff --git a/data/doc/sisu/markup-samples/v4/samples/_sisu/image/philosophical_gnu.png b/data/doc/sisu/markup-samples/v4/samples/_sisu/image/philosophical_gnu.png
new file mode 100644
index 00000000..ebd239ef
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/samples/_sisu/image/philosophical_gnu.png
Binary files differ
diff --git a/data/doc/sisu/markup-samples/v4/samples/_sisu/image/sisu.png b/data/doc/sisu/markup-samples/v4/samples/_sisu/image/sisu.png
new file mode 100644
index 00000000..b449fa6b
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/samples/_sisu/image/sisu.png
Binary files differ
diff --git a/data/doc/sisu/markup-samples/v4/samples/_sisu/sisu_document_make b/data/doc/sisu/markup-samples/v4/samples/_sisu/sisu_document_make
new file mode 100644
index 00000000..85e583e1
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/samples/_sisu/sisu_document_make
@@ -0,0 +1,9 @@
+@make:
+ :breaks: break=1
+ :home_button_text: {SiSU}http://sisudoc.org; {sources / git}http://sources.sisudoc.org/
+% :footer: {SiSU}http://sisudoc.org; {sources / git}http://sources.sisudoc.org/
+% :home_button_image: {sisu.png }http://sisudoc.org
+
+@links:+
+ {SiSU}http://sisudoc.org
+ {sources / git}http://sources.sisudoc.org/
diff --git a/data/doc/sisu/markup-samples/samples/free_as_in_freedom.richard_stallman_crusade_for_free_software.sam_williams.sst b/data/doc/sisu/markup-samples/v4/samples/free_as_in_freedom.richard_stallman_crusade_for_free_software.sam_williams.sst
index d19efafa..2d38902a 100644
--- a/data/doc/sisu/markup-samples/samples/free_as_in_freedom.richard_stallman_crusade_for_free_software.sam_williams.sst
+++ b/data/doc/sisu/markup-samples/v4/samples/free_as_in_freedom.richard_stallman_crusade_for_free_software.sam_williams.sst
@@ -1,4 +1,4 @@
-% SiSU 2.0
+% SiSU 4.0
@title: Free as in Freedom
:subtitle: Richard Stallman's Crusade for Free Software
@@ -14,21 +14,23 @@
:license: Published under the GNU Free Documentation License. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Document License, Version 1.1 or any later version published by the Free Software Foundation; with the Invariant Sections being no invariant sections, with the Front-Cover Texts being no invariant sections, and with the Back-Cover Texts being no invariant sections. A copy of the license is included in Appendix C, GNU Free Documentation License. All images are to be included verbatim when the document is copied, distributed, or modified under the terms of the GFDL.
@classify:
- :topic_register: SiSU:markup sample:book;copyright;GNU/Linux:GPL|copyleft|free software;free software;Software:Software Libré;GPL;Linux:GNU|Software Libré;book:biography;programming
+ :topic_register: SiSU markup sample:book:biography;book:biography;copyright;GNU/Linux:GPL|copyleft|free software;free software;Software:Software Libré;GPL;Linux:GNU|Software Libré;programming
+
+@identifier:
:oclc: 49044520
:isbn: 9780596002879
@links:
- {Home and Source}http://faifzilla.org/
- {@ Wikipedia}http://en.wikipedia.org/wiki/Free_as_in_Freedom:_Richard_Stallman%27s_Crusade_for_Free_Software
- {@ Amazon.com}http://www.amazon.com/gp/product/0596002874
- {@ Barnes & Noble}http://search.barnesandnoble.com/booksearch/isbnInquiry.asp?isbn=0596002874
- {SiSU}http://sisudoc.org/
- {sources / git}http://sources.sisudoc.org/
+ { Home and Source }http://faifzilla.org/
+ { @ Wikipedia }http://en.wikipedia.org/wiki/Free_as_in_Freedom:_Richard_Stallman%27s_Crusade_for_Free_Software
+ { @ Amazon.com }http://www.amazon.com/gp/product/0596002874
+ { @ Barnes & Noble }http://search.barnesandnoble.com/booksearch/isbnInquiry.asp?isbn=0596002874
@make:
- :skin: skin_rms
:breaks: new=:A,:B,:C,1
+ :home_button_image: {free_as_in_freedom.png }http://stallman.org/
+ :home_button_text: {Free as in Freedom}http://stallman.org/; {Free Software Foundation}http://www.fsf.org
+ :footer: {Free as in Freedom}http://stallman.org/; {Free Software Foundation}http://www.fsf.org
:A~ @title @author
@@ -223,7 +225,7 @@ Once inside the auditorium, a visitor finds the person who has forced this tempo
% extended range for Microsoft
-The subject of Stallman's speech is the history and future of the free software movement. The location is significant. Less than a month before, Microsoft senior vice president Craig Mundie appeared at the nearby NYU Stern School of Business, delivering a speech blasting the General Public License, or GPL, a legal device originally conceived by Stallman 16 years before. Built to counteract the growing wave of software secrecy overtaking the computer industry-a wave first noticed by Stallman during his 1980 troubles with the Xerox laser printer-the GPL has evolved into a central tool of the free software community. In simplest terms, the GPL locks software programs into a form of communal ownership-what today's legal scholars now call the "digital commons"-through the legal weight of copyright. Once locked, programs remain unremovable. Derivative versions must carry the same copyright protection-even derivative versions that bear only a small snippet of the original source code. For this reason, some within the software industry have taken to calling the GPL a "viral" license, because it spreads itself to every software program it touches.~{ Actually, the GPL's powers are not quite that potent. According to section 10 of the GNU General Public License, Version 2 (1991), the viral nature of the license depends heavily on the Free Software Foundation's willingness to view a program as a derivative work, not to mention the existing license the GPL would replace.<br>If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software that is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.<br>"To compare something to a virus is very harsh," says Stallman. "A spider plant is a more accurate comparison; it goes to another place if you actively take a cutting."<br>For more information on the GNU General Public License, visit http://www.gnu.org/copyleft/gpl.html }~
+The subject of Stallman's speech is the history and future of the free software movement. The location is significant. Less than a month before, Microsoft senior vice president Craig Mundie appeared at the nearby NYU Stern School of Business, delivering a speech blasting the General Public License, or GPL, a legal device originally conceived by Stallman 16 years before. Built to counteract the growing wave of software secrecy overtaking the computer industry-a wave first noticed by Stallman during his 1980 troubles with the Xerox laser printer-the GPL has evolved into a central tool of the free software community. In simplest terms, the GPL locks software programs into a form of communal ownership-what today's legal scholars now call the "digital commons"-through the legal weight of copyright. Once locked, programs remain unremovable. Derivative versions must carry the same copyright protection-even derivative versions that bear only a small snippet of the original source code. For this reason, some within the software industry have taken to calling the GPL a "viral" license, because it spreads itself to every software program it touches.~{ Actually, the GPL's powers are not quite that potent. According to section 10 of the GNU General Public License, Version 2 (1991), the viral nature of the license depends heavily on the Free Software Foundation's willingness to view a program as a derivative work, not to mention the existing license the GPL would replace. \\ If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software that is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. \\ "To compare something to a virus is very harsh," says Stallman. "A spider plant is a more accurate comparison; it goes to another place if you actively take a cutting." \\ For more information on the GNU General Public License, visit http://www.gnu.org/copyleft/gpl.html }~
={Mundie, Craig+2;NYU Stern School of Business;Stern School of Business (NYU)}
In an information economy increasingly dependent on software and increasingly beholden to software standards, the GPL has become the proverbial "big stick." Even companies that once laughed it off as software socialism have come around to recognize the benefits. Linux, the Unix-like kernel developed by Finnish college student Linus Torvalds in 1991, is licensed under the GPL, as are many of the world's most popular programming tools: GNU Emacs, the GNU Debugger, the GNU C Compiler, etc. Together, these tools form the components of a free software operating system developed, nurtured, and owned by the worldwide hacker community. Instead of viewing this community as a threat, high-tech companies like IBM, Hewlett Packard, and Sun Microsystems have come to rely upon it, selling software applications and services built to ride atop the ever-growing free software infrastructure.
@@ -235,12 +237,12 @@ They've also come to rely upon it as a strategic weapon in the hacker community'
20 years is a long time in the software industry. Consider this: in 1980, when Richard Stallman was cursing the AI Lab's Xerox laser printer, Microsoft, the company modern hackers view as the most powerful force in the worldwide software industry, was still a privately held startup. IBM, the company hackers used to regard as the most powerful force in the worldwide software industry, had yet to to introduce its first personal computer, thereby igniting the current low-cost PC market. Many of the technologies we now take for granted-the World Wide Web, satellite television, 32-bit video-game consoles-didn't even exist. The same goes for many of the companies that now fill the upper echelons of the corporate establishment, companies like AOL, Sun Microsystems, Amazon.com, Compaq, and Dell. The list goes on and on.
={Amazon.com;AOL (America OnLine);Compaq computers;Dell computers;PCs (personal computers);personal computers (PCs)}
-The fact that the high-technology marketplace has come so far in such little time is fuel for both sides of the GPL debate. GPL-proponents point to the short lifespan of most computer hardware platforms. Facing the risk of buying an obsolete product, consumers tend to flock to companies with the best long-term survival. As a result, the software marketplace has become a winner-take-all arena.~{ See Shubha Ghosh, "Revealing the Microsoft Windows Source Code," Gigalaw.com (January, 2000).<br> http://www.gigalaw.com/articles/ghosh-2000-01-p1.html }~ The current, privately owned software environment, GPL-proponents say, leads to monopoly abuse and stagnation. Strong companies suck all the oxygen out of the marketplace for rival competitors and innovative startups.
+The fact that the high-technology marketplace has come so far in such little time is fuel for both sides of the GPL debate. GPL-proponents point to the short lifespan of most computer hardware platforms. Facing the risk of buying an obsolete product, consumers tend to flock to companies with the best long-term survival. As a result, the software marketplace has become a winner-take-all arena.~{ See Shubha Ghosh, "Revealing the Microsoft Windows Source Code," Gigalaw.com (January, 2000). \\ http://www.gigalaw.com/articles/ghosh-2000-01-p1.html }~ The current, privately owned software environment, GPL-proponents say, leads to monopoly abuse and stagnation. Strong companies suck all the oxygen out of the marketplace for rival competitors and innovative startups.
-GPL-opponents argue just the opposite. Selling software is just as risky, if not more risky, than buying software, they say. Without the legal guarantees provided by private software licenses, not to mention the economic prospects of a privately owned "killer app" (i.e., a breakthrough technology that launches an entirely new market),~{ Killer apps don't have to be proprietary. Witness, of course, the legendary Mosaic browser, a program whose copyright permits noncommercial derivatives with certain restrictions. Still, I think the reader gets the point: the software marketplace is like the lottery. The bigger the potential payoff, the more people want to participate. For a good summary of the killer-app phenomenon, see Philip Ben-David, "Whatever Happened to the `Killer App'?" e-Commerce News (December 7, 2000).<br> http://www.ecommercetimes.com/perl/story/5893.html }~ companies lose the incentive to participate. Once again, the market stagnates and innovation declines. As Mundie himself noted in his May 3 address on the same campus, the GPL's "viral" nature "poses a threat" to any company that relies on the uniqueness of its software as a competitive asset. Added Mundie:
+GPL-opponents argue just the opposite. Selling software is just as risky, if not more risky, than buying software, they say. Without the legal guarantees provided by private software licenses, not to mention the economic prospects of a privately owned "killer app" (i.e., a breakthrough technology that launches an entirely new market),~{ Killer apps don't have to be proprietary. Witness, of course, the legendary Mosaic browser, a program whose copyright permits noncommercial derivatives with certain restrictions. Still, I think the reader gets the point: the software marketplace is like the lottery. The bigger the potential payoff, the more people want to participate. For a good summary of the killer-app phenomenon, see Philip Ben-David, "Whatever Happened to the `Killer App'?" e-Commerce News (December 7, 2000). \\ http://www.ecommercetimes.com/perl/story/5893.html }~ companies lose the incentive to participate. Once again, the market stagnates and innovation declines. As Mundie himself noted in his May 3 address on the same campus, the GPL's "viral" nature "poses a threat" to any company that relies on the uniqueness of its software as a competitive asset. Added Mundie:
={Mundie, Craig+2}
-_1 It also fundamentally undermines the independent commercial software sector because it effectively makes it impossible to distribute software on a basis where recipients pay for the product rather than just the cost of distribution.~{ See Craig Mundie, "The Commercial Software Model," senior vice president, Microsoft Corp. Excerpted from an online transcript of Mundie's May 3, 2001, speech to the New York University Stern School of Business.<br> http://www.microsoft.com/presspass/exec/craig/05-03sharedsource.asp }~
+_1 It also fundamentally undermines the independent commercial software sector because it effectively makes it impossible to distribute software on a basis where recipients pay for the product rather than just the cost of distribution.~{ See Craig Mundie, "The Commercial Software Model," senior vice president, Microsoft Corp. Excerpted from an online transcript of Mundie's May 3, 2001, speech to the New York University Stern School of Business. \\ http://www.microsoft.com/presspass/exec/craig/05-03sharedsource.asp }~
The mutual success of GNU/Linux, the amalgamated operating system built around the GPL-protected Linux kernel, and Windows over the last 10 years reveals the wisdom of both perspectives. Nevertheless, the battle for momentum is an important one in the software industry. Even powerful vendors such as Microsoft rely on the support of third-party software developers whose tools, programs, and computer games make an underlying software platform such as Windows more attractive to the mainstream consumer. Citing the rapid evolution of the technology marketplace over the last 20 years, not to mention his own company's admirable track record during that period, Mundie advised listeners to not get too carried away by the free software movement's recent momentum:
={GNU Project:Linux and, mutual success of;Linux:GNU Project and;third-party software developers supporting Microsoft}
@@ -299,7 +301,7 @@ Richard Matthew Stallman's rise from frustrated academic to political leader ove
Most importantly, it speaks to the changing nature of political power in a world increasingly beholden to computer technology and the software programs that power that technology.
-Maybe that's why, even at a time when most high-technology stars are on the wane, Stallman's star has grown. Since launching the GNU Project in 1984,~{ The acronym GNU stands for "GNU's not Unix." In another portion of the May 29, 2001, NYU speech, Stallman summed up the acronym's origin:<br>_1 We hackers always look for a funny or naughty name for a program, because naming a program is half the fun of writing the program. We also had a tradition of recursive acronyms, to say that the program that you're writing is similar to some existing program . . . I looked for a recursive acronym for Something Is Not UNIX. And I tried all 26 letters and discovered that none of them was a word. I decided to make it a contraction. That way I could have a three-letter acronym, for Something's Not UNIX. And I tried letters, and I came across the word "GNU." That was it.<br>_1 Although a fan of puns, Stallman recommends that software users pronounce the "g" at the beginning of the acronym (i.e., "gah-new"). Not only does this avoid confusion with the word "gnu," the name of the African antelope, Connochaetes gnou, it also avoids confusion with the adjective "new." "We've been working on it for 17 years now, so it is not exactly new any more," Stallman says.<br>Source: author notes and online transcript of "Free Software: Freedom and Cooperation," Richard Stallman's May 29, 2001, speech at New York University.<br> http://www.gnu.org/events/rms-nyu-2001-transcript.txt }~ Stallman has been at turns ignored, satirized, vilified, and attacked-both from within and without the free software movement. Through it all, the GNU Project has managed to meet its milestones, albeit with a few notorious delays, and stay relevant in a software marketplace several orders of magnitude more complex than the one it entered 18 years ago. So too has the free software ideology, an ideology meticulously groomed by Stallman himself.
+Maybe that's why, even at a time when most high-technology stars are on the wane, Stallman's star has grown. Since launching the GNU Project in 1984,~{ The acronym GNU stands for "GNU's not Unix." In another portion of the May 29, 2001, NYU speech, Stallman summed up the acronym's origin: \\ _1 We hackers always look for a funny or naughty name for a program, because naming a program is half the fun of writing the program. We also had a tradition of recursive acronyms, to say that the program that you're writing is similar to some existing program . . . I looked for a recursive acronym for Something Is Not UNIX. And I tried all 26 letters and discovered that none of them was a word. I decided to make it a contraction. That way I could have a three-letter acronym, for Something's Not UNIX. And I tried letters, and I came across the word "GNU." That was it. \\ _1 Although a fan of puns, Stallman recommends that software users pronounce the "g" at the beginning of the acronym (i.e., "gah-new"). Not only does this avoid confusion with the word "gnu," the name of the African antelope, Connochaetes gnou, it also avoids confusion with the adjective "new." "We've been working on it for 17 years now, so it is not exactly new any more," Stallman says. \\ Source: author notes and online transcript of "Free Software: Freedom and Cooperation," Richard Stallman's May 29, 2001, speech at New York University. \\ http://www.gnu.org/events/rms-nyu-2001-transcript.txt }~ Stallman has been at turns ignored, satirized, vilified, and attacked-both from within and without the free software movement. Through it all, the GNU Project has managed to meet its milestones, albeit with a few notorious delays, and stay relevant in a software marketplace several orders of magnitude more complex than the one it entered 18 years ago. So too has the free software ideology, an ideology meticulously groomed by Stallman himself.
To understand the reasons behind this currency, it helps to examine Richard Stallman both in his own words and in the words of the people who have collaborated and battled with him along the way. The Richard Stallman character sketch is not a complicated one. If any person exemplifies the old adage "what you see is what you get," it's Stallman.
@@ -339,7 +341,7 @@ Thirty years after the fact, Lippman punctuates the memory with a laugh. "To tel
Seated at the dining-room table of her second Manhattan apartment-the same spacious three-bedroom complex she and her son moved to following her 1967 marriage to Maurice Lippman, now deceased-Alice Lippman exudes a Jewish mother's mixture of pride and bemusement when recalling her son's early years. The nearby dining-room credenza offers an eight-by-ten photo of Stallman glowering in full beard and doctoral robes. The image dwarfs accompanying photos of Lippman's nieces and nephews, but before a visitor can make too much of it, Lippman makes sure to balance its prominent placement with an ironic wisecrack.
={Lippman, Maurice}
-"Richard insisted I have it after he received his honorary doctorate at the University of Glasgow," says Lippman. "He said to me, `Guess what, mom? It's the first graduation I ever attended.'"~{ See Michael Gross, "Richard Stallman: High School Misfit, Symbol of Free Software, MacArthur-certified Genius" (1999). This interview is one of the most candid Stallman interviews on the record. I recommend it highly.<br> http://www.mgross.com/interviews/stallman1.html }~
+"Richard insisted I have it after he received his honorary doctorate at the University of Glasgow," says Lippman. "He said to me, `Guess what, mom? It's the first graduation I ever attended.'"~{ See Michael Gross, "Richard Stallman: High School Misfit, Symbol of Free Software, MacArthur-certified Genius" (1999). This interview is one of the most candid Stallman interviews on the record. I recommend it highly. \\ http://www.mgross.com/interviews/stallman1.html }~
={University of Glasgow}
Such comments reflect the sense of humor that comes with raising a child prodigy. Make no mistake, for every story Lippman hears and reads about her son's stubbornness and unusual behavior, she can deliver at least a dozen in return.
@@ -382,10 +384,10 @@ Seth Breidbart, a fellow Columbia Science Honors Program alumnus, offers bolster
"It's hard to describe," Breidbart says. "It wasn't like he was unapproachable. He was just very intense. [He was] very knowledgeable but also very hardheaded in some ways."
-Such descriptions give rise to speculation: are judgment-laden adjectives like "intense" and "hardheaded" simply a way to describe traits that today might be categorized under juvenile behavioral disorder? A December, 2001, /{Wired}/ magazine article titled "The Geek Syndrome" paints the portrait of several scientifically gifted children diagnosed with high-functioning autism or Asperger Syndrome. In many ways, the parental recollections recorded in the Wired article are eerily similar to the ones offered by Lippman. Even Stallman has indulged in psychiatric revisionism from time to time. During a 2000 profile for the /{Toronto Star}/, Stallman described himself to an interviewer as "borderline autistic,"~{ See Judy Steed, /{Toronto Star}/, BUSINESS, (October 9, 2000): C03.<br>His vision of free software and social cooperation stands in stark contrast to the isolated nature of his private life. A Glenn Gould-like eccentric, the Canadian pianist was similarly brilliant, articulate, and lonely. Stallman considers himself afflicted, to some degree, by autism: a condition that, he says, makes it difficult for him to interact with people. }~ a description that goes a long way toward explaining a lifelong tendency toward social and emotional isolation and the equally lifelong effort to overcome it.
+Such descriptions give rise to speculation: are judgment-laden adjectives like "intense" and "hardheaded" simply a way to describe traits that today might be categorized under juvenile behavioral disorder? A December, 2001, /{Wired}/ magazine article titled "The Geek Syndrome" paints the portrait of several scientifically gifted children diagnosed with high-functioning autism or Asperger Syndrome. In many ways, the parental recollections recorded in the Wired article are eerily similar to the ones offered by Lippman. Even Stallman has indulged in psychiatric revisionism from time to time. During a 2000 profile for the /{Toronto Star}/, Stallman described himself to an interviewer as "borderline autistic,"~{ See Judy Steed, /{Toronto Star}/, BUSINESS, (October 9, 2000): C03. \\ His vision of free software and social cooperation stands in stark contrast to the isolated nature of his private life. A Glenn Gould-like eccentric, the Canadian pianist was similarly brilliant, articulate, and lonely. Stallman considers himself afflicted, to some degree, by autism: a condition that, he says, makes it difficult for him to interact with people. }~ a description that goes a long way toward explaining a lifelong tendency toward social and emotional isolation and the equally lifelong effort to overcome it.
={Asperger Syndrome+1;autism+5;Geek Syndrome, The (Silberman)+1;Wired magazine;Toronto Star;Silberman, Steve+1;Stallman, Richard M.:behavioral disorders+1}
-Such speculation benefits from the fast and loose nature of most so-called "behavioral disorders" nowadays, of course. As Steve Silberman, author of "The Geek Syndrome," notes, American psychiatrists have only recently come to accept Asperger Syndrome as a valid umbrella term covering a wide set of behavioral traits. The traits range from poor motor skills and poor socialization to high intelligence and an almost obsessive affinity for numbers, computers, and ordered systems.~{ See Steve Silberman, "The Geek Syndrome," Wired (December, 2001).<br> http://www.wired.com/wired/archive/9.12/aspergers_pr.html }~ Reflecting on the broad nature of this umbrella, Stallman says its possible that, if born 40 years later, he might have merited just such a diagnosis. Then again, so would many of his computer-world colleagues.
+Such speculation benefits from the fast and loose nature of most so-called "behavioral disorders" nowadays, of course. As Steve Silberman, author of "The Geek Syndrome," notes, American psychiatrists have only recently come to accept Asperger Syndrome as a valid umbrella term covering a wide set of behavioral traits. The traits range from poor motor skills and poor socialization to high intelligence and an almost obsessive affinity for numbers, computers, and ordered systems.~{ See Steve Silberman, "The Geek Syndrome," Wired (December, 2001). \\ http://www.wired.com/wired/archive/9.12/aspergers_pr.html }~ Reflecting on the broad nature of this umbrella, Stallman says its possible that, if born 40 years later, he might have merited just such a diagnosis. Then again, so would many of his computer-world colleagues.
={Stallman, Richard M.:childhood, behavioral disorders}
"It's possible I could have had something like that," he says. "On the other hand, one of the aspects of that syndrome is difficulty following rhythms. I can dance. In fact, I love following the most complicated rhythms. It's not clear cut enough to know."
@@ -589,7 +591,7 @@ Looking back, Stallman sees nothing unusual in the AI Lab's willingness to accep
To get a taste of "bureaucratic and stuffy," Stallman need only visit the computer labs at Harvard. There, access to the terminals was doled out according to academic rank. As an undergrad, Stallman usually had to sign up or wait until midnight, about the time most professors and grad students finished their daily work assignments. The waiting wasn't difficult, but it was frustrating. Waiting for a public terminal, knowing all the while that a half dozen equally usable machines were sitting idle inside professors' locked offices, seemed the height of illogic. Although Stallman paid the occasional visit to the Harvard computer labs, he preferred the more egalitarian policies of the AI Lab. "It was a breath of fresh air," he says. "At the AI Lab, people seemed more concerned about work than status."
={Harvard University:computer labs}
-Stallman quickly learned that the AI Lab's first-come, first-served policy owed much to the efforts of a vigilant few. Many were holdovers from the days of Project MAC, the Department of Defense-funded research program that had given birth to the first time-share operating systems. A few were already legends in the computing world. There was Richard Greenblatt, the lab's in-house Lisp expert and author of MacHack, the computer chess program that had once humbled A.I. critic Hubert Dreyfus. There was Gerald Sussman, original author of the robotic block-stacking program HACKER. And there was Bill Gosper, the in-house math whiz already in the midst of an 18-month hacking bender triggered by the philosophical implications of the computer game LIFE.~{ See Steven Levy, Hackers (Penguin USA [paperback], 1984): 144.<br>Levy devotes about five pages to describing Gosper's fascination with LIFE, a math-based software game first created by British mathematician John Conway. I heartily recommend this book as a supplement, perhaps even a prerequisite, to this one. }~
+Stallman quickly learned that the AI Lab's first-come, first-served policy owed much to the efforts of a vigilant few. Many were holdovers from the days of Project MAC, the Department of Defense-funded research program that had given birth to the first time-share operating systems. A few were already legends in the computing world. There was Richard Greenblatt, the lab's in-house Lisp expert and author of MacHack, the computer chess program that had once humbled A.I. critic Hubert Dreyfus. There was Gerald Sussman, original author of the robotic block-stacking program HACKER. And there was Bill Gosper, the in-house math whiz already in the midst of an 18-month hacking bender triggered by the philosophical implications of the computer game LIFE.~{ See Steven Levy, Hackers (Penguin USA [paperback], 1984): 144. \\ Levy devotes about five pages to describing Gosper's fascination with LIFE, a math-based software game first created by British mathematician John Conway. I heartily recommend this book as a supplement, perhaps even a prerequisite, to this one. }~
={Dreyfus, Hubert;Gosper, Bill;Greenblat, Richard;LIFE mathematical game;LISP programming language;MacHack;Project MAC;Sussman, Gerald+2}
Members of the tight-knit group called themselves "hackers." Over time, they extended the "hacker" description to Stallman as well. In the process of doing so, they inculcated Stallman in the ethical traditions of the "hacker ethic ." To be a hacker meant more than just writing programs, Stallman learned. It meant writing the best possible programs. It meant sitting at a terminal for 36 hours straight if that's what it took to write the best possible programs. Most importantly, it meant having access to the best possible machines and the most useful information at all times. Hackers spoke openly about changing the world through software, and Stallman learned the instinctual hacker disdain for any obstacle that prevented a hacker from fulfilling this noble cause. Chief among these obstacles were poor software, academic bureaucracy, and selfish behavior.
@@ -615,7 +617,7 @@ Using this feature, Stallman was able to watch how programs written by hackers p
By the end of 1970, hacking at the AI Lab had become a regular part of Stallman's weekly schedule. From Monday to Thursday, Stallman devoted his waking hours to his Harvard classes. As soon as Friday afternoon arrived, however, he was on the T, heading down to MIT for the weekend. Stallman usually timed his arrival to coincide with the ritual food run. Joining five or six other hackers in their nightly quest for Chinese food, he would jump inside a beat-up car and head across the Harvard Bridge into nearby Boston. For the next two hours, he and his hacker colleagues would discuss everything from ITS to the internal logic of the Chinese language and pictograph system. Following dinner, the group would return to MIT and hack code until dawn.
-For the geeky outcast who rarely associated with his high-school peers, it was a heady experience, suddenly hanging out with people who shared the same predilection for computers, science fiction, and Chinese food. "I remember many sunrises seen from a car coming back from Chinatown," Stallman would recall nostalgically, 15 years after the fact in a speech at the Swedish Royal Technical Institute. "It was actually a very beautiful thing to see a sunrise, 'cause that's such a calm time of day. It's a wonderful time of day to get ready to go to bed. It's so nice to walk home with the light just brightening and the birds starting to chirp; you can get a real feeling of gentle satisfaction, of tranquility about the work that you have done that night."~{ See Richard Stallman, "RMS lecture at KTH (Sweden)," (October 30, 1986).<br> http://www.gnu.org/philosophy/stallman-kth.html }~
+For the geeky outcast who rarely associated with his high-school peers, it was a heady experience, suddenly hanging out with people who shared the same predilection for computers, science fiction, and Chinese food. "I remember many sunrises seen from a car coming back from Chinatown," Stallman would recall nostalgically, 15 years after the fact in a speech at the Swedish Royal Technical Institute. "It was actually a very beautiful thing to see a sunrise, 'cause that's such a calm time of day. It's a wonderful time of day to get ready to go to bed. It's so nice to walk home with the light just brightening and the birds starting to chirp; you can get a real feeling of gentle satisfaction, of tranquility about the work that you have done that night."~{ See Richard Stallman, "RMS lecture at KTH (Sweden)," (October 30, 1986). \\ http://www.gnu.org/philosophy/stallman-kth.html }~
={Swedish Royal Technical Institute}
The more Stallman hung out with the hackers, the more he adopted the hacker worldview. Already committed to the notion of personal liberty, Stallman began to infuse his actions with a sense of communal responsibility. When others violated the communal code, Stallman was quick to speak out. Within a year of his first visit, Stallman was the one breaking into locked offices, trying to recover the sequestered terminals that belonged to the lab community as a whole. In true hacker fashion, Stallman also sought to make his own personal contribution to the art of lock hacking. One of the most artful door-opening tricks, commonly attributed to Greenblatt, involved bending a stiff wire into a cane and attaching a loop of tape to the long end. Sliding the wire under the door, a hacker could twist and rotate the wire so that the long end touched the door knob. Provided the adhesive on the tape held, a hacker could open the doorknob with a few sharp twists.
@@ -685,7 +687,7 @@ Ask anyone who's spent more than a minute in Richard Stallman's presence, and yo
To call the Stallman gaze intense is an understatement. Stallman's eyes don't just look at you; they look through you. Even when your own eyes momentarily shift away out of simple primate politeness, Stallman's eyes remain locked-in, sizzling away at the side of your head like twin photon beams.
-Maybe that's why most writers, when describing Stallman, tend to go for the religious angle. In a 1998 Salon.com article titled "The Saint of Free Software," Andrew Leonard describes Stallman's green eyes as "radiating the power of an Old Testament prophet."~{ See Andrew Leonard, "The Saint of Free Software," Salon.com (August 1998).<br> http://www.salon.com/21st/feature/1998/08/cov_31feature.html }~ A 1999 /{Wired}/ magazine article describes the Stallman beard as "Rasputin-like,"~{ See Leander Kahney, "Linux's Forgotten Man," Wired News (March 5, 1999).<br> http://www.wired.com/news/print/0,1294,18291,00.html }~ while a /{London Guardian}/ profile describes the Stallman smile as the smile of "a disciple seeing Jesus."~{ See "Programmer on moral high ground; Free software is a moral issue for Richard Stallman believes in freedom and free software." London Guardian (November 6, 1999).<br>These are just a small sampling of the religious comparisons. To date, the most extreme comparison has to go to Linus Torvalds, who, in his autobiography-see Linus Torvalds and David Diamond, Just For Fun: The Story of an Accidentaly Revolutionary (HarperCollins Publishers, Inc., 2001): 58-writes "Richard Stallman is the God of Free Software."<br>Honorable mention goes to Larry Lessig, who, in a footnote description of Stallman in his book-see Larry Lessig, The Future of Ideas (Random House, 2001): 270-likens Stallman to Moses:<br>_1 ... as with Moses, it was another leader, Linus Torvalds, who finally carried the movement into the promised land by facilitating the development of the final part of the OS puzzle. Like Moses, too, Stallman is both respected and reviled by allies within the movement. He is [an] unforgiving, and hence for many inspiring, leader of a critically important aspect of modern culture. I have deep respect for the principle and commitment of this extraordinary individual, though I also have great respect for those who are courageous enough to question his thinking and then sustain his wrath.<br>In a final interview with Stallman, I asked him his thoughts about the religious comparisons. "Some people do compare me with an Old Testament prophent, and the reason is Old Testament prophets said certain social practices were wrong. They wouldn't compromise on moral issues. They couldn't be bought off, and they were usually treated with contempt." }~
+Maybe that's why most writers, when describing Stallman, tend to go for the religious angle. In a 1998 Salon.com article titled "The Saint of Free Software," Andrew Leonard describes Stallman's green eyes as "radiating the power of an Old Testament prophet."~{ See Andrew Leonard, "The Saint of Free Software," Salon.com (August 1998). \\ http://www.salon.com/21st/feature/1998/08/cov_31feature.html }~ A 1999 /{Wired}/ magazine article describes the Stallman beard as "Rasputin-like,"~{ See Leander Kahney, "Linux's Forgotten Man," Wired News (March 5, 1999). \\ http://www.wired.com/news/print/0,1294,18291,00.html }~ while a /{London Guardian}/ profile describes the Stallman smile as the smile of "a disciple seeing Jesus."~{ See "Programmer on moral high ground; Free software is a moral issue for Richard Stallman believes in freedom and free software." London Guardian (November 6, 1999). \\ These are just a small sampling of the religious comparisons. To date, the most extreme comparison has to go to Linus Torvalds, who, in his autobiography-see Linus Torvalds and David Diamond, Just For Fun: The Story of an Accidentaly Revolutionary (HarperCollins Publishers, Inc., 2001): 58-writes "Richard Stallman is the God of Free Software." \\ Honorable mention goes to Larry Lessig, who, in a footnote description of Stallman in his book-see Larry Lessig, The Future of Ideas (Random House, 2001): 270-likens Stallman to Moses: \\ _1 ... as with Moses, it was another leader, Linus Torvalds, who finally carried the movement into the promised land by facilitating the development of the final part of the OS puzzle. Like Moses, too, Stallman is both respected and reviled by allies within the movement. He is [an] unforgiving, and hence for many inspiring, leader of a critically important aspect of modern culture. I have deep respect for the principle and commitment of this extraordinary individual, though I also have great respect for those who are courageous enough to question his thinking and then sustain his wrath. \\ In a final interview with Stallman, I asked him his thoughts about the religious comparisons. "Some people do compare me with an Old Testament prophent, and the reason is Old Testament prophets said certain social practices were wrong. They wouldn't compromise on moral issues. They couldn't be bought off, and they were usually treated with contempt." }~
={Wired magazine;Leonard, Andrew;London Guardian;Salon.com}
Such analogies serve a purpose, but they ultimately fall short. That's because they fail to take into account the vulnerable side of the Stallman persona. Watch the Stallman gaze for an extended period of time, and you will begin to notice a subtle change. What appears at first to be an attempt to intimidate or hypnotize reveals itself upon second and third viewing as a frustrated attempt to build and maintain contact. If, as Stallman himself has suspected from time to time, his personality is the product of autism or Asperger Syndrome, his eyes certainly confirm the diagnosis. Even at their most high-beam level of intensity, they have a tendency to grow cloudy and distant, like the eyes of a wounded animal preparing to give up the ghost.
@@ -747,7 +749,7 @@ Stallman's body bears witness to the tragedy. Lack of exercise has left Stallman
The walk is further slowed by Stallman's willingness to stop and smell the roses, literally. Spotting a particularly beautiful blossom, he tickles the innermost petals with his prodigious nose, takes a deep sniff and steps back with a contented sigh.
-"Mmm, rhinophytophilia,"~{ At the time, I thought Stallman was referring to the flower's scientific name. Months later, I would learn that rhinophytophilia was in fact a humorous reference to the activity, i.e., Stallman sticking his nose into a flower and enjoying the moment. For another humorous Stallman flower incident, visit:<br> http://www.stallman.org/texas.html }~ he says, rubbing his back.
+"Mmm, rhinophytophilia,"~{ At the time, I thought Stallman was referring to the flower's scientific name. Months later, I would learn that rhinophytophilia was in fact a humorous reference to the activity, i.e., Stallman sticking his nose into a flower and enjoying the moment. For another humorous Stallman flower incident, visit: \\ http://www.stallman.org/texas.html }~ he says, rubbing his back.
The drive to the restaurant takes less than three minutes. Upon recommendation from Tim Ney, former executive director of the Free Software Foundation, I have let Stallman choose the restaurant. While some reporters zero in on Stallman's monk-like lifestyle, the truth is, Stallman is a committed epicure when it comes to food. One of the fringe benefits of being a traveling missionary for the free software cause is the ability to sample delicious food from around the world. "Visit almost any major city in the world, and chances are Richard knows the best restaurant in town," says Ney. "Richard also takes great pride in knowing what's on the menu and ordering for the entire table."
={Ney, Tim}
@@ -772,7 +774,7 @@ The conversation shifts to Napster, the San Mateo, California software company,
Although based on proprietary software, the Napster system draws inspiration from the long-held Stallman contention that once a work enters the digital realm-in other words, once making a copy is less a matter of duplicating sounds or duplicating atoms and more a matter of duplicating information-the natural human impulse to share a work becomes harder to restrict. Rather than impose additional restrictions, Napster execs have decided to take advantage of the impulse. Giving music listeners a central place to trade music files, the company has gambled on its ability to steer the resulting user traffic toward other commercial opportunities.
-The sudden success of the Napster model has put the fear in traditional record companies, with good reason. Just days before my Palo Alto meeting with Stallman, U.S. District Court Judge Marilyn Patel granted a request filed by the Recording Industry Association of America for an injunction against the file-sharing service. The injunction was subsequently suspended by the U.S. Ninth District Court of Appeals, but by early 2001, the Court of Appeals, too, would find the San Mateo-based company in breach of copyright law,~{ See Cecily Barnes and Scott Ard, "Court Grants Stay of Napster Injunction," News.com (July 28, 2000).<br> http://news.cnet.com/news/0-1005-200-2376465.html }~ a decision RIAA spokesperson Hillary Rosen would later proclaim proclaim a "clear victory for the creative content community and the legitimate online marketplace."~{ See "A Clear Victory for Recording Industry in Napster Case," RIAA press release (February 12, 2001).<br> http://www.riaa.com/PR_story.cfm?id=372 }~
+The sudden success of the Napster model has put the fear in traditional record companies, with good reason. Just days before my Palo Alto meeting with Stallman, U.S. District Court Judge Marilyn Patel granted a request filed by the Recording Industry Association of America for an injunction against the file-sharing service. The injunction was subsequently suspended by the U.S. Ninth District Court of Appeals, but by early 2001, the Court of Appeals, too, would find the San Mateo-based company in breach of copyright law,~{ See Cecily Barnes and Scott Ard, "Court Grants Stay of Napster Injunction," News.com (July 28, 2000). \\ http://news.cnet.com/news/0-1005-200-2376465.html }~ a decision RIAA spokesperson Hillary Rosen would later proclaim proclaim a "clear victory for the creative content community and the legitimate online marketplace."~{ See "A Clear Victory for Recording Industry in Napster Case," RIAA press release (February 12, 2001). \\ http://www.riaa.com/PR_story.cfm?id=372 }~
For hackers such as Stallman, the Napster business model is scary in different ways. The company's eagerness to appropriate time-worn hacker principles such as file sharing and communal information ownership, while at the same time selling a service based on proprietary software, sends a distressing mixed message. As a person who already has a hard enough time getting his own carefully articulated message into the media stream, Stallman is understandably reticent when it comes to speaking out about the company. Still, Stallman does admit to learning a thing or two from the social side of the Napster phenomenon.
@@ -795,7 +797,7 @@ I turn to look, catching a glimpse of a woman's back. The woman is young, somewh
"Oh, no," he says. "They're gone. And to think, I'll probably never even get to see her again."
-After a brief sigh, Stallman recovers. The moment gives me a chance to discuss Stallman's reputation vis-ý-vis the fairer sex. The reputation is a bit contradictory at times. A number of hackers report Stallman's predilection for greeting females with a kiss on the back of the hand.~{ See Mae Ling Mak, "Mae Ling's Story" (December 17, 1998).<br> http://www.crackmonkey.org/pipermail/crackmonkey/1998q4/003006.htm <br>So far, Mak is the only person I've found willing to speak on the record in regard to this practice, although I've heard this from a few other female sources. Mak, despite expressing initial revulsion at it, later managed to put aside her misgivings and dance with Stallman at a 1999 LinuxWorld show.<br> http://www.linux.com/interact/potd.phtml?potd_id=44 }~ A May 26, 2000 Salon.com article, meanwhile, portrays Stallman as a bit of a hacker lothario. Documenting the free software-free love connection, reporter Annalee Newitz presents Stallman as rejecting traditional family values, telling her, "I believe in love, but not monogamy."~{ See Annalee Newitz, "If Code is Free Why Not Me?" Salon.com (May 26, 2000).<br> http://www.salon.com/tech/feature/2000/05/26/free_love/print.html }~
+After a brief sigh, Stallman recovers. The moment gives me a chance to discuss Stallman's reputation vis-ý-vis the fairer sex. The reputation is a bit contradictory at times. A number of hackers report Stallman's predilection for greeting females with a kiss on the back of the hand.~{ See Mae Ling Mak, "Mae Ling's Story" (December 17, 1998). \\ http://www.crackmonkey.org/pipermail/crackmonkey/1998q4/003006.htm \\ So far, Mak is the only person I've found willing to speak on the record in regard to this practice, although I've heard this from a few other female sources. Mak, despite expressing initial revulsion at it, later managed to put aside her misgivings and dance with Stallman at a 1999 LinuxWorld show. \\ http://www.linux.com/interact/potd.phtml?potd_id=44 }~ A May 26, 2000 Salon.com article, meanwhile, portrays Stallman as a bit of a hacker lothario. Documenting the free software-free love connection, reporter Annalee Newitz presents Stallman as rejecting traditional family values, telling her, "I believe in love, but not monogamy."~{ See Annalee Newitz, "If Code is Free Why Not Me?" Salon.com (May 26, 2000). \\ http://www.salon.com/tech/feature/2000/05/26/free_love/print.html }~
={Newitz, Annalee;Salon.com}
Stallman lets his menu drop a little when I bring this up. "Well, most men seem to want sex and seem to have a rather contemptuous attitude towards women," he says. "Even women they're involved with. I can't understand it at all."
@@ -839,7 +841,7 @@ Stallman asks me if I would be interested in hearing the folk filk. As soon as I
_1 How much wood could a woodchuck chuck,If a woodchuck could chuck wood? How many poles could a polak lock,If a polak could lock poles? How many knees could a negro grow, If a negro could grow knees? The answer, my dear, is stick it in your ear.The answer is to stick it in your ear.
-The singing ends, and Stallman's lips curl into another child-like half smile. I glance around at the nearby tables. The Asian families enjoying their Sunday lunch pay little attention to the bearded alto in their midst.~{ For more Stallman filks, visit<br> http://www.stallman.org/doggerel.html. To hear Stallman singing "The Free Software Song," visit<br> http://www.gnu.org/music/free-software-song.html. }~ After a few moments of hesitation, I finally smile too.
+The singing ends, and Stallman's lips curl into another child-like half smile. I glance around at the nearby tables. The Asian families enjoying their Sunday lunch pay little attention to the bearded alto in their midst.~{ For more Stallman filks, visit \\ http://www.stallman.org/doggerel.html. To hear Stallman singing "The Free Software Song," visit \\ http://www.gnu.org/music/free-software-song.html. }~ After a few moments of hesitation, I finally smile too.
"Do you want that last cornball?" Stallman asks, eyes twinkling. Before I can screw up the punch line, Stallman grabs the corn-encrusted dumpling with his two chopsticks and lifts it proudly. "Maybe I'm the one who should get the cornball," he says.
@@ -903,7 +905,7 @@ The waiter, uncomprehending or fooled by the look of the bill, smiles and scurri
The AI Lab of the 1970s was by all accounts a special place. Cutting-edge projects and top-flight researchers gave it an esteemed position in the world of computer science. The internal hacker culture and its anarchic policies lent a rebellious mystique as well. Only later, when many of the lab's scientists and software superstars had departed, would hackers fully realize the unique and ephemeral world they had once inhabited.
={AI Lab (Artificial Intelligence Laboratory)+17}
-"It was a bit like the Garden of Eden," says Stallman, summing up the lab and its software-sharing ethos in a 1998 Forbes article. "It hadn't occurred to us not to cooperate."~{ See Josh McHugh, "For the Love of Hacking," Forbes (August 10, 1998).<br> http://www.forbes.com/forbes/1998/0810/6203094a.html }~
+"It was a bit like the Garden of Eden," says Stallman, summing up the lab and its software-sharing ethos in a 1998 Forbes article. "It hadn't occurred to us not to cooperate."~{ See Josh McHugh, "For the Love of Hacking," Forbes (August 10, 1998). \\ http://www.forbes.com/forbes/1998/0810/6203094a.html }~
Such mythological descriptions, while extreme, underline an important fact. The ninth floor of 545 Tech Square was more than a workplace for many. For hackers such as Stallman, it was home.
@@ -960,13 +962,13 @@ During the late 1960s, interface design made additional leaps. In a famous 1968
Such innovations would take another two decades to make their way into the commercial marketplace. Still, by the 1970s, video screens had started to replace teletypes as display terminals, creating the potential for full-screen-as opposed to line-by-line-editing capabilities.
={display terminals, replacing teletypes;video screens}
-One of the first programs to take advantage of this full-screen capability was the MIT AI Lab's TECO. Short for Text Editor and COrrector, the program had been upgraded by hackers from an old teletype line editor for the lab's PDP-6 machine.~{ According to the Jargon File, TECO's name originally stood for Tape Editor and Corrector.<br> http://www.tuxedo.org/~esr/jargon/html/entry/TECO.html }~
+One of the first programs to take advantage of this full-screen capability was the MIT AI Lab's TECO. Short for Text Editor and COrrector, the program had been upgraded by hackers from an old teletype line editor for the lab's PDP-6 machine.~{ According to the Jargon File, TECO's name originally stood for Tape Editor and Corrector. \\ http://www.tuxedo.org/~esr/jargon/html/entry/TECO.html }~
-TECO was a substantial improvement over old editors, but it still had its drawbacks. To create and edit a document, a programmer had to enter a series of software commands specifying each edit. It was an abstract process. Unlike modern word processors, which update text with each keystroke, TECO demanded that the user enter an extended series of editing instructions followed by an "end of command" sequence just to change the text.Over time, a hacker grew proficient enough to write entire documents in edit mode, but as Stallman himself would later point out, the process required "a mental skill like that of blindfold chess."~{ See Richard Stallman, "EMACS: The Extensible, Customizable, Display Editor," AI Lab Memo (1979). An updated HTML version of this memo, from which I am quoting, is available at<br> http://www.gnu.org/software/emacs/emacs-paper.html }~
+TECO was a substantial improvement over old editors, but it still had its drawbacks. To create and edit a document, a programmer had to enter a series of software commands specifying each edit. It was an abstract process. Unlike modern word processors, which update text with each keystroke, TECO demanded that the user enter an extended series of editing instructions followed by an "end of command" sequence just to change the text.Over time, a hacker grew proficient enough to write entire documents in edit mode, but as Stallman himself would later point out, the process required "a mental skill like that of blindfold chess."~{ See Richard Stallman, "EMACS: The Extensible, Customizable, Display Editor," AI Lab Memo (1979). An updated HTML version of this memo, from which I am quoting, is available at \\ http://www.gnu.org/software/emacs/emacs-paper.html }~
To facilitate the process, AI Lab hackers had built a system that displayed both the "source" and "display" modes on a split screen. Despite this innovative hack, switching from mode to mode was still a nuisance.
-TECO wasn't the only full-screen editor floating around the computer world at this time. During a visit to the Stanford Artificial Intelligence Lab in 1976, Stallman encountered an edit program named E. The program contained an internal feature, which allowed a user to update display text after each command keystroke. In the language of 1970s programming, E was one of the first rudimentary WYSIWYG editors. Short for "what you see is what you get," WYSIWYG meant that a user could manipulate the file by moving through the displayed text, as opposed to working through a back-end editor program."~{ See Richard Stallman, "Emacs the Full Screen Editor" (1987).<br> http://www.lysator.liu.se/history/garb/txt/87-1-emacs.txt }~
+TECO wasn't the only full-screen editor floating around the computer world at this time. During a visit to the Stanford Artificial Intelligence Lab in 1976, Stallman encountered an edit program named E. The program contained an internal feature, which allowed a user to update display text after each command keystroke. In the language of 1970s programming, E was one of the first rudimentary WYSIWYG editors. Short for "what you see is what you get," WYSIWYG meant that a user could manipulate the file by moving through the displayed text, as opposed to working through a back-end editor program."~{ See Richard Stallman, "Emacs the Full Screen Editor" (1987). \\ http://www.lysator.liu.se/history/garb/txt/87-1-emacs.txt }~
={E edit program;Stanford Artificial Intelligence Laboratory}
Impressed by the hack, Stallman looked for ways to expand TECO's functionality in similar fashion upon his return to MIT. He found a TECO feature called Control-R, written by Carl Mikkelson and named after the two-key combination that triggered it. Mikkelson's hack switched TECO from its usual abstract command-execution mode to a more intuitive keystroke-by-keystroke mode. Stallman revised the feature in a subtle but significant way. He made it possible to trigger other TECO command strings, or "macros," using other, two-key combinations. Where users had once entered command strings and discarded them after entering then, Stallman's hack made it possible to save macro tricks on file and call them up at will. Mikkelson's hack had raised TECO to the level of a WYSIWYG editor. Stallman's hack had raised it to the level of a user-programmable WYSIWYG editor. "That was the real breakthrough," says Guy Steele, a fellow AI Lab hacker at the time. ^39^
@@ -1005,7 +1007,7 @@ Stallman now faced another conundrum: if users made changes but didn't communica
Not everybody accepted the contract. The explosive innovation continued throughout the decade, resulting in a host of Emacs-like programs with varying degrees of cross-compatibility. A few cited their relation to Stallman's original Emacs with humorously recursive names: Sine (Sine is not Emacs), Eine (Eine is not Emacs), and Zwei (Zwei was Eine initially). As a devoted exponent of the hacker ethic, Stallman saw no reason to halt this innovation through legal harassment. Still, the fact that some people would so eagerly take software from the community chest, alter it, and slap a new name on the resulting software displayed a stunning lack of courtesy.
={Eine (Eine is not Emacs) text editor;Zwei (Zwei was Eine initially) text editor;Sine (Sine is not Emacs) text editor}
-Such rude behavior was reflected against other, unsettling developments in the hacker community. Brian Reid's 1979 decision to embed "time bombs" in Scribe, making it possible for Unilogic to limit unpaid user access to the software, was a dark omen to Stallman. "He considered it the most Nazi thing he ever saw in his life," recalls Reid. Despite going on to later Internet fame as the cocreator of the Usenet alt heirarchy, Reid says he still has yet to live down that 1979 decision, at least in Stallman's eyes. "He said that all software should be free and the prospect of charging money for software was a crime against humanity."~{ In a 1996 interview with online magazine MEME, Stallman cited Scribe's sale as irksome, but hesitated to mention Reid by name. "The problem was nobody censured or punished this student for what he did," Stallman said. "The result was other people got tempted to follow his example." See MEME 2.04.<br> http://memex.org/meme2-04.html }~
+Such rude behavior was reflected against other, unsettling developments in the hacker community. Brian Reid's 1979 decision to embed "time bombs" in Scribe, making it possible for Unilogic to limit unpaid user access to the software, was a dark omen to Stallman. "He considered it the most Nazi thing he ever saw in his life," recalls Reid. Despite going on to later Internet fame as the cocreator of the Usenet alt heirarchy, Reid says he still has yet to live down that 1979 decision, at least in Stallman's eyes. "He said that all software should be free and the prospect of charging money for software was a crime against humanity."~{ In a 1996 interview with online magazine MEME, Stallman cited Scribe's sale as irksome, but hesitated to mention Reid by name. "The problem was nobody censured or punished this student for what he did," Stallman said. "The result was other people got tempted to follow his example." See MEME 2.04. \\ http://memex.org/meme2-04.html }~
={Reid, Brian+1;Unilogic software company;time bombs, in software;Scribe text-formatting program}
% additional reference to Unilogic; also time bombs; also scribe text-formatting program
@@ -1017,7 +1019,7 @@ Although Stallman had been powerless to head off Reid's sale, he did possess the
Over time, Emacs became a sales tool for the hacker ethic. The flexibility Stallman and built into the software not only encouraged collaboration, it demanded it. Users who didn't keep abreast of the latest developments in Emacs evolution or didn't contribute their contributions back to Stallman ran the risk of missing out on the latest breakthroughs. And the breakthroughs were many. Twenty years later, users had modified Emacs for so many different uses-using it as a spreadsheet, calculator, database, and web browser-that later Emacs developers adopted an overflowing sink to represent its versatile functionality. "That's the idea that we wanted to convey," says Stallman. "The amount of stuff it has contained within it is both wonderful and awful at the same time."
-Stallman's AI Lab contemporaries are more charitable. Hal Abelson, an MIT grad student who worked with Stallman during the 1970s and would later assist Stallman as a charter boardmember of the Free Software Foundation, describes Emacs as "an absolutely brilliant creation." In giving programmers a way to add new software libraries and features without messing up the system, Abelson says, Stallman paved the way for future large-scale collaborative software projects. "Its structure was robust enough that you'd have people all over the world who were loosely collaborating [and] contributing to it," Abelson says. "I don't know if that had been done before."~{ In writing this chapter, I've elected to focus more on the social significance of Emacs than the software significance. To read more about the software side, I recommend Stallman's 1979 memo. I particularly recommend the section titled "Research Through Development of Installed Tools" (#SEC27). Not only is it accessible to the nontechnical reader, it also sheds light on how closely intertwined Stallman's political philosophies are with his software-design philosophies. A sample excerpt follows:<br>_1 EMACS could not have been reached by a process of careful design, because such processes arrive only at goals which are visible at the outset, and whose desirability is established on the bottom line at the outset. Neither I nor anyone else visualized an extensible editor until I had made one, nor appreciated its value until he had experienced it. EMACS exists because I felt free to make individually useful small improvements on a path whose end was not in sight. }~
+Stallman's AI Lab contemporaries are more charitable. Hal Abelson, an MIT grad student who worked with Stallman during the 1970s and would later assist Stallman as a charter boardmember of the Free Software Foundation, describes Emacs as "an absolutely brilliant creation." In giving programmers a way to add new software libraries and features without messing up the system, Abelson says, Stallman paved the way for future large-scale collaborative software projects. "Its structure was robust enough that you'd have people all over the world who were loosely collaborating [and] contributing to it," Abelson says. "I don't know if that had been done before."~{ In writing this chapter, I've elected to focus more on the social significance of Emacs than the software significance. To read more about the software side, I recommend Stallman's 1979 memo. I particularly recommend the section titled "Research Through Development of Installed Tools" (#SEC27). Not only is it accessible to the nontechnical reader, it also sheds light on how closely intertwined Stallman's political philosophies are with his software-design philosophies. A sample excerpt follows: \\ _1 EMACS could not have been reached by a process of careful design, because such processes arrive only at goals which are visible at the outset, and whose desirability is established on the bottom line at the outset. Neither I nor anyone else visualized an extensible editor until I had made one, nor appreciated its value until he had experienced it. EMACS exists because I felt free to make individually useful small improvements on a path whose end was not in sight. }~
={Abelson, Hal}
Guy Steele expresses similar admiration. Currently a research scientist for Sun Microsystems, he remembers Stallman primarily as a "brilliant programmer with the ability to generate large quantities of relatively bug-free code." Although their personalities didn't exactly mesh, Steele and Stallman collaborated long enough for Steele to get a glimpse of Stallman's intense coding style. He recalls a notable episode in the late 1970s when the two programmers banded together to write the editor's "pretty print" feature. Originally conceived by Steele, pretty print was another keystroke-triggerd feature that reformatted Emacs' source code so that it was both more readable and took up less space, further bolstering the program's WYSIWIG qualities. The feature was strategic enough to attract Stallman's active interest, and it wasn't long before Steele wrote that he and Stallman were planning an improved version.
@@ -1035,7 +1037,7 @@ The length of the session revealed itself when Steele finally left the AI Lab. S
On September 27, 1983, computer programmers logging on to the Usenet newsgroup net.unix-wizards encountered an unusual message. Posted in the small hours of the morning, 12:30 a.m. to be exact, and signed by rms@mit-oz, the message's subject line was terse but attention-grabbing. "New UNIX implementation," it read. Instead of introducing a newly released version of Unix, however, the message's opening paragraph issued a call to arms:
={GNU Project:new UNIX implementation;net.unix-wizards newsgroup}
-_1 Starting this Thanksgiving I am going to write a complete Unix-compatible software system called GNU (for Gnu's Not Unix), and give it away free to everyone who can use it. Contributions of time, money, programs and equipment are greatly needed.~{ See Richard Stallman, "Initial GNU Announcement" (September 1983).<br> http://www.gnu.ai.mit.edu/gnu/initial-announcement.html }~
+_1 Starting this Thanksgiving I am going to write a complete Unix-compatible software system called GNU (for Gnu's Not Unix), and give it away free to everyone who can use it. Contributions of time, money, programs and equipment are greatly needed.~{ See Richard Stallman, "Initial GNU Announcement" (September 1983). \\ http://www.gnu.ai.mit.edu/gnu/initial-announcement.html }~
={Unix operating system:GNU system and}
To an experienced Unix developer, the message was a mixture of idealism and hubris. Not only did the author pledge to rebuild the already mature Unix operating system from the ground up, he also proposed to improve it in places. The new GNU system, the author predicted, would carry all the usual components-a text editor, a shell program to run Unix-compatible applications, a compiler, "and a few other things." ^44^ It would also contain many enticing features that other Unix systems didn't yet offer: a graphic user interface based on the Lisp programming language, a crash-proof file system, and networking protocols built according to MIT's internal networking system.
@@ -1068,7 +1070,7 @@ The breaking point came in 1982. That was the year the lab's administration deci
"Without hackers to maintain the system, [faculty members] said, `We're going to have a disaster; we must have commercial software,'" Stallman would recall a few years later. "They said, `We can expect the company to maintain it.' It proved that they were utterly wrong, but that's what they did."~{ See Richard Stallman (1986). }~
-At first, hackers viewed the Twenex system as yet another authoritarian symbol begging to be subverted. The system's name itself was a protest. Officially dubbed TOPS-20 by DEC, it was a successor to TOPS-10, a commercial operating system DEC marketed for the PDP-10. Bolt Beranek Newman had deveoped an improved version, dubbed Tenex, which TOPS-20 drew upon.~{ Multiple sources: see Richard Stallman interview, Gerald Sussman email, and Jargon File 3.0.0.<br> http://www.clueless.com/jargon3.0.0/TWENEX.html }~ Stallman, the hacker who coined the Twenex term, says he came up with the name as a way to avoid using the TOPS-20 name. "The system was far from tops, so there was no way I was going to call it that," Stallman recalls. "So I decided to insert a `w' in the Tenex name and call it Twenex."
+At first, hackers viewed the Twenex system as yet another authoritarian symbol begging to be subverted. The system's name itself was a protest. Officially dubbed TOPS-20 by DEC, it was a successor to TOPS-10, a commercial operating system DEC marketed for the PDP-10. Bolt Beranek Newman had deveoped an improved version, dubbed Tenex, which TOPS-20 drew upon.~{ Multiple sources: see Richard Stallman interview, Gerald Sussman email, and Jargon File 3.0.0. \\ http://www.clueless.com/jargon3.0.0/TWENEX.html }~ Stallman, the hacker who coined the Twenex term, says he came up with the name as a way to avoid using the TOPS-20 name. "The system was far from tops, so there was no way I was going to call it that," Stallman recalls. "So I decided to insert a `w' in the Tenex name and call it Twenex."
={DEC (Digital Equipment Corporation);TOPS-20 operating system+1}
% ={Bolt, Beranek & Newman engineering firm;Tenex}
@@ -1088,7 +1090,7 @@ The disguise was a thin one at best. By 1982, Stallman's aversion to passwords a
"I'm eternally grateful that MIT let me and many other people use their computers for free," says Hopkins. "It meant a lot to many people."
-This so-called "tourist" policy, which had been openly tolerated by MIT management during the ITS years,~{ See "MIT AI Lab Tourist Policy."<br> http://catalog.com/hopkins/text/tourist-policy.html }~ fell by the wayside when Oz became the lab's primary link to the ARPAnet. At first, Stallman continued his policy of repeating his login ID as a password so outside users could follow in his footsteps. Over time, however, the Oz's fragility prompted administrators to bar outsiders who, through sheer accident or malicious intent, might bring down the system. When those same administrators eventually demanded that Stallman stop publishing his password, Stallman, citing personal ethics, refused to do so and ceased using the Oz system altogether. ^46^
+This so-called "tourist" policy, which had been openly tolerated by MIT management during the ITS years,~{ See "MIT AI Lab Tourist Policy." \\ http://catalog.com/hopkins/text/tourist-policy.html }~ fell by the wayside when Oz became the lab's primary link to the ARPAnet. At first, Stallman continued his policy of repeating his login ID as a password so outside users could follow in his footsteps. Over time, however, the Oz's fragility prompted administrators to bar outsiders who, through sheer accident or malicious intent, might bring down the system. When those same administrators eventually demanded that Stallman stop publishing his password, Stallman, citing personal ethics, refused to do so and ceased using the Oz system altogether. ^46^
"[When] passwords first appeared at the MIT AI Lab I [decided] to follow my belief that there should be no passwords," Stallman would later say. "Because I don't believe that it's really desirable to have security on a computer, I shouldn't be willing to help uphold the security regime." ^46^
@@ -1151,7 +1153,7 @@ Nowhere was this state of affairs more evident than in the realm of personal com
One of the most notorious of these programmers was Bill Gates, a Harvard dropout two years Stallman's junior. Although Stallman didn't know it at the time, seven years before sending out his message to the net.unix-wizards newsgroup, Gates, a budding entrepreneur and general partner with the Albuquerque-based software firm Micro-Soft, later spelled as Microsoft, had sent out his own open letter to the software-developer community. Written in response to the PC users copying Micro-Soft's software programs, Gates' " Open Letter to Hobbyists" had excoriated the notion of communal software development.
={Gates, Bill+2;Micro-Soft;net.unix-wizards newsgroup;Open Letter to Hobbyists (Gates)+1}
-"Who can afford to do professional work for nothing?" asked Gates. "What hobbyist can put three man-years into programming, finding all bugs, documenting his product, and distributing it for free?"~{ See Bill Gates, "An Open Letter to Hobbyists" (February 3, 1976).<br>To view an online copy of this letter, go to<br> http://www.blinkenlights.com/classiccmp/gateswhine.html. }~
+"Who can afford to do professional work for nothing?" asked Gates. "What hobbyist can put three man-years into programming, finding all bugs, documenting his product, and distributing it for free?"~{ See Bill Gates, "An Open Letter to Hobbyists" (February 3, 1976). \\ To view an online copy of this letter, go to \\ http://www.blinkenlights.com/classiccmp/gateswhine.html. }~
Although few hackers at the AI Lab saw the missive, Gates' 1976 letter nevertheless represented the changing attitude toward software both among commercial software companies and commercial software developers. Why treat software as a zero-cost commodity when the market said otherwise? As the 1970s gave way to the 1980s, selling software became more than a way to recoup costs; it became a political statement. At a time when the Reagan Administration was rushing to dismantle many of the federal regulations and spending programs that had been built up during the half century following the Great Depression, more than a few software programmers saw the hacker ethic as anticompetitive and, by extension, un-American. At best, it was a throwback to the anticorporate attitudes of the late 1960s and early 1970s. Like a Wall Street banker discovering an old tie-dyed shirt hiding between French-cuffed shirts and double-breasted suits, many computer programmers treated the hacker ethic as an embarrassing reminder of an idealistic age.
@@ -1171,7 +1173,7 @@ group{
If not now, when?
-}group ~{ See Richard Stallman, Open Sources (O'Reilly & Associates, Inc., 1999): 56.<br>Stallman adds his own footnote to this statement, writing, "As an atheist, I don't follow any religious leaders, but I sometimes find I admire something one of them has said." }~
+}group ~{ See Richard Stallman, Open Sources (O'Reilly & Associates, Inc., 1999): 56. \\ Stallman adds his own footnote to this statement, writing, "As an atheist, I don't follow any religious leaders, but I sometimes find I admire something one of them has said." }~
Speaking to audiences, Stallman avoids the religious route and expresses the decision in pragmatic terms. "I asked myself: what could I, an operating-system developer, do to improve the situation? It wasn't until I examined the question for a while that I realized an operating-system developer was exactly what was needed to solve the problem."
@@ -1212,7 +1214,7 @@ In the course of reverse-engineering Gosling's interpreter, Stallman would creat
Despite the stress it generated, the dispute over Gosling's innovations would assist both Stallman and the free software movement in the long term. It would force Stallman to address the weaknesses of the Emacs Commune and the informal trust system that had allowed problematic offshoots to emerge. It would also force Stallman to sharpen the free software movement's political objectives. Following the release of GNU Emacs in 1985, Stallman issued " The GNU Manifesto," an expansion of the original announcement posted in September, 1983. Stallman included within the document a lengthy section devoted to the many arguments used by commercial and academic programmers to justify the proliferation of proprietary software programs. One argument, "Don't programmers deserve a reward for their creativity," earned a response encapsulating Stallman's anger over the recent Gosling Emacs episode:
={Emacs Commune:proprietary software and;Emacs text editor;GNU Emacs;GNU Manifesto}
-"If anything deserves a reward, it is social contribution," Stallman wrote. "Creativity can be a social contribution, but only in so far [sic] as society is free to use the results. If programmers deserve to be rewarded for creating innovative programs, by the same token they deserve to be punished if they restrict the use of these programs."~{ See Richard Stallman, "The GNU Manifesto" (1985).<br> http://www.gnu.org/manifesto.html }~
+"If anything deserves a reward, it is social contribution," Stallman wrote. "Creativity can be a social contribution, but only in so far [sic] as society is free to use the results. If programmers deserve to be rewarded for creating innovative programs, by the same token they deserve to be punished if they restrict the use of these programs."~{ See Richard Stallman, "The GNU Manifesto" (1985). \\ http://www.gnu.org/manifesto.html }~
With the release of GNU Emacs, the GNU Project finally had code to show. It also had the burdens of any software-based enterprise. As more and more Unix developers began playing with the software, money, gifts, and requests for tapes began to pour in. To address the business side of the GNU Project, Stallman drafted a few of his colleagues and formed the Free Software Foundation (FSF), a nonprofit organization dedicated to speeding the GNU Project towards its goal. With Stallman as president and various hacker allies as board members, the FSF helped provide a corporate face for the GNU Project.
={Free Software Foundation (FSF):GNU Project and;GNU Project:Emacs, release of}
@@ -1252,9 +1254,9 @@ Needless to say, Stallman, who stands in front of the room dressed in plain blue
As Stallman putters around the front of the room, a few audience members wearing T-shirts with the logo of the Maui FreeBSD Users Group (MFUG) race to set up camera and audio equipment. FreeBSD, a free software offshoot of the Berkeley Software Distribution, the venerable 1970s academic version of Unix, is technically a competitor to the GNU/Linux operating system. Still, in the hacking world, Stallman speeches are documented with a fervor reminiscent of the Grateful Dead and its legendary army of amateur archivists. As the local free software heads, it's up to the MFUG members to make sure fellow programmers in Hamburg, Mumbai, and Novosibirsk don't miss out on the latest pearls of RMS wisdom.
={Berkely Software Distribution (BSD);BSD (Berkely Software Distribution);Grateful Dead, The+1;Maui FreeBSD Users Group}
-The analogy to the Grateful Dead is apt. Often, when describing the business opportunities inherent within the free software model, Stallman has held up the Grateful Dead as an example. In refusing to restrict fans' ability to record live concerts, the Grateful Dead became more than a rock group. They became the center of a tribal community dedicated to Grateful Dead music. Over time, that tribal community became so large and so devoted that the band shunned record contracts and supported itself solely through musical tours and live appearances. In 1994, the band's last year as a touring act, the Grateful Dead drew $52 million in gate receipts alone.~{ See "Grateful Dead Time Capsule: 1985-1995 North American Tour Grosses."<br> http://www.accessplace.com/gdtc/1197.htm }~
+The analogy to the Grateful Dead is apt. Often, when describing the business opportunities inherent within the free software model, Stallman has held up the Grateful Dead as an example. In refusing to restrict fans' ability to record live concerts, the Grateful Dead became more than a rock group. They became the center of a tribal community dedicated to Grateful Dead music. Over time, that tribal community became so large and so devoted that the band shunned record contracts and supported itself solely through musical tours and live appearances. In 1994, the band's last year as a touring act, the Grateful Dead drew $52 million in gate receipts alone.~{ See "Grateful Dead Time Capsule: 1985-1995 North American Tour Grosses." \\ http://www.accessplace.com/gdtc/1197.htm }~
-While few software companies have been able to match that success, the tribal aspect of the free software community is one reason many in the latter half of the 1990s started to accept the notion that publishing software source code might be a good thing. Hoping to build their own loyal followings, companies such as IBM, Sun Microsystems, and Hewlett Packard have come to accept the letter, if not the spirit, of the Stallman free software message. Describing the GPL as the information-technology industry's "Magna Carta," ZDNet software columnist Evan Leibovitch sees the growing affection for all things GNU as more than just a trend. "This societal shift is letting users take back control of their futures," Leibovitch writes. "Just as the Magna Carta gave rights to British subjects, the GPL enforces consumer rights and freedoms on behalf of the users of computer software."~{ See Evan Leibovitch, "Who's Afraid of Big Bad Wolves," ZDNet Tech Update (December 15, 2000).<br> http://techupdate.zdnet.com/techupdate/stories/main/0,14179,2664992,00.html }~
+While few software companies have been able to match that success, the tribal aspect of the free software community is one reason many in the latter half of the 1990s started to accept the notion that publishing software source code might be a good thing. Hoping to build their own loyal followings, companies such as IBM, Sun Microsystems, and Hewlett Packard have come to accept the letter, if not the spirit, of the Stallman free software message. Describing the GPL as the information-technology industry's "Magna Carta," ZDNet software columnist Evan Leibovitch sees the growing affection for all things GNU as more than just a trend. "This societal shift is letting users take back control of their futures," Leibovitch writes. "Just as the Magna Carta gave rights to British subjects, the GPL enforces consumer rights and freedoms on behalf of the users of computer software."~{ See Evan Leibovitch, "Who's Afraid of Big Bad Wolves," ZDNet Tech Update (December 15, 2000). \\ http://techupdate.zdnet.com/techupdate/stories/main/0,14179,2664992,00.html }~
={Hewlett Packard;IBM;Sun Microsystems}
The tribal aspect of the free software community also helps explain why 40-odd programmers, who might otherwise be working on physics projects or surfing the Web for windsurfing buoy reports, have packed into a conference room to hear Stallman speak.
@@ -1266,7 +1268,7 @@ Unlike the New York speech, Stallman gets no introduction. He also offers no sel
Once again, Stallman quickly segues into the parable of the Xerox laser printer, taking a moment to deliver the same dramatic finger-pointing gestures to the crowd. He also devotes a minute or two to the GNU/Linux name.
-"Some people say to me, `Why make such a fuss about getting credit for this system? After all, the important thing is the job is done, not whether you get recognition for it.' Well, this would be wise advice if it were true. But the job wasn't to build an operating system; the job is to spread freedom to the users of computers. And to do that we have to make it possible to do everything with computers in freedom."~{ For narrative purposes, I have hesitated to go in-depth when describing Stallman's full definition of software "freedom." The GNU Project web site lists four fundamental components:<br>The freedom to run a program, for any purpose (freedom 0).<br>The freedom to study how a program works, and adapt it to your needs (freedom 1).<br>The freedom to redistribute copies of a program so you can help your neighbor (freedom 2).<br>The freedom to improve the program, and release your improvements to the public, so that the whole community benefits (freedom 3).<br>For more information, please visit "The Free Software Definition" at http://www.gnu.org/philosophy/free-sw.html }~
+"Some people say to me, `Why make such a fuss about getting credit for this system? After all, the important thing is the job is done, not whether you get recognition for it.' Well, this would be wise advice if it were true. But the job wasn't to build an operating system; the job is to spread freedom to the users of computers. And to do that we have to make it possible to do everything with computers in freedom."~{ For narrative purposes, I have hesitated to go in-depth when describing Stallman's full definition of software "freedom." The GNU Project web site lists four fundamental components: \\ The freedom to run a program, for any purpose (freedom 0). \\ The freedom to study how a program works, and adapt it to your needs (freedom 1). \\ The freedom to redistribute copies of a program so you can help your neighbor (freedom 2). \\ The freedom to improve the program, and release your improvements to the public, so that the whole community benefits (freedom 3). \\ For more information, please visit "The Free Software Definition" at http://www.gnu.org/philosophy/free-sw.html }~
Adds Stallman, "There's a lot more work to do."
@@ -1320,7 +1322,7 @@ The skit is a lighthearted moment of self-pardoy, a humorous return-jab at the m
Discussing the St. Ignucius persona afterward, Stallman says he first came up with it in 1996, long after the creation of Emacs but well before the emergence of the "open source" term and the struggle for hacker-community leadership that precipitated it. At the time, Stallman says, he wanted a way to "poke fun at himself," to remind listeners that, though stubborn, Stallman was not the fanatic some made him out to be. It was only later, Stallman adds, that others seized the persona as a convenient way to play up his reputation as software ideologue, as Eric Raymond did in an 1999 interview with the linux.com web site:
={linux.com;Raymond, Eric:St. Ignucius and+2}
-_1 When I say RMS calibrates what he does, I'm not belittling or accusing him of insincerity. I'm saying that like all good communicators he's got a theatrical streak. Sometimes it's conscious-have you ever seen him in his St. Ignucius drag, blessing software with a disk platter on his head? Mostly it's unconscious; he's just learned the degree of irritating stimulus that works, that holds attention without (usually) freaking people out.~{ See "Guest Interview: Eric S. Raymond," Linux.com (May 18, 1999).<br> http://www.linux.com/interviews/19990518/8/ }~
+_1 When I say RMS calibrates what he does, I'm not belittling or accusing him of insincerity. I'm saying that like all good communicators he's got a theatrical streak. Sometimes it's conscious-have you ever seen him in his St. Ignucius drag, blessing software with a disk platter on his head? Mostly it's unconscious; he's just learned the degree of irritating stimulus that works, that holds attention without (usually) freaking people out.~{ See "Guest Interview: Eric S. Raymond," Linux.com (May 18, 1999). \\ http://www.linux.com/interviews/19990518/8/ }~
Stallman takes issue with the Raymond analysis. "It's simply my way of making fun of myself," he says. "The fact that others see it as anything more than that is a reflection of their agenda, not mine."
@@ -1370,7 +1372,7 @@ By the spring of 1985, Richard Stallman had settled on the GNU Project's first m
The dispute with UniPress had highlighted a flaw in the Emacs Commune social contract. Where users relied on Stallman's expert insight, the Commune's rules held. In areas where Stallman no longer held the position of alpha hacker-pre-1984 Unix systems, for example-individuals and companies were free to make their own rules.
={UniPress software company}
-The tension between the freedom to modify and the freedom to exert authorial privilege had been building before GOSMACS. The Copyright Act of 1976 had overhauled U.S. copyright law, extending the legal protection of copyright to software programs. According to Section 102(b) of the Act, individuals and companies now possessed the ability to copyright the "expression" of a software program but not the "actual processes or methods embodied in the program."~{ See Hal Abelson, Mike Fischer, and Joanne Costello, "Software and Copyright Law," updated version (1998).<br> http://www.swiss.ai.mit.edu/6805/articles/int-prop/software-copyright.html }~ Translated, programmers and companies had the ability to treat software programs like a story or song. Other programmers could take inspiration from the work, but to make a direct copy or nonsatirical derivative, they first had to secure permission from the original creator. Although the new law guaranteed that even programs without copyright notices carried copyright protection, programmers quickly asserted their rights, attaching coypright notices to their software programs.
+The tension between the freedom to modify and the freedom to exert authorial privilege had been building before GOSMACS. The Copyright Act of 1976 had overhauled U.S. copyright law, extending the legal protection of copyright to software programs. According to Section 102(b) of the Act, individuals and companies now possessed the ability to copyright the "expression" of a software program but not the "actual processes or methods embodied in the program."~{ See Hal Abelson, Mike Fischer, and Joanne Costello, "Software and Copyright Law," updated version (1998). \\ http://www.swiss.ai.mit.edu/6805/articles/int-prop/software-copyright.html }~ Translated, programmers and companies had the ability to treat software programs like a story or song. Other programmers could take inspiration from the work, but to make a direct copy or nonsatirical derivative, they first had to secure permission from the original creator. Although the new law guaranteed that even programs without copyright notices carried copyright protection, programmers quickly asserted their rights, attaching coypright notices to their software programs.
={Copyright Act of 1976;copyright laws;GOSMACS (Gosling Emacs);software:copyright laws on}
At first, Stallman viewed these notices with alarm. Rare was the software program that didn't borrow source code from past programs, and yet, with a single stroke of the president's pen, Congress had given programmers and companies the power to assert individual authorship over communally built programs. It also injected a dose of formality into what had otherwise been an informal system. Even if hackers could demonstrate how a given program's source-code bloodlines stretched back years, if not decades, the resources and money that went into battling each copyright notice were beyond most hackers' means. Simply put, disputes that had once been settled hacker-to-hacker were now settled lawyer-to-lawyer. In such a system, companies, not hackers, held the automatic advantage.
@@ -1402,9 +1404,8 @@ As an example of this informality, Gilmore cites a copyright notice for trn, a U
% previous markup as 'poem' with footnote not satisfactory
-Copyright (c) 1985, Larry Wall<br>
-You may copy the trn kit in whole or in part as long as you don't try
-to make money off it, or pretend that you wrote it.~{ See Trn Kit README.<br> http://www.za.debian.org/doc/trn/trn-readme }~
+Copyright (c) 1985, Larry Wall \\
+You may copy the trn kit in whole or in part as long as you don't try to make money off it, or pretend that you wrote it.~{ See Trn Kit README. \\ http://www.za.debian.org/doc/trn/trn-readme }~
Such statements, while reflective of the hacker ethic, also reflected the difficulty of translating the loose, informal nature of that ethic into the rigid, legal language of copyright. In writing the GNU Emacs License, Stallman had done more than close up the escape hatch that permitted proprietary offshoots. He had expressed the hacker ethic in a manner understandable to both lawyer and hacker alike.
@@ -1430,7 +1431,7 @@ anyone to deny you these rights or to ask you to surrender the
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the software, or if you modify it.
-}poem ~{ See Richard Stallman, et al., "GNU General Public License: Version 1," (February, 1989).<br> http://www.gnu.org/copyleft/copying-1.0.html }~
+}poem ~{ See Richard Stallman, et al., "GNU General Public License: Version 1," (February, 1989). \\ http://www.gnu.org/copyleft/copying-1.0.html }~
In fashioning the GPL, Stallman had been forced to make an additional adjustment to the informal tenets of the old Emacs Commune. Where he had once demanded that Commune members publish any and all changes, Stallman now demanded publication only in instances when programmers circulated their derivative versions in the same public manner as Stallman. In other words, programmers who simply modified Emacs for private use no longer needed to send the source-code changes back to Stallman. In what would become a rare compromise of free software doctrine, Stallman slashed the price tag for free software. Users could innovate without Stallman looking over their shoulders just so long as they didn't bar Stallman and the rest of the hacker community from future exchanges of the same program.
={Emacs Commune+1}
@@ -1445,7 +1446,7 @@ As hacks go, the GPL stands as one of Stallman's best. It created a system of co
"The GPL developed much like any piece of free software with a large community discussing its structure, its respect or the opposite in their observation, needs for tweaking and even to compromise it mildly for greater acceptance," says Jerry Cohen, another attorney who helped Stallman with the creation of the license. "The process worked very well and GPL in its several versions has gone from widespread skeptical and at times hostile response to widespread acceptance."
-In a 1986 interview with Byte magazine, Stallman summed up the GPL in colorful terms. In addition to proclaiming hacker values, Stallman said, readers should also "see it as a form of intellectual jujitsu, using the legal system that software hoarders have set up against them."~{ See David Betz and Jon Edwards, "Richard Stallman discusses his public-domain [sic] Unix-compatible software system with BYTE editors," BYTE (July, 1996). (Reprinted on the GNU Project web site: http://www.gnu.org/gnu/byte-interview.html )<br>This interview offers an interesting, not to mention candid, glimpse at Stallman's political attitudes during the earliest days of the GNU Project. It is also helpful in tracing the evolution of Stallman's rhetoric.<br>Describing the purpose of the GPL, Stallman says, "I'm trying to change the way people approach knowledge and information in general. I think that to try to own knowledge, to try to control whether people are allowed to use it, or to try to stop other people from sharing it, is sabotage."<br>Contrast this with a statement to the author in August 2000: "I urge you not to use the term `intellectual property' in your thinking. It will lead you to misunderstand things, because that term generalizes about copyrights, patents, and trademarks. And those things are so different in their effects that it is entirely foolish to try to talk about them at once. If you hear somebody saying something about intellectual property, without quotes, then he's not thinking very clearly and you shouldn't join." }~ Years later, Stallman would describe the GPL's creation in less hostile terms. "I was thinking about issues that were in a sense ethical and in a sense political and in a sense legal," he says. "I had to try to do what could be sustained by the legal system that we're in. In spirit the job was that of legislating the basis for a new society, but since I wasn't a government, I couldn't actually change any laws. I had to try to do this by building on top of the existing legal system, which had not been designed for anything like this."
+In a 1986 interview with Byte magazine, Stallman summed up the GPL in colorful terms. In addition to proclaiming hacker values, Stallman said, readers should also "see it as a form of intellectual jujitsu, using the legal system that software hoarders have set up against them."~{ See David Betz and Jon Edwards, "Richard Stallman discusses his public-domain [sic] Unix-compatible software system with BYTE editors," BYTE (July, 1996). (Reprinted on the GNU Project web site: http://www.gnu.org/gnu/byte-interview.html ) \\ This interview offers an interesting, not to mention candid, glimpse at Stallman's political attitudes during the earliest days of the GNU Project. It is also helpful in tracing the evolution of Stallman's rhetoric. \\ Describing the purpose of the GPL, Stallman says, "I'm trying to change the way people approach knowledge and information in general. I think that to try to own knowledge, to try to control whether people are allowed to use it, or to try to stop other people from sharing it, is sabotage." \\ Contrast this with a statement to the author in August 2000: "I urge you not to use the term `intellectual property' in your thinking. It will lead you to misunderstand things, because that term generalizes about copyrights, patents, and trademarks. And those things are so different in their effects that it is entirely foolish to try to talk about them at once. If you hear somebody saying something about intellectual property, without quotes, then he's not thinking very clearly and you shouldn't join." }~ Years later, Stallman would describe the GPL's creation in less hostile terms. "I was thinking about issues that were in a sense ethical and in a sense political and in a sense legal," he says. "I had to try to do what could be sustained by the legal system that we're in. In spirit the job was that of legislating the basis for a new society, but since I wasn't a government, I couldn't actually change any laws. I had to try to do this by building on top of the existing legal system, which had not been designed for anything like this."
={Byte magazine}
About the time Stallman was pondering the ethical, political, and legal issues associated with free software, a California hacker named Don Hopkins mailed him a manual for the 68000 microprocessor. Hopkins, a Unix hacker and fellow science-fiction buff, had borrowed the manual from Stallman a while earlier. As a display of gratitude, Hopkins decorated the return envelope with a number of stickers obtained at a local science-fiction convention. One sticker in particular caught Stallman's eye. It read, "Copyleft (L), All Rights Reversed." Following the release of the first version of GPL, Stallman paid tribute to the sticker, nicknaming the free software license "Copyleft." Over time, the nickname and its shorthand symbol, a backwards "C," would become an official Free Software Foundation synonym for the GPL.
@@ -1469,7 +1470,7 @@ Hired in 1986, Bostic had taken on the personal project of porting BSD over to t
% CSRG abbreviated to SRG above?
-The arguments eventually took hold, although not in the way Stallman would have liked. In June, 1989, Berkeley separated its networking code from the rest of the AT&T-owned operating system and distributed it under a University of California license. The contract terms were liberal. All a licensee had to do was give credit to the university in advertisements touting derivative programs.~{ The University of California's "obnoxious advertising clause" would later prove to be a problem. Looking for a less restrictive alternative to the GPL, some hackers used the University of California, replacing "University of California" with the name of their own instution. The result: free software programs that borrowed from dozens of other programs would have to cite dozens of institutions in advertisements. In 1999, after a decade of lobbying on Stallman's part, the University of California agreed to drop this clause.<br>See "The BSD License Problem" at http://www.gnu.org/philosophy/bsd.html. }~ In contrast to the GPL, proprietary offshoots were permissible. Only one problem hampered the license's rapid adoption: the BSD Networking release wasn't a complete operating system. People could study the code, but it could only be run in conjunction with other proprietary-licensed code.
+The arguments eventually took hold, although not in the way Stallman would have liked. In June, 1989, Berkeley separated its networking code from the rest of the AT&T-owned operating system and distributed it under a University of California license. The contract terms were liberal. All a licensee had to do was give credit to the university in advertisements touting derivative programs.~{ The University of California's "obnoxious advertising clause" would later prove to be a problem. Looking for a less restrictive alternative to the GPL, some hackers used the University of California, replacing "University of California" with the name of their own instution. The result: free software programs that borrowed from dozens of other programs would have to cite dozens of institutions in advertisements. In 1999, after a decade of lobbying on Stallman's part, the University of California agreed to drop this clause. \\ See "The BSD License Problem" at http://www.gnu.org/philosophy/bsd.html. }~ In contrast to the GPL, proprietary offshoots were permissible. Only one problem hampered the license's rapid adoption: the BSD Networking release wasn't a complete operating system. People could study the code, but it could only be run in conjunction with other proprietary-licensed code.
={AT&T+1}
Over the next few years, Bostic and other University of California employees worked to replace the missing components and turn BSD into a complete, freely redistributable operating system. Although delayed by a legal challenge from Unix Systems Laboratories-the AT&T spin-off that retained ownership of the Unix brand name-the effort would finally bear fruit in the early 1990s. Even before then, however, many of the Berkeley utilities would make their way into Stallman's GNU Project.
@@ -1538,14 +1539,14 @@ Jeremy Allison, a Sun user during the late 1980s and programmer destined to run
Stallman's growing stature as a software programmer, however, was balanced by his struggles as a project manager. Although the GNU Project moved from success to success in creation of developer-oriented tools, its inability to generate a working kernel-the central "traffic cop" program in all Unix systems that determines which devices and applications get access to the microprocessor and when-was starting to elicit grumbles as the 1980s came to a close. As with most GNU Project efforts, Stallman had started kernel development by looking for an existing program to modify. According to a January 1987 "Gnusletter," Stallman was already working to overhaul TRIX, a Unix kernel developed at MIT.
-A review of GNU Project "GNUsletters" of the late 1980s reflects the management tension. In January, 1987, Stallman announced to the world that the GNU Project was working to overhaul TRIX, a Unix kernel developed at MIT. A year later, in February of 1988, the GNU Project announced that it had shifted its attentions to Mach, a lightweight "micro-kernel" developed at Carnegie Mellon. All told, however, official GNU Project kernel development wouldn't commence until 1990.~{ See "HURD History."<br> http://www.gnu.org/software/hurd/history.html }~
+A review of GNU Project "GNUsletters" of the late 1980s reflects the management tension. In January, 1987, Stallman announced to the world that the GNU Project was working to overhaul TRIX, a Unix kernel developed at MIT. A year later, in February of 1988, the GNU Project announced that it had shifted its attentions to Mach, a lightweight "micro-kernel" developed at Carnegie Mellon. All told, however, official GNU Project kernel development wouldn't commence until 1990.~{ See "HURD History." \\ http://www.gnu.org/software/hurd/history.html }~
% ={Carnegie Mellon University}
The delays in kernel development were just one of many concerns weighing on Stallman during this period. In 1989, Lotus Development Corporation filed suit against rival software company, Paperback Software International, for copying menu commands in Lotus' popular 1-2-3 Spreadsheet program. Lotus' suit, coupled with the Apple-Microsoft "look and feel" battle, provided a troublesome backdrop for the GNU Project. Although both suits fell outside the scope of the GNU Project, both revolved around operating systems and software applications developed for the personal computer, not Unix-compatible hardware systems-they threatened to impose a chilling effect on the entire culture of software development. Determined to do something, Stallman recruited a few programmer friends and composed a magazine ad blasting the lawsuits. He then followed up the ad by helping to organize a group to protest the corporations filing the suit. Calling itself the League of Programming Freedom, the group held protests outside the offices of Lotus, Inc. and the Boston courtroom hosting the Lotus trial.
={Apple Computers;Lotus Development Corp.;Microsoft Corporation:Apple Computer lawsuit;Paperback Software International}
-The protests were notable.~{ According to a League of Programming Freedom Press, the protests were notable for featuring the first hexadecimal protest chant:<br>1-2-3-4, toss the lawyers out the door;<br>5-6-7-8, innovate don't litigate;<br>9-A-B-C, 1-2-3 is not for me;<br>D-E-F-O, look and feel have got to go<br> http://lpf.ai.mit.edu/Links/prep.ai.mit.edu/demo.final.release }~ They document the evolving nature of software industry. Applications had quietly replaced operating systems as the primary corporate battleground. In its unfulfilled quest to build a free software operating system, the GNU Project seemed hopelessly behind the times. Indeed, the very fact that Stallman had felt it necessary to put together an entirely new group dedicated to battling the "look and feel" lawsuits reinforced that obsolescence in the eyes of some observers.
+The protests were notable.~{ According to a League of Programming Freedom Press, the protests were notable for featuring the first hexadecimal protest chant: \\ 1-2-3-4, toss the lawyers out the door; \\ 5-6-7-8, innovate don't litigate; \\ 9-A-B-C, 1-2-3 is not for me; \\ D-E-F-O, look and feel have got to go \\ http://lpf.ai.mit.edu/Links/prep.ai.mit.edu/demo.final.release }~ They document the evolving nature of software industry. Applications had quietly replaced operating systems as the primary corporate battleground. In its unfulfilled quest to build a free software operating system, the GNU Project seemed hopelessly behind the times. Indeed, the very fact that Stallman had felt it necessary to put together an entirely new group dedicated to battling the "look and feel" lawsuits reinforced that obsolescence in the eyes of some observers.
In 1990, the John D. and Catherine T. MacArthur Foundation cerified Stallman's genius status when it granted Stallman a MacArthur fellowship, therefore making him a recipient for the organization's so-called "genius grant." The grant, a $240,000 reward for launching the GNU Project and giving voice to the free software philosophy, relieved a number of short-term concerns. First and foremost, it gave Stallman, a nonsalaried employee of the FSF who had been supporting himself through consulting contracts, the ability to devote more time to writing GNU code.~{ I use the term "writing" here loosely. About the time of the MacArthur award, Stallman began suffering chronic pain in his hands and was dictating his work to FSF-employed typists. Although some have speculated that the hand pain was the result of repetitive stress injury, or RSI, an injury common among software programmers, Stallman is not 100% sure. "It was NOT carpal tunnel syndrome," he writes. "My hand problem was in the hands themselves, not in the wrists." Stallman has since learned to work without typists after switching to a keyboard with a lighter touch. }~
@@ -1582,7 +1583,7 @@ things people like/dislike in minix, as my OS resembles it somewhat
(same physical layout of the file-system (due to practical reasons)
among other things).
-}poem~{ See "Linux 10th Anniversary."<br> http://www.linux10.org/history/ }~
+}poem~{ See "Linux 10th Anniversary." \\ http://www.linux10.org/history/ }~
The posting drew a smattering of responses and within a month, Torvalds had posted a 0.01 version of the operating system-i.e., the earliest possible version fit for outside review-on an Internet FTP site. In the course of doing so, Torvalds had to come up with a name for the new system. On his own PC hard drive, Torvalds had saved the program as Linux, a name that paid its respects to the software convention of giving each Unix variant a name that ended with the letter X. Deeming the name too "egotistical," Torvalds changed it to Freax, only to have the FTP site manager change it back.
={Freax}
@@ -1596,7 +1597,7 @@ _1 You put six months of your life into this thing and you want to make it avail
When it was time to release the 0.12 version of Linux, the first to include a fully integrated version of GCC, Torvalds decided to voice his allegiance with the free software movement. He discarded the old kernel license and replaced it with the GPL. The decision triggered a porting spree, as Torvalds and his collaborators looked to other GNU programs to fold into the growing Linux stew. Within three years, Linux developers were offering their first production release, Linux 1.0, including fully modified versions of GCC, GDB, and a host of BSD tools.
-By 1994, the amalgamated operating system had earned enough respect in the hacker world to make some observers wonder if Torvalds hadn't given away the farm by switching to the GPL in the project's initial months. In the first issue of Linux Journal, publisher Robert Young sat down with Torvalds for an interview. When Young asked the Finnish programmer if he felt regret at giving up private ownership of the Linux source code, Torvalds said no. "Even with 20/20 hindsight," Torvalds said, he considered the GPL "one of the very best design decisions" made during the early stages of the Linux project.~{ See Robert Young, "Interview with Linus, the Author of Linux," Linux Journal (March 1, 1994).<br> http://www.linuxjournal.com/article.php?sid=2736 }~
+By 1994, the amalgamated operating system had earned enough respect in the hacker world to make some observers wonder if Torvalds hadn't given away the farm by switching to the GPL in the project's initial months. In the first issue of Linux Journal, publisher Robert Young sat down with Torvalds for an interview. When Young asked the Finnish programmer if he felt regret at giving up private ownership of the Linux source code, Torvalds said no. "Even with 20/20 hindsight," Torvalds said, he considered the GPL "one of the very best design decisions" made during the early stages of the Linux project.~{ See Robert Young, "Interview with Linus, the Author of Linux," Linux Journal (March 1, 1994). \\ http://www.linuxjournal.com/article.php?sid=2736 }~
={Young, Robert}
% robert young entry added
@@ -1628,7 +1629,7 @@ Or were they? To the pessimistically inclined, each sign of acceptance carried i
% Intel index ref added
-Finally, there was the curious nature of Linux itself. Unrestricted by design bugs (like GNU) and legal disputes (like BSD), Linux' high-speed evolution had been so unplanned, its success so accidental, that programmers closest to the software code itself didn't know what to make of it. More compilation album than operating system, it was comprised of a hacker medley of greatest hits: everything from GCC, GDB, and glibc (the GNU Project's newly developed C Library) to X (a Unix-based graphic user interface developed by MIT's Laboratory for Computer Science) to BSD-developed tools such as BIND (the Berkeley Internet Naming Daemon, which lets users substitute easy-to-remember Internet domain names for numeric IP addresses) and TCP/IP. The arch's capstone, of course, was the Linux kernel-itself a bored-out, super-charged version of Minix. Rather than building their operating system from scratch, Torvalds and his rapidly expanding Linux development team had followed the old Picasso adage, "good artists borrow; great artists steal." Or as Torvalds himself would later translate it when describing the secret of his success: "I'm basically a very lazy person who likes to take credit for things other people actually do."~{ Torvalds has offered this quote in many different settings. To date, however, the quote's most notable appearance is in the Eric Raymond essay, "The Cathedral and the Bazaar" (May, 1997).<br> http://www.tuxedo.org/~esr/writings/cathedral-bazaar/cathedral-bazaar/index.html }~
+Finally, there was the curious nature of Linux itself. Unrestricted by design bugs (like GNU) and legal disputes (like BSD), Linux' high-speed evolution had been so unplanned, its success so accidental, that programmers closest to the software code itself didn't know what to make of it. More compilation album than operating system, it was comprised of a hacker medley of greatest hits: everything from GCC, GDB, and glibc (the GNU Project's newly developed C Library) to X (a Unix-based graphic user interface developed by MIT's Laboratory for Computer Science) to BSD-developed tools such as BIND (the Berkeley Internet Naming Daemon, which lets users substitute easy-to-remember Internet domain names for numeric IP addresses) and TCP/IP. The arch's capstone, of course, was the Linux kernel-itself a bored-out, super-charged version of Minix. Rather than building their operating system from scratch, Torvalds and his rapidly expanding Linux development team had followed the old Picasso adage, "good artists borrow; great artists steal." Or as Torvalds himself would later translate it when describing the secret of his success: "I'm basically a very lazy person who likes to take credit for things other people actually do."~{ Torvalds has offered this quote in many different settings. To date, however, the quote's most notable appearance is in the Eric Raymond essay, "The Cathedral and the Bazaar" (May, 1997). \\ http://www.tuxedo.org/~esr/writings/cathedral-bazaar/cathedral-bazaar/index.html }~
={BIND (Berkely Internet Naming Daemon);Berkely Internet Naming Daemon (BIND);C programming language:glibc;GNU Debugger (GDB):Linux and;GDB (GNU Debugger): Linux and;glibc (GNU C Library);GNU C Library (glibc);kernel (Linux);X graphic user interface;Laboratory for Computer Science:X, developing;Minix operating system:kernel, used for Linux;TCP/IP;Torvalds, Linus:Minix, reworking for Linux+2}
Such laziness, while admirable from an efficiency perspective, was troubling from a political perspective. For one thing, it underlined the lack of an ideological agenda on Torvalds' part. Unlike the GNU developers, Torvalds hadn't built an operating system out of a desire to give his fellow hackers something to work with; he'd built it to have something he himself could play with. Like Tom Sawyer whitewashing a fence, Torvalds' genius lay less in the overall vision and more in his ability to recruit other hackers to speed the process.
@@ -1657,7 +1658,7 @@ The message represented a dramatic about-face on Stallman's part. Until 1993, St
The friend's report was correct. Built to run on 386-based machines, Linux was firmly rooted to its low-cost hardware platform. What the friend failed to report, however, was the sizable advantage Linux enjoyed as the only freely modifiable operating system in the marketplace. In other words, while Stallman spent the next three years listening to bug reports from his HURD team, Torvalds was winning over the programmers who would later uproot and replant the operating system onto new platforms.
-By 1993, the GNU Project's inability to deliver a working kernel was leading to problems both within the GNU Project and within the free software movement at large. A March, 1993, a Wired magazine article by Simson Garfinkel described the GNU Project as "bogged down" despite the success of the project's many tools.~{ See Simson Garfinkel, "Is Stallman Stalled?" Wired (March, 1993). }~ Those within the project and its nonprofit adjunct, the Free Software Foundation, remember the mood as being even worse than Garfinkel's article let on. "It was very clear, at least to me at the time, that there was a window of opportunity to introduce a new operating system," says Chassell. "And once that window was closed, people would become less interested. Which is in fact exactly what happened."~{ Chassel's concern about there being a 36-month "window" for a new operating system is not unique to the GNU Project. During the early 1990s, free software versions of the Berkeley Software Distribution were held up by Unix System Laboratories' lawsuit restricting the release of BSD-derived software. While many users consider BSD offshoots such as FreeBSD and OpenBSD to be demonstrably superior to GNU/Linux both in terms of performance and security, the number of FreeBSD and OpenBSD users remains a fraction of the total GNU/Linux user population.<br>To view a sample analysis of the relative success of GNU/Linux in relation to other free software operating systems, see the essay by New Zealand hacker, Liam Greenwood, "Why is Linux Successful" (1999). }~
+By 1993, the GNU Project's inability to deliver a working kernel was leading to problems both within the GNU Project and within the free software movement at large. A March, 1993, a Wired magazine article by Simson Garfinkel described the GNU Project as "bogged down" despite the success of the project's many tools.~{ See Simson Garfinkel, "Is Stallman Stalled?" Wired (March, 1993). }~ Those within the project and its nonprofit adjunct, the Free Software Foundation, remember the mood as being even worse than Garfinkel's article let on. "It was very clear, at least to me at the time, that there was a window of opportunity to introduce a new operating system," says Chassell. "And once that window was closed, people would become less interested. Which is in fact exactly what happened."~{ Chassel's concern about there being a 36-month "window" for a new operating system is not unique to the GNU Project. During the early 1990s, free software versions of the Berkeley Software Distribution were held up by Unix System Laboratories' lawsuit restricting the release of BSD-derived software. While many users consider BSD offshoots such as FreeBSD and OpenBSD to be demonstrably superior to GNU/Linux both in terms of performance and security, the number of FreeBSD and OpenBSD users remains a fraction of the total GNU/Linux user population. \\ To view a sample analysis of the relative success of GNU/Linux in relation to other free software operating systems, see the essay by New Zealand hacker, Liam Greenwood, "Why is Linux Successful" (1999). }~
={Garfinkel, Simson;GNU Project:kernel;Wired magazine:GNU Project and}
% ={Chassell, Robert}
@@ -1673,7 +1674,7 @@ Stallman cites a number of issues when explaining the delay. The Lotus and Apple
"I figured, OK, the [Mach] part that has to talk to the machine has already been debugged," Stallman says, recalling the HURD team's troubles in a 2000 speech. "With that head start, we should be able to get it done faster. But instead, it turned out that debugging these asynchronous multithreaded programs was really hard. There were timing books that would clobber the files, and that's no fun. The end result was that it took many, many years to produce a test version."~{ See Maui High Performance Computing Center Speech. }~
-Whatever the excuse, or excuses, the concurrent success of the Linux-kernel team created a tense situation. Sure, the Linux kernel had been licensed under the GPL, but as Murdock himself had noted, the desire to treat Linux as a purely free software operating system was far from uniform. By late 1993, the total Linux user population had grown from a dozen or so Minix enthusiasts to somewhere between 20,000 and 100,000.~{ GNU/Linux user-population numbers are sketchy at best, which is why I've provided such a broad range. The 100,000 total comes from the Red Hat "Milestones" site,<br> http://www.redhat.com/about/corporate/milestones.html }~ What had once been a hobby was now a marketplace ripe for exploitation. Like Winston Churchill watching Soviet troops sweep into Berlin, Stallman felt an understandable set of mixed emotions when it came time to celebrate the Linux "victory."~{ I wrote this Winston Churchill analogy before Stallman himself sent me his own unsolicited comment on Churchill:<br>_1 World War II and the determination needed to win it was a very strong memory as I was growing up. Statements such as Churchill's, "We will fight them in the landing zones, we will fight them on the beaches . . . we will never surrender," have always resonated for me. }~
+Whatever the excuse, or excuses, the concurrent success of the Linux-kernel team created a tense situation. Sure, the Linux kernel had been licensed under the GPL, but as Murdock himself had noted, the desire to treat Linux as a purely free software operating system was far from uniform. By late 1993, the total Linux user population had grown from a dozen or so Minix enthusiasts to somewhere between 20,000 and 100,000.~{ GNU/Linux user-population numbers are sketchy at best, which is why I've provided such a broad range. The 100,000 total comes from the Red Hat "Milestones" site, \\ http://www.redhat.com/about/corporate/milestones.html }~ What had once been a hobby was now a marketplace ripe for exploitation. Like Winston Churchill watching Soviet troops sweep into Berlin, Stallman felt an understandable set of mixed emotions when it came time to celebrate the Linux "victory."~{ I wrote this Winston Churchill analogy before Stallman himself sent me his own unsolicited comment on Churchill: \\ _1 World War II and the determination needed to win it was a very strong memory as I was growing up. Statements such as Churchill's, "We will fight them in the landing zones, we will fight them on the beaches . . . we will never surrender," have always resonated for me. }~
Although late to the party, Stallman still had clout. As soon as the FSF announced that it would lend its money and moral support to Murdock's software project, other offers of support began rolling in. Murdock dubbed the new project Debian-a compression of his and his wife, Deborah's, names-and within a few weeks was rolling out the first distribution. "[Richard's support] catapulted Debian almost overnight from this interesting little project to something people within the community had to pay attention to," Murdock says.
={Debian+19}
@@ -1685,7 +1686,7 @@ In January of 1994, Murdock issued the " Debian Manifesto." Written in the spiri
_1 The Free Software Foundation plays an extremely important role in the future of Debian. By the simple fact that they will be distributing it, a message is sent to the world that Linux is not a commercial product and that it never should be, but that this does not mean that Linux will never be able to compete commercially. For those of you who disagree, I challenge you to rationalize the success of GNU Emacs and GCC, which are not commercial software but which have had quite an impact on the commercial market regardless of that fact.
-_1 The time has come to concentrate on the future of Linux rather than on the destructive goal of enriching oneself at the expense of the entire Linux community and its future. The development and distribution of Debian may not be the answer to the problems that I have outlined in the Manifesto, but I hope that it will at least attract enough attention to these problems to allow them to be solved.~{ See Ian Murdock, "A Brief History of Debian," (January 6, 1994): Appendix A, "The Debian Manifesto."<br> http://www.debian.org/doc/manuals/project-history/apA.html }~
+_1 The time has come to concentrate on the future of Linux rather than on the destructive goal of enriching oneself at the expense of the entire Linux community and its future. The development and distribution of Debian may not be the answer to the problems that I have outlined in the Manifesto, but I hope that it will at least attract enough attention to these problems to allow them to be solved.~{ See Ian Murdock, "A Brief History of Debian," (January 6, 1994): Appendix A, "The Debian Manifesto." \\ http://www.debian.org/doc/manuals/project-history/apA.html }~
Shortly after the Manifesto's release, the Free Software Foundation made its first major request. Stallman wanted Murdock to call its distribution "GNU/Linux." At first, Murdock says, Stallman had wanted to use the term " Lignux"-"as in Linux with GNU at the heart of it"-but a sample testing of the term on Usenet and in various impromptu hacker focus groups had merited enough catcalls to convince Stallman to go with the less awkward GNU/Linux.
={Lignux (Linux with GNU)}
@@ -1698,7 +1699,7 @@ The deepest split, Murdock says, was over glibc. Short for GNU C Library, glibc
In the hacker world, forks are an interesting phenomenon. Although the hacker ethic permits a programmer to do anything he wants with a given program's source code, most hackers prefer to pour their innovations into a central source-code file or "tree" to ensure compatibility with other people's programs. To fork glibc this early in the development of Linux would have meant losing the potential input of hundreds, even thousands, of Linux developers. It would also mean growing incompatibility between Linux and the GNU system that Stallman and the GNU team still hoped to develop.
={forks (code)+3;tree (source code)}
-As leader of the GNU Project, Stallman had already experienced the negative effects of a software fork in 1991. A group of Emacs developers working for a software company named Lucid had a falling out over Stallman's unwillingness to fold changes back into the GNU Emacs code base. The fork had given birth to a parallel version, Lucid Emacs, and hard feelings all around.~{ Jamie Zawinski, a former Lucid programmer who would go on to head the Mozilla development team, has a web site that documents the Lucid/GNU Emacs fork, titled, "The Lemacs/FSFmacs Schism."<br> http://www.jwz.org/doc/lemacs.html }~
+As leader of the GNU Project, Stallman had already experienced the negative effects of a software fork in 1991. A group of Emacs developers working for a software company named Lucid had a falling out over Stallman's unwillingness to fold changes back into the GNU Emacs code base. The fork had given birth to a parallel version, Lucid Emacs, and hard feelings all around.~{ Jamie Zawinski, a former Lucid programmer who would go on to head the Mozilla development team, has a web site that documents the Lucid/GNU Emacs fork, titled, "The Lemacs/FSFmacs Schism." \\ http://www.jwz.org/doc/lemacs.html }~
={Emacs text editor:Lucid software company and;GNU Emacs:Lucid software company and;Lucid software company}
Murdock says Debian was mounting work on a similar fork in glibc source code that motivated Stallman to insist on adding the GNU prefix when Debian rolled out its software distribution. "The fork has since converged. Still, at the time, there was a concern that if the Linux community saw itself as a different thing as the GNU community, it might be a force for disunity."
@@ -1749,7 +1750,7 @@ Ready or not.
In November , 1995, Peter Salus, a member of the Free Software Foundation and author of the 1994 book, A Quarter Century of Unix, issued a call for papers to members of the GNU Project's "system-discuss" mailing list. Salus, the conference's scheduled chairman, wanted to tip off fellow hackers about the upcoming Conference on Freely Redistributable Software in Cambridge, Massachusetts. Slated for February, 1996 and sponsored by the Free Software Foundation, the event promised to be the first engineering conference solely dedicated to free software and, in a show of unity with other free software programmers, welcomed papers on "any aspect of GNU, Linux, NetBSD, 386BSD, FreeBSD, Perl, Tcl/tk, and other tools for which the code is accessible and redistributable." Salus wrote:
={Free Software Foundation (FSF);FSF (Free Software Foundation);FreeBSD;Conference on Freely Redistributable Software+1;Linux;NetBSD;Perl programming language;386BSD;Salus, Peter+4}
-_1 Over the past 15 years, free and low-cost software has become ubiquitous. This conference will bring together implementers of several different types of freely redistributable software and publishers of such software (on various media). There will be tutorials and refereed papers, as well as keynotes by Linus Torvalds and Richard Stallman.~{ See Peter Salus, "FYI-Conference on Freely Redistributable Software, 2/2, Cambridge" (1995) (archived by Terry Winograd).<br> http://hci.stanford.edu/pcd-archives/pcd-fyi/1995/0078.html }~
+_1 Over the past 15 years, free and low-cost software has become ubiquitous. This conference will bring together implementers of several different types of freely redistributable software and publishers of such software (on various media). There will be tutorials and refereed papers, as well as keynotes by Linus Torvalds and Richard Stallman.~{ See Peter Salus, "FYI-Conference on Freely Redistributable Software, 2/2, Cambridge" (1995) (archived by Terry Winograd). \\ http://hci.stanford.edu/pcd-archives/pcd-fyi/1995/0078.html }~
One of the first people to receive Salus' email was conference committee member Eric S. Raymond. Although not the leader of a project or company like the various other members of the list, Raymond had built a tidy reputation within the hacker community as a major contributor to GNU Emacs and as editor of /{The New Hacker Dictionary}/, a book version of the hacking community's decade-old Jargon File.
={New Hacker Dictionary, The;Raymond, Eric:open source and+56}
@@ -1758,7 +1759,7 @@ For Raymond, the 1996 conference was a welcome event. Active in the GNU Project
Despite the falling out, Raymond remained active in the free software community. So much so that when Salus suggested a conference pairing Stallman and Torvalds as keynote speakers, Raymond eagerly seconded the idea. With Stallman representing the older, wiser contingent of ITS/Unix hackers and Torvalds representing the younger, more energetic crop of Linux hackers, the pairing indicated a symbolic show of unity that could only be beneficial, especially to ambitious younger (i.e., below 40) hackers such as Raymond. "I sort of had a foot in both camps," Raymond says.
-By the time of the conference, the tension between those two camps had become palpable. Both groups had one thing in common, though: the conference was their first chance to meet the Finnish wunderkind in the flesh. Surprisingly, Torvalds proved himself to be a charming, affable speaker. Possessing only a slight Swedish accent, Torvalds surprised audience members with his quick, self-effacing wit.~{ Although Linus Torvalds is Finnish, his mother tongue is Swedish. "The Rampantly Unofficial Linus FAQ" offers a brief explanation:<br>_1 Finland has a significant (about 6%) Swedish-speaking minority population. They call themselves "finlandssvensk" or "finlandssvenskar" and consider themselves Finns; many of their families have lived in Finland for centuries. Swedish is one of Finland's two official languages.<br> http://tuxedo.org/~esr/faqs/linus/ }~ Even more surprising, says Raymond, was Torvalds' equal willingness to take potshots at other prominent hackers, including the most prominent hacker of all, Richard Stallman. By the end of the conference, Torvalds' half-hacker, half-slacker manner was winning over older and younger conference-goers alike.
+By the time of the conference, the tension between those two camps had become palpable. Both groups had one thing in common, though: the conference was their first chance to meet the Finnish wunderkind in the flesh. Surprisingly, Torvalds proved himself to be a charming, affable speaker. Possessing only a slight Swedish accent, Torvalds surprised audience members with his quick, self-effacing wit.~{ Although Linus Torvalds is Finnish, his mother tongue is Swedish. "The Rampantly Unofficial Linus FAQ" offers a brief explanation: \\ _1 Finland has a significant (about 6%) Swedish-speaking minority population. They call themselves "finlandssvensk" or "finlandssvenskar" and consider themselves Finns; many of their families have lived in Finland for centuries. Swedish is one of Finland's two official languages. \\ http://tuxedo.org/~esr/faqs/linus/ }~ Even more surprising, says Raymond, was Torvalds' equal willingness to take potshots at other prominent hackers, including the most prominent hacker of all, Richard Stallman. By the end of the conference, Torvalds' half-hacker, half-slacker manner was winning over older and younger conference-goers alike.
"It was a pivotal moment," recalls Raymond. "Before 1996, Richard was the only credible claimant to being the ideological leader of the entire culture. People who dissented didn't do so in public. The person who broke that taboo was Torvalds."
@@ -1776,7 +1777,7 @@ As a former GNU Project member, Raymond sensed an added dynamic to the tension b
For Raymond, the defection merely confirmed a growing suspicion: recent delays such as the HURD and recent troubles such as the Lucid-Emacs schism reflected problems normally associated with software project management, not software code development. Shortly after the Freely Redistributable Software Conference, Raymond began working on his own pet software project, a popmail utility called "fetchmail." Taking a cue from Torvalds, Raymond issued his program with a tacked-on promise to update the source code as early and as often as possible. When users began sending in bug reports and feature suggestions, Raymond, at first anticipating a tangled mess, found the resulting software surprisingly sturdy. Analyzing the success of the Torvalds approach, Raymond issued a quick analysis: using the Internet as his "petri dish" and the harsh scrutiny of the hacker community as a form of natural selection, Torvalds had created an evolutionary model free of central planning.
={fetchmail;FreeBSD;Conference on Freely Redistributable Software;Internet}
-What's more, Raymond decided, Torvalds had found a way around Brooks' Law. First articulated by Fred P. Brooks, manager of IBM's OS/360 project and author of the 1975 book, The Mythical Man-Month, Brooks' Law held that adding developers to a project only resulted in further project delays. Believing as most hackers that software, like soup, benefits from a limited number of cooks, Raymond sensed something revolutionary at work. In inviting more and more cooks into the kitchen, Torvalds had actually found away to make the resulting software better.~{ Brooks' Law is the shorthand summary of the following quote taken from Brooks' book:<br>_1 Since software construction is inherently a systems effort-an exercise in complex interrelationships-communication effort is great, and it quickly dominates the decrease in individual task time brought about by partitioning. Adding more men then lengthens, not shortens, the schedule.<br>See Fred P. Brooks, The Mythical Man-Month (Addison Wesley Publishing, 1995) }~
+What's more, Raymond decided, Torvalds had found a way around Brooks' Law. First articulated by Fred P. Brooks, manager of IBM's OS/360 project and author of the 1975 book, The Mythical Man-Month, Brooks' Law held that adding developers to a project only resulted in further project delays. Believing as most hackers that software, like soup, benefits from a limited number of cooks, Raymond sensed something revolutionary at work. In inviting more and more cooks into the kitchen, Torvalds had actually found away to make the resulting software better.~{ Brooks' Law is the shorthand summary of the following quote taken from Brooks' book: \\ _1 Since software construction is inherently a systems effort-an exercise in complex interrelationships-communication effort is great, and it quickly dominates the decrease in individual task time brought about by partitioning. Adding more men then lengthens, not shortens, the schedule. \\ See Fred P. Brooks, The Mythical Man-Month (Addison Wesley Publishing, 1995) }~
={Brooks, Fred P.;Mythical Man-Month, The (Brooks)}
Raymond put his observations on paper. He crafted them into a speech, which he promptly delivered before a group of friends and neighbors in Chester County, Pennsylvania. Dubbed " The Cathedral and the Bazaar," the speech contrasted the management styles of the GNU Project with the management style of Torvalds and the kernel hackers. Raymond says the response was enthusiastic, but not nearly as enthusiastic as the one he received during the 1997 Linux Kongress, a gathering of Linux users in Germany the next spring.
@@ -1814,7 +1815,7 @@ While in California, Raymond also managed to squeeze in a visit to VA Research,
Peterson, whose organization had taken an active interest in advancing the free software cause, offered an alternative: open source.
-Looking back, Peterson says she came up with the open source term while discussing Netscape's decision with a friend in the public relations industry. She doesn't remember where she came upon the term or if she borrowed it from another field, but she does remember her friend disliking the term.~{ See Malcolm Maclachlan, "Profit Motive Splits Open Source Movement," TechWeb News (August 26, 1998).<br> http://content.techweb.com/wire/story/TWB19980824S0012 }~
+Looking back, Peterson says she came up with the open source term while discussing Netscape's decision with a friend in the public relations industry. She doesn't remember where she came upon the term or if she borrowed it from another field, but she does remember her friend disliking the term.~{ See Malcolm Maclachlan, "Profit Motive Splits Open Source Movement," TechWeb News (August 26, 1998). \\ http://content.techweb.com/wire/story/TWB19980824S0012 }~
At the meeting, Peterson says, the response was dramatically different. "I was hesitant about suggesting it," Peterson recalls. "I had no standing with the group, so started using it casually, not highlighting it as a new term." To Peterson's surprise, the term caught on. By the end of the meeting, most of the attendees, including Raymond, seemed pleased by it.
@@ -1871,7 +1872,7 @@ http://www.opensource.org/docs/definition.html }~
Perens would later resign from the OSI, expressing regret that the organization had set itself up in opposition to Stallman and the FSF. Still, looking back on the need for a free software definition outside the Free Software Foundation's auspices, Perens understands why other hackers might still feel the need for distance. "I really like and admire Richard," says Perens. "I do think Richard would do his job better if Richard had more balance. That includes going away from free software for a couple of months."
-Stallman's monomaniacal energies would do little to counteract the public-relations momentum of open source proponents. In August of 1998, when chip-maker Intel purchased a stake in GNU/Linux vendor Red Hat, an accompanying New York Times article described the company as the product of a movement "known alternatively as free software and open source."~{ See Amy Harmon, "For Sale: Free Operating System," New York Times (September 28, 1998).<br> http://www.nytimes.com/library/tech/98/09/biztech/articles/28linux.html }~ Six months later, a John Markoff article on Apple Computer was proclaiming the company's adoption of the "open source" Apache server in the article headline.~{ See John Markoff, "Apple Adopts `Open Source' for its Server Computers," New York Times (March 17, 1999).<br> http://www.nytimes.com/library/tech/99/03/biztech/articles/17apple.html }~
+Stallman's monomaniacal energies would do little to counteract the public-relations momentum of open source proponents. In August of 1998, when chip-maker Intel purchased a stake in GNU/Linux vendor Red Hat, an accompanying New York Times article described the company as the product of a movement "known alternatively as free software and open source."~{ See Amy Harmon, "For Sale: Free Operating System," New York Times (September 28, 1998). \\ http://www.nytimes.com/library/tech/98/09/biztech/articles/28linux.html }~ Six months later, a John Markoff article on Apple Computer was proclaiming the company's adoption of the "open source" Apache server in the article headline.~{ See John Markoff, "Apple Adopts `Open Source' for its Server Computers," New York Times (March 17, 1999). \\ http://www.nytimes.com/library/tech/99/03/biztech/articles/17apple.html }~
={Apache web server;Apple Computers:open source software and;Intel;Markoff, John;Red Hat Inc.:success of+1}
Such momentum would coincide with the growing momentum of companies that actively embraced the "open source" term. By August of 1999, Red Hat, a company that now eagerly billed itself as "open source," was selling shares on Nasdaq. In December, VA Linux-formerly VA Research-was floating its own IPO to historical effect. Opening at $30 per share, the company's stock price exploded past the $300 mark in initial trading only to settle back down to the $239 level. Shareholders lucky enough to get in at the bottom and stay until the end experienced a 698% increase in paper wealth, a Nasdaq record.
@@ -1881,7 +1882,7 @@ Such momentum would coincide with the growing momentum of companies that activel
Among those lucky shareholders was Eric Raymond, who, as a company board member since the Mozilla launch, had received 150,000 shares of VA Linux stock. Stunned by the realization that his essay contrasting the Stallman-Torvalds managerial styles had netted him $36 million in potential wealth, Raymond penned a follow-up essay. In it, Raymond mused on the relationship between the hacker ethic and monetary wealth:
-_1 Reporters often ask me these days if I think the open-source community will be corrupted by the influx of big money. I tell them what I believe, which is this: commercial demand for programmers has been so intense for so long that anyone who can be seriously distracted by money is already gone. Our community has been self-selected for caring about other things-accomplishment, pride, artistic passion, and each other.~{ See Eric Raymond, "Surprised by Wealth," Linux Today (December 10, 1999).<br> http://linuxtoday.com/news_story.php3?ltsn=1999-12-10-001-05-NW-LF }~
+_1 Reporters often ask me these days if I think the open-source community will be corrupted by the influx of big money. I tell them what I believe, which is this: commercial demand for programmers has been so intense for so long that anyone who can be seriously distracted by money is already gone. Our community has been self-selected for caring about other things-accomplishment, pride, artistic passion, and each other.~{ See Eric Raymond, "Surprised by Wealth," Linux Today (December 10, 1999). \\ http://linuxtoday.com/news_story.php3?ltsn=1999-12-10-001-05-NW-LF }~
Whether or not such comments allayed suspicions that Raymond and other open source proponents had simply been in it for the money, they drove home the open source community's ultimate message: all you needed to sell the free software concept is a friendly face and a sensible message. Instead of fighting the marketplace head-on as Stallman had done, Raymond, Torvalds, and other new leaders of the hacker community had adopted a more relaxed approach-ignoring the marketplace in some areas, leveraging it in others. Instead of playing the role of high-school outcasts, they had played the game of celebrity, magnifying their power in the process.
@@ -2118,7 +2119,7 @@ During my research, I came across an essay titled "Freedom-Or Copyright?" Writte
% additional reference to the Digital Millenium Copyright Act
-_1 We still have the same old freedoms in using paper books. But if e-books replace printed books, that exception will do little good. With "electronic ink," which makes it possible to download new text onto an apparently printed piece of paper, even newspapers could become ephemeral. Imagine: no more used book stores; no more lending a book to your friend; no more borrowing one from the public library-no more "leaks" that might give someone a chance to read without paying. (And judging from the ads for Microsoft Reader, no more anonymous purchasing of books either.) This is the world publishers have in mind for us.~{ See "Safari Tech Books Online; Subscriber Agreement: Terms of Service."<br> http://safari.oreilly.com/mainhlp.asp?help=service }~
+_1 We still have the same old freedoms in using paper books. But if e-books replace printed books, that exception will do little good. With "electronic ink," which makes it possible to download new text onto an apparently printed piece of paper, even newspapers could become ephemeral. Imagine: no more used book stores; no more lending a book to your friend; no more borrowing one from the public library-no more "leaks" that might give someone a chance to read without paying. (And judging from the ads for Microsoft Reader, no more anonymous purchasing of books either.) This is the world publishers have in mind for us.~{ See "Safari Tech Books Online; Subscriber Agreement: Terms of Service." \\ http://safari.oreilly.com/mainhlp.asp?help=service }~
Needless to say, the essay caused some concern. Neither Tracy nor I had discussed the software her company would use nor had we discussed the type of copyright that would govern the e-book's usage. I mentioned the Technology Review article and asked if she could give me information on her company's e-book policies. Tracy promised to get back to me.
@@ -2209,9 +2210,9 @@ In July, a full year after the original email from Tracy, I got a call from Henn
Sure enough, the issue did come up. I learned through Henning that O'Reilly intended to publish the biography both as a book and as part of its new Safari Tech Books Online subscription service. The Safari user license would involve special restrictions,1 Henning warned, but O'Reilly was willing to allow for a copyright that permitted users to copy and share and the book's text regardless of medium. Basically, as author, I had the choice between two licenses: the Open Publication License or the GNU Free Documentation License.
={Open Publication License (OPL)+8;OPL (Open Publication License)+8;Safari Tech Books Online subscription service}
-I checked out the contents and background of each license. The Open Publication License (OPL)~{ See "The Open Publication License: Draft v1.0" (June 8, 1999).<br> http://opencontent.org/openpub/ }~ gives readers the right to reproduce and distribute a work, in whole or in part, in any medium "physical or electronic," provided the copied work retains the Open Publication License. It also permits modification of a work, provided certain conditions are met. Finally, the Open Publication License includes a number of options, which, if selected by the author, can limit the creation of "substantively modified" versions or book-form derivatives without prior author approval.
+I checked out the contents and background of each license. The Open Publication License (OPL)~{ See "The Open Publication License: Draft v1.0" (June 8, 1999). \\ http://opencontent.org/openpub/ }~ gives readers the right to reproduce and distribute a work, in whole or in part, in any medium "physical or electronic," provided the copied work retains the Open Publication License. It also permits modification of a work, provided certain conditions are met. Finally, the Open Publication License includes a number of options, which, if selected by the author, can limit the creation of "substantively modified" versions or book-form derivatives without prior author approval.
-The GNU Free Documentation License (GFDL),~{ See "The GNU Free Documentation License: Version 1.1" (March, 2000).<br> http://www.gnu.org/copyleft/fdl.html }~ meanwhile, permits the copying and distribution of a document in any medium, provided the resulting work carries the same license. It also permits the modification of a document provided certain conditions. Unlike the OPL, however, it does not give authors the option to restrict certain modifications. It also does not give authors the right to reject modifications that might result in a competitive book product. It does require certain forms of front- and back-cover information if a party other than the copyright holder wishes to publish more than 100 copies of a protected work, however.
+The GNU Free Documentation License (GFDL),~{ See "The GNU Free Documentation License: Version 1.1" (March, 2000). \\ http://www.gnu.org/copyleft/fdl.html }~ meanwhile, permits the copying and distribution of a document in any medium, provided the resulting work carries the same license. It also permits the modification of a document provided certain conditions. Unlike the OPL, however, it does not give authors the option to restrict certain modifications. It also does not give authors the right to reject modifications that might result in a competitive book product. It does require certain forms of front- and back-cover information if a party other than the copyright holder wishes to publish more than 100 copies of a protected work, however.
={GFDL (GNU Free Documentation License)+1;GNU Free Documentation License (GFDL)+1}
In the course of researching the licenses, I also made sure to visit the GNU Project web page titled "Various Licenses and Comments About Them."~{ See http://www.gnu.org/philosophy/license-list.html }~ On that page, I found a Stallman critique of the Open Publication License. Stallman's critique related to the creation of modified works and the ability of an author to select either one of the OPL's options to restrict modification. If an author didn't want to select either option, it was better to use the GFDL instead, Stallman noted, since it minimized the risk of the nonselected options popping up in modified versions of a document.
diff --git a/data/doc/sisu/markup-samples/v4/samples/free_as_in_freedom_2.richard_stallman_and_the_free_software_revolution.sam_williams.richard_stallman.sst b/data/doc/sisu/markup-samples/v4/samples/free_as_in_freedom_2.richard_stallman_and_the_free_software_revolution.sam_williams.richard_stallman.sst
new file mode 100644
index 00000000..c99cb10e
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/samples/free_as_in_freedom_2.richard_stallman_and_the_free_software_revolution.sam_williams.richard_stallman.sst
@@ -0,0 +1,2548 @@
+% SiSU 4.0
+
+@title: Free as in Freedom (2.0)
+ :subtitle: Richard Stallman and the Free Software Revolution
+
+@creator:
+ :author: Williams, Sam; Stallman, Richard M.
+
+@date:
+ :published: 2010
+
+@rights:
+ :copyright: Copyright (C) Sam Williams 2002; Copyright 2010 Richard M. Stallman
+ :license: Published under the GNU Free Documentation License. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License."
+
+@classify:
+ :topic_register: SiSU markup sample:book:biography;book:biography;copyright;GNU/Linux:GPL|copyleft|free software;free software;Software:Software Libré;GPL;Linux:GNU|Software Libré;programming
+
+@links:
+ { Home and Source }http://faifzilla.org/
+ { @ Wikipedia }http://en.wikipedia.org/wiki/Free_as_in_Freedom:_Richard_Stallman%27s_Crusade_for_Free_Software
+ { @ Amazon.com }http://www.amazon.com/gp/product/0596002874
+ { @ Barnes & Noble }http://search.barnesandnoble.com/booksearch/isbnInquiry.asp?isbn=0596002874
+
+@make:
+ :breaks: new=:A,:B,:C,1
+ :home_button_text: {Free as in Freedom 2.0}http://stallman.org/; {Free Software Foundation}http://www.fsf.org
+ :footer: {Free as in Freedom 2.0}http://stallman.org/; {Free Software Foundation}http://www.fsf.org
+
+% http://static.fsf.org/nosvn/faif-2.0.pdf
+% http://www.scribd.com/doc/55232810/Free-as-in-Freedom-Richard-Stallman
+
+:A~ @title, Sam Williams, Second Edition Revisions by Richard M. Stallman
+
+1~pre2 [Publisher Information] -#
+
+This is /{Free as in Freedom 2.0: Richard Stallman and the Free Soft-ware Revolution}/ , a revision of /{Free as in Freedom: Richard Stallman’s Crusade for Free Software}/. -#
+
+Copyright c 2002, 2010 Sam Williams \\ Copyright c 2010 Richard M. Stallman -#
+
+Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation;with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNUFree Documentation License." -#
+
+Published by the Free Software Foundation \\
+51 Franklin St., Fifth Floor \\
+Boston, MA 02110-1335 \\
+USA -#
+
+ISBN: 9780983159216 -#
+
+The cover photograph of Richard Stallman is by Peter Hinely. The PDP-10 photograph in Chapter 7 is by Rodney Brooks. The photo-graph of St. IGNUcius in Chapter 8 is by Stian Eikeland -#
+
+1~ Foreword by Richard M. Stallman
+
+I have aimed to make this edition combine the advantages of my knowledge and Williams' interviews and outside viewpoint. The reader can judge to what extent I have achieved this.
+
+I read the published text of the English edition for the first time in 2009 when I was asked to assist in making a French translation of /{Free as in Freedom}/. It called for more than small changes.
+
+Many facts needed correction, but deeper changes were also needed. Williams, a non-programmer, blurred fundamental technical and legal distinctions, such as that between modifying an existing program's code, on the one hand, and implementing some of its ideas in a new program, on the other. Thus, the first edition said that both Gosmacs and GNU Emacs were developed by modifying the original PDP-10 Emacs, which in fact neither one was. Likewise, it mistakenly described Linux as a "version of Minix." SCO later made the same false claim in its infamous lawsuit against IBM, and both Torvalds and Tanenbaum rebutted it.
+
+The first edition over dramatized many events by projecting spurious emotions into them. For instance, it said that I "all but shunned" Linux in 1992, and then made a "a dramatic about-face" by deciding in 1993 to sponsor Debian GNU/Linux. Both my interest in 1993 and my lack of interest in 1992 were pragmatic means to pursue the same end: to complete the GNU system. The launch of the GNU Hurd kernel in 1990 was also a pragmatic move directed at that same end.
+
+For all these reasons, many statements in the original edition were mistaken or incoherent. It was necessary to correct them, but not straightforward to do so with integrity short of a total rewrite, which was undesirable for other reasons. Using explicit notes for the corrections was suggested, but in most chapters the amount of change made explicit notes prohibitive. Some errors were too pervasive or too in-grained to be corrected by notes. Inline or footnotes for the rest would have overwhelmed the text in some places and made the text hard to read; footnotes would have been skipped by readers tired of looking down for them. I have therefore made corrections directly in the text.
+
+However, I have not tried to check all the facts and quotations that are outside my knowledge; most of those I have simply carried forward on Williams' authority.
+
+Williams' version contained many quotations that are critical of me. I have preserved all these, adding rebuttals when appropriate.I have not deleted any quotation, except in chapter 11where I have deleted some that were about open source and did not pertain to my life or work. Likewise I have preserved (and sometimes commented on) most of Williams' own interpretations that criticized me, when they did not represent misunderstanding of facts or technology, but I have freely corrected inaccurate assertions about my work and my thoughts and feelings. I have preserved his personal impressions when presented as such, and "I" in the text of this edition always refers to Williams except in notes labeled "RMS:".
+
+In this edition, the complete system that combines GNU and Linux is always "GNU/Linux," and "Linux" by itself always refers to Torvalds' kernel, except in quotations where the other usage is marked with "[sic]". \\ See http://www.gnu.org/gnu/gnu-linux-faq.html for more explanation of why it is erroneous and unfair to call the whole system "Linux."
+
+I would like to thank John Sullivan for his many useful criticisms and suggestions.
+
+1~ Preface by Sam Williams
+
+This summer marks the 10th anniversary of the email exchange that set in motion the writing of /{Free as in Freedom: Richard Stallman's Crusade for Free Software}/ and, by extension, the work prefaced here, /{Richard Stallman and the Free Software Revolution}/.
+
+Needless to say, a lot has changed over the intervening decade.
+
+Originally conceived in an era of American triumphalism, the book's main storyline - about one man's Jeremiah-like efforts to enlighten fellow software developers as to the ethical, if not economic, shortsightedness of a commercial system bent on turning the free range intellectual culture that gave birth to computer science into a rude agglomeration of proprietary gated communities - seems almost nostalgic, a return to the days when the techno-capitalist system seemed to be working just fine, barring the criticism of a few outlying skeptics.
+
+Now that doubting the system has become almost a common virtue,it helps to look at what narrative threads, if any, remained consistent over the last ten years.
+
+While I don't follow the software industry as closely as I once did, one thing that leaps out now, even more than it did then, is the ease with which ordinary consumers have proven willing to cede vast swaths of private information and personal user liberty in exchange for riding a top the coolest technology "platform" or the latest networking trend.
+
+A few years ago, I might have dubbed this the "iPod Effect," a shorthand salute to Apple co-founder Steve Jobs' unrivaled success in getting both the music industry and digital music listeners to put aside years of doubt and mutual animosity to rally around a single, sexy device - the Apple iPod - and its restrictive licensing regime, iTunes. Were I pitching the story to a magazine or newspaper nowadays, I'd probably have to call it the "iPad Effect" or maybe the "Kindle Effect" both in an attempt to keep up with the evolving brand names and to acknowledge parallel, tectonic shifts in the realm of daily journalism and electronic book publishing.
+
+Lest I appear to be gratuitously plugging the above-mentioned brand names, RMS suggests that I offer equal time to a pair of websites that can spell out their many disadvantages, especially in the realm of software liberty. I have agreed to this suggestion in the spirit of equal time. The web sites he recommends are DefectiveByDesign.org and BadVista.org.
+
+Regardless of title, the notion of corporate brand as sole guarantor of software quality in a swiftly changing world remains a hard one to dislodge, even at a time when most corporate brands are trading at or near historic lows.
+
+Ten years ago, it wasn't hard to find yourself at a technology conference listening in on a conversation (or subjected to direct tutelage) in which some old-timer, Richard Stallman included, offered a compelling vision of an alternate possibility. It was the job of these old-timers, I ultimately realized, to make sure we newbies in the journalism game recognized that the tools we prided ourselves in finally knowing how to use - Microsoft Word, PowerPoint, Internet Explorer, just to name a few popular offerings from a single oft-cited vendor - were but a pale shadow of towering edifice the original architects of the personal computer set out to build.
+
+Nowadays, it's almost as if the opposite situation is at hand. The edifice is now a sprawling ecosystem, a jungle teeming with ideas but offering only a few stable niches for sustainable growth. While one can still find plenty of hackers willing to grumble about, say, Vista's on going structural flaws, Apple's dictatorial oversight of the iPhoneApp Store or Google's shifting definition of the word "evil" - each year brings with it a fresh crop of "digital native" consumers willing to trust corporate guidance in this Hobbesian realm. Maybe that's because many of the problems that once made using your desktop computer such a teeth-grinding experience have largely been paved over with the help of free software.
+
+Whatever. As consumer software reliability has improved, the race to stay one step ahead of consumer taste has put application developers in an even tighter embrace with moneyed interests. I'm not saying that the hacker ethos no longer exists or that it has even weakened in any noticeable way. I'm just saying that I doubt the programmer who generated the Facebook algorithm that rewrites the "info" pages so that each keyword points to a sponsored page, with an 80-percent semantic error rate to boot, spends much time in his new Porsche grousing about what the program really could have achieved if only the "suits" hadn't gotten in the way.
+
+True, millions of people now run mostly free software on their computers with many running free software exclusively. From an ordinary consumer perspective, however, terms like "software" and "computer" have become increasingly distant. Many 2010-era cell phones could give a 2000-era laptop a run for its money in the functionality department. And yet, when it comes time to make a cell phone purchase, how many users lend any thought to the computer or software operating system making that functionality possible? The vast majority of modern phone users base their purchasing decisions almost entirely on the number of applications offered, the robustness of the network and, most important of all, the monthly service plan. Getting a consumer in this situation to view his or her software purchase through the lens of personal liberty, as opposed to personal convenience, is becoming, if not more difficult, certainly a more complex endeavor.
+
+Given this form of pessimistic introduction, why should anyone want go on and read this book?
+
+I can offer two major reasons.
+
+The first reason is a personal one. As noted in the Epilogue of /{Free as in Freedom}/, Richard and I parted on less than cordial terms shortly before the publication of that book. The fault, in large part, was mine. Having worked with Richard to make sure that my biographical sketch didn't run afoul of free software principles - an effort that, I'm proud to say, made /{Free as in Freedom}/ one of the first works to employ the GNU Free Documentation License (GFDL) as a copyright mechanism - I abruptly ended the cooperative relationship when it came time to edit the work and incorporate Richard' lengthy list of error corrections and requests for clarification.
+
+Though able to duck behind my own principles of authorial independence and journalistic objectivity, I have since come to lament not begging the book's publisher - O'Reilly and Associates - for additional time. Because O'Reilly had already granted my one major stipulation - the GFDL - and had already put up with a heavy stream of last-minute changes on my part, however, I was hesitant to push my luck.
+
+In the years immediately following the publication of /{Free as in Freedom}/, I was able to justify my decision by noting that the GFDL, just like the GNU General Public License in the software realm, makes it possible for any reader to modify the book and resell it as a competitive work. As Ernest Hemingway once put it, "the first draft of anything is shit." If Stallman or others within the hacker community saw /{Free as in Freedom}/ as a first draft at best, well, at least I had spared them the time and labor of generating their own first draft.
+
+Now that Richard has indeed delivered what amounts to a significant rewrite, I can only but remain true to my younger self and endorse the effort. Indeed, I salute it. My only remaining hope is that, seeing as how Richard's work doesn't show any sign of slowing, additional documentation gets added to the mix.
+
+Before moving on to the next reason, I should note that one of the pleasant by-products of this book is a re-opening of email communication channels between Richard and myself. The resulting communication has reacquainted me with the razor-sharp Stallman writing style.
+
+An illustrative and perhaps amusing anecdote for anyone out there who has wrangled with Richard in text: In the course of discussing the passage in which I observe and document the process of Richard losing his cool amid the rush hour traffic of Kihei, Maui, a passage that served as the basis for Chapter 7 ("A Brief Journey through Hacker Hell") in the original book, I acknowledged a common complaint among the book's reviewers - namely, that the episode seemed out of place, a fragment of magazine-style profile interrupting a book-length biography. I told Richard that he could discard the episode for that reason alone but noted that my decision to include it was based on two justifications. First, it offered a glimpse of the Stallman temper, something I'd been warned about but had yet to experience in a first hand manner. Second, I felt the overall scene possessed a certain metaphorical value. Hence the chapter title. Stallman, to my surprise, agreed on both counts. His concern lay more in the two off-key words. At one point I quote him accusing the lead driver of our two-vehicle caravan with "deliberately" leading us down a dead-end street, an accusation that, if true, suggested a level of malice outside the bounds of the actual situation. Without the benefit of a recorded transcript - I only had a notebook at the time, I allowed that it was likely I'd mishandled Stallman's actual wording and had made it more hurtful than originally intended.
+
+On a separate issue, meanwhile, Stallman questioned his quoted use of the word "fucking." Again, I didn't have the moment on tape, but I wrote back that I distinctly recalled an impressive display of profanity, a reminder of Richard's New York roots, and was willing to stand by that memory.
+
+An email response from Richard, received the next day, restated the critique in a way that forced me to go back and re-read the first message. As it turned out, Stallman wasn't so much objecting to the "fuck" as the "-ing" portion of the quote.
+
+"Part of the reason I doubt [the words] is that they involve using fucking as an adverb," Stallman wrote. "I have never spoken that way. So I am sure the words are somewhat altered."
+
+"Touch'e".
+
+The second reason a person should feel compelled to read this book cycles back to the opening theme of this preface - how different a future we face in 2010 compared to the one we were still squinting our eyes to see back in 2000. I ll be honest: Like many Americans (and non-Americans), my world view was altered by the events of September 11, 2001, so much so that it wasn't much longer after the publication of /{Free as in Freedom}/ that my attention drifted sharply away from the free software movement and Stallman's efforts to keep it on course. While I have managed to follow the broad trends and major issues, the day-to-day drama surrounding software standards, software copyrights and software patents has become something I largely skip over - the Internet news equivalent of the Water Board notes in the local daily newspaper, in other words.
+
+[RMS: The September 2001 attacks, not mentioned later in the book, deserve brief comment here. Far from "changing everything," as many proclaim, the attacks have, in fact, changed very little in the U.S.: There are still scoundrels in power who hate our freedoms. The only major difference is that they can now cite "terrorists" as an excuse for laws to take them away. See the political notes on stallman.org for more about this.]
+
+This is a lamentable development in large part because, ten years in, I finally see the maturing 21st century in what I believe to be a clear light. Again, if this were a pitch letter to some editor, I'd call it "The Process Century."
+
+By that I mean I we stand at a rare point in history where, all cynicism aside, the power to change the world really does delegate down to the ordinary citizen's level. The catch, of course, is that the same power that belongs to you also belongs to everyone else. Wherein past eras one might have secured change simply by winning the sympathies of a few well-placed insiders, today's reformer must bring into alignment an entire vector field of competitive ideas and interests. In short, being an effective reformer nowadays requires more than just titanic stamina and a willingness to cry out in the wilderness for a decade or more, it requires knowing how to articulate durable, scalable ideas, how to beat the system at its own game.
+
+On all counts, I would argue that Richard M. Stallman, while maybe not the archetype, is at the very least an ur-type of the successful reformer just described.
+
+While some might lament a future in which every problem seems to take a few decades of committee meetings and sub-committee hearings just to reach the correction stage, I, for one, see the alternative - a future so responsive to individual or small group action that some self-appointed actor finally decides to put that responsiveness to the test- as too chilling to contemplate.
+
+In short, if you are the type of person who, like me, hopes to seethe 21st century follow a less bloody course than the 20th century, the Water Board - in its many frustrating guises - is where that battle is currently being fought. As hinted by the Virgil-inspired epigraph introducing the book's first chapter, I've always held out hope that this book might in some way become a sort of epic poem for the Internet Age. Built around a heroic but flawed central figure, its authorial stamp should be allowed to blur with age.
+
+On that note, I would like to end this preface the same way I always end this preface - with a request for changes and contributions from any reader wishing to improve the text. Appendix B - GNU Free Documentation License offers a guide on your rights as a reader to submit changes, make corrections, or even create your own spin-off version of the book. If you prefer to simply run the changes through Richard or myself, you can find the pertinent contact information on the Free Software Foundation web site. In the meantime, good luck and enjoy the book!
+
+group{
+
+Sam Williams
+Staten Island,
+USA
+
+}group
+
+1~ Chapter 1 - For Want of a Printer
+
+code{
+
+I fear the Greeks. Even when they bring gifts.
+ ---Virgil
+ The Aeneid
+
+}code
+
+The new printer was jammed, again.
+
+Richard M. Stallman, a staff software programmer at the Massachusetts Institute of Technology's Artificial Intelligence Laboratory (AI Lab), discovered the malfunction the hard way. An hour after sending off a 50-page file to the office laser printer, Stallman, 27, broke off a productive work session to retrieve his documents. Upon arrival, he found only four pages in the printer's tray. To make matters even more frustrating, the four pages belonged to another user, meaning that Stallman's print job and the unfinished portion of somebody else's print job were still trapped somewhere within the electrical plumbing of the lab's computer network.
+={AI Lab (Artificial Intelligence Laboratory);MIT Massachusetts Institute of Technology}
+
+Waiting for machines is an occupational hazard when you're a software programmer, so Stallman took his frustration with a grain of salt. Still, the difference between waiting for a machine and waiting on a machine is a sizable one. It wasn't the first time he'd been forced to stand over the printer, watching pages print out one by one. As a person who spent the bulk of his days and nights improving the efficiency of machines and the software programs that controlled them, Stallman felt a natural urge to open up the machine, look at the guts, and seek out the root of the problem.
+
+Unfortunately, Stallman's skills as a computer programmer did not extend to the mechanical-engineering realm. As freshly printed documents poured out of the machine, Stallman had a chance to reflect on other ways to circumvent the printing jam problem.
+
+How long ago had it been that the staff members at the AI Lab had welcomed the new printer with open arms? Stallman wondered. The machine had been a donation from the Xerox Corporation. A cutting edge prototype, it was a modified version of a fast Xerox photocopier. Only instead of making copies, it relied on software data piped in over a computer network to turn that data into professional-looking documents. Created by engineers at the world-famous Xerox Palo Alto Research Facility, it was, quite simply, an early taste of the desktop-printing revolution that would seize the rest of the computing industry by the end of the decade.
+={Xerox Corporation+10:Palo Alto Research Center}
+
+Driven by an instinctual urge to play with the best new equipment, programmers at the AI Lab promptly integrated the new machine into the lab's sophisticated computing infrastructure. The results had been immediately pleasing. Unlike the lab's old printer, the new Xerox machine was fast. Pages came flying out at a rate of one per second, turning a 20-minute print job into a 2-minute print job. The new machine was also more precise. Circles came out looking like circles, not ovals. Straight lines came out looking like straight lines, not low-amplitude sine waves.
+
+It was, for all intents and purposes, a gift too good to refuse.
+
+Once the machine was in use, its flaws began to surface. Chief among the drawbacks was the machine's susceptibility to paper jams. Engineering-minded programmers quickly understood the reason behind the flaw. As a photocopier, the machine generally required the direct oversight of a human operator. Figuring that these human operators would always be on hand to fix a paper jam, if it occurred, Xerox engineers had devoted their time and energies to eliminating other pesky problems. In engineering terms, user diligence was built into the system.
+
+In modifying the machine for printer use, Xerox engineers had changed the user-machine relationship in a subtle but profound way. Instead of making the machine subservient to an individual human operator, they made it subservient to an entire networked population of human operators. Instead of standing directly over the machine, a human user on one end of the network sent his print command through an extended bucket brigade of machines, expecting the desired content to arrive at the targeted destination and in proper form. It wasn't until he finally went to check up on the final output that he realized how little of it had really been printed.
+
+Stallman was hardly the only AI Lab denizen to notice the problem, but he also thought of a remedy. Years before, for the lab's previous printer, Stallman had solved a similar problem by modifying the software program that regulated the printer, on a small PDP-11machine, as well as the Incompatible Timesharing System that ran on the main PDP-10 computer. Stallman couldn't eliminate paper jams, but he could insert software code that made the PDP-11 check the printer periodically, and report jams back to the PDP-10. Stallman also inserted code on the PDP-10 to notify every user with a waiting print job that the printer was jammed. The notice was simple, something along the lines of "The printer is jammed, please fix it," and because it went out to the people with the most pressing need to fix the problem, chances were that one of them would fix it forthwith.
+={PDP-10 computer;PDP-11 computer}
+
+As fixes go, Stallman's was oblique but elegant. It didn't fix the mechanical side of the problem, but it did the next best thing by closing the information loop between user and machine. Thanks to a few additional lines of software code, AI Lab employees could eliminate the 10 or 15 minutes wasted each week in running back and forth to check on the printer. In programming terms, Stallman's fix took advantage of the amplified intelligence of the overall network.
+
+"If you got that message, you couldn't assume somebody else would fix it," says Stallman, recalling the logic. "You had to go to the printer. A minute or two after the printer got in trouble, the two or three people who got messages arrive to fix the machine. Of those two or three people, one of them, at least, would usually know how to fix the problem."
+
+Such clever fixes were a trademark of the AI Lab and its indigenous population of programmers. Indeed, the best programmers at the AI Lab disdained the term programmer, preferring the more slangy occupational title of hacker instead. The job title covered a host of activities - everything from creative mirth making to the improvement of existing software and computer systems. Implicit within the title, however, was the old-fashioned notion of Yankee ingenuity. For a hacker, writing a software program that worked was only the beginning. A hacker would try to display his cleverness (and impress other hackers) by tackling an additional challenge: to make the program particularly fast, small, powerful, elegant, or somehow impressive in a clever way.~{ For more on the term "hacker," see Appendix A - Hack, Hackers, and Hacking. }~
+
+Companies like Xerox made it a policy to donate their products(and software) to places where hackers typically congregated. If hackers used these products, they might go to work for the company later on. In the 60s and early 70s, they also sometimes developed programs that were useful for the manufacturer to distribute to other customers.
+={hackers:philosophy of donating software+7;software:companies donating;source code:Xerox Corporation publishing+32}
+
+When Stallman noticed the jamming tendency in the Xerox laser printer, he thought of applying the old fix or "hack" to this printer. In the course of looking up the Xerox laser-printer software, however, Stallman made a troubling discovery. The printer didn't have any software, at least nothing Stallman or a fellow programmer could read. Until then, most companies had made it a form of courtesy to publish source-code files-readable text files that documented the individual software commands that told a machine what to do. Xerox, in this instance, had provided software files only in compiled, or binary, form. If programmers looked at the files, all they would see was an endless stream of ones and zeroes - gibberish.
+={Xerox Corporation:source code, publishing+31;text file source code, publishing;binary files}
+
+There are programs, called "disassemblers," to convert the ones and zeroes into low-level machine instructions, but figuring out what those instructions actually "do" is a long and hard task, known as "reverse engineering." To reverse engineer this program could have taken more time than five years' worth of jammed printouts. Stallman wasn't desperate enough for that, so he put the problem aside.
+
+Xerox's unfriendly policy contrasted blatantly with the usual practices of the hacker community. For instance, to develop the program for the PDP-11 that ran the old printer, and the program for another PDP-11 that handled display terminals, the AI Lab needed a cross-assembler program to build PDP-11 programs on the PDP-10 main computer. The lab's hackers could have written one, but Stallman, a Harvard student, found such a program at Harvard's computer lab. That program was written to run on the same kind of computer, the PDP-10, albeit with a different operating system. Stallman never knew who had written the program, since the source code did not say. But he brought a copy back to the AI Lab. He then altered the source code to make it run on the AI Lab's Incompatible Timesharing System (ITS). With no muss and little fuss, the AI Lab got the program it needed for its software infrastructure. Stallman even added a few features not found in the original version, making the program more powerful. "We wound up using it for several years," Stallman says.
+={Harvard University:computer labs+2;AI Lab (Artificial Intelligence Laboratory):borrowing source code for}
+
+From the perspective of a 1970s-era programmer, the transaction was the software equivalent of a neighbor stopping by to borrow a power tool or a cup of sugar from a neighbor. The only difference was that in borrowing a copy of the software for the AI Lab, Stallman had done nothing to deprive anyone else of the use of the program. If anything, other hackers gained in the process, because Stallman had introduced additional features that other hackers were welcome to borrow back. For instance, Stallman recalls a programmer at the private engineering firm, Bolt, Beranek & Newman, borrowing the program. He made it run on Twenex and added a few additional features, which Stallman eventually reintegrated into the AI Lab's own source-code archive. The two programmers decided to maintain a common version together, which had the code to run either on ITSor on Twenex at the user's choice.
+={Bolt, Beranek & Newman engineering firm}
+
+"A program would develop the way a city develops," says Stallman, recalling the software infrastructure of the AI Lab. "Parts would get replaced and rebuilt. New things would get added on. But you could always look at a certain part and say, 'Hmm, by the style, I see this part was written back in the early 60s and this part was written in themid-1970s.'"
+
+Through this simple system of intellectual accretion, hackers at the AI Lab and other places built up robust creations. Not every programmer participating in this culture described himself as a hacker, but most shared the sentiments of Richard M. Stallman. If a program or software fix was good enough to solve your problems, it was good enough to solve somebody else's problems. Why not share it out of a simple desire for good karma?
+
+This system of cooperation was being undermined by commercial secrecy and greed, leading to peculiar combinations of secrecy and co-operation. For instance, computer scientists at UC Berkeley had built up a powerful operating system called BSD, based on the Unix system they had obtained from AT&T. Berkeley made BSD available for the cost of copying a tape, but would only give these tapes to schools that could present a $50,000 source license obtained from AT&T. The Berkeley hackers continued to share as much as AT&T let them, but they had not perceived a conflict between the two practices.
+={AT&T;Multics operating system;UC Berkeley:building Unix;Unix operating system;BSD}
+
+Likewise, Stallman was annoyed that Xerox had not provided the source-code files, but not yet angry. He never thought of asking Xerox for a copy. "They had already given us the laser printer," Stallman says. "I could not say they owed us something more. Besides, I took for granted that the absence of source code reflected an intentional decision, and that asking them to change it would be futile."
+
+Good news eventually arrived: word had it that a scientist at the computer-science department at Carnegie Mellon University had a copy of the laser printer source code.
+={Carnegie Mellon University+17}
+
+The association with Carnegie Mellon did not augur well. In 1979, Brian Reid, a doctoral student there, had shocked the community by refusing to share his text-formatting program, dubbed Scribe. This text formatter was the first to have mark-up commands oriented to-wards the desired semantics (such as "emphasize this word" or "this paragraph is a quotation") rather than low-level formatting details("put this word in italics" or "narrow the margins for this paragraph"). Instead Reid sold Scribe to a Pittsburgh-area software company called Unilogic. His graduate-student career ending, Reid says he simply was looking for a way to unload the program on a set of developers that would take pains to keep it from slipping into the public domain.(Why one would consider such an outcome particularly undesirable is not clear.) To sweeten the deal, Reid also agreed to insert a set of time-dependent functions - "time bombs" in software-programmer parlance - that deactivated freely copied versions of the program after a 90-day expiration date. To avoid deactivation, users paid the software company, which then issued a code that defused the internal time-bomb anti-feature.
+={Unilogic software company+1;time bombs, in software;Scribe text-formatting program+1;anti-feature}
+
+For Stallman, this was a betrayal of the programmer ethos, pure and simple. Instead of honoring the notion of share-and-share alike, Reid had inserted a way for companies to compel programmers to pay for information access. But he didn't think deeply about the question, since he didn't use Scribe much.
+
+Unilogic gave the AI Lab a gratis copy to use, but did not remove or mention the time bomb. It worked, for a while; then one day a user reported that Scribe had stopped working. System hacker Howard Cannon spent hours debugging the binary until he found the time-bomb and patched it out. Cannon was incensed, and wasn't shy about telling the other hackers how mad he was that Unilogic had wasted his time with an intentional bug.
+
+Stallman had a Lab-related reason, a few months later, to visit the Carnegie Mellon campus. During that visit, he made a point of looking for the person reported to have the printer software source code. By good fortune, the man was in his office.
+
+In true engineer-to-engineer fashion, the conversation was cordial but blunt. After briefly introducing himself as a visitor from MIT, Stallman requested a copy of the laser-printer source code that he wanted to modify. To his chagrin, the researcher refused.
+
+"He told me that he had promised not to give me a copy," Stallman says.
+
+Memory is a funny thing. Twenty years after the fact, Stallman's mental history tape is blank in places. Not only does he not remember the motivating reason for the trip or even the time of year during which he took it, he also has no recollection of who was on the other end of the conversation. According to Reid, the person most likely to have fielded Stallman's request is Robert Sproull, a former Xerox PARC researcher and current director of Sun Laboratories, a research division of the computer-technology conglomerate Sun Microsystems. During the 1970s, Sproull had been the primary developer of the laser-printer software in question while at Xerox PARC. Around 1980, Sproull took a faculty research position at Carnegie Mellon where he continued his laser-printer work amid other projects.
+={Xerox Corporation:PARC|Palo Alto Research Center;Sproull, Robert (Xerox PARC researcher);Sun Laboratories}
+
+When asked directly about the request, however, Sproull draws a blank. "I can't make a factual comment," writes Sproull via email. "I have absolutely no recollection of the incident."
+
+"The code that Stallman was asking for was leading-edge, state-of-the-art code that Sproull had written in the year or so before going to Carnegie Mellon," recalls Reid. If so, that might indicate a mis-understanding that occurred, since Stallman wanted the source for the program that MIT had used for quite some time, not some newer version. But the question of which version never arose in the brief conversation.
+
+In talking to audiences, Stallman has made repeated reference to the incident, noting that the man's unwillingness to hand over the source code stemmed from a nondisclosure agreement, a contractual agreement between him and the Xerox Corporation giving the signatory access to the software source code in exchange for a promise of secrecy. Now a standard item of business in the software industry, the nondisclosure agreement, or NDA, was a novel development at the time, a reflection of both the commercial value of the laser printer to Xerox and the information needed to run it. "Xerox was at the time trying to make a commercial product out of the laser printer," recalls Reid. "They would have been insane to give away the source code."
+={NDAs (nondisclosure agreements): for source code+13;nondisclosure agreements (NDAs):for source code+13}
+
+For Stallman, however, the NDA was something else entirely. It was a refusal on the part of some CMU researcher to participate in a society that, until then, had encouraged software programmers to regard programs as communal resources. Like a peasant whose centuries-old irrigation ditch had grown suddenly dry, Stallman had followed the ditch to its source only to find a brand-spanking-new hydroelectric dam bearing the Xerox logo.
+
+For Stallman, the realization that Xerox had compelled a fellow programmer to participate in this newfangled system of compelled secrecy took a while to sink in. In the first moment, he could only seethe refusal in a personal context. "I was so angry I couldn't think of a way to express it. So I just turned away and walked out without another word," Stallman recalls. "I might have slammed the door. Who knows? All I remember is wanting to get out of there. I went to his office expecting him to cooperate, so I had not thought about how I would respond if he refused. When he did, I was stunned speechless as well as disappointed and angry."
+
+Twenty years after the fact, the anger still lingers, and Stallman presents the event as one that made him confront an ethical issue, though not the only such event on his path. Within the next few months, a series of events would befall both Stallman and the AI Lab hacker community that would make 30 seconds worth of tension in a remote Carnegie Mellon office seem trivial by comparison. Nevertheless, when it comes time to sort out the events that would transform Stallman from a lone hacker, instinctively suspicious of centralized authority, to a crusading activist applying traditional notions of liberty, equality, and fraternity to the world of software development, Stallman singles out the Carnegie Mellon encounter for special attention.
+
+"It was my first encounter with a nondisclosure agreement, and it immediately taught me that nondisclosure agreements have victims," says Stallman, firmly. "In this case I was the victim. [My lab and I]were victims."
+
+Stallman later explained, "If he had refused me his cooperation for personal reasons, it would not have raised any larger issue. I might have considered him a jerk, but no more. The fact that his refusal was impersonal, that he had promised in advance to be uncooperative, not just to me but to anyone whatsoever, made this a larger issue."
+
+Although previous events had raised Stallman's ire, he says it wasn't until his Carnegie Mellon encounter that he realized the events were beginning to intrude on a culture he had long considered sacrosanct. He said, "I already had an idea that software should be shared, but I wasn't sure how to think about that. My thoughts weren't clear and organized to the point where I could express them in a concise fashion to the rest of the world. After this experience, I started to recognize what the issue was, and how big it was."
+
+As an elite programmer at one of the world's elite institutions, Stallman had been perfectly willing to ignore the compromises and bargains of his fellow programmers just so long as they didn't interfere with his own work. Until the arrival of the Xerox laser printer, Stallman had been content to look down on the machines and programs other computer users grimly tolerated.
+
+Now that the laser printer had insinuated itself within the AI Lab's network, however, something had changed. The machine worked fine, barring the paper jams, but the ability to modify software according to personal taste or community need had been taken away. From the viewpoint of the software industry, the printer software represented a change in business tactics. Software had become such a valuable asset that companies no longer accepted the need to publicize source code, especially when publication meant giving potential competitors a chance to duplicate something cheaply. From Stallman's viewpoint, the printer was a Trojan Horse. After a decade of failure, software that users could not change and redistribute - future hackers would use the term "proprietary" software - had gained a foothold inside the AI Lab through the sneakiest of methods. It had come disguised as a gift.
+={proprietary software}
+
+That Xerox had offered some programmers access to additional gifts in exchange for secrecy was also galling, but Stallman takes pains to note that, if presented with such a quid pro quo bargain at a younger age, he just might have taken the Xerox Corporation up on its offer. The anger of the Carnegie Mellon encounter, however, had a firming effect on Stallman's own moral lassitude. Not only did it give him the necessary anger to view such future offers with suspicion, it also forced him to turn the situation around: what if a fellow hacker dropped into Stallman's office someday and it suddenly became Stallman's job to refuse the hacker's request for source code?
+
+"When somebody invited me to betray all my colleagues in that way, I remembered how angry I was when somebody else had done that to me and my whole lab," Stallman says. "So I said, 'Thank you very much for offering me this nice software package, but I can't accept it on the conditions that you're asking for, so I'm going to do without it.'"
+
+It was a lesson Stallman would carry with him through the tumultuous years of the 1980s, a decade during which many of his MIT colleagues would depart the AI Lab and sign nondisclosure agreements of their own. They may have told themselves that this was a necessary evil so they could work on the best projects. For Stallman, however, the NDA called the moral legitimacy of the project into question. What good is a technically exciting project if it is meant to be withheld from the community?
+
+As Stallman would quickly learn, refusing such offers involved more than personal sacrifice. It involved segregating himself from fellow hackers who, though sharing a similar distaste for secrecy, tended to express that distaste in a more morally flexible fashion. Refusing another's request for source code, Stallman decided, was not only a betrayal of the scientific mission that had nurtured software development since the end of World War II, it was a violation of the Golden Rule, the baseline moral dictate to do unto others as you would have them do unto you.
+
+Hence the importance of the laser printer and the encounter that resulted from it. Without it, Stallman says, his life might have followed a more ordinary path, one balancing the material comforts of a commercial programmer with the ultimate frustration of a life spent writing invisible software code. There would have been no sense of clarity, no urgency to address a problem others weren't addressing. Most importantly, there would have been no righteous anger, an emotion that, as we soon shall see, has propelled Stallman's career as surely as any political ideology or ethical belief.
+
+"From that day forward, I decided this was something I could never participate in," says Stallman, alluding to the practice of trading personal liberty for the sake of convenience - Stallman's description of the NDA bargain - as well as the overall culture that encouraged such ethically suspect deal-making in the first place. "I decided never to make other people victims as I had been a victim."
+
+1~ Chapter 2 - 2001: A Hacker's Odyssey
+
+The New York University computer-science department sits inside Warren Weaver Hall, a fortress-like building located two blocks east of Washington Square Park. Industrial-strength air-conditioning vents create a surrounding moat of hot air, discouraging loiterers and solicitors alike. Visitors who breach the moat encounter another formidable barrier, a security check-in counter immediately inside the building's single entryway.
+={Warren Weaver Hall+2;New York University computer science department+44}
+
+Beyond the security checkpoint, the atmosphere relaxes somewhat. Still, numerous signs scattered throughout the first floor preach the dangers of unsecured doors and propped-open fire exits. Taken as a whole, the signs offer a reminder: even in the relatively tranquil confines of pre-September 11, 2001, New York, one can never be too careful or too suspicious.
+
+The signs offer an interesting thematic counterpoint to the growing number of visitors gathering in the hall's interior atrium. A few look like NYU students. Most look like shaggy-haired concert-goers milling outside a music hall in anticipation of the main act. For one brief morning, the masses have taken over Warren Weaver Hall, leaving the nearby security attendant with nothing better to do but watch Ricki Lake on TV and shrug her shoulders toward the nearby auditorium whenever visitors ask about "the speech."
+
+Once inside the auditorium, a visitor finds the person who has forced this temporary shutdown of building security procedures. The person is Richard M. Stallman, founder of the GNU Project, original president of the Free Software Foundation, winner of the 1990 MacArthur Fellowship, winner of the Association of Computing Machinery's Grace Murray Hopper Award (also in 1990), co-recipient of the Takeda Foundation's 2001 Takeda Award for Social/Economic Betterment, and former AI Lab hacker. As announced over a host of hacker-related web sites, including the GNU Project's own http://www.gnu.org site, Stallman is in Manhattan, his former hometown, to deliver a much anticipated speech in rebuttal to the Microsoft Corporation's recent campaign against the GNU General Public License.
+={Free Software Foundation (FSF)+1;FSF (Free Software Foundation);GNU General Public License+1;GNU Project:web site for;GPL+1;MacArthur Fellowship Program;Microsoft Corporation+8}
+
+The subject of Stallman's speech is the history and future of the free software movement. The location is significant. Less than a month before, Microsoft senior vice president Craig Mundie appeared at the nearby NYU Stern School of Business, delivering a speech blasting the GNU General Public License, or GNU GPL, a legal device originally conceived by Stallman 16 years before. Built to counteract the growing wave of software secrecy overtaking the computer industry - a wave first noticed by Stallman during his 1980 troubles with the Xerox laser printer - the GPL has evolved into a central tool of the free software community. In simplest terms, the GPL establishes a form of communal ownership - what today's legal scholars now call the "digital commons" - through the legal weight of copyright. The GPL makes this irrevocable; once an author gives code to the community in this way, that code can't be made proprietary by anyone else. Derivative versions must carry the same copyright license, if they use a substantial amount of the original source code. For this reason, critics of the GPL have taken to calling it a "viral" license, suggesting inaccurately that it spreads itself to every software program it touches.~{ Actually, the GPL's powers are not quite that potent: just putting your code in the same computer with a GPL-covered program does not put your code under the GPL. "To compare something to a virus is very harsh," says Stallman. "A spider plant is a more accurate comparison; it goes to another place if you actively take a cutting." For more information on the GNU General Public License, \\ visit http://www.gnu.org/copyleft/gpl.html. }~
+={Mundie, Craig+2;NYU Stern School of Business;Stern School of Business (NYU)}
+
+In an information economy increasingly dependent on software and increasingly beholden to software standards, the GPL has become the proverbial "big stick." Even companies that once derided it as "software socialism" have come around to recognize the benefits. Linux, the kernel developed by Finnish college student Linus Torvalds in 1991, is licensed under the GPL, as are most parts of the GNU system: GNU Emacs, the GNU Debugger, the GNU C Compiler, etc. Together, these tools form the components of the free software GNU/Linux operating system, developed, nurtured, and owned by the worldwide hacker community. Instead of viewing this community as a threat, high-tech companies like IBM, Hewlett Packard, and Sun Microsystems have come to rely upon it, selling software applications and services built to ride atop the ever-growing free software infrastructure.~{ Although these applications run on GNU/Linux, it does not follow that they are themselves free software. On the contrary, most of them applications are proprietary software, and respect your freedom no more than Windows does. They may contribute to the success of GNU/Linux, but they don't contribute to the goal of freedom for which it exists. }~
+={C Compiler (GNU);GNU Debugger (GDB);GDB (GNU Debugger);Debugger;Emacs text editor;GNU Emacs;GNU C Compiler (GCC)+9;GCC (GNU C Compiler);Hewlett Packard:free software community and;IBM:free software community and;Linux;Torvalds, Linus;Sun Microsystems: free software community and}
+
+They've also come to rely upon it as a strategic weapon in the hacker community's perennial war against Microsoft, the Redmond, Washington-based company that has dominated the PC-software marketplace since the late 1980s. As owner of the popular Windows operating system, Microsoft stands to lose the most in an industry-wide shift to the GPL license. Each program in the Windows colossus is covered by copyrights and contracts (End User License Agreements, or EULAs) asserting the proprietary status of the executable, as well as the underlying source code that users can't get anyway. Incorporating code protected by the "viral" GPL into one of these programs is forbidden; to comply with the GPL's requirements, Microsoft would be legally required to make that whole program free software. Rival companies could then copy, modify, and sell improved versions of it, taking away the basis of Microsoft's lock over the users.
+={Windows (Microsoft):source code and;open source:software development, approach to;Redmond (Washington)}
+
+Hence the company's growing concern over the GPL's rate of adoption. Hence the recent Mundie speech blasting the GPL and the "open source" approach to software development and sales. (Microsoft does not even acknowledge the term "free software," preferring to use its attacks to direct attention towards the apolitical "open source" camp described in chapter 11, and away from the free software movement.) And hence Stallman's decision to deliver a public rebuttal to that speech on the same campus here today.
+
+20 years is a long time in the software industry. Consider this: in 1980, when Richard Stallman was cursing the AI Lab's Xerox laser printer, Microsoft, which dominates the worldwide software industry, was still a privately held startup. IBM, the company then regarded as the most powerful force in the computer hardware industry, had yet to introduce its first personal computer, thereby igniting the current low-cost PC market. Many of the technologies we now take for granted - the World Wide Web, satellite television, 32-bit video-game consoles - didn't even exist. The same goes for many of the companies that now fill the upper echelons of the corporate establishment, companies like AOL, Sun Microsystems, Amazon.com, Compaq, and Dell. The list goes on and on.
+={Amazon.com;AOL (America OnLine);Compaq computers;Dell computers;PCs (personal computers);personal computers (PCs)}
+
+Among those who value progress above freedom, the fact that the high-technology marketplace has come so far in such little time is cited both for and against the GNU GPL. Some argue in favor of the GPL, pointing to the short lifespan of most computer hardware platforms. Facing the risk of buying an obsolete product, consumers tend to flock to companies with the best long-term survival. As a result, the software marketplace has become a winner-take-all arena.~{ See Shubha Ghosh, "Revealing the Microsoft Windows Source Code," Gi-galaw.com (January, 2000), \\ http://www.gigalaw.com/. }~ The proprietary software environment, they say, leads to monopoly abuse and stagnation. Strong companies suck all the oxygen out of the marketplace for rival competitors and innovative startups. Others argue just the opposite. Selling software is just as risky, if not more risky, than buying software, they say. Without the legal guarantees provided by proprietary software licenses, not to mention the economic prospects of a privately owned "killer app" (i.e., a break-through technology that launches an entirely new market),~{ Killer apps don't have to be proprietary. Still, I think the reader gets the point: the software marketplace is like the lottery. The bigger the potential pay-off, the more people want to participate. For a good summary of the killer-app phenomenon, see Philip Ben-David, "Whatever Happened to the 'Killer App'?", e-Commerce News (December 7, 2000), \\ http://www.ecommercetimes.com/story/5893.html. }~ companies lose the incentive to participate. Once again, the market stagnates and innovation declines. As Mundie himself noted in his May 3rd address on the same campus, the GPL's "viral" nature "poses a threat" to any company that relies on the uniqueness of its software as a competitive asset. Added Mundie:
+={Mundie, Craig+3}
+
+_1 It also fundamentally undermines the independent commercial software sector because it effectively makes it impossible to distribute software on a basis where recipients pay for the product rather than just the cost of distribution.~{ See Craig Mundie, "The Commercial Software Model," senior vice president, Microsoft Corp., excerpted from an online transcript of Mundie's May 3, 2001, speech to the New York University Stern School of Business, \\ http://www.microsoft.com/presspass/exec/craig/05-03sharedsource.asp. }~
+
+The mutual success of GNU/Linux and Windows over the last 10years suggests that both sides on this question are sometimes right. However, free software activists such as Stallman think this is a side issue. The real question, they say, isn't whether free or proprietary software will succeed more, it's which one is more ethical.
+
+Nevertheless, the battle for momentum is an important one in the software industry. Even powerful vendors such as Microsoft rely on the support of third-party software developers whose tools, programs, and computer games make an underlying software platform such as Windows more attractive to the mainstream consumer. Citing the rapid evolution of the technology marketplace over the last 20 years, not to mention his own company's impressive track record during that period, Mundie advised listeners to not get too carried away by the free software movement's recent momentum:
+={GNU Project:Linux and, mutual success of;Linux:GNU Project and;third-party software developers supporting Microsoft}
+
+_1 Two decades of experience have shown that an economic model that protects intellectual property and a business model that recoups research and development costs can create impressive economic benefits and distribute them very broadly.~{ /{Ibid.}/ }~
+
+Such admonitions serve as the backdrop for Stallman's speech today. Less than a month after their utterance, Stallman stands with his back to one of the chalk boards at the front of the room, edgy to begin.
+
+If the last two decades have brought dramatic changes to the software marketplace, they have brought even more dramatic changes to Stallman himself. Gone is the skinny, clean-shaven hacker who once spent his entire days communing with his beloved PDP-10. In his place stands a heavy-set middle-aged man with long hair and rabbinical beard, a man who now spends the bulk of his time writing and answering email, haranguing fellow programmers, and giving speeches like the one today. Dressed in an aqua-colored T-shirt and brown polyester pants, Stallman looks like a desert hermit who just stepped out of a Salvation Army dressing room.
+
+The crowd is filled with visitors who share Stallman's fashion and grooming tastes. Many come bearing laptop computers and cellular modems, all the better to record and transmit Stallman's words to a waiting Internet audience. The gender ratio is roughly 15 males to 1 female, and 1 of the 7 or 8 females in the room comes in bearing a stuffed penguin, the official Linux mascot, while another carries a stuffed teddy bear.
+
+Agitated, Stallman leaves his post at the front of the room and takes a seat in a front-row chair, tapping commands into an already-opened laptop. For the next 10 minutes Stallman is oblivious to the growing number of students, professors, and fans circulating in front of him at the foot of the auditorium stage.
+
+Before the speech can begin, the baroque rituals of academic formality must be observed. Stallman's appearance merits not one but two introductions. Mike Uretsky, co-director of the Stern School's Center for Advanced Technology, provides the first.
+={Uretsky, Mike+5}
+
+"The role of a university is to foster debate and to have interesting discussions," Uretsky says. "This particular presentation, this seminar falls right into that mold. I find the discussion of open source particularly interesting."
+
+Before Uretsky can get another sentence out, Stallman is on his feet waving him down like a stranded motorist.
+
+"I do free software," Stallman says to rising laughter. "Open source is a different movement.
+
+"The laughter gives way to applause. The room is stocked with Stallman partisans, people who know of his reputation for verbal exactitude, not to mention his much publicized 1998 falling out with the open source software proponents. Most have come to anticipate such outbursts the same way radio fans once waited for Jack Benny's trademark, "Now cut that out!" phrase during each radio program.
+
+Uretsky hastily finishes his introduction and cedes the stage to Edmond Schonberg, a professor in the NYU computer-science department. As a computer programmer and GNU Project contributor, Schonberg knows which linguistic land mines to avoid. He deftly summarizes Stallman's career from the perspective of a modern-day programmer.
+={Schonberg, Ed.+2}
+
+"Richard is the perfect example of somebody who, by acting locally, started thinking globally [about] problems concerning the un-availability of source code," says Schonberg. "He has developed a coherent philosophy that has forced all of us to reexamine our ideas of how software is produced, of what intellectual property means, and of what the software community actually represents."~{ If this were to be said today, Stallman would object to the term "intellectual property" as carrying bias and confusion. \\ See http://www.gnu.org/philosophy/not-ipr.html. }~
+
+Schonberg welcomes Stallman to more applause. Stallman takes a moment to shut off his laptop, rises out of his chair, and takes the stage.
+
+At first, Stallman's address seems more Catskills comedy routine than political speech. "I'd like to thank Microsoft for providing me the opportunity to be on this platform," Stallman wisecracks. "For the past few weeks, I have felt like an author whose book was fortuitously banned somewhere."
+
+For the uninitiated, Stallman dives into a quick free software warm-up analogy. He likens a software program to a cooking recipe. Both provide useful step-by-step instructions on how to complete a desired task and can be easily modified if a user has special desires or circumstances. "You don't have to follow a recipe exactly," Stallman notes. "You can leave out some ingredients. Add some mushrooms, 'cause you like mushrooms. Put in less salt because your doctor said you should cut down on salt - whatever."
+
+Most importantly, Stallman says, software programs and recipes are both easy to share. In giving a recipe to a dinner guest, a cook loses little more than time and the cost of the paper the recipe was written on. Software programs require even less, usually a few mouse-clicks and a modicum of electricity. In both instances, however, the person giving the information gains two things: increased friendship and the ability to borrow interesting recipes in return.
+
+"Imagine what it would be like if recipes were packaged inside black boxes," Stallman says, shifting gears. "You couldn't see what ingredients they're using, let alone change them, and imagine if you made a copy for a friend. They would call you a pirate and try to put you in prison for years. That world would create tremendous outrage from all the people who are used to sharing recipes. But that is exactly what the world of proprietary software is like. A world in which common decency towards other people is prohibited or prevented."
+
+With this introductory analogy out of the way, Stallman launches into a retelling of the Xerox laser-printer episode. Like the recipe analogy, the laser-printer story is a useful rhetorical device. With its parable-like structure, it dramatizes just how quickly things can change in the software world. Drawing listeners back to an era before Amazon.com one-click shopping, Microsoft Windows, and Oracle databases, it asks the listener to examine the notion of software ownership free of its current corporate logos.
+
+Stallman delivers the story with all the polish and practice of a local district attorney conducting a closing argument. When he gets to the part about the Carnegie Mellon professor refusing to lend him a copy of the printer source code, Stallman pauses.
+
+"He had betrayed us," Stallman says. "But he didn't just do it to us. Chances are he did it to you."
+
+On the word "you," Stallman points his index finger accusingly at an unsuspecting member of the audience. The targeted audience member's eyebrows flinch slightly, but Stallman's own eyes have moved on. Slowly and deliberately, Stallman picks out a second listener to nervous titters from the crowd. "And I think, mostly likely, he did it to you, too," he says, pointing at an audience member three rows behind the first.
+
+By the time Stallman has a third audience member picked out, the titters have given away to general laughter. The gesture seems a bit staged, because it is. Still, when it comes time to wrap up the Xerox laser-printer story, Stallman does so with a showman's flourish. "He probably did it to most of the people here in this room - except a few, maybe, who weren't born yet in 1980," Stallman says, drawing more laughs. "[That's] because he had promised to refuse to cooperate with just about the entire population of the planet Earth."
+
+Stallman lets the comment sink in for a half-beat. "He had signed a nondisclosure agreement," Stallman adds.
+
+Richard Matthew Stallman's rise from frustrated academic to political leader over the last 20 years speaks to many things. It speaks to Stallman's stubborn nature and prodigious will. It speaks to the clearly articulated vision and values of the free software movement Stallman helped build. It speaks to the high-quality software programs Stallman has built, programs that have cemented Stallman's reputation as a programming legend. It speaks to the growing momentum of the GPL, a legal innovation that many Stallman observers see as his most momentous accomplishment.
+
+Most importantly, it speaks to the changing nature of political power in a world increasingly beholden to computer technology and the software programs that power that technology.
+
+Maybe that's why, even at a time when most high-technology stars are on the wane, Stallman's star has grown. Since launching the GNU Project in 1984,~{ The acronym GNU stands for "GNU's not Unix." In another portion of the May 29, 2001, NYU speech, Stallman summed up the acronym's origin: \\ We hackers always look for a funny or naughty name for a program, because naming a program is half the fun of writing the program. We also had a tradition of recursive acronyms, to say that the program that you're writing is similar to some existing program... I looked for a recursive acronym for Something Is Not UNIX. And I tried all 26 letters and discovered that none of them was a word. I decided to make it a contraction. That way I could have a three-letter acronym, for Something's Not UNIX. And I tried letters, and I came across the word "GNU." That was it. \\ Although a fan of puns, Stallman recommends that software users pronounce the "g" at the beginning of the acronym (i.e., "gah-new").Not only does this avoid confusion with the word "gnu," the name of the African antelope, Connochaetes gnou, it also avoids confusion with the adjective "new." "We've been working on it for 17 years now, so it is not exactly new any more," Stallman says. \\ Source: author notes and online transcript of "Free Software: Freedom and Cooperation," Richard Stallman's May 29, 2001, speech at New York University, \\ http://www.gnu.org/events/rms-nyu-2001-transcript.txt. }~ Stallman has been at turns ignored, satirized, vilified, and attacked-both from within and without the free software movement. Through it all, the GNU Project has managed to meet its milestones, albeit with a few notorious delays, and stay relevant in a software marketplace several orders of magnitude more complex than the one it entered 18 years ago. So too has the free software ideology, an ideology meticulously groomed by Stallman himself.
+
+To understand the reasons behind this currency, it helps to examine Richard Stallman both in his own words and in the words of the people who have collaborated and battled with him along the way. The Richard Stallman character sketch is not a complicated one. If any person exemplifies the old adage "what you see is what you get," it's Stallman.
+
+"I think if you want to understand Richard Stallman the human being, you really need to see all of the parts as a consistent whole," advises Eben Moglen, legal counsel to the Free Software Foundation and professor of law at Columbia University Law School. "All those personal eccentricities that lots of people see as obstacles to getting to know Stallman really 'are' Stallman: Richard's strong sense of personal frustration, his enormous sense of principled ethical commitment, his inability to compromise, especially on issues he considers fundamental. These are all the very reasons Richard did what he did when he did."
+={Columbia University;Moglen, Eben+2}
+
+Explaining how a journey that started with a laser printer would eventually lead to a sparring match with the world's richest corporation is no easy task. It requires a thoughtful examination of the forces that have made software ownership so important in today's society. It also requires a thoughtful examination of a man who, like many political leaders before him, understands the malleability of human memory. It requires an ability to interpret the myths and politically laden codewords that have built up around Stallman over time. Finally, it requires an understanding of Stallman's genius as a programmer and his failures and successes in translating that genius to other pursuits.
+
+When it comes to offering his own summary of the journey, Stallman acknowledges the fusion of personality and principle observed by Moglen. "Stubbornness is my strong suit," he says. "Most people who attempt to do anything of any great difficulty eventually get discouraged and give up. I never gave up."
+
+He also credits blind chance. Had it not been for that run-in over the Xerox laser printer, had it not been for the personal and political conflicts that closed out his career as an MIT employee, had it not been for a half dozen other timely factors, Stallman finds it very easy to picture his life following a different career path. That being said, Stallman gives thanks to the forces and circumstances that put him in the position to make a difference.
+
+"I had just the right skills," says Stallman, summing up his decision for launching the GNU Project to the audience. "Nobody was there but me, so I felt like, 'I'm elected. I have to work on this. If not me, who?'"
+
+1~ Chapter 3 - A Portrait of the Hacker as a Young Man
+={Stallman, Richard M.:childhood+61}
+
+Richard Stallman's mother, Alice Lippman, still remembers the moment she realized her son had a special gift.
+={Lippman, Alice+60}
+
+"I think it was when he was eight," Lippman recalls.
+
+The year was 1961, and Lippman, a recently divorced single mother, was whiling away a weekend afternoon within the family's tiny one-bedroom apartment on Manhattan's Upper West Side. Leafing throug ha copy of Scientific American, Lippman came upon her favorite section, the Martin Gardner-authored column titled "Mathematical Games." A substitute art teacher at the time, Lippman enjoyed Gardner's column for the brain-teasers it provided. With her son already ensconced in a book on the nearby sofa, Lippman decided to take a crack at solving the week's feature puzzle.
+
+"I wasn't the best person when it came to solving the puzzles," she admits. "But as an artist, I found they really helped me work through conceptual barriers."
+
+Lippman says her attempt to solve the puzzle met an immediate brick wall. About to throw the magazine down in disgust, Lippman was surprised by a gentle tug on her shirt sleeve.
+
+"It was Richard," she recalls, "He wanted to know if I needed any help."
+
+Looking back and forth, between the puzzle and her son, Lippman says she initially regarded the offer with skepticism. "I asked Richard if he'd read the magazine," she says. "He told me that, yes, he had and what's more he'd already solved the puzzle. The next thing I know, he starts explaining to me how to solve it."
+
+Hearing the logic of her son's approach, Lippman's skepticism quickly gave way to incredulity. "I mean, I always knew he was a bright boy," she says, "but this was the first time I'd seen anything that suggested how advanced he really was."
+
+Thirty years after the fact, Lippman punctuates the memory with a laugh. "To tell you the truth, I don't think I ever figured out how to solve that puzzle," she says. "All I remember is being amazed he knew the answer."
+
+Seated at the dining-room table of her second Manhattan apartment - the same spacious three-bedroom complex she and her son moved to following her 1967 marriage to Maurice Lippman, now deceased - Alice Lippman exudes a Jewish mother's mixture of pride and bemusement when recalling her son's early years. The nearby dining-room credenza offers an eight-by-ten photo of Stallman glowering in full beard and doctoral robes. The image dwarfs accompanying photos of Lippman's nieces and nephews, but before a visitor can make too much of it, Lippman makes sure to balance its prominent placement with an ironic wisecrack."
+={Lippman, Maurice}
+
+Richard insisted I have it after he received his honorary doctorate at the University of Glasgow," says Lippman. "He said to me, 'Guess what, mom? It's the first graduation I ever attended.'"~{ One of the major background sources for this chapter was the interview "Richard Stallman: High School Misfit, Symbol of Free Software, MacArthur-Certified Genius" by Michael Gross, author of the 1999 book Talking About My Generation , a collection of interviews with notable personalities from the so-called "Baby Boom" generation. Although Stallman did not make it into the book, Gross published the interview as an online supplement to the book's web site. The URL for the interview has changed several times since I first came across it. According to various readers who have gone searching for it, you can now find the interview at \\ http://www.mgross.com/MoreThgsChng/interviews/stallman1.html. }~
+={University of Glasgow}
+
+Such comments reflect the sense of humor that comes with raising a child prodigy. Make no mistake, for every story Lippman hears and reads about her son's stubbornness and unusual behavior, she can deliver at least a dozen in return.
+
+"He used to be so conservative," she says, throwing up her hands in mock exasperation. "We used to have the worst arguments right here at this table. I was part of the first group of public city school teachers that struck to form a union, and Richard was very angry with me. He saw unions as corrupt. He was also very opposed to social security. He thought people could make much more money investing it on their own. Who knew that within 10 years he would become so idealistic? All I remember is his stepsister coming to me and saying, 'What is he going to be when he grows up? A fascist?'"~{ RMS: I don't remember telling her this. All I can say is I strongly disagree with those views now. When I was in my teens, I lacked compassion for the difficulties most people encounter in life; my problems were different. I did not appreciate how the wealthy will reduce most people to poverty unless we organize at all levels to stop them. I did not understand how hard it is for most people to resist social pressure to do foolish things, such as spend all their money instead of saving, since I hardly even noticed the pressure myself. In addition, unions in the 60s, when they were very powerful, were sometimes arrogant or corrupt. But they are much weaker today, and the result is that economic growth, when it occurs, benefits mainly the rich. }~
+
+As a single parent for nearly a decade - she and Richard's father, Daniel Stallman, were married in 1948, divorced in 1958, and split custody of their son afterwards - Lippman can attest to her son's aversion to authority. She can also attest to her son's lust for knowledge. It was during the times when the two forces intertwined, Lippman says, that she and her son experienced their biggest battles.
+={Stallman, Daniel}
+
+"It was like he never wanted to eat," says Lippman, recalling the behavior pattern that set in around age eight and didn't let up until her son's high-school graduation in 1970. "I'd call him for dinner, and he'd never hear me. I'd have to call him 9 or 10 times just to get his attention. He was totally immersed."
+
+Stallman, for his part, remembers things in a similar fashion, albeit with a political twist.
+
+"I enjoyed reading," he says. "If I wanted to read, and my mother told me to go to the kitchen and eat or go to sleep, I wasn't going to listen. I saw no reason why I couldn't read. No reason why she should be able to tell me what to do, period. Essentially, what I had read about, ideas such as democracy and individual freedom, I applied to myself. I didn't see any reason to exclude children from these principles."
+
+The belief in individual freedom over arbitrary authority extended to school as well. Two years ahead of his classmates by age 11, Stallman endured all the usual frustrations of a gifted public-school student. It wasn't long after the puzzle incident that his mother attended the first in what would become a long string of parent-teacher conferences.
+
+"He absolutely refused to write papers," says Lippman, recalling an early controversy. "I think the last paper he wrote before his senior year in high school was an essay on the history of the number system in the west for a fourth-grade teacher." To be required to choose a specific topic when there was nothing he actually wanted to write about was almost impossible for Stallman, and painful enough to make him go to great lengths to avoid such situations.
+
+Gifted in anything that required analytical thinking, Stallman gravitated toward math and science at the expense of his other studies. What some teachers saw as single-mindedness, however, Lippman saw as impatience. Math and science offered simply too much opportunity to learn, especially in comparison to subjects and pursuits for which her son seemed less naturally inclined. Around age 10 or 11, when the boys in Stallman's class began playing a regular game of touch football, she remembers her son coming home in a rage. "He wanted to play so badly, but he just didn't have the coordination skills," Lippman recalls. "It made him so angry."
+
+The anger eventually drove her son to focus on math and science all the more. Even in the realm of science, however, her son's impatience could be problematic. Poring through calculus textbooks by age seven, Stallman saw little need to dumb down his discourse for adults. Sometime, during his middle-school years, Lippman hired a student from nearby Columbia University to play big brother to her son. The student left the family's apartment after the first session and never came back. "I think what Richard was talking about went over his head," Lippman speculates.
+
+Another favorite maternal memory dates back to the early 1960s, shortly after the puzzle incident. Around age seven, two years after the divorce and relocation from Queens, Richard took up the hobby of launching model rockets in nearby Riverside Drive Park. What started as aimless fun soon took on an earnest edge as her son began recording the data from each launch. Like the interest in mathematical games,the pursuit drew little attention until one day, just before a major NASA launch, Lippman checked in on her son to see if he wanted to watch.
+
+"He was fuming," Lippman says. "All he could say to me was, 'But I'm not published yet.' Apparently he had something that he really wanted to show NASA." Stallman doesn't remember the incident, but thinks it more likely that he was anguished because he didn't have anything to show.
+
+Such anecdotes offer early evidence of the intensity that would become Stallman's chief trademark throughout life. When other kids came to the table, Stallman stayed in his room and read. When other kids played Johnny Unit as, Stallman played spaceman. "I was weird," Stallman says, summing up his early years succinctly in a 1999 interview. "After a certain age, the only friends I had were teachers."~{ /{Ibid.}/ }~ Stallman was not ashamed of his weird characteristics, distinguishing them from the social ineptness that he did regard as a failing. However, both contributed together to his social exclusion.
+
+Although it meant courting more run-ins at school, Lippman decided to indulge her son's passion. By age 12, Richard was attending science camps during the summer and private school during the school year. When a teacher recommended her son enroll in the Columbia Science Honors Program, a post-Sputnik program designed for gifted middle- and high-school students in New York City, Stallman added to his extracurriculars and was soon commuting uptown to the Columbia University campus on Saturdays.
+={Columbia University;Science Honors Program (Columbia)+2}
+
+Dan Chess, a fellow classmate in the Columbia Science Honors Program, recalls Richard Stallman seeming a bit weird even among the students who shared a similar lust for math and science. "We were all geeks and nerds, but he was unusually poorly adjusted," recalls Chess, now a mathematics professor at Hunter College. "He was also smart as shit. I've known a lot of smart people, but I think he was the smartest person I've ever known."
+={Chess, Dan;Hunter College}
+
+Seth Breidbart, a fellow Columbia Science Honors Program alumnus, offers bolstering testimony. A computer programmer who has kept in touch with Stallman thanks to a shared passion for science fiction and science-fiction conventions, he recalls the 15-year-old, buzz-cut-wearing Stallman as "scary," especially to a fellow 15-year-old.
+={Breidbart, Seth+1}
+
+"It's hard to describe," Breidbart says. "It wasn't like he was unapproachable. He was just very intense. [He was] very knowledgeable but also very hardheaded in some ways."
+
+Such descriptions give rise to speculation: are judgment-laden adjectives like "intense" and "hardheaded" simply a way to describe traits that today might be categorized under juvenile behavioral disorder? A December, 2001, /{Wired}/ magazine article titled "The Geek Syndrome" paints the portrait of several scientifically gifted children diagnosed with high-functioning autism or Asperger Syndrome. In many ways, the parental recollections recorded in the /{Wired}/ article are eerily similar to the ones offered by Lippman. Stallman also speculates about this. In the interview for a 2000 profile for the /{Toronto Star}/, Stallman said he wondered if he were "borderline autistic." The article inaccurately cited the speculation as a certainty.~{ See Judy Steed, Toronto Star, BUSINESS, (October 9, 2000): C03. His vision of free software and social cooperation stands in stark contrast to the isolated nature of his private life. A Glenn Gould-like eccentric, the Canadian pianist was similarly brilliant, articulate, and lonely. Stallman considers himself afflicted, to some degree, by autism: a condition that, he says, makes it difficult for him to interact with people. }~
+={Asperger Syndrome+1;autism+5;Geek Syndrome, The (Silberman)+1;Wired magazine;Toronto Star;Silberman, Steve+1;Stallman, Richard M.:behavioral disorders+1}
+
+Such speculation benefits from the fast and loose nature of most so-called "behavioral disorders" nowadays, of course. As Steve Silberman, author of "The Geek Syndrome," notes, American psychiatrists have only recently come to accept Asperger Syndrome as a valid umbrella term covering a wide set of behavioral traits. The traits range from poor motor skills and poor socialization to high intelligence and an almost obsessive affinity for numbers, computers, and ordered systems.~{ See Steve Silberman, "The Geek Syndrome," Wired (December, 2001), \\ http://www.wired.com/wired/archive/9.12/aspergers_pr.html. }~
+={Stallman, Richard M.:childhood, behavioral disorders}
+
+"It's possible I could have had something like that," Stallman says. "On the other hand, one of the aspects of that syndrome is difficulty following rhythms. I can dance. In fact, I love following the most complicated rhythms. It's not clear cut enough to know." Another possibility is that Stallman had a "shadow syndrome" which goes someway in the direction of Asperger's syndrome but without going beyond the limits of normality.~{ See John Ratey and Catherine Johnson, "Shadow Syndromes." }~
+
+Chess, for one, rejects such attempts at back-diagnosis. "I never thought of him [as] having that sort of thing," he says. "He was just very unsocialized, but then, we all were."
+={Chess, Dan}
+
+Lippman, on the other hand, entertains the possibility. She recalls a few stories from her son's infancy, however, that provide fodder for speculation. A prominent symptom of autism is an over-sensitivity to noises and colors, and Lippman recalls two anecdotes that stand out in this regard. "When Richard was an infant, we'd take him to the beach," she says. "He would start screaming two or three blocks before we reached the surf. It wasn't until the third time that we figured out what was going on: the sound of the surf was hurting his ears." She also recalls a similar screaming reaction in relation to color: "My mother had bright red hair, and every time she'd stoop down to pick him up, he'd let out a wail."
+
+In recent years, Lippman says she has taken to reading books about autism and believes that such episodes were more than coincidental. "I do feel that Richard had some of the qualities of an autistic child," she says. "I regret that so little was known about autism back then."
+
+Over time, however, Lippman says her son learned to adjust. By age seven, she says, her son had become fond of standing at the front window of subway trains, mapping out and memorizing the labyrinthian system of railroad tracks underneath the city. It was a hobby that relied on an ability to accommodate the loud noises that accompanied each train ride. "Only the initial noise seemed to bother him," says Lippman. "It was as if he got shocked by the sound but his nerves learned how to make the adjustment."
+
+For the most part, Lippman recalls her son exhibiting the excitement, energy, and social skills of any normal boy. It wasn't until after a series of traumatic events battered the Stallman household, she says, that her son became introverted and emotionally distant.
+
+The first traumatic event was the divorce of Alice and Daniel Stallman, Richard's father. Although Lippman says both she and her ex-husband tried to prepare their son for the blow, she says the blow was devastating nonetheless. "He sort of didn't pay attention when we first told him what was happening," Lippman recalls. "But the reality smacked him in the face when he and I moved into a new apartment. The first thing he said was, 'Where's Dad's furniture?'"
+={divorce of Alice and Daniel Stallman;Stallman, Daniel}
+
+For the next decade, Stallman would spend his weekdays at his mother's apartment in Manhattan and his weekends at his father's home in Queens. The shuttling back and forth gave him a chance to study a pair of contrasting parenting styles that, to this day, leaves Stallman firmly opposed to the idea of raising children himself. Speaking about his father, a World War II vet who died in early 2001, Stallman balances respect with anger. On one hand, there is the man whose moral commitment led him to learn French just so he could be more helpful to Allies when they'd finally fight the Nazis in France. On the other hand, there was the parent who always knew how to craft a put-down for cruel effect.~{ Regrettably, I did not get a chance to interview Daniel Stallman for this book. During the early research for this book, Stallman informed me that his father suffered from Alzheimer's. When I resumed research in late 2001, I learned, sadly, that Daniel Stallman had died earlier in the year. }~
+
+"My father had a horrible temper," Stallman says. "He never screamed, but he always found a way to criticize you in a cold, designed-to-crush way."
+
+As for life in his mother's apartment, Stallman is less equivocal. "That was war," he says. "I used to say in my misery, 'I want to go home,' meaning to the nonexistent place that I'll never have."
+
+For the first few years after the divorce, Stallman found the tranquility that eluded him in the home of his paternal grandparents. One died when he was 8, and the other when he was 10. For Stallman, the loss was devastating. "I used to go and visit and feel I was in a loving, gentle environment," Stallman recalls. "It was the only place I ever found one, until I went away to college."
+
+Lippman lists the death of Richard's paternal grandparents as the second traumatic event. "It really upset him," she says. He was very close to both his grandparents. Before they died, he was very outgoing, almost a leader-of-the-pack type with the other kids. After they died, he became much more emotionally withdrawn.
+
+From Stallman's perspective, the emotional withdrawal was merely an attempt to deal with the agony of adolescence. Labeling his teenage years a "pure horror," Stallman says he often felt like a deaf person amid a crowd of chattering music listeners.
+
+"I often had the feeling that I couldn't understand what other people were saying," says Stallman, recalling his sense of exclusion. "I could understand the words, but something was going on underneath the conversations that I didn't understand. I couldn't understand why people were interested in the things other people said."
+
+For all the agony it produced, adolescence would have an encouraging effect on Stallman's sense of individuality. At a time when most of his classmates were growing their hair out, Stallman preferred to keep his short. At a time when the whole teenage world was listening to rock and roll, Stallman preferred classical music. A devoted fan of science fiction, /{Mad}/ magazine, and late-night TV, Stallman came to have a distinctly off-the-wall personality that met with the incomprehension of parents and peers alike.
+
+"Oh, the puns," says Lippman, still exasperated by the memory of her son's teenage personality. "There wasn't a thing you could say at the dinner table that he couldn't throw back at you as a pun."
+
+Outside the home, Stallman saved the jokes for the adults who tended to indulge his gifted nature. One of the first was a summer-camp counselor who lent Stallman a manual for the IBM 7094 computer during his 8th or 9th year. To a pre teenager fascinated with numbers and science, the gift was a godsend.~{ Stallman, an atheist, would probably quibble with this description. Suffice it to say, it was something Stallman welcomed. See Gross (1999): "As soon as I heard about computers, I wanted to see one and play with one." }~ Soon, Stallman was writing out programs on paper in the instructions of the 7094. There was no computer around to run them on, and he had no real applications to use one for, but he yearned to write a program - any program whatsoever. He asked the counselor for arbitrary suggestions of something to code.
+={IBM 7094 computer+1}
+
+With the first personal computer still a decade away, Stallman would be forced to wait a few years before getting access to his first computer. His chance finally came during his senior year of high school. The IBM New York Scientific Center, a now-defunct research facility in downtown Manhattan, offered Stallman the chance to try to write his first real program. His fancy was to write a pre-processor for the programming language PL/I, designed to add the tensor algebra summation convention as a feature to the language. "I first wrote it in PL/I, then started over in assembler language when the compiled PL/I program was too big to fit in the computer," he recalls.
+={assembler language;IBM:New York Scientific Center;IBM New York Scientific Center;PL/I programming language;Stallman, Richard M.:childhood, first computer program}
+
+For the summer after high-school graduation, the New York Scientific Center hired him. Tasked with writing a numerical analysis program in Fortran, he finished that in a few weeks, acquiring such a distaste for the Fortran language that he vowed never to write any-thing in it again. Then he spent the rest of the summer writing a text-editor in APL.
+
+Simultaneously, Stallman had held a laboratory-assistant position in the biology department at Rockefeller University. Although he was already moving toward a career in math or physics, Stallman's analytical mind impressed the lab director enough that a few years after Stallman departed for college, Lippman received an unexpected phone call. "It was the professor at Rockefeller," Lippman says. "He wanted to know how Richard was doing. He was surprised to learn that he was working in computers. He'd always thought Richard had a great future ahead of him as a biologist."
+={Rockefeller University}
+
+Stallman's analytical skills impressed faculty members at Columbia as well, even when Stallman himself became a target of their ire. "Typically once or twice an hour [Stallman] would catch some mistake in the lecture," says Breidbart. "And he was not shy about letting the professors know it immediately. It got him a lot of respect but not much popularity."
+
+Hearing Breidbart's anecdote retold elicits a wry smile from Stallman. "I may have been a bit of a jerk sometimes," he admits. "But I found kindred spirits among teachers, because they, too, liked to learn. Kids, for the most part, didn't. At least not in the same way."
+={Breidbart, Seth}
+
+Hanging out with the advanced kids on Saturday nevertheless encouraged Stallman to think more about the merits of increased socialization. With college fast approaching, Stallman, like many in his Columbia Science Honors Program, had narrowed his list of desired schools down to two choices: Harvard and MIT. Hearing of her son's desire to move on to the Ivy League, Lippman became concerned. As a 15-year-old high-school junior, Stallman was still having run-ins with teachers and administrators. Only the year before, he had pulled straight A's in American History, Chemistry, French, and Algebra, but a glaring F in English reflected the ongoing boycott of writing assignments. Such miscues might draw a knowing chuckle at MIT, but at Harvard, they were a red flag.
+={Harvard University+7;MIT Massachusetts Institute of Technology}
+
+During her son's junior year, Lippman says she scheduled an appointment with a therapist. The therapist expressed instant concern over Stallman's unwillingness to write papers and his run-ins with teachers. Her son certainly had the intellectual wherewithal to succeed at Harvard, but did he have the patience to sit through college classes that required a term paper? The therapist suggested a trial run. If Stallman could make it through a full year in New York City public schools, including an English class that required term papers, he could probably make it at Harvard. Following the completion of his junior year, Stallman promptly enrolled in public summer school downtown and began making up the mandatory humanities classes he had shunned earlier in his high-school career.
+={Louis D. Brandeis High School+3}
+
+By fall, Stallman was back within the mainstream population of New York City high-school students, at Louis D. Brandeis High School on on West 84th Street. It wasn't easy sitting through classes that seemed remedial in comparison with his Saturday studies at Columbia, but Lippman recalls proudly her son's ability to toe the line.
+
+"He was forced to kowtow to a certain degree, but he did it," Lippman says. "I only got called in once, which was a bit of a miracle. It was the calculus teacher complaining that Richard was interrupting his lesson. I asked how he was interrupting. He said Richard was always accusing the teacher of using a false proof. I said, 'Well, is he right?' The teacher said, 'Yeah, but I can't tell that to the class. They wouldn't understand.'"
+
+By the end of his first semester at Brandeis High, things were falling into place. A 96 in English wiped away much of the stigma of the 60 earned 2 years before. For good measure, Stallman backed it up with top marks in American History, Advanced Placement Calculus, and Microbiology. The crowning touch was a perfect 100 in Physics. Though still a social outcast, Stallman finished his 10 months at Brandeis as the fourth-ranked student in a class of 789.
+
+Outside the classroom, Stallman pursued his studies with even more diligence, rushing off to fulfill his laboratory-assistant duties at Rockefeller University during the week and dodging the Vietnam protesters on his way to Saturday school at Columbia. It was there, while the rest of the Science Honors Program students sat around discussing their college choices, that Stallman finally took a moment to participate in the preclass bull session.
+
+Recalls Breidbart, "Most of the students were going to Harvard and MIT, of course, but you had a few going to other Ivy League schools. As the conversation circled the room, it became apparent that Richard hadn't said anything yet. I don't know who it was, but somebody got up the courage to ask him what he planned to do."
+={Breidbart, Seth+1}
+
+Thirty years later, Breidbart remembers the moment clearly. As soon as Stallman broke the news that he, too, would be attending Harvard University in the fall, an awkward silence filled the room. Almost as if on cue, the corners of Stallman's mouth slowly turned upward into a self-satisfied smile. Says Breidbart, "It was his silent way of saying, 'That's right. You haven't got rid of me yet.'"
+
+1~ Chapter 4 - Impeach God
+
+Although their relationship was fraught with tension, Richard Stallman would inherit one noteworthy trait from his mother: a passion for progressive politics.
+
+It was an inherited trait that would take several decades to emerge, however. For the first few years of his life, Stallman lived in what he now admits was a "political vacuum."~{ See Michael Gross, "Richard Stallman: High School Misfit, Symbol of Free Software, Mac Arthur-certified Genius" (1999). }~ Like most Americans during the Eisenhower age, the Stallman family spent the Fifties trying to recapture the normalcy lost during the wartime years of the 1940s.
+
+"Richard's father and I were Democrats but happy enough to leave it at that," says Lippman, recalling the family's years in Queens. "We didn't get involved much in local or national politics."
+={Lippman, Alice:political identity of+11}
+
+That all began to change, however, in the late 1950s when Alice divorced Daniel Stallman. The move back to Manhattan represented more than a change of address; it represented a new, independent identity and a jarring loss of tranquility.
+={Stallman, Daniel}
+
+"I think my first taste of political activism came when I went to the Queens public library and discovered there was only a single book on divorce in the whole library," recalls Lippman. "It was very controlled by the Catholic church, at least in Elmhurst, where we lived. I think that was the first inkling I had of the forces that quietly control our lives."
+={Elmhurst (New York);Queens public library}
+
+Returning to her childhood neighborhood, Manhattan's Upper West Side, Lippman was shocked by the changes that had taken place since her departure to Hunter College a decade and a half before. The sky-rocketing demand for post-war housing had turned the neighborhood into a political battleground. On one side stood the pro-development city-hall politicians and businessmen hoping to rebuild many of the neighborhood's blocks to accommodate the growing number of white-collar workers moving into the city. On the other side stood the poor Irish and Puerto Rican tenants who had found an affordable haven in the neighborhood.
+={Hunter College}
+
+At first, Lippman didn't know which side to choose. As a new resident, she felt the need for new housing. As a single mother with minimal income, however, she shared the poorer tenants' concern over the growing number of development projects catering mainly to wealthy residents. Indignant, Lippman began looking for ways to combat the political machine that was attempting to turn her neighborhood into a clone of the Upper East Side.
+
+Lippman says her first visit to the local Democratic party headquarters came in 1958. Looking for a day-care center to take care of her son while she worked, she had been appalled by the conditions encountered at one of the city-owned centers that catered to low-income residents. "All I remember is the stench of rotten milk, the dark hallways, the paucity of supplies. I had been a teacher in private nursery schools. The contrast was so great. We took one look at that room and left. That stirred me up."
+={Democratic party+3}
+
+The visit to the party headquarters proved disappointing, however. Describing it as "the proverbial smoke-filled room," Lippman says she became aware for the first time that corruption within the party might actually be the reason behind the city's thinly disguised hostility toward poor residents. Instead of going back to the headquarters, Lippman decided to join up with one of the many clubs aimed at reforming the Democratic party and ousting the last vestiges of the Tammany Hall machine. Dubbed the Woodrow Wilson/FDR Reform Democratic Club, Lippman and her club began showing up at planning and city-council meetings, demanding a greater say.
+={Woodrow Wilson/FDR Reform Democratic Club;Tammany Hall+1}
+
+"Our primary goal was to fight Tammany Hall, Carmine DeSapio and his henchman,"~{ Carmine DeSapio holds the dubious distinction of being the first Italian-American boss of Tammany Hall, the New York City political machine. For more information on DeSapio and the politics of post-war New York, see John Davenport, "Skinning the Tiger: Carmine DeSapio and the End of the Tammany Era," New York Affairs (1975): 3:1. }~ says Lippman. "I was the representative to the city council and was very much involved in creating a viable urban-renewal plan that went beyond simply adding more luxury housing to the neighborhood."
+={DeSapio, Carmine}
+
+Such involvement would blossom into greater political activity during the 1960s. By 1965, Lippman had become an "outspoken" supporter for political candidates like William Fitts Ryan, a Democrat elected to Congress with the help of reform clubs and one of the first U.S. representatives to speak out against the Vietnam War.
+={Vietnam War+10;Ryan, William Fitts}
+
+It wasn't long before Lippman, too, was an outspoken opponent of U.S. involvement in Indochina. "I was against the Vietnam War from the time Kennedy sent troops," she says. "I had read the stories by reporters and journalists sent to cover the early stages of the conflict. I really believed their forecast that it would become a quagmire."
+={Indochina}
+
+Such opposition permeated the Stallman-Lippman household. In 1967, Lippman remarried. Her new husband, Maurice Lippman, a major in the Air National Guard, resigned his commission to demonstrate his opposition to the war. Lippman's stepson, Andrew Lippman, was at MIT and temporarily eligible for a student deferment. Still, the threat of induction should that deferment disappear, as it eventually did, made the risk of U.S. escalation all the more immediate. Finally, there was Richard who, though younger, faced the prospect of being drafted as the war lasted into the 1970s.
+={Lippman, Andrew;Lippman, Maurice;MIT Massachusetts Institute of Technology}
+
+"Vietnam was a major issue in our household," says Lippman. "We talked about it constantly: what would we do if the war continued, what steps Richard or his stepbrother would take if they got drafted. We were all opposed to the war and the draft. We really thought it was immoral."
+
+For Stallman, the Vietnam War elicited a complex mixture of emotions: confusion, horror, and, ultimately, a profound sense of political impotence. As a kid who could barely cope in the mild authoritarian universe of private school, Stallman experienced a shiver whenever the thought of Army boot camp presented itself. He did not think he could get through it and emerge sane.
+={draft (Vietnam War)+6}
+
+"I was devastated by the fear, but I couldn't imagine what to do and didn't have the guts to go demonstrate," recalls Stallman, whose March 16th birthday earned him a low number in the dreaded draft lottery. This did not affect him immediately, since he had a college deferment, one of the last before the U.S. stopped granting them; but it would affect him in a few years. "I couldn't envision moving to Canada or Sweden. The idea of getting up by myself and moving somewhere. How could I do that? I didn't know how to live by myself. I wasn't the kind of person who felt confident in approaching things like that."
+
+Stallman says he was impressed by the family members who did speak out. Recalling a sticker, printed and distributed by his father, likening the My Lai massacre to similar Nazi atrocities in World War II, he says he was "excited" by his father's gesture of outrage. "I admired him for doing it," Stallman says. "But I didn't imagine that I could do anything. I was afraid that the juggernaut of the draft was going to destroy me."
+
+However, Stallman says he was turned off by the tone and direction of much of that movement. Like other members of the Science Honors Program, he saw the weekend demonstrations at Columbia as little more than a distracting spectacle.~{ Chess, another Columbia Science Honors Program alum, describes the protests as "background noise." "We were all political," he says, "but the SHP was important. We would never have skipped it for a demonstration." }~ Ultimately, Stallman says, the irrational forces driving the anti-war movement became indistinguishable from the irrational forces driving the rest of youth culture. Instead of worshiping the Beatles, girls in Stallman's age group were suddenly worshiping firebrands like Abbie Hoffman and Jerry Rubin. To a kid already struggling to comprehend his teenage peers, slogans like "make love not war" had a taunting quality. Stallman did not want to make war, at least not in Southeast Asia, but nobody was inviting him to make love either.
+={Beatles;Hoffman, Abbie;Rubin, Jerry;Science Honors Program (Columbia)}
+
+"I didn't like the counter culture much," Stallman recalls. "I didn't like the music. I didn't like the drugs. I was scared of the drugs. I especially didn't like the anti-intellectualism, and I didn't like the prejudice against technology. After all, I loved a computer. And I didn't like the mindless anti-Americanism that I often encountered. There were people whose thinking was so simplistic that if they disapproved of the conduct of the U.S. in the Vietnam War, they had to support the North Vietnamese. They couldn't imagine a more complicated position, I guess."
+
+Such comments underline a trait that would become the key to Stallman's own political maturation. For Stallman, political confidence was directly proportionate to personal confidence. By 1970, Stallman had become confident in few things outside the realm of math and science. Nevertheless, confidence in math gave him enough of a foundation to examine the extremes of the anti-war movement in purely logical terms. Doing so, Stallman found the logic wanting. Although opposed to the war in Vietnam, Stallman saw no reason to disavow war as a means for defending liberty or correcting injustice.
+
+In the 1980s, a more confident Stallman decided to make up for his past inactivity by participating in mass rallies for abortion rights in Washington DC. "I became dissatisfied with my earlier self for failing in my duty to protest the Vietnam War," he explains.
+
+In 1970, Stallman left behind the nightly dinnertime conversations about politics and the Vietnam War as he departed for Harvard. Looking back, Stallman describes the transition from his mother's Manhattan apartment to life in a Cambridge dorm as an "escape." At Harvard, he could go to his room and have peace whenever he wanted it. Peers who watched Stallman make the transition, however, saw little to suggest a liberating experience.
+={Harvard University+22}
+
+"He seemed pretty miserable for the first while at Harvard," recalls Dan Chess, a classmate in the Science Honors Program who also matriculated at Harvard. "You could tell that human interaction was really difficult for him, and there was no way of avoiding it at Harvard. Harvard was an intensely social kind of place."
+={Chess, Dan;Science Honors Program (Columbia)+1}
+
+To ease the transition, Stallman fell back on his strengths: math and science. Like most members of the Science Honors Program, Stallman breezed through the qualifying exam for Math 55, the legendary "boot camp" class for freshman mathematics "concentrators" at Harvard. Within the class, members of the Science Honors Program formed a durable unit. "We were the math mafia," says Chess with a laugh. "Harvard was nothing, at least compared with the SHP."
+={Math 55 (Harvard University)+9}
+
+To earn the right to boast, however, Stallman, Chess, and the other SHP alumni had to get through Math 55. Promising four years worth of math in two semesters, the course favored only the truly devout. "It was an amazing class," says David Harbater, a former "math mafia" member and now a professor of mathematics at the University of Pennsylvania. "It's probably safe to say there has never been a class for beginning college students that was that intense and that advanced. The phrase I say to people just to get it across is that, among other things, by the second semester we were discussing the differential geometry of Banach manifolds. That's usually when their eyes bug out, because most people don't start talking about Banach manifolds until their second year of graduate school."
+={Harbater, David+2;University of Pennsylvania}
+
+Starting with 75 students, the class quickly melted down to 20by the end of the second semester. Of that 20, says Harbater, "only 10 really knew what they were doing." Of that 10, 8 would go on to become future mathematics professors, 1 would go on to teach physics.
+
+"The other one," emphasizes Harbater, "was Richard Stallman." Seth Breidbart, a fellow Math 55 classmate, remembers Stallman distinguishing himself from his peers even then.
+={Breidbart, Seth+14}
+
+"He was a stickler in some very strange ways," says Breidbart. There is a standard technique in math which everybody does wrong. It's an abuse of notation where you have to define a function for something and what you do is you define a function and then you prove that it's well defined. Except the first time he did and presented it, he defined a relation and proved that it's a function. It's the exact same proof, but he used the correct terminology, which no one else did. That's just the way he was."
+
+It was in Math 55 that Richard Stallman began to cultivate a reputation for brilliance. Breidbart agrees, but Chess, whose competitive streak refused to yield, says the realization that Stallman might be the best mathematician in the class didn't set in until the next year. "It was during a class on Real Analysis," says Chess, now a math professor at Hunter College. "I actually remember in a proof about complex valued measures that Richard came up with an idea that was basically a metaphor from the calculus of variations. It was the first time I ever saw somebody solve a problem in a brilliantly original way."
+={Hunter College}
+
+For Chess, it was a troubling moment. Like a bird flying into a clear glass window, it would take a while to realize that some levels of insight were simply off limits.
+
+"That's the thing about mathematics," says Chess. "You don't have to be a first-rank mathematician to recognize first-rate mathematical talent. I could tell I was up there, but I could also tell I wasn't at the first rank. If Richard had chosen to be a mathematician, he would have been a first-rank mathematician."~{ Stallman doubts this, however. "One of the reasons I moved from math and physics to programming is that I never learned how to discover anything new in the former two. I only learned to study what others had done. In programming, I could do something useful every day." }~
+
+For Stallman, success in the classroom was balanced by the same lack of success in the social arena. Even as other members of the math mafia gathered to take on the Math 55 problem sets, Stallman preferred to work alone. The same went for living arrangements. On the housing application for Harvard, Stallman clearly spelled out his preferences. "I said I preferred an invisible, inaudible, intangible roommate," he says. In a rare stroke of bureaucratic foresight, Harvard's housing office accepted the request, giving Stallman a one-room single for his freshman year.
+
+Breidbart, the only math-mafia member to share a dorm with Stallman that freshman year, says Stallman slowly but surely learned how to interact with other students. He recalls how other dorm mates, impressed by Stallman's logical acumen, began welcoming his input whenever an intellectual debate broke out in the dining club or dorm commons."
+
+We had the usual bull sessions about solving the world's problems or what would be the result of something," recalls Breidbart. "Say somebody discovers an immortality serum. What do you do? What are the political results? If you give it to everybody, the world gets overcrowded and everybody dies. If you limit it, if you say everyone who's alive now can have it but their children can't, then you end up with an underclass of people without it. Richard was just better able than most to see the unforeseen circumstances of any decision."
+
+Stallman remembers the discussions vividly. "I was always in favor of immortality," he says. "How else would we be able to see what the world is like 200 years from now?" Curious, he began asking various acquaintances whether they would want immortality if offered it. "I was shocked that most people regarded immortality as a bad thing." Many said that death was good because there was no use living a decrepit life, and that aging was good because it got people prepared for death, without recognizing the circularity of the combination.
+
+Although perceived as a first-rank mathematician and first-rate in-formal debater, Stallman shied away from clear-cut competitive events that might have sealed his brilliant reputation. Near the end of fresh-man year at Harvard, Breidbart recalls how Stallman conspicuously ducked the Putnam exam, a prestigious test open to math students throughout the U.S. and Canada. In addition to giving students ac hance to measure their knowledge in relation to their peers, the Putnam served as a chief recruiting tool for academic math departments. According to campus legend, the top scorer automatically qualified for a graduate fellowship at any school of his choice, including Harvard.
+={Putnam exam+1}
+
+Like Math 55, the Putnam was a brutal test of merit. A six-hour exam in two parts, it seemed explicitly designed to separate the wheat from the chaff. Breidbart, a veteran of both the Science Honors
+
+Program and Math 55, describes it as easily the most difficult test he ever took. "Just to give you an idea of how difficult it was," says Breidbart, "the top score was a 120, and my score the first year was in the 30s. That score was still good enough to place me 101st in the country."
+
+Surprised that Stallman, the best student in the class, had skipped the test, Breidbart says he and a fellow classmate cornered him in the dining common and demanded an explanation. "He said he was afraid of not doing well," Breidbart recalls.
+
+Breidbart and the friend quickly wrote down a few problems from memory and gave them to Stallman. "He solved all of them," Breidbart says, " leading me to conclude that by not doing well, he either meant coming in second or getting something wrong."
+
+Stallman remembers the episode a bit differently. "I remember that they did bring me the questions and it's possible that I solved one of them, but I'm pretty sure I didn't solve them all," he says. Nevertheless, Stallman agrees with Breidbart's recollection that fear was the primary reason for not taking the test. Despite a demonstrated willingness to point out the intellectual weaknesses of his peers and professors in the classroom, Stallman hated and feared the notion of head-to-head competition - so why not just avoid it?
+
+"It's the same reason I never liked chess," says Stallman. "Whenever I'd play, I would become so consumed by the fear of making a single mistake and losing that I would start making stupid mistakes very early in the game. The fear became a self-fulfilling prophecy." He avoided the problem by not playing chess.
+
+Whether such fears ultimately prompted Stallman to shy away from a mathematical career is a moot issue. By the end of his freshman year at Harvard, Stallman had other interests pulling him away from the field. Computer programming, a latent fascination throughout Stallman's high-school years, was becoming a full-fledged passion. Where other math students sought occasional refuge in art and history classes, Stallman sought it in the computer-science laboratory.
+
+For Stallman, the first taste of real computer programming at the IBM New York Scientific Center had triggered a desire to learn more. "Toward the end of my first year at Harvard school, I started to have enough courage to go visit computer labs and see what they had. I'd ask them if they had extra copies of any manuals that I could read." Taking the manuals home, Stallman would examine the machine specifications to learn about the range of different computer designs.
+
+One day, near the end of his freshman year, Stallman heard about a special laboratory near MIT. The laboratory was located on the ninth floor of a building in Tech Square, the mostly-commercial office park MIT had built across the street from the campus. According to the rumors, the lab itself was dedicated to the cutting-edge science of artificial intelligence and boasted the cutting-edge machines and software to match.
+={artificial intelligence;MIT Massachusetts Institute of Technology:first visit to+2}
+
+Intrigued, Stallman decided to pay a visit.
+
+The trip was short, about 2 miles on foot, 10 minutes by train, but as Stallman would soon find out, MIT and Harvard can feel like opposite poles of the same planet. With its maze-like tangle of inter-connected office buildings, the Institute's campus offered an aestheticy in to Harvard's spacious colonial-village yang. Of the two, the maze of MIT was much more Stallman's style. The same could be said for the student body, a geeky collection of ex-high school misfits known more for its predilection for pranks than its politically powerful alumni.
+
+The yin-yang relationship extended to the AI Lab as well. Unlike Harvard computer labs, there was no grad-student gatekeeper, no clipboard waiting list for terminal access, no atmosphere of "look but don't touch." Instead, Stallman found only a collection of open terminals and robotic arms, presumably the artifacts of some AI experiment. When he encountered a lab employee, he asked if the lab had any spare manuals it could loan to an inquisitive student. "They had some, but a lot of things weren't documented," Stallman recalls. "They were hackers, after all," he adds wryly, referring to hackers' tendency to move on to a new project without documenting the last one.
+={AI Lab (Artificial Intelligence Laboratory)+40}
+
+Stallman left with something even better than a manual: A job. His first project was to write a PDP-11 simulator that would run on a PDP-10. He came back to the AI Lab the next week, grabbing an available terminal, and began writing the code.
+
+Looking back, Stallman sees nothing unusual in the AI Lab's willingness to accept an unproven outsider at first glance. "That's the way it was back then," he says. "That's the way it still is now. I'll hire somebody when I meet him if I see he's good. Why wait? Stuffy people who insist on putting bureaucracy into everything really miss the point. If a person is good, he shouldn't have to go through a long, detailed hiring process; he should be sitting at a computer writing code."
+
+To get a taste of "bureaucratic and stuffy," Stallman need only visit the computer labs at Harvard. There, access to the terminals was doled out according to academic rank. As an undergrad, Stallman sometimes had to wait for hours. The waiting wasn't difficult, but it was frustrating. Waiting for a public terminal, knowing all the while that a half dozen equally usable machines were sitting idle inside professors' locked offices, seemed the height of irrational waste. Although Stallman continued to pay the occasional visit to the Harvard computer labs, he preferred the more egalitarian policies of the AI Lab. "It was a breath of fresh air," he says. "At the AI Lab, people seemed more concerned about work than status."
+={Harvard University:computer labs}
+
+Stallman quickly learned that the AI Lab's first-come, first-served policy owed much to the efforts of a vigilant few. Many were holdovers from the days of Project MAC, the Department of Defense-funded re-search program that had given birth to the first time-share operating systems. A few were already legends in the computing world. There was Richard Greenblatt, the lab's in-house Lisp expert and author of MacHack, the computer chess program that had once humbled AI critic Hubert Dreyfus. There was Gerald Sussman, original author of the robotic block-stacking program HACKER. And there was Bill Gosper, the in-house math whiz already in the midst of an 18-month hacking bender triggered by the philosophical implications of the computer game LIFE.~{ See Steven Levy, Hackers (Penguin USA [paperback], 1984): 144. Levy devotes about five pages to describing Gosper's fascination with LIFE, a math-based software game first created by British mathematician John Conway. I heartily recommend this book as a supplement, perhaps even a prerequisite, to this one. }~
+={Dreyfus, Hubert;Gosper, Bill;Greenblat, Richard;LIFE mathematical game;LISP programming language;MacHack;Project MAC;Sussman, Gerald+2}
+
+Members of the tight-knit group called themselves "hackers." Overtime, they extended the "hacker" description to Stallman as well. In the process of doing so, they inculcated Stallman in the ethical traditions of the "hacker ethic." In their fascination with exploring the limits of what they could make a computer do, hackers might sit at a terminal for 36 hours straight if fascinated with a challenge. Most importantly, they demanded access to the computer (when no one else was using it) and the most useful information about it. Hackers spoke openly about changing the world through software, and Stallman learned the instinctual hacker disdain for any obstacle that prevented a hacker from fulfilling this noble cause. Chief among these obstacles were poor software, academic bureaucracy, and selfish behavior.
+={ethics of hacking;hackers+7:ethics of}
+
+Stallman also learned the lore, stories of how hackers, when presented with an obstacle, had circumvented it in creative ways. This included various ways that hackers had opened professors' offices to "liberate" sequestered terminals. Unlike their pampered Harvard counterparts, MIT faculty members knew better than to treat the AI Lab's limited stock of terminals as private property. If a faculty member made the mistake of locking away a terminal for the night, hackers were quick to make the terminal accessible again - and to remonstrate with the professor for having mistreated the community. Some hackers did this by picking locks ("lock hacking"), some by removing ceiling tiles and climbing over the wall. On the 9th floor, with its false floor for the computers' cables, some spelunked under it. "I was actually shown a cart with a heavy cylinder of metal on it that had been used to break down the door of one professor's office,"~{ Gerald Sussman, an MIT faculty member and hacker whose work at the AI Lab predates Stallman's, disputes this story. According to Sussman, the hackers never broke any doors to retrieve terminals. }~ Stallman says.
+={AI Lab (Artificial Intelligence Laboratory):lock hacking at+31}
+
+The hackers' insistence served a useful purpose by preventing the professors from egotistically obstructing the lab's work. The hackers did not disregard people's particular needs, but insisted that these be met in ways that didn't obstruct everyone else. For instance, professors occasionally said they had something in their offices which had to be protected from theft. The hackers responded, "No one will object if you lock your office, although that's not very friendly, as long as you don't lock away the lab's terminal in it."
+
+Although the academic people greatly outnumbered the hackers in the AI Lab, the hacker ethic prevailed. The hackers were the lab staff and students who had designed and built parts of the computers, and written nearly all the software that users used. They kept everything working, too. Their work was essential, and they refused to be downtrodden. They worked on personal pet projects as well as features users had asked for, but sometimes the pet projects revolved around improving the machines and software even further. Like teenage hot-rodders, most hackers viewed tinkering with machines as its own form of entertainment.
+
+Nowhere was this tinkering impulse better reflected than in the operating system that powered the lab's central PDP-10 computer. Dubbed ITS, short for the Incompatible Time Sharing system, the operating system incorporated the hacking ethic into its very design. Hackers had built it as a protest to Project MAC's original operating system, the Compatible Time Sharing System, CTSS, and named it accordingly. At the time, hackers felt the CTSS design too restrictive, limiting programmers' power to modify and improve the program's own internal architecture if needed. According to one legend passed down by hackers, the decision to build ITS had political overtones as well. Unlike CTSS, which had been designed for the IBM 7094, ITS was built specifically for the PDP-6. In letting hackers write the system themselves, AI Lab administrators guaranteed that only hackers would feel comfortable using the PDP-6. In the feudal world of academic research, the gambit worked. Although the PDP-6 was co-owned in conjunction with other departments, AI researchers soon had it to themselves. Using ITS and the PDP-6 as a foundation, the Lab had been able to declare independence from Project MAC shortly before Stallman's arrival.~{ Ibid. }~
+={Compatible Time Sharing System (CTSS);CTSS (Compatible Time Sharing System);IBM 7094 computer;Incompatible Timesharing System (ITS)+5;PDP-6 computer+1;Project MAC:Incompatible Time Sharing system and}
+
+By 1971, ITS had moved to the newer but compatible PDP-10, leaving the PDP-6 for special stand-alone uses. The AI PDP-10 had a very large memory for 1971, equivalent to a little over a megabyte;in the late 70s it was doubled. Project MAC had bought two other PDP-10s; all were located on the 9th floor, and they all ran ITS. The hardware-inclined hackers designed and built a major hardware addition for these PDP-10s, implementing paged virtual memory, a feature lacking in the standard PDP-10.~{ I apologize for the whirlwind summary of ITS' genesis, an operating system many hackers still regard as the epitome of the hacker ethos. For more information on the program's political significance, see Simson Garfinkel, Architects of the Information Society: Thirty-Five Years of the Laboratory for Computer Science at MIT (MIT Press, 1999). }~
+
+As an apprentice hacker, Stallman quickly became enamored with ITS. Although forbidding to some non-hackers, ITS boasted features most commercial operating systems wouldn't offer for years (or even to this day), features such as multitasking, applying the debugger immediately to any running program, and full-screen editing capability.
+
+"ITS had a very elegant internal mechanism for one program to examine another," says Stallman, recalling the program. "You could examine all sorts of status about another program in a very clean, well-specified way." This was convenient not only for debugging, but also for programs to start, stop or control other programs.
+
+Another favorite feature would allow the one program to freeze an-other program's job cleanly, between instructions. In other operating systems, comparable operations might stop the program in the middle of a system call, with internal status that the user could not see and that had no well-defined meaning. In ITS, this feature made sure that monitoring the step-by-step operation of a program was reliable and consistent.
+
+"If you said, 'Stop the job,' it would always be stopped in user mode. It would be stopped between two user-mode instructions, and everything about the job would be consistent for that point," Stallman says. "If you said, 'Resume the job,' it would continue properly. Not only that, but if you were to change the (explicitly visible) status of the job and continue it, and later change it back, everything would be consistent. There was no hidden status anywhere."
+
+Starting in September 1971, hacking at the AI Lab had become a regular part of Stallman's weekly school schedule. From Sunday through Friday, Stallman was at Harvard. As soon as Friday afternoon arrived, however, he was on the subway, heading down to MIT for the weekend. Stallman usually made sure to arrive well before the ritual food run. Joining five or six other hackers in their nightly quest for Chinese food, he would jump inside a beat-up car and head across the Harvard Bridge into nearby Boston. For the next hour or so, he and his hacker colleagues would discuss everything from ITS to the internal logic of the Chinese language and pictograph system. Following dinner, the group would return to MIT and hack code until dawn, or perhaps go to Chinatown again at 3 a.m.
+
+Stallman might stay up all morning hacking, or might sleep Saturday morning on a couch. On waking he would hack some more, have another Chinese dinner, then go back to Harvard. Sometimes he would stay through Sunday as well. These Chinese dinners were not only delicious; they also provided sustenance lacking in the Harvard dining halls, where on the average only one meal a day included anything he could stomach. (Breakfast did not enter the count, since he didn't like most breakfast foods and was normally asleep at that hour.)
+
+For the geeky outcast who rarely associated with his high-school peers, it was a heady experience to be hanging out with people who shared the same predilection for computers, science fiction, and Chinese food. "I remember many sunrises seen from a car coming back from Chinatown," Stallman would recall nostalgically, 15 years after the fact in a speech at the Swedish Royal Technical Institute. "It was actually a very beautiful thing to see a sunrise, 'cause that's such a calm time of day. It's a wonderful time of day to get ready to go to bed. It's so nice to walk home with the light just brightening and the birds starting to chirp; you can get a real feeling of gentle satisfaction, of tranquility about the work that you have done that night."~{ See Richard Stallman, "RMS lecture at KTH (Sweden)," (October 30, 1986), \\ http://www.gnu.org/philosophy/stallman-kth.html. }~
+={Swedish Royal Technical Institute}
+
+The more Stallman hung out with the hackers, the more he adopted the hacker world view. Already committed to the notion of personal liberty, Stallman began to infuse his actions with a sense of communal duty. When others violated the communal code, Stallman was quick to speak out. Within a year of his first visit, Stallman was the one opening locked offices to recover the sequestered terminals that belonged to the lab community as a whole. In true hacker fashion, Stallman also sought to make his own personal contribution to the art. One of the most artful door-opening tricks, commonly attributed to Greenblatt, involved bending a stiff wire into several right angles and attaching a strip of tape to one end. Sliding the wire under the door, a hacker could twist and rotate the wire so that the tape touched the inside doorknob. Provided the tape stuck, a hacker could turn the doorknob by pulling the handle formed from the outside end of the wire.
+={Greenblat, Richard:lock-hacking and}
+
+When Stallman tried the trick, he found it hard to execute. Getting the tape to stick wasn't always easy, and twisting the wire in a way that turned the doorknob was similarly difficult. Stallman thought about another method: sliding away ceiling tiles to climb over the wall. This always worked, if there was a desk to jump down onto, but it generally covered the hacker in itchy fiberglass. Was there a way to correct that flaw? Stallman considered an alternative approach. What if, instead of slipping a wire under the door, a hacker slid away two ceiling panels and reached over the wall with a wire?
+
+Stallman took it upon himself to try it out. Instead of using a wire, Stallman draped out a long U-shaped loop of magnetic tape with a short U of adhesive tape attached sticky-side-up at the base. Reaching across over the door jamb, he dangled the tape until it looped under the inside doorknob. Lifting the tape until the adhesive stuck, he then pulled on one end of the tape, thus turning the doorknob. Sure enough, the door opened. Stallman had added a new twist to the art of getting into a locked room.
+
+"Sometimes you had to kick the door after you turned the doorknob," says Stallman, recalling a slight imperfection of the new method. "It took a little bit of balance to pull it off while standing on a chair on a desk."
+
+Such activities reflected a growing willingness on Stallman's part to speak and act out in defense of political beliefs. The AI Lab's spirit of direct action had proved inspirational enough for Stallman to breakout of the timid impotence of his teenage years. Opening up an office to free a terminal wasn't the same as taking part in a protest march, but it was effective in a way that most protests weren't: it solved the problem at hand.
+
+By the time of his last years at Harvard, Stallman was beginning to apply the whimsical and irreverent lessons of the AI Lab back at school .
+
+"Did he tell you about the snake?" his mother asks at one point during an interview. "He and his dorm mates put a snake up for student election. Apparently it got a considerable number of votes.
+
+"The snake was a candidate for election within Currier House, Stallman's dorm, not the campus-wide student council. Stallman does re-member the snake attracting a fair number of votes, thanks in large part to the fact that both the snake and its owner both shared the same last name. "People may have voted for it because they thought they were voting for the owner," Stallman says. "Campaign posters said that the snake was 'slithering for' the office. We also said it was an 'at large' candidate, since it had climbed into the wall through the ventilating unit a few weeks before and nobody knew where it was."
+
+Stallman and friends also "nominated" the house master's 3-year-old son. "His platform was mandatory retirement at age seven," Stallman recalls. Such pranks paled in comparison to the fake-candidate pranks on the MIT campus, however. One of the most successful fake-candidate pranks was a cat named Woodstock, which actually managed to outdraw most of the human candidates in a campus-wide election. "They never announced how many votes Woodstock got, and they treated those votes as spoiled ballots," Stallman recalls. "But the large number of spoiled ballots in that election suggested that Woodstock had actually won. A couple of years later, Woodstock was suspiciously run over by a car. Nobody knows if the driver was working for the MIT administration." Stallman says he had nothing to do with Woodstock's candidacy, "but I admired it."~{ In an email shortly after this book went into its final edit cycle, Stallman says he drew political inspiration from the Harvard campus as well. "In my first year of Harvard, in a Chinese History class, I read the story of the first revolt against the Qin dynasty," he says. (That's the one whose cruel founder burnt all the books and was buried with the terra cotta warriors.) "The story is not reliable history, but it was very moving." }~
+
+At the AI Lab, Stallman's political activities had a sharper-edged tone. During the 1970s, hackers faced the constant challenge of faculty members and administrators pulling an end-run around ITS and its hacker-friendly design. ITS allowed anyone to sit down at a console and do anything at all, even order the system to shut down in five minutes. If someone ordered a shutdown with no good reason, some other user canceled it. In the mid-1970s some faculty members (usually those who had formed their attitudes elsewhere) began calling for a file security system to limit access to their data. Other operating systems had such features, so those faculty members had become accustomed to living under security, and to the feeling that it was protecting them from something dangerous. But the AI Lab, through the insistence of Stallman and other hackers, remained a security-free zone.
+={Incompatible Timesharing System (ITS)+1}
+
+Stallman presented both ethical and practical arguments against adding security. On the ethical side, Stallman appealed to the AI Lab community's traditions of intellectual openness and trust. On the practical side, he pointed to the internal structure of ITS, which was built to foster hacking and cooperation rather than to keep every user under control. Any attempt to reverse that design would require a major overhaul. To make it even more difficult, he used up the last empty field in each file's descriptor for a feature to record which user had most recently changed the file. This feature left no place to store file security information, but it was so useful that nobody could seriously propose to remove it.
+={security (computer), opposition to}
+
+"The hackers who wrote the Incompatible Timesharing System decided that file protection was usually used by a self-styled system manager to get power over everyone else," Stallman would later explain. "They didn't want anyone to be able to get power over them that way, so they didn't implement that kind of a feature. The result was, that whenever something in the system was broken, you could always fix it" (since access control did not stand in your way).~{ See Richard Stallman (1986). }~
+
+Through such vigilance, hackers managed to keep the AI Lab's machines security-free. In one group at the nearby MIT Laboratory for Computer Sciences, however, security-minded faculty members won the day. The DM group installed its first password system in 1977. Once again, Stallman took it upon himself to correct what he saw as ethical laxity. Gaining access to the software code that controlled the password system, Stallman wrote a program to decrypt the encrypted passwords that the system recorded. Then he started an email campaign, asking users to choose the null string as their passwords. If the user had chosen "starfish," for example, the email message looked something like this:
+={password-based systems, hacking into+5}
+
+_1 I see you chose the password "starfish". I suggest that you switch to the password "carriage return", which is what I use. It's easier to type, and also opposes the idea of passwords and security.
+
+The users who chose "carriage return" - that is, users who simply pressed the Enter or Return button, entering a blank string instead of a unique password - left their accounts accessible to the world at large, just as all accounts had been, not long before. That was the point: by refusing to lock the shiny new locks on their accounts, they ridiculed the idea of having locks. They knew that the weak security implemented on that machine would not exclude any real intruders, and that this did not matter, because there was no reason to be concerned about intruders, and that no one wanted to intrude anyway, only to visit.
+
+Stallman, speaking in an interview for the 1984 book /{Hackers}/, proudly noted that one-fifth of the LCS staff accepted this argument and employed the null-string password.~{ See Steven Levy, Hackers (Penguin USA [paperback], 1984): 417. }~
+={Hackers (Levy)}
+
+Stallman's null-string campaign, and his resistance to security in general, would ultimately be defeated. By the early 1980s, even the AI Lab's machines were sporting password security systems. Even so, it represented a major milestone in terms of Stallman's personal and political maturation. Seen in the context of Stallman's later career, it represents a significant step in the development of the timid teenager, afraid to speak out even on issues of life-threatening importance, into the adult activist who would soon turn needling and cajoling into a full-time occupation.
+
+In voicing his opposition to computer security, Stallman drew on many of the key ideas that had shaped his early life: hunger for knowledge, distaste for authority, and frustration over prejudice and secret rules that rendered some people outcasts. He would also draw on the ethical concepts that would shape his adult life: responsibility to the community, trust, and the hacker spirit of direct action. Expressed in software-computing terms, the null string represents the 1.0 version of the Richard Stallman political world view - incomplete in a few places but, for the most part, fully mature.
+={computer security, opposition to}
+
+Looking back, Stallman hesitates to impart too much significance to an event so early in his hacking career. "In that early stage there were a lot of people who shared my feelings," he says. "The large number of people who adopted the null string as their password was a sign that many people agreed that it was the proper thing to do. I was simply inclined to be an activist about it."
+
+Stallman does credit the AI Lab for awakening that activist spirit, however. As a teenager, Stallman had observed political events with little idea as to how he could do or say anything of importance. As a young adult, Stallman was speaking out on matters in which he felt supremely confident, matters such as software design, responsibility to the community, and individual freedom. "I joined this community which had a way of life which involved respecting each other's freedom," he says. "It didn't take me long to figure out that that was a good thing. It took me longer to come to the conclusion that this was a moral issue."
+
+Hacking at the AI Lab wasn't the only activity helping to boost Stallman's esteem. At the start of his junior year at Harvard, Stallman began participating in a recreational international folk dance group which had just been started in Currier House. He was not going to try it, considering himself incapable of dancing, but a friend pointed out, "You don't know you can't if you haven't tried." To his amazement, he was good at it and enjoyed it. What started as an experiment became another passion alongside hacking and studying; also, occasionally, away to meet women, though it didn't lead to a date during his college career. While dancing, Stallman no longer felt like the awkward, un-coordinated 10-year-old whose attempts to play football had ended in frustration. He felt confident, agile, and alive. In the early 80s, Stallman went further and joined the MIT Folk Dance Performing Group. Dancing for audiences, dressed in an imitation of the traditional garb of a Balkan peasant, he found being in front of an audience fun, and discovered an aptitude for being on stage which later helped him in public speaking.
+={folk dancing;Stallman, Richard M.:folk dancing}
+
+Although the dancing and hacking did little to improve Stallman's social standing, they helped him overcome the sense of exclusion that had clouded his pre-Harvard life. In 1977, attending a science-fiction convention for the first time, he came across Nancy the Button maker, who makes calligraphic buttons saying whatever you wish. Excited, Stallman ordered a button with the words "Impeach God" emblazoned on it.
+
+For Stallman, the "Impeach God" message worked on many levels. An atheist since early childhood, Stallman first saw it as an attempt to start a "second front" in the ongoing debate on religion. "Back then everybody was arguing about whether a god existed," Stallman recalls. "'Impeach God' approached the subject from a completely different viewpoint. If a god was so powerful as to create the world and yet did nothing to correct the problems in it, why would we ever want to worship such a god? Wouldn't it be more just to put it on trial?"
+
+At the same time, "Impeach God" was a reference to the Watergate scandal of the 1970s, in effect comparing a tyrannical deity to Nixon. Watergate affected Stallman deeply. As a child, Stallman had grown up resenting authority. Now, as an adult, his mistrust had been solidified by the culture of the AI Lab hacker community. To the hackers, Watergate was merely a Shakespearean rendition of the daily power struggles that made life such a hassle for those without privilege. It was an out sized parable for what happened when people traded liberty and openness for security and convenience.
+
+Buoyed by growing confidence, Stallman wore the button proudly. People curious enough to ask him about it received a well-prepared spiel. "My name is Jehovah," Stallman would say. "I have a secret plan to end injustice and suffering, but due to heavenly security reasons I can't tell you the workings of my plan. I see the big picture and you don't, and you know I'm good because I told you so. So put your faith in me and obey me without question. If you don't obey, that means you're evil, so I'll put you on my enemies list and throw you in a pit where the Infernal Revenue Service will audit your taxes every year for all eternity."
+
+Those who interpreted the spiel as a parody of the Watergate hearings only got half the message. For Stallman, the other half of the message was something only his fellow hackers seemed to be hearing. One hundred years after Lord Acton warned about absolute power corrupting absolutely, Americans seemed to have forgotten the first part of Acton's truism: power, itself, corrupts. Rather than point out the numerous examples of petty corruption, Stallman felt content voicing his outrage toward an entire system that trusted power in the first place.
+
+"I figured, why stop with the small fry," says Stallman, recalling the button and its message. "If we went after Nixon, why not go after Mr. Big? The way I see it, any being that has power and abuses it deserves to have that power taken away."
+
+1~ Chapter 5 - Puddle of Freedom
+
+[RMS: In this chapter, I have corrected statements about facts, including facts about my thoughts and feelings, and removed some gratuitous hostility in descriptions of events. I have preserved Williams' statements of his own impressions, except where noted.]
+
+Ask anyone who's spent more than a minute in Richard Stallman's presence, and you'll get the same recollection: forget the long hair. Forget the quirky demeanor. The first thing you notice is the gaze. One look into Stallman's green eyes, and you know you're in the presence of a true believer.
+
+To call the Stallman gaze intense is an understatement. Stallman's eyes don't just look at you; they look through you. Even when your own eyes momentarily shift away out of simple primate politeness, Stallman's eyes remain locked-in, sizzling away at the side of your head like twin photon beams.
+
+Maybe that's why most writers, when describing Stallman, tend to go for the religious angle. In a 1998 Salon.com article titled "The Saint of Free Software," Andrew Leonard describes Stallman's green eyes as "radiating the power of an Old Testament prophet."1~{ See Andrew Leonard, "The Saint of Free Software," Salon.com (August 1998), \\ http://www.salon.com/21st/feature/1998/08/cov_31feature.html. }~ A 1999 Wired magazine article describes the Stallman beard as "Rasputin-like,"~{ See Leander Kahney, "Linux's Forgotten Man," Wired News (March 5, 1999), \\ http://www.wired.com/news/print/0,1294,18291,00.html. }~ while a London Guardian profile describes the Stallman smile as the smile of "a disciple seeing Jesus."~{ See "Programmer on moral high ground; Free software is a moral issue for Richard Stallman believes in freedom and free software," London Guardian (November 6, 1999), \\ http://www.guardian.co.uk/uk/1999/nov/06/andrewbrown. \\ These are just a small sampling of the religious comparisons. To date, the most extreme comparison has to go to Linus Torvalds, who, in his autobiography - see Linus Torvalds and David Diamond, Just For Fun: The Story of an Accidental Revolutionary (HarperCollins Publishers, Inc., 2001): 58 - writes, "Richard Stallman is the God of Free Software." Honorable mention goes to Larry Lessig, who, in a footnote description of Stallman in his book - see Larry Lessig, The Future of Ideas (Random House, 2001): 270 - likens Stallman to Moses:... \\ as with Moses, it was another leader, Linus Torvalds, who finally carried the movement into the promised land by facilitating the development of the final part of the OS puzzle. Like Moses, too, Stallman is both respected and reviled by allies within the movement. He is[an] unforgiving, and hence for many inspiring, leader of a critically important aspect of modern culture. I have deep respect for the principle and commitment of this extraordinary individual, though I also have great respect for those who are courageous enough to question his thinking and then sustain his wrath. \\ In a final interview with Stallman, I asked him his thoughts about the religious comparisons. "Some people do compare me with an Old Testament prophet, and the reason is Old Testament prophets said certain social practices were wrong. They wouldn't compromise on moral issues. They couldn't be bought off, and they were usually treated with contempt." }~
+={Wired magazine;Leonard, Andrew;London Guardian;Salon.com}
+
+Such analogies serve a purpose, but they ultimately fall short. That's because they fail to take into account the vulnerable side of the Stallman persona. Watch the Stallman gaze for an extended period of time, and you will begin to notice a subtle change. What appears at first to be an attempt to intimidate or hypnotize reveals itself upon second and third viewing as a frustrated attempt to build and maintain contact. If his personality has a touch or "shadow" of autism or Asperger's Syndrome, a possibility that Stallman has entertained from time to time, his eyes certainly confirm the diagnosis. Even at their most high-beam level of intensity, they have a tendency to grow cloudy and distant, like the eyes of a wounded animal preparing to give up the ghost.
+={Asperger Syndrome;autism}
+
+My own first encounter with the legendary Stallman gaze dates back to the March, 1999, LinuxWorld Convention and Expo in San Jose, California. Billed as a "coming out party" for the "Linux" software community, the convention also stands out as the event that reintroduced Stallman to the technology media. Determined to push for his proper share of credit, Stallman used the event to instruct spectators and reporters alike on the history of the GNU Project and the project's overt political objectives.
+={GNU Project:GNOME 1.0+1;Linux+6;LinuxWorld+8}
+
+As a reporter sent to cover the event, I received my own Stallman tutorial during a press conference announcing the release of GNOME 1.0, a free software graphic user interface. Unwittingly, I push an entire bank of hot buttons when I throw out my very first question to Stallman himself: "Do you think GNOME's maturity will affect the commercial popularity of the Linux operating system?"
+={GNOME 1.0}
+
+"I ask that you please stop calling the operating system Linux," Stallman responds, eyes immediately zeroing in on mine. "The Linux kernel is just a small part of the operating system. Many of the software programs that make up the operating system you call Linux were not developed by Linus Torvalds at all. They were created by GNU Project volunteers, putting in their own personal time so that users might have a free operating system like the one we have today. To not acknowledge the contribution of those programmers is both impolite and a misrepresentation of history. That's why I ask that when you refer to the operating system, please call it by its proper name, GNU/Linux."
+={GNU Project:Linux and|kernel;Torvalds, Linus+3}
+
+Taking the words down in my reporter's notebook, I notice an eerie silence in the crowded room. When I finally look up, I find Stallman's unblinking eyes waiting for me. Timidly, a second reporter throws out a question, making sure to use the term "GNU/Linux" instead of Linux. Miguel de Icaza, leader of the GNOME project, fields the question. It isn't until halfway through de Icaza's answer, however, that Stallman's eyes finally unlock from mine. As soon as they do, a mild shiver rolls down my back. When Stallman starts lecturing another reporter over a perceived error in diction, I feel a guilty tinge of relief. At least he isn't looking at me, I tell myself.
+={de Icaza, Miguel;GNU/Linux}
+
+For Stallman, such face-to-face moments would serve their purpose. By the end of the first LinuxWorld show, most reporters know better than to use the term "Linux" in his presence, and Wired.com is running a story comparing Stallman to a pre-Stalinist revolutionary erased from the history books by hackers and entrepreneurs eager to downplay the GNU Project's overly political objectives.~{ See Leander Kahney (1999). }~ Other articles follow, and while few reporters call the operating system GNU/Linux in print, most are quick to credit Stallman for launching the drive to build a free software operating system 15 years before.
+
+I won't meet Stallman again for another 17 months. During the interim, Stallman will revisit Silicon Valley once more for the August, 1999 LinuxWorld show. Although not invited to speak, Stallman does manage to deliver the event's best line. Accepting the show's Linus Torvalds Award for Community Service - an award named after Linux creator Linus Torvalds - on behalf of the Free Software Foundation, Stallman wisecracks, "Giving the Linus Torvalds Award to the Free Software Foundation is a bit like giving the Han Solo Award to the Rebel Alliance."
+
+This time around, however, the comments fail to make much of a media dent. Midway through the week, Red Hat, Inc., a prominent GNU/Linux vendor, goes public. The news merely confirms what many reporters such as myself already suspect: "Linux" has become a Wall Street buzzword, much like "e-commerce" and "dot-com" before it. With the stock market approaching the Y2K rollover like a hyperbola approaching its vertical asymptote, all talk of free software or open source as a political phenomenon falls by the wayside.
+={Red Hat Inc.:going public}
+
+Maybe that's why, when LinuxWorld follows up its first two shows with a third LinuxWorld show in August, 2000, Stallman is conspicuously absent.
+
+My second encounter with Stallman and his trademark gaze comes shortly after that third LinuxWorld show. Hearing that Stallman is going to be in Silicon Valley, I set up a lunch interview in Palo Alto, California. The meeting place seems ironic, not only because of his absence from the show but also because of the overall backdrop. Outside of Redmond, Washington, few cities offer a more direct testament to the economic value of proprietary software. Curious to see how Stallman, a man who has spent the better part of his life railing against our culture's predilection toward greed and selfishness, is coping in a city where even garage-sized bungalows run in the half-million-dollar price range, I make the drive down from Oakland.
+={Redmond (Washington);Palo Alto (California);Silicon Valley+1}
+
+I follow the directions Stallman has given me, until I reach the headquarters of Art.net, a nonprofit "virtual artists collective." Located in a hedge-shrouded house in the northern corner of the city, the Art.net headquarters are refreshingly run-down. Suddenly, the idea of Stallman lurking in the heart of Silicon Valley doesn't seem so strange after all.
+={Art.net}
+
+I find Stallman sitting in a darkened room, tapping away on his gray laptop computer. He looks up as soon as I enter the room, giving me a full blast of his 200-watt gaze. When he offers a soothing "Hello," I offer a return greeting. Before the words come out, however, his eyes have already shifted back to the laptop screen.
+
+"I'm just finishing an article on the spirit of hacking," Stallman says, fingers still tapping. "Take a look."
+
+I take a look. The room is dimly lit, and the text appears as greenish-white letters on a black background, a reversal of the color scheme used by most desktop word-processing programs, so it takes my eyes a moment to adjust. When they do, I find myself reading Stallman's account of a recent meal at a Korean restaurant. Before the meal, Stallman makes an interesting discovery: the person setting the table has left six chopsticks instead of the usual two in front of Stallman's place setting. Where most restaurant goers would have ignored the redundant pairs, Stallman takes it as challenge: find away to use all six chopsticks at once. Like many software hacks, the successful solution is both clever and silly at the same time. Hence Stallman's decision to use it as an illustration.
+
+As I read the story, I feel Stallman watching me intently. I look over to notice a proud but child-like half smile on his face. When I praise the essay, my comment barely merits a raised eyebrow.
+
+"I'll be ready to go in a moment," he says.
+
+Stallman goes back to tapping away at his laptop. The laptop is gray and boxy, not like the sleek, modern laptops that seemed to be a programmer favorite at the recent LinuxWorld show. Above the keyboard rides a smaller, lighter keyboard, a testament to Stallman's aging hands. During the mid 1990s, the pain in Stallman's hands became so unbearable that he had to hire a typist. Today, Stallman relies on a keyboard whose keys require less pressure than a typical computer keyboard.
+
+Stallman has a tendency to block out all external stimuli while working. Watching his eyes lock onto the screen and his fingers dance, one quickly gets the sense of two old friends locked in deep conversation.
+
+The session ends with a few loud keystrokes and the slow disassembly of the laptop.
+
+"Ready for lunch?" Stallman asks.
+
+We walk to my car. Pleading a sore ankle, Stallman limps along slowly. Stallman blames the injury on a tendon in his left foot. The injury is three years old and has gotten so bad that Stallman, a huge fan of folk dancing, has been forced to give up all dancing activities."I love folk dancing intensely," Stallman laments. "Not being able to dance has been a tragedy for me."
+={folk dancing;Stallman, Richard M.:folk dancing}
+
+Stallman's body bears witness to the tragedy. Lack of exercise has left Stallman with swollen cheeks and a pot belly that was much less visible the year before. You can tell the weight gain has been dramatic, because when Stallman walks, he arches his back like a pregnant woman trying to accommodate an unfamiliar load.
+
+The walk is further slowed by Stallman's willingness to stop and smell the roses, literally. Spotting a particularly beautiful blossom, he strokes the innermost petals against his nose, takes a deep sniff, and steps back with a contented sigh.
+
+"Mmm, rhinophytophilia," he says, rubbing his back.~{ At the time, I thought Stallman was referring to the flower's scientific name. Months later, I would learn that rhino phytophilia was in fact a humorous reference to the activity - i.e., Stallman's sticking his nose into a flower and enjoying the moment - presenting it as the kinky practice of nasal sex with plants. For another humorous Stallman flower incident, \\ visit: http://www.stallman.org/articles/texas.html. }~
+
+The drive to the restaurant takes less than three minutes. Upon recommendation from Tim Ney, former executive director of the Free Software Foundation, I have let Stallman choose the restaurant. While some reporters zero in on Stallman's monk-like lifestyle, the truth is, Stallman is a committed epicure when it comes to food. One of the fringe benefits of being a traveling missionary for the free software cause is the ability to sample delicious food from around the world. "Visit almost any major city in the world, and chances are Richard knows the best restaurant in town," says Ney. "Richard also takes great pride in knowing what's on the menu and ordering for the entire table." (If they are willing, that is.)
+={Ney, Tim}
+
+For today's meal, Stallman has chosen a Cantonese-style dim sum restaurant two blocks off University Avenue, Palo Alto's main drag. The choice is partially inspired by Stallman's recent visit to China, including a stop in Hong Kong, in addition to Stallman's personal aversion to spicier Hunanese and Szechuan cuisine. "I'm not a big fan of spicy," Stallman admits.
+
+We arrive a few minutes after 11 a.m. and find ourselves already subject to a 20-minute wait. Given the hacker aversion to lost time, I hold my breath momentarily, fearing an outburst. Stallman, contrary to expectations, takes the news in stride.
+
+"It's too bad we couldn't have found somebody else to join us," he tells me. "It's always more fun to eat with a group of people."
+
+During the wait, Stallman practices a few dance steps. His moves are tentative but skilled. We discuss current events. Stallman says his only regret about not attending LinuxWorld was missing out on a press conference announcing the launch of the GNOME Foundation. Backed by Sun Microsystems and IBM, the foundation is in many ways a vindication for Stallman, who has long championed that free software and free-market economics need not be mutually exclusive. Nevertheless, Stallman remains dissatisfied by the message that came out.
+
+"The way it was presented, the companies were talking about Linux with no mention of the GNU Project at all," Stallman says.
+={GNU Project:Linux and;Linux:GNU Project and}
+
+Such disappointments merely contrast the warm response coming from overseas, especially Asia, Stallman notes. A quick glance at the Stallman 2000 travel itinerary bespeaks the growing popularity of the free software message. Between recent visits to India, China, and Brazil, Stallman has spent 12 of the last 115 days on United States soil. His travels have given him an opportunity to see how the free software concept translates into different languages of cultures.
+
+"In India many people are interested in free software, because they see it as a way to build their computing infrastructure without spending a lot of money," Stallman says. "In China, the concept has been much slower to catch on. Comparing free software to free speech is harder to do when you don't have any free speech. Still, the level of interest in free software during my last visit was profound."
+
+The conversation shifts to Napster, the San Mateo, California software company, which has become something of a media cause c'el'ebre in recent months. The company markets a controversial software tool that lets music fans browse and copy the music files of other music fans. Thanks to the magnifying powers of the Internet, this so-called "peer-to-peer" program has evolved into a de facto online jukebox, giving ordinary music fans a way to listen to MP3 music files over the computer without paying a royalty or fee, much to record companies' chagrin.
+={Napster+4;San Mateo (California)+2}
+
+Although based on proprietary software, the Napster system draws inspiration from the long-held Stallman contention that once a work enters the digital realm - in other words, once making a copy is less a matter of duplicating sounds or duplicating atoms and more a matter of duplicating information - the natural human impulse to share a work becomes harder to restrict. Rather than impose additional restrictions, Napster execs have decided to take advantage of the impulse. Giving music listeners a central place to trade music files, the company has gambled on its ability to steer the resulting user traffic toward other commercial opportunities.
+
+The sudden success of the Napster model has put the fear in traditional record companies, with good reason. Just days before my Palo Alto meeting with Stallman, U.S. District Court Judge Marilyn Patel granted a request filed by the Recording Industry Association of America for an injunction against the file-sharing service. The in-junction was subsequently suspended by the U.S. Ninth District Court of Appeals, but by early 2001, the Court of Appeals, too, would find the San Mateo-based company in breach of copyright law,~{ See Cecily Barnes and Scott Ard, "Court Grants Stay of Napster Injunction," News.com (July 28, 2000), \\ http://news.cnet.com/news/0-1005-200-2376465.html. }~ a decision RIAA spokesperson Hillary Rosen would later proclaim a "clear victory for the creative content community and the legitimate online marketplace."~{ See "A Clear Victory for Recording Industry in Napster Case," RIAA press release (February 12, 2001), \\ http://www.riaa.com/PR_story.cfm?id=372. }~
+
+For hackers such as Stallman, the Napster business model is troublesome in different ways. The company's eagerness to appropriate time-worn hacker principles such as file sharing and communal information ownership, while at the same time selling a service based on proprietary software, sends a distressing mixed message. As a person who already has a hard enough time getting his own carefully articulated message into the media stream, Stallman is understandably reticent when it comes to speaking out about the company. Still, Stallman does admit to learning a thing or two from the social side of the Napster phenomenon.
+
+"Before Napster, I thought it might be [sufficient] for people to privately redistribute works of entertainment," Stallman says. "The number of people who find Napster useful, however, tells me that the right to redistribute copies not only on a neighbor-to-neighbor basis, but to the public at large, is essential and therefore may not be taken away."
+
+No sooner does Stallman say this than the door to the restaurant swings open and we are invited back inside by the host. Within a few seconds, we are seated in a side corner of the restaurant next to a large mirrored wall.
+
+The restaurant's menu doubles as an order form, and Stallman is quickly checking off boxes before the host has even brought water to the table. "Deep-fried shrimp roll wrapped in bean-curd skin," Stallman reads. "Bean-curd skin. It offers such an interesting texture. I think we should get it."
+
+This comment leads to an impromptu discussion of Chinese food and Stallman's recent visit to China. "The food in China is utterly exquisite," Stallman says, his voice gaining an edge of emotion for the first time this morning. "So many different things that I've never seen in the U.S., local things made from local mushrooms and local vegetables. It got to the point where I started keeping a journal just to keep track of every wonderful meal."
+
+The conversation segues into a discussion of Korean cuisine. During the same June, 2000, Asian tour, Stallman paid a visit to South Korea. His arrival ignited a mini-firestorm in the local media thanks to a Korean software conference attended by Microsoft founder and chairman Bill Gates that same week. Next to getting his photo above Gates's photo on the front page of the top Seoul newspaper, Stallman says the best thing about the trip was the food. "I had a bowl of naeng myun, which is cold noodles," says Stallman. "These were a very interesting feeling noodle. Most places don't use quite the same kind of noodles for your naeng myun, so I can say with complete certainty that this was the most exquisite naeng myun I ever had."
+={Gates, Bill;South Korea}
+
+The term "exquisite" is high praise coming from Stallman. I know this, because a few moments after listening to Stallman rhapsodize about naeng myun, I feel his laser-beam eyes singeing the top of my right shoulder.
+
+"There is the most exquisite woman sitting just behind you," Stallman says.
+
+I turn to look, catching a glimpse of a woman's back. The woman is young, somewhere in her mid-20s, and is wearing a white sequined dress. She and her male lunch companion are in the final stages of paying the check. When both get up from the table to leave the restaurant, I can tell without looking, because Stallman's eyes suddenly dim in intensity.
+
+"Oh, no," he says. "They're gone. And to think, I'll probably never even get to see her again."
+
+After a brief sigh, Stallman recovers. The moment gives me a chance to discuss Stallman's reputation vis-'a-vis the fairer sex. The reputation is a bit contradictory at times. A number of hackers report Stallman's predilection for greeting females with a kiss on the back of the hand.~{ See Mae Ling Mak, "A Mae Ling Story" (December 17, 1998), \\ http://crackmonkey.org/pipermail/crackmonkey/1998-December/001777.html. So far, Mak is the only person I've found willing to speak on the record in regard to this practice, although I've heard this from a few other female sources. Mak, despite expressing initial revulsion at it, later managed to put aside her misgivings and dance with Stallman at a 1999 LinuxWorld show. }~ A May 26, 2000 Salon.com article, meanwhile, portrays Stallman as a bit of a hacker lothario. Documenting the free software-free love connection, reporter Annalee Newitz presents Stallman as rejecting traditional family values, telling her, "I believe in love, but not monogamy."~{ See Annalee Newitz, "If Code is Free Why Not Me?", Salon.com (May 26,2000), \\ http://www.salon.com/tech/feature/2000/05/26/free_love/print.html. }~
+={Newitz, Annalee;Salon.com}
+
+Stallman lets his menu drop a little when I bring this up. "Well, most men seem to want sex and seem to have a rather contemptuous attitude towards women," he says. "Even women they're involved with. I can't understand it at all."
+
+I mention a passage from the 1999 book /{Open Sources}/ in which Stallman confesses to wanting to name the GNU kernel after a girl-friend at the time. The girlfriend's name was Alix, a name that fit perfectly with the Unix developer convention of putting an "x" at the end names of operating systems and kernels - e.g., "Linux." Alix was a Unix system administrator, and had suggested to her friends, "Someone should name a kernel after me." So Stallman decided to name the GNU kernel "Alix" as a surprise for her. The kernel's main developer renamed the kernel "Hurd," but retained the name "Alix" for part of it. One of Alix's friends noticed this part in a source snapshot and told her, and she was touched. A later redesign of the Hurd eliminated that part.~{ See Richard Stallman, "The GNU Operating System and the Free Software Movement," Open Sources (O'Reilly & Associates, Inc., 1999): 65. [RMS: Williams interpreted this vignette as suggesting that I am a hopeless romantic, and that my efforts were meant to impress some as-yet-unidentified woman. No MIT hacker would believe this, since we learned quite young that most women wouldn't notice us, let alone love us, for our programming. We programmed because it was fascinating. Meanwhile, these events were only possible because I had a thoroughly identified girlfriend at the time. If I was a romantic, at the time I was neither a hopeless romantic nor a hopeful romantic, but rather temporarily a successful one. On the strength of that naive interpretation, Williams went on to compare meto Don Quijote. For completeness' sake, here's a somewhat inarticulate quote from the first edition: "I wasn't really trying to be romantic. It was more of a teasing thing. I mean, it was romantic, but it was also teasing, you know? It would have been a delightful surprise."] }~
+={HURD kernel;Open Sources (DiBona, et al)}
+
+For the first time all morning, Stallman smiles. I bring up the hand kissing. "Yes, I do do that," Stallman says. "I've found it's a way of offering some affection that a lot of women will enjoy. It's a chance to give some affection and to be appreciated for it."
+
+Affection is a thread that runs clear through Richard Stallman's life, and he is painfully candid about it when questions arise. "There really hasn't been much affection in my life, except in my mind," he says. Still, the discussion quickly grows awkward. After a few one-word replies, Stallman finally lifts up his menu, cutting off the inquiry.
+
+"Would you like some shu mai?" he asks.
+
+When the food comes out, the conversation slaloms between the arriving courses. We discuss the oft-noted hacker affection for Chinese food, the weekly dinner runs into Boston's Chinatown district during Stallman's days as a staff programmer at the AI Lab, and the underlying logic of the Chinese language and its associated writing system. Each thrust on my part elicits a well-informed parry on Stallman's part.
+
+"I heard some people speaking Shanghainese the last time I was in China," Stallman says. "It was interesting to hear. It sounded quite different [from Mandarin]. I had them tell me some cognate words in Mandarin and Shanghainese. In some cases you can see the resemblance, but one question I was wondering about was whether tones would be similar. They're not. That's interesting to me, because there's a theory that the tones evolved from additional syllables that got lost and replaced. Their effect survives in the tone. If that's true, and I've seen claims that that happened within historic times, the dialects must have diverged before the loss of these final syllables."
+
+The first dish, a plate of pan-fried turnip cakes, has arrived. Both Stallman and I take a moment to carve up the large rectangular cakes, which smell like boiled cabbage but taste like potato latkes fried in bacon.
+
+I decide to bring up the outcast issue again, wondering if Stallman's teenage years conditioned him to take unpopular stands, most notably his uphill battle since 1994 to get computer users and the media to replace the popular term "Linux" with "GNU/Linux."
+
+"I believe [being an outcast] did help me [to avoid bowing to popular views]," Stallman says, chewing on a dumpling. "I have never understood what peer pressure does to other people. I think the reason is that I was so hopelessly rejected that for me, there wasn't anything to gain by trying to follow any of the fads. It wouldn't have made any difference. I'd still be just as rejected, so I didn't try."
+
+Stallman points to his taste in music as a key example of his contrarian tendencies. As a teenager, when most of his high school classmates were listening to Motown and acid rock, Stallman preferred classical music. The memory leads to a rare humorous episode from Stallman's middle-school years. Following the Beatles' 1964 appearance on the Ed Sullivan Show, most of Stallman's classmates rushed out to purchase the latest Beatles albums and singles. Right then and there, Stallman says, he made a decision to boycott the Fab Four.
+={Beatles+2;music+4}
+
+"I liked some of the pre-Beatles popular music," Stallman says. "But I didn't like the Beatles. I especially disliked the wild way people reacted to them. It was like: who was going to have a Beatles assembly to adulate the Beatles the most?"
+
+When his Beatles boycott failed to take hold, Stallman looked for other ways to point out the herd-mentality of his peers. Stallman says he briefly considered putting together a rock band himself dedicated to satirizing the Liverpool group.
+
+"I wanted to call it Tokyo Rose and the Japanese Beetles."
+
+Given his current love for international folk music, I ask Stallman if he had a similar affinity for Bob Dylan and the other folk musicians of the early 1960s. Stallman shakes his head. "I did like Peter, Paul and Mary," he says. "That reminds me of a great filk."
+={Dylan, Bob;Peter, Paul and Mary}
+
+When I ask for a definition of "filk," Stallman explains that the term is used in science fiction fandom to refer to the writing of new lyrics for songs. (In recent decades, some filkers write melodies too.) Classic filks include "On Top of Spaghetti," a rewrite of "On Top of Old Smokey," and "Yoda," filk-master "Weird" Al Yankovic's Star Wars-oriented rendition of the Kinks tune, "Lola."
+
+Stallman asks me if I would be interested in hearing the filk. As soon as I say yes, Stallman's voice begins singing in an unexpectedly clear tone, using the tune of "Blowin' in the Wind":
+
+poem{
+
+ How much wood could a woodchuck chuck,
+ f a woodchuck could chuck wood?
+ How many poles could a polak lock,
+ If a polak could lock poles?
+ How many knees could a negro grow,
+ If a negro could grow knees?
+ The answer, my dear,
+ is stick it in your ear.
+ The answer is, stick it in your ear...
+
+}poem
+
+The singing ends, and Stallman's lips curl into another child-like half smile. I glance around at the nearby tables. The Asian families enjoying their Sunday lunch pay little attention to the bearded alto in their midst.~{ For Stallman's own filks, \\ visit http://www.stallman.org/doggerel.html . To hear Stallman singing "The Free Software Song," \\ visit http://www.gnu.org/music/free-software-song.html. }~ After a few moments of hesitation, I finally smile too.
+
+"Do you want that last cornball?" Stallman asks, eyes twinkling. Before I can screw up the punch line, Stallman grabs the corn-encrusted dumpling with his two chopsticks and lifts it proudly. "Maybe I'm the one who should get the cornball," he says.
+
+The food gone, our conversation assumes the dynamics of a normal interview. Stallman reclines in his chair and cradles a cup of tea in his hands. We resume talking about Napster and its relation to the free software movement. Should the principles of free software be extended to similar arenas such as music publishing? I ask.
+
+"It's a mistake to transfer answers from one thing to another," says Stallman, contrasting songs with software programs. "The right approach is to look at each type of work and see what conclusion you get."
+
+When it comes to copyrighted works, Stallman says he divides the world into three categories. The first category involves "functional" works - e.g., software programs, dictionaries, and textbooks. The second category involves works that might best be described as "testimonial" - e.g., scientific papers and historical documents. Such works serve a purpose that would be undermined if subsequent readers or authors were free to modify the work at will. It also includes works of personal expression - e.g., diaries, journals, and autobiographies. To modify such documents would be to alter a person's recollections or point of view, which Stallman considers ethically unjustifiable. The third category includes works of art and entertainment.
+={copyrighted works, categories of}
+
+Of the three categories, the first should give users the unlimited right to make modified versions, while the second and third should regulate that right according to the will of the original author. Regardless of category, however, the freedom to copy and redistribute non-commercially should remain unabridged at all times, Stallman insists. If that means giving Internet users the right to generate a hundred copies of an article, image, song, or book and then email the copies to a hundred strangers, so be it. "It's clear that private occasional redistribution must be permitted, because only a police state can stop that," Stallman says. "It's antisocial to come between people and their friends. Napster has convinced me that we also need to permit, must permit, even noncommercial redistribution to the public for the fun of it. Because so many people want to do that and find it so useful."
+={Napster}
+
+When I ask whether the courts would accept such a permissive outlook, Stallman cuts me off.
+
+"That's the wrong question," he says. "I mean now you've changed the subject entirely from one of ethics to one of interpreting laws. And those are two totally different questions in the same field. It's useless to jump from one to the other. How the courts would interpret the existing laws is mainly in a harsh way, because that's the way these laws have been bought by publishers."
+
+The comment provides an insight into Stallman's political philosophy: just because the legal system currently backs up businesses' ability to treat copyright as the software equivalent of land title doesn't mean computer users have to play the game according to those rules. Freedom is an ethical issue, not a legal issue. "I'm looking beyond what the existing laws are to what they should be," Stallman says. "I'm not trying to draft legislation. I'm thinking about what should the law do? I consider the law prohibiting the sharing of copies with your friend the moral equivalent of Jim Crow. It does not deserve respect."
+
+The invocation of Jim Crow prompts another question. How much influence or inspiration does Stallman draw from past political leaders? Like the civil-rights movement of the 1950s and 1960s, his attempt to drive social change is based on an appeal to timeless values: freedom, justice, and fair play.
+
+Stallman divides his attention between my analogy and a particularly tangled strand of hair. When I stretch the analogy to the point where I'm comparing Stallman with Dr. Martin Luther King, Jr., Stallman, after breaking off a split end and popping it into his mouth, cuts me off.
+
+"I'm not in his league, but I do play the same game," he says, chewing.
+
+I suggest Malcolm X as another point of comparison. Like the former Nation of Islam spokesperson, Stallman has built up a reputation for courting controversy, alienating potential allies, and preaching a message favoring self-sufficiency over cultural integration.
+
+Chewing on another split end, Stallman rejects the comparison. "My message is closer to King's message," he says. "It's a universal message. It's a message of firm condemnation of certain practices that mistreat others. It's not a message of hatred for anyone. And it's not aimed at a narrow group of people. I invite anyone to value freedom and to have freedom."
+
+Many criticize Stallman for rejecting handy political alliances; some psychologize this and describe it as a character trait. In the case of his well-publicized distaste for the term "open source," the unwillingness to participate in recent coalition-building projects seems understand-able. As a man who has spent the last two decades stumping on the behalf of free software, Stallman's political capital is deeply invested in the term. Still, comments such as the "Han Solo" comparison at the 1999 LinuxWorld have only reinforced Stallman's reputation, amongst those who believe virtue consists of following the crowd, as a disgruntled mossback unwilling to roll with political or marketing trends.
+
+"I admire and respect Richard for all the work he's done," says Red Hat president Robert Young, summing up Stallman's paradoxical political conduct. "My only critique is that sometimes Richard treats his friends worse than his enemies."
+={Young, Robert;Red Hat Inc.}
+
+[RMS: The term "friends" only partly fits people such as Young, and companies such as Red Hat. It applies to some of what they did, and do: for instance, Red Hat contributes to development of free software, including some GNU programs. But Red Hat does other things that work against the free software movement's goals - for instance, its versions of GNU/Linux contain non-free software. Turning from deeds to words, referring to the whole system as "Linux" is unfriendly treatment of the GNU Project, and promoting "open source" instead of "free software" rejects our values. I could work with Young and Red Hat when we were going in the same direction, but that was not often enough to make them possible allies.]
+
+Stallman's reluctance to ally the free software movement with other political causes is not due to lack of interest in them. Visit his offices at MIT, and you instantly find a clearinghouse of left-leaning news articles covering civil-rights abuses around the globe. Visit his personal web site, stallman.org, and you'll find attacks on the Digital Millennium Copyright Act, the War on Drugs, and the World Trade Organization. Stallman explains, "We have to be careful of entering the free software movement into alliances with other political causes that substantial numbers of free software supporters might not agree with. For instance, we avoid linking the free software movement with any political party because we do not want to drive away the supporters and elected officials of other parties."
+={Digital Millennium Copyright Act;War on Drugs;World Trade Organization}
+
+Given his activist tendencies, I ask, why hasn't Stallman sought a larger voice? Why hasn't he used his visibility in the hacker world as a platform to boost his political voice? [RMS: But I do - when I see a good opportunity. That's why I started stallman.org. ]
+
+Stallman lets his tangled hair drop and contemplates the question for a moment. [RMS: My quoted response doesn't fit that question. It does fit a different question, "Why do you focus on free software rather than on the other causes you believe in?" I suspect the question I was asked was more like that one.]
+
+"I hesitate to exaggerate the importance of this little puddle of freedom," he says. "Because the more well-known and conventional areas of working for freedom and a better society are tremendously important. I wouldn't say that free software is as important as they are. It's the responsibility I undertook, because it dropped in my lap and I saw a way I could do something about it. But, for example, to end police brutality, to end the war on drugs, to end the kinds of racism we still have, to help everyone have a comfortable life, to protect the rights of people who do abortions, to protect us from theocracy, these are tremendously important issues, far more important than what I do. I just wish I knew how to do something about them."
+
+Once again, Stallman presents his political activity as a function of personal confidence. Given the amount of time it has taken him to develop and hone the free software movement's core tenets, Stallman is hesitant to believe he can advance the other causes he supports.
+
+"I wish I knew how to make a major difference on those bigger issues, because I would be tremendously proud if I could, but they're very hard and lots of people who are probably better than I am have been working on them and have gotten only so far," he says. "But as I see it, while other people were defending against these big visible threats, I saw another threat that was unguarded. And so I went to defend against that threat. It may not be as big a threat, but I was the only one there [to oppose it]."
+
+Chewing a final split end, Stallman suggests paying the check. Be-fore the waiter can take it away, however, Stallman pulls out a white-colored dollar bill and throws it on the pile. The bill looks so clearly counterfeit, I can't help but pick it up and read it. Sure enough, it did not come from the US Mint. Instead of bearing the image of a George Washington or Abe Lincoln, the bill's front side bears the image of a cartoon pig. Instead of the United States of America, the banner above the pig reads, "Untied Status of Avarice." The bill is for zero dollars,~{ RMS: Williams was mistaken to call this bill "counterfeit." It is legal tender, worth zero dollars for payment of any debt. Any U.S. government office will convert it into zero dollars' worth of gold. }~ and when the waiter picks up the money, Stallman makes sure to tug on his sleeve.
+
+"I added an extra zero to your tip," Stallman says, yet another half smile creeping across his lips.
+
+The waiter, uncomprehending or fooled by the look of the bill, smiles and scurries away.
+
+"I think that means we're free to go," Stallman says.
+
+1~ Chapter 6 - The Emacs Commune
+={Emacs Commune+52;Stallman, Richard M.:AI Lab, as a programmer+18;Stallman, Richard M.:Emacs Commune and+52}
+
+The AI Lab of the 1970s was by all accounts a special place. Cutting-edge projects and top-flight researchers gave it an esteemed position in the world of computer science. The internal hacker culture and its anarchic policies lent a rebellious mystique as well. Only later, when many of the lab's scientists and software superstars had departed, would hackers fully realize the unique and ephemeral world they had once inhabited.
+
+"It was a bit like the Garden of Eden," says Stallman, summing up the lab and its software-sharing ethos in a 1998 /{Forbes}/ article. "It hadn't occurred to us not to cooperate."~{ See Josh McHugh, "For the Love of Hacking," Forbes (August 10, 1998), \\ http://www.forbes.com/forbes/1998/0810/6203094a.html. }~
+
+Such mythological descriptions, while extreme, underline an important fact. The ninth floor of 545 Tech Square was more than a workplace for many. For hackers such as Stallman, it was home.
+
+The word "home" is a weighted term in the Stallman lexicon. In a pointed swipe at his parents, Stallman, to this day, refuses to acknowledge any home before Currier House, the dorm he lived in during his days at Harvard. He has also been known to describe leaving that home in tragicomic terms. Once, while describing his years at Harvard, Stallman said his only regret was getting kicked out. It wasn't until I asked Stallman what precipitated his ouster, that I realized I had walked into a classic Stallman setup line.
+={Currier House (Harvard University)}
+
+"At Harvard they have this policy where if you pass too many classes they ask you to leave," Stallman says.
+
+With no dorm and no desire to return to New York, Stallman followed a path blazed by Greenblatt, Gosper, Sussman, and the many other hackers before him. Enrolling at MIT as a grad student, Stallman rented a room in an apartment in nearby Cambridge but soon viewed the AI Lab itself as his de facto home. In a 1986 speech, Stallman recalled his memories of the AI Lab during this period:
+={Gosper, Bill;Greenblat, Richard;Sussman, Gerald}
+
+_1 I may have done a little bit more living at the lab than most people, because every year or two for some reason or other I'd have no apartment and I would spend a few months living at the lab. And I've always found it very comfortable, as well as nice and cool in the summer. But it was not at all uncommon to find people falling asleep at the lab, again because of their enthusiasm; you stay up as long as you possibly can hacking, because you just don't want to stop. And then when you're completely exhausted, you climb over to the nearest soft horizontal surface. A very informal atmosphere.~{ See Stallman (1986). }~
+
+The lab's home-like atmosphere could be a problem at times. What some saw as a dorm, others viewed as an electronic opium den. In the 1976 book /{Computer Power and Human Reason}/, MIT researcher Joseph Weizenbaum offered a withering critique of the "computer bum," Weizenbaum's term for the hackers who populated computer rooms such as the AI Lab. "Their rumpled clothes, their unwashed hair and unshaved faces, and their uncombed hair all testify that they are oblivious to their bodies and to the world in which they move," Weizenbaum wrote. "[Computer bums] exist, at least when so engaged, only through and for the computers."~{ See Joseph Weizenbaum, Computer Power and Human Reason: From Judgment to Calculation (W. H. Freeman, 1976): 116. }~
+={computer bums;Computer Power and Human Reason (Weizenbaum);Weizenbaum, Joseph+1}
+
+Almost a quarter century after its publication, Stallman still bristles when hearing Weizenbaum's "computer bum" description, discussing it in the present tense as if Weizenbaum himself was still in the room. "He wants people to be just professionals, doing it for the money and wanting to get away from it and forget about it as soon as possible," Stallman says. "What he sees as a normal state of affairs, I see as a tragedy."
+
+Hacker life, however, was not without tragedy. Stallman characterizes his transition from weekend hacker to full-time AI Lab denizen as a series of painful misfortunes that could only be eased through the euphoria of hacking. As Stallman himself has said, the first misfortune was his graduation from Harvard. Eager to continue his studies in physics, Stallman enrolled as a graduate student at MIT. The choice of schools was a natural one. Not only did it give Stallman the chance to follow the footsteps of great MIT alumni: William Shockley ('36), Richard P. Feynman ('39), and Murray Gell-Mann ('51), it also put him two miles closer to the AI Lab and its new PDP-10 computer. "My attention was going toward programming, but I still thought, well, maybe I can do both," Stallman says.
+={Feynman, Richard;Gell-Mann, Murray;Harvard University:graduation from;Shockley, William}
+
+Toiling in the fields of graduate-level science by day and programming in the monastic confines of the AI Lab by night, Stallman tried to achieve a perfect balance. The fulcrum of this geek teeter-totter was his weekly outing with the Folk-Dance Club, his one social outlet that guaranteed at least a modicum of interaction with the opposite sex. Near the end of that first year at MIT, however, disaster struck. A knee injury forced Stallman to stop dancing. At first, Stallman viewed the injury as a temporary problem; he went to dancing and chatted with friends while listening to the music he loved. By the end of the summer, when the knee still ached and classes reconvened, Stallman began to worry. "My knee wasn't getting any better," Stallman recalls," which meant I had to expect to be unable to dance, permanently. I was heartbroken."
+
+With no dorm and no dancing, Stallman's social universe imploded. Dancing was the only situation in which he had found success in meeting women and occasionally even dating them. No more dancing ever was painful enough, but it also meant, it seemed, no more dates ever.
+
+"I felt basically that I'd lost all my energy," Stallman recalls. "I'd lost my energy to do anything but what was most immediately tempting. The energy to do something else was gone. I was in total despair."
+
+Stallman retreated from the world even further, focusing entirely on his work at the AI Lab. By October, 1975, he dropped out of MIT and out of physics, never to return to studies. Software hacking, once a hobby, had become his calling.
+
+Looking back on that period, Stallman sees the transition from full-time student to full-time hacker as inevitable. Sooner or later, he believes, the siren's call of computer hacking would have overpowered his interest in other professional pursuits. "With physics and math, I could never figure out a way to contribute," says Stallman, recalling his struggles prior to the knee injury. "I would have been proud to advance either one of those fields, but I could never see a way to do that. I didn't know where to start. With software, I saw right away how to write things that would run and be useful. The pleasure of that knowledge led me to want to do it more."
+
+Stallman wasn't the first to equate hacking with pleasure. Many of the hackers who staffed the AI Lab boasted similar, incomplete academic resumes. *** Most had come in pursuing degrees in math or electrical engineering only to surrender their academic careers and professional ambitions to the sheer exhilaration that came with solving problems never before addressed. Like St. Thomas Aquinas, the scholastic known for working so long on his theological summae that he sometimes achieved spiritual visions, hackers reached transcendent internal states through sheer mental focus and physical exhaustion. Although Stallman shunned drugs, like most hackers, he enjoyed the "high" that came near the end of a 20-hour coding bender.
+={Thomas Aquinas, saint}
+
+Perhaps the most enjoyable emotion, however, was the sense of personal fulfillment. When it came to hacking, Stallman was a natural. A childhood's worth of late-night study sessions gave him the ability to work long hours with little sleep. As a social outcast since age 10, he had little difficulty working alone. And as a mathematician with a built-in gift for logic and foresight, Stallman possessed the ability to circumvent design barriers that left most hackers spinning their wheels.
+
+"He was special," recalls Gerald Sussman, an AI Lab faculty member and (since 1985) board member of the Free Software Foundation. Describing Stallman as a "clear thinker and a clear designer," Sussman invited Stallman to join him in AI research projects in 1973 and 1975, both aimed at making AI programs that could analyze circuits the way human engineers do it. The project required an expert's command of Lisp, a programming language built specifically for AI applications, as well as understanding (supplied by Sussman) of how a human might approach the same task. The 1975 project pioneered an AI technique called dependency-directed backtracking or truth maintenance, which consists of positing tentative assumptions, noticing if they lead to contradictions, and reconsidering the pertinent assumptions if that occurs.
+={LISP programming language;Sussman, Gerald}
+
+When he wasn't working on official projects such as these, Stallman devoted his time to pet projects. It was in a hacker's best interest to improve the lab's software infrastructure, and one of Stallman's biggest pet projects during this period was the lab's editor program TECO.
+={TECO editor program+23}
+
+The story of Stallman's work on TECO during the 1970s is inextricably linked with Stallman's later leadership of the free software movement. It is also a significant stage in the history of computer evolution, so much so that a brief recapitulation of that evolution is necessary. During the 1950s and 1960s, when computers were first appearing at universities, computer programming was an incredibly abstract pursuit. To communicate with the machine, programmers created a series of punch cards, with each card representing an individual software command. Programmers would then hand the cards over to a central system administrator who would then insert them, one by one, into the machine, waiting for the machine to spit out a new set of punch cards, which the programmer would then decipher as output. This process, known as "batch processing," was cumbersome and time consuming. It was also prone to abuses of authority. One of the motivating factors behind hackers' inbred aversion to centralization was the power held by early system operators in dictating which jobs held top priority.
+={batch processing;Free Software Foundation (FSF):TECO text-editor and;punch cards, for batch processing}
+
+In 1962, computer scientists and hackers involved in MIT's Project MAC, an early forerunner of the AI Lab, took steps to alleviate this frustration. Time-sharing, originally known as "time stealing," made it possible for multiple programs to take advantage of a machine's operational capabilities. Teletype interfaces also made it possible to communicate with a machine not through a series of punched holes but through actual text. A programmer typed in commands and read the line-by-line output generated by the machine.
+={Project MAC;teletype interfaces vs. batch processing+3}
+
+During the late 1960s, interface design made additional leaps. In a famous 1968 lecture, Doug Engelbart, a scientist then working at the Stanford Research Institute, unveiled a prototype of the modern graphical interface. Rigging up a television set to the computer and adding a pointer device which Engelbart dubbed a "mouse," the scientist created a system even more interactive than the time-sharing system developed at MIT. Treating the video display like a high-speed printer, Engelbart's system gave a user the ability to move the cursor around the screen and see the cursor position updated by the computer in real time. The user suddenly had the ability to position text anywhere on the screen.
+={Engelbart, Doug;graphial interfaces;mice, as video pointers;Stanford Research Institute}
+
+Such innovations would take another two decades to make their way into the commercial marketplace. Still, by the 1970s, video screens had started to replace teletypes as display terminals, creating the potential for full-screen - as opposed to line-by-line - editing capabilities.
+={display terminals, replacing teletypes;video screens}
+
+One of the first programs to take advantage of this full-screen capability was the MIT AI Lab's TECO. Short for Text Editor and COrrector, the program had been upgraded by hackers from an old teletype line editor for the lab's PDP-6 machine.~{ According to the Jargon File, TECO's name originally stood for Tape Editor and Corrector. \\ See http://www.catb.org/jargon/html/T/TECO.html. }~
+
+TECO was a substantial improvement over old editors, but it still had its drawbacks. To create and edit a document, a programmer had to enter a series of commands specifying each edit. It was an abstract process. Unlike modern word processors, which update text with each keystroke, TECO demanded that the user enter an extended series of editing instructions followed by an "end of command string" sequence just to change the text. Over time, a hacker grew proficient enough to make large changes elegantly in one command string, but as Stallman himself would later point out, the process required "a mental skill like that of blindfold chess."~{ See Richard Stallman, "EMACS: The Extensible, Customizable, Display Editor," AI Lab Memo (1979). An updated HTML version of this memo, from which I am quoting, is available at \\ http://www.gnu.org/software/emacs/emacs-paper.html. }~
+
+To facilitate the process, AI Lab hackers had built a system that displayed both the text and the command string on a split screen. Despite this innovative hack, editing with TECO still required skill and planning.
+
+TECO wasn't the only full-screen editor floating around the computer world at this time. During a visit to the Stanford Artificial Intelligence Lab in 1976, Stallman encountered an edit program named E. The program contained an internal feature, which allowed a user to update display text after each command keystroke. In the language of 1970s programming, E was one of the first rudimentary WYSIWYG editors. Short for "what you see is what you get," WYSIWYG meant that a user could manipulate the file by moving through the displayed text, as opposed to working through a back-end editor program."~{ See Richard Stallman, "Emacs the Full Screen Editor" (1987), \\ http://www.lysator.liu.se/history/garb/txt/87-1-emacs.txt. }~
+={E edit program;Stanford Artificial Intelligence Laboratory}
+
+Impressed by the hack, Stallman looked for ways to expand TECO's functionality in similar fashion upon his return to MIT. He found a TECO feature called Control-R, written by Carl Mikkelson and named after the two-key combination that triggered it. Mikkelson's hack switched TECO from its usual abstract command-execution mode to a more intuitive keystroke-by-keystroke mode. The only flaws were that it used just five lines of the screen and was too inefficient for real use. Stallman reimplemented the feature to use the whole screen efficiently, then extended it in a subtle but significant way. He made it possible to attach TECO command strings, or "macros," to keystrokes. Advanced TECO users already saved macros in files; Stallman's hack made it possible to call them up fast. The result was a user-programmable WYSIWYG editor. "That was the real breakthrough," says Guy Steele, a fellow AI Lab hacker at the time.~{ Ibid. }~
+={macro modes, adding to TECO+11;Steele, Guy+13}
+
+By Stallman's own recollection, the macro hack touched off an explosion of further innovation. "Everybody and his brother was writing his own collection of redefined screen-editor commands, a command for everything he typically liked to do," Stallman would later recall. "People would pass them around and improve them, making them more powerful and more general. The collections of redefinitions gradually became system programs in their own right."~{ Ibid. }~
+
+So many people found the macro innovations useful and had incorporated it into their own TECO programs that the TECO editor had become secondary to the macro mania it inspired. "We started to categorize it mentally as a programming language rather than as an editor," Stallman says. Users were experiencing their own pleasure tweaking the software and trading new ideas.~{ Ibid. }~
+
+Two years after the explosion, the rate of innovation began to exhibit inconvenient side effects. The explosive growth had provided an exciting validation of the collaborative hacker approach, but it had also led to incompatibility. "We had a Tower of Babel effect," says Guy Steele.
+
+The effect threatened to kill the spirit that had created it, Steele says. Hackers had designed ITS to facilitate programmers' ability to share knowledge and improve each other's work. That meant being able to sit down at another programmer's desk, open up a programmer's work and make comments and modifications directly within the software. "Sometimes the easiest way to show somebody how to program or debug something was simply to sit down at the terminal and do it for them," explains Steele.
+
+The macro feature, after its second year, began to foil this capability. In their eagerness to embrace the new full-screen capabilities, hackers had customized their versions of TECO to the point where a hacker sitting down at another hacker's terminal usually had to spend the first hour just figuring out what macro commands did what.
+
+Frustrated, Steele took it upon himself to solve the problem. He gathered together the four different macro packages and began assembling a chart documenting the most useful macro commands. In the course of implementing the design specified by the chart, Steele say she attracted Stallman's attention.
+
+"He started looking over my shoulder, asking me what I was doing," recalls Steele.
+
+For Steele, a soft-spoken hacker who interacted with Stallman infrequently, the memory still sticks out. Looking over another hacker's shoulder while he worked was a common activity at the AI Lab. Stallman, the TECO maintainer at the lab, deemed Steele's work "interesting" and quickly set off to complete it.
+
+"As I like to say, I did the first 0.001 percent of the implementation, and Stallman did the rest," says Steele with a laugh.
+
+The project's new name, Emacs, came courtesy of Stallman. Short for "editing macros," it signified the evolutionary transcendence that had taken place during the macros explosion two years before. It also took advantage of a gap in the software programming lexicon. Noting a lack of programs on ITS starting with the letter "E," Stallman chose Emacs, making it natural to reference the program with a single letter. Once again, the hacker lust for efficiency had left its mark.~{ Ibid. }~
+={Emacs text editor+11;GNU Emacs+11}
+
+Of course, not everyone switched to Emacs, or not immediately. Users were free to continue maintaining and running their own TECO-based editors as before. But most found it preferable to switch to Emacs, especially since Emacs was designed to make it easy to replace or add some parts while using others unchanged.
+
+"On the one hand, we were trying to make a uniform command set again; on the other hand, we wanted to keep it open ended, because the programmability was important," recalls Steele.
+
+Stallman now faced another conundrum: if users made changes but didn't communicate those changes back to the rest of the community, the Tower of Babel effect would simply emerge in other places. Falling back on the hacker doctrine of sharing innovation, Stallman embedded a statement within the source code that set the terms of use. Users were free to modify and redistribute the code on the condition that they gave back all the extensions they made. Stallman called this "joining the Emacs Commune." Just as TECO had become more than a simple editor, Emacs had become more than a simple software program. To Stallman, it was a social contract. In a 1981 memo documenting the project, Stallman spelled out the contract terms. "EMACS," he wrote, "was distributed on a basis of communal sharing, which means that all improvements must be given back to me to be incorporated and distributed."~{ See Stallman (1979): #SEC34. }~
+={Emacs Commune}
+
+The original Emacs ran only on the PDP-10 computer, but soon users of other computers wanted an Emacs to edit with. The explosive innovation continued throughout the decade, resulting in a host of Emacs-like programs with varying degrees of cross-compatibility. The Emacs Commune's rules did not apply to them, since their code was separate. A few cited their relation to Stallman's original Emacs with humorously recursive names: Sine (Sine is not Emacs), Eine (Eine isnot Emacs), and Zwei (Zwei was Eine initially). A true Emacs had to provide user-programmability like the original; editors with similar keyword commands but without the user-programmability were called "ersatz Emacs." One example was Mince (Mince is Not Complete Emacs).
+={Eine (Eine is not Emacs) text editor;Zwei (Zwei was Eine initially) text editor;Sine (Sine is not Emacs) text editor}
+
+While Stallman was developing Emacs in the AI Lab, there were other, unsettling developments elsewhere in the hacker community. Brian Reid's 1979 decision to embed "time bombs" in Scribe, making it possible for Unilogic to limit unpaid user access to the software, was a dark omen to Stallman. "He considered it the most Nazi thing he ever saw in his life," recalls Reid. Despite going on to later Internet fame as the co-creator of the Usenet /{alt}/ hierarchy, Reid says he still has yet to live down that 1979 decision, at least in Stallman's eyes. "He said that all software should be free and the prospect of charging money for software was a crime against humanity."~{ In a 1996 interview with online magazine MEME , Stallman cited Scribe's sale as irksome, but declined to mention Reid by name. "The problem was nobody censured or punished this student for what he did," Stallman said. "The result was other people got tempted to follow his example." See MEME 2.04, \\ http://memex.org/meme2-04.html. }~
+={Reid, Brian+1;Unilogic software company;time bombs, in software;Scribe text-formatting program}
+
+Although Stallman had been powerless to head off Reid's sale, he did possess the ability to curtail other forms of behavior deemed contrary to the hacker ethos. As central source-code maintainer for the original Emacs, Stallman began to wield his power for political effect. During his final stages of conflict with the administrators at the Laboratory for Computer Science over password systems, Stallman initiated a software "strike," refusing to send lab members the latest version of Emacs until they rejected the security system on the lab's computers.~{ See Steven Levy, Hackers (Penguin USA [paperback], 1984): 419. }~ This was more gesture than sanction, since nothing could stop them from installing it themselves. But it got the point across: putting passwords on an ITS system would lead to condemnation and reaction.
+={security (computer), opposition to;strike, at the Laboratory for Computer Science}
+
+"A lot of people were angry with me, saying I was trying to hold them hostage or blackmail them, which in a sense I was," Stallman would later tell author Steven Levy. "I was engaging in violence against them because I thought they were engaging in violence to everyone at large."~{ Ibid. }~
+
+Over time, Emacs became a sales tool for the hacker ethic. The flexibility Stallman had built into the software not only encouraged collaboration, it demanded it. Users who didn't keep abreast of the latest developments in Emacs evolution or didn't contribute their contributions back to Stallman ran the risk of missing out on the latest breakthroughs. And the breakthroughs were many. Twenty years later, users of GNU Emacs (a second implementation started in 1984)have modified it for so many different uses - using it as a spreadsheet, calculator, database, and web browser - that later Emacs developers adopted an overflowing sink to represent its versatile functionality. "That's the idea that we wanted to convey," says Stallman. "The amount of stuff it has contained within it is both wonderful and awful at the same time."
+
+Stallman's AI Lab contemporaries are more charitable. Hal Abelson, an MIT grad student who worked with Sussman during the 1970sand would later assist Stallman as a charter board member of the FreeSoftware Foundation, describes Emacs as "an absolutely brilliant creation." In giving programmers a way to add new software libraries and features without messing up the system, Abelson says, Stallman paved the way for future large-scale collaborative software projects. "Its structure was robust enough that you'd have people all over the world who were loosely collaborating [and] contributing to it," Abelson says. "I don't know if that had been done before."~{ In writing this chapter, I've elected to focus more on the social significance of Emacs than the software significance. To read more about the software side, I recommend Stallman's 1979 memo. I particularly recommend the section titled "Research Through Development of Installed Tools" (#SEC27). Not only is it accessible to the nontechnical reader, it also sheds light on how closely inter-twined Stallman's political philosophies are with his software-design philosophies. A sample excerpt follows:EMACS could not have been reached by a process of careful design, because such processes arrive only at goals which are visible at the outset, and whose desirability is established on the bottom line at the outset. Neither I nor anyone else visualized an extensible editor until I had made one, nor appreciated its value until he had experienced it. EMACS exists because I felt free to make individually useful small improvements on a path whose end was not in sight. }~
+={Abelson, Hal}
+
+Guy Steele expresses similar admiration. Currently a research scientist for Sun Microsystems, he remembers Stallman primarily as a "brilliant programmer with the ability to generate large quantities of relatively bug-free code." Although their personalities didn't exactly mesh, Steele and Stallman collaborated long enough for Steele to get a glimpse of Stallman's intense coding style. He recalls a notable episode in the late 1970s when the two programmers banded together to write the editor's "pretty print" feature. Originally conceived by Steele, pretty print was another keystroke-triggered feature that reformatted Emacs' source code so that it was both more readable and took up less space, further bolstering the program's WYSIWYG qualities. The feature was strategic enough to attract Stallman's active interest, and it wasn't long before Steele wrote that he and Stallman were planning an improved version.
+={Steele, Guy+3;Sun Microsystems}
+
+"We sat down one morning," recalls Steele. "I was at the keyboard, and he was at my elbow," says Steele. "He was perfectly willing to let me type, but he was also telling me what to type.
+
+The programming session lasted 10 hours. Throughout that entire time, Steele says, neither he nor Stallman took a break or made any small talk. By the end of the session, they had managed to hack the pretty print source code to just under 100 lines. "My fingers were on the keyboard the whole time," Steele recalls, "but it felt like both of our ideas were flowing onto the screen. He told me what to type, and I typed it."
+
+The length of the session revealed itself when Steele finally left the AI Lab. Standing outside the building at 545 Tech Square, he was surprised to find himself surrounded by nighttime darkness. Asa programmer, Steele was used to marathon coding sessions. Still, something about this session was different. Working with Stallman had forced Steele to block out all external stimuli and focus his entire mental energies on the task at hand. Looking back, Steele says he found the Stallman mind-meld both exhilarating and scary at the same time. "My first thought afterward was [that] it was a great experience, very intense, and that I never wanted to do it again in my life."
+
+1~ Chapter 7 - A Stark Moral Choice
+={Stallman, Richard M.:GNU Project+72}
+
+On September 27, 1983, computer programmers logging on to the Usenet newsgroup net.unix-wizards encountered an unusual message. Posted in the small hours of the morning, 12:30 a.m. to be exact, and signed by rms@mit-oz, the message's subject line was terse but attention-grabbing. "New UNIX implementation," it read. Instead of introducing a newly released version of Unix, however, the message's opening paragraph issued a call to arms:
+={GNU Project:new UNIX implementation;net.unix-wizards newsgroup}
+
+_1 Starting this Thanksgiving I am going to write a complete Unix-compatible software system called GNU (for Gnu's Not Unix), and give it away free to everyone who can use it. Contributions of time, money, programs and equipment are greatly needed.~{ See Richard Stallman, "Initial GNU Announcement" (September 1983). }~
+={Unix operating system:GNU system and}
+
+To an experienced Unix developer, the message was a mixture of idealism and hubris. Not only did the author pledge to rebuild the already mature Unix operating system from the ground up, he also proposed to improve it in places. The new GNU system, the author predicted, would carry all the usual components - a text editor, a shell program to run Unix-compatible applications, a compiler, "and a few other things."~{ Ibid. }~ It would also contain many enticing features that other Unix systems didn't yet offer: a graphic user interface based on the Lisp programming language, a crash-proof file system, and networking protocols built according to MIT's internal networking system.
+={LISP programming language:GNU system and}
+
+"GNU will be able to run Unix programs, but will not be identical to Unix," the author wrote. "We will make all improvements that are convenient, based on our experience with other operating systems."
+
+Anticipating a skeptical response on some readers' part, the author made sure to follow up his operating-system outline with a brief biographical sketch titled, "Who am I?":
+
+_1 I am Richard Stallman, inventor of the original much-imitated EMACS editor, now at the Artificial Intelligence Lab at MIT. I have worked extensively on compilers, editors, debuggers, command interpreters, the Incompatible Timesharing System and the Lisp Machine operating system. I pioneered terminal-independent display support in ITS. In addition I have implemented one crash proof file system and two window systems for Lisp machines.~{ Ibid. }~
+
+As fate would have it, Stallman's fanciful GNU Project missed its Thanksgiving launch date. By January, 1984, however, Stallman made good on his promise and fully immersed himself in the world of Unix software development. For a software architect raised on ITS, it was like designing suburban shopping malls instead of Moorish palaces. Even so, building a Unix-like operating system had its hidden advantages. ITS had been powerful, but it also possessed an Achilles' heel: MIT hackers had written it specifically to run on the powerful DEC-built PDP-10 computer. When AI Lab administrators elected to phase out the lab's PDP-10 machine in the early 1980s, the operating system that hackers once likened to a vibrant city became an instant ghost town. Unix, on the other hand, was designed for portability, which made it immune to such dangers. Originally developed by junior scientists at AT&T, the program had slipped out under corporate-management radar, finding a happy home in the cash-strapped world of academic computer systems. With fewer resources than their MIT brethren, Unix developers had customized the software to ride atop a motley assortment of hardware systems, primarily the 16-bit PDP-11 - a machine considered fit for only small tasks by most AI Lab hackers - but later also 32-bit mainframes such as the VAX 11/780. By 1983, a few companies, most notably Sun Microsystems, were developing a more powerful generation of desktop computers, dubbed "workstations," to take advantage of that increasingly ubiquitous operating system on machines comparable in power to the much older PDP-10.
+={AT&T;Incompatible Timesharing System (ITS)+5;VAX 11/780;PDP-10 computer;PDP-11 computer;Sun Microsystems:developing workstations}
+
+To facilitate portability, the developers of Unix had put an extra layer of abstraction between the software and the machine. Rather than writing it in the instructions of a specific machine type - as the AI Lab hackers had done with ITS and the PDP-10 - Unix developers wrote in a high-level language, called C. Focusing more on the inter-locking interfaces and specifications that held the operating system's many subcomponents together, rather than the actual components themselves, they created a system that could be quickly modified to run on any machine. If a user disliked a certain component, the interface specifications made it possible to pull out an individual subcomponent and either fix it or replace it with something better. Simply put, the Unix approach promoted flexibility and economy, hence its rapid adoption.~{ See Marshall Kirk McKusick, "Twenty Years of Berkeley Unix," Open Sources (O'Reilly & Associates, Inc., 1999): 38. }~
+={abstraction:designing Unix;Unix operating system:adoption through flexibility}
+
+Stallman's decision to start developing the GNU system was triggered by the end of the ITS system that the AI Lab hackers had nurtured for so long. The demise of ITS, and the AI Lab hacker community which had sustained it, had been a traumatic blow to Stallman. If the Xerox laser printer episode had taught him to recognize the in- justice of proprietary software, the community's death forced him to choose between surrendering to proprietary software and opposing it.
+={AI Lab (Artificial Intelligence Laboratory):ITS demise+3}
+
+Like the software code that composed it, the roots of ITS' demise stretched way back. By 1980, most of the lab's hackers were working on developing the Lisp Machine and its operating system.
+
+Created by artificial-intelligence research pioneer John McCarthy, a MIT artificial-intelligence researcher during the late 1950s, Lisp is an elegant language, well-suited for writing complex programs to operate on data with irregular structure. The language's name is a shortened version of LISt Processing. Following McCarthy's departure to the Stanford Artificial Intelligence Laboratory, MIT hackers refined the language into a local dialect dubbed MACLISP. The "MAC" stood for Project MAC, the DARPA-funded research project that gave birth to the AI Lab and the Laboratory for Computer Science. Led by AI Labarch-hacker Richard Greenblatt, the AI Lab hackers during the late 1970s designed a computer specialized for running Lisp efficiently and conveniently, the Lisp Machine, then developed an entire Lisp-based operating system for it.
+
+By 1980, two rival groups of hackers had formed two companies to manufacture and sell copies of the Lisp Machine. Greenblatt started Lisp Machines Incorporated. He planned to avoid outside investment and make a "hacker company." Most of the hackers joined Symbolics, a conventional startup. In 1982 they entirely ceased to work at MIT.
+
+With few hackers left to mind the shop, programs and machines took longer to fix - or were not fixed at all. Even worse, Stallman says, the lab began to undergo a "demographic change." The hackers who had once formed a vocal minority within the AI Lab were almost gone while "the professors and the students who didn't really love the [PDP-10] were just as numerous as before."~{ See Richard Stallman (1986). }~
+={PDP-10 computer+4}
+
+In 1982, the AI Lab received the replacement for its main computer, the PDP-10, which was over 12 years old. Digital's current model, the Dec system 20, was compatible for user programs but would have re-quired a drastic rewrite or "port" of ITS if hackers wanted to continue running the same operating system. Fearful that the lab had lost its critical mass of in-house programming talent, AI Lab faculty members pressed for Twenex, a commercial operating system developed by Digital. Outnumbered, the hackers had no choice but to comply.
+
+"Without hackers to maintain the system, [faculty members] said,'We're going to have a disaster; we must have commercial software,'" Stallman would recall a few years later. "They said, 'We can expect the company to maintain it.' It proved that they were utterly wrong, but that's what they did."~{ Ibid. }~
+
+At first, hackers viewed the Twenex system as yet another authoritarian symbol begging to be subverted. The system's name itself was a protest. Officially dubbed TOPS-20 by DEC, it was named as a successor to TOPS-10, a proprietary operating system DEC distributed for the PDP-10. But TOPS-20 was not based on TOPS-10. It was derived from the Tenex system which Bolt Beranek Newmanhad developed for the PDP-10.~{ Multiple sources: see Richard Stallman interview, Gerald Sussman email, and Jargon File 3.0.0 at \\ http://catb.org/jargon/html/T/TWENEX.html. }~ Stallman, the hacker who coined the Twenex term, says he came up with the name as a way to avoid using the TOPS-20 name. "The system was far from tops, so there was noway I was going to call it that," Stallman recalls. "So I decided to insert a 'w' in the Tenex name and call it Twenex."
+={DEC (Digital Equipment Corporation);TOPS-20 operating system+1;KL-10 mainframe+11;Twenex operating systems+4}
+
+{free_as_in_freedom_2_01_pdp_1_processor_with_kl_10.png 302x203 "PDP-1 processor with KL-10 (a PDP-10 similar to that of the AI Lab), Stanford Artificial Intelligence Laboratory, 1979." }http://en.wikipedia.org/wiki/Richard_stallman
+
+The machine that ran the Twenex/TOPS-20 system had its own derisive nickname: Oz. According to one hacker legend, the machine got its nickname because it required a smaller PDP-11 machine to power its terminal. One hacker, upon viewing the KL-10-PDP-11setup for the first time, likened it to the wizard's bombastic on screen introduction in the Wizard of Oz. "I am the great and powerful Oz," the hacker intoned. "Pay no attention to the PDP-11 behind that console."~{ See http://www.as.cmu.edu/~geek/humor/See_Figure_1.txt. }~
+={Oz+8;PDP-11 computer}
+
+If hackers laughed when they first encountered the KL-10, their laughter quickly died when they encountered Twenex. Not only did Twenex boast built-in security, but the system's software engineers had designed the tools and applications with the security system in mind. What once had been a cat-and-mouse game over passwords in the case of the Laboratory for Computer Science's security system, now became an out-and-out battle over system management. System administrators argued that without security, the Oz system was more prone to accidental crashes. Hackers argued that crashes could be better prevented by overhauling the source code. Unfortunately, the number of hackers with the time and inclination to perform this sort of overhaul had dwindled to the point that the system-administrator argument prevailed.
+={security (computer), opposition to:Twenex operating systems and}
+
+The initial policy was that any lab member could have the "wheel privilege" to bypass security restrictions. But anyone who had the "wheel privilege" could take it away from anyone else, who would then be powerless to restore it. This state of affairs tempted a small group of hackers to try to seize total control by canceling the "wheel privilege" for all but themselves.
+
+Cadging passwords, and applying the debugger during startup, Stallman successfully foiled these attempts. After the second foiled" /{coup d'état}/," Stallman issued an alert to all the AI Lab personnel.~{ See Richard Stallman (1986). }~
+
+"There has been another attempt to seize power," Stallman wrote. "So far, the aristocratic forces have been defeated." To protect his identity, Stallman signed the message "Radio Free OZ."
+
+The disguise was a thin one at best. By 1982, Stallman's aversion to passwords and secrecy had become so well known that users outside the AI Laboratory were using his account from around the ARPAnet - the research-funded computer network that would serve as a foundation for today's Internet. One such "tourist" during the early 1980s was Don Hopkins, a California programmer who learned through the hacking grapevine that all an outsider needed to do to gain access to MIT's vaunted ITS system was to log in under the initials RMS and enter the same three-letter monogram when the system requested a password.
+={ARPAnet+2;Hopkins, Don}
+
+"I'm eternally grateful that MIT let me and many other people use their computers for free," says Hopkins. "It meant a lot to many people."
+
+This so-called "tourist" policy, which had been openly tolerated by MIT management during the ITS years,~{ See "MIT AI Lab Tourist Policy," \\ http://www.art.net/~hopkins/Don/text/tourist-policy.html. }~ fell by the wayside when Oz became the lab's primary link to the ARPAnet. At first, Stallman continued his policy of repeating his login ID as a password so outside users could have access through his account. Over time, however, Oz's fragility prompted administrators to bar outsiders who, through sheer accident or malicious intent, might bring down the system. When those same administrators eventually demanded that Stall-man stop publishing his password, Stallman, citing personal ethics, instead ceased using the Oz system altogether.~{ See Richard Stallman (1986). }~
+
+"[When] passwords first appeared at the MIT AI Lab I [decided] to follow my belief that there should be no passwords," Stallman would later say. "Because I don't believe that it's really desirable to have security on a computer, I shouldn't be willing to help uphold the security regime."~{ Ibid. }~
+
+Stallman's refusal to bow before the great and powerful Oz symbolized the growing tension between hackers and AI Lab management during the early 1980s. This tension paled in comparison to the conflict that raged within the hacker community itself. By the time the Dec system 20 arrived, the hacker community was divided into two camps, LMI and Symbolics.
+={Symbolics+15;LISP programming language+1}
+
+Symbolics, with its outside investment, recruited various AI Lab hackers and set some of them working on improving parts of the Lisp Machine operating system outside the auspices of the AI Lab. By the end of 1980, the company had hired 14 AI Lab staffers as part-time consultants to develop its version of the Lisp Machine. The remaining few, apart from Stallman, worked for LMI.~{ See Steve Levy, Hackers, page 423. }~ Stallman, preferring the unpressured life at the AI Lab and not wishing to take a side, chose to join neither company.
+={AI Lab (Artificial Intelligence Laboratory):Symbolics and+10}
+
+At first, the other hackers continued spending some of their time at MIT, and contributed to MIT's Lisp Machine operating system. Both LMI and Symbolics had licensed this code from MIT. The license required them to return their changes to MIT, but did not require them to let MIT redistribute these changes. However, through 1981 they adhered to a gentleman's agreement to permit that, so all their system improvements were included in the MIT version and thus shared with all Lisp Machine users. This situation allowed those still at MIT to remain neutral.
+
+On March 16, 1982, a date Stallman remembers well because it was his birthday, Symbolics executives ended the gentleman's agreement. The motive was to attack LMI. LMI had fewer hackers, and fewer staff in general, so the Symbolics executives thought that LMI was getting the main benefit of sharing the system improvements. By ending the sharing of system code, they hoped to wipe out LMI. So they decided to enforce the letter of the license. Instead of contributing their improvements to the MIT version of the system, which LMI could use, they provided MIT with a copy of the Symbolics version of the system for users at MIT to run. Anyone using it would provide the service of testing only to Symbolics, and if he made improvements, most likely they too would only be useful for Symbolics.
+
+As the person responsible (with help from Greenblatt for the first couple of months) for keeping up the lab's Lisp Machine system, Stallman was incensed. The Symbolics hackers had left the system code with hundreds of half-made changes that caused errors. Viewing this announcement as an "ultimatum," he retaliated by disconnecting Symbolics' microwave communications link to the laboratory. He then vowed never to work on a Symbolics machine, and pledged to continue the development of MIT's system so as to defend LMI from Symbolics. "The way I saw it, the AI Lab was a neutral country, like Belgium in World War II," Stallman says. "If Germany invades Belgium, Belgium declares war on Germany and sides with Britain and France."
+% ={DARPA;Greenblat, Richard;LISP programming language:operating system for+4;MACLISP language;McCarthy, John;Project MAC;Stanford Artificial Intelligence Laboratory}
+
+When Symbolics executives noticed that their latest features were still appearing in the MIT Lisp Machine system and, by extension, the LMI Lisp machine, they were not pleased. Stallman knew what copyright law required, and was rewriting the features from scratch.He took advantage of the opportunity to read the source code Symbolics supplied to MIT, so as to understand the problems and fixes, and then made sure to write his changes in a totally different way. But the Symbolics executives didn't believe this. They installed a "spy" program on Stallman's computer terminal looking for evidence against him. However, when they took their case to MIT administration, around the start of 1983, they had little evidence to present: a dozen places in the sources where both versions had been changed and appeared similar.
+={Brain Makers: Genius, Ego, and Greed in the Quest for Machines that Think, The Newquist;Newquist, Harvey}
+
+When the AI Lab administrators showed Stallman Symbolics' supposed evidence, he refuted it, showing that the similarities were actually held over from before the fork. Then he turned the logic around:if, after the thousands of lines he had written, Symbolics could produce no better evidence than this, it demonstrated that Stallman's diligent efforts to avoid copying were effective. The AI Lab approved Stallman's work, which he continued till the end of 1983.~{ The Brain Makers by H. P. Newquist says inaccurately that the AI Lab told Stallman to stay away from the Lisp Machine project. }~
+
+Stallman did make a change in his practices, though. "Just to be ultra safe, I no longer read their source code [for new features and major changes]. I used only the documentation and wrote the code from that." For the biggest new features, rather than wait for Symbolics to release documentation, he designed them on his own; later, when the Symbolics documentation appeared, he added compatibility with Symbolics' interface for the feature. Then he read Symbolics' source code changes to find minor bugs they had fixed, and fixed each of them differently.
+
+The experience solidified Stallman's resolve. As Stallman designed replacements for Symbolics' new features, he also enlisted members of the AI Lab to keep using the MIT system, so as to provide a continuous stream of bug reports. MIT continued giving LMI direct access to the changes. "I was going to punish Symbolics if it was the last thing I did," Stallman says. Such statements are revealing. Not only do they shed light on Stallman's non pacifist nature, they also reflect the intense level of emotion triggered by the conflict.
+
+The level of despair owed much to what Stallman viewed as the "destruction" of his "home" - i.e., the demise of the AI Lab's close-knit hacker subculture. In a later email interview with Levy, Stall-man would liken himself to the historical figure Ishi, the last surviving member of the Yahi, a Pacific Northwest tribe wiped out during the Indian wars of the 1860s and 1870s. The analogy casts Stallman's survival in epic, almost mythical, terms.~{ Steven Levy in Hackers had this period in mind when he described Stallman as the "last of the true hackers," but his intended meaning was not what you might think. Levy used the term "true hackers" to distinguish the MIT hacker community from two other hacker communities described later in the book, to which he gave other names. When this community had dissolved, leaving only Stallman, he therefore became the last of the "true hackers." Levy did not mean that nobody else was truly a hacker, but people tend to interpret his words that way, especially those who see them without reading the explanations in Levy's book. Stallman has never described himself using those words of Levy's. }~ The hackers who worked for Symbolics saw it differently. Instead of seeing Symbolics as an ex-terminating force, many of Stallman's colleagues saw it as a belated bid for relevance. In commercializing the Lisp Machine, the company pushed hacker principles of engineer-driven software design out of the ivory-tower confines of the AI Lab and into the corporate market place where manager-driven design principles held sway. Rather than viewing Stallman as a holdout, many hackers saw him as the representative of an obsolete practice.
+={Ishi;Yahi}
+
+Personal hostilities also affected the situation. Even before Symbolics hired away most of the AI Lab's hacker staff, Stallman says many of the hackers who later joined Symbolics were shunning him. "I was no longer getting invited to go to Chinatown," Stallman recalls. "The custom started by Greenblatt was that if you went out to dinner, you went around or sent a message asking anybody at the lab if they also wanted to go. Sometime around 1980-1981, I stopped getting asked. They were not only not inviting me, but one person later confessed that he had been pressured to lie to me to keep their going away to dinner without me a secret."
+={Greenblat, Richard}
+
+Although Stallman felt hurt by this petty form of ostracism, there was nothing to be done about it. The Symbolics ultimatum changed the matter from a personal rejection to a broader injustice. When Symbolics excluded its source changes from redistribution, as a means to defeat its rival, Stallman determined to thwart Symbolics' goal. By holing up in his MIT offices and writing equivalents for each new software feature and fix, he gave users of the MIT system, including LMI customers, access to the same features as Symbolics users.
+
+It also guaranteed Stallman's legendary status within the hacker community. Already renowned for his work with Emacs, Stallman's ability to match the output of an entire team of Symbolics programmers - a team that included more than a few legendary hackers itself - still stands as one of the major human accomplishments of the Information Age, or of any age for that matter. Dubbing it a "master hack" and Stallman himself a "virtual John Henry of computer code," author Steven Levy notes that many of his Symbolics-employed rivals had no choice but to pay their idealistic former comrade grudging respect. Levy quotes Bill Gosper, a hacker who eventually went to work for Symbolics in the company's Palo Alto office, expressing amazement over Stallman's output during this period:
+={Gosper, Bill}
+
+_1 I can see something Stallman wrote, and I might decide it was bad (probably not, but somebody could convince me it was bad), and I would still say, "But wait a minute - Stallman doesn't have anybody to argue with all night over there. He's working alone! It's incredible anyone could do this alone!"~{ See Steven Levy, Hackers (Penguin USA [paperback], 1984): 426 }~
+
+For Stallman, the months spent playing catch up with Symbolics evoke a mixture of pride and profound sadness. As a dyed-in-the-wool liberal whose father had served in World War II, Stallman is no pacifist. In many ways, the Symbolics war offered the rite of passage toward which Stallman had been careening ever since joining the AI Lab staff a decade before. At the same time, however, it coincided with the traumatic destruction of the AI Lab hacker culture that had nurtured Stallman since his teenage years. One day, while taking a break from writing code, Stallman experienced a traumatic moment passing through the lab's equipment room. There, Stallman encountered the hulking, unused frame of the PDP-10 machine. Startled by the dormant lights, lights that once actively blinked out a silent code indicating the status of the internal program, Stallman says the emotional impact was not unlike coming across a beloved family member's well-preserved corpse.
+={PDP-10 computer}
+
+"I started crying right there in the machine room," he says. "Seeing the machine there, dead, with nobody left to fix it, it all drove home how completely my community had been destroyed."
+
+Stallman would have little opportunity to mourn. The Lisp Ma-chine, despite all the furor it invoked and all the labor that had gone into making it, was merely a sideshow to the large battles in the technology marketplace. The relentless pace of computer miniaturization was bringing in newer, more powerful microprocessors that would soon incorporate the machine's hardware and software capabilities like a modern metropolis swallowing up an ancient desert village.
+
+Riding atop this microprocessor wave were hundreds - thousands- of proprietary software programs, each protected by a patchwork of user licenses and nondisclosure agreements that made it impossible for hackers to review or share source code. The licenses were crude and ill-fitting, but by 1983 they had become strong enough to satisfy the courts and scare away would-be interlopers. Software, once a form of garnish most hardware companies gave away to make their expensive computer systems more flavorful, was quickly becoming the main dish. In their increasing hunger for new games and features, users were putting aside the traditional demand to review the recipe after every meal.
+
+Nowhere was this state of affairs more evident than in the realm of personal computer systems. Companies such as Apple Computer and Commodore were minting fresh millionaires selling machines with built-in operating systems. Unaware of the hacker culture and its distaste for binary-only software, many of these users saw little need to protest when these companies failed to attach the accompanying source-code files. A few anarchic adherents of the hacker ethic helped propel that ethic into this new marketplace, but for the most part, the marketplace rewarded the programmers speedy enough to write new programs and savvy enough to write End User License Agreements to lock them up tight.
+={Apple Computers; Commodore computers;software+10}
+
+One of the most notorious of these programmers was Bill Gates, a Harvard dropout two years Stallman's junior. Although Stallman didn't know it at the time, seven years before sending out his message to the net.unix-wizards newsgroup, Gates, a budding entrepreneur and general partner with the Albuquerque-based software firm Micro-Soft, later spelled as Microsoft, had sent out his own open letter to the software-developer community. Written in response to the PC users copying Micro-Soft's software programs, Gates' "Open Letter to Hobbyists" had excoriated the notion of communal software development.
+={Gates, Bill+2;Micro-Soft;net.unix-wizards newsgroup;Open Letter to Hobbyists (Gates)+1}
+
+"Who can afford to do professional work for nothing?" asked Gates. "What hobbyist can put three man-years into programming, finding all bugs, documenting his product, and distributing it for free?"~{ See Bill Gates, "An Open Letter to Hobbyists" (February 3, 1976). To view an online copy of this letter, \\ go to http://en.wikipedia.org/wiki/Open_Letter_to_Hobbyists. }~
+
+Although few hackers at the AI Lab saw the missive, Gates' 1976 letter nevertheless represented the changing attitude toward software both among commercial software companies and commercial software developers. Why treat software as a zero-cost commodity when the market said otherwise? As the 1970s gave way to the 1980s, selling software became more than a way to recoup costs; it became a political statement. At a time when the Reagan Administration was rushing to dismantle many of the federal regulations and spending programs that had been built up during the half century following the Great Depression, more than a few software programmers saw the hacker ethic as anticompetitive and, by extension, un-American. At best, it was a throwback to the anti-corporate attitudes of the late 1960s and early 1970s. Like a Wall Street banker discovering an old tie-dyed shirt hiding between French-cuffed shirts and double-breasted suits, many computer programmers treated the hacker ethic as an embarrassing reminder of an idealistic age.
+
+For a man who had spent the entire 1960s as a throwback to the 1950s, Stallman didn't mind living out of step with his peers. As a programmer used to working with the best machines and the best software, however, Stallman faced what he could only describe as a "stark moral choice": either swallow his ethical objection for "proprietary" software - the term Stallman and his fellow hackers used to describe any program that carried copyright terms or an end-user license that restricted copying and modification - or dedicate his life to building an alternate, non-proprietary system of software programs. After his two-year battle with Symbolics, Stallman felt confident enough to undertake the latter option. "I suppose I could have stopped working
+={proprietary software+3}
+
+on computers altogether," Stallman says. "I had no special skills, but I'm sure I could have become a waiter. Not at a fancy restaurant, probably, but I could've been a waiter somewhere."
+
+Being a waiter - i.e., dropping out of programming altogether -would have meant completely giving up an activity, computer programming, that had given him so much pleasure. Looking back on his life since moving to Cambridge, Stallman finds it easy to identify lengthy periods when software programming provided the only pleasure. Rather than drop out, Stallman decided to stick it out.
+
+An Atheist, Stallman rejects notions such as fate, karma, or a divine calling in life. Nevertheless, he does feel that the decision to shun proprietary software and build an operating system to help others do the same was a natural one. After all, it was Stallman's own personal combination of stubbornness, foresight, and coding virtuosity that led him to consider a fork in the road most others didn't know existed. In his article, "The GNU Project," Stallman affirms agreement with the ideals encapsulated in the words of the Jewish sage Hillel:
+={Hillel+1;Open Sources (DiBona, et al)+1}
+
+% ### group --> ? compare earlier version
+
+_1 If I am not for myself, who will be for me? If I am only for myself, what am I? If not now, when?~{ See http://www.gnu.org/gnu/the-gnu-project.html. Stallman adds his own footnote to this statement, writing, "As an Atheist, I don't follow any religious leaders, but I sometimes find I admire something one of them has said. }~
+
+Speaking to audiences, Stallman avoids the religious route and ex-presses the decision in pragmatic terms. "I asked myself: what could I, an operating-system developer, do to improve the situation? It wasn't until I examined the question for a while that I realized an operating-system developer was exactly what was needed to solve the problem."
+
+Once he recognized that, Stallman says, everything else "fell into place." In 1983, MIT was acquiring second-generation Lisp Machines from Symbolics, on which the MIT Lisp Machine system could not possibly run. Once most of the MIT machines were replaced, he would be unable to continue maintaining that system effectively for lack of users' bug reports. He would have to stop. But he also wanted to stop. The MIT Lisp Machine system was not free software: even though users could get the source code, they could not redistribute it freely. Meanwhile, the goal of continuing the MIT system had already been achieved: LMI had survived and was developing software on its own.
+
+Stallman didn't want to spend his whole life punishing those who had destroyed his old community. He wanted to build a new one. He decided to denounce software that would require him to compromise his ethical beliefs, and devote his life to the creation of programs that would make it easier for him and others to escape from it. Pledging to build a free software operating system "or die trying - of old age, of course," Stallman quips, he resigned from the MIT staff in January, 1984, to build GNU.
+
+The resignation distanced Stallman's work from the legal auspices of MIT. Still, Stallman had enough friends and allies within the AI Lab to continue using the facilities, and later his own office. He also had the ability to secure outside consulting gigs to underwrite the early stages of the GNU Project. In resigning from MIT, however, Stallman negated any debate about conflict of interest or Institute ownership of the software. The man whose early adulthood fear of social isolation had driven him deeper and deeper into the AI Lab's embrace was now building a legal firewall between himself and that environment.
+={GNU Project}
+
+For the first few months, Stallman operated in isolation from the Unix community as well. Although his announcement to the net.unix-wizards group had attracted sympathetic responses, few volunteers signed on to join the crusade in its early stages.
+={net.unix-wizards newsgroup}
+
+"The community reaction was pretty much uniform," recalls Rich Morin, leader of a Unix user group at the time. "People said, 'Oh, that's a great idea. Show us your code. Show us it can be done.'"
+
+Aware that the job was enormous, Stallman decided to try to reuse existing free software wherever possible. So he began looking for existing free programs and tools that could be converted into GNU programs and tools. One of the first candidates was a compiler named VUCK, which converted programs written in the popular C programming language into machine-runnable code. Translated from the Dutch, the program's acronym stood for the Free University Compiler Kit. Optimistic, Stallman asked the program's author if the program was free. When the author informed him that the words "Free University" were a reference to the Vrije Universiteit in Amsterdam, and that the program was not free, Stallman was chagrined.
+
+"He responded derisively, stating that the university was free but the compiler was not," recalls Stallman. He had not only refused to help - he suggested Stallman drop his plan to develop GNU, and instead write some add-ons to boost sales of VUCK, in return for a share of the profits. "I therefore decided that my first program for the GNU Project would be a multi-language, multi-platform compiler."
+19~{ See Richard Stallman, "The GNU Operating System and the Free Software Movement," Open Sources (O'Reilly & Associates, Inc., 1999): 65. }~
+
+Instead of VUCK, Stallman found the Pastel compiler ("off-color Pascal"), written by programmers at Lawrence Livermore National Lab. According to what they said when they gave him a copy, the compiler was free to copy and modify. Unfortunately, the program was unsuitable for the job, because its memory requirements were enormous. It parsed the entire input file in core memory, then retained all the internal data until it finished compiling the file. On mainframe systems this design had been forgivable. On Unix systems it was a crippling barrier, since even 32-bit machines that ran Unix were often unable to provide so much memory to a program. Stallman made substantial progress at first, building a C-compatible front end to the compiler and testing it on the larger Vax, whose system could handle large memory spaces. When he tried porting the system to the 68010, and investigated why it crashed, he discovered the memory size problem, and concluded he would have to build a totally new compiler from scratch. Stallman eventually did this, producing the GNU C Compiler or GCC. But it was not clear in 1984 what to do about the compiler, so he decided to let those plans gel while turning his attention to other parts of GNU.
+={C programming language:VUCK compiler for;VUCK compiler}
+
+In September of 1984, thus, Stallman began development of a GNU version of Emacs, the replacement for the program he had been supervising for a decade. Within the Unix community, the two native editor programs were vi, written by Sun Microsystems co-founder Bill Joy, and ed, written by Bell Labs scientist (and Unix co-creator) Ken Thompson. Both were useful and popular, but neither offered the endlessly expandable nature of Emacs.
+={Bell Labs;Emacs text editor:rewriting for Unix+2;GNU Emacs:rewriting for Unix+2;Joy, Bill;vi text editor;Thompson, Ken}
+
+Looking back, Stallman says he didn't view the decision in strategic terms. "I wanted an Emacs, and I had a good opportunity to develop one."
+
+Once again, Stallman had found existing code with which he hoped to save time. In writing a Unix version of Emacs, Stallman was soon following the footsteps of Carnegie Mellon graduate student James Gosling, author of a C-based version dubbed Gosling Emacs or Gosmacs. Gosling's version of Emacs included an interpreter for a simplified offshoot of the Lisp language, called Mocklisp. Although Gosling had put Gosmacs under copyright and had sold the rights to UniPress, a privately held software company, Stallman received the assurances of a fellow developer who had participated in early Gosmacs development. According to the developer, Gosling, while a Ph.D. student at Carnegie Mellon, had given him permission by email to distribute his own version of Gosmacs in exchange for his contribution to the code.
+={Carnegie Mellon University;Gosling, James+3;GOSMACS (Gosling Emacs);interpreters for LISP+1;LISP programming language:EMACS and+1;MOCKLISP language;UniPress software company+1}
+
+At first Stallman thought he would change only the user-level commands, to implement full compatibility with the original PDP-10Emacs. However, when he found how weak Mocklisp was in comparison with real Lisp, he felt compelled to replace it with a true Lisp system. This made it natural to rewrite most of the higher-level code of Gosmacs in a completely different way, taking advantage of the greater power and flexible data structures of Lisp. By mid-1985, in GNU Emacs as released on the Internet, only a few files still had code remaining from Gosmacs.
+
+Then UniPress caught wind of Stallman's project, and denied that the other developer had received permission to distribute his own version of Gosmacs. He could not find a copy of the old email to defend his claim. Stallman eliminated this problem by writing replacements for the few modules that remained from Gosmacs.
+
+Nevertheless, the notion of developers selling off software rights - indeed, the very notion of developers having such powers to sell in the first place - rankled Stallman. In a 1986 speech at the Swedish Royal Technical Institute, Stallman cited the UniPress incident as yet another example of the dangers associated with proprietary software.
+={proprietary software:Emacs and+4;Swedish Royal Technical Institute}
+
+"Sometimes I think that perhaps one of the best things I could do with my life is find a gigantic pile of proprietary software that was a trade secret, and start handing out copies on a street corner so it wouldn't be a trade secret any more," said Stallman. "Perhaps that would be a much more efficient way for me to give people new free software than actually writing it myself; but everyone is too cowardly to even take it."~{ See Richard Stallman (1986). }~
+
+Despite the stress it generated, the dispute over Gosling's code would assist both Stallman and the free software movement in the longterm. It would force Stallman to address the weaknesses of the Emacs Commune and the informal trust system that had allowed problematic offshoots to emerge. It would also force Stallman to sharpen the free software movement's political objectives. Following the release of GNU Emacs in 1985, Stallman issued /{The GNU Manifesto}/, an expansion of the original announcement posted in September, 1983. Stallman included within the document a lengthy section devoted to the many arguments used by commercial and academic programmers to justify the proliferation of proprietary software programs. One argument, "Don't programmers deserve a reward for their creativity," earned a response encapsulating Stallman's anger over the recent Gosling Emacs episode:
+={Emacs Commune:proprietary software and;Emacs text editor;GNU Emacs;GNU Manifesto}
+
+"If anything deserves a reward, it is social contribution," Stallman wrote. "Creativity can be a social contribution, but only in so far [ sic ] as society is free to use the results. If programmers deserve to be rewarded for creating innovative programs, by the same token they deserve to be punished if they restrict the use of these programs."~{ See Richard Stallman, The GNU Manifesto (1985), \\ http://www.gnu.org/gnu/ manifesto.html. }~
+
+With the release of GNU Emacs, the GNU Project finally had code to show. It also had the burdens of any software-based enterprise. As more and more Unix developers began playing with the software, money, gifts, and requests for tapes began to pour in. To address the business side of the GNU Project, Stallman drafted a few of his colleagues and formed the Free Software Foundation (FSF), a non-profit organization dedicated to speeding the GNU Project towards its goal. With Stallman as president and various friends and hacker allies as board members, the FSF helped provide a corporate face for the GNU Project.
+={Free Software Foundation (FSF):GNU Project and;GNU Project:Emacs, release of}
+
+Robert Chassell, a programmer then working at Lisp Machines, Inc., became one of five charter board members at the Free Software Foundation following a dinner conversation with Stallman. Chassell also served as the organization's treasurer, a role that started small but quickly grew.
+={Chassell, Robert+6;LISP Machines Inc. (LMI);LMI (LISP Machines Inc.)}
+
+"I think in '85 our total expenses and revenue were something in the order of $23,000, give or take," Chassell recalls. "Richard had his office, and we borrowed space. I put all the stuff, especially the tapes, under my desk. It wasn't until sometime later LMI loaned us some space where we could store tapes and things of that sort."
+
+In addition to providing a face, the Free Software Foundation provided a center of gravity for other disenchanted programmers. The Unix market that had seemed so collegial even at the time of Stallman's initial GNU announcement was becoming increasingly competitive. In an attempt to tighten their hold on customers, companies were starting to deny users access to Unix source code, a trend that only speeded the number of inquiries into ongoing GNU software projects.
+
+The Unix wizards who once regarded Stallman as a noisy kook were now beginning to see him as a software prophet or a software Cassandra, according as they felt hope or despair over escaping the problem she identified.
+
+"A lot of people don't realize, until they've had it happen to them, how frustrating it can be to spend a few years working on a software program only to have it taken away," says Chassell, summarizing the feelings and opinions of the correspondents writing in to the FSF during the early years. "After that happens a couple of times, you start to say to yourself, 'Hey, wait a minute.'"
+
+For Chassell, the decision to participate in the Free Software Foundation came down to his own personal feelings of loss. Prior to LMI, Chassell had been working for hire, writing an introductory book on Unix for Cadmus, Inc., a Cambridge-area software company. When Cadmus folded, taking the rights to the book down with it, Chassell says he attempted to buy the rights back with no success.
+
+"As far as I know, that book is still sitting on a shelf somewhere, unusable, uncopyable, just taken out of the system," Chassell says. "It was quite a good introduction if I may say so myself. It would have taken maybe three or four months to convert [the book] into a perfectly usable introduction to GNU/Linux today. The whole experience, aside from what I have in my memory, was lost."
+
+Forced to watch his work sink into the mire while his erstwhile employer struggled through bankruptcy, Chassell says he felt a hint of the anger that drove Stallman to fits of apoplexy. "The main clarity, for me, was the sense that if you want to have a decent life, you don't want to have bits of it closed off," Chassell says. "This whole idea of having the freedom to go in and to fix something and modify it, whatever it may be, it really makes a difference. It makes one think happily that after you've lived a few years that what you've done is worthwhile. Because otherwise it just gets taken away and thrown out or abandoned or, at the very least, you no longer have any relation to it. It's like losing a bit of your life."
+
+1~ Chapter 8 - St. Ignucius
+={Ignucius, (St.);St. Ignucius}
+
+The Maui High Performance Computing Center is located in a single-story building in the dusty red hills just above the town of Kihei. Framed by million-dollar views and the multi-million dollar real estate of the Silversword Golf Course, the center seems like the ultimate scientific boondoggle. Far from the boxy, sterile confines of Tech Square or even the sprawling research metropolises of Argonne, Illinois and Los Alamos, New Mexico, the MHPCC seems like the kind of place where scientists spend more time on their tans than their post-doctoral research projects.
+={Argonne (Illinois);Los Alamos (New Mexico);Maui High Performance Computing Center (MHPCC);MHPCC (Maui High Performance Computing Center)}
+
+The image is only half true. Although researchers at the MHPCC do take advantage of the local recreational opportunities, they also take their work seriously. According to { Top500.org }http://top500.org, a web site that tracks the most powerful supercomputers in the world, the IBMSP Power3 supercomputer housed within the MHPCC clocks in at 837 billion floating-point operations per second, making it one of 25most powerful computers in the world. Co-owned and operated by the University of Hawaii and the U.S. Air Force, the machine divides its computer cycles between the number crunching tasks associated with military logistics and high-temperature physics research.
+={IBM SP Power3 supercomputer;U.S Air Force;University of Hawaii;Top500.org}
+
+Simply put, the MHPCC is a unique place, a place where the brainy culture of science and engineering and the laid-back culture of the Hawaiian islands coexist in peaceful equilibrium. A slogan on the lab's 2000 web site sums it up: "Computing in paradise."
+
+It's not exactly the kind of place you'd expect to find Richard Stallman, a man who, when taking in the beautiful view of the nearby Maui Channel through the picture windows of a staffer's office, mutters a terse critique: "Too much sun." Still, as an emissary from one computing paradise to another, Stallman has a message to deliver, even if it means subjecting his hacker eyes to painful solar glare.
+
+The conference room is already full by the time I arrive to catch Stallman's speech. The gender breakdown is a little better than at the New York speech, 85% male, 15% female, but not by much. About half of the audience members wear khaki pants and logo-encrusted golf shirts. The other half seems to have gone native. Dressed in the gaudy flower-print shirts so popular in this corner of the world, their faces area deep shade of ochre. The only residual indication of geek status are the gadgets: Nokia cell phones, Palm Pilots, and Sony VAIO laptops.
+
+Needless to say, Stallman, who stands in front of the room dressed in plain blue T-shirt, brown polyester slacks, and white socks, sticks out like a sore thumb. The fluorescent lights of the conference room help bring out the unhealthy color of his sun-starved skin.~{ RMS: The idea that skin can be "sun-starved" or that paleness is "unhealthy"is dangerous misinformation; staying out of the sun can't hurt you as long as you have enough Vitamin D. What damages the skin, and can even kill you, is excessive exposure to sunlight. }~ His beard and hair are enough to trigger beads of sweat on even the coolest Hawaiian neck. Short of having the words "mainlander" tattooed on his forehead, Stallman couldn't look more alien if he tried. [RMS: Is there something bad about looking different from others?]
+
+As Stallman putters around the front of the room, a few audience members wearing T-shirts with the logo of the Maui FreeBSD Users Group (MFUG) race to set up camera and audio equipment. FreeBSD, a free software offshoot of the Berkeley Software Distribution, the venerable 1970s academic version of Unix, is technically a competitor to the GNU/Linux operating system. Still, in the hacking world, Stallman speeches are documented with a fervor reminiscent of the Grateful Dead and its legendary army of amateur archivists. As the local free software heads, it's up to the MFUG members to make sure fellow programmers in Hamburg, Mumbai, and Novosibirsk don't miss out on the latest pearls of RMS wisdom.
+={Berkely Software Distribution (BSD);BSD (Berkely Software Distribution);Grateful Dead, The+1;Maui FreeBSD Users Group}
+
+The analogy to the Grateful Dead is apt. Often, when describing the business opportunities inherent within the free software model, Stallman has held up the Grateful Dead as an example. In refusing to restrict fans' ability to record live concerts, the Grateful Dead became more than a rock group. They became the center of a tribal community dedicated to Grateful Dead music. Over time, that tribal community became so large and so devoted that the band shunned record contracts and supported itself solely through musical tours and live appearances. In 1994, the band's last year as a touring act, the Grateful Dead drew $52 million in gate receipts alone.~{ See "Grateful Dead Time Capsule: 1985-1995 North American Tour Grosses," \\ http://www.dead101.com/1197.htm. }~
+
+While few software companies have been able to match that success, the tribal aspect of the free software community is one reason many in the latter half of the 1990s started to accept the notion that publishing software source code might be a good thing. Hoping to build their own loyal followings, companies such as IBM, Sun Microsystems, and Hewlett Packard have come to accept the letter, if not the spirit, of the Stallman free software message. Describing the GPL as the information-technology industry's /{Magna Carta}/, ZDNet software columnist Evan Leibovitch sees the growing affection for all things GNU as more than just a trend. "This societal shift is letting users take back control of their futures," Leibovitch writes. "Just as the /{Magna Carta}/ gave rights to British subjects, the GPL enforces consumer rights and freedoms on behalf of the users of computer software."~{ See Evan Leibovitch, "Who's Afraid of Big Bad Wolves," /{ZDNet}/ Tech Update (December 15, 2000), \\ http://www.zdnet.com/news/whos-afraid-of-the-big-bad-wolves/298394. }~
+={Hewlett Packard;IBM;Sun Microsystems}
+
+The tribal aspect of the free software community also helps explain why 40-odd programmers, who might otherwise be working on physics projects or surfing the Web for windsurfing buoy reports, have packed into a conference room to hear Stallman speak.
+
+Unlike the New York speech, Stallman gets no introduction. He also offers no self-introduction. When the FreeBSD people finally get their equipment up and running, Stallman simply steps forward, starts speaking, and steamrolls over every other voice in the room.
+={FreeBSD}
+
+"Most of the time when people consider the question of what rules society should have for using software, the people considering it are from software companies, and they consider the question from a self-serving perspective," says Stallman, opening his speech. "What rules can we impose on everybody else so they have to pay us lots of money? I had the good fortune in the 1970s to be part of a community of programmers who shared software. And because of this I always like to look at the same issue from a different direction to ask: what kind of rules make possible a good society that is good for the people who are in it? And therefore I reach completely different answers."
+
+Once again, Stallman quickly segues into the parable of the Xerox laser printer, taking a moment to deliver the same dramatic finger-pointing gestures to the crowd. He also devotes a minute or two to the GNU/Linux name.
+
+"Some people say to me, 'Why make such a fuss about getting credit for this system? After all, the important thing is the job is done, not whether you get recognition for it.' Well, this would be wise advice if it were true. But the job wasn't to build an operating system; the job is to spread freedom to the users of computers. And to do that we have to make it possible to do everything with computers in freedom."~{ For narrative purposes, I have hesitated to go in-depth when describing Stallman's full definition of software "freedom." The GNU Project web site lists four fundamental components: \\ _* The freedom to run the program as you wish, for any purpose (freedom 0). \\ _* The freedom to study the program's source code, and change it so that the program does what you wish (freedom 1). \\ _* The freedom to redistribute copies of the program so you can help your neighbor (freedom 2). \\ _* The freedom to distribute copies of your modified versions, so that the whole community can benefit from them (freedom 3). For more information, please visit "The Free Software Definition" at \\ http://www.gnu.org/philosophy/free-sw.html. }~
+
+Adds Stallman, "There's a lot more work to do."
+
+For some in the audience, this is old material. For others, it's a little arcane. When a member of the golf-shirt contingent starts dozing off, Stallman stops the speech and asks somebody to wake the person up.
+
+"Somebody once said my voice was so soothing, he asked if I was some kind of healer," says Stallman, drawing a quick laugh from the crowd. "I guess that probably means I can help you drift gently into a blissful, relaxing sleep. And some of you might need that. I guess I shouldn't object if you do. If you need to sleep, by all means do."
+
+The speech ends with a brief discussion of software patents, a growing issue of concern both within the software industry and within the free software community. Like Napster, software patents reflect the awkward nature of applying laws and concepts written for the physical world to the frictionless universe of information technology.
+
+Copyright law and patent law work differently, and have totally different effects in the software field. The copyright on a program controls the copying and adaptation of that program's code, and it belongs to the program's developer. But copyright does not cover ideas. In other words, a developer is free, under copyright, to implement in his own code features and commands he has seen in existing programs. Those aspects are ideas, not expression, and thus outside the scope of copyright law.
+
+It is likewise lawful - though hard work - to decode how a binary program works, and then implement the same ideas and algorithms indifferent code. This practice is known as "reverse engineering."
+
+Software patents work differently. According to the U.S. Patent Office, companies and individuals can obtain patents for computing ideas that are innovative (or, at least, unknown to the Patent Office). In theory, this allows the patent-holder to trade off disclosure of the technique for a specific monopoly lasting a minimum of 20 years after the patent filing. In practice, the disclosure is of limited value to the public, since the operation of the program is often self-evident, and could in any case be determined by reverse engineering. Unlike copyright, a patent gives its holder the power to forbid the independent development of software programs which use the patented idea.
+={U.S. Patent Office}
+
+In the software industry, where 20 years can cover the entire life cycle of a marketplace, patents take on a strategic weight. Where companies such as Microsoft and Apple once battled over copyright and the "look and feel" of various technologies, today's Internet companies use patents as a way to stake out individual applications and business models, the most notorious example being Amazon.com's 2000 attempt to patent the company's "one-click" on line shopping process. For most companies, however, software patents have become a defensive tool, with cross-licensing deals balancing one set of corporate patents against another in a tense form of corporate detente. Still, in a few notable cases of computer encryption and graphic imaging algorithms, software vendors have successfully stifled rival developments. For instance, some font-rendering features are missing from free soft-ware because of patent threats from Apple.
+
+For Stallman, the software-patent issue dramatizes the need for eternal hacker vigilance. It also underlines the importance of stressing the political benefits of free software programs over the competitive benefits. Stallman says competitive performance and price, two areas where free software operating systems such as GNU/Linux and FreeBSD already hold a distinct advantage over their proprietary counterparts, are side issues compared to the large issues of user and developer freedom.
+={FreeBSD+2}
+
+This position is controversial within the community: open source advocates emphasize the utilitarian advantages of free software over the political advantages. Rather than stress the political significance of free software programs, open source advocates have chosen to stress the engineering integrity of the hacker development model. Citing the power of peer review, the open source argument paints programs such as GNU/Linux or FreeBSD as better built, better inspected and, by extension, more trustworthy to the average user.
+
+That's not to say the term "open source" doesn't have its political implications. For open source advocates, the term open source serves two purposes. First, it eliminates the confusion associated with the word "free," a word many businesses interpret as meaning "zero cost." Second, it allows companies to examine the free software phenomenon on a technological, rather than ethical, basis. Eric Raymond, co-founder of the Open Source Initiative and one of the leading hackers to endorse the term, explained his refusal to follow Stallman's political path in a 1999 essay, titled "Shut Up and Show Them the Code":
+={OSI (Open Source Initiative);Open Source Initiative (OSI);Raymond, Eric;Shut Up and Show Them the Code (Raymond)+1}
+
+_1 RMS's rhetoric is very seductive to the kind of people we are. We hackers are thinkers and idealists who readily resonate with appeals to "principle" and "freedom" and "rights." Even when we disagree with bits of his program, we want RMS's rhetorical style to work; we think it ought to work; we tend to be puzzled and disbelieving when it fails on the 95% of people who aren't wired like we are.~{ See Eric Raymond, "Shut Up and Show Them the Code," online essay, (June28, 1999), \\ http://www.catb.org/~esr/writings/shut-up-and-show-them.html. }~
+
+Included among that 95%, Raymond writes, are the bulk of business managers, investors, and non-hacker computer users who, through sheer weight of numbers, tend to decide the overall direction of the commercial software marketplace. Without a way to win these people over, Raymond argues, programmers are doomed to pursue their ideology on the periphery of society:
+
+_1 When RMS insists that we talk about "computer users' rights," he's issuing a dangerously attractive invitation to us to repeat old failures. It's one we should reject - not because his principles are wrong, but because that kind of language, applied to software, simply does not persuade anybody but us. In fact, it confuses and repels most people outside our culture.~{ Ibid. }~
+
+Stallman, however, rejects Raymond's premises:
+
+_1 Raymond's attempt to explain our failure is misleading because we have not failed. Our goal is large, and we have a long way to go, but we have also come a long way.
+
+_1 Raymond's pessimistic assertion about the values of non-hackers is an exaggeration. Many non-hackers are more concerned with the political issues we focus on than with the technical advantages that open source emphasizes. This often includes political leaders too, though not in all countries.
+
+_1 It was the ethical ideals of free software, not "better software," which persuaded the presidents of Ecuador and Brazil to move government agencies to free software. They are not geeks, but they understand freedom.
+
+But the principal flaw in the open source argument, according to Stallman, is that it leads to weaker conclusions. It convinces many users to run some programs which are free, but does not offer the many reason to migrate entirely to free software. This partially gives them freedom, but does not teach them to recognize it and value it as such, so they remain likely to let it drop and lose it. For instance, what happens when the improvement of free software is blocked by a patent?
+
+Most open source advocates are equally, if not more, vociferous as Stallman when it comes to opposing software patents. So too are most proprietary software developers, since patents threaten their projects too. However, pointing to software patents' tendency to put areas of software functionality off limits, Stallman contrasts what the free software idea and the open source idea imply about such cases.
+
+"It's not because we don't have the talent to make better software," says Stallman. "It's because we don't have the right. Somebody has prohibited us from serving the public. So what's going to happen when users encounter these gaps in free software? Well, if they have been persuaded by the open source movement that these freedoms are good because they lead to more-powerful reliable software, they're likely to say, 'You didn't deliver what you promised. This software's not more powerful. It's missing this feature. You lied to me.' But if they have come to agree with the free software movement, that the freedom is important in itself, then they will say, 'How dare those people stop me from having this feature and my freedom too.' And with that kind of response, we may survive the hits that we're going to take as these patents explode."
+
+Watching Stallman deliver his political message in person, it is hard to see anything confusing or repellent. Stallman's appearance may seem off-putting, but his message is logical. When an audience member asks if, in shunning proprietary software, free software proponents lose the ability to keep up with the latest technological advancements, Stallman answers the question in terms of his own personal beliefs. "I think that freedom is more important than mere technical advance," he says. "I would always choose a less advanced free program rather than a more advanced non free program, because I won't give up my freedom for something like that [advance]. My rule is, if I can't share it with you, I won't take it."
+
+In the minds of those who assume ethics means religion, such answers reinforce the quasi-religious nature of the Stallman message. However, unlike a Jew keeping kosher or a Mormon refusing to drink alcohol, Stallman is not obeying a commandment, but simply refusing to cede his freedom. His speech explains the practical requisites for doing so: a proprietary program takes away your freedom, so if you want freedom, you need to reject the program.
+
+Stallman paints his decision to use free software in place of proprietary in the color of a personal belief he hopes others will come to share. As software evangelists go, Stallman avoids forcing those beliefs down listeners' throats. Then again, a listener rarely leaves a Stallman speech not knowing where the true path to software righteousness lies.
+
+As if to drive home this message, Stallman punctuates his speech with an unusual ritual. Pulling a black robe out of a plastic grocery bag, Stallman puts it on. Then he pulls out a reflective brown computer disk and places it on his head. The crowd lets out a startled laugh.
+
+"I am St. IGNUcius of the Church of Emacs," says Stallman, raising his right hand in mock-blessing. "I bless your computer, my child."
+={Ignucius, (St.);St. Ignucius}
+
+The laughter turns into full-blown applause after a few seconds. As audience members clap, the computer disk on Stallman's head catches the glare of an overhead light, eliciting a perfect halo effect. In the blink of an eye, Stallman resembles a Russian religious icon.
+
+{free_as_in_freedom_2_02_rms_st_ignucius.png 254x240 "Stallman dressed as St. IGNUcius. The photo was taken by Stian Eikeland in Bergen, Norway on February 19, 2009." }http://en.wikipedia.org/wiki/Richard_stallman
+
+"Emacs was initially a text editor," says Stallman, explaining the getup. "Eventually it became a way of life for many and a religion for some. We call this religion the Church of Emacs."
+={Church of Emacs+8;Emacs text editor+11;GNU Emacs+11}
+
+The skit is a lighthearted moment of self-parody, a humorous return-jab at the many people who might see Stallman's form of software asceticism as religious fanaticism in disguise. It is also the sound of the other shoe dropping - loudly. It's as if, in donning his robe and halo, Stallman is finally letting listeners off the hook, saying, "It's OK to laugh. I know I'm weird." [RMS: To laugh at someone for being weird is boorish, and it is not my intention to excuse that. But I hope people will laugh at my St. IGNUcius comedy routine.]
+
+Discussing the St. IGNUcius persona afterward, Stallman says he first came up with it in 1996, long after the creation of Emacs but well before the emergence of the "open source" term and the struggle for hacker-community leadership that precipitated it. At the time, Stallman says, he wanted a way to "poke fun at himself," to remind listeners that, though stubborn, Stallman was not the fanatic some made him out to be. It was only later, Stallman adds, that others seized the persona as a convenient way to play up his reputation as software ideologue, as Eric Raymond did in an 1999 interview with the Linux.com web site:
+={linux.com;Raymond, Eric:St. Ignucius and+2}
+
+_1 When I say RMS calibrates what he does, I'm not belittling or accusing him of insincerity. I'm saying that like all good communicators he's got a theatrical streak. Sometimes it's conscious - have you ever seen him in his St. IGNUcius drag, blessing software with a disk platter on his head? Mostly it's unconscious; he's just learned the degree of irritating stimulus that works, that holds attention without (usually) freaking people out.~{ See "Guest Interview: Eric S. Raymond," /{Linux.com}/ (May 18, 1999), \\ http://www.linux.com/interviews/19990518/8/. }~
+
+Stallman takes issue with the Raymond analysis. "It's simply my way of making fun of myself," he says. "The fact that others see it as anything more than that is a reflection of their agenda, not mine."
+
+That said, Stallman does admit to being a ham. "Are you kidding?" he says at one point. "I love being the center of attention." To facilitate that process, Stallman says he once enrolled in Toastmasters, an organization that helps members bolster their public-speaking skills and one Stallman recommends highly to others. He possesses a stage presence that would be the envy of most theatrical performers and feels a link to vaudevillians of years past. A few days after the Maui High Performance Computing Center speech, I allude to the 1999 LinuxWorld performance and ask Stallman if he has a Groucho Marx complex - i.e., the unwillingness to belong to any club that would have him as a member.~{ RMS: Williams misinterprets Groucho's famous remark by treating it as psychological. It was intended as a jab at the overt antisemitism of many clubs, which was why they would refuse him as a member. I did not understand this either until my mother explained it to me. Williams and I grew up when bigotry had gone underground, and there was no need to veil criticism of bigotry in humor as Groucho did. }~ Stallman's response is immediate: "No, but I admire Groucho Marx in a lot of ways and certainly have been in some things I say inspired by him. But then I've also been inspired in some ways by Harpo."
+={Marx, Groucho+1}
+
+The Groucho Marx influence is certainly evident in Stallman's lifelong fondness for punning. Then again, punning and wordplay are common hacker traits. Perhaps the most Groucho-like aspect of Stallman's personality, however, is the deadpan manner in which the puns are delivered. Most come so stealthily - without even the hint of a raised eyebrow or upturned smile - you almost have to wonder if Stal-man's laughing at his audience more than the audience is laughing at him.
+
+Watching members of the Maui High Performance Computer Center laugh at the St. IGNUcius parody, such concerns evaporate. While not exactly a standup act, Stallman certainly possesses the chops to keep a roomful of engineers in stitches. "To be a saint in the Church of Emacs does not require celibacy, but it does require making a commitment to living a life of moral purity," he tells the Maui audience. "You must exorcise the evil proprietary operating systems from all your computers, and then install a wholly [holy] free operating system. And then you must install only free software on top of that. If you make this commitment and live by it, then you too will be a saint in the Church of Emacs, and you too may have a halo."
+
+The St. IGNUcius skit ends with a brief inside joke. On most Unix systems and Unix-related offshoots, the primary competitor program to Emacs is vi, pronounced vee-eye, a text-editing program developed by former UC Berkeley student and current Sun Microsystems chief scientist, Bill Joy. Before doffing his "halo," Stallman pokes fun at the rival program. "People sometimes ask me if it is a sin in the Church of Emacs to use vi," he says. "Using a free version of vi is not a sin;it is a penance. So happy hacking."~{ The service of the Church of Emacs has developed further since 2001. Users can now join the Church by reciting the Confession of the Faith: "There is no system but GNU, and Linux is one of its kernels." Stallman sometimes mentions the religious ceremony known as the Foobar Mitzvah, the Great Schism between various rival versions of Emacs, and the cult of the Virgin of Emacs (which refers to any person that has not yet learned to use Emacs). In addition, "vi vi vi" has been identified as the Editor of the Beast. }~
+={Joy, Bill;vi text editor:as an Emacs competitor;UC Berkeley;Sun Microsystems}
+
+After a brief question-and-answer session, audience members gather around Stallman. A few ask for autographs. "I'll sign this," says Stallman, holding up one woman's print out of the GNU General Public License, "but only if you promise me to use the term GNU/Linux instead of Linux" (when referring to the system), "and tell all your friends to do likewise."
+={GNU General Public License;GPL}
+
+The comment merely confirms a private observation. Unlike other stage performers and political figures, Stallman has no "off" mode. Aside from the St. IGNUcius character, the ideologue you see on stage is the ideologue you meet backstage. Later that evening, during a dinner conversation in which a programmer mentions his affinity for "open source" programs, Stallman, between bites, upbraids his table-mate: "You mean free software. That's the proper way to refer to it."
+
+During the question-and-answer session, Stallman admits to playing the pedagogue at times. "There are many people who say, 'Well, first let's invite people to join the community, and then let's teach them about freedom.' And that could be a reasonable strategy, but what we have is almost everybody's inviting people to join the community, and hardly anybody's teaching them about freedom once they come in."
+
+The result, Stallman says, is something akin to a third-world city. "You have millions of people moving in and building shantytowns, but nobody's working on step two: getting them out of those shantytowns. If you think talking about software freedom is a good strategy, please join in doing step two. There are plenty working on step one. We need more people working on step two."
+
+Working on "step two" means driving home the issue that freedom, not acceptance, is the root issue of the free software movement. Those who hope to reform the proprietary software industry from the inside are on a fool's errand. "Change from the inside is risky," Stallman stays. "Unless you're working at the level of a Gorbachev, you're going to be neutralized."
+
+Hands pop up. Stallman points to a member of the golf shirt-wearing contingent. "Without patents, how would you suggest dealing with commercial espionage?"
+
+"Well, those two questions have nothing to do with each other, really," says Stallman.
+
+"But I mean if someone wants to steal another company's piece of software."
+
+Stallman's recoils as if hit by a poisonous spray. "Wait a second," Stallman says. "Steal? I'm sorry, there's so much prejudice in that statement that the only thing I can say is that I reject that prejudice." Then he turns to the substance of the question. "Companies that develop non-free software and other things keep lots and lots of trade secrets, and so that's not really likely to change. In the old days -even in the 1980s - for the most part programmers were not aware that there were even software patents and were paying no attention to them. What happened was that people published the interesting ideas, and if they were not in the free software movement, they kept secret the little details. And now they patent those broad ideas and keep secret the little details. So as far as what you're describing, patents really make no difference to it one way or another."
+
+"But if it doesn't affect their publication," a new audience member jumps in, his voice trailing off almost as soon as he starts speaking.
+
+"But it does," Stallman says. "Their publication is telling you that this is an idea that's off limits to the rest of the community for 20 years. And what the hell good is that? Besides, they've written it in such a hard way to read, both to obfuscate the idea and to make the patent as broad as possible, that it's basically useless looking at the published information [in the patent] to learn anything anyway. The only reason to look at patents is to see the bad news of what you can't do."
+
+The audience falls silent. The speech, which began at 3:15, is now nearing the 5:00 whistle, and most listeners are already squirming in their seats, antsy to get a jump start on the weekend. Sensing the fatigue, Stallman glances around the room and hastily shuts things down. "So it looks like we're done," he says, following the observation with an auctioneer's "going, going, gone" to flush out any last-minute questioners. When nobody throws their hand up, Stallman signs off with a traditional exit line.
+
+"Happy hacking," he says.
+
+1~ Chapter 9 - The GNU General Public License
+={GNU General Public License+82;GPL+82;Stallman, Richard M.:childhood:GNU General Public License+82}
+
+By the spring of 1985, Richard Stallman had produced the GNU Project's first useful result - a Lisp-based version of Emacs for Unix-like operating systems. To make it available to others as free software, he had to develop the way to release it - in effect, the follow-on for the Emacs Commune.
+={Emacs Commune+7;Emacs text editor:Lisp-based free software version;GNU Emacs:List-based free software version}
+
+The tension between the freedom to modify and authorial privilege had been building before Gosmacs. The Copyright Act of 1976 had overhauled U.S. copyright law, extending the legal coverage of copyright to software programs. According to Section 102(b) of the Act, individuals and companies could copyright the "expression" of a software program but not the "actual processes or methods embodied in the program."~{ See Hal Abelson, Mike Fischer, and Joanne Costello, "Software and Copyright Law," updated version (1997), \\ http://groups.csail.mit.edu/mac/classes/6.805/articles/int-prop/software-copyright.html. }~
+={Copyright Act of 1976;copyright laws;GOSMACS (Gosling Emacs);software:copyright laws on}
+
+Translated, this treated a program much like an algebra textbook:its author can claim copyright on the text but not on the mathematical ideas of algebra or the pedagogical technique employed to explain it. Thus, regardless of what Stallman said about using the code of the original Emacs, other programmers were legally entitled to write their own implementations of the ideas and commands of Emacs, and they did. Gosmacs was one of 30-odd imitations of the original Emacs developed for various computer systems.
+
+The Emacs Commune applied only to the code of the original Emacs program written by Stallman himself. Even if it had been legally enforced, it would not have applied to separately developed imitations such as Gosmacs. Making Gosmacs non-free was unethical according to the ethical ideas of the free software movement, because(as proprietary software) it did not respect its users' freedom, but this issue had nothing to do with where the ideas in Gosmacs came from.
+
+Under copyright, programmers who wanted to copy code from an existing program (even with changes) had to obtain permission from the original developer. The new law applied copyright even in the absence of copyright notices - though hackers generally did not know this - and the copyright notices too began appearing.
+
+Stallman saw these notices as the flags of an invading, occupying army. Rare was the program that didn't borrow source code from past programs, and yet, with a single stroke of the president's pen, the U.S. government had given programmers and companies the legal power to forbid such reuse. Copyright also injected a dose of formality into what had otherwise been an informal system. Simply put, disputes that had once been settled hacker-to-hacker were now to be settled lawyer-to-lawyer. In such a system, companies, not hackers, held the automatic advantage. Some saw placing one's name in a copyright notice as taking responsibility for the quality of the code, but the copyright notice usually has a company's name, and there are other ways for individuals to say what code they wrote.
+={source code:copy rights for}
+
+However, Stallman also noticed, in the years leading up to the GNU Project, that copyright allowed an author to grant permission for certain activities covered by copyright, and place conditions on them too. "I had seen email messages with copyright notices plus simple 'verbatim copying permitted' licenses," he recalls. "Those definitely were [an] inspiration." These licenses carried the condition not to remove the license. Stallman's idea was to take this a few steps further. For example, a permission notice could allow users to redistribute even modified versions, with the condition that these versions carry the same permission.
+
+Thus Stallman concluded that use of copyright was not necessarily unethical. What was bad about software copyright was the way it was typically used, and designed to be used: to deny the user essential freedoms. Most authors imagined no other way to use it. But copyright could be used in a different way: to make a program free and assure its continued freedom.
+
+By GNU Emacs 16, in early 1985, Stallman drafted a copyright-based license that gave users the right to make and distribute copies. It also gave users the right to make and distribute modified versions, but only under the same license. They could not exercise the unlimited power of copyright over those modified versions, so they could not make their versions proprietary as Gosmacs was. And they had to make the source code available. Those conditions closed the legal gap that would otherwise allow restricted, non-free versions of GNU Emacs to emerge.
+={Emacs text editor:copyrights and|GNU Emacs License and;GNU Emacs:copyrights and|GNU Emacs License and;GOSMACS (Gosling Emacs):copyrights and;licenses+15}
+
+Although helpful in codifying the social contract of the Emacs Commune, the early GNU Emacs license remained too "informal" for its purpose, Stallman says. Soon after forming the Free Software Foundation he began working on a more airtight version, consulting with the other directors and with the attorneys who had helped to set it up.
+
+Mark Fischer, a Boston copyright attorney who initially provided Stallman's legal advice, recalls discussing the license with Stallman during this period. "Richard had very strong views about how it should work," Fischer says, "He had two principles. The first was to make the software absolutely as open as possible." (By the time he said this, Fischer seems to have been influenced by open source supporters; Stallman never sought to make software "open.") "The second was to encourage others to adopt the same licensing practices." The requirements in the license were designed for the second goal.
+={Fischer, Mark+2}
+
+The revolutionary nature of this final condition would take a while to sink in. At the time, Fischer says, he simply viewed the GNU Emacs license as a simple trade. It put a price tag on GNU Emacs' use. Instead of money, Stallman was charging users access to their own later modifications. That said, Fischer does remember the license terms as unique.
+
+"I think asking other people to accept the price was, if not unique, highly unusual at that time," he says.
+
+In fashioning the GNU Emacs license, Stallman made one major change to the informal tenets of the old Emacs Commune. Where he had once demanded that Commune members send him all the changes they wrote, Stallman now demanded only that they pass along source code and freedom whenever they chose to redistribute the program. In other words, programmers who simply modified Emacs for private use no longer needed to send the source-code changes back to Stallman. In a rare alteration of free software doctrine, Stallman slashed the "price tag" for free software. Users could innovate without Stallman looking over their shoulders, and distribute their versions only when they wished, just so long as all copies came with permission for their possessors to develop and redistribute them further.
+
+Stallman says this change was fueled by his own dissatisfaction with the Big Brother aspect of the original Emacs Commune social contract. As much as he had found it useful for everyone to send him their changes, he came to feel that requiring this was unjust. "It was wrong to require people to publish all changes," says Stallman.
+
+"It was wrong to require them to be sent to one privileged developer. That kind of centralization and privilege for one was not consistent with a society in which all had equal rights."
+
+The GNU Emacs General Public License made its debut on a version of GNU Emacs in 1985. Following the release, Stallman welcomed input from the general hacker community on how to improve the license's language. One hacker to take up the offer was future software activist John Gilmore, then working as a consultant to Sun Microsystems. As part of his consulting work, Gilmore had ported Emacs over to SunOS, the company's in-house version of Unix. In the process of doing so, Gilmore had published the changed version under the GNU Emacs license. Instead of viewing the license as a liability, Gilmore saw it as clear and concise expression of the hacker ethos. "Up until then, most licenses were very informal," Gilmore recalls.
+={Gilmore, John+6;SunOS:porting Emacs to;Sun Microsystems}
+
+As an example of this informality, Gilmore cites the mid-1980s copyright license of trn, a news reader program written by Larry Wall, a hacker who could go onto later fame as the creator of both the Unix "patch" utility and the Perl scripting language. In the hope of striking a balance between common hacker courtesy and an author's right to dictate the means of commercial publication, Wall used the program's accompanying copyright notice as an editorial sounding board.
+={Wall, Larry+1;patches, inserting into source code;Perl programming language;source code:patches}
+
+_1 Copyright (c) 1985, Larry Wall \\ You may copy the trn kit in whole or in part as long as you don't try to make money off it, or pretend that you wrote it.~{ See Trn Kit README, \\ http://stuff.mit.edu/afs/sipb/project/trn/src/trn-3.6/README. }~
+
+Such statements, while reflective of the hacker ethic, also reflected the difficulty of translating the loose, informal nature of that ethic into the rigid, legal language of copyright. In writing the GNU Emacs license, Stallman had done more than close up the escape hatch that permitted proprietary offshoots. He had expressed the hacker ethic in a manner understandable to both lawyer and hacker alike.
+
+It wasn't long, Gilmore says, before other hackers began discussing ways to "port" the GNU Emacs license over to their own programs. Prompted by a conversation on Usenet, Gilmore sent an email to Stallman in November, 1986, suggesting modification:
+
+_1 You should probably remove "EMACS" from the license and replace it with "SOFTWARE" or something. Soon, we hope, Emacs will not be the biggest part of the GNU system, and the license applies to all of it.~{ See John Gilmore, quoted from email to author. }~
+
+Gilmore wasn't the only person suggesting a more general approach. By the end of 1986, Stallman himself was at work with GNU Project's next major milestone, the source-code debugger GDB. To release this, he had to modify the GNU Emacs license so it applied to GDB instead of GNU Emacs. It was not a big job, but it was an opening for possible errors. In 1989, Stallman figured out how to remove the specific references to Emacs, and express the connection between the program code and the license solely in the program's source files. This way, any developer could apply the license to his program without changing the license. The GNU General Public License, GNU GPL for short, was born. The GNU Project soon made it the official license of all existing GNU programs.
+={GNU Debugger (GDB)+1;GDB (GNU Debugger);Debugger+1}
+
+In publishing the GPL, Stallman followed the software convention of using decimal numbers to indicate versions with minor changes and whole numbers to indicate versions with major changes. The first version, in 1989, was labeled Version 1.0. The license contained a preamble spelling out its political intentions:
+
+_1 The General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.
+
+_1 To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.~{ See Richard Stallman, et al., "GNU General Public License: Version 1,"(February, 1989), \\ http://www.gnu.org/licenses/old-licenses/gpl-1.0.html. }~
+
+As hacks go, the GPL stands as one of Stallman's best. It created a system of communal ownership within the normally proprietary confines of copyright law. More importantly, it demonstrated the intellectual similarity between legal code and software code. Implicit within the GPL's preamble was a profound message: instead of viewing copyright law with suspicion, hackers should view it as a dangerous system that could be hacked.
+% ={Emacs Commune+1}
+
+"The GPL developed much like any piece of free software with a large community discussing its structure, its respect or the opposite in their observation, needs for tweaking and even to compromise it mildly for greater acceptance," says Jerry Cohen, another attorney who advised Stallman after Fischer departed. "The process worked very well and GPL in its several versions has gone from widespread skeptical and at times hostile response to widespread acceptance."
+
+In a 1986 interview with /{BYTE}/ magazine, Stallman summed up the GPL in colorful terms. In addition to proclaiming hacker values, Stallman said, readers should also "see it as a form of intellectual ju-jitsu, using the legal system that software hoarders have set up against them."~{ See David Betz and Jon Edwards, "Richard Stallman discusses his public-domain [ sic ] Unix-compatible software system with BYTE editors," BYTE (July, 1986). (Reprinted on the GNU Project web site: \\ http://www.gnu.org/gnu/byte-interview.html .) \\ This interview offers an interesting, not to mention candid, glimpse at Stallman's political attitudes during the earliest days of the GNU Project. It is also helpful in tracing the evolution of Stallman's rhetoric. \\ Describing the purpose of the GPL, Stallman says, "I'm trying to change the way people approach knowledge and information in general. I think that to try to own knowledge, to try to control whether people are allowed to use it, or to try to stop other people from sharing it, is sabotage." \\ Contrast this with a statement to the author in August 2000: "I urge you not to use the term 'intellectual property' in your thinking. It will lead you to misunderstand things, because that term generalizes about copyrights, patents, and trademarks. And those things are so different in their effects that it is entirely foolish to try to talk about them at once. If you hear somebody saying something' about intellectual property,' without [putting it in] quotes, then he's not thinking very clearly and you shouldn't join." \\ [RMS: The contrast it shows is that I've learned to be more cautious in generalizing. I probably wouldn't talk about "owning knowledge" today, since it's a very broad concept. But "owning knowledge" is not the same generalization as "intellectual property," and the difference between those three laws is crucial to understanding any legal issue about owning knowledge. Patents are direct monopolies over using specific knowledge; that really is one form of "owning knowledge." Copyrights are one of the methods used to stop the sharing of works that embody or explain knowledge, which is a very different thing. Meanwhile, trademarks have very little to do with the subject of knowledge.] }~ Years later, Stallman would describe the GPL's creation in less hostile terms. "I was thinking about issues that were in a sense ethical and in a sense political and in a sense legal," he says. "I had to try to do what could be sustained by the legal system that we're in. In spirit the job was that of legislating the basis for a new society, but since I wasn't a government, I couldn't actually change any laws. I had to try to do this by building on top of the existing legal system, which had not been designed for anything like this."
+={Byte magazine}
+
+About the time Stallman was pondering the ethical, political, and legal issues associated with free software, a California hacker named Don Hopkins mailed him a manual for the 68000 microprocessor. Hopkins, a Unix hacker and fellow science-fiction buff, had borrowed the manual from Stallman a while earlier. As a display of gratitude, Hopkins decorated the return envelope with a number of stickers obtained at a local science-fiction convention. One sticker in particular caught Stallman's eye. It read, "Copyleft (L), All Rights Reversed." Stallman, inspired by the sticker, nicknamed the legal technique employed in the GNU Emacs license (and later in the GNU GPL) "Copyleft," jocularly symbolized by a backwards "C" in a circle. Over time, the nickname would become general Free Software Foundation terminology for any copyright license "making a program free software and requiring all modified and extended versions of the program to be free software as well."
+={copyleft;Hopkins, Don}
+
+The German sociologist Max Weber once proposed that all great religions are built upon the "routinization" or "institutionalization" of charisma. Every successful religion, Weber argued, converts the charisma or message of the original religious leader into a social, political, and ethical apparatus more easily translatable across cultures and time.
+={Weber, Max}
+
+While not religious per se, the GNU GPL certainly qualifies as an interesting example of this "routinization" process at work in the modern, decentralized world of software development. Since its unveiling, programmers and companies who have otherwise expressed little loyalty or allegiance to Stallman have willingly accepted the GPL bargain at face value. Thousands have also accepted the GPL as a preemptive protective mechanism for their own software programs. Even those who reject the GPL conditions as too limiting still credit it as influential.
+
+One hacker falling into this latter group was Keith Bostic, a University of California employee at the time of the GPL 1.0 release. Bostic's department, the Computer Systems Research Group (SRG), had been involved in Unix development since the late 1970s and was responsible for many key parts of Unix, including the TCP/IP networking protocol, the cornerstone of modern Internet communications. By the late 1980s, AT&T, the original owner of the Unix software, began to focus on commercializing Unix and began looking to the Berkeley Software Distribution, or BSD, the academic version of Unix developed by Bostic and his Berkeley peers, as a key source of commercial technology.
+={AT&T+1;Berkely Software Distribution (BSD)+6;Bostic, Keith+5;BSD (Berkely Software Distribution)+6;Computer Systems Research Group;University of California+4;TCP/IP}
+
+The code written by Bostic and friends was off limits to nearly everyone, because it was intermixed with proprietary AT&T code. Berkeley distributions were therefore available only to institutions that already had a Unix source license from AT&T. As AT&T raised its license fees, this arrangement, which had at first seemed innocuous (to those who thought only of academia) became increasingly burdensome even there. To use Berkeley's code in GNU, Stallman would have to convince Berkeley to separate it from AT&T's code and release it as free software. In 1984 or 1985 he met with the leaders of the BSD effort, pointing out that AT&T was not a charity and that for a university to donate its work (in effect) to AT&T was not proper. He asked them to separate out their code and release it as free software.
+={licenses:AT&T UNIX source code and+2}
+
+Hired in 1986, Bostic had taken on the personal project of porting the latest version of BSD to the PDP-11 computer. It was during this period, Bostic says, that he came into close interaction with Stallman during Stallman's occasional forays out to the west coast. "I remember vividly arguing copyright with Stallman while he sat at borrowed workstations at CSRG," says Bostic. "We'd go to dinner afterward and continue arguing about copyright over dinner."
+={PDP-11 computer}
+
+The arguments eventually took hold, although not in the way Stallman would have preferred. In June, 1989, Berkeley had separated its networking code from the rest of the AT&T-owned operating system and began distributing it under a copyright-based free license. The license terms were liberal. All a licensee had to do was give credit to the university in advertisements touting derivative programs.~{ The University of California's "obnoxious advertising clause" would later prove to be a problem. Looking for a permissive alternative to the GPL, some hackers used the original BSD license, replacing "University of California" with their own names or the names of their institutions. The result: free software systems using many of these programs would have to cite dozens of names in advertisements. In 1999, after a few years of lobbying on Stallman's part, the University of California agreed to drop this clause. See "The BSD License Problem" at \\ http://www.gnu.org/philosophy/bsd.html. }~ In contrast to the GPL, this license permitted proprietary offshoots. One problem limited the use of the BSD Networking release: it wasn't a complete operating system, just the network-related parts of one. While the code would be a major contribution to any free operating system, it could only be run at that time in conjunction with other, proprietary-licensed code.
+={AT&T+1}
+
+Over the next few years, Bostic and other University of California employees worked to replace the missing components and turn BSD into a complete, freely redistributable operating system. Although delayed by a legal challenge from Unix Systems Laboratories - the AT&T spin-off that retained ownership of the Unix code - the effort would finally bear fruit in the early 1990s. Even before then, however, many of the Berkeley network utilities would make their way into Stallman's GNU system.
+
+"I think it's highly unlikely that we ever would have gone as strongly as we did without the GNU influence," says Bostic, looking back. "It was clearly something where they were pushing hard and we liked the idea."
+
+By the end of the 1980s, the GPL was beginning to exert a gravitational effect on the free software community. A program didn't have to carry the GPL to qualify as free software - witness the case of the BSD network utilities - but putting a program under the GPL sent a definite message. "I think the very existence of the GPL inspired people to think through whether they were making free software, and how they would license it," says Bruce Perens, creator of Electric Fence, a popular Unix utility, and future leader of the Debian GNU/Linux development team. A few years after the release of the GPL, Perens says he decided to discard Electric Fence's homegrown license in favor of Stallman's lawyer-vetted copyright. "It was actually pretty easy to do," Perens recalls.
+={Perens, Bruce}
+
+Rich Morin, the programmer who had viewed Stallman's initial GNU announcement with a degree of skepticism, recalls being impressed by the software that began to gather under the GPL umbrella. As the leader of a SunOS user group, one of Morin's primary duties during the 1980s had been to send out distribution tapes containing the best freeware or free software utilities. The job often mandated calling up original program authors to verify whether their programs were copyrighted or whether they had been consigned to the public domain. Around 1989, Morin says, he began to notice that the best software programs typically fell under the GPL license. "As a software distributor, as soon as I saw the word GPL, I knew I was home free,"recalls Morin.
+={SunOS}
+
+To compensate for the prior hassles that went into compiling distribution tapes to the Sun User Group, Morin had charged recipients a convenience fee. Now, with programs moving over to the GPL, Morin was suddenly getting his tapes put together in half the time, turning a tidy profit in the process. Sensing a commercial opportunity, Morin rechristened his hobby as a business: Prime Time Freeware.
+={Sun User Group}
+
+Such commercial exploitation was completely consistent with the free software agenda. "When we speak of free software, we are referring to freedom, not price," advised Stallman in the GPL's preamble. By the late 1980s, Stallman had refined it to a more simple mnemonic: "Don't think free as in free beer; think free as in free speech."
+
+For the most part, businesses ignored Stallman's entreaties. Still, for a few entrepreneurs, the freedom associated with free software was the same freedom associated with free markets. Take software ownership out of the commercial equation, and you had a situation where even the smallest software company was free to compete against the IBMs and DECs of the world.
+
+One of the first entrepreneurs to grasp this concept was Michael Tiemann, a software programmer and graduate student at Stanford University. During the 1980s, Tiemann had followed the GNU Project like an aspiring jazz musician following a favorite artist. It wasn't until the release of the GNU C Compiler, or GCC, in 1987, however, that he began to grasp the full potential of free software. Dubbing GCC a "bombshell," Tiemann says the program's own existence underlined Stallman's determination as a programmer.
+={C Compiler (GNU)+9;GNU C Compiler (GCC)+9;GCC (GNU C Compiler)+9;Tiemann, Michael+8;Stanford University}
+
+"Just as every writer dreams of writing the great American novel, every programmer back in the 1980s talked about writing the great American compiler," Tiemman recalls. "Suddenly Stallman had done it. It was very humbling."
+
+"You talk about single points of failure, GCC was it," echoes Bostic. "Nobody had a compiler back then, until GCC came along."
+
+Rather than compete with Stallman, Tiemann decided to build on top of his work. The original version of GCC weighed in at 110,000 lines of code, but Tiemann recalls the program as surprisingly easy to understand. So easy in fact that Tiemann says it took less than five days to master and another week to port the software to a new hardware platform, National Semiconductor's 32032 microchip. Over the next year, Tiemann began playing around with the source code, creating the first "native" or direct compiler for the C++ programming language, by extending GCC to handle C++ as well as C. (The existing, proprietary implementation of the C++ language worked by converting the code to the C language, then feeding the result to a C compiler.) One day, while delivering a lecture on the program at Bell Labs, Tiemann ran into some AT&T developers struggling to pull off the same thing.
+={C+ programming language}
+
+"There were about 40 or 50 people in the room, and I asked how many people were working on the native code compiler," Tiemann recalls. "My host said the information was confidential but added that if I took a look around the room I might get a good general idea."
+
+It wasn't long after, Tiemann says, that the light bulb went off in his head. "I had been working on that project for six months," Tiemann says. I just thought to myself, whether it's me or the code, this is a level of efficiency that the free market should be ready to reward."
+
+Tiemann found added inspiration in the /{GNU Manifesto}/: while excoriating the greed of proprietary software vendors, it also encourages companies, as long as they respect users freedom, to use and redistribute free software in their commercial activities. By removing the power of monopoly from the commercial software question, the GPL makes it possible for even small companies to compete on the basis of service, which extends from simple tech support to training to extending free programs for specific clients' needs.
+={GNU Manifesto}
+
+In a 1999 essay, Tiemann recalls the impact of Stallman's /{Manifesto}/. "It read like a socialist polemic, but I saw something different. I saw a business plan in disguise."~{ See Michael Tiemann, "Future of Cygnus Solutions: An Entrepreneur's Account," Open Sources (O'Reilly & Associates, Inc., 1999): 139, \\ http://www.oreilly.com/catalog/opensources/book/tiemans.html. }~
+
+This business plan was not new; Stallman supported himself in the late 80s by doing this on a small scale. But Tiemann intended to take it to a new level. Teaming up with John Gilmore and David Vinayak Wallace, Tiemann launched a software consulting service dedicated to customizing GNU programs. Dubbed Cygnus Support (informally, "Cygnus" was a recursive acronym for "Cygnus, Your GNU Support"), the company signed its first development contract in February, 1990. By the end of the year, the company had $725,000 worth of support and development contracts.
+={Gilmore, John}
+
+The complete GNU operating system Stallman envisioned required more than software development tools. In the 1990s, GNU also developed a command line interpreter or "shell," which was an extended replacement for the Bourne Shell (written by FSF employee Brian Fox, and christened by Stallman the Bourne Again Shell, or BASH), as well as the PostScript interpreter Ghostscript, the documentation browser platform Texinfo, the C Library which C programs need in order to run and talk to the system's kernel, the spreadsheet Oleo ("better for you than the more expensive spreadsheet"), and even a fairly good chess game. However, programmers were typically most interested in the GNU programming tools.
+
+GNU Emacs, GDB, and GCC were the "big three" of developer-oriented tools, but they weren't the only ones developed by the GNU Project in the 80s. By 1990, GNU had also generated GNU versions of the build-controller Make, the parser-generator YACC (rechristened Bison), and awk (rechristened gawk); as well as dozens more. Like GCC, GNU programs were usually designed to run on multiple systems, not just a single vendor's platform. In the process of making programs more flexible, Stallman and his collaborators often made them more useful as well.
+
+Recalling the GNU universalist approach, Prime Time Freeware's Morin points to a useless but vitally important software package called GNU Hello, which serves as an example to show programmers how to properly package a program for GNU. "It's the hello world program which is five lines of C, packaged up as if it were a GNU distribution," Morin says. "And so it's got the Texinfo stuff and the configure stuff. It's got all the other software engineering goo that the GNU Project has come up with to allow packages to port to all these different environments smoothly. That's tremendously important work, and it affects not only all of [Stallman's] software, but also all of the other GNU Project software."
+
+According to Stallman, improving technically on the components of Unix was secondary to replacing them with free software. "With each piece I may or may not find a way to improve it," said Stallman to /{BYTE}/. "To some extent I am getting the benefit of reimplementation, which makes many systems much better. To some extent it's because I have been in the field a long time and worked on many other systems. I therefore have many ideas [which I learned from them] to bring to bear."~{ See Richard Stallman, BYTE (1986). }~
+={Byte magazine}
+
+Nevertheless, as GNU tools made their mark in the late 1980s, Stallman's AI Lab-honed reputation for design fastidiousness soon became legendary throughout the entire software-development community.
+
+Jeremy Allison, a Sun user during the late 1980s and programmer destined to run his own free software project, Samba, in the 1990s, recalls that reputation with a laugh. During the late 1980s, Allison began using Emacs. Inspired by the program's community-development model, Allison says he sent in a snippet of source code only to have it rejected by Stallman.
+={Allison, Jeramy+1}
+
+"It was like the /{Onion}/ headline," Allison says. "'Child's prayers to God answered: No.'"
+={Onion, The}
+
+As the GNU Project moved from success to success in creation of user-level programs and libraries, it postponed development of the kernel, the central "traffic cop" program that controls other programs' access to the processor and all machine resources.
+
+As with several other major system components, Stallman sought a head-start on kernel development by looking for an existing program to adapt. A review of GNU Project "GNUs letters" of the late 1980s reveals that this approach, like the initial attempt to build GCC out of Pastel, had its problems. A January, 1987 GNUs letter reported the GNU Project's intention to overhaul TRIX, a kernel developed at MIT. However, Stallman never actually tried to do this, since he was working on GCC at the time; later he concluded that TRIX would require too much change to be a good starting point. By February of 1988, according to a newsletter published that month, the GNU Project had shifted its kernel plans to Mach, a lightweight "micro-kernel" developed at Carnegie Mellon. Mach was not then free software, but its developers privately said they would liberate it; when this occurred, in 1990, GNU Project kernel development could really commence.~{ See "Hurd History," \\ http://www.gnu.org/software/hurd/history.html. }~
+
+The delays in kernel development were just one of many concerns weighing on Stallman during this period. In 1989, Lotus Development Corporation filed suit against rival software companies, Paperback Software International and Borland, for copying menu commands from Lotus' popular 1-2-3 Spreadsheet program. Lotus' suit, coupled with the Apple-Microsoft "look and feel" battle, endangered the future of the GNU system. Although neither suit directly attacked the GNU Project, both threatened the right to develop software compatible with existing programs, as many GNU programs were. These lawsuits could impose a chilling effect on the entire culture of software development. Determined to do something, Stallman and a few professors put an ad in /{The Tech}/ (the MIT student newspaper) blasting the lawsuits and calling for a boycott of both Lotus and Apple. He then followed up the ad by helping to organize a group to protest the corporations filing the suit. Calling itself the League for Programming Freedom, the group held protests outside the offices of Lotus, Inc.
+={Apple Computers;Lotus Development Corp.;Microsoft Corporation:Apple Computer lawsuit;Paperback Software International}
+
+The protests were notable.~{ According to a League for Programming Freedom press release at \\ http://progfree.org/Links/prep.ai.mit.edu/demo.final.release, the protests were no-table for featuring the first hexadecimal protest chant: \\ 1-2-3-4, toss the lawyers out the door \\ 5-6-7-8, innovate don't litigate \\ 9-A-B-C, 1-2-3 is not for me \\ D-E-F-O, look and feel have got to go }~
+
+They document the evolving nature of the software industry. Applications had quietly replaced operating systems as the primary corporate battleground. In its unfinished quest to build a free software operating system, the GNU Project seemed hopelessly behind the times to those whose primary values were fashion and success. Indeed, the very fact that Stallman had felt it necessary to put together an entirely new group dedicated to battling the "look and feel" lawsuits led some observers to think that the FSF was obsolete.
+
+However, Stallman had a strategic reason to start a separate organization to fight the imposition of new monopolies on software development: so that proprietary software developers would join it too. Extending copyright to cover interfaces would threaten many proprietary software developers as well as many free software developers. These proprietary developers were unlikely to endorse the Free Soft-ware Foundation, but there was, intentionally, nothing in the League for Programming Freedom to drive them away. For the same reason, Stallman handed over leadership of LPF to others as soon as it was feasible.
+
+In 1990, the John D. and Catherine T. MacArthur Foundation certified Stallman's genius status when it granted Stallman a Mac Arthur fellowship, the so-called "genius grant," amounting in this case to$240,000 over 5 years. Although the Foundation does not state a reason for its grants, this one was seen as an award for launching the GNU Project and giving voice to the free software philosophy. The grant relieved a number of short-term concerns for Stallman. For instance, it enabled him to cease the consulting work through which he had obtained his income in the 80s and devote more time to the free software cause.
+
+The award also made it possible for Stallman to register normally to vote. In 1985 a fire in the house where Stallman lived left him without an official domicile. It also covered most of his books with ash, and cleaning these "dirty books" did not yield satisfying results. From that time he lived as a "squatter" at 545 Technology Square, and had to vote as a "homeless person."~{ See Reuven Lerner, "Stallman wins $240,000 MacArthur award," MIT, The Tech (July 18, 1990), \\ http://the-tech.mit.edu/V110/N30/rms.30n.html. }~ "[The Cambridge Election Commission] didn't want to accept that as my address," Stallman would later recall. "A newspaper article about the MacArthur grant said that, and then they let me register."~{ See Michael Gross, "Richard Stallman: High School Misfit, Symbol of Free Software, Mac Arthur-certified Genius" (1999). }~
+
+Most importantly, the MacArthur fellowship gave Stallman press attention and speaking invitations, which he used to spread the word about GNU, free software, and dangers such as "look and feel" lawsuits and software patents.
+
+Interestingly, the GNU system's completion would stem from one of these trips. In April 1991, Stallman paid a visit to the Polytechnic University in Helsinki, Finland. Among the audience members was 21-year-old Linus Torvalds, who was just beginning to develop the Linux kernel - the free software kernel destined to fill the GNU system's main remaining gap.
+={Helsinki, Finland+3;Polytechnic University (Finland);Torvalds, Linus+16}
+
+A student at the nearby University of Helsinki at the time, Torvalds regarded Stallman with bemusement. "I saw, for the first time in my life, the stereotypical long-haired, bearded hacker type," recalls Torvalds in his 2001 autobiography /{Just for Fun}/. "We don't have much of them in Helsinki."~{ See Linus Torvalds and David Diamond, Just For Fun: The Story of an Accidental Revolutionary (Harper Collins Publishers, Inc., 2001): 58-59. Although presumably accurate in regard to Torvalds' life, what the book says about Stallman is sometimes wrong. For instance, it says that Stallman "wants to make everything open source," and that he "complains about other people not using the GPL." In fact, Stallman advocates free software, not open source. He urges authors to choose the GNU GPL, in most circumstances, but says that all free software licenses are ethical. }~
+
+While not exactly attuned to the "socio political" side of the Stallman agenda, Torvalds nevertheless appreciated one aspect of the agenda's underlying logic: no programmer writes error-free code. Even when users have no wish to adapt a program to their specific preferences, any program can use improvement. By sharing software, hackers put a program's improvement ahead of individual motivations such as greed or ego protection.
+
+Like many programmers of his generation, Torvalds had cut his teeth not on mainframe computers like the IBM 7094, but on a motley assortment of home-built computer systems. As a university student, Torvalds had made the step up from PC programming to Unix, using the university's MicroVAX. This ladder-like progression had given Torvalds a different perspective on the barriers to machine access. For Stallman, the chief barriers were bureaucracy and privilege. For Torvalds, the chief barriers were geography and the harsh Helsinki winter. Forced to trek across the University of Helsinki just to log in to his Unix account, Torvalds quickly began looking for a way to log in from the warm confines of his off-campus apartment.
+={IBM 7094 computer;MicroVAX+1}
+
+Torvalds was using Minix, a lightweight non-free system developed as an instructional example by Dutch university professor Andrew Tanenbaum.~{ It was non-free in 1991. Minix is free software now. }~ It included the non-free Free University Compiler Kit, plus utilities of the sort that Tanenbaum had contemptuously invited Stallman in 1983 to write.~{ Tanenbaum describes Minix as an "operating system" in his book, Operating System Design and Implementation , but what the book discusses is only the part of the system that corresponds to the kernel of Unix. There are two customary usages of the term "operating system," and one of them is what is called the "kernel" in Unix terminology. But that's not the only terminological complication in the subject. That part of Minix consists of a microkernel plus servers that run on it, a design of the same kind as the GNU Hurd plus Mach. The microkernel plus servers are comparable to the kernel of Unix. But when that book says "the kernel," it refers to the microkernel only. See Andrew Tanenbaum, Operating System Design and Implementation , 1987. }~
+={Minix operating system+2;Unix operating system:Minix and;Tanenbaum, Andrew}
+
+Minix fit within the memory confines of Torvalds' 386 PC, but it was intended more to be studied than used. The Minix system also lacked the facility of terminal emulation, which would mimic a typical display terminal and thus enable Torvalds to log in to the MicroVAX from home.
+
+Early in 1991, Torvalds began writing a terminal emulation program. He used Minix to develop his emulator, but the emulator didn't run on Minix; it was a stand-alone program. Then he gave it features to access disk files in Minix's file system. Around then, Torvalds referred to his evolving work as the "GNU/Emacs of terminal emulation programs."~{ See Linus Torvalds and David Diamond, Just For Fun: The Story of an Accidental Revolutionary (Harper Collins Publishers, Inc., 2001): 78. }~
+
+Since Minix lacked many important features. Torvalds began extending his terminal emulator into a kernel comparable to that of Minix, except that it was monolithic. Feeling ambitious, he solicited a Minix newsgroup for copies of the POSIX standards, the specifications for a Unix-compatible kernel.~{ POSIX was subsequently extended to include specifications for many command-line features, but that did not exist in 1991. }~ A few weeks later, having put his kernel together with some GNU programs and adapted them to work with it, Torvalds was posting a message reminiscent of Stallman's original 1983 GNU posting:
+
+_1 Hello everybody out there using minix-
+
+_1 I'm doing a (free) operating system (just a hobby, won't be big and professional like gnu) for 386 (486) AT clones. This has been brewing since April, and is starting to get ready. I'd like any feedback on things people like/dislike in minix, as my OS resembles it somewhat (same physical layout of the file-system (due to practical reasons) among other things). I've currently ported bash (1.08) and gcc(1.40)...~{ Ibid, p. 85. }~
+
+The posting drew a smattering of responses and within a month, Torvalds had posted a 0.01 version of his kernel - i.e., the earliest possible version fit for outside review - on an Internet FTP site. In the course of doing so, Torvalds had to come up with a name for the new kernel. On his own PC hard drive, Torvalds had saved the program as Linux, a name that paid its respects to the software convention of giving each Unix variant a name that ended with the letter X. Deeming the name too "egotistical," Torvalds changed it to Freax, only to have the FTP site manager change it back.
+={Freax}
+
+Torvalds said he was writing a free operating system, and his comparing it with GNU shows he meant a complete system. However, what he actually wrote was a kernel, pure and simple. Torvalds had no need to write more than the kernel because, as he knew, the other needed components were already available, thanks to the developers of GNU and other free software projects. Since the GNU Project wanted to use them all in the GNU system, it had perforce made them work together. While Torvalds continued developing the kernel, he (and later his collaborators) made those programs work with it too.
+
+Initially, Linux was not free software: the license it carried did not qualify as free, because it did not allow commercial distribution. Torvalds was worried that some company would swoop in and take Linux away from him. However, as the growing GNU/Linux combination gained popularity, Torvalds saw that sale of copies would be useful for the community, and began to feel less worried about a possible takeover.~{ Ibid, p. 94-95. }~ This led him to reconsider the licensing of Linux.
+
+Neither compiling Linux with GCC nor running GCC with Linux required him legally to release Linux under the GNU GPL, but Torvalds' use of GCC implied for him a certain obligation to let other users borrow back. As Torvalds would later put it: "I had hoisted myself up on the shoulders of giants."~{ Ibid, p. 95-97. }~ Not surprisingly, he began to think about what would happen when other people looked to him for similar support. A decade after the decision, Torvalds echoes the Free Software Foundation's Robert Chassell when he sums up his thoughts at the time:
+={C Compiler (GNU):Linux development and+3;GNU C Compiler (GCC):Linux development and;GCC (GNU C Compiler):Linux development and}}
+
+_1 You put six months of your life into this thing and you want to make it available and you want to get something out of it, but you don't want people to take advantage of it. I wanted people to be able to see [Linux], and to make changes and improvements to their hearts' content. But I also wanted to make sure that what I got out of it was to see what they were doing. I wanted to always have access to the sources so that if they made improvements, I could make those improvements myself.~{ See Linus Torvalds and David Diamond, Just For Fun: The Story of an Accidental Revolutionary (Harper Collins Publishers, Inc., 2001): 94-95. }~
+
+When it was time to release the 0.12 version of Linux, the first to operate fully with GCC, Torvalds decided to throw his lot in with the free software movement. He discarded the old license of Linux and replaced it with the GPL. Within three years, Linux developers were offering release 1.0 of Linux, the kernel; it worked smoothly with the almost complete GNU system, composed of programs from the GNU Project and elsewhere. In effect, they had completed the GNU operating system by adding Linux to it. The resulting system was basically GNU plus Linux. Torvalds and friends, however, referred to it confusingly as "Linux."
+
+By 1994, the amalgamated system had earned enough respect in the hacker world to make some observers from the business world wonder if Torvalds hadn't given away the farm by switching to the GPL in the project's initial months. In the first issue of /{Linux Journal}/, publisher Robert Young sat down with Torvalds for an interview. When Young asked the Finnish programmer if he felt regret at giving up private ownership of the Linux source code, Torvalds said no. "Even with 20/20 hindsight," Torvalds said, he considered the GPL "one of the very best design decisions" made during the early stages of the Linux project.~{ See Robert Young, "Interview with Linus, the Author of Linux," Linux Journal (March 1, 1994), \\ http://www.linuxjournal.com/article/2736. }~
+={Young, Robert}
+
+That the decision had been made with zero appeal or deference to Stallman and the Free Software Foundation speaks to the GPL's growing portability. Although it would take a couple of years to be recognized by Stallman, the explosiveness of Linux development conjured flashbacks of Emacs. This time around, however, the innovation triggering the explosion wasn't a software hack like Control-R but the novelty of running a Unix-like system on the PC architecture. The motives may have been different, but the end result certainly fit the ethical specifications: a fully functional operating system composed entirely of free software.
+={Control-R (^R)}
+
+As his initial email message to the comp.os.minix newsgroup indicates, it would take a few months before Torvalds saw Linux as anything more than a holdover until the GNU developers delivered on the Hurd kernel. As far as Torvalds was concerned, he was simply the latest in a long line of kids taking apart and reassembling things just for fun. Nevertheless, when summing up the runaway success of a project that could have just as easily spent the rest of its days on an abandoned computer hard drive, Torvalds credits his younger self for having the wisdom to give up control and accept the GPL bargain. "I may not have seen the light," writes Torvalds, reflecting on Stallman's 1991 Polytechnic University speech and his subsequent decision to switch to the GPL. "But I guess something from his speech sunk in."~{ See Linus Torvalds and David Diamond, Just For Fun: The Story of an Accidental Revolutionary (Harper Collins Publishers, Inc., 2001): 59. }~
+={HURD kernel}
+
+1~ Chapter 10 - GNU/Linux
+={GNU/Linux+45;Linux+45;Stallman, Richard M.:GNU Linux+46}
+
+By 1993, the free software movement was at a crossroads. To the optimistically inclined, all signs pointed toward success for the hacker culture. /{Wired}/ magazine, a funky, new publication offering stories on data encryption, Usenet, and software freedom, was flying off magazine racks. The Internet, once a slang term used only by hackers and research scientists, had found its way into mainstream lexicon. Even President Clinton was using it. The personal computer, once a hobbyist's toy, had grown to full-scale respectability, giving a whole new generation of computer users access to hacker-built software. And while the GNU Project had not yet reached its goal of a fully intact, free GNU operating system, users could already run the GNU/Linux variant.
+={Internet+3;Wired magazine;PCs (personal computers)+2;personal computers (PCs)+2}
+
+Any way you sliced it, the news was good, or so it seemed. After a decade of struggle, hackers and hacker values were finally gaining acceptance in mainstream society. People were getting it.
+
+Or were they? To the pessimistically inclined, each sign of acceptance carried its own troubling countersign. Sure, being a hacker was suddenly cool, but was cool good for a community that thrived on alienation? Sure, the White House was saying nice things about the Internet, even going so far as to register its own domain name, white-house.gov, *** but it was also meeting with the companies, censorship advocates, and law-enforcement officials looking to tame the Internet's Wild West culture. Sure, PCs were more powerful, but in commoditizing the PC marketplace with its chips, Intel had created a situation in which proprietary software vendors now held the power. For every new user won over to the free software cause via GNU/Linux, hundreds, perhaps thousands, were booting up Microsoft Windows for the first time. GNU/Linux had only rudimentary graphical interfaces, so it was hardly user-friendly. In 1993, only an expert could use it. The GNU Project's first attempt to develop a graphical desktop had been abortive.
+={Intel}
+
+Then there was the political situation. Copyrighting of user interfaces was still a real threat - the courts had not yet rejected the idea. Meanwhile, patents on software algorithms and features were a growing danger that threatened to spread to other countries.
+
+Finally, there was the curious nature of GNU/Linux itself. Unrestricted by legal disputes (such as BSD faced), GNU/Linux's high-speed evolution had been so unplanned, its success so accidental, that programmers closest to the software code itself didn't know what to make of it. More compilation album than unified project, it was comprised of a hacker medley of greatest hits: everything from GCC, GDB, and glibc (the GNU Project's newly developed C Library) toX (a Unix-based graphic user interface developed by MIT's Laboratory for Computer Science) to BSD-developed tools such as BIND (the Berkeley Internet Naming Daemon, which lets users substitute easy-to-remember Internet domain names for numeric IP addresses) and TCP/IP. In addition, it contained the Linux kernel - itself designed as a replacement for Minix. Rather than developing a new operating system, Torvalds and his rapidly expanding Linux development team had plugged their work into this matrix. As Torvalds himself would later translate it when describing the secret of his success: "I'm basically a very lazy person who likes to take credit for things other people actually do."~{ Torvalds has offered this quote in many different settings. To date, however, the quote's most notable appearance is in the Eric Raymond essay, "The Cathedral and the Bazaar" (May, 1997), \\ http://www.catb.org/~esr/writings/cathedral-bazaar/. }~
+={BIND (Berkely Internet Naming Daemon);Berkely Internet Naming Daemon (BIND);C programming language:glibc;GNU Debugger (GDB):Linux and;GDB (GNU Debugger): Linux and;glibc (GNU C Library);GNU C Library (glibc);kernel (Linux);X graphic user interface;Laboratory for Computer Science:X, developing;Minix operating system:kernel, used for Linux;TCP/IP;Torvalds, Linus:Minix, reworking for Linux+2}
+
+Such laziness, while admirable from an efficiency perspective, was troubling from a political perspective. For one thing, it underlined the lack of an ideological agenda on Torvalds' part. Unlike the GNU developers, Torvalds hadn't built his kernel out of a desire to give his fellow hackers freedom; he'd built it to have something he himself could play with. So what exactly was the combined system, and which philosophy would people associate it with? Was it a manifestation of the free software philosophy first articulated by Stallman in the /{GNU Manifesto}/? Or was it simply an amalgamation of nifty software tools that any user, similarly motivated, could assemble on his own home system?
+={GNU Manifesto}
+
+By late 1993, a growing number of GNU/Linux users had begun to lean toward the latter definition and began brewing private variations on the theme. They began to develop various "distributions" of GNU/Linux and distribute them, sometimes gratis, sometimes for a price. The results were spotty at best.
+
+"This was back before Red Hat and the other commercial distributions," remembers Ian Murdock, then a computer science student at Purdue University. "You'd flip through Unix magazines and find all these business card-sized ads proclaiming 'Linux.' Most of the companies were fly-by-night operations that saw nothing wrong with slipping a little of their own [proprietary] source code into the mix."
+={Murdock, Ian+38;Red Hat Inc.;Purdue University}
+
+Murdock, a Unix programmer, remembers being "swept away" by GNU/Linux when he first downloaded and installed it on his home PC system. "It was just a lot of fun," he says. "It made me want to get involved." The explosion of poorly built distributions began to dampen his early enthusiasm, however. Deciding that the best way to get involved was to build a version free of additives, Murdock set about putting a list of the best free software tools available with the intention of folding them into his own distribution. "I wanted something that would live up to the Linux name," Murdock says.
+
+In a bid to "stir up some interest," Murdock posted his intentions on the Internet, including Usenet's comp.os.linux newsgroup. One of the first responding email messages was from rms@ai.mit.edu. As a hacker, Murdock instantly recognized the address. It was Richard M. Stallman, founder of the GNU Project and a man Murdock knew even back then as "the hacker of hackers." Seeing the address in his mail queue, Murdock was puzzled. Why on Earth would Stallman, a person leading his own operating-system project, care about Murdock's gripes over "Linux" distributions?
+
+Murdock opened the message.
+
+"He said the Free Software Foundation was starting to look closely at Linux and that the FSF was interested in possibly doing a Linux [sic] system, too. Basically, it looked to Stallman like our goals were in line with their philosophy."
+={Free Software Foundation (FSF):Linux and+3}
+
+Not to over dramatize, the message represented a change in strategy on Stallman's part. Until 1993, Stallman had been content to keep his nose out of Linux affairs. After first hearing of the new kernel, Stallman asked a friend to check its suitability. Recalls Stallman, "Here ported back that the software was modeled after System V, which was the inferior version of Unix. He also told me it wasn't portable."
+={System V}
+
+The friend's report was correct. Built to run on 386-based machines, Linux was firmly rooted to its low-cost hardware platform. What the friend failed to report, however, was the sizable advantage Linux enjoyed as the only free kernel in the marketplace. In other words, while Stallman spent the next year and a half listening to progress reports from the Hurd developer, reporting rather slow progress, Torvalds was winning over the programmers who would later uproot and replant Linux and GNU onto new platforms.
+
+By 1993, the GNU Project's failure to deliver a working kernel was leading to problems both within the GNU Project and in the free software movement at large. A March, 1993, /{Wired}/ magazine article by Simson Garfinkel described the GNU Project as "bogged down" despite the success of the project's many tools.~{ See Simson Garfinkel, "Is Stallman Stalled?" /{Wired}/ (March, 1993). }~ Those within the project and its nonprofit adjunct, the Free Software Foundation, remember the mood as being even worse than Garfinkel's article let on. "It was very clear, at least to me at the time, that there was a window of opportunity to introduce a new operating system," says Chassell. "And once that window was closed, people would become less interested. Which is in fact exactly what happened."~{ Chassell's concern about there being a 36-month "window" for a new operating system is not unique to the GNU Project. During the early 1990s, free software versions of the Berkeley Software Distribution were held up by Unix System Laboratories' lawsuit restricting the release of BSD-derived software. While many users consider BSD offshoots such as FreeBSD and OpenBSD to be demonstrably superior to GNU/Linux both in terms of performance and security, the number of FreeBSD and OpenBSD users remains a fraction of the total GNU/Linux user population. To view a sample analysis of the relative success of GNU/Linux in relation to other free software operating systems, see the essay by New Zealand hacker, Liam Greenwood, "Why is Linux Successful" (1999), \\ http://www.freebsddiary.org/linux.php. }~
+={Garfinkel, Simson;GNU Project:kernel;Wired magazine:GNU Project and}
+
+Much has been made about the GNU Project's struggles during the 1990-1993 period. While some place the blame on Stallman for those struggles, Eric Raymond, an old friend of Stallman's who supported the GNU Project lukewarmly, says the problem was largely institutional. "The FSF got arrogant," Raymond says. "They moved away from the goal of doing a production-ready operating system to doing operating-system research." Even worse, "They thought nothing outside the FSF could affect them."
+={HURD kernel+4;Raymond, Eric}
+
+Murdock adopts a more charitable view. "I think part of the problem is they were a little too ambitious and they threw good money after bad," he says. "Micro-kernels in the late 80s and early 90s were a hot topic. Unfortunately, that was about the time that the GNU Project started to design their kernel. They ended up with a lot of baggage and it would have taken a lot of backpedaling to lose it."
+
+Stallman responds, "Although the emotions Raymond cites come from his imagination, he's right about one cause of the Hurd's delay:the Hurd developer several times redesigned and rewrote large parts of the code based on what he had learned, rather than trying to make the Hurd run as soon as possible. It was good design practice, but it wasn't the right practice for our goal: to get something working ASAP."
+
+Stallman cites other issues that also caused delay. The Lotus and Apple lawsuits claimed much of his attention; this, coupled with hand problems that prevented him from typing for three years, mostly excluded Stallman from programming. Stallman also cites poor communication between various portions of the GNU Project. "We had to do a lot of work to get the debugging environment to work," he recalls." And the people maintaining GDB at the time were not that cooperative." They had given priority to supporting the existing platforms of GDB's current users, rather than to the overall goal of a complete GNU system.
+
+Most fundamentally, however, Stallman says he and the Hurd developers underestimated the difficulty of developing the Unix kernel facilities on top of the Mach microkernel. "I figured, OK, the [Mach]part that has to talk to the machine has already been debugged," Stallman says, recalling the Hurd team's troubles in a 2000 speech. "With that head start, we should be able to get it done faster. But instead, it turned out that debugging these asynchronous multi-threaded programs was really hard. There were timing bugs that would clobber the files, and that's no fun. The end result was that it took many, many years to produce a test version."~{ See Maui High Performance Computing Center Speech. In subsequent emails, I asked Stallman what exactly he meant by the term "timing bugs." Stallman said "timing errors" was a better way to summarize the problem and offered an elucidating technical information of how a timing error can hamper an operating system's performance: \\ "Timing errors" occur in an asynchronous system where jobs done in parallel can theoretically occur in any order, and one particular order leads to problems. \\ Imagine that program A does X, and program B does Y, where both X and Y are short routines that examine and update the same data structure. Nearly always the computer will do X before Y, or do Y before X, and then there will be no problem. On rare occasions, by chance, the scheduler will let program A run until it is in the middle of X, and then run B which will do Y. Thus, Y will be done while Xis half-done. Since they are updating the same data structure, they will interfere. For instance, perhaps X has already examined the data structure, and it won't notice that there was a change. There will be an unreproducible failure, unreproducible because it depends on chance factors (when the scheduler decides to run which program and how long). \\ The way to prevent such a failure is to use a lock to make sure X and Y can't run at the same time. Programmers writing asynchronous systems know about the general need for locks, but sometimes they overlook the need for a lock in a specific place or on a specific data structure. Then the program has a timing error. }~
+
+Over time, the growing success of GNU together with Linux made it clear that the GNU Project should get on the train that was leaving and not wait for the Hurd. Besides, there were weaknesses in the community surrounding GNU/Linux. Sure, Linux had been licensed under the GPL, but as Murdock himself had noted, the desire to treat GNU/Linux as a purely free software operating system was far from unanimous. By late 1993, the total GNU/Linux user population had grown from a dozen or so enthusiasts to somewhere between 20,000 and 100,000.~{ GNU/Linux user-population numbers are sketchy at best, which is why I've provided such a broad range. The 100,000 total comes from the Red Hat "Milestones" site, \\ http://www.redhat.com/about/corporate/milestones.html. }~ What had once been a hobby was now a marketplace ripe for exploitation, and some developers had no objection to exploiting it with non-free software. Like Winston Churchill watching Soviet troops sweep into Berlin, Stallman felt an understandable set of mixed emotions when it came time to celebrate the GNU/Linux "victory."~{ I wrote this Winston Churchill analogy before Stallman himself sent me his own unsolicited comment on Churchill: \\ World War II and the determination needed to win it was a very strong memory as I was growing up. Statements such as Churchill's, "We will fight them in the landing zones, we will fight them on the beaches... we will never surrender," have always resonated for me. }~
+
+Although late to the party, Stallman still had clout. As soon as the FSF announced that it would lend its money and moral support to Murdock's software project, other offers of support began rolling in. Murdock dubbed the new project Debian - a compression of his and his wife, Deborah's, names - and within a few weeks was rolling out the first distribution. "[Richard's support] catapulted Debian almost overnight from this interesting little project to something people within the community had to pay attention to," Murdock says.
+={Debian+19}
+
+In January of 1994, Murdock issued the
+/{Debian Manifesto}/. Written in the spirit of Stallman's /{GNU Manifesto}/ from a decade before, it explained the importance of working closely with the Free Software Foundation. Murdock wrote:
+={Debian Manifesto+3;Free Software Foundation (FSF):Debian Manifesto and;GNU Manifesto:Debian Manifesto and}
+
+_1 The Free Software Foundation plays an extremely important role in the future of Debian. By the simple fact that they will be distributing it, a message is sent to the world that Linux [sic] is not a commercial product and that it never should be, but that this does not mean that Linux will never be able to compete commercially. For those of you who disagree, I challenge you to rationalize the success of GNU Emacs and GCC, which are not commercial software but which have had quite an impact on the commercial market regardless of that fact.
+
+_1 The time has come to concentrate on the future of Linux[sic] rather than on the destructive goal of enriching one-self at the expense of the entire Linux community and its future. The development and distribution of Debian may not be the answer to the problems that I have outlined in the /{Manifesto}/, but I hope that it will at least attract enough attention to these problems to allow them to be solved.~{ See Ian Murdock, /{A Brief History of Debian}/, (January 6, 1994): Appendix A, "The Debian Manifesto," \\ http://www.debian.org/doc/manuals/project-history/ap-manifesto.en.html. }~
+
+Shortly after the /{Manifesto's}/ release, the Free Software Foundation made its first major request. Stallman wanted Murdock to call its distribution "GNU/Linux." At first, Stallman proposed the term "Lignux" - combining the names Linux and GNU - but the initial reaction was very negative, and this convinced Stallman to go with the longer but less criticized GNU/Linux.
+={Lignux (Linux with GNU)}
+
+Some dismissed Stallman's attempt to add the "GNU" prefix as a belated quest for credit, never mind whether it was due, but Murdock saw it differently. Looking back, Murdock saw it as an attempt to counteract the growing tension between the GNU Project's developers and those who adapted GNU programs to use with the Linux kernel. "There was a split emerging," Murdock recalls. "Richard was concerned."
+={C programming language:glibc+3;glibc (GNU C Library)+3;GNU C Library (glibc)+3}
+
+By 1990, each GNU program had a designated maintainer-in-charge. Some GNU programs could run on many different systems, and users often contributed changes to port them to another system. Often these users knew only that one system, and did not consider how to keep the code clean for other systems. To add support for the new system while keeping the code comprehensible, so it could be maintained reliably for all systems, then required rewriting much of the changes. The maintainer-in-charge had the responsibility to critique the changes and tell their user-authors how to redo parts of the port. Generally they were eager to do this so that their changes would be integrated into the standard version. Then the maintainer-in-charge would edit in there worked changes, and take care of them in future maintenance. For some GNU programs, this had happened dozens of times for dozens of different systems.
+
+The programmers who adapted various GNU programs to work with the kernel Linux followed this common path: they considered only their own platform. But when the maintainers-in-charge asked them to help clean up their changes for future maintenance, several of them were not interested. They did not care about doing the correct thing, or about facilitating future maintenance of the GNU packages they had adapted. They cared only about their own versions and were inclined to maintain them as forks.
+
+In the hacker world, forks are an interesting issue. Although the hacker ethic permits a programmer to do anything he wants with a given program's source code, it is considered correct behavior to offer to work with the original developer to maintain a joint version. Hackers usually find it useful, as well as proper, to pour their improvements into the program's principal version. A free software license gives every hacker the right to fork a program, and sometimes it is necessary, but doing so without need or cause is considered somewhat rude.
+={forks (code)+3;tree (source code)}
+
+As leader of the GNU Project, Stallman had already experienced the negative effects of a software fork in 1991. Says Stallman, "Lucid hired several people to write improvements to GNU Emacs, meant to be contributions to it; but the developers did not inform me about the project. Instead they designed several new features on their own. As you might expect, I agreed with some of their decisions and disagreed with others. They asked me to incorporate all their code, but when I said I wanted to use about half of it, they declined to help me adapt that half to work on its own. I had to do it on my own." The fork had given birth to a parallel version, Lucid Emacs, and hard feelings all around.~{ Jamie Zawinski, a former Lucid programmer who would go on to head the Mozilla development team, has a web site that documents the Lucid/GNU Emacs fork, titled, "The Lemacs/FSFmacs Schism.", at \\ http://www.jwz.org/doc/lemacs.html. Stallman's response to those accusations is in \\ http://stallman.org/articles/xemacs.origin. }~
+={Emacs text editor:Lucid software company and;GNU Emacs:Lucid software company and;Lucid software company}
+
+Now programmers had forked several of the principal GNU packages at once. At first, Stallman says he considered the forks to be a product of impatience. In contrast to the fast and informal dynamics of the Linux team, GNU source-code maintainers tended to be slower and more circumspect in making changes that might affect a program's long-term viability. They also were unafraid of harshly critiquing other people's code. Over time, however, Stallman began to sense that there was an underlying lack of awareness of the GNU Project and its objectives when reading Linux developers' emails.
+
+"We discovered that the people who considered themselves 'Linux users' didn't care about the GNU Project," Stallman says. "They said, 'Why should I bother doing these things? I don't care about the GNU Project. It [the program]'s working for me. It's working for us Linux users, and nothing else matters to us.' And that was quite surprising, given that people were essentially using a variant of the GNU system, and they cared so little. They cared less than anybody else about GNU." Fooled by their own practice of calling the combination "Linux," they did not realize that their system was more GNU than Linux.
+
+For the sake of unity, Stallman asked the maintainers-in-charge to do the work which normally the change authors should have done. In most cases this was feasible, but not in glibc. Short for GNU C Library, glibc is the package that all programs use to make "system calls" directed at the kernel, in this case Linux. User programs on a Unix-like system communicate with the kernel only through the C library.
+
+The changes to make glibc work as a communication channel between Linux and all the other programs in the system were major and ad-hoc, written without attention to their effect on other platforms. For the glibc maintainer-in-charge, the task of cleaning them up was daunting. Instead the Free Software Foundation paid him to spend most of a year reimplementing these changes from scratch, to make glibc version 6 work "straight out of the box" in GNU/Linux.
+
+Murdock says this was the precipitating cause that motivated Stallman to insist on adding the GNU prefix when Debian rolled out its software distribution. "The fork has since converged. Still, at the time, there was a concern that if the Linux community saw itself as a different thing as the GNU community, it might be a force for disunity."
+
+While some viewed it as politically grasping to describe the combination of GNU and Linux as a "variant" of GNU, Murdock, already sympathetic to the free software cause, saw Stallman's request to call Debian's version GNU/Linux as reasonable. "It was more for unity than for credit," he says.
+
+Requests of a more technical nature quickly followed. Although Murdock had been accommodating on political issues, he struck a firmer pose when it came to the design and development model of the actual software. What had begun as a show of solidarity soon became a running disagreement.
+
+"I can tell you that I've had my share of disagreements with him," says Murdock with a laugh. "In all honesty Richard can be a fairly difficult person to work with." The principal disagreement was over debugging. Stallman wanted to include debugging information in all executable programs, to enable users to immediately investigate any bugs they might encounter. Murdock thought this would make the system files too big and interfere with distribution. Neither was willing to change his mind.
+
+In 1996, Murdock, following his graduation from Purdue, decided to hand over the reins of the growing Debian project. He had already been ceding management duties to Bruce Perens, the hacker best known for his work on Electric Fence, a Unix utility released under the GPL. Perens, like Murdock, was a Unix programmer who had become enamored of GNU/Linux as soon as the operating system's Unix-like abilities became manifest. Like Murdock, Perens sympathized with the political agenda of Stallman and the Free Software Foundation, albeit from afar.
+={Electric Fence Unix utility; Perens, Bruce+3}
+
+"I remember after Stallman had already come out with the /{GNU Manifesto}/, GNU Emacs, and GCC, I read an article that said he was working as a consultant for Intel," says Perens, recalling his first brush with Stallman in the late 1980s. "I wrote him asking how he could be advocating free software on the one hand and working for Intel on the other. He wrote back saying, 'I work as a consultant to produce free-software.' He was perfectly polite about it, and I thought his answer made perfect sense."
+
+As a prominent Debian developer, however, Perens regarded Murdock's design battles with Stallman with dismay. Upon assuming leadership of the development team, Perens says he made the command decision to distance Debian from the Free Software Foundation. "I decided we did not want Richard's style of micro-management," he says.
+
+According to Perens, Stallman was taken aback by the decision but had the wisdom to roll with it. "He gave it some time to cool off and sent a message that we really needed a relationship. He requested that we call it GNU/Linux and left it at that. I decided that was fine. I made the decision unilaterally. Everybody breathed a sigh of relief."
+
+Over time, Debian would develop a reputation as the hacker's version of GNU/Linux, alongside Slackware, another popular distribution founded during the same 1993-1994 period. However, Slackware contained some non-free programs, and Debian after its separation from GNU began distributing non-free programs too.~{ Debian Buzz in June 1996 contained non-free Netscape 3.01 in its Contrib section. }~ Despite labeling them as "non-free" and saying that they were "not officially part of Debian," proposing these programs to the user implied a kind of endorsement for them. As the GNU Project became aware of these policies, it came to recognize that neither Slackware nor Debian was a GNU/Linux distro it could recommend to the public.
+={Gilmore, John; Young, Robert+2;Red Hat Inc.;Teimann, Michael;Slackware}
+
+Outside the realm of hacker-oriented systems, however, GNU/Linux was picking up steam in the commercial Unix marketplace. In North Carolina, a Unix company billing itself as Red Hat was revamping its business to focus on GNU/Linux. The chief executive officer was Robert Young, the former /{Linux Journal}/ editor who in 1994 had put the question to Linus Torvalds, asking whether he had any regrets about putting the kernel under the GPL. To Young, Torvalds' response had a "profound" impact on his own view toward GNU/Linux. Instead of looking for a way to corner the GNU/Linux market via traditional software tactics, Young began to consider what might happen if a company adopted the same approach as Debian - i.e., building an operating system completely out of free software parts. Cygnus Solutions, the company founded by Michael Tiemann and John Gilmore in 1990, was already demonstrating the ability to sell free software based on quality and customizability. What if Red Hat took the same approach with GNU/Linux?
+
+"In the western scientific tradition we stand on the shoulders of giants," says Young, echoing both Torvalds and Sir Isaac Newton before him. "In business, this translates to not having to reinvent wheels as we go along. The beauty of [the GPL] model is you put your code into the public domain.~{ Young uses the term "public domain" loosely here. Strictly speaking, it means "not copyrighted." Code released under the GNU GPL cannot be in the public domain, since it must be copyrighted in order for the GNU GPL to apply. }~ If you're an independent software vendor and you're trying to build some application and you need a modem-dialer, well, why reinvent modem dialers? You can just steal PPP off of Red Hat [GNU/]Linux and use that as the core of your modem-dialing tool. If you need a graphic tool set, you don't have to write your own graphic library. Just download GTK. Suddenly you have the ability to reuse the best of what went before. And suddenly your focus as an application vendor is less on software management and more on writing the applications specific to your customer's needs." However, Young was no free software activist, and readily included non-free programs in Red Hat's GNU/Linux system.
+
+Young wasn't the only software executive intrigued by the business efficiencies of free software. By late 1996, most Unix companies were starting to wake up and smell the brewing source code. The GNU/Linux sector was still a good year or two away from full commercial breakout mode, but those close enough to the hacker community could feel it: something big was happening. The Intel 386 chip, the Internet, and the World Wide Web had hit the marketplace like a set of monster waves; free software seemed like the largest wave yet.
+
+For Ian Murdock, the wave seemed both a fitting tribute and a fitting punishment for the man who had spent so much time giving the free software movement an identity. Like many Linux aficionados, Murdock had seen the original postings. He'd seen Torvalds' original admonition that Linux was "just a hobby." He'd also seen Torvalds' admission to Minix creator Andrew Tanenbaum: "If the GNU kernel had been ready last spring, I'd not have bothered to even start my project."~{ This quote is taken from the much publicized Torvalds-Tanenbaum "flame war" following the initial release of Linux. In the process of defending his choice of a non-portable monolithic kernel design, Torvalds says he started working on Linux as a way to learn more about his new 386 PC. "If the GNU kernel had been ready last spring, I'd not have bothered to even start my project." See Chris DiBona et al., /{Open Sources}/ (O'Reilly & Associates, Inc., 1999): 224. }~ Like many, Murdock knew that some opportunities had been missed. He also knew the excitement of watching new opportunities come seeping out of the very fabric of the Internet.
+={Tanenbaum, Andrew}
+
+"Being involved with Linux in those early days was fun," recalls Murdock. "At the same time, it was something to do, something to pass the time. If you go back and read those old [comp.os.minix]exchanges, you'll see the sentiment: this is something we can play with until the Hurd is ready. People were anxious. It's funny, but in a lot of ways, I suspect that Linux would never have happened if the Hurd had come along more quickly."
+
+By the end of 1996, however, such "what if" questions were already moot, because Torvalds' kernel had gained a critical mass of users. The 36-month window had closed, meaning that even if the GNU Project had rolled out its Hurd kernel, chances were slim anybody outside the hard-core hacker community would have noticed. Linux, by filling the GNU system's last gap, had achieved the GNU Project's goal of producing a Unix-like free software operating system. However, most of the users did not recognize what had happened: they thought the whole system was Linux, and that Torvalds had done it all. Most of them installed distributions that came with non-free software; with Torvalds as their ethical guide, they saw no principled reason to reject it. Still, a precarious freedom was available for those that appreciated it.
+={HURD kernel}
+
+1~ Chapter 11 - Open Source
+={GNU Project:open source movement and+59;open source+59;Stallman, Richard M.:open source and+59}
+
+[RMS: In this chapter only, I have deleted some quotations. The material deleted was about open source and didn't relate to my life or my work.]
+
+In November, 1995, Peter Salus, a member of the Free Software Foundation and author of the 1994 book, /{A Quarter Century of Unix}/, issued a call for papers to members of the GNU Project's "system-discuss" mailing list. Salus, the conference's scheduled chairman, wanted to tip off fellow hackers about the upcoming Conference on Freely Redistributable Software in Cambridge, Massachusetts. Slated for February, 1996, and sponsored by the Free Software Foundation, the event promised to be the first engineering conference solely dedicated to free software and, in a show of unity with other free software programmers, welcomed papers on "any aspect of GNU, Linux, NetBSD, 386BSD, FreeBSD, Perl, Tcl/tk, and other tools for which the code is accessible and redistributable." Salus wrote:
+={Free Software Foundation (FSF);FSF (Free Software Foundation);FreeBSD;Conference on Freely Redistributable Software+1;Linux;NetBSD;Perl programming language;386BSD;Salus, Peter+4}
+
+_1 Over the past 15 years, free and low-cost software has become ubiquitous. This conference will bring together implementers of several different types of freely redistributable software and publishers of such software (on various media). There will be tutorials and refereed papers, as well as keynotes by Linus Torvalds and Richard Stallman.~{ See Peter Salus, "FYI-Conference on Freely Redistributable Software, 2/2, Cambridge" (1995) (archived by Terry Winograd), \\ http://bat8.inria.fr/~lang/hotlist/free/licence/fsf96/call-for-papers.html. }~
+
+Among the recipients of Salus' email was conference committee member Eric S. Raymond. Although not the leader of a project or company like the various other members of the list, Raymond had built a tidy reputation within the hacker community for some software projects and as editor of /{The New Hacker's Dictionary}/, a greatly enlarged version of /{The Hacker's Dictionary}/ published a decade earlier by Guy Steele.
+={New Hacker Dictionary, The;Raymond, Eric:open source and+56}
+
+For Raymond, the 1996 conference was a welcome event. Although he did not thoroughly support the free software movement's ideas, he had contributed to some GNU programs, in particular to GNU Emacs. Those contributions stopped in 1992, when Raymond demanded authority to make changes in the official GNU version of GNU Emacs without discussing them with Stallman, who was directly in charge of Emacs development. Stallman rejected the demand, and Raymond accused Stallman of "micro-management." "Richard kicked up a fuss about my making unauthorized modifications when I was cleaning up the Emacs LISP libraries," Raymond recalls. "It frustrated me so much that I decided I didn't want to work with him anymore."
+
+Despite the falling out, Raymond remained active in the free software community. So much so that when Salus suggested a conference pairing Stallman and Torvalds as keynote speakers, Raymond eagerly seconded the idea. With Stallman representing the older, wiser contingent of ITS/Unix hackers and Torvalds representing the younger, more energetic crop of Linux hackers, the pairing indicated a symbolic show of unity that could only be beneficial, especially to ambitious younger (i.e., below 40) hackers such as Raymond. "I sort of had afoot in both camps," Raymond says.
+
+By the time of the conference, the tension between those two camps had become palpable. Both groups had one thing in common, though:the conference was their first chance to meet the Finnish /{wunderkind}/ in the flesh. Surprisingly, Torvalds proved himself to be a charming, affable speaker. Possessing only a slight Swedish accent, Torvalds surprised audience members with his quick, self-effacing wit.~{ Although Linus Torvalds is Finnish, his mother tongue is Swedish. "The Rampantly Unofficial Linus FAQ" at \\ http://catb.org/~esr/faqs/linus/ offers a brief explanation:Finland has a significant (about 6%) Swedish-speaking minority population. They call themselves finlands svensk or finlands svenskar and consider themselves Finns; many of their families have lived in Finland for centuries. Swedish is one of Finland's two official languages. }~
+
+Even more surprising, says Raymond, was Torvalds' equal willingness to take potshots at other prominent hackers, including the most prominent hacker of all, Richard Stallman. By the end of the conference, Torvalds' half-hacker, half-slacker manner was winning over older and younger conference-goers alike.
+
+"It was a pivotal moment," recalls Raymond. "Before 1996, Richard was the only credible claimant to being the ideological leader of the entire culture. People who dissented didn't do so in public. The person who broke that taboo was Torvalds."
+
+The ultimate breach of taboo would come near the end of the show. During a discussion on the growing market dominance of Microsoft Windows or some similar topic, Torvalds admitted to being a fan of Microsoft's PowerPoint slideshow software program. From the perspective of old-line software purists, it was like bragging about one's slaves at an abolitionist conference. From the perspective of Torvalds and his growing band of followers, it was simply common sense. Why shun convenient proprietary software programs just to make a point? They didn't agree with the point anyway. When freedom requires a sacrifice, those who don't care about freedom see the sacrifice as self-denial, rather than as a way to obtain something important. Being a hacker wasn't about self-denial, it was about getting the job done, and "the job," for them, was defined in practical terms.
+={Windows (Microsoft);Microsoft Corporation+3;PowerPoint (Microsoft)+3;proprietary software:Torvalds, Linus and;Torvalds, Linus:PowerPoint and+3}
+
+"That was a pretty shocking thing to say," Raymond remembers. "Then again, he was able to do that, because by 1995 and 1996, he was rapidly acquiring clout."
+
+Stallman, for his part, doesn't remember any tension at the 1996conference; he probably wasn't present when Torvalds made that statement. But he does remember later feeling the sting of Torvalds' celebrated "cheekiness." "There was a thing in the Linux documentation which says print out the GNU coding standards and then tear them up," says Stallman, recalling one example. "When you look closely, what he disagreed with was the least important part of it, the recommendation for how to indent C code."
+
+"OK, so he disagrees with some of our conventions. That's fine, bu the picked a singularly nasty way of saying so. He could have just said,'Here's the way I think you should indent your code.' Fine. There should be no hostility there."
+
+For Raymond, the warm reception other hackers gave to Torvalds' comments confirmed a suspicion: the dividing line separating Linux developers from GNU developers was largely generational. Many Linux hackers, like Torvalds, had grown up in a world of proprietary software. They had begun contributing to free software without perceiving any injustice in non-free software. For most of them, nothing was at stake beyond convenience. Unless a program was technically inferior, they saw little reason to reject it on licensing issues alone. Some day hackers might develop a free software alternative to PowerPoint. Until then, why criticize PowerPoint or Microsoft; why not use it?
+
+This was an example of the growing dispute, within the free software community, between those who valued freedom as such, and those who mainly valued powerful, reliable software. Stallman referred to the two camps as political parties within the community, calling the former the "freedom party." The supporters of the other camp did not try to name it, so Stallman disparagingly called it the "bandwagon party" or the "success party," because many of them presented "more users" as the primary goal.
+
+In the decade since launching the GNU Project, Stallman had built up a fearsome reputation as a programmer. He had also built up a reputation for intransigence both in terms of software design and people management. This was partly true, but the reputation provided a convenient excuse that anyone could cite if Stallman did not do as he wished. The reputation has been augmented by mistaken guesses.
+
+For example, shortly before the 1996 conference, the Free Software Foundation experienced a full-scale staff defection. Brian Youmans, a current FSF staffer hired by Salus in the wake of the resignations, recalls the scene: "At one point, Peter [Salus] was the only staff member working in the office." The previous staff were unhappy with the executive director; as Bryt Bradley told her friends in December, 1995:
+
+_1 [name omitted] (the Executive Director of the FSF) decided to come back from Medical/Political Leave last week. The office staff (Gena Bean, Mike Drain, and myself) decided we could not work with her as our supervisor because of the many mistakes she had made in her job tasks prior to her taking a leave. Also, there had been numerous instances where individuals were threatened with inappropriate firing and there were many instances of what we felt were verbal abuse from her to ALL members of the office staff. We requested (many times) that she not come back as our supervisor, but stated that we were willing to work with her as a co-worker. Our requests were ignored. We quit.
+
+The executive director in question then gave Stallman an ultimatum: give her total autonomy in the office or she would quit. Stallman, as president of the FSF, declined to give her total control over its activities, so she resigned, and he recruited in Peter Salus to replace her.
+
+When Raymond, an outsider, learned that these people had left the FSF, he presumed Stallman was at fault. This provided confirmation for his theory that Stallman's personality was the cause of any and all problems in the GNU Project.
+
+Raymond had another theory: recent delays such as the Hurd and recent troubles such as the Lucid-Emacs schism reflected problems normally associated with software project management, not software code development.
+
+Shortly after the Freely Redistributable Software Conference, Raymond began working on his own pet software project, a mail utility called "fetchmail." Taking a cue from Torvalds, Raymond issued his program with a tacked-on promise to update the source code as early and as often as possible. When users began sending in bug reports and feature suggestions, Raymond, at first anticipating a tangled mess, found the resulting software surprisingly sturdy. Analyzing the success of the Torvalds approach, Raymond issued a quick analysis: using the Internet as his "petri dish" and the harsh scrutiny of the hacker community as a form of natural selection, Torvalds had created an evolutionary model free of central planning.
+={fetchmail;FreeBSD;Conference on Freely Redistributable Software;Internet}
+
+What's more, Raymond decided, Torvalds had found a way around Brooks' Law. First articulated by Fred P. Brooks, manager of IBM's OS/360 project and author of the 1975 book, /{The Mythical Man-Month}/, Brooks' Law held that adding developers to a project only resulted in further project delays. Believing as most hackers that software, like soup, benefits from a limited number of cooks, Raymond sensed something revolutionary at work. In inviting more and more cooks into the kitchen, Torvalds had actually found a way to make the resulting software /{better}/.~{ Brooks' Law is the shorthand summary of the following quote taken from Brooks' book:Since software construction is inherently a systems effort - an exercise in complex interrelationships - communication effort is great, and it quickly dominates the decrease in individual task time brought about by partitioning. Adding more men then lengthens, not shortens, the schedule. See Fred P. Brooks, The Mythical Man-Month (Addison Wesley Publishing, 1995). }~
+={Brooks, Fred P.;Mythical Man-Month, The (Brooks)}
+
+Raymond put his observations on paper. He crafted them into a speech, which he promptly delivered before a group of friends and neighbors in Chester County, Pennsylvania. Dubbed "The Cathedral and the Bazaar," the speech contrasted the "Bazaar" style originated by Torvalds with the "Cathedral" style generally used by everyone else.
+={Cathedral and the Bazaar, The (Raymond)+10;Linux Kongress+6}
+
+Raymond says the response was enthusiastic, but not nearly as enthusiastic as the one he received during the 1997 Linux Kongress, a gathering of GNU/Linux users in Germany the next spring.
+
+"At the Kongress, they gave me a standing ovation at the end of the speech," Raymond recalls. "I took that as significant for two reasons. For one thing, it meant they were excited by what they were hearing. For another thing, it meant they were excited even after hearing the speech delivered through a language barrier."
+
+Eventually, Raymond would convert the speech into a paper, also titled "The Cathedral and the Bazaar." The paper drew its name from Raymond's central analogy. Previously, programs were "cathedrals," impressive, centrally planned monuments built to stand the test of time. Linux, on the other hand, was more like "a great babbling bazaar," a software program developed through the loose decentralizing dynamics of the Internet.
+
+Raymond's paper associated the Cathedral style, which he and Stallman and many others had used, specifically with the GNU Project and Stallman, thus casting the contrast between development models as a comparison between Stallman and Torvalds. Where Stallman was his chosen example of the classic cathedral architect - i.e., a programming "wizard" who could disappear for 18 months and return with something like the GNU C Compiler - Torvalds was more like a genial dinner-party host. In letting others lead the Linux design discussion and stepping in only when the entire table needed a referee, Torvalds had created a development model very much reflective of his own laid-back personality. From Torvalds' perspective, the most important managerial task was not imposing control but keeping the ideas flowing.
+
+Summarized Raymond, "I think Linus's cleverest and most consequential hack was not the construction of the Linux kernel itself, but rather his invention of the Linux development model."~{ See Eric Raymond, "The Cathedral and the Bazaar" (1997). }~
+
+If the paper's description of these two styles of development was perceptive, its association of the Cathedral model specifically with Stallman (rather than all the others who had used it, including Raymond himself) was sheer calumny. In fact, the developers of some GNU packages including the GNU Hurd had read about and adopted Torvalds' methods before Raymond tried them, though without analyzing them further and publicly championing them as Raymond's paper did. Thousands of hackers, reading Raymond's article, must have been led to a negative attitude towards GNU by this smear.
+
+In summarizing the secrets of Torvalds' managerial success, Raymond attracted the attention of other members of the free software community for whom freedom was not a priority. They sought to interest business in the use and development of free software, and to do so, decided to cast the issue in terms of the values that appeal to business: powerful, reliable, cheap, advanced. Raymond became the best-known proponent of these ideas, and they reached the management of Netscape, whose proprietary browser was losing market share to Microsoft's equally proprietary Internet Explorer. Intrigued by a speech by Raymond, Netscape executives took the message back to corporate headquarters. A few months later, in January, 1998, the company announced its plan to publish the source code of its flagship Navigator web browser in the hopes of enlisting hacker support in future development.
+={Netscape+8;source code:Netscape+4}
+
+% ={Monterey (California);O'Reilly, Tim;O'Reilly & Associates}
+% ={Apache web server;BIND (Berkely Internet Naming Daemon);Berkely Internet Naming Daemon (BIND);Wall, Larry;Perl programming language;Python programming language;sendmail Unix mail program}
+% ={Mountain View (California);Netscape+8}
+
+When Netscape CEO Jim Barksdale cited Raymond's "Cathedral and the Bazaar" essay as a major influence upon the company's decision, the company instantly elevated Raymond to the level of hacker celebrity. He invited a few people including Larry Augustin, founder of VA Research which sold workstations with the GNU/Linux operating system pre-installed; Tim O'Reilly, founder of the publisher O'Reilly& Associates; and Christine Peterson, president of the Foresight Institute, a Silicon Valley think tank specializing in nano technology, to talk. "The meeting's agenda boiled down to one item: how to take advantage of Netscape's decision so that other companies might follow suit?"
+={Augustin, Larry;Foresight Institute;VA Research;Peterson, Christine+4;Barksdale, Jim}
+
+Raymond doesn't recall the conversation that took place, but he does remember the first complaint addressed. Despite the best efforts of Stallman and other hackers to remind people that the word "free" in free software stood for freedom and not price, the message still wasn't getting through. Most business executives, upon hearing the term for the first time, interpreted the word as synonymous with "zero cost," tuning out any follow-up messages in short order. Until hackers found a way to get past this misunderstanding, the free software movement faced an uphill climb, even after Netscape.
+
+Peterson, whose organization had taken an active interest in advancing the free software cause, offered an alternative: "open source."
+
+Looking back, Peterson says she came up with the "open source" term while discussing Netscape's decision with a friend in the public relations industry. She doesn't remember where she came upon the term or if she borrowed it from another field, but she does remember her friend disliking the term.~{ See Malcolm Maclachlan, "Profit Motive Splits Open Source Movement," Tech-Web News (August 26, 1998), \\ http://www.techweb.com/article/showArticle?articleID=29102344. }~
+
+At the meeting, Peterson says, the response was dramatically different. "I was hesitant about suggesting it," Peterson recalls. "I had no standing with the group, so started using it casually, not highlighting it as a new term." To Peterson's surprise, the term caught on. By the end of the meeting, most of the attendees, including Raymond, seemed pleased by it.
+
+Raymond says he didn't publicly use the term "open source" as a substitute for "free software" until a day or two after the Mozilla launch party, when O'Reilly had scheduled a meeting to talk about free-software. Calling his meeting "the Freeware Summit," O'Reilly says he wanted to direct media and community attention to the other deserving projects that had also encouraged Netscape to release Mozilla. "All these guys had so much in common, and I was surprised they didn't all know each other," says O'Reilly. "I also wanted to let the world know just how great an impact the free software culture had already made. People were missing out on a large part of the free-software tradition."
+={Freeware Summit;O'Reilly, Tim:open source and+8}
+
+In putting together the invite list, however, O'Reilly made a decision that would have long-term political consequences. He decided to limit the list to west-coast developers such as Wall, Eric Allman, creator of send mail, and Paul Vixie, creator of BIND. There were exceptions, of course: Pennsylvania-resident Raymond, who was already in town thanks to the Mozilla launch, earned an quick invite. So did Virginia-resident Guido van Rossum, creator of Python. "Frank Willison, my editor in chief and champion of Python within the company, invited him without first checking in with me," O'Reilly recalls. "I was happy to have him there, but when I started, it really was just a local gathering."
+={van Rossum, Guido;Python programming language;BIND (Berkely Internet Naming Daemon);Berkely Internet Naming Daemon (BIND);Wall, Larry;Perl programming language;Python programming language;sendmail Unix mail program}
+
+For some observers, the unwillingness to include Stallman's name on the list qualified as a snub. "I decided not to go to the event because of it," says Perens, remembering the summit. Raymond, who did go, says he argued for Stallman's inclusion to no avail. The snub rumor gained additional strength from the fact that O'Reilly, the event's host, had feuded publicly with Stallman over the issue of software-manual copyrights. Prior to the meeting, Stallman had argued that free software manuals should be as freely copyable and modifiable as free software programs. O'Reilly, meanwhile, argued that a value-added market for non-free books increased the utility of free software by making it more accessible to a wider community. The two had also disputed the title of the event, with Stallman insisting on "Free Software" rather than "Freeware." The latter term most often refers to programs which are available gratis, but which are not free software because their source code is not released.
+
+Looking back, O'Reilly doesn't see the decision to leave Stallman's name off the invite list as a snub. "At that time, I had never met Richard in person, but in our email interactions, he'd been inflexible and unwilling to engage in dialogue. I wanted to make sure the GNU tradition was represented at the meeting, so I invited John Gilmore and Michael Tiemann, whom I knew personally, and whom I knew were passionate about the value of the GPL but seemed more willing to engage in a frank back-and-forth about the strengths and weaknesses of the various free software projects and traditions. Given all the later brouhaha, I do wish I'd invited Richard as well, but I certainly don't think that my failure to do so should be interpreted as a lack of respect for the GNU Project or for Richard personally."
+={Gilmore, John;Tiemann, Michael+7}
+
+Snub or no snub, both O'Reilly and Raymond say the term "open-source" won over just enough summit-goers to qualify as a success. The attendees shared ideas and experiences and brainstormed on how to improve free software's image. Of key concern was how to point out the successes of free software, particularly in the realm of Internet infrastructure, as opposed to playing up the GNU/Linux challenge to Microsoft Windows. But like the earlier meeting at VA, the discussion soon turned to the problems associated with the term "free software." O'Reilly, the summit host, remembers a comment from Torvalds, a summit attendee.
+
+"Linus had just moved to Silicon Valley at that point, and he explained how only recently that he had learned that the word 'free' had two meanings - free as in 'libre' and free as in 'gratis' - in English."
+
+Michael Tiemann, founder of Cygnus, proposed an alternative to the troublesome "free software" term: sourceware. "Nobody got too excited about it," O'Reilly recalls. "That's when Eric threw out the term 'open source.'"
+
+Although the term appealed to some, support for a change in offcial terminology was far from unanimous. At the end of the one-day conference, attendees put the three terms - free software, open source, or sourceware - to a vote. According to O'Reilly, 9 out of the 15 attendees voted for "open source." Although some still quibbled with the term, all attendees agreed to use it in future discussions with the press. "We wanted to go out with a solidarity message," O'Reilly says.
+
+The term didn't take long to enter the national lexicon. Shortly after the summit, O'Reilly shepherded summit attendees to a press conference attended by reporters from the /{New York Times}/, the /{Wall Street Journal}/, and other prominent publications. Within a few months, Torvalds' face was appearing on the cover of /{Forbes}/ magazine, with the faces of Stallman, Perl creator Larry Wall, and Apache team leader Brian Behlendorf featured in the interior spread. Open source was open for business.
+={Wall, Larry}
+
+For summit attendees such as Tiemann, the solidarity message was the most important thing. Although his company had achieved a fair amount of success selling free software tools and services, he sensed the difficulty other programmers and entrepreneurs faced.
+
+"There's no question that the use of the word free was confusing in a lot of situations," Tiemann says. "Open source positioned itself as being business friendly and business sensible. Free software positioned itself as morally righteous. For better or worse we figured it was more advantageous to align with the open source crowd.
+
+Raymond called Stallman after the meeting to tell him about the new term "open source" and ask if he would use it. Raymond says Stallman briefly considered adopting the term, only to discard it. "I know because I had direct personal conversations about it," Raymond says.
+
+Stallman's immediate response was, "I'll have to think about it." The following day he had concluded that the values of Raymond and O'Reilly would surely dominate the future discourse of "open source," and that the best way to keep the ideas of the free software movement in public view was to stick to its traditional term.
+
+Later in 1998, Stallman announced his position: "open source," while helpful in communicating the technical advantages of free software also encouraged speakers to soft-pedal the issue of software freedom. It avoided the unintended meaning of "gratis software" and the intended meaning of "freedom-respecting software" equally. As a means for conveying the latter meaning, it was therefore no use. In effect, Raymond and O'Reilly had given a name to the non-idealistic political party in the community, the one Stallman did not agree with.
+
+In addition, Stallman thought that the ideas of "open source" led people to put too much emphasis on winning the support of business. While such support in itself wasn't necessarily bad in itself, he expected that being too desperate for it would lead to harmful compromises. "Negotiation 101 would teach you that if you are desperate to get someone's agreement, you are asking for a bad deal," he says. "You need to be prepared to say no." Summing up his position at the 1999 LinuxWorld Convention and Expo, an event billed by Torvalds himself as a "coming out party" for the "Linux" community, Stallman implored his fellow hackers to resist the lure of easy compromise.
+={LinuxWorld Conventions+2}
+
+"Because we've shown how much we can do, we don't have to be desperate to work with companies or compromise our goals," Stallman said during a panel discussion. "Let them offer and we'll accept. We don't have to change what we're doing to get them to help us. You can take a single step towards a goal, then another and then more and more and you'll actually reach your goal. Or, you can take a half measure that means you don't ever take another step, and you'll never get there."
+
+Even before the LinuxWorld show, however, Stallman was showing an increased willingness to alienate open source supporters. A few months after the Freeware Summit, O'Reilly hosted its second annual Perl Conference. This time around, Stallman was in attendance. During a panel discussion lauding IBM's decision to employ the free software Apache web server in its commercial offerings, Stallman, taking advantage of an audience microphone, made a sharp denunciation of panelist John Ousterhout, creator of the Tcl scripting language. Stallman branded Ousterhout a "parasite" on the free software community for marketing a proprietary version of Tcl via Ousterhout's startup company, Scriptics. Ousterhout had stated that Scriptics would contribute only the barest minimum of its improvements to the free version of Tcl, meaning it would in effect use that small contribution to win community approval for much a larger amount of non-free software development. Stallman rejected this position and denounced Scriptics' plans. "I don't think Scriptics is necessary for the continued existenceof Tcl," Stallman said to hisses from the fellow audience members.~{ Ibid. }~
+={Apache web server;IBM:Apache web server and;Ousterhout, John;Tcl scripting language+1;Scriptics}
+
+"It was a pretty ugly scene," recalls Prime Time Freeware's Rich Morin. "John's done some pretty respectable things: Tcl, Tk, Sprite. He's a real contributor." Despite his sympathies for Stallman and Stallman's position, Morin felt empathy for those troubled by Stallman's discordant words.
+={Morin, Rich+1;Prime Time Freeware;Sprite}
+
+Stallman will not apologize. "Criticizing proprietary software isn't ugly - proprietary software is ugly. Ousterhout had indeed made real contributions in the past, but the point is that Scriptics was going to be nearly 100% a proprietary software company. In that conference, standing up for freedom meant disagreeing with nearly everyone. Speaking from the audience, I could only say a few sentences. The only way to raise the issue so it would not be immediately forgotten was to put it in strong terms."
+
+"If people rebuke me for 'making a scene' when I state a serious criticism of someone's conduct, while calling Torvalds 'cheeky' for saying nastier things about trivial matters, that seems like a double standard to me."
+
+Stallman's controversial criticism of Ousterhout momentarily alienated a potential sympathizer, Bruce Perens. In 1998, Eric Raymond proposed launching the Open Source Initiative, or OSI, an organization that would police the use of the term "open source" and provide a definition for companies interested in making their own programs. Raymond recruited Perens to draft the definition.~{ See Bruce Perens et al., "The Open Source Definition," The Open Source Initiative (1998), \\ http://www.opensource.org/docs/definition.html. }~
+={OSI (Open Source Initiative);Open Source Initiative (OSI);Perens, Bruce+1}
+
+Perens would later resign from the OSI, expressing regret that the organization had set itself up in opposition to Stallman and the FSF. Still, looking back on the need for a free software definition outside the Free Software Foundation's auspices, Perens understands why other hackers might still feel the need for distance. "I really like and admire Richard," says Perens. "I do think Richard would do his job better if Richard had more balance. That includes going away from free-software for a couple of months."
+
+Stallman's energies would do little to counteract the public-relations momentum of open source proponents. In August of 1998, when chip-maker Intel purchased a stake in GNU/Linux vendor Red Hat, an accompanying /{New York Times}/ article described the company as the product of a movement "known alternatively as free software and opensource."~{ See Amy Harmon, "For Sale: Free Operating System," New York Times (September 28, 1998), \\ http://www.nytimes.com/library/tech/98/09/biztech/articles/28linux.html. }~ Six months later, a John Markoff article on Apple Computerwas proclaiming the company's adoption of the "open source" Apache server in the article headline.~{ See John Markoff, "Apple Adopts 'Open Source' for its Server Computers," New York Times (March 17, 1999), \\ http://www.nytimes.com/library/tech/99/03/biztech/articles/17apple.html. }~
+={Apache web server;Apple Computers:open source software and;Intel;Markoff, John;Red Hat Inc.:success of+1}
+
+Such momentum would coincide with the growing momentum of companies that actively embraced the "open source" term. By August of 1999, Red Hat, a company that now eagerly billed itself as "opensource," was selling shares on Nasdaq. In December, VA Linux -formerly VA Research - was floating its own IPO to historic effect. Opening at $30 per share, the company's stock price exploded past the $300 mark in initial trading only to settle back down to the $239 level. Shareholders lucky enough to get in at the bottom and stay until the end experienced a 698% increase in paper wealth, a Nasdaq record. Eric Raymond, as a board member, owned shares worth $36 million. However, these high prices were temporary; they tumbled when the dot-com boom ended.
+={VA Linux+1;VA Research}
+
+The open source proponents' message was simple: all you need, to sell the free software concept, is to make it business-friendly. They saw Stallman and the free software movement as fighting the market;they sought instead to leverage it. Instead of playing the role of high-school outcasts, they had played the game of celebrity, magnifying their power in the process.
+
+These methods won great success for open source, but not for the ideals of free software. What they had done to "spread the message" was to omit the most important part of it: the idea of freedom as an ethical issue. The effects of this omission are visible today: as of 2009, nearly all GNU/Linux distributions include proprietary programs, Torvalds' version of Linux contains proprietary firmware programs, and the company formerly called VA Linux bases its business on proprietary software. Over half of all the world's web servers run some version of Apache, and the usual version of Apache is free software, but many of those sites run a proprietary modified version distributed by IBM.
+
+"On his worst days Richard believes that Linus Torvalds and I conspired to hijack his revolution," Raymond says. "Richard's rejection of the term open source and his deliberate creation of an ideological fissure in my view comes from an odd mix of idealism and territoriality. There are people out there who think it's all Richard's personal ego. I don't believe that. It's more that he so personally associates himself with the free software idea that he sees any threat to that as a threat to himself."
+
+Stallman responds, "Raymond misrepresents my views: I don't think Torvalds 'conspired' with anyone, since being sneaky is not his way. However, Raymond's nasty conduct is visible in those statements themselves. Rather than respond to my views (even as he claims they are) on their merits, he proposes psychological interpretations for them. He attributes the harshest interpretation to unnamed others, then 'defends' me by proposing a slightly less derogatory one. He has often 'defended' me this way."
+
+Ironically, the success of open source and open source advocates such as Raymond would not diminish Stallman's role as a leader - but it would lead many to misunderstand what he is a leader of. Since the free software movement lacks the corporate and media recognition of open source, most users of GNU/Linux do not hear that it exists, let alone what its views are. They have heard the ideas and values of opensource, and they never imagine that Stallman might have different ones. Thus he receives messages thanking him for his advocacy of "open source," and explains in response that he has never been a supporter of that, using the occasion to inform the sender about free-software.
+
+Some writers recognize the term "free software" by using the term "FLOSS," which stands for "Free/Libre and Open Source Software." However, they often say there is a single "FLOSS" movement, which is like saying that the U.S. has a "Liberal/Conservative" movement, and the views they usually associate with this supposed single movement are the open source views they have heard.
+
+Despite all these obstacles, the free software movement does make its ideas heard sometimes, and continues to grow in absolute terms. By sticking to its guns, and presenting its ideas in contrast to those of open source, it gains ground. "One of Stallman's primary character traits is the fact he doesn't budge," says Ian Murdock. "He'll wait up to a decade for people to come around to his point of view if that's what it takes."
+
+Murdock, for one, finds that un-budgeable nature both refreshing and valuable. Stallman may no longer be the solitary leader of the free software movement, but he is still the polestar of the free software community. "You always know that he's going to be consistent in his views," Murdock says. "Most people aren't like that. Whether you agree with him or not, you really have to respect that."
+
+1~ Chapter 12 - A Brief Journey through Hacker Hell
+
+[RMS: In this chapter my only change is to add a few notes labeled like this one.]
+
+Richard Stallman stares, unblinking, through the windshield of a rental car, waiting for the light to change as we make our way through downtown Kihei.
+={Kihei (Hawaii)+15}
+
+The two of us are headed to the nearby town of Pa'ia, where we are scheduled to meet up with some software programmers and their wives for dinner in about an hour or so.
+={Pa'ia (Hawaii)+2}
+
+It's about two hours after Stallman's speech at the Maui High Performance Center, and Kihei, a town that seemed so inviting before the speech, now seems profoundly uncooperative. Like most beach cities, Kihei is a one-dimensional exercise in suburban sprawl. Driving down its main drag, with its endless succession of burger stands, realty agencies, and bikini shops, it's hard not to feel like a steel-coated morsel passing through the alimentary canal of a giant commercial tapeworm. The feeling is exacerbated by the lack of side roads. With nowhere to go but forward, traffic moves in spring-like lurches. 200 yards ahead, a light turns green. By the time we are moving, the light is yellow again.
+
+For Stallman, a lifetime resident of the east coast, the prospect of spending the better part of a sunny Hawaiian afternoon trapped in slow traffic is enough to trigger an embolism. [RMS: Since I was driving, I was also losing time to answer my email, and that's a real pain since I can barely keep up anyway.] Even worse is the knowledge that, with just a few quick right turns a quarter mile back, this whole situation easily could have been avoided. Unfortunately, we are at the mercy of the driver ahead of us, a programmer from the lab who knows the way and who has decided to take us to Pa'ia via the scenic route instead of via the nearby Pilani Highway.
+
+"This is terrible," says Stallman between frustrated sighs. "Why didn't we take the other route?"
+
+Again, the light a quarter mile ahead of us turns green. Again, we creep forward a few more car lengths. This process continues for another 10 minutes, until we finally reach a major crossroad promising access to the adjacent highway.
+
+The driver ahead of us ignores it and continues through the intersection.
+
+"Why isn't he turning?" moans Stallman, throwing up his hands in frustration. "Can you believe this?"
+
+I decide not to answer either. I find the fact that I am sitting in a car with Stallman in the driver seat, in Maui no less, unbelievable enough. Until two hours ago, I didn't even know Stallman knew how to drive. Now, listening to Yo-Yo Ma's cello playing the mournful bass notes of "Appalachian Journey" on the car stereo and watching the sunset pass by on our left, I do my best to fade into the upholstery.
+
+When the next opportunity to turn finally comes up, Stallman hits his right turn signal in an attempt to cue the driver ahead of us. No such luck. Once again, we creep slowly through the intersection, coming to a stop a good 200 yards before the next light. By now, Stallman is livid.
+
+"It's like he's deliberately ignoring us," he says, gesturing and pantomiming like an air craft carrier landing-signals officer in a futile attempt to catch our guide's eye. The guide appears unfazed, and for the next five minutes all we see is a small portion of his head in the rear-view mirror.
+
+I look out Stallman's window. Nearby Kahoolawe and Lanai Islands provide an ideal frame for the setting sun. It's a breathtaking view, the kind that makes moments like this a bit more bearable if you're a Hawaiian native, I suppose. I try to direct Stallman's attention to it, but Stallman, by now obsessed by the inattentiveness of the driver ahead of us, blows me off.
+={Lanai Islands (Hawaii)}
+
+When the driver passes through another green light, completely ignoring a "Pilani Highway Next Right," I grit my teeth. I remember an early warning relayed to me by BSD programmer Keith Bostic. "Stallman does not suffer fools gladly," Bostic warned me. "If somebody says or does something stupid, he'll look them in the eye and say, 'That's stupid.'"
+={Bostic, Keith}
+
+Looking at the oblivious driver ahead of us, I realize that it's the stupidity, not the inconvenience, that's killing Stallman right now.
+
+"It's as if he picked this route with absolutely no thought on how to get there efficiently," Stallman says.
+
+The word "efficiently" hangs in the air like a bad odor. Few things irritate the hacker mind more than inefficiency. It was the inefficiency of checking the Xerox laser printer two or three times a day that triggered Stallman's initial inquiry into the printer source code. It was the inefficiency of rewriting software tools hijacked by commercial software vendors that led Stallman to battle Symbolics and to launch the GNU Project. If, as Jean Paul Sartre once opined, hell is other people, hacker hell is duplicating other people's stupid mistakes, and it's no exaggeration to say that Stallman's entire life has been an attempt to save mankind from these fiery depths.
+={Sartre, Jean Paul}
+
+This hell metaphor becomes all the more apparent as we take in the slowly passing scenery. With its multitude of shops, parking lots, and poorly timed street lights, Kihei seems less like a city and more like a poorly designed software program writ large. Instead of rerouting traffic and distributing vehicles through side streets and expressways, city planners have elected to run everything through a single main drag. From a hacker perspective, sitting in a car amidst all this mess is like listening to a CD rendition of nails on a chalkboard at full volume.
+
+"Imperfect systems infuriate hackers," observes Steven Levy, another warning I should have listened to before climbing into the car with Stallman. "This is one reason why hackers generally hate driving cars - the system of randomly programmed red lights and oddly laid out one-way streets causes delays which are so goddamn /{unnecessary}/ [Levy's emphasis] that the impulse is to rearrange signs, open up traffic-light control boxes . . . re-design the entire system."~{ See Steven Levy, /{Hackers}/ (Penguin USA [paperback], 1984): 40. }~
+
+More frustrating, however, is the duplicity of our trusted guide. Instead of searching out a clever shortcut - as any true hacker would do on instinct - the driver ahead of us has instead chosen to play along with the city planners' game. Like Virgil in Dante's /{Inferno}/, our guide is determined to give us the full guided tour of this hacker hell whether we want it or not.
+
+Before I can make this observation to Stallman, the driver finally hits his right turn signal. Stallman's hunched shoulders relax slightly, and for a moment the air of tension within the car dissipates. The tension comes back, however, as the driver in front of us slows down. "Construction Ahead" signs line both sides of the street, and even though the Pilani Highway lies less than a quarter mile off in the distance, the two-lane road between us and the highway is blocked by a dormant bulldozer and two large mounds of dirt.
+
+It takes Stallman a few seconds to register what's going on as our guide begins executing a clumsy five-point U-turn in front of us. When he catches a glimpse of the bulldozer and the "No Through Access" signs just beyond, Stallman finally boils over.
+
+"Why, why, why?" he whines, throwing his head back. "You should have known the road was blocked. You should have known this way wouldn't work. You did this deliberately." [RMS: I meant that he chose the slow road deliberately. As explained below, I think these quotes are not exact.]
+
+The driver finishes the turn and passes us on the way back toward the main drag. As he does so, he shakes his head and gives us an apologetic shrug. Coupled with a toothy grin, the driver's gesture reveals a touch of mainlander frustration but is tempered with a protective dose of islander fatalism. Coming through the sealed windows of our rental car, it spells out a succinct message: "Hey, it's Maui; what are you gonna do?"
+
+Stallman can take it no longer.
+
+"Don't you fucking smile!" he shouts, fogging up the glass as he does so. "It's your fucking fault. This all could have been so much easier if we had just done it my way." [RMS: These quotes appear to be inaccurate, because I don't use "fucking" as an adverb. This was not an interview, so Williams would not have had a tape recorder running. I'm sure things happened overall as described, but these quotations probably reflect his understanding rather than my words.]
+
+Stallman accents the words "my way" by gripping the steering wheel and pulling himself towards it twice. The image of Stallman's lurching frame is like that of a child throwing a temper tantrum in a car seat, an image further underlined by the tone of Stallman's voice. Halfway between anger and anguish, Stallman seems to be on the verge of tears.
+
+Fortunately, the tears do not arrive. Like a summer cloudburst, the tantrum ends almost as soon as it begins. After a few whiny gasps, Stallman shifts the car into reverse and begins executing his own U-turn. By the time we are back on the main drag, his face is as impassive as it was when we left the hotel 30 minutes earlier.
+
+It takes less than five minutes to reach the next cross-street. This one offers easy highway access, and within seconds, we are soon speeding off toward Pa'ia at a relaxing rate of speed. The sun that once loomed bright and yellow over Stallman's left shoulder is now burning a cool orange-red in our rear-view mirror. It lends its color to the gauntlet wili wili trees flying past us on both sides of the highway.
+={Pa'ia (Hawaii)}
+
+For the next 20 minutes, the only sound in our vehicle, aside from the ambient hum of the car's engine and tires, is the sound of a cello and a violin trio playing the mournful strains of an Appalachian folktune.
+
+1~ Chapter 13 - Continuing the Fight
+
+For Richard Stallman, time may not heal all wounds, but it does provide a convenient ally.
+
+Four years after "The Cathedral and the Bazaar," Stallman still chafes over the Raymond critique. He also grumbles over Linus Torvalds' elevation to the role of world's most famous hacker. He recalls a popular T-shirt that began showing at Linux tradeshows around 1999. Designed to mimic the original promotional poster for Star Wars, the shirt depicted Torvalds brandishing a light-saber like Luke Skywalker, while Stallman's face rides atop R2D2. The shirt still grates on Stallman's nerves not only because it depicts him as Torvalds' sidekick, but also because it elevates Torvalds to the leadership role in the free-software community, a role even Torvalds himself is loath to accept. "It's ironic," says Stallman mournfully. "Picking up that sword is exactly what Linus refuses to do. He gets everybody focusing on him as the symbol of the movement, and then he won't fight. What good is it?"
+={Cathedral and the Bazaar, The (Raymond);Luke Skywalker;R2D2;Torvalds, Linus+1;Star Wars}
+
+Then again, it is that same unwillingness to "pick up the sword," on Torvalds' part, that has left the door open for Stallman to bolster his reputation as the hacker community's ethical arbiter. Despite his grievances, Stallman has to admit that the last few years have been quite good, both to himself and to his organization. Relegated to the periphery by the ironic success of the GNU/Linux system because users thought of it as "Linux," Stallman has nonetheless successfully recaptured the initiative. His speaking schedule between January 2000and December 2001 included stops on six continents and visits to countries where the notion of software freedom carries heavy overtones -China and India, for example.
+
+Outside the bully pulpit, Stallman has taken advantage of the leverage of the GNU General Public License (GPL), of which he remains the steward. During the summer of 2000, while the air was rapidly leaking out of the 1999 Linux IPO bubble, Stallman and the Free Software Foundation scored two major victories. In July, 2000, Troll tech, a Norwegian software company and developer of Qt, a graphical interface library that ran on the GNU/Linux operating system, announced it was licensing its software under the GPL. A few weeks later, Sun Microsystems, a company that, until then, had been warily trying to ride the open source bandwagon without actually contributing its code, finally relented and announced that it, too, was dual licensing its new OpenOffice~{ Sun was compelled by a trademark complaint to use the clumsy name "OpenOffice.org." }~ application suite under the Lesser GNU Public License(LGPL) and the Sun Industry Standards Source License (SISSL).
+={Free Software Foundation (FSF):QT graphic tools and;GNU General Public License:QT graphics tools and;Lesser GNU Public License (LGPL);OpenOffice application suite+4;Qt+1;Troll Tech+1;SISSL (Sun Industry Standards Source Licence);Sun Industry Standards Source License (SISSL);Sun Microsystems:OpenOffice application suite}
+
+In the case of Trolltech, this victory was the result of a protracted effort by the GNU Project. The non-freeness of Qt was a serious problem for the free software community because KDE, a free graphical desktop environment that was becoming popular, depended on it. Qt was non-free software but Trolltech had invited free software projects(such as KDE) to use it gratis. Although KDE itself was free software, users that insisted on freedom couldn't run it, since they had to reject Qt. Stallman recognized that many users would want a graphical desktop on GNU/Linux, and most would not value freedom enough to reject the temptation of KDE, with Qt hiding within. The danger was that GNU/Linux would become a motor for the installation of KDE, and therefore also of non-free Qt. This would undermine the freedom which was the purpose of GNU.
+
+To deal with this danger, Stallman recruited people to launch two parallel counter projects. One was GNOME, the GNU free graphical desktop environment. The other was Harmony, a compatible free replacement for Qt. If GNOME succeeded, KDE would not be necessary; if Harmony succeeded, KDE would not need Qt. Either way, users would be able to have a graphical desktop on GNU/Linux without non-free Qt.
+
+In 1999, these two efforts were making good progress, and the management of Trolltech were starting to feel the pressure. So Trolltech released Qt under its own free software license, the QPL. The QPL qualified as a free license, but Stallman pointed out the drawback of incompatibility with the GPL: in general, combining GPL-covered code with Qt in one program was impossible without violating one license or the other. Eventually the Trolltech management recognized that the GPL would serve their purposes equally well, and released Qt with dual licensing: the same Qt code, in parallel, was available under the GNU GPL and under the QPL. After three years, this was victory.
+
+Once Qt was free, the motive for developing Harmony (which wasn't complete enough for actual use) had disappeared, and the developers abandoned it. GNOME had acquired substantial momentum, so its development continued, and it remains the main GNU graphical desktop.
+
+Sun desired to play according to the Free Software Foundation's conditions. At the 1999 O'Reilly Open Source Conference, Sun Microsystems co-founder and chief scientist Bill Joy defended his company's "community source" license, essentially a watered-down compromise letting users copy and modify Sun-owned software but not sell copies of said software without negotiating a royalty agreement with Sun. (With this restriction, the license did not qualify as free, nor for that matter as open source.) A year after Joy's speech, Sun Microsystems vice president Marco Boerries was appearing on the same stage spelling out the company's new licensing compromise in the case of OpenOffice, an office-application suite designed specifically for the GNU/Linux operating system.
+={Boerries, Marco+2;community source, license of Sun Microsystems;Joy, Bill;O'Reilly & Associates:Open Source Conferences}
+
+"I can spell it out in three letters," said Boerries. "GPL."
+
+At the time, Boerries said his company's decision had little to do with Stallman and more to do with the momentum of GPL-protected programs. "What basically happened was the recognition that different products attracted different communities, and the license you use depends on what type of community you want to attract," said Boerries. "With [OpenOffice], it was clear we had the highest correlation with the GPL community."~{ Marco Boerries, interview with author (July, 2000). }~ Alas, this victory was incomplete, since OpenOffice recommends the use of non-free plug-ins.
+
+Such comments point out the under-recognized strength of the GPL and, indirectly, the political genius of the man who played the largest role in creating it. "There isn't a lawyer on earth who would have drafted the GPL the way it is," says Eben Moglen, Columbia University law professor and Free Software Foundation general counsel. "But it works. And it works because of Richard's philosophy of design."
+={Columbia University;Moglen, Eben+35}
+
+A former professional programmer, Moglen traces his pro bono work with Stallman back to 1990 when Stallman requested Moglen's legal assistance on a private affair. Moglen, then working with encryption expert Phillip Zimmerman during Zimmerman's legal battles with the federal government, says he was honored by the request.~{ For more information on Zimmerman's legal travails, read Steven Levy's /{Crypto}/, p. 287-288. In the original book version of /{Free as in Freedom}/, I reported that Moglen helped defend Zimmerman against the National Security Agency. According to Levy's account, Zimmerman was investigated by the U.S. Attorney's office and U.S. Customs, not the NSA. }~
+={Zimmerman, Phillip;National Security Administration}
+
+"I told him I used Emacs every day of my life, and it would take an awful lot of lawyering on my part to pay off the debt."
+
+Since then, Moglen, perhaps more than any other individual, has had the best chance to observe the crossover of Stallman's hacker philosophies into the legal realm. Moglen says Stallman's approach to legal code and his approach to software code are largely the same. "I have to say, as a lawyer, the idea that what you should do with a legal document is to take out all the bugs doesn't make much sense," Moglen says. "There is uncertainty in every legal process, and what most lawyers want to do is to capture the benefits of uncertainty for their client. Richard's goal is the complete opposite. His goal is to remove uncertainty, which is inherently impossible. It is inherently impossible to draft one license to control all circumstances in all legal systems all over the world. But if you were to go at it, you would have to go at it his way. And the resulting elegance, the resulting simplicity in design almost achieves what it has to achieve. And from there a little lawyering will carry you quite far."
+
+As the person charged with pushing the Stallman agenda, Moglen understands the frustration of would-be allies. "Richard is a man who does not want to compromise over matters that he thinks of as fundamental," Moglen says, "and he does not take easily the twisting of words or even just the seeking of artful ambiguity, which human society often requires from a lot of people."
+
+In addition to helping the Free Software Foundation, Moglen has provided legal aid to other copyright defendants, such as Dmitry Sklyarov, and distributors of the DVD decryption program deCSS.
+={Sklyarov, Dmitri+1}
+
+Sklyarov had written and released a program to break digital copy-protection on Adobe e-Books, in Russia where there was no law against it, as an employee of a Russian company. He was then arrested while visiting the US to give a scientific paper about his work. Stallman eagerly participated in protests condemning Adobe for having Sklyarov arrested, and the Free Software Foundation denounced the Digital Millennium Copyright Act as "censorship of software," but it could not intervene in favor of Sklyarov's program because that was non-free. Thus, Moglen worked for Sklyarov's defense through the Electronic Frontier Foundation. The FSF avoided involvement in the distribution of deCSS, since that was illegal, but Stallman condemned the U.S. government for prohibiting deCSS, and Moglen worked as direct counsel for the defendants.
+={Electronic Frontier Foundation}
+
+Following the FSF's decision not to involve itself in those cases, Moglen has learned to appreciate the value of Stallman's stubbornness. "There have been times over the years where I've gone to Richard and said, 'We have to do this. We have to do that. Here's the strategic situation. Here's the next move. Here's what he have to do.' And Richard's response has always been, 'We don't have to do anything.'Just wait. What needs doing will get done."
+
+"And you know what?" Moglen adds. "Generally, he's been right."
+
+Such comments disavow Stallman's own self-assessment: "I'm not good at playing games," Stallman says, addressing the many unseen critics who see him as a shrewd strategist. "I'm not good at looking ahead and anticipating what somebody else might do. My approach has always been to focus on the foundation [of ideas], to say 'Let's make the foundation as strong as we can make it.'"
+
+The GPL's expanding popularity and continuing gravitational strength are the best tributes to the foundation laid by Stallman and his GNU colleagues. While Stallman was never the sole person in the world releasing free software, he nevertheless can take sole credit for building the free software movement's ethical framework. Whether or not other modern programmers feel comfortable working inside that framework is immaterial. The fact that they even have a choice at all is Stallman's greatest legacy.
+
+Discussing Stallman's legacy at this point seems a bit premature. Stallman, 48 at the time of this writing, still has a few years left to add to or subtract from that legacy. Still, the momentum of the free software movement makes it tempting to examine Stallman's life outside the day-to-day battles of the software industry and within a more august, historical setting.
+
+To his credit, Stallman refuses all opportunities to speculate about this. "I've never been able to work out detailed plans of what the future was going to be like," says Stallman, offering his own premature epitaph. "I just said 'I'm going to fight. Who knows where I'll get?'"
+
+There's no question that in picking his fights, Stallman has alienated the very people who might otherwise have been his greatest champions, had he been willing to fight for their views instead of his own. It is also a testament to his forthright, ethical nature that many of Stallman's erstwhile political opponents still manage to put in a few good words for him when pressed. The tension between Stallman the ideologue and Stallman the hacker genius, however, leads a biographer to wonder: how will people view Stallman when Stallman's own personality is no longer there to get in the way?
+
+In early drafts of this book, I dubbed this question the "100 year" question. Hoping to stimulate an objective view of Stallman and his work, I asked various software-industry luminaries to take themselves out of the current time-frame and put themselves in a position of a historian looking back on the free software movement 100 years in the future. From the current vantage point, it is easy to see similarities between Stallman and past Americans who, while somewhat marginal during their lifetime, have attained heightened historical importance in relation to their age. Easy comparisons include Henry David Thoreau, transcendentalist philosopher and author of /{Civil Disobedience}/, and John Muir, founder of the Sierra Club and progenitor of the modern environmental movement. It is also easy to see similarities in men like William Jennings Bryan, a.k.a. "The Great Commoner," leader of the populist movement, enemy of monopolies, and a man who, though powerful, seems to have faded into historical insignificance.
+={Bryan, Willliam Jennings;Muir, John;On Civil Disobedience (Thoreau);Thoreau, Henry David;Sierra Club}
+
+Although not the first person to view software as public property, Stallman is guaranteed a footnote in future history books thanks to the GPL. Given that fact, it seems worthwhile to step back and examine Richard Stallman's legacy outside the current time frame. Will the GPL still be something software programmers use in the year 2102, or will it have long since fallen by the wayside? Will the term "free-software" seem as politically quaint as "free silver" does today, or will it seem eerily prescient in light of later political events?
+
+Predicting the future is risky sport. Stallman refuses, saying that asking what people will think in 100 years presumes we have no influence over it. The question he prefers is, "What should we do to make a better future?" But most people, when presented with the predictive question, seemed eager to bite.
+
+"One hundred years from now, Richard and a couple of other people are going to deserve more than a footnote," says Moglen. "They're going to be viewed as the main line of the story."
+
+The "couple of other people" Moglen nominates for future textbook chapters include John Gilmore, who beyond contributing in various ways to free software has founded the Electronic Frontier Foundation, and Theodor Holm Nelson, a.k.a. Ted Nelson, author of the 1982book, /{Literary Machines}/. Moglen says Stallman, Nelson, and Gilmore each stand out in historically significant, non-overlapping ways. He credits Nelson, commonly considered to have coined the term "hypertext," for identifying the predicament of information ownership in the digital age. Gilmore and Stallman, meanwhile, earn notable credit for identifying the negative political effects of information control and building organizations - the Electronic Frontier Foundation in the case of Gilmore and the Free Software Foundation in the case of Stallman - to counteract those effects. Of the two, however, Moglen sees Stallman's activities as more personal and less political in nature.
+={Electronic Frontier Foundation;Gilmore, John;Nelson, Theodor Holm+2;Nelson, Ted+2}
+
+"Richard was unique in that the ethical implications of un-free software were particularly clear to him at an early moment," says Moglen. "This has a lot to do with Richard's personality, which lots of people will, when writing about him, try to depict as epiphenomenal or even a drawback in Richard Stallman's own life work."
+
+Gilmore, who describes his inclusion between the erratic Nelson and the irascible Stallman as something of a "mixed honor," nevertheless seconds the Moglen argument. Writes Gilmore:
+
+_1 My guess is that Stallman's writings will stand up as well as Thomas Jefferson's have; he's a pretty clear writer and also clear on his principles... Whether Richard will be as influential as Jefferson will depend on whether the abstractions we call "civil rights" end up more important a hundred years from now than the abstractions that we call "software" or "technically imposed restrictions."
+={Jefferson, Thomas}
+
+Another element of the Stallman legacy not to be overlooked, Gilmore writes, is the collaborative software-development model pioneered by the GNU Project. Although flawed at times, the model has nevertheless evolved into a standard within the software-development industry. All told, Gilmore says, this collaborative software-development model may end up being even more influential than the GNU Project, the GPL License, or any particular software program developed by Stallman:
+
+_1 Before the Internet, it was quite hard to collaborate over distance on software, even among teams that know and trust each other. Richard pioneered collaborative development of software, particularly by disorganized volunteers who seldom meet each other. Richard didn't build any of the basic tools for doing this (the TCP protocol, email lists, diff and patch, tar files, RCS or CVS or remote-CVS), but he used the ones that were available to form social groups of programmers who could effectively collaborate.
+
+Stallman thinks that evaluation, though positive, misses the point. "It emphasizes development methods over freedom, which reflects the values of open source rather than free software. If that is how future users look back on the GNU Project, I fear it will lead to a world in which developers maintain users in bondage, and let them aid development occasionally as a reward, but never take the chains off them."
+
+Lawrence Lessig, Stanford law professor and author of the 2001 book, /{The Future of Ideas}/, is similarly bullish. Like many legal scholars, Lessig sees the GPL as a major bulwark of the current so-called "digital commons," the vast agglomeration of community-owned software programs, network and telecommunication standards that have triggered the Internet's exponential growth over the last three decades. Rather than connect Stallman with other Internet pioneers, men such as Vannevar Bush, Vinton Cerf, and J. C. R. Licklider who convinced others to see computer technology on a wider scale, Lessig sees Stallman's impact as more personal, introspective, and, ultimately, unique:
+={Future of Ideas, The (Lessig)}
+
+_1 [Stallman] changed the debate from "is" to "ought." He made people see how much was at stake, and he built a device to carry these ideals forward... That said, I don't quite know how to place him in the context of Cerf or Licklider. The innovation is different. It is not just about a certain kind of code, or enabling the Internet. [It's] much more about getting people to see the value in a certain kind of Internet. I don't think there is anyone else in that class, before or after.
+
+Not everybody sees the Stallman legacy as set in stone, of course. Eric Raymond, the open source proponent who feels that Stallman's leadership role has diminished significantly since 1996, sees mixed signals when looking into the 2102 crystal ball:
+
+_1 I think Stallman's artifacts (GPL, Emacs, GCC) will be seen as revolutionary works, as foundation-stones of the information world. I think history will be less kind to some of the theories from which RMS operated, and not kind at all to his personal tendency towards territorial, cult-leader behavior.
+
+As for Stallman himself, he, too, sees mixed signals:
+
+_1 What history says about the GNU Project, twenty years from now, will depend on who wins the battle of freedom to use public knowledge. If we lose, we will be just a footnote. If we win, it is uncertain whether people will know the role of the GNU operating system - if they think the system is "Linux," they will build a false picture of what happened and why.
+
+_1 But even if we win, what history people learn a hundred years from now is likely to depend on who dominates politically.
+
+Searching for his own 19th-century historical analogy, Stallman summons the figure of John Brown, the militant abolitionist regarded as a hero on one side of the Mason Dixon line and a madman on the other.
+
+John Brown's slave revolt never got going, but during his subsequent trial he effectively roused national demand for abolition. During the Civil War, John Brown was a hero; 100 years after, and for much of the 1900s, history textbooks taught that he was crazy. During the era of legal segregation, while bigotry was shameless, the U.S. partly accepted the story that the South wanted to tell about itself, and history textbooks said many untrue things about the Civil War and related events.
+
+Such comparisons document both the self-perceived peripheral nature of Stallman's current work and the binary nature of his current reputation. It's hard to see Stallman's reputation falling to the same level of infamy as Brown's did during the post-Reconstruction period. Stallman, despite his occasional war-like analogies, has done little to inspire violence. Still, it is easy to envision a future in which Stallman's ideas wind up on the ash-heap.~{ RMS: Sam Williams' further words here, "In fashioning the free software cause not not as a mass movement but as a collection of private battles against the forces of proprietary temptation," do not fit the facts. Ever since the first announcement of the GNU Project, I have asked the public to support the cause. The free software movement aims to be a mass movement, and the only question is whether it has enough supporters to qualify as "mass." As of 2009, the Free Software Foundation has some 3000 members that pay the hefty dues, and over 20,000 subscribers to its monthly e-mail newsletter. }~
+
+Then again, it is that very will that may someday prove to be Stallman's greatest lasting legacy. Moglen, a close observer over the last decade, warns those who mistake the Stallman personality as counter-productive or epiphenomenal to the "artifacts" of Stallman's life. Without that personality, Moglen says, there would be precious few artifacts to discuss. Says Moglen, a former Supreme Court clerk:
+
+_1 Look, the greatest man I ever worked for was Thurgood Marshall. I knew what made him a great man. I knew why he had been able to change the world in his possible way. I would be going out on a limb a little bit if I were to make a comparison, because they could not be more different: Thurgood Marshall was a man in society, representing an outcast society to the society that enclosed it, but still a man in society. His skill was social skills. But he was all of a piece, too. Different as they were in every other respect, the person I now most compare him to in that sense - of a piece, compact, made of the substance that makes stars, all the way through - is Stallman.
+={Marshall, Thurgood}
+
+In an effort to drive that image home, Moglen reflects on a shared moment in the spring of 2000. The success of the VA Linux IPO was still resonating in the business media, and a half dozen issues related to free software were swimming through the news. Surrounded by a swirling hurricane of issues and stories each begging for comment, Moglen recalls sitting down for lunch with Stallman and feeling like a castaway dropped into the eye of the storm. For the next hour, he says, the conversation calmly revolved around a single topic: strengthening the GPL.
+={VA Linux}
+
+"We were sitting there talking about what we were going to do about some problems in Eastern Europe and what we were going to do when the problem of the ownership of content began to threaten free software," Moglen recalls. "As we were talking, I briefly thought about how we must have looked to people passing by. Here we are, these two little bearded anarchists, plotting and planning the next steps. And, of course, Richard is plucking the knots from his hair and dropping them in the soup and behaving in his usual way. Anybody listening in on our conversation would have thought we were crazy, but I knew: I knew the revolution's right here at this table. This is what's making it happen. And this man is the person making it happen."
+
+Moglen says that moment, more than any other, drove home the elemental simplicity of the Stallman style.
+
+"It was funny," recalls Moglen. "I said to him, 'Richard, you know, you and I are the two guys who didn't make any money out of this revolution.' And then I paid for the lunch, because I knew he didn't have the money to pay for it."~{ RMS: I never refuse to let people treat me to a meal, since my pride is not based on picking up the check. But I surely did have the money to pay for lunch. My income, which comes from around half the speeches I give, is much less than a law professor's salary, but I'm not poor. }~
+
+1~ Epilogue from Sam Williams: Crushing Loneliness
+
+[RMS: Because this chapter is so personally from Sam Williams, I have indicated all changes to the text with square brackets or ellipses, and I have made such changes only to clear up technical or legal points,and to remove passages that I found to be hostile and devoid of information. I have also added notes labeled 'RMS:' to respond to certain points. Williams has also changed the text of this chapter; changes made by Williams are not explicitly indicated.]
+
+Writing the biography of a living person is a bit like producing a play. The drama in front of the curtain often pales in comparison to the drama backstage.
+
+In /{The Autobiography of Malcolm X}/, Alex Haley gives readers a rare glimpse of that backstage drama. Stepping out of the ghostwriter role, Haley delivers the book's epilogue in his own voice. The epilogue explains how a freelance reporter originally dismissed as a "tool" and"spy" by the Nation of Islam spokesperson managed to work through personal and political barriers to get Malcolm X's life story on paper.
+={Autobiography of Malcolm X, The (Haley)+1;Haley, Alex}
+
+While I hesitate to compare this book with /{The Autobiography of Malcolm X}/, I do owe a debt of gratitude to Haley for his candid epilogue. Over the last 12 months, it has served as a sort of instruction manual on how to deal with a biographical subject who has built an entire career on being disagreeable. [RMS: I have built my career on saying no to things others accept without much question, but if I sometimes seem or am disagreeable, it is not through specific intention.] From the outset, I envisioned closing this biography with a similar epilogue, both as an homage to Haley and as a way to let readers know how this book came to be.
+
+The story behind this story starts in an Oakland apartment, winding its way through the various locales mentioned in the book - Silicon Valley, Maui, Boston, and Cambridge. Ultimately, however, it is a tale of two cities: New York, New York, the book-publishing capital of the world, and Sebastopol, California, the book-publishing capital of Sonoma County.
+
+The story starts in April, 2000. At the time, I was writing stories for the ill-fated web site BeOpen.com. One of my first assignments was a phone interview with Richard M. Stallman. The interview went well, so well that Slashdot (http://www.slashdot.org), the popular "news for nerds" site owned by VA Software, Inc. (formerly VA LinuxSystems and before that, VA Research), gave it a link in its daily list of feature stories. Within hours, the web servers at BeOpen were heating up as readers clicked over to the site.
+={BeOpen.com+3;VA Linux;VA Research;VA Software, Inc.;Slashdot}
+
+For all intents and purposes, the story should have ended there. Three months after the interview, while attending the O'Reilly Open Source Conference in Monterey, California, I received the following email message from Tracy Pattison, foreign-rights manager at a large New York publishing house:
+={Monterey (California);O'Reilly & Associates:Open Source Conferences;Pattison, Tracy}
+
+% poem or group what follows ?
+
+poem{
+
+To: sam@BeOpen.com
+
+Subject: RMS Interview Date: Mon, 10 Jul 2000 15:56:37 - 0400
+
+Dear Mr. Williams,
+
+I read your interview with Richard Stallman on BeOpen
+with great interest. I've been intrigued by RMS and his
+work for some time now and was delighted to find your
+piece which I really think you did a great job of capturing
+some of the spirit of what Stallman is trying to do with
+GNU-Linux and the Free Software Foundation.
+
+What I'd love to do, however, is read more - and I don't
+think I'm alone. Do you think there is more information
+and/or sources out there to expand and update your
+interview and adapt it into more of a profile of Stallman?
+Perhaps including some more anecdotal information about
+his personality and background that might really interest
+and enlighten readers outside the more hardcore
+programming scene?
+
+}poem
+
+Tracy ended the email with a request that I give her a call to discuss the idea further. I did just that. Tracy told me her company was launching a new electronic book line, and it wanted stories that appealed to an early-adopter audience. The e-book format was 30,000words, about 100 pages, and she had pitched her bosses on the idea of profiling a major figure in the hacker community. Her bosses liked the idea, and in the process of searching for interesting people to profile,she had come across my BeOpen interview with Stallman. Hence her email to me.
+
+That's when Tracy asked me: would I be willing to expand the interview into a full-length feature profile?
+
+My answer was instant: yes. Before accepting it, Tracy suggested I put together a story proposal she could show her superiors. Two days later, I sent her a polished proposal. A week later, Tracy sent me a follow up email. Her bosses had given it the green light.
+
+I have to admit, getting Stallman to participate in an e-book project was an afterthought on my part. As a reporter who covered the open source beat, I knew Stallman was a stickler. I'd already received a half dozen emails at that point upbraiding me for the use of "Linux" instead of "GNU/Linux."
+
+Then again, I also knew Stallman was looking for ways to get his message out to the general public. Perhaps if I presented the project to him that way, he would be more receptive. If not, I could always rely upon the copious amounts of documents, interviews, and recorded online conversations Stallman had left lying around the Internet and do an unauthorized biography.
+
+During my research, I came across an essay titled "Freedom - Or Copyright?" Written by Stallman and published in the June, 2000,edition of the MIT /{Technology Review}/, the essay blasted e-books for an assortment of software sins. Not only did readers have to use proprietary software programs to read them, Stallman lamented, but the methods used to prevent unauthorized copying were overly harsh. Instead of downloading a transferable HTML or PDF file, readers downloaded an encrypted file. In essence, purchasing an e-book meant purchasing a nontransferable key to unscramble the encrypted content. Any attempt to open a book's content without an authorized key constituted a criminal violation of the Digital Millennium Copyright Act, the 1998 law designed to bolster copyright enforcement on the Internet. Similar penalties held for readers who converted a book's content into an open file format, even if their only intention was to read the book on a different computer in their home. Unlike a normal book, the reader no longer held the right to lend, copy, or resell an e-book. They only had the right to read it on an authorized machine, warned Stallman:
+={Digital Millennium Copyright Act}
+
+_1 We still have the same old freedoms in using paper books.But if e-books replace printed books, that exception will do little good. With "electronic ink," which makes it possible to download new text onto an apparently printed piece of paper, even newspapers could become ephemeral. Imagine:no more used book stores; no more lending a book to your friend; no more borrowing one from the public library - no more "leaks" that might give someone a chance to read without paying. (And judging from the ads for Microsoft Reader, no more anonymous purchasing of books either.)This is the world publishers have in mind for us.~{ See "Freedom - Or Copyright?" (May, 2000), \\ http://www.technologyreview.com/articles/stallman0500.asp. }~
+
+Needless to say, the essay caused some concern. Neither Tracy nor I had discussed the software her company would use nor had we discussed the type of copyright [license] that would govern the e-book's usage. I mentioned the /{Technology Review}/ article and asked if she could give me information on her company's e-book policies. Tracy promised to get back to me.
+
+Eager to get started, I decided to call Stallman anyway and mention the book idea to him. When I did, he expressed immediate interest and immediate concern. "Did you read my essay on e-books?" he asked.
+
+When I told him, yes, I had read the essay and was waiting to hear back from the publisher, Stallman laid out two conditions: he didn't want to lend support to an e-book licensing mechanism he fundamentally opposed, and he didn't want to come off as lending support. "I don't want to participate in anything that makes me look like a hypocrite," he said.
+
+For Stallman, the software issue was secondary to the copyright issue. He said he was willing to ignore whatever software the publisher or its third-party vendors employed just so long as the company specified within the copyright that readers were free to make and distribute verbatim copies of the e-book's content. Stallman pointed to Stephen King's /{The Plant}/ as a possible model. In June, 2000, King announced on his official web site that he was self-publishing /{The Plant}/ in serial form. According to the announcement, the book's total cost would be $13, spread out over a series of $1 installments. As long as at least 75% of the readers paid for each chapter, King promised to continue releasing new installments. By August, the plan seemed to be working, as King had published the first two chapters with a third on the way.
+={King, Stephen;open source+4;Plant, The (King)}
+
+"I'd be willing to accept something like that," Stallman said. "As long as it also permitted verbatim copying." [RMS: As I recall, I also raised the issue of encryption; the text two paragraphs further down confirms this. I would not have agreed to publish the book in a way that /{required}/ a non-free program to read it.]
+
+I forwarded the information to Tracy. Feeling confident that she and I might be able to work out an equitable arrangement, I called up Stallman and set up the first interview for the book. Stallman agreed to the interview without making a second inquiry into the status issue. Shortly after the first interview, I raced to set up a second interview (this one in Kihei), squeezing it in before Stallman headed off on a 14-day vacation to Tahiti. [RMS: That was not a pure vacation; I gave a speech there too.]
+={Kihei (Hawaii)}
+
+It was during Stallman's vacation that the bad news came from Tracy. Her company's legal department didn't want to adjust its [license] notice on the e-books. Readers who wanted to make their books transferable would [first have to crack the encryption code, to be able to convert the book to a free, public format such as HTML. This would be illegal and they might face criminal penalties.]
+
+With two fresh interviews under my belt, I didn't see any way to write the book without resorting to the new material. I quickly set up a trip to New York to meet with my agent and with Tracy to see if there was a compromise solution.
+
+When I flew to New York, I met my agent, Henning Guttman. It was our first face-to-face meeting, and Henning seemed pessimistic about our chances of forcing a compromise, at least on the publisher's end. The large, established publishing houses already viewed the e-book format with enough suspicion and weren't in the mood to experiment with copyright language that made it easier for readers to avoid payment. As an agent who specialized in technology books, however,Henning was intrigued by the novel nature of my predicament. I told him about the two interviews I'd already gathered and the promise not to publish the book in a way that made Stallman "look like a hypocrite." Agreeing that I was in an ethical bind, Henning suggested we make that our negotiating point.
+={Guttman, Henning}
+
+Barring that, Henning said, we could always take the carrot-and-stick approach. The carrot would be the publicity that came with publishing an e-book that honored the hacker community's internal ethics. The stick would be the risks associated with publishing an e-book that didn't. Nine months before Dmitry Sklyarov became an Internet /{cause célèbre}/, we knew it was only a matter of time before an enterprising programmer revealed how to hack e-books. We also knew that a major publishing house releasing an [encrypted] e-book on Richard M. Stallman was the software equivalent of putting "Steal This E-Book" on the cover.
+={Sklyarov, Dmitri}
+
+After my meeting with Henning, I called Stallman. Hoping to make the carrot more enticing, I discussed a number of potential compromises. What if the publisher released the book's content under a[dual] license, something similar to what Sun Microsystems had done with Open Office, the free software desktop applications suite? The publisher could then release DRM-restricted~{ RMS: Williams wrote "commercial" here, but that is a misnomer, since it means "connected with business." All these versions would be commercial if a company published them. }~ versions of the e-book under [its usual] format, taking advantage of all the bells and whistles that went with the e-book software, while releasing the copyable version under a less aesthetically pleasing HTML format.
+
+Stallman told me he didn't mind the [dual-license] idea, but he did dislike the idea of making the freely copyable version inferior to the restricted version. Besides, he said [on second thought, this case was different precisely because he had] a way to control the outcome. He could refuse to cooperate.
+
+[RMS: The question was whether it would be wrong for me to agree to the restricted version. I can endorse the free version of Sun's Open Office, because it is free software and much better than nothing,while at the same time I reject the non-free version. There is no self- contradiction here, because Sun didn't need or ask my approval for the non-free version; I was not responsible for its existence. In this case, if I had said yes to the non-freely-copyable version, the onus would fall on me.]
+
+I made a few more suggestions with little effect. About the only thing I could get out of Stallman was a concession [RMS: i.e., a further compromise] that the e-book's [license] restrict all forms of file sharing to "noncommercial redistribution."
+
+Before I signed off, Stallman suggested I tell the publisher that I'd promised Stallman that the work would be [freely sharable]. I told Stallman I couldn't agree to that statement [RMS: though it was true,since he had accepted my conditions at the outset] but that I did view the book as unfinishable without his cooperation. Seemingly satisfied,Stallman hung up with his usual sign-off line: "Happy hacking."
+
+Henning and I met with Tracy the next day. Tracy said her company was willing to publish copyable excerpts in a unencrypted format but would limit the excerpts to 500 words. Henning informed her that this wouldn't be enough for me to get around my ethical obligation to Stallman. Tracy mentioned her own company's contractual obligation to online vendors such as Amazon.com. Even if the company decided to open up its e-book content this one time, it faced the risk of its partners calling it a breach of contract. Barring a change of heart in the executive suite or on the part of Stallman, the decision was up tome. I could use the interviews and go against my earlier agreement with Stallman, or I could plead journalistic ethics and back out of the verbal agreement to do the book.
+={Amazon.com}
+
+Following the meeting, my agent and I relocated to a pub on Third Ave. I used his cell phone to call Stallman, leaving a message when nobody answered. Henning left for a moment, giving me time to collect my thoughts. When he returned, he was holding up the cell phone.
+
+"It's Stallman," Henning said.
+
+The conversation got off badly from the start. I relayed Tracy's comment about the publisher's contractual obligations.
+
+"So," Stallman said bluntly. "Why should I give a damn about their contractual obligations?"
+
+Because asking a major publishing house to risk a legal battle with its vendors over a 30,000-word e-book is a tall order, I suggested. [RMS: His unstated premise was that I couldn't possibly refuse this deal for mere principle.]
+
+"Don't you see?" Stallman said. "That's exactly why I'm doing this. I want a signal victory. I want them to make a choice between freedom and business as usual."
+
+As the words "signal victory" echoed in my head, I felt my attention wander momentarily to the passing foot traffic on the sidewalk. Coming into the bar, I had been pleased to notice that the location was less than half a block away from the street corner memorialized in the 1976 Ramones song, "53rd and 3rd," a song I always enjoyed playing in my days as a musician. Like the perpetually frustrated street hustler depicted in that song, I could feel things falling apart as quickly as they had come together. The irony was palpable. After weeks of gleefully recording other people's laments, I found myself in the position of trying to pull off the rarest of feats: a Richard Stallman compromise. When I continued hemming and hawing, pleading the publisher's position and revealing my growing sympathy for it,Stallman, like an animal smelling blood, attacked.
+
+"So that's it? You're just going to screw me? You're just going to bend to their will?"
+
+[RMS: The quotations show that Williams' interpretation of this conversation was totally wrong. He compares me to a predator, but I was only saying no to the deal he was badgering me to accept.I had already made several compromises, some described above; I just refused to compromise my principles entirely away. I often do this; people who aren't satisfied say I "refused to compromise at all, "but that is an exaggeration; \\ see http://www.gnu.org/philosophy/compromise.html. Then I feared he was going to disregard the conditions he had previously agreed to, and publish the book with DRM despite my refusal. What I smelled was not his "blood" but possible betrayal.]
+
+I brought up the issue of a dual-copyright again.
+
+"You mean license," Stallman said curtly.
+
+"Yeah, license. Copyright. Whatever," I said, feeling suddenly like a wounded tuna trailing a rich plume of plasma in the water.
+
+"Aw, why didn't you just fucking do what I told you to do!" he shouted. [RMS: I think this quotation was garbled, both because using "fucking" as an adverb was never part of my speech pattern, and because the words do not fit the circumstances. The words he quotes are a rebuke to a disobedient subordinate. I felt he had an ethical obligation, but he was not my subordinate, and I would not have spoken to him as one. Using notes rather than a recorder, he could not reliably retain the exact words.]
+
+I must have been arguing on behalf of the publisher to the very end, because in my notes I managed to save a final Stallman chestnut: "I don't care. What they're doing is evil. I can't support evil. Goodbye." [RMS: It sounds like I had concluded that he would never take no for an answer, and the only way to end the conversation without accepting his proposition was to hang up on him.]
+
+As soon as I put the phone down, my agent slid a freshly poured Guinness to me. "I figured you might need this," he said with a laugh. "I could see you shaking there towards the end."
+
+I was indeed shaking. The shaking wouldn't stop until the Guinness was more than halfway gone. It felt weird, hearing myself characterized as an emissary of "evil." [RMS: My words as quoted criticize the publisher, not Williams personally. If he took it personally, perhaps that indicates he was starting to take ethical responsibility for the deal he had pressed me to accept.] It felt weirder still, knowing that three months before, I was sitting in an Oakland apartment trying to come up with my next story idea. Now, I was sitting in a part of the world I'd only known through rock songs, taking meetings with publishing executives and drinking beer with an agent I'd never even laid eyes on until the day before. It was all too surreal, like watching my life reflected back as a movie montage.
+
+About that time, my internal absurdity meter kicked in. The initial shaking gave way to convulsions of laughter. To my agent, I must have looked like a another fragile author undergoing an untimely emotional breakdown. To me, I was just starting to appreciate the cynical beauty of my situation. Deal or no deal, I already had the makings of a pretty good story. It was only a matter of finding a place to tell it. When my laughing convulsions finally subsided, I held up my drink in a toast.
+
+"Welcome to the front lines, my friend," I said, clinking pints with my agent. "Might as well enjoy it."
+
+If this story really were a play, here's where it would take a momentary, romantic interlude. Disheartened by the tense nature of our meeting, Tracy invited Henning and me to go out for drinks with her and some of her coworkers. We left the bar on Third Ave., headed down to the East Village, and caught up with Tracy and her friends.
+
+Once there, I spoke with Tracy, careful to avoid shop talk. Our conversation was pleasant, relaxed. Before parting, we agreed to meet the next night. Once again, the conversation was pleasant, so pleasant that the Stallman e-book became almost a distant memory.
+
+When I got back to Oakland, I called around to various journalist friends and acquaintances. I recounted my predicament. Most upbraided me for giving up too much ground to Stallman in the pre-interview negotiation. [RMS: Those who have read the whole book know that I would never have dropped the conditions.] A former j-school professor suggested I ignore Stallman's "hypocrite" comment and just write the story. Reporters who knew of Stallman's media-savviness ex-pressed sympathy but uniformly offered the same response: it's your call.
+
+I decided to put the book on the back burner. Even with the interviews, I wasn't making much progress. Besides, it gave me a chance to speak with Tracy without running things past Henning first.By Christmas we had traded visits: she flying out to the west coast once, me flying out to New York a second time. The day before New Year's Eve, I proposed. Deciding which coast to live on, I picked New York. By February, I packed up my laptop computer and all my research notes related to the Stallman biography, and we winged our way to JFK Airport. Tracy and I were married on May 11. So much for failed book deals.
+
+During the summer, I began to contemplate turning my interview notes into a magazine article. Ethically, I felt in the clear doing so,since the original interview terms said nothing about traditional print media. To be honest, I also felt a bit more comfortable writing about Stallman after eight months of radio silence. Since our telephone conversation in September, I'd only received two emails from Stallman.Both chastised me for using "Linux" instead of "GNU/Linux" in a pair of articles for the web magazine /{Upside Today}/. Aside from that, I had enjoyed the silence. In June, about a week after the New York University speech, I took a crack at writing a 5,000-word magazine-length story about Stallman. This time, the words flowed. The distance had helped restore my lost sense of emotional perspective, I suppose.
+={Upside Today web magazine}
+
+In July, a full year after the original email from Tracy, I got a call from Henning. He told me that O'Reilly & Associates, a publishing house out of Sebastopol, California, was interested in the running the Stallman story as a biography. [RMS: I have a vague memory that I suggested contacting O'Reilly, but I can't be sure after all these years.] The news pleased me. Of all the publishing houses in the world, O'Reilly, the same company that had published Eric Raymond's /{The Cathedral and the Bazaar}/, seemed the most sensitive to the issues that had killed the earlier e-book. As a reporter, I had relied heavily on the O'Reilly book /{Open Sources}/ as a historical reference. I also knew that various chapters of the book, including a chapter written by Stallman, had been published with [license] notices that permitted redistribution. Such knowledge would come in handy if the issue of electronic publication ever came up again.
+={Cathedral and the Bazaar, The (Raymond);O'Reilly & Associates;Open Sources (DiBona, et al)+2;Raymond, Eric}
+
+Sure enough, the issue did come up. I learned through Henning that O'Reilly intended to publish the biography both as a book and as part of its new Safari Tech Books Online subscription service. The Safari user license would involve special restrictions,~{ See "Safari Tech Books Online; Subscriber Agreement: Terms of Service" \\ http://my.safaribooksonline.com/termsofservice. As of December, 2009, the see-books require non-free reader software, so people should refuse to use them. }~ Henning warned, but O'Reilly was willing to allow for a copyright that permitted users to copy and share the book's text regardless of medium. Basically, as author, I had the choice between two licenses: the Open Publication License or the GNU Free Documentation License.
+={Open Publication License (OPL)+8;OPL (Open Publication License)+8;Safari Tech Books Online subscription service}
+
+I checked out the contents and background of each license. The Open Publication License (OPL)~{ See "The Open Publication License: Draft v1.0" (June 8, 1999), \\ http://opencontent.org/openpub/. }~ gives readers the right to reproduce and distribute a work, in whole or in part, in any medium "physical or electronic," provided the copied work retains the Open Publication License. It also permits modification of a work, provided certain conditions are met. Finally, the Open Publication License includes a number of options, which, if selected by the author, can limit the creation of "substantively modified" versions or book-form derivatives without prior author approval.
+
+The GNU Free Documentation License (GFDL), meanwhile, permits the copying and distribution of a document in any medium, provided the resulting work carries the same license.~{ See "The GNU Free Documentation License: Version 1.3" (November, 2008), \\ http://www.gnu.org/copyleft/fdl.html. }~
+={GFDL (GNU Free Documentation License)+1;GNU Free Documentation License (GFDL)+1}
+
+It also permits the modification of a document provided certain conditions. Unlike the OPL, however, it does not give authors the option to restrict certain modifications. It also does not give authors the right to reject modifications that might result in a competitive book product. It does require certain forms of front - and back-cover information if a party other than the copyright holder wishes to publish more than 100 copies of a protected work, however.
+
+In the course of researching the licenses, I also made sure to visit the GNU Project web page titled "Various Licenses and Comments About Them."~{ See http://www.gnu.org/philosophy/license-list.html. }~
+
+On that page, I found a Stallman critique of the Open Publication License. Stallman's critique related to the creation of modified works and the ability of an author to select either one of the OPL's options to restrict modification. If an author didn't want to select either option, it was better to use the GFDL instead, Stallman noted, since it minimized the risk of the non-selected options popping up in modified versions of a document.
+
+The importance of modification in both licenses was a reflection of their original purpose - namely, to give software-manual owners a chance to improve their manuals and publicize those improvements to the rest of the community. Since my book wasn't a manual, I had little concern about the modification clause in either license. My only concern was giving users the freedom to exchange copies of the book or make copies of the content, the same freedom they would have enjoyed if they purchased a hardcover book. Deeming either license suitable for this purpose, I signed the O'Reilly contract when it came to me.
+
+Still, the notion of unrestricted modification intrigued me. In my early negotiations with Tracy, I had pitched the merits of a GPL-style license for the e-book's content. At worst, I said, the license would guarantee a lot of positive publicity for the e-book. At best, it would encourage readers to participate in the book-writing process. As an author, I was willing to let other people amend my work just so long as my name always got top billing. Besides, it might even be interesting to watch the book evolve. I pictured later editions looking much like online versions of the /{Talmud}/, my original text in a central column surrounded by illuminating, third-party commentary in the margins.
+
+My idea drew inspiration from Project Xanadu (http://www.xanadu.com), the legendary software concept originally conceived by Ted Nelson in 1960. During the O'Reilly Open Source Conference in 1999, I had seen the first demonstration of the project's [free] offshoot Udanax and had been wowed by the result. In one demonstration sequence, Udanax displayed a parent document and a derivative work in a similar two-column, plain-text format. With a click of the button, the program introduced lines linking each sentence in the parent to its conceptual offshoot in the derivative. An e-book biography of Richard M. Stallman didn't have to be Udanax-enabled, but given such technological possibilities, why not give users a chance to play around?~{ Anybody willing to "port" this book over to Udanax, the free software version of Xanadu, will receive enthusiastic support from me. To find out more about this intriguing technology, \\ visit http://www.udanax.com. }~
+={Nelson, Ted;O'Reilly & Associates:Open Source Conferences;Project Xanadu;Udanax}
+
+When Laurie Petrycki, my editor at O'Reilly, gave me a choice be-tween the OPL or the GFDL, I indulged the fantasy once again. By September of 2001, the month I signed the contract, e-books had become almost a dead topic. Many publishing houses, Tracy's included,were shutting down their e-book imprints for lack of interest. I had to wonder. If these companies had treated e-books not as a form of publication but as a form of community building, would those imprints have survived?
+={GFDL (GNU Free Documentation License)+1;GNU Free Documentation License (GFDL)+1;Petrycki, Laurie}
+
+After I signed the contract, I notified Stallman that the book project was back on. I mentioned the choice O'Reilly was giving me between the Open Publication License and the GNU Free Documentation License. I told him I was leaning toward the OPL, if only for the fact I saw no reason to give O'Reilly's competitors a chance to print the same book under a different cover. Stallman wrote back, arguing in favor of the GFDL, noting that O'Reilly had already used it several times in the past. Despite the events of the past year, I suggested a deal. I would choose the GFDL if it gave me the possibility to do more interviews and if Stallman agreed to help O'Reilly publicize the book. Stallman agreed to participate in more interviews but said that his participation in publicity-related events would depend on the content of the book. Viewing this as only fair, I set up an interview for December 17, 2001 in Cambridge.
+
+I set up the interview to coincide with a business trip my wife Tracy was taking to Boston. Two days before leaving, Tracy suggested I invite Stallman out to dinner.
+
+"After all," she said, "he is the one who brought us together."I sent an email to Stallman, who promptly sent a return email accepting the offer. When I drove up to Boston the next day, I met Tracy at her hotel and hopped the T to head over to MIT. When we got to Tech Square, I found Stallman in the middle of a conversation just as we knocked on the door.
+
+"I hope you don't mind," he said, pulling the door open far enough so that Tracy and I could just barely hear Stallman's conversational counterpart. It was a youngish woman, mid-20s I'd say, named Sarah.
+
+"I took the liberty of inviting somebody else to have dinner with us," Stallman said, matter-of-factly, giving me the same catlike smile he gave me back in that Palo Alto restaurant.
+
+To be honest, I wasn't too surprised. The news that Stallman had a new female friend had reached me a few weeks before, courtesy of Stallman's mother. "In fact, they both went to Japan last month when Richard went over to accept the Takeda Award," Lippman told me at the time.~{ Alas, I didn't find out about the Takeda Foundation's decision to award Stallman, along with Linus Torvalds and Ken Sakamura, with its first-ever award for"Techno-Entrepreneurial Achievement for Social/Economic Well-Being" until after Stallman had made the trip to Japan to accept the award. For more information about the award and its accompanying $1 million prize, visit the Takeda site, \\ http://www.takeda-foundation.jp. }~
+={Takeda Awards}
+
+On the way over to the restaurant, I learned the circumstances of Sarah and Richard's first meeting. Interestingly, the circumstances were very familiar. Working on her own fictional book, Sarah said she heard about Stallman and what an interesting character he was. She promptly decided to create a character in her book on Stallman and,in the interests of researching the character, set up an interview with Stallman. Things quickly went from there. The two had been dating since the beginning of 2001, she said.
+
+"I really admired the way Richard built up an entire political movement to address an issue of profound personal concern," Sarah said,explaining her attraction to Stallman.
+
+My wife immediately threw back the question: "What was the issue?" "Crushing loneliness." During dinner, I let the women do the talking and spent most of the time trying to detect clues as to whether the last 12 months had softened Stallman in any significant way. I didn't see anything to suggest they had. Although more flirtatious than I remembered,Stallman retained the same general level of prickliness. At one point,my wife uttered an emphatic "God forbid" only to receive a typical Stallman rebuke.
+
+"I hate to break it to you, but there is no God," Stallman said.[RMS: I must have been too deadpan. He could justly accuse me of being a wise guy, but not of rebuking.]
+
+Afterwards, when the dinner was complete and Sarah had departed, Stallman seemed to let his guard down a little. As we walked to a nearby bookstore, he admitted that the last 12 months had dramatically changed his outlook on life. "I thought I was going to be alone forever," he said. "I'm glad I was wrong."
+
+Before parting, Stallman handed me his "pleasure card," a business card listing Stallman's address, phone number, and favorite pastimes("sharing good books, good food and exotic music and dance") so that I might set up a final interview.
+
+The next day, over another meal of dim sum, Stallman seemed even more lovestruck than the night before. Recalling his debates with Currier House dorm maters over the benefits and drawbacks of an immortality serum, Stallman expressed hope that scientists might some day come up with the key to immortality. "Now that I'm finally starting to have happiness in my life, I want to have [a longer life]," he said.
+
+When I mentioned Sarah's "crushing loneliness" comment, Stallman failed to see a connection between loneliness on a physical or spiritual level and loneliness on a hacker level. "The impulse to share code is about friendship but friendship at a much lower level," he said. Later, however, when the subject came up again, Stallman did admit that loneliness, or the fear of perpetual loneliness [RMS: at the hacker-to-hacker, community level, that is], had played a major role in fueling his determination during the earliest days of the GNU Project.
+
+"My fascination with computers was not a consequence of anything else," he said. "I wouldn't have been less fascinated with computers if I had been popular and all the women flocked to me. However, it's certainly true the experience of feeling I didn't have a home, finding one and losing it, finding another and having it destroyed, affected me deeply. The one I lost was the dorm. The one that was destroyed was the AI Lab. The precariousness of not having any kind of home or community was very powerful. It made me want to fight to get it back."
+
+After the interview, I couldn't help but feel a certain sense of emotional symmetry. Hearing Sarah describe what attracted her to Stallman and hearing Stallman himself describe the emotions that prompted him to take up the free software cause, I was reminded of my own reasons for writing this book. Since July, 2000, I have learned to appreciate both the seductive and the repellent sides of the Richard Stallman persona. Like Eben Moglen before me, I feel that dismissing that persona as epiphenomenal or distracting in relation to the overall free software movement would be a grievous mistake. In many ways the two are so mutually defining as to be indistinguishable.
+
+[RMS: Williams objectifies his reactions, both positive and negative, as parts of me, but they are functions also of his own attitudes about appearance, conformity, and business success.]
+
+While I'm sure not every reader feels the same level of affinity for Stallman...I'm sure most will agree [that] few individuals offer as singular a human portrait as Richard M. Stallman. It is my sincere hope that, with this initial portrait complete and with the help of the GFDL, others will feel a similar urge to add their own perspective to that portrait.
+
+Endnotes
+
+1~ Appendix A - Hack, Hackers and Hacking
+={hackers+18}
+
+To understand the full meaning of the word "hacker," it helps to examine the word's etymology over the years.
+
+/{The New Hacker Dictionary}/, an online compendium of software-programmer jargon, officially lists nine different connotations of the word "hack" and a similar number for "hacker." Then again, the same publication also includes an accompanying essay that quotes Phil Agre, an MIT hacker who warns readers not to be fooled by the word's perceived flexibility. "Hack has only one meaning," argues Agre. "An extremely subtle and profound one which defies articulation." Richard Stallman tries to articulate it with the phrase, "Playful cleverness."
+={Agre, Phil;New Hacker Dictionary, The}
+
+Regardless of the width or narrowness of the definition, most modern hackers trace the word back to MIT, where the term bubbled upas popular item of student jargon in the early 1950s. In 1990 the MIT Museum put together a journal documenting the hacking phenomenon.According to the journal, students who attended the institute during the fifties used the word "hack" the way a modern student might use the word "goof." Hanging a jalopy out a dormitory window was a "hack," but anything harsh or malicious - e.g., egging a rival dorm's windows or defacing a campus statue - fell outside the bounds. Implicit within the definition of "hack" was a spirit of harmless, creative fun.
+={MIT Museum}
+
+This spirit would inspire the word's gerund form: "hacking." A 1950s student who spent the better part of the afternoon talking on the phone or dismantling a radio might describe the activity as "hacking." Again, a modern speaker would substitute the verb form of "goof" -"goofing" or "goofing off" - to describe the same activity.
+
+As the 1950s progressed, the word "hack" acquired a sharper, more rebellious edge. The MIT of the 1950s was overly competitive, and hacking emerged as both a reaction to and extension of that competitive culture. Goofs and pranks suddenly became a way to blow off steam, thumb one's nose at campus administration, and indulge creative thinking and behavior stifled by the Institute's rigorous undergraduate curriculum. With its myriad hallways and underground steam tunnels, the Institute offered plenty of exploration opportunities for the student undaunted by locked doors and "No Trespassing"signs. Students began to refer to their off-limits explorations as "tunnel hacking." Above ground, the campus phone system offered similar opportunities. Through casual experimentation and due diligence, students learned how to perform humorous tricks. Drawing inspiration from the more traditional pursuit of tunnel hacking, students quickly dubbed this new activity "phone hacking."
+
+The combined emphasis on creative play and restriction-free exploration would serve as the basis for the future mutations of the hacking term. The first self-described computer hackers of the 1960s MIT campus originated from a late 1950s student group called the Tech Model Railroad Club. A tight clique within the club was the Signals and Power (S&P) Committee - the group behind the railroad club's electrical circuitry system. The system was a sophisticated assortment of relays and switches similar to the kind that controlled the local cam-pus phone system. To control it, a member of the group simply dialed in commands via a connected phone and watched the trains do his bidding.
+={Tech Model Railroad Club;S&P (Signals and Power) Committee+2;Signals and Power (S&P) Committee+2}
+
+The nascent electrical engineers responsible for building and maintaining this system saw their activity as similar in spirit to phone hacking. Adopting the hacking term, they began refining it even further. From the S&P hacker point of view, using one less relay to operate a particular stretch of track meant having one more relay for future play. Hacking subtly shifted from a synonym for idle play to a synonym for idle play that improved the overall performance or efficiency of the club's railroad system at the same time. Soon S&P committee members proudly referred to the entire activity of improving and reshaping the track's underlying circuitry as "hacking" and to the people who did it as "hackers."
+
+Given their affinity for sophisticated electronics - not to mention the traditional MIT-student disregard for closed doors and "No Trespassing" signs - it didn't take long before the hackers caught wind of a new machine on campus. Dubbed the TX-0, the machine was one of the first commercially marketed computers. By the end of the 1950s, the entire S&P clique had migrated en masse over to the TX-0 control room, bringing the spirit of creative play with them.The wide-open realm of computer programming would encourage yet another mutation in etymology. "To hack" no longer meant soldering unusual looking circuits, but cobbling together software programs with little regard to "official" methods or software-writing procedures. It also meant improving the efficiency and speed of already-existing pro-grams that tended to hog up machine resources. True to the word's roots, it also meant writing programs that served no other purpose than to amuse or entertain.
+={TX-0 computer}
+
+A classic example of this expanded hacking definition is the game Spacewar, the first computer-based video game. Developed by MIT hackers in the early 1960s, Spacewar had all the traditional hacking definitions: it was goofy and random, serving little useful purpose other than providing a nightly distraction for the dozen or so hackers who delighted in playing it. From a software perspective, however,it was a monumental testament to innovation of programming skill.It was also completely free. Because hackers had built it for fun,they saw no reason to guard their creation, sharing it extensively with other programmers. By the end of the 1960s, Spacewar had become a diversion for programmers around the world, if they had the (then rather rare) graphical displays.
+
+This notion of collective innovation and communal software ownership distanced the act of computer hacking in the 1960s from the tunnel hacking and phone hacking of the 1950s. The latter pursuits tended to be solo or small-group activities. Tunnel and phone hackers relied heavily on campus lore, but the off-limits nature of their activity discouraged the open circulation of new discoveries. Computer hackers, on the other hand, did their work amid a scientific field biased toward collaboration and the rewarding of innovation. Hackers and "official" computer scientists weren't always the best of allies, but in the rapid evolution of the field, the two species of computer programmer evolved a cooperative - some might say symbiotic - relationship.
+
+Hackers had little respect for bureaucrats' rules. They regarded computer security systems that obstructed access to the machine as just another bug, to be worked around or fixed if possible. Thus,breaking security (but not for malicious purposes) was a recognized aspect of hacking in 1970, useful for practical jokes (the victim might say, "I think someone's hacking me") as well as for gaining access to the computer. But it was not central to the idea of hacking. Where there was a security obstacle, hackers were proud to display their wits in surmounting it; however, given the choice, as at the MIT AI Lab,they chose to have no obstacle and do other kinds of hacking. Where there is no security, nobody needs to break it.
+
+It is a testament to the original computer hackers' prodigious skill that later programmers, including Richard M. Stallman, aspired to wear the same hacker mantle. By the mid to late 1970s, the term"hacker" had acquired elite connotations. In a general sense, a computer hacker was any person who wrote software code for the sake of writing software code. In the particular sense, however, it was a testament to programming skill. Like the term "artist," the meaning carried tribal overtones. To describe a fellow programmer as a hacker was a sign of respect. To describe oneself as a hacker was a sign of immense personal confidence. Either way, the original looseness of the computer-hacker appellation diminished as computers became more common.
+
+As the definition tightened, "computer" hacking acquired additional semantic overtones. The hackers at the MIT AI Lab shared many other characteristics, including love of Chinese food, disgust for tobacco smoke, and avoidance of alcohol, tobacco and other addictive drugs. These characteristics became part of some people's under-standing of what it meant to be a hacker, and the community exerted an influence on newcomers even though it did not demand conformity. However, these cultural associations disappeared with the AI Lab hacker community. Today, most hackers resemble the surrounding society on these points.
+
+As the hackers at elite institutions such as MIT, Stanford, and Carnegie Mellon conversed about hacks they admired, they also considered the ethics of their activity, and began to speak openly of a "hacker ethic": the yet-unwritten rules that governed a hacker's day-to-day behavior. In the 1984 book /{Hackers}/, author Steven Levy, after much research and consultation, codified the hacker ethic as five core hacker tenets.
+={Hackers (Levy)+1}
+
+In the 1980s, computer use expanded greatly, and so did security breaking. Mostly it was done by insiders with criminal intent, who were generally not hackers at all. However, occasionally the police and administrators, who defined disobedience as evil, traced a computer "intrusion" back to a hacker whose idea of ethics was "Don't hurt people." Journalists published articles in which "hacking" meant breaking security, and usually endorsed the administrators' view of the matter. Although books like /{Hackers}/ did much to document the original spirit of exploration that gave rise to the hacking culture, for most newspaper reporters and readers the term "computer hacker"became a synonym for "electronic burglar."
+
+By the late 1980s, many U.S. teenagers had access to computers.Some were alienated from society; inspired by journalists' distorted picture of "hacking," they expressed their resentment by breaking computer security much as other alienated teens might have done it by breaking windows. They began to call themselves "hackers," but they never learned the MIT hackers' principle against malicious behavior.As younger programmers began employing their computer skills to harmful ends - creating and disseminating computer viruses, breaking into computer systems for mischief, deliberately causing computers to crash - the term "hacker" acquired a punk, nihilistic edge which attracted more people with similar attitudes.
+
+Hackers have railed against this perceived mis-usage of their self-designator for nearly two decades. Stallman, not one to take things lying down, coined the term "cracking" for "security breaking" so that people could more easily avoid calling it "hacking." But the distinction between hacking and cracking is often misunderstood. These two descriptive terms are not meant to be exclusive. It's not that "Hacking is here, and cracking is there, and never the twain shall meet." Hacking and cracking are different attributes of activities, just as "young"and "tall" are different attributes of persons.
+
+Most hacking does not involve security, so it is not cracking. Most cracking is done for profit or malice and not in a playful spirit, so it is not hacking. Once in a while a single act may qualify as cracking and as hacking, but that is not the usual case. The hacker spirit includes irreverence for rules, but most hacks do not break rules. Cracking is by definition disobedience, but it is not necessarily malicious or harmful. The computer security field distinguishes between "black hat"and "white hat" crackers - i.e., crackers who turn toward destructive,malicious ends versus those who probe security in order to fix it.
+
+The hacker's central principle not to be malicious remains the primary cultural link between the notion of hacking in the early 21st century and hacking in the 1950s. It is important to note that, as the idea of computer hacking has evolved over the last four decades,the original notion of hacking - i.e., performing pranks or exploring underground tunnels - remains intact. In the fall of 2000, the MIT Museum paid tribute to the Institute's age-old hacking tradition with a dedicated exhibit, the Hall of Hacks. The exhibit includes a number of photographs dating back to the 1920s, including one involving amock police cruiser. In 1993, students paid homage to the original MIT notion of hacking by placing the same police cruiser, lights flashing, atop the Institute's main dome. The cruiser's vanity license plate read IHTFP, a popular MIT acronym with many meanings. The most noteworthy version, itself dating back to the pressure-filled world of MIT student life in the 1950s, is "I hate this fucking place." In 1990,however, the Museum used the acronym as a basis for a journal on the history of hacks. Titled /{The Journal of the Institute for Hacks,Tomfoolery, and Pranks}/, it offers an adept summary of the hacking.
+={Hall of Hacks}
+
+"In the culture of hacking, an elegant, simple creation is as highly valued as it is in pure science," writes /{Boston Globe}/ reporter Randolph Ryan in a 1993 article attached to the police car exhibit. "A Hack differs from the ordinary college prank in that the event usually requires careful planning, engineering and finesse, and has an under-lying wit and inventiveness," Ryan writes. "The unwritten rule holds that a hack should be good-natured, non-destructive and safe. In fact,hackers sometimes assist in dismantling their own handiwork."
+={Boston Globe;Ryan, Randolph}
+
+The urge to confine the culture of computer hacking within the same ethical boundaries is well-meaning but impossible. Although most software hacks aspire to the same spirit of elegance and simplicity,the software medium offers less chance for reversibility. Dismantling a police cruiser is easy compared with dismantling an idea, especially an idea whose time has come.
+
+Once a vague item of obscure student jargon, the word "hacker" has become a linguistic billiard ball, subject to political spin and ethical nuances. Perhaps this is why so many hackers and journalists enjoy using it. We cannot predict how people will use the word in the future.We can, however, decide how we will use it ourselves. Using the term "cracking" rather than "hacking," when you mean "security breaking,"shows respect for Stallman and all the hackers mentioned in this book,and helps preserve something which all computer users have benefited from: the hacker spirit.
+={crackers}
+
+1~ Appendix B - GNU Free Documentation License
+={GFDL (GNU Free Documentation License)+64;GNU Free Documentation License (GFDL)+64}
+
+Version 1.3, 3 November 2008
+
+Copyright © 2000, 2001, 2002, 2007, 2008 Free Software Foundation
+
+http://fsf.org/
+
+Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
+
+2~ Preamble
+
+The purpose of this License is to make a manual, textbook, or other functional and useful document "free" in the sense of freedom:to assure everyone the effective freedom to copy and redistribute it,with or without modifying it, either commercially or non-commercially.Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others.
+
+This License is a kind of "copyleft", which means that derivative works of the document must themselves be free in the same sense.It complements the GNU General Public License, which is a copyleft license designed for free software.
+
+We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals;it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference.
+
+2~ 1. APPLICABILITY AND DEFINITIONS
+
+This License applies to any manual or other work, in any medium,that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License. Such a notice grants a world-wide, royalty-free license, unlimited in duration, to use that work under the conditions stated herein. The "!{Document}!", below,refers to any such manual or work. Any member of the public is a licensee, and is addressed as "!{you}!". You accept the license if you copy, modify or distribute the work in a way requiring permission under copyright law.
+
+A "!{Modified Version}!" of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language.
+
+A "!{Secondary Section}!" is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document's overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (Thus, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial,philosophical, ethical or political position regarding them.
+
+The "!{Invariant Sections}!" are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License. If a section does not fit the above definition of Secondary then it is not allowed to be designated as Invariant. The Document may contain zero Invariant Sections. If the Document does not identify any Invariant Sections then there are none.
+
+The "!{Cover Texts}!" are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License. A Front-Cover Text may be at most 5 words, and a Back-Cover Text may be at most 25 words.
+
+A "!{Transparent}!" copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, that is suitable for revising the document straight forwardly with generic text editors or (for images composed of pixels) generic paint programs or (for drawings) some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose markup, or absence of markup, has been arranged to thwart or discourage subsequent modification by readers is not Transparent. An image format is not Transparent if used for any substantial amount of text. A copy that is not "Transparent" is called "!{Opaque}!".
+
+Examples of suitable formats for Transparent copies include plain ASCII without markup, Texinfo input format, LaTeX input format, SGML or XML using a publicly available DTD, and standard-conforming simple HTML, PostScript or PDF designed for human modification. Examples of transparent image formats include PNG, XCF and JPG. Opaque formats include proprietary formats that can be read and edited only by proprietary word processors, SGML or XML for which the DTD and/or processing tools are not generally available, and the machine-generated HTML, PostScript or PDF produced by some word processors for output purposes only.
+
+The "!{Title Page}!" means, for a printed book, the title page itself,plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For works in formats which do not have any title page as such, "Title Page" means the text near the most prominent appearance of the work's title, preceding the beginning of the body of the text.
+
+The "!{publisher}!" means any person or entity that distributes copies of the Document to the public.
+
+A section "!{Entitled XYZ}!" means a named subunit of the Document whose title either is precisely XYZ or contains XYZ in parentheses following text that translates XYZ in another language. (Here XYZ stands for a specific section name mentioned below, such as"!{Acknowledgements}!", "!{Dedications}!", "!{Endorsements}!", or "!{History}!".)
+
+To "!{Preserve the Title}!" of such a section when you modify the Document means that it remains a section "Entitled XYZ" according to this definition.
+
+The Document may include Warranty Disclaimers next to the notice which states that this License applies to the Document. These Warranty Disclaimers are considered to be included by reference in this License, but only as regards disclaiming warranties: any other implication that these Warranty Disclaimers may have is void and has no effect on the meaning of this License.
+
+2~ 2. VERBATIM COPYING
+
+You may copy and distribute the Document in any medium, either commercially or non-commercially, provided that this License, the copyright notices, and the license notice saying this License applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough number of copies you must also follow the conditions in section 3.
+
+You may also lend copies, under the same conditions stated above,and you may publicly display copies.
+
+
+2~ 3. COPYING IN QUANTITY
+
+If you publish printed copies (or copies in media that commonly have printed covers) of the Document, numbering more than 100, and the Document's license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The front cover must present the full title with all words of the title equally prominent and visible. You may add other material on the covers in addition. Copying with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects.
+
+If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages.
+
+If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a computer-network location from which the general network-using public has access to download using public-standard network protocols a complete Transparent copy of the Document, free of added material. If you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that edition to the public.
+
+It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document.
+
+2~ 4. MODIFICATIONS
+
+You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it. In addition, you must do these things in the Modified Version:
+
+A. Use in the Title Page (and on the covers, if any) a title distinct from that of the Document, and from those of previous versions (which should, if there were any, be listed in the History section of the Document). You may use the same title as a previous version if the original publisher of that version gives permission.
+
+B. List on the Title Page, as authors, one or more persons or entities responsible for authorship of the modifications in the Modified Version, together with at least five of the principal authors of the Document (all of its principal authors, if it has fewer than five), unless they release you from this requirement.
+
+C. State on the Title page the name of the publisher of the Modified Version, as the publisher.
+
+D. Preserve all the copyright notices of the Document.
+
+E. Add an appropriate copyright notice for your modifications adjacent to the other copyright notices.
+
+F. Include, immediately after the copyright notices, a license notice giving the public permission to use the Modified Version under the terms of this License, in the form shown in the Addendum below.
+
+G. Preserve in that license notice the full lists of Invariant Sections and required Cover Texts given in the Document's license notice.
+
+H. Include an unaltered copy of this License.
+
+I. Preserve the section Entitled "History", Preserve its Title, and add to it an item stating at least the title, year, new authors,and publisher of the Modified Version as given on the Title Page.If there is no section Entitled "History" in the Document, create one stating the title, year, authors, and publisher of the Document as given on its Title Page, then add an item describing the Modified Version as stated in the previous sentence.
+
+J. Preserve the network location, if any, given in the Document for public access to a Transparent copy of the Document, and likewise the network locations given in the Document for previous versions it was based on. These may be placed in the "History" section. You may omit a network location for a work that was published at least four years before the Document itself, or if the original publisher of the version it refers to gives permission.
+
+K. For any section Entitled "Acknowledgements" or "Dedications",Preserve the Title of the section, and preserve in the section all the substance and tone of each of the contributor acknowledgements and/or dedications given therein.
+
+
+L. Preserve all the Invariant Sections of the Document, unaltered in their text and in their titles. Section numbers or the equivalent are not considered part of the section titles.
+
+M. Delete any section Entitled "Endorsements". Such a section may not be included in the Modified Version.
+
+N. Do not re-title any existing section to be Entitled "Endorsements"or to conflict in title with any Invariant Section.
+
+O. Preserve any Warranty Disclaimers.
+
+If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version's license notice. These titles must be distinct from any other section titles.
+
+You may add a section Entitled "Endorsements", provided it contains nothing but endorsements of your Modified Version by various parties-for example, statements of peer review or that the text has been approved by an organization as the authoritative definition of a standard.
+
+You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on explicit permission from the previous publisher that added the old one.
+
+The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version.
+
+2~ 5. COMBINING DOCUMENTS
+
+You may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice, and that you preserve all their Warranty Disclaimers.
+
+The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number. Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work.
+
+In the combination, you must combine any sections Entitled "History" in the various original documents, forming one section Entitled "History"; likewise combine any sections Entitled "Acknowledgements", and any sections Entitled "Dedications". You must delete all sections Entitled "Endorsements".
+
+2~ 6. COLLECTIONS OF DOCUMENTS
+
+You may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects.
+
+You may extract a single document from such a collection, and distribute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document.
+
+2~ 7. AGGREGATION WITH INDEPENDENT WORKS
+
+A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, is called an "aggregate" if the copyright resulting from the compilation is not used to limit the legal rights of the compilation's users beyond what the individual works permit.When the Document is included in an aggregate, this License does not apply to the other works in the aggregate which are not themselves derivative works of the Document.
+
+If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one half of the entire aggregate, the Document's Cover Texts may be placed on covers that bracket the Document within the aggregate, or the electronic equivalent of covers if the Document is in electronic form.Otherwise they must appear on printed covers that bracket the whole aggregate.
+
+2~ 8. TRANSLATION
+
+Translation is considered a kind of modification, so you may distribute translations of the Document under the terms of section 4.Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections. You may include a translation of this License,and all the license notices in the Document, and any Warranty Disclaimers, provided that you also include the original English version of this License and the original versions of those notices and disclaimers.In case of a disagreement between the translation and the original version of this License or a notice or disclaimer, the original version will prevail.
+
+If a section in the Document is Entitled "Acknowledgements","Dedications", or "History", the requirement (section 4) to Preserve its Title (section 1) will typically require changing the actual title.
+
+2~ 9. TERMINATION
+
+You may not copy, modify, sublicense, or distribute the Document except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, or distribute it is void, and will automatically terminate your rights under this License.
+
+However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
+
+Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
+
+Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, receipt of a copy of some or all of the same material does not give you any rights to use it.
+
+2~ 10. FUTURE REVISIONS OF THIS LICENSE
+
+The Free Software Foundation may publish new, revised versions of the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. \\ See http://www.gnu.org/copyleft/.
+
+Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License "or any later version" applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published(not as a draft) by the Free Software Foundation. If the Document specifies that a proxy can decide which future versions of this License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Document.
+
+2~ 11. RELICENSING
+
+"Massive Multi-author Collaboration Site" (or "MMC Site") means any World Wide Web server that publishes copyrightable works and also provides prominent facilities for anybody to edit those works. A public wiki that anybody can edit is an example of such a server. A"Massive Multi-author Collaboration" (or "MMC") contained in the site means any set of copyrightable works thus published on the MMC site.
+
+"CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0 license published by Creative Commons Corporation, a not-for-profit corporation with a principal place of business in San Francisco,California, as well as future copyleft versions of that license published by that same organization.
+
+"Incorporate" means to publish or republish a Document, in whole or in part, as part of another Document.An MMC is "eligible for relicensing" if it is licensed under this License, and if all works that were first published under this License somewhere other than this MMC, and subsequently incorporated in whole or in part into the MMC, (1) had no cover texts or invariant sections, and (2) were thus incorporated prior to November 1, 2008.
+
+The operator of an MMC Site may republish an MMC contained in the site under CC-BY-SA on the same site at any time before August 1, 2009, provided the MMC is eligible for relicensing.
+
+2~ ADDENDUM: How to use this License for your documents
+
+To use this License in a document you have written, include a copy of the License in the document and put the following copyright and license notices just after the title page:
+
+_1 Copyright © YEAR YOUR NAME. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".
+
+If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, replace the "with ... Texts." line with this:
+
+_1 with the Invariant Sections being LIST THEIR TITLES,with the Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
+
+If you have Invariant Sections without Cover Texts, or some other combination of the three, merge those two alternatives to suit the situation.
+
+If your document contains nontrivial examples of program code,we recommend releasing these examples in parallel under your choice of free software license, such as the GNU General Public License, to permit their use in free software.
+
+1~ Colophon
+
+The front and back covers of this book were designed and produced by Rob Myers using Inkscape, the free software vector graphics program. Jeanne Rasata also contributed to the cover design.
+
+The typsetting was done by John Sullivan at the Free Software Foundation using LATEX, GNU Emacs, Evince, and the GNU Image Manipulation Program (GIMP). The primary font is 10-point Computer Modern.
+
+Digital versions of the book, including the LATEX source code, are available at http://www.fsf.org/faif. Improvements are welcome,and can be sent to sales@gnu.org.
diff --git a/data/doc/sisu/markup-samples/v4/samples/sisu_output_overview.ssi b/data/doc/sisu/markup-samples/v4/samples/sisu_output_overview.ssi
new file mode 100644
index 00000000..e2c90529
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/samples/sisu_output_overview.ssi
@@ -0,0 +1,61 @@
+% @title: SiSU overview of status of features available in various outputs
+
+% @date.created: 2005-10-31
+
+% @date.available: 2006-10-31
+
+% @date.modified: 2006-01-23
+
+% @date: 2006-01-23
+
+% :A~? SiSU overview of status of features available in various outputs
+
+!_ A Checklist of Output Features
+
+This table gives an indication of the features that are available
+for various forms of output of SiSU.~{ updated for sisu-0.36.6 on 2006-01-23 }~
+
+{t~h}
+feature |txt|ltx/pdf|HTML|XHTML|XML/s|XML/d|ODF|SQLite|pgSQL
+headings | * | * | * | * | * | * | * | * | *
+footnotes | * | * | * | * | * | * | * | * | *
+bold, underscore, italics | . | * | * | * | * | * | * | * | *
+strikethrough | . | * | * | * | * | * | * | |
+superscript, subscript | . | * | * | * | * | * | * | |
+extended ascii set (utf-8)| * | * | * | * | * | * | * | | *
+indents | * | * | * | * | * | * | * | |
+bullets | . | * | * | * | * | * | . | |
+groups | | | | | | | | |
+* tables | | * | * | . | . | . | . | . | .
+* poem | * | * | * | . | . | . | * | . | .
+* code | * | * | * | . | . | . | * | . | .
+url | * | * | * | * | * | * | * | . | .
+links | * | * | * | * | * | * | * | . | .
+images | - | * | * | T | T | T | * | T | T
+image caption | - | * | * | | | | | |
+table of contents | | * | * | * | * | * | . | |
+page header/footer? | - | * | * | * | * | * | t | |
+line break | * | * | * | * | * | * | * | |
+page break | | * | | | | | * | |
+segments | | | * | | | | | |
+skins | * | * | * | * | * | * | | |
+ocn | . | * | * | * | * | * | -?| * | *
+auto-heading numbers | * | * | * | * | * | * | * | * | *
+minor list numbering | * | * | * | * | * | * | * | * | *
+special characters | . | . | . | | | | | |
+
+group{
+
+ Done
+ * yes/done
+ . partial
+
+ - not available/appropriate
+
+ Not Done
+ T task todo
+ t lesser task/todo
+ not done
+
+}group
+
diff --git a/data/doc/sisu/markup-samples/v4/sisu_manual/_sisu/image/GnuDebianLinuxRubyBetterWay.png b/data/doc/sisu/markup-samples/v4/sisu_manual/_sisu/image/GnuDebianLinuxRubyBetterWay.png
new file mode 100644
index 00000000..ce5b8830
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/sisu_manual/_sisu/image/GnuDebianLinuxRubyBetterWay.png
Binary files differ
diff --git a/data/doc/sisu/markup-samples/v4/sisu_manual/_sisu/image/ruby_logo.png b/data/doc/sisu/markup-samples/v4/sisu_manual/_sisu/image/ruby_logo.png
new file mode 100644
index 00000000..829e2458
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/sisu_manual/_sisu/image/ruby_logo.png
Binary files differ
diff --git a/data/doc/sisu/markup-samples/v4/sisu_manual/_sisu/image/sisu.home.png b/data/doc/sisu/markup-samples/v4/sisu_manual/_sisu/image/sisu.home.png
new file mode 100644
index 00000000..b449fa6b
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/sisu_manual/_sisu/image/sisu.home.png
Binary files differ
diff --git a/data/doc/sisu/markup-samples/v4/sisu_manual/_sisu/image/sisu.png b/data/doc/sisu/markup-samples/v4/sisu_manual/_sisu/image/sisu.png
new file mode 100644
index 00000000..b449fa6b
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/sisu_manual/_sisu/image/sisu.png
Binary files differ
diff --git a/data/doc/sisu/markup-samples/v4/sisu_manual/_sisu/image/tux.png b/data/doc/sisu/markup-samples/v4/sisu_manual/_sisu/image/tux.png
new file mode 100644
index 00000000..15fd152b
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/sisu_manual/_sisu/image/tux.png
Binary files differ
diff --git a/data/doc/sisu/markup-samples/v4/sisu_manual/_sisu/sisu_document_make b/data/doc/sisu/markup-samples/v4/sisu_manual/_sisu/sisu_document_make
new file mode 100644
index 00000000..17c6bbf8
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/sisu_manual/_sisu/sisu_document_make
@@ -0,0 +1,20 @@
+@make:
+ :num_top: 1
+ :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: /${debian_stable}/,'*{Wheezy}*' /${debian_testing}/,'*{Jessie}*'
+ :home_button_text: {SiSU}http://sisudoc.org; {git}http://git.sisudoc.org
+ :footer: {SiSU}http://sisudoc.org; {git}http://git.sisudoc.org
+
+@links:
+ { SiSU Homepage }http://www.sisudoc.org/
+ { SiSU Manual }http://www.sisudoc.org/sisu/sisu_manual/
+ { Book Samples & Markup Examples }http://www.jus.uio.no/sisu/SiSU/examples.html
+ { SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html
+ { SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html
+ { SiSU Git repo }http://git.sisudoc.org/?p=code/sisu.git;a=summary
+ { SiSU List Archives }http://lists.sisudoc.org/pipermail/sisu/
+ { SiSU @ Debian }http://packages.qa.debian.org/s/sisu.html
+ { SiSU Project @ Debian }http://qa.debian.org/developer.php?login=sisu@lists.sisudoc.org
+ { SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU
diff --git a/data/doc/sisu/markup-samples/sisu_manual/_sisu/v2/sisurc.yml b/data/doc/sisu/markup-samples/v4/sisu_manual/_sisu/v4/sisurc.yml
index 433c6967..6d11656d 100644
--- a/data/doc/sisu/markup-samples/sisu_manual/_sisu/v2/sisurc.yml
+++ b/data/doc/sisu/markup-samples/v4/sisu_manual/_sisu/v4/sisurc.yml
@@ -49,12 +49,12 @@ show_output_on: 'filesystem_url'
#% flag - set (non-default) processing flag shortcuts -1, -2 etc. (here adding colour and verbosity as default)
flag:
color: true # making colour default -c is toggle, and will now toggle colour off
- default: '-NhewpotbxXyYv' # -m run by default; includes verbose
- i: '-Nhewpoty' # -m run by default
- ii: '-NhewpotbxX' # -m run by default
- iii: '-NhewpotbxXY' # -m run by default
- iv: '-NhewpotbxXiIY' # -m run by default
- v: '-NhewpotbxXYDv --update' # -m run by default; includes verbose
+# default: '-NhewpotbxXyYv' # -m run by default; includes verbose
+# i: '-Nhewpoty' # -m run by default
+# ii: '-NhewpotbxX' # -m run by default
+# iii: '-NhewpotbxXY' # -m run by default
+# iv: '-NhewpotbxXiIY' # -m run by default
+# v: '-NhewpotbxXYDv --update' # -m run by default; includes verbose
#% papersize, (LaTeX/pdf) current values A4, US_letter, book_b5, book_a5, US_legal, easily extensible
default:
@@ -83,11 +83,9 @@ default:
db:
postgresql:
port: '5432' # '5432'
- #user: 'tst' # '[provide username]'
- #host: 'sisudoc.org'
- #user: 'ralph'
- ##port: '5433'
- #port: '5432'
+ #host: # '[if not localhost, provide host tcp/ip address or domain name]''
+ #user: # '[(if different from user) provide username]'
+ #password: # '[password if required]'
sqlite:
user: 'ralph'
path: ~ # './sisu_sqlite.db'
@@ -95,13 +93,18 @@ db:
multi: true
# single: true
+#% output_dir_structure_by: language (language_and_filetype); filetype; or filename (original v1 & v2)
+#output_dir_structure_by: filename
+#output_dir_structure_by: filetype
+output_dir_structure_by: language
+
permission_set:
zap: true
css_modify: true
remote_base_site: true
program_set:
- rmagick: false
+ rmagick: true
# wc: true
# editor: true
# postgresql: true
@@ -128,5 +131,4 @@ program_set:
# action: http://search.sisudoc.org
# db: sisu
# title: sample search form
-
#promo: sisu_search_libre, sisu_icon, sisu, open_society, fsf, ruby
diff --git a/data/doc/sisu/markup-samples/v4/sisu_manual/sisu.ssm b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu.ssm
new file mode 100644
index 00000000..79703fef
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu.ssm
@@ -0,0 +1,73 @@
+% SiSU master 4.0
+
+@title: SiSU
+ :subtitle: Manual
+
+@creator:
+ :author: Amissah, Ralph
+
+@date:
+ :published: 2008-05-22
+ :created: 2002-08-28
+ :issued: 2002-08-28
+ :available: 2002-08-28
+ :modified: 2012-10-03
+
+@rights:
+ :copyright: Copyright (C) Ralph Amissah 2012
+ :license: GPL 3 (part of SiSU documentation)
+
+@classify:
+ :topic_register: SiSU:manual;electronic documents:SiSU:manual
+ :subject: ebook, epublishing, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, search
+
+@make:
+ :manpage: name=sisu - documents: markup, structuring, publishing in multiple standard formats, and search; synopsis=sisu [-short-options|--long-options] [filename/wildcard] . sisu [-abCcDdeFGghIikLMmNnoPpQqRrSsTtUuVvWwXxYyZ_0-9] [filename/wildcard] . sisu --txt --html --epub --odt --pdf --wordmap --sqlite --manpage --texinfo --sisupod --source --qrcode [filename/wildcard] . sisu [-Ddcv] [instruction] [filename/wildcard] . sisu --pg (--createdb|update [filename/wildcard]|--dropall) . sisu [operations] . sisu [-CcFLSVvW] . sisu (--configure|--webrick|--sample-search-form)
+
+:A~ @title @creator
+
+:B~ What is SiSU?
+
+% << sisu_synopsis.ssi
+
+<< sisu_introduction.sst
+
+% :B~? SiSU Commands
+
+<< sisu_commands.sst
+
+<< sisu_help.sst
+
+% :B~? SiSU Markup
+
+<< sisu_markup.sst
+
+<< sisu_filetypes.sst
+
+% :B~? SiSU Configuration
+
+<< sisu_config.ssi
+
+<< sisu_css.ssi
+
+<< sisu_content_directories.ssi
+
+<< sisu_homepages.ssi
+
+% :B~? SiSU Output and Markup Examples
+
+<< sisu_examples.ssi
+
+<< sisu_search_intro.ssi
+
+<< sisu_sql.ssi
+
+<< sisu_postgresql.sst
+
+<< sisu_sqlite.sst
+
+<< sisu_search_cgi.ssi
+
+<< sisu_webrick.sst
+
+<< sisu_short_feature_summary.ssi
diff --git a/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_commands.sst b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_commands.sst
new file mode 100644
index 00000000..0f3c0b8e
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_commands.sst
@@ -0,0 +1,421 @@
+% SiSU 4.0
+
+@title: SiSU
+ :subtitle: Commands
+
+@creator:
+ :author: Amissah, Ralph
+
+@date:
+ :created: 2002-08-28
+ :issued: 2002-08-28
+ :available: 2002-08-28
+ :published: 2007-09-16
+ :modified: 2012-10-03
+
+@rights:
+ :copyright: Copyright (C) Ralph Amissah 2012
+ :license: GPL 3 (part of SiSU documentation)
+
+@classify:
+ :topic_register: electronic documents:SiSU:document:commands;SiSU:manual:commands;electronic documents:SiSU:manual:commands;SiSU:document:commands;SiSU:document:commands
+ :subject: ebook, epublishing, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, search
+
+:A~? @title @creator
+
+:B~? SiSU Commands
+
+1~commands Commands Summary
+
+2~ Description
+
+SiSU is a document publishing system, that from a simple single marked-up document, produces multiple output formats including: plaintext, HTML, XHTML, XML, EPUB, ODT (OpenDocument (ODF) text), LaTeX, PDF, info, and SQL (PostgreSQL and SQLite), which share text object numbers ("object citation numbering") and the same document structure information. For more see: http://sisudoc.org or http://www.jus.uio.no/sisu
+
+% 2~ Summary of man page
+
+% This man page covers a number of subjects in brief, including: document processing command flags; document markup (basic markup and headers); configuration files; directory structure; skins; document naming; interactive help and other information.
+
+2~ Document Processing Command Flags
+
+!_ -a [filename/wildcard] \\
+produces plaintext with Unix linefeeds and without markup, (object numbers are omitted), has footnotes at end of each paragraph that contains them [ -A for equivalent dos (linefeed) output file] [see -e for endnotes]. (Options include: --endnotes for endnotes --footnotes for footnotes at the end of each paragraph --unix for unix linefeed (default) --msdos for msdos linefeed)
+
+!_ -b [filename/wildcard] \\
+see --xhtml
+
+!_ --by-* \\
+see --output-by-*
+
+!_ -C \\
+configure/initialise shared output directory files initialize shared output directory (config files such as css and dtd files are not updated if they already exist unless modifier is used). -C --init-site configure/initialise site more extensive than -C on its own, shared output directory files/force update, existing shared output config files such as css and dtd files are updated if this modifier is used.
+
+!_ -CC \\
+see --configure
+
+!_ -c [filename/wildcard] \\
+see --color-toggle
+
+!_ --color-toggle [filename/wildcard] \\
+screen toggle ansi screen colour on or off depending on default set (unless -c flag is used: if sisurc colour default is set to 'true', output to screen will be with colour, if sisurc colour default is set to 'false' or is undefined screen output will be without colour). Alias -c
+
+!_ --configure \\
+configure/initialise shared output directory files initialize shared output directory (config files such as css and dtd files are not updated if they already exist unless modifier is used). The equivalent of: -C --init-site configure/initialise site, more extensive than -C on its own, shared output directory files/force update, existing shared output config files such as css and dtd files are updated if -CC is used.
+
+!_ --concordance [filename/wildcard] \\
+produces concordance (wordmap) a rudimentary index of all the words in a document. (Concordance files are not generated for documents of over 260,000 words unless this limit is increased in the file sisurc.yml). Alias -w
+
+!_ -D [instruction] [filename] \\
+see --pg
+
+!_ -d [--db-[database type (sqlite|pg)]] --[instruction] [filename] \\
+see --sqlite
+
+!_ --dal [filename/wildcard/url] \\
+assumed for most other flags, creates new intermediate files for processing (document abstraction) that is used in all subsequent processing of other output. This step is assumed for most processing flags. To skip it see -n. Alias -m
+
+!_ --delete [filename/wildcard] \\
+see --zap
+
+!_ --dump[=directory_path] [filename/wildcard] \\
+places output in directory specified, if none is specified in the current directory (pwd). Compare --redirect
+
+!_ -e [filename/wildcard] \\
+see --epub
+
+!_ --epub [filename/wildcard] \\
+produces an epub document, [sisu version >=2 ] (filename.epub). Alias -e
+
+!_ --exc-* \\
+exclude output feature, overrides configuration settings
+ --exc-ocn, (exclude object citation numbering, (switches off object citation numbering), affects html (seg, scroll), epub, xhtml, xml, pdf);
+ --exc-toc, (exclude table of contents, affects html (scroll), epub, pdf);
+ --exc-links-to-manifest, --exc-manifest-links, (exclude links to manifest, affects html (seg, scroll));
+ --exc-search-form, (exclude search form, affects html (seg, scroll), manifest);
+ --exc-minitoc, (exclude mini table of contents, affects html (seg), concordance, manifest);
+ --exc-manifest-minitoc, (exclude mini table of contents, affects manifest);
+ --exc-html-minitoc, (exclude mini table of contents, affects html (seg), concordance);
+ --exc-html-navigation, (exclude navigation, affects html (seg));
+ --exc-html-navigation-bar, (exclude navigation bar, affects html (seg));
+ --exc-html-search-form, (exclude search form, affects html (seg, scroll));
+ --exc-html-right-pane, (exclude right pane/column, affects html (seg, scroll));
+ --exc-html-top-band, (exclude top band, affects html (seg, scroll), concordance (minitoc forced on to provide seg navigation));
+ --exc-segsubtoc (exclude sub table of contents, affects html (seg), epub);
+see also --inc-*
+
+!_ -F [--webserv=webrick] \\
+see --sample-search-form
+
+!_ -f [optional string part of filename] \\
+see --find
+
+!_ --find [optional string part of filename] \\
+without match string, glob all .sst .ssm files in directory (including language subdirectories). With match string, find files that match given string in directory (including language subdirectories). Alias -f, --glob, -G
+
+!_ -G [optional string part of filename] \\
+see --find
+
+!_ -g [filename/wildcard] \\
+see --git
+
+!_ --git [filename/wildcard] \\
+produces or updates markup source file structure in a git repo (experimental and subject to change). Alias -g
+
+!_ --glob [optional string part of filename] \\
+see --find
+
+!_ -h [filename/wildcard] \\
+see --html
+
+!_ --harvest *.ss[tm] \\
+makes two lists of sisu output based on the sisu markup documents in a directory: list of author and authors works (year and titles), and; list by topic with titles and author. Makes use of header metadata fields (author, title, date, topic_register). Can be used with maintenance (-M) and remote placement (-R) flags.
+
+!_ --help [topic] \\
+provides help on the selected topic, where topics (keywords) include: list, (com)mands, short(cuts), (mod)ifiers, (env)ironment, markup, syntax, headers, headings, endnotes, tables, example, customise, skin, (dir)ectories, path, (lang)uage, db, install, setup, (conf)igure, convert, termsheet, search, sql, features, license.
+
+!_ --html [filename/wildcard] \\
+produces html output, segmented text with table of contents (toc.html and index.html) and the document in a single file (scroll.html). Alias -h
+
+!_ -I [filename/wildcard] \\
+see --texinfo
+
+!_ -i [filename/wildcard] \\
+see --manpage
+
+!_ --inc-* \\
+include output feature, overrides configuration settings, (usually the default if none set), has precedence over --exc-* (exclude output feature). Some detail provided under --exc-*,
+see --exc-*
+
+!_ -j [filename/wildcard] \\
+copies images associated with a file for use by html, xhtml & xml outputs (automatically invoked by --dump & redirect).
+
+!_ --keep-processing-files [filename/wildcard/url] \\
+see --maintenance
+
+!_ -L \\
+prints license information.
+
+!_ -M [filename/wildcard/url] \\
+see --maintenance
+
+!_ -m [filename/wildcard/url] \\
+see --dal (document abstraction level/layer)
+
+!_ --machine [filename/wildcard/url] \\
+see --dal (document abstraction level/layer)
+
+!_ --maintenance [filename/wildcard/url] \\
+maintenance mode, interim processing files are preserved and their locations indicated. (also see -V). Aliases -M and --keep-processing-files.
+
+!_ --manpage [filename/wildcard] \\
+produces man page of file, not suitable for all outputs. Alias -i
+
+!_ -N [filename/wildcard/url] \\
+document digest or document content certificate ( DCC ) as md5 digest tree of the document: the digest for the document, and digests for each object contained within the document (together with information on software versions that produced it) (digest.txt). -NV for verbose digest output to screen.
+
+!_ -n [filename/wildcard/url] \\
+skip the creation of intermediate processing files (document abstraction) if they already exist, this skips the equivalent of -m which is otherwise assumed by most processing flags.
+
+!_ --no-* \\
+see --exc-*
+
+!_ -o [filename/wildcard/url] \\
+see --odt
+
+!_ --odf [filename/wildcard/url] \\
+see --odt
+
+!_ --odt [filename/wildcard/url] \\
+output basic document in opendocument file format (opendocument.odt). Alias -o
+
+!_ --output-by-* \\
+select output directory structure from 3 alternatives:
+--output-by-language, (language directory (based on language code) with filetype (html, epub, pdf etc.) subdirectories);
+--output-by-filetype, (filetype directories with language code as part of filename);
+--output-by-filename, (filename directories with language code as part of filename).
+This is configurable. Alias --by-*
+
+!_ -P [language_directory/filename language_directory] \\
+see --po4a
+
+!_ -p [filename/wildcard] \\
+see --pdf
+
+!_ --pdf [filename/wildcard] \\
+produces LaTeX pdf (portrait.pdf & landscape.pdf). Default paper size is set in config file, or document header, or provided with additional command line parameter, e.g. --papersize-a4 preset sizes include: 'A4', U.S. 'letter' and 'legal' and book sizes 'A5' and 'B5' (system defaults to A4). Alias -p
+
+!_ --pg [instruction] [filename] \\
+database PostgreSQL ( --pgsql may be used instead) possible instructions, include: --createdb; --create; --dropall; --import [filename]; --update [filename]; --remove [filename]; see database section below. Alias -D
+
+!_ --po [language_directory/filename language_directory] \\
+see --po4a
+
+!_ --po4a [language_directory/filename language_directory] \\
+produces .pot and po files for the file in the languages specified by the language directory. SiSU markup is placed in subdirectories named with the language code, e.g. en/ fr/ es/. The sisu config file must set the output directory structure to multilingual. v3, experimental
+
+!_ -Q [filename/wildcard] \\
+see --qrcode
+
+!_ -q [filename/wildcard] \\
+see --quiet
+
+!_ --qrcode [filename/wildcard] \\
+generate QR code image of metadata (used in manifest). v3 only.
+
+!_ --quiet [filename/wildcard] \\
+quiet less output to screen.
+
+!_ -R [filename/wildcard] \\
+see --rsync
+
+!_ -r [filename/wildcard] \\
+see --scp
+
+!_ --redirect[=directory_path] [filename/wildcard] \\
+places output in subdirectory under specified directory, subdirectory uses the filename (without the suffix). If no output directory is specified places the subdirectory under the current directory (pwd). Compare --dump
+
+!_ --rsync [filename/wildcard] \\
+copies sisu output files to remote host using rsync. This requires that sisurc.yml has been provided with information on hostname and username, and that you have your "keys" and ssh agent in place. Note the behavior of rsync different if -R is used with other flags from if used alone. Alone the rsync --delete parameter is sent, useful for cleaning the remote directory (when -R is used together with other flags, it is not). Also see --scp. Alias -R
+
+!_ -S \\
+see --sisupod
+
+!_ -S [filename/wildcard] \\
+see --sisupod
+
+!_ -s [filename/wildcard] \\
+see --source
+
+!_ --sample-search-form [--webserv=webrick] \\
+generate examples of (naive) cgi search form for SQLite and PgSQL depends on your already having used sisu to populate an SQLite and/or PgSQL database, (the SQLite version scans the output directories for existing sisu_sqlite databases, so it is first necessary to create them, before generating the search form) see -d -D and the database section below. If the optional parameter --webserv=webrick is passed, the cgi examples created will be set up to use the default port set for use by the webrick server, (otherwise the port is left blank and the system setting used, usually 80). The samples are dumped in the present work directory which must be writable, (with screen instructions given that they be copied to the cgi-bin directory). Alias -F
+
+!_ --scp [filename/wildcard] \\
+copies sisu output files to remote host using scp. This requires that sisurc.yml has been provided with information on hostname and username, and that you have your "keys" and ssh agent in place. Also see --rsync. Alias -r
+
+!_ --sqlite --[instruction] [filename] \\
+database type set to SQLite, this produces one of two possible databases, without additional database related instructions it produces a discreet SQLite file for the document processed; with additional instructions it produces a common SQLite database of all processed documents that (come from the same document preparation directory and as a result) share the same output directory base path (possible instructions include: --createdb; --create; --dropall; --import [filename]; --update [filename]; --remove [filename]); see database section below. Alias -d
+
+!_ --sisupod \\
+produces a sisupod a zipped sisu directory of markup files including sisu markup source files and the directories local configuration file, images and skins. Note: this only includes the configuration files or skins contained in ./_sisu not those in ~/.sisu -S [filename/wildcard] option. Note: (this option is tested only with zsh). Alias -S
+
+!_ --sisupod [filename/wildcard] \\
+produces a zipped file of the prepared document specified along with associated images, by default named sisupod.zip they may alternatively be named with the filename extension .ssp This provides a quick way of gathering the relevant parts of a sisu document which can then for example be emailed. A sisupod includes sisu markup source file, (along with associated documents if a master file, or available in multilingual versions), together with related images and skin. SiSU commands can be run directly against a sisupod contained in a local directory, or provided as a url on a remote site. As there is a security issue with skins provided by other users, they are not applied unless the flag --trust or --trusted is added to the command instruction, it is recommended that file that are not your own are treated as untrusted. The directory structure of the unzipped file is understood by sisu, and sisu commands can be run within it. Note: if you wish to send multiple files, it quickly becomes more space efficient to zip the sisu markup directory, rather than the individual files for sending). See the -S option without [filename/wildcard]. Alias -S
+
+!_ --source [filename/wildcard] \\
+copies sisu markup file to output directory. Alias -s
+
+!_ -T [filename/wildcard (*.termsheet.rb)] \\
+standard form document builder, preprocessing feature
+
+!_ -t [filename/wildcard] \\
+see --txt
+
+!_ --texinfo [filename/wildcard] \\
+produces texinfo and info file, (view with pinfo). Alias -I
+
+!_ --txt [filename/wildcard] \\
+produces plaintext with Unix linefeeds and without markup, (object numbers are omitted), has footnotes at end of each paragraph that contains them [ -A for equivalent dos (linefeed) output file] [see -e for endnotes]. (Options include: --endnotes for endnotes --footnotes for footnotes at the end of each paragraph --unix for unix linefeed (default) --msdos for msdos linefeed). Alias -t
+
+!_ -U [filename/wildcard] \\
+see --urls
+
+!_ -u [filename/wildcard] \\
+provides url mapping of output files for the flags requested for processing, also see -U
+
+!_ --urls [filename/wildcard] \\
+prints url output list/map for the available processing flags options and resulting files that could be requested, (can be used to get a list of processing options in relation to a file, together with information on the output that would be produced), -u provides url output mapping for those flags requested for processing. The default assumes sisu_webrick is running and provides webrick url mappings where appropriate, but these can be switched to file system paths in sisurc.yml. Alias -U
+
+!_ -V \\
+on its own, provides SiSU version and environment information (sisu --help env)
+
+!_ -V [filename/wildcard] \\
+even more verbose than the -v flag.
+
+!_ -v \\
+on its own, provides SiSU version information
+
+!_ -v [filename/wildcard] \\
+see --verbose
+
+!_ --v3 [filename/wildcard] \\
+invokes the sisu v3 document parser/generator. You may run sisu3 instead.
+
+!_ --v4 [filename/wildcard] \\
+invokes the sisu v4 document parser/generator. This is the default and is normally omitted.
+
+!_ --verbose [filename/wildcard] \\
+provides verbose output of what is being generated, where output is placed (and error messages if any), as with -u flag provides a url mapping of files created for each of the processing flag requests. Alias -v
+
+!_ -W \\
+see --webrick
+
+!_ -w [filename/wildcard] \\
+see --concordance
+
+!_ --webrick \\
+starts ruby's webrick webserver points at sisu output directories, the default port is set to 8081 and can be changed in the resource configuration files. [tip: the webrick server requires link suffixes, so html output should be created using the -h option rather than -H ; also, note -F webrick ]. Alias -W
+
+!_ --wordmap [filename/wildcard] \\
+see --concordance
+
+!_ --xhtml [filename/wildcard] \\
+produces xhtml/XML output for browser viewing (sax parsing). Alias -b
+
+!_ --xml-dom [filename/wildcard] \\
+produces XML output with deep document structure, in the nature of dom. Alias -X
+
+!_ --xml-sax [filename/wildcard] \\
+produces XML output shallow structure (sax parsing). Alias -x
+
+!_ -X [filename/wildcard] \\
+see --xml-dom
+
+!_ -x [filename/wildcard] \\
+see --xml-sax
+
+!_ -Y [filename/wildcard] \\
+produces a short sitemap entry for the document, based on html output and the sisu_manifest. --sitemaps generates/updates the sitemap index of existing sitemaps. (Experimental, [g,y,m announcement this week])
+
+!_ -y [filename/wildcard] \\
+produces an html summary of output generated (hyperlinked to content) and document specific metadata (sisu_manifest.html). This step is assumed for most processing flags.
+
+!_ -Z [filename/wildcard] \\
+see --zap
+
+!_ --zap [filename/wildcard] \\
+Zap, if used with other processing flags deletes output files of the type about to be processed, prior to processing. If -Z is used as the lone processing related flag (or in conjunction with a combination of -[mMvVq]), will remove the related document output directory. Alias -Z
+
+1~command_modifiers command line modifiers
+
+!_ --no-ocn \\
+[with --html --pdf or --epub] switches off object citation numbering. Produce output without identifying numbers in margins of html or LaTeX/pdf output.
+
+!_ --no-annotate \\
+strips output text of editor endnotes~[* square brackets ]~ denoted by asterisk or dagger/plus sign
+
+!_ --no-asterisk \\
+strips output text of editor endnotes~[* square brackets ]~ denoted by asterisk sign
+
+!_ --no-dagger \\
+strips output text of editor endnotes~[+ square brackets ]~ denoted by dagger/plus sign
+
+1~commands_database database commands
+
+!_ dbi - database interface
+
+!_ -D or --pgsql
+set for PostgreSQL
+!_ -d or --sqlite
+default set for SQLite -d is modifiable with --db=[database type (PgSQL or SQLite)]
+
+!_ --pg -v --createall \\
+initial step, creates required relations (tables, indexes) in existing PostgreSQL database (a database should be created manually and given the same name as working directory, as requested) (rb.dbi) [ -dv --createall SQLite equivalent] it may be necessary to run sisu -Dv --createdb initially NOTE: at the present time for PostgreSQL it may be necessary to manually create the database. The command would be 'createdb [database name]' where database name would be SiSU_[present working directory name (without path)]. Please use only alphanumerics and underscores.
+
+!_ --pg -v --import \\
+[filename/wildcard] imports data specified to PostgreSQL db (rb.dbi) [ -dv --import SQLite equivalent]
+
+!_ --pg -v --update \\
+[filename/wildcard] updates/imports specified data to PostgreSQL db (rb.dbi) [ -dv --update SQLite equivalent]
+
+!_ --pg --remove \\
+[filename/wildcard] removes specified data to PostgreSQL db (rb.dbi) [ -d --remove SQLite equivalent]
+
+!_ --pg --dropall \\
+kills data" and drops (PostgreSQL or SQLite) db, tables & indexes [ -d --dropall SQLite equivalent]
+
+The -v is for verbose output.
+
+1~command_shorcuts Shortcuts, Shorthand for multiple flags
+
+!_ --update [filename/wildcard] \\
+Checks existing file output and runs the flags required to update this output. This means that if only html and pdf output was requested on previous runs, only the -hp files will be applied, and only these will be generated this time, together with the summary. This can be very convenient, if you offer different outputs of different files, and just want to do the same again.
+
+!_ -0 to -5 [filename or wildcard] \\
+Default shorthand mappings (for v3, note that the defaults can be changed/configured in the sisurc.yml file):
+
+!_ -0 \\
+-NQhewpotbxXyYv [this is the default action run when no options are give, i.e. on 'sisu [filename]']
+
+!_ -1 \\
+-Qhewpoty
+
+!_ -2 \\
+-NQhewpotbxXy
+
+!_ -3 \\
+-NQhewpotbxXyY
+
+!_ -4 \\
+-NQhewpotbxXDyY --update
+
+!_ -5 \\
+-NQhewpotbxXDyYv --update
+
+add -v for verbose mode and -c to toggle color state, e.g. sisu -2vc [filename or wildcard]
+
+consider -u for appended url info or -v for verbose output
+
+2~ Command Line with Flags - Batch Processing
+
+In the data directory run sisu -mh filename or wildcard eg. "sisu -h cisg.sst" or "sisu -h *.{sst,ssm}" to produce html version of all documents.
+
+Running sisu (alone without any flags, filenames or wildcards) brings up the interactive help, as does any sisu command that is not recognised. Enter to escape.
diff --git a/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_config.ssi b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_config.ssi
new file mode 100644
index 00000000..3c29f995
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_config.ssi
@@ -0,0 +1,75 @@
+% SiSU insert 2.0
+
+@title: SiSU
+ :subtitle: Configuration
+
+@creator:
+ :author: Amissah, Ralph
+
+@date:
+ :published: 2007-09-16
+ :created: 2002-08-28
+ :issued: 2002-08-28
+ :available: 2002-08-28
+ :modified: 2011-12-12
+
+@rights:
+ :copyright: Copyright (C) Ralph Amissah 2007
+ :license: GPL 3 (part of SiSU documentation)
+
+:A~? Configuration
+
+:B~? Configure Environment
+
+1~config Configuration
+
+2~ Configuration files
+
+3~ config.yml
+
+SiSU configration parameters are adjusted in the configuration file, which can be used to override the defaults set. This includes such things as which directory interim processing should be done in and where the generated output should be placed.
+
+The SiSU configuration file is a yaml file, which means indentation is significant.
+
+SiSU resource configuration is determined by looking at the following files if they exist:
+
+_1 ./_sisu/v4/sisurc.yml
+
+_1 ./_sisu/sisurc.yml
+
+_1 ~/.sisu/v4/sisurc.yml
+
+_1 ~/.sisu/sisurc.yml
+
+_1 /etc/sisu/v4/sisurc.yml
+
+_1 /etc/sisu/sisurc.yml
+
+The search is in the order listed, and the first one found is used.
+
+In the absence of instructions in any of these it falls back to the internal program defaults.
+
+Configuration determines the output and processing directories and the database access details.
+
+If SiSU is installed a sample sisurc.yml may be found in /etc/sisu/sisurc.yml
+
+3~ sisu_document_make
+
+Most sisu document headers relate to metadata, the exception is the @make: header which provides processing related information. The default contents of the @make header may be set by placing them in a file sisu_document_make.
+
+The search order is as for resource configuration:
+
+_1 ./_sisu/v4/sisu_document_make
+
+_1 ./_sisu/sisu_document_make
+
+_1 ~/.sisu/v4/sisu_document_make
+
+_1 ~/.sisu/sisu_document_make
+
+_1 /etc/sisu/v4/sisu_document_make
+
+_1 /etc/sisu/sisu_document_make
+
+A sample sisu_document_make can be found in the _sisu/ directory under along with the provided sisu markup samples.
+
diff --git a/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_content_directories.ssi b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_content_directories.ssi
new file mode 100644
index 00000000..182b176d
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_content_directories.ssi
@@ -0,0 +1,264 @@
+% SiSU insert 2.0
+
+@title: SiSU
+ :subtitle: Content Directories, Organising Content
+
+@creator:
+ :author: Amissah, Ralph
+
+@date:
+ :created: 2002-08-28
+ :issued: 2002-08-28
+ :available: 2007-08-28
+ :published: 2007-09-16
+ :modified: 2011-02-07
+
+@rights:
+ :copyright: Copyright (C) Ralph Amissah 2007
+ :license: GPL 3 (part of SiSU documentation)
+
+:A~? Organisation of Content
+
+:B~? Content Directories
+
+1~organising_content Organising Content - Directory Structure and Mapping
+
+SiSU v3 has new options for the source directory tree, and output directory structures of which there are 3 alternatives.
+
+2~ Document Source Directory
+
+The document source directory is the directory in which sisu processing commands are given. It contains the sisu source files (.sst .ssm .ssi), or (for sisu v3 may contain) subdirectories with language codes which contain the sisu source files, so all English files would go in subdirectory en/, French in fr/, Spanish in es/ and so on. ISO 639-1 codes are used (as varied by po4a). A list of available languages (and possible sub-directory names) can be obtained with the command "sisu --help lang" The list of languages is limited to langagues supported by XeTeX polyglosia.
+
+3~ General Directories
+
+code{
+
+./subject_name/
+
+% files stored at this level e.g. sisu_manual.sst or
+% for sisu v3 may be under language sub-directories
+% e.g.
+
+./subject_name/en
+
+./subject_name/fr
+
+./subject_name/es
+
+./subject_name/_sisu
+
+./subject_name/_sisu/css
+
+./subject_name/_sisu/image
+
+}code
+
+2~ Document Output Directory Structures
+
+3~ Output Directory Root
+
+The output directory root can be set in the sisurc.yml file. Under the root, subdirectories are made for each directory in which a document set resides. If you have a directory named poems or conventions, that directory will be created under the output directory root and the output for all documents contained in the directory of a particular name will be generated to subdirectories beneath that directory (poem or conventions). A document will be placed in a subdirectory of the same name as the document with the filetype identifier stripped (.sst .ssm)
+
+The last part of a directory path, representing the sub-directory in which a document set resides, is the directory name that will be used for the output directory. This has implications for the organisation of document collections as it could make sense to place documents of a particular subject, or type within a directory identifying them. This grouping as suggested could be by subject (sales_law, english_literature); or just as conveniently by some other classification (X University). The mapping means it is also possible to place in the same output directory documents that are for organisational purposes kept separately, for example documents on a given subject of two different institutions may be kept in two different directories of the same name, under a directory named after each institution, and these would be output to the same output directory. Skins could be associated with each institution on a directory basis and resulting documents will take on the appropriate different appearance.
+
+3~ Alternative Output Structures
+
+There are 3 possibile output structures described as being, by language, by filetype or by filename, the selection is made in sisurc.yml
+
+code{
+
+#% output_dir_structure_by: language; filetype; or filename
+output_dir_structure_by: language #(language & filetype, preferred?)
+#output_dir_structure_by: filetype
+#output_dir_structure_by: filename #(default, closest to original v1 & v2)
+
+}code
+
+3~ By Language
+
+The by language directory structure places output files
+
+The by language directory structure separates output files by language code (all files of a given language), and within the language directory by filetype.
+
+Its selection is configured in sisurc.yml
+
+output_dir_structure_by: language
+
+% works for html epub odf, pdf, sortof for info NOT for man pages
+
+code{
+
+ |-- en
+ |-- epub
+ |-- hashes
+ |-- html
+ | |-- viral_spiral.david_bollier
+ | |-- manifest
+ | |-- qrcode
+ | |-- odt
+ | |-- pdf
+ | |-- sitemaps
+ | |-- txt
+ | |-- xhtml
+ | `-- xml
+ |-- po4a
+ | `-- live-manual
+ | |-- po
+ | |-- fr
+ | `-- pot
+ `-- _sisu
+ |-- css
+ |-- image
+ |-- image_sys -> ../../_sisu/image_sys
+ `-- xml
+ |-- rnc
+ |-- rng
+ `-- xsd
+
+}code
+
+#by: language
+subject_dir/en/manifest/filename.html
+
+3~ By Filetype
+
+The by filetype directory structure separates output files by filetype, all html files in one directory pdfs in another and so on. Filenames are given a language extension.
+
+Its selection is configured in sisurc.yml
+
+output_dir_structure_by: filetype
+
+% works for html epub odf, pdf, sortof for info NOT for man pages
+
+code{
+
+ |-- epub
+ |-- hashes
+ |-- html
+ |-- viral_spiral.david_bollier
+ |-- manifest
+ |-- qrcode
+ |-- odt
+ |-- pdf
+ |-- po4a
+ |-- live-manual
+ | |-- po
+ | |-- fr
+ | `-- pot
+ |-- _sisu
+ | |-- css
+ | |-- image
+ | |-- image_sys -> ../../_sisu/image_sys
+ | `-- xml
+ | |-- rnc
+ | |-- rng
+ | `-- xsd
+ |-- sitemaps
+ |-- txt
+ |-- xhtml
+ `-- xml
+
+}code
+
+#by: filetype
+subject_dir/html/filename/manifest.en.html
+
+3~ By Filename
+
+The by filename directory structure places most output of a particular file (the different filetypes) in a common directory.
+
+Its selection is configured in sisurc.yml
+
+output_dir_structure_by: filename
+
+% works for html epub odf, pdf, sortof for info NOT for man pages
+
+code{
+
+ |-- epub
+ |-- po4a
+ |-- live-manual
+ | |-- po
+ | |-- fr
+ | `-- pot
+ |-- _sisu
+ | |-- css
+ | |-- image
+ | |-- image_sys -> ../../_sisu/image_sys
+ | `-- xml
+ | |-- rnc
+ | |-- rng
+ | `-- xsd
+ |-- sitemaps
+ |-- src
+ |-- pod
+ `-- viral_spiral.david_bollier
+
+}code
+
+#by: filename
+subject_dir/filename/manifest.en.html
+
+3~ Remote Directories
+
+code{
+
+./subject_name/
+
+% containing sub_directories named after the generated files from which they are made
+
+./subject_name/src
+
+% contains shared source files text and binary e.g. sisu_manual.sst and sisu_manual.sst.zip
+
+./subject_name/_sisu
+
+% configuration file e.g. sisurc.yml
+
+./subject_name/_sisu/skin
+
+% skins in various skin directories doc, dir, site, yml
+
+./subject_name/_sisu/css
+
+./subject_name/_sisu/image
+
+% images for documents contained in this directory
+
+./subject_name/_sisu/mm
+
+}code
+
+3~ Sisupod
+
+code{
+
+./sisupod/
+
+% files stored at this level e.g. sisu_manual.sst
+
+./sisupod/_sisu
+
+% configuration file e.g. sisurc.yml
+
+./sisupod/_sisu/skin
+
+% skins in various skin directories doc, dir, site, yml
+
+./sisupod/_sisu/css
+
+./sisupod/_sisu/image
+
+% images for documents contained in this directory
+
+./sisupod/_sisu/mm
+
+}code
+
+2~ Organising Content
+
+
+
+% .SH "SKINS \- document, directory and site skins"
+
+
diff --git a/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_css.ssi b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_css.ssi
new file mode 100644
index 00000000..7ffc654b
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_css.ssi
@@ -0,0 +1,42 @@
+% SiSU insert 2.0
+
+@title: SiSU
+ :subtitle: CSS - Cascading Style Sheets
+
+@creator:
+ :author: Amissah, Ralph
+
+@date:
+ :created: 2007-08-28
+ :issued: 2007-08-28
+ :available: 2007-08-28
+ :published: 2007-09-16
+ :modified: 2011-02-07
+
+@rights:
+ :copyright: Copyright (C) Ralph Amissah 2007
+ :license: GPL 3 (part of SiSU documentation)
+
+:A~? CSS
+
+1~css CSS - Cascading Style Sheets (for html, XHTML and XML)
+
+CSS files to modify the appearance of SiSU html, XHTML or XML may be placed in the configuration directory: ./_sisu/css ; ~/.sisu/css or; /etc/sisu/css and these will be copied to the output directories with the command sisu -CC.
+
+The basic CSS file for html output is html.css, placing a file of that name in directory _sisu/css or equivalent will result in the default file of that name being overwritten.
+
+HTML:
+html.css
+
+XML DOM:
+dom.css
+
+XML SAX:
+sax.css
+
+XHTML:
+xhtml.css
+
+The default homepage may use homepage.css or html.css
+
+Under consideration is to permit the placement of a CSS file with a different name in directory _sisu/css directory or equivalent.~{ SiSU has worked this way in the past, though this was dropped as it was thought the complexity outweighed the flexibility, however, the balance was rather fine and this behaviour could be reinstated. }~
diff --git a/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_description.sst b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_description.sst
new file mode 100644
index 00000000..9f8fdcd8
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_description.sst
@@ -0,0 +1,527 @@
+% SiSU 4.0
+
+@title: SiSU - SiSU information Structuring Universe / Structured information, Serialized Units
+ :subtitle: Description
+
+@creator:
+ :author: Amissah, Ralph
+
+@date:
+ :created: 2002-11-12
+ :issued: 2002-11-12
+ :available: 2002-11-12
+ :published: 2007-08-30
+ :modified: 2012-10-03
+
+@rights:
+ :copyright: Copyright (C) Ralph Amissah 2007
+ :license: GPL 3 (part of SiSU documentation)
+
+@classify:
+ :topic_register: electronic documents;SiSU:document:description;sisu:document:description
+ :subject: ebook, epublishing, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, search
+
+:A~? @title @creator
+
+:B~? SiSU an attempt to describe
+
+1~ Description
+
+2~ Outline
+
+SiSU is a flexible document preparation, generation publishing and search system.~{ This information was first placed on the web 12 November 2002; with predating material taken from http://www.jus.uio.no/lm/lm.information/toc.html part of a site started and developed since 1993. See document metadata section http://www.jus.uio.no/sisu/SiSU/metadata.html or manifest page http://www.jus.uio.no/sisu/SiSU/sisu_manifest.html for information on this version. Dates related to the development of SiSU may be tracked in the http://www.jus.uio.no/sisu/SiSU/changelog.html or the Git repository http://git.sisudoc.org/?p=code/sisu.git;a=summary some of the more significant events may be contained within the Chronology section of this document http://www.jus.uio.no/sisu/sisu_chronology }~
+
+SiSU ("SiSU information Structuring Universe" or "Structured information, Serialized Units"),~{ also chosen for the meaning of the Finnish term "sisu". }~ is a Unix command line oriented framework for document structuring, publishing and search. Featuring minimalistic markup, multiple standard outputs, a common citation system, and granular search.
+
+Using markup applied to a document, SiSU can produce plain text, HTML, XHTML, XML, OpenDocument, EPUB, LaTeX or PDF files, and populate an SQL database with objects~{ objects include: headings, paragraphs, verse, tables, images, but not footnotes/endnotes which are numbered separately and tied to the object from which they are referenced. }~ (equating generally to paragraph-sized chunks) so searches may be performed and matches returned with that degree of granularity (e.g. your search criteria is met by these documents and at these locations within each document). Document output formats share a common object numbering system for locating content. This is particularly suitable for "published" works (finalized texts as opposed to works that are frequently changed or updated) for which it provides a fixed means of reference of content.
+
+SiSU is the data/information structuring and transforming tool, that has resulted from work on one of the oldest law web projects. It makes possible the one time, simple human readable markup of documents, that SiSU can then publish in various forms, suitable for paper~{ PDF via LaTeX }~, web~{ currently HTML (two forms of HTML presentation one based on css the other on tables), and /PHP/; potentially structured XML }~ and relational database~{ any SQL - currently PostgreSQL and SQLite (for portability, testing and development) }~ presentations, retaining common data-structure and meta-information across the output/presentation formats. Several requirements of legal and scholarly publication on the web have been addressed, including the age old need to be able to reliably cite/pinpoint text within a document, to easily make footnotes/endnotes, to allow for semantic document meta-tagging, and to keep required markup to a minimum. These and other features of interest are listed and described below. A few points are worth making early (and will be repeated a number of times):
+
+_1 (i) The SiSU document generator was the first to place material on the web with a system that makes possible citation across different document types, with paragraph, or rather object citation numbering~{ previously called "text object numbering" }~ a text positioning system, available for the pinpointing of text, 1997, a simple idea from which much benefit, and SiSU remains today, to the best of my knowledge, the only multiple format e-book/ electronic-document system on the web that gives you this possibility (including for relational databases).
+
+_1 (ii) Markup is done once for the multiple formats produced.
+
+_1 (iii) Markup is simple, and human readable (with a little practice), in almost all cases there is less and simpler markup required than basic HTML. In any event the markup required is very much simpler than the HTML, EPUB, LaTeX, [lout], structured XML, ODT (Open Document Format text), PostgreSQL or SQLite feed etc. that you can have SiSU generate for you.
+
+_1 (iv) SiSU is a batch processor, dealing with as many files as you need to generate at a time.
+
+_1 (v) Scalability is dependent on your file system, the database (currently PostgreSQL and/or SQLite) and your hardware.
+
+SiSU Sabaki~{ SiSU Sabaki, release version. Pre-release version SiSU Scribe, and version prior to that SiSU nicknamed Scribbler. Pre-release versions go back several years. Both Scribbler and Scribe (still maintained) made system calls to SiSU's various parts, instead of using libraries. }~ (or just SiSU) is the provisional name given to the software described here that helps structure documents for web and other publication. The name SiSU is a loose anagram for something along the lines of *{/{"SiSU is structuring unit"}/}*, or /{"SiSU, information structuring unit"}/ or the more descriptive /{"Structured information, Serialized Units"}/ or *{/{"simple - information structuring unit"}/}* or the more descriptive /{"Structured information, Serialized Units"}/ or what it may be directed towards /{"*semantic* and *{information structuring universe}*"}/,~{ A little universe it may be, but semantic you may have a hard time getting away with, given the meaning the word has taken on with markup. On a document wide basis semantic information may be provided, which can be really useful, (and meaningful, especially) if you have a large document set, and use this with rss feeds or in an sql database etc. On a markup level, I have little inclination to add semantic markup formally beyond references, title, author [Dublin Core entities? addresses?] etc. Actually this deserves a bit of thought possibly use letter tags (including letter alias/synonyms for font faces) to create a small set of default semantic tags, with the possibility for per document adjustments. Will seek to permit XML entity tagging, within SiSU markup and have that ignored/removed by the parts of the program that have no use for it. }~ tongue in cheek, only just. Guess I'll get away with *{/{"Simple - information Structuring Universe"}/}*. SiSU is also a Finnish word roughly meaning guts, inner strength and perseverance.~{ "Sisu refers not to the courage of optimism, but to a concept of life that says, 'I may not win, but I will gladly give my life for what I believe.'" Aini Rajanen, Of Finnish Ways, 1981, p. 10. \\ http://www.humanlanguages.com/finnishenglish/rlfs.htm \\ "Every Finn has his own pet definition. To me, sisu means patience without passion. But there are many varieties of sisu. Sisu can be a sudden outburst or it can be the kind that lasts. A man can have both kinds. It is outside reason. It is something in the soul. It comes from oneself. For instance, it makes a soldier do things because he himself must, not because he has been told." Paavo Nurmi \\ http://personalweb.smcvt.edu/tmatikainen/finnishtraditions.htm }~
+
+SiSU was born of the need to find a way, with minimal effort, and for as wide a range of document types as possible, to produce high quality publishing output in a variety of document formats. As such it was necessary to find a simple document representation that would work across a large number of document types, and the most convenient way(s) to produce acceptable output formats. The project leading to this program was started in 1993 (together with the trade law project now known as Lex Mercatoria) as an investigation of how to effectively/efficiently place documents on the web. The unified document handling, together with features such as paragraph numbering, endnote handling and tables... appeared in 1996/97. SiSU was originally written in Perl,~{ http://www.perl.org/ }~ and converted to Ruby,~{ http://www.ruby-lang.org/en/ }~ in 2000, one of the most impressive programming languages in existence! In its current form it has been written to run on the Gnu/Linux platform, and in particular on Debian,~{ http://www.debian.org/ }~ taking advantage of many of the wonderful projects that are available there.
+
+SiSU markup is based on requiring the minimum markup needed to determine the structure of a document. (This can be as little as saying in a header to look for the word Book at a specified level and the word Chapter at another level). SiSU then breaks a document into its smallest parts (at a heading, and paragraph level) while retaining all structural information. This break up of the document and information on its structure is taken advantage of in the transformations made in generating the very different output types that can be created, and in providing as much as can be for what each output type is best at doing, e.g. LaTeX (professional document typesetting, easy conversion to PDF or Postscript), EPUB, XML (in this case, structural representation), ODF (Open Document Format text), SQL (e.g. document search; representing constituent parts of documents based on their structure, headings, chapters, paragraphs as required; user control).~{ where explicit structure is provided through the use of tagging headings, it could be reduced (still) further, for example by reducing the number of characters used to identify heading levels; but in many cases even that information is not required as regular expressions can be used to extract the implicit structure. }~
+
+From markup that is simpler and more sparse than HTML you get:
+
+_* far greater output possibilities, including HTML, EPUB, XML, ODF (Open Document Format text), LaTeX (PDF), and SQL;
+
+_* the advantages implicit in the very different output possibilities;
+
+_* a common citation system (for all outputs - including the relational database, search results are relevant for all outputs);
+
+For more see the short summary of features provided below.
+
+SiSU processes files with minimal tagging to produce various document outputs including HTML, EPUB, ODF, LaTeX (which is converted to PDF) and if required loads the structured information into an SQL database (PostgreSQL and SQLite have been used for this). SiSU produces an intermediate processing format.~{ This proved to be the easiest way to develop syntax, changes could be made, or alternatives provided for the markup syntax whilst the intermediate markup syntax was largely held constant. There is actually an optional second intermediate markup format in YAML http://www.yaml.org/ }~
+
+SiSU was originally used in constructing Lex Mercatoria http://lexmercatoria.org/ or http://www.jus.uio.no/lm/ (one of the oldest law web sites), and considerable thought went into producing output that would be suitable for legal and academic writings (that do not have formulae) given the limitations of HTML, and publication in a wide variety of "formats", in particular in relation to the convenient and accurate citation of text. However, the construction of Lex Mercatoria uses only a fraction of the features available from SiSU today, /vis/ generation of flat file structures, rather than in addition the building of ("granular") SQL database content, (at an object level with relevant relational tables, and other outputs also available).
+
+2~ Short summary of features *~summary
+
+!_ (i)
+markup syntax: (a) simpler than html, (b) mnemonic, influenced by mail/messaging/wiki markup practices, (c) human readable, and easily writable,
+
+!_ (ii)
+(a) minimal markup requirement, (b) single file marked up for multiple outputs,
+
+notes:
+
+* documents are prepared in a single UTF-8 file using a minimalistic mnemonic syntax. Typical literature, documents like "War and Peace" require almost no markup, and most of the headers are optional.
+
+* markup is easily readable/parsed by the human eye, (basic markup is simpler and more sparse than the most basic html), [this may also be converted to XML representations of the same input/source document].
+
+* markup defines document structure (this may be done once in a header pattern-match description, or for heading levels individually); basic text attributes (bold, italics, underscore, strike-through etc.) as required; and semantic information related to the document (header information, extended beyond the Dublin core and easily further extended as required); the headers may also contain processing instructions.
+
+!_ (iii)
+(a) multiple outputs primarily industry established and institutionally accepted open standard formats, include amongst others: plaintext (UTF-8); html; EPUB; (structured) XML; ODF (Open Document text)l; LaTeX; PDF (via LaTeX); SQL type databases (currently PostgreSQL and SQLite). Also produces: concordance files; document content certificates (md5 or sha256 digests of headings, paragraphs, images etc.) and html manifests (and sitemaps of content). (b) takes advantage of the strengths implicit in these very different output types, (e.g. PDFs produced using typesetting of LaTeX, databases populated with documents at an individual object/paragraph level, making possible granular search (and related possibilities))
+
+!_ (iv)
+outputs share a common numbering system (dubbed "object citation numbering" (ocn)) that is meaningful (to man and machine) across various digital outputs whether paper, screen, or database oriented, (PDF, html, EPUB, XML, Opendocument, SQLite, PostgreSQL), this numbering system can be used to reference content.
+
+!_ (v)
+SQL databases are populated at an object level (roughly headings, paragraphs, verse, tables) and become searchable with that degree of granularity, the output information provides the object/paragraph numbers which are relevant across all generated outputs; it is also possible to look at just the matching paragraphs of the documents in the database; [output indexing also work well with search indexing tools like hyperesteier].
+
+!_ (vi)
+use of semantic meta-tags in headers permit the addition of semantic information on documents, (the available fields are easily extended)
+
+!_ (vii)
+creates organised directory/file structure for (file-system) output, easily mapped with its clearly defined structure, with all text objects numbered, you know in advance where in each document output type, a bit of text will be found (e.g. from an SQL search, you know where to go to find the prepared html output or PDF etc.)... there is more; easy directory management and document associations, the document preparation (sub-)directory may be used to determine output (sub-)directory, the skin used, and the SQL database used,
+
+!_ (viii)
+"Concordance file" wordmap, consisting of all the words in a document and their (text/ object) locations within the text, (and the possibility of adding vocabularies),
+
+!_ (ix)
+document content certification and comparison considerations: the document and each object within it stamped with an md5 hash making it possible to easily check or guarantee that the substantive content of a document is unchanged.
+
+!_ (x)
+SiSU's minimalist markup makes for meaningful "diffing" of the substantive content of markup-files,
+
+!_ (xi)
+easily skinnable, document appearance on a project/site wide, directory wide, or document instance level easily controlled/changed,
+
+!_ (xii)
+in many cases a regular expression may be used (once in the document header) to define all or part of a documents structure obviating or reducing the need to provide structural markup within the document,
+
+!_ (xiii)
+prepared files may be batch process, documents produced are static files so this needs to be done only once but may be repeated for various reasons as desired (updated content, addition of new output formats, updated technology document presentations/representations)
+
+!_ (xiv)
+possible to pre-process, which permits: the easy creation of standard form documents, and templates/term-sheets, or; building of composite documents (master documents) from other sisu marked up documents, or marked up parts, i.e. import documents or parts of text into a main document should this be desired
+
+there is a considerable degree of future-proofing, output representations are "upgradeable", and new document formats may be added.
+
+!_ (xv)
+there is a considerable degree of future-proofing, output representations are "upgradeable", and new document formats may be added: (a) modular, (thanks in no small part to Ruby) another output format required, write another module.... (b) easy to update output formats (eg html, XHTML, EPUB, LaTeX/PDF produced can be updated in program and run against whole document set), (c) easy to add, modify, or have alternative syntax rules for input, should you need to,
+
+!_ (xvi)
+scalability, dependent on your file-system and on the relational database used (currently PostgreSQL and SQLite), and your hardware,
+
+!_ (xvii)
+only marked up files need be backed up, to secure the larger document set produced,
+
+!_ (xviii)
+document management,
+
+!_ (xix)
+Syntax highlighting for SiSU markup is available for a number of text editors.
+
+!_ (xx)
+remote operations: (a) run SiSU on a remote server, (having prepared sisu markup documents locally or on that server, i.e. this solution where sisu is installed on the remote server, would work whatever type of machine you chose to prepare your markup documents on), (b) generated document outputs may be posted by sisu to remote sites (using rsync/scp) (c)document source (plaintext utf-8) if shared on the net may be identified by its url and processed locally to produce the different document outputs.
+
+!_ (xxi)
+document source may be bundled together (automatically) with associated documents (multiple language versions or master document with inclusions) and images and sent as a zip file called a sisupod, if shared on the net these too may be processed locally to produce the desired document outputs, these may be downloaded, shared as email attachments, or processed by running sisu against them, either using a url or the filename.
+
+!_ (xxii)
+for basic document generation, the only software dependency is Ruby, and a few standard Unix tools (this covers plaintext, html, EPUB, XML, ODF, LaTeX). To use a database you of course need that, and to convert the LaTeX generated to PDF, a LaTeX processor like tetex or texlive.
+
+as a developers tool it is flexible and extensible
+
+SiSU was developed in relation to legal documents, and is strong across a wide variety of texts (law, literature...). SiSU handles images but is not suitable for formulae/ statistics, or for technical writing at this time.
+
+SiSU has been developed and has been in use for several years. Requirements to cover a wide range of documents within its use domain have been explored.
+
+Some modules are more mature than others, the most mature being html and LaTeX / pdf. PostgreSQL and search functions are useable and together with /ocn/ unique (to the best of my knowledge). The XML output document set is "well formed" but largely proof of concept.
+
+2~ How it works
+
+SiSU markup is fairly minimalistic, it consists of: a (largely optional) document header, made up of information about the document (such as when it was published, who authored it, and granting what rights) and any processing instructions; and markup within text which is related to document structure and typeface. SiSU must be able to discern the structure of a document, (text headings and their levels in relation to each other), either from information provided in the instruction header or from markup within the text (or from a combination of both). Processing is done against an abstraction of the document comprising of information on the document's structure and its objects,~{ objects include: headings, paragraphs, verse, tables, images, but not footnotes/endnotes which are numbered separately and tied to the object from which they are referenced. }~ which the program serializes (providing the object numbers) and which are assigned hash sum values based on their content. This abstraction of information about document structure, objects, (and hash sums), provides considerable flexibility in representing documents different ways and for different purposes (e.g. search, document layout, publishing, content certification, concordance etc.), and makes it possible to take advantage of some of the strengths of established ways of representing documents, (or indeed to create new ones).
+
+2~ Simple markup
+
+SiSU markup is based on requiring the minimum markup needed to determine the structure of a document. (This can be as little as saying in a header to look for the word Book at a specified level and the word Chapter at another level). SiSU then breaks a document into its smallest parts (at a heading, and paragraph level) while retaining all structural information. This break up of the document and information on its structure is taken advantage of in the transformations made in generating the very different output types that can be created, and in providing as much as can be for what each output type is best at doing, e.g. LaTeX (professional document typesetting, easy conversion to pdf or Postscript), EPUB, XML (in this case, structural representation), ODF (OpenDocument), SQL (e.g. document search; representing constituent parts of documents based on their structure, headings, chapters, paragraphs as required; user control).~{ where explicit structure is provided through the use of tagging headings, it could be reduced (still) further, for example by reducing the number of characters used to identify heading levels; but in many cases even that information is not required as regular expressions can be used to extract the implicit structure. }~
+
+3~ Sparse markup requirement, try to get the most out of markup
+
+One of its strengths is that very small amounts of initial tagging is required for the program to generate its output.
+
+This is a basic markup example:
+
+_* { basic markup example, text file - an international convention }http://www.jus.uio.no/sisu/src/un_contracts_international_sale_of_goods_convention_1980.sst ~{ http://www.jus.uio.no/sisu/src/un_contracts_international_sale_of_goods_convention_1980.sst output provided as example in the next section }~
+
+Emphasis has been on simplicity and minimalism in markup requirements. Design philosophy is to try keep the amount of markup required low, for whatever has been determined to be acceptable output.~{ seems there are several "smart ASCIIs" available, primarily for ascii to html conversion, that make this, and reasonable looking ascii their goal \\ http://webseitz.fluxent.com/wiki/SmartAscii \\ http://daringfireball.net/projects/markdown/ \\ http://www.textism.com/tools/textile/ }~
+
+SiSU's markup is more minimalistic and simpler than (the equivalent) html and for it, you get considerably more than just html, as this preparation gives you all available output formats, upon request.
+
+3~ Single markup file provides multiple output formats
+
+For each document, there is only one (input, minimalistically marked up) file from which all the available output types are generated.~{ These include richly laid out and linked html (table or css variants), /PHP/, LaTeX (from which pdf portrait and landscape documents are produced), texinfo (for info files etc.), and PostgreSQL and/or SQLite. And the opportunity to fairly easily build additional modules, such as XML. See the examples provided in this document. }~
+
+Eg. the markup example:
+
+_* {~^ original text file - an international convention }http://www.jus.uio.no/sisu/src/un_contracts_international_sale_of_goods_convention_1980.sst
+
+Produces the following output:
+
+_* {~^ Manifest of output presentations generated }http://www.jus.uio.no/sisu/un_contracts_international_sale_of_goods_convention_1980/sisu_manifest.html
+
+_* {~^ Segmented html version of document }http://www.jus.uio.no/sisu/un_contracts_international_sale_of_goods_convention_1980/toc.html
+
+_* {~^ Full length html document }http://www.jus.uio.no/sisu/un_contracts_international_sale_of_goods_convention_1980/doc.html
+
+_* {~^ EPUB version of document }http://www.jus.uio.no/sisu/epub/un_contracts_international_sale_of_goods_convention_1980.epub
+
+_* {~^ pdf landscape version of document }http://www.jus.uio.no/sisu/un_contracts_international_sale_of_goods_convention_1980/landscape.letter.pdf
+
+_* {~^ pdf portrait version of document }http://www.jus.uio.no/sisu/un_contracts_international_sale_of_goods_convention_1980/portrait.letter.pdf
+
+_* {~^ odt open document format text version of document }http://www.jus.uio.no/sisu/un_contracts_international_sale_of_goods_convention_1980/opendocument.odt
+
+_* {~^ xml sax version of document }http://www.jus.uio.no/sisu/un_contracts_international_sale_of_goods_convention_1980/sax.xml
+
+_* {~^ xml dom version of document }http://www.jus.uio.no/sisu/un_contracts_international_sale_of_goods_convention_1980/dom.xml
+
+_* {~^ clean tex ascii version of document }http://www.jus.uio.no/sisu/un_contracts_international_sale_of_goods_convention_1980/plain.txt
+
+_* {~^ Concordance }http://www.jus.uio.no/sisu/un_contracts_international_sale_of_goods_convention_1980/concordance.html
+
+(and in addition to these: PostgreSQL, SQLite, texinfo and -{YAML}- ~{ discontinued for the time being }~ versions if desired)
+
+3~ Syntax relatively easy to read and remember
+
+Syntax is kept simple and mnemonic.~{ SiSU markup syntax, an incomplete summary: http://www.jus.uio.no/sisu/sisu_markup/toc.html \\ Visual check of elementary font face modifiers: *bold* *{bold}* !{emphasis}! /{italics}/ _{underscore}_ -{strikethrough}- ^{superscript}^ ,{subscript}, }~
+
+3~ Kept simple by having a limited publishing feature set, and features identified as most important, are available across several document types
+
+To keep SiSU markup sparse and simple SiSU deliberately provides a limited publishing feature set, including: indent levels; bold; italics; superscript; subscript; simple tables; images; tables of contents and; endnotes. Which in most cases are available across the different output formats.
+
+The publishing feature set may be expanded as required.
+
+2~ Designed with usability in mind
+
+Output is designed to be uniform, easy to read, navigate and cite.
+
+2~ Code separate from content
+
+Code~{ the program that generates the documents }~ is separated from content. This means that when changes are desired in the output presentation, the code that produces them, and not the marked up text data set (which could be thousands of documents) is modified. Separating code from content makes large scale changes to output appearance trivial, and permits the easy addition of new output modules.
+
+2~ Object citation numbering, a text or object positioning / citation system - "paragraph" (or text object) numbering, that remains same and usable across all output formats by people and machine *~citation *~ocn
+
+Object citation numbering is a simple object (text) positioning and cition system that is human relevant and machine useable, used by SiSU for all manner of presentations, and that is available for use in all text mappings. It is based on the automated sequential numbering of objects (roughly paragraphs, (headings, tables, verse) or other blocks of text or images etc.). The text positioning system (in which I claim copyright) is invaluable for publishing requiring the citing text across multiple output formats, and for the general mapping of text within a document:
+
+_* in html, html not being easily citeable (change font size, or use a different browser and the page on which specific text appears has changed), and
+
+_* across multiple formats being common to all output formats html/xml/pdf/sql output,
+
+_* the results of an sql search can just be "live" citation references to the documents in which the text is found, {~^ much like an index (see image examples provided). }http://www.jus.uio.no/sisu/SiSU/1.html#search
+
+I claim copyright on the system I use which is the most basic of all, numbering all text in headings and paragraphs sequentially (with tables and images being treated as a single paragraph) and only footnotes/endnotes not following this numbering, as their position in text is not strictly determined, (a change from footnotes to endnotes would change their numbering), footnotes instead "belong" to the paragraph from which they are referenced, and have sequential numbers of their own.
+
+SiSU has a paragraph numbering system, that remains the same regardless of the output format. This provides an effective means of citation, pinpointing text accurately in all output formats, using the same reference. This is particularly useful where text has to be located across different output formats - for example once html is printed the number of pages and pages on which given text is found will vary depending on the browser, its settings the font size setting etc. Similarly SiSU produces pdf in different forms, eg. on the example site Lex Mercatoria as portrait and landscape documents - here too page numbering varies, but paragraph numbering is the same, /{vis a vis}/ all versions of the text (portrait and landscape pdf and the html versions of the text, and as stored (with "paragraphs" as records) to the PostgreSQL or SQLite database).
+
+These numbers are placed in the text margins and are intended to be independent of and not to interfere with authors tagging. [The citation system (object citation numbering system, automated "paragraph numbering") which is automatically generated and is common and identical across all document formats] The paragraph numbering system is more accurately described as an (text) object numbering system, as headings are also numbered... all headings and paragraphs are numbered sequentially. Endnotes are automatically numbered independently and rather "belong" to the paragraph from which they are referenced, as an endnote does not (necessarily) form a part of a documents sequence, (they may be produced as either endnotes or footnotes (or both depending on what output you choose to look at - if you take the segmented html version document provided as an example, you will find that the endnotes are placed both at the end of each section, and in a separate section of their own called endnotes, and these are hyper-linked)). An attractive feature of providing citation numbering in this way is that it is independent of the document structure... it remains the same regardless of what is done about the document structure.
+
+The rules have been kept very simple, unique incremental object citation numbers are assigned to headings, paragraphs, verse, tables and images. It is possible to manually override this feature on a per heading or comment basis though this should be used exceptionally, it may be of use where there a substantive text, and the addition of a minor comment by the publisher that should not be mapped as part of the text.
+
+The object citation number markers contain additional numbering information with regard to the document structure, that can be used for alternative presentations, including such detail as the type of object (heading, paragraph, table, image, etc.), numbered sequentially.
+
+An advantage is that the numbering remains the same regardless of document structure.
+
+Text object ("paragraph") numbering is the same for all output versions of the same document, vis HTML, EPUB, PDF, PgSQL, etc.
+
+In the relational database, as individual text objects of a document stored (and indexed) together with object numbers, and all versions of the document have the same numbering, the results of searches may be tailored just to provide the location of the search result in all available document formats.
+
+/{ Note: there is a bug in the released behaviour of object citation numbering, (not certain when it was introduced) tables should be numbered, ie each table gets an ocn, required amongst other things for relational database. This will be corrected in a future release. Citation numbering of existing documents that contain tables will changed. }/
+
+2~ Handling of Dublin Core meta-tags making use of the Resource Description Framework
+
+SiSU is able to use meta tags based on the Dublin Core~{ http://dublincore.org/ }~ and Resource Description Framework~{ http://www.w3.org/RDF/ }~
+
+This provides the means of providing semantic information about a document, both as computer processable meta-tags, and as human readable information that may be of value for classification purposes.
+
+This information is provided both in html metatags, and (where available) under the section titled "Document Information - Metadata", near the end of a document, for example in the segmented html version of this text at: http://www.jus.uio.no/sisu/SiSU/metadata.html
+
+2~ Easy directory management
+
+#1 Directory file association, skins and special image management, made simpler.~{ The previous way was directory associations for file output were set up in the configuration file. The present system is a more natural way to work requireing less configuration. }~
+
+The last part of the name of the work directory in which markup is being done, or rather from where SiSU is run in order to generate document output, is used in determining the sub-directory name for output files, that is created in the document output directory. This provides a rather easy way to associate documents e.g. of a given subject, or by owner.
+
+code{
+
+/www/docs
+ /intellectual_property
+ /arbitration
+ /contract_law
+
+/www/docs
+ /ralph
+ /sisu
+
+}code
+
+all are placed in their own directories within the directory structure created. Similar rules are used in the creation of sql type databases (though they can be overridden).
+
+There are a couple of further associations with these directories.
+
+# If the working directory has within it a sub-directory called image_local, the images within that directory are used for references to images, that are not part of the default site build.
+
+2~ Document Version Control Information
+
+The possibility of citing an exact document version.
+
+Permits the inclusion of document version control information to the document body and metatags.~{ from a version control system such as CVS }~ This provides a much more certain method of referring to the exact version of a particular document, (assuming that the document is from a trusted source, that will retain earlier versions of a document).~{ The version control system must be run, so the version number is obtained, prior to the SiSU document generation, and subsequent posting of the document. }~
+
+This information (where available) is provided under the section of the document titled "Document Information - MetaData", near the end of a document, for example in the segmented html version of this text at: http://www.jus.uio.no/sisu/SiSU/metadata.html
+
+2~ Table of contents
+
+SiSU produces a rudimentary a table of contents based on document headings.
+
+2~ Auto-numbering of headings
+
+Headings can be automatically numbered, (and automatically named for hyper-linking)
+
+2~ Numbering and cross-hyperlinking of endnotes
+
+SiSU can automatically number footnotes/endnotes. This is the default operation where no number is provided.
+
+Footnotes/endnotes may also be manually numbered. Where a number, or numbers are provided for a footnote/endnote, this does not increment the automatic footnote/endnote number counter.
+
+In the html output footnotes/endnotes are cross-hyper-linked (to their reference point and vice versa). In th pdf output footnotes are linked from their reference point only.
+
+2~ "Skinnable"
+
+SiSU is skinnable, on a site-wide, directory-wide and per document basis, so different looking versions of things may be produced with little difficulty. There is a default skin which may be modified, as the background site skin, and each working directory may have a skin associated with it, as may each individual document. The hierarchy of application is document, directory, then site... ie if a document skin exists it gets precedence.
+
+Whilst it is skinnable, the default output styles are selected to work across the widest possible range of document types.
+
+2~ Multiple Outputs
+
+From markup that is simpler and more sparse than html you get:
+
+_* far greater output possibilities, including multiple html types, XML (different structured types), LaTeX (pdf landscape, portrait), and SQL (PostgreSQL or SQLite or other);
+
+_* the advantages implicit in these very different output possibilities;~{ e.g. LaTeX (professional document typesetting, easy conversion to pdf or Postscript), XML (in this case, structural representation), SQL (e.g. document set searches; representation of the constituent parts of documents based on their structure, headings, chapters, paragraphs as desired; control of use) }~
+
+_* a common citation system
+
+As many output formats/presentations as one cares to write modules for - several types of html (e.g. structure based on css, or structure based on tables); /{LaTeX/pdf}/ and /{Lout/pdf}/; PgSQL other databases easily added; yaml...
+
+3~ html - several presentations: full length & segmented; css & table based
+
+Most documents are produced in single and segmented html versions, described below:
+
+!_ The Scroll (full length text presentations)
+
+The full length of the text in a single scrollable document.~{ CISG http://www.jus.uio.no/lm/un.contracts.international.sale.of.goods.convention.1980/doc.html \\ The Unidroit Contract Principles http://www.jus.uio.no/lm/unidroit.contract.principles.1994/doc.html or \\ The Autonomous Contract http://www.jus.uio.no/lm/autonomous.contract.2000.amissah/doc.html }~ As a rule the files they are saved in are named: /doc/ or more precisely /{doc.html}/
+
+For various reasons texts may only be provided in this form (such as this one which is short), though most are also provided as segmented texts.
+
+"Scroll" is a reference to the historical scroll, a single long document/ parchment, and also no doubt to what you will have to do to get to the bottom of the text.~{ Scrolling is not however necessarily confined to full length documents as you will have to scroll to get to the bottom of any long segment (eg. chapter) of a segmented text. }~
+
+!_ The Segmented Text
+
+The text divided into segments (such as articles or chapters depending on the text)~{ CISG http://www.jus.uio.no/lm/un.contracts.international.sale.of.goods.convention.1980/toc.html \\ The Unidroit Principles http://www.jus.uio.no/lm/unidroit.contract.principles.1994/toc.html \\ The Autonomous Contract http://www.jus.uio.no/lm/autonomous.contract.2000.amissah/toc.html or \\ WTA 1994 http://www.jus.uio.no/lm/wta.1994 }~ As a rule the files they are saved in are named: /toc/ and /index/ or more precisely /{toc.html}/ and /{index.html}/
+
+If you know exactly what you are looking for, loading a segment of text is faster (the segments being smaller). Occasionally longer documents such as the WTA 1994 http://www.jus.uio.no/lm/wta.1994/toc are only provided in segmented form.
+
+!_ Cascading Style Sheet, and Table based html
+
+SiSU outputs html, two current standard forms available are:
+
+{ css based }http://www.jus.uio.no/sisu/SiSU/toc.html
+
+and
+
+table based [largely discontinued]~{ formatting possibility still exists in code tree but maintenance has been largely discontinuted. }~
+
+!_ The html is tested across several browsers
+
+I like to remind you that there are other excellent browsers out there, many of which have long supported practical features like tabbing.
+
+The html is tested across several browsers, including:
+
+_* {~^ *Firefox* (Mozilla-Firefox) }http://www.mozilla.org/products/firefox/
+
+_* {~^ Kazehakase }http://kazehakase.sourceforge.jp/
+
+_* {~^ Konqueror }http://www.konqueror.org/
+
+_* {~^ Mozilla }http://www.mozilla.org/
+
+_* {~^ MS Internet Explorer }http://www.microsoft.com/windows/ie/default.asp
+
+_* {~^ Netscape }http://home.netscape.com/comprod/mirror/client_download.html
+
+_* {~^ Opera }http://www.opera.com/
+
+Also lighter weight graphical browsers:
+
+_* {~^ Dillo }http://www.dillo.org/
+
+_* {~^ *Epiphany* }http://www.gnome.org/projects/epiphany/
+
+_* {~^ *Galeon* }http://galeon.sourceforge.net/
+
+And for console/text browsing:
+
+_* {~^ *elinks* }http://elinks.or.cz/
+
+_* {~^ *links2* }http://links.twibright.com/
+
+_* {~^ *w3m* }http://w3m.sourceforge.net/
+
+The html tables output is rendered more accurately across a wider variety set and older versions of browsers (than the html css output).
+
+3~ EPUB
+
+SiSU generates EPUB documents.
+
+3~ XML
+
+SiSU generates well formed XML, and multiple versions. An XML SAX version with a flat/shallow structure, and XML DOM version with a deeper (embedded) structure. There is also a released working xhtml module. Examples of SAX and DOM versions are provided within this document.
+
+3~ ODT:ODF, Open Document Format - ISO/IEC 26300:2006
+
+SiSU generates Open Document Output format.
+
+3~ PDF - portrait and landscape, (through the generation of LaTeX output which is then transformed to pdf)
+
+SiSU outputs LaTeX if required which is easily transformed to PDF.~{ LaTeX and pdf features introduced 18^th^ June 2001, Landscape and portrait pdfs introduced 7^th^ October 2001., Lout is a more recent addition 22^th^ April 2003 }~ PDF documents are generated on the site from the same source files and Ruby program that produce html. Landscape oriented pdf introduced, providing easier screen viewing, they are also (paper saving, being currently) formatted to have fewer pages than their portrait equivalents.
+
+_* {~^ Adobe Reader }http://www.adobe.com/products/acrobat/readstep2.html
+
+_* {~^ *Evince* }http://www.gnome.org/projects/evince/
+
+_* {~^ xpdf }http://www.foolabs.com/xpdf/
+
+3~ Search - loading/populating of relational database while retaining document structure information, object citation numbering and other features (currently PostgreSQL and/or SQLite)
+
+SiSU (from the same markup input file) automatically feeds into PostgreSQL~{ http://www.postgresql.org/ \\ http://advocacy.postgresql.org/ \\ http://en.wikipedia.org/wiki/Postgresql }~ and/or SQLite~{ http://www.hwaci.com/sw/sqlite/ \\ http://en.wikipedia.org/wiki/Sqlite }~ database (could be any other of the better relational databases)~{ Relational database features retaining document structure and citation introduced 15^th^ July 2002 }~ - together with all additional information related to document structure, and the alternative ways in which it is generated on the site retained. As regards scaling of the database, it is as scalable as the database (here Postgresql or SQLite) and hardware allow. I will prune the images later.
+
+This is one of the more interesting output forms, as all the structural data for the documents are retained (though can be ignored by the user of the database should they so choose). All site texts/documents are (currently) streamed to four PgSQL database tables:
+
+_1* one containing semantic (and other) headers, including, title, author, subject, (the Dublin Core...);
+
+_1* another the substantive texts by individual "paragraph" (or object) - along with structural information, each paragraph being identifiable by its paragraph number (if it has one which almost all of them do), and the substantive text of each paragraph quite naturally being searchable (both in formatted and clean text versions for searching); and
+
+_1* a third containing endnotes cross-referenced back to the paragraph from which they are referenced (both in formatted and clean text versions for searching).
+
+_1* a fourth table with a one to one relation with the headers table contains full text versions of output, eg. pdf, html, xml, and ascii.
+
+There is of course the possibility to add further structures.
+
+At this level SiSU loads a relational database with documents broken in to their smallest logical structurally constituent parts, as text objects, with their object citation number and all other structural information needed to construct the structured document. Text is stored (at this text object level) with and without elementary markup tagging, the stripped version being so as to facilitate ease of searching.
+
+Because the document structure of sites created is clearly defined, and the text object citation system is available for all forms of output, it is possible to search the sql database, and either read results from that database, or just as simply map the results to the html output, which has richer text markup.
+
+The combination of the SiSU citation system with a relational database is pretty powerful, giving rise to several possibilities. As individual text objects of a document stored (and indexed) together with object numbers, and all versions of the document have the same numbering, complex searches can be tailored to return just the locations of the search results relevant for all available output formats, with live links to the precise locations in the database or in html/xml documents; or, the structural information provided makes it possible to search the full contents of the database and have headings in which search content appears, or to search only headings etc. (as the Dublin Core is incorporated it is easy to make use of that as well).
+
+This is a larger scale project, (with little development on the front end largely ignored), though the "infrastructure" has been in place since 2002.
+
+3~ Search - database frontend sample, utilising database and SiSU features, including object citation numbering (backend currently PostgreSQL) *~search
+
+{~^ Sample search frontend }http://search.sisudoc.org
+A small database and sample query front-end (search from) that makes use of the citation system, _{object citation numbering}_ to demonstrates functionality.~{ (which could be extended further with current back-end). As regards scaling of the database, it is as scalable as the database (here PostgreSQL) and hardware allow. }~
+
+SiSU can provide information on which documents are matched and at what locations within each document the matches are found. These results are relevant across all outputs using object citation numbering, which includes html, EPUB, XML, LaTeX, PDF and indeed the SQL database. You can then refer to one of the other outputs or in the SQL database expand the text within the matched objects (paragraphs) in the documents matched.
+
+(further work needs to be done on the sample search form, which is rudimentary and only passes simple booleans correctly at present to the SQL engine)
+
+A few canned searches, showing object numbers. Search for:
+
+{ English documents matching Linux OR Debian }http://search.sisudoc.org/cgi-bin/sisu_pgsql.cgi?s1=Linux%2BOR%2BDebian&db=SiSUv2c_sisu&view=index
+
+{ GPL OR Stallman }http://search.sisudoc.org/cgi-bin/sisu_pgsql.cgi?s1=GPL%2BOR%2BStallman&db=SiSUv2c_sisu&view=index
+
+{ invention OR innovation }http://search.sisudoc.org/cgi-bin/sisu_pgsql.cgi?s1=invention%2BOR%2Binnovation&db=SiSUv2c_sisu&view=index
+
+{ copyright in English language documents }http://search.sisudoc.org/cgi-bin/sisu_pgsql.cgi?s1=copyright&db=SiSUv2c_sisu&view=index
+
+Note that the searches done in this form are case sensitive.
+
+Expand those same searches, showing the matching text in each document:
+
+{ English documents matching Linux OR Debian }http://search.sisudoc.org/cgi-bin/sisu_pgsql.cgi?s1=Linux%2BOR%2BDebian&db=SiSUv2c_sisu&view=text
+
+{ GPL OR Stallman }http://search.sisudoc.org/cgi-bin/sisu_pgsql.cgi?s1=GPL%2BOR%2BStallman&db=SiSUv2c_sisu&view=text
+
+{ invention OR innovation }http://search.sisudoc.org/cgi-bin/sisu_pgsql.cgi?s1=invention%2BOR%2Binnovation&db=SiSUv2c_sisu&view=text
+
+{ copyright }http://search.sisudoc.org/cgi-bin/sisu_pgsql.cgi?s1=copyright&db=SiSUv2c_sisu&view=text
+
+Note you may set results either for documents matched and object number locations within each matched document meeting the search criteria; or display the names of the documents matched along with the objects (paragraphs) that meet the search criteria.~{ of this feature when demonstrated to an IBM software innovations evaluator in 2004 he said to paraphrase: this could be of interest to us. We have large document management systems, you can search hundreds of thousands of documents and we can tell you which documents meet your search criteria, but there is no way we can tell you without opening each document where within each your matches are found. }~
+
+!_ OCN index mode,
+(object citation number) the numbers displayed are relevant (and may be used to reference the match) in any sisu generated rendition of the text~{ OCN are provided for HTML, XML, EPUB, pdf ... though currently omitted in plain-text and opendocument format output }~ the links provided are to the locations of matches within the html generated by SiSU.
+
+!_ Paragraph mode,
+you may alternatively display the text of each paragraph in which the match was made, again the object/paragraph numbers are relevant to any SiSU generated/published text.
+
+Several options for output - select database to search, show results in index view (links to locations within text), show results with text, echo search in form, show what was searched, create and show a "canned url" for search, show available search fields. Also shows counters number of documents in which found and number of locations within documents where found. [could consider sorting by document with most occurrences of the search result].
+
+Simple search, results with files in which search found, and text object (paragraph or endnote) where found within files.
+
+3~ Other forms
+
+There are other forms as well, YAML file, Ruby Marshal dumps, document pre-processing (processing of documents prior to the steps described here, to produce input suitable for the program) snap in a new module as required/desired, well formed XML, no problem.
+
+2~ Concordance / Word Map or rudimentary index
+
+Concordance /WordMaps:~{ Concordance/ WordMaps introduced 15^th^ August 2002 }~ SiSU produces a rudimentary index based on the words within the text, making use of paragraph numbers to identify text locations. This is generated in html and hyper-linked but identifies these words locations in the other document formats. Though it is possible to search using a search engine, this is a means for browsing an alphabetical list of words which may suggest other useful content.
+
+% Concordance files may be built using a document vocabulary. The vocabulary to be used may be specified on a per document basis.
+
+2~ Managed (document) directory, database, or site structure
+
+SiSU builds the web site (or more generically provides a suitable directory structure) - placing various output texts in the hierarchy of the web-site (or db), which (for directories) is a sub-directory with the name of the text file.
+
+2~ Batch processing
+
+SiSU is a batch processing tool, handling and transforming multiple (or individual) documents (in many ways) with a single instruction.
+
+2~ Integration to superior Gnu/Linux and Unix tools
+
+As should have been noted by the above description of SiSU, it makes use of existing programs found on Gnu/Linux and Unix, amongst those already mentioned include the LaTeX to pdf converters and the database PostgreSQL or SQLite.
+
+3~ Backup and version control
+
+Unix provides many tools for version control. For documents Subversion, CVS and even the old RCS are useful for the per-document histories they provide.
+
+For writing code superior (more recent) version control system exist. These can also be used for documents though they tend to take stamps of changes across the repository as a whole, rather than for each individual file that is tracked, (as CVS and RCS do). My personal preference is for distributed systems such as Git, Mercurial or Darcs, of which I use Git for both code and documents.
+
+Several backup tools exist. At the base level I tend to use rdiff.
+
+3~ Editor support
+
+SiSU documents are prepared / marked up in utf-8 text _{you are free to use the text editor of your choice.}_
+
+Syntax highlighting for a number of editors are provided. Amongst them Vim, Kwrite, Kate, Gedit and diakonos. These may be found with configuration instructions at http://www.sisudoc.org/sisu/sisu_syntax_highlighting/doc.html {~^ Vim }http://www.vim.org/ as of version 7 has built in sytax highlighting for SiSU.
+
+2~ Modular design, need something new add a module
+
+Need a new output format that does not already exist, write a new module.
+
+Prefer a new input syntax, you could write a new syntax matching the existing design, though my personal preference is some uniformity in entry appearance. If necessary has been fairly easy to extend the design parameters. It is intended to incorporate some additional basic semantic tagging, (book, article, author etc.) However, keeping the requirements for input minimal, and relatively simple has been a design goal.
+
diff --git a/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_download.ssi b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_download.ssi
new file mode 100644
index 00000000..96c97985
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_download.ssi
@@ -0,0 +1,133 @@
+% SiSU insert 2.0
+
+@title: SiSU - SiSU information Structuring Universe / Structured information, Serialized Units
+ :subtitle: Download, Stable and Development Branches
+
+@creator:
+ :author: Amissah, Ralph
+
+@date:
+ :created: 2002-11-12
+ :issued: 2002-11-12
+ :available: 2002-11-12
+ :published: 2009-01-18
+ :modified: 2011-03-11
+
+@rights:
+ :copyright: Copyright (C) Ralph Amissah 2007
+ :license: GPL 3 (part of SiSU documentation)
+
+:A~? @title @creator
+
+:B~? SiSU Downloads, Stable and Development Branches
+
+:C~ Download information
+
+1~download Download SiSU - Linux/Unix
+
+2~current- SiSU Current Version - Linux/Unix
+
+3~source- Source (tarball tar.gz)
+
+_* {~^ sisu_[version].orig.tar.gz }http://www.jus.uio.no/sisu/pkg/src/
+
+_* {~^ sisu-markup-samples_[version].orig.tar.gz }http://www.jus.uio.no/sisu/pkg/src/
+
+For more general use see http://sisudoc.org/sisu/sisu_manual
+
+For changelogs see http://www.jus.uio.no/sisu/SiSU/changelog.html
+
+3~git- Git (source control management)
+
+Git repository currently at:
+
+_* git clone git://git.sisudoc.org/git/code/sisu.git
+
+_* git clone _http://git.sisudoc.org/git/code/sisu.git
+
+_* http://git.sisudoc.org/?p=code/sisu.git;a=summary
+
+On using git, see
+
+!_ Git documentation:
+{~^ Git User's Manual }http://www.kernel.org/pub/software/scm/git/docs/user-manual.html, {~^ Everyday GIT With 20 Commands Or So }http://www.kernel.org/pub/software/scm/git/docs/everyday.html, {~^ A tutorial introduction to git }http://www.kernel.org/pub/software/scm/git/docs/v1.4.4.4/tutorial.html, {~^ A tutorial introduction to git: part two }http://www.kernel.org/pub/software/scm/git/docs/v1.4.4.4/tutorial-2.html
+
+!_ User contributed texts:
+{~^ The Git Community Book }http://book.git-scm.com/index.html, {~^ Git Magic }http://www-cs-students.stanford.edu/~blynn/gitmagic/, {~^ Git From the Bottom Up (pdf) }http://www.newartisans.com/blog_assets/git.from.bottom.up.pdf
+
+3~debian- Debian
+
+This section contains information on the latest SiSU release. For installation notes see http://sisudoc.org/sisu/sisu_manual/installation.html
+
+SiSU is updated fairly regularly in Debian testing and unstable, and should be available therefrom.
+
+To add this archive, should you still choose to do so, add the following lines to your /etc/apt/sources.list
+
+code{
+
+deb http://www.jus.uio.no/sisu/archive unstable main non-free
+deb-src http://www.jus.uio.no/sisu/archive unstable main non-free
+
+}code
+
+*{Source}* available from
+
+http://www.jus.uio.no/sisu/pkg/src/
+
+http://www.jus.uio.no/sisu/archive/pool/main/s/sisu/
+
+http://www.sisudoc.org/sisu/archive/pool/main/s/sisu/
+
+sisu_[version].orig.tar.gz
+
+sisu_[version].debian.tar.gz
+
+sisu_[version].dsc
+
+group{
+
+*{Debs}*
+
+{~^ sisu_[version]_all.deb }http://www.jus.uio.no/sisu/archive/pool/main/s/sisu/ ~{ \\ sisu, the base code, (the main package on which the others depend), without any dependencies other than ruby (and for convenience the ruby webrick web server), this generates a number of types of output on its own, other packages provide additional functionality, and have their dependencies \\ Depends: ruby (>=1.8.7), libwebrick-ruby \\ Recommends: sisu-pdf, sisu-sqlite, sisu-postgresql, sisu-examples, vim-sisu, librmagick-ruby, trang, tidy, libtidy, librexml-ruby, zip, unzip, openssl }~
+
+{~^ sisu-complete_[version]_all.deb }http://www.jus.uio.no/sisu/archive/pool/main/s/sisu/ ~{ \\ a package that pulls in other packages to build the whole of sisu (excluding sisu-examples) \\ Depends: ruby (>=1.8.7), sisu, sisu-pdf, sisu-postgresql, sisu-remote, sisu-sqlite, vim-sisu \\ Recommends: sisu-examples }~
+
+{~^ sisu-pdf_[version]_all.deb }http://www.jus.uio.no/sisu/archive/pool/main/s/sisu/ ~{ \\ dependencies used by sisu to produce PDF from LaTeX generated \\ Depends: sisu, tetex-bin, tetex-extra, latex-ucs \\ Suggests: evince, xpdf }~
+
+{~^ sisu-postgresql_[version]_all.deb }http://www.jus.uio.no/sisu/archive/pool/main/s/sisu/ ~{ \\ dependencies used by sisu to populate postgresql database (further configuration is necessary) \\ Depends: sisu, postgresql, libdbi-ruby, libdbm-ruby, libdbd-pg-ruby \\ Suggests: pgaccess, libdbd-pgsql, postgresql-contrib }~
+
+{~^ sisu-sqlite_[version]_all.deb }http://www.jus.uio.no/sisu/archive/pool/main/s/sisu/ ~{ \\ dependencies used by sisu to populate sqlite database \\ Depends: sisu, sqlite, libdbi-ruby, libdbm-ruby, libdbd-sqlite-ruby \\ Suggests: libdbd-sqlite }~
+
+}group
+
+For changelogs see:
+
+_1 http://www.sisudoc.org/sisu/SiSU/changelog.html
+
+_1 http://www.jus.uio.no/sisu/SiSU/changelog.html
+
+!_ non-free
+
+Book markup samples have been moved to non-free as the substantive text of the documents are available under the author or original publisher's license, and usually do not comply with the Debian Free Software Guidelines.
+
+_* {~^ sisu-markup-samples_[version]_all.deb }http://www.jus.uio.no/sisu/archive/pool/non-free/s/sisu-markup-samples/ ~{ \\ marked up documents and other examples related to sisu, a larger package containing a number of texts \\ Depends: sisu }~
+
+_* {~^ sisu-markup-samples_[version].dsc }http://www.jus.uio.no/sisu/pkg/src/ ~{ \\ sisu-markup-samples_[version].dsc }~
+
+For changelogs see:
+
+_1 http://www.jus.uio.no/sisu/SiSU/changelog_markup_samples.html
+
+3~rpm- RPM
+
+The RPM is generated from the source file using Alien.~{ http://www.kitenet.net/programs/alien/ }~ Dependencies are not handled, not even that of the essential Ruby.
+
+sudo rpm -i [package name]
+
+_* {~^ sisu-[version].noarch.rpm }http://www.jus.uio.no/sisu/pkg/rpm/ ~{ \\ created using alien }~
+
+_* {~^ sisu-markup-samples_[version].noarch.rpm }http://www.jus.uio.no/sisu/pkg/rpm/ ~{ \\ http://www.jus.uio.no/sisu/archive/pool/non-free/s/sisu-markup-samples/ \\ created using: alien -r sisu_[version]_all.deb }~
+
+For changelogs see:
+
+_1 http://www.jus.uio.no/sisu/SiSU/changelog_markup_samples.html
diff --git a/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_examples.ssi b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_examples.ssi
new file mode 100644
index 00000000..cf9df9d5
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_examples.ssi
@@ -0,0 +1,97 @@
+% SiSU insert 2.0
+
+@title: SiSU
+ :subtitle: Markup Samples, Output Examples
+
+@creator:
+ :author: Amissah, Ralph
+
+@date:
+ :created: 2002-11-12
+ :issued: 2002-11-12
+ :available: 2002-11-12
+ :published: 2007-09-16
+ :modified: 2012-10-03
+
+@rights:
+ :copyright: Copyright (C) Ralph Amissah 2007
+ :license: GPL 3 (part of SiSU documentation)
+
+A~? @title @creator
+
+B~? SiSU Markup and Output Examples
+
+1~examples Markup and Output Examples
+
+2~ Markup examples *~markup
+
+Current markup examples and document output samples are provided off http://sisudoc.org or http://www.jus.uio.no/sisu and in the sisu-markup-sample package available off http://sources.sisudoc.org
+
+For some documents hardly any markup at all is required at all, other than a header, and an indication that the levels to be taken into account by the program in generating its output are.
+
+2~sisu-markup-samples SiSU Markup Samples
+
+A few additional sample books prepared as sisu markup samples, output formats to be generated using SiSU are contained in a separate package sisu-markup-samples. sisu-markup-samples contains books (prepared using sisu markup), that were released by their authors various licenses mostly different Creative Commons licences that do not permit inclusion in the Debian Project as they have requirements that do not meet the Debian Free Software Guidelines for various reasons, most commonly that they require that the original substantive text remain unchanged, and sometimes that the works be used only non-commercially.
+
+/{Accelerando}/, Charles Stross (2005) \\
+accelerando.charles_stross.sst
+
+/{Alice's Adventures in Wonderland}/, Lewis Carroll (1865) \\
+alices_adventures_in_wonderland.lewis_carroll.sst
+
+/{CONTENT}/, Cory Doctorow (2008) \\
+content.cory_doctorow.sst
+
+/{Democratizing Innovation}/, Eric von Hippel (2005) \\
+democratizing_innovation.eric_von_hippel.sst
+
+/{Down and Out in the Magic Kingdom}/, Cory Doctorow (2003) \\
+down_and_out_in_the_magic_kingdom.cory_doctorow.sst
+
+/{For the Win}/, Cory Doctorow (2010) \\
+for_the_win.cory_doctorow.sst
+
+/{Free as in Freedom - Richard Stallman's Crusade for Free Software}/, Sam Williams (2002) \\
+free_as_in_freedom.richard_stallman_crusade_for_free_software.sam_williams.sst
+
+/{Free as in Freedom 2.0 - Richard Stallman and the Free Software Revolution}/, Sam Williams (2002), Richard M. Stallman (2010) \\
+free_as_in_freedom_2.richard_stallman_and_the_free_software_revolution.sam_williams.richard_stallman.sst
+
+/{Free Culture - How Big Media Uses Technology and the Law to Lock Down Culture and Control Creativity}/, Lawrence Lessig (2004) \\
+free_culture.lawrence_lessig.sst
+
+/{Free For All - How Linux and the Free Software Movement Undercut the High Tech Titans}/, Peter Wayner (2002) \\
+free_for_all.peter_wayner.sst
+
+/{GNU GENERAL PUBLIC LICENSE v2}/, Free Software Foundation (1991) \\
+gpl2.fsf.sst
+
+/{GNU GENERAL PUBLIC LICENSE v3}/, Free Software Foundation (2007) \\
+gpl3.fsf.sst
+
+/{Gulliver's Travels}/, Jonathan Swift (1726 / 1735) \\
+gullivers_travels.jonathan_swift.sst
+
+/{Little Brother}/, Cory Doctorow (2008) \\
+little_brother.cory_doctorow.sst
+
+/{The Cathederal and the Bazaar}/, Eric Raymond (2000) \\
+the_cathedral_and_the_bazaar.eric_s_raymond.sst
+
+/{The Public Domain - Enclosing the Commons of the Mind}/, James Boyle (2008) \\
+the_public_domain.james_boyle.sst
+
+/{The Wealth of Networks - How Social Production Transforms Markets and Freedom}/, Yochai Benkler (2006) \\
+the_wealth_of_networks.yochai_benkler.sst
+
+/{Through the Looking Glass}/, Lewis Carroll (1871) \\
+through_the_looking_glass.lewis_carroll.sst
+
+/{Two Bits - The Cultural Significance of Free Software}/, Christopher Kelty (2008) \\
+two_bits.christopher_kelty.sst
+
+/{UN Contracts for International Sale of Goods}/, UN (1980) \\
+un_contracts_international_sale_of_goods_convention_1980.sst
+
+/{Viral Spiral}/, David Bollier (2008) \\
+viral_spiral.david_bollier.sst
diff --git a/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_faq.sst b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_faq.sst
new file mode 100644
index 00000000..966cea5f
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_faq.sst
@@ -0,0 +1,200 @@
+% SiSU 4.0
+
+@title: SiSU
+ :subtitle: FAQ - Frequently Asked/Answered Questions
+
+@creator:
+ :author: Amissah, Ralph
+
+@date:
+ :published: 2008-03-12
+ :created: 2006-09-06
+ :available: 2006-09-06
+ :issued: 2006-09-06
+ :modified: 2012-10-03
+
+@rights:
+ :copyright: Copyright (C) Ralph Amissah 2007
+ :license: GPL 3 (part of SiSU documentation)
+
+@classify:
+ :topic_register: electronic documents;SiSU:document:FAQ;sisu:document:FAQ;SiSU:manual:FAQ;electronic documents:SiSU:manual:FAQ
+ :subject: ebook, epublishing, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, search
+
+:A~? @title @creator
+
+1~faq FAQ - Frequently Asked/Answered Questions
+
+2~ Why are urls produced with the -v (and -u) flag that point to a web server on port 8081 ?
+
+Try the following rune:
+
+_* sisu -W
+
+This should start the ruby webserver. It should be done after having produced some output as it scans the output directory for what to serve.
+
+2~ I cannot find my output, where is it?
+
+The following should provide help on output paths:
+
+_* sisu --help env
+
+_* sisu -V [same as the previous command]
+
+_* sisu --help directory
+
+_* sisu --help path
+
+_* sisu -U [filename]
+
+_* man sisu
+
+2~ I do not get any pdf output, why?
+
+SiSU produces LaTeX and pdflatex is run against that to generate pdf files.
+
+If you use Debian the following will install the required dependencies
+
+_* aptitude install sisu-pdf
+
+the following packages are required: tetex-bin, tetex-extra, latex-ucs
+
+2~ Where is the latex (or some other interim) output?
+
+Try adding -M (for maintenance) to your command flags, e.g.:
+
+_* sisu -HpMv [filename]
+
+this should result in the interim processing output being retained, and information being provided on where to find it.
+
+_* sisu --help directory
+
+_* sisu --help path
+
+should also provide some relevant information as to where it is placed.
+
+2~ Why isn't SiSU markup XML
+
+I worked with text and (though I find XML immensely valuable) disliked noise
+... better to sidestep the question and say:
+
+SiSU currently "understands" three XML input representations - or more accurately, converts from three forms of XML to native SiSU markup for processing. The three types correspond to SAX (structure described), DOM (structure embedded, whole document must be read before structure is correctly discernable) and node based (a tree) forms of XML document structure representation. Problem is I use them very seldom and check that all is as it should be with them seldom, so I would not be surprised if something breaks there, but as far as I know they are working. I will check and add an XML markup help page before the next release. There already is a bit of information in the man page under the title SiSU VERSION CONVERSION
+
+_1 sisu --to-sax [filename/wildcard]
+
+_1 sisu --to-dom [filename/wildcard]
+
+_1 sisu --to-node [filename/wildcard]
+
+The XML should be well formed... must check, but lacks sensible headers. Suggestions welcome as to what to make of them. [For the present time I am satisfied that I can convert (both ways) between 3 forms of XML representation and SiSU markup].
+
+_1 sisu --from-xml2sst [filename/wildcard]
+
+2~ LaTeX claims to be a document preparation system for high-quality typesetting. Can the same be said about SiSU?
+
+% what are some similarities and differences between LaTex and SiSU?
+
+SiSU is not really about type-setting.
+
+LaTeX is the ultimate computer instruction type-setting language for paper based publication.
+
+LaTeX is able to control just about everything that happens on page and pixel, position letters kerning, space variation between characters, words, paragraphs etc. formula.
+
+SiSU is not really about type-setting at all. It is about a lightweight markup instruction that provides enough information for an abstraction of the documents structure and objects, from which different forms of representation of the document can be generated.
+
+SiSU with very little markup instruction is able to produce relatively high quality pdf by virtue of being able to generate usable default LaTeX; it produces "quality" html by generating the html directly; likewise it populates an SQL database in a useful way with the document in object sized chunks and its meta-data. But SiSU works on an abstraction of the document's structure and content and custom builds suitable uniform output. The html for browser viewing and pdf for paper viewing/publishing are rather different things with different needs for layout - as indeed is what is needed to store information in a database in searchable objects.
+
+% SiSU is a lightweight document abstraction, meta-(structure and markup) syntax designed to make use of a minimal amount of preparation detail that can be used across very different ways of representing documents
+
+The pdfs or html produced for example by open office based on open document format and other office/word processor suits usually attempt to have similar looking outputs - your document rendered in html looks much the same, or in pdf... sisu is less this way, it seeks to have a starting point with as little information about appearance as possible, and to come up with the best possible appearance for each output that can be derived based on this minimal information.
+
+Where there are large document sets, it provides consistency in appearance in each output format for the documents.
+
+The excuse for going this way is, it is a waste of time to think much about appearance when working on substantive content, it is the substantive content that is relevant, not the way it looks beyond the basic informational tags - and yet you want to be able to take advantage of as many useful different ways of representing documents as are available, and for various types of output to to be/look as good as it can for each medium/format in which it is presented, (with different mediums having different focuses) and SiSU tries to achieve this from minimal markup.
+
+2~ Can the SiSU markup be used to prepare for a LaTex automatic building of an index to the work?
+
+Has not been, is of interest though the question on introducing such possibilities is how to keep them as unobtrusive as possible, and as generically relevant as possible to other output formats (which is why the focus on object numbers). Unobtrusive refers both to the markup (where there is no big problem with introducing optional extras); and, more challengingly how to minimise impact on competing ideas/interests, such allowing the addition of semantic tags which could be tied to objects, mapped against the objects that contain them, (permitting mapping and mining of content in various ways that would be largely agnostic of output format - object numbering being an attempt to move beyond output format based content locators (such as page numbers). The desire being to (be a meta markup and) maintain agnosticism as to what is being generated and in development to favor solutions of that nature. Keep bridging LaTeX, XML, SQL ... make use of objects and serialisation for mapping whether against content or meta-content (such as semantic [or additional structural] markers).
+
+2~ Can the conversion from SiSU to LaTeX be modified if we have special needs for the LaTeX, or do we need to modify the LaTeX manually?
+
+Should be possible to modify code, it is GPLv3, should be possible either to modify existing modules or write an independent module for generating bespoke latex. Generic improvements are welcome for inclusion/incorporation in the existing code base.
+
+If there are tools to generate mathematical/scientific formula from latex to images (jpg, png), the latex parser could conceivably be used to make these available to other output formats.
+
+2~ How do I create GIN or GiST index in Postgresql for use in SiSU
+
+This at present needs to be done "manually" and it is probably necessary to alter the sample search form. The following is a helpful response from one of the contributors of GiN to Postgresql Oleg Bartunov 2006-12-06:
+
+"I have tsearch2 slides which introduces tsearch2
+http://www.sai.msu.su/~megera/wiki/tsearch2slides
+
+FTS in PostgreSQL is provided by tsearch2, which should works without
+any indices (GiST or GIN) ! Indices provide performance, not functionality.
+
+In your example I'd do ( simple way, just for demo):
+
+!_ 0.
+compile, install tsearch2 and load tsearch2 into your database
+
+_1 cd contrib/tsearch2; make&&make&&install&&make installcheck; psql DB < tsearch2.sql
+
+!_ 1.
+Add column fts, which holds tsvector
+
+_1 alter table documents add column fts tsvector;
+
+!_ 2.
+Fill fts column
+
+_1 update document set fts = to_tsvector(clean);
+
+!_ 3.
+create index - just for performance !
+
+_1 create index fts_gin_idx on document using gin(fts);
+
+!_ 4.
+Run vacuum
+
+_1 vacuum analyze document;
+
+That's all.
+
+Now you can search:
+
+select lid, metadata_tid, rank_cd(fts, q,2)as rank from document, plainto_tsquery('markup syntax') q where q @@ fts order by rank desc limit 10;
+
+2~ Are there some examples of using Ferret Search with a SiSU repository?
+
+Heard good things about Ferret, but have not used it. The output directory structure and content produced by SiSU is very uniform. Have looked at a couple of other engines (hyperestraier, lucene). There it was enough to identify the files that needed to be indexed and pass them to the search indexing tool. Some Unix rune doing the job, such as:
+
+code{
+
+find /home/ralph/sisu_www -type f | \
+egrep '/sisu_www/(sisu|document_archive)/.+?.html$' | \
+egrep -v '(doc|concordance).html$' | \
+estcmd gather -sd casket -
+
+}code
+
+you would have to experiment with what gives the desired result, the file doc.html is the complete text in html (there are additional smaller html segments), and plain.txt the document as a text file. It may be possible to index the text file and return the html document.
+
+
+2~ Have you had any reports of building SiSU from tar on Mac OS 10.4?
+
+None. In the early days of its release a Mac friend built and run the ruby code part that did not rely on system calls to bits like the latex engine. That is already some years back. He was not into writing or document markup, and did it as a favour at the time. I have not followed up that thread of development.
+
+It should however be possible, much of the output relies on plain ruby, and the system commands to latex etc. could be made appropriate for the underlying OS.
+
+2~ Where is version 1?
+
+Version 1 was finally released on December 21, 2009, and largely to make a version 1 branch available as version 2 was in the pipeline with an imminent release. Most of SiSU was mature and stable long before the release of version 1.
+
+2~ What is the difference between version 1 and 2?
+
+Input and output of version 1 and 2 are largely the same with the following significant exceptions. On the input side, document headers, that is metadata and processing instructions have changed in version 2. On the output side, version 2 was introduced with EPUB documents as a possible output, and over time is likely to be developed further.
+
+Version 2 introduces a new processing layer, which relies more on the programming language Ruby's objects (and regular expressions), than version 1 does which relies on regular expressions. The thinking behind version 1 use of regular expressions was that it made it more straightforward to switch languages for processing, as many languages support regular expressions; the thinking behind version 2 was version 1 was more complicated than it need be, and since Ruby was the language used, why not make programming more straightforward, as it would be easier to develop further.
+
+Version 1 was removed with the introduction of the version 3 development branch
diff --git a/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_filetypes.sst b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_filetypes.sst
new file mode 100644
index 00000000..d36acac0
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_filetypes.sst
@@ -0,0 +1,143 @@
+% SiSU 4.0
+
+@title: SiSU
+ :subtitle: Filetypes
+
+@creator:
+ :author: Amissah, Ralph
+
+@date:
+ :published: 2007-09-16
+ :created: 2002-08-28
+ :issued: 2002-08-28
+ :available: 2002-08-28
+ :modified: 2012-10-03
+
+@rights:
+ :copyright: Copyright (C) Ralph Amissah 2007
+ :license: GPL 3 (part of SiSU documentation)
+
+@classify:
+ :topic_register: SiSU:manual:filetypes;electronic documents:SiSU:manual:filetypes
+ :subject: ebook, epublishing, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, search
+
+:A~? @title @creator
+
+1~filetypes SiSU filetypes
+
+SiSU has plaintext and binary filetypes, and can process either type of document.
+
+2~ .sst .ssm .ssi marked up plain text
+
+SiSU documents are prepared as plain-text (utf-8) files with SiSU markup. They may make reference to and contain images (for example), which are stored in the directory beneath them _sisu/image. SiSU plaintext markup files are of three types that may be distinguished by the file extension used: regular text .sst; master documents, composite documents that incorporate other text, which can be any regular text or text insert; and inserts the contents of which are like regular text except these are marked .ssi and are not processed.
+
+SiSU processing can be done directly against a sisu documents; which may be located locally or on a remote server for which a url is provided.
+
+SiSU source markup can be shared with the command:
+
+_1 sisu -s [filename]
+
+3~ sisu text - regular files (.sst)
+
+The most common form of document in SiSU, see the section on SiSU markup.
+
+3~ sisu master files (.ssm)
+
+Composite documents which incorporate other SiSU documents which may be either regular SiSU text .sst which may be generated independently, or inserts prepared solely for the purpose of being incorporated into one or more master documents.
+
+The mechanism by which master files incorporate other documents is described as one of the headings under under SiSU markup in the SiSU manual.
+
+Note: Master documents may be prepared in a similar way to regular documents, and processing will occur normally if a .sst file is renamed .ssm without requiring any other documents; the .ssm marker flags that the document may contain other documents.
+
+Note: a secondary file of the composite document is built prior to processing with the same prefix and the suffix ._sst ~{ .ssc (for composite) is under consideration but ._sst makes clear that this is not a regular file to be worked on, and thus less likely that people will have "accidents", working on a .ssc file that is overwritten by subsequent processing. It may be however that when the resulting file is shared .ssc is an appropriate suffix to use. }~
+
+3~ sisu insert files (.ssi)
+
+Inserts are documents prepared solely for the purpose of being incorporated into one or more master documents. They resemble regular SiSU text files except they are ignored by the SiSU processor. Making a file a .ssi file is a quick and convenient way of flagging that it is not intended that the file should be processed on its own.
+
+2~ sisupod, zipped binary container (sisupod.zip, .ssp)
+
+A sisupod is a zipped SiSU text file or set of SiSU text files and any associated images that they contain (this will be extended to include sound and multimedia-files)
+
+SiSU plaintext files rely on a recognised directory structure to find contents such as images associated with documents, but all images for example for all documents contained in a directory are located in the sub-directory _sisu/image. Without the ability to create a sisupod it can be inconvenient to manually identify all other files associated with a document. A sisupod automatically bundles all associated files with the document that is turned into a pod.
+
+The structure of the sisupod is such that it may for example contain a single document and its associated images; a master document and its associated documents and anything else; or the zipped contents of a whole directory of prepared SiSU documents.
+
+The command to create a sisupod is:
+
+_1 sisu -S [filename]
+
+Alternatively, make a pod of the contents of a whole directory:
+
+_1 sisu -S
+
+SiSU processing can be done directly against a sisupod; which may be located locally or on a remote server for which a url is provided.
+
+http://www.sisudoc.org/sisu/sisu_commands
+
+http://www.sisudoc.org/sisu/sisu_manual
+
+% 1~alt Experimental Alternative Input Representations
+%
+% 2~ Alternative XML
+%
+% SiSU offers alternative XML input representations of documents as a proof of concept, experimental feature. They are however not strictly maintained, and incomplete and should be handled with care.
+%
+% !_ convert from sst to simple xml representations (sax, dom and node):
+%
+% _1 sisu --to-sax [filename/wildcard] or sisu --to-sxs [filename/wildcard]
+%
+% _1 sisu --to-dom [filename/wildcard] or sisu --to-sxd [filename/wildcard]
+%
+% _1 sisu --to-node [filename/wildcard] or sisu --to-sxn [filename/wildcard]
+%
+% !_ convert to sst from any sisu xml representation (sax, dom and node):
+%
+% _1 sisu --from-xml2sst [filename/wildcard [.sxs.xml,.sxd.xml,sxn.xml]]
+%
+% or the same:
+%
+% _1 sisu --from-sxml [filename/wildcard [.sxs.xml,.sxd.xml,sxn.xml]]
+%
+% 3~ XML SAX representation
+%
+% To convert from sst to simple xml (sax) representation:
+%
+% _1 sisu --to-sax [filename/wildcard] or sisu --to-sxs [filename/wildcard]
+%
+% To convert from any sisu xml representation back to sst
+%
+% _1 sisu --from-xml2sst [filename/wildcard [.sxs.xml,.sxd.xml,sxn.xml]]
+%
+% or the same:
+%
+% _1 sisu --from-sxml [filename/wildcard [.sxs.xml,.sxd.xml,sxn.xml]]
+%
+% 3~ XML DOM representation
+%
+% To convert from sst to simple xml (dom) representation:
+%
+% _1 sisu --to-dom [filename/wildcard] or sisu --to-sxd [filename/wildcard]
+%
+% To convert from any sisu xml representation back to sst
+%
+% _1 sisu --from-xml2sst [filename/wildcard [.sxs.xml,.sxd.xml,sxn.xml]]
+%
+% or the same:
+%
+% _1 sisu --from-sxml [filename/wildcard [.sxs.xml,.sxd.xml,sxn.xml]]
+%
+% 3~ XML Node representation
+%
+% To convert from sst to simple xml (node) representation:
+%
+% _1 sisu --to-node [filename/wildcard] or sisu --to-sxn [filename/wildcard]
+%
+% To convert from any sisu xml representation back to sst
+%
+% _1 sisu --from-xml2sst [filename/wildcard [.sxs.xml,.sxd.xml,sxn.xml]]
+%
+% or the same:
+%
+% _1 sisu --from-sxml [filename/wildcard [.sxs.xml,.sxd.xml,sxn.xml]]
+
diff --git a/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_help.sst b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_help.sst
new file mode 100644
index 00000000..ce6627b7
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_help.sst
@@ -0,0 +1,95 @@
+% SiSU 4.0
+
+@title: SiSU
+ :subtitle: Help
+
+@creator:
+ :author: Amissah, Ralph
+
+@date:
+ :created: 2002-08-28
+ :issued: 2002-08-28
+ :available: 2002-08-28
+ :published: 2007-08-30
+ :modified: 2012-10-03
+
+@rights:
+ :copyright: Copyright (C) Ralph Amissah 2007
+ :license: GPL 3 (part of SiSU documentation)
+
+@classify:
+ :topic_register: SiSU:manual:help;electronic documents:manual:SiSU:help
+ :subject: ebook, epublishing, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, search
+
+:A~? @title @creator
+
+:B~? SiSU Help
+
+1~help Help
+
+2~ SiSU Manual
+
+The most up to date information on sisu should be contained in the sisu_manual, available at:
+
+_1 http://sisudoc.org/sisu/sisu_manual/
+
+The manual can be generated from source, found respectively, either within the SiSU tarball
+or installed locally at:
+
+_1 ./data/doc/sisu/markup-samples/sisu_manual
+
+_1 /usr/share/doc/sisu/markup-samples/sisu_manual
+
+move to the respective directory and type e.g.:
+
+_1 sisu sisu_manual.ssm
+
+% The manual pages provided with SiSU are also available online, and there is an interactive help, which is being superseded by the man page, and possibly some document which contains this component.
+
+2~ SiSU man pages *~man
+
+If SiSU is installed on your system usual man commands should be available, try:
+
+_1 man sisu
+
+Most SiSU man pages are generated directly from sisu documents that are used to prepare the sisu manual, the sources files for which are located within the SiSU tarball at:
+
+_1 ./data/doc/sisu/markup-samples/sisu_manual
+
+Once installed, directory equivalent to:
+
+_1 /usr/share/doc/sisu/markup-samples/sisu_manual
+
+Available man pages are converted back to html using man2html:
+
+_1 /usr/share/doc/sisu/html/
+
+_1 ./data/doc/sisu/html
+
+An online version of the sisu man page is available here:
+
+_* {~^ various sisu man pages }http://www.jus.uio.no/sisu/man/
+
+_* {~^ sisu.1 }http://www.jus.uio.no/sisu/man/sisu.1.html
+
+2~ SiSU built-in interactive help
+
+This is particularly useful for getting the current sisu setup/environment information:
+
+_1 sisu --help
+
+_1 sisu --help [subject]
+
+_2 sisu --help commands
+
+_2 sisu --help markup
+
+_2 sisu --help env [for feedback on the way your system is setup with regard to sisu]
+
+_1 sisu -V [environment information, same as above command]
+
+_1 sisu (on its own provides version and some help information)
+
+Apart from real-time information on your current configuration the SiSU manual and man pages are likely to contain more up-to-date information than the sisu interactive help (for example on commands and markup).
+
+NOTE: Running the command sisu (alone without any flags, filenames or wildcards) brings up the interactive help, as does any sisu command that is not recognised. Enter to escape.
diff --git a/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_help_sources.sst b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_help_sources.sst
new file mode 100644
index 00000000..bee5ed78
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_help_sources.sst
@@ -0,0 +1,108 @@
+% SiSU insert 4.0
+
+@title: SiSU
+ :subtitle: References
+
+@creator:
+ :author: Amissah, Ralph
+
+@date:
+ :created: 2002-11-12
+ :issued: 2002-11-12
+ :available: 2002-11-12
+ :published: 2007-09-16
+ :modified: 2012-10-03
+
+@rights:
+ :copyright: Copyright (C) Ralph Amissah 2007
+ :license: GPL 3 (part of SiSU documentation)
+
+@classify:
+ :topic_register: SiSU:manual:help sources;electronic documents:SiSU:manual:help sources
+ :subject: ebook, epublishing, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, search
+
+:A~? @title @creator
+
+:B~? SiSU Help Sources
+
+1~help_sources Help Sources
+
+2~ man pages
+
+_1 man sisu
+
+_1 man sisu-concordance
+
+_1 man sisu-epub
+
+_1 man sisu-git
+
+_1 man sisu-harvest
+
+_1 man sisu-html
+
+_1 man sisu-odf
+
+_1 man sisu-pdf
+
+_1 man sisu-pg
+
+_1 man sisu-po
+
+_1 man sisu-sqlite
+
+_1 man sisu-txt
+
+_1 man 7 sisu_complete
+
+_1 man 7 sisu_pdf
+
+_1 man 7 sisu_postgresql
+
+_1 man 7 sisu_sqlite
+
+_1 man sisu_termsheet
+
+_1 man sisu_webrick
+
+2~ sisu generated output - links to html
+
+Note SiSU documentation is prepared in SiSU and output is available in multiple formats including amongst others html, pdf, odf and epub, which may be also be accessed via the html pages~{ named index.html or more extensively through sisu_manifest.html }~
+
+3~ www.sisudoc.org
+
+http://sisudoc.org/sisu/sisu_manual/index.html
+
+_1 http://sisudoc.org/sisu/sisu_manual/index.html
+
+2~ man2html
+
+3~ locally installed
+
+file:///usr/share/doc/sisu/html/sisu.1.html
+
+_1 file:///usr/share/doc/sisu/html/sisu.1.html
+
+_1 /usr/share/doc/sisu/html/sisu_pdf.7.html
+
+_1 /usr/share/doc/sisu/html/sisu_postgresql.7.html
+
+_1 /usr/share/doc/sisu/html/sisu_sqlite.7.html
+
+_1 /usr/share/doc/sisu/html/sisu_webrick.1.html
+
+3~ www.jus.uio.no/sisu
+
+http://www.jus.uio.no/sisu/man/sisu.1.html
+
+_1 http://www.jus.uio.no/sisu/man/sisu.1.html
+
+_1 http://www.jus.uio.no/sisu/man/sisu_complete.7.html
+
+_1 http://www.jus.uio.no/sisu/man/sisu_pdf.7.html
+
+_1 http://www.jus.uio.no/sisu/man/sisu_postgresql.7.html
+
+_1 http://www.jus.uio.no/sisu/man/sisu_sqlite.7.html
+
+_1 http://www.jus.uio.no/sisu/man/sisu_webrick.1.html
diff --git a/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_homepages.ssi b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_homepages.ssi
new file mode 100644
index 00000000..3d8d95d5
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_homepages.ssi
@@ -0,0 +1,39 @@
+% SiSU insert 2.0
+
+@title: SiSU
+ :subtitle: Homepages
+
+@creator:
+ :author: Amissah, Ralph
+
+@date:
+ :published: 2007-09-16
+ :created: 2007-08-28
+ :issued: 2007-08-28
+ :available: 2007-08-28
+ :modified: 2011-02-07
+
+@rights:
+ :copyright: Copyright (C) Ralph Amissah 2007
+ :license: GPL 3 (part of SiSU documentation)
+
+:A~? @title @creator
+
+:B~? Setting up of homepages
+
+1~home Homepages
+
+SiSU is about the ability to auto-generate documents. Home pages are regarded as custom built items, and are not created by SiSU. More accurately, SiSU has a default home page, which will not be appropriate for use with other sites, and the means to provide your own home page instead in one of two ways as part of a site's configuration, these being:
+
+# through placing your home page and other custom built documents in the subdirectory _sisu/home/ (this probably being the easier and more convenient option)
+
+# through providing what you want as the home page in a skin,
+
+Document sets are contained in directories, usually organised by site or subject. Each directory can/should have its own homepage. See the section on directory structure and organisation of content.
+
+2~ Home page and other custom built pages in a sub-directory
+
+Custom built pages, including the home page index.html may be placed within the configuration directory _sisu/home/ in any of the locations that is searched for the configuration directory, namely ./_sisu ; ~/_sisu ; /etc/sisu
+From there they are copied to the root of the output directory with the command:
+
+_1 sisu -CC
diff --git a/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_how.ssi b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_how.ssi
new file mode 100644
index 00000000..3372bcd4
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_how.ssi
@@ -0,0 +1,26 @@
+% SiSU 2.0
+
+@title: SiSU
+ :subtitle: How Does SiSU Work?
+
+@creator:
+ :author: Amissah, Ralph
+
+@date:
+ :published: 2007-09-16
+ :created: 2002-08-28
+ :issued: 2002-08-28
+ :available: 2002-08-28
+ :modified: 2011-02-07
+
+@rights:
+ :copyright: Copyright (C) Ralph Amissah 2007
+ :license: GPL 3 (part of SiSU documentation)
+
+:A~? @title @creator
+
+:B~? Description
+
+1~sisu_how How does sisu work?
+
+SiSU markup is fairly minimalistic, it consists of: a (largely optional) document header, made up of information about the document (such as when it was published, who authored it, and granting what rights) and any processing instructions; and markup within the substantive text of the document, which is related to document structure and typeface. SiSU must be able to discern the structure of a document, (text headings and their levels in relation to each other), either from information provided in the document header or from markup within the text (or from a combination of both). Processing is done against an abstraction of the document comprising of information on the document's structure and its objects,[2] which the program serializes (providing the object numbers) and which are assigned hash sum values based on their content. This abstraction of information about document structure, objects, (and hash sums), provides considerable flexibility in representing documents different ways and for different purposes (e.g. search, document layout, publishing, content certification, concordance etc.), and makes it possible to take advantage of some of the strengths of established ways of representing documents, (or indeed to create new ones).
diff --git a/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_howto.sst b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_howto.sst
new file mode 100644
index 00000000..dab3e8a4
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_howto.sst
@@ -0,0 +1,1326 @@
+% SiSU insert 4.0
+
+@title: SiSU
+ :subtitle: Technical, Howto
+
+@creator:
+ :author: Amissah, Ralph
+
+@date:
+ :published: 2007-09-16
+ :created: 2002-11-12
+ :issued: 2002-11-12
+ :available: 2002-11-12
+ :modified: 2012-10-03
+
+@rights:
+ :copyright: Copyright (C) Ralph Amissah 2007
+ :license: GPL 3 (part of SiSU documentation)
+
+@classify:
+ :topic_register: SiSU:manual:howto;electronic documents:SiSU:manual:howto;SiSU:document:howto;sisu:document:howto
+ :subject: ebook, epublishing, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, search
+
+:A~? @title @creator
+
+:B~? SiSU some technical information
+
+:C~ HowTo
+
+1~howto_help Getting Help
+
+An online manual of sorts should be available at:
+
+http://www.jus.uio.no/sisu_manual/
+
+The manual pages provided with SiSU are also available online, and there is an interactive help, which is being superseded by the man page, and possibly some document which contains this component.
+
+2~ SiSU "man" pages *~man
+
+If SiSU is installed on your system usual man commands should be available, try:
+
+man sisu
+
+The SiSU man pages can be viewed online at:~{ generated from source using rman<br> http://polyglotman.sourceforge.net/rman.html <br>With regard to SiSU man pages the formatting generated for markup syntax is not quite right, for that you might prefer the links under:<br> http://www.jus.uio.no/sample }~
+
+An online version of the sisu man page is available here:
+
+_* {~^ various sisu man pages }http://www.jus.uio.no/sisu/man/
+
+_* {~^ sisu.1 }http://www.jus.uio.no/sisu/man/sisu.1.html
+
+_* {~^ sisu.8 }http://www.jus.uio.no/sisu/man/sisu.8.html
+
+_* {~^ sisu_webrick.1 }http://www.jus.uio.no/sisu/man/sisu_webrick.1.html
+
+2~ SiSU built-in help
+
+_1 sisu --help
+
+_1 sisu --help [subject]
+
+_2 sisu --help env [for feedback on the way your system is setup with regard to sisu]
+
+_2 sisu -V [same as above command]
+
+_2 sisu --help commands
+
+_2 sisu --help markup
+
+2~ Command Line with Flags - Batch Processing
+
+Running sisu (alone without any flags, filenames or wildcards) brings up the interactive help, as does any sisu command that is not recognised.
+
+In the data directory run sisu -mh filename or wildcard eg. "sisu -h cisg.sst" or "sisu -h *.{sst,ssm}" to produce html version of all documents.
+
+1~howto_setup Setup, initialisation
+
+2~ initialise output directory
+
+Images, css files for a document directory are copied to their respective locations in the output directory.
+
+while within your document markup/preparation directory, issue the following command
+
+_1 sisu -CC
+
+3~ Use of search functionality, an example using sqlite
+
+SiSU can populate PostgreSQL and Sqlite databases and provides a sample search form for querying these databases.
+
+This note provides an example to get you started and will use sqlite
+
+It is necessary to:
+
+(1) make sure the required dependencies have been installed
+
+(2) have a directory with sisu markup samples that is writable
+
+(3) use sisu to create a database
+
+(4) use sisu tp populate a database
+
+(5) use sisu to start the webrick (httpd) server
+
+(6) use sisu to create a search form
+
+(7) copy the search form to the cgi directory
+
+(8) open up the form in your browser
+
+(9) query the database using the search form
+
+!_ (1) make sure the required dependencies have been installed
+
+if you use Debian, the following command will install the required dependencies
+
+aptitude install sisu-sqlite
+
+!_ (2) have a directory with sisu markup samples that is writable
+
+ideally copy the sisu-examples directory to your home directory (because the directory in which you run this example should be writable)
+
+cp -rv /usr/share/doc/sisu/markup-samples/samples .
+
+you are better off installing the package sisu-markup-samples which will make the following available
+
+cp -rv /usr/share/doc/sisu/markup-samples-non-free/samples .
+
+!_ (3) use sisu to create an sqlite database
+
+within the sisu-examples directory
+
+sisu -dv createall
+
+!_ (4) use sisu tp populate a database with some text
+
+within the sisu-examples directory
+
+sisu -div free_*.sst
+
+or
+
+sisu -dv import free_*.sst debian_constitution_v1.2.sst debian_social_contract_v1.1.sst gpl2.fsf.sst
+
+!_ (5) use sisu to start the webrick (httpd) server (if it has not already been started):
+
+sisu -W
+
+!_ (6) use sisu to create a search form (for use with the webrick server, and your sample documents)
+
+within the sisu-examples directory
+
+sisu -F webserv=webrick
+
+and follow the instructions provided
+
+#here i run into a problem, you are working from a read only
+#directory..., not my usual mode of operation, to complete the example
+#the following is necessary
+sudo touch sisu_sqlite.cgi sisu_pgsql.cgi
+sudo -P chown $USER sisu_sqlite.cgi sisu_pgsql.cgi
+
+#now this should be possible:
+sisu -F webrick
+
+!_ (7) copy the search form to the cgi directory
+
+sisu -F webserv=webrick
+
+and follow the instructions provided
+
+% sudo chmod -v 755 /usr/lib/cgi-bin/sisu_sqlite.cgi
+
+!_ (8) open up the form in your browser and query it
+
+url:
+
+http://localhost:8081/cgi-bin/sisu_sqlite.cgi
+
+or as instructed by command sisu -F webrick
+
+!_ (9) query the database using the search form
+
+if there are other options in the dropdown menu select
+
+document_samples_sisu_markup
+
+and search for some text, e.g.:
+
+aim OR project
+
+_* selecting the *index* radio button gives an index of results using the object numbers
+
+_* selecting the *text* radio button gives the content of the matched paragraphs with the match highlighted
+
+!_ (10) to start again with a new database
+
+to start from scratch you can drop the database with the command
+
+sisu -dv dropall
+
+and go to step 3
+
+to get to step 3 in one step with a single command
+
+sisu -dv recreate
+
+continue subsequent steps
+
+2~ misc
+
+3~ url for output files -u -U
+
+_1 sisu -uv[and other flags] [filename/wildcard]
+
+_1 sisu -Uv [filename/wildcard]
+
+3~ toggle screen color
+
+_1 sisu -cv[and processing flags] [filename/wildcard]
+
+3~ verbose mode
+
+_1 sisu -v[and processing flags] [filename/wildcard]
+
+_1 sisu -V[and processing flags] [filename/wildcard]
+
+3~ quiet mode
+
+_1 sisu -q[and processing flags] [filename/wildcard]
+
+3~ maintenance mode
+intermediate files kept -M
+
+_1 sisu -Mv[and other flags] [filename/wildcard]
+
+3~ start the webrick server
+
+_1 sisu -W
+
+2~ remote placement of output
+
+configuration is necessary
+
+scp
+
+_1 sisu -vr[and processing flags] [filename/wildcard]
+
+rsync
+
+_1 sisu -vR[and processing flags] [filename/wildcard]
+
+1~howto_config Configuration Files
+
+Sample provided, on untarring the source tarball:
+
+_1 conf/sisu/v4/sisurc.yml
+
+_1 conf/sisu/v3/sisurc.yml
+
+and on installation under:
+
+_1 /etc/sisu/v4/sisurc.yml
+
+_1 /etc/sisu/v3/sisurc.yml
+
+The following paths are searched:
+
+_1 ./_sisu/v4/sisurc.yml or ./_sisu/v3/sisurc.yml
+
+_1 ./_sisu/sisurc.yml
+
+_1 ~/.sisu/v4/sisurc.yml or ~/.sisu/v3/sisurc.yml
+
+_1 ~/.sisu/sisurc.yml
+
+_1 /etc/sisu/v4/sisurc.yml /etc/sisu/v3/sisurc.yml
+
+_1 /etc/sisu/sisurc.yml
+
+1~howto_markup Markup
+
+See sample markup provided on
+
+http://www.sisudoc.org/
+
+http://www.jus.uio.no/sisu
+
+http://www.jus.uio.no/sisu_markup
+
+http://www.jus.uio.no/sisu/SiSU
+
+in particular for each of the document output samples provided, the source document is provided as well
+
+http://www.jus.uio.no/sisu/SiSU/examples.html
+
+on untarring the source tarball:
+
+_1 data/doc/sisu/markup-samples
+
+or the same once source is installed (or sisu-examples) under:
+
+_1 /usr/share/doc/sisu/markup-samples/
+
+and if you have sisu-markup-samples installed, under
+
+_1 data/doc/sisu/markup-samples-non-free/
+
+_1 /usr/share/doc/sisu/markup-samples-non-free/
+
+Some notes are contained within the man page, *{man sisu}* and within sisu help via the commands *{sisu help markup}* and *{sisu help headers}*
+
+SiSU is for literary and legal text, also for some social science material. In particular it does not do formula, and is not particularly suited to technical documentation. Despite the latter caveat, some notes will be provided here and added to over time:
+
+2~ Headers
+
+Headers @headername: provide information related to the document, this may relate to
+
+# how it is to be processed, such as whether headings are to be numbered, what skin is to be used and markup instructions, such as the document structure, or words to be made bold within the document
+
+# semantic information about the document including the dublin core
+
+2~ Font Face
+
+Defaults are set. You may change the face to: bold, italics, underscore, strikethrough, ...
+
+3~ Bold
+
+\@bold: [list of words that should be made bold within document]
+
+!_ bold line
+
+\!_ bold line
+
+*{ bold word or sentence }*
+
+!\{ bold word or sentence \}!
+
+*\{ bold word or sentence \}*
+
+*boldword* or !boldword!
+
+\*boldword\* or \!boldword\!
+
+3~ Italics
+
+\@italics: [list of words that should be italicised within document]
+
+/{ italicise word or sentence }/
+
+/\{ italicise word or sentence \}/
+
+/italicisedword/
+
+\/italicisedword\/
+
+3~ Underscore
+
+_{ underscore word or sentence }_
+
+_\{ underscore word or sentence \}_
+
+_underscoreword_
+
+3~ Strikethrough
+
+-{ strikethrough word or sentence }-
+
+-\{ strikethrough word or sentence \}-
+
+-strikeword-
+
+\-strikeword\-
+
+2~ Endnotes
+
+There are two forms of markup for endnotes, they cannot be mixed within the same document
+
+here~{ this is an endnote }~
+
+# preferred endnote markup
+
+here~\{ this is an endnote \}~
+
+# alternative markup equivalent, kept because it is possible to search and replace to get markup in existing texts such as Project Gutenberg
+
+here\~^
+
+^\~ this is an endote
+
+2~ Links
+
+{ SiSU }http://www.sisudoc.org
+
+code{
+
+{ SiSU }http://www.sisudoc.org
+
+}code
+
+{sisu.png }http://www.sisudoc.org
+
+code{
+
+{sisu.png }http://www.sisudoc.org
+
+}code
+
+{tux.png 64x80 }image
+
+code{
+
+{ tux.png 64x80 }image
+
+}code
+
+{~^ SiSU }http://www.sisudoc.org
+
+code{
+
+{~^ SiSU }http://www.sisudoc.org
+
+}code
+
+is equivalent to:
+
+code{
+
+{ SiSU }http://www.sisudoc.org ~{ http://www.sisudoc.org }~
+
+}code
+
+the same can be done with an image:
+
+{~^ sisu.png "SiSU" }http://www.sisudoc.org
+
+code{
+
+{~^ sisu.png "SiSU" }http://www.sisudoc.org
+
+}code
+
+2~ Number Titles
+
+Set with the header @markup:
+
+2~ Line operations
+
+Line Operations (marker placed at start of line)
+
+\!_ bold line
+
+!_ bold line
+
+\_1 indent paragraph one level
+
+_1 indent paragraph one level
+
+\_2 indent paragraph two steps
+
+_2 indent paragraph two steps
+
+\_* bullet paragraph
+
+_* bullet paragraph
+
+\# number paragraph (see headers for numbering document headings)
+
+# number paragraph (see headers for numbering document headings)
+
+\_# number paragraph level 2 (see headers for numbering document headings)
+
+_# number paragraph level 2 (see headers for numbering document headings)
+
+2~ Tables
+
+Table markup sample
+
+code{
+
+table{~h c3; 26; 32; 32;
+
+This is a table, column1
+this would become row one of column two
+column three of row one is here
+
+column one row 2
+column two of row two
+column three of row two, and so on
+
+column one row three
+and so on
+here
+
+}table
+
+}code
+
+Alternative form of table markup
+
+code{
+
+{t~h}
+ |Mon|Tue|Wed|Thu|Fri|Sat|Sun
+0 | * | * | * | * | * | * | *
+1 | * | * | * | * | | |
+2 | - | * | * | * | * | * |
+3 | - | * | * | * | * | * | *
+4 | - | | | * | * | * |
+5 | * | * | * | * | * | * | *
+
+}code
+
+2~ Grouped Text
+
+code{
+
+ 5.times { puts 'Ruby' }
+
+}code
+
+code\{
+
+code{
+
+ 5.times { puts 'Ruby' }
+
+}code
+
+\}code
+
+poem{
+
+A Limerick
+
+There was a young lady from Clyde,
+who ate a green apple and died,
+but the apple fermented inside the lamented,
+and made cider inside her inside.
+
+}poem
+
+code{
+
+poem{
+
+There was a young lady from Clyde,
+who ate a green apple and died,
+but the apple fermented inside the lamented,
+and made cider inside her inside.
+
+}poem
+
+}code
+
+2~ Composite Document
+
+To import another document, the master document or importing document should be named filename.r3 (r for require)
+
+\<\< \{ filename.sst \}
+
+\<\< \{ filename.ssi \}
+
+1~howto_appearance Change Appearance
+
+2~ Skins
+
+"Skins" are gone in v4 replaced by @make: :header: within a document, and a common shared _sisu/sisu_document_make file (which uses identical parameters to the individual documents @make: :header:)
+
+2~ CSS
+
+The appearance of html and XML related output can be changed for an ouput collection directory by prepareing and placing a new css file in one of the sisu css directories searched in the sisu configuration path. These are located at:
+
+_./_sisu/css
+
+~/.sisu/css
+
+and
+
+/etc/sisu/css
+
+The contents of the first directory found in the search path are copied to the corresponding sisu output directory with the commnd:
+
+sisu -CC
+
+The SiSU standard css files for SiSU output are:
+
+dom.css html.css html_tables.css index.css sax.css xhtml.css
+
+A document may specify its own/bespoke css file using the css header.
+
+\@css:
+
+[expand]
+
+:C~ Extracts from the README
+
+1~howto_readme README
+
+SiSU 0.55 2007w27/6 2007-07-07
+
+Homepage: http://www.sisudoc.org
+
+old homepage: http://www.jus.uio.no/sisu
+
+!_ Description
+
+SiSU is lightweight markup based document creation and publishing framework that is controlled from the command line. Prepare documents for SiSU using your text editor of choice, then use SiSU to generate various output document formats.
+
+With minimal preparation of a plain-text (UTF-8) file using its native markup-syntax, SiSU produces: plain-text, HTML, XHTML, EPUB, XML, ODF:ODT (Opendocument), LaTeX, PDF, and populates an SQL database (PostgreSQL or SQLite) in paragraph sized chunks so that document searches are done at this "atomic" level of granularity.
+
+Outputs share a common citation numbering system, and any semantic meta-data provided about the document.
+
+SiSU also provides concordance files, document content certificates and manifests of generated output.
+
+SiSU takes advantage of well established open standard ways of representing text, and provides a bridge to take advantage of the strengths of each, while remaining simple. SiSU implements across document formats a "useful common feature set" [coming from a humanities, law, and possibly social sciences perspective, rather than technical or scientific writing] ... focus is primarily on content and data integrity rather than appearance, (though outputs in the various formats are respectable).
+
+A vim syntax highlighting file and an ftplugin with folds for sisu markup is provided. Vim 7 includes syntax highlighting for SiSU.
+
+man pages, and interactive help are provided.
+
+Dependencies for various features are taken care of in sisu related packages. The package sisu-complete installs the whole of SiSU.
+
+Additional document markup samples are provided in the package sisu-markup-samples which is found in the non-free archive the licenses for the substantive content of the marked up documents provided is that provided by the author or original publisher.
+
+Homepage: http://www.sisudoc.org
+
+old homepage: http://www.jus.uio.no/sisu
+
+SiSU - simple information structuring universe, is a publishing tool, document generation and management, (and search enabling) tool primarily for literary, academic and legal published works.
+
+SiSU can be used for Internet, Intranet, local filesystem or cd publishing.
+
+SiSU can be used directly off the filesystem, or from a database.
+
+SiSU's scalability, is dependent on your hardware, and filesystem, and/or database Postgresql.
+
+Amongst it's characteristics are:
+
+_* simple mnemonoic markup style,
+
+_* the ability to produce multiple output formats, including html, structured XML, LaTeX, pdf (via LaTeX), stream to a relational database whilst retaining document structure - Postgresql and Sqlite,
+
+_* that all share a common citation system (a simple idea from which much good), possibly most exciting, the following: if fed into a relational database (as it can be automatically), the document set is searchable, with results displayed at a paragraph level, or the possibility of an indexed display of documents in which the match is found together with a hyperlinked listing for each of each paragraph in which the match is found. In any event citations using this system (with or without the relational database) are relevant for all output formats.
+
+_* it is command line driven, and can be set up on a remote server
+
+_* Documents are marked up in SiSU syntax in your favourite editor. SiSU syntax may be regarded as a type of smart ascii - which in its basic form is simpler than the most elementary html. There is currently a syntax highlighter, and folding for Vim. Syntax highlighters for other editors are welcome.
+
+Input files should be UTF-8
+
+Once set up it is simple to use.
+
+2~ Online Information, places to look
+
+http://www.sisudoc.org
+
+http://www.jus.uio.no/sisu
+
+Download Sources:
+
+_1 http://www.jus.uio.no/sisu/SiSU/download.html#current
+
+_1 http://www.jus.uio.no/sisu/SiSU/download.html#debian
+
+2~ Installation
+
+NB. Platform is Unix / Linux.
+
+3~ Debian
+
+If you use Debian use the Debian packages, check the information at:
+
+_1 http://www.jus.uio.no/sisu/SiSU/download.html#debian
+
+(A) SiSU is available directly off the Debian archives for Sid and testing. It
+should necessary only to run as root:
+
+_1 aptitude update
+
+_1 aptitude install sisu-complete
+
+(B) If there are newer versions of SiSU upstream of the Debian archives, they
+will be available by adding the following to your /etc/apt/sources.list
+
+_1 deb http://www.jus.uio.no/sisu/archive unstable main non-free
+
+_1 deb-src http://www.jus.uio.no/sisu/archive unstable main non-free
+
+[the non-free line is for document markup samples, for which the substantive text is provided under the author or original publisher's license and which in most cases will not be debian free software guideline compliant]
+
+Then as root run:
+
+_1 aptitude update
+
+_1 aptitude install sisu-complete
+
+3~ RPM
+
+RPMs are provided though untested, they are prepared by running alien against the source package, and against the debs.
+
+They may be downloaded from:
+
+_1 http://www.jus.uio.no/sisu/SiSU/download.html#rpm
+
+3~ Source package .tgz
+
+Otherwise to install SiSU from source, check information at:
+
+_1 http://www.jus.uio.no/sisu/SiSU/download.html#current
+
+alternative modes of installation from source are provided, setup.rb (by Minero Aoki), rake (by Jim Weirich) built install file, rant (by Stefan Lang) built install file,
+
+Ruby is the essential dependency for the basic operation of SiSU
+
+1. Download the latest source (information available) from:
+
+_1 http://www.jus.uio.no/sisu/SiSU/download.html#current
+
+2. Unpack the source
+
+Note however, that additional external package dependencies, such as texlive or postgresql should you desire to use it are not taken care of for you.
+
+3~ to use setup.rb
+
+this is a three step process, in the root directory of the unpacked SiSU as root type:
+
+_1 ruby setup.rb config
+
+_1 ruby setup.rb setup
+
+as root:
+
+_1 ruby setup.rb install
+
+further information:
+
+_1 http://i.loveruby.net/en/projects/setup/
+
+_1 http://i.loveruby.net/en/projects/setup/doc/usage.html
+
+3~ to use install (prapared with "Rake")
+
+Rake must be installed on your system:
+
+_1 http://rake.rubyforge.org/
+
+_1 http://rubyforge.org/frs/?group_id=50
+
+in the root directory of the unpacked SiSU as root type:
+
+_1 rake
+
+or
+
+_1 rake base
+
+This makes use of Rake (by Jim Weirich) and the provided Rakefile
+
+For a list of alternative actions you may type:
+
+_1 rake help
+
+_1 rake -T
+
+3~ to use install (prapared with "Rant")
+
+(you may use the instructions above for rake substituting rant if rant is
+installed on your system, or you may use an independent installer created using
+rant as follows:)
+
+in the root directory of the unpacked SiSU as root type:
+
+_1 ruby ./sisu-install
+
+or
+
+_1 ruby ./sisu-install base
+
+This makes use of Rant (by Stefan Lang) and the provided Rantfile. It has been configured to do post installation setup setup configuration and generation of first test file. Note however, that additional external package dependencies, such as tetex-extra are not taken care of for you.
+
+further information:
+
+_1 http://make.rubyforge.org/
+
+_1 http://rubyforge.org/frs/?group_id=615
+
+For a list of alternative actions you may type:
+
+_1 ruby ./sisu-install help
+
+_1 ruby ./sisu-install -T
+
+2~ Dependencies
+
+Once installed see 'man 8 sisu' for some information on additional programs that sisu makes use of, and that you may need or wish to install. (this will depend on such factors as whether you want to generate pdf, whether you will be using SiSU with or without a database, ...) 'man sisu-markup-samples' may also be of interest if the sisu-markup-samples package has also been installed.
+
+The information in man 8 may not be most up to date, and it is possible that more useful information can be gleaned from the following notes taken from the Debian control file (end edited), gives an idea of additional packages that SiSU can make use of if available, (the use/requirement of some of which are interdependent for specific actions by SiSU).
+
+The following is from the debian/control file of sisu-3.0.2, which amongst other things provides the dependencies of sisu within Debian.
+
+code{
+
+Source: sisu
+Section: text
+Priority: optional
+Maintainer: SiSU Project <sisu@lists.sisudoc.org>
+Uploaders: Ralph Amissah <ralph@amissah.com>
+Build-Depends: debhelper (>= 8)
+Standards-Version: 3.9.1
+Homepage: http://www.sisudoc.org/
+Vcs-Browser: http://git.sisudoc.org/?p=code/sisu.git
+Vcs-Git: git://git.sisudoc.org/git/code/sisu.git
+XS-Dm-Upload-Allowed: yes
+
+}code
+
+code{
+
+Package: sisu
+Architecture: all
+Depends: ${misc:Depends}, ruby (>= 1.8.2), libwebrick-ruby, rsync, unzip, zip
+Recommends:
+ sisu-pdf, sisu-sqlite, sisu-postgresql, imagemagick, keychain, librmagick-ruby,
+ librexml-ruby, openssl, openssh-client | lsh-client, tidy, vim-addon-manager
+Suggests: lv, calibre, pinfo, texinfo, trang
+Conflicts: sisu-markup-samples (<= 1.0.11)
+Replaces: sisu-markup-samples (<= 1.0.11)
+Description: documents - structuring, publishing in multiple formats and search
+ SiSU is a lightweight markup based, command line oriented, document
+ structuring, publishing and search framework for document collections.
+ .
+ With minimal preparation of a plain-text, (UTF-8) file, using its native
+ markup syntax in your text editor of choice, SiSU can generate various
+ document formats (most of which share a common object numbering system for
+ locating content), including plain text, HTML, XHTML, XML, EPUB, OpenDocument
+ text (ODF:ODT), LaTeX, PDF files, and populate an SQL database with objects
+ (roughly paragraph-sized chunks) so searches may be performed and matches
+ returned with that degree of granularity: your search criteria is met by these
+ documents and at these locations within each document. Object numbering is
+ particularly suitable for "published" works (finalized texts as opposed to
+ works that are frequently changed or updated) for which it provides a fixed
+ means of reference of content. Document outputs also share semantic meta-data
+ provided.
+ .
+ SiSU also provides concordance files, document content certificates and
+ manifests of generated output.
+ .
+ A vim syntax highlighting file and an ftplugin with folds for sisu markup is
+ provided, as are syntax highlighting files for kate, kwrite, gedit and
+ diakonos. Vim 7 includes syntax highlighting for SiSU.
+ .
+ man pages, and interactive help are provided.
+ .
+ Dependencies for various features are taken care of in sisu related packages.
+ The package sisu-complete installs the whole of SiSU.
+ .
+ Additional document markup samples are provided in the package
+ sisu-markup-samples which is found in the non-free archive the licenses for
+ the substantive content of the marked up documents provided is that provided
+ by the author or original publisher.
+
+}code
+
+code{
+
+Package: sisu-complete
+Architecture: all
+Depends:
+ ${misc:Depends}, ruby (>= 1.8.2), sisu (= ${source:Version}),
+ sisu-pdf (= ${source:Version}), sisu-postgresql (= ${source:Version}),
+ sisu-sqlite (= ${source:Version})
+Description: installs all SiSU related packages
+ SiSU is a lightweight markup based document structuring, publishing and search
+ framework for document collections.
+ .
+ This package installs SiSU and related packages that enable sisu to produce
+ pdf and to populate PostgreSQL and sqlite databases.
+ .
+ See sisu for a description of the package.
+
+}code
+
+code{
+
+Package: sisu-pdf
+Architecture: all
+Depends:
+ ${misc:Depends}, sisu, texlive-latex-base, texlive-fonts-recommended,
+ texlive-latex-recommended, texlive-latex-extra, texlive-xetex, lmodern,
+ ttf-liberation
+Suggests: evince | pdf-viewer
+Description: dependencies to convert SiSU LaTeX output to pdf
+ SiSU is a lightweight markup based document structuring, publishing and search
+ framework for document collections.
+ .
+ This package enables the conversion of SiSU LaTeX output to pdf.
+
+}code
+
+code{
+
+Package: sisu-pdf
+Architecture: all
+Depends:
+ ${misc:Depends}, sisu, texlive-latex-base, texlive-fonts-recommended,
+ texlive-latex-recommended, texlive-latex-extra, texlive-xetex, lmodern,
+ ttf-liberation
+Suggests: evince | pdf-viewer
+Description: dependencies to convert SiSU LaTeX output to pdf
+ SiSU is a lightweight markup based document structuring, publishing and search
+ framework for document collections.
+ .
+ This package enables the conversion of SiSU LaTeX output to pdf.
+
+}code
+
+code{
+
+Package: sisu-postgresql
+Architecture: all
+Depends:
+ ${misc:Depends}, sisu, libdbd-pg-ruby, libdbd-pg-ruby1.8, libdbi-ruby,
+ libdbi-ruby1.8, libdbm-ruby, postgresql, libfcgi-ruby1.8 | libfcgi-ruby1.9.1
+Suggests: postgresql-contrib
+Description: SiSU dependencies for use with PostgreSQL database
+ SiSU is a lightweight markup based document structuring, publishing and search
+ framework for document collections.
+ .
+ This package enables SiSU to populate a PostgreSQL database. This is done at
+ an object/paragraph level, making granular searches of documents possible.
+ .
+ This relational database feature of SiSU is not required but provides
+ interesting possibilities, including that of granular searches of documents
+ for matching units of text, primarily paragraphs that can be displayed or
+ identified by object citation number, from which an index of documents
+ matched and each matched paragraph within them can be displayed.
+
+}code
+
+code{
+
+Package: sisu-sqlite
+Architecture: all
+Depends:
+ ${misc:Depends}, sisu, sqlite3, libsqlite3-ruby, libdbd-sqlite3-ruby,
+ libdbd-sqlite3-ruby1.8, libdbi-ruby, libdbi-ruby1.8, libdbm-ruby,
+ libfcgi-ruby1.8 | libfcgi-ruby1.9.1
+Description: SiSU dependencies for use with SQLite database
+ SiSU is a lightweight markup based document structuring, publishing and search
+ framework for document collections.
+ .
+ This package enables SiSU to populate an SQLite database. This is done at an
+ object/paragraph level, making granular searches of documents possible.
+ .
+ This relational database feature of SiSU is not required but provides
+ interesting possibilities, including that of granular searches of documents
+ for matching units of text, primarily paragraphs that can be displayed or
+ identified by object citation number, from which an index of documents
+ matched and each matched paragraph within them can be displayed.
+
+}code
+
+2~ Quick start
+
+Most of the installation should be taken care of by the aptitude or rant
+install. (The rant install if run in full will also test run the generation of
+the first document).
+
+After installation of sisu-complete, move to the document samples directory
+
+_1 cd /usr/share/doc/sisu/markup-samples/samples
+
+and run
+
+_1 sisu -3 free_as_in_freedom.rms_and_free_software.sam_williams.sst
+
+or the same:
+
+_1 sisu -NhwpoabxXyv free_as_in_freedom.rms_and_free_software.sam_williams.sst
+
+look at output results, see the "sisu_manifest" page created for the document
+
+or to generate an online document move to a writable directory, as the file will be downloaded there and e.g.
+
+sisu -3 http://www.jus.uio.no/sisu/src/free_culture.lawrence_lessig.sst
+
+the database stuff is extra perhaps, the latex stuff could be considered extra perhaps but neither needs to be installed for most of sisu output to work
+
+examine source document, vim has syntax support
+
+gvim free_as_in_freedom.rms_and_free_software.sam_williams.sst
+
+additional markup samples in
+
+_1 http://www.jus.uio.no/sisu/SiSU/examples.html
+
+For help
+
+_1 man sisu
+
+or
+
+_1 sisu --help
+
+e.g.
+
+for the way sisu "sees/maps" your system
+
+_1 sisu --help env
+
+for list of commands and so on
+
+_1 sisu --help commands
+
+2~ Configuration files
+
+The default configuration/setup is contained within the program and is altered by configuration settings in /etc/[sisu version]/sisurc.yml or in ~/.sisu/sisurc.yml
+
+_* configuration file - a yaml file
+
+_1 /etc/sisu/[sisu version]/sisurc.yml
+
+_1 ~/.sisu/sisurc.yml
+
+_* directory structure - setting up of output and working directory.
+
+_* additional software - eg. Tex and LaTeX (tetex, tetex-base, tetex-extra on Debian), Postgresql, [sqlite], trang, tidy, makeinfo, ... none of which are required for basic html or XML processing.
+
+_* if you use Vim as editor there is a syntax highlighter and fold resource config file for SiSU. I hope more syntax highlighters follow.
+
+There are post installation steps (which are really part of the overall installation)
+
+sisu -C in your marked up document directory, should do some auto-configuring provided you have the right permissions for the output directories. (and provided the output directories have already been specified if you are not using the defaults).
+
+2~ Use General Overview
+
+Documents are marked up in SiSU syntax and kept in an ordinary text editable file, named with the suffix .sst, or .ssm
+
+Marked up SiSU documents are usually kept in a sub-directory of your choosing
+
+use the interactive help and man pages
+
+_1 sisu --help
+
+_1 man sisu
+
+2~ Help
+
+interactive help described below, or man page:
+
+_1 man sisu
+
+_1 man 8 sisu
+
+'man sisu_markup-samples' [if the sisu-markup-samples package is also installed]
+
+Once installed an interactive help is available typing 'sisu' (without) any flags, and select an option:
+
+_1 sisu
+
+alternatively, you could type e.g.
+
+_1 sisu --help commands
+
+_1 sisu --help env
+
+_1 sisu --help headers
+
+_1 sisu --help markup
+
+_1 sisu --help headings
+
+etc.
+
+for questions about mappings, output paths etc.
+
+_1 sisu --help env
+
+_1 sisu --help path
+
+_1 sisu --help directory
+
+2~ Directory Structure
+
+Once installed, type:
+
+_1 sisu --help env
+
+or
+
+_1 sisu -V
+
+2~ Configuration File
+
+The defaults can be changed via SiSU's configure file sisurc.yml which the program expects to find in ./_sisu ~/.sisu or /etc/sisu (searched in that order, stopping on the first one found)
+
+2~ Markup
+
+See man pages.
+
+_1 man sisu
+
+_1 man 8 sisu
+
+Once installed there is some information on SiSU Markup in its help:
+
+_1 sisu --help markup
+
+and
+
+_1 sisu --help headers
+
+Sample marked up document are provided with the download tarball in the directory:
+
+_1 ./data/doc/sisu/markup-samples/
+
+These are installed on the system usually at:
+
+_1 /usr/share/doc/sisu/markup-samples/
+
+More markup samples are available in the package sisu-markup-samples, which if installed should be available at:
+
+_1 /usr/share/doc/sisu/markup-samples-non-free/
+
+Many more are available online off:
+
+_1 http://www.jus.uio.no/sisu/SiSU/examples.html
+
+2~ Additional Things
+
+There is syntax support for some editors provided (together with a README file) in
+
+_1 ./data/sisu/v4/conf/editor-syntax-etc
+
+usually installed to:
+
+_1 /usr/share/sisu/v4/conf/editor-syntax-etc
+
+2~ License
+
+License: GPL 3 or later see the copyright file in
+
+_1 ./data/doc/sisu
+
+usually installed to:
+
+_1 /usr/share/doc/sisu
+
+2~ SiSU Standard
+
+SiSU uses:
+
+_* Standard SiSU markup syntax,
+
+_* Standard SiSU meta-markup syntax, and the
+
+_* Standard SiSU object citation numbering and system
+
+© Ralph Amissah 1997, current 2006 All Rights Reserved.
+
+_* however note the License section
+
+CHANGELOG
+
+_1 ./CHANGELOG
+
+and see
+
+_1 http://www.jus.uio.no/sisu/SiSU/changelog.html
+
+_1 http://www.jus.uio.no/sisu/SiSU/changelog_markup_samples.html
+
+:C~ Extracts from man 8 sisu
+
+1~howto_setup_post_installation Post Installation Setup
+
+2~ Post Installation Setup - Quick start
+
+After installation of sisu-complete, move to the document samples directory,
+
+_1 cd /usr/share/doc/sisu/markup-samples/samples
+
+[this is not where you would normally work but provides sample documents for
+testing, you may prefer instead to copy the contents of that directory to a local
+directory before proceeding]
+
+and in that directory, initialise the output directory with the command
+
+_1 sisu -CC
+
+then run:
+
+_1 sisu -1 free_as_in_freedom.rms_and_free_software.sam_williams.sst
+
+or the same:
+
+_1 sisu -NhwpoabxXyv free_as_in_freedom.rms_and_free_software.sam_williams.sst
+
+look at output results, see the "sisu_manifest" page created for the document
+
+for an overview of your current sisu setup, type:
+
+_1 sisu --help env
+
+or
+
+_1 sisu -V
+
+To generate a document from a remote url accessible location move to a writable directory, (create a work directory and cd into it) as the file will be downloaded there and e.g.
+
+_1 sisu -1 http://www.jus.uio.no/sisu/src/gpl.fsf.sst
+
+_1 sisu -3 http://www.jus.uio.no/sisu/src/free_culture.lawrence_lessig.sst
+
+examine source document, vim has syntax highlighting support
+
+gvim free_as_in_freedom.rms_and_free_software.sam_williams.sst
+
+additional markup samples in
+
+_1 http://www.jus.uio.no/sisu/SiSU/examples.html
+
+it should also be possible to run sisu against sisupods (prepared zip files, created by running the command sisu -S [filename]), whether stored locally or remotely.
+
+_1 sisu -3 http://www.jus.uio.no/sisu/pod/free_culture.lawrence_lessig.sst.zip
+
+_1 sisu -3 --trust http://www.jus.uio.no/sisu/pod/free_culture.lawrence_lessig.sst.zip
+
+For help
+
+_1 man sisu
+
+_1 sisu --help
+
+_1 sisu --help env
+for the way sisu "sees/maps" your system
+
+_1 sisu --help commands
+for list of commands and so on
+
+2~ Document markup directory
+
+% B. Generate a (local) document from a markup/work directory.
+
+Perhaps the easiest way to begin is to create a directory for sisu marked up documents within your home directory, and copy the file structure (and document samples) provided in the document sample directory:
+
+_1 mkdir ~/sisu_test
+
+_1 cd ~/sisu_test
+
+_1 cp -a /usr/share/doc/sisu/markup-samples/samples/* ~/sisu_test/.
+
+better if you have installed sisu-markup-samples
+
+_1 cp -a /usr/share/doc/sisu/markup-samples-non-free/samples/* ~/sisu_test/.
+
+% !_ Tip:
+% the markup syntax examples may be of interest
+%
+% _1 http://www.jus.uio.no/sisu/sample/
+
+!_ Tip:
+
+_1 sisu -U [sisu markup filename]
+
+should printout the different possible outputs and where sisu would place them.
+
+!_ Tip:
+if you want to toggle ansi color add
+
+_1 c
+
+to your flags.
+
+3~ Configuration files
+
+SiSU configuration file search path is:
+
+_1 ./_sisu/sisurc.yaml
+
+_1 ~/.sisu/sisurc.yaml
+
+_1 /etc/sisu/sisurc.yaml
+
+.\"%% Debian Installation Note
+
+3~ Debian INSTALLATION Note
+
+It is best you see
+
+_1 http://www.jus.uio.no/sisu/SiSU/download.html#debian
+
+for up the most up to date information.
+
+notes taken from the Debian control file (end edited), gives an idea of additional packages that SiSU can make use of if available, (the use/requirement of some of which are interdependent for specific actions by SiSU):
+
+Package: sisu
+
+SiSU is a lightweight markup based, command line oriented, document structuring, publishing and search framework for document collections.
+
+With minimal preparation of a plain-text, (UTF-8) file, using its native markup syntax in your text editor of choice, SiSU can generate various document formats (most of which share a common object numbering system for locating content), including plain text, HTML, XHTML, XML, OpenDocument text (ODF:ODT), EPUB, LaTeX, PDF files, and populate an SQL database with objects (roughly paragraph-sized chunks) so searches may be performed and matches returned with that degree of granularity: your search criteria is met by these documents and at these locations within each document. Object numbering is particularly suitable for "published" works (finalized texts as opposed to works that are frequently changed or updated) for which it provides a fixed means of reference of content. Document outputs also share semantic meta-data provided.
+
+SiSU also provides concordance files, document content certificates and manifests of generated output.
+
+A vim syntax highlighting file and an ftplugin with folds for sisu markup is provided, as are syntax highlighting files for kate, kwrite, gedit and diakonos. Vim 7 includes syntax highlighting for SiSU.
+
+man pages, and interactive help are provided.
+
+Dependencies for various features are taken care of in sisu related packages. The package sisu-complete installs the whole of SiSU.
+
+Additional document markup samples are provided in the package sisu-markup-samples which is found in the non-free archive the licenses for the substantive content of the marked up documents provided is that provided by the author or original publisher.
+
+Homepage: http://www.sisudoc.org
+
+old homepage: http://www.jus.uio.no/sisu
+
+3~ Document Resource Configuration
+
+!_ sisu
+resource configuration information is obtained from sources (where they exist):
+
+_1 ~/.sisu/sisurc.yaml
+
+_1 /etc/sisu/[sisu version]/sisurc.yaml
+
+_1 sisu program defaults
diff --git a/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_installation.ssi b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_installation.ssi
new file mode 100644
index 00000000..f908bb6e
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_installation.ssi
@@ -0,0 +1,368 @@
+% SiSU insert 2.0
+
+@title: SiSU
+ :subtitle: Installation
+
+@creator:
+ :author: Amissah, Ralph
+
+@date:
+ :published: 2007-09-16
+ :created: 2002-11-12
+ :issued: 2002-11-12
+ :available: 2002-11-12
+ :modified: 2011-02-07
+
+@rights:
+ :copyright: Copyright (C) Ralph Amissah 2007
+ :license: GPL 3 (part of SiSU documentation)
+
+:A~? SiSU Installation notes
+
+:C~ Installation
+
+1~installation Installation
+
+See the {~^ download pages }http://www.jus.uio.no/sisu/SiSU/download.html for information related to installation.
+
+2~ Debian
+
+SiSU is developed on Debian, and packages are available for Debian that take care of the dependencies encountered on installation.
+
+The package is divided into the following components:
+
+_1 *sisu*, the base code, (the main package on which the others depend), without any dependencies other than ruby (and for convenience the ruby webrick web server), this generates a number of types of output on its own, other packages provide additional functionality, and have their dependencies
+
+_1 *sisu-complete*, a dummy package that installs the whole of greater sisu as described below, apart from sisu-examples
+
+_1 *sisu-pdf*, dependencies used by sisu to produce pdf from LaTeX generated
+
+_1 *sisu-postgresql*, dependencies used by sisu to populate postgresql database (further configuration is necessary)
+
+_1 *sisu-remote*, dependencies used to place sisu output on a remote server (further configuration is necessary)
+
+_1 *sisu-sqlite*, dependencies used by sisu to populate sqlite database
+
+_1 *sisu-markup-samples*, sisu markup samples and other miscellany (under Debian Free Software Guidelines non-free)
+
+SiSU is available off { Debian Unstable and Testing }http://packages.debian.org/cgi-bin/search_packages.pl?searchon=names&subword=1&version=all&release=all&keywords=sisu&sourceid=mozilla-search ~{ http://packages.qa.debian.org/s/sisu.html }~ install it using apt-get, aptitude or alternative Debian install tools. SiSU is currently comprised of eight packages. *~apt-get
+
+Initial packaging is done here and to get the latest version of SiSU available you may add the following line(s) to your sources list: *~sources.list
+
+code{
+
+#/etc/apt/sources.list
+
+deb http://www.jus.uio.no/sisu/archive unstable main non-free
+deb-src http://www.jus.uio.no/sisu/archive unstable main non-free
+
+}code
+
+The non-free section is for sisu markup samples provided, which contain authored works the substantive text of which cannot be changed, and which as a result do not meet the debian free software guidelines.
+
+On Debian there is little more to know beyond how to install software on Debian using apt, aptitude or synaptic.
+
+code{
+
+#Using aptitude:
+
+ aptitude update
+
+ aptitude install sisu-complete sisu-markup-samples
+
+}code
+
+code{
+
+Using apt-get
+
+ apt-get update
+
+ apt get install sisu-complete sisu-examples
+
+}code
+
+2~ Other Unix / Linux
+
+A source tarball or an rpms built using alien are available, (however dependencies have not been tested). SiSU is first packaged and tested with dependency handling for Debian.~{ Notes on dependencies are provided in the section that follows }~ Information on dependencies configured for Debian is provided as this may be of assistance.
+
+3~ source tarball
+
+!_ installation with provided install script
+
+To install SiSU, in the root directory of the unpacked SiSU _{as root type}_:~{ This makes use of rant and the provided Rantfile. Note however, that additional external package dependencies, such as tetex-extra are not taken care of for you. }~
+
+_1 ruby install
+
+Once installed see man 8 sisu for information on additional programs that sisu makes use of.
+
+Further notes on install script.
+
+The install script is prepared using Rant, and a Rantfile *~rant is provided,~{ a Rantfile has been configured to do post installation setup }~ with more comprehensive install options, and post install and setup configuration and generation of first test file, if you have installed Stefan Lang's {~^ Rant }http://make.rubyforge.org/ ~{ http://make.rubyforge.org/ <br> http://rubyforge.org/frs/?group_id=615 }~ installed. While in the package directory, type: rant help, or rant -T, or to install SiSU _{as root}_, type:
+
+*install* is an install script prepared using Stefan Lang's {~^ Rant }http://make.rubyforge.org/ ~{ http://make.rubyforge.org/ <br> http://rubyforge.org/frs/?group_id=615 }~ It should work whether you have previously installed Rant or not. It has fairly comprehensive install options, and can do some post install and setup configuration and generation of first test file. For options type:
+
+_1 ruby install -T
+
+To install as root type:
+
+_1 ruby install
+
+For a minimal install type:
+
+_1 ruby install base
+
+!_ installation with setup.rb
+
+{~^ setup.rb }http://i.loveruby.net/en/projects/setup/ is provided the package and will install SiSU~{ Minero Aoki<br> http://i.loveruby.net/en/projects/setup/doc/ }~ installation is a 3 step process~{ Installation instructions<br> http://i.loveruby.net/en/projects/setup/doc/usage.html }~ the following string assumes you are in the package directory and that you have root as sudo:
+
+_1 ruby setup.rb config && ruby setup.rb setup && sudo ruby setup.rb install
+
+!_ installation of rpm
+
+The RPM is generated from the source file using Alien.~{ http://www.kitenet.net/programs/alien/ }~ Dependencies are not handled, not even that of the essential Ruby.
+
+1~install_dependencies_and_notes SiSU Components, Dependencies and Notes
+
+The dependency lists are from the Debian control file for SiSU version 0.36, and may assist in building SiSU on other distributions.
+
+2~ sisu
+
+_* the base code, (the main package on which the others depend), without any dependencies other than ruby (and for convenience the ruby webrick web server), this generates a number of types of output on its own, other packages provide additional functionality, and have their dependencies
+
+*Depends:* on ruby (>=1.8.2), libwebrick-ruby
+
+*Recommends:* sisu-pdf, sisu-sqlite, sisu-postgresql, sisu-examples, librmagick-ruby, trang, tidy, libtidy, librexml-ruby, zip, unzip, openssl
+
+initialise directory
+
+_1 sisu -CC
+
+html
+
+_1 sisu -hv [filename/wildcard]
+
+_1 sisu -Hv [filename/wildcard]
+
+LaTeX (but sisu-pdf dependencies required to convert that to pdf)
+
+_1 sisu -pv [filename/wildcard]
+
+plain text Unix with footnotes
+
+_1 sisu -av [filename/wildcard]
+
+plain text Dos with footnotes
+
+_1 sisu -Av [filename/wildcard]
+
+plain text Unix with endnotes
+
+_1 sisu -ev [filename/wildcard]
+
+plain text Dos with endnotes
+
+_1 sisu -Ev [filename/wildcard]
+
+openoffice odt
+
+_1 sisu -ov [filename/wildcard]
+
+xhtml
+
+_1 sisu -bv [filename/wildcard]
+
+XML SAX
+
+_1 sisu -xv [filename/wildcard]
+
+XML DOM
+
+_1 sisu -Xv [filename/wildcard]
+
+wordmap (a rudimentary index of content)
+
+_1 sisu -wv [filename/wildcard]
+
+document content certificate
+
+_1 sisu -Nv [filename/wildcard]
+
+placement of sourcefile in output directory
+
+_1 sisu -sv [filename/wildcard]
+
+creation of source tarball with images, and placement of source tarball in ouput directory
+
+_1 sisu -Sv [filename/wildcard]
+
+manifest of output produced (polls output directory and provides links to existing output)
+
+_1 sisu -yv [filename/wildcard]
+
+url for output files -u -U
+
+_1 sisu -uv[and other flags] [filename/wildcard]
+
+_1 sisu -Uv [filename/wildcard]
+
+toggle screen colour
+
+_1 sisu -cv[and processing flags] [filename/wildcard]
+
+verbose mode
+
+_1 sisu -v[and processing flags] [filename/wildcard]
+
+_1 sisu -V[and processing flags] [filename/wildcard]
+
+quiet mode
+
+_1 sisu -q[and processing flags] [filename/wildcard]
+
+maintenance mode, intermediate files kept -M
+
+_1 sisu -Mv[and other flags] [filename/wildcard]
+
+[the -v is for verbose]
+
+start the webrick server
+
+_1 sisu -W
+
+2~ sisu-complete
+
+_* a dummy package that installs the whole SiSU, apart from sisu-examples
+
+*Depends:* ruby (>=1.8.2), sisu, sisu-pdf, sisu-postgresql, sisu-remote, sisu-sqlite
+
+*Recommends:* sisu-examples
+
+2~ sisu-examples
+
+_* installs sisu markup samples and other miscelleny
+
+*Depends:* sisu
+
+2~ sisu-pdf
+
+_* dependencies used by sisu to produce pdf from LaTeX generated
+
+*Depends:* sisu, tetex-bin, tetex-extra, latex-ucs
+
+*Suggests:* evince, xpdf
+
+converts sisu LaTeX produced to pdf
+
+_1 sisu -pv [filename/wildcard]
+
+[the -v is for verbose]
+
+2~ sisu-postgresql
+
+_* dependencies used by sisu to populate postgresql database (further configuration is necessary)
+
+*Depends:* sisu, postgresql-8.1, libdbi-ruby, libdbm-ruby, libdbd-pg-ruby
+
+*Suggests:* pgaccess, libdbd-pgsql, postgresql-contrib-8.1
+
+installs dependencies for sisu to work with and populate postgresql database
+
+create database
+
+_1 sisu -Dv createall
+
+drop database
+
+_1 sisu -Dv dropall
+
+import content
+
+_1 sisu -Div [filename/wildcard]
+
+_1 sisu -Dv import [filename/wildcard]
+
+update content
+
+_1 sisu -Duv [filename/wildcard]
+
+_1 sisu -Dv update [filename/wildcard]
+
+[the -v is for verbose]
+
+The following are available without installation of the sisu-postgresql component, but are of interest in this context
+
+generate a sample database query form for use with webserver on port 80
+
+_1 sisu -F
+
+or for use with webrick server
+
+_1 sisu -F webrick
+
+to start webrick server
+
+_1 sisu -W
+
+2~ sisu-remote
+
+_* dependencies used to place sisu output on a remote server (further configuration is necessary)
+
+scp
+
+_1 sisu -vr[and processing flags] [filename/wildcard]
+
+rsync
+
+_1 sisu -vR[and processing flags] [filename/wildcard]
+
+[the -v is for verbose]
+
+*Depends:* sisu, rsync, openssh-client|lsh-client, keychain
+
+2~ sisu-sqlite
+
+_* dependencies used by sisu to populate sqlite database
+
+*Depends:* sisu, sqlite, libdbi-ruby, libdbm-ruby, libdbd-sqlite-ruby
+
+*Suggests:* libdbd-sqlite
+
+installs dependencies for sisu to work with and populate sqlite database
+
+create database
+
+_1 sisu -dv createall
+
+drop database
+
+_1 sisu -dv dropall
+
+update content
+
+_1 sisu -div [filename/wildcard]
+
+_1 sisu -dv import [filename/wildcard]
+
+update content
+
+_1 sisu -duv [filename/wildcard]
+
+_1 sisu -dv update [filename/wildcard]
+
+[the -v is for verbose]
+
+The following are available without installation of the sisu-sqlite component, but are of interest in this context
+
+generate a sample database query form for use with webserver on port 80
+
+_1 sisu -F
+
+or for use with webrick server
+
+_1 sisu -F webrick
+
+to start webrick server
+
+_1 sisu -W
+
diff --git a/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_interesting_to_whom.ssi b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_interesting_to_whom.ssi
new file mode 100644
index 00000000..750c46ea
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_interesting_to_whom.ssi
@@ -0,0 +1,32 @@
+% SiSU 2.0
+
+@title: SiSU
+ :subtitle: Who Might Be Interested?
+
+@creator:
+ :author: Amissah, Ralph
+
+@date:
+ :created: 2002-08-28
+ :issued: 2002-08-28
+ :available: 2002-08-28
+ :published: 2007-09-16
+ :modified: 2011-02-07
+
+@rights:
+ :copyright: Copyright (C) Ralph Amissah 2007
+ :license: GPL 3 (part of SiSU documentation)
+
+:A~? @title @creator
+
+:B~? Who might SiSU interest?
+
+1~sisu_interest Who might be interested in the SiSU feature set?
+
+SiSU is most likely to be of interest to people who are working with medium to large volumes of published texts that would like to have the presented in a uniform way that is searchable (either using sisu database integration or an appropriate indexing tool), with the possibility of multiple alternative output formats that may be added to and upgraded/updated over time. SiSU should be of interest to institutions/ organisations/ governments/ individuals with document collections and some technical knowhow that are interested in:
+
+_* long term maintenance and reducing downstream/future costs of maintaining those document sets for which SiSU is suited.
+
+_* the ability to output multiple standard format outputs for various purposes.
+
+_* the implications for search offered
diff --git a/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_introduction.sst b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_introduction.sst
new file mode 100644
index 00000000..8978ace6
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_introduction.sst
@@ -0,0 +1,55 @@
+% SiSU 4.0
+
+@title: SiSU
+ :subtitle: Introduction
+
+@creator:
+ :author: Amissah, Ralph
+
+@date:
+ :published: 2007-09-16
+ :created: 2002-08-28
+ :issued: 2002-08-28
+ :available: 2002-08-28
+ :modified: 2012-10-03
+
+@rights:
+ :copyright: Copyright (C) Ralph Amissah 2011
+ :license: GPL 3 (part of SiSU documentation)
+
+@classify:
+ :subject: ebook, epublishing, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, search
+
+:A~? @title @creator
+
+:B~? What is SiSU?
+
+:C~? Description
+
+1~sisu_intro Introduction - What is SiSU?
+
+SiSU is a framework for document structuring, publishing (in multiple open standard formats) and search, comprising of: (a) a lightweight document structure and presentation markup syntax; and (b) an accompanying engine for generating standard document format outputs from documents prepared in sisu markup syntax, which is able to produce multiple standard outputs (including the population of sql databases) that (can) share a common numbering system for the citation of text within a document.
+
+SiSU is developed under an open source, software libre license (GPLv3). Its use case for development is work with medium to large document sets and cope with evolving document formats/ representation technologies. Documents are prepared once, and generated as need be to update the technical presentation or add additional output formats. Various output formats (including search related output) share a common mechanism for cross-output-format citation.
+
+SiSU both defines a markup syntax and provides an engine that produces open standards format outputs from documents prepared with SiSU markup. From a single lightly prepared document sisu custom builds several standard output formats which share a common (text object) numbering system for citation of content within a document (that also has implications for search). The sisu engine works with an abstraction of the document's structure and content from which it is possible to generate different forms of representation of the document. Significantly SiSU markup is more sparse than html and outputs which include HTML, EPUB, ODT (Open Document Format text), LaTeX, landscape and portrait PDF, all of which can be added to and updated. SiSU is also able to populate SQL type databases at an object level, which means that searches can be made with that degree of granularity.
+
+Source document preparation and output generation is a two step process: (i) document source is prepared, that is, marked up in sisu markup syntax and (ii) the desired output subsequently generated by running the sisu engine against document source. Output representations if updated (in the sisu engine) can be generated by re-running the engine against the prepared source. Using SiSU markup applied to a document, SiSU custom builds (to take advantage of the strengths of different ways of representing documents) various standard open output formats including plain text, HTML, XHTML, XML, EPUB, ODT, LaTeX or PDF files, and populate an SQL database with objects~{ objects include: headings, paragraphs, verse, tables, images, but not footnotes/endnotes which are numbered separately and tied to the object from which they are referenced. }~ (equating generally to paragraph-sized chunks) so searches may be performed and matches returned with that degree of granularity ( e.g. your search criteria is met by these documents and at these locations within each document). Document output formats share a common object numbering system for locating content. This is particularly suitable for "published" works (finalized texts as opposed to works that are frequently changed or updated) for which it provides a fixed means of reference of content.
+
+In preparing a SiSU document you optionally provide semantic information related to the document in a document header, and in marking up the substantive text provide information on the structure of the document, primarily indicating heading levels and footnotes. You also provide information on basic text attributes where used. The rest is automatic, sisu from this information custom builds~{ i.e. the HTML, PDF, EPUB, ODT outputs are each built individually and optimised for that form of presentation, rather than for example the html being a saved version of the odf, or the pdf being a saved version of the html. }~ the different forms of output requested.
+
+SiSU works with an abstraction of the document based on its structure which is comprised of its headings~{ the different heading levels }~ and objects~{ units of text, primarily paragraphs and headings, also any tables, poems, code-blocks }~, which enables SiSU to represent the document in many different ways, and to take advantage of the strengths of different ways of presenting documents. The objects are numbered, and these numbers can be used to provide a common basis for citing material within a document across the different output format types. This is significant as page numbers are not well suited to the digital age, in web publishing, changing a browser's default font or using a different browser can mean that text will appear on a different page; and publishing in different formats, html, landscape and portrait pdf etc. again page numbers are not useful to cite text. Dealing with documents at an object level together with object numbering also has implications for search that SiSU is able to take advantage of.
+
+One of the challenges of maintaining documents is to keep them in a format that allows use of them independently of proprietary platforms. Consider issues related to dealing with legacy proprietary formats today and what guarantee you have that old proprietary formats will remain (or can be read without proprietary software/equipment) in 15 years time, or the way the way in which html has evolved over its relatively short span of existence. SiSU provides the flexibility of producing documents in multiple non-proprietary open formats including HTML, EPUB,~{ An open standard format for e-books }~ ODT,~{ Open Document Format (ODF) text }~ PDF~{ Specification submitted by Adobe to ISO to become a full open ISO specification <br> http://www.linux-watch.com/news/NS7542722606.html }~ ODF,~{ ISO standard ISO/IEC 26300:2006 }~. Whilst SiSU relies on software, the markup is uncomplicated and minimalistic which guarantees that future engines can be written to run against it. It is also easily converted to other formats, which means documents prepared in SiSU can be migrated to other document formats. Further security is provided by the fact that the software itself, SiSU is available under GPLv3 a licence that guarantees that the source code will always be open, and free as in libre, which means that that code base can be used, updated and further developed as required under the terms of its license. Another challenge is to keep up with a moving target. SiSU permits new forms of output to be added as they become important, (Open Document Format text was added in 2006 when it became an ISO standard for office applications and the archival of documents), EPUB was introduced in 2009; and allows the technical representations existing output to be updated (HTML has evolved and the related module has been updated repeatedly over the years, presumably when the World Wide Web Consortium (w3c) finalises HTML 5 which is currently under development, the HTML module will again be updated allowing all existing documents to be regenerated as HTML 5).
+
+The document formats are written to the file-system and available for indexing by independent indexing tools, whether off the web like Google and Yahoo or on the site like Lucene and Hyperestraier.
+
+SiSU also provides other features such as concordance files and document content certificates, and the working against an abstraction of document structure has further possibilities for the research and development of other document representations, the availability of objects is useful for example for topic maps and thesauri, together with the flexibility of SiSU offers great possibilities.
+
+SiSU is primarily for published works, which can take advantage of the citation system to reliably reference its documents. SiSU works well in a complementary manner with such collaborative technologies as Wikis, which can take advantage of and be used to discuss the substance of content prepared in SiSU.
+
+http://www.sisudoc.org/
+
+http://www.jus.uio.no/sisu
+
+% SiSU is a way of preparing, publishing, managing and searching documents.
diff --git a/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_manual.ssm b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_manual.ssm
new file mode 100644
index 00000000..90e8a323
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_manual.ssm
@@ -0,0 +1,96 @@
+% SiSU master 4.0
+
+@title: SiSU
+ :subtitle: Manual
+
+@creator:
+ :author: Amissah, Ralph
+
+@date:
+ :published: 2008-07-21
+ :created: 2002-08-28
+ :issued: 2002-08-28
+ :available: 2002-08-28
+ :modified: 2012-10-03
+
+@rights:
+ :copyright: Copyright (C) Ralph Amissah 2007
+ :license: GPL 3 (part of SiSU documentation)
+
+@classify:
+ :topic_register: SiSU:manual;electronic documents:SiSU:manual
+ :subject: ebook, epublishing, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, search
+
+:A~ @title @creator
+
+:B~ What is SiSU?
+
+<< sisu_introduction.sst
+
+<< sisu_how.ssi
+
+<< sisu_short_feature_summary.ssi
+
+<< sisu_help.sst
+
+% :B~? SiSU Commands
+
+<< sisu_commands.sst
+
+% :B~? SiSU Markup
+
+<< sisu_markup.sst
+
+<< sisu_filetypes.sst
+
+% :B~? SiSU Configuration
+
+<< sisu_config.ssi
+
+<< sisu_css.ssi
+
+<< sisu_content_directories.ssi
+
+<< sisu_homepages.ssi
+
+% :B~? SiSU Output and Markup Examples
+
+<< sisu_examples.ssi
+
+<< sisu_output_overview.sst
+
+<< sisu_search_intro.ssi
+
+<< sisu_sql.ssi
+
+<< sisu_postgresql.sst
+
+<< sisu_sqlite.sst
+
+<< sisu_search_cgi.ssi
+
+<< sisu_webrick.sst
+
+<< sisu_remote.sst
+
+% :B~? SiSU Download and Installation
+
+<< sisu_download.ssi
+
+<< sisu_installation.ssi
+
+<< sisu_quickstart.sst
+
+% :B~? SiSU Howto and FAQ
+
+<< sisu_howto.sst
+
+<< sisu_faq.sst
+
+<< sisu_interesting_to_whom.ssi
+
+<< sisu_work_needed_and_wishlist.ssi
+
+<< sisu_syntax_highlighting.sst
+
+<< sisu_help_sources.sst
diff --git a/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_markup.sst b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_markup.sst
new file mode 100644
index 00000000..9027817a
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_markup.sst
@@ -0,0 +1,1268 @@
+% SiSU 4.0
+
+@title: SiSU
+ :subtitle: Markup
+
+@creator:
+ :author: Amissah, Ralph
+
+@date:
+ :created: 2002-08-28
+ :issued: 2002-08-28
+ :available: 2002-08-28
+ :published: 2008-05-22
+ :modified: 2012-10-03
+
+@rights:
+ :copyright: Copyright (C) Ralph Amissah 2007
+ :license: GPL 3 (part of SiSU documentation)
+
+@classify:
+ :topic_register: electronic documents:SiSU:document:markup;SiSU:document:markup;SiSU:document:markup;SiSU:manual:markup;electronic documents:SiSU:manual:markup
+ :subject: ebook, epublishing, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, search
+
+:A~? @title @creator
+
+:B~? SiSU Markup
+
+1~markup Introduction to SiSU Markup~{ From sometime after SiSU 0.58 it should be possible to describe SiSU markup using SiSU, which though not an original design goal is useful. }~
+
+2~ Summary
+
+SiSU source documents are plaintext (UTF-8)~{ files should be prepared using UTF-8 character encoding }~ files
+
+All paragraphs are separated by an empty line.
+
+Markup is comprised of:
+
+_* at the top of a document, the document header made up of semantic meta-data about the document and if desired additional processing instructions (such an instruction to automatically number headings from a particular level down)
+
+_* followed by the prepared substantive text of which the most important single characteristic is the markup of different heading levels, which define the primary outline of the document structure. Markup of substantive text includes:
+
+_1* heading levels defines document structure
+
+_1* text basic attributes, italics, bold etc.
+
+_1* grouped text (objects), which are to be treated differently, such as code blocks or poems.
+
+_1* footnotes/endnotes
+
+_1* linked text and images
+
+_1* paragraph actions, such as indent, bulleted, numbered-lists, etc.
+
+Some interactive help on markup is available, by typing sisu and selecting markup or sisu --help markup
+
+To check the markup in a file:
+
+_1 sisu --identify [filename].sst
+
+For brief descriptive summary of markup history
+
+_1 sisu --query-history
+
+or if for a particular version:
+
+_1 sisu --query-0.38
+
+2~ Markup Examples
+
+3~ Online
+
+Online markup examples are available together with the respective outputs produced from http://www.jus.uio.no/sisu/SiSU/examples.html or from http://www.jus.uio.no/sisu/sisu_examples/
+
+There is of course this document, which provides a cursory overview of sisu markup and the respective output produced: http://www.jus.uio.no/sisu/sisu_markup/
+
+an alternative presentation of markup syntax: /usr/share/doc/sisu/on_markup.txt.gz
+
+3~ Installed
+
+With SiSU installed sample skins may be found in: /usr/share/doc/sisu/markup-samples (or equivalent directory) and if sisu-markup-samples is installed also under: /usr/share/doc/sisu/markup-samples-non-free
+
+1~headers Markup of Headers
+
+Headers contain either: semantic meta-data about a document, which can be used by any output module of the program, or; processing instructions.
+
+Note: the first line of a document may include information on the markup version used in the form of a comment. Comments are a percentage mark at the start of a paragraph (and as the first character in a line of text) followed by a space and the comment:
+
+code{
+
+% this would be a comment
+
+}code
+
+2~ Sample Header
+
+This current document is loaded by a master document that has a header similar to this one:
+
+code{
+
+% SiSU master 2.0
+
+@title: SiSU
+ :subtitle: Manual
+
+@creator:
+ :author: Amissah, Ralph
+
+@publisher: [publisher name]
+
+@rights: Copyright (C) Ralph Amissah 2007, part of SiSU documentation, License GPL 3
+
+@classify:
+ :type: information
+ :topic_register: SiSU:manual;electronic documents:SiSU:manual
+ :subject: ebook, epublishing, electronic book, electronic publishing,
+ electronic document, electronic citation, data structure,
+ citation systems, search
+
+% used_by: manual
+
+@date:
+ :published: 2008-05-22
+ :created: 2002-08-28
+ :issued: 2002-08-28
+ :available: 2002-08-28
+ :modified: 2010-03-03
+
+@make:
+ :num_top: 1
+ :breaks: new=C; break=1
+ :bold: /Gnu|Debian|Ruby|SiSU/
+ :home_button_text: {SiSU}http://sisudoc.org; {git}http://git.sisudoc.org
+ :footer: {SiSU}http://sisudoc.org; {git}http://git.sisudoc.org
+ :manpage: name=sisu - documents: markup, structuring, publishing in multiple standard formats, and search;
+ synopsis=sisu [-abcDdeFhIiMmNnopqRrSsTtUuVvwXxYyZz0-9] [filename/wildcard ]
+ . sisu [-Ddcv] [instruction]
+ . sisu [-CcFLSVvW]
+ . sisu --v4 [operations]
+ . sisu --v3 [operations]
+
+@links:
+ { SiSU Homepage }http://www.sisudoc.org/
+ { SiSU Manual }http://www.sisudoc.org/sisu/sisu_manual/
+ { Book Samples & Markup Examples }http://www.jus.uio.no/sisu/SiSU/examples.html
+ { SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html
+ { SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html
+ { SiSU Git repo }http://git.sisudoc.org/?p=code/sisu.git;a=summary
+ { SiSU List Archives }http://lists.sisudoc.org/pipermail/sisu/
+ { SiSU @ Debian }http://packages.qa.debian.org/s/sisu.html
+ { SiSU Project @ Debian }http://qa.debian.org/developer.php?login=sisu@lists.sisudoc.org
+ { SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU
+
+}code
+
+2~ Available Headers
+
+Header tags appear at the beginning of a document and provide meta information on the document (such as the Dublin Core), or information as to how the document as a whole is to be processed. All header instructions take the form @headername: or on the next line and indented by once space :subheadername: All Dublin Core meta tags are available
+
+!_ @indentifier:
+information or instructions
+
+where the "identifier" is a tag recognised by the program, and the "information" or "instructions" belong to the tag/indentifier specified
+
+Note: a header where used should only be used once; all headers apart from @title: are optional; the @structure: header is used to describe document structure, and can be useful to know.
+
+This is a sample header
+
+% (Dublin Core in fuschia, other information headers in cyan, markup instructions in red):
+
+code{
+
+% SiSU 2.0 [declared file-type identifier with markup version]
+
+}code
+
+
+code{
+
+@title: [title text] [this header is the only one that is mandatory]
+ :subtitle: [subtitle if any]
+ :language: English
+
+}code
+
+code{
+
+@creator:
+ :author: [Lastname, First names]
+ :illustrator: [Lastname, First names]
+ :translator: [Lastname, First names]
+ :prepared_by: [Lastname, First names]
+
+}code
+
+code{
+
+@date:
+ :published: [year or yyyy-mm-dd]
+ :created: [year or yyyy-mm-dd]
+ :issued: [year or yyyy-mm-dd]
+ :available: [year or yyyy-mm-dd]
+ :modified: [year or yyyy-mm-dd]
+ :valid: [year or yyyy-mm-dd]
+ :added_to_site: [year or yyyy-mm-dd]
+ :translated: [year or yyyy-mm-dd]
+
+}code
+
+code{
+
+@rights:
+ :copyright: Copyright (C) [Year and Holder]
+ :license: [Use License granted]
+ :text: [Year and Holder]
+ :translation: [Name, Year]
+ :illustrations: [Name, Year]
+
+}code
+
+code{
+
+@classify:
+ :topic_register: SiSU:markup sample:book;book:novel:fantasy
+ :type:
+ :subject:
+ :description:
+ :keywords:
+ :abstract:
+ :loc: [Library of Congress classification]
+ :dewey: [Dewey classification
+
+}code
+
+code{
+
+@identify:
+ :isbn: [ISBN]
+ :oclc:
+
+}code
+
+
+code{
+
+@links: { SiSU }http://www.sisudoc.org
+ { FSF }http://www.fsf.org
+
+}code
+
+code{
+
+@make:
+ :num_top: 1
+ :headings: [text to match for each level
+ (e.g. PART; Chapter; Section; Article; or another: none; BOOK|FIRST|SECOND; none; CHAPTER;)
+ :breaks: new=:C; break=1
+ :promo: sisu, ruby, sisu_search_libre, open_society
+ :bold: [regular expression of words/phrases to be made bold]
+ :italics: [regular expression of words/phrases to italicise]
+ :home_button_text: {SiSU}http://sisudoc.org; {git}http://git.sisudoc.org
+ :footer: {SiSU}http://sisudoc.org; {git}http://git.sisudoc.org
+
+}code
+
+code{
+
+@original:
+ :language: [language]
+
+}code
+
+code{
+
+@notes:
+ :comment:
+ :prefix: [prefix is placed just after table of contents]
+
+}code
+
+% header ends here, NB only @title: is mandatory [this would be a comment]
+% NOTE: headings/levels below refer to 0.38 expermental markup (a conversion script provided in sisu-examples, modify.rb makes conversion between 0.37 and 0.38 markup simple)
+
+1~ Markup of Substantive Text
+
+2~heading_levels Heading Levels
+
+Heading levels are :A~ ,:B~ ,:C~ ,1~ ,2~ ,3~ ... :A - :C being part / section headings, followed by other heading levels, and 1 -6 being headings followed by substantive text or sub-headings. :A~ usually the title :A~? conditional level 1 heading (used where a stand-alone document may be imported into another)
+
+!_ :A~ [heading text]
+Top level heading [this usually has similar content to the title @title: ]
+NOTE: the heading levels described here are in 0.38 notation, see heading
+
+!_ :B~ [heading text]
+Second level heading [this is a heading level divider]
+
+!_ :C~ [heading text]
+Third level heading [this is a heading level divider]
+
+!_ 1~ [heading text]
+Top level heading preceding substantive text of document or sub-heading 2, the heading level that would normally be marked 1. or 2. or 3. etc. in a document, and the level on which sisu by default would break html output into named segments, names are provided automatically if none are given (a number), otherwise takes the form 1~my_filename_for_this_segment
+
+!_ 2~ [heading text]
+Second level heading preceding substantive text of document or sub-heading 3 , the heading level that would normally be marked 1.1 or 1.2 or 1.3 or 2.1 etc. in a document.
+
+!_ 3~ [heading text]
+Third level heading preceding substantive text of document, that would normally be marked 1.1.1 or 1.1.2 or 1.2.1 or 2.1.1 etc. in a document
+
+code{
+
+1~filename level 1 heading,
+
+% the primary division such as Chapter that is followed by substantive text, and may be further subdivided (this is the level on which by default html segments are made)
+
+}code
+
+2~ Font Attributes
+
+!_ markup example:
+
+code{
+
+normal text, *{emphasis}*, !{bold text}!, /{italics}/, _{underscore}_, "{citation}",
+^{superscript}^, ,{subscript},, +{inserted text}+, -{strikethrough}-, #{monospace}#
+
+normal text
+
+*{emphasis}* [note: can be configured to be represented by bold, italics or underscore]
+
+!{bold text}!
+
+/{italics}/
+
+_{underscore}_
+
+"{citation}"
+
+^{superscript}^
+
+,{subscript},
+
++{inserted text}+
+
+-{strikethrough}-
+
+#{monospace}#
+
+}code
+
+!_ resulting output:
+
+normal text, *{emphasis}*, !{bold text}!, /{italics}/, _{underscore}_, "{citation}",
+^{superscript}^, ,{subscript},, +{inserted text}+, -{strikethrough}-, #{monospace}#
+
+normal text
+
+*{emphasis}* [note: can be configured to be represented by bold, italics or underscore]
+
+!{bold text}!
+
+/{italics}/
+
+_{underscore}_
+
+"{citation}"
+
+^{superscript}^
+
+,{subscript},
+
++{inserted text}+
+
+-{strikethrough}-
+
+#{monospace}#
+
+2~ Indentation and bullets
+
+!_ markup example:
+
+code{
+
+ordinary paragraph
+
+_1 indent paragraph one step
+
+_2 indent paragraph two steps
+
+_9 indent paragraph nine steps
+
+}code
+
+!_ resulting output:
+
+ordinary paragraph
+
+_1 indent paragraph one step
+
+_2 indent paragraph two steps
+
+_9 indent paragraph nine steps
+
+!_ markup example:
+
+code{
+
+_* bullet text
+
+_1* bullet text, first indent
+
+_2* bullet text, two step indent
+
+}code
+
+!_ resulting output:
+
+_* bullet text
+
+_1* bullet text, first indent
+
+_2* bullet text, two step indent
+
+Numbered List (not to be confused with headings/titles, (document structure))
+
+!_ markup example:
+
+code{
+
+# numbered list numbered list 1., 2., 3, etc.
+
+_# numbered list numbered list indented a., b., c., d., etc.
+
+}code
+
+2~ Hanging Indents
+
+!_ markup example:
+
+code{
+
+_0_1 first line no indent,
+rest of paragraph indented one step
+
+_1_0 first line indented,
+rest of paragraph no indent
+
+in each case level may be 0-9
+
+}code
+
+!_ resulting output:
+
+_0_1 first line no indent, rest of paragraph indented one step
+
+_1_0 first line indented, rest of paragraph no indent
+
+in each case level may be 0-9
+
+2~ Footnotes / Endnotes
+
+Footnotes and endnotes are marked up at the location where they would be indicated within a text. They are automatically numbered. The output type determines whether footnotes or endnotes will be produced
+
+!_ markup example:
+
+code{
+
+~{ a footnote or endnote }~
+
+}code
+
+!_ resulting output:
+
+~{ a footnote or endnote }~
+
+!_ markup example:
+
+code{
+
+normal text~{ self contained endnote marker & endnote in one }~ continues
+
+}code
+
+!_ resulting output:
+
+normal text~{ self contained endnote marker & endnote in one }~ continues
+
+!_ markup example:
+
+code{
+
+normal text ~{* unnumbered asterisk footnote/endnote, insert multiple asterisks if required }~ continues
+
+normal text ~{** another unnumbered asterisk footnote/endnote }~ continues
+
+}code
+
+!_ resulting output:
+
+normal text ~{* unnumbered asterisk footnote/endnote, insert multiple asterisks if required }~ continues
+
+normal text ~{** another unnumbered asterisk footnote/endnote }~ continues
+
+!_ markup example:
+
+code{
+
+normal text ~[* editors notes, numbered asterisk footnote/endnote series ]~ continues
+
+normal text ~[+ editors notes, numbered asterisk footnote/endnote series ]~ continues
+
+}code
+
+!_ resulting output:
+
+normal text ~[* editors notes, numbered asterisk footnote/endnote series ]~ continues
+
+normal text ~[+ editors notes, numbered asterisk footnote/endnote series ]~ continues
+
+!_ Alternative endnote pair notation for footnotes/endnotes:
+
+code{
+
+% note the endnote marker "~^"
+
+normal text~^ continues
+
+^~ endnote text following the paragraph in which the marker occurs
+
+}code
+
+the standard and pair notation cannot be mixed in the same document
+
+2~ Links
+
+3~ Naked URLs within text, dealing with urls
+
+urls found within text are marked up automatically. A url within text is automatically hyperlinked to itself and by default decorated with angled braces, unless they are contained within a code block (in which case they are passed as normal text), or escaped by a preceding underscore (in which case the decoration is omitted).
+
+!_ markup example:
+
+code{
+
+normal text http://www.sisudoc.org/ continues
+
+}code
+
+!_ resulting output:
+
+normal text http://www.sisudoc.org/ continues
+
+An escaped url without decoration
+
+!_ markup example:
+
+code{
+
+normal text _http://www.sisudoc.org/ continues
+
+deb _http://www.jus.uio.no/sisu/archive unstable main non-free
+
+}code
+
+!_ resulting output:
+
+normal text _http://www.sisudoc.org/ continues
+
+deb _http://www.jus.uio.no/sisu/archive unstable main non-free
+
+where a code block is used there is neither decoration nor hyperlinking, code blocks are discussed later in this document
+
+!_ resulting output:
+
+code{
+
+deb http://www.jus.uio.no/sisu/archive unstable main non-free
+deb-src http://www.jus.uio.no/sisu/archive unstable main non-free
+
+}code
+
+3~link_text Linking Text
+
+To link text or an image to a url the markup is as follows
+
+!_ markup example:
+
+code{
+
+about { SiSU }http://url.org markup
+
+}code
+
+!_ resulting output:
+
+about { SiSU }http://www.sisudoc.org/ markup
+
+A shortcut notation is available so the url link may also be provided automatically as a footnote
+
+!_ markup example:
+
+code{
+
+about {~^ SiSU }http://url.org markup
+
+}code
+
+!_ resulting output:
+
+about {~^ SiSU }http://www.sisudoc.org/ markup
+
+Internal document links to a tagged location, including an ocn
+
+!_ markup example:
+
+code{
+
+about { text links }#link_text
+
+}code
+
+!_ resulting output:
+
+about { text links }#link_text
+
+Shared document collection link
+
+!_ markup example:
+
+code{
+
+about { SiSU book markup examples }:SiSU/examples.html
+
+}code
+
+!_ resulting output:
+
+about { SiSU book markup examples }:SiSU/examples.html
+
+3~ Linking Images
+
+!_ markup example:
+
+code{
+
+{ tux.png 64x80 }image
+
+% various url linked images
+
+{tux.png 64x80 "a better way" }http://www.sisudoc.org/
+
+{GnuDebianLinuxRubyBetterWay.png 100x101 "Way Better - with Gnu/Linux, Debian and Ruby" }http://www.sisudoc.org/
+
+{~^ ruby_logo.png "Ruby" }http://www.ruby-lang.org/en/
+
+}code
+
+!_ resulting output:
+
+{ tux.png 64x80 }image
+
+{tux.png 64x80 "Gnu/Linux - a better way" }http://www.sisudoc.org/
+
+{GnuDebianLinuxRubyBetterWay.png 100x101 "Way Better - with Gnu/Linux, Debian and Ruby" }http://www.sisudoc.org/
+
+{~^ ruby_logo.png "Ruby" }http://www.ruby-lang.org/en/
+
+!_ linked url footnote shortcut
+
+code{
+
+{~^ [text to link] }http://url.org
+
+% maps to: { [text to link] }http://url.org ~{ http://url.org }~
+
+% which produces hyper-linked text within a document/paragraph, with an endnote providing the url for the text location used in the hyperlink
+
+}code
+
+code{
+
+text marker *~name
+
+}code
+
+note at a heading level the same is automatically achieved by providing names to headings 1, 2 and 3 i.e. 2~[name] and 3~[name] or in the case of auto-heading numbering, without further intervention.
+
+3~ Link shortcut for multiple versions of a sisu document in the same directory tree
+
+!_ markup example:
+
+code{
+
+!_ /{"Viral Spiral"}/, David Bollier
+
+{ "Viral Spiral", David Bollier [3sS]}viral_spiral.david_bollier.sst
+
+}code
+
+
+!_ /{"Viral Spiral"}/, David Bollier
+
+{ "Viral Spiral", David Bollier [3sS]}viral_spiral.david_bollier.sst
+
+2~ Grouped Text
+
+3~ Tables
+
+Tables may be prepared in two either of two forms
+
+!_ markup example:
+
+code{
+
+table{ c3; 40; 30; 30;
+
+This is a table
+this would become column two of row one
+column three of row one is here
+
+And here begins another row
+column two of row two
+column three of row two, and so on
+
+}table
+
+}code
+
+!_ resulting output:
+
+table{ c3; 40; 30; 30;
+
+This is a table
+this would become column two of row one
+column three of row one is here
+
+And here begins another row
+column two of row two
+column three of row two, and so on
+
+}table
+
+a second form may be easier to work with in cases where there is not much information in each column
+
+*{markup example:}*~{ Table from the Wealth of Networks by Yochai Benkler<br> http://www.jus.uio.no/sisu/the_wealth_of_networks.yochai_benkler }~
+
+code{
+
+!_ Table 3.1: Contributors to Wikipedia, January 2001 - June 2005
+
+{table~h 24; 12; 12; 12; 12; 12; 12;}
+ |Jan. 2001|Jan. 2002|Jan. 2003|Jan. 2004|July 2004|June 2006
+Contributors* | 10| 472| 2,188| 9,653| 25,011| 48,721
+Active contributors** | 9| 212| 846| 3,228| 8,442| 16,945
+Very active contributors*** | 0| 31| 190| 692| 1,639| 3,016
+No. of English language articles| 25| 16,000| 101,000| 190,000| 320,000| 630,000
+No. of articles, all languages | 25| 19,000| 138,000| 490,000| 862,000|1,600,000
+
+* Contributed at least ten times; ** at least 5 times in last month; *** more than 100 times in last month.
+
+}code
+
+!_ resulting output:
+
+
+!_ Table 3.1: Contributors to Wikipedia, January 2001 - June 2005
+
+{table~h 24; 12; 12; 12; 12; 12; 12;}
+ |Jan. 2001|Jan. 2002|Jan. 2003|Jan. 2004|July 2004|June 2006
+Contributors* | 10| 472| 2,188| 9,653| 25,011| 48,721
+Active contributors** | 9| 212| 846| 3,228| 8,442| 16,945
+Very active contributors*** | 0| 31| 190| 692| 1,639| 3,016
+No. of English language articles| 25| 16,000| 101,000| 190,000| 320,000| 630,000
+No. of articles, all languages | 25| 19,000| 138,000| 490,000| 862,000|1,600,000
+
+* Contributed at least ten times; ** at least 5 times in last month; *** more than 100 times in last month.
+
+% code{
+
+% test
+
+% ~#
+
+% % unnumbered paragraph (place marker at end of paragraph)
+
+% -#
+
+% % unnumbered paragraph, delete when not required (place marker at end of paragraph) [used in dummy headings, eg. for segmented html]
+
+% % add a comment to text, that will be removed prior to processing (place marker at beginning of line)
+
+% }code
+
+3~ Poem
+
+!_ basic markup:
+
+code{
+
+poem{
+
+ Your poem here
+
+}poem
+
+Each verse in a poem is given an object number.
+
+}code
+
+!_ markup example:
+
+code{
+
+poem{
+
+ `Fury said to a
+ mouse, That he
+ met in the
+ house,
+ "Let us
+ both go to
+ law: I will
+ prosecute
+ YOU. --Come,
+ I'll take no
+ denial; We
+ must have a
+ trial: For
+ really this
+ morning I've
+ nothing
+ to do."
+ Said the
+ mouse to the
+ cur, "Such
+ a trial,
+ dear Sir,
+ With
+ no jury
+ or judge,
+ would be
+ wasting
+ our
+ breath."
+ "I'll be
+ judge, I'll
+ be jury,"
+ Said
+ cunning
+ old Fury:
+ "I'll
+ try the
+ whole
+ cause,
+ and
+ condemn
+ you
+ to
+ death."'
+
+}poem
+
+}code
+
+!_ resulting output:
+
+poem{
+
+ `Fury said to a
+ mouse, That he
+ met in the
+ house,
+ "Let us
+ both go to
+ law: I will
+ prosecute
+ YOU. --Come,
+ I'll take no
+ denial; We
+ must have a
+ trial: For
+ really this
+ morning I've
+ nothing
+ to do."
+ Said the
+ mouse to the
+ cur, "Such
+ a trial,
+ dear Sir,
+ With
+ no jury
+ or judge,
+ would be
+ wasting
+ our
+ breath."
+ "I'll be
+ judge, I'll
+ be jury,"
+ Said
+ cunning
+ old Fury:
+ "I'll
+ try the
+ whole
+ cause,
+ and
+ condemn
+ you
+ to
+ death."'
+
+}poem
+
+3~ Group
+
+!_ basic markup:
+
+code{
+
+group{
+
+ Your grouped text here
+
+}group
+
+A group is treated as an object and given a single object number.
+
+}code
+
+!_ markup example:
+
+code{
+
+group{
+
+ `Fury said to a
+ mouse, That he
+ met in the
+ house,
+ "Let us
+ both go to
+ law: I will
+ prosecute
+ YOU. --Come,
+ I'll take no
+ denial; We
+ must have a
+ trial: For
+ really this
+ morning I've
+ nothing
+ to do."
+ Said the
+ mouse to the
+ cur, "Such
+ a trial,
+ dear Sir,
+ With
+ no jury
+ or judge,
+ would be
+ wasting
+ our
+ breath."
+ "I'll be
+ judge, I'll
+ be jury,"
+ Said
+ cunning
+ old Fury:
+ "I'll
+ try the
+ whole
+ cause,
+ and
+ condemn
+ you
+ to
+ death."'
+
+}group
+
+}code
+
+!_ resulting output:
+
+group{
+
+ `Fury said to a
+ mouse, That he
+ met in the
+ house,
+ "Let us
+ both go to
+ law: I will
+ prosecute
+ YOU. --Come,
+ I'll take no
+ denial; We
+ must have a
+ trial: For
+ really this
+ morning I've
+ nothing
+ to do."
+ Said the
+ mouse to the
+ cur, "Such
+ a trial,
+ dear Sir,
+ With
+ no jury
+ or judge,
+ would be
+ wasting
+ our
+ breath."
+ "I'll be
+ judge, I'll
+ be jury,"
+ Said
+ cunning
+ old Fury:
+ "I'll
+ try the
+ whole
+ cause,
+ and
+ condemn
+ you
+ to
+ death."'
+
+}group
+
+3~ Code
+
+Code tags #{ code{ ... }code }# (used as with other group tags described above) are used to escape regular sisu markup, and have been used extensively within this document to provide examples of SiSU markup. You cannot however use code tags to escape code tags. They are however used in the same way as group or poem tags.
+
+A code-block is treated as an object and given a single object number. [an option to number each line of code may be considered at some later time]
+
+!_ use of code tags instead of poem compared, resulting output:
+
+code{
+
+ `Fury said to a
+ mouse, That he
+ met in the
+ house,
+ "Let us
+ both go to
+ law: I will
+ prosecute
+ YOU. --Come,
+ I'll take no
+ denial; We
+ must have a
+ trial: For
+ really this
+ morning I've
+ nothing
+ to do."
+ Said the
+ mouse to the
+ cur, "Such
+ a trial,
+ dear Sir,
+ With
+ no jury
+ or judge,
+ would be
+ wasting
+ our
+ breath."
+ "I'll be
+ judge, I'll
+ be jury,"
+ Said
+ cunning
+ old Fury:
+ "I'll
+ try the
+ whole
+ cause,
+ and
+ condemn
+ you
+ to
+ death."'
+
+}code
+
+From SiSU 2.7.7 on you can number codeblocks by placing a hash after the opening code tag #{ code{# }# as demonstrated here:
+
+code{#
+
+ `Fury said to a
+ mouse, That he
+ met in the
+ house,
+ "Let us
+ both go to
+ law: I will
+ prosecute
+ YOU. --Come,
+ I'll take no
+ denial; We
+ must have a
+ trial: For
+ really this
+ morning I've
+ nothing
+ to do."
+ Said the
+ mouse to the
+ cur, "Such
+ a trial,
+ dear Sir,
+ With
+ no jury
+ or judge,
+ would be
+ wasting
+ our
+ breath."
+ "I'll be
+ judge, I'll
+ be jury,"
+ Said
+ cunning
+ old Fury:
+ "I'll
+ try the
+ whole
+ cause,
+ and
+ condemn
+ you
+ to
+ death."'
+
+}code
+
+2~ Additional breaks - linebreaks within objects, column and page-breaks
+
+3~ line-breaks
+
+To break a line within a "paragraph object", two backslashes \\\\ \\ with a space before and a space or newline after them \\ may be used.
+
+code{
+
+To break a line within a "paragraph object",
+two backslashes \\ with a space before
+and a space or newline after them \\
+may be used.
+
+}code
+
+The html break br enclosed in angle brackets (though undocumented) is available in versions prior to 3.0.13 and 2.9.7 (it remains available for the time being, but is depreciated).
+
+3~ page breaks
+
+Page breaks are only relevant and honored in some output formats. A page break or a new page may be inserted manually using the following markup on a line on its own:
+
+page new =\\= or <:pn> breaks the page, starts a new page.
+
+page break -\\- or <:pb> breaks a column, starts a new column, if using columns, else breaks the page, starts a new page.
+
+code{
+
+-\\-
+
+or
+
+<:pb>
+
+}code
+
+or
+
+code{
+
+=\\=
+
+or
+
+<:pn>
+
+}code
+
+2~ Book index
+
+To make an index append to paragraph the book index term relates to it, using an equal sign and curly braces.
+
+Currently two levels are provided, a main term and if needed a sub-term. Sub-terms are separated from the main term by a colon.
+
+code{
+
+ Paragraph containing main term and sub-term.
+ ={Main term:sub-term}
+
+}code
+
+The index syntax starts on a new line, but there should not be an empty line between paragraph and index markup.
+
+The structure of the resulting index would be:
+
+code{
+
+ Main term, 1
+ sub-term, 1
+
+}code
+
+Several terms may relate to a paragraph, they are separated by a semicolon. If the term refers to more than one paragraph, indicate the number of paragraphs.
+
+code{
+
+ Paragraph containing main term, second term and sub-term.
+ ={first term; second term: sub-term}
+
+}code
+
+The structure of the resulting index would be:
+
+code{
+
+ First term, 1,
+ Second term, 1,
+ sub-term, 1
+
+}code
+
+If multiple sub-terms appear under one paragraph, they are separated under the main term heading from each other by a pipe symbol.
+
+code{
+
+ Paragraph containing main term, second term and sub-term.
+ ={Main term:sub-term+1|second sub-term}
+
+ A paragraph that continues discussion of the first sub-term
+
+}code
+
+The plus one in the example provided indicates the first sub-term spans one additional paragraph. The logical structure of the resulting index would be:
+
+code{
+
+ Main term, 1,
+ sub-term, 1-3,
+ second sub-term, 1,
+
+}code
+
+1~ Composite documents markup
+
+It is possible to build a document by creating a master document that requires other documents. The documents required may be complete documents that could be generated independently, or they could be markup snippets, prepared so as to be easily available to be placed within another text. If the calling document is a master document (built from other documents), it should be named with the suffix *{.ssm}* Within this document you would provide information on the other documents that should be included within the text. These may be other documents that would be processed in a regular way, or markup bits prepared only for inclusion within a master document *{.sst}* regular markup file, or *{.ssi}* (insert/information) A secondary file of the composite document is built prior to processing with the same prefix and the suffix *{._sst}*
+
+basic markup for importing a document into a master document
+
+code{
+
+<< filename1.sst
+
+<< filename2.ssi
+
+}code
+
+The form described above should be relied on. Within the Vim editor it results in the text thus linked becoming hyperlinked to the document it is calling in which is convenient for editing.
diff --git a/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_markup_syntax_history.sst b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_markup_syntax_history.sst
new file mode 100644
index 00000000..a5b56f1f
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_markup_syntax_history.sst
@@ -0,0 +1,260 @@
+% SiSU 4.0
+
+@title: SiSU
+ :subtitle: Markup
+
+@creator:
+ :author: Amissah, Ralph
+
+@date:
+ :created: 2002-08-28
+ :issued: 2002-08-28
+ :available: 2002-08-28
+ :published: 2008-05-22
+ :modified: 2012-10-03
+
+@rights:
+ :copyright: Copyright (C) Ralph Amissah 2007
+ :license: GPL 3 (part of SiSU documentation)
+
+@classify:
+ :topic_register: electronic documents:SiSU:document:markup;SiSU:document:markup;SiSU:document:markup;SiSU:manual:markup;electronic documents:SiSU:manual:markup
+ :subject: ebook, epublishing, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, search
+
+:A~? @title @creator
+
+:B~? SiSU Markup Syntax History
+
+1~ Composite documents markup
+
+It is possible to build a document by creating a master document that requires other documents. The documents required may be complete documents that could be generated independently, or they could be markup snippets, prepared so as to be easily available to be placed within another text. If the calling document is a master document (built from other documents), it should be named with the suffix *{.ssm}* Within this document you would provide information on the other documents that should be included within the text. These may be other documents that would be processed in a regular way, or markup bits prepared only for inclusion within a master document *{.sst}* regular markup file, or *{.ssi}* (insert/information) A secondary file of the composite document is built prior to processing with the same prefix and the suffix *{._sst}*
+
+basic markup for importing a document into a master document
+
+code{
+
+<< filename1.sst
+
+<< filename2.ssi
+
+}code
+
+The form described above should be relied on. Within the Vim editor it results in the text thus linked becoming hyperlinked to the document it is calling in which is convenient for editing.
+
+1~syntax_history Markup Syntax History
+
+2~ Notes related to Files-types and Markup Syntax
+
+4.0 introduced additional headers and drops the use of skins replacing them with additions to the @make: header, and having a common _sisu/sisu_document_make file that uses @make: header syntax to provide a default @make: (it will parse 2.0 but igore skins, markup is otherwise the same as version 2.0 with version 3.0's minor additions)
+
+3.0 very minor additions to markup added, substantially the same as version 2.0
+
+2.0 introduced new headers and is therefore incompatible with 1.0 though otherwise the same with the addition of a couple of tags (i.e. a superset)
+
+0.38 is substantially current for version 1.0
+
+depreciated 0.16 supported, though file names were changed at 0.37
+
+_* sisu --query=[sisu version [0.38] or 'history]
+
+provides a short history of changes to SiSU markup
+
+!_ SiSU 2.0
+(2010-03-06:09/6)
+same as 1.0, apart from the changing of headers and the addition of a monospace tag related headers now grouped, e.g.
+
+code{
+
+@title:
+ :subtitle:
+
+@creator:
+ :author:
+ :translator:
+ :illustrator:
+
+@rights:
+ :text:
+ :illustrations:
+
+}code
+
+see document markup samples, and sisu --help headers
+
+the monospace tag takes the form of a hash '#'
+
+code{
+
+#{ this enclosed text would be monospaced }#
+
+}code
+
+!_ 1.0
+(2009-12-19:50/6)
+same as 0.69
+
+!_ 0.69
+(2008-09-16:37/2)
+(same as 1.0) and as previous (0.57) with the addition of book index tags
+
+code{
+
+/^={.+?}$/
+
+}code
+
+e.g. appended to a paragraph, on a new-line (without a blank line in between) logical structure produced assuming this is the first text "object"
+
+code{
+
+ ={GNU/Linux community distribution:Debian+2|Fedora|Gentoo;Free Software Foundation+5}
+
+}code
+
+code{
+
+Free Software Foundation, 1-6
+GNU/Linux community distribution, 1
+ Debian, 1-3
+ Fedora, 1
+ Gentoo,
+
+}code
+
+!_ 0.66
+(2008-02-24:07/7)
+same as previous, adds semantic tags, [experimental and not-used]
+
+code{
+
+/[:;]{.+?}[:;][a-z+]/
+
+}code
+
+!_ 0.57
+(2007w34/4)
+SiSU 0.57 is the same as 0.42 with the introduction of some a shortcut to use the headers @title and @creator in the first heading [expanded using the contents of the headers @title: and @author:]
+
+code{
+
+:A~ @title by @author
+
+}code
+
+!_ 0.52
+(2007w14/6)
+declared document type identifier at start of text/document:
+
+_1 SiSU 0.52
+
+or, backward compatible using the comment marker:
+
+_1 % SiSU 0.38
+
+variations include 'SiSU (text|master|insert) [version]' and 'sisu-[version]'
+
+!_ 0.51
+(2007w13/6)
+skins changed (simplified), markup unchanged
+
+!_ 0.42
+(2006w27/4)
+* (asterisk) type endnotes, used e.g. in relation to author
+
+SiSU 0.42 is the same as 0.38 with the introduction of some additional endnote types,
+
+Introduces some variations on endnotes, in particular the use of the asterisk
+
+code{
+
+~{* for example for describing an author }~ and ~{** for describing a second author }~
+
+}code
+
+* for example for describing an author
+
+** for describing a second author
+
+and
+
+code{
+
+~[* my note ]~ or ~[+ another note ]~
+
+}code
+
+which numerically increments an asterisk and plus respectively
+
+*1 my note
++1 another note
+
+!_ 0.38
+(2006w15/7)
+introduced new/alternative notation for headers, e.g. @title: (instead of 0\~title), and accompanying document structure markup, :A,:B,:C,1,2,3 (maps to previous 1,2,3,4,5,6)
+
+SiSU 0.38 introduced alternative experimental header and heading/structure markers,
+
+code{
+
+@headername: and headers :A~ :B~ :C~ 1~ 2~ 3~
+
+}code
+
+as the equivalent of:
+
+code{
+
+0~headername and headers 1~ 2~ 3~ 4~ 5~ 6~
+
+}code
+
+The internal document markup of SiSU 0.16 remains valid and standard Though note that SiSU 0.37 introduced a new file naming convention
+
+SiSU has in effect two sets of levels to be considered, using 0.38 notation A-C headings/levels, pre-ordinary paragraphs /pre-substantive text, and 1-3 headings/levels, levels which are followed by ordinary text. This may be conceptualised as levels A,B,C, 1,2,3, and using such letter number notation, in effect: A must exist, optional B and C may follow in sequence (not strict) 1 must exist, optional 2 and 3 may follow in sequence i.e. there are two independent heading level sequences A,B,C and 1,2,3 (using the 0.16 standard notation 1,2,3 and 4,5,6) on the positive side: the 0.38 A,B,C,1,2,3 alternative makes explicit an aspect of structuring documents in SiSU that is not otherwise obvious to the newcomer (though it appears more complicated, is more in your face and likely to be understood fairly quickly); the substantive text follows levels 1,2,3 and it is 'nice' to do most work in those levels
+
+!_ 0.37
+(2006w09/7)
+introduced new file naming convention, .sst (text), .ssm (master), .ssi (insert), markup syntax unchanged
+
+SiSU 0.37 introduced new file naming convention, using the file extensions .sst .ssm and .ssi to replace .s1 .s2 .s3 .r1 .r2 .r3 and .si
+
+this is captured by the following file 'rename' instruction:
+
+code{
+
+rename 's/\.s[123]$/\.sst/' *.s{1,2,3}
+rename 's/\.r[123]$/\.ssm/' *.r{1,2,3}
+rename 's/\.si$/\.ssi/' *.si
+
+}code
+
+The internal document markup remains unchanged, from SiSU 0.16
+
+!_ 0.35
+(2005w52/3)
+sisupod, zipped content file introduced
+
+!_ 0.23
+(2005w36/2)
+utf-8 for markup file
+
+!_ 0.22
+(2005w35/3)
+image dimensions may be omitted if rmagick is available to be relied upon
+
+!_ 0.20.4
+(2005w33/4)
+header 0~links
+
+!_ 0.16
+(2005w25/2)
+substantial changes introduced to make markup cleaner, header 0\~title type, and headings [1-6]\~ introduced, also percentage sign (%) at start of a text line as comment marker
+
+SiSU 0.16 (0.15 development branch) introduced the use of
+
+the header 0~ and headings/structure 1~ 2~ 3~ 4~ 5~ 6~
+
+in place of the 0.1 header, heading/structure notation
+
+SiSU 0.1 headers and headings structure represented by
+header 0{~ and headings/structure 1{ 2{ 3{ 4{~ 5{ 6{
diff --git a/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_output_overview.sst b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_output_overview.sst
new file mode 100644
index 00000000..332f4aae
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_output_overview.sst
@@ -0,0 +1,142 @@
+% SiSU 4.0
+
+@title: SiSU
+ :subtitle: SiSU overview of status of features available in various outputs
+
+@creator:
+ :author: Amissah, Ralph
+
+@date:
+ :published: 2007-09-16
+ :created: 2005-10-31
+ :available: 2006-10-31
+ :issued: 2006-10-31
+ :modified: 2012-10-03
+
+@rights:
+ :copyright: Copyright (C) Ralph Amissah 2007
+ :license: GPL 3 (part of SiSU documentation)
+
+@classify:
+ :topic_register: electronic documents:SiSU:document:markup table;SiSU:manual:output overview;electronic documents:SiSU:manual:output overview;SiSU:document:output overview;SiSU:document:output overview
+ :subject: ebook, epublishing, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, search
+
+:A~? @title @creator
+
+:B~? SiSU overview of status of features available in various outputs
+
+1~ A Checklist of Output Features
+
+% 2~ features available in various output types
+
+This table gives an indication of the features that are available
+for various forms of output of SiSU.
+
+!_ sisu-2.0.0 on 2010-03-06
+
+{table~h 28}
+feature |txt|ltx/pdf|HTML|EPUB|XML/s|XML/d|ODF|SQLite|pgSQL
+headings | * | * | * | * | * | * | * | * | *
+footnotes | * | * | * | * | * | * | * | * | *
+bold, underscore, italics | . | * | * | * | * | * | * | * | *
+strikethrough | . | * | * | * | * | * | * | |
+superscript, subscript | . | * | * | * | * | * | * | |
+extended ascii set (utf-8)| * | * | * | * | * | * | * | | *
+indents | * | * | * | * | * | * | * | |
+bullets | . | * | * | * | * | * | . | |
+groups | | | | | | | | |
+* tables | | * | * | * | . | . | . | . | .
+* poem | * | * | * | * | . | . | * | . | .
+* code | * | * | * | * | . | . | * | . | .
+url | * | * | * | * | * | * | * | . | .
+links | * | * | * | * | * | * | * | . | .
+images | - | * | * | * | T | T | * | T | T
+image caption | - | * | * | * | | | | |
+table of contents | | * | * | * | * | * | . | |
+page header/footer? | - | * | * | * | * | * | t | |
+line break | * | * | * | * | * | * | * | |
+page break | | * | | | | | * | |
+segments | | | * | * | | | | |
+skins | * | * | * | * | * | * | | |
+ocn | . | * | * | * | * | * | -?| * | *
+auto-heading numbers | * | * | * | * | * | * | * | * | *
+minor list numbering | * | * | * | * | * | * | * | * | *
+special characters | . | . | . | . | | | | |
+
+!_ sisu-1.0.0 on 2009-10-28
+
+{table~h 28}
+feature |txt|ltx/pdf|HTML|XML/s|XML/d|ODF|SQLite|pgSQL
+headings | * | * | * | * | * | * | * | *
+footnotes | * | * | * | * | * | * | * | *
+bold, underscore, italics | . | * | * | * | * | * | * | *
+strikethrough | . | * | * | * | * | * | |
+superscript, subscript | . | * | * | * | * | * | |
+extended ascii set (utf-8)| * | * | * | * | * | * | | *
+indents | * | * | * | * | * | * | |
+bullets | . | * | * | * | * | . | |
+groups | | | | | | | |
+* tables | | * | * | . | . | . | . | .
+* poem | * | * | * | . | . | * | . | .
+* code | * | * | * | . | . | * | . | .
+url | * | * | * | * | * | * | . | .
+links | * | * | * | * | * | * | . | .
+images | - | * | * | T | T | * | T | T
+image caption | - | * | * | | | | |
+table of contents | | * | * | * | * | . | |
+page header/footer? | - | * | * | * | * | t | |
+line break | * | * | * | * | * | * | |
+page break | | * | | | | * | |
+segments | | | * | | | | |
+skins | * | * | * | * | * | | |
+ocn | . | * | * | * | * | -?| * | *
+auto-heading numbers | * | * | * | * | * | * | * | *
+minor list numbering | * | * | * | * | * | * | * | *
+special characters | . | . | . | | | | |
+
+!_ sisu-0.36.6 on 2006-01-23
+
+{table~h 28; 8; 8; 8; 8; 8; 8; 8; 8; 8;}
+feature |txt|ltx/pdf|HTML|XHTML|XML/s|XML/d|ODF|SQLite|pgSQL
+headings | * | * | * | * | * | * | * | * | *
+footnotes | * | * | * | * | * | * | * | * | *
+bold, underscore, italics | . | * | * | * | * | * | * | * | *
+strikethrough | . | * | * | * | * | * | * | |
+superscript, subscript | . | * | * | * | * | * | * | |
+extended ascii set (utf-8)| * | * | * | * | * | * | * | | *
+indents | * | * | * | * | * | * | * | |
+bullets | . | * | * | * | * | * | . | |
+groups | | | | | | | | |
+* tables | | * | * | . | . | . | . | . | .
+* poem | * | * | * | . | . | . | * | . | .
+* code | * | * | * | . | . | . | * | . | .
+url | * | * | * | * | * | * | * | . | .
+links | * | * | * | * | * | * | * | . | .
+images | - | * | * | T | T | T | * | T | T
+image caption | - | * | * | | | | | |
+table of contents | | * | * | * | * | * | . | |
+page header/footer? | - | * | * | * | * | * | t | |
+line break | * | * | * | * | * | * | * | |
+page break | | * | | | | | * | |
+segments | | | * | | | | | |
+skins | * | * | * | * | * | * | | |
+ocn | . | * | * | * | * | * | -?| * | *
+auto-heading numbers | * | * | * | * | * | * | * | * | *
+minor list numbering | * | * | * | * | * | * | * | * | *
+special characters | . | . | . | | | | | |
+
+group{
+
+ Done
+ * yes/done
+ . partial
+
+ - not available/appropriate
+
+ Not Done
+ T task todo
+ t lesser task/todo
+ not done
+
+}group
+
diff --git a/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_postgresql.sst b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_postgresql.sst
new file mode 100644
index 00000000..574e307c
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_postgresql.sst
@@ -0,0 +1,82 @@
+% SiSU 4.0
+
+@title: SiSU
+ :subtitle: Search
+
+@creator:
+ :author: Amissah, Ralph
+
+@date:
+ :published: 2007-09-16
+ :created: 2002-08-28
+ :issued: 2002-08-28
+ :available: 2002-08-28
+ :modified: 2012-10-03
+
+@rights:
+ :copyright: Copyright (C) Ralph Amissah 2007
+ :license: GPL 3 (part of SiSU documentation)
+
+@classify:
+ :topic_register: electronic documents:SiSU:document:postgresql;SiSU:manual:postgresql;electronic documents:SiSU:manual:postgresql;SiSU:document:postgresql;SiSU:document:postgresql;
+ :subject: ebook, epublishing, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, search
+
+@make:
+ :manpage: section=7; name=sisu - package to install what sisu needs to to populate a postgresql database (postgresql dependency component); synopsis=sisu -Dv [filename/wildcard ]\n sisu -Dv [instruction]
+
+:A~? @title @creator
+
+% :B~? SiSU Postgresql
+
+1~postgresql Postgresql
+
+2~ Name
+
+SiSU - Structured information, Serialized Units - a document publishing system, postgresql dependency package
+
+2~ Description
+
+Information related to using postgresql with sisu (and related to the sisu_postgresql dependency package, which is a dummy package to install dependencies needed for SiSU to populate a postgresql database, this being part of SiSU - man sisu).
+
+2~ Synopsis
+
+_1 sisu -D [instruction] [filename/wildcard if required]
+
+_1 sisu -D --pg --[instruction] [filename/wildcard if required]
+
+
+2~ Commands
+
+Mappings to two databases are provided by default, postgresql and sqlite, the same commands are used within sisu to construct and populate databases however -d (lowercase) denotes sqlite and -D (uppercase) denotes postgresql, alternatively --sqlite or --pgsql may be used
+
+!_ -D or --pgsql
+may be used interchangeably.
+
+3~ create and destroy database
+
+!_ --pgsql --createall<br>
+initial step, creates required relations (tables, indexes) in existing (postgresql) database (a database should be created manually and given the same name as working directory, as requested) (rb.dbi)
+
+!_ sisu -D --createdb<br>
+creates database where no database existed before
+
+!_ sisu -D --create<br>
+creates database tables where no database tables existed before
+
+!_ sisu -D --Dropall<br>
+destroys database (including all its content)! kills data and drops tables, indexes and database associated with a given directory (and directories of the same name).
+
+!_ sisu -D --recreate<br>
+destroys existing database and builds a new empty database structure
+
+3~ import and remove documents
+
+!_ sisu -D --import -v [filename/wildcard]<br>
+populates database with the contents of the file. Imports documents(s) specified to a postgresql database (at an object level).
+
+!_ sisu -D --update -v [filename/wildcard]<br>
+updates file contents in database
+
+!_ sisu -D --remove -v [filename/wildcard]<br>
+removes specified document from postgresql database.
+
diff --git a/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_quickstart.sst b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_quickstart.sst
new file mode 100644
index 00000000..ae95f528
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_quickstart.sst
@@ -0,0 +1,256 @@
+% SiSU 4.0
+
+@title: SiSU
+ :subtitle: Quickstart, installation and use
+
+@creator:
+ :author: Amissah, Ralph
+
+@date:
+ :created: 2006-09-06
+ :available: 2006-09-06
+ :issued: 2006-09-06
+ :published: 2007-09-16
+ :modified: 2012-10-03
+
+@rights:
+ :copyright: Copyright (C) Ralph Amissah 2007
+ :license: GPL 3 (part of SiSU documentation)
+
+@classify:
+ :topic_register: electronic documents:SiSU:document:quickstart;SiSU:manual:quickstart;electronic documents:SiSU:manual:quickstart;SiSU:document:quickstart;SiSU:document:quickstart
+ :subject: ebook, epublishing, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, search
+
+:A~? @title @creator
+
+:B~? Quickstart - SiSU installation and use
+
+1~ Quickstart - Getting Started Howto
+
+2~ Installation
+
+Installation is currently most straightforward and tested on the Debian platform, as there are packages for the installation of sisu and all requirements for what it does.
+
+3~ Debian Installation
+
+SiSU is available directly from the Debian Sid and testing archives (and possibly Ubuntu), assuming your /etc/apt/sources.list is set accordingly:
+
+code{
+
+ aptitude update
+ aptitude install sisu-complete
+
+}code
+
+The following /etc/apt/sources.list setting permits the download of additional markup samples:
+
+code{
+
+#/etc/apt/sources.list
+
+ deb http://ftp.fi.debian.org/debian/ unstable main non-free contrib
+ deb-src http://ftp.fi.debian.org/debian/ unstable main non-free contrib
+
+}code
+
+The aptitude commands become:
+
+code{
+
+ aptitude update
+ aptitude install sisu-complete sisu-markup-samples
+
+}code
+
+If there are newer versions of SiSU upstream of the Debian archives, they will be available by adding the following to your /etc/apt/sources.list
+
+code{
+
+#/etc/apt/sources.list
+
+ deb http://www.jus.uio.no/sisu/archive unstable main non-free
+ deb-src http://www.jus.uio.no/sisu/archive unstable main non-free
+
+}code
+
+repeat the aptitude commands
+
+code{
+
+ aptitude update
+ aptitude install sisu-complete sisu-markup-samples
+
+}code
+
+Note however that it is not necessary to install sisu-complete if not all components of sisu are to be used. Installing just the package sisu will provide basic functionality.
+
+3~ RPM Installation
+
+RPMs are provided though untested, they are prepared by running alien against the source package, and against the debs.
+
+They may be downloaded from:
+
+_1 http://www.jus.uio.no/sisu/SiSU/download.html#rpm
+
+as root type:
+
+_1 rpm -i [rpm package name]
+
+3~ Installation from source
+
+To install SiSU from source check information at:
+
+_1 http://www.jus.uio.no/sisu/SiSU/download.html#current
+
+_* download the source package
+
+_* Unpack the source
+
+Two alternative modes of installation from source are provided, setup.rb (by Minero Aoki) and a rant(by Stefan Lang) built install file, in either case: the first steps are the same, download and unpack the source file:
+
+For basic use SiSU is only dependent on the programming language in which it is written Ruby, and SiSU will be able to generate html, EPUB, various XMLs, including ODF (and will also produce LaTeX). Dependencies required for further actions, though it relies on the installation of additional dependencies which the source tarball does not take care of, for things like using a database (postgresql or sqlite)~{ There is nothing to stop MySQL support being added in future. }~ or converting LaTeX to pdf.
+
+!_ setup.rb
+
+This is a standard ruby installer, using setup.rb is a three step process. In the root directory of the unpacked SiSU as root type:
+
+code{
+
+ ruby setup.rb config
+ ruby setup.rb setup
+ #[and as root:]
+ ruby setup.rb install
+
+}code
+
+further information on setup.rb is available from:
+
+_1 http://i.loveruby.net/en/projects/setup/
+
+_1 http://i.loveruby.net/en/projects/setup/doc/usage.html
+
+!_ "install"
+
+The "install" file provided is an installer prepared using "rant". In the root directory of the unpacked SiSU as root type:
+
+_1 ruby install base
+
+or for a more complete installation:
+
+_1 ruby install
+
+or
+
+_1 ruby install base
+
+This makes use of Rant (by Stefan Lang) and the provided Rantfile. It has been configured to do post installation setup setup configuration and generation of first test file. Note however, that additional external package dependencies, such as tetex-extra are not taken care of for you.
+
+Further information on "rant" is available from:
+
+_1 http://make.rubyforge.org/
+
+_1 http://rubyforge.org/frs/?group_id=615
+
+For a list of alternative actions you may type:
+
+_1 ruby install help
+
+_1 ruby install -T
+
+2~ Testing SiSU, generating output
+
+To check which version of sisu is installed:
+
+sisu -v
+
+Depending on your mode of installation one or a number of markup sample files may be found either in the directory:
+
+...
+
+or
+
+...
+
+change directory to the appropriate one:
+
+cd /usr/share/doc/sisu/markup-samples/samples
+
+3~ basic text, plaintext, html, XML, ODF, EPUB
+
+Having moved to the directory that contains the markup samples (see instructions above if necessary), choose a file and run sisu against it
+
+sisu -NhwoabxXyv free_as_in_freedom.rms_and_free_software.sam_williams.sst
+
+this will generate html including a concordance file, opendocument text format, plaintext, XHTML and various forms of XML, and OpenDocument text
+
+3~ LaTeX / pdf
+
+Assuming a LaTeX engine such as tetex or texlive is installed with the required modules (done automatically on selection of sisu-pdf in Debian)
+
+Having moved to the directory that contains the markup samples (see instructions above if necessary), choose a file and run sisu against it
+
+sisu -pv free_as_in_freedom.rms_and_free_software.sam_williams.sst
+
+sisu -3 free_as_in_freedom.rms_and_free_software.sam_williams.sst
+
+should generate most available output formats: html including a concordance file, opendocument text format, plaintext, XHTML and various forms of XML, and OpenDocument text and pdf
+
+3~ relational database - postgresql, sqlite
+
+Relational databases need some setting up - you must have permission to create the database and write to it when you run sisu.
+
+Assuming you have the database installed and the requisite permissions
+
+sisu --sqlite --recreate
+
+sisu --sqlite -v --import free_as_in_freedom.rms_and_free_software.sam_williams.sst
+
+sisu --pgsql --recreate
+
+sisu --pgsql -v --import free_as_in_freedom.rms_and_free_software.sam_williams.sst
+
+2~ Getting Help
+
+3~ The man pages
+
+Type:
+
+_1 man sisu
+
+The man pages are also available online, though not always kept as up to date as within the package itself:
+
+_* {~^ sisu.1 }http://www.jus.uio.no/sisu/man/sisu.1.html
+
+_* {~^ sisu.8 }http://www.jus.uio.no/sisu/man/sisu.8.html
+
+_* {~^ man directory }http://www.jus.uio.no/sisu/man
+
+3~ Built in help
+
+sisu --help
+
+sisu --help --env
+
+sisu --help --commands
+
+sisu --help --markup
+
+3~ The home page
+
+http://www.sisudoc.org/
+
+http://www.jus.uio.no/sisu
+
+http://www.jus.uio.no/sisu/SiSU
+
+2~ Markup Samples
+
+A number of markup samples (along with output) are available off:
+
+http://www.jus.uio.no/sisu/SiSU/examples.html
+
+Additional markup samples are packaged separately in the file:
+
+***
+
+On Debian they are available in non-free~{ the Debian Free Software guidelines require that everything distributed within Debian can be changed - and the documents are authors' works that while freely distributable are not freely changeable. }~ to include them it is necessary to include non-free in your /etc/apt/source.list or obtain them from the sisu home site.
diff --git a/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_remote.sst b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_remote.sst
new file mode 100644
index 00000000..959fbcf6
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_remote.sst
@@ -0,0 +1,88 @@
+% SiSU 4.0
+
+@title: SiSU
+ :subtitle: Remote Operations
+
+@creator:
+ :author: Amissah, Ralph
+
+@date:
+ :published: 2007-09-16
+ :created: 2002-08-28
+ :issued: 2002-08-28
+ :available: 2002-08-28
+ :modified: 2012-10-03
+
+@rights:
+ :copyright: Copyright (C) Ralph Amissah 2007
+ :license: GPL 3 (part of SiSU documentation)
+
+@classify:
+ :topic_register: electronic documents:SiSU:document:remote;SiSU:manual:remote;electronic documents:SiSU:manual:remote;SiSU:document:remote;SiSU:document:remote
+ :subject: ebook, epublishing, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, search
+
+:A~? @title @creator
+
+:B~? SiSU Remote Operations
+
+1~remote_source Remote Source Documents
+
+SiSU processing instructions can be run against remote source documents by providing the url of the documents against which the processing instructions are to be carried out. The remote SiSU documents can either be sisu marked up files in plaintext .sst or .ssm or; zipped sisu files, sisupod.zip or filename.ssp
+
+!_ .sst / .ssm - sisu text files
+
+SiSU can be run against source text files on a remote machine, provide the processing instruction and the url. The source file and any associated parts (such as images) will be downloaded and generated locally.
+
+code{
+
+sisu -3 http://[provide url to valid .sst or .ssm file]
+
+}code
+
+Any of the source documents in the sisu examples page can be used in this way, see http://www.jus.uio.no/sisu/SiSU/examples.html and use the url to the .sst for the desired document.
+
+NOTE: to set up a remote machine to serve SiSU documents in this way, images should be in the directory relative to the document source ../_sisu/image
+
+!_ sisupod - zipped sisu files
+
+A sisupod is the zipped content of a sisu marked up text or texts and any other associated parts to the document such as images.
+
+SiSU can be run against a sisupod on a (local or) remote machine, provide the processing instruction and the url, the sisupod will be downloaded and the documents it contains generated locally.
+
+code{
+
+sisu -3 http://[provide url to valid sisupod.zip or .ssp file]
+
+}code
+
+Any of the source documents in the sisu examples page can be used in this way, see http://www.jus.uio.no/sisu/SiSU/examples.html and use the url for the desired document.
+
+:C~ Remote Document Output
+
+1~remote_output Remote Output
+
+Once properly configured SiSU output can be automatically posted once generated to a designated remote machine using either rsync, or scp.
+
+In order to do this some ssh authentication agent and keychain or similar tool will need to be configured. Once that is done the placement on a remote host can be done seamlessly with the -r (for scp) or -R (for rsync) flag, which may be used in conjunction with other processing flags, e.g.
+
+code{
+
+sisu -3R sisu_remote.sst
+
+}code
+
+2~ commands
+
+!_ -R [filename/wildcard] <br>
+copies sisu output files to remote host using rsync. This requires that sisurc.yml has been provided with information on hostname and username, and that you have your "keys" and ssh agent in place. Note the behavior of rsync different if -R is used with other flags from if used alone. Alone the rsync --delete parameter is sent, useful for cleaning the remote directory (when -R is used together with other flags, it is not). Also see -r
+
+!_ -r [filename/wildcard] <br>
+copies sisu output files to remote host using scp. This requires that sisurc.yml has been provided with information on hostname and username, and that you have your "keys" and ssh agent in place. Also see -R
+
+2~ configuration
+
+[expand on the setting up of an ssh-agent / keychain]
+
+1~remote_servers Remote Servers
+
+As SiSU is generally operated using the command line, and works within a Unix type environment, SiSU the program and all documents can just as easily be on a remote server, to which you are logged on using a terminal, and commands and operations would be pretty much the same as they would be on your local machine.
diff --git a/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_search.ssm b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_search.ssm
new file mode 100644
index 00000000..9c40a8bf
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_search.ssm
@@ -0,0 +1,35 @@
+% SiSU master 4.0
+
+@title: SiSU
+ :subtitle: Search
+
+@creator:
+ :author: Ralph Amissah
+
+@date:
+ :created: 2002-08-28
+ :issued: 2002-08-28
+ :available: 2002-08-28
+ :published: 2007-09-16
+ :modified: 2012-10-03
+
+@rights:
+ :copyright: Copyright (C) Ralph Amissah 2007
+ :license: GPL 3 (part of SiSU documentation)
+
+@classify:
+ :subject: ebook, epublishing, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, search
+
+:A~? @title @creator
+
+:B~? SiSU Search
+
+<< sisu_search_intro.ssi
+
+<< sisu_sql.ssi
+
+<< sisu_postgresql.sst
+
+<< sisu_sqlite.sst
+
+<< sisu_search_cgi.ssi
diff --git a/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_search_cgi.ssi b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_search_cgi.ssi
new file mode 100644
index 00000000..03eef9ff
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_search_cgi.ssi
@@ -0,0 +1,75 @@
+% SiSU insert 2.0
+
+@title: SiSU
+ :subtitle: Search
+
+@creator:
+ :author: Ralph Amissah
+
+@date:
+ :published: 2007-09-16
+ :created: 2002-08-28
+ :issued: 2002-08-28
+ :available: 2002-08-28
+ :modified: 2011-02-07
+
+@rights:
+ :copyright: Copyright (C) Ralph Amissah 2007
+ :license: GPL 3 (part of SiSU documentation)
+
+:A~? @title @creator
+
+:B~? SiSU Search
+
+:C~? CGI Search Form
+
+1~search_cgi Introduction
+
+2~ Search - database frontend sample, utilising database and SiSU features, including object citation numbering (backend currently PostgreSQL) *~search
+
+{~^ Sample search frontend }http://search.sisudoc.org
+A small database and sample query front-end (search from) that makes use of the citation system, _{object citation numbering}_ to demonstrates functionality.~{ (which could be extended further with current back-end). As regards scaling of the database, it is as scalable as the database (here Postgresql) and hardware allow. }~
+
+SiSU can provide information on which documents are matched and at what locations within each document the matches are found. These results are relevant across all outputs using object citation numbering, which includes html, XML, EPUB, LaTeX, PDF and indeed the SQL database. You can then refer to one of the other outputs or in the SQL database expand the text within the matched objects (paragraphs) in the documents matched.
+
+Note you may set results either for documents matched and object number locations within each matched document meeting the search criteria; or display the names of the documents matched along with the objects (paragraphs) that meet the search criteria.~{ of this feature when demonstrated to an IBM software innovations evaluator in 2004 he said to paraphrase: this could be of interest to us. We have large document management systems, you can search hundreds of thousands of documents and we can tell you which documents meet your search criteria, but there is no way we can tell you without opening each document where within each your matches are found. }~
+
+% Several options for output - select database to search, show results in index view (links to locations within text), show results with text, echo search in form, show what was searched, create and show a "canned url" for search, show available search fields. Also shows counters number of documents in which found and number of locations within documents where found. [could consider sorting by document with most occurrences of the search result].
+
+!_ sisu -F --webserv-webrick<br>
+builds a cgi web search frontend for the database created
+
+The following is feedback on the setup on a machine provided by the help command:
+
+_1 sisu --help sql
+
+code{
+
+Postgresql
+ user: ralph
+ current db set: SiSU_sisu
+ port: 5432
+ dbi connect: DBI:Pg:database=SiSU_sisu;port=5432
+
+sqlite
+ current db set: /home/ralph/sisu_www/sisu/sisu_sqlite.db
+ dbi connect DBI:SQLite:/home/ralph/sisu_www/sisu/sisu_sqlite.db
+
+}code
+
+Note on databases built
+
+By default, [unless otherwise specified] databases are built on a directory basis, from collections of documents within that directory. The name of the directory you choose to work from is used as the database name, i.e. if you are working in a directory called /home/ralph/ebook the database SiSU_ebook is used. [otherwise a manual mapping for the collection is necessary]
+
+2~ Search Form
+
+!_ sisu -F<br>
+generates a sample search form, which must be copied to the web-server cgi directory
+
+!_ sisu -F --webserv-webrick<br>
+generates a sample search form for use with the webrick server, which must be copied to the web-server cgi directory
+
+!_ sisu -W<br>
+starts the webrick server which should be available wherever sisu is properly installed
+
+The generated search form must be copied manually to the webserver directory as instructed
diff --git a/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_search_intro.ssi b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_search_intro.ssi
new file mode 100644
index 00000000..d5da379f
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_search_intro.ssi
@@ -0,0 +1,31 @@
+% SiSU insert 2.0
+
+@title: SiSU
+ :subtitle: Search
+
+@creator:
+ :author: Amissah, Ralph
+
+@date:
+ :published: 2007-09-16
+ :created: 2002-08-28
+ :issued: 2002-08-28
+ :available: 2002-08-28
+ :modified: 2011-02-07
+
+@rights:
+ :copyright: Copyright (C) Ralph Amissah 2007
+ :license: GPL 3 (part of SiSU documentation)
+
+:A~? @title @creator
+
+:B~? SiSU Search
+
+1~search_intro SiSU Search - Introduction
+
+SiSU output can easily and conveniently be indexed by a number of standalone indexing tools, such as Lucene, Hyperestraier.
+
+Because the document structure of sites created is clearly defined, and the text object citation system is available hypothetically at least, for all forms of output, it is possible to search the sql database, and either read results from that database, or just as simply map the results to the html output, which has richer text markup.
+
+In addition to this SiSU has the ability to populate a relational sql type database with documents at an object level, with objects numbers that are shared across different output types, which make them searchable with that degree of granularity. Basically, your match criteria is met by these documents and at these locations within each document, which can be viewed within the database directly or in various output formats.
+
diff --git a/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_short_feature_summary.ssi b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_short_feature_summary.ssi
new file mode 100644
index 00000000..294644af
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_short_feature_summary.ssi
@@ -0,0 +1,81 @@
+% SiSU 2.0
+
+@title: SiSU
+ :subtitle: Summary of Features
+
+@creator:
+ :author: Ralph Amissah
+
+@date:
+ :created: 2002-08-28
+ :issued: 2002-08-28
+ :available: 2002-08-28
+ :published: 2007-09-16
+ :modified: 2011-02-07
+
+@rights:
+ :copyright: Copyright (C) Ralph Amissah 2007
+ :license: GPL 3 (part of SiSU documentation)
+
+:A~? @title @creator
+
+:B~? What is SiSU?
+
+:C~? Description
+
+1~sisu_feature_summary Summary of features
+
+_* sparse/minimal markup (clean utf-8 source texts). Documents are prepared in a single UTF-8 file using a minimalistic mnemonic syntax. Typical literature, documents like "War and Peace" require almost no markup, and most of the headers are optional.
+
+_* markup is easily readable/parsable by the human eye, (basic markup is simpler and more sparse than the most basic HTML), [this may also be converted to XML representations of the same input/source document].
+
+_* markup defines document structure (this may be done once in a header pattern-match description, or for heading levels individually); basic text attributes (bold, italics, underscore, strike-through etc.) as required; and semantic information related to the document (header information, extended beyond the Dublin core and easily further extended as required); the headers may also contain processing instructions. SiSU markup is primarily an abstraction of document structure and document metadata to permit taking advantage of the basic strengths of existing alternative practical standard ways of representing documents [be that browser viewing, paper publication, sql search etc.] (html, epub, xml, odf, latex, pdf, sql)
+
+_* for output produces reasonably elegant output of established industry and institutionally accepted open standard formats.[3] takes advantage of the different strengths of various standard formats for representing documents, amongst the output formats currently supported are:
+
+_* HTML - both as a single scrollable text and a segmented document
+
+_* XHTML
+
+_* EPUB
+
+_* XML - both in sax and dom style xml structures for further development as required
+
+_* ODT - Open Document Format text, the iso standard for document storage
+
+_* LaTeX - used to generate pdf
+
+_* PDF (via LaTeX)
+
+_* SQL - population of an sql database (PostgreSQL or SQLite), (at the same object level that is used to cite text within a document)
+
+Also produces: concordance files; document content certificates (md5 or sha256 digests of headings, paragraphs, images etc.) and html manifests (and sitemaps of content). (b) takes advantage of the strengths implicit in these very different output types, (e.g. PDFs produced using typesetting of LaTeX, databases populated with documents at an individual object/paragraph level, making possible granular search (and related possibilities))
+
+_* ensuring content can be cited in a meaningful way regardless of selected output format. Online publishing (and publishing in multiple document formats) lacks a useful way of citing text internally within documents (important to academics generally and to lawyers) as page numbers are meaningless across browsers and formats. sisu seeks to provide a common way of pinpoint the text within a document, (which can be utilized for citation and by search engines). The outputs share a common numbering system that is meaningful (to man and machine) across all digital outputs whether paper, screen, or database oriented, (pdf, HTML, EPUB, xml, sqlite, postgresql), this numbering system can be used to reference content.
+
+_* Granular search within documents. SQL databases are populated at an object level (roughly headings, paragraphs, verse, tables) and become searchable with that degree of granularity, the output information provides the object/paragraph numbers which are relevant across all generated outputs; it is also possible to look at just the matching paragraphs of the documents in the database; [output indexing also work well with search indexing tools like hyperestraier].
+
+_* long term maintainability of document collections in a world of changing formats, having a very sparsely marked-up source document base. there is a considerable degree of future-proofing, output representations are "upgradeable", and new document formats may be added. e.g. addition of odf (open document text) module in 2006, epub in 2009 and in future html5 output sometime in future, without modification of existing prepared texts
+
+_* SQL search aside, documents are generated as required and static once generated.
+
+_* documents produced are static files, and may be batch processed, this needs to be done only once but may be repeated for various reasons as desired (updated content, addition of new output formats, updated technology document presentations/representations)
+
+_* document source (plaintext utf-8) if shared on the net may be used as input and processed locally to produce the different document outputs
+
+_* document source may be bundled together (automatically) with associated documents (multiple language versions or master document with inclusions) and images and sent as a zip file called a sisupod, if shared on the net these too may be processed locally to produce the desired document outputs
+
+_* generated document outputs may automatically be posted to remote sites.
+
+_* for basic document generation, the only software dependency is Ruby, and a few standard Unix tools (this covers plaintext, HTML, EPUB, XML, ODF, LaTeX). To use a database you of course need that, and to convert the LaTeX generated to pdf, a latex processor like tetex or texlive.
+
+_* as a developers tool it is flexible and extensible
+
+Syntax highlighting for SiSU markup is available for a number of text editors.
+
+SiSU is less about document layout than about finding a way with little markup to be able to construct an abstract representation of a document that makes it possible to produce multiple representations of it which may be rather different from each other and used for different purposes, whether layout and publishing, or search of content
+
+i.e. to be able to take advantage from this minimal preparation starting point of some of the strengths of rather different established ways of representing documents for different purposes, whether for search (relational database, or indexed flat files generated for that purpose whether of complete documents, or say of files made up of objects), online viewing (e.g. html, xml, pdf), or paper publication (e.g. pdf)...
+
+the solution arrived at is by extracting structural information about the document (about headings within the document) and by tracking objects (which are serialized and also given hash values) in the manner described. It makes possible representations that are quite different from those offered at present. For example objects could be saved individually and identified by their hashes, with an index of how the objects relate to each other to form a document.
+
diff --git a/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_sql.ssi b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_sql.ssi
new file mode 100644
index 00000000..6e54275b
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_sql.ssi
@@ -0,0 +1,50 @@
+% SiSU insert 2.0
+
+@title: SiSU
+ :subtitle: SQL and Search
+
+@creator:
+ :author: Amissah, Ralph
+
+@date:
+ :created: 2002-08-28
+ :issued: 2002-08-28
+ :available: 2002-08-28
+ :published: 2007-09-16
+ :modified: 2011-02-07
+
+@rights:
+ :copyright: Copyright (C) Ralph Amissah 2007
+ :license: GPL 3 (part of SiSU documentation)
+
+@classify:
+ :subject: ebook, epublishing, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, search
+
+:A~? @title @creator
+
+:B~? SiSU Search
+
+:C~? Search
+
+1~search_sql SQL
+
+2~ populating SQL type databases
+
+SiSU feeds sisu markupd documents into sql type databases PostgreSQL~{ http://www.postgresql.org/ <br> http://advocacy.postgresql.org/ <br> http://en.wikipedia.org/wiki/Postgresql }~ and/or SQLite~{ http://www.hwaci.com/sw/sqlite/ <br> http://en.wikipedia.org/wiki/Sqlite }~ database together with information related to document structure.
+
+This is one of the more interesting output forms, as all the structural data of the documents are retained (though can be ignored by the user of the database should they so choose). All site texts/documents are (currently) streamed to four tables:
+
+_1* one containing semantic (and other) headers, including, title, author, subject, (the Dublin Core...);
+
+_1* another the substantive texts by individual "paragraph" (or object) - along with structural information, each paragraph being identifiable by its paragraph number (if it has one which almost all of them do), and the substantive text of each paragraph quite naturally being searchable (both in formatted and clean text versions for searching); and
+
+_1* a third containing endnotes cross-referenced back to the paragraph from which they are referenced (both in formatted and clean text versions for searching).
+
+_1* a fourth table with a one to one relation with the headers table contains full text versions of output, eg. pdf, html, xml, and ascii.
+
+There is of course the possibility to add further structures.
+
+At this level SiSU loads a relational database with documents chunked into objects, their smallest logical structurally constituent parts, as text objects, with their object citation number and all other structural information needed to construct the document. Text is stored (at this text object level) with and without elementary markup tagging, the stripped version being so as to facilitate ease of searching.
+
+Being able to search a relational database at an object level with the SiSU citation system is an effective way of locating content generated by SiSU. As individual text objects of a document stored (and indexed) together with object numbers, and all versions of the document have the same numbering, complex searches can be tailored to return just the locations of the search results relevant for all available output formats, with live links to the precise locations in the database or in html/xml documents; or, the structural information provided makes it possible to search the full contents of the database and have headings in which search content appears, or to search only headings etc. (as the Dublin Core is incorporated it is easy to make use of that as well).
+
diff --git a/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_sqlite.sst b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_sqlite.sst
new file mode 100644
index 00000000..a73ae16c
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_sqlite.sst
@@ -0,0 +1,82 @@
+% SiSU 4.0
+
+@title: SiSU
+ :subtitle: Sqlite / search
+
+@creator:
+ :author: Amissah, Ralph
+
+@date:
+ :published: 2007-09-16
+ :created: 2002-08-28
+ :issued: 2002-08-28
+ :available: 2002-08-28
+ :modified: 2012-10-03
+
+@rights:
+ :copyright: Copyright (C) Ralph Amissah 2007
+ :license: GPL 3 (part of SiSU documentation)
+
+@classify:
+ :topic_register: electronic documents:SiSU:document:sqlite;SiSU:manual:sqlite;electronic documents:SiSU:manual:sqlite;SiSU:document:sqlite;SiSU:document:sqlite
+ :subject: ebook, epublishing, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, search
+
+@make:
+ :manpage: section=7; name=sisu - package to install what sisu needs to to populate a postgresql database (postgresql dependency component); synopsis=sisu -dv [filename/wildcard ]\n sisu -dv [instruction]
+
+:A~? @title @creator
+
+% :B~? SiSU Sqlite
+
+1~sqlite Sqlite
+
+2~ Name
+
+SiSU - Structured information, Serialized Units - a document publishing system.
+
+
+2~ Description
+
+Information related to using sqlite with sisu (and related to the sisu_sqlite dependency package, which is a dummy package to install dependencies needed for SiSU to populate an sqlite database, this being part of SiSU - man sisu).
+
+2~ Synopsis
+
+_1 sisu -d [instruction] [filename/wildcard if required]
+
+_1 sisu -d --(sqlite|pg) --[instruction] [filename/wildcard if required]
+
+
+2~ Commands
+
+Mappings to two databases are provided by default, postgresql and sqlite, the same commands are used within sisu to construct and populate databases however -d (lowercase) denotes sqlite and -D (uppercase) denotes postgresql, alternatively --sqlite or --pgsql may be used
+
+!_ -d or --sqlite
+may be used interchangeably.
+
+3~ create and destroy database
+
+!_ --sqlite --createall<br>
+initial step, creates required relations (tables, indexes) in existing (sqlite) database (a database should be created manually and given the same name as working directory, as requested) (rb.dbi)
+
+!_ sisu -d --createdb<br>
+creates database where no database existed before
+
+!_ sisu -d --create<br>
+creates database tables where no database tables existed before
+
+!_ sisu -d --dropall<br>
+destroys database (including all its content)! kills data and drops tables, indexes and database associated with a given directory (and directories of the same name).
+
+!_ sisu -d --recreate<br>
+destroys existing database and builds a new empty database structure
+
+3~ import and remove documents
+
+!_ sisu -d --import -v [filename/wildcard]<br>
+populates database with the contents of the file. Imports documents(s) specified to an sqlite database (at an object level).
+
+!_ sisu -d --update -v [filename/wildcard]<br>
+updates file contents in database
+
+!_ sisu -d --remove -v [filename/wildcard]<br>
+removes specified document from sqlite database.
diff --git a/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_synopsis.ssi b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_synopsis.ssi
new file mode 100644
index 00000000..98e5d4f3
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_synopsis.ssi
@@ -0,0 +1,48 @@
+% SiSU 4.0
+
+@title: SiSU
+ :subtitle: Commands
+
+@creator:
+ :author: Amissah, Ralph
+
+@date:
+ :created: 2002-08-28
+ :issued: 2002-08-28
+ :available: 2002-08-28
+ :published: 2007-09-16
+ :modified: 2011-02-07
+
+@rights:
+ :copyright: Copyright (C) Ralph Amissah 2007
+ :license: GPL 3 (part of SiSU documentation)
+
+:A~? @title @creator
+
+:B~? SiSU Commands
+
+1~ Synopsis
+
+SiSU - Structured information, Serialized Units - a document publishing system
+
+sisu [ -abcDdeFhIiMmNnopqRrSsTtUuVvwXxYyZz0-9 ] [ filename/ wildcard ]
+
+sisu [ -Ddcv ] [ instruction ]
+
+sisu [ -CcFLSVvW ]
+
+Note: commands should be issued from within the directory that contains the marked up files, cd to markup directory.
+
+sisu is at version 2, version 3 is under development. To use sisu version 3
+
+sisu --v3 [and options/operations as above]
+
+or
+
+sisu3 [and options/operations as above]
+
+sisu version 1 has been discontinued.
+
+for settings see sisu --help env
+
+sisu [ filename/ wildcard] == sisu -0 [filename/wildcard]
diff --git a/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_syntax_highlighting.sst b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_syntax_highlighting.sst
new file mode 100644
index 00000000..12a70fb8
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_syntax_highlighting.sst
@@ -0,0 +1,155 @@
+% SiSU insert 4.0
+
+@title: SiSU
+ :subtitle: Syntax Highlighting
+
+@creator:
+ :author: Amissah, Ralph
+
+@date:
+ :published: 2007-09-16
+ :created: 2002-11-12
+ :issued: 2002-11-12
+ :available: 2002-11-12
+ :modified: 2012-10-03
+
+@rights:
+ :copyright: Copyright (C) Ralph Amissah 2007
+ :license: GPL 3 (part of SiSU documentation)
+
+@classify:
+ :topic_register: electronic documents:SiSU:document:syntax highlighting;SiSU:manual:syntax highlighting;electronic documents:SiSU:manual:syntax highlighting;SiSU:document:syntax highlighting;SiSU:document:syntax highlighting
+ :subject: ebook, epublishing, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, search
+
+:A~? @title @creator
+
+:B~? SiSU Syntax Highlighting
+
+1~ Editor Files, Syntax Highlighting
+
+The directory:
+
+_1 ./data/sisu/v4/conf/editor-syntax-etc/
+
+_1 ./data/sisu/v3/conf/editor-syntax-etc/
+
+_1 /usr/share/sisu/v4/conf/editor-syntax-etc
+
+_1 /usr/share/sisu/v3/conf/editor-syntax-etc
+
+contains rudimentary sisu syntax highlighting files for:
+
+_* (g)vim http://www.vim.org
+
+_1 package: sisu-vim
+
+status: largely done
+
+_1 there is a vim syntax highlighting and folds component
+
+_* gedit http://www.gnome.org/projects/gedit
+
+_* gobby http://gobby.0x539.de/
+
+_1 file: sisu.lang
+
+place in:
+
+_1 /usr/share/gtksourceview-1.0/language-specs
+
+or
+
+_1 ~/.gnome2/gtksourceview-1.0/language-specs
+
+_1 status: very basic syntax highlighting
+
+_1 comments: this editor features display line wrap and is used by Goby!
+
+_* nano http://www.nano-editor.org
+
+_1 file: nanorc
+
+save as:
+
+_1 ~/.nanorc
+
+_1 status: basic syntax highlighting
+
+_1 comments: assumes dark background; no display line-wrap; does line breaks
+
+_* diakonos (an editor written in ruby) http://purepistos.net/diakonos
+
+file: diakonos.conf
+
+save as:
+
+_1 ~/.diakonos/diakonos.conf
+
+includes:
+
+_1 status: basic syntax highlighting
+
+comments: assumes dark background; no display line-wrap
+
+_* kate & kwrite http://kate.kde.org
+
+_1 file: sisu.xml
+
+_1 place in:
+
+_2 /usr/share/apps/katepart/syntax
+
+_1 or
+
+_2 ~/.kde/share/apps/katepart/syntax
+
+_1 [settings::configure kate::{highlighting,filetypes}]
+
+_1 [tools::highlighting::{markup,scripts}::SiSU]
+
+% kde-config --prefix
+% KDEDIR/share/apps/katepart/syntax/
+% KDEHOME/share/apps/katepart/syntax
+% [In the configure dialog in kate, go to the "Editor->highlighting" page and
+% >select a highlight to change the mimetype/pattern associations for it.]
+% /etc/mime.types
+% /usr/share/mime/text
+
+_* nedit http://www.nedit.org
+
+_1 file: sisu_nedit.pats
+
+_1 nedit -import sisu_nedit.pats
+
+_1 status: a very clumsy first attempt [not really done]
+
+_1 comments: this editor features display line wrap
+
+_* emacs http://www.gnu.org/software/emacs/emacs.html
+
+_1 files: sisu-mode.el
+
+_1 to file ~/.emacs add the following 2 lines:
+
+_2 (add-to-list 'load-path "/usr/share/sisu/v4/conf/editor-syntax-etc/emacs")
+
+_2 (require 'sisu-mode.el)
+
+_1 [not done / not yet included]
+
+_* vim & gvim http://www.vim.org
+
+_1 files:
+
+_1 package is the most comprehensive sisu syntax highlighting and editor environment provided to date (is for vim/ gvim, and is separate from the contents of this directory)
+
+_1 status: this includes: syntax highlighting; vim folds; some error checking
+
+_1 comments: this editor features display line wrap
+
+NOTE:
+
+[SiSU parses files with long lines or line breaks, but, display linewrap (without line-breaks) is a convenient editor feature to have for sisu markup]
+
+% aeditor (an editor written in ruby)
+
diff --git a/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_webrick.sst b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_webrick.sst
new file mode 100644
index 00000000..6e56e53a
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_webrick.sst
@@ -0,0 +1,59 @@
+% SiSU 4.0
+
+@title: SiSU
+ :subtitle: sisu_webrick
+
+@creator:
+ :author: Amissah, Ralph
+
+@date:
+ :created: 2002-08-28
+ :issued: 2002-08-28
+ :available: 2007-08-28
+ :published: 2007-09-16
+ :modified: 2012-10-03
+
+@rights:
+ :copyright: Copyright (C) Ralph Amissah 2007
+ :license: GPL 3 (part of SiSU documentation)
+
+@classify:
+ :topic_register: electronic documents:SiSU:document:webrick;SiSU:manual:webrick;electronic documents:SiSU:manual:webrick;SiSU:document:webrick;SiSU:document:webrick
+ :subject: ebook, epublishing, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, search
+
+@make:
+ :manpage: section=7; name=sisu - documents: structuring, publishing in multiple formats, and search; synopsis=sisu -W
+
+:A~? @title @creator
+
+:B~? SiSU Webrick
+
+1~webrick sisu_webrick
+
+2~ Name
+
+SiSU - Structured information, Serialized Units - a document publishing system
+
+2~ Synopsis
+
+sisu_webrick [port]
+
+or
+
+sisu -W [port]
+
+2~ Description
+
+sisu_webrick is part of SiSU (man sisu) sisu_webrick starts Ruby's Webrick web-server and points it to the directories to which SiSU output is written, providing a list of these directories (assuming SiSU is in use and they exist).
+
+The default port for sisu_webrick is set to 8081, this may be modified in the yaml file: ~/.sisu/sisurc.yml a sample of which is provided as /etc/sisu/sisurc.yml (or in the equivalent directory on your system).
+
+2~ Summary of man page
+
+sisu_webrick, may be started on it's own with the command: sisu_webrick [port] or using the sisu command with the -W flag: sisu -W [port]
+
+where no port is given and settings are unchanged the default port is 8081
+
+2~ Document processing command flags
+
+sisu -W [port] starts Ruby Webrick web-server, serving SiSU output directories, on the port provided, or if no port is provided and the defaults have not been changed in ~/.sisu/sisurc.yaml then on port 8081
diff --git a/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_work_needed_and_wishlist.ssi b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_work_needed_and_wishlist.ssi
new file mode 100644
index 00000000..20e774ac
--- /dev/null
+++ b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_work_needed_and_wishlist.ssi
@@ -0,0 +1,59 @@
+% SiSU 2.0
+
+@title: SiSU
+ :subtitle: Work Needed and Wishlist
+
+@creator:
+ :author: Ralph Amissah
+
+@date:
+ :created: 2002-08-28
+ :issued: 2002-08-28
+ :available: 2002-08-28
+ :published: 2007-09-16
+ :modified: 2011-02-07
+
+@rights:
+ :copyright: Copyright (C) Ralph Amissah 2007
+ :license: GPL 3 (part of SiSU documentation)
+
+:A~? @title @creator
+
+:B~? Work Needed and Wishlist
+
+1~sisu_work_needed Work Needed
+
+SiSU is fairly mature and for most purposes the syntax and what it is supposed to do is clear. For the most part additions and changes are minor and backward compatible, (in particular there may be things of interest that to be able to achieve will require additions to the syntax).
+
+_* Amongst the most requested features is a way to represent and extract bibliographies from scholarly and other writings. This involves an extension of sisu markup syntax and a new module to extract the bibliography.
+
+_* Integration of postgresql tsearch2 / gin indexing, (which currently needs to be done manually, and) which has been waiting for the integration of tsearch2 / gin into Postgresql main, which is supposed to occur in Postgresql 8.3
+
+_* Internationalisation always. SiSU is utf-8 and for those parts that are utf-8 friendly will work out of the box - html and postgresql for example work out of the box (and for example comfortably represent Chinese text), LaTeX and odf do not work out of the box, they need additional work for extended language sets.
+
+_* Refinements and improvements to output representations, some are fairly mature, others (such as manpages and info files (and even ODF) remain young.
+
+_* Simple extension to contain, link and share included audio and multi-media files, (including sisupod.zip)
+
+1~sisu_wishlist Wishlist
+
+SiSU provides a lot of "plumbing" and is readily usable as a tool by those comfortable with marking up documents with an editor. The syntax is fairly easy to learn, especially the subset required to start using SiSU effectively.
+
+SiSU might also be of interest to developers interested in:
+
+_* experimenting with the search implications offered
+
+_* producing additional output formats
+
+_* producing conversion tools
+
+_* producing input interfaces, (experimenting with additional interfaces for producing sisu source documents)
+
+Several tools that are of interest would come under the heading interface and conversion. Amongst others, the following are of interest:
+
+_* Converters from various document formats, such as Open Document Text (ODF), MS Word(TM) and Word Perfect(TM), even html. The problem here is one of the most important things for SiSU is to be able to recognise the structure of a document, and many documents prepared in other formats have not been prepared strictly with a view to representing structure, but appearance - so heading levels may be "painted" to look right rather than have the correct structural representation. Even if conversion is not perfect this may serve as a first step in assisting in conversion of documents to SiSU for those with legacy document sets that they would like to have in sisu format. (once in SiSU it is easier to get out in various other formats as this is what sisu does, within the constraints of the information that sisu uses to generate output)
+
+_* The possibility to save directly from from various word processors, and possibly templates within them to assist in making sure the document structure is "understood" by SiSU.
+
+_* Web interface/front-end, a form like front end for the writing or submission of sisu documents to a server which uses SiSU to generate output. Headers could be made available as separate small entry forms with help provided to explain where they might be used. Apart from the most important headers such as title, author, date and possibly subject the remainder of the header forms could be placed after the form for substantive content. This would offer a more Web 2.0 like approach to the use of SiSU and the possibility of using it for collaborative editing of content (possibly for documents that are to be finalised/published as the citation system is most suited to published works). [Collaborative editing is currently possible through use of a collaborative editor such as Gobby which makes use of the Obby protocol].
+
diff --git a/data/sisu/v2/conf/convert/modify.rb b/data/sisu/v2/conf/convert/modify.rb
deleted file mode 100644
index c3fe47c9..00000000
--- a/data/sisu/v2/conf/convert/modify.rb
+++ /dev/null
@@ -1,272 +0,0 @@
-#!/usr/bin/env ruby
-# encoding: utf-8
-=begin
- * Name: modify.rb
- * Author: Ralph Amissah
- * http://www.jus.uio.no/sisu
- * http://www.jus.uio.no/sisu/SiSU/download
- * Description: A conversion script for canned substitutions,
- a fairly generic simple tool that can be used to store other canned conversions,
- used here for altering SiSU markup
- * Copyright (C) 2004, 2006 Ralph Amissah
- * Packaged with: SiSU information Structuring Universe -
- Structured information, Serialized Units
- * SiSU Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Ralph Amissah
-
- * License: GPL 3 or later
-
- Summary of GPL 3
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- http://www.fsf.org/licenses/gpl.html
- http://www.gnu.org/copyleft/gpl.html
- http://www.jus.uio.no/sisu/gpl3.fsf
-
- (C) Ralph Amissah 1997, current 2009.
- All Rights Reserved.
-
- * Ralph Amissah: ralph@amissah.com
- ralph.amissah@gmail.com
-
-=end
-module SiSU_Modify
- class Convert_markup
- def initialize(cf,files)
- @cf,@files=cf,files
- @description="This is a script that contains canned text conversions for reuse"
- end
- def current_match_and_replace #Disable, edit manually
- clean_non_regular_characters
- #convert_pre_37_to_38_experimental
- end
- def message(text)
- response=''
- while response !~/yes/
- print %{
- #{text}
- to continue type "yes" [to exit type "no" or "quit"]: }
- response=File.new('/dev/tty').gets.strip
- exit if response =~/^(?:quit|no)$/
- end
- end
- def help
- print <<WOK
-
-#@description
-
-modify.rb --default [filename/wildcard]
- performs the current default conversion that is set
- [handle with care, (may be disabled)]
-
-modify.rb --to38 [filename/wildcard]
- converts pre 0.37 sisu markup to 0.38 experimental
-
-modify.rb --to37 [filename/wildcard]
- converts pre 0.37 sisu markup to 0.38 experimental
-
-note converting twice in a single direction will result
-in markup inconsistency
-
-An alternative script has been introduced,
-try 'sisu --convert'
-
-modify.rb --default
- performs the current default conversion that is set
- on the files matched in default the settings
- [handle with care, (may be disabled)]
-
-WOK
- exit
- end
- #%% substitutions to be made
- def clean_non_regular_characters
- #/[^ a-zA-Z0-9,.!?;:/={}()%@#~\[\]"'´&$_+^-]
- #/[^ a-zA-Z0-9,.!?;:/={}()%@#~\[\]"'´&$_+^•’‘`“”–ffifffflfifl-]
- #message(%w{[^ a-zA-Z0-9,.!?;:/={}()%@#~\[\]"'´&$_+^-]})
- message(%q{clean non regular characters})
- [
- [/’/, "'"],
- [/‘/, "'"],
- [/´/, "'"],
- [/`/, "'"],
- [/[“”]/, '"'],
- [/–/, '-'],
- [/ff/, 'ff'],
- [/ffi/, 'ffi'],
- [/ffl/, 'ffl'],
- [/fi/, 'fi'],
- [/fl/, 'fl'],
- [/^•/, '_* '],
- [/•/, '*']
- ]
- end
- def convert_pre_37_to_38_experimental
- message('convert sisu markup from 0.37 to 0.38 experimental (rad)')
- [
- [/^0~(\S+?)([+-])\s+/, "@\\1:\\2 "],
- [/^0~(\S+)\s+/, "@\\1: "],
- [/^@toc:\s+/, "@structure: "],
- [/^1~/, ':A~'],
- [/^2~/, ':B~'],
- [/^3~/, ':C~'],
- [/^4~/, '1~'],
- [/^5~/, '2~'],
- [/^6~/, '3~']
- ]
- end
- def convert_38_experimental_to_37
- message('convert sisu markup from 0.38 experimental (rad) to 0.37')
- [
- [/^@(\S+?):([+-])\s+/, "0~\\1\\2 "],
- [/^@(\S+?):\s+/, "0~\\1 "],
- [/^0~structure\s+/, "0~toc "],
- [/^1~/, '4~'],
- [/^2~/, '5~'],
- [/^3~/, '6~'],
- [/^:?A~/, '1~'],
- [/^:?B~/, '2~'],
- [/^:?C~/, '3~']
- ]
- end
- def markup_version?(i)
- file=File.open(i,'r')
- cont=file.readlines
- file.close
- markup_version=nil
- cont.each do |y|
- if y =~/^:?A~/
- markup_version='0.38'
- break
- end
- if y =~/^1~/
- markup_version='0.37'
- break
- end
- #if y =~/^1{~/
- # markup_version='0.16'
- # break
- #end
- markup_version='0.37'
- end
- markup_version
- end
- def conversion
- #%% do it -------------------------->
- if @files and @files.length > 0
- p @files
- mr=nil
- #%% changes to make m match, r replace -------------------------->
- if @cf =~/--help/; help
- else
- message("WARNING, proceed at your own risk,\npermanent changes requested for the above named files\n best that you check (manually) what this file is set to do\n conversions set are at the top of the file")
- mr=case @cf
- when /--convert|default/; current_match_and_replace
- when /--(?:(?:37)?to38|rad)/; convert_pre_37_to_38_experimental
- when /--(?:(?:38)?to37)/; convert_38_experimental_to_37
- else help
- end
- end
- match_and_replace=mr
- #start_processing =/not used in this example/i
- end_processing =/END\s+OF\s+FILE/
- @files.each do |i|
- @new,@matched,@flag_start,@flag_end,@empty1,@empty2=true,false,false,false,false,false
- o="#{i}.bk" #o is for old
- file=File.open(i,'r')
- cont=file.readlines
- file.close
- cont.each do |y|
- #p y
- #p y if y =~/^[1-6]~/
- match_and_replace.each do |m,r|
- if y =~m
- if @new
- @new=false
- File.unlink(o) if File.exists?(o)
- #system("lv #{i} > #{o}")
- File.rename(i,o)
- File.unlink(i) if File.exists?(i)
- @file=File.new(i,'w')
- @matched=true
- break
- end
- end
- end
- end
- if @matched
- puts "match in #{i}"
- @flag_start=true
- cont.each do |y|
- if y =~end_processing; @flag_end=true
- end
- if @flag_start and not @flag_end
- match_and_replace.each do |m,r|
- if y =~m
- p m.to_s + ' -> ' + r
- puts "in: #{y}"
- y.gsub!(m,r) if m and r
- puts "out: #{y}"
- end
- end
- end
- #if y =~start_processing: @flag_start=true
- #end
- #if y =~m1
- #end
- if y=~/^\s*$/; @empty1=true
- else @empty1=false
- end
- @file.puts y unless (@empty1==true and @empty2==true)
- if y=~/^\s*$/; @empty2=true
- else @empty2=false
- end
- #@file << y + "\n"
- end
- @file.close
- else puts "NO match in #{f}"
- end
- end
- else puts "this routine makes permanent changes to the contents of the files matched, as instructed within [no matches]"
- end
- end
- end
-end
-#%% files to match for this conversion set ------------------------->
-f=$*
-p $*
-cf=f[0].to_s
-f.shift
-match_and_replace=Array.new
-#unless cf and cf =~/--/
-# puts <<WOK
-#
-##@description
-#
-#usage:
-# modify.rb --convert [filename/wildcard]
-#for help
-# modify.rb --help
-#WOK
-# exit
-#end
-unless f.length > 0; f=Dir.glob("[a-z]*.ss?") #restricted to sisu type files, it need not be
-end
-#f=Dir.glob("{bin,conf,data,lib}/**/*.rb") #sisu development
-#f=Dir.glob("[^_]/**/*") #all files subdirectories beneath pwd except those starting with _
-SiSU_Modify::Convert_markup.new(cf,f).conversion
-__END__
diff --git a/data/sisu/v2/v/version.yml b/data/sisu/v2/v/version.yml
deleted file mode 100644
index 663c9bd2..00000000
--- a/data/sisu/v2/v/version.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-:version: 2.9.12
-:date_stamp: 2012w07/2
-:date: "2012-02-14"
-:project: SiSU
diff --git a/data/sisu/v2/conf/cgi-bin/sisu_search_pgsql.cgi b/data/sisu/v4/conf/cgi-bin/sisu_search_pgsql.cgi
index c196c756..c196c756 100644
--- a/data/sisu/v2/conf/cgi-bin/sisu_search_pgsql.cgi
+++ b/data/sisu/v4/conf/cgi-bin/sisu_search_pgsql.cgi
diff --git a/data/sisu/v2/conf/cgi-bin/sisu_search_sqlite.cgi b/data/sisu/v4/conf/cgi-bin/sisu_search_sqlite.cgi
index 34bb3748..34bb3748 100644
--- a/data/sisu/v2/conf/cgi-bin/sisu_search_sqlite.cgi
+++ b/data/sisu/v4/conf/cgi-bin/sisu_search_sqlite.cgi
diff --git a/data/sisu/v2/conf/completion/README b/data/sisu/v4/conf/completion/README
index d723a140..d723a140 100644
--- a/data/sisu/v2/conf/completion/README
+++ b/data/sisu/v4/conf/completion/README
diff --git a/data/sisu/v2/conf/completion/_sisu b/data/sisu/v4/conf/completion/_sisu
index 076795cb..076795cb 100644
--- a/data/sisu/v2/conf/completion/_sisu
+++ b/data/sisu/v4/conf/completion/_sisu
diff --git a/data/sisu/v2/conf/convert/kdissert_to_sisu b/data/sisu/v4/conf/convert/kdissert_to_sisu
index 35921c3e..35921c3e 100644
--- a/data/sisu/v2/conf/convert/kdissert_to_sisu
+++ b/data/sisu/v4/conf/convert/kdissert_to_sisu
diff --git a/data/sisu/v4/conf/convert/modify.rb b/data/sisu/v4/conf/convert/modify.rb
new file mode 100644
index 00000000..8a4b9074
--- /dev/null
+++ b/data/sisu/v4/conf/convert/modify.rb
@@ -0,0 +1,376 @@
+#!/usr/bin/env ruby
+# encoding: utf-8
+=begin
+
+ * Name: modify.rb
+
+ * Description: A conversion script for canned substitutions,
+ a fairly generic simple tool that can be used to store other canned conversions,
+ (used here for altering SiSU markup or the SiSU program)
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997 - 2012, Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ * Packaged with: SiSU a framework for document structuring, publishing & search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
+ <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
+ <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.jus.uio.no/sisu/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+=end
+module SiSU_Modify
+ class Operations
+ def initialize(cf,files)
+ @cf,@files=cf,files
+ @description="This is a script that contains canned text conversions for reuse"
+ pwd=Dir.pwd
+ @mod_inst='modify_instructions.rb'
+ @modify_instructions_script="#{pwd}/#{@mod_inst}"
+ if FileTest.file?(@modify_instructions_script) ==true
+ puts <<-WOK
+ autoload script: "#{@modify_instructions_script}"
+ used by "ruby #{__FILE__} --convert" if
+ "Extracted.new.modify.modules_and_classes" is used
+ (see "matches_and_replaces")
+ EDIT this file manually
+ [to rebuild run: "ruby #{__FILE__} --build-gsub"]
+
+ WOK
+ else
+ puts <<-WOK
+ autoload script does not exist: "#{@modify_instructions_script}"
+ needed for "ruby #{__FILE__} --convert" if
+ "Extracted.new.modify.modules_and_classes" is used
+ (see "matches_and_replaces")
+ try run: "ruby #{__FILE__} --build-gsub"
+
+ WOK
+ end
+ autoload :Extracted, "./#{@mod_inst}"
+ end
+ def matches_and_replaces #edit manually
+ [
+ #Extracted.new.modify.modules_and_classes,
+ #Extracted.new.modify.modules,
+ #Extracted.new.modify.classes,
+ #modify.dates,
+ #modify.modules,
+ #modify.classes,
+ #modify.misc,
+ ]
+ end
+ def message(text)
+ response=''
+ while response !~/yes/
+ print %{
+ #{text}
+ To continue type "yes" [to exit type "no" or "quit"]: }
+ response=File.new('/dev/tty').gets.strip
+ exit if response =~/^(?:quit|no)$/
+ end
+ end
+ def help
+ print <<WOK
+
+#{@description}
+
+note converting twice in a single direction will result
+in markup inconsistency
+
+modify.rb --convert
+ performs the current conversion that is set in method "matches_and_replaces",
+ this needs to be edited manually, as do the substitutions to be made on the
+ files matched in the settings [handle with care]
+
+modify.rb --report
+ reports on the names of modules and classes in each file requested
+ (the defalt is all)
+
+modify.rb --build-gsub
+ creates modify_instructions.rb methods for substitutions of methods and
+ classes for editing
+
+WOK
+ exit
+ end
+ #%% substitutions to be made
+ # [//, ''],
+ #def rename_default
+ # message(%q{rename SiSU modules, classes, date})
+ # [
+ # [/1997\s+-\s+2012/, '1997 - 2012'],
+ # ]
+ #end
+ def modify
+ def misc
+ [
+ #[//, ''],
+ ]
+ end
+ def dates
+ [
+ [/1997\s+-\s+2011/, '1997 - 2012'],
+ ]
+ end
+ def modules
+ [
+ #[//, ''],
+ ]
+ end
+ def classes
+ [
+ #[//, ''],
+ ]
+ end
+ self
+ end
+ def convert
+ message("WARNING, proceed at your own risk,\npermanent changes requested for the above named files\n best that you check (manually) what this file is set to do\n conversions set are at the top of the file")
+ if matches_and_replaces.length > 0
+ @files.each do |i|
+ @new,@matched,@empty1,@empty2=true,false,false,false
+ file=File.open(i,'r')
+ cont=file.readlines
+ file.close
+ @file=File.new(i,'w')
+ cont.each do |t|
+ matches_and_replaces.each do |match_and_replace|
+ match_and_replace.each do |m,r|
+ if t =~m
+ p m.to_s + ' -> ' + r
+ puts "in: #{t}"
+ t=t.gsub(m,r) if m and r
+ puts "out: #{t}"
+ end
+ end
+ end
+ if t=~/^\s*$/; @empty1=true
+ else @empty1=false
+ end
+ @file.puts t unless (@empty1==true and @empty2==true)
+ if t=~/^\s*$/; @empty2=true
+ else @empty2=false
+ end
+ end
+ @file.close
+ end
+ end
+ end
+ def report_modules_and_classes
+ @f=nil
+ @structure={}
+ @arr={mod: [], cl: []}
+ @files.each do |f|
+ @new,@matched,@empty1,@empty2=true,false,false,false
+ file=File.open(f,'r')
+ cont=file.readlines
+ file.close
+ cont.each do |t|
+ if f != @f
+ @f=f
+ @mod=nil
+ #puts "---\n#{@f}"
+ @structure[@f]={}
+ end
+ if t =~/^\s*module\s+\S+/
+ @mod=t.match(/^\s*module\s+(\S+)/)[1]
+ #puts ' ' + @mod
+ @arr[:mod] << @mod
+ @structure[@f].store(@mod,[])
+ #@structure[@f] = {@mod => []}
+ end
+ if t =~/^\s*class\s+\S+/
+ cl=t.match(/^\s*class\s+(\S+)/)[1]
+ #puts ' ' + cl
+ @arr[:cl] << cl
+ @structure[@f][@mod] << cl
+ end
+ end
+ end
+ @structure.sort.each do |fl,modules|
+ puts "---\n" + fl
+ modules.sort.each do |mod,classes|
+ puts ' ' + mod
+ classes.sort.each do |cl|
+ puts ' ' + cl
+ end
+ end
+ end
+ puts '---'
+ puts 'number of modules: ' + @arr[:mod].length.to_s + ', unique: ' + @arr[:mod].uniq.length.to_s
+ puts 'number of classes: ' + @arr[:cl].length.to_s + ', unique: ' + @arr[:cl].uniq.length.to_s
+ end
+ def build_search_and_replace_method_for_modules_and_classes
+ @f=nil
+ @structure={}
+ @arr={mod: [], cl: []}
+ @files.each do |f|
+ @new,@matched,@empty1,@empty2=true,false,false,false
+ file=File.open(f,'r')
+ cont=file.readlines
+ file.close
+ cont.each do |t|
+ if f != @f
+ @f=f
+ @mod=nil
+ #puts "---\n#{@f}"
+ @structure[@f]={}
+ end
+ if t =~/^\s*module\s+\S+/
+ @mod=t.match(/^\s*module\s+(\S+)/)[1]
+ #puts ' ' + @mod
+ @arr[:mod] << @mod
+ @structure[@f].store(@mod,[])
+ #@structure[@f] = {@mod => []}
+ end
+ if t =~/^\s*class\s+\S+/
+ cl=t.match(/^\s*class\s+(\S+)/)[1]
+ #puts ' ' + cl
+ @arr[:cl] << cl
+ @structure[@f][@mod] << cl
+ end
+ end
+ end
+ puts 'number of modules: ' + @arr[:mod].length.to_s + ', unique: ' + @arr[:mod].uniq.length.to_s
+ puts 'number of classes: ' + @arr[:cl].length.to_s + ', unique: ' + @arr[:cl].uniq.length.to_s
+ method_modules_and_classes=[]
+ method_modules_and_classes <<<<-WOK
+#module SiSU_MC
+ class Extracted
+ def modify
+ WOK
+ #% modules_and_classes
+ method_modules_and_classes <<<<-WOK
+ def modules_and_classes
+ [
+ WOK
+ @structure.sort.each do |fl,modules|
+ method_modules_and_classes << ' '*8 + "##% -- " + fl
+ modules.sort.each do |mod,classes|
+ method_modules_and_classes << ' '*8 + '# ' + "[/#{mod}/," + ' '*(67 - mod.length) + "'#{mod}'],"
+ classes.uniq.sort.each do |cl|
+ method_modules_and_classes << ' '*8 + '# ' + "[/#{cl}/," + ' '*(65 - cl.length) + "'#{cl}'],"
+ end
+ end
+ end
+ method_modules_and_classes <<<<-WOK
+ ]
+ end
+ WOK
+ #% modules
+ method_modules_and_classes <<<<-WOK
+ def modules
+ [
+ WOK
+ method_modules_and_classes << ' '*8 + '# ' + 'number of modules: ' + @arr[:mod].length.to_s +
+ ', unique: ' + @arr[:mod].uniq.length.to_s
+ @arr[:mod].uniq.sort.each do |mod|
+ method_modules_and_classes << ' '*8 + '# ' + "[/#{mod}/," + ' '*(67 - mod.length) + "'#{mod}'],"
+ end
+ method_modules_and_classes <<<<-WOK
+ ]
+ end
+ WOK
+ #% classes
+ method_modules_and_classes <<<<-WOK
+ def classes
+ [
+ WOK
+ method_modules_and_classes << ' '*8 + '# ' + 'number of classes: ' + @arr[:cl].length.to_s +
+ ', unique: ' + @arr[:cl].uniq.length.to_s
+ @arr[:cl].uniq.sort.each do |cl|
+ method_modules_and_classes << ' '*8 + '# ' + "[/#{cl}/," + ' '*(67 - cl.length) + "'#{cl}'],"
+ end
+ method_modules_and_classes <<<<-WOK
+ ]
+ end
+ WOK
+ method_modules_and_classes <<<<-WOK
+ self
+ end
+ end
+#end
+ WOK
+ #method_modules_and_classes.each{|x| puts x}
+ if FileTest.file?(@modify_instructions_script) ==true
+ message("WARNING << #{@mod_inst} >> exists (and may have been edited). The existing << #{@mod_inst} >> will be overwritten if you proceed.")
+ end
+ instructs=File.new(@modify_instructions_script,'w')
+ method_modules_and_classes.each do |x|
+ puts x
+ instructs.puts x
+ end
+ instructs.close
+ end
+ def action
+ if @files and @files.length > 0
+ p @files
+ mr=nil
+ #%% changes to make m match, r replace -------------------------->
+ if @cf =~/--help/; help
+ else
+ case @cf
+ when /--convert/; convert
+ when /--report/; report_modules_and_classes
+ when /--build-gsub/; build_search_and_replace_method_for_modules_and_classes
+ else help
+ end
+ #act
+ end
+ else puts "this routine makes permanent changes to the contents of the files matched, as instructed within [no matches]"
+ end
+ end
+ end
+end
+#% files to match for this conversion set ------------------------->
+f=$* #; p $*
+cf=f[0].to_s
+f.shift
+match_and_replace=Array.new
+unless f.length > 0
+ f=if cf == '--report' \
+ or cf == '--build-gsub'
+ Dir.glob("[a-zA-Z]*.rb") #restrict to ruby files
+ else
+ Dir.glob("[a-zA-Z]*")
+ end
+ f=f.sort.delete_if { |x| x == __FILE__ or x == 'modify_instructions.rb' }
+end
+SiSU_Modify::Operations.new(cf,f).action
+__END__
+#f=Dir.glob("{bin,conf,data,lib}/**/*.rb") #sisu development
+#f=Dir.glob("[^_]/**/*") #all files subdirectories beneath pwd except those starting with _
diff --git a/data/sisu/v2/conf/convert/sisu_convert b/data/sisu/v4/conf/convert/sisu_convert
index a3a12189..a3a12189 100644
--- a/data/sisu/v2/conf/convert/sisu_convert
+++ b/data/sisu/v4/conf/convert/sisu_convert
diff --git a/data/sisu/v2/conf/convert/wvHtml.xml b/data/sisu/v4/conf/convert/wvHtml.xml
index 3cc9dd29..3cc9dd29 100644
--- a/data/sisu/v2/conf/convert/wvHtml.xml
+++ b/data/sisu/v4/conf/convert/wvHtml.xml
diff --git a/data/sisu/v2/conf/convert/wvSiSU.xml b/data/sisu/v4/conf/convert/wvSiSU.xml
index 271b00ff..271b00ff 100644
--- a/data/sisu/v2/conf/convert/wvSiSU.xml
+++ b/data/sisu/v4/conf/convert/wvSiSU.xml
diff --git a/data/sisu/v2/conf/editor-syntax-etc/README b/data/sisu/v4/conf/editor-syntax-etc/README
index c03f3569..c03f3569 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/README
+++ b/data/sisu/v4/conf/editor-syntax-etc/README
diff --git a/data/sisu/v2/conf/editor-syntax-etc/diakonos/diakonos.conf b/data/sisu/v4/conf/editor-syntax-etc/diakonos/diakonos.conf
index a3c3afe4..a3c3afe4 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/diakonos/diakonos.conf
+++ b/data/sisu/v4/conf/editor-syntax-etc/diakonos/diakonos.conf
diff --git a/data/sisu/v2/conf/editor-syntax-etc/emacs/README b/data/sisu/v4/conf/editor-syntax-etc/emacs/README
index 24816c1e..24816c1e 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/emacs/README
+++ b/data/sisu/v4/conf/editor-syntax-etc/emacs/README
diff --git a/data/sisu/v2/conf/editor-syntax-etc/emacs/sisu-mode.el b/data/sisu/v4/conf/editor-syntax-etc/emacs/sisu-mode.el
index 8ea5c023..84e7cbef 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/emacs/sisu-mode.el
+++ b/data/sisu/v4/conf/editor-syntax-etc/emacs/sisu-mode.el
@@ -251,15 +251,23 @@
;;indented text
(cons "^_[1-9] " 'general-font-lock-red1)
+ (cons "^_[1-9]! " 'general-font-lock-red1)
+
+ ;hanging indented text [proposed enable when implemented]
+ (cons "^__[1-9] " 'general-font-lock-red1)
+ (cons "^_[0-9]_[0-9] " 'general-font-lock-red1)
+ (cons "^__[1-9]! " 'general-font-lock-red1)
+ (cons "^_[0-9]_[0-9]! " 'general-font-lock-red1)
;;url
(cons "\\(^\\|[ ]\\)http:[/][/][^ \t\n\r<]+" 'general-font-lock-blue2)
-;; \\|\$
-
;; Comment Lines
(cons "^% .*" 'general-font-lock-blue1)
+
;; line break
+ (cons " \\\\\\\\ " 'general-font-lock-red1)
+ ;; line break (depreciated)
(cons "<br>" 'general-font-lock-red1)
;; Section titles
diff --git a/data/sisu/v2/conf/editor-syntax-etc/gedit/sisu.lang b/data/sisu/v4/conf/editor-syntax-etc/gedit/sisu.lang
index b82d5f80..b82d5f80 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/gedit/sisu.lang
+++ b/data/sisu/v4/conf/editor-syntax-etc/gedit/sisu.lang
diff --git a/data/sisu/v2/conf/editor-syntax-etc/kate/sisu.xml b/data/sisu/v4/conf/editor-syntax-etc/kate/sisu.xml
index a8054f2d..a8054f2d 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/kate/sisu.xml
+++ b/data/sisu/v4/conf/editor-syntax-etc/kate/sisu.xml
diff --git a/data/sisu/v2/conf/editor-syntax-etc/nano/nanorc b/data/sisu/v4/conf/editor-syntax-etc/nano/nanorc
index 30ba439c..30ba439c 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/nano/nanorc
+++ b/data/sisu/v4/conf/editor-syntax-etc/nano/nanorc
diff --git a/data/sisu/v2/conf/editor-syntax-etc/nedit/sisu_nedit.pats b/data/sisu/v4/conf/editor-syntax-etc/nedit/sisu_nedit.pats
index ef01b2be..ef01b2be 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/nedit/sisu_nedit.pats
+++ b/data/sisu/v4/conf/editor-syntax-etc/nedit/sisu_nedit.pats
diff --git a/data/sisu/v2/conf/editor-syntax-etc/vim/colors/8.vim b/data/sisu/v4/conf/editor-syntax-etc/vim/colors/8.vim
index 46d618f3..46d618f3 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/vim/colors/8.vim
+++ b/data/sisu/v4/conf/editor-syntax-etc/vim/colors/8.vim
diff --git a/data/sisu/v2/conf/editor-syntax-etc/vim/colors/frugal-cterm-ruby.vim b/data/sisu/v4/conf/editor-syntax-etc/vim/colors/frugal-cterm-ruby.vim
index aad6de0f..aad6de0f 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/vim/colors/frugal-cterm-ruby.vim
+++ b/data/sisu/v4/conf/editor-syntax-etc/vim/colors/frugal-cterm-ruby.vim
diff --git a/data/sisu/v2/conf/editor-syntax-etc/vim/colors/frugal-cterm-sisu.vim b/data/sisu/v4/conf/editor-syntax-etc/vim/colors/frugal-cterm-sisu.vim
index 03f192df..03f192df 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/vim/colors/frugal-cterm-sisu.vim
+++ b/data/sisu/v4/conf/editor-syntax-etc/vim/colors/frugal-cterm-sisu.vim
diff --git a/data/sisu/v2/conf/editor-syntax-etc/vim/colors/frugal.vim b/data/sisu/v4/conf/editor-syntax-etc/vim/colors/frugal.vim
index 1ff26a58..1ff26a58 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/vim/colors/frugal.vim
+++ b/data/sisu/v4/conf/editor-syntax-etc/vim/colors/frugal.vim
diff --git a/data/sisu/v2/conf/editor-syntax-etc/vim/colors/slate.vim b/data/sisu/v4/conf/editor-syntax-etc/vim/colors/slate.vim
index 238b27df..238b27df 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/vim/colors/slate.vim
+++ b/data/sisu/v4/conf/editor-syntax-etc/vim/colors/slate.vim
diff --git a/data/sisu/v2/conf/editor-syntax-etc/vim/colors/sparse-cterm-ruby.vim b/data/sisu/v4/conf/editor-syntax-etc/vim/colors/sparse-cterm-ruby.vim
index 3d8f92e1..3d8f92e1 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/vim/colors/sparse-cterm-ruby.vim
+++ b/data/sisu/v4/conf/editor-syntax-etc/vim/colors/sparse-cterm-ruby.vim
diff --git a/data/sisu/v2/conf/editor-syntax-etc/vim/colors/sparse-cterm-sisu.vim b/data/sisu/v4/conf/editor-syntax-etc/vim/colors/sparse-cterm-sisu.vim
index 9704dbd2..9704dbd2 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/vim/colors/sparse-cterm-sisu.vim
+++ b/data/sisu/v4/conf/editor-syntax-etc/vim/colors/sparse-cterm-sisu.vim
diff --git a/data/sisu/v2/conf/editor-syntax-etc/vim/filetype.vim b/data/sisu/v4/conf/editor-syntax-etc/vim/filetype.vim
index 917c3e04..917c3e04 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/vim/filetype.vim
+++ b/data/sisu/v4/conf/editor-syntax-etc/vim/filetype.vim
diff --git a/data/sisu/v2/conf/editor-syntax-etc/vim/ftplugin/sisu.vim b/data/sisu/v4/conf/editor-syntax-etc/vim/ftplugin/sisu.vim
index 160444fd..be3ff18f 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/vim/ftplugin/sisu.vim
+++ b/data/sisu/v4/conf/editor-syntax-etc/vim/ftplugin/sisu.vim
@@ -1,6 +1,6 @@
"%% SiSU Vim ftplugin
" SiSU Maintainer: Ralph Amissah <ralph@amissah.com>
-" SiSU Markup: SiSU (sisu-2.0) 2010-06-05
+" SiSU Markup: SiSU (sisu-3.3) 2012-08-18
" an ftplugin setting defaults for editing sisu markup files
:syntax on
:filetype on
@@ -175,8 +175,15 @@
":command! Fp FMake ^\s*[A-Za-z0-9#]
:command! Fp FMake ^\s*\S
:command! Fo FMake ^[%\"]\s*[{>]
+"% linenumbering, on, relative, off
+:map <Leader>nn :set <c-r>={'00':'','01':'r','10':'nor'}[&rnu.&nu]<CR>nu<CR>
"% cursorline
:highlight CursorLine guibg=black ctermbg=black
:highlight CursorColumn guibg=black ctermbg=black
+:map <leader>cu :if &cursorcolumn <Bar>
+ \set nocursorline nocursorcolumn <Bar>
+ \else <Bar>
+ \set cursorline cursorcolumn <Bar>
+ \endif<cr>
:map <leader>cu- :set nocursorline nocursorcolumn<cr>
:map <leader>cu+ :set cursorline cursorcolumn<cr>
diff --git a/data/sisu/v2/conf/editor-syntax-etc/vim/syntax/sisu.vim b/data/sisu/v4/conf/editor-syntax-etc/vim/syntax/sisu.vim
index be92d62f..7edcf208 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/vim/syntax/sisu.vim
+++ b/data/sisu/v4/conf/editor-syntax-etc/vim/syntax/sisu.vim
@@ -1,7 +1,7 @@
" SiSU Vim syntax file
" SiSU Maintainer: Ralph Amissah <ralph@amissah.com>
-" SiSU Markup: SiSU (sisu-2.9.12)
-" Last Change: 2012-02-11
+" SiSU Markup: SiSU (sisu-4.0.0)
+" Last Change: 2012-11-16
" URL: <http://git.sisudoc.org/?p=code/sisu.git;a=blob;f=data/sisu/v3/conf/editor-syntax-etc/vim/syntax/sisu.vim;hb=HEAD>
"(originally looked at Ruby Vim by Mirko Nasato)
@@ -14,19 +14,15 @@ endif
let s:cpo_save = &cpo
set cpo&vim
-" Errors:
+"% "Errors:
syn match sisu_error contains=sisu_link,sisu_error_wspace "<![^ei]\S\+!>"
-" Markers Identifiers:
+
+"% "Markers Identifiers:
if !exists("sisu_no_identifiers")
syn match sisu_mark_endnote "\~^"
- syn match sisu_break contains=@NoSpell " \\\\\( \|$\)"
- syn match sisu_break contains=@NoSpell "<br>\|<br />"
- syn match sisu_control contains=@NoSpell "^<:p[bn]>\s*$"
- "syn match sisu_control contains=@NoSpell "^<\(br\)\?:\(pg\|pgn\|pn\)>\s*$"
- "syn match sisu_control contains=@NoSpell "^\[\(br\)\?:\(pg\|pgn\|pn\)\]\s*$"
+ syn match sisu_break contains=@NoSpell " \\\\\( \|$\)\|<br>\|<br />"
+ syn match sisu_control contains=@NoSpell "^\(-\\\\-\|=\\\\=\|<:p[bn]>\)\s*$"
syn match sisu_control contains=@NoSpell "^<:\(bo\|---\)>\s*$"
- "syn match sisu_control contains=@NoSpell "^<\(br\)\?:\(pr\|o\)>\s*$"
- "syn match sisu_control contains=@NoSpell "^\[\(br\)\?:\(pr\|o\)\]\s*$"
syn match sisu_marktail "[~-]#"
syn match sisu_control "\""
syn match sisu_underline "\(^\| \)_[a-zA-Z0-9]\+_\([ .,]\|$\)"
@@ -37,14 +33,19 @@ if !exists("sisu_no_identifiers")
syn match sisu_require contains=@NoSpell "^<<\s*[a-zA-Z0-9^._-]\+\.ss[it]$"
syn match sisu_require contains=@NoSpell "^<<{[a-zA-Z0-9^._-]\+\.ss[it]}$"
syn match sisu_structure "^:A\~$"
+
+"% "Document Sub Headers:
syn match sisu_sub_header_title "^\s\+:\(subtitle\|short\|edition\|language\|lang_char\|note\):\s" "group=sisu_header_content
- syn match sisu_sub_header_creator "^\s\+:\(author\|contributor\|illustrator\|photographer\|translator\|digitized_by\|prepared_by\|audio\|video\):\s" " &hon &institution
+ syn match sisu_sub_header_creator "^\s\+:\(author\|editor\|contributor\|illustrator\|photographer\|translator\|digitized_by\|prepared_by\|audio\|video\):\s" " &hon &institution
syn match sisu_sub_header_rights "^\s\+:\(copyright\|text\|translation\|illustrations\|photographs\|preparation\|digitization\|audio\|video\|license\|all\):\s" " access_rights license
- syn match sisu_sub_header_classify "^\s\+:\(topic_register\|coverage\|format\|identifier\|keywords\|relation\|subject\|type\|dewey\|loc\|oclc\|pg\|isbn\):\s"
- syn match sisu_sub_header_date "^\s\+:\(added_to_site\|available\|created\|issued\|modified\|published\|valid\|translated\|original_publication\):\s"
+ syn match sisu_sub_header_classify "^\s\+:\(topic_register\|keywords\|subject\|dewey\|loc\):\s"
+ syn match sisu_sub_header_identifier "^\s\+:\(oclc\|isbn\):\s"
+ syn match sisu_sub_header_date "^\s\+:\(added_to_site\|available\|created\|issued\|modified\|published\|valid\|translated\|original_publication\):\s"
syn match sisu_sub_header_original "^\s\+:\(publisher\|date\|language\|lang_char\|institution\|nationality\|source\):\s"
- syn match sisu_sub_header_make "^\s\+:\(headings\|num_top\|breaks\|language\|italics\|bold\|emphasis\|plaintext_wrap\|texpdf_font\|skin\|stamp\|promo\|ad\|manpage\):\s"
- syn match sisu_sub_header_notes "^\s\+:\(abstract\|comment\|description\|history\|prefix\|prefix_[ab]\|suffix\):\s"
+ syn match sisu_sub_header_make "^\s\+:\(headings\|num_top\|breaks\|language\|italics\|bold\|emphasis\|substitute\|omit\|plaintext_wrap\|texpdf_font_mono\|texpdf_font\|stamp\|promo\|ad\|manpage\|home_button_text\|home_button_image\|cover_image\|footer\):\s"
+ syn match sisu_sub_header_notes "^\s\+:\(description\|abstract\|comment\|coverage\|relation\|source\|history\|type\|format\|prefix\|prefix_[ab]\|suffix\):\s"
+
+"% "semantic markers: (ignore)
syn match sisu_sem_marker ";{\|};[a-z._]*[a-z]"
syn match sisu_sem_marker_block "\([a-z][a-z._]*\|\):{\|}:[a-z._]*[a-z]"
syn match sisu_sem_ex_marker ";\[\|\];[a-z._]*[a-z]"
@@ -55,77 +56,125 @@ if !exists("sisu_no_identifiers")
syn match sisu_sem_ex_content contains=sisu_error,sisu_error_wspace,sisu_content_alt,sisu_link,sisu_linked,sisu_break,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker ";\[[^}].\{-}\];[a-z]\+"
endif
-"URLs Numbers And ASCII Codes:
+"% "URLs Numbers And ASCII Codes:
syn match sisu_number "\<\(0x\x\+\|0b[01]\+\|0\o\+\|0\.\d\+\|0\|[1-9][\.0-9_]*\)\>"
syn match sisu_number "?\(\\M-\\C-\|\\c\|\\C-\|\\M-\)\=\(\\\o\{3}\|\\x\x\{2}\|\\\=\w\)"
-"Tuned Error: (is error if not already matched)
+"% "Tuned Error: (is error if not already matched)
syn match sisu_error contains=sisu_error "[\~/\*!_]{\|}[\~/\*!_]"
syn match sisu_error contains=sisu_error "<a href\|</a>]"
-"Simple Paired Enclosed Markup:
+"% "Simple Paired Enclosed Markup:
"url/link
syn region sisu_link contains=sisu_error,sisu_error_wspace matchgroup=sisu_action start="^<<\s*|[a-zA-Z0-9^._-]\+|@|[a-zA-Z0-9^._-]\+|"rs=s+2 end="$"
-"header
+
+"% "Document Header:
+" title
syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_title matchgroup=sisu_header start="^[@]title:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+" creator
syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_creator matchgroup=sisu_header start="^[@]creator:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+" dates
syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_date matchgroup=sisu_header start="^[@]date:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+" publisher
syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_publisher matchgroup=sisu_header start="^[@]publisher:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+" rights
syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_rights matchgroup=sisu_header start="^[@]rights:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+" classify document
syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_classify matchgroup=sisu_header start="^[@]classify:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+" identifier document
+syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_identifier matchgroup=sisu_header start="^[@]identifier:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+" original language (depreciated)
syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_original matchgroup=sisu_header start="^[@]original:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+" notes
syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_notes matchgroup=sisu_header start="^[@]notes:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+" links of interest
syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_linked,sisu_sub_header_links matchgroup=sisu_header start="^[@]links:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+" make, processing instructions
syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_make matchgroup=sisu_header start="^[@]make:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
-"headings
-syn region sisu_heading contains=sisu_mark_endnote,sisu_content_endnote,sisu_marktail,sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_ocn,sisu_error,sisu_error_wspace matchgroup=sisu_structure start="^\([1-8]\|:\?[A-C]\)\~\(\S\+\|[^-]\)" end="$"
-"block/group text
-syn region sisu_content_alt contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^table{.\+" end="}table"
-syn region sisu_content_alt contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^{\(t\|table\)\(\~h\)\?\(\sc[0-9]\+;\)\?[0-9; ]*}" end="\n$"
+
+"% "Headings:
+syn region sisu_heading contains=sisu_mark_endnote,sisu_content_endnote,sisu_marktail,sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_ocn,sisu_error,sisu_error_wspace matchgroup=sisu_structure start="^\([1-8]\|:\?[A-C]\)\~\(\S\+\|[^-]\)" end="$"
+
+"% "Block Group Text:
+" table
+syn region sisu_content_alt contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^table{.\+" end="}table"
+" table
+syn region sisu_content_alt contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^{\(t\|table\)\(\~h\)\?\(\sc[0-9]\+;\)\?[0-9; ]*}" end="\n$"
+" block, group, poem, alt
syn region sisu_content_alt contains=sisu_mark_endnote,sisu_content_endnote,sisu_link,sisu_mark,sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^\(block\|group\|poem\|alt\){" end="^}\(block\|group\|poem\|alt\)"
+" code
syn region sisu_content_alt contains=sisu_error matchgroup=sisu_contain start="^code{" end="^}code"
-"endnotes
-syn region sisu_content_endnote contains=sisu_link,sisu_strikeout,sisu_underline,sisu_number,sisu_control,sisu_identifier,sisu_error,sisu_error_wspace,sisu_mark,sisu_break,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker matchgroup=sisu_mark_endnote start="\~{[*+]*" end="}\~" skip="\n"
-syn region sisu_content_endnote contains=sisu_link,sisu_strikeout,sisu_underline,sisu_number,sisu_control,sisu_identifier,sisu_error,sisu_error_wspace,sisu_mark,sisu_break,sisu_sem_block,sisu_sem_content,sisu_sem_marker matchgroup=sisu_mark_endnote start="\~\[[*+]*" end="\]\~" skip="\n"
-syn region sisu_content_endnote contains=sisu_strikeout,sisu_number,sisu_control,sisu_link,sisu_identifier,sisu_error,sisu_error_wspace,sisu_mark,sisu_break matchgroup=sisu_mark_endnote start="\^\~" end="\n$"
-"links and images
-syn region sisu_linked contains=sisu_fontface,sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker,sisu_sem_block,sisu_error matchgroup=sisu_link start="{\(\~^\s\)\?" end="}\(https\?:/\/\|:\|\.\.\/\|#\)\S\+" oneline
-syn region sisu_linked contains=sisu_fontface,sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker,sisu_sem_block,sisu_error matchgroup=sisu_link start="{\(\~^\s\)\?" end="\[[1-5][sS]*\]}\S\+\.ss[tm]" oneline
-syn region sisu_linked contains=sisu_fontface,sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_link start="{" end="}image" oneline
-"some line operations
-syn region sisu_control contains=sisu_strikeout,sisu_identifier,sisu_content_endnote,sisu_mark_endnote,sisu_error,sisu_error_wspace matchgroup=sisu_control start="\(\(^\| \)!_ \|<:b>\)" end="$"
-syn region sisu_normal contains=sisu_fontface,sisu_control,sisu_identifier,sisu_content_endnote,sisu_mark_endnote,sisu_link,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker,sisu_linked,sisu_error,sisu_error_wspace matchgroup=sisu_markpara start="^_\([1-9*]\|[1-9]\*\) " end="$"
+
+"% "Endnotes:
+" regular endnote or asterisk or plus sign endnote
+syn region sisu_content_endnote contains=sisu_link,sisu_strikeout,sisu_underline,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error,sisu_error_wspace,sisu_mark,sisu_break,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker matchgroup=sisu_mark_endnote start="\~{[*+]*" end="}\~" skip="\n"
+" numbered asterisk or plus sign endnote
+syn region sisu_content_endnote contains=sisu_link,sisu_strikeout,sisu_underline,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error,sisu_error_wspace,sisu_mark,sisu_break,sisu_sem_block,sisu_sem_content,sisu_sem_marker matchgroup=sisu_mark_endnote start="\~\[[*+]*" end="\]\~" skip="\n"
+" endnote content marker (for binary content marking)
+syn region sisu_content_endnote contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_link,sisu_identifier,sisu_error,sisu_error_wspace,sisu_mark,sisu_break matchgroup=sisu_mark_endnote start="\^\~" end="\n$"
+
+"% "Links And Images:
+" image with url link (and possibly footnote of url)
+syn region sisu_linked contains=sisu_fontface,sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker,sisu_sem_block,sisu_error matchgroup=sisu_link start="{\(\~^\s\)\?" end="}\(https\?:/\/\|:\|\.\.\/\|#\)\S\+" oneline
+" sisu outputs, short notation
+syn region sisu_linked contains=sisu_fontface,sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker,sisu_sem_block,sisu_error matchgroup=sisu_link start="{\(\~^\s\)\?" end="\[[1-5][sS]*\]}\S\+\.ss[tm]" oneline
+" image
+syn region sisu_linked contains=sisu_fontface,sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_link start="{" end="}image" oneline
+
+"% "Some Line Operations:
+" bold line
+syn region sisu_bold contains=sisu_strikeout,sisu_identifier,sisu_content_endnote,sisu_mark_endnote,sisu_error,sisu_error_wspace matchgroup=sisu_markpara start="^!_ " end=" \\\\\|$"
+" indent and bullet paragraph
+syn region sisu_normal contains=sisu_fontface,sisu_bold,sisu_control,sisu_identifier,sisu_content_endnote,sisu_mark_endnote,sisu_link,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker,sisu_linked,sisu_error,sisu_error_wspace matchgroup=sisu_markpara start="^_\([1-9*]\|[1-9]\*\) " end="$"
+" indent and bullet (bold start) paragraph
+syn region sisu_bold contains=sisu_fontface,sisu_bold,sisu_control,sisu_identifier,sisu_content_endnote,sisu_mark_endnote,sisu_link,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker,sisu_linked,sisu_error,sisu_error_wspace matchgroup=sisu_markpara start="^_\([1-9*]\|[1-9]\*\)!_\? " end=" \\\\\|$"
+" hanging indent paragraph [proposed]
+syn region sisu_normal contains=sisu_fontface,sisu_bold,sisu_control,sisu_identifier,sisu_content_endnote,sisu_mark_endnote,sisu_link,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker,sisu_linked,sisu_error,sisu_error_wspace matchgroup=sisu_markpara start="^_[0-9]\?_[0-9] " end="$"
+" hanging indent (bold start/ definition) paragraph [proposed]
+syn region sisu_bold contains=sisu_fontface,sisu_bold,sisu_control,sisu_identifier,sisu_content_endnote,sisu_mark_endnote,sisu_link,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker,sisu_linked,sisu_error,sisu_error_wspace matchgroup=sisu_markpara start="^_[0-9]\?_[0-9]!_\? " end=" \\\\\|$"
+" list numbering
syn region sisu_normal contains=sisu_strikeout,sisu_identifier,sisu_content_endnote,sisu_mark_endnote,sisu_link,sisu_linked,sisu_error,sisu_error_wspace matchgroup=sisu_markpara start="^\(#[ 1]\|_# \)" end="$"
-"font face curly brackets
+
+"% "Font Face Curly Brackets:
"syn region sisu_identifier contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_sem start="\S\+:{" end="}:[^<>,.!?:; ]\+" oneline
+" book index:
syn region sisu_index matchgroup=sisu_index_block start="^={" end="}"
-syn region sisu_control contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="\*{" end="}\*"
-syn region sisu_control contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="!{" end="}!"
-syn region sisu_underline contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="_{" end="}_"
-syn region sisu_identifier contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="/{" end="}/"
-syn region sisu_underline contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="+{" end="}+"
-syn region sisu_identifier contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="\^{" end="}\^"
-syn region sisu_identifier contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start=",{" end="},"
-syn region sisu_identifier contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="#{" end="}#"
+" emphasis:
+syn region sisu_bold contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="\*{" end="}\*"
+" bold:
+syn region sisu_bold contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="!{" end="}!"
+" underscore:
+syn region sisu_underline contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="_{" end="}_"
+" italics:
+syn region sisu_identifier contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="/{" end="}/"
+" added:
+syn region sisu_underline contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="+{" end="}+"
+" superscript:
+syn region sisu_identifier contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="\^{" end="}\^"
+" subscript:
+syn region sisu_identifier contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start=",{" end="},"
+" monospace:
+syn region sisu_identifier contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="#{" end="}#"
+" strikethrough:
syn region sisu_strikeout contains=sisu_error matchgroup=sisu_fontface start="-{" end="}-"
-syn region sisu_html contains=sisu_error contains=sisu_strikeout matchgroup=sisu_contain start="<a href=\".\{-}\">" end="</a>" oneline
-"single words bold italicise etc. "workon
-syn region sisu_control contains=sisu_error matchgroup=sisu_control start="\([ (]\|^\)\*[^\|{\n\~\\]"hs=e-1 end="\*"he=e-0 skip="[a-zA-Z0-9']" oneline
+
+"% "Single Words Bold Italicise Etc: (depreciated)
+syn region sisu_bold contains=sisu_error matchgroup=sisu_bold start="\([ (]\|^\)\*[^\|{\n\~\\]"hs=e-1 end="\*"he=e-0 skip="[a-zA-Z0-9']" oneline
syn region sisu_identifier contains=sisu_error matchgroup=sisu_content_alt start="\([ ]\|^\)/[^{ \|\n\\]"hs=e-1 end="/\[ \.\]" skip="[a-zA-Z0-9']" oneline
"misc
syn region sisu_identifier contains=sisu_error matchgroup=sisu_fontface start="\^[^ {\|\n\\]"rs=s+1 end="\^[ ,.;:'})\\\n]" skip="[a-zA-Z0-9']" oneline
-"Expensive Mode:
+"% "Expensive Mode:
if !exists("sisu_no_expensive")
else " not Expensive
syn region sisu_content_alt matchgroup=sisu_control start="^\s*def\s" matchgroup=NONE end="[?!]\|\>" skip="\.\|\(::\)" oneline
endif " Expensive?
-"Headers And Headings: (Document Instructions)
+"% "Headers And Headings: (Document Instructions)
syn match sisu_control contains=sisu_error,sisu_error_wspace "4\~! \S\+"
syn region sisu_markpara contains=sisu_error,sisu_error_wspace start="^=begin" end="^=end.*$"
-"Errors:
+"% "Errors:
syn match sisu_error_wspace contains=sisu_error_wspace "^\s\+[^:]"
syn match sisu_error_wspace contains=sisu_error_wspace "\s\s\+"
syn match sisu_error_wspace contains=sisu_error_wspace "\s\+$"
@@ -149,16 +198,17 @@ syn match sisu_error contains=sisu_error "<dir>"
syn match sisu_error contains=sisu_error,sisu_match,sisu_strikeout,sisu_contain,sisu_content_alt,sisu_mark,sisu_break,sisu_number "<[a-zA-Z\/]\+>"
syn match sisu_error "/\?<\([biu]\)>[^(</\1>)]\{-}\n$"
-"Error Exceptions:
+"% "Error Exceptions:
syn match sisu_control "\n$" "contains=ALL
-syn match sisu_control " //"
+"syn match sisu_control " //"
syn match sisu_error "%{"
syn match sisu_error "<br>_\?https\?:\S\+\|_\?https\?:\S\+<br>"
syn match sisu_error "[><]_\?https\?:\S\+\|_\?https\?:\S\+[><]"
syn match sisu_comment "^%\{1,2\}.\+"
-"Definitions Default Highlighting:
+"% "Definitions Default Highlighting:
hi def link sisu_normal Normal
+hi def link sisu_bold Statement
hi def link sisu_header PreProc
hi def link sisu_header_content Normal
hi def link sisu_sub_header_title Statement
@@ -167,6 +217,7 @@ hi def link sisu_sub_header_date Statement
hi def link sisu_sub_header_publisher Statement
hi def link sisu_sub_header_rights Statement
hi def link sisu_sub_header_classify Statement
+hi def link sisu_sub_header_identifier Statement
hi def link sisu_sub_header_original Statement
hi def link sisu_sub_header_links Statement
hi def link sisu_sub_header_notes Statement
diff --git a/data/sisu/v4/conf/editor-syntax-etc/vim/syntax/sisu_next.vim b/data/sisu/v4/conf/editor-syntax-etc/vim/syntax/sisu_next.vim
new file mode 100644
index 00000000..257e1cba
--- /dev/null
+++ b/data/sisu/v4/conf/editor-syntax-etc/vim/syntax/sisu_next.vim
@@ -0,0 +1,281 @@
+" SiSU Vim syntax file
+" SiSU Maintainer: Ralph Amissah <ralph@amissah.com>
+" SiSU Markup: SiSU (sisu-3.1.0)
+" Last Change: 2011-10-03
+" URL: <http://git.sisudoc.org/?p=code/sisu.git;a=blob;f=data/sisu/v3/conf/editor-syntax-etc/vim/syntax/sisu.vim;hb=HEAD>
+"(originally looked at Ruby Vim by Mirko Nasato)
+
+if version < 600
+ syntax clear
+elseif exists("b:current_syntax")
+ finish
+else
+endif
+let s:cpo_save = &cpo
+set cpo&vim
+
+"% "Errors:
+syn match sisu_error contains=sisu_link,sisu_error_wspace "<![^ei]\S\+!>"
+
+"% "Markers Identifiers:
+if !exists("sisu_no_identifiers")
+ syn match sisu_mark_endnote "\~^"
+ syn match sisu_break contains=@NoSpell " \\\\\( \|$\)"
+ syn match sisu_break contains=@NoSpell "<br>\|<br />"
+ syn match sisu_control contains=@NoSpell "^<:p[bn]>\s*$"
+ "syn match sisu_control contains=@NoSpell "^<\(br\)\?:\(pg\|pgn\|pn\)>\s*$"
+ "syn match sisu_control contains=@NoSpell "^\[\(br\)\?:\(pg\|pgn\|pn\)\]\s*$"
+ syn match sisu_control contains=@NoSpell "^<:\(bo\|---\)>\s*$"
+ "syn match sisu_control contains=@NoSpell "^<\(br\)\?:\(pr\|o\)>\s*$"
+ "syn match sisu_control contains=@NoSpell "^\[\(br\)\?:\(pr\|o\)\]\s*$"
+ syn match sisu_marktail "[~-]#"
+ syn match sisu_control "\""
+ syn match sisu_underline "\(^\| \)_[a-zA-Z0-9]\+_\([ .,]\|$\)"
+ syn match sisu_number contains=@NoSpell "[0-9a-f]\{32\}\|[0-9a-f]\{64\}"
+ syn match sisu_link contains=@NoSpell "\(_\?https\?://\|\.\.\/\)\S\+"
+ syn match sisu_link " \*\~\S\+"
+ syn match sisu_action "^<:insert\d\+>"
+ syn match sisu_require contains=@NoSpell "^<<\s*[a-zA-Z0-9^._-]\+\.ss[it]$"
+ syn match sisu_require contains=@NoSpell "^<<{[a-zA-Z0-9^._-]\+\.ss[it]}$"
+ syn match sisu_structure "^:A\~$"
+
+"% "Document Sub Headers:
+ syn match sisu_sub_header_title "^\s\+:\(subtitle\|short\|edition\|language\|lang_char\|note\):\s" "group=sisu_header_content
+ syn match sisu_sub_header_creator "^\s\+:\(author\|editor\):\s" " &hon &institution
+ syn match sisu_sub_header_contributor "^\s\+:\(editor\|translator\|illustrator\|photographer\|audio\|video\|prepared_by\|digitized_by\):\s"
+ syn match sisu_sub_header_rights "^\s\+:\(copyright\|text\|translation\|illustrations\|photographs\|preparation\|digitization\|audio\|video\|license\|all\):\s" " access_rights license
+ syn match sisu_sub_header_classify "^\s\+:\(topic_register\|coverage\|identifier\|keywords\|relation\|subject\|type\|dewey\|loc\):\s"
+ syn match sisu_sub_header_identify "^\s\+:\(isbn\|urn\|oclc\|pg\):\s"
+ syn match sisu_sub_header_format "^\s\+:\(mimetype\):\s"
+ syn match sisu_sub_header_date "^\s\+:\(added_to_site\|available\|created\|issued\|modified\|published\|valid\|translated\|original_publication\):\s"
+ syn match sisu_sub_header_original "^\s\+:\(publisher\|date\|language\|lang_char\|institution\|nationality\|source\):\s"
+ syn match sisu_sub_header_make "^\s\+:\(headings\|num_top\|breaks\|language\|italics\|bold\|emphasis\|plaintext_wrap\|texpdf_font_mono\|texpdf_font\|skin\|stamp\|promo\|ad\|manpage\):\s"
+ syn match sisu_sub_header_notes "^\s\+:\(abstract\|comment\|description\|history\|prefix\|prefix_[ab]\|suffix\):\s"
+
+"% "semantic markers: (ignore)
+ syn match sisu_sem_marker ";{\|};[a-z._]*[a-z]"
+ syn match sisu_sem_marker_block "\([a-z][a-z._]*\|\):{\|}:[a-z._]*[a-z]"
+ syn match sisu_sem_ex_marker ";\[\|\];[a-z._]*[a-z]"
+ syn match sisu_sem_ex_marker_block "\([a-z][a-z._]*\|\):\[\|\]:[a-z._]*[a-z]"
+ syn match sisu_sem_block contains=sisu_error,sisu_error_wspace,sisu_content_alt,sisu_link,sisu_linked,sisu_break,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker,sisu_mark_endnote,sisu_content_endnote "\([a-z]*\):{[^}].\{-}}:\1"
+ syn match sisu_sem_content contains=sisu_error,sisu_error_wspace,sisu_content_alt,sisu_link,sisu_linked,sisu_break,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker ";{[^}].\{-}};[a-z]\+"
+ syn match sisu_sem_ex_block contains=sisu_error,sisu_error_wspace,sisu_content_alt,sisu_link,sisu_linked,sisu_break,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker,sisu_mark_endnote,sisu_content_endnote "\([a-z]*\):\[[^}].\{-}\]:\1"
+ syn match sisu_sem_ex_content contains=sisu_error,sisu_error_wspace,sisu_content_alt,sisu_link,sisu_linked,sisu_break,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker ";\[[^}].\{-}\];[a-z]\+"
+endif
+
+"% "URLs Numbers And ASCII Codes:
+syn match sisu_number "\<\(0x\x\+\|0b[01]\+\|0\o\+\|0\.\d\+\|0\|[1-9][\.0-9_]*\)\>"
+syn match sisu_number "?\(\\M-\\C-\|\\c\|\\C-\|\\M-\)\=\(\\\o\{3}\|\\x\x\{2}\|\\\=\w\)"
+
+"% "Tuned Error: (is error if not already matched)
+syn match sisu_error contains=sisu_error "[\~/\*!_]{\|}[\~/\*!_]"
+syn match sisu_error contains=sisu_error "<a href\|</a>]"
+
+"% "Simple Paired Enclosed Markup:
+"url/link
+syn region sisu_link contains=sisu_error,sisu_error_wspace matchgroup=sisu_action start="^<<\s*|[a-zA-Z0-9^._-]\+|@|[a-zA-Z0-9^._-]\+|"rs=s+2 end="$"
+
+"% "Document Header:
+" title
+syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_title matchgroup=sisu_header start="^[@]title:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+" creator
+syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_creator matchgroup=sisu_header start="^[@]creator:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+" contributor
+syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_contributor matchgroup=sisu_header start="^[@]contributor:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+" dates
+syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_date matchgroup=sisu_header start="^[@]date:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+" publisher
+syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_publisher matchgroup=sisu_header start="^[@]publisher:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+" rights
+syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_rights matchgroup=sisu_header start="^[@]rights:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+" classify document
+syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_classify matchgroup=sisu_header start="^[@]classify:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+" identifier
+syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_identifier matchgroup=sisu_header start="^[@]identifier:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+" format
+syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_format matchgroup=sisu_header start="^[@]format:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+" original language (depreciated)
+syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_original matchgroup=sisu_header start="^[@]original:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+" notes
+syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_notes matchgroup=sisu_header start="^[@]notes:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+" links of interest
+syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_linked,sisu_sub_header_links matchgroup=sisu_header start="^[@]links:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+" make, processing instructions
+syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_make matchgroup=sisu_header start="^[@]make:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$"
+
+"% "Headings:
+syn region sisu_heading contains=sisu_mark_endnote,sisu_content_endnote,sisu_marktail,sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_ocn,sisu_error,sisu_error_wspace matchgroup=sisu_structure start="^\([1-8]\|:\?[A-C]\)\~\(\S\+\|[^-]\)" end="$"
+
+"% "Block Group Text:
+" table
+syn region sisu_content_alt contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^table{.\+" end="}table"
+" table
+syn region sisu_content_alt contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^{\(t\|table\)\(\~h\)\?\(\sc[0-9]\+;\)\?[0-9; ]*}" end="\n$"
+" block, group, poem, alt
+syn region sisu_content_alt contains=sisu_mark_endnote,sisu_content_endnote,sisu_link,sisu_mark,sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^\(block\|group\|poem\|alt\){" end="^}\(block\|group\|poem\|alt\)"
+" code
+syn region sisu_content_alt contains=sisu_error matchgroup=sisu_contain start="^code{" end="^}code"
+
+"% "Endnotes:
+" regular endnote or asterisk or plus sign endnote
+syn region sisu_content_endnote contains=sisu_link,sisu_strikeout,sisu_underline,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error,sisu_error_wspace,sisu_mark,sisu_break,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker matchgroup=sisu_mark_endnote start="\~{[*+]*" end="}\~" skip="\n"
+" numbered asterisk or plus sign endnote
+syn region sisu_content_endnote contains=sisu_link,sisu_strikeout,sisu_underline,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error,sisu_error_wspace,sisu_mark,sisu_break,sisu_sem_block,sisu_sem_content,sisu_sem_marker matchgroup=sisu_mark_endnote start="\~\[[*+]*" end="\]\~" skip="\n"
+" endnote content marker (for binary content marking)
+syn region sisu_content_endnote contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_link,sisu_identifier,sisu_error,sisu_error_wspace,sisu_mark,sisu_break matchgroup=sisu_mark_endnote start="\^\~" end="\n$"
+
+"% "Links And Images:
+" image with url link (and possibly footnote of url)
+syn region sisu_linked contains=sisu_fontface,sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker,sisu_sem_block,sisu_error matchgroup=sisu_link start="{\(\~^\s\)\?" end="}\(https\?:/\/\|:\|\.\.\/\|#\)\S\+" oneline
+" sisu outputs, short notation
+syn region sisu_linked contains=sisu_fontface,sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker,sisu_sem_block,sisu_error matchgroup=sisu_link start="{\(\~^\s\)\?" end="\[[1-5][sS]*\]}\S\+\.ss[tm]" oneline
+" image
+syn region sisu_linked contains=sisu_fontface,sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_link start="{" end="}image" oneline
+
+"% "Some Line Operations:
+" bold line
+syn region sisu_bold contains=sisu_strikeout,sisu_identifier,sisu_content_endnote,sisu_mark_endnote,sisu_error,sisu_error_wspace matchgroup=sisu_markpara start="^!_ " end=" \\\\\|$"
+" indent and bullet paragraph
+syn region sisu_normal contains=sisu_fontface,sisu_bold,sisu_control,sisu_identifier,sisu_content_endnote,sisu_mark_endnote,sisu_link,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker,sisu_linked,sisu_error,sisu_error_wspace matchgroup=sisu_markpara start="^_\([1-9*]\|[1-9]\*\) " end="$"
+" indent and bullet (bold start) paragraph
+syn region sisu_bold contains=sisu_fontface,sisu_bold,sisu_control,sisu_identifier,sisu_content_endnote,sisu_mark_endnote,sisu_link,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker,sisu_linked,sisu_error,sisu_error_wspace matchgroup=sisu_markpara start="^_\([1-9*]\|[1-9]\*\)!_\? " end=" \\\\\|$"
+" hanging indent paragraph [proposed]
+syn region sisu_normal contains=sisu_fontface,sisu_bold,sisu_control,sisu_identifier,sisu_content_endnote,sisu_mark_endnote,sisu_link,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker,sisu_linked,sisu_error,sisu_error_wspace matchgroup=sisu_markpara start="^_[0-9]\?_[0-9] " end="$"
+" hanging indent (bold start/ definition) paragraph [proposed]
+syn region sisu_bold contains=sisu_fontface,sisu_bold,sisu_control,sisu_identifier,sisu_content_endnote,sisu_mark_endnote,sisu_link,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker,sisu_linked,sisu_error,sisu_error_wspace matchgroup=sisu_markpara start="^_[0-9]\?_[0-9]!_\? " end=" \\\\\|$"
+" list numbering
+syn region sisu_normal contains=sisu_strikeout,sisu_identifier,sisu_content_endnote,sisu_mark_endnote,sisu_link,sisu_linked,sisu_error,sisu_error_wspace matchgroup=sisu_markpara start="^\(#[ 1]\|_# \)" end="$"
+
+"% "Font Face Curly Brackets:
+"syn region sisu_identifier contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_sem start="\S\+:{" end="}:[^<>,.!?:; ]\+" oneline
+" book index:
+syn region sisu_index matchgroup=sisu_index_block start="^={" end="}"
+" emphasis:
+syn region sisu_bold contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="\*{" end="}\*"
+" bold:
+syn region sisu_bold contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="!{" end="}!"
+" underscore:
+syn region sisu_underline contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="_{" end="}_"
+" italics:
+syn region sisu_identifier contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="/{" end="}/"
+" added:
+syn region sisu_underline contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="+{" end="}+"
+" superscript:
+syn region sisu_identifier contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="\^{" end="}\^"
+" subscript:
+syn region sisu_identifier contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start=",{" end="},"
+" monospace:
+syn region sisu_identifier contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="#{" end="}#"
+" strikethrough:
+syn region sisu_strikeout contains=sisu_error matchgroup=sisu_fontface start="-{" end="}-"
+" (depreciated remove, consider marking as error):
+" syn region sisu_html contains=sisu_error contains=sisu_strikeout matchgroup=sisu_contain start="<a href=\".\{-}\">" end="</a>" oneline
+
+"% "Single Words Bold Italicise Etc: (depreciated)
+syn region sisu_bold contains=sisu_error matchgroup=sisu_bold start="\([ (]\|^\)\*[^\|{\n\~\\]"hs=e-1 end="\*"he=e-0 skip="[a-zA-Z0-9']" oneline
+syn region sisu_identifier contains=sisu_error matchgroup=sisu_content_alt start="\([ ]\|^\)/[^{ \|\n\\]"hs=e-1 end="/\[ \.\]" skip="[a-zA-Z0-9']" oneline
+"misc
+syn region sisu_identifier contains=sisu_error matchgroup=sisu_fontface start="\^[^ {\|\n\\]"rs=s+1 end="\^[ ,.;:'})\\\n]" skip="[a-zA-Z0-9']" oneline
+
+"% "Expensive Mode:
+if !exists("sisu_no_expensive")
+else " not Expensive
+ syn region sisu_content_alt matchgroup=sisu_control start="^\s*def\s" matchgroup=NONE end="[?!]\|\>" skip="\.\|\(::\)" oneline
+endif " Expensive?
+
+"% "Headers And Headings: (Document Instructions)
+syn match sisu_control contains=sisu_error,sisu_error_wspace "4\~! \S\+"
+syn region sisu_markpara contains=sisu_error,sisu_error_wspace start="^=begin" end="^=end.*$"
+
+"% "Errors:
+syn match sisu_error_wspace contains=sisu_error_wspace "^\s\+[^:]"
+syn match sisu_error_wspace contains=sisu_error_wspace "\s\s\+"
+"syn match sisu_error_wspace contains=sisu_error_wspace "\s\s\+\|\t\+"
+syn match sisu_error_wspace contains=sisu_error_wspace "\s\+$"
+syn match sisu_error contains=sisu_error_wspace "\t\+"
+syn match sisu_error contains=sisu_error,sisu_error_wspace "\([^ (][_\\]\||[^ (}]\)https\?:\S\+"
+syn match sisu_error contains=sisu_error "_\?https\?:\S\+[}><]"
+syn match sisu_error contains=sisu_error "\([!*/_\+,^]\){\([^(\}\1)]\)\{-}\n$"
+syn match sisu_error contains=sisu_error "^[\~]{[^{]\{-}\n$"
+syn match sisu_error contains=sisu_error "\s\+.{{"
+syn match sisu_error contains=sisu_error "^\~\s*$"
+syn match sisu_error contains=sisu_error "^0\~.*"
+syn match sisu_error contains=sisu_error "^[1-9]\~\s*$"
+syn match sisu_error contains=sisu_error "^[1-9]\~\S\+\s*$"
+syn match sisu_error contains=sisu_error "[^{]\~\^[^ \)]"
+syn match sisu_error contains=sisu_error "\~\^\s\+\.\s*"
+syn match sisu_error contains=sisu_error "{\~^\S\+"
+syn match sisu_error contains=sisu_error "[_/\*!^]{[ .,:;?><]*}[_/\*!^]"
+syn match sisu_error contains=sisu_error "[^ (\"'(\[][_/\*!]{\|}[_/\*!][a-zA-Z0-9)\]\"']"
+syn match sisu_error contains=sisu_error "<dir>"
+"errors for filetype sisu, though not error in 'metaverse':
+syn match sisu_error contains=sisu_error,sisu_match,sisu_strikeout,sisu_contain,sisu_content_alt,sisu_mark,sisu_break,sisu_number "<[a-zA-Z\/]\+>"
+syn match sisu_error "/\?<\([biu]\)>[^(</\1>)]\{-}\n$"
+
+"% "Error Exceptions:
+syn match sisu_control "\n$" "contains=ALL
+"syn match sisu_control " //"
+syn match sisu_error "%{"
+syn match sisu_error "<br>_\?https\?:\S\+\|_\?https\?:\S\+<br>"
+syn match sisu_error "[><]_\?https\?:\S\+\|_\?https\?:\S\+[><]"
+syn match sisu_comment "^%\{1,2\}.\+"
+
+"% "Definitions Default Highlighting:
+hi def link sisu_normal Normal
+hi def link sisu_bold Statement
+hi def link sisu_header PreProc
+hi def link sisu_header_content Normal
+hi def link sisu_sub_header_title Statement
+hi def link sisu_sub_header_creator Statement
+hi def link sisu_sub_header_date Statement
+hi def link sisu_sub_header_publisher Statement
+hi def link sisu_sub_header_rights Statement
+hi def link sisu_sub_header_classify Statement
+hi def link sisu_sub_header_original Statement
+hi def link sisu_sub_header_links Statement
+hi def link sisu_sub_header_notes Statement
+hi def link sisu_sub_header_make Statement
+hi def link sisu_heading Title
+hi def link sisu_structure Operator
+hi def link sisu_contain Include
+hi def link sisu_mark_endnote Delimiter
+"hi def link sisu_mark_endnote Include
+hi def link sisu_require NonText
+hi def link sisu_link NonText
+hi def link sisu_linked String
+hi def link sisu_fontface Delimiter
+"hi def link sisu_fontface Include
+hi def link sisu_strikeout DiffDelete
+hi def link sisu_content_alt Special
+hi def link sisu_sem_content SpecialKey
+hi def link sisu_sem_block Special
+hi def link sisu_sem_marker Visual
+"hi def link sisu_sem_marker Structure
+hi def link sisu_sem_marker_block MatchParen
+hi def link sisu_sem_ex_marker FoldColumn
+hi def link sisu_sem_ex_marker_block Folded
+hi def link sisu_sem_ex_content Comment
+"hi def link sisu_sem_ex_content SpecialKey
+hi def link sisu_sem_ex_block Comment
+hi def link sisu_index SpecialKey
+hi def link sisu_index_block Visual
+hi def link sisu_content_endnote Special
+hi def link sisu_control Delimiter
+"hi def link sisu_control Define
+hi def link sisu_ocn Include
+hi def link sisu_number Number
+hi def link sisu_identifier Function
+hi def link sisu_underline Underlined
+hi def link sisu_markpara Include
+hi def link sisu_marktail Include
+hi def link sisu_mark Identifier
+hi def link sisu_break Structure
+hi def link sisu_html Type
+hi def link sisu_action Identifier
+hi def link sisu_comment Comment
+hi def link sisu_error_sem_marker Error
+hi def link sisu_error_wspace Error
+hi def link sisu_error Error
+let b:current_syntax = "sisu"
+let &cpo = s:cpo_save
+unlet s:cpo_save
diff --git a/data/sisu/v2/conf/editor-syntax-etc/vim/templates/ssi.tpl b/data/sisu/v4/conf/editor-syntax-etc/vim/templates/ssi.tpl
index a101dee6..a101dee6 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/vim/templates/ssi.tpl
+++ b/data/sisu/v4/conf/editor-syntax-etc/vim/templates/ssi.tpl
diff --git a/data/sisu/v2/conf/editor-syntax-etc/vim/templates/ssm.tpl b/data/sisu/v4/conf/editor-syntax-etc/vim/templates/ssm.tpl
index cbda5053..cbda5053 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/vim/templates/ssm.tpl
+++ b/data/sisu/v4/conf/editor-syntax-etc/vim/templates/ssm.tpl
diff --git a/data/sisu/v2/conf/editor-syntax-etc/vim/templates/sst.tpl b/data/sisu/v4/conf/editor-syntax-etc/vim/templates/sst.tpl
index dd19efb4..dd19efb4 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/vim/templates/sst.tpl
+++ b/data/sisu/v4/conf/editor-syntax-etc/vim/templates/sst.tpl
diff --git a/data/sisu/v2/conf/editor-syntax-etc/vim/vim-sisu.yaml b/data/sisu/v4/conf/editor-syntax-etc/vim/vim-sisu.yaml
index ca665bc8..ca665bc8 100644
--- a/data/sisu/v2/conf/editor-syntax-etc/vim/vim-sisu.yaml
+++ b/data/sisu/v4/conf/editor-syntax-etc/vim/vim-sisu.yaml
diff --git a/data/sisu/v2/conf/lighttpd/lighttpd.cfg.sisu b/data/sisu/v4/conf/lighttpd/lighttpd.cfg.sisu
index 6647de9f..6647de9f 100644
--- a/data/sisu/v2/conf/lighttpd/lighttpd.cfg.sisu
+++ b/data/sisu/v4/conf/lighttpd/lighttpd.cfg.sisu
diff --git a/data/sisu/v2/conf/lighttpd/lighttpd.cfg.sisu_www b/data/sisu/v4/conf/lighttpd/lighttpd.cfg.sisu_www
index 0dd16c94..0dd16c94 100644
--- a/data/sisu/v2/conf/lighttpd/lighttpd.cfg.sisu_www
+++ b/data/sisu/v4/conf/lighttpd/lighttpd.cfg.sisu_www
diff --git a/data/sisu/v2/conf/ruby/irbrc b/data/sisu/v4/conf/ruby/irbrc
index cceffdfc..cceffdfc 100644
--- a/data/sisu/v2/conf/ruby/irbrc
+++ b/data/sisu/v4/conf/ruby/irbrc
diff --git a/data/sisu/v4/v/version.yml b/data/sisu/v4/v/version.yml
new file mode 100644
index 00000000..f851e32c
--- /dev/null
+++ b/data/sisu/v4/v/version.yml
@@ -0,0 +1,5 @@
+---
+:version: 4.0.0
+:date_stamp: 2012w50/3
+:date: "2012-12-12"
+:project: SiSU
diff --git a/lib/sisu/v2/character_encoding.rb b/lib/sisu/v2/character_encoding.rb
deleted file mode 100644
index 5d19a61f..00000000
--- a/lib/sisu/v2/character_encoding.rb
+++ /dev/null
@@ -1,379 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: modules related to locales, character encoding for different
- output generators [requires kirbybase]
-
-=end
-module SiSU_character_encode
- require 'kirbybase'
- require "#{SiSU_lib}/sysenv" # sysenv.rb
- class Characters
- attr_accessor(:character_encoding,:glyph,:dec,:hex,:rb,:html,:html_name,:tex,:tex_licr,:tex_alt,:name)
- def initialize(&block)
- instance_eval(&block)
- end
- end
- class Create <Characters
- def initialize
- #NOTE places character_encoding.tbl in correct subdirectory ./_sisu_processing/encoding
- @db=KirbyBase.new #default database location, pwd
- @ce_tbl=@db.create_table.documents(:character_encoding, :glyph,:String, :dec,:Integer, :hex,:String, :rb,:String, :html,:String, :html_name,:String, :tex,:String, :tex_licr,:String, :tex_alt,:String, :name,:String)
- end
- def db
- x=Character_encoding.new.table
- #x.each {|y| puts y[2].inspect}
- x.each do |c|
- #puts "#{c[0]}, #{c[1]}, #{c[2]}, #{c[3]}, #{c[4]}, #{c[5]}, #{c[6]}, #{c[7]}, #{c[8]}, #{c[9]}"
- @ce_tbl.insert(c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], c[8], c[9])
- end
- end
- end
- class Query
- def initialize(find='',show='')
- #NOTE character_encoding.tbl not read from subdirectory ./_sisu_processing/encoding
- @db=KirbyBase.new #default database location, pwd
- @ce_tbl=@db.get_table(:character_encoding)
- @find=find
- end
- def selected(selected,show)
- @y=[]
- selected.each do |x|
- @y<<case show
- when 'glyph'; x.glyph
- when 'dec'; x.dec
- when 'hex'; x.hex
- when 'rb'; x.rb
- when 'html'; x.html
- when 'html_name'; x.html_name
- when 'tex'; x.tex
- when 'ot1'; x.ot1
- when 'ts1'; x.ts1
- when 'name'; x.name
- else x.hex
- end
- end
- #@ce_tbl.select(:glyph,:name) { |r| r.hex==hex }.each do |r|
- # puts '%s %s' % [r.glyph, r.name]
- #end
- #:glyph,:dec,:hex,:rb,:html,:html_name,:tex,:tex_licr,:tex_alt,:name
- #list=['number','glyph','html','hex','rb','tex','ot1','ts1','name']
- end
- def hex(hex,show)
- select=@ce_tbl.select(:glyph,:dec,:hex,:rb,:html,:html_name,:tex,:tex_licr,:tex_alt,:name) { |r| r.hex==hex }
- selected(select,show)
- @y
- end
- def dec(dec,show)
- select=@ce_tbl.select(:glyph,:dec,:hex,:rb,:html,:html_name,:tex,:tex_licr,:tex_alt,:name) { |r| r.dec==dec }
- selected(select,show)
- @y
- end
- def name(name,show)
- select=@ce_tbl.select(:glyph,:dec,:hex,:rb,:html,:html_name,:tex,:tex_licr,:tex_alt,:name) { |r| r.name =~ /#{name}/ }
- selected(select,show)
- @y
- end
- def report
- puts @ce_tbl.select(:glyph,:dec,:hex,:rb,:html,:html_name,:tex,:tex_licr,:tex_alt,:name).to_report
- end
- def table
- selected=@ce_tbl.select
- #selected=@ce_tbl.select(:glyph,:dec,:hex,:rb,:html,:html_name,:tex,:tex_licr,:tex_alt,:name)
- selected.each do |c|
- puts '%s %s %s %s %s %s %s %s %s %s' % [c.glyph,c.dec,c.hex,c.rb,c.html,c.html_name,c.tex,c.tex_licr,c.tex_alt,c.name]
- #puts "#{c.glyph}, #{c.dec}, #{c.hex}, #{c.rb}, #{c.html}, #{c.name}, #{c.tex}, #{c.tec_licr}, #{c.tex_alt}, #{c.c_name}"
- end
- end
- end
- class Character_encoding
- def table
- x=[]
-#:glyph, :dec,:hex, :rb, :xml , :html_name, :tex, :tex_licr, :tex_alt, :name
- x=[
- ['', 9, '', '', '&#009;', nil, '', '', '', 'Horizontal tab' ],
- ['', 15, '', '', '&#015;', nil, '', '', '', 'Line feed' ],
- ['', 17, '', '', '&#017;', nil, '', '', '', 'Carriage return' ],
- [' ', 32, '40', '\40', '&#032;', nil, '', '', '', 'Space' ],
- ['!', 33, '41', '\41', '&#033;', nil, '!', '!', '!', 'Punctuation Exclamation !' ],
- ['', 34, '42', '\42', '&#034;', '&quot;', '', '', '', 'Punctuation Quotation mark' ],
- ['#', 35, '43', '\43', '&#035;', nil, '{\#}', '\#', '', 'Hash mark #' ],
- ['$', 36, '44', '\44', '&#036;', nil, '{\$}', '\textdollar', '', 'Dollar sign $' ],
- ['%', 37, '45', '\45', '&#037;', nil, '{\%}', '\%', '', 'Percent sign %' ],
- ['&', 38, '46', '\46', '&#038;', '&amp;', '{\&}', '\&', '', 'Ampersand &' ],
- ['\'', 39, '47', '\47', '&#039;', nil, '', '', '', 'Apostrophe \''],
- ['(', 40, '50', '\50', '&#040;', nil, '', '', '', 'Left parenthesis (' ],
- [')', 41, '51', '\51', '&#041;', nil, '', '', '', 'Right parenthesis )' ],
- ['*', 42, '52', '\52', '&#042;', nil, '', '', '', 'Asterisk *' ],
- ['+', 43, '53', '\53', '&#043;', nil, '', '', '', 'Plus sign +' ],
- [',', 44, '54', '\54', '&#044;', nil, ',', ',', ',', 'Puncutation Comma ,' ],
- ['-', 45, '55', '\55', '&#045;', nil, '-', '-', '-', 'Puncutation Hyphen -' ],
- ['.', 46, '56', '\56', '&#046;', nil, '.', '.', '.', 'Puncutation Period .' ],
- ['/', 47, '57', '\57', '&#047;', nil, '/', '/', '/', 'Puncutation Slash /' ],
- ['0', 48, '60', '\60', '&#048;', nil, '0', '0', '0', 'Digit zero 0' ],
- ['1', 49, '61', '\61', '&#049;', nil, '1', '1', '1', 'Digit one 1' ],
- ['2', 50, '62', '\62', '&#050;', nil, '2', '2', '2', 'Digit two 2' ],
- ['3', 51, '63', '\63', '&#051;', nil, '3', '3', '3', 'Digit three 3' ],
- ['4', 52, '64', '\64', '&#052;', nil, '4', '4', '4', 'Digit four 4' ],
- ['5', 53, '65', '\65', '&#053;', nil, '5', '5', '5', 'Digit five 5' ],
- ['6', 54, '66', '\66', '&#054;', nil, '6', '6', '6', 'Digit six 6' ],
- ['7', 55, '67', '\67', '&#055;', nil, '7', '7', '7', 'Digit seven 7' ],
- ['8', 56, '70', '\70', '&#056;', nil, '8', '8', '8', 'Digit eight 8' ],
- ['9', 57, '71', '\71', '&#057;', nil, '9', '9', '9', 'Digit nine 9' ],
- [':', 58, '72', '\72', '&#058;', nil, '', '', '', 'Punctuation Colon :' ],
- [';', 59, '73', '\73', '&#059;', nil, '', '', '', 'Punctuation Semicolon ;' ],
- ['<', 60, '74', '\74', '&#060;', '&lt;', '', '', '', 'Less than <' ],
- ['=', 61, '75', '\75', '&#061;', nil, '', '', '', 'Equals sign =' ],
- ['>', 62, '76', '\76', '&#062;', '&gt;', '', '', '', 'Greater than >' ],
- ['?', 63, '77', '\77', '&#063;', nil, '?', '?', '?', 'Punctuation Question mark ?' ],
- ['@', 64, '100', '\100', '&#064;', nil, '', '', '', 'Commercial at sign @' ],
- ['A', 65, '101', '\101', '&#065;', nil, 'A', 'A', 'A', 'Captial A' ],
- ['B', 66, '102', '\102', '&#066;', nil, 'B', 'B', 'B', 'Captial B' ],
- ['C', 67, '103', '\103', '&#067;', nil, 'C', 'C', 'C', 'Captial C' ],
- ['D', 68, '104', '\104', '&#068;', nil, 'D', 'D', 'D', 'Captial D' ],
- ['E', 69, '105', '\105', '&#069;', nil, 'E', 'E', 'E', 'Captial E' ],
- ['F', 70, '106', '\106', '&#070;', nil, 'F', 'F', 'F', 'Captial F' ],
- ['G', 71, '107', '\107', '&#071;', nil, 'G', 'G', 'G', 'Captial G' ],
- ['H', 72, '110', '\110', '&#072;', nil, 'H', 'H', 'H', 'Captial H' ],
- ['I', 73, '111', '\111', '&#073;', nil, 'I', 'I', 'I', 'Captial I' ],
- ['J', 74, '112', '\112', '&#074;', nil, 'J', 'J', 'J', 'Captial J' ],
- ['K', 75, '113', '\113', '&#075;', nil, 'K', 'K', 'K', 'Captial K' ],
- ['L', 76, '114', '\114', '&#076;', nil, 'L', 'L', 'L', 'Captial L' ],
- ['M', 77, '115', '\115', '&#077;', nil, 'M', 'M', 'M', 'Captial M' ],
- ['N', 78, '116', '\116', '&#078;', nil, 'N', 'N', 'N', 'Captial N' ],
- ['O', 79, '117', '\117', '&#079;', nil, 'O', 'O', 'O', 'Captial O' ],
- ['P', 80, '120', '\120', '&#080;', nil, 'P', 'P', 'P', 'Captial P' ],
- ['Q', 81, '121', '\121', '&#081;', nil, 'Q', 'Q', 'Q', 'Captial Q' ],
- ['R', 82, '122', '\122', '&#082;', nil, 'R', 'R', 'R', 'Captial R' ],
- ['S', 83, '123', '\123', '&#083;', nil, 'S', 'S', 'S', 'Captial S' ],
- ['T', 84, '124', '\124', '&#084;', nil, 'T', 'T', 'T', 'Captial T' ],
- ['U', 85, '125', '\125', '&#085;', nil, 'U', 'U', 'U', 'Captial U' ],
- ['V', 86, '126', '\126', '&#086;', nil, 'V', 'V', 'V', 'Captial V' ],
- ['W', 87, '127', '\127', '&#087;', nil, 'W', 'W', 'W', 'Captial W' ],
- ['X', 88, '130', '\130', '&#088;', nil, 'X', 'X', 'X', 'Captial X' ],
- ['Y', 89, '131', '\131', '&#089;', nil, 'Y', 'Y', 'Y', 'Captial Y' ],
- ['Z', 90, '132', '\132', '&#090;', nil, 'Z', 'Z', 'Z', 'Captial Z' ],
- ['[', 91, '133', '\133', '&#091;', nil, '', '', '', 'Left square bracket [' ],
- ['\\', 92, '134', '\134', '&#092;', nil, '', '\textbackslash', '', 'Backslash \\'],
- [']', 93, '135', '\135', '&#093;', nil, '', '', '', 'Right square bracket ]' ],
- ['^', 94, '136', '\136', '&#094;', nil, '', '', '', 'Caret ^' ],
- ['_', 95, '137', '\137', '&#095;', nil, '{\_}', '\textunderscore', '', 'Underscore _' ],
- ['`', 96, '140', '\140', '&#096;', nil, '', '', '', 'Grave accent `' ],
- ['a', 97, '141', '\141', '&#097;', nil, 'a', 'a', 'a', 'Small a' ],
- ['b', 98, '142', '\142', '&#098;', nil, 'b', 'b', 'b', 'Small b' ],
- ['c', 99, '143', '\143', '&#099;', nil, 'c', 'c', 'c', 'Small c' ],
- ['d', 100, '144', '\144', '&#100;', nil, 'd', 'd', 'd', 'Small d' ],
- ['e', 101, '145', '\145', '&#101;', nil, 'e', 'e', 'e', 'Small e' ],
- ['f', 102, '146', '\146', '&#102;', nil, 'f', 'f', 'f', 'Small f' ],
- ['g', 103, '147', '\147', '&#103;', nil, 'g', 'g', 'g', 'Small g' ],
- ['h', 104, '150', '\150', '&#104;', nil, 'h', 'h', 'h', 'Small h' ],
- ['i', 105, '151', '\151', '&#105;', nil, 'i', 'i', 'i', 'Small i' ],
- ['j', 106, '152', '\152', '&#106;', nil, 'j', 'j', 'j', 'Small j' ],
- ['k', 107, '153', '\153', '&#107;', nil, 'k', 'k', 'k', 'Small k' ],
- ['l', 108, '154', '\154', '&#108;', nil, 'l', 'l', 'l', 'Small l' ],
- ['m', 109, '155', '\155', '&#109;', nil, 'm', 'm', 'm', 'Small m' ],
- ['n', 110, '156', '\156', '&#110;', nil, 'n', 'n', 'n', 'Small n' ],
- ['o', 111, '157', '\157', '&#111;', nil, 'o', 'o', 'o', 'Small o' ],
- ['p', 112, '160', '\160', '&#112;', nil, 'p', 'p', 'p', 'Small p' ],
- ['q', 113, '161', '\161', '&#113;', nil, 'q', 'q', 'q', 'Small q' ],
- ['r', 114, '162', '\162', '&#114;', nil, 'r', 'r', 'r', 'Small r' ],
- ['s', 115, '163', '\163', '&#115;', nil, 's', 's', 's', 'Small s' ],
- ['t', 116, '164', '\164', '&#116;', nil, 't', 't', 't', 'Small t' ],
- ['u', 117, '165', '\165', '&#117;', nil, 'u', 'u', 'u', 'Small u' ],
- ['v', 118, '166', '\166', '&#118;', nil, 'v', 'v', 'v', 'Small v' ],
- ['w', 119, '167', '\167', '&#119;', nil, 'w', 'w', 'w', 'Small w' ],
- ['x', 120, '170', '\170', '&#120;', nil, 'x', 'x', 'x', 'Small x' ],
- ['y', 121, '171', '\171', '&#121;', nil, 'y', 'y', 'y', 'Small y' ],
- ['z', 122, '172', '\172', '&#122;', nil, 'z', 'z', 'z', 'Small z' ],
- ['{', 123, '173', '\173', '&#123;', nil, '{\{}', '\{', '', 'Left curly brace {' ],
- ['|', 124, '174', '\174', '&#124;', nil, '', '', '', 'Vertical bar / pipe |' ],
- ['}', 125, '175', '\175', '&#125;', nil, '{\}}', '\}', '', 'Right curly brace }' ],
- ['~', 126, '176', '\176', '&#126;', nil, '', '', '', 'Tilde ~' ],
- ['', 127, '177', '', '&#127;', nil, '', '', '', ' ' ],
- ['', 128, '200', '', '&#128;', nil, '', '', '', ' ' ],
- ['', 129, '201', '', '&#129;', nil, '', '', '', ' ' ],
- ['\'', 130, '202', '', '&#130;', nil, '', '', '', 'Low left single quote \''],
- [' ', 131, '203', '', '&#131;', nil, '', '', '', 'Florin ' ],
- ['"', 132, '204', '', '&#132;', nil, '', '', '', 'Low left double quote "' ],
- ['…', 133, '205', '\342\200\246', '&#133;', nil, '…', '\textellipsis', '', 'Ellipsis …' ],
- ['†', 134, '206', '\342\200\240', '&#134;', nil, '†', '\textdagger', '', 'Dagger †' ],
- ['‡', 135, '207', '\342\200\241', '&#135;', nil, '‡', '\textdaggerbl', '', 'Double dagger ‡' ],
- ['^', 136, '210', '', '&#136;', nil, '', '', '', 'Circumflex ^' ],
- ['', 137, '211', '', '&#137;', nil, '', '', '', 'Permil ' ],
- ['', 138, '212', '', '&#138;', nil, '', '', '', 'Capital S, caron ' ],
- ['<', 139, '213', '', '&#139;', nil, '', '', '', 'Less than sign (see &060;) <' ],
- ['', 140, '214', '', '&#140;', nil, '', '', '', 'Capital OE ligature ' ],
- ['', 141, '215', '', '&#141;', nil, '', '', '', ' ' ],
- ['', 142, '216', '', '&#142;', nil, '', '', '', 'Capital Z, caron ' ],
- ['', 143, '217', '', '&#143;', nil, '', '', '', ' ' ],
- ['', 144, '220', '', '&#144;', nil, '', '', '', ' ' ],
- ['', 145, '221', '', '&#145;', nil, '', '', '', 'Left single quote ' ],
- ['', 146, '222', '', '&#146;', nil, '', '', '', 'Right single quote ' ],
- ['', 147, '223', '', '&#147;', nil, '', '', '', 'Left double quote ' ],
- ['', 148, '224', '', '&#148;', nil, '', '', '', 'Right double quote ' ],
- ['', 149, '225', '', '&#149;', nil, '', '', '', 'Bullet ' ],
- ['-', 150, '226', '', '&#150;', nil, '', '', '', 'En dash -' ],
- ['', 151, '227', '', '&#151;', nil, '', '', '', 'Em dash -' ],
- ['~', 152, '230', '', '&#152;', nil, '', '', '', 'Tilde (see &126;) ~' ],
- ['t', 153, '231', '', '&#153;', nil, '', '', '', 'Trademark t' ],
- ['', 154, '232', '', '&#154;', nil, '', '', '', 'small s, caron ' ],
- ['', 155, '233', '', '&#155;', nil, '', '', '', 'Greater than sign (see &062;) ' ],
- ['', 156, '234', '', '&#156;', nil, '', '', '', 'Small oe ligature ' ],
- ['', 157, '235', '', '&#157;', nil, '', '', '', ' ' ],
- ['', 158, '236', '', '&#158;', nil, '', '', '', 'Small z, caron ' ],
- ['', 159, '237', '', '&#159;', nil, '', '', '', 'Capital Y, umlaut ' ],
- ['', 160, '240', '', '&#160;', '&nbsp;', '', '', '', 'Non-breaking space ' ],
- ['¡', 161, '241', '\302\241', '&#161;', '&iexcl;', '¡', '', '', 'Inverted exclamation ' ],
- ['¢', 162, '242', '\302\242', '&#162;', '&cent;', '¢', '', '', 'Cent sign ¢' ],
- ['£', 163, '243', '\302\243', '&#163;', '&pound;', '£', '\textsterling', '', 'Pound sign £' ],
- ['¤', 164, '244', '\302\244', '&#164;', '&curren;', '¤', '\textcurrency', '', 'General currency sign ' ],
- ['¥', 165, '245', '\302\245', '&#165;', '&yen;', '¥', '', '', 'Yen sign ¥' ],
- ['¦', 166, '246', '\302\246', '&#166;', '&brvbar;', '¦', '', '', 'Broken vertical bar ' ],
- ['§', 167, '247', '\302\247', '&#167;', '&sect;', '§', '\textsection', '', 'Section sign §' ],
- ['¨', 168, '250', '\302\250', '&#168;', '&uml;', '¨', '\"', '', 'Umlaut ' ],
- ['©', 169, '251', '\302\251', '&#169;', '&copy;', '©', '\copyright', '\textcopyright', 'Copyright ©' ],
- ['ª', 170, '252', '\302\252', '&#170;', '&ordf;', 'ª', '', '', 'Feminine ordinal ª' ],
- ['«', 171, '253', '\302\253', '&#171;', '&laquo;', '«', '', '', 'Left angle quote «' ],
- ['¬', 172, '254', '\302\254', '&#172;', '&not;', '¬', '', '', 'Not sign ' ],
- ['­', 173, '255', '\302\255', '&#173;', '&shy;', '­', '', '', 'Soft hyphen ' ],
- ['®', 174, '256', '\302\256', '&#174;', '&reg;', '®', '', '', 'Registered trademark ®' ],
- ['¯', 175, '257', '\302\257', '&#175;', '&macr;', '¯', '', '', 'Macron accent ' ],
- ['°', 176, '260', '\302\260', '&#176;', '&deg;', '°', '', '', 'Degree sign °' ],
- ['±', 177, '261', '\302\261', '&#177;', '&plusmin;', '±', '', '', 'Plus or minus ±' ],
- ['²', 178, '262', '\302\262', '&#178;', '&sup2;', '²', '', '', 'Superscript 2 ²' ],
- ['³', 179, '263', '\302\263', '&#179;', '&sup3;', '³', '', '', 'Superscript 3 ³' ],
- ['', 180, '264', '\302\264', '&#180;', '&acute;', ''', '', '', 'Acute accent ' ],
- ['µ', 181, '265', '\302\265', '&#181;', '&micro;', 'µ', '', '', 'Micro sign (Greek mu) µ' ],
- ['¶', 182, '266', '\302\266', '&#182;', '&para;', '¶', '\textparagraph', '', 'Paragraph sign ¶' ],
- ['·', 183, '267', '\302\267', '&#183;', '&middot;', %q{·}, '', %q{}, 'Middle dot ' ],
- ['¸', 184, '270', '\302\270', '&#184;', '&cedil;', '¸', '', '', 'Cedilla ' ],
- ['¹', 185, '271', '\302\271', '&#185;', '&sup1;', '¹', '', '', 'Superscript 1 ¹' ],
- ['º', 186, '272', '\302\272', '&#186;', '&ordm;', 'º', '', '', 'Masculine ordinal º' ],
- ['»', 187, '273', '\302\273', '&#187;', '&raquo;', '»', '', '', 'Right angle quote ' ],
- ['¼', 188, '274', '\302\274', '&#188;', '&frac14;', '¼', '', '', 'Fraction one quarter ¼' ],
- ['½', 189, '275', '\302\275', '&#189;', '&frac12;', '½', '', '', 'Fraction on half ½' ],
- ['¾', 190, '276', '\302\276', '&#190;', '&frac34;', '¾', '', '', 'Fraction three quarters ¾' ],
- ['¿', 191, '277', '\302\277', '&#191;', '&iquest;', '¿', '', '', 'Inverted question mark ¿' ],
- ['À', 192, '300', '\303\200', '&#192;', '&Agrave;', 'À', '\`{A}', '', 'Capital A, grave accent À' ],
- ['Á', 193, '301', '\303\201', '&#193;', '&Aacute;', 'Á', %q{\'{A}}, '', 'Capital A, acute accent Á' ],
- ['Â', 194, '302', '\303\202', '&#194;', '&Acirc;', 'Â', '^{A}', '', 'Capital A, circumflex accent Â' ],
- ['Ã', 195, '303', '\303\203', '&#195;', '&Atilde;', 'Ã', '~{A}', '', 'Capital A, tilde Ã' ],
- ['Ä', 196, '304', '\303\204', '&#196;', '&Auml;', 'Ä', '"{A}', '', 'Capital A, umlaut Ä' ],
- ['Å', 197, '305', '\303\205', '&#197;', '&Aring;', 'Å', 'r{A}', '', 'Capital A, ring Å' ],
- ['Æ', 198, '306', '\303\206', '&#198;', '&AElig;', 'Æ', 'AE', '', 'Capital AE ligature Æ' ],
- ['Ç', 199, '307', '\303\207', '&#199;', '&Ccedil;', 'Ç', '', '', 'Capital C, cedilla Ç' ],
- ['È', 200, '310', '\303\210', '&#200;', '&Egrave;', 'È', '`{E}', '', 'Capital E, grave accent È' ],
- ['É', 201, '311', '\303\211', '&#201;', '&Eacute;', 'É', ''{E}', '', 'Capital E, acute accent É' ],
- ['Ê', 202, '312', '\303\212', '&#202;', '&Ecirc;', 'Ê', '^{E}', '', 'Capital E, circumflex accent Ê' ],
- ['Ë', 203, '313', '\303\213', '&#203;', '&Euml;', 'Ë', '"{E}', '', 'Capital E, umlaut Ë' ],
- ['Ì', 204, '314', '\303\214', '&#204;', '&Igrave;', 'Ì', '`{I}', '', 'Capital I, grave accent Ì' ],
- ['Í', 205, '315', '\303\215', '&#205;', '&Iacute;', 'Í', ''{I}', '', 'Capital I, acute accent Í' ],
- ['Î', 206, '316', '\303\216', '&#206;', '&Icirc;', 'Î', '^{I}', '', 'Capital I, circumflex accent Î' ],
- ['Ï', 207, '317', '\303\217', '&#207;', '&Iuml;', 'Ï', '"{I}', '', 'Capital I, umlaut Ï' ],
- ['Ð', 208, '320', '\303\220', '&#208;', '&ETH;', 'Ð', '', '', 'Capital eth, Icelandic ' ],
- ['Ñ', 209, '321', '\303\221', '&#209;', '&Ntilde;', 'Ñ', '', '', 'Capital N, tilde Ñ' ],
- ['Ò', 210, '322', '\303\222', '&#210;', '&Ograve;', 'Ò', '`{O}', '', 'Capital O, grave accent Ò' ],
- ['Ó', 211, '323', '\303\223', '&#211;', '&Oacute;', 'Ó', ''{O}', '', 'Capital O, acute accent Ó' ],
- ['Ô', 212, '324', '\303\224', '&#212;', '&Ocirc;', 'Ô', '^{O}', '', 'Capital O, circumflex accent Ô' ],
- ['Õ', 213, '325', '\303\225', '&#213;', '&Otilde;', 'Õ', '~{O}', '', 'Capital O, tilde Õ' ],
- ['Ö', 214, '326', '\303\226', '&#214;', '&Ouml;', 'Ö', '"{O}', '', 'Capital O, umlaut Ö' ],
- ['×', 215, '327', '\303\227', '&#215;', '&times;', '×', '', '', 'Multiply sign ×' ],
- ['Ø', 216, '330', '\303\230', '&#216;', '&Oslash;', 'Ø', 'O', '', 'Capital O, slash Ø' ],
- ['Ù', 217, '331', '\303\231', '&#217;', '&Ugrave;', 'Ù', '', '', 'Capital U, grave accent Ù' ],
- ['Ú', 218, '332', '\303\232', '&#218;', '&Uacute;', 'Ú', '', '', 'Capital U, acute accent Ú' ],
- ['Û', 219, '333', '\303\233', '&#219;', '&Ucirc;', 'Û', '', '', 'Capital U, circumflex accent Û' ],
- ['Ü', 220, '334', '\303\234', '&#220;', '&Uuml;', 'Ü', '', '', 'Capital U, umlaut Ü' ],
- ['Ý', 221, '335', '\303\235', '&#221;', '&Yacute;', 'Ý', '', '', 'Capital Y, acute accent Ý' ],
- ['Þ', 222, '336', '\303\236', '&#222;', '&THORN;', 'Þ', '', '', 'Capital thorn, Icelandic Þ' ],
- ['ß', 223, '337', '\303\237', '&#223;', '&szlig;', 'ß', '', '', 'Small sz ligature, German ß' ],
- ['à', 224, '340', '\303\240', '&#224;', '&agrave;', 'à', '\`{a}', '', 'Small a, grave accent à' ],
- ['á', 225, '341', '\303\241', '&#225;', '&aacute;', 'á', %q{\'{a}}, '', 'Small a, acute accent á' ],
- ['â', 226, '342', '\303\242', '&#226;', '&acirc;', 'â', '\^{a}', '', 'Small a, circumflex accent â' ],
- ['ã', 227, '343', '\303\243', '&#227;', '&atilde;', 'ã', '\~{a}', '', 'Small a, tilde ã' ],
- ['ä', 228, '344', '\303\244', '&#228;', '&auml;', 'ä', '\"{a}', '', 'Small a, umlaut ä' ],
- ['å', 229, '345', '\303\245', '&#229;', '&aring;', 'å', '\r{a}', '', 'Small a, ring å' ],
- ['æ', 230, '346', '\303\246', '&#230;', '&aelig;', 'æ', '\ae', '', 'Small ae ligature æ' ],
- ['ç', 231, '347', '\303\257', '&#231;', '&ccedil;', 'ç', '', '', 'Small c, cedilla ç' ],
- ['è', 232, '350', '\303\250', '&#232;', '&egrave;', 'è', '\`{e}', '', 'Small e, grave accent è' ],
- ['é', 233, '351', '\303\251', '&#233;', '&eacute;', 'é', %q{\'{e}}, '', 'Small e, acute accent é' ],
- ['ê', 234, '352', '\303\252', '&#234;', '&ecirc;', 'ê', '\^{e}', '', 'Small e, circumflex accent ê' ],
- ['ë', 235, '353', '\303\253', '&#235;', '&euml;', 'ë', '\"{e}', '', 'Small e, umlaut ë' ],
- ['ì', 236, '354', '\303\254', '&#236;', '&igrave;', 'ì', '\`{i}', '', 'Small i, grave accent ì' ],
- ['í', 237, '355', '\303\255', '&#237;', '&iacute;', 'í', '\'{i}', '', 'Small i, acute accent í' ],
- ['î', 238, '356', '\303\256', '&#238;', '&icirc;', 'î', '\^{i}', '', 'Small i, circumflex accent î' ],
- ['ï', 239, '357', '\303\257', '&#239;', '&iuml;', 'ï', '\"{i}', '', 'Small i, umlaut ï' ],
- ['ð', 240, '360', '\303\260', '&#240;', '&eth;', 'ð', '', '', 'Small eth, Icelandic ð' ],
- ['ñ', 241, '361', '\303\261', '&#241;', '&ntilde;', 'ñ', '', '', 'Small n, tilde ñ' ],
- ['ò', 242, '362', '\303\262', '&#242;', '&ograve;', 'ò', '\`{o}', '', 'Small o, grave accent ò' ],
- ['ó', 243, '363', '\303\263', '&#243;', '&oacute;', 'ó', %q{\'{o}}, '', 'Small o, acute accent ó' ],
- ['ô', 244, '364', '\303\264', '&#244;', '&ocirc;', 'ô', '\^{o}', '', 'Small o, circumflex accent ô' ],
- ['õ', 245, '365', '\303\265', '&#245;', '&otilde;', 'õ', '\^{o}', '', 'Small o, tilde õ' ],
- ['ö', 246, '366', '\303\266', '&#246;', '&ouml;', 'ö', '\"{o}', '', 'Small o, umlaut ö' ],
- ['÷', 247, '367', '\303\267', '&#247;', '&divide;', '÷', '', '', 'Divide sign ÷' ],
- ['ø', 248, '370', '\303\270', '&#248;', '&oslash;', 'ø', '', '', 'Small o, slash ø' ],
- ['ù', 249, '371', '\303\271', '&#249;', '&ugrave;', 'ù', '\`{u}', '', 'Small u, grave accent ù' ],
- ['ú', 250, '372', '\303\272', '&#250;', '&uacute;', 'ú', %q{\'{u}}, '', 'Small u, acute accent ú' ],
- ['û', 251, '373', '\303\273', '&#251;', '&ucirc;', 'û', '\^{u}', '', 'Small u, circumflex accent û' ],
- ['ü', 252, '374', '\303\274', '&#252;', '&uuml;', 'ü', '\"{u}', '', 'Small u, umlaut ü' ],
- ['ý', 253, '375', '\303\275', '&#253;', '&yacute;', 'ý', '', '', 'Small y, acute accent ý' ],
- ['þ', 254, '376', '\303\276', '&#254;', '&thorn;', 'þ', '', '', 'Small thorn, Icelandic þ' ],
- ['ÿ', 255, '377', '\303\277', '&#255;', '&yuml;', 'ÿ', '', '', 'Smally y, umlaut ÿ' ],
- ['∝', , '', '', '&#8733;', '&prop;', '∝', '', '', 'proportional to U+221D (8733) ∝' ],
- ['∞', , '', '', '&#8734;', '&infin;', '∞', '', '', 'infinity U+221E (8734) ∞' ],
-]
- end
- end
-end
-__END__
diff --git a/lib/sisu/v2/constants.rb b/lib/sisu/v2/constants.rb
deleted file mode 100644
index 6c949d53..00000000
--- a/lib/sisu/v2/constants.rb
+++ /dev/null
@@ -1,204 +0,0 @@
-# coding:utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
- constants
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/copyleft/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: system environment, resource control and configuration details
-
-=end
-Sfx={:txt=>'.txt',:html=>'.html',:xhtml=>'.xhtml',:xml=>'.xml',:epub=>'.epub',:epub_xhtml=>'.xhtml',:odt=>'.odt',:pdf=>'.pdf'}
-Ax,Xx,Mx,Rx,Hx,Dx,Px,Db,Gt,Tex=Array.new(10){{}}
-Ax[:tab]="\t"
-Xx[:protect]='☞'
-Xx[:segment]='Ф'
-Mx[:meta_o],Mx[:meta_c]='〔@','〕'
-Mx[:lv_o_1],Mx[:lv_o_2],Mx[:lv_o_3],Mx[:lv_o_4],Mx[:lv_o_5],Mx[:lv_o_6],Mx[:lv_o_7],Mx[:lv_o_8],Mx[:lv_o_9]=1,2,3,4,5,6,7,8,9;
-Mx[:lv_o],Mx[:lv_c]='〔','〕'
-Mx[:en_a_o]='【'; Mx[:en_a_c]='】' #endnote Mx[:en_a_o]='~{'; Mx[:en_a_c]='}~'
-Mx[:en_b_o]='〖'; Mx[:en_b_c]='〗' #endnote Mx[:en_b_o]='~['; Mx[:en_b_c]=']~'
-Mx[:gr_o]='〔'; Mx[:gr_c]='〕' #group text mark
-Mx[:id_o]='〔'; Mx[:id_c]='〕' #object id mark
-Mx[:tc_o]='『'; Mx[:tc_c]="』" #table row mark #Mx[:tc_c]="』\n"
-Mx[:tc_p]='┆' #table col/misc mark
-Mx[:pa_o]='〔'; Mx[:pa_c]='〕' #affects paragraph mark
-Mx[:mk_o]='〔'; Mx[:mk_c]='〕' #generic mark
-Mx[:gl_o]='〔'; Mx[:gl_c]='〕' #glyph
-Mx[:fa_o]='〔'; Mx[:fa_o_c]='¤'; Mx[:fa_c_o]='¤'; Mx[:fa_c]='〕'
-Mx[:fa_bold_o]= "#{Mx[:fa_o]}b#{Mx[:fa_o_c]}"; Mx[:fa_bold_c]= "#{Mx[:fa_c_o]}b#{Mx[:fa_c]}"
-Mx[:fa_italics_o]= "#{Mx[:fa_o]}i#{Mx[:fa_o_c]}"; Mx[:fa_italics_c]= "#{Mx[:fa_c_o]}i#{Mx[:fa_c]}"
-Mx[:fa_underscore_o]= "#{Mx[:fa_o]}u#{Mx[:fa_o_c]}"; Mx[:fa_underscore_c]= "#{Mx[:fa_c_o]}u#{Mx[:fa_c]}"
-Mx[:fa_cite_o]= "#{Mx[:fa_o]}cite#{Mx[:fa_o_c]}"; Mx[:fa_cite_c]= "#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}"
-Mx[:fa_insert_o]= "#{Mx[:fa_o]}ins#{Mx[:fa_o_c]}"; Mx[:fa_insert_c]= "#{Mx[:fa_c_o]}ins#{Mx[:fa_c]}"
-Mx[:fa_strike_o]= "#{Mx[:fa_o]}del#{Mx[:fa_o_c]}"; Mx[:fa_strike_c]= "#{Mx[:fa_c_o]}del#{Mx[:fa_c]}"
-Mx[:fa_superscript_o]="#{Mx[:fa_o]}sup#{Mx[:fa_o_c]}"; Mx[:fa_superscript_c]="#{Mx[:fa_c_o]}sup#{Mx[:fa_c]}"
-Mx[:fa_subscript_o]= "#{Mx[:fa_o]}sub#{Mx[:fa_o_c]}"; Mx[:fa_subscript_c]= "#{Mx[:fa_c_o]}sub#{Mx[:fa_c]}"
-Mx[:fa_hilite_o]= "#{Mx[:fa_o]}hi#{Mx[:fa_o_c]}"; Mx[:fa_hilite_c]= "#{Mx[:fa_c_o]}hi#{Mx[:fa_c]}"
-Mx[:fa_monospace_o]= "#{Mx[:fa_o]}mono#{Mx[:fa_o_c]}"; Mx[:fa_monospace_c]= "#{Mx[:fa_c_o]}mono#{Mx[:fa_c]}"
-Mx[:gl_bullet]= "#{Mx[:gl_o]}●#{Mx[:gl_c]}"
- Mx[:pa_non_object_dummy_heading]="#{Mx[:pa_o]}-##{Mx[:pa_c]}" #unnumbered paragraph, delete when not required [used in dummy headings, eg. for segmented html] (place marker at end of paragraph)
- Mx[:pa_non_object_no_heading]="#{Mx[:pa_o]}~##{Mx[:pa_c]}" #unnumbered paragraph (place marker at end of paragraph)
-Mx[:idx_o]='▢ '; Mx[:idx_c]='▢ ' #
-Mx[:nbsp]= '░' #'▭ '
-Mx[:br_line]= '▌' #lB ▌ 9612 #'┘' #'¶'
-Mx[:br_paragraph]= '█' #FB █ 9608 # PP ∥ 8741 #'▐' #'┘' #'¶' #FB █ 9608 lB ▌ 9612 RB ▐ 9616
-Mx[:br_nl]= '』' # '┘'
-Mx[:obj_ln_sep]= 'obj_ln_sep'; Hx[:obj_ln_sep]= {:obj=>Mx[:obj_ln_sep]} # line sep
-Mx[:br_page]= 'break_page'; Hx[:br_page]= {:obj=>Mx[:br_page]} # newpage
-Mx[:br_page_new]= 'break_page_new'; Hx[:br_page_new]= {:obj=>Mx[:br_page_new]} # clearpage
-Mx[:br_endnotes]= "#{Mx[:mk_o]}ENDNOTES#{Mx[:mk_c]}"
-Mx[:br_eof]= "#{Mx[:mk_o]}EOF#{Mx[:mk_c]}"
-Mx[:lnk_o]='⌠'; Mx[:lnk_c]='⌡' #'⌈' '⌋' '⌠' '⌡' #Mx[:lnk_o]='◁'; Mx[:lnk_c]='▷' #‹ ›
-Mx[:url_o]='「'; Mx[:url_c]='」'
-Mx[:rel_o]='⌈'; Mx[:rel_c]='⌋'
-Mx[:tag_o]='⌊'; Mx[:tag_c]='⌉'
-Mx[:sm_set_o]='《'; Mx[:sm_set_c]='》'
-Mx[:sm_subset_o]='《 '; Mx[:sm_subset_c]='》'
-Mx[:vline]='┆' # ¦ |
-#Mx[:sm_set_o]='∈ '; Mx[:sm_set_c]='∋ '
-#Mx[:sm_subset_o]='∈ '; Mx[:sm_subset_c]='∋ '
-Rx[:mx_fa_clean]= /#{Mx[:fa_o]}.+?#{Mx[:fa_c]}|#{Mx[:pa_o]}.+?#{Mx[:pa_c]}|#{Mx[:mk_o]}.+?#{Mx[:mk_c]}/
-Rx[:lv],Rx[:lv_1],Rx[:lv_2],Rx[:lv_3],Rx[:lv_4],Rx[:lv_5],Rx[:lv_6],Rx[:lv_7],Rx[:lv_8],Rx[:lv_9]=
- /〔([1-9]):(\S*?)〕/,/#{Mx[:lv_o_1]}(\S*?)#{Mx[:lv_c]}/,/#{Mx[:lv_o_2]}(\S*?)#{Mx[:lv_c]}/,/#{Mx[:lv_o_3]}(\S*?)#{Mx[:lv_c]}/,/#{Mx[:lv_o_4]}(\S*?)#{Mx[:lv_c]}/,/#{Mx[:lv_o_5]}(\S*?)#{Mx[:lv_c]}/,/#{Mx[:lv_o_6]}(\S*?)#{Mx[:lv_c]}/,/#{Mx[:lv_o_7]}(\S*?)#{Mx[:lv_c]}/,/#{Mx[:lv_o_8]}(\S*?)#{Mx[:lv_c]}/,/#{Mx[:lv_o_9]}(\S*?)#{Mx[:lv_c]}/
-Rx[:meta]=/#{Mx[:meta_o]}(\S+?)#{Mx[:meta_c]}/
-Dx[:url_o]='‹'; Dx[:url_c]='›'
-Dx[:url_o_xml]='&lt;'; Dx[:url_c_xml]='&gt;'
-Dx[:rel_o]='‹'; Dx[:rel_c]='›' # Dx[:rel_o]='「'; Dx[:rel_c]='」'
-Tex[:backslash]="\\\\"
-Tex[:backslash]="\\\\"
-Tex[:tilde]='\\\\\\~'
-#Px[:emphasis_o]= '*'; Px[:emphasis_c]= '*'
-#Px[:bold_o]= '!'; Px[:bold_c]= '!'
-Px[:bold_o]= '*'; Px[:bold_c]= '*'
-Px[:italics_o]= '/'; Px[:italics_c]= '/'
-Px[:underscore_o]= '_'; Px[:underscore_c]= '_'
-Px[:cite_o]= '"'; Px[:cite_c]= '"'
-Px[:insert_o]= '+'; Px[:insert_c]= '+'
-Px[:strike_o]= '-'; Px[:strike_c]= '-'
-Px[:superscript_o]='^'; Px[:superscript_c]='^'
-Px[:subscript_o]= '['; Px[:subscript_c]= ']'
-Px[:hilite_o]= '*'; Px[:hilite_c]= '*'
-Px[:monospace_o]= ''; Px[:monospace_c]= ''
-Px[:lv1]= '*'
-Px[:lv2]= '='
-Px[:lv3]= '='
-#Px[:lv2_3]= '='
-Px[:lv4]= '-'
-Px[:lv5]= '.'
-Px[:lv6]= '.'
-#Px[:lv5_6]= '.'
-Db[:name_prefix]="SiSU#{SiSU_version_dir}c_"
-Db[:name_prefix_db]="sisu_#{SiSU_version_dir}c_"
-Db[:col_title]=800
-Db[:col_title_part]=400
-Db[:col_title_edition]=10
-Db[:col_name]=600
-Db[:col_creator_misc_short]=100
-Db[:col_language]=100
-Db[:col_language_char]=3
-Db[:col_date_text]=10
-Db[:col_classify_txt_long]=600
-Db[:col_classify_txt_short]=600
-Db[:col_classify_short]=200
-Db[:col_classify_identify]=256
-Db[:col_classify_library]=30
-Db[:col_classify_small]=16
-Db[:col_filename]=256
-Db[:col_digest]=64
-Db[:col_filesize]=10
-Db[:col_info_note]=2500
-Gt[:grotto]='sisu:'
-Gt[:txt]='txt'
-Gt[:image]='images'
-Gt[:conf]='conf'
-__END__
-consider:
- 〔comment〕
- 〔links?????〕
- import document?
-check:
- bold line
-
-┆┆⋮┇┊┋
-『』
-「」
-〔〕
-【】
-
- #˝ " λ Ω β α π Ѫ Ж Я Ѳ ѳ Ф ㈣
- Ѳ ѳ Ф
- ♩ ♭  ✠  ▭ ▬ ▪
-【】〖〗《》「」
- ‹ › ∗ 
-'〔lv1〕','〔lv2〕','〔lv3〕','〔lv4〕','〔lv5〕','〔lv6〕','〔lv7〕','〔lv8〕','〔lv9〕'
-'〔 Ѳ1〕','〔 Ѳ2〕','〔 Ѳ3〕','〔 Ѳ4〕','〔 Ѳ5〕','〔Ѳ6〕','〔Ѳ7〕','〔Ѳ8〕','〔Ѳ9〕'
-◁▷
-◀this is text or an image▶ http://
-p __FILE__ +':'+ __LINE__.to_s
-p __FILE__ + ' ' + __LINE__.to_s + ' ' + html
-puts "#{__FILE__} #{__LINE__} #{o.inspect}"
-puts __FILE__ + ' ' + __LINE__.to_s + '--> ' + o.inspect
-puts %{-\t#{__FILE__}::#{__LINE__}::#{caller}:\n"#{name}"}
-p "\t" + txt.obj + " << #{__FILE__} #{__LINE__} >>"
-p (__FILE__ + ' ' + __LINE__.to_s + '--> ' + dob.inspect) if dob.is=='heading'
-data.each {|o| p (__FILE__ + ' ' + __LINE__.to_s + '--> ' + o.inspect) if o.is=='heading'}
-puts "#{__FILE__} #{__LINE__} #{para}" if @opt.cmd =~/M/
-puts "#{__FILE__} #{__LINE__} #{t_o}" if @opt.cmd =~/M/
- dr ┌ 9484 dR ┍ 9485 Dr ┎ 9486 DR ┏ 9487 dl ┐ 9488 dL ┑ 9489 Dl ┒ 9490 LD ┓ 9491 ur └ 9492 uR ┕ 9493 Ur ┖ 9494 UR ┗ 9495 ul ┘ 9496 uL ┙ 9497 Ul ┚ 9498 UL ┛ 9499 vr ├
- dr ┌ 9484 dR ┍ 9485 Dr ┎ 9486 DR ┏ 9487 dl ┐ 9488 dL ┑ 9489 Dl ┒ 9490 LD ┓ 9491 ur └ 9492 uR ┕ 9493 Ur ┖ 9494 UR ┗ 9495 ul ┘ 9496 uL ┙ 9497 Ul ┚ 9498 UL ┛ 9499 vr ├
- └ ┘
-Iu ⌠ 8992 Il ⌡ <7 ⌈ 8968 >7 ⌉ 8969 7< ⌊ 8970 7> ⌋ 8971
-<" 『 12302 >" 』 12303
-<' 「 12300 >' 」 12301
diff --git a/lib/sisu/v2/dal.rb b/lib/sisu/v2/dal.rb
deleted file mode 100644
index fd09f64e..00000000
--- a/lib/sisu/v2/dal.rb
+++ /dev/null
@@ -1,475 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: preprocessing, (document abstraction), data abstraction used
- in subsequent processing
-
-=end
-module SiSU_DAL
- require "#{SiSU_lib}/defaults" # defaults.rb
- include SiSU_Viz
- require "#{SiSU_lib}/sysenv" # sysenv.rb
- include SiSU_Env
- require "#{SiSU_lib}/param" # param.rb
- include SiSU_Param
- require "#{SiSU_lib}/dal_doc_objects" # dal_doc_objects.rb
- require "#{SiSU_lib}/dal_syntax" # dal_syntax.rb
- include SiSU_Syntax
- require "#{SiSU_lib}/dal_doc_str" # dal_doc_str.rb
- require "#{SiSU_lib}/dal_idx" # dal_idx.rb
- require "#{SiSU_lib}/dal_numbering" # dal_numbering.rb
- require "#{SiSU_lib}/dal_hash_digest" # dal_hash_digest.rb
- require "#{SiSU_lib}/dal_endnotes" # dal_endnotes.rb
- require "#{SiSU_lib}/dal_images" # dal_images.rb
- require "#{SiSU_lib}/dal_metadata" # dal_metadata.rb
- require "#{SiSU_lib}/dal_character_check" # dal_character_check.rb
- require "#{SiSU_lib}/dal_substitutions_and_insertions" # dal_substitutions_and_insertions.rb
- require "#{SiSU_lib}/dal_expand_insertions" # dal_expand_insertions.rb
- require "#{SiSU_lib}/i18n" # i18n.rb
- require "#{SiSU_lib}/shared_sem" # shared_sem.rb
- class Instantiate < SiSU_Param::Parameters::Instructions
- def initialize
- @@flag_vocab=0
- @@line_mode=''
- end
- end
- class Source <Instantiate
- @@dal_array=[]
- @@idx_arr={:sst=>[],:tex=>[],:html=>[],:xhtml=>[]}
- @@map_arr={:nametags=>[],:ocn_htmlseg=>[]}
- @@fns=nil
- def initialize(opt)
- @opt=opt
- @@fns||@opt.fns
- @make_fns=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns)
- @fnm=@make_fns.marshal.dal_metadata
- @fnc=@make_fns.marshal.dal_content
- @idx_sst=@make_fns.marshal.dal_idx_sst_rel_html_seg
- @idx_tex=@make_fns.marshal.dal_idx_sst_rel
- @idx_html=@make_fns.marshal.dal_idx_html
- @idx_xhtml=@make_fns.marshal.dal_idx_xhtml
- @map_nametags=@make_fns.marshal.dal_map_nametags
- @map_ocn_htmlseg=@make_fns.marshal.dal_map_ocn_htmlseg
- SiSU_Env::Create_system_link.new.images
- @env=SiSU_Env::Info_env.new
- end
- def read #creates dal
- begin
- dal=[]
- @@dal_array=[]
- @@fns=@opt.fns
- create_dal
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- Instantiate.new
- end
- end
- def get #reads dal, unless does not exist then creates first
- begin
- dal=[]
- unless @@fns==@opt.fns
- @@fns=@opt.fns
- @@dal_array=[]
- end
- dal=(@@dal_array.empty?) ? read_fnc : @@dal_array.dup
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- Instantiate.new
- end
- end
- def get_idx_sst #reads dal idx.sst, #unless does not exist then creates first
- begin
- dal=[]
- unless @@fns==@opt.fns
- @@fns=@opt.fns
- @@idx_arr[:sst]=[]
- end
- dal=(@@idx_arr[:sst].empty?) ? read_idx_sst : @@idx_arr[:sst].dup #check
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- Instantiate.new
- end
- end
- def get_idx_tex #reads dal idx.tex, #unless does not exist then creates first
- begin
- dal=[]
- unless @@fns==@opt.fns
- @@fns=@opt.fns
- @@idx_arr[:tex]=[]
- end
- dal=(@@idx_arr[:tex].empty?) ? read_idx_tex : @@idx_arr[:tex].dup #check
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- Instantiate.new
- end
- end
- def get_idx_html #reads dal idx.html, #unless does not exist then creates first
- begin
- dal=[]
- unless @@fns==@opt.fns
- @@fns=@opt.fns
- @@idx_arr[:html]=[]
- end
- dal=(@@idx_arr[:html].empty?) ? read_idx_html : @@idx_arr[:html].dup
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- Instantiate.new
- end
- end
- def get_idx_xhtml #reads dal idx.xhtml, #unless does not exist then creates first
- begin
- dal=[]
- unless @@fns==@opt.fns
- @@fns=@opt.fns
- @@idx_arr[:xthml]=[]
- end
- dal=(@@idx_arr[:xhtml].empty?) ? read_idx_xhtml : @@idx_arr[:xhtml].dup
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- Instantiate.new
- end
- end
- def get_map_nametags #reads dal map.nametags, #unless does not exist then creates first
- begin
- dal=[]
- unless @@fns==@opt.fns
- @@fns=@opt.fns
- @@map_arr[:nametags]=[]
- end
- dal=(@@map_arr[:nametags].empty?) ? read_map_nametags : @@map_arr[:nametags].dup
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- Instantiate.new
- end
- end
- def get_map_ocn_htmlseg #reads dal map.ocn_htmlseg, #unless does not exist then creates first
- begin
- dal=[]
- unless @@fns==@opt.fns
- @@fns=@opt.fns
- @@map_arr[:ocn_htmlseg]=[]
- end
- dal=(@@map_arr[:ocn_htmlseg].empty?) ? read_map_ocn_htmlseg : @@map_arr[:ocn_htmlseg].dup
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- Instantiate.new
- end
- end
- protected
- def create_dal
- dal_array=[]
- unless @opt.cmd =~/q/
- tell=(@opt.cmd=~/[vVM]/) \
- ? SiSU_Screen::Ansi.new(@opt.cmd,'Document Abstraction') \
- : SiSU_Screen::Ansi.new(@opt.cmd,'Document Abstraction',@opt.fns)
- tell.green_title_hi
- end
- file_array=@env.read_source_file(@opt.fns)
- file_array.each do |l|
- if l =~/\r\n/; l.gsub!(/\r\n/,"\n")
- end
- end
- meta=file_array.dup
- meta=meta.join.split("\n\n") #check whether can be eliminated, some of these are large objects to have twice
- @md=SiSU_Param::Parameters::Instructions.new(meta,@opt).extract
- meta=nil
- dal=SiSU_DAL::Make.new(@md,file_array).song
- if @opt.cmd =~/[vM]/
- SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"~meta/#{@opt.fns}.meta").output if @opt.cmd =~/v/i
- SiSU_Screen::Ansi.new(@opt.cmd,"dal -> #{@make_fns.meta}").txt_grey if @opt.cmd =~/M/
- end
- dal.each{|s| dal_array << s}
- dal_array
- end
- def read_fnm
- dal=[]
- dal=if FileTest.file?(@fnm)
- (RUBY_VERSION < '1.9') \
- ? (File.open(@fnm){ |f| dal=Marshal.load(f)}) \
- : (File.open(@fnm,'r:utf-8'){ |f| dal=Marshal.load(f)})
- else SiSU_DAL::Source.new(@opt).create_dal
- end
- end
- def read_fnc
- dal=[]
- dal=if FileTest.file?(@fnc)
- (RUBY_VERSION < '1.9') \
- ? (File.open(@fnc){ |f| dal=Marshal.load(f)}) \
- : (File.open(@fnc,'r:utf-8'){ |f| dal=Marshal.load(f)})
- else SiSU_DAL::Source.new(@opt).create_dal
- end
- end
- def read_idx_sst
- m=[]
- m=if FileTest.file?(@idx_sst)
- (RUBY_VERSION < '1.9') \
- ? (File.open(@idx_sst){ |f| m=Marshal.load(f)}) \
- : (File.open(@idx_sst,'r:utf-8'){ |f| m=Marshal.load(f)})
- else nil
- end
- end
- def read_idx_tex
- m=[]
- m=if FileTest.file?(@idx_tex)
- (RUBY_VERSION < '1.9') \
- ? (File.open(@idx_tex){ |f| m=Marshal.load(f)}) \
- : (File.open(@idx_tex,'r:utf-8'){ |f| m=Marshal.load(f)})
- else nil
- end
- end
- def read_idx_html
- m=[]
- m=if FileTest.file?(@idx_html)
- (RUBY_VERSION < '1.9') \
- ? (File.open(@idx_html){ |f| m=Marshal.load(f)}) \
- : (File.open(@idx_html,'r:utf-8'){ |f| m=Marshal.load(f)})
- else nil
- end
- end
- def read_idx_xhtml
- m=[]
- m=if FileTest.file?(@idx_xhtml)
- (RUBY_VERSION < '1.9') \
- ? (File.open(@idx_xhtml){ |f| m=Marshal.load(f)}) \
- : (File.open(@idx_xhtml,'r:utf-8'){ |f| m=Marshal.load(f)})
- else nil
- end
- end
- def read_map_nametags
- m=[]
- m=if FileTest.file?(@map_nametags)
- (RUBY_VERSION < '1.9') \
- ? (File.open(@map_nametags){ |f| m=Marshal.load(f)}) \
- : (File.open(@map_nametags,'r:utf-8'){ |f| m=Marshal.load(f)})
- else nil
- end
- end
- def read_map_ocn_htmlseg
- m=[]
- m=if FileTest.file?(@map_ocn_htmlseg)
- (RUBY_VERSION < '1.9') \
- ? (File.open(@map_ocn_htmlseg){ |f| m=Marshal.load(f)}) \
- : (File.open(@map_ocn_htmlseg,'r:utf-8'){ |f| m=Marshal.load(f)})
- else nil
- end
- end
- end
- class Output
- def initialize(md,data)
- @md,@data=md,data
- @make=SiSU_Env::Create_file.new(@md.cmd,@md.fns)
- @dir=SiSU_Env::Info_env.new(@md.fns)
- end
- def screen_dump(o)
- if defined? o.of
- print %{OF: #{o.of}; }
- end
- if defined? o.is
- print %{IS: #{o.is}; }
- end
- if defined? o.ocn
- print %{OCN: #{o.ocn}; }
- end
- if defined? o.node
- print %{NODE: #{o.node}; }
- end
- if defined? o.parent
- print %{Parent: #{o.parent}; }
- end
- if defined? o.obj and not o.obj.empty?
- puts %{\n#{o.obj}; }
- else "\n"
- end
- end
- def screen_print(t_o)
- if defined? t_o
- print ' ' + t_o.to_s
- end
- end
- def screen_output(data)
- data.each do |o|
- print o.class
- screen_print(o.ocn)
- screen_print(o.obj)
- puts "\n"
- end
- end
- def hard_output
- if @md.cmd =~/M/
- filename_meta=@make.file_meta
- @data.each {|o| filename_meta.puts o.inspect.sub(/:0x[0-9a-f]{8}\s/,': ')} #to make diffing easier
- filename_txt=@make.file_txt
- @data.each do |o|
- if defined? o.ocn
- filename_txt.puts case o.is
- when 'heading'
- "[#{o.is} #{o.lv}~#{o.name} [#{o.ocn}]] #{o.obj}"
- else "[#{o.is} [#{o.ocn}]] #{o.obj}"
- end
- else
- filename_txt.puts case o.is
- when 'meta'
- "[m~#{o.tag}] #{o.obj}"
- else "[#{o.is}] #{o.obj}"
- end
- end
- end
- filename_debug=@make.file_debug
- @data.each do |o|
- if defined? o.ocn
- case o.is
- when 'heading'
- filename_debug.puts "#{o.is} #{o.lv}~#{o.name} odv=#{o.odv} osp=#{o.osp} [#{o.ocn}] -->\n\t#{o.obj}"
- end
- end
- end
- else
- hard="#{@dir.path.dal}/#{@md.fns}.meta"
- File.unlink(hard) if FileTest.file?(hard)
- hard="#{@dir.path.dal}/#{@md.fns}.txt"
- File.unlink(hard) if FileTest.file?(hard)
- hard="#{@dir.path.dal}/#{@md.fns}.debug.txt"
- File.unlink(hard) if FileTest.file?(hard)
- end
- end
- def make_marshal_content
- marshal_dal=@make.marshal.dal_content
- File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.class==Array
- end
- def make_marshal_metadata
- marshal_dal=@make.marshal.dal_metadata
- File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.class==Array
- end
- def idx_html_hard_output
- if @md.book_idx \
- and @md.cmd =~/M/
- filename_meta=@make.file_meta_idx_html
- unless @data.nil? #REMOVE earliest possible
- @data.each {|s| p s.inspect + "\n" unless s.class==String}
- @data.each {|s| filename_meta.puts s.strip + "\n" unless s.strip.empty?}
- end
- else
- hard_idx_html="#{@dir.path.dal}/#{@md.fns}.idx.html"
- File.unlink(hard_idx_html) if FileTest.file?(hard_idx_html)
- end
- end
- def make_marshal_idx_sst_html_seg
- marshal_dal=@make.marshal.dal_idx_sst_rel_html_seg
- File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.class==Array
- end
- def make_marshal_idx_sst_rel
- marshal_dal=@make.marshal.dal_idx_sst_rel
- File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.class==Array
- end
- def make_marshal_idx_html
- marshal_dal=@make.marshal.dal_idx_html
- File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.class==Array
- end
- def make_marshal_idx_xhtml
- marshal_dal=@make.marshal.dal_idx_xhtml
- File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.class==Array
- end
- def make_marshal_map_nametags
- marshal_dal=@make.marshal.dal_map_nametags
- File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.class==Hash
- end
- def make_marshal_map_name_ocn_htmlseg
- marshal_dal=@make.marshal.dal_map_ocn_htmlseg
- File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.class==Hash
- end
- end
- class Make
- def initialize(md,data)
- @md,@data=md,data
- @env=SiSU_Env::Info_env.new(@md.fns)
- end
- def reset
- @@flag_vocab=0
- @@line_mode=''
- end
- def song
- reset
- data=@data
- my_make_source_file=SiSU_Env::Create_file.new(@md.cmd,@md.fns)
- data=data.join.split("\n\n")
- data=SiSU_insertions::Insertions.new(@md,data).expand_insertions? # dal_expand_insertions.rb
- data=SiSU_substitute_and_insert::SI.new(@md,data).substitutions_and_insertions? # dal_substitutions_and_insertions.rb
- data,metadata=SiSU_document_structure_extract::Build.new(@md,data).identify_parts # dal_doc_str.rb
- data=SiSU_Syntax::Markup.new(@md,data).songsheet # dal_syntax.rb
- data,endnote_array=SiSU_character_check::Check.new(data).character_check_and_oldstyle_endnote_array # dal_character_check.rb
- data=SiSU_images::Images.new(@md,data).images # dal_images.rb
- data,tags_map,ocn_html_seg_map=SiSU_numbering::Numbering.new(@md,data).numbering_song # dal_numbering.rb
- data,book_index_rel,book_index_rel_html_seg,html_idx,xhtml_idx=SiSU_book_index::Book_index.new(@md,data,@env).indexing_song if @md.book_idx # dal_idx.rb
- data=SiSU_endnotes::Endnotes.new(@md,data,endnote_array).endnotes # dal_endnotes.rb
- outputdata=data
- if @md.cmd =~/[mM]/
- SiSU_DAL::Output.new(@md,outputdata).hard_output
- SiSU_DAL::Output.new(@md,outputdata).make_marshal_content
- SiSU_DAL::Output.new(@md,metadata).make_marshal_metadata
- SiSU_DAL::Output.new(@md,html_idx).idx_html_hard_output
- SiSU_DAL::Output.new(@md,book_index_rel_html_seg).make_marshal_idx_sst_html_seg
- SiSU_DAL::Output.new(@md,book_index_rel).make_marshal_idx_sst_rel
- SiSU_DAL::Output.new(@md,html_idx).make_marshal_idx_html
- SiSU_DAL::Output.new(@md,xhtml_idx).make_marshal_idx_xhtml
- SiSU_DAL::Output.new(@md,tags_map).make_marshal_map_nametags
- SiSU_DAL::Output.new(@md,ocn_html_seg_map).make_marshal_map_name_ocn_htmlseg
- end
- reset
- outputdata
- end
- protected
- end
-end
-__END__
diff --git a/lib/sisu/v2/dal_doc_objects.rb b/lib/sisu/v2/dal_doc_objects.rb
deleted file mode 100644
index bc0020b2..00000000
--- a/lib/sisu/v2/dal_doc_objects.rb
+++ /dev/null
@@ -1,425 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: document abstraction
-
-=end
-module SiSU_document_structure
- class Extract
- def extract(h,o)
- obj=h ? h : o
- end
- end
- class Object_metadata
- attr_accessor :is,:of,:tags,:obj,:digest
- def initialize
- @tags={}
- @is=@tmp=@digest=nil
- @of='meta'
- end
- def metadata(tags)
- of= @of #String, classification - group
- is= 'meta' #String, classification - specific type
- tags= tags || ((defined? o.tags) ? o.tags : {}) #String, metadata type/tag
- obj= nil
- @of,@is,@tags,@obj=of,is,tags,obj
- self
- end
- end
- class Object_meta
- attr_accessor :obj,:is,:of,:tag,:digest,:tmp
- def initialize
- @is=@obj=@tag=@digest=@digest=@tmp=nil
- @of='meta'
- end
- def metadata(h,o=nil)
- of= @of #String, classification - group
- is= 'meta' #String, classification - specific type
- tag= h[:tag] || ((defined? o.tag) ? o.tag : nil) #String, metadata type/tag
- obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
- @of,@is,@tag,@obj,@digest,@tmp=of,is,tag,obj,digest,tmp
- self
- end
- end
- class Object_heading
- attr_accessor :obj,:is,:tags,:of,:lv,:ln,:toc_,:name,:idx,:ocn,:odv,:osp,:node,:parent,:ocn_,:note_,:autonum_,:digest,:tmp
- def initialize
- @of='para'
- @is=@obj=@lv=@ln=@toc_=@name=@idx=@size=@ocn=@odv=@osp=@node=@parent=@ocn_=@note_=@autonum_=@digest=@tmp=nil
- @tags=[]
- end
- def heading_ln(lv)
- ln=case lv
- when /A/; 1
- when /B/; 2
- when /C/; 3
- when /1/; 4
- when /2/; 5
- when /3/; 6
- when /4/; 7
- when /5/; 8
- when /6/; 9
- end
- end
- def heading_lv(ln)
- lv=case ln.to_s
- when /1/; 'A'
- when /2/; 'B'
- when /3/; 'C'
- when /4/; '1'
- when /5/; '2'
- when /6/; '3'
- when /7/; '4'
- when /8/; '5'
- when /9/; '6'
- end
- end
- def heading(h,o=nil)
- if not h[:ln] and (h[:lv] and h[:lv]=~/[1-6A-C]/)
- h[:ln]=heading_ln(h[:lv])
- elsif not h[:lv] and (h[:ln] and h[:ln].to_s=~/[1-9]/)
- h[:lv]=heading_lv(h[:ln])
- end
- of= @of #String, classification - group
- is= 'heading' #String, classification - specific type
- name= h[:name] || ((defined? o.name) ? o.name : nil) #String, named object?
- tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
- obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
- ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
- odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
- osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
- node= h[:node] || ((defined? o.node) ? o.node : nil) #[Node relationship doc structure info]
- parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
- lv= h[:lv] || ((defined? o.lv) ? o.lv : nil) #Alpha-numeric, document structure as used in markup, A-C then 1-6
- ln= h[:ln] || ((defined? o.ln) ? o.ln : nil) #Integer, document structure level, for convenience in processing 1-9
- toc_= h[:toc_] || ((defined? o.toc_) ? o.toc_ : false) #Bool, do not include in toc, (relevant to headings)
- ocn_=if h[:ocn_].nil?; ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
- else h[:ocn_]
- end
- autonum_= if h[:autonum_].nil?; ((defined? o.autonum_) ? o.autonum_ : true) #Bool? auto-numbering if requested default on, false suppresses
- else h[:autonum_]
- end
- note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
- digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@lv,@ln,@name,@tags,@obj,@idx,@ocn,@odv,@osp,@node,@parent,@toc_,@ocn_,@note_,@autonum_,@digest,@tmp=of,is,lv,ln,name,tags,obj,idx,ocn,odv,osp,node,parent,toc_,ocn_,note_,autonum_,digest,tmp
- self
- end
- def heading_insert(h,o=nil)
- heading(h,o=nil)
- @is= 'heading_insert' #String, classification - specific type
- self
- end
- end
- class Object_para
- attr_accessor :obj,:is,:tags,:of,:name,:idx,:bullet_,:indent,:ocn,:odv,:osp,:parent,:note_,:image_,:ocn_,:digest,:tmp
- def initialize
- @of='para'
- @is=@obj=@name=@idx=@bullet_=@indent=@size=@ocn=@odv=@osp=@parent=@note_=@image_=@ocn_=@digest=@tmp=nil
- @tags=[]
- end
- def paragraph(h,o=nil)
- of= @of #String, classification - group
- is= 'para' #String, classification - specific type
- name= h[:name] || ((defined? o.name) ? o.name : nil) #String, named object?
- tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
- obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
- ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
- odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
- osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
- parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
- indent= h[:indent].to_s || ((defined? o.indent) ? o.indent.to_s : nil) #Integer, indent level
- bullet_=h[:bullet_] || ((defined? o.bullet_) ? o.bullet_ : false) #Bool, bulleted?
- note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
- image_= h[:image_] || ((defined? o.image_) ? o.image_ : false) #Bool, images? (processing optimization)
- ocn_=if h[:ocn_].nil?; ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
- else h[:ocn_]
- end
- digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@name,@tags,@obj,@indent,@bullet_,@idx,@ocn,@odv,@osp,@parent,@image_,@note_,@ocn_,@digest,@tmp=of,is,name,tags,obj,indent,bullet_,idx,ocn,odv,osp,parent,image_,note_,ocn_,digest,tmp
- self
- end
- def docinfo(h,o=nil)
- of= @of #String, classification - group
- is= 'docinfo' #String, classification - specific type
- name= h[:name] || ((defined? o.name) ? o.name : nil) #String, named object?
- tags= h[:tags] || ((defined? o.tags) ? o.tags : nil) #Array, associated object tags, names if any
- obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- idx= nil #String, book index provided?
- ocn= nil #Integer, sequential on substantive-content objects
- odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
- osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
- parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
- indent= nil #Integer, indent level
- bullet_=false #Bool, bulleted?
- note_= false #Bool, endnotes/footnotes? (processing optimization)
- image_= h[:image_] || ((defined? o.image_) ? o.image_ : false) #Bool, images? (processing optimization)
- ocn_=if h[:ocn_].nil?; ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
- else h[:ocn_]
- end
- digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@name,@tags,@obj,@indent,@bullet_,@idx,@ocn,@odv,@osp,@parent,@image_,@note_,@ocn_,@digest,@tmp=of,is,name,tags,obj,indent,bullet_,idx,ocn,odv,osp,parent,image_,note_,ocn_,digest,tmp
- self
- end
- end
- class Object_group
- attr_accessor :obj,:is,:of,:tags,:idx,:ocn,:odv,:osp,:parent,:note_,:number_,:ocn_,:digest,:tmp
- def initialize
- @of='group'
- @is=@obj=@idx=@ocn=@odv=@osp=@parent=@note_=@number_=@ocn_=@digest=@tmp=nil
- @tags=[]
- end
- def code(h,o=nil)
- of= @of #String, classification - group #alt 'code'
- is= 'code' #String, classification - specific type
- tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
- obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
- ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
- odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
- osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
- parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
- number_= h[:number_] || ((defined? o.number_) ? o.number_ : false) #Bool, numbered or not?
- note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
- ocn_= if h[:ocn_].nil?; ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
- else h[:ocn_]
- end
- digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@number_,@note_,@ocn_,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,number_,note_,ocn_,digest,tmp
- self
- end
- def group(h,o=nil)
- of= @of #String, classification - group
- is= 'group' #String, classification - specific type
- tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
- obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
- ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
- odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
- osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
- parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
- note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
- ocn_= if h[:ocn_].nil?; ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
- else h[:ocn_]
- end
- digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,note_,ocn_,digest,tmp
- self
- end
- def alt(h,o=nil) #see group
- of= @of #String, classification - group
- is= 'alt' #String, classification - specific type
- tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
- obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
- ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
- odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
- osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
- parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
- note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
- ocn_= if h[:ocn_].nil?; ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
- else h[:ocn_]
- end
- digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,note_,ocn_,digest,tmp
- self
- end
- def verse(h,o=nil) #part of poem decide how you deal with this
- of= @of #String, classification - group
- is= 'verse' #String, classification - specific type
- tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
- obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
- ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
- odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
- osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
- parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
- ocn_= if h[:ocn_].nil?; ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
- else h[:ocn_]
- end
- digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,note_,ocn_,digest,tmp
- @h=nil
- self
- end
- end
- class Object_table
- attr_accessor :obj,:is,:of,:lv,:tags,:name,:idx,:indent,:size,:ocn,:number,:head_,:cols,:widths,:odv,:osp,:parent,:note_,:ocn_,:digest,:tmp
- def initialize
- @of='group'
- @is=@obj=@lv=@name=@idx=@indent=@size=@ocn,@number,@head_,@cols,@widths=@odv=@osp=@parent=@note_=@ocn_=@digest=@tmp=nil
- @tags=[]
- end
- def table(h,o=nil)
- of= @of #String, classification - group
- is= 'table' #String, classification - specific type
- tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
- cols= h[:cols] || ((defined? o.cols) ? o.cols : nil)
- widths= h[:widths] || ((defined? o.widths) ? o.widths : nil)
- obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
- ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
- odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
- osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
- parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
- head_= h[:head_] || ((defined? o.head_) ? o.head_ : false)
- note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
- ocn_=if h[:ocn_].nil?; ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
- else h[:ocn_]
- end
- digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@tags,@cols,@widths,@obj,@idx,@ocn,@odv,@osp,@parent,@head_,@note_,@ocn_,@digest,@tmp=of,is,tags,cols,widths,obj,idx,ocn,odv,osp,parent,head_,note_,ocn_,digest,tmp
- self
- end
- end
- class Object_image
- attr_accessor :obj,:is,:of,:lv,:idx,:size,:ocn,:parent,:note_,:ocn_,:digest,:tmp
- def initialize
- @of='image'
- @is=@obj=@lv=@idx=@size=@ocn=@parent=@note_=@ocn_=@tmp=@digest=nil
- @tags=[]
- end
- def image(h,o=nil) #not yet used, and what of a paragraph containing several images, consider
- of= @of #String, classification - group
- is= 'image' #String, classification - specific type
- tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
- obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- size= h[:size] || ((defined? o.size) ? o.size : nil)
- idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
- ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
- odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
- osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
- parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
- note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
- ocn_=if h[:ocn_].nil?; ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
- else h[:ocn_]
- end
- digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@tags,@obj,@size,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@digest,@tmp=of,is,tags,obj,size,idx,ocn,odv,osp,parent,note_,ocn_,digest,tmp
- self
- end
- end
- class Object_structure
- attr_accessor :obj,:tag,:node,:lv,:ln,:status,:is,:of,:tmp
- def initialize
- @of='structure'
- @is=@obj=@node=@lv=@ln=@status=@tmp=nil
- end
- def xml_dom(h,o=nil)
- of= @of #String, classification - group
- is= 'xml_dom' #String, classification - specific type
- obj= h[:obj] || ((defined? o.obj) ? o.obj : '') #String, text content
- lv= h[:lv] || ((defined? o.lv) ? o.lv : nil) #Alpha-numeric, document structure as used in markup, A-C then 1-6
- ln= h[:ln] || ((defined? o.ln) ? o.ln : nil) #Integer, document structure level, for convenience in processing 1-9
- node= h[:node] || ((defined? o.node) ? o.node : nil) #[Node relationship doc structure info]
- status= h[:status] || ((defined? o.status) ? o.status : nil) #tag status open or close
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@obj,@status,@node,@lv,@ln,@tmp=of,is,obj,status,node,lv,ln,tmp
- self
- end
- end
- class Object_comment
- attr_accessor :obj,:is,:of,:tmp
- def initialize
- @of='comment'
- @is=@obj=@tmp=nil
- end
- def comment(h,o=nil)
- of= @of #String, classification - group
- is= 'comment' #String, classification - specific type
- obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@obj,@tmp=of,is,obj,tmp
- self
- end
- end
- class Object_layout
- attr_accessor :obj,:is,:of,:tmp
- def initialize
- @of='layout'
- @is=@obj=@tmp=nil
- end
- def break(h,o=nil) #decide how to deal with, perhaps no obj?
- of= @of #String, classification - group
- is= 'break' #String, classification - specific type
- obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@obj,@tmp=of,is,obj,tmp
- self
- end
- def insert(h,o=nil) #decide how to deal with, could mimic paragraph?
- of= @of #String, classification - group
- is= 'insert' #String, classification - specific type
- obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@obj,@tmp=of,is,obj,tmp
- self
- end
- end
-end
-__END__
-# ~# |-# no paragraph number # -# not included in toc
diff --git a/lib/sisu/v2/dal_doc_str.rb b/lib/sisu/v2/dal_doc_str.rb
deleted file mode 100644
index 6fd7eff2..00000000
--- a/lib/sisu/v2/dal_doc_str.rb
+++ /dev/null
@@ -1,1184 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: document abstraction
-
-=end
-module SiSU_document_structure_extract
- class Instantiate < SiSU_Param::Parameters::Instructions
- @@flag={} #Beware!!
- def initialize
- @@flag['table_to']=false
- @@counter=@@column=@@columns=0
- @@line_mode=''
- end
- end
- class Build
- @@flag={} #Beware!!
- def initialize(md,data)
- @md,@data=md,data
- Instantiate.new
- @pb=SiSU_document_structure::Object_layout.new.break(Hx[:br_page])
- @pbn=SiSU_document_structure::Object_layout.new.break(Hx[:br_page_new])
- end
- def ln_get(lv)
- ln=case lv
- when /A/; 1
- when /B/; 2
- when /C/; 3
- when /1/; 4
- when /2/; 5
- when /3/; 6
- when /4/; 7
- when /5/; 8
- when /6/; 9
- end
- end
- def image_test(str)
- boolean=(str=~/\{\s*\S+?\.png.+?\}https?:\/\/\S+/ ? true : false)
- end
- def bullet_test(str)
- bool=((str=~/\*/) ? true : false)
- end
- def indent_test(str)
- num=((str=~/^_([1-9])/) ? $1 : 0)
- end
- def endnote_test?(str)
- bool=((str=~/~\{.+?\}~|~\[.+?\]~/) ? true : false)
- end
- def extract_tags(str,nametag=nil)
- tags=[]
- if str.nil?
- else
- if str =~/(?:^|[ ])\*~([a-z0-9._-]+)(?=[ #{Mx[:br_nl]}]|$)/
- str.gsub!(/(^|[ ])\*~([a-z0-9._-]+)(?=[ #{Mx[:br_nl]}]|$)/i,
- "\\1#{Mx[:tag_o]}\\2#{Mx[:tag_c]}")
- str.gsub!(/ [ ]+/i,' ')
- tags=str.scan(/#{Mx[:tag_o]}(\S+?)#{Mx[:tag_c]}/).flatten
- str.gsub!(/[ ]?#{Mx[:tag_o]}\S+?#{Mx[:tag_c]}[ ]?/,' ') #may be issues with spaces would leave one, but "code" blocks?
- end
- tags=nametag ? (tags << nametag) : tags
- end
- [str,tags]
- end
- def identify_parts
- data=@data
- tuned_file=[]
- @tuned_group,@tuned_code=[],[]
- @@counter,@verse_count=0,0
- @metadata={}
- @data.each do |t_o|
- t_o.gsub!(/(?:\n\s*\n)+/m,"\n") unless @@flag['code']
- if t_o !~/^(?:code|poem|alt|group)\{|^\}(?:code|poem|alt|group)|^(?:table\{|\{table)[ ~]/ \
- and not @@flag['code'] \
- and not @@flag['poem'] \
- and not @@flag['group'] \
- and not @@flag['alt'] \
- and not @@flag['table']
- unless t_o =~/^(?:@\S+?:|%+)\s/ # extract book index for paragraph if any
- idx=if t_o=~/^=\{(.+)\}\s*$\Z/m; m=$1
- t_o.gsub!(/\n=\{.+\}\s*$\Z/m,'')
- m
- else nil
- end
- end
- t_o=case t_o
- when /^#{Mx[:meta_o]}\S+?#{Mx[:meta_c]}/ #metadata, header
- if t_o=~/^#{Mx[:meta_o]}(\S+?)#{Mx[:meta_c]}\s*(.+)/m
- tag,obj=$1,$2
- @metadata[tag]=obj
- end
- t_o=nil
- when /^%+\s/ #comment
- t_o=if t_o=~/^%+\s+(.+)/
- h={:obj=>$1}
- SiSU_document_structure::Object_comment.new.comment(h)
- else nil
- end
- when /^:?([A-C1-6])\~/ #heading / lv
- lv=$1
- ln=ln_get(lv)
- t_o=if t_o=~/^:?[A-C1-6]\~\s+(.+)/m
- obj=$1
- note=endnote_test?(obj)
- obj,tags=extract_tags(obj)
- h={:lv=>lv,:ln=>ln,:obj=>obj,:idx=>idx,:tags=>tags}
- SiSU_document_structure::Object_heading.new.heading(h)
- elsif t_o=~/^:?[A-C1-6]\~(\S+?)-\s+(.+)/m
- name,obj=$1,$2
- note=endnote_test?(obj)
- obj,tags=extract_tags(obj)
- h={:lv=>lv,:name=>name,:obj=>obj,:idx=>idx,:autonum_=>false,:tags=>tags}
- SiSU_document_structure::Object_heading.new.heading(h)
- elsif t_o=~/^:?[A-C1-6]\~(\S+)\s+(.+)/m
- name,obj=$1,$2
- note=endnote_test?(obj)
- obj,tags=extract_tags(obj,name)
- h={:lv=>lv,:name=>name,:obj=>obj,:idx=>idx,:tags=>tags}
- SiSU_document_structure::Object_heading.new.heading(h)
- else nil
- end
- when /^(?:_[1-9]|_[1-9]?\*)\s+/ #indented and/or bullet paragraph
- t_o=if t_o=~/^(_(?:[1-9]?\*|[1-9])\s+)(.+)/m
- tst,obj=$1,$2
- indent=indent_test(tst)
- bullet=bullet_test(tst)
- image=image_test(obj)
- note=endnote_test?(obj)
- obj,tags=extract_tags(obj)
- unless obj=~/\A\s*\Z/m
- h={:bullet_=>bullet,:indent=>indent,:obj=>obj,:idx=>idx,:note_=>note,:image_=>image,:tags=>tags}
- SiSU_document_structure::Object_para.new.paragraph(h)
- end
- else nil
- end
- when /^<?:p[bn]>?\s*$/
- if t_o =~/^<?:pn>?\s*$/
- SiSU_document_structure::Object_layout.new.break(Hx[:br_page_new])
- else SiSU_document_structure::Object_layout.new.break(Hx[:br_page])
- end
- when /^<?:(?:ols|---)>?\s*$/
- SiSU_document_structure::Object_layout.new.break(Hx[:obj_ln_sep])
- else #paragraph
- image=image_test(t_o)
- note=endnote_test?(t_o)
- obj,tags=extract_tags(t_o)
- unless obj=~/\A\s*\Z/m
- h={:bullet_=>false,:indent=>0,:obj=>obj,:idx=>idx,:note_=>note,:image_=>image,:tags=>tags}
- SiSU_document_structure::Object_para.new.paragraph(h)
- end
- end
- elsif not @@flag['code']
- if t_o =~/^code\{/
- @@flag['code']=true
- @@counter=1
- @codeblock_numbered=(t_o =~/^code\{#/) ? true : false
- h={:obj=>'code block start'} #introduce a counter
- t_o=SiSU_document_structure::Object_comment.new.comment(h) #t_o=SiSU_document_structure::Object_layout.new.insert(h)
- elsif t_o =~/^poem\{/
- @@flag['poem']=true
- h={:obj=>'poem start'} #introduce a counter
- t_o=SiSU_document_structure::Object_comment.new.comment(h) #t_o=SiSU_document_structure::Object_layout.new.insert(h)
- tuned_file << t_o
- elsif t_o =~/^group\{/
- @@flag['group']=true
- h={:obj=>'group text start'} #introduce a counter
- t_o=SiSU_document_structure::Object_comment.new.comment(h) #t_o=SiSU_document_structure::Object_layout.new.insert(h)
- tuned_file << t_o
- elsif t_o =~/^alt\{/
- @@flag['alt']=true
- h={:obj=>'alt text start'} #introduce a counter
- t_o=SiSU_document_structure::Object_comment.new.comment(h) #t_o=SiSU_document_structure::Object_layout.new.insert(h)
- tuned_file << t_o
- elsif t_o =~/^(?:table\{|\{table)[ ~]/
- h={:obj=>'table start'} #introduce a counter
- ins=SiSU_document_structure::Object_comment.new.comment(h) #ins=SiSU_document_structure::Object_layout.new.insert(h)
- tuned_file << ins
- if t_o=~/^table\{(?:~h)?\s+/
- @@flag['table']=true
- @rows=''
- case t_o
- when /table\{~h\s+c(\d+);\s+(.+)/
- cols=$1
- col=$2.scan(/\d+/)
- heading=true
- when /table\{\s+c(\d+);\s+(.+)/
- cols=$1
- col=$2.scan(/\d+/)
- heading=false
- end
- @h={:head_=>heading,:cols=>cols,:widths=>col,:idx=>idx}
- elsif t_o=~/^\{table(?:~h)?(?:\s+\d+;?)?\}\n.+\Z/m
- m1,m2,hd=nil,nil,nil
- tbl=/^\{table(?:~h)?(?:\s+\d+;?)?\}\n(.+)\Z/m.match(t_o)[1] #two table representations should be consolidated as one
- hd=((t_o =~/^\{table~h/) ? true : false)
- tbl,tags=extract_tags(tbl)
- rws=tbl.split(/\n/)
- rows=''
- cols=nil
- rws.each do |r|
- cols=(cols ? cols : (r.scan('|').length) +1)
- r.gsub!(/\s*\|\s*/m,"#{Mx[:tc_p]}") #r.gsub!(/\|/m,"#{Mx[:tc_p]}")
- rows += r + Mx[:tc_c]
- end
- col=[]
- if t_o =~/^\{table(?:~h)?\s+(\d+);?\}/ #width of col 1 given as %, usually when wider than rest that are even
- c1=$1.to_i
- width=(100 - c1)/(cols - 1)
- col=[ c1 ]
- (cols - 1).times { col << width }
- else #all columns of equal width
- width=100.00/cols
- cols.times { col << width }
- end
- h={:head_=>hd,:cols=>cols,:widths=>col,:obj=>rows,:idx=>idx,:tags=>tags}
- t_o=SiSU_document_structure::Object_table.new.table(h) unless h.nil?
- tuned_file << t_o
- h={:obj=>'table end'} #introduce a counter
- t_o=SiSU_document_structure::Object_comment.new.comment(h)
- t_o
- elsif t_o=~/^\{table(?:~h)?\s+/
- m1,m2,hd=nil,nil,nil
- h=case t_o
- when /\{table~h\s+(.+?)\}\n(.+)\Z/m #two table representations should be consolidated as one
- m1,tbl,hd=$1,$2,true
- when /\{table\s+(.+?)\}\n(.+)\Z/m #two table representations should be consolidated as one
- m1,tbl,hd=$1,$2,false
- else nil
- end
- tbl,tags=extract_tags(tbl)
- col=m1.scan(/\d+/)
- rws=tbl.split(/\n/)
- rows=''
- rws.each do |r|
- r.gsub!(/\s*\|\s*/m,"#{Mx[:tc_p]}") #r.gsub!(/\|/m,"#{Mx[:tc_p]}")
- rows += r + Mx[:tc_c]
- end
- h={:head_=>hd,:cols=>col.length,:widths=>col,:obj=>rows,:idx=>idx,:tags=>tags}
- t_o=SiSU_document_structure::Object_table.new.table(h) unless h.nil?
- tuned_file << t_o
- h={:obj=>'table end'} #introduce a counter
- t_o=SiSU_document_structure::Object_comment.new.comment(h)
- t_o
- end
- end
- t_o
- end
- if @@flag['table']
- if @@flag['table'] \
- and t_o =~/^\}table/ #two table representations should be consolidated as one
- @@flag['table']=false
- headings,columns,widths,idx=@h[:head_],@h[:cols],@h[:widths],@h[:idx]
- @h={:head_=>headings,:cols=>columns,:widths=>widths,:idx=>idx,:obj=>@rows}
- t_o=SiSU_document_structure::Object_table.new.table(@h)
- tuned_file << t_o
- @h,@rows=nil,''
- t_o
- h={:obj=>'table end'} #introduce a counter
- t_o=SiSU_document_structure::Object_comment.new.comment(h) #t_o=SiSU_document_structure::Object_layout.new.insert(h)
- t_o
- else
- if t_o !~/^table\{/ \
- and not t_o.nil?
- t_o.gsub!(/^\n+/m,'') #check added for ruby 1.9.2 not needed in 1.8 series
- t_o.gsub!(/\n/m,"#{Mx[:tc_p]}")
- @rows += t_o + Mx[:tc_c]
- end
- t_o=nil
- end
- end
- if @@flag['code']
- if t_o =~/^\}code/
- @@flag['code']=false
- obj,tags=extract_tags(@tuned_code.join("\n"))
- h={:obj=>obj,:tags=>tags,:number_=>@codeblock_numbered}
- t_o=SiSU_document_structure::Object_group.new.code(h)
- @tuned_code=[]
- tuned_file << t_o
- h={:obj=>'code block end'} #introduce a counter
- t_o=SiSU_document_structure::Object_comment.new.comment(h) #t_o=SiSU_document_structure::Object_layout.new.insert(h)
- end
- if @@flag['code'] \
- and t_o.class==String \
- and not t_o.nil? #you may need to introduce t_o.class==String test more widely
- sub_array=t_o.dup + "#{Mx[:br_nl]}"
- @line_mode=sub_array.scan(/.+/)
- @line_mode=[]
- sub_array.scan(/.+/) {|w| @line_mode << w if w =~/[\S]+/}
- t_o=SiSU_document_structure_extract::Build.new(@md,@line_mode).build_lines('code').join
- @tuned_code << t_o
- t_o=nil
- end
- elsif @@flag['poem'] \
- or @@flag['group'] \
- or @@flag['alt']
- if @@flag['poem'] \
- and t_o =~/^\}poem/
- @@flag['poem']=false
- h={:obj=>'poem end'} #introduce a counter
- t_o=SiSU_document_structure::Object_comment.new.comment(h) #t_o=SiSU_document_structure::Object_layout.new.insert(h)
- elsif ( @@flag['group'] \
- and t_o =~/^\}group/ )
- @@flag['group']=false
- obj,tags=extract_tags(@tuned_group.join("\n"))
- h={:obj=>obj,:tags=>tags}
- @tuned_group=[]
- t_o=SiSU_document_structure::Object_group.new.group(h)
- tuned_file << t_o
- h={:obj=>'group text end'} #introduce a counter
- t_o=SiSU_document_structure::Object_comment.new.comment(h) #t_o=SiSU_document_structure::Object_layout.new.insert(h)
- elsif ( @@flag['alt'] \
- and t_o =~/^\}alt/ )
- @@flag['alt']=false
- obj,tags=extract_tags(@tuned_group.join("\n"))
- h={:obj=>obj,:tags=>tags}
- t_o=SiSU_document_structure::Object_group.new.alt(h)
- @tuned_group=[]
- tuned_file << t_o
- h={:obj=>'alt text end'} #introduce a counter
- t_o=SiSU_document_structure::Object_comment.new.comment(h) #t_o=SiSU_document_structure::Object_layout.new.insert(h)
- end
- if @@flag['poem'] \
- or @@flag['group'] \
- or @@flag['alt'] \
- and t_o =~/\S/ \
- and t_o !~/^(?:\}(?:verse|code|alt|group)|(?:verse|code|alt|group)\{)/ # fix logic
- sub_array=t_o.dup
- @line_mode=sub_array.scan(/.+/)
- type=if @@flag['poem']; 'poem'
- t_o=SiSU_document_structure_extract::Build.new(@md,@line_mode).build_lines(type).join
- poem=t_o.split(/\n\n/)
- poem.each do |v|
- v.gsub!(/\n/m,"#{Mx[:br_nl]}\n")
- obj,tags=extract_tags(v)
- h={:obj=>obj,:tags=>tags}
- t_o=SiSU_document_structure::Object_group.new.verse(h)
- tuned_file << t_o
- end
- else 'group'
- end
- @verse_count+=1 if @@flag['poem']
- end
- end
- if not @@flag['code']
- if @@flag['poem'] \
- or @@flag['group'] \
- or @@flag['alt']
- if t_o.class==String
- t_o.gsub!(/\n/m,"#{Mx[:br_nl]}")
- t_o.gsub!(/[ ][ ]/m,"#{Mx[:nbsp]*2}")
- t_o.gsub!(/#{Mx[:nbsp]}\s/,"#{Mx[:nbsp]*2}")
- t_o=t_o + Mx[:br_nl] if t_o =~/\S+/
- elsif t_o.is=='group' \
- or t_o.is=='alt' \
- or t_o.is=='verse'
- t_o.obj.gsub!(/\n/m,"#{Mx[:br_nl]}")
- t_o.obj.gsub!(/[ ][ ]/m,"#{Mx[:nbsp]*2}")
- t_o.obj.gsub!(/#{Mx[:nbsp]}\s/,"#{Mx[:nbsp]*2}")
- end
- @tuned_group << t_o if t_o =~/\S+/
- else tuned_file << t_o
- end
- else tuned_file << t_o
- end
- end
- if @md.flag_endnotes
- tuned_file << @pb
- h={:ln=>2,:obj=>'Endnotes',:autonum_=>false}
- tuned_file << SiSU_document_structure::Object_heading.new.heading_insert(h)
- h={:ln=>4,:obj=>'Endnotes',:name=>'endnotes',:autonum_=>false}
- tuned_file << SiSU_document_structure::Object_heading.new.heading_insert(h)
- h={:obj=>'Endnotes'}
- end
- if @md.book_idx
- tuned_file << @pb
- h={:ln=>2,:obj=>'Index',:autonum_=>false}
- tuned_file << SiSU_document_structure::Object_heading.new.heading_insert(h)
- h={:ln=>4,:obj=>'Index',:name=>'book_index',:autonum_=>false}
- tuned_file << SiSU_document_structure::Object_heading.new.heading_insert(h)
- h={:obj=>'Index'}
- end
- tuned_file << @pb
- h={:ln=>2,:obj=>'Metadata',:autonum_=>false,:ocn_=>false}
- tuned_file << SiSU_document_structure::Object_heading.new.heading_insert(h)
- h={:ln=>4,:obj=>'SiSU Metadata, document information',:name=>'metadata',:autonum_=>false,:ocn_=>false}
- tuned_file << SiSU_document_structure::Object_heading.new.heading_insert(h)
- tuned_file << @pb
- h={:ln=>2,:obj=>'Manifest',:autonum_=>false,:ocn_=>false}
- tuned_file << SiSU_document_structure::Object_heading.new.heading_insert(h)
- h={:ln=>4,:obj=>'SiSU Manifest, alternative outputs etc.',:name=>'sisu_manifest',:autonum_=>false,:ocn_=>false}
- tuned_file << SiSU_document_structure::Object_heading.new.heading_insert(h)
- tuned_file
- h={:obj=>'eof'}
- meta=SiSU_document_structure::Object_metadata.new.metadata(@metadata)
- [tuned_file,meta]
- end
- def table_rows_and_columns_array(table_str)
- table=[]
- table_str.split(/#{Mx[:tc_c]}/).each do |table_row|
- table_row_with_columns=table_row.split(/#{Mx[:tc_p]}/)
- table << table_row_with_columns
- end
- table
- end
- def meta_heading(h)
- h={:lv=>h[:lv],:ln=>h[:ln],:name=>h[:name],:obj=>h[:obj],:ocn=>'0'}
- SiSU_document_structure::Object_heading.new.heading(h)
- end
- def meta_para(str)
- h={:obj=>str,:ocn_=>false}
- SiSU_document_structure::Object_para.new.paragraph(h)
- end
- def metadata
- meta=[]
- dir=SiSU_Env::Info_env.new(@md.fns)
- base_html="#{dir.url.root}/#{@md.fnb}"
- l=SiSU_Env::Standardise_language.new.file_to_language(@md.fns)
- language=l[:l]
- tr=SiSU_Translate::Source.new(@md,language)
- meta << @pb
- h={:ln=>2,:obj=>'Metadata',:ocn_=>false}
- meta << SiSU_document_structure::Object_heading.new.heading(h)
- h={:ln=>4,:name=>'metadata',:obj=>'Metadata',:autonum_=>false,:ocn_=>false}
- meta << SiSU_document_structure::Object_heading.new.heading(h) #add ocnm
- s="Document Manifest @\n #{base_html}/#{@md.fn[:manifest]}"
- meta << meta_para(s)
- s="#{Mx[:fa_bold_o]}Dublin Core#{Mx[:fa_bold_c]} (DC)" #add ocnm
- meta << meta_para(s)
- s="#{Mx[:fa_italics_o]}DC tags included with this document are provided here.#{Mx[:fa_italics_c]}" #add ocnm
- meta << meta_para(s)
- if defined? @md.title.full \
- and @md.title.full=~/\S+/
- s="#{tr.full_title}: #{Mx[:fa_underscore_o]}#{@md.title.full}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.creator.author \
- and @md.creator.author=~/\S+/
- s="\n#{tr.author}: #{Mx[:fa_underscore_o]}#{@md.creator.author}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.creator.translator \
- and @md.creator.translator=~/\S+/
- s="#{tr.translator}: #{Mx[:fa_underscore_o]}#{@md.creator.translator}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.creator.illustrator \
- and @md.creator.illustrator=~/\S+/
- s="#{tr.illustrator}: #{Mx[:fa_underscore_o]}#{@md.creator.illustrator}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.creator.prepared_by \
- and @md.creator.prepared_by=~/\S+/
- s="\n#{tr.prepared_by}: #{Mx[:fa_underscore_o]}#{@md.creator.prepared_by}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.creator.digitized_by \
- and @md.creator.digitized_by=~/\S+/
- s="#{tr.digitized_by}: #{Mx[:fa_underscore_o]}#{@md.creator.digitized_by}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.rights.all \
- and @md.rights.all=~/\S+/
- s="\n#{tr.rights}: #{Mx[:fa_underscore_o]}#{@md.rights.all}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.notes.description \
- and @md.notes.description=~/\S+/
- s="#{tr.description}: #{Mx[:fa_underscore_o]}#{@md.notes.description}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.classify.subject \
- and @md.classify.subject=~/\S+/
- s="#{tr.subject}: #{Mx[:fa_underscore_o]}#{@md.classify.subject}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.publisher \
- and @md.publisher=~/\S+/
- s="\n#{tr.publisher}: #{Mx[:fa_underscore_o]}#{@md.publisher}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.creator.contributor \
- and @md.creator.contributor=~/\S+/
- s="\n#{tr.contributor}: #{Mx[:fa_underscore_o]}#{@md.creator.contributor}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.notes.abstract \
- and @md.notes.abstract=~/\S+/
- s="\n#{tr.abstract}: #{Mx[:fa_underscore_o]}#{@md.notes.abstract}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.date.created \
- and @md.date.created=~/\S+/
- s="\n#{tr.date_created}: #{Mx[:fa_underscore_o]}#{@md.date.created}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.date.issued \
- and @md.date.issued=~/\S+/
- s="\n#{tr.date_issued}: #{Mx[:fa_underscore_o]}#{@md.date.issued}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.date.available \
- and @md.date.available=~/\S+/
- s="\n#{tr.date_available}: #{Mx[:fa_underscore_o]}#{@md.date.available}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.date.modified \
- and @md.date.modified=~/\S+/
- s="\n#{tr.date_modified}: #{Mx[:fa_underscore_o]}#{@md.date.modified}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.date.valid \
- and @md.date.valid=~/\S+/
- s="\n#{tr.date_valid}: #{Mx[:fa_underscore_o]}#{@md.date.valid}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.date.published \
- and @md.date.published=~/\S+/
- s="\n#{tr.date}: #{Mx[:fa_underscore_o]}#{@md.date.published}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.classify.loc \
- and @md.classify.loc=~/\S+/
- s="\n#{tr.cls_loc}: #{Mx[:fa_underscore_o]}#{@md.classify.loc}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.classify.dewey \
- and @md.classify.dewey=~/\S+/
- s="\n#{@cls_dewey}: #{Mx[:fa_underscore_o]}#{@md.classify.dewey}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.classify.pg \
- and @md.classify.pg=~/\S+/
- s="\n#{tr.cls_gutenberg}: #{Mx[:fa_underscore_o]}#{@md.classify.pg}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.classify.isbn \
- and @md.classify.isbn=~/\S+/
- s="\n#{tr.cls_isbn}: #{Mx[:fa_underscore_o]}#{@md.classify.isbn}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.notes.comment \
- and @md.notes.comment=~/\S+/
- s="\n#{tr.comments}: #{Mx[:fa_underscore_o]}#{@md.notes.comment}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.notes.prefix_a \
- and @md.notes.prefix_a=~/\S+/
- s="\n#{tr.prefix_a}: #{Mx[:fa_underscore_o]}#{@md.notes.prefix_a}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.notes.prefix_b \
- and @md.notes.prefix_b=~/\S+/
- s="\n#{tr.prefix_b}: #{Mx[:fa_underscore_o]}#{@md.notes.prefix_b}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.classify.identifier \
- and @md.classify.identifier=~/\S+/
- s="\n#{tr.identifier}: #{Mx[:fa_underscore_o]}#{@md.classify.identifier}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.original.source \
- and @md.original.source=~/\S+/
- s="\n#{tr.source}: #{Mx[:fa_underscore_o]}#{@md.original.source}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.title.language \
- and @md.title.language=~/\S+/
- s="\n#{tr.language}: #{Mx[:fa_underscore_o]}#{@md.title.language}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.original.language \
- and @md.original.language=~/\S+/
- s="\n#{tr.language_original}: #{Mx[:fa_underscore_o]}#{@md.original.language}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.classify.format \
- and @md.classify.format=~/\S+/
- s="\n#{tr.format}: #{Mx[:fa_underscore_o]}#{@md.classify.format}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.classify.relation \
- and @md.classify.relation=~/\S+/
- s="\n#{tr.relation}: #{Mx[:fa_underscore_o]}#{@md.classify.relation}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.classify.coverage \
- and @md.classify.coverage=~/\S+/
- s="\n#{tr.coverage}: #{Mx[:fa_underscore_o]}#{@md.classify.coverage}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.classify.keywords \
- and @md.classify.keywords=~/\S+/
- s="\n#{tr.keywords}: #{Mx[:fa_underscore_o]}#{@md.classify.keywords}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- s="#{Mx[:fa_bold_o]}Version Information#{Mx[:fa_bold_c]}"
- meta << meta_para(s)
- if defined? @md.fns \
- and @md.fns=~/\S+/
- s="#{tr.sourcefile}: #{Mx[:fa_underscore_o]}#{@md.fns}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.file_encoding \
- and @md.file_encoding=~/\S+/
- s="Filetype: #{Mx[:fa_underscore_o]}#{@md.file_encoding}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.dgst \
- and @md.dgst.class==Array
- s="Source Digest: #{@md.dgst[0]} #{Mx[:fa_underscore_o]}#{@md.dgst[1]}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- if defined? @md.dgst_skin \
- and @md.dgst_skin.class==Array
- s="Skin Digest: #{@md.dgst_skin[0]} #{Mx[:fa_underscore_o]}#{@md.dgst_skin[1]}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- end
- s="#{Mx[:fa_bold_o]}Generated#{Mx[:fa_bold_c]}"
- meta << meta_para(s)
- s="#{tr.last_generated}: #{Mx[:fa_underscore_o]}#{Time.now}#{Mx[:fa_underscore_c]}"
- meta << meta_para(s)
- s="#{tr.sisu_version}: #{Mx[:fa_underscore_o]}#{@md.sisu_version[:project]}#{Mx[:fa_underscore_c]} #{Mx[:fa_underscore_o]}#{@md.sisu_version[:version]}#{Mx[:fa_underscore_c]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})"
- meta << meta_para(s)
- meta
- end
- def build_lines(type='')
- data=@data
- data.each do |line|
- if line =~/\S/ \
- and line !~/^code\{|^\}code/ \
- and line.class != Hash
- line.gsub!(/\s\s/,"#{Mx[:nbsp]*2}")
- line.gsub!(/#{Mx[:nbsp]}\s/,"#{Mx[:nbsp]*2}")
- line.gsub!(/^/,"#{Mx[:gr_o]}codeline#{Mx[:gr_c]}") if type=='code' # REMOVE try sort for texpdf special case
- if line =~/(?:https?|file|ftp):\/\/\S+$/
- line.gsub!(/\s*$/," #{Mx[:br_nl]}")
- else line.gsub!(/\s*$/,"#{Mx[:br_nl]}") #unless type=='code'
- end
- if @@flag['code']; @@counter+=1
- else
- end
- elsif line =~/^\s*$/
- line.gsub!(/\s*$/,"#{Mx[:br_nl]}")
- end
- end
- data
- end
- end
- class Structure # this must happen early
- def initialize(md,dob)
- @md,@dob=md,dob
- end
- def structure
- structure_markup_normalize
- structure_markup
- @dob
- end
- def structure_markup #build structure where structure provided only in meta header
- @dob=if @dob.is =~/para/ \
- and @dob.indent !~/[1-9]/ \
- and not @dob.bullet_
- @dob=case @dob.obj
- when /^#{@md.lv1}/
- h={:lv=>'A',:ln=>1}
- SiSU_document_structure::Object_heading.new.heading(h,@dob)
- when /^#{@md.lv2}/
- h={:lv=>'B',:ln=>2}
- SiSU_document_structure::Object_heading.new.heading(h,@dob)
- when /^#{@md.lv3}/
- h={:lv=>'C',:ln=>3}
- SiSU_document_structure::Object_heading.new.heading(h,@dob)
- when /^#{@md.lv4}/
- h={:lv=>'1',:ln=>4}
- SiSU_document_structure::Object_heading.new.heading(h,@dob)
- when /^#{@md.lv5}/
- h={:lv=>'2',:ln=>5}
- SiSU_document_structure::Object_heading.new.heading(h,@dob)
- when /^#{@md.lv6}/
- h={:lv=>'3',:ln=>6}
- SiSU_document_structure::Object_heading.new.heading(h,@dob)
- else @dob
- end
- else @dob
- end
- @dob
- end
- def structure_markup_normalize #needs a bit of thinking
- dob=if @md.markup_version.determined < 0.38 #%convert internal representation, consider making 0.38 structure default ([A-C1-6] instead of [1-9]), requires downstream changes
- @dob.gsub!(/^[456]~/,'!_')
- @dob.gsub!(/^3~(\S+)/,"#{Mx[:lv_o]}6:\\1#{Mx[:lv_c]}")
- @dob.gsub!(/^3~\s+/,"#{Mx[:lv_o]}6:#{Mx[:lv_c]}")
- @dob.gsub!(/^2~(\S+)/,"#{Mx[:lv_o]}5:\\1#{Mx[:lv_c]}")
- @dob.gsub!(/^2~\s+/,"#{Mx[:lv_o]}5:#{Mx[:lv_c]}")
- @dob.gsub!(/^1~(\S+)/,"#{Mx[:lv_o]}4:\\1#{Mx[:lv_c]}")
- @dob.gsub!(/^1~\s+/,"#{Mx[:lv_o]}4:#{Mx[:lv_c]}")
- @dob.gsub!(/^:?C~(\S+)/,"#{Mx[:lv_o]}3:\\1#{Mx[:lv_c]}")
- @dob.gsub!(/^:?C~\s+/,"#{Mx[:lv_o]}3:#{Mx[:lv_c]}")
- @dob.gsub!(/^:?B~(\S+)/,"#{Mx[:lv_o]}2:\\1#{Mx[:lv_c]}")
- @dob.gsub!(/^:?B~\s+/,"#{Mx[:lv_o]}2:#{Mx[:lv_c]}")
- @dob.gsub!(/^:?A~(\S+)/,"#{Mx[:lv_o]}1:\\1#{Mx[:lv_c]}")
- @dob.gsub!(/^:?A~\s+/,"#{Mx[:lv_o]}1:#{Mx[:lv_c]}")
- @dob=if @dob =~/^@(?:level|markup):\s/
- @dob.gsub!(/3/,'6')
- @dob.gsub!(/2/,'5')
- @dob.gsub!(/1/,'4')
- @dob.gsub!(/:?C/,'3')
- @dob.gsub!(/:?B/,'2')
- @dob.gsub!(/:?A/,'1')
- @dob
- else @dob
- end
- else @dob
- end
- end
- def structure_marks
- t_o=if @md.markup_version.determined < 0.38
- @t_o.gsub!(/^1~(\S+)/,"#{Mx[:lv_o]}1:\\1#{Mx[:lv_c]}")
- @t_o.gsub!(/^1~\s+/,"#{Mx[:lv_o]}1:#{Mx[:lv_c]}")
- @t_o.gsub!(/^2~(\S+)/,"#{Mx[:lv_o]}2:\\1#{Mx[:lv_c]}")
- @t_o.gsub!(/^2~\s+/,"#{Mx[:lv_o]}2:#{Mx[:lv_c]}")
- @t_o.gsub!(/^3~(\S+)/,"#{Mx[:lv_o]}3:\\1#{Mx[:lv_c]}")
- @t_o.gsub!(/^3~\s+/,"#{Mx[:lv_o]}3:#{Mx[:lv_c]}")
- @t_o.gsub!(/^4~(\S+)/,"#{Mx[:lv_o]}4:\\1#{Mx[:lv_c]}")
- @t_o.gsub!(/^4~\s+/,"#{Mx[:lv_o]}4:#{Mx[:lv_c]}")
- @t_o.gsub!(/^5~(\S+)/,"#{Mx[:lv_o]}5:\\1#{Mx[:lv_c]}")
- @t_o.gsub!(/^5~\s+/,"#{Mx[:lv_o]}5:#{Mx[:lv_c]}")
- @t_o.gsub!(/^6~(\S+)/,"#{Mx[:lv_o]}6:\\1#{Mx[:lv_c]}")
- @t_o.gsub!(/^6~\s+/,"#{Mx[:lv_o]}6:#{Mx[:lv_c]}")
- @t_o.gsub!(/^[789]~/,'!_')
- @t_o
- else @t_o
- end
- end
- end
- class OCN
- def initialize(md,data)
- @md,@data=md,data
- end
- def ocn #and auto segment numbering increment
- data=@data
- @o_array=[]
- node=ocn=ocn_dv=ocn_sp=ocnh=ocnh1=ocnh2=ocnh3=ocnh4=ocnh5=ocnh6=ocno=ocnp=ocnt=ocnc=ocng=ocni=ocnm=ocnu=ocnk=nm=0 # h heading, o other, t table, g group, i image
- node_count_flag=false
- regex_exclude_ocn_and_node = /#{Rx[:meta]}|^@\S+?:\s|^4~endnotes|^#{Mx[:lv_o]}4:endnotes#{Mx[:lv_c]}|^\^~ |<:e[:_]\d+?>|^<:\#|<:- |<[:!]!4|<hr width|#{Mx[:br_endnotes]}|\A\s*\Z/mi #ocn here #&nbsp; added with Tune.code #¡
- parent=node1=node2=node3=node4=node5=node6=nil
- data.each do |dob|
- h={}
- if dob.obj !~ regex_exclude_ocn_and_node \
- and dob.of !~/(?:comment|layout|meta)/ \
- and dob.obj !~/#{Mx[:pa_non_object_no_heading]}|#{Mx[:pa_non_object_dummy_heading]}/ \
- and dob.ocn_
- #dob.ln now is determined, and set earlier, check how best to remove this -->
- if dob.is=='heading'
- ln=case dob.lv
- when 'A'; 1
- when 'B'; 2
- when 'C'; 3
- when '1'; 4
- when '2'; 5
- when '3'; 6
- when '4'; 7
- when '5'; 8
- when '6'; 9
- end
- end
- if not dob.obj =~/<:#>|~#|-#/ \
- or not dob.toc_ # fix this no longer in dob.obj
- ocn+=1
- if dob.is=='heading' \
- and (ln.to_s =~/^[1-9]/ \
- or ln.to_s =~@md.lv1 \
- or ln.to_s =~@md.lv2 \
- or ln.to_s =~@md.lv3 \
- or ln.to_s =~@md.lv4 \
- or ln.to_s =~@md.lv5 \
- or ln.to_s =~@md.lv6)
- ocnh+=1
- if ln==1 \
- or ln=~@md.lv1; ocnh1+=1 #heading
- node1="1:#{ocnh1};#{ocn}"
- node,ocn_sp,parent=node1,"h#{ocnh}",0 #FIX
- elsif ln==2 \
- or ln=~@md.lv2; ocnh2+=1
- node2="2:#{ocnh2};#{ocn}"
- node,ocn_sp,parent=node2,"h#{ocnh}",node1
- elsif ln==3 \
- or ln=~@md.lv3; ocnh3+=1
- node3="3:#{ocnh3};#{ocn}"
- node,ocn_sp,parent=node3,"h#{ocnh}",node2
- elsif ln==4 \
- or ln=~@md.lv4; ocnh4+=1
- node4="4:#{ocnh4};#{ocn}"
- node,ocn_sp,parent=node4,"h#{ocnh}",node3
- elsif ln==5 \
- or ln=~@md.lv5; ocnh5+=1
- node5="5:#{ocnh5};#{ocn}"
- node,ocn_sp,parent=node5,"h#{ocnh}",node4
- elsif ln==6 \
- or ln=~@md.lv6; ocnh6+=1
- node6="6:#{ocnh6};#{ocn}"
- node,ocn_sp,parent=node6,"h#{ocnh}",node5
- end
- else
- ocno+=1
- if dob.is=='table'
- ocnt+=1
- ocn_sp,parent="t#{ocnt}",node
- elsif dob.is=='code'
- ocnc+=1
- ocn_sp,parent="c#{ocnc}",node
- elsif dob.is=~/^(?:group|alt|verse)/
- ocng+=1 #group, poem
- ocn_sp,parent="g#{ocng}",node
- elsif dob.is=~/image|#{Mx[:lnk_o]}\S+?\.(?:png|jpg|gif)\s+/m
- ocni+=1
- ocn_sp,parent="i#{ocni}",node
- else ocnp+=1 #paragraph
- ocn_sp,parent="p#{ocnp}",node
- end
- end
- if dob.is=='heading'
- dob.ln,dob.node,dob.ocn,dob.odv,dob.osp,dob.parent=ln,node,ocn,ocn_dv,ocn_sp,parent
- else
- unless dob.of=~/meta|comment|layout/
- dob.ocn,dob.odv,dob.osp,dob.parent=ocn,ocn_dv,ocn_sp,parent
- end
- end
- else ocnu+=1
- dob.obj.gsub!(/#{Mx[:fa_o]}~##{Mx[:fa_c]}/,'') if dob.obj
- ocn_dv,ocn_sp="u#{ocnu}","u#{ocnu}"
- dob.ocn,dob.odv,dob.osp=ocn,ocn_dv,ocn_sp
- end
- h
- elsif dob.obj=~/#{Mx[:pa_non_object_no_heading]}/
- dob.obj.gsub!(/#{Mx[:pa_non_object_no_heading]}/,'')
- if dob.is=='para'
- h={:obj=>dob.obj,:ocn_=>false,:ocn=>nil}
- dob=SiSU_document_structure::Object_para.new.paragraph(h,dob)
- elsif dob.is=='heading'
- h={:obj=>dob.obj,:ocn_=>false,:ocn=>nil,:toc_=>true}
- dob=SiSU_document_structure::Object_heading.new.heading(h,dob)
- end
- elsif dob.obj=~/#{Mx[:pa_non_object_dummy_heading]}/
- dob.obj.gsub!(/#{Mx[:pa_non_object_dummy_heading]}/,'')
- if dob.is=='para'
- h={:obj=>dob.obj,:ocn_=>false,:ocn=>nil}
- dob=SiSU_document_structure::Object_para.new.paragraph(h,dob)
- elsif dob.is=='heading'
- h={:obj=>dob.obj,:ocn_=>false,:ocn=>nil,:toc_=>false}
- dob=SiSU_document_structure::Object_heading.new.heading(h,dob)
- end
- else dob
- end
- dob.obj.gsub!(/\n\n/,"\n") if dob.is =~/(?:code|verse|alt|group)/ #newlines taken out
- @o_array << dob
- end
- @o_array
- end
- end
- class XML
- def initialize(md,data)
- @data,@md=data,md
- end
- def dom
- @s=['0',
- 'A',
- 'B',
- 'C',
- '1',
- '2',
- '3'
- ]
- @sp=' '
- tuned_file=structure_build
- tuned_file
- end
- def structure_build
- data=@data
- tuned_file=[]
- hs=[0,false,false,false]
- t={:lv =>@s[0],:status =>'open'}
- tuned_file << tags(t)
- if @md.cmd =~/V/
- puts "\nXML sisu structure outline --->\n"
- puts "<#{@s[0]}>"
- end
- data.each_with_index do |o,i|
- if o.is =~/^heading/
- case o.ln
- when 1
- tuned_file << tag_close(o.ln,hs)
- tuned_file << tag_open(o,@s)
- if @md.cmd =~/V/
- puts_tag_close(o.ln,hs)
- puts_tag_open(o,@s)
- end
- hs=[1,true,false,false]
- when 2
- tuned_file << tag_close(o.ln,hs)
- tuned_file << tag_open(o,@s)
- if @md.cmd =~/V/
- puts_tag_close(o.ln,hs)
- puts_tag_open(o,@s)
- end
- hs=[2,true,true,false]
- when 3
- tuned_file << tag_close(o.ln,hs)
- tuned_file << tag_open(o,@s)
- if @md.cmd =~/V/
- puts_tag_close(o.ln,hs)
- puts_tag_open(o,@s)
- end
- hs=[3,true,true,true]
- when 4
- tuned_file << tag_close(o.ln,hs)
- tuned_file << tag_open(o,@s)
- if @md.cmd =~/V/
- puts_tag_close(o.ln,hs)
- puts_tag_open(o,@s)
- end
- hs[0]=4
- when 5
- tuned_file << tag_close(o.ln,hs)
- tuned_file << tag_open(o,@s)
- if @md.cmd =~/V/
- puts_tag_close(o.ln,hs)
- puts_tag_open(o,@s)
- end
- hs[0]=5
- when 6
- tuned_file << tag_close(o.ln,hs)
- tuned_file << tag_open(o,@s)
- if @md.cmd =~/V/
- puts_tag_close(o.ln,hs)
- puts_tag_open(o,@s)
- end
- hs[0]=6
- end
- end
- tuned_file << o
- end
- puts_tag_close(0,hs) if @md.cmd =~/V/
- tuned_file << tag_close(0,hs)
- tuned_file.flatten!
- tuned_file
- end
- def tags(o)
- tag=if o[:status]=='open'
- %{<#{o[:lv]} id="#{o[:node]}">}
- else "</#{o[:lv]}>"
- end
- ln=case o[:lv]
- when 'A'; 1
- when 'B'; 2
- when 'C'; 3
- when '1'; 4
- when '2'; 5
- when '3'; 6
- when '4'; 7
- when '5'; 8
- when '6'; 9
- end
- h={:tag=>tag,:node=>o[:node],:lv =>o[:lv],:ln =>ln,:status =>o[:status]}
- SiSU_document_structure::Object_structure.new.xml_dom(h) #downstream code utilise else ignore like comments
- end
- def tag_open(o,tag)
- t={:lv =>tag[o.ln],:node =>o.node,:status =>'open'}
- t_o=tags(t)
- t_o
- end
- def tag_close(lev,hs)
- ary=[]
- case hs[0]
- when 1
- if (lev <= 1) and hs[1]
- t={:lv =>@s[1],:status =>'close'}
- ary << tags(t)
- end
- if (lev==0)
- t={:lv =>@s[0],:status =>'close'}
- ary << tags(t)
- end
- when 2
- if (lev <= 2) and hs[2]
- t={:lv =>@s[2],:status =>'close'}
- ary << tags(t)
- end
- if (lev <= 1) and hs[1]
- t={:lv =>@s[1],:status =>'close'}
- ary << tags(t)
- end
- if (lev==0)
- t={:lv =>@s[0],:status =>'close'}
- ary << tags(t)
- end
- when 3
- if (lev <= 3) and hs[3]
- t={:lv =>@s[3],:status =>'close'}
- ary << tags(t)
- end
- if (lev <= 2) and hs[2]
- t={:lv =>@s[2],:status =>'close'}
- ary << tags(t)
- end
- if (lev <= 1) and hs[1]
- t={:lv =>@s[1],:status =>'close'}
- ary << tags(t)
- end
- if (lev==0)
- t={:lv =>@s[0],:status =>'close'}
- ary << tags(t)
- end
- when 4
- if (lev <= 4)
- t={:lv =>@s[4],:status =>'close'}
- ary << tags(t)
- end
- if (lev <= 3) and hs[3]
- t={:lv =>@s[3],:status =>'close'}
- ary << tags(t)
- end
- if (lev <= 2) and hs[2]
- t={:lv =>@s[2],:status =>'close'}
- ary << tags(t)
- end
- if (lev <= 1) and hs[1]
- t={:lv =>@s[1],:status =>'close'}
- ary << tags(t)
- end
- if (lev==0)
- t={:lv =>@s[0],:status =>'close'}
- ary << tags(t)
- end
- when 5
- if (lev <= 5)
- t={:lv =>@s[5],:status =>'close'}
- ary << tags(t)
- end
- if (lev <= 4)
- t={:lv =>@s[4],:status =>'close'}
- ary << tags(t)
- end
- if (lev <= 3) and hs[3]
- t={:lv =>@s[3],:status =>'close'}
- ary << tags(t)
- end
- if (lev <= 2) and hs[2]
- t={:lv =>@s[2],:status =>'close'}
- ary << tags(t)
- end
- if (lev <= 1) and hs[1]
- t={:lv =>@s[1],:status =>'close'}
- ary << tags(t)
- end
- if (lev==0)
- t={:lv =>@s[0],:status =>'close'}
- ary << tags(t)
- end
- when 6
- if (lev <= 6)
- t={:lv =>@s[6],:status =>'close'}
- ary << tags(t)
- end
- if (lev <= 5)
- t={:lv =>@s[5],:status =>'close'}
- ary << tags(t)
- end
- if (lev <= 4)
- t={:lv =>@s[4],:status =>'close'}
- ary << tags(t)
- end
- if (lev <= 3) and hs[3]
- t={:lv =>@s[3],:status =>'close'}
- ary << tags(t)
- end
- if (lev <= 2) and hs[2]
- t={:lv =>@s[2],:status =>'close'}
- ary << tags(t)
- end
- if (lev <= 1) and hs[1]
- t={:lv =>@s[1],:status =>'close'}
- ary << tags(t)
- end
- if (lev==0)
- t={:lv =>@s[0],:status =>'close'}
- ary << tags(t)
- end
- end
- ary
- end
- def puts_tag_open(o,tag)
- puts %{#{@sp*o.ln}<#{tag[o.ln]} id="#{o.node}">}
- end
- def puts_tag_close(lev,hs)
- case hs[0]
- when 1
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
- puts "</#{@s[0]}>" if (lev==0)
- when 2
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
- puts "</#{@s[0]}>" if (lev==0)
- when 3
- puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) and hs[3]
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
- puts "</#{@s[0]}>" if (lev==0)
- when 4
- puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4)
- puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) and hs[3]
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
- puts "</#{@s[0]}>" if (lev==0)
- when 5
- puts "#{@sp*5}</#{@s[5]}>" if (lev <= 5)
- puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4)
- puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) and hs[3]
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
- puts "</#{@s[0]}>" if (lev==0)
- when 6
- puts "#{@sp*6}</#{@s[6]}>" if (lev <= 6)
- puts "#{@sp*5}</#{@s[5]}>" if (lev <= 5)
- puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4)
- puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) and hs[3]
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
- puts "</#{@s[0]}>" if (lev==0)
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/v2/dal_expand_insertions.rb b/lib/sisu/v2/dal_expand_insertions.rb
deleted file mode 100644
index f7adb76e..00000000
--- a/lib/sisu/v2/dal_expand_insertions.rb
+++ /dev/null
@@ -1,198 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/copyleft/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: system environment, resource control and configuration details
-
-=end
-module SiSU_insertions
- class Insertions
- def initialize(md,data)
- @md,@data=md,data
- end
- def output_filetypes_in_cmd(cmd_shortcut,source=nil) #make list of file types in shortcut command (as configured), e.g. when sisu -3 is used
- cf_defaults=SiSU_Env::Info_processing_flag.new
- cmd_list=case cmd_shortcut.inspect
- when /0/; cf_defaults.cf_0
- when /1/; cf_defaults.cf_1
- when /2/; cf_defaults.cf_2
- when /3/; cf_defaults.cf_3
- when /4/; cf_defaults.cf_4
- when /5/; cf_defaults.cf_5
- end
- file_type_names={}
- file_type_names[:gen],file_type_names[:src]=[],[]
- file_type_names[:gen] <<= if cmd_list =~ /y/; 'sisu_manifest.html'
- end
- file_type_names[:gen] <<= if cmd_list =~ /h/; ['toc.html', 'doc.html']
- end
- file_type_names[:gen] <<= if cmd_list =~ /e/; ['.epub']
- end
- file_type_names[:gen] <<= if cmd_list =~ /p/; ['landscape.pdf', 'portrait.pdf']
- end
- file_type_names[:gen] <<= if cmd_list =~ /o/; 'opendocument.odt'
- end
- file_type_names[:gen] <<= if cmd_list =~ /b/; 'scroll.xhtml'
- end
- file_type_names[:gen] <<= if cmd_list =~ /x/; 'sax.xml'
- end
- file_type_names[:gen] <<= if cmd_list =~ /X/; 'dom.xml'
- end
- file_type_names[:gen] <<= if cmd_list =~ /a/; 'plain.txt'
- end
- file_type_names[:gen] <<= if cmd_list =~ /g/; 'wiki.txt'
- end
- file_type_names[:gen] <<= if cmd_list =~ /w/; 'concordance.html'
- end
- file_type_names[:gen] <<= if cmd_list =~ /N/; 'digest.txt'
- end
- file_type_names[:src] <<= if source and cmd_shortcut =~ /s/; source
- end
- file_type_names[:src] <<= if cmd_shortcut =~ /S/; "#{source}.zip"
- end
- file_type_names[:gen]=file_type_names[:gen].flatten
- file_type_names[:src]=file_type_names[:src].flatten
- file_type_names
- end
- def expand_insertions?
- data=@data
- tuned_file,tuned_file_tmp=[],[]
- data.each do |para|
- if para !~/^%+\s/ \
- and para =~/\{(?:~\^\s+)?(.+?)\s\[(?:\d(?:[sS]*))\]\}(?:\.\.\/\S+?\/|\S+?\.ss[tm]\b)/
- txt,cmd,source,url_dir,note,manifest=nil,nil,nil,nil,nil,nil
- @u=SiSU_Env::Info_env.new.url
- if defined? @u.remote
- if para =~/(.+?)\{(.+?)\s\[(\d[sS]*)\]\}((\S+?)\.ss[tm]\b)(.*)/m
- pre,txt,cmd,source,url_dir,note="#{$1.strip} ",$2,$3,$4,$5,$6
- elsif para =~/\{(.+?)\s\[(\d[sS]*)\]\}((\S+?)\.ss[tm]\b)(.*)/
- pre,txt,cmd,source,url_dir,note='',$1,$2,$3,$4,$5
- end
- manifest="#{pre}{#{txt} }#{@u.remote}/#{url_dir}/toc.html#{note}\n\n"
- else
- puts "error, does currently support relative paths (reltive paths were removed, as had problems for citation, and was not suited to all output types should possibly reconsider) #{__FILE__} #{__LINE__}"
- if para =~/\{(?:~\^\s+)?(.+?)\s\[(\d[sS]*)\]\}\.\.\/(\S+?)\/(\s+#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]})?/
- txt,cmd,url_dir,note=$1,$2,$3,$4
- manifest="{ #{txt} }../#{url_dir}/toc.html#{note}\n\n"
- end
- end
- tuned_file_tmp << manifest
- output_filetypes=output_filetypes_in_cmd(cmd,source)
- output_filetypes[:gen].each do |o_f|
- describe = case o_f
- when /sisu_manifest.html/; '~^ document manifest'
- when /toc.html/; ' html, segmented text'
- when /doc.html/; ' html, scroll, document in one'
- when /\.epub/; ' epub'
- when /landscape.pdf/; ' pdf, landscape'
- when /portrait.pdf/; ' pdf, portrait'
- when /opendocument.odt/; ' odf:odt, open document text'
- when /scroll.xhtml/; ' xhtml scroll'
- when /sax.xml/; ' xml, sax'
- when /dom.xml/; ' xml, dom'
- when /plain.txt/; ' plain text utf-8'
- #when /manpage.1/; ' man, 1'
- when /wiki.txt/; ' wiki text'
- when /concordance.html/; ' concordance'
- when /digest.txt/; ' dcc, document content certificate (digests)'
- else nil
- end
- if describe
- tuned_file_tmp << if @u.remote #to double space <:br> at beginning of entry
- if describe =~/epub/
- "#{Mx[:nbsp]*4} { #{describe} }#{@u.remote}/epub/#{url_dir}#{o_f} "
- elsif describe =~/^~\^ /
- "#{Mx[:nbsp]*4} {#{describe} }#{@u.remote}/#{url_dir}/#{o_f} "
- else "#{Mx[:nbsp]*4} { #{describe} }#{@u.remote}/#{url_dir}/#{o_f} "
- end
- else
- if describe =~/epub/
- "#{Mx[:nbsp]*4} { #{describe} }../epub/#{url_dir}#{o_f} "
- elsif describe =~/^~\^ /
- "#{Mx[:nbsp]*4} {#{describe} }../#{url_dir}/#{o_f} "
- else "#{Mx[:nbsp]*4} { #{describe} }../#{url_dir}/#{o_f} "
- end
- end
- end
- end
- output_filetypes[:src].each do |o_f|
- describe=case o_f
- when /#{source}\.zip/; ' markup source (zipped) pod'
- when /#{source}/; ' markup source text'
- else nil
- end
- if describe
- tuned_file_tmp << if @u.remote
- x=if describe =~/zip/
- "#{Mx[:nbsp]*4} {#{describe} }#{@u.src_pod}/#{o_f} "
- else "#{Mx[:nbsp]*4} {#{describe} }#{@u.src_txt}/#{o_f} "
- end
- else
- x=if describe =~/zip/
- "#{Mx[:nbsp]*4} { #{describe} }../pod/#{o_f} "
- else "#{Mx[:nbsp]*4} { #{describe} }../zip/#{o_f} "
- end
- end
- end
- end
- tuned_file << 'group{' << tuned_file_tmp.join("\n") << '}group'
- tuned_file_tmp=[]
- else tuned_file << para
- end
- end
- tuned_file
- end
- end
-end
-__END__
diff --git a/lib/sisu/v2/dal_syntax.rb b/lib/sisu/v2/dal_syntax.rb
deleted file mode 100644
index 35505d12..00000000
--- a/lib/sisu/v2/dal_syntax.rb
+++ /dev/null
@@ -1,522 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: Syntax for markup, input markup syntaxes, determined here
-
-=end
-module SiSU_Syntax
- class Words
- def initialize(line,md,mkp)
- @line,@md,@mkp=line,md,mkp
- end
- end
- class Markup
- def initialize(md='',data='')
- @data,@md=data,md
- @vz=SiSU_Env::Get_init.instance.skin
- @data_new=[]
- url_and_stub=SiSU_Env::Info_env.new.url
- @output_url="#{url_and_stub.remote}"
- @env=SiSU_Env::Info_env.new
- emph_set=if defined? @md.make.emphasis \
- and not @md.make.emphasis.nil?
- @md.make.emphasis
- else @env.markup_emphasis
- end
- @emph=case emph_set
- when /bold/
- emph_italics=false
- {:o =>Mx[:fa_bold_o], :c =>Mx[:fa_bold_c] }
- when /italics/
- emph_italics=true
- {:o =>Mx[:fa_italics_o], :c =>Mx[:fa_italics_c] }
- when /underscore/
- emph_italics=false
- {:o =>Mx[:fa_underscore_o], :c =>Mx[:fa_underscore_c] }
- else p __LINE__.to_s + '::' + __FILE__
- end
- @http_m=%r{\{.+?\}https?://\S+|https?:\S+|:\S+|\.\.\/\S+|#\S+|\S+?\.png\b|[*]~\S+|^#{Mx[:meta_o]}.+|#{Mx[:gr_o]}(?:code|group|alt|verse)(?:-end)?#{Mx[:gr_c]}|#{Mx[:fa_o]}:br#{Mx[:fa_c]}}
- @manmkp_ital=emph_italics \
- ? '[i/*]\\{.+?\\}[i/*]' \
- : '[i/]\\{.+?\\}[i/]'
- tail_m_ital=%q{(?:\s|[.,;:?!'")]|~\^|~\\\{\s|$)}
- tail_m_bold=%{(?:(?:#{Mx[:fa_italics_c]})?(?:\s|[.,;:?!'")]|~\^|~\\\{\s|$))?}
- bold_line=%{^!_\s.+?(?:#{Mx[:br_line]}|\n|$)}
- ital_line=%{^/_\s.+?(?:#{Mx[:br_line]}|\n|$)}
- @line_scan_ital=if defined? @md.make.italics[:str] \
- and defined? @vz.markup_make_italic[:str]
- /#{@http_m}|#{bold_line}|#{@manmkp_ital}#{tail_m_ital}|(?:#{@md.make.italics[:str]}|#{@vz.markup_make_italic[:str]})#{tail_m_ital}|\S+|\n/
- elsif defined? @md.make.italics[:str]
- /#{@http_m}|#{bold_line}|#{@manmkp_ital}#{tail_m_ital}|#{@md.make.italics[:str]}#{tail_m_ital}|\S+|\n/
- elsif defined? @vz.markup_make_italic[:str]
- /#{@http_m}|#{bold_line}|#{@manmkp_ital}#{tail_m_ital}|#{@vz.markup_make_italic[:str]}#{tail_m_ital}|\S+|\n/
- end
- @manmkp_bold=emph_italics \
- ? '^!_\s.+?(?:\n|$)|[!b]\\{.+?\\}[*!b]|[*!][a-zA-Z0-9\-_]+[!]' \
- : '^!_\s.+?(?:\n|$)|[*!b]\\{.+?\\}[*!b]|[*!][a-zA-Z0-9\-_]+[*!]'
- @line_scan_bold=if (defined? @md.make.bold[:str] \
- and @md.make.bold[:str]) \
- and (defined? @vz.markup_make_bold[:str] \
- and @vz.markup_make_bold[:str])
- /#{@http_m}|#{bold_line}|(?:#{@manmkp_bold}|#{@md.make.bold[:str]}|#{@vz.markup_make_bold[:str]})#{tail_m_bold}|\S+|\n/
- elsif defined? @md.make.bold[:str] \
- and @md.make.bold[:str]
- /#{@http_m}|#{bold_line}|(?:#{@manmkp_bold}|#{@md.make.bold[:str]})#{tail_m_bold}|\S+|\n/
- elsif defined? @vz.markup_make_bold[:str] \
- and @vz.markup_make_bold[:str]
- /#{@http_m}|#{bold_line}|(?:#{@manmkp_bold}|#{@vz.markup_make_bold[:str]})#{tail_m_bold}|\S+|\n/
- end
- end
- def songsheet
- @data.compact!
- @data.each do |dob|
- dob=breaks(dob)
- dob=if @md.sem_tag then sem(dob) else dob end #revisit
- dob=wordlist_italics(dob)
- dob=wordlist_bold(dob)
- dob=bodymarkup(dob)
- @data_new << dob unless dob.nil?
- end
- @data_new
- end
- def sem(dob) #revisit
- dob=SiSU_sem::Tags.new(dob,@md).rm.all
- end
- def breaks(dob)
- if dob.is !~/^(?:meta|comment|code|table)/
- dob.obj.gsub!(/ \\\\(?: |$)/,"#{Mx[:br_line]}")
- dob.obj.gsub!(/(?:<:?br>|<br \/>)/,"#{Mx[:br_line]}") # depreciated
- end
- dob
- end
- def wordlist_italics(dob)
- dob=dob.dup
- if (defined? @md.make.italics[:str] \
- and @md.make.italics[:str]) \
- or (defined? @vz.markup_make_italic[:str] \
- and @vz.markup_make_italic[:str])
- dob.obj=if dob.is !~/^(?:meta|heading|code|comment)/
- word=dob.obj.scan(@line_scan_ital)
- word.flatten!
- word.compact! #reinstated
- line_array=[]
- word.each do |w|
- unless /#{@manmkp_ital}|#{@http_m}/.match(w)
- if defined? @md.make.italics[:regx] \
- and @md.make.italics[:regx]
- w.gsub!(@md.make.italics[:regx],
- "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}")
- elsif defined? @vz.markup_make_italic \
- and @vz.markup_make_italic
- w.gsub!(@vz.markup_make_italic,
- "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}")
- else w
- end
- end
- line_array << w
- end
- line_array.join(' ')
- else dob.obj
- end
- end
- dob
- end
- def embolden(given)
- given.gsub!(/^!_\s+((?:\{|#{Mx[:lnk_o]})(?:~^ )?.+?(?:\}|#{Mx[:lnk_o]})https?:\/\/\S+.*?)([#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/,
- "#{Mx[:fa_bold_o]} \\1 #{Mx[:fa_bold_c]}\\2")
- given.gsub!(/^!_\s+((?:\{|#{Mx[:lnk_o]})(?:~^ )?.+?(?:\}|#{Mx[:lnk_o]})https?:\/\/\S+.*)/,
- "#{Mx[:fa_bold_o]} \\1 #{Mx[:fa_bold_c]}")
- given.gsub!(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)([#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/,
- "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2")
- given.gsub!(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)\s+((?:[*]~\S+\s*)+)/,
- "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2")
- given.gsub!(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)\s*([~-]#)$/,
- "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2")
- given.gsub!(/(?:^!_\s+|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]}\s*)(.*)?\s*$/,
- "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}")
- end
- def italicise(given)
- given.gsub!(/^\/_\s*(.+?)([#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/,
- "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2")
- given.gsub!(/^\/_\s*(.+?)\s+((?:[*]~\S+\s*)+)/,
- "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2")
- given.gsub!(/^\/_\s*(.+?)\s*([~-]#)$/,
- "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2")
- given.gsub!(/^\/_\s+(.*)?\s*$/,
- "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}")
- end
- def wordlist_bold(dob)
- dob=dob.dup
- if (defined? @md.make.bold[:str] \
- and @md.make.bold[:str]) \
- or (defined? @vz.markup_make_bold[:str] \
- and @vz.markup_make_bold[:str])
- dob.obj=if dob.is !~/^(?:meta|heading|code|comment|table)/
- line_array=[]
- word=dob.obj.scan(@line_scan_bold)
- word.flatten!
- word.compact!
- word.each do |w|
- unless /#{@manmkp_bold}|#{@http_m}/.match(w)
- if defined? @md.make.bold[:regx] \
- and @md.make.bold[:regx] #document header: @bold: [bold word list]
- w.gsub!(@md.make.bold[:regx],"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}")
- elsif defined? @vz.markup_make_bold \
- and @vz.markup_make_bold #defaults and skin adjusted bold word list
- w.gsub!(@vz.markup_make_bold,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}")
- end
- else
- if w =~ /(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s+/; embolden(w) #bold paragraph/emphasize #may wish to remove think about 7{ 8{ conversion not satisfactory, as information is lost!
- elsif w =~/^\/_\s+/; italicise(w)
- else w
- end
- end
- line_array << w
- end
- line_array.join(' ')
- else dob.obj
- end
- else
- if dob.is !~/^(?:heading|comment|meta)/ \
- and dob.obj =~ /^!_\s+/
- embolden(dob.obj)
- elsif dob.is=='heading' \
- and dob.ln.to_s =~/[7-9]/
- embolden(dob.obj)
- end
- if dob.obj =~ /\/_\s+/
- italicise(dob.obj)
- end
- end
- dob
- end
- def fontface(dob)
- dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[\{]|\>)\*\{(.+?)\}\*/m,
- "\\1#{@emph[:o]}\\2#{@emph[:c]}") #emphasis
- dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[\{]|\>)!\{(.+?)\}!/m,
- "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold
- dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[\{]|\(|\>)\/\{(.+?)\}\//m,
- "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}") #italics
- dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[\{]|\>)_\{(.+?)\}_/m,
- "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}") #underscore
- dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[\{]|\>)#\{(.+?)\}#/m,
- "\\1#{Mx[:fa_monospace_o]}\\2#{Mx[:fa_monospace_c]}") #monospace
- dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\"\{(.+?)\}\"/m,
- "\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}") #cite /blockquote?
- dob.obj.gsub!(/(^|[^\\])\^\{(.+?)\}\^/m,
- "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") #superscript
- dob.obj.gsub!(/(^|[^\\]),\{(.+?)\},/m,
- "\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}") #subscript
- dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\+\{(.+?)\}\+/m,
- "\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}") #inserted text
- dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)-\{(.+?)\}-/m,
- "\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}") #strikethrough - deleted text
- dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>|\d+)\^(\S+?)\^/,
- "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") #superscript single word, watch digit added
- dob
- end
- def bodymarkup(dob)
- # << http://www.jus.uio.no/sisu/sisu_markup_table/markup >>
- # See: data/sisu/sample/document_samples_sisu_markup/
- ## fontface
- # *{emphasis}* e{emphasis}e <strong>emphasis</strong>
- # !{bold text}! b{bold}b <b>bold text</b>
- # _{underline}_ u{underline}u <u>underline</u>
- # /{italics}/ i{italics}i <i>italics</i>
- # "{citation}" c{citation}c <cite>citation</cite> #blockquote?
- # ^{superscript}^ <sup>superscript</sup>
- # ,{subscript}, <sub>subscript</sub>
- # +{inserted text}+ <ins>inserted text</ins>
- # -{deleted text}- <del>deleted text</del>
- # #{monospace text}#
- #
- # {url address}:url
- # {image.png}imageurl
- # {image.png}png
- # ~{endnote}~ <!e endnote !>
- # !_ #bold/emphasise paragraph
- # _" #blockquote paragraph
- # _1 <:i1> #indent paragraph 1 step
- # _2 <:i2> #indent paragraph 2 steps
- # _3 <:i3> #indent paragraph 3 steps
- # _4 <:i4> #indent paragraph 4 steps
- # _* #bullet (list) ●
- # _1* #bullet (list) indented
- # _1* #bullet (list) indented
- # # #numbered (list) level 1
- # _# #numbered (list) level 2
- dob=dob.dup
- if dob.is !~/^(?:meta|comment|code|table)/
- line_array=[]
- word=dob.obj.scan(/\S+|\n/) #unless line =~/^(?:#{Mx[:meta_o]}|%+\s)/ #visit
- if word
- word.each do |w| # _ - / # | : ! ^ ~
- unless w =~/~\{|\}~|~\[|\]~|^\^~|~\^|\*~\S+|~#|\{t?~|\{table|https?:\/\/\S+/ # do something earlier about table!!
- w.gsub!(/\\?~/,"#{Mx[:gl_o]}#126#{Mx[:gl_c]}") #escaped special character
- end
- w.gsub!(/^\<$/,"#{Mx[:gl_o]}#lt#{Mx[:gl_c]}") #escaped special character
- w.gsub!(/^\>$/,"#{Mx[:gl_o]}#gt#{Mx[:gl_c]}") #escaped special character
- line_array << w
- end
- dob.obj=line_array.join(' ')
- dob.obj=dob.obj.strip
- end
- dob.obj.gsub!(/^([*#-.]{1,12})$/,'\1 ~#') #ocn off for these paragraph separators
- dob.obj.gsub!(/~\{(.+?)\}~/m,Mx[:en_a_o] + '\1' + Mx[:en_a_c])
- dob.obj.gsub!(/~\[([^*+].+?)\]~/m,Mx[:en_b_o] + '* \1' + Mx[:en_b_c]) #default if markup does not specify
- dob.obj.gsub!(/~\[(.+?)\]~/m,Mx[:en_b_o] + '\1' + Mx[:en_b_c])
- if dob.is =='heading' \
- and dob.ln ==1
- dob.obj.gsub!(/\s*@title\b/," #{@md.title.full}")
- if defined? @md.creator.author \
- and @md.creator.author
- dob.obj.gsub!(/\s+(?:@creator|@author)/,",#{Mx[:br_line]}#{@md.creator.author}")
- else dob.obj.gsub!(/\s+(?:@creator|@author)/,'')
- end
- end
- if dob.is =='heading'
- dob.obj.gsub!(/^\s*@title\s*$/,@md.title.full) if dob.lv =~/1/ #
- if dob.lv =~/[23]/ \
- and defined? @md.creator.author \
- and @md.creator.author
- dob.obj.gsub!(/^\s*(?:(by\s+)?(?:@creator|@author))\s*$/,"\\1#{@md.creator.author}")
- else dob.obj.gsub!(/^\s*(?:(by\s+)?(?:@creator|@author))\s*$/,'\1')
- end
- end
- dob.obj.gsub!(/<(https?:\/\/\S+?)>/,'< \1 >') #catch problem markup
- dob.obj.gsub!(/<:=(\S+?)>/,'{ c_\1.png 14x14 }http://www.jus.uio.no/sisu') #adjustment 2005w30
- dob.obj.gsub!(/<!(\S+)!>/,'<:\1>') #escaped special character
- dob.obj.gsub!(/&nbsp;/,"#{Mx[:nbsp]}") #escaped special character
- dob.obj.gsub!(/\\~/,"#{Mx[:gl_o]}#126#{Mx[:gl_c]}") #escaped special character
- dob.obj.gsub!(/\\\{/,"#{Mx[:gl_o]}#123#{Mx[:gl_c]}") #escaped special character
- dob.obj.gsub!(/\\\}/,"#{Mx[:gl_o]}#125#{Mx[:gl_c]}") #escaped special character
- dob.obj.gsub!(/\\\<</,"#{Mx[:gl_o]}#lt#{Mx[:gl_c]}#{Mx[:gl_o]}#lt#{Mx[:gl_c]}") #escaped special character
- dob.obj.gsub!(/\\\>>/,"#{Mx[:gl_o]}#gt#{Mx[:gl_c]}#{Mx[:gl_o]}#gt#{Mx[:gl_c]}") #escaped special character
- dob.obj.gsub!(/\\\</,"#{Mx[:gl_o]}#lt#{Mx[:gl_c]}") #escaped special character
- dob.obj.gsub!(/\\\>/,"#{Mx[:gl_o]}#gt#{Mx[:gl_c]}") #escaped special character
- dob.obj.gsub!(/\\\_/,"#{Mx[:gl_o]}#095#{Mx[:gl_c]}") #escaped special character
- dob.obj.gsub!(/\\\-/,"#{Mx[:gl_o]}#045#{Mx[:gl_c]}") #escaped special character
- dob.obj.gsub!(/\\\+/,"#{Mx[:gl_o]}#043#{Mx[:gl_c]}") #escaped special character
- dob.obj.gsub!(/\\\//,"#{Mx[:gl_o]}#047#{Mx[:gl_c]}") #escaped special character
- dob.obj.gsub!(/\\\#/,"#{Mx[:gl_o]}#035#{Mx[:gl_c]}") #escaped special character
- dob.obj.gsub!(/\\\&/,"#{Mx[:gl_o]}#038#{Mx[:gl_c]}") #&amp; #escaped special character
- dob.obj.gsub!(/\\\|/,"#{Mx[:gl_o]}#124#{Mx[:gl_c]}") #not really a sisu special character but made available as possibility
- dob.obj.gsub!(/\\\:/,"#{Mx[:gl_o]}#058#{Mx[:gl_c]}") #not really a sisu special character but made available as possibility
- dob.obj.gsub!(/\\\!/,"#{Mx[:gl_o]}#033#{Mx[:gl_c]}") #not really a sisu special character but made available as possibility
- dob.obj.gsub!(/\\\^/,"#{Mx[:gl_o]}#094#{Mx[:gl_c]}") #not really a sisu special character but made available as possibility
- dob.obj.gsub!(/\\\,/,"#{Mx[:gl_o]}#044#{Mx[:gl_c]}") #not really a sisu special character but made available as possibility
- dob.obj.gsub!(/\\\\/,"#{Mx[:gl_o]}#092#{Mx[:gl_c]}") #escaped special character
- dob.obj.gsub!(/\\\*/,"#{Mx[:gl_o]}#042#{Mx[:gl_c]}") #escaped special character
- dob.obj.gsub!(/\\\!/,"#{Mx[:gl_o]}#033#{Mx[:gl_c]}") #escaped special character
- if dob.obj=~/(?:https?:|ftp:|\{([^{}]+?)\}(?:#|:|[.]{1,2}\/))\S+/m
- if dob.obj=~/(?:^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ (?:.+?)\s*\}(?:(?:https?:|ftp:|:|[.]{1,2}\/)\S+?)\s*#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/m
- dob.obj.gsub!(/(^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ ([^}]+?)\s*\}((?:https?:|ftp:|:|[.]{1,2}\/)\S+?)\s*#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/m,
- "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3 #{Mx[:en_a_o]}\\3 \\4#{Mx[:en_a_c]}") # watch
- end
- if dob.obj=~/(?:^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ (?:.+?)\s*\}(?:(?:https?:|ftp:|:|[.]{1,2}\/)\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m
- dob.obj.gsub!(/(^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ (.+?)\s*\}((?:https?:|ftp:|:|[.]{1,2}\/)\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m,
- "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3\\4 #{Mx[:en_a_o]}\\3#{Mx[:en_a_c]} ")
- end
- dob.obj.gsub!(/(^|[^#])\{\s*([^{}]+?)\s*\}((?:https?:|:|[.]{2}\/|#)\S+?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/,
- "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3") #linked (text or image, however text cannot include modified face, e.g. bold, ital, underline)
- dob.obj.gsub!(/(^|[#{Mx[:gl_c]}#{Mx[:lnk_c]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}(\s])((?:https?|ftp):\/\/\S+?\.[^>< ]+?)([,.;'"]?)(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m,
- %{\\1#{Mx[:url_o]}\\2#{Mx[:url_c]}\\3})
- dob.obj.gsub!(/#{Mx[:lnk_c]}#(\S+?[^>< ]+?)([()\[\]]*[,.;:!?'"]{0,2})(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m,
- %{#{Mx[:lnk_c]}#{Mx[:rel_o]}\\1#{Mx[:rel_c]}\\2})
- dob.obj.gsub!(/#{Mx[:lnk_c]}:(\S+?[^>< ]+?)([()\[\]]*[,.;:!?'"]{0,2})(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m,
- %{#{Mx[:lnk_c]}#{Mx[:rel_o]}:\\1#{Mx[:rel_c]}\\2})
- dob.obj.gsub!(/#{Mx[:lnk_c]}[.]{2}\/(\S+?[^>< ]+?)([()\[\]]*[,.;:!?'"]{0,2})(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m,
- %{#{Mx[:lnk_c]}#{Mx[:rel_o]}:\\1#{Mx[:rel_c]}\\2})
- end
- if dob.obj=~/_(?:https?|ftp):\S+/m # _http://url #CHECK
- dob.obj.gsub!(/(^|[#{Mx[:gl_c]}#{Mx[:lnk_c]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}(\s])(_(?:https?|ftp):\/\/\S+?\.[^>< ]+?)([,.;'"]?)(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m,
- %{\\1#{Mx[:url_o]}\\2#{Mx[:url_c]}\\3})
- end
- dob=fontface(dob)
- dob.obj.gsub!(/<[:e]\s+(.+?)!?>/,
- "#{Mx[:en_a_o]}\\1#{Mx[:en_a_c]}") #not tested
- dob.obj.gsub!(/^\s*_\*\s*/,
- "#{Mx[:gl_bullet]}") #bullets, shortcut
- dob.obj.gsub!(/=\{(.+?)\}/,
- "#{Mx[:idx_o]}\\1#{Mx[:idx_c]}")
- dob.obj.gsub!(/^\s*_([1-9])\*\s*/,
- "#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}#{Mx[:gl_bullet]}") #bullets, shortcut
- dob.obj.gsub!(/^\s*_([1-9])\s+/,
- "#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}") #indent
- dob.obj.gsub!(/<:hi>/,"#{Mx[:fa_hilite_o]}") #'<span style="background-color: rgb(255,240,196)">') # bright yellow rgb(255,255,0) pale yellow rgb(255,255,200)
- dob.obj.gsub!(/<:\/hi>/,"#{Mx[:fa_hilite_c]}") #'</span>')
- dob.obj.gsub!(/(#{Mx[:gr_o]}verse#{Mx[:gr_c]}.+)/m,"\\1\n")
- dob.obj.gsub!(/[ ]+($)/,'\1')
- dob.obj.gsub!(/\{\s*(.+?)\s*\}(https?:\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/,
- "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}#{Mx[:url_o]}\\2#{Mx[:url_c]}\\3") #any remaining linked text or image
- dob.obj.gsub!(/\{\s*(.+?)\s*\}(#{Mx[:url_o]}\S+?#{Mx[:url_c]})/,
- "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2") #any remaining linked text or image
- dob.obj.gsub!(/(^|\s)([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)/,"\\1#{Mx[:url_o]}\\2#{Mx[:url_c]}")
- dob.obj.gsub!(/(^|[ ])\{\s*(.+?)\s*\}(\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/,
- "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3\\4") #any remaining linked text or image
- dob.obj.gsub!(/\{\s*(.+?)\s*\}#([a-zA-Z0-9][a-zA-Z0-9_-]*)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/,
- "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}#{Mx[:rel_o]}\\2#{Mx[:rel_c]}\\3") #any remaining linked text or image, check need
- dob.obj.gsub!(/\{\s*(.+?)\s*\}(#{Mx[:rel_o]}\S+?#{Mx[:rel_c]})/,
- "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2") #any remaining linked text or image, check need
- dob.obj.gsub!(/\{\s*(.+?)\s*\}(image)/,
- "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2") #linked image
- elsif dob.is=='table'
- dob=fontface(dob)
- elsif dob.is =='code'
- dob.obj.gsub!(/#{Mx[:meta_o]}(\S+?)#{Mx[:meta_c]}\s*/,'@\1: ')
- dob.obj.gsub!(/([<>])/,'_\1')
- dob.obj.gsub!(/_<:(\S+?)_>/,'<:\1>') #convert <:\S+> back, clumsy
- dob.obj.gsub!(/_<(br(?: \/)?)_>/,'<\1>') #convert <br> <br /> back, clumsy
- dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s)&lt;(br(?: \/)?)&gt;([\s,.]|$)/,'\1<\2>\3') #convert <br> <br /> back, clumsy
- if dob.number_
- codeline=[]
- ln=1
- dob.obj.split(/#{Mx[:gr_o]}codeline#{Mx[:gr_c]}|<br(?: \/)?>|\n/).each_with_index do |cl,i|
- unless i == 0
- cl.gsub!(Mx[:br_nl],'')
- w=3-ln.to_s.length
- cl = "#{ln}#{Mx[:nbsp]*w}#{Mx[:vline]}#{Mx[:nbsp]}#{Mx[:nbsp]}#{cl}#{Mx[:br_nl]}"
- ln +=1
- end
- codeline << cl
- end
- codeline= codeline.join("")
- dob.obj=codeline
- else
- dob.obj.gsub!(/#{Mx[:gr_o]}codeline#{Mx[:gr_c]}/,
- "\n#{Mx[:nbsp]}#{Mx[:nbsp]}") #temporary fix, prefer: #line.gsub!(/<:codeline>/,"\n")
- end
- dob
- else # @\S+?:
- end
- dob
- end
- def tech #script markup planned to be more strict for technical documents
- # *{emphasis}* e{emphasis}e <strong>emphasis</strong>
- # !{bold text}! b{bold}b <b>bold text</b>
- # _{underline}_ u{underline}u <u>underline</u>
- # /{italics}/ i{italics}i <i>italics</i>
- # "{citation}" c{citation}c <cite>citation</cite>
- # ^{superscript}^ <sup>superscript</sup>
- # ,{subscript}, <sub>subscript</sub>
- # +{inserted text}+ <ins>inserted text</ins>
- # -{deleted text}- <del>deleted text</del>
- # #{monospace text}#
- # {url address}:url
- # {image.png}imageurl
- # {image.png}png
- # ~{endnote}~ <!e endnote !>
- # +1 <!i1!>
- # +2 <!i2!>
- puts 'tech'
- @data.each do |line|
- line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)e\{(.+?)\}e/,
- "\\1#{@emph[:o]}\\2#{@emph[:c]}") #emphasis
- line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)b\{(.+?)\}b/,
- "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold
- line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)u\{(.+?)\}u/,
- "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}") #underscore
- line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)c\{(.+?)\}c/,
- "\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}") #cite
- line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)i\{(.+?)\}i/,
- "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}") #italics
- line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)!\{(.+?)\}!/,
- "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold
- line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)\*\{(.+?)\}\*/,
- "\\1#{@emph[:o]}\\2#{@emph[:c]}") #emphasis
- line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)_\{(.+?)\}_/,
- "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}") #underscore
- line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\(|\>)\/\{(.+?)\}\//,
- "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}") #italics
- line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\"\{(.+?)\}\"/,
- "\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}")
- line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\^\{(.+?)\}\^/,
- "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}")
- line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)9\{(.+?)\}9/,
- "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}")
- line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>),\{(.+?)\},/,
- "\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}")
- line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)6\{(.+?)\}6/,
- "\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}")
- line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\+\{(.+?)\}\+/,
- "\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}")
- line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)v\{(.+?)\}v/,
- "\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}")
- line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)-\{(.+?)\}-/,
- "\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}")
- line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)x\{(.+?)\}x/,
- "\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}")
- line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\*(\S+?)\*/,
- "\\1#{@emph[:o]}\\2#{@emph[:c]}") #emphasise single word, watch
- line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\!(\S+?)\!/,
- "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold single word, watch
- line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\/([\(\)a-zA-Z0-9']+?)\/([ ,.;:'"~$]|[^a-zA-Z0-9])/,
- "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}\\3") #italics single word, watch
- line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)_(\S+?)_/,
- "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}") #underscore single word, watch
- line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\^(\S+?)\^/,
- "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") #check #superscript single word, watch digit added
- line.gsub!(/^\s*_\([1-9]\)\(\*\+\)\s*/,
- "#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}#{Mx[:fa_o]}\\2#{Mx[:fa_c_o]}") #bullets, shortcut
- line.gsub!(/^\s*_\([1-9]\)\s+/,
- "#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}")
- line.gsub!(/#{Mx[:br_line]}\s*_[12]\s+/,
- "#{Mx[:br_line]} ") #indent used in endnotes, not implemented, replace when ready with: line.gsub!(/(?:<br>|<br \/>)\s*_([12])\s+/,'<br><:i\1> ')
- end
- @data
- end
- end
-end
-__END__
diff --git a/lib/sisu/v2/db_dbi.rb b/lib/sisu/v2/db_dbi.rb
deleted file mode 100644
index 1a3825b9..00000000
--- a/lib/sisu/v2/db_dbi.rb
+++ /dev/null
@@ -1,93 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: modules shared by the different db types, dbi, postgresql,
- sqlite
-
-=end
-module SiSU_DB_DBI
- require "#{SiSU_lib}/db_columns" # db_columns.rb
- require "#{SiSU_lib}/db_tests" # db_tests.rb
- require "#{SiSU_lib}/db_create" # db_create.rb
- require "#{SiSU_lib}/db_select" # db_select.rb
- require "#{SiSU_lib}/db_indexes" # db_indexes.rb
- require "#{SiSU_lib}/db_drop" # db_drop.rb
- require "#{SiSU_lib}/db_remove" # db_remove.rb
- require "#{SiSU_lib}/db_load_tuple" # db_load_tuple.rb
- require "#{SiSU_lib}/db_import" # db_import.rb
- class Column_size < SiSU_DB_columns::Column_size # db_columns.rb
- end
- class Test < SiSU_DB_tests::Test # db_tests.rb
- end
- class Create <SiSU_DB_create::Create # db_create.rb
- end
- class Case <SiSU_DB_select::Case # db_select.rb
- end
- class Index <SiSU_DB_index::Index # db_indexes.rb
- end
- class Drop <SiSU_DB_drop::Drop # db_drop.rb
- end
- class Remove <SiSU_DB_remove::Remove # db_remove.rb
- end
- class Load_documents <SiSU_DB_tuple::Load_documents # db_load_tuple.rb
- end
- class Load_metadata <SiSU_DB_tuple::Load_metadata # db_load_tuple.rb
- end
- class Load_urls <SiSU_DB_tuple::Load_urls # db_update urls
- end
- class Import <SiSU_DB_import::Import #<SiSU_DB::Column_size # db_import.rb
- end
-end
-__END__
diff --git a/lib/sisu/v2/epub.rb b/lib/sisu/v2/epub.rb
deleted file mode 100644
index 6f4ab25b..00000000
--- a/lib/sisu/v2/epub.rb
+++ /dev/null
@@ -1,678 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: epub generation, processing
-
-=end
-module SiSU_EPUB
- require 'pstore'
- require "#{SiSU_lib}/particulars" # particulars.rb
- include SiSU_Particulars
- require "#{SiSU_lib}/defaults" # defaults.rb
- include SiSU_Viz
- require "#{SiSU_lib}/xhtml_table" # xhtml_table.rb
- require "#{SiSU_lib}/epub_format" # epub_format.rb
- include SiSU_EPUB_Format
- require "#{SiSU_lib}/epub_segments" # epub_segments.rb
- include SiSU_EPUB_seg
- require "#{SiSU_lib}/epub_tune" # epub_tune.rb
- include SiSU_EPUB_Tune
- require "#{SiSU_lib}/epub_concordance" # epub_concordance.rb
- class Source
- def initialize(opt)
- @opt=opt
- @particulars=SiSU_Particulars::Combined_singleton.instance.get_all(opt)
- end
- def read
- songsheet
- end
- def songsheet
- begin
- @md=@particulars.md
- @fnb=@md.fnb
- @env=@particulars.env
- loc=@env.path.url.output_tell
- unless @opt.cmd =~/q/
- tool=if @opt.cmd =~/z/; "#{@env.program.epub_viewer} #{loc}/epub/#{@fnb}.epub"
- elsif @opt.cmd =~/[MVv]/; "#{@env.program.epub_viewer} #{loc}/epub/#{@fnb}.epub"
- else @opt.fns
- end
- @opt.cmd=~/[MVvz]/ \
- ? SiSU_Screen::Ansi.new(@opt.cmd,'EPUB',tool).green_hi_blue \
- : SiSU_Screen::Ansi.new(@opt.cmd,'EPUB',tool).green_title_hi
- SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{loc}/epub/#{@fnb}.epub").flow if @opt.cmd =~/[MV]/
- end
- @env.path.epub_bld #(@md)
- @env.path.epub_cp_images(@md)
- dir_epub=@env.path.epub
- SiSU_Env::Info_skin.new(@md).select
- data=nil
- my_make=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns,@md) #Beware #FIX opt and md, both not necessary
- SiSU_Env::SiSU_file.new(@md).mkdir
- @tuned_file_array=SiSU_EPUB::Source::XHtml_environment.new(@particulars).tuned_file_instructions
- data=@tuned_file_array
- scr_endnotes=SiSU_EPUB::Source::Endnotes.new(@md,data).scroll
- toc=SiSU_EPUB::Source::Toc.new(@md,data).songsheet
- data=@tuned_file_array
- scr_toc=SiSU_EPUB::Source::Scroll_head_and_segtoc.new(@md,toc).in_common #watch
- SiSU_EPUB::Source::Seg.new(@md,data).songsheet
- SiSU_EPUB::Source::Epub_output.new(@md).songsheet
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- unless @opt.cmd =~/[MV]/ #check maintenance flag
- texfiles=Dir["#{@env.path.tune}/#{@opt.fns}*"]
- texfiles.each do |f|
- if FileTest.file?(f)
- File.unlink(f)
- end
- end
- end
- SiSU_Env::Create_file.new(@opt.cmd,@opt.fns).param_instantiate
- @@flag,@@scr,@@seg,@@seg_endnotes,@@seg_subtoc,@@seg_ad={},{},{},{},{},{}
- @@seg_total,@@tracker,@@loop_count,@@tablehead,@@number_of_cols=0,0,0,0,0
- @@seg_name,@@seg_name_html,@@seg_subtoc_array,@@seg_endnotes_array,@@segtocband,@@tablefoot=Array.new(7){[]}
- @@filename_seg,@@seg_url,@@fn,@@to_lev4,@@get_hash_to,@@get_hash_fn='','','','','','',''
- @@is4=@@is3=@@is2=@@is1=@@heading1=@@heading2=@@heading3=@@heading4=0
- end
- end
- private
- class XHtml_environment
- def initialize(particulars)
- @particulars=particulars
- @md,@env=particulars.md,particulars.env
- @vz=SiSU_Env::Get_init.instance.skin
- @env,@css,@symlnk=particulars.env,SiSU_Style::CSS.new,SiSU_Env::Create_system_link.new #home
- end
- def link_images
- @symlnk.images
- end
- def directories
- my_make=SiSU_Env::Create_file.new(@md.cmd,@md.fns)
- @path={ :root=>my_make.html_root }
- title=File.basename(@md.fns,'.rb')
- SiSU_Env::SiSU_file.new(@md).mkdir
- end
- def tuned_file_instructions
- @tell=SiSU_Screen::Ansi.new(@md.cmd)
- @md.cmd=@md.cmd.gsub(/H/,'h')
- @md.file_type='html' if @md.cmd =~/[hon]/
- directories
- newfilename=%{#{@env.path.output}/#{@md.fnb}/#{@md.fn[:index]}} if @md.file_type =~/html/
- dal_array=@particulars.dal_array # dal file drawn here
- @tuned_file_array=SiSU_EPUB_Tune::Tune.new(dal_array,@md).songsheet
- @tuned_file_array
- end
- end
- class Endnotes
- include SiSU_EPUB_Format
- def initialize(md,data)
- @md,@data=md,data
- end
- def scroll
- @scr_endnotes=[]
- format_head_scroll=SiSU_EPUB_Format::Head_scroll.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_EPUB_Format::Format_scroll.new(@md,txt_obj)
- @scr_endnotes << format_scroll.endnote_body
- end
- end
- end
- end
- @scr_endnotes
- end
- end
- class Toc
- @@toc={ :seg=>[],:seg_mini=>[],:scr=>[],:ncx=>[],:opf=>[] }
- @@seg_url=''
- @@firstseg=nil
- def initialize(md=nil,data='')
- @md,@data=md,data
- @vz=SiSU_Env::Get_init.instance.skin
- @epub=SiSU_EPUB_Format::Head_information.new(@md)
- @tell=SiSU_Screen::Ansi.new(@md.cmd) if @md
- end
- def songsheet #extracts toc for scroll & seg
- SiSU_Screen::Ansi.new(@md.cmd,'Toc').txt_grey if @md.cmd =~/[MVv]/
- toc=nil
- @@firstseg=nil
- @@toc={ :seg=>[],:seg_mini=>[],:scr=>[],:ncx=>[],:opf=>[] }
- md_opf_a_content,md_opf_a_spine=[],[]
- @nav_no=1
- @@toc[:ncx] << @epub.toc_ncx.open #epub ncx navmap
- @@toc[:ncx] << @epub.toc_ncx.head_open << @epub.toc_ncx.head << @epub.toc_ncx.head_close
- @@toc[:ncx] << @epub.toc_ncx.doc_title << @epub.toc_ncx.doc_author
- @@toc[:ncx] << @epub.toc_ncx.navmap_open
- @@toc[:opf] << @epub.metadata_opf.package_open
- @@toc[:opf] << @epub.metadata_opf.metadata
- @@toc[:opf] << @epub.metadata_opf.manifest_open
- @@toc[:ncx] << @epub.toc_ncx.navmap_sisu_toc(@nav_no) #epub ncx navmap, toc
- @@toc[:seg] << %{<div class="content">\n<div class="substance">}
- @@toc[:scr] << %{<div class="content">\n<div class="substance">}
- md_opf_a_content << @epub.metadata_opf.manifest_content_sisu_toc
- md_opf_a_spine << @epub.metadata_opf.spine_sisu_toc
- @ncxo=[nil,false,false,false,false,false,false]
- @dob_toc2,@dob_toc3=nil,nil
- @ncx_cls=[]
- @data.each do |dob|
- if dob.is=='heading' \
- or dob.is=='heading_insert'
- dob_toc=dob.dup
- toc=case dob_toc.ln
- when 1
- Toc.new(@md,dob_toc).level_1
- when 2
- @nav_no+=1
- @nav_no2=@nav_no
- @ncx_cls << @epub.toc_ncx.navpoint_close if @ncxo[4]
- @ncx_cls << @epub.toc_ncx.navpoint_close if @ncxo[3]
- @ncx_cls << @epub.toc_ncx.navpoint_close if @ncxo[2]
- @ncxo[2],@ncxo[3],@ncxo[4]=false,false,false
- @dob_toc2=dob_toc
- @ncxo[2]=true
- Toc.new(@md,dob_toc).level_2
- when 3
- @nav_no+=1
- @nav_no3=@nav_no
- @ncx_cls << @epub.toc_ncx.navpoint_close if @ncxo[4]
- @ncx_cls << @epub.toc_ncx.navpoint_close if @ncxo[3]
- @ncxo[3],@ncxo[4]=false,false
- @dob_toc3=dob_toc
- @ncxo[3]=true
- Toc.new(@md,dob_toc).level_3
- when 4
- @@toc[:ncx] << @ncx_cls if @ncx_cls.length > 0
- @ncx_cls=[]
- @@toc[:ncx] << @epub.toc_ncx.navpoint_top3(@dob_toc2,@nav_no2,dob_toc.name) if @dob_toc2 #epub ncx navmap
- @@toc[:ncx] << @epub.toc_ncx.navpoint_top3(@dob_toc3,@nav_no3,dob_toc.name) if @dob_toc3 #epub ncx navmap
- @dob_toc2,@dob_toc3=nil,nil
- @nav_no+=1
- @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[4]
- @ncxo[4]=false
- @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no) if dob_toc #epub ncx navmap
- @ncxo[4]=true
- md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc)
- md_opf_a_spine << @epub.metadata_opf.spine(dob_toc)
- Toc.new(@md,dob_toc).level_4
- when 5; Toc.new(@md,dob_toc).level_5
- when 6; Toc.new(@md,dob_toc).level_6
- else nil
- 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]
- @@toc[:scr] << toc[:seg]
- @@toc[:seg_mini] << toc[:seg_mini] if toc[:seg_mini]
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error
- end
- end
- end
- end
- @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[4]
- @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[3]
- @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[2]
- @ncxo[1],@ncxo[2],@ncxo[3],@ncxo[4]=false,false,false,false
- md_opf_a_content << @epub.metadata_opf.manifest_images(@md.ec[:image])
- @@toc[:seg] << "</div>\n</div>"
- @@toc[:scr] << "</div>\n</div>"
- @@toc[:ncx] << @epub.toc_ncx.navmap_close
- @@toc[:ncx] << @epub.toc_ncx.close
- @@toc[:opf] << md_opf_a_content << @epub.metadata_opf.manifest_close
- @@toc[:opf] << @epub.metadata_opf.spine_open << md_opf_a_spine << @epub.metadata_opf.spine_close
- @@toc[:opf] << @epub.metadata_opf.package_close
- @@toc[:opf]=@@toc[:opf].flatten
- Epub_output.new(@md,@@toc[:opf]).epub_metadata_opf
- Epub_output.new(@md,@@toc[:ncx]).epub_toc_ncx
- @md.firstseg=@@firstseg
- @@toc
- end
- def minitoc
- minitoc=@@toc[:seg_mini].join("\n")
- '<div class="toc">' + minitoc + '</div>'
- end
- protected
- def level_1
- dob=@data
- linkname,link=dob.obj.strip,dob.ocn
- if link \
- and link !~/#/ #% keep eye on link
- p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,link)
- end
- title=if dob.obj !~/Document Information/; linkname
- else
- link='metadata'
- %{<b><a href="#{@md.fnl[:pre]}#{link}#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}">#{linkname}</a></b>}
- end
- toc={}
- txt_obj={:txt =>title}
- format_toc=SiSU_EPUB_Format::Format_toc.new(@md,txt_obj)
- toc[:seg]=if dob.name =~/^meta/ \
- and dob.obj =~/Document Information/ #check
- format_toc.lev0
- else format_toc.lev1
- end
- toc[:seg_mini]=if dob.name =~/^meta/ \
- and dob.obj =~/Document Information/ #check
- x=if @md.concord_make
- format_toc.mini_concord_tail
- else format_toc.mini_tail
- end
- else format_toc.mini_lev1
- end
- title=if dob.ocn ==0
- if dob.name =~/^meta/ \
- and dob.obj =~/Document Information/
- %{<a href="#docinfo">#{linkname}</a>}
- else linkname
- end
- else
- @@toc[:scr] << '<br />'
- link=if dob.ln; dob.ln
- else ''
- end
- %{<b><a href="##{link}">#{linkname}</a></b>}
- end
- txt_obj={:txt =>title}
- format_toc=SiSU_EPUB_Format::Format_toc.new(@md,txt_obj)
- toc[:scr]=if dob.name =~/^meta/ \
- and dob.obj =~/Document Information/
- format_toc.lev0
- else format_toc.lev1
- end
- toc
- end
- def level_2
- dob=@data
- linkname,ocn=dob.obj.strip,dob.ocn
- if ocn \
- and ocn !~/#/
- p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,ocn)
- end
- txt_obj={:txt =>linkname}
- format_toc=SiSU_EPUB_Format::Format_toc.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_EPUB_Format::Format_toc.new(@md,txt_obj)
- toc[:scr]=format_toc.lev2
- end
- toc
- end
- def level_3
- dob=@data
- linkname,ocn=dob.obj.strip,dob.ocn
- if ocn \
- and ocn !~/#/
- p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,ocn)
- end
- txt_obj={:txt =>linkname}
- format_toc=SiSU_EPUB_Format::Format_toc.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_EPUB_Format::Format_toc.new(@md,txt_obj)
- toc[:scr]=format_toc.lev3
- end
- toc
- end
- def level_4
- dob=@data
- linkname,ocn=dob.obj.strip,dob.ocn
- p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,ocn) if ocn
- if dob.ln==4
- seg_link=%{ <a href="#{@md.fnl[:pre]}#{dob.name}#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}">
- #{dob.obj}
- </a> }
- @@seg_url=dob.name
- elsif dob.obj =~/\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+/
- seg_link=dob.obj.gsub(/^(\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+)(.*)/,
- %{<a href="#{@md.fnl[:pre]}\\1#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}">} +
- %{\\1 \\2</a> })
- end
- p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,ocn) if ocn
- txt_obj={:txt =>seg_link}
- format_toc=SiSU_EPUB_Format::Format_toc.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={:txt =>title}
- format_toc=SiSU_EPUB_Format::Format_toc.new(@md,txt_obj)
- toc[:scr]=format_toc.lev4
- toc
- end
- def level_5
- dob=@data
- linkname,ocn=dob.obj.strip,dob.ocn
- toc={}
- if ocn \
- and ocn !~/#/
- p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,ocn)
- lnk_n_txt=%{ <a href="#{@md.fnl[:pre]}#{@@seg_url}#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}#o#{ocn}">
- #{linkname}
- </a>}
- txt_obj={:txt =>lnk_n_txt}
- format_toc=SiSU_EPUB_Format::Format_toc.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_EPUB_Format::Format_toc.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 !~/#/
- p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,ocn)
- lnk_n_txt=%{ <a href="#{@md.fnl[:pre]}#{@@seg_url}#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}#o#{ocn}">
- #{linkname}
-</a>}
- txt_obj={:txt =>lnk_n_txt}
- format_toc=SiSU_EPUB_Format::Format_toc.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_EPUB_Format::Format_toc.new(@md,txt_obj)
- toc[:scr]=format_toc.lev6
- end
- toc
- end
- def level_crosslink
- dob=@data
- if dob !~/^4~!/
- dob.gsub!(/^4~!\s+(\S+)\s+(.+)/,
- %{<table><tr><td width =\"80\"></td>
- <td><a href="http://\\1">
- #{@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">
- #{@png.crosslink}
- &nbsp;&nbsp;\\2
- <\/a>
- </td></tr></table>
-})
- end
- end
- end
- class Scroll_head_and_segtoc < Toc
- def initialize(md='',toc='',links_guide_toc='')
- @md,@toc,@links_guide_toc=md,toc,links_guide_toc
- @vz=SiSU_Env::Get_init.instance.skin
- end
- def in_common
- toc_shared=[]
- segtoc=[]
- SiSU_Screen::Ansi.new(@md.cmd,'Scroll & Segtoc').txt_grey if @md.cmd =~/[MVv]/
- format_head_toc=SiSU_EPUB_Format::Head_toc.new(@md)
- dochead=format_head_toc.head
- dochead.gsub!(/toc\.(html)/,'doc.\1') #kludge
- toc_shared << dochead #<< ads.div.major
- segtoc << format_head_toc.head #<< ads.div.major
- toc_shared << format_head_toc.toc_head_escript if SiSU_EPUB_Format::Head_toc.method_defined? :toc_head_escript
- segtoc << format_head_toc.toc_head_escript if SiSU_EPUB_Format::Head_toc.method_defined? :toc_head_escript
- if defined? @md.rights.all \
- and @md.rights.all
- rights=format_head_toc.rights.all
- rights=SiSU_EPUB_Tune::Clean_xhtml.new(rights).clean
- end
- if defined? @md.notes.prefix_b \
- and @md.notes.prefix_b
- prefix_b=format_head_toc.prefix_b
- prefix_b=SiSU_EPUB_Tune::Clean_xhtml.new(prefix_b).clean
- end
- seg_toc_band=format_head_toc.seg_head_navigation_band
- seg_toc_band_bottom=format_head_toc.seg_head_navigation_band_bottom
- 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_EPUB_Format::Format_text_object.new(@md,txt_obj)
- toc_shared << format_txt_obj.center_bold
- segtoc << format_txt_obj.center_bold
- if defined? @md.creator.author \
- and @md.creator.author
- creator_endnote=@md.creator.author.gsub(/(\*+)/,%{&nbsp;<sup><a href="#notes">\\1</a></sup>})
- tmp_head=creator_endnote + "\n"
- txt_obj={:txt =>tmp_head}
- format_txt_obj=SiSU_EPUB_Format::Format_text_object.new(@md,txt_obj)
- toc_shared << format_txt_obj.center_bold
- segtoc << format_txt_obj.center_bold
- end
- segtoc << seg_toc_band
- tmp_head=nil
- if defined? @md.prefix_a \
- and @md.prefix_a
- tmp_head ||= %{#{@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 \
- and @md.prefix_b
- toc_shared << prefix_b
- end
- #Table of Contents added/appended here
- toc_shared << @toc[:scr]
- segtoc << @links_guide_toc
- segtoc << @toc[:seg]
- if defined? @md.rights.all \
- and @md.rights.all
- segtoc << rights
- end
- if defined? @md.prefix_b \
- and @md.prefix_b
- segtoc << prefix_b
- end
- #Segtoc tail added here
- segtoc << seg_toc_band_bottom
- segtoc << format_head_toc.xhtml_close
- segtoc.flatten!.compact!
- Epub_output.new(@md,segtoc).segtoc
- segtoc=[]
- @toc[:scr],@toc[:seg]=[],[]
- toc_shared
- end
- end
- class Table < SiSU_XHTML_table::Table_xhtml
- end
- class Seg < SiSU_EPUB_seg::Seg
- end
- class Epub_output
- require 'fileutils'
- include FileUtils #::Verbose
- def initialize(md,output='')
- @md,@output=md,output
- @epub_out="#{@md.env.path.output}/epub"
- @epub_doc="#{@md.fnb}.epub"
- @epub_header=SiSU_EPUB_Format::Head_information.new(@md)
- @make=SiSU_Env::Create_file.new(@md.cmd,@md.fns,@md)
- end
- def songsheet
- mimetype
- metainf_container
- css
- images if @md.ec[:image]
- #concordance #uncomment to enable inclusion of concordance file
- output_zip
- end
- def mimetype
- out=@make.epub.mimetype
- out<<@epub_header.mimetype
- out.close
- end
- def metainf_container #container.xml file in META-INF directory
- out=@make.epub.metainf_cont
- out<<@epub_header.metainf_container
- out.close
- end
- def css
- out=@make.epub.xhtml_css
- out << SiSU_EPUB_Format::Css.new.css_epub_xhtml
- out.close
- end
- def epub_toc_ncx
- begin
- out=@make.epub.toc_ncx
- @output.each do |para|
- unless para =~/\A\s*\Z/
- out.puts para
- end
- end
- out.close
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error
- end
- end
- def epub_metadata_opf
- begin
- out=@make.epub.metadata
- @output.each do |para|
- unless para =~/\A\s*\Z/
- out.puts para
- end
- end
- out.close
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error
- end
- end
- def images
- img_pth=@md.env.path.image_source_local_tex
- @md.ec[:image].each do |x|
- if FileTest.directory?("#{@md.env.path.epub}/OPS/image") \
- and FileTest.file?("#{img_pth}/#{x}")
- cp("#{img_pth}/#{x}","#{@md.env.path.epub}/OPS/image")
- end
- end
- end
- def concordance
- SiSU_EPUB_Concordance::Source.new(@md.opt).read
- end
- def output_zip
- mkdir_p(@epub_out) unless FileTest.directory?(@epub_out)
- system("
- cd #{@md.env.path.epub}
- zip -qXr9D #{@epub_doc} *
- mv #{@epub_doc} #{@epub_out}/.
- cd #{Dir.pwd}
- ")
- unless @md.cmd.inspect =~/M/
- system("rm -r #{@md.env.path.epub}")
- end
- end
- def segtoc
- begin
- filename_html_segtoc=@make.epub.xhtml_segtoc
- filename_html_index=@make.epub.xhtml_index
- @output.each do |para|
- para.strip!
- unless para =~/\A\s*\Z/
- filename_html_segtoc.puts para,"\n"
- filename_html_index.puts para,"\n"
- end
- end
- filename_html_segtoc.close
- filename_html_index.close
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error
- end
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/v2/epub_tune.rb b/lib/sisu/v2/epub_tune.rb
deleted file mode 100644
index 9c9223a0..00000000
--- a/lib/sisu/v2/epub_tune.rb
+++ /dev/null
@@ -1,416 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: epub generation, epub pre-processing
-
-=end
-require "#{SiSU_lib}/param"
-module SiSU_EPUB_Tune
- require "#{SiSU_lib}/sysenv" # sysenv.rb
- include SiSU_Env; include SiSU_Screen
- require "#{SiSU_lib}/epub_format" # epub_format.rb #watch
- @@line_mode=''
- @@endnote_array=[]
- @@endnote_call_counter=1
- @@table_align='<table summary='' width="96%" border="0" bgcolor="white" cellpadding="0" col="3">
-<tr ...><td width="2%" align="right">
-&nbsp\;</td>
-<td width="94%" valign="top" align="justify">'
- @@table_align_close='</td>
-<td width="4%" align="right" valign="top">
-<font size="1" color="#777777">
-&nbsp;&nbsp;&nbsp;</font> </td></tr></table>'
- @@counter,@@column,@columns=0,0,0
- class Output
- def initialize(data,md)
- @data,@md=data,md
- @cX=SiSU_Screen::Ansi.new(@md.cmd).cX
- end
- def hard_output
- my_make=SiSU_Env::Create_file.new(@md.cmd,@md.fns)
- @filename_tune=my_make.file_tune
- data=[]
- @data.each{|x| x.obj.strip; data << x if not x.obj.empty?} #1.9 array?
- data.each do |dob|
- @filename_tune.puts dob, "\n" #check
- end
- end
- def marshal
- my_make=SiSU_Env::Create_file.new(@md.cmd,@md.fns)
- @marshal_tune=my_make.marshal_tune
- File.open(@marshal_tune,'w') {|f| Marshal.dump(@data.to_a,f)}
- end
- end
- class Clean_xhtml
- def initialize(html='')
- @html=html
- end
- def clean
- html=@html
- str=if html.class==String
- html
- else html.obj
- end
- str.gsub!(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;')
- str.gsub!(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;')
- str.gsub!(/\*/u,'&#042;') # &#042;
- str.gsub!(/\+/u,'&#043;') # &#043;
- str.gsub!(/¢/u,'&cent;') # &#162;
- str.gsub!(/£/u,'&pound;') # &#163;
- str.gsub!(/¥/u,'&yen;') # &#165;
- str.gsub!(/§/u,'&sect;') # &#167;
- str.gsub!(/©/u,'&copy;') # &#169;
- str.gsub!(/ª/u,'&ordf;') # &#170;
- str.gsub!(/«/u,'&laquo;') # &#171;
- str.gsub!(/®/u,'&reg;') # &#174;
- str.gsub!(/°/u,'&deg;') # &#176;
- str.gsub!(/±/u,'&plusmn;') # &#177;
- str.gsub!(/²/u,'&sup2;') # &#178;
- str.gsub!(/³/u,'&sup3;') # &#179;
- str.gsub!(/µ/u,'&micro;') # &#181;
- str.gsub!(/¶/u,'&para;') # &#182;
- str.gsub!(/¹/u,'&sup1;') # &#185;
- str.gsub!(/º/u,'&ordm;') # &#186;
- str.gsub!(/»/u,'&raquo;') # &#187;
- str.gsub!(/¼/u,'&frac14;') # &#188;
- str.gsub!(/½/u,'&frac12;') # &#189;
- str.gsub!(/¾/u,'&frac34;') # &#190;
- str.gsub!(/×/u,'&times;') # &#215;
- str.gsub!(/÷/u,'&divide;') # &#247;
- str.gsub!(/¿/u,'&iquest;') # &#191;
- str.gsub!(/À/u,'&Agrave;') # &#192;
- str.gsub!(/Á/u,'&Aacute;') # &#193;
- str.gsub!(/Â/u,'&Acirc;') # &#194;
- str.gsub!(/Ã/u,'&Atilde;') # &#195;
- str.gsub!(/Ä/u,'&Auml;') # &#196;
- str.gsub!(/Å/u,'&Aring;') # &#197;
- str.gsub!(/Æ/u,'&AElig;') # &#198;
- str.gsub!(/Ç/u,'&Ccedil;') # &#199;
- str.gsub!(/È/u,'&Egrave;') # &#200;
- str.gsub!(/É/u,'&Eacute;') # &#201;
- str.gsub!(/Ê/u,'&Ecirc;') # &#202;
- str.gsub!(/Ë/u,'&Euml;') # &#203;
- str.gsub!(/Ì/u,'&Igrave;') # &#204;
- str.gsub!(/Í/u,'&Iacute;') # &#205;
- str.gsub!(/Î/u,'&Icirc;') # &#206;
- str.gsub!(/Ï/u,'&Iuml;') # &#207;
- str.gsub!(/Ð/u,'&ETH;') # &#208;
- str.gsub!(/Ñ/u,'&Ntilde;') # &#209;
- str.gsub!(/Ò/u,'&Ograve;') # &#210;
- str.gsub!(/Ó/u,'&Oacute;') # &#211;
- str.gsub!(/Ô/u,'&Ocirc;') # &#212;
- str.gsub!(/Õ/u,'&Otilde;') # &#213;
- str.gsub!(/Ö/u,'&Ouml;') # &#214;
- str.gsub!(/Ø/u,'&Oslash;') # &#216;
- str.gsub!(/Ù/u,'&Ugrave;') # &#217;
- str.gsub!(/Ú/u,'&Uacute;') # &#218;
- str.gsub!(/Û/u,'&Ucirc;') # &#219;
- str.gsub!(/Ü/u,'&Uuml;') # &#220;
- str.gsub!(/Ý/u,'&Yacute;') # &#221;
- str.gsub!(/Þ/u,'&THORN;') # &#222;
- str.gsub!(/ß/u,'&szlig;') # &#223;
- str.gsub!(/à/u,'&agrave;') # &#224;
- str.gsub!(/á/u,'&aacute;') # &#225;
- str.gsub!(/â/u,'&acirc;') # &#226;
- str.gsub!(/ã/u,'&atilde;') # &#227;
- str.gsub!(/ä/u,'&auml;') # &#228;
- str.gsub!(/å/u,'&aring;') # &#229;
- str.gsub!(/æ/u,'&aelig;') # &#230;
- str.gsub!(/ç/u,'&ccedil;') # &#231;
- str.gsub!(/è/u,'&egrave;') # &#232;
- str.gsub!(/é/u,'&eacute;') # &#233;
- str.gsub!(/ê/u,'&ecirc;') # &#234;
- str.gsub!(/ë/u,'&euml;') # &#235;
- str.gsub!(/ì/u,'&igrave;') # &#236;
- str.gsub!(/í/u,'&iacute;') # &#237;
- str.gsub!(/î/u,'&icirc;') # &#238;
- str.gsub!(/ï/u,'&iuml;') # &#239;
- str.gsub!(/ð/u,'&eth;') # &#240;
- str.gsub!(/ñ/u,'&ntilde;') # &#241;
- str.gsub!(/ò/u,'&ograve;') # &#242;
- str.gsub!(/ó/u,'&oacute;') # &#243;
- str.gsub!(/ô/u,'&ocirc;') # &#244;
- str.gsub!(/õ/u,'&otilde;') # &#245;
- str.gsub!(/ö/u,'&ouml;') # &#246;
- str.gsub!(/ø/u,'&oslash;') # &#248;
- str.gsub!(/ù/u,'&ugrave;') # &#250;
- str.gsub!(/ú/u,'&uacute;') # &#251;
- str.gsub!(/û/u,'&ucirc;') # &#252;
- str.gsub!(/ü/u,'&uuml;') # &#253;
- str.gsub!(/þ/u,'&thorn;') # &#254;
- str.gsub!(/ÿ/u,'&yuml;') # &#255;
- str.gsub!(/ý/u,'&yacute;')
- str.gsub!(/<br>/u,'<br />')
- str.gsub(/#{Mx[:nbsp]}/u,'&nbsp;')
- str
- end
- end
- class Tune
- def initialize(data,md)
- @data,@md=data,md
- @vz=SiSU_Env::Get_init.instance.skin
- @env=SiSU_Env::Info_env.new(@md.fns)
- @sys=SiSU_Env::System_call.new
- @env=SiSU_Env::Info_env.new(@md.fns)
- @brace_url=SiSU_Viz::Skin.new.url_decoration
- end
- def songsheet
- begin
- @cX=SiSU_Screen::Ansi.new(@md.cmd).cX
- SiSU_Screen::Ansi.new(@md.cmd,'Tune').txt_grey if @md.cmd =~/[MVv]/
- data=Tune.new(@data,@md).amp_html
- data=Tune.new(data,@md).endnotes_html
- data=Tune.new(data,@md).url_markup
- data=Tune.new(data,@md).markup
- if @md.cmd =~/M/ #Hard Output Tune Optional on/off here
- data=Output.new(data,@md).hard_output
- Output.new(data,@md).marshal
- end
- tuned=Tune.new(@data,@md).output
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error
- ensure
- end
- end
- def para_numbers
- data=@data
- @tuned_file=[]
- data.each do |dob|
- dob.gsub!(/#{Mx[:lv_o]}\d:(\S?)#{Mx[:lv_c]}/,'\0#\1.&nbsp;') #fix Mx[:lv_o]
- @tuned_file << dob
- end
- end
- def markup
- @tuned_file=[]
- @data.each do |dob|
- dob.obj.gsub!(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;')
- dob.obj.gsub!(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;')
- dob.obj.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />') unless dob.is=='table'
- dob.obj.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>')
- dob.obj.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>')
- dob.obj.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>')
- dob.obj.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>')
- dob.obj.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>')
- dob.obj.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'<ins>\1</ins>')
- dob.obj.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>')
- dob.obj.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>')
- dob.obj.gsub!(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>') # tt, kbd
- dob.obj.gsub!(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'')
- dob.obj.gsub!(/^#{Mx[:gl_bullet]}/m,'●&nbsp;&nbsp;')
- dob.obj.gsub!(/#{Mx[:nbsp]}/,'&nbsp;')
- dob.obj.gsub!(/<(p|br)>/,'<\1 />')
- dob=SiSU_EPUB_Tune::Clean_xhtml.new(dob).clean
- @tuned_file << dob
- end
- end
- def urls(data)
- @words=[]
- map_nametags=SiSU_Particulars::Combined_singleton.instance.get_map_nametags(@md).nametags_map #p map_nametags
- data.each do |word|
- @words << if word=~/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/
- http_=true
- if word =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/
- m,u=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/.match(word).captures
- elsif word =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/
- http_=false
- m,u=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}(\S+?)#{Mx[:rel_c]}/.match(word).captures
- elsif word =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}image/
- m,u=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}(image)/.match(word).captures
- end
- case m
- when /\.png|\.jpg|\.gif|c=|\s\d+x\d+/
- w,h=/\s(\d+)x(\d+)/.match(m).captures if m =~/\s\d+x\d+/
- w=%{width="#{w}"} if w
- h=%{height="#{h}"} if h
- c=m[/"(.+?)"/m,1]
- caption=%{<br /><p class="caption">#{c}</p>} if c
- png=m.scan(/\S+/)[0]
- image_path='./image'
- ins=if u \
- and u.strip !~/^image$/
- %{<a href="#{u}"><img src="#{@env.url.images_epub}/#{png}" #{w} #{h} naturalsizeflag="0" align="bottom" border="0" /></a>#{caption}}
- else %{<img src="#{@env.url.images_epub}/#{png}" #{w} #{h} naturalsizeflag="0" align="bottom" border="0" />#{caption}}
- end
- word.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/,ins)
- else
- link=m[/(.+)/m]
- png=m.scan(/\S+/)[0].strip
- link=link.strip
- u.sub!(/^#*/,'') #make neater
- if map_nametags[u] \
- and map_nametags[u][:segname]
- if u=~/^\d+$/
- u.gsub!(/^(\d+)$/,"#{map_nametags[u][:segname]}#{Sfx[:xhtml]}#o\\1") if u !~/\// unless http_
- else
- u.gsub!(/(\S+)/,"#{map_nametags[u][:segname]}#{Sfx[:xhtml]}#\\1") if u !~/\// unless http_
- end
- elsif u =~/^:/
- u.gsub!(/^:/,"#{@env.url.root}/")
- elsif u =~/^\.\.\//
- u.gsub!(/^\.\.\//,"#{@env.url.root}/")
- elsif u =~/https?:\/\//
- else p "NOT FOUND name_tags: #{u}"
- end
- ins=%{<a href="#{u}">#{link}</a>}
- word.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,ins)
- word.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/,ins)
- end
- word
- else word
- end
- word
- end
- @words=@words.join(' ')
- end
- def url_markup
- data=@data
- @tuned_file=[]
- data.each do |dob|
- unless dob.is=='code'
- if dob.obj =~/<::\s+/ #watch
- dob.obj.gsub!(/<::\s+(\S+?)\s+!>/,
- %{<img src="#{@env.url.images_epub}/c_\\1.png" alt="\\1" width="14" height="14" align="bottom" border="0" />})
- end
- if dob.obj =~/<:image\s+/
- dob.obj.gsub!(/<:image\s+(http\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+>/,
- %{<a href="\\1"><img src="#{@env.url.images_epub}/\\2" \\3 \\4 naturalsizeflag="0" align="bottom" border="0" /></a>})
- dob.obj.gsub!(/<:image\s+(http\S+)\s+(\S+)\s+>/,
- %{<a href="\\1"><img src="#{@env.url.images_epub}/\\2" naturalsizeflag="0" align="bottom" border="0" /></a>})
- dob.obj.gsub!(/<:image\s+(\S+)\s+(\S+)\s+(\S+)\s+>/,
- %{<img src="#{@env.url.images_epub}/\\1" \\2 \\3 naturalsizeflag="0" align="bottom" border="0" />})
- dob.obj.gsub!(/<:image\s+(\S+)\s+>/,
- %{<img src="#{@env.url.images_epub}/\\1" naturalsizeflag="0" align="bottom" border="0" />})
- end
- if dob.obj =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/
- @word_mode=dob.obj.scan(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)[()\[\]]*[,.;:!?'"]{0,2}|(?:#{Mx[:gl_o]}\S+?#{Mx[:gl_c]})+|[^#{Mx[:lnk_o]}#{Mx[:lnk_c]}]+/mu)
- words=urls(@word_mode)
- dob.obj.gsub!(/.+/m,words)
- end
- dob.obj.gsub!(/\\copyright/i,%{<sup>&copy;</sup>})
- if (dob.obj !~/\<:ad\s+\.\.\//)
- dob.obj.gsub!(/\<:ad\s+(\S+)?\s+(\S+\.png)\s+(.+)?\;\s+(.+)?\;\s*!\>/,
- %{\n<center><a href="http:\/\/\\1" target="external"><img src="#{@env.url.images_epub}/\\2" alt="\\3" /></a></center>\n})
- else
- dob.obj.gsub!(/\<:ad\s+(\S+)?\s+(\S+\.png)\s+(.+)?\;\s+(.+)?\;\s*\>/,
- %{\n<center><a href="\\1" target="_top"><img src="#{@env.url.images_epub}/\\2" alt="\\3" /></a></center>\n})
- end
- dob.obj.gsub!(/!pick/,%{<img border="0" height="15" width="15" src="#{@env.url.images_epub}/#{@vz.icon_choice}" alt="stellar" />})
- dob.obj.gsub!(/!new/,%{&nbsp;<img border="0" height="15" width="15" src="#{@env.url.images_epub}/#{@vz.icon_new}" alt="new" />})
- dob.obj.gsub!(/<:h(.{1,7}?)>/,'<a href="#h\1">\1</a>')
- dob.obj.gsub!(/<:to(\d{1,7}?)>/,'<a href="#to\1">to&nbsp;{&nbsp;\1&nbsp;}</a> ')
- dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'<a href="\1" target="_top">\1</a>') #http ftp matches escaped, no decoration
- dob.obj.gsub!(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}<a href="mailto:\\1">\\1</a>#{@brace_url.xml_close}})
- dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}<a href="\\1" target="_top">\\1</a>#{@brace_url.xml_close}}) #http ftp matches with decoration
- if dob.obj =~/..\/\S+/ \
- and dob.obj !~/(\"..\/\S+?\"|>\s*..\/\S+<)/
- dob.obj.gsub!(/(\.\.\/\S+)/,'<a href="\1">\1</a>')
- end
- dob.obj.gsub!(/<a href="\.\.\//,%{<a href="#{@vz.url_site}/})
- else
- dob.obj.gsub!(/(^|[^}])_</m,'\1&lt;'); dob.obj.gsub!(/(^|[^}])_>/m,'\1&gt;') #code-block: angle brackets special characters
- dob.obj.gsub!(/(^|[^}])_</m,'\1&lt;'); dob.obj.gsub!(/(^|[^}])_>/m,'\1&gt;')
- end
- @tuned_file << dob
- end
- end
- def amp_html
- data=@data
- data.each do |dob|
- dob.obj.gsub!(/&/u,'&amp;')
- end
- data
- end
- def endnotes_html
- data=@data
- @tuned_file=[]
- a,s='_a','_s'
- ast,pls='&#042;','&#043;'
- data.each do |dob|
- unless dob.is =~/^code/
- dob.obj.gsub!(/(#{Mx[:en_a_o]}|#{Mx[:en_b_o]})(\d+)\s+(.+?)(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/,
- %{#{Mx[:nbsp]}<a href="#note\\2">#{Mx[:nbsp]}<sup id="note_ref\\2">\\2</sup>#{Mx[:nbsp]}</a> } + #note- endnote-
- %{\\1\\2 <a href="#note_ref\\2">#{Mx[:nbsp]}<sup id="note\\2">\\2.</sup></a> \\3 \\4}) #endnote- note- (careful may have switched)
- dob.obj.gsub!(/(#{Mx[:en_b_o]})[*](\d+)\s+(.+?)(#{Mx[:en_b_c]})/,
- %{#{Mx[:nbsp]}<a href="#note_astx\\2">#{Mx[:nbsp]}<sup id="note_ref_astx\\2">#{ast}\\2</sup>#{Mx[:nbsp]}</a> } + #note- endnote-
- %{\\1#{ast}\\2 <a href="#note_ref_astx\\2">#{Mx[:nbsp]}<sup id="note_astx\\2">#{ast}\\2.</sup></a> \\3 \\4}) #endnote- note- (careful may have switched)
- dob.obj.gsub!(/(#{Mx[:en_b_o]})[+](\d+)\s+(.+?)(#{Mx[:en_b_c]})/,
- %{#{Mx[:nbsp]}<a href="#note_plus\\2">#{Mx[:nbsp]}<sup id="note_ref_plus\\2">#{pls}\\2</sup>#{Mx[:nbsp]}</a> } + #note- endnote-
- %{\\1#{pls}\\2 <a href="#note_ref_plus\\2">#{Mx[:nbsp]}<sup id="note_plus\\2">#{pls}\\2.</sup></a> \\3 \\4}) #endnote- note- (careful may have switched) # double-check there may here be a bug
- if dob.obj =~/#{Mx[:en_a_o]}([*+]+)\s+.+?#{Mx[:en_a_c]}/
- m=$1.length.to_i
- dob.obj.gsub!(/(#{Mx[:en_a_o]})[*]+\s+(.+?)(#{Mx[:en_a_c]})/,
- %{#{Mx[:nbsp]}<a href="#note#{a*m}">#{Mx[:nbsp]}<sup id="note_ref#{a*m}">#{ast*m}</sup>#{Mx[:nbsp]}</a> } + #note- endnote-
- %{\\1#{ast*m} <a href="#note_ref#{a*m}">#{Mx[:nbsp]}<sup id="note#{a*m}">#{ast*m}</sup></a> \\2 \\3}) #endnote- note- (careful may have switched)
- dob.obj.gsub!(/(#{Mx[:en_a_o]})([+]+)\s+(.+?)(#{Mx[:en_a_c]})/,
- %{#{Mx[:nbsp]}<a href="#note#{s*m}">#{Mx[:nbsp]}<sup id="note_ref#{s*m}">#{pls*m}</sup>#{Mx[:nbsp]}</a> } + #note- endnote-
- %{\\1#{pls*m} <a href="#note_ref#{s*m}">#{Mx[:nbsp]}<sup id="note#{s*m}">#{pls*m}</sup></a> \\2 \\3}) #endnote- note- (careful may have switched)
- end
- end
- @tuned_file << dob
- end
- end
- def output
- data=@data
- @tuned_file=[]
- data.each do |dob|
- dob.obj.strip!
- dob.obj.chomp!
- @tuned_file << dob
- end
- @tuned_file << "\n<EOF>" if (@md.fns =~/\.sst0/) #remove
- @tuned_file
- end
- end
-end
-__END__
diff --git a/lib/sisu/v2/git.rb b/lib/sisu/v2/git.rb
deleted file mode 100644
index b5dc403e..00000000
--- a/lib/sisu/v2/git.rb
+++ /dev/null
@@ -1,230 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/copyleft/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: system environment, resource control and configuration details
-
-=end
-module SiSU_Git
- require "#{SiSU_lib}/param" # param.rb
- require "#{SiSU_lib}/sysenv" # sysenv.rb
- require "#{SiSU_lib}/dal" # dal.rb
- class Source
- include FileUtils #::Verbose
- def initialize(opt)
- @opt=opt
- @env=SiSU_Env::Info_env.new
- l=SiSU_Env::Standardise_language.new.file_to_language(@opt.fns)
- @git_path={}
- if @env.i18n.multilingual
- m=/((.+?)(?:\~\w{2,3})?)\.((?:-|ssm\.)?sst|ssm)$/ #watch added match for sss
- fnn,fnb,fnt=@opt.fns[m,1],@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.path.processing_path_git + '/' + fnb # + @opt.fnb
- @git_path[:src]=@git_path[:fnb] + '/' + Gt[:txt] + '/' + l[:c]
- @git_path[:image]=@git_path[:fnb] + '/' + Gt[:image]
- @git_path[:conf]=@git_path[:fnb] + '/' + Gt[:conf]
- @md=SiSU_Param::Parameters.new(@opt).get
- SiSU_DAL::Source.new(@opt).read # -m
- end
- def read
- make_dir_fnb
- if program_found?
- git_init
- end
- populate.sisusrc_files
- if program_found?
- git_commit
- end
- end
- def program_found?
- found=`whereis git`
- (found =~/bin\/git\b/) ? true : false
- end
- def make_dir_fnb
- mkdir_p(@git_path[:fnb]) unless FileTest.directory?(@git_path[:fnb])
- mkdir_p(@git_path[:src]) unless FileTest.directory?(@git_path[:src])
- mkdir_p(@git_path[:conf]) unless FileTest.directory?(@git_path[:conf])
- mkdir_p("#{@git_path[:conf]}/skin") unless FileTest.directory?("#{@git_path[:conf]}/skin")
- mkdir_p(@git_path[:image]) unless FileTest.directory?(@git_path[:image])
- end
- def git_init
- unless FileTest.directory?("#{@git_path[:fnb]}/.git")
- system("cd #{@git_path[:fnb]}\
- && git init
- ")
- end
- end
- def git_commit
- system("cd #{@git_path[:fnb]} \
- && git add . \
- && git commit -a
- ")
- end
- def populate
- def identify_language_versions
- print __FILE__ + ':'
- p __LINE__
- end
- def copy_src_head
- if @opt.fns =~/\.ssm\.sst/
- ssm=@opt.fns.gsub(/\.ssm\.sst/,'.ssm')
- cp_r("#{@env.path.pwd}/#{ssm}",@git_path[:src])
- else
- cp_r("#{@env.path.pwd}/#{@opt.fns}",@git_path[:src])
- 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|
- cp_r("#{@env.path.pwd}/#{f}",@git_path[:src])
- end
- end
- def locate_parse_file
- composite_src=@opt.fns=~/\.ssm$/ ? true : false
- parse_file=if composite_src \
- and @opt.cmd.inspect !~/m/
- ##SiSU_Assemble::Composite.new(@opt).read
- #SiSU_DAL::Source.new(@opt).read # -m
- "#{@env.path.composite_file}/#{@opt.fnb}.ssm.sst"
- elsif composite_src
- "#{@env.path.composite_file}/#{@opt.fnb}.ssm.sst"
- else "#{@env.path.pwd}/#{@opt.fns}"
- end
- end
- def locate_skin
- SiSU_Env::Info_skin.new(@md).select
- end
- def read_composite
- #print __FILE__ + ':'
- #p __LINE__
- end
- def extract_skin
- #print __FILE__ + ':'
- #p __LINE__
- end
- def extract_skin_and_images #(parse_file)
- parse_file_name=locate_parse_file
- parse_file=IO.readlines(parse_file_name,'')
- rgx_image=/(?:^|[^_\\])\{\s*(\S+?\.(?:png|jpg|gif))/
- #rgx_rb_image=/["'](\S+?\.(?:png|jpg|gif))["']/
- #rgx_rb_image=/[^\/]?([a-z]\S+?\.(?:png|jpg|gif))/
- rgx_rb_image=/([a-z][^ \/]+?\.(?:png|jpg|gif))/
- rgx_skin=/^\s+:skin:\s+(\S+)/
- skin_get=nil
- images=[]
- skin_get
- parse_file.each do |f| #% work area
- if f !~/^%+\s/
- skin_get ||= f.scan(rgx_skin).uniq.flatten if f =~rgx_skin
- if f =~rgx_image
- images << f.scan(rgx_image).uniq
- end
- end
- end
- skin=skin_get[0] if skin_get
- skin=locate_skin
- parse_skin=IO.readlines(skin,"\n")
- parse_skin.each do |f| #% work area
- if f !~/^#/ \
- and f =~rgx_rb_image
- images << f.scan(rgx_rb_image).uniq
- end
- end
- image_path="#{@env.path.pwd}/_sisu/image"
- images.flatten.each do |i|
- if FileTest.file?("#{image_path}/#{i}")
- cp_r("#{image_path}/#{i}",@git_path[:image])
- end
- end
- if FileTest.file?(skin)
- cp_r(skin,"#{@git_path[:conf]}/skin")
- end
- {:skin =>skin, :images =>images}
- 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
- populate.extract_skin
- #parse_file_name=locate_parse_file
- #parse_file=IO.readlines(parse_file_name,'')
- populate.extract_skin_and_images #(parse_file)
- #populate.extract_composite_source
- #populate.read_composite # or read_each_composite
- populate.identify_language_versions
- end
- self
- end
- end
-end
-__END__
diff --git a/lib/sisu/v2/harvest.rb b/lib/sisu/v2/harvest.rb
deleted file mode 100644
index 2a01910e..00000000
--- a/lib/sisu/v2/harvest.rb
+++ /dev/null
@@ -1,101 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
- harvest metadata from document corpus (suitable for medium sized sites)
- (concept example, [to remove size constraint: implement SQL equivalent])
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/copyleft/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: system environment, resource control and configuration details
-
-=end
-def help
- puts <<WOK
- harvest --harvest extracts document index metadata
-
-WOK
-end
-def css(opt)
- require "#{SiSU_lib}/css" # css.rb
- css=SiSU_Style::CSS.new
- fn_css=SiSU_Env::CSS_default.new
- style=File.new("#{@env.path.pwd}/#{fn_css.harvest}",'w')
- style << css.harvest
- style.close
-end
-def cases(opt)
- case opt.mod.inspect
- when/--harvest/i
- css(opt) if opt.cmd.inspect =~/M/
- HARVEST_authors::Songsheet.new(opt).songsheet
- HARVEST_topics::Songsheet.new(opt).songsheet
- if opt.cmd.inspect =~/R/
- require "#{SiSU_lib}/remote" # remote.rb
- SiSU_Remote::Put.new(opt).rsync_harvest
- end
- else
- help
- end
-end
-require "#{SiSU_lib}/options" # options.rb
-require "#{SiSU_lib}/harvest_topics" # harvest_topics.rb
-require "#{SiSU_lib}/harvest_authors" # harvest_authors.rb
-require "#{SiSU_lib}/sysenv" # sysenv.rb
- include SiSU_Env
-@env=SiSU_Env::Info_env.new
-@@the_idx_topics,@@the_idx_authors={},{}
-argv=$*
-opt=SiSU_commandline::Options.new(argv)
-argv.shift
-mkdir_p(@env.path.output_md_harvest) unless FileTest.directory?(@env.path.output_md_harvest)
-cases(opt)
-__END__
diff --git a/lib/sisu/v2/harvest_authors.rb b/lib/sisu/v2/harvest_authors.rb
deleted file mode 100644
index dfb2b654..00000000
--- a/lib/sisu/v2/harvest_authors.rb
+++ /dev/null
@@ -1,316 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
- metadata harvest, extract authors and their writings from document set
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: simple xml representation (sax style)
-
-=end
-module HARVEST_authors
- require "#{SiSU_lib}/author_format" # author_format.rb
- @@the_idx_authors=[]
- class Songsheet
- def initialize(opt)
- @opt=opt
- @file_list=opt.files
- @env=SiSU_Env::Info_env.new
- end
- def songsheet
- files,idx_array=[],[]
- @file_list.each do |f|
- (f =~/.+?\.ss[tm]$/) \
- ? (files << f[/(.+?\.ss[tm])$/,1]) \
- : (print "not .sst or .ssm ? << #{f} >> ")
- end
- files.each do |filename|
- file_array=[]
- File.open(filename,'r') do |file|
- file.each_line("\n\n") do |line|
- if line =~/^@(?:title|creator|date):(?:\s|$)/m
- file_array << line
- elsif line =~/^@\S+?:(?:\s|$)/m \
- or line =~/^(?:\s*\n|%+ )/
- else break
- end
- end
- end
- idx_array=HARVEST_authors::Harvest.new(file_array,filename,idx_array).extract_harvest
- end
- the_idx=HARVEST_authors::Index.new(idx_array,@@the_idx_authors).construct_book_author_index
- HARVEST_authors::Output_index.new(@opt,the_idx).html_print.html_songsheet
- puts "file://#{@env.path.output_md_harvest}/harvest_authors.html"
- puts "file://#{@env.path.pwd}/harvest_authors.html" if @opt.cmd.inspect =~/M/
- end
- end
- class Harvest
- def initialize(data,filename,idx_array)
- @data,@filename,@idx_array=data,filename,idx_array
- end
- def extract_harvest
- data,filename,idx_array=@data,@filename,@idx_array
- @title,@subtitle,@fulltitle,@author,@author_format,@date=nil,nil,nil,nil,nil,nil
- @authors=[]
- rgx={}
- rgx[:author]=/^@creator:(?:[ ]+|.+?:author:[ ]+)(.+?)(?:\||\n)/m
- rgx[:title]=/^@title:[ ]+(.+)/
- rgx[:subtitle]=/^@title:.+?:subtitle:[ ]+(.+?)\n/m
- rgx[:date]=/^@date:(?:[ ]+|.+?:published:[ ]+)(\d{4})/m
- data.each do |para|
- if para=~ rgx[:title]
- @title=rgx[:title].match(para)[1]
- end
- if para=~ rgx[:subtitle]
- @subtitle=rgx[:subtitle].match(para)[1]
- end
- if para=~ rgx[:author]
- @author_format=rgx[:author].match(para)[1]
- end
- if para=~ rgx[:date]
- @date=rgx[:date].match(para)[1]
- end
- break if @title and @subtitle and @author and @date
- end
- @fulltitle=@subtitle ? (@title + ' - ' + @subtitle) : @title
- if @title and @author_format
- creator=FORMAT::Author.new(@author_format.strip).author_details
- @authors,@authorship=creator[:authors],creator[:authorship]
- file=if filename=~/~[a-z]{2,3}\.ss[mt]$/
- lang='.' + /~([a-z]{2,3})\.ss[mt]$/.match(filename)[1]
- filename.sub(/~[a-z]{2,3}\.ss[mt]$/,'')
- else
- lang=''
- filename.sub(/\.ss[mt]$/,'')
- end
- page="sisu_manifest#{lang}.html"
- idx_array <<= { :filename => filename, :file => file, :date => @date, :title => @fulltitle, :author => creator, :page => page }
- else
- #p "missing author field: #{@filename} title: #{@title}; author: #{@author_format}"
- end
- idx_array.flatten!
- idx_array
- end
- end
- class Index
- def initialize(idx_array,the_idx)
- @idx_array,@the_idx=idx_array,the_idx
- @@the_idx_authors=@the_idx
- end
- def capital(txt)
- txt[0].chr.capitalize + txt[1,txt.length]
- end
- def construct_book_author_index
- idx_array=@idx_array
- idx_array.each do |idx|
- idx[:author][:last_first_format_a].each do |author|
- author.strip!
- if @@the_idx_authors[author].class==NilClass
- @@the_idx_authors[author]={:md => []}
- end
- @@the_idx_authors[author][:md] << { :filename => idx[:filename], :file => idx[:file], :author => idx[:author], :title => idx[:title], :date => idx[:date], :page => idx[:page] }
- end
- end
- @the_idx=@@the_idx_authors
- end
- end
- class Output_index
- def initialize(opt,the_idx)
- @opt,@the_idx=opt,the_idx
- @env=SiSU_Env::Info_env.new
- @rc=Get_init.instance.yamlrc
- @alph=%W[9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z]
- @letter=@alph.shift
- @vz=SiSU_Env::Get_init.instance.skin
- end
- def html_file_open
- @output={}
- @output[:html]=File.new("#{@env.path.output_md_harvest}/harvest_authors.html",'w')
- @output[:html_mnt]=(@opt.cmd.inspect =~/M/) \
- ? File.new("#{@env.path.pwd}/harvest_authors.html",'w') \
- : nil
- end
- def html_file_close
- @output[:html].close
- @output[:html_mnt].close if @output[:html_mnt].class==File
- end
- def html_print
- def html_songsheet
- html_file_open
- html_head
- html_alph
- html_body
- html_tail
- html_file_close
- end
- def html_head_adjust(type='')
- css_path=(type !~/maintenance/) \
- ? '../_sisu/css/harvest.css' \
- : 'harvest.css'
- sv=SiSU_Env::Info_version.instance.get_version
- <<WOK
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<title>SiSU Metadata Harvest - Authors</title>
-<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
-<meta name="dc.title" content= "SiSU metadata harvest, Authors - SiSU information Structuring Universe, Structured information Serialised Units" />
-<meta name="dc.subject" content= "document structuring, ebook, publishing, PDF, LaTeX, XML, ODF, SQL, postgresql, sqlite, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, granular search, digital library" />
-<meta name="generator" content="#{sv[:project]} #{sv[:version]} of #{sv[:date_stamp]} (n*x and Ruby!)" />
-<link rel="generator" href="http://www.jus.uio.no/sisu/SiSU" />
-<link rel="stylesheet" href="#{css_path}" type="text/css" />
-<link rel="shortcut icon" href="../_sisu/image/rb7.ico" />
-</head>
-<body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en">
-<a name="top" id="top"></a>
-<a name="up" id="up"></a>
-<a name="start" id="start"></a>
-<h1>SiSU Metadata Harvest - Authors</h1>
-<p>[<a href="../index.html">&nbsp;HOME&nbsp;</a>] also see <a href="harvest_topics.html">SiSU Metadata Harvest - Topics</a></p>
-<p>#{@env.widget_static.search_form}</p>
-<hr />
-WOK
- end
- def html_head
- @output[:html_mnt] << html_head_adjust('maintenance') if @opt.cmd.inspect =~/M/
- @output[:html] << html_head_adjust
- end
- def html_alph
- a=[]
- a << '<p>'
- @alph.each do |x|
- a << ((x =~/[0-9]/) ? '' : %{<a href="##{x}">#{x}</a>,&nbsp;})
- end
- @output[:html_mnt] << a.join if @output[:html_mnt].class==File
- @output[:html] << a.join
- end
- def html_tail
- a=[]
- a <<<<WOK
-<hr />
-<a name="bottom" id="bottom"></a>
-<a name="down" id="down"></a>
-<a name="end" id="end"></a>
-<a name="finish" id="finish"></a>
-<a name="stop" id="stop"></a>
-<a name="credits"></a>
-#{@vz.credits_sisu}
-</body>
-</html>
-WOK
- @output[:html_mnt] << a if @output[:html_mnt].class==File
- @output[:html] << a
- end
- def do_html(html)
- @output[:html_mnt] << html if @output[:html_mnt].class==File
- @output[:html] << html
- end
- def do_string(attrib,string)
- html=%{<p class="#{attrib}">#{string}</p>}
- do_html(html)
- end
- def do_string_name(attrib,string)
- f=/^(\S)/.match(string[0])[1]
- if @letter < f
- while @letter < f
- if @alph.length > 0
- @letter=@alph.shift
- if @output[:html_mnt].class==File
- @output[:html_mnt] << %{\n<p class="letter"><a name="#{@letter}"></p>#{@letter}</a><p class="book_index_lev1"><a name="#{@letter.downcase}"></a></p>}
- end
- @output[:html] << %{\n<p class="letter"><a name="#{@letter}">#{@letter}</a></p><p class="book_index_lev1"><a name="#{@letter.downcase}"></a></p>}
- else break
- end
- end
- end
- end
- def html_body
- the_idx=@the_idx
- the_idx.sort.each do |a|
- do_string_name('',a)
- name=a[0].sub(/(.+?)(?:,.+|$)/,'\1').gsub(/\s+/,'_')
- x = %{<p class="author"><a name="#{name}">#{a[0]}</a></p>}
- if @output[:html_mnt].class==File
- @output[:html_mnt] << x
- end
- @output[:html] << x
- works=[]
- a[1][:md].each do |x|
- work=[ "#{x[:date]} #{x[:title]}", %{<p class="publication">#{x[:date]} <a href="../#{x[:file]}/#{x[:page]}">#{x[:title]}</a>, #{x[:author][:authors_s]}</p>} ]
- works<<=(@output[:html_mnt].class==File) \
- ? (work.concat([%{<p class="publication">[<a href="#{x[:file]}.sst">src</a>]&nbsp;&nbsp;#{x[:date]} <a href="file://#{@env.path.output}/#{x[:file]}/#{x[:page]}">#{x[:title]}</a>, #{x[:author][:authors_s]} -- [<a href="#{x[:file]}.sst">#{x[:file]}.sst</a>]</p>}])) \
- : work
- end
- works.sort_by {|x| x[0]}.each do |x|
- @output[:html] << x[1]
- @output[:html_mnt] << x[2] if @output[:html_mnt].class==File
- end
- end
- end
- self
- end
- def screen_print
- def cycle
- the_idx=@the_idx
- the_idx.sort.each do |a|
- puts a[0]
- a[1][:md].each do |x|
- puts "\t" + x[:file]
- end
- end
- end
- self
- end
- end
-end
-__END__
diff --git a/lib/sisu/v2/harvest_topics.rb b/lib/sisu/v2/harvest_topics.rb
deleted file mode 100644
index 45b14496..00000000
--- a/lib/sisu/v2/harvest_topics.rb
+++ /dev/null
@@ -1,559 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
- metadata harvest, extract topics and associated writings from document set
- (topics use topic_register header)
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: simple xml representation (sax style)
-
-=end
-module HARVEST_topics
- require "#{SiSU_lib}/author_format" # author_format.rb
- class Songsheet
- def initialize(opt)
- @opt=opt
- @file_list=opt.files
- @env=SiSU_Env::Info_env.new
- end
- def songsheet
- files,idx_array=[],[]
- @file_list.each do |f|
- (f =~/.+?\.ss[tm]$/) \
- ? (files << f[/(.+?\.ss[tm])$/,1]) \
- : (print "not .sst or .ssm ? << #{f} >> ")
- end
- files.each do |filename|
- file_array=[]
- File.open(filename,'r') do |file|
- file.each_line("\n\n") do |line|
- if line =~/^@(?:title|creator|classify):(?:\s|$)/m
- file_array << line
- elsif line =~/^@\S+?:(?:\s|$)/m \
- or line =~/^(?:\s*\n|%+ )/
- else break
- end
- end
- end
- idx_array=HARVEST_topics::Harvest.new(@opt,file_array,filename,idx_array).extract_harvest
- end
- the_idx=HARVEST_topics::Index.new(idx_array,@@the_idx_topics).construct_book_topic_index
- #HARVEST_topics::Output_index.new('',the_idx).screen_print.cycle if @opt.cmd.inspect =~/[VM]/
- HARVEST_topics::Output_index.new(@opt,the_idx).html_print.html_songsheet
- puts "file://#{@env.path.output_md_harvest}/harvest_topics.html"
- puts "file://#{@env.path.pwd}/harvest_topics.html" if @opt.cmd.inspect =~/M/
- end
- end
- class Harvest
- def initialize(opt,data,filename,idx_array)
- @opt,@data,@filename,@idx_array=opt,data,filename,idx_array
- end
- def extract_harvest
- data,filename,idx_array=@data,@filename,@idx_array
- @idx_lst,@title,@subtitle,@fulltitle,@author,@author_format=nil,nil,nil,nil,nil,nil
- rgx={}
- rgx[:author]=/^@creator:(?:[ ]+|.+?:author:[ ]+)(.+?)(?:\||\n)/m
- rgx[:title]=/^@title:[ ]+(.+)/
- rgx[:subtitle]=/^@title:.+?:subtitle:[ ]+(.+?)\n/m
- rgx[:idx]=/^@classify:.+?:topic_register:[ ]+(.+?)\n/m
- data.each do |para|
- if para=~ rgx[:idx]
- @idx_list=rgx[:idx].match(para)[1]
- end
- if para=~ rgx[:title]
- @title=rgx[:title].match(para)[1]
- end
- if para=~ rgx[:subtitle]
- @subtitle=rgx[:subtitle].match(para)[1]
- end
- if para=~ rgx[:author]
- @author_format=rgx[:author].match(para)[1]
- end
- break if @title and @subtitle and @author and @idx_lst
- end
- @fulltitle=@subtitle ? (@title + ' - ' + @subtitle) : @title
- if @title \
- and @author_format \
- and @idx_list
- creator=FORMAT::Author.new(@author_format.strip).author_details
- @authors,@authorship=creator[:authors],creator[:authorship]
- file=if filename=~/~[a-z]{2,3}\.ss[mt]$/
- lang='.' + /~([a-z]{2,3})\.ss[mt]$/.match(filename)[1]
- filename.sub(/~[a-z]{2,3}\.ss[mt]$/,'')
- else
- lang=''
- filename.sub(/\.ss[mt]$/,'')
- end
- page="sisu_manifest#{lang}.html"
- idx_array <<=if @idx_list =~/;/
- g=@idx_list.scan(/[^;]+/)
- idxl=[]
- g.each do |i|
- i.strip!
- idxl << { :filename =>filename,:file =>file,:rough_idx =>i,:title =>@fulltitle,:author =>creator,:page =>page}
- end
- idxl
- else { :filename =>filename,:file =>file,:rough_idx =>@idx_list,:title =>@fulltitle,:author =>creator,:page =>page}
- end
- else
- p "missing required field in #{@filename} - [title]: <<#{@title}>>; [author]: <<#{@author_format}>>; [idx]: <<#{@idx_list}>>" if @opt.cmd.inspect =~/[VM]/
- end
- idx_array.flatten!
- idx_array
- end
- end
- class Index
- def initialize(idx_array,the_idx)
- @idx_array,@the_idx=idx_array,the_idx
- @@the_idx_topics=@the_idx
- end
- def capital(txt)
- txt[0].chr.capitalize + txt[1,txt.length]
- end
- def contents(hash,idx)
- names=''
- idx[:author][:last_first_format_a].each do |n|
- s=n.sub(/(.+?)(?:,.+|$)/,'\1').gsub(/\s+/,'_')
- names += %{<a href="harvest_authors.html##{s}">#{n}</a>, }
- end
- hash << { :filename =>idx[:filename],:file =>idx[:file],:author =>names,:title =>idx[:title],:page =>idx[:page]}
- end
- def construct_book_topic_index
- idx_array=@idx_array
- idx_array.each do |idx|
- @lv0,@lv1,@lv2,@lv3,@lv4={},{},{},{},{}
- if idx[:rough_idx]
- idx_lst=idx[:rough_idx].scan(/[^:]+/)
- else
- puts "no topic register in: << #{idx[:filename]} >>"
- next
- end
- idx_lst_alt=[]
- idx_lst.each {|lev| idx_lst_alt << lev.scan(/[^|]+/)}
- depth = idx_lst_alt.length - 1
- range = 0..depth
- range.each do |t|
- if idx_lst_alt[t]
- case t
- when 0
- lev0=idx_lst_alt[t]
- lev0.each do |lv0|
- lv0=capital(lv0)
- if @@the_idx_topics[lv0].class==NilClass
- @@the_idx_topics[lv0]={:md => []}
- end
- @lv0=lv0 if lev0.length==1
- j=@@the_idx_topics[lv0][:md]
- contents(j,idx) if idx_lst_alt.length - 1 == t
- end
- when 1
- lev1=idx_lst_alt[t]
- lev1.each do |lv1|
- lv1=capital(lv1)
- if @@the_idx_topics[@lv0][lv1].class==NilClass
- @@the_idx_topics[@lv0][lv1]={:md => []}
- end
- @lv1=lv1 if lev1.length==1
- j=@@the_idx_topics[@lv0][lv1][:md]
- contents(j,idx) if idx_lst_alt.length - 1 == t
- end
- when 2
- lev2=idx_lst_alt[t]
- lev2.each do |lv2|
- lv2=capital(lv2)
- if @@the_idx_topics[@lv0][@lv1][lv2].class==NilClass
- @@the_idx_topics[@lv0][@lv1][lv2]={:md => []}
- end
- @lv2=lv2 if lev2.length==1
- j=@@the_idx_topics[@lv0][@lv1][lv2][:md]
- contents(j,idx) if idx_lst_alt.length - 1 == t
- end
- when 3
- lev3=idx_lst_alt[t]
- lev3.each do |lv3|
- lv3=capital(lv3)
- if @@the_idx_topics[@lv0][@lv1][@lv2][lv3].class==NilClass
- @@the_idx_topics[@lv0][@lv1][@lv2][lv3]={:md => []}
- end
- @lv3=lv3 if lev3.length==1
- j=@@the_idx_topics[@lv0][@lv1][@lv2][lv3][:md]
- contents(j,idx) if idx_lst_alt.length - 1 == t
- end
- when 4
- lev4=idx_lst_alt[t]
- lev4.each do |lv4|
- lv4=capital(lv4)
- if @@the_idx_topics[@lv0][@lv1][@lv2][@lv3][lv4].class==NilClass
- @@the_idx_topics[@lv0][@lv1][@lv2][@lv3][lv4]={:md => []}
- end
- @lv4=lv4 if lev4.length==1
- j=@@the_idx_topics[@lv0][@lv1][@lv2][@lv3][lv4][:md]
- contents(j,idx) if idx_lst_alt.length - 1 == t
- end
- end
- end
- end
- end
- @the_idx
- end
- end
- class Output_index
- def initialize(opt,the_idx)
- @opt,@the_idx=opt,the_idx
- @env=SiSU_Env::Info_env.new
- @rc=Get_init.instance.yamlrc
- @alph=%W[9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z]
- @letter=@alph.shift
- @vz=SiSU_Env::Get_init.instance.skin
- end
- def html_file_open
- @output={}
- @output[:html]=File.new("#{@env.path.output_md_harvest}/harvest_topics.html",'w')
- if @opt.cmd.inspect =~/-M/
- @output[:html_mnt]=File.new("#{@env.path.pwd}/harvest_topics.html",'w')
- end
- end
- def html_file_close
- @output[:html].close
- @output[:html_mnt].close if @output[:html_mnt].class==File
- end
- def html_print
- def html_songsheet
- html_file_open
- html_head
- html_alph
- html_body
- html_tail
- html_file_close
- end
- def html_head_adjust(type='')
- css_path=(type !~/maintenance/) \
- ? '../_sisu/css/harvest.css' \
- : 'harvest.css'
- sv=SiSU_Env::Info_version.instance.get_version
- <<WOK
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<title>SiSU Metadata Harvest - Topics</title>
-<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
-<meta name="dc.title" content= "SiSU metadata harvest, Topics - SiSU information Structuring Universe, Structured information Serialised Units" />
-<meta name="dc.subject" content= "document structuring, ebook, publishing, PDF, LaTeX, XML, ODF, SQL, postgresql, sqlite, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, granular search, digital library" />
-<meta name="generator" content="#{sv[:project]} #{sv[:version]} of #{sv[:date_stamp]} (n*x and Ruby!)" />
-<link rel="generator" href="http://www.jus.uio.no/sisu/SiSU" />
-<link rel="stylesheet" href="#{css_path}" type="text/css" />
-<link rel="shortcut icon" href="../_sisu/image/rb7.ico" />
-</head>
-<body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en">
-<a name="top" id="top"></a>
-<a name="up" id="up"></a>
-<a name="start" id="start"></a>
-<h1>SiSU Metadata Harvest - Topics</h1>
-<p>[<a href="../index.html">&nbsp;HOME&nbsp;</a>] also see <a href="harvest_authors.html">SiSU Metadata Harvest - Authors</a></p>
-<p>#{@env.widget_static.search_form}</p>
-<hr />
-WOK
- end
- def html_head
- @output[:html_mnt] << html_head_adjust('maintenance') if @opt.cmd.inspect =~/M/
- @output[:html] << html_head_adjust
- end
- def html_alph
- a=[]
- a << '<p>'
- @alph.each do |x|
- a << (x =~/[0-9]/) \
- ? '' \
- : %{<a href="##{x}">#{x}</a>,&nbsp;}
- end
- @output[:html_mnt] << a if @opt.cmd.inspect =~/M/
- @output[:html] << a.join
- end
- def html_tail
- a=[]
- a <<<<WOK
-<hr />
-<a name="bottom" id="bottom"></a>
-<a name="down" id="down"></a>
-<a name="end" id="end"></a>
-<a name="finish" id="finish"></a>
-<a name="stop" id="stop"></a>
-<a name="credits"></a>
-#{@vz.credits_sisu}
-</body>
-</html>
-WOK
- @output[:html_mnt] << a if @output[:html_mnt].class==File
- @output[:html] << a
- end
- def do_html(html)
- @output[:html] << html
- end
- def do_html_maintenance(html)
- @output[:html_mnt] << html if @output[:html_mnt].class==File
- end
- def do_string(attrib,string)
- html=%{<p class="#{attrib}">#{string}</p>}
- do_html(html)
- do_html_maintenance(html) if @output[:html_mnt].class==File
- end
- def do_string_default(attrib,string)
- html=%{<p class="#{attrib}">#{string}</p>}
- do_html(html)
- end
- def do_string_maintenance(attrib,string)
- html=%{<p class="#{attrib}">#{string}</p>}
- do_html_maintenance(html) if @output[:html_mnt].class==File
- end
- def do_string_name(attrib,string)
- f=/^(\S)/.match(string)[1]
- if @letter < f
- while @letter < f
- if @alph.length > 0
- @letter=@alph.shift
- if @output[:html_mnt].class==File
- @output[:html_mnt] << %{\n<p class="letter"><a name="#{@letter}">#{@letter}</a></p><p class="book_index_lev1"><a name="#{@letter.downcase}"></a></p>}
- end
- @output[:html] << %{\n<p class="letter"><a name="#{@letter}">#{@letter}</a></p><p class="book_index_lev1"><a name="#{@letter.downcase}"></a></p>}
- else break
- end
- end
- end
- name=string.strip.gsub(/\s+/,'_')
- html=%{<p class="#{attrib}"><a name="#{name}">#{string}</a></p>}
- do_html(html)
- do_html_maintenance(html) if @output[:html_mnt].class==File
- end
- def do_array(lv,array)
- lv+=1
- array.each do |b|
- do_case(lv,b)
- end
- end
- def do_hash_md(attrib,hash)
- html=%{<a href="../#{hash[:file]}/#{hash[:page]}">#{hash[:title]}</a> - #{hash[:author]}}
- do_string_default(attrib,html)
- end
- def do_hash_md_maintenance(attrib,hash)
- if @output[:html_mnt].class==File #should not be run for presentation output
- html=%{[<a href="#{hash[:file]}.sst">src</a>]&nbsp;&nbsp;<a href="file://#{@env.path.output}/#{hash[:file]}/#{hash[:page]}">#{hash[:title]}</a> - #{hash[:author]}}
- do_string_maintenance(attrib,html)
- end
- end
- def do_hash(lv,hash)
- lv+=1
- key=[]
- hash.each_key do |m|
- if m == :md
- do_case(lv,hash[m])
- elsif m != :title and m != :author and m != :filename and m != :file and m != :rough_idx and m != :page
- key << m
- elsif m == :title
- do_hash_md('work',hash)
- do_hash_md_maintenance('work',hash)
- end
- end
- if key.length > 0
- key.sort.each do |m|
- attrib="lev#{lv}"
- lv==0 ? do_string_name(attrib,m) : do_string(attrib,m)
- do_case(lv,hash[m])
- end
- end
- end
- def do_case(lv,a)
- y = a.class
- case
- when y==String
- attrib="lev#{lv}"
- lv==0 ? do_string_name(attrib,a) : do_string(attrib,a)
- when y==Array
- do_array(lv,a)
- when y==Hash
- do_hash(lv,a)
- end
- end
- def html_body
- the_idx=@the_idx
- the_idx.sort.each do |a|
- do_case(-1,a)
- end
- end
- self
- end
- def screen_print
- def do_string(lv,string)
- s=' '*4
- puts s*lv + string
- end
- def do_array(lv,array)
- lv+=1
- array.each do |b|
- do_case(lv,b)
- end
- end
- def do_hash_md(lv,hash)
- string=hash[:title] + ' - ' + hash[:author]
- do_string(lv,string)
- end
- def do_hash(lv,hash)
- lv+=1
- key=[]
- hash.each_key do |m|
- if m == :md
- do_case(lv,hash[m])
- elsif m != :title and m != :author and m != :filename and m != :file and m != :rough_idx and m != :page
- key << m
- elsif m == :title
- do_hash_md(lv,hash)
- end
- end
- if key.length > 0
- key.sort.each do |m|
- do_string(lv,m)
- do_case(lv,hash[m])
- end
- end
- end
- def do_case(lv,a)
- s=' '*4
- y = a.class
- case
- when y==String
- do_string(lv,a)
- when y==Array
- do_array(lv,a)
- when y==Hash
- do_hash(lv,a)
- end
- end
- def cycle
- the_idx=@the_idx
- the_idx.each do |a|
- do_case(-1,a)
- end
- end
- self
- end
- def screen_print_unsorted
- def do_string(lv,string)
- s=' '*4
- puts s*lv + string
- end
- def do_array(lv,array)
- lv+=1
- array.each do |b|
- do_case(lv,b)
- end
- end
- def do_hash_md(lv,hash)
- string=hash[:title] + ' - ' + hash[:author]
- do_string(lv,string)
- end
- def do_hash(lv,hash)
- lv+=1
- hash.each_key do |m|
- if m == :md
- do_case(lv,hash[m])
- else
- if m != :title and m != :author and m != :filename and m != :file and m != :rough_idx and m != :page
- do_string(lv,m)
- do_case(lv,hash[m])
- elsif m == :title
- do_hash_md(lv,hash)
- else
- end
- end
- end
- end
- def do_case(lv,a)
- s=' '*4
- y = a.class
- case
- when y==String
- do_string(lv,a)
- when y==Array
- do_array(lv,a)
- when y==Hash
- do_hash(lv,a)
- end
- end
- def cycle
- the_idx=@the_idx
- the_idx.each do |a|
- do_case(-1,a)
- end
- end
- self
- end
- end
-end
-__END__
-terms -|_ t{tl1} -|_ {fa}[fa]{filenames and other details}
- | |_ {tl2} -|_ {fa}[fa]{filenames and other details}
- | | |_{tl3} -|_ {fa}[fa]{filenames and other details}
- | | | |_{tl4} - {fa}[fa]{filenames and other details}
- | | | |
- | | | |_{tl4a} - {fa}[fa]{filenames and other details}
- | | | |
- | | | |_{tl4b} - {fa}[fa]{filenames and other details}
- | | | |
- | | | |_ ...
- | | |
- | | |_{tl3a} - {fa}[fa]{filenames and other details}
- | |
- | |_{tl2a} - {fa}[fa]{filenames and other details}
- |
- |_ t{tl1a} -|_ {fa}[fa]{filenames and other details}
- |_ ...
diff --git a/lib/sisu/v2/html_tune.rb b/lib/sisu/v2/html_tune.rb
deleted file mode 100644
index 99ce1b0f..00000000
--- a/lib/sisu/v2/html_tune.rb
+++ /dev/null
@@ -1,371 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: html generation, html pre-processing
-
-=end
-require "#{SiSU_lib}/param"
-module SiSU_HTML_Tune
- require "#{SiSU_lib}/sysenv" # sysenv.rb
- include SiSU_Env; include SiSU_Screen
- require "#{SiSU_lib}/html_format" # html_format.rb #watch
- @@line_mode=''
- @@endnote_array=[]
- @@endnote_call_counter=1
- @@table_align='<table summary='' width="96%" border="0" bgcolor="white" cellpadding="0" col="3">
-<tr ...><td width="2%" align="right">
-&nbsp\;</td>
-<td width="94%" valign="top" align="justify">'
- @@table_align_close='</td>
-<td width="4%" align="right" valign="top">
-<font size="1" color="#777777">
-&nbsp;&nbsp;&nbsp;</font> </td></tr></table>'
- @@counter,@@column,@columns=0,0,0
- class Output
- def initialize(data,md)
- @data,@md=data,md
- @cX=SiSU_Screen::Ansi.new(@md.cmd).cX
- end
- def hard_output
- my_make=SiSU_Env::Create_file.new(@md.cmd,@md.fns)
- @filename_tune=my_make.file_tune
- data=[]
- @data.each{|x| x.obj.strip; data << x if not x.obj.empty?} #1.9 array?
- data.each do |dob|
- @filename_tune.puts dob, "\n"
- end
- end
- def marshal
- my_make=SiSU_Env::Create_file.new(@md.cmd,@md.fns)
- @marshal_tune=my_make.marshal_tune
- File.open(@marshal_tune,'w') {|f| Marshal.dump(@data.to_a,f)}
- end
- end
- class Clean_html
- def initialize(html='')
- @html=html
- end
- def clean
- html=@html
- str=if html.class==String
- html
- else html.obj
- end
- str.gsub!(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;')
- str.gsub!(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;')
- str.gsub!(/¢/u,'&cent;') # &#162;
- str.gsub!(/£/u,'&pound;') # &#163;
- str.gsub!(/¥/u,'&yen;') # &#165;
- str.gsub!(/§/u,'&sect;') # &#167;
- str.gsub!(/©/u,'&copy;') # &#169;
- str.gsub!(/ª/u,'&ordf;') # &#170;
- str.gsub!(/«/u,'&laquo;') # &#171;
- str.gsub!(/®/u,'&reg;') # &#174;
- str.gsub!(/°/u,'&deg;') # &#176;
- str.gsub!(/±/u,'&plusmn;') # &#177;
- str.gsub!(/²/u,'&sup2;') # &#178;
- str.gsub!(/³/u,'&sup3;') # &#179;
- str.gsub!(/µ/u,'&micro;') # &#181;
- str.gsub!(/¶/u,'&para;') # &#182;
- str.gsub!(/¹/u,'&sup1;') # &#185;
- str.gsub!(/º/u,'&ordm;') # &#186;
- str.gsub!(/»/u,'&raquo;') # &#187;
- str.gsub!(/¼/u,'&frac14;') # &#188;
- str.gsub!(/½/u,'&frac12;') # &#189;
- str.gsub!(/¾/u,'&frac34;') # &#190;
- str.gsub!(/×/u,'&times;') # &#215;
- str.gsub!(/÷/u,'&divide;') # &#247;
- str.gsub!(/¿/u,'&iquest;') # &#191;
- str.gsub!(/À/u,'&Agrave;') # &#192;
- str.gsub!(/Á/u,'&Aacute;') # &#193;
- str.gsub!(/Â/u,'&Acirc;') # &#194;
- str.gsub!(/Ã/u,'&Atilde;') # &#195;
- str.gsub!(/Ä/u,'&Auml;') # &#196;
- str.gsub!(/Å/u,'&Aring;') # &#197;
- str.gsub!(/Æ/u,'&AElig;') # &#198;
- str.gsub!(/Ç/u,'&Ccedil;') # &#199;
- str.gsub!(/È/u,'&Egrave;') # &#200;
- str.gsub!(/É/u,'&Eacute;') # &#201;
- str.gsub!(/Ê/u,'&Ecirc;') # &#202;
- str.gsub!(/Ë/u,'&Euml;') # &#203;
- str.gsub!(/Ì/u,'&Igrave;') # &#204;
- str.gsub!(/Í/u,'&Iacute;') # &#205;
- str.gsub!(/Î/u,'&Icirc;') # &#206;
- str.gsub!(/Ï/u,'&Iuml;') # &#207;
- str.gsub!(/Ð/u,'&ETH;') # &#208;
- str.gsub!(/Ñ/u,'&Ntilde;') # &#209;
- str.gsub!(/Ò/u,'&Ograve;') # &#210;
- str.gsub!(/Ó/u,'&Oacute;') # &#211;
- str.gsub!(/Ô/u,'&Ocirc;') # &#212;
- str.gsub!(/Õ/u,'&Otilde;') # &#213;
- str.gsub!(/Ö/u,'&Ouml;') # &#214;
- str.gsub!(/Ø/u,'&Oslash;') # &#216;
- str.gsub!(/Ù/u,'&Ugrave;') # &#217;
- str.gsub!(/Ú/u,'&Uacute;') # &#218;
- str.gsub!(/Û/u,'&Ucirc;') # &#219;
- str.gsub!(/Ü/u,'&Uuml;') # &#220;
- str.gsub!(/Ý/u,'&Yacute;') # &#221;
- str.gsub!(/Þ/u,'&THORN;') # &#222;
- str.gsub!(/ß/u,'&szlig;') # &#223;
- str.gsub!(/à/u,'&agrave;') # &#224;
- str.gsub!(/á/u,'&aacute;') # &#225;
- str.gsub!(/â/u,'&acirc;') # &#226;
- str.gsub!(/ã/u,'&atilde;') # &#227;
- str.gsub!(/ä/u,'&auml;') # &#228;
- str.gsub!(/å/u,'&aring;') # &#229;
- str.gsub!(/æ/u,'&aelig;') # &#230;
- str.gsub!(/ç/u,'&ccedil;') # &#231;
- str.gsub!(/è/u,'&egrave;') # &#232;
- str.gsub!(/é/u,'&eacute;') # &#233;
- str.gsub!(/ê/u,'&ecirc;') # &#234;
- str.gsub!(/ë/u,'&euml;') # &#235;
- str.gsub!(/ì/u,'&igrave;') # &#236;
- str.gsub!(/í/u,'&iacute;') # &#237;
- str.gsub!(/î/u,'&icirc;') # &#238;
- str.gsub!(/ï/u,'&iuml;') # &#239;
- str.gsub!(/ð/u,'&eth;') # &#240;
- str.gsub!(/ñ/u,'&ntilde;') # &#241;
- str.gsub!(/ò/u,'&ograve;') # &#242;
- str.gsub!(/ó/u,'&oacute;') # &#243;
- str.gsub!(/ô/u,'&ocirc;') # &#244;
- str.gsub!(/õ/u,'&otilde;') # &#245;
- str.gsub!(/ö/u,'&ouml;') # &#246;
- str.gsub!(/ø/u,'&oslash;') # &#248;
- str.gsub!(/ù/u,'&ugrave;') # &#250;
- str.gsub!(/ú/u,'&uacute;') # &#251;
- str.gsub!(/û/u,'&ucirc;') # &#252;
- str.gsub!(/ü/u,'&uuml;') # &#253;
- str.gsub!(/þ/u,'&thorn;') # &#254;
- str.gsub!(/ÿ/u,'&yuml;') # &#255;
- str.gsub!(/ý/u,'&yacute;')
- str
- end
- end
- class Tune
- def initialize(data,md)
- @data,@md=data,md
- @vz=SiSU_Env::Get_init.instance.skin
- @env=SiSU_Env::Info_env.new(@md.fns)
- @sys=SiSU_Env::System_call.new
- @env=SiSU_Env::Info_env.new(@md.fns)
- @brace_url=SiSU_Viz::Skin.new.url_decoration
- end
- def songsheet
- begin
- @cX=SiSU_Screen::Ansi.new(@md.cmd).cX
- SiSU_Screen::Ansi.new(@md.cmd,'Tune').txt_grey if @md.cmd =~/[MVv]/
- data=Tune.new(@data,@md).endnotes_html
- data=Tune.new(data,@md).url_markup
- data=Tune.new(data,@md).markup
- if @md.cmd =~/M/ #Hard Output Tune Optional on/off here
- data=Output.new(data,@md).hard_output
- Output.new(data,@md).marshal
- end
- tuned=Tune.new(@data,@md).output
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error
- ensure
- end
- end
- def para_numbers
- data=@data
- @tuned_file=[]
- data.each do |dob|
- dob.gsub!(/#{Mx[:lv_o]}\d:(\S?)#{Mx[:lv_c]}/,'\0<a name="H#\1">#\1.</a>&nbsp;') #fix Mx[:lv_o]
- @tuned_file << dob
- end
- end
- def markup
- @tuned_file=[]
- @data.each do |dob|
- dob.obj.gsub!(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;')
- dob.obj.gsub!(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;')
- dob.obj.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />') unless dob.is=='table'
- dob.obj.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>')
- dob.obj.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>')
- dob.obj.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>')
- dob.obj.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>')
- dob.obj.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>')
- dob.obj.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'<ins>\1</ins>')
- dob.obj.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>')
- dob.obj.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>')
- dob.obj.gsub!(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>') # tt, kbd
- dob.obj.gsub!(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'<a name="\1"></a>')
- dob.obj.gsub!(/^#{Mx[:gl_bullet]}/m,'●&nbsp;&nbsp;')
- dob.obj.gsub!(/#{Mx[:nbsp]}/,'&nbsp;')
- dob.obj.gsub!(/<(p|br)>/,'<\1 />')
- dob=SiSU_HTML_Tune::Clean_html.new(dob).clean
- @tuned_file << dob
- end
- end
- def urls(data)
- @words=[]
- data.each do |word|
- @words << if word=~/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/
- http_=true
- if word =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/
- m,u=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/.match(word).captures
- elsif word =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}:\S+?#{Mx[:rel_c]}/
- #http_=false
- m,u=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}:(\S+?)#{Mx[:rel_c]}/.match(word).captures
- u='../' + u
- elsif word =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/
- http_=false
- m,u=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}(\S+?)#{Mx[:rel_c]}/.match(word).captures
- elsif word =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}image/
- m,u=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}(image)/.match(word).captures
- end
- case m
- when /\.png|\.jpg|\.gif|c=|\s\d+x\d+/
- w,h=/\s(\d+)x(\d+)/.match(m).captures if m =~/\s\d+x\d+/
- w=%{width="#{w}"} if w
- h=%{height="#{h}"} if h
- c=m[/"(.+?)"/m,1]
- caption=%{<br /><p class="caption">#{c}</p>} if c
- png=m.scan(/\S+/)[0]
- image_path=if @md.fns =~/\.-ss[tm]$/; @env.url.images_external
- else @env.url.images_local
- end
- ins=if u \
- and u.strip !~/^image$/
- %{<a href="#{u}"><img src="#{image_path}/#{png}" #{w} #{h} naturalsizeflag="0" align="bottom" border="0"></a>#{caption}}
- else %{<img src="#{image_path}/#{png}" #{w} #{h} naturalsizeflag="0" align="bottom" border="0">#{caption}}
- end
- word.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/,ins)
- else
- link=m[/(.+)/m]
- png=m.scan(/\S+/)[0].strip
- link=link.strip
- u.gsub!(/(\S+)/,"#{Xx[:segment]}#\\1") if u !~/\// unless http_ #marker: in scroll remove; in seg replace
- ins=%{<a href="#{u}">#{link}</a>}
- word.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,ins)
- word.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/,ins)
- end
- word
- else word
- end
- word
- end
- @words=@words.join(' ')
- end
- def url_markup
- data=@data
- @tuned_file=[]
- data.each do |dob|
- unless dob.is=='code'
- if dob.obj =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/
- @word_mode=dob.obj.scan(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)[()\[\]]*[,.;:!?'"]{0,2}|(?:#{Mx[:gl_o]}\S+?#{Mx[:gl_c]})+|[^#{Mx[:lnk_o]}#{Mx[:lnk_c]}]+/mu)
- words=urls(@word_mode)
- dob.obj.gsub!(/.+/m,words)
- end #consider change, do a while loop
- dob.obj.gsub!(/\\copyright/i,%{<sup>&copy;</sup>})
- if (dob.obj !~/\<:ad\s+\.\.\//)
- dob.obj.gsub!(/\<:ad\s+(\S+)?\s+(\S+\.png)\s+(.+)?\;\s+(.+)?\;\s*!\>/,
- %{\n<center><a href="http:\/\/\\1" target="external"><img src="#{@env.url.images_local}/\\2" alt="\\3"></a></center>\n})
- else
- dob.obj.gsub!(/\<:ad\s+(\S+)?\s+(\S+\.png)\s+(.+)?\;\s+(.+)?\;\s*\>/,
- %{\n<center><a href="\\1" target="_top"><img src="#{@env.url.images_local}/\\2" alt="\\3"></a></center>\n})
- end
- dob.obj.gsub!(/!pick/,%{<img border="0" height="15" width="15" src="#{@env.url.images}/#{@vz.icon_choice}" alt="stellar">})
- dob.obj.gsub!(/!new/,%{&nbsp;<img border="0" height="15" width="15" src="#{@env.url.images}/#{@vz.icon_new}" alt="new">})
- dob.obj.gsub!(/<:h(.{1,7}?)>/,'<a href="#h\1">\1</a>')
- dob.obj.gsub!(/<:to(\d{1,7}?)>/,'<a href="#to\1">to&nbsp;{&nbsp;\1&nbsp;}</a> ')
- dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'<a href="\1" target="_top">\1</a>') #http ftp matches escaped, no decoration
- dob.obj.gsub!(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}<a href="mailto:\\1">\\1</a>#{@brace_url.xml_close}})
- dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}<a href="\\1" target="_top">\\1</a>#{@brace_url.xml_close}}) #http ftp matches with decoration
- if dob.obj =~/..\/\S+/ \
- and dob.obj !~/(\"..\/\S+?\"|>\s*..\/\S+<)/
- dob.obj.gsub!(/(\.\.\/\S+)/,'<a href="\1">\1</a>')
- end
- dob.obj.gsub!(/<a href=":/,%{<a href="#{@vz.url_site}/})
- dob.obj.gsub!(/<a href="\.\.\//,%{<a href="#{@vz.url_site}/})
- else
- dob.obj.gsub!(/(^|[^}])_</m,'\1&lt;'); dob.obj.gsub!(/(^|[^}])_>/m,'\1&gt;') #code-block: angle brackets special characters
- dob.obj.gsub!(/(^|[^}])_</m,'\1&lt;'); dob.obj.gsub!(/(^|[^}])_>/m,'\1&gt;')
- end
- @tuned_file << dob
- end
- end
- def endnotes_html
- data=@data
- @tuned_file=[]
- data.each do |dob|
- unless dob.is =~/^code/
- dob.obj.gsub!(/(#{Mx[:en_a_o]}|#{Mx[:en_b_o]})(\d+)\s+(.+?)(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/,
- '&nbsp;<a name="-\2" href="#_\2">&nbsp;<sup>\2</sup>&nbsp;</a> ' + #note- endnote-
- '\1\2 <a name="_\2" href="#-\2">&nbsp;<sup>\2.</sup></a> \3 \4') #endnote- note- (careful may have switched)
- dob.obj.gsub!(/(#{Mx[:en_b_o]})([*+]\d+)\s+(.+?)(#{Mx[:en_b_c]})/,
- '&nbsp;<a name="-\2" href="#_\2">&nbsp;<sup>\2</sup>&nbsp;</a> ' + #note- endnote-
- '\1\2 <a name="_\2" href="#-\2">&nbsp;<sup>\2.</sup></a> \3 \4') #endnote- note- (careful may have switched)
- dob.obj.gsub!(/(#{Mx[:en_a_o]})([*+]+)\s+(.+?)(#{Mx[:en_a_c]})/,
- '&nbsp;<a name="-\2" href="#_\2">&nbsp;<sup>\2</sup>&nbsp;</a> ' + #note- endnote-
- '\1\2 <a name="_\2" href="#-\2">&nbsp;<sup>\2</sup></a> \3 \4') #endnote- note- (careful may have switched)
- end
- @tuned_file << dob
- end
- end
- def output
- data=@data
- @tuned_file=[]
- data.each do |dob|
- dob.obj.strip!
- dob.obj.chomp!
- @tuned_file << dob
- end
- @tuned_file << "\n<EOF>" if (@md.fns =~/\.sst0/) #remove
- @tuned_file
- end
- end
-end
-__END__
diff --git a/lib/sisu/v2/hub.rb b/lib/sisu/v2/hub.rb
deleted file mode 100644
index 9c4fb714..00000000
--- a/lib/sisu/v2/hub.rb
+++ /dev/null
@@ -1,580 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: SiSU information Structuring Universe, text structuring,
- processing, publishing, search
-
-=end
-module SiSU
- require "#{SiSU_lib}/constants" # constants.rb
- require "#{SiSU_lib}/sysenv" # sysenv.rb
- include SiSU_Screen
- @@pwd=Dir.pwd
- class Op
- @@env=SiSU_Env::Info_env.new
- def initialize(opt,req,message)
- @opt,@req,@message=opt,req,message
- @n_do=0
- end
- def pod_output(fns_pod)
- dir_pwd=@@env.path.pwd
- dir_pod=@@env.sisupod_gen(fns_pod)
- Dir.chdir(dir_pod)
- content=Dir.glob("*.ss[mt]").join(' ')
- if content =~/\.ss[mt]/
- Dir.chdir(dir_pwd)
- @opt.fns=content #check
- system("cd #{dir_pod}
- sisu -CC #{@opt.cmd} #{@opt.mod.join(' ')} #{content}
- cd -
- ")
- end
- @pwd=`pwd`.strip
- Dir.chdir(@pwd)
- end
- def select
- require "#{SiSU_lib}/#{@req}"
- if @req =~/^conf$/ # -C
- SiSU_Initialize::Source.new(@opt).read
- end
- if not @opt.files.empty?
- @opt.files.each do |fns|
- env=SiSU_Env::Info_env.new(fns)
- if fns =~ /sisupod(?:\.zip)?|\S+?(?:\.ss[mt]\.zip|\.ssp)$/
- require "#{SiSU_lib}/remote" # remote.rb #check
- pod_name=SiSU_Remote::Remote_download.new(fns).pod.name
- SiSU_Screen::Ansi.new(@opt.cmd,pod_name).puts_blue unless @opt.cmd =~/q/
- @opt.files.shift
- pod_output(pod_name)
- break
- else
- put=fns.gsub(/(.+)?\.ssm\.sst$/,'\1.ssm')
- @opt.fns=fns
- if @req !~/(?:urls|remote)$/
- if @req=~/^dal$/ \
- and FileTest.file?(@opt.fns) \
- and @opt.fns =~ /\.(?:(?:-|ssm\.)?sst|ssm)$/
- if fns =~ /\.ssm$/
- require "#{SiSU_lib}/composite" # composite.rb #pre-processing
- SiSU_Assemble::Composite.new(@opt).read
- @opt.fns=fns.gsub(/\.ssm$/,'.ssm.sst')
- end
- SiSU_DAL::Source.new(@opt).read # -m
- elsif FileTest.file?(env.source_file_with_path)
- case @opt.fns
- when /\.(?:(?:-|ssm\.)?sst|ssm)$/
- case @req
- when /^dal$/
- if fns =~ /\.ssm$/
- require "#{SiSU_lib}/composite" # composite.rb #pre-processing
- SiSU_Assemble::Composite.new(@opt).read
- @opt.fns=fns.gsub(/\.ssm$/,'.ssm.sst')
- end
- SiSU_DAL::Source.new(@opt).read # -m
- when /^git$/; SiSU_Git::Source.new(@opt).read # -g
- when /^concordance$/; SiSU_Concordance::Source.new(@opt).read # -w
- when /^share_src$/; SiSU_Markup::Source.new(@opt).read # -s
- when /^sisupod_make$/; SiSU_Doc::Source.new(@opt).read # -S
- when /^source_kdissert$/; SiSU_Kdi_source::Source.new(@opt).read ## -S
- when /^digests$/; SiSU_Digest_view::Source.new(@opt).read # -N
- when /^xml_scaffold$/; SiSU_XML_scaffold::Source.new(@opt).read # -k
- when /^plaintext$/; SiSU_Plaintext::Source.new(@opt).read # -t -a
- #when /^wikispeak$/; SiSU_Wikispeak::Source.new(@opt).read # -g
- when /^epub$/; SiSU_EPUB::Source.new(@opt).read # -e
- when /^odf$/; SiSU_ODF::Source.new(@opt).read # -o
- when /^xml_md_oai_pmh_dc$/; SiSU_XML_metadata::OAI_PMH.new(@opt).read # -O
- when /^texpdf$/; SiSU_TeX::Source.new(@opt).read # -p
- when /^manpage$/; SiSU_Manpage::Source.new(@opt).read # -i
- when /^texinfo$/; SiSU_TexInfo::Source.new(@opt).read # -I
- when /^html$/; SiSU_HTML::Source.new(@opt).read # -h -H
- when /^xml$/; SiSU_XML_SAX::Source.new(@opt).read # -x
- when /^xml_dom$/; SiSU_XML_DOM::Source.new(@opt).read # -X
- when /^xml_fictionbook$/; SiSU_XML_Fictionbook::Source.new(@opt).read # -f
- when /^xhtml$/; SiSU_XHTML::Source.new(@opt).read # -b
- when /^embedded$/; SiSU_Embedded::Source.new(@opt).read # -m (image and other content)
- when /^manifest$/; SiSU_Manifest::Source.new(@opt).read # -y
- when /^sitemaps$/; SiSU_Sitemaps::Source.new(@opt).read # -Y
- when /^zap$/; SiSU_Zap::Source.new(@opt).read # -Z
- when /^dbi$/; SiSU_DBI::SiSU_SQL.new(@opt).connect # -D -d
- end
- @n_do=@n_do+1
- SiSU_Screen::Ansi.new(@opt.cmd,@n_do,"#{@req.upcase} processed").files_processed if @opt.cmd =~/[MVv]/
- ObjectSpace.garbage_collect
- else #print "not processed --> ", fns, "\n"
- end
- else
- if @req !~/^conf$/ \
- and @opt.fns !~/http:\/\//
- Operations.new(@opt).not_found
- end
- end
- elsif FileTest.file?(put)
- if @opt.mod.inspect !~/harvest/ #decide whether should permit harvest in single operation
- case @req
- when /^urls$/; SiSU_urls::Source.new(@opt).read # -u -v -V -M
- when /^remote$/
- case @message
- when /scp/; SiSU_Remote::Put.new(@opt).scp # -r
- when /rsync/; SiSU_Remote::Put.new(@opt).rsync # -R
- else #SiSU_Remote::Put.new(put,@opt.cmd).scp
- end
- end
- @n_do=@n_do+1
- SiSU_Screen::Ansi.new(@opt.cmd,@n_do,"#{@req.upcase} processed").files_processed if @opt.cmd =~/[MVv]/
- end
- else Operations.new(@opt).not_found
- end
- end
- end
- elsif @req =~/^dbi$/; SiSU_DBI::SiSU_SQL.new(@opt).connect # -D -d
- elsif @req=~/^sisupod_make$/; SiSU_Doc::Source.new(@opt).read # -S
- end
- Operations.new.counter
- end
- end
- class Operations
- @@n_do=0
- def initialize(opt='')
- @opt=opt
- @cX=SiSU_Screen::Ansi.new(@opt).cX
- end
- def counter
- @@n_do=0
- end
- def remote_put_base_site_rsync # -CR
-p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
- require "#{SiSU_lib}/remote" # remote.rb
- SiSU_Remote::Put.new(@opt).rsync_base
- end
- def remote_put_base_site_rsync_match # -CCRZ
-p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
- require "#{SiSU_lib}/remote" # remote.rb
- SiSU_Remote::Put.new(@opt).rsync_base_sync
- end
- def remote_put_base_site # -Cr
-p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
- require "#{SiSU_lib}/remote" # remote.rb
- SiSU_Remote::Put.new(@opt).scp_base
- end
- def remote_put_base_site_all # -CCr
-p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
- require "#{SiSU_lib}/remote" # remote.rb
- SiSU_Remote::Put.new(@opt).scp_base_all
- end
- def cgi # -F
- require "#{SiSU_lib}/cgi" # cgi.rb
- SiSU_CGI::SiSU_search.new(@opt).read
- end
- def encoding # -K build character encoding db (uses KirbyBase)
- require "#{SiSU_lib}/character_encoding" # character_encoding.rb
- SiSU_character_encode::Create.new.db
- end
- def termsheet # -t
- system("sisu_termsheet #{@opt.cmd} #{@opt.fns}\n")
- @@n_do=@@n_do+1
- SiSU_Screen::Ansi.new(@opt.cmd,@@n_do,'Termsheet(s) processed').term_sheet_title unless @opt.cmd =~/q/
- end
- def webrick # -W
- port=prt=@fns
- prt=if prt !~/\d+/
- 'webrick default (sysenv)'
- else "webrick port set to #{prt}"
- end
- puts %{#{@cX.blue}<<#{@cX.off}#{@cX.green}Start Webrick web server on port: #{prt}#{@cX.off}#{@cX.blue}>> #{@cX.off*2} }
- system("sisu_webrick #{port}&\n")
- end
- def not_found
- puts "\n#{@cX.fuschia}FILE NOT FOUND:#{@cX.off} << #{@opt.fns} >> - requested #{@opt.cmd} processing skipped\n"
- end
- def convert_name_message(fns,type,i,o,rune)
- %{\nIn filename: "#{@cX.fuschia}#{fns}#{@cX.off}" << #{type} >> #{@cX.fuschia}is apre 0.36 markup filename.#{@cX.off} #{@cX.brown}Please rename your file.#{@cX.off}\n\tAs of sisu-0.37, SiSU markup files with #{@cX.brown}the extensions #{i} should be re-named #{o}#{@cX.off}\n\tif you have the program called 'rename' installed, the following rune should do the trick:\n\t\t#{rune}\n\talternatively try:\n\t\tsisu --convert --36to37 #{fns}\n\trequested #{@opt.cmd} processing skipped\n}
- end
- def not_recognised
- case @opt.fns
- when /(\.s[123])$/
- type=@opt.fns.gsub(/\S+?(#{$1})/,'\1')
- rune=%q{rename 's/\.s[123]$/\.sst/' *.s{1,2,3}}
- puts convert_name_message(@opt.fns,type,'.s1 .s2 and .s3','.sst',rune)
- when /(\.r[123])$/
- type=@opt.fns.gsub(/\S+?(#{$1})/,'\1')
- rune=%q{rename 's/\.r[123]$/\.ssm/' *.r{1,2,3}}
- puts convert_name_message(@opt.fns,type,'.r1 .r2 and .r3','.sst',rune)
- puts %{\n\tNote also that you will need to change the names of the files called/required\n\twithin the document text to build the composite document\n\t\t.s1 .s2 .s3 should be .sst \n\t\t.si should be .ssi\n\trequested #{@opt.cmd} processing skipped\n}
- when /(\.ssi)$/
- puts "\n#{@cX.fuschia}component filetype:#{@cX.off} << #{@opt.fns} >> - is not a processed filetype, (it may be used as a component of a .ssm markup file)\n\trequested #{@opt.cmd} processing skipped\n"
- else
- puts "\n#{@cX.fuschia}FILETYPE NOT RECOGNISED:#{@cX.off} << #{@opt.fns} >> - is not a recognized filetype,\n\trequested #{@opt.cmd} processing skipped\n"
- end
- end
- end
- class Processing
- require 'fileutils'
- include FileUtils
- @@env=SiSU_Env::Info_env.new
- attr_accessor :op
- def initialize(opt)
- @opt=opt
- @msg,@msgs='',nil
- @tell=lambda { SiSU_Screen::Ansi.new(@opt.cmd,@msg,"#{@msgs.inspect if @msgs}") }
- end
- def op(req,msg)
- Op.new(@opt,req,msg).select if req and msg
- end
- def actions
- if @opt.cmd =~/P/
- require 'profile'
- end
- if @opt.mod.inspect =~/--harvest/
- require "#{SiSU_lib}/harvest" # harvest.rb
- end
- if @opt.mod.inspect =~/--convert|--to|--from/
- require "#{SiSU_lib}/sst_convert_markup" # sst_convert_markup.rb
- end
- if @opt.cmd =~/([AabCcDdeFfgGHhIiJjkLMmNnOopQqrRSsTtUuVvwWXxYyZ_0-9])/ \
- and @opt.cmd =~/^-/ \
- and @opt.mod.inspect !~/--(?:sitemaps|query|identify)/ \
- or @opt.mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/ #and
- @@tell=SiSU_Screen::Ansi.new(@opt.cmd)
- @cX=SiSU_Screen::Ansi.new(@opt.cmd).cX
- flag=SiSU_Env::Info_processing_flag.new
- extra=''
- if @opt.cmd !~/[mn]/
- extra+=if @opt.cmd =~/[abegHhIiNOopTtwXxyz]/ \
- and @opt.cmd !~/[mn]/
- 'm' #% add dal
- elsif ((@opt.cmd =~/[Dd]/ \
- or (@opt.mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/)) \
- and @opt.mod.inspect !~/(?:remove|(?:(?:re)?create(?:all)?|dropall|drop)$)/) \
- and @opt.cmd !~/[mn]/
- 'm' #% add dal
- else ''
- end
- end
- if @opt.cmd !~/y/
- extra+=if @opt.cmd =~/[abeHhIiNopsSstwXxz]/ \
- and @opt.cmd !~/y/
- 'ym' #% add manifest
- elsif (@opt.cmd =~/[Dd]/ \
- or @opt.mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/) \
- and @opt.files[0] !~/^remove$/ \
- and @opt.cmd !~/y/
- 'ym' #% add manifest
- else ''
- end
- end
- @opt.cmd=@opt.cmd + extra
- opt=@opt.cmd.scan(/CC|\S/)
- @opt.cmd=opt.uniq.join
- if @opt.cmd =~/[vVM]/ #% version information
- if @opt.cmd =~/V/ \
- and @opt.files.empty? #% environment
- SiSU_Help::Help.new('env',@opt).environment
- else SiSU_Help::Help.new('env',@opt).sisu_version
- end
- end
- if @opt.cmd =~/^-L$/ #% version information
- SiSU_Help::Help.new('license',@opt).help_request
- end
- if @opt.cmd =~/m/i #% -m for -C
- path={}
- path[:css]=@@env.path.output + '/_sisu/css'
- path[:xml]=@@env.path.output + '/_sisu/xml'
- path[:xsd]=path[:xml] + '/xsd'
- path[:xsd]=path[:xml] + '/rnc'
- path[:xsd]=path[:xml] + '/rng'
- re_p=/(sisupod(?:\.zip)?|\S+?\.ss[mt]\.zip|[^\/]+?\.ssp)$/
- unless @opt.files.join(',') =~ re_p #do not mix pods with source markup files in command line
- unless ( FileTest.directory?(path[:css]) \
- and FileTest.directory?(path[:xsd]) )
- @opt.cmd=@opt.cmd +='C' unless @opt.cmd =~/C/ #FIX
- end
- if @opt.cmd =~/M/
- $VERBOSE=false #debug $VERBOSE=true
- end
- end
- end
- if @opt.cmd =~/C/ #% -C initialize/configure
- op('conf','configure site')
- if @opt.cmd =~/R/
- if @opt.mod.inspect =~/--init(?:ialize)?=site/ \
- and @opt.cmd =~/RZ/
- Operations.new(@opt).remote_put_base_site_rsync_match
- else Operations.new(@opt).remote_put_base_site_rsync
- end
- elsif @opt.cmd =~/r/
- if @opt.mod.inspect =~/--init(?:ialize)?=site/ \
- and @opt.cmd =~/CCr/
- Operations.new(@opt).remote_put_base_site_all
- else Operations.new(@opt).remote_put_base_site
- end
- end
- end
- if @opt.cmd =~/F/ #% -F cgi sample search form
- Operations.new(@opt).cgi
- end
- if @opt.cmd =~/W/ #% -W webrick #@argv==port
- Operations.new(@opt).webrick
- end
- if @opt.cmd =~/Z/ #% -Z wipe previous output clean
- op('zap','Zap, deletions')
- end
- if @opt.cmd =~/s/ #% -s sisu source
- op('share_src','SiSU markup source')
- end
- if @opt.cmd =~/g/ #% -g sisu git
- op('git','SiSU Git')
- end
- if @opt.cmd =~/m/ #% -m is remote url requested? (download if)
- @retry_count= -1
- begin
- path_image='./_sisu/processing/external_document/image'
- path_skin='./_sisu/processing/external_document/skin/doc'
- @get_s,@get_p=[],[]
- re_s=/((?:https?|file):\/\/\S+?\.sst)$/
- re_p=/((?:https?|file):\/\/\S+?(?:\/\S+?\.ss[mt]\.zip|sisupod(?:\.zip)?|\.ssp))/
- @opt.files.each do |fns|
- if fns =~re_s
- @get_s << re_s.match(fns)[1] if re_s
- end
- if fns =~re_p
- @get_p << re_p.match(fns)[1] if re_p
- end
- end
- if @get_s.length > 0 #% remote markup file .sst
- require "#{SiSU_lib}/remote" # remote.rb
- SiSU_Remote::Get.new(@opt,@get_s).fns
- Operations.new.counter
- end
- if @get_p.length > 0 #% remote sisupod
- require "#{SiSU_lib}/remote" # remote.rb
- SiSU_Remote::Get.new(@opt,@get_p).sisupod
- end
- rescue
- SiSU_Errors::Info_error.new($!,$@,@opt,@fns).error #ok
- @retry_count +=1
- retry unless @retry_count > 1
- ensure
- end
- @opt.files=@opt.files.collect {|x| x=x.gsub(/(?:https?|file):\/\/\S+\/(\S+)\.sst$/,'\1.-sst') }
- end
- if @opt.cmd=~/m/ #% -m dal
- op('dal','dal')
- end
- @opt.files=@opt.files.collect {|x| x=x.gsub(/\.ssm$/,'.ssm.sst') }
- if @opt.cmd =~/S/
- op('sisupod_make','sisupod (zip)') #% -S make sisupod
- if @opt.fns=~/\.kdi._sst/
- op('share_src_kdissert','kdissert (kdi)') #% -S share kdissert source
- end
- end
- if @opt.cmd =~/N/; op('digests','digests') #% -N digest tree
- end
- if @opt.cmd =~/[hHz]/; op('html','html') #% -h -H -z html css
- end
- if @opt.cmd =~/[at]/; op('plaintext','plaintext') #% -t -a #-A -f -e -E plaintext -a creates ms-dos type; -A creates unix type, plaintext file
- end
- #if @opt.cmd =~/g/; op('git','git') #% -g git
- #end
- #if @opt.cmd =~/g/; op('wikispeak','wikispeak') #% -g wiki
- #end
- if @opt.cmd =~/e/; op('epub','ePub') #% -e epub
- end
- if @opt.cmd =~/o/; op('odf','OpenDocument') #% -o opendocument
- end
- if @opt.cmd =~/x/; op('xml','xml sax') #% -x xml sax type
- end
- if @opt.cmd =~/X/; op('xml_dom','xml dom') #% -X xml dom type
- end
- if @opt.cmd =~/f/; op('xml_fictionbook','xml fictionbook') #% -f xml fictionbook
- end
- if @opt.cmd =~/b/; op('xhtml','xhtml sax') #% -b xhtml sax type
- end
- if @opt.cmd =~/w/; op('concordance','Concordance') #% -w concordance
- end
- if @opt.cmd =~/O/; op('xml_md_oai_pmh_dc','OAI PMH') #% -O open archive initiative, metadata harvesting
- end
- if @opt.cmd =~/T/ #% -T termsheet/standard form
- SiSU_Help::Help.new('termsheet').help_request
- @opt.files.each do |fns|
- if FileTest.file?(fns)
- @opt.fns=fns
- case @opt.fns
- when /\.(termsheet.rb)$/; Operations.new(@opt).termsheet
- else #print "not processed --> ", fns, "\n"
- end
- else Operations.new(@opt).not_found
- end
- end
- Operations.new.counter
- end
- if @opt.cmd =~/k/; op('xml_scaffold','XML scaffold') #% -T temporary tests
- end
- if @opt.cmd =~/p/; op('texpdf','LaTeX pdf') #% -p latex/ texpdf
- end
- if @opt.cmd =~/i/; op('manpage','manpage') #% -i manpage
- end
- if @opt.cmd =~/I/; op('texinfo','TeX Info') #% -I texinfo (i taken by db import)
- end
- if @opt.cmd =~/D/ \
- or @opt.mod.inspect =~/--pgsql/; op('dbi','postgresql') #% -D DB postgresql
- end
- if @opt.cmd =~/d/ \
- or @opt.mod.inspect =~/--sqlite/; op('dbi','sqlite') #% -d DB sqlite
- end
- if @opt.cmd =~/G/; Operations.new(@opt).cgi #% -G cgi - used to make dbi intecface
- end
- if @opt.cmd=~/m/; op('embedded','Embedded Content') #% -m embedded content
- end
- if @opt.cmd =~/y/; op('manifest','Manifest') #% -y manifest
- end
- if @opt.cmd =~/Y/; op('sitemaps','Sitemap') #% -Y sitemap
- end
- if @opt.mod.inspect !~/--harvest/
- if @opt.cmd =~/r/; op('remote','scp') #% -r copy to remote server
- end
- if @opt.cmd =~/R/; op('remote','rsync') #% -R copy to remote server
- end
- else
- end
- op('urls','urls')
- @msg,@msgs="\tsisu -W [to start ruby web-server on output directory]\n",nil unless @opt.cmd =~/q/
- @tell.call.print_brown if @opt.cmd =~/[uUvVM]/ unless @opt.files.join.empty?
- if defined? @@env.path.processing \
- and @@env.user \
- and FileTest.directory?(@@env.path.processing) \
- and @@env.path.processing =~/#{@@env.user}$/ #clean temporary processing directory of content as is located in public area
- cd(@@env.path.processing_base_tmp) do
- rm_rf(@@env.user) unless @opt.cmd =~/M/
- end end
- elsif @opt.mod.inspect =~/--query/
- require "#{SiSU_lib}/sst_identify_markup" # sst_identify_markup.rb
- puts SiSU_Markup::Markup_history.new(@opt).query
- elsif @opt.mod.inspect =~/--identify/
- require "#{SiSU_lib}/sst_identify_markup" # sst_identify_markup.rb
- markup_version=SiSU_Markup::Markup_identify.new(@opt).markup_version?
- elsif @opt.mod.inspect =~/--about/ #% help instructions
- if @opt.mod.inspect =~/--about/ \
- and not @opt.what.empty?
- SiSU_Help::Help.new(@opt.what,'color_off').help_request
- else SiSU_Help::Help.new('list','color_off').help_request
- end
- elsif @opt.mod.inspect =~/--sitemaps/ #% sitemaps
- require "#{SiSU_lib}/sitemaps" # sitemaps.rb
- SiSU_Sitemaps::Source.new(@opt).read
- if @opt.cmd =~/R/
- require "#{SiSU_lib}/remote" # remote.rb
- SiSU_Remote::Put.new(@opt).rsync_sitemaps
- end
- else #% help instructions
- unless @opt.mod.inspect =~/--convert|--to|--from|--harvest/
- if @opt.mod.inspect =~/--help/ \
- and not @opt.what.empty?
- SiSU_Help::Help.new(@opt.what).help_request
- elsif @opt.mod.inspect =~/--help/; SiSU_Help::Help.new('list').help_request
- else SiSU_Help::Help.new('env',@opt).sisu_version
- tell=SiSU_Screen::Ansi.new(''," for HELP type:\n\tsisu --help [help request]\n\tman sisu\n or see the system or online documentation on SiSU:\n #{Config::CONFIG['datadir']}/doc/sisu/\n <http://www.jus.uio.no/sisu/>\n <http://sisudoc.org/>"); tell.puts_grey
- end
- end
- end
- @opt.files.each do |fns|
- if FileTest.file?(fns)
- @opt.fns=fns
- unless @opt.fns =~ /(?:\.(?:(?:-|ssm\.)?sst|ssm|ssp|sx[sdn]\.xml|termsheet.rb)|\S+?\.ss[mt]\.zip|sisupod(?:\.zip)?|\S+?\.ssp)$/
- if @opt.fns=~/\.kdi$/ \
- and @opt.mod.inspect =~/--(?:convert(?:-from)?|from)[=-]kdi/
- elsif @opt.fns=~/\.sx[sdn]\.xml$/ \
- and @opt.mod.inspect =~/--(?:(?:convert(?:-from)?|from)[=-])?(?:xml2sst|sxml)/
- elsif @opt.fns=~/\.ssi$/ \
- and @opt.mod.inspect =~/--identify/
- else Operations.new(@opt).not_recognised
- end
- end
- if @opt.fns =~/\.ssm\.sst$/ \
- and @opt.cmd !~/[S_M]/ # rework necessry, revist, the _ flag is a hack, to keep ._sst files
- @msg,@msgs='temporary file removed',nil
- @tell.call.warn unless @opt.cmd =~/V/
- File.unlink(@opt.fns) if File.exist?(@opt.fns) #CONSIDER
- end
- else #Operations.new(fns,'html').not_found
- end
- end
- end
- end
- begin #% select what to do
- if RUBY_VERSION < '1.9'
- require 'jcode'
- $KCODE='UTF8'
- end
- require "#{SiSU_lib}/constants" # constants.rb
- require "#{SiSU_lib}/options" # options.rb
- require "#{SiSU_lib}/sysenv" # sysenv.rb
- include SiSU_Env; include SiSU_Screen
- require "#{SiSU_lib}/param" # param.rb
- include SiSU_Param
- require "#{SiSU_lib}/defaults" # defaults.rb
- include SiSU_Viz
- require "#{SiSU_lib}/help" # help.rb
- include SiSU_Help
- require 'uri'
- home=ENV['HOME']
- argv=$*
- @opt=SiSU_commandline::Options.new(argv)
- Processing.new(@opt).actions
- rescue; STDERR.puts SiSU_Screen::Ansi.new(@opt,$!,$@,nil).rescue #fix
- ensure
- Dir.chdir(@@pwd)
- end
-end
-__END__
diff --git a/lib/sisu/v2/manifest.rb b/lib/sisu/v2/manifest.rb
deleted file mode 100644
index 82756e67..00000000
--- a/lib/sisu/v2/manifest.rb
+++ /dev/null
@@ -1,713 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: summary of generated outputs and metadata
-
-=end
-module SiSU_Manifest
- require "#{SiSU_lib}/sysenv" # sysenv.rb
- include SiSU_Env
- require "#{SiSU_lib}/i18n" # i18n.rb
- require "#{SiSU_lib}/particulars" # particulars.rb
- include SiSU_Particulars
- require "#{SiSU_lib}/html_minitoc" # html_minitoc.rb
- require "#{SiSU_lib}/html" # html.rb
- include SiSU_HTML_Format
- require "#{SiSU_lib}/param" # param.rb
- include SiSU_Param
- include SiSU_Viz
- class Source
- def initialize(opt)
- @opt=opt
- @particulars=SiSU_Particulars::Combined_singleton.instance.get_all(opt)
- l=SiSU_Env::Standardise_language.new.file_to_language(@opt.fns)
- @doc_language=l[:l]
- end
- def read
- begin
- @env=SiSU_Env::Info_env.new(@opt.fns)
- @md=SiSU_Param::Parameters.new(@opt).get
- SiSU_Env::Info_skin.new(@md).select
- xbrowser=@env.program.web_browser
- browser=@env.program.console_web_browser
- webserv_url=@env.path.url.output_tell
- unless @opt.cmd =~/q/
- url_html="#{webserv_url}/#{@md.fnb}/#{@md.fn[:manifest]}"
- @opt.cmd=~/[MVvz]/ \
- ? SiSU_Screen::Ansi.new(@opt.cmd,'Manifest',"#{xbrowser} #{url_html}").green_hi_blue \
- : SiSU_Screen::Ansi.new(@opt.cmd,'Manifest',@opt.fns).green_title_hi
- SiSU_Screen::Ansi.new(@opt.cmd,"#{browser} #{url_html}").grey_tab if @opt.cmd =~/v/i
- end
- data=SiSU_HTML::Source::Html_environment.new(@particulars).tuned_file_instructions
- Output_Info.new(@md).check_output(data)
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- end
- end
- private
- class Output_Info <Source
- def initialize(md)
- @manifest={ :txt=>[],:html=>[] }
- @md,@fns=md,md.fns
- @env=SiSU_Env::Info_env.new(@md.fns)
- @fnb=@md.fnb
- @base_url,@base_url_src,@base_url_pod,@base_url_epub="#{@env.url.root}/#{@fnb}",@env.url.src_txt,@env.url.src_pod,@env.url.epub
- @base_path,@base_path_src,@base_path_pod,@base_path_epub="#{@env.path.output}/#{@fnb}",@env.path.output_src,@env.path.output_pod,@env.path.output_epub
- @@dg ||=SiSU_Env::Info_env.new.digest.type
- @dg=@@dg
- l=SiSU_Env::Standardise_language.new.file_to_language(@md.fns)
- @language=l[:l]
- @translate=SiSU_Translate::Source.new(@md,@language)
- @brace_url=SiSU_Viz::Skin.new.url_decoration
- end
- def output
- SiSU_Env::SiSU_file.new(@md).mkdir
- manifest=SiSU_Env::SiSU_file.new(@md,@md.fn[:manifest]).mkfile
- @manifest[:html].each do |x|
- manifest << x
- end
- end
- def summarize(id,file,img='● ')
- size=(File.size("#{@base_path}/#{file}")/1024.00).to_s
- kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1]
- @manifest[:txt] << "#{file} #{id} #{kb}\n"
- @manifest[:html] << %{<tr><th class="left"><p class="norm"><a href="#{file}">#{img}#{id}</a></p></th><td><p class="small"><a href="#{file}">#{file}</a></p><p class="tiny">#{@brace_url.xml_open}<a href="#{@base_url}/#{file}">#{@base_url}/#{file}</a>#{@brace_url.xml_close}</p></td><td class="right"><p class="right">#{kb}</p></td></tr>\n}
- end
- def summarize_epub(id,file,img='● ')
- size=(File.size("#{@base_path_epub}/#{file}")/1024.00).to_s
- kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1]
- @manifest[:txt] << "#{file} #{id} #{kb}\n"
- @manifest[:html] << %{<tr><th class="left"><p class="norm"><a href="../epub/#{file}">#{img}#{id}</a></p></th><td><p class="small"><a href="../epub/#{file}">#{file}</a></p><p class="tiny">#{@brace_url.xml_open}<a href="#{@base_url_epub}/#{file}">#{@base_url_epub}/#{file}</a>#{@brace_url.xml_close}</p></td><td class="right"><p class="right">#{kb}</p></td></tr>\n}
- end
- def summarize_source(id,file)
- sys=SiSU_Env::System_call.new
- dgst =if @dg =~/^sha(?:2|256)$/; sys.sha256("#{@base_path_src}/#{file}")
- else sys.md5("#{@base_path_src}/#{file}")
- end
- SiSU_Screen::Ansi.new(@md.cmd,"#{dgst[1]} #{file}").warn if @md.cmd =~/[vVM]/
- size=(File.size("#{@base_path_src}/#{file}")/1024.00).to_s
- kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1]
- @manifest[:txt] << "#{file} #{id} #{kb}\n"
- @manifest[:html] << %{<tr><th class="left"><p class="norm"><a href="../src/#{file}">#{id}</a></p></th><td class="right"><p class="tiny"><a href="../src/#{file}">#{file}</a> &nbsp;&nbsp;#{dgst[1]}<br />#{@brace_url.xml_open}<a href="#{@base_url_src}/#{file}">#{@base_url_src}/#{file}</a>#{@brace_url.xml_close}</p></td><td class="right"><p class="right">#{kb}</p>
- </td></tr>\n} if kb and kb =~/\d+/
- end
- def summarize_pod(id,file)
- sys=SiSU_Env::System_call.new
- dgst =if @dg =~/^sha(?:2|256)$/; sys.sha256("#{@base_path_pod}/#{file}")
- else sys.md5("#{@base_path_pod}/#{file}")
- end
- SiSU_Screen::Ansi.new(@md.cmd,"#{dgst[1]} #{file}").warn if @md.cmd =~/[vVM]/
- size=(File.size("#{@base_path_pod}/#{file}")/1024.00).to_s
- kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1]
- @manifest[:txt] << "#{file} #{id} #{kb}\n"
- @manifest[:html] << %{<tr><th class="left"><p class="norm"><a href="../pod/#{file}">#{id}</a></p></th><td class="right"><p class="tiny"><a href="../pod/#{file}">#{file}</a> &nbsp;&nbsp;#{dgst[1]}<br />#{@brace_url.xml_open}<a href="#{@base_url_pod}/#{file}">#{@base_url_pod}/#{file}</a>#{@brace_url.xml_close}</p></td><td class="right"><p class="right">#{kb}</p>
- </td></tr>\n} if kb and kb =~/\d+/
- end
- def languages(id,file)
- flv=@env.published_manifests?(@base_path)
- @manifest[:html] << %{<tr><th class="left"><div id="horizontal_links"><ul id="horizontal">\n}
- flv.each do |l|
- lang=SiSU_Translate::Source.new(@md,@language,l[:l]).language_list
- @manifest[:txt] << "#{l[:m]} #{lang}\n"
- @manifest[:html] << %{<li class="norm"><a href="#{l[:m]}">#{lang}</a>&nbsp;&nbsp;&nbsp;</li>}
- end
- @manifest[:html] << %{</ul></div></th></tr>\n}
- end
- def published_languages(id,file)
- flv=@env.published_manifests?(@base_path)
- flv.each do |l|
- lang=SiSU_Translate::Source.new(@md,@language,l[:l]).language_list
- @manifest[:txt] << "#{l[:m]} #{lang}\n"
- @manifest[:html] << %{<tr><th class="left"><p class="bold"><a href="#{l[:m]}">#{lang}</a></p></th><td><p class="norm">#{lang}</p><p class="tiny">#{@brace_url.xml_open}<a href="#{@base_url}/#{l[:m]}">#{@base_url}/#{l[:m]}</a>#{@brace_url.xml_close}</p></td><td class="right"><p class="right">&nbsp;</p></td></tr>\n}
- end
- end
- def metadata(id,info)
- info.to_s.gsub!(/#{Mx[:br_line]}/,'<br />')
- @manifest[:html] << %{<tr><th class="left"><p class="bold_left">#{id}:</p></th><td><p class="left">#{info}</p></td></tr>\n}
- end
- def links(url,lnk,target)
- static=if url =~/^\.\//; url.gsub(/^\.(\.)?/,@base_url)
- elsif url =~/^\.\.\//; url.gsub(/^\.(\.)?/,@env.url.root)
- else url
- end
- @manifest[:html] << %{<tr><th class="right" width=5%><p class="norm">●</p></th><td class="left"><p class="norm"><a href="#{url}">#{lnk}</a></p><p class="tiny">&nbsp;&nbsp;#{@brace_url.xml_open}<a href="#{static}">#{static}</a>#{@brace_url.xml_close}</p></td></tr>\n}
- end
- def output_tests
- if FileTest.file?("#{@base_path}/#{@md.fn[:toc]}")==true
- img='<img border="0" height="18" width="15" src="../_sisu/image_sys/b_toc.png" alt="TOC linked" /> '
- id,file='HTML, table of contents (for segmented text)',@md.fn[:toc]
- summarize(id,file,img)
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:doc]}")==true
- img='<img border="0" height="15" width="15" src="../_sisu/image_sys/b_doc.png" alt="Full Text" /> '
- id,file='HTML, full length document',@md.fn[:doc]
- summarize(id,file,img)
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:book_index]}")==true
- id,file='HTML, (book type) index',@md.fn[:book_index]
- summarize(id,file)
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:concordance]}")==true
- id,file='HTML, concordance file',@md.fn[:concordance]
- summarize(id,file)
- end
- if FileTest.file?("#{@base_path_epub}/#{@md.fn[:epub]}")==true
- img='<img border="0" height="18" width="18" src="../_sisu/image_sys/b_epub.png" alt="EPUB" /> '
- id,file='EPUB (Electronic Publication, e-book standard)',@md.fn[:epub]
- summarize_epub(id,file,img)
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:pdf_p_letter]}")==true
- img='<img border="0" height="18" width="15" src="../_sisu/image_sys/b_pdf.png" alt="PDF portrait" /> '
- id,file="PDF, U.S. letter size, portrait/vertical document (recommended for printing)",@md.fn[:pdf_p_letter]
- summarize(id,file,img)
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:pdf_l_letter]}")==true
- img='<img border="0" height="15" width="18" src="../_sisu/image_sys/b_pdf.png" alt="PDF landscape" /> '
- id,file="PDF, U.S. letter size, landscape/horizontal document (recommended for screen viewing)",@md.fn[:pdf_l_letter]
- summarize(id,file,img)
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:pdf_p_a4]}")==true
- img='<img border="0" height="18" width="15" src="../_sisu/image_sys/b_pdf.png" alt="PDF portrait" /> '
- id,file="PDF, A4 size, portrait/vertical document (recommended for printing)",@md.fn[:pdf_p_a4]
- summarize(id,file,img)
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:pdf_l_a4]}")==true
- img='<img border="0" height="15" width="18" src="../_sisu/image_sys/b_pdf.png" alt="PDF landscape" /> '
- id,file="PDF, A4 size, landscape/horizontal document (recommended for screen viewing)",@md.fn[:pdf_l_a4]
- summarize(id,file,img)
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:pdf_p_a5]}")==true
- img='<img border="0" height="18" width="15" src="../_sisu/image_sys/b_pdf.png" alt="PDF portrait" /> '
- id,file="PDF, A5 (book) size, portrait/vertical document (recommended for printing)",@md.fn[:pdf_p_a5]
- summarize(id,file,img)
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:pdf_l_a5]}")==true
- img='<img border="0" height="15" width="18" src="../_sisu/image_sys/b_pdf.png" alt="PDF landscape" /> '
- id,file="PDF, A5 (book) size, landscape/horizontal document (recommended for screen viewing)",@md.fn[:pdf_l_a5]
- summarize(id,file,img)
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:pdf_p_b5]}")==true
- img='<img border="0" height="18" width="15" src="../_sisu/image_sys/b_pdf.png" alt="PDF portrait" /> '
- id,file="PDF, B5 (book) size, portrait/vertical document (recommended for printing)",@md.fn[:pdf_p_b5]
- summarize(id,file,img)
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:pdf_l_b5]}")==true
- img='<img border="0" height="15" width="18" src="../_sisu/image_sys/b_pdf.png" alt="PDF landscape" /> '
- id,file="PDF, B5 (book) size, landscape/horizontal document (recommended for screen viewing)",@md.fn[:pdf_l_b5]
- summarize(id,file,img)
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:pdf_p_legal]}")==true
- img='<img border="0" height="18" width="15" src="../_sisu/image_sys/b_pdf.png" alt="PDF portrait" /> '
- id,file="PDF, U.S. legal size, portrait/vertical document (recommended for printing)",@md.fn[:pdf_p_legal]
- summarize(id,file,img)
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:pdf_l_legal]}")==true
- img='<img border="0" height="15" width="18" src="../_sisu/image_sys/b_pdf.png" alt="PDF landscape" /> '
- id,file="PDF, U.S. legal size, landscape/horizontal document (recommended for screen viewing)",@md.fn[:pdf_l_legal]
- summarize(id,file,img)
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:odf]}")==true
- img='<img border="0" height="18" width="18" src="../_sisu/image_sys/b_odf.png" alt="ODF/ODT" /> '
- id,file='ODF:ODT (Open Document Format)',@md.fn[:odf]
- summarize(id,file,img)
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:xhtml]}")==true
- id,file='XHTML',@md.fn[:xhtml]
- summarize(id,file)
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:sax]}")==true
- id,file='XML SAX',@md.fn[:sax]
- summarize(id,file)
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:dom]}")==true
- id,file='XML DOM',@md.fn[:dom]
- summarize(id,file)
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:plain]}")==true
- if @md.cmd =~/a/; id,file='Plaintext (Unix (UTF-8) with footnotes)',@md.fn[:plain]
- elsif @md.cmd =~/e/; id,file='Plaintext (Unix (UTF-8) with endnotes)',@md.fn[:plain]
- elsif @md.cmd =~/A/; id,file='Plaintext (dos (UTF-8) with footnotes)',@md.fn[:plain]
- elsif @md.cmd =~/E/; id,file='Plaintext (dos (UTF-8) with endnotes)',@md.fn[:plain]
- else id,file='Plaintext (UTF-8)',@md.fn[:plain]
- end
- summarize(id,file)
- end
- if FileTest.file?("#{@base_path}/#{@md.fns}.tex")==true
- id,file='LaTeX (portrait)',"#{@md.fns}.tex"
- summarize(id,file)
- end
- if FileTest.file?("#{@base_path}/#{@md.fns}.tex")==true
- id,file='LaTeX (landscape)',"#{@md.fns}.landscape.tex"
- summarize(id,file)
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:digest]}")==true
- id,file="Digest/DCC - Document Content Certificate (#{@dg})",@md.fn[:digest]
- summarize(id,file)
- end
- end
- def published_versions
- if FileTest.file?("#{@base_path}/sisu_manifest.html")==true
- id,file='Markup (SiSU source)',@md.fns
- languages(id,file)
- end
- end
- def language_versions
- if FileTest.file?("#{@base_path}/sisu_manifest.html")==true
- id,file='Markup (SiSU source)',@md.fns
- published_languages(id,file)
- end
- end
- def source_tests
- if @md.fns =~/\.ssm\.sst$/ #% decide whether to extract and include requested/required documents
- req=@md.fns
- if FileTest.file?("#{@base_path_src}/#{req}")==true
- id,file='Markup Composite File (SiSU source)',req
- summarize_source(id,file)
- end
- else
- if FileTest.file?("#{@base_path_src}/#{@md.fns}")==true
- id,file='Markup (SiSU source)',@md.fns
- summarize_source(id,file)
- end
- end
- if FileTest.file?("#{@base_path_pod}/#{@md.fn[:sisupod]}")==true
- id,file='SiSU doc (zip)',@md.fn[:sisupod]
- summarize_pod(id,file)
- end
- if FileTest.file?("#{@base_path}/#{@md.fnb}")==true \
- and @md.fnb =~/\.kdi$/
- id,file='Kdissert (.kdi source)',@md.fnb
- summarize_pod(id,file)
- end
- end
- def metadata_tests
- if defined? @md.title.full \
- and @md.title.full=~/\S+/
- id,info=@translate.full_title,@md.title.full
- metadata(id,info)
- end
- if defined? @md.creator.author \
- and @md.creator.author=~/\S+/
- id,info=@translate.author,@md.creator.author
- metadata(id,info)
- end
- if defined? @md.creator.contributor \
- and @md.creator.contributor=~/\S+/
- id,info=@translate.contributor,@md.creator.contributor
- metadata(id,info)
- end
- if defined? @md.creator.translator \
- and @md.creator.translator=~/\S+/
- id,info=@translate.translator,@md.creator.translator
- metadata(id,info)
- end
- if defined? @md.creator.illustrator \
- and @md.creator.illustrator=~/\S+/
- id,info=@translate.illustrator,@md.creator.illustrator
- metadata(id,info)
- end
- if defined? @md.publisher \
- and @md.publisher=~/\S+/ #dc
- id,info=@translate.publisher,@md.publisher
- metadata(id,info)
- end
- if defined? @md.creator.prepared_by \
- and @md.creator.prepared_by=~/\S+/
- id,info=@translate.prepared_by,@md.creator.prepared_by
- metadata(id,info)
- end
- if defined? @md.creator.digitized_by \
- and @md.creator.digitized_by=~/\S+/
- id,info=@translate.digitized_by,@md.creator.digitized_by
- metadata(id,info)
- end
- if defined? @md.classify.subject \
- and @md.classify.subject=~/\S+/
- id,info=@translate.subject,@md.classify.subject
- metadata(id,info)
- end
- if defined? @md.notes.description \
- and @md.notes.description=~/\S+/
- id,info=@translate.description,@md.notes.description
- metadata(id,info)
- end
- if defined? @md.notes.abstract \
- and @md.notes.abstract=~/\S+/
- id,info=@translate.abstract,@md.notes.abstract
- metadata(id,info)
- end
- if defined? @md.type \
- and @md.type=~/\S+/ #dc
- id,info=@translate.type,@md.type
- metadata(id,info)
- end
- if defined? @md.rights.all \
- and @md.rights.all=~/\S+/ #dc
- id,info=@translate.rights,@md.rights.all
- metadata(id,info)
- end
- if defined? @md.date.published
- if defined? @md.date.published \
- and @md.date.published=~/\S+/ #dc
- id,info=@translate.date,@md.date.published
- metadata(id,info)
- end
- if defined? @md.date.created \
- and @md.date.created=~/\S+/ #dc
- id,info=@translate.date_created,@md.date.created
- metadata(id,info)
- end
- if defined? @md.date.issued \
- and @md.date.issued=~/\S+/ #dc
- id,info=@translate.date_issued,@md.date.issued
- metadata(id,info)
- end
- if defined? @md.date.available \
- and @md.date.available=~/\S+/ #dc
- id,info=@translate.date_available,@md.date.available
- metadata(id,info)
- end
- if defined? @md.date.modified \
- and @md.date.modified=~/\S+/ #dc
- id,info=@translate.date_modified,@md.date.modified
- metadata(id,info)
- end
- if defined? @md.date.valid \
- and @md.date.valid=~/\S+/ #dc
- id,info=@translate.date_valid,@md.date.valid
- metadata(id,info)
- end
- end
- if defined? @md.title.language \
- and @md.title.language=~/\S+/
- id,info=@translate.language,@md.title.language
- metadata(id,info)
- end
- if defined? @md.original.language \
- and @md.original.language=~/\S+/
- id,info=@translate.language_original,@md.original.language
- metadata(id,info)
- end
- if defined? @md.classify.format \
- and @md.classify.format=~/\S+/
- id,info=@transate.format,@md.classify.format
- metadata(id,info)
- end
- if defined? @md.classify.identifier \
- and @md.classify.identifier=~/\S+/
- id,info=@translate.identifier,@md.classify.identifier
- metadata(id,info)
- end
- if defined? @md.original.source \
- and @md.original.source=~/\S+/
- id,info=@translate.source,@md.original.source
- metadata(id,info)
- end
- if defined? @md.classify.relation \
- and @md.classify.relation=~/\S+/
- id,info=@translate.relation,@md.classify.relation
- metadata(id,info)
- end
- if defined? @md.classify.coverage \
- and @md.classify.coverage=~/\S+/
- id,info=@translate.coverage,@md.classify.coverage
- metadata(id,info)
- end
- if defined? @md.classify.keywords \
- and @md.classify.keywords=~/\S+/
- id,info=@translate.keywords,@md.classify.keywords
- metadata(id,info)
- end
- if defined? @md.notes.comment \
- and @md.notes.comment=~/\S+/
- id,info=@translate.comments,@md.notes.comment
- metadata(id,info)
- end
- if defined? @md.classify.loc \
- and @md.classify.loc=~/\S+/
- id,info=@translate.cls_loc,@md.classify.loc
- metadata(id,info)
- end
- if defined? @md.classify.dewey \
- and @md.classify.dewey=~/\S+/
- id,info=@translate.cls_dewey,@md.classify.dewey
- metadata(id,info)
- end
- if defined? @md.classify.oclc \
- and @md.classify.oclc=~/\S+/
- id,info=@translate.cls_oclc,@md.classify.oclc
- @manifest[:html] << %{<tr><th class="left"><p class="bold_left">#{id}:</p></th><td>\n}
- @manifest[:html] << %{<p class="left"><a href="http://worldcat.org/oclc/#{info}">#{info}</a></p>\n}
- @manifest[:html] << %{</td></tr>\n}
- end
- if defined? @md.classify.pg \
- and @md.classify.pg=~/\S+/
- id,info=@translate.cls_gutenberg,@md.classify.pg
- metadata(id,info)
- end
- if defined? @md.classify.isbn \
- and @md.classify.isbn=~/\S+/
- id,info=@translate.cls_isbn,@md.classify.isbn
- metadata(id,info)
- end
- if defined? @md.notes.prefix_a \
- and @md.notes.prefix_a=~/\S+/
- id,info=@translate.prefix_a,@md.notes.prefix_a
- metadata(id,info)
- end
- if defined? @md.notes.prefix_b \
- and @md.notes.prefix_b=~/\S+/
- id,info=@translate.prefix_b,@md.notes.prefix_b
- metadata(id,info)
- end
- if defined? @md.topic_register_array \
- and @md.topic_register_array.length > 0
- @manifest[:html] << %{<tr><th class="left"><p class="bold_left">#{@translate.topic_register}:</p></th><td>\n}
- @md.topic_register_array.each do |t|
- t.each_with_index do |st,i|
- if st.class==Array
- st.each do |v|
- @manifest[:html] << %{<p class="it#{i}">#{v}</p>\n}
- end
- else @manifest[:html] << %{<p class="it#{i}">#{st}</p>\n}
- end
- end
- end
- @manifest[:html] << %{</td></tr>\n}
- end
- if @md.fns
- id,info=@translate.sourcefile,@md.fns
- metadata(id,info)
- end
- if @md.en[:mismatch] > 0
- id,info='WARNING document error in endnote markup, number mismatch',"endnotes: #{@md.en[:note]} != endnote reference marks: #{@md.en[:mark]} (difference = #{@md.en[:mismatch]})"
- metadata(id,info)
- end
- if @md.wc_words
- id,info=@translate.word_count,@md.wc_words
- metadata(id,info)
- end
- if @md.dgst
- id,info="#{@translate.sourcefile_digest} (#{@dg})",@md.dgst[1]
- metadata(id,info)
- end
- if @md.sc_number
- id,info=@translate.sc_number,@md.sc_number
- metadata(id,info)
- end
- if @md.sc_date
- id,info=@translate.sc_date,"#{@md.sc_date} at #{@md.sc_time}"
- metadata(id,info)
- end
- if @md.generated
- id,info=@translate.last_generated,@md.generated
- metadata(id,info)
- end
- if @md.sisu_version
- id,info=@translate.sisu_version,"#{@md.sisu_version[:project]} #{@md.sisu_version[:version]} #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})"
- metadata(id,info)
- end
- if @md.ruby_version
- id,info=@translate.ruby_version,@md.ruby_version
- metadata(id,info)
- end
- end
- def links_tests
- if defined? @md.lnk \
- and @md.lnk
- @md.lnk.each do |l|
- if defined? l[:say]
- target=if l[:url] !~/^\.(\.)?\//; 'external'
- else '_top'
- end
- url,lnk=l[:url],l[:say]
- unless url.nil? \
- or url.empty?
- links(url,lnk,target)
- end
- end
- end
- end
- end
- def check_output(data)
- begin
- minitoc=SiSU_HTML_minitoc::Toc_mini.new(@md,data).songsheet.join("\n")
- id,file='',''
- vz=SiSU_Env::Get_init.instance.skin
- banner_table=if vz.banner_home_button_only !~ /http:\/\/www\.jus\.uio\.no\/sisu/ \
- and vz.banner_home_button_only !~ /sisu\.home\.png/
-<<WOK
-<table summary="band" border="0" cellpadding="3" cellspacing="0">
-<tr><td align="left" width="15%" bgcolor="#ffffff">#{vz.banner_band}</td>
-<td width="70%"><p class="tiny">#{@brace_url.xml_open}<a href="#{@base_url}/#{file}">#{@base_url}/#{file}</a>#{@brace_url.xml_close}</p></td>
-<td>#{@env.widget_static.search_form}</td></tr>
-</table>
-WOK
-#<<WOK
-#<table summary="band" width="100%" border="0" cellpadding="3" cellspacing="0">
-#<tr><td align="left" bgcolor="#ffffff">#{vz.banner_band}</td><td width="60%"><p class="tiny">#{@brace_url.xml_open}<a href="#{@base_url}/#{file}">#{@base_url}/#{file}</a>#{@brace_url.xml_close}</p></td><td width="20%">#{@env.widget_static.search_form}</td><td><a href="http://www.jus.uio.no/sisu/" target="_top"><img border="0" src="#{vz.url_path_image_sys}/sisu.png" alt="SiSU --&gt;" /></a></td></tr>
-#</table>
-#WOK
- else
-<<WOK
-<table summary="band" border="0" cellpadding="3" cellspacing="0">
-<tr><td align="left" bgcolor="#ffffff"><a href="http://www.jus.uio.no/sisu/" target="_top"><img border="0" src="#{vz.url_path_image_sys}/sisu.png" alt="SiSU --&gt;" /></a></td>
-<td><p class="tiny">#{@brace_url.xml_open}<a href="#{@base_url}/#{file}">#{@base_url}/#{file}</a>#{@brace_url.xml_close}</p></td>
-<td>#{@env.widget_static.search_form}</td></tr>
-</table>
-WOK
- end
- @manifest[:html] <<<<WOK
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<title>
-SiSU manifest: #{@md.title.full}
-</title>
-<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
-<meta name="sourcefile" content="#{@md.fns}" />
-<link rel="generator" href="http://www.jus.uio.no/sisu" />
-<link rel="shortcut icon" href="../_sisu/image_sys/rb7.ico" />
-<link rel="stylesheet" href="../#{@env.path.style}/html.css" type="text/css" />
-</head>
-<body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en">
-#{banner_table}
-WOK
- if @env.manifest_minitoc?
- @manifest[:html] <<<<WOK
-<div class="toc">
-#{minitoc.to_s}
-</div>
-<div class="content">
-WOK
- else
- @manifest[:html] <<<<WOK
-<div>
-WOK
- end
- @manifest[:html] <<<<WOK
-<h1 class="small">#{@translate.manifest_description}</h1>
-<h2 class="small">#{@md.title.full}</h2>
-<p class="bold">#{@md.author}</p>
-<p class="small">
-&nbsp;&nbsp;<a href="#output">Document, Available Filetypes</a>
-</p>
-<p class="small">
-&nbsp;&nbsp;<a href="#metadata">Document Metadata</a>
-</p>
-<p class="tiny">
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#links">(metadata suggested links (if any)</a>
-</p>
-<table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">
-WOK
- published_versions
- @manifest[:html] << '</table>'
- @manifest[:html] <<<<WOK
-<h2 class="small"><a name="output">#{@translate.manifest_description_output}</a></h2>
-<table summary="available output/filetypes" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">
-<tr> <th class="left"><p class="bold">#{@translate.filetype_description}</p></th><th class="left"><p class="bold">#{@translate.filename}</p></th><th class="right"><p class="right"><b>#{@translate.file_size}</b></p><p class="tiny_right">(kB)</p></th></tr>
-
-WOK
- output_tests
- @manifest[:html] << '</table>'
- @manifest[:html] <<<<WOK
-<table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">
-WOK
- source_tests
- @manifest[:html] << '</table>'
- @manifest[:html] <<<<WOK
-<h2 class="small"><a name="metadata">#{@translate.manifest_description_metadata}</a></h2>
-<table summary="document metadata" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">
-<tr> <th class="left"><p class="bold">#{@translate.metadata}</p></th><th class="left"><p class="bold">#{@translate.description}</p></th></tr>
-WOK
- metadata_tests
- @manifest[:html] <<<<WOK
-</table>
-WOK
- @manifest[:html] <<<<WOK
-<p class="bold"><a name="links">#{@translate.suggested_links}:</a></p>
-<table summary="suggested links" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">
-WOK
- links_tests
- @manifest[:html] <<<<WOK
-</table>
-WOK
- @manifest[:html] <<<<WOK
-<h2 class="small"><a name="languages">#{@translate.language_version_list}</a></h2>
-<table summary="language versions" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">
-<tr> <th class="left"><p class="bold">#{@translate.filename}</p></th><th class="left"><p class="bold">#{@translate.description}</p></th><th class="right"><p class="right">&nbsp;</p></th></tr>
-
-WOK
- language_versions
- @manifest[:html] <<<<WOK
-</table>
-</div>
-<div>
-<br />
-#{vz.credits_sisu_manifest}
-</div>
-</body>
-</html>
-WOK
- output
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error
- ensure
- end
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/v2/manpage.rb b/lib/sisu/v2/manpage.rb
deleted file mode 100644
index f9c75227..00000000
--- a/lib/sisu/v2/manpage.rb
+++ /dev/null
@@ -1,420 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: manpage text generation, stripped manpage output (unix,
- linefeed)
-
-=end
-module SiSU_Manpage
- require "#{SiSU_lib}/dal" # dal.rb
- require "#{SiSU_lib}/sysenv" # sysenv.rb
- include SiSU_Env
- include SiSU_Param
- include SiSU_Viz
- require "#{SiSU_lib}/manpage_format" # manpage_format.rb
- include SiSU_Manpage_format
- require "#{SiSU_lib}/shared_metadata" # shared_metadata.rb
- require "#{SiSU_lib}/shared_txt" # shared_txt.rb
- pwd=Dir.pwd
- @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0
- @@tablefoot=''
- class Source
- def initialize(opt)
- @opt=opt
- if @opt.fns =~/(.+?)\.(?:-|ssm\.)?sst$/
- @@dostype='unix endnotes'
- else puts "#{sf} not a processed file type"
- end
- end
- def read
- begin
- @md=SiSU_Param::Parameters.new(@opt).get
- @env=SiSU_Env::Info_env.new(@opt.fns)
- path=@env.path.output_tell
- tool=(@opt.cmd =~/[MVv]/) \
- ? "#{@env.program.text_editor} #{path}/man/#{@md.fn[:manpage]}" \
- : ''
- SiSU_Screen::Ansi.new(@opt.cmd,'Manpage',tool).green_hi_blue unless @opt.cmd =~/q/
- SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/man/#{@md.fn[:manpage]}").flow if @opt.cmd =~/[MV]/
- my_make=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns)
- @dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here
- SiSU_Manpage::Source::Scroll.new(@md,@dal_array).songsheet
- SiSU_Env::Info_skin.new(@md).select #watch
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- end
- end
- private
- class Scroll <Source
- require "#{SiSU_lib}/defaults" # defaults.rb
- require "#{SiSU_lib}/shared_txt" # shared_txt.rb
- include SiSU_text_utils
- @@endnotes={ :para=>[],:end=>[] }
- def initialize(md,data)
- @md,@data=md,data
- @brace_url=SiSU_Viz::Skin.new.url_decoration
- @vz=SiSU_Env::Get_init.instance.skin
- @tab="\t"
- @br="\n"
- @@dostype='unix endnotes'
- @manpage={ :body=>[],:open=>[],:close=>[],:head=>[],:metadata=>[],:tail=>[],:endnotes=>[] }
- end
- def songsheet
- manpage=markup(@data)
- publish(manpage)
- end
- # Used for extraction of endnotes from paragraphs
- def extract_endnotes(para='')
- notes=para.scan(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})([\d*+]+\s+.+?)\s*(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m)
- @n=[]
- notes.each do |n| #high cost to deal with <br> appropriately within manpage, consider
- n=n.dup.to_s
- if n =~/#{Mx[:br_line]}/
- fix = n.split(/\s*#{Mx[:br_line]}+\s*/) #watch #added
- fix.each do |x|
- unless x.empty?; @n << x
- end
- end
- else @n << n
- end
- end
- notes=@n.flatten
- notes.each do |e|
- util=if e.to_s =~/^\[[\d*+]+\]:/; SiSU_text_utils::Wrap.new(e.to_s,78,4,1)
- else SiSU_text_utils::Wrap.new(e.to_s,78,0,1)
- end
- wrap=util.line_wrap
- if wrap =~ /^\s*[\d*+]+\s+.+?\s*\Z/m
- wrap.gsub!(/(^|&nbsp;|#{Mx[:nbsp]}|\s|\*)\\\*/,'\1\\\\\*') #man page requires
- wrap.gsub!(/\s\.(\S+)/,' \\.\1')
- wrap.gsub!(/^\s*([\d*+]+)\s+(.+?)\s*\Z/m, <<GSUB
-.TP
-.BI \\1.
-\\2
-GSUB
- )
- else
- wrap.gsub!(/^\s*(.+)\Z/m, <<GSUB
-\\1
-GSUB
- )
- end
- @@endnotes[:para] << wrap
- @@endnotes[:end] << wrap << "\n.br"
- @@endnotes
- end
- end
- def manpage_metadata
- @manpage[:metadata]=Metadata::Summary.new(@md).manpage.metadata
- end
- def manpage_tail
- SiSU_Env::Info_skin.new(@md).select
- vz=SiSU_Env::Get_init.instance.skin
- generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version]
- lastdone="Last Generated on: #{Time.now}"
- rubyv="Ruby version: #{@md.ruby_version}"
- sc=if @md.sc_info
- "Source file: #{@md.sc_filename}#{@br}Version number: #{@md.sc_number}#{@br}Version date: #{@md.sc_date}#{@br}"
- else ''
- end
- @manpage[:tail] <<<<WOK
-#{@br}
-.TP
-Other versions of this document:
-.TP
-manifest: <#{vz.url_root_http}/#{@md.fnb}/#{@md.fn[:manifest]}>
-.TP
-at: <#{vz.url_site}>
-.TP
-#{sc}
-.TP
-* #{generator}
-.TP
-* #{rubyv}
-.TP
-* #{lastdone}
-.TP
-* SiSU #{vz.url_sisu}
-WOK
- end
- def manpage_structure(dob='',hname='') #% Used to extract the structure of a document
- if dob.is=='heading'
- lv=dob.ln
- n=dob.ln - 1
- n3=dob.ln + 2
- else lv=nil
- end
- wrapped=if dob.is=='para' \
- or dob.is=='heading'
- paragraph=dob.obj
- if dob.is=='para'
- if dob.indent =~/[1-9]/
- util=if dob.bullet_
- SiSU_text_utils::Wrap.new("* #{paragraph}",78,dob.indent.to_i*2)
- else SiSU_text_utils::Wrap.new(paragraph,78,dob.indent.to_i*2)
- end
- else
- util=if dob.bullet_
- SiSU_text_utils::Wrap.new("* #{paragraph}",78,0)
- else SiSU_text_utils::Wrap.new(paragraph,78,0)
- end
- end
- else util=SiSU_text_utils::Wrap.new(paragraph,78,0)
- end
- w=util.line_wrap
- w.gsub!(/^(\\\.)/,' \1')
- w
- end
- if lv
- times=wrapped.length
- times=78 if times > 78
- @manpage[:body] << case lv
- when 1; '.SH ' << wrapped.upcase << @br << '.br'
- when 2..3; '.SH ' << wrapped.upcase << @br << '.br'
- when 4; '.SH ' << wrapped.upcase << @br << '.br'
- when 5..6; '.SH ' << wrapped.upcase << @br
- end
- else
- @manpage[:body] << if wrapped =~/^\.BI\s/ # main text, contents, body KEEP
- '.TP' << @br << wrapped.gsub!(/^\.BI\s/,'.B ') # sleight ... simpler output
- else
- '.br' << @br << wrapped
- end
- end
- if @@endnotes[:para] \
- and @@dostype =~/footnote/ #edit out to switch off endnotes following paragraph to which they belong
- @manpage[:body] << @br
- @@endnotes[:para].each { |e| @manpage[:body] << e << @br }
- elsif @@endnotes[:para] \
- and @@dostype =~/endnote/
- @manpage[:body] << @br*2
- end
- @@endnotes[:para]=[]
- end
- def markup(data) # Used for major markup instructions
- dir=SiSU_Env::Info_env.new(@md.fns)
- @data_mod,@endnotes,@level,@cont,@copen,@manpage_contents_close=Array.new(6){[]}
- (0..6).each { |x| @cont[x]=@level[x]=false }
- (4..6).each { |x| @manpage_contents_close[x]='' }
- manpage_tail #($1,$2)
- table_message='[table omitted, see other document formats]'
- fix=[]
- manpage_metadata
- data.each do |dob|
- if dob.is=='comment' \
- or dob.is=='heading_insert'
- dob.obj=''
- end
- dob.obj.gsub!(/.+?<-#>/,'') # remove dummy headings (used by html) #check
- dob.obj.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'^\1^')
- dob.obj.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'[\1]')
- dob.obj.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'++\1++')
- dob.obj.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'--\1--')
- dob.obj.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'"\1"')
- dob.obj.gsub!(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'\1')
- dob.obj.gsub!(/\A\s*#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}#{Mx[:br_line]}/m,"#{Mx[:br_line]}.I \\1#{Mx[:br_line]}")
- dob.obj.gsub!(/\s*#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/m,"#{Mx[:br_line]}.I \\1#{Mx[:br_line]}")
- dob.obj.gsub!(/\A\s*#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}#{Mx[:br_line]}/m,"#{Mx[:br_line]}.BI \\1#{Mx[:br_line]}")
- dob.obj.gsub!(/\s*#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,"#{Mx[:br_line]}.B \\1#{Mx[:br_line]}")
- dob.obj.gsub!(/\s*#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,"#{Mx[:br_line]}.I \\1#{Mx[:br_line]}")
- unless dob.is=='code'
- dob.obj.gsub!(/(?:^|\s)#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,"\\1 #{@brace_url.txt_open}\\2#{@brace_url.txt_close}")
- dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s)#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,"\\1#{@brace_url.txt_open}\\2#{@brace_url.txt_close}")
- @manpage[:endnotes]=extract_endnotes(dob.obj)
- dob.obj.gsub!(/#{Mx[:en_a_o]}([\d*+]+)\s*(?:.+?)#{Mx[:en_a_c]}/m,'[^\1]') # endnote marker marked up
- dob.obj.gsub!(/#{Mx[:en_b_o]}([\d*+]+)\s*(?:.+?)#{Mx[:en_b_c]}/m,'[^\1]') # endnote marker marked up
- dob.obj.gsub!(/#{Mx[:gl_o]}#amp#{Mx[:gl_c]}/,'&') ##{Mx[:gl_o]}#095#{Mx[:gl_c]}
- dob.obj.gsub!(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!')
- dob.obj.gsub!(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#')
- dob.obj.gsub!(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*')
- dob.obj.gsub!(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-')
- dob.obj.gsub!(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/')
- dob.obj.gsub!(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_')
- dob.obj.gsub!(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{')
- dob.obj.gsub!(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}')
- dob.obj.gsub!(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~')
- dob.obj.gsub!(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'©')
- else
- dob.obj.gsub!(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})+\s*/,"\n") # watch
- end
- dob.obj.gsub!(/(^|&nbsp;|#{Mx[:nbsp]}|\s|\*)\\\*/,'\1\\\\\*') #man page requires
- dob.obj.gsub!(/┆/,'|')
- dob.obj.gsub!(/\s\.(\S+)/,' \\.\1')
- dob.obj.gsub!(/(\n\.)(\S\S\S+)/m,'\1\\.\2')
- dob.obj.gsub!(/-/,'\-') #manpages use this
- dob.obj.gsub!(/&#126;/,'~') if dob.obj #manpages use this
- if dob.is =~/group|verse|alt|code/
- if dob.is =='code'
- dob.obj.gsub!(/(^|[^}])_([<>])/m,'\1\2') # _> _<
- dob.obj.gsub!(/(^|[^}])_([<>])/m,'\1\2') # _<_<
- dob.obj.gsub!(/\A(.+)?\Z/m,".nf\n\n\\1\n\n.fi")
- end
- else
- dob.obj.gsub!(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*/,"\n\n") #unless para =~/#{Mx[:lv_o]}\d:/ #watch introduces a bug
- end
- dob.obj.gsub!(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})+\s*/,"\n\n.br\n\n") # watch
- blit=dob.obj.scan(/\[[^\]]+\]|[^\[]+/)
- blit_array=[]
- blit.each do |x|
- if x =~/^\[/
- x.gsub!(/\s+/,' \ ') #manpages use this
- else x
- end
- blit_array << x
- end
- dob.obj=blit_array.join
- dob.obj.gsub!(/#{Mx[:gl_o]}:name#\S+?#{Mx[:gl_c]}/mi,'') #added
- dob.obj.gsub!(/\s\\\s+(#{Mx[:br_line]}|#{Mx[:br_nl]})/,'\1') #a messy solution
- dob.obj.gsub!(/#{Mx[:br_page]}\s*|#{Mx[:br_page_new]}/,'') # remove page breaks
- dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s)#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1\2')
- dob.obj.gsub!(/<a href=".+?">(.+?)<\/a>/m,'\1')
- dob.obj.gsub!(/#{Mx[:mk_o]}name#\S+?#{Mx[:mk_c]}/,'') # remove name links
- dob.obj.gsub!(/&nbsp;|#{Mx[:nbsp]}/,' ') # decide on
- dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,' [ \1 ]') #"[ #{dir.url.images_local}\/\\1 ]")
- dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}image/,' [ \1 ]') #"[ #{dir.url.images_local}\/\\1 ]")
- dob.obj.gsub!(/^(?:^|[^_\\])#{Mx[:lnk_o]}\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*#{Mx[:lnk_c]}\S+/,'[image: "\1"]')
- wordlist=dob.obj.scan(/\S+/)
- if dob.obj !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/
- if dob.obj =~@regx #/.+?<~\d+;\w\d+;\w\d+>.*/ #watch change
- paranum=dob.obj[@regx,3]
- @p_num=SiSU_Manpage_format::Paragraph_number.new(paranum)
- end
- x=SiSU_Manpage_format::Format_text_object.new(@md,dob)
- if dob.is=='heading'
- manpage_structure(dob)
- dob.obj=case dob.ln
- when 1; x.heading_body1
- when 2; x.heading_body2
- when 3; x.heading_body3
- when 4; x.heading_body4
- when 5; x.heading_body5
- when 6; x.heading_body6
- end
- elsif dob.is=='para'
- manpage_structure(dob)
- else
- if dob.obj =~/#{table_message}/
- @manpage[:body] << dob.obj << @br
- end
- end
- if (dob.obj =~/<a name="n\d+">/ \
- and dob.obj =~/^(-\{{2}~\d+|<!e[:_]\d+!>)/) # -endnote
- dob.obj=''
- end
- if dob.obj
- dob.obj.gsub!(/\s(\[)/m,' \ \1')
- dob.obj.gsub!(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})/,"\n\n")
- dob.obj.gsub!(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~')
- dob.obj.gsub!(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{')
- dob.obj.gsub!(/#{Mx[:pa_o]}\S+#{Mx[:pa_c]}/,' ')
- dob.obj.gsub!(/<!.+!>/,' ')
- dob.obj.gsub!(/<:\S+>/,' ')
- end
- dob
- end
- end
- @manpage
- end
- def publish(manpage)
- divider='='
- content=[]
- date=if defined? @md.date.modified \
- and @md.date.modified
- @md.date.modified
- elsif defined? @md.date.published \
- and @md.date.published
- @md.date.published
- else SiSU_Env::Info_date.new.year #date missing decide on action
- end
- manpage_name,manpage_synopsis='',''
- manpg={}
- proj=SiSU_Env::Info_version.instance.get_version
- manpage[:open] = %{.TH "#{@md.fnb}" "#{@md.make.manpage['section']}" "#{date}" "#{proj[:version]}" "#{@md.title.main}"#{@md.make.manpage['name']}#{@md.make.manpage['synopsis']}}
- content << manpage[:open]
- content << manpage[:head]
- content << manpage[:body]
- content << @@endnotes[:end] if @@dostype =~/endnotes/
- content << manpage[:metadata]
- content << manpage[:tail]
- Output.new(@md,content).manpage
- @@endnotes={ :para=>[],:end=>[] }
- end
- end
- class Output <Source
- include SiSU_Param
- include SiSU_Env
- def initialize(md,content)
- @md,@content=md,content
- end
- def manpage #%manpage output
- SiSU_Env::SiSU_file.new(@md).mkdir
- filename_manpage=SiSU_Env::SiSU_file.new(@md,@md.fn[:manpage]).mkfile_man
- @sisu=[]
- @content.each do |para| # this is a hack
- if para.class==Array \
- and para.length > 0
- para.each do |line|
- line.gsub!(/\s+$/m,'')
- filename_manpage.puts line #unix manpage
- end
- else filename_manpage.puts para #unix manpage # /^([*=-]|\.){5}/
- end
- end
- filename_manpage.close
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/v2/odf.rb b/lib/sisu/v2/odf.rb
deleted file mode 100644
index 2880cdfe..00000000
--- a/lib/sisu/v2/odf.rb
+++ /dev/null
@@ -1,735 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: opendocument text generation
-
-=end
-module SiSU_ODF
- require "#{SiSU_lib}/particulars" # particulars.rb
- include SiSU_Particulars
- require "#{SiSU_lib}/dal" # dal.rb
- require "#{SiSU_lib}/sysenv" # sysenv.rb
- include SiSU_Env
- include SiSU_Viz
- require "#{SiSU_lib}/odf_format" # odf_format.rb
- include SiSU_ODF_format
- require "#{SiSU_lib}/shared_metadata" # shared_metadata.rb
- require "#{SiSU_lib}/shared_txt" # shared_txt.rb
- @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0
- class Source
- require 'zlib'
- require 'find'
- require 'fileutils'
- include FileUtils
- def initialize(opt)
- @opt=opt
- @particulars=SiSU_Particulars::Combined_singleton.instance.get_all(opt)
- @@endnotes_para=[]
- end
- def read
- begin
- @env,@md,@dal_array=@particulars.env,@particulars.md,@particulars.dal_array
- opendoc=@md.fn[:odf]
- path=@env.path.output_tell
- unless @opt.cmd =~/q/
- tool=(@opt.cmd =~/[MVv]/) \
- ? "#{@env.program.odf_viewer} #{path}/#{@md.fnb}/#{opendoc}" \
- : @opt.fns
- @opt.cmd=~/[MVvz]/ \
- ? SiSU_Screen::Ansi.new(@opt.cmd,'Opendocument (ODF:ODT)',tool).green_hi_blue \
- : SiSU_Screen::Ansi.new(@opt.cmd,'Opendocument (ODF:ODT)',tool).green_title_hi
- SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/#{@md.fnb}/#{opendoc}").flow if @opt.cmd =~/[MV]/
- end
- my_make=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns)
- SiSU_ODF::Source::Scroll.new(@particulars).songsheet
- SiSU_Env::Info_skin.new(@md).select
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- end
- end
- private
- class Scroll <Source
- require "#{SiSU_lib}/defaults" # defaults.rb
- require "#{SiSU_lib}/shared_txt" # shared_txt.rb
- @@img_count=0
- @@odf={ :body=>[],:open=>[],:close=>[],:head=>[],:metadata=>[],:tail=>[],:endnotes=>[] }
- @@docstart=true
- @@fns=nil
- def initialize(particulars)
- @env,@md,@dal_array=particulars.env,particulars.md,particulars.dal_array
- @vz=SiSU_Env::Get_init.instance.skin
- @tab="\t"
- @brace_url=SiSU_Viz::Skin.new.url_decoration
- @br=(@md.cmd =~/M/) ? '' : ''
- #@br=(@md.cmd =~/M/) ? "\n" : ''
- end
- def songsheet
- pre
- @data=markup(@dal_array)
- post
- publish
- end
- # Used for extraction of endnotes from paragraphs
- def extract_endnotes(dob='')
- notes=dob.obj.scan(/#{Mx[:en_a_o]}(\d+\s+.+?)#{Mx[:en_a_c]}/)[1] #FIX
- @n=[]
- notes.each do |n| #high cost to deal with <br> appropriately within odf, consider
- n=n.dup.to_s
- if n =~/#{Mx[:br_line]}/
- fix=n.split(/#{Mx[:br_line]}/) #watch #added
- fix.each do |x|
- if x =~/\S+/; @n << x
- end
- end
- else @n << n
- end
- end
- end
- def odf_metadata
- @@odf[:metadata]=Metadata::Summary.new(@md).odf.metadata
- end
- def odf_tail
- generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version]
- lastdone="Last Generated on: #{Time.now}"
- rubyv="Ruby version: #{@md.ruby_version}"
- sc=if @md.sc_info
- "Source file: #{@md.sc_filename}\nVersion number: #{@md.sc_number}\nVersion date: #{@md.sc_date}\n"
- else ''
- end
- url=@md.fnb
- fn=@md.fn[:manifest]
- manifest="#{@env.url.root}/#{@md.fnb}/#{@md.fn[:manifest]}"
- @@odf[:tail] << %{<text:p text:style-name="P1">Available document outputs: <br /> &lt;<text:a xlink:type="simple" xlink:href="#{manifest}">#{manifest}</text:a>&gt;</text:p>}
- @@odf[:tail] << %{\n<text:p text:style-name="P1">SiSU: &lt;<text:a xlink:type="simple" xlink:href="http://www.jus.uio.no/lm">www.jus.uio.no/sisu</text:a>&gt; and &lt;<text:a xlink:type="simple" xlink:href="http://www.sisudoc.org">www.sisudoc.org</text:a>&gt;</text:p>}
- @@odf[:tail] << "\n</office:text></office:body></office:document-content>"
- end
- def heading(dob)
- dob.obj.gsub!(/#{Mx[:tag_o]}\S+?#{Mx[:tag_c]}/,'') #check
- m=/#{$1}/
- breakpage=''
- if @md.fns \
- and @md.fns != '' \
- and @md.fns !=@@fns
- @@docstart=true
- @@fns=@md.fns
- end
- unless @@docstart
- breakpage=if (@md.pagenew or @md.pagebreak) \
- and (@md.pagenew =~ m or @md.pagebreak =~m)
- '<text:p text:style-name="P9"> </text:p>'
- else ''
- end
- end
- @@docstart=false
- dob.obj=%{#{breakpage}<text:h text:style-name="Heading_20_#{dob.ln}" text:outline-level="#{dob.ln}">#{dob.obj}</text:h>}
- dob
- end
- def image_src(i)
- image_source=if @md.fns =~/\.ss[tm]$/ \
- and FileTest.file?("#{@env.path.image_source_local_tex}/#{i}") #review
- @env.path.image_source_local_tex
- elsif @md.fns =~/\.-ss[tm]$/ \
- and FileTest.file?("#{@env.path.image_source_remote_tex}/#{i}")
- @env.path.image_source_remote_tex
- elsif FileTest.file?("#{@env.path.image_source_tex}/#{i}")
- @env.path.image_source_tex
- else
- SiSU_Screen::Ansi.new(@md.cmd,"ERROR - image:",%{"#{i}" missing},"search locations: #{@env.path.image_source_local_tex},#{@env.path.image_source_remote_tex} and #{@env.path.image_source_tex}").error2 unless @md.cmd =~/q/
- nil
- end
- end
- def image_odf(img)
- # copy image to od image directory (unless exists)
- # divide pixel dimension by 37.79485 and retain 3 decimal places
- m,u=img[1],img[2]
- i=/^(\S+?\.(?:png|jpg|gif))/.match(m).captures.join if m =~/^(\S+?\.(?:png|jpg|gif))/
- c=/^\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"/.match(m).captures.join if m =~/^\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"/
- w,h=/\s(\d+)x(\d+)/.match(m).captures if m =~/\s\d+x\d+/
- w=(w.to_i/37.79485).to_s
- h=(h.to_i/37.79485).to_s
- h=/([0-9]+\.\d{0,3})/.match(h).captures.join
- w=/([0-9]+\.\d{0,3})/.match(w).captures.join
- image_source=image_src(i)
- pwd=Dir.pwd
- cp("#{image_source}/#{i}","#{@env.path.odf}/Pictures/#{i}") if image_source
- img=if i.to_s =~/jpg|png|gif/ \
- and h.to_s =~/\d/ \
- and w.to_s =~/\d/
- @@img_count +=1
- %{<draw:frame draw:style-name="fr1" draw:name="graphics#{@@img_count}" text:anchor-type="as-char" svg:width="#{w}cm" svg:height="#{h}cm" draw:z-index="2"><draw:image xlink:href="Pictures/#{i}" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/></draw:frame>#{c}} #anchor-type: as-char or paragraph or char or ...
- else %{<text:p text:style-name="P1">[image omitted]</text:p>}
- end
- end
- def image(dob)
- m=if dob.obj =~/#{Mx[:lnk_o]}[ ]*(.+?)[ ]*#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/
- dob.obj.scan(/(#{Mx[:lnk_o]}[ ]*(.+?)[ ]*#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]})/)
- elsif dob.obj =~/#{Mx[:lnk_o]}[ ]*(.+?)[ ]*#{Mx[:lnk_c]}image/
- dob.obj.scan(/(#{Mx[:lnk_o]}[ ]*(.+?)[ ]*#{Mx[:lnk_c]}(image))/)
- else nil
- end
- if m; m.each do |i|
- cont,url=i[1],i[2]
- cont.gsub!(/([)(\]\[])/,"\\\\\\1")
- cont.gsub!(/([+?])/,"\\\\\\1") # incorrect handling of +
- url.gsub!(/([+?])/,"\\\\\\1")
- dob.obj.sub!(/#{Mx[:lnk_o]}[ ]*#{cont}[ ]*#{Mx[:lnk_c]}image/m,image_odf(i))
- dob.obj.sub!(/#{Mx[:lnk_o]}[ ]*#{cont}[ ]*#{Mx[:lnk_c]}#{Mx[:url_o]}#{url}#{Mx[:url_c]}/m,image_odf(i))
- dob.obj.gsub!(/\\([)(\]\[?])/,'\1') #clumsy fix
- end
- m=nil
- end
- dob
- end
- def text_link_odf(txt,url,trail)
- txt.gsub!(/(\\\+)/,'+') #this is convoluted, and risky :-(
- url.gsub!(/(\\\+)/,'+') #this is convoluted, and risky :-(
- map_nametags=SiSU_Particulars::Combined_singleton.instance.get_map_nametags(@md).nametags_map
- t=case url
- when /^https?:/
- %{<text:a xlink:type="simple" xlink:href="#{url}">#{txt.strip}</text:a>#{trail}}
- when /^:/ # site same document collection html link
- url.gsub!(/^:/,"#{@env.url.root}/")
- %{<text:a xlink:type="simple" xlink:href="#{url}">#{txt.strip}</text:a>#{trail}}
- when /^\.\.\// # site same document collection html link
- url.gsub!(/^\.\.\//,"#{@env.url.root}/")
- %{<text:a xlink:type="simple" xlink:href="#{url}">#{txt.strip}</text:a>#{trail}}
- else # document internal link
- if map_nametags[url] \
- and map_nametags[url][:segname]
- else p "NOT FOUND name_tags: #{url}"
- end
- t=map_nametags[url] \
- && map_nametags[url][:segname] \
- ? %{<text:a xlink:type="simple" xlink:href="#{@env.url.root}/#{@md.fnb}/#{map_nametags[url][:segname]}#{Sfx[:html]}##{url}">#{txt.strip}</text:a>#{trail}} \
- : %{#{txt.strip}#{trail}}
- end
- t
- end
- def text_link(dob)
- m=dob.obj.scan(/(#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]})/) #sort
- if m
- m.each do |i|
- txt,url,trail=i[1],i[2]
- txt.gsub!(/([)(\]\[])/,"\\\\\\1")
- txt.gsub!(/([+?*])/,"\\\\\\1") # problems with +
- url.gsub!(/([+?])/,"\\\\\\1") # problems with +
- dob.obj.gsub!(/#{Mx[:lnk_o]}[ ]*#{txt}#{Mx[:lnk_c]}#{Mx[:url_o]}#{url}#{Mx[:url_c]}/m,text_link_odf(txt,url,trail)) #make sure trailing ']' are not caught in url
- dob.obj.gsub!(/\\([)(\]\[?])/,'\1') #clumsy fix
- end
- m=nil
- end
- dob
- end
- def text_link_relative(dob)
- m=dob.obj.scan(/(#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}(\S+?)#{Mx[:rel_c]})/) #sort
- if m
- m.each do |i|
- txt,url,trail=i[1],i[2]
- txt.gsub!(/([)(\]\[])/,"\\\\\\1")
- txt.gsub!(/([+?*])/,"\\\\\\1") # problems with +
- url.gsub!(/([+?])/,"\\\\\\1") # problems with +
- dob.obj.gsub!(/#{Mx[:lnk_o]}[ ]*#{txt}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{url}#{Mx[:rel_c]}/m,text_link_odf(txt,url,trail)) #make sure trailing ']' are not caught in url
- dob.obj.gsub!(/\\([)(\]\[?])/,'\1') #clumsy fix
- end
- m=nil
- end
- dob
- end
- def normal(dob) #P1 - P3
- dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,
- '<text:a xlink:type="simple" xlink:href="\1">\1</text:a>') #http ftp matches escaped, no decoration
- dob.obj.gsub!(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,
- %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{@brace_url.xml_close}})
- dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
- %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{@brace_url.xml_close}}) #http ftp matches with decoration
- dob.obj= if dob.is=='para' and dob.indent.to_s =~/[0-9]/ # and t_o.bullet_==true
- %{<text:p text:style-name="P1#{dob.indent}">#{dob.obj}</text:p>}
- else %{<text:p text:style-name="P1">#{dob.obj}</text:p>}
- end
- dob
- end
- def fontface(dob)
- end
- def footnote_urls(str)
- str.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
- %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{@brace_url.xml_close}})
- str=text_link(str) if str =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/
- str=text_link_relative(str) if str =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/
- str
- end
- def footnote(t_o)
- str=if defined? t_o.obj; t_o.obj
- elsif t_o.class==String; t_o
- end
- if str
- @astx||=10000
- @astxs||=20000
- if str =~/#{Mx[:en_a_o]}\d+\s+/
- str.gsub!(/#{Mx[:en_a_o]}(\d+)\s+(.+?)#{Mx[:en_a_c]}/,'<text:note text:id="ftn\1" text:note-class="footnote"><text:note-citation>\1</text:note-citation><text:note-body><text:p text:style-name="Footnote"> \2</text:p><text:p text:style-name="Footnote"/></text:note-body></text:note>')
- end
- if str =~/#{Mx[:en_a_o]}([*]+)\s+/
- a=$1.gsub(/([*])/,"\\\\\\1")
- str.gsub!(/#{Mx[:en_a_o]}([*]+)\s+(.+?)#{Mx[:en_a_c]}/,%{<text:note text:id="ftn#{@astx.to_s}" text:note-class="footnote"><text:note-citation text:label="\\1">\\1</text:note-citation><text:note-body><text:p text:style-name="Footnote"> \\2</text:p><text:p text:style-name="Footnote"/></text:note-body></text:note>})
- @astxs+=1
- end
- if str=~/#{Mx[:en_a_o]}[*+]+\s/
- asterisk=str.scan(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)#{Mx[:en_a_c]}/)
- asterisk.each do |x|
- a=x[0].gsub(/([*+])/,"\\\\\\1")
- str=group_clean(str)
- str=footnote_urls(str)
- str.gsub!(/#{Mx[:en_a_o]}(#{a})\s+(.+?)#{Mx[:en_a_c]}/,%{<text:note text:id="ftn#{@astx.to_s}" text:note-class="footnote"><text:note-citation text:label="\\1">\\1</text:note-citation><text:note-body><text:p text:style-name="Footnote"> \\2</text:p><text:p text:style-name="Footnote"/></text:note-body></text:note>})
- @astx+=1
- end
- end
- if str=~/#{Mx[:en_b_o]}[*+]\d+\s/
- asterisk=str.scan(/#{Mx[:en_b_o]}([*+]\d+)\s+(.+?)#{Mx[:en_b_c]}/)
- asterisk.each do |x|
- a=x[0].gsub(/([*+])/,"\\\\\\1")
- str=group_clean(str)
- str=footnote_urls(str)
- str.gsub!(/#{Mx[:en_b_o]}(#{a})\s+(.+?)#{Mx[:en_b_c]}/,%{<text:note text:id="ftn#{@astx.to_s}" text:note-class="footnote"><text:note-citation text:label="\\1">\\1</text:note-citation><text:note-body><text:p text:style-name="Footnote"> \\2</text:p><text:p text:style-name="Footnote"/></text:note-body></text:note>})
- @astx+=1
- end
- end
- end
- if defined? t_o.obj; t_o.obj=str
- elsif t_o.class==String; t_o=str
- end
- t_o
- end
- def group_clean(str)
- str.gsub!(/&amp;nbsp;|&nbsp;|#{Mx[:nbsp]}/,'&#160;')
- str.gsub!(/</,'&lt;'); str.gsub!(/>/,'&gt;')
- str.gsub!(/&lt;(text:span text:style-name="T[1-5]"|\/text:span)&gt;/,'<\1>') #works, not ideal
- str.gsub!(/#{Mx[:br_line]}/,'<br />')
- str.gsub!(/&lt;br(?:\s+\/)?&gt;/,'<br />')
- str
- end
- def poem(dob) #P4 #same as group
- parray=[]
- dob.obj.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/).each do |parablock|
- parablock=group_clean(parablock)
- parray << %{<text:p text:style-name="P4">#{parablock}</text:p>} if parablock =~/\S+/
- end
- dob.obj=parray.join + '<text:p text:style-name="Standard"/>'
- dob
- end
- def group(dob) #P4 #same as verse
- parray=[]
- dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,
- '<text:a xlink:type="simple" xlink:href="\1">\1</text:a>') #http ftp matches escaped, no decoration
- dob.obj.gsub!(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,
- %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{@brace_url.xml_close}})
- dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
- %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{@brace_url.xml_close}}) #http ftp matches with decoration
- dob.obj.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/).each do |parablock|
- parablock=group_clean(parablock)
- parablock.gsub!(/&lt;text:a xlink:type="simple" xlink:href="(.+?)"&gt;/m,'<text:a xlink:type="simple" xlink:href="\1">')
- parablock.gsub!(/&lt;(\/text:a)&gt;/,'<\1>')
- parablock.gsub!(/&lt;(text:note text:id=.+?)&gt;/,'<\1>')
- parablock.gsub!(/&lt;(text:p text:style-name="Footnote")&gt;/,'<\1>')
- parablock.gsub!(/&lt;(\/?text:(?:note-citation|note-body|note|p))&gt;/,'<\1>')
- parablock=footnote(parablock)
- parray << %{<text:p text:style-name="P4">#{parablock}</text:p>} if parablock =~/\S+/
- end
- dob.obj=parray.join + '<text:p text:style-name="Standard"/>'
- dob
- end
- def code(dob) #P5
- if dob.is=='code'
- dob.obj.gsub!(/\s\s/,'&#160;&#160;')
- parray=[]
- dob.obj.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/).each do |parablock|
- parablock=group_clean(parablock)
- parablock.gsub!(/^\s*$/,'<br />')
- parablock.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,
- '<text:a xlink:type="simple" xlink:href="\1">\1</text:a>') #http ftp matches escaped, no decoration
- parray << %{<text:p text:style-name="P20">#{parablock}</text:p>} if parablock =~/\S+/
- end
- dob.obj=parray.join + '<text:p text:style-name="Standard"/>'
- end
- dob
- end
- def table(dob) #
- if dob.is =='table'
- table=SiSU_ODF_format::Table.new(@md,dob)
- dob=table.table
- end
- dob
- end
- def obj_break(dob)
- if dob.is =='break'
- br=SiSU_ODF_format::Format_obj_break.new(@md,dob)
- if dob.obj==Mx[:br_page] \
- or dob.obj==Mx[:br_page_new]
- dob=br.br_page
- elsif dob.obj==Mx[:obj_ln_sep]
- dob=br.obj_sep
- end
- end
- dob
- end
- def odf_structure(md,dob)
- @md,@dob=md,dob
- dob=if dob.is !='code'
- dob=image(dob) if dob.obj =~/#{Mx[:lnk_o]}[ ]*\S+?\.(?:png|jpg|gif)\s.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/
- dob=text_link(dob) if dob.obj =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/
- dob=text_link_relative(dob) if dob.obj =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/
- dob
- else dob
- end
- dob=footnote(dob)
- if dob.is=='heading'
- @@odf[:body] << heading(dob).obj << @br*2
- elsif dob.is =='verse'
- @@odf[:body] << poem(dob).obj << @br*2
- elsif dob.is=='group'
- @@odf[:body] << group(dob).obj << @br*2
- elsif dob.is=='code'
- @@odf[:body] << code(dob).obj << @br*2
- elsif dob.is=='table' #elsif dob.obj =~ /<!Th?¡/u
- @@odf[:body] << table(dob).obj << @br*2
- elsif dob.is=='break'
- @@odf[:body] << obj_break(dob).obj << @br*2
- else
- @@odf[:body] << normal(dob).obj << @br*2 # main text, contents, body KEEP
- end
- @@endnotes_para=[]
- end
- def tidywords(wordlist)
- wordlist
- end
- def markup(data) # Used for major markup instructions
- safe_characters=/[^a-zA-Z0-9}{\/?,."';:)(><\-_&!@%~#\]\[*=$| \n+`#{Mx[:tc_p]}]/u
- dir=SiSU_Env::Info_env.new(@md.fns)
- dir.path.odf_bld
- @data_mod,@endnotes,@level,@cont,@copen,@odf_contents_close=Array.new(6){[]}
- @rcdc=false
- (0..6).each { |x| @cont[x]=@level[x]=false }
- (4..6).each { |x| @odf_contents_close[x]='' }
- odf_tail #($1,$2)
- fix=[]
- bullet=image_src('bullet_09.png')
- cp("#{bullet}/bullet_09.png","#{@env.path.odf}/Pictures/.") #if image_src('bullet_09.png')
- odf_metadata
- data.each do |dob|
- #p dob.obj if dob.obj =~safe_characters and @md.cmd =~/V/ #KEEP
- dob.obj='' if dob.obj =~/#{Mx[:lv_o]}\d+:.*?#{Mx[:lv_c]}.+?#{Mx[:pa_non_object_dummy_heading]}/ #fix Mx[:lv_o]
- para_array=[]
- dob.obj.gsub!(/</,'&lt;'); dob.obj.gsub!(/>/,'&gt;')
- word=dob.obj.scan(/\S+|\n/)
- if word
- word.each do |w| # _ - / # | : ! ^ ~
- unless dob =~/^(?:#{Rx[:meta]}|%+ )/m
- w.gsub!(/&#(?:126|152);/,'~') #126 usual
- w.gsub!(/&nbsp;/,'&#160;')
- if w !~/&\S{2,7}?;/
- w.gsub!(/&/,'&amp;')
- end
- w.gsub!(/(&\S{1,7};)+&/,'\1&amp;') #could break things
- end
- para_array << w
- end
- dob.obj=para_array.join(' ')
- dob.obj=dob.obj.strip
- end
- if dob.is=='code' #{Mx[:gr_o]}code#{Mx[:gr_c]}/ #fix #code-block: angle brackets special characters #fix
- dob.obj.gsub!(/(^|[^}])_(?:<|&lt;)/m,'\1&lt;'); dob.obj.gsub!(/(^|[^}])_(?:>|&gt;)/m,'\1&gt;')
- dob.obj.gsub!(/(^|[^}])_(?:<|&lt;)/m,'\1&lt;'); dob.obj.gsub!(/(^|[^}])_(?:>|&gt;)/m,'\1&gt;')
- end
- if dob.of=='group'
- dob.obj.gsub!(/#{Mx[:gl_bullet]}/,'● ')
- end
- dob.obj.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>')
- dob.obj.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'<ins>\1</ins>')
- dob.obj.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>')
- dob.obj.gsub!(/#{Mx[:tag_o]}\S+?#{Mx[:tag_c]}/,'') #check
- dob.obj.gsub!(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;')
- dob.obj.gsub!(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;')
- dob.obj.gsub!(/#{Mx[:mk_o]}[~-]##{Mx[:mk_c]}/,'')
- if dob.is=='para' \
- and dob.bullet_
- dob.obj='<draw:frame draw:style-name="gr1" text:anchor-type="as-char" svg:width="0.22cm" svg:height="0.22cm" draw:z-index="2"><draw:image xlink:href="Pictures/bullet_09.png" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/></draw:frame> ' +
- dob.obj
- end
- dob.obj.gsub!(/#{Mx[:br_line]}/,'<br />')
- dob.obj.gsub!(/&#169;/,'©') #too arbitrary
- dob.obj.gsub!(/.+?<-#>/,'') # remove dummy headings (used by html) #check
- dob.obj.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,
- '<text:span text:style-name="T1">\1</text:span>')
- dob.obj.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,
- '<text:span text:style-name="T2">\1</text:span>')
- dob.obj.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,
- '<text:span text:style-name="T3">\1</text:span>')
- dob.obj.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,
- '<text:span text:style-name="T4">\1</text:span>')
- dob.obj.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,
- '<text:span text:style-name="T5">\1</text:span>')
- dob.obj.gsub!(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,
- '<text:span text:style-name="T7">\1</text:span>')
- dob.obj.gsub!(/­/u,'-')
- dob.obj.gsub!(/ /u, ' ') # space identify
- dob.obj.gsub!(/ /u, ' ') # space identify
- dob.obj.gsub!(/·/u,'*')
- dob.obj.gsub!(/[­–—]/u,'-') #— – chk
- dob.obj.gsub!(/ < /i,'&#060;')
- dob.obj.gsub!(/\\copy(?:right)?\b/,'&#169;')
- dob.obj.gsub!(/\\trademark\b|\\tm\b/,'&#174;')
- dob.obj.gsub!(/\44/,'&#36;') #$ watch
- dob.obj.gsub!(/<a href=".+?">(.+?)<\/a>/,'\1')
- dob.obj.gsub!(/#{Mx[:mk_o]}name#\S+?#{Mx[:mk_c]}/,'') # remove name links
- wordlist=dob.obj.scan(/\S+/)
- dob.obj=tidywords(wordlist).join(' ').strip
- @rcdc=true if @rcdc==false \
- and (dob.obj =~/~metadata/ or dob =~/#{Mx[:lv_o]}1:meta#{Mx[:lv_x]}\s*Document Information/) #fix Mx[:lv_o]
- if dob.is !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/
- if defined? dob.ocn and dob.ocn =~/\d+/
- @p_num=SiSU_ODF_format::Paragraph_number.new(dob.ocn)
- end
- if dob.is=~/heading|para|group|verse|code|table|break/ # extend, include other types
- odf_structure(@md,dob)
- end
- dob.obj.gsub!(/<!.+!>/,' ') if dob.obj ## Clean Prepared Text
- dob.obj.gsub!(/#{Mx[:tc_o]}.+?#{Mx[:tc_c]}/,' ') if dob.obj ## CHECK Clean Prepared Text
- dob.obj.gsub!(/<:\S+>/,' ') if dob.obj ## Clean Prepared Text
- end
- end
- end
- def pre
- table=if @md.flag_tables
- x=<<WOK
- <style:style style:name="Table1" style:family="table"><style:table-properties style:width="16.999cm" table:align="margins"/></style:style>
- <style:style style:name="Table1.A" style:family="table-column"><style:table-column-properties style:column-width="16.999cm" style:rel-column-width="65535*"/></style:style>
- <style:style style:name="Table1.B" style:family="table-column"><style:table-column-properties style:column-width="8.499cm" style:rel-column-width="32767*"/></style:style>
- <style:style style:name="Table1.C" style:family="table-column"><style:table-column-properties style:column-width="5.666cm" style:rel-column-width="21845*"/></style:style>
- <style:style style:name="Table1.D" style:family="table-column"><style:table-column-properties style:column-width="4.349cm" style:rel-column-width="16383*"/></style:style>
- <style:style style:name="Table1.E" style:family="table-column"><style:table-column-properties style:column-width="3.399cm" style:rel-column-width="13107*"/></style:style>
- <style:style style:name="Table1.F" style:family="table-column"><style:table-column-properties style:column-width="2.833cm" style:rel-column-width="10922*"/></style:style>
- <style:style style:name="Table1.G" style:family="table-column"><style:table-column-properties style:column-width="2.428cm" style:rel-column-width="9362*"/></style:style>
- <style:style style:name="Table1.H" style:family="table-column"><style:table-column-properties style:column-width="2.124cm" style:rel-column-width="8191*"/></style:style>
- <style:style style:name="Table2" style:family="table"><style:table-properties style:width="16.999cm" table:align="margins"/></style:style>
- <style:style style:name="Table2.A" style:family="table-column"><style:table-column-properties style:column-width="16.999cm" style:rel-column-width="65535*"/></style:style>
- <style:style style:name="Table2.B" style:family="table-column"><style:table-column-properties style:column-width="8.499cm" style:rel-column-width="32767*"/></style:style>
- <style:style style:name="Table2.C" style:family="table-column"><style:table-column-properties style:column-width="5.666cm" style:rel-column-width="21845*"/></style:style>
- <style:style style:name="Table2.D" style:family="table-column"><style:table-column-properties style:column-width="4.349cm" style:rel-column-width="16383*"/></style:style>
- <style:style style:name="Table2.E" style:family="table-column"><style:table-column-properties style:column-width="3.999cm" style:rel-column-width="13107*"/></style:style>
- <style:style style:name="Table2.F" style:family="table-column"><style:table-column-properties style:column-width="2.833cm" style:rel-column-width="10922*"/></style:style>
- <style:style style:name="Table2.G" style:family="table-column"><style:table-column-properties style:column-width="2.428cm" style:rel-column-width="9362*"/></style:style>
- <style:style style:name="Table2.H" style:family="table-column"><style:table-column-properties style:column-width="2.124cm" style:rel-column-width="8191*"/></style:style>
- <style:style style:name="Table2.I" style:family="table-column"><style:table-column-properties style:column-width="1.8887cm" style:rel-column-width="7281*"/></style:style>
- <style:style style:name="Table2.J" style:family="table-column"><style:table-column-properties style:column-width="1.6999cm" style:rel-column-width="6553*"/></style:style>
- <style:style style:name="Table2.K" style:family="table-column"><style:table-column-properties style:column-width="1.5453cm" style:rel-column-width="5957*"/></style:style>
- <style:style style:name="Table2.L" style:family="table-column"><style:table-column-properties style:column-width="1.416cm" style:rel-column-width="5461*"/></style:style>
- <style:style style:name="Table2.M" style:family="table-column"><style:table-column-properties style:column-width="1.307" style:rel-column-width="5041*"/></style:style>
- <style:style style:name="Table2.N" style:family="table-column"><style:table-column-properties style:column-width="1.214cm" style:rel-column-width="4681*"/></style:style>
-WOK
- x.strip!
- x.gsub!(/\n+/m,'') unless @md.opt.cmd=~/M/
- x
- else ''
- end
- breakpage=if @md.pagenew \
- or @md.pagebreak
- ' fo:break-before="page"'
- else ''
- end
- x=<<WOK
-<?xml version="1.0" encoding="UTF-8"?>
-<office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" office:version="1.0"><office:scripts/>
-<office:font-face-decls><style:font-face style:name="DejaVu Sans Mono" svg:font-family="'DejaVu Sans Mono'" style:font-adornments="Book" style:font-family-generic="modern" style:font-pitch="fixed"/><style:font-face style:name="Inconsolata" svg:font-family="Inconsolata" style:font-adornments="Regular" style:font-pitch="fixed"/><style:font-face style:name="Liberation Mono" svg:font-family="'Liberation Mono'" style:font-adornments="Regular" style:font-family-generic="modern" style:font-pitch="fixed"/><style:font-face style:name="DejaVu Sans" svg:font-family="'DejaVu Sans'" style:font-adornments="ExtraLight" style:font-family-generic="swiss" style:font-pitch="variable"/><style:font-face style:name="Nimbus Sans L" svg:font-family="&apos;Nimbus Sans L&apos;" style:font-pitch="variable"/><style:font-face style:name="Tahoma" svg:font-family="Tahoma, Lucidasans, &apos;Lucida Sans&apos;, &apos;Arial Unicode MS&apos;" style:font-pitch="variable"/><style:font-face style:name="DejaVu Serif" svg:font-family="'DejaVu Sans'" style:font-adornments="ExtraLight" style:font-family-generic="swiss" style:font-pitch="variable"/><style:font-face style:name="Nimbus Roman No9 L" svg:font-family="&apos;Nimbus Roman No9 L&apos;" style:font-family-generic="roman" style:font-pitch="variable"/><style:font-face style:name="Bitstream Vera Sans" svg:font-family="&apos;Bitstream Vera Sans&apos;" style:font-family-generic="swiss" style:font-pitch="variable"/></office:font-face-decls>
-<office:automatic-styles>
-#{table}
- <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:text-align="justify" style:justify-single-word="false"/></style:style>
- <style:style style:name="P2" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:text-align="justify" style:justify-single-word="false"/></style:style>
- <style:style style:name="P3" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:text-align="justify" style:justify-single-word="false"/></style:style>
- <style:style style:name="P4" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0cm" fo:line-height="100%" fo:text-align="justify" style:justify-single-word="false"/></style:style>
- <style:style style:name="P5" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0cm" fo:line-height="100%" fo:text-align="start" style:justify-single-word="false"/></style:style>
- <style:style style:name="P6" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:break-before="page"/></style:style>
- <style:style style:name="P7" style:family="paragraph" style:parent-style-name="Table_20_Contents"><style:paragraph-properties fo:text-align="justify" style:justify-single-word="false"/></style:style>
- <style:style style:name="P8" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:break-before="page"/></style:style>
- <style:style style:name="P9" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:break-after="page"/></style:style>
- <style:style style:name="P10" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:text-align="justify" style:justify-single-word="false"/></style:style>
- <style:style style:name="P11" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:margin-left="1cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/></style:style>
- <style:style style:name="P12" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:margin-left="2cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/></style:style>
- <style:style style:name="P13" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:margin-left="3cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/></style:style>
- <style:style style:name="P14" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:margin-left="4cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/></style:style>
- <style:style style:name="P15" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:margin-left="5cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/></style:style>
- <style:style style:name="P16" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:margin-left="6cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/></style:style>
- <style:style style:name="P17" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:margin-left="7cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/></style:style>
- <style:style style:name="P18" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:margin-left="8cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/></style:style>
- <style:style style:name="P19" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:margin-left="8cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/></style:style>
- <style:style style:name="P20" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0cm" fo:line-height="100%" fo:text-align="start" style:justify-single-word="false"/><style:text-properties style:font-name="DejaVu Sans Mono" fo:font-size="9pt" fo:font-weight="normal" fo:background-color="#e6e6e6"/></style:style>
- <style:style style:name="T1" style:family="text"><style:text-properties fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold"/></style:style>
- <style:style style:name="T2" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic"/></style:style>
- <style:style style:name="T3" style:family="text"><style:text-properties style:text-underline-style="solid" style:text-underline-width="auto" style:text-underline-color="font-color"/></style:style>
- <style:style style:name="T4" style:family="text"><style:text-properties style:text-position="super 58%"/></style:style>
- <style:style style:name="T5" style:family="text"><style:text-properties style:text-position="sub 58%"/></style:style>
- <style:style style:name="T6" style:family="text"><style:text-properties style:font-name="Courier 10 Pitch" fo:font-size="12pt"/></style:style>
- <style:style style:name="T7" style:family="text"><style:text-properties style:font-name="DejaVu Sans Mono" fo:font-size="10pt" fo:font-weight="normal" fo:background-color="#e6e6e6"/></style:style>
- <style:style style:name="fr1" style:family="graphic" style:parent-style-name="Graphics"><style:graphic-properties style:wrap="none" style:horizontal-pos="left" style:horizontal-rel="paragraph" style:mirror="none" fo:clip="rect(0cm 0cm 0cm 0cm)" draw:luminance="0%" draw:contrast="0%" draw:red="0%" draw:green="0%" draw:blue="0%" draw:gamma="100%" draw:color-inversion="false" draw:image-opacity="100%" draw:color-mode="standard"/></style:style>
- <style:style style:name="gr1" style:family="graphic"><style:graphic-properties draw:stroke="none" draw:fill="none" draw:textarea-horizontal-align="center" draw:textarea-vertical-align="middle" draw:color-mode="standard" draw:luminance="0%" draw:contrast="0%" draw:gamma="100%" draw:red="0%" draw:green="0%" draw:blue="0%" fo:clip="rect(0cm 0cm 0cm 0cm)" draw:image-opacity="100%" style:mirror="none" style:run-through="background" style:wrap="none" style:vertical-pos="top" style:vertical-rel="baseline" style:horizontal-pos="left" style:horizontal-rel="paragraph" draw:wrap-influence-on-position="once-concurrent" style:flow-with-text="false"/></style:style>
- <style:style style:name="gr2" style:family="graphic"><style:graphic-properties draw:stroke="none" draw:fill="none" draw:textarea-horizontal-align="center" draw:textarea-vertical-align="middle" draw:color-mode="standard" draw:luminance="0%" draw:contrast="0%" draw:gamma="100%" draw:red="0%" draw:green="0%" draw:blue="0%" fo:clip="rect(0cm 0cm 0cm 0cm)" draw:image-opacity="100%" style:mirror="none" style:run-through="background" style:wrap="none" style:vertical-pos="middle" style:vertical-rel="baseline" style:horizontal-pos="left" style:horizontal-rel="paragraph" draw:wrap-influence-on-position="once-concurrent" style:flow-with-text="false"/></style:style>
-</office:automatic-styles>
-<office:body>
- <office:text><office:forms form:automatic-focus="false" form:apply-design-mode="false"/>
- <text:sequence-decls><text:sequence-decl text:display-outline-level="0" text:name="Illustration"/><text:sequence-decl text:display-outline-level="0" text:name="Table"/><text:sequence-decl text:display-outline-level="0" text:name="Text"/><text:sequence-decl text:display-outline-level="0" text:name="Drawing"/></text:sequence-decls>
-WOK
- x.strip!
- x.gsub!(/\n+/m,'') unless @md.opt.cmd=~/M/
- @@odf[:head] << x
- end
- def post
- end
- def publish
- divider='='
- content=[]
- data=@data
- content << @@odf[:open]
- content << @@odf[:head]
- content << @@odf[:body]
- content << @@odf[:metadata]
- content << @@odf[:tail]
- Output.new(content,@md,@env).odf
- @@odf[:head],@@odf[:body],@@odf[:tail],@@odf[:metadata]=[],[],[],[]
- end
- end
- class Output <Source
- def initialize(content,md,env)
- @content,@md,@env=content,md,env
- end
- def odf #%odf output
- SiSU_Env::SiSU_file.new(@md).mkdir
- header=SiSU_ODF_format::ODT_head.new(@md)
- filename="#{@env.path.odf}/META-INF/manifest.xml"
- od=File.new(filename,'w+')
- od << header.meta_inf_manifest_xml
- od.close
- filename="#{@env.path.odf}/meta.xml"
- od=File.new(filename,'w+')
- od << header.meta_xml
- od.close
- filename="#{@env.path.odf}/settings.xml"
- od=File.new(filename,'w+')
- od << header.settings_xml
- od.close
- filename="#{@env.path.odf}/styles.xml"
- od=File.new(filename,'w+')
- od << header.styles_xml
- od.close
- filename="#{@env.path.odf}/mimetype"
- od=File.new(filename,'w+')
- od << header.mimetype
- od.close
- filename="#{@env.path.odf}/content.xml"
- od=File.new(filename,'w+')
- @content.each do |para| # this is a hack
- od.puts para unless para =~/\A\s*\Z/
- end
- od.close
- opendoc=@md.fn[:odf]
- system("
- cd #{@env.path.odf}
- zip -qr #{opendoc} *
- mv #{opendoc} #{@env.path.output}/#{@md.fnb}/.
- cd #{Dir.pwd}
- ")
- end
- end
- end
-end
-__END__
-todo:
-* table of contents
-* page header/footer?
-
-done:
-headings *
-footnotes *
-bold underscore italics strikethrough *
-superscript subscript *
-extended ascii set *
-indents *
- [autonomy_markup0.sst] *
-groups
- poem *
- code *
- tables
-images
-bullet
-line break
-page break
-
-notes?? [you could add a note number for every object/paragraph!]
-
- cd(@env.path.odf)
- structure=[]
- Find.find(@env.path.odf) do |f|
- structure << puts f
- end
- open(opendoc,'wb') do |f|
- zip=Zlib::ZipWriter.new(f)
- structure.each |z| do
- zip << z
- end
- zip.close
- end
- #zip -qr #{opendoc} *
- mv(opendoc,"#{@env.path.output}/#{@md.fnb}/.")
- cd(Dir.pwd)
-●
-<text:span text:style-name="T6">●</text:span> #bullet
-dob.obj.gsub!(/^(#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]})\s*#{Mx[:gl_bullet]}/,'\1 <text:span text:style-name="T6">·</text:span> ') #bullet
-dob.obj.gsub!(/^#{Mx[:gl_bullet]}/,'<text:span text:style-name="T6">·</text:span> ') #bullet
diff --git a/lib/sisu/v2/odf_format.rb b/lib/sisu/v2/odf_format.rb
deleted file mode 100644
index 1b5f2e9b..00000000
--- a/lib/sisu/v2/odf_format.rb
+++ /dev/null
@@ -1,468 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: opendocument formatting, default opendocument template
-
-=end
-module SiSU_ODF_format
- require "#{SiSU_lib}/param" # param.rb
- include SiSU_Param
- include SiSU_Viz
- class Paragraph_number
- def initialize(paranum)
- @paranum=/(\d+)/m.match(paranum)[1]
- end
- def display
- @paranum.gsub(/(\d+)/,'<font size="1" color="#777777">&nbsp;&nbsp;\1</font>')
- end
- def name
- @paranum.gsub(/(\d+)/,'<a name="\1"></a>')
- end
- def goto
- @paranum.gsub(/(\d+)/,'<a href="#\1">')
- end
- end
- class Format_text_object
- def initialize(md,t_o)
- @md,@t_o=md,t_o
- if t_o.class==Hash
- @txt =t_o[:txt] || nil
- else
- p t_o.class
- p caller
- end
- rgx=/#{Mx[:en_a_o]}\d+\s+(.+?)#{Mx[:en_a_c]}/
- @txt.gsub!(rgx,'\1') if @txt =~rgx
- @vz=SiSU_Env::Get_init.instance.skin
- end
- def scr_endnote_body
- "<endnote>#{@txt}</endnote> "
- end
- def heading_body1
- end
- def heading_body2
- end
- def heading_body3
- end
- def heading_body4
- end
- def heading_body5
- end
- def heading_body6
- end
- end
- class Table
- @@tablehead,@@table_counter=0,0 #reinitialise on new file
- @@tablefoot=[] #watch
- @@fns=''
- def initialize(md,dob)
- @md,@dob,@txt,@vz=md,dob,dob.obj,SiSU_Env::Get_init.instance.skin
- if @md.fns != @@fns
- @@table_counter=0
- @@fns=@md.fns
- end
- end
- def table_head_open(count)
- type=if @dob.head_; 1
- else 2
- end
- alpha=case @dob.cols
- when 1; 'A'
- when 2; 'B'
- when 3; 'C'
- when 4; 'D'
- when 5; 'E'
- when 6; 'F'
- when 7; 'G'
- when 8; 'H'
- when 9; 'I'
- when 10; 'J'
- when 11; 'K'
- when 12; 'L'
- when 13; 'M'
- when 14; 'N'
- else 'D'
- end
- %{<table:table table:name="Table#{count}" table:style-name="Table#{type}">#{@br}} +
- %{<table:table-column table:style-name="Table#{type}.#{alpha}" table:number-columns-repeated="#{@dob.cols}"/>#{@br}}
- end
- def table_close(tablefoot='')
- '</table:table>'
- end
- def table_tag_cell(str,i)
- txt_name_cell=if i==0 \
- and @dob.head_
- 'Table_20_Heading'
- else 'P7'
- end
- str.gsub!(/^~$/,'') # tilde / empty cell
- %{<table:table-cell office:value-type="string">#{@br}} +
- %{<text:p text:style-name="#{txt_name_cell}">#{@br}} +
- %{#{str}} +
- %{</text:p>#{@br}} +
- %{</table:table-cell>#{@br}}
- end
- def table_tag_row(str,i)
- %{<table:table-row>#{@br}} +
- %{#{str}} +
- %{</table:table-row>#{@br}}
- end
- def table_tag_row_dump(str,i)
- txt_name_row=if i==0 \
- and @dob.head_
- 'Table_20_Heading'
- else 'P7'
- end
- %{<table:table-row>#{@br}} +
- %{<table:table-cell office:value-type="string">#{@br}} +
- %{<text:p text:style-name="#{txt_name_row}">#{@br}}
- %{#{str}} +
- %{</text:p>#{@br}} +
- %{</table:table-cell>#{@br}} +
- %{</table:table-row>#{@br}}
- end
- def table_row(row,i)
- row='' if row =~/^<!$/
- m=row[/<!f(.+?)!>/,1]
- @@tablefoot << m if m
- row.gsub!(/<!f.+?!>/,'')
- @cells=[]
- row.split(/\s*#{Mx[:tc_p]}/).each do |cell|
- @cells << table_tag_cell(cell,i)
- end
- row=@cells.join
- row=table_tag_row(row,i)
- row
- end
- def table
- @@table_counter+=1
- table_head_open(@@table_counter)
- @table=[]
- @dob.obj.split(/\s*#{Mx[:tc_c]}/).each_with_index do |r,i|
- @table << table_row(r,i)
- end
- @dob.obj= table_head_open(@@table_counter) + @table.join + table_close
- @dob
- end
- end
- class ODT_head
- def initialize(md)
- @md=md
- @generator="#{@md.sisu_version[:project]} #{@md.sisu_version[:version]} #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})"
- end
- def meta_inf_manifest_xml
- x=<<WOK
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE manifest:manifest PUBLIC "-//OpenOffice.org//DTD Manifest 1.0//EN" "Manifest.dtd">
-<manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0">
- <manifest:file-entry manifest:media-type="application/vnd.oasis.opendocument.text" manifest:full-path="/"/>
- <manifest:file-entry manifest:media-type="application/vnd.sun.xml.ui.configuration" manifest:full-path="Configurations2/"/>
- <manifest:file-entry manifest:media-type="" manifest:full-path="Pictures/"/>
- <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="content.xml"/>
- <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="styles.xml"/>
- <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="meta.xml"/>
- <manifest:file-entry manifest:media-type="" manifest:full-path="Thumbnails/thumbnail.png"/>
- <manifest:file-entry manifest:media-type="" manifest:full-path="Thumbnails/"/>
- <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="settings.xml"/>
-</manifest:manifest>
-WOK
- x.strip!
- x.gsub!(/\n+/m,'') unless @md.opt.cmd=~/M/
- x
- end
- def meta_xml
- x=<<WOK
-<?xml version="1.0" encoding="UTF-8"?>
-<office:document-meta xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:ooo="http://openoffice.org/2004/office" office:version="1.0">
- <office:meta>
- <meta:generator>#{@generator}</meta:generator>
- <meta:creation-date>#{@md.generated}</meta:creation-date>
- <dc:date>#{@md.generated}</dc:date>
- <dc:language>en-US</dc:language>
- <meta:editing-cycles>4</meta:editing-cycles>
- </office:meta>
-</office:document-meta>
-WOK
- x.strip!
- x.gsub!(/\n+/m,'') unless @md.opt.cmd=~/M/
- x
- end
- def settings_xml
- x=<<WOK
-<?xml version="1.0" encoding="UTF-8"?>
-<office:document-settings xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" office:version="1.0">
- <office:settings>
- <config:config-item-set config:name="ooo:view-settings">
- <config:config-item config:name="ViewAreaTop" config:type="int">0</config:config-item>
- <config:config-item config:name="ViewAreaLeft" config:type="int">0</config:config-item>
- <config:config-item config:name="ViewAreaWidth" config:type="int">21459</config:config-item>
- <config:config-item config:name="ViewAreaHeight" config:type="int">22068</config:config-item>
- <config:config-item config:name="ShowRedlineChanges" config:type="boolean">true</config:config-item>
- <config:config-item config:name="InBrowseMode" config:type="boolean">false</config:config-item>
- <config:config-item-map-indexed config:name="Views">
- <config:config-item-map-entry>
- <config:config-item config:name="ViewId" config:type="string">view2</config:config-item>
- <config:config-item config:name="ViewLeft" config:type="int">3002</config:config-item>
- <config:config-item config:name="ViewTop" config:type="int">11008</config:config-item>
- <config:config-item config:name="VisibleLeft" config:type="int">0</config:config-item>
- <config:config-item config:name="VisibleTop" config:type="int">0</config:config-item>
- <config:config-item config:name="VisibleRight" config:type="int">21458</config:config-item>
- <config:config-item config:name="VisibleBottom" config:type="int">22066</config:config-item>
- <config:config-item config:name="ZoomType" config:type="short">0</config:config-item>
- <config:config-item config:name="ZoomFactor" config:type="short">100</config:config-item>
- <config:config-item config:name="IsSelectedFrame" config:type="boolean">false</config:config-item>
- </config:config-item-map-entry>
- </config:config-item-map-indexed>
- </config:config-item-set>
- <config:config-item-set config:name="ooo:configuration-settings">
- <config:config-item config:name="AddParaTableSpacing" config:type="boolean">true</config:config-item>
- <config:config-item config:name="PrintReversed" config:type="boolean">false</config:config-item>
- <config:config-item config:name="LinkUpdateMode" config:type="short">1</config:config-item>
- <config:config-item config:name="IgnoreFirstLineIndentInNumbering" config:type="boolean">false</config:config-item>
- <config:config-item config:name="CharacterCompressionType" config:type="short">0</config:config-item>
- <config:config-item config:name="PrintSingleJobs" config:type="boolean">false</config:config-item>
- <config:config-item config:name="UpdateFromTemplate" config:type="boolean">false</config:config-item>
- <config:config-item config:name="PrintPaperFromSetup" config:type="boolean">false</config:config-item>
- <config:config-item config:name="AddFrameOffsets" config:type="boolean">false</config:config-item>
- <config:config-item config:name="PrintLeftPages" config:type="boolean">true</config:config-item>
- <config:config-item config:name="RedlineProtectionKey" config:type="base64Binary"/>
- <config:config-item config:name="PrintTables" config:type="boolean">true</config:config-item>
- <config:config-item config:name="ChartAutoUpdate" config:type="boolean">true</config:config-item>
- <config:config-item config:name="PrintControls" config:type="boolean">true</config:config-item>
- <config:config-item config:name="PrinterSetup" config:type="base64Binary"/>
- <config:config-item config:name="PrintAnnotationMode" config:type="short">0</config:config-item>
- <config:config-item config:name="LoadReadonly" config:type="boolean">false</config:config-item>
- <config:config-item config:name="AddParaSpacingToTableCells" config:type="boolean">true</config:config-item>
- <config:config-item config:name="AddExternalLeading" config:type="boolean">true</config:config-item>
- <config:config-item config:name="ApplyUserData" config:type="boolean">true</config:config-item>
- <config:config-item config:name="FieldAutoUpdate" config:type="boolean">true</config:config-item>
- <config:config-item config:name="SaveVersionOnClose" config:type="boolean">false</config:config-item>
- <config:config-item config:name="SaveGlobalDocumentLinks" config:type="boolean">false</config:config-item>
- <config:config-item config:name="IsKernAsianPunctuation" config:type="boolean">false</config:config-item>
- <config:config-item config:name="AlignTabStopPosition" config:type="boolean">true</config:config-item>
- <config:config-item config:name="CurrentDatabaseDataSource" config:type="string"/>
- <config:config-item config:name="PrinterName" config:type="string"/>
- <config:config-item config:name="PrintFaxName" config:type="string"/>
- <config:config-item config:name="ConsiderTextWrapOnObjPos" config:type="boolean">false</config:config-item>
- <config:config-item config:name="PrintRightPages" config:type="boolean">true</config:config-item>
- <config:config-item config:name="IsLabelDocument" config:type="boolean">false</config:config-item>
- <config:config-item config:name="UseFormerLineSpacing" config:type="boolean">false</config:config-item>
- <config:config-item config:name="AddParaTableSpacingAtStart" config:type="boolean">true</config:config-item>
- <config:config-item config:name="UseFormerTextWrapping" config:type="boolean">false</config:config-item>
- <config:config-item config:name="PrintProspect" config:type="boolean">false</config:config-item>
- <config:config-item config:name="PrintGraphics" config:type="boolean">true</config:config-item>
- <config:config-item config:name="AllowPrintJobCancel" config:type="boolean">true</config:config-item>
- <config:config-item config:name="CurrentDatabaseCommandType" config:type="int">0</config:config-item>
- <config:config-item config:name="DoNotJustifyLinesWithManualBreak" config:type="boolean">false</config:config-item>
- <config:config-item config:name="UseFormerObjectPositioning" config:type="boolean">false</config:config-item>
- <config:config-item config:name="PrinterIndependentLayout" config:type="string">high-resolution</config:config-item>
- <config:config-item config:name="UseOldNumbering" config:type="boolean">false</config:config-item>
- <config:config-item config:name="PrintPageBackground" config:type="boolean">true</config:config-item>
- <config:config-item config:name="CurrentDatabaseCommand" config:type="string"/>
- <config:config-item config:name="PrintDrawings" config:type="boolean">true</config:config-item>
- <config:config-item config:name="PrintBlackFonts" config:type="boolean">false</config:config-item>
- </config:config-item-set>
- </office:settings>
-</office:document-settings>
-WOK
- x.strip!
- x.gsub!(/\n+/m,'') unless @md.opt.cmd=~/M/
- x
- end
- def styles_xml
- x=<<WOK
-<?xml version="1.0" encoding="UTF-8"?>
-<office:document-styles xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" office:version="1.0">
- <office:font-face-decls>
- <style:font-face style:name="HG Mincho Light J" svg:font-family="'HG Mincho Light J', 'MS Mincho', 'HG Mincho J', 'HG Mincho L', 'HG Mincho', Mincho, 'MS PMincho', 'HG Mincho Light J', 'MS Gothic', 'HG Gothic J', 'HG Gothic B', 'HG Gothic', Gothic, 'MS PGothic', 'Andale Sans UI', 'Arial Unicode MS', 'Lucida Sans Unicode', Tahoma" style:font-pitch="variable"/>
- <style:font-face style:name="Nimbus Sans L" svg:font-family="'Nimbus Sans L'" style:font-pitch="variable"/>
- <style:font-face style:name="Tahoma" svg:font-family="Tahoma, Lucidasans, 'Lucida Sans', 'Arial Unicode MS'" style:font-pitch="variable"/>
- <style:font-face style:name="Nimbus Roman No9 L" svg:font-family="'Nimbus Roman No9 L'" style:font-family-generic="roman" style:font-pitch="variable"/>
- <style:font-face style:name="Bitstream Vera Sans" svg:font-family="'Bitstream Vera Sans'" style:font-family-generic="swiss" style:font-pitch="variable"/>
- </office:font-face-decls>
- <office:styles>
- <style:default-style style:family="graphic">
- <style:graphic-properties draw:shadow-offset-x="0.3cm" draw:shadow-offset-y="0.3cm" draw:start-line-spacing-horizontal="0.283cm" draw:start-line-spacing-vertical="0.283cm" draw:end-line-spacing-horizontal="0.283cm" draw:end-line-spacing-vertical="0.283cm" style:flow-with-text="false"/>
- <style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" style:writing-mode="lr-tb" style:font-independent-line-spacing="false">
- <style:tab-stops/>
- </style:paragraph-properties>
- <style:text-properties style:use-window-font-color="true" fo:font-size="12pt" fo:language="en" fo:country="US" style:font-size-asian="12pt" style:language-asian="none" style:country-asian="none" style:font-size-complex="12pt" style:language-complex="none" style:country-complex="none"/>
- </style:default-style>
- <style:default-style style:family="paragraph">
- <style:paragraph-properties fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="1.251cm" style:writing-mode="page"/>
- <style:text-properties style:use-window-font-color="true" style:font-name="Nimbus Roman No9 L" fo:font-size="12pt" fo:language="en" fo:country="US" style:font-name-asian="Nimbus Sans L" style:font-size-asian="12pt" style:language-asian="none" style:country-asian="none" style:font-name-complex="Nimbus Sans L" style:font-size-complex="12pt" style:language-complex="none" style:country-complex="none" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2"/>
- </style:default-style>
- <style:default-style style:family="table">
- <style:table-properties table:border-model="collapsing"/>
- </style:default-style>
- <style:default-style style:family="table-row">
- <style:table-row-properties fo:keep-together="auto"/>
- </style:default-style>
- <style:style style:name="Standard" style:family="paragraph" style:class="text"/>
- <style:style style:name="Text_20_body" style:display-name="Text body" style:family="paragraph" style:parent-style-name="Standard" style:class="text">
- <style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0.212cm"/>
- </style:style>
- <style:style style:name="Heading" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Text_20_body" style:class="text">
- <style:paragraph-properties fo:margin-top="0.423cm" fo:margin-bottom="0.212cm" fo:keep-with-next="always"/>
- <style:text-properties style:font-name="Bitstream Vera Sans" fo:font-size="14pt" style:font-name-asian="HG Mincho Light J" style:font-size-asian="14pt" style:font-name-complex="Tahoma" style:font-size-complex="14pt"/>
- </style:style>
- <style:style style:name="Heading_20_1" style:display-name="Heading 1" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:class="text" style:default-outline-level="1">
- <style:text-properties fo:font-size="120%" fo:font-weight="bold" style:font-size-asian="120%" style:font-weight-asian="bold" style:font-size-complex="115%" style:font-weight-complex="bold"/>
- </style:style>
- <style:style style:name="Heading_20_2" style:display-name="Heading 2" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:class="text" style:default-outline-level="2">
- <style:text-properties fo:font-size="115%" fo:font-weight="bold" style:font-size-asian="115%" style:font-weight-asian="bold" style:font-size-complex="115%" style:font-weight-complex="bold"/>
- </style:style>
- <style:style style:name="Heading_20_3" style:display-name="Heading 3" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:class="text" style:default-outline-level="3">
- <style:text-properties fo:font-size="110%" fo:font-weight="bold" style:font-size-asian="110%" style:font-weight-asian="bold" style:font-size-complex="115%" style:font-weight-complex="bold"/>
- </style:style>
- <style:style style:name="Heading_20_4" style:display-name="Heading 4" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:class="text" style:default-outline-level="4">
- <style:text-properties fo:font-size="100%" fo:font-style="italic" fo:font-weight="bold" style:font-size-asian="100%" style:font-style-asian="italic" style:font-weight-asian="bold" style:font-size-complex="100%" style:font-style-complex="italic" style:font-weight-complex="bold"/>
- </style:style>
- <style:style style:name="Heading_20_5" style:display-name="Heading 5" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:class="text" style:default-outline-level="5">
- <style:text-properties fo:font-size="90%" fo:font-style="italic" fo:font-weight="bold" style:font-size-asian="90%" style:font-style-asian="italic" style:font-weight-asian="bold" style:font-size-complex="90%" style:font-style-complex="italic" style:font-weight-complex="bold"/>
- </style:style>
- <style:style style:name="Heading_20_6" style:display-name="Heading 6" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:class="text" style:default-outline-level="6">
- <style:text-properties fo:font-size="80%" fo:font-style="italic" fo:font-weight="bold" style:font-size-asian="80%" style:font-style-asian="italic" style:font-weight-asian="bold" style:font-size-complex="80%" style:font-style-complex="italic" style:font-weight-complex="bold"/>
- </style:style>
- <style:style style:name="Footnote" style:family="paragraph" style:parent-style-name="Standard" style:class="extra">
- <style:paragraph-properties fo:margin-left="0.499cm" fo:margin-right="0cm" fo:text-indent="-0.499cm" style:auto-text-indent="false" text:number-lines="false" text:line-number="0"/>
- <style:text-properties fo:font-size="10pt" style:font-size-asian="10pt" style:font-size-complex="10pt"/>
- </style:style>
- <style:style style:name="Footnote_20_Symbol" style:display-name="Footnote Symbol" style:family="text"/>
- <style:style style:name="Footnote_20_anchor" style:display-name="Footnote anchor" style:family="text">
- <style:text-properties style:text-position="super 58%"/>
- </style:style>
- <style:style style:name="Graphics" style:family="graphic">
- <style:graphic-properties text:anchor-type="paragraph" svg:x="0cm" svg:y="0cm" style:wrap="dynamic" style:number-wrapped-paragraphs="no-limit" style:wrap-contour="false" style:vertical-pos="top" style:vertical-rel="paragraph" style:horizontal-pos="center" style:horizontal-rel="paragraph"/>
- </style:style>
- <text:outline-style>
- <text:outline-level-style text:level="1" style:num-format="">
- <style:list-level-properties text:min-label-distance="0.381cm"/>
- </text:outline-level-style>
- <text:outline-level-style text:level="2" style:num-format="">
- <style:list-level-properties text:min-label-distance="0.381cm"/>
- </text:outline-level-style>
- <text:outline-level-style text:level="3" style:num-format="">
- <style:list-level-properties text:min-label-distance="0.381cm"/>
- </text:outline-level-style>
- <text:outline-level-style text:level="4" style:num-format="">
- <style:list-level-properties text:min-label-distance="0.381cm"/>
- </text:outline-level-style>
- <text:outline-level-style text:level="5" style:num-format="">
- <style:list-level-properties text:min-label-distance="0.381cm"/>
- </text:outline-level-style>
- <text:outline-level-style text:level="6" style:num-format="">
- <style:list-level-properties text:min-label-distance="0.381cm"/>
- </text:outline-level-style>
- <text:outline-level-style text:level="7" style:num-format="">
- <style:list-level-properties text:min-label-distance="0.381cm"/>
- </text:outline-level-style>
- <text:outline-level-style text:level="8" style:num-format="">
- <style:list-level-properties text:min-label-distance="0.381cm"/>
- </text:outline-level-style>
- <text:outline-level-style text:level="9" style:num-format="">
- <style:list-level-properties text:min-label-distance="0.381cm"/>
- </text:outline-level-style>
- <text:outline-level-style text:level="10" style:num-format="">
- <style:list-level-properties text:min-label-distance="0.381cm"/>
- </text:outline-level-style>
- </text:outline-style>
- <text:notes-configuration text:note-class="footnote" text:citation-style-name="Footnote_20_Symbol" text:citation-body-style-name="Footnote_20_anchor" style:num-format="1" text:start-value="0" text:footnotes-position="page" text:start-numbering-at="document"/>
- <text:notes-configuration text:note-class="endnote" style:num-format="i" text:start-value="0"/>
- <text:linenumbering-configuration text:number-lines="false" text:offset="0.499cm" style:num-format="1" text:number-position="left" text:increment="5"/>
- </office:styles>
- <office:automatic-styles>
- <style:page-layout style:name="pm1">
- <style:page-layout-properties fo:page-width="20.999cm" fo:page-height="29.699cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:footnote-max-height="0cm">
- <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
- </style:page-layout-properties>
- <style:header-style/>
- <style:footer-style/>
- </style:page-layout>
- </office:automatic-styles>
- <office:master-styles>
- <style:master-page style:name="Standard" style:page-layout-name="pm1"/>
- </office:master-styles>
-</office:document-styles>
-WOK
- x.strip!
- x.gsub!(/\n+/m,'') unless @md.opt.cmd=~/M/
- x
- end
- def mimetype
- x=<<WOK
-application/vnd.oasis.opendocument.text
-WOK
- x.strip!
- end
- end
- class Format_obj_break
- def initialize(md,t_o)
- @md,@t_o=md,t_o
- end
- def br_page
- @t_o.obj='<text:p text:style-name="P8"> </text:p>'
- @t_o
- end
- def obj_sep #center later
- sep='--- '
- @t_o.obj=%{<text:p text:style-name="P1">#{sep*20}</text:p>}
- @t_o
- end
- end
- class XML
- end
-end
-__END__
diff --git a/lib/sisu/v2/options.rb b/lib/sisu/v2/options.rb
deleted file mode 100644
index 4997e35d..00000000
--- a/lib/sisu/v2/options.rb
+++ /dev/null
@@ -1,217 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: SiSU information Structuring Universe, command line options
- parsing
-
-=end
-module SiSU_commandline
- require "#{SiSU_lib}/sysenv" # sysenv.rb
- class Options
- attr_accessor :cmd,:mod,:files,:fns,:fnb,:fnc,:fncb,:what
- def initialize(a)
- @cmd,@files,@fns,@fnb,@fnc,@fncb,@what,c,w,s='','','','','','','','','','',''
- @files,@mod,m,f,z,ca=[],[],[],[],[],[]
- @env=SiSU_Env::Info_env.new
- shortcut=SiSU_Env::Info_processing_flag.new
- a.each do |x|
- y=case x
- when /0/
- (x=~/^-1\S+/) \
- ? x.gsub(/^-0(\S+)/,shortcut.cf_0 + ' -\1') \
- : x.gsub(/^-0/,shortcut.cf_0 + ' ')
- when /1/
- (x=~/^-1\S+/) \
- ? x.gsub(/^-1(\S+)/,shortcut.cf_1 + ' -\1') \
- : x.gsub(/^-1/,shortcut.cf_1 + ' ')
- when /2/
- (x=~/^-2\S+/) \
- ? x.gsub(/^-2(\S+)/,shortcut.cf_2 + ' -\1') \
- : x.gsub(/^-2/,shortcut.cf_2 + ' ')
- when /3/
- (x=~/^-3\S+/) \
- ? x.gsub(/^-3(\S+)/,shortcut.cf_3 + ' -\1') \
- : x.gsub(/^-3/,shortcut.cf_3 + ' ')
- when /4/
- (x=~/^-4\S+/) \
- ? x.gsub(/^-4(\S+)/,shortcut.cf_4 + ' -\1') \
- : x.gsub(/^-4/,shortcut.cf_4 + ' ')
- when /5/
- (x=~/^-5\S+/) \
- ? x.gsub(/^-5(\S+)/,shortcut.cf_5 + ' -\1') \
- : x.gsub(/^-5/,shortcut.cf_5 + ' ')
- when /6/
- (x=~/^-6\S+/) \
- ? x.gsub(/^-6(\S+)/,shortcut.cf_5 + ' -\1') \
- : x.gsub(/^-6/,shortcut.cf_5 + ' ')
- else x
- end
- s << " #{y}" unless y.empty?
- end
- s.strip!
- a=s.split(/\s+/)
- a.each do |x|
- if x =~/^-[a-z0-5]+/i \
- or x =~/^--\S+/
- if x =~/^-([a-z0-5]+)/i; c << $1
- end
- if x =~/^--\S+/; m << x
- end
- elsif x =~ /(?:\.(?:(?:-|ssm\.)?sst(?:\.xml)?|ssm|ssi|sx[sdn]\.xml|s[1-3]|kdi|ssp)|\S+?\.ss[mt]\.zip|sisupod(\.zip)?)$/
- if x =~/^(?:https?|file):\/\/\S+/; f << x
- elsif FileTest.file?(x); f << x
- else puts "file not found: #{x}"
- end
- elsif x =~ /\.termsheet\.rb$/
- if FileTest.file?(x); f << x
- else puts "file not found: #{x}"
- end
- else w=x
- puts "#{x} in #{a.join(' ')}?"
- end
- end
- unless m.empty?
- m.each do |m|
- case m
- when /^--(?:color-toggle)$/; c=c+'c'
- when /^--(?:configure)$/; c=c+'CC'
- when /^--(?:dal?|machine|abstraction|abs)$/; c=c+'m'
- when /^--(?:txt|text|plaintext)$/; c=c+'t'
- when /^--(?:html)$/; c=c+'h'
- when /^--(?:epub)$/; c=c+'e'
- when /^--(?:od[ft])$/; c=c+'o'
- when /^--(?:pdf)$/; c=c+'p'
- when /^--(?:concordance|wordmap)$/; c=c+'w'
- when /^--(?:manpage)$/; c=c+'i'
- when /^--(?:texinfo)$/; c=c+'I'
- when /^--(?:xhtml)$/; c=c+'b'
- when /^--(?:xml-sax)$/; c=c+'x'
- when /^--(?:xml-dom)$/; c=c+'X'
- when /^--(?:digest)$/; c=c+'N'
- when /^--(?:termsheet)$/; c=c+'T'
- when /^--(?:manifest)$/; c=c+'y'
- when /^--(?:sqlite)$/; c=c+'d'
- when /^--(?:pg|pg?sql|postgresql)$/; c=c+'D'
- when /^--(?:remote|rsync)$/; c=c+'R'
- when /^--(?:scp)$/; c=c+'r'
- when /^--(?:source)$/; c=c+'s'
- when /^--(?:sisupod|pod)$/; c=c+'S'
- when /^--(?:git)$/; c=c+'g'
- when /^--(?:urls)$/; c=c+'U'
- when /^--(?:zap|delete)$/; c=c+'Z'
- when /^--(?:sample-search-form)$/; c=c+'F'
- when /^--(?:webserv|webrick)$/; c=c+'W'
- when /^--(?:maintenance|keep-processing-files)$/; c=c+'M'
- when /^--(?:verbose[=-]3)$/; c=c+'VM'
- when /^--(?:verbose[=-]2|Verbose|VERBOSE)$/; c=c+'V'
- when /^--(?:verbose(?:[=-]1)?)$/; c=c+'v'
- when /^--(?:verbose[=-]0|quiet|silent)$/; c=c+'q'
- else @mod << m
- end
- end
- end
- unless c.empty?
- c.gsub!(/-/,'')
- c.scan(/CC|\S/) {|x| ca << x}
- @cmd= '-' + ca.uniq.join
- end
- unless w.empty? ; @what=w
- end
- @files << f
- @files.flatten!
- if @files.length > 0 \
- and @cmd.empty? \
- and @mod.length==0 #% if no other action called on filename given, default is sisu -0 [filename(s)] configured as flag default
- @cmd=shortcut.cf_0
- end
- SiSU_Screen::Ansi.new(@cmd,"\tsisu " + @cmd + ' ' + @mod.join(' ') + ' ' + @files.join(' ') + "\n").print_brown if @cmd =~/[vVM]/
- @files.uniq!
- end
- def cmd
- @cmd
- end
- def mod
- @mod
- end
- def fns
- @fns
- end
- def what
- @what
- end
- def fnb
- unless fns.empty?
- fns[/(.+?)\.(?:(?:-|ssm\.)?sst|ssm)$/,1]
- end
- end
- def fnc
- @fnc=if @fns =~/\.(?:ssm\.sst|ssm)$/; fnb + '.ssm.sst'
- else @fns
- end
- end
- def fncb
- @fncb=if @fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/; fnb + '.ssm.sst'
- else @fns.gsub(/(?:\~\S{2,3})?(\.sst)$/,'\1')
- end
- end
- end
-end
-__END__
-note usually named @opt
-is carried in Param usually as @md
-@opt is a subset of @md
-where @md is passed, contents of @opt are available
-passing @opt as well is duplication
-check for fns & fnb
diff --git a/lib/sisu/v2/plaintext.rb b/lib/sisu/v2/plaintext.rb
deleted file mode 100644
index ba146978..00000000
--- a/lib/sisu/v2/plaintext.rb
+++ /dev/null
@@ -1,419 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: plaintext text generation, stripped plaintext output (unix,
- linefeed)
-
-=end
-module SiSU_Plaintext
- require "#{SiSU_lib}/dal" # dal.rb
- require "#{SiSU_lib}/sysenv" # sysenv.rb
- include SiSU_Env
- require "#{SiSU_lib}/plaintext_format" # plaintext_format.rb
- include SiSU_Plaintext_format
- require "#{SiSU_lib}/shared_metadata" # shared_metadata.rb
- require "#{SiSU_lib}/shared_txt" # shared_txt.rb
- include SiSU_Param
- include SiSU_Viz
- pwd=Dir.pwd
- @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0
- @@tablefoot=''
- class Source
- def initialize(opt)
- @opt=opt
- unless @opt.fns =~/(.+?)\.(?:-|ssm\.)?sst$/
- puts "#{sf} not a processed file type"
- end
- end
- def read
- begin
- md=SiSU_Param::Parameters.new(@opt).get
- env=SiSU_Env::Info_env.new(@opt.fns)
- unless @opt.cmd =~/q/
- path=env.path.output_tell
- tool=(@opt.cmd =~/[MVv]/) \
- ? "#{env.program.text_editor} #{path}/#{md.fnb}/#{md.fn[:plain]}" \
- : @opt.fns
- @opt.cmd=~/[MVvz]/ \
- ? SiSU_Screen::Ansi.new(@opt.cmd,'Plaintext',tool).green_hi_blue \
- : SiSU_Screen::Ansi.new(@opt.cmd,'Plaintext',tool).green_title_hi
- SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{path}/#{md.fnb}/#{md.fn[:plain]}").flow if @opt.cmd =~/[MV]/
- end
- my_make=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns)
- dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here
- wrap_width=if defined? md.make.plaintext_wrap \
- and md.make.plaintext_wrap
- md.make.plaintext_wrap
- elsif defined? env.plaintext_wrap \
- and env.plaintext_wrap
- env.plaintext_wrap
- else 78
- end
- #wrap_width=(defined? md.make.plaintext_wrap) ? md.make.plaintext_wrap : 78
- SiSU_Plaintext::Source::Scroll.new(dal_array,md,wrap_width).songsheet
- SiSU_Env::Info_skin.new(md).select #watch
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- end
- end
- private
- class Scroll <Source
- require "#{SiSU_lib}/defaults" # defaults.rb
- require "#{SiSU_lib}/shared_txt" # shared_txt.rb
- include SiSU_text_utils
- @@endnotes={ :para=>[],:end=>[] }
- def initialize(data,md,wrap_width)
- @data,@md,@wrap_width=data,md,wrap_width
- @brace_url=SiSU_Viz::Skin.new.url_decoration
- @tab="\t"
- @@endnotes_=case md.mod.inspect
- when /--footnote/; false
- when /--endnote/; true
- else true
- end
- @br=case md.mod.inspect
- when /--dos/; "\r\n"
- when /--unix/; "\n"
- else "\n"
- end
- @plaintext={ :body=>[],:open=>[],:close=>[],:head=>[],:metadata=>[],:tail=>[] }
- end
- def songsheet
- plaintext=markup(@data)
- publish(plaintext)
- end
- # Used for extraction of endnotes from paragraphs
- def extract_endnotes(dob='')
- notes=dob.obj.scan(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})([\d*+]+\s+.+?)(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/)
- @n=[]
- notes.flatten.each do |n| #high cost to deal with <br> appropriately within plaintext, consider
- n=n.dup.to_s
- if n =~/#{Mx[:br_line]}|#{Mx[:br_nl]}/
- fix = n.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/) #watch #added
- fix.each do |x|
- unless x.empty?; @n << x
- end
- end
- else @n << n
- end
- end
- notes=@n.flatten
- notes.each do |e|
- util=(e.to_s =~/^\[[\d*+]+\]:/) \
- ? (SiSU_text_utils::Wrap.new(e.to_s,@wrap_width,4,1)) \
- : (SiSU_text_utils::Wrap.new(e.to_s,@wrap_width,1,1))
- wrap=util.line_wrap
- if wrap =~ /^\s*[\d*+]+\s+.+?\s*\Z/m
- wrap.gsub!(/^(\s*)([\d*+]+)\s+(.+?)\s*\Z/m, <<GSUB
-\\1[\\2]: \\3
-GSUB
- )
- else
- wrap.gsub!(/^(.+)\Z/m, <<GSUB
-\\1
-GSUB
- )
- end
- @@endnotes[:para] << "-#{wrap}"
- @@endnotes[:end] << '' << wrap
- end
- @@endnotes
- end
- def plaintext_metadata
- array=Metadata::Summary.new(@md).plaintext.metadata
- array.each do |meta|
- tag,inf=meta.scan(/^.+?:\s|.+/)
- if tag and inf
- util=SiSU_text_utils::Wrap.new(inf,@wrap_width,15,1)
- txt=util.line_wrap
- @plaintext[:metadata] <<<<WOK
-
-#{@tab}#{tag}#{txt}
-WOK
- end
- end
- end
- def plaintext_tail
- SiSU_Env::Info_skin.new(@md).select
- env=SiSU_Env::Info_env.new(@md.fns)
- vz=SiSU_Env::Get_init.instance.skin
- base_url="#{env.url.root}/#{@md.fnb}"
- generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version]
- lastdone="Last Generated on: #{Time.now}"
- rubyv="Ruby version: #{@md.ruby_version}"
- sc=if @md.sc_info
- "Source file: #{@md.sc_filename}#{@br}Version number: #{@md.sc_number}#{@br}Version date: #{@md.sc_date}#{@br}"
- else ''
- end
- @plaintext[:tail] <<<<WOK
-#{@br}
-plaintext (plain text):
- #{base_url}/#{@md.fn[:plain]}#{@br}
-Other versions of this document: #{@br}
-manifest:
- #{base_url}/#{@md.fn[:manifest]}#{@br}
-at:
- #{env.url.root}#{@br}
-
-#{sc}
-* #{generator}
-* #{rubyv}
-* #{lastdone}
-* SiSU #{vz.url_sisu}
-WOK
- end
- def plaintext_structure(dob='') #% Used to extract the structure of a document
- lv=n=n3=nil
- if dob.is=='heading'
- lv=dob.ln
- n=lv - 1
- n3=lv + 2
- end
- util=nil
- wrapped=if dob.is =='para' \
- or dob.is=='heading'
- if dob.is=='para'
- if dob.indent =~/[1-9]/
- util=if dob.bullet_
- SiSU_text_utils::Wrap.new("* #{dob.obj}",@wrap_width,dob.indent.to_i*2)
- else SiSU_text_utils::Wrap.new(dob.obj,@wrap_width,dob.indent.to_i*2)
- end
- else
- util=if dob.bullet_
- SiSU_text_utils::Wrap.new("* #{dob.obj}",@wrap_width,0)
- else SiSU_text_utils::Wrap.new(dob.obj,@wrap_width,0)
- end
- end
- else util=SiSU_text_utils::Wrap.new(dob.obj,@wrap_width,0)
- end
- util.line_wrap
- end
- if lv
- times=wrapped.length
- times=@wrap_width if times > @wrap_width
- @plaintext[:body] << case lv
- when 1; wrapped.upcase << @br << Px[:lv1]*times << @br
- when 2; wrapped.upcase << @br << Px[:lv2]*times << @br
- when 3; wrapped.upcase << @br << Px[:lv3]*times << @br
- #when 2..3; wrapped.upcase << @br << Px[:lv2_3]*times << @br
- when 4; wrapped.upcase << @br << Px[:lv4]*times << @br
- when 5; wrapped.upcase << @br << Px[:lv5]*times << @br
- when 6; wrapped.upcase << @br << Px[:lv6]*times << @br
- #when 5..6; wrapped.upcase << @br << Px[:lv5_6]*times << @br
- end
- else
- @plaintext[:body] << wrapped << @br # main text, contents, body KEEP
- end
- if @@endnotes[:para] \
- and not @@endnotes_
- @plaintext[:body] << @br
- @@endnotes[:para].each {|e| @plaintext[:body] << e << @br}
- elsif @@endnotes[:para] \
- and @@endnotes_
- @plaintext[:body] << @br*2
- end
- @@endnotes[:para]=[]
- end
- def markup(data) # Used for major markup instructions
- dir=SiSU_Env::Info_env.new(@md.fns)
- @data_mod,@endnotes,@level,@cont,@copen,@plaintext_contents_close=Array.new(6){[]}
- (0..6).each { |x| @cont[x]=@level[x]=false }
- (4..6).each { |x| @plaintext_contents_close[x]='' }
- plaintext_tail #($1,$2)
- plaintext_metadata
- table_message='[table omitted, see other document formats]'
- fix=[]
- data.each do |dob|
- dob.obj.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+/um,"#{@br}#{table_message}") #fix
- dob.obj.gsub!(/.+?#{Mx[:gl_o]}-##{Mx[:gl_c]}/,'') # remove dummy headings (used by html) #check also [~-]#
- dob.obj.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,
- "#{Px[:bold_o]}\\1#{Px[:bold_c]}")
- dob.obj.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,
- "#{Px[:italics_o]}\\1#{Px[:italics_c]}")
- dob.obj.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,
- "#{Px[:underscore_o]}\\1#{Px[:underscore_c]}")
- dob.obj.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,
- "#{Px[:subscript_o]}\\1#{Px[:subscript_c]}")
- dob.obj.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,
- "#{Px[:superscript_o]}\\1#{Px[:superscript_c]}")
- dob.obj.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,
- "#{Px[:insert_o]}\\1#{Px[:insert_c]}")
- dob.obj.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,
- "#{Px[:cite_o]}\\1#{Px[:cite_c]}")
- dob.obj.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,
- "#{Px[:strike_o]}\\1#{Px[:strike_c]}")
- dob.obj.gsub!(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,
- "#{Px[:monospace_o]}\\1#{Px[:monospace_c]}")
- unless dob.is=='code'
- dob.obj.gsub!(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/,'\1')
- dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1')
- dob.obj.gsub!(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1 [link: <\2>]')
- dob.obj.gsub!(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}image/,'\1 [link: local image]')
- dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,"#{@brace_url.txt_open}\\1#{@brace_url.txt_close}")
- extract_endnotes(dob)
- dob.obj.gsub!(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'[^\1]') # endnote marker marked up
- dob.obj.gsub!(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'[^\1]') # endnote marker marked up
- dob.obj.gsub!(/#{Mx[:gl_o]}(?:#lt|#060)#{Mx[:gl_c]}/,'<')
- dob.obj.gsub!(/#{Mx[:gl_o]}(?:#gt|#062)#{Mx[:gl_c]}/,'>')
- dob.obj.gsub!(/#{Mx[:gl_o]}#(?:038|amp)#{Mx[:gl_c]}/,'&')
- dob.obj.gsub!(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!')
- dob.obj.gsub!(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#')
- dob.obj.gsub!(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*')
- dob.obj.gsub!(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-')
- dob.obj.gsub!(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/')
- dob.obj.gsub!(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_')
- dob.obj.gsub!(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{')
- dob.obj.gsub!(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}')
- dob.obj.gsub!(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~')
- dob.obj.gsub!(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'©')
- end
- if dob.of=='group' # watch
- dob.obj.gsub!(/#{Mx[:gl_o]}●#{Mx[:gl_c]}/,"* ")
- dob.obj.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"\n")
- else dob.obj.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"\n\n")
- end
- if dob.is=='code'
- dob.obj.gsub!(/(^|[^}])_([<>])/m,'\1\2') # _> _<
- dob.obj.gsub!(/(^|[^}])_([<>])/m,'\1\2') # _<_<
- end
- dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1')
- dob.obj.gsub!(/<a href=".+?">(.+?)<\/a>/m,'\1')
- dob.obj.gsub!(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'') # remove name links
- dob.obj.gsub!(/&nbsp;|#{Mx[:nbsp]}/,' ') # decide on
- dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,' [ \1 ]') #"[ #{dir.url.images_local}\/\\1 ]")
- dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}image/,' [ \1 ]')
- dob.obj.gsub!(/(?:^|[^_\\])\{\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*\}\S+/,'[image: "\1"]')
- wordlist=dob.obj.scan(/\S+/)
- if dob.obj !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/
- if defined? dob.ocn and dob.ocn.to_s =~/\d+/
- paranum=dob.ocn.to_s
- @p_num=SiSU_Plaintext_format::Paragraph_number.new(paranum)
- end
- if dob.is=='heading' \
- or dob.is=='para'
- plaintext_structure(dob)
- elsif dob.is=='group' \
- or dob.is=='verse' \
- or dob.is=='code' \
- or dob.is=='table'
- @plaintext[:body] << dob.obj << @br
- elsif dob.is=='break'
- sp=' '
- ln='-'
- @plaintext[:body] <<=if dob.obj==Mx[:br_page] \
- or dob.obj==Mx[:br_page_new]
- "#{@br}#{ln*40}#{@br*2}"
- elsif dob.obj ==Mx[:obj_ln_sep]
- "#{@br}#{sp*20}* * *#{@br*2}"
- end # following empty line (@br) missing, fix
- end
- dob='' if (dob.obj =~/<a name="n\d+">/ \
- and dob.obj =~/^(-\{{2}~\d+|<!e[:_]\d+!>)/) # -endnote
- dob.obj.gsub!(/<!.+!>/,' ') if dob ## Clean Prepared Text
- dob.obj.gsub!(/<:\S+>/,' ') if dob ## Clean Prepared Text
- end
- end
- @plaintext
- end
- def publish(plaintext)
- divider='='
- content=[]
- content << plaintext[:open]
- content << plaintext[:head]
- content << plaintext[:body]
- content << @@endnotes[:end] if @@endnotes_
- content << "#{@br}#{divider*@wrap_width}#{@br}"
- content << plaintext[:metadata]
- content << "#{@br}#{divider*@wrap_width}#{@br}" if @md.stmp =~/\w+/ #not used?
- content << plaintext[:tail]
- Output.new(content,@md).plaintext
- @@endnotes={ :para=>[],:end=>[] }
- end
- end
- class Output <Source
- include SiSU_Param
- include SiSU_Env
- def initialize(content,md)
- @content,@md=content,md
- end
- def plaintext #%plaintext output
- SiSU_Env::SiSU_file.new(@md).mkdir
- file_plaintext=SiSU_Env::SiSU_file.new(@md,@md.fn[:plain]).mkfile
- @sisu=[]
- emptyline=0
- @content.each do |para| # this is a hack
- if para.class==Array \
- and para.length > 0
- para.each do |line|
- if line
- line.gsub!(/\s+$/m,'')
- line.gsub!(/^\A[ ]*\Z/m,'')
- if line=~/^\A[ ]*\Z/m
- emptyline+=1
- else emptyline=0
- end
- file_plaintext.puts line if emptyline < 2 #remove extra line spaces (fix upstream)
- end
- end
- else file_plaintext.puts para #unix plaintext # /^([*=-]|\.){5}/
- end
- end
- file_plaintext.close
- end
- end
- end
-end
-__END__
-&#033;\|&#035;\|&&#042;\|&#045;\|&#047;\|&#095;\|&#123;\|&#125;\|&#126;\|&#
diff --git a/lib/sisu/v2/shared_markup_alt.rb b/lib/sisu/v2/shared_markup_alt.rb
deleted file mode 100644
index 52ecfe24..00000000
--- a/lib/sisu/v2/shared_markup_alt.rb
+++ /dev/null
@@ -1,318 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
- #___#
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/copyleft/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: system environment, resource control and configuration details
-
-=end
-module SiSU_text_representation
- class Alter
- def initialize(x)
- if x.class==String
- @t_o,@s=nil,x
- else
- @t_o,@s=x,x.obj.dup
- end
- end
- def strip_clean_of_extra_spaces # dal output tuned
- @s=@s.dup
- @s=@s.gsub(/[ ]+([,.;:?](?:$|\s))/,'\1') unless @s =~/#{Mx[:en_a_o]}|#{Mx[:en_b_o]}/
- @s=@s.gsub(/ [ ]+/,' ')
- @s=@s.gsub(/^ [ ]+/,'')
- @s=@s.gsub(/ [ ]+$/,'')
- @s=@s.gsub(/((?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})')[ ]+(s )/,'\1\2')
- @s=@s.gsub(/((?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})')[ ]+(s )/,'\1\2')
- end
- def strip_clean_of_markup # text form used in sql db search, used for digest, define rules, make same as in db clean
- @s=@s.dup #% same as db clean -->
- @s=@s.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\1')
- @s=@s.gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\1')
- @s=@s.gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\1')
- @s=@s.gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'\1')
- @s=@s.gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'\1')
- @s=@s.gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strke_c]}/,'\1')
- @s=@s.gsub(/#{Mx[:fa_superscript_o]}(\d+)#{Mx[:fa_superscript_c]}/,'[\1]')
- @s=@s.gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'\1')
- @s=@s.gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'\1')
- @s=@s.gsub(/#{Mx[:fa_hilite_o]}(.+?)#{Mx[:fa_hilite_c]}/,'\1')
- @s=@s.gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/i,'~')
- @s=@s.gsub(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'') # endnote removed
- @s=@s.gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'') # endnote removed
- @s=@s.gsub(/(?:#{Mx[:nbsp]})+/,' ')
- @s=@s.gsub(/(?:#{Mx[:br_nl]})+/,"\n")
- @s=@s.gsub(/(?:#{Mx[:br_paragraph]})+/,"\n")
- @s=@s.gsub(/(?:#{Mx[:br_line]})+/,"\n")
- @s=@s.gsub(/#{Mx[:gl_o]}(?:#lt|#060)#{Mx[:gl_c]}/,'<')
- @s=@s.gsub(/#{Mx[:gl_o]}(?:#gt|#062)#{Mx[:gl_c]}/,'>')
- @s=@s.gsub(/#{Mx[:gl_o]}#(?:038|amp)#{Mx[:gl_c]}/,'&')
- @s=@s.gsub(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!')
- @s=@s.gsub(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#')
- @s=@s.gsub(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*')
- @s=@s.gsub(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-')
- @s=@s.gsub(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/')
- @s=@s.gsub(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_')
- @s=@s.gsub(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{')
- @s=@s.gsub(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}')
- @s=@s.gsub(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~')
- @s=@s.gsub(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'©')
- @s=@s.gsub(/\s\s+/,' ')
- @s=@s.gsub(/\s\s+/,' ')
- @s=@s.strip
- end
- def semi_revert_markup # used for digest, define rules, make same as in db clean
- if @t_o
- @s=@s.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'*{\1}*')
- @s=@s.gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'/{\1}/')
- @s=@s.gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'_{\1}_')
- @s=@s.gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'"{\1}"')
- @s=@s.gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'+{\1}+')
- @s=@s.gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strke_c]}/,'-{\1}-')
- @s=@s.gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'^{\1}^')
- @s=@s.gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,',{\1},')
- @s=@s.gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/i,'~')
- @s=@s.gsub(/#{Mx[:en_a_o]}([\d*+]+\s+.+?)#{Mx[:en_a_c]}/,'~{\1}~') # endnote marker marked up
- @s=@s.gsub(/#{Mx[:en_b_o]}([\d*+]+\s+.+?)#{Mx[:en_b_c]}/,'~[\1]~') # endnote marker marked up
- if @t_o.is=='heading' or @t_o.is=='para'
- @s=@s.gsub(/ [ ]+/,' ')
- @s=@s.gsub(/(?:#{Mx[:nbsp]})+/,' ')
- if @t_o.is=='heading'
- @s=@t_o.lv + '~ ' + @s
- end
- if @t_o.is=='para'
- if @t_o.bullet_
- @s='_* ' + @s
- end
- if @t_o.indent.to_i > 0
- @s="_#{@t_o.indent} " + @s
- @s=@s.gsub(/^(_[1-9])\s_\*\s/,'\1* ')
- end
- end
- end
- if @t_o.is=='group' or @t_o.is=='code'
- @s=@s.gsub(/#{Mx[:nbsp]}/,' ')
- @s="#{@t_o.is}{\n\n#{@s}\n\n}#{@t_o.is}"
- @s=@s.gsub(/(?:#{Mx[:br_nl]}|\n)+/m,"\n\n")
- end
- #dealing with poem and verse calls for change in dal, where start and end verse of poem are marked as such
- @s=@s.strip
- end
- @s
- end
- def html_lite #test whether eventually can be used in db_import replacing shared_html_lite (search for SiSU_Format_Shared)
- if @t_o
- @s=@s.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>')
- @s=@s.gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>')
- @s=@s.gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>')
- @s=@s.gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'"\1"')
- @s=@s.gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'+{\1}+')
- @s=@s.gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strke_c]}/,'-{\1}-')
- @s=@s.gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>')
- @s=@s.gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>')
- @s=@s.gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/i,'~')
- if @t_o.is !='code'
- if @s =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/
- wm=@s.scan(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)|\S+/)
- words=urls(wm)
- @s=@s.gsub(/.+/m,words)
- end
- @s=@s.gsub(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;')
- @s=@s.gsub(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;')
- @s=@s.gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'<a href="\1" target="_top">\1</a>') #http ftp matches escaped, no decoration
- @s=@s.gsub(/(#{Mx[:lnk_c]})#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1<a href="\2" target="_top">\2</a>\3') #special case \{ e.g. \}http://url
- @s=@s.gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{@url_brace.xml_open}<a href="\\1" target="_top">\\1</a>#{@url_brace.xml_close}}) #http ftp matches with decoration
- else
- @s=@s.gsub(/(^|[^}])_</m,'\1&lt;'); @s.gsub(/(^|[^}])_>/m,'\1&gt;') #code-block: angle brackets special characters
- @s=@s.gsub(/(^|[^}])_</m,'\1&lt;'); @s.gsub(/(^|[^}])_>/m,'\1&gt;')
- end
- if @t_o.is=='paragraph'
- if @t_o.bullet_
- @s=@s
- end
- if @t_o.indent > 0
- @s=@s
- end
- end
- if @t_o.is=='heading'
- @s=@s
- end
- else
- p __FILE__ +':'+ __LINE__.to_s
- end
- @s
- end
- end
- class Modified_text_plus_Hash_digest
- def initialize(md,x)
- @md=md
- if x.class==String
- @t_o,@s=nil,x
- else
- @t_o,@s=x,x.obj.dup
- end
- @env ||=SiSU_Env::Info_env.new(@md.fns)
- @sha_ =((@env.digest.type =='sha256') ? true : false)
- @sha_ ? (require 'digest/sha2') : (require 'digest/md5')
- end
- def digest(txt)
- d=nil
- if @sha_
- for hash_class in [ Digest::SHA256 ]
- d=hash_class.hexdigest(txt)
- end
- else
- for hash_class in [ Digest::MD5 ]
- d=hash_class.hexdigest(txt)
- end
- end
- d
- end
- def strip_clean_of_markup
- def txt
- SiSU_text_representation::Alter.new(@s).strip_clean_of_markup
- end
- def dgst
- en_dgst,img_dgst={},{}
- txt_dgst=digest(txt)
- {:txt=>txt,:dgst_txt=>txt_dgst}
- end
- self
- end
- def semi_revert_markup
- def txt
- SiSU_text_representation::Alter.new(@s).semi_revert_markup
- end
- def dgst
- txt_dgst=digest(txt)
- {:txt=>txt,:dgst_txt=>txt_dgst}
- end
- self
- end
- def composite
- def stripped_clean(txt)
- SiSU_text_representation::Alter.new(txt).strip_clean_of_markup
- end
- def markup_reverted(txt)
- SiSU_text_representation::Alter.new(txt).semi_revert_markup
- end
- def images(imgs)
- sys=SiSU_Env::System_call.new
- line_image=[]
- img_dgst={}
- if imgs and imgs.length > 0
- @image_name,@image_dgst,@img=[],[],[]
- imgs.each do |i|
- image_source=if FileTest.file?("#{@env.path.image_source_local_tex}/#{i}")
- @env.path.image_source_local_tex
- elsif FileTest.file?("#{@env.path.image_source_remote_tex}/#{i}")
- @env.path.image_source_remote_tex
- elsif FileTest.file?("#{@env.path.image_source_tex}/#{i}")
- @env.path.image_source_tex
- else
- SiSU_Screen::Ansi.new(@md.cmd,"ERROR - image:", %{"#{i}" missing}, "search locations: #{@env.path.image_source_local_tex}, #{@env.path.image_source_remote_tex} and #{@env.path.image_source_tex}").error2 unless @md.cmd =~/q/
- nil
- end
- img_type = /\S+\.(png|jpg|gif)/.match(i)[1]
- not_found_msg='image not found'
- if image_source
- para_image = image_source + '/' + i
- image_name = i
- image_dgst =(@sha_ ? sys.sha256(para_image) : sys.md5(para_image))
- else
- image_name = i + ' [image missing]'
- image_dgst = ''
- end
- line_image << {:img_dgst=>image_dgst[1],:img_name=>image_name,:img_type=>img_type}
- end
- end
- line_image
- end
- def endnotes(en)
- en_dgst=[]
- if en and en.length > 0
- en.flatten.each do |e|
- note_no=e.gsub(/^([\d*+]+)\s+.+/,'\1')
- e=digest(stripped_clean(e))
- note_dgst=digest(e)
- en_dgst << {:note_number=>note_no,:note_dgst=>note_dgst}
- end
- end
- en_dgst
- end
- def dgst
- if @t_o.of !='comment' and @t_o.of !='structure' and @t_o.of !='layout'
- en_dgst,img_dgst={},{}
- txt_stripped_dgst=digest(stripped_clean(@t_o))
- txt_markup_reverted_dgst=digest(markup_reverted(@t_o))
- endnotes_dgst=[]
- rgx_notes=/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})([\d*+]+\s+.+?)(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/
- notes=@t_o.obj.scan(rgx_notes)
- endnotes_dgst=endnotes(notes)
- rgx_image=/#{Mx[:lnk_o]}(\S+\.(?:png|jpg|gif))\s.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/
- imgs=if (@t_o.is=='para' or @t_o.is=='image') \
- and @t_o.obj =~rgx_image
- imgs=@t_o.obj.scan(rgx_image).flatten
- line_image=images(imgs)
- end
- dgst={:is=>@t_o.is,:ocn=>@t_o.ocn,:dgst_stripped_txt=>txt_stripped_dgst,:dgst_markedup_txt=>txt_markup_reverted_dgst}
- dgst[:endnotes]=endnotes_dgst if endnotes_dgst and endnotes_dgst.length > 0
- dgst[:images]=line_image if line_image and line_image.length > 0
- end
- dgst
- end
- self
- end
- end
-end
-__END__
diff --git a/lib/sisu/v2/shared_metadata.rb b/lib/sisu/v2/shared_metadata.rb
deleted file mode 100644
index f27cf5ba..00000000
--- a/lib/sisu/v2/shared_metadata.rb
+++ /dev/null
@@ -1,800 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/copyleft/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: system environment, resource control and configuration details
-
-=end
-module Metadata
- class Summary
- attr_accessor :tag,:inf,:class,:attrib
- def initialize(md,display_heading=false)
- @md,@display_heading=md,display_heading
- @tag,@inf,@class,@attrib=nil
- end
- def metadata_base
- meta,tag=[],[]
- dir=SiSU_Env::Info_env.new(@md.fns)
- base_html="#{dir.url.root}/#{@md.fnb}"
- l=SiSU_Env::Standardise_language.new.file_to_language(@md.fns)
- language=l[:l]
- tr=SiSU_Translate::Source.new(@md,language)
- @attrib='md'
- if @display_heading
- @tag,@inf=%{<b><u>Document Metadata</u></b>},''
- meta << self.meta_para
- end
- if defined? @md.title.full \
- and @md.title.full=~/\S+/
- @tag,@inf,@class=tr.full_title,@md.title.full,'dc' #1
- meta << self.meta_para
- end
- if defined? @md.creator.author \
- and @md.creator.author=~/\S+/
- @tag,@inf,@class=tr.author,@md.creator.author,'dc' #2
- meta << self.meta_para
- end
- if defined? @md.creator.translator \
- and @md.creator.translator=~/\S+/
- @tag,@inf,@class=tr.translator,@md.creator.translator,'ext'
- meta << self.meta_para
- end
- if defined? @md.creator.illustrator \
- and @md.creator.illustrator=~/\S+/
- @tag,@inf,@class=tr.illustrator,@md.creator.illustrator,'ext'
- meta << self.meta_para
- end
- if defined? @md.creator.prepared_by \
- and @md.creator.prepared_by=~/\S+/
- @tag,@inf,@class=tr.prepared_by,@md.creator.prepared_by,'ext'
- meta << self.meta_para
- end
- if defined? @md.creator.digitized_by \
- and @md.creator.digitized_by=~/\S+/
- @tag,@inf,@class=tr.digitized_by,@md.creator.digitized_by,'ext'
- meta << self.meta_para
- end
- if defined? @md.rights.all \
- and @md.rights.all=~/\S+/
- @tag,@inf,@class=tr.rights,@md.rights.all,'dc' #15
- meta << self.meta_para
- end
- if defined? @md.classify.subject \
- and @md.classify.subject=~/\S+/
- @tag,@inf,@class=tr.subject,@md.classify.subject,'dc' #3
- meta << self.meta_para
- end
- if defined? @md.notes.description \
- and @md.notes.description=~/\S+/
- @tag,@inf,@class=tr.description,@md.notes.description,'dc' #4
- meta << self.meta_para
- end
- if defined? @md.publisher \
- and @md.publisher=~/\S+/
- @tag,@inf,@class=tr.publisher,@md.publisher,'dc' #5
- meta << self.meta_para
- end
- if defined? @md.creator.contributor \
- and @md.creator.contributor=~/\S+/
- @tag,@inf,@class=tr.contributor,@md.creator.contributor,'dc' #6
- meta << self.meta_para
- end
- if defined? @md.notes.abstract \
- and @md.notes.abstract=~/\S+/
- @tag,@inf,@class=tr.abstract,@md.notes.abstract,'ext'
- meta << self.meta_para
- end
- if defined? @md.date.created \
- and @md.date.created=~/\S+/
- @tag,@inf,@class=tr.date_created,@md.date.created,'dc' #7
- meta << self.meta_para
- end
- if defined? @md.date.issued \
- and @md.date.issued=~/\S+/
- @tag,@inf,@class=tr.date_issued,@md.date.issued,'dc' #7
- meta << self.meta_para
- end
- if defined? @md.date.available \
- and @md.date.available=~/\S+/
- @tag,@inf,@class=tr.date_available,@md.date.available,'dc' #7
- meta << self.meta_para
- end
- if defined? @md.date.modified \
- and @md.date.modified=~/\S+/
- @tag,@inf,@class=tr.date_modified,@md.date.modified,'dc' #7
- meta << self.meta_para
- end
- if defined? @md.date.valid \
- and @md.date.valid=~/\S+/
- @tag,@inf,@class=tr.date_valid,@md.date.valid,'dc' #7
- meta << self.meta_para
- end
- if defined? @md.date.published \
- and @md.date.published=~/\S+/
- @tag,@inf,@class=tr.date,@md.date.published,'dc' #7
- meta << self.meta_para
- end
- if defined? @md.type \
- and @md.date=~/\S+/
- @tag,@inf,@class=tr.type,@md.type,'dc' #8
- meta << self.meta_para
- end
- if defined? @md.classify.loc \
- and @md.classify.loc=~/\S+/
- @tag,@inf,@class=tr.cls_loc,@md.classify.loc,'id'
- meta << self.meta_para
- end
- if defined? @md.classify.dewey \
- and @md.classify.dewey=~/\S+/
- @tag,@inf,@class=tr.cls_dewey,@md.classify.dewey,'id'
- meta << self.meta_para
- end
- if defined? @md.classify.pg \
- and @md.classify.pg=~/\S+/
- @tag,@inf,@class=tr.cls_gutenberg,@md.classify.pg,'id'
- meta << self.meta_para
- end
- if defined? @md.classify.isbn \
- and @md.classify.isbn=~/\S+/
- @tag,@inf,@class=tr.cls_isbn,@md.classify.isbn,'id'
- meta << self.meta_para
- end
- if defined? @md.notes.comment \
- and @md.notes.comment=~/\S+/
- @tag,@inf,@class=tr.comments,@md.notes.comment,'ext'
- meta << self.meta_para
- end
- if defined? @md.notes.prefix_a \
- and @md.notes.prefix_a=~/\S+/
- @tag,@inf,@class=tr.prefix_a,@md.notes.prefix_a,'inf'
- meta << self.meta_para
- end
- if defined? @md.notes.prefix_b \
- and @md.notes.prefix_b=~/\S+/
- @tag,@inf,@class=tr.prefix_b,@md.notes.prefix_b,'inf'
- meta << self.meta_para
- end
- if defined? @md.classify.identifier \
- and @md.classify.identifier=~/\S+/
- @tag,@inf,@class=tr.identifier,@md.classify.identifier,'dc' #10
- meta << self.meta_para
- end
- if defined? @md.original.source \
- and @md.original.source=~/\S+/
- @tag,@inf,@class=tr.source,@md.original.source,'dc' #11
- meta << self.meta_para
- end
- if defined? @md.title.language \
- and @md.title.language=~/\S+/
- @tag,@inf,@class=tr.language,@md.title.language,'dc' #12
- meta << self.meta_para
- end
- if defined? @md.original.language \
- and @md.original.language=~/\S+/
- @tag,@inf,@class=tr.language_original,@md.original.language,'ext'
- meta << self.meta_para
- end
- if defined? @md.classify.format \
- and @md.classify.format=~/\S+/
- @tag,@inf,@class=tr.format,@md.classify.format,'dc' #9
- meta << self.meta_para
- end
- if defined? @md.classify.relation \
- and @md.classify.relation=~/\S+/
- @tag,@inf,@class=tr.relation,@md.classify.relation,'dc' #13
- meta << self.meta_para
- end
- if defined? @md.classify.coverage \
- and @md.classify.coverage=~/\S+/
- @tag,@inf,@class=tr.coverage,@md.classify.coverage,'dc' #14
- meta << self.meta_para
- end
- if defined? @md.classify.keywords \
- and @md.classify.keywords=~/\S+/
- @tag,@inf,@class=tr.keywords,@md.classify.keywords,'ext'
- meta << self.meta_para
- end
- if @display_heading
- @tag,@inf=%{<b><u>Version Information</u></b>},''
- meta << self.meta_para
- end
- if defined? @md.fns \
- and @md.fns=~/\S+/
- @tag,@inf,@class=tr.sourcefile,@md.fns,'src'
- meta << self.meta_para
- end
- if defined? @md.file_encoding \
- and @md.file_encoding=~/\S+/
- @tag,@inf,@class='Filetype',@md.file_encoding,'src'
- meta << self.meta_para
- end
- if defined? @md.dgst \
- and @md.dgst.class==Array
- @tag,@inf,@class='Source Digest',"#{@md.dgst[0]} #{@md.dgst[1]}",'src'
- meta << self.meta_para
- end
- if defined? @md.dgst_skin \
- and @md.dgst_skin.class==Array
- @tag,@inf,@class='Skin Digest',"#{@md.dgst_skin[0]} #{@md.dgst_skin[1]}",'src'
- meta << self.meta_para
- end
- if @display_heading
- @tag,@inf=%{<b><u>Generated</u></b>},''
- meta << self.meta_para
- end
- if defined? @md.sisu_version \
- and @md.sisu_version[:version]=~/\S+/
- v="#{tr.sisu_version}: " +
- "#{@md.sisu_version[:project]} " +
- "#{@md.sisu_version[:version]} " +
- "of #{@md.sisu_version[:date_stamp]} " +
- "(#{@md.sisu_version[:date]})"
- @tag,@inf,@class='Generated by',v,'ver'
- meta << self.meta_para
- end
- if defined? @md.ruby_version \
- and @md.ruby_version=~/\S+/
- @tag,@inf,@class=tr.ruby_version,@md.ruby_version,'ver'
- meta << self.meta_para
- end
- if defined? @md.generated \
- and @md.generated.class==Time
- @tag,@inf,@class=tr.last_generated,@md.generated,'date'
- meta << self.meta_para
- end
- meta
- end
- def char_enc(str)
- @s=str
- def utf8
- if @s \
- and @s.class==String
- @s.gsub!(/<br(?: \/)?>/u,Mx[:br_paragraph])
- @s.gsub!(/</um,'&#60;') # '&lt;' # &#060;
- @s.gsub!(/</um,'&#60;') # '&lt;' # &#060;
- @s.gsub!(/>/um,'&#62;') # '&gt;' # &#062;
- @s.gsub!(/¢/um,'&#162;') # '&cent;' # &#162;
- @s.gsub!(/£/um,'&#163;') # '&pound;' # &#163;
- @s.gsub!(/¥/um,'&#165;') # '&yen;' # &#165;
- @s.gsub!(/§/um,'&#167;') # '&sect;' # &#167;
- @s.gsub!(/©/um,'&#169;') # '&copy;' # &#169;
- @s.gsub!(/ª/um,'&#170;') # '&ordf;' # &#170;
- @s.gsub!(/«/um,'&#171;') # '&laquo;' # &#171;
- @s.gsub!(/®/um,'&#174;') # '&reg;' # &#174;
- @s.gsub!(/°/um,'&#176;') # '&deg;' # &#176;
- @s.gsub!(/±/um,'&#177;') # '&plusmn;' # &#177;
- @s.gsub!(/²/um,'&#178;') # '&sup2;' # &#178;
- @s.gsub!(/³/um,'&#179;') # '&sup3;' # &#179;
- @s.gsub!(/µ/um,'&#181;') # '&micro;' # &#181;
- @s.gsub!(/¶/um,'&#182;') # '&para;' # &#182;
- @s.gsub!(/¹/um,'&#185;') # '&sup1;' # &#185;
- @s.gsub!(/º/um,'&#186;') # '&ordm;' # &#186;
- @s.gsub!(/»/um,'&#187;') # '&raquo;' # &#187;
- @s.gsub!(/¼/um,'&#188;') # '&frac14;' # &#188;
- @s.gsub!(/½/um,'&#189;') # '&frac12;' # &#189;
- @s.gsub!(/¾/um,'&#190;') # '&frac34;' # &#190;
- @s.gsub!(/×/um,'&#215;') # '&times;' # &#215;
- @s.gsub!(/÷/um,'&#247;') # '&divide;' # &#247;
- @s.gsub!(/¿/um,'&#191;') # '&iquest;' # &#191;
- @s.gsub!(/À/um,'&#192;') # '&Agrave;' # &#192;
- @s.gsub!(/Á/um,'&#193;') # '&Aacute;' # &#193;
- @s.gsub!(/Â/um,'&#194;') # '&Acirc;' # &#194;
- @s.gsub!(/Ã/um,'&#195;') # '&Atilde;' # &#195;
- @s.gsub!(/Ä/um,'&#196;') # '&Auml;' # &#196;
- @s.gsub!(/Å/um,'&#197;') # '&Aring;' # &#197;
- @s.gsub!(/Æ/um,'&#198;') # '&AElig;' # &#198;
- @s.gsub!(/Ç/um,'&#199;') # '&Ccedil;' # &#199;
- @s.gsub!(/È/um,'&#200;') # '&Egrave;' # &#200;
- @s.gsub!(/É/um,'&#201;') # '&Eacute;' # &#201;
- @s.gsub!(/Ê/um,'&#202;') # '&Ecirc;' # &#202;
- @s.gsub!(/Ë/um,'&#203;') # '&Euml;' # &#203;
- @s.gsub!(/Ì/um,'&#204;') # '&Igrave;' # &#204;
- @s.gsub!(/Í/um,'&#205;') # '&Iacute;' # &#205;
- @s.gsub!(/Î/um,'&#206;') # '&Icirc;' # &#206;
- @s.gsub!(/Ï/um,'&#207;') # '&Iuml;' # &#207;
- @s.gsub!(/Ð/um,'&#208;') # '&ETH;' # &#208;
- @s.gsub!(/Ñ/um,'&#209;') # '&Ntilde;' # &#209;
- @s.gsub!(/Ò/um,'&#210;') # '&Ograve;' # &#210;
- @s.gsub!(/Ó/um,'&#211;') # '&Oacute;' # &#211;
- @s.gsub!(/Ô/um,'&#212;') # '&Ocirc;' # &#212;
- @s.gsub!(/Õ/um,'&#213;') # '&Otilde;' # &#213;
- @s.gsub!(/Ö/um,'&#214;') # '&Ouml;' # &#214;
- @s.gsub!(/Ø/um,'&#216;') # '&Oslash;' # &#216;
- @s.gsub!(/Ù/um,'&#217;') # '&Ugrave;' # &#217;
- @s.gsub!(/Ú/um,'&#218;') # '&Uacute;' # &#218;
- @s.gsub!(/Û/um,'&#219;') # '&Ucirc;' # &#219;
- @s.gsub!(/Ü/um,'&#220;') # '&Uuml;' # &#220;
- @s.gsub!(/Ý/um,'&#221;') # '&Yacute;' # &#221;
- @s.gsub!(/Þ/um,'&#222;') # '&THORN;' # &#222;
- @s.gsub!(/ß/um,'&#223;') # '&szlig;' # &#223;
- @s.gsub!(/à/um,'&#224;') # '&agrave;' # &#224;
- @s.gsub!(/á/um,'&#225;') # '&aacute;' # &#225;
- @s.gsub!(/â/um,'&#226;') # '&acirc;' # &#226;
- @s.gsub!(/ã/um,'&#227;') # '&atilde;' # &#227;
- @s.gsub!(/ä/um,'&#228;') # '&auml;' # &#228;
- @s.gsub!(/å/um,'&#229;') # '&aring;' # &#229;
- @s.gsub!(/æ/um,'&#230;') # '&aelig;' # &#230;
- @s.gsub!(/ç/um,'&#231;') # '&ccedil;' # &#231;
- @s.gsub!(/è/um,'&#232;') # '&egrave;' # &#232;
- @s.gsub!(/é/um,'&#233;') # '&acute;' # &#233;
- @s.gsub!(/ê/um,'&#234;') # '&circ;' # &#234;
- @s.gsub!(/ë/um,'&#235;') # '&euml;' # &#235;
- @s.gsub!(/ì/um,'&#236;') # '&igrave;' # &#236;
- @s.gsub!(/í/um,'&#237;') # '&acute;' # &#237;
- @s.gsub!(/î/um,'&#238;') # '&icirc;' # &#238;
- @s.gsub!(/ï/um,'&#239;') # '&iuml;' # &#239;
- @s.gsub!(/ð/um,'&#240;') # '&eth;' # &#240;
- @s.gsub!(/ñ/um,'&#241;') # '&ntilde;' # &#241;
- @s.gsub!(/ò/um,'&#242;') # '&ograve;' # &#242;
- @s.gsub!(/ó/um,'&#243;') # '&oacute;' # &#243;
- @s.gsub!(/ô/um,'&#244;') # '&ocirc;' # &#244;
- @s.gsub!(/õ/um,'&#245;') # '&otilde;' # &#245;
- @s.gsub!(/ö/um,'&#246;') # '&ouml;' # &#246;
- @s.gsub!(/ø/um,'&#248;') # '&oslash;' # &#248;
- @s.gsub!(/ù/um,'&#250;') # '&ugrave;' # &#250;
- @s.gsub!(/ú/um,'&#251;') # '&uacute;' # &#251;
- @s.gsub!(/û/um,'&#252;') # '&ucirc;' # &#252;
- @s.gsub!(/ü/um,'&#253;') # '&uuml;' # &#253;
- @s.gsub!(/þ/um,'&#254;') # '&thorn;' # &#254;
- @s.gsub!(/ÿ/um,'&#255;') # '&yuml;' # &#255;
- @s.gsub!(/‘/um,'&#8216;') # '&lsquo;' # &#8216;
- @s.gsub!(/’/um,'&#8217;') # '&rsquo;' # &#8217;
- @s.gsub!(/“/um,'&#8220;') # &ldquo; # &#8220;
- @s.gsub!(/”/um,'&#8221;') # &rdquo; # &#8221;
- @s.gsub!(/–/um,'&#8211;') # &ndash; # &#8211;
- @s.gsub!(/—/um,'&#8212;') # &mdash; # &#8212;
- @s.gsub!(/∝/um,'&#8733;') # &prop; # &#8733;
- @s.gsub!(/∞/um,'&#8734;') # &infin; # &#8734;
- @s.gsub!(/™/um,'&#8482;') # &trade; # &#8482;
- @s.gsub!(/✠/um,'&#10016;') # &cross; # &#10016;
- @s.gsub!(/ /um,' ') # space identify
- @s.gsub!(/ /um,' ') # space identify
- @s.gsub!(/#{Mx[:br_paragraph]}/u,'<br />')
- end
- @s
- end
- self
- end
- def xml_sax
- def meta_para
- inf_xml=char_enc(@inf).utf8
- <<WOK
-<metadata>
-#{Ax[:tab]}<meta>#{@tag.capitalize}:</meta>
-#{Ax[:tab]}<data class="#{@attrib}">
-#{Ax[:tab]*2}#{inf_xml}
-#{Ax[:tab]}</data>
-</metadata>
-WOK
- end
- def metadata
- Metadata::Summary.new(@md).metadata_base
- end
- self
- end
- def xml_dom
- def meta_para
- inf_xml=char_enc(@inf).utf8
- <<WOK
-#{Ax[:tab]}<header>
-#{Ax[:tab]*2}<meta>#{@tag.capitalize}:</meta>
-#{Ax[:tab]*2}<#{@attrib}>
-#{Ax[:tab]*3}#{inf_xml}
-#{Ax[:tab]*2}</#{@attrib}>
-#{Ax[:tab]}</header>
-WOK
- end
- def metadata
- Metadata::Summary.new(@md).metadata_base
- end
- self
- end
- def xhtml_scroll
- def meta_para
- inf_xml=char_enc(@inf).utf8
- <<WOK
-#{Ax[:tab]}<metadata>
-#{Ax[:tab]}<meta>#{@tag.capitalize}:</meta>
-#{Ax[:tab]}<#{@attrib} class="#{@class}">
-#{Ax[:tab]*2}#{inf_xml}
-#{Ax[:tab]}</#{@attrib}>
-#{Ax[:tab]}</metadata>
- <br />
-WOK
- end
- def metadata
- Metadata::Summary.new(@md).metadata_base
- end
- self
- end
- def xhtml_display
- def meta_para
- inf_xml=char_enc(@inf).utf8
- %{<p class="norm">
- <b>#{@tag}</b>: #{inf_xml}
-</p>}
- end
- def metadata
- Metadata::Summary.new(@md,true).metadata_base
- end
- self
- end
- def odf
- def meta_para
- url_brace=SiSU_Viz::Skin.new.url_decoration
- if @inf.class==String
- @inf.gsub!(/</,'&lt;'); @inf.gsub!(/>/,'&gt;')
- @inf.gsub!(/&lt;br(?: \/)?&gt;/,'<br />')
- if @inf =~/&/
- inf_array=[]
- word=@inf.scan(/\S+|\n/)
- word.each do |w| # _ - / # | : ! ^ ~
- w.gsub!(/&nbsp;/,'&#160;')
- if w !~/&\S{2,7}?;/
- w.gsub!(/&/,'&amp;')
- end
- inf_array << w
- end
- @inf=inf_array.join(' ')
- end
- @inf.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,
- '<text:a xlink:type="simple" xlink:href="\1">\1</text:a>') #http ftp matches escaped, no decoration
- @inf.gsub!(/(#{Mx[:lnk_c]})#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
- '\1<text:a xlink:type="simple" xlink:href="\2">\2</text:a>') #special case \{ e.g. \}http://url
- if @inf =~/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/
- @inf.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
- %{#{url_brace.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{url_brace.xml_close}}) #http ftp matches with decoration
- else
- @inf.gsub!(/(https?:\/\/[^<>()'"\s]+)/,
- %{#{url_brace.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{url_brace.xml_close}}) #http ftp matches with decoration
- end
- @inf.gsub!(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+)/,
- %{#{url_brace.xml_open}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{url_brace.xml_close}}) if @inf !~/http:\/\// # improve upon, document crash where url contains '@' symbol
- end
- <<WOK
-<text:p text:style-name="P1">#{@tag.capitalize}: #{@inf}</text:p>
-WOK
- end
- def metadata
- Metadata::Summary.new(@md).metadata_base
- end
- self
- end
- def plaintext
- def meta_para
- <<WOK
-
-#{@tag.capitalize}: #{@inf}
-WOK
- end
- def metadata
- Metadata::Summary.new(@md).metadata_base
- end
- self
- end
- def manpage
- def meta_para
- <<WOK
-
-.TP
-#{@tag.capitalize}:
-.I #{@inf}
-WOK
- end
- def metadata
- Metadata::Summary.new(@md).metadata_base
- end
- self
- end
- end
- class TeX_metadata
- def initialize(md)
- @md=md
- @br="\\\\\n"
- end
- def meta_para(tag,inf,sc=true)
- inf=((inf.class==String && sc) ? spec_char(inf) : inf)
- %{\\begin\{bfseries\}#{tag}:\\end\{bfseries\} #{inf}
-}
- end
- def spec_char(inf)
- SiSU_TeX_Pdf::Special_characters.new(@md,inf).special_characters
- end
- def word_break_points(inf)
- SiSU_TeX_Pdf::Special_characters.new(@md,inf).special_word_break_points
- end
- def number_break_points(inf)
- SiSU_TeX_Pdf::Special_characters.new(@md,inf).special_number_break_points
- end
- def metadata_tex
- meta=[]
- dir=SiSU_Env::Info_env.new(@md.fns)
- base_html="#{dir.url.root}/#{@md.fnb}"
- l=SiSU_Env::Standardise_language.new.file_to_language(@md.fns)
- language=l[:l]
- tr=SiSU_Translate::Source.new(@md,language)
- tag="Document Manifest @"
- inf="#{@br}#{base_html}/#{@md.fn[:manifest]}"
- meta << meta_para(tag,inf)
- if defined? @md.title.full \
- and @md.title.full=~/\S+/
- tag,inf=tr.full_title,@md.title.full
- meta << meta_para(tag,inf)
- end
- if defined? @md.creator.author \
- and @md.creator.author=~/\S+/
- tag,inf=tr.author,@md.creator.author
- meta << meta_para(tag,inf)
- end
- if defined? @md.creator.translator \
- and @md.creator.translator=~/\S+/
- tag,inf=tr.translator,@md.creator.translator
- meta << meta_para(tag,inf)
- end
- if defined? @md.creator.illustrator \
- and @md.creator.illustrator=~/\S+/
- tag,inf=tr.illustrator,@md.creator.illustrator
- meta << meta_para(tag,inf)
- end
- if defined? @md.creator.prepared_by \
- and @md.creator.prepared_by=~/\S+/
- tag,inf=tr.prepared_by,@md.creator.prepared_by
- meta << meta_para(tag,inf)
- end
- if defined? @md.creator.digitized_by \
- and @md.creator.digitized_by=~/\S+/
- tag,inf=tr.digitized_by,@md.creator.digitized_by
- meta << meta_para(tag,inf)
- end
- if defined? @md.rights.all \
- and @md.rights.all=~/\S+/
- tag,inf=tr.rights,@md.rights.all
- meta << meta_para(tag,inf)
- end
- if defined? @md.notes.description \
- and @md.notes.description=~/\S+/
- tag,inf=tr.description,@md.notes.description
- meta << meta_para(tag,inf)
- end
- if defined? @md.classify.subject \
- and @md.classify.subject=~/\S+/
- tag,inf=tr.subject,@md.classify.subject
- meta << meta_para(tag,inf)
- end
- if defined? @md.publisher \
- and @md.publisher=~/\S+/
- tag,inf=tr.publisher,@md.publisher
- meta << meta_para(tag,inf)
- end
- if defined? @md.creator.contributor \
- and @md.creator.contributor=~/\S+/
- tag,inf=tr.contributor,@md.creator.contributor
- meta << meta_para(tag,inf)
- end
- if defined? @md.notes.abstract \
- and @md.notes.abstract=~/\S+/
- tag,inf=tr.abstract,@md.notes.abstract
- meta << meta_para(tag,inf)
- end
- if defined? @md.date.created \
- and @md.date.created=~/\S+/
- tag,inf=tr.date_created,@md.date.created
- meta << meta_para(tag,inf)
- end
- if defined? @md.date.issued \
- and @md.date.issued=~/\S+/
- tag,inf=tr.date_issued,@md.date.issued
- meta << meta_para(tag,inf)
- end
- if defined? @md.date.available \
- and @md.date.available=~/\S+/
- tag,inf=tr.date_available,@md.date.available
- meta << meta_para(tag,inf)
- end
- if defined? @md.date.modified \
- and @md.date.modified=~/\S+/
- tag,inf=tr.date_modified,@md.date.modified
- meta << meta_para(tag,inf)
- end
- if defined? @md.date.valid \
- and @md.date.valid=~/\S+/
- tag,inf=tr.date_valid,@md.date.valid
- meta << meta_para(tag,inf)
- end
- if defined? @md.date.published \
- and @md.date.published=~/\S+/
- tag,inf=tr.date,@md.date.published
- meta << meta_para(tag,inf)
- end
- if defined? @md.classify.topic_register \
- and @md.classify.topic_register=~/\S+/
- tag,inf=tr.topic_register,@md.classify.topic_register
- inf=word_break_points(inf)
- meta << meta_para(tag,inf)
- end
- if defined? @md.classify.loc \
- and @md.classify.loc=~/\S+/
- tag,inf=tr.cls_loc,@md.classify.loc
- meta << meta_para(tag,inf)
- end
- if defined? @md.classify.dewey \
- and @md.classify.dewey=~/\S+/
- tag,inf=tr.cls_dewey,@md.classify.dewey
- meta << meta_para(tag,inf)
- end
- if defined? @md.classify.oclc \
- and @md.classify.oclc=~/\S+/
- tag,inf=tr.cls_oclc,@md.classify.oclc
- meta << meta_para(tag,inf)
- end
- if defined? @md.classify.pg \
- and @md.classify.pg=~/\S+/
- tag,inf=tr.cls_gutenberg,@md.classify.pg
- meta << meta_para(tag,inf)
- end
- if defined? @md.classify.isbn \
- and @md.classify.isbn=~/\S+/
- tag,inf=tr.cls_isbn,@md.classify.isbn
- meta << meta_para(tag,inf)
- end
- if defined? @md.notes.comment \
- and @md.notes.comment=~/\S+/
- tag,inf=tr.comments,@md.notes.comment
- meta << meta_para(tag,inf)
- end
- if defined? @md.notes.prefix_a \
- and @md.notes.prefix_a=~/\S+/
- tag,inf=tr.prefix_a,@md.notes.prefix_a
- meta << meta_para(tag,inf)
- end
- if defined? @md.notes.prefix_b \
- and @md.notes.prefix_b=~/\S+/
- tag,inf=tr.prefix_b,@md.notes.prefix_b
- meta << meta_para(tag,inf)
- end
- if defined? @md.classify.identifier \
- and @md.classify.identifier=~/\S+/
- tag,inf=tr.identifier,@md.classify.identifier
- meta << meta_para(tag,inf)
- end
- if defined? @md.original.source \
- and @md.original.source=~/\S+/
- tag,inf=tr.source,@md.original.source
- meta << meta_para(tag,inf)
- end
- if defined? @md.title.language \
- and @md.title.language=~/\S+/
- tag,inf=tr.language,@md.title.language
- meta << meta_para(tag,inf)
- end
- if defined? @md.original.language \
- and @md.original.language=~/\S+/
- tag,inf=tr.language_original,@md.original.language
- meta << meta_para(tag,inf)
- end
- if defined? @md.classify.format \
- and @md.classify.format=~/\S+/
- tag,inf=tr.format,@md.classify.format
- meta << meta_para(tag,inf)
- end
- if defined? @md.classify.relation \
- and @md.classify.relation=~/\S+/
- tag,inf=tr.relation,@md.classify.relation
- meta << meta_para(tag,inf)
- end
- if defined? @md.classify.coverage \
- and @md.classify.coverage=~/\S+/
- tag,inf=tr.coverage,@md.classify.coverage
- meta << meta_para(tag,inf)
- end
- if defined? @md.classify.keywords \
- and @md.classify.keywords=~/\S+/
- tag,inf=tr.keywords,@md.classify.keywords
- meta << meta_para(tag,inf)
- end
- meta << %{#{@br}\\begin\{bfseries\}Version Information \\end\{bfseries\}}
- if defined? @md.fns \
- and @md.fns=~/\S+/
- fn=spec_char(@md.fns)
- fn=word_break_points(fn)
- fn="\\begin\{footnotesize\}#{fn}\\end\{footnotesize\}"
- tag,inf=tr.sourcefile,fn
- meta << meta_para(tag,inf,false)
- end
- if defined? @md.file_encoding \
- and @md.file_encoding=~/\S+/
- tag,inf='Filetype',@md.file_encoding
- meta << meta_para(tag,inf)
- end
- if defined? @md.dgst \
- and @md.dgst.class==Array
- hash_of=spec_char(@md.dgst[0])
- hash_of=word_break_points(hash_of)
- dgst=number_break_points(@md.dgst[1])
- tag,inf='Source Digest',"\\begin\{footnotesize\}#{hash_of}\\end\{footnotesize\}\\-\\begin\{scriptsize\}#{dgst}\\end\{scriptsize\}"
- meta << meta_para(tag,inf,false)
- end
- if defined? @md.dgst_skin \
- and @md.dgst_skin.class==Array
- hash_of=spec_char(@md.dgst_skin[0])
- hash_of=word_break_points(hash_of)
- dgst=number_break_points(@md.dgst_skin[1])
- tag,inf='Skin Digest',"\\begin\{footnotesize\}#{hash_of}\\end\{footnotesize\}\\-\\begin\{scriptsize\}#{dgst}\\end\{scriptsize\}"
- meta << meta_para(tag,inf,false)
- end
- meta << %{#{@br}\\begin\{bfseries\}Generated \\end\{bfseries\}}
- if defined? @md.generated \
- and @md.generated.class==Time
- tag,inf=tr.last_generated,@md.generated
- meta << meta_para(tag,inf)
- end
- if defined? @md.sisu_version \
- and @md.sisu_version[:version]=~/\S+/
- tag=tr.sisu_version
- inf="#{@md.sisu_version[:project]} " +
- "#{@md.sisu_version[:version]} " +
- "of #{@md.sisu_version[:date_stamp]} " +
- "(#{@md.sisu_version[:date]})"
- meta << meta_para(tag,inf)
- end
- if defined? @md.ruby_version \
- and @md.ruby_version=~/\S+/
- tag,inf=tr.ruby_version,@md.ruby_version
- meta << meta_para(tag,inf)
- end
- meta
- end
- end
-end
-__END__
diff --git a/lib/sisu/v2/shared_xml.rb b/lib/sisu/v2/shared_xml.rb
deleted file mode 100644
index e82f51bf..00000000
--- a/lib/sisu/v2/shared_xml.rb
+++ /dev/null
@@ -1,706 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: common file for xml generation
-=end
-module SiSU_XML_munge
- class Trans
- require "#{SiSU_lib}/defaults" # defaults.rb
- def initialize(md)
- @md=md
- @sys=SiSU_Env::System_call.new
- @dir=SiSU_Env::Info_env.new(@md.fns)
- @brace_url=SiSU_Viz::Skin.new.url_decoration
- if @md.sem_tag
- @ab ||=semantic_tags.default
- end
- end
- def semantic_tags
- def default
- {
- :pub => 'publication',
- :conv => 'convention',
- :vol => 'volume',
- :pg => 'page',
- :cty => 'city',
- :org => 'organization',
- :uni => 'university',
- :dept => 'department',
- :fac => 'faculty',
- :inst => 'institute',
- :co => 'company',
- :com => 'company',
- :conv => 'convention',
- :dt => 'date',
- :y => 'year',
- :m => 'month',
- :d => 'day',
- :ti => 'title',
- :au => 'author',
- :ed => 'editor', #editor?
- :v => 'version', #edition
- :n => 'name',
- :fn => 'firstname',
- :mn => 'middlename',
- :ln => 'lastname',
- :in => 'initials',
- :qt => 'quote',
- :ct => 'cite',
- :ref => 'reference',
- :ab => 'abreviation',
- :def => 'define',
- :desc => 'description',
- :trans => 'translate',
- }
- end
- self
- end
- def char_enc #character encode
- def utf8(dob='')
- if @sys.locale =~/utf-?8/i # instead ucs for utf8 #require 'iconv' ? Iñtërnâtiônàlizætiøn
- str=if defined? dob.obj; dob.obj
- elsif dob.class==String; dob
- end
- if str
- #¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûü
- #¢£¥§©ª«®°±²³µ¶¹º»¼½¾×÷
- str.gsub!(/</um,'&#60;') # '&lt;' # &#060;
- str.gsub!(/>/um,'&#62;') # '&gt;' # &#062;
- str.gsub!(/¢/um,'&#162;') # '&cent;' # &#162;
- str.gsub!(/£/um,'&#163;') # '&pound;' # &#163;
- str.gsub!(/¥/um,'&#165;') # '&yen;' # &#165;
- str.gsub!(/§/um,'&#167;') # '&sect;' # &#167;
- str.gsub!(/©/um,'&#169;') # '&copy;' # &#169;
- str.gsub!(/ª/um,'&#170;') # '&ordf;' # &#170;
- str.gsub!(/«/um,'&#171;') # '&laquo;' # &#171;
- str.gsub!(/®/um,'&#174;') # '&reg;' # &#174;
- str.gsub!(/°/um,'&#176;') # '&deg;' # &#176;
- str.gsub!(/±/um,'&#177;') # '&plusmn;' # &#177;
- str.gsub!(/²/um,'&#178;') # '&sup2;' # &#178;
- str.gsub!(/³/um,'&#179;') # '&sup3;' # &#179;
- str.gsub!(/µ/um,'&#181;') # '&micro;' # &#181;
- str.gsub!(/¶/um,'&#182;') # '&para;' # &#182;
- str.gsub!(/¹/um,'&#185;') # '&sup1;' # &#185;
- str.gsub!(/º/um,'&#186;') # '&ordm;' # &#186;
- str.gsub!(/»/um,'&#187;') # '&raquo;' # &#187;
- str.gsub!(/¼/um,'&#188;') # '&frac14;' # &#188;
- str.gsub!(/½/um,'&#189;') # '&frac12;' # &#189;
- str.gsub!(/¾/um,'&#190;') # '&frac34;' # &#190;
- str.gsub!(/×/um,'&#215;') # '&times;' # &#215;
- str.gsub!(/÷/um,'&#247;') # '&divide;' # &#247;
- str.gsub!(/¿/um,'&#191;') # '&iquest;' # &#191;
- str.gsub!(/À/um,'&#192;') # '&Agrave;' # &#192;
- str.gsub!(/Á/um,'&#193;') # '&Aacute;' # &#193;
- str.gsub!(/Â/um,'&#194;') # '&Acirc;' # &#194;
- str.gsub!(/Ã/um,'&#195;') # '&Atilde;' # &#195;
- str.gsub!(/Ä/um,'&#196;') # '&Auml;' # &#196;
- str.gsub!(/Å/um,'&#197;') # '&Aring;' # &#197;
- str.gsub!(/Æ/um,'&#198;') # '&AElig;' # &#198;
- str.gsub!(/Ç/um,'&#199;') # '&Ccedil;' # &#199;
- str.gsub!(/È/um,'&#200;') # '&Egrave;' # &#200;
- str.gsub!(/É/um,'&#201;') # '&Eacute;' # &#201;
- str.gsub!(/Ê/um,'&#202;') # '&Ecirc;' # &#202;
- str.gsub!(/Ë/um,'&#203;') # '&Euml;' # &#203;
- str.gsub!(/Ì/um,'&#204;') # '&Igrave;' # &#204;
- str.gsub!(/Í/um,'&#205;') # '&Iacute;' # &#205;
- str.gsub!(/Î/um,'&#206;') # '&Icirc;' # &#206;
- str.gsub!(/Ï/um,'&#207;') # '&Iuml;' # &#207;
- str.gsub!(/Ð/um,'&#208;') # '&ETH;' # &#208;
- str.gsub!(/Ñ/um,'&#209;') # '&Ntilde;' # &#209;
- str.gsub!(/Ò/um,'&#210;') # '&Ograve;' # &#210;
- str.gsub!(/Ó/um,'&#211;') # '&Oacute;' # &#211;
- str.gsub!(/Ô/um,'&#212;') # '&Ocirc;' # &#212;
- str.gsub!(/Õ/um,'&#213;') # '&Otilde;' # &#213;
- str.gsub!(/Ö/um,'&#214;') # '&Ouml;' # &#214;
- str.gsub!(/Ø/um,'&#216;') # '&Oslash;' # &#216;
- str.gsub!(/Ù/um,'&#217;') # '&Ugrave;' # &#217;
- str.gsub!(/Ú/um,'&#218;') # '&Uacute;' # &#218;
- str.gsub!(/Û/um,'&#219;') # '&Ucirc;' # &#219;
- str.gsub!(/Ü/um,'&#220;') # '&Uuml;' # &#220;
- str.gsub!(/Ý/um,'&#221;') # '&Yacute;' # &#221;
- str.gsub!(/Þ/um,'&#222;') # '&THORN;' # &#222;
- str.gsub!(/ß/um,'&#223;') # '&szlig;' # &#223;
- str.gsub!(/à/um,'&#224;') # '&agrave;' # &#224;
- str.gsub!(/á/um,'&#225;') # '&aacute;' # &#225;
- str.gsub!(/â/um,'&#226;') # '&acirc;' # &#226;
- str.gsub!(/ã/um,'&#227;') # '&atilde;' # &#227;
- str.gsub!(/ä/um,'&#228;') # '&auml;' # &#228;
- str.gsub!(/å/um,'&#229;') # '&aring;' # &#229;
- str.gsub!(/æ/um,'&#230;') # '&aelig;' # &#230;
- str.gsub!(/ç/um,'&#231;') # '&ccedil;' # &#231;
- str.gsub!(/è/um,'&#232;') # '&egrave;' # &#232;
- str.gsub!(/é/um,'&#233;') # '&acute;' # &#233;
- str.gsub!(/ê/um,'&#234;') # '&circ;' # &#234;
- str.gsub!(/ë/um,'&#235;') # '&euml;' # &#235;
- str.gsub!(/ì/um,'&#236;') # '&igrave;' # &#236;
- str.gsub!(/í/um,'&#237;') # '&acute;' # &#237;
- str.gsub!(/î/um,'&#238;') # '&icirc;' # &#238;
- str.gsub!(/ï/um,'&#239;') # '&iuml;' # &#239;
- str.gsub!(/ð/um,'&#240;') # '&eth;' # &#240;
- str.gsub!(/ñ/um,'&#241;') # '&ntilde;' # &#241;
- str.gsub!(/ò/um,'&#242;') # '&ograve;' # &#242;
- str.gsub!(/ó/um,'&#243;') # '&oacute;' # &#243;
- str.gsub!(/ô/um,'&#244;') # '&ocirc;' # &#244;
- str.gsub!(/õ/um,'&#245;') # '&otilde;' # &#245;
- str.gsub!(/ö/um,'&#246;') # '&ouml;' # &#246;
- str.gsub!(/ø/um,'&#248;') # '&oslash;' # &#248;
- str.gsub!(/ù/um,'&#250;') # '&ugrave;' # &#250;
- str.gsub!(/ú/um,'&#251;') # '&uacute;' # &#251;
- str.gsub!(/û/um,'&#252;') # '&ucirc;' # &#252;
- str.gsub!(/ü/um,'&#253;') # '&uuml;' # &#253;
- str.gsub!(/þ/um,'&#254;') # '&thorn;' # &#254;
- str.gsub!(/ÿ/um,'&#255;') # '&yuml;' # &#255;
- str.gsub!(/‘/um,'&#8216;') # '&lsquo;' # &#8216;
- str.gsub!(/’/um,'&#8217;') # '&rsquo;' # &#8217;
- str.gsub!(/“/um,'&#8220;') # &ldquo; # &#8220;
- str.gsub!(/”/um,'&#8221;') # &rdquo; # &#8221;
- str.gsub!(/–/um,'&#8211;') # &ndash; # &#8211;
- str.gsub!(/—/um,'&#8212;') # &mdash; # &#8212;
- str.gsub!(/∝/um,'&#8733;') # &prop; # &#8733;
- str.gsub!(/∞/um,'&#8734;') # &infin; # &#8734;
- str.gsub!(/™/um,'&#8482;') # &trade; # &#8482;
- str.gsub!(/✠/um,'&#10016;') # &cross; # &#10016;
- str.gsub!(/ /um,' ') # space identify
- str.gsub!(/ /um,' ') # space identify
- end
- dob=if defined? dob.obj
- dob.obj=str
- dob
- elsif dob.class==String; dob
- end
- dob
- end
- end
- def html(dob='')
- if @sys.locale =~/utf-?8/i # instead ucs for utf8 #require 'iconv' ? Iñtërnâtiônàlizætiøn
- dob.obj.gsub!(/ /u,' ') # space identify
- dob.obj.gsub!(/ /u,' ') # space identify
- else
- dob.obj.gsub!(/¢/u,'&cent;') # &#162;
- dob.obj.gsub!(/£/u,'&pound;') # &#163;
- dob.obj.gsub!(/¥/u,'&yen;') # &#165;
- dob.obj.gsub!(/§/u,'&sect;') # &#167;
- dob.obj.gsub!(/©/u,'&copy;') # &#169;
- dob.obj.gsub!(/ª/u,'&ordf;') # &#170;
- dob.obj.gsub!(/«/u,'&laquo;') # &#171;
- dob.obj.gsub!(/®/u,'&reg;') # &#174;
- dob.obj.gsub!(/°/u,'&deg;') # &#176;
- dob.obj.gsub!(/±/u,'&plusmn;') # &#177;
- dob.obj.gsub!(/²/u,'&sup2;') # &#178;
- dob.obj.gsub!(/³/u,'&sup3;') # &#179;
- dob.obj.gsub!(/µ/u,'&micro;') # &#181;
- dob.obj.gsub!(/¶/u,'&para;') # &#182;
- dob.obj.gsub!(/¹/u,'&sup1;') # &#185;
- dob.obj.gsub!(/º/u,'&ordm;') # &#186;
- dob.obj.gsub!(/»/u,'&raquo;') # &#187;
- dob.obj.gsub!(/¼/u,'&frac14;') # &#188;
- dob.obj.gsub!(/½/u,'&frac12;') # &#189;
- dob.obj.gsub!(/¾/u,'&frac34;') # &#190;
- dob.obj.gsub!(/×/u,'&times;') # &#215;
- dob.obj.gsub!(/÷/u,'&divide;') # &#247;
- dob.obj.gsub!(/¿/u,'&iquest;') # &#191;
- dob.obj.gsub!(/À/u,'&Agrave;') # &#192;
- dob.obj.gsub!(/Á/u,'&Aacute;') # &#193;
- dob.obj.gsub!(/Â/u,'&Acirc;') # &#194;
- dob.obj.gsub!(/Ã/u,'&Atilde;') # &#195;
- dob.obj.gsub!(/Ä/u,'&Auml;') # &#196;
- dob.obj.gsub!(/Å/u,'&Aring;') # &#197;
- dob.obj.gsub!(/Æ/u,'&AElig;') # &#198;
- dob.obj.gsub!(/Ç/u,'&Ccedil;') # &#199;
- dob.obj.gsub!(/È/u,'&Egrave;') # &#200;
- dob.obj.gsub!(/É/u,'&Eacute;') # &#201;
- dob.obj.gsub!(/Ê/u,'&Ecirc;') # &#202;
- dob.obj.gsub!(/Ë/u,'&Euml;') # &#203;
- dob.obj.gsub!(/Ì/u,'&Igrave;') # &#204;
- dob.obj.gsub!(/Í/u,'&Iacute;') # &#205;
- dob.obj.gsub!(/Î/u,'&Icirc;') # &#206;
- dob.obj.gsub!(/Ï/u,'&Iuml;') # &#207;
- dob.obj.gsub!(/Ð/u,'&ETH;') # &#208;
- dob.obj.gsub!(/Ñ/u,'&Ntilde;') # &#209;
- dob.obj.gsub!(/Ò/u,'&Ograve;') # &#210;
- dob.obj.gsub!(/Ó/u,'&Oacute;') # &#211;
- dob.obj.gsub!(/Ô/u,'&Ocirc;') # &#212;
- dob.obj.gsub!(/Õ/u,'&Otilde;') # &#213;
- dob.obj.gsub!(/Ö/u,'&Ouml;') # &#214;
- dob.obj.gsub!(/Ø/u,'&Oslash;') # &#216;
- dob.obj.gsub!(/Ù/u,'&Ugrave;') # &#217;
- dob.obj.gsub!(/Ú/u,'&Uacute;') # &#218;
- dob.obj.gsub!(/Û/u,'&Ucirc;') # &#219;
- dob.obj.gsub!(/Ü/u,'&Uuml;') # &#220;
- dob.obj.gsub!(/Ý/u,'&Yacute;') # &#221;
- dob.obj.gsub!(/Þ/u,'&THORN;') # &#222;
- dob.obj.gsub!(/ß/u,'&szlig;') # &#223;
- dob.obj.gsub!(/à/u,'&agrave;') # &#224;
- dob.obj.gsub!(/á/u,'&aacute;') # &#225;
- dob.obj.gsub!(/â/u,'&acirc;') # &#226;
- dob.obj.gsub!(/ã/u,'&atilde;') # &#227;
- dob.obj.gsub!(/ä/u,'&auml;') # &#228;
- dob.obj.gsub!(/å/u,'&aring;') # &#229;
- dob.obj.gsub!(/æ/u,'&aelig;') # &#230;
- dob.obj.gsub!(/ç/u,'&ccedil;') # &#231;
- dob.obj.gsub!(/è/u,'&egrave;') # &#232;
- dob.obj.gsub!(/é/u,'&acute;') # &#233;
- dob.obj.gsub!(/ê/u,'&circ;') # &#234;
- dob.obj.gsub!(/ë/u,'&euml;') # &#235;
- dob.obj.gsub!(/ì/u,'&igrave;') # &#236;
- dob.obj.gsub!(/í/u,'&acute;') # &#237;
- dob.obj.gsub!(/î/u,'&icirc;') # &#238;
- dob.obj.gsub!(/ï/u,'&iuml;') # &#239;
- dob.obj.gsub!(/ð/u,'&eth;') # &#240;
- dob.obj.gsub!(/ñ/u,'&ntilde;') # &#241;
- dob.obj.gsub!(/ò/u,'&ograve;') # &#242;
- dob.obj.gsub!(/ó/u,'&oacute;') # &#243;
- dob.obj.gsub!(/ô/u,'&ocirc;') # &#244;
- dob.obj.gsub!(/õ/u,'&otilde;') # &#245;
- dob.obj.gsub!(/ö/u,'&ouml;') # &#246;
- dob.obj.gsub!(/ø/u,'&oslash;') # &#248;
- dob.obj.gsub!(/ù/u,'&ugrave;') # &#250;
- dob.obj.gsub!(/ú/u,'&uacute;') # &#251;
- dob.obj.gsub!(/û/u,'&ucirc;') # &#252;
- dob.obj.gsub!(/ü/u,'&uuml;') # &#253;
- dob.obj.gsub!(/þ/u,'&thorn;') # &#254;
- dob.obj.gsub!(/ÿ/u,'&yuml;') # &#255;
- dob.obj.gsub!(/‘/u,'&#lsquo;') # &lsquo; # &#8216;
- dob.obj.gsub!(/’/u,'&#rsquo;') # &rsquo; # &#8217;
- dob.obj.gsub!(/“/u,'&ldquo;') # &ldquo; # &#8220;
- dob.obj.gsub!(/”/u,'&rdquo;') # &rdquo; # &#8221;
- dob.obj.gsub!(/–/u,'&ndash;') # &ndash; # &#8211;
- dob.obj.gsub!(/—/u,'&mdash;') # &mdash; # &#8212;
- dob.obj.gsub!(/∝/u,'&prop;') # &prop; # &#8733;
- dob.obj.gsub!(/∞/u,'&infin;') # &infin; # &#8734;
- dob.obj.gsub!(/™/u,'&trade;') # &trade; # &#8482;
- dob.obj.gsub!(/✠/u,'&#10016;') # &#10016;
- #par.obja.gsub!(/✠/u '&dagger;') # &dagger; # &#8224; incorrect replacement †
- dob.obj.gsub!(/ /u,' ') # space identify
- dob.obj.gsub!(/ /u,' ') # space identify
- end
- end
- self
- end
- def tidywords(wordlist)
- wordlist.each do |x|
- #imperfect solution will not catch all possible cases
- x.gsub!(/&/,'&amp;') unless x =~/&\S+;/
- x.gsub!(/&([A-Z])/,'&amp;\1')
- end
- end
- def markup(dob='')
- wordlist=dob.obj.scan(/&[#0-9a-z]+;|\S+|\n/) #\n needed for tables, check though added 2005w17
- dob.obj=tidywords(wordlist).join(' ').strip
- unless dob.is=='table'
- dob.obj.gsub!(/#{Mx[:br_line]}/u,'<br />')
- dob.obj.gsub!(/#{Mx[:br_paragraph]}/u,'<br />')
- dob.obj.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />')
- end
- dob.obj.gsub!(/#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}/,'')
- dob.obj.gsub!(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;')
- dob.obj.gsub!(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;')
- dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+)<\s+/,'\1&lt; '); dob.obj.gsub!(/\s+>(\s+|$)/,' &gt;\1')
- #dob.obj.gsub!(/#{Mx[:fa_emphasis_o]}(.+?)#{Mx[:fa_emphasis_c]}/,'<em>\1</em>') #reinstate
- dob.obj.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/m,'<b>\1</b>')
- dob.obj.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/m,'<i>\1</i>')
- dob.obj.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>')
- dob.obj.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>')
- dob.obj.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>')
- dob.obj.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'<ins>\1</ins>')
- dob.obj.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>')
- dob.obj.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>')
- dob.obj.gsub!(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>')
- dob.obj.gsub!(/<:pb>\s*/,'') #Fix
- dob.obj.gsub!(/<+[-~]#>+/,'')
- if dob.is !~/^code/
- #embeds a red-bullet image -->
- dob.obj.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>')
- dob.obj.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>')
- dob.obj.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>')
- dob.obj.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>')
- dob.obj.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />') unless dob.is=='table'
- dob.obj.gsub!(/#{Mx[:br_page]}\s*/,'')
- dob.obj.gsub!(/#{Mx[:br_page_new]}\s*/,'')
- dob.obj.gsub!(/#{Mx[:pa_non_object_no_heading]}|#{Mx[:pa_non_object_dummy_heading]}/,''); dob.obj.gsub!(/<[-~]#>/,'')
- dob.obj.gsub!(/href="#{Xx[:segment]}/m,'href="')
- dob.obj.gsub!(/#{Mx[:lnk_o]}([^#{Mx[:lnk_o]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{Mx[:rel_c]}]+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}(\.\.\/\S+?)#{Mx[:rel_c]}/,
- '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\2">\1</link>')
- dob.obj.gsub!(/#{Mx[:lnk_o]}([^#{Mx[:lnk_o]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{Mx[:rel_c]}]+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}:(\S+?)#{Mx[:rel_c]}/,
- '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="../\2">\1</link>')
- dob.obj.gsub!(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}(\S+?)#{Mx[:rel_c]}/,
- '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="#\2">\1</link>')
- dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))[ ]+(\d+)x(\d+)(\s+[^}]+)?#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
- %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@dir.url.images_local}/\\1" width="\\2" height="\\3" />[\\1] \\4})
- dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))([ ]+[^}]+)?#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
- %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@dir.url.images_local}/\\1"/>\\1})
- dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))[ ]+(\d+)x(\d+)(\s+[^}]+)?#{Mx[:lnk_c]}image/,
- %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@dir.url.images_local}/\\1" width="\\2" height="\\3" />[\\1] \\4})
- dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))([ ]+[^}]+)?#{Mx[:lnk_c]}image/,
- %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@dir.url.images_local}/\\1"/>\\1})
- dob.obj.gsub!(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
- '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\2">\1</link>') #watch, compare html_tune
- dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
- %{#{@brace_url.xml_open}<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\\1">\\1</link>#{@brace_url.xml_close}})
- dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,
- '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\1">\1</link>') #escaped urls not linked, deal with later
- else
- dob.obj.gsub!(/(^|[^}])_</m,'\1&lt;'); dob.obj.gsub!(/(^|[^}])_>/m,'\1&gt;') #code-block: angle brackets special characters
- dob.obj.gsub!(/(^|[^}])_</m,'\1&lt;'); dob.obj.gsub!(/(^|[^}])_>/m,'\1&gt;')
- end
- if dob.of=='group'
- dob.obj.gsub!(/#{Mx[:gl_bullet]}/,'● ')
- end
- dob.obj.gsub!(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,
- %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}})
- dob.obj.gsub!(/#{Dx[:url_o]}/,"#{Dx[:url_o_xml]}")
- dob.obj.gsub!(/#{Dx[:url_c]}/,"#{Dx[:url_c_xml]}")
- dob.obj.gsub!(/&nbsp;|#{Mx[:nbsp]}/m,'&#160;')
- dob
- end
- def markup_light(dob='')
- dob.obj.gsub!(/\/\{(.+?)\}\//,'<i>\1</i>')
- dob.obj.gsub!(/[*!]\{(.+?)\}[*!]/,'<b>\1</b>')
- dob.obj.gsub!(/_\{(.+?)\}_/,'<u>\1</u>')
- dob.obj.gsub!(/-\{(.+?)\}-/,'<del>\1</del>')
- dob.obj.gsub!(/<br(\s*\/)?>/,'<br />')
- dob.obj.gsub!(/<:pb>\s*/,'')
- dob.obj.gsub!(/<[-~]#>/,'')
- dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s)&\s+/,'\1&amp; ') #sort
- dob.obj.gsub!(/&([^;]{1,5})/,'&amp;\1') #sort, rough estimate, revisit #WATCH found in node not sax
- dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif))[ ]+.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/,
- "<image.path>#{@dir.url.images_local}\/\\1</image.path>")
- dob.obj.gsub!(/&nbsp;|#{Mx[:nbsp]}/,'&#160;')
- wordlist=dob.obj.scan(/&[#0-9a-z]+;|\S+|\n/) #\n needed for tables, check though added 2005w17
- dob.obj=tidywords(wordlist).join(' ').strip
- dob
- end
- def markup_fictionbook(dob='')
- dob.obj.gsub!(/~\{([\d*+]+).+?\}~/,'[\1]')
- dob.obj.gsub!(/\/\{(.+?)\}\//,'<i>\1</i>')
- dob.obj.gsub!(/[*!]\{(.+?)\}[*!]/,'<b>\1</b>')
- dob.obj.gsub!(/_\{(.+?)\}_/,'<u>\1</u>')
- dob.obj.gsub!(/-\{(.+?)\}-/,'<del>\1</del>')
- dob.obj.gsub!(/<br(?:\s*\/)?>/,'<br />')
- dob.obj.gsub!(/<:pb>\s*/,'')
- dob.obj.gsub!(/<[-~]#>/,'')
- #temporary -->
- dob.obj.gsub!(/<:\S+?>/,'')
- #<-- temporary
- dob.obj.gsub!(/<[-~]#>/,'')
- dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s)&\s+/,'\1&amp; ') #sort
- dob.obj.gsub!(/&([^;]{1,5})/,'&amp;\1') #sort, rough estimate, revisit #WATCH found in node not sax
- dob.obj.gsub!(/(#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif))[ ]+.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/,
- "<image.path>#{@dir.url.images_local}\/\\1</image.path>")
- dob.obj.gsub!(/&nbsp;|#{Mx[:nbsp]}/,'&#160;')
- wordlist=dob.obj.scan(/&[#0-9a-z]+;|\S+|\n/) #\n needed for tables, check though added 2005w17
- dob.obj=tidywords(wordlist).join(' ').strip
- dob
- end
- def markup_group(dob='')
- dob.obj.gsub!(/</,'&lt;'); dob.obj.gsub!(/>/,'&gt;')
- dob.obj.gsub!(/&lt;:?br(?:\s+\/)?&gt;/,'<br />')
- dob.obj.gsub!(/&lt;(link xmlns:xlink=".+?")&gt;/,'<\1>')
- dob.obj.gsub!(/&lt;(\/link)&gt;/,'<\1>')
- dob.obj.gsub!(/&lt;(\/?en)&gt;/,'<\1>')
- dob
- end
- def xml_sem_block_paired(matched) # colon depth: many, recurs
- matched.gsub!(/\b(au):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:au]} depth="many">\\2</sem:#{@ab[:au]}>})
- matched.gsub!(/\b(vol):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:vol]} depth="many">\\2</sem:#{@ab[:vol]}>})
- matched.gsub!(/\b(pub):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:pub]} depth="many">\\2</sem:#{@ab[:pub]}>})
- matched.gsub!(/\b(ref):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:ref]} depth="many">\\2</sem:#{@ab[:ref]}>})
- matched.gsub!(/\b(desc):\{(.+?)\}:\1\b/m,%{<sem:#{@ab[:desc]} depth="many">\\2</sem:#{@ab[:desc]}>})
- matched.gsub!(/\b(conv):\{(.+?)\}:\1\b/m,%{<sem:#{@ab[:conv]} depth="many">\\2</sem:#{@ab[:conv]}>})
- matched.gsub!(/\b(ct):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:ct]} depth="many">\\2</sem:#{@ab[:ct]}>})
- matched.gsub!(/\b(cty):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:cty]} depth="many">\\2</sem:#{@ab[:cty]}>})
- matched.gsub!(/\b(org):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:org]} depth="many">\\2</sem:#{@ab[:org]}>})
- matched.gsub!(/\b(dt):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:dt]} depth="many">\\2</sem:#{@ab[:dt]}>})
- matched.gsub!(/\b(n):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:n]} depth="many">\\2</sem:#{@ab[:n]}>})
- matched.gsub!(/([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\1)/m,'<sem:\1 depth="many">\2</sem:\1>')
- end
- def xml_semantic_tags(dob)
- if @md.sem_tag
- dob.obj.gsub!(/([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\1)/m) {|c| xml_sem_block_paired(c) }
- dob.obj.gsub!(/([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\1)/m) {|c| xml_sem_block_paired(c) }
- dob.obj.gsub!(/([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\1)/m) {|c| xml_sem_block_paired(c) }
- dob.obj.gsub!(/:\{(.+?)\}:au\b/m, %{<sem:#{@ab[:au]} depth="one">\\1</sem:#{@ab[:au]}>})
- dob.obj.gsub!(/:\{(.+?)\}:n\b/m, %{<sem:#{@ab[:n]} depth="one">\\1</sem:#{@ab[:n]}>})
- dob.obj.gsub!(/:\{(.+?)\}:ti\b/m, %{<sem:#{@ab[:ti]} depth="one">\\1</sem:#{@ab[:ti]}>})
- dob.obj.gsub!(/:\{(.+?)\}:ref\b/m, %{<sem:#{@ab[:ref]} depth="one">\\1</sem:#{@ab[:ref]}>})
- dob.obj.gsub!(/:\{(.+?)\}:desc\b/m, %{<sem:#{@ab[:desc]} depth="one">\\1</sem:#{@ab[:desc]}>})
- dob.obj.gsub!(/:\{(.+?)\}:cty\b/m, %{<sem:#{@ab[:cty]} depth="one">\\1</sem:#{@ab[:cty]}>})
- dob.obj.gsub!(/:\{(.+?)\}:org\b/m, %{<sem:#{@ab[:org]} depth="one">\\1</sem:#{@ab[:org]}>})
- dob.obj.gsub!(/:\{(.+?)\}:([a-z]+(?:[_:.][a-z]+)*)/m,'<sem:\2 depth="one">\1</sem:\2>')
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};ti\b/m, %{<sem:#{@ab[:ti]} depth="zero">\\1</sem:#{@ab[:ti]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};qt\b/m, %{<sem:#{@ab[:qt]} depth="zero">\\1</sem:#{@ab[:qt]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};ref\b/m, %{<sem:#{@ab[:ref]} depth="zero">\\1</sem:#{@ab[:ref]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};ed\b/m, %{<sem:#{@ab[:ed]} depth="zero">\\1</sem:#{@ab[:ed]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};v\b/m, %{<sem:#{@ab[:v]} depth="zero">\\1</sem:#{@ab[:v]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};desc\b/m, %{<sem:#{@ab[:desc]} depth="zero">\\1</sem:#{@ab[:desc]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};def\b/m, %{<sem:#{@ab[:def]} depth="zero">\\1</sem:#{@ab[:def]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};trans\b/m, %{<sem:#{@ab[:trans]} depth="zero">\\1</sem:#{@ab[:trans]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};y\b/m, %{<sem:#{@ab[:y]} depth="zero">\\1</sem:#{@ab[:y]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};ab\b/m, %{<sem:#{@ab[:ab]} depth="zero">\\1</sem:#{@ab[:ab]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};pg\b/m, %{<sem:#{@ab[:pg]} depth="zero">\\1</sem:#{@ab[:pg]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};fn?\b/m, %{<sem:#{@ab[:fn]} depth="zero">\\1</sem:#{@ab[:fn]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};mn?\b/m, %{<sem:#{@ab[:mn]} depth="zero">\\1</sem:#{@ab[:mn]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};ln?\b/m, %{<sem:#{@ab[:ln]} depth="zero">\\1</sem:#{@ab[:ln]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};in\b/m, %{<sem:#{@ab[:in]} depth="zero">\\1</sem:#{@ab[:in]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};uni\b/m, %{<sem:#{@ab[:uni]} depth="zero">\\1</sem:#{@ab[:uni]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};fac\b/m, %{<sem:#{@ab[:fac]} depth="zero">\\1</sem:#{@ab[:fac]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};inst\b/m, %{<sem:#{@ab[:inst]} depth="zero">\\1</sem:#{@ab[:inst]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};dept\b/m, %{<sem:#{@ab[:dpt]} depth="zero">\\1</sem:#{@ab[:dept]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};org\b/m, %{<sem:#{@ab[:org]} depth="zero">\\1</sem:#{@ab[:org]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};com?\b/m, %{<sem:#{@ab[:com]} depth="zero">\\1</sem:#{@ab[:com]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};cty\b/m, %{<sem:#{@ab[:cty]} depth="zero">\\1</sem:#{@ab[:cty]}>})
- dob.obj.gsub!(/;\{([^}]+(?![;]))\};([a-z]+(?:[_:.][a-z]+)*)/m,'<sem:\2 depth="zero">\1</sem:\2>')
- end
- dob
- end
- end
-end
-module SiSU_XML_tags #Format
- require "#{SiSU_lib}/param" # param.rb
- include SiSU_Param
- include SiSU_Viz
- class RDF
- def initialize(md='',seg_name=[],tracker=0)
- @full_title=@subtitle=@author=@subject=@description=@publisher=@contributor=@date=@date_created=@date_issued=@date_available=@date_valid=@date_modified=@type=@format=@identifier=@source=@language=@relation=@coverage=@rights=@copyright=@owner=@keywords=''
- @md=md
- @rdfurl=%{ rdf:about="http://www.jus.uio.no/lm/toc"\n}
- if defined? @md.title.full \
- and @md.title.full # DublinCore 1 - title
- @rdf_title=%{ dc.title="#{seg_name}#{@md.title.full}"\n}
- @full_title=%{ <meta name="dc.title" content="#{@md.title.full}" />\n}
- end
- if defined? @md.creator.author \
- and @md.creator.author=~/\S+/ # DublinCore 2 - creator/author (author)
- @rdf_author=%{ dc.author="#{@md.creator.author}"\n}
- content=meta_content_clean(@md.creator.author)
- @author=%{ <meta name="dc.author" content="#{content}" />\n}
- end
- if defined? @md.classify.subject \
- and @md.classify.subject=~/\S+/ # DublinCore 3 - subject (us library of congress, eric or udc, or schema???)
- @rdf_subject=%{ dc.subject="#{@md.classify.subject}"\n}
- content=meta_content_clean(@md.classify.subject)
- @subject=%{ <meta name="dc.subject" content="#{content}" />\n}
- end
- if defined? @md.notes.description \
- and @md.notes.description=~/\S+/ # DublinCore 4 - description
- @rdf_description=%{ dc.description="#{@md.notes.description}"\n}
- content=meta_content_clean(@md.notes.description)
- @description=%{ <meta name="dc.description" content="#{content}" />\n}
- end
- if defined? @md.publisher \
- and @md.publisher # DublinCore 5 - publisher (current copy published by)
- @rdf_publisher=%{ dc.publisher="#{@md.publisher}"\n}
- content=meta_content_clean(@md.publisher)
- @publisher=%{ <meta name="dc.publisher" content="#{content}" />\n}
- end
- if defined? @md.creator.contributor \
- and @md.creator.contributor=~/\S+/ # DublinCore 6 - contributor
- @rdf_contributor=%{ dc.contributor="#{@md.creator.contributor}"\n}
- content=meta_content_clean(@md.creator.contributor)
- @contributor=%{ <meta name="dc.contributor" content="#{content}" />\n}
- end
- if defined? @md.date.published \
- and @md.date.published=~/\S+/ # DublinCore 7 - date year-mm-dd
- @rdf_date=%{ dc.date="#{@md.date.published}"\n}
- @date=%{ <meta name="dc.date" content="#{@md.date.published}" #{@md.date_scheme} />\n} # fix @md.date_scheme
- end
- if defined? @md.date.created \
- and @md.date.created=~/\S+/ # DublinCore 7 - date.created year-mm-dd
- @rdf_date_created=%{ dc.date.created="#{@md.date.created}"\n}
- @date_created=%{ <meta name="dc.date.created" content="#{@md.date.created}" #{@md.date_scheme} />\n}
- end
- if defined? @md.date.issued \
- and @md.date.issued=~/\S+/ # DublinCore 7 - date.issued year-mm-dd
- @rdf_date_issued=%{ dc.date.issued="#{@md.date.issued}"\n}
- @date_issued=%{ <meta name="dc.date.issued" content="#{@md.date.issued}" #{@md.date_scheme} />\n}
- end
- if defined? @md.date.available \
- and @md.date.available=~/\S+/ # DublinCore 7 - date.available year-mm-dd
- @rdf_date_available=%{ dc.date.available="#{@md.date.available}"\n}
- @date_available=%{ <meta name="dc.date.available" content="#{@md.date.available}" #{@md.date_scheme} />\n}
- end
- if defined? @md.date.valid \
- and @md.date.valid=~/\S+/ # DublinCore 7 - date.valid year-mm-dd
- @rdf_date_valid=%{ dc.date.valid="#{@md.date.valid}"\n}
- @date_valid=%{ <meta name="dc.date.valid" content="#{@md.date.valid}" #{@md.date_scheme} />\n}
- end
- if defined? @md.date.modified \
- and @md.date.modified=~/\S+/ # DublinCore 7 - date.modified year-mm-dd
- @rdf_date_modified=%{ dc.date.modified="#{@md.date.modified}"\n}
- @date_modified=%{ <meta name="dc.date.modified" content="#{@md.date.modified}" #{@md.date_scheme} />\n}
- end
- if defined? @md.type \
- and @md.type # DublinCore 8 - type (genre eg. report, convention etc)
- @rdf_type=%{ dc.type="#{@md.type}"\n}
- content=meta_content_clean(@md.type)
- @type=%{ <meta name="dc.type" content="#{content}" />\n}
- end
- if defined? @md.classify.format \
- and @md.classify.format=~/\S+/ # DublinCore 9 - format (use your mime type)
- @rdf_format=%{ dc.format="#{@md.classify.format}"\n}
- content=meta_content_clean(@md.classify.format)
- @format=%{ <meta name="dc.format" content="#{content}" />\n}
- end
- if defined? @md.classify.identifier \
- and @md.classify.identifier=~/\S+/ # DublinCore 10 - identifier (your identifier, could use urn which is free)
- @rdf_identifier=%{ dc.identifier="#{@md.classify.identifier}"\n}
- content=meta_content_clean(@md.classify.identifier)
- @identifier=%{ <meta name="dc.identifier" content="#{content}" />\n}
- end
- if defined? @md.original.source \
- and @md.original.source=~/\S+/ # DublinCore 11 - source (document source)
- @rdf_source=%{ dc.source="#{@md.original.source}"\n}
- content=meta_content_clean(@md.original.source)
- @source=%{ <meta name="dc.source" content="#{content}" />\n}
- end
- if defined? @md.title.language \
- and @md.title.language=~/\S+/ # DublinCore 12 - language (English)
- @rdf_language=%{ dc.language="#{@md.title.language}"\n}
- @language=%{ <meta name="dc.language" content="#{@md.title.language}" />\n}
- end
- if defined? @md.original.language \
- and @md.original.language=~/\S+/
- @rdf_language_original=%{ dc.language="#{@md.original.language}"\n}
- @language_original=%{ <meta name="dc.language" content="#{@md.original.language}" />\n}
- end
- if defined? @md.classify.relation \
- and @md.classify.relation=~/\S+/ # DublinCore 13 - relation
- @rdf_relation=%{ dc.relation="#{@md.classify.relation}"\n}
- content=meta_content_clean(@md.classify.relation)
- @relation=%{ <meta name="dc.relation" content="#{content}" />\n}
- end
- if defined? @md.classify.coverage \
- and @md.classify.coverage=~/\S+/ # DublinCore 14 - coverage
- @rdf_coverage=%{ dc.coverage="#{@md.classify.coverage}"\n}
- content=meta_content_clean(@md.classify.coverage)
- @coverage=%{ <meta name="dc.coverage" content="#{content}" />\n}
- end
- if defined? @md.rights.all \
- and @md.rights.all # DublinCore 15 - rights
- @rdf_rights=%{ dc.rights="#{@md.rights.all}"\n}
- content=meta_content_clean(@md.rights.all)
- @rights=%{ <meta name="dc.rights" content="#{content}" />\n}
- end
- content=meta_content_clean(@md.keywords)
- @keywords=%{ <meta name="keywords" content="#{content}" />\n} if @md.keywords
- @vz=SiSU_Env::Get_init.instance.skin
- end
- def meta_content_clean(content='')
- content
- unless content.nil?
- content.tr!('"',"'")
- content=SiSU_XML_munge::Trans.new(@md).char_enc.utf8(content)
- end
- content
- end
- def rdfseg #segHead
- rdftoc
- end
- def comment_xml(extra='')
- generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version]
- lastdone="Last Generated on: #{Time.now}"
- rubyv="Ruby version: #{@md.ruby_version}"
- sc=if @md.sc_info
- "Source file: #{@md.sc_filename} version: #{@md.sc_number} of: #{@md.sc_date}"
- else ''
- end
- if extra.empty?
-<<WOK
-<!-- Document processing information:
- * #{generator}
- * #{rubyv}
- * #{sc}
- * #{lastdone}
- * SiSU http://www.jus.uio.no/sisu
--->
-WOK
- else
-<<WOK
-<!-- Document processing information:
- * #{extra}
- * #{generator}
- * #{rubyv}
- * #{sc}
- * #{lastdone}
- * SiSU http://www.jus.uio.no/sisu
--->
-WOK
- end
- end
- def comment_xml_sax
- desc='SiSU XML, SAX type representation'
- comment_xml(desc)
- end
- def comment_xml_node
- desc='SiSU XML, Node type representation'
- comment_xml(desc)
- end
- def comment_xml_dom
- desc='SiSU XML, DOM type representation'
- comment_xml(desc)
- end
- def metatag_html #values strung together, because some empty, and resulting output (line breaks) is much better
-<<WOK
-#{@full_title}#{@subtitle}#{@author}#{@subject}#{@description}#{@publisher}#{@contributor}#{@date}#{@date_created}#{@date_issued}#{@date_available}#{@date_valid}#{@date_modified}#{@type}#{@format}#{@identifier}#{@source}#{@language}#{@relation}#{@coverage}#{@rights}#{@copyright}#{@owner}
-#{@vz.txt_generator}
-#{@vz.png_ico}
-WOK
- end
- end
-end
-module SiSU_Tables
- require "#{SiSU_lib}/xml_tables" # xml_tables.rb
-end
-__END__
diff --git a/lib/sisu/v2/sisupod_make.rb b/lib/sisu/v2/sisupod_make.rb
deleted file mode 100644
index 188e3315..00000000
--- a/lib/sisu/v2/sisupod_make.rb
+++ /dev/null
@@ -1,338 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: create sisupod filetype and copy it to output directory!
-
-=end
-module SiSU_Doc
- require 'fileutils'
- include SiSU_Env
- class Source
- include FileUtils #::Verbose
- require "#{SiSU_lib}/sysenv" # sysenv.rb
- require "#{SiSU_lib}/response" # response.rb
- def initialize(opt)
- @opt=opt
- m=/.+\/(?:src\/)?(\S+)/im # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m
- @date=SiSU_Env::Info_date.new.dt
- @env=SiSU_Env::Info_env.new(@opt.fns)
- @ver=SiSU_Env::Info_version.instance.get_version
- @ans=SiSU_Response::Response.new
- pod_path="#{@env.path.processing}/sisupod"
- @v=if @opt.cmd =~/[VM]/; 'v'
- else ''
- end
- @local_path="#{@env.path.output_pod}" #@local_path="#{@env.path.output}/#{@env.fnb}"
- @zipfile=if @opt.fns =~/\.ssm\.sst$/; @opt.fns.gsub(/(?:\~\S{2,3})?\.ssm\.sst$/,'.ssm')
- else @opt.fns.gsub(/(?:\~\S{2,3})?(\.sst)$/,'\1')
- end
- mkdir_p(pod_path) unless FileTest.directory?(pod_path)
- rm_rf("#{@env.path.processing}sisupod/*") if FileTest.directory?("#{@env.path.processing}sisupod")
- end
- def read
- unless @opt.cmd =~/q/
- @opt.cmd=~/[MVvz]/ \
- ? SiSU_Screen::Ansi.new(@opt.cmd,'Share SiSU Document (zip)',@opt.fns).green_hi_blue \
- : SiSU_Screen::Ansi.new(@opt.cmd,'Share SiSU Document (zip)',@opt.fns).green_title_hi
- end
- unless @opt.fns.empty?
- unless @opt.cmd =~/q/
- SiSU_Screen::Ansi.new(@opt.cmd,'Make sisu document (zip) and place in output directory',"#{@opt.fns} -> file://#{@env.path.output_pod}/#{@zipfile}.zip").warn if @opt.cmd =~/[MVv]/
- end
- directories
- sisupod_build
- sisupod_zip
- #sisupod_7zip
- else
- if @opt.cmd =~/[MVv]/
- SiSU_Screen::Ansi.new(@opt.cmd,'Make (zip) of sisu work directory',"#{@env.stub_pwd}\_#{@date}.zip").warn
- SiSU_Screen::Ansi.new(@opt.cmd,'').blue_tab
- end
- ans=@ans.response?('make sisupod of entire directory?')
- if ans; sisupod_zip_directory
- end
- end
- end
- def sisupod_zip_directory
- sisupod_directory="sisupod-#{@env.stub_pwd}-#{@date}.ssp" # "sisupod-#{@env.stub_pwd}-#{@date}.zip"
- unless File.symlink?('sisupod'); File.symlink(Dir.pwd,'sisupod')
- end
- re_base_dir='^sisupod/([^.][^/]*\.(ssm|ssi|sst)$|_sisu/)'
- re_files='/[a-zA-Z0-9.~_-]+\.(ssm|ssi|sst|rb|css|png|jpg|gif|yaml)$'
- re_ignore='/[.~_-][^/]+$'
- if File.symlink?('sisupod')
- info="SiSU sisupod #{@ver[:version]} directory contents #{sisupod_directory}"
- system(%{
- echo "#{info}"
- echo "#{info}" > sisu_zip.txt
- zip -qz #{sisupod_directory} sisu_zip.txt < sisu_zip.txt
- for I in `find -H sisupod -print | \
- egrep "#{re_base_dir}" | \
- egrep "#{re_files}" | \
- egrep -v "#{re_ignore}" `
- do zip #{sisupod_directory} $I
- done
- })
- else puts "the required systemlink 'sisupod' could not be created on the current directory: remove the file or directory named 'sisupod' within #{Dir.pwd}"
- end
- if @opt.cmd =~/[MVv]/
- SiSU_Screen::Ansi.new(@opt.cmd,'Share SiSU Document (tar gzip)',@opt.fns).green_hi_blue
- SiSU_Screen::Ansi.new(@opt.cmd,'Zipped directory',sisupod_directory).warn
- SiSU_Screen::Ansi.new('',sisupod_directory).blue_tab
- end
- end
- def directories
- SiSU_Env::Info_env.new.sisupod
- end
- def select(skin='') # skin loading logic here
- load "#{SiSU_lib}/defaults.rb"
- @skin={}
- skin_path = [
- "#{@env.path.pwd}/_sisu/skin",
- "#{@env.path.home}/.sisu/skin",
- '/etc/sisu/skin',
- "#{@env.path.processing}/external_document/skin"
- ]
- sk_doc,sk_dir="doc/#{skin}.rb","dir/skin_#{@env.stub_pwd}.rb"
- skin_path.each do |v| #document skin priority 1
- if FileTest.file?("#{v}/#{sk_doc}")
- @skin[:name],@skin[:type]="#{v}/#{sk_doc}",'doc'
- break
- end
- end
- unless @skin.length > 0
- skin_path.each do |v| #directory skin priority 2
- if FileTest.file?("#{v}/#{sk_dir}")
- @skin[:name],@skin[:type]="#{v}/#{sk_dir}",'dir'
- break
- end
- end
- end
- @skin
- end
- def sisupod_build #see also sisupod in sysenv
- @rgx_rb_image=/["'](\S+?\.(?:png|jpg|gif))["']/
- @rgx_image=/(?:^|[^_\\])\{\s*(\S+?\.(?:png|jpg|gif))/
- @rgx_skin=/^\s+:skin:\s+(\S+)/
- @rgx_doc_import=/^%\s\s*\|(\S+?\.ss[ti])\|@\|\^\|>>ok/
- use_file=@opt.fns =~/(?:\.ssm|\.ssm\.sst)$/ \
- ? "#{@env.path.composite_file}/#{@opt.fnb}.ssm.sst" \
- : @opt.fns
- file_array=IO.readlines(use_file,'')
- skin,images,doc_import=[],[],[]
- file_array.each do |f| #% work area
- if f !~/^%+\s/
- skin << f.scan(@rgx_skin).uniq.flatten if f =~@rgx_skin
- if f !~/^%+\s/ \
- and f =~@rgx_image
- images << f.scan(@rgx_image).uniq
- end
- elsif f =~/^%\s/ \
- and @opt.fns =~/\.ssm\.sst$/
- doc_import << f.scan(@rgx_doc_import).uniq if f =~@rgx_doc_import
- end
- end
- docskin=nil
- if skin \
- and skin.length > 0
- docskin=skin.pop.flatten.join
- skin_source=select(docskin)
- else
- skin_source=select
- end
- docskin_place="#{@env.path.processing}/sisupod/_sisu/skin/#{skin_source[:type]}"
- if skin_source[:type] =~/dir/
- docskin_with_path="#{docskin_place}/skin_#{@env.stub_pwd}.rb"
- docskin=[docskin_with_path.gsub(/.+?\/(skin_\S+?)\.rb/,'\1')]
- docskin='skin_sisupod'
- end
- if skin_source \
- and docskin #imperfect, revisit
- unless skin_source[:name].nil? \
- or skin_source[:name].empty?
- cp_r(skin_source[:name],"#{docskin_place}/#{docskin}.rb")
- skinfile_array=IO.readlines(skin_source[:name],'')
- para_images=[]
- skinfile_array.each do |f| #% work area
- unless f =~/^%+ / #hmmm
- images << f.scan(@rgx_rb_image).uniq if f =~@rgx_rb_image #and FileTest.file?(f.scan(@rgx_rb_image).uniq)
- #does not really discriminate, may duplicate images in sisu file, and may take images from default image pool
- end
- end
- end
- end
- #1. mapping in doc dir?
- #2. need images used by skin, scan skin??
- if images \
- and images.length > 1
- images.flatten!
- images.uniq!
- images.delete_if {|x| x =~/https?:\/\// }
- #images.sort!
- image_path_pwd='_sisu/image'
- path_pod_conf="#{@env.path.processing}/sisupod/_sisu"
- images_path_pod="#{path_pod_conf}/image"
- #unattractive hard coding ... !
- images_pwd="#{@env.path.pwd}/#{image_path_pwd}"
- ##sequence copies base images, defaults used in all html outputs
- #image_source_base='/usr/share/sisu/image'
- #dir_pwd=Dir.pwd
- #Dir.chdir(image_source_base)
- #base_images=Dir.glob('*')
- #base_images.each do |i|
- # cp_r(i,"#{images_path_pod}/#{i}")
- #end
- #Dir.chdir(dir_pwd)
- if FileTest.directory?(image_path_pwd)
- images=images.uniq
- images.each do |i|
- cp_r("#{images_pwd}/#{i}","#{images_path_pod}/#{i}") if FileTest.file?("#{images_pwd}/#{i}")
- end
- #chmod(0755, dir_images_www)
- else puts "\tWARN, did not find - #{image_path_pod}"
- end
- end
- x=@env.document_language_versions_found #check multiple document language versions (param not used)
- if doc_import.flatten.length > 0 \
- and @opt.fns =~/\.ssm\.sst$/
- doc_import.flatten.each do |f|
- cp_r("#{@env.path.pwd}/#{f}","#{@env.path.processing}/sisupod/#{f}")
- end
- end
- if x[:f] \
- and x[:f].length > 1 #store multiple document language versions, sisupod
- x[:f].each do |f|
- cp_r("#{@env.path.pwd}/#{f}","#{@env.path.processing}/sisupod/#{f}")
- end
- elsif @opt.fns =~/\.ssm\.sst/
- ssm=@opt.fns.gsub(/\.ssm\.sst/,'.ssm')
- cp_r("#{@env.path.pwd}/#{ssm}","#{@env.path.processing}/sisupod/#{ssm}")
- else cp_r("#{@env.path.pwd}/#{@opt.fns}","#{@env.path.processing}/sisupod/#{@opt.fns}")
- end #NB not all possibilies met, revisit, also in case of composite file may wish to add README
- end
- def sisupod_7zip #look at later
- mkdir_p(@local_path) unless FileTest.directory?(@local_path)
- system(%{
- cd #{@env.path.processing}
- echo "SiSU sisupod #{@ver[:version]}" > sisu_zip.txt
- #7zip -qz #{@opt.fns}.7z sisu_zip.txt < sisu_zip.txt
- 7zr a -t7z -m0=lzma -mx=9 -ms=on #{@zipfile}.7z sisu_zip.txt
- 7zr a -t7z -m0=lzma -mx=9 -ms=on #{@zipfile}.7z sisupod
- #7zip -qr #{@zipfile}.7z sisupod
- mv #{@zipfile}.7z #{@local_path}/. &
- rm -r sisupod/* && cd #{@env.path.pwd}
- })
- SiSU_Screen::Ansi.new('',"#{@opt.fns}.7z").blue_tab unless @opt.cmd =~/q/
- end
- def sisupod_zip
- mkdir_p(@local_path) unless FileTest.directory?(@local_path)
- system(%{
- cd #{@env.path.processing}
- echo "SiSU sisupod #{@ver[:version]}" > sisu_zip.txt
- zip -qz #{@zipfile}.zip sisu_zip.txt < sisu_zip.txt
- zip -qr #{@zipfile}.zip sisupod
- mv #{@zipfile}.zip #{@local_path}/. &
- rm -r sisupod/* && cd #{@env.path.pwd}
- })
- SiSU_Screen::Ansi.new('',"#{@zipfile}.zip").blue_tab if @opt.cmd =~/[MVv]/
- end
- end
-end
-__END__
-question?: should you permit the packing of multiple files in single .gz ?
-
- open @opt.fns, parse file
- extract from file content:
- images and copy each image from whatever image source to _sisu/sisupod/sisu/_sisu/image
- skin and copy active skin from whatever source to _sisu/sisupod/sisu/_sisu/skin/doc
- extract from skin images required by skin
-
- remove previously existing contents of _/sisu/sisupod &
- make directory structure:
-
- _sisu
- sisupod
- sisu
- content.sst [file content]
- filename.sst [link to content.sst]
- _sisu
- conf
- skin/
- doc [relevant skin if any other than default]
- image [all images for specific document gathered here]
-
-sisu
- _sisu
- sisurc.yml
- skin/
- dir/
- doc/
- misc/
- site/
- yaml/
- convert/
- standard_terms/
- image
- processing
- dal/
- tex/
- texinfo/
- tune/
- sisupod
-
-special case
-
-composite file (master), e.g.
-SiSU.ssm
diff --git a/lib/sisu/v2/sysenv.rb b/lib/sisu/v2/sysenv.rb
deleted file mode 100644
index 38ea24a2..00000000
--- a/lib/sisu/v2/sysenv.rb
+++ /dev/null
@@ -1,3366 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: system environment, resource control and configuration details
-
-=end
-@@cX=nil
-@@current_document=Dir.pwd #nil #''
-module SiSU_Env
- require "#{SiSU_lib}/constants" # constants.rb
- require 'fileutils'
- include FileUtils::Verbose
- require 'singleton'
- @@noyaml=false
- class Info_date
- require 'date'
- attr_accessor :dt,:t
- def initialize
- @dt,@t=Date.today.to_s,Time.now
- end
- def week
- w=@t.strftime('%W')
- "#{@t.year}w#{w}"
- end
- def month
- "#{@t.year}#{@t.month}"
- end
- def year
- @t.year
- end
- def weekonly
- @t.strftime('%W')
- end
- def monthonly
- @t.month
- end
- def year_static
- '2010'
- end
- end
- class Info_system
- require 'rbconfig'
- include Singleton
- @@user,@@home,@@hostname,@@pwd,@@sisu_etc,@@host,@@arch,@@rbver,@@dir_arch,@@dir_sitearch,@@dir_bin,@@locale,@@rc,@@ad=ENV['USER'],ENV['HOME'],ENV['HOSTNAME'],ENV['PWD'],Config::CONFIG['sysconfdir'] + '/sisu',Config::CONFIG['host'],Config::CONFIG['arch'],%x{ruby -v}.strip,Config::CONFIG['archdir'],Config::CONFIG['sitearchdir'],Config::CONFIG['bindir'],%x{locale charmap}.strip,nil,{} # %x{ruby -v}.strip # Config::CONFIG['rb_ver']
- out=Config::CONFIG['localstatedir']
- etc=Config::CONFIG['sysconfdir'] + '/sisu'
- share=Config::CONFIG['datadir'] + '/sisu'
- data=Config::CONFIG['datadir'] + '/doc/sisu'
- m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m
- @stub_pwd ||=@@pwd[m,1]
- prcss_dir='_sisu_processing_'
- prcss_dir_tmp_root="/tmp/#{prcss_dir}"
- prcss_dir_stub="#{prcss_dir}/#{@stub_pwd}"
- if @@user
- tmp_processing="#{prcss_dir_tmp_root}/#{@@user}/#{@stub_pwd}"
- tmp_processing_individual="#{prcss_dir_tmp_root}/#{@@user}/#{@stub_pwd}"
- else #error
- tmp_processing=tmp_processing_individual="/tmp/#{prcss_dir_stub}"
- end
- tmp_processing_home=if @@home \
- and File.writable?("#{@@home}/.")
- "#{@@home}/#{prcss_dir_stub}"
- else prcss_dir_stub
- end
- processing_path=tmp_processing_individual
- processing_dir=prcss_dir
- processing_git="#{Dir.pwd}/#{Gt[:grotto]}"
- user=ENV['USER']
- port_pgsql=if defined? ENV['PGPORT'] \
- and not (ENV['PGPORT'].nil? \
- or ENV['PGPORT'].empty?) \
- and ENV['PGPORT']=~/^\d+$/
- ENV['PGPORT']
- else '5432'
- end
- IMAGES=:images
- SISU_ETC=:sisu_etc
- SISU_SHARE=:sisu_share
- SAMPLE_DATA_PATH=:sample_data_path
- IMAGE_STUB=:image_stub
- STYLESHEET_STUB=:stylesheet_stub
- IMAGE_LOCAL=:image_local
- WEBSERV_PATH=:webserv_path
- WEBSERV_MAN=:webserv_man
- WEBSERV_PHP=:webserv_php
- WEBSERV_CGI=:webserv_cgi
- WEBSERV_RSS=:webserv_rss
- WEBSERV_SQLITE=:webserv_sqlite
- OUTPUT_LOCAL=:output_local
- PROCESSING_DIR=:processing_dir
- PROCESSING_PATH=:processing_path
- PROCESSING_DIR_TMP_ROOT=:processing_dir_tmp_root
- PROCESSING_PATH_TMP_BASE=:processing_path_tmp_base
- PROCESSING_DAL=:processing_dal
- PROCESSING_TUNE=:processing_tune
- PROCESSING_LATEX=:processing_latex
- PROCESSING_TEXINFO=:processing_texinfo
- PROCESSING_LOUT=:processing_lout
- PROCESSING_SQLITE=:processing_sqlite
- PROCESSING_POSTGRESQL=:processing_postgresql
- PROCESSING_ENCODING=:processing_encoding
- PROCESSING_GIT=:processing_git
- PAPERSIZE=:papersize
- LANGUAGE=:language
- LANGUAGE_CODE=:language_code
- MULTILINGUAL=:multilingual
- CONCORD_MAX=:concord_max
- DIGEST=:digest
- WEBSERV_HOST_CGI=:webserv_host_cgi
- WEBSERV_PORT_CGI=:webserv_port_cgi
- POSTGRESQL_USER=:postgresql_user
- POSTGRESQL_PORT=:postgresql_port
- SQLITE_USER=:sqlite_user
- SQLITE_PATH=:sqlite_path
- SQLITE_PORT=:sqlite_port
- DEFAULT_DIR={
- IMAGES => '_sisu/image',
- SISU_ETC => etc,
- SISU_SHARE => share,
- SAMPLE_DATA_PATH => data,
- IMAGE_STUB => '_sisu/image',
- STYLESHEET_STUB => '_sisu/css',
- IMAGE_LOCAL => @@pwd + '/_sisu/image',
- WEBSERV_PATH => out + '/www',
- #WEBSERV_DIR => www, # uncomment for urls...
- #WEBSERV_IMAGE => out + '/www/_sisu/image',
- WEBSERV_MAN => out + '/www/man', #alter
- WEBSERV_PHP => out + '/www/php',
- WEBSERV_CGI => '/usr/lib/cgi-bin',
- WEBSERV_RSS => out + '/www/feed',
- WEBSERV_SQLITE => out + '/www/sqlite',
- OUTPUT_LOCAL => @@home + '/sisu_www',
- PROCESSING_DIR => processing_dir,
- PROCESSING_PATH => processing_path,
- PROCESSING_DIR_TMP_ROOT => prcss_dir_tmp_root,
- PROCESSING_PATH_TMP_BASE => processing_path,
- PROCESSING_DAL => 'dal',
- PROCESSING_TUNE => 'tune',
- PROCESSING_LATEX => 'tex',
- PROCESSING_TEXINFO => 'texinfo',
- PROCESSING_LOUT => 'lout',
- PROCESSING_SQLITE => 'sqlite',
- PROCESSING_POSTGRESQL=> 'postgresql',
- PROCESSING_ENCODING => 'encoding',
- PROCESSING_GIT => processing_git,
- #TEXINFO_STUB => 'texinfo',
- PAPERSIZE => 'A4', #A4, US_letter, book_b5, book_a5, US_legal
- LANGUAGE => 'English',
- LANGUAGE_CODE => 'en', #change, unecessary duplication though currently used
- MULTILINGUAL => true,
- CONCORD_MAX => 260000,
- DIGEST => 'sha256',
- WEBSERV_HOST_CGI => ' http://localhost',
- WEBSERV_PORT_CGI => 8081, #8111,8123,8081
- POSTGRESQL_USER => @@user, #'ralph', # change user !!!
- POSTGRESQL_PORT => port_pgsql,
- #POSGRESQL_LINKS_PATH => '',
- SQLITE_USER => @@user,
- SQLITE_PATH => @@user, #??
- SQLITE_PORT => '**',
- }
- @@default_dir=DEFAULT_DIR
- m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m
- stub_pwd=@@pwd[m,1]
- @@rc_path=["#{@@pwd}/_sisu/#{SiSU_version_dir}","#{@@pwd}/_sisu","#{@@home}/.sisu/#{SiSU_version_dir}","#{@@home}/.sisu","#{@@sisu_etc}/#{SiSU_version_dir}"]
- @@yamlrc_path=(stub_pwd !~/^sisupod$/) \
- ? (["#{@@pwd}/_sisu/#{SiSU_version_dir}","#{@@pwd}/_sisu","#{@@home}/.sisu/#{SiSU_version_dir}","#{@@home}/.sisu","#{@@sisu_etc}/#{SiSU_version_dir}"]) \
- : ["#{@@home}/.sisu/#{SiSU_version_dir}","#{@@home}/.sisu","#{@@sisu_etc}/#{SiSU_version_dir}"] #security policy: prevent reading of sisurc.yml in sisupod
- @@ad_path=(stub_pwd !~/^sisupod$/) \
- ? (["#{@@pwd}/_sisu/skin/yml","#{@@home}/.sisu/skin/yml","#{@@sisu_etc}/skin/yml"]) \
- : ["#{@@home}/.sisu",@@sisu_etc]
- attr_accessor :user,:home,:hostname,:pwd,:host,:arch,:rbver,:dir_arch,:dir_sitearch,:dir_bin,:locale,:webserv_path,:webserv_host_cgi,:webserv_port_cgi,:default_dir,:rc_path,:yamlrc_path,:ad_path
- def initialize
- @user,@home,@hostname,@pwd,@sisu_etc,@host,@arch,@rbver,@dir_arch,@dir_sitearch,@dir_bin,@locale,@default_dir,@rc_path,@yamlrc_path,@ad_path=@@user,@@home,@@hostname,@@pwd,@@sisu_etc,@@host,@@arch,@@rbver,@@dir_arch,@@dir_sitearch,@@dir_bin,@@locale,@@default_dir,@@rc_path,@@yamlrc_path,@@ad_path
- #note rbver is duplicated in Info_version
- end
- end
- class Load
- def initialize(prog,mandatory=false)
- @prog,@mandatory=prog,mandatory
- end
- def prog
- load_prog=false
- pp=''
- $:.each do |reqpath|
- if FileTest.exist?("#{reqpath}/#{@prog}.rb")
- load_prog=true
- break
- end
- end
- if load_prog \
- and @prog=~/dbi/
- require 'dbi' #revisit
- end
- if load_prog
- require @prog
- else
- @mandatory \
- ? (SiSU_Screen::Ansi.new(@cmd,"module required: #{@prog}").warn) \
- : (SiSU_Screen::Ansi.new(@cmd,"#{@prog} load requested").warn)
- end
- load_prog
- end
- def prog?
- load_prog=false
- $:.each do |reqpath|
- if FileTest.exist?("#{reqpath}/#{@prog}.rb"); load_prog=true
- break
- end
- end
- load_prog
- end
- end
- class Get_init < Info_system
- include Singleton
- @@noyaml=false
- @@rc,@@vz,@@tx=nil,nil,nil
- @@ad={ :promo=>nil,:promo_list=>nil,:flag_promo=>false }
- attr_accessor :yaml
- def initialize
- super()
- end
- def skin
- @@vz ||=SiSU_Viz::Skin.new
- end
- def tex
- @@tx ||=SiSU_Viz::TeX.new
- end
- def yamlrc
- unless @@rc
- @yamlrc_path.each do |v|
- if @@noyaml \
- or FileTest.exist?("#{v}/noyaml")
- puts "WARNING - YAML loading switched off, to enable delete the file:\n\t#{v}/noyaml\n\n" unless @@noyaml
- @@noyaml=true
- break
- else
- if FileTest.exist?("#{v}/sisurc.yml")
- unless @@rc
- require 'yaml'
- @@rc ||= YAML::load(File::open("#{v}/sisurc.yml"))
- end
- break
- end
- unless @@rc
- if FileTest.exist?("#{v}/sisurc.yaml")
- unless @@rc
- require 'yaml'
- @@rc ||= YAML::load(File::open("#{v}/sisurc.yaml"))
- end
- break
- end
- end
- end
- end
- end
- @@rc
- end
- def ads #WORK AREA
- tell_no_yaml='WARNING - YAML loading switched off, to enable delete the file:'
- @ad_path.each do |v|
- if @@noyaml \
- or FileTest.exist?("#{v}/noyaml")
- puts tell_no_yaml + "\n\t#{v}/noyaml\n" unless @@noyaml
- @@noyaml=true
- break
- else
- if FileTest.exist?("#{v}/list.yml")
- unless @@ad[:promo_list]
- require 'yaml'
- @@ad[:promo_list] ||= YAML::load(File::open("#{v}/list.yml"))
- end
- @@ad[:flag_promo]=true
- break
- end
- @@ad[:flag_promo]=false
- end
- end
- @ad_path.each do |v|
- if @@noyaml \
- or FileTest.exist?("#{v}/noyaml")
- puts tell_no_yaml + "\n\t#{v}/noyaml\n" unless @@noyaml
- @@noyaml=true
- break
- else
- if FileTest.exist?("#{v}/promo.yml")
- unless @@ad[:promo]
- require 'yaml'
- @@ad[:promo] ||= YAML::load(File::open("#{v}/promo.yml"))
- end
- @@ad[:flag_promo]=true
- break
- end
- @@ad[:flag_promo]=false
- end
- end
- @@ad
- end
- end
- class Env_call
- @@rc,@@fns,@@fnn,@@fnb,@@fnt,@@flv,@@fnz=nil,nil,nil,nil,nil,nil,nil
- @@ad={}
- attr_accessor :rc,:fnn,:fnb,:fnt,:fnv,:fnz,:ad
- def initialize(fns='')
- super()
- @fns=fns
- @sys=Info_system.instance
- @rc=Get_init.instance.yamlrc
- @ad=Get_init.instance.ads
- if @fns \
- and @fns != '' \
- and @fns !=@@fns
- @@fns,@@fnn,@@fnb,@@fnt,@@flv,@@fnz=@fns,nil,nil,nil,nil,nil
- end
- if @fns \
- and @fns != '' #watch
- if multilingual
- m=/((.+?)(?:\~\w{2,3})?)\.((?:-|ssm\.)?sst|ssm)$/
- @@fnn ||=@fns[m,1]
- @@fnb ||=@fns[m,2]
- @@fnt ||=@fns[m,3]
- @@flv ||=document_language_versions_found[:f]
- unless @@fns =~/\S+?\.zip/
- @@fnz ||=if @@fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/; @@fnb + '.ssm.zip'
- elsif @@fnb; @@fnb + '.sst.zip'
- else '' # e.g. termsheet
- end
- end
- else m=/(.+?)\.((?:-|ssm\.)?sst|ssm)$/
- @@fnb ||=@fns[m,1]
- @@fnt ||=@fns[m,2]
- unless @@fns =~/\S+?\.zip/
- @@fnz ||=if @@fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/; @@fnb + '.ssm.zip'
- else @@fnb + '.sst.zip'
- end
- end
- end
- end
- @fnn,@fnb,@fnt,@flv,@fnz=@@fnn,@@fnb,@@fnt,@@flv,@@fnz
- end
- def multilingual
- if defined? @rc['default']['multilingual'] \
- and @rc['default']['multilingual'] != nil
- @rc['default']['multilingual']
- else true
- end
- end
- def document_language_versions_found
- @fn={}
- unless (@fns.nil? \
- or @fns.empty?)
- if multilingual
- m=/((.+?)(?:\~\w{2,3})?)\.((?:-|ssm\.)?sst$)/
- @fn[:b],@fn[:m],@fn[:t]=@fns[m,1],@fns[m,2],@fns[m,3]
- else m=/(.+?)\.((?:-|ssm\.)?sst$)/
- @fn[:b]=@fn[:m]=@fns[m,1]
- @fn[:t]=@fns[m,2]
- end
- end
- lang=SiSU_Env::Standardise_language.new
- langs=lang.codes
- x=[]
- if FileTest.file?("#{@fn[:m]}.#{@fn[:t]}"); x << "#{@fn[:m]}.#{@fn[:t]}"
- end
- x << @fns
- langs.each do |l|
- lng=SiSU_Env::Standardise_language.new(l)
- if FileTest.file?("#{@fn[:m]}~#{lng.code}.#{@fn[:t]}")
- x << "#{@fn[:m]}~#{lng.code}.#{@fn[:t]}"
- elsif FileTest.file?("#{@fn[:m]}~#{lng.name}.#{@fn[:t]}")
- x << "#{@fn[:m]}~#{lng.name}.#{@fn[:t]}"
- end
- end
- @fn[:f]=x.uniq!
- @fn
- end
- def published_manifests?(output_base)
- ob=output_base
- @fn={}
- @m=[]
- unless (@fns.nil? \
- or @fns.empty?)
- if multilingual
- m=/((.+?)(?:\~\w{2,3})?)\.((?:-|ssm\.)?sst$)/
- @fn[:b],@fn[:m],@fn[:t]=@fns[m,1],@fns[m,2],@fns[m,3]
- else m=/(.+?)\.((?:-|ssm\.)?sst$)/
- @fn[:b]=@fn[:m]=@fns[m,1]
- @fn[:t]=@fns[m,2]
- end
- end
- lang=SiSU_Env::Standardise_language.new
- langs=lang.codes
- x=[]
- if FileTest.file?("#{@fn[:m]}.#{@fn[:t]}"); x << "#{@fn[:m]}.#{@fn[:t]}"
- end
- dir=SiSU_Env::Info_env.new(@fns)
- @m << {:m => 'sisu_manifest.html', :l => 'English' } #fix later, default language
- langs.each do |l|
- lng=SiSU_Env::Standardise_language.new(l)
- fns_c="#{@fn[:m]}~#{lng.code}.#{@fn[:t]}"
- fns_l="#{@fn[:m]}~#{lng.name}.#{@fn[:t]}"
- if FileTest.file?(fns_c)
- fn_set_lang=SiSU_Env::Standardise_language.new.file_to_language(fns_c)
- lng=fn_set_lang[:l]
- fn=SiSU_Env::Env_call.new(fns_c).lang(fn_set_lang[:c])
- @m << {:m => fn[:manifest], :l => lng }
- elsif FileTest.file?(fns_l)
- fn_set_lang=SiSU_Env::Standardise_language.new.file_to_language(fns_l)
- @fnl=dir.i18n.lang_filename(fn_set_lang[:c])
- fn=SiSU_Env::Env_call.new(fns_l).lang(fn_set_lang[:c])
- @m << {:m => fn[:manifest], :l => lng }
- end
- end
- @m.uniq!
- @m
- end
- def filename(code,name,suffix)
- d=SiSU_Env::Info_env.new(@fns)
- fnl=d.i18n.lang_filename(code)
- if code
- "#{fnl[:pre]}#{name}#{fnl[:mid]}#{suffix}#{fnl[:post]}"
- else "#{name}#{suffix}"
- end
- end
- def lang(code)
- @fn={
- :html => filename(code,'','.html'),
- :book_index => filename(code,'book_index','.html'),
- :concordance => filename(code,'concordance','.html'),
- :sax => filename(code,'sax','.xml'),
- :dom => filename(code,'dom','.xml'),
- :docbook => filename(code,'docbook','.xml'),
- :xhtml => filename(code,'scroll','.xhtml'),
- :pdf_l => filename(code,'landscape','.pdf'),
- :pdf_p => filename(code,'portrait','.pdf'),
- :pdf_l_a4 => filename(code,'landscape.a4','.pdf'),
- :pdf_p_a4 => filename(code,'portrait.a4','.pdf'),
- :pdf_l_a5 => filename(code,'landscape.a5','.pdf'),
- :pdf_p_a5 => filename(code,'portrait.a5','.pdf'),
- :pdf_l_b5 => filename(code,'landscape.b5','.pdf'),
- :pdf_p_b5 => filename(code,'portrait.b5','.pdf'),
- :pdf_l_letter => filename(code,'landscape.letter','.pdf'),
- :pdf_p_letter => filename(code,'portrait.letter','.pdf'),
- :pdf_l_legal => filename(code,'landscape.legal','.pdf'),
- :pdf_p_legal => filename(code,'portrait.legal','.pdf'),
- :toc => filename(code,'toc','.html'),
- :doc => filename(code,'doc','.html'),
- :index => filename(code,'index','.html'),
- :odf => filename(code,'opendocument','.odt'),
- :epub => filename(code,@fnb,'.epub'),
- :plain => filename(code,'plain','.txt'),
- :manpage => filename(code,@fnb,'.1'), #fix, section number
- :wiki => filename(code,'wiki','.txt'),
- :digest => filename(code,'digest','.txt'),
- :metadata => filename(code,'metadata','.html'), #chk
- :manifest => filename(code,'sisu_manifest','.html'),
- :oai_pmh => filename(code,'oai_pmh','.xml'),
- :sitemap => filename(code,'sitemap','.xml'),
- :sitemap_touch => filename(code,"sitemap_#{@fnb}",'.xml'),
- :sxs => filename(code,@fnb,'.sxs.xml'),
- :sxd => filename(code,@fnb,'.sxd.xml'),
- :sxn => filename(code,@fnb,'.sxn.xml'),
- :sisupod => filename(nil,@fnz,''),
- :book_idx_html => filename(code,'book_index','.html'),
- :book_idx_epub => filename(code,'book_index','.xhtml'),
- :epub_concord => filename(code,'concordance','.xhtml'),
- }
- @fn
- end
- end
- class System_call
- @@locale_flag=false
- def initialize(input='',output='',cmd='')
- @input,@output,@cmd=input,output,cmd
- @prog=SiSU_Env::Info_program.new
- @sys=Info_system.instance
- end
- def program_found?(program)
- found=`whereis #{program}`
- (found =~/bin\/#{program}\b/) ? true : false
- end
- def locale #locales utf8 or other
- unless @@locale_flag
- @@locale_flag=true
- end
- @sys.locale
- end
- def file_encoding(filename,cmd='') #file encoding
- program='file'
- fnsp=Info_env.new(filename).source_file_with_path
- if program_found?(program)
- encoding=%x{file -L #{fnsp}}.strip
- encoding.gsub!(/#{fnsp}:(\s+|$)/,'')
- encoding=if encoding \
- and not encoding.empty?
- encoding
- else 'UTF-8 assumed, encoding undetermined'
- end
- puts encoding if cmd =~/[VM]/
- encoding
- else encoding='UTF-8 assumed, file encoding check program unavailable'
- end
- end
- def wc #word count
- program='wc'
- if program_found?(program) \
- and locale !~/utf-?8/i
- true
- else
- program_ref="(not available)" unless program_found?(program)
- program_ref="(UTF-8)" if locale =~/utf-?8/i
- false
- end
- end
- def rcs #rcs for document markup data
- program='rcs'
- program_ref="\n\t\tdocument version information requested"
- if program_found?(program); true
- else puts "\tWARN: #{program} is not installed #{program_ref}" #if @cmd =~/v/
- false
- end
- end
- def cvs #cvs for document markup data
- program='cvs'
- program_ref="\n\t\tdocument version information requested"
- if program_found?(program); true
- else puts "\tWARN: #{program} is not installed #{program_ref}" #if @cmd =~/v/
- false
- end
- end
- def openssl #openssl for digests
- program='openssl'
- program_ref="\n\t\tused to generate requested source document identification digest"
- if program_found?(program); true
- else puts "\tWARN: #{program} is not installed #{program_ref}" #if @cmd =~/v/
- false
- end
- end
- def md5(filename) #md5 dgst
- program='openssl'
- program_ref="\n\t\tmd5 digest requested"
- if program_found?(program)
- pwd=Dir.pwd
- Dir.chdir(File.dirname(filename))
- dgst=%x{openssl dgst -md5 #{File.basename(filename)}}.strip #use file name without file path
- Dir.chdir(pwd)
- dgst.scan(/\S+/)
- else puts "\tWARN: #{program} is not installed #{program_ref}" #if @cmd =~/v/
- false
- end
- end
- def sha256(filename) #sha dgst
- program='openssl'
- program_ref="\n\t\tsha digest requested"
- if program_found?(program)
- pwd=Dir.pwd
- Dir.chdir(File.dirname(filename))
- dgst=%x{openssl dgst -sha256 #{File.basename(filename)}}.strip #use file name without file path
- Dir.chdir(pwd)
- dgst.scan(/\S+/)
- else puts "\tWARN: #{program} is not installed #{program_ref}" #if @cmd =~/v/
- false
- end
- end
- def psql #psql
- program='psql'
- program_ref="\n\t\tpsql requested"
- if program_found?(program); true
- else puts "\tWARN: #{program} is not installed #{program_ref}" #if @cmd =~/v/
- false
- end
- end
- def create_pg_db(dbname_stub=nil) #createdb
- unless dbname_stub
- @pwd ||=Dir.pwd
- m=/.+\/(?:src\/)?(\S+)/im # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m
- dbname_stub=@pwd[m,1]
- end
- program='createdb'
- db_name="#{Db[:name_prefix]}#{dbname_stub}"
- program_ref="\n\t\tcreatedb dbname #{db_name} #for postgresql database creation"
- if program_found?(program); system("createdb #{dbname_name}")
- else puts "\tWARN: #{program} is not available #{program_ref}" #if @cmd =~/v/
- end
- end
- def relaxng(cmd='') #trang - convert between different schema languages for XML
- program='trang'
- program_ref="\n\t\tsee http://www.thaiopensource.com/relaxng/trang.html"
- if program_found?(program); system("trang #{@input} #{@output}")
- else puts "\tWARN: #{program} is not installed #{program_ref}" if cmd =~/V/
- end
- end
- def imagemagick #imagemagick is a image manipulation program
- program='identify'
- program_ref="\n\t\tsee http://www.imagemagick.org/"
- found=(program_found?(program)) ? true : false
- puts "\tWARN: #{program} is not installed #{program_ref}" unless found
- found
- end
- def graphicksmagick #graphicsmagick is a image manipulation program
- program='gm'
- program_ref="\n\t\tsee http://www.graphicsmagick.org/"
- found=(program_found?(program)) ? true : false
- puts "\tWARN: #{program} is not installed #{program_ref}" unless found
- found
- end
- def well_formed? #tidy - check for well formed xml xhtml etc.
- program=@prog.tidy
- program_ref="\n\t\tsee http://tidy.sourceforge.net/"
- if program_found?(program); system("#{@prog.tidy} -xml #{@input} > #{@output}")
- else puts "\tWARN: #{program} is not installed #{program_ref}"
- end
- end
- def tex2pdf_engine
- prog=['xetex','xelatex','pdflatex','pdfetex','pdftex']
- @pdfetex_flag=false
- @cmd ||=''
- @texpdf=nil
- prog.each do |program|
- if program_found?(program)
- @texpdf=program if program =~/xetex|xelatex|pdftex|pdflatex/
- @pdfetex_flag=true
- break
- end
- end
- if @pdfetex_flag==false
- @texpdf=prog.join(', ')
- end
- @texpdf
- end
- def latex2pdf(md,papersize='a4') #convert from latex to pdf
- tell=((@cmd =~/[MVv]/) ? '' : '> /dev/null' )
- mode='batchmode'
- #mode='nonstopmode'
- program_ref="\n\t\tSee http://www.tug.org/applications/pdftex/\n\t\tOn Debian this is is included in tetex-extra"
- texpdf=tex2pdf_engine
- if @pdfetex_flag;
- texpdf_cmd=case texpdf
- when /xetex/
- @input =~/landscape\.tex$/ \
- ? %{#{texpdf} -interaction=#{mode} -fmt=xelatex -papersize="#{papersize} -l" #{@input} #{tell}\n} \
- : %{#{texpdf} -interaction=#{mode} -fmt=xelatex -papersize="#{papersize}" #{@input} #{tell}\n}
- when /xelatex/
- @input =~/landscape\.tex$/ \
- ? %{#{texpdf} -interaction=#{mode} -papersize="#{papersize} -l" #{@input} #{tell}\n} \
- : %{#{texpdf} -interaction=#{mode} -papersize="#{papersize}" #{@input} #{tell}\n}
- when /pdftex/; "#{texpdf} -interaction=#{mode} -fmt=pdflatex #{@input} #{tell}\n"
- when /pdflatex/; "#{texpdf} -interaction=#{mode} #{@input} #{tell}\n"
- end
- system(texpdf_cmd)
- else puts "\tWARN: none of the following programs are installed: #{program[0]}, #{program[1]}, #{program[2]} is installed. #{program_ref}"
- end
- end
- def makeinfo #texinfo
- program='makeinfo'
- program_ref="\n\t\tsee http://www.gnu.org/software/texinfo/"
- (program_found?(program)) \
- ? system("#{program} #{@input}\n") \
- : (puts "\tWARN: #{program} is not installed #{program_ref}")
- end
- def scp
- program='scp'
- puts "scp -Cr #{@input} #{@output}" if @cmd =~/[vVM]/
- (program_found?(program)) \
- ? system("scp -Cr #{@input} #{@output}") \
- : (puts "\tWARN: #{program} not found" )
- end
- def rsync(action='')
- program='rsync'
- if program_found?(program)
- vb=if @cmd =~/q/; 'q'
- elsif @cmd =~/v/; 'v'
- else ''
- end
- msg=''
- msg=" && echo 'OK: #{@input} -> #{@output}'" unless @cmd =~/q/
- puts "rsync -az#{vb} #{action} #{@input} #{@output}" if @cmd =~/[vVM]/
- system("rsync -az#{vb} #{action} #{@input} #{@output} #{msg}")
- else puts "\tWARN: #{program} not found"
- end
- end
- def rm
- if @cmd =~/^-Z[mMvVq]*$/; rm_rf(@input)
- elsif @cmd =~/V/; rm(@input)
- elsif @cmd !~/q/; rm(@input)
- elsif @cmd =~/q/; rm(@input)
- else puts "\tWARN: operation ignored"
- end
- end
- end
- class Standardise_language
- def initialize(l='')
- @language=l
- if @language.empty?
- @language=Info_env.new.defaults[:language]
- end
- end
- def language #use ISO_639-2
- lang={}
- case @language
- when /American|^us$/i; d,c,l=false,'en','American English' #depreciated, see iso 639-2
- when /English|^en$/i; d,c,l=false,'en','English'
- when /French|Francais|^fr$/i; d,c,l=false,'fr','French'
- when /German|^de$/i; d,c,l=false,'de','German'
- when /Italian|^it$/i; d,c,l=false,'it','Italian'
- when /Spanish|Espanol|^es$/i; d,c,l=false,'es','Spanish'
- when /Brazilian(?: Portuguese)?|^br$/i; d,c,l=false,'pt','Brazilian Portuguese' #depreciated, see iso 639-2
- when /Portuguese|^pt$/i; d,c,l=false,'pt','Portuguese'
- when /Swedish|Svensk|^sv$/i; d,c,l=false,'sv','Swedish'
- when /Danish|Dansk|^da$/i; d,c,l=false,'da','Danish'
- when /Finnish|Finsk|Suomi|^fi$/i; d,c,l=false,'fi','Finnish'
- when /Norwegian|Norsk|^no$/i; d,c,l=false,'no','Norwegian'
- when /Icelandic|^is$/i; d,c,l=false,'is','Icelandic'
- when /Dutch|^nl$/i; d,c,l=false,'nl','Dutch'
- when /Estonian|^et$/i; d,c,l=false,'et','Estonian'
- when /Hungarian|^hu$/i; d,c,l=false,'hu','Hungarian'
- when /Polish|^pl$/i; d,c,l=false,'pl','Polish'
- when /Romanian|^ro$/i; d,c,l=false,'ro','Romanian'
- when /Russian|^ru$/i; d,c,l=false,'ru','Russian'
- when /Greek|^el$/i; d,c,l=false,'el','Greek'
- when /Ukranian|^uk$/i; d,c,l=false,'uk','Ukranian'
- when /Turkish|^tr$/i; d,c,l=false,'tr','Turkish'
- #when /Serbian/i; d,c,l=false,'', 'Serbian'
- #when /Welsh/i; d,c,l=false,'', 'Welsh'
- #when /Basque/i; d,c,l=false,'', 'Basque'
- #when /Breton/i; d,c,l=false,'', 'Breton'
- #when /Catalan/i; d,c,l=false,'', 'Catalan'
- #when /Galician/i; d,c,l=false,'', 'Galician'
- #when /Saa?mi/i; d,c,l=false,'', 'Saami'
- #when /Hebrew/i; d,c,l=false,'', 'Hebrew'
- #when /Latin/i; d,c,l=false,'', 'Latin'
- #when /Esperanto/i; d,c,l=false,'', 'Esperanto'
- when /Slovenian|^sl$/i; d,c,l=false,'sl','Slovenian'
- when /Croatian|^hr$/i; d,c,l=false,'hr','Croatian'
- when /Slovak(?:ian)?|^sk$/i; d,c,l=false,'sk','Slovakian'
- when /Czech|^cs$/i; d,c,l=false,'cs','Czech'
- when /Bulgarian|^bg$/i; d,c,l=false,'bg','Bulgarian'
- else d,c,l=true,'en','English (default)'
- #else d,c,l=true,'xx','Default'
- end
- lang[:d],lang[:c],lang[:l]=d,c,l
- lang
- end
- def name
- language[:l].downcase
- end
- def title
- language[:l]
- end
- def code
- language[:c]
- end
- def file_to_language(file)
- m=/.+?\~(\w{2,3})\.(?:-|ssm\.)?sst$/
- @language=if file =~m ; file[m,1]
- else ''
- end
- language
- end
- def codes
- codes=['us','en','fr','de','it','es','br','pt','sv','da','fi','no','is','nl','et','hu','pl','ro','ru','el','uk','tr','sk','hr','sl','cs','bg'] # remove us and br see iso-639-2
- end
- end
- class Info_env < Env_call
- require 'fileutils'
- include FileUtils
- attr_accessor :filename,:sys,:home,:hostname,:user,:env,:rc,:www,:fnb,:fnn,:fnt,:flv,:webserv_path,:stub_pwd,:stub_src,:webserv_host_cgi,:webserv_port_cgi,:processing,:processing_git,:etc,:yamlrc_dir
- @@image_flag,@@local_image=true,true #warning on @@image_flag
- @@fb=@@man_path=nil,nil
- def initialize(fns='',md=nil)
- super() #you may not want to re-execute this static info so frequently!
- @fns,@md=fns,md
- @env=Env_call.new(fns) if fns
- fnb=if @md \
- and defined? @md.fnb
- @md.fnb
- elsif defined? @env.fnb \
- and @env.fnb
- @env.fnb
- elsif not @fns.nil? \
- and not @fns.empty?
- m=/(.+)?\.(?:(?:-|ssm\.)?sst|ssm)$/m
- @fns[m,1] if not @fns.empty?
- end
- if fnb; @@fb ||=fnb
- end
- @sys=Info_system.instance
- @fnb ||=@@fb #clean up this... used primarily for zap which is not passed normal parameters
- @fixed_websev_root='' # @home
- @pwd=@@pwd||=Dir.pwd
- m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m
- @stub_pwd=@@pwd[m,1]
- @stub_epub=@stub_pwd + '/epub'
- @stub_src=@stub_pwd + '/src'
- @stub_pod=@stub_pwd + '/pod'
- @stub_md=@stub_pwd + '/sisu_site_metadata'
- end
- def user
- @sys.user
- end
- def hostname
- @sys.hostname
- end
- def host
- @sys.host
- end
- def arch
- @sys.arch
- end
- def rbver
- @sys.rbver
- end
- def locale
- @sys.locale
- end
- def concord_max
- ((defined? @rc['processing']['concord_max']) \
- && @rc['processing']['concord_max']) \
- ? @rc['processing']['concord_max'] \
- : (defaults[:concord_max])
- end
- def markup_emphasis
- if defined? @rc['default']['emphasis'] \
- and @rc['default']['emphasis'] \
- and @rc['default']['emphasis']=~/bold/
- 'bold'
- elsif defined? @rc['default']['emphasis'] \
- and @rc['default']['emphasis'] \
- and @rc['default']['emphasis']=~/italic/
- 'italics'
- elsif defined? @rc['default']['emphasis'] \
- and @rc['default']['emphasis'] \
- and @rc['default']['emphasis']=~/underscore/
- 'underscore'
- else 'bold'
- end
- end
- def plaintext_wrap
- ((defined? @rc['default']['text_wrap']) \
- && (@rc['default']['text_wrap']) \
- && (@rc['default']['text_wrap'].to_s=~/\d\d+/) \
- && (@rc['default']['text_wrap'].to_i > 19) \
- && (@rc['default']['text_wrap'].to_i < 201)) \
- ? @rc['default']['text_wrap'].to_i \
- : 78
- end
- def current_document
- @@current_document||=Dir.pwd
- @@current_document
- end
- def stub_pwd #200412
- @stub_pwd
- end
- def stub_md_harvest
- @stub_md
- end
- def stub_src
- @stub_src
- end
- def stub_pod
- @stub_pod
- end
- def sisupod
- #path.processing
- # sisupod
- # sisu
- # content.sst [file content]
- # filename.sst [link to content.sst]
- # _sisu
- # conf
- # skin/
- # doc [relevant skin if any other than default]
- # image [all images for specific document gathered here]
- sisupod_processing_path="#{path.processing}/sisupod"
- if FileTest.directory?(sisupod_processing_path) \
- or FileTest.file?(sisupod_processing_path)
- rm_rf(sisupod_processing_path)
- end
- paths=[]
- paths=["#{path.processing}/sisupod/_sisu/skin/doc","#{path.processing}/sisupod/_sisu/skin/dir","#{path.processing}/sisupod/_sisu/skin/site","#{path.processing}/sisupod/_sisu/image"]
- paths.each {|x| mkdir_p(x) unless FileTest.directory?(x) }
- end
- def defaults #multiple default directories
- @default_dir ||=@sys.default_dir #DEFAULT_DIR
- end
- def manifest_minitoc?
- flag=if defined? @rc['manifest']['minitoc'] \
- and not @rc['manifest']['minitoc'].nil?
- @rc['manifest']['minitoc']
- else false
- end
- end
- def widget #needs (md) #move
- @rc=SiSU_Env::Get_init.instance.yamlrc
- @ad=SiSU_Env::Get_init.instance.ads
- @vz=SiSU_Env::Get_init.instance.skin
- @flag={ :ad=>false,:md=>false,:sk=>false,:rc=>false }
- def promo?
- @flag[:ad]=if @md.flag_promo && @ad[:flag_promo]
- @flag[:md]=true
- true
- elsif defined? @vz.widget_promo \
- and not @vz.widget_promo.nil? \
- and @vz.widget_promo.class==Array \
- and @vz.widget_promo.length > 0
- @flag[:sk]=true
- true
- elsif defined? @rc['promo'] \
- and not @rc['promo'].nil? \
- and @rc['promo'].length > 0
- @flag[:rc]=true
- true
- else false
- end
- @flag
- end
- def search?
- searches=['sisu','hyperestraier']
- flag=false
- if defined? @rc['search']
- searches.each do |type|
- flag=if defined? @rc['search'][type] \
- and defined? @rc['search'][type]['action'] \
- and @rc['search'][type]['flag']==true \
- and @rc['search'][type]['action'] =~/https?:\/\//
- flag=if promo?[:ad]
- false
- elsif defined? @vz.widget_search \
- and @vz.widget_search==true
- true
- elsif defined? @rc['search'][type]['flag'] \
- and @rc['search'][type]['flag']==true
- true
- else false
- end
- else false
- end
- end
- else false
- end
- flag
- end
- def search_fixed?
- searches=['sisu','hyperestraier']
- flag=if defined? @rc['search']
- searches.each do |type|
- if defined? @rc['search'][type] \
- and defined? @rc['search'][type]['action'] \
- and @rc['search'][type]['action'] =~/https?:\/\// \
- and defined? @rc['search'][type]['db'] \
- and @rc['search'][type]['db'] =~/\S+/
- flag=if promo?[:ad]
- false
- elsif defined? @vz.widget_search \
- and @vz.widget_search==true
- true
- elsif defined? @rc['search'][type]['flag'] \
- and @rc['search'][type]['flag']==true
- true
- else false
- end
- else false
- end
- end
- else false
- end
- end
- def search_form(type='sisusearch',action=nil,db=nil,table=false)
- rc=SiSU_Env::Get_init.instance.yamlrc
- create_form_sisu=if action \
- and db \
- and action =~/https?:\/\// \
- and db =~/\S+/
- true
- elsif widget.search?
- db=if rc['search']['sisu']['flag']==true \
- and rc['search']['sisu']['db']=~/\S+/
- (rc['search']['sisu']['db']=~/^#{Db[:name_prefix]}\S+/) \
- ? rc['search']['sisu']['db'] \
- : "#{Db[:name_prefix]}#{rc['search']['sisu']['db']}"
- else nil
- end
- action=rc['search']['sisu']['action']
- true
- elsif defined? rc['search']['sisu']['flag'] \
- and defined? rc['search']['sisu']['action'] \
- and rc['search']['sisu']['flag']==true \
- and rc['search']['sisu']['action'] =~/https?:\/\//
- true
- else false
- end
- if table
- table_open='<td align="center" bgcolor="#ffffff">'
- table_close='</td>'
- else
- table_open=''
- table_close='<br />'
- end
- form=if create_form_sisu \
- and type=~/sisusearch/ \
- and defined? rc['search']['sisu'] \
- and defined? rc['search']['sisu']['action']
- <<WOK
-<!-- SiSU Search -->
-#{table_open}
-<a name="search"></a>
-<form method="get" action="#{rc['search']['sisu']['action']}" target="_top">
-<font size="2">
-<input type="text" name="s1" size="24" maxlength="255" />
-<input type="hidden" name="db" value="#{db}" />
-<input type="hidden" name="ltd" value="1000" />
-<input type="hidden" name="off" value="0" />
-<input type="hidden" name="doc" value="#{@md.fnb}" /><br />
-<input type="submit" name="search" value="search doc" />
-<input type="submit" name="search" value="search db" />
-</font></form>
-#{table_close}
-<!-- SiSU Search -->
-WOK
- else ''
- end
- form
- end
- def search_form_static(action=nil,db=nil)
- rc=SiSU_Env::Get_init.instance.yamlrc
- create_form=if rc['search']['sisu']['flag']==true \
- and action \
- and db \
- and action =~/https?:\/\// \
- and db =~/\S+/
- true
- elsif widget.search_fixed?
- db=if rc['search']['sisu']['flag']==true \
- and rc['search']['sisu']['db']=~/\S+/
- (rc['search']['sisu']['db']=~/^#{Db[:name_prefix]}\S+/) \
- ? rc['search']['sisu']['db'] \
- : "#{Db[:name_prefix]}#{rc['search']['sisu']['db']}"
- else nil
- end
- action=rc['search']['sisu']['action']
- true
- else false
- end
- if create_form
- %{<td align="center" bgcolor="#ffffff">
-<!-- SiSU Search -->
-<a name="search"></a>
-<form method="get" action="#{rc['search']['sisu']['action']}" target="_top">
-<font size="2">
-<input type="text" name="s1" size="24" maxlength="255" />
-<br />
-<input type="hidden" name="db" value="#{db}" />
-<input type="hidden" name="ltd" value="1000" />
-<input type="hidden" name="off" value="0" />
-<input type="hidden" name="doc" value="#{@md.fnb}" />
-<input type="submit" name="search" value="search doc" />
-<input type="submit" name="search" value="search db" />
-</font>
-</form>
-<!-- SiSU Search -->
-</td> }
- else ''
- end
- end
- def search_action #check
- action=if search?
- else ''
- end
- end
- self
- end
- def widget_static
- @rc=SiSU_Env::Get_init.instance.yamlrc
- @vz=SiSU_Env::Get_init.instance.skin
- @flag={ :ad=>false,:md=>false,:sk=>false,:rc=>false }
- def search?
- flag=if defined? @rc['search'] \
- and defined? @rc['search']['sisu'] \
- and defined? @rc['search']['sisu']['action'] \
- and @rc['search']['sisu']['action'] =~/https?:\/\// \
- and defined? @rc['search']['sisu']['db'] \
- and @rc['search']['sisu']['db'] =~/\S+/ \
- and defined? @rc['search']['sisu']['db'] \
- and @rc['search']['sisu']['db'] =~/\S+/
- flag=if defined? @vz.widget_search \
- and @vz.widget_search==true
- true
- elsif defined? @rc['search']['sisu']['flag'] \
- and @rc['search']['sisu']['flag']==true
- true
- else
- false
- end
- else
- false
- end
- end
- def search_fixed?
- flag=if defined? @rc['search'] \
- and defined? @rc['search']['sisu'] \
- and defined? @rc['search']['sisu']['action'] \
- and @rc['search']['sisu']['action'] =~/https?:\/\// \
- and defined? @rc['search']['sisu']['db'] \
- and @rc['search']['sisu']['db'] =~/\S+/ \
- and defined? @rc['search']['sisu']['db'] \
- and @rc['search']['sisu']['db'] =~/\S+/
- flag=if defined? @vz.widget_search \
- and @vz.widget_search==true
- true
- elsif defined? @rc['search']['sisu']['flag'] \
- and @rc['search']['sisu']['flag']==true
- true
- else
- false
- end
- else
- false
- end
- end
- def search_form(action=nil,db=nil)
- rc=SiSU_Env::Get_init.instance.yamlrc
- create_form=if defined? rc['search']['sisu']['flag'] \
- and rc['search']['sisu']['flag']==true \
- and action \
- and db \
- and action =~/https?:\/\// \
- and db =~/\S+/
- true
- elsif widget_static.search? \
- and rc['search']['sisu']['flag']==true
- db=if rc['search']['sisu']['db']=~/\S+/
- (rc['search']['sisu']['db']=~/^#{Db[:name_prefix]}\S+/) \
- ? rc['search']['sisu']['db'] \
- : "#{Db[:name_prefix]}#{rc['search']['sisu']['db']}"
- else nil
- end
- action=rc['search']['sisu']['action']
- true
- else false
- end
- if create_form \
- and @fnb \
- and @fnb=~/\S+/
- %{<!-- SiSU Search -->
-<a name="search"></a>
-<form method="get" action="#{rc['search']['sisu']['action']}" target="_top">
-<font size="2">
-<input type="text" name="s1" size="24" maxlength="255" />
-<br />
-<input type="hidden" name="db" value="#{db}" />
-<input type="hidden" name="doc" value="#{@fnb}" />
-<input type="submit" name="search" value="search doc" />
-<input type="submit" name="search" value="search db" />
-</font>
-</form>
-<!-- SiSU Search --> }
- elsif create_form
- %{<!-- SiSU Search -->
-<a name="search"></a>
-<form method="get" action="#{rc['search']['sisu']['action']}" target="_top">
-<font size="2">
-<input type="text" name="s1" size="24" maxlength="255" />
-<br />
-<input type="hidden" name="db" value="#{db}" />
-<input type="submit" name="search" value="search db" />
-</font>
-</form>
-<!-- SiSU Search --> }
- else ''
- end
- end
- def search_action #check
- action=if search?
- else ''
- end
- end
- self
- end
- def source_file_path
- file=@fns.gsub(/\.ssm(?:\.sst)?/,'.ssm.sst')
- pth=unless file =~/\.ssm\.sst$/; "#{Dir.pwd}"
- else "#{path.composite_file}"
- end
- end
- def source_file_with_path
- file=@fns.gsub(/\.ssm(?:\.sst)?/,'.ssm.sst')
- "#{source_file_path}/#{file}"
- end
- def read_source_file(fns)
- fns_array=if RUBY_VERSION < '1.9'
- x=unless fns =~/\.ssm.sst$/
- IO.readlines(fns,'')
- else IO.readlines("#{path.composite_file}/#{fns}",'')
- end
- else #ruby version >= '1.9'
- x=unless fns =~/\.ssm.sst$/
- IO.readlines(fns,'r:utf-8')
- else IO.readlines("#{path.composite_file}/#{fns}",'r:utf-8')
- end
- end
- end
- def font
- def texpdf
- (defined? @rc['default']['texpdf_font']) \
- && (@rc['default']['texpdf_font']=~/\S{3,}/) \
- ? @rc['default']['texpdf_font'] \
- : 'Liberation Sans' #'Liberation Sans' #'Liberation Serif'
- end
- self
- end
- def path #dir
- def home
- @sys.home
- end
- def pwd
- @sys.pwd
- end
- def stub_pwd
- @stub_pwd
- end
- def stub_epub
- @stub_epub
- end
- def stub_src
- @stub_src
- end
- def stub_pod
- @stub_pod
- end
- def stub_md_harvest
- @stub_md
- end
- def etc
- defaults[:sisu_etc] #live/dynamic
- end
- def arch
- @sys.dir_arch
- end
- def sitearch
- @sys.dir_sitearch
- end
- def bin
- @sys.dir_bin
- end
- def share #shared data repository source directory
- defaults[:sisu_share]
- end
- def style
- defaults[:stylesheet_stub]
- end
- def sample_data #sample data repository source directory
- defaults[:sample_data_path]
- end
- def rc
- @sys.rc_path
- end
- def yamlrc
- rc.each do |v|
- if FileTest.exist?("#{v}/sisurc.yml")
- @yamlrc_dir="#{v}/sisurc.yml"
- break
- end
- end
- unless @yamlrc_dir
- rc.each do |v|
- if FileTest.exist?("#{v}/sisurc.yaml")
- @yamlrc_dir="#{v}/sisurc.yaml"
- break
- end
- end
- end
- @yamlrc_dir
- end
- def man #check use
- (defined? @rc['webserv']['man']) \
- ? "#{webserv}/#{@rc['webserv']['man']}" \
- : defaults[:webserv_man]
- end
- def webserv_path #testing, check need, remove
- webserv
- end
- def webserv #separation required for webrick which cannot use path.output (different requirements as no file is passed)
- man_path=if @@man_path.nil?
- man_path=if defined? @rc['webserv']['path'] \
- and @rc['webserv']['path'] =~/\S\S+/
- man_path=@@man_path=File.expand_path(@rc['webserv']['path'])
- else defaults[:webserv_path]
- end
- else @@man_path
- end
- man_path_head=man_path.gsub(/(\S+)\/[^\/\s]+$/,'\1')
- unless FileTest.directory?(man_path)
- mkdir_p(man_path) if File.writable?("#{man_path_head}/.")
- end
- @webserv_path=if defined? man_path \
- and File.writable?("#{man_path}/.")
- man_path #web server path as configured in rc file
- elsif FileTest.directory?(defaults[:webserv_path]) \
- and File.writable?("#{defaults[:webserv_path]}/.") #web server path default
- defaults[:webserv_path]
- else #create default directory under home and place output there
- unless FileTest.directory?(defaults[:output_local])
- mkdir_p(defaults[:output_local])
- end
- defaults[:output_local]
- end
- end
- def webserv_stub_ensure
- mkdir_p(path.webserv) unless FileTest.directory?(path.webserv)
- mkdir_p("#{path.webserv}/#{@stub_pwd}") unless FileTest.directory?("#{path.webserv}/#{@stub_pwd}")
- end
- def webserv_map_pwd #dir
- "#{path.webserv}/#{stub_pwd}"
- end
- def webserv_dir #fixed/hard path to /www web/presentation directory, on Debian /var/www subdirectories are created within it, depending on markup directory stub-name (last segment of markup directory name)
- defaults[:webserv_dir]
- end
- def webserv_image #web/presentation directory, subdirectories are created within it, depending on markup directory stub-name (last segment of markup directory name)
- images=if defined? @rc['webserv']['images']
- @rc['webserv']['images']
- else defaults[:images]
- end
- "#{path.webserv}/#{images}"
- end
- def output #web/webserv output directory... subdirectory into which further subdirectories are made based on file names
- "#{path.webserv}/#{@stub_pwd}"
- end
- def output_src
- "#{path.output}/src"
- end
- def output_md_harvest
- "#{path.output}/sisu_site_metadata"
- end
- def output_pod
- "#{path.output}/pod"
- end
- def output_epub
- "#{path.output}/epub"
- end
- def output_harvest
- "#{path.output}/sisu_site_metadata"
- end
- def manpage
- "#{path.output}/man"
- end
- def sitemaps
- "#{path.output}/sitemaps"
- end
- def encoding
- pth="#{processing}/#{defaults[:processing_encoding]}"
- mkdir_p(pth) unless FileTest.directory?(pth)
- pth
- end
- def processing_base_tmp
- defaults[:processing_path_tmp_base]
- end
- def processing_dir_tmp_root
- defaults[:processing_dir_tmp_root]
- end
- def processing_path_root
- proposed_path_base=if defined? @rc['processing']['path'] \
- and not @rc['processing']['path'].nil? \
- and not @rc['processing']['path'].empty?
- x=if @rc['processing']['path'] =~/^(?:~|home)$/
- home #fix
- else @rc['processing']['path']
- end
- else nil
- end
- proposed_dir=if defined? @rc['processing']['dir'] \
- and not @rc['processing']['dir'].nil? \
- and not @rc['processing']['dir'].empty?
- @rc['processing']['dir']
- else defaults[:processing_dir]
- end
- path=if proposed_path_base \
- and FileTest.directory?(proposed_path_base) \
- and File.writable?("#{proposed_path_base}/.")
- x=if proposed_dir
- "#{proposed_path_base}/#{proposed_dir}"
- else
- "#{proposed_path_base}/#{defaults[:processing_dir]}"
- end
- else defaults[:processing_dir_tmp_root]
- end
- end
- def processing_path_usr?
- case processing_path_root
- when /^\/home/; false
- else true
- end
- end
- def processing_path
- (processing_path_usr?) \
- ? ("#{processing_path_root}/#{user}/#{stub_pwd}") \
- : ("#{processing_path_root}/#{stub_pwd}") # see defaults[:processing_path]
- end
- def processing #processing directory, used/needed for sisu work files, has sub-directories (dal,tex etc)
- unless FileTest.directory?(processing_path_root)
- mkdir_p(processing_path_root)
- File.chmod(0777,processing_path_root)
- end
- if processing_path_usr?
- processing_path_usr="#{processing_path_root}/#{user}"
- mkdir_p(processing_path_usr) unless FileTest.directory?(processing_path_usr)
- File.chmod(0700,processing_path_usr)
- end
- mkdir_p(processing_path) unless FileTest.directory?(processing_path)
- File.chmod(0700,processing_path)
- path_processing=[processing_path,defaults[:processing_path],defaults[:processing_path_home]]
- processing=nil
- path_processing.each do |v| #
- processing=v
- unless FileTest.directory?(processing)
- puts "a processing directory (#{processing}) is being created for use by sisu"
- mkdir_p(processing)
- File.chmod(0700,processing)
- end
- break
- end
- processing
- end
- def processing_path_git
- proposed_dir=if defined? @rc['git']['dir'] \
- and not @rc['git']['dir'].nil? \
- and not @rc['git']['dir'].empty?
- x=(@rc['git']['dir'] =~/^(?:~|home)$/) \
- ? home + '/' + 'sisu:' \
- : @rc['git']['dir'] + '/' + 'sisu:'
- else defaults[:processing_git]
- end
- end
- def processing_git
- unless FileTest.directory?(processing_path_git)
- mkdir_p(processing_path_git)
- File.chmod(0700,processing_path_git)
- end
- processing_path_git
- end
- def epub
- "#{processing}/epub/#{@fnb}"
- end
- def sql
- pth="#{processing}/sql"
- mkdir_p(pth) unless FileTest.directory?(pth)
- pth
- end
- def composite_file
- pth=path.dal #"#{processing}/composite"
- mkdir_p(pth) unless FileTest.directory?(pth)
- pth
- end
- def dal
- pth=if defined? @rc['processing']['dal'] \
- and not @rc['processing']['dal'].nil? \
- and not @rc['processing']['dal'].empty?
- "#{processing}/#{@rc['processing']['dal']}"
- else "#{processing}/#{defaults[:processing_dal]}"
- end
- mkdir_p(pth) unless FileTest.directory?(pth)
- pth
- end
- def tune
- pth=if defined? @rc['processing']['tune'] \
- and not @rc['processing']['tune'].nil? \
- and not @rc['processing']['tune'].empty?
- "#{processing}/#{@rc['processing']['tune']}"
- else "#{processing}/#{defaults[:processing_tune]}"
- end
- mkdir_p(pth) unless FileTest.directory?(pth)
- pth
- end
- def odf #_bld
- pth="#{processing}/odf"
- mkdir_p(pth) unless FileTest.directory?(pth)
- pth
- end
- def odf_bld
- rm_rf(path.odf)
- mkdir_p(path.odf) unless FileTest.directory?(path.odf)
- mkdir_p("#{path.odf}/Configurations2") unless FileTest.directory?("#{path.odf}/Configurations2")
- mkdir_p("#{path.odf}/META-INF") unless FileTest.directory?("#{path.odf}/META-INF")
- mkdir_p("#{path.odf}/Pictures") unless FileTest.directory?("#{path.odf}/Pictures")
- mkdir_p("#{path.odf}/Thumbnails") unless FileTest.directory?("#{path.odf}/Thumbnails")
- path.odf
- end
- def epub_bld
- mkdir_p(path.epub) unless FileTest.directory?(path.epub)
- mkdir_p("#{path.epub}/META-INF") unless FileTest.directory?("#{path.epub}/META-INF")
- mkdir_p("#{path.epub}/OPS/image") unless FileTest.directory?("#{path.epub}/OPS/image")
- mkdir_p("#{path.epub}/OPS/css") unless FileTest.directory?("#{path.epub}/OPS/css")
- images=%W[bullet_09.png arrow_next_red.png arrow_prev_red.png arrow_up_red.png]
- path.epub
- end
- def epub_cp_images(md)
- pth="#{path.epub}/OPS/image"
- mkdir_p(pth) unless FileTest.directory?(pth)
- src="#{path.share}/image"
- images=%W[bullet_09.png arrow_next_red.png arrow_prev_red.png arrow_up_red.png]
- images.each do |i| #move to avoid repeated tests
- cp("#{src}/#{i}","#{pth}/#{i}") unless FileTest.file?("#{pth}/#{i}")
- end
- pth
- end
- def tex
- pth=if defined? @rc['processing']['latex'] \
- and not @rc['processing']['latex'].nil? \
- and not @rc['processing']['latex'].empty?
- "#{processing}/#{@rc['processing']['latex']}"
- else "#{processing}/#{defaults[:processing_latex]}"
- end
- mkdir_p(pth) unless FileTest.directory?(pth)
- pth
- end
- def texi
- pth=if defined? @rc['processing']['texinfo'] \
- and not @rc['processing']['texinfo'].nil? \
- and not @rc['processing']['texinfo'].empty?
- "#{processing}/#{@rc['processing']['texinfo']}"
- else "#{processing}/#{defaults[:processing_texinfo]}"
- end
- mkdir_p(pth) unless FileTest.directory?(pth)
- pth
- end
- def texinfo #texinfo webserv, check
- "#{processing}/#{defaults[:processing_texinfo]}"
- end
- def lout
- pth=if defined? @rc['processing']['lout'] \
- and not @rc['processing']['lout'].nil? \
- and not @rc['processing']['lout'].empty?
- "#{processing}/#{@rc['processing']['lout']}"
- else "#{processing}/#{defaults[:processing_lout]}"
- end
- mkdir_p(pth) unless FileTest.directory?(pth)
- pth
- end
- def sqlite
- pth=if defined? @rc['processing']['sqlite'] \
- and not @rc['processing']['sqlite'].nil? \
- and not @rc['processing']['sqlite'].empty?
- "#{processing}/#{@rc['processing']['sqlite']}"
- else "#{processing}/#{defaults[:processing_sqlite]}"
- end
- mkdir_p(pth) unless FileTest.directory?(pth)
- pth
- end
- def postgresql
- pth=if defined? @rc['processing']['postgresql'] \
- and not @rc['processing']['postgresql'].nil? \
- and not @rc['processing']['postgresql'].empty?
- "#{processing}/#{@rc['processing']['postgresql']}"
- else "#{processing}/#{defaults[:processing_postgresql]}"
- end
- mkdir_p(pth) unless FileTest.directory?(pth)
- pth
- end
- def feed
- (defined? @rc['webserv']['feed']) \
- ? ("#{public_output}/#{@rc['webserv']['feed']}") \
- : (defaults[:webserv_feed])
- end
- def feed_home
- "#{public_output}/#{@rc['webserv']['feed_home']}"
- end
- def scripts #used previously only to include tla version info
- if defined? @rc['project']['path']; "#{home}/#{@rc['project']['path']}"
- end
- end
- def cgi
- (defined? @rc['webserv']['cgi']) \
- ? "#{@rc['webserv']['cgi']}" \
- : (defaults[:webserv_cgi])
- end
- def php
- (defined? @rc['webserv']['php']) \
- ? "#{public_output}/#{@rc['webserv']['php']}" \
- : (defaults[:webserv_php])
- end
- # programs
- def output_tell
- url.webserv_map_pwd
- end
- def image_source #image repository source directory
- image_path=if defined? @rc['image']['path'] \
- and defined? @rc['image']['public']
- pth="#{@rc['image']['path']}"
- "#{pth}/#{@rc['image']['public']}"
- else "#{share}/image"
- end
- end
- def image_source_tex #image repository source directory
- image_path=if defined? @rc['image']['path'] \
- and defined? @rc['image']['public']
- pth="#{@rc['image']['path']}"
- "#{pth}/#{@rc['image']['public']}"
- else
- image=defaults[:image_stub]
- "#{share}/image"
- end
- end
- def image_external
- "#{processing}/external_document/image"
- end
- def image_source_local_tex
- if FileTest.directory?(defaults[:image_local]); defaults[:image_local]
- end
- end
- def image_source_remote_tex
- if FileTest.directory?(image_external); image_external
- end
- end
- self
- end
- def url
- def hostname
- "http://#{@sys.hostname}"
- end
- def dir_url
- "file://#{path.webserv}/#{stub_pwd}"
- end
- def localhost
- "http://localhost/#{stub_pwd}"
- end
- def local
- "http://#{hostname}/#{@stub_pwd}"
- end
- def root
- if defined? @rc['webserv']['url_root'] \
- and @rc['webserv']['url_root'] =~/https?:\/\//
- "#{@rc['webserv']['url_root']}/#{@stub_pwd}"
- elsif defined? @rc['webserv']['url_root'] \
- and @rc['webserv']['url_root'] =~/localhost/
- "http://localhost/#{@stub_pwd}"
- else "file://#{path.output}"
- end
- end
- def remote
- root
- end
- def epub
- "#{root}/epub"
- end
- def src_txt
- "#{root}/src"
- end
- def src_pod
- "#{root}/pod"
- end
- def webserv_host_base
- if defined? @rc['webserv']['host']
- case @rc['webserv']['host']
- when /https?:\/\//; @rc['webserv']['host']
- when /\S+/; "http://#{@rc['webserv']['host']}"
- else defaults[:webserv_host_cgi]
- end
- else defaults[:webserv_host_cgi]
- end
- end
- def webrick_port
- if @md \
- and @md.cmd.inspect=~/-F/ \
- and @md.mod.inspect=~/port=(\d+)/
- $1
- else
- if defined? @rc['webserv_cgi']['port']
- if @rc['webserv_cgi']['port'].nil? \
- and (defined? @md.mod \
- and not @md.mod.nil? \
- and @md.mod.inspect=~/webrick/)
- defaults[:webserv_port_cgi]
- elsif not @rc['webserv_cgi']['port'].nil?
- @rc['webserv_cgi']['port']
- else defaults[:webserv_port_cgi]
- end
- else defaults[:webserv_port_cgi]
- end
- end
- end
- def webserv_port_cgi
- if @md \
- and @md.cmd.inspect=~/-F/ \
- and @md.mod.inspect=~/port=(\d+)/
- $1
- else
- if defined? @rc['webserv_cgi']['port']
- if @rc['webserv_cgi']['port'].nil? \
- and (defined? @md.mod \
- and not @md.mod.nil? \
- and @md.mod.inspect=~/webrick/)
- defaults[:webserv_port_cgi]
- elsif not @rc['webserv_cgi']['port'].nil?
- @rc['webserv_cgi']['port']
- else nil
- end
- else nil
- end
- end
- end
- def webserv_cgi #web url for local webserv (localhost, or hostname)
- if defined? @rc['webserv_cgi']['host'] \
- and not @rc['webserv_cgi']['host'].nil?
- http=((@rc['webserv_cgi']['host'] =~ /https?:\/\//) ? '' : 'http://') #check https? missing
- if webserv_port_cgi
- "#{http}#{@rc['webserv_cgi']['host']}:#{webserv_port_cgi}/#{@stub_pwd}"
- else "#{http}#{@rc['webserv_cgi']['host']}/#{@stub_pwd}"
- end
- else
- http=((webserv_host_base=~/https?:\/\//) ? '' : 'http://')
- if webserv_port_cgi
- "#{http}#{webserv_host_base}:#{webserv_port_cgi}/#{@stub_pwd}"
- else "#{http}#{webserv_host_base}/#{@stub_pwd}"
- end
- end
- end
- def webserv_base_cgi #web url for local webserv (localhost, or hostname)
- if defined? @rc['webserv_cgi']['host'] \
- and not @rc['webserv_cgi']['host'].nil?
- http=((@rc['webserv_cgi']['host'] =~ /https?:\/\//) ? '' : 'http://')
- if webserv_port_cgi
- "#{http}#{@rc['webserv_cgi']['host']}:#{webserv_port_cgi}"
- else "#{http}#{@rc['webserv_cgi']['host']}"
- end
- else
- http=((webserv_host_base=~/https?:\/\//) ? '' : 'http://')
- if webserv_port_cgi
- "#{http}#{webserv_host_base}:#{webserv_port_cgi}"
- else "#{http}#{webserv_host_base}"
- end
- end
- end
- def webrick #must have a port #REMOVE
- if defined? @rc['webserv_cgi']['host'] \
- and not @rc['webserv_cgi']['host'].nil?
- http=if @rc['webserv_cgi']['host'] =~/http:\/\//
- 'http://'
- elsif @rc['webserv_cgi']['host'] =~/https:\/\//
- 'https://'
- else defaults
- end
- "#{http}#{@rc['webserv_cgi']['host']}"
- elsif webserv_host_base \
- and not webserv_host_base.nil?
- "#{http}#{webserv_host_base}"
- else "#{http}localhost" end
- end
- def webserv #web url for local webserv (localhost, or hostname)
- if path.webserv_dir \
- and path.webserv =~ /#{path.webserv_dir}/ #revisit
- "#{path.webserv}/#{@stub_pwd}".gsub(/#{path.webserv_dir}/,"#{url.hostname}/#{@stub_pwd}")
- elsif defined? @rc['webserv']['webrick_url'] \
- and @rc['webserv']['webrick_url']==false
- "file://#{path.webserv}/#{@stub_pwd}"
- elsif webserv_port_cgi =~/\S+/
- "#{url.hostname}:#{webserv_port_cgi}/#{@stub_pwd}"
- else "#{url.hostname}/#{@stub_pwd}"
- end
- end
- def webserv_base #web url for local webserv (localhost, or hostname)
- if path.webserv_dir \
- and path.webserv =~ /#{path.webserv_dir}/ #revisit
- "#{path.webserv}/#{@stub_pwd}".gsub(/#{path.webserv_dir}/,"#{url.hostname}")
- elsif defined? @rc['webserv']['webrick_url'] \
- and @rc['webserv']['webrick_url']==false
- "file://#{path.webserv}"
- else "#{url.webrick_base}"
- end
- end
- def webserv_files_from_db #sort this out, messy
- if defined? @rc['webserv_cgi']['file_links']
- case @rc['webserv_cgi']['file_links']
- when /webserv_cgi/; url.webserv_base_cgi
- when /webserv/; @rc['webserv']['url_root']
- when /https?:\/\//; @rc['webserv_cgi']['file_links']
- when /\S+/; "http://#{@rc['webserv_cgi']['file_links']}"
- else webserv_base_cgi
- end
- else webserv_base_cgi
- end
- end
- def sample_search_form_title
- if defined? @rc['search']['sisu']['title'] \
- and @rc['search']['sisu']['title'] =~/\S+/
- @rc['search']['sisu']['title']
- else %{(SiSU (generated sample) search form}
- end
- end
- def output_tell
- output_type=if defined? @rc['show_output_on'] \
- and @rc['show_output_on'] =~/^(?:filesystem|webserv|(?:local|remote)(?:_webserv)?|webrick)/
- @rc['show_output_on']
- else 'filesystem'
- end
- output=case output_type
- when /^filesystem(?:_url)?/; url.dir_url
- when /^remote(?:_webserv)?/; url.remote
- when /^(?:webserv|local_webserv)/; url.local
- when /^local(:\d+)/; url.hostname + $1 + '/' + stub_pwd
- when /^localhost(:\d+)/; url.localhost + $1 + '/' + stub_pwd
- when /^localhost/; url.localhost
- when /^webrick/; url.webrick
- when /^path/; url.webserv_map_pwd
- else url.webserv_map_pwd
- end
- end
- def images
- '../_sisu/image'
- end
- def images_local
- if FileTest.directory?(defaults[:image_local])
- if @@image_flag
- images=Dir.glob("#{defaults[:image_local]}/*.{png,jpg,gif}")
- pth="#{path.webserv}/#{@stub_pwd}"
- mkdir_p("#{pth}/_sisu/image") unless FileTest.directory?("#{pth}/_sisu/image")
- images.each { |i| File.install(i,"#{pth}/#{i}") } unless images.length > 0
- @@image_flag=false
- end
- '../_sisu/image'
- else
- if @@local_image==true
- cmd=if @cmd; @cmd
- else ''
- end
- SiSU_Screen::Ansi.new(cmd,"WARNING - no local image directory or images:", defaults[:image_local] ).warn unless cmd =~/q/
- @@local_image=false
- end
- url.images
- end
- end
- def images_external
- if FileTest.directory?(image_external)
- if @@image_flag
- images=Dir.glob("#{image_external}/*.{png,jpg,gif}")
- pth="#{path.webserv}/#{@stub_pwd}"
- mkdir_p("#{pth}/_sisu/image_external") unless FileTest.directory?("#{pth}/_sisu/image_external")
- images.each { |i| File.install(i,"#{pth}/#{i}") } unless images.length > 0
- @@image_flag=false
- end
- '../_sisu/image_external'
- else
- if @@local_image==true
- SiSU_Screen::Ansi.new(@cmd,"WARNING - image directory for external images or no such images:", :image_external ).warn unless @cmd =~/q/
- @@local_image=false
- end
- url.images_external
- end
- end
- def images_epub
- './image'
- end
- self
- end
- def digest
- def type
- if defined? @rc['default']['digest'] \
- and @rc['default']['digest'] != nil
- case @rc['default']['digest']
- when /^sha(?:2|256)?$/; 'sha256'
- when /^md5$/; 'md5'
- else 'sha256'
- end
- else 'sha256'
- end
- end
- def length
- case digest.type
- when /sha256/; 64
- when /md5/; 32
- else 64
- end
- end
- def pattern
- "[0-9a-f]{#{digest.length}}" #/[0-9a-f]{#{digest.length}}/
- end
- self
- end
- def program
- def text_editor
- if defined? @rc['program_select']['editor'] \
- and @rc['program_select']['editor'] =~/\S\S+/
- @rc['program_select']['editor']
- elsif defined? @rc['program_select']['text_editor'] \
- and @rc['program_select']['text_editor'] =~/\S\S+/
- @rc['program_select']['text_editor']
- else 'editor' #'gvim -c :R -c :S'
- end
- end
- def pdf_viewer
- ((defined? @rc['program_select']['pdf_viewer']) \
- && @rc['program_select']['pdf_viewer'] =~/\S\S+/) \
- ? @rc['program_select']['pdf_viewer'] \
- : 'pdf-viewer' #'evince'
- end
- def web_browser
- if defined? @rc['program_select']['www_browser'] \
- and @rc['program_select']['www_browser'] =~/\S\S+/
- @rc['program_select']['www_browser']
- elsif defined? @rc['program_select']['web_browser'] \
- and @rc['program_select']['web_browser'] =~/\S\S+/
- @rc['program_select']['web_browser']
- else 'x-www-browser' #'firefox' 'iceweasel' 'kazehakase' 'galeon'
- end
- end
- def www_browser
- web_browser
- end
- def console_web_browser
- if defined? @rc['program_select']['console_www_browser'] \
- and @rc['program_select']['console_www_browser'] =~/\S\S+/
- @rc['program_select']['console_www_browser']
- elsif defined? @rc['program_select']['console_web_browser'] \
- and @rc['program_select']['console_web_browser'] =~/\S\S+/
- @rc['program_select']['console_web_browser']
- else 'console-www-browser' #'lynx' 'links2' 'elinks' 'epiphany'
- end
- end
- def console_www_browser
- web_browser
- end
- def epub_viewer
- if defined? @rc['program_select']['epub_viewer'] \
- and @rc['program_select']['epub_viewer'] =~/\S\S+/
- @rc['program_select']['epub_viewer']
- elsif defined? @rc['program_select']['epub_viewer'] \
- and @rc['program_select']['epub_viewer'] =~/\S\S+/
- @rc['program_select']['epub_viewer']
- else 'ebook-viewer' #'calibre' 'fbreader'
- end
- end
- def xml_viewer
- ((defined? @rc['program_select']['xml_viewer']) \
- && @rc['program_select']['xml_viewer'] =~/\S\S+/) \
- ? @rc['program_select']['xml_viewer'] \
- : text_editor
- end
- def xml_editor
- xml_viewer
- end
- def odf_viewer
- ((defined? @rc['program_select']['odf_viewer']) \
- && @rc['program_select']['odf_viewer'] =~/\S\S+/) \
- ? @rc['program_select']['odf_viewer'] \
- : 'lowriter' #'odf-viewer','oowriter'
- end
- def manpage_viewer
- 'man'
- end
- def manpage_generator
- ((defined? @rc['program_select']['man']) \
- && @rc['program_select']['man'] =~/\S\S+/) \
- ? @rc['program_select']['man'] \
- : 'nroff -man' #'nroff -man' #'groff -man -Tascii'
- end
- def file_encoding
- is=(defined? @rc['program_set']['file_encoding']) ? @rc['program_set']['encoding'] : ''
- (is.nil? || is==true) ? 'encoding' : is
- end
- def wc #wordcount
- is=(defined? @rc['program_set']['wc']) ? @rc['program_set']['wc'] : ''
- (is.nil? || is==true) ? 'wc' : is
- end
- def tidy
- is=(defined? @rc['program_set']['tidy']) ? @rc['program_set']['tidy'] : nil
- (is.nil? || is==true) ? 'tidy' : is
- end
- def rmagick
- is=(defined? @rc['program_set']['rmagick']) ? @rc['program_set']['rmagick'] : nil
- (is.nil? || is==true) ? 'rmagick' : is
- end
- def rexml #should be part of ruby 1.8 but apparently not always
- is=(defined? @rc['program_set']['rexml']) ? @rc['program_set']['rexml'] : ''
- (is.nil? || is==true) ? 'rexml' : is
- end
- def pdflatex
- is=(defined? @rc['program_set']['pdflatex']) ? @rc['program_set']['pdflatex'] : ''
- (is.nil? || is==true) ? 'pdflatex' : is
- end
- def postgresql
- is=(defined? @rc['program_set']['postgresql']) ? @rc['program_set']['postgresql'] : ''
- (is.nil? || is==true) ? 'postgresql' : is
- end
- def sqlite
- is=(defined? @rc['program_set']['sqlite']) ? @rc['program_set']['sqlite'] : ''
- (is.nil? || is==true) ? 'sqlite' : is
- end
- self
- end
- def i18n
- def language # language settings
- m=/.+\/\S+?\~(\S+)/
- pwd=Dir.pwd
- conf=(defined? @rc['default']['language']) ? @rc['default']['language'] : nil
- l=if pwd=~ m; pwd[m,1] #2 directory: by visible directory name
- elsif conf; @rc['default']['language'] #3 config: from sisurc.yaml
- else defaults[:language] #4 sisu: program default
- end #1 document: param gets
- SiSU_Env::Standardise_language.new(l)
- end
- def multilingual
- ((defined? @rc['default']['multilingual']) \
- && @rc['default']['multilingual'] != nil) \
- ? @rc['default']['multilingual'] \
- : (defaults[:multilingual])
- end
- def lang_filename(l)
- @lang={}
- x=if multilingual
- (( defined? @rc['default']['language_file']) \
- && @rc['default']['language_file'] != nil) \
- ? @rc['default']['language_file'] \
- : 1
- else 0
- end
- if (l != defaults[:language_code]) \
- or (language.code != defaults[:language_code]) #watch
- if x==1; @lang[:pre],@lang[:mid],@lang[:post]="#{l}.",'',''
- elsif x==2; @lang[:pre],@lang[:mid],@lang[:post]='',".#{l}",''
- elsif x==3; @lang[:pre],@lang[:mid],@lang[:post]='','',".#{l}"
- else @lang[:pre],@lang[:mid],@lang[:post]='','',''
- end
- else @lang[:pre],@lang[:mid],@lang[:post]='','',''
- end
- @lang
- end
- self
- end
- def file_encoding
- is=''
- if defined? @rc['program_set']['file_encoding']; is=@rc['program_set']['encoding']
- end
- if is.nil? \
- or is==true; is='encoding'
- end
- is
- end
- def papersize # paper settings, default overidden in param if set within document
- (defined? @rc['default']['papersize']) \
- ? @rc['default']['papersize'].downcase \
- : (defaults[:papersize].downcase)
- end
- def odf_structure
- rm_rf("#{path.processing}/odf")
- system("unzip -q #{path.share}/#{SiSU_version_dir}/odf/odt.zip -d #{path.processing}")
- end
- def sisupod_gen(fns_pod)
- pwd=Dir.pwd
- sisupod_processing_path="#{path.processing}/sisupod"
- if FileTest.directory?(sisupod_processing_path) \
- or FileTest.file?(sisupod_processing_path)
- rm_rf(sisupod_processing_path)
- end
- unless FileTest.directory?(sisupod_processing_path)
- mkdir_p(sisupod_processing_path)
- end
- if FileTest.file?("#{Dir.pwd}/#{fns_pod}")
- system("unzip -q #{Dir.pwd}/#{fns_pod} -d #{path.processing}")
- else
- SiSU_Screen::Ansi.new('',"file not found: #{fns_pod}").warn unless @cmd=~/q/
- end
- sisupod_processing_path
- end
- end
- class Info_processing_flag
- attr_accessor :color,:cf_0,:cf_1,:cf_2,:cf_3,:cf_4,:cf_5
- def initialize
- @rc=Get_init.instance.yamlrc
- end
- def color #processing flag shortcuts
- (defined? @rc['flag']['color']) ? @rc['flag']['color'] : false
- end
- def cf_0 #processing flag shortcuts
- if defined? @rc['flag']['default'] \
- and not (@rc['flag']['default'].nil? \
- or @rc['flag']['default'].empty?)
- @rc['flag']['default']
- else '-NhwepoabxXyYv'
- end
- end
- def cf_1 #processing flag shortcuts
- if defined? @rc['flag']['i'] \
- and not (@rc['flag']['i'].nil? \
- or @rc['flag']['i'].empty?)
- @rc['flag']['i']
- else '-hwepoay'
- end
- end
- def cf_2 #processing flag shortcuts
- if defined? @rc['flag']['ii'] \
- and not (@rc['flag']['ii'].nil? \
- or @rc['flag']['ii'].empty?)
- @rc['flag']['ii']
- else '-NhwepoabxXy'
- end
- end
- def cf_3 #processing flag shortcuts
- if defined? @rc['flag']['iii'] \
- and not (@rc['flag']['iii'].nil? \
- or @rc['flag']['iii'].empty?)
- @rc['flag']['iii']
- else '-NhwepoabxXyY'
- end
- end
- def cf_4 #processing flag shortcuts
- if defined? @rc['flag']['iv'] \
- and not (@rc['flag']['iv'].nil? \
- or @rc['flag']['iv'].empty?)
- @rc['flag']['iv']
- else '-NhwepoabxXDyY --update'
- end
- end
- def cf_5 #processing flag shortcuts
- if defined? @rc['flag']['v'] \
- and not (@rc['flag']['v'].nil? \
- or @rc['flag']['v'].empty?)
- @rc['flag']['v']
- else '-NhwepoabxXDyYv --update'
- end
- end
- end
- class Info_settings < Info_env
- def permission?(prog) #program defaults
- (defined? @rc['permission_set'][prog]) ? @rc['permission_set'][prog] : false
- end
- def program?(prog) #program defaults
- (defined? @rc['program_set'][prog]) ? @rc['program_set'][prog] : false
- end
- end
- class File_map < Info_env
- attr_accessor :local_sisu_source
- def initialize(opt='') #watch
- super()
- @opt=opt #,opt.fns,opt.cmd
- @env=(@opt.fns && !(@opt.fns.empty?) \
- ? (SiSU_Env::Info_env.new(@opt.fns)) \
- : (SiSU_Env::Info_env.new('dummy.sst')))
- if @opt.cmd =~/m/; @md=SiSU_Param::Parameters.new(@opt).get
- end
- ft=[]
- if @md \
- and defined? @md.fn \
- and @md.fn # used for multilingual
- if @md.cmd =~ /[hH]/
- ft << @md.fn[:html]
- end
- if @md.cmd =~ /w/ \
- and @md.cmd !~ /[hH]/
- ft << @md.fn[:concordance]
- end
- if @md.cmd =~ /y/ \
- and @md.cmd !~ /[hH]/
- ft << @md.fn[:manifest]
- end
- if @md.cmd =~ /[at]/; ft << @md.fn[:plain]
- end
- if @md.cmd =~ /b/; ft << @md.fn[:xhtml]
- end
- if @md.cmd =~ /e/; ft << @md.fn[:epub]
- end
- if @md.cmd =~ /g/; ft << @md.fn[:wiki]
- end
- if @md.cmd =~ /i/; ft << @md.fn[:manpage]
- end
- if @md.cmd =~ /N/; ft << @md.fn[:digest]
- end
- if @md.cmd =~ /o/; ft << @md.fn[:odf]
- end
- if @md.cmd =~ /O/; ft << @md.fn[:oai_pmh]
- end
- if @md.cmd =~ /p/; ft << @md.fn[:pdf_l] << @md.fn[:pdf_p]
- end
- if @md.cmd =~ /s/; ft << @md.fns
- end
- if @md.cmd =~ /S/; ft << @md.fn[:sisupod] << '.kdi'
- end
- if @md.cmd =~ /x/; ft << @md.fn[:sax]
- end
- if @md.cmd =~ /X/; ft << @md.fn[:dom]
- end
- @fnb=@md.fnb
- else # still needed where/when param is not parsed
- if @opt.cmd =~ /[hH]/; ft << '.html' << '.html.??'
- end
- if @opt.cmd =~ /w/ \
- and @opt.cmd !~ /[hH]/
- ft << 'concordance.html' << '??.concordance.html' << 'concordance.??.html'
- end
- if @opt.cmd =~ /y/ \
- and @opt.cmd !~ /[hH]/
- ft << 'sisu_manifest.html' << '??.sisu_manifest.html' << 'sisu_manifest.??.html'
- end
- if @opt.cmd =~ /a/; ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt'
- end
- if @opt.cmd =~ /b/; ft << 'scroll.xhtml' << '??.scroll.xhtml' << 'scroll.??.xhtml'
- end
- if @opt.cmd =~ /e/; ft << @fnb << '.epub'
- end
- if @opt.cmd =~ /g/; ft << 'wiki.txt' << '??.wiki.txt' << 'wiki.??.txt'
- end
- if @opt.cmd =~ /i/; ft << '.1' << '??.man.1' << 'man.??.1'
- end
- if @opt.cmd =~ /N/; ft << 'digest.txt' << '??.digest.txt' << 'digest.??.txt'
- end
- if @opt.cmd =~ /o/; ft << 'opendocument.odt' << '??.opendocument.odt' << 'opendocument.??.odt'
- end
- if @opt.cmd =~ /O/; ft << 'oai_pmh.xml'
- end
- if @opt.cmd =~ /p/; ft << 'landscape.pdf' << 'portrait.pdf' << '.pdf'
- end
- if @opt.cmd =~ /s/; ft << '.sst' << '.ssi' << '.ssm'
- end
- if @opt.cmd =~ /S/; ft << '.zip' << '.kdi'
- end
- if @opt.cmd =~ /x/; ft << 'sax.xml' << '??.sax.xml' << 'sax.??.xml'
- end
- if @opt.cmd =~ /X/; ft << 'dom.xml' << '??.dom.xml' << 'dom.??.xml'
- end
- if @opt.mod.inspect =~ /sxm|sxs|xml/; ft << @fnb << '.sxs.xml'
- end
- if @opt.mod.inspect =~ /sxd/; ft << @fnb << '.sxd.xml'
- end
- if @opt.mod.inspect =~ /sxn/; ft << @fnb << '.sxn.xml'
- end
- end
- ft=ft.uniq
- filetypes=ft.join(',')
- @filetypes=if filetypes !~/..+/; '' # -r called alone, copy all
- elsif @opt.cmd =~/u/; '' # -u added, copy all, (used to create remote directory tree see output path), not the usual function of -u
- elsif filetypes =~/\S+?,\S+/; '*{' + filetypes + '}' # more than one relevant file type
- else '*' + filetypes # one relevant file type
- end
- @source_path=(@fnb && !(@fnb.empty?) \
- ? "#{@env.path.output}/#{@fnb}" \
- : @env.path.output)
- @source_path_epub=(@fnb && !(@fnb.empty?) \
- ? "#{@env.path.output}/epub" \
- : @env.path.output_epub)
- @source_path_src=(@fnb && !(@fnb.empty?) \
- ? "#{@env.path.output}/src" \
- : @env.path.output_src)
- @source_path_pod=(@fnb && !(@fnb.empty?) \
- ? "#{@env.path.output}/pod" \
- : @env.path.output_pod)
- @source_path_harvest=(@fnb && !(@fnb.empty?) \
- ? "#{@env.path.output}/sisu_site_metadata" \
- : @env.path.output_harvest)
- @local_sisu_source=(@filetypes =~/\S/) \
- ? "#{@source_path}/#{@filetypes}" \
- : @source_path
- end
- end
- class Clean_output
- require 'fileutils'
- include FileUtils::Verbose
- def initialize(opt)
- @opt=opt
- z=File_map.new(@opt)
- @zap=z.local_sisu_source
- if @opt.cmd =~ /[hH]/
- @zap=Dir.glob(@zap).join(' ')
- if @opt.cmd !~ /w/; @zap.gsub!(/#{@source_path}\/concordance.html/,'')
- end
- end
- @env=SiSU_Env::Info_env.new
- end
- def zap
- def main_output
- (@zap !~/\/\//) \
- ? (rm_rf(@zap) if FileTest.directory?(@zap)) \
- : (puts 'suspect zap request, ignored')
- end
- def site_map
- if @opt.fnb \
- and not @opt.fnb.empty?
- sm="#{@env.path.output}/sitemaps/sitemap_#{@opt.fnb}.xml"
- rm(sm) if FileTest.file?(sm)
- end
- end
- def epub
- if @opt.fnb \
- and not @opt.fnb.empty?
- sm="#{@env.path.output}/epub/#{@opt.fnb}.epub"
- rm(sm) if FileTest.file?(sm)
- end
- end
- def src # consider
- if @opt.fnb \
- and not @opt.fnb.empty?
- sm="#{@env.path.output}/pod/#{@opt.fns}.zip"
- rm(sm) if FileTest.file?(sm)
- sm="#{@env.path.output}/src/#{@opt.fns}"
- rm(sm) if FileTest.file?(sm)
- end
- end
- self
- end
- end
- class Info_remote_host
- def initialize
- @rc=Get_init.instance.yamlrc
- end
- def remote_host #see Info_remote remote_host_base_general
- r=[]
- r=if (defined? @rc['remote'] \
- and @rc['remote'].class==Array)
- r_array=@rc['remote']
- r_array.each_with_index do |renv,i|
- r[i]={}
- if defined? renv['user'] \
- and defined? renv['host']
- end
- r[i][:user]=renv['user']
- r[i][:host]=renv['host']
- r[i][:path]=if defined? renv['path']
- renv['path']
- else ''
- end
- r[i][:name]="#{r[i][:user]}@#{r[i][:host]}:#{r[i][:path]}"
- end
- r
- elsif (defined? @rc['remote'] \
- and @rc['remote'].class==Hash \
- and defined? @rc['remote']['user'] \
- and defined? @rc['remote']['host'])
- r[0]={}
- r[0][:user]=@rc['remote']['user']
- r[0][:host]=@rc['remote']['host']
- r[0][:path]=if defined? @rc['remote']['path']
- @rc['remote']['path']
- else ''
- end
- r[0][:name]="#{r[0][:user]}@#{r[0][:host]}:#{r[0][:path]}"
- r
- else
- r[0]={}
- r[0][:name]='.'
- r[0][:user]=''
- r[0][:host]=''
- r[0][:path]=''
- #puts "no remote host or user"
- r
- end
- end
- def rhost
- def r1
- (defined? SiSU_Env::Info_remote_host.new.remote_host[0][:name]) \
- ? (SiSU_Env::Info_remote_host.new.remote_host[0][:name]) \
- : nil
- end
- def r2
- (defined? SiSU_Env::Info_remote_host.new.remote_host[1][:name]) \
- ? (SiSU_Env::Info_remote_host.new.remote_host[1][:name]) \
- : nil
- end
- def r3
- (defined? SiSU_Env::Info_remote_host.new.remote_host[2][:name]) \
- ? (SiSU_Env::Info_remote_host.new.remote_host[2][:name]) \
- : nil
- end
- def r4
- (defined? SiSU_Env::Info_remote_host.new.remote_host[3][:name]) \
- ? (SiSU_Env::Info_remote_host.new.remote_host[3][:name]) \
- : nil
- end
- def r5
- (defined? SiSU_Env::Info_remote_host.new.remote_host[4][:name]) \
- ? (SiSU_Env::Info_remote_host.new.remote_host[4][:name]) \
- : nil
- end
- def r6
- (defined? SiSU_Env::Info_remote_host.new.remote_host[5][:name]) \
- ? (@ls + SiSU_Env::Info_remote_host.new.remote_host[5][:name]) \
- : nil
- end
- self
- end
- end
- class Info_remote < File_map
- @@flag_remote=false
- require 'socket'
- def initialize(opt)
- super(opt) #
- @opt=opt
- @rc=Get_init.instance.yamlrc
- end
- def remote_host_base_general
- SiSU_Env::Info_remote_host.new.remote_host
- end
- def remote_host_base
- remote_host_base_general.each do |remote_conn|
- @@flag_remote=true if remote_conn[:name] =~/\S+?@\S+/
- end
- remote_host_base_general
- end
- def scp #sort out later using ruby libraries #not ideal, first time each file is sent, -r must be called separately for subdir to be built
- self.remote_host_base.each do |remote_conn|
- local_gen=@source_path
- remote_gen=case @opt.cmd
- when /u/; "#{remote_conn[:name]}/#{@env.path.stub_pwd}/." #creates remote directory tree, this is not the usual function of u
- when /[abhHNopwxXy]/; "#{remote_conn[:name]}/#{@env.path.stub_pwd}/#{@fnb}/."
- else "#{remote_conn[:name]}/#{@env.path.stub_pwd}/."
- end
- local_epub=@source_path_epub
- local_src=@source_path_src
- local_pod=@source_path_pod
- remote_epub="#{remote_conn[:name]}/#{@env.path.stub_epub}/."
- remote_src="#{remote_conn[:name]}/#{@env.path.stub_src}/."
- remote_pod="#{remote_conn[:name]}/#{@env.path.stub_pod}/."
- src_txt=@opt.fnc
- src_pod=@opt.fncb.gsub(/(\.ss[mt])(?:\.sst)?$/,'\1.zip')
- if (local_gen =~/\S/ \
- and local_gen !~/\/\//) \
- and (remote_gen =~/\S/ \
- and remote_gen !~/\/\//) \
- and @@flag_remote==true \
- and @opt.cmd !~/U/
- System_call.new(local_gen,remote_gen).scp
- if FileTest.file?("#{local_src}/#{src_txt}")
- System_call.new("#{local_src}/#{src_txt}",remote_src).scp
- end
- if FileTest.file?("#{local_pod}/#{src_pod}")
- System_call.new("#{local_src}/#{src_pod}",remote_pod).scp
- end
- if FileTest.file?("#{local_epub}/#{@opt.fnb}.epub")
- System_call.new("#{local_epub}/#{@opt.fnb}.epub",remote_epub,@opt.cmd).scp
- end
- elsif @opt.cmd =~/U/
- puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
- puts "#{local_gen} -> #{remote_gen}"
- if FileTest.file?("#{local_src}/#{src_doc}")
- puts "#{local_src}/#{src_doc}* -> #{remote_src}"
- end
- if FileTest.file?("#{local_pod}/#{src_doc}.zip")
- puts "#{local_pod}/#{src_doc}* -> #{remote_pod}"
- end
- else
- puts 'suspect scp request, ignored'
- puts "#{local_gen} -> #{remote_gen} remote flag: #{@@flag_remote}"
- puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
- end
- end
- end
- def rsync
- self.remote_host_base.each do |remote_conn|
- local_gen=@source_path
- local_gen_image="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image"
- local_gen_image_external="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image_external"
- remote_gen="#{remote_conn[:name]}/#{@env.path.stub_pwd}/."
- remote_images="#{remote_conn[:name]}/#{@env.path.stub_pwd}/_sisu/image/."
- remote_images_external="#{remote_conn[:name]}/#{@env.path.stub_pwd}/_sisu/image_external/."
- local_epub=@source_path_epub
- local_src=@source_path_src
- local_pod=@source_path_pod
- remote_epub="#{remote_conn[:name]}/#{@env.path.stub_epub}/."
- remote_src="#{remote_conn[:name]}/#{@env.path.stub_src}/."
- remote_pod="#{remote_conn[:name]}/#{@env.path.stub_pod}/."
- src_txt=@opt.fnc
- src_pod=@opt.fncb.gsub(/(\.ss[mt])(?:\.sst)?$/,'\1.zip')
- if (local_gen =~/\S/ \
- and local_gen !~/\/\//) \
- and (remote_gen =~/\S/ \
- and remote_gen !~/\/\//) \
- and @@flag_remote==true \
- and @opt.cmd !~/U/
- delete_extra_files='--delete' # '--delete-after'
- System_call.new(local_gen,remote_gen,@opt.cmd).rsync(delete_extra_files)
- if FileTest.file?("#{local_src}/#{src_txt}")
- System_call.new("#{local_src}/#{src_txt}",remote_src,@opt.cmd).rsync
- if defined? @md.ec[:image] and not @md.ec[:image].empty?
- images="#{local_gen_image}/" + @md.ec[:image].join(" #{local_gen_image}/")
- System_call.new(images,remote_images,@opt.cmd).rsync
- images_external="#{local_gen_image_external}/" + @md.ec[:image].join(" #{local_gen_image_external}/")
- System_call.new(images_external,remote_images_external,@opt.cmd).rsync
- end
- end
- if FileTest.file?("#{local_epub}/#{@opt.fnb}.epub")
- System_call.new("#{local_epub}/#{@opt.fnb}.epub",remote_epub,@opt.cmd).rsync
- end
- if FileTest.file?("#{local_pod}/#{src_pod}")
- System_call.new("#{local_pod}/#{src_pod}",remote_pod,@opt.cmd).rsync
- end
- elsif @opt.cmd =~/U/
- puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
- puts "#{local_gen} -> #{remote_gen}"
- if FileTest.file?("#{local_src}/#{src_doc}") \
- or FileTest.file?("#{local_src}/#{src_doc}.zip")
- puts "#{local_src}/#{src_doc}* -> #{remote_src}"
- end
- else
- puts 'suspect rsync request, ignored'
- puts "#{local_gen} -> #{remote_gen} remote flag: #{@@flag_remote}"
- puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
- end
- end
- end
- def scp_base #base site
- self.remote_host_base.each do |remote_conn|
- local=@source_path
- remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/."
- if defined? @rc['permission_set']['remote_base_site'] \
- and @rc['permission_set']['remote_base_site'] \
- and @@flag_remote==true \
- and @opt.cmd !~/U/
- puts "begin scp_base: #{local} -> #{remote}"
- System_call.new("#{local}/#{@env.path.style}/",remote).scp
- elsif @opt.cmd =~/U/
- puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
- puts "begin scp_base: #{local} -> #{remote}"
- puts "#{local}/#{@env.path.style}/ -> #{remote}"
- else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
- end
- end
- end
- def scp_base_all #base site
- self.remote_host_base.each do |remote_conn|
- local=@source_path
- remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/."
- if defined? @rc['permission_set']['remote_base_site'] \
- and @rc['permission_set']['remote_base_site'] \
- and @@flag_remote==true \
- and @opt.cmd !~/U/
- puts "begin scp_base_all: #{local} -> #{remote}"
- System_call.new("#{local}/_sisu/image_sys/",remote).scp
- System_call.new("#{local}/_sisu/image/",remote).scp
- System_call.new("#{local}/#{@env.path.style}/",remote).scp
- elsif @opt.cmd =~/U/
- puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
- puts "scp_base_all: #{local} -> #{remote}"
- puts "#{local}/_sisu/image_sys/ -> #{remote}"
- puts "#{local}/_sisu/image/ -> #{remote}"
- puts "#{local}/#{@env.path.style}/ -> #{remote}"
- else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
- end
- end
- end
- def rsync_base #base site
- ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu"
- image_sys="#{@env.path.webserv}/_sisu/image_sys"
- images="#{@env.path.webserv}/_sisu/image"
- self.remote_host_base.each do |remote_conn|
- remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/."
- remote_conf="#{remote_conn[:name]}/_sisu"
- if defined? @rc['permission_set']['remote_base_site'] \
- and @rc['permission_set']['remote_base_site'] \
- and @@flag_remote==true \
- and @opt.cmd !~/U/
- System_call.new("#{image_sys}","#{remote_conf}").rsync
- System_call.new("#{images}","#{remote_conf}").rsync
- System_call.new("#{ldest}","#{remote}").rsync
- elsif @opt.cmd =~/U/
- puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
- puts "rsync_base: #{local} -> #{remote}"
- puts "#{local}/_sisu/image -> #{remote}"
- puts "#{local}/_sisu/image_sys/ -> #{remote}"
- puts "#{local}/#{@env.path.style}/ -> #{remote}"
- else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
- end
- end
- end
- def rsync_base_sync #base site
- self.remote_host_base.each do |remote_conn|
- local=@source_path
- remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/."
- if defined? @rc['permission_set']['remote_base_site'] \
- and @rc['permission_set']['remote_base_site'] \
- and @@flag_remote==true \
- and @opt.cmd !~/U/
- delete_extra_files='--delete' # '--delete-after'
- puts "begin rsync_base_sync: #{local} -> #{remote}"
- System_call.new("#{local}/_sisu/image_sys/",remote).rsync(delete_extra_files)
- System_call.new("#{local}/_sisu/image/",remote).rsync(delete_extra_files)
- System_call.new("#{local}/#{@env.path.style}/",remote).rsync(delete_extra_files)
- elsif @opt.cmd =~/U/
- puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
- puts "rsync_base_sync: #{local} -> #{remote}"
- puts "#{local}/_sisu/image_sys/ -> #{remote}"
- puts "#{local}/_sisu/image/ -> #{remote}"
- puts "#{local}/#{@env.path.style}/ -> #{remote}"
- else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
- end
- end
- end
- def rsync_sitemaps #sitemap directory
- self.remote_host_base.each do |remote_conn|
- local="#{@source_path}/sitemapindex.xml"
- remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/."
- if @@flag_remote
- delete_extra_files='--delete' # '--delete-after'
- System_call.new(local,remote).rsync(delete_extra_files)
- elsif @opt.cmd =~/U/
- puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
- puts "rsync_sitemaps: #{local} -> #{remote}"
- else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
- end
- end
- end
- def rsync_harvest
- self.remote_host_base.each do |remote_conn|
- local=@source_path_harvest
- remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/."
- if @@flag_remote
- delete_extra_files='--delete' # '--delete-after'
- System_call.new(local,remote).rsync(delete_extra_files)
- elsif @opt.cmd =~/U/
- puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
- puts "rsync_sitemaps: #{local} -> #{remote}"
- else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
- end
- end
- end
- end
- class Info_version <Info_env
- include Singleton
- require 'rbconfig'
- @@lib_path=nil
- def get_version
- @version={}
- @pwd=ENV['PWD']
- yst_ver="#{defaults[:sisu_share]}/#{SiSU_version_dir}/v/version.yml"
- lib_path=@@lib_path ? @@lib_path : `echo $RUBYLIB`.split(':')
- @@lib_path ||=lib_path
- if File.exist?(yst_ver); @version=YAML::load(File::open(yst_ver)) #unless @@noyaml
- end
- @version
- end
- def rbversion
- %x{ruby -v}.strip
- end
- end
- class Create_system_link #< Info_env #revisit problems created 2004w41
- def initialize
- @env=SiSU_Env::Info_env.new
- end
- def images
- unless FileTest.directory?("#{@env.path.output}/_sisu")
- mkdir_p("#{@env.path.output}/_sisu")
- end
- unless File.exist?("#{@env.path.output}/_sisu/image_sys") \
- or File.symlink?("#{@env.path.output}/_sisu/image_sys")
- File.symlink("../../_sisu/image_sys", "#{@env.path.output}/_sisu/image_sys")
- end
- end
- def man_forms
- #File.symlink("../../man/form", "#{@env.path.output}/man/form") unless File.symlink?("#{@env.path.output}/man/form")==true
- end
- def man_pdf
- #File.symlink("../../man/form", "#{@env.path.output}/man/pdf") unless File.symlink?("#{@env.path.output}/man/pdf")==true
- end
- end
- class Info_file < Info_env
- def initialize(fns='')
- @env=SiSU_Env::Info_env.new
- @fns=fns
- end
- def basefilename
- m=/(.+?)\.(?:(?:-|ssm\.)?sst|ssm)$/m
- fnb=@fns[m,1]
- end
- def project
- "#{@env.development}/sisu.lnk"
- end
- def project_info
- "#{@env.datapriv_i}/sisu.er3"
- end
- def project_todo
- "#{@env.development}/todo.txt"
- end
- def admin_self
- "#{@env.path.home}/.corundum/dots.lnk"
- end
- def admin_root
- '/root/.corundum/admin.txt'
- end
- end
- class Info_db < Info_env
- @@rc=nil
- def initialize
- @@pwd ||=Dir.pwd
- @pwd=Dir.pwd
- @env=SiSU_Env::Info_env.new
- m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m
- @pwd_stub=@pwd[m,1]
- @rc=@@rc ||=Get_init.instance.yamlrc
- @defaults=Info_env.new.defaults
- end
- def share_source?
- ((defined? @rc['db']['share_source']) \
- && @rc['db']['share_source']==true) \
- ? @rc['db']['share_source'] \
- : false
- end
- def engine
- def default
- ((defined? @rc['db']['engine']['default']) \
- && @rc['db']['engine']['default']=~/postgresql|sqlite/) \
- ? @rc['db']['engine']['default'] \
- : 'sqlite'
- end
- self
- end
- def psql
- def user
- ((defined? @rc['db']['postgresql']['user']) \
- && @rc['db']['postgresql']['user']=~/\S+/) \
- ? @rc['db']['postgresql']['user'] \
- : @env.user
- end
- def db #db_name
- "#{Db[:name_prefix]}#{@pwd_stub}"
- end
- def port #PGPORT
- ((defined? @rc['db']['postgresql']['port']) \
- && ( @rc['db']['postgresql']['port'] =~/\d+/ \
- || @rc['db']['postgresql']['port'].class==Fixnum)) \
- ? @rc['db']['postgresql']['port'] \
- : (@defaults[:postgresql_port])
- end
- def password
- ((defined? @rc['db']['postgresql']['password']) \
- && @rc['db']['postgresql']['password']=~/\S+/) \
- ? @rc['db']['postgresql']['password'] \
- : ''
- end
- def host
- ((defined? @rc['db']['postgresql']['host']) \
- && @rc['db']['postgresql']['host']=~/(?:\S{1,3}\.){3}\S{1,3}|\S+?\.\S+/) \
- ? @rc['db']['postgresql']['host'] \
- : ''
- end
- def dbi
- (psql.host =~/(?:\S{1,3}\.){3}\S{1,3}|\S+?\.\S+/) \
- ? "DBI:Pg:database=#{psql.db};host=#{psql.host};port=#{psql.port}" \
- : "DBI:Pg:database=#{psql.db};port=#{psql.port}"
- end
- def conn_dbi
- DBI.connect(psql.dbi,psql.user,psql.db)
- end
- self
- end
- def mysql
- def db
- #"#{Db[:name_prefix]}#{@pwd_stub}"
- end
- def port
- '**'
- end
- def dbi
- "dbi:Mysql:database=#{mysql.db};port=#{mysql.port}"
- end
- self
- end
- def sqlite
- def db
- "#{@env.path.webserv}/#{@pwd_stub}/sisu_sqlite.db"
- end
- def dbi
- "DBI:SQLite3:#{sqlite.db}" #sqlite3 ?
- end
- def sqlite3
- sqlite.db #sqlite3 ?
- end
- def conn_dbi
- DBI.connect(sqlite.dbi)
- end
- def conn_sqlite3
- SQLite3::Database.new(sqlite.sqlite3)
- end
- self
- end
- end
- class Info_port < Info_env
- def initialize
- @env=SiSU_Env::Info_env.new
- end
- def webrick
- @env.url.webrick_port
- end
- end
- class Info_program < Info_env #revisit
- attr_accessor :editor,:wc,:tidy,:rexml,:pdflatex,:postgresql,:sqlite
- def initialize
- prog=SiSU_Env::Info_env.new.program
- @editor,@wc,@tidy,@rexml,@pdflatex,@postgresql,@sqlite=prog.text_editor,prog.wc,prog.tidy,prog.rexml,prog.pdflatex,prog.postgresql,prog.sqlite
- end
- end
- class Info_skin
- def initialize(md=nil,skin=nil)
- @md=md
- @d_sk=if skin.class==String ; skin
- elsif defined? md.doc_skin \
- and md.doc_skin
- md.doc_skin
- else nil
- end
- @home,@pwd=ENV['HOME'],ENV['PWD']
- m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m
- @pwd_stub=@pwd[m,1]
- @env=SiSU_Env::Info_env.new
- end
- def select # skin loading logic here
- load "#{SiSU_lib}/defaults.rb"
- skin_path=[]
- @env.sys.rc_path.each{|x| skin_path << "#{x}/skin"}
- skin_path << "#{@env.path.processing}/external_document/skin"
- skin=true
- if @pwd_stub =~/^sisupod$/ \
- and @md.mod.inspect !~/--trust/
- skin=false #security only run skins on sisupod if --trust flag is provided
- end
- doc_skin,dir_skin=nil,nil
- if skin
- unless @d_sk.nil?
- sk_doc="doc/#{@d_sk}.rb"
- skin_path.each do |v| #document skin priority 1
- if FileTest.file?("#{v}/#{sk_doc}")
- doc_skin="#{v}/#{sk_doc}"
- load doc_skin
- break
- end
- end
- end
- unless doc_skin
- sk_dir="dir/skin_#{@pwd_stub}.rb"
- skin_path.each do |v| #directory skin priority 2
- if FileTest.file?("#{v}/#{sk_dir}")
- dir_skin="#{v}/#{sk_dir}"
- load dir_skin
- break
- end
- end
- end
- end
- sk=if doc_skin; doc_skin
- elsif dir_skin; dir_skin
- else nil
- end
- end
- end
- class CSS_default
- def html
- 'html.css'
- end
- def html_tables
- 'html_tables.css'
- end
- def xhtml
- 'xhtml.css'
- end
- def xml_sax
- 'sax.css'
- end
- def xml_dom
- 'dom.css'
- end
- def docbook_xml
- 'docbook.css'
- end
- def homepage
- 'homepage.css'
- end
- def harvest
- 'harvest.css'
- end
- end
- class CSS_select < Info_env
- def initialize(md)
- @md=md
- @env=SiSU_Env::Info_env.new
- end
- def html
- css=if @md.doc_css \
- and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_html.css")
- "#{@md.doc_css}_html.css"
- elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_html.css")
- "#{@env.path.stub_pwd}_html.css"
- else CSS_default.new.html
- end
- end
- def html_tables
- css=if @md.doc_css \
- and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_html_tables.css")
- "#{@md.doc_css}_html_tables.css"
- elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_html_tables.css")
- "#{@env.path.stub_pwd}_html_tables.css"
- else CSS_default.new.html_tables
- end
- end
- def xhtml
- css=if @md.doc_css \
- and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_xhtml.css")
- "#{@md.doc_css}_xhtml.css"
- elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_xhtml.css")
- "#{@env.path.stub_pwd}_xhtml.css"
- else CSS_default.new.xhtml
- end
- end
- def xml_sax
- css=if @md.doc_css \
- and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_xml_sax.css")
- "#{@md.doc_css}_xml_sax.css"
- elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_xml_sax.css")
- "#{@env.path.stub_pwd}_xml_sax.css"
- else CSS_default.new.xml_sax
- end
- end
- def xml_dom
- css=if @md.doc_css \
- and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_xml_dom.css")
- "#{@md.doc_css}_xml_dom.css"
- elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_xml_dom.css")
- "#{@env.path.stub_pwd}_xml_dom.css"
- else CSS_default.new.xml_dom
- end
- end
- def docbook_xml
- css=if @md.doc_css \
- and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_docbook.css")
- "#{@md.doc_css}_xml_dom.css"
- elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_docbook.css")
- "#{@env.path.stub_pwd}_docbook.css"
- else CSS_default.new.docbook_xml
- end
- end
- def homepage
- css=if @md.doc_css \
- and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_homepage.css")
- "#{@md.doc_css}_homepage.css"
- elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_homepage.css")
- "#{@env.path.stub_pwd}_homepage.css"
- else CSS_default.new.homepage
- end
- end
- end
- class CSS_stylesheet
- def initialize(md)
- @md=md
- @css=CSS_select.new(@md)
- @env=SiSU_Env::Info_env.new
- end
- def html
- %{ <link rel="stylesheet" href="../#{@env.path.style}/#{@css.html}" type="text/css" />}
- end
- def html_tables
- %{ <link rel="stylesheet" href="../#{@env.path.style}/#{@css.html_tables}" type="text/css" />}
- end
- def xhtml_epub
- %{ <link rel="stylesheet" href="css/xhtml.css" type="text/css" />}
- end
- end
- class SiSU_file <Info_env #todo unify with Create_file
- def initialize(md,fno='')
- begin
- @fno,@fns,@fnb=fno,md.fns,md.fnb
- @env=SiSU_Env::Info_env.new(@fns)
- @env_out="#{@env.path.output}/#{@fnb}"
- rescue; STDERR.puts SiSU_Screen::Ansi.new(@cmd,$!,$@).rescue
- ensure
- end
- end
- def make_file(path,filename)
- if File.writable?("#{path}/."); File.new("#{path}/#{filename}",'w+')
- else SiSU_Screen::Ansi.new('',"is the file or directory writable?, could not create #{filename}").warn
- end
- end
- def touch_file(path,filename)
- if File.writable?("#{path}/.");
- system("touch #{path}/#{filename}")
- else SiSU_Screen::Ansi.new('',"is the file or directory writable?, could not create #{filename}").warn
- end
- end
- def make_path(path)
- mkdir_p(path) unless FileTest.directory?(path)
- end
- def mkdir_initialize # not used but consider using
- mkdir_p(@env.path.output) unless FileTest.directory?(@env.path.output)
- mkdir_p("#{@env.path.output}/#{@fnb}") unless FileTest.directory?("#{@env.path.output}/#{@fnb}")
- mkdir_p("#{@env.path.output}/#{@env.path.style}") unless FileTest.directory?("#{@env.path.output}/#{@env.path.style}")
- mkdir_p(@env.path.dal) unless FileTest.directory?(@env.path.dal)
- mkdir_p(@env.path.tune) unless FileTest.directory?(@env.path.tune)
- end
- def mkdir
- dir=@env.path.output
- txt_path="#{dir}/#{@fnb}"
- mkdir_p(dir) unless FileTest.directory?(dir)
- mkdir_p(txt_path) unless FileTest.directory?(txt_path)
- mkdir_p("#{dir}/#{@env.path.style}") unless FileTest.directory?("#{dir}/#{@env.path.style}")
- mkdir_p(@env.path.dal) unless FileTest.directory?(@env.path.dal)
- mkdir_p(@env.path.tune) unless FileTest.directory?(@env.path.tune)
- end
- def mkfile #consider using more
- path="#{@env.path.output}/#{@fnb}"
- filename=@fno
- file=make_file(path,filename)
- end
- def mkfile_man
- path="#{@env.path.output}/man"
- make_path(path)
- filename=@fno
- file=make_file(path,filename)
- end
- def mkfile_pwd
- path=Dir.pwd
- filename=@fno
- file=make_file(path,filename)
- end
- end
- class Create_file <Info_env #todo unify with SiSU_file
- def initialize(cmd,fns,operation='')
- @cmd=cmd
- begin
- super(fns)
- @env=SiSU_Env::Info_env.new(fns)
- ver=Info_version.instance
- if operation.class.inspect =~/SiSU_Param/
- @md=operation
- end
- case operation #watch
- when /pdf/; @env_out=''
- when /sql/
- when /xml|plaintext|ascii/; @env_out="#{@env.path.output}/#{@fnb}" #check change of name to plaintext from ascii
- else
- if defined? @md.sfx_src \
- and @md.sfx_src =~/ss[ftsumc]/
- @env_suf='lm'
- @env_out_root=@env.path.output
- @env_out="#{@env.path.output}/#{@fnb}"
- @env_tex=@env.path.tex
- @env_lout=@env.path.lout
- @@publisher='SiSU http://www.jus.uio.no/sisu'
- @env_pdf="#{@env_out_root}/pdf"
- end
- end
- rescue; STDERR.puts SiSU_Screen::Ansi.new(@cmd,$!,$@).rescue
- ensure
- end
- end
- def param_instantiate
- @cX||=SiSU_Screen::Ansi.new(@cmd)
- @@date=Info_date.new
- @@proc=@@filename_txt=@@filename_texinfo=@@filename_lout_portrait=@@filename_lout_landscape=@@filename_html_scroll=@@filename_html_index=@@filename_html_segtoc=@@filename_semantic=@@filename_rss=@@newfile=@@drr=@@yaml=@@yamladdr=nil
- @@publisher='SiSU scribe'
- end
- def marshal
- def dal_content
- "#{@env.path.dal}/#{@fns}.content.rbm"
- end
- def dal_idx_sst_rel_html_seg
- "#{@env.path.dal}/#{@fns}.idx_sst.rbm"
- end
- def dal_idx_sst_rel
- "#{@env.path.dal}/#{@fns}.idx_tex.rbm"
- end
- def dal_idx_html
- "#{@env.path.dal}/#{@fns}.idx_html.rbm"
- end
- def dal_idx_xhtml
- "#{@env.path.dal}/#{@fns}.idx_xhtml.rbm"
- end
- def dal_metadata
- "#{@env.path.dal}/#{@fns}.metadata.rbm"
- end
- def dal_map_nametags
- "#{@env.path.dal}/#{@fns}.map_name_tags.rbm"
- end
- def dal_map_ocn_htmlseg
- "#{@env.path.dal}/#{@fns}.map_ocn_htmlseg.rbm"
- end
- self
- end
- def html_root
- #@env.path.output
- end
- def mkdir_pdf
- Dir.mkdir(@env.path.tex) unless FileTest.directory?(@env.path.tex)
- end
- def file_generic(output_file='')
- filename="#{@env.path.output}/#{@fnb}/#{output_file}"
- File.new(filename,'w+')
- end
- def file_error
- File.new('/tmp/errorlog.sisu','w+')
- end
- def file_txt
- File.new("#{@env.path.dal}/#{@fns}.txt",'w+')
- end
- def file_debug
- File.new("#{@env.path.dal}/#{@fns}.debug.txt",'w+')
- end
- def file_meta
- File.new("#{@env.path.dal}/#{@fns}.meta",'w+')
- end
- def file_meta_idx_html
- File.new("#{@env.path.dal}/#{@fns}.idx.html",'w+')
- end
- def file_note
- File.new("#{Dir.pwd}/#{@fns}.fn",'w+')
- end
- def meta
- "#{@env.path.dal}/#{@fns}.meta"
- end
- def file_tune
- File.new("#{@env.path.tune}/#{@fns}.tune",'w+')
- end
- def marshal_tune
- "#{@env.path.tune}/#{@fns}.marshal_tune"
- end
- def file_semantic
- filename_semantic="./semantic.yaml"
- @@filename_semantic=File.new(filename_semantic,'w+')
- end
- def file_rss
- filename_rss="./semantic.xml"
- @@filename_rss=File.new(filename_rss,'w+')
- end
- def file_html_scroll(md)
- filename_scroll="#{@env.path.output}/#{md.fnb}/#{md.fnl[:pre]}doc#{md.fnl[:mid]}.html#{md.fnl[:post]}"
- @@filename_html_scroll=File.new(filename_scroll,'w+')
- end
- def file_html_index(md)
- filename_index="#{@env.path.output}/#{md.fnb}/#{md.fnl[:pre]}index#{md.fnl[:mid]}.html#{md.fnl[:post]}"
- @@filename_html_index=File.new(filename_index,'w+')
- end
- def file_html_segtoc(md)
- filename_segtoc="#{@env.path.output}/#{md.fnb}/#{md.fnl[:pre]}toc#{md.fnl[:mid]}.html#{md.fnl[:post]}"
- File.new(filename_segtoc,'w+')
- end
- def epub
- @pth=@env.path.epub
- def xhtml_index
- filename_index="#{@pth}/OPS/index.xhtml"
- File.new(filename_index,'w+')
- end
- def xhtml_segtoc
- filename_segtoc="#{@pth}/OPS/toc.xhtml"
- File.new(filename_segtoc,'w+')
- end
- def mimetype #fixed application/epub+zip ~/grotto/theatre/dbld/builds/epub_sample/mimetype
- File.new("#{@pth}/mimetype",'w')
- end
- def metadata #variable matadata ~/grotto/theatre/dbld/builds/epub_sample/metadata.opf
- File.new("#{@pth}/OPS/epb.opf",'w')
- end
- def toc_ncx #variable toc ~/grotto/theatre/dbld/builds/epub_sample/toc.ncx
- File.new("#{@pth}/OPS/epb.ncx",'w')
- end
- def metainf_cont #variable content ~/grotto/theatre/dbld/builds/epub_sample/META-INF/container.xml
- File.new("#{@pth}/META-INF/container.xml",'w')
- end
- def xhtml_css #fixed epub xhtml css
- File.new("#{@pth}/OPS/css/xhtml.css",'w')
- end
- self
- end
- def file_texinfo
- File.new("#{@env.path.texinfo}/#{@fnb}.texinfo",'w+')
- end
- end
- class Create_site < Info_env
- require "#{SiSU_lib}/css" # css.rb
- include SiSU_Style
- def initialize(cmd)
- @cmd=cmd
- @env=SiSU_Env::Info_env.new
- @home,@pwd=ENV['HOME'],ENV['PWD'] #@pwd=Dir.pwd
- @rc=Get_init.instance.yamlrc
- @vz=SiSU_Env::Get_init.instance.skin
- @vz_home=SiSU_Viz::Home.new
- end
- def homepage
- homepage_path=nil
- @env.sys.rc_path.each do |v|
- if FileTest.file?("#{v}/home/index.html")
- homepage_path="#{v}/home/index.html"
- break
- end
- end
- mkdir_p("#{@env.path.webserv}/#{@env.path.stub_pwd}") unless FileTest.directory?("#{@env.path.webserv}/#{@env.path.stub_pwd}")
- if homepage_path \
- and FileTest.file?(homepage_path)
- cp(homepage_path,"#{@env.path.webserv}/#{@env.path.stub_pwd}/index.html")
- cp(homepage_path,"#{@env.path.webserv}/#{@env.path.stub_pwd}/toc.html")
- else
- doc_skin=nil
- sk_doc='doc/skin_sisu.rb'
- @env.sys.rc_path.each do |v| #document skin priority 1
- if FileTest.file?("#{v}/skin/#{sk_doc}")
- doc_skin="#{v}/skin/#{sk_doc}"
- load doc_skin
- break
- end
- end
- filename_homepage=File.new("#{@env.path.webserv}/#{@env.path.stub_pwd}/index.html",'w')
- filename_homepage_toc=File.new("#{@env.path.webserv}/#{@env.path.stub_pwd}/toc.html",'w')
- filename_homepage << @vz_home.homepage
- filename_homepage_toc << @vz_home.homepage
- end
- end
- def html_seg_title_banner?
- ((defined? @rc['html']['seg_title_banner']) \
- && @rc['html']['seg_title_banner']==true) \
- ? @rc['html']['seg_title_banner'] \
- : false
- end
- def html_quick_ref?
- ((defined? @rc['html']['quick_ref']) \
- && @rc['html']['quick_ref']==true) \
- ? @rc['html']['quick_ref'] \
- : false
- end
- def cp_images(src_path,dest_path)
- if FileTest.directory?(src_path)
- cd(src_path)
- source=Dir.glob("*.{png,jpg,gif,ico}")
- mkdir_p(dest_path) unless FileTest.directory?(dest_path)
- chmod(0755,dest_path)
- source.each do |i|
- cp_r(i,"#{dest_path}/#{i}")
- chmod(0644,"#{dest_path}/#{i}")
- end
- cd(@pwd)
- else puts "\tWARN, did not find - #{src_path}"
- end
- end
- def cp_local_images
- src="#{@pwd}/_sisu/image"
- dest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image"
- cp_images(src,dest)
- end
- def cp_external_images
- src="#{@env.path.processing}/external_document/image"
- dest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image_external"
- cp_images(src,dest)
- end
- def cp_webserver_images
- src=@env.path.image_source
- dest="#{@env.path.webserv}/_sisu/image"
- cp_images(src,dest)
- end
- def cp_webserver_images_local #this should not have been necessary
- src=@env.path.image_source
- dest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image"
- cp_images(src,dest)
- end
- def cp_base_images #fix images
- src="#{@env.path.share}/image"
- dest="#{@env.path.webserv}/_sisu/image_sys"
- cp_images(src,dest)
- end
- def cp_css
- mkdir_p("#{@env.path.output}/#{@env.path.style}") unless FileTest.directory?("#{@env.path.output}/#{@env.path.style}")
- css_path=['/etc/sisu/css',"#{@home}/.sisu/css","#{@pwd}/_sisu/css"] #BROKEN
- if defined? @rc['permission_set']['css_modify'] \
- and @rc['permission_set']['css_modify']
- SiSU_Screen::Ansi.new(@cmd,"modify is css set to: #{@rc['permission_set']['css_modify']}").warn if @cmd=~/[MV]/
- css_path.each do |x|
- if FileTest.directory?(x)
- cd(x)
- source=Dir.glob("*.{css}")
- source.each do |i|
- cp(i,"#{@env.path.output}/#{@env.path.style}")
- end
- cd(@pwd)
- end
- end
- else SiSU_Screen::Ansi.new(@cmd,"modify css is not set or is set to: false").warn if @cmd=~/[MV]/
- end
- fn_css=SiSU_Env::CSS_default.new
- css=SiSU_Style::CSS.new
- path_style="#{@env.path.output}/#{@env.path.style}"
- mkdir_p(path_style) unless FileTest.directory?(path_style)
- style=File.new("#{path_style}/#{fn_css.homepage}",'w')
- style << css.homepage
- style.close
- style=File.new("#{path_style}/#{fn_css.html_tables}",'w')
- style << css.html_tables
- style.close
- style=File.new("#{path_style}/#{fn_css.html}",'w')
- style << css.html
- style.close
- style=File.new("#{path_style}/#{fn_css.xml_sax}",'w')
- style << css.xml_sax
- style.close
- style=File.new("#{path_style}/#{fn_css.xml_dom}",'w')
- style << css.xml_dom
- style=File.new("#{path_style}/#{fn_css.docbook_xml}",'w')
- style << css.docbook_xml
- style.close
- style=File.new("#{path_style}/#{fn_css.xhtml}",'w')
- style << css.xhtml
- style=File.new("#{path_style}/#{fn_css.harvest}",'w')
- style << css.harvest
- style.close
- end
- end
-end
-module SiSU_Screen
- require "#{SiSU_lib}/screen_text_color" # screen_text_color.rb
-end
-module SiSU_Errors
- require "#{SiSU_lib}/errors" # errors.rb
-end
-__END__
-https? intro check 2007-09-22
-
-fns_array=unless fns =~/\.ssm.sst$/
- if RUBY_VERSION < '1.9'
- IO.readlines(fns,'')
- else IO.readlines(fns,'r:utf-8')
- end
-else
- if RUBY_VERSION < '1.9'
- IO.readlines("#{path.composite_file}/#{fns}",'')
- else IO.readlines("#{path.composite_file}/#{fns}",'r:utf-8')
- end
-end
diff --git a/lib/sisu/v2/texpdf.rb b/lib/sisu/v2/texpdf.rb
deleted file mode 100644
index 6503c931..00000000
--- a/lib/sisu/v2/texpdf.rb
+++ /dev/null
@@ -1,830 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: LaTeX generation
-
-=end
-module SiSU_TeX
- require 'pstore'
- require "#{SiSU_lib}/defaults" # defaults.rb
- include SiSU_Viz
- require "#{SiSU_lib}/particulars" # particulars.rb
- include SiSU_Particulars
- require "#{SiSU_lib}/texpdf_format" # texpdf_format.rb
- include SiSU_TeX_Pdf
- require "#{SiSU_lib}/shared_metadata" # shared_metadata.rb
- @tex_file=@@tex_footnote_array=@@tex_col_w=[]
- @@tabular="{tabular}"
- @@column_instruct=@@squigle_close=@@tex_line_mode=@@tex_word_mode=@@line_mode=''
- @@tex_debug_counter=@@table_pagebreak_counter=@@tex_footnote_call_counter=@@tex_table_flag=@@tex_counter=@@tex_column=@@tex_columns=@@tex_columns=@@counting=0
- @@tex_pattern_margin_number=/\\\\begin\\\{tiny\\\}\\\\hspace\\\{0mm\\\}\\\\end\\\{tiny\\\}\\\{\\\\marginpar.+?\s+/
- @@n=@@tableheader=@@rights=nil
- @@date ||=SiSU_Env::Info_date.new
- class Source
- require 'pstore'
- require "#{SiSU_lib}/sysenv" # sysenv.rb
- include SiSU_Env
- include SiSU_Viz
- require "#{SiSU_lib}/dal" # dal.rb
- include SiSU_DAL
- include SiSU_TeX
- def initialize(opt)
- @opt=opt
- @particulars=SiSU_Particulars::Combined_singleton.instance.get_all(opt)
- @md=@particulars.md
- @env=@particulars.env
- end
- def directories
- begin
- @dir_out_root=@env.path.output
- case @opt.fns
- when /\.(?:-|ssm\.)?sst$/
- SiSU_Env::SiSU_file.new(@md).mkdir
- Dir.mkdir(@env.path.tex) unless FileTest.directory?(@env.path.tex)
- end
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- end
- end
- def read
- song
- end
- def song
- begin
- @md=@particulars.md
- SiSU_Screen::Ansi.new(@opt.cmd,'LaTeX/PDF',@md.fns).green_title_hi unless @opt.cmd =~/q/
- if @opt.cmd =~/[MVv]/
- path=@env.url.output_tell
- SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.program.pdf_viewer} #{path}/#{@md.fnb}/#{@md.fn[:pdf_l]}").flow
- SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.program.pdf_viewer} #{path}/#{@md.fnb}/#{@md.fn[:pdf_p]}").flow
- end
- @md=@particulars.md
- SiSU_Env::Create_file.new(@opt.cmd,@opt.fns)
- $flag=@md.cmd #introduced to pass 0 for no object citation numbers... to texpdf_format
- @dir_o="#{@env.path.output}/#{@opt.fnb}"
- directories
- #% needed needs to be reprogrammed !!!
- SiSU_Env::Info_skin.new(@md).select
- dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here
- SiSU_TeX::Source::LaTeX_create.new(@particulars).songsheet
- dal_array=''
- pwd=Dir.pwd
- SiSU_TeX::Source::LaTeX_to_pdf.new(@md,@particulars.env).latexrun_selective
- Dir.chdir(pwd)
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- unless @opt.cmd =~/[MV]/ #check maintenance flag
- texfiles=Dir["#{@env.path.tex}/#{@opt.fns}*"]
- texfiles.each do |f|
- if FileTest.file?(f)
- File.unlink(f)
- end
- end
- end
- @tex_file=@@tex_footnote_array=[]
- @@column_instruct=''
- @@squigle_close=@@tex_line_mode=@@tex_word_mode=@@line_mode=''
- @@tex_debug_counter=@@table_pagebreak_counter=@@tex_footnote_call_counter=@@tex_table_flag=@@tex_counter=@@tex_column=@@tex_columns=@@tex_columns=@@counting=0
- @@tex_col_w=[]
- @@n=@@tableheader=@@rights=nil
- @@date=SiSU_Env::Info_date.new
- @@flag={}
- $flag=1 #remove at some stage
- SiSU_Env::Create_file.new(@opt.cmd,@opt.fns).param_instantiate
- end
- end
- private
- class LaTeX_to_pdf
- require 'fileutils'
- include FileUtils #::Verbose
- @@n_lpdf||=0 #change
- def initialize(md,env)
- @md,@env=md,env
- end
- def latex_do(texfilename,papersize)
- @texfilename=texfilename
- @@n_lpdf=@@n_lpdf+1
- SiSU_Screen::Ansi.new(@md.cmd,"#{papersize} portrait ->").dark_grey_title_hi if @md.cmd =~/[MVv]/
- tex_fn_base=@texfilename.gsub(/\.tex$/,'')
- cmd=SiSU_Env::System_call.new("#{tex_fn_base}.tex",'',@md.cmd)
- tell=SiSU_Screen::Ansi.new(@md.cmd)
- tell.grey_open if @md.cmd =~/[MVv]/
- if "#{tex_fn_base}" =~/\w+/ \
- and "#{papersize}" =~/\w+/
- 2.times { |i| cmd.latex2pdf(@md,papersize) }
- end
- tell.p_off if @md.cmd =~/[MVv]/
- SiSU_Screen::Ansi.new(@md.cmd,"#{papersize} landscape ->").dark_grey_title_hi if @md.cmd =~/[MVv]/
- cmd=SiSU_Env::System_call.new("#{tex_fn_base}.landscape.tex",'',@md.cmd)
- tell.grey_open if @md.cmd =~/[MVv]/
- if "#{tex_fn_base}" =~/\w+/ \
- and "#{papersize}" =~/\w+/
- 2.times { |i| cmd.latex2pdf(@md,papersize) }
- end
- tell.p_off if @md.cmd =~/[MVv]/
- pwd=Dir.pwd
- portrait_pdf="#{pwd}/#{tex_fn_base}.pdf"
- landscape_pdf="#{pwd}/#{tex_fn_base}.landscape.pdf"
- case papersize
- when /a4/; pdf_p=@md.fn[:pdf_p_a4]; pdf_l=@md.fn[:pdf_l_a4]
- when /a5/; pdf_p=@md.fn[:pdf_p_a5]; pdf_l=@md.fn[:pdf_l_a5]
- when /b5/; pdf_p=@md.fn[:pdf_p_b5]; pdf_l=@md.fn[:pdf_l_b5]
- when /letter/; pdf_p=@md.fn[:pdf_p_letter]; pdf_l=@md.fn[:pdf_l_letter]
- when /legal/; pdf_p=@md.fn[:pdf_p_legal]; pdf_l=@md.fn[:pdf_l_legal]
- else pdf_p=@md.fn[:pdf_p_a4]; pdf_l=@md.fn[:pdf_l_a4]
- end
- if FileTest.file?(portrait_pdf)
- cp(portrait_pdf,"#{@dir_sisu}/#{@md.fnb}/#{pdf_p}")
- rm(portrait_pdf)
- else p "#{__FILE__}:#{__LINE__} NOT FOUND: #{portrait_pdf}" if @md.cmd.inspect =~/M/
- end
- if FileTest.file?(landscape_pdf)
- cp(landscape_pdf,"#{@dir_sisu}/#{@md.fnb}/#{pdf_l}")
- rm(landscape_pdf)
- else p "#{__FILE__}:#{__LINE__} NOT FOUND: #{landscape_pdf}" if @md.cmd.inspect =~/M/
- end
- SiSU_Screen::Ansi.new(@md.cmd,@@n_lpdf,'processed (SiSU LaTeX to pdf - using pdfetex aka. pdftex or pdflatex)').generic_number if @md.cmd =~/[MVv]/
- end
- def latexrun_selective
- begin
- pwd=Dir.pwd
- Dir.chdir(pwd) #watch
- @tex_f_no=0
- info={}
- if FileTest.file?(@env.source_file_with_path)
- @md.papersize_array.each do |ps|
- if @md.fns =~/\.(?:-|ssm\.)?sst$/
- @dirout=SiSU_Env::Info_env.new(@md.fns)
- case @md.fns
- when /\.(?:-|ssm\.)?sst$/
- if FileTest.directory?(@env.path.tex)==true
- Dir.chdir(@env.path.tex)
- @dir_sisu=@dirout.path.output
- texfile=@md.fns.gsub(/$/,".#{ps}.tex")
- texfile=texfile.gsub(/~/,'-')
- if File.exist?(texfile) \
- and File.size(texfile) > 0
- @tex_f_no+=1
- #p "#{__FILE__}:#{__LINE__} texpdf generation disabled" if @md.cmd.inspect =~/M/ #%% disable temporarily, re-enable
- latex_do(texfile,ps)
- else
- puts "\tzero file size #{@env.path.tex}/#{texfile}"
- end
- end
- end
- end
- end
- outputdir="#{@dir_sisu}/#{@md.fnb}"
- case @md.papersize_array[0] #default pdf
- when /a4/; pdf_p=@md.fn[:pdf_p_a4]; pdf_l=@md.fn[:pdf_l_a4]
- when /a5/; pdf_p=@md.fn[:pdf_p_a5]; pdf_l=@md.fn[:pdf_l_a5]
- when /b5/; pdf_p=@md.fn[:pdf_p_b5]; pdf_l=@md.fn[:pdf_l_b5]
- when /letter/; pdf_p=@md.fn[:pdf_p_letter]; pdf_l=@md.fn[:pdf_l_letter]
- when /legal/; pdf_p=@md.fn[:pdf_p_legal]; pdf_l=@md.fn[:pdf_l_legal]
- else pdf_p=@md.fn[:pdf_p_a4]; pdf_l=@md.fn[:pdf_l_a4]
- end
- if FileTest.file?("#{outputdir}/#{pdf_p}")
- system("
- cd #{outputdir}
- rm portrait.pdf
- ln -s #{pdf_p} portrait.pdf
- ")
- end
- if FileTest.file?("#{outputdir}/#{pdf_l}")
- system("
- cd #{outputdir}
- rm landscape.pdf
- ln -s #{pdf_l} landscape.pdf
- ")
- end
- else
- SiSU_Screen::Ansi.new(@md.cmd,"FILE NOT FOUND: << #{@md.fns} >> - requested latex system processing skipped").warn
- end
- lst=Dir["*.{aux,log,out}"]
- lst.each {|file| File.unlink(file)} if lst
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error
- end
- end
- end
- class LaTeX_create
- @@tex_head={
- 'a4'=> {:p => nil, :l => nil},
- 'a5'=> {:p => nil, :l => nil},
- 'b5'=> {:p => nil, :l => nil},
- 'letter'=>{:p => nil, :l => nil},
- 'legal'=> {:p => nil, :l => nil},
- 'book'=> {:p => nil, :l => nil}
- }
- @@prefix_b=nil
- def initialize(particulars)
- @particulars=particulars
- @md=@particulars.md
- @env=@particulars.env
- @data=@particulars.dal_array # dal file drawn here
- @st={ :tex=>{} }
- @tex_ml=SiSU_TeX_Pdf::Use_TeX.new(@md)
- @vz=SiSU_Env::Get_init.instance.skin
- @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern
- @brace_url=SiSU_Viz::Skin.new.url_decoration
- vz=SiSU_Env::Get_init.instance.skin
- @skin_no_ocn=if defined? vz.ocn_display_off \
- and vz.ocn_display_off==true
- true
- else false
- end
- end
- def songsheet
- begin
- data=@data
- @@tex_footnote_array=[]
- @@rights=nil
- SiSU_Screen::Ansi.new(@md.cmd,"pdfTex portrait & landscape").txt_grey if @md.cmd=~/[MVvz]/
- if defined? @md.rights.all \
- and not @md.rights.all.empty?
- rght=@md.rights #.author.dup #dup is necessary, else contents of :rights changed
- sp_char=SiSU_TeX_Pdf::Special_characters.new(@md,rght.copyright.all)
- copymark=@md.author_copymark \
- ? '{\begin{small}\copyright\end{small}} ' \
- : ''
- copymark='Copyright {\begin{small}\copyright\end{small}} '
- copyright=sp_char.special_characters_safe.gsub(/^\s*Copyright \(C\)/, copymark)
- @@rights||="\n #{Tex[:backslash]*2}[3]\\ \\linebreak #{copyright}"
- end
- if defined? @md.notes.prefix_b \
- and not @md.notes.prefix_b.empty?
- sp_char=SiSU_TeX_Pdf::Special_characters.new(@md,@md.notes.prefix_b)
- prefix_b=sp_char.special_characters_safe
- @@prefix_b="\n #{Tex[:backslash]*2}[3]\\ \\linebreak \\ #{prefix_b}\n" unless @@prefix_b
- end
- data=pre(data)
- data=footnote(data)
- if @md.flag_tables #WORK ON 2009
- data=tables(data) #uncomment to start experimenting with tables
- end
- ocn=if @md.markup.inspect =~/no_ocn/ \
- or @md.mod.inspect =~/--no-ocn/ \
- or @skin_no_ocn
- false
- else true
- end
- data=number_paras(data)
- data=markup(data)
- output(data)
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error
- ensure
- end
- end
- protected
- def pre(data)
- @tex_file=[]
- data.each do |dob|
- # DEBUG 2003w16 this is a kludge, because i could not get parameters
- # from param, Sort out ... revert to more elegant solution
- # even more of a kludge as had to insert newlines where code is used not satisfactory, think about
- dob.tmp=dob.obj #.dup
- if dob.is=='para' \
- or dob.is=='heading'
- dob.tmp.gsub!(/#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}/,'')
- dob.tmp=SiSU_TeX_Pdf::Special_characters.new(@md,dob.tmp).special_characters
- if dob.tmp =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/
- dob.tmp=SiSU_TeX_Pdf::Format_text_object.new(@md,dob.tmp).url_str_internal(dob.tmp)
- end
- elsif dob.is =='code'
- dob.tmp=SiSU_TeX_Pdf::Special_characters.new(@md,dob.tmp).special_characters_code
- elsif dob.is =='break'
- if dob.obj==Mx[:br_page]; dob.tmp='\newpage'
- elsif dob.obj==Mx[:br_page_new]; dob.tmp='\clearpage'
- elsif dob.obj==Mx[:obj_ln_sep]; dob.tmp='\parasep'
- end
- elsif dob.is=='comment' \
- or dob.is=='meta'
- dob.tmp='' #dob.tmp=nil
- end
- end
- data
- end
- def footnote(data)
- data.each do |dob|
- # EMBEDDED FOOTNOTES / ENDNOTES should be straightforward but not quite a synch.
- if dob.tmp =~/#{Mx[:en_a_o]}[\d*+]+\s|#{Mx[:en_b_o]}([*+]\d+)\s/
- dob.tmp.gsub!(/#{Mx[:en_a_o]}(\d+)\s+(.+?)#{Mx[:en_a_c]}/m,"\\footnote[\\1]{%\n \\2} ")
- dob.tmp.gsub!(/#{Mx[:en_b_o]}([*+]\d+)\s+(.+?)#{Mx[:en_b_c]}/m,"\\FootnoteA{\\1}{%\n \\2} ")
- dob.tmp.gsub!(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)#{Mx[:en_a_c]}/m,"\\FootnoteA{\\1}{%\n \\2} ")
- end
- end
- data
- end
- def tables_hash(md,dob)
- @block={}
- @dob=dob
- @md.papersize_array.each do |ps|
- @@tableheader={ ps => { :p => 0, :l => 0 }}
- dob.tmp={:tmp =>dob.tmp,:paper_size =>ps}
- format_l=SiSU_TeX_Pdf::Format_text_object.new(md,dob)
- dob.tmp={:tmp =>dob.tmp,:paper_size =>ps}
- format_p=SiSU_TeX_Pdf::Format_text_object.new(md,dob)
- @block[ps]={
- :l => format_l.longtable_landscape,
- :p => format_p.longtable_portrait
- }
- end
- @dob.tmp=@block
- @dob
- end
- def tables(data)
- @tex_file=[]
- data.each do |dob|
- @tex_file << if dob.class==String \
- or dob.class==Hash; dob
- elsif dob.is=='table'
- tables_hash(@md,dob) #Hash result
- else dob
- end
- end
- @tex_file
- end
- def enclose(dob)
- dob
- end
- def markup_common(dob)
- tex_f=nil
- txt_obj={:dal =>dob}
- if dob.of=='group'
- @lineone=case dob.is
- when /alt|group|verse/
- dob.tmp.gsub!(/#{Mx[:nbsp]}/m,'{~}')
- dob.tmp.gsub!(/#{Mx[:gl_bullet]}/m,'$\txtbullet$\hspace{\enspace}') #Bullet environment not used for grouped text, ∴ no hanging indent here
- dob.tmp.gsub!(/#{Mx[:br_nl]}+/m,"\n\n") #match not ideal, but currently not inserting extra newlines anyway
- ocn=SiSU_TeX_Pdf::Format_text_object.new(@md).ocn_display(dob)
- dob.tmp=if dob.is=='group' \
- or dob.is=='alt'
- ocn \
- + @tex_ml.paraskip_small \
- + "\n" \
- + ' \\begin{footnotesize}' \
- + "\n\n" \
- + dob.tmp \
- + '\\end{footnotesize}' \
- + "\n" \
- + @tex_ml.paraskip_normal
- elsif dob.is=~/verse/
- ocn \
- + @tex_ml.paraskip_tiny \
- + "\n" \
- + ' \\begin{footnotesize}' \
- + "\n\n" \
- + dob.tmp \
- + '\\end{footnotesize}' \
- + "\n" \
- + @tex_ml.paraskip_normal \
- + "\n\\linebreak\n"
- end
- dob
- when /code/
- sp_char=SiSU_TeX_Pdf::Special_characters.new(@md,dob.tmp,dob.is)
- dob.tmp=sp_char.special_characters_safe
- dob.tmp.gsub!(/#{Mx[:nbsp]}/,'{~}') #dob.tmp.gsub!(/#{Mx[:nbsp]}\s*/,'{~}')
- dob.tmp.gsub!(/#{Mx[:vline]}/m,'\vline')
- dob.tmp.gsub!(/ \\( |#{Mx[:br_nl]})/,' {\textbackslash}\1')
- dob.tmp.gsub!(/#{Mx[:br_nl]}\s*\Z/m,'')
- dob.tmp.gsub!(/#{Mx[:br_nl]}{2}/,'\newline \\\\\\ ')
- dob.tmp.gsub!(/#{Mx[:br_nl]}/,' \\\\\\ ')
- dob.tmp.gsub!(/\n\n\n/m," \\newline\n\n")
- ocn=SiSU_TeX_Pdf::Format_text_object.new(@md).ocn_display(dob)
- dob.tmp = ocn \
- + @tex_ml.paraskip_small \
- + '\begin{Codeblock}' \
- + dob.tmp \
- + ' \end{Codeblock}' \
- + "\n" \
- + @tex_ml.paraskip_normal
- dob
- else 'error' #should never occur
- end
- if dob.tmp =~/<=curly/ #takes care of escaped curly braces, expand
- sp_char=SiSU_TeX_Pdf::Special_characters.new(@md,dob)
- dob.tmp=sp_char.special_characters_curly(dob.tmp)
- end
- dob=enclose(dob) unless dob.tmp =~/^$/
- dob
- else
- tst=SiSU_TeX_Pdf::Format_text_object.new(@md,dob)
- case dob.is
- when 'heading'
- case dob.ln
- when 1..3
- tst.heading_major
- when 4
- tst.level4
- when 5
- tst.level5
- when 6
- tst.level6
- else dob
- end
- when 'heading_insert'
- br="\n\\\\\n"
- if dob.name=='book_index'
- h=tst.heading_major
- heading="\\clearpage\n" + h.tmp
- idx_arr=[]
- idx=SiSU_Particulars::Combined_singleton.instance.get_idx_tex(@md.opt).tex_idx
- idx.each do |x|
- x=if x.class==String
- x=SiSU_TeX_Pdf::Special_characters.new(@md,x).special_characters
- x=SiSU_TeX_Pdf::Format_text_object.new(@md,x).url_str_internal(x,true)
- else x=nil
- end
- idx_arr << x.sub(/,$/,'') if x.class==String
- end
- idx_str=idx_arr.join(br)
- l=heading + br + idx_str
- p=heading + br +
- '\begin{multicols}{2}' + br +
- idx_str + br +
- '\end{multicols}'
- dob.tmp={:l =>l,:p =>p}
- elsif dob.ln==2 \
- and dob.obj=~/Metadata\b/
- tst.heading_major
- elsif dob.ln==4 \
- and dob.obj=~/Metadata\b/
- h=tst.level4
- metadata=Metadata::TeX_metadata.new(@md).metadata_tex
- dob.tmp=h.tmp + ' ' + '\begin{scriptsize}' + metadata.join(br) + '\end{scriptsize}'
- else dob.tmp='' # dob.tmp={:l =>'',:p =>''}
- end
- when 'para'
- if dob.bullet_
- dob.tmp=tst.bullet
- elsif dob.indent \
- and dob.indent =~/[1-9]/
- dob.tmp=tst.indent
- else
- dob.tmp.strip!
- dob=enclose(dob) unless dob.tmp =~/^$/
- end
- else
- dob.tmp.strip!
- dob=enclose(dob) unless dob.tmp =~/^$/
- end
- if dob.class==String
- dob.tmp.gsub!(/\s*(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*/,' \newline ') #% tread with care
- dob.tmp.gsub!(/(\.#{Tex[:tilde]}\S*\s*|<:\S+>|#{Mx[:fa_o]}.*?#{Mx[:fa_c]}|#{Mx[:gr_o]}.*?#{Mx[:gr_c]}|<!.*?!>|<!>)/,' ') #% tread with care
- end
- if dob.tmp =~/<=curly/ #takes care of escaped curly braces, expand
- sp_char=SiSU_TeX_Pdf::Special_characters.new(@md,dob)
- dob.tmp=sp_char.special_characters_curly(dob.tmp)
- end
- dob
- end
- if dob.tmp =~/(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image\b)/m \
- and dob.is !='code'
- dob=SiSU_TeX_Pdf::Bare_urls.new(@md,dob).bare_urls
- tst=SiSU_TeX_Pdf::Format_text_object.new(@md,dob)
- dob=tst.urls_txt_and_images
- dob
- elsif dob.tmp =~/https?:\/\/\S+\b/m \
- and dob.is =='code'
- dob=SiSU_TeX_Pdf::Bare_urls.new(@md,dob).bare_urls_in_code
- dob
- end
- if dob.class !=Hash and dob.tmp =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}image\b/ \
- and dob.is !='code'
- tst=SiSU_TeX_Pdf::Format_text_object.new(@md,dob)
- end
- dob
- end
- def markup(data)
- @tex_file=[]
- md={}
- home=@vz.txt_home.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}|#{Mx[:br_paragraph]}|\\\\/,' - ') #no line splitting in heading neither html nor latex
- title=@md.title.full.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}|#{Mx[:br_paragraph]}|\\\\/,' - ') #no line splitting in heading neither html nor latex
- @md.papersize_array.each do |ps|
- txt_obj={:txt =>"#{home}: - #{title}",:paper_size =>ps,:orientation =>'portrait'}
- orient_portrait=SiSU_TeX_Pdf::Format_head.new(@md,txt_obj)
- txt_obj={:txt =>"#{home}: - #{title}",:paper_size =>ps,:orientation =>'landscape'}
- orient_landscape=SiSU_TeX_Pdf::Format_head.new(@md,txt_obj)
- @@tex_head[ps][:p]=orient_portrait.document_head_with_orientation
- @@tex_head[ps][:l]=orient_landscape.document_head_with_orientation
- end
- @tex_file <<<<WOK
-#{@tex_ml.header}#{@tex_ml.footer}
-\\tolerance=300
-\\clubpenalty=300
-\\widowpenalty=300
-\\makeatother
-\\makeatother
-\\chardef\\txtbullet="2022
-\\chardef\\tilde="7E
-%\\chardef\\asterisk="2A
-\\def\\asterisk{{\\rm \\char42} }
-\\definecolor{Light}{gray}{.92}
-\\newcommand{\\Codeblock}[1]{\\normaltext\\raggedright\\small\\ttfamily\\texbackslash#1}
-\\newcommand{\\monosp}[1]{\\normaltext\\ttfamily\\texbackslash#1}
-\\newcommand{\\parasep}{\\\\ \\begin{center}*\\hspace{2em}*\\hspace{2em}*\\end{center} \\\\}
-\\newcommand{\\hardspace}{{~}}
-%\\newcommand{\\hardspace}{\\hspace{.5em}}
-% \\sloppy
-\\begin{document}
-WOK
- sisu_rc_footnote=if @md.sc_info; @tex_ml.doc_sc_info_footnote_full
- else @tex_ml.doc_sc_info_footnote_brief
- end
- @copymark='' #check and remove as now is superflous
- x={}
- txt_obj={:title =>@md.title.full}
- x[:l]=SiSU_TeX_Pdf::Format_text_object.new(@md,txt_obj).title_landscape
- x[:p]=SiSU_TeX_Pdf::Format_text_object.new(@md,txt_obj).title_portrait
- @tex_file << x
- x=nil
- if defined? @md.creator.author \
- and @md.creator.author
- sp_char=SiSU_TeX_Pdf::Special_characters.new(@md,@md.creator.author)
- author=sp_char.special_characters
- @tex_file << if @md.author_home
- <<WOK
-
-\\author{\\href{#{@md.author_home}}{#{@copymark} \\textnormal{#{author}}}}
-WOK
- else "\n\\author{#{@copymark} \\textnormal{#{author}}}"
- end
- end
- @tex_file << unless @md.fnb =~/^mail\s*$/; @tex_ml.site
- else '\date'
- end
- @tex_file <<<<WOK
-\\pagenumbering{roman}\\maketitle
-\\pagestyle{fancy}
-WOK
- if defined? @md.rights.all \
- and @md.rights.all
- @tex_file << "\\newpage\n"
- @tex_file << @@rights
- @tex_file << @@prefix_b if defined? @md.creator.prefix_b and @md.creator.prefix_b
- end
- x={}
- x[:l] =<<WOK
-#{@tex_ml.newpage('landscape')}
-\\pagestyle{fancy}
-\\tableofcontents
-#{@tex_ml.newpage('landscape')}
-\\pagenumbering{arabic}
-#{@tex_ml.paraskip_normal}
-#{@tex_ml.newpage('landscape')}
-WOK
- x[:p] =<<WOK
-#{@tex_ml.newpage('portrait')}
-\\pagestyle{fancy}
-\\tableofcontents
-#{@tex_ml.newpage('portrait')}
-\\pagenumbering{arabic}
-#{@tex_ml.paraskip_normal}
-#{@tex_ml.newpage('portrait')}
-WOK
- @tex_file << x
- x=nil
- data.each do |dob| #% case follows with levels 1-6 indents & graphics
- if dob.class==Hash
- elsif dob.of=='para' \
- or dob.of=='group' #GATEWAY FIX FIX stuff
- dob=markup_common(dob)
- elsif dob.is=='table'
- if ( dob.tmp['a4'] \
- or dob.tmp['a5'] \
- or dob.tmp['b5'] \
- or dob.tmp['letter'] \
- or dob.tmp['legal'])
- @md.papersize_array.each do |ps|
- if dob.tmp[ps]
- if (dob.tmp[ps][:p] and dob.tmp[ps][:l])
- dob.tmp[ps]={
- :p => markup_common(dob.tmp[ps][:p]),
- :l => markup_common(dob.tmp[ps][:l])
- }
- else p "#{__FILE__}:#{__LINE__}" if @md.cmd.inspect =~/M/
- end
- end
- end
- elsif dob.tmp.class==Hash \
- and (dob.tmp[:p] and dob.tmp[:l])
- dob = {
- :p => markup_common(dob.tmp[:p]),
- :l => markup_common(dob.tmp[:l])
- }
- else p "#{__FILE__}:#{__LINE__}" if @md.cmd.inspect =~/M/
- end
- end
- @tex_file << dob
- end
- @st[:tex][:stmp]||=@md.stmpd
- stamp=@st[:tex][:stmp] if @st[:tex][:stmp]
- if stamp
- use=stamp.gsub(/\n/,"#{Tex[:backslash]*2}\n")
- @tex_file << "\n\\newpage\n"
- @tex_file << "\\section*" +
- "{#{@tex_ml.owner_chapter}}\n" +
- "\\addcontentsline{toc}" +
- "{section}{#{@tex_ml.owner_chapter}}\n"
- @tex_file << "#{use}\n"
- @tex_file << @@rights if @@rights
- end
- @tex_file << "\n\\end{document}"
- end
- def number_paras_numbering(dob) # need tables and other types of object
- if dob.of =~/para/ #\
- paranum=dob.ocn ? dob.ocn : ''
- paranum = '' if paranum.to_i==0
- paranumber_display=if @md.markup.inspect =~/no_ocn/ \
- or @md.mod.inspect =~/--no-ocn/ \
- or not dob.ocn_
- ''
- else
- tags=''
- #[keep] code that follows inserts "name tags" as hypertargets, currently using ocn (converting nametags to ocn) for internal linking, related code: |texpdf_format.rb|@|uses nametags directly|
- #if dob.tags.length > 0 # insert tags "hypertargets"
- # dob.tags.each do |t|
- # tags=tags +"\\hspace{0mm}\\hypertarget{#{t}}{\\hspace{0mm}}"
- # end
- #end
- "\\begin{tiny}\\hspace{0mm}\\end{tiny}{\\marginpar{\\begin{tiny}\\hspace{0mm}\\hypertarget{#{dob.ocn}}{#{dob.ocn}}#{tags}\\end{tiny}}}" #ocn object citation numbering
- end
- dob.tmp = paranumber_display + dob.tmp
- end
- dob
- end
- def number_paras(data)
- tex_file=[]
- data.each do |dob|
- dob=if dob.class==Hash
- if ( dob['a4'] \
- or dob['a5'] \
- or dob['b5'] \
- or dob['letter'] \
- or dob['legal'])
- para_hash={}
- @md.papersize_array.each do |ps|
- if defined? dob.tmp and dob.tmp[ps]
- if (dob.tmp[ps][:p] and dob.tmp[ps][:l])
- para_hash[ps]={
- :p => number_paras_numbering(dob.tmp[ps][:p]),
- :l => number_paras_numbering(dob.tmp[ps][:l])
- }
- dob.tmp=para_hash
- else p "#{__FILE__}:#{__LINE__}" if @md.cmd.inspect =~/M/
- end
- end
- end
- elsif (dob.tmp[:p] and dob.tmp[:l])
- dob.tmp = {
- :p => number_paras_numbering(dob.tmp[:p]),
- :l => number_paras_numbering(dob.tmp[:l])
- }
- else p "#{__FILE__}:#{__LINE__}" if @md.cmd.inspect =~/M/
- end
- else
- dob=if dob.of !~/comment|meta|layout/
- number_paras_numbering(dob)
- else dob
- end
- end
- end
- data
- end
- def output_morph_hash(o)
- ps,h,fn=o[:ps],o[:h],o[:filename]
- if h[ps] \
- and (h[ps][:p] and h[ps][:l])
- h[ps][:p].gsub!(/(?:^[ ]+|[ ]+$)/m,'') if h[ps][:p]
- h[ps][:l].gsub!(/(?:^[ ]+|[ ]+$)/m,'') if h[ps][:l]
- h[ps][:p].gsub!(/\n\n\n+/m,"\n\n") if h[ps][:p]
- h[ps][:l].gsub!(/\n\n\n+/m,"\n\n") if h[ps][:l]
- if h[ps][:p] !~/\A\s*\Z/
- fn[:portrait].puts h[ps][:p],"\n"
- end
- if h[ps][:l] !~/\A\s*\Z/
- fn[:landscape].puts h[ps][:l],"\n"
- end
- elsif (h[:p] and h[:l])
- h[:p].gsub!(/(?:^[ ]+|[ ]+$)/m,'') if h[:p]
- h[:l].gsub!(/(?:^[ ]+|[ ]+$)/m,'') if h[:l]
- h[:p].gsub!(/\n\n\n+/m,"\n\n") if h[:p]
- h[:l].gsub!(/\n\n\n+/m,"\n\n") if h[:l]
- if h[:p] !~/\A\s*\Z/
- fn[:portrait].puts h[:p],"\n"
- end
- if h[:l] !~/\A\s*\Z/
- fn[:landscape].puts h[:l],"\n"
- end
- else p "#{__FILE__}:#{__LINE__}" if @md.cmd.inspect =~/M/
- end
- end
- def output(array)
- array.flatten!
- array.compact!
- @array=array
- fns_l=@md.fns.gsub(/~/,'-') #this is a sorry fix, but necessary as it appears latex programs like not ~
- @md.papersize_array.each do |ps|
- file={
- :landscape =>File.new("#{@env.path.tex}/#{fns_l}.#{ps}.landscape.tex",'w+'),
- :portrait =>File.new("#{@env.path.tex}/#{fns_l}.#{ps}.tex",'w+')
- }
- file[:portrait] << @@tex_head[ps][:p]
- file[:landscape] << @@tex_head[ps][:l]
- array.each do |morph|
- if morph.class==String
- morph.gsub!(/^\s+/,'')
- if morph !~/\A\s*\Z/
- file[:portrait].puts morph,"\n"
- file[:landscape].puts morph,"\n"
- end
- elsif morph.class.inspect =~ /SiSU_document_structure/ \
- and morph.tmp \
- and morph.tmp.class==String
- unless morph.of=='group'
- morph.tmp.gsub!(/^\s+/,'')
- else morph.tmp.gsub!(/^ +/,'')
- end
- if morph.tmp !~/\A\s*\Z/ \
- or morph.is=='code'
- file[:portrait].puts morph.tmp,"\n"
- file[:landscape].puts morph.tmp,"\n"
- end
- elsif morph.class==Hash #inserted headers and the like, only
- h={:ps =>ps,:h =>morph,:filename =>file}
- output_morph_hash(h)
- elsif morph.tmp.class==Hash #tables & images?
- h={:ps =>ps,:h =>morph.tmp,:filename =>file}
- output_morph_hash(h)
- end
- end
- array=@array
- file[:portrait].close
- file[:landscape].close
- end
- @@tex_head={
- 'a4'=> {:p => nil, :l => nil},
- 'a5'=> {:p => nil, :l => nil},
- 'b5'=> {:p => nil, :l => nil},
- 'letter'=>{:p => nil, :l => nil},
- 'legal'=> {:p => nil, :l => nil},
- 'book'=> {:p => nil, :l => nil}
- }
- array=[]
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/v2/update.rb b/lib/sisu/v2/update.rb
deleted file mode 100644
index 21b766e2..00000000
--- a/lib/sisu/v2/update.rb
+++ /dev/null
@@ -1,130 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: update previous output (with similar output file type formats)
-
-=end
-module SiSU_Update_control_flag
- require "#{SiSU_lib}/sysenv" # sysenv.rb
- include SiSU_Env
- include SiSU_Param
- class Check
- def initialize(opt)
- @opt=opt
- @md=SiSU_Param::Parameters.new(@opt).get
- end
- def read
- begin
- @env=SiSU_Env::Info_env.new(@md.fns)
- out=@env.path.output
- base_path="#{out}/#{@md.fnb}"
- SiSU_Screen::Ansi.new(@md.cmd,'Checking previous output',base_path).green_hi_blue unless @md.cmd =~/q/
- Set_CF.new(@md).set_flags
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error
- ensure
- end
- end
- private
- class Set_CF
- def initialize(md)
- @md=md
- @env=SiSU_Env::Info_env.new(@md.fns)
- out=@env.path.output
- @base_path="#{out}/#{@md.fnb}"
- end
- def set_flags #-mNhwpoabxXyv
- flag='-v'
- if FileTest.file?("#{@base_path}/#{@md.fn[:doc]}")==true
- flag=flag + 'a'
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:toc]}")==true \
- or FileTest.file?("#{@base_path}/#{@md.fn[:doc]}")==true
- flag=flag + 'h'
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:xhtml]}")==true
- flag=flag + 'b'
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:sax]}")==true
- flag=flag + 'x'
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:dom]}")==true
- flag=flag + 'X'
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:odf]}")==true
- flag=flag + 'o'
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:pdf_p]}")==true \
- or FileTest.file?("#{@base_path}/#{@md.fn[:pdf_l]}")==true
- flag=flag + 'p'
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:concordance]}")==true
- flag=flag + 'w'
- end
- if FileTest.file?("#{@base_path}/#{@md.fn[:digest]}")==true
- flag=flag + 'N'
- end
- if FileTest.file?("#{@base_path}/#{@md.fns}")==true
- flag=flag + 's'
- end
- if FileTest.file?("#{@base_path}/sisupod.tgz")==true
- flag=flag + 'S'
- end
- puts flag
- flag
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/v2/urls.rb b/lib/sisu/v2/urls.rb
deleted file mode 100644
index d2493edd..00000000
--- a/lib/sisu/v2/urls.rb
+++ /dev/null
@@ -1,279 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: urls for output files
-
-=end
-module SiSU_urls
- require "#{SiSU_lib}/particulars" # particulars.rb
- include SiSU_Particulars
- require "#{SiSU_lib}/sysenv" # sysenv.rb
- include SiSU_Env; include SiSU_Screen
- class Source
- attr_reader :opt
- def initialize(opt)
- @opt=opt
- end
- def read
- begin
- SiSU_urls::Output_urls.new(@opt).songsheet if @opt.fnb #fnb[/.+?\.(?:[_-]?sst|ssm)$/]
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd).error
- ensure
- end
- end
- end
- class Output_urls
- attr_reader :fns,:fnb,:cmd,:dir,:m_regular,:u
- def initialize(opt)
- @opt=opt
- @particulars=SiSU_Particulars::Combined_singleton.instance.get_env_md(opt)
- fn_set_lang=SiSU_Env::Standardise_language.new.file_to_language(@opt.fns)
- @cmd=@opt.cmd
- @md=@particulars.md
- @env=@particulars.env
- @fnb=@env.fnb
- fn_set_lang=SiSU_Env::Standardise_language.new.file_to_language(@opt.fns)
- @fnl=@env.i18n.lang_filename(fn_set_lang[:c])
- @fn=SiSU_Env::Env_call.new(@opt.fns).lang(fn_set_lang[:c])
- @m_regular=/(.+?)\.(?:(?:-|ssm\.)?sst|ssm)$/
- @prog=@env.program
- source=if @opt.fns =~/\.sst$/; @opt.fns
- elsif @opt.fns =~/\.ssm\.sst/; "#{@fnb}.ssm.sst"
- else 'not recognised file'
- end
- @u ||= {
- 'a (Plain-text (footnotes))'=>@fn[:plain],
- 'A (Plain-text (footnotes) dos)'=>@fn[:plain],
- 'b (XHTML)'=>@fn[:xhtml],
- 'D[iu] (DBI import/update postgresql)'=>'dbi psql',
- 'd[iu] (DBI import/update sqlite)'=>'dbi sqlite3',
- 'e (EPUB)'=>@fn[:epub],
- 'h (HTML segmented)'=>@fn[:toc],
- 'H (HTML segmented)'=>@fn[:toc],
- 'h (HTML scroll)'=>@fn[:doc],
- 'H (HTML scroll)'=>@fn[:doc],
- 'I (Info file)'=>'info',
- 'i (manpage)'=>'manpage',
- 'm (Document Abstraction)'=>'dal',
- 'N (Digests md5/sha256)'=>@fn[:digest],
- 'o (ODF:ODT - Open Document)'=>@fn[:odf],
- 'p (PDF landscape)'=>@fn[:pdf_l],
- 'p (PDF portrait)'=>@fn[:pdf_p],
- 'P (Ruby profiler)'=>'profile',
- 's (sisu markup)'=>source,
- 'S (sisupod)'=>@fn[:sisupod],
- 't (Plain-text (endnotes))'=>@fn[:plain],
- 'x (XML sax type)'=>@fn[:sax],
- 'X (XML dom type)'=>@fn[:dom],
- 'y (Manifest, html)'=>@fn[:manifest],
- 'Y (Sitemap, xml)'=>@fn[:sitemap],
- 'w (Concordance, html)'=>@fn[:concordance],
- }.sort {|a,b| a[0].downcase<=>b[0].downcase}
- end
- def songsheet
- begin
- @opt.cmd=~/U/ ? urls_all : (urls_select unless @opt.cmd=~/q/)
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- end
- end
- def urls_maintenance(opt,x,y)
- if x=~/^([abcehHmNoptwxXy])/ \
- and opt.cmd =~/[abcehHmNoptwxXy]/ \
- and x=~/^[#{opt.cmd}]/ \
- and opt.cmd =~/M/
- m=$1
- f=y
- tool=@prog.text_editor
- if x =~/^m/ \
- and @opt.cmd=~/m/ \
- and x=~/^[#{opt.cmd}]/
- SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@env.path.dal}/#{@opt.fns}.meta").maintenance if @opt.cmd =~/[MVv]/
- end
- if x=~/^([hHw])/ \
- and @opt.cmd=~/[hHw]/ \
- and x=~/^[#{@opt.cmd}]/
- f=if x !~/segmented/; "#{y}.html"
- else "#{y}.index.html"
- end
- end
- if x=~/^p/ \
- and @opt.cmd=~/p/ \
- and x=~/^[#{@opt.cmd}]/
- tool=@prog.pdf_viewer
- fns=@opt.fns.gsub(/~/,'-')
- unless @opt.cmd =~/q/
- tell=if y =~/landscape/
- SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@env.path.tex}/#{fns}.landscape.tex")
- else SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@env.path.tex}/#{fns}.tex")
- end
- tell.maintenance if @opt.cmd =~/[MVv]/
- end
- end
- if x=~/^o/ \
- and @opt.cmd=~/o/ \
- and x=~/^[#{@opt.cmd}]/
- tool=@prog.odf_viewer
- end
- if x=~/^e/ \
- and @opt.cmd=~/e/ \
- and x=~/^[#{@opt.cmd}]/
- SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@env.path.epub}/OPS/toc.xhtml").maintenance if @opt.cmd =~/[MVv]/
- end
- if x !~/^[me]/
- SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{tool} #{@env.path.output}/#{@fnb}/#{y}").maintenance if @opt.cmd =~/[MVv]/
- end
- @opt.cmd.gsub!(/#{m}/,'')
- end
- end
- def urls_select
- unless @opt.cmd =~/q/
- i="(output manifest) #{@env.url.output_tell}/#{@fnb}/sisu_manifest.html"
- @opt.cmd=~/[MVvz]/ \
- ? SiSU_Screen::Ansi.new(@opt.cmd,'URLs').grey_title_hi \
- : SiSU_Screen::Ansi.new(@opt.cmd,'URL',i).green_hi_blue
- SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output}/#{@fnb}").flow if @opt.cmd =~/[MVv]/
- end
- m=/.+\/(?:src\/)?(\S+)/im # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m
- @pwd_stub="#{@env.url.output_tell}"[m,1]
- unless @opt.cmd =~/q/
- @u.each do |x,y|
- if @opt.fns =~ @m_regular
- if @opt.cmd =~/[MVv]/
- if x=~/^([abchHNoptwxXyY])/ \
- and @opt.cmd=~/[abchHNoptwxXyY]/ \
- and x=~/^[#{@opt.cmd}]/
- m=$1
- SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.web_browser} #{@env.url.output_tell}/#{@fnb}/#{y}").result
- @opt.cmd.gsub!(/#{m}/,'')
- end
- if x=~/^I/ \
- and @opt.cmd =~/I/
- SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","cd #{@env.path.texinfo}; pinfo ./#{@fnb}.#{y}; cd -").result
- @opt.cmd.gsub!(/I/,'')
- end
- if x=~/^D/ \
- and @opt.cmd =~/D/
- SiSU_Screen::Ansi.new(@opt.cmd,"-#{x} DBI psql","#{@pwd_stub}::#{@opt.fns}",y).result
- @opt.cmd.gsub!(/D/,'')
- end
- if x=~/^d/ \
- and @opt.cmd =~/d/
- SiSU_Screen::Ansi.new(@opt.cmd,"-#{x} DBI sqlite","sqlite3 #{@env.path.output}/sisu_sqlite.db", "#{y}").result
- @opt.cmd.gsub!(/d/,'')
- end
- if x=~/^e/ \
- and @opt.cmd =~/e/
- SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.epub_viewer} #{@env.path.output}/epub/#{y}").result
- @opt.cmd.gsub!(/e/,'')
- end
- if x=~/^i/ \
- and @opt.cmd =~/i/
- SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.manpage_viewer} #{@env.path.manpage}/#{@fnb}.1").result
- @opt.cmd.gsub!(/i/,'')
- end
- if x=~/^P/ \
- and @opt.cmd =~/P/
- SiSU_Screen::Ansi.new(@opt.cmd,"-#{x} Profile","#{@pwd_stub}::#{@opt.fns}",y).result
- @opt.cmd.gsub!(/P/,'')
- end
- if x=~/^s/ \
- and @opt.cmd =~/s/
- SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.web_browser} #{@env.url.output_tell}/src/#{y}").result
- @opt.cmd.gsub!(/s/,'')
- end
- if x=~/^S/ \
- and @opt.cmd =~/S/
- zipfile=if @opt.fns =~/\.ssm\.sst$/; y.gsub(/(?:\~\S{2,3})?(\.ssm\.sst\.zip)$/,'.ssm.zip')
- else y.gsub(/(?:\~\S{2,3})?(\.sst\.zip)$/,'\1')
- end
- SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.web_browser} #{@env.url.output_tell}/pod/#{y}").result
- @opt.cmd.gsub!(/S/,'')
- end
- end
- urls_maintenance(@opt,x,y) if @opt.cmd =~/[MV]/
- end
- end
- end
- end
- def urls_all
- i="(output manifest) #{@env.url.output_tell}/#{@fnb}/sisu_manifest.html"
- SiSU_Screen::Ansi.new(@opt.cmd,'URLs',i).grey_title_hi
- @u.each do |x,y|
- tell=case x
- when /^m/
- SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} ~#{y}/#{@fnb}.#{y}")
- when /^[abBcdhNopswxXy]/
- tellx=SiSU_Screen::Ansi.new(@opt.cmd,"-p (LaTeX)","#{@prog.text_editor} ~work/tex_rz/#{@fnb}.tex") if y=~/landscape/
- SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.web_browser} #{@env.url.output_tell}/#{@fnb}/#{y}")
- when /^e/
- SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.epub_viewer} #{@env.path.output}/epub/#{y}")
- when /^Y/
- SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.web_browser} #{@env.url.output_tell}/sitemap/#{y}")
- when /^I/
- SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","cd #{@env.path.texinfo}; pinfo ./#{@fnb}.#{y}; cd -")
- when /^i/
- SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.manpage_viewer} #{@env.path.manpage}/#{@fnb}.1")
- end
- unless @opt.cmd =~/q/
- tellx.result if tellx
- tell.result if tell
- end
- tellx=nil
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/v2/webrick.rb b/lib/sisu/v2/webrick.rb
deleted file mode 100644
index ff228a65..00000000
--- a/lib/sisu/v2/webrick.rb
+++ /dev/null
@@ -1,176 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: webrick share - note sisu by default does not link with file
- suffixes, see man pages for options
-
-=end
-def brick(port,get='')
- cgidir=if get=~/pwd/; Dir.pwd
- else '/usr/lib/cgi-bin' # @env.path.cgi
- end
- port=SiSU_Env::Info_port.new.webrick
- begin
- s=HTTPServer.new(
- :Port => port,
- :DocumentRoot => Dir::pwd + '/htdocs',
- :CGIPathEnv => ENV['PATH']
- )
- cgi_dir=File.expand_path(cgidir)
- @mount.each { |x,y| # mount subdirectories
- s.mount(x, HTTPServlet::FileHandler, y, true)
- }
- s.mount('/cgi-bin', HTTPServlet::FileHandler, cgi_dir, {:FancyIndexing=>true})
- trap("INT"){ s.shutdown }
- s.start
- rescue; SiSU_Errors::Info_error.new($!,$@,'-W',nil).error #fix
- ensure
- end
-end
-begin #%
- require 'webrick'
- include WEBrick
- require 'time'
- require 'fileutils'
- include FileUtils
- require "#{SiSU_lib}/sysenv" # sysenv.rb
- include SiSU_Env; include SiSU_Screen
- @cX=SiSU_Screen::Ansi.new('yes').cX
- @env=SiSU_Env::Info_env.new
- port=SiSU_Env::Info_port.new
- @argv=$*
- @host=@env.url.webrick
- host='localhost'
- @port="#{@argv[0].to_i}"
- @port="#{port.webrick}" if @port =~ /^0$/
- @serve=[]
- Dir.foreach(@env.path.webserv) do |x|
- if x !~/^\./ \
- and FileTest.directory?("#{@env.path.webserv}/#{x}")
- @serve << x
- end
- end
- @mount=[]
- @serve.each {|x| @mount << ["/#{x}", "#{@env.path.webserv}/#{x}"]}
- @pwd=Dir.pwd
- @week=Time.now.strftime(%{%Yw%W})
- puts "\n"
- @mount.each { |x,y|
- puts " #{@cX.cyan}#{x}#{@cX.off}\t#{@cX.grey}see#{@cX.off} #{@cX.blue}#{@host}:#{@port}#{x}/wb.cgi#{@cX.off} #{@cX.ruby}@#{@cX.off} #{@cX.blue}#{@host}:#{@port}#{x}/#{@cX.off}"
- }
- puts "#{@cX.grey}"
- wb_s2=[]
- #% writes file wb.cgi to shared directories ...
- #% wb_top
- wb_top=%q(#!/usr/bin/env ruby
- # * arch-tag: webrick info on environment, mounted directories, and contents of pwd
- require 'time'
- require 'cgi'
- require 'fcgi'
- ls=Dir.entries('./')
- dir_contents=[]
- ls.each { |x| dir_contents << "<a href=\"./#{x}/\">#{x}</a><br>" unless x =~/^(\.)+$/ }
- dir_contents=dir_contents.sort.join(' ')
- #host=ENV['HOSTNAME']
- #host=%x{echo $HOSTNAME}
- )
- wb_s1=<<WOK
-
- page=CGI.new "html3"
- page.out {
- page.html {
- page.head { page.title {"#{@host} Webrick Report"} } +
- page.body {
- page.h1 {"Webrick #{@host}"} +
- page.p {"Webrick is Ruby's built in webserver."} +
- page.center {"Host name: " + page.b{"#{@host} "} + "(#{@host}) port: " + page.b{"#{@port}"}} +
- page.center {"#{Time.now}"} +
- page.center {"#{Time.now.strftime(%{%Yw%W})}"} +
- page.p {''} +
- page.p {''} +
- page.p {page.b{"Webrick Served Directories: "}} +
-WOK
- #% wb_s2 (mounts)
- @mount.each do |x,y| wb_s2 <<<<WOK
- page.p {page.b{'<a href="#{@host}:#{@port}#{x}/">#{x}</a> '} + '<a href="#{@host}:#{@port}#{x}/">#{@host}:#{@port}#{x}</a> (mounts: #{y}/) <a href="#{@host}:#{@port}#{x}/wb.cgi">info (wb.cgi)</a>'} +
-WOK
-end
- #% wb_end
- wb_end=<<WOK
- page.p {page.b{"Contents of PWD (see URL): "}} +
- page.p {"#\{dir_contents}"}
- }
- }
- }
-WOK
- @mount.each { |x,y| #% wb puts
- puts y
- filename=File.new("#{y}/wb.cgi",'w')
- filename << wb_top
- filename << wb_s1
- filename << wb_s2
- filename << wb_end
- filename.close
- chmod(0755,"#{y}/wb.cgi &") if FileTest.file?("#{y}/wb.cgi &")
- }
- puts " #{@cX.off}"
- get=@argv.shift if @argv[0] =~/pwd/ #% argv
- brick(@port,get)
-rescue;
- require "#{SiSU_lib}/sysenv" # sysenv.rb
- SiSU_Errors::Info_error.new($!,$@,'-W',nil).error #fix
-ensure
-end
-__END__
diff --git a/lib/sisu/v2/air.rb b/lib/sisu/v4/air.rb
index abe0ee6c..47c0f0ba 100644
--- a/lib/sisu/v2/air.rb
+++ b/lib/sisu/v4/air.rb
@@ -1,4 +1,4 @@
-# coding:utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -31,11 +32,9 @@
If you have Internet connection, the latest version of the GPL should be
available at these locations:
<http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/copyleft/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -57,10 +56,7 @@
=end
module SiSU_Air
- require "#{SiSU_lib}/particulars" # particulars.rb
- #require "#{SiSU_lib}/defaults" # defaults.rb
- #require "#{SiSU_lib}/sysenv" # sysenv.rb
- #require "#{SiSU_lib}/param" # param.rb
+ require_relative 'particulars' # particulars.rb
class Source
@@dal_array=[]
@@fns=nil
diff --git a/lib/sisu/v2/author_format.rb b/lib/sisu/v4/author_format.rb
index dee83eb6..36d956b7 100644
--- a/lib/sisu/v2/author_format.rb
+++ b/lib/sisu/v4/author_format.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -31,11 +32,9 @@
If you have Internet connection, the latest version of the GPL should be
available at these locations:
<http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/copyleft/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -56,7 +55,7 @@
** Description: system environment, resource control and configuration details
=end
-module FORMAT
+module SiSU_FormatAuthor
class Author
def initialize(author_param)
@author_param=author_param
@@ -65,19 +64,19 @@ module FORMAT
@authors,@author_array=[],[]
authors=@author_param.scan(/[^;]+/)
authors.each do |a|
- a.strip!
+ a=a.strip
if a =~/"(.+?)"/
- @authors << { :the => $1 }
+ @authors << { the: $1 }
@author_array << $1.upcase
else #if a =~/,/
x=a.scan(/[^,]+/)
- x[0].strip!
- x[1].strip! if x[1]
+ x[0]=x[0].strip
+ x[1]=x[1].strip if x[1]
if x.length==1
- @authors << { :the => x[0] }
+ @authors << { the: x[0] }
@author_array << x[0].upcase
elsif x.length==2
- @authors << { :the=> x[0], :others => x[1] }
+ @authors << { the: x[0], others: x[1] }
@author_array << "#{x[0].upcase}, #{x[1]}"
else #p x.length
end
@@ -101,11 +100,11 @@ module FORMAT
end
end
{
- :last_first_a => authors,
- :last_first_format_a => @author_array,
- :authors_h => @authors,
- :authors_s => authors_string,
- :authors_param => @author_param
+ last_first_a: authors,
+ last_first_format_a: @author_array,
+ authors_h: @authors,
+ authors_s: authors_string,
+ authors_param: @author_param
}
end
end
diff --git a/lib/sisu/v2/cgi.rb b/lib/sisu/v4/cgi.rb
index d9bbc9ed..b6653f51 100644
--- a/lib/sisu/v2/cgi.rb
+++ b/lib/sisu/v4/cgi.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -58,25 +57,24 @@
=end
module SiSU_CGI #% database building documents
- require "#{SiSU_lib}/sysenv" # sysenv.rb
- require "#{SiSU_lib}/cgi_pgsql" # cgi_pgsql.rb
- include SiSU_CGI_pgsql
- require "#{SiSU_lib}/cgi_sqlite" # cgi_sqlite.rb
- class SiSU_search
+ require_relative 'sysenv' # sysenv.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 #verify @opt.files[0].class
+ @webserv=@opt.files[0].to_s.strip
end
def search_info
a=%{
For help on sisu search, type:
sisu --help search
- }
- SiSU_Screen::Ansi.new(@opt.cmd,a).print_grey
+ }
+ SiSU_Screen::Ansi.new(@opt.cmd,a).print_grey
end
def read
- SiSU_CGI_sqlite::SiSU_search_sqlite.new(@opt,@webserv).sqlite
- SiSU_CGI_pgsql::SiSU_search_pgsql.new(@opt,@webserv).pgsql
+ SiSU_CGI_SQLite::SearchSQLite.new(@opt,@webserv).sqlite
+ SiSU_CGI_PgSQL::SearchPgSQL.new(@opt,@webserv).pgsql
search_info unless @opt.cmd =~/q/
end
end
diff --git a/lib/sisu/v2/cgi_pgsql.rb b/lib/sisu/v4/cgi_pgsql.rb
index 2cac69f6..1264d922 100644
--- a/lib/sisu/v2/cgi_pgsql.rb
+++ b/lib/sisu/v4/cgi_pgsql.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -56,19 +55,19 @@
** Description: generates naive cgi search form for search of sisu database (pgsql sqlite)
=end
-module SiSU_CGI_pgsql #% database building documents
- require "#{SiSU_lib}/sysenv" # sysenv.rb
- require "#{SiSU_lib}/cgi_sql_common" # cgi_sql_common.rb
- include SiSU_CGI_sql
- class SiSU_search_pgsql < SiSU_CGI_common
+module SiSU_CGI_PgSQL #% database building documents
+ require_relative 'sysenv' # sysenv.rb
+ require_relative 'cgi_sql_common' # cgi_sql_common.rb
+ include SiSU_CGI_SQL
+ class SearchPgSQL < CGI_Common
def initialize(opt,webserv)
@opt,@webserv=opt,webserv
- @env=SiSU_Env::Info_env.new('',opt)
- @sys=SiSU_Env::System_call.new
+ @env=SiSU_Env::InfoEnv.new('',opt)
+ @sys=SiSU_Env::SystemCall.new
@image_src="#{@env.url.webserv_cgi}/_sisu/image_sys"
- @common=SiSU_CGI_sql::SiSU_CGI_common.new(@webserv,@opt.cmd,@image_src,@env)
- @db=SiSU_Env::Info_db.new
- @cgi_file_name="#{Db[:name_prefix_db]}pgsql.cgi"
+ @common=SiSU_CGI_SQL::CGI_Common.new(@webserv,@opt,@image_src,@env)
+ @db=SiSU_Env::InfoDb.new
+ @cgi_file_name="#{Db[:name_prefix_db]}by_#{opt.dir_structure_by.to_s}_pgsql.cgi"
end
def pgsql
serve=[]
@@ -76,13 +75,13 @@ module SiSU_CGI_pgsql
available_db_table=`psql --list` # system call requires psql
available_db=available_db_table.scan(/(#{Db[:name_prefix]}\S+)/) if not available_db_table.nil?
if available_db \
- and available_db.class==Array
+ and available_db.is_a?(Array)
available_db.flatten.each do |x|
serve << x.gsub(/#{Db[:name_prefix]}(\S+)/,'\1')
end
- else put "WARNING: no postgresql database available, (have you created one?)"
+ else STDERR.puts "WARNING: no postgresql database available, (have you created one?)"
end
- serve.sort!
+ serve=serve.sort
f1,f2,f3='','',''
serve.each do |x|
f1 << %{ <option value="#{Db[:name_prefix]}#{x}">#{x}</option>\n} unless x =~/apache|sisu\/image/ #check
@@ -95,7 +94,7 @@ module SiSU_CGI_pgsql
f2 << " end\n"
if FileTest.writable?('.')
output=File.open(@cgi_file_name,'w')
- output << header0 << header1 << header_desc << header2 << f1 << buttons1 << buttons1_pgsql << buttons2 << search_request << search_statement << search_statement_common << search_query1 << @common.pages << search_query2 << @common.tail << @common.main1 << f2 << dbi_connect << @common.main2
+ output << header0 << header1 << header_desc << header2 << f1 << buttons1 << buttons1_pgsql << buttons2 << search_request << search_statement << search_statement_common << search_query1 << @common.pages << search_query2 << @common.tail << @common.main1 << f2 << dbi_connect << @common.main2 << @common.dir_structure << @common.main3
a=%{ generated sisu_pgsql.cgi,
BASED ON ALREADY EXISTING directories that could potentially be used to populate postgresql db, (-D)
}
@@ -115,7 +114,7 @@ module SiSU_CGI_pgsql
a="postgresql db used for present directory: #{@db.psql.db}"
b="\n\t(to create and populate postgresql database see 'man sisu' and in particular the -D flag)\n\t[the database to be used for this directory (#{@db.psql.db}) will have to be created manually if it does not exist,\n\tsee 'sisu --help sql'\n\tif you have permission to create databases:\n\t'sisu -d --createdb'\n\tor using postgresql tools directly:\n\t'createdb #{@db.psql.db}'\n\tfor a list of existing databases try 'psql --list']"
SiSU_Screen::Ansi.new(@opt.cmd,a,b).txt_cyan
- else puts 'failed in attempt to write sisu_pgsql.cgi to present directory, is directory writable?'
+ else puts 'failed in attempt to write #{@cgi_file_name} to present directory, is directory writable?'
end
end
def header0
@@ -140,23 +139,23 @@ module SiSU_CGI_pgsql
end
def search_statement
<<-'WOK_SQL'
- class Dbi_search_string
+ class DBI_SearchString
def initialize(l,t,q,cse=false)
@l,@t,@q,@c=l,t,q,cse
end
def string
- search={ :search => [],:flag => false }
+ search={ search: [], flag: false }
if @t =~/\S+/ or @q =~/\S+/
- if @t =~/\S+/; unescaped_search=CGI.unescape(@t)
- elsif @q =~/\S+/; unescaped_search=CGI.unescape(@q)
+ if @t =~/\S+/ then unescaped_search=CGI.unescape(@t)
+ elsif @q =~/\S+/ then unescaped_search=CGI.unescape(@q)
end
search_construct=[]
- if @c
- unescaped_search.gsub!(/\s*(AND|OR)\s*/,"' \) \\1 #{@l}~\( '")
- unescaped_search.gsub!(/(.+)/,"#{@l}~\( '\\1' \)")
+ unescaped_search=if @c
+ unescaped_search.gsub(/\s*(AND|OR)\s*/,"' \) \\1 #{@l}~\( '").
+ gsub(/(.+)/,"#{@l}~\( '\\1' \)")
else
- unescaped_search.gsub!(/\s*(AND|OR)\s*/,"' \) \\1 #{@l}~*\( '")
- unescaped_search.gsub!(/(.+)/,"#{@l}~*\( '\\1' \)")
+ unescaped_search.gsub(/\s*(AND|OR)\s*/,"' \) \\1 #{@l}~*\( '").
+ gsub(/(.+)/,"#{@l}~*\( '\\1' \)")
end
search_construct << unescaped_search
search_construct=search_construct.join(' ')
@@ -171,13 +170,11 @@ module SiSU_CGI_pgsql
end
def search_query1
<<-'WOK_SQL'
- @search_text,@search_endnotes=[],[]
- search[:text].flatten.each {|x| @search_text << "#{x} AND " }
- @search_text=@search_text.join.gsub!(/AND\s+$/m,'') #watch
- @search_text.gsub!(/(doc_objects\.clean~[*]?\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+doc_objects\.clean~[*]?\(\s*'[^']+'\s*\))+)/,'(\1)')
- search[:endnotes].flatten.each{|x| @search_endnotes << "#{x} AND " }
- @search_endnotes=@search_endnotes.join.gsub!(/AND\s+$/m,'') #watch
- @search_endnotes.gsub!(/(endnotes\.clean~\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean~\(\s*'[^']+'\s*\))+)/,'(\1)')
+ @search_text,@search_endnotes='',''
+ @search_text=search[:text].flatten.join(' AND ')
+ @search_text=@search_text.gsub(/(doc_objects\.clean~[*]?\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+doc_objects\.clean~[*]?\(\s*'[^']+'\s*\))+)/,'(\1)')
+ @search_endnotes=search[:endnotes].flatten.join(' AND ')
+ @search_endnotes=@search_endnotes.gsub(/(endnotes\.clean~\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean~\(\s*'[^']+'\s*\))+)/,'(\1)')
end
WOK_SQL
end
@@ -186,7 +183,7 @@ module SiSU_CGI_pgsql
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.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.title, metadata_and_text.src_filename, doc_objects.ocn}
+ @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
@@ -194,7 +191,7 @@ module SiSU_CGI_pgsql
def sql_select_endnotes
limit ||=@@limit
offset ||=@@offset
- @sql_statement[:endnotes]=%{SELECT metadata_and_text.title, metadata_and_text.creator_author, metadata_and_text.src_filename, endnotes.body, endnotes.nr, endnotes.ocn, endnotes.metadata_tid FROM metadata_and_text, endnotes WHERE (#{@search_endnotes}) AND metadata_and_text.tid = endnotes.metadata_tid ORDER BY metadata_and_text.title, metadata_and_text.src_filename, endnotes.nr}
+ @sql_statement[:endnotes]=%{SELECT metadata_and_text.title, metadata_and_text.creator_author, metadata_and_text.src_filename, metadata_and_text.language_document_char, endnotes.body, endnotes.nr, endnotes.ocn, endnotes.metadata_tid FROM metadata_and_text, endnotes WHERE (#{@search_endnotes}) AND metadata_and_text.tid = endnotes.metadata_tid ORDER BY metadata_and_text.language_document_char, metadata_and_text.title, metadata_and_text.src_filename, endnotes.nr}
@sql_statement[:range]=%{LIMIT #{limit} OFFSET #{offset} ;}
select=@sql_statement[:endnotes] + ' ' + @sql_statement[:range]
select
diff --git a/lib/sisu/v2/cgi_sql_common.rb b/lib/sisu/v4/cgi_sql_common.rb
index 1b043f00..eb766a4c 100644
--- a/lib/sisu/v2/cgi_sql_common.rb
+++ b/lib/sisu/v4/cgi_sql_common.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -56,10 +55,11 @@
** Description: generates naive cgi search form for search of sisu database (pgsql sqlite)
=end
-module SiSU_CGI_sql
- class SiSU_CGI_common
- def initialize(webserv,cmd,image_src,dir)
- @webserv,@cmd,@image_src,@env=webserv,cmd,image_src,dir
+module SiSU_CGI_SQL
+ class CGI_Common
+ def initialize(webserv,opt,image_src,dir)
+ @webserv,@opt,@image_src,@env=webserv,opt,image_src,dir
+ @cmd=opt.cmd
end
def about
<<-'WOK_SQL'
@@ -78,7 +78,7 @@ module SiSU_CGI_sql
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2012, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -137,7 +137,7 @@ module SiSU_CGI_sql
search_field='' if checked_echo !~/\S/
@base,@search_field,@selected_db,@result_type,@checked_sql_limit,@checked_tip,@checked_stats,@checked_searched,@checked_url,@checked_case,@checked_echo,@checked_sql,@checked_all,@checked_none,@checked_selected,@checked_default,@search_note,@the_can=base,search_field,selected_db,result_type,checked_sql_limit,checked_tip,checked_stats,checked_searched,checked_url,checked_case,checked_echo,checked_sql,checked_all,checked_none,checked_selected,checked_default,search_note,the_can
@tip=if checked_tip =~/\S/
- '<font size="2" color="#666666">text:__; fulltxt:__; keywords:__; title:__; author:__; topic_register:__; subject:__; description:__; publisher:__; contributor:__; date:__; type:__; format:__; identifier:__; source:__; language:__; relation:__; coverage:__; rights:__; comment:__; abstract:__; filename:__;</font><br />'
+ '<font size="2" color="#666666">text:__; fulltxt:__; keywords:__; title:__; author:__; topic_register:__; subject:__; description:__; publisher:__; editor:__; contributor:__; date:__; type:__; format:__; identifier:__; source:__; language:__; relation:__; coverage:__; rights:__; comment:__; abstract:__; filename:__;</font><br />'
else ''
end
end
@@ -229,11 +229,11 @@ module SiSU_CGI_sql
end
def search_request
<<-'WOK_SQL'
- class Search_request #% search_for
- attr_accessor :text1,:fulltext,:keywords,:title,:author,:topic_register,:subject,:description,:publisher,:contributor,:date,:type,:format,:identifier,:source,:language,:relation,:coverage,:rights,:comment,:abstract,:owner,:date_created,:date_issued,:date_modified,:date_available,:date_valid,:filename
+ class SearchRequest #% search_for
+ attr_accessor :text1,:fulltext,:keywords,:title,:author,:topic_register,:subject,:description,:publisher,:editor,:contributor,:date,:type,:format,:identifier,:source,:language,:relation,:coverage,:rights,:comment,:abstract,:owner,:date_created,:date_issued,:date_modified,:date_available,:date_valid,:filename
def initialize(search_field='',q='')
@search_field,@q=search_field,q
- @text1=@fulltext=@keywords=@title=@author=@topic_register=@subject=@description=@publisher=@contributor=@date=@type=@format=@identifier=@source=@language=@relation=@coverage=@rights=@comment=@abstract=@owner=@date_created=@date_issued=@date_modified=@date_available=@date_valid=@filename=''
+ @text1=@fulltext=@keywords=@title=@author=@topic_register=@subject=@description=@publisher=@editor=@contributor=@date=@type=@format=@identifier=@source=@language=@relation=@coverage=@rights=@comment=@abstract=@owner=@date_created=@date_issued=@date_modified=@date_available=@date_valid=@filename=''
if @search_field=~/\S/
@text1=text_to_match('text:')
@fulltext=text_to_match('fulltxt:')
@@ -243,6 +243,7 @@ module SiSU_CGI_sql
@subject=text_to_match('subj(?:ect)?:') # DublinCore 3 - subject
@description=text_to_match('description:') # DublinCore 4 - description
@publisher=text_to_match('pub(?:lisher)?:') # DublinCore 5 - publisher
+ @editor=text_to_match('editor:')
@contributor=text_to_match('contributor:') # DublinCore 6 - contributor
@date=text_to_match('date:') # DublinCore 7 - date dd-mm-yy
@type=text_to_match('type:') # DublinCore 8 - type
@@ -274,6 +275,7 @@ module SiSU_CGI_sql
@subject=q['sj'] if q['sj']=~/\S/
@description=q['dsc'] if q['dsc']=~/\S/
@publisher=q['pb'] if q['pb']=~/\S/
+ @editor=q['cntr'] if q['cntr']=~/\S/
@contributor=q['cntr'] if q['cntr']=~/\S/
@date=q['dt'] if q['dt']=~/\S/
@type=q['ty'] if q['ty']=~/\S/
@@ -290,8 +292,8 @@ module SiSU_CGI_sql
@date_modified=q['dtm'] if q['dtm']=~/\S/
@date_available=q['dta'] if q['dta']=~/\S/
@date_valid=q['dtv'] if q['dtv']=~/\S/
- @filename=if q['doc'] and q['search'] !~/search db/; q['doc']
- elsif q['fns']=~/\S/; q['fns']
+ @filename=if q['doc'] and q['search'] !~/search db/ then q['doc']
+ elsif q['fns']=~/\S/ then q['fns']
end
@@limit=q['ltd'] if q['ltd']=~/\d+/ # 1000
@@offset=q['off'] if q['off']=~/\d+/ # 0
@@ -299,21 +301,19 @@ module SiSU_CGI_sql
end
def text_to_match(identifier='')
m={
- :string => /#{identifier}\s*(.+?)/,
- :string => /#{identifier}\s*(.+?)(?:;|\n|\r|$)/,
- :word => /#{identifier}[\s(]*(\S+)/
+ string: /#{identifier}\s*(.+?)/,
+ string: /#{identifier}\s*(.+?)(?:;|\n|\r|$)/,
+ word: /#{identifier}[\s(]*(\S+)/
}
search_string=if @search_field =~m[:word]
- search_string=if @search_field =~m[:braces]; m[:braces].match(@search_field)[1]
- elsif @search_field =~m[:string]; m[:string].match(@search_field)[1]
+ search_string=if @search_field =~m[:braces] then m[:braces].match(@search_field)[1]
+ elsif @search_field =~m[:string] then m[:string].match(@search_field)[1]
else
str=m[:word].match(@search_field)[1]
- str.gsub!(/[()]/,'')
+ str=str.gsub(/[()]/,'')
str
end
- search_string.strip!
- search_string.gsub!(/\s+/,'+')
- search_string
+ search_string=search_string.strip.gsub(/\s+/,'+')
#else
# "__"
end
@@ -323,119 +323,119 @@ module SiSU_CGI_sql
end
def search_statement_common
<<-'WOK_SQL'
- class Dbi_search_statement
+ class DBI_SearchStatement
attr_reader :text_search_flag,:sql_select_body_format,:sql_select_endnotes_format,:sql_offset,:sql_limit
def initialize(conn,search_for,q,c)
@conn=conn
@text_search_flag=false
- @sql_statement={ :body=>'',:endnotes=>'',:range=>'' }
+ @sql_statement={ body: '', endnotes: '', range: '' }
#@offset||=@@offset
#@offset+=@@limit
- search={ :text => [],:endnotes => [] }
+ search={ text: [], endnotes: [] }
cse=(c =~/\S/) ? true : false
- st=Dbi_search_string.new('doc_objects.clean',search_for.text1,q['s1'],cse).string
- se=Dbi_search_string.new('endnotes.clean',search_for.text1,q['s1'],cse).string
+ st=DBI_SearchString.new('doc_objects.clean',search_for.text1,q['s1'],cse).string
+ se=DBI_SearchString.new('endnotes.clean',search_for.text1,q['s1'],cse).string
@text_search_flag=st[:flag]
if st[:flag]
search[:text] << st[:search]
search[:endnotes] << se[:search]
end
- st=Dbi_search_string.new('metadata_and_text.fulltext',search_for.fulltext,q['ft'],cse).string
+ st=DBI_SearchString.new('metadata_and_text.fulltext',search_for.fulltext,q['ft'],cse).string
if st[:flag]
search[:text] << st[:search]
search[:endnotes] << st[:search]
end
- st=Dbi_search_string.new('metadata_and_text.classify_keywords',search_for.keywords,q['key'],cse).string
+ st=DBI_SearchString.new('metadata_and_text.title',search_for.title,q['ti'],cse).string
if st[:flag]
search[:text] << st[:search]
search[:endnotes] << st[:search]
end
- st=Dbi_search_string.new('metadata_and_text.title',search_for.title,q['ti'],cse).string
+ st=DBI_SearchString.new('metadata_and_text.creator_author',search_for.author,q['au'],cse).string
if st[:flag]
search[:text] << st[:search]
search[:endnotes] << st[:search]
end
- st=Dbi_search_string.new('metadata_and_text.creator_author',search_for.author,q['au'],cse).string
+ st=DBI_SearchString.new('metadata_and_text.classify_topic_register',search_for.topic_register,q['tr'],cse).string
if st[:flag]
search[:text] << st[:search]
search[:endnotes] << st[:search]
end
- st=Dbi_search_string.new('metadata_and_text.classify_topic_register',search_for.topic_register,q['tr'],cse).string
+ st=DBI_SearchString.new('metadata_and_text.classify_subject',search_for.subject,q['sj'],cse).string
if st[:flag]
search[:text] << st[:search]
search[:endnotes] << st[:search]
end
- st=Dbi_search_string.new('metadata_and_text.classify_subject',search_for.subject,q['sj'],cse).string
+ st=DBI_SearchString.new('metadata_and_text.classify_keywords',search_for.keywords,q['key'],cse).string
if st[:flag]
search[:text] << st[:search]
search[:endnotes] << st[:search]
end
- st=Dbi_search_string.new('metadata_and_text.notes_description',search_for.description,q['dsc'],cse).string
+ st=DBI_SearchString.new('metadata_and_text.notes_description',search_for.description,q['dsc'],cse).string
if st[:flag]
search[:text] << st[:search]
search[:endnotes] << st[:search]
end
- st=Dbi_search_string.new('metadata_and_text.publisher',search_for.publisher,q['pb'],cse).string
+ st=DBI_SearchString.new('metadata_and_text.publisher',search_for.publisher,q['pb'],cse).string
if st[:flag]
search[:text] << st[:search]
search[:endnotes] << st[:search]
end
- st=Dbi_search_string.new('metadata_and_text.creator_contributor',search_for.contributor,q['cntr'],cse).string
+ st=DBI_SearchString.new('metadata_and_text.creator_editor',search_for.editor,q['cntr'],cse).string
if st[:flag]
search[:text] << st[:search]
search[:endnotes] << st[:search]
end
- st=Dbi_search_string.new('metadata_and_text.date_published',search_for.date,q['dt'],cse).string
+ st=DBI_SearchString.new('metadata_and_text.creator_contributor',search_for.contributor,q['cntr'],cse).string
if st[:flag]
search[:text] << st[:search]
search[:endnotes] << st[:search]
end
- st=Dbi_search_string.new('metadata_and_text.classify_type',search_for.type,q['ty'],cse).string
+ st=DBI_SearchString.new('metadata_and_text.date_published',search_for.date,q['dt'],cse).string
if st[:flag]
search[:text] << st[:search]
search[:endnotes] << st[:search]
end
- st=Dbi_search_string.new('metadata_and_text.classify_identifier',search_for.identifier,q['id'],cse).string
+ st=DBI_SearchString.new('metadata_and_text.notes_type',search_for.type,q['ty'],cse).string
if st[:flag]
search[:text] << st[:search]
search[:endnotes] << st[:search]
end
- st=Dbi_search_string.new('metadata_and_text.original_source',search_for.source,q['src'],cse).string
+ st=DBI_SearchString.new('metadata_and_text.original_source',search_for.source,q['src'],cse).string
if st[:flag]
search[:text] << st[:search]
search[:endnotes] << st[:search]
end
- st=Dbi_search_string.new('metadata_and_text.title_language',search_for.language,q['lang'],cse).string
+ st=DBI_SearchString.new('metadata_and_text.language_document_char',search_for.language,q['lang'],cse).string
if st[:flag]
search[:text] << st[:search]
search[:endnotes] << st[:search]
end
- st=Dbi_search_string.new('metadata_and_text.classify_relation',search_for.relation,q['rel'],cse).string
+ st=DBI_SearchString.new('metadata_and_text.notes_relation',search_for.relation,q['rel'],cse).string
if st[:flag]
search[:text] << st[:search]
search[:endnotes] << st[:search]
end
- st=Dbi_search_string.new('metadata_and_text.classify_coverage',search_for.coverage,q['cov'],cse).string
+ st=DBI_SearchString.new('metadata_and_text.notes_coverage',search_for.coverage,q['cov'],cse).string
if st[:flag]
search[:text] << st[:search]
search[:endnotes] << st[:search]
end
- st=Dbi_search_string.new('metadata_and_text.rights_all',search_for.rights,q['cr'],cse).string
+ st=DBI_SearchString.new('metadata_and_text.rights_all',search_for.rights,q['cr'],cse).string
if st[:flag]
search[:text] << st[:search]
search[:endnotes] << st[:search]
end
- st=Dbi_search_string.new('metadata_and_text.notes_comment',search_for.comment,q['co'],cse).string
+ st=DBI_SearchString.new('metadata_and_text.notes_comment',search_for.comment,q['co'],cse).string
if st[:flag]
search[:text] << st[:search]
search[:endnotes] << st[:search]
end
- st=Dbi_search_string.new('metadata_and_text.notes_abstract',search_for.abstract,q['ab'],cse).string
+ st=DBI_SearchString.new('metadata_and_text.notes_abstract',search_for.abstract,q['ab'],cse).string
if st[:flag]
search[:text] << st[:search]
search[:endnotes] << st[:search]
end
- st=Dbi_search_string.new('metadata_and_text.src_filename',search_for.filename,q['fns'],cse).string
+ st=DBI_SearchString.new('metadata_and_text.src_filename',search_for.filename,q['fns'],cse).string
if st[:flag]
search[:text] << st[:search]
search[:endnotes] << st[:search]
@@ -463,7 +463,7 @@ module SiSU_CGI_sql
end
def previous
@offset_previous >= 0 \
- ? (@@canned_search_url.to_s + '&ltd=' + sql_match_limit.to_s + '&off=' + @offset_previous.to_s) \
+ ? (@@canned_search_url.to_s + '&ltd=' + sql_match_limit.to_s + '&off=' + @offset_previous.to_s)
: ''
end
def start
@@ -507,7 +507,7 @@ module SiSU_CGI_sql
</center>}
end
else
- if page.to_s =~ /^1$/; ''
+ if page.to_s =~ /^1$/ then ''
elsif page.to_s =~ /^2$/
%{<br /><center>
<a href="#{can.previous}">
@@ -531,7 +531,7 @@ module SiSU_CGI_sql
WOK_SQL
end
def tail
- v=SiSU_Env::Info_version.instance.get_version
+ v=SiSU_Env::InfoVersion.instance.get_version
<<-WOK_SQL
def tail
<<-'WOK'
@@ -553,7 +553,7 @@ module SiSU_CGI_sql
<br />
<a href="http://www.jus.uio.no/sisu" >
<b>#{v[:project]}</b></a> <sup>&copy;</sup> Ralph Amissah
- 1993, current 2010.
+ 1993, current 2012.
All Rights Reserved.
<br />
<a href="http://www.jus.uio.no/sisu" >
@@ -589,7 +589,7 @@ module SiSU_CGI_sql
<br />Standard SiSU meta-markup syntax, and the
<br />Standard SiSU <u>object citation numbering</u> and system, (object/text positioning system)
<br />
- <sup>&copy;</sup> Ralph Amissah 1997, current 2010.
+ <sup>&copy;</sup> Ralph Amissah 1997, current 2012.
All Rights Reserved.
</font></p>
</td></tr>
@@ -645,9 +645,9 @@ module SiSU_CGI_sql
@counters_txt,@counters_endn,@sql_select_body,@sql_select_endnotes='','','',''
FCGI.each_cgi do |cgi|
begin # all code goes in begin section
- @search={ :text => [],:endnotes => [] }
+ @search={ text: [], endnotes: [] }
q=CGI.new
- @db=if cgi['db'] =~/\S+/;
+ @db=if cgi['db'] =~/\S+/
@stub=/#{@db_name_prefix}(\S+)/.match(cgi['db'])[1]
cgi['db']
else
@@ -656,13 +656,13 @@ module SiSU_CGI_sql
end
checked_url,checked_stats,checked_searched,checked_tip,checked_case,checked_echo,checked_sql,checked_all,checked_none,checked_selected,checked_default,selected_db='','','','','','','','',''
result_type=(cgi['view']=~/text/) \
- ? result_type={:index=>'',:text=>'checked'} \
- : result_type={:index=>'checked',:text=>''}
+ ? result_type={ index: '', text: 'checked'}
+ : result_type={ index: 'checked', text: ''}
@@limit=if cgi['sql_match_limit'].to_s=~/2500/
- checked_sql_limit={:l1000=>'',:l2500=>'checked'}
+ checked_sql_limit={ l1000: '', l2500: 'checked'}
'2500'
else
- checked_sql_limit={:l1000=>'checked',:l2500=>''}
+ checked_sql_limit={ l1000: 'checked', l2500: ''}
'1000'
end
checked_echo='checked' if cgi['echo'] =~/\S/
@@ -695,7 +695,7 @@ module SiSU_CGI_sql
def main2
<<-'WOK_SQL'
search_field=cgi['find'] if cgi['find'] # =~/\S+/
- @search_for=Search_request.new(search_field,q) #.analyze #% search_for
+ @search_for=SearchRequest.new(search_field,q) #.analyze #% search_for
#% searches
#Canned_search.new(@base,@search_for.text1,cgi)
if @search_for.text1=~/\S+/ or @search_for.fulltext=~/\S+/ or @search_for.author=~/\S+/ or @search_for.topic_register=~/\S+/ #and search_field =~/\S/
@@ -708,6 +708,7 @@ module SiSU_CGI_sql
sj='&sj=' + CGI.escape(@search_for.subject) if @search_for.subject=~/\S/
dsc='&dsc=' + CGI.escape(@search_for.description) if @search_for.description=~/\S/
pb='&pb=' + CGI.escape(@search_for.publisher) if @search_for.publisher=~/\S/
+ edt='&edt=' + CGI.escape(@search_for.editor) if @search_for.editor=~/\S/
cntr='&cntr=' + CGI.escape(@search_for.contributor) if @search_for.contributor=~/\S/
dt='&dt=' + CGI.escape(@search_for.date) if @search_for.date=~/\S/
ty='&ty=' + CGI.escape(@search_for.type) if @search_for.type=~/\S/
@@ -726,8 +727,8 @@ module SiSU_CGI_sql
dtv='&dtv=' + CGI.escape(@search_for.date_valid) if @search_for.date_valid=~/\S/
fns='&fns=' + CGI.escape(@search_for.filename) if @search_for.filename=~/\S/
@@canned_search_url=(checked_all =~/checked/) \
- ? "#{@base}?#{s1}#{ft}#{key}#{ti}#{au}#{tr}#{sj}#{dsc}#{pb}#{cntr}#{dt}#{ty}#{id}#{src}#{lang}#{rel}#{cov}#{cr}#{co}#{ab}#{dtc}#{dti}#{dtm}#{dta}#{dtv}#{fns}&db=#{cgi['db']}&view=#{cgi['view']}&a=1" \
- : "#{@base}?#{s1}#{ft}#{key}#{ti}#{au}#{tr}#{sj}#{dsc}#{pb}#{cntr}#{dt}#{ty}#{id}#{src}#{lang}#{rel}#{cov}#{cr}#{co}#{ab}#{dtc}#{dti}#{dtm}#{dta}#{dtv}#{fns}&db=#{cgi['db']}&view=#{cgi['view']}"
+ ? "#{@base}?#{s1}#{ft}#{key}#{ti}#{au}#{tr}#{sj}#{dsc}#{pb}#{edt}#{cntr}#{dt}#{ty}#{id}#{src}#{lang}#{rel}#{cov}#{cr}#{co}#{ab}#{dtc}#{dti}#{dtm}#{dta}#{dtv}#{fns}&db=#{cgi['db']}&view=#{cgi['view']}&a=1"
+ : "#{@base}?#{s1}#{ft}#{key}#{ti}#{au}#{tr}#{sj}#{dsc}#{pb}#{edt}#{cntr}#{dt}#{ty}#{id}#{src}#{lang}#{rel}#{cov}#{cr}#{co}#{ab}#{dtc}#{dti}#{dtm}#{dta}#{dtv}#{fns}&db=#{cgi['db']}&view=#{cgi['view']}"
mod=ft=~/\S+/ ? (ft.gsub(/ft/,'s1')) : s1
@canned_base_url="#{@base}?#{mod}&db=#{cgi['db']}"
if checked_case=~/\S/
@@ -747,13 +748,13 @@ module SiSU_CGI_sql
elsif checked_all =~/checked/ or checked_url =~/checked/
canned_search=@@canned_search_url.scan(/(?:s1|ft|au|ti|fns|tr)=[^&]+/)
af=canned_search.join('; ')
- af.gsub!(/s1=/,'text: ')
- af.gsub!(/ft=/,'fulltxt: ')
- af.gsub!(/au=/,'author: ')
- af.gsub!(/ti=/,'title: ')
- af.gsub!(/fns=/,'filename: ')
- af.gsub!(/tr=/,'topic_register: ')
- af.gsub!(/%2B/,' ')
+ af=af.gsub(/s1=/,'text: ').
+ gsub(/ft=/,'fulltxt: ').
+ gsub(/au=/,'author: ').
+ gsub(/ti=/,'title: ').
+ gsub(/fns=/,'filename: ').
+ gsub(/tr=/,'topic_register: ').
+ gsub(/%2B/,' ')
analyze_format=af
st=af.split(/\s*;\s*/)
search_field=st.join("\n")
@@ -761,12 +762,13 @@ module SiSU_CGI_sql
green=%{<font size="2" color="#004000">}
canned_search_url_txt=CGI.escapeHTML(@@canned_search_url)
the_can=%{<font size="2" color="#666666">#{canned_note} <a href="#{@@canned_search_url}">#{canned_search_url_txt}</a></font><br />}
- p_text=p_fulltext=p_keywords=p_title=p_author=p_topic_register=p_subject=p_description=p_publisher=p_contributor=p_date=p_type=p_format=p_identifier=p_source=p_language=p_relation=p_coverage=p_rights=p_comment=p_abstract=p_filename=''
+ p_text=p_fulltext=p_keywords=p_title=p_author=p_topic_register=p_subject=p_description=p_publisher=p_editor=p_contributor=p_date=p_type=p_format=p_identifier=p_source=p_language=p_relation=p_coverage=p_rights=p_comment=p_abstract=p_filename=''
p_filename=%{filename: #{green}#{@search_for.filename}</font><br />} if @search_for.filename =~/\S+/
p_text=%{text: #{green}#{@search_for.text1}</font><br />} if @search_for.text1 =~/\S+/
p_fulltext=%{fulltxt: #{green}#{@search_for.fulltext}</font><br />} if @search_for.fulltext =~/\S+/
p_title=%{title: #{green}#{@search_for.title}</font><br />} if @search_for.title =~/\S+/
p_author=%{author: #{green}#{@search_for.author}</font><br />} if @search_for.author =~/\S+/
+ p_editor=%{editor: #{green}#{@search_for.editor}</font><br />} if @search_for.editor=~/\S+/
p_contributor=%{contributor: #{green}#{@search_for.contributor}</font><br />} if @search_for.contributor =~/\S+/
p_date=%{date: #{green}#{@search_for.date}</font><br />} if @search_for.date =~/\S+/
p_rights=%{rights: #{green}#{@search_for.rights}</font><br />} if @search_for.rights =~/\S+/
@@ -788,18 +790,18 @@ module SiSU_CGI_sql
<font size="2" color="#666666">
<b>database:</b> #{green}#{@db}</font>; <b>selected view:</b> #{green}#{cgi['view']}</font>
<b>search string:</b> "#{green}#{analyze_format}</font>"<br />
- #{p_text} #{p_fulltext} #{p_keywords} #{p_title} #{p_author} #{p_topic_register} #{p_subject} #{p_description} #{p_publisher} #{p_contributor} #{p_date} #{p_type} #{p_format} #{p_identifier} #{p_source} #{p_language} #{p_relation} #{p_coverage} #{p_rights} #{p_comment} #{p_abstract} #{p_filename}
+ #{p_text} #{p_fulltext} #{p_keywords} #{p_title} #{p_author} #{p_topic_register} #{p_subject} #{p_description} #{p_publisher} #{p_editor} #{p_contributor} #{p_date} #{p_type} #{p_format} #{p_identifier} #{p_source} #{p_language} #{p_relation} #{p_coverage} #{p_rights} #{p_comment} #{p_abstract} #{p_filename}
</font>
WOK
#eg = %{canned search e.g.:<br /> <a href="#{url}">#{url}</a><br />find: #{analyze}<br />database: #{database}}
- #dbi_canning
+ #% dbi_canning
@header=Form.new(@base,search_field,selected_db,result_type,checked_sql_limit,checked_tip,checked_stats,checked_searched,checked_url,checked_case,checked_echo,checked_sql,checked_all,checked_none,checked_selected,checked_default,search_note,the_can).submission_form #% form
unless q['s1'] =~/\S/ or q['au'] =~/\S/ or @search[:text][1] =~/\S/
print "Content-type: text/html\n\n"
puts (@header+@tail)
else #% searches
s1=(@search_for.text1 =~/\S/) \
- ? @search_for.text1 \
+ ? @search_for.text1
: 'Unavailable'
if checked_case=~/\S/
@search[:text]<<%{doc_objects.clean~'#{CGI.unescape(s1)}'}
@@ -808,13 +810,13 @@ module SiSU_CGI_sql
@search[:text]<<%{doc_objects.clean~*'#{CGI.unescape(s1)}'}
@search[:endnotes]<<%{endnotes.clean~*'#{CGI.unescape(s1)}'}
end
- #dbi_request
- dbi_statement=Dbi_search_statement.new(@conn,@search_for,q,checked_case)
+ #% dbi_request
+ dbi_statement=DBI_SearchStatement.new(@conn,@search_for,q,checked_case)
@text_search_flag=false
@text_search_flag=dbi_statement.text_search_flag
s_contents=dbi_statement.contents
s_endnotes=dbi_statement.endnotes
- @body_main,@endnotes=[],[]
+ @body_main,@endnotes='',''
@search_regx=nil
oldtid=0
if @text_search_flag
@@ -827,25 +829,98 @@ module SiSU_CGI_sql
@endnotes << '<p><hr><br /><b>Endnotes:</b><br />' << sql_select_endnotes
else
end
- #text_objects_body
+ @hostpath="#{@hosturl_files}/#{@stub}"
+ @ln='en'
+ WOK_SQL
+ end
+ def dir_structure
+ case @opt.dir_structure_by
+ when :language
+ <<-'WOK_SQL'
+ def path_manifest(fn,ln=nil)
+ "#{@hostpath}/#{ln}/manifest/#{fn}.html"
+ end
+ def path_html_seg(fn,ln=nil)
+ "#{@hostpath}/#{ln}/html/#{fn}"
+ end
+ def path_toc(fn,ln=nil)
+ "#{path_html_seg(fn,ln)}/toc.html"
+ end
+ def path_filename(fn,seg,ln=nil)
+ "#{path_html_seg(fn,ln)}/#{seg}.html"
+ end
+ def path_endnotes(fn,ln=nil)
+ "#{path_html_seg(fn,ln)}/endnotes.html"
+ end
+ def path_html_doc(fn,ln=nil)
+ "#{@hostpath}/#{ln}/html/#{fn}.html"
+ end
+ WOK_SQL
+ when :filetype
+ <<-'WOK_SQL'
+ def path_manifest(fn,ln=nil)
+ "#{@hostpath}/manifest/#{fn}.#{ln}.html"
+ end
+ def path_html_seg(fn,ln=nil)
+ "#{@hostpath}/html/#{fn}"
+ end
+ def path_toc(fn,ln=nil)
+ "#{path_html_seg(fn,ln)}/toc.#{ln}.html"
+ end
+ def path_filename(fn,seg,ln=nil)
+ "#{path_html_seg(fn,ln)}/#{seg}.#{ln}.html"
+ end
+ def path_endnotes(fn,ln=nil)
+ "#{path_html_seg(fn,ln)}/endnotes.#{ln}.html"
+ end
+ def path_html_doc(fn,ln=nil)
+ "#{@hostpath}/html/#{fn}.#{ln}.html"
+ end
+ WOK_SQL
+ else
+ <<-'WOK_SQL'
+ def path_manifest(fn,ln=nil)
+ "#{@hostpath}/#{fn}/sisu_manifest.#{ln}.html"
+ end
+ def path_html_seg(fn,ln=nil)
+ "#{@hostpath}/#{fn}"
+ end
+ def path_toc(fn,ln=nil)
+ "#{path_html_seg(fn,ln)}/toc.#{ln}.html"
+ end
+ def path_filename(fn,seg,ln=nil)
+ "#{path_html_seg(fn,ln)}/#{seg}.#{ln}.html"
+ end
+ def path_endnotes(fn,ln=nil)
+ "#{path_html_seg(fn,ln)}/endnotes.#{ln}.html"
+ end
+ def path_html_doc(fn,ln=nil)
+ "#{path_html_seg(fn,ln)}/scroll.#{ln}.html"
+ end
+ WOK_SQL
+ end
+ end
+ def main3
+ <<-'WOK_SQL'
+ #% text_objects_body
s_contents.each do |c| #% text body
location=c['src_filename'][/(.+?)\.(?:ssm\.sst|sst)$/,1]
file_suffix=c['src_filename'][/.+?\.(_?sst|ssm)$/,1]
lang=if location =~ /\S+?~(\S\S\S?)$/
l=location[/\S+?~(\S\S\S?)$/,1]
- location.gsub!(/(\S+?)~\S\S\S?/,'\1')
+ location=location.gsub(/(\S+?)~\S\S\S?/,'\1')
l=".#{l}"
else ''
end
- #metadata_found_body
+ #% metadata_found_body
if c['tid'].to_i != oldtid.to_i
ti=c['title']
can_txt_srch=(cgi['view']=~/index/) \
- ? %{<a href="#{@canned_base_url}&fns=#{c['src_filename']}&view=text"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a>&nbsp;} \
- : %{<a href="#{@canned_base_url}&fns=#{c['src_filename']}&view=index"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a>&nbsp;}
- title=%{<span style="background-color: #{@color_heading}"><a href="#{@hosturl_files}/#{@stub}/#{location}/toc#{lang}.html"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html">&nbsp;#{ti}</a></span> by #{c['creator_author']} #{can_txt_srch}<a href="#{@hosturl_files}/#{@stub}/#{location}/toc#{lang}.html"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html"></a>&nbsp;<a href="#{@hosturl_files}/#{@stub}/epub/#{location}#{lang}.epub"><img border="0" width="15" height="15" src="#{@image_src}/b_epub.png" alt="epub"></a>&nbsp;<a href="#{@hosturl_files}/#{@stub}/#{location}/portrait#{lang}.pdf"><img border="0" width="15" height="18" src="#{@image_src}/b_pdf.png" alt="pdf portrait"></a>&nbsp;<a href="#{@hosturl_files}/#{@stub}/#{location}/landscape#{lang}.pdf"><img border="0" width="18" height="15" src="#{@image_src}/b_pdf.png" alt="pdf landscape"></a></a>&nbsp;<a href="#{@hosturl_files}/#{@stub}/#{location}/opendocument#{lang}.odt"><img border="0" width="15" height="15" src="#{@image_src}/b_odf.png" alt="odf"></a>&nbsp;<a href="#{@hosturl_files}/#{@stub}/#{location}/sisu_manifest#{lang}.html"><img border="0" width="15" height="15" src="#{@image_src}/b_info.png" alt="manifest"></a><br />} if file_suffix=~/s/ #hmm watch file_suffix
+ ? %{<a href="#{@canned_base_url}&fns=#{c['src_filename']}&lang=#{c['language_document_char']}&view=text"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a>&nbsp;}
+ : %{<a href="#{@canned_base_url}&fns=#{c['src_filename']}&lang=#{c['language_document_char']}&view=index"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a>&nbsp;}
+ title=%{<span style="background-color: #{@color_heading}"><a href="#{path_toc(location,c['language_document_char'])}"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html">&nbsp;#{ti}</a></span> [#{c['language_document_char']}] by #{c['creator_author']} #{can_txt_srch}<a href="#{path_toc(location,c['language_document_char'])}"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html"></a>&nbsp;<a href="#{path_manifest(location,c['language_document_char'])}"><img border="0" width="15" height="15" src="#{@image_src}/b_info.png" alt="manifest"></a><br />} if file_suffix=~/s/ #hmm watch file_suffix
title=@text_search_flag \
- ? '<br /><hr>'+title \
+ ? '<br /><hr>'+title
: '<br />'+title
@counter_txt_doc+=1
oldtid=c['tid'].to_i
@@ -867,7 +942,7 @@ module SiSU_CGI_sql
search_regex=[]
build=unescaped_search.scan(/\S+/).each do |g|
(g.to_s =~/(AND|OR)/) \
- ? (search_regex << '|') \
+ ? (search_regex << '|')
: (search_regex << %{#{g.to_s}})
end
search_regex=search_regex.join(' ')
@@ -878,9 +953,9 @@ module SiSU_CGI_sql
else nil
end
matched_para=(@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/) \
- ? (c['body'].gsub(/(<a\s+href="https?:\/\/[^><\s]+#{@search_regx}[^>]+?>|#{@search_regx})/mi,%{<span style="background-color: #{@color_match}">\\1</span>})) \
+ ? (c['body'].gsub(/(<a\s+href="https?:\/\/[^><\s]+#{@search_regx}[^>]+?>|#{@search_regx})/mi,%{<span style="background-color: #{@color_match}">\\1</span>}))
: c['body']
- %{<hr><p><font size="2">ocn <b><a href="#{@hosturl_files}/#{@stub}/#{location}/#{c['seg']}#{lang}.html##{c['ocn']}">#{c['ocn']}</a></b>:</font></p>#{matched_para}}
+ %{<hr><p><font size="2">ocn <b><a href="#{path_filename(location,c['seg'],@ln)}##{c['ocn']}">#{c['ocn']}</a></b>:</font></p>#{matched_para}}
elsif c['suffix'] =~/1/ #doc
%{#{title}<hr><p><font size="2">ocn #{c['ocn']}:#{c['body']}}
end
@@ -888,9 +963,9 @@ module SiSU_CGI_sql
output=title+text
else #elsif cgi['view']=~/index/ #% idx body
if c['suffix'] !~/1/ #seg
- index=%{<a href="#{@hosturl_files}/#{@stub}/#{location}/#{c['seg']}#{lang}.html##{c['ocn']}">#{c['ocn']}</a>, } if @text_search_flag
- elsif c['suffix'] =~/1/ #doc
- index=%{<a href="#{@hosturl_files}/#{@stub}/#{location}/doc#{lang}.html##{c['ocn']}">#{c['ocn']}</a>, }
+ index=%{<a href="#{path_filename(location,c['seg'],@ln)}##{c['ocn']}">#{c['ocn']}</a>, } if @text_search_flag
+ elsif c['suffix'] =~/1/ #doc #FIX
+ index=%{<a href="#{path_html_doc(location,@ln)}##{c['ocn']}">#{c['ocn']}</a>, }
end
if c['seg'] =~/\S+/
if @text_search_flag
@@ -900,7 +975,7 @@ module SiSU_CGI_sql
else
@counter_txt_ocn+=1
output=c['suffix'] !~/1/ \
- ? title+index \
+ ? title+index
: %{#{title}#{c['ocn'].sort}, }
end
end
@@ -925,7 +1000,7 @@ module SiSU_CGI_sql
file_suffix=e['src_filename'][/.+?\.(_?sst|ssm)$/,1]
lang=if location =~ /\S+?~(\S\S\S?)$/
l=location[/\S+?~(\S\S\S?)$/,1]
- location.gsub!(/(\S+?)~\S\S\S?/,'\1')
+ location=location.gsub(/(\S+?)~\S\S\S?/,'\1')
l=".#{l}"
else ''
end
@@ -934,9 +1009,9 @@ module SiSU_CGI_sql
if e['metadata_tid'].to_i != oldtid.to_i
ti=e['title']
can_txt_srch=(cgi['view']=~/index/) \
- ? %{<a href="#{@canned_base_url}&fns=#{e['src_filename']}&view=text"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a>&nbsp;} \
- : %{<a href="#{@canned_base_url}&fns=#{e['src_filename']}&view=index"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a>&nbsp;}
- title=%{<br /><hr><span style="background-color: #{@color_heading}"><a href="#{@hosturl_files}/#{@stub}/#{location}/toc#{lang}.html"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html">&nbsp;#{ti}</a></span> by #{e['creator_author']} #{can_txt_srch}<a href="#{@hosturl_files}/#{@stub}/#{location}/toc#{lang}.html"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html"></a>&nbsp;<a href="#{@hosturl_files}/#{@stub}/epub/#{location}#{lang}.epub"><img border="0" width="15" height="15" src="#{@image_src}/b_epub.png" alt="epub"></a>&nbsp;<a href="#{@hosturl_files}/#{@stub}/#{location}/portrait.pdf"><img border="0" width="15" height="18" src="#{@image_src}/b_pdf.png" alt="pdf portrait"></a>&nbsp;<a href="#{@hosturl_files}/#{@stub}/#{location}/landscape.pdf"><img border="0" width="18" height="15" src="#{@image_src}/b_pdf.png" alt="pdf landscape"></a>&nbsp;<a href="#{@hosturl_files}/#{@stub}/#{location}/opendocument#{lang}.odt"><img border="0" width="15" height="15" src="#{@image_src}/b_odf.png" alt="odf"></a>&nbsp;<a href="#{@hosturl_files}/#{@stub}/#{location}/sisu_manifest#{lang}.html"><img border="0" width="15" height="15" src="#{@image_src}/b_info.png" alt="manifest"></a><br />} if file_suffix=~/s/
+ ? %{<a href="#{@canned_base_url}&fns=#{e['src_filename']}&lang=#{e['language_document_char']}&view=text"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a>&nbsp;}
+ : %{<a href="#{@canned_base_url}&fns=#{e['src_filename']}&lang=#{e['language_document_char']}&view=index"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a>&nbsp;}
+ title=%{<br /><hr><span style="background-color: #{@color_heading}"><a href="#{path_toc(location,@ln)}"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html">&nbsp;#{ti}</a></span> [#{e['language_document_char']}] by #{e['creator_author']} #{can_txt_srch}<a href="#{path_toc(location,@ln)}"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html"></a>&nbsp;<a href="#{path_manifest(location,@ln)}"><img border="0" width="15" height="15" src="#{@image_src}/b_info.png" alt="manifest"></a><br />} if file_suffix=~/s/
@counter_endn_doc+=1
oldtid=e['metadata_tid'].to_i
else title = ''
@@ -944,18 +1019,19 @@ module SiSU_CGI_sql
if cgi['view']=~/text/ \
or (cgi['view']!~/index/ and cgi['search'] !~/search db/) #% txt endnotes
@counter_endn_ocn+=1
- matched_endnote=(@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/) \
- ? matched=e['body'].gsub(/(<a\s+href="https?:\/\/[^><\s]+#{@search_regx}[^>]+?>|#{@search_regx})/mi,%{<span style="background-color: #{@color_match}">\\1</span>}) \
+ matched_endnote=(@search_regx.to_s.is_a?(String) \
+ && @search_regx.to_s=~/\S\S+/) \
+ ? (matched=e['body'].gsub(/(<a\s+href="https?:\/\/[^><\s]+#{@search_regx}[^>]+?>|#{@search_regx})/mi,%{<span style="background-color: #{@color_match}">\\1</span>}))
: e['body']
- output=%{#{title}<hr><font size="2">note <b><a href="#{@hosturl_files}/#{@stub}/#{location}/endnotes.html#_#{e['nr']}">#{e['nr']}</a></b> referred to from ocn <a href="#{@hosturl_files}/#{@stub}/#{location}/doc.html##{e['ocn']}">#{e['ocn']}</a>:</font> #{matched_endnote}}
- else #elsif cgi['view']=~/index/ #% idx endnotes
+ output=%{#{title}<hr><font size="2">note <b><a href="#{path_endnotes(location,@ln)}#_#{e['nr']}">#{e['nr']}</a></b> referred to from ocn <a href="#{path_html_doc(location,@ln)}##{e['ocn']}">#{e['ocn']}</a>:</font> #{matched_endnote}}
+ else #elsif cgi['view']=~/index/ #doc #FIX #% idx endnotes
@counter_endn_ocn+=1
- output=%{#{title}<a href="#{@hosturl_files}/#{@stub}/#{location}/endnotes.html#_#{e['nr']}">#{e['nr']}</a> [&sect; <a href="#{@hosturl_files}/#{@stub}/#{location}/doc.html##{e['ocn']}">#{e['ocn']}</a>], }
+ output=%{#{title}<a href="#{path_endnotes(location,@ln)}#_#{e['nr']}">#{e['nr']}</a> [&sect; <a href="#{path_html_doc(location,@ln)}##{e['ocn']}">#{e['ocn']}</a>], }
end
@counters_endn=if @counter_endn_doc > 0
if checked_stats =~/\S/
@@lt_e=@counter_endn_ocn==dbi_statement.sql_match_limit.to_i \
- ? true \
+ ? true
: false
start=(@@offset.to_i+1).to_s
range=(@@offset.to_i+@counter_endn_ocn.to_i).to_s
@@ -964,17 +1040,17 @@ module SiSU_CGI_sql
end
end
@endnotes << output #+ details
- else @endnotes=[] #does not take out yet
+ else @endnotes='' #does not take out yet
end
end
offset=dbi_statement.sql_offset.to_s
limit=dbi_statement.sql_match_limit.to_s
@@lt_t ||=false; @@lt_e ||=false
canned=(@@lt_t or @@lt_e) \
- ? dbi_statement.pre_next(true,@image_src).to_s \
+ ? dbi_statement.pre_next(true,@image_src).to_s
: dbi_statement.pre_next(false,@image_src).to_s
limit=dbi_statement.sql_match_limit.to_s
- cgi.out{@header + @counters_txt + @counters_endn + canned + @body_main.join + @endnotes.join + canned + @tail} #% print cgi_output_header+counters+body+endnotes
+ cgi.out{@header.force_encoding("UTF-8") + @counters_txt.force_encoding("UTF-8") + @counters_endn.force_encoding("UTF-8") + canned.force_encoding("UTF-8") + @body_main.force_encoding("UTF-8") + @endnotes.force_encoding("UTF-8") + canned.force_encoding("UTF-8") + @tail.force_encoding("UTF-8")} #% print cgi_output_header+counters+body+endnotes
end
rescue Exception => e
s='<pre>' + CGI::escapeHTML(e.backtrace.reverse.join("\n"))
diff --git a/lib/sisu/v2/cgi_sqlite.rb b/lib/sisu/v4/cgi_sqlite.rb
index 8ef65015..78ae0f9a 100644
--- a/lib/sisu/v2/cgi_sqlite.rb
+++ b/lib/sisu/v4/cgi_sqlite.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -56,16 +55,17 @@
** Description: generates naive cgi search form for search of sisu database (pgsql sqlite)
=end
-module SiSU_CGI_sqlite #% database building documents
- require "#{SiSU_lib}/sysenv" # sysenv.rb
- require "#{SiSU_lib}/cgi_sql_common" # cgi_sql_common.rb
- include SiSU_CGI_sql
- class SiSU_search_sqlite < SiSU_CGI_common
+module SiSU_CGI_SQLite #% database building documents
+ require_relative 'sysenv' # sysenv.rb
+ require_relative 'cgi_sql_common' # cgi_sql_common.rb
+ include SiSU_CGI_SQL
+ class SearchSQLite < CGI_Common
def initialize(opt,webserv)
@opt,@webserv=opt,webserv
- @env=SiSU_Env::Info_env.new('',opt)
+ @env=SiSU_Env::InfoEnv.new('',opt)
@image_src="#{@env.url.webserv_cgi}/_sisu/image_sys"
- @common=SiSU_CGI_sql::SiSU_CGI_common.new(@webserv,@opt.cmd,@image_src,@env)
+ @common=SiSU_CGI_SQL::CGI_Common.new(@webserv,@opt,@image_src,@env)
+ @cgi_file_name="#{Db[:name_prefix_db]}by_#{opt.dir_structure_by.to_s}_sqlite.cgi"
end
def sqlite
serve=[]
@@ -77,7 +77,7 @@ module SiSU_CGI_sqlite
end
end
end
- serve.sort!
+ serve=serve.sort
f1,f2,f3='','',''
serve.each do |x|
f1 << %{ <option value="#{Db[:name_prefix]}#{x}">#{x}</option>\n}
@@ -87,7 +87,6 @@ module SiSU_CGI_sqlite
f2 << %{ when /#{Db[:name_prefix]}#{x}/; '<option value="#{Db[:name_prefix]}#{x}">#{x}</option>'\n}
end
f2 << " end\n"
- #f3
f3 << %{ db_name='sisu_sqlite.db'\n}
f3 << %{ db_sqlite=case cgi['db']\n}
serve.each do |x|
@@ -95,8 +94,8 @@ module SiSU_CGI_sqlite
end
f3 << %{ else '#{@env.path.webserv}/#{serve[0]}/sisu_sqlite.db'\n end\n}
if FileTest.writable?('.')
- output=File.open('sisu_sqlite.cgi','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
+ 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
a=%{ generated sisu_sqlite.cgi,
BASED ON ALREADY CREATED sisu_sqlite.db OUTPUT, (-d)
}
@@ -104,16 +103,17 @@ module SiSU_CGI_sqlite
c=case @webserv
when /pwd/; ''
else "if necessary make the directory /usr/lib/cgi-bin :
- sudo cp -vi #{Dir.pwd}/sisu_sqlite.cgi /usr/lib/cgi-bin/.
- sudo chmod -v 755 /usr/lib/cgi-bin/sisu_sqlite.cgi
- (copy sisu_sqlite.cgi to your cgi directory) and set file permissions to 755"
+ sudo cp -vi #{Dir.pwd}/#{@cgi_file_name} /usr/lib/cgi-bin/.
+ sudo chmod -v 755 /usr/lib/cgi-bin/#{@cgi_file_name}
+ sudo ln -s /usr/lib/cgi-bin/#{@cgi_file_name} /usr/lib/cgi-bin/sisu_sqlite.cgi
+ (copy #{@cgi_file_name} to your cgi directory) set file permissions to 755, and make symbolic link to sisu_sqlite.cgi"
end
a=%{#{c}
#{@env.webserv_base_cgi}/cgi-bin/sisu_sqlite.cgi
}
b='(to create and populate sisu sqlite database see "man sisu" and in particular the -d flag)'
SiSU_Screen::Ansi.new(@opt.cmd,a,b).warn
- else puts 'failed in attempt to write sisu_sqlite.cgi to present directory, is directory writable?'
+ else puts "failed in attempt to write #{@cgi_file_name} to present directory, is directory writable?"
end
end
def header0
@@ -136,19 +136,19 @@ module SiSU_CGI_sqlite
end
def search_statement
<<-'WOK_SQL'
- class Dbi_search_string
+ class DBI_SearchString
def initialize(l,t,q,cse=false)
@l,@t,@q=l,t,q
end
def string
- search={ :search => [],:flag => false }
+ search={ search: [], flag: false }
if @t =~/\S+/ or @q =~/\S+/
- if @t =~/\S+/; unescaped_search=CGI.unescape(@t)
- elsif @q =~/\S+/; unescaped_search=CGI.unescape(@q)
+ if @t =~/\S+/ then unescaped_search=CGI.unescape(@t)
+ elsif @q =~/\S+/ then unescaped_search=CGI.unescape(@q)
end
search_construct=[]
- unescaped_search.gsub!(/\s*(AND|OR)\s*/,"%' \) \\1 #{@l} LIKE \( '%")
- unescaped_search.gsub!(/(.+)/,"#{@l} LIKE \( '%\\1%' \)")
+ unescaped_search=unescaped_search.gsub(/\s*(AND|OR)\s*/,"%' \) \\1 #{@l} LIKE \( '%").
+ gsub(/(.+)/,"#{@l} LIKE \( '%\\1%' \)")
search_construct << unescaped_search
search_construct=search_construct.join(' ')
search[:search] << search_construct
@@ -162,13 +162,11 @@ module SiSU_CGI_sqlite
end
def search_query1
<<-'WOK_SQL'
- @search_text,@search_endnotes=[],[]
- search[:text].flatten.each{|x| @search_text << "#{x} AND " }
- @search_text=@search_text.join.gsub!(/AND\s+$/m,'')
- @search_text.gsub!(/(doc_objects\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+doc_objects\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)')
- search[:endnotes].flatten.each{|x| @search_endnotes << "#{x} AND " }
- @search_endnotes=@search_endnotes.join.gsub!(/AND\s+$/m,'')
- @search_endnotes.gsub!(/(endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)')
+ @search_text,@search_endnotes='',''
+ @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)')
+ @search_endnotes=search[:endnotes].flatten.join(' AND ')
+ @search_endnotes=@search_endnotes.gsub(/(endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)')
end
WOK_SQL
end
@@ -177,7 +175,7 @@ module SiSU_CGI_sqlite
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.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.title, metadata_and_text.src_filename, doc_objects.ocn}
+ @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
@@ -185,7 +183,7 @@ module SiSU_CGI_sqlite
def sql_select_endnotes
limit ||=@@limit
offset ||=@@offset
- @sql_statement[:endnotes]=%{SELECT metadata_and_text.title, metadata_and_text.creator_author, metadata_and_text.src_filename, endnotes.body, endnotes.nr, endnotes.ocn, endnotes.metadata_tid FROM metadata_and_text, endnotes WHERE #{@search_endnotes} AND metadata_and_text.tid = endnotes.metadata_tid ORDER BY metadata_and_text.title, metadata_and_text.src_filename, endnotes.nr}
+ @sql_statement[:endnotes]=%{SELECT metadata_and_text.title, metadata_and_text.creator_author, metadata_and_text.src_filename, metadata_and_text.language_document_char, endnotes.body, endnotes.nr, endnotes.ocn, endnotes.metadata_tid FROM metadata_and_text, endnotes WHERE #{@search_endnotes} AND metadata_and_text.tid = endnotes.metadata_tid ORDER BY metadata_and_text.language_document_char, metadata_and_text.title, metadata_and_text.src_filename, endnotes.nr}
@sql_statement[:range]=%{LIMIT #{limit} OFFSET #{offset} ;}
select=@sql_statement[:endnotes] + ' ' + @sql_statement[:range]
select
diff --git a/lib/sisu/v2/composite.rb b/lib/sisu/v4/composite.rb
index 4ff53498..2f58567b 100644
--- a/lib/sisu/v2/composite.rb
+++ b/lib/sisu/v4/composite.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -58,22 +57,21 @@
=end
module SiSU_Assemble
- require 'fileutils'
- require "#{SiSU_lib}/sysenv" # sysenv.rb
- class Remote_image
- include FileUtils
+ require_relative 'sysenv' # sysenv.rb
+ class RemoteImage
def initialize
- @env=SiSU_Env::Info_env.new
+ @env=SiSU_Env::InfoEnv.new
end
def image(dir)
images=[]
images[0]=dir
images
end
- def download_images(download_from,images_array)
- path="#{@env.path.processing}/external_document/image"
- mkdir_p(path) unless FileTest.directory?(path)
- images_array.each do |i|
+ def download_images(images_info)
+ path="#{@env.processing_path.processing}/external_document/image"
+ FileUtils::mkdir_p(path) unless FileTest.directory?(path)
+ download_from=images_info.shift
+ images_info.each do |i|
image="#{path}/#{i}"
imagefile=File.new(image,'w+')
open("#{download_from}/#{i}") do |g|
@@ -82,48 +80,39 @@ module SiSU_Assemble
imagefile.close
end
output_path="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image_external"
- mkdir_p(output_path) unless FileTest.directory?(output_path)
- SiSU_Env::System_call.new("#{path}/*",output_path,'q').rsync
- end
- def download_doc_skin(doc_skin) #first element in array is source url
- path="#{@env.path.processing}/external_document/skin/doc"
- mkdir_p(path) unless FileTest.directory?(path)
- download_from=doc_skin.shift
- doc_skin.each do |i|
- skin="#{path}/#{i}.rb"
- unless FileTest.exists?(skin)
- skinfile=File.new(skin,'w+')
- open("#{download_from}/#{i}.rb") do |g|
- skinfile << g.read
- end
- skinfile.close
- end
- end
+ FileUtils::mkdir_p(output_path) unless FileTest.directory?(output_path)
+ SiSU_Env::SystemCall.new("#{path}/*",output_path,'q').rsync
end
end
class Composite
@@imager={}
def initialize(opt)
@opt=opt
- @env=SiSU_Env::Info_env.new
+ @env=SiSU_Env::InfoEnv.new
end
def read
begin
- @fns_array=IO.readlines(@opt.fns,'')
+ pwd=Dir.pwd
+ Dir.chdir(@opt.f_pth[:pth])
+ @fns_array=IO.readlines(@opt.fno,'')
assembled=insertions?
write(assembled)
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
+ Dir.chdir(pwd)
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
ensure
end
end
def write(assembled)
- assembled_file=File.new("#{@env.path.composite_file}/#{@opt.fnb}.ssm.sst",'w+')
- assembled.each{|a| assembled_file << a }
+ assembled_file=File.new("#{@env.processing_path.composite_file}/#{@opt.fnb}.ssm.sst",'w+')
+ assembled.each {|a| assembled_file << a }
assembled_file.close
end
def download_images(download_from,images_array)
- path="#{@env.path.processing}/external_document/image"
- mkdir_p(path) unless FileTest.directory?(path)
+ path="#{@env.processing_path.processing}/external_document/image"
+ FileUtils::mkdir_p(path) unless FileTest.directory?(path)
images_array.each do |i|
image="#{path}/#{i}"
unless FileTest.exists?(image)
@@ -135,38 +124,23 @@ module SiSU_Assemble
end
end
end
- def download_doc_skin(doc_skin) #first element in array is source url
- path="#{@env.path.processing}/external_document/skin/doc"
- mkdir_p(path) unless FileTest.directory?(path)
- download_from=doc_skin.shift
- doc_skin.each do |i|
- skin="#{path}/#{i}.rb"
- unless FileTest.exists?(skin)
- skinfile=File.new(skin,'w+')
- open("#{download_from}/#{i}.rb") do |g|
- skinfile << g.read
- end
- skinfile.close
- end
- end
- end
def insertion(fni,insert_array)
- file={ :prepared=>[],:images=>[] }
+ file={ prepared: [], images: [] }
rgx_image=/(?:^|[^_\\])\{\s*(\S+?\.(?:png|jpg|gif))/
file[:prepared] << "\n% |#{fni}|@|^|>>ok\n"
@code_flag=false
insert_array.each do |i|
- @code_flag=if i =~/^code\{/; true
- elsif i =~/^\}code/; false
+ @code_flag=if i =~/^code\{/ then true
+ elsif i =~/^\}code/ then false
else @code_flag
end
if not @code_flag \
and i !~/^%+\s/
- i.gsub!(/^([123]|:?[ABC])~\? /,'% [conditional heading:] \1~ ') #off conditional heading (consider syntax)
+ i=i.gsub(/^([123]|:?[ABC])~\? /,'% [conditional heading:] \1~ ') #off conditional heading (consider syntax)
if i =~/^@\S+?:/
- i.gsub!(/\n/m,"\n% ")
- i.gsub!(/\n%\s+$/m,'')
- i.gsub!(/^@\S+?:/m,"\n% [imported header:] ") #off imported headers
+ i=i.gsub(/\n/m,"\n% ").
+ gsub(/\n%\s+$/m,'').
+ gsub(/^@\S+?:/m,"\n% [imported header:] ") #off imported headers
end
end
file[:prepared] << i
@@ -177,8 +151,7 @@ module SiSU_Assemble
end
file[:prepared] << "\n% end import" << "\n\n"
if file[:images].length > 0
- file[:images].flatten!
- file[:images].uniq!
+ file[:images]=file[:images].flatten.uniq
file[:images].delete_if {|x| x =~/https?:\/\// }
end
file
@@ -186,7 +159,7 @@ module SiSU_Assemble
def insertions?
data=@fns_array
tuned_file,imagedir=[],[]
- SiSU_Screen::Ansi.new(@opt.cmd,'Composite Document',@opt.fns).grey_title_hi unless @opt.cmd =~/q/
+ SiSU_Screen::Ansi.new(@opt.cmd,'Composite Document',"[#{@opt.f_pth[:lng_is]}] #{@opt.fno}").grey_title_hi unless @opt.cmd =~/q/
para=data.each do |para|
if para =~/^<<\s+(\S+?\.ss[it])$/ \
or para =~/^<<\{(\S+?\.ss[it])\}$/ \
@@ -214,23 +187,64 @@ module SiSU_Assemble
file[:prepared]
else
cX=SiSU_Screen::Ansi.new(@opt.cmd).cX
- puts "\t #{cX.fuschia}ERROR#{cX.off} #{cX.brown}#{@opt.fns}#{cX.off} #{cX.fuschia}requires invalid or non-existent file:#{cX.off} #{cX.brown}#{loadfile}#{cX.off}"
+ STDERR.puts "\t #{cX.fuschia}ERROR#{cX.off} #{cX.brown}#{@opt.fns}#{cX.off} #{cX.fuschia}requires invalid or non-existent file:#{cX.off} #{cX.brown}#{loadfile}#{cX.off}"
para
end
else tuned_file << para
end
- tuned_file.flatten!
- tuned_file.compact!
+ tuned_file=tuned_file.flatten.compact
end
if @@imager.length >0
@@imager.each do |d,i|
- i.flatten!
- i.uniq!
- download_images(d,i)
+ i=i.flatten.uniq
+ image_info=d + i
+ download_images(image_info.flatten)
end
end
tuned_file
end
end
+ class CompositeFileList
+ @@imager={}
+ def initialize(opt)
+ @opt=opt
+ @env=SiSU_Env::InfoEnv.new
+ end
+ def read
+ begin
+ @opt.fns=@opt.fns.gsub(/\.ssm\.sst$/,'.ssm') #FIX earlier, hub
+ @fns_array=IO.readlines(@opt.fns,'')
+ files=insertions?
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ end
+ end
+ def insertions?
+ data=@fns_array
+ tuned_file,imagedir=[],[]
+ SiSU_Screen::Ansi.new(@opt.cmd,'Composite Document',@opt.fno).grey_title_hi unless @opt.cmd =~/q/
+ @ssm=[@opt.fns]
+ para=data.each do |para|
+ if para =~/^<<\s+(\S+?\.ss[it])$/
+ loadfile=$1.strip
+ SiSU_Screen::Ansi.new(@opt.cmd,'loading:',loadfile).txt_grey if @opt.cmd =~/[MVv]/
+ tuned_file << if loadfile =~ /(?:https?|file):\/\/\S+?\.ss[ti]$/
+ @ssm << loadfile
+ elsif loadfile =~ /\.ss[ti]$/ \
+ and FileTest.file?(loadfile)
+ @ssm << loadfile
+ else
+ cX=SiSU_Screen::Ansi.new(@opt.cmd).cX
+ STDERR.puts "\t #{cX.fuschia}ERROR#{cX.off} #{cX.brown}#{@opt.fns}#{cX.off} #{cX.fuschia}requires invalid or non-existent file:#{cX.off} #{cX.brown}#{loadfile}#{cX.off}"
+ para
+ end
+ end
+ end
+ @ssm
+ end
+ end
end
__END__
diff --git a/lib/sisu/v2/concordance.rb b/lib/sisu/v4/concordance.rb
index 20ab8efa..f93fbd6a 100644
--- a/lib/sisu/v2/concordance.rb
+++ b/lib/sisu/v4/concordance.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -58,67 +57,84 @@
=end
module SiSU_Concordance
- require "#{SiSU_lib}/particulars" # particulars.rb
+ require_relative 'particulars' # particulars.rb
include SiSU_Particulars
- require "#{SiSU_lib}/sysenv" # sysenv.rb
+ require_relative 'sysenv' # sysenv.rb
include SiSU_Env
- require "#{SiSU_lib}/defaults" # defaults.rb
+ require_relative 'defaults' # defaults.rb
include SiSU_Viz
- require "#{SiSU_lib}/html_format" # html_format.rb
+ require_relative 'html_format' # html_format.rb
include SiSU_HTML_Format
- require "#{SiSU_lib}/html_minitoc" # html_minitoc.rb
+ require_relative 'html_minitoc' # html_minitoc.rb
class Source
def initialize(opt)
@opt=opt
- @particulars=SiSU_Particulars::Combined_singleton.instance.get_all(opt)
+ @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)
end
def read
begin
@env,@md=@particulars.env,@particulars.md
loc=@env.url.output_tell
- unless @md.cmd =~/q/
- tool=(@md.cmd =~/[MVv]/) ? "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:concordance]}" : @md.fns
- @md.cmd=~/[MVvz]/ \
- ? SiSU_Screen::Ansi.new(@md.cmd,"Concordance",tool).grey_title_hi \
- : SiSU_Screen::Ansi.new(@md.cmd,'Concordance',tool).green_title_hi
+ unless @md.opt.cmd =~/q/
+ tool=(@md.opt.cmd =~/[MVv]/) \
+ ? "#{@env.program.web_browser} #{@md.file.output_path.html_concordance.dir}/#{@md.file.base_filename.html_concordance}"
+ : "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}"
+ @md.opt.cmd=~/[MVvz]/ \
+ ? SiSU_Screen::Ansi.new(@opt.cmd,"Concordance",tool).grey_title_hi
+ : SiSU_Screen::Ansi.new(@opt.cmd,'Concordance',tool).green_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.cmd,"concordance skipped, large document has over #{wordmax} words (#{@md.wc_words})").warn unless @md.cmd =~/q/
+ SiSU_Screen::Ansi.new(@md.opt.cmd,"concordance skipped, large document has over #{wordmax} words (#{@md.wc_words})").warn unless @md.opt.cmd =~/q/
end
else
- SiSU_Screen::Ansi.new(@md.cmd,"wc (word count) is off, concordance will be processed for all files including those over the max set size of: #{wordmax} words").warn unless @md.cmd =~/q/
+ SiSU_Screen::Ansi.new(@md.opt.cmd,"wc (word count) is off, concordance will be processed for all files including those over the max set size of: #{wordmax} words").warn unless @md.opt.cmd =~/q/
SiSU_Concordance::Source::Words.new(@particulars).songsheet
end
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
ensure
+ SiSU_Env::CreateSite.new(@opt.cmd).cp_css
end
end
private
- class Doc_title
+ class DocTitle
include SiSU_Viz
#revisit, both requires (html & shared_xml) needed for stand alone operation (sisu -w [filename])
- require "#{SiSU_lib}/shared_xml" # shared_xml.rb
- require "#{SiSU_lib}/html" # html.rb
+ require_relative 'shared_xml' # shared_xml.rb
+ require_relative 'html' # html.rb
def initialize(particulars)
@particulars,@md=particulars,particulars.md
- @data=SiSU_HTML::Source::Html_environment.new(particulars).tuned_file_instructions
- @vz=SiSU_Env::Get_init.instance.skin
+ @data=SiSU_HTML::Source::HTML_Environment.new(particulars).tuned_file_instructions
+ @file=SiSU_Env::FileOp.new(@md)
txt_path=%{#{@md.dir_out}}
- SiSU_Env::Info_skin.new(@md).select
@fnb=@md.fnb
- @lex_button=%{<a href="http://www.jus.uio.no/sisu/" target="_top"><img border="0" height="44" width="144" valign="center" src="../_sisu/image/sisu.png" alt="SiSU home --&gt;"></a>}
+ @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" bgcolor="white" 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.fn[:toc]}" #{@vz.js_toc}><b>#{@md.title.full}</b></a></h1><p class="bold">#{@md.author}</p></td></tr></table>
+<table summary="links to text related to this rudimentary index" width="96%" border="0" bgcolor="white" cellpadding="0" align="center"><tr><td width="2%" align="right">&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
end
def create
- head_banner=SiSU_HTML_Format::Head_toc.new(@md)
- minitoc=SiSU_HTML_minitoc::Toc_mini.new(@md,@data).songsheet.join("\n")
- toc='<div class="toc">' + minitoc + '</div>'
+ head_banner=SiSU_HTML_Format::HeadToc.new(@md)
+ minitoc=SiSU_HTML_MiniToc::TocMini.new(@md,@data).songsheet.join("\n")
+ stylesheet=SiSU_Style::CSS_HeadInfo.new(@md).stylesheet
+ make=SiSU_Env::ProcessingSettings.new(@md)
+ if make.build.manifest_minitoc?
+ toc='<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 PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
@@ -132,14 +148,12 @@ WOK
<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" />
- <link rel="stylesheet" href="../_sisu/css/html.css" type="text/css" />
- #{@vz.js_head}
+ #{stylesheet.css_head_seg}
</head>
<body>
- #{@vz.js_top}
- #{head_banner.concordance_navigation_band('pdf')}
+ #{top_band}
#{toc}
-<div class="content">
+<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>
@@ -169,21 +183,22 @@ WOK
end
end
class Words
- require "#{SiSU_lib}/defaults" # defaults.rb
+ require_relative 'i18n' # i18n.rb
+ include SiSU_i18n
+ require_relative 'defaults' # defaults.rb
include SiSU_Viz
- require "#{SiSU_lib}/html_format" # html_format.rb
+ require_relative 'html_format' # html_format.rb
include SiSU_HTML_Format
- require "#{SiSU_lib}/sysenv" # sysenv.rb
+ require_relative 'sysenv' # sysenv.rb
include SiSU_Screen
@@dp=nil
def initialize(particulars)
@particulars=particulars
begin
- @vz=SiSU_Env::Get_init.instance.skin
@env,@md,@dal_array=particulars.env,particulars.md,particulars.dal_array
- @path="#{@env.path.output}/#{@md.fnb}"
+ @file=SiSU_Env::FileOp.new(@md)
@freq=Hash.new(0)
- @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern
+ @dp=@@dp ||=SiSU_Env::InfoEnv.new.digest.pattern
@rxp_lv1=/^#{Mx[:lv_o]}1:/ #fix @rxp_lv # Mx[:lv_o]
@rxp_lv2=/^#{Mx[:lv_o]}2:/ #fix @rxp_lv # Mx[:lv_o]
@rxp_lv3=/^#{Mx[:lv_o]}3:/ #fix @rxp_lv # Mx[:lv_o]
@@ -194,33 +209,41 @@ WOK
@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
- @rgx_scanlist=%r{#{Mx[:fa_italics_o]}[a-zA-Z0-9"\s]{2,12}#{Mx[:fa_italics_c]}|#{Mx[:fa_bold_o]}[a-zA-Z0-9"\s]{2,12}#{Mx[:fa_bold_c]}|(?:https?|file)://\S+|<\S+?>|\w+|[a-zA-Z]+}mi
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error
+ @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::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
end
end
def songsheet
begin
- mkdir_p(@path) unless FileTest.directory?(@path)
- @file_concordance=File.open("#{@path}/#{@md.fn[:concordance]}",'w')
+ FileUtils::mkdir_p(@file.output_path.html_concordance.dir) unless FileTest.directory?(@file.output_path.html_concordance.dir)
+ @file_concordance=File.open(@file.place_file.html_concordance.dir,'w')
map_para
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
ensure
@file_concordance.close
end
end
protected
def location_scroll(wordlocation,show)
- %{<a href="#{@md.fnl[:pre]}doc#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}\##{wordlocation}">#{wordlocation}</a>; }
+ %{<a href="doc#{@md.lang_code_insert}#{Sfx[:html]}\##{wordlocation}">#{wordlocation}</a>; }
end
def location_seg(wordlocation,show) ##fix
- @word_location_seg=wordlocation.gsub(/(.+?)\#(\d+)/,"#{@md.fnl[:pre]}\\1#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}#\\2") unless wordlocation.nil?
+ @word_location_seg=wordlocation.gsub(/(.+?)\#(\d+)/,"\\1#{@md.lang_code_insert}#{Sfx[:html]}#\\2") unless wordlocation.nil?
case wordlocation
when @rxp_t1
- %{[<a href="#{@md.fnl[:pre]}doc#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}##{show}">H</a>]#{show}, }
+ %{[<a href="doc#{@md.lang_code_insert}#{Sfx[:html]}##{show}">H</a>]#{show}, }
when @rxp_t2
- %{[<a href="#{@md.fnl[:pre]}doc#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}##{show}">H</a>]#{show}, }
+ %{[<a href="doc#{@md.lang_code_insert}#{Sfx[:html]}##{show}">H</a>]#{show}, }
when @rxp_t3
- %{[<a href="#{@md.fnl[:pre]}doc#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}##{show}">H</a>]#{show}, }
+ %{[<a href="doc#{@md.lang_code_insert}#{Sfx[:html]}##{show}">H</a>]#{show}, }
else %{<a href="#{@word_location_seg}">#{show}</a>, }
end
end
@@ -230,56 +253,63 @@ WOK
@dal_array.each do |line|
if defined? line.ocn \
and line.ocn.to_s =~/\d/
- if line.is =~/heading/ \
- and line.ln==4
+ if (line.is ==:heading \
+ || line.is ==:heading_insert) \
+ && line.ln==4
@seg=line.name
end
ocn=line.ocn.to_s
if ocn =~/\d+/ \
and ocn !~/^0$/
- line.obj.gsub!(/#{@rxp_excluded1}/,' ')
+ line.obj=line.obj.gsub(/#{@rxp_excluded1}/,' ')
line.obj=line.obj.split(@rgx_splitlist).join(' ') #%take in word or other match
for word in line.obj.scan(@rgx_scanlist) #%take in word or other match
- word.gsub!(/#{Mx[:lnk_o]}|#{Mx[:lnk_c]}|#{Mx[:url_o]}|#{Mx[:url_c]}/,'')
- word.gsub!(/#{Mx[:fa_o]}\S+?#{Mx[:fa_o_c]}/,'')
- word.gsub!(/#{Mx[:fa_c_o]}\S+?#{Mx[:fa_c]}/,'')
- word.gsub!(/#{Mx[:gl_o]}#[a-z]+#{Mx[:gl_c]}/,'')
- word.gsub!(/#{Mx[:gl_o]}#[0-9]+#{Mx[:gl_c]}/,'')
- word.gsub!(/[0-9a-f]{10,}/,' ') if word =~/[0-9]/
- word.gsub!(/#{Mx[:br_line]}/,' ')
- word.gsub!(/^ +/,'')
- word.gsub!(/^\S$/,'')
+ 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.gsub!(/#{Mx[:br_nl]}|#{Mx[:br_line]}/,' ')
- word.gsub!(/#{Mx[:fa_o]}[a-z]{1,7}#{Mx[:fa_o_c]}|#{Mx[:fa_c_o]}[a-z]{1,7}#{Mx[:fa_c]}/,'')
- word.gsub!(/#{Mx[:en_a_o]}(?:\d|[*+])*|#{Mx[:en_b_o]}(?:\d|[*+])*|#{Mx[:en_a_c]}|#{Mx[:en_b_c]}/mi,'')
- word.gsub!(/#{Mx[:fa_o]}\S+?#{Mx[:fa_o_c]}/,''); word.gsub!(/#{Mx[:fa_c_o]}\S+?#{Mx[:fa_c]}/,'')
- word.gsub!(/<\/?\S+?>/,'')
- word.gsub!(/^\@+/,'')
- word.strip!
- word.gsub!(/#{Mx[:tc_p]}.+/,'')
- word.gsub!(/[\.,;:"]$/,'')
- word.gsub!(/["]/,'')
- word.gsub!(/^\s*[\(]/,'')
- word.gsub!(/[\(]\s*$/,'')
- word.gsub!(/^(?:See|e\.?g\.?).+/,'')
- word.gsub!(/^\s*[.,;:]\s*/,'')
- word.strip!
- word.gsub!(/^\(?[a-zA-Z]\)$/,'')
- word.gsub!(/^\d+(st|nd|rd|th)$/,'')
- word.gsub!(/^(\d+\.?)+$/, '')
- word.gsub!(/#{Mx[:mk_o]}|#{Mx[:mk_c]}/,'')
- word.gsub!(/:name#\S+/,'')
- word.gsub!(/^\S$/,'')
+ word=word.gsub(/#{Mx[:br_nl]}|#{Mx[:br_line]}/,' ').
+ gsub(/#{Mx[:fa_o]}[a-z]{1,7}#{Mx[:fa_o_c]}|#{Mx[:fa_c_o]}[a-z]{1,7}#{Mx[:fa_c]}/,'').
+ gsub(/#{Mx[:en_a_o]}(?:\d|[*+])*|#{Mx[:en_b_o]}(?:\d|[*+])*|#{Mx[:en_a_c]}|#{Mx[:en_b_c]}/mi,'').
+ gsub(/#{Mx[:fa_o]}\S+?#{Mx[:fa_o_c]}/,'').
+ gsub(/#{Mx[:fa_c_o]}\S+?#{Mx[:fa_c]}/,'').
+ gsub(/<\/?\S+?>/,'').
+ gsub(/^\@+/,'').
+ strip.
+ gsub(/#{Mx[:tc_p]}.+/,'').
+ gsub(/[\.,;:"]$/,'').
+ gsub(/["]/,'').
+ gsub(/^\s*[\(]/,'').
+ gsub(/[\(]\s*$/,'').
+ gsub(/^(?:See|e\.?g\.?).+/,'').
+ gsub(/^\s*[.,;:]\s*/,'').
+ strip.
+ gsub(/^\(?[a-zA-Z]\)$/,'').
+ gsub(/^\d+(st|nd|rd|th)$/,'').
+ gsub(/^(\d+\.?)+$/, '').
+ gsub(/#{Mx[:mk_o]}|#{Mx[:mk_c]}/,'').
+ gsub(/:name#\S+/,'').
+ gsub(/^\S$/,'')
word=nil if word =~/^\S$/
word=nil if word =~/^\s*$/ #watch
if word
unless word =~/[A-Z][A-Z]/ \
or word =~/\w+\s\w+/
- word.capitalize!
+ word=word.capitalize
end
@freq[word] +=1
@word_map[word] ||= []
@@ -302,9 +332,12 @@ WOK
end
scr='<font size="1" color="#777777" face=times new roman><img border="0" height="15" width="15" src="../_sisu/image/b_doc.png" alt="Full Text">&nbsp;scroll:&nbsp;</font><font size="1" color="#222222" face=times new roman>doc#&nbsp;</font> '
seg=''
- @file_concordance << SiSU_Concordance::Source::Doc_title.new(@particulars).create
- alph=%W[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z]
+ 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
@@ -330,9 +363,8 @@ WOK
end
# special cases endnotes and header levels 1 - 3
end
- credits=@vz.credits_sisu
@file_concordance << %{</div></body>\n</html>} # footer
- SiSU_Screen::Ansi.new(@md.cmd,@md.fns,"#{@env.path.output_tell}/#{@md.fn[:concordance]}").flow if @md.cmd =~/[MV]/
+ SiSU_Screen::Ansi.new(@md.opt.cmd,@md.fns,"#{@md.file.output_path.html_concordance.dir}/#{@md.file.base_filename.html_concordance}").flow if @md.opt.cmd =~/[MV]/
end
end
end
diff --git a/lib/sisu/v2/conf.rb b/lib/sisu/v4/conf.rb
index f3f978db..8cd3e2ef 100644
--- a/lib/sisu/v2/conf.rb
+++ b/lib/sisu/v4/conf.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -57,33 +56,31 @@
=end
module SiSU_Initialize
- require "#{SiSU_lib}/sysenv" # sysenv.rb
+ require_relative 'sysenv' # sysenv.rb
include SiSU_Env
include SiSU_Screen
- require "#{SiSU_lib}/relaxng" # relaxng.rb
- include SiSU_relaxng
- require "#{SiSU_lib}/css" # css.rb
+ 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
- SiSU_Config.new(@opt).make_homepage
- SiSU_Config.new(@opt).css
- SiSU_Config.new(@opt).dtd
- SiSU_Config.new(@opt).cp_local_images
- SiSU_Config.new(@opt).cp_external_images
- SiSU_Config.new(@opt).cp_webserver_images #if @opt.mod.inspect =~/--init(?:ialize)?=site/
+ ConfigSite.new(@opt).make_homepage
+ ConfigSite.new(@opt).css
+ ConfigSite.new(@opt).dtd
+ ConfigSite.new(@opt).cp_local_images
+ ConfigSite.new(@opt).cp_external_images
+ ConfigSite.new(@opt).cp_webserver_images #if @opt.mod.inspect =~/--init(?:ialize)?=site/
end
end
- class SiSU_Config #config files such as css are not updated if they already exist unless forced using the --init=site modifier
- require 'fileutils'
- require "#{SiSU_lib}/sysenv" # sysenv.rb
- include FileUtils #::Verbose
+ class ConfigSite #config files such as css are not updated if they already exist unless forced using the --init=site modifier
+ require_relative 'sysenv' # sysenv.rb
def initialize(opt)
@opt=opt
- @env=SiSU_Env::Info_env.new(@opt.fns)
+ @env=SiSU_Env::InfoEnv.new(@opt.fns)
@suffix,@path={},{}
@suffix[:rnc]='rnc'
@suffix[:rng]='rng'
@@ -96,31 +93,30 @@ module SiSU_Initialize
end
def make_homepage
SiSU_Screen::Ansi.new(@opt.cmd,'invert','Make homepage','').colorize unless @opt.cmd =~/q/
- SiSU_Env::Create_site.new(@opt.cmd).homepage
+ SiSU_Env::CreateSite.new(@opt.cmd).homepage
end
def cp_local_images
SiSU_Screen::Ansi.new(@opt.cmd,'invert','Copy images','').colorize unless @opt.cmd =~/q/
- SiSU_Env::Create_site.new(@opt.cmd).cp_local_images
- SiSU_Env::Create_site.new(@opt.cmd).cp_webserver_images_local #this should not have been necessary
- SiSU_Env::Create_site.new(@opt.cmd).cp_base_images #base images (nav etc.) used by all html
+ SiSU_Env::CreateSite.new(@opt.cmd).cp_local_images
+ SiSU_Env::CreateSite.new(@opt.cmd).cp_webserver_images_local #this should not have been necessary
+ SiSU_Env::CreateSite.new(@opt.cmd).cp_base_images #base images (nav etc.) used by all html
end
def cp_external_images
SiSU_Screen::Ansi.new(@opt.cmd,'invert','Copy external images','').colorize if @opt.cmd =~/V/
- SiSU_Env::Create_site.new(@opt.cmd).cp_external_images
+ SiSU_Env::CreateSite.new(@opt.cmd).cp_external_images
end
def cp_webserver_images
SiSU_Screen::Ansi.new(@opt.cmd,'invert','Copy webserver/output file images','').colorize unless @opt.cmd =~/q/
- SiSU_Env::Create_site.new(@opt.cmd).cp_webserver_images
- SiSU_Env::Create_system_link.new.images
+ SiSU_Env::CreateSite.new(@opt.cmd).cp_webserver_images
end
def css
SiSU_Screen::Ansi.new(@opt.cmd,'invert','Configuring CSSs','').colorize unless @opt.cmd =~/q/
- SiSU_Env::Create_site.new(@opt.cmd).cp_css
+ SiSU_Env::CreateSite.new(@opt.cmd).cp_css
end
def dtd
SiSU_Screen::Ansi.new(@opt.cmd,'invert','Configuring DTDs','').colorize unless @opt.cmd =~/q/
- @rxng=SiSU_relaxng::RelaxNG.new
- @path.each { |d| mkdir_p(d[1]) unless FileTest.directory?(d[1]) }
+ @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
@@ -161,7 +157,7 @@ module SiSU_Initialize
end
def trang_rnc_model_output_sax
s=@suffix
- rnc_src=@env.path.dal + '/sax.' + s[:rnc]
+ rnc_src=@env.processing_path.dal + '/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
@@ -169,18 +165,21 @@ module SiSU_Initialize
rnc << @rxng.rnc_model_output_sax
rnc.close
#xsd
- schema=SiSU_Env::System_call.new(rnc_src,xsd_file)
+ schema=SiSU_Env::SystemCall.new(rnc_src,xsd_file)
schema.relaxng(@opt.cmd)
#rng
- schema=SiSU_Env::System_call.new(rnc_src,rng_file)
+ schema=SiSU_Env::SystemCall.new(rnc_src,rng_file)
schema.relaxng(@opt.cmd)
#rnc
- cp(rnc_src,rnc_file)
- chmod(0644,rnc_file)
+ 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.path.dal + '/dom.' + s[:rnc]
+ rnc_src=@env.processing_path.dal + '/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
@@ -188,18 +187,21 @@ module SiSU_Initialize
rnc << @rxng.rnc_model_output_dom
rnc.close
#xsd
- schema=SiSU_Env::System_call.new(rnc_src,xsd_file)
+ schema=SiSU_Env::SystemCall.new(rnc_src,xsd_file)
schema.relaxng(@opt.cmd)
#rng
- schema=SiSU_Env::System_call.new(rnc_src,rng_file)
+ schema=SiSU_Env::SystemCall.new(rnc_src,rng_file)
schema.relaxng(@opt.cmd)
#rnc
- cp(rnc_src,rnc_file)
- chmod(0644,rnc_file)
+ 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.path.dal + '/xhtml.' + s[:rnc]
+ rnc_src=@env.processing_path.dal + '/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
@@ -207,41 +209,44 @@ module SiSU_Initialize
rnc << @rxng.rnc_model_output_xhtml
rnc.close
#xsd
- schema=SiSU_Env::System_call.new(rnc_src,xsd_file)
+ schema=SiSU_Env::SystemCall.new(rnc_src,xsd_file)
schema.relaxng(@opt.cmd)
#rng
- schema=SiSU_Env::System_call.new(rnc_src,rng_file)
+ schema=SiSU_Env::SystemCall.new(rnc_src,rng_file)
schema.relaxng(@opt.cmd)
#rnc
- cp(rnc_src,rnc_file)
- chmod(0644,rnc_file)
+ 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.path.dal + '/sax.rnc'
+ rnc_file=@env.processing_path.dal + '/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::System_call.new(rnc_file,dtd_file)
+ schema=SiSU_Env::SystemCall.new(rnc_file,dtd_file)
schema.relaxng(@opt.cmd)
end
def trang_rnc_model_input_dom
- rnc_file=@env.path.dal + '/dom.rnc'
+ rnc_file=@env.processing_path.dal + '/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::System_call.new(rnc_file,dtd_file)
+ schema=SiSU_Env::SystemCall.new(rnc_file,dtd_file)
schema.relaxng(@opt.cmd)
end
def trang_rnc_model_input_node
- rnc_file=@env.path.dal + '/node.rnc'
- rng_file=@env.path.dal + '/node.rng'
+ rnc_file=@env.processing_path.dal + '/node.rnc'
+ rng_file=@env.processing_path.dal + '/node.rng'
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::System_call.new(rnc_file,dtd_file)
+ schema=SiSU_Env::SystemCall.new(rnc_file,dtd_file)
schema.relaxng(@opt.cmd)
end
end
diff --git a/lib/sisu/v4/constants.rb b/lib/sisu/v4/constants.rb
new file mode 100644
index 00000000..af5c13a4
--- /dev/null
+++ b/lib/sisu/v4/constants.rb
@@ -0,0 +1,296 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+ constants
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: system environment, resource control and configuration details
+
+=end
+#Ax,Xx,Mx,Rx,Hx,Dx,Px,Ep,Db,Gt,Tex=Array.new(11){{}}
+YEAR='2012'
+Sfx={ txt: '.txt', html: '.html', xhtml: '.xhtml', xml: '.xml', epub: '.epub', epub_xhtml: '.xhtml', odt: '.odt', pdf: '.pdf'}
+Ax={
+ tab: "\t",
+}
+Xx={
+ protect: '☞',
+ segment: 'Ф',
+ relative_path: '☼',
+ html_relative2: '※※',
+ html_relative1: '※',
+}
+Mx={
+ meta_o: '〔@', meta_c: '〕',
+ lv_o_1: 1,
+ lv_o_2: 2,
+ lv_o_3: 3,
+ lv_o_4: 4,
+ lv_o_5: 5,
+ lv_o_6: 6,
+ lv_o_7: 7,
+ lv_o_8: 8,
+ lv_o_9: 9,
+ lv_o: '〔', lv_c: '〕',
+ en_a_o: '【', en_a_c: '】', #endnote Mx[:en_a_o]='~{'; Mx[:en_a_c]='}~'
+ en_b_o: '〖', en_b_c: '〗', #endnote Mx[:en_b_o]='~['; Mx[:en_b_c]=']~'
+ bl_o: '〔', bl_c: '〕', #block text mark
+ gr_o: '〔', gr_c: '〕', #group text mark #REPLACE & RETIRE
+ id_o: '〔', id_c: '〕', #object id mark
+ tc_o: '『', tc_c: "』", #table row mark #Mx[:tc_c]="』\n"
+ tc_p: '┆', #table col/misc mark
+ pa_o: '〔', pa_c: '〕', #affects paragraph mark
+ mk_o: '〔', mk_c: '〕', #generic mark
+ gl_o: '〔', gl_c: '〕', #glyph
+ fa_o: '〔', fa_o_c: '¤', fa_c_o: '¤', fa_c: '〕',
+ idx_o: '▢ ', idx_c: '▢ ',
+ nbsp: '░', #'▭ '
+ br_line: '╱', #lB ▌ 9612 ┘ ¶
+ br_nl: '╲', #lB ▌ 』 ┘
+ br_paragraph: '█', #FB █ 9608 # PP ∥ 8741 #▐ #'┘' #'¶' #FB █ 9608 lB ▌ 9612 RB ▐ 9616
+ br_obj: 'break_obj',
+ br_page: '┼',
+ br_page_new: '╋',
+ lnk_o: '⌠', lnk_c: '⌡', #'⌈' '⌋' '⌠' '⌡' #Mx[:lnk_o: '◁'; Mx[:lnk_c: '▷' #‹ ›
+ url_o: '「', url_c: '」',
+ rel_o: '⌈', rel_c: '⌋',
+ tag_o: '⌊', tag_c: '⌉',
+ sm_set_o: '《', sm_set_c: '》',
+ sm_subset_o: '《 ', sm_subset_c: '》',
+ vline: '┆', # ¦ |
+}
+Mx[:fa_bold_o]= "#{Mx[:fa_o]}b#{Mx[:fa_o_c]}"
+Mx[:fa_bold_c]= "#{Mx[:fa_c_o]}b#{Mx[:fa_c]}"
+Mx[:fa_italics_o]= "#{Mx[:fa_o]}i#{Mx[:fa_o_c]}"
+Mx[:fa_italics_c]= "#{Mx[:fa_c_o]}i#{Mx[:fa_c]}"
+Mx[:fa_underscore_o]= "#{Mx[:fa_o]}u#{Mx[:fa_o_c]}"
+Mx[:fa_underscore_c]= "#{Mx[:fa_c_o]}u#{Mx[:fa_c]}"
+Mx[:fa_cite_o]= "#{Mx[:fa_o]}cite#{Mx[:fa_o_c]}"
+Mx[:fa_cite_c]= "#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}"
+Mx[:fa_insert_o]= "#{Mx[:fa_o]}ins#{Mx[:fa_o_c]}"
+Mx[:fa_insert_c]= "#{Mx[:fa_c_o]}ins#{Mx[:fa_c]}"
+Mx[:fa_strike_o]= "#{Mx[:fa_o]}del#{Mx[:fa_o_c]}"
+Mx[:fa_strike_c]= "#{Mx[:fa_c_o]}del#{Mx[:fa_c]}"
+Mx[:fa_superscript_o]= "#{Mx[:fa_o]}sup#{Mx[:fa_o_c]}"
+Mx[:fa_superscript_c]= "#{Mx[:fa_c_o]}sup#{Mx[:fa_c]}"
+Mx[:fa_subscript_o]= "#{Mx[:fa_o]}sub#{Mx[:fa_o_c]}"
+Mx[:fa_subscript_c]= "#{Mx[:fa_c_o]}sub#{Mx[:fa_c]}"
+Mx[:fa_hilite_o]= "#{Mx[:fa_o]}hi#{Mx[:fa_o_c]}"
+Mx[:fa_hilite_c]= "#{Mx[:fa_c_o]}hi#{Mx[:fa_c]}"
+Mx[:fa_monospace_o]= "#{Mx[:fa_o]}mono#{Mx[:fa_o_c]}"
+Mx[:fa_monospace_c]= "#{Mx[:fa_c_o]}mono#{Mx[:fa_c]}"
+Mx[:gl_bullet]= "#{Mx[:gl_o]}●#{Mx[:gl_c]}"
+Mx[:br_endnotes]= "#{Mx[:mk_o]}ENDNOTES#{Mx[:mk_c]}"
+Mx[:br_eof]= "#{Mx[:mk_o]}EOF#{Mx[:mk_c]}"
+Mx[:pa_non_object_dummy_heading]="#{Mx[:pa_o]}-##{Mx[:pa_c]}" #unnumbered paragraph, delete when not required [used in dummy headings, eg. for segmented html] (place marker at end of paragraph)
+Mx[:pa_non_object_no_heading]="#{Mx[:pa_o]}~##{Mx[:pa_c]}" #unnumbered paragraph (place marker at end of paragraph)
+Hx={
+ br_obj: { obj: Mx[:br_obj] }, # line sep
+ br_page: { obj: Mx[:br_page] }, # newpage
+ br_page_new: { obj: Mx[:br_page_new] }, # clearpage
+}
+#Mx[:sm_set_o]='∈ '; Mx[:sm_set_c]='∋ '
+#Mx[:sm_subset_o]='∈ '; Mx[:sm_subset_c]='∋ '
+Rx={
+ mx_fa_clean: /#{Mx[:fa_o]}.+?#{Mx[:fa_c]}|#{Mx[:pa_o]}.+?#{Mx[:pa_c]}|#{Mx[:mk_o]}.+?#{Mx[:mk_c]}/,
+ lv: /〔([1-9]):(\S*?)〕/,
+ lv_1: /#{Mx[:lv_o_1]}(\S*?)#{Mx[:lv_c]}/,
+ lv_2: /#{Mx[:lv_o_2]}(\S*?)#{Mx[:lv_c]}/,
+ lv_3: /#{Mx[:lv_o_3]}(\S*?)#{Mx[:lv_c]}/,
+ lv_4: /#{Mx[:lv_o_4]}(\S*?)#{Mx[:lv_c]}/,
+ lv_5: /#{Mx[:lv_o_5]}(\S*?)#{Mx[:lv_c]}/,
+ lv_6: /#{Mx[:lv_o_6]}(\S*?)#{Mx[:lv_c]}/,
+ lv_7: /#{Mx[:lv_o_7]}(\S*?)#{Mx[:lv_c]}/,
+ lv_8: /#{Mx[:lv_o_8]}(\S*?)#{Mx[:lv_c]}/,
+ lv_9: /#{Mx[:lv_o_9]}(\S*?)#{Mx[:lv_c]}/,
+ meta: /#{Mx[:meta_o]}(\S+?)#{Mx[:meta_c]}/,
+}
+Dx={
+ url_o: '‹', url_c: '›',
+ url_o_xml: '&lt;', url_c_xml: '&gt;',
+ rel_o: '‹', rel_c: '›',
+ lt_xml: '&lt;', gt_xml: '&gt;',
+}
+Tex={
+ backslash: "\\\\",
+ backslash: "\\\\",
+ tilde: '\\\\\\~',
+}
+Px={
+ bold_o: '*', bold_c: '*',
+ italics_o: '/', italics_c: '/',
+ underscore_o: '_', underscore_c: '_',
+ #emphasis_o: '*', emphasis_c: '*',
+ #bold_o: '!', bold_c: '!',
+ cite_o: '"', cite_c: '"',
+ insert_o: '+', insert_c: '+',
+ strike_o: '-', strike_c: '-',
+ superscript_o: '^', superscript_c: '^',
+ subscript_o: '[', subscript_c: ']',
+ hilite_o: '*', hilite_c: '*',
+ monospace_o: '', monospace_c: '',
+ po_bold_o: '!{', po_bold_c: '}!',
+ po_italics_o: '/{', po_italics_c: '}/',
+ po_underscore_o: '_{', po_underscore_c: '}_',
+ po_cite_o: '"{', po_cite_c: '}"',
+ po_insert_o: '+{', po_insert_c: '}+',
+ po_strike_o: '-{', po_strike_c: '}-',
+ po_superscript_o: '^{', po_superscript_c: '}^',
+ po_subscript_o: ',{', po_subscript_c: '},',
+ po_hilite_o: '*{', po_hilite_c: '}*',
+ po_monospace_o: '#{', po_monospace_c: '}#',
+ 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 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],
+ lv1: '*',
+ lv2: '=',
+ lv3: '=',
+ lv4: '-',
+ lv5: '.',
+ lv6: '.',
+}
+Px[:lng_lst_rgx]=Px[:lng_lst].join('|')
+Ep={
+ d_oebps: 'OEBPS',
+ f_ncx: 'toc.ncx',
+ f_opf: 'content.opf',
+}
+Db={
+ name_prefix: "SiSU#{SiSU_version_dir}a_",
+ name_prefix_db: "sisu_#{SiSU_version_dir}a_",
+ col_title: 800,
+ col_title_part: 400,
+ col_title_edition: 10,
+ col_name: 600,
+ col_creator_misc_short: 100,
+ col_language: 100,
+ col_language_char: 6,
+ col_date_text: 10,
+ col_txt_long: 600,
+ col_txt_short: 200,
+ col_identify_hash: 256,
+ col_library: 30,
+ col_small: 16,
+ col_filename: 256,
+ col_digest: 64,
+ col_filesize: 10,
+ col_info_note: 2500,
+}
+Gt={
+ grotto: 'sisu_src',
+ git: 'sisu:',
+ src: 'src',
+ pods: 'pods',
+ sisupod: 'sisupod',
+ pod: 'pod',
+ files: 'files',
+ doc: 'doc',
+ po: 'po4a/po',
+ pot: 'po4a/pot',
+ image: 'image',
+ audio: 'audio',
+ video: 'video',
+ conf: 'doc/_sisu',
+}
+S_CONF={
+ header_make: 'sisu_document_make',
+ rc_yml: 'sisurc.yml',
+}
+DISABLE={
+ epub: {
+ internal_navigation: true,
+ per_section_title: true,
+ ncx_navpoint_unique_id: true,
+ },
+}
+DEVELOPER={
+ maintenance: :false,
+}
+__END__
+consider:
+ 〔comment〕
+ 〔links?????〕
+ import document?
+check:
+ bold line
+
+┆┆⋮┇┊┋
+『』
+「」
+〔〕
+【】
+
+ #˝ " λ Ω β α π Ѫ Ж Я Ѳ ѳ Ф ㈣
+ Ѳ ѳ Ф
+ ♩ ♭  ✠  ▭ ▬ ▪
+【】〖〗《》「」
+ ‹ › ∗ 
+'〔lv1〕','〔lv2〕','〔lv3〕','〔lv4〕','〔lv5〕','〔lv6〕','〔lv7〕','〔lv8〕','〔lv9〕'
+'〔 Ѳ1〕','〔 Ѳ2〕','〔 Ѳ3〕','〔 Ѳ4〕','〔 Ѳ5〕','〔Ѳ6〕','〔Ѳ7〕','〔Ѳ8〕','〔Ѳ9〕'
+◁▷
+◀this is text or an image▶ http://
+p __FILE__ +':'+ __LINE__.to_s
+p __FILE__ + ' ' + __LINE__.to_s + ' ' + html
+puts "#{__FILE__} #{__LINE__} #{o.inspect}"
+puts __FILE__ + ' ' + __LINE__.to_s + '--> ' + o.inspect
+puts %{-\t#{__FILE__}::#{__LINE__}::#{caller}:\n"#{name}"}
+p "\t" + txt.obj + " << #{__FILE__} #{__LINE__} >>"
+p (__FILE__ + ' ' + __LINE__.to_s + '--> ' + dob.inspect) if dob.is==:heading
+data.each {|o| p (__FILE__ + ' ' + __LINE__.to_s + '--> ' + o.inspect) if o.is==:heading}
+puts "#{__FILE__} #{__LINE__} #{para}" if @opt.cmd =~/M/
+puts "#{__FILE__} #{__LINE__} #{t_o}" if @opt.cmd =~/M/
+ dr ┌ 9484 dR ┍ 9485 Dr ┎ 9486 DR ┏ 9487 dl ┐ 9488 dL ┑ 9489 Dl ┒ 9490 LD ┓ 9491 ur └ 9492 uR ┕ 9493 Ur ┖ 9494 UR ┗ 9495 ul ┘ 9496 uL ┙ 9497 Ul ┚ 9498 UL ┛ 9499 vr ├
+ dr ┌ 9484 dR ┍ 9485 Dr ┎ 9486 DR ┏ 9487 dl ┐ 9488 dL ┑ 9489 Dl ┒ 9490 LD ┓ 9491 ur └ 9492 uR ┕ 9493 Ur ┖ 9494 UR ┗ 9495 ul ┘ 9496 uL ┙ 9497 Ul ┚ 9498 UL ┛ 9499 vr ├
+ └ ┘
+Iu ⌠ 8992 Il ⌡ <7 ⌈ 8968 >7 ⌉ 8969 7< ⌊ 8970 7> ⌋ 8971
+<" 『 12302 >" 』 12303
+<' 「 12300 >' 」 12301
diff --git a/lib/sisu/v2/css.rb b/lib/sisu/v4/css.rb
index 9856c0d0..f723853f 100644
--- a/lib/sisu/v2/css.rb
+++ b/lib/sisu/v4/css.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -57,11 +56,103 @@
=end
module SiSU_Style
- require "#{SiSU_lib}/sysenv" # sysenv.rb
- require "#{SiSU_lib}/defaults" # defaults.rb
+ require_relative 'sysenv' # sysenv.rb
+ require_relative 'defaults' # defaults.rb
+ class CSS_HeadInfo
+ def initialize(md,ft='html')
+ @md,@ft=md,ft
+ @env=SiSU_Env::InfoEnv.new('',md)
+ @fn_css ||=SiSU_Env::CSS_Default.new
+ @o_str ||=SiSU_Env::ProcessingSettings.new(md).output_dir_structure
+ css_copy
+ end
+ def stylesheet
+ def css_path
+ SiSU_Env::CSS_Stylesheet.new(@md)
+ end
+ def css_embed_content
+ @css_embed_content ||=SiSU_Style::CSS.new
+ end
+ def css_embed?
+ if @ft=='html' \
+ && @o_str.dump_or_redirect?
+ true
+ else
+ false
+ end
+ end
+ def css_embed(css)
+ <<-WOK
+ <style TYPE="text/css">
+ #{css}
+ </style>
+ WOK
+ end
+ def css_action
+ style_css=SiSU_Style::CSS.new
+ css=case @ft
+ when 'html'
+ css=css_embed_content.html
+ css_embed(css)
+ when 'xhtml'
+ css_path.xhtml
+ when 'xml_sax'
+ css_path.xml_sax
+ when 'xml_dom'
+ css_path.xml_dom
+ else
+ css_embed_content.html
+ end
+ end
+ def css_head
+ (css_embed?) \
+ ? css_action
+ : "#{css_path.html}#{css_path.html_seg}"
+ end
+ def css_head_seg
+ (css_embed?) \
+ ? css_action
+ : css_path.html_seg
+ end
+ def css_head_xml
+ css_action
+ end
+ self
+ end
+ def css_copy
+ if @o_str.dump_or_redirect?
+ css=SiSU_Style::CSS.new
+ if @o_str.dump?
+ css_pth="#{@md.opt.opt_act[:dump][:inst]}/#{@env.path.style}"
+ elsif @o_str.redirect?
+ css_pth="#{@md.opt.opt_act[:redirect][:inst]}/#{@md.fnb}/#{@env.path.style}"
+ end
+ FileUtils::mkdir_p(css_pth) unless FileTest.directory?(css_pth)
+ case @ft
+ when 'html'
+ style=File.new("#{css_pth}/#{@fn_css.html}",'w')
+ style << css.html
+ style.close
+ when 'xhtml'
+ style=File.new("#{css_pth}/#{@fn_css.xhtml}",'w')
+ style << css.xhtml
+ style.close
+ when 'xml_sax'
+ style=File.new("#{css_pth}/#{@fn_css.xml_sax}",'w')
+ style << css.xml_sax
+ style.close
+ when 'xml_dom'
+ style=File.new("#{css_pth}/#{@fn_css.xml_dom}",'w')
+ style << css.xml_dom
+ style.close
+ css_path.xml_dom
+ end
+ end
+ end
+ end
class CSS
def initialize
- @vz=SiSU_Env::Get_init.instance.skin
+ @vz=SiSU_Viz::Defaults.new
end
def fonts
@vz.font_fonts
@@ -336,13 +427,14 @@ WOK
background-color: #aaaaaa;
}
- .norm, .bold, .verse, .group, .alt {
+ .norm, .bold, .verse, .group, .block, .alt {
line-height: 150%;
margin-left: 0em;
margin-right: 2em;
margin-top: 10px;
margin-bottom: 0px;
- text-indent: 0mm;
+ padding-left: 0em;
+ text-indent: 0em;
}
p, h0, h1, h2, h3, h4, h5, h6 {
display: block;
@@ -357,16 +449,431 @@ WOK
margin-top: 3px;
margin-bottom: 3px;
}
+
+ /* indent */
+
p.norm { }
- p.i1 {margin-left: 1em;}
- p.i2 {margin-left: 2em;}
- p.i3 {margin-left: 3em;}
- p.i4 {margin-left: 4em;}
- p.i5 {margin-left: 5em;}
- p.i6 {margin-left: 6em;}
- p.i7 {margin-left: 7em;}
- p.i8 {margin-left: 8em;}
- p.i9 {margin-left: 9em;}
+ p.i1 {padding-left: 1em;}
+ p.i2 {padding-left: 2em;}
+ p.i3 {padding-left: 3em;}
+ p.i4 {padding-left: 4em;}
+ p.i5 {padding-left: 5em;}
+ p.i6 {padding-left: 6em;}
+ p.i7 {padding-left: 7em;}
+ p.i8 {padding-left: 8em;}
+ p.i9 {padding-left: 9em;}
+
+ /* hanging indent */
+
+ p.h0i0 {
+ padding-left: 0em;
+ text-indent: 0em;
+ }
+ p.h0i1 {
+ padding-left: 1em;
+ text-indent: -1em;
+ }
+ p.h0i2 {
+ padding-left: 2em;
+ text-indent: -2em;
+ }
+ p.h0i3 {
+ padding-left: 3em;
+ text-indent: -3em;
+ }
+ p.h0i4 {
+ padding-left: 4em;
+ text-indent: -4em;
+ }
+ p.h0i5 {
+ padding-left: 5em;
+ text-indent: -5em;
+ }
+ p.h0i6 {
+ padding-left: 6em;
+ text-indent: -6em;
+ }
+ p.h0i7 {
+ padding-left: 7em;
+ text-indent: -7em;
+ }
+ p.h0i8 {
+ padding-left: 8em;
+ text-indent: -8em;
+ }
+ p.h0i9 {
+ padding-left: 9em;
+ text-indent: -9em;
+ }
+
+ p.h1i0 {
+ padding-left: 0em;
+ text-indent: 1em;
+ }
+ p.h1i1 {
+ padding-left: 1em;
+ text-indent: 0em;
+ }
+ p.h1i2 {
+ padding-left: 2em;
+ text-indent: -1em;
+ }
+ p.h1i3 {
+ padding-left: 3em;
+ text-indent: -2em;
+ }
+ p.h1i4 {
+ padding-left: 4em;
+ text-indent: -3em;
+ }
+ p.h1i5 {
+ padding-left: 5em;
+ text-indent: -4em;
+ }
+ p.h1i6 {
+ padding-left: 6em;
+ text-indent: -5em;
+ }
+ p.h1i7 {
+ padding-left: 7em;
+ text-indent: -6em;
+ }
+ p.h1i8 {
+ padding-left: 8em;
+ text-indent: -7em;
+ }
+ p.h1i9 {
+ padding-left: 9em;
+ text-indent: -8em;
+ }
+
+ p.h2i0 {
+ padding-left: 0em;
+ text-indent: 2em;
+ }
+ p.h2i1 {
+ padding-left: 1em;
+ text-indent: 1em;
+ }
+ p.h2i2 {
+ padding-left: 2em;
+ text-indent: 0em;
+ }
+ p.h2i3 {
+ padding-left: 3em;
+ text-indent: -1em;
+ }
+ p.h2i4 {
+ padding-left: 4em;
+ text-indent: -2em;
+ }
+ p.h2i5 {
+ padding-left: 5em;
+ text-indent: -3em;
+ }
+ p.h2i6 {
+ padding-left: 6em;
+ text-indent: -4em;
+ }
+ p.h2i7 {
+ padding-left: 7em;
+ text-indent: -5em;
+ }
+ p.h2i8 {
+ padding-left: 8em;
+ text-indent: -6em;
+ }
+ p.h2i9 {
+ padding-left: 9em;
+ text-indent: -7em;
+ }
+
+ p.h3i0 {
+ padding-left: 0em;
+ text-indent: 3em;
+ }
+ p.h3i1 {
+ padding-left: 1em;
+ text-indent: 2em;
+ }
+ p.h3i2 {
+ padding-left: 2em;
+ text-indent: 1em;
+ }
+ p.h3i3 {
+ padding-left: 3em;
+ text-indent: 0em;
+ }
+ p.h3i4 {
+ padding-left: 4em;
+ text-indent: -1em;
+ }
+ p.h3i5 {
+ padding-left: 5em;
+ text-indent: -2em;
+ }
+ p.h3i6 {
+ padding-left: 6em;
+ text-indent: -3em;
+ }
+ p.h3i7 {
+ padding-left: 7em;
+ text-indent: -4em;
+ }
+ p.h3i8 {
+ padding-left: 8em;
+ text-indent: -5em;
+ }
+ p.h3i9 {
+ padding-left: 9em;
+ text-indent: -6em;
+ }
+
+ p.h4i0 {
+ padding-left: 0em;
+ text-indent: 4em;
+ }
+ p.h4i1 {
+ padding-left: 1em;
+ text-indent: 3em;
+ }
+ p.h4i2 {
+ padding-left: 2em;
+ text-indent: 2em;
+ }
+ p.h4i3 {
+ padding-left: 3em;
+ text-indent: 1em;
+ }
+ p.h4i4 {
+ padding-left: 4em;
+ text-indent: 0em;
+ }
+ p.h4i5 {
+ padding-left: 5em;
+ text-indent: -1em;
+ }
+ p.h4i6 {
+ padding-left: 6em;
+ text-indent: -2em;
+ }
+ p.h4i7 {
+ padding-left: 7em;
+ text-indent: -3em;
+ }
+ p.h4i8 {
+ padding-left: 8em;
+ text-indent: -4em;
+ }
+ p.h4i9 {
+ padding-left: 9em;
+ text-indent: -5em;
+ }
+
+ p.h5i0 {
+ padding-left: 0em;
+ text-indent: 5em;
+ }
+ p.h5i1 {
+ padding-left: 1em;
+ text-indent: 4em;
+ }
+ p.h5i2 {
+ padding-left: 2em;
+ text-indent: 3em;
+ }
+ p.h5i3 {
+ padding-left: 3em;
+ text-indent: 2em;
+ }
+ p.h5i4 {
+ padding-left: 4em;
+ text-indent: 1em;
+ }
+ p.h5i5 {
+ padding-left: 5em;
+ text-indent: 0em;
+ }
+ p.h5i6 {
+ padding-left: 6em;
+ text-indent: -1em;
+ }
+ p.h5i7 {
+ padding-left: 7em;
+ text-indent: -2em;
+ }
+ p.h5i8 {
+ padding-left: 8em;
+ text-indent: -3em;
+ }
+ p.h5i9 {
+ padding-left: 9em;
+ text-indent: -4em;
+ }
+
+ p.h6i0 {
+ padding-left: 0em;
+ text-indent: 6em;
+ }
+ p.h6i1 {
+ padding-left: 1em;
+ text-indent: 5em;
+ }
+ p.h6i2 {
+ padding-left: 2em;
+ text-indent: 4em;
+ }
+ p.h6i3 {
+ padding-left: 3em;
+ text-indent: 3em;
+ }
+ p.h6i4 {
+ padding-left: 4em;
+ text-indent: 2em;
+ }
+ p.h6i5 {
+ padding-left: 5em;
+ text-indent: 1em;
+ }
+ p.h6i6 {
+ padding-left: 6em;
+ text-indent: 0em;
+ }
+ p.h6i7 {
+ padding-left: 7em;
+ text-indent: -1em;
+ }
+ p.h6i8 {
+ padding-left: 8em;
+ text-indent: -2em;
+ }
+ p.h6i9 {
+ padding-left: 9em;
+ text-indent: -3em;
+ }
+
+ p.h7i0 {
+ padding-left: 0em;
+ text-indent: 7em;
+ }
+ p.h7i1 {
+ padding-left: 1em;
+ text-indent: 6em;
+ }
+ p.h7i2 {
+ padding-left: 2em;
+ text-indent: 5em;
+ }
+ p.h7i3 {
+ padding-left: 3em;
+ text-indent: 4em;
+ }
+ p.h7i4 {
+ padding-left: 4em;
+ text-indent: 3em;
+ }
+ p.h7i5 {
+ padding-left: 5em;
+ text-indent: 2em;
+ }
+ p.h7i6 {
+ padding-left: 6em;
+ text-indent: 1em;
+ }
+ p.h7i7 {
+ padding-left: 7em;
+ text-indent: 0em;
+ }
+ p.h7i8 {
+ padding-left: 8em;
+ text-indent: -1em;
+ }
+ p.h7i9 {
+ padding-left: 9em;
+ text-indent: -2em;
+ }
+
+ p.h8i0 {
+ padding-left: 0em;
+ text-indent: 8em;
+ }
+ p.h8i1 {
+ padding-left: 1em;
+ text-indent: 7em;
+ }
+ p.h8i2 {
+ padding-left: 2em;
+ text-indent: 6em;
+ }
+ p.h8i3 {
+ padding-left: 3em;
+ text-indent: 5em;
+ }
+ p.h8i4 {
+ padding-left: 4em;
+ text-indent: 4em;
+ }
+ p.h8i5 {
+ padding-left: 5em;
+ text-indent: 3em;
+ }
+ p.h8i6 {
+ padding-left: 6em;
+ text-indent: 2em;
+ }
+ p.h8i7 {
+ padding-left: 7em;
+ text-indent: 1em;
+ }
+ p.h8i8 {
+ padding-left: 8em;
+ text-indent: 0em;
+ }
+ p.h8i9 {
+ padding-left: 9em;
+ text-indent: -1em;
+ }
+
+ p.h9i0 {
+ padding-left: 0em;
+ text-indent: 9em;
+ }
+ p.h9i1 {
+ padding-left: 1em;
+ text-indent: 8em;
+ }
+ p.h9i2 {
+ padding-left: 2em;
+ text-indent: 7em;
+ }
+ p.h9i3 {
+ padding-left: 3em;
+ text-indent: 6em;
+ }
+ p.h9i4 {
+ padding-left: 4em;
+ text-indent: 5em;
+ }
+ p.h9i5 {
+ padding-left: 5em;
+ text-indent: 4em;
+ }
+ p.h9i6 {
+ padding-left: 6em;
+ text-indent: 3em;
+ }
+ p.h9i7 {
+ padding-left: 7em;
+ text-indent: 2em;
+ }
+ p.h9i8 {
+ padding-left: 8em;
+ text-indent: 1em;
+ }
+ p.h9i9 {
+ padding-left: 9em;
+ text-indent: 0em;
+ }
p.it0 {
margin-left: 0em;
@@ -429,6 +936,8 @@ WOK
line-height: 100%;
}
+ p.block { }
+
p.group { }
p.alt { }
@@ -1024,12 +1533,12 @@ WOK
padding-left: 1em;
padding-right: 1em;
}
-/*
- div.content {
- margin-left: 1em;
- margin-right: 1em;
+ div.content0, div.main_column0 {
+ margin: 0;
+ padding: 0;
+ border-left: 0% solid #ffffff;
+ padding-left: 5%;
}
-*/
div.scroll {
margin: 0;
padding: 0;
@@ -1337,35 +1846,446 @@ WOK
text-align: left;
}
text[class|="indent0"] {
- margin-left: 10%;
+ padding-left: 10%;
}
text[class|="indent1"] {
- margin-left: 15%;
+ padding-left: 15%;
}
text[class|="indent2"] {
- margin-left: 20%;
+ padding-left: 20%;
}
text[class|="indent3"] {
- margin-left: 25%;
+ padding-left: 25%;
}
text[class|="indent4"] {
- margin-left: 30%;
+ padding-left: 30%;
}
text[class|="indent5"] {
- margin-left: 35%;
+ padding-left: 35%;
}
text[class|="indent6"] {
- margin-left: 40%;
+ padding-left: 40%;
}
text[class|="indent7"] {
- margin-left: 45%;
+ padding-left: 45%;
}
text[class|="indent8"] {
- margin-left: 50%;
+ padding-left: 50%;
}
text[class|="indent9"] {
- margin-left: 55%;
+ padding-left: 55%;
+ }
+
+ text[class|="hang0_indent0"] {
+ padding-left: 10%;
+ text-indent: 0%;
+ }
+ text[class|="hang0_indent1"] {
+ padding-left: 15%;
+ text-indent: -5%;
+ }
+ text[class|="hang0_indent2"] {
+ padding-left: 20%;
+ text-indent: -10%;
+ }
+ text[class|="hang0_indent3"] {
+ padding-left: 25%;
+ text-indent: -15%;
+ }
+ text[class|="hang0_indent4"] {
+ padding-left: 30%;
+ text-indent: -20%;
+ }
+ text[class|="hang0_indent5"] {
+ padding-left: 35%;
+ text-indent: -25%;
+ }
+ text[class|="hang0_indent6"] {
+ padding-left: 40%;
+ text-indent: -30%;
+ }
+ text[class|="hang0_indent7"] {
+ padding-left: 45%;
+ text-indent: -35%;
+ }
+ text[class|="hang0_indent8"] {
+ padding-left: 50%;
+ text-indent: -40%;
+ }
+ text[class|="hang0_indent9"] {
+ padding-left: 55%;
+ text-indent: -45%;
+ }
+
+ text[class|="hang1_indent0"] {
+ padding-left: 10%;
+ text-indent: 5%;
+ }
+ text[class|="hang1_indent1"] {
+ padding-left: 15%;
+ text-indent: 0%;
+ }
+ text[class|="hang1_indent2"] {
+ padding-left: 20%;
+ text-indent: -5%;
+ }
+ text[class|="hang1_indent3"] {
+ padding-left: 25%;
+ text-indent: -10%;
+ }
+ text[class|="hang1_indent4"] {
+ padding-left: 30%;
+ text-indent: -15%;
+ }
+ text[class|="hang1_indent5"] {
+ padding-left: 35%;
+ text-indent: -20%;
+ }
+ text[class|="hang1_indent6"] {
+ padding-left: 40%;
+ text-indent: -25%;
+ }
+ text[class|="hang1_indent7"] {
+ padding-left: 45%;
+ text-indent: -30%;
+ }
+ text[class|="hang1_indent8"] {
+ padding-left: 50%;
+ text-indent: -35%;
+ }
+ text[class|="hang1_indent9"] {
+ padding-left: 55%;
+ text-indent: -40%;
+ }
+
+ text[class|="hang2_indent0"] {
+ padding-left: 10%;
+ text-indent: 10%;
+ }
+ text[class|="hang2_indent1"] {
+ padding-left: 15%;
+ text-indent: 5%;
+ }
+ text[class|="hang2_indent2"] {
+ padding-left: 20%;
+ text-indent: 0%;
+ }
+ text[class|="hang2_indent3"] {
+ padding-left: 25%;
+ text-indent: -5%;
+ }
+ text[class|="hang2_indent4"] {
+ padding-left: 30%;
+ text-indent: -10%;
+ }
+ text[class|="hang2_indent5"] {
+ padding-left: 35%;
+ text-indent: -15%;
+ }
+ text[class|="hang2_indent6"] {
+ padding-left: 40%;
+ text-indent: -20%;
+ }
+ text[class|="hang2_indent7"] {
+ padding-left: 45%;
+ text-indent: -25%;
+ }
+ text[class|="hang2_indent8"] {
+ padding-left: 50%;
+ text-indent: -30%;
+ }
+ text[class|="hang2_indent9"] {
+ padding-left: 55%;
+ text-indent: -35%;
+ }
+
+ text[class|="hang3_indent0"] {
+ padding-left: 10%;
+ text-indent: 15%;
+ }
+ text[class|="hang3_indent1"] {
+ padding-left: 15%;
+ text-indent: 10%;
+ }
+ text[class|="hang3_indent2"] {
+ padding-left: 20%;
+ text-indent: 5%;
+ }
+ text[class|="hang3_indent3"] {
+ padding-left: 25%;
+ text-indent: 0%;
+ }
+ text[class|="hang3_indent4"] {
+ padding-left: 30%;
+ text-indent: -5%;
+ }
+ text[class|="hang3_indent5"] {
+ padding-left: 35%;
+ text-indent: -10%;
+ }
+ text[class|="hang3_indent6"] {
+ padding-left: 40%;
+ text-indent: -15%;
+ }
+ text[class|="hang3_indent7"] {
+ padding-left: 45%;
+ text-indent: -20%;
+ }
+ text[class|="hang3_indent8"] {
+ padding-left: 50%;
+ text-indent: -25%;
+ }
+ text[class|="hang3_indent9"] {
+ padding-left: 55%;
+ text-indent: -30%;
+ }
+
+ text[class|="hang4_indent0"] {
+ padding-left: 10%;
+ text-indent: 20%;
+ }
+ text[class|="hang4_indent1"] {
+ padding-left: 15%;
+ text-indent: 15%;
+ }
+ text[class|="hang4_indent2"] {
+ padding-left: 20%;
+ text-indent: 10%;
+ }
+ text[class|="hang4_indent3"] {
+ padding-left: 25%;
+ text-indent: 5%;
}
+ text[class|="hang4_indent4"] {
+ padding-left: 30%;
+ text-indent: 0%;
+ }
+ text[class|="hang4_indent5"] {
+ padding-left: 35%;
+ text-indent: -5%;
+ }
+ text[class|="hang4_indent6"] {
+ padding-left: 40%;
+ text-indent: -10%;
+ }
+ text[class|="hang4_indent7"] {
+ padding-left: 45%;
+ text-indent: -15%;
+ }
+ text[class|="hang4_indent8"] {
+ padding-left: 50%;
+ text-indent: -20%;
+ }
+ text[class|="hang4_indent9"] {
+ padding-left: 55%;
+ text-indent: -25%;
+ }
+
+ text[class|="hang5_indent0"] {
+ padding-left: 10%;
+ text-indent: 25%;
+ }
+ text[class|="hang5_indent1"] {
+ padding-left: 15%;
+ text-indent: 20%;
+ }
+ text[class|="hang5_indent2"] {
+ padding-left: 20%;
+ text-indent: 15%;
+ }
+ text[class|="hang5_indent3"] {
+ padding-left: 25%;
+ text-indent: 10%;
+ }
+ text[class|="hang5_indent4"] {
+ padding-left: 30%;
+ text-indent: 5%;
+ }
+ text[class|="hang5_indent5"] {
+ padding-left: 35%;
+ text-indent: 0%;
+ }
+ text[class|="hang5_indent6"] {
+ padding-left: 40%;
+ text-indent: -5%;
+ }
+ text[class|="hang5_indent7"] {
+ padding-left: 45%;
+ text-indent: -10%;
+ }
+ text[class|="hang5_indent8"] {
+ padding-left: 50%;
+ text-indent: -15%;
+ }
+ text[class|="hang5_indent9"] {
+ padding-left: 55%;
+ text-indent: -20%;
+ }
+
+ text[class|="hang6_indent0"] {
+ padding-left: 10%;
+ text-indent: 30%;
+ }
+ text[class|="hang6_indent1"] {
+ padding-left: 15%;
+ text-indent: 25%;
+ }
+ text[class|="hang6_indent2"] {
+ padding-left: 20%;
+ text-indent: 20%;
+ }
+ text[class|="hang6_indent3"] {
+ padding-left: 25%;
+ text-indent: 15%;
+ }
+ text[class|="hang6_indent4"] {
+ padding-left: 30%;
+ text-indent: 10%;
+ }
+ text[class|="hang6_indent5"] {
+ padding-left: 35%;
+ text-indent: 5%;
+ }
+ text[class|="hang6_indent6"] {
+ padding-left: 40%;
+ text-indent: 0%;
+ }
+ text[class|="hang6_indent7"] {
+ padding-left: 45%;
+ text-indent: -5%;
+ }
+ text[class|="hang6_indent8"] {
+ padding-left: 50%;
+ text-indent: -10%;
+ }
+ text[class|="hang6_indent9"] {
+ padding-left: 55%;
+ text-indent: -15%;
+ }
+
+ text[class|="hang7_indent0"] {
+ padding-left: 10%;
+ text-indent: 35%;
+ }
+ text[class|="hang7_indent1"] {
+ padding-left: 15%;
+ text-indent: 30%;
+ }
+ text[class|="hang7_indent2"] {
+ padding-left: 20%;
+ text-indent: 25%;
+ }
+ text[class|="hang7_indent3"] {
+ padding-left: 25%;
+ text-indent: 20%;
+ }
+ text[class|="hang7_indent4"] {
+ padding-left: 30%;
+ text-indent: 15%;
+ }
+ text[class|="hang7_indent5"] {
+ padding-left: 35%;
+ text-indent: 10%;
+ }
+ text[class|="hang7_indent6"] {
+ padding-left: 40%;
+ text-indent: 5%;
+ }
+ text[class|="hang7_indent7"] {
+ padding-left: 45%;
+ text-indent: 0%;
+ }
+ text[class|="hang7_indent8"] {
+ padding-left: 50%;
+ text-indent: -5%;
+ }
+ text[class|="hang7_indent9"] {
+ padding-left: 55%;
+ text-indent: -10%;
+ }
+
+ text[class|="hang8_indent0"] {
+ padding-left: 10%;
+ text-indent: 40%;
+ }
+ text[class|="hang8_indent1"] {
+ padding-left: 15%;
+ text-indent: 35%;
+ }
+ text[class|="hang8_indent2"] {
+ padding-left: 20%;
+ text-indent: 30%;
+ }
+ text[class|="hang8_indent3"] {
+ padding-left: 25%;
+ text-indent: 25%;
+ }
+ text[class|="hang8_indent4"] {
+ padding-left: 30%;
+ text-indent: 20%;
+ }
+ text[class|="hang8_indent5"] {
+ padding-left: 35%;
+ text-indent: 15%;
+ }
+ text[class|="hang8_indent6"] {
+ padding-left: 40%;
+ text-indent: 10%;
+ }
+ text[class|="hang8_indent7"] {
+ padding-left: 45%;
+ text-indent: 5%;
+ }
+ text[class|="hang8_indent8"] {
+ padding-left: 50%;
+ text-indent: 0%;
+ }
+ text[class|="hang8_indent9"] {
+ padding-left: 55%;
+ text-indent: -5%;
+ }
+
+ text[class|="hang9_indent0"] {
+ padding-left: 10%;
+ text-indent: 45%;
+ }
+ text[class|="hang9_indent1"] {
+ padding-left: 15%;
+ text-indent: 40%;
+ }
+ text[class|="hang9_indent2"] {
+ padding-left: 20%;
+ text-indent: 35%;
+ }
+ text[class|="hang9_indent3"] {
+ padding-left: 25%;
+ text-indent: 30%;
+ }
+ text[class|="hang9_indent4"] {
+ padding-left: 30%;
+ text-indent: 25%;
+ }
+ text[class|="hang9_indent5"] {
+ padding-left: 35%;
+ text-indent: 20%;
+ }
+ text[class|="hang9_indent6"] {
+ padding-left: 40%;
+ text-indent: 15%;
+ }
+ text[class|="hang9_indent7"] {
+ padding-left: 45%;
+ text-indent: 10%;
+ }
+ text[class|="hang9_indent8"] {
+ padding-left: 50%;
+ text-indent: 5%;
+ }
+ text[class|="hang9_indent9"] {
+ padding-left: 55%;
+ text-indent: 0%;
+ }
+
text[class|="indent_bullet"] {
text-indent: 0%;
}
@@ -1399,7 +2319,7 @@ WOK
text[class|="indent_bullet9"] {
text-indent: 50%;
}
- text[class|="verse"], text[class|="group"], text[class|="code"] {
+ text[class|="verse"], text[class|="block"], text[class|="group"], text[class|="code"] {
text-align: left;
}
ocn {
@@ -1482,6 +2402,23 @@ WOK
p.right, th.right, td.right {
text-align: right;
}
+
+ .svg_outer {
+ display: block;
+ margin-bottom: 0;
+ margin-left: 0;
+ margin-right: 0;
+ margin-top: 0;
+ padding-bottom: 0;
+ padding-left: 0;
+ padding-right: 0;
+ padding-top: 0;
+ text-align: left;
+ }
+ .svg_inner {
+ display: block;
+ text-align: center;
+ }
WOK
end
def xml_sax #stylesheet for xml sax
@@ -1643,61 +2580,481 @@ WOK
font-weight: bold;
text-align: left;
}
+ text[class|="indent0"] {
+ padding-left: 10%;
+ }
text[class|="indent1"] {
- margin-left: 10%;
+ padding-left: 15%;
}
text[class|="indent2"] {
- margin-left: 15%;
+ padding-left: 20%;
}
text[class|="indent3"] {
- margin-left: 20%;
+ padding-left: 25%;
}
text[class|="indent4"] {
- margin-left: 25%;
+ padding-left: 30%;
}
text[class|="indent5"] {
- margin-left: 30%;
+ padding-left: 35%;
}
text[class|="indent6"] {
- margin-left: 35%;
+ padding-left: 40%;
}
text[class|="indent7"] {
- margin-left: 40%;
+ padding-left: 45%;
}
text[class|="indent8"] {
- margin-left: 45%;
+ padding-left: 50%;
}
text[class|="indent9"] {
- margin-left: 50%;
+ padding-left: 55%;
+ }
+
+ text[class|="hang0_indent0"] {
+ padding-left: 10%;
+ text-indent: 0%;
+ }
+ text[class|="hang0_indent1"] {
+ padding-left: 15%;
+ text-indent: -5%;
+ }
+ text[class|="hang0_indent2"] {
+ padding-left: 20%;
+ text-indent: -10%;
+ }
+ text[class|="hang0_indent3"] {
+ padding-left: 25%;
+ text-indent: -15%;
+ }
+ text[class|="hang0_indent4"] {
+ padding-left: 30%;
+ text-indent: -20%;
+ }
+ text[class|="hang0_indent5"] {
+ padding-left: 35%;
+ text-indent: -25%;
+ }
+ text[class|="hang0_indent6"] {
+ padding-left: 40%;
+ text-indent: -30%;
+ }
+ text[class|="hang0_indent7"] {
+ padding-left: 45%;
+ text-indent: -35%;
+ }
+ text[class|="hang0_indent8"] {
+ padding-left: 50%;
+ text-indent: -40%;
+ }
+ text[class|="hang0_indent9"] {
+ padding-left: 55%;
+ text-indent: -45%;
+ }
+
+ text[class|="hang1_indent0"] {
+ padding-left: 10%;
+ text-indent: 5%;
+ }
+ text[class|="hang1_indent1"] {
+ padding-left: 15%;
+ text-indent: 0%;
+ }
+ text[class|="hang1_indent2"] {
+ padding-left: 20%;
+ text-indent: -5%;
+ }
+ text[class|="hang1_indent3"] {
+ padding-left: 25%;
+ text-indent: -10%;
+ }
+ text[class|="hang1_indent4"] {
+ padding-left: 30%;
+ text-indent: -15%;
+ }
+ text[class|="hang1_indent5"] {
+ padding-left: 35%;
+ text-indent: -20%;
+ }
+ text[class|="hang1_indent6"] {
+ padding-left: 40%;
+ text-indent: -25%;
+ }
+ text[class|="hang1_indent7"] {
+ padding-left: 45%;
+ text-indent: -30%;
+ }
+ text[class|="hang1_indent8"] {
+ padding-left: 50%;
+ text-indent: -35%;
+ }
+ text[class|="hang1_indent9"] {
+ padding-left: 55%;
+ text-indent: -40%;
+ }
+
+ text[class|="hang2_indent0"] {
+ padding-left: 10%;
+ text-indent: 10%;
+ }
+ text[class|="hang2_indent1"] {
+ padding-left: 15%;
+ text-indent: 5%;
+ }
+ text[class|="hang2_indent2"] {
+ padding-left: 20%;
+ text-indent: 0%;
+ }
+ text[class|="hang2_indent3"] {
+ padding-left: 25%;
+ text-indent: -5%;
+ }
+ text[class|="hang2_indent4"] {
+ padding-left: 30%;
+ text-indent: -10%;
+ }
+ text[class|="hang2_indent5"] {
+ padding-left: 35%;
+ text-indent: -15%;
+ }
+ text[class|="hang2_indent6"] {
+ padding-left: 40%;
+ text-indent: -20%;
+ }
+ text[class|="hang2_indent7"] {
+ padding-left: 45%;
+ text-indent: -25%;
+ }
+ text[class|="hang2_indent8"] {
+ padding-left: 50%;
+ text-indent: -30%;
+ }
+ text[class|="hang2_indent9"] {
+ padding-left: 55%;
+ text-indent: -35%;
+ }
+
+ text[class|="hang3_indent0"] {
+ padding-left: 10%;
+ text-indent: 15%;
+ }
+ text[class|="hang3_indent1"] {
+ padding-left: 15%;
+ text-indent: 10%;
+ }
+ text[class|="hang3_indent2"] {
+ padding-left: 20%;
+ text-indent: 5%;
+ }
+ text[class|="hang3_indent3"] {
+ padding-left: 25%;
+ text-indent: 0%;
+ }
+ text[class|="hang3_indent4"] {
+ padding-left: 30%;
+ text-indent: -5%;
+ }
+ text[class|="hang3_indent5"] {
+ padding-left: 35%;
+ text-indent: -10%;
+ }
+ text[class|="hang3_indent6"] {
+ padding-left: 40%;
+ text-indent: -15%;
+ }
+ text[class|="hang3_indent7"] {
+ padding-left: 45%;
+ text-indent: -20%;
+ }
+ text[class|="hang3_indent8"] {
+ padding-left: 50%;
+ text-indent: -25%;
+ }
+ text[class|="hang3_indent9"] {
+ padding-left: 55%;
+ text-indent: -30%;
+ }
+
+ text[class|="hang4_indent0"] {
+ padding-left: 10%;
+ text-indent: 20%;
+ }
+ text[class|="hang4_indent1"] {
+ padding-left: 15%;
+ text-indent: 15%;
+ }
+ text[class|="hang4_indent2"] {
+ padding-left: 20%;
+ text-indent: 10%;
+ }
+ text[class|="hang4_indent3"] {
+ padding-left: 25%;
+ text-indent: 5%;
+ }
+ text[class|="hang4_indent4"] {
+ padding-left: 30%;
+ text-indent: 0%;
+ }
+ text[class|="hang4_indent5"] {
+ padding-left: 35%;
+ text-indent: -5%;
+ }
+ text[class|="hang4_indent6"] {
+ padding-left: 40%;
+ text-indent: -10%;
+ }
+ text[class|="hang4_indent7"] {
+ padding-left: 45%;
+ text-indent: -15%;
+ }
+ text[class|="hang4_indent8"] {
+ padding-left: 50%;
+ text-indent: -20%;
+ }
+ text[class|="hang4_indent9"] {
+ padding-left: 55%;
+ text-indent: -25%;
+ }
+
+ text[class|="hang5_indent0"] {
+ padding-left: 10%;
+ text-indent: 25%;
+ }
+ text[class|="hang5_indent1"] {
+ padding-left: 15%;
+ text-indent: 20%;
+ }
+ text[class|="hang5_indent2"] {
+ padding-left: 20%;
+ text-indent: 15%;
+ }
+ text[class|="hang5_indent3"] {
+ padding-left: 25%;
+ text-indent: 10%;
+ }
+ text[class|="hang5_indent4"] {
+ padding-left: 30%;
+ text-indent: 5%;
+ }
+ text[class|="hang5_indent5"] {
+ padding-left: 35%;
+ text-indent: 0%;
+ }
+ text[class|="hang5_indent6"] {
+ padding-left: 40%;
+ text-indent: -5%;
+ }
+ text[class|="hang5_indent7"] {
+ padding-left: 45%;
+ text-indent: -10%;
+ }
+ text[class|="hang5_indent8"] {
+ padding-left: 50%;
+ text-indent: -15%;
+ }
+ text[class|="hang5_indent9"] {
+ padding-left: 55%;
+ text-indent: -20%;
+ }
+
+ text[class|="hang6_indent0"] {
+ padding-left: 10%;
+ text-indent: 30%;
+ }
+ text[class|="hang6_indent1"] {
+ padding-left: 15%;
+ text-indent: 25%;
+ }
+ text[class|="hang6_indent2"] {
+ padding-left: 20%;
+ text-indent: 20%;
+ }
+ text[class|="hang6_indent3"] {
+ padding-left: 25%;
+ text-indent: 15%;
+ }
+ text[class|="hang6_indent4"] {
+ padding-left: 30%;
+ text-indent: 10%;
+ }
+ text[class|="hang6_indent5"] {
+ padding-left: 35%;
+ text-indent: 5%;
+ }
+ text[class|="hang6_indent6"] {
+ padding-left: 40%;
+ text-indent: 0%;
+ }
+ text[class|="hang6_indent7"] {
+ padding-left: 45%;
+ text-indent: -5%;
+ }
+ text[class|="hang6_indent8"] {
+ padding-left: 50%;
+ text-indent: -10%;
+ }
+ text[class|="hang6_indent9"] {
+ padding-left: 55%;
+ text-indent: -15%;
+ }
+
+ text[class|="hang7_indent0"] {
+ padding-left: 10%;
+ text-indent: 35%;
+ }
+ text[class|="hang7_indent1"] {
+ padding-left: 15%;
+ text-indent: 30%;
+ }
+ text[class|="hang7_indent2"] {
+ padding-left: 20%;
+ text-indent: 25%;
+ }
+ text[class|="hang7_indent3"] {
+ padding-left: 25%;
+ text-indent: 20%;
+ }
+ text[class|="hang7_indent4"] {
+ padding-left: 30%;
+ text-indent: 15%;
+ }
+ text[class|="hang7_indent5"] {
+ padding-left: 35%;
+ text-indent: 10%;
+ }
+ text[class|="hang7_indent6"] {
+ padding-left: 40%;
+ text-indent: 5%;
+ }
+ text[class|="hang7_indent7"] {
+ padding-left: 45%;
+ text-indent: 0%;
+ }
+ text[class|="hang7_indent8"] {
+ padding-left: 50%;
+ text-indent: -5%;
+ }
+ text[class|="hang7_indent9"] {
+ padding-left: 55%;
+ text-indent: -10%;
+ }
+
+ text[class|="hang8_indent0"] {
+ padding-left: 10%;
+ text-indent: 40%;
+ }
+ text[class|="hang8_indent1"] {
+ padding-left: 15%;
+ text-indent: 35%;
+ }
+ text[class|="hang8_indent2"] {
+ padding-left: 20%;
+ text-indent: 30%;
+ }
+ text[class|="hang8_indent3"] {
+ padding-left: 25%;
+ text-indent: 25%;
+ }
+ text[class|="hang8_indent4"] {
+ padding-left: 30%;
+ text-indent: 20%;
+ }
+ text[class|="hang8_indent5"] {
+ padding-left: 35%;
+ text-indent: 15%;
+ }
+ text[class|="hang8_indent6"] {
+ padding-left: 40%;
+ text-indent: 10%;
+ }
+ text[class|="hang8_indent7"] {
+ padding-left: 45%;
+ text-indent: 5%;
+ }
+ text[class|="hang8_indent8"] {
+ padding-left: 50%;
+ text-indent: 0%;
+ }
+ text[class|="hang8_indent9"] {
+ padding-left: 55%;
+ text-indent: -5%;
+ }
+
+ text[class|="hang9_indent0"] {
+ padding-left: 10%;
+ text-indent: 45%;
+ }
+ text[class|="hang9_indent1"] {
+ padding-left: 15%;
+ text-indent: 40%;
+ }
+ text[class|="hang9_indent2"] {
+ padding-left: 20%;
+ text-indent: 35%;
+ }
+ text[class|="hang9_indent3"] {
+ padding-left: 25%;
+ text-indent: 30%;
+ }
+ text[class|="hang9_indent4"] {
+ padding-left: 30%;
+ text-indent: 25%;
+ }
+ text[class|="hang9_indent5"] {
+ padding-left: 35%;
+ text-indent: 20%;
+ }
+ text[class|="hang9_indent6"] {
+ padding-left: 40%;
+ text-indent: 15%;
+ }
+ text[class|="hang9_indent7"] {
+ padding-left: 45%;
+ text-indent: 10%;
+ }
+ text[class|="hang9_indent8"] {
+ padding-left: 50%;
+ text-indent: 5%;
+ }
+ text[class|="hang9_indent9"] {
+ padding-left: 55%;
+ text-indent: 0%;
+ }
+
+ text[class|="indent_bullet"] {
+ text-indent: 0%;
+ }
+ text[class|="indent_bullet0"] {
+ text-indent: 0%;
}
text[class|="indent_bullet1"] {
- margin-left: 10%;
+ padding-left: 10%;
}
text[class|="indent_bullet2"] {
- margin-left: 15%;
+ padding-left: 15%;
}
text[class|="indent_bullet3"] {
- margin-left: 20%;
+ padding-left: 20%;
}
text[class|="indent_bullet4"] {
- margin-left: 25%;
+ padding-left: 25%;
}
text[class|="indent_bullet5"] {
- margin-left: 30%;
+ padding-left: 30%;
}
text[class|="indent_bullet6"] {
- margin-left: 35%;
+ padding-left: 35%;
}
text[class|="indent_bullet7"] {
- margin-left: 40%;
+ padding-left: 40%;
}
text[class|="indent_bullet8"] {
- margin-left: 45%;
+ padding-left: 45%;
}
text[class|="indent_bullet9"] {
- margin-left: 50%;
+ padding-left: 50%;
}
- text[class|="verse"], text[class|="group"], text[class|="code"] {
+ text[class|="verse"], text[class|="block"], text[class|="group"], text[class|="code"] {
text-align: left;
}
table {
@@ -1859,7 +3216,7 @@ WOK
margin-top: 2px;
margin-bottom: 0px;
}
- para.verse, para.group, para.code {
+ para.verse, para.block, para.group, para.code {
text-align: left;
}
para.norm {
diff --git a/lib/sisu/v4/dal.rb b/lib/sisu/v4/dal.rb
new file mode 100644
index 00000000..0e816091
--- /dev/null
+++ b/lib/sisu/v4/dal.rb
@@ -0,0 +1,510 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: preprocessing, (document abstraction), data abstraction used
+ in subsequent processing
+
+=end
+module SiSU_DAL
+ require_relative 'defaults' # defaults.rb
+ include SiSU_Viz
+ require_relative 'sysenv' # sysenv.rb
+ include SiSU_Env
+ require_relative 'param' # param.rb
+ include SiSU_Param
+ require_relative 'dal_doc_objects' # dal_doc_objects.rb
+ require_relative 'dal_syntax' # dal_syntax.rb
+ include SiSU_DAL_Syntax
+ require_relative 'dal_doc_str' # dal_doc_str.rb
+ require_relative 'dal_idx' # dal_idx.rb
+ require_relative 'dal_numbering' # dal_numbering.rb
+ require_relative 'dal_hash_digest' # dal_hash_digest.rb
+ require_relative 'dal_endnotes' # dal_endnotes.rb
+ require_relative 'dal_images' # dal_images.rb
+ require_relative 'dal_metadata' # dal_metadata.rb
+ require_relative 'dal_character_check' # dal_character_check.rb
+ require_relative 'dal_substitutions_and_insertions' # dal_substitutions_and_insertions.rb
+ require_relative 'dal_expand_insertions' # dal_expand_insertions.rb
+ require_relative 'prog_text_translation' # prog_text_translation.rb
+ require_relative 'shared_sem' # shared_sem.rb
+ class Instantiate < SiSU_Param::Parameters::Instructions
+ def initialize
+ @@flag_vocab=0
+ @@line_mode=''
+ end
+ end
+ class Source <Instantiate
+ @@dal_array=[]
+ @@idx_arr={ sst: [], tex: [], html: [], xhtml: [] }
+ @@map_arr={ nametags: [], ocn_htmlseg: [] }
+ @@fns=nil
+ def initialize(opt,fnx=nil)
+ @opt,@fnx=opt,fnx
+ @@fns||@opt.fns
+ @make_fns=if @fnx and @fnx =~/\.ss[tmi]$/
+ SiSU_Env::InfoFile.new(@fnx)
+ else
+ SiSU_Env::InfoFile.new(@opt.fns)
+ end
+ @fnm=@make_fns.marshal.dal_metadata
+ @fnc=@make_fns.marshal.dal_content
+ @idx_sst=@make_fns.marshal.dal_idx_sst_rel_html_seg
+ @idx_raw=@make_fns.marshal.dal_idx_sst_rel
+ @idx_html=@make_fns.marshal.dal_idx_html
+ @idx_xhtml=@make_fns.marshal.dal_idx_xhtml
+ @map_nametags=@make_fns.marshal.dal_map_nametags
+ @map_ocn_htmlseg=@make_fns.marshal.dal_map_ocn_htmlseg
+ @env=SiSU_Env::InfoEnv.new
+ end
+ def read #creates dal
+ begin
+ dal=[]
+ @@dal_array=[]
+ @@fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
+ ? @fnx
+ : @opt.fns
+ create_dal
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@@fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ SiSU_DAL::Instantiate.new
+ end
+ end
+ def get #reads dal, unless does not exist then creates first
+ begin
+ dal=[]
+ unless @@fns==@opt.fns \
+ or @@fns==@fnx
+ @@fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
+ ? @fnx
+ : @opt.fns
+ @@dal_array=[]
+ end
+ dal=(@@dal_array.empty?) \
+ ? read_fnc
+ : @@dal_array.dup
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ SiSU_DAL::Instantiate.new
+ end
+ end
+ def get_idx_sst #reads dal idx.sst, #unless does not exist then creates first
+ begin
+ dal=[]
+ unless @@fns==@opt.fns \
+ or @@fns==@fnx
+ @@fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
+ ? @fnx
+ : @opt.fns
+ @@idx_arr[:sst]=[]
+ end
+ dal=(@@idx_arr[:sst].empty?) ? read_idx_sst : @@idx_arr[:sst].dup #check
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ SiSU_DAL::Instantiate.new
+ end
+ end
+ def get_idx_raw
+ begin
+ dal=[]
+ unless @@fns==@opt.fns \
+ or @@fns==@fnx
+ @@fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
+ ? @fnx
+ : @opt.fns
+ @@idx_arr[:tex]=[]
+ end
+ dal=(@@idx_arr[:tex].empty?) ? read_idx_raw : @@idx_arr[:tex].dup #check
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ SiSU_DAL::Instantiate.new
+ end
+ end
+ def get_idx_html #reads dal idx.html, #unless does not exist then creates first
+ begin
+ dal=[]
+ unless @@fns==@opt.fns \
+ or @@fns==@fnx
+ @@fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
+ ? @fnx
+ : @opt.fns
+ @@idx_arr[:html]=[]
+ end
+ dal=(@@idx_arr[:html].empty?) ? read_idx_html : @@idx_arr[:html].dup
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ SiSU_DAL::Instantiate.new
+ end
+ end
+ def get_idx_xhtml #reads dal idx.xhtml, #unless does not exist then creates first
+ begin
+ dal=[]
+ unless @@fns==@opt.fns \
+ or @@fns==@fnx
+ @@fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
+ ? @fnx
+ : @opt.fns
+ @@idx_arr[:xthml]=[]
+ end
+ dal=(@@idx_arr[:xhtml].empty?) ? read_idx_xhtml : @@idx_arr[:xhtml].dup
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ SiSU_DAL::Instantiate.new
+ end
+ end
+ def get_map_nametags #reads dal map.nametags, #unless does not exist then creates first
+ begin
+ dal=[]
+ unless @@fns==@opt.fns \
+ or @@fns==@fnx
+ @@fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
+ ? @fnx
+ : @opt.fns
+ @@map_arr[:nametags]=[]
+ end
+ dal=(@@map_arr[:nametags].empty?) ? read_map_nametags : @@map_arr[:nametags].dup
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ SiSU_DAL::Instantiate.new
+ end
+ end
+ def get_map_ocn_htmlseg #reads dal map.ocn_htmlseg, #unless does not exist then creates first
+ begin
+ dal=[]
+ unless @@fns==@opt.fns \
+ or @@fns==@fnx
+ @@fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
+ ? @fnx
+ : @opt.fns
+ @@map_arr[:ocn_htmlseg]=[]
+ end
+ dal=(@@map_arr[:ocn_htmlseg].empty?) ? read_map_ocn_htmlseg : @@map_arr[:ocn_htmlseg].dup
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ SiSU_DAL::Instantiate.new
+ end
+ end
+ protected
+ def create_dal
+ dal_array=[]
+ unless @opt.cmd =~/q/
+ tell=(@opt.cmd=~/[vVM]/) \
+ ? SiSU_Screen::Ansi.new(@opt.cmd,'Document Abstraction')
+ : SiSU_Screen::Ansi.new(@opt.cmd,'Document Abstraction',"[#{@opt.f_pth[:lng_is]}] #{@opt.fno}")
+ tell.grey_title_hi
+ end
+ fn=(@fnx && @fnx =~/\.ss[tmi]$/) \
+ ? @fnx
+ : @opt.fns
+ if @opt.fno =~/\.txz$/
+ Dir.chdir(@opt.f_pth[:pth])
+ end
+ meta=file_array=@env.source_file_processing_array(fn)
+ @md=SiSU_Param::Parameters::Instructions.new(meta,@opt).extract
+ meta=nil
+ dal=SiSU_DAL::Make.new(fn,@md,file_array).song
+ if @opt.cmd =~/[vM]/
+ cf=SiSU_Env::CreateFile.new(fn)
+ SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"~meta/#{@opt.fns}.meta").output if @opt.cmd =~/v/i
+ SiSU_Screen::Ansi.new(@opt.cmd,"dal -> #{cf.meta}").txt_grey if @opt.cmd =~/M/
+ end
+ dal.each {|s| dal_array << s}
+ dal_array
+ end
+ def read_fnm
+ dal=[]
+ dal=if FileTest.file?(@fnm)
+ File.open(@fnm,'r:utf-8'){ |f| dal=Marshal.load(f)}
+ else SiSU_DAL::Source.new(@opt).create_dal
+ end
+ end
+ def read_fnc
+ dal=[]
+ dal=if FileTest.file?(@fnc)
+ File.open(@fnc,'r:utf-8'){ |f| dal=Marshal.load(f)}
+ else SiSU_DAL::Source.new(@opt).create_dal
+ end
+ end
+ def read_idx_sst
+ m=[]
+ m=if FileTest.file?(@idx_sst)
+ File.open(@idx_sst,'r:utf-8'){ |f| m=Marshal.load(f)}
+ else nil
+ end
+ end
+ def read_idx_raw
+ m=[]
+ m=if FileTest.file?(@idx_raw)
+ File.open(@idx_raw,'r:utf-8'){ |f| m=Marshal.load(f)}
+ else nil
+ end
+ end
+ def read_idx_html
+ m=[]
+ m=if FileTest.file?(@idx_html)
+ File.open(@idx_html,'r:utf-8'){ |f| m=Marshal.load(f)}
+ else nil
+ end
+ end
+ def read_idx_xhtml
+ m=[]
+ m=if FileTest.file?(@idx_xhtml)
+ File.open(@idx_xhtml,'r:utf-8'){ |f| m=Marshal.load(f)}
+ else nil
+ end
+ end
+ def read_map_nametags
+ m=[]
+ m=if FileTest.file?(@map_nametags)
+ File.open(@map_nametags,'r:utf-8'){ |f| m=Marshal.load(f)}
+ else nil
+ end
+ end
+ def read_map_ocn_htmlseg
+ m=[]
+ m=if FileTest.file?(@map_ocn_htmlseg)
+ File.open(@map_ocn_htmlseg,'r:utf-8'){ |f| m=Marshal.load(f)}
+ else nil
+ end
+ end
+ end
+ class Output
+ def initialize(fn,md,data)
+ @fn,@md,@data=fn,md,data
+ @cf=SiSU_Env::CreateFile.new(@fn)
+ @make=SiSU_Env::InfoFile.new(@fn)
+ @dir=SiSU_Env::InfoEnv.new(@fn)
+ end
+ def screen_dump(o)
+ if defined? o.of
+ print %{OF: #{o.of}; }
+ end
+ if defined? o.is
+ print %{IS: #{o.is.to_s}; }
+ end
+ if defined? o.ocn
+ print %{OCN: #{o.ocn}; }
+ end
+ if defined? o.node
+ print %{NODE: #{o.node}; }
+ end
+ if defined? o.parent
+ print %{Parent: #{o.parent}; }
+ end
+ if defined? o.obj and not o.obj.empty?
+ puts %{\n#{o.obj}; }
+ else "\n"
+ end
+ end
+ def screen_print(t_o)
+ if defined? t_o
+ print ' ' + t_o.to_s
+ end
+ end
+ def screen_output(data)
+ data.each do |o|
+ print o.class
+ screen_print(o.ocn)
+ screen_print(o.obj)
+ puts "\n"
+ end
+ end
+ def hard_output
+ if @md.opt.cmd =~/M/
+ filename_meta=@cf.metaverse.file_meta
+ @data.each {|o| filename_meta.puts o.inspect.sub(/:0x[0-9a-f]{8}\s/,': ')} #to make diffing easier
+ filename_txt=@cf.metaverse.file_txt
+ @data.each do |o|
+ if defined? o.ocn
+ filename_txt.puts case o.is
+ when :heading
+ "[#{o.is.to_s} #{o.lv}~#{o.name} [#{o.ocn}]] #{o.obj}"
+ else "[#{o.is.to_s} [#{o.ocn}]] #{o.obj}"
+ end
+ else
+ filename_txt.puts case o.is
+ when :meta
+ "[m~#{o.tag}] #{o.obj}"
+ else "[#{o.is.to_s}] #{o.obj}"
+ end
+ end
+ end
+ filename_debug=@cf.file_debug
+ @data.each do |o|
+ if defined? o.ocn
+ case o.is
+ when :heading
+ filename_debug.puts "#{o.is.to_s} #{o.lv}~#{o.name} odv=#{o.odv} osp=#{o.osp} [#{o.ocn}] -->\n\t#{o.obj}"
+ end
+ end
+ end
+ else
+ hard="#{@dir.processing_path.dal}/#{@md.fns}.meta"
+ File.unlink(hard) if FileTest.file?(hard)
+ hard="#{@dir.processing_path.dal}/#{@md.fns}.txt"
+ File.unlink(hard) if FileTest.file?(hard)
+ hard="#{@dir.processing_path.dal}/#{@md.fns}.debug.txt"
+ File.unlink(hard) if FileTest.file?(hard)
+ end
+ end
+ def make_marshal_content
+ marshal_dal=@make.marshal.dal_content
+ File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Array)
+ end
+ def make_marshal_metadata
+ marshal_dal=@make.marshal.dal_metadata
+ File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Array)
+ end
+ def idx_html_hard_output
+ if @md.book_idx \
+ and @md.opt.cmd =~/M/
+ filename_meta=@cf.file_meta_idx_html
+ if @data.is_a?(Array)
+ @data.each {|s| p s.inspect + "\n" unless s.is_a?(String)}
+ @data.each {|s| filename_meta.puts s.strip + "\n" unless s.strip.empty?}
+ end
+ else
+ hard_idx_html="#{@dir.processing_path.dal}/#{@md.fns}.idx.html"
+ File.unlink(hard_idx_html) if FileTest.file?(hard_idx_html)
+ end
+ end
+ def make_marshal_idx_sst_html_seg
+ marshal_dal=@make.marshal.dal_idx_sst_rel_html_seg
+ File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Array)
+ end
+ def make_marshal_idx_sst_rel
+ marshal_dal=@make.marshal.dal_idx_sst_rel
+ File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Array)
+ end
+ def make_marshal_idx_html
+ marshal_dal=@make.marshal.dal_idx_html
+ File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Array)
+ end
+ def make_marshal_idx_xhtml
+ marshal_dal=@make.marshal.dal_idx_xhtml
+ File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Array)
+ end
+ def make_marshal_map_nametags
+ marshal_dal=@make.marshal.dal_map_nametags
+ File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Hash)
+ end
+ def make_marshal_map_name_ocn_htmlseg
+ marshal_dal=@make.marshal.dal_map_ocn_htmlseg
+ File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Hash)
+ end
+ end
+ class Make
+ def initialize(fn,md,data)
+ @fn,@md,@data=fn,md,data
+ @env=SiSU_Env::InfoEnv.new(@md.fns)
+ end
+ def reset
+ @@flag_vocab=0
+ @@line_mode=''
+ end
+ def song
+ reset
+ data=@data
+ data=SiSU_DAL_Insertions::Insertions.new(@md,data).expand_insertions? # dal_expand_insertions.rb
+ data=SiSU_DAL_SubstituteAndInsert::SI.new(@md,data).substitutions_and_insertions? # dal_substitutions_and_insertions.rb
+ data,metadata=SiSU_DAL_DocumentStructureExtract::Build.new(@md,data).identify_parts # dal_doc_str.rb
+ data=SiSU_DAL_Syntax::Markup.new(@md,data).songsheet # dal_syntax.rb
+ data,endnote_array=SiSU_DAL_CharacterCheck::Check.new(data).character_check_and_oldstyle_endnote_array # dal_character_check.rb
+ data=SiSU_DAL_Images::Images.new(@md,data).images # dal_images.rb
+ data,tags_map,ocn_html_seg_map=SiSU_DAL_Numbering::Numbering.new(@md,data).numbering_song # dal_numbering.rb
+ data,book_index_rel,book_index_rel_html_seg,html_idx,xhtml_idx=SiSU_DAL_BookIndex::BookIndex.new(@md,data,@env).indexing_song if @md.book_idx # dal_idx.rb
+ data=SiSU_DAL_Endnotes::Endnotes.new(@md,data,endnote_array).endnotes # dal_endnotes.rb
+ outputdata=data
+ if @md.opt.cmd =~/[mM]/
+ SiSU_DAL::Output.new(@fn,@md,outputdata).hard_output
+ SiSU_DAL::Output.new(@fn,@md,outputdata).make_marshal_content
+ SiSU_DAL::Output.new(@fn,@md,metadata).make_marshal_metadata
+ SiSU_DAL::Output.new(@fn,@md,html_idx).idx_html_hard_output
+ SiSU_DAL::Output.new(@fn,@md,book_index_rel_html_seg).make_marshal_idx_sst_html_seg
+ SiSU_DAL::Output.new(@fn,@md,book_index_rel).make_marshal_idx_sst_rel
+ SiSU_DAL::Output.new(@fn,@md,html_idx).make_marshal_idx_html
+ SiSU_DAL::Output.new(@fn,@md,xhtml_idx).make_marshal_idx_xhtml
+ SiSU_DAL::Output.new(@fn,@md,tags_map).make_marshal_map_nametags
+ SiSU_DAL::Output.new(@fn,@md,ocn_html_seg_map).make_marshal_map_name_ocn_htmlseg
+ end
+ reset
+ outputdata
+ end
+ protected
+ end
+end
+__END__
diff --git a/lib/sisu/v2/dal_character_check.rb b/lib/sisu/v4/dal_character_check.rb
index a843f202..f20d4106 100644
--- a/lib/sisu/v2/dal_character_check.rb
+++ b/lib/sisu/v4/dal_character_check.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -31,11 +32,9 @@
If you have Internet connection, the latest version of the GPL should be
available at these locations:
<http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/copyleft/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -56,7 +55,7 @@
** Description: system environment, resource control and configuration details
=end
-module SiSU_character_check
+module SiSU_DAL_CharacterCheck
class Check
def initialize(data)
@data=data
@@ -64,37 +63,37 @@ module SiSU_character_check
@endnote_array=[]
end
def character_check_and_oldstyle_endnote_array
- require 'iconv'
data=@data
@tuned_file,@endnote_array=[],[]
endnote_no=1
data.each do |dob|
- unless dob.is =='table'
- dob.obj.strip!
- dob.obj.gsub!(/^[{~}]\s*$/,'')
- dob.obj.gsub!(/~#\s*/,"#{Mx[:pa_non_object_no_heading]}")
- dob.obj.gsub!(/-#\s*/,"#{Mx[:pa_non_object_dummy_heading]}")
- dob.obj.gsub!(/(#{Mx[:en_a_o]})\s*\s+/,'\1 '); dob.obj.gsub!(/(~\{\s*)\s+/,'\1 ')
- dob.obj.gsub!(/ \/\//,"#{Mx[:br_line]}")
- dob.obj.gsub!(/<br>/,"#{Mx[:br_line]}") #needed by xml, xhtml etc.
- dob.obj.gsub!(/\t/,' ')
- dob.obj.gsub!(/\342\200\231/u,"'") #if dob =~/’/ #Avoid #&lsquo; &rsquo; #&ldquo; &rdquo;
- dob.obj.gsub!(/�/u,' ') #watch, replace with char code
- dob.obj.gsub!(/·/u,'*')
- dob.obj.gsub!(/\\copy(?:right)?\b/,'&#169;')
- dob.obj.gsub!(/\\trademark\b|\\tm\b/,'&#174;')
+ unless dob.is ==:table
+ dob.obj=dob.obj.strip.
+ gsub(/^[{~}]\s*$/,'').
+ gsub(/~#\s*/,"#{Mx[:pa_non_object_no_heading]}").
+ gsub(/-#\s*/,"#{Mx[:pa_non_object_dummy_heading]}").
+ gsub(/(#{Mx[:en_a_o]})\s*\s+/,'\1 ').
+ gsub(/(~\{\s*)\s+/,'\1 ').
+ gsub(/ \/\//,"#{Mx[:br_line]}").
+ gsub(/<br>/,"#{Mx[:br_line]}"). #needed by xml, xhtml etc.
+ gsub(/\t/,' ').
+ gsub(/\342\200\231/u,"'"). #if dob =~/’/ #Avoid #&lsquo; &rsquo; #&ldquo; &rdquo;
+ gsub(/\\copy(?:right)?\b/,'&#169;').
+ gsub(/\\trademark\b|\\tm\b/,'&#174;')
dob.obj=dob.obj + "\n"
- unless dob.is =~/^code/
+ unless dob.is ==:code
case dob.obj
when /\^~/ #% Note must do this first (earlier loop) and then enter gathered data into ~^\d+
sub_dob=dob.obj.dup
- @endnote_array << sub_dob.gsub!(/\n/,'').gsub!(/\^~\s+(.+)\s*/,%{#{Mx[:en_a_o]}#{endnote_no} \\1 #{Mx[:en_a_c]}}).strip
+ @endnote_array << sub_dob.gsub(/\n/,'').
+ gsub(/\^~\s+(.+)\s*/,%{#{Mx[:en_a_o]}#{endnote_no} \\1 #{Mx[:en_a_c]}}).
+ strip
endnote_no+=1
dob=nil if dob.obj =~/\^~ .+/ #watch, removes 'binary' endnote now in endnote array for later insertion
end
end
end
- @tuned_file << dob unless dob.nil?
+ @tuned_file << dob if dob.is_a?(Object)
end
@tuned_file=@tuned_file.flatten.compact
[@tuned_file,@endnote_array]
diff --git a/lib/sisu/v4/dal_doc_objects.rb b/lib/sisu/v4/dal_doc_objects.rb
new file mode 100644
index 00000000..f77348ec
--- /dev/null
+++ b/lib/sisu/v4/dal_doc_objects.rb
@@ -0,0 +1,445 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: document abstraction
+
+=end
+module SiSU_DAL_DocumentStructure
+ class Extract
+ def extract(h,o)
+ obj=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 #String, classification - group
+ is= :meta #String, classification - specific type
+ tags= tags || ((defined? o.tags) ? o.tags : {}) #String, metadata type/tag
+ obj= nil
+ @of,@is,@tags,@obj=of,is,tags,obj
+ self
+ end
+ end
+ class 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 #String, classification - group
+ is= :meta #String, classification - specific type
+ tag= h[:tag] || ((defined? o.tag) ? o.tag : nil) #String, metadata type/tag
+ obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
+ tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
+ digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
+ @of,@is,@tag,@obj,@digest,@tmp=of,is,tag,obj,digest,tmp
+ self
+ end
+ end
+ class ObjectHeading
+ attr_accessor :obj,:is,:tags,:of,:lv,:ln,:toc_,:name,:idx,:ocn,:odv,:osp,:node,:parent,:ocn_,:note_,:autonum_,:digest,:tmp
+ def initialize
+ @of=:para
+ @is=@obj=@lv=@ln=@toc_=@name=@idx=@size=@ocn=@odv=@osp=@node=@parent=@ocn_=@note_=@autonum_=@digest=@tmp=nil
+ @tags=[]
+ end
+ def heading_ln(lv)
+ ln=case lv
+ when /A/; 1
+ when /B/; 2
+ when /C/; 3
+ when /1/; 4
+ when /2/; 5
+ when /3/; 6
+ when /4/; 7
+ when /5/; 8
+ when /6/; 9
+ end
+ end
+ def heading_lv(ln)
+ lv=case ln.to_s
+ when /1/; 'A'
+ when /2/; 'B'
+ when /3/; 'C'
+ when /4/; '1'
+ when /5/; '2'
+ when /6/; '3'
+ when /7/; '4'
+ when /8/; '5'
+ when /9/; '6'
+ end
+ end
+ def heading(h,o=nil)
+ if not h[:ln] and (h[:lv] and h[:lv]=~/[1-6A-C]/)
+ h[:ln]=heading_ln(h[:lv])
+ elsif not h[:lv] and (h[:ln] and h[:ln].to_s=~/[1-9]/)
+ h[:lv]=heading_lv(h[:ln])
+ end
+ of= @of #String, classification - group
+ is= :heading #String, classification - specific type
+ name= h[:name] || ((defined? o.name) ? o.name : nil) #String, named object?
+ tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
+ obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
+ idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
+ ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
+ odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
+ osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
+ node= h[:node] || ((defined? o.node) ? o.node : nil) #[Node relationship doc structure info]
+ parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
+ lv= h[:lv] || ((defined? o.lv) ? o.lv : nil) #Alpha-numeric, document structure as used in markup, A-C then 1-6
+ ln= h[:ln] || ((defined? o.ln) ? o.ln : nil) #Integer, document structure level, for convenience in processing 1-9
+ toc_= h[:toc_] || ((defined? o.toc_) ? o.toc_ : false) #Bool, do not include in toc, (relevant to headings)
+ ocn_=if h[:ocn_].nil? then ((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? then ((defined? o.autonum_) ? o.autonum_ : true) #Bool? auto-numbering if requested default on, false suppresses
+ else h[:autonum_]
+ end
+ note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
+ digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
+ tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
+ @of,@is,@lv,@ln,@name,@tags,@obj,@idx,@ocn,@odv,@osp,@node,@parent,@toc_,@ocn_,@note_,@autonum_,@digest,@tmp=of,is,lv,ln,name,tags,obj,idx,ocn,odv,osp,node,parent,toc_,ocn_,note_,autonum_,digest,tmp
+ self
+ end
+ def heading_insert(h,o=nil)
+ heading(h,o=nil)
+ @is= :heading_insert #String, classification - specific type
+ self
+ end
+ end
+ class ObjectPara
+ attr_accessor :obj,:is,:tags,:of,:name,:idx,:bullet_,:indent,:hang,:ocn,:odv,:osp,:parent,:note_,:image_,:ocn_,:digest,:tmp
+ def initialize
+ @of=:para
+ @is=@obj=@name=@idx=@bullet_=@indent=@hang=@size=@ocn=@odv=@osp=@parent=@note_=@image_=@ocn_=@digest=@tmp=nil
+ @tags=[]
+ end
+ def paragraph(h,o=nil)
+ of= @of #String, classification - group
+ is= :para #String, classification - specific type
+ 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?
+ 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? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
+ else h[:ocn_]
+ end
+ digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
+ tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
+ @of,@is,@name,@tags,@obj,@indent,@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
+ 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? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
+ else h[:ocn_]
+ end
+ digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
+ tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
+ @of,@is,@name,@tags,@obj,@indent,@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,:idx,:ocn,:odv,:osp,:parent,:note_,:number_,:ocn_,:digest,:tmp
+ def initialize
+ @of=:block
+ @is=@obj=@idx=@ocn=@odv=@osp=@parent=@note_=@number_=@ocn_=@digest=@tmp=nil
+ @tags=[]
+ end
+ def code(h,o=nil)
+ of= @of #String, classification - group #alt 'code'
+ is= :code #String, classification - specific type
+ tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
+ obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
+ idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
+ ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
+ odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
+ osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
+ parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
+ number_= h[:number_] || ((defined? o.number_) ? o.number_ : false) #Bool, numbered or not?
+ note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
+ ocn_= if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
+ else h[:ocn_]
+ end
+ digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
+ tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
+ @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@number_,@note_,@ocn_,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,number_,note_,ocn_,digest,tmp
+ self
+ end
+ def block(h,o=nil)
+ of= @of #String, classification - group
+ is= :block #String, classification - specific type
+ tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
+ obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
+ idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
+ 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? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
+ else h[:ocn_]
+ end
+ digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
+ tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
+ @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,note_,ocn_,digest,tmp
+ self
+ end
+ def group(h,o=nil)
+ of= @of #String, classification - group
+ is= :group #String, classification - specific type
+ tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
+ obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
+ idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
+ ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
+ odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
+ osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
+ parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
+ note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
+ ocn_= if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
+ else h[:ocn_]
+ end
+ digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
+ tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
+ @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,note_,ocn_,digest,tmp
+ self
+ end
+ def alt(h,o=nil) #see block
+ of= @of #String, classification - group
+ is= :alt #String, classification - specific type
+ tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
+ obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
+ idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
+ ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
+ odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
+ osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
+ parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
+ note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
+ ocn_= if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
+ else h[:ocn_]
+ end
+ digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
+ tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
+ @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,note_,ocn_,digest,tmp
+ self
+ end
+ def verse(h,o=nil) #part of poem decide how you deal with this
+ of= @of #String, classification - group
+ is= :verse #String, classification - specific type
+ tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
+ obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
+ idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
+ ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
+ odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
+ osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
+ parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
+ ocn_= if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
+ else h[:ocn_]
+ end
+ digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
+ tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
+ @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,note_,ocn_,digest,tmp
+ @h=nil
+ self
+ end
+ end
+ class ObjectTable
+ attr_accessor :obj,:is,:of,:lv,:tags,:name,:idx,:indent,:hang,:size,:ocn,:number,:head_,:cols,:widths,:odv,:osp,:parent,:note_,:ocn_,:digest,:tmp
+ def initialize
+ @of=:block
+ @is=@obj=@lv=@name=@idx=@indent=@hang=@size=@ocn,@number,@head_,@cols,@widths=@odv=@osp=@parent=@note_=@ocn_=@digest=@tmp=nil
+ @tags=[]
+ end
+ def table(h,o=nil)
+ of= @of #String, classification - group
+ is= :table #String, classification - specific type
+ 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? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
+ else h[:ocn_]
+ end
+ digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
+ tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
+ @of,@is,@tags,@cols,@widths,@obj,@idx,@ocn,@odv,@osp,@parent,@head_,@note_,@ocn_,@digest,@tmp=of,is,tags,cols,widths,obj,idx,ocn,odv,osp,parent,head_,note_,ocn_,digest,tmp
+ self
+ end
+ end
+ class 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 #String, classification - group
+ is= :image #String, classification - specific type
+ tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
+ obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
+ size= h[:size] || ((defined? o.size) ? o.size : nil)
+ idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
+ ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
+ odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
+ osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
+ parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
+ note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
+ ocn_=if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
+ else h[:ocn_]
+ end
+ digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
+ tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
+ @of,@is,@tags,@obj,@size,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@digest,@tmp=of,is,tags,obj,size,idx,ocn,odv,osp,parent,note_,ocn_,digest,tmp
+ self
+ end
+ end
+ class ObjectStructure
+ attr_accessor :obj,:tag,:node,:lv,:ln,:status,:is,:of,:tmp
+ def initialize
+ @of=:structure
+ @is=@obj=@node=@lv=@ln=@status=@tmp=nil
+ end
+ def xml_dom(h,o=nil)
+ of= @of #String, classification - group
+ is= :xml_dom #String, classification - specific type
+ obj= h[:obj] || ((defined? o.obj) ? o.obj : '') #String, text content
+ lv= h[:lv] || ((defined? o.lv) ? o.lv : nil) #Alpha-numeric, document structure as used in markup, A-C then 1-6
+ ln= h[:ln] || ((defined? o.ln) ? o.ln : nil) #Integer, document structure level, for convenience in processing 1-9
+ node= h[:node] || ((defined? o.node) ? o.node : nil) #[Node relationship doc structure info]
+ status= h[:status] || ((defined? o.status) ? o.status : nil) #tag status open or close
+ tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
+ @of,@is,@obj,@status,@node,@lv,@ln,@tmp=of,is,obj,status,node,lv,ln,tmp
+ self
+ end
+ end
+ class ObjectComment
+ attr_accessor :obj,:is,:of,:tmp
+ def initialize
+ @of=:comment
+ @is=@obj=@tmp=nil
+ end
+ def comment(h,o=nil)
+ of= @of #String, classification - group
+ is= :comment #String, classification - specific type
+ obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
+ tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
+ @of,@is,@obj,@tmp=of,is,obj,tmp
+ self
+ end
+ end
+ class ObjectLayout
+ attr_accessor :obj,:is,:of,:tmp
+ def initialize
+ @of=:layout
+ @is=@obj=@tmp=nil
+ end
+ def break(h,o=nil) #decide how to deal with, perhaps no obj?
+ of= @of #String, classification - group
+ is= :break #String, classification - specific type
+ obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
+ tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
+ @of,@is,@obj,@tmp=of,is,obj,tmp
+ self
+ end
+ def insert(h,o=nil) #decide how to deal with, could mimic paragraph?
+ of= @of #String, classification - group
+ is= :insert #String, classification - specific type
+ obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
+ tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
+ @of,@is,@obj,@tmp=of,is,obj,tmp
+ self
+ end
+ end
+end
+__END__
+# ~# |-# no paragraph number # -# not included in toc
diff --git a/lib/sisu/v4/dal_doc_str.rb b/lib/sisu/v4/dal_doc_str.rb
new file mode 100644
index 00000000..012e7a33
--- /dev/null
+++ b/lib/sisu/v4/dal_doc_str.rb
@@ -0,0 +1,1044 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: document abstraction
+
+=end
+module SiSU_DAL_DocumentStructureExtract
+ class Instantiate < SiSU_Param::Parameters::Instructions
+ @@flag={} #Beware!!
+ def initialize
+ @@flag['table_to']=false
+ @@counter=@@column=@@columns=0
+ @@line_mode=''
+ end
+ end
+ class Build
+ @@flag={} #Beware!!
+ def initialize(md,data)
+ @md,@data=md,data
+ SiSU_DAL_DocumentStructureExtract::Instantiate.new
+ @pb=SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page])
+ @pbn=SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_new])
+ end
+ def ln_get(lv)
+ ln=case lv
+ when /A/; 1
+ when /B/; 2
+ when /C/; 3
+ when /1/; 4
+ when /2/; 5
+ when /3/; 6
+ when /4/; 7
+ when /5/; 8
+ when /6/; 9
+ end
+ end
+ def image_test(str)
+ boolean=(str=~/\{\s*\S+?\.png.+?\}https?:\/\/\S+/ ? true : false)
+ end
+ def bullet_test(str)
+ bool=((str=~/\*/) ? true : false)
+ end
+ def hang_and_indent_test(str)
+ hang_indent=if str=~/^_([1-9])[^_]/
+ [$1,$1]
+ elsif str=~/^__([1-9])/
+ [0,$1]
+ elsif str=~/^_([0-9])_([0-9])/
+ [$1,$2]
+ else
+ [0,0]
+ end
+ hang,indent=hang_indent[0],hang_indent[1]
+ [hang,indent]
+ end
+ def hang_and_indent_def_test(str1,str2)
+ hang_indent=if str1=~/^_([1-9])[^_]/
+ [$1,$1]
+ elsif str1=~/^__([1-9])/
+ [0,$1]
+ elsif str1=~/^_([0-9])_([0-9])/
+ [$1,$2]
+ else
+ [0,0]
+ end
+ obj=if str2 =~/^(.+?)\s+\\\\(?:\s+|\n)/
+ str2.gsub(/^(.+?)(\s+\\\\(?:\s+|\n))/,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2")
+ else
+ str2.gsub(/^(.+?)\n/,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\n")
+ end
+ hang,indent=hang_indent[0],hang_indent[1]
+ [hang,indent,obj]
+ end
+ def endnote_test?(str)
+ bool=((str=~/~\{.+?\}~|~\[.+?\]~/) ? true : false)
+ end
+ def extract_tags(str,nametag=nil)
+ tags=[]
+ if str.nil?
+ else
+ if str =~/(?:^|[ ])\*~([a-z0-9._-]+)(?=[ #{Mx[:br_nl]}]|$)/
+ str=str.gsub(/(^|[ ])\*~([a-z0-9._-]+)(?=[ #{Mx[:br_nl]}]|$)/i,
+ "\\1#{Mx[:tag_o]}\\2#{Mx[:tag_c]}").
+ gsub(/ [ ]+/i,' ')
+ tags=str.scan(/#{Mx[:tag_o]}(\S+?)#{Mx[:tag_c]}/).flatten
+ str=str.gsub(/[ ]?#{Mx[:tag_o]}\S+?#{Mx[:tag_c]}[ ]?/,' ') #may be issues with spaces would leave one, but "code" blocks?
+ end
+ tags=nametag ? (tags << nametag) : tags
+ end
+ [str,tags]
+ end
+ def identify_parts
+ data=@data
+ tuned_file=[]
+ @tuned_block,@tuned_code=[],[]
+ @@counter,@verse_count=0,0
+ @metadata={}
+ @data.each do |t_o|
+ t_o=t_o.gsub(/(?:\n\s*\n)+/m,"\n") unless @@flag['code']
+ if t_o !~/^(?:code|poem|alt|group|block)\{|^\}(?:code|poem|alt|group|block)|^(?:table\{|\{table)[ ~]/ \
+ and not @@flag['code'] \
+ and not @@flag['poem'] \
+ and not @@flag['group'] \
+ and not @@flag['block'] \
+ and not @@flag['alt'] \
+ and not @@flag['table']
+ unless t_o =~/^(?:@\S+?:|%+)\s/ # extract book index for paragraph if any
+ idx=if t_o=~/^=\{(.+)\}\s*$\Z/m; m=$1
+ t_o=t_o.gsub(/\n=\{.+\}\s*$\Z/m,'')
+ m
+ else nil
+ end
+ end
+ t_o=case t_o
+ when /^#{Mx[:meta_o]}\S+?#{Mx[:meta_c]}/ #metadata, header
+ if t_o=~/^#{Mx[:meta_o]}(\S+?)#{Mx[:meta_c]}\s*(.+)/m
+ tag,obj=$1,$2
+ @metadata[tag]=obj
+ end
+ t_o=nil
+ when /^%+\s/ #comment
+ t_o=if t_o=~/^%+\s+(.+)/
+ h={obj: $1}
+ SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h)
+ else nil
+ end
+ when /^:?([A-C1-6])\~/ #heading / lv
+ lv=$1
+ ln=ln_get(lv)
+ t_o=if t_o=~/^:?[A-C1-6]\~\s+(.+)/m
+ obj=$1
+ note=endnote_test?(obj)
+ obj,tags=extract_tags(obj)
+ h={ lv: lv, ln: ln, obj: obj, idx: idx, tags: tags }
+ SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h)
+ elsif t_o=~/^:?[A-C1-6]\~(\S+?)-\s+(.+)/m
+ name,obj=$1,$2
+ note=endnote_test?(obj)
+ obj,tags=extract_tags(obj)
+ h={ lv: lv, name: name, obj: obj, idx: idx, autonum_: false, tags: tags}
+ SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h)
+ elsif t_o=~/^:?[A-C1-6]\~(\S+)\s+(.+)/m
+ name,obj=$1,$2
+ note=endnote_test?(obj)
+ obj,tags=extract_tags(obj,name)
+ h={ lv: lv, name: name, obj: obj, idx: idx, tags: tags }
+ SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h)
+ else nil
+ end
+ when /^_(?:[1-9]!?|[1-9]?\*)\s+/ #indented and/or bullet paragraph
+ t_o=if t_o=~/^(_(?:[1-9]?\*|[1-9]!?)\s+)(.+)/m
+ tst,obj=$1,$2
+ if t_o=~/^_[1-9]!\s+.+/m
+ hang,indent,obj=hang_and_indent_def_test(tst,obj)
+ else
+ hang,indent=hang_and_indent_test(tst)
+ end
+ bullet=bullet_test(tst)
+ image=image_test(obj)
+ note=endnote_test?(obj)
+ obj,tags=extract_tags(obj)
+ unless obj=~/\A\s*\Z/m
+ h={ bullet_: bullet, hang: hang, indent: indent, obj: obj, idx: idx, note_: note, image_: image, tags: tags }
+ SiSU_DAL_DocumentStructure::ObjectPara.new.paragraph(h)
+ end
+ else nil
+ end
+ when /^_[0-9]?_[0-9]!?\s+/ #hanging indent paragraph
+ t_o=if t_o=~/^(_[0-9]?_[0-9]!?\s+)(.+)/m
+ tst,obj=$1,$2
+ if t_o=~/^_[0-9]?_[0-9]!\s+.+/m
+ hang,indent,obj=hang_and_indent_def_test(tst,obj)
+ else
+ hang,indent=hang_and_indent_test(tst)
+ end
+ image=image_test(obj)
+ note=endnote_test?(obj)
+ obj,tags=extract_tags(obj)
+ unless obj=~/\A\s*\Z/m
+ h={ hang: hang, indent: indent, obj: obj, idx: idx, note_: note, image_: image, tags: tags }
+ SiSU_DAL_DocumentStructure::ObjectPara.new.paragraph(h)
+ end
+ else nil
+ end
+ when /^<(?:br)?:(?:pa?r|o(?:bj|---)?)>\s*$/ #[br:par] #[br:obj]
+ SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_obj])
+ when /^(?:-\\\\-|<:pb>)\s*$/ #[br:pg]
+ SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page])
+ when /^(?:=\\\\=|<:pn>)\s*$/ #[br:pgn]
+ SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_new])
+ else #paragraph
+ image=image_test(t_o)
+ note=endnote_test?(t_o)
+ obj,tags=extract_tags(t_o)
+ unless obj=~/\A\s*\Z/m
+ h={ bullet_: false, indent: 0, hang: 0, obj: obj, idx: idx, note_: note, image_: image, tags: tags }
+ SiSU_DAL_DocumentStructure::ObjectPara.new.paragraph(h)
+ end
+ end
+ elsif not @@flag['code']
+ if t_o =~/^code\{/
+ @@flag['code']=true
+ @@counter=1
+ @codeblock_numbered=(t_o =~/^code\{#/) ? true : false
+ h={ obj: 'code block start' } #introduce a counter
+ t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h) #t_o=SiSU_DAL_DocumentStructure::ObjectLayout.new.insert(h)
+ elsif t_o =~/^poem\{/
+ @@flag['poem']=true
+ h={ obj: 'poem start' } #introduce a counter
+ t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h) #t_o=SiSU_DAL_DocumentStructure::ObjectLayout.new.insert(h)
+ tuned_file << t_o
+ elsif t_o =~/^group\{/
+ @@flag['group']=true
+ h={ obj: 'group text start' } #introduce a counter
+ t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h) #t_o=SiSU_DAL_DocumentStructure::ObjectLayout.new.insert(h)
+ tuned_file << t_o
+ elsif t_o =~/^block\{/
+ @@flag['block']=true
+ h={ obj: 'block text start' } #introduce a counter
+ t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h) #t_o=SiSU_DAL_DocumentStructure::ObjectLayout.new.insert(h)
+ tuned_file << t_o
+ elsif t_o =~/^alt\{/
+ @@flag['alt']=true
+ h={ obj: 'alt text start' } #introduce a counter
+ t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h) #t_o=SiSU_DAL_DocumentStructure::ObjectLayout.new.insert(h)
+ tuned_file << t_o
+ elsif t_o =~/^(?:table\{|\{table)[ ~]/
+ h={ obj: 'table start' } #introduce a counter
+ ins=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h) #ins=SiSU_DAL_DocumentStructure::ObjectLayout.new.insert(h)
+ tuned_file << ins
+ if t_o=~/^table\{(?:~h)?\s+/
+ @@flag['table']=true
+ @rows=''
+ case t_o
+ when /table\{~h\s+c(\d+);\s+(.+)/
+ cols=$1
+ col=$2.scan(/\d+/)
+ heading=true
+ when /table\{\s+c(\d+);\s+(.+)/
+ cols=$1
+ col=$2.scan(/\d+/)
+ heading=false
+ end
+ @h={ head_: heading, cols: cols, widths: col, idx: idx }
+ elsif t_o=~/^\{table(?:~h)?(?:\s+\d+;?)?\}\n.+\Z/m
+ m1,m2,hd=nil,nil,nil
+ tbl=/^\{table(?:~h)?(?:\s+\d+;?)?\}\n(.+)\Z/m.match(t_o)[1] #two table representations should be consolidated as one
+ hd=((t_o =~/^\{table~h/) ? true : false)
+ tbl,tags=extract_tags(tbl)
+ rws=tbl.split(/\n/)
+ rows=''
+ cols=nil
+ rws.each do |r|
+ cols=(cols ? cols : (r.scan('|').length) +1)
+ r=r.gsub(/\s*\|\s*/m,"#{Mx[:tc_p]}") #r.gsub!(/\|/m,"#{Mx[:tc_p]}")
+ rows += r + Mx[:tc_c]
+ end
+ col=[]
+ if t_o =~/^\{table(?:~h)?\s+(\d+);?\}/ #width of col 1 given as %, usually when wider than rest that are even
+ c1=$1.to_i
+ width=(100 - c1)/(cols - 1)
+ col=[ c1 ]
+ (cols - 1).times { col << width }
+ else #all columns of equal width
+ width=100.00/cols
+ cols.times { col << width }
+ end
+ h={ head_: hd, cols: cols, widths: col, obj: rows, idx: idx, tags: tags }
+ t_o=SiSU_DAL_DocumentStructure::ObjectTable.new.table(h) unless h.nil?
+ tuned_file << t_o
+ h={ obj: 'table end' } #introduce a counter
+ t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h)
+ t_o
+ elsif t_o=~/^\{table(?:~h)?\s+/
+ m1,m2,hd=nil,nil,nil
+ h=case t_o
+ when /\{table~h\s+(.+?)\}\n(.+)\Z/m #two table representations should be consolidated as one
+ m1,tbl,hd=$1,$2,true
+ when /\{table\s+(.+?)\}\n(.+)\Z/m #two table representations should be consolidated as one
+ m1,tbl,hd=$1,$2,false
+ else nil
+ end
+ tbl,tags=extract_tags(tbl)
+ col=m1.scan(/\d+/)
+ rws=tbl.split(/\n/)
+ rows=''
+ rws.each do |r|
+ r=r.gsub(/\s*\|\s*/m,"#{Mx[:tc_p]}") #r.gsub!(/\|/m,"#{Mx[:tc_p]}")
+ rows += r + Mx[:tc_c]
+ end
+ h={ head_: hd, cols: col.length, widths: col, obj: rows, idx: idx, tags: tags }
+ t_o=SiSU_DAL_DocumentStructure::ObjectTable.new.table(h) unless h.nil?
+ tuned_file << t_o
+ h={ obj: 'table end' } #introduce a counter
+ t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h)
+ t_o
+ end
+ end
+ t_o
+ end
+ if @@flag['table']
+ if @@flag['table'] \
+ and t_o =~/^\}table/ #two table representations should be consolidated as one
+ @@flag['table']=false
+ headings,columns,widths,idx=@h[:head_],@h[:cols],@h[:widths],@h[:idx]
+ @h={ head_: headings, cols: columns, widths: widths, idx: idx, obj: @rows }
+ t_o=SiSU_DAL_DocumentStructure::ObjectTable.new.table(@h)
+ tuned_file << t_o
+ @h,@rows=nil,''
+ t_o
+ h={ obj: 'table end' } #introduce a counter
+ t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h) #t_o=SiSU_DAL_DocumentStructure::ObjectLayout.new.insert(h)
+ t_o
+ else
+ if t_o.is_a?(String) \
+ and t_o !~/^table\{/
+ t_o=t_o.gsub(/^\n+/m,''). #check added for ruby 1.9.2 not needed in 1.8 series (tested in v2)
+ gsub(/\n+/m,"#{Mx[:tc_p]}")
+ @rows += t_o + Mx[:tc_c]
+ end
+ t_o=nil
+ end
+ end
+ if @@flag['code']
+ if t_o =~/^\}code/
+ @@flag['code']=false
+ obj=@tuned_code.join("\n")
+ tags=[]
+ h={ obj: obj, tags: tags, number_: @codeblock_numbered }
+ t_o=SiSU_DAL_DocumentStructure::ObjectBlockTxt.new.code(h)
+ @tuned_code=[]
+ tuned_file << t_o
+ h={ obj: 'code block end' } #introduce a counter
+ t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h) #t_o=SiSU_DAL_DocumentStructure::ObjectLayout.new.insert(h)
+ end
+ if @@flag['code'] \
+ and t_o.is_a?(String)
+ sub_array=t_o.dup + "#{Mx[:br_nl]}"
+ @line_mode=sub_array.scan(/.+/)
+ @line_mode=[]
+ sub_array.scan(/.+/) {|w| @line_mode << w if w =~/[\S]+/}
+ t_o=SiSU_DAL_DocumentStructureExtract::Build.new(@md,@line_mode).build_lines('code').join
+ @tuned_code << t_o
+ t_o=nil
+ end
+ elsif @@flag['poem'] \
+ or @@flag['group'] \
+ or @@flag['block'] \
+ or @@flag['alt']
+ if @@flag['poem'] \
+ and t_o =~/^\}poem/
+ @@flag['poem']=false
+ h={ obj: 'poem end' } #introduce a counter
+ t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h) #t_o=SiSU_DAL_DocumentStructure::ObjectLayout.new.insert(h)
+ elsif ( @@flag['group'] \
+ and t_o =~/^\}group/ )
+ @@flag['group']=false
+ obj,tags=extract_tags(@tuned_block.join("\n"))
+ h={ obj: obj, tags: tags }
+ @tuned_block=[]
+ t_o=SiSU_DAL_DocumentStructure::ObjectBlockTxt.new.group(h)
+ tuned_file << t_o
+ h={ obj: 'group text end' } #introduce a counter
+ t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h) #t_o=SiSU_DAL_DocumentStructure::ObjectLayout.new.insert(h)
+ elsif ( @@flag['block'] \
+ and t_o =~/^\}block/ )
+ @@flag['block']=false
+ obj,tags=extract_tags(@tuned_block.join("\n"))
+ h={ obj: obj, tags: tags }
+ @tuned_block=[]
+ t_o=SiSU_DAL_DocumentStructure::ObjectBlockTxt.new.block(h)
+ tuned_file << t_o
+ h={ obj: 'block text end' } #introduce a counter
+ t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h) #t_o=SiSU_DAL_DocumentStructure::ObjectLayout.new.insert(h)
+ elsif ( @@flag['alt'] \
+ and t_o =~/^\}alt/ )
+ @@flag['alt']=false
+ obj,tags=extract_tags(@tuned_block.join("\n"))
+ h={ obj: obj, tags: tags }
+ t_o=SiSU_DAL_DocumentStructure::ObjectBlockTxt.new.alt(h)
+ @tuned_block=[]
+ tuned_file << t_o
+ h={ obj: 'alt text end' } #introduce a counter
+ t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h) #t_o=SiSU_DAL_DocumentStructure::ObjectLayout.new.insert(h)
+ end
+ if @@flag['poem'] \
+ or @@flag['group'] \
+ or @@flag['alt'] \
+ and t_o =~/\S/ \
+ and t_o !~/^(?:\}(?:verse|code|alt|group|block)|(?:verse|code|alt|group|block)\{)/ # fix logic
+ sub_array=t_o.dup
+ @line_mode=sub_array.scan(/.+/)
+ type=if @@flag['poem']; 'poem'
+ t_o=SiSU_DAL_DocumentStructureExtract::Build.new(@md,@line_mode).build_lines(type).join
+ poem=t_o.split(/\n\n/)
+ poem.each do |v|
+ v=v.gsub(/\n/m,"#{Mx[:br_nl]}\n")
+ obj,tags=extract_tags(v)
+ h={ obj: obj, tags: tags }
+ t_o=SiSU_DAL_DocumentStructure::ObjectBlockTxt.new.verse(h)
+ tuned_file << t_o
+ end
+ else 'group'
+ end
+ @verse_count+=1 if @@flag['poem']
+ end
+ end
+ if not @@flag['code']
+ if @@flag['poem'] \
+ or @@flag['group'] \
+ or @@flag['alt']
+ if t_o.is_a?(String)
+ t_o=t_o.gsub(/\n/m,"#{Mx[:br_nl]}").
+ gsub(/[ ][ ]/m,"#{Mx[:nbsp]*2}").
+ gsub(/#{Mx[:nbsp]}\s/,"#{Mx[:nbsp]*2}")
+ t_o=t_o + Mx[:br_nl] if t_o =~/\S+/
+ elsif t_o.is==:group \
+ || t_o.is==:block \
+ || t_o.is==:alt \
+ || t_o.is==:verse
+ t_o.obj=t_o.obj.gsub(/\n/m,"#{Mx[:br_nl]}").
+ gsub(/[ ][ ]/m,"#{Mx[:nbsp]*2}").
+ gsub(/#{Mx[:nbsp]}\s/,"#{Mx[:nbsp]*2}")
+ end
+ @tuned_block << t_o if t_o =~/\S+/
+ else tuned_file << t_o
+ end
+ else tuned_file << t_o
+ end
+ end
+ if @md.flag_endnotes
+ tuned_file << @pb
+ h={ ln: 2, obj: 'Endnotes', autonum_: false }
+ tuned_file << SiSU_DAL_DocumentStructure::ObjectHeading.new.heading_insert(h)
+ h={ ln: 4, obj: 'Endnotes', name: 'endnotes', autonum_: false }
+ tuned_file << SiSU_DAL_DocumentStructure::ObjectHeading.new.heading_insert(h)
+ h={ obj: 'Endnotes' }
+ end
+ if @md.book_idx
+ tuned_file << @pb
+ h={ ln: 2, obj: 'Index', autonum_: false }
+ tuned_file << SiSU_DAL_DocumentStructure::ObjectHeading.new.heading_insert(h)
+ h={ ln: 4, obj: 'Index', name: 'book_index', autonum_: false }
+ tuned_file << SiSU_DAL_DocumentStructure::ObjectHeading.new.heading_insert(h)
+ h={ obj: 'Index' }
+ end
+ tuned_file << @pb
+ h={ ln: 2, obj: 'Metadata', autonum_: false, ocn_: false }
+ tuned_file << SiSU_DAL_DocumentStructure::ObjectHeading.new.heading_insert(h)
+ h={ ln: 4, obj: 'SiSU Metadata, document information', name: 'metadata', autonum_: false, ocn_: false }
+ tuned_file << SiSU_DAL_DocumentStructure::ObjectHeading.new.heading_insert(h)
+ tuned_file
+ h={ obj: 'eof' }
+ meta=SiSU_DAL_DocumentStructure::ObjectMetadata.new.metadata(@metadata)
+ [tuned_file,meta]
+ end
+ def table_rows_and_columns_array(table_str)
+ table=[]
+ table_str.split(/#{Mx[:tc_c]}/).each do |table_row|
+ table_row_with_columns=table_row.split(/#{Mx[:tc_p]}/)
+ table << table_row_with_columns
+ end
+ table
+ end
+ def meta_heading(h)
+ h={ lv: h[:lv], ln: h[:ln], name: h[:name], obj: h[:obj], ocn: '0' }
+ SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h)
+ end
+ def meta_para(str)
+ h={ obj: str, ocn_: false }
+ SiSU_DAL_DocumentStructure::ObjectPara.new.paragraph(h)
+ end
+ def build_lines(type='')
+ lines,lines_new=@data,[]
+ lines.each do |line|
+ line=if line =~/\S/ \
+ and line !~/^code\{|^\}code/ \
+ and not line.is_a?(Hash)
+ @@counter+=1 if @@flag['code']
+ line=line.gsub(/\s\s/,"#{Mx[:nbsp]*2}").
+ gsub(/#{Mx[:nbsp]}\s/,"#{Mx[:nbsp]*2}")
+ line=line.gsub(/^/,"#{Mx[:gr_o]}codeline#{Mx[:gr_c]}") if type=='code' # REMOVE try sort for texpdf special case
+ line=if line =~/(?:https?|file|ftp):\/\/\S+$/
+ line.gsub(/\s*$/," #{Mx[:br_nl]}")
+ else line.gsub(/\s*$/,"#{Mx[:br_nl]}") #unless type=='code'
+ end
+ elsif line =~/^\s*$/
+ line.gsub(/\s*$/,"#{Mx[:br_nl]}")
+ else line
+ end
+ lines_new << line
+ end
+ lines_new
+ end
+ end
+ class Structure # this must happen early
+ def initialize(md,dob)
+ @md,@dob=md,dob
+ end
+ def structure
+ structure_markup_normalize
+ structure_markup
+ @dob
+ end
+ def structure_markup #build structure where structure provided only in meta header
+ @dob=if @dob.is ==:para \
+ && (((@dob.hang !~/[1-9]/) && (@dob.indent !~/[1-9]/)) \
+ || (@dob.hang != @dob.indent)) \
+ and not @dob.bullet_
+ @dob=case @dob.obj
+ when /^#{@md.lv1}/
+ h={ lv: 'A', ln: 1 }
+ SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h,@dob)
+ when /^#{@md.lv2}/
+ h={ lv: 'B', ln: 2 }
+ SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h,@dob)
+ when /^#{@md.lv3}/
+ h={ lv: 'C', ln: 3 }
+ SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h,@dob)
+ when /^#{@md.lv4}/
+ h={ lv: '1', ln: 4 }
+ SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h,@dob)
+ when /^#{@md.lv5}/
+ h={ lv: '2', ln: 5 }
+ SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h,@dob)
+ when /^#{@md.lv6}/
+ h={ lv: '3', ln: 6 }
+ SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h,@dob)
+ else @dob
+ end
+ else @dob
+ end
+ @dob
+ end
+ def structure_markup_normalize #needs a bit of thinking
+ dob=if @md.markup_version.determined < 0.38 #%convert internal representation, consider making 0.38 structure default ([A-C1-6] instead of [1-9]), requires downstream changes
+ @dob=@dob.gsub(/^[456]~/,'!_').
+ gsub(/^3~(\S+)/,"#{Mx[:lv_o]}6:\\1#{Mx[:lv_c]}").
+ gsub(/^3~\s+/,"#{Mx[:lv_o]}6:#{Mx[:lv_c]}").
+ gsub(/^2~(\S+)/,"#{Mx[:lv_o]}5:\\1#{Mx[:lv_c]}").
+ gsub(/^2~\s+/,"#{Mx[:lv_o]}5:#{Mx[:lv_c]}").
+ gsub(/^1~(\S+)/,"#{Mx[:lv_o]}4:\\1#{Mx[:lv_c]}").
+ gsub(/^1~\s+/,"#{Mx[:lv_o]}4:#{Mx[:lv_c]}").
+ gsub(/^:?C~(\S+)/,"#{Mx[:lv_o]}3:\\1#{Mx[:lv_c]}").
+ gsub(/^:?C~\s+/,"#{Mx[:lv_o]}3:#{Mx[:lv_c]}").
+ gsub(/^:?B~(\S+)/,"#{Mx[:lv_o]}2:\\1#{Mx[:lv_c]}").
+ gsub(/^:?B~\s+/,"#{Mx[:lv_o]}2:#{Mx[:lv_c]}").
+ gsub(/^:?A~(\S+)/,"#{Mx[:lv_o]}1:\\1#{Mx[:lv_c]}").
+ gsub(/^:?A~\s+/,"#{Mx[:lv_o]}1:#{Mx[:lv_c]}")
+ @dob=if @dob =~/^@(?:level|markup):\s/
+ @dob=@dob.gsub(/3/,'6').
+ gsub(/2/,'5').
+ gsub(/1/,'4').
+ gsub(/:?C/,'3').
+ gsub(/:?B/,'2').
+ gsub(/:?A/,'1')
+ @dob
+ else @dob
+ end
+ else @dob
+ end
+ end
+ def structure_marks
+ t_o=if @md.markup_version.determined < 0.38
+ @t_o=@t_o.gsub(/^1~(\S+)/,"#{Mx[:lv_o]}1:\\1#{Mx[:lv_c]}").
+ gsub(/^1~\s+/,"#{Mx[:lv_o]}1:#{Mx[:lv_c]}").
+ gsub(/^2~(\S+)/,"#{Mx[:lv_o]}2:\\1#{Mx[:lv_c]}").
+ gsub(/^2~\s+/,"#{Mx[:lv_o]}2:#{Mx[:lv_c]}").
+ gsub(/^3~(\S+)/,"#{Mx[:lv_o]}3:\\1#{Mx[:lv_c]}").
+ gsub(/^3~\s+/,"#{Mx[:lv_o]}3:#{Mx[:lv_c]}").
+ gsub(/^4~(\S+)/,"#{Mx[:lv_o]}4:\\1#{Mx[:lv_c]}").
+ gsub(/^4~\s+/,"#{Mx[:lv_o]}4:#{Mx[:lv_c]}").
+ gsub(/^5~(\S+)/,"#{Mx[:lv_o]}5:\\1#{Mx[:lv_c]}").
+ gsub(/^5~\s+/,"#{Mx[:lv_o]}5:#{Mx[:lv_c]}").
+ gsub(/^6~(\S+)/,"#{Mx[:lv_o]}6:\\1#{Mx[:lv_c]}").
+ gsub(/^6~\s+/,"#{Mx[:lv_o]}6:#{Mx[:lv_c]}").
+ gsub(/^[789]~/,'!_')
+ @t_o
+ else @t_o
+ end
+ end
+ end
+ class OCN
+ def initialize(md,data)
+ @md,@data=md,data
+ end
+ def ocn #and auto segment numbering increment
+ data=@data
+ @o_array=[]
+ node=ocn=ocn_dv=ocn_sp=ocnh=ocnh1=ocnh2=ocnh3=ocnh4=ocnh5=ocnh6=ocno=ocnp=ocnt=ocnc=ocng=ocni=ocnm=ocnu=ocnk=nm=0 # h heading, o other, t table, g group, i image
+ node_count_flag=false
+ regex_exclude_ocn_and_node = /#{Rx[:meta]}|^@\S+?:\s|^4~endnotes|^#{Mx[:lv_o]}4:endnotes#{Mx[:lv_c]}|^\^~ |<:e[:_]\d+?>|^<:\#|<:- |<[:!]!4|<hr width|#{Mx[:br_endnotes]}|\A\s*\Z/mi #ocn here #&nbsp; added with Tune.code #¡
+ parent=node1=node2=node3=node4=node5=node6=nil
+ data.each do |dob|
+ h={}
+ if (dob.obj !~ regex_exclude_ocn_and_node || dob.is ==:code) \
+ && (dob.of !=:comment \
+ && dob.of !=:layout \
+ && dob.of !=:meta) \
+ && dob.obj !~/#{Mx[:pa_non_object_no_heading]}|#{Mx[:pa_non_object_dummy_heading]}/ \
+ && dob.ocn_
+ #dob.ln now is determined, and set earlier, check how best to remove this -->
+ if dob.is==:heading
+ ln=case dob.lv
+ when 'A'; 1
+ when 'B'; 2
+ when 'C'; 3
+ when '1'; 4
+ when '2'; 5
+ when '3'; 6
+ when '4'; 7
+ when '5'; 8
+ when '6'; 9
+ end
+ end
+ if not dob.obj =~/<:#>|~#|-#/ \
+ or not dob.toc_ # fix this no longer in dob.obj
+ ocn+=1
+ if dob.is==:heading \
+ and (ln.to_s =~/^[1-9]/ \
+ or ln.to_s =~@md.lv1 \
+ or ln.to_s =~@md.lv2 \
+ or ln.to_s =~@md.lv3 \
+ or ln.to_s =~@md.lv4 \
+ or ln.to_s =~@md.lv5 \
+ or ln.to_s =~@md.lv6)
+ ocnh+=1
+ if ln==1 \
+ or ln=~@md.lv1; ocnh1+=1 #heading
+ node1="1:#{ocnh1};#{ocn}"
+ node,ocn_sp,parent=node1,"h#{ocnh}",0 #FIX
+ elsif ln==2 \
+ or ln=~@md.lv2; ocnh2+=1
+ node2="2:#{ocnh2};#{ocn}"
+ node,ocn_sp,parent=node2,"h#{ocnh}",node1
+ elsif ln==3 \
+ or ln=~@md.lv3; ocnh3+=1
+ node3="3:#{ocnh3};#{ocn}"
+ node,ocn_sp,parent=node3,"h#{ocnh}",node2
+ elsif ln==4 \
+ or ln=~@md.lv4; ocnh4+=1
+ node4="4:#{ocnh4};#{ocn}"
+ node,ocn_sp,parent=node4,"h#{ocnh}",node3
+ elsif ln==5 \
+ or ln=~@md.lv5; ocnh5+=1
+ node5="5:#{ocnh5};#{ocn}"
+ node,ocn_sp,parent=node5,"h#{ocnh}",node4
+ elsif ln==6 \
+ or ln=~@md.lv6; ocnh6+=1
+ node6="6:#{ocnh6};#{ocn}"
+ node,ocn_sp,parent=node6,"h#{ocnh}",node5
+ end
+ else
+ ocno+=1
+ if dob.is==:table
+ ocnt+=1
+ ocn_sp,parent="t#{ocnt}",node
+ elsif dob.is==:code
+ ocnc+=1
+ ocn_sp,parent="c#{ocnc}",node
+ elsif dob.is==:group \
+ || dob.is==:block \
+ || dob.is==:alt \
+ || dob.is==:verse
+ ocng+=1 #group, poem
+ ocn_sp,parent="g#{ocng}",node
+ elsif dob.is==:image #check
+ ocni+=1
+ ocn_sp,parent="i#{ocni}",node
+ else ocnp+=1 #paragraph
+ ocn_sp,parent="p#{ocnp}",node
+ end
+ end
+ if dob.is==:heading
+ dob.ln,dob.node,dob.ocn,dob.odv,dob.osp,dob.parent=ln,node,ocn,ocn_dv,ocn_sp,parent
+ else
+ if dob.of !=:meta \
+ && dob.of !=:comment \
+ && dob.of !=:layout
+ dob.ocn,dob.odv,dob.osp,dob.parent=ocn,ocn_dv,ocn_sp,parent
+ end
+ end
+ else ocnu+=1
+ dob.obj=dob.obj.gsub(/#{Mx[:fa_o]}~##{Mx[:fa_c]}/,'') if dob.obj
+ ocn_dv,ocn_sp="u#{ocnu}","u#{ocnu}"
+ dob.ocn,dob.odv,dob.osp=ocn,ocn_dv,ocn_sp
+ end
+ h
+ elsif dob.obj=~/#{Mx[:pa_non_object_no_heading]}/
+ dob.obj=dob.obj.gsub(/#{Mx[:pa_non_object_no_heading]}/,'')
+ if dob.is==:para
+ h={ obj: dob.obj, ocn_: false, ocn: nil }
+ dob=SiSU_DAL_DocumentStructure::ObjectPara.new.paragraph(h,dob)
+ elsif dob.is==:heading
+ h={ obj: dob.obj, ocn_: false, ocn: nil, toc_: true }
+ dob=SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h,dob)
+ end
+ elsif dob.obj=~/#{Mx[:pa_non_object_dummy_heading]}/
+ dob.obj=dob.obj.gsub(/#{Mx[:pa_non_object_dummy_heading]}/,'')
+ if dob.is==:para
+ h={ obj: dob.obj, ocn_: false, ocn: nil }
+ dob=SiSU_DAL_DocumentStructure::ObjectPara.new.paragraph(h,dob)
+ elsif dob.is==:heading
+ h={ obj: dob.obj, ocn_: false, ocn: nil, toc_: false }
+ dob=SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h,dob)
+ end
+ else dob
+ end
+ if dob.is==:code \
+ || dob.is==:verse \
+ || dob.is==:alt \
+ || dob.is==:group \
+ || dob.is==:block
+ dob.obj=dob.obj.gsub(/\n\n/,"\n") #newlines taken out
+ end
+ @o_array << dob
+ end
+ @o_array
+ end
+ end
+ class XML
+ def initialize(md,data)
+ @data,@md=data,md
+ end
+ def dom
+ @s=['0',
+ 'A',
+ 'B',
+ 'C',
+ '1',
+ '2',
+ '3'
+ ]
+ @sp=' '
+ tuned_file=structure_build
+ tuned_file
+ end
+ def structure_build
+ data=@data
+ tuned_file=[]
+ hs=[0,false,false,false]
+ t={ lv: @s[0], status: 'open' }
+ tuned_file << tags(t)
+ if @md.opt.cmd =~/V/
+ puts "\nXML sisu structure outline --->\n"
+ puts "<#{@s[0]}>"
+ end
+ data.each_with_index do |o,i|
+ if o.is ==:heading \
+ || o.is ==:heading_insert
+ case o.ln
+ when 1
+ tuned_file << tag_close(o.ln,hs)
+ tuned_file << tag_open(o,@s)
+ if @md.opt.cmd =~/V/
+ puts_tag_close(o.ln,hs)
+ puts_tag_open(o,@s)
+ end
+ hs=[1,true,false,false]
+ when 2
+ tuned_file << tag_close(o.ln,hs)
+ tuned_file << tag_open(o,@s)
+ if @md.opt.cmd =~/V/
+ puts_tag_close(o.ln,hs)
+ puts_tag_open(o,@s)
+ end
+ hs=[2,true,true,false]
+ when 3
+ tuned_file << tag_close(o.ln,hs)
+ tuned_file << tag_open(o,@s)
+ if @md.opt.cmd =~/V/
+ puts_tag_close(o.ln,hs)
+ puts_tag_open(o,@s)
+ end
+ hs=[3,true,true,true]
+ when 4
+ tuned_file << tag_close(o.ln,hs)
+ tuned_file << tag_open(o,@s)
+ if @md.opt.cmd =~/V/
+ puts_tag_close(o.ln,hs)
+ puts_tag_open(o,@s)
+ end
+ hs[0]=4
+ when 5
+ tuned_file << tag_close(o.ln,hs)
+ tuned_file << tag_open(o,@s)
+ if @md.opt.cmd =~/V/
+ puts_tag_close(o.ln,hs)
+ puts_tag_open(o,@s)
+ end
+ hs[0]=5
+ when 6
+ tuned_file << tag_close(o.ln,hs)
+ tuned_file << tag_open(o,@s)
+ if @md.opt.cmd =~/V/
+ puts_tag_close(o.ln,hs)
+ puts_tag_open(o,@s)
+ end
+ hs[0]=6
+ end
+ end
+ tuned_file << o
+ end
+ puts_tag_close(0,hs) if @md.opt.cmd =~/V/
+ tuned_file << tag_close(0,hs)
+ tuned_file=tuned_file.flatten
+ end
+ def tags(o)
+ tag=(o[:status]=='open') \
+ ? %{<#{o[:lv]} id="#{o[:node]}">}
+ : "</#{o[:lv]}>"
+ ln=case o[:lv]
+ when 'A'; 1
+ when 'B'; 2
+ when 'C'; 3
+ when '1'; 4
+ when '2'; 5
+ when '3'; 6
+ when '4'; 7
+ when '5'; 8
+ when '6'; 9
+ end
+ h={ tag: tag, node: o[:node], lv: o[:lv], ln: ln, status: o[:status] }
+ SiSU_DAL_DocumentStructure::ObjectStructure.new.xml_dom(h) #downstream code utilise else ignore like comments
+ end
+ def tag_open(o,tag)
+ t={ lv: tag[o.ln], node: o.node, status: 'open' }
+ t_o=tags(t)
+ t_o
+ end
+ def tag_close(lev,hs)
+ ary=[]
+ case hs[0]
+ when 1
+ if (lev <= 1) and hs[1]
+ t={ lv: @s[1], status: 'close' }
+ ary << tags(t)
+ end
+ if (lev==0)
+ t={ lv: @s[0], status: 'close' }
+ ary << tags(t)
+ end
+ when 2
+ if (lev <= 2) and hs[2]
+ t={ lv: @s[2], status: 'close' }
+ ary << tags(t)
+ end
+ if (lev <= 1) and hs[1]
+ t={ lv: @s[1], status: 'close' }
+ ary << tags(t)
+ end
+ if (lev==0)
+ t={ lv: @s[0], status: 'close' }
+ ary << tags(t)
+ end
+ when 3
+ if (lev <= 3) and hs[3]
+ t={ lv: @s[3], status: 'close' }
+ ary << tags(t)
+ end
+ if (lev <= 2) and hs[2]
+ t={ lv: @s[2], status: 'close' }
+ ary << tags(t)
+ end
+ if (lev <= 1) and hs[1]
+ t={ lv: @s[1], status: 'close' }
+ ary << tags(t)
+ end
+ if (lev==0)
+ t={ lv: @s[0], status: 'close' }
+ ary << tags(t)
+ end
+ when 4
+ if (lev <= 4)
+ t={ lv: @s[4], status: 'close' }
+ ary << tags(t)
+ end
+ if (lev <= 3) and hs[3]
+ t={ lv: @s[3], status: 'close' }
+ ary << tags(t)
+ end
+ if (lev <= 2) and hs[2]
+ t={ lv: @s[2], status: 'close' }
+ ary << tags(t)
+ end
+ if (lev <= 1) and hs[1]
+ t={ lv: @s[1], status: 'close' }
+ ary << tags(t)
+ end
+ if (lev==0)
+ t={ lv: @s[0], status: 'close' }
+ ary << tags(t)
+ end
+ when 5
+ if (lev <= 5)
+ t={ lv: @s[5], status: 'close' }
+ ary << tags(t)
+ end
+ if (lev <= 4)
+ t={ lv: @s[4], status: 'close' }
+ ary << tags(t)
+ end
+ if (lev <= 3) and hs[3]
+ t={ lv: @s[3], status: 'close' }
+ ary << tags(t)
+ end
+ if (lev <= 2) and hs[2]
+ t={ lv: @s[2], status: 'close' }
+ ary << tags(t)
+ end
+ if (lev <= 1) and hs[1]
+ t={ lv: @s[1], status: 'close' }
+ ary << tags(t)
+ end
+ if (lev==0)
+ t={ lv: @s[0], status: 'close' }
+ ary << tags(t)
+ end
+ when 6
+ if (lev <= 6)
+ t={ lv: @s[6], status: 'close' }
+ ary << tags(t)
+ end
+ if (lev <= 5)
+ t={ lv: @s[5], status: 'close' }
+ ary << tags(t)
+ end
+ if (lev <= 4)
+ t={ lv: @s[4], status: 'close' }
+ ary << tags(t)
+ end
+ if (lev <= 3) and hs[3]
+ t={ lv: @s[3], status: 'close' }
+ ary << tags(t)
+ end
+ if (lev <= 2) and hs[2]
+ t={ lv: @s[2], status: 'close' }
+ ary << tags(t)
+ end
+ if (lev <= 1) and hs[1]
+ t={ lv: @s[1], status: 'close' }
+ ary << tags(t)
+ end
+ if (lev==0)
+ t={ lv: @s[0], status: 'close' }
+ ary << tags(t)
+ end
+ end
+ ary
+ end
+ def puts_tag_open(o,tag)
+ puts %{#{@sp*o.ln}<#{tag[o.ln]} id="#{o.node}">}
+ end
+ def puts_tag_close(lev,hs)
+ case hs[0]
+ when 1
+ puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
+ puts "</#{@s[0]}>" if (lev==0)
+ when 2
+ puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
+ puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
+ puts "</#{@s[0]}>" if (lev==0)
+ when 3
+ puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) and hs[3]
+ puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
+ puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
+ puts "</#{@s[0]}>" if (lev==0)
+ when 4
+ puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4)
+ puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) and hs[3]
+ puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
+ puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
+ puts "</#{@s[0]}>" if (lev==0)
+ when 5
+ puts "#{@sp*5}</#{@s[5]}>" if (lev <= 5)
+ puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4)
+ puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) and hs[3]
+ puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
+ puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
+ puts "</#{@s[0]}>" if (lev==0)
+ when 6
+ puts "#{@sp*6}</#{@s[6]}>" if (lev <= 6)
+ puts "#{@sp*5}</#{@s[5]}>" if (lev <= 5)
+ puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4)
+ puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) and hs[3]
+ puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
+ puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
+ puts "</#{@s[0]}>" if (lev==0)
+ end
+ end
+ end
+end
+__END__
diff --git a/lib/sisu/v2/dal_endnotes.rb b/lib/sisu/v4/dal_endnotes.rb
index 95176516..4ef6f3ae 100644
--- a/lib/sisu/v2/dal_endnotes.rb
+++ b/lib/sisu/v4/dal_endnotes.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -31,11 +32,9 @@
If you have Internet connection, the latest version of the GPL should be
available at these locations:
<http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/copyleft/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -56,7 +55,7 @@
** Description: system environment, resource control and configuration details
=end
-module SiSU_endnotes
+module SiSU_DAL_Endnotes
class Endnotes
def initialize(md,data,endnote_array=nil)
@md,@data,@endnote_array=md,data,endnote_array
@@ -68,18 +67,18 @@ module SiSU_endnotes
endnote_no,endnote_ref=1,1
data.each do |dob|
# manually numbered endnotes <!e(\d)!> <!e_(\d)!> -->
- if @md.mod.inspect =~/--no-asterisk|--no-annotate/
- dob.obj.gsub!(/#{Mx[:en_b_o]}\s.+?#{Mx[:en_b_c]}/,'')
+ if @md.opt.mod.inspect =~/--no-asterisk|--no-annotate/
+ dob.obj=dob.obj.gsub(/#{Mx[:en_b_o]}\s.+?#{Mx[:en_b_c]}/,'')
end
- if @md.mod.inspect =~/--no-dagger|--no-annotate/
- dob.obj.gsub!(/#{Mx[:en_b_o]}[+]\s.+?#{Mx[:en_b_c]}/,'')
+ if @md.opt.mod.inspect =~/--no-dagger|--no-annotate/
+ dob.obj=dob.obj.gsub(/#{Mx[:en_b_o]}[+]\s.+?#{Mx[:en_b_c]}/,'')
end
- if defined? dob.obj \
- and defined? dob.is \
- and dob.is !~/^code/
+ if (defined? dob.obj) \
+ && (defined? dob.is) \
+ && dob.is !=:code
case dob.obj # auto-numbered endnotes <!e!> <!e_!> -->
when /#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}[*+]\s+.+?#{Mx[:en_b_c]}/
- dob.obj.gsub!(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/,' \1') # required 2003w31
+ dob.obj=dob.obj.gsub(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/,' \1') # required 2003w31
word_mode=dob.obj.scan(/\S+/m)
word_mode=endnote_call_number(word_mode)
dob.obj=word_mode.join(' ')
diff --git a/lib/sisu/v4/dal_expand_insertions.rb b/lib/sisu/v4/dal_expand_insertions.rb
new file mode 100644
index 00000000..2ec4945f
--- /dev/null
+++ b/lib/sisu/v4/dal_expand_insertions.rb
@@ -0,0 +1,378 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: system environment, resource control and configuration details
+
+=end
+module SiSU_DAL_Insertions
+ class Insertions
+ def initialize(md,data)
+ @md,@data=md,data
+ end
+ def output_filetypes_in_cmd(cmd_shortcut,lnk=nil) #make list of file types in shortcut command (as configured), e.g. when sisu -3 is used
+ cf_defaults=SiSU_Env::InfoProcessingFlag.new
+ cmd_list=case cmd_shortcut.inspect
+ when /0/; cf_defaults.cf_0
+ when /1/; cf_defaults.cf_1
+ when /2/; cf_defaults.cf_2
+ when /3/; cf_defaults.cf_3
+ when /4/; cf_defaults.cf_4
+ when /5/; cf_defaults.cf_5
+ end
+ file_type_names={}
+ file_type_names[:gen],file_type_names[:src]=[],[]
+ file_type_names[:gen] <<= if cmd_list =~ /y/ then "~^ { document manifest }#{lnk[:manifest]}"
+ end
+ file_type_names[:gen] <<= if cmd_list =~ /h/ then [" { html, segmented text }#{lnk[:html_toc]}"," { html, scroll, document in one }#{lnk[:html_doc]}"]
+ end
+ file_type_names[:gen] <<= if cmd_list =~ /e/ then [" { epub }#{lnk[:epub]}"]
+ end
+ file_type_names[:gen] <<= if cmd_list =~ /p/ then [" { pdf, landscape }#{lnk[:pdf_landscape]}"," { pdf, portrait }#{lnk[:pdf_portrait]}"]
+ end
+ file_type_names[:gen] <<= if cmd_list =~ /o/ then " { odf:odt, open document text }#{lnk[:odt]}"
+ end
+ file_type_names[:gen] <<= if cmd_list =~ /b/ then " { xhtml scroll }#{lnk[:xhtml]}"
+ end
+ file_type_names[:gen] <<= if cmd_list =~ /x/ then " { xml, sax }#{lnk[:xml_sax]}"
+ end
+ file_type_names[:gen] <<= if cmd_list =~ /X/ then " { xml, dom }#{lnk[:xml_dom]}"
+ end
+ file_type_names[:gen] <<= if cmd_list =~ /a/ then " { plain text utf-8 }#{lnk[:txt]}"
+ end
+ file_type_names[:gen] <<= if cmd_list =~ /g/ then 'wiki.txt'
+ end
+ file_type_names[:gen] <<= if cmd_list =~ /w/ then " { concordance }#{lnk[:html_concordance]}"
+ end
+ file_type_names[:gen] <<= if cmd_list =~ /N/ then " { dcc, document content certificate (digests) }#{lnk[:digest]}"
+ end
+ file_type_names[:src] <<= if source and cmd_shortcut =~ /s/ then " { markup source text }#{lnk[:source]}"
+ end
+ file_type_names[:src] <<= if cmd_shortcut =~ /S/ then " { 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 manifest
+ "#{@base_path}/manifest/#{@linked_doc}.html"
+ end
+ def html_toc
+ "#{@base_path}/html/#{@linked_doc}.html"
+ end
+ def html_doc
+ "#{@base_path}/html/#{@linked_doc}.html"
+ end
+ def html_concordance
+ "#{@base_path}/html/#{@linked_doc}.html"
+ end
+ def epub
+ "#{@base_path}/epub/#{@linked_doc}.epub"
+ end
+ def pdf_landscape
+ "#{@base_path}/pdf/#{@linked_doc}.pdf"
+ end
+ def pdf_portrait
+ "#{@base_path}/pdf/#{@linked_doc}.pdf"
+ end
+ def odt
+ "#{@base_path}/odt/#{@linked_doc}.odt"
+ end
+ def xhtml
+ "#{@base_path}/xhtml/#{@linked_doc}.xhtml"
+ end
+ def xml_sax
+ "#{@base_path}/xml/#{@linked_doc}.xml"
+ end
+ def xml_dom
+ "#{@base_path}/xml/#{@linked_doc}.xml"
+ end
+ def txt
+ "#{@base_path}/txt/#{@linked_doc}.txt"
+ end
+ def digest
+ "#{@base_path}/digest/#{@linked_doc}.txt"
+ end
+ def source
+ "#{@base_path}/src/#{@src}"
+ end
+ def sisupod
+ "#{@base_path}/pod/#{@src}.zip"
+ end
+ self
+ end
+ def by_filetype(linked_doc,lng,src=nil)
+ @linked_doc,@lng,@src=linked_doc,lng,src
+ @base_path="#{@md.file.output_path.base.url}"
+ def manifest
+ "#{@base_path}/manifest/#{@linked_doc}.#{@lng}.html"
+ end
+ def html_toc
+ "#{@base_path}/html/#{@linked_doc}.#{@lng}.html"
+ end
+ def html_doc
+ "#{@base_path}/html/#{@linked_doc}.#{@lng}.html"
+ end
+ def html_concordance
+ "#{@base_path}/html/#{@linked_doc}.#{@lng}.html"
+ end
+ def epub
+ "#{@base_path}/epub/#{@linked_doc}.#{@lng}.epub"
+ end
+ def pdf_landscape
+ "#{@base_path}/pdf/#{@linked_doc}.#{@lng}.pdf"
+ end
+ def pdf_portrait
+ "#{@base_path}/pdf/#{@linked_doc}.#{@lng}.pdf"
+ end
+ def odt
+ "#{@base_path}/odt/#{@linked_doc}.#{@lng}.odt"
+ end
+ def xhtml
+ "#{@base_path}/xhtml/#{@linked_doc}.#{@lng}.xhtml"
+ end
+ def xml_sax
+ "#{@base_path}/xml_sax/#{@linked_doc}.#{@lng}.xml"
+ end
+ def xml_dom
+ "#{@base_path}/xml_dom/#{@linked_doc}.#{@lng}.xml"
+ end
+ def txt
+ "#{@base_path}/txt/#{@linked_doc}.#{@lng}.txt"
+ end
+ def digest
+ "#{@base_path}/digest/#{@linked_doc}.#{@lng}.txt"
+ end
+ def source
+ "#{@base_path}/src/#{@src}"
+ end
+ def sisupod
+ "#{@base_path}/pod/#{@src}.zip"
+ end
+ self
+ end
+ def by_filename(linked_doc,lng,src=nil)
+ @linked_doc,@lng,@src=linked_doc,lng,src
+ @base_path="#{@md.file.output_path.base.url}/#{@linked_doc}"
+ def manifest
+ "#{@base_path}/sisu_manifest.#{@lng}.html"
+ end
+ def html_toc
+ "#{@base_path}/toc.#{@lng}.html"
+ end
+ def html_doc
+ "#{@base_path}/scroll.#{@lng}.html"
+ end
+ def html_concordance
+ "#{@base_path}/concordance.#{@lng}.html"
+ end
+ def epub
+ "#{@base_path}/epub/#{@linked_doc}.#{@lng}.epub"
+ end
+ def pdf_landscape
+ "#{@base_path}/landscape.#{@lng}.a4.pdf"
+ end
+ def pdf_portrait
+ "#{@base_path}/portrait.#{@lng}.a4.pdf"
+ end
+ def odt
+ "#{@base_path}/opendocument.#{@lng}.odt"
+ end
+ def xhtml
+ "#{@base_path}/scroll.#{@lng}.xhtml"
+ end
+ def xml_sax
+ "#{@base_path}/scroll.#{@lng}.sax.xml"
+ end
+ def xml_dom
+ "#{@base_path}/scroll.#{@lng}.dom.xml"
+ end
+ def txt
+ "#{@base_path}/plain.#{@lng}.txt"
+ end
+ def digest
+ "#{@base_path}/digest.#{@lng}.txt"
+ 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_=false
+ data.each do |para|
+ codeblock_=if para =~/^code\{/
+ true
+ elsif para =~/^\}code/
+ false
+ else codeblock_
+ end
+ if para !~/^%+\s/ \
+ and not codeblock_ \
+ and para =~/\{(?:~\^\s+)?(.+?)\s\[(?:\d(?:[sS]*))\]\}(?:\.\.\/\S+?\/|\S+?\.ss[tm]\b)/
+ txt,cmd,source,linked_doc,note,manifest=nil,nil,nil,nil,nil,nil
+ @u=SiSU_Env::InfoEnv.new.url
+ pre=txt=cmd=source=linked_doc=note=''
+ if defined? @u.remote
+ if /(?<pre>.+?)\{(?<txt>.+?)\s\[(?<cmd>\d[sS]*)\]\}(?<source>(?<linked_doc>\S+?)\.ss[tm]\b)(?<note>.*)/m =~ para
+ pre=pre.strip
+ elsif /\{(?<txt>.+?)\s\[(?<cmd>\d[sS]*)\]\}(?<source>(?<linked_doc>\S+?)\.ss[tm]\b)(?<note>.*)/m =~ para
+ end
+ if linked_doc =~ /(\S+?)\/(\S+)/
+ linked_doc,linked_doc_lang=$1,$2
+ else
+ linked_doc,linked_doc_lang=linked_doc,@md.opt.lng_base
+ end
+ else
+ puts "error, does currently support relative paths (reltive paths were removed, as had problems for citation, and was not suited to all output types should possibly reconsider) #{__FILE__} #{__LINE__}"
+ if /\{(?:~\^\s+)?(?<txt>.+?)\s\[(?<cmd>\d[sS]*)\]\}\.\.\/(?<linked_doc>\S+?)\/(?<note>\s+#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]})?/ =~ para
+ end
+ end
+ lnk={}
+ case @md.opt.dir_structure_by
+ when :language
+ lnk={
+ manifest: by_language(linked_doc,linked_doc_lang).manifest,
+ html_toc: by_language(linked_doc,linked_doc_lang).html_toc,
+ html_doc: by_language(linked_doc,linked_doc_lang).html_doc,
+ epub: by_language(linked_doc,linked_doc_lang).epub,
+ pdf_landscape: by_language(linked_doc,linked_doc_lang).pdf_landscape,
+ pdf_portrait: by_language(linked_doc,linked_doc_lang).pdf_landscape,
+ odt: by_language(linked_doc,linked_doc_lang).odt,
+ xhtml: by_language(linked_doc,linked_doc_lang).xhtml,
+ xml_sax: by_language(linked_doc,linked_doc_lang).xml_sax,
+ xml_dom: by_language(linked_doc,linked_doc_lang).xml_dom,
+ txt: by_language(linked_doc,linked_doc_lang).txt,
+ html_concordance: by_language(linked_doc,linked_doc_lang).html_concordance,
+ digest: by_language(linked_doc,linked_doc_lang).digest,
+ sisupod: by_language(linked_doc,linked_doc_lang,source).sisupod,
+ source: by_language(linked_doc,linked_doc_lang,source).source,
+ }
+ when :filetype
+ lnk={
+ manifest: by_filetype(linked_doc,linked_doc_lang).manifest,
+ html_toc: by_filetype(linked_doc,linked_doc_lang).html_toc,
+ html_doc: by_filetype(linked_doc,linked_doc_lang).html_doc,
+ epub: by_filetype(linked_doc,linked_doc_lang).epub,
+ pdf_landscape: by_filetype(linked_doc,linked_doc_lang).pdf_landscape,
+ pdf_portrait: by_filetype(linked_doc,linked_doc_lang).pdf_landscape,
+ odt: by_filetype(linked_doc,linked_doc_lang).odt,
+ xhtml: by_filetype(linked_doc,linked_doc_lang).xhtml,
+ xml_sax: by_filetype(linked_doc,linked_doc_lang).xml_sax,
+ xml_dom: by_filetype(linked_doc,linked_doc_lang).xml_dom,
+ txt: by_filetype(linked_doc,linked_doc_lang).txt,
+ html_concordance: by_filetype(linked_doc,linked_doc_lang).html_concordance,
+ digest: by_filetype(linked_doc,linked_doc_lang).digest,
+ sisupod: by_filetype(linked_doc,linked_doc_lang,source).sisupod,
+ source: by_filetype(linked_doc,linked_doc_lang,source).source,
+ }
+ else
+ lnk={
+ manifest: by_filename(linked_doc,linked_doc_lang).manifest,
+ html_toc: by_filename(linked_doc,linked_doc_lang).html_toc,
+ html_doc: by_filename(linked_doc,linked_doc_lang).html_doc,
+ epub: by_filename(linked_doc,linked_doc_lang).epub,
+ pdf_landscape: by_filename(linked_doc,linked_doc_lang).pdf_landscape,
+ pdf_portrait: by_filename(linked_doc,linked_doc_lang).pdf_landscape,
+ odt: by_filename(linked_doc,linked_doc_lang).odt,
+ xhtml: by_filename(linked_doc,linked_doc_lang).xhtml,
+ xml_sax: by_filename(linked_doc,linked_doc_lang).xml_sax,
+ xml_dom: by_filename(linked_doc,linked_doc_lang).xml_dom,
+ txt: by_filename(linked_doc,linked_doc_lang).txt,
+ html_concordance: by_filename(linked_doc,linked_doc_lang).html_concordance,
+ digest: by_filename(linked_doc,linked_doc_lang).digest,
+ sisupod: by_filename(linked_doc,linked_doc_lang,source).sisupod,
+ source: by_filename(linked_doc,linked_doc_lang,source).source,
+ }
+ end
+ linked_title="#{pre}{#{txt} }#{lnk[:manifest]}#{note}\n\n"
+ tuned_file_tmp << linked_title
+ output_filetypes=output_filetypes_in_cmd(cmd,lnk)
+ output_filetypes[:gen].each do |o_f|
+ describe = o_f
+ if describe
+ tuned_file_tmp << if @u.remote #to double space <:br> at beginning of entry
+ "#{Mx[:nbsp]*4} #{describe} "
+ else # remove ...
+ "[provide document placement host location]"
+ end
+ end
+ end
+ output_filetypes[:src].each do |o_f|
+ describe = o_f
+ if describe
+ tuned_file_tmp << if @u.remote
+ "#{Mx[:nbsp]*4} #{describe} "
+ 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/v2/dal_hash_digest.rb b/lib/sisu/v4/dal_hash_digest.rb
index a78c54f1..8718c461 100644
--- a/lib/sisu/v2/dal_hash_digest.rb
+++ b/lib/sisu/v4/dal_hash_digest.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -31,11 +32,9 @@
If you have Internet connection, the latest version of the GPL should be
available at these locations:
<http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/copyleft/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -56,29 +55,30 @@
** Description: system environment, resource control and configuration details
=end
-module SiSU_hash
- require "#{SiSU_lib}/shared_markup_alt.rb" #shared_markup_alt.rb
- class Object_digest
+module SiSU_DAL_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::Info_env.new(@md.fns)
+ @env ||=SiSU_Env::InfoEnv.new(@md.fns)
end
def object_digest
# 1. clean/stripped text without any markup, paragraph, headings etc. without endnotes
# 2. endnotes clean/stripped text digest only (there may be several endnotes within a paragraph)
# 3. whole object, text with markup and any endnotes, (question: with or without the endnote digests??? presumption better without, [however may be easier to check with?])
# [digests should not include other digests]
- data=@data
+ data=@data.compact
@tuned_file=[]
- data.compact!
sha_ =(@env.digest.type=='sha256' ? true : false)
sha_ ? (require 'digest/sha2') : (require 'digest/md5')
data.each do |t_o|
- unless t_o.obj.class==Array
- t_o.obj.strip!
+ unless t_o.obj.is_a?(Array)
+ t_o.obj=t_o.obj.strip
end
- if t_o.of !~/structure|comment|layout/ \
- and t_o.ocn.class==Fixnum
+ if (t_o.of !=:structure \
+ && t_o.of !=:comment \
+ && t_o.of !=:layout) \
+ && t_o.ocn.is_a?(Fixnum)
if sha_
for hash_class in [ Digest::SHA256 ]
@tuned_file << stamped(t_o,hash_class)
@@ -101,14 +101,14 @@ module SiSU_hash
when /#{Mx[:en_a_o]}|#{Mx[:en_b_o]}/
if en_plus =~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/
t_o_txt,en_open,en_txt,en_close=/(.*?)(#{Mx[:en_a_o]}|#{Mx[:en_b_o]})(.+?)(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m.match(en_plus)[1..4]
- stripped_en=SiSU_text_representation::Alter.new(en_txt).strip_clean_of_markup
+ stripped_en=SiSU_TextRepresentation::Alter.new(en_txt).strip_clean_of_markup
digest_en_strip=if @env.digest.type =~/sha256/
Digest::SHA256.hexdigest(stripped_en)
else
Digest::MD5.hexdigest(stripped_en)
end
t_o_txt + en_open + en_txt + Mx[:id_o] + digest_en_strip + Mx[:id_c] + en_close
- else puts "Error Exception - problem encountered with:\n#{en_plus}" #arbitrary exception, tidy up
+ else STDERR.puts "Error Exception - problem encountered with:\n#{en_plus}" #arbitrary exception, tidy up
end
else en_plus
end
@@ -116,16 +116,16 @@ module SiSU_hash
t_o_bit.join
end
def stamped(t_o,hash_class) #decide what hash information is most useful, is compromise necessary?
- t_o.obj=SiSU_text_representation::Alter.new(t_o).strip_clean_of_extra_spaces
+ t_o.obj=SiSU_TextRepresentation::Alter.new(t_o).strip_clean_of_extra_spaces
t_obj=t_o.inspect.sub(/:0x[0-9a-f]{8}\s/,': ')
- stripped=SiSU_text_representation::Alter.new(t_o).strip_clean_of_markup
- markup=SiSU_text_representation::Alter.new(t_o).semi_revert_markup
- digests=SiSU_text_representation::Modified_text_plus_Hash_digest.new(@md,t_o).composite.dgst
- unless t_o.is=='code'
+ stripped=SiSU_TextRepresentation::Alter.new(t_o).strip_clean_of_markup
+ markup=SiSU_TextRepresentation::Alter.new(t_o).semi_revert_markup
+ digests=SiSU_TextRepresentation::ModifiedTextPlusHashDigest.new(@md,t_o).composite.dgst
+ unless t_o.is==:code
case t_o.obj
when /#{Mx[:en_a_o]}[\d*+]+\s+.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}[*+]\d+\s+.+?#{Mx[:en_b_c]}/m
en_and_t_o,en_and_t_o_digest=[],[]
- t_o.obj.gsub!(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m,' \1') #watch
+ t_o.obj=t_o.obj.gsub(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m,' \1') #watch
t_o_plus_en=t_o.obj.scan(/.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/m)
t_o_tail=if t_o.obj =~/(?:.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})+([\s\S]+)/m
/(?:.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})+.*/m.match(t_o.obj)[1]
@@ -144,11 +144,11 @@ module SiSU_hash
def strip_clean_extra_spaces(s) # dal output tuned
s=s.dup
s=s.gsub(/[ ]+([,.;:?](?:$|\s))/,'\1') unless s =~/#{Mx[:en_a_o]}|#{Mx[:en_b_o]}/
- s=s.gsub(/ [ ]+/,' ')
- s=s.gsub(/^ [ ]+/,'')
- s=s.gsub(/ [ ]+$/,'')
- s=s.gsub(/((?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})')[ ]+(s )/,'\1\2')
- s=s.gsub(/((?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})')[ ]+(s )/,'\1\2')
+ s=s.gsub(/ [ ]+/,' ').
+ gsub(/^ [ ]+/,'').
+ gsub(/ [ ]+$/,'').
+ gsub(/((?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})')[ ]+(s )/,'\1\2').
+ gsub(/((?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})')[ ]+(s )/,'\1\2')
end
end
end
diff --git a/lib/sisu/v2/dal_idx.rb b/lib/sisu/v4/dal_idx.rb
index 7c00be3c..db4ba9c1 100644
--- a/lib/sisu/v2/dal_idx.rb
+++ b/lib/sisu/v4/dal_idx.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -31,11 +32,9 @@
If you have Internet connection, the latest version of the GPL should be
available at these locations:
<http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/copyleft/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -56,14 +55,14 @@
** Description: system environment, resource control and configuration details
=end
-module SiSU_book_index
- class Book_index
+module SiSU_DAL_BookIndex
+ class BookIndex
def initialize(md,data,env=nil)
@md,@data,@env=md,data,env
@rgx_idx=/#{Mx[:idx_o]}(?:.+?)#{Mx[:idx_c]}\s*/
@rgx_idx_ocn_seg=/(.+?)~(\d+)~(\S+)/
@rgx_idx_ocn=/(.+?)~(\d+)/
- @env ||=SiSU_Env::Info_env.new(@md.fns)
+ @env ||=SiSU_Env::InfoEnv.new(@md.fns)
end
def indexing_song
data=@data
@@ -75,11 +74,16 @@ module SiSU_book_index
tuned_file=[]
idx_array=[]
data.each do |dob|
- if dob.is =~/heading/ \
- and dob.ln==4
+ if (dob.is ==:heading \
+ || dob.is ==:heading_insert) \
+ && dob.ln==4
@seg=dob.name
end
- idx_array << "#{dob.idx}~#{dob.ocn}~#{@seg}" if defined? dob.idx and not (dob.idx.nil? or dob.idx.empty?)
+ if defined? dob.idx \
+ and dob.idx.is_a?(String) \
+ and not dob.idx.empty?
+ idx_array << "#{dob.idx}~#{dob.ocn}~#{@seg}"
+ end
tuned_file << dob if dob
end
idx_array=construct_idx_array(idx_array) if idx_array.length > 0
@@ -101,48 +105,54 @@ module SiSU_book_index
g=idx_list.scan(/[^;]+/)
idxl=[]
g.each do |i|
- i.strip!
- idxl << { :rough_idx => i, :ocn => ocn, :seg => seg }
+ i=i.strip
+ idxl << { rough_idx: i, ocn: ocn, seg: seg }
end
idxl
- else { :rough_idx => idx_list, :ocn => ocn, :seg => seg }
+ else { rough_idx: idx_list, ocn: ocn, seg: seg }
end
end
- idx_lst.flatten!
- idx_lst
+ idx_lst=idx_lst.flatten
end
def construct_book_index(idx_array)
the_idx={}
idx_array.each do |idx|
- idx_lst=idx[:rough_idx].scan(/[^|:]+/)
- idx_lst[0].strip!
- if idx_lst[0] =~/.+?\+\d+/
- use,plus=/(.+?)\+(\d+)/.match(idx_lst[0])[1,2]
- else use=idx_lst[0]
- end
- use=use[0].chr.capitalize + use[1,use.length]
- the_idx[use]={} unless the_idx[use] and defined? the_idx[use]
- idx_lst.each do |i|
- i.strip!
- i,r=/(.+?)\+(\d+)/.match(i)[1,2] if i =~/.+?\+\d+/
- x=if idx_lst.length==1 or idx_lst[0].gsub(/\+\d+/,'')==i
- the_idx[use]['term_node_lev1']=[] unless the_idx[use]['term_node_lev1'] and defined? the_idx[use]['term_node_lev1']
- x=if r
- the_idx[use]['term_node_lev1'] << { :ocn => idx[:ocn], :range => "#{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}", :seg => idx[:seg] }
- "#{i} #{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}"
- else
- the_idx[use]['term_node_lev1'] << { :ocn => idx[:ocn], :seg => idx[:seg] }
- "#{i} #{idx[:ocn]}"
- end
- else
- the_idx[use]['term_node_lev2']={} unless the_idx[use]['term_node_lev2'] and defined? the_idx[use]['term_node_lev2']
- the_idx[use]['term_node_lev2'][i]=[] unless the_idx[use]['term_node_lev2'][i] and defined? the_idx[use]['term_node_lev2'][i]
- x=if r
- the_idx[use]['term_node_lev2'][i] << { :ocn => idx[:ocn], :range => "#{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}", :seg => idx[:seg] }
- "#{idx_lst[0]}:#{i} #{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}"
+ if idx[:rough_idx] =~/[|]/ \
+ && idx[:rough_idx] !~/[:]/
+ if @md.opt.cmd =~/[MVv]/
+ p 'book index error? --> ' + idx[:rough_idx]
+ end
+ else
+ idx_lst=idx[:rough_idx].scan(/[^|:]+/)
+ idx_lst[0]=idx_lst[0].strip
+ if idx_lst[0] =~/.+?\+\d+/
+ use,plus=/(.+?)\+(\d+)/.match(idx_lst[0])[1,2]
+ else use=idx_lst[0]
+ end
+ use=use[0].chr.capitalize + use[1,use.length]
+ the_idx[use]={} unless the_idx[use] and defined? the_idx[use]
+ idx_lst.each do |i|
+ i=i.strip
+ i,r=/(.+?)\+(\d+)/.match(i)[1,2] if i =~/.+?\+\d+/
+ x=if idx_lst.length==1 or idx_lst[0].gsub(/\+\d+/,'')==i
+ the_idx[use]['term_node_lev1']=[] unless the_idx[use]['term_node_lev1'] and defined? the_idx[use]['term_node_lev1']
+ x=if r
+ the_idx[use]['term_node_lev1'] << { ocn: idx[:ocn], range: "#{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}", seg: idx[:seg] }
+ "#{i} #{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}"
+ else
+ the_idx[use]['term_node_lev1'] << { ocn: idx[:ocn], seg: idx[:seg] }
+ "#{i} #{idx[:ocn]}"
+ end
else
- the_idx[use]['term_node_lev2'][i] << { :ocn => idx[:ocn], :seg => idx[:seg] }
- "#{idx_lst[0]}:#{i} #{idx[:ocn]}"
+ the_idx[use]['term_node_lev2']={} unless the_idx[use]['term_node_lev2'] and defined? the_idx[use]['term_node_lev2']
+ the_idx[use]['term_node_lev2'][i]=[] unless the_idx[use]['term_node_lev2'][i] and defined? the_idx[use]['term_node_lev2'][i]
+ x=if r
+ the_idx[use]['term_node_lev2'][i] << { ocn: idx[:ocn], range: "#{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}", seg: idx[:seg] }
+ "#{idx_lst[0]}:#{i} #{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}"
+ else
+ the_idx[use]['term_node_lev2'][i] << { ocn: idx[:ocn], seg: idx[:seg] }
+ "#{idx_lst[0]}:#{i} #{idx[:ocn]}"
+ end
end
end
end
@@ -151,28 +161,28 @@ module SiSU_book_index
the_idx
end
def clean_xml(str)
- str.gsub!(/&/,'&#038;')
- str.gsub!(/\(/,'&#040;')
- str.gsub!(/\)/,'&#041;')
- str.gsub!(/\*/,'&#042;')
- str.gsub!(/\+/,'&#043;')
- str.gsub!(/,/,'&#044;')
+ str=str.gsub(/&/,'&#038;').
+ gsub(/\(/,'&#040;').
+ gsub(/\)/,'&#041;').
+ gsub(/\*/,'&#042;').
+ gsub(/\+/,'&#043;').
+ gsub(/,/,'&#044;')
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_document_structure::Object_layout.new.break(h)
+ h={obj: Mx[:br_page]}
+ o=SiSU_DAL_DocumentStructure::ObjectLayout.new.break(h)
idx[:sst_rel_html_seg] << o
idx[:sst_rel] << o
- h={:lv=>'2',:name=>'index',:obj=>"Index"}
- o=SiSU_document_structure::Object_heading.new.heading(h)
+ h={lv: '2', name: 'index', obj: "Index"}
+ o=SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h)
idx[:sst_rel_html_seg] << o
idx[:sst_rel] << o
- h={:lv=>'4',:name=>'idx',:obj=>" [Index] #{Mx[:pa_non_object_dummy_heading]}"}
- o=SiSU_document_structure::Object_heading.new.heading(h)
+ h={lv: '4', name: 'idx', obj: " [Index] #{Mx[:pa_non_object_dummy_heading]}"}
+ o=SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h)
idx[:sst_rel_html_seg] << o
idx[:sst_rel] << o
alph=%W[9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z]
@@ -194,7 +204,7 @@ module SiSU_book_index
idx[:xhtml] << %{\n<p class="letter" id="numeral">0 - 9</p>}
the_idx.each do |i|
i.each do |x|
- if x.class==String
+ if x.is_a?(String)
f=/^(\S)/.match(x)[1]
if letter < f
while letter < f
@@ -216,25 +226,25 @@ module SiSU_book_index
@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.cmd =~/V/
- elsif x.class==Array
+ print "\n" + x + ', ' if @md.opt.cmd =~/V/
+ elsif x.is_a?(Array)
p 'array error? -->'
print x
- elsif x.class==Hash
- if x['term_node_lev1'].class==Array
+ elsif x.is_a?(Hash)
+ if x['term_node_lev1'].is_a?(Array)
x['term_node_lev1'].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.cmd =~/V/
+ print a[:range] + ', ' if @md.opt.cmd =~/V/
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.cmd =~/V/
+ print a[:ocn] + ', ' if @md.opt.cmd =~/V/
else p 'error'
end
end
@@ -251,20 +261,20 @@ module SiSU_book_index
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.cmd =~/V/
+ print "\n\t" + k + ', ' if @md.opt.cmd =~/V/
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.cmd =~/V/
+ print z[:range] + ', ' if @md.opt.cmd =~/V/
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.cmd =~/V/
+ print z[:ocn] + ', ' if @md.opt.cmd =~/V/
else p 'error'
end
end
@@ -278,19 +288,19 @@ module SiSU_book_index
end
end
end
- print "\n" if @md.cmd =~/V/
+ print "\n" if @md.opt.cmd =~/V/
idx
end
def screen_print(the_idx)
the_idx.each do |i|
i.each do |x|
- if x.class==String
+ if x.is_a?(String)
print "\n" + x + ', '
- elsif x.class==Array
+ elsif x.is_a?(Array)
p 'array error? -->'
print x
- elsif x.class==Hash
- if x['term_node_lev1'].class==Array
+ elsif x.is_a?(Hash)
+ if x['term_node_lev1'].is_a?(Array)
x['term_node_lev1'].each do |a|
if a[:range]
print a[:range] + ', '
@@ -347,7 +357,7 @@ module SiSU_book_index
def clean_index(data) #check on use of dob
tuned_file=[]
data.each do |para|
- para.gsub!(/\n*#{@rgx_idx}/m,'')
+ para=para.gsub(/\n*#{@rgx_idx}/m,'')
tuned_file << para
end
tuned_file
diff --git a/lib/sisu/v2/dal_images.rb b/lib/sisu/v4/dal_images.rb
index 2f9eb79d..9c6dd872 100644
--- a/lib/sisu/v2/dal_images.rb
+++ b/lib/sisu/v4/dal_images.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -31,11 +32,9 @@
If you have Internet connection, the latest version of the GPL should be
available at these locations:
<http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/copyleft/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -56,7 +55,7 @@
** Description: system environment, resource control and configuration details
=end
-module SiSU_images
+module SiSU_DAL_Images
class Images
#require 'RMagick'
#include Magick
@@ -67,7 +66,7 @@ module SiSU_images
data=@data
tuned_file=[]
@rmgk=false
- imagemagick_=SiSU_Env::Info_settings.new.program?('rmagick')
+ imagemagick_=true #imagemagick_=SiSU_Env::InfoSettings.new.program?('rmagick')
if imagemagick_
begin
@rmgk=SiSU_Env::Load.new('RMagick').prog
@@ -75,13 +74,13 @@ module SiSU_images
@rmgk=false
end
else
- if @md.cmd =~/[vVM]/
- SiSU_Screen::Ansi.new(@md.cmd,'use of RMagick is not enabled in sisurc.yml').warn
+ if @md.opt.cmd =~/[vVM]/
+ SiSU_Screen::Ansi.new(@md.opt.cmd,'*WARN* use of RMagick is not enabled in sisurc.yml').warn
end
end
data.each do |dob|
- unless dob.is =~/^table/
- dob.obj.strip!
+ unless dob.is ==:table
+ dob.obj=dob.obj.strip
if dob.obj =~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif)(?:\s*|\s+.+)?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/
if dob.obj !~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif)\s+\d+x\d+/
m=/#{Mx[:lnk_o]}\s*(\S+\.(?:png|jpg|gif))/
@@ -89,8 +88,8 @@ module SiSU_images
imgs=dob.obj.scan(m).flatten
img_col=img_row=nil
images=imgs.each do |image|
- dir=SiSU_Env::Info_env.new(@md.fns)
- path_image=[dir.path.image_source_local_tex,dir.path.image_source_remote_tex,dir.path.image_source_tex]
+ 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
@@ -101,11 +100,11 @@ module SiSU_images
img=Magick::ImageList.new("#{image_path}/#{image}")
img_col,img_row=img.columns,img.rows
else
- if @md.cmd =~/[vVM]/
- SiSU_Screen::Ansi.new(@md.cmd,'RMagick not present, will attempt to use imagemagick (identify) directly').warn
+ if @md.opt.cmd =~/[vVM]/
+ SiSU_Screen::Ansi.new(@md.opt.cmd,'*WARN* RMagick not present, will attempt to use imagemagick (identify) directly').warn
end
- imgk=SiSU_Env::System_call.new.imagemagick
- gmgk=SiSU_Env::System_call.new.graphicksmagick
+ imgk=SiSU_Env::SystemCall.new.imagemagick
+ gmgk=SiSU_Env::SystemCall.new.graphicksmagick
if imgk or gmgk
if imgk
imgsys=`identify #{image_path}/#{image}`.strip #system call
@@ -133,18 +132,20 @@ module SiSU_images
img_col=((1.00*img_row/row)*col).round
end
end
- dob.obj.gsub!(/(#{image})/,"#{image} #{img_col}x#{img_row}")
- else dob.obj.gsub!(/#{Mx[:lnk_o]}\s*(\S+)\.(png|jpg|gif).+?#{Mx[:lnk_c]}(#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/,'[ \1 (\2 missing) ]')
+ dob.obj=dob.obj.gsub(/(#{image})/,"#{image} #{img_col}x#{img_row}")
+ else dob.obj=dob.obj.gsub(/#{Mx[:lnk_o]}\s*(\S+)\.(png|jpg|gif).+?#{Mx[:lnk_c]}(#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/,'[ \1 (\2 missing) ]')
end
end
else
images=dob.obj.scan(m) do |image|
- SiSU_Screen::Ansi.new(@md.cmd,'where image dimensions have not been provided RMagick or imagemagick is required',image).warn #unless @opt.cmd =~/q/
+ SiSU_Screen::Ansi.new(@md.opt.cmd,'*WARN* where image dimensions have not been provided RMagick or imagemagick is required',image).warn #unless @opt.cmd =~/q/
end
end
end
end
- dob.obj.gsub!(/(#{Mx[:lnk_o]})\s*(\S+\.(?:png|jpg|gif))\s+/i,'\1\2 ') if dob.obj =~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/
+ if dob.obj =~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/
+ dob.obj=dob.obj.gsub(/(#{Mx[:lnk_o]})\s*(\S+\.(?:png|jpg|gif))\s+/i,'\1\2 ')
+ end
end
tuned_file << dob unless dob.nil?
end
diff --git a/lib/sisu/v2/dal_metadata.rb b/lib/sisu/v4/dal_metadata.rb
index 77b58f86..cfdf9606 100644
--- a/lib/sisu/v2/dal_metadata.rb
+++ b/lib/sisu/v4/dal_metadata.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -31,11 +32,9 @@
If you have Internet connection, the latest version of the GPL should be
available at these locations:
<http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/copyleft/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -56,21 +55,21 @@
** Description: system environment, resource control and configuration details
=end
-module SiSU_metadata
+module SiSU_DAL_Metadata
class Metadata
def initialize(md,metad)
@md,@metadata=md,metad
- l=SiSU_Env::Standardise_language.new.file_to_language(md.fns)
- language=l[:l]
+ l=SiSU_Env::StandardiseLanguage.new(@md.opt.lng).language
+ language=l[:n]
@tr=SiSU_Translate::Source.new(md,language)
end
def make_para(obj,ocn)
- h={:obj=>obj,:ocn=>0}
- SiSU_document_structure::Object_para.new.paragraph(h)
+ h={ obj: obj, ocn: 0 }
+ SiSU_DAL_DocumentStructure::ObjectPara.new.paragraph(h)
end
def make_heading(obj,ocn,name,lv,ln)
- h={:lv=>lv,:ln=>ln,:name=>name,:obj=>obj,:ocn=>0}
- SiSU_document_structure::Object_heading.new.heading(h)
+ h={ lv: lv, ln: ln, name: name, obj: obj, ocn: 0 }
+ SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h)
end
def metadata
end
diff --git a/lib/sisu/v2/dal_numbering.rb b/lib/sisu/v4/dal_numbering.rb
index c052db29..f81563f3 100644
--- a/lib/sisu/v2/dal_numbering.rb
+++ b/lib/sisu/v4/dal_numbering.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -31,11 +32,9 @@
If you have Internet connection, the latest version of the GPL should be
available at these locations:
<http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/copyleft/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -56,7 +55,7 @@
** Description: system environment, resource control and configuration details
=end
-module SiSU_numbering
+module SiSU_DAL_Numbering
class Numbering
attr_accessor :obj,:osp,:ocn,:lv,:name,:index,:comment
def initialize(md,data)
@@ -77,12 +76,15 @@ module SiSU_numbering
def number_plaintext_para(data)
@tuned_file=[]
data.each do |dob|
- if dob.of !~/(?:group|comment|layout)/ and dob.ocn_ #and dob.obj !~ /#{Mx[:gr_o]}Th|#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}/ #FIX
- dob.obj.gsub!(/(.+)\n/,'\1 ') #messy, but idea is that tables should retain breaks
+ if (dob.of !=:block \
+ && dob.of !=:comment \
+ && dob.of !=:layout) \
+ && dob.ocn_ #and dob.obj !~ /#{Mx[:gr_o]}Th|#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}/ #FIX
+ dob.obj=dob.obj.gsub(/(.+)\n/,'\1 ') #messy, but idea is that tables should retain breaks
end
- unless dob.obj.class==Array
- dob.obj.gsub!(/^\s+/,'')
- dob.obj.gsub!(/\s$/,"\n")
+ unless dob.obj.is_a?(Array)
+ dob.obj=dob.obj.gsub(/^\s+/,'').
+ gsub(/\s$/,"\n")
end
@tuned_file << dob
end
@@ -90,37 +92,35 @@ module SiSU_numbering
end
def number_sub_heading(dob,num,title_no)
unless dob.obj =~/\d+\.|(?:chapter|article|section|clause)\s+\d+/i #name selection arbitrary, fix
- case dob.name
- when /-/; dob.obj.gsub!(/^/,"#{title_no} ")
- when /^#/; dob.obj.gsub!(/^/,"#{title_no} ")
- when /^[a-z_\.]+/
- dob.obj.gsub!(/^/,"#{title_no} ")
+ dob.obj=case dob.name
+ when /-/; dob.obj.gsub(/^/,"#{title_no} ")
+ when /^#/; dob.obj.gsub(/^/,"#{title_no} ")
+ when /^[a-z_\.]+/; dob.obj.gsub(/^/,"#{title_no} ")
else
dob.name=title_no if dob.name=~/^$/ #where title contains title number
- dob.obj.gsub!(/^/,"#{title_no} ") if title_no =~/\d+/ #main, where title number is to be provided #watch changed placement
+ dob.obj.gsub(/^/,"#{title_no} ") if title_no =~/\d+/ #main, where title number is to be provided #watch changed placement
end
if @md.toc_lev_limit \
and @md.toc_lev_limit < num
- dob.obj.gsub!(/^/,'!_ ') #bold line, watch
+ dob.obj=dob.obj.gsub(/^/,'!_ ') #bold line, watch
end
end
dob
end
def heading_tag_clean(heading_tag)
- heading_tag.gsub!(/[ ]+/,'_')
- heading_tag.gsub!(/["']/,'')
- heading_tag.gsub!(/[\/]/,'-')
- heading_tag.gsub!(/#{Mx[:fa_bold_o]}|#{Mx[:fa_bold_c]}/,'')
- heading_tag.gsub!(/#{Mx[:fa_italics_o]}|#{Mx[:fa_italics_c]}/,'')
- heading_tag.gsub!(/#{Mx[:fa_underscore_o]}|#{Mx[:fa_underscore_c]}/,'')
- heading_tag.gsub!(/#{Mx[:fa_cite_o]}|#{Mx[:fa_cite_c]}/,'')
- heading_tag.gsub!(/#{Mx[:fa_insert_o]}|#{Mx[:fa_insert_c]}/,'')
- heading_tag.gsub!(/#{Mx[:fa_strike_o]}|#{Mx[:fa_strike_c]}/,'')
- heading_tag.gsub!(/#{Mx[:fa_superscript_o]}|#{Mx[:fa_superscript_c]}/,'')
- heading_tag.gsub!(/#{Mx[:fa_subscript_o]}|#{Mx[:fa_subscript_c]}/,'')
- heading_tag.gsub!(/#{Mx[:fa_hilite_o]}|#{Mx[:fa_hilite_c]}/,'')
- heading_tag.gsub!(/#{Mx[:gl_bullet]}/,'')
- heading_tag
+ heading_tag=heading_tag.gsub(/[ ]+/,'_').
+ gsub(/["']/,'').
+ gsub(/[\/]/,'-').
+ gsub(/#{Mx[:fa_bold_o]}|#{Mx[:fa_bold_c]}/,'').
+ gsub(/#{Mx[:fa_italics_o]}|#{Mx[:fa_italics_c]}/,'').
+ gsub(/#{Mx[:fa_underscore_o]}|#{Mx[:fa_underscore_c]}/,'').
+ gsub(/#{Mx[:fa_cite_o]}|#{Mx[:fa_cite_c]}/,'').
+ gsub(/#{Mx[:fa_insert_o]}|#{Mx[:fa_insert_c]}/,'').
+ gsub(/#{Mx[:fa_strike_o]}|#{Mx[:fa_strike_c]}/,'').
+ gsub(/#{Mx[:fa_superscript_o]}|#{Mx[:fa_superscript_c]}/,'').
+ gsub(/#{Mx[:fa_subscript_o]}|#{Mx[:fa_subscript_c]}/,'').
+ gsub(/#{Mx[:fa_hilite_o]}|#{Mx[:fa_hilite_c]}/,'').
+ gsub(/#{Mx[:gl_bullet]}/,'')
end
def auto_number_heading_ie_title(data) #also does some segment naming
@tuned_file=[]
@@ -135,20 +135,20 @@ module SiSU_numbering
no1=num_top; no2=(num_top + 1); no3=(num_top + 2); no4=(num_top + 3)
end
t_not=0
- data.compact!
chapter_number_counter=0
+ data=data.compact
data.each do |dob| #@md.seg_names << [additions to segment names]
title_no=nil
- dob=SiSU_document_structure_extract::Structure.new(@md,dob).structure_markup #must happen earlier, node info etc. require
- if dob.is =='heading' \
- and dob.autonum_ \
+ dob=SiSU_DAL_DocumentStructureExtract::Structure.new(@md,dob).structure_markup #must happen earlier, node info etc. require
+ if dob.is ==:heading \
+ && dob.autonum_ \
and defined? @md.make.num_top \
and @md.make.num_top !~/^$/
if dob.lv=='1' \
and dob.obj =~/^#\s|\s#(?:\s|$)/
chapter_number_counter +=1
- dob.obj.gsub!(/^#\s/,"#{chapter_number_counter} ")
- dob.obj.gsub!(/#([:,]?\s|[.]?$)/,"#{chapter_number_counter}\\1")
+ dob.obj=dob.obj.gsub(/^#\s/,"#{chapter_number_counter} ").
+ gsub(/#([:,]?\s|[.]?$)/,"#{chapter_number_counter}\\1")
end
if dob.ln==no1
@subnumber=1
@@ -160,7 +160,7 @@ module SiSU_numbering
if dob.ln==no1
t_no1+=1; t_no2=0; t_no3=0
title_no="#{t_no1}"
- if not @md.seg_names.nil? \
+ if @md.seg_names.is_a?(Array) \
and not @md.seg_names.include?(title_no)
if dob.ln==no1
dob.name="#{title_no}" if not dob.name
@@ -168,15 +168,15 @@ module SiSU_numbering
tag=dob.obj.gsub(/(Article|Clause|Section|Chapter)\s+/,"\\1_#{title_no}").downcase
tag=heading_tag_clean(tag)
dob.tags=[tag,dob.tags].flatten if tag !~/^\d+$/ #check whether will work across file types with stop signs
- (dob.obj =~/(Article|Clause|Section)\s+/) \
- ? (dob.obj.gsub!(/(Article|Clause|Section)\s+/,"\\1 #{title_no} ")) \
- : (dob.obj.gsub!(/^/,"#{title_no}. ")) #fix stop later
+ dob.obj=(dob.obj =~/(Article|Clause|Section)\s+/) \
+ ? (dob.obj.gsub(/(Article|Clause|Section)\s+/,"\\1 #{title_no} "))
+ : (dob.obj.gsub(/^/,"#{title_no}. ")) #fix stop later
end
if dob.ln !=no1 \
and dob.obj =~/^[\d.]+\s/ #fix -> if the title starts with a numbering scheme, do not auto-number, review
dob.name ="#{title_no}" if not dob.name
dob.tags=[title_no,dob.tags].flatten if title_no !~/^\d+$/ #check whether will work across file types with stop signs
- dob.obj.gsub!(/^/,"#{title_no}. ")
+ dob.obj=dob.obj.gsub(/^/,"#{title_no}. ")
end
@md.seg_names << title_no
end
@@ -184,7 +184,7 @@ module SiSU_numbering
and dob.name!~/^[a-z_\.]+$/ \
and dob.obj !~/[A-Z]\.?\s/ #bug -> tmp fix, excludes A. B. C. lettering, but not roman numerals, is arbitrary, review required # not fixed, work on
dob.tags=[title_no,dob.tags].flatten if title_no !~/^\d+$/ #check whether will work across file types with stop signs
- dob.obj.gsub!(/^/i,"#{title_no}. ")
+ dob.obj=dob.obj.gsub(/^/i,"#{title_no}. ")
end
end
if dob.ln==no1 #watch because here you change dob.name
@@ -207,7 +207,7 @@ module SiSU_numbering
dob.tags=[dob.name,dob.tags].flatten if dob.name !~/^\d+$/ #check whether will work across file types with stop signs
dob.name.gsub(/^([a-z_\.]+)-$/,'\1')
end
- elsif dob.is =='heading' \
+ elsif dob.is ==:heading \
and dob.autonum_ \
and @md.markup =~/num_extract/ #AS DANGEROUS force enable with document, note already does this type of numbering for cisg, locate and coordinate logic, is currently misplaced in code, chengwei inspired 2004w23/4
#here lies a bug, as is nil when run from -Dv --update, FIX
@@ -229,11 +229,11 @@ module SiSU_numbering
@tuned_file=@tuned_file.flatten
end
def ocn(data) #and auto segment numbering increment
- @tuned_file=SiSU_document_structure_extract::OCN.new(@md,data).ocn
+ @tuned_file=SiSU_DAL_DocumentStructureExtract::OCN.new(@md,data).ocn
@tuned_file
end
def xml(data)
- @tuned_file=SiSU_document_structure_extract::XML.new(@md,data).dom
+ @tuned_file=SiSU_DAL_DocumentStructureExtract::XML.new(@md,data).dom
@tuned_file
end
def minor_numbering(data) #and auto segment numbering increment
@@ -241,20 +241,23 @@ module SiSU_numbering
number_small,letter_small=0,0
letter=%w( a b c d e f g h i j k l m n o p q r s t u v w x y z )
data.each do |dob|
- if dob.of =~/heading|para|group/
- if dob.is =='heading' \
+ if dob.of ==:heading \
+ || dob.of ==:heading_insert \
+ || dob.of ==:para \
+ || dob.of ==:block
+ if dob.is ==:heading \
and dob.ln.to_s=~/^[1-9]/ #% sub-number system, (baby numbering) reset with any change of major number (more obviously should be placed in number titles, but that is conditionally executed, check and move later)
number_small,letter_small=0,0
- elsif dob.is =~/para/
+ elsif dob.is ==:para
if dob.obj =~/^#[ 1]/ \
and dob.obj !~/^#\s+(?:~#)?$/
letter_small=0
number_small=0 if dob.obj =~ /^#1/
number_small+=1
- dob.obj.gsub!(/^#[ 1]/,"#{number_small}. ") #change 2004
+ dob.obj=dob.obj.gsub(/^#[ 1]/,"#{number_small}. ")
end
if dob.obj =~/^_# /
- dob.obj.gsub!(/^_# /,"#{letter[letter_small]}. ") #change 2004
+ dob.obj=dob.obj.gsub(/^_# /,"#{letter[letter_small]}. ")
dob.indent='1'
letter_small+=1
end
@@ -282,13 +285,13 @@ module SiSU_numbering
tags={}
art_filename_auto=1
@counter=1
- if not @md.seg_autoname_safe and @md.cmd =~/[MV]/
+ if not @md.seg_autoname_safe and @md.opt.cmd =~/[MV]/
puts 'manual segment names, numbers used as names, risk warning (segmented html)'
end
ocn_html_seg=[]
data.each do |dob|
- if dob.is=='heading' \
- and dob.ln \
+ if dob.is==:heading \
+ && dob.ln \
and dob.ln.to_s =~/^[456]/
if dob.ln==4 \
and not dob.name \
@@ -298,19 +301,19 @@ module SiSU_numbering
if dob.name !~/^\S+/ \
and dob.obj =~/^\s*(?:\S+\s+)?([\d.,:-]+)/m #heading starts with a recognised numeric or word followed by a recognised numerical construct, use that as name
possible_seg_name=$1
- possible_seg_name.gsub!(/(?:[:,-]|\W)/,'.')
- possible_seg_name.gsub!(/\.$/,'')
- if not @md.seg_names.nil? \
+ possible_seg_name=possible_seg_name.gsub(/(?:[:,-]|\W)/,'.').
+ gsub(/\.$/,'')
+ if @md.seg_names.is_a?(Array) \
and not @md.seg_names.include?(possible_seg_name)
dob.name=possible_seg_name
dob.tags=[dob.name,dob.tags].flatten if dob.name !~/^\d+$/
@md.seg_names << possible_seg_name
- else puts 'warn, there may be a conflicting numbering scheme' if @md.cmd =~/[VM]/
+ else puts 'warn, there may be a conflicting numbering scheme' if @md.opt.cmd =~/[VM]/
end
end
if dob.ln==4 \
and dob.name #extract segment name from embedded document structure info
- if not @md.seg_names.nil? \
+ if @md.seg_names.is_a?(Array) \
and not @md.seg_names.include?(dob.name)
dob.tags=[dob.name,dob.tags].flatten if dob.name !~/^\d+$/
@md.seg_names << dob.name
@@ -320,7 +323,7 @@ module SiSU_numbering
and not dob.name #if still no segment name, provide a numerical one
pf='_' #pg='' #may use e.g. '' or '~' or '_'
segn_auto="#{pf}#{art_filename_auto.to_s}"
- if not @md.seg_names.nil? \
+ if @md.seg_names.is_a?(Array) \
and not @md.seg_names.include?(segn_auto)
dob.name=segn_auto
dob.tags=[dob.name,dob.tags].flatten if dob.name !~/^\d+$/ #check whether will work across file types with stop signs
@@ -334,18 +337,19 @@ module SiSU_numbering
puts "e r r o r -\t#{__FILE__}::#{__LINE__}\n#{dob.inspect}"
end
end
- if dob.is =~/heading/ \
- and dob.ln==4
+ if (dob.is ==:heading \
+ || dob.is ==:heading_insert) \
+ && dob.ln==4
@seg=dob.name
end
- @tuned_file << if dob.is=='heading' \
- and (@md.pagenew or @md.pagebreak)
+ @tuned_file << if dob.is==:heading \
+ && (@md.pagenew || @md.pagebreak)
m=dob.ln.to_s
dob_tmp=[]
if @md.pagenew.inspect =~/#{m}/
- dob_tmp << SiSU_document_structure::Object_layout.new.break(Hx[:br_page_new]) << dob
+ dob_tmp << SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_new]) << dob
elsif @md.pagebreak.inspect =~/#{m}/
- dob_tmp << SiSU_document_structure::Object_layout.new.break(Hx[:br_page]) << dob
+ dob_tmp << SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page]) << dob
end
para_result=unless dob_tmp.length > 0; dob
else dob_tmp
@@ -354,18 +358,18 @@ module SiSU_numbering
end
if defined? dob.ocn \
and dob.ocn
- @segname=((dob.is=='heading'|| dob.is=='heading_insert') && dob.ln==4 && (defined? dob.name)) \
- ? (dob.name) \
+ @segname=((dob.is==:heading || dob.is==:heading_insert) && dob.ln==4 && (defined? dob.name)) \
+ ? (dob.name)
: @segname
- tags["#{dob.ocn}"]={:segname=>@segname}
- ocn_html_seg[dob.ocn]=if dob.is =~/heading/
+ tags["#{dob.ocn}"]={ segname: @segname }
+ ocn_html_seg[dob.ocn]=if (dob.is==:heading || dob.is==:heading_insert)
x=if dob.ln =~/[1-3]/
- {:seg=>nil,:level=> dob.ln}
+ { seg: nil, level: dob.ln }
else #elsif dob.ln =~/[4-6]/
- {:seg=>@seg,:level=> dob.ln}
+ { seg: @seg, level: dob.ln }
end
else
- {:seg=>@seg,:level=>nil}
+ { seg: @seg, level: nil }
end
end
dob.tags=dob.tags.uniq if defined? dob.tags
@@ -375,7 +379,7 @@ module SiSU_numbering
#? (dob.name) \
#: @segname
dob.tags.each do |x|
- tags[x]={:ocn=>dob.ocn.to_s,:segname=>@segname} #@tags[x.to_s]=[dob.ocn.to_s,@segname.to_s]
+ tags[x]={ ocn: dob.ocn.to_s, segname: @segname }
end
end
dob
@@ -399,15 +403,21 @@ module SiSU_numbering
end
def set_heading_top(data) #% make sure no false positives
unless @md.set_heading_top
- puts "\tdocument contains no top level heading, (will have to manufacture one)" if @md.cmd =~/[MV]/
+ puts "\tdocument contains no top level heading, (will have to manufacture one)" if @md.opt.cmd =~/[MV]/
@tuned_file=[]
data.each do |t_o|
unless @md.set_heading_top
if t_o !~/^(?:#{Rx[:meta]}|@\S+:)\s/m \
and t_o !~/\A\s*\Z/m
@md.set_heading_top=true
- head=@md.title.main ? ([@lv='1',@obj=@md.title.main]) : ([@lv='1',@obj='[no title provided]'])
- @tuned_file << head
+ if defined? @md.title \
+ and @md.title \
+ and defined? @md.title.full \
+ and defined? @md.creator \
+ and @md.creator
+ head=@md.title.main ? ([@lv='1',@obj=@md.title.main]) : ([@lv='1',@obj='[no title provided]'])
+ @tuned_file << head
+ end
end
end
@tuned_file << t_o
@@ -417,17 +427,17 @@ module SiSU_numbering
end
def set_heading_seg(data) #% make sure no false positives
unless @md.set_heading_seg
- puts "\tdocument contains no segment level, (will have to manufacture one)" if @md.cmd =~/[MV]/
+ puts "\tdocument contains no segment level, (will have to manufacture one)" if @md.opt.cmd =~/[MV]/
@tuned_file=[]
data.each do |dob|
unless @md.set_heading_seg
if defined? dob.ln and dob.ln.to_s !~/^[123]/m \
and dob.obj !~/\A\s*\Z/m \
- and dob.is !='layout'
+ and dob.is !=:layout
@md.set_heading_seg=true
- head=if @md.title.main ; dob.ln,dob.name,dob.obj=4,'seg',@md.title.main
- else dob.ln,dob.name,dob.obj=4,'seg','[segment]'
- end
+ head=@md.title.main \
+ ? (dob.ln,dob.name,dob.obj=4,'seg',@md.title.main)
+ : (dob.ln,dob.name,dob.obj=4,'seg','[segment]')
@tuned_file << head
end
end
@@ -438,7 +448,7 @@ module SiSU_numbering
end
def set_header_title(data) #% make sure no false positives
unless @md.set_header_title
- puts "\t no document title provided, (will have to manufacture one)" if @md.cmd =~/[MV]/
+ puts "\t no document title provided, (will have to manufacture one)" if @md.opt.cmd =~/[MV]/
@tuned_file=[]
data.each do |t_o|
unless @md.set_header_title
diff --git a/lib/sisu/v2/dal_substitutions_and_insertions.rb b/lib/sisu/v4/dal_substitutions_and_insertions.rb
index c598b990..92e19034 100644
--- a/lib/sisu/v2/dal_substitutions_and_insertions.rb
+++ b/lib/sisu/v4/dal_substitutions_and_insertions.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -31,11 +32,9 @@
If you have Internet connection, the latest version of the GPL should be
available at these locations:
<http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/copyleft/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -56,98 +55,91 @@
** Description: system environment, resource control and configuration details
=end
-module SiSU_substitute_and_insert
+module SiSU_DAL_SubstituteAndInsert
class SI
def initialize(md,data)
@md,@data=md,data
- @skin=SiSU_Env::Info_skin.new(@md)
end
def substitutions_and_insertions?
data=@data
data_expand=[]
if data[0] =~ /^#!\s*(?:\/usr\/bin\/env sisu|\/usr\/bin\/sisu)/ # remove bang from top #! (however file is stripped, so will be removed provided no content precedes it)
- data[0].gsub!(/^#!\s*\/usr\/bin\/sisu/,'')
- data[0].gsub!(/^#!\s*\/usr\/bin\/env sisu/,'')
+ data[0]=data[0].gsub(/^#!\s*\/usr\/bin\/sisu/,'').
+ gsub(/^#!\s*\/usr\/bin\/env sisu/,'')
end
if data[0] =~ /^(SiSU\s+[\d.]*|sisu-[\d.]+)$/ # SiSU identifier
- data[0].gsub!(/^(SiSU\s*[\d.]*)$/,'% \1')
- data[0].gsub!(/^(sisu-[\d.]+)$/,'% \1')
+ data[0]=data[0].gsub(/^(SiSU\s*[\d.]*)$/,'% \1').
+ gsub(/^(sisu-[\d.]+)$/,'% \1')
end
data.each do |para|
if para =~/<:(insert\d+)!?>/ \
and para !~/^%\s+/
- @skin.select
ins=SiSU_Viz::Inserts.new
case para
when /^\s*<:(insert1)>\s*$/
i=$1
if defined? ins.insert1
para=[]
- ins.insert1.split(/\n\n/).each{|x| para << x }
- else p "skin #{i} not found in #{@skin.select}"
+ ins.insert1.split(/\n\n/).each {|x| para << x }
end
when /^\s*<:(insert2)>\s*$/
i=$1
if defined? ins.insert2
para=[]
- ins.insert2.split(/\n\n/).each{|x| para << x }
- else p "skin #{i} not found in #{@skin.select}"
+ ins.insert2.split(/\n\n/).each {|x| para << x }
end
when /^\s*<:(insert3)>\s*$/
i=$1
if defined? ins.insert3
para=[]
- ins.insert3.split(/\n\n/).each{|x| para << x << "\n"}
- else p "skin #{i} not found in #{@skin.select}"
+ ins.insert3.split(/\n\n/).each {|x| para << x << "\n"}
end
when /^\s*<:(insert4)>\s*$/
i=$1
if defined? ins.insert4
para=[]
- ins.insert4.split(/\n\n/).each{|x| para << x << "\n"}
- else p "skin #{i} not found in #{@skin.select}"
+ ins.insert4.split(/\n\n/).each {|x| para << x << "\n"}
end
when /^\s*<:(insert5)>\s*$/
i=$1
if defined? ins.insert5
para=[]
- ins.insert5.split(/\n\n/).each{|x| para << x << "\n"}
- else p "skin #{i} not found in #{@skin.select}"
+ ins.insert5.split(/\n\n/).each {|x| para << x << "\n"}
end
when /^\s*<:(insert6)>\s*$/
i=$1
if defined? ins.insert6
para=[]
- ins.insert6.split(/\n\n/).each{|x| para << x << "\n"}
- else p "skin #{i} not found in #{@skin.select}"
+ ins.insert6.split(/\n\n/).each {|x| para << x << "\n"}
end
when /^\s*<:(insert7)>\s*$/
i=$1
if defined? ins.insert7
para=[]
- ins.insert7.split(/\n\n/).each{|x| para << x << "\n"}
- else p "skin #{i} not found in #{@skin.select}"
+ ins.insert7.split(/\n\n/).each {|x| para << x << "\n"}
end
end
- para.each{|x| data_expand << x }
+ para.each {|x| data_expand << x }
else data_expand << para
end
- data_expand.flatten!
- data_expand.compact!
+ data_expand=data_expand.flatten.compact
end
+ data_new=[]
data_expand.each do |para|
para=if @md.markup_version.determined >= 0.38
- SiSU_document_structure_extract::Structure.new(@md,para).structure_markup_normalize
+ SiSU_DAL_DocumentStructureExtract::Structure.new(@md,para).structure_markup_normalize
else
- SiSU_document_structure_extract::Structure.new(@md,para).structure_marks
+ SiSU_DAL_DocumentStructureExtract::Structure.new(@md,para).structure_marks
end
- para.gsub!(/^(:?A~)\s*$/,'\1~ @title @author') #conditional header
- para.gsub!(/^((?:[1-9]|:?[A-C])~\S*)\s*$/,'\1~ [Note: heading marker::required title missing]~#') #conditional header for incorporated document 2004w12
+ para=para.gsub(/^(:?A~)\s*$/,'\1~ @title @author'). #conditional header
+ gsub(/^((?:[1-9]|:?[A-C])~\S*)\s*$/,'\1~ [Note: heading marker::required title missing]~#') #conditional header for incorporated document 2004w12
if para =~/^@\S+?:/
- para.gsub!(/^@(\S+?):(\s+|$)/,"#{Mx[:meta_o]}\\1#{Mx[:meta_c]}\\2")
- para.gsub!(/^@(\S+?):([+-])(\s+|$)/,"#{Mx[:meta_o]}\\1\\2#{Mx[:meta_c]}\\3")
+ para=para.gsub(/^@(\S+?):(\s+|$)/,"#{Mx[:meta_o]}\\1#{Mx[:meta_c]}\\2").
+ gsub(/^@(\S+?):([+-])(\s+|$)/,"#{Mx[:meta_o]}\\1\\2#{Mx[:meta_c]}\\3")
end
+ data_new << para
end
+ data_new
end
end
end
diff --git a/lib/sisu/v4/dal_syntax.rb b/lib/sisu/v4/dal_syntax.rb
new file mode 100644
index 00000000..b62fbad8
--- /dev/null
+++ b/lib/sisu/v4/dal_syntax.rb
@@ -0,0 +1,601 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: Syntax for markup, input markup syntaxes, determined here
+
+=end
+module SiSU_DAL_Syntax
+ class Words
+ def initialize(line,md,mkp)
+ @line,@md,@mkp=line,md,mkp
+ end
+ end
+ class Markup
+ def initialize(md='',data='')
+ @md,@data=md,data
+ @vz=SiSU_Viz::Defaults.new
+ @data_new=[]
+ url_and_stub=SiSU_Env::InfoEnv.new.url
+ @output_url="#{url_and_stub.remote}"
+ @env=SiSU_Env::InfoEnv.new
+ emph_set=if defined? @md.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|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|$)}
+ tail_m_bold=%{(?:(?:#{Mx[:fa_italics_c]})?(?:\s|[.,;:?!'")]|~\^|~\\\{\s|$))?}
+ bold_line=%{^!_\s.+?(?:#{Mx[:br_line]}|\n|$)}
+ ital_line=%{^/_\s.+?(?:#{Mx[:br_line]}|\n|$)}
+ @line_scan_ital=if defined? @md.italics_match_list[:str]
+ /#{@http_m}|#{bold_line}|#{@manmkp_ital}#{tail_m_ital}|#{@md.italics_match_list[:str]}#{tail_m_ital}|\S+|\n/i
+ elsif defined? @vz.markup_make_italic[:str]
+ /#{@http_m}|#{bold_line}|#{@manmkp_ital}#{tail_m_ital}|#{@vz.markup_make_italic[:str]}#{tail_m_ital}|\S+|\n/i
+ end
+ @manmkp_bold=emph_italics \
+ ? '^!_\s.+?(?:\n|$)|[!b]\\{.+?\\}[*!b]|[*!][a-zA-Z0-9\-_]+[!]'
+ : '^!_\s.+?(?:\n|$)|[*!b]\\{.+?\\}[*!b]|[*!][a-zA-Z0-9\-_]+[*!]'
+ @line_scan_bold=if (defined? @md.bold_match_list[:str] \
+ and @md.bold_match_list[:str]) \
+ and (defined? @vz.markup_make_bold[:str] \
+ and @vz.markup_make_bold[:str])
+ /#{@http_m}|#{bold_line}|(?:#{@manmkp_bold}|#{@md.bold_match_list[:str]}|#{@vz.markup_make_bold[:str]})#{tail_m_bold}|\S+|\n/i
+ elsif defined? @md.bold_match_list[:str] \
+ and @md.bold_match_list[:str]
+ /#{@http_m}|#{bold_line}|(?:#{@manmkp_bold}|#{@md.bold_match_list[:str]})#{tail_m_bold}|\S+|\n/i
+ elsif defined? @vz.markup_make_bold[:str] \
+ and @vz.markup_make_bold[:str]
+ /#{@http_m}|#{bold_line}|(?:#{@manmkp_bold}|#{@vz.markup_make_bold[:str]})#{tail_m_bold}|\S+|\n/i
+ 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
+ end
+ dob
+ end
+ def wordlist_italics(dob)
+ dob=dob.dup
+ if (defined? @md.italics_match_list[:str] \
+ and @md.italics_match_list[:str]) \
+ or (defined? @vz.markup_make_italic[:str] \
+ and @vz.markup_make_italic[:str])
+ dob.obj=if dob.is !=:meta \
+ && dob.is !=:heading \
+ && dob.is !=:heading_insert \
+ && dob.is !=:code \
+ && 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]}")
+ elsif defined? @vz.markup_make_italic \
+ and @vz.markup_make_italic
+ w=w.gsub(@vz.markup_make_italic,
+ "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}")
+ else w
+ end
+ end
+ line_array << w
+ end
+ line_array.join(' ')
+ else dob.obj
+ end
+ end
+ dob
+ end
+ def embolden(given)
+ given=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 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]) \
+ or (defined? @vz.markup_make_bold[:str] \
+ and @vz.markup_make_bold[: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]}")
+ elsif defined? @vz.markup_make_bold \
+ and @vz.markup_make_bold #defaults adjusted bold word list
+ w=w.gsub(@vz.markup_make_bold,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}")
+ end
+ else
+ 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(dob)
+ dob.obj=dob.obj.gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[\{]|\>)\*\{(.+?)\}\*/m,
+ "\\1#{@emph[:o]}\\2#{@emph[:c]}"). #emphasis
+ gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[\{]|\>)!\{(.+?)\}!/m,
+ "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}"). #bold
+ gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[\{]|\(|\>)\/\{(.+?)\}\//m,
+ "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}"). #italics
+ gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[\{]|\>)_\{(.+?)\}_/m,
+ "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}"). #underscore
+ gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[\{]|\>)#\{(.+?)\}#/m,
+ "\\1#{Mx[:fa_monospace_o]}\\2#{Mx[:fa_monospace_c]}"). #monospace
+ gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\"\{(.+?)\}\"/m,
+ "\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}"). #cite /blockquote?
+ gsub(/(^|[^\\])\^\{(.+?)\}\^/m,
+ "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}"). #superscript
+ gsub(/(^|[^\\]),\{(.+?)\},/m,
+ "\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}"). #subscript
+ gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\+\{(.+?)\}\+/m,
+ "\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}"). #inserted text
+ gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)-\{(.+?)\}-/m,
+ "\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}"). #strikethrough - deleted text
+ gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>|\d+)\^(\S+?)\^/,
+ "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") #superscript single word, watch digit added
+ dob
+ end
+ def bodymarkup(dob)
+ # << http://www.jus.uio.no/sisu/sisu_markup_table/markup >>
+ # See: data/sisu/sample/document_samples_sisu_markup/
+ ## fontface
+ # *{emphasis}* e{emphasis}e <strong>emphasis</strong>
+ # !{bold text}! b{bold}b <b>bold text</b>
+ # _{underline}_ u{underline}u <u>underline</u>
+ # /{italics}/ i{italics}i <i>italics</i>
+ # "{citation}" c{citation}c <cite>citation</cite> #blockquote?
+ # ^{superscript}^ <sup>superscript</sup>
+ # ,{subscript}, <sub>subscript</sub>
+ # +{inserted text}+ <ins>inserted text</ins>
+ # -{deleted text}- <del>deleted text</del>
+ # #{monospace text}#
+ #
+ # {url address}:url
+ # {image.png}imageurl
+ # {image.png}png
+ # ~{endnote}~ <!e endnote !>
+ # !_ #bold/emphasise paragraph
+ # _" #blockquote paragraph
+ # _1 <:i1> #indent paragraph 1 step
+ # _2 <:i2> #indent paragraph 2 steps
+ # _3 <:i3> #indent paragraph 3 steps
+ # _4 <:i4> #indent paragraph 4 steps
+ # _* #bullet (list) ●
+ # _1* #bullet (list) indented
+ # _1* #bullet (list) indented
+ # # #numbered (list) level 1
+ # _# #numbered (list) level 2
+ dob=dob.dup
+ if dob.is !=:meta \
+ && 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 ==1
+ 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<\2>\3') #convert <br> <br /> back, clumsy
+ if dob.number_
+ codeline=[]
+ ln=1
+ dob.obj.split(/#{Mx[:gr_o]}codeline#{Mx[:gr_c]}|<br(?: \/)?>|\n/).each_with_index do |cl,i|
+ unless i == 0
+ cl=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}~ <!e 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/v2/db_columns.rb b/lib/sisu/v4/db_columns.rb
index c1fb6109..9fc24bf8 100644
--- a/lib/sisu/v2/db_columns.rb
+++ b/lib/sisu/v4/db_columns.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -57,15 +56,16 @@
sqlite
=end
-module SiSU_DB_columns
- require "#{SiSU_lib}/sysenv" # sysenv.rb
- require "#{SiSU_lib}/db_sqltxt" # db_sqltxt.rb
- class Columns < SiSU_DB_text::Prepare
+module SiSU_DbColumns
+ require_relative 'sysenv' # sysenv.rb
+ require_relative 'db_sqltxt' # db_sqltxt.rb
+ class Columns < SiSU_DbText::Prepare
def initialize(md=nil)
@md=md
- @db=SiSU_Env::Info_db.new #watch
- if defined? md.mod \
- and md.mod.inspect=~/import|update/ \
+ @db=SiSU_Env::InfoDb.new #watch
+ @lang ||=SiSU_i18n::Languages.new
+ if defined? md.opt.mod \
+ and md.opt.mod.inspect=~/import|update/ \
and FileTest.exist?(md.fns)
txt_arr=IO.readlines(md.fns,'')
src=txt_arr.join("\n")
@@ -98,7 +98,7 @@ module SiSU_DB_columns
'title'
end
def create_column
- "#{name} VARCHAR(#{Db[:col_title]}) NULL,"
+ "#{name} VARCHAR(#{Db[:col_title]}) NOT NULL,"
end
def column_comment
%{COMMENT ON COLUMN metadata_and_text.#{name}
@@ -108,7 +108,7 @@ module SiSU_DB_columns
t=if defined? @md.title.full \
and @md.title.full=~/\S+/
txt=@md.title.full
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -120,7 +120,7 @@ module SiSU_DB_columns
'title_main'
end
def create_column
- "#{name} VARCHAR(#{Db[:col_title_part]}) NULL,"
+ "#{name} VARCHAR(#{Db[:col_title_part]}) NOT NULL,"
end
def column_comment
%{COMMENT ON COLUMN metadata_and_text.#{name}
@@ -130,7 +130,7 @@ module SiSU_DB_columns
t=if defined? @md.title.main \
and @md.title.main=~/\S+/
txt=@md.title.main
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -152,7 +152,7 @@ module SiSU_DB_columns
t=if defined? @md.title.sub \
and @md.title.sub=~/\S+/
txt=@md.title.sub
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -174,7 +174,7 @@ module SiSU_DB_columns
t=if defined? @md.title.short \
and @md.title.short=~/\S+/
txt=@md.title.short
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -196,7 +196,7 @@ module SiSU_DB_columns
t=if defined? @md.title.edition \
and @md.title.edition=~/\S+/
txt=@md.title.edition
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -218,7 +218,7 @@ module SiSU_DB_columns
t=if defined? @md.title.note \
and @md.title.note=~/\S+/
txt=@md.title.note
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -237,10 +237,9 @@ module SiSU_DB_columns
IS 'metadata document language [DC12]';}
end
def tuple
- t=if defined? @md.title.language \
- and @md.title.language=~/\S+/
- txt=@md.title.language
- special_character_escape(txt)
+ t=if @lang.list[@md.opt.lng][:n]
+ txt=@lang.list[@md.opt.lng][:n]
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -259,10 +258,10 @@ module SiSU_DB_columns
IS 'metadata document language iso code';}
end
def tuple
- t=if defined? @md.title.language_char \
- and @md.title.language_char=~/\S+/
- txt=@md.title.language_char
- special_character_escape(txt)
+ t=if defined? @md.opt.lng \
+ and @md.opt.lng=~/\S+/
+ txt=@md.opt.lng
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -273,6 +272,7 @@ module SiSU_DB_columns
#% creator
@creator:
:author:
+ :editor:
:contributor:
:illustrator:
:photographer:
@@ -295,14 +295,14 @@ module SiSU_DB_columns
end
def tuple
t=if defined? @md.creator.author_detail \
- and @md.creator.author_detail.class==Array \
+ and @md.creator.author_detail.is_a?(Array) \
and @md.creator.author_detail.length > 0
txt=''
@md.creator.author_detail.each do |h|
txt=txt + %{#{h[:the]}, #{h[:others]}; }
end
- txt.gsub!(/[;, ]+\s*$/,'')
- special_character_escape(txt)
+ txt=txt.gsub(/[;, ]+\s*$/,'')
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -324,7 +324,7 @@ module SiSU_DB_columns
t=if defined? @md.creator.author_hon \
and @md.creator.author_hon=~/\S+/
txt=@md.creator.author_hon
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -346,7 +346,35 @@ module SiSU_DB_columns
t=if defined? @md.creator.author_nationality_detail \
and @md.creator.author_nationality=~/\S+/
txt=@md.creator.author_nationality_detail
- special_character_escape(txt)
+ txt=special_character_escape(txt)
+ ["#{name}, ","'#{txt}', "]
+ else ['','']
+ end
+ end
+ self
+ end
+ def creator_editor
+ def name
+ 'creator_editor'
+ end
+ def create_column
+ "#{name} VARCHAR(#{Db[:col_name]}) NULL,"
+ end
+ def column_comment
+ %{COMMENT ON COLUMN metadata_and_text.#{name}
+ IS 'metadata document editor name(s)';}
+ end
+ def tuple
+ t=if defined? @md.creator.editor_detail \
+ and @md.creator.editor_detail.is_a?(Array) \
+ and @md.creator.editor_detail.length > 0
+ txt=@md.creator.editor_detail #dc
+ txt=''
+ @md.creator.editor_detail.each do |h|
+ txt=txt + %{#{h[:the]}, #{h[:others]}; }
+ end
+ txt=txt.gsub(/[;, ]+\s*$/,'')
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -366,15 +394,15 @@ module SiSU_DB_columns
end
def tuple
t=if defined? @md.creator.contributor_detail \
- and @md.creator.contributor_detail.class==Array \
+ and @md.creator.contributor_detail.is_a?(Array) \
and @md.creator.contributor_detail.length > 0
txt=@md.creator.contributor_detail #dc
txt=''
@md.creator.contributor_detail.each do |h|
txt=txt + %{#{h[:the]}, #{h[:others]}; }
end
- txt.gsub!(/[;, ]+\s*$/,'')
- special_character_escape(txt)
+ txt=txt.gsub(/[;, ]+\s*$/,'')
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -394,15 +422,15 @@ module SiSU_DB_columns
end
def tuple
t=if defined? @md.creator.illustrator_detail \
- and @md.creator.illustrator_detail.class==Array \
+ and @md.creator.illustrator_detail.is_a?(Array) \
and @md.creator.illustrator_detail.length > 0
txt=@md.creator.illustrator_detail
txt=''
@md.creator.illustrator_detail.each do |h|
txt=txt + %{#{h[:the]}, #{h[:others]}; }
end
- txt.gsub!(/[;, ]+\s*$/,'')
- special_character_escape(txt)
+ txt=txt.gsub(/[;, ]+\s*$/,'')
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -422,15 +450,15 @@ module SiSU_DB_columns
end
def tuple
t=if defined? @md.creator.photographer_detail \
- and @md.creator.photographer_detail.class==Array \
+ and @md.creator.photographer_detail.is_a?(Array) \
and @md.creator.photographer_detail.length > 0
txt=@md.creator.photographer_detail
txt=''
@md.creator.photographer_detail.each do |h|
txt=txt + %{#{h[:the]}, #{h[:others]}; }
end
- txt.gsub!(/[;, ]+\s*$/,'')
- special_character_escape(txt)
+ txt=txt.gsub(/[;, ]+\s*$/,'')
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -450,14 +478,14 @@ module SiSU_DB_columns
end
def tuple
t=if defined? @md.creator.translator_detail \
- and @md.creator.translator_detail.class==Array \
+ and @md.creator.translator_detail.is_a?(Array) \
and @md.creator.translator_detail.length > 0
txt=''
@md.creator.translator_detail.each do |h|
txt=txt + %{#{h[:the]}, #{h[:others]}; }
end
- txt.gsub!(/[;, ]+\s*$/,'')
- special_character_escape(txt)
+ txt=txt.gsub(/[;, ]+\s*$/,'')
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -477,15 +505,15 @@ module SiSU_DB_columns
end
def tuple
t=if defined? @md.creator.prepared_by_detail \
- and @md.creator.prepared_by_detail.class==Array \
+ and @md.creator.prepared_by_detail.is_a?(Array) \
and @md.creator.prepared_by_detail.length > 0
txt=@md.creator.prepared_by_detail
txt=''
@md.creator.prepared_by_detail.each do |h|
txt=txt + %{#{h[:the]}, #{h[:others]}; }
end
- txt.gsub!(/[;, ]+\s*$/,'')
- special_character_escape(txt)
+ txt=txt.gsub(/[;, ]+\s*$/,'')
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -505,15 +533,15 @@ module SiSU_DB_columns
end
def tuple
t=if defined? @md.creator.digitized_by_detail \
- and @md.creator.digitized_by_detail.class==Array \
+ and @md.creator.digitized_by_detail.is_a?(Array) \
and @md.creator.digitized_by_detail.length > 0
txt=@md.creator.digitized_by_detail
txt=''
@md.creator.digitized_by_detail.each do |h|
txt=txt + %{#{h[:the]}, #{h[:others]}; }
end
- txt.gsub!(/[;, ]+\s*$/,'')
- special_character_escape(txt)
+ txt=txt.gsub(/[;, ]+\s*$/,'')
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -533,15 +561,15 @@ module SiSU_DB_columns
end
def tuple
t=if defined? @md.creator.audio_detail \
- and @md.creator.audio_detail.class==Array \
+ and @md.creator.audio_detail.is_a?(Array) \
and @md.creator.audio_detail.length > 0
txt=@md.creator.audio_detail
txt=''
@md.creator.audio_detail.each do |h|
txt=txt + %{#{h[:the]}, #{h[:others]}; }
end
- txt.gsub!(/[;, ]+\s*$/,'')
- special_character_escape(txt)
+ txt=txt.gsub(/[;, ]+\s*$/,'')
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -561,14 +589,14 @@ module SiSU_DB_columns
end
def tuple
t=if defined? @md.creator.video_detail \
- and @md.creator.video_detail.class==Array \
+ and @md.creator.video_detail.is_a?(Array) \
and @md.creator.video_detail.length > 0
txt=''
@md.creator.video_detail.each do |h|
txt=txt + %{#{h[:the]}, #{h[:others]}; }
end
- txt.gsub!(/[;, ]+\s*$/,'')
- special_character_escape(txt)
+ txt=txt.gsub(/[;, ]+\s*$/,'')
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -599,10 +627,9 @@ module SiSU_DB_columns
IS 'metadata document language';}
end
def tuple
- t=if defined? @md.language.document \
- and @md.language.document=~/\S+/
- txt=@md.language.document
- special_character_escape(txt)
+ t=if @lang.list[@md.opt.lng][:n]
+ txt=@lang.list[@md.opt.lng][:n]
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -614,17 +641,18 @@ module SiSU_DB_columns
'language_document_char'
end
def create_column
- "#{name} VARCHAR(#{Db[:col_language_char]}) NULL,"
+ "#{name} VARCHAR(#{Db[:col_language_char]}) NOT NULL,"
end
def column_comment
%{COMMENT ON COLUMN metadata_and_text.#{name}
IS 'metadata document language';}
end
def tuple
- t=if defined? @md.language.document_char \
- and @md.language.document_char=~/\S+/
- txt=@md.language.document_char
- special_character_escape(txt)
+ #modify check, is now required, SiSUv3d_
+ t=if defined? @md.opt.lng \
+ and @md.opt.lng=~/\S+/
+ txt=@md.opt.lng
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -646,7 +674,7 @@ module SiSU_DB_columns
t=if defined? @md.language.original \
and @md.language.original=~/\S+/
txt=@md.language.original
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -668,7 +696,7 @@ module SiSU_DB_columns
t=if defined? @md.language.original_char \
and @md.language.original_char=~/\S+/
txt=@md.language.original_char
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -704,7 +732,7 @@ module SiSU_DB_columns
t=if defined? @md.date.added_to_site \
and @md.date.added_to_site=~/\S+/
txt=@md.date.added_to_site
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -726,7 +754,7 @@ module SiSU_DB_columns
t=if defined? @md.date.available \
and @md.date.available=~/\S+/
txt=@md.date.available
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -748,7 +776,7 @@ module SiSU_DB_columns
t=if defined? @md.date.created \
and @md.date.created=~/\S+/
txt=@md.date.created
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -770,7 +798,7 @@ module SiSU_DB_columns
t=if defined? @md.date.issued \
and @md.date.issued=~/\S+/
txt=@md.date.issued
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -792,7 +820,7 @@ module SiSU_DB_columns
t=if defined? @md.date.modified \
and @md.date.modified=~/\S+/
txt=@md.date.modified
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -814,7 +842,7 @@ module SiSU_DB_columns
t=if defined? @md.date.published \
and @md.date.published=~/\S+/
txt=@md.date.published
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -836,7 +864,7 @@ module SiSU_DB_columns
t=if defined? @md.date.valid \
and @md.date.valid=~/\S+/
txt=@md.date.valid
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -858,7 +886,7 @@ module SiSU_DB_columns
t=if defined? @md.date.translated \
and @md.date.translated=~/\S+/
txt=@md.date.translated
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -880,7 +908,7 @@ module SiSU_DB_columns
t=if defined? @md.date.original_publication \
and @md.date.original_publication=~/\S+/
txt=@md.date.original_publication
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -903,7 +931,7 @@ module SiSU_DB_columns
t=if defined? @md.generated \
and @md.generated.to_s=~/\S+/
txt=@md.generated.to_s
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -929,7 +957,7 @@ module SiSU_DB_columns
t=if defined? @md.publisher \
and @md.publisher=~/\S+/
txt=@md.publisher
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -951,7 +979,7 @@ module SiSU_DB_columns
# t=if defined? @md.current.publisher \
# and @md.current.publisher=~/\S+/
# txt=@md.current.publisher
-# special_character_escape(txt)
+# txt=special_character_escape(txt)
# "'#{txt}', "
# end
# end
@@ -982,7 +1010,7 @@ module SiSU_DB_columns
t=if defined? @md.original.publisher \
and @md.original.publisher=~/\S+/
txt=@md.original.publisher
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -1004,7 +1032,7 @@ module SiSU_DB_columns
t=if defined? @md.original.language \
and @md.original.language=~/\S+/
txt=@md.original.language
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -1026,7 +1054,7 @@ module SiSU_DB_columns
t=if defined? @md.original.language_char \
and @md.original.language_char=~/\S+/
txt=@md.original.language_char
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -1048,7 +1076,7 @@ module SiSU_DB_columns
t=if defined? @md.original.source \
and @md.original.source=~/\S+/
txt=@md.original.source
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -1070,7 +1098,7 @@ module SiSU_DB_columns
t=if defined? @md.original.institution \
and @md.original.institution=~/\S+/
txt=@md.original.institution
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -1092,7 +1120,7 @@ module SiSU_DB_columns
t=if defined? @md.original.nationality \
and @md.original.nationality=~/\S+/
txt=@md.original.nationality
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -1129,7 +1157,7 @@ module SiSU_DB_columns
t=if defined? @md.rights.all \
and @md.rights.all=~/\S+/
txt=@md.rights.all
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -1151,7 +1179,7 @@ module SiSU_DB_columns
t=if defined? @md.rights.copyright_text \
and @md.rights.copyright_text=~/\S+/
txt=@md.rights.copyright_text
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -1173,7 +1201,7 @@ module SiSU_DB_columns
t=if defined? @md.rights.copyright_translation \
and @md.rights.copyright_translation=~/\S+/
txt=@md.rights.copyright_translation
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -1195,7 +1223,7 @@ module SiSU_DB_columns
t=if defined? @md.rights.copyright_illustrations \
and @md.rights.copyright_illustrations=~/\S+/
txt=@md.rights.copyright_illustrations
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -1217,7 +1245,7 @@ module SiSU_DB_columns
t=if defined? @md.rights.copyright_photographs \
and @md.rights.copyright_photographs=~/\S+/
txt=@md.rights.copyright_photographs
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -1239,7 +1267,7 @@ module SiSU_DB_columns
t=if defined? @md.rights.copyright_preparation \
and @md.rights.copyright_preparation=~/\S+/
txt=@md.rights.copyright_preparation
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -1261,7 +1289,7 @@ module SiSU_DB_columns
t=if defined? @md.rights.copyright_digitization \
and @md.rights.copyright_digitization=~/\S+/
txt=@md.rights.copyright_digitization
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -1283,7 +1311,7 @@ module SiSU_DB_columns
t=if defined? @md.rights.copyright_audio \
and @md.rights.copyright_audio=~/\S+/
txt=@md.rights.copyright_audio
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -1305,7 +1333,7 @@ module SiSU_DB_columns
t=if defined? @md.rights.copyright_video \
and @md.rights.copyright_video=~/\S+/
txt=@md.rights.copyright_video
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -1327,7 +1355,57 @@ module SiSU_DB_columns
t=if defined? @md.rights.license \
and @md.rights.license=~/\S+/
txt=@md.rights.license
- special_character_escape(txt)
+ txt=special_character_escape(txt)
+ ["#{name}, ","'#{txt}', "]
+ else ['','']
+ end
+ end
+ self
+ end
+=begin
+#% identifier
+@identifier:
+ :oclc:
+ :isbn:
+=end
+ def identifier_oclc
+ def name
+ 'identifier_oclc'
+ end
+ def create_column
+ "#{name} VARCHAR(#{Db[:col_library]}) NULL,"
+ end
+ def column_comment
+ %{COMMENT ON COLUMN metadata_and_text.#{name}
+ IS 'metadata identifier document Online Computer Library Center number';}
+ end
+ def tuple
+ t=if defined? @md.identifier.oclc \
+ and @md.identifier.oclc=~/\S+/
+ txt=@md.identifier.oclc
+ txt=special_character_escape(txt)
+ ["#{name}, ","'#{txt}', "]
+ else ['','']
+ end
+ end
+ self
+ end
+ def identifier_isbn
+ def name
+ 'identifier_isbn'
+ end
+ def create_column
+ "#{name} VARCHAR(#{Db[:col_small]}) NULL,"
+ end
+ def column_comment
+ %{COMMENT ON COLUMN metadata_and_text.#{name}
+ IS 'metadata identifier document isbn (if any)';}
+ end
+ def tuple
+ t=if defined? @md.identifier.isbn \
+ and @md.identifier.isbn=~/\S+/
+ txt=@md.identifier.isbn
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -1338,17 +1416,11 @@ module SiSU_DB_columns
#% classify
@classify:
:topic_register:
- :coverage:
- :format:
- :identifier:
- :keywords:
- :relation:
:subject:
+ :keywords:
:type:
:loc:
:dewey:
- :pg:
- :isbn:
=end
def classify_topic_register
def name
@@ -1365,7 +1437,7 @@ module SiSU_DB_columns
t=if defined? @md.classify.topic_register \
and @md.classify.topic_register=~/\S+/
txt=@md.classify.topic_register
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -1377,7 +1449,7 @@ module SiSU_DB_columns
'classify_subject'
end
def create_column
- "#{name} VARCHAR(#{Db[:col_classify_txt_short]}) NULL,"
+ "#{name} VARCHAR(#{Db[:col_txt_long]}) NULL,"
end
def column_comment
%{COMMENT ON COLUMN metadata_and_text.#{name}
@@ -1387,29 +1459,7 @@ module SiSU_DB_columns
t=if defined? @md.classify.subject \
and @md.classify.subject=~/\S+/
txt=@md.classify.subject
- special_character_escape(txt)
- ["#{name}, ","'#{txt}', "]
- else ['','']
- end
- end
- self
- end
- def classify_type #check
- def name
- 'classify_type'
- end
- def create_column
- "#{name} VARCHAR(#{Db[:col_classify_txt_short]}) NULL,"
- end
- def column_comment
- %{COMMENT ON COLUMN metadata_and_text.#{name}
- IS 'metadata classify document type [DC8]';}
- end
- def tuple
- t=if defined? @md.classify.type \
- and @md.classify.type=~/\S+/
- txt=@md.classify.type
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -1421,7 +1471,7 @@ module SiSU_DB_columns
'classify_loc'
end
def create_column
- "#{name} VARCHAR(#{Db[:col_classify_library]}) NULL,"
+ "#{name} VARCHAR(#{Db[:col_library]}) NULL,"
end
def column_comment
%{COMMENT ON COLUMN metadata_and_text.#{name}
@@ -1431,7 +1481,7 @@ module SiSU_DB_columns
t=if defined? @md.classify.loc \
and @md.classify.loc=~/\S+/
txt=@md.classify.loc
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -1443,7 +1493,7 @@ module SiSU_DB_columns
'classify_dewey'
end
def create_column
- "#{name} VARCHAR(#{Db[:col_classify_library]}) NULL,"
+ "#{name} VARCHAR(#{Db[:col_library]}) NULL,"
end
def column_comment
%{COMMENT ON COLUMN metadata_and_text.#{name}
@@ -1453,151 +1503,122 @@ module SiSU_DB_columns
t=if defined? @md.classify.dewey \
and @md.classify.dewey=~/\S+/
txt=@md.classify.dewey
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
end
self
end
- def classify_oclc
- def name
- 'classify_oclc'
- end
- def create_column
- "#{name} VARCHAR(#{Db[:col_classify_library]}) NULL,"
- end
- def column_comment
- %{COMMENT ON COLUMN metadata_and_text.#{name}
- IS 'metadata classify document Online Computer Library Center number';}
- end
- def tuple
- t=if defined? @md.classify.oclc \
- and @md.classify.oclc=~/\S+/
- txt=@md.classify.oclc
- special_character_escape(txt)
- ["#{name}, ","'#{txt}', "]
- else ['','']
- end
- end
- self
- end
- def classify_pg
- def name
- 'classify_pg'
- end
- def create_column
- "#{name} VARCHAR(#{Db[:col_classify_small]}) NULL,"
- end
- def column_comment
- %{COMMENT ON COLUMN metadata_and_text.#{name}
- IS 'metadata classify document project gutenberg (if any)';}
- end
- def tuple
- t=if defined? @md.classify.pg \
- and @md.classify.pg=~/\S+/
- txt=@md.classify.pg
- special_character_escape(txt)
- ["#{name}, ","'#{txt}', "]
- else ['','']
- end
- end
- self
- end
- def classify_isbn
+ def classify_keywords
def name
- 'classify_isbn'
+ 'classify_keywords'
end
def create_column
- "#{name} VARCHAR(#{Db[:col_classify_small]}) NULL,"
+ "#{name} VARCHAR(#{Db[:col_txt_long]}) NULL,"
end
def column_comment
%{COMMENT ON COLUMN metadata_and_text.#{name}
- IS 'metadata classify document isbn (if any)';}
+ IS 'metadata classify document keywords';}
end
def tuple
- t=if defined? @md.classify.isbn \
- and @md.classify.isbn=~/\S+/
- txt=@md.classify.isbn
- special_character_escape(txt)
+ t=if defined? @md.classify.keywords \
+ and @md.classify.keywords=~/\S+/
+ txt=@md.classify.keywords
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
end
self
end
- def classify_format
+=begin
+#% notes
+@notes:
+ :abstract:
+ :description:
+ :comment:
+ :coverage:
+ :relation:
+ :format:
+ :history:
+ :prefix:
+ :prefix_a:
+ :prefix_b:
+ :suffix:
+=end
+ def notes_abstract
def name
- 'classify_format'
+ 'notes_abstract'
end
def create_column
- "#{name} VARCHAR(#{Db[:col_classify_txt_short]}) NULL,"
+ "#{name} TEXT NULL,"
end
def column_comment
%{COMMENT ON COLUMN metadata_and_text.#{name}
- IS 'metadata classify document format [DC9]';}
+ IS 'metadata document notes abstract';}
end
def tuple
- t=if defined? @md.classify.format \
- and @md.classify.format=~/\S+/
- txt=@md.classify.format
- special_character_escape(txt)
+ t=if defined? @md.notes.abstract \
+ and @md.notes.abstract=~/\S+/
+ txt=@md.notes.abstract
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
end
self
end
- def classify_identifier
+ def notes_description
def name
- 'classify_identifier'
+ 'notes_description'
end
def create_column
- "#{name} VARCHAR(#{Db[:col_classify_identify]}) NULL,"
+ "#{name} TEXT NULL,"
end
def column_comment
%{COMMENT ON COLUMN metadata_and_text.#{name}
- IS 'metadata classify document identifier [DC10]';}
+ IS 'metadata document notes description [DC4]';}
end
def tuple
- t=if defined? @md.classify.identifier \
- and @md.classify.identifier=~/\S+/
- txt=@md.classify.identifier
- special_character_escape(txt)
+ t=if defined? @md.notes.description \
+ and @md.notes.description=~/\S+/
+ txt=@md.notes.description
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
end
self
end
- def classify_relation
+ def notes_comment
def name
- 'classify_relation'
+ 'notes_comment'
end
def create_column
- "#{name} VARCHAR(#{Db[:col_classify_short]}) NULL,"
+ "#{name} TEXT NULL,"
end
def column_comment
%{COMMENT ON COLUMN metadata_and_text.#{name}
- IS 'metadata classify document relation [DC13]';}
+ IS 'metadata document notes comment';}
end
def tuple
- t=if defined? @md.classify.relation \
- and @md.classify.relation=~/\S+/
- txt=@md.classify.relation
- special_character_escape(txt)
+ t=if defined? @md.notes.comment \
+ and @md.notes.comment=~/\S+/
+ txt=@md.notes.comment
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
end
self
end
- def classify_coverage
+ def notes_coverage
def name
- 'classify_coverage'
+ 'notes_coverage'
end
def create_column
- "#{name} VARCHAR(#{Db[:col_classify_short]}) NULL,"
+ "#{name} VARCHAR(#{Db[:col_txt_short]}) NULL,"
end
def column_comment
%{COMMENT ON COLUMN metadata_and_text.#{name}
@@ -1607,129 +1628,95 @@ module SiSU_DB_columns
t=if defined? @md.classify.coverage \
and @md.classify.coverage=~/\S+/
txt=@md.classify.coverage
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
end
self
end
- def classify_keywords
+ def notes_relation
def name
- 'classify_keywords'
+ 'notes_relation'
end
def create_column
- "#{name} VARCHAR(#{Db[:col_classify_txt_short]}) NULL,"
+ "#{name} VARCHAR(#{Db[:col_txt_short]}) NULL,"
end
def column_comment
%{COMMENT ON COLUMN metadata_and_text.#{name}
- IS 'metadata classify document keywords';}
- end
- def tuple
- t=if defined? @md.classify.keywords \
- and @md.classify.keywords=~/\S+/
- txt=@md.classify.keywords
- special_character_escape(txt)
- ["#{name}, ","'#{txt}', "]
- else ['','']
- end
- end
- self
- end
-=begin
-#% notes
-@notes:
- :abstract:
- :comment:
- :description:
- :history:
- :prefix:
- :prefix_a:
- :prefix_b:
- :suffix:
-=end
- def notes_abstract
- def name
- 'notes_abstract'
- end
- def create_column
- "#{name} TEXT NULL,"
- end
- def column_comment
- %{COMMENT ON COLUMN metadata_and_text.#{name}
- IS 'metadata document notes abstract';}
+ IS 'metadata classify document relation [DC13]';}
end
def tuple
- t=if defined? @md.notes.abstract \
- and @md.notes.abstract=~/\S+/
- txt=@md.notes.abstract
- special_character_escape(txt)
+ t=if defined? @md.classify.relation \
+ and @md.classify.relation=~/\S+/
+ txt=@md.classify.relation
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
end
self
end
- def notes_comment
+ def notes_history #check, consider removal
def name
- 'notes_comment'
+ 'notes_history'
end
def create_column
- "#{name} TEXT NULL,"
+ "#{name} VARCHAR(#{Db[:col_txt_long]}) NULL,"
end
def column_comment
%{COMMENT ON COLUMN metadata_and_text.#{name}
- IS 'metadata document notes comment';}
+ IS 'metadata document notes history';}
end
def tuple
- t=if defined? @md.notes.comment \
- and @md.notes.comment=~/\S+/
- txt=@md.notes.comment
- special_character_escape(txt)
+ t=if defined? @md.notes.history \
+ and @md.notes.history=~/\S+/
+ txt=@md.notes.history
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
end
self
end
- def notes_description
+ def notes_type #check
def name
- 'notes_description'
+ 'notes_type'
end
def create_column
- "#{name} TEXT NULL,"
+ "#{name} VARCHAR(#{Db[:col_txt_long]}) NULL,"
end
def column_comment
%{COMMENT ON COLUMN metadata_and_text.#{name}
- IS 'metadata document notes description [DC4]';}
+ IS 'metadata notes document type [DC8]';}
end
def tuple
- t=if defined? @md.notes.description \
- and @md.notes.description=~/\S+/
- txt=@md.notes.description
- special_character_escape(txt)
+ t=if defined? @md.notes.type \
+ and @md.notes.type=~/\S+/
+ txt=@md.notes.type
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
end
self
end
- def notes_history #check, consider removal
+ def notes_format
def name
- 'notes_history'
+ 'notes_format'
end
def create_column
- "#{name} VARCHAR(#{Db[:col_classify_txt_short]}) NULL,"
+ "#{name} VARCHAR(#{Db[:col_txt_long]}) NULL,"
end
def column_comment
%{COMMENT ON COLUMN metadata_and_text.#{name}
- IS 'metadata document notes history';}
+ IS 'metadata classify document format [DC9]';}
end
def tuple
- t=if defined? @md.notes.history \
- and @md.notes.history=~/\S+/
- txt=@md.notes.history
- special_character_escape(txt)
+ t=if defined? @md.classify.format \
+ and @md.classify.format=~/\S+/
+ txt=@md.classify.format
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -1751,7 +1738,7 @@ module SiSU_DB_columns
t=if defined? @md.notes.prefix \
and @md.notes.prefix=~/\S+/
txt=@md.notes.prefix
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -1773,7 +1760,7 @@ module SiSU_DB_columns
t=if defined? @md.notes.prefix_a \
and @md.notes.prefix_a=~/\S+/
txt=@md.notes.prefix_a
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -1795,7 +1782,7 @@ module SiSU_DB_columns
t=if defined? @md.notes.prefix_b \
and @md.notes.prefix_b=~/\S+/
txt=@md.notes.prefix_b
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -1817,7 +1804,7 @@ module SiSU_DB_columns
t=if defined? @md.notes.suffix \
and @md.notes.suffix=~/\S+/
txt=@md.notes.suffix
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -1832,7 +1819,7 @@ module SiSU_DB_columns
'src_filename'
end
def create_column
- "#{name} VARCHAR(#{Db[:col_filename]}) NULL,"
+ "#{name} VARCHAR(#{Db[:col_filename]}) NOT NULL,"
end
def column_comment
%{COMMENT ON COLUMN metadata_and_text.#{name}
@@ -1842,7 +1829,7 @@ module SiSU_DB_columns
t=if defined? @md.fns \
and @md.fns=~/\S+/
txt=@md.fns
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -1863,7 +1850,7 @@ module SiSU_DB_columns
end
def tuple
t=if defined? @md.dgst \
- and @md.dgst.class==Array \
+ and @md.dgst.is_a?(Array) \
and @md.dgst[1]=~/\S+/
txt=@md.dgst[1]
["#{name}, ","'#{txt}', "]
@@ -1887,7 +1874,7 @@ module SiSU_DB_columns
t=if defined? @md.filesize \
and @md.filesize=~/\S+/
txt=@md.filesize
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -1909,7 +1896,7 @@ module SiSU_DB_columns
t=if defined? @md.wc_words \
and @md.wc_words=~/\S+/
txt=@md.wc_words
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -1928,7 +1915,7 @@ module SiSU_DB_columns
IS 'sisu markup source text (if shared)';}
end
def tuple
- t=if @md.mod.inspect=~/import|update/ \
+ t=if @md.opt.mod.inspect=~/import|update/ \
and FileTest.exist?(@md.fns)
["#{name}, ","'#{@sisutxt}', "]
else ['','']
@@ -1938,8 +1925,6 @@ module SiSU_DB_columns
end
=begin
#% misc
-@make:
- :skin:
@links:
=end
def fulltext
@@ -1954,7 +1939,7 @@ module SiSU_DB_columns
IS 'document full text clean, searchable';}
end
def tuple
- t=if @md.mod.inspect=~/import|update/ \
+ t=if @md.opt.mod.inspect=~/import|update/ \
and FileTest.exist?(@md.fns)
["#{name}, ","'#{@fulltext}', "]
else ['','']
@@ -1962,73 +1947,6 @@ module SiSU_DB_columns
end
self
end
- def skin_name #check
- def name
- 'skin_name'
- end
- def create_column
- "#{name} VARCHAR(#{Db[:col_filename]}) NULL,"
- end
- def column_comment
- %{COMMENT ON COLUMN metadata_and_text.#{name}
- IS 'source text skin name';}
- end
- def tuple
- t=if defined? @md.skin_name \
- and @md.skin_name=~/\S+/
- txt=@md.skin_name
- special_character_escape(txt)
- ["#{name}, ","'#{txt}', "]
- else ['','']
- end
- end
- self
- end
- def skin_fingerprint #check
- def name
- 'skin_fingerprint'
- end
- def create_column
- "#{name} VARCHAR(#{Db[:col_digest]}) NULL,"
- end
- def column_comment
- %{COMMENT ON COLUMN metadata_and_text.#{name}
- IS 'source text skin fingerprint';}
- end
- def tuple
- t=if defined? @md.dgst_skin \
- and @md.dgst_skin.class==Array \
- and @md.dgst_skin[1]=~/\S+/
- txt=@md.dgst_skin[1]
- special_character_escape(txt)
- ["#{name}, ","'#{txt}', "]
- else ['','']
- end
- end
- self
- end
- def skin # you likely want a separate table for skins
- def name
- 'skin'
- end
- def create_column
- "#{name} TEXT NULL,"
- end
- def column_comment
- %{COMMENT ON COLUMN metadata_and_text.#{name}
- IS 'source text skin';}
- end
- def tuple
- t=if defined? @md.skin \
- and @md.skin=~/\S+/
- txt=@md.skin
- special_character_escape(txt)
- ["#{name}, ","'#{txt}', "]
- else ['','']
- end
- end
- self
- end
def links
def name
'links'
@@ -2045,7 +1963,7 @@ module SiSU_DB_columns
t=if defined? @md.links \
and @md.links=~/\S+/
txt=@md.links
- special_character_escape(txt)
+ txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
end
@@ -2055,7 +1973,7 @@ module SiSU_DB_columns
self
end
end
- class Column_size
+ class ColumnSize
def document_clean # restriction not necessary
60000
end
diff --git a/lib/sisu/v2/db_create.rb b/lib/sisu/v4/db_create.rb
index 2676542e..784f37b1 100644
--- a/lib/sisu/v2/db_create.rb
+++ b/lib/sisu/v4/db_create.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -57,18 +56,18 @@
sqlite
=end
-module SiSU_DB_create
- require "#{SiSU_lib}/db_columns" # db_columns.rb
- class Create < SiSU_DB_columns::Columns
- require "#{SiSU_lib}/sysenv" # sysenv.rb
+module SiSU_DbCreate
+ require_relative 'db_columns' # db_columns.rb
+ class Create < SiSU_DbColumns::Columns
+ require_relative 'sysenv' # sysenv.rb
@@dl=nil
def initialize(opt,conn,file,sql_type='pg')
@opt,@conn,@file,@sql_type=opt,conn,file,sql_type
@cX=SiSU_Screen::Ansi.new(@opt.cmd).cX
@comment=(@sql_type=='pg') \
- ? (Comment.new(@conn,@sql_type)) \
+ ? (SiSU_DbCreate::Comment.new(@conn,@sql_type))
: nil
- @@dl ||=SiSU_Env::Info_env.new.digest.length
+ @@dl ||=SiSU_Env::InfoEnv.new.digest.length
end
def available
DBI.available_drivers.each do |driver|
@@ -79,15 +78,15 @@ module SiSU_DB_create
end
end
def create_db
- @env=SiSU_Env::Info_env.new(@opt.fns)
+ @env=SiSU_Env::InfoEnv.new(@opt.fns)
tell=(@sql_type=='sqlite') \
- ? SiSU_Screen::Ansi.new(@opt.cmd,'invert','Create Sqlite db tables in:',%{"#{@env.path.output}/sisu_sqlite.db"}) \
+ ? SiSU_Screen::Ansi.new(@opt.cmd,'invert','Create Sqlite db tables in:',%{"#{@file}"})
: SiSU_Screen::Ansi.new(@opt.cmd,'invert','Create PG db tables in:',%{"#{Db[:name_prefix]}#{@env.path.stub_pwd}"})
- tell.colorize if @opt.cmd =~/vVM/
- SiSU_Env::System_call.new.create_pg_db(@env.path.stub_pwd) if @sql_type=='pg' #watch use of path.stub_pwd instead of stub
+ tell.colorize if @opt.cmd =~/[vVM]/
+ SiSU_Env::SystemCall.new.create_pg_db(@env.path.stub_pwd) if @sql_type=='pg' #watch use of path.stub_pwd instead of stub
end
def output_dir?
- dir=SiSU_Env::Info_env.new('')
+ dir=SiSU_Env::InfoEnv.new('')
if @opt.cmd =~/d/
dir.path.webserv_stub_ensure
end
@@ -99,8 +98,8 @@ module SiSU_DB_create
to be populated from document files
create tables metadata_and_text
data import through ruby transfer
- } unless @opt.cmd =~/q/
- @conn.execute(%{
+ } if @opt.cmd =~/[VM]/
+ create_metadata_and_text=%{
CREATE TABLE metadata_and_text (
tid BIGINT PRIMARY KEY,
/* title */
@@ -116,6 +115,7 @@ module SiSU_DB_create
#{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}
@@ -163,22 +163,22 @@ module SiSU_DB_create
/* classify */
#{column.classify_topic_register.create_column}
#{column.classify_subject.create_column}
- #{column.classify_type.create_column}
#{column.classify_loc.create_column}
#{column.classify_dewey.create_column}
- #{column.classify_oclc.create_column}
- #{column.classify_pg.create_column}
- #{column.classify_isbn.create_column}
- #{column.classify_format.create_column}
- #{column.classify_identifier.create_column}
- #{column.classify_relation.create_column}
- #{column.classify_coverage.create_column}
#{column.classify_keywords.create_column}
+ /* identifier */
+ #{column.identifier_oclc.create_column}
+ #{column.identifier_isbn.create_column}
/* notes */
#{column.notes_abstract.create_column}
- #{column.notes_comment.create_column}
#{column.notes_description.create_column}
+ #{column.notes_comment.create_column}
#{column.notes_history.create_column}
+ #{column.notes_coverage.create_column}
+ #{column.notes_relation.create_column}
+ /* column.notes_source.create_column */
+ #{column.notes_type.create_column}
+ #{column.notes_format.create_column}
#{column.notes_prefix.create_column}
#{column.notes_prefix_a.create_column}
#{column.notes_prefix_b.create_column}
@@ -191,9 +191,6 @@ module SiSU_DB_create
#{column.src_txt.create_column}
/* misc */
#{column.fulltext.create_column}
- #{column.skin_name.create_column}
- #{column.skin_fingerprint.create_column}
- #{column.skin.create_column}
#{column.links.create_column.gsub(/,$/,'')}
/* subj VARCHAR(64) NULL, */
/* contact VARCHAR(100) NULL, */
@@ -201,16 +198,17 @@ module SiSU_DB_create
/* types CHAR(1) NULL, */
/* writing_focus_nationality VARCHAR(100) NULL, */
);
- })
- @comment.psql.metadata_and_text if @comment
+ }
+ @conn.execute(create_metadata_and_text)
+ @comment.psql.metadata_and_text if @comment
end
def doc_objects # create doc_objects base
print %{
to be populated from documents files
create tables doc_objects
data import through ruby transfer
- } unless @opt.cmd =~/q/
- @conn.execute(%{
+ } if @opt.cmd =~/[VM]/
+ create_doc_objects=%{
CREATE TABLE doc_objects (
lid BIGINT PRIMARY KEY,
metadata_tid BIGINT REFERENCES metadata_and_text,
@@ -219,6 +217,7 @@ module SiSU_DB_create
ocns VARCHAR(6),
clean TEXT NULL,
body TEXT NULL,
+ book_idx TEXT NULL,
seg VARCHAR(256) NULL,
lev_an VARCHAR(1),
lev SMALLINT NULL,
@@ -242,16 +241,17 @@ module SiSU_DB_create
digest_all CHAR(#{@@dl}),
types CHAR(1) NULL
);
- })
- @comment.psql.doc_objects if @comment
+ }
+ @conn.execute(create_doc_objects)
+ @comment.psql.doc_objects if @comment
end
def endnotes
print %{
to be populated from document files
create tables endnotes
data import through ruby transfer
- } unless @opt.cmd =~/q/
- @conn.execute(%{
+ } if @opt.cmd =~/[VM]/
+ create_endnotes=%{
CREATE TABLE endnotes (
nid BIGINT PRIMARY KEY,
document_lid BIGINT REFERENCES doc_objects,
@@ -264,16 +264,17 @@ module SiSU_DB_create
digest_clean CHAR(#{@@dl}),
metadata_tid BIGINT REFERENCES metadata_and_text
);
- })
- @comment.psql.endnotes if @comment
+ }
+ @conn.execute(create_endnotes)
+ @comment.psql.endnotes if @comment
end
def endnotes_asterisk
print %{
to be populated from document files
create tables endnotes_asterisk
data import through ruby transfer
- } unless @opt.cmd =~/q/
- @conn.execute(%{
+ } if @opt.cmd =~/[VM]/
+ create_endnotes_asterisk=%{
CREATE TABLE endnotes_asterisk (
nid BIGINT PRIMARY KEY,
document_lid BIGINT REFERENCES doc_objects,
@@ -286,16 +287,17 @@ module SiSU_DB_create
digest_clean CHAR(#{@@dl}),
metadata_tid BIGINT REFERENCES metadata_and_text
);
- })
- @comment.psql.endnotes_asterisk if @comment
+ }
+ @conn.execute(create_endnotes_asterisk)
+ @comment.psql.endnotes_asterisk if @comment
end
def endnotes_plus
print %{
to be populated from document files
create tables endnotes_plus
data import through ruby transfer
- } unless @opt.cmd =~/q/
- @conn.execute(%{
+ } if @opt.cmd =~/[VM]/
+ create_endnotes_plus=%{
CREATE TABLE endnotes_plus (
nid BIGINT PRIMARY KEY,
document_lid BIGINT REFERENCES doc_objects,
@@ -308,8 +310,9 @@ module SiSU_DB_create
digest_clean CHAR(#{@@dl}),
metadata_tid BIGINT REFERENCES metadata_and_text
);
- })
- @comment.psql.endnotes_plus if @comment
+ }
+ @conn.execute(create_endnotes_plus)
+ @comment.psql.endnotes_plus if @comment
end
def urls # create doc_objects file links mapping
print %{
@@ -317,8 +320,8 @@ module SiSU_DB_create
to be populated from doc_objects files
create tables urls
data import through ruby transfer
- } unless @opt.cmd =~/q/
- @conn.execute(%{
+ } if @opt.cmd =~/[VM]/
+ create_urls=%{
CREATE TABLE urls (
metadata_tid BIGINT REFERENCES metadata_and_text,
plaintext varchar(512),
@@ -338,13 +341,14 @@ module SiSU_DB_create
markup varchar(512),
sisupod varchar(512)
);
- })
- @comment.psql.urls if @comment
+ }
+ @conn.execute(create_urls)
+ @comment.psql.urls if @comment
end
self
end
end
- class Comment < SiSU_DB_columns::Columns
+ class Comment < SiSU_DbColumns::Columns
def initialize(conn,sql_type='pg')
@conn=conn
if sql_type =~ /pg/; psql
@@ -375,6 +379,7 @@ module SiSU_DB_create
%{#{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}},
@@ -416,21 +421,19 @@ module SiSU_DB_create
%{#{column.rights_license.column_comment}},
%{#{column.classify_topic_register.column_comment}},
%{#{column.classify_subject.column_comment}},
- %{#{column.classify_type.column_comment}},
%{#{column.classify_loc.column_comment}},
%{#{column.classify_dewey.column_comment}},
- %{#{column.classify_oclc.column_comment}},
- %{#{column.classify_pg.column_comment}},
- %{#{column.classify_isbn.column_comment}},
- %{#{column.classify_format.column_comment}},
- %{#{column.classify_identifier.column_comment}},
- %{#{column.classify_relation.column_comment}},
- %{#{column.classify_coverage.column_comment}},
%{#{column.classify_keywords.column_comment}},
+ %{#{column.identifier_oclc.column_comment}},
+ %{#{column.identifier_isbn.column_comment}},
%{#{column.notes_abstract.column_comment}},
%{#{column.notes_comment.column_comment}},
%{#{column.notes_description.column_comment}},
%{#{column.notes_history.column_comment}},
+ %{#{column.notes_coverage.column_comment}},
+ %{#{column.notes_relation.column_comment}},
+ %{#{column.notes_type.column_comment}},
+ %{#{column.notes_format.column_comment}},
%{#{column.notes_prefix.column_comment}},
%{#{column.notes_prefix_a.column_comment}},
%{#{column.notes_prefix_b.column_comment}},
@@ -441,9 +444,6 @@ module SiSU_DB_create
%{#{column.src_word_count.column_comment}},
%{#{column.src_txt.column_comment}},
%{#{column.fulltext.column_comment}},
- %{#{column.skin_name.column_comment}},
- %{#{column.skin_fingerprint.column_comment}},
- %{#{column.skin.column_comment}},
%{#{column.links.column_comment}},
]
conn_execute_array(sql_arr)
@@ -482,6 +482,8 @@ module SiSU_DB_create
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.lev1
IS 'document structure, level number 1';},
%{COMMENT ON COLUMN doc_objects.lev2
diff --git a/lib/sisu/v4/db_dbi.rb b/lib/sisu/v4/db_dbi.rb
new file mode 100644
index 00000000..4e8528fb
--- /dev/null
+++ b/lib/sisu/v4/db_dbi.rb
@@ -0,0 +1,92 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: modules shared by the different db types, dbi, postgresql,
+ sqlite
+
+=end
+module SiSU_DbDBI
+ require_relative 'db_columns' # db_columns.rb
+ require_relative 'db_tests' # db_tests.rb
+ require_relative 'db_create' # db_create.rb
+ require_relative 'db_select' # db_select.rb
+ require_relative 'db_indexes' # db_indexes.rb
+ require_relative 'db_drop' # db_drop.rb
+ require_relative 'db_remove' # db_remove.rb
+ require_relative 'db_load_tuple' # db_load_tuple.rb
+ require_relative 'db_import' # db_import.rb
+ class ColumnSize < SiSU_DbColumns::ColumnSize # db_columns.rb
+ end
+ class Test < SiSU_DbTests::Test # db_tests.rb
+ end
+ class Create <SiSU_DbCreate::Create # db_create.rb
+ end
+ class Case <SiSU_DbSelect::Case # db_select.rb
+ end
+ class Index <SiSU_DbIndex::Index # db_indexes.rb
+ end
+ class Drop <SiSU_DbDrop::Drop # db_drop.rb
+ end
+ class Remove <SiSU_DbRemove::Remove # db_remove.rb
+ end
+ class LoadDocuments <SiSU_DbTuple::LoadDocuments # db_load_tuple.rb
+ end
+ class LoadMetadata <SiSU_DbTuple::LoadMetadata # db_load_tuple.rb
+ end
+ class LoadUrls <SiSU_DbTuple::LoadUrls # db_update urls
+ end
+ class Import <SiSU_DbImport::Import #<SiSU_DB::ColumnSize # db_import.rb
+ end
+end
+__END__
diff --git a/lib/sisu/v2/db_drop.rb b/lib/sisu/v4/db_drop.rb
index edd08345..98db3b07 100644
--- a/lib/sisu/v2/db_drop.rb
+++ b/lib/sisu/v4/db_drop.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -57,9 +56,9 @@
sqlite
=end
-module SiSU_DB_drop
+module SiSU_DbDrop
class Drop
- require "#{SiSU_lib}/response" # response.rb
+ require_relative 'response' # response.rb
def initialize(opt,conn,db_info,sql_type='')
@opt,@conn,@db_info,@sql_type=opt,conn,db_info,sql_type
@ans=SiSU_Response::Response.new
@@ -90,10 +89,10 @@ module SiSU_DB_drop
and File.exist?(@db_info.sqlite.db)
@conn.close
File.unlink(@db_info.sqlite.db)
- db=SiSU_Env::Info_db.new
+ db=SiSU_Env::InfoDb.new
conn=db.sqlite.conn_sqlite3
- sdb=SiSU_DB_DBI::Create.new(@opt,conn,@db_info,@sql_type)
- sdb_index=SiSU_DB_DBI::Index.new(@opt,conn,@db_info,@sql_type)
+ sdb=SiSU_DbDBI::Create.new(@opt,conn,@db_info,@sql_type)
+ sdb_index=SiSU_DbDBI::Index.new(@opt,conn,@db_info,@sql_type)
sdb.output_dir?
begin
sdb.create_db
@@ -104,7 +103,11 @@ module SiSU_DB_drop
sdb.create_table.endnotes_plus
sdb.create_table.urls
sdb_index.create_indexes
- rescue; SiSU_Errors::Info_error.new($!,$@,'-D').error; @sdb.output_dir?
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,'-D').error do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ sdb.output_dir?
end
exit
else
diff --git a/lib/sisu/v2/db_import.rb b/lib/sisu/v4/db_import.rb
index 4237757f..ae808cf8 100644
--- a/lib/sisu/v2/db_import.rb
+++ b/lib/sisu/v4/db_import.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -57,27 +56,29 @@
sqlite
=end
-module SiSU_DB_import
- require "#{SiSU_lib}/db_columns" # db_columns.rb
- require "#{SiSU_lib}/db_load_tuple" # db_load_tuple.rb
- require "#{SiSU_lib}/db_sqltxt" # db_sqltxt.rb
- require "#{SiSU_lib}/shared_html_lite" # shared_html_lite.rb
+module SiSU_DbImport
+ require_relative 'db_columns' # db_columns.rb
+ require_relative 'db_load_tuple' # db_load_tuple.rb
+ require_relative 'db_sqltxt' # db_sqltxt.rb
+ require_relative 'shared_html_lite' # shared_html_lite.rb
require 'sqlite3'
- class Import < SiSU_DB_text::Prepare
+ class Import < SiSU_DbText::Prepare
include SiSU_Param
include SiSU_Screen
@@dl=nil
@@hname=nil
attr_accessor :tp
- def initialize(opt,conn,file,sql_type='pg')
- @opt,@conn,@file,@sql_type=opt,conn,file,sql_type
+ def initialize(opt,conn,file_maint,sql_type='pg')
+ @opt,@conn,@file_maint,@sql_type=opt,conn,file_maint,sql_type
@cX=SiSU_Screen::Ansi.new(@opt.cmd).cX
- @env=SiSU_Env::Info_env.new(@opt.fns)
- @dal="#{@env.path.dal}"
- if @opt.fns.empty? or @opt.cmd.empty?; @fnb=''
+ @env=SiSU_Env::InfoEnv.new(@opt.fns)
+ @dal="#{@env.processing_path.dal}"
+ @fnb=if @opt.fns.empty? \
+ or @opt.cmd.empty?
+ ''
else
@md=SiSU_Param::Parameters.new(@opt).get
- @fnb=@md.fnb
+ @md.fnb
end
@suffix=@opt.fns[/(?:.+?)(?:\.ssm\.sst|\.-?sst)/,1]
@fnc="#{@dal}/#{@opt.fns}.content.rbm"
@@ -85,44 +86,51 @@ module SiSU_DB_import
@col=Hash.new('')
@col[:ocn]=''
@counter={}
- @db=SiSU_Env::Info_db.new
+ @db=SiSU_Env::InfoDb.new
if @sql_type=='sqlite'
@driver_sqlite3=(@conn.inspect.match(/^(.{10})/)[1]==@db.sqlite.conn_sqlite3.inspect.match(/^(.{10})/)[1]) \
- ? true \
+ ? true
: false
end
sql='SELECT MAX(lid) FROM doc_objects'
begin
@col[:lid] ||=0
@col[:lid]=@driver_sqlite3 \
- ? @conn.execute( sql ).join.to_i \
- : @conn.execute( sql ) { |x| x.fetch_all.to_s.to_i }
+ ? @conn.execute( sql ).join.to_i
+ : @conn.execute( sql ) { |x| x.fetch_all.flatten[0] }
rescue
puts "#{__FILE__}:#{__LINE__}" if @opt.cmd =~/M/
end
@col[:lid]=0 if @col[:lid].nil? or @col[:lid].to_s.empty?
sql='SELECT MAX(nid) FROM endnotes'
begin
- @id_n ||=0
@id_n=@driver_sqlite3 \
- ? @conn.execute( sql ).join.to_i \
- : @id_n=@conn.execute( sql ) { |x| x.fetch_all.to_s.to_i }
+ ? @conn.execute( sql ).join.to_i
+ : @id_n=@conn.execute( sql ) { |x| x.fetch_all.flatten[0] }
+ @id_n ||=0
rescue
puts "#{__FILE__}:#{__LINE__}" if @opt.cmd =~/M/
end
@id_n =0 if @col[:lid].nil? or @col[:lid].to_s.empty?
@col[:lv1]=@col[:lv2]=@col[:lv3]=@col[:lv4]=@col[:lv5]=@col[:lv6]=0
- @db=SiSU_Env::Info_db.new
- @@dl ||=SiSU_Env::Info_env.new.digest.length
+ @db=SiSU_Env::InfoDb.new
+ @pdf_fn=SiSU_Env::FileOp.new(@md).base_filename
+ @@dl ||=SiSU_Env::InfoEnv.new.digest.length
end
def marshal_load
- require "#{SiSU_lib}/dal" # dal.rb
+ require_relative 'dal' # dal.rb
@dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here
SiSU_Screen::Ansi.new(@opt.cmd,"#{@db.psql.db}::#{@opt.fns}").puts_blue if @opt.cmd =~/vVM/
SiSU_Screen::Ansi.new(@opt.cmd,'Marshal Load',@fnc).puts_grey if @opt.cmd =~/v/
- select_first_match=%{ SELECT metadata_and_text.tid FROM metadata_and_text WHERE metadata_and_text.src_filename = '#{@opt.fns}'; }
+#%
+ select_first_match=%{
+ SELECT metadata_and_text.tid
+ FROM metadata_and_text
+ WHERE metadata_and_text.src_filename = '#{@opt.fns}'
+ AND metadata_and_text.language_document_char = '#{@opt.lng}'
+ ;}
file_exist=@sql_type=~/sqlite/ \
- ? @conn.get_first_value(select_first_match) \
+ ? @conn.get_first_value(select_first_match)
: @conn.select_one(select_first_match)
if not file_exist
t_d=[] # transaction_data
@@ -158,11 +166,13 @@ module SiSU_DB_import
@conn.do("COMMIT")
end
rescue DBI::DatabaseError => e
- puts "Error code: #{e.err}"
- puts "Error message: #{e.errstr}"
- puts "Error SQLSTATE: #{e.state}"
- SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- sqlfn="#{@env.path.sql}/#{@md.fnb}.sql"
+ STDERR.puts "Error code: #{e.err}"
+ STDERR.puts "Error message: #{e.errstr}"
+ STDERR.puts "Error SQLSTATE: #{e.state}"
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ sqlfn="#{@env.processing_path.sql}/#{@md.fnb}.sql"
sql=File.new(sqlfn,'w')
t_d.each {|i| sql.puts i}
p sqlfn
@@ -172,8 +182,10 @@ module SiSU_DB_import
puts "#{__FILE__}:#{__LINE__}"
end
rescue
- SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- sqlfn="#{@env.path.sql}/#{@md.fnb}.sql"
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ sqlfn="#{@env.processing_path.sql}/#{@md.fnb}.sql"
sql=File.new(sqlfn,'w')
t_d.each {|i| sql.puts i}
p sqlfn
@@ -186,8 +198,8 @@ module SiSU_DB_import
end
else
if file_exist
- @db=SiSU_Env::Info_db.new
- puts "\n#{@cX.grey}file #{@cX.off} #{@cX.blue}#{@opt.fns}#{@cX.off} #{@cX.grey}already exists in database#{@cX.off} #{@cX.blue}#{@db.psql.db}#{@cX.off} #{@cX.brown}update instead?#{@cX.off}"
+ @db=SiSU_Env::InfoDb.new
+ puts "\n#{@cX.grey}file #{@cX.off} #{@cX.blue}#{@opt.fns}#{@cX.off} in language code #{cX.blue}#{@opt.lng}#{cX.off} #{@cX.grey}already exists in database#{@cX.off} #{@cX.blue}#{@db.psql.db}#{@cX.off} #{@cX.brown}update instead?#{@cX.off}"
end
end
end
@@ -206,7 +218,7 @@ module SiSU_DB_import
src=special_character_escape(src)
@tp[:sisutxt_f],@tp[:sisutxt_i]='sisutxt, ',"'#{src}', "
txt=clean_searchable_text(txt_arr)
- #special_character_escape(txt)
+ #txt=special_character_escape(txt)
@tp[:fulltxt_f],@tp[:fulltxt_i]='fulltxt, ',"'#{txt}', "
end
#% title
@@ -215,24 +227,24 @@ module SiSU_DB_import
#@tp[:title]=@md.title.full
#special_character_escape(@tp[:title])
#@tp[:title_f],@tp[:title_i]='title, ',"'#{@tp[:title]}', "
- sql='SELECT MAX(tid) FROM metadata_and_text'
+ sql='SELECT MAX(tid) FROM metadata_and_text;'
begin
@@id_t ||=0
id_t=if @driver_sqlite3
@conn.execute( sql ).join.to_i # { |x| id_t=x.join.to_i }
- else @conn.execute( sql ) { |x| x.fetch_all.to_s.to_i }
+ else
+ @conn.execute( sql ) { |x| x.fetch_all.flatten[0] }
end
@@id_t=id_t if id_t
rescue
puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
end
- @@id_t =0 if @col[:lid].nil? or @col[:lid].to_s.empty?
@@id_t+=1 #bug related, needs to be performed once at start of file, but consider moving, as, placed here it means program will fail if document header lacks @title:
puts %{\n#{@cX.grey}Processing file number#{@cX.off}: #{@cX.green}#{@@id_t}#{@@cX.off}} if @opt.cmd =~/vVM/
end
################ CLEAR ##############
- SiSU_DB_DBI::Test.new(self,@opt).verify #% import title names, filenames (tuple)
- t=SiSU_DB_tuple::Load_metadata.new(@conn,@@id_t,@md,@file)
+ SiSU_DbDBI::Test.new(self,@opt).verify #% import title names, filenames (tuple)
+ t=SiSU_DbTuple::LoadMetadata.new(@conn,@@id_t,@md,@file_maint)
tuple=t.tuple
tuple
end
@@ -254,25 +266,32 @@ module SiSU_DB_import
data.obj.gsub!(/#{Mx[:gl_o]}(●)#{Mx[:gl_c]}\s*/,'\1 ')
data.obj.gsub!(/#{Mx[:tag_o]}\S+?#{Mx[:tag_c]}/,'') #check
@col[:seg]=@@seg
- if data.of =~/para|heading|group/ # regular text what of code-blocks grouped text etc.
+ if data.of ==:para \
+ || :heading \
+ || :heading_insert \
+ || :block \
+ || :group # regular text what of code-blocks grouped text etc.
notedata=data.obj.dup
- if data.is=='heading' \
- and data.ln.inspect=~/[123]/
+ #% :headings
+ if data.is==:heading \
+ && (data.ln.inspect=~/[123]/)
@col[:lev],txt,@col[:ocn],@col[:lev_an],@col[:ocnd],@col[:ocns],@col[:t_of],@col[:t_is],@col[:node],@col[:parent],@col[:digest_clean],@col[:digest_all]=data.ln,data.obj,data.ocn,data.lv,data.odv,data.osp,data.of,data.is,data.node,data.parent,'',''
@col[:lid]+=1
txt=endnotes(txt).extract_any
- @col[:body]=SiSU_Format_Shared::CSS_Format.new(@md,data).lev4_minus
- special_character_escape(@col[:body])
- @col[:plaintext]=@col[:body].dup
- @col[:plaintext]=strip_markup(@col[:plaintext])
- @col[:plaintext]=clean_searchable_text(@col[:plaintext])
- if @en[0]; @en_a,@en_z=@en[0].first,@en[0].last
+ body=SiSU_FormatShared::CSS_Format.new(@md,data).lev4_minus
+ @col[:body]=special_character_escape(body)
+ plaintext=@col[:body].dup
+ plaintext=strip_markup(plaintext)
+ @col[:plaintext]=clean_searchable_text(plaintext)
+ book_idx=data.idx ? data.idx : ''
+ @col[:book_idx]=clean_searchable_text(book_idx)
+ if @en[0] then @en_a,@en_z=@en[0].first,@en[0].last
end
- if @en_ast[0]; @en_a_asterisk,@en_z_asterisk=@en_ast[0].first,@en_ast[0].last
+ if @en_ast[0] then @en_a_asterisk,@en_z_asterisk=@en_ast[0].first,@en_ast[0].last
end
- if @en_pls[0]; @en_a_plus,@en_z_plus=@en_pls[0].first,@en_pls[0].last
+ if @en_pls[0] then @en_a_plus,@en_z_plus=@en_pls[0].first,@en_pls[0].last
end
- t=SiSU_DB_tuple::Load_documents.new(@conn,@col,@opt,@file)
+ t=SiSU_DbTuple::LoadDocuments.new(@conn,@col,@opt,@file_maint)
@tuple_array << t.tuple
case @col[:lev]
when /1/; @col[:lv1]+=1
@@ -280,8 +299,8 @@ module SiSU_DB_import
when /3/; @col[:lv3]+=1
end
@col[:lev]=@col[:plaintext]=@col[:body]=''
- elsif data.is=='heading' \
- and data.ln==4
+ elsif data.is==:heading \
+ && data.ln==4
@@seg,txt,@col[:ocn],@col[:lev_an],@col[:ocnd],@col[:ocns],@col[:t_of],@col[:t_is],@col[:node],@col[:parent],@col[:digest_clean],@col[:digest_all]=data.name,data.obj,data.ocn,data.lv,data.odv,data.osp,data.of,data.is,data.node,data.parent,'',''
@col[:seg]=@@seg
@col[:lv4]+=1
@@ -292,23 +311,28 @@ module SiSU_DB_import
@@hname=@col[:seg].to_s
else @@hname
end
- @env=SiSU_Env::Info_env.new(@md.fns)
+ @env=SiSU_Env::InfoEnv.new(@md.fns)
@base_url="#{@env.url.root}/#{@md.fnb}/#{@hname}.html"
txt=endnotes(txt).extract_any
- @col[:body]=SiSU_Format_Shared::CSS_Format.new(@md,data).lev4_plus
- special_character_escape(@col[:body])
- @col[:plaintext]=@col[:body].dup
- @col[:plaintext]=strip_markup(@col[:plaintext])
- @col[:plaintext]=clean_searchable_text(@col[:plaintext])
+ body=SiSU_FormatShared::CSS_Format.new(@md,data).lev4_plus
+ @col[:body]=special_character_escape(body)
+ plaintext=@col[:body].dup
+ plaintext=strip_markup(plaintext)
+ @col[:plaintext]=clean_searchable_text(plaintext)
+ book_idx=data.idx ? data.idx : ''
+ @col[:book_idx]=clean_searchable_text(book_idx)
@en_a,@en_z=@en[0].first,@en[0].last if @en[0]
@en_a_asterisk,@en_z_asterisk=@en_ast[0].first,@en_ast[0].last if @en_ast[0]
@en_a_plus,@en_z_plus=@en_pls[0].first,@en_pls[0].last if @en_pls[0]
- t=SiSU_DB_tuple::Load_documents.new(@conn,@col,@opt,@file)
+ t=SiSU_DbTuple::LoadDocuments.new(@conn,@col,@opt,@file_maint)
@tuple_array << t.tuple
@col[:lev]=@col[:plaintext]=@col[:body]=''
- elsif data.is=='heading' and data.ln==5
+ elsif data.is==:heading \
+ && data.ln==5
txt,@col[:ocn],@col[:lev_an],@col[:ocnd],@col[:ocns],@col[:t_of],@col[:t_is],@col[:node],@col[:parent],@col[:digest_clean],@col[:digest_all]=data.obj,data.ocn,data.lv,data.odv,data.osp,data.of,data.is,data.node,data.parent,'',''
- @@seg_full=data.name if data.is=='heading' and data.ln==5 and data.name #check data.name
+ @@seg_full=data.name if data.is==:heading \
+ && data.ln==5 \
+ && data.name #check data.name
@@seg ||='' #nil # watch
@col[:seg]=@@seg
@col[:lv5]+=1
@@ -319,23 +343,26 @@ module SiSU_DB_import
@@hname=@col[:seg].to_s
else @@hname
end
- @env=SiSU_Env::Info_env.new(@md.fns)
+ @env=SiSU_Env::InfoEnv.new(@md.fns)
@base_url="#{@env.url.root}/#{@md.fnb}/#{@hname}.html"
txt=endnotes(txt).extract_any
- @col[:body]=SiSU_Format_Shared::CSS_Format.new(@md,data).lev4_plus
- special_character_escape(@col[:body])
- @col[:plaintext]=@col[:body].dup
- @col[:plaintext]=strip_markup(@col[:plaintext])
- @col[:plaintext]=clean_searchable_text(@col[:plaintext])
+ body=SiSU_FormatShared::CSS_Format.new(@md,data).lev4_plus
+ @col[:body]=special_character_escape(body)
+ plaintext=@col[:body].dup
+ plaintext=strip_markup(plaintext)
+ @col[:plaintext]=clean_searchable_text(plaintext)
+ book_idx=data.idx ? data.idx : ''
+ @col[:book_idx]=clean_searchable_text(book_idx)
@en_a,@en_z=@en[0].first,@en[0].last if @en[0]
@en_a_asterisk,@en_z_asterisk=@en_ast[0].first,@en_ast[0].last if @en_ast[0]
@en_a_plus,@en_z_plus=@en_pls[0].first,@en_pls[0].last if @en_pls[0]
- t=SiSU_DB_tuple::Load_documents.new(@conn,@col,@opt,@file)
+ t=SiSU_DbTuple::LoadDocuments.new(@conn,@col,@opt,@file_maint)
@tuple_array << t.tuple
@col[:lev]=@col[:plaintext]=@col[:body]=''
- elsif data.is=='heading' and data.ln==6
+ elsif data.is==:heading \
+ && data.ln==6
txt,@col[:ocn],@col[:lev_an],@col[:ocnd],@col[:ocns],@col[:t_of],@col[:t_is],@col[:node],@col[:parent],@col[:digest_clean],@col[:digest_all]=data.obj,data.ocn,data.lv,data.odv,data.osp,data.of,data.is,data.node,data.parent,'',''
- @@seg_full=data.name if data.is=='heading' and data.ln==6 and data.name #check data.name
+ @@seg_full=data.name if data.is==:heading && data.ln==6 && data.name #check data.name
@@seg ||='' #nil # watch
@col[:seg]=@@seg
@col[:lv6]+=1
@@ -346,20 +373,28 @@ module SiSU_DB_import
@@hname=@col[:seg].to_s
else @@hname
end
- @env=SiSU_Env::Info_env.new(@md.fns)
+ @env=SiSU_Env::InfoEnv.new(@md.fns)
@base_url="#{@env.url.root}/#{@md.fnb}/#{@hname}.html"
txt=endnotes(txt).extract_any
- @col[:body]=SiSU_Format_Shared::CSS_Format.new(@md,data).lev4_plus
- special_character_escape(@col[:body])
- @col[:plaintext]=@col[:body].dup
- @col[:plaintext]=strip_markup(@col[:plaintext])
- @col[:plaintext]=clean_searchable_text(@col[:plaintext])
+ body=SiSU_FormatShared::CSS_Format.new(@md,data).lev4_plus
+ @col[:body]=special_character_escape(body)
+ plaintext=@col[:body].dup
+ plaintext=strip_markup(plaintext)
+ @col[:plaintext]=clean_searchable_text(plaintext)
+ book_idx=data.idx ? data.idx : ''
+ @col[:book_idx]=clean_searchable_text(book_idx)
@en_a,@en_z=@en[0].first,@en[0].last if @en[0]
@en_a_asterisk,@en_z_asterisk=@en_ast[0].first,@en_ast[0].last if @en_ast[0]
@en_a_plus,@en_z_plus=@en_pls[0].first,@en_pls[0].last if @en_pls[0]
- t=SiSU_DB_tuple::Load_documents.new(@conn,@col,@opt,@file)
+ t=SiSU_DbTuple::LoadDocuments.new(@conn,@col,@opt,@file_maint)
@tuple_array << t.tuple
@col[:lev]=@col[:plaintext]=@col[:body]=''
+ #% :structure :layout :comment
+ elsif data.of==:structure \
+ || data.of==:layout \
+ || data.of==:comment
+ #added watch
+ #% :
else #% regular text
@col[:lid]+=1
txt=''
@@ -369,11 +404,11 @@ module SiSU_DB_import
@@hname=@col[:seg].to_s
else @@hname
end
- @env=SiSU_Env::Info_env.new(@md.fns)
+ @env=SiSU_Env::InfoEnv.new(@md.fns)
@base_url="#{@env.url.root}/#{@md.fnb}/#{@hname}.html"
txt=endnotes(txt).extract_any
if @sql_type=~/pg/ \
- and txt.size > (SiSU_DB_columns::Column_size.new.document_clean - 1) #% examine pg build & remove limitation
+ and txt.size > (SiSU_DbColumns::ColumnSize.new.document_clean - 1) # examine pg build & remove limitation
puts "\n\nTOO LARGE (TXT - see error log)\n\n"
open("#{Dir.pwd}/pg_documents_error_log",'a') do |error|
error.puts("\n#{@opt.fns}\nTEXT BODY\n#{@col[:body].size} object #{@col[:ocn]} -> #{@col[:body].slice(0..500)}")
@@ -383,20 +418,30 @@ module SiSU_DB_import
@en_a,@en_z=@en[0].first,@en[0].last if @en[0]
@en_a_asterisk,@en_z_asterisk=@en_ast[0].first,@en_ast[0].last if @en_ast[0]
@en_a_plus,@en_z_plus=@en_pls[0].first,@en_pls[0].last if @en_pls[0]
- @col[:body]=if data.is=='table'
- SiSU_Format_Shared::CSS_Format.new(@md,data).html_table
- elsif data.is=='code'
- SiSU_Format_Shared::CSS_Format.new(@md,data).code
- elsif defined? data.indent and data.indent =~/[1-9]/
- SiSU_Format_Shared::CSS_Format.new(@md,data).indent(data.indent)
+ body=if data.is==:table
+ SiSU_FormatShared::CSS_Format.new(@md,data).html_table
+ elsif data.is==:code
+ SiSU_FormatShared::CSS_Format.new(@md,data).code
+ elsif defined? data.indent \
+ and defined? data.hang \
+ and data.indent =~/[1-9]/ \
+ and data.indent == data.hang
+ SiSU_FormatShared::CSS_Format.new(@md,data).indent(data.indent)
+ elsif defined? data.indent \
+ and defined? data.hang \
+ and data.hang =~/[0-9]/ \
+ and data.indent != data.hang
+ SiSU_FormatShared::CSS_Format.new(@md,data).hang_indent(data.hang,data.indent)
else
- SiSU_Format_Shared::CSS_Format.new(@md,data).norm
+ SiSU_FormatShared::CSS_Format.new(@md,data).norm
end
- special_character_escape(@col[:body])
- @col[:plaintext]=@col[:body].dup
- @col[:plaintext]=strip_markup(@col[:plaintext])
- @col[:plaintext]=clean_searchable_text(@col[:plaintext])
- t=SiSU_DB_tuple::Load_documents.new(@conn,@col,@opt,@file)
+ @col[:body]=special_character_escape(body)
+ plaintext=@col[:body].dup
+ plaintext=strip_markup(plaintext)
+ @col[:plaintext]=clean_searchable_text(plaintext)
+ book_idx=data.idx ? data.idx : ''
+ @col[:book_idx]=clean_searchable_text(book_idx)
+ t=SiSU_DbTuple::LoadDocuments.new(@conn,@col,@opt,@file_maint)
@tuple_array << t.tuple
@en,@en_ast,@en_pls=[],[],[]
@col[:en_a]=@col[:en_z]=nil
@@ -410,10 +455,10 @@ module SiSU_DB_import
nr,txt,digest_clean=$1,$2.strip,0
end
@id_n+=1
- special_character_escape(txt)
- body=SiSU_Format_Shared::CSS_Format.new(@md,data).endnote(nr,txt)
- strip_markup(txt)
- if txt.size > (SiSU_DB_columns::Column_size.new.endnote_clean - 1)
+ txt=special_character_escape(txt)
+ body=SiSU_FormatShared::CSS_Format.new(@md,data).endnote(nr,txt)
+ txt=strip_markup(txt)
+ if txt.size > (SiSU_DbColumns::ColumnSize.new.endnote_clean - 1)
puts "\n\nTOO LARGE (ENDNOTE - see error log)\n\n"
open("#{Dir.pwd}/pg_documents_error_log",'a') do |error|
error.puts("\n#{@opt.fns}\nENDNOTE\n#{txt.size} object #{@col[:ocn]},#{@col[:ocnd]},#{@col[:ocns]} -> #{txt.slice(0..500)}")
@@ -421,19 +466,20 @@ module SiSU_DB_import
txt=%{\n\nLARGE TEXT BLOCK OMITTED\n\n}
end
if txt
- en={ :type => 'endnotes',
- :id => @id_n,
- :lid => @col[:lid],
- :nr => nr,
- :txt => txt,
- :body => body,
- :ocn => @col[:ocn],
- :ocnd => @col[:ocnd],
- :ocns => @col[:ocns],
- :id_t => @@id_t,
- :hash => digest_clean
+ en={
+ type: 'endnotes',
+ id: @id_n,
+ lid: @col[:lid],
+ nr: nr,
+ txt: txt,
+ body: body,
+ ocn: @col[:ocn],
+ ocnd: @col[:ocnd],
+ ocns: @col[:ocns],
+ id_t: @@id_t,
+ hash: digest_clean
}
- t=SiSU_DB_tuple::Load_endnotes.new(@conn,en,@opt,@file)
+ t=SiSU_DbTuple::LoadEndnotes.new(@conn,en,@opt,@file_maint)
@tuple_array << t.tuple
end
end
@@ -448,10 +494,10 @@ module SiSU_DB_import
nr,txt,digest_clean=$1,$2.strip,0
end
@id_n+=1
- special_character_escape(txt)
- body=SiSU_Format_Shared::CSS_Format.new(@md,data).endnote(nr,txt)
- strip_markup(txt)
- if txt.size > (SiSU_DB_columns::Column_size.new.endnote_clean - 1)
+ txt=special_character_escape(txt)
+ body=SiSU_FormatShared::CSS_Format.new(@md,data).endnote(nr,txt)
+ txt=strip_markup(txt)
+ if txt.size > (SiSU_DbColumns::ColumnSize.new.endnote_clean - 1)
puts "\n\nTOO LARGE (ENDNOTE - see error log)\n\n"
open("#{Dir.pwd}/pg_documents_error_log",'a') do |error|
error.puts("\n#{@opt.fns}\nENDNOTE\n#{txt.size} object #{@col[:ocn]},#{@col[:ocnd]},#{@col[:ocns]} -> #{txt.slice(0..500)}")
@@ -459,19 +505,20 @@ module SiSU_DB_import
txt=%{\n\nLARGE TEXT BLOCK OMITTED\n\n}
end
if txt
- en={ :type => 'endnotes_asterisk',
- :id => @id_n,
- :lid => @col[:lid],
- :nr => nr,
- :txt => txt,
- :body => body,
- :ocn => @col[:ocn],
- :ocnd => @col[:ocnd],
- :ocns => @col[:ocns],
- :id_t => @@id_t,
- :hash => digest_clean
+ en={
+ type: 'endnotes_asterisk',
+ id: @id_n,
+ lid: @col[:lid],
+ nr: nr,
+ txt: txt,
+ body: body,
+ ocn: @col[:ocn],
+ ocnd: @col[:ocnd],
+ ocns: @col[:ocns],
+ id_t: @@id_t,
+ hash: digest_clean
}
- t=SiSU_DB_tuple::Load_endnotes.new(@conn,en,@opt,@file)
+ t=SiSU_DbTuple::LoadEndnotes.new(@conn,en,@opt,@file_maint)
@tuple_array << t.tuple
end
end
@@ -486,10 +533,10 @@ module SiSU_DB_import
nr,txt,digest_clean=$1,$2.strip,0
end
@id_n+=1
- special_character_escape(txt)
- body=SiSU_Format_Shared::CSS_Format.new(@md,data).endnote(nr,txt)
- strip_markup(txt)
- if txt.size > (SiSU_DB_columns::Column_size.new.endnote_clean - 1)
+ txt=special_character_escape(txt)
+ body=SiSU_FormatShared::CSS_Format.new(@md,data).endnote(nr,txt)
+ txt=strip_markup(txt)
+ if txt.size > (SiSU_DbColumns::ColumnSize.new.endnote_clean - 1)
puts "\n\nTOO LARGE (ENDNOTE - see error log)\n\n"
open("#{Dir.pwd}/pg_documents_error_log",'a') do |error|
error.puts("\n#{@opt.fns}\nENDNOTE\n#{txt.size} object #{@col[:ocn]},#{@col[:ocnd]},#{@col[:ocns]} -> #{txt.slice(0..500)}")
@@ -497,19 +544,20 @@ module SiSU_DB_import
txt=%{\n\nLARGE TEXT BLOCK OMITTED\n\n}
end
if txt
- en={ :type => 'endnotes_plus',
- :id => @id_n,
- :lid => @col[:lid],
- :nr => nr,
- :txt => txt,
- :body => body,
- :ocn => @col[:ocn],
- :ocnd => @col[:ocnd],
- :ocns => @col[:ocns],
- :id_t => @@id_t,
- :hash => digest_clean
+ en={
+ type: 'endnotes_plus',
+ id: @id_n,
+ lid: @col[:lid],
+ nr: nr,
+ txt: txt,
+ body: body,
+ ocn: @col[:ocn],
+ ocnd: @col[:ocnd],
+ ocns: @col[:ocns],
+ id_t: @@id_t,
+ hash: digest_clean
}
- t=SiSU_DB_tuple::Load_endnotes.new(@conn,en,@opt,@file)
+ t=SiSU_DbTuple::LoadEndnotes.new(@conn,en,@opt,@file_maint)
@tuple_array << t.tuple
end
end
@@ -518,7 +566,10 @@ module SiSU_DB_import
end
end
end
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
ensure
end
@tuple_array
@@ -537,28 +588,28 @@ module SiSU_DB_import
end
def standard
x=(@txt =~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/) \
- ? @txt.scan(/#{Mx[:en_a_o]}(\d+).+?#{Mx[:en_a_c]}/) \
+ ? @txt.scan(/#{Mx[:en_a_o]}(\d+).+?#{Mx[:en_a_c]}/)
: nil
end
def asterisk
x=(@txt =~/#{Mx[:en_b_o]}\*.+?#{Mx[:en_b_c]}/) \
- ? @txt.scan(/#{Mx[:en_b_o]}[*](\d+).+?#{Mx[:en_b_c]}/) \
+ ? @txt.scan(/#{Mx[:en_b_o]}[*](\d+).+?#{Mx[:en_b_c]}/)
: nil
end
def plus
x=(@txt =~/#{Mx[:en_b_o]}\+.+?#{Mx[:en_b_c]}/) \
- ? @txt.scan(/#{Mx[:en_b_o]}[+](\d+).+?#{Mx[:en_b_c]}/) \
+ ? @txt.scan(/#{Mx[:en_b_o]}[+](\d+).+?#{Mx[:en_b_c]}/)
: nil
end
def clean_text(base_url=nil)
- if base_url
- @txt.gsub!(/#{Mx[:en_a_o]}(\d+).+?#{Mx[:en_a_c]}/,%{<sup><a href="#{base_url}#_\\1" name="-\\1">\\1</a></sup>})
- @txt.gsub!(/#{Mx[:en_b_o]}([*]\d+).+?#{Mx[:en_b_c]}/,%{<sup><a href="#{base_url}#_\\1" name="-\\1">\\1</a></sup>})
- @txt.gsub!(/#{Mx[:en_b_o]}([+]\d+).+?#{Mx[:en_b_c]}/,%{<sup><a href="#{base_url}#_\\1" name="-\\1">\\1</a></sup>})
+ @txt=if base_url
+ @txt.gsub(/#{Mx[:en_a_o]}(\d+).+?#{Mx[:en_a_c]}/,%{<sup><a href="#{base_url}#_\\1" name="-\\1">\\1</a></sup>}).
+ gsub(/#{Mx[:en_b_o]}([*]\d+).+?#{Mx[:en_b_c]}/,%{<sup><a href="#{base_url}#_\\1" name="-\\1">\\1</a></sup>}).
+ gsub(/#{Mx[:en_b_o]}([+]\d+).+?#{Mx[:en_b_c]}/,%{<sup><a href="#{base_url}#_\\1" name="-\\1">\\1</a></sup>})
else
- @txt.gsub!(/#{Mx[:en_a_o]}(\d+).+?#{Mx[:en_a_c]}/,'<sup>\1</sup>')
- @txt.gsub!(/#{Mx[:en_b_o]}([*]\d+).+?#{Mx[:en_b_c]}/,'<sup>\1</sup>')
- @txt.gsub!(/#{Mx[:en_b_o]}([+]\d+).+?#{Mx[:en_b_c]}/,'<sup>\1</sup>')
+ @txt.gsub(/#{Mx[:en_a_o]}(\d+).+?#{Mx[:en_a_c]}/,'<sup>\1</sup>').
+ gsub(/#{Mx[:en_b_o]}([*]\d+).+?#{Mx[:en_b_c]}/,'<sup>\1</sup>').
+ gsub(/#{Mx[:en_b_o]}([+]\d+).+?#{Mx[:en_b_c]}/,'<sup>\1</sup>')
end
@txt
end
@@ -581,7 +632,7 @@ module SiSU_DB_import
def db_import_urls(dbi_unit,content) #% import documents OID - populate database
begin
@fnc=content
- @env=SiSU_Env::Info_env.new(@opt.fns)
+ @env=SiSU_Env::InfoEnv.new(@opt.fns)
base=@env.url.root
out=@env.path.output
f,u={},{}
@@ -589,57 +640,71 @@ module SiSU_DB_import
or @fnb.nil?
p 'file output path error' #remove
end
- if FileTest.file?("#{out}/#{@fnb}/#{@md.fn[:plain]}")==true
- f[:txt],u[:txt]='plaintext,', "'#{base}/#{@fnb}/#{@md.fn[:plain]}',"
- end
- if FileTest.file?("#{out}/#{@fnb}/#{@md.fn[:toc]}")==true
- f[:html_toc],u[:html_toc]='html_toc,', "'#{base}/#{@fnb}/#{@md.fn[:toc]}',"
+ if FileTest.file?("#{@md.file.output_path.txt.dir}/#{@md.file.base_filename.txt}")==true
+ f[:txt],u[:txt]='plaintext,', "'#{@md.file.output_path.txt.url}/#{@md.file.base_filename.txt}',"
end
- if FileTest.file?("#{out}/#{@fnb}/#{@md.fn[:doc]}")==true
- f[:html_doc],u[:html_doc]='html_doc,', "'#{base}/#{@fnb}/#{@md.fn[:doc]}',"
+ if FileTest.file?("#{@md.file.output_path.html_seg.dir}/#{@md.file.base_filename.html_seg}")==true
+ f[:html_toc],u[:html_toc]='html_toc,', "'#{@md.file.output_path.html_seg.url}/#{@md.file.base_filename.html_seg}',"
end
- if FileTest.file?("#{out}/#{@fnb}/#{@md.fn[:xhtml]}")==true
- f[:xhtml],u[:xhtml]='xhtml,', "'#{base}/#{@fnb}/#{@md.fn[:xhtml]}',"
+ if FileTest.file?("#{@md.file.output_path.html_scroll.dir}/#{@md.file.base_filename.html_scroll}")==true
+ f[:html_doc],u[:html_doc]='html_doc,', "'#{@md.file.output_path.html_scroll.url}/#{@md.file.base_filename.html_scroll}',"
end
- if FileTest.file?("#{out}/#{@fnb}/#{@md.fn[:sax]}")==true
- f[:xml_sax],u[:xml_sax]='xml_sax,', "'#{base}/#{@fnb}/#{@md.fn[:sax]}',"
+ if FileTest.file?("#{@md.file.output_path.xhtml.dir}/#{@md.file.base_filename.xhtml}")==true
+ f[:xhtml],u[:xhtml]='xhtml,', "'#{@md.file.output_path.xhtml.url}/#{@md.file.base_filename.xhtml}',"
end
- if FileTest.file?("#{out}/#{@fnb}/#{@md.fn[:dom]}")==true
- f[:xml_dom],u[:xml_dom]='xml_dom,', "'#{base}/#{@fnb}/#{@md.fn[:dom]}',"
+ if FileTest.file?("#{@md.file.output_path.xml_sax.dir}/#{@md.file.base_filename.xml_sax}")==true
+ f[:xml_sax],u[:xml_sax]='xml_sax,', "'#{@md.file.output_path.xml_sax.url}/#{@md.file.base_filename.xml_sax}',"
end
- if FileTest.file?("#{out}/#{@fnb}/#{@md.fn[:odf]}")==true
- f[:odf],u[:odf]='odf,', "'#{base}/#{@fnb}/#{@md.fn[:odf]}',"
+ if FileTest.file?("#{@md.file.output_path.xml_dom.dir}/#{@md.file.base_filename.xml_dom}")==true
+ f[:xml_dom],u[:xml_dom]='xml_dom,', "'#{@md.file.output_path.xml_dom.url}/#{@md.file.base_filename.xml_dom}',"
end
- if FileTest.file?("#{out}/#{@fnb}/#{@md.fn[:pdf_p]}")==true
- f[:pdf_p],u[:pdf_p]='pdf_p,', "'#{base}/#{@fnb}/#{@md.fn[:pdf_p]}',"
+ if FileTest.file?("#{@md.file.output_path.epub.dir}/#{@md.file.base_filename.epub}")==true
+ f[:epub],u[:epub]='epub,', "'#{@md.file.output_path.epub.url}/#{@md.file.base_filename.epub}',"
end
- if FileTest.file?("#{out}/#{@fnb}/#{@md.fn[:pdf_l]}")==true
- f[:pdf_l],u[:pdf_l]='pdf_l,', "'#{base}/#{@fnb}/#{@md.fn[:pdf_l]}',"
+ if FileTest.file?("#{@md.file.output_path.odt.dir}/#{@md.file.base_filename.odt}")==true
+ f[:odf],u[:odf]='odf,', "'#{@md.file.output_path.odt.url}/#{@md.file.base_filename.odt}',"
end
- if FileTest.file?("#{out}/#{@fnb}/#{@md.fn[:concordance]}")==true
- f[:concordance],u[:concordance]='concordance,', "'#{base}/#{@fnb}/#{@md.fn[:concordance]}',"
+ if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@pdf_fn.pdf_p_a4}")==true #\
+ #or FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@pdf_fn.pdf_p_letter}")==true
+ f[:pdf_p],u[:pdf_p]='pdf_p,', "'#{@md.file.output_path.pdf.url}/#{@pdf_fn.pdf_p_a4}',"
end
- if FileTest.file?("#{out}/#{@fnb}/#{@opt.fns}.tex")==true
- f[:latex_p],u[:latex_p]='latex_p,', "'#{base}/#{@fnb}/#{@opt.fns}.tex',"
+ if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@pdf_fn.pdf_l_a4}")==true #\
+ #or FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@pdf_fn.pdf_l_letter}")==true
+ f[:pdf_l],u[:pdf_l]='pdf_l,', "'#{@md.file.output_path.pdf.url}/#{@pdf_fn.pdf_l_a4}',"
end
- if FileTest.file?("#{out}/#{@fnb}/#{@opt.fns}.landscape.tex")==true
- f[:latex_l],u[:latex_l]='latex_l,', "'#{base}/#{@fnb}/#{@opt}.fns}.landscape.tex',"
+ if FileTest.file?("#{@md.file.output_path.html_concordance.dir}/#{@md.file.base_filename.html_concordance}")==true
+ f[:concordance],u[:concordance]='concordance,', "'#{@md.file.output_path.html_concordance.url}/#{@md.file.base_filename.html_concordance}',"
end
- if FileTest.file?("#{out}/#{@fnb}/#{@md.fn[:digest]}")==true
- f[:digest],u[:digest]='digest,', "'#{base}/#{@fnb}/#{@md.fn[:digest]}',"
+ #if FileTest.file?("#{@md.file.output_path.x.dir}/#{@md.file.base_filename.x}")==true
+ # f[:latex_p],u[:latex_p]='latex_p,', "'#{@md.file.output_path.x.url}/#{@md.file.base_filename.x}',"
+ #end
+ ##if FileTest.file?("#{out}/#{@fnb}/#{@opt.fns}.tex")==true
+ ## f[:latex_p],u[:latex_p]='latex_p,', "'#{base}/#{@fnb}/#{@opt.fns}.tex',"
+ ##end
+ #if FileTest.file?("#{@md.file.output_path.x.dir}/#{@md.file.base_filename.x}")==true
+ # f[:latex_l],u[:latex_l]='latex_l,', "'#{@md.file.output_path.x.url}/#{@md.file.base_filename.x}',"
+ #end
+ ##if FileTest.file?("#{out}/#{@fnb}/#{@opt.fns}.landscape.tex")==true
+ ## f[:latex_l],u[:latex_l]='latex_l,', "'#{base}/#{@fnb}/#{@opt}.fns}.landscape.tex',"
+ ##end
+ if FileTest.file?("#{@md.file.output_path.digest.dir}/#{@md.file.base_filename.digest}")==true
+ f[:digest],u[:digest]='digest,', "'#{@md.file.output_path.digest.url}/#{@md.file.base_filename.digest}',"
end
- if FileTest.file?("#{out}/#{@fnb}/#{@md.fn[:manifest]}")==true #revisit, was to be text, this is html
- f[:manifest],u[:manifest]='manifest,', "'#{base}/#{@fnb}/#{@md.fn[:manifest]}',"
+ if FileTest.file?("#{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}")==true #revisit, was to be text, this is html
+ f[:manifest],u[:manifest]='manifest,', "'#{@md.file.output_path.manifest.url}/#{@md.file.base_filename.manifest}',"
end
- if FileTest.file?("#{out}/#{@fnb}/#{@opt.fns}.meta")==true
- f[:markup],u[:markup]='markup,', "'#{base}/#{@fnb}/#{@opt.fns}.meta',"
+ if FileTest.file?("#{@md.file.output_path.src.dir}/#{@md.file.base_filename.src}")==true
+ f[:markup],u[:markup]='markup,', "'#{@md.file.output_path.src.url}/#{@md.file.base_filename.src}',"
end
- if FileTest.file?("#{out}/#{@fnb}/#{@opt.fns}.tgz")==true
- f[:sisupod],u[:sisupod]='sisupod,', "'#{base}/#{@fnb}/#{@opt.fns}.tgz',"
+ if FileTest.file?("#{@md.file.output_path.sisupod.dir}/#{@md.file.base_filename.sisupod}")==true
+ f[:sisupod],u[:sisupod]='sisupod,', "'#{@md.file.output_path.sisupod.url}/#{@md.file.base_filename.sisupod}',"
end
- t=SiSU_DB_tuple::Load_urls.new(@conn,f,u,@@id_t,@opt,@file)
+ t=SiSU_DbTuple::LoadUrls.new(@conn,f,u,@@id_t,@opt,@file_maint)
tuple=t.tuple
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
ensure
end
tuple
diff --git a/lib/sisu/v2/db_indexes.rb b/lib/sisu/v4/db_indexes.rb
index abd90409..99eb65cc 100644
--- a/lib/sisu/v2/db_indexes.rb
+++ b/lib/sisu/v4/db_indexes.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -57,7 +56,7 @@
sqlite
=end
-module SiSU_DB_index
+module SiSU_DbIndex
class Index # create documents Indexes def initialize(opt,conn='',sql_type='')
def initialize(opt,conn,file,sql_type='')
@opt,@conn,@file,@sql_type=opt,conn,file,sql_type
@@ -71,7 +70,7 @@ module SiSU_DB_index
end
end
def base
- print "\n create documents common indexes\n" unless @opt.cmd =~/q/
+ print "\n create documents common indexes\n" if @opt.cmd =~/[VM]/
sql_arr=[
%{CREATE INDEX idx_ocn ON doc_objects(ocn);},
%{CREATE INDEX idx_digest_clean ON doc_objects(digest_clean);},
@@ -93,12 +92,13 @@ module SiSU_DB_index
%{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
- print "\n create documents TEXT indexes\n" unless @opt.cmd =~/q/
+ print "\n create documents TEXT indexes\n" if @opt.cmd =~/[VM]/
sql_arr=[
%{CREATE INDEX idx_clean ON doc_objects(clean);},
%{CREATE INDEX idx_endnote ON endnotes(clean);}
diff --git a/lib/sisu/v2/db_load_tuple.rb b/lib/sisu/v4/db_load_tuple.rb
index f1af99a0..3df7ca3e 100644
--- a/lib/sisu/v2/db_load_tuple.rb
+++ b/lib/sisu/v4/db_load_tuple.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -57,13 +56,13 @@
sqlite
=end
-module SiSU_DB_tuple
- require "#{SiSU_lib}/db_columns" # db_columns.rb
- class Load_documents
- require "#{SiSU_lib}/param" # param.rb
+module SiSU_DbTuple
+ require_relative 'db_columns' # db_columns.rb
+ class LoadDocuments
+ require_relative 'param' # param.rb
include SiSU_Param
- def initialize(conn,col,opt,file)
- @conn,@col,@opt,@file=conn,col,opt,file
+ 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]=~/^[1-6]/ \
or @col[:lev]==1 \
@@ -79,22 +78,22 @@ module SiSU_DB_tuple
end
def tuple #% import line
sql_entry=if @col[:en_a]
- "INSERT INTO doc_objects (lid, metadata_tid, lev, lev_an, clean, body, ocn, ocnd, ocns, seg, lev1, lev2, lev3, lev4, lev5, lev6, 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[:ocn]}', '#{@col[:ocnd]}', '#{@col[:ocns]}', '#{@col[:seg]}', '#{@col[:lv1]}', '#{@col[:lv2]}', '#{@col[:lv3]}', '#{@col[:lv4]}', '#{@col[:lv5]}', '#{@col[:lv6]}', '#{@col[:en_a]}', '#{@col[:en_z]}', '#{@col[:t_of]}', '#{@col[:t_is]}', '#{@col[:node]}', '#{@col[:parent]}', '#{@col[:digest_clean]}', '#{@col[:digest_all]}');"
+ "INSERT INTO doc_objects (lid, metadata_tid, lev, lev_an, clean, body, book_idx, ocn, ocnd, ocns, seg, lev1, lev2, lev3, lev4, lev5, lev6, 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[:lv1]}', '#{@col[:lv2]}', '#{@col[:lv3]}', '#{@col[:lv4]}', '#{@col[:lv5]}', '#{@col[:lv6]}', '#{@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, ocn, ocnd, ocns, seg, lev1, lev2, lev3, lev4, lev5, lev6, 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[:ocn]}', '#{@col[:ocnd]}', '#{@col[:ocns]}', '#{@col[:seg]}', '#{@col[:lv1]}', '#{@col[:lv2]}', '#{@col[:lv3]}', '#{@col[:lv4]}', '#{@col[:lv5]}', '#{@col[:lv6]}', '#{@col[:t_of]}', '#{@col[:t_is]}', '#{@col[:node]}', '#{@col[:parent]}', '#{@col[:digest_clean]}', '#{@col[:digest_all]}');"
+ "INSERT INTO doc_objects (lid, metadata_tid, lev, lev_an, clean, body, book_idx, ocn, ocnd, ocns, seg, lev1, lev2, lev3, lev4, lev5, lev6, 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[:lv1]}', '#{@col[:lv2]}', '#{@col[:lv3]}', '#{@col[:lv4]}', '#{@col[:lv5]}', '#{@col[:lv6]}', '#{@col[:t_of]}', '#{@col[:t_is]}', '#{@col[:node]}', '#{@col[:parent]}', '#{@col[:digest_clean]}', '#{@col[:digest_all]}');"
end
if @opt.cmd =~/M/
if @opt.cmd =~/V/
- puts @file.inspect
+ puts @file_maint.inspect
puts sql_entry
end
- @file.puts sql_entry
+ @file_maint.puts sql_entry
else
if @opt.cmd =~/V/
puts sql_entry
- @file.puts sql_entry
+ @file_maint.puts sql_entry
end
end
if @opt.cmd =~/v/
@@ -114,10 +113,10 @@ module SiSU_DB_tuple
sql_entry
end
end
- class Load_metadata #< SiSU_DB_columns::Columns
- def initialize(conn,id,md,file)
- @conn,@id,@opt,@file=conn,id,md,file
- @tp=SiSU_DB_columns::Columns.new(md)
+ 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 (
@@ -132,6 +131,7 @@ module SiSU_DB_tuple
#{@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]}
@@ -173,21 +173,19 @@ module SiSU_DB_tuple
#{@tp.column.rights_license.tuple[0]}
#{@tp.column.classify_topic_register.tuple[0]}
#{@tp.column.classify_subject.tuple[0]}
-#{@tp.column.classify_type.tuple[0]}
#{@tp.column.classify_loc.tuple[0]}
#{@tp.column.classify_dewey.tuple[0]}
-#{@tp.column.classify_oclc.tuple[0]}
-#{@tp.column.classify_pg.tuple[0]}
-#{@tp.column.classify_isbn.tuple[0]}
-#{@tp.column.classify_format.tuple[0]}
-#{@tp.column.classify_identifier.tuple[0]}
-#{@tp.column.classify_relation.tuple[0]}
-#{@tp.column.classify_coverage.tuple[0]}
#{@tp.column.classify_keywords.tuple[0]}
+#{@tp.column.identifier_oclc.tuple[0]}
+#{@tp.column.identifier_isbn.tuple[0]}
#{@tp.column.notes_abstract.tuple[0]}
-#{@tp.column.notes_comment.tuple[0]}
#{@tp.column.notes_description.tuple[0]}
+#{@tp.column.notes_comment.tuple[0]}
#{@tp.column.notes_history.tuple[0]}
+#{@tp.column.notes_format.tuple[0]}
+#{@tp.column.notes_relation.tuple[0]}
+#{@tp.column.notes_coverage.tuple[0]}
+#{@tp.column.notes_type.tuple[0]}
#{@tp.column.notes_prefix.tuple[0]}
#{@tp.column.notes_prefix_a.tuple[0]}
#{@tp.column.notes_prefix_b.tuple[0]}
@@ -198,9 +196,6 @@ module SiSU_DB_tuple
#{@tp.column.src_word_count.tuple[0]}
#{@tp.column.src_txt.tuple[0]}
#{@tp.column.fulltext.tuple[0]}
-#{@tp.column.skin_name.tuple[0]}
-#{@tp.column.skin_fingerprint.tuple[0]}
-#{@tp.column.skin.tuple[0]}
#{@tp.column.links.tuple[0]}
tid)
" +
@@ -216,6 +211,7 @@ tid)
#{@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]}
@@ -257,21 +253,19 @@ tid)
#{@tp.column.rights_license.tuple[1]}
#{@tp.column.classify_topic_register.tuple[1]}
#{@tp.column.classify_subject.tuple[1]}
-#{@tp.column.classify_type.tuple[1]}
#{@tp.column.classify_loc.tuple[1]}
#{@tp.column.classify_dewey.tuple[1]}
-#{@tp.column.classify_oclc.tuple[1]}
-#{@tp.column.classify_pg.tuple[1]}
-#{@tp.column.classify_isbn.tuple[1]}
-#{@tp.column.classify_format.tuple[1]}
-#{@tp.column.classify_identifier.tuple[1]}
-#{@tp.column.classify_relation.tuple[1]}
-#{@tp.column.classify_coverage.tuple[1]}
#{@tp.column.classify_keywords.tuple[1]}
+#{@tp.column.identifier_oclc.tuple[1]}
+#{@tp.column.identifier_isbn.tuple[1]}
#{@tp.column.notes_abstract.tuple[1]}
#{@tp.column.notes_comment.tuple[1]}
#{@tp.column.notes_description.tuple[1]}
#{@tp.column.notes_history.tuple[1]}
+#{@tp.column.notes_format.tuple[1]}
+#{@tp.column.notes_relation.tuple[1]}
+#{@tp.column.notes_coverage.tuple[1]}
+#{@tp.column.notes_type.tuple[1]}
#{@tp.column.notes_prefix.tuple[1]}
#{@tp.column.notes_prefix_a.tuple[1]}
#{@tp.column.notes_prefix_b.tuple[1]}
@@ -282,47 +276,44 @@ tid)
#{@tp.column.src_word_count.tuple[1]}
#{@tp.column.src_txt.tuple[1]}
#{@tp.column.fulltext.tuple[1]}
-#{@tp.column.skin_name.tuple[1]}
-#{@tp.column.skin_fingerprint.tuple[1]}
-#{@tp.column.skin.tuple[1]}
#{@tp.column.links.tuple[1]}
#{@id}
);"
- if @opt.cmd =~/M/
- puts "maintenance mode on: creating sql transaction file (for last transaction set (document) only):\n\t#{@file.inspect}"
- @file.puts sql_entry
+ if @md.opt.cmd =~/M/
+ 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
- @file.puts sql_entry if @opt.cmd =~/V/
+ @file_maint.puts sql_entry if @md.opt.cmd =~/V/
end
sql_entry
end
end
- class Load_urls
- def initialize(conn,f,u,id,opt,file)
- @conn,@f,@u,@id,@opt,@file=conn,f,u,id,opt,file
+ 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.cmd =~/M/
- @file.puts sql_entry
+ @file_maint.puts sql_entry
else
- @file.puts sql_entry if @opt.cmd =~/V/
+ @file_maint.puts sql_entry if @opt.cmd =~/V/
end
sql_entry
end
end
- class Load_endnotes
- def initialize(conn,en,opt,file)
- @conn,@en,@opt,@file=conn,en,opt,file
+ 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.cmd =~/M/
- @file.puts sql_entry
+ @file_maint.puts sql_entry
else
- @file.puts sql_entry if @opt.cmd =~/V/
+ @file_maint.puts sql_entry if @opt.cmd =~/V/
end
sql_entry
end
diff --git a/lib/sisu/v2/db_remove.rb b/lib/sisu/v4/db_remove.rb
index 364f5fc7..3371a9be 100644
--- a/lib/sisu/v2/db_remove.rb
+++ b/lib/sisu/v4/db_remove.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -57,24 +56,36 @@
sqlite
=end
-module SiSU_DB_remove
+module SiSU_DbRemove
class Remove
def initialize(opt,conn,file,sql_type)
@opt,@conn,@file,@sql_type=opt,conn,file,sql_type
@md=SiSU_Param::Parameters.new(@opt).get
@fnb=@md.fnb
- @db=SiSU_Env::Info_db.new
+ @db=SiSU_Env::InfoDb.new
end
def remove
driver_sqlite3=if @sql_type=='sqlite'
(@conn.inspect.match(/^(.{10})/)[1]==@db.sqlite.conn_sqlite3.inspect.match(/^(.{10})/)[1]) \
- ? true \
+ ? true
: false
end
del_id=if driver_sqlite3
- @conn.get_first_value(%{ SELECT tid FROM metadata_and_text WHERE src_filename = '#{@opt.fns}'; }).to_i
+ remove_selected=%{
+ SELECT tid
+ FROM metadata_and_text
+ WHERE src_filename = '#{@opt.fns}'
+ AND metadata_and_text.language_document_char = '#{@opt.lng}'
+ ;}
+ @conn.get_first_value(remove_selected).to_i
else
- x=@conn.select_one(%{ SELECT metadata_and_text.tid FROM metadata_and_text WHERE metadata_and_text.src_filename = '#{@opt.fns}'; })
+ remove_selected=%{
+ SELECT metadata_and_text.tid
+ FROM metadata_and_text
+ WHERE metadata_and_text.src_filename = '#{@opt.fns}'
+ AND metadata_and_text.language_document_char = '#{@opt.lng}'
+ ;}
+ x=@conn.select_one(remove_selected)
x ? (x.join.to_i) : nil
end
if del_id
diff --git a/lib/sisu/v2/db_select.rb b/lib/sisu/v4/db_select.rb
index 04d12acb..a013c00b 100644
--- a/lib/sisu/v2/db_select.rb
+++ b/lib/sisu/v4/db_select.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -57,20 +56,20 @@
sqlite
=end
-module SiSU_DB_select
+module SiSU_DbSelect
class Case
def initialize(opt,conn='',sql_type='pg')
@opt,@conn,@sql_type=opt,conn,sql_type
- @db=SiSU_Env::Info_db.new
- @file=sql_maintenance_file
- @sdb=SiSU_DB_DBI::Create.new(@opt,@conn,@file,@sql_type) # db_dbi.rb
- @sdb_index=SiSU_DB_DBI::Index.new(@opt,@conn,@file,@sql_type) # db_dbi.rb
- @sdb_no=SiSU_DB_DBI::Drop.new(@opt,@conn,@db,@sql_type) # db_dbi.rb
+ @db=SiSU_Env::InfoDb.new
+ @file_maint=sql_maintenance_file
+ @sdb=SiSU_DbDBI::Create.new(@opt,@conn,@file_maint,@sql_type) # db_dbi.rb
+ @sdb_index=SiSU_DbDBI::Index.new(@opt,@conn,@file_maint,@sql_type) # db_dbi.rb
+ @sdb_no=SiSU_DbDBI::Drop.new(@opt,@conn,@db,@sql_type) # db_dbi.rb
if @opt.mod.inspect =~/update|import/
- @sdb_import=SiSU_DB_DBI::Import.new(@opt,@conn,@file,@sql_type)
- @sdb_remove_doc=SiSU_DB_DBI::Remove.new(@opt,@conn,@file,@sql_type)
+ @sdb_import=SiSU_DbDBI::Import.new(@opt,@conn,@file_maint,@sql_type)
+ @sdb_remove_doc=SiSU_DbDBI::Remove.new(@opt,@conn,@file_maint,@sql_type)
elsif @opt.mod.inspect =~/remove/
- @sdb_remove_doc=SiSU_DB_DBI::Remove.new(@opt,@conn,@file,@sql_type)
+ @sdb_remove_doc=SiSU_DbDBI::Remove.new(@opt,@conn,@file_maint,@sql_type)
end
end
def db_exist?
@@ -79,9 +78,9 @@ module SiSU_DB_select
puts %{no connection with #{@sql_type} database established, createdb "#{@db.sqlite.db}"?}
exit
end
- if @conn.class==NilClass
+ if @conn.is_a?(NilClass)
db=@sql_type=='sqlite' \
- ? @db.sqlite.db \
+ ? @db.sqlite.db
: @db.psql.db
puts %{no connection with #{@sql_type} database established, createdb "#{db}"?}
exit
@@ -90,12 +89,14 @@ module SiSU_DB_select
def sql_maintenance_file
file=if @opt.inspect =~/M/
x=if @opt.fns and not @opt.fns.empty?
- @env=SiSU_Env::Info_env.new(@opt.fns) if @opt.fns
- puts "\n#{@env.path.sqlite}/#{@opt.fns}.sql" if @sql_type =~/sqlite/ and @opt.cmd =~/M/
- @db=SiSU_Env::Info_db.new
- @job="sqlite3 #{@db.sqlite.db} < #{@env.path.sqlite}/#{@opt.fns}.sql"
- File.new("#{@env.path.sqlite}/#{@opt.fns}.sql",'w+')
- elsif @opt.fns and @opt.fns.inspect =~/create/; nil #sort variations later
+ @env=SiSU_Env::InfoEnv.new(@opt.fns) if @opt.fns
+ puts "\n#{@env.processing_path.sqlite}/#{@opt.fns}.sql" if @sql_type =~/sqlite/ and @opt.cmd =~/M/
+ @db=SiSU_Env::InfoDb.new
+ @job="sqlite3 #{@db.sqlite.db} < #{@env.processing_path.sqlite}/#{@opt.fns}.sql"
+ File.new("#{@env.processing_path.sqlite}/#{@opt.fns}.sql",'w+')
+ elsif @opt.fns \
+ and @opt.fns.inspect =~/create/
+ nil #sort variations later
else nil
end
else nil
@@ -108,63 +109,66 @@ module SiSU_DB_select
when /^--createdb$/
@sdb.output_dir?
begin
- @sdb.create_db
+ @sdb.create_db
rescue; @sdb.output_dir?
end
when /^--(?:init(?:ialize)?|create(?:all)?)$/
@sdb.output_dir?
begin
- @sdb.create_table.metadata_and_text
- @sdb.create_table.doc_objects
- @sdb.create_table.endnotes
- @sdb.create_table.endnotes_asterisk
- @sdb.create_table.endnotes_plus
- @sdb.create_table.urls
- @sdb_index.create_indexes
- rescue; SiSU_Errors::Info_error.new($!,$@,'-D').error; @sdb.output_dir?
+ @sdb.create_table.metadata_and_text
+ @sdb.create_table.doc_objects
+ @sdb.create_table.endnotes
+ @sdb.create_table.endnotes_asterisk
+ @sdb.create_table.endnotes_plus
+ @sdb.create_table.urls
+ @sdb_index.create_indexes
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,'-D').error; @sdb.output_dir? do
+ __LINE__.to_s + ':' + __FILE__
+ end
end
when /^--createtables?$/
@sdb.output_dir?
begin
- @sdb.create_table.metadata_and_text
- @sdb.create_table.doc_objects
- @sdb.create_table.endnotes
- @sdb.create_table.endnotes_asterisk
- @sdb.create_table.endnotes_plus
- @sdb.create_table.urls
- @sdb_index.create_indexes
+ @sdb.create_table.metadata_and_text
+ @sdb.create_table.doc_objects
+ @sdb.create_table.endnotes
+ @sdb.create_table.endnotes_asterisk
+ @sdb.create_table.endnotes_plus
+ @sdb.create_table.urls
+ @sdb_index.create_indexes
rescue; @sdb.output_dir?
end
when /^--recreate$/
@sdb.output_dir?
begin
- @sdb_no.drop.tables
- @sdb.create_table.metadata_and_text
- @sdb.create_table.doc_objects
- @sdb.create_table.endnotes
- @sdb.create_table.endnotes_asterisk
- @sdb.create_table.endnotes_plus
- @sdb.create_table.urls
- @sdb_index.create_indexes
+ @sdb_no.drop.tables
+ @sdb.create_table.metadata_and_text
+ @sdb.create_table.doc_objects
+ @sdb.create_table.endnotes
+ @sdb.create_table.endnotes_asterisk
+ @sdb.create_table.endnotes_plus
+ @sdb.create_table.urls
+ @sdb_index.create_indexes
rescue; @sdb.output_dir?
end
when /^--cr(eate)?lex$/
@sdb.output_dir?
begin
- @sdb.create_table.doc_objects
+ @sdb.create_table.doc_objects
rescue; @sdb.output_dir?
end
when /^--cr(eate)?metadata$/
@sdb.output_dir?
begin
- @sdb.create_table.metadata_and_text
+ @sdb.create_table.metadata_and_text
rescue; @sdb.output_dir?
end
when /^--import$/
db_exist?
@sdb_import.marshal_load
tell=case @sql_type
- when /sqlite/; SiSU_Screen::Ansi.new(@opt.cmd,"sqlite #{@db.sqlite.db} database?")
+ when /sqlite/; SiSU_Screen::Ansi.new(@opt.cmd,"sqlite3 #{@db.sqlite.db} database?")
when /pg/; SiSU_Screen::Ansi.new(@opt.cmd,"pgaccess or psql #{@db.psql.db} database?")
else '???'
end
@@ -173,14 +177,19 @@ module SiSU_DB_select
db_exist?
@sdb_remove_doc.remove
@sdb_import.marshal_load
- SiSU_Screen::Ansi.new(@opt.cmd,"pgaccess or psql #{@db.psql.db} database?").puts_grey if @opt.cmd =~/v/
+ tell=case @sql_type
+ when /sqlite/; SiSU_Screen::Ansi.new(@opt.cmd,"sqlite3 #{@db.sqlite.db} database?")
+ when /pg/; SiSU_Screen::Ansi.new(@opt.cmd,"pgaccess or psql #{@db.psql.db} database?")
+ else '???'
+ end
+ tell.puts_grey if @opt.cmd =~/v/
when /^--remove$/
db_exist?
@sdb_remove_doc.remove
when /^--index$/
db_exist?
@sdb_index.create_indexes
- when /^droptable(s)?$/
+ when /^--droptable(s)?$/
db_exist?
@sdb_no.drop.tables
when /^--dropindex(es)?$/
@@ -190,16 +199,21 @@ module SiSU_DB_select
db_exist?
@sdb_no.drop.tables
when /^--(?:db=)?(?:(?:sq)?lite|pg(?:sql)?|my(?:sql)?)$/
+ when /^--(?:v\d+|dev)$/
else
- help=SiSU_Help::Help.new
- help.summary
- help.commands
+ #help=SiSU_Help::Help.new
+ #help.summary
+ #help.commands
end
if @opt.cmd =~/M/ \
and @opt.cmd =~/d/
puts @job
end
end
+ if @opt.act[:psql][:set]==:on \
+ and @opt.mod.inspect !~/--(?:createdb|init(?:ialize)?|create(?:all)?|createtables?|recreate|cr(eate)?lex|cr(eate)?metadata|import|update|remove|index|droptable(s)?|dropindex(es)?|dropall|drop)/
+ SiSU_Screen::Ansi.new(@opt.cmd,"--pg requires further instruction").warn unless @opt.cmd =~/[q]/
+ end
begin
rescue; @sdb.output_dir?
end
diff --git a/lib/sisu/v2/db_sqltxt.rb b/lib/sisu/v4/db_sqltxt.rb
index e1fbed29..53c15ed3 100644
--- a/lib/sisu/v2/db_sqltxt.rb
+++ b/lib/sisu/v4/db_sqltxt.rb
@@ -1,15 +1,14 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
* Description: a framework for document structuring, publishing and search
- #___#
* Author: Ralph Amissah
* Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010 Ralph Amissah All Rights Reserved.
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -24,7 +23,7 @@
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
+ 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
@@ -33,11 +32,9 @@
If you have Internet connection, the latest version of the GPL should be
available at these locations:
<http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/copyleft/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -49,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -58,49 +55,48 @@
** Description: system environment, resource control and configuration details
=end
-module SiSU_DB_text
+module SiSU_DbText
class Prepare
def special_character_escape(str)
- str.gsub!(/'/,"''") #string.gsub!(/'/,"\047") #string.gsub!(/'/,"\\'")
- str.gsub!(/(\\)/m,'\1\1') #ok but with warnings, double backslash on sqlite #str.gsub!(/[\\]/m,'\\x5C') #ok but with warnings, but not for sqlite #str.gsub!(/(\\)/m,'\1') #ok for sqlite not for pgsql
- str.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"<br />\n")
- str.gsub!(/#{Mx[:tag_o]}\S+?#{Mx[:tag_c]}/,'') #check
- str.gsub!(/#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg))(?:\s+\d+x\d+)?(.+?)#{Mx[:lnk_c]}\S+/,'[image: \1] \2')
- str.gsub!(/#{Mx[:lnk_o]}\s*(.+?)\s*#{Mx[:lnk_c]}(?:file|ftp):\/\/\S+?([.,!?]?(?:\s|$))/,'\1\2')
- str.gsub!(/#{Mx[:lnk_o]}\s*(.+?)\s*#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,'\1')
- str
+ str=str.gsub(/'/,"''"). #string.gsub!(/'/,"\047") #string.gsub!(/'/,"\\'")
+ gsub(/(\\)/m,'\1\1'). #ok but with warnings, double backslash on sqlite #str.gsub!(/[\\]/m,'\\x5C') #ok but with warnings, but not for sqlite #str.gsub!(/(\\)/m,'\1') #ok for sqlite not for pgsql
+ gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"<br />\n").
+ gsub(/#{Mx[:tag_o]}\S+?#{Mx[:tag_c]}/,''). #check
+ gsub(/#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg))(?:\s+\d+x\d+)?(.+?)#{Mx[:lnk_c]}\S+/,'[image: \1] \2').
+ gsub(/#{Mx[:lnk_o]}\s*(.+?)\s*#{Mx[:lnk_c]}(?:file|ftp):\/\/\S+?([.,!?]?(?:\s|$))/,'\1\2').
+ gsub(/#{Mx[:lnk_o]}\s*(.+?)\s*#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,'\1')
end
def clean_searchable_text(arr) #produce clean, searchable, plaintext from document source
txt_arr,en=[],[]
- arr=arr.class==String ? arr.split(/\n+/m) : arr
+ arr=(arr.is_a?(String)) ? arr.split(/\n+/m) : arr
arr.each do |s|
- s.gsub!(/([*\/_-])\{(.+?)\}\1/m,'\2')
- s.gsub!(/^(?:group|poem|code)\{/m,''); s.gsub!(/^\}(?:group|poem|code)/m,'')
- s.gsub!(/\A(?:@\S+:\s+.+)\Z/m,'')
+ s=s.gsub(/([*\/_-])\{(.+?)\}\1/m,'\2').
+ gsub(/^(?:block|group|poem|code)\{/m,'').gsub(/^\}(?:block|group|poem|code)/m,'').
+ gsub(/\A(?:@\S+:\s+.+)\Z/m,'')
if s =~/^:A~/
if defined? @md.creator \
and defined? @md.creator.author \
and not @md.creator.author.empty?
- s.gsub!(/@author/,@md.creator.author)
+ s=s.gsub(/@author/,@md.creator.author)
else
- SiSU_Screen::Ansi.new('v','WARNING Document Author information missing; provide @creator: :author:',@md.fnb).warn unless @md.cmd.inspect =~/q/
+ SiSU_Screen::Ansi.new('v','WARNING Document Author information missing; provide @creator: :author:',@md.fnb).warn unless @md.opt.cmd.inspect =~/q/
end
if defined? @md.title \
and defined? @md.title.full \
and not @md.title.full.empty?
- s.gsub!(/@title/,@md.title.full)
+ s=s.gsub(/@title/,@md.title.full)
else
- SiSU_Screen::Ansi.new('v','WARNING Document Title missing; provide @title:',@md.fnb).warn unless @md.cmd.inspect =~/q/
+ SiSU_Screen::Ansi.new('v','WARNING Document Title missing; provide @title:',@md.fnb).warn unless @md.opt.cmd.inspect =~/q/
end
end
- s.gsub!(/^(?:_[1-9]\*?|_\*)\s+/m,'')
- s.gsub!(/^(?:[1-9]\~(\S+)?)\s+/m,'')
- s.gsub!(/^(?::?[A-C]\~(\S+)?)\s+/m,'')
- s.gsub!(/^%{1,3} .+/m,'') #removed even if contained in code block
- s.gsub!(/<br>/m,' ')
+ s=s.gsub(/^(?:_[1-9]\*?|_\*)\s+/m,'').
+ gsub(/^(?:[1-9]\~(\S+)?)\s+/m,'').
+ gsub(/^(?::?[A-C]\~(\S+)?)\s+/m,'').
+ gsub(/^%{1,3} .+/m,''). #removed even if contained in code block
+ gsub(/<br>/m,' ')
en << s.scan(/~\{\s*(.+?)\s*\}~/m)
- s.gsub!(/~\{.+?\}~/m,'')
- s.gsub!(/ \s+/m,' ')
+ s=s.gsub(/~\{.+?\}~/m,'').
+ gsub(/ \s+/m,' ')
#special_character_escape(s)
s
end
@@ -111,17 +107,16 @@ module SiSU_DB_text
txt
end
def strip_markup(str) #define rules, make same as in dal clean
- str.gsub!(/#{Mx[:fa_superscript_o]}(\d+)#{Mx[:fa_superscript_c]}/,'[\1]')
- str.gsub!(/(?:&nbsp\\;|#{Mx[:nbsp]})+/,' ')
- str.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}\d+(.+)#{Mx[:tc_c]}/u,'\1') #tables
- str.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}\d+#{Mx[:tc_p]}/u,' ') #tables
- str.gsub!(/#{Mx[:tc_p]}/u,' ') #tables tidy later
- str.gsub!(/<.+?>/,'')
- str.gsub!(/#{Mx[:lnk_o]}.+?\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:file|ftp)\/\/:\S+ /,' [image] ') # else image names found in search
- str.gsub!(/#{Mx[:lnk_o]}.+?\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,' [image]') # else image names found in search
- str.gsub!(/\s\s+/,' ')
- str.strip!
- str
+ str=str.gsub(/#{Mx[:fa_superscript_o]}(\d+)#{Mx[:fa_superscript_c]}/,'[\1]').
+ gsub(/(?:&nbsp\\;|#{Mx[:nbsp]})+/,' ').
+ gsub(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}\d+(.+)#{Mx[:tc_c]}/u,'\1'). #tables
+ gsub(/#{Mx[:tc_p]}#{Mx[:tc_p]}\d+#{Mx[:tc_p]}/u,' '). #tables
+ gsub(/#{Mx[:tc_p]}/u,' '). #tables tidy later
+ gsub(/<.+?>/,'').
+ gsub(/#{Mx[:lnk_o]}.+?\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:file|ftp)\/\/:\S+ /,' [image] '). # else image names found in search
+ gsub(/#{Mx[:lnk_o]}.+?\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,' [image]'). # else image names found in search
+ gsub(/\s\s+/,' ').
+ strip
end
def unique_words(str)
a=str.scan(/[a-zA-Z0-9\\\/_-]{2,}/) #a=str.scan(/\S+{2,}/)
diff --git a/lib/sisu/v2/db_tests.rb b/lib/sisu/v4/db_tests.rb
index 55ea2e0b..07d6d488 100644
--- a/lib/sisu/v2/db_tests.rb
+++ b/lib/sisu/v4/db_tests.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -57,7 +56,7 @@
sqlite
=end
-module SiSU_DB_tests
+module SiSU_DbTests
class Test
def initialize(info,opt)
@ck,@opt=info,opt
diff --git a/lib/sisu/v2/dbi.rb b/lib/sisu/v4/dbi.rb
index 191d5099..cd44b808 100644
--- a/lib/sisu/v2/dbi.rb
+++ b/lib/sisu/v4/dbi.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -57,21 +56,21 @@
=end
module SiSU_DBI #% database building
- require "#{SiSU_lib}/help" # help.rb
- require "#{SiSU_lib}/sysenv" # sysenv.rb
+ require_relative 'help' # help.rb
+ require_relative 'sysenv' # sysenv.rb
include SiSU_Env; include SiSU_Screen
- require "#{SiSU_lib}/param" # param.rb
+ require_relative 'param' # param.rb
include SiSU_Param
- require "#{SiSU_lib}/db_dbi" # db_dbi.rb
- include SiSU_DB_DBI
- require "#{SiSU_lib}/shared_html_lite" # shared_html_lite.rb
- include SiSU_Format_Shared
- class SiSU_SQL
+ require_relative 'db_dbi' # db_dbi.rb
+ include SiSU_DbDBI
+ require_relative 'shared_html_lite' # shared_html_lite.rb
+ include SiSU_FormatShared
+ class SQL
def initialize(opt)
SiSU_Env::Load.new('dbi',true).prog
@opt=opt
- @db=SiSU_Env::Info_db.new
- if @opt.cmd =~/d/i \
+ @db=SiSU_Env::InfoDb.new
+ if @opt.cmd =~/[Dd]/ \
or @opt.mod.inspect =~/--(pg(?:sql)?|(?:sq)?lite)/
@sql_type=if @opt.cmd=~/D/ \
or @opt.mod.inspect =~/--pg(?:sql)?/
@@ -108,8 +107,6 @@ module SiSU_DBI
puts %{manually create the database: "#{@db.db}" if it does not yet exist}
#sudo su -p postgres; createdb #{@db.db}; #[createuser?]
end
- SiSU_DB_DBI::Case.new(@opt,@conn,@sql_type).cases
- @conn=DBI.connect(@db.dbi,@db.user,@db.db)
ensure
end
end
@@ -126,11 +123,13 @@ module SiSU_DBI
when /pg/; read_psql
when /sqlite/; read_sqlite
end
- SiSU_Screen::Ansi.new(@opt.cmd,"DBI (#{@sql_type}) #{@opt.mod}",@opt.fns).dbi_title unless @opt.cmd =~/q/
+ SiSU_Screen::Ansi.new(@opt.cmd,"DBI (#{@sql_type}) #{@opt.mod}",@opt.fno).dbi_title unless @opt.cmd =~/q/
begin
- SiSU_DB_DBI::Case.new(@opt,@conn,@sql_type).cases
+ SiSU_DbDBI::Case.new(@opt,@conn,@sql_type).cases
rescue
- SiSU_Errors::Info_error.new($!,$@,@cf,@opt.fns).error
+ SiSU_Errors::InfoError.new($!,$@,@cf,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
ensure
end
begin
diff --git a/lib/sisu/v4/dbi_discreet.rb b/lib/sisu/v4/dbi_discreet.rb
new file mode 100644
index 00000000..07814a1a
--- /dev/null
+++ b/lib/sisu/v4/dbi_discreet.rb
@@ -0,0 +1,182 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: postgresql module, dbi import frame
+
+=end
+module SiSU_DBI_Discreet #% database building
+ require_relative 'help' # help.rb
+ require_relative 'sysenv' # sysenv.rb
+ include SiSU_Env; include SiSU_Screen
+ require_relative 'param' # param.rb
+ include SiSU_Param
+ require_relative 'db_dbi' # db_dbi.rb
+ include SiSU_DbDBI
+ require_relative 'shared_html_lite' # shared_html_lite.rb
+ include SiSU_FormatShared
+ require 'fileutils'
+ include FileUtils::Verbose
+ class SQL
+ def initialize(opt)
+ SiSU_Env::Load.new('dbi',true).prog
+ @opt=opt
+ @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)
+ @md=@particulars.md
+ if @opt.cmd =~/[d]/ \
+ or @opt.mod.inspect =~/--((?:sq)?lite)/
+ @sql_type='sqlite'
+ maintenance_check(@opt,__FILE__,__LINE__) if @opt.cmd.inspect =~/M/
+ end
+ @output_path=@md.file.output_path.sqlite_discreet.dir
+ @filename=@md.file.base_filename.sqlite_discreet
+ @file_maint=sql_maintenance_file
+ @file="#{@output_path}/#{@filename}"
+ end
+ def build
+ prepare
+ create_and_populate
+ end
+ def maintenance_check(opt,file,line)
+ p opt.mod
+ p opt.cmd
+ p "at #{file} #{line}"
+ end
+ def prepare
+ if not FileTest.directory?(@output_path)
+ FileUtils::mkdir_p(@output_path)
+ elsif @file
+ FileUtils::rm_rf(@file)
+ end
+ end
+ def db_exist?(db,conn)
+ msg=%{no connection with sqlite database established, createdb "#{db.sqlite.db}"?}
+ if (not (FileTest.file?(db.sqlite.db)) \
+ or FileTest.zero?(db.sqlite.db))
+ puts msg
+ exit
+ end
+ if conn.is_a?(NilClass)
+ puts msg
+ exit
+ end
+ end
+ def create_and_populate
+ db=SiSU_Env::DbOp.new(@md)
+ conn=db.sqlite_discreet.conn_sqlite3
+ sdb=SiSU_DbDBI::Create.new(@opt,conn,@file,'sqlite')
+ sdb_index=SiSU_DbDBI::Index.new(@opt,conn,@file,'sqlite')
+ sdb.output_dir?
+ begin
+ SiSU_Screen::Ansi.new(@opt.cmd,'SQLite',"[#{@opt.f_pth[:lng_is]}] #{@opt.fno}").green_title_hi unless @opt.cmd =~/q/
+ 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.cmd,"sqlite3 #{db.sqlite.db} database?")
+ tell.puts_grey if @opt.cmd =~/v/
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,'-d').error do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ sdb.output_dir?
+ end
+ end
+ def read_sqlite
+ begin
+ @conn=@db.sqlite.conn_sqlite3
+ rescue
+ ensure
+ end
+ end
+ def connect
+ begin
+ sql_type='sqlite'
+ SiSU_Screen::Ansi.new(@opt.cmd,"DBI (#{@sql_type}) #{@opt.mod}",@opt.fns).dbi_title unless @opt.cmd =~/q/
+ @db.sqlite_discreet.conn_sqlite3
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@cf,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ end
+ end
+ def populate
+ end
+ def sql_maintenance_file
+ file=if @opt.inspect =~/M/
+ x=if @opt.fns and not @opt.fns.empty?
+ @env=SiSU_Env::InfoEnv.new(@opt.fns) if @opt.fns
+ puts "\n#{@env.processing_path.sqlite}/#{@opt.fns}.sql" if @sql_type =~/sqlite/ and @opt.cmd =~/M/
+ @db=SiSU_Env::InfoDb.new
+ @job="sqlite3 #{@db.sqlite.db} < #{@env.processing_path.sqlite}/#{@opt.fns}.sql"
+ File.new("#{@env.processing_path.sqlite}/#{@opt.fns}.sql",'w+')
+ elsif @opt.fns \
+ and @opt.fns.inspect =~/create/
+ nil #sort variations later
+ else nil
+ end
+ else nil
+ end
+ file
+ end
+ end
+end
+__END__
diff --git a/lib/sisu/v2/defaults.rb b/lib/sisu/v4/defaults.rb
index 31cc449e..aa80c72b 100644
--- a/lib/sisu/v2/defaults.rb
+++ b/lib/sisu/v4/defaults.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -22,7 +23,7 @@
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
+ 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
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.sisudoc.org/sisu/gpl.fsf/toc.html>
- <http://www.sisudoc.org/sisu/gpl.fsf/doc.html>
- <http://www.sisudoc.org/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,28 +46,28 @@
<http://www.sisudoc.org>
* Download:
- <http://www.sisudoc.org/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
<ralph.amissah@gmail.com>
- ** Description: Default values (reset by skins)
+ ** Description: Default values
=end
$latex_run=nil
module SiSU_Viz
require 'uri'
- require "#{SiSU_lib}/sysenv" # sysenv.rb
+ require_relative 'sysenv' # sysenv.rb
include SiSU_Env
- require "#{SiSU_lib}/css" # css.rb
+ require_relative 'css' # css.rb
include SiSU_Style
- class Skin
+ class Defaults
def initialize
@fonts='verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman' # 'verdana, arial, georgia, tahoma, sans-serif, helvetica, "times new roman", times, roman'
- @dir=SiSU_Env::Info_env.new
- @date=SiSU_Env::Info_date.new #{@date.year}
- @v=SiSU_Env::Info_version.instance.get_version
+ @dir=SiSU_Env::InfoEnv.new
+ @date=SiSU_Env::InfoDate.new #{@date.year}
+ @v=SiSU_Env::InfoVersion.instance.get_version
end
#% glyph
def glyph_bullet # &bullet;
@@ -78,114 +77,42 @@ module SiSU_Viz
def html_hardspace
'&nbsp;'
end
- #% php
- def php_persist
- end
- #% javascript #kxjs knxjs
- def js_home
- end
- def js_infobox
- end
- def js_knxjs
- end
- def js_head
- end
- def js_top
- end
- def js_sisu
- end
- def js_home
- end
- def js_sponsor
- end
- def js_books
- end
- def js_journals
- end
- def js_conferences
- end
- def js_services
- end
- def js_catalogue
- end
- def js_doc
- end
- def js_toc
- end
- def js_seg
- end
- def js_mail
- end
- def js_manifest
- end
- def js_status
- end
- def js_next
- end
- def js_prev
- end
- def js_plaintext
- end
- def js_portrait
- end
- def js_landscape
- end
- def js_pdf
- end
- def js_epub
- end
- def js_odf
- end
- def js_concordance
- end
- def js_instruments
- end
- def js_external
- end
- def js_gopher
- end
- def js_ftp
- end
- def js_law
- end
- def js_disclaimer
- end
def semantic_tags
def default
{
- :pub => 'publication',
- :conv => 'convention',
- :vol => 'volume',
- :pg => 'page',
- :cty => 'city',
- :org => 'organization',
- :uni => 'university',
- :dept => 'department',
- :fac => 'faculty',
- :inst => 'institute',
- :co => 'company',
- :com => 'company',
- :conv => 'convention',
- :dt => 'date',
- :y => 'year',
- :m => 'month',
- :d => 'day',
- :ti => 'title',
- :au => 'author',
- :ed => 'editor', #editor?
- :v => 'version', #edition
- :n => 'name',
- :fn => 'firstname',
- :mn => 'middlename',
- :ln => 'lastname',
- :in => 'initials',
- :qt => 'quote',
- :ct => 'cite',
- :ref => 'reference',
- :ab => 'abreviation',
- :def => 'define',
- :desc => 'description',
- :trans => 'translate',
+ pub: 'publication',
+ conv: 'convention',
+ vol: 'volume',
+ pg: 'page',
+ cty: 'city',
+ org: 'organization',
+ uni: 'university',
+ dept: 'department',
+ fac: 'faculty',
+ inst: 'institute',
+ co: 'company',
+ com: 'company',
+ conv: 'convention',
+ dt: 'date',
+ y: 'year',
+ m: 'month',
+ d: 'day',
+ ti: 'title',
+ au: 'author',
+ ed: 'editor', #editor?
+ v: 'version', #edition
+ n: 'name',
+ fn: 'firstname',
+ mn: 'middlename',
+ ln: 'lastname',
+ in: 'initials',
+ qt: 'quote',
+ ct: 'cite',
+ ref: 'reference',
+ ab: 'abreviation',
+ def: 'define',
+ desc: 'description',
+ trans: 'translate',
}
end
self
@@ -386,28 +313,13 @@ module SiSU_Viz
'www.sisudoc.org/'
end
def url_path_image_base #used for html image display
- '../_sisu/image'
+ "#{Xx[:html_relative2]}_sisu/image"
end
def url_path_image #used for html image display
- '../_sisu/image'
+ "#{Xx[:html_relative2]}_sisu/image"
end
def url_path_image_sys #used for html image display
- '../_sisu/image_sys'
- end
- def url_path_image_epub
- './image'
- end
- def url_path_ebook_dir
- './ebook'
- end
- def url_path_ebook_images
- '.'
- end
- def url_promo
- ''
- end
- def url_promo_home
- ''
+ "#{Xx[:html_relative2]}_sisu/image_sys"
end
def url_decoration
def tex_open #'{\UseTextSymbol{OML}{<}}'
@@ -452,9 +364,6 @@ module SiSU_Viz
self
end
#% color
- def color_shadow
- '"4"'
- end
def color_body
%{<body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en">}
end
@@ -464,18 +373,6 @@ module SiSU_Viz
def color_black
'#000000'
end
- def color_shadow #hmmm
- '"4"'
- end
- def color_blue_dark
- '#000099'
- end
- def color_blue
- 'blue'
- end
- def color_blue_base
- '#b9d4dd'
- end
def color_blue_ink
'#003399'
end
@@ -546,7 +443,7 @@ module SiSU_Viz
%{"#{color_white}"}
end
def color_body
- %{\n<body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en">\n}
+ %{<body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en">}
end
def color_font_face #was font WATCH
"#{color_black}"
@@ -603,46 +500,12 @@ module SiSU_Viz
def icon_pdf_landscape
'b_pdf.png'
end
- def icon_status
- 'b_status.png'
- end
- def icon_external
- 'b_ext.png'
- end
- def icon_external_toc
- 'b_ext_toc.png'
- end
- def icon_seg_toc
- 'b_bluebell.png'
- end
- def icon_crosslink_toc
- 'b_amber.png'
- end
- def icon_mail
- 'b_mail.png'
- end
- def icon_para
- 'b_para.png'
- end
- def icon_pdf
- 'b_pdf.png'
- end
- def icon_ftp
- 'b_ftp.png'
- end
- def icon_gopher
- 'b_gopher.png'
- end
def icon_choice
'b_choice.png'
end
def icon_new
'b_new.png'
end
- def icon_book
- 'b_amber.png'
- # b_book.png
- end
def icon_dot_clear
'dot_clear.png'
end
@@ -652,27 +515,9 @@ module SiSU_Viz
def icon_dot
icon_dot_white
end
- def icon_amber
- 'b_amber.png'
- end
- def icon_rose
- 'b_rose.png'
- end
- def icon_bluebell
- 'b_bluebell.png'
- end
def icon_home_button
'sisu.png'
end
- def icon_home_banner
- 'sisu.png'
- end
- def icon_site
- 'b_home.png'
- end
- def icon_bluedot
- 'blueband.png'
- end
def icon_next
'arrow_next_red.png'
end
@@ -689,27 +534,9 @@ module SiSU_Viz
def font_face
%{face="#{font_fonts}"}
end
- def font_lmtoc_face
- %{face="#{font_fonts}"}
- end
- def font_ebook_face
- %{face="#{font_fonts}"}
- end
- def font_face_lmtoc
- %{face="#{font_fonts}"}
- end
def font_color
'color="#000000"'
end
- def font_size
- 'size="4"'
- end
- def font_size_txt
- 'size="4"'
- end
- def font_size_txt_00
- 'size="3"'
- end
def font_size_endnote
'size="3"'
end
@@ -735,13 +562,13 @@ module SiSU_Viz
when /\/i$/; 'i'
else ''
end
- r.gsub!(/^\/(.+?)\/i?/,'\1')
- r.gsub!(/\(/,'(?:') # avoid need to escape use of brackets within regex provided
+ r=r.gsub(/^\/(.+?)\/i?/,'\1').
+ gsub(/\(/,'(?:') # avoid need to escape use of brackets within regex provided
m='\b(' + r + ')\b'
make[:str]
- make[:regx]=if x =~/i/; /#{m}/i
- else /#{m}/
- end
+ make[:regx]=(x =~/i/) \
+ ? (/#{m}/i)
+ : (/#{m}/)
else nil
end
end
@@ -756,13 +583,13 @@ module SiSU_Viz
when /\/i$/; 'i'
else ''
end
- r.gsub!(/^\/(.+?)\/i?/,'\1')
- r.gsub!(/\(/,'(?:') # avoid need to escape use of brackets within regex provided
+ r.gsub(/^\/(.+?)\/i?/,'\1').
+ gsub(/\(/,'(?:') # avoid need to escape use of brackets within regex provided
m='\b(' + r + ')\b'
make[:str]
- make[:regx]=if x =~/i/; /#{m}/i
- else /#{m}/
- end
+ make[:regx]=(x =~/i/) \
+ ? (/#{m}/i)
+ : (/#{m}/)
else nil
end
make
@@ -772,109 +599,35 @@ module SiSU_Viz
def paragraph_txt
%{<p class="normal">}
end
- def paragraph_txt_00
- %{<p class="justify">}
- end
- def paragraph_font_citation
- %{<font #{font_size_txt} #{font_face}>}
- end
def paragraph_endnote
%{<p class="endnote">}
end
- def paragraph_table
- %{<p align="left"><font #{font_small} #{font_color} #{font_face}>}
- end
- def paragraph_table_xml
- end
- def paragraph_tiny
- %{<p class="tiny">}
- end
- def paragraph_small
- %{<p class="small">} # keep but not used?
- end
def paragraph_font_tiny
%{<font #{font_tiny} #{font_face}>}
end
def paragraph_font_small
%{<font #{font_small} #{font_face}>}
end
- def paragraph_heading_1
- %{<h1>}
- end
- def paragraph_heading_1_center
- %{<h1 class="center">}
- end
#% table
def table_close
'</td></tr>
</table>'
end
- def table_close_centered_table
- end
- def table_align_A
- end
- def table_align_B
- end
- def table_align_C
- end
def table_width_1
'"100%"'
end
def table_width_2
'"99%"'
end
- def table_width_3
- '"94%"'
- end
- def table_width_4
- '"90%"'
- end
def table_width_txt
'"94%"'
end
- def table_width_txt_avgo
- '"100%"'
- end
def table_width_txt_r
'"96%"'
end
- def table_cellpad_small_paper_margins
- '"6"'
- end
- def table_cellpad_paper_margins
- '"36"'
- end
- def table_cellpad_A
- '"0"'
- end
- def table_cellpad_B
- '"20"'
- end
- def table_cellpad_shadow
- '"4"'
- end
- def table_cellpad_band
- '"16"'
- end
def table_cellpad_box
'"20"'
end
- def table_table_align_A
- '<center>'
- end
- def table_table_align_B
- '<center>'
- end
- def table_table_align_C
- ' '
- end
- #% table_do
- def table_do_table_paper
- %{#{table_align_C} <table summary="table paper" width=#{table_width_2} border="0" cellpadding=#{table_cellpad_paper_margins} bgcolor=#{color_paper} align="Justify"><tr><td>\n<font color="#000000"><p />\n}
- end
- def table_do_table_surround
- %{<table summary="table surround" width="100%" border="0" cellpadding="0" bgcolor="#ffffff" align="center"><tr><td>\n}
- end
#% indent
def indent_level_0
'"1%"'
@@ -902,16 +655,6 @@ module SiSU_Viz
'</td>
<td width="2%" align="right" valign="top"> '
end
- def margin_num_header
- '</td>
-<td width="4%" align="right" valign="top">'
- end
- def margin_txt_00_1
- %{<table summary="" width=#{table_width_txt} border="0" bgcolor="white" cellpadding="2" align="center">
-<tr><td width=#{indent_level_1} align="right">
-</td>
-<td valign="top" align="left" width=#{indent_level_1_c2w100}>}
- end
def margin_txt_w1
%{<table summary="" width=#{table_width_txt_r} border="0" bgcolor="white" cellpadding="2" align="center">
<tr><td width="6%" align="right">&nbsp;</td>
@@ -943,7 +686,7 @@ module SiSU_Viz
</td>
<td valign="top" align="justify">}
end
- def margin_css #unused, check
+ def margin_css
'<table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">
<tr><td valign="top" align="justify"> '
end
@@ -956,18 +699,9 @@ module SiSU_Viz
<img border="0" width="160" height="60" src="#{url_path_image}/#{icon_sisu}" alt="SiSU" />
</a>}
end
- def png_hp
- dir=SiSU_Env::Info_env.new #(@fns)
- %{ <a href="#{url.site}">
- <img border="0" width="160" height="60" src="#{@dir.url.images_local}/#{icon_home_banner}" alt="#{txt_home}" />
- </a>}
- end
def png_site
%{<img src="#{url_path_image}/#{icon_site}" alt="@" border="0" />}
end
- def png_homepage
- png_site
- end
def png_nav
%{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_bluebell}" alt="Contents" />}
end
@@ -995,123 +729,17 @@ module SiSU_Viz
def png_pdf_landscape
%{<img border="0" height="15" width="18" src="#{url_path_image_sys}/#{icon_pdf}" alt="PDF landscape" />}
end
- def png_wmp
- %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_wmp}" alt="Concordance" />}
- end
- def png_para
- %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_para}" alt="Segment" />}
- end
- def png_status
- %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_status}" alt="Membership status" />}
- end
- def png_mark
- %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_rose}" alt="*" />}
- end
- def png_doc_tiny
- %{<img border="0" height="8" width="8" src="#{url_path_image_sys}/#{icon_doc}" alt="Doc" />}
- end
- def png_toc_tiny
- %{<img border="0" height="8" width="8" src="#{url_path_image_sys}/#{icon_toc}" alt="TOC" />}
- end
- def png_status_tiny
- %{<img border="0" height="8" width="8" src="#{url_path_image_sys}/#{icon_status}" alt="Status, Member States" />}
- end
- def png_ftp
- %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_ftp}" alt="FTP" />}
- end
- def png_gopher
- %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_gopher}" alt="Gopher" />}
- end
- def png_crosslink
- %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_crosslink_toc}" alt="lateral hop" />}
- end
- def png_crosslink_ext
- %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_external_toc}" alt="lateral hop" />}
- end
def png_home
- dir=SiSU_Env::Info_env.new #(@fns)
- %{<img border="0" src="#{dir.url.images_local}/#{icon_home_button}" alt="#{txt_home} --&gt;" />}
- end
- def png_home_button
- #dir=SiSU_Env::Info_env.new #(@fns)
+ #dir=SiSU_Env::InfoEnv.new #(@fns)
%{<img border="0" src="#{url_path_image_base}/#{icon_home_button}" alt="#{txt_home} --&gt;" />}
+ #%{<img border="0" src="#{dir.url.images_local}/#{icon_home_button}" alt="#{txt_home} --&gt;" />}
end
- def png_book
- %{<img border="2" height="15" width="15" src="#{url_path_image_sys}/#{icon_book}" alt="Cameron May Books" />}
- end
- #% png_nav
- def png_nav_home
- end
- def png_nav_toc
- %{<img border="0" width="22" height="22" src="#{url_path_image_sys}/#{icon_up}" alt="TOC" />}
- end
- def png_nav_doc
- end
- def png_nav_previous
- %{<img border="0" width="22" height="22" src="#{url_path_image_sys}/#{icon_previous}" alt="&lt;&lt;&nbsp;previous" />}
- end
- def png_nav_next
- %{<img border="0" width="22" height="22" src="#{url_path_image_sys}/#{icon_next}" alt="next&nbsp;&gt;&gt;" />}
- end
- def png_nav_pre
- png_nav_previous
- end
- def png_nav_nxt
- png_nav_next
- end
- def epub_png_nav_previous
- %{<img border="0" width="22" height="22" src="#{url_path_image_epub}/#{icon_previous}" alt="&lt;&lt;&nbsp;previous" />}
- end
- def epub_png_nav_next
- %{<img border="0" width="22" height="22" src="#{url_path_image_epub}/#{icon_next}" alt="next&nbsp;&gt;&gt;" />}
- end
- def epub_png_nav_up
- %{<img border="0" width="22" height="22" src="#{url_path_image_epub}/#{icon_up}" alt="&#094;up&nbsp;&#094;" />}
- end
- def epub_png_nav_pre
- epub_png_nav_previous
- end
- def epub_png_nav_nxt
- epub_png_nav_next
- end
- def epub_png_nav_toc
- epub_png_nav_up
- end
- def png_nav_pdf
- %{<img border="0" height="18" width="15" src="#{url_path_image_sys}/#{icon_pdf}" alt="PDF" />}
- end
- def png_nav_pdf_portrait
- %{<img border="0" width="15" height="18" src="#{url_path_image_sys}/#{icon_pdf}" alt="pdf portrait" />}
- end
- def png_nav_pdf_landscape
- %{<img border="0" width="18" height="15" src="#{url_path_image_sys}/#{icon_pdf}" alt="pdf landscape" />}
- end
- def png_nav_dot_toc
- %{<img border="0" width="100%" height="20" src="#{url_path_image_sys}/#{icon_dot}" alt="&#094;" />}
- end
- def png_nav_dot_previous
- %{<img border="0" width="100%" height="20" src="#{url_path_image_sys}/#{icon_dot}" alt="&lt;" />}
- end
- def png_nav_dot_next
- %{<img border="0" width="100%" height="20" src="#{url_path_image_sys}/#{icon_dot}" alt="&gt;" />}
- end
- def png_nav_dot_pre
- png_nav_dot_previous
- end
- def png_nav_dot_nxt
- png_nav_dot_next
+ def png_home_button
+ rel=@dir.path_rel_links.html_scroll_2
+ %{<img border="0" src="#{rel}/#{icon_home_button}" alt="#{txt_home} --&gt;" />}
end
+ #% png_nav #not currently used
#% nav_txt
- def nav_txt_home
- %{ <font face="#{font_fonts}" size="2">
- #{png_site}&nbsp;
- </font> }
- end
- def nav_txt_home_button
- %{ <font face="#{font_fonts}" size="2">
- #{png_home_button}&nbsp;
- </font> }
- end
def nav_txt_homepage
%{ <font face="#{font_fonts}" size="2">
&nbsp;home&nbsp;
@@ -1122,17 +750,13 @@ module SiSU_Viz
&nbsp;&nbsp;toc&nbsp;
</font> }
end
- def nav_txt_toc_link_verbose
- %{ <font face="#{font_fonts}" size="2">
- #{png_toc}&nbsp;&nbsp;segments'&nbsp;toc&nbsp;
- </font> }
- end
def nav_txt_doc_link
%{ <font face="#{font_fonts}" size="2">
&nbsp;scroll&nbsp;
</font> }
end
def nav_txt_manifest
+ #{png_manifest}&nbsp;document&nbsp;manifest
%{ <font face="#{font_fonts}" size="2">
[&nbsp;document&nbsp;manifest&nbsp;]
</font> }
@@ -1142,37 +766,6 @@ module SiSU_Viz
&nbsp;&nbsp;A-Z&nbsp;
</font> }
end
- def nav_txt_previous
- ' <font face="" size="2">
- &nbsp;&nbsp;<b>&lt;&lt;</b>&nbsp;Previous&nbsp;&nbsp;
- </font>
- Full&nbsp;Text&nbsp;'
- end
- def nav_txt_next
- %{ <font face="#{font_fonts}" size="2">
- &nbsp;&nbsp;Next&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>&gt;&gt;</b>&nbsp;&nbsp;
- </font> }
- end
- def nav_txt_plaintext
- %{ <font face="#{font_fonts}" size="2">
- &nbsp;&nbsp;txt&nbsp;
- </font> }
- end
- def nav_txt_odf
- %{ <font face="#{font_fonts}" size="2">
- &nbsp;&nbsp;odt&nbsp;
- </font> }
- end
- def nav_txt_pdfs
- %{ <font face="#{font_fonts}" size="2">
- pdfs&nbsp;&nbsp;
- </font> }
- end
- def nav_txt_epub
- %{ <font face="#{font_fonts}" size="2">
- &nbsp;epub&nbsp;
- </font> }
- end
def nav_txt_pdf_portrait
%{ <font face="#{font_fonts}" size="2">
&nbsp;pdf&nbsp;
@@ -1184,95 +777,21 @@ module SiSU_Viz
</font> }
end
#% banner
- def banner_home
- %{ <center>
- <a href="#{url_site}/" target="_top" #{js_home}>
- #{png_site}
- </a>
- <br />
- <font size="2" color="#444444">
- an
- <br />
- (&nbsp;international&nbsp;|&nbsp;transnational&nbsp;)
- <br />
- commercial&nbsp;law&nbsp;&&nbsp;e-commerce
- <br />
- infrastructure monitor</font></center>}
- end
- def banner_home_guide
- %{ <br />
- <a href="#{url_site}/" target="_top" #{js_home}>
- #{png_doc} LM toc
- </a>
- <a href="../treaties.and.organisations/lm.chronological" target="_top" #{js_instruments}>
- #{png_doc} LM 20**
- </a>
- <br />}
- end
def banner_home_button_only
- %{<a href="#{url_site}/" #{js_home}>
+ %{<a href="#{url_site}/">
#{png_home_button}
</a>}
end
- def banner_home_button #yellow_dark now white
- %{<table summary="home button" width="100%" border="0" cellpadding="3" bgcolor= "#ffffff" align="center">
-<tr><td align="left" valign="middle" bgcolor="#{color_white}" width="10%">
- <a href="#{url_site}/" #{js_home}>
- #{png_home_button}
- </a>
-</td>
-<td width="90%">
-#{table_close}}
- end
- def banner_home_and_index_buttons #yellow_dark now white
- %{<table summary="home and index buttons" bgcolor=#{color_band1}>
-<tr><td width="20%">
-<table summary="home button" width="100%" border="0" cellpadding="3" align="center">
-<tr><td align="center" valign="middle" bgcolor="#{color_white}">
- <a href="#{url_site}/" target="_top" #{js_home}>
- #{png_home}
- </a>
-</td></tr>
-</table>
-</td>
-<td width="60%">
-<table summary="other contents buttons" border="0" cellpadding="3" cellspacing="0">
-<tr><td align="center" bgcolor=#{color_band2}>
- <font face="arial" size="2">
- <a href="toc" target="_top" #{js_toc}>
- &nbsp;This&nbsp;text's&nbsp;sub-&nbsp;
- <br />
- &nbsp;Table&nbsp;of&nbsp;Contents&nbsp;
- </a>
- </font>
-</td></tr>
-</table>
-</td>
-<td width="20%">
- &nbsp;
-#{table_close}}
- end
- def banner_url_txt_sisu
- %{<a href="#{url_sisu}/sisu" target="_top" #{js_home}>SiSU</a>}
- end
def banner_band #yellow_dark now white
%{<table summary="home button" width="100%" border="0" cellpadding="3" bgcolor= "#ffffff" align="center">
<tr><td align="left" valign="middle" bgcolor="#{color_white}">
- <a href="#{url_site}/" target="_top" #{js_home}>
+ <a href="#{url_site}/" target="_top">
#{png_home}
</a>
</td>
<td width="90%">
#{table_close}}
end
- def banner_credit_band
- %{<table summary="credits table yellow" width="80%" border="1" cellpadding="0" bgcolor="#{color_yellow_dark}" align="center">
-<tr><td align="center">
-<table summary="salmon" width="100%" border="0" cellpadding="0" bgcolor="#ffdec9">
-<tr><td align="center">
-<table summary="credits white background" width="100%" border="0" cellpadding="6" bgcolor="#ffffff">
-<tr><td align="center">}
- end
def banner_instrument_cover_band_scr
'<table summary="scroll instrument cover band" width="100%" border="0" cellpadding="8" bgcolor="#ffffff" align="center">
<tr><td align="center">'
@@ -1285,262 +804,16 @@ module SiSU_Viz
def widget_promo # Array used to build promo from list.yml and promo.yml
# ['sisu_icon','sisu','sisu_search_libre','open_society','fsf','ruby']
end
- def widget_browsers
-<<WOK
-<tr align="center"><td align="center">
-<table summary="browser suggestions" bgcolor="#ffffff" cellpadding="4" border="0">
-<tr><td>
- <p>
- <font color="#666666" size="2">
- If you have problems viewing pages on this site please update your browser:
- </font>
- </p>
-#{table_close}
-<table summary="browser suggestions" bgcolor="#ffffff" cellpadding="4" border="0">
-<tr><td>
- <p>
- <font color="#666666" size="1">
- <a href="http://www.gnome.org/projects/epiphany/" target="external">
- &nbsp;Epiphany
- </a>
- <sup>&reg;</sup>&nbsp;|
- </font>
- </p>
-</td>
-<td>
- <p>
- <font color="#666666" size="1">
- <a href="http://galeon.sourceforge.net/" target="external">
- &nbsp;Galeon
- </a>
- <sup>&reg;</sup>&nbsp;|
- </font>
- </p>
-</td>
-<td>
- <p>
- <font color="#666666" size="1">
- <a href="http://www.microsoft.com/windows/ie/default.asp" target="external">
- I-Explorer
- </a>
- <sup>&reg;</sup>&nbsp;|
- </font>
- </p>
-</td>
-<td>
- <p>
- <font color="#666666" size="1">
- <a href="http://kazehakase.sourceforge.jp/" target="external">
- Kazehakase</a>
- <sup>&reg;</sup>&nbsp;|</font></p></td>
-<td>
-<td>
- <p>
- <font color="#666666" size="1">
- <a href="http://www.konqueror.org/" target="external">
- Konqueror</a>
- <sup>&reg;</sup>&nbsp;|</font></p></td>
-<td>
- <p>
- <font color="#666666" size="1">
- <a href="http://www.mozilla.org/" target="external">
- Mozilla
- </a>
- <a href="http://www.mozilla.org/products/firefox/" target="external">
- <b>Firefox</b>
- </a>
- <sup>&reg;</sup>&nbsp;|
- </font>
- </p>
-</td>
-<td>
- <p>
- <font color="#666666" size="1">
- <a href="http://home.netscape.com/comprod/mirror/client_download.html" target="external">
- Netscape
- </a>
- <sup>&reg;</sup>&nbsp;|
- </font>
- </p>
-</td>
-<td>
- <p>
- <font color="#666666" size="1">
- <a href="http://www.opera.com/" target="external">
- Opera
- </a>
- <sup>&reg;</sup>&nbsp;|
- </font>
- </p>
-</td>
-<td>
- <p>
- <font color="#666666" size="1">
- <a href="http://www.apple.com/safari/" target="external">
- Safari
- </a>
- <sup>&reg;</sup>
- </font>
- </p>
-#{table_close}
-<table summary="lightweight browser and text browser suggestions" bgcolor="#ffffff" cellpadding="4" border="0">
-<tr><td>
- <p>
- <font color="#666666" size="1">
- for console/text viewing:
- </font>
- </p>
-</td>
-<td>
- <p>
- <font color="#666666" size="1">
- <a href="http://elinks.or.cz/" target="external">
- <b>elinks</b>
- </a>&nbsp;|
- </font>
- </p>
-</td>
-<td>
- <p>
- <font color="#666666" size="1">
- <a href="http://atrey.karlin.mff.cuni.cz/~clock/twibright/links" target="external">
- <b>links2</b>
- </a>&nbsp;|
- </font>
- </p>
-</td>
-<td>
- <p>
- <font color="#666666" size="1">
- <a href="http://w3m.sourceforge.net/" target="external">
- <b>w3m</b>
- </a>
- </font>
- </p>
-</td>
-<td>
- <p>
- <font color="#666666" size="1">
- for lightweight gui (X) viewing try:
- </font>
- </p>
-</td>
-<td>
- <p>
- <font color="#666666" size="1">
- <a href="http://www.dillo.org/" target="external">
- Dillo
- </a>
- &nbsp;|
- </font>
- </p>
-</td>
-<td>
- <p>
- <font color="#666666" size="1">
- <a href="http://www.gnome.org/projects/epiphany/" target="external">
- &nbsp;Epiphany
- </a>
- <sup>&reg;</sup>&nbsp;|
- </font>
- </p>
-</td>
-<td>
- <p>
- <font color="#666666" size="1">
- <a href="http://galeon.sourceforge.net/" target="external">
- &nbsp;Galeon
- </a>&nbsp;|
- </font>
- </p>
-</td>
-<td>
- <p>
- <font color="#666666" size="1">
- <a href="http://atrey.karlin.mff.cuni.cz/~clock/twibright/links" target="external">
- <b>links2 -g</b>
- </a>
- </font>
- </p>
-#{table_close}
-</td></tr>
-WOK
- end
def widgets_open
<<WOK
<table summary="SiSU summary" bgcolor="#ffffff" cellpadding="4" border="0">
WOK
end
- def widget_pdfviewers
-<<WOK
-<tr align="center"><td align="center">
-<!-- pdf viewer suggestions -->
-<tr><td>
- <p class="center">
- <font color="#666666" size="1">
- &amp; for
- <a href="http://www.adobe.com/products/acrobat/adobepdf.html" target="external">
- pdf
- </a>
- viewings of this site we recommend stand alone viewers
- <br />
- (rather than web browser plugins):
- </font>
- </p>
-</td></tr>
-<tr align="center"><td align="center">
- <p class="center">
- <font color="#666666" size="1">
- <a href="http://www.adobe.com/products/acrobat/readstep2.html" target="external">
- Acrobat Reader
- </a>
- <sup>&reg;</sup>
- &nbsp;|
- </font>
- </p>
-</td>
-<td>
- <p class="center">
- <font color="#666666" size="1">
- <a href="http://www.gnome.org/projects/evince/" target="external">
- <b>Evince</b>
- </a>
- <sup>&reg;</sup>
- </font>
- </p>
-</td>
-<td>
- <p class="center"><font color="#666666" size="1">
- <a href="http://www.cs.wisc.edu/~ghost/gv/" target="external">
- &nbsp;GhostView<sup>&reg;</sup>&nbsp;</a>,
- <a href="http://wwwthep.physik.uni-mainz.de/~plass/gv/" target="external">
- GV<sup>&reg;</sup>
- </a>
- &amp;
- <a href="http://www.cs.wisc.edu/~ghost/gsview/" target="external">
- GSview<sup>&reg;</sup>
- </a>
- &nbsp;|
- </font>
- </p>
-</td>
-<td>
- <p class="center">
- <font color="#666666" size="1">
- <a href="http://www.foolabs.com/xpdf/" target="external">
- &nbsp;Xpdf
- </a>
- <sup>&reg;</sup>
- </font>
- </p>
-</td></tr>
-WOK
- end
def widget_sisu_text
<<WOK
<p class="tiny"><font color="#666666" size="2">
Output generated by
- <a href="#{url_sisu}" #{js_sisu}>
+ <a href="#{url_sisu}">
#{@v[:project]}
</a>
#{@v[:version]} #{@v[:date]} (#{@v[:date_stamp]})
@@ -1561,7 +834,7 @@ WOK
<!-- widget sisu -->
<tr><td valign="top" width="10%">
<p class="tiny_left"><font color="#666666" size="2">
- <a href="#{url_sisu}" #{js_sisu}>
+ <a href="#{url_sisu}">
<img border="0" src="../_sisu/image/sisu.png" alt="SiSU" width="120" height="39" />
</a>
</font></p>
@@ -1569,33 +842,33 @@ WOK
<!-- SiSU Rights -->
<p class="tiny_left"><font color="#666666" size="2">
Output generated by
- <a href="#{url_sisu}" #{js_sisu}>
+ <a href="#{url_sisu}">
#{@v[:project]}
</a>
#{@v[:version]} #{@v[:date]} (#{@v[:date_stamp]})
<br />
- <a href="#{url_sisu}" #{js_sisu}>
+ <a href="#{url_sisu}">
<b>#{@v[:project]}</b>
</a>
Copyright <sup>&copy;</sup> Ralph Amissah
1997, current #{@date.year_static}.
All Rights Reserved.
<br />
- <a href="#{url_sisu}" #{js_sisu}>
+ <a href="#{url_sisu}">
#{@v[:project]}
</a>
is software for document structuring, publishing and search,
<br />
- <a href="#{url_sisu}" #{js_sisu}>
+ <a href="#{url_sisu}">
www.sisudoc.org/
</a>
and
- <a href="#{url_sisudoc}" #{js_sisu}>
+ <a href="#{url_sisudoc}">
www.sisudoc.org
</a>
<br />
<i>w3 since October 3 1993</i>
- <a href="mailto:ralph@amissah.com" #{js_mail}>
+ <a href="mailto:ralph@amissah.com">
ralph@amissah.com
</a>
</font></p>
@@ -1623,7 +896,7 @@ WOK
</font></p>
</td><td valign="top" width="45%">
<p class="tiny_left"><font color="#666666" size="2">
- <a href="#{url_sisu}" #{js_sisu}>
+ <a href="#{url_sisu}">
#{@v[:project]}
</a>
is released under
@@ -1656,26 +929,6 @@ WOK
WOK
end
#% credits
- def credits_itl_cover_band
- %{<table summary="itl cover band" width="88%" border="0" cellpadding="0" bgcolor="blue">
-<tr><td>
-<table summary="" width="100%" border="0" cellpadding="8" bgcolor="#000099">
-<tr><td>
-<table summary="" width="99%" border="1" cellpadding="0" bgcolor="#ffcc00">
-<tr><td>
-<table summary="" width="100%" border="1" cellpadding="0" bgcolor="#ffffff">
-<tr><td align="center">
- <font #{font_face}>
- <br />
- \@
- <br />
- #{txt_home}
- <br />
- #{banner_url_txt_sisu}
- <br />
- </font>
-#{table_close*4}}
- end
def credits_sisu_manifest
widget_sisu_text
end
@@ -1696,35 +949,12 @@ WOK
</div>}
''
end
- #% bottom
- def bottom_surround
- %{</td>
-<td align="center" valign="bottom">#{table_close}<table summary="" border="0" width="100%" valign="top">
-<tr><td valign="top" width="20%"><table summary="" width="100%" border="0" cellpadding="0" bgcolor="#e3ecef" align="center">
-<tr><td valign="top">
-#{table_close}
-</td>
-<td align="center" valign="top">
- #{banner_band}
-#{table_close}
-<table summary="" border="0" width="100%" valign="top">
-<tr><td valign="top" width="20%">
-<table summary="" width="100%" border="0" cellpadding="0" bgcolor="#e3ecef" align="center">
-<tr><td valign="top">
- #{table_close}
-</td>
-<td align="center" valign="top">
- #{credits_splash}
-#{table_close}
-</body>
-</html>}
- end
end
- class Home < Skin
+ class Home < Defaults
def initialize
- @v=SiSU_Env::Info_version.instance.get_version
- @dir=SiSU_Env::Info_env.new
- @date=SiSU_Env::Info_date.new #{@date.year}
+ @v=SiSU_Env::InfoVersion.instance.get_version
+ @dir=SiSU_Env::InfoEnv.new
+ @date=SiSU_Env::InfoDate.new #{@date.year}
end
def redirect
<<WOK
@@ -1744,12 +974,12 @@ WOK
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
+<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>SiSU information Structuring Universe - Structured
information, Serialized Units - software for electronic texts,
documents, books, digital libraries in plaintext, html, XHTML, XML,
ODF (OpenDocument), EPUB, LaTeX, PDF, SQL (PostgreSQL and SQLite), and
for search</title>
-<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="dc.title"
content="SiSU information Structuring Universe, Structured information Serialised Units, #{@date.year_static}" />
<meta name="dc.creator" content="Ralph Amissah" />
@@ -1767,7 +997,7 @@ for search</title>
<body>
<div id="top_band">
<p class="top_band_image">
- <a href="http://www.sisudoc.org/sisu/SiSU" target="_top" >
+ <a href="http://www.sisudoc.org/sisu/SiSU" target="_top">
<img border="0" src="./_sisu/image/sisu.png" alt="SiSU &gt;&gt;">
</a>
</p>
@@ -1777,11 +1007,11 @@ for search</title>
<h2 class="top_band_tiny">
Structured information, Serialized Units
&nbsp;&nbsp;
- <a href="http://www.sisudoc.org" target="_top" >
+ <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" >
+ <a href="http://www.jus.uio.no/sisu/" target="_top">
&lt;www.jus.uio.no/sisu/&gt;
</a>
</h2>
@@ -1799,7 +1029,7 @@ outputs include: plaintext, html, XHTML, XML, ODF (OpenDocument), EPUB, LaTeX, P
</div>
<div id="column_left">
<p class="bold">
- <a href="http://www.sisudoc.org/sisu/SiSU" target="_top" >
+ <a href="http://www.sisudoc.org/sisu/SiSU" target="_top">
SiSU
</a>
</p>
@@ -1807,7 +1037,7 @@ outputs include: plaintext, html, XHTML, XML, ODF (OpenDocument), EPUB, LaTeX, P
---
</p>
<p class="small">
- <a href="http://www.sisudoc.org/sisu/sisu_manual/" target="_top" >
+ <a href="http://www.sisudoc.org/sisu/sisu_manual/" target="_top">
SiSU Manual
</a>
</p>
@@ -1815,7 +1045,7 @@ outputs include: plaintext, html, XHTML, XML, ODF (OpenDocument), EPUB, LaTeX, P
---
</p>
<p class="small">
- <a href="http://www.sisudoc.org/sisu/SiSU/1.html#summary" target="_top" >
+ <a href="http://www.sisudoc.org/sisu/SiSU/1.html#summary" target="_top">
What does SiSU do? Summary
</a>
</p>
@@ -1823,17 +1053,17 @@ outputs include: plaintext, html, XHTML, XML, ODF (OpenDocument), EPUB, LaTeX, P
---
</p>
<p class="small">
- <a href="http://www.sisudoc.org/sisu/SiSU/examples.html" target="_top" >
+ <a href="http://www.sisudoc.org/sisu/SiSU/examples.html" target="_top">
Book Samples and Markup Examples
</a>
</p>
<p class="small">
- <a href="http://www.sisudoc.org/sisu/sisu_site_metadata/harvest_authors.html" target="_top" >
+ <a href="http://www.sisudoc.org/sisu/sisu_site_metadata/harvest_authors.html" target="_top">
sorted by Author (sisu metadata)
</a>
</p>
<p class="small">
- <a href="http://www.sisudoc.org/sisu/sisu_site_metadata/harvest_topics.html" target="_top" >
+ <a href="http://www.sisudoc.org/sisu/sisu_site_metadata/harvest_topics.html" target="_top">
sorted by Topic (sisu metadata)
</a>
</p>
@@ -1841,7 +1071,7 @@ outputs include: plaintext, html, XHTML, XML, ODF (OpenDocument), EPUB, LaTeX, P
---
</p>
<p class="small">
- <a href="http://www.sisudoc.org/sisu/SiSU/1.html#ocn" target="_top" >
+ <a href="http://www.sisudoc.org/sisu/SiSU/1.html#ocn" target="_top">
Object Citation Numbering - <i>ocn</i>
</a>
</p>
@@ -1850,12 +1080,13 @@ outputs include: plaintext, html, XHTML, XML, ODF (OpenDocument), EPUB, LaTeX, P
---
</p>
<p class="small">
- <a href="http://www.sisudoc.org/sisu/SiSU/1.html#search" target="_top" >
+ <a href="http://www.sisudoc.org/sisu/SiSU/1.html#search" target="_top">
Search - "<i>granular</i>"
</a>
+</p>
<p class="tiny">
Of interest is the ease of streaming documents to a relational database, at an object (roughly paragraph) level and the potential for increased precision in the presentation of matches that results thereby. The ability to serialise html, LaTeX, XML, SQL, (whatever) is also inherent in / incidental to the design. For a description see the
- <a href="http://www.sisudoc.org/sisu/sisu_provisional_patent_application_200408" target="_top" >
+ <a href="http://www.sisudoc.org/sisu/sisu_provisional_patent_application_200408" target="_top">
abandoned U.S. provisional patent application
</a>
</p>
@@ -1863,15 +1094,23 @@ outputs include: plaintext, html, XHTML, XML, ODF (OpenDocument), EPUB, LaTeX, P
---
</p>
<p class="small">
- <a href="http://www.sisudoc.org/sisu/SiSU/download.html" target="_top" >
- <b>Download</b>
+ <a href="http://git.sisudoc.org/" target="_top">
+ <b>Development, SCM - Git</b>
+ </a><br />
+ <a href="http://git.sisudoc.org/" target="_top">
+ &lt;http://git.sisudoc.org&gt;
+ </a>
+</p>
+<p class="small">
+ <a href="http://www.sisudoc.org/sisu/SiSU/download.html" target="_top">
+ <b>Download</b> alternatives
</a>
</p>
<p class="tiny">
---
</p>
<p class="small">
- <a href="http://www.sisudoc.org/sisu/SiSU/changelog.html" target="_top" >
+ <a href="http://www.sisudoc.org/sisu/SiSU/changelog.html" target="_top">
Changelog
</a>
</p>
@@ -1879,8 +1118,8 @@ outputs include: plaintext, html, XHTML, XML, ODF (OpenDocument), EPUB, LaTeX, P
---
</p>
<p class="small">
- License, SiSU is licensed under
- <a href="http://www.gnu.org/licenses/gpl.html" target="_top" >
+ License, SiSU is licensed under
+ <a href="http://www.gnu.org/licenses/gpl.html" target="_top">
GPLv3 or later
</a>
</p>
@@ -1907,7 +1146,7 @@ SiSU is an Open Source project initiated and led by Ralph Amissah <a href="mailt
<p class="bold">
For less markup than the most elementary HTML you can have more.
</p>
-<p><a href="http://www.sisudoc.org/sisu/SiSU" target="_top" ><b>SiSU</b> - Structured information, Serialized Units</a> for electronic documents, is an information structuring, transforming, publishing and search framework with the following features:</p>
+<p><a href="http://www.sisudoc.org/sisu/SiSU" target="_top"><b>SiSU</b> - Structured information, Serialized Units</a> for electronic documents, is an information structuring, transforming, publishing and search framework with the following features:</p>
<p>
<b>(i)</b> markup syntax:
<b>(a)</b>
@@ -1952,7 +1191,7 @@ SQL databases are populated at an object level (roughly headings, paragraphs, ve
use of semantic meta-tags in headers permit the addition of semantic information on documents, (the available fields are easily extended)</p>
<p>
<b>(vii)</b>
-creates organised directory/file structure for (file-system) output, easily mapped with its clearly defined structure, with all text objects numbered, you know in advance where in each document output type, a bit of text will be found (e.g. from an SQL search, you know where to go to find the prepared html output or PDF etc.)... there is more; easy directory management and document associations, the document preparation (sub-)directory may be used to determine output (sub-)directory, the skin used, and the SQL database used,</p>
+creates organised directory/file structure for (file-system) output, easily mapped with its clearly defined structure, with all text objects numbered, you know in advance where in each document output type, a bit of text will be found (e.g. from an SQL search, you know where to go to find the prepared html output or PDF etc.)... there is more; easy directory management and document associations, the document preparation (sub-)directory may be used to determine output (sub-)directory and the SQL database used,</p>
<p>
<b>(viii)</b>
"Concordance file" wordmap, consisting of all the words in a document and their (text/ object) locations within the text, (and the possibility of adding vocabularies),</p>
@@ -1963,12 +1202,13 @@ document content certification and comparison considerations:
the document and each object within it stamped with an md5 hash making it possible to easily check or guarantee that the substantive content of a document is unchanged,
<b>(b)</b>
version control, documents integrated with time based source control system, default RCS or CVS with use of $Id$ tag, which SiSU checks
+</p>
<p>
<b>(x)</b>
SiSU's minimalist markup makes for meaningful "diffing" of the substantive content of markup-files,</p>
<p>
<b>(xi)</b>
-easily skinnable, document appearance on a project/site wide, directory wide, or document instance level easily controlled/changed,</p>
+modifiable document appearance on a project/site wide, directory wide, or document instance level easily controlled/changed,</p>
<p>
<b>(xii)</b>
in many cases a regular expression may be used (once in the document header) to define all or part of a documents structure obviating or reducing the need to provide structural markup within the document,</p>
@@ -2020,7 +1260,7 @@ as a developers tool it is flexible and extensible
</p>
<br />
<p class="small">
-<a href="http://www.sisudoc.org"><b>SiSU</b></a> at <a href="http://www.sisudoc.org">&lt;www.sisudoc.org&gt;</a> or <a href="http://www.jus.uio.no/sisu/">&lt;www.jus.uio.no/sisu/&gt;</a></p>
+<a href="http://www.sisudoc.org"><b>SiSU</b></a> at <a href="http://www.sisudoc.org">&lt;www.sisudoc.org&gt;</a> or <a href="http://www.jus.uio.no/sisu/">&lt;www.jus.uio.no/sisu/&gt;</a></p>
</div>
<div id="column_right">
<p class="tiny">
@@ -2033,7 +1273,7 @@ as a developers tool it is flexible and extensible
<input type="hidden" name="a" value="1" />
<input type="radio" name="view" value="index" checked="checked" /> idx
<input type="radio" name="view" value="text" /> txt
-<a href="http://search.sisudoc.org" target="_top" >&lt;search.sisudoc.org&gt;</a>
+<a href="http://search.sisudoc.org" target="_top">&lt;search.sisudoc.org&gt;</a>
</form>
<!-- Search SiSU -->
</p>
@@ -2059,6 +1299,7 @@ SiSU markup is fairly minimalistic, it consists of: a (largely optional) documen
<a href="http://www.sisudoc.org/sisu/SiSU/">
&lt;www.sisudoc.org/sisu/SiSU&gt;
</a>
+</p>
<p class="tiny">
SiSU was developed in relation to legal documents, and is strong across a wide variety of texts (law, literature...(humanities, law and part of the social sciences)). SiSU handles images but is not suitable for formulae/ statistics, or for technical writing at this time.</p>
<p class="tiny">
@@ -2100,7 +1341,7 @@ WOK
end
class Inserts
end
- class TeX < Skin
+ class TeX < Defaults
def initialize(papersize='')
@papersize=papersize
end
diff --git a/lib/sisu/v2/digests.rb b/lib/sisu/v4/digests.rb
index 12052631..4bde7511 100644
--- a/lib/sisu/v2/digests.rb
+++ b/lib/sisu/v4/digests.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -56,10 +55,10 @@
** Description: document digests (md5|sha256) and structure processing
=end
-module SiSU_Digest_view
- require "#{SiSU_lib}/particulars" # particulars.rb
- require "#{SiSU_lib}/i18n" # i18n.rb
- require "#{SiSU_lib}/shared_markup_alt.rb" # shared_markup_alt.rb
+module SiSU_DigestView
+ require_relative 'particulars' # particulars.rb
+ require_relative 'prog_text_translation' # prog_text_translation.rb
+ require_relative 'shared_markup_alt.rb' # shared_markup_alt.rb
pwd=Dir.pwd
class Source
@@dg=nil
@@ -68,25 +67,26 @@ module SiSU_Digest_view
@fnb=@opt.fnb
@@endnotes_para=[]
@@dg=nil
- @dg=@@dg ||=SiSU_Env::Info_env.new.digest.type
- @particulars=SiSU_Particulars::Combined_singleton.instance.get_all(opt)
+ @dg=@@dg ||=SiSU_Env::InfoEnv.new.digest.type
+ @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)
end
def read
begin
@env,@md,@dal_array=@particulars.env,@particulars.md,@particulars.dal_array
unless @opt.cmd =~/q/
tool=(@opt.cmd =~/[MVv]/) \
- ? "#{@env.program.text_editor} #{@env.path.output_tell}/#{@md.fnb}/#{@md.fn[:digest]}" \
- : @opt.fns
+ ? "#{@env.program.text_editor} file://#{@md.file.output_path.hash_digest.dir}/#{@md.file.base_filename.hash_digest}"
+ : "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}"
@opt.cmd=~/[MVvz]/ \
- ? SiSU_Screen::Ansi.new(@opt.cmd,"Document #{@dg} Digests",tool).green_hi_blue \
+ ? SiSU_Screen::Ansi.new(@opt.cmd,"Document #{@dg} Digests",tool).green_hi_blue
: SiSU_Screen::Ansi.new(@opt.cmd,"Document #{@dg} Digests",tool).green_title_hi
- SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/#{@md.fnb}/#{@md.fn[:digest]}").flow if @opt.cmd =~/[MV]/
+ SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"file://#{@md.file.output_path.hash_digest.dir}/#{@md.file.base_filename.hash_digest}").flow if @opt.cmd =~/[MV]/
+ end
+ SiSU_DigestView::Source::Scroll.new(@particulars).songsheet
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
end
- my_make=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns)
- SiSU_Digest_view::Source::Scroll.new(@particulars).songsheet
- SiSU_Env::Info_skin.new(@md).select
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
ensure
end
end
@@ -98,12 +98,12 @@ module SiSU_Digest_view
def initialize(particulars) #data='',md='')
@particulars=particulars
@data,@env,@md=@particulars.dal_array,@particulars.env,@particulars.md
- SiSU_Env::SiSU_file.new(@md).mkdir
+ SiSU_Env::FileOp.new(@md).mkdir
@@dg ||=@env.digest.type
@@dl ||=@env.digest.length
@dg,@dl=@@dg,@@dl
- l=SiSU_Env::Standardise_language.new.file_to_language(@md.fns)
- @language=l[:l]
+ l=SiSU_Env::StandardiseLanguage.new(@md.opt.lng).language
+ @language=l[:n]
@tr=SiSU_Translate::Source.new(@md,@language)
@sp=' '
end
@@ -115,27 +115,28 @@ module SiSU_Digest_view
output
end
def description(f,e='')
- puts f + e.to_s if @md.cmd =~/V/
+ puts f + e.to_s if @md.opt.cmd =~/V/
@@description << f << e
end
def digests(f,e='')
- puts f if @md.cmd =~/V/
+ puts f if @md.opt.cmd =~/V/
@@ds[:digests] << f + "\n"
end
def dal_structure_tree(f,e='')
- puts f + e.to_s if @md.cmd =~/V/
+ puts f + e.to_s if @md.opt.cmd =~/V/
@@ds[:tree] << f << e
end
def dal_structure_summary(f,e='')
- puts f + e.to_s if @md.cmd =~/V/
+ puts f + e.to_s if @md.opt.cmd =~/V/
@@ds[:summary] << f << e
end
def rcinfo(f,e='')
- puts f + e.to_s if @md.cmd =~/V/
+ puts f + e.to_s if @md.opt.cmd =~/V/
@@sc_info << f << e
end
def output
- filename_digest=SiSU_Env::SiSU_file.new(@md,@md.fn[:digest]).mkfile
+ file=SiSU_Env::FileOp.new(@md)
+ filename_digest=file.write_file.hash_digest
filename_digest << @@description.join << @@ds[:digests].join << @@ds[:tree].join << @@ds[:summary].join << @@sc_info.join
end
def rgx_txt(txt)
@@ -143,7 +144,7 @@ module SiSU_Digest_view
end
def message_digest
data=@data
- sys=SiSU_Env::System_call.new
+ sys=SiSU_Env::SystemCall.new
l=Hash.new(0)
@p=[]
@g,@v,@r='','',''
@@ -153,9 +154,9 @@ module SiSU_Digest_view
if para =~/#{Mx[:id_o]}~(\d+);((?:\w|[0-6]:)\d+);(\w\d+)#{Mx[:id_c]}#{Mx[:id_o]}([0-9a-f]{#{@dl}}):([0-9a-f]{#{@dl}})#{Mx[:id_c]}/
ocn,h1,h2,d_clean,d_all=$1,$2,$3,$4,$5
@ocn=ocn unless ocn.to_i==0
- para.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>')
- para.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>')
- para.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>')
+ para=para.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>').
+ gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>').
+ gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>')
if para=~/#{Mx[:en_a_o]}[\d*+]+.+?#{Mx[:id_o]}[0-9a-f]{#{@dl}}#{Mx[:id_c]}#{Mx[:en_a_c]}/
para_endnotes << para.scan(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})([\d*+]+).+?#{Mx[:id_o]}([0-9a-f]{#{@dl}})#{Mx[:id_c]}(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/)
end
@@ -191,14 +192,14 @@ module SiSU_Digest_view
and images.length > 0 # then get path of image & produce digest
@image_name,@image_dgst,@img=[],[],[]
images.each do |i|
- image_source=if FileTest.file?("#{@env.path.image_source_local_tex}/#{i}")
- @env.path.image_source_local_tex
- elsif FileTest.file?("#{@env.path.image_source_remote_tex}/#{i}")
- @env.path.image_source_remote_tex
- elsif FileTest.file?("#{@env.path.image_source_tex}/#{i}")
- @env.path.image_source_tex
+ image_source=if FileTest.file?("#{@env.path.image_source_include_local}/#{i}")
+ @env.path.image_source_include_local
+ elsif FileTest.file?("#{@env.path.image_source_include_remote}/#{i}")
+ @env.path.image_source_include_remote
+ elsif FileTest.file?("#{@env.path.image_source_include}/#{i}")
+ @env.path.image_source_include
else
- SiSU_Screen::Ansi.new(@md.cmd,"ERROR - image:", %{"#{i}" missing}, "search locations: #{@env.path.image_source_local_tex}, #{@env.path.image_source_remote_tex} and #{@env.path.image_source_tex}").error2 unless @md.cmd =~/q/
+ SiSU_Screen::Ansi.new(@md.opt.cmd,"ERROR - image:", %{"#{i}" missing}, "search locations: #{@env.path.image_source_include_local}, #{@env.path.image_source_include_remote} and #{@env.path.image_source_include}").error2 unless @md.opt.cmd =~/q/
nil
end
@img << /\S+\.(png|jpg|gif)/.match(i)[1]
@@ -206,9 +207,9 @@ module SiSU_Digest_view
if image_source
para_image = image_source + '/' + i
@image_name << i
- @image_dgst << if @dg =~/^sha(?:2|256)$/; sys.sha256(para_image)
- else sys.md5(para_image)
- end
+ @image_dgst << (@dg =~/^sha(?:2|256)$/) \
+ ? sys.sha256(para_image)
+ : sys.md5(para_image)
else
@image_name << ' '*16 + i + ' [image missing]'
@image_dgst << ''
@@ -227,7 +228,7 @@ module SiSU_Digest_view
end
else
prefix=''
- metad=[@tr.full_title,@tr.author,@tr.translator,@tr.illustrator,@tr.prepared_by,@tr.digitized_by,@tr.description,@tr.subject,@tr.abstract,@tr.publisher,@tr.contributor,@tr.date_created,@tr.date_issued,@tr.date_available,@tr.date_modified,@tr.date_valid,@tr.date,@tr.type,@tr.format,@tr.rights,@tr.identifier,@tr.source,@tr.language,@tr.language_original,@tr.relation,@tr.coverage,@tr.keywords,@tr.comments,@tr.cls_loc,@tr.cls_dewey,@tr.cls_gutenberg,@tr.cls_isbn,@tr.prefix_a,@tr.prefix_b,@tr.sourcefile,@tr.sourcefile_digest,@tr.last_generated,@tr.sisu_version,@tr.ruby_version,@tr.sc_number,@tr.sc_date,'Skin_Digest: ','Generated by: ','Ruby version: ']
+ metad=[@tr.full_title,@tr.author,@tr.translator,@tr.illustrator,@tr.prepared_by,@tr.digitized_by,@tr.description,@tr.subject,@tr.abstract,@tr.publisher,@tr.contributor,@tr.date_created,@tr.date_issued,@tr.date_available,@tr.date_modified,@tr.date_valid,@tr.date,@tr.type,@tr.format,@tr.rights,@tr.identifier,@tr.source,@tr.language,@tr.language_original,@tr.relation,@tr.coverage,@tr.keywords,@tr.comments,@tr.cls_loc,@tr.cls_dewey,@tr.cls_gutenberg,@tr.cls_isbn,@tr.prefix_a,@tr.prefix_b,@tr.sourcefile,@tr.sourcefile_digest,@tr.last_generated,@tr.sisu_version,@tr.ruby_version,@tr.sc_number,@tr.sc_date,'Generated by: ','Ruby version: ']
metad.each do |n|
m=rgx_txt(n)
if m=~/\S+/ \
@@ -255,8 +256,6 @@ module SiSU_Digest_view
@c=/#{m_author}: (.+?)#{Mx[:id_o]}~\d;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}[0-9a-f]{#{@dl}}:[0-9a-f]{#{@dl}}#{Mx[:id_c]}/.match(para)[1].gsub(/<\/?u>/,'').strip
when /#{m_sourcefile_digest}.+?<u>/ #watch
dgst_extra="\n" + ' '*21 +'source' +' '*4 + @md.dgst[1] + ' '*34 + @md.fns
- when /Skin_Digest: /
- dgst_extra="\n" + ' '*21 + 'skin' +' '*6 + @md.dgst_skin[1] + ' '*34 + /(skin_\S+?\.rb)/.match(@md.dgst_skin[0])[1]
when /#{m_sisu_version}: /
@v=/#{m_sisu_version}: (.+?)#{Mx[:id_o]}~\d;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}[0-9a-f]{#{@dl}}:[0-9a-f]{#{@dl}}#{Mx[:id_c]}/.match(para)[1].gsub(/<\/?u>/,'').strip
when /#{m_last_generated}: /
@@ -298,11 +297,11 @@ module SiSU_Digest_view
data=@data
endnotes=nil
data.each do |t_o|
- dgst=SiSU_text_representation::Modified_text_plus_Hash_digest.new(@md,t_o).composite.dgst
+ dgst=SiSU_TextRepresentation::ModifiedTextPlusHashDigest.new(@md,t_o).composite.dgst
if dgst
- if t_o.is=='heading'
+ if t_o.is==:heading
digests("#{@sp*0}#{dgst[:ocn]}#{@sp*(8-dgst[:ocn].to_s.length)}#{dgst[:dgst_stripped_txt]} #{dgst[:dgst_markedup_txt]} #{dgst[:is]} #{t_o.lv}")
- elsif t_o.is=='heading_insert'
+ elsif t_o.is==:heading_insert
digests("#{@sp*0}[#{dgst[:ocn]}]#{@sp*(6-dgst[:ocn].to_s.length)}#{dgst[:dgst_stripped_txt]} #{dgst[:dgst_markedup_txt]} #{dgst[:is]} #{t_o.lv}")
else
digests("#{@sp*0}#{dgst[:ocn]}#{@sp*(8-dgst[:ocn].to_s.length)}#{dgst[:dgst_stripped_txt]} #{dgst[:dgst_markedup_txt]} #{dgst[:is]}")
@@ -325,7 +324,7 @@ module SiSU_Digest_view
dal_structure_tree("------------\n")
dal_structure_tree("document structure[*]\n")
data.each do |t_o|
- if t_o.is=='heading'
+ if t_o.is==:heading
x=case t_o.ln
when 1; l[1] +=1 #fix Mx[:lv_o]
' '*0 +':A'
@@ -342,7 +341,7 @@ module SiSU_Digest_view
else nil
end
end
- ocn=t_o.ocn if defined? t_o.ocn and t_o.is !='heading_insert'
+ ocn=t_o.ocn if defined? t_o.ocn and t_o.is !=:heading_insert
dal_structure_tree("#{x}\n") if x and not x.empty?
end
dal_structure_tree(" [*] heading levels\n")
diff --git a/lib/sisu/v2/embedded.rb b/lib/sisu/v4/embedded.rb
index afdfd5a7..87b37fc0 100644
--- a/lib/sisu/v2/embedded.rb
+++ b/lib/sisu/v4/embedded.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -57,18 +56,18 @@
=end
module SiSU_Embedded
- require "#{SiSU_lib}/param" # param.rb
+ require_relative 'param' # param.rb
include SiSU_Param
- require "#{SiSU_lib}/sysenv" # sysenv.rb
+ require_relative 'sysenv' # sysenv.rb
include SiSU_Env
class Source
- require 'fileutils'
- include FileUtils
def initialize(opt)
@opt=opt
@md=SiSU_Param::Parameters.new(@opt).get
- @env=SiSU_Env::Info_env.new(@md.fns)
- @rhost=SiSU_Env::Info_remote.new(@opt).remote_host_base
+ @env=SiSU_Env::InfoEnv.new(@md.fns)
+ @rhost=SiSU_Env::InfoRemote.new(@opt).remote_host_base
+ @base_src_dir=@opt.f_pth[:pth].sub(/\/#{@opt.f_pth[:lng]}$/,'')
+ @f=SiSU_Env::FileOp.new(@md)
end
def read
songsheet
@@ -78,58 +77,64 @@ module SiSU_Embedded
audio
multimedia
begin
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
ensure
end
end
def images
- src="#{Dir.pwd}/_sisu/image"
- ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image"
+ src="#{@base_src_dir}/_sisu/image"
+ src_img='_sisu/image'
+ ldest=@env.path.output
+ img_dir="#{@env.path.output}/_sisu/image"
@rhost.each do |remote_conn|
rdest="#{remote_conn[:name]}/#{@env.path.stub_pwd}/_sisu/image"
- if @md.cmd.inspect =~/[vVMR]/ \
+ remote_rel=remote_conn[:name] + '/' + @f.output_path.stub.rcp
+ if @md.opt.cmd.inspect =~/[vVMR]/ \
and FileTest.directory?(src)
- mkdir_p(ldest) unless FileTest.directory?(ldest)
- src_ec="#{src}/" + @md.ec[:image].join(" #{src}/")
+ FileUtils::mkdir_p(img_dir) unless FileTest.directory?(img_dir)
+ src_ec=@f.place_file.images.rel + '/' + @md.ec[:image].join(" #{@f.output_path.images.rel}/")
unless @opt.fns =~/\.-sst$/
- SiSU_Env::System_call.new(src_ec,"#{ldest}/.",'q').rsync
- if @md.cmd.inspect =~/R/ #rsync to remote image directory
- SiSU_Env::System_call.new(src_ec,"#{rdest}/.",'q').rsync
- end
+ SiSU_Env::SystemCall.new(src_ec,ldest,'q').rsync('--relative',@opt.base_path)
+ #if @md.opt.cmd.inspect =~/R/ #rsync to remote image directory
+ # SiSU_Env::SystemCall.new(src_ec,remote_rel,'q').rsync('--relative')
+ #end
end
end
end
end
def audio
#p @md.ec[:audio]
- src="#{Dir.pwd}/_sisu/mm/audio"
+ src="#{@base_src_dir}/_sisu/mm/audio"
ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/mm/audio"
@rhost.each do |remote_conn|
rdest="#{remote_conn[:name]}/#{@env.path.stub_pwd}/_sisu/mm/audio"
- if @md.cmd.inspect =~/[vVMR]/ \
+ if @md.opt.cmd.inspect =~/[vVMR]/ \
and FileTest.directory?(src)
- mkdir_p(ldest) unless FileTest.directory?(ldest)
+ FileUtils::mkdir_p(ldest) unless FileTest.directory?(ldest)
src_ec="#{src}/" + @md.ec[:audio].join(" #{src}/")
- SiSU_Env::System_call.new(src_ec,"#{ldest}/.",'q').rsync
- if @md.cmd.inspect =~/R/ #rsync to remote audio directory
- SiSU_Env::System_call.new(src_ec,"#{rdest}/.",'q').rsync
+ SiSU_Env::SystemCall.new(src_ec,"#{ldest}/.",'q').rsync
+ if @md.opt.cmd.inspect =~/R/ #rsync to remote audio directory
+ SiSU_Env::SystemCall.new(src_ec,"#{rdest}/.",'q').rsync
end
end
end
end
def multimedia
#p @md.ec[:multimedia]
- src="#{Dir.pwd}/_sisu/mm/video"
+ src="#{@base_src_dir}/_sisu/mm/video"
ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/mm/video"
@rhost.each do |remote_conn|
rdest="#{remote_conn[:name]}/#{@env.path.stub_pwd}/_sisu/mm/video"
- if @md.cmd.inspect =~/[vVMR]/ \
+ if @md.opt.cmd.inspect =~/[vVMR]/ \
and FileTest.directory?(src)
- mkdir_p(ldest) unless FileTest.directory?(ldest)
+ FileUtils::mkdir_p(ldest) unless FileTest.directory?(ldest)
src_ec="#{src}/" + @md.ec[:multimedia].join(" #{src}/")
- SiSU_Env::System_call.new(src_ec,"#{ldest}/.",'q').rsync
- if @md.cmd.inspect =~/R/ #rsync to remote video directory
- SiSU_Env::System_call.new(src_ec,"#{rdest}/.",'q').rsync
+ SiSU_Env::SystemCall.new(src_ec,"#{ldest}/.",'q').rsync
+ if @md.opt.cmd.inspect =~/R/ #rsync to remote video directory
+ SiSU_Env::SystemCall.new(src_ec,"#{rdest}/.",'q').rsync
end
end
end
diff --git a/lib/sisu/v4/epub.rb b/lib/sisu/v4/epub.rb
new file mode 100644
index 00000000..9ac4b610
--- /dev/null
+++ b/lib/sisu/v4/epub.rb
@@ -0,0 +1,723 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: epub generation, processing
+
+=end
+module SiSU_EPUB
+ require 'pstore'
+ require_relative 'particulars' # particulars.rb
+ include SiSU_Particulars
+ require_relative 'defaults' # defaults.rb
+ include SiSU_Viz
+ require_relative 'xhtml_table' # xhtml_table.rb
+ require_relative 'epub_format' # epub_format.rb
+ include SiSU_EPUB_Format
+ require_relative 'epub_segments' # epub_segments.rb
+ include SiSU_EPUB_Seg
+ require_relative 'epub_tune' # epub_tune.rb
+ include SiSU_EPUB_Tune
+ require_relative 'epub_concordance' # epub_concordance.rb
+ class Source
+ def initialize(opt)
+ @opt=opt
+ @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)
+ end
+ def read
+ songsheet
+ end
+ def songsheet
+ begin
+ @md=@particulars.md
+ @fnb=@md.fnb
+ @env=@particulars.env
+ loc=@env.path.url.output_tell
+ unless @opt.cmd =~/q/
+ tool=(@opt.cmd =~/[MVvz]/) \
+ ? "#{@env.program.epub_viewer} #{@md.file.output_path.epub.dir}/#{@md.file.base_filename.epub}"
+ : "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}"
+ @opt.cmd=~/[MVvz]/ \
+ ? SiSU_Screen::Ansi.new(@opt.cmd,'EPUB',tool).green_hi_blue
+ : SiSU_Screen::Ansi.new(@opt.cmd,'EPUB',tool).green_title_hi
+ SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@md.file.output_path.epub.dir}/#{@md.file.base_filename.epub}").flow if @opt.cmd =~/[MV]/
+ end
+ @env.processing_path.epub_bld #(@md)
+ @env.processing_path.epub_cp_images(@md)
+ dir_epub=@env.processing_path.epub
+ data=nil
+ SiSU_Env::FileOp.new(@md).mkdir.output.epub
+ @tuned_file_array=SiSU_EPUB::Source::XHTML_Environment.new(@particulars).tuned_file_instructions
+ data=@tuned_file_array
+ scr_endnotes=SiSU_EPUB::Source::Endnotes.new(@md,data).scroll
+ toc=SiSU_EPUB::Source::Toc.new(@md,data).songsheet
+ data=@tuned_file_array
+ scr_toc=SiSU_EPUB::Source::ScrollHeadAndSegToc.new(@md,toc).in_common #watch
+ SiSU_EPUB::Source::Seg.new(@md,data).songsheet
+ SiSU_EPUB::Source::Output.new(@md).songsheet
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ unless @opt.cmd =~/[MV]/ #check maintenance flag
+ 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.cmd,@opt.fns).param_instantiate
+ @@flag,@@scr,@@seg,@@seg_endnotes,@@seg_subtoc,@@seg_ad={},{},{},{},{},{}
+ @@seg_total,@@tracker,@@loop_count,@@tablehead,@@number_of_cols=0,0,0,0,0
+ @@seg_name,@@seg_name_html,@@seg_subtoc_array,@@seg_endnotes_array,@@segtocband,@@tablefoot=Array.new(7){[]}
+ @@filename_seg,@@seg_url,@@fn,@@to_lev4,@@get_hash_to,@@get_hash_fn='','','','','','',''
+ @@is4=@@is3=@@is2=@@is1=@@heading1=@@heading2=@@heading3=@@heading4=0
+ end
+ end
+ private
+ class XHTML_Environment
+ def initialize(particulars)
+ @particulars=particulars
+ @md,@env=particulars.md,particulars.env
+ @vz=SiSU_Viz::Defaults.new
+ @env,@css=particulars.env,SiSU_Style::CSS.new
+ end
+ def directories
+ title=File.basename(@md.fns,'.rb')
+ SiSU_Env::FileOp.new(@md).mkdir.output.epub
+ end
+ def tuned_file_instructions
+ @tell=SiSU_Screen::Ansi.new(@md.opt.cmd)
+ @md.opt.cmd=@md.opt.cmd.gsub(/H/,'h')
+ directories
+ dal_array=@particulars.dal_array # dal file drawn here
+ @tuned_file_array=SiSU_EPUB_Tune::Tune.new(dal_array,@md).songsheet
+ @tuned_file_array
+ end
+ end
+ class Endnotes
+ include SiSU_EPUB_Format
+ def initialize(md,data)
+ @md,@data=md,data
+ end
+ def scroll
+ @scr_endnotes=[]
+ format_head_scroll=SiSU_EPUB_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_EPUB_Format::FormatScroll.new(@md,txt_obj)
+ @scr_endnotes << format_scroll.endnote_body
+ end
+ end
+ end
+ end
+ @scr_endnotes
+ end
+ end
+ class Toc
+ @@toc={ seg: [], seg_mini: [], scr: [], ncx: [], opf: [] }
+ @@seg_url=''
+ @@firstseg=nil
+ def initialize(md=nil,data='')
+ @md,@data=md,data
+ @vz=SiSU_Viz::Defaults.new
+ @epub=SiSU_EPUB_Format::HeadInformation.new(@md)
+ @tell=SiSU_Screen::Ansi.new(@md.opt.cmd) if @md
+ @make=SiSU_Env::ProcessingSettings.new(@md)
+ end
+ def songsheet #extracts toc for scroll & seg
+ SiSU_Screen::Ansi.new(@md.opt.cmd,'Toc').txt_grey if @md.opt.cmd =~/[MVv]/
+ toc=nil
+ @@firstseg=nil
+ @@toc={ seg: [], seg_mini: [], scr: [], ncx: [], opf: [] }
+ md_opf_a_content,md_opf_a_spine,md_opf_a_guide=[],[],[]
+ @nav_no=0
+ @s_a_no,@s_b_no,@s_c_no=0,0,0
+ @@toc[:ncx] << @epub.toc_ncx.open #epub ncx navmap
+ @@toc[:ncx] << @epub.toc_ncx.head_open << @epub.toc_ncx.head << @epub.toc_ncx.head_close
+ @@toc[:ncx] << @epub.toc_ncx.doc_title << @epub.toc_ncx.doc_author
+ @@toc[:ncx] << @epub.toc_ncx.navmap_open
+ @@toc[:opf] << @epub.metadata_opf.package_open
+ @@toc[:opf] << @epub.metadata_opf.metadata
+ @@toc[:opf] << @epub.metadata_opf.manifest_open
+ @@toc[:seg] << %{<div class="content">\n<div class="substance">}
+ @@toc[:scr] << %{<div class="content">\n<div class="substance">}
+ if defined? @md.make.cover_image \
+ and @md.make.cover_image.is_a?(Hash) \
+ and @md.make.cover_image[:cover] =~/\S+/
+ md_opf_a_content << @epub.metadata_opf.manifest_cover_image_information(@md)
+ md_opf_a_spine << @epub.metadata_opf.spine_cover_image
+ md_opf_a_guide << @epub.metadata_opf.guide_cover_image
+ end
+ md_opf_a_content << @epub.metadata_opf.manifest_content_sisu_toc
+ if @make.build.toc?
+ md_opf_a_spine << @epub.metadata_opf.spine_sisu_toc
+ md_opf_a_guide << @epub.metadata_opf.guide_sisu_toc
+ end
+ @ncxo=[nil,false,false,false,false,false,false]
+ @dob_toc2,@dob_toc3=nil,nil
+ @ncx_cls=[]
+ @level_a_first_occurrence=true
+ @data.each do |dob|
+ if dob.is==:heading \
+ || dob.is==:heading_insert
+ dob_toc=dob.dup
+ toc=case dob_toc.ln
+ when 1
+ @s_a_no +=1
+ name_s_a='section_a' + @s_a_no.to_s
+ @nav_no+=1
+ @nav_no2=@nav_no
+ @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[4]
+ @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[3]
+ @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[2]
+ @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[1]
+ @ncxo[1],@ncxo[2],@ncxo[3],@ncxo[4]=true,false,false,false
+ @epub.sections(dob_toc,name_s_a)
+ @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no,name_s_a) if dob_toc
+ if @level_a_first_occurrence \
+ && @make.build.toc?
+ @nav_no+=1
+ @@toc[:ncx] << @epub.toc_ncx.navmap_sisu_toc(@nav_no) #epub ncx navmap, toc
+ @level_a_first_occurrence=false
+ end
+ md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,name_s_a)
+ md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,name_s_a)
+ md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,name_s_a)
+ SiSU_EPUB::Source::Toc.new(@md,dob_toc).level_1
+ when 2
+ @s_b_no +=1
+ name_s_b='section_b' + @s_b_no.to_s
+ @nav_no+=1
+ @nav_no2=@nav_no
+ @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[4]
+ @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[3]
+ @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[2]
+ @ncxo[2],@ncxo[3],@ncxo[4]=true,false,false
+ @epub.sections(dob_toc,name_s_b)
+ @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no,name_s_b) if dob_toc
+ md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,name_s_b)
+ md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,name_s_b)
+ md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,name_s_b)
+ SiSU_EPUB::Source::Toc.new(@md,dob_toc).level_2
+ when 3
+ @s_c_no +=1
+ name_s_c='section_c' + @s_c_no.to_s
+ @nav_no+=1
+ @nav_no3=@nav_no
+ @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[4]
+ @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[3]
+ @ncxo[3],@ncxo[4]=true,false
+ @epub.sections(dob_toc,name_s_c)
+ @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no,name_s_c) if dob_toc
+ md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,name_s_c)
+ md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,name_s_c)
+ md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,name_s_c)
+ SiSU_EPUB::Source::Toc.new(@md,dob_toc).level_3
+ when 4
+ @ncx_cls=[]
+ @nav_no+=1
+ @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[4]
+ @ncxo[4]=true
+ @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no) if dob_toc
+ md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc)
+ md_opf_a_spine << @epub.metadata_opf.spine(dob_toc)
+ md_opf_a_guide << @epub.metadata_opf.guide(dob_toc)
+ SiSU_EPUB::Source::Toc.new(@md,dob_toc).level_4
+ when 5; SiSU_EPUB::Source::Toc.new(@md,dob_toc).level_5
+ when 6; SiSU_EPUB::Source::Toc.new(@md,dob_toc).level_6
+ else nil
+ end
+ toc.each do |k,d|
+ 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]
+ @@toc[:scr] << toc[:seg]
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ end
+ end
+ end
+ end
+ @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[4]
+ @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[3]
+ @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[2]
+ @ncxo[1],@ncxo[2],@ncxo[3],@ncxo[4]=false,false,false,false
+ md_opf_a_content << @epub.metadata_opf.manifest_images(@md.ec[:image])
+ @@toc[:seg] << "</div>\n</div>"
+ @@toc[:scr] << "</div>\n</div>"
+ @@toc[:ncx] << @epub.toc_ncx.navmap_close
+ @@toc[:ncx] << @epub.toc_ncx.close
+ @@toc[:opf] << md_opf_a_content << @epub.metadata_opf.manifest_close
+ @@toc[:opf] << @epub.metadata_opf.spine_open << md_opf_a_spine << @epub.metadata_opf.spine_close
+ @@toc[:opf] << @epub.metadata_opf.guide_open << md_opf_a_guide << @epub.metadata_opf.guide_close
+ @@toc[:opf] << @epub.metadata_opf.package_close
+ @@toc[:opf]=@@toc[:opf].flatten
+ SiSU_EPUB::Source::Output.new(@md,@@toc[:opf]).epub_metadata_opf
+ SiSU_EPUB::Source::Output.new(@md,@@toc[:ncx]).epub_toc_ncx
+ @md.firstseg=@@firstseg
+ @@toc
+ end
+ protected
+ def level_1
+ dob=@data
+ linkname,link=dob.obj.strip,dob.ocn
+ if link \
+ and link !~/#/ #% keep eye on link
+ p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,link)
+ end
+ title=if dob.obj !~/Document Information/
+ linkname
+ else
+ link='metadata'
+ %{<b><a href="#{link}#{Sfx[:epub_xhtml]}">#{linkname}</a></b>}
+ end
+ toc={}
+ txt_obj={ txt: title }
+ format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj)
+ toc[:seg]=if dob.name =~/^meta/ \
+ and dob.obj =~/Document Information/ #check
+ format_toc.lev0
+ else format_toc.lev1
+ end
+ 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 />'
+ link=(dob.ln) \
+ ? dob.ln
+ : ''
+ %{<b><a href="##{link}">#{linkname}</a></b>}
+ end
+ txt_obj={ txt: title }
+ format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj)
+ toc[:scr]=if dob.name =~/^meta/ \
+ and dob.obj =~/Document Information/
+ format_toc.lev0
+ else format_toc.lev1
+ end
+ toc
+ end
+ def level_2
+ dob=@data
+ linkname,ocn=dob.obj.strip,dob.ocn
+ if ocn \
+ and ocn !~/#/
+ p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn)
+ end
+ txt_obj={ txt: linkname }
+ format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj)
+ toc={}
+ toc[:seg]=format_toc.lev2
+ if p_num
+ title=%{#{p_num.goto}#{linkname}</a>}
+ txt_obj={ txt: title }
+ format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj)
+ toc[:scr]=format_toc.lev2
+ end
+ toc
+ end
+ def level_3
+ dob=@data
+ linkname,ocn=dob.obj.strip,dob.ocn
+ if ocn \
+ and ocn !~/#/
+ p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn)
+ end
+ txt_obj={ txt: linkname }
+ format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj)
+ toc={}
+ toc[:seg]=format_toc.lev3
+ if p_num
+ title=%{#{p_num.goto}#{linkname}</a>}
+ txt_obj={ txt: title }
+ format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj)
+ toc[:scr]=format_toc.lev3
+ end
+ toc
+ end
+ def level_4
+ dob=@data
+ linkname,ocn=dob.obj.strip,dob.ocn
+ p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn) if ocn
+ if dob.ln==4
+ seg_link=%{ <a href="#{dob.name}#{Sfx[:epub_xhtml]}">
+ #{dob.obj}
+ </a> }
+ @@seg_url=dob.name
+ elsif dob.obj =~/\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+/
+ seg_link=dob.obj.gsub(/^(\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+)(.*)/,
+ %{<a href="\\1#{Sfx[:epub_xhtml]}">} +
+ %{\\1 \\2</a> })
+ end
+ p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn) if ocn
+ txt_obj={ txt: seg_link }
+ format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj)
+ toc={}
+ toc[:seg]=format_toc.lev4
+ title=%{#{p_num.goto}#{linkname}</a>} if p_num
+ txt_obj={ txt: title }
+ format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj)
+ toc[:scr]=format_toc.lev4
+ toc
+ end
+ def level_5
+ dob=@data
+ linkname,ocn=dob.obj.strip,dob.ocn
+ toc={}
+ if ocn \
+ and ocn !~/#/
+ p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn)
+ lnk_n_txt=%{ <a href="#{@@seg_url}#{Sfx[:epub_xhtml]}#o#{ocn}">
+ #{linkname}
+ </a>}
+ txt_obj={ txt: lnk_n_txt }
+ format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj)
+ toc[:seg]=format_toc.lev5
+ title=%{#{p_num.goto}#{linkname}</a>}
+ txt_obj={ txt: title }
+ format_toc=SiSU_EPUB_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 !~/#/
+ p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn)
+ lnk_n_txt=%{ <a href="#{@@seg_url}#{Sfx[:epub_xhtml]}#o#{ocn}">
+ #{linkname}
+</a>}
+ txt_obj={ txt: lnk_n_txt }
+ format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj)
+ toc[:seg]=format_toc.lev6
+ title=%{#{p_num.goto}#{linkname}</a>}
+ txt_obj={ txt: title }
+ format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj)
+ toc[:scr]=format_toc.lev6
+ end
+ toc
+ end
+ end
+ class ScrollHeadAndSegToc < Toc
+ def initialize(md='',toc='',links_guide_toc='')
+ @md,@toc,@links_guide_toc=md,toc,links_guide_toc
+ @vz=SiSU_Viz::Defaults.new
+ end
+ def in_common
+ toc_shared=[]
+ segtoc=[]
+ SiSU_Screen::Ansi.new(@md.opt.cmd,'Scroll & Segtoc').txt_grey if @md.opt.cmd =~/[MVv]/
+ format_head_toc=SiSU_EPUB_Format::HeadToc.new(@md)
+ dochead=format_head_toc.head
+ dochead=dochead.gsub(/toc\.(html)/,'doc.\1') #kludge
+ toc_shared << dochead #<< ads.div.major
+ segtoc << format_head_toc.head #<< ads.div.major
+ if defined? @md.rights.all \
+ and @md.rights.all
+ rights=format_head_toc.rights.all
+ rights=SiSU_EPUB_Tune::CleanXHTML.new(rights).clean
+ end
+ if defined? @md.notes.prefix_b \
+ and @md.notes.prefix_b
+ prefix_b=format_head_toc.prefix_b
+ prefix_b=SiSU_EPUB_Tune::CleanXHTML.new(prefix_b).clean
+ end
+ 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_EPUB_Format::FormatTextObject.new(@md,txt_obj)
+ toc_shared << format_txt_obj.center_bold
+ segtoc << format_txt_obj.center_bold
+ if defined? @md.creator.author \
+ and @md.creator.author
+ creator_endnote=@md.creator.author.gsub(/(\*+)/,%{&nbsp;<sup><a href="#notes">\\1</a></sup>})
+ tmp_head=creator_endnote + "\n"
+ txt_obj={ txt: tmp_head }
+ format_txt_obj=SiSU_EPUB_Format::FormatTextObject.new(@md,txt_obj)
+ toc_shared << format_txt_obj.center_bold
+ segtoc << format_txt_obj.center_bold
+ end
+ tmp_head=nil
+ if defined? @md.prefix_a \
+ and @md.prefix_a
+ tmp_head ||= %{#{@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 \
+ and @md.prefix_b
+ toc_shared << prefix_b
+ end
+ #Table of Contents added/appended here
+ toc_shared << @toc[:scr]
+ segtoc << @links_guide_toc
+ segtoc << @toc[:seg]
+ if defined? @md.rights.all \
+ and @md.rights.all
+ segtoc << rights
+ end
+ if defined? @md.prefix_b \
+ and @md.prefix_b
+ segtoc << prefix_b
+ end
+ #Segtoc tail added here
+ segtoc << format_head_toc.xhtml_close
+ segtoc=segtoc.flatten.compact #watch
+ SiSU_EPUB::Source::Output.new(@md).make_cover_image
+ SiSU_EPUB::Source::Output.new(@md,segtoc).make_segtoc
+ segtoc=[]
+ @toc[:scr],@toc[:seg]=[],[]
+ toc_shared
+ end
+ end
+ class Table < SiSU_XHTML_Table::TableXHTML
+ end
+ class Seg < SiSU_EPUB_Seg::Seg
+ end
+ class Output
+ def initialize(md,output='')
+ @md,@output=md,output
+ @epub_doc="#{@md.fnb}.epub"
+ @epub_header=SiSU_EPUB_Format::HeadInformation.new(@md)
+ @make=SiSU_Env::ProcessingSettings.new(@md)
+ @make_file=SiSU_Env::CreateFile.new(@md.fns)
+ end
+ def songsheet
+ mimetype
+ metainf_container
+ css
+ images if @md.ec[:image]
+ #concordance #uncomment to enable inclusion of concordance file
+ output_zip
+ end
+ def mimetype
+ out=@make_file.epub.mimetype
+ out<<@epub_header.mimetype
+ out.close
+ end
+ def metainf_container #container.xml file in META-INF directory
+ out=@make_file.epub.metainf_cont
+ out<<@epub_header.metainf_container
+ out.close
+ end
+ def css
+ out=@make_file.epub.xhtml_css
+ out << SiSU_EPUB_Format::CSS.new.css_epub_xhtml
+ out.close
+ end
+ def epub_toc_ncx
+ begin
+ out=@make_file.epub.toc_ncx
+ @output.each do |para|
+ unless para =~/\A\s*\Z/
+ out.puts para
+ end
+ end
+ out.close
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ end
+ end
+ def epub_metadata_opf
+ begin
+ out=@make_file.epub.metadata
+ @output.each do |para|
+ unless para =~/\A\s*\Z/
+ out.puts para
+ end
+ end
+ out.close
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ end
+ end
+ def images
+ img_pth=@md.env.path.image_source_include
+ img_src_pth=unless @md.opt.f_pth[:pth] =~/\/\S+?\/sisupod\/\S+?\/sisupod\/doc/
+ @md.file.output_path.epub.rel_image
+ else
+ pt=/(\/\S+?\/sisupod\/\S+?\/sisupod)\/doc/.match(@md.opt.f_pth[:pth])[1]
+ pt + '/image'
+ end
+ @md.ec[:image].each do |x|
+ if FileTest.directory?("#{@md.env.processing_path.epub}/#{Ep[:d_oebps]}/image") \
+ && FileTest.file?("#{img_src_pth}/#{x}")
+ FileUtils::cp("#{img_src_pth}/#{x}","#{@md.env.processing_path.epub}/#{Ep[:d_oebps]}/image")
+ elsif FileTest.directory?("#{@md.env.processing_path.epub}/#{Ep[:d_oebps]}/image") \
+ && FileTest.file?("#{img_pth}/#{x}")
+ FileUtils::cp("#{img_pth}/#{x}","#{@md.env.processing_path.epub}/#{Ep[:d_oebps]}/image")
+ else STDERR.puts %{\t*WARN* did not find image - "#{x}" in #{img_src_pth} or #{img_pth} [#{__FILE__}:#{__LINE__}]}
+ end
+ end
+ end
+ def concordance
+ SiSU_EPUB_Concordance::Source.new(@md.opt).read
+ end
+ def output_zip
+ FileUtils::mkdir_p(@md.file.output_path.epub.dir) unless FileTest.directory?(@md.file.output_path.epub.dir)
+ if FileTest.directory?(@md.env.processing_path.epub)
+ pwd=Dir.pwd
+ Dir.chdir(@md.env.processing_path.epub)
+ system("
+ zip -qXr9D #{@epub_doc} *
+ ")
+ FileUtils::mv(@epub_doc, @md.file.place_file.epub.dir)
+ Dir.chdir(pwd)
+ unless @md.opt.cmd.inspect =~/M/
+ FileUtils::rm_r(@md.env.processing_path.epub)
+ end
+ end
+ end
+ def make_cover_image
+ begin
+ if @md.make.cover_image? \
+ and @md.make.cover_image.is_a?(Hash) \
+ and @md.make.cover_image[:cover] =~/\S+/
+ filename_xhtml=@make_file.epub.xhtml_cover_image
+ cover_image=<<WOK
+<?xml version='1.0' encoding='utf-8'?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title>Cover</title>
+ <meta http-equiv="Content-Type" content='text/html; charset=utf-8' />
+ <link rel="stylesheet" href="css/xhtml.css" type="text/css" />
+ <style type="text/css"> img { max-width: 100%; } </style>
+</head>
+<body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en">
+ <div class="svg_outer">
+ <div class="svg_inner">
+ <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100%" height="100%" viewBox="0 0 #{@md.make.cover_image[:w]} #{@md.make.cover_image[:h]}" preserveAspectRatio="xMidYMid meet">
+ <image width="#{@md.make.cover_image[:w]}" height="#{@md.make.cover_image[:h]}" xlink:href="image/#{@md.make.cover_image[:cover]}" />
+ </svg>
+ </div>
+ </div>
+</body>
+</html>
+WOK
+ filename_xhtml.puts cover_image,"\n"
+ filename_xhtml.close
+ end
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ end
+ end
+ def make_segtoc
+ begin
+ if @make.build.toc?
+ filename_xhtml=@make_file.epub.xhtml_index
+ @output.each do |para|
+ para=para.strip
+ unless para =~/\A\s*\Z/
+ filename_xhtml.puts para,"\n"
+ end
+ end
+ filename_xhtml.close
+ end
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ end
+ end
+ end
+ end
+end
+__END__
diff --git a/lib/sisu/v2/epub_concordance.rb b/lib/sisu/v4/epub_concordance.rb
index 301d34a2..e75fb1bf 100644
--- a/lib/sisu/v2/epub_concordance.rb
+++ b/lib/sisu/v4/epub_concordance.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -58,60 +57,59 @@
=end
module SiSU_EPUB_Concordance
- require "#{SiSU_lib}/particulars" # particulars.rb
+ require_relative 'particulars' # particulars.rb
include SiSU_Particulars
- require "#{SiSU_lib}/sysenv" # sysenv.rb
+ require_relative 'sysenv' # sysenv.rb
include SiSU_Env
- require "#{SiSU_lib}/defaults" # defaults.rb
+ require_relative 'defaults' # defaults.rb
include SiSU_Viz
- require "#{SiSU_lib}/epub_format" # epub_format.rb
+ require_relative 'epub_format' # epub_format.rb
include SiSU_EPUB_Format
class Source
def initialize(opt)
@opt=opt
- @particulars=SiSU_Particulars::Combined_singleton.instance.get_all(opt)
+ @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)
end
def read
begin
@env,@md=@particulars.env,@particulars.md
- loc=@env.url.output_tell
- tool=((@md.cmd =~/[MVv]/) ? "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:concordance]}" : '')
- SiSU_Screen::Ansi.new(@md.cmd,"Concordance",tool).grey_title_hi unless @md.cmd =~/q/
wordmax=@env.concord_max
unless @md.wc_words.nil?
if @md.wc_words < wordmax
SiSU_EPUB_Concordance::Source::Words.new(@particulars).songsheet
else
- SiSU_Screen::Ansi.new(@md.cmd,"concordance skipped, large document has over #{wordmax} words (#{@md.wc_words})").warn unless @md.cmd =~/q/
+ SiSU_Screen::Ansi.new(@md.opt.cmd,"*WARN* concordance skipped, large document has over #{wordmax} words (#{@md.wc_words})").warn unless @md.opt.cmd =~/q/
end
else
- SiSU_Screen::Ansi.new(@md.cmd,"wc (word count) is off, concordance will be processed for all files including those over the max set size of: #{wordmax} words").warn unless @md.cmd =~/q/
+ SiSU_Screen::Ansi.new(@md.opt.cmd,"*WARN* wc (word count) is off, concordance will be processed for all files including those over the max set size of: #{wordmax} words").warn unless @md.opt.cmd =~/q/
SiSU_EPUB_Concordance::Source::Words.new(@particulars).songsheet
end
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
ensure
end
end
private
- class Doc_title
+ class DocTitle
include SiSU_Viz
#revisit, both requires (html & shared_xml) needed for stand alone operation (sisu -w [filename])
- require "#{SiSU_lib}/epub" # epub.rb
+ require_relative 'epub' # epub.rb
def initialize(particulars)
@particulars,@md=particulars,particulars.md
- @data=SiSU_EPUB::Source::XHtml_environment.new(particulars).tuned_file_instructions
- @vz=SiSU_Env::Get_init.instance.skin
+ @data=SiSU_EPUB::Source::XHTML_Environment.new(particulars).tuned_file_instructions
+ @vz=SiSU_Viz::Defaults.new
txt_path=%{#{@md.dir_out}}
- SiSU_Env::Info_skin.new(@md).select
@fnb=@md.fnb
@lex_button=%{<a href="http://www.jus.uio.no/sisu/" target="_top"><img border="0" height="44" width="144" valign="center" src="../_sisu/image/sisu.png" alt="SiSU home --&gt;"></a>}
@doc_details =<<WOK
-<table summary="links to text related to this rudimentary index" width="96%" border="0" bgcolor="white" cellpadding="0" align="center"><tr><td width="2%" align="right">&nbsp;</td><td width="94%" valign="top" align="justify"><h1 class="small"><a href="#{@md.fn[:toc]}" #{@vz.js_toc}><b>#{@md.title.full}</b></a></h1><p class="bold">#{@md.creator.author}</p></td></tr></table>
+<table summary="links to text related to this rudimentary index" width="96%" border="0" bgcolor="white" cellpadding="0" align="center"><tr><td width="2%" align="right">&nbsp;</td><td width="94%" valign="top" align="justify"><h1 class="small"><a href="#{@md.file.base_filename.epub}"><b>#{@md.title.full}</b></a></h1><p class="bold">#{@md.creator.author}</p></td></tr></table>
WOK
end
def create
- @css=SiSU_Env::CSS_stylesheet.new(@particulars.md)
- format_head_toc=SiSU_EPUB_Format::Head_toc.new(@md)
+ @css=SiSU_Env::CSS_Stylesheet.new(@particulars.md)
+ format_head_toc=SiSU_EPUB_Format::HeadToc.new(@md)
dochead=format_head_toc.head
<<WOK
#{dochead}
@@ -145,18 +143,18 @@ WOK
end
end
class Words
- require "#{SiSU_lib}/defaults" # defaults.rb
+ require_relative 'defaults' # defaults.rb
include SiSU_Viz
- require "#{SiSU_lib}/epub_format" # epub_format.rb
+ require_relative 'epub_format' # epub_format.rb
include SiSU_EPUB_Format
- require "#{SiSU_lib}/sysenv" # sysenv.rb
+ require_relative 'sysenv' # sysenv.rb
include SiSU_Screen
def initialize(particulars)
@particulars=particulars
begin
- @vz=SiSU_Env::Get_init.instance.skin
+ @vz=SiSU_Viz::Defaults.new
@env,@md,@dal_array=particulars.env,particulars.md,particulars.dal_array
- @path="#{@env.path.epub}"
+ @path="#{@env.processing_path.epub}"
@freq=Hash.new(0)
@rxp_lv1=/^#{Mx[:lv_o]}1:/ #fix Mx[:lv_o]
@rxp_lv2=/^#{Mx[:lv_o]}2:/ #fix Mx[:lv_o]
@@ -170,14 +168,24 @@ WOK
@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?|[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
@rgx_scanlist=%r{#{Mx[:fa_italics_o]}[a-zA-Z0-9"\s]{2,12}#{Mx[:fa_italics_c]}|#{Mx[:fa_bold_o]}[a-zA-Z0-9"\s]{2,12}#{Mx[:fa_bold_c]}|#{Mx[:url_o]}https?://\S+?#{Mx[:url_c]}|file://\S+|<\S+?>|\w+|[a-zA-Z]+}mi
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
end
end
def songsheet
begin
+ #fix to use
+ p __LINE__.to_s + ':' + __FILE__
+ p "#{@path}/content/#{@md.fn[:epub_concord]}"
+ p "#{@md.file.output_path.epub.dir}/#{@md.file.base_filename.epub}"
@file_concordance=File.open("#{@path}/content/#{@md.fn[:epub_concord]}",'w')
map_para
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
ensure
@file_concordance.close
end
@@ -185,18 +193,18 @@ WOK
protected
def location_scroll(wordlocation,show)
@wordlocation=wordlocation
- %{<a href="#{@md.fnl[:pre]}doc#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}\##{@wordlocation}">#{@wordlocation}</a>; }
+ %{<a href="doc#{Sfx[:epub_xhtml]}\##{@wordlocation}">#{@wordlocation}</a>; }
end
def location_seg(wordlocation,show)
@wordlocation,@show=wordlocation,show
- @word_location_seg=wordlocation.gsub(/(.+?)\#(\d+)/,"#{@md.fnl[:pre]}\\1#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}#o\\2") unless wordlocation.nil?
+ @word_location_seg=wordlocation.gsub(/(.+?)\#(\d+)/,"\\1#{Sfx[:epub_xhtml]}#o\\2") unless wordlocation.nil?
case @wordlocation
when @rxp_t1
- %{[<a href="#{@md.fnl[:pre]}doc#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}##{@show}">H</a>]#{@show}, }
+ %{[<a href="doc#{Sfx[:epub_xhtml]}##{@show}">H</a>]#{@show}, }
when @rxp_t2
- %{[<a href="#{@md.fnl[:pre]}doc#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}##{@show}">H</a>]#{@show}, }
+ %{[<a href="doc#{Sfx[:epub_xhtml]}##{@show}">H</a>]#{@show}, }
when @rxp_t3
- %{[<a href="#{@md.fnl[:pre]}doc#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}##{@show}">H</a>]#{@show}, }
+ %{[<a href="doc#{Sfx[:epub_xhtml]}##{@show}">H</a>]#{@show}, }
else %{<a href="#{@word_location_seg}">#{@show}</a>, }
end
end
@@ -205,54 +213,57 @@ WOK
@word_map={}
@dal_array.each do |line|
if defined? line.ocn
- if line.is =~/heading/ and line.ln==4; @seg=line.name
+ if (line.is ==:heading \
+ || line.is ==:heading_insert) \
+ && line.ln==4
+ @seg=line.name
end
- if line.ocn.to_s =~/\d+/; toy=line.ocn.to_s
+ if line.ocn.to_s =~/\d+/ then toy=line.ocn.to_s
end
if toy =~/\d+/ \
and toy !~/^0$/
line.obj=line.obj.split(@rgx_splitlist).join(' ') #%take in word or other match
for word in line.obj.scan(@rgx_scanlist) #%take in word or other match
- word.gsub!(/#{Mx[:lnk_o]}|#{Mx[:lnk_c]}|#{Mx[:url_o]}|#{Mx[:url_c]}/,'')
- word.gsub!(/#{Mx[:fa_o]}\S+?#{Mx[:fa_o_c]}/,'')
- word.gsub!(/#{Mx[:fa_c_o]}\S+?#{Mx[:fa_c]}/,'')
- word.gsub!(/#{Mx[:gl_o]}#[a-z]+#{Mx[:gl_c]}/,'')
- word.gsub!(/#{Mx[:gl_o]}#[0-9]+#{Mx[:gl_c]}/,'')
- word.gsub!(/^\S$/,'')
+ word=word.gsub(/#{Mx[:lnk_o]}|#{Mx[:lnk_c]}|#{Mx[:url_o]}|#{Mx[:url_c]}/,'').
+ gsub(/#{Mx[:fa_o]}\S+?#{Mx[:fa_o_c]}/,'').
+ gsub(/#{Mx[:fa_c_o]}\S+?#{Mx[:fa_c]}/,'').
+ gsub(/#{Mx[:gl_o]}#[a-z]+#{Mx[:gl_c]}/,'').
+ gsub(/#{Mx[:gl_o]}#[0-9]+#{Mx[:gl_c]}/,'').
+ gsub(/^\S$/,'')
word=nil if word.empty?
word=nil if word =~@rxp_excluded0 #watch
word=nil if word =~@rxp_excluded1 #watch
word=nil if word =~/^\S$/
if word
- word.gsub!(/#{Mx[:br_nl]}|#{Mx[:br_line]}/,' ')
- word.gsub!(/#{Mx[:fa_o]}[a-z]{1,7}#{Mx[:fa_o_c]}|#{Mx[:fa_c_o]}[a-z]{1,7}#{Mx[:fa_c]}/,'')
- word.gsub!(/#{Mx[:mk_o]}(?:[0-9a-f]{32}:[0-9a-f]{32}|[0-9a-f]{64}:[0-9a-f]{64})#{Mx[:mk_c]}/,'')
- word.gsub!(/#{Mx[:mk_o]}(?:[0-9a-f]{32}|[0-9a-f]{64})#{Mx[:mk_c]}/,'')
- word.gsub!(/#{Mx[:en_a_o]}(?:\d|[*+])*|#{Mx[:en_b_o]}(?:\d|[*+])*|#{Mx[:en_a_c]}|#{Mx[:en_b_c]}/mi,'')
- word.gsub!(/#{Mx[:fa_o]}\S+?#{Mx[:fa_o_c]}/,''); word.gsub!(/#{Mx[:fa_c_o]}\S+?#{Mx[:fa_c]}/,'')
- word.gsub!(/<\/?\S+?>/,'')
- word.gsub!(/^\@+/,'')
- word.strip!
- word.gsub!(/#{Mx[:tc_p]}.+/,'')
- word.gsub!(/[\.,;:"]$/,'')
- word.gsub!(/["]/,'')
- word.gsub!(/^\s*[\(]/,'')
- word.gsub!(/[\(]\s*$/,'')
- word.gsub!(/^(?:See|e\.?g\.?).+/,'')
- word.gsub!(/^\s*[.,;:]\s*/,'')
- word.strip!
- word.gsub!(/^\(?[a-zA-Z]\)$/,'')
- word.gsub!(/^\d+(st|nd|rd|th)$/,'')
- word.gsub!(/^(\d+\.?)+$/, '')
- word.gsub!(/#{Mx[:mk_o]}|#{Mx[:mk_c]}/,'')
- word.gsub!(/:name#\S+/,'')
- word.gsub!(/^\S$/,'')
+ word=word.gsub(/#{Mx[:br_nl]}|#{Mx[:br_line]}/,' ').
+ gsub(/#{Mx[:fa_o]}[a-z]{1,7}#{Mx[:fa_o_c]}|#{Mx[:fa_c_o]}[a-z]{1,7}#{Mx[:fa_c]}/,'').
+ gsub(/#{Mx[:mk_o]}(?:[0-9a-f]{32}:[0-9a-f]{32}|[0-9a-f]{64}:[0-9a-f]{64})#{Mx[:mk_c]}/,'').
+ gsub(/#{Mx[:mk_o]}(?:[0-9a-f]{32}|[0-9a-f]{64})#{Mx[:mk_c]}/,'').
+ gsub(/#{Mx[:en_a_o]}(?:\d|[*+])*|#{Mx[:en_b_o]}(?:\d|[*+])*|#{Mx[:en_a_c]}|#{Mx[:en_b_c]}/mi,'').
+ gsub(/#{Mx[:fa_o]}\S+?#{Mx[:fa_o_c]}/,'').gsub(/#{Mx[:fa_c_o]}\S+?#{Mx[:fa_c]}/,'').
+ gsub(/<\/?\S+?>/,'').
+ gsub(/^\@+/,'').
+ strip.
+ gsub(/#{Mx[:tc_p]}.+/,'').
+ gsub(/[\.,;:"]$/,'').
+ gsub(/["]/,'').
+ gsub(/^\s*[\(]/,'').
+ gsub(/[\(]\s*$/,'').
+ gsub(/^(?:See|e\.?g\.?).+/,'').
+ gsub(/^\s*[.,;:]\s*/,'').
+ strip.
+ gsub(/^\(?[a-zA-Z]\)$/,'').
+ gsub(/^\d+(st|nd|rd|th)$/,'').
+ gsub(/^(\d+\.?)+$/, '').
+ gsub(/#{Mx[:mk_o]}|#{Mx[:mk_c]}/,'').
+ gsub(/:name#\S+/,'').
+ gsub(/^\S$/,'')
word=nil if word =~/^\S$/
word=nil if word =~/^\s*$/ #watch
if word
unless word =~/[A-Z][A-Z]/ \
or word =~/\w+\s\w+/
- word.capitalize!
+ word=word.capitalize
end
@freq[word] +=1
@word_map[word] ||= []
@@ -275,7 +286,7 @@ WOK
end
scr='<font size="1" color="#777777" face=times new roman><img border="0" height="15" width="15" src="../_sisu/image/b_doc.png" alt="Full Text">&nbsp;scroll:&nbsp;</font><font size="1" color="#222222" face=times new roman>doc#&nbsp;</font> '
seg=''
- @file_concordance << SiSU_EPUB_Concordance::Source::Doc_title.new(@particulars).create
+ @file_concordance << SiSU_EPUB_Concordance::Source::DocTitle.new(@particulars).create
alph=%W[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z]
@file_concordance << '<p>'
alph.each {|x| @file_concordance << %{<a href="##{x}">#{x}</a>,&nbsp;}}
diff --git a/lib/sisu/v2/epub_format.rb b/lib/sisu/v4/epub_format.rb
index 5b452f83..98fc385d 100644
--- a/lib/sisu/v2/epub_format.rb
+++ b/lib/sisu/v4/epub_format.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -58,31 +57,27 @@
=end
module SiSU_EPUB_Format
include SiSU_Viz
- class Paragraph_number
+ class ParagraphNumber
def initialize(md,ocn)
@md,@ocn=md,ocn.to_s
@ocn ||=''
- vz=SiSU_Env::Get_init.instance.skin
- @skin_no_ocn=if defined? vz.ocn_display_off \
- and vz.ocn_display_off==true
- true
- else false
- end
+ vz=SiSU_Viz::Defaults.new
end
def ocn_display
- if @md.markup.inspect =~/no_ocn/ \
- or @md.mod.inspect =~/--no-ocn/ \
- or @skin_no_ocn
- ocn_class='ocn_off'
- @ocn.gsub(/^(\d+|)$/,
- %{<label class="#{ocn_class}">&nbsp;</label>})
- elsif @ocn.to_i==0
- @ocn.gsub(/^(\d+|)$/,
- %{<label class="#{ocn_class}">&nbsp;</label>})
- else
+ @make=SiSU_Env::ProcessingSettings.new(@md)
+ if @make.build.ocn?
ocn_class='ocn'
+ if @ocn.to_i==0
+ @ocn.gsub(/^(\d+|)$/,
+ %{<label class="#{ocn_class}">&nbsp;</label>})
+ else
+ @ocn.gsub(/^(\d+|)$/,
+ %{<label class="#{ocn_class}"><a href="#o\\1" class="lnk#{ocn_class}">\\1</a></label>})
+ end
+ else
+ ocn_class='ocn_off'
@ocn.gsub(/^(\d+|)$/,
- %{<label class="#{ocn_class}"><a href="#o\\1" class="lnk#{ocn_class}">\\1</a></label>})
+ %{<label class="#{ocn_class}">&nbsp;</label>})
end
end
def name
@@ -95,7 +90,7 @@ module SiSU_EPUB_Format
%{<a href="##{@ocn}">}
end
end
- class Css
+ class CSS
def css_epub_xhtml
<<WOK
/* SiSU epub css default stylesheet */
@@ -155,12 +150,13 @@ module SiSU_EPUB_Format
margin-right: 1%;
}
- .norm, .bold, .verse, .group, .alt {
+ .norm, .bold, .verse, .group, .block, .alt {
line-height: 150%;
margin-left: 0em;
margin-right: 2em;
margin-top: 10px;
margin-bottom: 0px;
+ padding-left: 0em;
text-indent: 0mm;
}
p, h0, h1, h2, h3, h4, h5, h6 {
@@ -177,15 +173,425 @@ module SiSU_EPUB_Format
margin-bottom: 3px;
}
p.norm { }
- p.i1 {margin-left: 1em;}
- p.i2 {margin-left: 2em;}
- p.i3 {margin-left: 3em;}
- p.i4 {margin-left: 4em;}
- p.i5 {margin-left: 5em;}
- p.i6 {margin-left: 6em;}
- p.i7 {margin-left: 7em;}
- p.i8 {margin-left: 8em;}
- p.i9 {margin-left: 9em;}
+ p.i1 {padding-left: 1em;}
+ p.i2 {padding-left: 2em;}
+ p.i3 {padding-left: 3em;}
+ p.i4 {padding-left: 4em;}
+ p.i5 {padding-left: 5em;}
+ p.i6 {padding-left: 6em;}
+ p.i7 {padding-left: 7em;}
+ p.i8 {padding-left: 8em;}
+ p.i9 {padding-left: 9em;}
+
+ p.h0i0 {
+ padding-left: 0em;
+ text-indent: 0em;
+ }
+ p.h0i1 {
+ padding-left: 1em;
+ text-indent: -1em;
+ }
+ p.h0i2 {
+ padding-left: 2em;
+ text-indent: -2em;
+ }
+ p.h0i3 {
+ padding-left: 3em;
+ text-indent: -3em;
+ }
+ p.h0i4 {
+ padding-left: 4em;
+ text-indent: -4em;
+ }
+ p.h0i5 {
+ padding-left: 5em;
+ text-indent: -5em;
+ }
+ p.h0i6 {
+ padding-left: 6em;
+ text-indent: -6em;
+ }
+ p.h0i7 {
+ padding-left: 7em;
+ text-indent: -7em;
+ }
+ p.h0i8 {
+ padding-left: 8em;
+ text-indent: -8em;
+ }
+ p.h0i9 {
+ padding-left: 9em;
+ text-indent: -9em;
+ }
+
+ p.h1i0 {
+ padding-left: 0em;
+ text-indent: 1em;
+ }
+ p.h1i1 {
+ padding-left: 1em;
+ text-indent: 0em;
+ }
+ p.h1i2 {
+ padding-left: 2em;
+ text-indent: -1em;
+ }
+ p.h1i3 {
+ padding-left: 3em;
+ text-indent: -2em;
+ }
+ p.h1i4 {
+ padding-left: 4em;
+ text-indent: -3em;
+ }
+ p.h1i5 {
+ padding-left: 5em;
+ text-indent: -4em;
+ }
+ p.h1i6 {
+ padding-left: 6em;
+ text-indent: -5em;
+ }
+ p.h1i7 {
+ padding-left: 7em;
+ text-indent: -6em;
+ }
+ p.h1i8 {
+ padding-left: 8em;
+ text-indent: -7em;
+ }
+ p.h1i9 {
+ padding-left: 9em;
+ text-indent: -8em;
+ }
+
+ p.h2i0 {
+ padding-left: 0em;
+ text-indent: 2em;
+ }
+ p.h2i1 {
+ padding-left: 1em;
+ text-indent: 1em;
+ }
+ p.h2i2 {
+ padding-left: 2em;
+ text-indent: 0em;
+ }
+ p.h2i3 {
+ padding-left: 3em;
+ text-indent: -1em;
+ }
+ p.h2i4 {
+ padding-left: 4em;
+ text-indent: -2em;
+ }
+ p.h2i5 {
+ padding-left: 5em;
+ text-indent: -3em;
+ }
+ p.h2i6 {
+ padding-left: 6em;
+ text-indent: -4em;
+ }
+ p.h2i7 {
+ padding-left: 7em;
+ text-indent: -5em;
+ }
+ p.h2i8 {
+ padding-left: 8em;
+ text-indent: -6em;
+ }
+ p.h2i9 {
+ padding-left: 9em;
+ text-indent: -7em;
+ }
+
+ p.h3i0 {
+ padding-left: 0em;
+ text-indent: 3em;
+ }
+ p.h3i1 {
+ padding-left: 1em;
+ text-indent: 2em;
+ }
+ p.h3i2 {
+ padding-left: 2em;
+ text-indent: 1em;
+ }
+ p.h3i3 {
+ padding-left: 3em;
+ text-indent: 0em;
+ }
+ p.h3i4 {
+ padding-left: 4em;
+ text-indent: -1em;
+ }
+ p.h3i5 {
+ padding-left: 5em;
+ text-indent: -2em;
+ }
+ p.h3i6 {
+ padding-left: 6em;
+ text-indent: -3em;
+ }
+ p.h3i7 {
+ padding-left: 7em;
+ text-indent: -4em;
+ }
+ p.h3i8 {
+ padding-left: 8em;
+ text-indent: -5em;
+ }
+ p.h3i9 {
+ padding-left: 9em;
+ text-indent: -6em;
+ }
+
+ p.h4i0 {
+ padding-left: 0em;
+ text-indent: 4em;
+ }
+ p.h4i1 {
+ padding-left: 1em;
+ text-indent: 3em;
+ }
+ p.h4i2 {
+ padding-left: 2em;
+ text-indent: 2em;
+ }
+ p.h4i3 {
+ padding-left: 3em;
+ text-indent: 1em;
+ }
+ p.h4i4 {
+ padding-left: 4em;
+ text-indent: 0em;
+ }
+ p.h4i5 {
+ padding-left: 5em;
+ text-indent: -1em;
+ }
+ p.h4i6 {
+ padding-left: 6em;
+ text-indent: -2em;
+ }
+ p.h4i7 {
+ padding-left: 7em;
+ text-indent: -3em;
+ }
+ p.h4i8 {
+ padding-left: 8em;
+ text-indent: -4em;
+ }
+ p.h4i9 {
+ padding-left: 9em;
+ text-indent: -5em;
+ }
+
+ p.h5i0 {
+ padding-left: 0em;
+ text-indent: 5em;
+ }
+ p.h5i1 {
+ padding-left: 1em;
+ text-indent: 4em;
+ }
+ p.h5i2 {
+ padding-left: 2em;
+ text-indent: 3em;
+ }
+ p.h5i3 {
+ padding-left: 3em;
+ text-indent: 2em;
+ }
+ p.h5i4 {
+ padding-left: 4em;
+ text-indent: 1em;
+ }
+ p.h5i5 {
+ padding-left: 5em;
+ text-indent: 0em;
+ }
+ p.h5i6 {
+ padding-left: 6em;
+ text-indent: -1em;
+ }
+ p.h5i7 {
+ padding-left: 7em;
+ text-indent: -2em;
+ }
+ p.h5i8 {
+ padding-left: 8em;
+ text-indent: -3em;
+ }
+ p.h5i9 {
+ padding-left: 9em;
+ text-indent: -4em;
+ }
+
+ p.h6i0 {
+ padding-left: 0em;
+ text-indent: 6em;
+ }
+ p.h6i1 {
+ padding-left: 1em;
+ text-indent: 5em;
+ }
+ p.h6i2 {
+ padding-left: 2em;
+ text-indent: 4em;
+ }
+ p.h6i3 {
+ padding-left: 3em;
+ text-indent: 3em;
+ }
+ p.h6i4 {
+ padding-left: 4em;
+ text-indent: 2em;
+ }
+ p.h6i5 {
+ padding-left: 5em;
+ text-indent: 1em;
+ }
+ p.h6i6 {
+ padding-left: 6em;
+ text-indent: 0em;
+ }
+ p.h6i7 {
+ padding-left: 7em;
+ text-indent: -1em;
+ }
+ p.h6i8 {
+ padding-left: 8em;
+ text-indent: -2em;
+ }
+ p.h6i9 {
+ padding-left: 9em;
+ text-indent: -3em;
+ }
+
+ p.h7i0 {
+ padding-left: 0em;
+ text-indent: 7em;
+ }
+ p.h7i1 {
+ padding-left: 1em;
+ text-indent: 6em;
+ }
+ p.h7i2 {
+ padding-left: 2em;
+ text-indent: 5em;
+ }
+ p.h7i3 {
+ padding-left: 3em;
+ text-indent: 4em;
+ }
+ p.h7i4 {
+ padding-left: 4em;
+ text-indent: 3em;
+ }
+ p.h7i5 {
+ padding-left: 5em;
+ text-indent: 2em;
+ }
+ p.h7i6 {
+ padding-left: 6em;
+ text-indent: 1em;
+ }
+ p.h7i7 {
+ padding-left: 7em;
+ text-indent: 0em;
+ }
+ p.h7i8 {
+ padding-left: 8em;
+ text-indent: -1em;
+ }
+ p.h7i9 {
+ padding-left: 9em;
+ text-indent: -2em;
+ }
+
+ p.h8i0 {
+ padding-left: 0em;
+ text-indent: 8em;
+ }
+ p.h8i1 {
+ padding-left: 1em;
+ text-indent: 7em;
+ }
+ p.h8i2 {
+ padding-left: 2em;
+ text-indent: 6em;
+ }
+ p.h8i3 {
+ padding-left: 3em;
+ text-indent: 5em;
+ }
+ p.h8i4 {
+ padding-left: 4em;
+ text-indent: 4em;
+ }
+ p.h8i5 {
+ padding-left: 5em;
+ text-indent: 3em;
+ }
+ p.h8i6 {
+ padding-left: 6em;
+ text-indent: 2em;
+ }
+ p.h8i7 {
+ padding-left: 7em;
+ text-indent: 1em;
+ }
+ p.h8i8 {
+ padding-left: 8em;
+ text-indent: 0em;
+ }
+ p.h8i9 {
+ padding-left: 9em;
+ text-indent: -1em;
+ }
+
+ p.h9i0 {
+ padding-left: 0em;
+ text-indent: 9em;
+ }
+ p.h9i1 {
+ padding-left: 1em;
+ text-indent: 8em;
+ }
+ p.h9i2 {
+ padding-left: 2em;
+ text-indent: 7em;
+ }
+ p.h9i3 {
+ padding-left: 3em;
+ text-indent: 6em;
+ }
+ p.h9i4 {
+ padding-left: 4em;
+ text-indent: 5em;
+ }
+ p.h9i5 {
+ padding-left: 5em;
+ text-indent: 4em;
+ }
+ p.h9i6 {
+ padding-left: 6em;
+ text-indent: 3em;
+ }
+ p.h9i7 {
+ padding-left: 7em;
+ text-indent: 2em;
+ }
+ p.h9i8 {
+ padding-left: 8em;
+ text-indent: 1em;
+ }
+ p.h9i9 {
+ padding-left: 9em;
+ text-indent: 0em;
+ }
p.it0 {
margin-left: 0em;
@@ -250,6 +656,8 @@ module SiSU_EPUB_Format
p.group { }
+ p.block { }
+
p.alt { }
p.verse {
@@ -260,6 +668,7 @@ module SiSU_EPUB_Format
font-family: inconsolata, andale mono, courier new, courier, monospace;
font-size: 90%;
text-align: left;
+ background-color: #eeeeee;
}
p.caption {
@@ -784,36 +1193,6 @@ module SiSU_EPUB_Format
background-color: #f9f9aa;
}
- .minitoc {
- font-weight: normal;
- margin-top: 2px;
- margin-bottom: 2px;
- }
- h1.minitoc, h2.minitoc, h3.minitoc {
- margin-left: 0em;
- font-weight: bold;
- text-align: left;
- font-size: 90%;
- margin-top: 4px;
- margin-bottom: 4px;
- }
- h4.minitoc {
- margin-left: 0em;
- font-size: 90%;
- }
- h5.minitoc {
- margin-left: 1em;
- font-size: 85%;
- }
- h6.minitoc {
- margin-left: 2em;
- font-size: 85%;
- }
- h0.minitoc {
- margin-left: 0em;
- font-size: 90%;
- }
-
h1.c, h2.c, h3.c, h4.c, h5.c, h6.c, p.c {
text-align: center
}
@@ -838,14 +1217,14 @@ module SiSU_EPUB_Format
WOK
end
end
- class Head_information
+ class HeadInformation
include SiSU_Viz
attr_reader :md,:rdf,:vz
def initialize(md)
@md=md
# DublinCore 1 - title
- @vz=SiSU_Env::Get_init.instance.skin
- @css=SiSU_Env::CSS_stylesheet.new(md)
+ @vz=SiSU_Viz::Defaults.new
+ @css=SiSU_Env::CSS_Stylesheet.new(md)
@seg_name_xhtml=(SiSU_EPUB::Source::Seg.new.seg_name_xhtml || [])
@seg_name_xhtml_tracker=(SiSU_EPUB::Source::Seg.new.seg_name_xhtml_tracker || [])
@index='index'
@@ -854,7 +1233,7 @@ WOK
end
def doc_type_xhtml
<<WOK
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
@@ -896,16 +1275,44 @@ WOK
end
def metainf_container #container.xml file in META-INF directory
#simple, make sure full-path of rootfile points to metadata.opf
- #epub_metadata.opf epb.opf
+ #epub_metadata.opf content.opf
<<WOK
-<?xml version="1.0" encoding="UTF-8"?>
-<container xmlns="urn:oasis:names:tc:opendocument:xmlns:container" version="1.0">
+<?xml version='1.0' encoding='utf-8'?>
+<container version="1.0"
+ xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
<rootfiles>
- <rootfile full-path="OPS/epb.opf" media-type="application/oebps-package+xml"/>
+ <rootfile full-path="#{Ep[:d_oebps]}/#{Ep[:f_opf]}"
+ media-type="application/oebps-package+xml" />
</rootfiles>
</container>
WOK
end
+ def sections(dob,name)
+ filename="#{name}#{Sfx[:epub_xhtml]}"
+ dir_epub_cont="#{@md.env.processing_path.epub}/#{Ep[:d_oebps]}"
+ segfilename="#{dir_epub_cont}/#{filename}"
+ output_epub_cont_seg=File.new(segfilename,'w')
+ output_epub_cont_seg << %{#{doc_type}
+<head>
+ <title>
+ #{dob.obj} -
+ #{@md.html_title}
+ </title>
+<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
+#{@css.xhtml_epub}
+</head>
+#{@vz.color_body}
+<div class="content">
+<div class="substance">
+ <label class="ocn"><a href="#o8" class="lnkocn">8</a></label>
+ <h1 class="norm" id="o8">
+ #{dob.obj}
+ </h1>
+</div>
+</body>
+</html>}
+output_epub_cont_seg.close
+ end
def toc_ncx #list of navigation points (like chapters), table of contents, listing each navigation point (chapters and such) under the navigation map
def structure
open
@@ -921,6 +1328,9 @@ WOK
end
def open
<<WOK
+<?xml version="1.0"?>
+<!DOCTYPE ncx PUBLIC "-//NISO//DTD ncx 2005-1//EN"
+ "http://www.daisy.org/z3986/2005/ncx-2005-1.dtd">
<ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1">
WOK
end
@@ -935,15 +1345,17 @@ WOK
WOK
end
def head
- depth=@md.lvs[2] + @md.lvs[3] + @md.lvs[4]
+ depth=@md.lvs[1] + @md.lvs[2] + @md.lvs[3] + @md.lvs[4]
<<WOK
<!-- four required metadata items (for all NCX documents,
(including the relaxed constraints of OPS 2.0) -->
- <meta name="dtb:uid" content="#{@md.dgst[1]}"/>
- <!-- <meta name="epub-creator" content="#{@md.publisher}"/> -->
- <meta name="dtb:depth" content="#{depth}"/>
- <meta name="dtb:totalPageCount" content="0"/>
- <meta name="dtb:maxPageNumber" content="0"/>
+ <title>#{@md.title.full} by #{@md.author}</title>
+ <link href="css/xhtml.css" rel="stylesheet" type="text/css" id="main-css" />
+ <meta name="dtb:uid" content="urn:uuid:#{@md.dgst[1]}" />
+ <!-- <meta name="epub-creator" content="#{@md.publisher}" /> -->
+ <meta name="dtb:depth" content="#{depth}" />
+ <meta name="dtb:totalPageCount" content="0" />
+ <meta name="dtb:maxPageNumber" content="0" />
WOK
end
def head_close
@@ -971,31 +1383,29 @@ WOK
WOK
end
def navmap_sisu_toc(no)
+ id_u=DISABLE[:epub][:ncx_navpoint_unique_id] \
+ ? ''
+ : "-#{no}"
<<WOK
- <navPoint id="navpoint-#{no}" playOrder="#{no}">
+ <navPoint id="navpoint#{id_u}" playOrder="#{no}">
<navLabel>
<text>Table of Contents</text>
</navLabel>
- <content src="index#{Sfx[:epub_xhtml]}"/>
+ <content src="index#{Sfx[:epub_xhtml]}" />
</navPoint>
WOK
end
- def navpoint(dob,no)
- <<WOK
- <navPoint id="navpoint-#{no}" playOrder="#{no}">
- <navLabel>
- <text>#{dob.obj}</text>
- </navLabel>
- <content src="#{dob.name}#{Sfx[:epub_xhtml]}"/>
-WOK
- end
- def navpoint_top3(dob,no,name)
+ def navpoint(dob,no,name=nil)
+ name=name ? name : dob.name
+ id_u=DISABLE[:epub][:ncx_navpoint_unique_id] \
+ ? ''
+ : "-#{no}"
<<WOK
- <navPoint id="navpoint-#{no}" playOrder="#{no}">
+ <navPoint id="navpoint#{id_u}" playOrder="#{no}">
<navLabel>
<text>#{dob.obj}</text>
</navLabel>
- <content src="#{name}#{Sfx[:epub_xhtml]}"/>
+ <content src="#{name}#{Sfx[:epub_xhtml]}" />
WOK
end
def navpoint_close
@@ -1019,11 +1429,13 @@ WOK
manifest_close
spine_open
spine_close
+ guide_open
+ guide_close
package_close
end
def package_open
<<WOK
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version='1.0' encoding='utf-8'?>
<package xmlns="http://www.idpf.org/2007/opf" unique-identifier="EPB-UUID" version="2.0">
WOK
end
@@ -1033,18 +1445,120 @@ WOK
WOK
end
def metadata #metadata dc
+ cover_image=if defined? @md.make.cover_image \
+ and @md.make.cover_image.is_a?(Hash) \
+ and @md.make.cover_image[:cover] =~/\S+/
+ %{\n <meta name="cover" content="cover_image" />}
+ else ''
+ end
author=if defined? @md.creator.author \
and @md.creator.author =~/\S+/
- x=@md.creator.author.gsub!(/</,'&lt;'); @md.creator.author.gsub!(/>/,'&gt;')
- @md.creator.author.gsub!(/&lt;br(?: \/)?&gt;/,'<br />')
- %{\n <dc:creator opf:file-as="#{x}" opf:role="aut">#{x}</dc:creator>}
+ m=''
+ @md.creator.author_detail.each do |x|
+ surname=x[:the] \
+ ? x[:the]
+ : ''
+ other_names=x[:others] \
+ ? ', ' + x[:others]
+ : ''
+ m=(m.empty?) \
+ ? (surname + other_names)
+ : (m + '; ' + surname + ', ' + other_names)
+ m=m.gsub(/</,'&lt;').gsub(/>/,'&gt;').
+ gsub(/&lt;br(?: \/)?&gt;/,';')
+ end
+ x=@md.creator.author.dup
+ x=x.gsub(/</,'&lt;').gsub(/>/,'&gt;').
+ gsub(/&lt;br(?: \/)?&gt;/,'<br />')
+ %{\n <dc:creator opf:file-as="#{m}" opf:role="aut">#{x}</dc:creator>}
+ else ''
+ end
+ editor=if defined? @md.creator.editor \
+ and @md.creator.editor =~/\S+/
+ m=''
+ @md.creator.editor_detail.each do |x|
+ surname=x[:the] \
+ ? x[:the]
+ : ''
+ other_names=x[:others] \
+ ? ', ' + x[:others]
+ : ''
+ m=(m.empty?) \
+ ? (surname + other_names)
+ : (m + '; ' + surname + ', ' + other_names)
+ m=m.gsub(/</,'&lt;').gsub(/>/,'&gt;').
+ gsub(/&lt;br(?: \/)?&gt;/,';')
+ end
+ x=@md.creator.editor.dup
+ x=x.gsub(/</,'&lt;').gsub(/>/,'&gt;').
+ gsub(/&lt;br(?: \/)?&gt;/,'<br />')
+ %{\n <dc:creator opf:file-as="#{m}" opf:role="edt">#{x}</dc:creator>}
+ else ''
+ end
+ translator=if defined? @md.creator.translator \
+ and @md.creator.translator =~/\S+/
+ m=''
+ @md.creator.translator_detail.each do |x|
+ surname=x[:the] \
+ ? x[:the]
+ : ''
+ other_names=x[:others] \
+ ? ', ' + x[:others]
+ : ''
+ m=(m.empty?) \
+ ? (surname + other_names)
+ : (m + '; ' + surname + ', ' + other_names)
+ m=m.gsub(/</,'&lt;').gsub(/>/,'&gt;').
+ gsub(/&lt;br(?: \/)?&gt;/,';')
+ end
+ x=@md.creator.translator.dup
+ x=x.gsub(/</,'&lt;').gsub(/>/,'&gt;').
+ gsub(/&lt;br(?: \/)?&gt;/,'<br />')
+ %{\n <dc:creator opf:file-as="#{m}" opf:role="trl">#{x}</dc:creator>}
else ''
end
illustrator=if defined? @md.creator.illustrator \
and @md.creator.illustrator =~/\S+/
- x=@md.creator.illustrator.gsub!(/</,'&lt;'); @md.creator.illustrator.gsub!(/>/,'&gt;')
- @md.creator.illustrator.gsub!(/&lt;br(?: \/)?&gt;/,'<br />')
- %{\n <dc:creator opf:file-as="#{x}" opf:role="ill">#{x}</dc:creator>}
+ m=''
+ @md.creator.illustrator_detail.each do |x|
+ surname=x[:the] \
+ ? x[:the]
+ : ''
+ other_names=x[:others] \
+ ? ', ' + x[:others]
+ : ''
+ m=(m.empty?) \
+ ? (surname + other_names)
+ : (m + '; ' + surname + ', ' + other_names)
+ m=m.gsub(/</,'&lt;').gsub(/>/,'&gt;').
+ gsub(/&lt;br(?: \/)?&gt;/,';')
+ end
+ x=@md.creator.illustrator.dup
+ x=x.gsub(/</,'&lt;').gsub(/>/,'&gt;').
+ gsub(/&lt;br(?: \/)?&gt;/,'<br />')
+ %{\n <dc:creator opf:file-as="#{m}" opf:role="ill">#{x}</dc:creator>}
+ else ''
+ end
+ date_published=if defined? @md.date.published \
+ and @md.date.published =~/\S+/
+ x=@md.date.published.dup
+ x=x.gsub(/</,'&lt;').gsub(/>/,'&gt;').
+ gsub(/&lt;br(?: \/)?&gt;/,'<br />')
+ %{\n <dc:date opf:event="published">#{x}</dc:date>}
+ else ''
+ end
+ subject=if defined? @md.classify.subject \
+ and @md.classify.subject =~/\S+/
+ x=@md.classify.subject.dup
+ x=x.gsub(/</,'&lt;').gsub(/>/,'&gt;').
+ gsub(/&lt;br(?: \/)?&gt;/,'<br />')
+ %{\n <dc:subject>#{x}</dc:subject>}
+ else ''
+ end
+ language=if defined? @md.opt.lng \
+ and @md.opt.lng =~/\S+/
+ language=@md.opt.lng.gsub(/<br>/,'<br />')
+ %{\n <dc:language>#{language}</dc:language>}
else ''
end
rights=if defined? @md.rights.all \
@@ -1053,14 +1567,16 @@ WOK
%{\n <dc:rights>#{rights}</dc:rights>}
else ''
end
+ f=SiSU_Env::FileOp.new(@md)
<<WOK
- <metadata xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:opf="http://www.idpf.org/2007/opf">
+ <metadata xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:opf="http://www.idpf.org/2007/opf"
+ unique-identifier="urn:uuid:#{@md.dgst[1]}" version="2.0">
<dc:title>#{@md.title.full}</dc:title>
- #{author}#{illustrator}
- <dc:language>en-US</dc:language>
- <dc:identifier id="bookid">...</dc:identifier>
- #{rights}
- <dc:identifier id="EPB-UUID">urn:uuid:#{@md.dgst[1]}</dc:identifier>
+ #{cover_image}#{author}#{editor}#{translator}#{illustrator}#{language}#{date_published}#{subject}#{rights}
+ <dc:identifier opf:scheme="URI">#{f.output_path.epub.url}/#{f.base_filename.epub}</dc:identifier>
+ <dc:identifier id="bookid">urn:uuid:#{@md.dgst[1]}</dc:identifier>
+ <!-- <dc:identifier id="EPB-UUID">urn:uuid:#{@md.dgst[1]}</dc:identifier> -->
</metadata>
WOK
end
@@ -1068,29 +1584,41 @@ WOK
<<WOK
<manifest>
<!-- NCX -->
- <item id="ncx" href="epb.ncx" media-type="application/x-dtbncx+xml"/>
+ <item id="ncx" href="#{Ep[:f_ncx]}" media-type="application/x-dtbncx+xml" />
<!-- CSS Style Sheets -->
- <item id="main-css" href="css/xhtml.css" media-type="text/css"/>
+ <item id="main-css" href="css/xhtml.css" media-type="text/css" />
<!-- Content Documents -->
WOK
end
def manifest_content_sisu_toc
<<WOK
- <item id="index" href="index.xhtml" media-type="application/xhtml+xml"/>
+ <item id="index" href="index.xhtml" media-type="application/xhtml+xml" />
WOK
end
- def manifest_content(dob)
+ def manifest_cover_image_information(md)
+ cover_image=if defined? md.make.cover_image \
+ and @md.make.cover_image.is_a?(Hash) \
+ and md.make.cover_image[:cover] =~/\S+/
+ <<WOK
+ <item id="cover_image_file" href="cover_image#{Sfx[:epub_xhtml]}" media-type="application/xhtml+xml" />
+WOK
+ else ''
+ end
+ end
+ def manifest_content(dob,name=nil)
+ name=name ? name : dob.name
<<WOK
- <item id="#{dob.name}" href="#{dob.name}#{Sfx[:epub_xhtml]}" media-type="application/xhtml+xml"/>
+ <item id="#{name}" href="#{name}#{Sfx[:epub_xhtml]}" media-type="application/xhtml+xml" />
WOK
- end
+ end
def manifest_images(imgs)
imgs=imgs + ['arrow_next_red.png','arrow_prev_red.png','arrow_up_red.png','bullet_09.png']
images=[" <!-- Images -->\n"]
imgs.each do |i|
image,type=/(\S+?)\.(png|jpg|gif)/.match(i)[1,2]
+ type=type.sub(/jpg/,'jpeg')
images<<<<WOK
- <item id="#{image}" href="image/#{image}.#{type}" media-type="image/#{type}"/>
+ <item id="#{image}" href="image/#{image}.#{type}" media-type="image/#{type}" />
WOK
end
images=images.join('')
@@ -1102,19 +1630,25 @@ WOK
WOK
end
def spine_open
- #spine: reading order of HTML files from manifest, idref attribute refers back to id in manifest (exclude images, CSS etc.).
+ #spine: reading order of XHTML files from manifest, idref attribute refers back to id in manifest (exclude images, CSS etc.).
<<WOK
<spine toc="ncx">
WOK
end
+ def spine_cover_image
+ <<WOK
+ <itemref idref="cover_image_file" />
+WOK
+ end
def spine_sisu_toc
<<WOK
- <itemref idref="index" linear="yes"/>
+ <itemref idref="index" linear="yes" />
WOK
end
- def spine(dob)
+ def spine(dob,name=nil)
+ name=name ? name : dob.name
<<WOK
- <itemref idref="#{dob.name}" linear="yes"/>
+ <itemref idref="#{name}" linear="yes" />
WOK
end
def spine_close
@@ -1122,185 +1656,75 @@ WOK
</spine>
WOK
end
+ def guide_open
+ #guide: presentation order of XHTML files by reader).
+ <<WOK
+ <guide>
+WOK
+ end
+ def guide_cover_image
+ <<WOK
+ <reference type="cover" title="Cover of [book title]" href="cover_image#{Sfx[:epub_xhtml]}" />
+WOK
+ end
+ def guide_sisu_toc
+ <<WOK
+ <reference type="index" href="index#{Sfx[:epub_xhtml]}" />
+WOK
+ end
+ def guide(dob,name=nil)
+ name=name ? name : dob.name
+ <<WOK
+ <reference type="text" href="#{name}#{Sfx[:epub_xhtml]}" />
+WOK
+ end
+ def guide_close
+ <<WOK
+ </guide>
+WOK
+ end
self
end
- def toc_head_escript
- end
- def seg_head_escript
- end
def table_close
%{ </font>
#{@vz.table_close}}
end
- def buttons_home
- %{<!- home and index buttons -!>
- #{@vz.banner_home_and_index_buttons}
-<!- home and index buttons -!>}
- end
- def copyat
- %{<p class="tiny">copy @
- <a href="#{@vz.url_home}" #{@vz.js_home}>
- #{@vz.txt_home}
- </a></p>}
- end
def xhtml_close
%{#{@vz.credits_sisu_epub}
</body>
</html>}
end
end
- class Widget < Head_information
- def initialize(md)
- super(md)
- @md=md
- @cf_defaults=SiSU_Env::Info_processing_flag.new
- end
- def home
- %{<td align="center" bgcolor=#{@vz.color_band2}>
- <a href="../index.html" target="_top">
- #{@vz.png_homepage}</a>
-</td>
-}
- end
- def scroll(text)
- if @md.fns =~ /\.(?:-|ssm\.)?sst$/
- scroll=%{<td align="center" bgcolor=#{@vz.color_band2}>
- <a href="#{@md.fn[:doc]}" target="_top" #{@vz.js_doc}>
- #{text}
- </a>
-</td>
-}
- end
- end
- def seg(text)
- %{<td align="center" bgcolor="#99CC66">
- <a href="#{@md.fn[:toc]}" target="_top" #{@vz.js_doc}>
- #{text}
- </a>
-</td>
-}
- end
- def search
- env=SiSU_Env::Info_env.new(@md.fns,@md)
- env.widget.search_form('sisusearch',nil,nil,true)
- end
- def manifest
- %{<td align="center" bgcolor=#{@vz.color_band2}>
- <a href="#{@md.fn[:manifest]}" target="_top" #{@vz.js_manifest}>
- #{@vz.nav_txt_manifest}
- </a>
-</td>}
- end
- def pdf
- pdf=if @md.programs[:pdf] \
- and @cf_defaults.cf_0 =~/p/
- %{
-<td align="center" bgcolor=#{@vz.color_band2}>
- <a href="#{@md.fn[:pdf_p]}" target="_top" #{@vz.js_portrait}>
- #{@vz.nav_txt_pdf_portrait}
- </a>
-</td>
-<td align="center" bgcolor=#{@vz.color_band2}>
- <a href="#{@md.fn[:pdf_l]}" target="_top" #{@vz.js_landscape}>
- #{@vz.nav_txt_pdf_landscape}
- </a>
-</td>
-}
- else ''
- end
- end
- def odf
- odf=if @cf_defaults.cf_0 =~/o/
- %{
-<td align="center" bgcolor=#{@vz.color_band2}>
- <a href="#{@md.fn[:odf]}" target="_top" #{@vz.js_odf}>
- #{@vz.nav_txt_odf}
- </a>
-</td>}
- else ''
- end
- end
- def concordance(text)
- if @md.concord_make \
- and @md.wc_words < 300000 #max word count for display of concordance here as would now be a large file
- %{<td align="center" bgcolor=#{@vz.color_band2}>
- <a href="#{@md.fn[:concordance]}" target="_top" #{@vz.js_concordance}>
- #{text}
- </a>
- </td>}
- else ''
- end
- end
- end
- class XML
- end
- class Head_toc < Head_information
+ class HeadToc < HeadInformation
def initialize(md)
super(md)
@md=md
@tocband_segtoc=make_seg
end
- def concordance_navigation_band(type='')
- if type=~/pdf/
- @tocband_concordance=make_concordance
- end
- %{<p class="align_right">
- <a href="index.html" target="_top">
- #{@vz.epub_png_nav_toc}
- </a>
-</p>
-}
- end
- def seg_head_navigation_band
- firstseg=%{<a href="#{@md.fnl[:pre]}#{@md.firstseg}#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}" target="_top">
- #{@vz.epub_png_nav_nxt}
- </a>} if @md.firstseg =~/\S+/
- %{<p class="align_right">#{firstseg}</p>}
- end
- def seg_head_navigation_band_bottom
- firstseg=%{<a href="#{@md.fnl[:pre]}#{@md.firstseg}#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}" target="_top">
- #{@vz.epub_png_nav_nxt}
- </a>} if @md.firstseg =~/\S+/
- %{<p class="align_right">#{firstseg}</p>}
- end
- def manifest_link(text) #watch fix removed font size 2
- %{ <a href="#{@md.fn[:manifest]}" target="_top" #{@vz.js_manifest}>#{text}</a>}
+ def manifest_link(text)
+ %{ <a href="#{@md.file.output_path.manifest.url}/#{@md.file.base_filename.manifest}" target="_top">#{text}</a>}
end
- def concordance_link(text) #watch fix removed font size 2
+ def concordance_link(text)
if @md.concord_make
- %{<a href="#{@md.fn[:concordance]}" target="_top" #{@vz.js_concordance}>
+ %{<a href="#{@md.file.base_filename.html_concordance}" target="_top">
#{text}
</a>}
else ''
end
end
- def make_concordance
- manifest=scroll=seg=''
- wgt=Widget.new(@md)
- %{<table summary="toc scroll and segment with pdf" border="0" cellpadding="3" cellspacing="0">
-<tr>
- #{wgt.seg(@vz.nav_txt_toc_link)}#{wgt.scroll(@vz.nav_txt_doc_link)}#{wgt.pdf}#{wgt.odf}
-<td align="center" bgcolor=#{@vz.color_band2}>
- #{wgt.concordance(@vz.nav_txt_concordance)}
- #{wgt.manifest}
- #{wgt.search}
- #{wgt.home}
-</tr></table>}
- end
def head
%{#{doc_type}
<head>
-<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
+<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
#{@css.xhtml_epub}
</head>
-#{@vz.color_body}
-#{@vz.js_top}}
+#{@vz.color_body}}
end
def concordance
if @md.concord_make
%{#{@vz.margin_css}
<h4 class="toc">
- <a href="./#{@md.fn[:concordance]}" #{@vz.js_concordance}>
+ <a href="./#{@md.file.base_filename.html_concordance}">
<i>Concordance</i>
</a>
</h4>
@@ -1311,9 +1735,9 @@ WOK
end
end
def links_guide_open(type='horizontal')
- if type=='vertical'; links_guide_vertical_open
- else links_guide_horizontal_open
- end
+ (type=='vertical') \
+ ? links_guide_vertical_open
+ : links_guide_horizontal_open
end
def prefix_a
end
@@ -1358,18 +1782,14 @@ WOK
def metadata
%{#{@vz.margin_css}
<h4 class="toc">
- <a href="#{@metalink}" #{@vz.js_metalink}>
+ <a href="#{@metalink}">
<i>MetaData</i>
</a>
</h4>
#{@vz.table_close}}
end
- def seg_metadata
- @metalink=%{./#{@md.fn[:metadata]}}
- metadata
- end
end
- class Head_seg < Head_information
+ class HeadSeg < HeadInformation
def initialize(md)
super(md)
end
@@ -1380,229 +1800,18 @@ WOK
#{@seg_name_xhtml[@seg_name_xhtml_tracker]} -
#{@md.html_title}
</title>
-<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
-#{@vz.font_css_table_file}
+<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
+#{@css.xhtml_epub}
</head>
-#{@vz.color_body}
-#{@vz.js_top}}
- end
- def title_banner(title,subtitle,creator)
- end
- def dot_control_pre_next
- %{<table summary="segment hidden control pre and next" width="100%" border="0" cellpadding="0" bgcolor=#{@vz.color_grey_pale} align="center">
-<tr><td align="left">
- <a href="#{@md.fnl[:pre]}#{@seg_name_xhtml[@seg_name_xhtml_tracker-1]}#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}" target="_top" #{@vz.js_prev}>
- #{@vz.png_nav_dot_pre}
- </a>
-</td>
-<td align="center">
- <a href="#{@md.fnl[:pre]}#{@index}#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}" target="_top" #{@vz.js_toc}>
- #{@vz.png_nav_dot_toc}
- </a>
-</td>
-<td align="right">
- <a href="#{@md.fnl[:pre]}#{@seg_name_xhtml[@seg_name_xhtml_tracker+1]}#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}" target="_top" #{@vz.js_next}>
- #{@vz.png_nav_dot_nxt}
- </a>
-#{@vz.table_close}}
- end
- def dot_control_pre
- %{<table summary="segment hidden control pre" width="100%" border="0" cellpadding="0" bgcolor=#{@vz.color_grey_pale} align="center">
-<tr><td align="left">
- <a href="#{@md.fnl[:pre]}#{@seg_name_xhtml[@seg_name_xhtml_tracker-1]}#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}" target="_top" #{@vz.js_prev}>
- #{@vz.png_nav_dot_pre}
- </a>
-</td>
-<td align="center">
- <a href="#{@md.fnl[:pre]}#{@index}#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}" target="_top" #{@vz.js_toc}>
- #{@vz.png_nav_dot_toc}
- </a>
-</td>
-<td align="right">
- <a href="#{@md.fn[:toc]}" target="_top" #{@vz.js_next}>
- #{@vz.png_nav_dot_nxt}
- </a>
-#{@vz.table_close}}
- end
- def toc_nav(f_pre=false,f_nxt=false,use=1)
- pre=nxt=''
- toc=%{<a href="#{@md.fnl[:pre]}#{@index}#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}" target="_top" #{@vz.js_toc}>
- #{@vz.epub_png_nav_toc}
-</a>
-}
- pre=%{<a href="#{@md.fnl[:pre]}#{@seg_name_xhtml[@seg_name_xhtml_tracker-use]}#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}" target="_top" #{@vz.js_prev}>
- #{@vz.epub_png_nav_pre}
-</a>
-} if f_pre==true
- nxt=%{<a href="#{@md.fnl[:pre]}#{@seg_name_xhtml[@seg_name_xhtml_tracker+1]}#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}" target="_top" #{@vz.js_next}>
- #{@vz.epub_png_nav_nxt}
- </a>
-} if f_nxt==true
- %{<p class="align_right">
-#{pre}
-#{toc}
-#{nxt}
-</p>
-}
- end
- def toc_next2
- pre,nxt=false,true
- toc_nav(false,true).dup
- end
- def toc_pre_next2
- toc_nav(true,true).dup
- end
- def toc_pre2
- toc_nav(true,false).dup
- end
- def manifest_link(text)
- %{<a href="#{@md.fn[:manifest]}" target="_top" #{@vz.js_manifest}>
- #{text}
- </a>}
- end
- def concordance_link(text)
- if @md.concord_make
- %{<a href="#{@md.fn[:concordance]}" target="_top" #{@vz.js_concordance}>
- #{text}
- </a>}
- else ''
- end
- end
- def doc_types #used in seg_nav_band ###
- scroll=seg=''
- wgt=Widget.new(@md)
- x=if @md.concord_make
- %{
-<table summary="segment navigation available documents types: toc,doc,pdf,concordance" border="0" cellpadding="3" cellspacing="0">
-<tr>
- #{wgt.seg(@vz.nav_txt_toc_link)}
- #{wgt.scroll(@vz.nav_txt_doc_link)}
- #{wgt.pdf}#{wgt.odf}
-<td align="center" bgcolor=#{@vz.color_band2}>
- #{wgt.concordance(@vz.nav_txt_concordance)}
- #{wgt.manifest}
- #{wgt.search}
- #{wgt.home}
-</tr></table>}
- else
- %{
-<table summary="segment navigation available documents types: toc,doc,pdf,concordance" border="0" cellpadding="3" cellspacing="0">
-<tr>
- #{wgt.seg(@vz.nav_txt_toc_link)}
- #{wgt.scroll(@vz.nav_txt_doc_link)}
- #{wgt.pdf}#{wgt.odf}
-<td align="center" bgcolor=#{@vz.color_band2}>
- #{wgt.manifest}
- #{wgt.search}
- #{wgt.home}
-</tr></table>}
- end
- end
- def navigation_table
- %{<table summary="navigation segment table" width=#{@vz.table_width_1} border="0" bgcolor="white" cellpadding="0">
-<tr><th width="#{@@indent['leve_1']}" align="right">
-</td>
-<td valign="top">
- <font size=2>}
- end
- def navigation_table1
- %{<table summary="navigation segment table1" width=#{@vz.table_width_1} border="0" cellpadding=#{@vz.table_cellpad_box} bgcolor=#{@vz.color_table1} align="left">
-<tr><td valign="top">
- <font size="2">}
- end
- def navigation_table2
- %{<table summary="navigation segment table2" width=#{@vz.table_width_2} border="0" cellpadding=#{@vz.table_cellpad_box} bgcolor=#{@vz.color_table2} align="left">
-<tr><td valign="top">
- <font size="2">}
- end
- def heading_advert_local_1
- dir=SiSU_Env::Info_env.new(@fns)
- %{ <p class="center">
-<table summary="image" border="0" cellpadding="3" cellspacing="0" align="center">
-<tr><td align="center" bgcolor="white">
- <a href="http://#{@md.ad_url}#{Sfx[:epub_xhtml]}" target="_top">
- <img border="0" src="#{dir.url.images_epub}/#{@md.ad_png}" alt="#{@md.ad_alt}" />
- </a>
-#{@vz.table_close}
-</p>}
- end
- def heading_advert_local_2
- dir=SiSU_Env::Info_env.new(@fns)
- %{ <p class="center">
-<table summary="image" border="0" cellpadding="3" cellspacing="0" align="center">
-<tr><td align="center" bgcolor="white">
- <a href="#{@md.ad_url}#{Sfx[:epub_xhtml]}" target="_top">
- <img border="0" src="#{dir.url.images_epub}/#{@md.ad_png}" alt="#{@md.ad_alt}" />
- </a>
-#{@vz.table_close}
-</p>}
- end
- def heading_advert_external
- dir=SiSU_Env::Info_env.new(@fns)
- %{ <p class="center">
-<table summary="image" border="0" cellpadding="3" cellspacing="0" align="center">
-<tr><td align="center" bgcolor="white">
- <a href="#{@md.ad_url}#{Sfx[:epub_xhtml]}" target="external">
- <img border="0" src="#{dir.url.images_epub}/#{@md.ad_png}" alt="#{@md.ad_alt}" />
- </a>
-#{@vz.table_close}
-</p>}
- end
- def navigation_band(segtocband) #change name to navigaion_band_banner
- %{#{segtocband}
-}
- end
- def navigation_band_bottom(segtocband,seg_table_top_control) #change name to navigaion_band_bannerless
- %{
-<div class="main_column">
- <table summary="segment navigation band" bgcolor=#{@vz.color_band1} width="100%"><tr>
- <td width="70%" align="center">
- #{doc_types}
- </td>
- <td width="30%" align="right">
- #{segtocband}
- </td></tr>
- </table>
- #{seg_table_top_control}
-</div>
-}
+#{@vz.color_body}}
end
def endnote_mark
%{
<hr class="endnote" />
}
end
- def endnote_section_open
-%{
-<div class="endnote">
-}
- end
- def endnote_section_close
-%{
-</div>
-} #revisit
- end
- def head
- %{#{doc_type}
-<head>
- <title>
- #{@seg_name_xhtml[@seg_name_xhtml_tracker]} -
- #{@md.html_title}
- </title>
-<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
-#{@css.xhtml_epub}
-</head>
-#{@vz.color_body}
-#{@vz.js_top}}
- end
- def toc_metadata
- @metalink=%{./#{@md.fn[:metadata]}}
- toc_metadata
- end
- def title_banner(title,subtitle,creator)
- end
end
- class Head_scroll < Head_toc
+ class HeadScroll < HeadToc
def initialize(md)
super(md)
end
@@ -1619,12 +1828,12 @@ WOK
#{@vz.table_close}}
end
end
- class Format_text_object
- @vz=SiSU_Env::Get_init.instance.skin
+ class FormatTextObject
+ @vz=SiSU_Viz::Defaults.new
attr_accessor :md,:t_o,:txt,:ocn,:format,:table,:link,:linkname,:paranum,:p_num,:headname,:banner,:url
def initialize(md,t_o)
@md,@t_o=md,t_o
- if t_o.class==Hash
+ if t_o.is_a?(Hash)
@txt =t_o[:txt] || nil
@ocn =t_o[:ocn] || nil
@ocn_display =t_o[:ocn_display] || nil
@@ -1639,12 +1848,12 @@ WOK
if @format and not @format.empty?
if @format=~/^\d:(\S+)/ #need more reliable marker #if @format =~ /#{Rx[:lv]}/
headname=$1 #format[/\d~(\S+)/m,1]
- @headname=if headname =~/^[a-zA-Z]/; %{<id="#{headname}">} #consider: h_#{headname}
- else %{<id="h#{headname}"></a>}
- end
- @headname=if headname =~/^[a-zA-Z]/; %{<a name="#{headname}" id="#{headname}"></a>} #consider: h_#{headname}
- else %{<a name="h#{headname}" id="h#{headname}"></a>}
- end
+ @headname=(headname =~/^[a-zA-Z]/) \
+ ? %{<id="#{headname}">}
+ : %{<id="h#{headname}"></a>}
+ @headname=(headname =~/^[a-zA-Z]/) \
+ ? %{<a name="#{headname}" id="#{headname}"></a>}
+ : %{<a name="h#{headname}" id="h#{headname}"></a>}
end
end
elsif t_o.class.inspect =~/Object/
@@ -1652,19 +1861,19 @@ WOK
@named=nametags_seg(@dob)
@txt=((defined? t_o.obj) ? t_o.obj : nil)
@ocn=((defined? t_o.ocn) ? t_o.ocn.to_s : nil)
- @headname=((t_o.is=='heading' and defined? t_o.name) ? t_o.name : nil)
+ @headname=((t_o.is==:heading and defined? t_o.name) ? t_o.name : nil)
else
- if @md.cmd =~/M/
+ if @md.opt.cmd =~/M/
p __FILE__ +':'+ __LINE__.to_s
p t_o.class
p caller
end
end
if @txt and not @txt.empty?
- @txt.gsub!(/#{Mx[:mk_o]}[-~]##{Mx[:mk_c]}/,'')
+ @txt=@txt.gsub(/#{Mx[:mk_o]}[-~]##{Mx[:mk_c]}/,'')
end
- @p_num=Paragraph_number.new(@md,@ocn)
- @vz=SiSU_Env::Get_init.instance.skin
+ @p_num=ParagraphNumber.new(@md,@ocn)
+ @vz=SiSU_Viz::Defaults.new
end
def nametags_seg(dob) #FIX
tags=''
@@ -1700,57 +1909,60 @@ WOK
</div>
}
end
- def para_form_css(tag,attrib) # regular paragraphs shaped here
+ def para_form_css(tag,attrib,txt) # regular paragraphs shaped here
ul=ulc=''
ul,ulc="<ul>\n ","\n </ul>" if @tag =~/li/
%{
<div class="substance">
#{@p_num.ocn_display}
#{ul}<#{tag} class="#{attrib}" #{@p_num.id}>
- #{@named}#{@txt}
+ #{@named}#{txt}
</#{tag}>#{ulc}
</div>
}
end
def para
- para_form_css('p','norm')
+ para_form_css('p','norm',@txt)
end
def group
- para_form_css('p','group')
+ para_form_css('p','group',@txt)
+ end
+ def block
+ para_form_css('p','block',@txt)
end
def alt
- para_form_css('p','alt')
+ para_form_css('p','alt',@txt)
end
def verse
- para_form_css('p','verse')
+ para_form_css('p','verse',@txt)
end
def code
- para_form_css('p','code')
+ para_form_css('p','code',@txt)
end
def center
- para_form_css('p','center')
+ para_form_css('p','center',@txt)
end
def bold
- para_form_css('p','bold')
+ para_form_css('p','bold',@txt)
end
def bullet
- para_form_css('li','bullet')
+ para_form_css('li','bullet',@txt)
end
def table
@txt=if @t_o.obj !~/^<table\s/
- table=SiSU_XHTML_shared::Table_xhtml.new(@t_o) #move, make happen earlier
- @txt=table.table.obj
+ table=SiSU_XHTML_Shared::TableXHTML.new(@t_o) #move, make happen earlier
+ table.table.obj
else @txt
end
- para_form_css('p','norm')
+ para_form_css('p','norm',@txt)
end
def break
- @txt.gsub!(/#{Mx[:br_page_new]}|#{Mx[:br_page]}/,'<hr /><br />')
- @txt.gsub!(/#{Mx[:obj_ln_sep]}/,'<hr style="width:30%" /><br />')
- para_form_css('p','norm')
+ @txt=@txt.gsub(/#{Mx[:br_page_new]}|#{Mx[:br_page]}/,'<hr /><br />').
+ gsub(/#{Mx[:br_obj]}/,'<hr style="width:30%" /><br />')
+ para_form_css('p','norm',@txt)
end
def format(tag,attrib)
- para_form_css(tag,attrib)
+ para_form_css(tag,attrib,@txt)
end
def title_heading(tag,attrib)
%{
@@ -1762,19 +1974,25 @@ WOK
}
end
def title_heading1
- title_heading('h1','tiny')
+ id_u=DISABLE[:epub][:per_section_title] \
+ ? ''
+ : title_heading('h1','tiny')
end
def title_heading2
- title_heading('h2','tiny')
+ id_u=DISABLE[:epub][:per_section_title] \
+ ? ''
+ : title_heading('h2','tiny')
end
def title_heading3
- title_heading('h3','tiny')
+ id_u=DISABLE[:epub][:per_section_title] \
+ ? ''
+ : title_heading('h3','tiny')
end
def title_heading4
''
end
- def seg_heading_sub(tag,attrib)
- @txt.gsub!(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ')
+ def seg_heading_sub(tag,attrib,txt)
+ txt=txt.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ')
%{
<div class="substance">
#{@p_num.ocn_display}
@@ -1795,10 +2013,10 @@ WOK
}
end
def seg_heading5
- seg_heading_sub('p','bold')
+ seg_heading_sub('p','bold',@txt)
end
def seg_heading6
- seg_heading_sub('p','bold')
+ seg_heading_sub('p','bold',@txt)
end
def dl #check :trailer
"<dl><b>#{@txt}</b> #{@trailer}</dl>"
@@ -1808,18 +2026,19 @@ WOK
</p>
</div>'
end
- def gsub_body
- case @txt
+ def gsub_body #unused
+ @txt=case @txt
when /^(?:#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]}\s*)?\((i+|iv|v|vi+|ix|x|xi+)\)/
- @txt.gsub!(/^\((i+|iv|v|vi+|ix|x|xi+)\)/,'<b>(\1)</b>')
- @txt.gsub!(/^(#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]})\s*\((i+|iv|v|vi+|ix|x|xi+)\)/,'\1<b>(\2)</b>')
+ @txt.gsub(/^\((i+|iv|v|vi+|ix|x|xi+)\)/,'<b>(\1)</b>').
+ gsub(/^(#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]})\s*\((i+|iv|v|vi+|ix|x|xi+)\)/,'\1<b>(\2)</b>')
when /^(?:#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]}\s*)?\(?(\d|[a-z])+\)/
- @txt.gsub!(/^\((\d+|[a-z])+\)/,'<b>(\1)</b>')
- @txt.gsub!(/^(#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]})\s*\((\d+|[a-z])+\)/,'\1<b>(\2)</b>')
+ @txt.gsub(/^\((\d+|[a-z])+\)/,'<b>(\1)</b>').
+ gsub(/^(#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]})\s*\((\d+|[a-z])+\)/,'\1<b>(\2)</b>')
when /^\s*\d{1,3}\.\s/
- @txt.gsub!(/^\s*(\d+\.)/,'<b>\1</b>')
+ @txt.gsub(/^\s*(\d+\.)/,'<b>\1</b>')
when /^\s*[A-Z]\.\s/
- @txt.gsub!(/^\s*([A-Z]\.)/,'<b>\1</b>')
+ @txt.gsub(/^\s*([A-Z]\.)/,'<b>\1</b>')
+ else @txt
end
end
def bold_para
@@ -1831,9 +2050,9 @@ WOK
&nbsp;&nbsp;&nbsp;
#{@vz.table_close}}
end
- def bold_heading
- @txt.gsub!(/[1-9]~\S+/,'')
- @txt.gsub!(/[1-9]~/,'')
+ def bold_heading #unused
+ @txt=@txt.gsub(/[1-9]~\S+/,'').
+ gsub(/[1-9]~/,'')
%{<p class="bold">
#{@txt}
</p>
@@ -1854,74 +2073,27 @@ WOK
%{<p class="centerbold">#{@txt}</p>\n}
end
end
- class Format_scroll < Format_text_object
+ class FormatScroll < FormatTextObject
def initialize(md,txt)
super(md,txt)
- @vz=SiSU_Env::Get_init.instance.skin
+ @vz=SiSU_Viz::Defaults.new
end
end
- class Format_seg < Format_text_object
+ class FormatSeg < FormatTextObject
def initialize(md,txt)
super(md,txt)
end
- def navigation_toc_lev1_advert
- %{#{@banner.home_button}\n
-<p class="center">
-#{@txt}
-#{@two}
-</a></p>}
- end
- def navigation_toc_lev1
- %{#{@banner.nav_toc}}
- end
- def navigation_toc_lev2 #change bold use css
- %{<table summary="navigation segment level 2">
-<tr><td width ="20">
-</td>
-<td>
- <font size="3" #{@vz.font_face}>
- <b>#{@txt}</b>
- </font>
- </p>
-#{@vz.table_close}}
- end
- def navigation_toc_lev3 #change bold use css
- %{<table summary="navigation segment level 3">
-<tr><td width ="20">
-</td>
-<td>
- <font size="3" #{@vz.font_face}>
- <b>#{@txt}</b>
- </font>
- </p>
-#{@vz.table_close}}
- end
- def navigation_toc_lev4
- %{<table summary="navigation segment level 4">
-<tr><td width ="80">
-</td>
-<td>
-<p>
- #{@txt}
-</p>
-#{@vz.table_close}}
- end
- def navigation_toc_lev5
- end
- def navigation_toc_lev6
- end
def endnote_seg_body(fn='') #FIX #url construction keep within single line... BUG WATCH 200408
fn='doc' if fn.to_s.empty? #you may wish to reconsider, sends to 'doc' where no segment info
%{
<p class="endnote">
- #{@endnote_part_a}#{@md.fnl[:pre]}#{fn}#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}#{@endnote_part_b}
+ #{@endnote_part_a}#{fn}#{Sfx[:epub_xhtml]}#{@endnote_part_b}
</p>
}
end
def clean(txt)
- txt.gsub!(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/,'')
- txt.gsub!(/#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/,'')
- txt
+ txt=txt.gsub(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/,'').
+ gsub(/#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/,'')
end
def subtoc_lev(tag,attrib)
@txt=clean(@txt)
@@ -1933,10 +2105,10 @@ WOK
note=''
if txt =~/(#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})/m # had \s* at end
note=$1
- note.gsub!(/[\n\s]+/m,' ')
- txt.gsub!(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ')
- txt.gsub!(/<a[\n\s]+"[\n\s]+href="#note_ref\d+">&nbsp;<sup id="note\d+">\d+<\/sup>&nbsp;/m,'')
- txt.gsub!(/<a[\n\s]+"[\n\s]+href="#note_ref\d+">#{Mx[:nbsp]}<sup id="note\d+">\d+<\/sup>#{Mx[:nbsp]}/m,'') #remove
+ note=note.gsub(/[\n\s]+/m,' ')
+ txt=txt.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ').
+ gsub(/<a[\n\s]+"[\n\s]+href="#note_ref\d+">&nbsp;<sup id="note\d+">\d+<\/sup>&nbsp;/m,'').
+ gsub(/<a[\n\s]+"[\n\s]+href="#note_ref\d+">#{Mx[:nbsp]}<sup id="note\d+">\d+<\/sup>#{Mx[:nbsp]}/m,'') #remove
end
%{<#{tag} class="#{attrib}">
<a href="#o#{@ocn}"><i>#{txt}</i></a> #{note}
@@ -1948,8 +2120,8 @@ WOK
def subtoc_lev6
subtoc_lev('h6','subtoc') if @txt
end
- def heading_sub(tag,attrib)
- @txt.gsub!(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ')
+ def heading_sub(tag,attrib,txt)
+ txt=txt.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ')
%{
<div class="substance">
#{@p_num.ocn_display}
@@ -1971,10 +2143,10 @@ WOK
}
end
def heading5
- heading_sub('p','bold')
+ heading_sub('p','bold',@txt)
end
def heading6
- heading_sub('p','bold')
+ heading_sub('p','bold',@txt)
end
def navigation_heading4
%{<table summary="navigation segment heading 4" width=100% bgcolor="#08163f" border="0">
@@ -1998,7 +2170,7 @@ WOK
%{<p class="centerbold">#{@txt}</p>}
end
end
- class Format_toc < Format_text_object
+ class FormatToc < FormatTextObject
def initialize(md,txt)
super(md,txt)
end
@@ -2040,44 +2212,6 @@ WOK
def lev0 #docinfo
lev('h0','toc')
end
- def mini_lev1
- lev('h1','minitoc')
- end
- def mini_lev2
- lev('h2','minitoc')
- end
- def mini_lev3
- lev('h3','minitoc')
- end
- def mini_lev4
- lev('h4','minitoc')
- end
- def mini_lev5
- lev('h5','minitoc')
- end
- def mini_lev6
- lev('h6','minitoc')
- end
- def mini_lev0 #docinfo
- lev('h0','minitoc')
- end
- def mini_tail
- %{
- <h4 class="minitoc">
- <a href="sisu_manifest.html">Manifest (alternative outputs)</a>
- </h4>
-}
- end
- def mini_concord_tail
- %{
- <h4 class="minitoc">
- <a href="concordance.html">Concordance (wordlist)</a>
- </h4>
- <h4 class="minitoc">
- <a href="sisu_manifest.html">Manifest (alternative outputs)</a>
- </h4>
-}
- end
end
end
__END__
diff --git a/lib/sisu/v2/epub_segments.rb b/lib/sisu/v4/epub_segments.rb
index a09aebe3..1261e228 100644
--- a/lib/sisu/v2/epub_segments.rb
+++ b/lib/sisu/v4/epub_segments.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -56,45 +55,38 @@
** Description: epub segment generation, processing
=end
-module SiSU_EPUB_seg
- require "#{SiSU_lib}/shared_xhtml" # shared_xhtml.rb
- require "#{SiSU_lib}/epub" # epub.rb
- require "#{SiSU_lib}/shared_metadata" # shared_metadata.rb
- class Seg_output
- def initialize(md,outputfile,seg,minitoc,type='')
- @md,@output_epub_cont_seg,@seg,@minitoc,@type=md,outputfile,seg,minitoc,type
+module SiSU_EPUB_Seg
+ require_relative 'shared_xhtml' # shared_xhtml.rb
+ require_relative 'epub' # epub.rb
+ require_relative 'shared_metadata' # shared_metadata.rb
+ class Output
+ def initialize(md,outputfile,seg,type='')
+ @md,@output_epub_cont_seg,@seg,@type=md,outputfile,seg,type
end
def output #CONSIDER
if @seg[:title] =~/\S/
filename_seg=[]
filename_seg << @seg[:title] << @seg[:nav]
if @type=='endnotes'
- @seg[:headings]=[]
- format_head_seg=SiSU_EPUB_Format::Head_seg.new(@md)
- @seg[:headings] << format_head_seg.title_banner(@md.title.main,@md.title.sub,@author)
- txt_obj={:txt =>'Endnotes',:ocn_display =>''}
- format_seg=SiSU_EPUB_Format::Format_seg.new(@md,txt_obj)
+ @seg[:headings]=[] #watch
+ txt_obj={ txt: 'Endnotes', ocn_display: ''}
+ format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj)
@seg[:headings] << format_seg.title_heading1
filename_seg << @seg[:heading_endnotes] << @seg[:headings] << %{\n<div class="content">\n} << @seg[:endnote_all] << '</div>'
elsif @type=='idx'
@seg[:headings]=[]
- format_head_seg=SiSU_EPUB_Format::Head_seg.new(@md)
- @seg[:headings] << format_head_seg.title_banner(@md.title.main,@md.title.sub,@author)
- txt_obj={:txt =>'Index',:ocn_display =>''}
- format_seg=SiSU_EPUB_Format::Format_seg.new(@md,txt_obj)
+ format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj)
@seg[:headings] << format_seg.title_heading1
filename_seg << @seg[:heading_idx] << @seg[:headings] << %{\n<div class="content">\n} << @seg[:idx] << '</div>'
elsif @type=='metadata'
- metadata=Metadata::Summary.new(@md).xhtml_display.metadata
+ metadata=SiSU_Metadata::Summary.new(@md).xhtml_display.metadata
@seg[:headings]=[]
- format_head_seg=SiSU_EPUB_Format::Head_seg.new(@md)
- @seg[:headings] << format_head_seg.title_banner(@md.title.main,@md.title.sub,@author)
- txt_obj={:txt =>'Metadata',:ocn_display =>''}
- format_seg=SiSU_EPUB_Format::Format_seg.new(@md,txt_obj)
+ txt_obj={ txt: 'Metadata', ocn_display: ''}
+ format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj)
@seg[:headings] << format_seg.title_heading1
filename_seg << @seg[:heading_idx] << @seg[:headings] << %{\n<div class="content">\n} << metadata << '</div>'
elsif @type=='sisu_manifest'
- env=SiSU_Env::Info_env.new(@md.fns)
+ env=SiSU_Env::InfoEnv.new(@md.fns)
path_and_name,url_and_name="#{env.path.output}/#{@md.fnb}/sisu_manifest.html","#{env.url.root}/#{@md.fnb}/sisu_manifest.html"
manifest=if FileTest.file?("#{path_and_name}")==true
<<WOK
@@ -104,21 +96,18 @@ WOK
else ''
end
@seg[:headings]=[]
- format_head_seg=SiSU_EPUB_Format::Head_seg.new(@md)
- @seg[:headings] << format_head_seg.title_banner(@md.title.main,@md.title.sub,@author)
- txt_obj={:txt =>'Manifest',:ocn_display =>''}
- format_seg=SiSU_EPUB_Format::Format_seg.new(@md,txt_obj)
+ txt_obj={ txt: 'Manifest', ocn_display: ''}
+ format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj)
@seg[:headings] << format_seg.title_heading1
filename_seg << @seg[:heading_idx] << @seg[:headings] << %{\n<div class="content">\n} << manifest << '</div>'
else
filename_seg << @seg[:headings] << @seg[:main] << "\n</div>\n"
end
filename_seg << @seg[:tail] << @seg[:nav] << @seg[:close]
- filename_seg.flatten!.compact!
+ filename_seg=filename_seg.flatten.compact #watch
filename_seg.each do |str|
unless str =~/\A\s*\Z/
- str.strip!
- @output_epub_cont_seg << str
+ @output_epub_cont_seg << str.strip
end
end
@output_epub_cont_seg.close
@@ -132,26 +121,28 @@ WOK
@@loop_count=@@seg_total=@@tracker=0
@@is4=@@is3=@@is2=@@is1=0
@@heading1=@@heading2=@@heading3=@@heading4=0
- @@seg[:nav],@@seg[:title],@@seg[:headings],@@seg[:main],@@seg[:idx],@@seg[:tail],@@seg_subtoc_array,@@seg_endnotes_array,@@seg[:endnote_all]=Array.new(10){[]}
+ @@seg[:headings],@@seg[:main],@@seg[:idx],@@seg[:tail],@@seg_subtoc_array,@@seg_endnotes_array,@@seg[:endnote_all]=Array.new(7){[]}
@@seg[:heading_endnotes]=''
@@tablehead,@@number_of_cols=0,0
- @@segtocband=nil
@@fns_previous=''
attr_reader :seg_name_xhtml,:seg_name_xhtml_tracker
def initialize(md='',data='')
@md,@data=md,data
- @vz=SiSU_Env::Get_init.instance.skin
+ @vz=SiSU_Viz::Defaults.new
@seg_name_xhtml=@@seg_name_xhtml || nil
@seg_name_xhtml_tracker=@@tracker || nil
+ @make=SiSU_Env::ProcessingSettings.new(@md) if @md
end
def songsheet
begin
- @minitoc=SiSU_EPUB::Source::Toc.new(@md,@data).minitoc
data=get_subtoc_endnotes(@data)
data=articles(data)
- Seg.new.cleanup # (((( added ))))
+ SiSU_EPUB_Seg::Seg.new.cleanup # (((( added ))))
#### (((( END )))) ####
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
ensure
@@seg_name=[]
end
@@ -163,13 +154,13 @@ WOK
printed_endnote_seg='n'
idx_xhtml=nil
if @md.book_idx
- my_make_source_file=SiSU_Env::Create_file.new(@md.cmd,@md.fns)
- idx_xhtml=SiSU_Particulars::Combined_singleton.instance.get_idx_xhtml(@md).xhtml_idx
+ idx_xhtml=SiSU_Particulars::CombinedSingleton.instance.get_idx_xhtml(@md).xhtml_idx
idx_xhtml.each {|x| @@seg[:idx] << x }
@@seg[:heading_idx]=''
end
data.each do |dob|
- if (dob.is=='heading' or dob.is=='heading_insert') \
+ if (dob.is==:heading \
+ || dob.is==:heading_insert) \
and dob.ln==4
@@seg_name << dob.name
seg_name=dob.name
@@ -178,8 +169,8 @@ WOK
@@seg_name_xhtml=@@seg_name
@@seg_total=@@seg_name.length
testforartnum=@@seg_name_xhtml
- SiSU_Screen::Ansi.new(@md.cmd,@@seg_name.length) if @md.cmd =~/[MVv]/
- map_nametags=SiSU_Particulars::Combined_singleton.instance.get_map_nametags(@md).nametags_map #p map_nametags
+ SiSU_Screen::Ansi.new(@md.opt.cmd,@@seg_name.length) if @md.opt.cmd =~/[MVv]/
+ map_nametags=SiSU_Particulars::CombinedSingleton.instance.get_map_nametags(@md).nametags_map #p map_nametags
data.each do |dob|
#if defined? dob.obj \
#and dob.obj =~/href="#{Xx[:segment]}#+\S+?"/
@@ -187,14 +178,15 @@ WOK
# #while dob.obj =~/href="#{Xx[:segment]}#+(\S+?)"/
# # m=$1
# # if map_nametags[m][:segname]
- # # dob.obj.sub!(/href="#{Xx[:segment]}#+(\S+?)"/,%{href="#{map_nametags[m][:segname]}#{Sfx[:html]}#\\1"})
+ # # dob.obj=dob.obj.sub(/href="#{Xx[:segment]}#+(\S+?)"/,%{href="#{map_nametags[m][:segname]}#{Sfx[:html]}#\\1"})
# # else
# # p "NOT FOUND name_tags: #{m}"
- # # dob.obj.sub!(/href="#{Xx[:segment]}#+(\S+?)"/,%{href="#\\1"}) # not satisfactory
+ # # dob.obj=dob.obj.sub(/href="#{Xx[:segment]}#+(\S+?)"/,%{href="#\\1"}) # not satisfactory
# # end
# #end
#end
- if (dob.is=='heading' or dob.is=='heading_insert') \
+ if (dob.is==:heading \
+ || dob.is==:heading_insert) \
and dob.ln==4
if dob.ocn==0
@@heading4=dob.obj
@@ -202,62 +194,66 @@ WOK
end
@@is4=newfile=1
end
- if (dob.is=='heading' or dob.is=='heading_insert') \
+ if (dob.is==:heading \
+ || dob.is==:heading_insert) \
and dob.ln==3
@@heading3=dob.obj
@@is4,@@is3=0,1
end
- if (dob.is=='heading' or dob.is=='heading_insert') \
+ if (dob.is==:heading \
+ || dob.is==:heading_insert) \
and dob.ln==2
@@heading2=dob.obj
@@is4,@@is3,@@is2=0,0,1
end
- if (dob.is=='heading' or dob.is=='heading_insert') \
+ if (dob.is==:heading \
+ || dob.is==:heading_insert) \
and dob.ln==1
@@heading1=dob.obj
@@is4,@@is3,@@is2,@@is1=0,0,0,1
end
if (@@is1 && !@@is2 && !@@is3 && !@@is4)
- if not (dob.is=='heading' or dob.is=='heading_insert') \
+ if not (dob.is==:heading \
+ || dob.is==:heading_insert) \
and dob.ln==1
head1=$_ #; check
end
end
if @@is4==1
- dir_epub_cont="#{@md.env.path.epub}/OPS"
+ dir_epub_cont="#{@md.env.processing_path.epub}/#{Ep[:d_oebps]}"
if newfile==1 \
or dob.obj =~/^#{Mx[:br_endnotes]}|^#{Mx[:br_eof]}/
newfile=0
- if (dob.is=='heading' or dob.is=='heading_insert') \
+ if (dob.is==:heading \
+ || dob.is==:heading_insert) \
and dob.ln==4
if tracking != 0
- mkdir_p(@md.dir_out) unless FileTest.directory?(@md.dir_out) #bug - added specifically for nav! not needed by regular seg, check !!!
- Seg.new(@md).tail
- segfilename="#{dir_epub_cont}/#{@md.fnl[:pre]}#{@@seg_name_xhtml[tracking-1]}#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}"
+ SiSU_EPUB_Seg::Seg.new(@md).tail
+ segfilename="#{dir_epub_cont}/#{@@seg_name_xhtml[tracking-1]}#{Sfx[:epub_xhtml]}"
output_epub_cont_seg=File.new(segfilename,'w') if @@seg_name_xhtml[tracking-1]
- if dob.is=='heading' \
+ if dob.is==:heading \
or @@seg_name_xhtml[tracking-1] !~/endnotes|book_index|metadata/
- Seg_output.new(@md,output_epub_cont_seg,@@seg,@minitoc).output
- elsif dob.is=='heading_insert'
+ SiSU_EPUB_Seg::Output.new(@md,output_epub_cont_seg,@@seg).output
+ elsif dob.is==:heading_insert
if @@seg_name_xhtml[tracking-1]=='endnotes'
- Seg_output.new(@md,output_epub_cont_seg,@@seg,@minitoc,'endnotes').output
+ SiSU_EPUB_Seg::Output.new(@md,output_epub_cont_seg,@@seg,'endnotes').output
elsif @@seg_name_xhtml[tracking-1]=='book_index'
- Seg_output.new(@md,output_epub_cont_seg,@@seg,@minitoc,'idx').output
+ SiSU_EPUB_Seg::Output.new(@md,output_epub_cont_seg,@@seg,'idx').output
@@seg[:idx]=[]
elsif @@seg_name_xhtml[tracking-1]=='metadata' # navigation bug FIX
- Seg_output.new(@md,output_epub_cont_seg,@@seg,@minitoc,'metadata').output
+ SiSU_EPUB_Seg::Output.new(@md,output_epub_cont_seg,@@seg,'metadata').output
else puts "#{__FILE__}::#{__LINE__}"
end
else puts "#{__FILE__}::#{__LINE__}"
end
- Seg.new.reinitialise
+ SiSU_EPUB_Seg::Seg.new.reinitialise
heading_art(dob)
head(dob)
- if @@seg_name_xhtml[tracking]=='sisu_manifest' # this is for manifest, includes navigation bug
- segfilename="#{dir_epub_cont}/#{@md.fnl[:pre]}#{@@seg_name_xhtml[tracking]}#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}"
+ if @@seg_name_xhtml[tracking] =='metadata'
+ segfilename="#{dir_epub_cont}/#{@@seg_name_xhtml[tracking]}#{Sfx[:epub_xhtml]}"
output_epub_cont_seg=File.new(segfilename,'w')
- Seg_output.new(@md,output_epub_cont_seg,@@seg,@minitoc,'sisu_manifest').output
- Seg.new.reinitialise #BUG navigation bug with items following metadata, and occurring before manifest, this becomes a bug ... work area for book index, FIX
+ SiSU_EPUB_Seg::Output.new(@md,output_epub_cont_seg,@@seg,'metadata').output
+ SiSU_EPUB_Seg::Seg.new.reinitialise #BUG navigation bug with items following metadata, and occurring before manifest, this becomes a bug ... work area for book index, FIX
end
#@output_epub_cont_seg.close #%(((( EOF )))) -->
end
@@ -268,11 +264,16 @@ WOK
end
tracking=tracking+1
end
- @@get_hash_to=dob.name if (dob.is=='heading' or dob.is=='heading_insert') and dob.ln==4 and dob.name
- @@get_hash_fn=dob.name if (dob.is=='heading' or dob.is=='heading_insert') and dob.ln==4 and dob.name
- if dob.obj.class==String
+ if (dob.is==:heading \
+ || dob.is==:heading_insert) \
+ and dob.ln==4 \
+ and dob.name
+ @@get_hash_to=dob.name
+ @@get_hash_fn=dob.name
+ end
+ if dob.obj.is_a?(String)
markup(dob)
- elsif dob.obj.class==Array
+ elsif dob.obj.is_a?(Array)
dob.obj.each do |pg|
markup(pg)
end
@@ -287,136 +288,143 @@ WOK
data
end
def heading_art(dob)
- format_head_seg=SiSU_EPUB_Format::Head_seg.new(@md)
- if dob.is=='heading' \
- and dob.ln =~/^[1-6]/
- if @@tracker < @@seg_total-1; @@seg[:dot_nav]=format_head_seg.dot_control_pre_next
- else @@seg[:dot_nav]=format_head_seg.dot_control_pre
- end
- end
- @@seg[:title]=format_head_seg.head
+ @@seg[:title]=SiSU_EPUB_Format::HeadSeg.new(@md).head
end
def head(dob)
clean=/<!.*?!>|<:.*?>$/
- format_head_seg=SiSU_EPUB_Format::Head_seg.new(@md)
- if @@tracker < @@seg_total-1
- if @@tracker==0; @@segtocband=format_head_seg.toc_next2 #if format_head_seg.toc_next2
- else @@segtocband=format_head_seg.toc_pre_next2 #if format_head_seg.toc_pre_next2
- end
- else @@segtocband=format_head_seg.toc_pre2 #if format_head_seg.toc_pre2
- end
@p_num ||= ''
if @@is1==1
if defined? @md.creator.author \
and @md.creator.author
@author=%{<b>#{@md.creator.author}</b>\n}
end
- @@seg[:nav] << format_head_seg.navigation_band(@@segtocband)
- ocn=if @@heading1[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]; $1 #fix
- else ''
- end
- @p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,ocn)
- txt_obj={:txt =>@@heading1,:ocn_display =>@p_num.ocn_display}
- format_seg=SiSU_EPUB_Format::Format_seg.new(@md,txt_obj)
+ ocn=(@@heading1[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \
+ ? $1
+ : ''
+ @p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn)
+ txt_obj={ txt: @@heading1, ocn_display: @p_num.ocn_display }
+ format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj)
@@seg[:headings] << format_seg.title_heading1.gsub(clean,'')
- @@heading1.gsub!(/&nbsp;<a name="-[\d*+]+" href="#_[\d*+]+">&nbsp;<sup>[\d*+]+<\/sup>&nbsp;<\/a>/,'')
+ @@heading1=@@heading1.gsub(/&nbsp;<a name="-[\d*+]+" href="#_[\d*+]+">&nbsp;<sup>[\d*+]+<\/sup>&nbsp;<\/a>/,'')
end
if @@is2==1
heading2=@@heading2
- ocn=if heading2[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]; $1 #fix
- else ''
- end
- @p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,ocn)
- txt_obj={:txt =>heading2,:ocn_display =>@p_num.ocn_display}
- format_seg=SiSU_EPUB_Format::Format_seg.new(@md,txt_obj)
+ ocn=(heading2[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \
+ ? $1
+ : ''
+ @p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn)
+ txt_obj={ txt: heading2, ocn_display: @p_num.ocn_display }
+ format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj)
@@seg[:headings] << format_seg.title_heading2.gsub(clean,'')
- @@heading2.gsub!(/&nbsp;<a name="-[\d*+]+" href="#_[\d*+]+">&nbsp;<sup>[\d*+]+<\/sup>&nbsp;<\/a>/,'')
+ @@heading2=@@heading2.gsub(/&nbsp;<a name="-[\d*+]+" href="#_[\d*+]+">&nbsp;<sup>[\d*+]+<\/sup>&nbsp;<\/a>/,'')
end
if @@is3==1
heading3=@@heading3
- ocn=if heading3[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]; $1 #fix
- else ''
- end
- @p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,ocn)
- txt_obj={:txt =>heading3,:ocn_display =>@p_num.ocn_display}
- format_seg=SiSU_EPUB_Format::Format_seg.new(@md,txt_obj)
+ ocn=(heading3[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \
+ ? $1
+ : ''
+ @p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn)
+ txt_obj={ txt: heading3, ocn_display: @p_num.ocn_display }
+ format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj)
@@seg[:headings] << format_seg.title_heading3.gsub(clean,'')
- @@heading3.gsub!(/&nbsp;<a name="-[\d*+]+" href="#_[\d*+]+">&nbsp;<sup>[\d*+]+<\/sup>&nbsp;<\/a>/,'')
+ @@heading3=@@heading3.gsub(/&nbsp;<a name="-[\d*+]+" href="#_[\d*+]+">&nbsp;<sup>[\d*+]+<\/sup>&nbsp;<\/a>/,'')
end
if @@is4==1
heading4=@@heading4
- ocn=if heading4[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]; $1 #fix
- else ''
- end
- @p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,ocn)
- txt_obj={:txt =>heading4,:ocn_display =>@p_num.ocn_display}
- format_seg=SiSU_EPUB_Format::Format_seg.new(@md,txt_obj)
+ ocn=(heading4[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \
+ ? $1
+ : ''
+ @p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn)
+ txt_obj={ txt: heading4, ocn_display: @p_num.ocn_display }
+ format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj)
@@seg[:headings] << format_seg.title_heading4.gsub(clean,'')
end
@@tracker=@@tracker+1
end
def markup(dob)
@debug=[]
- format_head_seg=SiSU_EPUB_Format::Head_seg.new(@md)
- if dob.is =~/(?:heading|para)/ #extend as necessary FIX
- @p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,dob.ocn)
+ if dob.is ==:heading \
+ || dob.is ==:heading_insert \
+ || dob.is ==:para
+ #extend as necessary FIX
+ @p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,dob.ocn)
end
- sto=SiSU_EPUB_Format::Format_text_object.new(@md,dob)
- dob_xhtml=if dob.is=='heading' or dob.is=='heading_insert' or dob.is=='para'
- dob_xhtml=if dob.is=='heading' or dob.is=='heading_insert'
+ sto=SiSU_EPUB_Format::FormatTextObject.new(@md,dob)
+ dob_xhtml=if dob.is==:heading \
+ || dob.is==:heading_insert \
+ || dob.is==:para
+ dob_xhtml=if dob.is==:heading \
+ or dob.is==:heading_insert
if dob.ln==4
- sto.seg_heading4 # work on see Split_text_object
+ sto.seg_heading4 # work on see SplitTextObject
elsif dob.ln==5
sto.seg_heading5
- elsif dob.ln==6; sto.seg_heading6
+ elsif dob.ln==6
+ sto.seg_heading6
end
- elsif dob.is=='para'
- if dob.indent and dob.indent =~/[1-9]/
+ elsif dob.is==:para
+ if dob.indent \
+ and dob.hang \
+ and dob.indent =~/[0-9]/ \
+ and dob.hang =~/[0-9]/
if dob.bullet_
- sto.format('li',"i#{dob.indent}")
- else sto.format('p',"i#{dob.indent}")
- end
- else
- if dob.bullet_
- sto.format('li','bullet')
+ (dob.indent =~/[1-9]/) \
+ ? sto.format('li',"i#{dob.indent}")
+ : sto.format('li','bullet')
+ elsif dob.indent == dob.hang
+ sto.format('p',"i#{dob.indent}")
+ elsif dob.indent != dob.hang
+ sto.format('p',"h#{dob.hang}i#{dob.indent}")
else sto.para
end
+ else sto.para
end
end
- elsif dob.is =~/^(?:group|alt)$/
- sto.para #fix this should be group type specific #FIX
- elsif dob.is=='verse'
+ elsif dob.is ==:block \
+ || dob.is ==:group \
+ || dob.is ==:alt
+ sto.para #fix this should be block type specific #FIX
+ elsif dob.is==:verse
sto.verse
- elsif dob.is=='code'
+ elsif dob.is==:code
sto.code
- elsif dob.is=='table'
+ elsif dob.is==:table
sto.table
- elsif dob.is=='break'
+ elsif dob.is==:break
sto.break
end
if @md.flag_separate_endnotes # may need to revisit, check
- dob.obj.gsub!(/"\s+href="#note_ref(\d+)">/,%{" href=\"endnotes#{Sfx[:epub_xhtml]}#note_ref\\1">}) #endnote- twice #removed file type
+ dob.obj=dob.obj.gsub(/"\s+href="#note_ref(\d+)">/,%{" href=\"endnotes#{Sfx[:epub_xhtml]}#note_ref\\1">}) #endnote- twice #removed file type
end
- if dob.is =~/heading|para/ and (not dob.ocn or dob.ocn.to_s.empty?)
- format_seg=SiSU_EPUB_Format::Format_seg.new(@md,dob)
+ if (dob.is ==:heading \
+ || dob.is==:heading_insert \
+ || dob.is==:para) \
+ && (not dob.ocn or dob.ocn.to_s.empty?)
+ format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,dob)
end
- if (dob.is=='heading' or dob.is=='heading_insert' or dob.is=='para') \
+ if (dob.is==:heading \
+ || dob.is==:heading_insert \
+ || dob.is==:para) \
and dob.note_ #dob.obj =~/<a href="#note_ref\d+">&nbsp;<sup id=/ #endnote- note-
- format_seg=SiSU_EPUB_Format::Format_seg.new(@md,dob)
+ format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,dob)
dob.obj=format_seg.no_paranum
end
- if (dob.is=='heading' or dob.is=='heading_insert') \
+ if (dob.is==:heading \
+ || dob.is==:heading_insert) \
and dob.ln==4
@@seg[:main] << %{\n<div class="content">\n}
@@seg[:main] << dob_xhtml
- @@seg[:main] << @@seg_subtoc[@@get_hash_fn] #% insertion of sub-toc
+ if @make.build.segsubtoc?
+ @@seg[:main] << @@seg_subtoc[@@get_hash_fn] #% insertion of sub-toc
+ end
else
@@seg[:main] << dob_xhtml
end
end
def tail
- format_head_seg=SiSU_EPUB_Format::Head_seg.new(@md)
- if @md.flag_auto_endnotes and @@seg_endnotes[@@get_hash_fn]
+ format_head_seg=SiSU_EPUB_Format::HeadSeg.new(@md)
+ if @md.flag_auto_endnotes \
+ and @@seg_endnotes[@@get_hash_fn]
@@seg[:tail] << %{\n<div class="content">\n<div class="endnote">\n}
if @@seg_endnotes[@@get_hash_fn].flatten.length > 0
@@seg[:tail] << format_head_seg.endnote_mark
@@ -429,8 +437,7 @@ WOK
@@seg[:close] << format_head_seg.xhtml_close
end
def reinitialise
- @@seg[:title],@@seg[:dot_nav],@@seg[:nav],@@seg[:headings],@@seg[:main],@@seg[:tail],@@seg[:credits]=Array.new(8){[]}
- @@segtocband=nil
+ @@seg[:headings],@@seg[:main],@@seg[:tail],@@seg[:credits]=Array.new(4){[]}
end
def cleanup
reinitialise
@@ -441,9 +448,10 @@ WOK
end
def get_subtoc_endnotes(data) #get endnotes & sub-table of contents subtoc
data.each do |dob|
- dob.obj.gsub!(/<a name=\"h\d.*?\">(.+?)<\/a>/mi,'\1')
+ dob.obj=dob.obj.gsub(/<a name=\"h\d.*?\">(.+?)<\/a>/mi,'\1')
if @md.flag_auto_endnotes
- if (dob.is=='heading' or dob.is=='heading_insert') \
+ if (dob.is==:heading \
+ || dob.is==:heading_insert) \
and dob.ln.to_s =~/^[1234]/ \
and not @@fn.to_s.empty?
@@seg_endnotes[@@fn]=[]
@@ -451,7 +459,8 @@ WOK
@@seg_endnotes_array=[] if dob.ln==4
@@fns_previous=@md.fns if dob.ln==4 and dob.name =~/^meta/
end
- if (dob.is=='heading' or dob.is=='heading_insert') \
+ if (dob.is==:heading \
+ || dob.is==:heading_insert) \
and dob.ln==4 #% EXTRACTION OF SUB-TOCs & SEGMENT NAME, after EXTRACTION OF ENDNOTES & SUB-TOCs
@@seg_subtoc[@@fn]=@@seg_subtoc_array
@@seg_subtoc_array=[]
@@ -459,21 +468,20 @@ WOK
and dob.obj
@@fn=dob.name
else
- if dob.name =~/\S+/
- @@fn=dob.name
- else @@fn=''
- end
+ @@fn=(dob.name =~/\S+/) \
+ ? dob.name
+ : ''
end
end
end
- if dob.is=='heading' \
+ if dob.is==:heading \
and dob.ln.to_s =~/^[56]/
case dob.ln
when 5
- format_seg=SiSU_EPUB_Format::Format_seg.new(@md,dob)
+ format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,dob)
subtoc=format_seg.subtoc_lev5 #keep and make available, this is the subtoc
when 6
- format_seg=SiSU_EPUB_Format::Format_seg.new(@md,dob)
+ format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,dob)
subtoc=format_seg.subtoc_lev6 #keep and make available, this is the subtoc
end
@@seg_subtoc_array << subtoc
@@ -481,7 +489,7 @@ WOK
if @md.flag_auto_endnotes
ast,pls='&#042;','&#043;'
if dob.obj =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})(?:\d|#{ast}|#{pls})+ / \
- and dob.is !~/^code/ # endnote-
+ and dob.is !=:code # endnote-
endnote_array=[]
if dob.obj=~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/m
endnote_array << dob.obj.scan(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/m)
@@ -492,15 +500,15 @@ WOK
if dob.obj=~/#{Mx[:en_b_o]}#{pls}\d+\s.+?#{Mx[:en_b_c]}/m
endnote_array << dob.obj.scan(/#{Mx[:en_b_o]}#{pls}\d+\s.+?#{Mx[:en_b_c]}/m)
end
- endnote_array.flatten! #.compact! #check compacting
+ endnote_array=endnote_array.flatten #.compact #check compacting
endnote_array.each do |note|
note_match=note.dup
note_match_seg=note.dup
e_n=note_match_seg[/(?:#{Mx[:en_a_o]}(?:\d|#{ast}|#{pls})+|#{Mx[:en_b_o]}(?:#{ast}|#{pls})\d+)\s+(.+?)(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m,1]
try=e_n.split(/<br \/>/)
try.each do |e|
- txt_obj={:txt =>e}
- format_seg=SiSU_EPUB_Format::Format_seg.new(@md,txt_obj)
+ txt_obj={ txt: e }
+ format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj)
note_match=if e =~/#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]}/
format_seg.endnote_body_indent
else format_seg.endnote_body
@@ -512,12 +520,12 @@ WOK
m=/(?:#{Mx[:en_a_o]}(?:\d|#{ast}|#{pls})+|#{Mx[:en_b_o]}(?:#{ast}|#{pls})\d+)\s+(.+?href=")(#note_ref(?:\d|_a|_b)+".+)(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/mi
endnote_part_a=note_match_seg[m,1]
endnote_part_b=note_match_seg[m,2]
- txt_obj={:endnote_part_a =>endnote_part_a,:endnote_part_b =>endnote_part_b}
- format_seg=SiSU_EPUB_Format::Format_seg.new(@md,txt_obj)
+ txt_obj={ endnote_part_a: endnote_part_a, endnote_part_b: endnote_part_b }
+ format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj)
note_match_all_seg=format_seg.endnote_seg_body(@@fn) #BUG WATCH 200408
@@seg[:endnote_all] << note_match_all_seg
end
- dob.obj.gsub!(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ')
+ dob.obj=dob.obj.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ')
end
end
end
diff --git a/lib/sisu/v4/epub_tune.rb b/lib/sisu/v4/epub_tune.rb
new file mode 100644
index 00000000..e99216d5
--- /dev/null
+++ b/lib/sisu/v4/epub_tune.rb
@@ -0,0 +1,409 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: epub generation, epub pre-processing
+
+=end
+require_relative 'param'
+module SiSU_EPUB_Tune
+ require_relative 'sysenv' # sysenv.rb
+ include SiSU_Env; include SiSU_Screen
+ require_relative 'epub_format' # epub_format.rb #watch
+ @@line_mode=''
+ @@endnote_array=[]
+ @@endnote_call_counter=1
+ @@table_align='<table summary='' width="96%" border="0" bgcolor="white" cellpadding="0" col="3">
+<tr ...><td width="2%" align="right">
+&nbsp\;</td>
+<td width="94%" valign="top" align="justify">'
+ @@table_align_close='</td>
+<td width="4%" align="right" valign="top">
+<font size="1" color="#777777">
+&nbsp;&nbsp;&nbsp;</font> </td></tr></table>'
+ @@counter,@@column,@columns=0,0,0
+ class Output
+ def initialize(data,md)
+ @data,@md=data,md
+ @file=SiSU_Env::FileOp.new(@md)
+ @cX=SiSU_Screen::Ansi.new(@md.opt.cmd).cX
+ end
+ def hard_output
+ @filename_tune=@file.write_file_processing.html_tune
+ data=[]
+ @data.each {|x| x.obj.strip; data << x if not x.obj.empty?} #1.9 array?
+ data.each do |dob|
+ @filename_tune.puts dob, "\n" #check
+ end
+ end
+ def marshal
+ File.open(@file.marshal.html_tune,'w') {|f| Marshal.dump(@data.to_a,f)}
+ end
+ end
+ class CleanXHTML
+ def initialize(html='')
+ @html=html
+ end
+ def clean
+ html=@html
+ str=if html.is_a?(String)
+ html
+ else html.obj
+ end
+ str=str.gsub(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;').
+ gsub(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;').
+ gsub(/\*/u,'&#042;'). # &#042;
+ gsub(/\+/u,'&#043;'). # &#043;
+ gsub(/¢/u,'&cent;'). # &#162;
+ gsub(/£/u,'&pound;'). # &#163;
+ gsub(/¥/u,'&yen;'). # &#165;
+ gsub(/§/u,'&sect;'). # &#167;
+ gsub(/©/u,'&copy;'). # &#169;
+ gsub(/ª/u,'&ordf;'). # &#170;
+ gsub(/«/u,'&laquo;'). # &#171;
+ gsub(/®/u,'&reg;'). # &#174;
+ gsub(/°/u,'&deg;'). # &#176;
+ gsub(/±/u,'&plusmn;'). # &#177;
+ gsub(/²/u,'&sup2;'). # &#178;
+ gsub(/³/u,'&sup3;'). # &#179;
+ gsub(/µ/u,'&micro;'). # &#181;
+ gsub(/¶/u,'&para;'). # &#182;
+ gsub(/¹/u,'&sup1;'). # &#185;
+ gsub(/º/u,'&ordm;'). # &#186;
+ gsub(/»/u,'&raquo;'). # &#187;
+ gsub(/¼/u,'&frac14;'). # &#188;
+ gsub(/½/u,'&frac12;'). # &#189;
+ gsub(/¾/u,'&frac34;'). # &#190;
+ gsub(/×/u,'&times;'). # &#215;
+ gsub(/÷/u,'&divide;'). # &#247;
+ gsub(/¿/u,'&iquest;'). # &#191;
+ gsub(/À/u,'&Agrave;'). # &#192;
+ gsub(/Á/u,'&Aacute;'). # &#193;
+ gsub(/Â/u,'&Acirc;'). # &#194;
+ gsub(/Ã/u,'&Atilde;'). # &#195;
+ gsub(/Ä/u,'&Auml;'). # &#196;
+ gsub(/Å/u,'&Aring;'). # &#197;
+ gsub(/Æ/u,'&AElig;'). # &#198;
+ gsub(/Ç/u,'&Ccedil;'). # &#199;
+ gsub(/È/u,'&Egrave;'). # &#200;
+ gsub(/É/u,'&Eacute;'). # &#201;
+ gsub(/Ê/u,'&Ecirc;'). # &#202;
+ gsub(/Ë/u,'&Euml;'). # &#203;
+ gsub(/Ì/u,'&Igrave;'). # &#204;
+ gsub(/Í/u,'&Iacute;'). # &#205;
+ gsub(/Î/u,'&Icirc;'). # &#206;
+ gsub(/Ï/u,'&Iuml;'). # &#207;
+ gsub(/Ð/u,'&ETH;'). # &#208;
+ gsub(/Ñ/u,'&Ntilde;'). # &#209;
+ gsub(/Ò/u,'&Ograve;'). # &#210;
+ gsub(/Ó/u,'&Oacute;'). # &#211;
+ gsub(/Ô/u,'&Ocirc;'). # &#212;
+ gsub(/Õ/u,'&Otilde;'). # &#213;
+ gsub(/Ö/u,'&Ouml;'). # &#214;
+ gsub(/Ø/u,'&Oslash;'). # &#216;
+ gsub(/Ù/u,'&Ugrave;'). # &#217;
+ gsub(/Ú/u,'&Uacute;'). # &#218;
+ gsub(/Û/u,'&Ucirc;'). # &#219;
+ gsub(/Ü/u,'&Uuml;'). # &#220;
+ gsub(/Ý/u,'&Yacute;'). # &#221;
+ gsub(/Þ/u,'&THORN;'). # &#222;
+ gsub(/ß/u,'&szlig;'). # &#223;
+ gsub(/à/u,'&agrave;'). # &#224;
+ gsub(/á/u,'&aacute;'). # &#225;
+ gsub(/â/u,'&acirc;'). # &#226;
+ gsub(/ã/u,'&atilde;'). # &#227;
+ gsub(/ä/u,'&auml;'). # &#228;
+ gsub(/å/u,'&aring;'). # &#229;
+ gsub(/æ/u,'&aelig;'). # &#230;
+ gsub(/ç/u,'&ccedil;'). # &#231;
+ gsub(/è/u,'&egrave;'). # &#232;
+ gsub(/é/u,'&eacute;'). # &#233;
+ gsub(/ê/u,'&ecirc;'). # &#234;
+ gsub(/ë/u,'&euml;'). # &#235;
+ gsub(/ì/u,'&igrave;'). # &#236;
+ gsub(/í/u,'&iacute;'). # &#237;
+ gsub(/î/u,'&icirc;'). # &#238;
+ gsub(/ï/u,'&iuml;'). # &#239;
+ gsub(/ð/u,'&eth;'). # &#240;
+ gsub(/ñ/u,'&ntilde;'). # &#241;
+ gsub(/ò/u,'&ograve;'). # &#242;
+ gsub(/ó/u,'&oacute;'). # &#243;
+ gsub(/ô/u,'&ocirc;'). # &#244;
+ gsub(/õ/u,'&otilde;'). # &#245;
+ gsub(/ö/u,'&ouml;'). # &#246;
+ gsub(/ø/u,'&oslash;'). # &#248;
+ gsub(/ù/u,'&ugrave;'). # &#250;
+ gsub(/ú/u,'&uacute;'). # &#251;
+ gsub(/û/u,'&ucirc;'). # &#252;
+ gsub(/ü/u,'&uuml;'). # &#253;
+ gsub(/þ/u,'&thorn;'). # &#254;
+ gsub(/ÿ/u,'&yuml;'). # &#255;
+ gsub(/ý/u,'&yacute;').
+ gsub(/<br>/u,'<br />').
+ gsub(/#{Mx[:nbsp]}/u,'&nbsp;')
+ end
+ end
+ class Tune
+ def initialize(data,md)
+ @data,@md=data,md
+ @vz=SiSU_Viz::Defaults.new
+ @env=SiSU_Env::InfoEnv.new(@md.fns)
+ @sys=SiSU_Env::SystemCall.new
+ @env=SiSU_Env::InfoEnv.new(@md.fns)
+ @brace_url=SiSU_Viz::Defaults.new.url_decoration
+ end
+ def songsheet
+ begin
+ @cX=SiSU_Screen::Ansi.new(@md.opt.cmd).cX
+ SiSU_Screen::Ansi.new(@md.opt.cmd,'Tune').txt_grey if @md.opt.cmd =~/[MVv]/
+ data=SiSU_EPUB_Tune::Tune.new(@data,@md).amp_html
+ data=SiSU_EPUB_Tune::Tune.new(data,@md).endnotes_html
+ data=SiSU_EPUB_Tune::Tune.new(data,@md).url_markup
+ data=SiSU_EPUB_Tune::Tune.new(data,@md).markup
+ if @md.opt.cmd =~/M/ #Hard Output Tune Optional on/off here
+ data=SiSU_EPUB_Tune::Output.new(data,@md).hard_output
+ SiSU_EPUB_Tune::Output.new(data,@md).marshal
+ end
+ tuned=SiSU_EPUB_Tune::Tune.new(@data,@md).output
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ end
+ end
+ def markup
+ @tuned_file=[]
+ @data.each do |dob|
+ dob.obj=dob.obj.gsub(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;').
+ gsub(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;')
+ dob.obj=dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />') unless dob.is==:table
+ dob.obj=dob.obj.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>').
+ gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>').
+ gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>').
+ gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>').
+ gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>').
+ gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'<ins>\1</ins>').
+ gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>').
+ gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>').
+ gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>'). # tt, kbd
+ gsub(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'').
+ gsub(/#{Mx[:gl_bullet]}/m,'●&nbsp;&nbsp;').
+ gsub(/#{Mx[:nbsp]}/,'&nbsp;').
+ gsub(/<(p|br)>/,'<\1 />')
+ dob.obj=SiSU_EPUB_Tune::CleanXHTML.new(dob.obj).clean
+ @tuned_file << dob
+ end
+ end
+ def urls(data)
+ @words=[]
+ map_nametags=SiSU_Particulars::CombinedSingleton.instance.get_map_nametags(@md).nametags_map #p map_nametags
+ data.each do |word|
+ @words << if word=~/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/
+ http_=true
+ if word =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/
+ m,u=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/.match(word).captures
+ elsif word =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/
+ http_=false
+ m,u=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}(\S+?)#{Mx[:rel_c]}/.match(word).captures
+ elsif word =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}image/
+ m,u=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}(image)/.match(word).captures
+ end
+ case m
+ when /\.png|\.jpg|\.gif|c=|\s\d+x\d+/
+ w,h=/\s(\d+)x(\d+)/.match(m).captures if m =~/\s\d+x\d+/
+ w=%{width="#{w}"} if w
+ h=%{height="#{h}"} if h
+ c=m[/"(.+?)"/m,1]
+ caption=%{<br /><p class="caption">#{c}</p>} if c
+ png=m.scan(/\S+/)[0]
+ image_path=@md.file.output_path.epub.rel_image #image_path=@env.url.images_epub
+ ins=if u \
+ and u.strip !~/^image$/
+ %{<a href="#{u}"><img src="#{image_path}/#{png}" #{w} #{h} naturalsizeflag="0" align="bottom" border="0" /></a>#{caption}}
+ else %{<img src="#{image_path}/#{png}" #{w} #{h} naturalsizeflag="0" align="bottom" border="0" />#{caption}}
+ end
+ word=word.gsub(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/,ins)
+ else
+ link=m[/(.+)/m]
+ png=m.scan(/\S+/)[0].strip
+ link=link.strip
+ u=u.sub(/^#*/,'') #make neater
+ if map_nametags[u] \
+ and map_nametags[u][:segname]
+ u=unless http_
+ u=if u=~/^\d+$/
+ u.gsub(/^(\d+)$/,"#{map_nametags[u][:segname]}#{Sfx[:xhtml]}#o\\1") if u !~/\//
+ else
+ u.gsub(/(\S+)/,"#{map_nametags[u][:segname]}#{Sfx[:xhtml]}#\\1") if u !~/\//
+ end
+ else u
+ end
+ elsif u =~/^:/
+ u=u.gsub(/^:/,"#{@env.url.root}/")
+ elsif u =~/^\.\.\//
+ u=u.gsub(/^\.\.\//,"#{@env.url.root}/")
+ elsif u =~/https?:\/\//
+ else p "NOT FOUND name_tags: #{u}"
+ end
+ ins=%{<a href="#{u}">#{link}</a>}
+ word=word.gsub(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,ins).
+ gsub(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/,ins)
+ end
+ word
+ else word
+ end
+ word
+ end
+ @words=@words.join(' ')
+ end
+ def url_markup
+ data=@data
+ @tuned_file=[]
+ data.each do |dob|
+ unless dob.is==:code
+ if dob.obj =~/<::\s+/ #watch
+ dob.obj=dob.obj.gsub(/<::\s+(\S+?)\s+!>/,
+ %{<img src="#{@env.url.images_epub}/c_\\1.png" alt="\\1" width="14" height="14" align="bottom" border="0" />})
+ end
+ if dob.obj =~/<:image\s+/
+ dob.obj=dob.obj.gsub(/<:image\s+(http\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+>/,
+ %{<a href="\\1"><img src="#{@env.url.images_epub}/\\2" \\3 \\4 naturalsizeflag="0" align="bottom" border="0" /></a>}).
+ gsub(/<:image\s+(http\S+)\s+(\S+)\s+>/,
+ %{<a href="\\1"><img src="#{@env.url.images_epub}/\\2" naturalsizeflag="0" align="bottom" border="0" /></a>}).
+ gsub(/<:image\s+(\S+)\s+(\S+)\s+(\S+)\s+>/,
+ %{<img src="#{@env.url.images_epub}/\\1" \\2 \\3 naturalsizeflag="0" align="bottom" border="0" />}).
+ gsub(/<:image\s+(\S+)\s+>/,
+ %{<img src="#{@env.url.images_epub}/\\1" naturalsizeflag="0" align="bottom" border="0" />})
+ end
+ if dob.obj =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/
+ @word_mode=dob.obj.scan(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)[()\[\]]*[,.;:!?'"]{0,2}|(?:#{Mx[:gl_o]}\S+?#{Mx[:gl_c]})+|[^#{Mx[:lnk_o]}#{Mx[:lnk_c]}]+/mu)
+ words=urls(@word_mode)
+ dob.obj=dob.obj.gsub(/.+/m,words)
+ end
+ dob.obj=dob.obj.gsub(/\\copyright/i,%{<sup>&copy;</sup>})
+ dob.obj=if (dob.obj !~/\<:ad\s+\.\.\//)
+ dob.obj.gsub(/\<:ad\s+(\S+)?\s+(\S+\.png)\s+(.+)?\;\s+(.+)?\;\s*!\>/,
+ %{\n<center><a href="http:\/\/\\1" target="external"><img src="#{@env.url.images_epub}/\\2" alt="\\3" /></a></center>\n})
+ else
+ dob.obj.gsub(/\<:ad\s+(\S+)?\s+(\S+\.png)\s+(.+)?\;\s+(.+)?\;\s*\>/,
+ %{\n<center><a href="\\1" target="_top"><img src="#{@env.url.images_epub}/\\2" alt="\\3" /></a></center>\n})
+ end
+ dob.obj=dob.obj.gsub(/!pick/,%{<img border="0" height="15" width="15" src="#{@env.url.images_epub}/#{@vz.icon_choice}" alt="stellar" />}).
+ gsub(/!new/,%{&nbsp;<img border="0" height="15" width="15" src="#{@env.url.images_epub}/#{@vz.icon_new}" alt="new" />}).
+ gsub(/<:h(.{1,7}?)>/,'<a href="#h\1">\1</a>').
+ gsub(/<:to(\d{1,7}?)>/,'<a href="#to\1">to&nbsp;{&nbsp;\1&nbsp;}</a> ').
+ gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'<a href="\1" target="_top">\1</a>'). #http ftp matches escaped, no decoration
+ gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}<a href="mailto:\\1">\\1</a>#{@brace_url.xml_close}}).
+ gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}<a href="\\1" target="_top">\\1</a>#{@brace_url.xml_close}}) #http ftp matches with decoration
+ if dob.obj =~/..\/\S+/ \
+ and dob.obj !~/(\"..\/\S+?\"|>\s*..\/\S+<)/
+ dob.obj=dob.obj.gsub(/(\.\.\/\S+)/,'<a href="\1">\1</a>')
+ end
+ dob.obj=dob.obj.gsub(/<a href="\.\.\//,%{<a href="#{@vz.url_site}/})
+ else
+ dob.obj=dob.obj.gsub(/</m,'&lt;').gsub(/>/m,'&gt;')
+ end
+ @tuned_file << dob
+ end
+ end
+ def amp_html
+ data,data_new=@data,[]
+ data.each do |dob|
+ dob.obj=dob.obj.gsub(/&/u,'&amp;')
+ data_new << dob
+ end
+ data_new
+ end
+ def endnotes_html
+ data=@data
+ @tuned_file=[]
+ a,s='_a','_s'
+ ast,pls='&#042;','&#043;'
+ data.each do |dob|
+ unless dob.is ==:code
+ dob.obj=dob.obj.gsub(/(#{Mx[:en_a_o]}|#{Mx[:en_b_o]})(\d+)\s+(.+?)(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/,
+ %{#{Mx[:nbsp]}<a href="#note\\2">#{Mx[:nbsp]}<sup id="note_ref\\2">\\2</sup>#{Mx[:nbsp]}</a> } + #note- endnote-
+ %{\\1\\2 <a href="#note_ref\\2">#{Mx[:nbsp]}<sup id="note\\2">\\2.</sup></a> \\3 \\4}). #endnote- note- (careful may have switched)
+ gsub(/(#{Mx[:en_b_o]})[*](\d+)\s+(.+?)(#{Mx[:en_b_c]})/,
+ %{#{Mx[:nbsp]}<a href="#note_astx\\2">#{Mx[:nbsp]}<sup id="note_ref_astx\\2">#{ast}\\2</sup>#{Mx[:nbsp]}</a> } + #note- endnote-
+ %{\\1#{ast}\\2 <a href="#note_ref_astx\\2">#{Mx[:nbsp]}<sup id="note_astx\\2">#{ast}\\2.</sup></a> \\3 \\4}). #endnote- note- (careful may have switched)
+ gsub(/(#{Mx[:en_b_o]})[+](\d+)\s+(.+?)(#{Mx[:en_b_c]})/,
+ %{#{Mx[:nbsp]}<a href="#note_plus\\2">#{Mx[:nbsp]}<sup id="note_ref_plus\\2">#{pls}\\2</sup>#{Mx[:nbsp]}</a> } + #note- endnote-
+ %{\\1#{pls}\\2 <a href="#note_ref_plus\\2">#{Mx[:nbsp]}<sup id="note_plus\\2">#{pls}\\2.</sup></a> \\3 \\4}) #endnote- note- (careful may have switched) # double-check there may here be a bug
+ if dob.obj =~/#{Mx[:en_a_o]}([*+]+)\s+.+?#{Mx[:en_a_c]}/
+ m=$1.length.to_i
+ dob.obj=dob.obj.gsub(/(#{Mx[:en_a_o]})[*]+\s+(.+?)(#{Mx[:en_a_c]})/,
+ %{#{Mx[:nbsp]}<a href="#note#{a*m}">#{Mx[:nbsp]}<sup id="note_ref#{a*m}">#{ast*m}</sup>#{Mx[:nbsp]}</a> } + #note- endnote-
+ %{\\1#{ast*m} <a href="#note_ref#{a*m}">#{Mx[:nbsp]}<sup id="note#{a*m}">#{ast*m}</sup></a> \\2 \\3}). #endnote- note- (careful may have switched)
+ gsub(/(#{Mx[:en_a_o]})([+]+)\s+(.+?)(#{Mx[:en_a_c]})/,
+ %{#{Mx[:nbsp]}<a href="#note#{s*m}">#{Mx[:nbsp]}<sup id="note_ref#{s*m}">#{pls*m}</sup>#{Mx[:nbsp]}</a> } + #note- endnote-
+ %{\\1#{pls*m} <a href="#note_ref#{s*m}">#{Mx[:nbsp]}<sup id="note#{s*m}">#{pls*m}</sup></a> \\2 \\3}) #endnote- note- (careful may have switched)
+ end
+ end
+ @tuned_file << dob
+ end
+ end
+ def output
+ data=@data
+ @tuned_file=[]
+ data.each do |dob|
+ dob.obj=dob.obj.strip.chomp
+ @tuned_file << dob
+ end
+ @tuned_file << "\n<EOF>" if (@md.fns =~/\.sst0/) #remove
+ @tuned_file
+ end
+ end
+end
+__END__
diff --git a/lib/sisu/v2/errors.rb b/lib/sisu/v4/errors.rb
index 9a8f85c1..d1ce5170 100644
--- a/lib/sisu/v2/errors.rb
+++ b/lib/sisu/v4/errors.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -57,23 +56,28 @@
=end
module SiSU_Errors
- require "#{SiSU_lib}/sysenv" # sysenv.rb
+ require_relative 'sysenv' # sysenv.rb
include SiSU_Env; include SiSU_Screen
- class Info_error <Create_file
+ class InfoError <CreateFile
def initialize(error,errorlist,cmd,fns='')
@fns,@cmd,@error,@errorlist=fns,cmd,error,errorlist
- @cmd=if cmd and cmd =~/c/; 'Vc'
- else 'V'
- end
+ @cmd=(cmd \
+ && (cmd =~/c/)) \
+ ? 'Vc'
+ : 'V'
end
- def error #creates file errorlog.sisu in pwd of last error reported
- file=if @fns; SiSU_Env::Create_file.new(@cmd,@fns).file_error
- else File.new('/tmp/errorlog.sisu','w+')
- end
+ def error
+ file=@fns \
+ ? (SiSU_Env::CreateFile.new(@fns).file_error)
+ : (File.new('/tmp/errorlog.sisu','w+'))
file << @fns << "\n" << @error << "\n" << @errorlist
file.close
- if @cmd=~/[vVM]/; STDERR.puts SiSU_Screen::Ansi.new('',$!,$@).rescue
- else SiSU_Screen::Ansi.new('',"rescued, exception reaised, silenced").puts_grey
+ if @cmd=~/[vVM]/
+ SiSU_Screen::Ansi.new('',$!,$@).rescue do
+ (block_given?) ? yield : __LINE__.to_s + ':' + __FILE__
+ end
+ else
+ SiSU_Screen::Ansi.new('',"rescued, exception raised, silenced").puts_grey
end
end
end
diff --git a/lib/sisu/v4/git.rb b/lib/sisu/v4/git.rb
new file mode 100644
index 00000000..50521fba
--- /dev/null
+++ b/lib/sisu/v4/git.rb
@@ -0,0 +1,232 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: system environment, resource control and configuration details
+
+=end
+module SiSU_Git
+ require_relative 'param' # param.rb
+ require_relative 'sysenv' # sysenv.rb
+ require_relative 'dal' # dal.rb
+ class Source
+ def initialize(opt)
+ @opt=opt
+ @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
+ fnn,fnb,fnt=@opt.fns[m,1],@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
+ #unless @opt.cmd =~/q/
+ # @opt.cmd=~/[MVvz]/ \
+ # ? SiSU_Screen::Ansi.new(@opt.cmd,'Git path',@git_path[:fnb]).green_hi_blue \
+ # : SiSU_Screen::Ansi.new(@opt.cmd,'Git path',@git_path[:fnb]).green_title_hi
+ # SiSU_Screen::Ansi.new(@opt.cmd,"Git path","#{@opt.fns} -> #{@git_path[:fnb]}").warn if @opt.cmd =~/[MVv]/
+ #end
+ 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_DAL::Source.new(@opt).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.cmd =~/q/
+ @opt.cmd=~/[MVvz]/ \
+ ? SiSU_Screen::Ansi.new(@opt.cmd,'Git path',@git_path[:fnb]).green_hi_blue
+ : SiSU_Screen::Ansi.new(@opt.cmd,'Git path',@git_path[:fnb]).green_title_hi
+ SiSU_Screen::Ansi.new(@opt.cmd,"Git path","#{@opt.fns} -> #{@git_path[:fnb]}").warn if @opt.cmd =~/[MVv]/
+ 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]
+ 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])
+ else
+ 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
+ parse_file=if composite_src \
+ and @opt.cmd.inspect !~/m/
+ ##SiSU_Assemble::Composite.new(@opt).read
+ #SiSU_DAL::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/v4/harvest.rb b/lib/sisu/v4/harvest.rb
new file mode 100644
index 00000000..ea967c37
--- /dev/null
+++ b/lib/sisu/v4/harvest.rb
@@ -0,0 +1,112 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+ harvest metadata from document corpus (suitable for medium sized sites)
+ (concept example, [to remove size constraint: implement SQL equivalent])
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: system environment, resource control and configuration details
+
+=end
+module SiSU_Harvest
+ @@the_idx_topics,@@the_idx_authors={},{}
+ class Source
+ require_relative 'options' # options.rb
+ require_relative 'harvest_topics' # harvest_topics.rb
+ require_relative 'harvest_authors' # harvest_authors.rb
+ require_relative 'sysenv' # sysenv.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.cmd).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.mod.inspect
+ when/--harvest/i
+ css(opt) if opt.cmd.inspect =~/M/
+ SiSU_HarvestAuthors::Songsheet.new(opt,env).songsheet
+ SiSU_HarvestTopics::Songsheet.new(opt,env).songsheet
+ if opt.cmd.inspect =~/R/
+ 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/v4/harvest_authors.rb b/lib/sisu/v4/harvest_authors.rb
new file mode 100644
index 00000000..ef4b89c3
--- /dev/null
+++ b/lib/sisu/v4/harvest_authors.rb
@@ -0,0 +1,387 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+ metadata harvest, extract authors and their writings from document set
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: simple xml representation (sax style)
+
+=end
+module SiSU_HarvestAuthors
+ require_relative 'author_format' # author_format.rb
+ class Songsheet
+ @@the_idx_authors={}
+ def initialize(opt,env)
+ @opt,@env=opt,env
+ @file_list=opt.files
+ end
+ def songsheet
+ puts 'authors:'
+ 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|date):(?:\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|%+ )/
+ else break
+ end
+ end
+ end
+ lang_hash_file_array.each_pair do |lang,a|
+ idx_array[lang] ||= []
+ idx_array=SiSU_HarvestAuthors::Harvest.new(@opt,@env,a,filename,name,idx_array,lang).extract_harvest
+ end
+ end
+ the_idx=SiSU_HarvestAuthors::Index.new(idx_array,@@the_idx_authors).construct_book_author_index
+ SiSU_HarvestAuthors::OutputIndex.new(@opt,the_idx).html_print.html_songsheet
+ 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
+ @title,@subtitle,@fulltitle,@author,@author_format,@date=nil,nil,nil,nil,nil,nil
+ @authors=[]
+ rgx={}
+ rgx[:author]=/^@creator:(?:[ ]+|.+?:author:[ ]+)(.+?)(?:\||\n)/m
+ rgx[:title]=/^@title:[ ]+(.+)/
+ rgx[:subtitle]=/^@title:.+?:subtitle:[ ]+(.+?)\n/m
+ rgx[:date]=/^@date:(?:[ ]+|.+?:published:[ ]+)(\d{4})/m
+ data.each do |para|
+ if para=~ rgx[:title]
+ @title=rgx[:title].match(para)[1]
+ end
+ if para=~ rgx[:subtitle]
+ @subtitle=rgx[:subtitle].match(para)[1]
+ end
+ if para=~ rgx[:author]
+ @author_format=rgx[:author].match(para)[1]
+ end
+ if para=~ rgx[:date]
+ @date=rgx[:date].match(para)[1]
+ end
+ break if @title && @subtitle && @author && @date
+ end
+ @fulltitle=@subtitle ? (@title + ' - ' + @subtitle) : @title
+ if @title \
+ and @author_format
+ 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] <<= { filename: filename, file: file, date: @date, title: @fulltitle, author: creator, page: page, lang: lang }
+ else
+ #p "missing author field: #{@filename} title: #{@title}; author: #{@author_format}"
+ end
+ idx_array[lang]=idx_array[lang].flatten
+ idx_array
+ end
+ end
+ class Index
+ def initialize(idx_array,the_idx)
+ @idx_array,@the_idx=idx_array,the_idx
+ @@the_idx_authors=@the_idx
+ end
+ def capital(txt)
+ txt[0].chr.capitalize + txt[1,txt.length]
+ end
+ def construct_book_author_index
+ idx_array=@idx_array
+ idx_array.each_pair do |lang,idx_array|
+ @@the_idx_authors[lang] ||= {}
+ idx_array.each do |idx|
+ idx[:author][:last_first_format_a].each do |author|
+ author=author.strip
+ if @@the_idx_authors[lang][author].is_a?(NilClass)
+ @@the_idx_authors[lang][author]={ md: [] }
+ end
+ @@the_idx_authors[lang][author][:md] << { filename: idx[:filename], file: idx[:file], author: idx[:author], title: idx[:title], date: idx[:date], page: idx[:page], lang: idx[:lang] }
+ end
+ end
+ end
+ @the_idx=@@the_idx_authors
+ end
+ end
+ class OutputIndex
+ 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
+ @vz=SiSU_Viz::Defaults.new
+ 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}/authors.html"
+ elsif @env.output_dir_structure.by? == :filetype
+ harvest_pth="#{@env.path.webserv}/#{@opt.base_stub}/manifest"
+ file="#{harvest_pth}/authors.#{lng}.html"
+ elsif @env.output_dir_structure.by? == :filename
+ harvest_pth="#{@env.path.webserv}/#{@opt.base_stub}"
+ file="#{harvest_pth}/authors.#{lng}.html"
+ end
+ FileUtils::mkdir_p(harvest_pth) unless FileTest.directory?(harvest_pth)
+ puts "file://#{file}"
+ @output[lng][:html]=File.new(file,'w')
+ 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
+ html_file_open
+ html_head
+ html_alph
+ html_body
+ html_tail
+ html_file_close
+ end
+ def html_head_adjust(lng,type='')
+ css_path,topics='',''
+ if @env.output_dir_structure.by? == :language
+ css_path=(type !~/maintenance/) \
+ ? '../../_sisu/css/harvest.css'
+ : 'harvest.css'
+ topics='topics.html'
+ elsif @env.output_dir_structure.by? == :filetype
+ css_path=(type !~/maintenance/) \
+ ? '../_sisu/css/harvest.css'
+ : 'harvest.css'
+ topics="topics.#{lng}.html"
+ elsif @env.output_dir_structure.by? == :filename
+ css_path=(type !~/maintenance/) \
+ ? '../_sisu/css/harvest.css'
+ : 'harvest.css'
+ topics="topics.#{lng}.html"
+ end
+ ln=SiSU_i18n::Languages.new.language.list
+ harvest_languages=''
+ @the_idx.keys.each do |lng|
+ if @env.output_dir_structure.by? == :language
+ harvest_pth="../../#{lng}/manifest"
+ file="#{harvest_pth}/authors.html"
+ elsif @env.output_dir_structure.by? == :filetype
+ harvest_pth='.'
+ file="#{harvest_pth}/authors.#{lng}.html"
+ end
+ l=ln[lng][:t]
+ harvest_languages += %{<a href="#{file}">#{l}</a>&nbsp;&nbsp;&nbsp;}
+ end
+ sv=SiSU_Env::InfoVersion.instance.get_version
+ <<WOK
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>SiSU Metadata Harvest - Authors</title>
+<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
+<meta name="dc.title" content= "SiSU metadata harvest, Authors - SiSU information Structuring Universe, Structured information Serialised Units" />
+<meta name="dc.subject" content= "document structuring, ebook, publishing, PDF, LaTeX, XML, ODF, SQL, postgresql, sqlite, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, granular search, digital library" />
+<meta name="generator" content="#{sv[:project]} #{sv[:version]} of #{sv[:date_stamp]} (n*x and Ruby!)" />
+<link rel="generator" href="http://www.jus.uio.no/sisu/SiSU" />
+<link rel="stylesheet" href="#{css_path}" type="text/css" />
+<link rel="shortcut icon" href="../_sisu/image/rb7.ico" />
+</head>
+<body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en">
+<a name="top" id="top"></a>
+<a name="up" id="up"></a>
+<a name="start" id="start"></a>
+<h1>SiSU Metadata Harvest - Authors</h1>
+<p>[<a href="../index.html">&nbsp;HOME&nbsp;</a>] also see <a href="#{topics}">SiSU Metadata Harvest - Topics</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.cmd.inspect =~/M/
+ @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.cmd.inspect =~/M/
+ @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>
+#{@vz.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_mnt] << html if @output[lng][:html_mnt].is_a?(File)
+ @output[lng][:html] << html
+ end
+ def do_string_name(lng,attrib,string)
+ f=/^(\S)/.match(string[0])[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}"></p>#{@letter}</a><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
+ end
+ def html_body
+ the_idx=@the_idx
+ the_idx.each_pair do |lng,lng_array|
+ lng_array.sort.each do |a|
+ do_string_name(lng,'',a)
+ name=a[0].sub(/(.+?)(?:,.+|$)/,'\1').gsub(/\s+/,'_')
+ x = %{<p class="author"><a name="#{name}">#{a[0]}</a></p>}
+ if @output[lng][:html_mnt].is_a?(File)
+ @output[lng][:html_mnt] << x
+ end
+ @output[lng][:html] << x
+ works=[]
+ a[1][:md].each do |x|
+ manifest_at=if @env.output_dir_structure.by? == :language
+ manifest_pth="#{@env.path.output}/#{x[:file]}"
+ x[:file] + '.html'
+ elsif @env.output_dir_structure.by? == :filetype
+ manifest_name=x[:file]
+ x[:file] + '.' + lng + '.html'
+ elsif @env.output_dir_structure.by? == :filename
+ "../#{x[:file]}/#{x[:page]}"
+ else '' #error
+ end
+ work=[ "#{x[:date]} #{x[:title]}", %{<p class="publication">#{x[:date]} <a href="#{manifest_at}">#{x[:title]}</a>, #{x[:author][:authors_s]}</p>} ]
+ works<<=(@output[lng][:html_mnt].is_a?(File)) \
+ ? (work.concat([%{<p class="publication">[<a href="#{x[:file]}.sst">src</a>]&nbsp;&nbsp;#{x[:date]} <a href="file://#{manifest_at}">#{x[:title]}</a>, #{x[:author][:authors_s]} -- [<a href="#{x[:file]}.sst">#{x[:file]}.sst</a>]</p>}]))
+ : work
+ end
+ works.sort_by {|x| x[0]}.each do |x|
+ @output[lng][:html] << x[1]
+ @output[lng][:html_mnt] << x[2] if @output[lng][:html_mnt].is_a?(File)
+ end
+ end
+ end
+ end
+ self
+ end
+ def screen_print
+ def cycle
+ the_idx=@the_idx
+ the_idx.sort.each do |a|
+ puts a[0]
+ a[1][:md].each do |x|
+ puts "\t" + x[:file]
+ end
+ end
+ end
+ self
+ end
+ end
+end
+__END__
diff --git a/lib/sisu/v4/harvest_topics.rb b/lib/sisu/v4/harvest_topics.rb
new file mode 100644
index 00000000..ac64c905
--- /dev/null
+++ b/lib/sisu/v4/harvest_topics.rb
@@ -0,0 +1,808 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+ metadata harvest, extract topics and associated writings from document set
+ (topics use topic_register header)
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: simple xml representation (sax style)
+
+=end
+module SiSU_HarvestTopics
+ require_relative 'author_format' # author_format.rb
+ include SiSU_Viz
+ class Songsheet
+ @@the_idx_topics={}
+ def initialize(opt,env)
+ @opt,@env=opt,env
+ @file_list=opt.files
+ end
+ def songsheet
+ puts 'topics:'
+ 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 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,nil,nil,nil,nil,nil
+ rgx={}
+ rgx[:author]=/^@creator:(?:[ ]+|.+?:author:[ ]+)(.+?)(?:\||\n)/m
+ rgx[:title]=/^@title:[ ]+(.+)/
+ rgx[:subtitle]=/^@title:.+?:subtitle:[ ]+(.+?)\n/m
+ rgx[:idx]=/^@classify:.+?:topic_register:[ ]+(.+?)(?:\n\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(/[^;]+/)
+ idxl=[]
+ g.each do |i|
+ i=i.strip
+ idxl << { filename: filename, file: file, rough_idx: i, title: @fulltitle, author: creator, page: page, lang: lang }
+ end
+ idxl
+ else { filename: filename, file: file, rough_idx: @idx_list, title: @fulltitle, author: creator, page: page, lang: lang }
+ end
+ else
+ p "missing required field in #{@filename} - [title]: <<#{@title}>>; [author]: <<#{@author_format}>>; [idx]: <<#{@idx_list}>>" if @opt.cmd.inspect =~/[VM]/
+ end
+ idx_array[lang]=idx_array[lang].flatten
+ idx_array
+ end
+ end
+ class Index
+ 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
+ the_hash=construct_book_topic_hash(the_idx)
+ end
+ def capital(txt)
+ txt_a=txt.scan(/\S+/)
+ tx=''
+ txt_a.each do |txt|
+ tx += txt[0].chr.capitalize + txt[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
+ md={ 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_array|
+ @@the_idx_topics[lang] ||= {}
+ idx_array.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
+ y=@the_a.sort_by { |x| x[0] } #; y.each {|z| puts z}
+ end
+ def construct_book_topic_hash(y)
+ @the_h={}
+ y.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,y|
+ if extract == 0
+ @the_h[x0] ||={ md: [] }
+ @the_h[x0][:md] << y
+ else
+ @the_h[x0] ||={}
+ end
+ #puts ' '*0 + x0
+ if extract >= 1
+ y.each_pair do |x1,y|
+ if extract == 1
+ @the_h[x0][x1] ||={ md: [] }
+ @the_h[x0][x1][:md] << y
+ else
+ @the_h[x0][x1] ||={}
+ end
+ #puts ' '*1 + x1
+ if extract >= 2
+ y.each_pair do |x2,y|
+ if extract == 2
+ @the_h[x0][x1][x2] ||={ md: [] }
+ @the_h[x0][x1][x2][:md] << y
+ else
+ @the_h[x0][x1][x2] ||={}
+ end
+ #puts ' '*2 + x2
+ if extract >= 3
+ y.each_pair do |x3,y|
+ if extract == 3
+ @the_h[x0][x1][x2][x3] ||={ md: [] }
+ @the_h[x0][x1][x2][x3][:md] << y
+ else
+ @the_h[x0][x1][x2][x3] ||={}
+ end
+ #puts ' '*3 + x3
+ if extract == 4
+ y.each_pair do |x4,y|
+ if extract == 4
+ @the_h[x0][x1][x2][x3][x4] ||={ md: [] }
+ @the_h[x0][x1][x2][x3][x4][:md] << y
+ else
+ @the_h[x0][x1][x2][x3][x4] ||={}
+ end
+ #puts ' '*4 + x4
+ if extract == 5
+ y.each_pair do |x5,y|
+ if extract == 5
+ @the_h[x0][x1][x2][x3][x4][x5] ||={ md: [] }
+ @the_h[x0][x1][x2][x3][x4][x5][:md] << y
+ end
+ #puts ' '*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,y|
+ puts ' '*0 + x0 if x0.is_a?(String)
+ if y.is_a?(Hash)
+ y.each_pair do |x1,y|
+ puts ' '*1 + x1 if x1.is_a?(String)
+ if y.is_a?(Hash)
+ y.each_pair do |x2,y|
+ puts ' '*2 + x2 if x2.is_a?(String)
+ if y.is_a?(Hash)
+ y.each_pair do |x3,y|
+ puts ' '*3 + x3 if x3.is_a?(String)
+ if y.is_a?(Hash)
+ y.each_pair do |x4,y|
+ puts ' '*4 + x4 if x4.is_a?(String)
+ if y.is_a?(Hash)
+ y.each_pair do |x5,y|
+ puts ' '*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,y|
+ puts ' '*0 + x0 if x0.is_a?(String)
+ if y.is_a?(Hash)
+ if y.has_key?(:md)
+ y[:md].each { |x| puts ' '*5 + x[:title] }
+ end
+ y.each_pair do |x1,y|
+ puts ' '*1 + x1 if x1.is_a?(String)
+ if y.is_a?(Hash)
+ if y.has_key?(:md)
+ y[:md].each { |x| puts ' '*5 + x[:title] }
+ end
+ y.each_pair do |x2,y|
+ puts ' '*2 + x2 if x2.is_a?(String)
+ if y.is_a?(Hash)
+ if y.has_key?(:md)
+ y[:md].each { |x| puts ' '*5 + x[:title] }
+ end
+ y.each_pair do |x3,y|
+ puts ' '*3 + x3 if x3.is_a?(String)
+ if y.is_a?(Hash)
+ if y.has_key?(:md)
+ y[:md].each { |x| puts ' '*5 + x[:title] }
+ end
+ y.each_pair do |x4,y|
+ puts ' '*4 + x4 if x4.is_a?(String)
+ if y.is_a?(Hash)
+ if y.has_key?(:md)
+ y[:md].each { |x| puts ' '*5 + x[:title] }
+ end
+ y.each_pair do |x5,y|
+ puts ' '*5 + x4 if x4.is_a?(String)
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ class OutputIndex
+ 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
+ @vz=SiSU_Viz::Defaults.new
+ 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)
+ puts "file://#{file}"
+ @output[lng][:html]=File.new(file,'w')
+ if @opt.cmd.inspect =~/[M]/
+ @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,y|
+ lng=x0
+ if x0.is_a?(String)
+ #do_string_name(lng,'lev0',x0)
+ #puts ' '*0 + x0
+ end
+ if y.is_a?(Hash)
+ if y.has_key?(:md)
+ y[:md].each do |x|
+ #do_hash(lng,attrib,x) #lv==0 ?
+ #puts ' '*5 + x[:title]
+ end
+ end
+ y.each_pair do |x1,y|
+ if x1.is_a?(String)
+ do_string_name(lng,'lev0',x1)
+ #puts ' '*1 + x1
+ end
+ if y.is_a?(Hash)
+ if y.has_key?(:md)
+ y[:md].each do |x|
+ do_hash(lng,0,x)
+ #puts ' '*5 + x[:title]
+ end
+ end
+ y.each_pair do |x2,y|
+ if x2.is_a?(String)
+ do_string(lng,'lev1',x2)
+ #puts ' '*2 + x2
+ end
+ if y.is_a?(Hash)
+ if y.has_key?(:md)
+ y[:md].each do |x|
+ do_hash(lng,1,x)
+ #puts ' '*5 + x[:title]
+ end
+ end
+ y.each_pair do |x3,y|
+ if x3.is_a?(String)
+ do_string(lng,'lev2',x3)
+ #puts ' '*3 + x3
+ end
+ if y.is_a?(Hash)
+ if y.has_key?(:md)
+ y[:md].each do |x|
+ do_hash(lng,2,x)
+ #puts ' '*5 + x[:title]
+ end
+ end
+ y.each_pair do |x4,y|
+ if x4.is_a?(String)
+ do_string(lng,'lev3',x4)
+ #puts ' '*4 + x4
+ end
+ if y.is_a?(Hash)
+ if y.has_key?(:md)
+ y[:md].each do |x|
+ do_hash(lng,3,x)
+ #puts ' '*5 + x[:title]
+ end
+ end
+ y.each_pair do |x5,y|
+ if x5.is_a?(String)
+ do_string(lng,'lev4',x5)
+ #puts ' '*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 |lng|
+ if @env.output_dir_structure.by? == :language
+ harvest_pth="../../#{lng}/manifest"
+ file="#{harvest_pth}/topics.html"
+ elsif @env.output_dir_structure.by? == :filetype
+ harvest_pth='.'
+ file="#{harvest_pth}/topics.#{lng}.html"
+ elsif @env.output_dir_structure.by? == :filename
+ harvest_pth='.'
+ file="#{harvest_pth}/topics.#{lng}.html"
+ end
+ l=ln[lng][:t]
+ harvest_languages += %{<a href="#{file}">#{l}</a>&nbsp;&nbsp;&nbsp;}
+ end
+ sv=SiSU_Env::InfoVersion.instance.get_version
+ <<WOK
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>SiSU Metadata Harvest - Topics</title>
+<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
+<meta name="dc.title" content= "SiSU metadata harvest, Topics - SiSU information Structuring Universe, Structured information Serialised Units" />
+<meta name="dc.subject" content= "document structuring, ebook, publishing, PDF, LaTeX, XML, ODF, SQL, postgresql, sqlite, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, granular search, digital library" />
+<meta name="generator" content="#{sv[:project]} #{sv[:version]} of #{sv[:date_stamp]} (n*x and Ruby!)" />
+<link rel="generator" href="http://www.jus.uio.no/sisu/SiSU" />
+<link rel="stylesheet" href="#{css_path}" type="text/css" />
+<link rel="shortcut icon" href="../_sisu/image/rb7.ico" />
+</head>
+<body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en">
+<a name="top" id="top"></a>
+<a name="up" id="up"></a>
+<a name="start" id="start"></a>
+<h1>SiSU Metadata Harvest - Topics</h1>
+<p>[<a href="../index.html">&nbsp;HOME&nbsp;</a>] also see <a href="#{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.cmd.inspect =~/M/
+ @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.cmd.inspect =~/M/
+ @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>
+#{@vz.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)
+ manifest_at=if @env.output_dir_structure.by? == :language
+ hash[:file] + '.html'
+ elsif @env.output_dir_structure.by? == :filetype
+ hash[:file] + '.' + lng + '.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/v2/help.rb b/lib/sisu/v4/help.rb
index 8413aff1..391e722d 100644
--- a/lib/sisu/v2/help.rb
+++ b/lib/sisu/v4/help.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -57,18 +56,19 @@
=end
module SiSU_Help
- require "#{SiSU_lib}/sysenv" # sysenv.rb
+ require_relative 'sysenv' # sysenv.rb
include SiSU_Screen
- require "#{SiSU_lib}/param" # param.rb
+ require_relative 'param' # param.rb
class Help
+ require_relative 'i18n' # i18n.rb
def initialize(request='',color='')
@request,@color=request,color
- if color =~/color_off/; @cX=SiSU_Screen::Ansi.new('k').cX
- else @cX=SiSU_Screen::Ansi.new('yes').cX
- end
+ @cX=(color =~/color_off/) \
+ ? (SiSU_Screen::Ansi.new('k').cX)
+ : (SiSU_Screen::Ansi.new('yes').cX)
fns='help_example_dummy_file_name.sst'
- @env=SiSU_Env::Info_env.new(fns)
- @db=SiSU_Env::Info_db.new
+ @env=SiSU_Env::InfoEnv.new(fns)
+ @db=SiSU_Env::InfoDb.new
m=/.+\/(?:src\/)?(\S+)/im # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m
@output_stub=Dir.pwd[m,1]
end
@@ -158,8 +158,8 @@ module SiSU_Help
end
end
def summary
- print <<WOK
- SiSU, Copyright (C) 1997 - 2010 Ralph Amissah
+ print <<-WOK
+ SiSU, Copyright (C) 1997 - 2012 Ralph Amissah
License GPL version 3 or Later. This program comes with ABSOLUTELY NO WARRANTY;
This is free software, and you are welcome to redistribute it under the conditions of the GPL3 or later.
For more license detail type/enter: "sisu --help license"
@@ -192,11 +192,10 @@ alternatively typing #{@cX.orange}sisu --help#{@cX.off} #{@cX.green}[keyword]#{@
#{@cX.green}license#{@cX.off} sisu --help license
for help type 'sisu --help', 'sisu --help [help request]', 'man sisu', (or see the system or online documentation)
-WOK
- # #{@cX.cyan}sisu_convert#{@cX.off} program for initial (very basic and partial) conversion to sisu file format (html and word97 supported)
+ WOK
end
def abstract
- print <<WOK
+ print <<-WOK
Features:
#{@cX.cyan}(i)#{@cX.off} minimal markup requirement
#{@cX.cyan}(ii)#{@cX.off} single file marked up for multiple outputs
@@ -224,27 +223,18 @@ SiSU was developed in relation to legal documents, and so is strong across a wid
There is more detailed information available on it from:
#{@cX.blue}http://www.jus.uio.no/sisu#{@cX.off}
* plaintext
- * html
+ * HTML
+ * ODT (Open Document Format text)
+ * EPUB
* XML (structured)
- * LaTeX/pdf
- * texinfo
- * sql (at present postgresql & sqlite)
-
-A couple of sample inputs and outputs:
-
-The markup for "War and Peace" (chosen because it is a large text & to test the use of SiSU on Project Gutenberg's plaintext), this is the markup, very little after the headers (there is an insert of their legal notices). Took no time at all, it is a particularly simple text to markup though
-A simple document and a more demanding document
- #{@cX.blue}http://www.jus.uio.no/sisu/sample/war.and.peace.leo.tolstoy.er20 http://www.jus.uio.no/sisu/sample/autonomy.markup1.er30#{@cX.off}
-Some resulting outputs:
- html #{@cX.blue}http://www.jus.uio.no/sisu/war.and.peace.leo.tolstoy/ http://www.jus.uio.no/sisu/autonomy.markup1/#{@cX.off}
- #{@cX.blue}http://www.jus.uio.no/sisu/autonomy.markup1/doc#{@cX.off}
- pdf #{@cX.blue}http://www.jus.uio.no/sisu/war.and.peace.leo.tolstoy/portrait http://www.jus.uio.no/sisu/autonomy.markup1/portrait
- #{@cX.blue}http://www.jus.uio.no/sisu/war.and.peace.leo.tolstoy/landscape http://www.jus.uio.no/sisu/autonomy.markup1/landscape#{@cX.off}
- plaintext #{@cX.blue}http://www.jus.uio.no/sisu/war.and.peace.leo.tolstoy/doc.txt http://www.jus.uio.no/sisu/autonomy.markup1/doc.txt#{@cX.off}
-WOK
+ * LaTeX
+ * PDF (via LaTeX)
+ * TeXinfo
+ * SQL (at postgreSQL & SQLite)
+ WOK
end
def commands
- print <<WOK
+ print <<-WOK
#{@cX.ruby}-a#{@cX.off} #{@cX.green}[filename/wildcard]#{@cX.off} produces plaintext with Unix linefeeds. Without markup, (object numbers are omitted), has footnotes at end of each para‐ graph that contains them. Modifier options available: --footnotes (default) or --endnotes and for linefeeds --unix (default) or --msdos
@@ -333,11 +323,11 @@ WOK
#{@cX.ruby}-D#{@cX.off} #{@cX.ruby}--recreate#{@cX.off} kills data" and drops (postgresql or sqlite) db, tables & indexes, then creates an empty db with tables and indexes [#{@cX.ruby}-d --recreate#{@cX.off} sqlite equivalent]
also see command #{@cX.green}shortcuts#{@cX.off}, and shorthand mappings for multiple flags
-WOK
+ WOK
end
def shortcuts
- cf_defaults=SiSU_Env::Info_processing_flag.new
- print <<WOK
+ cf_defaults=SiSU_Env::InfoProcessingFlag.new
+ print <<-WOK
#{@cX.ruby}Shorthand for multiple flags#{@cX.off}
@@ -358,11 +348,10 @@ WOK
defaults may be changed in active sisurc.yml file under 'flag:'
add -v for verbose mode and -c (color toggle), e.g.
- sisu -2vc [filename or wildcard]
-WOK
+ WOK
end
def modifiers
- print <<WOK
+ print <<-WOK
#{@cX.ruby}Command flag modifiers#{@cX.off}
@@ -374,10 +363,10 @@ WOK
#{@cX.ruby}--no-dagger#{@cX.off} strips output text of editor endnotes~[+ square brackets ]~ denoted by dagger/plus sign
-WOK
+ WOK
end
def misc
- <<WOK
+ <<-WOK
#{@cX.cyan}misc#{@cX.off}
#{@cX.green}-s#{@cX.off} [filename or wildcard] #{@cX.green}spellcheck#{@cX.off} (aspell previously ispell
\t#{@cX.green}mailer examples#{@cX.off}
@@ -389,17 +378,20 @@ WOK
#{@cX.blue}-R #{@cX.off} (yaml|rss) extraction of semantic data into yaml file for auto build of xml feeds (rss, rdf) #{@cX.fuschia}[work area]#{@cX.off}
#{@cX.green}-R #{@cX.off} yaml extraction of semantic data into yaml file for auto build of xml feeds (rss, rdf)
#{@cX.green}-R #{@cX.off} rss creates rss2.0 feed
-WOK
+ WOK
end
def markup
- print <<WOK
+ print <<-WOK
sisu
Note: files for SiSU should be in UTF-8 character encoding.
#{@cX.cyan}Data text markup#{@cX.off} (alternative to available html subset)
- #{@cX.green}% SiSU 0.38#{@cX.off} [statement on first line of document, declared file-type identifier, SiSU markup document, markup used is version 0.38]
- #{@cX.green}:A~#{@cX.off} heading/title [levels :A to :C available (and beneath that 1 to 6)]
+ #{@cX.green}% SiSU 4.00#{@cX.off} [statement on first line of document, declared file-type identifier, SiSU markup document
+
+ #{@cX.green}A~#{@cX.off} heading/title [levels A to C available (and beneath that 1 to 6)]
+
#{@cX.green}1~#{@cX.off}filename heading [segmentation level, levels 1 to 6 available]
+
#{@cX.green}!{#{@cX.off}emphasis#{@cX.green}}!#{@cX.off}
#{@cX.green}*{#{@cX.off}bold text#{@cX.green}}*#{@cX.off}
#{@cX.green}_{#{@cX.off}underscore#{@cX.green}}_#{@cX.off}
@@ -409,18 +401,28 @@ sisu
#{@cX.green},{#{@cX.off}subscript#{@cX.green}},#{@cX.off}
#{@cX.green}+{#{@cX.off}inserted text#{@cX.green}}+#{@cX.off}
#{@cX.green}-{#{@cX.off}strikethrough#{@cX.green}}-#{@cX.off}
+
------------------------------------------
#{@cX.cyan}Indentation and bullets#{@cX.off}
+
#{@cX.green}_1#{@cX.off} indent paragraph one level
+
#{@cX.green}_2#{@cX.off} indent paragraph two steps
+
#{@cX.green}_*#{@cX.off} bullet text
+
#{@cX.green}_1*#{@cX.off} bullet text, first indent
+
------------------------------------------
#{@cX.cyan}Numbered List#{@cX.off} (not to be confused with headings/titles, (document structure))
+
#{@cX.green}##{@cX.off} numbered list numbered list 1., 2., 3, etc.
+
#{@cX.green}_##{@cX.off} numbered list numbered list indented second level a., b., c., d., etc.
+
------------------------------------------
#{@cX.cyan}Endnotes#{@cX.off}
+
#{@cX.green}~{#{@cX.off}footnote/endnote#{@cX.green}}~#{@cX.off} endnote#{@cX.green}~{#{@cX.off}self contained endnote marker & endnote in one#{@cX.green}}~#{@cX.off}
#{@cX.green}~{*#{@cX.off}asterisk footnote/endnote#{@cX.green}}~#{@cX.off}
editor's annotations, square bracket notes
@@ -430,8 +432,10 @@ sisu
alternative endnote pair notation
#{@cX.green}~^#{@cX.off} endnote marker
#{@cX.green}^~#{@cX.off} endnote text following the paragraph in which the marker occurs
+
------------------------------------------
#{@cX.cyan}Links#{@cX.off}
+
http://url.org on its own would be automatically marked up and hyperlinked to itself
#{@cX.green}{#{@cX.off} [text to link] #{@cX.green}}#{@cX.off}http://url.org
#{@cX.green}{#{@cX.off}image.png#{@cX.green}}#{@cX.off}http://url.org
@@ -450,19 +454,24 @@ sisu
if a server host name has been provided/configured, will provide a list of available output types that would be generated using the shortcut command and the markup file provided, i.e. output generated using the command (as configured):
"sisu -3sS markup_source_filename.sst"
using server host, directory stub, filename to compose the link.
+
------------------------------------------
adding fixed names in html, manual location marker/tagging
#{@cX.green}*~[name]#{@cX.off} <a name="[name]">
+
------------------------------------------
#{@cX.green}~##{@cX.off} unnumbered paragraph (place marker at end of paragraph)
#{@cX.green}-##{@cX.off} unnumbered paragraph, delete when not required (place marker at end of paragraph) [used in dummy headings, eg. for segmented html]
+
------------------------------------------
manual page breaks (LaTeX/pdf)
#{@cX.green}<:pb>#{@cX.off} page break, which breaks a page, starting a new page in single column text and a new column in double column text
#{@cX.green}<:pn>#{@cX.off} page new, which starts a new page, in both single and double column text (leaving an empty column in double column text if necessary).
Note: page breaks are usually introduced to pdfs either as header instructions, indicating that pages should break at given levels
+
------------------------------------------
#{@cX.cyan}Composite documents#{@cX.off}
+
It is possible to build a document by creating a master document that requires other documents. The documents required may complete documents that could be generated independently, or they could be markup snippets, prepared so as to be easily available to be placed within another text. If the calling document is a master document (built mainly from other documents), it should be named with the suffix #{@cX.blue}.ssm#{@cX.off} Within this document you would provide information on the other documents that should be included within the text. These may be other documents that would be processed in a regular way, or markup bits prepared only for inclusion within a master document #{@cX.blue}.sst#{@cX.off} regular markup file, or #{@cX.blue}.ssi#{@cX.off} (insert/information) A secondary file of the composite document is built prior to processing with the same prefix and the suffix #{@cX.blue}.ssm.sst#{@cX.off}
#{@cX.cyan}#basic sisu markup alternatives#{@cX.off}
@@ -494,16 +503,14 @@ sisu
general text markup: headings; endnotes; tables (which also includes a note on preformatted text)
configuration and customisation
document or site wide customisation: customise; skin
-WOK
+ WOK
help_markup
-# {../_sisu/image/tux.png http://www.jus.uio.no/sisu/ w=64 c=\"a better way\" }:image depreciated image eg
-# <!image http://www.jus.uio.no/sisu/ ../_sisu/image/tux.png width=\"64\" height=\"80\" !> old form
end
def example
help_markup
end
def example_v1
- print <<WOK
+ print <<-WOK
% SiSU 1.0
@title: Working Sample Document
@@ -522,9 +529,9 @@ WOK
@links: { SiSU }http://www.jus.uio.no/sisu { FSF }http://www.fsf.org
-:A~ A Sample Document
+A~ A Sample Document
-:B~ just for fun
+B~ just for fun
1~ This is Chapter One or Article One
@@ -543,11 +550,11 @@ _1 for a listing type: sisu ~ commands
_1 for an outline of sisu markup type: sisu ~ markup
The example ends here.
-WOK
+ WOK
help_markup
end
def example_v2
- print <<WOK
+ print <<-WOK
% SiSU 2.0
@title: Working Sample Document
@@ -570,9 +577,9 @@ WOK
@links:
{ SiSU }http://www.jus.uio.no/sisu { FSF }http://www.fsf.org
-:A~ @title @author
+A~ @title @author
-:B~ just for fun
+B~ just for fun
1~ This is Chapter One or Article One
@@ -591,118 +598,94 @@ _1 for a listing type: sisu ~ commands
_1 for an outline of sisu markup type: sisu ~ markup
The example ends here.
-WOK
+ WOK
help_markup
end
def headers
- print <<WOK
+ print <<-WOK
Header tags appear at the beginning of a document and provide meta information on the document (such as the Dublin Core), or information as to how the document as a whole is to be processed.
All header instructions take either the form #{@cX.green}@headername:#{@cX.off} followed on the next line by an indented sub-category header if any #{@cX.green}:sub-headername:#{@cX.off}.
#{@cX.green}@indentifier:#{@cX.off} information or instructions
where the #{@cX.green}"identifier"#{@cX.off} is a tag recognised by the program, and the #{@cX.green}"information"#{@cX.off} or #{@cX.green}"instructions"#{@cX.off} belong to the tag/indentifier specified
- Note: a header where used should only be used once; all headers apart from @title: are optional; the @structure: or 0~toc header is used to describe document structure, and can be useful to know.
-This is a sample header (#{@cX.fuschia}Dublin Core in fuschia,#{@cX.off} #{@cX.cyan}other information headers in cyan,#{@cX.off} #{@cX.ruby}markup instructions in red#{@cX.off}):
-
-#{@cX.fuschia}@title:#{@cX.off} My Title - This is now the Title of the Document and used as such
- #{@cX.cyan}:subtitle:#{@cX.off} The Subtitle if any
-
-#{@cX.fuschia}@creator:#{@cX.off}
- #{@cX.fuschia}:author:#{@cX.off} Surname, Other names (if more than one author separate author names with a semi colon, if name is of an institution just write name or the name contains a comma enclose in quotation marks)
-
-#{@cX.fuschia}@classify:#{@cX.off}
- #{@cX.fuschia}:topic_register:#{@cX.off} [e.g.:] text markup language; application:text processing;output:html|xml|latex|pdf|sql
-
-#{@cX.fuschia}@subject:#{@cX.off} (whatever your subject)
-
-#{@cX.fuschia}@description:#{@cX.off}
-
-#{@cX.fuschia}@publisher:#{@cX.off}
-
-#{@cX.fuschia}@contributor:#{@cX.off}
-
-#{@cX.fuschia}@translator:#{@cX.off} [or @translated_by:]
-
-#{@cX.fuschia}@illustrator:#{@cX.off} [or @illustrated_by:]
-
-#{@cX.fuschia}@prepared_by:#{@cX.off} [or @digitized_by:]
-
-#{@cX.fuschia}@date:#{@cX.off} 2000-08-27
-\t[ also #{@cX.fuschia}@date.created:#{@cX.off} #{@cX.fuschia}@date.issued:#{@cX.off} #{@cX.fuschia}@date.available:#{@cX.off} #{@cX.fuschia}@date.valid:#{@cX.off} #{@cX.fuschia}@date.modified:#{@cX.off} ]
-
-#{@cX.fuschia}@type:#{@cX.off} article
-
-#{@cX.fuschia}@format:#{@cX.off}
-
-#{@cX.fuschia}@identifier:#{@cX.off}
-
-#{@cX.fuschia}@source:#{@cX.off}
-
-#{@cX.fuschia}@language:#{@cX.off} [or @language.document:] [country code for language if available, or language, English, en is the default setting] (en - English, fr - French, de - German, it - Italian, es - Spanish, pt - Portuguese, sv - Swedish, da - Danish, fi - Finnish, no - Norwegian, is - Icelandic, nl - Dutch, et - Estonian, hu - Hungarian, pl - Polish, ro - Romanian, ru - Russian, el - Greek, uk - Ukranian, tr - Turkish, sk - Slovak, sl - Slovenian, hr - Croatian, cs - Czech, bg - Bulgarian ) [however, encodings are not available for all of the languages listed.]
-
-#{@cX.fuschia}@language.original:#{@cX.off}
+ Note: a header where used should only be used once; all headers apart from #{@cX.ruby}@title:#{@cX.off} are optional.
+
+#{@cX.ruby}@title:#{@cX.off} My Title - This is now the Title of the Document and used as such
+ #{@cX.cyan}:subtitle:#{@cX.off} The Subtitle if any
+
+#{@cX.ruby}@creator:#{@cX.off}
+ #{@cX.cyan}:author:#{@cX.off} Surname, Other names (if more than one author separate author names with a semi colon, if name is of an institution just write name or the name contains a comma enclose in quotation marks)
+ #{@cX.cyan}:contributor:#{@cX.off}
+ #{@cX.cyan}:translator:#{@cX.off} [or :translated_by:]
+ #{@cX.cyan}:illustrator:#{@cX.off} [or :illustrated_by:]
+ #{@cX.cyan}:prepared_by:#{@cX.off} [or :digitized_by:]
+
+#{@cX.ruby}@date:#{@cX.off}
+ #{@cX.cyan}:published:#{@cX.off}
+ #{@cX.cyan}:created:#{@cX.off}
+ #{@cX.cyan}:issued:#{@cX.off}
+ #{@cX.cyan}:available:#{@cX.off}
+ #{@cX.cyan}:valid:#{@cX.off}
+ #{@cX.cyan}:modified:#{@cX.off}
+
+#{@cX.ruby}@rights:#{@cX.off}
+ #{@cX.cyan}:copyright:#{@cX.off} Author's name, all rights reserved
+ #{@cX.cyan}:license:#{@cX.off} public domain, copyleft, creative commons variant, etc.
+
+#{@cX.ruby}@classify:#{@cX.off}
+ #{@cX.cyan}:topic_register:#{@cX.off} [e.g.:] text markup language; application:text processing;output:html|xml|latex|pdf|sql
+ #{@cX.cyan}:subject:#{@cX.off} (whatever your subject)
+ #{@cX.cyan}:keywords:#{@cX.off}
+ #{@cX.cyan}:loc:#{@cX.off} [Library of Congress classification]
+ #{@cX.cyan}:dewey:#{@cX.off} [Dewey classification]
+
+#{@cX.ruby}@identifier:#{@cX.off}
+ #{@cX.cyan}:isbn:#{@cX.off}
+ #{@cX.cyan}:oclc:#{@cX.off}
+
+#{@cX.ruby}@notes:#{@cX.off}
+ #{@cX.cyan}:description:#{@cX.off}
+ #{@cX.cyan}:abstract:#{@cX.off}
+ #{@cX.cyan}:comment:#{@cX.off}
+ #{@cX.cyan}:coverage:#{@cX.off}
+ #{@cX.cyan}:relation:#{@cX.off}
+ #{@cX.cyan}:source:#{@cX.off}
+ #{@cX.cyan}:history:#{@cX.off}
+ #{@cX.cyan}:type:#{@cX.off}
+ #{@cX.cyan}:format:#{@cX.off}
+ #{@cX.cyan}:prefix:#{@cX.off}
+ #{@cX.cyan}:suffix:#{@cX.off}
+
+#{@cX.ruby}@publisher:#{@cX.off}
+
+#{@cX.ruby}@language:#{@cX.off} [or @language.document:] [country code for language if available, or language, English, en is the default setting] (en - English, fr - French, de - German, it - Italian, es - Spanish, pt - Portuguese, sv - Swedish, da - Danish, fi - Finnish, no - Norwegian, is - Icelandic, nl - Dutch, et - Estonian, hu - Hungarian, pl - Polish, ro - Romanian, ru - Russian, el - Greek, uk - Ukranian, tr - Turkish, sk - Slovak, sl - Slovenian, hr - Croatian, cs - Czech, bg - Bulgarian ) [however, encodings are not available for all of the languages listed.]
+
+#{@cX.ruby}@language.original:#{@cX.off}
original language in which the work was published
-#{@cX.fuschia}@papersize:#{@cX.off}
-(A4|US_letter|book_B5|book_A5|US_legal)
-
-#{@cX.fuschia}@relation:#{@cX.off}
-
-#{@cX.fuschia}@coverage:#{@cX.off}
-
-#{@cX.fuschia}@rights:#{@cX.off} copyright, all rights reserved, public domain, copyleft, creative commons variant, etc.
-
-#{@cX.cyan}@owner:#{@cX.off}
-
-#{@cX.cyan}@keywords:#{@cX.off} text document generation processing management latex pdf structured xml citation [your keywords here, used for example by rss feeds, and in sql searches]
-
-#{@cX.cyan}@abstract:#{@cX.off} [paper abstract, placed after table of contents]
-
-#{@cX.cyan}@comment:#{@cX.off} [...]
-
-#{@cX.cyan}@catalogue:#{@cX.off} #{@cX.green}loc=#{@cX.off}[Library of Congress classification]; #{@cX.green}dewey=#{@cX.off}[Dewey classification]; #{@cX.green}isbn=#{@cX.off}[ISBN]; #{@cX.green}pg=#{@cX.off}[Project Gutenberg text number]
-
-#{@cX.cyan}@classify_loc:#{@cX.off} [Library of Congress classification]
-
-#{@cX.cyan}@classify_dewey:#{@cX.off} [Dewey classification]
-
-#{@cX.cyan}@classify_isbn:#{@cX.off} [ISBN]
-
-#{@cX.cyan}@classify_pg:#{@cX.off} [Project Gutenberg text number]
-
-#{@cX.cyan}@prefix_a:#{@cX.off} [prefix is placed just before table of contents - not implemented]
-
-#{@cX.cyan}@prefix_b:#{@cX.off} or #{@cX.cyan}@prefix:#{@cX.off} [prefix is placed just after table of contents]
-
-#{@cX.cyan}@rcs:#{@cX.off} $Id$ [used by rcs or cvs to embed version (revision control) information into document, rcs or cvs can usefully provide a history of updates to a document ]
-
-#{@cX.ruby}@structure:#{@cX.off} PART; CHAPTER; SECTION; ARTICLE; none; none;
-optional, document structure can be defined by words to match or regular expression (the regular expression is assumed to start at the beginning of a line of text i.e. ^) default markers :A~ to :C~ and 1~ to 6~ can be used within text instead, without this header tag, and may be used to supplement the instructions provided in this header tag if provided (@structure: is a synonym for @toc:)
-
-#{@cX.ruby}@level:#{@cX.off} newpage=3; breakpage=4 [paragraph level, used by latex to breakpages, the page is optional eg. in newpage]
-
-#{@cX.ruby}@markup:#{@cX.off} num_top=4 [various markup instructions, eg: num_top=4 headings tobe numbered, starting at heading level 4... the default is to provide 3 levels, as in 1 level 4, 1.1 level 5, 1.1.1 level 6, markup to be merged within level]
-
-#{@cX.ruby}@bold:#{@cX.off} [regular expression of words/phrases to be made bold]
-
-#{@cX.ruby}@italics:#{@cX.off} [regular expression of words/phrases to italize]
-
-#{@cX.ruby}@vocabulary:#{@cX.off} name of taxonomy/vocabulary/wordlist to use against document
-
-#{@cX.ruby}@skin:#{@cX.off} skin_doc_[name_of_desired_document_skin]
-
-#{@cX.ruby}@links:#{@cX.off} { SiSU }http://www.jus.uio.no/sisu/; { FSF }http://www.fsf.org
-
-#{@cX.ruby}@@promo:#{@cX.off} sisu, ruby, search_libre_docs, open_society [places content in right pane in html, makes use of list.yml and promo.yml, commented out sample in document sample: free_as_in_freedom.richard_stallman_crusade_for_free_software.sam_williams.sst]
+#{@cX.ruby}@links:#{@cX.off}
+ { SiSU }http://www.jus.uio.no/sisu/
+ { FSF }http://www.fsf.org
+
+#{@cX.ruby}@make:#{@cX.off}
+ #{@cX.cyan}:breaks:#{@cX.off} new=:B; break=1
+ #{@cX.cyan}:bold:#{@cX.off} [regular expression of words/phrases to be made bold]
+ #{@cX.cyan}:italics:#{@cX.off} [regular expression of words/phrases to italize]
+ #{@cX.cyan}:home_button_image:#{@cX.off} {free_as_in_freedom.png }http://stallman.org/
+ #{@cX.cyan}:home_button_text:#{@cX.off} {Free Culture}http://www.free-culture.cc; {Lawrence Lessig}http://www.lessig.org
+ #{@cX.cyan}:footer:#{@cX.off} {Free Culture}http://www.free-culture.cc; {Lawrence Lessig}http://www.lessig.org
+ #{@cX.cyan}:headings:#{@cX.off} PART; CHAPTER; Section; Article;
+ #{@cX.grey}% optional, document structure can be defined by words to match or regular expression (the regular expression is assumed to start at the beginning of a line of text i.e. ^) default markers A~ to C~ and 1~ to 6~ can be used within text instead, without this header tag, and may be used to supplement the instructions provided in this header tag if provided#{@cX.off}
+ #{@cX.cyan}:papersize:#{@cX.off} (A4|US_letter|book_B5|book_A5|US_legal)
+ #{@cX.cyan}:markup:#{@cX.off} num_top=4 [various markup instructions, eg: num_top=4 headings tobe numbered, starting at heading level 4... the default is to provide 3 levels, as in 1 level 4, 1.1 level 5, 1.1.1 level 6, markup to be merged within level]
+ #{@cX.cyan}:promo:#{@cX.off} sisu, ruby, search_libre_docs, open_society [places content in right pane in html, makes use of list.yml and promo.yml, commented out sample in document sample: free_as_in_freedom.richard_stallman_crusade_for_free_software.sam_williams.sst]
#{@cX.grey}% header ends here, NB only @title: is mandatory [this would be a comment]#{@cX.off}
-#{@cX.grey}% NOTE: headings/levels below refer to 0.38 expermental markup
- (a conversion script provided in sisu-examples, modify.rb makes conversion between 0.37 and 0.38 markup simple)#{@cX.off}
-#{@cX.blue}:A~#{@cX.off} Top level heading [this is usually the same as the title @title: ]
+#{@cX.blue}A~#{@cX.off} Top level heading [this is usually the same as the title @title: ]
-#{@cX.blue}:B~#{@cX.off} Second level heading [this is a heading level divider]
+#{@cX.blue}B~#{@cX.off} Second level heading [this is a heading level divider]
-#{@cX.blue}:C~#{@cX.off} Third level heading [this is a heading level divider]
+#{@cX.blue}C~#{@cX.off} Third level heading [this is a heading level divider]
#{@cX.blue}1~#{@cX.off} Top level heading preceding substantive text of document or sub-heading 5, the heading level that would normally be marked 1. or 2. or 3. etc. in a document
@@ -710,11 +693,11 @@ optional, document structure can be defined by words to match or regular express
#{@cX.blue}3~#{@cX.off} Third level heading preceding substantive text of document, that would normally be marked 1.1.1 or 1.1.2 or 1.2.1 or 2.1.1 etc. in a document
-WOK
+ WOK
help_markup
end
def customise
- print <<WOK
+ print <<-WOK
There are a number of files that control the appearance of a site or a document i.e.
#{@cX.blue}(i)#{@cX.off} files that control #{@cX.green}site-wide appearance#{@cX.off}:
@@ -745,37 +728,37 @@ WOK
if you have a body of documents the easiest way to give them a particular appearance/skin, is to associate that directory with a skin, all files in that directory take on the specified appearance, changing appearance of documents once directories are set up is as simple as copying the files from one directory to another (or renaming the directory); or associating the directory with a different skin.
see also directories
-WOK
+ WOK
end
def configure
- print <<WOK
+ print <<-WOK
see the following topics
install
setup
and note for initial configuration it is necessary to run:
sisu -C
(this places the default CSS files and DTDs in place)
-WOK
+ WOK
end
def path
help_env
- puts <<WOK
+ puts <<-WOK
If you have problems check permissions (and if in home directory ownership).
#{@cX.green}directory paths as currently set#{@cX.off}:
output docs: #{@cX.blue}#{@env.path.webserv}#{@cX.off}
cgi scripts: #{@cX.blue}#{@env.path.cgi}#{@cX.off}
- processing: #{@cX.blue}#{@env.path.processing}#{@cX.off}
- sisu meta markup: #{@cX.blue}#{@env.path.dal}#{@cX.off}
- html tuning: #{@cX.blue}#{@env.path.tune}#{@cX.off}
- latex: #{@cX.blue}#{@env.path.tex}#{@cX.off}
- texinfo: #{@cX.blue}#{@env.path.texi}#{@cX.off}
+ processing: #{@cX.blue}#{@env.processing_path.processing}#{@cX.off}
+ sisu meta markup: #{@cX.blue}#{@env.processing_path.dal}#{@cX.off}
+ html tuning: #{@cX.blue}#{@env.processing_path.tune}#{@cX.off}
+ latex: #{@cX.blue}#{@env.processing_path.tex}#{@cX.off}
+ texinfo: #{@cX.blue}#{@env.processing_path.texi}#{@cX.off}
images:
source: #{@cX.blue}#{@env.path.image_source}#{@cX.off}
- latex source: #{@cX.blue}#{@env.path.image_source_tex}#{@cX.off}
+ latex source: #{@cX.blue}#{@env.path.image_source_include}#{@cX.off}
note images are also sourced from within your pwd - #{@cX.blue}#{Dir.pwd}/_sisu/image#{@cX.off} if it exists
- #{@cX.grey}[ texinfo: #{@env.path.texinfo} - check duplication ]#{@cX.off}
+ #{@cX.grey}[ texinfo: #{@env.processing_path.texinfo} - check duplication ]#{@cX.off}
#{@cX.green}resource configuraton files#{@cX.off} to change the paths specified above, are searched for in the following order:
under the current SiSU markup data directory: #{@cX.blue}#{Dir.pwd}/_sisu/sisurc.yml#{@cX.off}
@@ -801,12 +784,12 @@ If you have problems check permissions (and if in home directory ownership).
See also
sisu --help directory
-WOK
+ WOK
help_env
end
def directories
help_env
- print <<WOK
+ print <<-WOK
the directory structure used by sisu is controlled by the configuration files #{@cX.blue}sisurc.yml#{@cX.off}
@@ -854,11 +837,11 @@ WOK
(d) #{@cX.green}processing directories#{@cX.off} sisu creates a number of processing directories,
where these should be located can be modified in #{@cX.green}~/.sisu/sisurc.yml#{@cX.off}
work directories include the following:
- root working directory #{@cX.blue}#{@env.path.processing}#{@cX.off}
- metaverse intermediate markup #{@cX.blue}#{@env.path.dal}#{@cX.off}
- tune html (for special html/navigation pages) #{@cX.blue}#{@env.path.tune}#{@cX.off}
- tex for latex and pdf #{@cX.blue}#{@env.path.tex}#{@cX.off}
- texinfo for texinfo and info files #{@cX.blue}#{@env.path.texi}#{@cX.off}
+ root working directory #{@cX.blue}#{@env.processing_path.processing}#{@cX.off}
+ metaverse intermediate markup #{@cX.blue}#{@env.processing_path.dal}#{@cX.off}
+ tune html (for special html/navigation pages) #{@cX.blue}#{@env.processing_path.tune}#{@cX.off}
+ tex for latex and pdf #{@cX.blue}#{@env.processing_path.tex}#{@cX.off}
+ texinfo for texinfo and info files #{@cX.blue}#{@env.processing_path.texi}#{@cX.off}
These files are usually used only for processing and removed. There is a maintenance flag to keep them.
@@ -892,30 +875,30 @@ WOK
See also
sisu --help path
-WOK
+ WOK
help_env
end
def program_found?(program)
if program
- rc=if SiSU_Env::Info_settings.new.program?(program)
- SiSU_Env::Info_settings.new.program?(program)
+ rc=if SiSU_Env::InfoSettings.new.program?(program)
+ SiSU_Env::InfoSettings.new.program?(program)
else ''
end
- if program =='rmagick'; program='identify' #rmagick is ruby lib uses imagemagick's identify
+ if program =='rmagick' then program='identify' #rmagick is ruby lib uses imagemagick's identify
end
- bin=if SiSU_Env::System_call.new.program_found?(program)
- SiSU_Env::System_call.new.program_found?(program)
+ bin=if SiSU_Env::SystemCall.new.program_found?(program)
+ SiSU_Env::SystemCall.new.program_found?(program)
else 'false'
end
else bin,rc='false','false'
end
- if program; "#{@cX.blue}#{program}#{@cX.off} bin: #{@cX.brown}#{bin}#{@cX.off} rc: #{@cX.brown}#{rc}#{@cX.off}"
- else "bin: #{@cX.brown}#{bin}#{@cX.off} rc: #{@cX.brown}#{rc}#{@cX.off}"
- end
+ (program) \
+ ? ("#{@cX.blue}#{program}#{@cX.off} bin: #{@cX.brown}#{bin}#{@cX.off} rc: #{@cX.brown}#{rc}#{@cX.off}")
+ : ("bin: #{@cX.brown}#{bin}#{@cX.off} rc: #{@cX.brown}#{rc}#{@cX.off}")
end
def sisu_version
- version=SiSU_Env::Info_version.instance.get_version
- rb_ver=SiSU_Env::Info_version.instance.rbversion
+ version=SiSU_Env::InfoVersion.instance.get_version
+ rb_ver=SiSU_Env::InfoVersion.instance.rbversion
if version[:version]
SiSU_Screen::Ansi.new('-v',version[:project],version[:version],version[:date_stamp],version[:date],rb_ver).version
else puts 'SiSU version information not available'
@@ -923,49 +906,49 @@ WOK
end
def rhost
@ls=leading_spaces=' '*49
- @rhost=SiSU_Env::Info_remote_host.new.rhost
+ @rhost=SiSU_Env::InfoRemoteHost.new.rhost
def r1
- if @rhost.r1; @rhost.r1 + "\n"
- else ''
- end
+ (@rhost.r1) \
+ ? @rhost.r1 + "\n"
+ : ''
end
def r2
- if @rhost.r2; @ls + @rhost.r2 + "\n"
- else ''
- end
+ (@rhost.r2) \
+ ? @ls + @rhost.r2 + "\n"
+ : ''
end
def r3
- if @rhost.r3; @ls + @rhost.r3 + "\n"
- else ''
- end
+ (@rhost.r3) \
+ ? @ls + @rhost.r3 + "\n"
+ : ''
end
def r4
- if @rhost.r4; @ls + @rhost.r4 + "\n"
- else ''
- end
+ (@rhost.r4) \
+ ? @ls + @rhost.r4 + "\n"
+ : ''
end
def r5
- if @rhost.r5; @ls + @rhost.r5 + "\n"
- else ''
- end
+ (@rhost.r5) \
+ ? @ls + @rhost.r5 + "\n"
+ : ''
end
def r6
- if @rhost.r6; @ls + @rhost.r6 + "\n"
- else ''
- end
+ (@rhost.r6) \
+ ? @ls + @rhost.r6 + "\n"
+ : ''
end
def note
msg='(remote settings user and host set in sisurc.yml under remote:)'
- if @rhost.r1; @ls + msg
- else msg
- end
+ (@rhost.r1) \
+ ? @ls + msg
+ : msg
end
self
end
def environment
- cf_defaults=SiSU_Env::Info_processing_flag.new
+ cf_defaults=SiSU_Env::InfoProcessingFlag.new
sisu_version
- x =<<WOK
+ x =<<-WOK
#{@cX.green}current and output directories#{@cX.off}
user: #{@cX.blue}#{@env.user}#{@cX.off}
home: #{@cX.blue}#{@env.path.home}#{@cX.off}
@@ -992,7 +975,7 @@ WOK
papersize set (LaTeX/pdf): #{@cX.blue}#{@env.papersize}#{@cX.off}
(digest and papersize can be changed in sisurc.yml under default:)
#{@cX.green}intermediate processing#{@cX.off}
- processing directory: #{@cX.blue}#{@env.path.processing}#{@cX.off}
+ processing directory: #{@cX.blue}#{@env.processing_path.processing}#{@cX.off}
(to keep processing output, use -M flag)
#{@cX.green}programs selected for viewing output#{@cX.off}
text editor: #{@cX.blue}#{@env.program.text_editor}#{@cX.off}
@@ -1022,16 +1005,16 @@ WOK
sisu -5 #{@cX.blue}#{cf_defaults.cf_5}#{@cX.off}
(defaults may be changed in active sisurc.yml file under flag:)
#{@cX.green}special powers, risky operations set:#{@cX.off}
- zap (delete output directories) #{@cX.blue}#{SiSU_Env::Info_settings.new.permission?('zap')}#{@cX.off}
- css copy (copy over css files) #{@cX.blue}#{SiSU_Env::Info_settings.new.permission?('css_modify')}#{@cX.off}
+ zap (delete output directories) #{@cX.blue}#{SiSU_Env::InfoSettings.new.permission?('zap')}#{@cX.off}
+ css copy (copy over css files) #{@cX.blue}#{SiSU_Env::InfoSettings.new.permission?('css_modify')}#{@cX.off}
(true/false defaults may be changed in active sisurc.yml file under permissions_set:)
NOTE: for HELP type 'sisu --help', 'sisu --help [help request]', 'man sisu', (or see the system or online documentation)
-WOK
-print x
+ WOK
+ print x
end
def dublin_core
- print <<WOK
+ print <<-WOK
@title:
@subtitle: [is added to title for purposes of Dublin Core description]
@@ -1066,10 +1049,10 @@ print x
@rights:
-WOK
+ WOK
end
def headings
- print <<WOK
+ print <<-WOK
These are not required, a header is quicker to prepare if a documents structure can be defined by matching words or a regular expression, see headers).
@structure: PART; CHAPTER; SECTION; ARTICLE; none; none;
@@ -1078,11 +1061,7 @@ structure can be defined by a match words or regular expression (the regular exp
The following heading or level (structuring) defaults are available (for use instead of or together with @structure: header):
- 1~ 2~ 3~ 4~ 5~ 6~
-
-or, [0.38]
-
- :A~ :B~ :C~ 1~ 2~ 3~
+ A~ B~ C~ 1~ 2~ 3~
Heading tags take either of the forms above, ranging from 1-6
@@ -1094,31 +1073,11 @@ segments (in html output) are by default created on level 4
assigned a file name automatically according to the title number,
unless you explicitly specify otherwise)
-eg.
-
-% SiSU 0.16 - 0.37
-
-1~ Document Title
-
-2~ Document Subtitle whatever it is
-
-3~ Part
-
-4~ Chapter
-
-5~ Heading
+A~ Document Title
-6~ sub-heading
+B~ Document Subtitle whatever it is
-in the 0.38 notation this maps to:
-
-% SiSU 0.38
-
-:A~ Document Title
-
-:B~ Document Subtitle whatever it is
-
-:C~ Part
+C~ Part
1~ Chapter
@@ -1126,8 +1085,6 @@ in the 0.38 notation this maps to:
3~ sub-heading
-(a conversion script provided in sisu-examples, modify.rb makes conversion between 0.37 and 0.38 markup simple)
-
Normal text would follow each heading level as appropriate, though it is most usual to start with ordinary writing beneath level 4 as it is at this level that segments are created.
Automatic numbering of paragraphs is usually set to start at level 4 trough level 6 and takes the form 1. then 1.1 then 1.1.1 this being given as a Header tag 0~ There may be up to 6 levels in a document,
@@ -1141,13 +1098,13 @@ the words can be used to identify the levels in a header tag:
0~toc Part; Chapter; Section; Article; none; none
instead of providing individual heading tags
-sisu structure, (0.38) alternative notation, A,B,C,1,2,3 mapping to 1,2,3,4,5,6
+sisu structure, notation, A,B,C,1,2,3
SiSU has in effect two sets of levels to be considered
- 1-3 headings/levels, (A-C [0.38]) pre-ordinary paragraphs /pre-substantive text, and
+ A-C pre-ordinary paragraphs /pre-substantive text, and
- 4-6 headings/levels, (1-3 [0.38]) levels which are followed by ordinary text.
+ 1-3 levels which are followed by ordinary text.
This may be conceptualised as levels A,B,C, 1,2,3, and using such letter number notation, in effect:
@@ -1159,16 +1116,30 @@ sisu structure, (0.38) alternative notation, A,B,C,1,2,3 mapping to 1,2,3,4,5,6
on the positive side: (a) the A,B,C,1,2,3 alternative makes explicit an aspect of structuring documents in SiSU that is not otherwise obvious to the newcomer (though it appears more complicated, is more in your face and likely to be understood fairly quickly); (b) the substantive text follows levels 1,2,3 and it is 'nice' to do most work in those levels
-
-WOK
+ WOK
end
def languages
- puts <<WOK
+ lang=SiSU_i18n::Languages.new.language.table
+ lang.each_value do |lng|
+ if lng[:t] == lng[:n]
+ puts "#{lng[:c]}: #{lng[:t]}"
+ else
+ puts "#{lng[:c]}: #{lng[:t]} (#{lng[:n]})"
+ end
+ end
+ puts <<-WOK
+
+ Multi-language Document File Naming and Directory Mapping
- Multi-language Document File Naming and Directory Mapping
+ A list of language codes and languages that may be available for most output formats. These are for the most part ISO 639/1 and where there is a departure it follows those made by po4a, and the languages supported will be limited (at this time) to those supported by polyglossia. (SiSU markup text is stored in Unicode so some output formats are served by this, for example, html and sql had no problem with Chinese, pdfs would be a problem as this is not (yet?) suported by xetex and polyglossia. SiSU parses left to right and would have problems with right to left languages.)
- If the same document exists in different language versions, and it is desired that the published language versions should reside in the same output directory, the following filenaming convention should be observed, using Spannish as the sample language code (es) [it is very likley the use of country codes as language codes will be changed or extended in future] [filename]~[language code].sst
+ If the same document exists in different language versions, a directory structure, or a filenaming convention may be followed. Using Spannish as the sample language code (es) [filename]~[language code].sst
+ The simplest now is to place each document in a sub-directory which has the language code as a name, if this convention is used it is preferable that all files are placed by language in the appropriate language sub-directory ... e.g.
+ ./en/filename.sst
+ ./es/filename.sst
+
+ Alternatively files may all be placed in the same directory with the language and named using a tilde and the language code as shown:
filename~es.sst
within sisurc.yml under the heading
@@ -1192,10 +1163,10 @@ WOK
Selecting this form of filename will overide other language settings including the language header within a document.
-WOK
+ WOK
end
def endnotes
- print <<WOK
+ print <<-WOK
(1) Footnote/endnotes tags take a number of possible forms, the simplest being to embed an endnote within your text~{ this would appear as an endnote, and would have an automatically assigned number }~ Embedded endnotes~{this is an endnote}~ and at the end of the paragraph~{* an asterisk marked note }~ writing the endnote:~{another endnote}~
@@ -1208,10 +1179,10 @@ WOK
^~ another endnote
-WOK
+ WOK
end
def tables
- print <<WOK
+ print <<-WOK
#{@cX.green}table{ [number of columns] [column width %];[column width %]#{@cX.off}
@@ -1248,6 +1219,13 @@ preformatted text
#{@cX.green}}poem#{@cX.off}
#{@cX.grey}----#{@cX.off}
+#{@cX.green}block{#{@cX.off}
+
+ [Text here]
+
+#{@cX.green}}block#{@cX.off}
+#{@cX.grey}----#{@cX.off}
+
#{@cX.green}group{#{@cX.off}
[Text here]
@@ -1261,18 +1239,17 @@ preformatted text
#{@cX.green}}code#{@cX.off}
-WOK
+ WOK
end
def modules
- print <<WOK
+ print <<-WOK
#{@cX.ruby}IGNORE#{@cX.off}
-WOK
+ WOK
end
- def install
- #% system configuration
- print <<WOK
+ def install #% system configuration
+ print <<-WOK
#{@cX.green}Install SiSU#{@cX.off}
Presumably if you are reading this interactively you have a copy of SiSU already installed, nevertheless here are a few notes.
@@ -1306,7 +1283,7 @@ WOK
lib (site-ruby): #{@cX.blue}#{Config::CONFIG['rubylibdir']}/#{SiSU_lib}#{@cX.off} or #{@cX.blue}#{Config::CONFIG['sitelibdir']}/#{SiSU_lib}#{@cX.off}
conf [etc]: #{@cX.blue}#{@env.path.etc}/sisu#{@cX.off}
data (document samples, images, README): #{@cX.blue}#{@env.path.sample_data}#{@cX.off}
- processing: #{@cX.blue}#{@env.path.processing}#{@cX.off}
+ processing: #{@cX.blue}#{@env.processing_path.processing}#{@cX.off}
output www: #{@cX.blue}#{@env.path.output}#{@cX.off}
Output files, are currently set to be produced in:
@@ -1329,10 +1306,10 @@ WOK
sisu --help
-WOK
+ WOK
end
def setup
- print <<WOK
+ print <<-WOK
#{@cX.green}configuration files#{@cX.off}
sisurc.yml used:
@@ -1353,10 +1330,10 @@ WOK
#{@cX.blue}man 8 sisu#{@cX.off}
and
#{@cX.blue}http://www.jus.uio.no/sisu/SiSU#{@cX.off}
-WOK
+ WOK
end
def termsheet
- print <<WOK
+ print <<-WOK
#{@cX.green}sisu --termsheet [termsheetname].termsheet.rb#{@cX.off}
will produce the collection of documents associated with [termsheetname.termsheet.rb]
@@ -1385,29 +1362,29 @@ WOK
it is necessary to purge the directory ~facilityData when old files are removed
-WOK
+ WOK
end
def help_commands
- print <<WOK
+ print <<-WOK
also see:
sisu --help commands
man sisu
-WOK
+ WOK
end
def help_env
- print <<WOK
+ print <<-WOK
for sisu environment information see:
sisu --help env
-WOK
+ WOK
end
def help_general
help_env
help_commands
end
def help_markup
- print <<WOK
+ print <<-WOK
for help with sisu markup see:
sisu --help markup
@@ -1419,8 +1396,6 @@ WOK
for brief descriptive summary of markup history
sisu --query-history
- or if for a particular version
- sisu --query-0.38
for markup:
sisu --help example
@@ -1429,19 +1404,14 @@ WOK
#{@cX.green}/usr/share/doc/sisu/markup-samples#{@cX.off}
and online
#{@cX.green}www.jus.uio.no/sisu#{@cX.off}
-WOK
+ WOK
end
def convert
- print <<WOK
+ print <<-WOK
for information on the markup version used within a sisu markup file:
sisu --inspect [filename]
- to convert between sst markup versions 0.37 and 0.38:
- sisu --to-current
- sisu --to-38 [filename/wildcard]
- sisu --to-37 [filename/wildcard]
-
convert an sst file with footnotes following text to (preferred) inline footnotes
sisu --convert-footnotes [filename/wildcard]
@@ -1462,50 +1432,50 @@ WOK
to attempt to convert a kdissert (.kdi) file to sisu markup:
sisu --from-kdi [kdissert filename]
(very basic and experimental)
-WOK
+ WOK
end
def dal
- print <<WOK
+ print <<-WOK
sisu --dal [filename/wildcard] creates the metaverse, used by all other modules for downstream processing
sisu -m [filename/wildcard] creates the metaverse, used by all other modules for downstream processing
-WOK
+ WOK
help_commands
end
def utf8
- print <<WOK
+ print <<-WOK
documents prepared for sisu processing should be stored in utf8
-WOK
+ WOK
end
def plaintext
- print <<WOK
+ print <<-WOK
sisu --txt [filename/wildcard] plaintext with Unix linefeeds (footnotes follow paragraphs)
sisu -t [filename/wildcard] plaintext with Unix linefeeds (footnotes follow paragraphs)
-WOK
+ WOK
help_commands
end
def html
- print <<WOK
+ print <<-WOK
sisu --html [filename/wildcard] html document type suffixes included
sisu -h [filename/wildcard] html document type suffixes included
-WOK
+ WOK
help_commands
end
def xhtml
- print <<WOK
+ print <<-WOK
sisu --xhtml [filename/wildcard] xhtml document
sisu -b [filename/wildcard] xhtml document
-WOK
+ WOK
help_commands
end
def xml
- print <<WOK
+ print <<-WOK
sisu --xml-sax [filename/wildcard] xml document (sax type parsing)
sisu -x [filename/wildcard] xml document (sax type parsing)
@@ -1518,52 +1488,52 @@ WOK
sisu --epub [filename/wildcard] odt document, (epub document)
sisu -e [filename/wildcard] odt document, (epub document)
-WOK
+ WOK
help_commands
end
def odf
- print <<WOK
+ print <<-WOK
sisu --odt [filename/wildcard] odt document, (odf open document format)
sisu -o [filename/wildcard] odt document, (odf open document format)
-WOK
+ WOK
help_commands
end
def epub
- print <<WOK
+ print <<-WOK
sisu --epub [filename/wildcard] epub document, (open format for e-books)
sisu -e [filename/wildcard] epub document, (open format for e-books)
-WOK
+ WOK
help_commands
end
def php
- print <<WOK
+ print <<-WOK
not supported
[php output has been removed]
-WOK
+ WOK
help_commands
end
def pdf
- print <<WOK
+ print <<-WOK
sisu --pdf [filename/wildcard] produces pdf files from LaTeX output
sisu -p [filename/wildcard] produces pdf files from LaTeX output
-WOK
+ WOK
help_commands
end
def latex
- print <<WOK
+ print <<-WOK
sisu --pdf [filename/wildcard] produces pdf files from LaTeX output
sisu -p [filename/wildcard] produces pdf files from LaTeX output
-WOK
+ WOK
help_commands
end
def texinfo
- print <<WOK
+ print <<-WOK
sisu --texinfo [filename] produces texinfo and info files
sisu -I [filename] produces texinfo and info files
@@ -1577,29 +1547,29 @@ WOK
and then to point at the file using
pinfo ./[filename]
-WOK
+ WOK
help_commands
end
def lout
- print <<WOK
+ print <<-WOK
sisu -l [filename/wildcard]
not currently supported, revisit someday?
-WOK
+ WOK
help_commands
end
def concordance
- print <<WOK
+ print <<-WOK
sisu --concordance starts the sisu webrick server, default port 8081
sisu --wordmap starts the sisu webrick server, default port 8081
sisu -W starts the sisu webrick server, default port 8081
-WOK
+ WOK
help_commands
end
def help_search
- print <<WOK
+ print <<-WOK
SiSU searches,
depending on how you wish to implement search,
@@ -1608,10 +1578,10 @@ WOK
sisu --help searchform (or 'sisu --help cgi')
sisu --help hyperestraier (or 'sisu --help est')
sisu --help webrick
-WOK
+ WOK
end
def cgi
- print <<WOK
+ print <<-WOK
sisu --sample-search-form generates a sample search form
sisu -F generates a sample search form
@@ -1621,12 +1591,12 @@ WOK
sisu -W starts the webrick server
the generated search form must be copied to the webserver directory as instructed
-WOK
+ WOK
help_search
help_general
end
def sql
- print <<WOK
+ print <<-WOK
Mappings to two databases are provided by default,
postgresql (--pg or -D) and sqlite (--sqlite or -d),
@@ -1657,21 +1627,21 @@ WOK
By default, [unless otherwise specified] databases are built on a directory basis, from collections of documents within that directory.
The name of the directory you choose to work from is used as the database name,
i.e. if you are working in a directory called #{@cX.blue}#{@env.path.home}/ebook#{@cX.off} the database #{@cX.blue}#{Db[:name_prefix]}ebook#{@cX.off} is used. [otherwise a manual mapping for the collection is necessary]
-WOK
+ WOK
help_search
help_general
end
def webrick
- print <<WOK
+ print <<-WOK
sisu --webrick starts the sisu webrick server, default port 8081
sisu -W starts the sisu webrick server, default port 8081
-WOK
+ WOK
help_commands
end
def hyperestraier
out_dir='(' + `ls #{@env.path.webserv}`.split("\n").join('|') + ')'
- print <<WOK
+ print <<-WOK
Not tested recently, not up-to-date
NOTE: The examples that follow assume that sisu output is placed in the directory
@@ -1728,10 +1698,10 @@ WOK
and try open the url: #{@cX.blue}
#{@env.url.webserv_host_base}/cgi-bin/estseek.cgi #{@cX.off}
-WOK
+ WOK
end
def yaml
- print <<WOK
+ print <<-WOK
Yaml sisurc files may be used to configure sisu, these are searched for in the following locations:
under the current SiSU markup data directory: #{@cX.blue}#{Dir.pwd}/_sisu/sisurc.yml#{@cX.off}
@@ -1746,10 +1716,10 @@ WOK
these may be called by the sisurc.yml, skins for document, directory or site, or from individual document headers in the header @@promo: [a commented out example header may be found in document sample: free_as_in_freedom.richard_stallman_cru‐ sade_for_free_software.sam_williams.sst, it calls for the specified lists in list.yml, which in turn calls the widgets named in promo.yml which are used to build content in the right pane of html output]
-WOK
+ WOK
end
def sitemap
- print <<WOK
+ print <<-WOK
SiSU sitemaps,
an experimental feature (following g,y,m announcement to use them this week)
@@ -1759,17 +1729,17 @@ WOK
to generate/update the index of sitemaps
sisu --sitemaps
-WOK
+ WOK
end
def license
- print <<WOK
+ print <<-WOK
* License: GPL 3 or later:
SiSU, a framework for document structuring, publishing and search
- Copyright (C) 1997 - 2011 Ralph Amissah
+ Copyright (C) 1997 - 2012 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
@@ -1788,7 +1758,6 @@ WOK
available at these locations:
<#{@cX.blue}http://www.fsf.org/licenses/gpl.html#{@cX.off}>
<#{@cX.blue}http://www.gnu.org/licenses/gpl.html#{@cX.off}>
- <#{@cX.blue}http://www.jus.uio.no/sisu/gpl.fsf#{@cX.off}>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -1796,31 +1765,32 @@ WOK
* Standard SiSU object citation numbering and system
* Hompages:
- <#{@cX.blue}http://www.jus.uio.no/sisu#{@cX.off}>
<#{@cX.blue}http://www.sisudoc.org#{@cX.off}>
+ <#{@cX.blue}http://www.jus.uio.no/sisu#{@cX.off}>
* Download:
- <#{@cX.blue}http://www.jus.uio.no/sisu/SiSU/download.html#{@cX.off}>
+ <#{@cX.blue}http://sources.sisudoc.org#{@cX.off}>
+ <#{@cX.blue}http://www.jus.uio.no/sisu/en/html/SiSU/download.html#{@cX.off}>
Ralph Amissah
<#{@cX.blue}ralph@amissah.com#{@cX.off}>
<#{@cX.blue}ralph.amissah@gmail.com#{@cX.off}>
-WOK
+ WOK
end
def standards
- print <<WOK
+ print <<-WOK
* SiSU uses:
* Standard SiSU markup syntax,
* Standard SiSU meta-markup syntax, and the
* Standard SiSU object citation numbering and system
-© Ralph Amissah 1997, current 2011.
+Copyright (C) Ralph Amissah 1997, current 2012.
All Rights Reserved.
Information on these may be obtained from:
- http://www.jus.uio.no/sisu
+ <#{@cX.blue}http://sisudoc.org#{@cX.off}>
More information to be provided later.
@@ -1829,10 +1799,10 @@ More information to be provided later.
* Ralph Amissah ralph@amissah.com
Ralph Amissah ralph.amissah@gmail.com
-WOK
+ WOK
end
def conversion
- print <<WOK
+ print <<-WOK
sisu_convert does the initial conversion from a couple of file formats to SiSU file format, currently only html and word97
#{@cX.cyan}sisu_convert#{@cX.off} [keyword]
sisu [keyword]
@@ -1840,10 +1810,10 @@ sisu_convert does the initial conversion from a couple of file formats to SiSU f
------------------------------------------
Preparing Documents for SiSU
#{@cX.green}--word97#{@cX.off} sisu --help markup (an incomplete overview)
-WOK
+ WOK
end
def external_programs
- puts <<WOK
+ puts <<-WOK
external ruby programs
@@ -1863,10 +1833,10 @@ WOK
#{@cX.brown}suggested/recommended#{@cX.off}
tidy (xml, xhtml well formed check)
trang (relaxng, rnc to dtd conversion)
-WOK
+ WOK
end
def scratch
- print <<WOK
+ print <<-WOK
Types of tag,
then there are various tags which occur within the document.
@@ -1893,7 +1863,7 @@ This makes citation a lot easier... regardless of the form of output that is bei
It also permits the building of various addons, like the concordance feature which identifies each word and the paragraphs in which the word appears with links to the paragraph...
Urls are automatically turned to live links in the html and pdf files created...
-WOK
+ WOK
end
end
end
diff --git a/lib/sisu/v2/html.rb b/lib/sisu/v4/html.rb
index ba2afabc..f9162192 100644
--- a/lib/sisu/v2/html.rb
+++ b/lib/sisu/v4/html.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -58,27 +57,31 @@
=end
module SiSU_HTML
require 'pstore'
- require "#{SiSU_lib}/particulars" # particulars.rb
+ require_relative 'particulars' # particulars.rb
include SiSU_Particulars
- require "#{SiSU_lib}/defaults" # defaults.rb
+ require_relative 'defaults' # defaults.rb
include SiSU_Viz
- require "#{SiSU_lib}/html_table" # html_table.rb
- require "#{SiSU_lib}/html_format" # html_format.rb
+ require_relative 'html_table' # html_table.rb
+ require_relative 'html_format' # html_format.rb
include SiSU_HTML_Format
- require "#{SiSU_lib}/html_segments" # html_segments.rb
- include SiSU_HTML_seg
- require "#{SiSU_lib}/html_scroll" # html_scroll.rb
- require "#{SiSU_lib}/html_promo" # html_promo.rb
- include SiSU_HTML_promo
- require "#{SiSU_lib}/html_tune" # html_tune.rb
+ 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::Combined_singleton.instance.get_all(opt)
+ @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)
end
def read
- songsheet
+ begin
+ songsheet
+ ensure
+ SiSU_Env::CreateSite.new(@opt.cmd).cp_css
+ end
end
def songsheet
begin
@@ -87,42 +90,41 @@ module SiSU_HTML
@env=@particulars.env
loc=@env.url.output_tell
unless @opt.cmd =~/q/
- tool=if @opt.cmd =~/z/; "#{@env.program.web_browser} #{loc}/#{@fnb}/#{@md.fn[:index]}"
- elsif @opt.cmd =~/[MVv]/; "#{@env.program.web_browser} #{loc}/#{@fnb}/#{@md.fn[:index]}"
- else @opt.fns
- end
+ tool=(@opt.cmd =~/[MVvz]/) \
+ ? ("#{@env.program.web_browser} file://#{@md.file.output_path.html_seg.dir}/#{@md.file.base_filename.html_segtoc}")
+ : ("[#{@opt.f_pth[:lng_is]}] #{@opt.fno}")
@opt.cmd=~/[MVvz]/ \
- ? SiSU_Screen::Ansi.new(@opt.cmd,'HTML',tool).green_hi_blue \
+ ? SiSU_Screen::Ansi.new(@opt.cmd,'HTML',tool).green_hi_blue
: SiSU_Screen::Ansi.new(@opt.cmd,'HTML',tool).green_title_hi
- SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/#{@fnb}/#{@md.fn[:index]}").flow if @opt.cmd =~/[MV]/
+ SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"file://#{@md.file.output_path.html_seg.dir}/#{@md.file.base_filename.html_segtoc}").flow if @opt.cmd =~/[MV]/
end
- SiSU_Env::Info_skin.new(@md).select
data=nil
- my_make=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns,@md) #Beware #FIX opt and md, both not necessary
- SiSU_Env::SiSU_file.new(@md).mkdir
- @tuned_file_array=SiSU_HTML::Source::Html_environment.new(@particulars).tuned_file_instructions
+ @tuned_file_array=SiSU_HTML::Source::HTML_Environment.new(@particulars).tuned_file_instructions
data=@tuned_file_array
scr_endnotes=SiSU_HTML::Source::Endnotes.new(data,@md).scroll
toc=SiSU_HTML::Source::Toc.new(@md,data).songsheet
- links_guide=SiSU_HTML::Source::Links_guide.new(data,@md).toc
+ links_guide=SiSU_HTML::Source::LinksGuide.new(data,@md).toc
data=@tuned_file_array
- scr_toc=SiSU_HTML::Source::Scroll_head_and_segtoc.new(@md,toc,links_guide).in_common #watch
+ scr_toc=SiSU_HTML::Source::ScrollHeadAndSegToc.new(@md,toc,links_guide).in_common #watch
SiSU_HTML::Source::Seg.new(@md,data).songsheet
data=@tuned_file_array
scr=SiSU_HTML::Source::Scroll.new(@md,data,scr_endnotes).songsheet
- scroll=SiSU_HTML::Source::Scroll_output.new(scr_toc,scr[:body],scr[:metadata],scr[:owner_details],scr[:tails],@md).publish
+ 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
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
ensure
unless @opt.cmd =~/[MV]/ #check maintenance flag
- texfiles=Dir["#{@env.path.tune}/#{@opt.fns}*"]
+ texfiles=Dir["#{@env.processing_path.tune}/#{@opt.fns}*"]
texfiles.each do |f|
if FileTest.file?(f)
File.unlink(f)
end
end
end
- SiSU_Env::Create_file.new(@opt.cmd,@opt.fns).param_instantiate
+ SiSU_Env::Clear.new(@opt.cmd,@opt.fns,@md).param_instantiate
@@flag,@@scr,@@seg,@@seg_endnotes,@@seg_subtoc,@@seg_ad={},{},{},{},{},{}
@@seg_total,@@tracker,@@loop_count,@@tablehead,@@number_of_cols=0,0,0,0,0
@@seg_name,@@seg_name_html,@@seg_subtoc_array,@@seg_endnotes_array,@@segtocband,@@tablefoot=Array.new(7){[]}
@@ -131,60 +133,50 @@ module SiSU_HTML
end
end
private
- class Html_environment
+ class HTML_Environment
def initialize(particulars)
@particulars=particulars
@md,@env=particulars.md,particulars.env
- @vz=SiSU_Env::Get_init.instance.skin
- @env,@css,@symlnk=particulars.env,SiSU_Style::CSS.new,SiSU_Env::Create_system_link.new #home
- end
- def link_images
- @symlnk.images
- end
- def directories
- my_make=SiSU_Env::Create_file.new(@md.cmd,@md.fns)
- @path={ :root=>my_make.html_root }
- title=File.basename(@md.fns,'.rb')
- SiSU_Env::SiSU_file.new(@md).mkdir
+ @vz=SiSU_Viz::Defaults.new
+ @env,@css=particulars.env,SiSU_Style::CSS.new
end
def tuned_file_instructions
- @tell=SiSU_Screen::Ansi.new(@md.cmd)
- @md.cmd=@md.cmd.gsub(/H/,'h')
- @md.file_type='html' if @md.cmd =~/[hon]/
- directories
- newfilename=%{#{@env.path.output}/#{@md.fnb}/#{@md.fn[:index]}} if @md.file_type =~/html/
+ @tell=SiSU_Screen::Ansi.new(@md.opt.cmd)
+ @md.opt.cmd=@md.opt.cmd.gsub(/H/,'h')
+ @md.file_type='html' if @md.opt.cmd =~/[hw]/
+ newfilename=%{#{@md.file.output_path.html_scroll.dir}/#{@md.file.base_filename.html_segtoc}} if @md.file_type =~/html/
dal_array=@particulars.dal_array # dal file drawn here
@tuned_file_array=SiSU_HTML_Tune::Tune.new(dal_array,@md).songsheet
@tuned_file_array
end
end
- class Links_guide
+ class LinksGuide
@links_guide_toc=[]
def initialize(data,md)
@data,@md=data,md
- @links_guide_=SiSU_Env::Create_site.new(@md.cmd).html_quick_ref?
+ @links_guide_=SiSU_Env::CreateSite.new(@md.opt.cmd).html_quick_ref?
end
def toc
@links_guide_toc=[]
if @links_guide_
- format_head_toc=SiSU_HTML_Format::Head_toc.new(@md)
+ 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=if l[:url] !~/^\.(\.)?\//; 'external'
- else '_top'
- end
+ 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::Format_toc.new(@md,txt_obj)
+ 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::Head_toc.new(@md)
+ format_head_toc=SiSU_HTML_Format::HeadToc.new(@md)
@links_guide_toc << format_head_toc.links_guide_close #(guide_type)
@links_guide_toc
else ''
@@ -198,10 +190,10 @@ module SiSU_HTML
end
def scroll
@scr_endnotes=[]
- format_head_scroll=SiSU_HTML_Format::Head_scroll.new(@md)
+ format_head_scroll=SiSU_HTML_Format::HeadScroll.new(@md)
@data.each do |dob|
pg=dob.dup
- unless pg.is =~/^code/
+ unless pg.is ==:code
if pg.obj =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[\d*+]+ /
endnote_array=[]
if pg.obj=~/#{Mx[:en_a_o]}[\d*+].+?#{Mx[:en_a_c]}/m
@@ -214,8 +206,8 @@ module SiSU_HTML
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::Format_scroll.new(@md,txt_obj)
+ txt_obj={ txt: note }
+ format_scroll=SiSU_HTML_Format::FormatScroll.new(@md,txt_obj)
@scr_endnotes << format_scroll.endnote_body
end
end
@@ -224,33 +216,33 @@ module SiSU_HTML
@scr_endnotes
end
end
- class Toc <Links_guide
- @@toc={ :seg=>[],:seg_mini=>[],:scr=>[] }
+ class Toc <LinksGuide
+ @@toc={ seg: [], seg_mini: [], scr: [] }
@@seg_url=''
@@firstseg=nil
def initialize(md=nil,data='')
@data,@md=data,md
- @vz=SiSU_Env::Get_init.instance.skin
- @tell=SiSU_Screen::Ansi.new(@md.cmd) if @md
+ @vz=SiSU_Viz::Defaults.new
+ @tell=SiSU_Screen::Ansi.new(@md.opt.cmd) if @md
end
def songsheet #extracts toc for scroll & seg
- SiSU_Screen::Ansi.new(@md.cmd,'Toc').txt_grey if @md.cmd =~/[MVv]/
+ SiSU_Screen::Ansi.new(@md.opt.cmd,'Toc').txt_grey if @md.opt.cmd =~/[MVv]/
toc=nil
@@firstseg=nil
- @@toc={ :seg=>[],:seg_mini=>[],:scr=>[] }
+ @@toc={ seg: [], seg_mini: [], scr: [] }
@data.each do |dob|
- if dob.is=='heading' \
- or dob.is=='heading_insert'
+ if dob.is==:heading \
+ || dob.is==:heading_insert
dob_toc=dob.dup
- toc=if dob_toc.is =='heading' \
- or dob.is=='heading_insert'
+ toc=if dob_toc.is ==:heading \
+ || dob.is==:heading_insert
toc=case dob_toc.ln
- when 1; Toc.new(@md,dob_toc).level_1
- when 2; Toc.new(@md,dob_toc).level_2
- when 3; Toc.new(@md,dob_toc).level_3
- when 4; Toc.new(@md,dob_toc).level_4
- when 5; Toc.new(@md,dob_toc).level_5
- when 6; Toc.new(@md,dob_toc).level_6
+ when 1; SiSU_HTML::Source::Toc.new(@md,dob_toc).level_1
+ when 2; SiSU_HTML::Source::Toc.new(@md,dob_toc).level_2
+ when 3; SiSU_HTML::Source::Toc.new(@md,dob_toc).level_3
+ when 4; SiSU_HTML::Source::Toc.new(@md,dob_toc).level_4
+ when 5; SiSU_HTML::Source::Toc.new(@md,dob_toc).level_5
+ when 6; SiSU_HTML::Source::Toc.new(@md,dob_toc).level_6
else nil
end
end
@@ -267,7 +259,10 @@ module SiSU_HTML
@@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::Info_error.new($!,$@,@md.cmd,@md.fns).error
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
end
end
end
@@ -297,22 +292,22 @@ WOK
#not used -->
def level_endnotes
if @md.flag_endnotes
- format_head_scroll=SiSU_HTML_Format::Head_scroll.new(@md)
+ format_head_scroll=SiSU_HTML_Format::HeadScroll.new(@md)
@@toc[:scr] << format_head_scroll.toc_endnote
end
end
def level_concordance
- format_head_toc=SiSU_HTML_Format::Head_toc.new(@md)
+ format_head_toc=SiSU_HTML_Format::HeadToc.new(@md)
@@toc[:seg_mini] << format_head_toc.mini_seg_concordance
end
def level_metadata
- format_head_toc=SiSU_HTML_Format::Head_toc.new(@md)
+ format_head_toc=SiSU_HTML_Format::HeadToc.new(@md)
@@toc[:scr] << format_head_toc.metadata
@@toc[:seg] << format_head_toc.seg_metadata
@@toc[:seg_mini] << format_head_toc.mini_seg_metadata
end
def level_word_index
- format_head_toc=SiSU_HTML_Format::Head_toc.new(@d0c)
+ format_head_toc=SiSU_HTML_Format::HeadToc.new(@d0c)
@@toc[:scr] << format_head_toc.concordance
@@toc[:seg] << format_head_toc.concordance
@@toc[:seg_mini] << format_head_toc.mini_concordance
@@ -323,16 +318,16 @@ WOK
linkname,link=dob.obj.strip,dob.ocn
if link \
and link !~/#/ #% keep eye on link
- p_num=SiSU_HTML_Format::Paragraph_number.new(@md,link)
+ p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,link)
end
- title=if dob.obj !~/Metadata/; linkname
+ title=if dob.obj !~/Metadata/ then linkname
else
link='metadata'
- %{<b><a href="#{@md.fnl[:pre]}#{link}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}">#{linkname}</a></b>}
+ %{<b><a href="#{link}#{@md.lang_code_insert}#{Sfx[:html]}">#{linkname}</a></b>}
end
toc={}
- txt_obj={:txt =>title}
- format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj)
+ 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
@@ -354,13 +349,13 @@ WOK
end
else
@@toc[:scr] << '<br />'
- link=if dob.ln; dob.ln
- else ''
- end
+ link=(dob.ln) \
+ ? dob.ln
+ : ''
%{<b><a href="##{link}">#{linkname}</a></b>}
end
- txt_obj={:txt =>title}
- format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj)
+ txt_obj={ txt: title }
+ format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj)
toc[:scr]=if dob.name =~/^meta/ \
and dob.obj =~/Document Information/
format_toc.lev0
@@ -373,18 +368,18 @@ WOK
linkname,ocn=dob.obj.strip,dob.ocn
p_num=if ocn \
and ocn !~/#/
- SiSU_HTML_Format::Paragraph_number.new(@md,ocn)
+ SiSU_HTML_Format::ParagraphNumber.new(@md,ocn)
else nil
end
- txt_obj={:txt =>linkname}
- format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj)
+ 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::Format_toc.new(@md,txt_obj)
+ txt_obj={ txt: title }
+ format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj)
toc[:scr]=format_toc.lev2
end
toc
@@ -394,18 +389,18 @@ WOK
linkname,ocn=dob.obj.strip,dob.ocn
p_num=if ocn \
and ocn !~/#/
- SiSU_HTML_Format::Paragraph_number.new(@md,ocn)
+ SiSU_HTML_Format::ParagraphNumber.new(@md,ocn)
else nil
end
- txt_obj={:txt =>linkname}
- format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj)
+ 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::Format_toc.new(@md,txt_obj)
+ txt_obj={ txt: title }
+ format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj)
toc[:scr]=format_toc.lev3
end
toc
@@ -413,26 +408,39 @@ WOK
def level_4
dob=@data
linkname,ocn=dob.obj.strip,dob.ocn
- p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) if ocn
+ p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn) if ocn
if dob.ln ==4
- seg_link=%{ <a href="#{@md.fnl[:pre]}#{dob.name}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" target="_top">
+ seg_link=%{ <a href="#{dob.name}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top">
#{dob.obj}
</a> }
@@seg_url=dob.name
elsif dob.obj =~/\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+/
seg_link=dob.obj.gsub(/^(\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+)(.*)/,
- %{<a href="#{@md.fnl[:pre]}\\1#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" } +
+ %{<a href="\\1#{@md.lang_code_insert}#{Sfx[:html]}" } +
%{target="_top">\\1 \\2</a> })
end
- p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) if ocn
- txt_obj={:txt =>seg_link}
- format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj)
+ 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={:txt =>title}
- format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj)
+ 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
@@ -443,17 +451,17 @@ WOK
toc={}
if ocn \
and ocn !~/#/
- p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn)
- lnk_n_txt=%{ <a href="#{@md.fnl[:pre]}#{@@seg_url}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}##{ocn}">
+ p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn)
+ lnk_n_txt=%{ <a href="#{@@seg_url}#{@md.lang_code_insert}#{Sfx[:html]}##{ocn}">
#{linkname}
</a>}
- txt_obj={:txt =>lnk_n_txt}
- format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj)
+ 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::Format_toc.new(@md,txt_obj)
+ txt_obj={ txt: title }
+ format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj)
toc[:scr]=format_toc.lev5
end
toc
@@ -464,25 +472,25 @@ WOK
toc={}
if ocn \
and ocn !~/#/
- p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn)
- lnk_n_txt=%{ <a href="#{@md.fnl[:pre]}#{@@seg_url}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}##{ocn}">
+ p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn)
+ lnk_n_txt=%{ <a href="#{@@seg_url}#{@md.lang_code_insert}#{Sfx[:html]}##{ocn}">
#{linkname}
</a>}
- txt_obj={:txt =>lnk_n_txt}
- format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj)
+ 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::Format_toc.new(@md,txt_obj)
+ 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
- if dob !~/^4~!/
- dob.gsub!(/^4~!\s+(\S+)\s+(.+)/,
+ 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}
@@ -491,7 +499,7 @@ WOK
</td></tr></table>
})
else
- dob.gsub!(/^4~!\s+(\S+)\s+(.+)/,
+ dob.gsub(/^4~!\s+(\S+)\s+(.+)/,
%{<table><tr><td width ="80">
</td><td>
<a href="\\1" target="_top">
@@ -503,47 +511,50 @@ WOK
end
end
end
- class Scroll_head_and_segtoc < Toc
+ class ScrollHeadAndSegToc < Toc
def initialize(md='',toc='',links_guide_toc='')
@md,@toc,@links_guide_toc=md,toc,links_guide_toc
- @vz=SiSU_Env::Get_init.instance.skin
+ @vz=SiSU_Viz::Defaults.new
+ @make=SiSU_Env::ProcessingSettings.new(@md)
end
def in_common
toc_shared=[]
@segtoc=[]
- SiSU_Screen::Ansi.new(@md.cmd,'Scroll & Segtoc').txt_grey if @md.cmd =~/[MVv]/
- format_head_toc=SiSU_HTML_Format::Head_toc.new(@md)
+ SiSU_Screen::Ansi.new(@md.opt.cmd,'Scroll & Segtoc').txt_grey if @md.opt.cmd =~/[MVv]/
+ format_head_toc=SiSU_HTML_Format::HeadToc.new(@md)
dochead=format_head_toc.head
- dochead.gsub!(/toc\.(html)/,'doc.\1') #kludge
- ads=SiSU_HTML_promo::Ad.new(@md)
+ dochead=dochead.gsub(/toc\.(html)/,'doc.\1') #kludge
+ ads=SiSU_HTML_Promo::Ad.new(@md)
toc_shared << dochead << ads.div.major
@segtoc << format_head_toc.head << ads.div.major
- toc_shared << format_head_toc.toc_head_escript if SiSU_HTML_Format::Head_toc.method_defined? :toc_head_escript
- @segtoc << format_head_toc.toc_head_escript if SiSU_HTML_Format::Head_toc.method_defined? :toc_head_escript
- toc_shared << format_head_toc.scroll_head_navigation_band
+ 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::Clean_html.new(rights).clean
+ rights=SiSU_HTML_Tune::CleanHTML.new(rights).clean
end
if @md.prefix_b
prefix_b=format_head_toc.notes.prefix_b
- prefix_b=SiSU_HTML_Tune::Clean_html.new(prefix_b).clean
+ prefix_b=SiSU_HTML_Tune::CleanHTML.new(prefix_b).clean
+ end
+ if @make.build.html_top_band?
+ @segtoc << format_head_toc.seg_head_navigation_band
end
- @segtoc << format_head_toc.seg_head_navigation_band
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::Format_text_object.new(@md,txt_obj)
+ 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_endnote=@md.creator.author.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::Format_text_object.new(@md,txt_obj)
+ 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
@@ -563,8 +574,9 @@ WOK
if defined? @md.prefix_b
toc_shared << prefix_b
end
- #Table of Contents added/appended here
- toc_shared << @toc[:scr]
+ scr_toc=if @make.build.toc? #Table of Contents added/appended here
+ toc_shared << @toc[:scr]
+ end
@segtoc << @links_guide_toc
@segtoc << @toc[:seg]
if defined? @md.rights.all \
@@ -575,64 +587,88 @@ WOK
#Segtoc tail added here
@segtoc << "</p>\n" #bugfix sort later DEBUGNOW
@segtoc << @seg_toc_band_bottom
- ads=SiSU_HTML_promo::Ad.new(@md)
+ ads=SiSU_HTML_Promo::Ad.new(@md)
@segtoc << format_head_toc.seg_navigation_tail << ads.div.close << ads.display << format_head_toc.html_close
- @segtoc.flatten!.compact!
- Output.new(@segtoc,@md).segtoc
+ @segtoc=@segtoc.flatten.compact #watch
+ SiSU_HTML::Source::Output.new(@segtoc,@md).segtoc
@segtoc=[]
@toc[:scr],@toc[:seg]=[],[]
toc_shared
end
end
- class Table < SiSU_HTML_table::Table_html
+ class Table < SiSU_HTML_Table::TableHTML
end
- class Scroll < SiSU_HTML_scroll::Scroll
+ class Scroll < SiSU_HTML_Scroll::Scroll
end
- class Scroll_output
+ class ScrollOutput
def initialize(scr_toc,scr_body,scr_metadata,scr_owner_details,scr_tails,md)
@scr_toc,@scr_body,@scr_metadata,@scr_owner_details,@scr_tails,@md=scr_toc,scr_body,scr_metadata,scr_owner_details,scr_tails,md
end
def publish
scroll=[]
- hr='<center><hr width=90% /></center>'
- scroll << @scr_toc << '<div class="scroll">' << hr << @scr_body << @scr_endnotes << hr << @scr_owner_details << '</div>' << @scr_tails
- scroll.flatten!.compact!
+ 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
+ class Seg < SiSU_HTML_Seg::Seg
end
class Output
def initialize(data='',md='')
@data,@md=data,md
- @my_make=SiSU_Env::Create_file.new(@md.cmd,@md.fns,@md)
+ @file=SiSU_Env::FileOp.new(md)
+ @o_str ||=SiSU_Env::ProcessingSettings.new(md).output_dir_structure
end
def scroll
begin
- @filename_html_scroll=@my_make.file_html_scroll(@md)
+ @filename_html_scroll=@file.write_file.html_scroll
@data.each do |para|
- para.strip!
- para.gsub!(/<:.+?>/,'')
- para.gsub!(/#{Rx[:mx_fa_clean]}/,'')
+ para=para.strip.
+ gsub(/<:.+?>/,'').
+ gsub(Xx[:html_relative2],@file.path_rel_links.html_scroll_2).
+ gsub(Xx[:html_relative1],@file.path_rel_links.html_scroll_1).
+ #gsub(/#{Xx[:html_relative]}/,@file.path_rel_links.html_scroll).
+ gsub(/#{Rx[:mx_fa_clean]}/,'')
unless para =~/\A\s*\Z/
@filename_html_scroll.puts para,"\n"
end
end
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ @filename_html_scroll.close
end
end
def segtoc
begin
- @filename_html_segtoc=@my_make.file_html_segtoc(@md)
- @filename_html_index=@my_make.file_html_index(@md)
+ @filename_html_segtoc=@file.write_file.html_segtoc
@data.each do |para|
- para.strip!
- para.gsub!(/<!.+?!>/,'')
+ 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"
- @filename_html_index.puts para,"\n"
end
end
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ @filename_html_segtoc.close
+ pwd_set=Dir.pwd
+ idx_lnk=if @o_str.dump_or_redirect?
+ @file.base_filename.manifest
+ else
+ @file.base_filename.html_segtoc
+ end
+ mlnk=@file.base_filename.html_seg_index
+ Dir.chdir(@file.output_path.html_seg.dir)
+ FileUtils::rm_f(mlnk)
+ FileUtils::ln_s(idx_lnk,mlnk)
+ Dir.chdir(pwd_set)
end
end
end
diff --git a/lib/sisu/v2/html_format.rb b/lib/sisu/v4/html_format.rb
index a59f82ac..cdb0b94a 100644
--- a/lib/sisu/v2/html_format.rb
+++ b/lib/sisu/v4/html_format.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -58,31 +57,26 @@
=end
module SiSU_HTML_Format
include SiSU_Viz
- class Paragraph_number
+ class ParagraphNumber
def initialize(md,ocn)
@md,@ocn=md,ocn.to_s
@ocn ||=''
- vz=SiSU_Env::Get_init.instance.skin
- @skin_no_ocn=if defined? vz.ocn_display_off \
- and vz.ocn_display_off==true
- true
- else false
- end
end
def ocn_display
- if @md.markup.inspect =~/no_ocn/ \
- or @md.mod.inspect =~/--no-ocn/ \
- or @skin_no_ocn
- ocn_class='ocn_off'
- @ocn.gsub(/^(\d+|)$/,
- %{<label class="#{ocn_class}">&nbsp;</label>})
- elsif @ocn.to_i==0
- @ocn.gsub(/^(\d+|)$/,
- %{<label class="#{ocn_class}"><a name="#{@ocn}">&nbsp;</a></label>})
- else
+ @make=SiSU_Env::ProcessingSettings.new(@md)
+ if @make.build.ocn?
ocn_class='ocn'
+ if @ocn.to_i==0
+ @ocn.gsub(/^(\d+|)$/,
+ %{<label class="#{ocn_class}"><a name="#{@ocn}">&nbsp;</a></label>})
+ else
+ @ocn.gsub(/^(\d+|)$/,
+ %{<label class="#{ocn_class}"><a name="#{@ocn}" href="##{@ocn}" class="lnk#{ocn_class}">\\1</a></label>})
+ end
+ else
+ ocn_class='ocn_off'
@ocn.gsub(/^(\d+|)$/,
- %{<label class="#{ocn_class}"><a name="#{@ocn}" href="##{@ocn}" class="lnk#{ocn_class}">\\1</a></label>})
+ %{<label class="#{ocn_class}">&nbsp;</label>})
end
end
def name
@@ -95,33 +89,83 @@ module SiSU_HTML_Format
%{<a href="##{@ocn}">}
end
end
- class Head_information
- require "#{SiSU_lib}/shared_xml" # shared_xml.rb
+ class HeadInformation
+ require_relative 'css' # css.rb
+ require_relative 'shared_xml' # shared_xml.rb
include SiSU_Viz
attr_reader :md,:rdf,:vz
def initialize(md)
@md=md
# DublinCore 1 - title
- @vz=SiSU_Env::Get_init.instance.skin
- @css=SiSU_Env::CSS_stylesheet.new(md)
+ @vz=SiSU_Viz::Defaults.new
@seg_name_html=(SiSU_HTML::Source::Seg.new.seg_name_html || [])
@seg_name_html_tracker=(SiSU_HTML::Source::Seg.new.seg_name_html_tracker || [])
- @index='index'
@metalink='#metadata'
+ @tocband_scroll,@tocband_segtoc=nil,nil
+ @stylesheet=SiSU_Style::CSS_HeadInfo.new(md).stylesheet
+ @o_str ||=SiSU_Env::ProcessingSettings.new(md).output_dir_structure
+ @index='index'
+ @toc="#{@md.file.output_path.html_seg.dir}/#{@md.file.base_filename.html_segtoc}"
+ end
+ def url_path_image_sys
+ (@o_str.dump_or_redirect?) \
+ ? './image'
+ : "#{Xx[:html_relative2]}_sisu/image_sys"
+ end
+ def icon
+ def up
+ 'arrow_up_red.png'
+ end
+ def next
+ 'arrow_next_red.png'
+ end
+ def previous
+ 'arrow_prev_red.png'
+ end
+ def dot_clear
+ 'dot_clear.png'
+ end
+ def dot_white
+ 'dot_white.png'
+ end
+ def dot
+ dot_white
+ end
+ self
end
- def doc_types #used in toc & seg_nav_band
- scroll=seg=''
- wgt=Widget.new(@md)
+ def png_nav
+ def toc
+ %{<img border="0" width="22" height="22" src="#{url_path_image_sys}/#{icon.up}" alt="toc" />}
+ end
+ def pre
+ %{<img border="0" width="22" height="22" src="#{url_path_image_sys}/#{icon.previous}" alt="&lt;&lt;&nbsp;previous" />}
+ end
+ def nxt
+ %{<img border="0" width="22" height="22" src="#{url_path_image_sys}/#{icon.next}" alt="next&nbsp;&gt;&gt;" />}
+ end
+ def dot_toc
+ %{<img border="0" width="100%" height="20" src="#{url_path_image_sys}/#{icon.dot}" alt="&#094;" />}
+ end
+ def dot_pre
+ %{<img border="0" width="100%" height="20" src="#{url_path_image_sys}/#{icon.dot}" alt="&lt;" />}
+ end
+ def dot_nxt
+ %{<img border="0" width="100%" height="20" src="#{url_path_image_sys}/#{icon.dot}" alt="&gt;" />}
+ end
+ self
+ end
+ def doc_types(page=:seg) #used in toc & seg_nav_band
+ wgt=SiSU_HTML_Format::Widget.new(@md)
%{
<table summary="segment navigation available documents types: toc,doc,pdf,concordance" border="0" cellpadding="3" cellspacing="0">
<tr>
<td align="center" bgcolor=#{@vz.color_band2}>
- #{wgt.manifest}
+ #{wgt.manifest(page)}
#{wgt.search}
</tr></table>}
end
def rdf
- SiSU_XML_tags::RDF.new(md)
+ SiSU_XML_Tags::RDF.new(md)
end
def doc_type
%{<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
@@ -132,27 +176,40 @@ module SiSU_HTML_Format
%{ </font>
#{@vz.table_close}}
end
- def buttons_home
- %{<!- home and index buttons -!>
- #{@vz.banner_home_and_index_buttons}
-<!- home and index buttons -!>}
- end
- def copyat
- %{#{@vz.paragraph_font_tiny}copy @
- <a href="#{@vz.url_home}" #{@vz.js_home}>
- #{@vz.txt_home}
- </a></h1>}
+ def button_home(page=:seg)
+ button=%{ <table summary="home button / home information" border="0" cellpadding="3" cellspacing="0">\n <tr><td align="left" bgcolor="#ffffff">\n}
+ if @md.make.home_button_image.is_a?(Hash)
+ image_path=if page==:manifest
+ @md.file.output_path.manifest.rel_image
+ elsif page==:scroll
+ @md.file.output_path.html_scroll.rel_image
+ else
+ @md.file.output_path.html_seg.rel_image
+ end
+ dir=SiSU_Env::FileOp.new(@md)
+ button +=%{ <p class="tiny_left"><a href="#{@md.make.home_button_image[:link]}" target="_top"><img border="0" src="#{image_path}/#{@md.make.home_button_image[:home_button]}" width="#{@md.make.home_button_image[:w]}" height="#{@md.make.home_button_image[:h]}" alt="home icon --&gt;" /></a></p>\n}
+ elsif @md.home_button_links.is_a?(Array)
+ @md.home_button_links.each do |links|
+ button +=%{ <p class="tiny_left"><a href="#{links[:url]}/" target="_top">\n #{links[:say]}\n </a></p>\n}
+ end
+ end
+ button +=%{ </td></tr>\n </table>}
+ button
end
def html_close #moved
%{</body>
</html>}
end
end
- class Widget < Head_information
+ class Widget < HeadInformation
def initialize(md)
super(md)
@md=md
- @cf_defaults=SiSU_Env::Info_processing_flag.new
+ @cf_defaults=SiSU_Env::InfoProcessingFlag.new
+ @env=SiSU_Env::InfoEnv.new(md.fns)
+ @file=SiSU_Env::FileOp.new(md)
+ @o_str ||=SiSU_Env::ProcessingSettings.new(md).output_dir_structure
+ @make=SiSU_Env::ProcessingSettings.new(@md)
end
def home
%{<td align="center" bgcolor=#{@vz.color_band2}>
@@ -164,7 +221,7 @@ module SiSU_HTML_Format
def scroll(text)
if @md.fns =~ /\.(?:-|ssm\.)?sst$/
scroll=%{<td align="center" bgcolor=#{@vz.color_band2}>
- <a href="#{@md.fn[:doc]}" target="_top" #{@vz.js_doc}>
+ <a href="#{Xx[:html_relative1]}html/#{@file.base_filename.html_scroll}" target="_top">
#{text}
</a>
</td>
@@ -173,34 +230,56 @@ module SiSU_HTML_Format
end
def seg(text)
%{<td align="center" bgcolor="#99CC66">
- <a href="#{@md.fn[:toc]}" target="_top" #{@vz.js_doc}>
+ <a href="#{@md.file.base_filename.html_segtoc}" target="_top">
#{text}
</a>
</td>
}
end
def search
- env=SiSU_Env::Info_env.new(@md.fns,@md)
- env.widget.search_form('sisusearch',nil,nil,true)
+ if @make.build.html_search_form?
+ env=SiSU_Env::InfoEnv.new(@md.fns,@md)
+ env.widget.search_form('sisusearch',nil,nil,true)
+ else ''
+ end
end
- def manifest
- %{<td align="center" bgcolor=#{@vz.color_band2}>
- <a href="#{@md.fn[:manifest]}" target="_top" #{@vz.js_manifest}>
+ def manifest(page=:seg)
+ if @make.build.links_to_manifest? \
+ and not @o_str.dump_or_redirect?
+ manifest_lnk=if @file.output_dir_structure.by_language_code? \
+ or @file.output_dir_structure.by_filetype?
+ "#{Xx[:html_relative1]}manifest/#{@file.base_filename.manifest}"
+ else @file.base_filename.manifest
+ end
+ if page==:manifest
+ manifest_lnk="#{@md.file.output_path.manifest.url}/#{@file.base_filename.manifest}"
+ brace_url=SiSU_Viz::Defaults.new.url_decoration
+ %{<td align="center" bgcolor=#{@vz.color_band2}>
+ <font face="#{@vz.font_fonts}" size="2">
+ #{brace_url.xml_open}<a href="#{manifest_lnk}" target="_top">#{@md.file.output_path.manifest.url}/#{@file.base_filename.manifest}</a>#{brace_url.xml_close}
+ </font>
+</td>}
+ else
+ %{<td align="center" bgcolor=#{@vz.color_band2}>
+ <a href="#{manifest_lnk}" target="_top">
#{@vz.nav_txt_manifest}
</a>
</td>}
+ end
+ else ''
+ end
end
def pdf #retired 2.7.9
pdf=if @md.programs[:pdf] \
and @cf_defaults.cf_0 =~/p/
%{
<td align="center" bgcolor=#{@vz.color_band2}>
- <a href="#{@md.fn[:pdf_p]}" target="_top" #{@vz.js_portrait}>
+ <a href="#{Xx[:html_relative1]}pdf/#{@file.base_filename.pdf_p}" target="_top">
#{@vz.nav_txt_pdf_portrait}
</a>
</td>
<td align="center" bgcolor=#{@vz.color_band2}>
- <a href="#{@md.fn[:pdf_l]}" target="_top" #{@vz.js_landscape}>
+ <a href="#{Xx[:html_relative1]}pdf/#{@file.base_filename.pdf_l}" target="_top">
#{@vz.nav_txt_pdf_landscape}
</a>
</td>
@@ -208,117 +287,65 @@ module SiSU_HTML_Format
else ''
end
end
- def txt #retired 2.7.9
- txt=if @cf_defaults.cf_0 =~/[at]/
- %{
-<td valign=bottom bgcolor=#{@vz.color_band2}>
- <a href="#{@md.fn[:plain]}" target="_top" #{@vz.js_plaintext}>
- #{@vz.nav_txt_plaintext}
- </a>
-</td>}
- else ''
- end
- end
- def epub #retired 2.7.9
- epub=if @cf_defaults.cf_0 =~/e/
- %{
-<td align="center" bgcolor=#{@vz.color_band2}>
- <a href="../epub/#{@md.fn[:epub]}" target="_top" #{@vz.js_epub}>
- #{@vz.nav_txt_epub}
- </a>
-</td>}
- else ''
- end
- end
- def odf #retired 2.7.9
- odf=if @cf_defaults.cf_0 =~/o/
- %{
-<td align="center" bgcolor=#{@vz.color_band2}>
- <a href="#{@md.fn[:odf]}" target="_top" #{@vz.js_odf}>
- #{@vz.nav_txt_odf}
- </a>
-</td>}
- else ''
- end
- end
- def concordance(text) #retired 2.7.9
- if @md.concord_make \
- and @md.wc_words < 300000 #max word count for display of concordance here as would now be a large file
- %{<td align="center" bgcolor=#{@vz.color_band2}>
- <a href="#{@md.fn[:concordance]}" target="_top" #{@vz.js_concordance}>
- #{text}
- </a>
- </td>}
- else ''
- end
- end
end
class XML
end
- class Head_toc < Head_information
+ class HeadToc < HeadInformation
def initialize(md)
super(md)
@md=md
+ @o_str ||=SiSU_Env::ProcessingSettings.new(md).output_dir_structure
+ @make=SiSU_Env::ProcessingSettings.new(@md)
end
def scroll_head_navigation_band
- pdf=if @md.programs[:pdf]
- <<WOK
+ if @make.build.html_top_band?
+ search_and_manifest=<<WOK
<td align="center" width="60%">
- #{make_seg_scroll_pdf}
+ #{make_scroll_search_form_and_manifest_link}
</td>
WOK
- else ''
- end
- %{<table summary="table of contents scroll navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}>
+ %{<table summary="table of contents scroll navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}>
<tr><td width="20%">
- #{@vz.banner_band}
-</td>#{pdf}
+ #{button_home(:scroll)}
+</td>
+<td width="75%" align="center">
+ #{doc_types}
+</td>
<td width="20%">
&nbsp;
#{@vz.table_close}
<p />}
+ else ''
+ end
end
- def concordance_navigation_band(type='')
- %{<table summary="concordance navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}>
-<tr><td width="20%">
- #{@vz.banner_band}
-</td>
-<td width="20%" align="right">
- &nbsp;<a href="index.html" target="_top" alt="-&gt;">
- #{@vz.png_nav_toc}
- </a>&nbsp;
-#{@vz.table_close}
-<p />}
- end
- def seg_head_navigation_band(type='')
- firstseg=%{<a href="#{@md.fnl[:pre]}#{@md.firstseg}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" target="_top" alt="-&gt;">
- #{@vz.png_nav_nxt}
- </a>} if @md.firstseg =~/\S+/
- %{<table summary="table of contents segment navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}>
+ def concordance_navigation_band
+ if @make.build.html_top_band?
+ %{<table summary="concordance navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}>
<tr><td width="20%">
- #{@vz.banner_band}
+ #{button_home}
</td>
<td width="75%" align="center">
#{doc_types}
</td>
<td width="5%" align="right">
- &nbsp;#{firstseg}&nbsp;
+ &nbsp;<a href="toc.html" target="_top" alt="-&gt;">
+ #{png_nav.toc}
+ </a>&nbsp;
#{@vz.table_close}
<p />}
- end
- def seg_head_navigation_band_bottom(type='') #retired 2.7.9
- if type=~/pdf/
- @tocband_segtoc=make_scroll_seg_pdf
+ else ''
end
- firstseg=%{<a href="#{@md.fnl[:pre]}#{@md.firstseg}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" target="_top" alt="-&gt;">
- #{@vz.png_nav_nxt}
+ end
+ def seg_head_navigation_band(page=:seg)
+ firstseg=%{<a href="#{@md.firstseg}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top" alt="-&gt;">
+ #{png_nav.nxt}
</a>} if @md.firstseg =~/\S+/
%{<table summary="table of contents segment navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}>
<tr><td width="20%">
- &nbsp;
+#{button_home(page)}
</td>
<td width="75%" align="center">
- #{@tocband_segtoc}
+ #{doc_types(page)}
</td>
<td width="5%" align="right">
&nbsp;#{firstseg}&nbsp;
@@ -326,22 +353,23 @@ WOK
<p />}
end
def manifest_link(text)
+# @file=SiSU_Env::FileOp.new(@md) if @md
%{<font size=2>
- <a href="#{@md.fn[:manifest]}" target="_top" #{@vz.js_manifest}>#{text}</a>
+ <a href="#{@md.file.base_filename.manifest}" target="_top">#{text}</a>
</font>}
end
- def concordance_link(text) #retired 2.7.9
+ def concordance_link(text)
if @md.concord_make
%{<font size=2>
- <a href="#{@md.fn[:concordance]}" target="_top" #{@vz.js_concordance}>
+ <a href="#{@md.file.base_filename.html_concordance}" target="_top">
#{text}
</a>
</font>}
else ''
end
end
- def make_seg_scroll_pdf
- wgt=Widget.new(@md)
+ def make_scroll_search_form_and_manifest_link
+ wgt=SiSU_HTML_Format::Widget.new(@md)
scroll=%{<td align="center" bgcolor=#{@vz.color_band2}>
#{@vz.nav_txt_doc_link}
</td>
@@ -354,7 +382,7 @@ WOK
end
def make_scroll_seg_pdf
manifest=scroll=seg=''
- wgt=Widget.new(@md)
+ wgt=SiSU_HTML_Format::Widget.new(@md)
seg=%{<td align="center" bgcolor=#{@vz.color_band2}>
#{@vz.nav_txt_toc_link}
</td>
@@ -368,7 +396,7 @@ WOK
end
def make_concordance
manifest=scroll=seg=''
- wgt=Widget.new(@md)
+ wgt=SiSU_HTML_Format::Widget.new(@md)
%{<table summary="toc scroll and segment with pdf" border="0" cellpadding="3" cellspacing="0">
<tr>
<td align="center" bgcolor=#{@vz.color_band2}>
@@ -377,7 +405,7 @@ WOK
</tr></table>}
end
def head
- rdf=SiSU_XML_tags::RDF.new(@md)
+ rdf=SiSU_XML_Tags::RDF.new(@md)
%{#{doc_type}
<head>
<title>
@@ -385,19 +413,18 @@ WOK
</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
#{rdf.metatag_html}
-#{@css.html}
+#{@stylesheet.css_head}
</head>
#{@vz.color_body}
<a name="top" id="top"></a>
<a name="up" id="up"></a>
-<a name="start" id="start"></a>
-#{@vz.js_top}}
+<a name="start" id="start"></a>}
end
def concordance
if @md.concord_make
%{#{@vz.margin_css}
<h4 class="toc">
- <a href="./#{@md.fn[:concordance]}" #{@vz.js_concordance}>
+ <a href="./#{@md.file.base_filename.html_concordance}">
<i>Concordance</i>
</a>
</h4>
@@ -408,12 +435,13 @@ WOK
end
end
def links_guide_vertical_open
+# @file=SiSU_Env::FileOp.new(@md) if @md
url=((defined? @vz.url_hp) && @vz.url_hp =~/^https?:\/\/\S+$/ ? @vz.url_hp : @vz.url_home)
%{
<div id="vertical_links">
<ul id="vertical">
<li class="refbold">
- <a href="#{url}" #{@vz.js_home}>
+ <a href="#{url}">
#{@vz.txt_hp}
</a>
</li>
@@ -421,19 +449,20 @@ WOK
Quick Ref.:
</li>
<li class="ref">
- <a href="#{@md.fn[:manifest]}" alt="Document Manifest" target="_top">
+ <a href="#{@md.file.base_filename.manifest}" alt="Document Manifest" target="_top">
Manifest
</a>
</li>
<!- quick ref -!>}
end
def links_guide_horizontal_open
+# @file=SiSU_Env::FileOp.new(@md) if @md
url=((defined? @vz.url_hp) && @vz.url_hp =~/^https?:\/\/\S+$/ ? @vz.url_hp : @vz.url_home)
%{
<div id="horizontal_links">
<ul id="horizontal">
<li class="refbold">
- <a href="#{url}" #{@vz.js_home}>
+ <a href="#{url}">
#{@vz.txt_hp}
</a>
</li>
@@ -441,16 +470,16 @@ WOK
Quick Ref.:
</li>
<li class="ref">
- <a href="#{@md.fn[:manifest]}" alt="Document Manifest" target="_top">
+ <a href="#{@md.file.base_filename.manifest}" alt="Document Manifest" target="_top">
Manifest
</a>
</li>
<!- quick ref -!>}
end
def links_guide_open(type='horizontal')
- if type=='vertical'; links_guide_vertical_open
- else links_guide_horizontal_open
- end
+ (type=='vertical') \
+ ? links_guide_vertical_open
+ : links_guide_horizontal_open
end
def links_guide_close
insert=''
@@ -518,12 +547,15 @@ WOK
#{@vz.table_close}}
end
def manifest #check structure
- manifest=manifest_link(@vz.nav_txt_manifest)
- %{#{@vz.margin_txt_3}
+ if not @o_str.dump_or_redirect?
+ manifest=manifest_link(@vz.nav_txt_manifest)
+ %{#{@vz.margin_txt_3}
#{@vz.paragraph_font_small}
#{manifest}
</font>
#{@vz.table_close}}
+ else ''
+ end
end
def concordance #check structure
concord=concordance_link(@vz.nav_txt_concordance)
@@ -536,16 +568,12 @@ WOK
def metadata
%{#{@vz.margin_css}
<h4 class="toc">
- <a href="#{@metalink}" #{@vz.js_metalink}>
+ <a href="#{@metalink}">
<i>MetaData</i>
</a>
</h4>
#{@vz.table_close}}
end
- def seg_metadata
- @metalink=%{./#{@md.fn[:metadata]}}
- metadata
- end
def seg_tail
%{
<div class="main_column">
@@ -553,6 +581,11 @@ WOK
<table summary="toc segment tail" bgcolor=#{@vz.color_band1}>
<tr><td width="20%">
#{@vz.banner_band}
+</td>
+<td width="60%">
+ <center>
+ #{@tocband_segtoc}
+ </center>
</td></tr>
</table>
<p>&nbsp;</p>
@@ -605,83 +638,85 @@ WOK
}
end
end
- class Head_seg < Head_information
- def initialize(md) #(md='')
+ class HeadSeg < HeadInformation
+ def initialize(md)
super(md)
end
- def head
- rdf=SiSU_XML_tags::RDF.new(@md)
- %{#{doc_type}
-<head>
- <title>
- #{@seg_name_html[@seg_name_html_tracker]} -
- #{@md.html_title}
- </title>
-<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
-#{rdf.metatag_html}
-#{@vz.font_css_table_file}
-</head>
-#{@vz.color_body}
-<a name="top" id="top"></a>
-<a name="up" id="up"></a>
-<a name="start" id="start"></a>
-#{@vz.js_top}}
- end
def title_banner(title,subtitle,creator)
end
def dot_control_pre_next
+ pre="#{@seg_name_html[@seg_name_html_tracker-1]}#{@md.lang_code_insert}#{Sfx[:html]}"
+ up=@toc
+ nxt="#{@seg_name_html[@seg_name_html_tracker+1]}#{@md.lang_code_insert}#{Sfx[:html]}"
+ if nxt=~/sisu_manifest\.html/
+ @file=SiSU_Env::FileOp.new(@md) if @md
+ if @file.output_dir_structure.by_language_code? \
+ or @file.output_dir_structure.by_filetype?
+ nxt=nxt.gsub(/sisu_manifest\.html/,"../../manifest/#{@file.base_filename.manifest}")
+ end
+ end
%{<table summary="segment hidden control pre and next" width="100%" border="0" cellpadding="0" bgcolor=#{@vz.color_grey_pale} align="center">
<tr><td align="left">
- <a href="#{@md.fnl[:pre]}#{@seg_name_html[@seg_name_html_tracker-1]}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" target="_top" #{@vz.js_prev}>
- #{@vz.png_nav_dot_pre}
+ <a href="#{pre}" target="_top">
+ #{png_nav.dot_pre}
</a>
</td>
<td align="center">
- <a href="#{@md.fnl[:pre]}#{@index}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" target="_top" #{@vz.js_toc}>
- #{@vz.png_nav_dot_toc}
+ <a href="#{up}" target="_top">
+ #{png_nav.dot_toc}
</a>
</td>
<td align="right">
- <a href="#{@md.fnl[:pre]}#{@seg_name_html[@seg_name_html_tracker+1]}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" target="_top" #{@vz.js_next}>
- #{@vz.png_nav_dot_nxt}
+ <a href="#{nxt}" target="_top">
+ #{png_nav.dot_nxt}
</a>
#{@vz.table_close}}
end
def dot_control_pre
+ pre="#{@seg_name_html[@seg_name_html_tracker-2]}#{@md.lang_code_insert}#{Sfx[:html]}"
+ up=@toc
+ nxt="#{@md.file.base_filename.html_segtoc}"
%{<table summary="segment hidden control pre" width="100%" border="0" cellpadding="0" bgcolor=#{@vz.color_grey_pale} align="center">
<tr><td align="left">
- <a href="#{@md.fnl[:pre]}#{@seg_name_html[@seg_name_html_tracker-2]}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" target="_top" #{@vz.js_prev}>
- #{@vz.png_nav_dot_pre}
+ <a href="#{pre}" target="_top">
+ #{png_nav.dot_pre}
</a>
</td>
<td align="center">
- <a href="#{@md.fnl[:pre]}#{@index}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" target="_top" #{@vz.js_toc}>
- #{@vz.png_nav_dot_toc}
+ <a href="#{up}" target="_top">
+ #{png_nav.dot_toc}
</a>
</td>
<td align="right">
- <a href="#{@md.fn[:toc]}" target="_top" #{@vz.js_next}>
- #{@vz.png_nav_dot_nxt}
+ <a href="#{nxt}" target="_top">
+ #{png_nav.dot_nxt}
</a>
#{@vz.table_close}}
end
def toc_nav(f_pre=false,f_nxt=false,use=1)
pre=nxt=''
toc=%{<td align="center" bgcolor=#{@vz.color_band1}>
- <a href="#{@md.fnl[:pre]}#{@index}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" target="_top" #{@vz.js_toc}>
- #{@vz.png_nav_toc}
+ <a href="#{@toc}" target="_top">
+ #{png_nav.toc}
</a>
</td>}
pre=%{<td align="center" bgcolor=#{@vz.color_band1}>
- <a href="#{@md.fnl[:pre]}#{@seg_name_html[@seg_name_html_tracker-use]}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" target="_top" #{@vz.js_prev}>
- #{@vz.png_nav_pre}
+ <a href="#{@seg_name_html[@seg_name_html_tracker-use]}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top">
+ #{png_nav.pre}
</a>
</td>} if f_pre==true
nxt=%{<td align="center" bgcolor=#{@vz.color_band1}>
- <a href="#{@md.fnl[:pre]}#{@seg_name_html[@seg_name_html_tracker+1]}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" target="_top" #{@vz.js_next}>
- #{@vz.png_nav_nxt}
+ <a href="#{@seg_name_html[@seg_name_html_tracker+1]}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top">
+ #{png_nav.nxt}
</a>
</td>} if f_nxt==true
+ if nxt =~/sisu_manifest.html/
+ @file=SiSU_Env::FileOp.new(@md) if @md
+ if @file.output_dir_structure.by_language_code? \
+ or @file.output_dir_structure.by_filetype?
+ nxt=nxt.gsub(/sisu_manifest\.html/,"../../manifest/#{@file.base_filename.manifest}")
+ end
+ end
%{<table summary="segment navigation pre/next" border="0" cellpadding="3" cellspacing="0">
<tr>
#{pre}
@@ -702,7 +737,7 @@ WOK
end
def manifest_link(text)
%{<font size=2>
- <a href="#{@md.fn[:manifest]}" target="_top" #{@vz.js_manifest}>
+ <a href="#{@md.file.base_filename.manifest}" target="_top">
#{text}
</a>
</font>}
@@ -710,7 +745,7 @@ WOK
def concordance_link(text)
if @md.concord_make
%{<font size=2>
- <a href="#{@md.fn[:concordance]}" target="_top" #{@vz.js_concordance}>
+ <a href="#{@md.file.base_filename.html_concordance}" target="_top">
#{text}
</a>
</font>}
@@ -734,42 +769,6 @@ WOK
<tr><td valign="top">
<font size="2">}
end
- def heading_advert_local_1
- dir=SiSU_Env::Info_env.new(@fns)
- %{ <center>
-<table summary="image" border="0" cellpadding="3" cellspacing="0" align="center">
-<tr><td align="center" bgcolor="white">
- <a href="http://#{@md.ad_url}#{Sfx[:html]}" target="_top">
- <img border="0" src="#{dir.url.images_local}/#{@md.ad_png}" alt="#{@md.ad_alt}">
- </a>
- <p />
-#{@vz.table_close}
-</center>}
- end
- def heading_advert_local_2
- dir=SiSU_Env::Info_env.new(@fns)
- %{ <center>
-<table summary="image" border="0" cellpadding="3" cellspacing="0" align="center">
-<tr><td align="center" bgcolor="white">
- <a href="#{@md.ad_url}#{Sfx[:html]}" target="_top">
- <img border="0" src="#{dir.url.images_local}/#{@md.ad_png}" alt="#{@md.ad_alt}">
- </a>
- <p />
-#{@vz.table_close}
-</center>}
- end
- def heading_advert_external
- dir=SiSU_Env::Info_env.new(@fns)
- %{ <center>
-<table summary="image" border="0" cellpadding="3" cellspacing="0" align="center">
-<tr><td align="center" bgcolor="white">
- <a href="#{@md.ad_url}#{Sfx[:html]}" target="external">
- <img border="0" src="#{dir.url.images_local}/#{@md.ad_png}" alt="#{@md.ad_alt}">
- </a>
- <p />
-#{@vz.table_close}
-</center>}
- end
def credit
%{
<div class="main_column">
@@ -787,7 +786,7 @@ WOK
def navigation_band(segtocband,seg_table_top_control) #change name to navigation_band_banner
%{<table summary="segment navigation band with banner" bgcolor=#{@vz.color_band1} width="100%"><tr>
<td width="20%" align="left">
-#{@vz.banner_band}
+#{button_home}
</td>
<td width="75%" align="center">
#{doc_types}
@@ -829,8 +828,8 @@ WOK
</div>
} #revisit
end
- def head
- rdf=SiSU_XML_tags::RDF.new(@md)
+ def head_seg
+ rdf=SiSU_XML_Tags::RDF.new(@md)
%{#{doc_type}
<head>
<title>
@@ -839,17 +838,12 @@ WOK
</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
#{rdf.metatag_html}
-#{@css.html}
+#{@stylesheet.css_head_seg}
</head>
#{@vz.color_body}
<a name="top" id="top"></a>
<a name="up" id="up"></a>
-<a name="start" id="start"></a>
-#{@vz.js_top}}
- end
- def toc_metadata
- @metalink=%{./#{@md.fn[:meatadata]}}
- toc_metadata
+<a name="start" id="start"></a>}
end
def title_banner(title,subtitle,creator)
%{
@@ -873,7 +867,7 @@ WOK
}
end
end
- class Head_scroll < Head_toc
+ class HeadScroll < HeadToc
def initialize(md)
super(md)
end
@@ -890,12 +884,12 @@ WOK
#{@vz.table_close}}
end
end
- class Format_text_object
- @vz=SiSU_Env::Get_init.instance.skin
+ class FormatTextObject
+ @vz=SiSU_Viz::Defaults.new
attr_accessor :md,:t_o,:txt,:ocn,:format,:table,:link,:linkname,:paranum,:p_num,:headname,:banner,:url
def initialize(md,t_o)
@md,@t_o=md,t_o
- if t_o.class==Hash
+ if t_o.is_a?(Hash)
@txt =t_o[:txt] || nil
@ocn =t_o[:ocn] || nil
@ocn_display =t_o[:ocn_display] || nil
@@ -906,24 +900,25 @@ WOK
@lnk_url =t_o[:lnk_url] || nil
@lnk_txt =t_o[:lnk_txt] || nil
@format =t_o[:format] || nil
- elsif t_o.class.inspect =~/^(?:#<)?SiSU_document_structure/
+ elsif t_o.class.inspect =~/^(?:#<)?SiSU_DAL_DocumentStructure/
@dob=t_o if defined? t_o.is
@named=nametags_seg(@dob)
@txt=((defined? t_o.obj) ? t_o.obj : nil)
@ocn=((defined? t_o.ocn) ? t_o.ocn.to_s : nil)
- @headname=((t_o.is=='heading' and defined? t_o.name) ? t_o.name : nil)
+ @headname=((t_o.is==:heading and defined? t_o.name) ? t_o.name : nil)
else
- if @md.cmd =~/M/
+ if @md.opt.cmd =~/M/
p t_o.class
p caller
end
end
@headnamed= (@headname ? %{<a name="h#{@headname}" id="h#{@headname}"></a>} : nil)
if @txt and not @txt.empty?
- @txt.gsub!(/#{Mx[:mk_o]}[-~]##{Mx[:mk_c]}/,'')
+ @txt=@txt.gsub(/#{Mx[:mk_o]}[-~]##{Mx[:mk_c]}/,'')
end
- @p_num=Paragraph_number.new(@md,@ocn)
- @vz=SiSU_Env::Get_init.instance.skin
+ @p_num=ParagraphNumber.new(@md,@ocn)
+ @vz=SiSU_Viz::Defaults.new
+ @make=SiSU_Env::ProcessingSettings.new(@md)
end
def nametags_scroll(dob)
tags=''
@@ -940,17 +935,17 @@ WOK
if defined? dob.tags \
and dob.tags.length > 0 # insert tags "hypertargets"
dob.tags.each do |t|
- tags=tags +%{<a name="#{t}" />}
+ tags=tags +%{<a name="#{t}" ></a>}
end
end
tags
end
def headname #check whether used
- hn=if @t_o.is =='heading' \
+ hn=if @t_o.is ==:heading \
and not @t_o.name.empty? #determine use
- hn=if @t_o.is =='heading'; %{<a name="h#{@t_o.name}" id="h#{@t_o.name}"></a>}
- else %{<a name="#{@t_o.name}" id="#{@t_o.name}"></a>}
- end
+ hn=(@t_o.is ==:heading) \
+ ? (%{<a name="h#{@t_o.name}" id="h#{@t_o.name}"></a>})
+ : (%{<a name="#{@t_o.name}" id="#{@t_o.name}"></a>})
else nil
end
hn
@@ -994,6 +989,9 @@ WOK
def para
para_form_css('p','norm')
end
+ def block
+ para_form_css('p','block')
+ end
def group
para_form_css('p','group')
end
@@ -1017,22 +1015,20 @@ WOK
end
def table
@txt=if @t_o.obj !~/^<table\s/
- table=SiSU_HTML_shared::Table_html.new(@t_o) #move, make happen earlier
+ table=SiSU_HTML_Shared::TableHTML.new(@t_o) #move, make happen earlier
@txt=table.table.obj
else @txt
end
para_form_css('p','norm')
end
- def break
- @txt.gsub!(/#{Mx[:br_page_new]}|#{Mx[:br_page]}/,'<hr /><br />')
- @txt.gsub!(/#{Mx[:obj_ln_sep]}/,'<hr style="width:30%" /><br />')
- para_form_css('p','norm')
- end
def format(tag,attrib)
para_form_css(tag,attrib)
end
def heading_normal(tag,attrib)
- %{
+ section_break=(tag=~/h[1-4]/) \
+ ? '<p><hr width=90% /></p>'
+ : ''
+ %{#{section_break}
<div class="substance">
#{@p_num.ocn_display}
<#{tag} class="#{attrib}" #{@p_num.id}>#{@p_num.name}
@@ -1063,8 +1059,11 @@ WOK
heading_normal('h6','norm')
end
def title_heading(tag,attrib)
+ cl=(@make.build.html_minitoc?) \
+ ? 'content'
+ : 'content0'
%{
-<div class="content">
+<div class="#{cl}">
<#{tag} class="#{attrib}">
#{@named}#{@txt}
</#{tag}>
@@ -1084,7 +1083,7 @@ WOK
''
end
def seg_heading_sub(tag,attrib)
- @txt.gsub!(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ')
+ @txt=@txt.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ')
%{
<div class="substance">
#{@p_num.ocn_display}
@@ -1119,15 +1118,16 @@ WOK
</div>'
end
def gsub_body #fix
- case @txt
+ @txt=case @txt
when /^\((i+|iv|v|vi+|ix|x|xi+)\)/
- @txt.gsub!(/^\((i+|iv|v|vi+|ix|x|xi+)\)/,'<b>(\1)</b>')
+ @txt.gsub(/^\((i+|iv|v|vi+|ix|x|xi+)\)/,'<b>(\1)</b>')
when /^\(?(\d|[a-z])+\)/
- @txt.gsub!(/^\((\d+|[a-z])+\)/,'<b>(\1)</b>')
+ @txt.gsub(/^\((\d+|[a-z])+\)/,'<b>(\1)</b>')
when /^\s*\d{1,3}\.\s/
- @txt.gsub!(/^\s*(\d+\.)/,'<b>\1</b>')
+ @txt.gsub(/^\s*(\d+\.)/,'<b>\1</b>')
when /^\s*[A-Z]\.\s/
- @txt.gsub!(/^\s*([A-Z]\.)/,'<b>\1</b>')
+ @txt.gsub(/^\s*([A-Z]\.)/,'<b>\1</b>')
+ else @txt
end
end
def bold_para
@@ -1140,8 +1140,8 @@ WOK
#{@vz.table_close}}
end
def bold_heading
- @txt.gsub!(/[1-9]~(\S+)/,'<a name="\1"></a>')
- @txt.gsub!(/[1-9]~/,'')
+ @txt=@txt.gsub(/[1-9]~(\S+)/,'<a name="\1"></a>').
+ gsub(/[1-9]~/,'')
%{<p class="bold">
#{@txt}
</p>
@@ -1162,13 +1162,13 @@ WOK
%{<p class="centerbold">#{@txt}</p>\n}
end
end
- class Format_scroll < Format_text_object
+ class FormatScroll < FormatTextObject
def initialize(md,txt)
super(md,txt)
- @vz=SiSU_Env::Get_init.instance.skin
+ @vz=SiSU_Viz::Defaults.new
end
end
- class Format_seg < Format_text_object
+ class FormatSeg < FormatTextObject
def initialize(md,txt)
super(md,txt)
end
@@ -1224,13 +1224,13 @@ WOK
fn='doc' if fn.to_s.empty? #you may wish to reconsider, sends to 'doc' where no segment info
%{
<p class="endnote">
- #{@endnote_part_a}#{@md.fnl[:pre]}#{fn}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}#{@endnote_part_b}
+ #{@endnote_part_a}#{fn}#{@md.lang_code_insert}#{Sfx[:html]}#{@endnote_part_b}
</p>
}
end
def clean(txt)
- txt.gsub!(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/,'')
- txt.gsub!(/#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/,'')
+ txt=txt.gsub(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/,'').
+ gsub(/#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/,'')
txt
end
def subtoc_lev(tag,attrib)
@@ -1243,9 +1243,9 @@ WOK
note=''
if txt =~/(#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})/m # had \s* at end
note=$1
- note.gsub!(/[\n\s]+/m,' ')
- txt.gsub!(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ')
- txt.gsub!(/<a[\n\s]+name="-\d+"[\n\s]+href="#_\d+">&nbsp;<sup>\d+<\/sup>&nbsp;/m,'')
+ note=note.gsub(/[\n\s]+/m,' ')
+ txt=txt.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ').
+ gsub(/<a[\n\s]+name="-\d+"[\n\s]+href="#_\d+">&nbsp;<sup>\d+<\/sup>&nbsp;/m,'')
end
%{<#{tag} class="#{attrib}">
<a href="##{@ocn}"><i>#{txt}</i></a> #{note}
@@ -1258,7 +1258,7 @@ WOK
subtoc_lev('h6','subtoc') if @txt
end
def heading_sub(tag,attrib)
- @txt.gsub!(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ')
+ @txt=@txt.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ')
%{
<div class="substance">
#{@p_num.ocn_display}
@@ -1307,7 +1307,7 @@ WOK
"<center>#{@txt}</center>"
end
end
- class Format_toc < Format_text_object
+ class FormatToc < FormatTextObject
def initialize(md,txt)
super(md,txt)
end
@@ -1350,7 +1350,7 @@ WOK
lev('h0','toc')
end
def strip_endnotes(txt)
- txt.gsub!(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ')
+ txt=txt.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ')
txt
end
def mini_lev1
@@ -1398,7 +1398,7 @@ WOK
}
end
end
- class Format_str
+ class FormatStr
def initialize(md,str)
@str=str
end
diff --git a/lib/sisu/v2/html_minitoc.rb b/lib/sisu/v4/html_minitoc.rb
index 00b6e384..5f562d19 100644
--- a/lib/sisu/v2/html_minitoc.rb
+++ b/lib/sisu/v4/html_minitoc.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -8,7 +8,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -32,11 +33,9 @@
If you have Internet connection, the latest version of the GPL should be
available at these locations:
<http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/copyleft/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -48,7 +47,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -57,35 +56,36 @@
** Description: system environment, resource control and configuration details
=end
- module SiSU_HTML_minitoc
- require "#{SiSU_lib}/html_tune" # html_tune.rb
+ module SiSU_HTML_MiniToc
+ require_relative 'html_tune' # html_tune.rb
include SiSU_HTML_Tune
- class Toc_mini
+ 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.cmd) if @md
+ @tell=SiSU_Screen::Ansi.new(@md.opt.cmd) if @md
end
def songsheet
- SiSU_Screen::Ansi.new(@md.cmd,'Toc').txt_grey if @md.cmd =~/[MVv]/
+ SiSU_Screen::Ansi.new(@md.opt.cmd,'Toc').txt_grey if @md.opt.cmd =~/[MVv]/
toc=nil
@toc=[]
@data.each do |txt|
- if (txt.is =='heading' or txt.is =='heading_insert')
- txt.obj.gsub!(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]}).+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m,'') #remove endnotes from toc
- txt.obj.gsub!(/<a name="-\d+" href="#_\d+">&nbsp;<sup>\d+<\/sup>&nbsp;<\/a>/,'')
- txt.obj.gsub!(@pat_strip_heading_name,'\1')
- txt.obj.gsub(/(.*?)<a name="(\d+)"><\/a>(.*)/,'\1') #2002w42 altered gsub! - problematic? - suspect
+ 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 1; Toc_mini.new(@md,txt).level_1
- when 2; Toc_mini.new(@md,txt).level_2
- when 3; Toc_mini.new(@md,txt).level_3
- when 4; Toc_mini.new(@md,txt).level_4
- when 5; Toc_mini.new(@md,txt).level_5
- when 6; Toc_mini.new(@md,txt).level_6
+ when 1; SiSU_HTML_MiniToc::TocMini.new(@md,txt).level_1
+ when 2; SiSU_HTML_MiniToc::TocMini.new(@md,txt).level_2
+ when 3; SiSU_HTML_MiniToc::TocMini.new(@md,txt).level_3
+ when 4; SiSU_HTML_MiniToc::TocMini.new(@md,txt).level_4
+ when 5; SiSU_HTML_MiniToc::TocMini.new(@md,txt).level_5
+ when 6; SiSU_HTML_MiniToc::TocMini.new(@md,txt).level_6
else
end
@toc << toc
@@ -95,31 +95,32 @@
end
protected
def level_concordance
- format_head_toc=SiSU_HTML_Format::Head_toc.new(@md)
+ 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::Head_toc.new(@md)
+ 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::Head_toc.new(@d0c)
+ format_head_toc=SiSU_HTML_Format::HeadToc.new(@d0c)
@@seg_mini << format_head_toc.mini_concordance
end
def level_1
txt=@data
- if (txt.is =='heading' or txt.is =='heading_insert') \
- and txt.ocn !=0
- txt.obj.gsub!(@pat_strip_heading_name,'\1')
+ 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/; txt.obj
else
link='metadata'
- %{<b><a href="#{@md.fnl[:pre]}#{link}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}">#{txt.obj}</a></b>}
+ %{<b><a href="#{link}#{@md.lang_code_insert}#{Sfx[:html]}">#{txt.obj}</a></b>}
end
toc={}
- txt_obj={:txt =>title}
- format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj)
+ 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
@@ -128,19 +129,20 @@
end
def level_2
txt=@data
- if (txt.is =='heading' or txt.is =='heading_insert') \
- and txt.ocn !=0
- txt.obj.gsub!(@pat_strip_heading_name,'\1')
+ 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::Format_toc.new(@md,txt_obj)
+ 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::Format_toc.new(@md,txt_obj)
+ txt_obj={ txt: txt.obj }
+ format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj)
toc_mini=format_toc.mini_lev3
toc_mini
end
@@ -148,48 +150,50 @@
txt=@data
unless txt =~/~metadata/
if txt.ln ==4
- seg_link=%{ <a href="#{@md.fnl[:pre]}#{txt.name}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" target="_top">
+ seg_link=%{ <a href="#{txt.name}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top">
#{txt.obj}
</a> }
@@seg_url=txt.name
elsif txt.obj =~/\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+/
seg_link=txt.obj.gsub(/^(\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+)(.*)/,
- %{<a href="#{@md.fnl[:pre]}\\2#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" } +
+ %{<a href="\\2#{@md.lang_code_insert}#{Sfx[:html]}" } +
%{target="_top">\\1 \\2</a> })
end
- txt_obj={:txt =>seg_link}
- format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj)
+ 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' or txt.is =='heading_insert') \
- and txt.ocn !=0
- txt.obj.gsub!(@pat_strip_heading_name,'\1')
+ if (txt.is ==:heading \
+ || txt.is ==:heading_insert) \
+ && txt.ocn !=0
+ txt.obj=txt.obj.gsub(@pat_strip_heading_name,'\1')
end
toc={}
- lnk_n_txt=%{ <a href="#{@md.fnl[:pre]}#{@@seg_url}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}##{txt.ocn}">
+ lnk_n_txt=%{ <a href="#{@@seg_url}#{@md.lang_code_insert}#{Sfx[:html]}##{txt.ocn}">
#{txt.obj}
</a>}
- txt_obj={:txt =>lnk_n_txt}
- format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj)
+ 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' or txt.is =='heading_insert') \
- and txt.ocn !=0
- txt.obj.gsub!(@pat_strip_heading_name,'\1')
+ if (txt.is ==:heading \
+ || txt.is ==:heading_insert) \
+ && txt.ocn !=0
+ txt.obj=txt.obj.gsub(@pat_strip_heading_name,'\1')
end
toc={}
- lnk_n_txt=%{ <a href="#{@md.fnl[:pre]}#{@@seg_url}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}##{txt.ocn}">
+ lnk_n_txt=%{ <a href="#{@@seg_url}#{@md.lang_code_insert}#{Sfx[:html]}##{txt.ocn}">
#{txt.obj}
</a>}
- txt_obj={:txt =>lnk_n_txt}
- format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj)
+ 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
diff --git a/lib/sisu/v2/html_promo.rb b/lib/sisu/v4/html_promo.rb
index 290e74f2..70e63335 100644
--- a/lib/sisu/v2/html_promo.rb
+++ b/lib/sisu/v4/html_promo.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -56,41 +55,52 @@
** Description: html advertising component, build here, mockup
=end
-module SiSU_HTML_promo
- require "#{SiSU_lib}/sysenv" # sysenv.rb
+module SiSU_HTML_Promo
+ require_relative 'sysenv' # sysenv.rb
include SiSU_Env
class Ad
def initialize(md)
@md=md
- @env=SiSU_Env::Info_env.new(@md.fns,@md)
- @rc=SiSU_Env::Get_init.instance.yamlrc
- @ad=SiSU_Env::Get_init.instance.ads
- @vz=SiSU_Env::Get_init.instance.skin
+ @env=SiSU_Env::InfoEnv.new(@md.fns,@md)
+ @rc=SiSU_Env::GetInit.new.sisu_yaml.rc
+ @ad=SiSU_Env::GetInit.new.ads
+ @vz=SiSU_Viz::Defaults.new
@flag=@env.widget.promo?
+ @make=SiSU_Env::ProcessingSettings.new(@md)
end
def div
def major
- @flag[:ad] ? '<div id="pane_major">' : ''
+ (@make.build.html_right_pane? \
+ && @flag[:ad]) \
+ ? '<div id="pane_major">'
+ : ''
end
def minor
- @flag[:ad] ? '<div id="pane_minor">' : ''
+ (@make.build.html_right_pane? \
+ && @flag[:ad]) \
+ ? '<div id="pane_minor">'
+ : ''
end
def close
- @flag[:ad] ? '</div>' : ''
+ (@make.build.html_right_pane? \
+ && @flag[:ad]) \
+ ? '</div>'
+ : ''
end
self
end
- def display #(type=nil,id=nil)
+ def display
ads_array,promo_array=[],[]
- if @flag[:ad]
+ if @make.build.html_right_pane? \
+ && @flag[:ad]
ads=if @md.promo && @md.promo.length > 0 #promo set in document
promo_array=@md.promo
- elsif @flag[:sk] #promo set in associated skin
+ elsif @flag[:sk] #promo set
promo_array=@vz.widget_promo
elsif @flag[:rc] #promo set in rc file
- promo_array=if @rc['promo'].class==String
- @rc['promo'].split(/[,;]\s*/)
- else @rc['promo']
+ promo_array=if @rc['html']['promo'].is_a?(String)
+ @rc['html']['promo'].split(/[,;]\s*/)
+ else @rc['html']['promo']
end
else advert_extract_all
end
@@ -150,7 +160,7 @@ module SiSU_HTML_promo
elsif defined? @rc['search']['sisu']['db'] \
and @rc['search']['sisu']['db'] =~/\S+/
(@rc['search']['sisu']['db']=~/^#{Db[:name_prefix]}\S+/) \
- ? @prod['search']['sisu']['db'] \
+ ? @prod['search']['sisu']['db']
: "#{Db[:name_prefix]}#{@prod['db']}"
else nil
end
@@ -396,7 +406,7 @@ WOK
adverts << output_form_select(type,id)
else
if defined? @ad[:promo][category][type][id] \
- and @ad[:promo][category][type][id].class==Array \
+ and @ad[:promo][category][type][id].is_a?(Array) \
and @ad[:promo][category][type][id].length > 0
adverts << @ad[:promo][category][type][id].join("\n")
end
@@ -405,7 +415,7 @@ WOK
end
end
else
- SiSU_Screen::Ansi.new(@md.cmd,"category not found: #{category}").warn unless @md.cmd =~/q/
+ SiSU_Screen::Ansi.new(@md.opt.cmd,"*WARN* category not found: #{category}").warn unless @md.opt.cmd =~/q/
end
adverts.join
end
diff --git a/lib/sisu/v2/html_scroll.rb b/lib/sisu/v4/html_scroll.rb
index bc6b4812..98f922b2 100644
--- a/lib/sisu/v2/html_scroll.rb
+++ b/lib/sisu/v4/html_scroll.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -56,22 +55,25 @@
** Description: html scroll generation, processing
=end
-module SiSU_HTML_scroll
- require "#{SiSU_lib}/shared_html" # shared_html.rb
- require "#{SiSU_lib}/html" # html.rb
- require "#{SiSU_lib}/shared_metadata" # shared_metadata.rb
- require "#{SiSU_lib}/html_promo" # html_promo.rb
+module SiSU_HTML_Scroll
+ require_relative 'shared_html' # shared_html.rb
+ require_relative 'html' # html.rb
+ require_relative 'shared_metadata' # shared_metadata.rb
+ require_relative 'html_promo' # html_promo.rb
class Scroll
def initialize(md='',data='',endnotes='')
@md,@data,@endnotes=md,data,endnotes
- @vz=SiSU_Env::Get_init.instance.skin
+ @vz=SiSU_Viz::Defaults.new
end
def songsheet
begin
- scr=Scroll.new(@md,@data,@endnotes).markup
- scr[:tails]=Scroll.new(@md).tails
+ scr=SiSU_HTML_Scroll::Scroll.new(@md,@data,@endnotes).markup
+ scr[:tails]=SiSU_HTML_Scroll::Scroll.new(@md).tails
scr
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
ensure
end
end
@@ -79,15 +81,16 @@ module SiSU_HTML_scroll
def markup
data=@data
@rcdc=false
- @scr={ :body=>[],:metadata=>[],:owner_details=>[] }
+ @scr={ body: [], metadata: [], owner_details: [] }
data.each do |dob|
+ dob.obj=dob.obj.gsub(/#{@md.file.output_path.html_seg.rel_image}/m,@md.file.output_path.html_scroll.rel_image)
if defined? dob.name and dob.name =~/^meta/ \
and dob.obj =~/Document Information/
- dob.obj.gsub!(/(Document Information(?: \(metadata\))?)/,'\1<a name="docinfo"></a>')
+ dob.obj=dob.obj.gsub(/(Document Information(?: \(metadata\))?)/,'\1<a name="docinfo"></a>')
end
if dob.obj =~/^Metadata$/ \
and dob.lv =='B'
- dob.obj.gsub!(/Metadata/,'')
+ dob.obj=dob.obj.gsub(/Metadata/,'')
end
if defined? dob.name \
and dob.name =~/^metadata/ \
@@ -95,17 +98,18 @@ module SiSU_HTML_scroll
and dob.obj =~/SiSU Metadata, document information/
@rcdc=true
end
- dob.obj.gsub!(/href="[a-z0-9._-]+(#\S+?")/m,'href="\1') # internal document links
- dob.obj.gsub!(/href="#{Xx[:segment]}/m,'href="')
- dob.obj.gsub!(/(?:\s*#{Mx[:br_page]}\s*|\s*#{Mx[:br_page_new]}\s*)+/m,'<p><hr width=90% /></p>')
+ dob.obj=dob.obj.gsub(/href="[a-z0-9._-]+(#\S+?")/m,'href="\1'). # internal document links
+ gsub(/href="#{Xx[:segment]}/m,'href="').
+ gsub(/(?:\s*#{Mx[:br_page]}\s*|\s*#{Mx[:br_page_new]}\s*)+/m,'<p><hr width=90% /></p>')
if dob.obj !~/(^#{Rx[:meta]}|#{Mx[:br_eof]})/
- unless dob.is =~/^code/; dob.obj.gsub!(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ')
+ unless dob.is ==:code
+ dob.obj=dob.obj.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ')
end
if defined? dob.ocn
- @p_num=SiSU_HTML_Format::Paragraph_number.new(@md,dob.ocn)
+ @p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,dob.ocn)
end
- sto=SiSU_HTML_Format::Format_text_object.new(@md,dob)
- para_html=if dob.is=='heading'
+ sto=SiSU_HTML_Format::FormatTextObject.new(@md,dob)
+ para_html=if dob.is==:heading
x=if dob.ln==1
sto.heading_body1
elsif dob.ln==2
@@ -119,16 +123,24 @@ module SiSU_HTML_scroll
elsif dob.ln==6
sto.heading_body6
end
- elsif dob.is=='heading_insert'
+ elsif dob.is==:heading_insert
x=if dob.ln==1
- sto.heading_body1
+ unless dob.obj.empty?
+ sto.heading_body1
+ end
elsif dob.ln==2
- sto.heading_body2
+ unless dob.obj.empty?
+ sto.heading_body2
+ end
elsif dob.ln==3
- sto.heading_body3
+ unless dob.obj.empty?
+ sto.heading_body3
+ end
elsif dob.ln==4 \
and dob.obj !~/^(?:Endnotes|Index|Metadata|Manifest)$/
- sto.heading_body4
+ unless dob.obj.empty?
+ sto.heading_body4
+ end
elsif dob.ln==4 \
and dob.obj=='Endnotes'
sto.heading_body4
@@ -136,53 +148,59 @@ module SiSU_HTML_scroll
elsif dob.ln==4 \
and dob.obj=='Index'
sto.heading_body4
- book_idx=SiSU_Particulars::Combined_singleton.instance.get_idx_html(@md.opt).html_idx
- book_idx.each do |x| #takes book index prepared for segments and strips segment identifying info
- x.gsub!(/<a href="\S+?\.html#(\d+)">(\1(?:-\d+)?)<\/a>/,'<a href="#\1">\2</a>')
+ book_idx=SiSU_Particulars::CombinedSingleton.instance.get_idx_html(@md.opt).html_idx
+ book_idx.each do |x| #takes book index prepared for segments & strips segment identifying info
+ x=x.gsub(/<a href="\S+?\.html#(\d+)">(\1(?:-\d+)?)<\/a>/,'<a href="#\1">\2</a>')
end
book_idx.join("\n")
- #elsif dob.ln==4 \
- #and dob.obj=~/Meta/
- #p __LINE__
- ##and dob.obj=='Metadata'
- #metadata=Metadata::Summary.new(@md).xhtml.metadata
elsif dob.ln==5
- sto.heading_body5
+ unless dob.obj.empty?
+ sto.heading_body5
+ end
elsif dob.ln==6
- sto.heading_body6
+ unless dob.obj.empty?
+ sto.heading_body6
+ end
end
- elsif dob.is=='para'
+ elsif dob.is==:para
if dob.indent \
- and dob.indent =~/[1-9]/
- if dob.bullet_
- sto.format('li',"i#{dob.indent}")
- else sto.format('p',"i#{dob.indent}")
- end
- else
+ and dob.hang \
+ and dob.indent =~/[0-9]/ \
+ and dob.hang =~/[0-9]/
if dob.bullet_
- sto.format('li','bullet')
+ if dob.indent =~/[1-9]/
+ sto.format('li',"i#{dob.indent}")
+ else
+ sto.format('li','bullet')
+ end
+ elsif dob.indent == dob.hang
+ sto.format('p',"i#{dob.indent}")
+ elsif dob.indent != dob.hang
+ sto.format('p',"h#{dob.hang}i#{dob.indent}")
else sto.para
end
+ else sto.para
end
- elsif dob.is=='group'
+ elsif dob.is==:block
+ sto.block
+ elsif dob.is==:group
sto.group
- elsif dob.is=='alt'
+ elsif dob.is==:alt
sto.alt
- elsif dob.is=='verse'
+ elsif dob.is==:verse
sto.verse
- elsif dob.is=='code'
+ elsif dob.is==:code
sto.code
- elsif dob.is=='table'
+ elsif dob.is==:table
sto.table
- elsif dob.is=='break'
- sto.break
+ elsif dob.is==:break
end
if dob =~/<a name="n\d+">/ \
and dob =~/^(?:\^~\d+\s|<!e[:_]\d+!>)/ # hmmm re-adjusted 200507, for alt endnote which should again be matched ^~ ... not in response to problem though
dob=''
end
- unless @rcdc; @scr[:body] << para_html unless para_html =~/\A\s*\Z/
- else #@scr[:metadata] << dob.obj
+ unless @rcdc
+ @scr[:body] << para_html unless para_html =~/\A\s*\Z/
end
end
end
@@ -190,8 +208,8 @@ module SiSU_HTML_scroll
end
def tails
scr_tail=[]
- format_head_scroll=SiSU_HTML_Format::Head_toc.new(@md)
- ads=SiSU_HTML_promo::Ad.new(@md)
+ format_head_scroll=SiSU_HTML_Format::HeadToc.new(@md)
+ ads=SiSU_HTML_Promo::Ad.new(@md)
scr_tail << format_head_scroll.scroll_tail << ads.div.close << ads.display << format_head_scroll.html_close
scr_tail
end
diff --git a/lib/sisu/v2/html_segments.rb b/lib/sisu/v4/html_segments.rb
index c1649a88..97334023 100644
--- a/lib/sisu/v2/html_segments.rb
+++ b/lib/sisu/v4/html_segments.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -56,59 +55,78 @@
** Description: html segment generation, processing
=end
-module SiSU_HTML_seg
- require "#{SiSU_lib}/shared_html" # shared_html.rb
- require "#{SiSU_lib}/html" # html.rb
- require "#{SiSU_lib}/html_promo" # html_promo.rb
- require "#{SiSU_lib}/shared_metadata" # shared_metadata.rb
- class Seg_output
+module SiSU_HTML_Seg
+ require_relative 'shared_html' # shared_html.rb
+ require_relative 'html' # html.rb
+ require_relative 'html_promo' # html_promo.rb
+ require_relative 'shared_metadata' # shared_metadata.rb
+ class Output
def initialize(md,outputfile,seg,minitoc,type='')
@md,@output_seg_file,@seg,@minitoc,@type=md,outputfile,seg,minitoc,type
- @title_banner_=SiSU_Env::Create_site.new(@md.cmd).html_seg_title_banner?
+ @title_banner_=SiSU_Env::CreateSite.new(@md.opt.cmd).html_seg_title_banner?
+ @file=SiSU_Env::FileOp.new(@md)
+ @make=SiSU_Env::ProcessingSettings.new(@md)
+ @cl=(@make.build.html_minitoc?) \
+ ? 'content'
+ : 'content0'
end
def output
if @seg[:title] =~/\S/
filename_seg=[]
- filename_seg << @seg[:title] << @seg[:tocband_banner]
+ if @make.build.html_top_band?
+ filename_seg << @seg[:title] << @seg[:tocband_banner]
+ else
+ filename_seg << @seg[:title]
+ end
if @type=='endnotes'
@seg[:headings]=[]
- format_head_seg=SiSU_HTML_Format::Head_seg.new(@md)
+ format_head_seg=SiSU_HTML_Format::HeadSeg.new(@md)
if @title_banner_
@seg[:headings] << format_head_seg.title_banner(@md.title.main,@md.title.sub,@author)
end
- txt_obj={:txt =>'Endnotes',:ocn_display =>''}
- format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj)
+ txt_obj={ txt: 'Endnotes', ocn_display: '' }
+ format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj)
@seg[:headings] << format_seg.title_heading1
- filename_seg << @seg[:heading_endnotes] << @minitoc << @seg[:headings] << %{\n<div class="content">\n} << @seg[:endnote_all] << '</div>' # << '</div>'
+ filename_seg << @seg[:heading_endnotes] << @minitoc << @seg[:headings] << %{\n<div class="#{@cl}">\n} << @seg[:endnote_all] << '</div>' # << '</div>'
elsif @type=='idx'
@seg[:headings]=[]
- format_head_seg=SiSU_HTML_Format::Head_seg.new(@md)
+ format_head_seg=SiSU_HTML_Format::HeadSeg.new(@md)
if @title_banner_
@seg[:headings] << format_head_seg.title_banner(@md.title.main,@md.title.sub,@author)
end
- txt_obj={:txt =>'Index',:ocn_display =>''}
- format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj)
+ txt_obj={ txt: 'Index', ocn_display: '' }
+ format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj)
@seg[:headings] << format_seg.title_heading1
- filename_seg << @seg[:heading_idx] << @minitoc << @seg[:headings] << %{\n<div class="content">\n} << @seg[:idx] << '</div>' # << '</div>'
+ filename_seg << @seg[:heading_idx] << @minitoc << @seg[:headings] << %{\n<div class="#{@cl}">\n} << @seg[:idx] << '</div>' # << '</div>'
elsif @type=='metadata'
- metadata=Metadata::Summary.new(@md).xhtml_display.metadata
+ metadata=SiSU_Metadata::Summary.new(@md).xhtml_display.metadata
@seg[:headings]=[]
- format_head_seg=SiSU_HTML_Format::Head_seg.new(@md)
+ format_head_seg=SiSU_HTML_Format::HeadSeg.new(@md)
if @title_banner_
@seg[:headings] << format_head_seg.title_banner(@md.title.main,@md.title.sub,@author)
end
- txt_obj={:txt =>'Metadata',:ocn_display =>''}
- format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj)
+ txt_obj={ txt: 'Metadata', ocn_display: '' }
+ format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj)
@seg[:headings] << format_seg.title_heading1
- filename_seg << @seg[:heading_idx] << @minitoc << @seg[:headings] << %{\n<div class="content">\n} << metadata << '</div>' # << '</div>'
+ filename_seg << @seg[:heading_idx] << @minitoc << @seg[:headings] << %{\n<div class="#{@cl}">\n} << metadata << '</div>' # << '</div>'
else
- filename_seg << @minitoc << @seg[:headings] << @seg[:main] << "\n</div>\n"
+ if @make.build.html_top_band?
+ filename_seg << @minitoc << @seg[:headings] << @seg[:main] << "\n</div>\n"
+ else
+ filename_seg << @minitoc << @seg[:main] << "\n</div>\n"
+ end
end
- filename_seg << @seg[:tail] << @seg[:tocband_bannerless] << @seg[:credits]
- filename_seg.flatten!.compact!
+ filename_seg <<=if @make.build.html_top_band?
+ @seg[:tail] << @seg[:tocband_bannerless] << @seg[:credits]
+ else
+ @seg[:tail] << @seg[:credits]
+ end
+ filename_seg=filename_seg.flatten.compact #watch
filename_seg.each do |str|
unless str =~/\A\s*\Z/
- str.strip!
+ str=str.strip.
+ gsub(Xx[:html_relative2],@file.path_rel_links.html_seg_2).
+ gsub(Xx[:html_relative1],@file.path_rel_links.html_seg_1)
@output_seg_file << str
end
end
@@ -131,11 +149,19 @@ module SiSU_HTML_seg
attr_reader :seg_name_html,:seg_name_html_tracker
def initialize(md=nil,data='')
@md,@data=md,data
- @vz=SiSU_Env::Get_init.instance.skin
+ @vz=SiSU_Viz::Defaults.new
@seg_name_html=@@seg_name_html || nil
@seg_name_html_tracker=@@tracker || nil
+ @env=SiSU_Env::InfoEnv.new(@md.fns) if @md
+ if @md
+ @make=SiSU_Env::ProcessingSettings.new(@md)
+ @cl=(@make.build.html_minitoc?) \
+ ? 'content'
+ : 'content0'
+ else @cl='content'
+ end
if @md
- @title_banner_=SiSU_Env::Create_site.new(@md.cmd).html_seg_title_banner?
+ @title_banner_=SiSU_Env::CreateSite.new(@md.opt.cmd).html_seg_title_banner?
end
end
def songsheet
@@ -143,9 +169,12 @@ module SiSU_HTML_seg
@minitoc=SiSU_HTML::Source::Toc.new(@md,@data).minitoc
data=get_subtoc_endnotes(@data)
data=articles(data)
- Seg.new.cleanup # (((( added ))))
+ SiSU_HTML_Seg::Seg.new.cleanup # (((( added ))))
#### (((( END )))) ####
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
ensure
@@seg_name=[]
end
@@ -157,14 +186,15 @@ module SiSU_HTML_seg
printed_endnote_seg='n'
idx_html=nil
if @md.book_idx
- my_make_source_file=SiSU_Env::Create_file.new(@md.cmd,@md.fns)
- idx_html=SiSU_Particulars::Combined_singleton.instance.get_idx_html(@md.opt).html_idx
+ #my_make_source_file=SiSU_Env::CreateFile.new(@md.fns)
+ idx_html=SiSU_Particulars::CombinedSingleton.instance.get_idx_html(@md.opt).html_idx
idx_html.each {|x| @@seg[:idx] << x }
@@seg[:heading_idx]=''
end
data.each do |dob|
- if (dob.is=='heading' or dob.is=='heading_insert') \
- and dob.ln==4
+ if (dob.is == :heading \
+ || dob.is == :heading_insert) \
+ && dob.ln == 4
@@seg_name << dob.name
seg_name=dob.name
end
@@ -172,8 +202,8 @@ module SiSU_HTML_seg
@@seg_name_html=@@seg_name
@@seg_total=@@seg_name.length
testforartnum=@@seg_name_html
- SiSU_Screen::Ansi.new(@md.cmd,@@seg_name.length).segmented if @md.cmd =~/[MVv]/
- map_nametags=SiSU_Particulars::Combined_singleton.instance.get_map_nametags(@md).nametags_map #p map_nametags
+ SiSU_Screen::Ansi.new(@md.opt.cmd,@@seg_name.length).segmented if @md.opt.cmd =~/[MVv]/
+ map_nametags=SiSU_Particulars::CombinedSingleton.instance.get_map_nametags(@md).nametags_map #p map_nametags
data.each do |dob|
if defined? dob.obj \
and dob.obj =~/href="#{Xx[:segment]}#+\S+?"/
@@ -188,32 +218,37 @@ module SiSU_HTML_seg
end
end
end
- if (dob.is=='heading' or dob.is=='heading_insert') \
- and dob.ln==4
+ if (dob.is==:heading \
+ || dob.is==:heading_insert) \
+ && dob.ln==4
if dob.ocn==0
@@heading4=dob.obj
else @@heading4=dob.obj
end
@@is4=newfile=1
end
- if (dob.is=='heading' or dob.is=='heading_insert') \
- and dob.ln==3
+ if (dob.is==:heading \
+ || dob.is==:heading_insert) \
+ && dob.ln==3
@@heading3=dob.obj
@@is4,@@is3=0,1
end
- if (dob.is=='heading' or dob.is=='heading_insert') \
- and dob.ln==2
+ if (dob.is==:heading \
+ || dob.is==:heading_insert) \
+ && dob.ln==2
@@heading2=dob.obj
@@is4,@@is3,@@is2=0,0,1
end
- if (dob.is=='heading' or dob.is=='heading_insert') \
- and dob.ln==1
+ if (dob.is==:heading \
+ || dob.is==:heading_insert) \
+ && dob.ln==1
@@heading1=dob.obj
@@is4,@@is3,@@is2,@@is1=0,0,0,1
end
if (@@is1 && !@@is2 && !@@is3 && !@@is4)
- if not (dob.is=='heading' or dob.is=='heading_insert') \
- and dob.ln==1
+ if not (dob.is==:heading \
+ || dob.is==:heading_insert) \
+ && dob.ln==1
head1=$_ #; check
end
end
@@ -221,38 +256,47 @@ module SiSU_HTML_seg
if newfile==1 \
or dob.obj =~/^#{Mx[:br_endnotes]}|^#{Mx[:br_eof]}/
newfile=0
- if (dob.is=='heading' or dob.is=='heading_insert') \
- and dob.ln==4
+ if (dob.is==:heading \
+ || dob.is==:heading_insert) \
+ && dob.ln==4
if tracking != 0
- mkdir_p(@md.dir_out) unless FileTest.directory?(@md.dir_out) #bug - added specifically for nav! not needed by regular seg, check !!!
- Seg.new(@md).tail
- segfilename="#{@md.dir_out}/#{@md.fnl[:pre]}#{@@seg_name_html[tracking-1]}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}"
+ dirout=SiSU_Env::InfoEnv.new(@md.fns)
+ dir_sisu=dirout.path.output
+ @file=SiSU_Env::FileOp.new(@md)
+ unless FileTest.directory?(@file.output_path.html_seg.dir)
+ FileUtils::mkdir_p(@file.output_path.html_seg.dir) if File.writable?("#{@file.output_path.base.dir}/.")
+ end
+ SiSU_HTML_Seg::Seg.new(@md).tail
+ segfilename="#{@file.output_path.html_seg.dir}/#{@@seg_name_html[tracking-1]}#{@md.lang_code_insert}#{Sfx[:html]}"
output_seg_file=File.new(segfilename,'w') if @@seg_name_html[tracking-1]
- if dob.is=='heading' \
- or @@seg_name_html[tracking-1] !~/endnotes|book_index|metadata/
- Seg_output.new(@md,output_seg_file,@@seg,@minitoc).output
- elsif dob.is=='heading_insert'
+ minitoc=(@make.build.html_minitoc?) \
+ ? @minitoc
+ : ''
+ if dob.is==:heading \
+ || (@@seg_name_html[tracking-1] !~/endnotes|book_index|metadata/)
+ SiSU_HTML_Seg::Output.new(@md,output_seg_file,@@seg,minitoc).output
+ elsif dob.is==:heading_insert
if @@seg_name_html[tracking-1]=='endnotes'
- Seg_output.new(@md,output_seg_file,@@seg,@minitoc,'endnotes').output
+ SiSU_HTML_Seg::Output.new(@md,output_seg_file,@@seg,minitoc,'endnotes').output
elsif @@seg_name_html[tracking-1]=='book_index'
- Seg_output.new(@md,output_seg_file,@@seg,@minitoc,'idx').output
+ SiSU_HTML_Seg::Output.new(@md,output_seg_file,@@seg,minitoc,'idx').output
@@seg[:idx]=[]
elsif @@seg_name_html[tracking-1]=='metadata'
- Seg_output.new(@md,output_seg_file,@@seg,@minitoc,'metadata').output
+ SiSU_HTML_Seg::Output.new(@md,output_seg_file,@@seg,minitoc,'metadata').output
else puts "#{__FILE__}::#{__LINE__}"
end
else puts "#{__FILE__}::#{__LINE__}"
end
- Seg.new.reinitialise
+ SiSU_HTML_Seg::Seg.new.reinitialise
heading_art(dob)
head(dob)
#keep use for last segment, eg if metadata is last segment
- #if @@seg_name_html[tracking] =~/metadata/ # this is for metadata
- # segfilename="#{@md.dir_out}/#{@md.fnl[:pre]}#{@@seg_name_html[tracking]}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}"
- # output_seg_file=File.new(segfilename,'w')
- # Seg_output.new(@md,output_seg_file,@@seg,@minitoc,'metadata').output
- # Seg.new.reinitialise
- #end
+ if @@seg_name_html[tracking] =='metadata' # this is for metadata
+ segfilename="#{@file.output_path.html_seg.dir}/#{@@seg_name_html[tracking]}#{@md.lang_code_insert}#{Sfx[:html]}"
+ output_seg_file=File.new(segfilename,'w')
+ SiSU_HTML_Seg::Output.new(@md,output_seg_file,@@seg,minitoc,'metadata').output
+ Seg.new.reinitialise
+ end
end
if tracking==0
heading_art(dob)
@@ -261,11 +305,16 @@ module SiSU_HTML_seg
end
tracking=tracking+1
end
- @@get_hash_to=dob.name if (dob.is=='heading' or dob.is=='heading_insert') and dob.ln==4 and dob.name
- @@get_hash_fn=dob.name if (dob.is=='heading' or dob.is=='heading_insert') and dob.ln==4 and dob.name
- if dob.obj.class==String
+ if (dob.is==:heading \
+ || dob.is==:heading_insert) \
+ && dob.ln==4 \
+ && dob.name
+ @@get_hash_to=dob.name
+ @@get_hash_fn=dob.name
+ end
+ if dob.obj.is_a?(String)
markup(dob)
- elsif dob.obj.class==Array
+ elsif dob.obj.is_a?(Array)
dob.obj.each do |pg|
markup(pg)
end
@@ -280,24 +329,37 @@ module SiSU_HTML_seg
data
end
def heading_art(dob)
- format_head_seg=SiSU_HTML_Format::Head_seg.new(@md)
- if (dob.is=='heading' or dob.is=='heading_insert') \
- and dob.ln.to_s =~/^[1-6]/
- if @@tracker < @@seg_total-1; @@seg[:dot_nav]=format_head_seg.dot_control_pre_next
- else @@seg[:dot_nav]=format_head_seg.dot_control_pre
+ format_head_seg=SiSU_HTML_Format::HeadSeg.new(@md)
+ @@seg[:dot_nav]=if (@make.build.html_navigation?) \
+ && (@make.build.html_navigation_bar?)
+ x=if (dob.is==:heading \
+ || dob.is==:heading_insert) \
+ && (dob.ln.to_s =~/^[1-6]/)
+ x=if @@tracker < @@seg_total-1
+ format_head_seg.dot_control_pre_next
+ else
+ format_head_seg.dot_control_pre
+ end
+ else @@seg[:dot_nav]
end
+ else @@seg[:dot_nav]=''
end
- ads=SiSU_HTML_promo::Ad.new(@md)
- @@seg[:title]=format_head_seg.head << ads.div.major
+ ads=SiSU_HTML_Promo::Ad.new(@md)
+ @@seg[:title]=format_head_seg.head_seg << ads.div.major
end
def head(dob)
clean=/<!.*?!>|<:.*?>/
- format_head_seg=SiSU_HTML_Format::Head_seg.new(@md)
- if @@tracker < @@seg_total-1
- if @@tracker==0; @@segtocband=format_head_seg.toc_next2 #if format_head_seg.toc_next2
- else @@segtocband=format_head_seg.toc_pre_next2 #if format_head_seg.toc_pre_next2
+ format_head_seg=SiSU_HTML_Format::HeadSeg.new(@md)
+ if @make.build.html_navigation?
+ if @@tracker < @@seg_total-1
+ @@segtocband=if @@tracker==0
+ format_head_seg.toc_next2 #if format_head_seg.toc_next2
+ else
+ format_head_seg.toc_pre_next2 #if format_head_seg.toc_pre_next2
+ end
+ else @@segtocband=format_head_seg.toc_pre2 #if format_head_seg.toc_pre2
end
- else @@segtocband=format_head_seg.toc_pre2 #if format_head_seg.toc_pre2
+ else @@segtocband=''
end
@p_num ||= ''
if @@is1==1
@@ -308,64 +370,67 @@ module SiSU_HTML_seg
else ''
end
@@seg[:tocband_bannerless] << '<br />' << conditional_div_close << format_head_seg.navigation_band_bottom(@@segtocband,@@seg[:dot_nav])
- @@seg[:headings] << format_head_seg.seg_head_escript if SiSU_HTML_Format::Head_seg.method_defined? :seg_head_escript #debug PHP move up in text #bug
if @title_banner_
@@seg[:headings] << format_head_seg.title_banner(@md.title.main,@md.title.sub,@author).gsub(clean,'')
end
- ocn=if @@heading1[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]; $1 #fix
- else ''
- end
- @p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn)
- txt_obj={:txt =>@@heading1,:ocn_display =>@p_num.ocn_display}
- format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj)
+ ocn=(@@heading1[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \
+ ? $1
+ : ''
+ @p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn)
+ txt_obj={ txt: @@heading1, ocn_display: @p_num.ocn_display }
+ format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj)
@@seg[:headings] << format_seg.title_heading1.gsub(clean,'')
- @@heading1.gsub!(/&nbsp;<a name="-[\d*+]+" href="#_[\d*+]+">&nbsp;<sup>[\d*+]+<\/sup>&nbsp;<\/a>/,'')
+ @@heading1=@@heading1.gsub(/&nbsp;<a name="-[\d*+]+" href="#_[\d*+]+">&nbsp;<sup>[\d*+]+<\/sup>&nbsp;<\/a>/,'')
end
if @@is2==1
heading2=@@heading2
- ocn=if heading2[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]; $1 #fix
- else ''
- end
- @p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn)
- txt_obj={:txt =>heading2,:ocn_display =>@p_num.ocn_display}
- format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj)
+ ocn=(heading2[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \
+ ? $1
+ : ''
+ @p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn)
+ txt_obj={ txt: heading2, ocn_display: @p_num.ocn_display }
+ format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj)
@@seg[:headings] << format_seg.title_heading2.gsub(clean,'')
- @@heading2.gsub!(/&nbsp;<a name="-[\d*+]+" href="#_[\d*+]+">&nbsp;<sup>[\d*+]+<\/sup>&nbsp;<\/a>/,'')
+ @@heading2=@@heading2.gsub(/&nbsp;<a name="-[\d*+]+" href="#_[\d*+]+">&nbsp;<sup>[\d*+]+<\/sup>&nbsp;<\/a>/,'')
end
if @@is3==1
heading3=@@heading3
- ocn=if heading3[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]; $1 #fix
- else ''
- end
- @p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn)
- txt_obj={:txt =>heading3,:ocn_display =>@p_num.ocn_display}
- format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj)
+ ocn=(heading3[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \
+ ? $1
+ : ''
+ @p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn)
+ txt_obj={ txt: heading3, ocn_display: @p_num.ocn_display }
+ format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj)
@@seg[:headings] << format_seg.title_heading3.gsub(clean,'')
- @@heading3.gsub!(/&nbsp;<a name="-[\d*+]+" href="#_[\d*+]+">&nbsp;<sup>[\d*+]+<\/sup>&nbsp;<\/a>/,'')
+ @@heading3=@@heading3.gsub(/&nbsp;<a name="-[\d*+]+" href="#_[\d*+]+">&nbsp;<sup>[\d*+]+<\/sup>&nbsp;<\/a>/,'')
end
if @@is4==1
heading4=@@heading4
- ocn=if heading4[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]; $1 #fix
- else ''
- end
- @p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn)
- txt_obj={:txt =>heading4,:ocn_display =>@p_num.ocn_display}
- format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj)
+ ocn=(heading4[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \
+ ? $1
+ : ''
+ @p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn)
+ txt_obj={ txt: heading4, ocn_display: @p_num.ocn_display }
+ format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj)
@@seg[:headings] << format_seg.title_heading4.gsub(clean,'')
end
@@tracker=@@tracker+1
end
def markup(dob)
@debug=[]
- format_head_seg=SiSU_HTML_Format::Head_seg.new(@md)
- if dob.is !~/meta/
- if dob.is =~/(?:heading|para)/ #extend as necessary FIX
- @p_num=SiSU_HTML_Format::Paragraph_number.new(@md,dob.ocn)
+ format_head_seg=SiSU_HTML_Format::HeadSeg.new(@md)
+ if dob.is !=:meta
+ if dob.is==:heading \
+ || dob.is==:heading_insert \
+ || dob.is == :para
+ @p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,dob.ocn)
end
- sto=SiSU_HTML_Format::Format_text_object.new(@md,dob)
- dob_html=if dob.is =~/heading|para/
- dob_html=if (dob.is=='heading' \
- or dob.is=='heading_insert')
+ sto=SiSU_HTML_Format::FormatTextObject.new(@md,dob)
+ dob_html=if dob.is == :heading \
+ || dob.is==:heading_insert \
+ || dob.is==:para
+ dob_html=if dob.is==:heading \
+ || dob.is==:heading_insert
x=if dob.ln==4
sto.seg_heading4
elsif dob.ln==5
@@ -373,60 +438,74 @@ module SiSU_HTML_seg
elsif dob.ln==6
sto.seg_heading6
end
- elsif dob.is=='para'
+ elsif dob.is==:para
if dob.indent \
- and dob.indent =~/[1-9]/
- if dob.bullet_
- sto.format('li',"i#{dob.indent}")
- else sto.format('p',"i#{dob.indent}")
- end
- else
+ and dob.hang \
+ and dob.indent =~/[0-9]/ \
+ and dob.hang =~/[0-9]/
if dob.bullet_
- sto.format('li','bullet')
+ if dob.indent =~/[1-9]/
+ sto.format('li',"i#{dob.indent}")
+ else
+ sto.format('li','bullet')
+ end
+ elsif dob.indent == dob.hang
+ sto.format('p',"i#{dob.indent}")
+ elsif dob.indent != dob.hang
+ sto.format('p',"h#{dob.hang}i#{dob.indent}")
else sto.para
end
+ else sto.para
end
end
- elsif dob.is=='group'
+ elsif dob.is==:block
+ sto.block
+ elsif dob.is==:group
sto.group
- elsif dob.is=='alt'
+ elsif dob.is==:alt
sto.alt
- elsif dob.is=='verse'
+ elsif dob.is==:verse
sto.verse
- elsif dob.is=='code'
+ elsif dob.is==:code
sto.code
- elsif dob.is=='table'
+ elsif dob.is==:table
sto.table
- elsif dob.is=='break'
- sto.break
+ elsif dob.is==:break
end
if @md.flag_separate_endnotes
- dob.obj.gsub!(/"\s+href="#_(\d+)">/,%{" href=\"endnotes#{Sfx[:html]}#_\\1">}) #endnote- twice #removed file type
+ dob.obj=dob.obj.gsub(/"\s+href="#_(\d+)">/,%{" href=\"endnotes#{Sfx[:html]}#_\\1">}) #endnote- twice #removed file type
end
if dob.obj !~/#{@vz.margin_txt_w1}|#{@vz.margin_txt_w2}/
- if dob.is =~/heading|para/ and (not dob.ocn or dob.ocn.to_s.empty?)
- format_seg=SiSU_HTML_Format::Format_seg.new(@md,dob)
+ if (dob.is==:heading \
+ || dob.is==:heading_insert \
+ || dob.is==:para) \
+ && (not dob.ocn \
+ || (dob.ocn.to_s.empty?))
+ format_seg=SiSU_HTML_Format::FormatSeg.new(@md,dob)
end
- dob.obj.gsub!(/\s*(-\{{2}~\d+|<:e[:_]\d+>).*/,'') #potentially dagerous - removes all paragraphs with <!e_!> #?? workpoint
+ dob.obj=dob.obj.gsub(/\s*(-\{{2}~\d+|<:e[:_]\d+>).*/,'') #potentially dagerous - removes all paragraphs with <!e_!> #?? workpoint
if dob.obj =~/<a name="_\d+" href="#-\d+">&nbsp;<sup>/ #endnote- note-
- format_seg=SiSU_HTML_Format::Format_seg.new(@md,dob)
+ format_seg=SiSU_HTML_Format::FormatSeg.new(@md,dob)
dob=format_seg.no_paranum
end
end
- if (dob.is=='heading' or dob.is=='heading_insert') \
- and dob.ln==4
- @@seg[:main] << %{\n<div class="content">\n}
+ if (dob.is==:heading \
+ || dob.is==:heading_insert) \
+ && dob.ln==4
+ @@seg[:main] << %{\n<div class="#{@cl}">\n}
@@seg[:main] << dob_html
- @@seg[:main] << @@seg_subtoc[@@get_hash_fn] #% insertion of sub-toc
+ if @make.build.segsubtoc?
+ @@seg[:main] << @@seg_subtoc[@@get_hash_fn] #% insertion of sub-toc
+ end
else
@@seg[:main] << dob_html #unless @@flag_alt==true
end
end
end
def tail
- format_head_seg=SiSU_HTML_Format::Head_seg.new(@md)
+ format_head_seg=SiSU_HTML_Format::HeadSeg.new(@md)
if @md.flag_auto_endnotes and @@seg_endnotes[@@get_hash_fn]
- @@seg[:tail] << %{\n<div class="content">\n<div class="endnote">\n}
+ @@seg[:tail] << %{\n<div class="#{@cl}">\n<div class="endnote">\n}
if @@seg_endnotes[@@get_hash_fn].flatten.length > 0
@@seg[:tail] << format_head_seg.endnote_mark
@@seg[:tail] << @@seg_endnotes[@@get_hash_fn].flatten #endnotes deposited at end of individual segments ||@|EXTRACTION OF ENDNOTES|
@@ -434,7 +513,7 @@ module SiSU_HTML_seg
@@seg[:tail] << '</div>'
@@seg[:tail] << '</div>' #this div closes div class content
end
- ads=SiSU_HTML_promo::Ad.new(@md)
+ ads=SiSU_HTML_Promo::Ad.new(@md)
@@seg[:credits] << format_head_seg.credit << ads.div.close << ads.display << format_head_seg.html_close
end
def reinitialise
@@ -450,18 +529,20 @@ module SiSU_HTML_seg
end
def get_subtoc_endnotes(data) #get endnotes & sub-table of contents subtoc
data.each do |dob|
- dob.obj.gsub!(/<a name=\"h\d.*?\">(.+?)<\/a>/mi,'\1')
+ dob.obj=dob.obj.gsub(/<a name=\"h\d.*?\">(.+?)<\/a>/mi,'\1')
if @md.flag_auto_endnotes
- if (dob.is=='heading' or dob.is=='heading_insert') \
- and dob.ln.to_s =~/^[1234]/ \
+ if (dob.is==:heading \
+ || dob.is==:heading_insert) \
+ && (dob.ln.to_s =~/^[1234]/) \
and not @@fn.to_s.empty?
@@seg_endnotes[@@fn]=[]
@@seg_endnotes[@@fn] << @@seg_endnotes_array
@@seg_endnotes_array=[] if dob.ln==4
@@fns_previous=@md.fns if dob.ln==4 and dob.name =~/^meta/
end
- if (dob.is=='heading' or dob.is=='heading_insert') \
- and dob.ln==4 #% EXTRACTION OF SUB-TOCs & SEGMENT NAME, after EXTRACTION OF ENDNOTES & SUB-TOCs
+ if (dob.is==:heading \
+ || dob.is==:heading_insert) \
+ && dob.ln==4 #% EXTRACTION OF SUB-TOCs & SEGMENT NAME, after EXTRACTION OF ENDNOTES & SUB-TOCs
@@seg_subtoc[@@fn]=@@seg_subtoc_array
@@seg_subtoc_array=[]
if dob.name \
@@ -475,23 +556,23 @@ module SiSU_HTML_seg
end
end
end
- if dob.is=='heading' \
- and dob.ln.to_s =~/^[56]/
+ if dob.is==:heading \
+ && (dob.ln.to_s =~/^[56]/)
case dob.ln
when 5
- txt_obj={:txt =>dob.obj.strip,:ocn =>dob.ocn}
- format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj)
+ txt_obj={ txt: dob.obj.strip, ocn: dob.ocn }
+ format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj)
subtoc=format_seg.subtoc_lev5 #keep and make available, this is the subtoc
when 6
- txt_obj={:txt =>dob.obj.strip,:ocn =>dob.ocn}
- format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj)
+ txt_obj={ txt: dob.obj.strip, ocn: dob.ocn }
+ format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj)
subtoc=format_seg.subtoc_lev6 #keep and make available, this is the subtoc
end
@@seg_subtoc_array << subtoc
end
if @md.flag_auto_endnotes
- if dob.obj =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[\d*+]+ <a name="_[\d*+]+"/ \
- and dob.is !~/^code/ # endnote-
+ if (dob.obj =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[\d*+]+ <a name="_[\d*+]+"/) \
+ && dob.is !=:code # endnote-
endnote_array=[]
if dob.obj=~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/m
endnote_array << dob.obj.scan(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/m)
@@ -502,15 +583,15 @@ module SiSU_HTML_seg
if dob.obj=~/#{Mx[:en_b_o]}[+]\d+\s.+?#{Mx[:en_b_c]}/m
endnote_array << dob.obj.scan(/#{Mx[:en_b_o]}[+]\d+\s.+?#{Mx[:en_b_c]}/m)
end
- endnote_array.flatten!.compact! #check compacting
+ endnote_array=endnote_array.flatten.compact #watch, check compacting
endnote_array.each do |note|
note_match=note.dup
note_match_seg=note.dup
e_n=note_match_seg[/(?:#{Mx[:en_a_o]}[\d*+]+|#{Mx[:en_b_o]}[*+]\d+)\s+(.+?)(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m,1]
try=e_n.split(/<br \/>/)
try.each do |e|
- txt_obj={:txt =>e}
- format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj)
+ txt_obj={ txt: e }
+ format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj)
note_match=if e =~/#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]}/
format_seg.endnote_body_indent
else format_seg.endnote_body
@@ -522,12 +603,12 @@ module SiSU_HTML_seg
m=/(?:#{Mx[:en_a_o]}[\d*+]+|#{Mx[:en_b_o]}[*+]\d+)\s+(.+?href=")(#-[\d*+]+".+)(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/mi
endnote_part_a=note_match_seg[m,1]
endnote_part_b=note_match_seg[m,2]
- txt_obj={:endnote_part_a =>endnote_part_a,:endnote_part_b =>endnote_part_b}
- format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj)
+ txt_obj={ endnote_part_a: endnote_part_a, endnote_part_b: endnote_part_b }
+ format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj)
note_match_all_seg=format_seg.endnote_seg_body(@@fn) #BUG WATCH 200408
@@seg[:endnote_all] << note_match_all_seg
end
- dob.obj.gsub!(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ')
+ dob.obj=dob.obj.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ')
end
end
end
diff --git a/lib/sisu/v2/html_table.rb b/lib/sisu/v4/html_table.rb
index 4eab0219..f94199ce 100644
--- a/lib/sisu/v2/html_table.rb
+++ b/lib/sisu/v4/html_table.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -56,10 +55,10 @@
** Description: shared html parts
=end
-module SiSU_HTML_table
- require "#{SiSU_lib}/defaults" # defaults.rb
- require "#{SiSU_lib}/xhtml_table.rb" # xhtml_table.rb
- class Table_html <SiSU_XHTML_table::Table_xhtml
+module SiSU_HTML_Table
+ require_relative 'defaults' # defaults.rb
+ require_relative 'xhtml_table.rb' # xhtml_table.rb
+ class TableHTML <SiSU_XHTML_Table::TableXHTML
end
end
__END__
diff --git a/lib/sisu/v4/html_tune.rb b/lib/sisu/v4/html_tune.rb
new file mode 100644
index 00000000..9ad44443
--- /dev/null
+++ b/lib/sisu/v4/html_tune.rb
@@ -0,0 +1,375 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: html generation, html pre-processing
+
+=end
+require_relative 'param'
+module SiSU_HTML_Tune
+ require_relative 'sysenv' # sysenv.rb
+ include SiSU_Env; include SiSU_Screen
+ require_relative 'html_format' # html_format.rb #watch
+ @@line_mode=''
+ @@endnote_array=[]
+ @@endnote_call_counter=1
+ @@table_align='<table summary='' width="96%" border="0" bgcolor="white" cellpadding="0" col="3">
+<tr ...><td width="2%" align="right">
+&nbsp\;</td>
+<td width="94%" valign="top" align="justify">'
+ @@table_align_close='</td>
+<td width="4%" align="right" valign="top">
+<font size="1" color="#777777">
+&nbsp;&nbsp;&nbsp;</font> </td></tr></table>'
+ @@counter,@@column,@columns=0,0,0
+ class Output
+ def initialize(data,md)
+ @data,@md=data,md
+ @file=SiSU_Env::InfoFile.new(@md.fns)
+ @cX=SiSU_Screen::Ansi.new(@md.opt.cmd).cX
+ end
+ def hard_output
+ @filename_tune=@file.write_file_processing.html_tune
+ data=[]
+ @data.each do |x|
+ unless x.obj.empty?
+ x.obj=x.obj.strip
+ data << x
+ end
+ end
+ data.each do |dob|
+ @filename_tune.puts dob, "\n"
+ end
+ end
+ def marshal
+ File.open(@file.marshal.html_tune,'w') {|f| Marshal.dump(@data.to_a,f)}
+ end
+ end
+ class CleanHTML
+ def initialize(html='')
+ @html=html
+ end
+ def clean
+ html=@html
+ str=if html.is_a?(String)
+ html
+ else html.obj
+ end
+ str=str.gsub(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;').
+ gsub(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;').
+ gsub(/¢/u,'&cent;'). # &#162;
+ gsub(/£/u,'&pound;'). # &#163;
+ gsub(/¥/u,'&yen;'). # &#165;
+ gsub(/§/u,'&sect;'). # &#167;
+ gsub(/©/u,'&copy;'). # &#169;
+ gsub(/ª/u,'&ordf;'). # &#170;
+ gsub(/«/u,'&laquo;'). # &#171;
+ gsub(/®/u,'&reg;'). # &#174;
+ gsub(/°/u,'&deg;'). # &#176;
+ gsub(/±/u,'&plusmn;'). # &#177;
+ gsub(/²/u,'&sup2;'). # &#178;
+ gsub(/³/u,'&sup3;'). # &#179;
+ gsub(/µ/u,'&micro;'). # &#181;
+ gsub(/¶/u,'&para;'). # &#182;
+ gsub(/¹/u,'&sup1;'). # &#185;
+ gsub(/º/u,'&ordm;'). # &#186;
+ gsub(/»/u,'&raquo;'). # &#187;
+ gsub(/¼/u,'&frac14;'). # &#188;
+ gsub(/½/u,'&frac12;'). # &#189;
+ gsub(/¾/u,'&frac34;'). # &#190;
+ gsub(/×/u,'&times;'). # &#215;
+ gsub(/÷/u,'&divide;'). # &#247;
+ gsub(/¿/u,'&iquest;'). # &#191;
+ gsub(/À/u,'&Agrave;'). # &#192;
+ gsub(/Á/u,'&Aacute;'). # &#193;
+ gsub(/Â/u,'&Acirc;'). # &#194;
+ gsub(/Ã/u,'&Atilde;'). # &#195;
+ gsub(/Ä/u,'&Auml;'). # &#196;
+ gsub(/Å/u,'&Aring;'). # &#197;
+ gsub(/Æ/u,'&AElig;'). # &#198;
+ gsub(/Ç/u,'&Ccedil;'). # &#199;
+ gsub(/È/u,'&Egrave;'). # &#200;
+ gsub(/É/u,'&Eacute;'). # &#201;
+ gsub(/Ê/u,'&Ecirc;'). # &#202;
+ gsub(/Ë/u,'&Euml;'). # &#203;
+ gsub(/Ì/u,'&Igrave;'). # &#204;
+ gsub(/Í/u,'&Iacute;'). # &#205;
+ gsub(/Î/u,'&Icirc;'). # &#206;
+ gsub(/Ï/u,'&Iuml;'). # &#207;
+ gsub(/Ð/u,'&ETH;'). # &#208;
+ gsub(/Ñ/u,'&Ntilde;'). # &#209;
+ gsub(/Ò/u,'&Ograve;'). # &#210;
+ gsub(/Ó/u,'&Oacute;'). # &#211;
+ gsub(/Ô/u,'&Ocirc;'). # &#212;
+ gsub(/Õ/u,'&Otilde;'). # &#213;
+ gsub(/Ö/u,'&Ouml;'). # &#214;
+ gsub(/Ø/u,'&Oslash;'). # &#216;
+ gsub(/Ù/u,'&Ugrave;'). # &#217;
+ gsub(/Ú/u,'&Uacute;'). # &#218;
+ gsub(/Û/u,'&Ucirc;'). # &#219;
+ gsub(/Ü/u,'&Uuml;'). # &#220;
+ gsub(/Ý/u,'&Yacute;'). # &#221;
+ gsub(/Þ/u,'&THORN;'). # &#222;
+ gsub(/ß/u,'&szlig;'). # &#223;
+ gsub(/à/u,'&agrave;'). # &#224;
+ gsub(/á/u,'&aacute;'). # &#225;
+ gsub(/â/u,'&acirc;'). # &#226;
+ gsub(/ã/u,'&atilde;'). # &#227;
+ gsub(/ä/u,'&auml;'). # &#228;
+ gsub(/å/u,'&aring;'). # &#229;
+ gsub(/æ/u,'&aelig;'). # &#230;
+ gsub(/ç/u,'&ccedil;'). # &#231;
+ gsub(/è/u,'&egrave;'). # &#232;
+ gsub(/é/u,'&eacute;'). # &#233;
+ gsub(/ê/u,'&ecirc;'). # &#234;
+ gsub(/ë/u,'&euml;'). # &#235;
+ gsub(/ì/u,'&igrave;'). # &#236;
+ gsub(/í/u,'&iacute;'). # &#237;
+ gsub(/î/u,'&icirc;'). # &#238;
+ gsub(/ï/u,'&iuml;'). # &#239;
+ gsub(/ð/u,'&eth;'). # &#240;
+ gsub(/ñ/u,'&ntilde;'). # &#241;
+ gsub(/ò/u,'&ograve;'). # &#242;
+ gsub(/ó/u,'&oacute;'). # &#243;
+ gsub(/ô/u,'&ocirc;'). # &#244;
+ gsub(/õ/u,'&otilde;'). # &#245;
+ gsub(/ö/u,'&ouml;'). # &#246;
+ gsub(/ø/u,'&oslash;'). # &#248;
+ gsub(/ù/u,'&ugrave;'). # &#250;
+ gsub(/ú/u,'&uacute;'). # &#251;
+ gsub(/û/u,'&ucirc;'). # &#252;
+ gsub(/ü/u,'&uuml;'). # &#253;
+ gsub(/þ/u,'&thorn;'). # &#254;
+ gsub(/ÿ/u,'&yuml;'). # &#255;
+ gsub(/ý/u,'&yacute;')
+ end
+ end
+ class Tune
+ def initialize(data,md)
+ @data,@md=data,md
+ @vz=SiSU_Viz::Defaults.new
+ @env=SiSU_Env::InfoEnv.new(@md.fns)
+ @sys=SiSU_Env::SystemCall.new
+ @env=SiSU_Env::InfoEnv.new(@md.fns)
+ @brace_url=SiSU_Viz::Defaults.new.url_decoration
+ end
+ def songsheet
+ begin
+ @cX=SiSU_Screen::Ansi.new(@md.opt.cmd).cX
+ SiSU_Screen::Ansi.new(@md.opt.cmd,'Tune').txt_grey if @md.opt.cmd =~/[MVv]/
+ songsheet_array(@data)
+ #data=songsheet_array(@data)
+ if @md.opt.cmd =~/M/ #Hard Output Tune Optional on/off here
+ data=SiSU_HTML_Tune::Output.new(@data,@md).hard_output
+ SiSU_HTML_Tune::Output.new(@data,@md).marshal
+ end
+ tuned=SiSU_HTML_Tune::Tune.new(@data,@md).output
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ end
+ end
+ def songsheet_array(data)
+ data_tuned=[]
+ #@tuned_file=[]
+ data.each do |dob|
+ dob=angle_brackets(dob)
+ dob=endnotes_html(dob)
+ dob=url_markup(dob)
+ dob=markup(dob)
+ data_tuned << dob
+ end
+ data_tuned
+ end
+ def urls(data)
+ @words=[]
+ data.each do |word|
+ @words << if word=~/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/
+ http_=true
+ if word =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/
+ m,u=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/.match(word).captures
+ elsif word =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}:\S+?#{Mx[:rel_c]}/
+ #http_=false
+ m,u=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}:(\S+?)#{Mx[:rel_c]}/.match(word).captures
+ u="#{Xx[:html_relative2]}/" + u
+ elsif word =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/
+ http_=false
+ m,u=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}(\S+?)#{Mx[:rel_c]}/.match(word).captures
+ elsif word =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}image/
+ m,u=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}(image)/.match(word).captures
+ end
+ case m
+ when /\.png|\.jpg|\.gif|c=|\s\d+x\d+/
+ w,h=/\s(\d+)x(\d+)/.match(m).captures if m =~/\s\d+x\d+/
+ w=%{width="#{w}"} if w
+ h=%{height="#{h}"} if h
+ c=m[/"(.+?)"/m,1]
+ caption=%{<br /><p class="caption">#{c}</p>} if c
+ png=m.scan(/\S+/)[0]
+ image_path=@md.file.output_path.html_seg.rel_image
+ #image_path=(@md.fns =~/\.-ss[tm]$/) \
+ #? @env.url.images_external
+ #: @env.url.images_local
+ ins=if u \
+ and u.strip !~/^image$/
+ %{<a href="#{u}"><img src="#{image_path}/#{png}" #{w} #{h} naturalsizeflag="0" align="bottom" border="0"></a>#{caption}}
+ else %{<img src="#{image_path}/#{png}" #{w} #{h} naturalsizeflag="0" align="bottom" border="0">#{caption}}
+ end
+ word=word.gsub(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/,ins)
+ else
+ link=m[/(.+)/m]
+ png=m.scan(/\S+/)[0].strip
+ link=link.strip
+ u=u.gsub(/(\S+)/,"#{Xx[:segment]}#\\1") if u !~/\// unless http_ #marker: in scroll remove; in seg replace
+ ins=%{<a href="#{u}">#{link}</a>}
+ word=word.gsub(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,ins).
+ gsub(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/,ins)
+ end
+ word
+ else word
+ end
+ word
+ end
+ @words=@words.join(' ')
+ end
+ def url_markup(dob)
+ unless dob.is==:code
+ if dob.obj =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/
+ @word_mode=dob.obj.scan(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)[()\[\]]*[,.;:!?'"]{0,2}|(?:#{Mx[:gl_o]}\S+?#{Mx[:gl_c]})+|[^#{Mx[:lnk_o]}#{Mx[:lnk_c]}]+/mu)
+ words=urls(@word_mode)
+ dob.obj=dob.obj.gsub(/.+/m,words)
+ end #consider change, do a while loop
+ dob.obj=dob.obj.gsub(/\\copyright/i,%{<sup>&copy;</sup>})
+ if (dob.obj !~/\<:ad\s+\.\.\//)
+ dob.obj=dob.obj.gsub(/\<:ad\s+(\S+)?\s+(\S+\.png)\s+(.+)?\;\s+(.+)?\;\s*!\>/,
+ %{\n<center><a href="http:\/\/\\1" target="external"><img src="#{@env.url.images_local}/\\2" alt="\\3"></a></center>\n})
+ else
+ dob.obj=dob.obj.gsub(/\<:ad\s+(\S+)?\s+(\S+\.png)\s+(.+)?\;\s+(.+)?\;\s*\>/,
+ %{\n<center><a href="\\1" target="_top"><img src="#{@env.url.images_local}/\\2" alt="\\3"></a></center>\n})
+ end
+ dob.obj=dob.obj.gsub(/!pick/,%{<img border="0" height="15" width="15" src="#{@env.url.images}/#{@vz.icon_choice}" alt="stellar">}).
+ gsub(/!new/,%{&nbsp;<img border="0" height="15" width="15" src="#{@env.url.images}/#{@vz.icon_new}" alt="new">}).
+ gsub(/<:h(.{1,7}?)>/,'<a href="#h\1">\1</a>').
+ gsub(/<:to(\d{1,7}?)>/,'<a href="#to\1">to&nbsp;{&nbsp;\1&nbsp;}</a> ').
+ gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'<a href="\1" target="_top">\1</a>'). #http ftp matches escaped, no decoration
+ gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}<a href="mailto:\\1">\\1</a>#{@brace_url.xml_close}}).
+ gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}<a href="\\1" target="_top">\\1</a>#{@brace_url.xml_close}}) #http ftp matches with decoration
+ if dob.obj =~/#{Xx[:html_relative2]}\/\S+/ \
+ and dob.obj !~/(\"#{Xx[:html_relative2]}\/\S+?\"|>\s*#{Xx[:html_relative2]}\/\S+<)/
+ dob.obj=dob.obj.gsub(/(#{Xx[:html_relative2]}\/\S+)/,'<a href="\1">\1</a>')
+ end
+ if dob.obj =~/..\/\S+/ \
+ and dob.obj !~/(\"..\/\S+?\"|>\s*..\/\S+<)/
+ dob.obj=dob.obj.gsub(/\.\.(\/\S+)/,%{<a href="#{Xx[:html_relative2]}\1">\1</a>})
+ end
+ dob.obj=dob.obj.gsub(/<a href=":/,%{<a href="#{@vz.url_site}/}).
+ gsub(/<a href="\.\.\//,%{<a href="#{@vz.url_site}/}).
+ gsub(/<a href="#{Xx[:html_relative2]}\//,%{<a href="#{@vz.url_site}/})
+ else
+ dob.obj=dob.obj.gsub(/</m,'&lt;').gsub(/>/m,'&gt;')
+ end
+ dob
+ end
+ def angle_brackets(dob)
+ dob.obj=dob.obj.gsub(/<([a-z:\/]+)>/,"#{Dx[:lt_xml]}\\1#{Dx[:gt_xml]}")
+ dob
+ end
+ def endnotes_html(dob)
+ unless dob.is ==:code
+ dob.obj=dob.obj.gsub(/(#{Mx[:en_a_o]}|#{Mx[:en_b_o]})(\d+)\s+(.+?)(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/,
+ '&nbsp;<a name="-\2" href="#_\2">&nbsp;<sup>\2</sup>&nbsp;</a> ' + #note- endnote-
+ '\1\2 <a name="_\2" href="#-\2">&nbsp;<sup>\2.</sup></a> \3 \4'). #endnote- note- (careful may have switched)
+ gsub(/(#{Mx[:en_b_o]})([*+]\d+)\s+(.+?)(#{Mx[:en_b_c]})/,
+ '&nbsp;<a name="-\2" href="#_\2">&nbsp;<sup>\2</sup>&nbsp;</a> ' + #note- endnote-
+ '\1\2 <a name="_\2" href="#-\2">&nbsp;<sup>\2.</sup></a> \3 \4'). #endnote- note- (careful may have switched)
+ gsub(/(#{Mx[:en_a_o]})([*+]+)\s+(.+?)(#{Mx[:en_a_c]})/,
+ '&nbsp;<a name="-\2" href="#_\2">&nbsp;<sup>\2</sup>&nbsp;</a> ' + #note- endnote-
+ '\1\2 <a name="_\2" href="#-\2">&nbsp;<sup>\2</sup></a> \3 \4') #endnote- note- (careful may have switched)
+ end
+ dob
+ end
+ def markup(dob)
+ dob.obj=dob.obj.gsub(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;').
+ gsub(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;')
+ dob.obj=dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />') unless dob.is==:table
+ dob.obj=dob.obj.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>').
+ gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>').
+ gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>').
+ gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>').
+ gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>').
+ gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'<ins>\1</ins>').
+ gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>').
+ gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>').
+ gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>'). # tt, kbd
+ gsub(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'<a name="\1"></a>').
+ gsub(/#{Mx[:gl_bullet]}/m,'●&nbsp;&nbsp;').
+ gsub(/#{Mx[:nbsp]}/,'&nbsp;').
+ gsub(/<(p|br)>/,'<\1 />')
+ dob=SiSU_HTML_Tune::CleanHTML.new(dob).clean
+ dob
+ end
+ def output
+ data=@data
+ @tuned_file=[]
+ data.each do |dob|
+ dob.obj=dob.obj.strip.chomp
+ @tuned_file << dob
+ end
+ @tuned_file << "\n<EOF>" if (@md.fns =~/\.sst0/) #remove
+ @tuned_file
+ end
+ end
+end
+__END__
diff --git a/lib/sisu/v4/hub.rb b/lib/sisu/v4/hub.rb
new file mode 100644
index 00000000..02762d4a
--- /dev/null
+++ b/lib/sisu/v4/hub.rb
@@ -0,0 +1,712 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: SiSU information Structuring Universe, text structuring,
+ processing, publishing, search
+
+=end
+module SiSU
+ require_relative 'constants' # constants.rb
+ require_relative 'sysenv' # sysenv.rb
+ include SiSU_Env
+ include SiSU_Screen
+ require_relative 'options' # options.rb
+ require_relative 'param' # param.rb
+ include SiSU_Param
+ require_relative 'defaults' # defaults.rb
+ include SiSU_Viz
+ require_relative 'help' # help.rb
+ include SiSU_Help
+ require 'uri'
+ class HubMaster
+ def initialize(argv)
+ pwd_the=Dir.pwd
+ begin #% select what to do
+ home=ENV['HOME']
+ opt=SiSU_Commandline::Options.new(argv)
+ SiSU::Processing.new(opt).actions
+ rescue
+ cmd=(opt ? opt.cmd : '')
+ SiSU_Screen::Ansi.new(cmd,$!,$@).rescue do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ Dir.chdir(pwd_the)
+ end
+ end
+ end
+ class OptionLoopFiles
+ def initialize(opt)
+ @opt=opt
+ @r=Px[:lng_lst_rgx]
+ end
+ def loop_files_on_given_option
+ @opt.files.each_with_index do |fno,i|
+ @opt.fno,@opt.fns=fno,fno
+ @opt.f_pth=@opt.f_pths[i]
+ if fno !~/\.-sst$/
+ @opt.pth=@opt.paths[i]
+ @opt.lng=@opt.lngs[i]
+ end
+ @@pwd=@opt.pth
+ @opt.pth=@opt.f_pths[i][:pth]
+ @opt.lng=@opt.f_pths[i][:lng]
+ Dir.chdir(@opt.f_pth[:pth]) #watch
+ @env=SiSU_Env::InfoEnv.new(fno)
+ yield
+ end
+ end
+ def loop_files_on_given_option_bundle
+ @files_bundle={}
+ @opt.files.each_with_index do |fno,i|
+ fn_base_bundle=fno.gsub(/(?:~(?:#{@r}))?\.ss[tm]$/,'')
+ unless @files_bundle[fn_base_bundle]
+ @files_bundle[fn_base_bundle]={ status: :todo }
+ end
+ end
+ @opt.files.each_with_index do |fno,i|
+ fn_base_bundle=fno.gsub(/(?:~(?:#{@r}))?\.ss[tm]$/,'')
+ unless @files_bundle[fn_base_bundle][:status] == :done
+ @files_bundle[fn_base_bundle][:status] = :done
+ @opt.fns=fno
+ @opt.fno=fno
+ @opt.f_pth=@opt.f_pths[i]
+ if fno !~/\.-sst$/
+ @opt.pth=@opt.paths[i]
+ @opt.lng=@opt.lngs[i]
+ end
+ @@pwd=@opt.pth
+ @opt.pth=@opt.f_pths[i][:pth]
+ @opt.lng=@opt.f_pths[i][:lng]
+ Dir.chdir(@opt.f_pth[:pth]) #watch
+ @env=SiSU_Env::InfoEnv.new(fno)
+ yield
+ else next
+ end
+ end
+ end
+ def manifest_on_files_translated
+ r=Px[:lng_lst_rgx]
+ number_of_files={}
+ @opt.files.each_with_index do |fns,i|
+ fn=fns.gsub(/(?:~(?:#{@r}))?\.ss[tm]$/,'')
+ if number_of_files[fn].is_a?(Array)
+ number_of_files[fn] << i
+ else
+ number_of_files.store(fn,[i])
+ end
+ end
+ files_translated_idx=[]
+ number_of_files.each do |x|
+ if x[1].length > 1
+ files_translated_idx << x[1]
+ end
+ end
+ if files_translated_idx.flatten.length > 1
+ SiSU_Screen::Ansi.new(@opt.cmd,'Manifest re-run on (currently generated) translated files',"").grey_title_hi unless @opt.act[:quiet][:set] ==:on
+ files_translated_idx.flatten.each do |i|
+ @opt.fns=@opt.files[i]
+ @opt.f_pth=@opt.f_pths[i]
+ if @opt.fns =~/\.-sst$/
+ @opt.pth=Dir.pwd
+ @opt.lng='en'
+ elsif @opt.fno =~/\.txz$/
+ @opt.pth=@opt.f_pths[i][:pth]
+ @opt.lng=@opt.f_pths[i][:lng]
+ else
+ @opt.pth=@opt.f_pths[i][:pth]
+ @opt.lng=@opt.f_pths[i][:lng]
+ end
+ @@pwd=@opt.pth
+ Dir.chdir(@opt.pth) #watch
+ @env=SiSU_Env::InfoEnv.new(@opt.fns)
+ yield
+ end
+ end
+ end
+ end
+ class Operations
+ @@n_do=0
+ def initialize(opt='')
+ @opt=opt
+ @cX=SiSU_Screen::Ansi.new(@opt).cX
+ end
+ def counter
+ @@n_do=0
+ end
+ def remote_put_base_site_rsync # -CR
+p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on
+ require_relative 'remote' # remote.rb
+ SiSU_Remote::Put.new(@opt).rsync_base
+ end
+ def remote_put_base_site_rsync_match # -CCRZ
+p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on
+ require_relative 'remote' # remote.rb
+ SiSU_Remote::Put.new(@opt).rsync_base_sync
+ end
+ def remote_put_base_site # -Cr
+p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on
+ require_relative 'remote' # remote.rb
+ SiSU_Remote::Put.new(@opt).scp_base
+ end
+ def remote_put_base_site_all # -CCr
+p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on
+ require_relative 'remote' # remote.rb
+ SiSU_Remote::Put.new(@opt).scp_base_all
+ end
+ def cgi # -F
+ require_relative 'cgi' # cgi.rb
+ SiSU_CGI::SearchSQL.new(@opt).read
+ end
+ def termsheet # -t
+ system("sisu_termsheet #{@opt.cmd} #{@opt.fns}\n")
+ @@n_do=@@n_do+1
+ SiSU_Screen::Ansi.new(@opt.cmd,@@n_do,'Termsheet(s) processed').term_sheet_title unless @opt.act[:quiet][:set] ==:on
+ end
+ def webrick # -W
+ prt=SiSU_Env::InfoEnv.new(@fns).port.webrick_port
+ puts %{#{@cX.blue}<<#{@cX.off}#{@cX.green}Start Webrick web server on port: #{prt}#{@cX.off}#{@cX.blue}>> #{@cX.off*2} }
+ require_relative 'webrick'
+ SiSU_Webserv::WebrickStart.new
+ end
+ def not_found
+ puts "\n#{@cX.fuschia}FILE NOT FOUND:#{@cX.off} << #{@opt.fns} >> - requested #{@opt.cmd} processing skipped\n"
+ end
+ def convert_name_message(fns,type,i,o,rune)
+ %{\nIn filename: "#{@cX.fuschia}#{fns}#{@cX.off}" << #{type} >> #{@cX.fuschia}is apre 0.36 markup filename.#{@cX.off} #{@cX.brown}Please rename your file.#{@cX.off}\n\tAs of sisu-0.37, SiSU markup files with #{@cX.brown}the extensions #{i} should be re-named #{o}#{@cX.off}\n\tif you have the program called 'rename' installed, the following rune should do the trick:\n\t\t#{rune}\n\talternatively try:\n\t\tsisu --convert --36to37 #{fns}\n\trequested #{@opt.cmd} processing skipped\n}
+ end
+ def not_recognised
+ case @opt.fns
+ when /(\.s[123])$/
+ type=@opt.fns.gsub(/\S+?(#{$1})/,'\1')
+ rune=%q{rename 's/\.s[123]$/\.sst/' *.s{1,2,3}}
+ puts convert_name_message(@opt.fns,type,'.s1 .s2 and .s3','.sst',rune)
+ when /(\.r[123])$/
+ type=@opt.fns.gsub(/\S+?(#{$1})/,'\1')
+ rune=%q{rename 's/\.r[123]$/\.ssm/' *.r{1,2,3}}
+ puts convert_name_message(@opt.fns,type,'.r1 .r2 and .r3','.sst',rune)
+ puts %{\n\tNote also that you will need to change the names of the files called/required\n\twithin the document text to build the composite document\n\t\t.s1 .s2 .s3 should be .sst \n\t\t.si should be .ssi\n\trequested #{@opt.cmd} processing skipped\n}
+ when /(\.ssi)$/
+ puts "\n#{@cX.fuschia}component filetype:#{@cX.off} << #{@opt.fns} >> - is not a processed filetype, (it may be used as a component of a .ssm markup file)\n\trequested #{@opt.cmd} processing skipped\n"
+ else
+ puts "\n#{@cX.fuschia}FILETYPE NOT RECOGNISED:#{@cX.off} << #{@opt.fns} >> - is not a recognized filetype,\n\trequested #{@opt.cmd} processing skipped\n"
+ end
+ end
+ end
+ class Processing
+ require 'fileutils'
+ include FileUtils
+ @@env=nil
+ attr_accessor :op
+ def initialize(opt)
+ @opt=opt
+ @@env=SiSU_Env::InfoEnv.new
+ @msg,@msgs='',nil
+ @tell=lambda { SiSU_Screen::Ansi.new(@opt.cmd,@msg,"#{@msgs.inspect if @msgs}") }
+ end
+ def do_loops
+ do_each_file_loop_options
+ do_loop_files_on_given_option_post
+ end
+ def do_each_file_loop_options
+ @opt.files.each_with_index do |fno,i|
+ @opt.fno=fno
+ @opt.fns=fno.gsub(/(?:https?|file):\/\/\S+\/(\S+)\.sst$/,'\1.-sst').
+ gsub(/\.ssm$/,'.ssm.sst')
+ @opt.f_pth=@opt.f_pths[i]
+ if @opt.fns !~/\.-sst$/
+ @opt.pth=@opt.f_pths[i][:pth]
+ @opt.lng=@opt.f_pths[i][:lng]
+ else
+ @opt.pth=Dir.pwd
+ @opt.lng='en'
+ end
+ unless @opt.pth.nil?
+ @@pwd=@opt.pth
+ Dir.chdir(@opt.pth) #watch
+ end
+ @env=SiSU_Env::InfoEnv.new(@opt.fns)
+ if @opt.act[:dal][:set]==:on #% --dal, -m
+ unless @opt.act[:po4a][:set]==:on # --po4a, -P
+ if @opt.fno =~ /\.ssm$/
+ require_relative 'composite' # composite.rb #pre-processing
+ SiSU_Assemble::Composite.new(@opt).read
+ end
+ require_relative 'dal' # -m dal.rb
+ SiSU_DAL::Source.new(@opt).read
+ end
+ end
+ if @opt.act[:qrcode][:set]==:on #% --qrcode, -Q
+ require_relative 'qrcode' # -Q qrcode.rb
+ SiSU_QRcode::Source.new(@opt).read
+ end
+ if @opt.act[:hash_digests][:set]==:on #% --hash-digests, -N digest tree
+ require_relative 'digests' # -N digests.rb
+ SiSU_DigestView::Source.new(@opt).read
+ end
+ if @opt.act[:txt][:set]==:on #% --txt, -t -a
+ require_relative 'plaintext' # -t -a plaintext.rb
+ SiSU_Plaintext::Source.new(@opt).read
+ end
+ if @opt.act[:html][:set]==:on #% --html, -h
+ require_relative 'html' # -h -H html.rb
+ SiSU_HTML::Source.new(@opt).read
+ end
+ if @opt.act[:concordance][:set]==:on #% --concordance, -w
+ require_relative 'concordance' # -w concordance.rb
+ SiSU_Concordance::Source.new(@opt).read
+ end
+ if @opt.act[:epub][:set]==:on #% --epub, -e
+ require_relative 'epub' # -e epub.rb
+ SiSU_EPUB::Source.new(@opt).read
+ end
+ if @opt.act[:odt][:set]==:on #% --odt, -o opendocument
+ require_relative 'odf' # -o odf.rb
+ SiSU_ODF::Source.new(@opt).read
+ end
+ if @opt.act[:xhtml][:set]==:on #% --xhtml, -b xhtml
+ require_relative 'xhtml' # -b xhtml.rb
+ SiSU_XHTML::Source.new(@opt).read
+ end
+ if @opt.act[:xml_sax][:set]==:on #% --xml-sax, -x xml sax type
+ require_relative 'xml' # -x xml.rb
+ SiSU_XML_SAX::Source.new(@opt).read
+ end
+ if @opt.act[:xml_dom][:set]==:on #% --xml-dom, -X xml dom type
+ require_relative 'xml_dom' # -X xml_dom.rb
+ SiSU_XML_DOM::Source.new(@opt).read
+ end
+ if @opt.act[:pdf][:set]==:on #% --pdf, -p latex/ texpdf
+ require_relative 'texpdf' # -p texpdf.rb
+ SiSU_TeX::Source.new(@opt).read
+ end
+ if @opt.act[:manpage][:set]==:on #% --manpage, -i
+ require_relative 'manpage' # -i manpage.rb
+ SiSU_Manpage::Source.new(@opt).read
+ end
+ if @opt.act[:texinfo][:set]==:on #% --texinfo, -I
+ require_relative 'texinfo' # -I texinfo.rb
+ SiSU_TexInfo::Source.new(@opt).read
+ end
+ if @opt.act[:sqlite_discreet][:set]==:on #% --sqlite, -d DB sqlite
+ require_relative 'dbi_discreet' # -d dbi_discreet.rb
+ SiSU_DBI_Discreet::SQL.new(@opt).build
+ end
+ if @opt.act[:manifest][:set]==:on #% --manifest, -y
+ require_relative 'manifest' # -y manifest.rb
+ SiSU_Manifest::Source.new(@opt).read
+ end
+ end
+ end
+ def loop_files_on_given_option_pre_do
+ if @opt.act[:sisupod][:set]==:on #% --sisupod, -S make sisupod
+ require_relative 'sisupod_make' # -S sisupod_make.rb
+ begin
+ OptionLoopFiles.new(@opt).loop_files_on_given_option do
+ SiSU_Doc::Source.new(@opt).read
+ end
+ ensure
+ SiSU_Doc::Source.new(@opt).sisupod_tar_xz
+ end
+ end
+ end
+ def do_loop_files_on_given_option_post
+ if @opt.act[:share_source][:set]==:on \
+ or @opt.act[:sisupod][:set]==:on \
+ or @opt.act[:git][:set]==:on
+ begin
+ require_relative 'shared_sisupod_source'
+ OptionLoopFiles.new(@opt).loop_files_on_given_option do
+ SiSU_Source::SiSUpodSource.new(@opt).read
+ end
+ if @opt.act[:share_source][:set]==:on
+#REDO
+ require_relative 'share_src' # -s share_src.rb
+ begin
+ ensure
+ OptionLoopFiles.new(@opt).loop_files_on_given_option_bundle do
+ SiSU_Markup::Source.new(@opt).read
+ end
+ end
+ end
+ if @opt.act[:sisupod][:set]==:on #% --sisupod, -S make sisupod
+ require_relative 'sisupod_make' # -S sisupod_make.rb
+ begin
+ ensure
+ OptionLoopFiles.new(@opt).loop_files_on_given_option_bundle do
+ SiSU_Doc::Source.new(@opt).sisupod_tar_xz
+ end
+ end
+ end
+ if @opt.act[:git][:set]==:on #% --git, -g sisu git
+ require_relative 'git' # -g git.rb
+ begin
+ OptionLoopFiles.new(@opt).loop_files_on_given_option do
+ SiSU_Git::Source.new(@opt).read
+ end
+ ensure
+ OptionLoopFiles.new(@opt).loop_files_on_given_option_bundle do
+ SiSU_Git::Source.new(@opt).git_commit
+ end
+ end
+ end
+ ensure
+ path_pod=@env.processing_path.processing_sisupod(@opt).paths
+ unless @opt.cmd =~/M/
+ FileUtils::rm_rf("#{path_pod[:sisupod]}/*") if FileTest.directory?(path_pod[:sisupod])
+ #FileUtils::rm_rf("#{path_pod[:fnb]}/*") if FileTest.directory?(path_pod[:fnb])
+ end
+ end
+ end
+ if @opt.act[:po4a][:set]==:on #% --po4a, -P
+ require_relative 'po4a'
+ begin
+ OptionLoopFiles.new(@opt).loop_files_on_given_option do
+ SiSU_Po4a::Source.new(@opt).read # -P po4a.rb
+ end
+ ensure
+ end
+ end
+ if @opt.act[:images][:set]==:on #% --images, -j
+ require_relative 'shared_images'
+ OptionLoopFiles.new(@opt).loop_files_on_given_option do
+ SiSU_Images::Source.new(@opt).read # -j shared_images.rb
+ end
+ end
+ if @opt.cmd =~/T/ #% -T termsheet/standard form
+ SiSU_Help::Help.new('termsheet').help_request
+ @opt.files.each do |fns|
+ if FileTest.file?(fns)
+ @opt.fns=fns
+ case @opt.fns
+ when /\.(termsheet.rb)$/
+ SiSU::Operations.new(@opt).termsheet
+ else #print "not processed --> ", fns, "\n"
+ end
+ else SiSU::Operations.new(@opt).not_found
+ end
+ end
+ SiSU::Operations.new.counter
+ end
+ if @opt.cmd =~/k/ #% -k temporary tests
+ OptionLoopFiles.new(@opt).loop_files_on_given_option do
+ #require_relative 'xml_scaffold'
+ #fix
+ end
+ end
+ if @opt.act[:psql][:set]==:on #% --pg, -D DB postgresql
+ require_relative 'dbi'
+ if @opt.files.length > 0 #switch test to actual commands
+ OptionLoopFiles.new(@opt).loop_files_on_given_option do
+ SiSU_DBI::SQL.new(@opt).connect # -D -d dbi.rb
+ end
+ else
+ SiSU_DBI::SQL.new(@opt).connect # -D -d dbi.rb
+ end
+ end
+ if @opt.act[:sqlite][:set]==:on #% --sqlite, -d DB sqlite
+ require_relative 'dbi'
+ if @opt.files.length > 0 #switch test to actual commands
+ OptionLoopFiles.new(@opt).loop_files_on_given_option do
+ SiSU_DBI::SQL.new(@opt).connect # -D -d dbi.rb
+ end
+ else
+ SiSU_DBI::SQL.new(@opt).connect # -D -d dbi.rb
+ end
+ end
+ if @opt.act[:dal][:set]==:on #% --dal, -m embedded content
+ # OptionLoopFiles.new(@opt).loop_files_on_given_option do
+ # require_relative 'embedded'
+ # SiSU_Embedded::Source.new(@opt).read # -m embedded.rb (image and other content) #check
+ # end
+ end
+ if @opt.act[:zap][:set]==:on #% --zap, -Z
+ # OptionLoopFiles.new(@opt).loop_files_on_given_option do
+ # require_relative 'zap'
+ # SiSU_Zap::Source.new(@opt).read # -Z zap.rb
+ # end
+ end
+ if @opt.act[:sisupod][:set]==:on #% --sisupod, -S make sisupod
+ # OptionLoopFiles.new(@opt).loop_files_on_given_option do
+ # require_relative 'sisupod_make'
+ # SiSU_Doc::Source.new(@opt).read # -S sisupod_make.rb
+ # end
+ end
+ if @opt.act[:manifest][:set]==:on #% --manifest, -y
+ require_relative 'manifest'
+ OptionLoopFiles.new(@opt).manifest_on_files_translated do
+ SiSU_Manifest::Source.new(@opt).read # -y manifest.rb
+ end
+ end
+ if @opt.act[:sitemap][:set]==:on #% --sitemap, -Y
+ require_relative 'sitemaps'
+ OptionLoopFiles.new(@opt).loop_files_on_given_option do
+ SiSU_Sitemaps::Source.new(@opt).read # -Y sitemaps.rb
+ end
+ end
+ if @opt.act[:harvest][:set] !=:on
+ if @opt.act[:scp][:set]==:on #% -r copy to remote server
+ require_relative 'remote' # -r remote.rb
+ OptionLoopFiles.new(@opt).loop_files_on_given_option do
+ SiSU_Remote::Put.new(@opt).scp
+ end
+ end
+ if @opt.act[:rsync][:set]==:on #% -R copy to remote server
+ require_relative 'remote' # -R remote.rb
+ OptionLoopFiles.new(@opt).loop_files_on_given_option do
+ SiSU_Remote::Put.new(@opt).rsync
+ end
+ end
+ else
+ end
+ if @opt.act[:urls_selected][:set]==:on #% --sitemap, -Y
+ require_relative 'urls'
+ OptionLoopFiles.new(@opt).loop_files_on_given_option do
+ SiSU_Urls::Source.new(@opt).read #% -u -v -V -M
+ end
+ end
+ end
+ def do_initialization
+ @cX=SiSU_Screen::Ansi.new(@opt.cmd).cX
+ flag=SiSU_Env::InfoProcessingFlag.new
+ if @opt.act[:version_info][:set]==:on #% version information
+ SiSU_Help::Help.new('env',@opt).sisu_version
+ end
+ if @opt.act[:license][:set]==:on #% license information
+ SiSU_Help::Help.new('license',@opt).help_request
+ end
+ if @opt.act[:dal][:set]==:on \
+ or @opt.act[:maintenance][:set]==:on #% --maintenance, -m for -C
+ path={}
+ path[:css]=@@env.path.output + '/_sisu/css'
+ path[:xml]=@@env.path.output + '/_sisu/xml'
+ path[:xsd]=path[:xml] + '/xsd'
+ path[:xsd]=path[:xml] + '/rnc'
+ path[:xsd]=path[:xml] + '/rng'
+ re_p3=/(sisupod(?:\.txz)?|\S+?\.ss[mt]\.txz|[^\/]+?\.ssp)$/
+ unless @opt.files.join(',') =~ re_p3 #do not mix pods with source markup files in command line
+ # unless ( FileTest.directory?(path[:css]) \
+ # and FileTest.directory?(path[:xsd]) )
+ # @opt.cmd=@opt.cmd +='C' unless @opt.cmd =~/C/ #FIX
+ # end
+ if @opt.act[:maintenance][:set] ==:on
+ $VERBOSE=false #debug $VERBOSE=true
+ end
+ end
+ re_p2=/(sisupod(?:\.zip)?|\S+?\.ss[mt]\.zip)$/
+ unless @opt.files.join(',') =~ re_p2 #do not mix pods with source markup files in command line
+ # unless ( FileTest.directory?(path[:css]) \
+ # and FileTest.directory?(path[:xsd]) )
+ # @opt.cmd=@opt.cmd +='C' unless @opt.cmd =~/C/ #FIX
+ # end
+ if @opt.act[:maintenance][:set] ==:on
+ $VERBOSE=false #debug $VERBOSE=true
+ end
+ end
+ end
+ if @opt.act[:site_init][:set]==:on #% --init-site, -C initialize/configure
+ require_relative 'conf' #% --init-site, -C initialize/configure
+ SiSU_Initialize::Source.new(@opt).read
+ if @opt.act[:rsync][:set]==:on
+ if @opt.mod.inspect =~/--init(?:ialize)?=site/ \
+ and @opt.cmd =~/RZ/
+ SiSU::Operations.new(@opt).remote_put_base_site_rsync_match
+ else SiSU::Operations.new(@opt).remote_put_base_site_rsync
+ end
+ elsif @opt.act[:scp][:set]==:on
+ if @opt.mod.inspect =~/--init(?:ialize)?=site/ \
+ and @opt.cmd =~/CCr/
+ SiSU::Operations.new(@opt).remote_put_base_site_all
+ else SiSU::Operations.new(@opt).remote_put_base_site
+ end
+ end
+ end
+ if @opt.act[:sample_search_form][:set]==:on #% --sample-search-form, -F cgi sample search form
+ SiSU::Operations.new(@opt).cgi
+ end
+ if @opt.act[:webrick][:set]==:on #% --webrick, -W webrick
+ SiSU::Operations.new(@opt).webrick
+ end
+ if @opt.act[:zap][:set]==:on #% --zap -Z wipe previous output clean DUPLICATE
+ #require_relative 'zap'
+ #SiSU_Zap::Source.new(@opt).read # -Z zap.rb
+ end
+ if @opt.act[:dal][:set]==:on
+ @retry_count= -1
+ begin
+ path_image='./_sisu/processing/external_document/image'
+ @get_s,@get_p,@get_pl=[],[],[]
+ re_s=/(\S+?\.-sst)$/
+ re_p3=/((?:https?|file):\/\/\S+?(?:\/\S+?\.ss[mt]\.txz|sisupod(?:\.txz)?|\.ssp))/
+ re_pl3=/^(\/\S+?\.ss[mt]\.txz)/
+ @opt.files.each do |fns|
+ if fns =~re_s
+ @get_s << @opt.f_pths[0][:url]
+ end
+ if fns =~re_p3
+ @get_p << re_p3.match(fns)[1] if re_p3
+ end
+ if fns =~re_pl3
+ @get_pl << re_pl3.match(fns)[1] if re_p3
+ end
+ end
+ if @get_s.length > 0 #% remote markup file .sst
+ require_relative 'remote' # remote.rb
+ SiSU_Remote::Get.new(@opt,@get_s).fns
+ SiSU::Operations.new.counter
+ end
+ if @get_p.length > 0 #% remote sisupod
+ require_relative 'remote' # remote.rb
+ SiSU_Remote::Get.new(@opt,@get_p).sisupod
+ end
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt,@fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ @retry_count +=1
+ retry unless @retry_count > 1
+ ensure
+ end
+ end
+ if @opt.act[:site_init][:set]==:on #% -C
+ require_relative 'conf' # -s conf.rb
+ SiSU_Initialize::Source.new(@opt).read
+ end
+ end
+ def actions
+ if @opt.act[:profile][:set]==:on
+ require 'profile'
+ end
+ if @opt.act[:harvest][:set]==:on
+ require_relative 'harvest' # harvest.rb
+ SiSU_Harvest::Source.new(@opt).read # -h -H html.rb
+ elsif @opt.mod.inspect =~/--convert|--to|--from/
+ require_relative 'sst_convert_markup' # sst_convert_markup.rb
+ elsif @opt.cmd =~/([abCcDdeFGgHhIjikLMmNnoPpQqRrSsTtUuVvWwXxYyZ_0-9])/ \
+ and @opt.cmd =~/^-/ \
+ and @opt.mod.inspect !~/--(?:sitemaps|query|identify)/ \
+ or @opt.mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/
+ do_initialization
+ do_loops
+ @msg,@msgs="\tsisu -W [to start ruby web-server on output directory]\n",nil unless @opt.act[:quiet][:set] ==:on
+ @tell.call.print_brown if @opt.cmd =~/[uUvVM]/ unless @opt.files.join.empty?
+ if defined? @@env.processing_path.processing \
+ and @@env.user \
+ and FileTest.directory?(@@env.processing_path.processing) \
+ and @@env.processing_path.processing =~/#{@@env.user}$/ #clean temporary processing directory of content as is located in public area
+ FileUtils::cd(@@env.processing_path.processing_base_tmp) do
+ FileUtils::rm_rf(@@env.user) unless @opt.act[:maintenance][:set] ==:on
+ end
+ end
+ elsif @opt.mod.inspect =~/--query/
+ require_relative 'sst_identify_markup' # sst_identify_markup.rb
+ puts SiSU_Markup::MarkupHistory.new(@opt).query
+ elsif @opt.mod.inspect =~/--identify/
+ require_relative 'sst_identify_markup' # sst_identify_markup.rb
+ markup_version=SiSU_Markup::MarkupIdentify.new(@opt).markup_version?
+ elsif @opt.mod.inspect =~/--about/ #% help instructions
+ if @opt.mod.inspect =~/--about/ \
+ and not @opt.what.empty?
+ SiSU_Help::Help.new(@opt.what,'color_off').help_request
+ else
+ SiSU_Help::Help.new('list','color_off').help_request
+ end
+ elsif @opt.mod.inspect =~/--sitemaps/ #% sitemaps
+ require_relative 'sitemaps' # sitemaps.rb
+ SiSU_Sitemaps::Source.new(@opt).read
+ if @opt.act[:rsync][:set]==:on
+ require_relative 'remote' # remote.rb
+ SiSU_Remote::Put.new(@opt).rsync_sitemaps
+ end
+ else #% help instructions
+ unless @opt.mod.inspect =~/--convert|--to|--from|--harvest/
+ if @opt.mod.inspect =~/--help/ \
+ and not @opt.what.empty?
+ SiSU_Help::Help.new(@opt.what).help_request
+ elsif @opt.mod.inspect =~/--help/
+ SiSU_Help::Help.new('list').help_request
+ else
+ SiSU_Help::Help.new('env',@opt).sisu_version
+ tell=SiSU_Screen::Ansi.new(''," for HELP type:\n\tsisu --help [help request]\n\tman sisu\n or see the system or online documentation on SiSU:\n #{Config::CONFIG['datadir']}/doc/sisu/\n <http://www.jus.uio.no/sisu/>\n <http://sisudoc.org/>")
+ tell.puts_grey
+ end
+ end
+ end
+ @opt.files.each do |fns|
+ if FileTest.file?(fns)
+ @opt.fns=fns
+ unless @opt.fns =~ /(?:\.(?:(?:-|ssm\.)?sst|ssm|ssp|sx[sdn]\.xml|termsheet.rb)|\S+?\.ss[mt]\.(?:txz|zip)|sisupod\.(?:txz|zip)?|\S+?\.ssp)$/
+ if @opt.cmd.inspect=~/-P/
+ elsif @opt.fns=~/\.kdi$/ \
+ and @opt.mod.inspect =~/--(?:convert(?:-from)?|from)[=-]kdi/
+ elsif @opt.fns=~/\.sx[sdn]\.xml$/ \
+ and @opt.mod.inspect =~/--(?:(?:convert(?:-from)?|from)[=-])?(?:xml2sst|sxml)/
+ elsif @opt.fns=~/\.ssi$/ \
+ and @opt.mod.inspect =~/--identify/
+ else SiSU::Operations.new(@opt).not_recognised
+ end
+ end
+ if @opt.fns =~/\.ssm\.sst$/ \
+ and @opt.cmd !~/[S_M]/ # rework necessry, revist, the _ flag is a hack, to keep ._sst files
+ @msg,@msgs='temporary file removed',nil
+ @tell.call.warn unless @opt.cmd =~/V/
+ File.unlink(@opt.fns) if File.exist?(@opt.fns) #CONSIDER
+ end
+ else #SiSU::Operations.new(fns,'html').not_found
+ end
+ end
+ end
+ end
+end
+__END__
diff --git a/lib/sisu/v4/i18n.rb b/lib/sisu/v4/i18n.rb
new file mode 100644
index 00000000..206a69ce
--- /dev/null
+++ b/lib/sisu/v4/i18n.rb
@@ -0,0 +1,697 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: internationalisation
+
+=end
+module SiSU_i18n
+ @@language_table,@@language_list=nil,nil
+ class Languages
+ def language
+ def table
+ @@language_table ||= {
+ am: { c: 'am', n: 'Amharic', t: 'Amharic', xlp: 'amharic' },
+ bg: { c: 'bg', n: 'Bulgarian', t: 'Български (Bəlgarski)', xlp: 'bulgarian' },
+ bn: { c: 'bn', n: 'Bengali', t: 'Bengali', xlp: 'bengali' },
+ br: { c: 'br', n: 'Breton', t: 'Breton', xlp: 'breton' },
+ ca: { c: 'ca', n: 'Catalan', t: 'catalan', xlp: 'catalan' },
+ cs: { c: 'cs', n: 'Czech', t: 'česky', xlp: 'czech' },
+ cy: { c: 'cy', n: 'Welsh', t: 'Welsh', xlp: 'welsh' },
+ da: { c: 'da', n: 'Danish', t: 'dansk', xlp: 'danish' },
+ de: { c: 'de', n: 'German', t: 'Deutsch', xlp: 'german' },
+ el: { c: 'el', n: 'Greek', t: 'Ελληνικά (Ellinika)', xlp: 'greek' },
+ en: { c: 'en', n: 'English', t: 'English', xlp: 'english' },
+ eo: { c: 'eo', n: 'Esperanto', t: 'Esperanto', xlp: 'esperanto' },
+ es: { c: 'es', n: 'Spanish', t: 'español', xlp: 'spanish' },
+ et: { c: 'et', n: 'Estonian', t: 'Estonian', xlp: 'estonian' },
+ eu: { c: 'eu', n: 'Basque', t: 'basque', xlp: 'basque' },
+ fi: { c: 'fi', n: 'Finnish', t: 'suomi', xlp: 'finnish' },
+ fr: { c: 'fr', n: 'French', t: 'français', xlp: 'french' },
+ ga: { c: 'ga', n: 'Irish', t: 'Irish', xlp: 'irish' },
+ gl: { c: 'gl', n: 'Galician', t: 'Galician', xlp: 'galician' },
+ he: { c: 'he', n: 'Hebrew', t: 'Hebrew', xlp: 'hebrew' },
+ hi: { c: 'hi', n: 'Hindi', t: 'Hindi', xlp: 'hindi' },
+ hr: { c: 'hr', n: 'Croatian', t: 'Croatian', xlp: 'croatian' },
+ hy: { c: 'hy', n: 'Armenian', t: 'Armenian', xlp: 'armenian' },
+ ia: { c: 'ia', n: 'Interlingua', t: 'Interlingua', xlp: 'interlingua' },
+ is: { c: 'is', n: 'Icelandic', t: 'Icelandic', xlp: 'icelandic' },
+ it: { c: 'it', n: 'Italian', t: 'Italiano', xlp: 'italian' },
+ la: { c: 'la', n: 'Latin', t: 'Latin', xlp: 'latin' },
+ lo: { c: 'lo', n: 'Lao', t: 'Lao', xlp: 'lao' },
+ lt: { c: 'lt', n: 'Lithuanian', t: 'Lithuanian', xlp: 'lithuanian' },
+ lv: { c: 'lv', n: 'Latvian', t: 'Latvian', xlp: 'latvian' },
+ ml: { c: 'ml', n: 'Malayalam', t: 'Malayalam', xlp: 'malayalam' },
+ mr: { c: 'mr', n: 'Marathi', t: 'Marathi', xlp: 'marathi' },
+ nl: { c: 'nl', n: 'Dutch', t: 'Nederlands', xlp: 'dutch' },
+ no: { c: 'no', n: 'Norwegian', t: 'norsk', xlp: 'norsk' },
+ nn: { c: 'nn', n: 'Norwegian Nynorsk', t: 'nynorsk', xlp: 'nynorsk' },
+ oc: { c: 'oc', n: 'Occitan', t: 'Occitan', xlp: 'occitan' },
+ pl: { c: 'pl', n: 'Polish', t: 'polski', xlp: 'polish' },
+ pt: { c: 'pt', n: 'Portuguese', t: 'Português', xlp: 'portuges' },
+ pt_BR: { c: 'pt_BR', n: 'Portuguese Brazil', t: 'Brazilian Português', xlp: 'brazilian' },
+ ro: { c: 'ro', n: 'Romanian', t: 'română', xlp: 'romanian' },
+ ru: { c: 'ru', n: 'Russian', t: 'Русский (Russkij)', xlp: 'russian' },
+ sa: { c: 'sa', n: 'Sanskrit', t: 'Sanskrit', xlp: 'sanskrit' },
+ se: { c: 'se', n: 'Sami', t: 'Samin', xlp: 'samin' },
+ sk: { c: 'sk', n: 'Slovak', t: 'slovensky', xlp: 'slovak' },
+ sl: { c: 'sl', n: 'Slovenian', t: 'Slovenian', xlp: 'slovenian' },
+ sq: { c: 'sq', n: 'Albanian', t: 'Albanian', xlp: 'albanian' },
+ sr: { c: 'sr', n: 'Serbian', t: 'Serbian', xlp: 'serbian' },
+ sv: { c: 'sv', n: 'Swedish', t: 'svenska', xlp: 'swedish' },
+ ta: { c: 'ta', n: 'Tamil', t: 'Tamil', xlp: 'tamil' },
+ te: { c: 'te', n: 'Telugu', t: 'Telugu', xlp: 'telugu' },
+ th: { c: 'th', n: 'Thai', t: 'Thai', xlp: 'thai' },
+ tk: { c: 'tk', n: 'Turkmen', t: 'Turkmen', xlp: 'turkmen' },
+ tr: { c: 'tr', n: 'Turkish', t: 'Türkçe', xlp: 'turkish' },
+ uk: { c: 'uk', n: 'Ukranian', t: 'українська (ukrajins\'ka)', xlp: 'ukrainian' },
+ ur: { c: 'ur', n: 'Urdu', t: 'Urdu', xlp: 'urdu' },
+ us: { c: 'en', n: 'English (American)',t: 'English', xlp: 'english' },
+ vi: { c: 'vi', n: 'Vietnamese', t: 'Vietnamese', xlp: 'vietnamese' },
+ en: { c: 'en', n: 'English', t: 'English', xlp: 'english' },
+ xx: { c: 'xx', n: 'Default', t: 'English', xlp: 'english' },
+ }
+ end
+ def list
+ @@language_list ||= {
+ 'am' => table[:am],
+ 'bg' => table[:bg],
+ 'bn' => table[:bn],
+ 'br' => table[:br],
+ 'ca' => table[:ca],
+ 'cs' => table[:cs],
+ 'cy' => table[:cy],
+ 'da' => table[:da],
+ 'de' => table[:de],
+ 'el' => table[:el],
+ 'en' => table[:en],
+ 'eo' => table[:eo],
+ 'es' => table[:es],
+ 'et' => table[:et],
+ 'eu' => table[:eu],
+ 'fi' => table[:fi],
+ 'fr' => table[:fr],
+ 'ga' => table[:ga],
+ 'gl' => table[:gl],
+ 'he' => table[:he],
+ 'hi' => table[:hi],
+ 'hr' => table[:hr],
+ 'hy' => table[:hy],
+ 'ia' => table[:ia],
+ 'is' => table[:is],
+ 'it' => table[:it],
+ 'la' => table[:la],
+ 'lo' => table[:lo],
+ 'lt' => table[:lt],
+ 'lv' => table[:lv],
+ 'ml' => table[:ml],
+ 'mr' => table[:mr],
+ 'nl' => table[:nl],
+ 'no' => table[:no],
+ 'nn' => table[:nn],
+ 'oc' => table[:oc],
+ 'pl' => table[:pl],
+ 'pt' => table[:pt],
+ 'pt_BR' => table[:pt_BR],
+ 'ro' => table[:ro],
+ 'ru' => table[:ru],
+ 'sa' => table[:sa],
+ 'se' => table[:se],
+ 'sk' => table[:sk],
+ 'sl' => table[:sl],
+ 'sq' => table[:sq],
+ 'sr' => table[:sr],
+ 'sv' => table[:sv],
+ 'ta' => table[:ta],
+ 'te' => table[:te],
+ 'th' => table[:th],
+ 'tk' => table[:tk],
+ 'tr' => table[:tr],
+ 'uk' => table[:uk],
+ 'ur' => table[:ur],
+ 'us' => table[:en],
+ 'vi' => table[:vi],
+ 'en' => table[:en],
+ 'xx' => table[:en]
+ }
+ end
+ self
+ end
+ end
+ class Alphabet
+ def initialize(lng_code)
+ @lng_code=lng_code
+ end
+ def hash_arrays
+ @alph=case @lng_code
+ when /en/ #english
+ {
+ u: %w[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z],
+ l: %w[a b c d e f g h i j k l m n o p q r s t u v w x y z]
+ }
+ when /da|no|nn/ #danish, norwegian
+ {
+ u: %w[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Å Æ Ø],
+ l: %w[a b c d e f g h i j k l m n o p q r s t u v w x y z å æ ø]
+ #u: %W[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Æ Ø Å],
+ #l: %w[a b c d e f g h i j k l m n o p q r s t u v w x y z æ ø å]
+ }
+ when /sv/ #swedish
+ {
+ u: %w[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Å Ä Ö],
+ l: %w[a b c d e f g h i j k l m n o p q r s t u v w x y z å ä ö]
+ }
+ else #english default
+ {
+ u: %w[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z],
+ l: %w[a b c d e f g h i j k l m n o p q r s t u v w x y z]
+ }
+ end
+ end
+ def hash_strings
+ { u: hash_arrays[:u].join, l: hash_arrays[:l].join }
+ end
+ end
+end
+__END__
+Language Lists
+* po4a c:
+ <http://www.debian.org/international/l10n/po/>
+ Px[:lng_lst]=%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 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]
+* polyglossia xlp:
+ <http://mirrors.ctan.org/macros/xetex/latex/polyglossia/polyglossia.pdf>
+ missing from (:c) list:
+ arabic asturian bahasai bahasam coptic divehi farsi lsorbian magyar scottish syriac usorbian
+note ISO_639-1
+ <http://en.wikipedia.org/wiki/ISO_639-1>
+ <http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes>
+also note ISO_639-2
+ <http://en.wikipedia.org/wiki/ISO_639-2>
+ <http://en.wikipedia.org/wiki/List_of_ISO_639-2_codes>
+
+Px[:lng_lst] # constants.rb
+
+module SiSU_TextTranslation
+ class Language
+ def initialize(md)
+ @md=md
+ end
+ def tex_name(char)
+ @lang=if char
+ case char
+ when 'sq'; 'albanian'
+ when 'am'; 'amharic'
+ #when 'ar'; 'arabic' # see polyglossia
+ when 'hy'; 'armenian'
+ #when ''; 'asturian' # polyglossia
+ #when ''; 'bahasai' # polyglossia
+ #when ''; 'bahasam' # polyglossia
+ when 'eu'; 'basque'
+ when 'bn'; 'bengali'
+ when 'pt_BR'; 'brazilian'
+ when 'br'; 'breton'
+ when 'bg'; 'bulgarian'
+ when 'ca'; 'catalan' # see polyglossia
+ #when ''; 'coptic' # polyglossia
+ when 'hr'; 'croatian'
+ when 'cs'; 'czech'
+ when 'da'; 'danish'
+ #when ''; 'divehi' # polyglossia
+ when 'nl'; 'dutch' # see polyglossia
+ when 'en'; 'english' # see polyglossia
+ when 'eo'; 'esperanto' # see polyglossia
+ when 'et'; 'estonian'
+ when 'gl'; 'galician'
+ when 'de'; 'german'
+ when 'el'; 'greek' #gl ?
+ when 'he'; 'hebrew'
+ when 'hi'; 'hindi'
+ when 'is'; 'icelandic'
+ when 'ia'; 'interlingua'
+ when 'ga'; 'irish'
+ when 'it'; 'italian'
+ #when ''; 'farsi' # polyglossia
+ when 'fi'; 'finnish'
+ when 'fr'; 'french'
+ when 'lo'; 'lao'
+ when 'la'; 'latin'
+ when 'lv'; 'latvian'
+ when 'lt'; 'lithuanian'
+ #when ''; 'lsorbian' # polyglossia
+ #when ''; 'magyar' # polyglossia
+ when 'ml'; 'malayalam'
+ when 'mr'; 'marathi'
+ #when 'hu'; 'magyar'
+ when 'no'; 'norske'
+ when 'nn'; 'nynorsk'
+ when 'oc'; 'occitan'
+ when 'pl'; 'polish'
+ when 'pt'; 'portuges'
+ when 'ro'; 'romanian'
+ when 'ru'; 'russian'
+ when 'se'; 'samin' #(check sami?)
+ when 'sa'; 'sanskrit'
+ when 'sr'; 'serbian'
+ #when ''; 'scottish' # polyglossia (gd (Gaelic (Scots)))
+ when 'sk'; 'slovak'
+ when 'sl'; 'slovenian'
+ when 'es'; 'spanish'
+ when 'sv'; 'swedish'
+ when 'ta'; 'tamil'
+ when 'te'; 'telugu'
+ when 'th'; 'thai'
+ when 'tr'; 'turkish'
+ when 'tk'; 'turkmen'
+ when 'uk'; 'ukrainian'
+ when 'ur'; 'urdu'
+ #when ''; 'usorbian' # polyglossia
+ when 'vi'; 'vietnamese'
+ when 'cy'; 'welsh'
+ when 'us'; 'USenglish' # depreciated, see iso-639-2
+ else 'english'
+ end
+ else 'english'
+ end
+ end
+ end
+end
+#% Language List po4a
+http://www.debian.org/international/l10n/po/
+see polyglossia for subset
+* CSB (Unknown language)
+* KAB (Unknown language)
+* TLH (Unknown language)
+* aa (Afar)
+* ab (Abkhazian)
+* af (Afrikaans)
+* af_ZA (Afrikaans, as spoken in South Africa)
+* am (Amharic)
+* an (Unknown language)
+* ang (Unknown language)
+* ar (Arabic)
+* ar_AR (Arabic, as spoken in Argentina)
+* ar_EG (Arabic, as spoken in Egypt)
+* ar_OM (Arabic, as spoken in Oman)
+* ar_PS (Arabic, as spoken in Palestinian Territory, Occupied)
+* ar_SA (Arabic, as spoken in Saudi Arabia)
+* ar_SY (Arabic, as spoken in Syrian Arab Republic)
+* as (Assamese)
+* ast (Unknown language)
+* ay (Aymara)
+* az (Azerbaijani)
+* az_IR (Azerbaijani, as spoken in Iran)
+* be (Belarusian)
+* be@latin (Unknown language)
+* be@tarask (Unknown language)
+* bem (Unknown language)
+* bg (Bulgarian)
+* bg_BG (Bulgarian, as spoken in Bulgaria)
+* bi (Bislama)
+* bn (Bengali)
+* bn_BD (Bengali, as spoken in Bangladesh)
+* bn_IN (Bengali, as spoken in India)
+* bo (Tibetan)
+* br (Breton)
+* bs (Bosnian)
+* bs_BA (Bosnian, as spoken in Bosnia and Herzegovina)
+* bs_BS (Bosnian, as spoken in Bahamas)
+* byn (Unknown language)
+* ca (Catalan)
+* ca@valencia (Unknown language)
+* ca_AD (Catalan, as spoken in Andorra)
+* ca_ES (Catalan, as spoken in Spain)
+* ca_ES@valencia (Unknown language)
+* ca_FR (Catalan, as spoken in France)
+* ca_IT (Catalan, as spoken in Italy)
+* co (Corsican)
+* crh (Unknown language)
+* cs (Czech)
+* cs_CZ (Czech, as spoken in Czech Republic)
+* csb (Unknown language)
+* cy (Welsh)
+* cy_GB (Welsh, as spoken in Great Britain)
+* cz (Unknown language)
+* da (Danish)
+* da_DK (Danish, as spoken in Denmark)
+* de (German)
+* de_AT (German, as spoken in Austria)
+* de_CH (German, as spoken in Switzerland)
+* de_DE (German, as spoken in Germany)
+* dk (Unknown language)
+* dz (Dzongkha)
+* el (Greek)
+* el_GR (Greek, as spoken in Greece)
+* en (English)
+* en@boldquot (Unknown language)
+* en@quot (Unknown language)
+* en@shaw (Unknown language)
+* en_AU (English, as spoken in Australia)
+* en_CA (English, as spoken in Canada)
+* en_GB (English, as spoken in Great Britain)
+* en_NZ (English, as spoken in New Zealand)
+* en_US (English, as spoken in United States)
+* en_US@piglatin (Unknown language)
+* en_ZA (English, as spoken in South Africa)
+* eo (Esperanto)
+* es (Spanish)
+* es_AR (Spanish, as spoken in Argentina)
+* es_CL (Spanish, as spoken in Chile)
+* es_CO (Spanish, as spoken in Colombia)
+* es_CR (Spanish, as spoken in Costa Rica)
+* es_DO (Spanish, as spoken in Dominican Republic)
+* es_EC (Spanish, as spoken in Ecuador)
+* es_ES (Spanish, as spoken in Spain)
+* es_GA (Spanish, as spoken in Gabon)
+* es_GT (Spanish, as spoken in Guatemala)
+* es_HN (Spanish, as spoken in Honduras)
+* es_LA (Spanish, as spoken in Lao People''s Democratic Republic)
+* es_MX (Spanish, as spoken in Mexico)
+* es_NI (Spanish, as spoken in Nicaragua)
+* es_PA (Spanish, as spoken in Panama)
+* es_PE (Spanish, as spoken in Peru)
+* es_PR (Spanish, as spoken in Puerto Rico)
+* es_SV (Spanish, as spoken in El Salvador)
+* es_UY (Spanish, as spoken in Uruguay)
+* es_VE (Spanish, as spoken in Venezuela)
+* et (Estonian)
+* et_EE (Estonian, as spoken in Estonia)
+* eu (Basque)
+* eu_ES (Basque, as spoken in Spain)
+* fa (Persian)
+* fa_AF (Persian, as spoken in Afghanistan)
+* fa_IR (Persian, as spoken in Iran)
+* fi (Finnish)
+* fi_FI (Finnish, as spoken in Finland)
+* fil (Unknown language)
+* fo (Faeroese)
+* fo_FO (Faeroese, as spoken in Faroe Islands)
+* fr (French)
+* fr_BE (French, as spoken in Belgium)
+* fr_CA (French, as spoken in Canada)
+* fr_CH (French, as spoken in Switzerland)
+* fr_FR (French, as spoken in France)
+* fr_FX (French, as spoken in France, Metropolitan)
+* fr_LU (French, as spoken in Luxembourg)
+* frp (Unknown language)
+* fur (Unknown language)
+* fy (Frisian)
+* fy_NL (Frisian, as spoken in Netherlands)
+* ga (Irish)
+* gd (Gaelic (Scots))
+* gez (Unknown language)
+* gl (Galician)
+* gl_ES (Galician, as spoken in Spain)
+* gn (Guarani)
+* gu (Gujarati)
+* gv (Manx)
+* ha (Hausa)
+* he (Hebrew)
+* he_IL (Hebrew, as spoken in Israel)
+* hi (Hindi)
+* hne (Unknown language)
+* hr (Croatian)
+* hr_HR (Croatian, as spoken in Croatia)
+* ht (Unknown language)
+* hu (Hungarian)
+* hu_HU (Hungarian, as spoken in Hungary)
+* hy (Armenian)
+* ia (Interlingua)
+* id (Indonesian)
+* id_ID (Indonesian, as spoken in Indonesia)
+* ig (Unknown language)
+* io (Unknown language)
+* is (Icelandic)
+* is_IS (Icelandic, as spoken in Iceland)
+* it (Italian)
+* it_CH (Italian, as spoken in Switzerland)
+* it_IT (Italian, as spoken in Italy)
+* iu (Inuktitut)
+* ja (Japanese)
+* ja_JP (Japanese, as spoken in Japan)
+* jv (Unknown language)
+* jv_ID (Unknown language)
+* ka (Georgian)
+* kab (Unknown language)
+* kk (Kazakh)
+* kl (Kalaallisut)
+* km (Khmer)
+* km_KH (Khmer, as spoken in Cambodia)
+* kn (Kannada)
+* ko (Korean)
+* ko_KR (Korean, as spoken in Korea)
+* ks (Kashmiri)
+* ku (Kurdish)
+* kw (Cornish)
+* ky (Kirghiz)
+* la (Latin)
+* lb (Letzeburgesch)
+* lg (Unknown language)
+* li (Unknown language)
+* ln (Lingala)
+* lo (Lao)
+* lt (Lithuanian)
+* lt_LT (Lithuanian, as spoken in Lithuania)
+* lv (Latvian)
+* lv_LV (Latvian, as spoken in Latvia)
+* mai (Unknown language)
+* mal (Unknown language)
+* mg (Malagasy)
+* mi (Maori)
+* mk (Macedonian)
+* mk_MK (Macedonian, as spoken in Macedonia, the Former Yugoslav Republic of)
+* ml (Malayalam)
+* ml_IN (Malayalam, as spoken in India)
+* ml_ML (Malayalam, as spoken in Mali)
+* mn (Mongolian)
+* mr (Marathi)
+* ms (Malay)
+* ms_MY (Malay, as spoken in Malaysia)
+* mt (Maltese)
+* my (Burmese)
+* my_MM (Burmese, as spoken in Myanmar)
+* na (Nauru)
+* nb (Norwegian Bokmål)
+* nb_NO (Norwegian Bokmål, as spoken in Norway)
+* nds (Unknown language)
+* ne (Nepali)
+* new (Unknown language)
+* nl (Dutch)
+* nl_BE (Dutch, as spoken in Belgium)
+* nl_NL (Dutch, as spoken in Netherlands)
+* nn (Norwegian Nynorsk)
+* nn_NO (Norwegian Nynorsk, as spoken in Norway)
+* no (Norwegian)
+* no_NO (Norwegian, as spoken in Norway)
+* nr (Ndebele, South)
+* nso (Unknown language)
+* oc (Occitan (post 1500))
+* oc_FR (Occitan (post 1500), as spoken in France)
+* om (Oromo)
+* or (Oriya)
+* pa (Panjabi)
+* pl (Polish)
+* pl_PL (Polish, as spoken in Poland)
+* pms (Unknown language)
+* ps (Pushto)
+* pt (Portuguese)
+* pt_BR (Portuguese, as spoken in Brazil)
+* pt_PT (Portuguese, as spoken in Portugal)
+* qu (Quechua)
+* rm (Rhaeto-Romance)
+* ro (Romanian)
+* ro_RO (Romanian, as spoken in Romania)
+* ru (Russian)
+* ru_RU (Russian, as spoken in Russia)
+* rw (Kinyarwanda)
+* sa (Sanskrit)
+* sc (Sardinian)
+* sd (Sindhi)
+* se (Sami)
+* se_NO (Sami, as spoken in Norway)
+* si (Sinhalese)
+* si_LK (Sinhalese, as spoken in Sri Lanka)
+* si_SI (Sinhalese, as spoken in Slovenia)
+* sk (Slovak)
+* sk_SK (Slovak, as spoken in Slovakia)
+* sl (Slovenian)
+* sl_SI (Slovenian, as spoken in Slovenia)
+* sl_SL (Slovenian, as spoken in Sierra Leone)
+* so (Somali)
+* sp (Unknown language)
+* sq (Albanian)
+* sq_AL (Albanian, as spoken in Albania)
+* sr (Serbian)
+* sr@Latn (Unknown language)
+* sr@ije (Unknown language)
+* sr@ijekavian (Unknown language)
+* sr@ijekavianlatin (Unknown language)
+* sr@latin (Unknown language)
+* sr_SR (Serbian, as spoken in Suriname)
+* sr_YU (Serbian, as spoken in Yugoslavia)
+* st (Sotho)
+* su (Sundanese)
+* su_ID (Sundanese, as spoken in Indonesia)
+* sv (Swedish)
+* sv_SE (Swedish, as spoken in Sweden)
+* sw (Swahili)
+* ta (Tamil)
+* ta_LK (Tamil, as spoken in Sri Lanka)
+* te (Telugu)
+* tg (Tajik)
+* th (Thai)
+* th_TH (Thai, as spoken in Thailand)
+* ti (Tigrinya)
+* tig (Unknown language)
+* tk (Turkmen)
+* tl (Tagalog)
+* tlh (Unknown language)
+* to (Tonga)
+* tr (Turkish)
+* tr_TR (Turkish, as spoken in Turkey)
+* tt (Tatar)
+* ug (Uighur)
+* ug_CN (Uighur, as spoken in China)
+* uk (Ukrainian)
+* uk_UA (Ukrainian, as spoken in Ukraine)
+* ur (Urdu)
+* ur_PK (Urdu, as spoken in Pakistan)
+* uz (Uzbek)
+* uz@cyrillic (Unknown language)
+* ve (Unknown language)
+* vi (Vietnamese)
+* vi_AR (Vietnamese, as spoken in Argentina)
+* vi_DE (Vietnamese, as spoken in Germany)
+* vi_PL (Vietnamese, as spoken in Poland)
+* vi_TR (Vietnamese, as spoken in Turkey)
+* vi_VN (Vietnamese, as spoken in Vietnam)
+* wa (Unknown language)
+* wal (Unknown language)
+* wo (Wolof)
+* xh (Xhosa)
+* yi (Yiddish)
+* yo (Yoruba)
+* zh (Chinese)
+* zh_CN (Chinese, as spoken in China)
+* zh_HK (Chinese, as spoken in Hong Kong)
+* zh_TW (Chinese, as spoken in Taiwan)
+* zu (Zulu)
+
+ 'sq'; 'albanian'
+ 'am'; 'amharic'
+#'ar'; 'arabic' # see polyglossia
+ 'hy'; 'armenian'
+#''; 'asturian' # polyglossia
+#''; 'bahasai' # polyglossia
+#''; 'bahasam' # polyglossia
+ 'eu'; 'basque'
+ 'bn'; 'bengali'
+ 'pt_BR'; 'brazilian'
+ 'br'; 'breton'
+ 'bg'; 'bulgarian'
+ 'ca'; 'catalan' # see polyglossia
+#''; 'coptic' # polyglossia
+ 'hr'; 'croatian'
+ 'cs'; 'czech'
+ 'da'; 'danish'
+#''; 'divehi' # polyglossia
+ 'nl'; 'dutch' # see polyglossia
+ 'en'; 'english' # see polyglossia
+ 'eo'; 'esperanto' # see polyglossia
+ 'et'; 'estonian'
+ 'gl'; 'galician'
+ 'de'; 'german'
+ 'el'; 'greek' #gl ?
+ 'he'; 'hebrew'
+ 'hi'; 'hindi'
+ 'is'; 'icelandic'
+ 'ia'; 'interlingua'
+ 'ga'; 'irish'
+ 'it'; 'italian'
+#''; 'farsi' # polyglossia
+ 'fi'; 'finnish'
+ 'fr'; 'french'
+ 'lo'; 'lao'
+ 'la'; 'latin'
+ 'lv'; 'latvian'
+ 'lt'; 'lithuanian'
+#''; 'lsorbian' # polyglossia
+#''; 'magyar' # polyglossia
+ 'ml'; 'malayalam'
+ 'mr'; 'marathi'
+#'hu'; 'magyar'
+ 'no'; 'norske'
+ 'nn'; 'nynorsk'
+ 'oc'; 'occitan'
+ 'pl'; 'polish'
+ 'pt'; 'portuges'
+ 'ro'; 'romanian'
+ 'ru'; 'russian'
+ 'se'; 'samin' #(check sami?)
+ 'sa'; 'sanskrit'
+ 'sr'; 'serbian'
+#''; 'scottish' # polyglossia (gd (Gaelic (Scots)))
+ 'sk'; 'slovak'
+ 'sl'; 'slovenian'
+ 'es'; 'spanish'
+ 'sv'; 'swedish'
+ 'ta'; 'tamil'
+ 'te'; 'telugu'
+ 'th'; 'thai'
+ 'tr'; 'turkish'
+ 'tk'; 'turkmen'
+ 'uk'; 'ukrainian'
+ 'ur'; 'urdu'
+#''; 'usorbian' # polyglossia
+ 'vi'; 'vietnamese'
+ 'cy'; 'welsh'
+ 'us'; 'USenglish' # depreciated, see iso-639-2
diff --git a/lib/sisu/v4/manifest.rb b/lib/sisu/v4/manifest.rb
new file mode 100644
index 00000000..9c4fceb9
--- /dev/null
+++ b/lib/sisu/v4/manifest.rb
@@ -0,0 +1,900 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: summary of generated outputs and metadata
+
+=end
+module SiSU_Manifest
+ require_relative 'sysenv' # sysenv.rb
+ include SiSU_Env
+ require_relative 'prog_text_translation' # prog_text_translation.rb
+ require_relative 'particulars' # particulars.rb
+ include SiSU_Particulars
+ require_relative 'html_minitoc' # html_minitoc.rb
+ require_relative 'html' # html.rb
+ include SiSU_HTML_Format
+ require_relative 'param' # param.rb
+ include SiSU_Param
+ require_relative 'i18n' # i18n.rb
+ include SiSU_Viz
+ 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.cmd =~/q/
+ url_html="file://#{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}"
+ @opt.cmd=~/[MVvz]/ \
+ ? SiSU_Screen::Ansi.new(@opt.cmd,'Manifest',"#{xbrowser} #{url_html}").green_hi_blue
+ : SiSU_Screen::Ansi.new(@opt.cmd,'Manifest',"[#{@opt.f_pth[:lng_is]}]", "#{url_html}").grey_title_grey_blue
+ SiSU_Screen::Ansi.new(@opt.cmd,"#{browser} #{url_html}").grey_tab if @opt.cmd =~/v/i
+ end
+ data=SiSU_HTML::Source::HTML_Environment.new(@particulars).tuned_file_instructions
+ SiSU_Manifest::Source::Output.new(@md).check_output(data)
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ SiSU_Env::CreateSite.new(@opt.cmd).cp_css
+ end
+ end
+ private
+ class Output <Source
+ 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=if @o_str.dump_or_redirect?
+ './image'
+ else
+ %{#{@f.path_rel_links.html_scroll_2}_sisu/image_sys}
+ end
+ @base_path=@f.output_path.manifest.dir
+ @@dg ||=SiSU_Env::InfoEnv.new.digest.type
+ @dg=@@dg
+ l=SiSU_Env::StandardiseLanguage.new(md.opt.lng).language
+ @language=l[:n]
+ @translate=SiSU_Translate::Source.new(md,@language)
+ @brace_url=SiSU_Viz::Defaults.new.url_decoration
+ @stylesheet=SiSU_Style::CSS_HeadInfo.new(md).stylesheet
+ 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
+ %{<br />#{@brace_url.xml_open}<a href="#{url}/#{file}">#{url}/#{file}</a>#{@brace_url.xml_close}}
+ else
+ %{<p class="tiny">#{@brace_url.xml_open}<a href="#{url}/#{file}">#{url}/#{file}</a>#{@brace_url.xml_close}</p>}
+ end
+ end
+ def summarize(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} #{id} #{kb}\n"
+ @manifest[:html] << %{<tr><th class="left"><p class="norm"><a href="#{rel}/#{file}">#{img}#{id}</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(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} #{id} #{kb}\n"
+ @manifest[:html] << %{<tr><th class="left"><p class="norm"><a href="#{rel}/#{file}">#{img}#{id}</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(id,file,pth,rel,url)
+ sys=SiSU_Env::SystemCall.new
+ dgst=(@dg =~/^sha(?:2|256)$/) \
+ ? sys.sha256("#{pth}/#{file}")
+ : sys.md5("#{pth}/#{file}")
+ SiSU_Screen::Ansi.new(@md.opt.cmd,"#{dgst[1]} #{file}").warn if @md.opt.cmd =~/[vVM]/
+ size=(File.size("#{pth}/#{file}")/1024.00).to_s
+ kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1]
+ @manifest[:txt] << "#{file} #{id} #{kb}\n"
+ @manifest[:html] << %{<tr><th class="left"><p class="norm"><a href="#{rel}/#{file}">#{id}</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|
+ if @o_str.dump_or_redirect? #does not work for --redirect or --dump
+ mp="#{@f.output_path.base.dir}"
+ mn="#{@md.fnb}.html"
+ 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"
+ mn="#{@md.fnb}.html"
+ 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"
+ mn="#{@md.fnb}.#{lc}.html"
+ mt="#{mp}/#{mn}"
+ mr=mn
+ mu="#{url}/manifest/#{mn}"
+ else
+ mp="#{@f.output_path.base.dir}/#{@md.fnb}"
+ mn="sisu_manifest.#{lc}.html"
+ 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
+ manifests
+ @m=@m.uniq
+ end
+ def languages(id,file)
+ flv=published_manifests?
+ @manifest[:html] << %{<tr><th class="left"><div id="horizontal_links"><ul id="horizontal">\n}
+ flv.each do |l|
+ lang=SiSU_Translate::Source.new(@md,@language,l[: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(id,file)
+ flv=published_manifests?
+ flv.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">#{@brace_url.xml_open}<a href="#{l[:mu]}">#{l[:mu]}</a>#{@brace_url.xml_close}</p></td><td class="right"><p class="right">&nbsp;</p></td></tr>\n}
+ end
+ end
+ def metadata(id,info)
+ info=info.to_s.gsub(/(?:#{Mx[:br_line]}|\\)+/,'<br />')
+ @manifest[:html] << %{<tr><th class="left"><p class="bold_left">#{id}:</p></th><td><p class="left">#{info}</p></td></tr>\n}
+ end
+ def links(url,lnk,target)
+ static=if url =~/^\.\// 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;#{@brace_url.xml_open}<a href="#{static}">#{static}</a>#{@brace_url.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
+ id,file='HTML, table of contents (for segmented text)',@f.base_filename.html_segtoc
+ summarize_html_seg(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
+ id,file='HTML, full length document',@f.base_filename.html_scroll
+ summarize(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
+ id,file='HTML, (book type) index',@f.base_filename.html_book_index
+ summarize(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
+ id,file='HTML, concordance file',@f.base_filename.html_concordance
+ summarize(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" /> }
+ id,file='EPUB (Electronic Publication, e-book standard)',@f.base_filename.epub
+ pth=@f.output_path.epub.dir
+ rel=@f.output_path.epub.rel_sm
+ url=@f.output_path.epub.url
+ summarize(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
+ id,file="PDF, U.S. letter size, portrait/vertical document (recommended for printing)","#{@f.base_filename.pdf_p_letter}"
+ summarize(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
+ id,file="PDF, U.S. letter size, landscape/horizontal document (recommended for screen viewing)","#{@f.base_filename.pdf_l_letter}"
+ summarize(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
+ id,file="PDF, A4 size, portrait/vertical document (recommended for printing)","#{@f.base_filename.pdf_p_a4}"
+ summarize(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
+ id,file="PDF, A4 size, landscape/horizontal document (recommended for screen viewing)","#{@f.base_filename.pdf_l_a4}"
+ summarize(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
+ id,file="PDF, A5 (book) size, portrait/vertical document (recommended for printing)","#{@f.base_filename.pdf_p_a5}"
+ summarize(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
+ id,file="PDF, A5 (book) size, landscape/horizontal document (recommended for screen viewing)","#{@f.base_filename.pdf_l_a5}"
+ summarize(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
+ id,file="PDF, B5 (book) size, portrait/vertical document (recommended for printing)","#{@f.base_filename.pdf_p_b5}"
+ summarize(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
+ id,file="PDF, B5 (book) size, landscape/horizontal document (recommended for screen viewing)","#{@f.base_filename.pdf_l_b5}"
+ summarize(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
+ id,file="PDF, U.S. legal size, portrait/vertical document (recommended for printing)","#{@f.base_filename.pdf_p_legal}"
+ summarize(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
+ id,file="PDF, U.S. legal size, landscape/horizontal document (recommended for screen viewing)","#{@f.base_filename.pdf_l_legal}"
+ summarize(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
+ id,file='ODF:ODT (Open Document Format)',@f.base_filename.odt
+ summarize(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
+ id,file='ODF:ODT (Open Document Format)',@f.base_filename.odt
+ id,file='XHTML',@f.base_filename.xhtml
+ summarize(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
+ id,file='XML SAX',@f.base_filename.xml_sax
+ summarize(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
+ id,file='XML DOM',@f.base_filename.xml_dom
+ summarize(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
+ id,file='Info file',@f.base_filename.info
+ summarize(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
+ id,file='Manpage',@f.base_filename.manpage
+ summarize(id,file,pth,rel,url)
+ end
+ if FileTest.file?(@f.place_file.sqlite_discreet.dir)==true
+ id,file='SQLite3 file',@f.base_filename.sqlite_discreet
+ pth=@f.output_path.sqlite_discreet.dir
+ rel=@f.output_path.sqlite_discreet.rel_sm
+ url=@f.output_path.sqlite_discreet.url
+ summarize(id,file,pth,rel,url)
+ end
+ if FileTest.file?(@f.place_file.txt.dir)==true
+ id=if @md.opt.cmd =~/a/ then 'Plaintext (Unix (UTF-8) with footnotes)'
+ elsif @md.opt.cmd =~/e/ then 'Plaintext (Unix (UTF-8) with endnotes)'
+ elsif @md.opt.cmd =~/A/ then 'Plaintext (dos (UTF-8) with footnotes)'
+ elsif @md.opt.cmd =~/E/ then 'Plaintext (dos (UTF-8) with endnotes)'
+ else 'Plaintext (UTF-8)'
+ end
+ 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(id,file,pth,rel,url)
+ end
+ if FileTest.file?("#{@base_path}/#{@md.fns}.tex")==true
+ id,file='LaTeX (portrait)',"#{@md.fns}.tex"
+ pth,rel,url='','',''
+ summarize(id,file,pth,rel,url)
+ end
+ if FileTest.file?("#{@base_path}/#{@md.fns}.tex")==true
+ id,file='LaTeX (landscape)',"#{@md.fns}.landscape.tex"
+ pth,rel,url='','',''
+ summarize(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
+ id,file="Digest/DCC - Document Content Certificate (#{@dg})",@f.base_filename.hash_digest
+ summarize(id,file,pth,rel,url)
+ end
+ end
+ def published_versions
+ id,file='Markup (SiSU source)',@md.fns
+ languages(id,file)
+ end
+ def language_versions
+ if FileTest.file?(@f.place_file.manifest.dir)==true
+ id,file='Markup (SiSU source)',@md.fns
+ published_languages(id,file)
+ end
+ end
+ def qrc_image
+ fn=@md.fnb
+ pth=(@o_str.dump_or_redirect?) \
+ ? '.'
+ : 'qrcode'
+ img_md="#{pth}/#{fn}.md.png"
+ img_title="#{pth}/#{fn}.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
+ id,file='Markup Composite File (SiSU source)',@f.base_filename.src
+ summarize_sources(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
+ id,file='Markup (SiSU source)',@f.base_filename.src
+ summarize_sources(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.ab_pod
+ url=@f.output_path.sisupod.url
+ id,file='SiSU doc (tar.xz)',@f.base_filename.sisupod
+ summarize_sources(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
+ id,file='SiSU pot',@f.base_filename.pot
+ summarize_sources(id,file,pth,rel,url)
+ end
+ end
+ def metadata_tests
+ if defined? @md.title #%
+ if defined? @md.title.full \
+ and @md.title.full=~/\S+/
+ id,info=@translate.full_title,@md.title.full
+ metadata(id,info)
+ end
+ end
+ if defined? @md.creator #%
+ if defined? @md.creator.author \
+ and @md.creator.author=~/\S+/
+ id,info=@translate.author,@md.creator.author
+ metadata(id,info)
+ end
+ if defined? @md.creator.editor \
+ and @md.creator.editor=~/\S+/
+ id,info=@translate.editor,@md.creator.editor
+ metadata(id,info)
+ end
+ if defined? @md.creator.contributor \
+ and @md.creator.contributor=~/\S+/
+ id,info=@translate.contributor,@md.creator.contributor
+ metadata(id,info)
+ end
+ if defined? @md.creator.translator \
+ and @md.creator.translator=~/\S+/
+ id,info=@translate.translator,@md.creator.translator
+ metadata(id,info)
+ end
+ if defined? @md.creator.illustrator \
+ and @md.creator.illustrator=~/\S+/
+ id,info=@translate.illustrator,@md.creator.illustrator
+ metadata(id,info)
+ end
+ if defined? @md.creator.prepared_by \
+ and @md.creator.prepared_by=~/\S+/
+ id,info=@translate.prepared_by,@md.creator.prepared_by
+ metadata(id,info)
+ end
+ if defined? @md.creator.digitized_by \
+ and @md.creator.digitized_by=~/\S+/
+ id,info=@translate.digitized_by,@md.creator.digitized_by
+ metadata(id,info)
+ end
+ end
+ if defined? @md.rights
+ if defined? @md.rights.all \
+ and @md.rights.all=~/\S+/ #dc
+ id,info=@translate.rights,@md.rights.all
+ metadata(id,info)
+ end
+ end
+ if defined? @md.date #%
+ if defined? @md.date.published \
+ and @md.date.published=~/\S+/ #dc
+ id,info=@translate.date,@md.date.published
+ metadata(id,info)
+ end
+ if defined? @md.date.created \
+ and @md.date.created=~/\S+/ #dc
+ id,info=@translate.date_created,@md.date.created
+ metadata(id,info)
+ end
+ if defined? @md.date.issued \
+ and @md.date.issued=~/\S+/ #dc
+ id,info=@translate.date_issued,@md.date.issued
+ metadata(id,info)
+ end
+ if defined? @md.date.available \
+ and @md.date.available=~/\S+/ #dc
+ id,info=@translate.date_available,@md.date.available
+ metadata(id,info)
+ end
+ if defined? @md.date.modified \
+ and @md.date.modified=~/\S+/ #dc
+ id,info=@translate.date_modified,@md.date.modified
+ metadata(id,info)
+ end
+ if defined? @md.date.valid \
+ and @md.date.valid=~/\S+/ #dc
+ id,info=@translate.date_valid,@md.date.valid
+ metadata(id,info)
+ end
+ end
+ if defined? @md.publisher \
+ and @md.publisher=~/\S+/ #dc
+ id,info=@translate.publisher,@md.publisher
+ metadata(id,info)
+ end
+ if defined? @md.notes #%
+ if defined? @md.notes.description \
+ and @md.notes.description=~/\S+/
+ id,info=@translate.description,@md.notes.description
+ metadata(id,info)
+ end
+ if defined? @md.notes.abstract \
+ and @md.notes.abstract=~/\S+/
+ id,info=@translate.abstract,@md.notes.abstract
+ metadata(id,info)
+ end
+ if defined? @md.notes.comment \
+ and @md.notes.comment=~/\S+/
+ id,info=@translate.comments,@md.notes.comment
+ metadata(id,info)
+ end
+ if defined? @md.notes.prefix_a \
+ and @md.notes.prefix_a=~/\S+/
+ id,info=@translate.prefix_a,@md.notes.prefix_a
+ metadata(id,info)
+ end
+ if defined? @md.notes.prefix_b \
+ and @md.notes.prefix_b=~/\S+/
+ id,info=@translate.prefix_b,@md.notes.prefix_b
+ metadata(id,info)
+ end
+ end
+ if defined? @md.title #%
+ if defined? @md.title.language \
+ and @md.title.language=~/\S+/
+ id,info=@translate.language,@md.title.language
+ metadata(id,info)
+ end
+ if defined? @md.original.language \
+ and @md.original.language=~/\S+/
+ id,info=@translate.language_original,@md.original.language
+ metadata(id,info)
+ end
+ end
+ if defined? @md.classify #%
+ if defined? @md.topic_register_array \
+ and @md.topic_register_array.length > 0
+ @manifest[:html] << %{<tr><th class="left"><p class="bold_left">#{@translate.topic_register}:</p></th><td>\n}
+ @md.topic_register_array.each do |t|
+ t.each_with_index do |st,i|
+ if st.is_a?(Array)
+ st.each do |v|
+ if v.is_a?(Array)
+ v.each do |w,i|
+ @manifest[:html] << %{<p class="it#{i}">#{w}</p>\n}
+ end
+ else
+ @manifest[:html] << %{<p class="it#{i}">#{v}</p>\n}
+ end
+ 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+/
+ id,info=@translate.subject,@md.classify.subject
+ metadata(id,info)
+ end
+ if defined? @md.classify.keywords \
+ and @md.classify.keywords=~/\S+/
+ id,info=@translate.keywords,@md.classify.keywords
+ metadata(id,info)
+ end
+ if defined? @md.classify.loc \
+ and @md.classify.loc=~/\S+/
+ id,info=@translate.cls_loc,@md.classify.loc
+ metadata(id,info)
+ end
+ if defined? @md.classify.dewey \
+ and @md.classify.dewey=~/\S+/
+ id,info=@translate.cls_dewey,@md.classify.dewey
+ metadata(id,info)
+ end
+ if defined? @md.notes.coverage \
+ and @md.notes.coverage=~/\S+/
+ id,info=@translate.coverage,@md.notes.coverage
+ metadata(id,info)
+ end
+ if defined? @md.notes.relation \
+ and @md.notes.relation=~/\S+/
+ id,info=@translate.relation,@md.notes.relation
+ metadata(id,info)
+ end
+ if defined? @md.notes.type \
+ and @md.notes.type=~/\S+/ #dc
+ id,info=@translate.type,@md.notes.type
+ metadata(id,info)
+ end
+ if defined? @md.notes.format \
+ and @md.notes.format=~/\S+/
+ id,info=@transate.format,@md.notes.format
+ metadata(id,info)
+ end
+ end
+ if defined? @md.identifier #%
+ if defined? @md.identifier.oclc \
+ and @md.identifier.oclc=~/\S+/
+ id,info=@translate.cls_oclc,@md.identifier.oclc
+ @manifest[:html] << %{<tr><th class="left"><p class="bold_left">#{id}:</p></th><td>\n}
+ @manifest[:html] << %{<p class="left"><a href="http://worldcat.org/oclc/#{info}">#{info}</a></p>\n}
+ @manifest[:html] << %{</td></tr>\n}
+ end
+ if defined? @md.identifier.pg \
+ and @md.identifier.pg=~/\S+/
+ id,info=@translate.cls_gutenberg,@md.identifier.pg
+ metadata(id,info)
+ end
+ if defined? @md.identifier.isbn \
+ and @md.identifier.isbn=~/\S+/
+ id,info=@translate.cls_isbn,@md.identifier.isbn
+ metadata(id,info)
+ end
+ end
+ if defined? @md.original.source \
+ and @md.original.source=~/\S+/
+ id,info=@translate.source,@md.original.source
+ metadata(id,info)
+ end
+ if @md.fns
+ id,info=@translate.sourcefile,@md.fns
+ metadata(id,info)
+ end
+ if @md.en[:mismatch] > 0
+ id,info='WARNING document error in endnote markup, number mismatch',"endnotes: #{@md.en[:note]} != endnote reference marks: #{@md.en[:mark]} (difference = #{@md.en[:mismatch]})"
+ metadata(id,info)
+ end
+ if @md.wc_words
+ id,info=@translate.word_count,@md.wc_words
+ metadata(id,info)
+ end
+ if @md.dgst
+ id,info="#{@translate.sourcefile_digest} (#{@dg})",@md.dgst[1]
+ metadata(id,info)
+ end
+ if @md.sc_number
+ id,info=@translate.sc_number,@md.sc_number
+ metadata(id,info)
+ end
+ if @md.sc_date
+ id,info=@translate.sc_date,"#{@md.sc_date} at #{@md.sc_time}"
+ metadata(id,info)
+ end
+ if @md.generated
+ id,info=@translate.last_generated,@md.generated
+ metadata(id,info)
+ end
+ if @md.sisu_version
+ id,info=@translate.sisu_version,"#{@md.sisu_version[:project]} #{@md.sisu_version[:version]} #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})"
+ metadata(id,info)
+ end
+ if @md.ruby_version
+ id,info=@translate.ruby_version,@md.ruby_version
+ metadata(id,info)
+ end
+ end
+ def links_tests
+ if defined? @md.lnk \
+ and @md.lnk
+ @md.lnk.each do |l|
+ if defined? l[:say]
+ target=(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
+ minitoc=SiSU_HTML_MiniToc::TocMini.new(@md,data).songsheet.join("\n")
+ id,file='',''
+ vz=SiSU_Viz::Defaults.new
+ search_form=if @f.build.search_form?
+ "<td>#{@env.widget_static.search_form}</td>"
+ else ''
+ end
+ format_head_toc=SiSU_HTML_Format::HeadToc.new(@md)
+ @manifest[:html] <<<<WOK
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>
+SiSU manifest: #{@md.title.full}
+</title>
+<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
+<meta name="sourcefile" content="#{@md.fns}" />
+<link rel="generator" href="http://www.jus.uio.no/sisu" />
+<link rel="shortcut icon" href="#{@f.path_rel_links.html_scroll_css}_sisu/image_sys/rb7.ico" />
+#{@stylesheet.css_head}
+</head>
+<body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en">
+#{format_head_toc.seg_head_navigation_band(:manifest)}
+WOK
+ if @f.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
+ @manifest[:html] <<<<WOK
+<h1 class="small">#{@translate.manifest_description}</h1>
+<h2 class="small">#{@md.title.full}</h2>
+<p class="bold">#{@md.author}</p>
+<p class="small">
+&nbsp;&nbsp;<a href="#output">Document, Available Filetypes</a>
+</p>
+<p class="small">
+&nbsp;&nbsp;<a href="#metadata">Document Metadata</a>
+</p>
+<p class="tiny">
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#links">metadata suggested links (if any)</a>
+</p>
+<table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">
+WOK
+ published_versions
+ @manifest[:html] << '</table>'
+ @manifest[:html] <<<<WOK
+<h2 class="small"><a name="output">#{@translate.manifest_description_output}</a></h2>
+<table summary="available output/filetypes" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">
+<tr> <th class="left"><p class="bold">#{@translate.filetype_description}</p></th><th class="left"><p class="bold">#{@translate.filename}</p></th><th class="right"><p class="right"><b>#{@translate.file_size}</b></p><p class="tiny_right">(kB)</p></th></tr>
+
+WOK
+ output_tests
+ @manifest[:html] << '</table>'
+ @manifest[:html] <<<<WOK
+<table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">
+WOK
+ source_tests
+ @manifest[:html] << '</table>'
+ @manifest[:html] <<<<WOK
+<h2 class="small"><a name="metadata">#{@translate.manifest_description_metadata}</a></h2>
+<table summary="document metadata" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">
+<tr> <th class="left"><p class="bold">#{@translate.metadata}</p></th><th class="left"><p class="bold">#{@translate.description}</p></th></tr>
+WOK
+ metadata_tests
+ @manifest[:html] <<<<WOK
+</table>
+WOK
+ @manifest[:html] <<<<WOK
+<p class="bold"><a name="links">#{@translate.suggested_links}:</a></p>
+<table summary="suggested links" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">
+WOK
+ links_tests
+ @manifest[:html] <<<<WOK
+</table>
+WOK
+ @manifest[:html] <<<<WOK
+<h2 class="small"><a name="languages">#{@translate.language_version_list}</a></h2>
+<table summary="language versions" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">
+<tr> <th class="left"><p class="bold">#{@translate.filename}</p></th><th class="left"><p class="bold">#{@translate.description}</p></th><th class="right"><p class="right">&nbsp;</p></th></tr>
+
+WOK
+ language_versions
+ qrc_image
+ @manifest[:html] <<<<WOK
+</table>
+</div>
+<div>
+<br />
+#{vz.credits_sisu_manifest}
+</div>
+</body>
+</html>
+WOK
+ output
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ end
+ end
+ end
+ end
+end
+__END__
diff --git a/lib/sisu/v4/manpage.rb b/lib/sisu/v4/manpage.rb
new file mode 100644
index 00000000..34df23cd
--- /dev/null
+++ b/lib/sisu/v4/manpage.rb
@@ -0,0 +1,435 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: manpage text generation, stripped manpage output (unix,
+ linefeed)
+
+=end
+module SiSU_Manpage
+ require_relative 'dal' # dal.rb
+ require_relative 'sysenv' # sysenv.rb
+ include SiSU_Env
+ include SiSU_Param
+ include SiSU_Viz
+ require_relative 'manpage_format' # manpage_format.rb
+ include SiSU_ManpageFormat
+ require_relative 'shared_metadata' # shared_metadata.rb
+ require_relative 'shared_txt' # shared_txt.rb
+ pwd=Dir.pwd
+ @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0
+ @@tablefoot=''
+ class Source
+ def initialize(opt)
+ @opt=opt
+ if @opt.fns =~/(.+?)\.(?:-|ssm\.)?sst$/
+ @@dostype='unix endnotes'
+ else puts "#{sf} not a processed file type"
+ end
+ end
+ def read
+ begin
+ @md=SiSU_Param::Parameters.new(@opt).get
+ @env=SiSU_Env::InfoEnv.new(@opt.fns)
+ path=@env.path.output_tell
+ tool=(@opt.cmd =~/[MVv]/) \
+ ? "#{@env.program.text_editor} #{@md.file.output_path.manpage.dir}/#{@md.file.base_filename.manpage}"
+ : "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}"
+ @opt.cmd=~/[MVvz]/ \
+ && @opt.cmd !~/q/ \
+ ? SiSU_Screen::Ansi.new(@opt.cmd,'Manpage',tool).green_hi_blue
+ : SiSU_Screen::Ansi.new(@opt.cmd,'Manpage',tool).green_title_hi
+ SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@md.file.output_path.manpage.dir}/#{@md.file.base_filename.manpage}").flow if @opt.cmd =~/[MV]/
+ @dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here
+ SiSU_Manpage::Source::Scroll.new(@md,@dal_array).songsheet
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ end
+ end
+ private
+ class Scroll <Source
+ require_relative 'defaults' # defaults.rb
+ require_relative 'shared_txt' # shared_txt.rb
+ include SiSU_TextUtils
+ @@endnotes={ para: [], end: [] }
+ def initialize(md,data)
+ @md,@data=md,data
+ @brace_url=SiSU_Viz::Defaults.new.url_decoration
+ @vz=SiSU_Viz::Defaults.new
+ @tab="\t"
+ @br="\n"
+ @@dostype='unix endnotes'
+ @manpage={ body: [], open: [], close: [], head: [], metadata: [], tail: [], endnotes: [] }
+ end
+ def songsheet
+ manpage=markup(@data)
+ publish(manpage)
+ end
+ # Used for extraction of endnotes from paragraphs
+ def extract_endnotes(para='')
+ notes=para.scan(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})([\d*+]+\s+.+?)\s*(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m)
+ @n=[]
+ notes.flatten.each do |n| #high cost to deal with <br> appropriately within manpage, consider
+ n=n.dup.to_s
+ if n =~/#{Mx[:br_line]}/
+ fix = n.split(/\s*#{Mx[:br_line]}+\s*/) #watch #added
+ fix.each do |x|
+ unless x.empty?; @n << x
+ end
+ end
+ else @n << n
+ end
+ end
+ notes=@n.flatten
+ notes.each do |e|
+ util=(e.to_s =~/^\[[\d*+]+\]:/) \
+ ? (SiSU_TextUtils::Wrap.new(e.to_s,78,4,1))
+ : (SiSU_TextUtils::Wrap.new(e.to_s,78,0,1))
+ wrap=util.line_wrap
+ wrap=if wrap =~ /^\s*[\d*+]+\s+.+?\s*\Z/m
+ wrap.gsub(/(^|&nbsp;|#{Mx[:nbsp]}|\s|\*)\\\*/,'\1\\\\\*'). #man page requires
+ gsub(/\s\.(\S+)/,' \\.\1').
+ gsub(/^\s*([\d*+]+)\s+(.+?)\s*\Z/m, <<GSUB
+.TP
+.BI \\1.
+\\2
+GSUB
+ )
+ else
+ wrap.gsub(/^\s*(.+)\Z/m, <<GSUB
+\\1
+GSUB
+ )
+ end
+ @@endnotes[:para] << wrap
+ @@endnotes[:end] << wrap << "\n.br"
+ @@endnotes
+ end
+ end
+ def manpage_metadata
+ @manpage[:metadata]=SiSU_Metadata::Summary.new(@md).manpage.metadata
+ end
+ def manpage_tail
+ vz=SiSU_Viz::Defaults.new
+ generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version]
+ lastdone="Last Generated on: #{Time.now}"
+ rubyv="Ruby version: #{@md.ruby_version}"
+ sc=if @md.sc_info
+ "Source file: #{@md.sc_filename}#{@br}Version number: #{@md.sc_number}#{@br}Version date: #{@md.sc_date}#{@br}"
+ else ''
+ end
+ @manpage[:tail] <<<<WOK
+#{@br}
+.TP
+.SH SEE ALSO
+ sisu(1),
+ sisu-epub(1),
+ sisu-harvest(1),
+ sisu-html(1),
+ sisu-odf(1),
+ sisu-pdf(1),
+ sisu-pg(1),
+ sisu-sqlite(1),
+ sisu-txt(1).
+ sisu_vim(7)
+.TP
+.SH HOMEPAGE
+ More information about SiSU can be found at <http://www.sisudoc.org/> or <http://www.jus.uio.no/sisu/>
+.TP
+.SH SOURCE
+ <http://sources.sisudoc.org/>
+.TP
+.SH AUTHOR
+ SiSU is written by Ralph Amissah <ralph@amissah.com>
+WOK
+ end
+ def manpage_structure(dob='',hname='') #% Used to extract the structure of a document
+ if dob.is==:heading
+ lv=dob.ln
+ n=dob.ln - 1
+ n3=dob.ln + 2
+ else lv=nil
+ end
+ wrapped=if dob.is==:para \
+ || dob.is==:heading
+ paragraph=dob.obj
+ if dob.is==:para
+ if dob.indent =~/[1-9]/ \
+ and dob.indent == dob.hang
+ util=if dob.bullet_
+ SiSU_TextUtils::Wrap.new("* #{paragraph}",78,dob.indent.to_i*2)
+ else SiSU_TextUtils::Wrap.new(paragraph,78,dob.indent.to_i*2)
+ end
+ elsif dob.hang =~/[0-9]/ \
+ and dob.indent != dob.hang # NOT yet implemented
+ util=SiSU_TextUtils::Wrap.new(paragraph,78,dob.indent.to_i*2)
+ else
+ util=if dob.bullet_
+ SiSU_TextUtils::Wrap.new("* #{paragraph}",78,0)
+ else SiSU_TextUtils::Wrap.new(paragraph,78,0)
+ end
+ end
+ else util=SiSU_TextUtils::Wrap.new(paragraph,78,0)
+ end
+ w=util.line_wrap
+ w=w.gsub(/^(\\\.)/,' \1')
+ w
+ end
+ if lv
+ times=wrapped.length
+ times=78 if times > 78
+ @manpage[:body] << case lv
+ when 1; '.SH ' << wrapped.upcase << @br << '.br'
+ when 2..3; '.SH ' << wrapped.upcase << @br << '.br'
+ when 4; '.SH ' << wrapped.upcase << @br << '.br'
+ when 5..6; '.SH ' << wrapped.upcase << @br
+ end
+ else
+ @manpage[:body] << if wrapped =~/^\.BI\s/ # main text, contents, body KEEP
+ '.TP' << @br << wrapped.gsub(/^\.BI\s/,'.B ') # sleight ... simpler output (check gsub!)
+ else
+ '.br' << @br << wrapped
+ end
+ end
+ if @@endnotes[:para] \
+ and @@dostype =~/footnote/ #edit out to switch off endnotes following paragraph to which they belong
+ @manpage[:body] << @br
+ @@endnotes[:para].each { |e| @manpage[:body] << e << @br }
+ elsif @@endnotes[:para] \
+ and @@dostype =~/endnote/
+ @manpage[:body] << @br*2
+ end
+ @@endnotes[:para]=[]
+ end
+ def markup(data) # Used for major markup instructions
+ dir=SiSU_Env::InfoEnv.new(@md.fns)
+ @data_mod,@endnotes,@level,@cont,@copen,@manpage_contents_close=Array.new(6){[]}
+ (0..6).each { |x| @cont[x]=@level[x]=false }
+ (4..6).each { |x| @manpage_contents_close[x]='' }
+ #manpage_tail #stop call
+ table_message='[table omitted, see other document formats]'
+ fix=[]
+ #manpage_metadata
+ data.each do |dob|
+ if dob.is==:comment \
+ || dob.is==:heading_insert
+ dob.obj=''
+ end
+ dob.obj=dob.obj.gsub(/.+?<-#>/,''). # remove dummy headings (used by html) #check
+ gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'^\1^').
+ gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'[\1]').
+ gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'++\1++').
+ gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'--\1--').
+ gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'"\1"').
+ gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'\1').
+ gsub(/\A\s*#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}#{Mx[:br_line]}([,.:!?](?: |$))?/m,"#{Mx[:br_line]}.I \\1\\2#{Mx[:br_line]}").
+ gsub(/\s*#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}([,.:!?](?: |$))?/m,"#{Mx[:br_line]}.I \\1\\2#{Mx[:br_line]}").
+ gsub(/\A\s*#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}([,.:!?](?: |$))?#{Mx[:br_line]}/m,"#{Mx[:br_line]}.BI \\1\\2#{Mx[:br_line]}").
+ gsub(/\s*#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}([,.:!?](?: |$))?/,"#{Mx[:br_line]}.B \\1\\2#{Mx[:br_line]}").
+ gsub(/\s*#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}([,.:!?](?: |$))?/,"#{Mx[:br_line]}.I \\1\\2#{Mx[:br_line]}")
+ unless dob.is==:code
+ dob.obj=dob.obj.gsub(/(?:^|\s)#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}([,.:!?](?: |$))?/,"\\1 #{@brace_url.txt_open}\\2#{@brace_url.txt_close}\\3").
+ gsub(/(^|#{Mx[:gl_c]}|\s)#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}([,.:!?](?: |$))?/,"\\1#{@brace_url.txt_open}\\2#{@brace_url.txt_close}\\3")
+ @manpage[:endnotes]=extract_endnotes(dob.obj)
+ dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}([\d*+]+)\s*(?:.+?)#{Mx[:en_a_c]}/m,'[^\1]'). # endnote marker marked up
+ gsub(/#{Mx[:en_b_o]}([\d*+]+)\s*(?:.+?)#{Mx[:en_b_c]}/m,'[^\1]'). # endnote marker marked up
+ gsub(/#{Mx[:gl_o]}#amp#{Mx[:gl_c]}/,'&'). ##{Mx[:gl_o]}#095#{Mx[:gl_c]}
+ gsub(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!').
+ gsub(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#').
+ gsub(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*').
+ gsub(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-').
+ gsub(/#{Mx[:gl_o]}#092#{Mx[:gl_c]}/,'\e').
+ gsub(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/').
+ gsub(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_').
+ gsub(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{').
+ gsub(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}').
+ gsub(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~').
+ gsub(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'©')
+ else
+ dob.obj=dob.obj.gsub(/\\/,'\e').
+ gsub(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*/,"\n\n") # watch
+ #dob.obj.gsub!(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})+\s*/,"\n") # watch
+ end
+ dob.obj=dob.obj.gsub(/(^|&nbsp;|#{Mx[:nbsp]}|\s|\*)\\\*/,'\1\\\\\*'). #man page requires
+ gsub(/┆/,'|').
+ gsub(/\s\.(\S+)/,' \\.\1').
+ gsub(/(\n\.)(\S\S\S+)/m,'\1\\.\2').
+ gsub(/-/,'\-') #manpages use this
+ dob.obj=dob.obj.gsub(/&#126;/,'~') if dob.obj #manpages use this
+ if dob.is =~/block|group|verse|alt|code/
+ if dob.is ==:code
+ dob.obj=dob.obj.gsub(/(^|[^}])_([<>])/m,'\1\2'). # _> _<
+ gsub(/(^|[^}])_([<>])/m,'\1\2'). # _<_<
+ gsub(/\A(.+)?\Z/m,".nf\n\n\\1\n\n.fi")
+ end
+ end
+ #dob.obj.gsub!(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})+\s*/m,"\n.br\n") # watch
+ dob.obj=dob.obj.gsub(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})+\s*/m,"\n\n") # watch
+ blit=dob.obj.scan(/\[[^\]]+\]|[^\[]+/)
+ blit_array=[]
+ blit.each do |x|
+ x=if x =~/^\[/
+ x.gsub(/\s+/,' \ ') #manpages use this
+ else x
+ end
+ blit_array << x
+ end
+ dob.obj=blit_array.join
+ dob.obj=dob.obj.gsub(/#{Mx[:gl_o]}:name#\S+?#{Mx[:gl_c]}/mi,''). #added
+ #gsub(/\s\\\s+(#{Mx[:br_line]}|#{Mx[:br_nl]})/,'\1'). #a messy solution
+ gsub(/#{Mx[:br_page]}\s*|#{Mx[:br_page_new]}/,''). # remove page breaks
+ gsub(/(^|#{Mx[:gl_c]}|\s)#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1\2').
+ gsub(/<a href=".+?">(.+?)<\/a>/m,'\1').
+ gsub(/#{Mx[:mk_o]}name#\S+?#{Mx[:mk_c]}/,''). # remove name links
+ gsub(/&nbsp;|#{Mx[:nbsp]}/,' '). # decide on
+ gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,' [ \1 ]'). #"[ #{dir.url.images_local}\/\\1 ]")
+ gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}image/,' [ \1 ]'). #"[ #{dir.url.images_local}\/\\1 ]")
+ gsub(/^(?:^|[^_\\])#{Mx[:lnk_o]}\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*#{Mx[:lnk_c]}\S+/,'[image: "\1"]')
+ wordlist=dob.obj.scan(/\S+/)
+ if dob.obj !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/
+ if dob.obj =~@regx #/.+?<~\d+;\w\d+;\w\d+>.*/ #watch change
+ paranum=dob.obj[@regx,3]
+ @p_num=SiSU_ManpageFormat::ParagraphNumber.new(paranum)
+ end
+ x=SiSU_ManpageFormat::FormatTextObject.new(@md,dob)
+ if dob.is==:heading
+ manpage_structure(dob)
+ dob.obj=case dob.ln
+ when 1; x.heading_body1
+ when 2; x.heading_body2
+ when 3; x.heading_body3
+ when 4; x.heading_body4
+ when 5; x.heading_body5
+ when 6; x.heading_body6
+ end
+ elsif dob.is==:para
+ manpage_structure(dob)
+ else
+ if dob.obj =~/#{table_message}/
+ @manpage[:body] << dob.obj << @br
+ end
+ end
+ if (dob.obj =~/<a name="n\d+">/ \
+ and dob.obj =~/^(-\{{2}~\d+|<!e[:_]\d+!>)/) # -endnote
+ dob.obj=''
+ end
+ if dob.obj
+ dob.obj=dob.obj.gsub(/\s(\[)/m,' \ \1').
+ gsub(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*/,"\n\n"). # watch
+ gsub(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~').
+ gsub(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{').
+ gsub(/#{Mx[:pa_o]}\S+#{Mx[:pa_c]}/,' ')
+ unless dob.is ==:code
+ dob.obj=dob.obj.gsub(/<!.+!>/,' ').
+ gsub(/<:\S+>/,' ')
+ end
+ end
+ dob
+ end
+ end
+ @manpage
+ end
+ def publish(manpage)
+ divider='='
+ content=[]
+ date=if defined? @md.date.modified \
+ and @md.date.modified
+ @md.date.modified
+ elsif defined? @md.date.published \
+ and @md.date.published
+ @md.date.published
+ else SiSU_Env::InfoDate.new.year #date missing decide on action
+ end
+ manpage_name,manpage_synopsis='',''
+ manpg={}
+ proj=SiSU_Env::InfoVersion.instance.get_version
+ manpage[:open] = %{.TH "#{@md.fnb}" "#{@md.make.manpage['section']}" "#{date}" "#{proj[:version]}" "#{@md.title.main}"#{@md.make.manpage['name']}#{@md.make.manpage['synopsis']}}
+ content << manpage[:open]
+ content << manpage[:head]
+ content << manpage[:body]
+ content << @@endnotes[:end] if @@dostype =~/endnotes/
+ content << manpage[:metadata]
+ content << manpage[:tail]
+ Output.new(@md,content).manpage
+ @@endnotes={ para: [], end: [] }
+ end
+ end
+ class Output <Source
+ include SiSU_Param
+ include SiSU_Env
+ def initialize(md,content)
+ @md,@content=md,content
+ end
+ def manpage #%manpage output
+ SiSU_Env::FileOp.new(@md).mkdir
+ filename_manpage=SiSU_Env::FileOp.new(@md).write_file.manpage
+ @sisu=[]
+ @content.each do |para| # this is a hack
+ if para.is_a?(Array) \
+ and para.length > 0
+ para.each do |line|
+ line=line.gsub(/\s+$/m,'')
+ filename_manpage.puts line #unix manpage
+ end
+ else filename_manpage.puts para #unix manpage # /^([*=-]|\.){5}/
+ end
+ end
+ filename_manpage.close
+ end
+ end
+ end
+end
+__END__
diff --git a/lib/sisu/v2/manpage_format.rb b/lib/sisu/v4/manpage_format.rb
index 98428c4a..57edaeb5 100644
--- a/lib/sisu/v2/manpage_format.rb
+++ b/lib/sisu/v4/manpage_format.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -56,11 +55,11 @@
** Description: manpage formatting template
=end
-module SiSU_Manpage_format
- require "#{SiSU_lib}/param" # param.rb
+module SiSU_ManpageFormat
+ require_relative 'param' # param.rb
include SiSU_Param
include SiSU_Viz
- class Paragraph_number
+ class ParagraphNumber
def initialize(paranum)
@paranum=/(\d+)/m.match(paranum)[1]
end
@@ -74,17 +73,12 @@ module SiSU_Manpage_format
@paranum.gsub(/(\d+)/,'<a href="#\1">')
end
end
- class Format_text_object
+ class FormatTextObject
def initialize(md,dob)
@md,@dob=md,dob
-if @dob.class==Hash
- puts __FILE__ + ' ' + __LINE__.to_s #+ "-->\n" + caller.inspect
-elsif @dob.class==String
- puts __FILE__ + ' ' + __LINE__.to_s #+ "-->\n" + caller.inspect
-end
rgx=/#{Mx[:en_a_o]}[\d*+]+\s+(.+?)#{Mx[:en_a_c]}/
@dob.obj.gsub!(rgx,'\1') if @dob.obj =~rgx
- @vz=SiSU_Env::Get_init.instance.skin
+ @vz=SiSU_Viz::Defaults.new
end
def scr_endnote_body
"<endnote>#{@dob.obj}</endnote> "
diff --git a/lib/sisu/v4/odf.rb b/lib/sisu/v4/odf.rb
new file mode 100644
index 00000000..7e4e807c
--- /dev/null
+++ b/lib/sisu/v4/odf.rb
@@ -0,0 +1,818 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: opendocument text generation
+
+=end
+module SiSU_ODF
+ require_relative 'particulars' # particulars.rb
+ include SiSU_Particulars
+ require_relative 'dal' # dal.rb
+ require_relative 'sysenv' # sysenv.rb
+ include SiSU_Env
+ include SiSU_Viz
+ require_relative 'odf_format' # odf_format.rb
+ include SiSU_ODF_Format
+ require_relative 'shared_metadata' # shared_metadata.rb
+ require_relative 'shared_txt' # shared_txt.rb
+ @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0
+ class Source
+ require 'zlib'
+ require 'find'
+ def initialize(opt)
+ @opt=opt
+ @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)
+ @@endnotes_para=[]
+ end
+ def read
+ begin
+ @md,@env,@dal_array=@particulars.md,@particulars.env,@particulars.dal_array
+ unless @opt.cmd =~/q/
+ tool=(@opt.cmd =~/[MVv]/) \
+ ? "#{@env.program.odf_viewer} file://#{@md.file.output_path.odt.dir}/#{@md.file.base_filename.odt}"
+ : "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}"
+ @opt.cmd=~/[MVvz]/ \
+ ? SiSU_Screen::Ansi.new(@opt.cmd,'Opendocument (ODF:ODT)',tool).green_hi_blue
+ : SiSU_Screen::Ansi.new(@opt.cmd,'Opendocument (ODF:ODT)',tool).green_title_hi
+ SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"file://#{@md.file.output_path.odt.dir}/#{@md.file.base_filename.odt}").flow if @opt.cmd =~/[MV]/
+ end
+ SiSU_ODF::Source::Scroll.new(@particulars).songsheet
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ end
+ end
+ private
+ class Scroll <Source
+ require_relative 'defaults' # defaults.rb
+ require_relative 'shared_txt' # shared_txt.rb
+ @@img_count=0
+ @@odf={ body: [], head: [], toc: [], metadata: [], tail: [], book_idx: [], endnotes: [] }
+ @@docstart=true
+ @@fns=nil
+ def initialize(particulars)
+ @md,@env,@dal_array=particulars.md,particulars.env,particulars.dal_array
+ @vz=SiSU_Viz::Defaults.new
+ @tab="\t"
+ @brace_url=SiSU_Viz::Defaults.new.url_decoration
+ @br=(@md.opt.cmd =~/M/) ? '' : ''
+ #@br=(@md.opt.cmd =~/M/) ? "\n" : ''
+ end
+ def songsheet
+ begin
+ pre
+ @data=markup(@dal_array)
+ post
+ publish
+ ensure
+ unless @md.opt.cmd =~/[MV]/ #check maintenance flag
+ if @env.processing_path.odt =~/od[ft]/
+ #p "rm -r #{@env.processing_path.odt}" if @md.opt.cmd =~/v/
+ FileUtils::rm_r(@env.processing_path.odf_pth)
+ #system("rm -r #{@env.processing_path.odt}")
+ end
+ end
+ end
+ end
+ # Used for extraction of endnotes from paragraphs
+ def extract_endnotes(dob='')
+ notes=dob.obj.scan(/#{Mx[:en_a_o]}(\d+\s+.+?)#{Mx[:en_a_c]}/)[1] #FIX
+ @n=[]
+ notes.each do |n| #high cost to deal with <br> appropriately within odf, consider
+ n=n.dup.to_s
+ if n =~/#{Mx[:br_line]}/
+ fix=n.split(/#{Mx[:br_line]}/) #watch #added
+ fix.each do |x|
+ if x =~/\S+/ then @n << x
+ end
+ end
+ else @n << n
+ end
+ end
+ end
+ def odf_book_idx
+ if @md.book_idx
+ idx_arr,idx_raw=[],SiSU_Particulars::CombinedSingleton.instance.get_idx_raw(@md.opt).raw_idx
+ idx_raw.each do |x|
+ x=if x.is_a?(String)
+ SiSU_ODF_Format::FormatBookIndex.new(x).book_idx_bookmark
+ else nil
+ end
+ idx_arr << x.strip if x.is_a?(String)
+ end
+ @@odf[:book_idx]=idx_arr.join
+ end
+ end
+ def odf_metadata
+ @@odf[:metadata]=SiSU_Metadata::Summary.new(@md).odf.metadata
+ end
+ def odf_tail
+ generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version]
+ lastdone="Last Generated on: #{Time.now}"
+ rubyv="Ruby version: #{@md.ruby_version}"
+ sc=if @md.sc_info
+ "Source file: #{@md.sc_filename}\nVersion number: #{@md.sc_number}\nVersion date: #{@md.sc_date}\n"
+ else ''
+ end
+ url=@md.fnb
+ fn=@md.file.base_filename.manifest
+ manifest="#{@md.file.output_path.manifest.url}/#{@md.file.base_filename.manifest}"
+ @@odf[:tail] << %{<text:p text:style-name="P_normal">Available document outputs: <br /> &lt;<text:a xlink:type="simple" xlink:href="#{manifest}">#{manifest}</text:a>&gt;</text:p>}
+ @@odf[:tail] << %{\n<text:p text:style-name="P_normal">SiSU: &lt;<text:a xlink:type="simple" xlink:href="http://www.jus.uio.no/lm">www.jus.uio.no/sisu</text:a>&gt; and &lt;<text:a xlink:type="simple" xlink:href="http://www.sisudoc.org">www.sisudoc.org</text:a>&gt;</text:p>}
+ @@odf[:tail] << "\n</office:text></office:body></office:document-content>"
+ end
+ def set_bookmark_tag(dob)
+ tags=SiSU_ODF_Format::Tags.new.set_bookmark_tag(dob)
+ end
+ def heading(dob,p_num)
+ m=/#{$1}/
+ breakpage=''
+ if @md.fns \
+ and @md.fns != '' \
+ and @md.fns !=@@fns
+ @@docstart=true
+ @@fns=@md.fns
+ end
+ unless @@docstart
+ breakpage=if (@md.pagenew or @md.pagebreak) \
+ and (@md.pagenew =~ m or @md.pagebreak =~m)
+ '<text:p text:style-name="P_normal_page_new"> </text:p>'
+ else ''
+ end
+ end
+ @@docstart=false
+ dob.tmp=dob.obj
+ dob.obj=%{#{breakpage}<text:h text:style-name="H_#{dob.ln}" text:outline-level="#{dob.ln}">#{p_num[:set_ref]}#{set_bookmark_tag(dob)}#{dob.obj}#{p_num[:display]}</text:h>}
+ dob
+ end
+ def toc(dob,p_num)
+ m=/#{$1}/
+ hardspace=(dob.lv =~/[A-C]/i) \
+ ? '<text:p text:style-name="Standard"/>'
+ : ''
+ toc_heading=dob.ocn \
+ ? %{<text:bookmark-ref text:reference-format="text" text:ref-name="#{dob.ocn}">#{dob.tmp}</text:bookmark-ref>}
+ : dob.tmp
+ dob.obj=%{<text:h text:style-name="H_#{dob.ln}" text:outline-level="#{dob.ln}">#{toc_heading}</text:h>#{hardspace}}
+ dob
+ end
+ def image_src(i)
+ image_source=if @md.fns =~/\.ss[tm]$/ \
+ and FileTest.file?("#{@env.path.image_source_include}/#{i}") #review
+ @env.path.image_source_include
+ elsif @md.opt.f_pth[:pth] =~/\/\S+?\/sisupod\/\S+?\/sisupod\/doc/
+ pt=/(\/\S+?\/sisupod\/\S+?\/sisupod)\/doc/.match(@md.opt.f_pth[:pth])[1]
+ img_src=pt + '/image'
+ if FileTest.file?("#{img_src}/#{i}")
+ img_src
+ else
+ SiSU_Screen::Ansi.new(@md.opt.cmd,"ERROR - image:",%{"#{i}" missing},"search locations: #{@env.path.image_source_include_local},#{@env.path.image_source_include_remote} and #{@env.path.image_source_include}").error2 unless @md.opt.cmd =~/q/
+ nil
+ end
+ elsif @md.fns =~/\.ss[tm]$/ \
+ and FileTest.file?("#{@env.path.image_source_include_local}/#{i}") #review
+ @env.path.image_source_include_local
+ elsif @md.fns =~/\.ss[tm]$/ \
+ and FileTest.file?("#{@env.path.image_source_sisu_includes}/#{i}")
+ @env.path.image_source_sisu_includes
+ elsif @md.fns =~/\.-ss[tm]$/ \
+ and FileTest.file?("#{@env.path.image_source_include_remote}/#{i}")
+ @env.path.image_source_include_remote
+ else
+ SiSU_Screen::Ansi.new(@md.opt.cmd,"ERROR - image:",%{"#{i}" missing},"search locations: #{@env.path.image_source_include_local},#{@env.path.image_source_include_remote} and #{@env.path.image_source_include}").error2 unless @md.opt.cmd =~/q/
+ nil
+ end
+ end
+ def image_odf(img)
+ # copy image to od image directory (unless exists)
+ # divide pixel dimension by 37.79485 and retain 3 decimal places
+ m,u=img[1],img[2]
+ i=/^(\S+?\.(?:png|jpg|gif))/.match(m).captures.join if m =~/^(\S+?\.(?:png|jpg|gif))/
+ c=/^\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"/.match(m).captures.join if m =~/^\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"/
+ w,h=/\s(\d+)x(\d+)/.match(m).captures if m =~/\s\d+x\d+/
+ w=(w.to_i/37.79485).to_s
+ h=(h.to_i/37.79485).to_s
+ h=/([0-9]+\.\d{0,3})/.match(h).captures.join
+ w=/([0-9]+\.\d{0,3})/.match(w).captures.join
+ image_source=image_src(i)
+ pwd=Dir.pwd
+ if image_source
+ if FileTest.file?("#{image_source}/#{i}")
+ FileUtils::cp("#{image_source}/#{i}","#{@env.processing_path.odt}/Pictures/#{i}")
+ else STDERR.puts %{\t*WARN* did not find image - "#{image_source}/#{i}" [#{__FILE__}:#{__LINE__}]}
+ end
+ end
+ img=if i.to_s =~/jpg|png|gif/ \
+ and h.to_s =~/\d/ \
+ and w.to_s =~/\d/
+ @@img_count +=1
+ %{<draw:frame draw:style-name="fr1" draw:name="graphics#{@@img_count}" text:anchor-type="as-char" svg:width="#{w}cm" svg:height="#{h}cm" draw:z-index="2"><draw:image xlink:href="Pictures/#{i}" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/></draw:frame>#{c}} #anchor-type: as-char or paragraph or char or ...
+ else %{<text:p text:style-name="P_normal">[image omitted]</text:p>}
+ end
+ end
+ def image(dob)
+ m=if dob.obj =~/#{Mx[:lnk_o]}[ ]*(.+?)[ ]*#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/
+ dob.obj.scan(/(#{Mx[:lnk_o]}[ ]*(.+?)[ ]*#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]})/)
+ elsif dob.obj =~/#{Mx[:lnk_o]}[ ]*(.+?)[ ]*#{Mx[:lnk_c]}image/
+ dob.obj.scan(/(#{Mx[:lnk_o]}[ ]*(.+?)[ ]*#{Mx[:lnk_c]}(image))/)
+ else nil
+ end
+ if m then m.each do |i|
+ cont,url=i[1],i[2]
+ cont=cont.gsub(/([)(\]\[])/,"\\\\\\1").
+ gsub(/([+?])/,"\\\\\\1") # incorrect handling of +
+ url=url.gsub(/([+?])/,"\\\\\\1")
+ dob.obj=dob.obj.sub(/#{Mx[:lnk_o]}[ ]*#{cont}[ ]*#{Mx[:lnk_c]}image/m,image_odf(i)).
+ sub(/#{Mx[:lnk_o]}[ ]*#{cont}[ ]*#{Mx[:lnk_c]}#{Mx[:url_o]}#{url}#{Mx[:url_c]}/m,image_odf(i)).
+ sub(/\\([)(\]\[?])/,'\1') #clumsy fix
+ end
+ m=nil
+ end
+ dob
+ end
+ def text_link_odf(txt,url,trail)
+ txt=txt.gsub(/(\\\+)/,'+') #this is convoluted, and risky :-(
+ url=url.gsub(/(\\\+)/,'+') #this is convoluted, and risky :-(
+ map_nametags=SiSU_Particulars::CombinedSingleton.instance.get_map_nametags(@md).nametags_map
+ t=case url
+ when /^https?:/
+ %{<text:a xlink:type="simple" xlink:href="#{url}">#{txt.strip}</text:a>#{trail}}
+ when /^:/ # site same document collection html link
+ url=url.gsub(/^:/,"#{@env.url.root}/")
+ %{<text:a xlink:type="simple" xlink:href="#{url}">#{txt.strip}</text:a>#{trail}}
+ when /^\.\.\// # site same document collection html link
+ url=url.gsub(/^\.\.\//,"#{@env.url.root}/")
+ %{<text:a xlink:type="simple" xlink:href="#{url}">#{txt.strip}</text:a>#{trail}}
+ else # document internal link
+ if map_nametags[url] \
+ and map_nametags[url][:segname]
+ else p "NOT FOUND name_tags: #{url}"
+ end
+ t=map_nametags[url] \
+ && map_nametags[url][:segname] \
+ ? %{<text:a xlink:type="simple" xlink:href="#{@env.url.root}/#{@md.fnb}/#{map_nametags[url][:segname]}#{Sfx[:html]}##{url}">#{txt.strip}</text:a>#{trail}}
+ : %{#{txt.strip}#{trail}}
+ end
+ t
+ end
+ def text_link_odf_bookmark(txt,url,trail)
+ map_nametags=SiSU_Particulars::CombinedSingleton.instance.get_map_nametags(@md).nametags_map
+ %{<text:bookmark-ref text:reference-format="text" text:ref-name="#{url}">#{txt.strip}</text:bookmark-ref>#{trail}}
+ end
+ def text_link(dob)
+ m=dob.obj.scan(/(#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]})/) #sort
+ if m
+ m.each do |i|
+ txt,url,trail=i[1],i[2]
+ txt=txt.gsub(/([)(\]\[])/,"\\\\\\1").
+ gsub(/([+?*])/,"\\\\\\1") # problems with +
+ url=url.gsub(/([+?])/,"\\\\\\1") # problems with +
+ dob.obj=dob.obj.gsub(/#{Mx[:lnk_o]}[ ]*#{txt}#{Mx[:lnk_c]}#{Mx[:url_o]}#{url}#{Mx[:url_c]}/m,text_link_odf(txt,url,trail)). #make sure trailing ']' are not caught in url
+ gsub(/\\([)(\]\[?])/,'\1') #clumsy fix
+ end
+ m=nil
+ end
+ dob
+ end
+ def text_link_relative(dob)
+ m=dob.obj.scan(/(#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}(\S+?)#{Mx[:rel_c]})/) #sort
+ if m
+ m.each do |i|
+ txt,url,trail=i[1],i[2]
+ txt=txt.gsub(/([)(\]\[])/,"\\\\\\1").
+ gsub(/([+?*])/,"\\\\\\1") # problems with +
+ url=url.gsub(/([+?])/,"\\\\\\1") # problems with +
+ dob.obj=dob.obj.gsub(/#{Mx[:lnk_o]}[ ]*#{txt}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{url}#{Mx[:rel_c]}/m,text_link_odf_bookmark(txt,url,trail)). #make sure trailing ']' are not caught in url
+ gsub(/\\([)(\]\[?])/,'\1') #clumsy fix
+ end
+ m=nil
+ end
+ dob
+ end
+ def text_link_relative_(dob)
+ m=dob.obj.scan(/(#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}(\S+?)#{Mx[:rel_c]})/) #sort
+ if m
+ m.each do |i|
+ txt,url,trail=i[1],i[2]
+ txt=txt.gsub(/([)(\]\[])/,"\\\\\\1")
+ dob.obj=dob.obj.gsub(/#{Mx[:lnk_o]}[ ]*#{txt}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{url}#{Mx[:rel_c]}/m,text_link_odf(txt,url,trail)). #make sure trailing ']' are not caught in url
+ gsub(/\\([)(\]\[?])/,'\1') #clumsy fix
+ end
+ m=nil
+ end
+ dob
+ end
+ def normal(dob,p_num) #P1 - P3
+ dob.obj=dob.obj.gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,
+ '<text:a xlink:type="simple" xlink:href="\1">\1</text:a>'). #http ftp matches escaped, no decoration
+ gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,
+ %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{@brace_url.xml_close}}).
+ gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
+ %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{@brace_url.xml_close}}) #http ftp matches with decoration
+ dob.obj= if dob.is==:para \
+ and dob.indent.to_s =~/[0-9]/ \
+ and dob.indent == dob.hang
+ %{<text:p text:style-name="P_indent_#{dob.indent}">#{p_num[:set_ref]}#{set_bookmark_tag(dob)}#{dob.obj}#{p_num[:display]}</text:p>}
+ elsif dob.is==:para \
+ and dob.hang.to_s =~/[0-9]/ \
+ and dob.indent != dob.hang
+ %{<text:p text:style-name="P_h#{dob.hang}_i#{dob.indent}">#{p_num[:set_ref]}#{set_bookmark_tag(dob)}#{dob.obj}#{p_num[:display]}</text:p>}
+ else %{<text:p text:style-name="P_normal">#{p_num[:set_ref]}#{set_bookmark_tag(dob)}#{dob.obj}#{p_num[:display]}</text:p>}
+ end
+ dob
+ end
+ def fontface(dob)
+ end
+ def footnote_urls(str)
+ str=str.gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
+ %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{@brace_url.xml_close}})
+ str=text_link(str) if str =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/
+ str=text_link_relative(str) if str =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/
+ str
+ end
+ def footnote(t_o)
+ str=if defined? t_o.obj then t_o.obj
+ elsif t_o.is_a?(String) then t_o
+ end
+ if str
+ @astx||=10000
+ @astxs||=20000
+ if str =~/#{Mx[:en_a_o]}\d+\s+/
+ str=str.gsub(/#{Mx[:en_a_o]}(\d+)\s+(.+?)#{Mx[:en_a_c]}/,'<text:note text:id="ftn\1" text:note-class="footnote"><text:note-citation>\1</text:note-citation><text:note-body><text:p text:style-name="Footnote"> \2</text:p><text:p text:style-name="Footnote"/></text:note-body></text:note>')
+ end
+ if str =~/#{Mx[:en_a_o]}([*]+)\s+/
+ a=$1.gsub(/([*])/,"\\\\\\1")
+ str=str.gsub(/#{Mx[:en_a_o]}([*]+)\s+(.+?)#{Mx[:en_a_c]}/,%{<text:note text:id="ftn#{@astx.to_s}" text:note-class="footnote"><text:note-citation text:label="\\1">\\1</text:note-citation><text:note-body><text:p text:style-name="Footnote"> \\2</text:p><text:p text:style-name="Footnote"/></text:note-body></text:note>})
+ @astxs+=1
+ end
+ if str=~/#{Mx[:en_a_o]}[*+]+\s/
+ asterisk=str.scan(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)#{Mx[:en_a_c]}/)
+ asterisk.each do |x|
+ a=x[0].gsub(/([*+])/,"\\\\\\1")
+ str=group_clean(str)
+ str=footnote_urls(str)
+ str=str.gsub(/#{Mx[:en_a_o]}(#{a})\s+(.+?)#{Mx[:en_a_c]}/,%{<text:note text:id="ftn#{@astx.to_s}" text:note-class="footnote"><text:note-citation text:label="\\1">\\1</text:note-citation><text:note-body><text:p text:style-name="Footnote"> \\2</text:p><text:p text:style-name="Footnote"/></text:note-body></text:note>})
+ @astx+=1
+ end
+ end
+ if str=~/#{Mx[:en_b_o]}[*+]\d+\s/
+ asterisk=str.scan(/#{Mx[:en_b_o]}([*+]\d+)\s+(.+?)#{Mx[:en_b_c]}/)
+ asterisk.each do |x|
+ a=x[0].gsub(/([*+])/,"\\\\\\1")
+ str=group_clean(str)
+ str=footnote_urls(str)
+ str=str.gsub(/#{Mx[:en_b_o]}(#{a})\s+(.+?)#{Mx[:en_b_c]}/,%{<text:note text:id="ftn#{@astx.to_s}" text:note-class="footnote"><text:note-citation text:label="\\1">\\1</text:note-citation><text:note-body><text:p text:style-name="Footnote"> \\2</text:p><text:p text:style-name="Footnote"/></text:note-body></text:note>})
+ @astx+=1
+ end
+ end
+ end
+ if defined? t_o.obj then t_o.obj=str
+ elsif t_o.is_a?(String) then t_o=str
+ end
+ t_o
+ end
+ def group_clean(str)
+ str=str.gsub(/&amp;nbsp;|&nbsp;|#{Mx[:nbsp]}/,'&#160;').
+ gsub(/</,'&lt;').gsub(/>/,'&gt;').
+ gsub(/&lt;(text:span text:style-name="Span_\S+?"|\/text:span)&gt;/,'<\1>'). #works, not ideal
+ gsub(/#{Mx[:br_line]}/,'<br />').
+ gsub(/&lt;br(?:\s+\/)?&gt;/,'<br />')
+ end
+ def poem(dob,p_num) #P4 #same as group
+ parray=[]
+ dob.obj.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/).each_with_index do |parablock,i|
+ set_ref=(i==0) ? "#{p_num[:set_ref]}#{set_bookmark_tag(dob)}" : ''
+ parablock=group_clean(parablock)
+ parray << %{<text:p text:style-name="P_group">#{set_ref}#{parablock}</text:p>} if parablock =~/\S+/
+ end
+ dob.obj=parray.join \
+ + %{<text:p text:style-name="P_group">#{p_num[:display]}</text:p>} \
+ + '<text:p text:style-name="Standard"/>'
+ dob
+ end
+ def group(dob,p_num) #P4 #same as verse
+ parray=[]
+ dob.obj=dob.obj.gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,
+ '<text:a xlink:type="simple" xlink:href="\1">\1</text:a>'). #http ftp matches escaped, no decoration
+ gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,
+ %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{@brace_url.xml_close}}).
+ gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
+ %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{@brace_url.xml_close}}) #http ftp matches with decoration
+ dob.obj.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/).each_with_index do |parablock,i|
+ set_ref=(i==0) ? "#{p_num[:set_ref]}#{set_bookmark_tag(dob)}" : ''
+ parablock=group_clean(parablock)
+ parablock=parablock.gsub(/&lt;text:a xlink:type="simple" xlink:href="(.+?)"&gt;/m,'<text:a xlink:type="simple" xlink:href="\1">').
+ gsub(/&lt;(\/text:a)&gt;/,'<\1>').
+ gsub(/&lt;(text:note text:id=.+?)&gt;/,'<\1>').
+ gsub(/&lt;(text:p text:style-name="Footnote")&gt;/,'<\1>').
+ gsub(/&lt;(\/?text:(?:note-citation|note-body|note|p))&gt;/,'<\1>')
+ parablock=footnote(parablock)
+ parray << %{<text:p text:style-name="P_group">#{set_ref}#{parablock}</text:p>} if parablock =~/\S+/
+ end
+ dob.obj=parray.join \
+ + %{<text:p text:style-name="P_group">#{p_num[:display]}</text:p>} \
+ + '<text:p text:style-name="Standard"/>'
+ dob
+ end
+ def block(dob,p_num) #P4 #same as verse
+ parray=[]
+ dob.obj=dob.obj.gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,
+ '<text:a xlink:type="simple" xlink:href="\1">\1</text:a>'). #http ftp matches escaped, no decoration
+ gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,
+ %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{@brace_url.xml_close}}).
+ gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
+ %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{@brace_url.xml_close}}) #http ftp matches with decoration
+ dob.obj.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/).each_with_index do |parablock,i|
+ set_ref=(i==0) ? "#{p_num[:set_ref]}#{set_bookmark_tag(dob)}" : ''
+ parablock=group_clean(parablock)
+ parablock=parablock.gsub(/&lt;text:a xlink:type="simple" xlink:href="(.+?)"&gt;/m,'<text:a xlink:type="simple" xlink:href="\1">').
+ gsub(/&lt;(\/text:a)&gt;/,'<\1>').
+ gsub(/&lt;(text:note text:id=.+?)&gt;/,'<\1>').
+ gsub(/&lt;(text:p text:style-name="Footnote")&gt;/,'<\1>').
+ gsub(/&lt;(\/?text:(?:note-citation|note-body|note|p))&gt;/,'<\1>')
+ parablock=footnote(parablock)
+ parray << %{<text:p text:style-name="P_group">#{set_ref}#{parablock}</text:p>} if parablock =~/\S+/
+ end
+ dob.obj=parray.join \
+ + %{<text:p text:style-name="P_group">#{p_num[:display]}</text:p>} \
+ + '<text:p text:style-name="Standard"/>'
+ dob
+ end
+ def code(dob,p_num) #P5
+ if dob.is==:code
+ dob.obj=dob.obj.gsub(/\s\s/,'&#160;&#160;')
+ parray=[]
+ dob.obj.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/).each_with_index do |parablock,i|
+ set_ref=(i==0) ? "#{p_num[:set_ref]}#{set_bookmark_tag(dob)}" : ''
+ parablock=group_clean(parablock)
+ parablock=parablock.gsub(/^\s*$/,'<br />').
+ gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,
+ '<text:a xlink:type="simple" xlink:href="\1">\1</text:a>') #http ftp matches escaped, no decoration
+ parray << %{<text:p text:style-name="P_code">#{set_ref}#{parablock}</text:p>} if parablock =~/\S+/
+ end
+ dob.obj=parray.join \
+ + %{<text:p text:style-name="P_group">#{p_num[:display]}</text:p>} \
+ + '<text:p text:style-name="Standard"/>'
+ end
+ dob
+ end
+ def table(dob,p_num) #
+ if dob.is ==:table
+ table=SiSU_ODF_Format::Table.new(@md,dob,p_num)
+ dob=table.table
+ end
+ dob
+ end
+ def obj_break(dob)
+ if dob.is ==:break
+ br=SiSU_ODF_Format::FormatObjBreak.new(@md,dob)
+ if dob.obj==Mx[:br_page] \
+ or dob.obj==Mx[:br_page_new]
+ dob=br.br_page
+ elsif dob.obj==Mx[:br_obj]
+ dob=br.obj_sep
+ end
+ end
+ dob
+ end
+ def odf_structure(md,dob)
+ @md,@dob=md,dob
+ dob=if dob.is !=:code
+ dob=image(dob) if dob.obj =~/#{Mx[:lnk_o]}[ ]*\S+?\.(?:png|jpg|gif)\s.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/
+ dob=text_link(dob) if dob.obj =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/
+ dob=text_link_relative(dob) if dob.obj =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/
+ dob
+ else dob
+ end
+ p_num={ display: '', set_ref: '' }
+ if dob.is !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/
+ if defined? dob.ocn \
+ and dob.ocn.is_a?(Fixnum)
+ p_num=SiSU_ODF_Format::ParagraphNumber.new(dob.ocn).set_bookmark_and_display
+ #p_num=SiSU_ODF_Format::ParagraphNumber.new(dob.ocn).set_ref_and_display
+ end
+ end
+ dob=footnote(dob)
+ if dob.is==:heading
+ @@odf[:body] << heading(dob,p_num).obj << @br*2
+ if SiSU_Env::ProcessingSettings.new(md).build.toc?
+ if dob.lv =~/[A-C1]/i
+ @@odf[:toc] << toc(dob,p_num).obj
+ end
+ end
+ elsif dob.is ==:verse
+ @@odf[:body] << poem(dob,p_num).obj << @br*2
+ elsif dob.is==:group
+ @@odf[:body] << group(dob,p_num).obj << @br*2
+ elsif dob.is==:block
+ @@odf[:body] << block(dob,p_num).obj << @br*2
+ elsif dob.is==:code
+ @@odf[:body] << code(dob,p_num).obj << @br*2
+ elsif dob.is==:table #elsif dob.obj =~ /<!Th?¡/u
+ @@odf[:body] << table(dob,p_num).obj << @br*2
+ elsif dob.is==:break
+ @@odf[:body] << obj_break(dob).obj << @br*2
+ else
+ @@odf[:body] << normal(dob,p_num).obj << @br*2 # main text, contents, body KEEP
+ end
+ @@endnotes_para=[]
+ end
+ def tidywords(wordlist)
+ wordlist
+ end
+ def markup(data) # Used for major markup instructions
+ safe_characters=/[^a-zA-Z0-9}{\/?,."';:)(><\-_&!@%~#\]\[*=$| \n+`#{Mx[:tc_p]}]/u
+ dir=SiSU_Env::InfoEnv.new(@md.fns)
+ dir.path.odt_bld
+ @data_mod,@endnotes,@level,@cont,@copen,@odf_contents_close=Array.new(6){[]}
+ @rcdc=false
+ (0..6).each { |x| @cont[x]=@level[x]=false }
+ (4..6).each { |x| @odf_contents_close[x]='' }
+ odf_tail #($1,$2)
+ fix=[]
+ bullet=image_src('bullet_09.png')
+ if bullet
+ if FileTest.file?("#{bullet}/bullet_09.png")
+ FileUtils::cp("#{bullet}/bullet_09.png","#{@env.processing_path.odt}/Pictures/.")
+ else STDERR.puts %{\t*WARN* did not find image - "#{bullet}/bullet_09.png" [#{__FILE__}:#{__LINE__}]}
+ end
+ end
+ odf_book_idx
+ odf_metadata
+ data.each do |dob|
+ #p dob.obj if dob.obj =~safe_characters and @md.opt.cmd =~/V/ #KEEP
+ dob.obj='' if dob.obj =~/#{Mx[:lv_o]}\d+:.*?#{Mx[:lv_c]}.+?#{Mx[:pa_non_object_dummy_heading]}/ #fix Mx[:lv_o]
+ para_array=[]
+ dob.obj=dob.obj.gsub(/</,'&lt;').gsub(/>/,'&gt;')
+ word=dob.obj.scan(/\S+|\n/)
+ if word
+ word.each do |w| # _ - / # | : ! ^ ~
+ unless dob =~/^(?:#{Rx[:meta]}|%+ )/m
+ w=w.gsub(/&#(?:126|152);/,'~'). #126 usual
+ gsub(/&nbsp;/,'&#160;')
+ if w !~/(?:&\S{2,7}?;)+/
+ w=w.gsub(/&/,'&amp;')
+ end
+ if w !~/&\S{1,7}?;(?:&\S{1,7}?;)+/ #imperfect
+ w=w.gsub(/(&\S{1,7};)+&/,'\1&amp;')
+ end
+ end
+ para_array << w
+ end
+ dob.obj=para_array.join(' ')
+ dob.obj=dob.obj.strip
+ end
+ if dob.is==:code #{Mx[:gr_o]}code#{Mx[:gr_c]}/ #fix #code-block: angle brackets special characters #fix
+ dob.obj=dob.obj.gsub(/(^|[^}])_(?:<|&lt;)/m,'\1&lt;').gsub(/(^|[^}])_(?:>|&gt;)/m,'\1&gt;').
+ gsub(/(^|[^}])_(?:<|&lt;)/m,'\1&lt;').gsub(/(^|[^}])_(?:>|&gt;)/m,'\1&gt;')
+ end
+ if dob.of==:block
+ dob.obj=dob.obj.gsub(/#{Mx[:gl_bullet]}/,'● ')
+ end
+ dob.obj=dob.obj.gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>').
+ gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'<ins>\1</ins>').
+ gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>').
+ gsub(/#{Mx[:tag_o]}\S+?#{Mx[:tag_c]}/,'<text:bookmark-start text:name="\1"/><text:bookmark-end text:name="\1"/>'). #check
+ gsub(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;').
+ gsub(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;').
+ gsub(/#{Mx[:mk_o]}[~-]##{Mx[:mk_c]}/,'')
+ if dob.is==:para \
+ and dob.bullet_
+ dob.obj='<draw:frame draw:style-name="gr1" text:anchor-type="as-char" svg:width="0.22cm" svg:height="0.22cm" draw:z-index="2"><draw:image xlink:href="Pictures/bullet_09.png" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/></draw:frame> ' +
+ dob.obj
+ end
+ dob.obj=dob.obj.gsub(/#{Mx[:br_line]}/,'<br />').
+ gsub(/&#169;/,'©'). #too arbitrary
+ gsub(/.+?<-#>/,''). # remove dummy headings (used by html) #check
+ gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,
+ '<text:span text:style-name="Span_bold">\1</text:span>').
+ gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,
+ '<text:span text:style-name="Span_italic">\1</text:span>').
+ gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,
+ '<text:span text:style-name="Span_underscore">\1</text:span>').
+ gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,
+ '<text:span text:style-name="Span_superscript">\1</text:span>').
+ gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,
+ '<text:span text:style-name="Span_subscript">\1</text:span>').
+ gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,
+ '<text:span text:style-name="Span_monospace">\1</text:span>').
+ gsub(/­/u,'-').
+ gsub(/ /u, ' '). # space identify
+ gsub(/ /u, ' '). # space identify
+ gsub(/·/u,'*').
+ gsub(/[­–—]/u,'-'). #— – chk
+ gsub(/ < /i,'&#060;').
+ gsub(/\\copy(?:right)?\b/,'&#169;').
+ gsub(/\\trademark\b|\\tm\b/,'&#174;').
+ gsub(/\44/,'&#36;'). #$ watch
+ gsub(/<a href=".+?">(.+?)<\/a>/,'\1').
+ gsub(/#{Mx[:mk_o]}name#\S+?#{Mx[:mk_c]}/,'') # remove name links
+ wordlist=dob.obj.scan(/\S+/)
+ dob.obj=tidywords(wordlist).join(' ').strip
+ @rcdc=true if @rcdc==false \
+ and (dob.obj =~/~metadata/ or dob =~/#{Mx[:lv_o]}1:meta#{Mx[:lv_x]}\s*Document Information/) #fix Mx[:lv_o]
+ if dob.is !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/ #check
+ if defined? dob.ocn and dob.ocn =~/\d+/
+ @p_num=SiSU_ODF_Format::ParagraphNumber.new(dob.ocn)
+ end
+ if dob.is ==:heading \
+ || dob.is ==:para \
+ || dob.is ==:group \
+ || dob.is ==:verse \
+ || dob.is ==:code \
+ || dob.is ==:table \
+ || dob.is ==:break
+ odf_structure(@md,dob)
+ end
+ if dob.obj ## Clean Prepared Text
+ dob.obj=dob.obj.gsub(/<!.+!>/,' ').
+ gsub(/#{Mx[:tc_o]}.+?#{Mx[:tc_c]}/,' ').
+ gsub(/<:\S+>/,' ')
+ end
+ end
+ end
+ end
+ def pre
+ table=if @md.flag_tables
+ x=<<WOK
+ <style:style style:name="Table1" style:family="table"><style:table-properties style:width="16.999cm" table:align="margins"/></style:style>
+ <style:style style:name="Table1.A" style:family="table-column"><style:table-column-properties style:column-width="16.999cm" style:rel-column-width="65535*"/></style:style>
+ <style:style style:name="Table1.B" style:family="table-column"><style:table-column-properties style:column-width="8.499cm" style:rel-column-width="32767*"/></style:style>
+ <style:style style:name="Table1.C" style:family="table-column"><style:table-column-properties style:column-width="5.666cm" style:rel-column-width="21845*"/></style:style>
+ <style:style style:name="Table1.D" style:family="table-column"><style:table-column-properties style:column-width="4.349cm" style:rel-column-width="16383*"/></style:style>
+ <style:style style:name="Table1.E" style:family="table-column"><style:table-column-properties style:column-width="3.399cm" style:rel-column-width="13107*"/></style:style>
+ <style:style style:name="Table1.F" style:family="table-column"><style:table-column-properties style:column-width="2.833cm" style:rel-column-width="10922*"/></style:style>
+ <style:style style:name="Table1.G" style:family="table-column"><style:table-column-properties style:column-width="2.428cm" style:rel-column-width="9362*"/></style:style>
+ <style:style style:name="Table1.H" style:family="table-column"><style:table-column-properties style:column-width="2.124cm" style:rel-column-width="8191*"/></style:style>
+ <style:style style:name="Table2" style:family="table"><style:table-properties style:width="16.999cm" table:align="margins"/></style:style>
+ <style:style style:name="Table2.A" style:family="table-column"><style:table-column-properties style:column-width="16.999cm" style:rel-column-width="65535*"/></style:style>
+ <style:style style:name="Table2.B" style:family="table-column"><style:table-column-properties style:column-width="8.499cm" style:rel-column-width="32767*"/></style:style>
+ <style:style style:name="Table2.C" style:family="table-column"><style:table-column-properties style:column-width="5.666cm" style:rel-column-width="21845*"/></style:style>
+ <style:style style:name="Table2.D" style:family="table-column"><style:table-column-properties style:column-width="4.349cm" style:rel-column-width="16383*"/></style:style>
+ <style:style style:name="Table2.E" style:family="table-column"><style:table-column-properties style:column-width="3.999cm" style:rel-column-width="13107*"/></style:style>
+ <style:style style:name="Table2.F" style:family="table-column"><style:table-column-properties style:column-width="2.833cm" style:rel-column-width="10922*"/></style:style>
+ <style:style style:name="Table2.G" style:family="table-column"><style:table-column-properties style:column-width="2.428cm" style:rel-column-width="9362*"/></style:style>
+ <style:style style:name="Table2.H" style:family="table-column"><style:table-column-properties style:column-width="2.124cm" style:rel-column-width="8191*"/></style:style>
+ <style:style style:name="Table2.I" style:family="table-column"><style:table-column-properties style:column-width="1.8887cm" style:rel-column-width="7281*"/></style:style>
+ <style:style style:name="Table2.J" style:family="table-column"><style:table-column-properties style:column-width="1.6999cm" style:rel-column-width="6553*"/></style:style>
+ <style:style style:name="Table2.K" style:family="table-column"><style:table-column-properties style:column-width="1.5453cm" style:rel-column-width="5957*"/></style:style>
+ <style:style style:name="Table2.L" style:family="table-column"><style:table-column-properties style:column-width="1.416cm" style:rel-column-width="5461*"/></style:style>
+ <style:style style:name="Table2.M" style:family="table-column"><style:table-column-properties style:column-width="1.307" style:rel-column-width="5041*"/></style:style>
+ <style:style style:name="Table2.N" style:family="table-column"><style:table-column-properties style:column-width="1.214cm" style:rel-column-width="4681*"/></style:style>
+WOK
+ x=x.strip
+ x=x.gsub(/\n+/m,'') unless @md.opt.cmd=~/M/
+ x
+ else ''
+ end
+ breakpage=if @md.pagenew \
+ or @md.pagebreak
+ ' fo:break-before="page"'
+ else ''
+ end
+ x=<<WOK
+<?xml version="1.0" encoding="UTF-8"?>
+<office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2"><office:scripts/>
+<office:font-face-decls><style:font-face style:name="DejaVu Sans Mono" svg:font-family="'DejaVu Sans Mono'" style:font-adornments="Book" style:font-family-generic="modern" style:font-pitch="fixed"/><style:font-face style:name="Inconsolata" svg:font-family="Inconsolata" style:font-adornments="Regular" style:font-pitch="fixed"/><style:font-face style:name="Liberation Mono" svg:font-family="'Liberation Mono'" style:font-adornments="Regular" style:font-family-generic="modern" style:font-pitch="fixed"/><style:font-face style:name="DejaVu Sans" svg:font-family="'DejaVu Sans'" style:font-adornments="ExtraLight" style:font-family-generic="swiss" style:font-pitch="variable"/><style:font-face style:name="Nimbus Sans L" svg:font-family="&apos;Nimbus Sans L&apos;" style:font-pitch="variable"/><style:font-face style:name="Tahoma" svg:font-family="Tahoma, Lucidasans, &apos;Lucida Sans&apos;, &apos;Arial Unicode MS&apos;" style:font-pitch="variable"/><style:font-face style:name="Nimbus Roman No9 L" svg:font-family="&apos;Nimbus Roman No9 L&apos;" style:font-family-generic="roman" style:font-pitch="variable"/><style:font-face style:name="Bitstream Vera Sans" svg:font-family="&apos;Bitstream Vera Sans&apos;" style:font-family-generic="swiss" style:font-pitch="variable"/></office:font-face-decls>
+<office:automatic-styles>
+#{table}
+ <style:style style:name="P_table_cell" style:family="paragraph" style:parent-style-name="Table_Contents"><style:paragraph-properties fo:text-align="justify" style:justify-single-word="false"/></style:style>
+</office:automatic-styles>
+<office:body>
+ <office:text text:use-soft-page-breaks="true">
+ <office:forms form:automatic-focus="false" form:apply-design-mode="false"/>
+ <text:sequence-decls><text:sequence-decl text:display-outline-level="0" text:name="Illustration"/><text:sequence-decl text:display-outline-level="0" text:name="Table"/><text:sequence-decl text:display-outline-level="0" text:name="Text"/><text:sequence-decl text:display-outline-level="0" text:name="Drawing"/></text:sequence-decls>
+WOK
+ x=x.strip
+ x=x.gsub(/\n+/m,'') unless @md.opt.cmd=~/M/
+ @@odf[:head] << x
+ end
+ def post
+ end
+ def publish
+ divider='='
+ content=[]
+ br_pg='<text:p text:style-name="P_normal_page_new"> </text:p>'
+ data=@data
+ content <<
+ @@odf[:head] <<
+ @@odf[:toc] <<
+ br_pg <<
+ @@odf[:body] <<
+ @@odf[:book_idx] <<
+ br_pg <<
+ @@odf[:metadata] <<
+ @@odf[:tail]
+ SiSU_ODF::Source::Output.new(content,@md,@env).odf
+ @@odf={ head: [], toc: [], body: [], tail: [], book_idx: [], metadata: [] }
+ end
+ end
+ class Output <Source
+ def initialize(content,md,env)
+ @content,@md,@env=content,md,env
+ end
+ def odf #%odf output
+ env=SiSU_Env::FileOp.new(@md)
+ env.mkdir
+ header=SiSU_ODF_Format::ODT_Head_1_2.new(@md)
+ filename="#{@env.processing_path.odt}/manifest.rdf"
+ od=File.new(filename,'w+')
+ od << header.manifest_rdf
+ od.close
+ filename="#{@env.processing_path.odt}/META-INF/manifest.xml"
+ od=File.new(filename,'w+')
+ od << header.meta_inf_manifest_xml(@md)
+ od.close
+ filename="#{@env.processing_path.odt}/meta.xml"
+ od=File.new(filename,'w+')
+ od << header.meta_xml
+ od.close
+ filename="#{@env.processing_path.odt}/settings.xml"
+ od=File.new(filename,'w+')
+ od << header.settings_xml
+ od.close
+ filename="#{@env.processing_path.odt}/styles.xml"
+ od=File.new(filename,'w+')
+ od << header.styles_xml
+ od.close
+ filename="#{@env.processing_path.odt}/mimetype"
+ od=File.new(filename,'w+')
+ od << header.mimetype
+ od.close
+ env.make_path(@env.processing_path.odt)
+ env.make_path(@md.file.output_path.odt.dir)
+ filename="#{@env.processing_path.odt}/content.xml"
+ od=File.new(filename,'w+')
+ @content.compact.each do |para| # this is a hack
+ od.puts para unless para =~/\A\s*\Z/
+ end
+ od.close
+ opendoc=@md.file.base_filename.odt #watch where output by language
+ FileUtils::mkdir_p(@md.file.output_path.odt.dir) unless FileTest.directory?(@md.file.output_path.odt.dir)
+ if FileTest.directory?(@env.processing_path.odt)
+ pwd=Dir.pwd
+ Dir.chdir(@env.processing_path.odt)
+ system("
+ zip -qr #{opendoc} *
+ ")
+ FileUtils::mv(opendoc, @md.file.place_file.odt.dir)
+ Dir.chdir(pwd)
+ end
+ end
+ end
+ end
+end
+__END__
diff --git a/lib/sisu/v4/odf_format.rb b/lib/sisu/v4/odf_format.rb
new file mode 100644
index 00000000..a12c09d0
--- /dev/null
+++ b/lib/sisu/v4/odf_format.rb
@@ -0,0 +1,658 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: opendocument formatting, default opendocument template
+
+=end
+module SiSU_ODF_Format
+ require_relative 'param' # param.rb
+ include SiSU_Param
+ include SiSU_Viz
+ class ParagraphNumber
+ def initialize(paranum)
+ @paranum=/(\d+)/m.match(paranum.to_s)[1]
+ end
+ def set_ref_and_display
+ set_ref=@paranum.gsub(/(\d+)/,' <text:span text:style-name="Span_subscript"><text:reference-mark-start text:name="\1"/><text:reference-mark-end text:name="\1"/></text:span>')
+ disp=@paranum.gsub(/(\d+)/,' <text:span text:style-name="Span_subscript">[\1]</text:span>')
+ ocn={ display: disp, set_ref: set_ref }
+ end
+ def set_bookmark_and_display
+ set_ref=@paranum.gsub(/(\d+)/,' <text:span text:style-name="Span_subscript"><text:bookmark-start text:name="\1"/><text:bookmark-end text:name="\1"/></text:span>')
+ disp=@paranum.gsub(/(\d+)/,' <text:span text:style-name="Span_subscript">[\1]</text:span>')
+ ocn={ display: disp, set_ref: set_ref }
+ end
+ def name
+ @paranum.gsub(/(\d+)/,'<a name="\1"></a>')
+ end
+ def goto
+ @paranum.gsub(/(\d+)/,'<a href="#\1">')
+ end
+ end
+ class FormatBookIndex
+ def initialize(idx_str)
+ @idx_str=idx_str
+ end
+ def book_idx_bookmark
+ map_nametags=SiSU_Particulars::CombinedSingleton.instance.get_map_nametags(@md).nametags_map #p map_nametags
+ rgx_bookmark=/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}#?\S+?#{Mx[:rel_c]}/m
+ while @idx_str =~/#{Mx[:lnk_o]}([^#{Mx[:lnk_o]}#{Mx[:lnk_c]}]+)#{Mx[:lnk_c]}#{Mx[:rel_o]}#?(\S+?)#{Mx[:rel_c]}/m
+ link,url=$1,$2
+ link,url=link.strip,url.strip
+ @idx_str=@idx_str.gsub(/&/m,"&amp;")
+ ocn_lnk=if map_nametags[url] \
+ and map_nametags[url][:ocn]
+ map_nametags[url][:ocn]
+ else nil
+ end
+ ocn_lnk=(url=~/^\d+$/ ? url : ocn_lnk)
+ if ocn_lnk and not ocn_lnk.empty?
+ @idx_str=@idx_str.sub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,
+ '<text:span text:style-name="Span_bold">\1</text:span>').
+ sub(rgx_bookmark,
+ %{<text:bookmark-ref text:reference-format="text" text:ref-name="#{url}">#{link.strip}</text:bookmark-ref>})
+ else
+ puts %{name tag: "#{url}" not found}
+ @idx_str.sub!(rgx_bookmark,"#{link}")
+ end
+ end
+ @idx_str=@idx_str.gsub(/#{Xx[:protect]}/m,'').
+ sub(/,\s*$/m,'').
+ gsub(/\n/,'')
+ @idx_str='<text:p text:style-name="P_normal">' + @idx_str + '</text:p>'
+ end
+ end
+ class Tags
+ def set_bookmark_tag(dob)
+ tags=''
+ if dob.tags.length > 0
+ dob.tags.each do |tag|
+ tags +=%{ <text:span text:style-name="Span_subscript"><text:bookmark-start text:name="#{tag}"/><text:bookmark-end text:name="#{tag}"/></text:span>}
+ end
+ end
+ tags
+ end
+ end
+ class FormatTextObject
+ def initialize(md,t_o)
+ @md,@t_o=md,t_o
+ if t_o.is_a?(Hash)
+ @txt =t_o[:txt] || nil
+ else
+ p t_o.class
+ p caller
+ end
+ rgx=/#{Mx[:en_a_o]}\d+\s+(.+?)#{Mx[:en_a_c]}/
+ @txt=@txt.gsub(rgx,'\1') if @txt =~rgx
+ @vz=SiSU_Viz::Defaults.new
+ end
+ def scr_endnote_body
+ "<endnote>#{@txt}</endnote> "
+ end
+ def heading_body1
+ end
+ def heading_body2
+ end
+ def heading_body3
+ end
+ def heading_body4
+ end
+ def heading_body5
+ end
+ def heading_body6
+ end
+ end
+ class Table
+ @@tablehead,@@table_counter=0,0 #reinitialise on new file
+ @@tablefoot=[] #watch
+ @@fns=''
+ def initialize(md,dob,p_num)
+ @md,@dob,@p_num=md,dob,p_num
+ @txt=dob.obj
+ @vz=SiSU_Viz::Defaults.new
+ if @md.fns != @@fns
+ @@table_counter=0
+ @@fns=@md.fns
+ end
+ end
+ def table_head_open(count)
+ type=(@dob.head_) \
+ ? 1
+ : 2
+ alpha=case @dob.cols
+ when 1; 'A'
+ when 2; 'B'
+ when 3; 'C'
+ when 4; 'D'
+ when 5; 'E'
+ when 6; 'F'
+ when 7; 'G'
+ when 8; 'H'
+ when 9; 'I'
+ when 10; 'J'
+ when 11; 'K'
+ when 12; 'L'
+ when 13; 'M'
+ when 14; 'N'
+ else 'D'
+ end
+ tag=SiSU_ODF_Format::Tags.new.set_bookmark_tag(@dob)
+ %{<table:table table:name="Table#{count}" table:style-name="Table#{type}">#{@p_num[:set_ref]}#{tag}#{@br}} +
+ %{<table:table-column table:style-name="Table#{type}.#{alpha}" table:number-columns-repeated="#{@dob.cols}"/>#{@br}}
+ end
+ def table_close(tablefoot='')
+ '</table:table>' \
+ + %{<text:p text:style-name="P_group">#{@p_num[:display]}</text:p>}
+ end
+ def table_tag_cell(str,i)
+ txt_name_cell=if i==0 \
+ and @dob.head_
+ 'Table_Heading'
+ else 'P_table_cell'
+ end
+ str=str.gsub(/^~$/,'') # tilde / empty cell
+ %{<table:table-cell office:value-type="string">#{@br}} +
+ %{<text:p text:style-name="#{txt_name_cell}">#{@br}} +
+ %{#{str}} +
+ %{</text:p>#{@br}} +
+ %{</table:table-cell>#{@br}}
+ end
+ def table_tag_row(str,i)
+ %{<table:table-row>#{@br}} +
+ %{#{str}} +
+ %{</table:table-row>#{@br}}
+ end
+ def table_tag_row_dump(str,i)
+ txt_name_row=if i==0 \
+ and @dob.head_
+ 'Table_Heading'
+ else 'P_table_cell'
+ end
+ %{<table:table-row>#{@br}} +
+ %{<table:table-cell office:value-type="string">#{@br}} +
+ %{<text:p text:style-name="#{txt_name_row}">#{@br}}
+ %{#{str}} +
+ %{</text:p>#{@br}} +
+ %{</table:table-cell>#{@br}} +
+ %{</table:table-row>#{@br}}
+ end
+ def table_row(row,i)
+ row='' if row =~/^<!$/
+ m=row[/<!f(.+?)!>/,1]
+ @@tablefoot << m if m
+ row=row.gsub(/<!f.+?!>/,'')
+ @cells=[]
+ row.split(/\s*#{Mx[:tc_p]}/).each do |cell|
+ @cells << table_tag_cell(cell,i)
+ end
+ row=@cells.join
+ row=table_tag_row(row,i)
+ row
+ end
+ def table
+ @@table_counter+=1
+ table_head_open(@@table_counter)
+ @table=[]
+ @dob.obj.split(/\s*#{Mx[:tc_c]}/).each_with_index do |r,i|
+ @table << table_row(r,i)
+ end
+ @dob.obj= table_head_open(@@table_counter) + @table.join + table_close
+ @dob
+ end
+ end
+ class ODT_Head_1_2
+ def initialize(md)
+ @md=md
+ @generator="#{@md.sisu_version[:project]} #{@md.sisu_version[:version]} #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})"
+ end
+ def manifest_rdf
+ x=<<WOK
+<?xml version="1.0" encoding="utf-8"?>
+<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+ <rdf:Description rdf:about="styles.xml">
+ <rdf:type rdf:resource="http://docs.oasis-open.org/ns/office/1.2/meta/odf#StylesFile"/>
+ </rdf:Description>
+ <rdf:Description rdf:about="">
+ <ns0:hasPart xmlns:ns0="http://docs.oasis-open.org/ns/office/1.2/meta/pkg#" rdf:resource="styles.xml"/>
+ </rdf:Description>
+ <rdf:Description rdf:about="content.xml">
+ <rdf:type rdf:resource="http://docs.oasis-open.org/ns/office/1.2/meta/odf#ContentFile"/>
+ </rdf:Description>
+ <rdf:Description rdf:about="">
+ <ns0:hasPart xmlns:ns0="http://docs.oasis-open.org/ns/office/1.2/meta/pkg#" rdf:resource="content.xml"/>
+ </rdf:Description>
+ <rdf:Description rdf:about="">
+ <rdf:type rdf:resource="http://docs.oasis-open.org/ns/office/1.2/meta/pkg#Document"/>
+ </rdf:Description>
+</rdf:RDF>
+WOK
+ x=x.strip
+ x=x.gsub(/\n+/m,'') unless @md.opt.cmd=~/M/
+ x
+ end
+ def meta_inf_manifest_xml(md)
+ images=[' <manifest:file-entry manifest:media-type="" manifest:full-path="Pictures/bullet_09.png"/>']
+ if md.ec[:image].length > 0
+ md.ec[:image].each do |i|
+ images<<<<WOK
+ <manifest:file-entry manifest:media-type="" manifest:full-path="Pictures/#{i}"/>
+WOK
+ end
+ end
+ images=images.join('')
+ x=<<WOK
+<?xml version="1.0" encoding="UTF-8"?>
+<manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0" manifest:version="1.2">
+ <manifest:file-entry manifest:media-type="application/vnd.oasis.opendocument.text" manifest:version="1.2" manifest:full-path="/"/>
+ <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="styles.xml"/>
+ <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="content.xml"/>
+ #{images}
+ <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="meta.xml"/>
+ <manifest:file-entry manifest:media-type="application/rdf+xml" manifest:full-path="manifest.rdf"/>
+ <manifest:file-entry manifest:media-type="image/png" manifest:full-path="Thumbnails/thumbnail.png"/>
+ <manifest:file-entry manifest:media-type="application/binary" manifest:full-path="layout-cache"/>
+ <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="settings.xml"/>
+ <manifest:file-entry manifest:media-type="" manifest:full-path="Configurations2/accelerator/current.xml"/>
+ <manifest:file-entry manifest:media-type="application/vnd.sun.xml.ui.configuration" manifest:full-path="Configurations2/"/>
+</manifest:manifest>
+WOK
+ x=x.strip
+ x=x.gsub(/\n+/m,'') unless @md.opt.cmd=~/M/
+ x
+ end
+ def meta_xml
+ x=<<WOK
+<?xml version="1.0" encoding="UTF-8"?>
+<office:document-meta xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:grddl="http://www.w3.org/2003/g/data-view#" office:version="1.2">
+ <office:meta>
+ <meta:generator>#{@generator}</meta:generator>
+ <meta:creation-date>#{@md.generated}</meta:creation-date>
+ <dc:date>#{@md.generated}</dc:date>
+ <dc:language>en-US</dc:language>
+ </office:meta>
+</office:document-meta>
+WOK
+ x=x.strip
+ x=x.gsub(/\n+/m,'') unless @md.opt.cmd=~/M/
+ x
+ end
+ def settings_xml
+ x=<<WOK
+<?xml version="1.0" encoding="UTF-8"?>
+<office:document-settings xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" office:version="1.2">
+ <office:settings>
+ <config:config-item-set config:name="ooo:view-settings">
+ <config:config-item config:name="ViewAreaTop" config:type="int">0</config:config-item>
+ <config:config-item config:name="ViewAreaLeft" config:type="int">0</config:config-item>
+ <config:config-item config:name="ViewAreaWidth" config:type="int">0</config:config-item>
+ <config:config-item config:name="ViewAreaHeight" config:type="int">0</config:config-item>
+ <config:config-item config:name="ShowRedlineChanges" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="InBrowseMode" config:type="boolean">false</config:config-item>
+ <config:config-item-map-indexed config:name="Views">
+ <config:config-item-map-entry>
+ <config:config-item config:name="ViewId" config:type="string">view2</config:config-item>
+ <config:config-item config:name="ViewLeft" config:type="int">0</config:config-item>
+ <config:config-item config:name="ViewTop" config:type="int">0</config:config-item>
+ <config:config-item config:name="VisibleLeft" config:type="int">0</config:config-item>
+ <config:config-item config:name="VisibleTop" config:type="int">0</config:config-item>
+ <config:config-item config:name="VisibleRight" config:type="int">0</config:config-item>
+ <config:config-item config:name="VisibleBottom" config:type="int">0</config:config-item>
+ <config:config-item config:name="ZoomType" config:type="short">0</config:config-item>
+ <config:config-item config:name="ViewLayoutColumns" config:type="short">2</config:config-item>
+ <config:config-item config:name="ViewLayoutBookMode" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="ZoomFactor" config:type="short">100</config:config-item>
+ <config:config-item config:name="IsSelectedFrame" config:type="boolean">false</config:config-item>
+ </config:config-item-map-entry>
+ </config:config-item-map-indexed>
+ </config:config-item-set>
+ <config:config-item-set config:name="ooo:configuration-settings">
+ <config:config-item config:name="ChartAutoUpdate" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="IsLabelDocument" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="MathBaselineAlignment" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="OutlineLevelYieldsNumbering" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="PrintLeftPages" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="DoNotJustifyLinesWithManualBreak" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="AlignTabStopPosition" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="PrintTextPlaceholder" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="UseOldNumbering" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="CurrentDatabaseCommand" config:type="string"/>
+ <config:config-item config:name="ProtectForm" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PrintBlackFonts" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PrintProspectRTL" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="SmallCapsPercentage66" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="PrintControls" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="CharacterCompressionType" config:type="short">0</config:config-item>
+ <config:config-item config:name="PrintHiddenText" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="UseFormerTextWrapping" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="IsKernAsianPunctuation" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PrintProspect" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PrintEmptyPages" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="UseFormerObjectPositioning" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="ConsiderTextWrapOnObjPos" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="TableRowKeep" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PrintReversed" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="TabsRelativeToIndent" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="PrintRightPages" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="PrintPaperFromSetup" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="AddFrameOffsets" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="AddParaSpacingToTableCells" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="UpdateFromTemplate" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="AddExternalLeading" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="PrintSingleJobs" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PrinterIndependentLayout" config:type="string">high-resolution</config:config-item>
+ <config:config-item config:name="LinkUpdateMode" config:type="short">1</config:config-item>
+ <config:config-item config:name="PrintAnnotationMode" config:type="short">0</config:config-item>
+ <config:config-item config:name="UseOldPrinterMetrics" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="RedlineProtectionKey" config:type="base64Binary"/>
+ <config:config-item config:name="PrinterSetup" config:type="base64Binary"/>
+ <config:config-item config:name="IgnoreFirstLineIndentInNumbering" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="CollapseEmptyCellPara" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="PrinterName" config:type="string"/>
+ <config:config-item config:name="InvertBorderSpacing" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PrintPageBackground" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="DoNotCaptureDrawObjsOnPage" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="ApplyUserData" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="TabAtLeftIndentForParagraphsInList" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="UnxForceZeroExtLeading" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="SaveVersionOnClose" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PrintFaxName" config:type="string"/>
+ <config:config-item config:name="AddParaTableSpacing" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="PrintDrawings" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="LoadReadonly" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PrintGraphics" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="FieldAutoUpdate" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="AllowPrintJobCancel" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="UseFormerLineSpacing" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="SaveGlobalDocumentLinks" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="CurrentDatabaseDataSource" config:type="string"/>
+ <config:config-item config:name="IgnoreTabsAndBlanksForLineCalculation" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="CurrentDatabaseCommandType" config:type="int">0</config:config-item>
+ <config:config-item config:name="DoNotResetParaAttrsForNumFont" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="ClipAsCharacterAnchoredWriterFlyFrames" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PrintTables" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="AddParaTableSpacingAtStart" config:type="boolean">true</config:config-item>
+ </config:config-item-set>
+ </office:settings>
+</office:document-settings>
+WOK
+ x=x.strip
+ x=x.gsub(/\n+/m,'') unless @md.opt.cmd=~/M/
+ x
+ end
+ def styles_xml
+ x=<<WOK
+<?xml version="1.0" encoding="UTF-8"?>
+<office:document-styles xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2">
+ <office:font-face-decls>
+ <style:font-face style:name="DejaVu Sans Mono" svg:font-family="'DejaVu Sans Mono'" style:font-adornments="Book" style:font-family-generic="modern" style:font-pitch="fixed"/>
+ <style:font-face style:name="Nimbus Sans L" svg:font-family="'Nimbus Sans L'" style:font-pitch="variable"/>
+ <style:font-face style:name="Tahoma" svg:font-family="Tahoma, Lucidasans, 'Lucida Sans', 'Arial Unicode MS'" style:font-pitch="variable"/>
+ <style:font-face style:name="Nimbus Roman No9 L" svg:font-family="'Nimbus Roman No9 L'" style:font-family-generic="roman" style:font-pitch="variable"/>
+ <style:font-face style:name="Bitstream Vera Sans" svg:font-family="'Bitstream Vera Sans'" style:font-family-generic="swiss" style:font-pitch="variable"/>
+ </office:font-face-decls>
+ <office:styles>
+ <style:default-style style:family="graphic">
+ <style:graphic-properties fo:wrap-option="wrap" draw:shadow-offset-x="0.3cm" draw:shadow-offset-y="0.3cm" draw:start-line-spacing-horizontal="0.283cm" draw:start-line-spacing-vertical="0.283cm" draw:end-line-spacing-horizontal="0.283cm" draw:end-line-spacing-vertical="0.283cm" style:flow-with-text="false"/>
+ <style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" style:writing-mode="lr-tb" style:font-independent-line-spacing="false">
+ <style:tab-stops/>
+ </style:paragraph-properties>
+ <style:text-properties style:use-window-font-color="true" fo:font-size="12pt" fo:language="en" fo:country="US" style:font-size-asian="12pt" style:language-asian="zxx" style:country-asian="none" style:font-size-complex="12pt" style:language-complex="zxx" style:country-complex="none"/>
+ </style:default-style>
+ <style:default-style style:family="paragraph">
+ <style:paragraph-properties fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="1.251cm" style:writing-mode="page"/>
+ <style:text-properties style:use-window-font-color="true" style:font-name="Nimbus Roman No9 L" fo:font-size="12pt" fo:language="en" fo:country="US" style:font-name-asian="Nimbus Sans L" style:font-size-asian="12pt" style:language-asian="zxx" style:country-asian="none" style:font-name-complex="Nimbus Sans L" style:font-size-complex="12pt" style:language-complex="zxx" style:country-complex="none" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2"/>
+ </style:default-style>
+ <style:default-style style:family="table">
+ <style:table-properties table:border-model="collapsing"/>
+ </style:default-style>
+ <style:default-style style:family="table-row">
+ <style:table-row-properties fo:keep-together="auto"/>
+ </style:default-style>
+ <style:style style:name="Standard" style:family="paragraph" style:class="text"/>
+ <style:style style:name="Text_body" style:display-name="Text body" style:family="paragraph" style:class="text"><style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0.212cm"/></style:style>
+ <style:style style:name="P_page_break" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:break-before="page"/></style:style>
+ <style:style style:name="P_normal" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:text-align="justify" style:justify-single-word="false"/></style:style>
+ <style:style style:name="P_normal_page_new" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:break-after="page"/></style:style>
+ <style:style style:name="P_indent_0" style:display-name="Paragraph indent 0" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:text-align="justify" style:justify-single-word="false"/></style:style>
+ <style:style style:name="P_indent_1" style:display-name="Paragraph indent 1" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:margin-left="1cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/></style:style>
+ <style:style style:name="P_indent_2" style:display-name="Paragraph indent 2" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:margin-left="2cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/></style:style>
+ <style:style style:name="P_indent_3" style:display-name="Paragraph indent 3" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:margin-left="3cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/></style:style>
+ <style:style style:name="P_indent_4" style:display-name="Paragraph indent 4" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:margin-left="4cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/></style:style>
+ <style:style style:name="P_indent_5" style:display-name="Paragraph indent 5" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:margin-left="5cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/></style:style>
+ <style:style style:name="P_indent_6" style:display-name="Paragraph indent 6" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:margin-left="6cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/></style:style>
+ <style:style style:name="P_indent_7" style:display-name="Paragraph indent 7" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:margin-left="7cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/></style:style>
+ <style:style style:name="P_indent_8" style:display-name="Paragraph indent 8" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:margin-left="8cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/></style:style>
+ <style:style style:name="P_indent_9" style:display-name="Paragraph indent 9" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:margin-left="9cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/></style:style>
+ <style:style style:name="P_h0_i0" style:display-name="Hang 0 Indent 0" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-indent="0cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h0_i1" style:display-name="Hang 0 Indent 1" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="1cm" fo:margin-right="0cm" fo:text-indent="-1cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h0_i2" style:display-name="Hang 0 Indent 2" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="2cm" fo:margin-right="0cm" fo:text-indent="-2cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h0_i3" style:display-name="Hang 0 Indent 3" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="3cm" fo:margin-right="0cm" fo:text-indent="-3cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h0_i4" style:display-name="Hang 0 Indent 4" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="4cm" fo:margin-right="0cm" fo:text-indent="-4cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h0_i5" style:display-name="Hang 0 Indent 5" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="5cm" fo:margin-right="0cm" fo:text-indent="-5cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h0_i6" style:display-name="Hang 0 Indent 6" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="6cm" fo:margin-right="0cm" fo:text-indent="-6cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h0_i7" style:display-name="Hang 0 Indent 7" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="7cm" fo:margin-right="0cm" fo:text-indent="-7cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h0_i8" style:display-name="Hang 0 Indent 8" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="8cm" fo:margin-right="0cm" fo:text-indent="-8cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h0_i9" style:display-name="Hang 0 Indent 9" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="9cm" fo:margin-right="0cm" fo:text-indent="-9cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h1_i0" style:display-name="Hang 1 Indent 0" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-indent="1cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h1_i1" style:display-name="Hang 1 Indent 1" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="1cm" fo:margin-right="0cm" fo:text-indent="0cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h1_i2" style:display-name="Hang 1 Indent 2" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="2cm" fo:margin-right="0cm" fo:text-indent="-1cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h1_i3" style:display-name="Hang 1 Indent 3" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="3cm" fo:margin-right="0cm" fo:text-indent="-2cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h1_i4" style:display-name="Hang 1 Indent 4" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="4cm" fo:margin-right="0cm" fo:text-indent="-3cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h1_i5" style:display-name="Hang 1 Indent 5" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="5cm" fo:margin-right="0cm" fo:text-indent="-4cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h1_i6" style:display-name="Hang 1 Indent 6" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="6cm" fo:margin-right="0cm" fo:text-indent="-5cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h1_i7" style:display-name="Hang 1 Indent 7" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="7cm" fo:margin-right="0cm" fo:text-indent="-6cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h1_i8" style:display-name="Hang 1 Indent 8" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="8cm" fo:margin-right="0cm" fo:text-indent="-7cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h1_i9" style:display-name="Hang 1 Indent 9" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="9cm" fo:margin-right="0cm" fo:text-indent="-8cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h2_i0" style:display-name="Hang 2 Indent 0" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-indent="2cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h2_i1" style:display-name="Hang 2 Indent 1" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="1cm" fo:margin-right="0cm" fo:text-indent="1cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h2_i2" style:display-name="Hang 2 Indent 2" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="2cm" fo:margin-right="0cm" fo:text-indent="0cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h2_i3" style:display-name="Hang 2 Indent 3" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="3cm" fo:margin-right="0cm" fo:text-indent="-1cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h2_i4" style:display-name="Hang 2 Indent 4" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="4cm" fo:margin-right="0cm" fo:text-indent="-2cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h2_i5" style:display-name="Hang 2 Indent 5" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="5cm" fo:margin-right="0cm" fo:text-indent="-3cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h2_i6" style:display-name="Hang 2 Indent 6" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="6cm" fo:margin-right="0cm" fo:text-indent="-4cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h2_i7" style:display-name="Hang 2 Indent 7" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="7cm" fo:margin-right="0cm" fo:text-indent="-5cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h2_i8" style:display-name="Hang 2 Indent 8" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="8cm" fo:margin-right="0cm" fo:text-indent="-6cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h2_i9" style:display-name="Hang 2 Indent 9" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="9cm" fo:margin-right="0cm" fo:text-indent="-7cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h3_i0" style:display-name="Hang 3 Indent 0" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-indent="3cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h3_i1" style:display-name="Hang 3 Indent 1" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="1cm" fo:margin-right="0cm" fo:text-indent="2cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h3_i2" style:display-name="Hang 3 Indent 2" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="2cm" fo:margin-right="0cm" fo:text-indent="1cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h3_i3" style:display-name="Hang 3 Indent 3" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="3cm" fo:margin-right="0cm" fo:text-indent="0cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h3_i4" style:display-name="Hang 3 Indent 4" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="4cm" fo:margin-right="0cm" fo:text-indent="-1cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h3_i5" style:display-name="Hang 3 Indent 5" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="5cm" fo:margin-right="0cm" fo:text-indent="-2cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h3_i6" style:display-name="Hang 3 Indent 6" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="6cm" fo:margin-right="0cm" fo:text-indent="-3cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h3_i7" style:display-name="Hang 3 Indent 7" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="7cm" fo:margin-right="0cm" fo:text-indent="-4cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h3_i8" style:display-name="Hang 3 Indent 8" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="8cm" fo:margin-right="0cm" fo:text-indent="-5cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h3_i9" style:display-name="Hang 3 Indent 9" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="9cm" fo:margin-right="0cm" fo:text-indent="-6cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h4_i0" style:display-name="Hang 4 Indent 0" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-indent="4cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h4_i1" style:display-name="Hang 4 Indent 1" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="1cm" fo:margin-right="0cm" fo:text-indent="3cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h4_i2" style:display-name="Hang 4 Indent 2" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="2cm" fo:margin-right="0cm" fo:text-indent="2cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h4_i3" style:display-name="Hang 4 Indent 3" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="3cm" fo:margin-right="0cm" fo:text-indent="1cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h4_i4" style:display-name="Hang 4 Indent 4" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="4cm" fo:margin-right="0cm" fo:text-indent="0cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h4_i5" style:display-name="Hang 4 Indent 5" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="5cm" fo:margin-right="0cm" fo:text-indent="-1cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h4_i6" style:display-name="Hang 4 Indent 6" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="6cm" fo:margin-right="0cm" fo:text-indent="-2cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h4_i7" style:display-name="Hang 4 Indent 7" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="7cm" fo:margin-right="0cm" fo:text-indent="-3cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h4_i8" style:display-name="Hang 4 Indent 8" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="8cm" fo:margin-right="0cm" fo:text-indent="-4cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h4_i9" style:display-name="Hang 4 Indent 9" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="9cm" fo:margin-right="0cm" fo:text-indent="-5cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h5_i0" style:display-name="Hang 5 Indent 0" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-indent="5cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h5_i1" style:display-name="Hang 5 Indent 1" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="1cm" fo:margin-right="0cm" fo:text-indent="4cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h5_i2" style:display-name="Hang 5 Indent 2" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="2cm" fo:margin-right="0cm" fo:text-indent="3cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h5_i3" style:display-name="Hang 5 Indent 3" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="3cm" fo:margin-right="0cm" fo:text-indent="2cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h5_i4" style:display-name="Hang 5 Indent 4" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="4cm" fo:margin-right="0cm" fo:text-indent="1cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h5_i5" style:display-name="Hang 5 Indent 5" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="5cm" fo:margin-right="0cm" fo:text-indent="0cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h5_i6" style:display-name="Hang 5 Indent 6" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="6cm" fo:margin-right="0cm" fo:text-indent="-1cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h5_i7" style:display-name="Hang 5 Indent 7" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="7cm" fo:margin-right="0cm" fo:text-indent="-2cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h5_i8" style:display-name="Hang 5 Indent 8" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="8cm" fo:margin-right="0cm" fo:text-indent="-3cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h5_i9" style:display-name="Hang 5 Indent 9" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="9cm" fo:margin-right="0cm" fo:text-indent="-4cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h6_i0" style:display-name="Hang 6 Indent 0" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-indent="6cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h6_i1" style:display-name="Hang 6 Indent 1" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="1cm" fo:margin-right="0cm" fo:text-indent="5cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h6_i2" style:display-name="Hang 6 Indent 2" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="2cm" fo:margin-right="0cm" fo:text-indent="4cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h6_i3" style:display-name="Hang 6 Indent 3" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="3cm" fo:margin-right="0cm" fo:text-indent="3cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h6_i4" style:display-name="Hang 6 Indent 4" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="4cm" fo:margin-right="0cm" fo:text-indent="2cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h6_i5" style:display-name="Hang 6 Indent 5" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="5cm" fo:margin-right="0cm" fo:text-indent="1cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h6_i6" style:display-name="Hang 6 Indent 6" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="6cm" fo:margin-right="0cm" fo:text-indent="0cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h6_i7" style:display-name="Hang 6 Indent 7" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="7cm" fo:margin-right="0cm" fo:text-indent="-1cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h6_i8" style:display-name="Hang 6 Indent 8" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="8cm" fo:margin-right="0cm" fo:text-indent="-2cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h6_i9" style:display-name="Hang 6 Indent 9" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="9cm" fo:margin-right="0cm" fo:text-indent="-3cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h7_i0" style:display-name="Hang 7 Indent 0" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-indent="7cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h7_i1" style:display-name="Hang 7 Indent 1" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="1cm" fo:margin-right="0cm" fo:text-indent="6cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h7_i2" style:display-name="Hang 7 Indent 2" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="2cm" fo:margin-right="0cm" fo:text-indent="5cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h7_i3" style:display-name="Hang 7 Indent 3" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="3cm" fo:margin-right="0cm" fo:text-indent="4cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h7_i4" style:display-name="Hang 7 Indent 4" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="4cm" fo:margin-right="0cm" fo:text-indent="3cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h7_i5" style:display-name="Hang 7 Indent 5" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="5cm" fo:margin-right="0cm" fo:text-indent="2cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h7_i6" style:display-name="Hang 7 Indent 6" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="6cm" fo:margin-right="0cm" fo:text-indent="1cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h7_i7" style:display-name="Hang 7 Indent 7" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="7cm" fo:margin-right="0cm" fo:text-indent="0cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h7_i8" style:display-name="Hang 7 Indent 8" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="8cm" fo:margin-right="0cm" fo:text-indent="-1cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h7_i9" style:display-name="Hang 7 Indent 9" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="9cm" fo:margin-right="0cm" fo:text-indent="-2cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h8_i0" style:display-name="Hang 8 Indent 0" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-indent="8cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h8_i1" style:display-name="Hang 8 Indent 1" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="1cm" fo:margin-right="0cm" fo:text-indent="7cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h8_i2" style:display-name="Hang 8 Indent 2" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="2cm" fo:margin-right="0cm" fo:text-indent="6cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h8_i3" style:display-name="Hang 8 Indent 3" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="3cm" fo:margin-right="0cm" fo:text-indent="5cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h8_i4" style:display-name="Hang 8 Indent 4" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="4cm" fo:margin-right="0cm" fo:text-indent="4cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h8_i5" style:display-name="Hang 8 Indent 5" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="5cm" fo:margin-right="0cm" fo:text-indent="3cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h8_i6" style:display-name="Hang 8 Indent 6" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="6cm" fo:margin-right="0cm" fo:text-indent="2cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h8_i7" style:display-name="Hang 8 Indent 7" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="7cm" fo:margin-right="0cm" fo:text-indent="1cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h8_i8" style:display-name="Hang 8 Indent 8" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="8cm" fo:margin-right="0cm" fo:text-indent="0cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h8_i9" style:display-name="Hang 8 Indent 9" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="9cm" fo:margin-right="0cm" fo:text-indent="-1cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h9_i0" style:display-name="Hang 9 Indent 0" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-indent="9cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h9_i1" style:display-name="Hang 9 Indent 1" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="1cm" fo:margin-right="0cm" fo:text-indent="8cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h9_i2" style:display-name="Hang 9 Indent 2" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="2cm" fo:margin-right="0cm" fo:text-indent="7cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h9_i3" style:display-name="Hang 9 Indent 3" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="3cm" fo:margin-right="0cm" fo:text-indent="6cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h9_i4" style:display-name="Hang 9 Indent 4" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="4cm" fo:margin-right="0cm" fo:text-indent="5cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h9_i5" style:display-name="Hang 9 Indent 5" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="5cm" fo:margin-right="0cm" fo:text-indent="4cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h9_i6" style:display-name="Hang 9 Indent 6" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="6cm" fo:margin-right="0cm" fo:text-indent="3cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h9_i7" style:display-name="Hang 9 Indent 7" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="7cm" fo:margin-right="0cm" fo:text-indent="2cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h9_i8" style:display-name="Hang 9 Indent 8" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="8cm" fo:margin-right="0cm" fo:text-indent="1cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="P_h9_i9" style:display-name="Hang 9 Indent 9" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"><style:paragraph-properties fo:margin-left="9cm" fo:margin-right="0cm" fo:text-indent="0cm" style:auto-text-indent="false"><style:tab-stops><style:tab-stop style:position="0cm"/></style:tab-stops></style:paragraph-properties></style:style>
+ <style:style style:name="Span_bold" style:family="text"><style:text-properties fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold"/></style:style>
+ <style:style style:name="Span_italic" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic"/></style:style>
+ <style:style style:name="Span_underscore" style:family="text"><style:text-properties style:text-underline-style="solid" style:text-underline-width="auto" style:text-underline-color="font-color"/></style:style>
+ <style:style style:name="Span_superscript" style:family="text"><style:text-properties style:text-position="super 58%"/></style:style>
+ <style:style style:name="Span_subscript" style:family="text"><style:text-properties style:text-position="sub 58%"/></style:style>
+ <style:style style:name="Span_monospace" style:family="text"><style:text-properties style:font-name="DejaVu Sans Mono" fo:font-size="10pt" fo:font-weight="normal" fo:background-color="#e6e6e6"/></style:style>
+ <style:style style:name="Heading" style:family="paragraph" style:next-style-name="Text_body" style:class="text"> <style:paragraph-properties fo:margin-top="0.423cm" fo:margin-bottom="0.212cm" fo:keep-with-next="always"/><style:text-properties style:font-name="Bitstream Vera Sans" fo:font-size="14pt" style:font-size-asian="14pt" style:font-name-complex="Tahoma" style:font-size-complex="14pt"/></style:style>
+ <style:style style:name="H_1" style:display-name="Heading 1" style:family="paragraph" style:next-style-name="Text_body" style:default-outline-level="1" style:class="text"><style:text-properties fo:font-size="120%" fo:font-weight="bold" style:font-size-asian="120%" style:font-weight-asian="bold" style:font-size-complex="115%" style:font-weight-complex="bold"/></style:style>
+ <style:style style:name="H_2" style:display-name="Heading 2" style:family="paragraph" style:next-style-name="Text_body" style:default-outline-level="2" style:class="text"><style:text-properties fo:font-size="115%" fo:font-weight="bold" style:font-size-asian="115%" style:font-weight-asian="bold" style:font-size-complex="115%" style:font-weight-complex="bold"/></style:style>
+ <style:style style:name="H_3" style:display-name="Heading 3" style:family="paragraph" style:next-style-name="Text_body" style:default-outline-level="3" style:class="text"><style:text-properties fo:font-size="110%" fo:font-weight="bold" style:font-size-asian="110%" style:font-weight-asian="bold" style:font-size-complex="115%" style:font-weight-complex="bold"/></style:style>
+ <style:style style:name="H_4" style:display-name="Heading 4" style:family="paragraph" style:next-style-name="Text_body" style:default-outline-level="4" style:class="text"><style:text-properties fo:font-size="12pt" fo:font-style="italic" fo:font-weight="bold" style:font-size-asian="12pt" style:font-style-asian="italic" style:font-weight-asian="bold" style:font-size-complex="12pt" style:font-style-complex="italic" style:font-weight-complex="bold"/></style:style>
+ <style:style style:name="H_5" style:display-name="Heading 5" style:family="paragraph" style:next-style-name="Text_body" style:default-outline-level="5" style:class="text"><style:text-properties fo:font-size="90%" fo:font-style="italic" fo:font-weight="bold" style:font-size-asian="90%" style:font-style-asian="italic" style:font-weight-asian="bold" style:font-size-complex="90%" style:font-style-complex="italic" style:font-weight-complex="bold"/></style:style>
+ <style:style style:name="H_6" style:display-name="Heading 6" style:family="paragraph" style:next-style-name="Text_body" style:default-outline-level="6" style:class="text"><style:text-properties fo:font-size="80%" fo:font-style="italic" fo:font-weight="bold" style:font-size-asian="80%" style:font-style-asian="italic" style:font-weight-asian="bold" style:font-size-complex="80%" style:font-style-complex="italic" style:font-weight-complex="bold"/></style:style>
+ <style:style style:name="P_group" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0cm" fo:line-height="100%" fo:text-align="justify" style:justify-single-word="false"/></style:style>
+ <style:style style:name="P_code" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0cm" fo:line-height="100%" fo:text-align="start" style:justify-single-word="false"/><style:text-properties style:font-name="DejaVu Sans Mono" fo:font-size="9pt" fo:font-weight="normal" fo:background-color="#e6e6e6"/></style:style>
+ <style:style style:name="Footnote" style:family="paragraph" style:class="extra"><style:paragraph-properties fo:margin-left="0.499cm" fo:margin-right="0cm" fo:text-indent="-0.499cm" style:auto-text-indent="false" text:number-lines="false" text:line-number="0"/> <style:text-properties fo:font-size="10pt" style:font-size-asian="10pt" style:font-size-complex="10pt"/></style:style>
+ <style:style style:name="Table_Contents" style:display-name="Table Contents" style:family="paragraph" style:parent-style-name="Standard" style:class="extra"><style:paragraph-properties text:number-lines="false" text:line-number="0"/></style:style>
+ <style:style style:name="Footnote_symbol" style:display-name="Footnote Symbol" style:family="text"/>
+ <style:style style:name="Footnote_anchor" style:display-name="Footnote Anchor" style:family="text"><style:text-properties style:text-position="super 58%"/></style:style>
+ <style:style style:name="Internet_link" style:display-name="Internet link" style:family="text"><style:text-properties fo:color="#000080" fo:language="zxx" fo:country="none" style:text-underline-style="solid" style:text-underline-width="auto" style:text-underline-color="font-color" style:language-asian="zxx" style:country-asian="none" style:language-complex="zxx" style:country-complex="none"/></style:style>
+ <style:style style:name="Graphics" style:family="graphic"><style:graphic-properties text:anchor-type="paragraph" svg:x="0cm" svg:y="0cm" style:wrap="dynamic" style:number-wrapped-paragraphs="no-limit" style:wrap-contour="false" style:vertical-pos="top" style:vertical-rel="paragraph" style:horizontal-pos="center" style:horizontal-rel="paragraph"/></style:style>
+ <text:outline-style style:name="Outline"><text:outline-level-style text:level="1" style:num-format=""><style:list-level-properties text:min-label-distance="0.381cm"/></text:outline-level-style>
+ <text:outline-level-style text:level="2" style:num-format=""><style:list-level-properties text:min-label-distance="0.381cm"/></text:outline-level-style>
+ <text:outline-level-style text:level="3" style:num-format=""><style:list-level-properties text:min-label-distance="0.381cm"/></text:outline-level-style>
+ <text:outline-level-style text:level="4" style:num-format=""><style:list-level-properties text:min-label-distance="0.381cm"/></text:outline-level-style>
+ <text:outline-level-style text:level="5" style:num-format=""><style:list-level-properties text:min-label-distance="0.381cm"/></text:outline-level-style>
+ <text:outline-level-style text:level="6" style:num-format=""><style:list-level-properties text:min-label-distance="0.381cm"/></text:outline-level-style>
+ <text:outline-level-style text:level="7" style:num-format=""><style:list-level-properties text:min-label-distance="0.381cm"/></text:outline-level-style>
+ <text:outline-level-style text:level="8" style:num-format=""><style:list-level-properties text:min-label-distance="0.381cm"/></text:outline-level-style>
+ <text:outline-level-style text:level="9" style:num-format=""><style:list-level-properties text:min-label-distance="0.381cm"/></text:outline-level-style>
+ <text:outline-level-style text:level="10" style:num-format=""><style:list-level-properties text:min-label-distance="0.381cm"/></text:outline-level-style>
+ </text:outline-style>
+ <text:notes-configuration text:note-class="footnote" text:citation-style-name="Footnote_symbol" text:citation-body-style-name="Footnote_anchor" style:num-format="1" text:start-value="0" text:footnotes-position="page" text:start-numbering-at="document"/>
+ <text:notes-configuration text:note-class="endnote" style:num-format="i" text:start-value="0"/>
+ <text:linenumbering-configuration text:number-lines="false" text:offset="0.499cm" style:num-format="1" text:number-position="left" text:increment="5"/>
+ <style:style style:name="fr1" style:family="graphic" style:parent-style-name="Graphics"><style:graphic-properties style:wrap="none" style:horizontal-pos="left" style:horizontal-rel="paragraph" style:mirror="none" fo:clip="rect(0cm 0cm 0cm 0cm)" draw:luminance="0%" draw:contrast="0%" draw:red="0%" draw:green="0%" draw:blue="0%" draw:gamma="100%" draw:color-inversion="false" draw:image-opacity="100%" draw:color-mode="standard"/></style:style>
+ <style:style style:name="gr1" style:family="graphic"><style:graphic-properties draw:stroke="none" draw:fill="none" draw:textarea-horizontal-align="center" draw:textarea-vertical-align="middle" draw:color-mode="standard" draw:luminance="0%" draw:contrast="0%" draw:gamma="100%" draw:red="0%" draw:green="0%" draw:blue="0%" fo:clip="rect(0cm 0cm 0cm 0cm)" draw:image-opacity="100%" style:mirror="none" style:run-through="background" style:wrap="none" style:vertical-pos="top" style:vertical-rel="baseline" style:horizontal-pos="left" style:horizontal-rel="paragraph" draw:wrap-influence-on-position="once-concurrent" style:flow-with-text="false"/></style:style>
+ <style:style style:name="gr2" style:family="graphic"><style:graphic-properties draw:stroke="none" draw:fill="none" draw:textarea-horizontal-align="center" draw:textarea-vertical-align="middle" draw:color-mode="standard" draw:luminance="0%" draw:contrast="0%" draw:gamma="100%" draw:red="0%" draw:green="0%" draw:blue="0%" fo:clip="rect(0cm 0cm 0cm 0cm)" draw:image-opacity="100%" style:mirror="none" style:run-through="background" style:wrap="none" style:vertical-pos="middle" style:vertical-rel="baseline" style:horizontal-pos="left" style:horizontal-rel="paragraph" draw:wrap-influence-on-position="once-concurrent" style:flow-with-text="false"/></style:style>
+ </office:styles>
+ <office:automatic-styles>
+ <style:page-layout style:name="Mpm1">
+ <style:page-layout-properties fo:page-width="20.999cm" fo:page-height="29.699cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:footnote-max-height="0cm">
+ <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="none" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
+ </style:page-layout-properties>
+ <style:header-style/>
+ <style:footer-style/>
+ </style:page-layout>
+ </office:automatic-styles>
+ <office:master-styles>
+ <style:master-page style:name="Standard" style:page-layout-name="Mpm1"/>
+ </office:master-styles>
+</office:document-styles>
+WOK
+ x=x.strip
+ x=x.gsub(/\n+/m,'') unless @md.opt.cmd=~/M/
+ x
+ end
+ def mimetype
+ x=<<WOK
+application/vnd.oasis.opendocument.text
+WOK
+ x=x.strip
+ end
+ end
+ class FormatObjBreak
+ def initialize(md,t_o)
+ @md,@t_o=md,t_o
+ end
+ def br_page
+ @t_o.obj='<text:p text:style-name="P_page_break"> </text:p>'
+ @t_o
+ end
+ def obj_sep #center later
+ sep='--- '
+ @t_o.obj=%{<text:p text:style-name="P_normal">#{sep*20}</text:p>}
+ @t_o
+ end
+ end
+ class XML
+ end
+end
+__END__
diff --git a/lib/sisu/v4/options.rb b/lib/sisu/v4/options.rb
new file mode 100644
index 00000000..b26bada2
--- /dev/null
+++ b/lib/sisu/v4/options.rb
@@ -0,0 +1,966 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: SiSU information Structuring Universe, command line options
+ parsing
+
+=end
+module SiSU_Commandline
+ require 'pathname'
+ require_relative 'sysenv' # sysenv.rb
+ require_relative 'param_make' # param_make.rb
+ @@sisu_call_origin_path=nil
+ class HeaderCommon
+ def initialize(make_instruct_array)
+ @make_instruct_array=make_instruct_array
+ end
+ def sisu_document_make_instructions
+ @pagenew=@pagebreak=@toc=@lv1=@lv2=@lv3=@lv4=@lv5=@lv6=@num_top=@i18n=@man_section=@emphasis_set_to=@bold_match_list=@italics_match_list=@substitution_match_list=@footer_links=@home_button_links=@links=nil
+ @makeset=false
+ if @make_instruct_array
+ @make_instruct_array.each do |para| #% scan document
+ if para =~/^(?:@make:|@links:)[+-]?\s/
+ case para
+ when /^@make:(.+)/m #% header processing - make
+ @env=SiSU_Env::InfoEnv.new
+ @make=SiSU_Param_Make::MdMake.new($1.strip,@opt,@env).make
+ makes=SiSU_Param_Make::MakeHead.new(@make).make_instruct
+ @makeset=true
+ @pagenew=makes[:pagenew]
+ @pagebreak=makes[:pagenew]
+ @toc=makes[:toc]
+ @lv1=makes[:lv1]
+ @lv2=makes[:lv2]
+ @lv3=makes[:lv3]
+ @lv4=makes[:lv4]
+ @lv5=makes[:lv5]
+ @lv6=makes[:lv6]
+ @num_top=makes[:num_top]
+ @i18n=makes[:i18n]
+ @man_section=makes[:man_section]
+ @emphasis_set_to=makes[:emphasis_set_to]
+ @bold_match_list=makes[:bold_match_list]
+ @italics_match_list=makes[:italics_match_list]
+ @substitution_match_list=makes[:substitution_match_list]
+ @footer_links=makes[:footer_links]
+ @home_button_links=makes[:home_button_links]
+ @home_button_image=makes[:home_button_image]
+ @cover_image=makes[:cover_image]
+ when /^@links:(.+)/m #% header processing - make
+ make_links=SiSU_Param::Parameters::MdMake.new($1.strip,@opt,@env).make_links
+ @links,@links_append=make_links.links,make_links.append?
+ end
+ end
+ end #% here endeth the common header loop
+ end
+ { makeset: @makeset,
+ pagenew: @pagenew,
+ pagebreak: @pagebreak,
+ toc: @toc,
+ lv1: @lv1,
+ lv2: @lv2,
+ lv3: @lv3,
+ lv4: @lv4,
+ lv5: @lv5,
+ lv6: @lv6,
+ num_top: @num_top,
+ i18n: @i18n,
+ man_section: @man_section,
+ emphasis_set_to: @emphasis_set_to,
+ bold_match_list: @bold_match_list,
+ italics_match_list: @italics_match_list,
+ substitution_match_list: @substitution_match_list,
+ footer_links: @footer_links,
+ home_button_links: @home_button_links,
+ home_button_image: @home_button_image,
+ cover_image: @cover_image,
+ links: @links,
+ links_append: @links_append
+ }
+ end
+ end
+ class Options
+ attr_accessor :cmd,:mod,:act,:dir_structure_by,:f_pths,:files,:files_mod,:base_path,:base_stub,:sub_location,:paths,:lngs,:f_pth,:pth,:fno,:fns,:fnb,:fnc,:fng,:fncb,:lng,:lng_base,:what,:make_instructions,:make_instructions_pod
+ @@act=nil
+ def initialize(a)
+ @cmd,@f_pth,@pth,@fno,@fns,@fnb,@fnc,@fng,@fncb,@what,@lng,@lng_base,@base_path,@base_stub,@sub_location='','','','','','','','','','','','','',''
+ @f_pths,@files,@files_mod,@paths,@mod,@act=Array.new(5){[]}
+ @env=SiSU_Env::InfoEnv.new
+ @lng_base=@env.language_default_set
+ @dir_structure_by=SiSU_Env::EnvCall.new.output_dir_structure.by?
+ @@sisu_call_origin_path ||=Dir.pwd
+ @base_path=@@sisu_call_origin_path
+ r=Px[:lng_lst_rgx]
+ u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/
+ @base_stub=@base_path.gsub(u,'\1')
+ @a=sisu_glob_rules(a)
+ @a.freeze
+ make_instruct_array=SiSU_Env::GetInit.new.sisu_document_make.makefile_read
+ @make_instructions=HeaderCommon.new(make_instruct_array).sisu_document_make_instructions
+ @make_instructions_pod=nil
+ init
+ end
+ def find_all(find_flag,opt)
+ if find_flag
+ pwd_set=Dir.pwd
+ x=Dir.glob('*.ss[tm]')
+ Px[:lng_lst].each do |d|
+ if FileTest.directory?(d)
+ x << Dir.glob("#{d}/*.ss[tm]")
+ end
+ end
+ x=x.flatten
+ opt + x
+ end
+ end
+ def find_select(find_flag,opt)
+ if find_flag
+ pwd_set=Dir.pwd
+ x=[]
+ if opt.inspect =~/"[a-zA-Z][a-zA-Z0-9._-]+?"/
+ opt.each do |g|
+ x <<=if g =~/.ss[tm]/
+ Dir.glob("*#{g}")
+ else
+ Dir.glob("*#{g}*.ss[tm]")
+ end
+ Px[:lng_lst].each do |d|
+ if FileTest.directory?(d)
+ x <<=if g =~/.ss[tm]/
+ Dir.glob("#{d}/*#{g}")
+ else
+ Dir.glob("#{d}/*#{g}*.ss[tm]")
+ end
+ end
+ end
+ end
+ end
+ x.flatten
+ end
+ end
+ def sisu_glob_rules(a)
+ a=if a.inspect =~/"-[A-Za-z0-9]*[fG]/ \
+ or a.inspect =~/"--find"|"--glob"/
+ b,f=[],[]
+ find_flag=false
+ a.each do |y|
+ if y =~ /^-/
+ if y =~/^-/ \
+ && y =~/[fG]|--find|--glob/
+ find_flag=true
+ end
+ b << y
+ end
+ if find_flag \
+ && y !~ /^-/ \
+ && y =~ /\S+/
+ if y !~/\//
+ f << y
+ else
+ find_flag=false
+ puts %{sub-directories "#{y}" cannot be provided for --find or --glob at this time}
+ end
+ end
+ end
+ r=Px[:lng_lst_rgx].gsub(/\|#{@lng_base}\|/,'|')
+ @lang_regx=%r{(?:#{r})}
+ z=if find_flag
+ (f.length > 0) \
+ ? (b + find_select(find_flag,f))
+ : find_all(find_flag,b)
+ elsif a.inspect =~/"(?:-\S+?|--\S+?)"/ \
+ && a.inspect =~/"#{@lang_regx}\/?"/ \
+ && a.inspect =~/"#{@lng_base}\/\S+?\.ss[tm]"/
+ init_selected_lang_dirs(a)
+ else b
+ end
+ else a
+ end
+ end
+ def init_selected_lang_dirs(a)
+ @z=[]
+ a.each do |y|
+ if y =~/^#{@lng_base}\/(\S+?\.ss[tm])$/
+ @fn=$1
+ @z << y
+ elsif y =~/^#{@lang_regx}\/?$/
+ @z << "#{y}/#{@fn}"
+ else @z << y
+ end
+ end
+ @z
+ end
+ def init
+ a=@a
+ if a.length > 0
+ s=expand_numeric_shortcuts(a)
+ q=set_files_and_paths_and_general_extract(s)
+ @cmd,@mod=opt_cmd_and_mod_adjust(q[:cmd],q[:mod])
+ @what=q[:what] unless q[:what].empty?
+ @paths = q[:paths]
+ @files = q[:files]
+ @f_pths = q[:f_pths]
+ @lngs = q[:lngs]
+ if @files.length > 0 \
+ and @cmd.empty? \
+ and @mod.length==0 #% if no other action called on filename given, default is sisu --v4 -0 [filename(s)] configured as flag default
+ shortcut=SiSU_Env::InfoProcessingFlag.new
+ @mod=['--v4']
+ @cmd=shortcut.cf_0 + 'm'
+ end
+ if @cmd =~/[vVM]/ \
+ && @cmd !~/-vu?$/
+ SiSU_Screen::Ansi.new(@cmd,"\tsisu " + @cmd + ' ' + @mod.join(' ') + ' ' + @files.join(' ') + "\n").print_brown
+ end
+ end
+# @files=@files.uniq
+ @@act ? @act=@@act : @@act=@act=opt_act
+ @files
+ self
+ end
+ def sisu_document_make_pod
+ def makefile_name
+ SiSU_Env::GetInit.new.sisu_document_make.makefile_name
+ end
+ def makefile(pod_make_path)
+ "#{pod_make_path}/#{makefile_name}"
+ end
+ def makefile_read(pod_make_path)
+ f=if FileTest.file?(makefile(pod_make_path))
+ sisu_doc_makefile=IO.read(makefile(pod_make_path), mode: 'r:utf-8')
+ sisu_doc_makefile.split(/\s*\n\s*\n/m)
+ else nil
+ end
+ end
+ self
+ end
+ def set_files_and_paths_and_general_extract(s)
+ c,w='',''
+ m,f,pth,z,lng,lngs=[],[],[],[],[],[]
+ lng_is=''
+ a=s.split(/\s+/)
+ r_l=Px[:lng_lst].join('|')
+ a.uniq.each do |x|
+ if x =~/^-[a-z0-5]+/i \
+ or x =~/^--\S+/
+ if x =~/^-([a-z0-5]+)/i
+ c << $1
+ end
+ if x =~/^--\S+/
+ m << x
+ end
+ elsif x =~ /(?:\.(?:(?:-|ssm\.)?sst(?:\.xml)?|ssm|ssi|sx[sdn]\.xml|s[1-3]|kdi|ssp)|\S+?\.ss[mt]\.(?:txz|zip)|sisupod\.(?:txz|zip))$/
+ if x =~/\S+?\.ss[mt]\.(?:txz|zip)|sisupod\.(?:txz|zip)/
+ if x =~/^(?:https?|file):\/\/\S+/ #\
+ end
+ pwd=Dir.pwd
+ fn_pod=x.gsub(/([^\/]+)\.txz$/,'\1')
+ fullname=@env.processing_path.processing + '/sisupod/' + fn_pod
+ pt=Pathname.new(fullname)
+ FileUtils::mkdir_p(pt.to_s)
+ pod_make_path=fullname + '/sisupod/doc/_sisu'
+ pod_make_path_file=pod_make_path
+ make_instruct_array=sisu_document_make_pod.makefile_read(pod_make_path)
+ @make_instructions_pod=HeaderCommon.new(make_instruct_array).sisu_document_make_instructions
+ Dir.chdir(pt.realpath)
+ options=s.gsub(/(\s+--?\S+)+.+/,'\1')
+ system("
+ chdir #{fullname}
+ tar xaf #{pwd}/#{x}
+ chdir #{pwd}
+ ")
+ Dir.chdir(pt.realpath.to_s + '/sisupod/doc')
+ r=Px[:lng_lst_rgx]
+ Dir.entries("#{fullname}/sisupod/doc").each do |d_lng|
+ if d_lng =~/^(?:#{r})$/
+ Dir.chdir(pt.realpath.to_s + "/sisupod/doc/#{d_lng}")
+ filenames=Dir.glob("*.ss[mt]")
+ filenames.each do |fn|
+ f_pths << {
+ pth: "#{fullname}/sisupod/doc/#{d_lng}",
+ f: "#{fn}",
+ pth_stub: 'doc',
+ lng: d_lng,
+ lng_is: d_lng,
+ url_base: '',
+ url: ''
+ }
+ Dir.chdir(pwd)
+ f << fn
+ end
+ end
+ end
+ elsif x =~/^(?:https?|file):\/\/\S+/ \
+ and x =~/\S+?\.ss[mt]$/
+ r_url=/(http:\/\/\S+?\/\S+?\/src(?:\/(?:#{r_l}))?)\//
+ url_base = (x[r_url,1])
+ url = x
+ y=x.gsub(/http:\/\/\S+?\/\S+?\/src\//,'')
+ t=/(#{r_l})\/[^\/]+?\.ss[tm]$/
+ l_p = (y[t,1]) \
+ ? y[t,1]
+ : nil
+ lng << l_p
+ lngs << if l_p
+ l_p
+ elsif x =~/~(#{r_l})\.ss[tm]/
+ $1
+ else lng_base
+ end
+ r_f=/(?:#{r_l})\/([^\/]+?\.ss[tm])$/
+ fn = (y[r_f,1]) \
+ ? y[r_f,1]
+ : y
+ fn=fn.gsub(/\.((?:ssm\.)?sst)/,'.-\1')
+ fullname=Dir.pwd + '/' + fn
+ pt=Pathname.new(fullname)
+ pth << Dir.pwd
+ r_u=/.+?\/([^\/]+)(?:\/(?:#{r_l})$|$)/
+ lng_is =if l_p
+ l_p
+ elsif x =~/~(#{r_l})\.ss[tm]/
+ $1
+ else lng_base
+ end
+ f_pths << {
+ pth: pt.split[0].realpath.to_s,
+ f: pt.split[1].to_s,
+ pth_stub: pt.split[0].realpath.to_s[r_u,1],
+ lng: (pt.split[0].realpath.to_s[t,1]) \
+ ? pt.split[0].realpath.to_s[t,1]
+ : nil,
+ lng_is: lng_is,
+ url_base: url_base,
+ url: url
+ }
+ f << fn
+ elsif FileTest.file?(x)
+ pt=Pathname.new(x)
+ pth << pt.split[0].realpath.to_s #remove?
+ f << pt.split[1].to_s #remove?
+ r_u=/.+?\/([^\/]+)(?:\/(?:#{r_l})$|$)/
+ t=/.+\/(#{r_l})$/
+ l_p = (pt.split[0].realpath.to_s[t,1]) \
+ ? pt.split[0].realpath.to_s[t,1]
+ : nil
+ lngs << lng_is = if l_p
+ l_p
+ elsif x =~/~(#{r_l})\.ss[tm]/
+ $1
+ else lng_base
+ end
+ f_pths << {
+ pth: pt.split[0].realpath.to_s,
+ f: pt.split[1].to_s,
+ pth_stub: pt.split[0].realpath.to_s[r_u,1],
+ lng: lng_is,
+ lng_is: lng_is,
+ url_base: nil,
+ url: nil
+ }
+ else puts "file not found: #{x}"
+ end
+ elsif x =~ /\.termsheet\.rb$/
+ (FileTest.file?(x)) \
+ ? (f << x)
+ : (puts "file not found: #{x}")
+ else w=x
+ puts "#{x} in #{a.join(' ')}?"
+ end
+ end
+ { cmd: c, mod: m, what: w, paths: pth, files: f, f_pths: f_pths, lng: lng_is, lngs: lngs }
+ end
+ def expand_numeric_shortcuts(a)
+ shortcut=SiSU_Env::InfoProcessingFlag.new
+ s=''
+ a.each do |x|
+ y=case x
+ when /0/
+ (x=~/^-1\S+/) \
+ ? x.gsub(/^-0(\S+)/,shortcut.cf_0 + ' -\1')
+ : x.gsub(/^-0/,shortcut.cf_0 + ' ')
+ when /1/
+ (x=~/^-1\S+/) \
+ ? x.gsub(/^-1(\S+)/,shortcut.cf_1 + ' -\1')
+ : x.gsub(/^-1/,shortcut.cf_1 + ' ')
+ when /2/
+ (x=~/^-2\S+/) \
+ ? x.gsub(/^-2(\S+)/,shortcut.cf_2 + ' -\1')
+ : x.gsub(/^-2/,shortcut.cf_2 + ' ')
+ when /3/
+ (x=~/^-3\S+/) \
+ ? x.gsub(/^-3(\S+)/,shortcut.cf_3 + ' -\1')
+ : x.gsub(/^-3/,shortcut.cf_3 + ' ')
+ when /4/
+ (x=~/^-4\S+/) \
+ ? x.gsub(/^-4(\S+)/,shortcut.cf_4 + ' -\1')
+ : x.gsub(/^-4/,shortcut.cf_4 + ' ')
+ when /5/
+ (x=~/^-5\S+/) \
+ ? x.gsub(/^-5(\S+)/,shortcut.cf_5 + ' -\1')
+ : x.gsub(/^-5/,shortcut.cf_5 + ' ')
+ when /6/
+ (x=~/^-6\S+/) \
+ ? x.gsub(/^-6(\S+)/,shortcut.cf_5 + ' -\1')
+ : x.gsub(/^-6/,shortcut.cf_5 + ' ')
+ else x
+ end
+ s << " #{y}" unless y.empty?
+ end
+ s.strip!
+ end
+ def opt_cmd_and_mod_adjust(c,m)
+ cmd,mod,files=@cmd,@mod,@files
+ unless m.empty?
+ m.each do |m|
+ case m
+ when /^--(?:color-toggle)$/; c=c+'c'
+ when /^--(?:configure|init-site)$/; c=c+'CC'
+ when /^--(?:dal?|machine|abstraction|abs)$/; c=c+'m'
+ when /^--(?:txt|text|plaintext)$/; c=c+'t'
+ when /^--(?:html)$/; c=c+'h'
+ when /^--(?:epub)$/; c=c+'e'
+ when /^--(?:od[ft])$/; c=c+'o'
+ when /^--(?:pdf)$/; c=c+'p'
+ when /^--(?:concordance|wordmap)$/; c=c+'w'
+ when /^--(?:manpage|man)$/; c=c+'i'
+ when /^--(?:texinfo)$/; c=c+'I'
+ when /^--(?:xhtml)$/; c=c+'b'
+ when /^--(?:xml-sax)$/; c=c+'x'
+ when /^--(?:xml-dom)$/; c=c+'X'
+ when /^--(?:images)$/; c=c+'j'
+ when /^--(?:hash-digests)$/; c=c+'N'
+ when /^--(?:po4a|pot?)$/; c=c+'P'
+ when /^--(?:termsheet)$/; c=c+'T'
+ when /^--(?:manifest)$/; c=c+'y'
+ when /^--(?:qrcode)$/; c=c+'Q'
+ when /^--(?:sqlite)$/; c=c+'d'
+ when /^--(?:pg|pg?sql|postgresql)$/; c=c+'D'
+ when /^--(?:remote|rsync)$/; c=c+'R'
+ when /^--(?:scp)$/; c=c+'r'
+ when /^--(?:source)$/; c=c+'s'
+ when /^--(?:sisupod|pod)$/; c=c+'S'
+ when /^--(?:git)$/; c=c+'g'
+ when /^--(?:urls)$/; c=c+'U'
+ when /^--(?:zap|delete)$/; c=c+'Z'
+ when /^--(?:sample-search-form)$/; c=c+'F'
+ when /^--(?:webserv|webrick)$/; c=c+'W'
+ when /^--(?:profile)$/; c=c+'E'
+ when /^--(?:maintenance|keep-processing-files)$/; c=c+'M'
+ when /^--(?:verbose[=-]3)$/; c=c+'VM'
+ when /^--(?:verbose[=-]2|Verbose|VERBOSE)$/; c=c+'V'
+ when /^--(?:verbose(?:[=-]1)?)$/; c=c+'v'
+ when /^--(?:verbose[=-]0|quiet|silent)$/; c=c+'q'
+ else mod << m #mod only contains command modifiers; commands converted to character
+ end
+ end
+ end
+ ca=[]
+ unless c.empty?
+ c=c.gsub(/-/,'')
+ c.scan(/CC|\S/) {|x| ca << x}
+ cmd= '-' + ca.uniq.join
+ end
+ extra=''
+ if cmd !~/[mn]/
+ extra+=if cmd =~/[abegHhIiNOoPpQTtwXxyz]/ \
+ and cmd !~/[mn]/
+ 'm' #% add dal
+ elsif ((cmd =~/[Dd]/ \
+ or (mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/)) \
+ and mod.inspect !~/(?:remove|(?:(?:re)?create(?:all)?|dropall|drop)$)/) \
+ and cmd !~/[mn]/
+ 'm' #% add dal
+ else ''
+ end
+ end
+ if cmd !~/j/
+ extra+=if cmd =~/[bHhwXxyz]/ \
+ and cmd !~/[j]/
+ 'j' #% copy images
+ else ''
+ end
+ end
+ if cmd !~/y/
+ extra+=if cmd =~/[abeHhIiNopQsSstwXxz]/ \
+ and cmd !~/y/
+ 'ym' #% add manifest
+ elsif (cmd =~/[Dd]/ \
+ or mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/) \
+ and files[0] !~/^remove$/ \
+ and cmd !~/y/
+ 'ym' #% add manifest
+ else ''
+ end
+ end
+ if cmd !~/u/ #% add urls
+ extra+='u'
+ end
+ cmd=cmd + extra
+ cmds=cmd.scan(/CC|\S/)
+ [cmds.uniq.join,mod]
+ end
+ def opt_act #note mod line commands have already been converted to command characters, cmd
+ cmd,mod=@cmd,@mod
+ @@act=if @@act
+ @act=@@act
+ else
+ act={}
+ act[:license]=(cmd =~/L/ \
+ || mod.inspect =~/"--license/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:site_init]=(cmd =~/C/ \
+ || mod.inspect =~/"--init-site"|"--configure"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:rc]=if mod.inspect =~/"--rc=/
+ x=Dir.pwd + '/' + mod.join.gsub(/--rc=/,'')
+ { bool: true, set: :on, inst: x }
+ else
+ { bool: false, set: :na, inst: '' }
+ end
+ act[:processing_path]=if mod.inspect =~/"--processing-path=/
+ base_pth=mod.join(';').gsub(/^.*--processing-path=['"]?(.+?)(?:['"]?;.+)?$/,'\1')
+ { bool: true, set: :on, inst: base_pth }
+ elsif mod.inspect =~/"--processing-path/
+ { bool: true, set: :on, inst: @base_path }
+ else
+ { bool: false, set: :na, inst: nil }
+ end
+ act[:dump]=if mod.inspect =~/"--dump=/
+ base_pth=mod.join(';').gsub(/^.*--dump=['"]?(.+?)(?:['"]?;.+)?$/,'\1')
+ { bool: true, set: :on, inst: base_pth }
+ elsif mod.inspect =~/"--dump/
+ { bool: true, set: :on, inst: @base_path }
+ else
+ { bool: false, set: :na, inst: nil }
+ end
+ act[:redirect]=if mod.inspect =~/"--redirect=/
+ base_pth=mod.join(';').gsub(/^.*--redirect=['"]?(.+?)(?:['"]?;.+)?$/,'\1')
+ { bool: true, set: :on, inst: base_pth }
+ elsif mod.inspect =~/"--redirect/
+ { bool: true, set: :on, inst: @base_path }
+ else
+ { bool: false, set: :na, inst: nil }
+ end
+ act[:verbose]=(cmd =~/v/ \
+ || mod.inspect =~/"--verbose"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:version_info]=(cmd =~/[vVM]/ \
+ || mod.inspect =~/"--verbose"|"--maintenance"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:quiet]=(cmd =~/q/ \
+ || mod.inspect =~/"--quiet"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:color_state]=if mod.inspect =~/"--color-on"|"--color"/
+ { bool: true, set: :on }
+ elsif mod.inspect =~/"--color-off"/
+ { bool: false, set: :off }
+ else { bool: true, set: :na } #fix default color
+ end
+# act[:color_toggle]=if cmd =~/c/ \
+# or mod.inspect =~/"--color-toggle"/
+# true
+# else false
+# end
+ act[:maintenance]=(cmd =~/M/ \
+ || mod.inspect =~/"--maintenance|--keep-processing-files"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:profile]=(cmd =~/E/ \
+ || mod.inspect =~/"--profile"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:switch]=if mod.inspect =~/"--switch-off=/
+ off_list=mod.join(';').gsub(/^.*--switch-off=['"]?(.+?)(?:['"];.+)?$/,'\1')
+ off_list=off_list.scan(/[^,;\s]+/)
+ { bool: false, set: :off, off: off_list}
+ else { bool: true, set: :na, off: [] }
+ end
+ act[:output_by]=if mod.inspect =~/"--(?:output-)?by-language"/
+ { set: :language }
+ elsif mod.inspect =~/"--(?:output-)?by-filename"/
+ { set: :filename }
+ elsif mod.inspect =~/"--(?:output-)?by-filetype"/
+ { set: :filetype }
+ else { set: :na }
+ end
+ act[:ocn]=if mod.inspect =~/"--inc-ocn"/
+ { bool: true, set: :on }
+ elsif mod.inspect =~/"--(?:exc|no)-ocn"/ \
+ || act[:switch][:off].inspect =~/"ocn"/
+ { bool: false, set: :off }
+ else { bool: true, set: :na }
+ end
+ act[:toc]=if mod.inspect =~/"--inc-toc"/
+ { bool: true, set: :on }
+ elsif mod.inspect =~/"--(?:exc|no)-toc"/ \
+ || act[:switch][:off].inspect =~/"toc"/
+ { bool: false, set: :off }
+ else { bool: true, set: :na }
+ end
+ act[:minitoc]=if mod.inspect =~/"--inc-minitoc"/
+ { bool: true, set: :on }
+ elsif mod.inspect =~/"--(?:exc|no)-minitoc"/ \
+ || act[:switch][:off].inspect =~/"minitoc"/
+ { bool: false, set: :off }
+ else { bool: true, set: :na }
+ end
+ act[:manifest]=if mod.inspect =~/"--inc-manifest"/
+ { bool: true, set: :on }
+ elsif mod.inspect =~/"--(?:exc|no)-manifest"/ \
+ || act[:switch][:off].inspect =~/"manifest"/
+ { bool: false, set: :off }
+ elsif act[:manifest]=(cmd =~/y/ \
+ || mod.inspect =~/"--manifest"/)
+ { bool: true, set: :on }
+ else { bool: true, set: :na }
+ end
+ act[:links_to_manifest]=if mod.inspect =~/"--inc-links-to-manifest"|"--inc-manifest-links"/
+ { bool: true, set: :on }
+ elsif mod.inspect =~/"--(?:exc|no)-links-to-manifest"|"--(?:exc|no)-manifest-links"/ \
+ || act[:switch][:off].inspect =~/"links_to_manifest"|"manifest_links"|"--(?:exc|no)-manifest"/ \
+ || mod.inspect =~/"--(?:redirect|dump)/
+ { bool: false, set: :off }
+ else { bool: true, set: :na }
+ end
+ act[:manifest_minitoc]=if mod.inspect =~/"--inc-manifest-minitoc"|"--inc-minitoc"/
+ { bool: true, set: :on }
+ elsif mod.inspect =~/"--(?:exc|no)-manifest-minitoc"|"--(?:exc|no)-minitoc"/ \
+ || act[:switch][:off].inspect =~/"manifest_minitoc"|"minitoc"/
+ #|| mod.inspect =~/"--(?:redirect|dump)/
+ { bool: false, set: :off }
+ else { bool: true, set: :na }
+ end
+ act[:metadata]=if mod.inspect =~/"--inc-metadata"/
+ { bool: true, set: :on }
+ elsif mod.inspect =~/"--(?:exc|no)-metadata"/ \
+ || act[:switch][:off].inspect =~/"metadata"/
+ { bool: false, set: :off }
+ else { bool: true, set: :na }
+ end
+ act[:html_minitoc]=if mod.inspect =~/"--inc-html-minitoc"|"--inc-minitoc"/
+ { bool: true, set: :on }
+ elsif mod.inspect =~/"--(?:exc|no)-html-minitoc"|"--(?:exc|no)-minitoc"/ \
+ || act[:switch][:off].inspect =~/"html_minitoc"|"minitoc"/
+ { bool: false, set: :off }
+ else { bool: true, set: :na }
+ end
+ act[:html_navigation]=if mod.inspect =~/"--inc-html-navigation"|"--inc-navigation"/
+ { bool: true, set: :on }
+ elsif mod.inspect =~/"--(?:exc|no)-html-navigation"|"--(?:exc|no)-navigation"/ \
+ || act[:switch][:off].inspect =~/"html_navigation"|"nav"/
+ { bool: false, set: :off }
+ else { bool: true, set: :na }
+ end
+ act[:html_navigation_bar]=if mod.inspect =~/"--inc-html-navigation-bar"|"--inc-navigation-bar"/
+ { bool: true, set: :on }
+ elsif mod.inspect =~/"--(?:exc|no)-html-navigation-bar"|"--(?:exc|no)-navigation-bar"/ \
+ || act[:switch][:off].inspect =~/"html_navigation_bar"|"navbar"/
+ { bool: false, set: :off }
+ else { bool: true, set: :na }
+ end
+ act[:segsubtoc]=if mod.inspect =~/"--inc-segsubtoc"/
+ { bool: true, set: :on }
+ elsif mod.inspect =~/"--(?:exc|no)-segsubtoc"/ \
+ || act[:switch][:off].inspect =~/"segsubtoc"/
+ { bool: false, set: :off }
+ else { bool: true, set: :na }
+ end
+ act[:search_form]=if mod.inspect =~/"--inc-search-form"/
+ { bool: true, set: :on }
+ elsif mod.inspect =~/"--(?:exc|no)-search-form"/ \
+ || act[:switch][:off].inspect =~/"search_form"|"search"/
+ { bool: false, set: :off }
+ else { bool: true, set: :na }
+ end
+ act[:html_search_form]=if mod.inspect =~/"--inc-html-search-form"|"--inc-search-form"/
+ { bool: true, set: :on }
+ elsif mod.inspect =~/"--(?:exc|no)-html-search-form"|"--(?:exc|no)-search-form"/ \
+ || act[:switch][:off].inspect =~/"html_search_form"|"search_form"|"search"/
+ { bool: false, set: :off }
+ else { bool: true, set: :na }
+ end
+ act[:html_right_pane]=if mod.inspect =~/"--inc-html-right-pane"|"--inc-right-pane"|"--inc-html-right-column"|"--inc-right-column"/
+ { bool: true, set: :on }
+ elsif mod.inspect =~/"--(?:exc|no)-html-right-pane"|"--(?:exc|no)-right-pane"|"--(?:exc|no)-html-right-column"|"--(?:exc|no)-right-column"/ \
+ || act[:switch][:off].inspect =~/"html_right_pane"|"html_right_column"|"promo"/
+ { bool: false, set: :off }
+ else { bool: true, set: :na }
+ end
+ act[:html_top_band]=if mod.inspect =~/"--inc-html-top-band"|"--inc-top-band"/
+ { bool: true, set: :on }
+ elsif mod.inspect =~/"--(?:exc|no)-html-top-band"|"--(?:exc|no)-top-band"/ \
+ || act[:switch][:off].inspect =~/"html-top-band"|"top-band"/
+ { bool: false, set: :off }
+ else { bool: true, set: :na }
+ end
+ act[:dal]=(cmd =~/m/ \
+ || mod.inspect =~/"--dal"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:html]=(cmd =~/h/ \
+ || mod.inspect =~/"--html"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:concordance]=(cmd =~/w/ \
+ || mod.inspect =~/"--concordance"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:images]=(cmd =~/j/ \
+ || mod.inspect =~/"--images"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:pdf]=(cmd =~/p/ \
+ || mod.inspect =~/"--pdf"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:epub]=(cmd =~/e/ \
+ || mod.inspect =~/"--epub"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:odt]=(cmd =~/o/ \
+ || mod.inspect =~/"--odt"|"--odf"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:xml_sax]=(cmd =~/x/ \
+ || mod.inspect =~/"--xml-sax"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:xml_dom]=(cmd =~/X/ \
+ || mod.inspect =~/"--xml-dom"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:xhtml]=(cmd =~/b/ \
+ || mod.inspect =~/"--xhtml"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:txt]=(cmd =~/[at]/ \
+ || mod.inspect =~/"--txt"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:manpage]=(cmd =~/i/ \
+ || mod.inspect =~/"--manpage"|"--man"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:texinfo]=(cmd =~/I/ \
+ || mod.inspect =~/"--texinfo"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:fictionbook]=(cmd =~/f/ \
+ || mod.inspect =~/"--fictionbook"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:psql]=(cmd =~/D/ \
+ || mod.inspect =~/"--pg"|"--pgsql"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:sqlite]=(cmd =~/d/ \
+ || mod.inspect =~/"--sqlite"/) \
+ && (mod.inspect =~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"|"--import"|"--update"|"--remove"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:sqlite_discreet]=(cmd =~/d/ \
+ || mod.inspect =~/"--sql"|"--sqlite"/) \
+ && (mod.inspect =~/"--both"/ \
+ || mod.inspect !~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"|"--import"|"--update"|"--remove"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:harvest]=(mod.inspect =~/"--harvest"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:po4a]=(cmd =~/P/ \
+ || mod.inspect =~/"--po4a"|"--pot?"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:git]=(cmd =~/g/ \
+ || mod.inspect =~/"--git"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:zap]=(cmd =~/Z/ \
+ || mod.inspect =~/"--zap"|"--delete"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:hash_digests]=(cmd =~/N/ \
+ || mod.inspect =~/"--hash-digests"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:sample_search_form]=(cmd =~/F/ \
+ || mod.inspect =~/"--sample-search-form"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:webrick]=(cmd =~/W/ \
+ || mod.inspect =~/"--webrick"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:share_source]=(cmd =~/s/ \
+ || mod.inspect =~/"--source"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:sisupod]=(cmd =~/S/ \
+ || mod.inspect =~/"--sisupod"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:scp]=(cmd =~/r/ \
+ || mod.inspect =~/"--scp"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:rsync]=(cmd =~/R/ \
+ || mod.inspect =~/"--rsync"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:delete_output]=(cmd =~/z/ \
+ || mod.inspect =~/"--delete"|"--zap"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:urls_all]=(cmd =~/U/ \
+ || mod.inspect =~/"--urls-all"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:urls_selected]=(cmd =~/u/ \
+ || mod.inspect =~/"--urls"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:sitemap]=(cmd =~/Y/ \
+ || mod.inspect =~/"--sitemap"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:qrcode]=(cmd =~/Q/ \
+ || mod.inspect =~/"--qrcode"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:help]=(mod.inspect =~/"--help/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ @act=act
+ end
+ end
+ def cmd
+ @cmd
+ end
+ def mod
+ @mod
+ end
+ def act
+ @@act
+ end
+ def files_mod
+ files_mod=files
+ @files_mod=files_mod
+ @files_mod
+ end
+ def f_pth
+ @f_pth
+ end
+ def pth
+ @pth
+ end
+ def sub_location
+ pth.gsub(/#{base_path}/,'')
+ end
+ def lng
+ @lng
+ end
+ def lng_base
+ @lng_base
+ end
+ def fno
+ @fno=if @fno \
+ and not @fno.empty?
+ @fno
+ else
+ fns[/(.+?(?:sst|ssm))(?:\.sst)?/,1]
+ end
+ end
+ def fng
+ @fng=if @fng \
+ and not @fng.empty?
+ @fng
+ else
+ fno.gsub(/(?:~(?:#{Px[:lng_lst_rgx]}))?(\.ss[tm])$/,'\1')
+ end
+ end
+ def fns
+ @fns
+ end
+ def what
+ @what
+ end
+ def fnb
+ unless fns.empty?
+ fns[/(.+?)\.(?:(?:-|ssm\.)?sst|ssm)$/,1]
+ end
+ end
+ def fnc
+ @fnc=if @fns =~/\.(?:ssm\.sst|ssm)$/
+ fnb + '.ssm.sst'
+ else @fns
+ end
+ end
+ def fncb
+ @fncb=if @fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/
+ fnb + '.ssm.sst'
+ else @fns.gsub(/(?:\~\S{2,3})?(\.sst)$/,'\1')
+ end
+ end
+ end
+end
+__END__
+note usually named @opt is carried in Param usually as @md @opt is a subset of
+@md where @md is passed, contents of @opt are available as @md.opt passing @opt
+as well is duplication check for fns & fnb
diff --git a/lib/sisu/v2/param.rb b/lib/sisu/v4/param.rb
index 60663830..40f9b983 100644
--- a/lib/sisu/v2/param.rb
+++ b/lib/sisu/v4/param.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -59,38 +58,52 @@
module SiSU_Param
require 'uri'
require 'pstore'
- require "#{SiSU_lib}/sysenv" # sysenv.rb
+ require_relative 'sysenv' # sysenv.rb
include SiSU_Env
- require "#{SiSU_lib}/param_identify_markup" # param_identify_markup.rb
- require "#{SiSU_lib}/help" # help.rb
+ require_relative 'param_make' # param_make.rb
+ require_relative 'param_identify_markup' # param_identify_markup.rb
+ require_relative 'help' # help.rb
include SiSU_Help
- @@date=SiSU_Env::Info_date.new
- @@symlnk=Create_system_link.new
+ @@date=SiSU_Env::InfoDate.new
@@proc=@@filename_txt=@@filename_texinfo=@@filename_lout_portrait=@@filename_lout_landscape=@@filename_html_scroll=@@filename_html_index=@@filename_html_segtoc=@@filename_semantic=@@filename_rss=@@newfile=@@drr=nil
- @doc={ :initialise=>nil,:markup=>'',:lnks=>'',:stmp=>'',:req=>{} }
+ @doc={ initialise: nil, markup: '', lnks: '', stmp: '', req: {} }
@@yaml=@@yamladdr=nil
@@trigger=nil
@@lv,@@flag={},{}
@@tex_backslash="\\\\"
class Parameters
@@publisher='SiSU scribe'
- @@md=@@fns=nil
+ @@md=@@fns=@@pth=nil
def initialize(opt)
@opt=opt
@cX||=SiSU_Screen::Ansi.new(opt.cmd)
@cmd,@mod=opt.cmd,opt.mod
- @fns=opt.fns.gsub(/\.ssm$/,'.ssm.sst') #revisit CHECK
- Instantiate.new.param_instantiate
- @env=SiSU_Env::Info_env.new(@fns)
- @pstorefile="#{@env.path.dal}/#{@fns}.pstore"
+ @fns=if @opt.cmd =~/P/ #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.dal}/#{@fns}.pstore"
end
def get
- unless @@fns==@fns
- @@fns=@fns
+ 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])
+ p '-- bug alert -- '
+ p __FILE__ + ':' + __LINE__.to_s
+ p 'f_pth ' + @opt.f_pth[:pth]
+ p 'pwd ' + Dir.pwd
+ 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 @cmd =~/M/ #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
+ or @opt.cmd =~/M/ #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)
@@ -101,20 +114,20 @@ module SiSU_Param
else
param_msg='Parameters extracted'
fns_array=@env.read_source_file(@opt.fns)
- md=Instructions.new(fns_array,@opt)
- @md=Instructions.new(fns_array,@opt).extract
+ md=SiSU_Param::Parameters::Instructions.new(fns_array,@opt)
+ @md=SiSU_Param::Parameters::Instructions.new(fns_array,@opt).extract
@md
end
if defined? @md.title.main # on removal check problems with -U
- SiSU_Screen::Ansi.new(@cmd,param_msg,@md.title.main).txt_grey if @cmd =~/[MVv]/
+ SiSU_Screen::Ansi.new(@opt.cmd,param_msg,@md.title.main).txt_grey if @opt.cmd =~/[MVv]/
end
@@md=@md
else @@md
end
- @@md.cmd=@cmd
+ @@md.opt=@opt
@@md
end
- class Md_default
+ class MdDefault
def rights(author,date)
@author,@date=author,date
def all
@@ -147,49 +160,52 @@ module SiSU_Param
self
end
end
+ class MdMake < SiSU_Param_Make::MdMake
+ end
class Md
def initialize(str,opt,env)
@s,@opt,@env=str,opt,env
end
def validate_length(s,l,n)
#s=(s.length <= l) ? s : nil
- s=if s.class==String \
+ s=if s.is_a?(String) \
and s.length <= l
s
- elsif s.class==NilClass; nil
+ elsif s.is_a?(NilClass)
+ nil
elsif s.class !=String
- puts "#{n} is #{s.class}: programming error, String expected #{__FILE__}:#{__LINE__}"
+ STDERR.puts "#{n} is #{s.class}: programming error, String expected #{__FILE__}:#{__LINE__}"
s
else
- SiSU_Screen::Ansi.new('v',"#{n} length #{s.length} exceeds set db field length #{l}, metadata dropped",@opt.fns).warn unless @opt.cmd =~/q/
+ SiSU_Screen::Ansi.new('v',"*WARN* #{n} length #{s.length} exceeds set db field length #{l}, metadata dropped",@opt.fns).warn unless @opt.cmd =~/q/
nil
end
end
def name_format(name)
if name
- name.strip!
+ 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 }
+ @name_a_h << { the: $1 }
else
x=b[0].scan(/[^,]+/)
if x.length==1
- @name_a_h << { :the => x[0].strip }
+ @name_a_h << { the: x[0].strip }
elsif x.length==2
- @name_a_h << { :the => x[0].strip, :others => x[1].strip }
+ @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'
+ 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
@@ -203,7 +219,7 @@ module SiSU_Param
"#{a[:the].strip}" + z
end
end
- {:name_a_h =>@name_a_h,:name_str =>name_str}
+ { name_a_h: @name_a_h, name_str: name_str }
else nil
end
end
@@ -213,7 +229,14 @@ module SiSU_Param
a,b=nil,nil
if x =~/^%\s/ #ignore comment
elsif x =~/:(\S+?):\s+(.+)/
- a,b=/:(\S+?):\s+(.+)/.match(x)[1,2]
+ a,b=/:(\S+?):\s+(.+)\Z/m.match(x)[1,2]
+ 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
@@ -247,12 +270,16 @@ module SiSU_Param
validate_length(s,l,n)
end
def short
- s=(@h['short'] ? @h['short'] : @h['main'])
+ 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'])
+ s=@h['subtitle'] \
+ ? (@h['main'] + ' - ' + @h['subtitle'])
+ : @h['main']
l,n=Db[:col_title],'title.full'
validate_length(s,l,n)
end
@@ -261,7 +288,7 @@ module SiSU_Param
l,n=Db[:col_language],'title.language'
validate_length(s,l,n)
end
- def language_char
+ 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)
@@ -272,20 +299,49 @@ module SiSU_Param
a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m)
@h=build_hash(a)
def author
- @h['author']=(@h['author'] ? @h['author'] : @h['main'])
+ @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'])
+ 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.class==Hash) ? names[:name_str] : nil
+ 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)
@@ -293,12 +349,20 @@ module SiSU_Param
end
end
def contributor_detail
- names=(@h['contributor'] ? name_format(@h['contributor']) : nil)
- (names.class==Hash) ? names[:name_a_h] : nil
+ 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.class==Hash) ? names[:name_str] : nil
+ 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)
@@ -306,12 +370,20 @@ module SiSU_Param
end
end
def illustrator_detail
- names=(@h['illustrator'] ? name_format(@h['illustrator']) : nil)
- (names.class==Hash) ? names[:name_a_h] : nil
+ 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.class==Hash) ? names[:name_str] : nil
+ 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)
@@ -319,12 +391,20 @@ module SiSU_Param
end
end
def photographer_detail
- names=(@h['photographer'] ? name_format(@h['photographer']) : nil)
- (names.class==Hash) ? names[:name_a_h] : nil
+ 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.class==Hash) ? names[:name_str] : nil
+ 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)
@@ -332,12 +412,20 @@ module SiSU_Param
end
end
def translator_detail
- names=(@h['translator'] ? name_format(@h['translator']) : nil)
- (names.class==Hash) ? names[:name_a_h] : nil
+ 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.class==Hash) ? names[:name_str] : nil
+ 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)
@@ -345,12 +433,20 @@ module SiSU_Param
end
end
def audio_detail
- names=(@h['audio'] ? name_format(@h['audio']) : nil)
- (names.class==Hash) ? names[:name_a_h] : nil
+ 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.class==Hash) ? names[:name_str] : nil
+ 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)
@@ -358,12 +454,20 @@ module SiSU_Param
end
end
def digitized_by_detail
- names=(@h['digitized_by'] ? name_format(@h['digitized_by']) : nil)
- (names.class==Hash) ? names[:name_a_h] : nil
+ 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.class==Hash) ? names[:name_str] : nil
+ 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)
@@ -371,9 +475,13 @@ module SiSU_Param
end
end
def prepared_by_detail
- names=(@h['prepared_by'] ? name_format(@h['prepared_by']) : nil)
+ names=@h['prepared_by'] \
+ ? name_format(@h['prepared_by'])
+ : nil
names=name_format(@h['prepared_by'])
- (names.class==Hash) ? names[:name_a_h] : nil
+ (names.is_a?(Hash)) \
+ ? names[:name_a_h]
+ : nil
end
self
end
@@ -389,41 +497,53 @@ module SiSU_Param
elsif @h['main']
@h['main']
else
- SiSU_Screen::Ansi.new(@cmd,'WARNING Document Copyright missing; provide @rights: :copyright:').warn unless @opt.cmd =~/q/
+ SiSU_Screen::Ansi.new(@opt.cmd,'WARNING Document Copyright missing; provide @rights: :copyright:').warn unless @opt.cmd =~/q/
''
end
l,n=Db[:col_info_note],'rights.copyright.text'
validate_length(s,l,n)
end
def translation
- s=(@h['translation'] ? @h['translation'] : nil)
+ 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)
+ 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)
+ 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)
+ 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)
+ 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)
+ s=@h['license'] \
+ ? @h['license']
+ : nil
l,n=Db[:col_info_note],'rights.license'
validate_length(s,l,n)
end
@@ -431,7 +551,7 @@ module SiSU_Param
(str =~/https?:\/\/\S+$/) ? ' ;' : ';'
end
def all
- s=if @h['all']; @h['all']
+ s=if @h['all'] then @h['all']
else
s=''
if defined? copyright.text \
@@ -444,39 +564,39 @@ module SiSU_Param
and copyright.translation \
and not copyright.translation.empty?
v=sep(copyright.translation)
- s +='<br> translation ' + copyright.translation + v
+ s +='\\\\ translation ' + copyright.translation + v
end
if defined? copyright.illustrations \
and copyright.illustrations \
and not copyright.illustrations.empty?
v=sep(copyright.illustrations)
- s +='<br> illustrations ' + copyright.illustrations + v
+ s +='\\\\ illustrations ' + copyright.illustrations + v
end
if defined? copyright.photographs \
and copyright.photographs \
and not copyright.photographs.empty?
v=sep(copyright.photographs)
- s +='<br> photographs ' + copyright.photographs + v
+ s +='\\\\ photographs ' + copyright.photographs + v
end
if defined? copyright.digitization \
and copyright.digitization \
and not copyright.digitization.empty?
v=sep(copyright.digitization)
- s +='<br> digitization ' + copyright.digitization + v
+ s +='\\\\ digitization ' + copyright.digitization + v
end
if defined? copyright.audio \
and copyright.audio \
and not copyright.audio.empty?
v=sep(copyright.audio)
- s +='<br> audio ' + copyright.audio + v
+ s +='\\\\ audio ' + copyright.audio + v
end
if defined? copyright.license \
and copyright.license \
and not copyright.license.empty?
- s +='<br> License: ' + copyright.license
+ s +='\\\\ License: ' + copyright.license
end
if s.empty?
- SiSU_Screen::Ansi.new(@cmd,'WARNING Document Rights information missing; provide @rights: :copyright:').warn unless @opt.cmd =~/q/
+ SiSU_Screen::Ansi.new(@opt.cmd,'WARNING Document Rights information missing; provide @rights: :copyright:').warn unless @opt.cmd =~/q/
else
l,n=Db[:col_info_note],'rights.all'
validate_length(s,l,n)
@@ -487,62 +607,52 @@ module SiSU_Param
end
self
end
- def classify
+ def identifier
a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m)
@h=build_hash(a)
- def coverage
- s=@h['coverage']
- l,n=Db[:col_classify_short],'classify.coverage'
+ def oclc
+ s=@h['oclc']
+ l,n=Db[:col_library],'identifier.oclc'
validate_length(s,l,n)
end
- def relation
- s=@h['relation']
- l,n=Db[:col_classify_short],'classify.short'
+ def isbn
+ s=@h['isbn']
+ l,n=Db[:col_small],'identifier.isbn'
validate_length(s,l,n)
end
- def subject
- s=@h['subject']
- l,n=Db[:col_classify_txt_short],'classify.subject'
+ def pg
+ s=@h['pg']
+ l,n=Db[:col_small],'identifier.pg'
validate_length(s,l,n)
end
+ self
+ end
+ def classify
+ a=@s.split(/(\n%\s.+?$|[ ]*)(?:\n[ ]*(?=:)|\Z)/m)
+ @h=build_hash(a)
def topic_register
s=@h['topic_register']
l,n=Db[:col_info_note],'classify.topic_register'
validate_length(s,l,n)
end
- def type
- s=@h['type']
- l,n=Db[:col_classify_txt_short],'classify.type'
+ def subject
+ s=@h['subject']
+ l,n=Db[:col_txt_long],'classify.subject'
validate_length(s,l,n)
end
- def identifier
- s=@h['identifier']
- l,n=Db[:col_classify_identify],'classify.identifier'
+ def keywords
+ s=@h['keywords']
+ l,n=Db[:col_txt_long],'classify.keywords'
validate_length(s,l,n)
end
def loc
s=@h['loc']
- l,n=Db[:col_classify_library],'classify.loc'
+ l,n=Db[:col_library],'classify.loc'
validate_length(s,l,n)
end
def dewey
s=@h['dewey']
- l,n=Db[:col_classify_library],'classify.dewey'
- validate_length(s,l,n)
- end
- def oclc
- s=@h['oclc']
- l,n=Db[:col_classify_library],'classify.oclc'
- validate_length(s,l,n)
- end
- def pg
- s=@h['pg']
- l,n=Db[:col_classify_small],'classify.pg'
- validate_length(s,l,n)
- end
- def isbn
- s=@h['isbn']
- l,n=Db[:col_classify_small],'classify.isbn'
+ l,n=Db[:col_library],'classify.dewey'
validate_length(s,l,n)
end
self
@@ -594,164 +704,31 @@ module SiSU_Param
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 make
- a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m)
- @h=build_hash(a)
- def headings
- lv=[]
- x=@h['headings']
- x=((x =~/;/) ? (x.split(/;\s*/)) : [ x ])
- lv[0]=x
- lv1=x[0] ||='1~ ' #some arbitrary changes made
- lv[1]=/^#{lv1}/
- lv2=x[1] ||='2~ '
- lv[2]=/^#{lv2}/
- lv3=x[2] ||='3~ '
- lv[3]=/^#{lv3}/
- lv4=x[3] ||='4~ '
- lv[4]=/^#{lv4}/
- lv5=x[4] ||='5~ '
- lv[5]=/^#{lv5}/
- lv6=x[5] ||='6~ '
- lv[6]=/^#{lv6}/
- lv
- end
- def num_top
- @h['num_top']
- end
- def breaks
- pagebreaks=((@h['breaks'] =~/;/) \
- ? (@h['breaks'].split(/;\s*/)) \
- : [ @h['breaks'] ])
- page_new,page_break=nil,nil
- pagebreaks.each do |x|
- page_new=x[/(:?[\dA-C],?)+/] if x=~/new|clear/
- page_break=x[/(:?[\dA-C],?)+/] if x =~/break/
- end
- {:page_new =>page_new, :page_break =>page_break}
- end
- def language
- l=if @h['language'] && (@h['language']=~/\S{2,}/)
- ((@h['language'] =~/,/) \
- ? (@h['language'].split(/,\s*/)) \
- : [ @h['language'] ])
- else [ 'en' ]
- end
- end
- def bold
- m=@h['bold']
- x=(m=~/\/i$/)? 'i' : ''
- z=if m
- m.gsub!(/^\/(.+?)\/i?/,'\1')
- m.gsub!(/\(/,'(?:') # avoid need to escape use of brackets within regex provided
- rgx='\b(' + m + ')\b'
- y=((x =~/i/) ? (/#{rgx}/i) : (/#{rgx}/))
- { :str =>'\b(?:' + m + ')\b', :regx => y }
- else nil
- end
- z
- end
- def italics
- m=@h['italics']
- x=((m=~/\/i$/) ? 'i' : '')
- z=if m
- m.gsub!(/^\/(.+?)\/i?/,'\1')
- m.gsub!(/\(/,'(?:') # avoid need to escape use of brackets within regex provided
- rgx='\b(' + m + ')\b'
- y=((x =~/i/) ? (/#{rgx}/i) : (/#{rgx}/))
- { :str =>'\b(?:' + m + ')\b', :regx => y }
- else nil
- end
- z
- end
- def emphasis
- if @h['emphasis'] =~/bold/; 'bold'
- elsif @h['emphasis'] =~/italics?/; 'italics'
- elsif @h['emphasis'] =~/under(?:line|score)/; 'underscore'
- 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 texpdf_font
- @h['texpdf_font'] && (@h['texpdf_font']=~/\S{3,}/) \
- ? @h['texpdf_font'] \
- : @env.font.texpdf
- end
- def skin
- @h['skin']
- end
- def promo
- @h['promo']
- end
- def ad
- @h['ad']
- end
- def manpage
- manpage={}
- if @h['manpage']
- if @h['manpage'] =~/;/m
- man=@h['manpage'].split(/;/m)
- man.each do |x|
- m=(x=~/=/m) ? x.split(/=/m) : nil
- if m
- manpage[m[0].strip] = m[1].split(/ \. /)
- end
- end
- end
- end
- if manpage['name']
- manpage['name']=manpage['name'].join("\n.br\n")
- manpage['name'].gsub!(/(-)/m,"\\\\\\1")
- manpage['name'].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")
- manpage['synopsis'].gsub!(/(-)/m,"\\\\\\1")
- manpage['synopsis'].gsub!(/\A/,"\n.br\n.SH SYNOPSIS\n.br\n")
- else
- manpage['synopsis']=''
- end
- unless manpage['section']
- manpage['section']=1
- end
- manpage
- end
- self
- end
+ #def 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
@@ -790,24 +767,53 @@ module SiSU_Param
end
self
end
- def links
- a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m)
- a
- end
def notes
a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m)
@h=build_hash(a)
+ def description
+ s=@h['description']
+ l,n=Db[:col_info_note],'notes.description'
+ validate_length(s,l,n)
+ end
def abstract
- @h['abstract']
+ s=@h['abstract']
+ l,n=Db[:col_info_note],'notes.abstract'
+ validate_length(s,l,n)
end
def comment
- @h['comment']
+ s=@h['comment']
+ l,n=Db[:col_info_note],'notes.comment'
+ validate_length(s,l,n)
end
- def description
- @h['description']
+ def coverage
+ s=@h['coverage']
+ l,n=Db[:col_info_note],'notes.coverage'
+ validate_length(s,l,n)
+ end
+ def relation
+ s=@h['relation']
+ l,n=Db[:col_info_note],'notes.relation'
+ validate_length(s,l,n)
+ end
+ def source
+ s=@h['source']
+ l,n=Db[:col_txt_long],'notes.source'
+ validate_length(s,l,n)
end
def history
- @h['history']
+ s=@h['history']
+ l,n=Db[:col_txt_long],'notes.history'
+ validate_length(s,l,n)
+ end
+ def type
+ s=@h['type']
+ l,n=Db[:col_txt_long],'notes.relation'
+ validate_length(s,l,n)
+ end
+ def format
+ s=@h['format']
+ l,n=Db[:col_txt_short],'notes.format'
+ validate_length(s,l,n)
end
def prefix
@h['prefix']
@@ -816,13 +822,13 @@ module SiSU_Param
end
end
class Instructions
- @doc={ :lv=>[] }
+ @doc={ lv: [] }
@doc[:fns],@doc[:fnb],@doc[:scr_suffix]='','',''
@@publisher='SiSU scribe'
- attr_accessor :cmd,:make,:mod,:env,:fn,:fns,:fnb,:fnn,:fnt,:fnl,:flv,:fnz,:fnstex,:ocn,:sfx_src,:pdf,:file_type,:dir_out,:dir_tex,:dir_lout,:txt_path,:site_skin,:sisu,:sisu_version,:ruby_version,:title,:subtitle,:full_title,:html_title,:subtitle_tex,:creator,:classify,:author_home,:author,:author_title,:author_nationality,:authors,:authorship,:translator,:illustrator,:prepared_by,:digitized_by,:subject,:description,:publisher,:current_publisher,:contributor,:date,:date_created,:date_issued,:date_available,:date_valid,:date_modified,:date_translated,:date_added_to_site,:date_scheme,:date_created_scheme,:date_issued_scheme,:date_available_scheme,:date_valid_scheme,:date_modified_scheme,:type,:format,:identifier,:source,:language,:language_original,:relation,:coverage,:rights,:keywords,:comments,:abstract,:cls_loc,:cls_dewey,:cls_pg,:cls_isbn,:papersize,:papersize_array,:toc,:lv1,:lv2,:lv3,:lv4,:lv5,:lv6,:lvs,:pagenew,:pagebreak,:num_top,:toc_lev_limit,:flag_endnotes,:flag_auto_endnotes,:flag_separate_endnotes,:flag_separate_endnotes_make,:markup,:markup_instruction,:markup_version,:markup_declared,:flag_tables,:vocabulary,:doc_skin,:doc_css,:yaml,:lnk,:links,:prefix_a,:prefix_b,:suffix,:information,:contact,:icon,:image,:ad_url,:ad_png,:ad_alt,:ad_began,:flag_promo,:promo,:ad_home,:stmp,:stmpd,:sc_filename,:sc_number,:sc_date,:sc_time,:sc_info,:yamladdr,:locale,:wc_lines,:wc_words,:wc_bytes,:file_encoding,:filesize,:user,:home,:hostname,:pwd,:firstseg,:programs,:author_copymark,:i18n,:lang,:en,:notes,:dgst,:dgst_skin,:generated,:tags,:tag_array,:concord_make,:seg_names,:seg_autoname_safe,:set_header_title,:set_heading_top,:set_heading_seg,:heading_seg_first,:heading_seg_first_flag,:base_program,:ec,:opt,:sem_tag,:book_idx,:topic_register,:topic_register_array,:original,:writing_focus,:audio,:daisy
+ attr_accessor :make,:env,:path,:file,:fn,:fns,:fno,:fnb,:fnn,:fnt,:fnl,:flv,:fnz,:fnstex,:ocn,:sfx_src,:pdf,:file_type,:dir_out,:dir_tex,:dir_lout,:txt_path,:sisu,:sisu_version,:ruby_version,:title,:subtitle,:full_title,:html_title,:subtitle_tex,:creator,:classify,:author_home,:author,:author_title,:author_nationality,:authors,:authorship,:translator,:illustrator,:prepared_by,:digitized_by,:subject,:description,:publisher,:current_publisher,:contributor,:date,:date_created,:date_issued,:date_available,:date_valid,:date_modified,:date_translated,:date_added_to_site,:date_scheme,:date_created_scheme,:date_issued_scheme,:date_available_scheme,:date_valid_scheme,:date_modified_scheme,:type,:format,:identifier,:source,:language,:language_original,:relation,:coverage,:rights,:keywords,:comments,:abstract,:cls_loc,:cls_dewey,:cls_pg,:cls_isbn,:papersize,:papersize_array,:toc,:lv1,:lv2,:lv3,:lv4,:lv5,:lv6,:lvs,:pagenew,:pagebreak,:num_top,:bold_match_list,:italics_match_list,:substitution_match_list,:emphasis_set_to,:toc_lev_limit,:flag_endnotes,:flag_auto_endnotes,:flag_separate_endnotes,:flag_separate_endnotes_make,:markup,:markup_instruction,:markup_version,:markup_declared,:flag_tables,:vocabulary,:doc_css,:yaml,:lnk,:links,:prefix_a,:prefix_b,:suffix,:information,:contact,:icon,:image,:ad_url,:ad_png,:ad_alt,:ad_began,:flag_promo,:promo,:ad_home,:stmp,:stmpd,:sc_filename,:sc_number,:sc_date,:sc_time,:sc_info,:yamladdr,:locale,:wc_lines,:wc_words,:wc_bytes,:file_encoding,:filesize,:user,:home,:hostname,:pwd,:firstseg,:programs,:author_copymark,:i18n,:lang,:lang_code_insert,:en,:notes,:dgst,:generated,:tags,:tag_array,:concord_make,:seg_names,:seg_autoname_safe,:set_header_title,:set_heading_top,:set_heading_seg,:heading_seg_first,:heading_seg_first_flag,:base_program,:ec,:opt,:sem_tag,:book_idx,:topic_register,:topic_register_array,:original,:writing_focus,:audio,:daisy,:home_button_image,:home_button_links,:footer_links,:cover_image,:man_section
def initialize(fns_array,opt)
- @env=@fn=@fns=@fnb=@fnn=@fnt=@fnl=@flv=@fnz=@fnstex=@ocn=@sfx_src=@pdf=@file_type=@dir_out=@dir_tex=@dir_lout=@txt_path=@make=@flag_endnotes=@flag_auto_endnotes=@flag_separate_endnotes=@flag_separate_endnotes_make=@site_skin=@sisu=@sisu_version=@ruby_version=@title=@subtitle=@full_title=@html_title=@subtitle_tex=@creator=@classify=@author_home=@author=@author_title=@author_nationality=@translator=@illustrator=@prepared_by=@digitized_by=@subject=@description=@publisher=@current_publisher=@contributor=@date=@date_created=@date_issued=@date_available=@date_valid=@date_modified=@date_translated=@date_added_to_site=@date_scheme=@date_created_scheme=@date_issued_scheme=@date_available_scheme=@date_valid_scheme=@date_modified_scheme=@type=@format=@identifier=@source=@language=@language_original=@relation=@coverage=@rights=@keywords=@comments=@abstract=@cls_loc=@cls_dewey=@cls_pg=@cls_isbn=@papersize=@toc=@lv1=@lv2=@lv3=@lv4=@lv5=@lv6=@pagenew=@pagebreak=@num_top=@toc_lev_limit=@flag_tables=@vocabulary=@doc_skin=@doc_css=@yaml=@lnk=@links=@prefix_a=@prefix_b=@suffix=@information=@contact=@icon=@ad_url=@ad_png=@ad_alt=@ad_began=@promo=@ad_home=@stmp=@stmpd=@sc_filename=@sc_number=@sc_date=@sc_time=@sc_info=@yamladdr=@locale=@wc_lines=@wc_words=@wc_bytes=@file_encoding=@filesize=@firstseg=@programs=@author_copymark=@i18n=@lang=@en=@notes=@dgst=@dgst_skin=@generated=@heading_seg_first=@base_program=@topic_register=@original=@writing_focus=@audio=nil
- @data,@fns,@cmd,@mod,@opt=fns_array,opt.fns,opt.cmd,opt.mod,opt #@data used as data
+ @env=@path,@file=@fn=@fns=@fno=@fnb=@fnn=@fnt=@fnl=@flv=@fnz=@fnstex=@ocn=@sfx_src=@pdf=@file_type=@dir_out=@dir_tex=@dir_lout=@txt_path=@make=@flag_endnotes=@flag_auto_endnotes=@flag_separate_endnotes=@flag_separate_endnotes_make=@sisu=@sisu_version=@ruby_version=@title=@subtitle=@full_title=@html_title=@subtitle_tex=@creator=@classify=@author_home=@author=@author_title=@author_nationality=@translator=@illustrator=@prepared_by=@digitized_by=@subject=@description=@publisher=@current_publisher=@contributor=@date=@date_created=@date_issued=@date_available=@date_valid=@date_modified=@date_translated=@date_added_to_site=@date_scheme=@date_created_scheme=@date_issued_scheme=@date_available_scheme=@date_valid_scheme=@date_modified_scheme=@type=@format=@identifier=@source=@language=@language_original=@relation=@coverage=@rights=@keywords=@comments=@abstract=@cls_loc=@cls_dewey=@cls_pg=@cls_isbn=@papersize=@toc=@lv1=@lv2=@lv3=@lv4=@lv5=@lv6=@pagenew=@pagebreak=@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
@@ -832,13 +838,59 @@ module SiSU_Param
@flv,@lang,@seg_names,@tags,@tag_array,@tag_a,@ec[:image],@ec[:audio],@ec[:multimedia]=Array.new(9){[]}
@authors,@topic_register_array,@papersize_array=[],[],[]
@lvs=[nil,0,0,0,0,0,0]
- @rgx_image=/(?:^|[^_\\])\{\s*(\S+?\.(?:png|jpg|gif))/
+ @emphasis_set_to='bold'
+ @lang_code_insert=if @opt.act[:output_by][:set]==:language
+ ''
+ elsif @opt.act[:output_by][:set]==:filetype \
+ or @opt.act[:output_by][:set]==:filename
+ ".#{@opt.lng}"
+ elsif @opt.dir_structure_by ==:language
+ ''
+ else
+ ".#{@opt.lng}"
+ end
+ @footer_links= { left: { say: '', url: '' }, center: { say: '', url: '' } }
+ @rgx_image=/(?:^|[^_\\])\{(?:\s*|\~\^\s+)(\S+?\.(?:png|jpg|gif)\b)/m
@rgx_audio=/\{\s*(\S+?\.(?:mp3|ogg))/
@rgx_mm=/\{\s*(\S+?\.(?:ogg|mpeg))/ #expand and distinguish ogg
+ Dir.chdir(@opt.f_pth[:pth])
begin
- rescue; SiSU_Errors::Info_error.new($!,$@,@cmd,@fns).error
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@fns).error 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[:pagenew]
+ @toc=common_makes[:toc]
+ @lv1=common_makes[:lv1]
+ @lv2=common_makes[:lv2]
+ @lv3=common_makes[:lv3]
+ @lv4=common_makes[:lv4]
+ @lv5=common_makes[:lv5]
+ @lv6=common_makes[:lv6]
+ @num_top=common_makes[:num_top]
+ @i18n=common_makes[:i18n]
+ @man_section=common_makes[:man_section]
+ @emphasis_set_to=common_makes[:emphasis_set_to]
+ @bold_match_list=common_makes[:bold_match_list]
+ @italics_match_list=common_makes[:italics_match_list]
+ @substitution_match_list=common_makes[:substitution_match_list]
+ @footer_links=common_makes[:footer_links]
+ @home_button_links=common_makes[:home_button_links]
+ @home_button_image=common_makes[:home_button_image]
+ @cover_image=common_makes[:cover_image]
+ @lnk=@links=common_makes[:links]
+ @header_make_links_append=common_makes[:links_append]
+ end
end
#protected
def determine_papersize(l)
@@ -854,10 +906,10 @@ module SiSU_Param
def extract
@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::Info_settings.new
- @sys=SiSU_Env::System_call.new
- @env=SiSU_Env::Info_env.new(@fns) #watch
+ @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
puts 'system locale: ' + @sys.locale if @opt.cmd =~/[MV]/
if @prog.wc \
and @sys.wc
@@ -873,27 +925,27 @@ module SiSU_Param
end
@concord_make=(@wc_words > @env.concord_max) ? false : true
@locale=@sys.locale
- @file_encoding=@sys.file_encoding(fns,@cmd)
+ @file_encoding=@sys.file_encoding(fns,@opt.cmd)
# programs set here for things that affect output appearance only
- @programs[:pdf]=SiSU_Env::System_call.new.program_found?('pdflatex')
- if @env.i18n.multilingual
- m=/((.+?)(?:\~\w{2,3})?)\.((?:-|ssm\.)?sst|ssm)$/ #watch added match for sss
+ @programs[:pdf]=SiSU_Env::SystemCall.new.program_found?('pdflatex')
+ if @opt.cmd =~/P/ #if @env.multilingual?
+ 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]
- @fnz=(@fns =~/\.(?:ssm\.sst|ssm)$/) ? (@fnn + '.ssm.zip') : (@fnn + '.sst.zip')
- else m=/(.+?)\.((?:-|ssm\.)?sst)$/
- @fnb=@fnn=@fns[m,1]
- @fnt=@fns[m,2]
- @flv<<@fns
- @fnz=(@fns =~/\.(?:_sst|ssm)$/) ? (@fnb + '.ssm.zip') : (@@fnb + '.sst.zip')
+ 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$/ #watch
+ if @fns =~ /(?:-|ssm\.)?sst$/ \
+ and not @opt.cmd =~/P/ #watch
@env_out_root=@env.path.output
@dir_out="#{@env.path.output}/#{@fnb}"
- @dir_tex=@env.path.tex
- @dir_lout=@env.path.lout
+ @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
@@ -902,23 +954,23 @@ module SiSU_Param
@flag_endnotes,@flag_auto_endnotes,@flag_separate_endnotes=false,false,false
@flag_separate_endnotes_make=true
regx_date=/^\d{4}(?:-(?:[0][0-9]|1[0-2])(-(?:[0-2][0-9]|3[01]))?)?$/
- ver=SiSU_Env::Info_version.instance
+ ver=SiSU_Env::InfoVersion.instance
@sisu_version=ver.get_version
@ruby_version=ver.rbversion
@generated=Time.now
fns_array=@data.dup
skip unless fns_array # consider
- @markup_version=SiSU_Markup_type::Markup_identify.new(fns_array,@opt).markup_version? #% determine markup version
+ @markup_version=SiSU_MarkupType::MarkupIdentify.new(fns_array,@opt).markup_version? #% determine markup version
if fns_array[0] =~ /^(?:%\s+)?(?:SiSU\s+(?:master\s+)?[\d.]*|sisu-[\d.]+)$/ #check markup and markup version
- if fns_array[0] =~ /^(?:%\s+)?(?:SiSU\s+(?:master\s+)?|sisu-)(?:(?:[0-9]+?)(?:\.[0-9]+?)(?:\.[0-9]+))?$/ #check markup and markup version
+ if fns_array[0] =~ /^(?:%\s+)?(?:SiSU\s+(?:master\s+)?|sisu-)(?:(?:[0-9]+?)(?:\.[0-9]+?)(?:\.[0-9]+))?$/ #check markup and markup version
@markup_version_declared=fns_array[0].match(/^(?:%\s+)?(?:SiSU\s+(?:master\s+)?|sisu-)([\d.]+)$/)[1]
sm_a,sm_b,sm_c=fns_array[0].match(/^(?:%\s+)?(?:SiSU\s+(?:master\s+)?|sisu-)([0-9]+)?(?:\.([0-9]+))?(?:\.([0-9]+))?$/)[1..3]
sm_c ||=0
- sv=(@cmd =~/[VMv]/) ? ("SiSU version (#{@sisu_version[:version]})") : ''
+ sv=(@opt.cmd =~/[VMv]/) ? ("SiSU version (#{@sisu_version[:version]})") : ''
s_a,s_b,s_c=@sisu_version[:version].match(/^([0-9]+)?(?:\.([0-9]+))?(?:\.([0-9]+))?(?:\-\S+)?$/)[1..3]
tell=(@markup_version_declared.to_f==@markup_version.determined) \
- ? SiSU_Screen::Ansi.new(@cmd,"Markup version (#{@markup_version.series} version #{@markup_version.determined})",sv) \
- : SiSU_Screen::Ansi.new(@cmd,"Markup version declared (#{@markup_version_declared}), determined (#{@markup_version.series} version #{@markup_version.determined})",sv)
+ ? SiSU_Screen::Ansi.new(@opt.cmd,"Markup version (#{@markup_version.series} version #{@markup_version.determined})",sv)
+ : SiSU_Screen::Ansi.new(@opt.cmd,"Markup version declared (#{@markup_version_declared}), determined (#{@markup_version.series} version #{@markup_version.determined})",sv)
ok=if s_a.to_i > sm_a.to_i
true
elsif s_a.to_i == sm_a.to_i \
@@ -931,23 +983,23 @@ module SiSU_Param
else false
end
if ok
- tell.txt_green if @cmd =~/[vVM]/
+ tell.txt_green if @opt.cmd =~/[vVM]/
else
- SiSU_Screen::Ansi.new(@cmd,"Warning: markup version determined (#{@markup_version.determined}) or markup version declared (#{@markup_version_declared}) is newer than SiSU version (#{@sisu_version[:version]})").warn unless @cmd =~/q/
+ SiSU_Screen::Ansi.new(@opt.cmd,"WARNING: markup version determined (#{@markup_version.determined}) or markup version declared (#{@markup_version_declared}) is newer than SiSU version (#{@sisu_version[:version]})").warn unless @opt.cmd =~/q/
end
else
- SiSU_Screen::Ansi.new(@cmd,'No SiSU markup version provided').warn if @cmd =~/[VM]/
+ SiSU_Screen::Ansi.new(@opt.cmd,'No SiSU markup version provided').warn if @opt.cmd =~/[VM]/
end
else
- mv=if defined? @markup_version.determined and not @markup_version.determined.nil?
+ mv=if @markup_version.determined.is_a?(Float)
x=@markup_version.determined
"markup version determined #{x}"
else ''
end
- SiSU_Screen::Ansi.new(@cmd,'SiSU filetype indicator not provided',mv).warn unless @cmd =~/q/
+ SiSU_Screen::Ansi.new(@opt.cmd,'SiSU filetype indicator not provided',mv).warn unless @opt.cmd =~/q/
end
@code_flag=false
- fns_array.each do |para| #% Scan document
+ 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 #{@sisu_version[:project]} #{@sisu_version[:version]} #{@sisu_version[:date_stamp]} #{@sisu_version[:date]}:\n\t\t#{para}\n\n"
@@ -961,83 +1013,88 @@ module SiSU_Param
if para =~regx_header \
and not @code_flag #or para=~/^(?:1|:?A)~/
case para
- when /^@ocn:\s+(.+?)$/m; @ocn=$1 #% processing
- when /^@title:(.+)/m #% metainfo DC
- @title=Md.new($1.strip,@opt,@env).title
- when /^@creator:(.+)/m #% metainfo DC
- @creator=Md.new($1.strip,@opt,@env).creator
+ 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 /^@classify:(.+)/m; classify=$1
- @classify=Md.new($1.strip,@opt,@env).classify
- when /^@publisher:\s+(.+)/m
- @publisher=Md.new($1.strip,@opt,@env).current_publisher
+ 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 /^@original:(.+)/m
- @original=Md.new($1.strip,@opt,@env).original
+ when /^@rights:(.+)/m; #% * header metadata - rights
+ @rights=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).rights
+ when /^@classify:(.+)/m; classify=$1 #% * header metadata - classify
+ @classify=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).classify
+ when /^@identifier:(.+)/m; identify=$1 #% * header metadata - identifier
+ @identifier=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).identifier
+ when /^@original:(.+)/m #% * header metadata - original (document)
+ @original=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).original
@source=@original.source
- when /^@writing_focus[:.]nationality:\s+(.+?)$/; @writing_focus=$1 # e.g. Finland (where and article on Finnish law)
- when /^@date:(.+)/m #% metainfo DC
- @date=Md.new($1.strip,@opt,@env).date
- when /^@rights:(.+)/m; #@rights=$1.gsub(/<(?:\/\s*)?br(?:\s*\/)?>/,Mx[:br_line]) #% metainfo DC copyright, public domain, copyleft, creative commons, etc.
- @rights=Md.new($1.strip,@opt,@env).rights
- when /^@papersize:\s+(.+?)$/m #% metainfo DC
- l=$1
- if @mod.inspect !~/--papersize[=-]\S+/
- l=determine_papersize(l.dup)
- @papersize=l
- end
- when /^@make:(.+)/m #% metainfo DC
- @make=Md.new($1.strip,@opt,@env).make
- if defined? @make.breaks \
- and @make.breaks[:page_new] #clearpage
- @pagenew=@make.breaks[:page_new]
- end
- if defined? @make.breaks \
- and @make.breaks[:page_break] #newpage
- @pagebreak=@make.breaks[:page_break]
- end
- if defined? @make.headings \
- and @make.headings
- @toc=@make.headings[0]
- @lv1=@make.headings[1]
- @lv2=@make.headings[2]
- @lv3=@make.headings[3]
- @lv4=@make.headings[4]
- @lv5=@make.headings[5]
- @lv6=@make.headings[6]
- end
- if defined? @make.num_top \
- and @make.num_top
- @num_top=@make.num_top # remove @num_top
- end
- if defined? @make.language \
- and @make.language[0]
- @i18n=@make.language
- end
- if defined? @make.skin \
- and @make.skin
- @doc_skin=@make.skin
+ 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
- if defined? @make.manpage \
- and @make.manpage
- @man_section=(defined? @make.manpage.section) ? @make.manpage.section : 1
- end
- when /^@links:\s+(.+?)\Z/m #% processing
- doc_links=Md.new($1.strip,@opt,@env).links
- count=1
- @links=[]
- doc_links.each do |doc_link|
- if doc_link=~/\{.+?\}(?:(?:https?|file|ftp):\/|\.\.)\/\S+(?:\s|$)/
- @links[count]={}
- @links[count][:say],@links[count][:url]=/\{\s*(.+?)\s*\}((?:(?:https?|file|ftp):\/|\.\.)\/\S+)/im.match(doc_link)[1,2]
- count +=1
- end
- end
- @lnk=@links
- when /^@notes?:\s(.+)\Z/m #% metainfo
- @notes=Md.new($1.strip,@opt,@env).notes
- when /^@base_program:\s+(.+?)$/; @base_program=$1 #% processing
+ 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
+ @toc=(makes[:toc]) ? (makes[:toc]) : @toc
+ @lv1=(makes[:lv1]) ? (makes[:lv1]) : @lv1
+ @lv2=(makes[:lv2]) ? (makes[:lv2]) : @lv2
+ @lv3=(makes[:lv3]) ? (makes[:lv3]) : @lv3
+ @lv4=(makes[:lv4]) ? (makes[:lv4]) : @lv4
+ @lv5=(makes[:lv5]) ? (makes[:lv5]) : @lv5
+ @lv6=(makes[:lv6]) ? (makes[:lv6]) : @lv6
+ @num_top=(makes[:num_top]) \
+ ? (makes[:num_top]) \
+ : @num_top
+ @substitution_match_list=(makes[:substitution_match_list]) \
+ ? (makes[:substitution_match_list]) \
+ : @substitution_match_list
+ @bold_match_list=(makes[:bold_match_list]) \
+ ? (makes[:bold_match_list]) \
+ : @bold_match_list
+ @italics_match_list=(makes[:italics_match_list]) \
+ ? (makes[:italics_match_list]) \
+ : @italics_match_list
+ @emphasis_set_to=(makes[:emphasis_set_to]) \
+ ? (makes[:emphasis_set_to]) \
+ : @emphasis_set_to
+ @i18n=(makes[:i18n]) \
+ ? (makes[:i18n]) \
+ : @i18n
+ @man_section=(makes[:man_section]) \
+ ? (makes[:man_section]) \
+ : @man_section
+ @footer_links=(makes[:footer_links]) \
+ ? (makes[:footer_links]) \
+ : @footer_links
+ @home_button_links=(makes[:home_button_links]) \
+ ? (makes[:home_button_links]) \
+ : @home_button_links
+ @home_button_image=(makes[:home_button_image]) \
+ ? (makes[:home_button_image]) \
+ : @home_button_image
+ @cover_image=(makes[:cover_image]) \
+ ? (makes[:cover_image]) \
+ : @cover_image
end
@lv1 ||=/^1~/
@lv2 ||=/^2~/
@@ -1045,34 +1102,61 @@ module SiSU_Param
@lv4 ||=/^4~/
@lv5 ||=/^5~/
@lv6 ||=/^6~/
- else #%
+ 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 /^:?A~#{l_0}/
@lvs[1]=1
- when /^:?B~/
+ when /^:?B~#{l_1}/
@lvs[2]=1
- when /^:?C~/
+ when /^:?C~#{l_2}/
@lvs[3]=1
- when /^1~/
+ when /^1~#{l_3}/
@lvs[4]=1
- when /^2~/
+ when /^2~#{l_4}/
@lvs[5]=1
- when /^3~/
+ when /^3~#{l_5}/
@lvs[6]=1
end
- if para =~ /^:A~/ #% processing
+ if para =~ /^:A~/ #% processing
if @markup.nil? \
or @markup.empty?
@markup=@markup_version.determined.to_s
- elsif @markup !~/0\.38/; @markup=@markup.strip + "; #{@markup_version.determined}"
+ elsif @markup !~/0\.38/ then @markup=@markup.strip + "; #{@markup_version.determined}"
end
if not defined? @title.full.nil?
tf=para[/^:A~\S*(.+)$/m,1]
tf="@title: #{tf}"
- @title=Md.new(tf.strip,@opt,@env).title
+ @title=SiSU_Param::Parameters::Md.new(tf.strip,@opt,@env).title
end
@html_title=@title.full.gsub(/(<p>|<p \/>|<br>|<br \/>)/,'')
- SiSU_Screen::Ansi.new(@cmd,'Parameters',@html_title).txt_grey if @cmd =~/v/
+ SiSU_Screen::Ansi.new(@opt.cmd,'Parameters',@html_title).txt_grey if @opt.cmd =~/v/
end
if not @book_idx \
and para =~/^=\{(.+?)\}\s*$/
@@ -1080,28 +1164,20 @@ module SiSU_Param
end
unless @code_flag
case para
- when /~\{\s+.+?\}~/m #% processing
+ when /~\{\s+.+?\}~/m #% processing
en=para.scan(/~\{.+?\}~/m)
en.each { |e| @en[:sum] +=1 }
- when /~\^(?:\s|$)/m #% processing
+ when /~\^(?:\s|$)/m #% processing
mk=para.scan(/~\^(?:\s|$)/)
mk.each { |e| @en[:mark] +=1 }
- when /^\^~\s+\S/; @en[:note] +=1 #% processing
+ when /^\^~\s+\S/; @en[:note] +=1 #% processing
end
end
- if para =~/~\{|\^~ |~\^|<:ee>|\{.+?\[[1-6]\]\}\S+?\.ss[tm]/m; @flag_auto_endnotes,@flag_endnotes=true,true
+ if para =~/~\{|\^~ |~\^|\{.+?\[[1-6]\]\}\S+?\.ss[tm]/m
+ @flag_auto_endnotes,@flag_endnotes=true,true
end
- unless @flag_auto_endnotes
- if para =~/^(4~endnotes\b|<:ee>)/
- @flag_separate_endnotes=true
- @flag_endnotes=true
- end
- end
- if para =~/^(?:4~endnotes|<:ee>)/; @flag_separate_endnotes_make=false
- end
- if para =~/<!!e[#0-9]+?!>\s*.+/; @flag_endnotes=true
- end
- if para =~/^(?:table\{|\{table)/i; @flag_tables=true
+ if para =~/^(?:table\{|\{table)/i
+ @flag_tables=true
end
end
if para =~/^:?A~/
@@ -1127,6 +1203,7 @@ module SiSU_Param
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
@@ -1136,46 +1213,63 @@ module SiSU_Param
unless @sem_tag
@sem_tag=true if para=~/[:;]\{.+?\}[:;][a-z+]/ #refix later
end
- end #% here endeth the document loop
+ end #% here endeth the document loop
+ unless @make
+ if @opt.cmd =~/[VM]/
+ SiSU_Screen::Ansi.new(@opt.cmd,'@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].flatten!
- @ec[:image].uniq!
+ @ec[:image]=@ec[:image].flatten.uniq
@ec[:image].delete_if {|x| x =~/https?:\/\// }
- @ec[:image].sort!
+ @ec[:image]=@ec[:image].sort
end
- @ec[:audio].uniq!; @ec[:audio].flatten!; @ec[:audio].sort!
- @ec[:multimedia].uniq!; @ec[:multimedia].flatten!; @ec[:multimedia].sort!
+ @ec[:audio]=@ec[:audio].uniq.flatten.sort
+ @ec[:multimedia]=@ec[:multimedia].uniq.flatten.sort
unless @rights
if defined? @creator.author \
- and @creator.author \
+ and @creator.author.is_a?(String) \
and defined? @date.published \
- and @date.published
- @rights=Md_default.new.rights(@creator.author,@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
- @rights=Md_default.new.rights("[#{@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 not @classify.topic_register.nil? \
+ and @classify.topic_register.is_a?(String) \
and @classify.topic_register.length >3
topic_register=@classify.topic_register
- u=topic_register.scan(/[^;]+/)
+ u=topic_register.scan(/[^;]+/m).sort
v=[]
u.each do |l|
- v << l.scan(/[^:]+/)
+ v << l.scan(/[^:]+/m)
end
v.each do |m|
- m[-1]=m[-1].scan(/[^|]+/) if m[-1] =~/[|]/
+ m[-1]=m[-1].scan(/[^|]+/m) if m[-1] =~/[|]/m
@topic_register_array << m
end
- @topic_register_array.sort!
+ @topic_register_array
end
if @i18n
- @i18n.uniq!
+ @i18n=@i18n.uniq
@i18n << 'en' unless @i18n.find_index("en")
else
- @i18n=[ en ]
+ @i18n=[ 'en' ]
end
if @markup_version.determined >= 0.38 #convert values in headers to internal representation
translated=[]
@@ -1189,44 +1283,46 @@ module SiSU_Param
translate.gsub!(/:?C/,'3')
translate.gsub!(/:?B/,'2')
translate.gsub!(/:?A/,'1')
- translate=if translate =~/^\d+$/; translate.to_i
- else translate
- end
+ # 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,@num_top,@toc_lev_limit=translated
- @markup.gsub!(/page_new\s*=\s*([\dA-C])/,"page_new=#{@pagenew}")
- @markup.gsub!(/page_break\s*=\s*([\dA-C])/,"page_break=#{@pagebreak}")
- @markup.gsub!(/num_top\s*=\s*([\dA-C])/,"num_top=#{@num_top}")
- @markup.gsub!(/toc_lev_limit\s*=\s*([\dA-C])/,"toc_lev_limit=#{@toc_lev_limit}")
+ @markup=@markup.gsub(/page_new\s*=\s*([\dA-C])/,"page_new=#{@pagenew}").
+ gsub(/page_break\s*=\s*([\dA-C])/,"page_break=#{@pagebreak}").
+ gsub(/num_top\s*=\s*([\dA-C])/,"num_top=#{@num_top}").
+ gsub(/toc_lev_limit\s*=\s*([\dA-C])/,"toc_lev_limit=#{@toc_lev_limit}")
end
- if @mod.inspect =~/--papersize[=-]\S+|--pdf[=-]\S+/ \
- or @mod.inspect =~/--(?:a4|letter|legal|book|a5|b5)\b/i #command line config/header override
- @papersize=determine_papersize(@mod.inspect)
+ if @opt.mod.inspect =~/--papersize[=-]\S+|--pdf[=-]\S+/ \
+ or @opt.mod.inspect =~/--(?:a4|letter|legal|book|a5|b5)\b/i #command line config/header override
+ @papersize=determine_papersize(@opt.mod.inspect)
end
@papersize_array=@papersize.scan(/(?:a4|letter|legal|book|a5|b5)/i)
- fn=@fns=~/\.ssm\.sst$/ ? @fns.gsub(/.sst/,'') : @fns #decide what to do a filesize on .ssm tells very little about actual document size
+ fn=@opt.fno #decide what to do a filesize on .ssm tells very little about actual document size
@filesize=(File.size(fn)).to_s
if @sys.openssl !=false
- skin=@doc_skin \
- ? (SiSU_Env::Info_skin.new(@opt,@doc_skin).select) \
- : SiSU_Env::Info_skin.new(@opt).select
- @dgst,@dgst_skin=[],[]
+ @dgst=[]
if @env.digest.type =~/sha256/
dgst=@sys.sha256(@env.source_file_with_path)
@dgst=dgst[1].length==64 ? dgst : nil
puts 'check document (sha256) digest' if not @dgst
- @dgst_skin=skin ? (@sys.sha256(skin)) : nil
else
dgst=@sys.md5(@env.source_file_with_path)
@dgst=dgst[1].length==32 ? dgst : nil
puts 'check document (md5) digest' if not @dgst
- @dgst_skin=skin ? (@sys.md5(skin)) : nil
end
end
- @publisher ||= "#@@publisher (this copy)"
- fn_set_lang=SiSU_Env::Standardise_language.new.file_to_language(@fns)
+ @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
@@ -1235,39 +1331,56 @@ module SiSU_Param
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[:l]
+ @language[:name]=fn_set_lang[:n]
end
@fnl=@env.i18n.lang_filename(fn_set_lang[:c])
- @flv.each do |l|
- lang=SiSU_Env::Standardise_language.new.file_to_language(l)
- c={ :a=>'',:b=>'',:c=>'' }
- if @fnl[:pre] =~/\S/; c[:a]="#{lang[:c]}."
- elsif @fnl[:mid] =~/\S/; c[:b]=".#{lang[:c]}"
- elsif @fnl[:post] =~/\S/; c[:c]=".#{lang[:c]}"
- end
- @lang << [lang[:l],"#{c[:a]}sisu_manifest#{c[:b]}.html#{c[:c]}"]
- end if @flv
- @lang.uniq!
- @fn=SiSU_Env::Env_call.new(@fns).lang(fn_set_lang[:c])
- @identifier="#{@env.url.root}/#{@fnb}/#{@fn[:toc]}" #DC note constructed dc identifier
+#fix
+# @flv.each do |l|
+# lang=SiSU_Env::StandardiseLanguage.new.file_to_language(l)
+# c={ a: '', b: '', c: '' }
+# if @fnl[:pre] =~/\S/ then c[:a]="#{lang[:c]}."
+# elsif @fnl[:mid] =~/\S/ then c[:b]=".#{lang[:c]}"
+# elsif @fnl[:post] =~/\S/ then c[:c]=".#{lang[:c]}"
+# end
+# @lang << [lang[:n],"#{c[:a]}sisu_manifest#{c[:b]}.html#{c[:c]}"]
+# end if @flv
+ @lang=@lang.uniq
+ @fn=SiSU_Env::EnvCall.new(@fns).lang(fn_set_lang[:c])
+ #if @identifier.is_a?(Array)
+ # @identifier[:sisupod]=sisupod_hash_value
+ #else @identifier={ sisupod: sisupod_hash_value }
+ #end
+ #"#{@env.url.root}/#{@fnb}/#{@fn[:toc]}" #DC note constructed dc identifier
if @en[:note] > 0 \
and @en[:sum] > 0
if @en[:sum] > 0
- else SiSU_Screen::Ansi.new(@cmd,'both endnote styles used',"~{ #{@en[:sum]} }~ and ^~ #{@en[:mark]}").warn if @cmd !~/q/
+ else SiSU_Screen::Ansi.new(@opt.cmd,'*WARN* both endnote styles used',"~{ #{@en[:sum]} }~ and ^~ #{@en[:mark]}").warn if @opt.cmd !~/q/
end
end
if @en[:mark] != @en[:note] \
and @en[:note] > 0
@en[:mismatch]=@en[:note] - @en[:mark]
- SiSU_Screen::Ansi.new(@cmd,'endnote number mismatch',"endnotes: #{@en[:note]} != endnote reference marks: #{@en[:mark]} (difference = #{@en[:mismatch]})").warn if @cmd !~/q/
+ SiSU_Screen::Ansi.new(@opt.cmd,'*WARN* endnote number mismatch',"endnotes: #{@en[:note]} != endnote reference marks: #{@en[:mark]} (difference = #{@en[:mismatch]})").warn if @opt.cmd !~/q/
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 @title.main !~/[\S]/
- SiSU_Screen::Ansi.new(@cmd,'WARNING Document Title missing','please provide @title:').warn unless @cmd =~/q/
+ 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.cmd,'WARNING: Document Title missing','please provide @title:').warn unless @opt.cmd =~/q/
+ end
end
if @author !~/[\S]/
- SiSU_Screen::Ansi.new(@cmd,'Warning Document Author missing','please provide @creator: :author:').warn unless @cmd =~/q/
+ if @fns =~/\.ssm$/ \
+ and @opt.inspect =~/P/
+ #@creator=SiSU_Param::Md.new('Text Insert',@opt,@env).creator
+ else
+ SiSU_Screen::Ansi.new(@opt.cmd,'WARNING: Document Author missing','please provide @creator: :author:').warn unless @opt.cmd =~/q/
+ end
end
@struct={}
doc_struct=Hash.new(0)
@@ -1332,41 +1445,45 @@ module SiSU_Param
@lv4 ||=/^4~/
@lv5 ||=/^5~/
@lv6 ||=/^6~/
- if @doc_skin
- SiSU_Screen::Ansi.new(@cmd,"doc_skin <- #{@doc_skin}").txt_grey if @cmd =~/v/
- end
@data=nil #else whole file's contents are stored in md pstore & is not required to be... big waste actually
- Store.new(self,@env).store #% pstore
+ @file=SiSU_Env::FileOp.new(self) #watch
+ Store.new(self,@env).store #% pstore
self
end
private
class Store
def initialize(md,env)
- @md=md
- @pstorefile="#{env.path.dal}/#{md.fns}.pstore"
+ @md,@env=md,env
end
def store
- File.unlink(@pstorefile) if FileTest.file?(@pstorefile)
- SiSU_Screen::Ansi.new(@md.cmd,"PStore -> #{@pstorefile}").txt_grey if @md.cmd =~/[MV]/
- store=PStore.new(@pstorefile)
- store.transaction do
- store['md']=@md
- store.commit
+ begin
+ pstorefile="#{@env.processing_path.dal}/#{@md.fns}.pstore"
+ File.unlink(pstorefile) if FileTest.file?(pstorefile)
+ SiSU_Screen::Ansi.new(@md.opt.cmd,"PStore -> #{pstorefile}").txt_grey if @md.opt.cmd =~/[MV]/
+ store=PStore.new(pstorefile)
+ store.transaction do
+ store['md']=@md
+ store.commit
+ end
+ @@md=@md=nil
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
end
- @@md=@md=nil
end
end
end
end
class Instantiate
def param_instantiate
- @@date=SiSU_Env::Info_date.new
- @@symlnk=SiSU_Env::Create_system_link.new
+ @@date=SiSU_Env::InfoDate.new
@@proc=@@filename_txt=@@filename_texinfo=@@filename_lout_portrait=@@filename_lout_landscape=@@filename_html_scroll=@@filename_html_index=@@filename_html_segtoc=@@filename_semantic=@@filename_rss=@@newfile=@@drr=nil
@doc={
- :initialise=>nil,
- :markup=>'',:lnks=>'',:stmp=>'',:prefix_a=>'',:prefix_b=>'',
- :req=>{}
+ initialise: nil,
+ markup: '', lnks: '', stmp: '', prefix_a: '', prefix_b: '',
+ req: {}
}
@@yaml=@@yamladdr=nil
@@flag={}
diff --git a/lib/sisu/v2/param_identify_markup.rb b/lib/sisu/v4/param_identify_markup.rb
index 97b6d888..e1d96a62 100644
--- a/lib/sisu/v2/param_identify_markup.rb
+++ b/lib/sisu/v4/param_identify_markup.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -58,8 +57,8 @@
altering SiSU markup
=end
-module SiSU_Markup_type
- class Markup_identify
+module SiSU_MarkupType
+ class MarkupIdentify
@@version={}
@@fns,@@version[:determined],@@version[:declared],@@declared_doc_type='','','','[text?]'
attr_accessor :version,:declared_doc_type
diff --git a/lib/sisu/v4/param_make.rb b/lib/sisu/v4/param_make.rb
new file mode 100644
index 00000000..a1bda002
--- /dev/null
+++ b/lib/sisu/v4/param_make.rb
@@ -0,0 +1,636 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public Lic/home/ralph/live-manual/build/manual/manifest/live-manual.ca.htmlense for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: make parameters extracted for program use
+
+=end
+
+module SiSU_Param_Make
+ class MdMake
+ def initialize(str,opt,env)
+ @s,@opt,@env=str,opt,env
+ end
+ def validate_length(s,l,n)
+ #s=(s.length <= l) ? s : nil
+ s=if s.is_a?(String) \
+ and s.length <= l
+ s
+ elsif s.is_a?(NilClass)
+ nil
+ elsif s.class !=String
+ STDERR.puts "#{n} is #{s.class}: programming error, String expected #{__FILE__}:#{__LINE__}"
+ s
+ else
+ SiSU_Screen::Ansi.new('v',"*WARN* #{n} length #{s.length} exceeds set db field length #{l}, metadata dropped",@opt.fns).warn unless @opt.cmd =~/q/
+ nil
+ end
+ end
+ def name_format(name)
+ if name
+ name=name.strip
+ @name_a_h=[]
+ authors=name.scan(/[^;]+/)
+ authors.each_with_index do |a,i|
+ b=((a =~/\s*\|\s*/) ? (a.split(/\|/)) : [a])
+ if b[0] =~/"(.+?)"/
+ @name_a_h << { the: $1 }
+ else
+ x=b[0].scan(/[^,]+/)
+ if x.length==1
+ @name_a_h << { the: x[0].strip }
+ elsif x.length==2
+ @name_a_h << { the: x[0].strip, others: x[1].strip }
+ else #p x.length
+ end
+ end
+ b.delete_at(0)
+ b.each do |d|
+ k,c=nil
+ k,c=/^(\S+)\s+(.*)/.match(d)[1,2] if d
+ @name_a_h[i][:hon]=c.strip if k=='hon'
+ @name_a_h[i][:affiliation]=c.strip if k=='affiliation'
+ @name_a_h[i][:nationality]=c.strip if k=='nationality'
+ end
+ end
+ l=@name_a_h.length
+ name_str=''
+ @name_a_h.each_with_index do |a,i|
+ name_str += if a[:others]
+ z=(((l - i) > 1) ? ', ' : '')
+ "#{a[:others].strip} #{a[:the].strip}" + z
+ else
+ z=(((l - i) > 2) ? ', ' : '')
+ "#{a[:the].strip}" + z
+ end
+ end
+ { name_a_h: @name_a_h, name_str: name_str }
+ else nil
+ end
+ end
+ def build_hash(arr)
+ @h={}
+ arr.each_with_index do |x,i|
+ a,b=nil,nil
+ if x =~/^%[:\s]/ #ignore comment
+ elsif x =~/:(\S+?):\s+(.+)/
+ a,b=/:(\S+?):\s+(.+)\Z/m.match(x)[1,2]
+ elsif i == 0
+ a='main'
+ b=x
+ else
+ end
+ @h[a]=b
+ end
+ @h
+ end
+ def make
+ a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m)
+ @h=build_hash(a)
+ def headings
+ lv=[]
+ x=@h['headings']
+ x=((x =~/;/) ? (x.split(/;\s*/)) : [ x ])
+ lv[0]=x
+ lv1=x[0] ||='1~ ' #some arbitrary changes made
+ lv[1]=/^#{lv1}/
+ lv2=x[1] ||='2~ '
+ lv[2]=/^#{lv2}/
+ lv3=x[2] ||='3~ '
+ lv[3]=/^#{lv3}/
+ lv4=x[3] ||='4~ '
+ lv[4]=/^#{lv4}/
+ lv5=x[4] ||='5~ '
+ lv[5]=/^#{lv5}/
+ lv6=x[5] ||='6~ '
+ lv[6]=/^#{lv6}/
+ lv
+ end
+ def num_top
+ @h['num_top']
+ end
+ def breaks
+ pagebreaks=((@h['breaks'] =~/;/) \
+ ? (@h['breaks'].split(/;\s*/))
+ : [ @h['breaks'] ])
+ page_new,page_break=nil,nil
+ pagebreaks.each do |x|
+ page_new=x[/(:?[\dA-C],?)+/] if x=~/new|clear/
+ page_break=x[/(:?[\dA-C],?)+/] if x =~/break/
+ end
+ { page_new: page_new, page_break: page_break }
+ end
+ def language
+ l=if @h['language'] && (@h['language']=~/\S{2,}/)
+ ((@h['language'] =~/,/) \
+ ? (@h['language'].split(/,\s*/))
+ : [ @h['language'] ])
+ else [ 'en' ]
+ end
+ end
+ def bold
+ m=@h['bold']
+ i=(m=~/\/i$/)? 'i' : ''
+ z=if m
+ x=m.gsub(/^\/(.+?)\/i?/,'\1').
+ gsub(/\((?:\?:)?/,'(?:') # avoid need to escape use of brackets within regex provided
+ rgx='\b(' + x + ')\b'
+ y=((i =~/i/) ? (/#{rgx}/i) : (/#{rgx}/))
+ { str: '\b(?:' + x + ')\b', regx: y, i: i }
+ else nil
+ end
+ end
+ def italics
+ m=@h['italics']
+ i=((m=~/\/i$/) ? 'i' : '')
+ z=if m
+ x=m.gsub(/^\/(.+?)\/i?/,'\1').
+ gsub(/\((?:\?:)?/,'(?:') # avoid need to escape use of brackets within regex provided
+ rgx='\b(' + x + ')\b'
+ y=((i =~/i/) ? (/#{rgx}/i) : (/#{rgx}/))
+ { str: '\b(?:' + x + ')\b', regx: y, i: i }
+ else nil
+ end
+ end
+ def emphasis
+ if @h['emphasis'] =~/bold/ then 'bold'
+ elsif @h['emphasis'] =~/italics?/ then 'italics'
+ elsif @h['emphasis'] =~/under(?:line|score)/ then 'underscore'
+ else nil
+ end
+ end
+ def substitute
+ m=@h['substitute']
+ z=if m
+ w=m.scan(/\/(.+?)\/(i?,)\s*'(.+?)'(?:\s+|\s*;\s*|$)/)
+ arr_hash=[]
+ matches=''
+ w.each do |x|
+ c=(x[1] =~/[i],/) ? :i : :s
+ matches=matches + x[0].gsub(/([${}])/,'\\\\\1') + '|'
+ arr_hash << {
+ match: x[0].gsub(/([${}])/,'\\\\\1'),
+ replace: x[2],
+ case_s: c
+ }
+ end
+ matches.chop!
+ { match_and_replace: arr_hash, matches: matches }
+ else nil
+ end
+ end
+ def plaintext_wrap
+ if @h['plaintext_wrap'].to_s =~/\d\d+/ \
+ and @h['plaintext_wrap'].to_i > 19 \
+ and @h['plaintext_wrap'].to_i < 201
+ @h['plaintext_wrap'].to_i
+ else nil
+ end
+ end
+ def omit
+ m=@h['omit']
+ @m=m ? (m.split(/,\s+/)) : nil
+ def list
+ @m
+ end
+ self
+ end
+ def ocn?
+ (omit.list.inspect =~/"ocn"/) \
+ ? :off
+ : :na
+ end
+ def toc?
+ (omit.list.inspect =~/"toc"/) \
+ ? :off
+ : :na
+ end
+ def manifest?
+ (omit.list.inspect =~/"manifest"/) \
+ ? :off
+ : :na
+ end
+ def links_to_manifest?
+ (omit.list.inspect =~/"manifest_links"|"links_to_manifest"/) \
+ ? :off
+ : :na
+ end
+ def metadata?
+ (omit.list.inspect =~/"metadata"/) \
+ ? :off
+ : :na
+ end
+ def minitoc?
+ (omit.list.inspect =~/"minitoc"/) \
+ ? :off
+ : :na
+ end
+ def html_minitoc?
+ (omit.list.inspect =~/"html_minitoc"/) \
+ ? :off
+ : :na
+ end
+ def html_top_band?
+ (omit.list.inspect =~/"html_top_band"/) \
+ ? :off
+ : :na
+ end
+ def html_navigation?
+ (omit.list.inspect =~/"html_navigation"/) \
+ ? :off
+ : :na
+ end
+ def html_navigation_bar?
+ (omit.list.inspect =~/"html_navigation_bar"/) \
+ ? :off
+ : :na
+ end
+ def segsubtoc?
+ (omit.list.inspect =~/"segsubtoc"/) \
+ ? :off
+ : :na
+ end
+ def search_form?
+ (omit.list.inspect =~/"search_form"/) \
+ ? :off
+ : :na
+ end
+ def html_search_form?
+ (omit.list.inspect =~/"html_search_form"/) \
+ ? :off
+ : :na
+ end
+ def html_right_pane?
+ (omit.list.inspect =~/"html_right_column"|"html_right_pane"/) \
+ ? :off
+ : :na
+ end
+ def manifest_minitoc?
+ (omit.list.inspect =~/"manifest_minitoc"/) \
+ ? :off
+ : :na
+ end
+ def cover_image?
+ (omit.list.inspect =~/"cover_image"/) \
+ ? :off
+ : :na
+ end
+ def home_button_image?
+ (omit.list.inspect =~/"home_button_image"/) \
+ ? :off
+ : :na
+ end
+ def texpdf_font
+ def main
+ @h['texpdf_font'] \
+ && (@h['texpdf_font']=~/\S{3,}/) \
+ ? @h['texpdf_font']
+ : @env.font.texpdf.main
+ end
+ def sans # not used
+ @h['texpdf_font_sans'] \
+ && (@h['texpdf_font_sans']=~/\S{3,}/) \
+ ? @h['texpdf_font_sans']
+ : @env.font.texpdf.sans
+ end
+ def serif # not used
+ @h['texpdf_font_serif'] \
+ && (@h['texpdf_font_serif']=~/\S{3,}/) \
+ ? @h['texpdf_font_serif']
+ : @env.font.texpdf.serif
+ end
+ def mono
+ @h['texpdf_font_mono'] \
+ && (@h['texpdf_font_mono']=~/\S{3,}/) \
+ ? @h['texpdf_font_mono']
+ : @env.font.texpdf.mono
+ end
+ self
+ end
+ def promo
+ @h['promo']
+ end
+ def ad
+ @h['ad']
+ end
+ def manpage
+ manpage={}
+ if @h['manpage']
+ if @h['manpage'] =~/;/m
+ man=@h['manpage'].split(/;/m)
+ man.each do |x|
+ m=(x=~/=/m) ? x.split(/=/m) : nil
+ if m
+ manpage[m[0].strip] = m[1].split(/ \. /)
+ end
+ end
+ end
+ end
+ if manpage['name']
+ manpage['name']=manpage['name'].join("\n.br\n").
+ gsub(/(-)/m,"\\\\\\1").
+ gsub(/\A/,"\n.br\n.SH NAME\n.br\n")
+ else
+ manpage['name']='man page "name/whatis" information not provided, set in header @man: name=[whatis information]'
+ end
+ if manpage['synopsis']
+ manpage['synopsis']=manpage['synopsis'].join("\n\n.br\n").
+ gsub(/(-)/m,"\\\\\\1").
+ gsub(/\A/,"\n.br\n.SH SYNOPSIS\n.br\n")
+ else
+ manpage['synopsis']=''
+ end
+ unless manpage['section']
+ manpage['section']=1
+ end
+ manpage
+ end
+ def get_image_dimensions(img)
+ imgk=SiSU_Env::SystemCall.new.imagemagick
+ gmgk=SiSU_Env::SystemCall.new.graphicksmagick
+ img_pth={
+ sst: @env.path.image_source_include,
+ pod: File.expand_path("../../../sisupod/image" )
+ }
+ path_img=if FileTest.file?("#{img_pth[:pod]}/#{img}")
+ "#{img_pth[:pod]}/#{img}"
+ elsif FileTest.file?("#{img_pth[:sst]}/#{img}")
+ "#{img_pth[:sst]}/#{img}"
+ else nil
+ end
+ if path_img
+ if imgk or gmgk
+ if imgk
+ imgsys=`identify #{path_img}`.strip #system call
+ elsif gmgk
+ imgsys=`gm identify #{path_img}`.strip #system call
+ end
+ w,h=/(\d+)x(\d+)/m.match(imgsys)[1,2]
+ else
+ w,h='600','800'
+ end
+ else
+ w,h=nil,nil
+ end
+ {w: w, h: h}
+ end
+ def home_button_text
+ s=if @h['home_button_text']
+ @h['home_button_text'].split(/\s*;\s*/)
+ else nil
+ end
+ #l,n=Db[:home_button],'make.home_button_text'
+ #validate_length(s,l,n)
+ end
+ def home_button_image
+ s=nil
+ s=if @h['home_button_image']
+ s=@h['home_button_image'].split(/\s*;\s*/)
+ s0=s[0] #if
+ image={}
+ s=if s0 =~/{(\S+\.(?:jpg|png|gif))(?:\s+(\d+x\d+))?\s*}(?:(http:\/\/\S+)|image)/
+ image[:home_button]=$1
+ if $2
+ image[:dimensions]=$2
+ image[:w],image[:h]=/(\d+)x(\d+)/m.match(image[:dimensions])[1,2]
+ else
+ d=get_image_dimensions(image[:home_button])
+ image[:w],image[:h]=d[:w],d[:h]
+ image[:dimensions]="#{d[:w]}x#{d[:h]}"
+ end
+ image[:link]=$3
+ image
+ end
+ else nil
+ end
+ end
+ def cover_image
+ s=nil
+ if @h['cover_image']
+ s=@h['cover_image'].split(/\s*;\s*/)
+ s=s[0] #if
+ image={}
+ if s =~/{(\S+\.(?:jpg|png|gif))(?:\s+(\d+x\d+))?\s+(?:"(.+?)")?\s*}image/
+ image[:cover]=$1
+ if $2
+ image[:dimensions]=$2
+ image[:w],image[:h]=/(\d+)x(\d+)/m.match(image[:dimensions])[1,2]
+ else
+ d=get_image_dimensions(image[:cover])
+ image[:w],image[:h]=d[:w],d[:h]
+ image[:dimensions]="#{d[:w]}x#{d[:h]}"
+ end
+ image[:note]=$3
+ elsif s =~/(\S+\.(?:jpg|png|gif))/
+ image[:cover]=$1
+ d=get_image_dimensions(image[:cover])
+ image[:w],image[:h]=d[:w],d[:h]
+ image[:dimensions]="#{d[:w]}x#{d[:h]}"
+ image[:note]=nil
+ end
+ image
+ else nil
+ end
+ end
+ def footer
+ s=if @h['footer']
+ @h['footer'].split(/\s*;\s*/)
+ else nil
+ end
+ end
+ self
+ end
+ def make_links
+ @doc_links=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m)
+ def links
+ lnks,a_idx=[],0
+ @doc_links.each do |doc_link|
+ if doc_link=~/\{.+?\}(?:(?:https?|file|ftp):\/|\.\.)\/\S+(?:\s|$)/
+ say,url=/\{\s*(.+?)\s*\}((?:(?:https?|file|ftp):\/|\.\.)\/\S+)/im.match(doc_link)[1,2]
+ lnks[a_idx]={ say: say, url: url }
+ a_idx +=1
+ end
+ end
+ lnks
+ end
+ def append?
+ (@doc_links[0]=='+') \
+ ? :yes
+ : :no
+ end
+ self
+ end
+ end
+ class MakeHead
+ attr_accessor :pagenew,:pagebreak,: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=@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.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,
+ 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/v2/particulars.rb b/lib/sisu/v4/particulars.rb
index b2f533e1..97a3da3e 100644
--- a/lib/sisu/v2/particulars.rb
+++ b/lib/sisu/v4/particulars.rb
@@ -1,4 +1,4 @@
-# coding:utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -8,7 +8,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -32,11 +33,9 @@
If you have Internet connection, the latest version of the GPL should be
available at these locations:
<http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/copyleft/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -48,7 +47,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -59,16 +58,17 @@
=end
module SiSU_Particulars
require 'singleton'
- require "#{SiSU_lib}/sysenv" # sysenv.rb
+ require_relative 'sysenv' # sysenv.rb
include SiSU_Env
- require "#{SiSU_lib}/param" # param.rb
+ require_relative 'param' # param.rb
include SiSU_Param
- require "#{SiSU_lib}/dal" # dal.rb
- class Combined_singleton
+ require_relative 'dal' # dal.rb
+ class CombinedSingleton
include Singleton
def get_all(opt)
@opt=opt
set_env
+ set_file
set_md
set_dal #needs @md
end
@@ -76,6 +76,10 @@ module SiSU_Particulars
@opt=opt
set_env
end
+ def get_file(opt)
+ @opt=opt
+ set_file
+ end
def get_md(opt)
@opt=opt
set_md
@@ -93,9 +97,9 @@ module SiSU_Particulars
@opt=opt
set_sst_idx
end
- def get_idx_tex(opt)
+ def get_idx_raw(opt)
@opt=opt
- set_tex_idx
+ set_raw_idx
end
def get_idx_html(opt)
@opt=opt
@@ -122,56 +126,88 @@ module SiSU_Particulars
@opt=opt
set_ocn_htmlseg_map
end
- attr_accessor :opt,:md,:sst_idx,:tex_idx,:html_idx,:xhtml_idx
+ attr_accessor :opt,:md,:sst_idx,:raw_idx,:html_idx,:xhtml_idx
def set_md
begin
@md=SiSU_Param::Parameters.new(@opt).get
self
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
end
end
- attr_accessor :opt,:env
+ attr_accessor :opt,:env,:file
def set_env
begin
- @env=SiSU_Env::Info_env.new(@opt.fns)
+ @env=SiSU_Env::InfoEnv.new(@opt.fns)
+ self
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ end
+ end
+ def set_file
+ begin
+ set_md unless @md
+ @file=SiSU_Env::FileOp.new(@md)
self
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
end
end
attr_accessor :opt,:dal_array
def set_dal
begin
- @dal_array=@dal_array=SiSU_DAL::Source.new(@md).get
+ @dal_array=SiSU_DAL::Source.new(@opt).get
self
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
end
end
def set_sst_idx
begin
- @sst_idx=SiSU_DAL::Source.new(@md).get_idx_sst
+ @sst_idx=SiSU_DAL::Source.new(@opt).get_idx_sst
self
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
end
end
- def set_tex_idx
+ def set_raw_idx
begin
- @tex_idx=SiSU_DAL::Source.new(@md).get_idx_tex
+ @raw_idx=SiSU_DAL::Source.new(@opt).get_idx_raw
self
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
end
end
def set_html_idx
begin
- @html_idx=SiSU_DAL::Source.new(@md).get_idx_html
+ @html_idx=SiSU_DAL::Source.new(@opt).get_idx_html
self
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
end
end
def set_xhtml_idx
begin
- @xhtml_idx=SiSU_DAL::Source.new(@md).get_idx_xhtml
+ @xhtml_idx=SiSU_DAL::Source.new(@opt).get_idx_xhtml
self
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
end
end
attr_accessor :nametags_map
@@ -180,7 +216,10 @@ module SiSU_Particulars
opt=@md ? @md : @opt
@nametags_map=SiSU_DAL::Source.new(opt).get_map_nametags
self
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
end
end
attr_accessor :ocn_htmlseg_map
@@ -188,7 +227,10 @@ module SiSU_Particulars
begin
@ocn_htmlseg_map=SiSU_DAL::Source.new(@md).get_map_ocn_htmlseg
self
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
end
end
end
diff --git a/lib/sisu/v4/plaintext.rb b/lib/sisu/v4/plaintext.rb
new file mode 100644
index 00000000..5ad35447
--- /dev/null
+++ b/lib/sisu/v4/plaintext.rb
@@ -0,0 +1,432 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: plaintext text generation, stripped plaintext output (unix,
+ linefeed)
+
+=end
+module SiSU_Plaintext
+ require_relative 'dal' # dal.rb
+ require_relative 'sysenv' # sysenv.rb
+ include SiSU_Env
+ require_relative 'plaintext_format' # plaintext_format.rb
+ include SiSU_PlaintextFormat
+ require_relative 'shared_metadata' # shared_metadata.rb
+ require_relative 'shared_txt' # shared_txt.rb
+ include SiSU_Param
+ include SiSU_Viz
+ pwd=Dir.pwd
+ @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0
+ @@tablefoot=''
+ class Source
+ def initialize(opt)
+ @opt=opt
+ unless @opt.fns =~/(.+?)\.(?:-|ssm\.)?sst$/
+ puts "#{sf} not a processed file type"
+ end
+ end
+ def read
+ begin
+ md=SiSU_Param::Parameters.new(@opt).get
+ env=SiSU_Env::InfoEnv.new(@opt.fns)
+ unless @opt.cmd =~/q/
+ path=env.path.output_tell
+ tool=(@opt.cmd =~/[MVv]/) \
+ ? "#{env.program.text_editor} #{md.file.output_path.txt.dir}/#{md.file.base_filename.txt}"
+ : "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}"
+ @opt.cmd=~/[MVvz]/ \
+ ? SiSU_Screen::Ansi.new(@opt.cmd,'Plaintext',tool).green_hi_blue
+ : SiSU_Screen::Ansi.new(@opt.cmd,'Plaintext',tool).green_title_hi
+ SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{md.file.output_path.txt.dir}/#{md.file.base_filename.txt}").flow if @opt.cmd =~/[MV]/
+ end
+ dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here
+ wrap_width=if defined? md.make.plaintext_wrap \
+ and md.make.plaintext_wrap
+ md.make.plaintext_wrap
+ elsif defined? env.plaintext_wrap \
+ and env.plaintext_wrap
+ env.plaintext_wrap
+ else 78
+ end
+ #wrap_width=(defined? md.make.plaintext_wrap) ? md.make.plaintext_wrap : 78
+ SiSU_Plaintext::Source::Scroll.new(dal_array,md,wrap_width).songsheet
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ end
+ end
+ private
+ class Scroll <Source
+ require_relative 'defaults' # defaults.rb
+ require_relative 'shared_txt' # shared_txt.rb
+ include SiSU_TextUtils
+ @@endnotes={ para: [], end: [] }
+ def initialize(data,md,wrap_width)
+ @data,@md,@wrap_width=data,md,wrap_width
+ @env=SiSU_Env::InfoEnv.new(@md.fns)
+ @brace_url=SiSU_Viz::Defaults.new.url_decoration
+ @tab="\t"
+ @@endnotes_=case md.opt.mod.inspect
+ when /--footnote/; false
+ when /--endnote/; true
+ else true
+ end
+ @br=case md.opt.mod.inspect
+ when /--dos/; "\r\n"
+ when /--unix/; "\n"
+ else "\n"
+ end
+ @plaintext={ body: [], open: [], close: [], head: [], metadata: [], tail: [] }
+ end
+ def songsheet
+ plaintext=markup(@data)
+ publish(plaintext)
+ end
+ # Used for extraction of endnotes from paragraphs
+ def extract_endnotes(dob='')
+ notes=dob.obj.scan(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})([\d*+]+\s+.+?)(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/)
+ @n=[]
+ notes.flatten.each do |n| #high cost to deal with <br> appropriately within plaintext, consider
+ n=n.dup.to_s
+ if n =~/#{Mx[:br_line]}|#{Mx[:br_nl]}/
+ fix = n.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/) #watch #added
+ fix.each do |x|
+ unless x.empty?; @n << x
+ end
+ end
+ else @n << n
+ end
+ end
+ notes=@n.flatten
+ notes.each do |e|
+ util=(e.to_s =~/^\[[\d*+]+\]:/) \
+ ? (SiSU_TextUtils::Wrap.new(e.to_s,@wrap_width,4,1))
+ : (SiSU_TextUtils::Wrap.new(e.to_s,@wrap_width,1,1))
+ wrap=util.line_wrap
+ wrap=if wrap =~ /^\s*[\d*+]+\s+.+?\s*\Z/m
+ wrap.gsub(/^(\s*)([\d*+]+)\s+(.+?)\s*\Z/m, <<GSUB
+\\1[\\2]: \\3
+GSUB
+ )
+ else
+ wrap.gsub(/^(.+)\Z/m, <<GSUB
+\\1
+GSUB
+ )
+ end
+ @@endnotes[:para] << "-#{wrap}"
+ @@endnotes[:end] << '' << wrap
+ end
+ @@endnotes
+ end
+ def plaintext_metadata
+ array=SiSU_Metadata::Summary.new(@md).plaintext.metadata
+ array.each do |meta|
+ tag,inf=meta.scan(/^.+?:\s|.+/)
+ if tag and inf
+ util=SiSU_TextUtils::Wrap.new(inf,@wrap_width,15,1)
+ txt=util.line_wrap
+ @plaintext[:metadata] <<<<WOK
+
+#{@tab}#{tag}#{txt}
+WOK
+ end
+ end
+ end
+ def plaintext_tail
+# env=SiSU_Env::InfoEnv.new(@md.fns)
+ vz=SiSU_Viz::Defaults.new
+ base_url="#{@env.url.root}/#{@md.fnb}"
+ generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version]
+ lastdone="Last Generated on: #{Time.now}"
+ rubyv="Ruby version: #{@md.ruby_version}"
+ sc=if @md.sc_info
+ "Source file: #{@md.sc_filename}#{@br}Version number: #{@md.sc_number}#{@br}Version date: #{@md.sc_date}#{@br}"
+ else ''
+ end
+ @plaintext[:tail] <<<<WOK
+#{@br}
+plaintext (plain text):
+ #{@md.file.output_path.txt.url}/#{@md.file.base_filename.txt}#{@br}
+Other versions of this document: #{@br}
+manifest:
+ #{@md.file.output_path.manifest.url}/#{@md.file.base_filename.manifest}#{@br}
+at:
+ #{@md.file.output_path.base.url}#{@br}
+
+#{sc}
+* #{generator}
+* #{rubyv}
+* #{lastdone}
+* SiSU #{vz.url_sisu}
+WOK
+ end
+ def plaintext_structure(dob='',p_num='') #% Used to extract the structure of a document
+ lv=n=n3=nil
+ if dob.is==:heading
+ lv=dob.ln
+ n=lv - 1
+ n3=lv + 2
+ end
+ util=nil
+ wrapped=if dob.is ==:para \
+ or dob.is==:heading
+ if dob.is==:para
+ if dob.hang \
+ and dob.hang =~/[0-9]/ \
+ and dob.indent != dob.hang
+ util=SiSU_TextUtils::Wrap.new(dob.obj,@wrap_width,dob.indent.to_i*2,dob.hang.to_i*2)
+ #util=SiSU_TextUtils::Wrap.new(dob.obj,@wrap_width,dob.hang.to_i*2,0)
+ elsif dob.indent =~/[1-9]/
+ util=if dob.bullet_
+ SiSU_TextUtils::Wrap.new("* #{dob.obj}",@wrap_width,dob.indent.to_i*2)
+ else SiSU_TextUtils::Wrap.new(dob.obj,@wrap_width,dob.indent.to_i*2)
+ end
+ else
+ util=if dob.bullet_
+ SiSU_TextUtils::Wrap.new("* #{dob.obj}",@wrap_width,0)
+ else SiSU_TextUtils::Wrap.new(dob.obj,@wrap_width,0)
+ end
+ end
+ else util=SiSU_TextUtils::Wrap.new(dob.obj,@wrap_width,0)
+ end
+ util.line_wrap
+ end
+ if lv
+ times=wrapped.length
+ times=@wrap_width if times > @wrap_width
+ @plaintext[:body] << case lv
+ when 1; wrapped.upcase << @br << Px[:lv1]*times + p_num << @br
+ when 2; wrapped.upcase << @br << Px[:lv2]*times + p_num << @br
+ when 3; wrapped.upcase << @br << Px[:lv3]*times + p_num << @br
+ when 4; wrapped.upcase << @br << Px[:lv4]*times + p_num << @br
+ when 5; wrapped.upcase << @br << Px[:lv5]*times + p_num << @br
+ when 6; wrapped.upcase << @br << Px[:lv6]*times + p_num << @br
+ end
+ else
+ @plaintext[:body] << wrapped + p_num << @br # main text, contents, body KEEP
+ end
+ if @@endnotes[:para] \
+ and not @@endnotes_
+ @plaintext[:body] << @br
+ @@endnotes[:para].each {|e| @plaintext[:body] << e << @br}
+ elsif @@endnotes[:para] \
+ and @@endnotes_
+ @plaintext[:body] << @br*2
+ end
+ @@endnotes[:para]=[]
+ end
+ def markup(data) # Used for major markup instructions
+ dir=SiSU_Env::InfoEnv.new(@md.fns)
+ @data_mod,@endnotes,@level,@cont,@copen,@plaintext_contents_close=Array.new(6){[]}
+ (0..6).each { |x| @cont[x]=@level[x]=false }
+ (4..6).each { |x| @plaintext_contents_close[x]='' }
+ plaintext_tail #($1,$2)
+ plaintext_metadata
+ table_message='[table omitted, see other document formats]'
+ fix=[]
+ data.each do |dob|
+ dob.obj=dob.obj.gsub(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+/um,"#{@br}#{table_message}"). #fix
+ gsub(/.+?#{Mx[:gl_o]}-##{Mx[:gl_c]}/,''). # remove dummy headings (used by html) #check also [~-]#
+ gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,
+ "#{Px[:bold_o]}\\1#{Px[:bold_c]}").
+ gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,
+ "#{Px[:italics_o]}\\1#{Px[:italics_c]}").
+ gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,
+ "#{Px[:underscore_o]}\\1#{Px[:underscore_c]}").
+ gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,
+ "#{Px[:subscript_o]}\\1#{Px[:subscript_c]}").
+ gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,
+ "#{Px[:superscript_o]}\\1#{Px[:superscript_c]}").
+ gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,
+ "#{Px[:insert_o]}\\1#{Px[:insert_c]}").
+ gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,
+ "#{Px[:cite_o]}\\1#{Px[:cite_c]}").
+ gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,
+ "#{Px[:strike_o]}\\1#{Px[:strike_c]}").
+ gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,
+ "#{Px[:monospace_o]}\\1#{Px[:monospace_c]}")
+ unless dob.is==:code
+ dob.obj=dob.obj.gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/,'\1').
+ gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1').
+ gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1 [link: <\2>]').
+ gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}image/,'\1 [link: local image]').
+ gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,"#{@brace_url.txt_open}\\1#{@brace_url.txt_close}")
+ extract_endnotes(dob)
+ dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'[^\1]'). # endnote marker marked up
+ gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'[^\1]'). # endnote marker marked up
+ gsub(/#{Mx[:gl_o]}(?:#lt|#060)#{Mx[:gl_c]}/,'<').
+ gsub(/#{Mx[:gl_o]}(?:#gt|#062)#{Mx[:gl_c]}/,'>').
+ gsub(/#{Mx[:gl_o]}#(?:038|amp)#{Mx[:gl_c]}/,'&').
+ gsub(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!').
+ gsub(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#').
+ gsub(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*').
+ gsub(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-').
+ gsub(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/').
+ gsub(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_').
+ gsub(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{').
+ gsub(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}').
+ gsub(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~').
+ gsub(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'©').
+ gsub(/#{Mx[:gl_o]}#092#{Mx[:gl_c]}/,'\\')
+ end
+ dob.obj=if dob.of==:block # watch
+ dob.obj.gsub(/#{Mx[:gl_o]}●#{Mx[:gl_c]}/,"* ").
+ gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"\n")
+ else dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"\n\n")
+ end
+ if dob.is==:code
+ dob.obj=dob.obj.gsub(/(^|[^}])_([<>])/m,'\1\2'). # _> _<
+ gsub(/(^|[^}])_([<>])/m,'\1\2') # _<_<
+ end
+ dob.obj=dob.obj.gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1').
+ gsub(/<a href=".+?">(.+?)<\/a>/m,'\1').
+ gsub(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,''). # remove name links
+ gsub(/&nbsp;|#{Mx[:nbsp]}/,' '). # decide on
+ gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,' [ \1 ]'). #"[ #{dir.url.images_local}\/\\1 ]")
+ gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}image/,' [ \1 ]').
+ gsub(/(?:^|[^_\\])\{\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*\}\S+/,'[image: "\1"]')
+ wordlist=dob.obj.scan(/\S+/)
+ if dob.obj !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/
+ #if defined? dob.ocn and dob.ocn.to_s =~/\d+/
+ # paranum=dob.ocn.to_s
+ # @p_num=SiSU_PlaintextFormat::ParagraphNumber.new(paranum)
+ #end
+ p_num=''
+ if @env.plaintext_ocn?
+ if defined? dob.ocn \
+ and dob.ocn.is_a?(Fixnum)
+ p_num=SiSU_PlaintextFormat::ParagraphNumber.new(dob.ocn).display
+ end
+ end
+ if dob.is==:heading \
+ or dob.is==:para
+ plaintext_structure(dob,p_num)
+ elsif dob.is==:group \
+ or dob.is==:block \
+ or dob.is==:verse \
+ or dob.is==:code \
+ or dob.is==:table
+ @plaintext[:body] << dob.obj + p_num << @br
+ elsif dob.is==:break
+ sp=' '
+ ln='-'
+ @plaintext[:body] <<=if dob.obj==Mx[:br_page] \
+ or dob.obj==Mx[:br_page_new]
+ "#{@br}#{ln*40}#{@br*2}"
+ elsif dob.obj ==Mx[:br_obj]
+ "#{@br}#{sp*20}* * *#{@br*2}"
+ end # following empty line (@br) missing, fix
+ end
+ dob='' if (dob.obj =~/<a name="n\d+">/ \
+ and dob.obj =~/^(-\{{2}~\d+|<!e[:_]\d+!>)/) # -endnote
+ if dob ## Clean Prepared Text
+ dob.obj=dob.obj.gsub(/<!.+!>/,' ').
+ gsub(/<:\S+>/,' ')
+ end
+ end
+ end
+ @plaintext
+ end
+ def publish(plaintext)
+ divider='='
+ content=[]
+ content << plaintext[:open]
+ content << plaintext[:head]
+ content << plaintext[:body]
+ content << @@endnotes[:end] if @@endnotes_
+ content << "#{@br}#{divider*@wrap_width}#{@br}"
+ content << plaintext[:metadata]
+ content << "#{@br}#{divider*@wrap_width}#{@br}" if @md.stmp =~/\w+/ #not used?
+ content << plaintext[:tail]
+ Output.new(content,@md).plaintext
+ @@endnotes={ para: [], end: [] }
+ end
+ end
+ class Output <Source
+ include SiSU_Param
+ include SiSU_Env
+ def initialize(content,md)
+ @content,@md=content,md
+ end
+ def plaintext #%plaintext output
+ file_plaintext=SiSU_Env::FileOp.new(@md).write_file.txt
+ @sisu=[]
+ emptyline=0
+ @content.each do |para| # this is a hack
+ if para.is_a?(Array) \
+ and para.length > 0
+ para.each do |line|
+ if line
+ line.gsub!(/\s+$/m,'')
+ line.gsub!(/^\A[ ]*\Z/m,'')
+ if line=~/^\A[ ]*\Z/m
+ emptyline+=1
+ else emptyline=0
+ end
+ file_plaintext.puts line if emptyline < 2 #remove extra line spaces (fix upstream)
+ end
+ end
+ else file_plaintext.puts para #unix plaintext # /^([*=-]|\.){5}/
+ end
+ end
+ file_plaintext.close
+ end
+ end
+ end
+end
+__END__
+&#033;\|&#035;\|&&#042;\|&#045;\|&#047;\|&#095;\|&#123;\|&#125;\|&#126;\|&#
diff --git a/lib/sisu/v2/plaintext_format.rb b/lib/sisu/v4/plaintext_format.rb
index a38ae9d2..745fa715 100644
--- a/lib/sisu/v2/plaintext_format.rb
+++ b/lib/sisu/v4/plaintext_format.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -56,28 +55,28 @@
** Description: plaintext formatting template
=end
-module SiSU_Plaintext_format
- require "#{SiSU_lib}/param" # param.rb
+module SiSU_PlaintextFormat
+ require_relative 'param' # param.rb
include SiSU_Param
include SiSU_Viz
- class Paragraph_number
+ class ParagraphNumber
def initialize(paranum)
- @paranum=/(\d+)/m.match(paranum)[1]
+ @paranum=/(\d+)/m.match(paranum.to_s)[1]
end
def display
- @paranum.gsub(/(\d+)/,'<font size="1" color="#777777">&nbsp;&nbsp;\1</font>')
+ @paranum.gsub(/(\d+)/,"\n[\\1]")
end
- def name
- @paranum.gsub(/(\d+)/,'<a name="\1"></a>')
+ def name #unused
+ @paranum.gsub(/(\d+)/,'\1')
end
- def goto
- @paranum.gsub(/(\d+)/,'<a href="#\1">')
+ def goto #unused
+ @paranum.gsub(/(\d+)/,'"#\1"')
end
end
- class Format_text_object
+ class FormatTextObject
def initialize(md,t_o)
@md,@t_o=md,t_o
- if t_o.class==Hash
+ if t_o.is_a?(Hash)
@txt =t_o[:txt] || nil
@lnk_url =t_o[:lnk_url] || nil
@lnk_txt =t_o[:lnk_txt] || nil
@@ -86,10 +85,10 @@ module SiSU_Plaintext_format
p caller
end
rgx=/^#{Rx[:lv]}/
- @txt.gsub!(rgx,'') if @txt =~rgx
+ @txt=@txt.gsub(rgx,'') if @txt =~rgx
rgx=/#{Mx[:en_a_o]}[\d*+]+\s+(.+?)#{Mx[:en_a_c]}/
- @txt.gsub!(rgx,'\1') if @txt =~rgx
- @vz=SiSU_Env::Get_init.instance.skin
+ @txt=@txt.gsub(rgx,'\1') if @txt =~rgx
+ @vz=SiSU_Viz::Defaults.new
end
def scr_endnote_body
"<endnote>#{@txt}</endnote> "
diff --git a/lib/sisu/v4/po4a.rb b/lib/sisu/v4/po4a.rb
new file mode 100644
index 00000000..8404ae39
--- /dev/null
+++ b/lib/sisu/v4/po4a.rb
@@ -0,0 +1,979 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: pot file generation
+ linefeed)
+
+=end
+module SiSU_Po4a
+ require_relative 'dal' # dal.rb
+ require_relative 'sysenv' # sysenv.rb
+ include SiSU_Env
+ require_relative 'composite' # composite.rb
+ require_relative 'shared_metadata' # shared_metadata.rb
+ require_relative 'po4a_set' # po4a_set.rb
+ include SiSU_Param
+ include SiSU_Viz
+ pwd=Dir.pwd
+ class Source
+ @@opt_src,@@opt_trn,@@opt_src_,@@opt_trn_,@@md_src,@@md_trn=nil,nil,nil,nil,nil,nil
+ def initialize(opt,fn=nil)
+ @opt,@fn=opt,fn
+ #unless @opt.fns =~/(.+?\.(?:-|ssm\.)?sst)$/
+ # puts "#{@opt.fns} not a processed file type"
+ #end
+ r=Px[:lng_lst_rgx].gsub(/\|en\|/,'|')
+ @lang_regx=%r{(?:#{r})}
+ if opt.fns =~/\S+?~#{@lang_regx}\.ss[mti]/ \
+ and opt.f_pth[:lng]!=@opt.lng_base
+ @@opt_src_=false
+ @@opt_trn=opt
+ @@md_trn=SiSU_Param::Parameters.new(opt).get
+ else
+ @@opt_src_=true
+ @@opt_src=opt
+ @@md_src=SiSU_Param::Parameters.new(opt).get
+ end
+ end
+ def read
+ begin
+ src={}
+ src[:pth]=@opt.f_pth[:pth]
+ src[:files]=if @opt.fns =~ /\.(?:(?:-|ssm\.)sst|ssm)$/
+ @opt.fns=@opt.fns.gsub(/\.ssm\.sst$/,'.ssm')
+ SiSU_Assemble::CompositeFileList.new(@opt).read
+ else
+ [@opt.fns]
+ end
+ md=SiSU_Param::Parameters.new(@opt).get
+ src[:files].each do |fn|
+ SiSU_DAL::Source.new(@opt,fn).read # -m
+ env=SiSU_Env::InfoEnv.new(@opt.fns)
+ m=/((.+?)(?:\~\w\w(?:_\w\w)?)?)\.((?:-|ssm\.)?sst|ssm|ssi)$/ #watch added match for sss
+ @fnn,@fnb,@fnt=fn[m,1],fn[m,2],fn[m,3]
+ unless @opt.cmd =~/q/
+ path=env.path.output_tell
+ tool=(@opt.cmd =~/[MVv]/) \
+ ? "#{env.program.text_editor} #{path}/#{md.fnb}/#{md.fn[:plain]}"
+ : @opt.fns
+ @opt.cmd=~/[MVvz]/ \
+ ? SiSU_Screen::Ansi.new(@opt.cmd,'Pot po4a',tool).green_hi_blue
+ : SiSU_Screen::Ansi.new(@opt.cmd,'Pot po4a',tool).green_title_hi
+ SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{path}/#{md.fnb}/#{md.fn[:plain]}").flow if @opt.cmd =~/[MV]/
+ end
+ if @opt.fns =~/\S+?~#{@lang_regx}\.ss[mti]/ \
+ or @opt.f_pth[:lng] !=@opt.lng_base
+ opt_lang_trn_fn=fn
+ @dal_array_lang_translation=SiSU_DAL::Source.new(@opt,opt_lang_trn_fn).get # dal file drawn here
+ opt_lang_src_fn=if fn =~/\S+?~\S{2}(?:_\S{2})?\.ss[mti]/
+ fn.gsub(/(\S+?)~\S{2}(?:_\S{2})?(\.ss[mti])/,'\1\2') #check i
+ else fn
+ end
+ transdir,srcdir=Dir.pwd,Dir.pwd
+ if Dir.pwd.to_s =~/\/#{@lang_regx}$/
+ transdir=Dir.pwd
+ srcdir=transdir.gsub(/\/#{@lang_regx}$/,"/#{@opt.lng_base}")
+ if FileTest.directory?(srcdir)
+ Dir.chdir(srcdir)
+ end
+ else nil
+ end
+ x=if FileTest.file?("#{srcdir}/#{opt_lang_src_fn}")
+ @dal_array_lang_src=SiSU_DAL::Source.new(@@opt_src,opt_lang_src_fn).get # dal file drawn here
+ else
+ puts "no identified source document"
+ exit
+ end
+ Dir.chdir(transdir) if transdir
+ else
+ @dal_array_lang_src=SiSU_DAL::Source.new(@opt,fn).get # dal file drawn here
+ @dal_array_lang_translation=nil
+ end
+ wrap_width=if defined? md.make.plaintext_wrap \
+ and md.make.plaintext_wrap
+ md.make.plaintext_wrap
+ elsif defined? env.plaintext_wrap \
+ and env.plaintext_wrap
+ env.plaintext_wrap
+ else 78
+ end
+ SiSU_Po4a::Source::Scroll.new(fn,@dal_array_lang_src,@dal_array_lang_translation,@@md_src,@@md_trn,wrap_width).songsheet
+ end
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ end
+ end
+ private
+ class Scroll <Source
+ require_relative 'defaults' # defaults.rb
+ require_relative 'po4a_set' # po4a_set.rb
+ include SiSU_Po4aUtils
+ @@endnotes={ para: [], end: [] }
+ def initialize(fn,data_src,data_trn,md_src,md_trn,wrap_width)
+ @fn,@data_src,@data_trn,@md_src,@md_trn,@wrap_width=fn,data_src,data_trn,md_src,md_trn,wrap_width
+ @md=(md_trn.nil?) \
+ ? md_src
+ : md_trn
+ @brace_url=SiSU_Viz::Defaults.new.url_decoration
+ @vz=SiSU_Viz::Defaults.new
+ @tab="\t"
+ @@endnotes_=(@md.opt.mod.inspect =~/--endnote/) ? true : false # --footnote
+ @br=(@md.opt.mod.inspect =~/--dos/) ? "\r\n" : "\n" # --unix
+ @pot={ body: [], open: [], close: [], head: [], metadata: [], tail: [] }
+ end
+ def songsheet
+############## BUG @fn changes value
+ fn=@fn
+ pot=pot_markup(@data_src,@data_trn)
+ publish(fn,pot)
+ end
+ def extract_endnotes(dob='') #% Used for extraction of endnotes from paragraphs
+ notes_a=dob.obj.scan(/#{Mx[:en_a_o]}([\d]+\s+.+?)#{Mx[:en_a_c]}/)
+ ##notes_a=dob.obj.scan(/#{Mx[:en_a_o]}([\d*+]+\s+.+?)#{Mx[:en_a_c]}/)
+ #notes_b=dob.obj.scan(/#{Mx[:en_b_o]}([\d*+]+\s+.+?)#{Mx[:en_b_c]}/)
+ @n=[]
+ notes_a.flatten.each do |n| #high cost to deal with <br> appropriately within plaintext, consider
+ n=n.dup.to_s
+ n=n.gsub(/^([\d]+)\s+/,'^~\1 ').
+ #gsub(/^([\d*+]+)\s+/,'^~\1 ').
+ gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br>')
+ @n << n
+ end
+ notes_a=@n.flatten
+ end
+ def wrap_endnotes(orig_notes='',trn_notes='')
+ nt=@@endnotes_ ? 'endnote' : 'footnote'
+ @fn=0
+ a_l=orig_notes.length
+ 0.upto(a_l-1) do |i|
+ @fn=if orig_notes[i].to_s =~/^\^~([\d*+]+)/ # provides endnote number within paragraph
+ @fn += 1
+ else @fn
+ end
+ d="#{nt} #{@fn}"
+ mark="^~ "
+ instruct=s_mark=''
+ if @md.opt.cmd=~/M/
+ instruct=%{\n# footnotes, the preferred sisu markup for a footnote is~{this is a footnote}~ however, for translation a footnote reference marker in the text~^ with a set of notes following the paragraph starting on a newline with "^~ this is a footnote", is easier to deal with, if possible these should be converted back to~{inline notes}~}
+ s_mark="\n# " + %{"\\n\\n#{mark}...\\n\\n"}
+ end
+ desc="#{d}#{s_mark}#{instruct}"
+ orig=(orig_notes[i].to_s =~/^\^~[\d*+]+/) ? (orig_notes[i].to_s.gsub(/^\^~[\d*+]+/,'^~')) : orig_notes[i].to_s
+ trans=if trn_notes.is_a?(Array) \
+ and trn_notes.length==orig_notes.length
+ (trn_notes[i].to_s =~/^\^~[\d*+]+/) ? (trn_notes[i].to_s.gsub(/^\^~[\d*+]+/,'^~')) : trn_notes[i].to_s
+ else ''
+ end
+ util=pot_structure(desc,orig,trans)
+ wrap=util.line_wrap
+ wrap=if wrap =~ /^\s*\^~[\d*+]+\s+.+?\s*\Z/m
+ wrap.gsub(/^\s*(\^~[\d*+]+)\s+(.+?)\s*\Z/m, <<GSUB
+\\1 \\2
+GSUB
+ )
+ else
+ wrap.gsub(/^(.+)\Z/m, <<GSUB
+\\1
+GSUB
+ )
+ end
+ @@endnotes[:para] << wrap
+ @@endnotes[:end] << '' << wrap
+ end
+ @@endnotes[:para].each {|e| @pot[:body] << e << @br}
+ @@endnotes[:para]=[]
+ @@endnotes
+ end
+ def pot_metadata_src
+ @po4a_identify_type='type: SiSU doc' #'type: Plain text'
+ meta_src=SiSU_Metadata::Summary.new(@md_src)
+ w=[]
+ w << [
+ "#. #{@po4a_identify_type} - metadata: title",
+ "#: en/#{@md.fns}:#{SiSU_Po4aUtils::PotNumber.new.num}",
+ 'msgid ""',
+ meta_src.metadata_tags.title.main,
+ meta_src.metadata_tags.title.sub,
+ meta_src.metadata_tags.title.edition,
+ meta_src.metadata_tags.title.note,
+ meta_src.metadata_tags.title.short,
+ meta_src.metadata_tags.title.language,
+ meta_src.metadata_tags.title.language_char,
+ 'msgstr ""',
+ ]
+ w << [
+ "#. #{@po4a_identify_type} - metadata: creator",
+ "#: en/#{@md.fns}:#{SiSU_Po4aUtils::PotNumber.new.num}",
+ 'msgid ""',
+ meta_src.metadata_tags.creator.head,
+ meta_src.metadata_tags.creator.author,
+ meta_src.metadata_tags.creator.contributor,
+ meta_src.metadata_tags.creator.illustrator,
+ meta_src.metadata_tags.creator.photographer,
+ meta_src.metadata_tags.creator.translator,
+ meta_src.metadata_tags.creator.audio,
+ meta_src.metadata_tags.creator.digitized_by,
+ meta_src.metadata_tags.creator.prepared_by,
+ 'msgstr ""',
+ ]
+ w << [
+ "#. #{@po4a_identify_type} - metadata: rights",
+ "#: en/#{@md.fns}:#{SiSU_Po4aUtils::PotNumber.new.num}",
+ 'msgid ""',
+ meta_src.metadata_tags.rights.head,
+ meta_src.metadata_tags.rights.copyright.text,
+ meta_src.metadata_tags.rights.copyright.translation,
+ meta_src.metadata_tags.rights.copyright.illustrations,
+ meta_src.metadata_tags.rights.copyright.photographs,
+ meta_src.metadata_tags.rights.copyright.digitization,
+ meta_src.metadata_tags.rights.copyright.audio,
+ meta_src.metadata_tags.rights.license,
+ 'msgstr ""',
+ ]
+ w << [
+ "#. #{@po4a_identify_type} - metadata: classify",
+ "#: en/#{@md.fns}:#{SiSU_Po4aUtils::PotNumber.new.num}",
+ 'msgid ""',
+ meta_src.metadata_tags.classify.head,
+ meta_src.metadata_tags.classify.subject,
+ meta_src.metadata_tags.classify.topic_register,
+ meta_src.metadata_tags.classify.loc,
+ meta_src.metadata_tags.classify.dewey,
+ meta_src.metadata_tags.notes.relation,
+ meta_src.metadata_tags.notes.type,
+ meta_src.metadata_tags.identifier.oclc,
+ meta_src.metadata_tags.identifier.isbn,
+ 'msgstr ""',
+ ]
+ w << [
+ "#. #{@po4a_identify_type} - metadata: date",
+ "#: en/#{@md.fns}:#{SiSU_Po4aUtils::PotNumber.new.num}",
+ 'msgid ""',
+ meta_src.metadata_tags.date.head,
+ meta_src.metadata_tags.date.added_to_site,
+ meta_src.metadata_tags.date.available,
+ meta_src.metadata_tags.date.created,
+ meta_src.metadata_tags.date.issued,
+ meta_src.metadata_tags.date.modified,
+ meta_src.metadata_tags.date.published,
+ meta_src.metadata_tags.date.valid,
+ 'msgstr ""',
+ ]
+ w << [
+ "#. #{@po4a_identify_type} - processing, make instruction",
+ "#: en/#{@md.fns}:#{SiSU_Po4aUtils::PotNumber.new.num}",
+ 'msgid ""',
+ meta_src.processing_tags.make.language,
+ meta_src.processing_tags.make.headings,
+ meta_src.processing_tags.make.num_top,
+ meta_src.processing_tags.make.breaks,
+ meta_src.processing_tags.make.emphasis,
+ meta_src.processing_tags.make.bold,
+ meta_src.processing_tags.make.italics,
+ meta_src.processing_tags.make.texpdf_font,
+ 'msgstr ""',
+ ]
+ w.each do |y|
+ z=''
+ y.each do |x|
+ if x
+ z += x + "\n" if x =~/^#|^msg(?:id|str)/
+ z += %{"#{x}"\n} if x =~/^@\S+?:(?: |$)/
+ z += %{"#{x}"\n} if x =~/^\s+:\S+?: /
+ end
+ end
+ @pot[:metadata] << z << @br
+ #puts z unless z.empty?
+ end
+ end
+ def pot_metadata_src_trn
+ @po4a_identify_type='type: SiSU doc'
+ #@po4a_identify_type='type: Plain text'
+ meta_src=SiSU_Metadata::Summary.new(@md_src)
+ meta_trn=SiSU_Metadata::Summary.new(@md_trn)
+ w=[]
+ w << [
+ "#. #{@po4a_identify_type} - metadata: title",
+ "#: en/#{@md.fns}:#{SiSU_Po4aUtils::PotNumber.new.num}",
+ 'msgid ""',
+ meta_src.metadata_tags.title.main,
+ meta_src.metadata_tags.title.sub,
+ meta_src.metadata_tags.title.edition,
+ meta_src.metadata_tags.title.note,
+ meta_src.metadata_tags.title.short,
+ meta_src.metadata_tags.title.language,
+ meta_src.metadata_tags.title.language_char,
+ 'msgstr ""',
+ meta_trn.metadata_tags.title.main,
+ meta_trn.metadata_tags.title.sub,
+ meta_trn.metadata_tags.title.edition,
+ meta_trn.metadata_tags.title.note,
+ meta_trn.metadata_tags.title.short,
+ meta_trn.metadata_tags.title.language,
+ meta_trn.metadata_tags.title.language_char,
+ ]
+ w << [
+ "#. #{@po4a_identify_type} - metadata: creator",
+ "#: en/#{@md.fns}:#{SiSU_Po4aUtils::PotNumber.new.num}",
+ 'msgid ""',
+ meta_src.metadata_tags.creator.head,
+ meta_src.metadata_tags.creator.author,
+ meta_src.metadata_tags.creator.contributor,
+ meta_src.metadata_tags.creator.illustrator,
+ meta_src.metadata_tags.creator.photographer,
+ meta_src.metadata_tags.creator.translator,
+ meta_src.metadata_tags.creator.audio,
+ meta_src.metadata_tags.creator.digitized_by,
+ meta_src.metadata_tags.creator.prepared_by,
+ 'msgstr ""',
+ meta_trn.metadata_tags.creator.head,
+ meta_trn.metadata_tags.creator.author,
+ meta_trn.metadata_tags.creator.contributor,
+ meta_trn.metadata_tags.creator.illustrator,
+ meta_trn.metadata_tags.creator.photographer,
+ meta_trn.metadata_tags.creator.translator,
+ meta_trn.metadata_tags.creator.audio,
+ meta_trn.metadata_tags.creator.digitized_by,
+ meta_trn.metadata_tags.creator.prepared_by,
+ ]
+ w << [
+ "#. #{@po4a_identify_type} - metadata: rights",
+ "#: en/#{@md.fns}:#{SiSU_Po4aUtils::PotNumber.new.num}",
+ 'msgid ""',
+ meta_src.metadata_tags.rights.head,
+ meta_src.metadata_tags.rights.copyright.text,
+ meta_src.metadata_tags.rights.copyright.translation,
+ meta_src.metadata_tags.rights.copyright.illustrations,
+ meta_src.metadata_tags.rights.copyright.photographs,
+ meta_src.metadata_tags.rights.copyright.digitization,
+ meta_src.metadata_tags.rights.copyright.audio,
+ meta_src.metadata_tags.rights.license,
+ 'msgstr ""',
+ meta_trn.metadata_tags.rights.head,
+ meta_trn.metadata_tags.rights.copyright.text,
+ meta_trn.metadata_tags.rights.copyright.translation,
+ meta_trn.metadata_tags.rights.copyright.illustrations,
+ meta_trn.metadata_tags.rights.copyright.photographs,
+ meta_trn.metadata_tags.rights.copyright.digitization,
+ meta_trn.metadata_tags.rights.copyright.audio,
+ meta_trn.metadata_tags.rights.license,
+ ]
+ w << [
+ "#. #{@po4a_identify_type} - metadata: classify",
+ "#: en/#{@md.fns}:#{SiSU_Po4aUtils::PotNumber.new.num}",
+ 'msgid ""',
+ meta_src.metadata_tags.classify.head,
+ meta_src.metadata_tags.classify.subject,
+ meta_src.metadata_tags.classify.topic_register,
+ meta_src.metadata_tags.classify.loc,
+ meta_src.metadata_tags.classify.dewey,
+ meta_src.metadata_tags.notes.relation,
+ meta_src.metadata_tags.notes.type,
+ meta_src.metadata_tags.identifier.oclc,
+ meta_src.metadata_tags.identifier.isbn,
+ 'msgstr ""',
+ meta_trn.metadata_tags.classify.head,
+ meta_trn.metadata_tags.classify.subject,
+ meta_trn.metadata_tags.classify.topic_register,
+ meta_trn.metadata_tags.classify.loc,
+ meta_trn.metadata_tags.classify.dewey,
+ meta_trn.metadata_tags.notes.relation,
+ meta_trn.metadata_tags.notes.type,
+ meta_trn.metadata_tags.identifier.oclc,
+ meta_trn.metadata_tags.identifier.isbn,
+ ]
+ w << [
+ "#. #{@po4a_identify_type} - metadata: date",
+ "#: en/#{@md.fns}:#{SiSU_Po4aUtils::PotNumber.new.num}",
+ 'msgid ""',
+ meta_src.metadata_tags.date.head,
+ meta_src.metadata_tags.date.added_to_site,
+ meta_src.metadata_tags.date.available,
+ meta_src.metadata_tags.date.created,
+ meta_src.metadata_tags.date.issued,
+ meta_src.metadata_tags.date.modified,
+ meta_src.metadata_tags.date.published,
+ meta_src.metadata_tags.date.valid,
+ 'msgstr ""',
+ meta_trn.metadata_tags.date.head,
+ meta_trn.metadata_tags.date.added_to_site,
+ meta_trn.metadata_tags.date.available,
+ meta_trn.metadata_tags.date.created,
+ meta_trn.metadata_tags.date.issued,
+ meta_trn.metadata_tags.date.modified,
+ meta_trn.metadata_tags.date.published,
+ meta_trn.metadata_tags.date.valid,
+ ]
+ w << [
+ "#. #{@po4a_identify_type} - processing, make instruction",
+ "#: en/#{@md.fns}:#{SiSU_Po4aUtils::PotNumber.new.num}",
+ 'msgid ""',
+ meta_src.processing_tags.make.language,
+ meta_src.processing_tags.make.headings,
+ meta_src.processing_tags.make.num_top,
+ meta_src.processing_tags.make.breaks,
+ meta_src.processing_tags.make.emphasis,
+ meta_src.processing_tags.make.bold,
+ meta_src.processing_tags.make.italics,
+ meta_src.processing_tags.make.texpdf_font,
+ 'msgstr ""',
+ meta_trn.processing_tags.make.language,
+ meta_trn.processing_tags.make.headings,
+ meta_trn.processing_tags.make.num_top,
+ meta_trn.processing_tags.make.breaks,
+ meta_trn.processing_tags.make.emphasis,
+ meta_trn.processing_tags.make.bold,
+ meta_trn.processing_tags.make.italics,
+ meta_trn.processing_tags.make.texpdf_font,
+ ]
+ w.each do |y|
+ z=''
+ y.each do |x|
+ if x
+ z += x + "\n" if x =~/^#|^msg(?:id|str)/
+ z += %{"#{x}"\n} if x =~/^@\S+?:(?: |$)/
+ z += %{"#{x}"\n} if x =~/^\s+:\S+?: /
+ end
+ end
+ @pot[:metadata] << z << @br
+ #puts z unless z.empty?
+ end
+ end
+ def pot_structure(desc,orig,trans,indent=0,hang=0)
+ SiSU_Po4aUtils::Wrap.new(@md,orig,trans,desc,@wrap_width,indent,hang)
+ end
+ def pot_structure_heading(dob_src='',notes_s='',dob_trn='',notes_t='') #% Used to extract the structure of a document
+ lv=n=n3=nil
+ lv=dob_src.ln
+ n=lv - 1
+ n3=lv + 2
+ util=nil
+ fn=(dob_src.name=~/[a-z\d]/i) ? dob_src.name : ''
+ mark="#{dob_src.lv}~#{fn} "
+ d="#{dob_src.is.to_s} (level #{dob_src.lv})"
+ instruct=s_mark=''
+ if @md.opt.cmd=~/M/
+ instruct=%{\n# markup for headings is marker at the start of the line/object, indicating the heading level, and if provided an associated name tag, this heading is "#{mark}"}
+ s_mark="\n# " + %{"\\n\\n#{mark}...\\n\\n"}
+ end
+ desc="#{d}#{s_mark}#{instruct}"
+ orig="#{s_mark}#{dob_src.obj}"
+ trans=(dob_trn=='') ? '' : "#{s_mark}#{dob_trn.obj}"
+ util=pot_structure(desc,orig,trans)
+ wrapped=util.line_wrap
+ @pot[:body] << wrapped << @br # main text, contents, body KEEP
+ if @@endnotes[:para] \
+ and notes_s.length > 0 \
+ and not @@endnotes_
+ @pot[:body] << @br
+ wrap_endnotes(notes_s,notes_t)
+ elsif @@endnotes[:para] \
+ and @@endnotes_
+ @pot[:body] << @br*2
+ end
+ end
+ def pot_structure_para(dob_src='',notes_s='',dob_trn='',notes_t='') #% Used to extract the structure of a document
+ util=nil
+ wrapped=if dob_src.indent =~/[1-9]/ \
+ and dob_src.indent == dob_src.hang
+ s_mark=desc=orig=trans=''
+ if dob_src.bullet_
+ mark="_#{dob_src.indent}* "
+ d="#{dob_src.is.to_s}: indent #{dob_src.indent}, bullet"
+ instruct=s_mark=''
+ if @md.opt.cmd=~/M/
+ instruct=%{\n# markup for indented bullet text is at the start of the line/object, an underscore followed by the indent level and an asterisk "#{mark}"}
+ s_mark="\n# " + %{"\\n\\n#{mark}...\\n\\n"}
+ end
+ desc="#{d}#{s_mark}#{instruct}"
+ else
+ mark="_#{dob_src.indent} "
+ d="#{dob_src.is.to_s}: indent #{dob_src.indent}"
+ instruct=s_mark=''
+ if @md.opt.cmd=~/M/
+ instruct=%{\n# markup for indented text is at the start of the line/object, an underscore followed by the indent level "#{mark}"}
+ s_mark="\n# " + %{"\\n\\n#{mark}...\\n\\n"}
+ end
+ desc="#{d}#{s_mark}#{instruct}"
+ end
+ orig="#{s_mark}#{dob_src.obj}"
+ trans=(dob_trn=='') ? '' : "#{s_mark}#{dob_trn.obj}"
+ util=pot_structure(desc,orig,trans)
+ elsif dob_src.hang =~/[0-9]/ \
+ and dob_src.indent != dob_src.hang
+ s_mark=desc=orig=trans=''
+ mark="_#{dob_src.hang}_#{dob_src.indent} "
+ d="#{dob_src.is.to_s}: hang #{dob_src.hang} indent #{dob_src.indent}"
+ instruct=s_mark=''
+ if @md.opt.cmd=~/M/
+ instruct=%{\n# markup for indented text with a first line indented to a different level from the rest of the paragraph, is at the start of the line/object, an underscore and the first indent level a second underscore and the indent level for the rest of the paragraph, "#{mark1}"}
+ s_mark="\n# " + %{"\\n\\n#{mark}...\\n\\n"}
+ end
+ desc="#{d}#{s_mark}#{instruct}"
+ orig="#{s_mark}#{dob_src.obj}"
+ trans=(dob_trn=='') ? '' : "#{s_mark}#{dob_trn.obj}"
+ util=pot_structure(desc,orig,trans)
+ else
+ s_mark=desc=orig=trans=''
+ if dob_src.bullet_
+ mark='_* '
+ d="#{dob_src.is.to_s}: bullet"
+ instruct=s_mark=''
+ if @md.opt.cmd=~/M/
+ instruct=%{\n# markup for indented text is at the start of the line/object, an underscore followed by an asterisk "#{mark}"}
+ s_mark="\n# " + %{"\\n\\n#{mark}...\\n\\n"}
+ end
+ desc="#{d}#{s_mark}#{instruct}"
+ orig="#{s_mark}#{dob_src.obj}"
+ trans=(dob_trn=='') ? '' : "#{s_mark}#{dob_trn.obj}"
+ else
+ mark=''
+ d=dob_src.is.to_s
+ instruct=%{\n# regular paragraph, no special markup}
+ if @md.opt.cmd=~/M/
+ instruct="\n# "
+ s_mark="\n# " + %{"\\n\\n#{mark}...\\n\\n"}
+ end
+ desc="#{d}#{s_mark}#{instruct}"
+ orig=dob_src.obj
+ trans=(dob_trn=='') ? '' : dob_trn.obj
+ end
+ util=pot_structure(desc,orig,trans)
+ end
+ wrapped=util.line_wrap
+ @pot[:body] << wrapped << @br # main text, contents, body KEEP
+ if @@endnotes[:para] \
+ and notes_s.length > 0 \
+ and not @@endnotes_
+ @pot[:body] << @br
+ wrap_endnotes(notes_s,notes_t)
+ elsif @@endnotes[:para] \
+ and @@endnotes_
+ @pot[:body] << @br*2
+ end
+ end
+ def pot_structure_block(dob_src='',notes_s='',dob_trn='',notes_t='') #% Used to extract the structure of a document
+ mark="block{\\n\\n...\\n\\n}block"
+ d=dob_src.is.to_s
+ instruct=s_mark=''
+ if @md.opt.cmd=~/M/
+ instruct="\n# block text is a text block with an opening and closing marker, the content of which may be wrapped"
+ s_mark="\n# " + %{"\\n\\n#{mark}\\n\\n"}
+ end
+ desc="#{d}#{s_mark}#{instruct}"
+ orig=dob_src.obj
+ trans=(dob_trn=='') ? '' : dob_trn.obj
+ util=pot_structure(desc,orig,trans)
+ unwrapped=util.no_line_wrap_block
+ @pot[:body] << unwrapped << @br
+ end
+ def pot_structure_group(dob_src='',notes_s='',dob_trn='',notes_t='') #% Used to extract the structure of a document
+ mark="group{\\n\\n...\\n\\n}group"
+ d=dob_src.is.to_s
+ instruct=s_mark=''
+ if @md.opt.cmd=~/M/
+ instruct="\n# group text is a text block with an opening and closing marker, the content of which may be wrapped"
+ s_mark="\n# " + %{"\\n\\n#{mark}\\n\\n"}
+ end
+ desc="#{d}#{s_mark}#{instruct}"
+ orig=dob_src.obj
+ trans=(dob_trn=='') ? '' : dob_trn.obj
+ util=pot_structure(desc,orig,trans)
+ unwrapped=util.no_line_wrap_block
+ @pot[:body] << unwrapped << @br
+ end
+ def pot_structure_verse(dob_src='',notes_s='',dob_trn='',notes_t='') #% Used to extract the structure of a document
+ mark="poem{\n\nverse\n\nverse\n\n...\n\n}poem"
+ d=dob_src.is.to_s
+ instruct=s_mark=''
+ if @md.opt.cmd=~/M/
+ instruct="\n# verse are part of the text block described as a poem, the first verse is preceeded by an opening marker, and the last verse by a closing marker, the content of which should remain unwrapped"
+ s_mark="\n# " + %{"\\n\\n#{mark}\\n\\n"}
+ end
+ desc="#{d}#{s_mark}#{instruct}"
+ orig=dob_src.obj
+ trans=(dob_trn=='') ? '' : dob_trn.obj
+ util=pot_structure(desc,orig,trans)
+ unwrapped=util.no_line_wrap_block
+ @pot[:body] << unwrapped << @br
+ end
+ def pot_structure_code(dob_src='',notes_s='',dob_trn='',notes_t='') #% Used to extract the structure of a document
+ mark="code{\\n\\n...\\n\\n}code"
+ d=dob_src.is.to_s
+ instruct=s_mark=''
+ if @md.opt.cmd=~/M/
+ instruct="\n# codeblocks are a text block with an opening and closing marker, the content of which should remain unwrapped"
+ s_mark="\n# " + %{"\\n\\n#{mark}\\n\\n"}
+ end
+ desc="#{d}#{s_mark}#{instruct}"
+ orig=dob_src.obj
+ trans=(dob_trn=='') ? '' : dob_trn.obj
+ util=pot_structure(desc,orig,trans)
+ unwrapped=util.no_line_wrap_block
+ @pot[:body] << unwrapped << @br
+ end
+ def pot_structure_table(dob_src='',notes_s='',dob_trn='',notes_t='') #% Used to extract the structure of a document
+ mark="table{\\n\\n...\\n\\n}table"
+ d=dob_src.is.to_s
+ instruct=s_mark=''
+ if @md.opt.cmd=~/M/
+ instruct="\n# tables are a text block with an opening and closing marker, the content of which should remain unwrapped"
+ s_mark="\n# " + %{"\\n\\n#{mark}\\n\\n"}
+ end
+ desc="#{d}#{s_mark}#{instruct}"
+ orig=dob_src.obj
+ orig=orig.gsub(/#{Mx[:tc_c]}/,"\n")
+ trans=(dob_trn=='') ? '' : dob_trn.obj
+ trans=trans.gsub(/#{Mx[:tc_c]}/,"\n")
+ util=pot_structure(desc,orig,trans)
+ unwrapped=util.no_line_wrap_block
+ @pot[:body] << unwrapped << @br
+ end
+ def pot_structure_idx(dob_src='',dob_trn='') #% Used to extract the structure of a document
+ mark="={ ... }"
+ instruct=s_mark=''
+ if @md.opt.cmd=~/M/
+ instruct="\n# the book index should be attached unwrapped to the preceding text block (there should be a new line, but no empty line)"
+ s_mark="\n# " + %{"\\n#{mark}\\n\\n"}
+ end
+ d='book-idx'
+ desc="#{d}#{s_mark}#{instruct}"
+ orig='={' + dob_src.idx + '}'
+ trans=if defined? dob_trn.idx \
+ and not dob_trn.idx.nil? \
+ and not dob_trn.idx.empty?
+ '={' + dob_trn.idx + '}'
+ else ''
+ end
+ util=pot_structure(desc,orig,trans)
+ unwrapped=util.no_line_wrap_block
+ @pot[:body] << unwrapped << @br
+ end
+ def pot_markup(data_src,data_trn)
+ #@endnotes,@copen,@pot_contents_close=Array.new(3){[]}
+ a_l=if data_trn
+ a_l=(data_src.length >= data_trn.length) \
+ ? data_src.length
+ : data_trn.length
+ else
+ data_src.length
+ end
+ s,t=0,0
+ if @md.fns =~ /\.(?:(?:-|ssm\.)?sst|ssm)$/
+ (data_trn.nil?) \
+ ? pot_metadata_src
+ : pot_metadata_src_trn
+ end
+ 0.upto(a_l-1) do |i|
+ if data_trn
+ unless data_src[s] \
+ and data_trn[t]
+ break
+ end
+ if data_src[s].of == :comment \
+ and data_trn[t].of == :comment \
+ and (data_src[s].is == data_trn[t].is)
+ s+=1;t+=1
+ next
+ end
+ if (data_src[s].is == :comment or data_trn[t].is == :comment) \
+ and (data_src[s].is != data_trn[t].is)
+ if data_src[s].is == :comment
+ puts "src (comment):\n\t" + data_src[s].obj if @md.opt.cmd =~/M/
+ s+=1
+ #next if data_src[s].is == :comment
+ elsif data_trn[t].is == :comment
+ puts "trans (comment):\n\t" + data_trn[t].obj if @md.opt.cmd =~/M/
+ t+=1
+ #next if data_trn[t].is == :comment
+ end
+ end
+ if (defined? data_src[s].ocn and data_src[s].ocn.is_a?(Fixnum)) \
+ and (defined? data_trn[t].ocn and data_trn[t].ocn.is_a?(Fixnum)) \
+ and (data_src[s].ocn == data_trn[t].ocn)
+ @m_s,@m_t=s,t
+ elsif (defined? data_src[s].ocn and data_src[s].ocn.is_a?(Fixnum)) \
+ and (defined? data_trn[t].ocn and data_trn[t].ocn.is_a?(Fixnum)) \
+ and (data_src[s].ocn != data_trn[t].ocn)
+ p '--- OCN ---'
+ p 'mis-match'
+ p data_src[s].ocn
+ p data_src[s].obj
+ p data_trn[t].ocn
+ p data_trn[t].obj
+ p '---'
+ p 'previous match'
+ p data_src[@m_s].ocn
+ p data_src[@m_s].obj
+ p data_trn[@m_t].ocn
+ p data_trn[@m_t].obj
+ exit
+ elsif (defined? data_src[s].ocn and defined? data_trn[t].ocn \
+ and data_src[s].ocn.class != data_trn[t].ocn.class)
+ p '--- OCN class ---'
+ p 'mis-match'
+ p data_src[s].ocn if defined? data_src[s].ocn
+ p data_src[s].obj
+ p data_trn[t].ocn if defined? data_trn[t].ocn
+ p data_trn[t].obj
+ #p '---'
+ #p 'previous match'
+ #p data_src[@m_s].ocn
+ #p data_src[@m_s].obj
+ #p data_trn[@m_t].ocn
+ #p data_trn[@m_t].obj
+ #elsif (defined? data_src[s].ocn != defined? data_trn[t].ocn) \
+ #and (data_src[s].ocn.nil? != data_trn[t].ocn.nil?)
+ # p '--- missing OCN? ---'
+ # p 'mis-match'
+ # p data_src[s].ocn if defined? data_src[s].ocn
+ # p data_src[s].obj
+ # p data_trn[t].ocn if defined? data_trn[t].ocn
+ # p data_trn[t].obj
+ else
+ end
+ end
+ notes_s,notes_t='',''
+ data_src[s],notes_s=markup(data_src[s])
+ if data_trn
+ data_trn[t],notes_t=markup(data_trn[t])
+ #data_src[s],data_trn[t]=pot_data(data_src[s],notes_s,data_trn[t],notes_t)
+ pot_data(data_src[s],notes_s,data_trn[t],notes_t)
+ else
+ #data_src[s],nul=pot_data(data_src[s],notes_s)
+ pot_data(data_src[s],notes_s)
+ end
+ s+=1;t+=1
+ end
+ @pot #watch
+ end
+ def pot_data(dob_src='',notes_s='',dob_trn='',notes_t='')
+ if dob_src.obj !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/
+ if defined? dob_src.ocn \
+ and dob_src.ocn.to_s =~/\d+/
+ paranum=dob_src.ocn.to_s
+ @p_num=SiSU_Po4aUtils::ParagraphNumber.new(paranum)
+ end
+ case dob_src.is
+ when :heading; pot_structure_heading(dob_src,notes_s,dob_trn,notes_t)
+ when :para; pot_structure_para(dob_src,notes_s,dob_trn,notes_t)
+ when :group; pot_structure_group(dob_src,notes_s,dob_trn,notes_t)
+ when :block; pot_structure_block(dob_src,notes_s,dob_trn,notes_t)
+ when :verse; pot_structure_verse(dob_src,notes_s,dob_trn,notes_t)
+ when :code; pot_structure_code(dob_src,notes_s,dob_trn,notes_t)
+ when :table; pot_structure_table(dob_src,notes_s,dob_trn,notes_t)
+ end
+ if defined? dob_src.idx \
+ and not dob_src.idx.nil? \
+ and not dob_src.idx.empty?
+ pot_structure_idx(dob_src,dob_trn)
+ end
+ dob_src='' if (dob_src.obj =~/<a name="n\d+">/ \
+ and dob_src.obj =~/^(-\{{2}~\d+|<!e[:_]\d+!>)/) # -endnote
+ if dob_src ## Clean Prepared Text
+ dob_src.obj=dob_src.obj.gsub(/<!.+!>/,' ').
+ gsub(/<:\S+>/,' ') if dob_src ## Clean Prepared Text
+ end
+ end
+ #[dob_src,dob_trn]
+ end
+ def markup(dob) # Used for major markup instructions
+ dir=SiSU_Env::InfoEnv.new(@md.fns)
+ fix=[]
+ dob.obj=dob.obj.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,
+ "#{Px[:po_bold_o]}\\1#{Px[:po_bold_c]}").
+ gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,
+ "#{Px[:po_italics_o]}\\1#{Px[:po_italics_c]}").
+ gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,
+ "#{Px[:po_underscore_o]}\\1#{Px[:po_underscore_c]}").
+ gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,
+ "#{Px[:po_subscript_o]}\\1#{Px[:po_subscript_c]}").
+ gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,
+ "#{Px[:po_superscript_o]}\\1#{Px[:po_superscript_c]}").
+ gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,
+ "#{Px[:po_insert_o]}\\1#{Px[:po_insert_c]}").
+ gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,
+ "#{Px[:po_cite_o]}\\1#{Px[:po_cite_c]}").
+ gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,
+ "#{Px[:po_strike_o]}\\1#{Px[:po_strike_c]}").
+ gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,
+ "#{Px[:po_monospace_o]}\\1#{Px[:po_monospace_c]}")
+ notes=''
+ unless dob.is==:code
+ dob.obj=dob.obj.gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/,'\1').
+ gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1').
+ gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1 [link: <\2>]').
+ gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}image/,'\1 [link: local image]').
+ gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1')
+ #dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,"#{@brace_url.txt_open}\\1#{@brace_url.txt_close}")
+ notes=extract_endnotes(dob)
+ #% ### footnotes current state - extracted
+ dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}([\d]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'~^'). # endnote marker marked up
+ #% ### footnotes current state - keep inline
+ #dob.obj.gsub!(/#{Mx[:en_a_o]}[\d]+\s+(.+?)#{Mx[:en_a_c]}/,'~{ \1 }~') # inline endnote with marker marked up
+ gsub(/#{Mx[:en_b_o]}[\d]+\s+(.+?)#{Mx[:en_b_c]}/,'~[ \1 ]~'). # inline endnote with marker marked up
+ gsub(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)#{Mx[:en_a_c]}/,'~{\1 \2 }~'). # inline endnote with marker marked up
+ gsub(/#{Mx[:en_b_o]}([*+]+)\s+(.+?)#{Mx[:en_b_c]}/,'~[\1 \2 ]~'). # inline endnote with marker marked up
+ gsub(/#{Mx[:gl_o]}(?:#lt|#060)#{Mx[:gl_c]}/,'<').
+ gsub(/#{Mx[:gl_o]}(?:#gt|#062)#{Mx[:gl_c]}/,'>').
+ gsub(/#{Mx[:gl_o]}#(?:038|amp)#{Mx[:gl_c]}/,'&').
+ gsub(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!').
+ gsub(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#').
+ gsub(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*').
+ gsub(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-').
+ gsub(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/').
+ gsub(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_').
+ gsub(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{').
+ gsub(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}').
+ gsub(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~').
+ gsub(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'©')
+ end
+ dob.obj=if dob.of==:block # watch
+ dob.obj.gsub(/#{Mx[:gl_o]}●#{Mx[:gl_c]}/,"* ").
+ gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"\n")
+ else dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"\n\n")
+ end
+ if dob.is==:code
+ dob.obj=dob.obj.gsub(/(^|[^}])_([<>])/m,'\1\2'). # _> _<
+ gsub(/(^|[^}])_([<>])/m,'\1\2') # _<_<
+ end
+ dob.obj=dob.obj.gsub(/#{Mx[:br_page]}\s*|#{Mx[:br_page_new]}/,''). # remove page breaks
+ gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1').
+ gsub(/<a href=".+?">(.+?)<\/a>/m,'\1').
+ gsub(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,''). # remove name links
+ gsub(/&nbsp;|#{Mx[:nbsp]}/,' '). # decide on
+ gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,' [ \1 ]'). #"[ #{dir.url.images_local}\/\\1 ]")
+ gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}image/,' [ \1 ]'). #"[ #{dir.url.images_local}\/\\1 ]")
+ gsub(/(?:^|[^_\\])\{\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*\}\S+/,'[image: "\1"]')
+ [dob,notes]
+ end
+ def publish(fn,pot)
+ divider='='
+ content=[]
+ content << pot[:open]
+ content << pot[:head]
+ content << pot[:metadata]
+ content << pot[:body]
+ content << @@endnotes[:end] if @@endnotes_
+ Output.new(fn,content,@md).po4a
+ @@endnotes={ para: [], end: [] }
+ end
+ end
+ class Output <Source
+ include SiSU_Param
+ include SiSU_Env
+ def initialize(fn,content,md)
+ @fn,@content,@md=fn,content,md
+ @file=SiSU_Env::FileOp.new(md,fn)
+ end
+ def po4a #%pot output
+ file_pot=(@md.opt.f_pth[:lng] ==@md.opt.lng_base) \
+ ? @file.write_file.pot
+ : @file.write_file.po
+ @sisu=[]
+ emptyline=0
+ @content.each do |para| # this is a hack
+ if para.is_a?(Array) \
+ and para.length > 0
+ para.each do |line|
+ if line
+ line=line.gsub(/\s+$/m,'').
+ gsub(/^\A[ ]*\Z/m,'')
+ if line=~/^\A[ ]*\Z/m
+ emptyline+=1
+ else emptyline=0
+ end
+ file_pot.puts line if emptyline < 2 #remove extra line spaces (fix upstream)
+ end
+ end
+ else file_pot.puts para #unix plaintext # /^([*=-]|\.){5}/
+ end
+ end
+ file_pot.close
+ SiSU_Po4aUtils::PotNumber.new.reset
+ po4a_git
+ end
+ def po4a_git
+ unless @md.opt.cmd =~/M/
+ require_relative 'git' # git.rb
+ git=SiSU_Git::Source.new(@md.opt)
+ git.create_file_structure_git unless FileTest.directory?(@file.output_path.pot_git.dir)
+ if @md.opt.f_pth[:lng] ==@md.opt.lng_base
+ FileUtils::cp(@file.place_file.pot.dir, @file.output_path.pot_git.dir)
+ else # naive, work on -->
+ FileUtils::cp(@file.place_file.po.dir, @file.output_path.po_git.dir) #unless FileTest.file?(@file.place_file.po_git.dir)
+ end
+ git.read
+ end
+ end
+ end
+ end
+end
+__END__
+&#033;\|&#035;\|&&#042;\|&#045;\|&#047;\|&#095;\|&#123;\|&#125;\|&#126;\|&#
+
+tables are problematic, difficult to reconstitute instruction, check
+
+metadata, move to top? and work on
+
+footnotes, different types, asterisk, also do you want to have separate
+paragraphs, or breaks within one block?
+
+where no ocn appropriately use ~# or -# or indeed 1~name-
+
+comments in document, what to do about them, not sure they are currently
+retained in dal, could be quite valuable to keep
diff --git a/lib/sisu/v4/po4a_set.rb b/lib/sisu/v4/po4a_set.rb
new file mode 100644
index 00000000..020f521c
--- /dev/null
+++ b/lib/sisu/v4/po4a_set.rb
@@ -0,0 +1,298 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: modules shared by flatfile output generators
+
+=end
+module SiSU_Po4aUtils
+ class Wrap
+ def initialize(md,orig='',trans='',is_desc='',n_char_max=76,n_indent=0,n_hang=nil)
+ @md,@orig,@trans,@is_desc,@n_char_max,@n_indent=md,orig,trans,is_desc,n_char_max,n_indent
+ @n_char_max_extend = n_char_max
+ @br="\n"
+ @n_hang=n_hang ? n_hang : @n_indent
+ @po4a_identify_type='type: SiSU doc'
+ #@po4a_identify_type='type: Plain text'
+ end
+ def line_wrap
+ space=' '
+ spaces_indent,spaces_hang="#{@br}#{space*@n_indent}",space*@n_hang
+ pot,i=[],0
+ pot_array=(@trans.empty?) ? [@orig] : [@orig,@trans]
+ pot_array.each do |pa|
+ line=0
+ out=[]
+ out[line]=''
+ @oldword='' #REMOVE @oldword
+ pa=pa.gsub(/<br>/,' <br> ').
+ gsub(/#{Mx[:br_nl]}/,"\n\n")
+ words=pa.scan(/\n\n|<br>|\S+/m)
+ while words != ''
+ word=words.shift
+ if not word
+ out[line] unless out[line].empty? #check
+ break
+ elsif word =~/\n\n/
+ word="\n"
+ @n_char_max_extend = @n_char_max + out[line].length
+ line=line
+ elsif (out[line].length + word.length) > (@n_char_max_extend - @n_indent) \
+ and out[line] =~/\S+/
+ @n_char_max_extend = @n_char_max
+ out[line].squeeze!(' ')
+ line += 1
+ end
+ if word
+ out[line]=if out[line] \
+ and out[line] !~/\S+$/m
+ "#{out[line]}#{word}"
+ elsif out[line] \
+ and out[line] =~/\S+/
+ "#{out[line]} #{word}"
+ else "#{word.strip}"
+ end
+ end
+ @oldword=word if word =~/\S+/
+ end
+ x=out.join(spaces_indent).gsub(/\A\n+/m,'').insert(0,spaces_hang)
+ z=[]
+ x.split(/\n/).each do |y|
+ y=y.gsub(/"/,'\"')
+ y=%{"#{y}"}
+ z << y
+ end
+ pot[i]=z.join("\n")
+ i +=1
+ pot
+ end
+ trans=(pot.length == 2) ? pot[1] : ''
+ po_str=<<WOK
+#. #{@po4a_identify_type} - #{@is_desc}
+#: en/#{@md.fns}:#{PotNumber.new.num}
+msgid ""
+#{pot[0]}
+msgstr ""
+#{trans}
+WOK
+ po_str
+ end
+ def no_line_wrap_block
+ pot,i=[],0
+ pot_array=(@trans.empty?) ? [@orig] : [@orig,@trans]
+ pot_array.each do |pa|
+ z=[]
+ pa.split(/\n\n/).each do |y|
+ y=y.gsub(/"/,'\"')
+ y=%{"#{y}"}
+ z << y if not y.empty?
+ end
+ pot[i]=z.join("\n")
+ i +=1
+ pot
+ end
+ trans=(pot.length == 2) ? pot[1] : ''
+ po_str=<<WOK
+#. #{@po4a_identify_type} - #{@is_desc}
+#: en/#{@md.fns}:#{PotNumber.new.num}
+#, no-wrap
+msgid ""
+#{pot[0]}
+msgstr ""
+#{trans}
+WOK
+ po_str
+ end
+ def line_wrap_indent1
+ @n_indent,@n_hang=2,2
+ line_wrap
+ end
+ def line_wrap_endnote
+ @n_indent,@n_hang=4,2
+ line_wrap
+ end
+ def array_wrap
+ if @orig.is_a?(Array)
+ @arr=[]
+ @orig.each do |line|
+ @arr << SiSU_TextUtils::Wrap.new(line,@n_char_max,@n_indent,@n_hang).line_wrap
+ end
+ end
+ @arr
+ end
+ end
+ class HeaderScan
+ def initialize(md,para)
+ @md,@p=md,para
+ end
+ def extract(tag,tag_content,type,attrib)
+ dc=if dc_tag \
+ and dc_content
+ [dc_tag,dc_content,{dc_tag=>dc_content}]
+ else nil
+ end
+ end
+ def header(tag,tag_content,type='',attrib='') #this will break stuff and must be tested thoroughly 20060825
+ @tag,@tag_content,@type,@attrib=tag,tag_content,type,attrib
+ def label #element
+ @tag
+ end
+ def type
+ @type
+ end
+ def text
+ @tag_content
+ end
+ def info #element text
+ @tag_content
+ end
+ def attribute
+ @attrib
+ end
+ def element
+ @tag
+ end
+ def attrib
+ @attrib
+ end
+ def el
+ @tag
+ end
+ self
+ end
+ def start_is_match
+ meta=case @p
+ when /^#{Mx[:meta_o]}(title)#{Mx[:meta_c]}\s*(.+?)$/; header($1,@md.title.full,'meta','dc') #dc 1
+ when /^#{Mx[:meta_o]}(creator|author)#{Mx[:meta_c]}\s*(.+?)$/; header('creator',$2,'meta','dc') #dc 2
+ when /^#{Mx[:meta_o]}(subject)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 3
+ when /^#{Mx[:meta_o]}(description)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 4
+ when /^#{Mx[:meta_o]}(publisher)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 5
+ when /^#{Mx[:meta_o]}(contributor)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 6
+ when /^#{Mx[:meta_o]}(date)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 7
+ when /^#{Mx[:meta_o]}(date\.created)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra')
+ when /^#{Mx[:meta_o]}(date\.issued)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra')
+ when /^#{Mx[:meta_o]}(date\.available)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra')
+ when /^#{Mx[:meta_o]}(date\.valid)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra')
+ when /^#{Mx[:meta_o]}(date\.modified)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra')
+ when /^#{Mx[:meta_o]}(type)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 8
+ when /^#{Mx[:meta_o]}(format)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 9
+ when /^#{Mx[:meta_o]}(identifier)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 10
+ when /^#{Mx[:meta_o]}(source)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 11
+ when /^#{Mx[:meta_o]}(language)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 12
+ when /^#{Mx[:meta_o]}(relation)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 13
+ when /^#{Mx[:meta_o]}(coverage)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 14
+ when /^#{Mx[:meta_o]}(rights)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 15
+ when /^#{Mx[:meta_o]}(keywords)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra')
+ when /^#{Mx[:meta_o]}(copyright)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra')
+ when /^#{Mx[:meta_o]}(translator|translated_by)#{Mx[:meta_c]}\s*(.+?)$/; header('translator',$2)
+ when /^#{Mx[:meta_o]}(illustrator|illustrated_by)#{Mx[:meta_c]}\s*(.+?)$/; header('illustrator',$2)
+ when /^#{Mx[:meta_o]}(prepared_by)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra')
+ when /^#{Mx[:meta_o]}(digitized_by)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra')
+ when /^#{Mx[:meta_o]}(comments?)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra')
+ when /^#{Mx[:meta_o]}(abstract)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra')
+ when /^#{Mx[:meta_o]}(tags?)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra')
+ when /^#{Mx[:meta_o]}(catalogue)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra')
+ when /^#{Mx[:meta_o]}(class(?:ify)?_loc)#{Mx[:meta_c]}\s*(.+?)$/; header('classify_loc',$2,'meta','extra')
+ when /^#{Mx[:meta_o]}(class(?:ify)?_dewey)#{Mx[:meta_c]}\s*(.+?)$/; header('classify_dewey',$2,'meta','extra')
+ when /^#{Mx[:meta_o]}(class(?:ify)?_pg)#{Mx[:meta_c]}\s*(.+?)$/; header('classify_pg',$2,'meta','extra')
+ when /^#{Mx[:meta_o]}(class(?:ify)?_isbn)#{Mx[:meta_c]}\s*(.+?)$/; header('classify_isbn',$2,'meta','extra')
+ when /^#{Mx[:meta_o]}(toc|structure)#{Mx[:meta_c]}\s*(.+?)$/; header('structure',$2,'process','instruct')
+ when /^#{Mx[:meta_o]}(level|page|markup)#{Mx[:meta_c]}\s*(.+?)$/; header('markup',$2,'process','instruct')
+ when /^#{Mx[:meta_o]}(bold)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct')
+ when /^#{Mx[:meta_o]}(italics|itali[sz]e)#{Mx[:meta_c]}\s*(.+?)$/; header('italicize',$2,'process','instruct')
+ when /^#{Mx[:meta_o]}(vocabulary|wordlist)#{Mx[:meta_c]}\s*(.+?)$/; header('vocabulary',$2,'process','instruct')
+ when /^#{Mx[:meta_o]}(css|stylesheet)#{Mx[:meta_c]}\s*(.+?)$/; header('css',$2,'process','instruct')
+ when /^#{Mx[:meta_o]}(links)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct')
+ when /^#{Mx[:meta_o]}(prefix)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct') #add a & b
+ when /^#{Mx[:meta_o]}(suffix)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct')
+ when /^#{Mx[:meta_o]}(information)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct')
+ when /^#{Mx[:meta_o]}(contact)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct')
+ when /^#{Mx[:meta_o]}(rcs|cvs)#{Mx[:meta_c]}\s*(.+?)$/; header('version',$2,'process','instruct')
+ else nil
+ end
+ end
+ def dublin
+ out=if @p =~/^#{Mx[:meta_o]}\S+?#{Mx[:meta_c]}/
+ start_is_match
+ else nil
+ end
+ end
+ def meta
+ out=if @p =~/^#{Mx[:meta_o]}\S+?#{Mx[:meta_c]}/
+ start_is_match
+ else nil
+ end
+ end
+ end
+ class ParagraphNumber
+ def initialize(paranum)
+ @paranum=/(\d+)/m.match(paranum)[1]
+ end
+ def display
+ @paranum.gsub(/(\d+)/,'#\1')
+ end
+ end
+ class PotNumber
+ @@n=0
+ def initialize
+ @@n +=2
+ end
+ def num
+ @@n
+ end
+ def reset
+ @@n=0
+ end
+ end
+end
+__END__
diff --git a/lib/sisu/v2/i18n.rb b/lib/sisu/v4/prog_text_translation.rb
index c43daabe..03ae97b1 100644
--- a/lib/sisu/v2/i18n.rb
+++ b/lib/sisu/v4/prog_text_translation.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -56,92 +55,8 @@
** Description: internationalisation
=end
-module SiSU_i18n
- class Language
- def initialize(md)
- @md=md
- end
- def tex_name(char)
- @lang=if char
- case char
- when 'sq'; 'albanian'
- when 'am'; 'amharic'
- #when 'ar'; 'arabic' # see polyglossia
- when 'hy'; 'armenian'
- #when ''; 'asturian' # polyglossia
- #when ''; 'bahasai' # polyglossia
- #when ''; 'bahasam' # polyglossia
- when 'eu'; 'basque'
- when 'bn'; 'bengali'
- when 'pt_BR'; 'brazilian'
- when 'br'; 'breton'
- when 'bg'; 'bulgarian'
- when 'ca'; 'catalan' # see polyglossia
- #when ''; 'coptic' # polyglossia
- when 'hr'; 'croatian'
- when 'cs'; 'czech'
- when 'da'; 'danish'
- #when ''; 'divehi' # polyglossia
- when 'nl'; 'dutch' # see polyglossia
- when 'en'; 'english' # see polyglossia
- when 'eo'; 'esperanto' # see polyglossia
- when 'et'; 'estonian'
- when 'gl'; 'galician'
- when 'de'; 'german'
- when 'el'; 'greek' #gl ?
- when 'he'; 'hebrew'
- when 'hi'; 'hindi'
- when 'is'; 'icelandic'
- when 'ia'; 'interlingua'
- when 'ga'; 'irish'
- when 'it'; 'italian'
- #when ''; 'farsi' # polyglossia
- when 'fi'; 'finnish'
- when 'fr'; 'french'
- when 'lo'; 'lao'
- when 'la'; 'latin'
- when 'lv'; 'latvian'
- when 'lt'; 'lithuanian'
- #when ''; 'lsorbian' # polyglossia
- #when ''; 'magyar' # polyglossia
- when 'ml'; 'malayalam'
- when 'mr'; 'marathi'
- #when 'hu'; 'magyar'
- when 'no'; 'norske'
- when 'nn'; 'nynorsk'
- when 'oc'; 'occitan'
- when 'pl'; 'polish'
- when 'pt'; 'portuges'
- when 'ro'; 'romanian'
- when 'ru'; 'russian'
- when 'se'; 'samin' #(check sami?)
- when 'sa'; 'sanskrit'
- when 'sr'; 'serbian'
- #when ''; 'scottish' # polyglossia (gd (Gaelic (Scots)))
- when 'sk'; 'slovak'
- when 'sl'; 'slovenian'
- when 'es'; 'spanish'
- when 'sv'; 'swedish'
- when 'ta'; 'tamil'
- when 'te'; 'telugu'
- when 'th'; 'thai'
- when 'tr'; 'turkish'
- when 'tk'; 'turkmen'
- when 'uk'; 'ukrainian'
- when 'ur'; 'urdu'
- #when ''; 'usorbian' # polyglossia
- when 'vi'; 'vietnamese'
- when 'cy'; 'welsh'
- when 'us'; 'USenglish' # depreciated, see iso-639-2
- else 'english'
- end
- else 'english'
- end
- end
- end
-end
module SiSU_Translate
- require "#{SiSU_lib}/sysenv" # sysenv.rb
+ require_relative 'sysenv' # sysenv.rb
include SiSU_Env; include SiSU_Param
class Source
def initialize(md,doc_lang,trans_str='')
@@ -153,7 +68,8 @@ module SiSU_Translate
when /German/i; German.new(md,doc_lang,trans_str)
when /Italian/i; Italian.new(md,doc_lang,trans_str)
when /Spanish/i; Spanish.new(md,doc_lang,trans_str)
- when /Brazilian(?: Portuguese)?/i; Portuguese.new(md,doc_lang,trans_str) # tag depreciated, see iso 639-2
+ when /Portuguese Brazil|Brazilian(?: Portuguese)?/i;
+ Portuguese.new(md,doc_lang,trans_str) # tag depreciated, see iso 639-2
when /Portuguese/i; Portuguese.new(md,doc_lang,trans_str)
when /Swedish/i; Swedish.new(md,doc_lang,trans_str)
when /Danish/i; Danish.new(md,doc_lang,trans_str)
@@ -177,13 +93,9 @@ module SiSU_Translate
else English.new(md,doc_lang,trans_str)
end
end
-
def filename
@lang_class.filename
end
- def description
- @lang_class.description
- end
def metadata
@lang_class.metadata
end
@@ -229,6 +141,9 @@ module SiSU_Translate
def digitized_by
@lang_class.digitized_by
end
+ def contents
+ @lang_class.contents
+ end
def subject
@lang_class.subject
end
@@ -244,9 +159,6 @@ module SiSU_Translate
def rights
@lang_class.rights
end
- def digitized_by
- @lang_class.digitized_by
- end
def date
@lang_class.date
end
@@ -369,7 +281,8 @@ module SiSU_Translate
when /German/i; 'Deutsch'
when /Italian/i; 'Italiano'
when /Spanish/i; 'español'
- when /Brazilian(?: Portuguese)?/i; 'Brazilian Português' # tag depreciated, see iso 639-2
+ when /Portuguese Brazil|Brazilian(?: Portuguese)?/i;
+ 'Brazilian Português' # tag depreciated, see iso 639-2
when /Portuguese/i; 'Português'
when /Swedish/i; 'svenska'
when /Danish/i; 'dansk'
@@ -405,9 +318,6 @@ module SiSU_Translate
def filename
'filename'
end
- def description
- 'description'
- end
def filetype_description
'filetype description'
end
@@ -450,6 +360,9 @@ module SiSU_Translate
def digitized_by
'Digitized by'
end
+ def contents
+ 'Contents'
+ end
def subject #dc
'Subject'
end
@@ -587,7 +500,8 @@ module SiSU_Translate
when /German/i; 'German'
when /Italian/i; 'Italian'
when /Spanish/i; 'Spanish'
- when /Brazilian(?: Portuguese)?/i; 'Brazilian Portuguese' # tag depreciated, see iso 639-2
+ when /Portuguese Brazil|Brazilian(?: Portuguese)?/i;
+ 'Brazilian Portuguese' # tag depreciated, see iso 639-2
when /Portuguese/i; 'Portuguese'
when /Swedish/i; 'Swedish'
when /Danish/i; 'Danish'
@@ -619,9 +533,6 @@ module SiSU_Translate
def filename
'nom de fichier'
end
- def description
- 'description'
- end
def filetype_description
description
end
@@ -664,6 +575,9 @@ module SiSU_Translate
def digitized_by
'Numérisé par'
end
+ def contents
+ 'Contents' #translate
+ end
def subject #dc
'Sujet'
end
@@ -801,7 +715,8 @@ module SiSU_Translate
when /German/i; 'Allemand'
when /Italian/i; 'Italien'
when /Spanish/i; 'Espagnol'
- when /Brazilian(?: Portuguese)?/i; 'Portugais brésilien' # tag depreciated, see iso 639-2
+ when /Portuguese Brazil|Brazilian(?: Portuguese)?/i;
+ 'Portugais brésilien' # tag depreciated, see iso 639-2
when /Portuguese/i; 'Portugais'
when /Swedish/i; 'Suédois'
when /Danish/i; 'Danois'
@@ -833,9 +748,6 @@ module SiSU_Translate
def filename
'Dateiname'
end
- def description
- 'Beschreibung'
- end
def filetype_description
description
end
@@ -875,6 +787,9 @@ module SiSU_Translate
def digitized_by
'digitalisiert von'
end
+ def contents
+ 'Contents' #translate
+ end
def subject
'Titel'
end
@@ -1012,7 +927,8 @@ module SiSU_Translate
when /German/i; 'Deutsch'
when /Italian/i; 'Italienisch'
when /Spanish/i; 'Spanisch'
- when /Brazilian(?: Portuguese)?/i; 'Brasilianisch-Portugiesisch' # tag depreciated, see iso 639-2
+ when /Portuguese Brazil|Brazilian(?: Portuguese)?/i;
+ 'Brasilianisch-Portugiesisch' # tag depreciated, see iso 639-2
when /Portuguese/i; 'Portugiesisch'
when /Swedish/i; 'Schwedisch'
when /Danish/i; 'Dänisch'
@@ -1044,209 +960,210 @@ module SiSU_Translate
def filename
'nombre del fichero'
end
- def description
- 'descripción'
- end
def filetype_description
description
end
- def metadata
- 'metadatos'
- end
- def file_size
- 'tamaño del fichero'
- end
- def full_title #dc
- 'Título'
- end
- def title
- 'Título'
- end
- def subtitle
- 'Subtítulo'
- end
- def author #dc
- 'Creador'
- end
- def contributor #dc
- 'Contribuidor'
- end
- def translator
- 'Traductor'
- end
- def illustrator
- 'Ilustrador'
- end
- def publisher #dc
- 'Editor'
- end
- def prepared_by
- 'Preparado por'
- end
- def digitized_by
- 'Digitalizado por'
- end
- def subject #dc
- 'Asunto'
- end
- def description #dc (watch)
- 'Descripción'
- end
- def abstract #dc
- 'Resumen'
- end
- def type #dc
- 'Tipo'
- end
- def rights #dc
- 'Derechos'
- end
- def date #dc
- 'Fecha'
- end
- def date_created #dc
- 'Fecha de creación'
- end
- def date_issued #dc
- 'Fecha de publicación'
- end
- def date_available #dc
- 'Fecha de disponibilidad'
- end
- def date_modified #dc
- 'Fecha de modificación'
- end
- def date_valid #dc
- 'Fecha de valided'
- end
- def language #dc
- 'Idioma'
- end
- def language_original
- 'Lenguaje original'
- end
- def format #dc
- 'Formato'
- end
- def identifier #dc
- 'Identificador'
- end
- def source #dc
- 'Fuente'
- end
- def relation #dc
- 'Relación'
- end
- def coverage #dc
- 'Cobertura'
- end
- def keywords
- 'Palabras claves'
- end
- def comments
- 'Comentarios'
- end
- def cls_loc
- 'Clasificación Biblioteca del Congreso'
- end
- def cls_dewey
- 'Clasificación Dewey'
- end
- def cls_oclc # fix
- 'Classify OCLC number'
+ def metadata
+ 'metadatos'
end
- def cls_gutenberg
- 'Clasificación Proyecto Gutenberg'
- end
- def cls_isbn
- 'Clasificación ISBN'
- end
- def prefix_a
- 'Prefijo (a)'
- end
- def prefix_b
- 'Prefijo (b)'
- end
- def topic_register
- 'Topics Registered'
+ def file_size
+ 'tamaño del fichero'
end
- def sourcefile
- 'Fichero fuente'
- end
- def word_count
- 'Número de palabras apróximado'
- end
- def sourcefile_digest
- 'Resumen del fichero fuente'
- end
- def digest_md5
- 'Resumen del fichero fuente (md5)'
- end
- def digest_sha256
- 'Resumen del fichero fuente (sha256)'
- end
- def sc_number
- 'Versión (RCS/CVS) del documento'
- end
- def sc_date
- 'Versión (RCS/CVS) del documento'
- end
- def last_generated
- 'Última generación (metaverse) del documento'
- end
- def sisu_version
- 'Generado por'
- end
- def ruby_version
- 'Versión de Ruby'
- end
- def suggested_links
- 'enlaces sugeridos de metadatos'
- end
- def language_version_list
- 'Document Language Versions, manifests'
- end
- def manifest_description
- 'SiSU manifest of document filetypes and metadata'
+ def full_title #dc
+ 'Título'
end
- def manifest_description_output
- 'Manifiesto SiSU de salida generada'
- end
- def manifest_description_metadata
- 'Manifiesto SiSU de metadatos de documento'
- end
- def language_list_translated
- lang=case @trans_str
- when /American/i; 'Inglés Americano' # tag depreciated, see iso 639-2
- when /English/i; 'Inglés'
- when /French/i; 'Francés'
- when /German/i; 'Alemán'
- when /Italian/i; 'Italiano'
- when /Spanish/i; 'Español'
- when /Brazilian(?: Portuguese)?/i; 'Portugués de Brasil' # tag depreciated, see iso 639-2
- when /Portuguese/i; 'Portugués'
- when /Swedish/i; 'Sueco'
- when /Danish/i; 'Danés'
- when /Finnish/i; 'Finés'
- when /Norwegian/i; 'Noruego'
- when /Icelandic/i; 'Islandés'
- when /Dutch/i; 'Holandés'
- when /Estonian/i; 'Estonio'
- when /Hungarian/i; 'Húngaro'
- when /Polish/i; 'Polaco'
- when /Romanian/i; 'Rumano'
- when /Russian/i; 'Ruso'
- when /Greek/i; 'Griego'
- when /Ukranian/i; 'Ucraniano'
- when /Turkish/i; 'Turco'
- when /Slovenian/i; 'Eslovaco'
- when /Croatian/i; 'Croata'
- when /Slovak(?:ian)?/i; 'Eslovaco'
- when /Czech/i; 'Checo'
- when /Bulgarian/i; 'Búlgaro'
- else @trans_str
+ def title
+ 'Título'
+ end
+ def subtitle
+ 'Subtítulo'
+ end
+ def author #dc
+ 'Creador'
+ end
+ def contributor #dc
+ 'Contribuidor'
+ end
+ def translator
+ 'Traductor'
+ end
+ def illustrator
+ 'Ilustrador'
+ end
+ def publisher #dc
+ 'Editor'
+ end
+ def prepared_by
+ 'Preparado por'
+ end
+ def digitized_by
+ 'Digitalizado por'
+ end
+ def contents
+ 'Contents' #translate
+ end
+ def subject #dc
+ 'Asunto'
+ end
+ def description #dc (watch)
+ 'Descripción'
+ end
+ def abstract #dc
+ 'Resumen'
+ end
+ def type #dc
+ 'Tipo'
+ end
+ def rights #dc
+ 'Derechos'
+ end
+ def date #dc
+ 'Fecha'
+ end
+ def date_created #dc
+ 'Fecha de creación'
+ end
+ def date_issued #dc
+ 'Fecha de publicación'
+ end
+ def date_available #dc
+ 'Fecha de disponibilidad'
+ end
+ def date_modified #dc
+ 'Fecha de modificación'
+ end
+ def date_valid #dc
+ 'Fecha de valided'
+ end
+ def language #dc
+ 'Idioma'
+ end
+ def language_original
+ 'Lenguaje original'
+ end
+ def format #dc
+ 'Formato'
+ end
+ def identifier #dc
+ 'Identificador'
+ end
+ def source #dc
+ 'Fuente'
+ end
+ def relation #dc
+ 'Relación'
+ end
+ def coverage #dc
+ 'Cobertura'
+ end
+ def keywords
+ 'Palabras claves'
+ end
+ def comments
+ 'Comentarios'
+ end
+ def cls_loc
+ 'Clasificación Biblioteca del Congreso'
+ end
+ def cls_dewey
+ 'Clasificación Dewey'
+ end
+ def cls_oclc # fix
+ 'Classify OCLC number'
+ end
+ def cls_gutenberg
+ 'Clasificación Proyecto Gutenberg'
+ end
+ def cls_isbn
+ 'Clasificación ISBN'
+ end
+ def prefix_a
+ 'Prefijo (a)'
+ end
+ def prefix_b
+ 'Prefijo (b)'
+ end
+ def topic_register
+ 'Topics Registered'
+ end
+ def sourcefile
+ 'Fichero fuente'
+ end
+ def word_count
+ 'Número de palabras apróximado'
+ end
+ def sourcefile_digest
+ 'Resumen del fichero fuente'
+ end
+ def digest_md5
+ 'Resumen del fichero fuente (md5)'
+ end
+ def digest_sha256
+ 'Resumen del fichero fuente (sha256)'
+ end
+ def sc_number
+ 'Versión (RCS/CVS) del documento'
+ end
+ def sc_date
+ 'Versión (RCS/CVS) del documento'
+ end
+ def last_generated
+ 'Última generación (metaverse) del documento'
+ end
+ def sisu_version
+ 'Generado por'
+ end
+ def ruby_version
+ 'Versión de Ruby'
+ end
+ def suggested_links
+ 'enlaces sugeridos de metadatos'
+ end
+ def language_version_list
+ 'Document Language Versions, manifests'
+ end
+ def manifest_description
+ 'SiSU manifest of document filetypes and metadata'
end
- end
+ def manifest_description_output
+ 'Manifiesto SiSU de salida generada'
+ end
+ def manifest_description_metadata
+ 'Manifiesto SiSU de metadatos de documento'
+ end
+ def language_list_translated
+ lang=case @trans_str
+ when /American/i; 'Inglés Americano' # tag depreciated, see iso 639-2
+ when /English/i; 'Inglés'
+ when /French/i; 'Francés'
+ when /German/i; 'Alemán'
+ when /Italian/i; 'Italiano'
+ when /Spanish/i; 'Español'
+ when /Portuguese Brazil|Brazilian(?: Portuguese)?/i;
+ 'Portugués de Brasil' # tag depreciated, see iso 639-2
+ when /Portuguese/i; 'Portugués'
+ when /Swedish/i; 'Sueco'
+ when /Danish/i; 'Danés'
+ when /Finnish/i; 'Finés'
+ when /Norwegian/i; 'Noruego'
+ when /Icelandic/i; 'Islandés'
+ when /Dutch/i; 'Holandés'
+ when /Estonian/i; 'Estonio'
+ when /Hungarian/i; 'Húngaro'
+ when /Polish/i; 'Polaco'
+ when /Romanian/i; 'Rumano'
+ when /Russian/i; 'Ruso'
+ when /Greek/i; 'Griego'
+ when /Ukranian/i; 'Ucraniano'
+ when /Turkish/i; 'Turco'
+ when /Slovenian/i; 'Eslovaco'
+ when /Croatian/i; 'Croata'
+ when /Slovak(?:ian)?/i; 'Eslovaco'
+ when /Czech/i; 'Checo'
+ when /Bulgarian/i; 'Búlgaro'
+ else @trans_str
+ end
+ end
end
class Italian
def initialize(md,doc_lang,trans_str)
@@ -1255,9 +1172,6 @@ module SiSU_Translate
def filename
'nome del file'
end
- def description
- 'descrizione'
- end
def filetype_description
description
end
@@ -1297,6 +1211,9 @@ module SiSU_Translate
def digitized_by
'Convertito in digitale da'
end
+ def contents
+ 'Contents' #translate
+ end
def subject #dc
'Oggetto'
end
@@ -1434,7 +1351,8 @@ module SiSU_Translate
when /German/i; 'Tedesco'
when /Italian/i; 'Italiano'
when /Spanish/i; 'Spagnolo'
- when /Brazilian(?: Portuguese)?/i; 'Portoguese (Brasile)' # tag depreciated, see iso 639-2
+ when /Portuguese Brazil|Brazilian(?: Portuguese)?/i;
+ 'Portoguese (Brasile)' # tag depreciated, see iso 639-2
when /Portuguese/i; 'Portoguese'
when /Swedish/i; 'Svedese'
when /Danish/i; 'Danese'
@@ -1466,9 +1384,6 @@ module SiSU_Translate
def filename
'tiedostonimi'
end
- def description
- 'kuvaus'
- end
def filetype_description
description
end
@@ -1508,6 +1423,9 @@ module SiSU_Translate
def digitized_by
'Digitalisoinut'
end
+ def contents
+ 'Contents' #translate
+ end
def subject #dc
'aihe'
end
@@ -1645,7 +1563,8 @@ module SiSU_Translate
when /German/i; 'Saksa'
when /Italian/i; 'Italia'
when /Spanish/i; 'Espanja'
- when /Brazilian(?: Portuguese)?/i; 'Brasilian portugali' # tag depreciated, see iso 639-2
+ when /Portuguese Brazil|Brazilian(?: Portuguese)?/i;
+ 'Brasilian portugali' # tag depreciated, see iso 639-2
when /Portuguese/i; 'Portugali'
when /Swedish/i; 'Ruotsi'
when /Danish/i; 'Tanska'
@@ -1670,9 +1589,12 @@ module SiSU_Translate
end
end
end
- class Porguguese < English
+ class Portuguese < English
end
class Swedish < English
+ def contents
+ 'Innehåll'
+ end
end
class Danish < English
end
diff --git a/lib/sisu/v4/qrcode.rb b/lib/sisu/v4/qrcode.rb
new file mode 100644
index 00000000..13a69ec6
--- /dev/null
+++ b/lib/sisu/v4/qrcode.rb
@@ -0,0 +1,744 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: summary of generated outputs and metadata
+
+=end
+module SiSU_QRcode
+ require_relative 'sysenv' # sysenv.rb
+ include SiSU_Env
+ require_relative 'prog_text_translation' # prog_text_translation.rb
+ require_relative 'particulars' # particulars.rb
+ include SiSU_Particulars
+ require_relative 'html' # html.rb
+ require_relative 'param' # param.rb
+ include SiSU_Param
+ require_relative 'i18n' # i18n.rb
+ include SiSU_Viz
+ 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
+ unless @opt.cmd =~/q/
+ url_html="file://#{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}"
+ @opt.cmd=~/[MVvz]/ \
+ ? SiSU_Screen::Ansi.new(@opt.cmd,'QR code',"#{xbrowser} #{url_html}").green_hi_blue
+ : SiSU_Screen::Ansi.new(@opt.cmd,'QR code',"[#{@opt.f_pth[:lng_is]}] #{@opt.fns}").green_title_hi
+ SiSU_Screen::Ansi.new(@opt.cmd,"#{browser} #{url_html}").grey_tab if @opt.cmd =~/v/i
+ end
+ data=SiSU_HTML::Source::HTML_Environment.new(@particulars).tuned_file_instructions
+ OutputInfo.new(@md).check_output(data)
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ end
+ end
+ private
+ class OutputInfo <Source
+ def initialize(md)
+ @manifest={ txt: [], txt_title: [] }
+ @md,@fns=md,md.fns
+ @env=SiSU_Env::InfoEnv.new(@md.fns)
+ @fnb=@md.fnb
+ @base_url="#{@env.url.root}/#{@fnb}"
+ @f=SiSU_Env::FileOp.new(@md)
+ @base_path=@f.output_path.manifest.dir
+ @@dg ||=SiSU_Env::InfoEnv.new.digest.type
+ @dg=@@dg
+ l=SiSU_Env::StandardiseLanguage.new(@md.opt.lng).language
+ @language=l[:n]
+ @translate=SiSU_Translate::Source.new(@md,@language)
+ @brace_url=SiSU_Viz::Defaults.new.url_decoration
+ @f.make_path(@f.output_path.qrcode.dir)
+ end
+ def output_metadata
+ fn=@f.base_filename.manifest_txt
+ mn=''
+ if @md.opt.cmd =~/M/
+ pt=@f.output_path.manifest.dir
+ fn=@f.base_filename.manifest_txt
+ manifest=@f.write_file.manifest_txt
+ end
+ @manifest[:txt].each do |x|
+ x=x.gsub(/\\\\/m,"\n")
+ puts x if @md.opt.cmd =~/V/
+ manifest << x if @md.opt.cmd =~/M/
+ mn += x
+ end
+ manifest.close if @md.opt.cmd =~/M/
+ #system(%{
+ # cat #{pt}/#{fn} | qrencode -s 3 -o qrcm.autonomy_markup0.png
+ #})
+ cmd=SiSU_Env::SystemCall.new(mn,@f.place_file.qrcode_md.dir,@md.opt.cmd)
+ cmd.qrencode
+ #system(%{
+ # echo "#{mn}" | qrencode -s 3 -o #{@dest}/qrc_md.#{fn}.png
+ #})
+ end
+ def output_metadata_short
+ fn=@f.base_filename.manifest_txt
+ mn=''
+ @manifest[:txt_title].each do |x|
+ mn += x
+ end
+ cmd=SiSU_Env::SystemCall.new(mn,@f.place_file.qrcode_title.dir,@md.opt.cmd)
+ cmd.qrencode
+ #system(%{
+ # echo "#{mn}" | qrencode -s 3 -o #{@dest}/qrc_title.#{fn}.png
+ #})
+ end
+ def summarize(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] <<<<WOK
+#{id} #{kb}
+ #{@brace_url.txt_open}#{url}/#{file}#{@brace_url.txt_close}
+WOK
+ end
+ def summarize_html_seg(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] <<<<WOK
+#{id} #{kb}
+ #{@brace_url.txt_open}#{url}/#{file}#{@brace_url.txt_close}
+WOK
+ end
+ def summarize_sources(id,file,pth,rel,url)
+ sys=SiSU_Env::SystemCall.new
+ dgst=(@dg =~/^sha(?:2|256)$/) \
+ ? (sys.sha256("#{pth}/#{file}"))
+ : (sys.md5("#{pth}/#{file}"))
+ SiSU_Screen::Ansi.new(@md.opt.cmd,"#{dgst[1]} #{file}").warn if @md.opt.cmd =~/[vVM]/
+ size=(File.size("#{pth}/#{file}")/1024.00).to_s
+ kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1]
+ @manifest[:txt] <<<<WOK
+#{id} #{dgst[1]} #{kb}
+ #{@brace_url.txt_open}#{url}/#{file}#{@brace_url.txt_close}
+WOK
+ end
+ def published_manifests?
+ @f=SiSU_Env::FileOp.new(@md) #.base_filename
+ @m=[]
+ url=@f.output_path.base.url
+ manifests={}
+ mp,mn,mt=nil,nil,nil
+ ln=SiSU_i18n::Languages.new.language.list
+ Px[:lng_lst].each do |lc|
+ if @env.output_dir_structure.by_language_code?
+ mp="#{@f.output_path.base.dir}/#{lc}/manifest"
+ mn="#{@md.fnb}.html"
+ mt="#{mp}/#{mn}"
+ mu="#{url}/#{lc}/manifest/#{mn}"
+ elsif @env.output_dir_structure.by_filetype?
+ mp="#{@f.output_path.base.dir}/manifest"
+ mn="#{@md.fnb}.#{lc}.html"
+ mt="#{mp}/#{mn}"
+ mu="#{url}/manifest/#{mn}"
+ else
+ mp="#{@f.output_path.base.dir}/#{@md.fnb}"
+ mn="sisu_manifest.#{lc}.html"
+ mt="#{mp}/#{mn}"
+ mu="#{url}/#{mn}"
+ end
+ if FileTest.directory?(mp) \
+ && FileTest.file?(mt)
+ lng=ln[lc][:t]
+ manifests[lc]={ ln: lng, fn: mn }
+ @m << { mu: mu, l: lng }
+ end
+ end
+ #url=@f.output_path.base.url
+ #@en_manifest=if @env.output_dir_structure.by_language_code?
+ # "#{url}/en/manifest/#{@md.fnb}.html"
+ #elsif @env.output_dir_structure.by_filetype?
+ # "#{url}/manifest/#{@md.fnb}.#{lc}.html"
+ #else
+ # "#{url}/sisu_manifest.#{lc}.html"
+ #end
+ manifests
+ @m=@m.uniq
+ @m
+ end
+ def languages(id,file)
+ flv=published_manifests?
+ flv.each do |l|
+ lang=SiSU_Translate::Source.new(@md,@language,l[:n]).language_list
+ @manifest[:txt] << "#{l[:mu]} #{l[:l]}\n"
+ end
+ end
+ def published_languages(id,file)
+ flv=published_manifests?
+ flv.each do |l|
+ @manifest[:txt] << "#{l[:l]} #{@brace_url.txt_open}#{l[:mu]}#{@brace_url.txt_close}\n"
+ end
+ end
+ def metadata(id,info)
+ info=info.to_s.gsub(/#{Mx[:br_line]}/,"\n")
+ @manifest[:txt] << %{#{id}: #{info}\n}
+ end
+ def md_title_info(id,info)
+ info=info.to_s.gsub(/#{Mx[:br_line]}/,"\n")
+ @manifest[:txt_title] << %{#{info}\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[:txt] << %{#{url} #{lnk} #{@brace_url.txt_open}#{static}#{@brace_url.txt_close}\n}
+ end
+ def output_tests
+ if FileTest.file?(@f.place_file.html_segtoc.dir)==true
+ pth=@f.output_path.html_seg.dir
+ rel=@f.output_path.html_seg.rel_sm
+ url=@f.output_path.html_seg.url
+ id,file='HTML, table of contents (for segmented text)',@f.base_filename.html_segtoc
+ summarize_html_seg(id,file,pth,rel,url)
+ end
+ if FileTest.file?(@f.place_file.html_scroll.dir)==true
+ pth=@f.output_path.html_scroll.dir
+ rel=@f.output_path.html_scroll.rel_sm
+ url=@f.output_path.html_scroll.url
+ id,file='HTML, full length document',@f.base_filename.html_scroll
+ summarize(id,file,pth,rel,url)
+ 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
+ id,file='HTML, (book type) index',@f.base_filename.html_book_index
+ summarize(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
+ id,file='HTML, concordance file',@f.base_filename.html_concordance
+ summarize(id,file,pth,rel,url)
+ end
+ if FileTest.file?(@f.place_file.epub.dir)==true
+ id,file='EPUB (Electronic Publication, e-book standard)',@f.base_filename.epub
+ pth=@f.output_path.epub.dir
+ rel=@f.output_path.epub.rel_sm
+ url=@f.output_path.epub.url
+ summarize(id,file,pth,rel,url)
+ end
+ if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_letter}")==true
+ pth=@f.output_path.pdf.dir
+ rel=@f.output_path.pdf.rel_sm
+ url=@f.output_path.pdf.url
+ id,file="PDF, U.S. letter size, portrait/vertical","#{@f.base_filename.pdf_p_letter}"
+ summarize(id,file,pth,rel,url)
+ end
+ if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_letter}")==true
+ pth=@f.output_path.pdf.dir
+ rel=@f.output_path.pdf.rel_sm
+ url=@f.output_path.pdf.url
+ id,file="PDF, U.S. letter size, landscape/horizontal","#{@f.base_filename.pdf_l_letter}"
+ summarize(id,file,pth,rel,url)
+ end
+ if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_a4}")==true
+ pth=@f.output_path.pdf.dir
+ rel=@f.output_path.pdf.rel_sm
+ url=@f.output_path.pdf.url
+ id,file="PDF, A4 size, portrait/vertical","#{@f.base_filename.pdf_p_a4}"
+ summarize(id,file,pth,rel,url)
+ end
+ if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_a4}")==true
+ pth=@f.output_path.pdf.dir
+ rel=@f.output_path.pdf.rel_sm
+ url=@f.output_path.pdf.url
+ id,file="PDF, A4 size, landscape/horizontal","#{@f.base_filename.pdf_l_a4}"
+ summarize(id,file,pth,rel,url)
+ end
+ if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_a5}")==true
+ pth=@f.output_path.pdf.dir
+ rel=@f.output_path.pdf.rel_sm
+ url=@f.output_path.pdf.url
+ id,file="PDF, A5 (book) size, portrait/vertical","#{@f.base_filename.pdf_p_a5}"
+ summarize(id,file,pth,rel,url)
+ end
+ if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_a5}")==true
+ pth=@f.output_path.pdf.dir
+ rel=@f.output_path.pdf.rel_sm
+ url=@f.output_path.pdf.url
+ id,file="PDF, A5 (book) size, landscape/horizontal","#{@f.base_filename.pdf_l_a5}"
+ summarize(id,file,pth,rel,url)
+ end
+ if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_b5}")==true
+ pth=@f.output_path.pdf.dir
+ rel=@f.output_path.pdf.rel_sm
+ url=@f.output_path.pdf.url
+ id,file="PDF, B5 (book) size, portrait/vertical","#{@f.base_filename.pdf_p_b5}"
+ summarize(id,file,pth,rel,url)
+ end
+ if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_b5}")==true
+ pth=@f.output_path.pdf.dir
+ rel=@f.output_path.pdf.rel_sm
+ url=@f.output_path.pdf.url
+ id,file="PDF, B5 (book) size, landscape/horizontal","#{@f.base_filename.pdf_l_b5}"
+ summarize(id,file,pth,rel,url)
+ end
+ if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_legal}")==true
+ pth=@f.output_path.pdf.dir
+ rel=@f.output_path.pdf.rel_sm
+ url=@f.output_path.pdf.url
+ id,file="PDF, U.S. legal size, portrait/vertical","#{@f.base_filename.pdf_p_legal}"
+ summarize(id,file,pth,rel,url)
+ end
+ if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_legal}")==true
+ pth=@f.output_path.pdf.dir
+ rel=@f.output_path.pdf.rel_sm
+ url=@f.output_path.pdf.url
+ id,file="PDF, U.S. legal size, landscape/horizontal","#{@f.base_filename.pdf_l_legal}"
+ summarize(id,file,pth,rel,url)
+ end
+ if FileTest.file?(@f.place_file.odt.dir)==true
+ pth=@f.output_path.odt.dir
+ rel=@f.output_path.odt.rel_sm
+ url=@f.output_path.odf.url
+ id,file='ODF:ODT (Open Document Format)',@f.base_filename.odt
+ summarize(id,file,pth,rel,url)
+ 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
+ id,file='ODF:ODT (Open Document Format)',@f.base_filename.odt
+ id,file='XHTML',@f.base_filename.xhtml
+ summarize(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
+ id,file='XML SAX',@f.base_filename.xml_sax
+ summarize(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
+ id,file='XML DOM',@f.base_filename.xml_dom
+ summarize(id,file,pth,rel,url)
+ end
+ if FileTest.file?(@f.place_file.txt.dir)==true
+ id=if @md.opt.cmd =~/a/ then 'Plaintext (Unix (UTF-8) with footnotes)'
+ elsif @md.opt.cmd =~/e/ then 'Plaintext (Unix (UTF-8) with endnotes)'
+ elsif @md.opt.cmd =~/A/ then 'Plaintext (dos (UTF-8) with footnotes)'
+ elsif @md.opt.cmd =~/E/ then 'Plaintext (dos (UTF-8) with endnotes)'
+ else 'Plaintext (UTF-8)'
+ end
+ 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(id,file,pth,rel,url)
+ end
+ if FileTest.file?("#{@base_path}/#{@md.fns}.tex")==true
+ id,file='LaTeX (portrait)',"#{@md.fns}.tex"
+ pth,rel,url='','',''
+ summarize(id,file,pth,rel,url)
+ end
+ if FileTest.file?("#{@base_path}/#{@md.fns}.tex")==true
+ id,file='LaTeX (landscape)',"#{@md.fns}.landscape.tex"
+ pth,rel,url='','',''
+ summarize(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
+ id,file='Manpage',@f.base_filename.manpage
+ summarize(id,file,pth,rel,url)
+ end
+ if FileTest.file?(@f.place_file.texinfo.dir)==true
+ pth=@f.output_path.texinfo.dir
+ rel=@f.output_path.texinfo.rel_sm
+ url=@f.output_path.texinfo.url
+ id,file='Texinfo',@f.base_filename.texinfo
+ summarize(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
+ id,file="Digest/DCC - Document Content Certificate (#{@dg})",@f.base_filename.hash_digest
+ summarize(id,file,pth,rel,url)
+ end
+ end
+ def published_versions
+ id,file='Markup (SiSU source)',@md.fns
+ #languages(id,file)
+ published_languages(id,file)
+ end
+ def language_versions
+ if FileTest.file?(@f.place_file.manifest.dir)==true
+ id,file='Markup (SiSU source)',@md.fns
+ published_languages(id,file)
+ end
+ end
+ def source_tests
+ if @md.fns =~/\.ssm\.sst$/ #% decide whether to extract and include requested/required documents
+ req=@md.fns
+ if FileTest.file?(@f.place_file.src.dir)==true
+ pth=@f.output_path.src.dir
+ rel=@f.output_path.src.rel
+ url=@f.output_path.src.url
+ id,file='Markup Composite File (SiSU source)',@f.base_filename.src
+ summarize_sources(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
+ url=@f.output_path.src.url
+ id,file='Markup (SiSU source)',@f.base_filename.src
+ summarize_sources(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
+ url=@f.output_path.sisupod.url
+ id,file='SiSU doc (zip)',@f.base_filename.sisupod
+ summarize_sources(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
+ id,file='SiSU pot',@f.base_filename.pot
+ summarize_sources(id,file,pth,rel,url)
+ end
+ end
+ def metadata_tests
+ if defined? @md.title.full \
+ and @md.title.full=~/\S+/
+ id,info=@translate.full_title,@md.title.full
+ #id,info=@translate.full_title,%{"#{@md.title.full}"}
+ metadata(id,info)
+ md_title_info(id,info)
+ end
+ if defined? @md.creator.author \
+ and @md.creator.author=~/\S+/
+ id,info=@translate.author,@md.creator.author
+ metadata(id,info)
+ md_title_info(id,info)
+ end
+ if defined? @md.creator.editor \
+ and @md.creator.editor=~/\S+/
+ id,info=@translate.editor,@md.creator.editor
+ metadata(id,info)
+ end
+ if defined? @md.creator.contributor \
+ and @md.creator.contributor=~/\S+/
+ id,info=@translate.contributor,@md.creator.contributor
+ metadata(id,info)
+ end
+ if defined? @md.creator.translator \
+ and @md.creator.translator=~/\S+/
+ id,info=@translate.translator,%{(#{@md.creator.translator})}
+ metadata(id,info)
+ md_title_info(id,info)
+ end
+ if defined? @md.creator.illustrator \
+ and @md.creator.illustrator=~/\S+/
+ id,info=@translate.illustrator,@md.creator.illustrator
+ metadata(id,info)
+ end
+ if defined? @md.publisher \
+ and @md.publisher=~/\S+/ #dc
+ id,info=@translate.publisher,@md.publisher
+ metadata(id,info)
+ end
+ if defined? @md.creator.prepared_by \
+ and @md.creator.prepared_by=~/\S+/
+ id,info=@translate.prepared_by,@md.creator.prepared_by
+ metadata(id,info)
+ end
+ if defined? @md.creator.digitized_by \
+ and @md.creator.digitized_by=~/\S+/
+ id,info=@translate.digitized_by,@md.creator.digitized_by
+ metadata(id,info)
+ end
+ if defined? @md.rights.all \
+ and @md.rights.all=~/\S+/ #dc
+ id,info=@translate.rights,@md.rights.all
+ metadata(id,info)
+ end
+ if defined? @md.date.published
+ if defined? @md.date.published \
+ and @md.date.published=~/\S+/ #dc
+ id,info=@translate.date,@md.date.published
+ metadata(id,info)
+ md_title_info(id,info)
+ end
+ if defined? @md.date.created \
+ and @md.date.created=~/\S+/ #dc
+ id,info=@translate.date_created,@md.date.created
+ metadata(id,info)
+ end
+ if defined? @md.date.issued \
+ and @md.date.issued=~/\S+/ #dc
+ id,info=@translate.date_issued,@md.date.issued
+ metadata(id,info)
+ end
+ if defined? @md.date.available \
+ and @md.date.available=~/\S+/ #dc
+ id,info=@translate.date_available,@md.date.available
+ metadata(id,info)
+ end
+ if defined? @md.date.modified \
+ and @md.date.modified=~/\S+/ #dc
+ id,info=@translate.date_modified,@md.date.modified
+ metadata(id,info)
+ end
+ if defined? @md.date.valid \
+ and @md.date.valid=~/\S+/ #dc
+ id,info=@translate.date_valid,@md.date.valid
+ metadata(id,info)
+ end
+ end
+ if defined? @md.title.language \
+ and @md.title.language=~/\S+/
+ id,info=@translate.language,@md.title.language
+ metadata(id,info)
+ end
+ if defined? @md.original.language \
+ and @md.original.language=~/\S+/
+ id,info=@translate.language_original,@md.original.language
+ metadata(id,info)
+ end
+ if defined? @md.classify.subject \
+ and @md.classify.subject=~/\S+/
+ id,info=@translate.subject,@md.classify.subject
+ metadata(id,info)
+ end
+ if defined? @md.classify.keywords \
+ and @md.classify.keywords=~/\S+/
+ id,info=@translate.keywords,@md.classify.keywords
+ metadata(id,info)
+ end
+ if defined? @md.classify.loc \
+ and @md.classify.loc=~/\S+/
+ id,info=@translate.cls_loc,@md.classify.loc
+ metadata(id,info)
+ end
+ if defined? @md.classify.dewey \
+ and @md.classify.dewey=~/\S+/
+ id,info=@translate.cls_dewey,@md.classify.dewey
+ metadata(id,info)
+ end
+ if defined? @md.notes.description \
+ and @md.notes.description=~/\S+/
+ id,info=@translate.description,@md.notes.description
+ metadata(id,info)
+ end
+ if defined? @md.notes.abstract \
+ and @md.notes.abstract=~/\S+/
+ id,info=@translate.abstract,@md.notes.abstract
+ metadata(id,info)
+ end
+ if defined? @md.notes.comment \
+ and @md.notes.comment=~/\S+/
+ id,info=@translate.comments,@md.notes.comment
+ metadata(id,info)
+ end
+ if defined? @md.notes.coverage \
+ and @md.notes.coverage=~/\S+/
+ id,info=@translate.coverage,@md.notes.coverage
+ metadata(id,info)
+ end
+ if defined? @md.notes.relation \
+ and @md.notes.relation=~/\S+/
+ id,info=@translate.relation,@md.notes.relation
+ metadata(id,info)
+ end
+ #if defined? @md.notes.source \
+ #and @md.notes.source=~/\S+/
+ # id,info=@translate.source,@md.notes.source
+ # metadata(id,info)
+ #end
+ #if defined? @md.notes.history \
+ #and @md.notes.history=~/\S+/
+ # id,info=@translate.history,@md.notes.history
+ # metadata(id,info)
+ #end
+ if defined? @md.notes.type \
+ and @md.notes.type=~/\S+/ #dc
+ id,info=@translate.type,@md.type
+ metadata(id,info)
+ end
+ if defined? @md.notes.format \
+ and @md.notes.format=~/\S+/
+ id,info=@transate.format,@md.notes.format
+ metadata(id,info)
+ end
+ if defined? @md.notes.prefix_a \
+ and @md.notes.prefix_a=~/\S+/
+ id,info=@translate.prefix_a,@md.notes.prefix_a
+ metadata(id,info)
+ end
+ if defined? @md.notes.prefix_b \
+ and @md.notes.prefix_b=~/\S+/
+ id,info=@translate.prefix_b,@md.notes.prefix_b
+ metadata(id,info)
+ end
+ if defined? @md.original.source \
+ and @md.original.source=~/\S+/
+ id,info=@translate.source,@md.original.source
+ metadata(id,info)
+ end
+ if defined? @md.identifier.oclc \
+ and @md.identifier.oclc=~/\S+/
+ id,info=@translate.cls_oclc,@md.identifier.oclc
+ @manifest[:txt] << %{#{id}:\n}
+ @manifest[:txt] << %{#{info}\n}
+ end
+ if defined? @md.identifier.isbn \
+ and @md.identifier.isbn=~/\S+/
+ id,info=@translate.cls_isbn,@md.identifier.isbn
+ metadata(id,info)
+ end
+ if defined? @md.topic_register_array \
+ and @md.topic_register_array.length > 0
+ @manifest[:txt] << %{#{@translate.topic_register}:\n}
+@sp=' '
+ @md.topic_register_array.each do |t|
+ t.each_with_index do |st,i|
+ if st.is_a?(Array)
+ st.each do |v|
+ @manifest[:txt] << %{#{@sp*i}#{v}\n}
+ end
+ else @manifest[:txt] << %{#{@sp*i}#{st}\n}
+ end
+ end
+ end
+ end
+ if @md.fns
+ id,info=@translate.sourcefile,@md.fns
+ metadata(id,info)
+ end
+ if @md.en[:mismatch] > 0
+ id,info='WARNING document error in endnote markup, number mismatch',"endnotes: #{@md.en[:note]} != endnote reference marks: #{@md.en[:mark]} (difference = #{@md.en[:mismatch]})"
+ metadata(id,info)
+ end
+ if @md.wc_words
+ id,info=@translate.word_count,@md.wc_words
+ metadata(id,info)
+ end
+ if @md.dgst
+ id,info="#{@translate.sourcefile_digest} (#{@dg})",@md.dgst[1]
+ metadata(id,info)
+ end
+ if @md.sc_number
+ id,info=@translate.sc_number,@md.sc_number
+ metadata(id,info)
+ end
+ if @md.sc_date
+ id,info=@translate.sc_date,"#{@md.sc_date} at #{@md.sc_time}"
+ metadata(id,info)
+ end
+ end
+ def check_output(data)
+ begin
+ id,file='',''
+ vz=SiSU_Viz::Defaults.new
+ @f=SiSU_Env::FileOp.new(@md) #.base_filename
+ url=@f.output_path.base.url
+ @en_manifest=if @env.output_dir_structure.by_language_code?
+ "#{url}/en/manifest/#{@md.fnb}.html"
+ elsif @env.output_dir_structure.by_filetype?
+ "#{url}/manifest/#{@md.fnb}.#{@md.opt.lng}.html"
+ else
+ "#{url}/sisu_manifest.#{@md.opt.lng}.html"
+ end
+ @manifest[:txt] <<<<WOK
+#{@translate.manifest_description_metadata}
+ #{@brace_url.txt_open}#{@en_manifest}#{@brace_url.txt_close}
+WOK
+ metadata_tests
+ @manifest[:txt_title] <<<<WOK
+ #{@brace_url.txt_open}#{@en_manifest}#{@brace_url.txt_close}
+WOK
+ source_tests
+ @manifest[:txt] <<<<WOK
+#{@translate.language_version_list}
+WOK
+ language_versions
+ output_metadata
+ output_metadata_short
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ end
+ end
+ end
+ end
+end
+__END__
diff --git a/lib/sisu/v2/relaxng.rb b/lib/sisu/v4/relaxng.rb
index 76962460..f2ceec58 100644
--- a/lib/sisu/v2/relaxng.rb
+++ b/lib/sisu/v4/relaxng.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -56,8 +55,8 @@
** Description: relaxng flow/logic
=end
-module SiSU_relaxng
- require "#{SiSU_lib}/sysenv" # sysenv.rb
+module SiSU_Relaxng
+ require_relative 'sysenv' # sysenv.rb
class RelaxNG
def gpl3_or_later
@gpl3_or_later =<<RELAXNG
@@ -70,15 +69,13 @@ module SiSU_relaxng
* Author: Ralph Amissah
- * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008 Ralph Amissah All Rights Reserved.
+ * Copyright: (C) 1997 - 2012 Ralph Amissah All Rights Reserved.
* License: GPL 3 or later:
SiSU, a framework for document structuring, publishing and search
- Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008 Ralph Amissah
+ Copyright: (C) 1997 - 2012 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
@@ -983,7 +980,6 @@ start =
| element links { text }
| element markup { text }
| element rights { text }
- | element skin { xsd:NCName }
| element subject { text }
| element title { text }
| element type { xsd:NCName }
@@ -1034,7 +1030,6 @@ start =
| element links { text }
| element markup { text }
| element rights { text }
- | element skin { xsd:NCName }
| element subject { text }
| element title { text }
| element type { xsd:NCName }
@@ -1107,7 +1102,6 @@ start =
| element links { text }
| element markup { text }
| element rights { text }
- | element skin { xsd:NCName }
| element subject { text }
| element title { text }
| element type { xsd:NCName }
diff --git a/lib/sisu/v2/remote.rb b/lib/sisu/v4/remote.rb
index d737dad6..d593f44b 100644
--- a/lib/sisu/v2/remote.rb
+++ b/lib/sisu/v4/remote.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -57,29 +56,29 @@
=end
module SiSU_Remote
- require "#{SiSU_lib}/sysenv" # sysenv.rb
+ require_relative 'sysenv' # sysenv.rb
include SiSU_Env
pwd=Dir.pwd
class Put
def initialize(opt)
@opt=opt
- @dir=SiSU_Env::Info_env.new(@opt.fns)
- @put=unless @opt.fns =~/\.ssm\.sst$/; @opt.fns
- else @opt.fns.gsub(/(.+)?\.ssm\.sst$/,'\1.ssm')
- end
- @remote=SiSU_Env::Info_remote.new(@opt)
+ @dir=SiSU_Env::InfoEnv.new(@opt.fns)
+ @put=(@opt.fns =~/\.ssm\.sst$/) \
+ ? @opt.fns.gsub(/(.+)?\.ssm\.sst$/,'\1.ssm')
+ : @opt.fns
+ @remote=SiSU_Env::InfoRemote.new(@opt)
end
def rsync
SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement ->',@put).dark_grey_title_hi unless @opt.cmd =~/q/
- @remote.rsync
+ @remote.rsync.document
end
def rsync_base
SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement ->','rsync').dark_grey_title_hi unless @opt.cmd =~/q/
- @remote.rsync_base
+ @remote.rsync.site_base
end
def rsync_base_sync
SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement ->','rsync and sync').dark_grey_title_hi unless @opt.cmd =~/q/
- @remote.rsync_base_sync
+ @remote.rsync.site_base_sync
end
def rsync_sitemaps
SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement sitemaps ->','rsync').dark_grey_title_hi unless @opt.cmd =~/q/
@@ -91,15 +90,15 @@ module SiSU_Remote
end
def scp
SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement ->',@put).dark_grey_title_hi unless @opt.cmd =~/q/
- @remote.scp
+ @remote.scp.document
end
def scp_base
SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement of base site ->','excluding images').dark_grey_title_hi unless @opt.cmd =~/q/
- @remote.scp_base
+ @remote.scp.site_base
end
def scp_base_all
SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement ->','complete').dark_grey_title_hi unless @opt.cmd =~/q/
- @remote.scp_base_all
+ @remote.scp.site_base_all
end
end
class Get
@@ -111,9 +110,8 @@ module SiSU_Remote
def fns
require 'open-uri'
require 'pp'
- require "#{SiSU_lib}/composite" # composite.rb
+ require_relative 'composite' # composite.rb
@rgx_image=/(?:^|[^_\\])\{\s*(\S+?\.(?:png|jpg|gif))/
- @rgx_skin=/@skin:\s+(\S+)/
threads=[]
for requested_page in @get_s
re_fnb=/((?:https?|file):\/\/[^\/ ]+?\/[^\/ ]+?)\/\S+?\/([^\/]+?)\.ss(t)/ #revisit and remove DO
@@ -122,14 +120,11 @@ module SiSU_Remote
raise "#{url} not found" unless f
base_uri,fnb,instr=re_fnb.match(url)[1..3] if re_fnb
imagedir=base_uri + '/_sisu/image' #check on
- doc_skin_dir = /((?:https?|file):\/\/\S+?)\/[^\/]+?\.sst$/.match(url).captures.join + '/_sisu/skin/doc'
downloaded_file=File.new("#{fnb}.-sst",'w+')
- image_download_url=SiSU_Assemble::Remote_image.new.image(imagedir)
+ image_download_url=SiSU_Assemble::RemoteImage.new.image(imagedir)
images=[]
- skin=SiSU_Assemble::Remote_image.new.image(doc_skin_dir)
f.collect.each do |r| # work area
unless r =~/^%+\s/
- skin << r.scan(@rgx_skin).uniq if r =~@rgx_skin
if r !~/^%+\s/ \
and r =~@rgx_image
images << r.scan(@rgx_image).uniq
@@ -137,19 +132,16 @@ module SiSU_Remote
end
downloaded_file << r
end
- if skin \
- and skin.length > 0
- SiSU_Assemble::Remote_image.new.download_doc_skin(skin)
- end
if images \
and images.length > 1
- images.flatten!
- images.uniq!
+ images=images.flatten.uniq
images.delete_if {|x| x =~/https?:\/\// }
- images.sort!
+ images=images.sort
@msg,@msgs='downloading images:', [ images.join(',') ]
@tell.call.warn unless @opt.cmd =~/q/
- SiSU_Assemble::Remote_image.new.download_images(image_download_url[0],images)
+ image_info=image_download_url + images
+ SiSU_Assemble::RemoteImage.new.download_images(image_info)
+ #SiSU_Assemble::RemoteImage.new.download_images(image_download_url,images)
@msg,@msgs='downloading done',nil
@tell.call.warn unless @opt.cmd =~/q/
end
@@ -164,8 +156,7 @@ module SiSU_Remote
if get_p.length > 0 #% remote sisupod
require 'net/http'
for requested_pod in get_p
- pod_info=Remote_download.new(requested_pod)
- @opt.fns=pod_info.pod.name
+ pod_info=RemoteDownload.new(requested_pod)
Net::HTTP.start(pod_info.pod.site) do |http|
resp=http.get("#{pod_info.pod.path}/#{pod_info.pod.name_source}")
open(pod_info.pod.name,'wb') do |file|
@@ -176,17 +167,17 @@ module SiSU_Remote
end
end
end
- class Remote_download
+ class RemoteDownload
def initialize(requested_file)
@requested_file=requested_file
end
def pod
- re_p_div=/https?:\/\/([^\/]+)(\/\S+)\/(sisupod(?:\.zip)?|\S+?(?:\.ss[mt]\.zip)?|[^\/]+?\.ssp)$/
- re_p=/(sisupod(?:\.zip)?|\S+?\.ss[mt](?:\.zip)?|[^\/]+?\.ssp)$/
+ re_p_div=/https?:\/\/([^\/]+)(\/\S+)\/(sisupod\.(?:txz|zip)|\S+?(?:\.ss[mt]\.(?:txz|zip))?|[^\/]+?\.ssp)$/
+ re_p=/(sisupod\.(?:txz|zip)|\S+?\.ss[mt]\.(?:txz|zip)?|[^\/]+?\.ssp)$/
if @requested_file =~ re_p_div
@site,@pth,@pod= re_p_div.match(@requested_file).captures
elsif @requested_file =~ re_p
- @pod= re_p.match(@requested_file).captures
+ @pod=re_p.match(@requested_file).captures.join
end
def site
@site
diff --git a/lib/sisu/v2/response.rb b/lib/sisu/v4/response.rb
index 8fad9fc9..d660d398 100644
--- a/lib/sisu/v2/response.rb
+++ b/lib/sisu/v4/response.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -62,9 +61,9 @@ module SiSU_Response
response='redo'
print ask + " ['yes', 'no' or 'quit']: "
response=File.new('/dev/tty').gets.strip
- ans=if response=='yes'; true
- elsif response=='no'; false
- elsif response =~/^quit|exit$/; exit
+ ans=if response=='yes' then true
+ elsif response=='no' then false
+ elsif response =~/^quit|exit$/ then exit
else puts "[please type: 'yes', 'no' or 'quit']"
response?(ask)
end
diff --git a/lib/sisu/v2/rexml.rb b/lib/sisu/v4/rexml.rb
index dc599e64..886d7eab 100644
--- a/lib/sisu/v2/rexml.rb
+++ b/lib/sisu/v4/rexml.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -59,21 +58,19 @@
module SiSU_Rexml
# load XML file for REXML parsing
require 'rexml/document' if FileTest.directory?("#{Config::CONFIG['rubylibdir']}/rexml") #Config::CONFIG['sitedir']
- require "#{SiSU_lib}/param" # param.rb
+ require_relative 'param' # param.rb
include SiSU_Param
- require "#{SiSU_lib}/sysenv" # sysenv.rb
+ require_relative 'sysenv' # sysenv.rb
include SiSU_Env
include SiSU_Viz
class Rexml
require 'rexml/document' if FileTest.directory?("#{Config::CONFIG['rubylibdir']}/rexml") #Config::CONFIG['sitedir']
def initialize(md,fno)
@md,@fno=md,fno
- @env=SiSU_Env::Info_env.new(@md.fns)
- @prog=SiSU_Env::Info_program.new #(md.fns) #if md
- if File.file?"#{@env.path.output}/#{@md.fnb}/#{@fno}"
- @fnap="#{@env.path.output}/#{@md.fnb}/#{@fno}" #index.xml causes problems with index.html in server config
- elsif File.file?"#{Dir.pwd}/#{@fno}"
- @fnap="#{Dir.pwd}/#{@fno}"
+ @env=SiSU_Env::InfoEnv.new(@md.fns)
+ @prog=SiSU_Env::InfoProgram.new #(md.fns) #if md
+ if File.file?(@fno)
+ @fnap=@fno #index.xml causes problems with index.html in server config
end
@e_head='/document/head'
@e_title='/document/head/title'
@@ -90,10 +87,10 @@ module SiSU_Rexml
xmlfile=IO.readlines(@fnap,'').join
begin
@xmldoc=REXML::Document.new xmlfile
- SiSU_Screen::Ansi.new(@md.cmd,'invert','REXML',"XML document #{@fnap} loaded").colorize unless @md.cmd =~/q/ #% tell
- if @md.cmd =~ /v/i #% substantive text
+ SiSU_Screen::Ansi.new(@md.opt.cmd,'invert','REXML',"XML document #{@fnap} loaded").colorize unless @md.opt.cmd =~/q/ #% tell
+ if @md.opt.cmd =~ /v/i #% substantive text
@xmldoc.elements.each(@e_head) do |e|
- SiSU_Screen::Ansi.new(@md.cmd,'brown',e).colorize unless @md.cmd =~/q/
+ SiSU_Screen::Ansi.new(@md.opt.cmd,'brown',e).colorize unless @md.opt.cmd =~/q/
end
end
rescue REXML::ParseException
@@ -101,10 +98,13 @@ module SiSU_Rexml
end
end
else
- SiSU_Screen::Ansi.new(@md.cmd,'fuschia',"File Not Found #{xmlfile}",'requested XML processing skipped').colorize unless @md.cmd =~/q/
+ SiSU_Screen::Ansi.new(@md.opt.cmd,'fuschia',"File Not Found #{xmlfile}",'requested XML processing skipped').colorize unless @md.opt.cmd =~/q/
exit
end
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
ensure
end
end
diff --git a/lib/sisu/v2/screen_text_color.rb b/lib/sisu/v4/screen_text_color.rb
index 2ebe46fa..a9c0b367 100644
--- a/lib/sisu/v2/screen_text_color.rb
+++ b/lib/sisu/v4/screen_text_color.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -58,7 +57,7 @@
=end
module SiSU_Screen
class Color
- attr_accessor :off,:marker,:bold,:underline,:invert,:darkgrey_hi,:grey_hi,:pink_hi,:fuschia_hi,:red_hi,:orange_hi,:yellow_hi,:brown_hi,:lightgreen_hi,:green_hi,:cyan_hi,:blue_hi,:navy_hi,:white,:grey,:pink,:fuschia,:ruby,:red,:orange,:yellow,:brown,:green,:darkgreen,:cyan,:blue,:navy,:black
+ attr_accessor :off,:marker,:bold,:underline,:invert,:darkgrey_hi,:grey_hi,:pink_hi,:fuschia_hi,:red_hi,:orange_hi,:yellow_hi,:brown_hi,:lightgreen_hi,:green_hi,:cyan_hi,:blue_hi,:navy_hi,:white,:white_bold,:grey,:pink,:fuschia,:ruby,:red,:orange,:yellow,:brown,:green,:darkgreen,:cyan,:blue,:navy,:black
def initialize(&block)
instance_eval &block
end
@@ -68,29 +67,25 @@ module SiSU_Screen
def initialize(cmd,*txt)
@cmd,@txt=cmd,txt
@color_instruct=txt[0]
- flag=SiSU_Env::Info_processing_flag.new
+ flag=SiSU_Env::InfoProcessingFlag.new
if @cmd
- if flag.color #set default colors on or off -c acts as toggle against this default, if default is off -c turns on, if default is on -c turns off
- @use_color=if @cmd =~/c/; false
- else true
- end
- else
- @use_color=if @cmd =~/c/; true
- else false
- end
- end
- if @cmd =~/k/; @use_color=false
+ #set default colors on or off -c acts as toggle against this default, if default is off -c turns on, if default is on -c turns off
+ @use_color=(flag.color) \
+ ? ((@cmd =~/c/) ? false : true)
+ : ((@cmd =~/c/) ? true : false)
+ if @cmd =~/k/ then @use_color=false # useful color off switch, however, k may be used for something else in future
end
else @use_color=false
end
@cX=@@cX= unless @use_color
Color.new do
- self.off=self.white=self.marker=self.bold=self.underline=self.invert=self.darkgrey_hi=self.grey_hi=self.pink_hi=self.fuschia_hi=self.red_hi=self.orange_hi=self.yellow_hi=self.brown_hi=self.lightgreen_hi=self.green_hi=self.cyan_hi=self.blue_hi=self.navy_hi=self.grey=self.pink=self.fuschia=self.ruby=self.red=self.orange=self.yellow=self.brown=self.green=self.darkgreen=self.cyan=self.blue=self.navy=self.black=''
+ self.off=self.white=self.white_bold=self.marker=self.bold=self.underline=self.invert=self.darkgrey_hi=self.grey_hi=self.pink_hi=self.fuschia_hi=self.red_hi=self.orange_hi=self.yellow_hi=self.brown_hi=self.lightgreen_hi=self.green_hi=self.cyan_hi=self.blue_hi=self.navy_hi=self.grey=self.pink=self.fuschia=self.ruby=self.red=self.orange=self.yellow=self.brown=self.green=self.darkgreen=self.cyan=self.blue=self.navy=self.black=''
end
else #default set to colors on
Color.new do
self.off = "\033[0m"
- self.white = "\033[0m"
+ self.white = "\033[37m"
+ self.white_bold = "\033[1m"
self.marker = "\033[42m"
self.bold = "\033[1m"
self.underline = "\033[4m"
@@ -127,7 +122,7 @@ module SiSU_Screen
end
def colors
0.upto(109) {|i| print "\033[#{i}m 33[#{i}m \033[m"}
- puts ''
+ puts ''
end
def color
case @color_instruct
@@ -205,16 +200,16 @@ module SiSU_Screen
def sisu
end
def rescue
- %{\t #{@cX.orange}Rescued#{@cX.off} #{@cX.grey}An#{@cX.off} #{@cX.fuschia}ERROR#{@cX.off} #{@cX.grey}occurred, message:"#{@cX.off} #{@cX.fuschia}#{@txt[0]}#{@cX.off} #{@cX.grey}#{@txt[1]}#{@cX.off} #{@cX.brown}#{@txt[2]}#{@cX.off}}
+ STDERR.puts %{\t #{@cX.orange}Rescued#{@cX.off} #{@cX.grey}#{yield if block_given?}\n\t An#{@cX.off} #{@cX.fuschia}ERROR#{@cX.off} #{@cX.grey}occurred, message:#{@cX.off} #{@cX.fuschia}#{@txt[0]}#{@cX.off} #{@cX.grey}#{@txt[1]}#{@cX.off} #{@cX.brown}#{@txt[2]}#{@cX.off}}
end
def warn
- puts "\t #{@cX.brown}#{@txt[0]}#{@cX.off} #{@cX.grey}#{@txt[1]}#{@cX.off}"
+ STDERR.puts "\t #{@cX.brown}#{@txt[0]}#{@cX.off} #{@cX.grey}#{@txt[1]}#{@cX.off}"
end
def error
- puts "\t #{@cX.fuschia}#{@txt[0]}#{@cX.off} #{@cX.brown}#{@txt[1]}#{@cX.off}"
+ STDERR.puts "\t #{@cX.fuschia}#{@txt[0]}#{@cX.off} #{@cX.brown}#{@txt[1]}#{@cX.off}"
end
def error2
- puts "\t #{@cX.grey}#{@txt[0]}#{@cX.off} #{@cX.fuschia}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}"
+ STDERR.puts "\t #{@cX.grey}#{@txt[0]}#{@cX.off} #{@cX.fuschia}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}"
end
def version
puts "#{@cX.blue_hi}#{@txt[0]} #{@txt[1]}#{@cX.off} #{@cX.grey} (#{@txt[3]} [#{@txt[2]}]) &#{@cX.off} #{@cX.ruby}Ruby#{@cX.off} #{@cX.grey}(#{@txt[4]})#{@cX.off}\n"
@@ -254,13 +249,6 @@ module SiSU_Screen
%{#{@cX.off} } +
%{#{@cX.cyan}nav only: #{@txt[4]}#{@cX.off}.}
end
- def php_numbers
- puts %{ #{@cX.green}#{@txt[0]}#{@cX.off} #{@cX.cyan}files processed#{@cX.off}. } +
- %{php_scr only: #{@txt[1]}, } +
- %{#{@cX.cyan}php_seg only: #{@txt[2]}#{@cX.off}, } +
- %{joint php scroll & seg: #{@txt[3]}, } +
- %{php_nav only: #{@txt[4]}}
- end
def txt_white
puts "\t#{@cX.white}#{@txt[0]}#{@cX.off} #{@cX.white}#{@txt[1]}#{@cX.off}"
end
@@ -348,6 +336,9 @@ module SiSU_Screen
def grey_title_hi
puts %{#{@cX.grey_hi}#{@cX.black}#{@txt[0]}#{@cX.off*2} #{@cX.blue}#{@txt[1]}#{@cX.off}}
end
+ def grey_title_grey_blue
+ puts %{#{@cX.grey_hi}#{@cX.black}#{@txt[0]}#{@cX.off*2} #{@cX.grey}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off}}
+ end
def dark_grey_title_hi
puts %{#{@cX.darkgrey_hi}#{@cX.black}#{@txt[0]}#{@cX.off*2} #{@cX.blue}#{@txt[1]}#{@cX.off}}
end
@@ -403,12 +394,81 @@ module SiSU_Screen
def html_output
puts %{\t#{@cX.grey}#{@txt[0]}#{@cX.off} #{@cX.ruby}->#{@cX.off}\n\t #{@cX.blue}#{@txt[1]}#{@cX.off}}
end
- def php_title
- puts %{\n#{@cX.green_hi}#{@cX.black}PHP#{@cX.off*2}}
- end
def segmented
puts "\t#{@cX.grey}Seg#{@cX.off} #{@cX.green}#{@txt[0]}#{@cX.off} #{@cX.grey}segments#{@cX.off}"
end
end
end
__END__
+ Color.new do
+ self.off = "\033[0m"
+ self.white = "\033[37m"
+ self.white_bold = "\033[1m"
+ self.marker = "\033[42m"
+ self.bold = "\033[1m"
+ self.underline = "\033[4m"
+ self.invert = "\033[7m"
+ self.darkgrey_hi = "\033[100m"
+ self.grey_hi = "\033[47m"
+ self.pink_hi = "\033[105m"
+ self.fuschia_hi = "\033[45m"
+ self.red_hi = "\033[41m"
+ self.orange_hi = "\033[101m"
+ self.yellow_hi = "\033[103m"
+ self.brown_hi = "\033[43m"
+ self.lightgreen_hi = "\033[102m"
+ self.green_hi = "\033[42m"
+ self.cyan_hi = "\033[106m"
+ self.blue_hi = "\033[104m"
+ self.navy_hi = "\033[44m"
+ self.grey = "\033[90m"
+ self.pink = "\033[95m"
+ self.fuschia = "\033[35m"
+ self.ruby = "\033[31m"
+ self.red = "\033[91m" #check
+ self.orange = "\033[91m"
+ self.yellow = "\033[93m"
+ self.brown = "\033[33m"
+ self.green = "\033[92m"
+ self.darkgreen = "\033[32m"
+ self.cyan = "\033[36m"
+ self.blue = "\033[94m"
+ self.navy = "\033[34m"
+ self.black = "\033[30m"
+ end
+# fewer colors
+ Color.new do
+ self.off = "\033[0m"
+ self.white = "\033[0m"
+ self.marker = "\033[42m"
+ self.bold = "\033[1m"
+ self.underline = "\033[4m"
+ self.invert = "\033[7m"
+ self.darkgrey_hi = "\033[100m"
+ self.grey_hi = "\033[47m"
+ self.pink_hi = "\033[105m"
+ self.fuschia_hi = "\033[45m"
+ self.red_hi = "\033[41m"
+ self.orange_hi = "\033[101m"
+ self.yellow_hi = "\033[103m"
+ self.brown_hi = "\033[43m"
+ self.lightgreen_hi = "\033[102m"
+ self.green_hi = "\033[42m"
+ self.cyan_hi = "\033[106m"
+ self.blue_hi = "\033[104m"
+ self.navy_hi = "\033[44m"
+ self.grey = "\033[90m"
+ self.pink = "\033[95m"
+ self.fuschia = "\033[35m"
+ self.ruby = "\033[31m"
+ self.red = "\033[31m" #check
+ self.orange = "\033[91m"
+ self.yellow = "\033[33m"
+ self.brown = "\033[33m"
+ self.green = "\033[32m"
+ self.darkgreen = "\033[32m"
+ self.cyan = "\033[36m"
+ self.blue = "\033[34m"
+ self.navy = "\033[34m"
+ self.black = "\033[30m"
+ end
diff --git a/lib/sisu/v2/share_src.rb b/lib/sisu/v4/share_src.rb
index 900e78ff..2c446ecb 100644
--- a/lib/sisu/v2/share_src.rb
+++ b/lib/sisu/v4/share_src.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -57,38 +56,31 @@
=end
module SiSU_Markup
- require "#{SiSU_lib}/sysenv" # sysenv.rb
+ require_relative 'shared_sisupod_source' # shared_sisupod_source.rb
+ include SiSU_Source
+ require_relative 'sysenv' # sysenv.rb
include SiSU_Env
pwd=Dir.pwd
- class Source
- require 'fileutils'
- include FileUtils
- def initialize(opt)
+ class Source < SiSU_Source::SiSUpodSource
+ def initialize(opt,build=nil,place=nil)
+ super(opt,build,place)
@opt=opt
- @env=SiSU_Env::Info_env.new(@opt.fns)
- stub=@opt.fnb.gsub(/~[a-z]+$/,'')
- @output_path="#{@env.path.output}/src"
end
def read
unless @opt.cmd =~/q/
@opt.cmd=~/[MVvz]/ \
- ? SiSU_Screen::Ansi.new(@opt.cmd,'Share Document Source!',@opt.fns).green_hi_blue \
+ ? SiSU_Screen::Ansi.new(@opt.cmd,'Share Document Source!',@opt.fns).green_hi_blue
: SiSU_Screen::Ansi.new(@opt.cmd,'Share Document Source!',@opt.fns).green_title_hi
- SiSU_Screen::Ansi.new(@opt.cmd,"Copy sisu markup file to output directory","#{@opt.fns} -> #{@output_path}").warn if @opt.cmd =~/[MVv]/
+ SiSU_Screen::Ansi.new(@opt.cmd,"Copy sisu markup file to output directory","#{@opt.fno} -> #{@file.output_path.src.dir}").warn if @opt.cmd =~/[MVv]/
end
- mkdir_p(@output_path) unless FileTest.directory?(@output_path)
- if FileTest.directory?(@output_path)
- unless @opt.fns =~/\.ssm$/; cp(@opt.fns,@output_path)
- else
- req=@opt.fns.gsub(/(.+?\.ssm)$/,'\1.sst')
- file="#{@env.path.composite_file}/#{@opt.fnb}.ssm.sst"
- if FileTest.file?(file); cp(file,"#{@output_path}/#{req}")
- else print "did not find #{file} to copy"
- end
- end
+ if FileTest.directory?(@path_pod[:fnb])
+ FileUtils::mkdir_p(@file.output_path.src.dir) unless FileTest.directory?(@file.output_path.src.dir)
+ v=(@opt.cmd =~/M/) ? 'v' : ''
+ system(%{
+ rsync -a#{v} #{@path_pod[:fnb]} #{@file.output_path.sisupod.dir}
+ })
else
- SiSU_Screen::Ansi.new(@opt.cmd,"Output directory does not exist","#{@opt.fns} -> #{@output_path}").warn if @opt.cmd =~/[MVv]/
- exit
+ SiSU_Screen::Ansi.new('',"#{@opt.fno} not available").blue_tab if @opt.cmd=~/[MVv]/
end
end
end
diff --git a/lib/sisu/v2/share_src_kdissert.rb b/lib/sisu/v4/share_src_kdissert.rb
index 4c37f3ff..4d0eae9f 100644
--- a/lib/sisu/v2/share_src_kdissert.rb
+++ b/lib/sisu/v4/share_src_kdissert.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -56,8 +55,8 @@
** Description: share sisu source markup file, copy it to output directory!
=end
-module SiSU_Kdi_source
- require "#{SiSU_lib}/sysenv" # sysenv.rb
+module SiSU_KdiSource
+ require_relative 'sysenv' # sysenv.rb
include SiSU_Env
pwd=Dir.pwd
class Source
@@ -65,18 +64,18 @@ module SiSU_Kdi_source
include FileUtils
def initialize(opt)
@opt=opt
- @env=SiSU_Env::Info_env.new(@opt.fns)
+ @env=SiSU_Env::InfoEnv.new(@opt.fns)
@output_path="#{@env.path.output}/#{@opt.fnb}"
end
def read
SiSU_Screen::Ansi.new(@opt.cmd,'Share Kdissert Source Document!',@opt.fnb).green_hi_blue unless @opt.cmd =~/q/
SiSU_Screen::Ansi.new(@opt.cmd,"Copy kdissert file to output directory","#{@opt.fnb} -> #{@output_path}").warn unless @opt.cmd =~/q/
- mkdir_p(@env.path.output) unless FileTest.directory?(@env.path.output)
- mkdir_p(@output_path) unless FileTest.directory?(@output_path)
+ FileUtils::mkdir_p(@env.path.output) unless FileTest.directory?(@env.path.output)
+ FileUtils::mkdir_p(@output_path) unless FileTest.directory?(@output_path)
if FileTest.directory?(@output_path)
if @opt.fns =~/\.kdi\._sst$/ \
and FileTest.file?(@opt.fnb)
- cp(@opt.fnb,@output_path)
+ FileUtils::cp(@opt.fnb,@output_path)
end
else
SiSU_Screen::Ansi.new(@opt.cmd,"Output directory does not exist","#{@opt.fnb} -> #{@output_path}").warn unless @opt.cmd =~/q/
diff --git a/lib/sisu/v2/shared_html.rb b/lib/sisu/v4/shared_html.rb
index dfffc5c9..98966965 100644
--- a/lib/sisu/v2/shared_html.rb
+++ b/lib/sisu/v4/shared_html.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -56,10 +55,10 @@
** Description: shared html parts
=end
-module SiSU_HTML_shared
- require "#{SiSU_lib}/defaults" # defaults.rb
- require "#{SiSU_lib}/html_table" # html_table.rb
- class Table_html < SiSU_HTML_table::Table_html
+module SiSU_HTML_Shared
+ require_relative 'defaults' # defaults.rb
+ require_relative 'html_table' # html_table.rb
+ class TableHTML < SiSU_HTML_Table::TableHTML
end
end
__END__
diff --git a/lib/sisu/v2/shared_html_lite.rb b/lib/sisu/v4/shared_html_lite.rb
index 02b4dcc2..dfb98ad0 100644
--- a/lib/sisu/v2/shared_html_lite.rb
+++ b/lib/sisu/v4/shared_html_lite.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -57,18 +56,18 @@
xml/xhtml/html formatting
=end
-module SiSU_Format_Shared
- require "#{SiSU_lib}/defaults" # defaults.rb
+module SiSU_FormatShared
+ require_relative 'defaults' # defaults.rb
include SiSU_Viz
class CSS_Format
- require "#{SiSU_lib}/defaults" # defaults.rb
- require "#{SiSU_lib}/particulars" # particulars.rb
+ require_relative 'defaults' # defaults.rb
+ require_relative 'particulars' # particulars.rb
@@fns=nil
def initialize(md,t_o)
@md,@t_o=md,t_o
@txt=@t_o.obj
@id=@ocn=@t_o.ocn if defined? @t_o.ocn
- @lv=@t_o.lv.to_s if @t_o.is=='heading'
+ @lv=@t_o.lv.to_s if @t_o.is==:heading
if @md.fns != @@fns
@@fns,@@hname=@md.fns,''
end
@@ -78,15 +77,15 @@ module SiSU_Format_Shared
else @@hname
end
@tab="\t"
- @brace_url=SiSU_Viz::Skin.new.url_decoration
+ @brace_url=SiSU_Viz::Defaults.new.url_decoration
@@tablehead,@@tablefoot=[],[]
- @vz=SiSU_Env::Get_init.instance.skin
- @env=SiSU_Env::Info_env.new(@md.fns)
+ @vz=SiSU_Viz::Defaults.new
+ @env=SiSU_Env::InfoEnv.new(@md.fns)
@base_url="#{@env.url.root}/#{@md.fnb}/#{@hname}.html"
end
def urls(data)
@words=[]
- map_nametags=SiSU_Particulars::Combined_singleton.instance.get_map_nametags(@md).nametags_map
+ map_nametags=SiSU_Particulars::CombinedSingleton.instance.get_map_nametags(@md).nametags_map
data.each do |word|
@words << if word=~/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}(#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/
if word =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/
@@ -109,16 +108,16 @@ module SiSU_Format_Shared
%{<a href="#{u}">[#{png}]</a>#{caption}}
else %{[#{png}] #{caption}}
end
- word.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/,ins)
+ word=word.gsub(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/,ins)
else
u=case u
when /^https?:\/\//
u
when /^:/
- u.gsub!(/^:/,'')
+ u=u.gsub(/^:/,'')
"#{@env.url.root}/#{u}"
when /^\.\.\// # can remove
- u.gsub!(/^\.\.\//,'')
+ u=u.gsub(/^\.\.\//,'')
"#{@env.url.root}/#{u}"
else
"#{@env.url.root}/#{@md.fnb}/#{map_nametags[u][:segname]}#{Sfx[:html]}##{u}"
@@ -127,8 +126,8 @@ module SiSU_Format_Shared
png=m.scan(/\S+/)[0].strip
link=link.strip
ins=%{<a href="#{u}">#{link}</a>}
- word.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,ins)
- word.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/,ins)
+ word=word.gsub(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,ins).
+ gsub(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/,ins)
word
end
word
@@ -139,34 +138,34 @@ module SiSU_Format_Shared
@words=@words.join(' ')
end
def markup_generic(s)
- s=s.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>')
- s=s.gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>')
- s=s.gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>')
- s=s.gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'"\1"')
- s=s.gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'+{\1}+')
- s=s.gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strke_c]}/,'-{\1}-')
- s=s.gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>')
- s=s.gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>')
- s=s.gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>') # tt, kbd
- s=s.gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/i,'~')
+ s=s.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>').
+ gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>').
+ gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>').
+ gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'"\1"').
+ gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'+{\1}+').
+ gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strke_c]}/,'-{\1}-').
+ gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>').
+ gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>').
+ gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>'). # tt, kbd
+ gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/i,'~')
end
def markup_object(t_o)
s=t_o.obj
- if t_o.is !='code'
+ s=if t_o.is !=:code
s=markup_generic(s)
if s =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/
wm=s.scan(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)|\S+/)
words=urls(wm)
- s.gsub!(/.+/m,words)
+ s=s.gsub(/.+/m,words)
end
- s.gsub!(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;')
- s.gsub!(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;')
- s.gsub!(/#{Mx[:url_o]}[_\\](\S+?)#{Mx[:url_c]}/,'<a href="\1" target="_top">\1</a>') #http ftp matches escaped, no decoration
- s.gsub!(/(#{Mx[:lnk_c]})#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1<a href="\2" target="_top">\2</a>') #special case \{ e.g. \}http://url
- s.gsub!(/(^|#{Mx[:gl_c]}|\s)#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{\\1#{@brace_url.xml_open}<a href="\\2" target="_top">\\2</a>#{@brace_url.xml_close}\\3}) #http ftp matches with decoration
+ s.gsub(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;').
+ gsub(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;').
+ gsub(/#{Mx[:url_o]}[_\\](\S+?)#{Mx[:url_c]}/,'<a href="\1" target="_top">\1</a>'). #http ftp matches escaped, no decoration
+ gsub(/(#{Mx[:lnk_c]})#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1<a href="\2" target="_top">\2</a>'). #special case \{ e.g. \}http://url
+ gsub(/(^|#{Mx[:gl_c]}|\s)#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{\\1#{@brace_url.xml_open}<a href="\\2" target="_top">\\2</a>#{@brace_url.xml_close}\\3}) #http ftp matches with decoration
else
- s.gsub!(/(^|[^}])_</m,'\1&lt;'); s.gsub!(/(^|[^}])_>/m,'\1&gt;') #code-block: angle brackets special characters
- s.gsub!(/(^|[^}])_</m,'\1&lt;'); s.gsub!(/(^|[^}])_>/m,'\1&gt;')
+ s.gsub(/</m,'&lt;').
+ gsub(/>/m,'&gt;')
end
s
end
@@ -177,11 +176,11 @@ module SiSU_Format_Shared
words=urls(wm)
s=s.gsub(/.+/m,words)
end
- s=s.gsub(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;')
- s=s.gsub(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;')
- s=s.gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'<a href="\1" target="_top">\1</a>\2') #http ftp matches escaped, no decoration
- s=s.gsub(/(#{Mx[:lnk_c]})#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1<a href="\2" target="_top">\2</a>') #special case \{ e.g. \}http://url
- s=s.gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}<a href="\\1" target="_top">\\1</a>#{@brace_url.xml_close}}) #http ftp matches with decoration
+ s=s.gsub(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;').
+ gsub(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;').
+ gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'<a href="\1" target="_top">\1</a>\2'). #http ftp matches escaped, no decoration
+ gsub(/(#{Mx[:lnk_c]})#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1<a href="\2" target="_top">\2</a>'). #special case \{ e.g. \}http://url
+ gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}<a href="\\1" target="_top">\\1</a>#{@brace_url.xml_close}}) #http ftp matches with decoration
end
def paragraph
%{<p class="h#{@lv}" type="substantive" header="#{@hname}">#{@txt}</p>\n} # << "\n"
@@ -204,36 +203,42 @@ GSUB
%{<p class="toc#{@lv}" header="#{@hname}"><a href="##{@ocn}">#{@txt}</a></p>\n} #<< "\n"
end
def lev_toc
- h={:txt =>txt,:class =>"toc#{@lv}",:type =>'toc'}
+ h={ txt: txt, class: "toc#{@lv}", type: 'toc' }
tag_para(h)
end
def lev4_plus
txt=markup_object(@t_o)
- h={:txt =>txt,:class =>"h#{@lv}",:type =>'substantive',:id =>@ocn,:header =>@hname}
+ h={ txt: txt, class: "h#{@lv}", type: 'substantive', id: @ocn, header: @hname }
tag_header(h)
end
def lev4_minus
txt=markup_object(@t_o)
- h={:txt =>txt,:class =>"h#{@t_o.ln}",:type =>'substantive',:id =>@ocn}
+ h={ txt: txt, class: "h#{@t_o.ln}", type: 'substantive', id: @ocn }
tag_para(h)
end
def norm_comment
- h={:txt =>@t_o.obj,:class =>'norm',:type =>'comment'}
+ h={ txt: @t_o.obj, class: 'norm', type: 'comment' }
tag_para(h)
end
def norm
txt=markup_object(@t_o)
- h={:txt =>txt,:class =>'norm',:type =>'substantive',:id =>@ocn}
+ h={ txt: txt, class: 'norm', type: 'substantive', id: @ocn }
tag_para(h)
end
def code
txt=markup_object(@t_o)
- h={:txt =>"<tt>#{txt}</tt>",:class =>'code',:type =>'substantive',:id =>@ocn}
+ h={ txt: "<tt>#{txt}</tt>", class: 'code', type: 'substantive', id: @ocn }
tag_para(h)
end
def indent(t)
txt=markup_object(@t_o)
- h={:txt =>txt,:class =>"indent#{t}",:type =>'substantive',:id =>@ocn}
+ h={ txt: txt, class: "indent#{t}", type: 'substantive', id: @ocn }
+ tag_para(h)
+ end
+ def hang_indent(f,t)
+ txt=markup_object(@t_o)
+ h={ txt: txt, class: "hang#{f}indent#{t}", type: 'substantive', id: @ocn }
+ #h={ txt: txt, class: "h#{f}i#{t}", type: 'substantive', id: @ocn }
tag_para(h)
end
def para_table
@@ -247,39 +252,39 @@ GSUB
@txt.split(/\n/).each do |parablock|
m=parablock[/<!f(.+?)!>/,1]
@@tablefoot << m if m
- parablock.gsub!(/<!f.+?!>/,'')
+ parablock=parablock.gsub(/<!f.+?!>/,'')
@@tablehead=1 if parablock =~/#{Mx[:gr_o]}Th#{Mx[:tc_p]}/u
- parablock.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+?#{Mx[:tc_p]}~(\d+)#{Mx[:gr_c]}/,
- %{<table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">})
+ parablock=parablock.gsub(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+?#{Mx[:tc_p]}~(\d+)#{Mx[:gr_c]}/,
+ %{<table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">})
if parablock =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/
tablefoot=[]
@@tablefoot.each {|x| tablefoot << %{<p align="center"><font size=2><i>#{x}</i></font></p>\n}}
@@tablefoot=[]
- parablock.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/,
+ parablock=parablock.gsub(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/,
%{#{@vz.table_close}\n}) # +
end
if @@tablehead==1
if parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}/u
- parablock.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,
- %{\n<tr>} +
- %{\n<td width="\\1%" valign="top">} +
- %{#{para_table}<b>})
- parablock.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,
- %{</b></td><td width="\\1%" valign="top">} +
- %{#{para_table}<b>})
- parablock.gsub!(/#{Mx[:tc_c]}/, '</b></td></tr>')
+ parablock=parablock.gsub(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,
+ %{\n<tr>} +
+ %{\n<td width="\\1%" valign="top">} +
+ %{#{para_table}<b>}).
+ gsub(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,
+ %{</b></td><td width="\\1%" valign="top">} +
+ %{#{para_table}<b>}).
+ gsub(/#{Mx[:tc_c]}/, '</b></td></tr>')
@@tablehead=0
end
parablock
else
- parablock.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,
- %{\n<tr>} +
- %{\n<td width="\\1%" valign="top">} +
- %{#{para_table}})
- parablock.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,
- %{</td><td width="\\1%" valign="top">} +
- %{#{para_table}})
- parablock.gsub!(/#{Mx[:tc_c]}/, '</td></tr>')
+ parablock=parablock.gsub(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,
+ %{\n<tr>} +
+ %{\n<td width="\\1%" valign="top">} +
+ %{#{para_table}}).
+ gsub(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,
+ %{</td><td width="\\1%" valign="top">} +
+ %{#{para_table}}).
+ gsub(/#{Mx[:tc_c]}/, '</td></tr>')
parablock
end
@new_content << parablock
@@ -287,7 +292,7 @@ GSUB
@new_content.join
end
end
- class CSS_Format_generic #does CSS_Format in one definition, needs to be told about attrib, despite brevity of generic, easier to see structure with CSS_Format
+ class CSS_FormatGeneric #does CSS_Format in one definition, needs to be told about attrib, despite brevity of generic, easier to see structure with CSS_Format
def initialize(attrib='',txt='',id=nil,ocnd=nil,ocns=nil,lv='',hname=nil)
@tab="\t"
@attrib=attrib
diff --git a/lib/sisu/v4/shared_images.rb b/lib/sisu/v4/shared_images.rb
new file mode 100644
index 00000000..48fd81a6
--- /dev/null
+++ b/lib/sisu/v4/shared_images.rb
@@ -0,0 +1,137 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: common file for xml generation
+=end
+module SiSU_Images
+ require_relative 'particulars' # particulars.rb
+ class Source
+ def initialize(opt)
+ @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)
+ end
+ def read
+ SiSU_Images::Source::Place.new(@particulars).songsheet
+ end
+ class Place
+ def initialize(particulars)
+ @particulars=particulars
+ @md=@particulars.md
+ @env=@particulars.env
+ @o_str ||=SiSU_Env::ProcessingSettings.new(@md).output_dir_structure
+ end
+ def songsheet
+ images_set.select_sisu_base
+ images_set.select_with_document
+ end
+ def images_set
+ @pwd=(/(\S+?)(?:\/(?:#{Px[:lng_lst_rgx]}))?$/).match(Dir.pwd)[1]
+ def copy(src_path,dest_path,images=nil)
+ if FileTest.directory?(src_path)
+ FileUtils::cd(src_path)
+ unless images
+ images=Dir.glob("*.{png,jpg,gif,ico}")
+ end
+ unless FileTest.directory?(dest_path) \
+ or FileTest.symlink?(dest_path)
+ FileUtils::mkdir_p(dest_path)
+ FileUtils::chmod(0755,dest_path)
+ end
+ if images.length > 0
+ images.each do |i|
+ if FileTest.file?(i)
+ FileUtils::cp_r(i,"#{dest_path}/#{i}")
+ FileUtils::chmod(0644,"#{dest_path}/#{i}")
+ else STDERR.puts %{\t*WARN* did not find image - "#{i}" [#{__FILE__}:#{__LINE__}]}
+ end
+ end
+ end
+ FileUtils::cd(@pwd)
+ else STDERR.puts %{\t*WARN* did not find - "#{src_path}" [#{__FILE__}:#{__LINE__}]}
+ end
+ end
+ def dest_path(image_type)
+ pth=if image_type==:image_sys
+ pth=(@o_str.dump_or_redirect?) \
+ ? "#{@md.file.output_path.html.dir}/image"
+ : "#{@md.file.output_path.base.dir}/_sisu/image_sys"
+ elsif image_type==:image
+ pth=(@o_str.dump_or_redirect?) \
+ ? "#{@md.file.output_path.html.dir}/image"
+ : "#{@md.file.output_path.base.dir}/_sisu/image"
+ end
+ pth
+ end
+ def select_with_document
+ images=@md.ec[:image]
+ src_path=unless @md.opt.f_pth[:pth] =~/\/\S+?\/sisupod\/\S+?\/sisupod\/doc/
+ "#{@pwd}/_sisu/image"
+ else #sisupod
+ pt=/(\/\S+?\/sisupod\/\S+?\/sisupod)\/doc/.match(@md.opt.f_pth[:pth])[1]
+ pt + '/image'
+ end
+ dest=dest_path(:image)
+ copy(src_path,dest,images)
+ end
+ def select_sisu_base
+ images=%w[arrow_next_red.png arrow_prev_red.png arrow_up_red.png dot_clear.png dot_white.png b_doc.png b_epub.png b_odf.png b_pdf.png b_toc.png]
+ src_path="#{@env.path.share}/image"
+ dest=dest_path(:image_sys)
+ copy(src_path,dest,images)
+ end
+ self
+ end
+ end
+ end
+end
+__END__
diff --git a/lib/sisu/v4/shared_markup_alt.rb b/lib/sisu/v4/shared_markup_alt.rb
new file mode 100644
index 00000000..4efedff1
--- /dev/null
+++ b/lib/sisu/v4/shared_markup_alt.rb
@@ -0,0 +1,321 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: system environment, resource control and configuration details
+
+=end
+module SiSU_TextRepresentation
+ class Alter
+ def initialize(x)
+ if x.is_a?(String)
+ @t_o,@s=nil,x
+ else
+ @t_o,@s=x,x.obj.dup
+ end
+ end
+ def strip_clean_of_extra_spaces # dal output tuned
+ @s=@s.dup
+ @s=@s.gsub(/[ ]+([,.;:?](?:$|\s))/,'\1') unless @s =~/#{Mx[:en_a_o]}|#{Mx[:en_b_o]}/
+ @s=@s.gsub(/ [ ]+/,' ').
+ 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
+ def strip_clean_of_markup # text form used in sql db search, used for digest, define rules, make same as in db clean
+ @s=@s.dup #% same as db clean -->
+ @s=@s.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\1').
+ gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\1').
+ gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\1').
+ gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'\1').
+ gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'\1').
+ gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strke_c]}/,'\1').
+ gsub(/#{Mx[:fa_superscript_o]}(\d+)#{Mx[:fa_superscript_c]}/,'[\1]').
+ gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'\1').
+ gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'\1').
+ gsub(/#{Mx[:fa_hilite_o]}(.+?)#{Mx[:fa_hilite_c]}/,'\1').
+ gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/i,'~').
+ gsub(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,''). # endnote removed
+ gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,''). # endnote removed
+ gsub(/(?:#{Mx[:nbsp]})+/,' ').
+ gsub(/(?:#{Mx[:br_nl]})+/,"\n").
+ gsub(/(?:#{Mx[:br_paragraph]})+/,"\n").
+ gsub(/(?:#{Mx[:br_line]})+/,"\n").
+ gsub(/#{Mx[:gl_o]}(?:#lt|#060)#{Mx[:gl_c]}/,'<').
+ gsub(/#{Mx[:gl_o]}(?:#gt|#062)#{Mx[:gl_c]}/,'>').
+ gsub(/#{Mx[:gl_o]}#(?:038|amp)#{Mx[:gl_c]}/,'&').
+ gsub(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!').
+ gsub(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#').
+ gsub(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*').
+ gsub(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-').
+ gsub(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/').
+ gsub(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_').
+ gsub(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{').
+ gsub(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}').
+ gsub(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~').
+ gsub(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'©').
+ gsub(/\s\s+/,' ').
+ gsub(/\s\s+/,' ').
+ strip
+ end
+ def semi_revert_markup # used for digest, define rules, make same as in db clean
+ if @t_o
+ @s=@s.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'*{\1}*').
+ gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'/{\1}/').
+ gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'_{\1}_').
+ gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'"{\1}"').
+ gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'+{\1}+').
+ gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strke_c]}/,'-{\1}-').
+ gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'^{\1}^').
+ gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,',{\1},').
+ gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/i,'~').
+ gsub(/#{Mx[:en_a_o]}([\d*+]+\s+.+?)#{Mx[:en_a_c]}/,'~{\1}~'). # endnote marker marked up
+ gsub(/#{Mx[:en_b_o]}([\d*+]+\s+.+?)#{Mx[:en_b_c]}/,'~[\1]~') # endnote marker marked up
+ if @t_o.is==:heading \
+ || @t_o.is==:para
+ @s=@s.gsub(/ [ ]+/,' ')
+ @s=@s.gsub(/(?:#{Mx[:nbsp]})+/,' ')
+ if @t_o.is==:heading
+ @s=@t_o.lv + '~ ' + @s
+ end
+ if @t_o.is==:para
+ if @t_o.bullet_
+ @s='_* ' + @s
+ end
+ if @t_o.indent.to_i > 0
+ @s="_#{@t_o.indent} " + @s
+ @s=@s.gsub(/^(_[1-9])\s_\*\s/,'\1* ')
+ end
+ end
+ end
+ if @t_o.is==:block \
+ || @t_o.is==:group \
+ || @t_o.is==:code
+ @s=@s.gsub(/#{Mx[:nbsp]}/,' ')
+ @s="#{@t_o.is.to_s}{\n\n#{@s}\n\n}#{@t_o.is.to_s}"
+ @s=@s.gsub(/(?:#{Mx[:br_nl]}|\n)+/m,"\n\n")
+ end
+ #dealing with poem and verse calls for change in dal, where start and end verse of poem are marked as such
+ @s=@s.strip
+ end
+ @s
+ end
+ def html_lite #test whether eventually can be used in db_import replacing shared_html_lite (search for SiSU_FormatShared)
+ if @t_o
+ @s=@s.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>').
+ gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>').
+ gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>').
+ gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'"\1"').
+ gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'+{\1}+').
+ gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strke_c]}/,'-{\1}-').
+ gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>').
+ gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>').
+ gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/i,'~')
+ if @t_o.is !=:code
+ if @s =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/
+ wm=@s.scan(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)|\S+/)
+ words=urls(wm)
+ @s=@s.gsub(/.+/m,words)
+ end
+ @s=@s.gsub(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;').
+ gsub(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;').
+ gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'<a href="\1" target="_top">\1</a>'). #http ftp matches escaped, no decoration
+ gsub(/(#{Mx[:lnk_c]})#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1<a href="\2" target="_top">\2</a>\3'). #special case \{ e.g. \}http://url
+ gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{@url_brace.xml_open}<a href="\\1" target="_top">\\1</a>#{@url_brace.xml_close}}) #http ftp matches with decoration
+ else
+ @s=@s.gsub(/</m,'&lt;').gsub(/>/m,'&gt;')
+ end
+ if @t_o.is==:paragraph
+ if @t_o.bullet_
+ @s=@s
+ end
+ if @t_o.indent > 0
+ @s=@s
+ end
+ end
+ if @t_o.is==:heading
+ @s=@s
+ end
+ else
+ p __FILE__ +':'+ __LINE__.to_s
+ end
+ @s
+ end
+ end
+ class ModifiedTextPlusHashDigest
+ def initialize(md,x)
+ @md=md
+ if x.is_a?(String)
+ @t_o,@s=nil,x
+ else
+ @t_o,@s=x,x.obj.dup
+ end
+ @env ||=SiSU_Env::InfoEnv.new(@md.fns)
+ @sha_ =((@env.digest.type =='sha256') ? true : false)
+ @sha_ ? (require 'digest/sha2') : (require 'digest/md5')
+ end
+ def digest(txt)
+ d=nil
+ if @sha_
+ for hash_class in [ Digest::SHA256 ]
+ d=hash_class.hexdigest(txt)
+ end
+ else
+ for hash_class in [ Digest::MD5 ]
+ d=hash_class.hexdigest(txt)
+ end
+ end
+ d
+ end
+ def strip_clean_of_markup
+ def txt
+ SiSU_TextRepresentation::Alter.new(@s).strip_clean_of_markup
+ end
+ def dgst
+ en_dgst,img_dgst={},{}
+ txt_dgst=digest(txt)
+ { txt: txt, dgst_txt: txt_dgst }
+ end
+ self
+ end
+ def semi_revert_markup
+ def txt
+ SiSU_TextRepresentation::Alter.new(@s).semi_revert_markup
+ end
+ def dgst
+ txt_dgst=digest(txt)
+ { txt: txt, dgst_txt: txt_dgst }
+ end
+ self
+ end
+ def composite
+ def stripped_clean(txt)
+ SiSU_TextRepresentation::Alter.new(txt).strip_clean_of_markup
+ end
+ def markup_reverted(txt)
+ SiSU_TextRepresentation::Alter.new(txt).semi_revert_markup
+ end
+ def images(imgs)
+ sys=SiSU_Env::SystemCall.new
+ line_image=[]
+ img_dgst={}
+ if imgs and imgs.length > 0
+ @image_name,@image_dgst,@img=[],[],[]
+ imgs.each do |i|
+ image_source=if FileTest.file?("#{@env.path.image_source_include_local}/#{i}")
+ @env.path.image_source_include_local
+ elsif FileTest.file?("#{@env.path.image_source_include_remote}/#{i}")
+ @env.path.image_source_include_remote
+ elsif FileTest.file?("#{@env.path.image_source_include}/#{i}")
+ @env.path.image_source_include
+ else
+ SiSU_Screen::Ansi.new(@md.opt.cmd,"ERROR - image:", %{"#{i}" missing}, "search locations: #{@env.path.image_source_include_local}, #{@env.path.image_source_include_remote} and #{@env.path.image_source_include}").error2 unless @md.opt.cmd =~/q/
+ nil
+ end
+ img_type = /\S+\.(png|jpg|gif)/.match(i)[1]
+ not_found_msg='image not found'
+ if image_source
+ para_image = image_source + '/' + i
+ image_name = i
+ image_dgst =(@sha_ ? sys.sha256(para_image) : sys.md5(para_image))
+ else
+ image_name = i + ' [image missing]'
+ image_dgst = ''
+ end
+ line_image << { img_dgst: image_dgst[1], img_name: image_name, img_type: img_type }
+ end
+ end
+ line_image
+ end
+ def endnotes(en)
+ en_dgst=[]
+ if en and en.length > 0
+ en.flatten.each do |e|
+ note_no=e.gsub(/^([\d*+]+)\s+.+/,'\1')
+ e=digest(stripped_clean(e))
+ note_dgst=digest(e)
+ en_dgst << { note_number: note_no, note_dgst: note_dgst }
+ end
+ end
+ en_dgst
+ end
+ def dgst
+ if @t_o.of !=:comment \
+ && @t_o.of !=:structure \
+ && @t_o.of !=:layout
+ en_dgst,img_dgst={},{}
+ txt_stripped_dgst=digest(stripped_clean(@t_o))
+ txt_markup_reverted_dgst=digest(markup_reverted(@t_o))
+ endnotes_dgst=[]
+ rgx_notes=/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})([\d*+]+\s+.+?)(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/
+ notes=@t_o.obj.scan(rgx_notes)
+ endnotes_dgst=endnotes(notes)
+ rgx_image=/#{Mx[:lnk_o]}(\S+\.(?:png|jpg|gif))\s.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/
+ imgs=if (@t_o.is==:para \
+ || @t_o.is==:image) \
+ and @t_o.obj =~rgx_image
+ imgs=@t_o.obj.scan(rgx_image).flatten
+ line_image=images(imgs)
+ end
+ dgst={ is: @t_o.is, ocn: @t_o.ocn, dgst_stripped_txt: txt_stripped_dgst, dgst_markedup_txt: txt_markup_reverted_dgst }
+ dgst[:endnotes]=endnotes_dgst if endnotes_dgst and endnotes_dgst.length > 0
+ dgst[:images]=line_image if line_image and line_image.length > 0
+ end
+ dgst
+ end
+ self
+ end
+ end
+end
+__END__
diff --git a/lib/sisu/v4/shared_metadata.rb b/lib/sisu/v4/shared_metadata.rb
new file mode 100644
index 00000000..74d76c1e
--- /dev/null
+++ b/lib/sisu/v4/shared_metadata.rb
@@ -0,0 +1,1344 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: system environment, resource control and configuration details
+
+=end
+module SiSU_Metadata
+ class Summary
+ attr_accessor :tag,:inf,:class,:attrib
+ def initialize(md,display_heading=false)
+ @md,@display_heading=md,display_heading
+ @tag,@inf,@class,@attrib=nil
+ end
+ def metadata_base
+ meta,tag=[],[]
+ dir=SiSU_Env::InfoEnv.new(@md.fns)
+ base_html="#{dir.url.root}/#{@md.fnb}"
+ l=SiSU_Env::StandardiseLanguage.new(@md.opt.lng).language
+ language=l[:n]
+ tr=SiSU_Translate::Source.new(@md,language)
+ @attrib='md'
+ if @display_heading
+ @tag,@inf=%{<b><u>Document Metadata</u></b>},''
+ meta << self.meta_para
+ end
+ if defined? @md.title.full \
+ and @md.title.full=~/\S+/
+ @tag,@inf,@class=tr.full_title,@md.title.full,'dc' #1
+ meta << self.meta_para
+ end
+ if defined? @md.creator.author \
+ and @md.creator.author=~/\S+/
+ @tag,@inf,@class=tr.author,@md.creator.author,'dc' #2
+ meta << self.meta_para
+ end
+ if defined? @md.creator.translator \
+ and @md.creator.translator=~/\S+/
+ @tag,@inf,@class=tr.translator,@md.creator.translator,'ext'
+ meta << self.meta_para
+ end
+ if defined? @md.creator.illustrator \
+ and @md.creator.illustrator=~/\S+/
+ @tag,@inf,@class=tr.illustrator,@md.creator.illustrator,'ext'
+ meta << self.meta_para
+ end
+ if defined? @md.creator.prepared_by \
+ and @md.creator.prepared_by=~/\S+/
+ @tag,@inf,@class=tr.prepared_by,@md.creator.prepared_by,'ext'
+ meta << self.meta_para
+ end
+ if defined? @md.creator.digitized_by \
+ and @md.creator.digitized_by=~/\S+/
+ @tag,@inf,@class=tr.digitized_by,@md.creator.digitized_by,'ext'
+ meta << self.meta_para
+ end
+ if defined? @md.creator.contributor \
+ and @md.creator.contributor=~/\S+/
+ @tag,@inf,@class=tr.contributor,@md.creator.contributor,'dc' #6
+ meta << self.meta_para
+ end
+ if defined? @md.rights.all \
+ and @md.rights.all=~/\S+/
+ @tag,@inf,@class=tr.rights,@md.rights.all,'dc' #15
+ meta << self.meta_para
+ end
+ if defined? @md.classify.subject \
+ and @md.classify.subject=~/\S+/
+ @tag,@inf,@class=tr.subject,@md.classify.subject,'dc' #3
+ meta << self.meta_para
+ end
+ if defined? @md.classify.keywords \
+ and @md.classify.keywords=~/\S+/
+ @tag,@inf,@class=tr.keywords,@md.classify.keywords,'ext'
+ meta << self.meta_para
+ end
+ if defined? @md.classify.loc \
+ and @md.classify.loc=~/\S+/
+ @tag,@inf,@class=tr.cls_loc,@md.classify.loc,'id'
+ meta << self.meta_para
+ end
+ if defined? @md.classify.dewey \
+ and @md.classify.dewey=~/\S+/
+ @tag,@inf,@class=tr.cls_dewey,@md.classify.dewey,'id'
+ meta << self.meta_para
+ end
+ if defined? @md.publisher \
+ and @md.publisher=~/\S+/
+ @tag,@inf,@class=tr.publisher,@md.publisher,'dc' #5
+ meta << self.meta_para
+ end
+ if defined? @md.date.created \
+ and @md.date.created=~/\S+/
+ @tag,@inf,@class=tr.date_created,@md.date.created,'dc' #7
+ meta << self.meta_para
+ end
+ if defined? @md.date.issued \
+ and @md.date.issued=~/\S+/
+ @tag,@inf,@class=tr.date_issued,@md.date.issued,'dc' #7
+ meta << self.meta_para
+ end
+ if defined? @md.date.available \
+ and @md.date.available=~/\S+/
+ @tag,@inf,@class=tr.date_available,@md.date.available,'dc' #7
+ meta << self.meta_para
+ end
+ if defined? @md.date.modified \
+ and @md.date.modified=~/\S+/
+ @tag,@inf,@class=tr.date_modified,@md.date.modified,'dc' #7
+ meta << self.meta_para
+ end
+ if defined? @md.date.valid \
+ and @md.date.valid=~/\S+/
+ @tag,@inf,@class=tr.date_valid,@md.date.valid,'dc' #7
+ meta << self.meta_para
+ end
+ if defined? @md.date.published \
+ and @md.date.published=~/\S+/
+ @tag,@inf,@class=tr.date,@md.date.published,'dc' #7
+ meta << self.meta_para
+ end
+ if defined? @md.identifier.isbn \
+ and @md.identifier.isbn=~/\S+/
+ @tag,@inf,@class=tr.cls_isbn,@md.identifier.isbn,'id'
+ meta << self.meta_para
+ end
+ if defined? @md.identifier.oclc \
+ and @md.identifier.oclc=~/\S+/
+ @tag,@inf,@class=tr.cls_oclc,@md.identifier.oclc,'id'
+ meta << self.meta_para
+ end
+ if defined? @md.notes.description \
+ and @md.notes.description=~/\S+/
+ @tag,@inf,@class=tr.description,@md.notes.description,'dc' #4
+ meta << self.meta_para
+ end
+ if defined? @md.notes.abstract \
+ and @md.notes.abstract=~/\S+/
+ @tag,@inf,@class=tr.abstract,@md.notes.abstract,'ext'
+ meta << self.meta_para
+ end
+ if defined? @md.notes.comment \
+ and @md.notes.comment=~/\S+/
+ @tag,@inf,@class=tr.comments,@md.notes.comment,'ext'
+ meta << self.meta_para
+ end
+ if defined? @md.notes.coverage \
+ and @md.notes.coverage=~/\S+/
+ @tag,@inf,@class=tr.coverage,@md.notes.coverage,'dc' #14
+ meta << self.meta_para
+ end
+ if defined? @md.notes.relation \
+ and @md.notes.relation=~/\S+/
+ @tag,@inf,@class=tr.relation,@md.notes.relation,'dc' #13
+ meta << self.meta_para
+ end
+ #if defined? @md.notes.source \
+ #and @md.notes.source=~/\S+/
+ # @tag,@inf,@class=tr.source,@md.notes.source,'dc' #11
+ # meta << self.meta_para
+ #end
+ if defined? @md.notes.history \
+ and @md.notes.history=~/\S+/
+ @tag,@inf,@class=tr.type,@md.notes.history,'dc' #8
+ meta << self.meta_para
+ end
+ if defined? @md.notes.type \
+ and @md.notes.type=~/\S+/
+ @tag,@inf,@class=tr.type,@md.notes.type,'dc' #8
+ meta << self.meta_para
+ end
+ if defined? @md.notes.format \
+ and @md.notes.format=~/\S+/
+ @tag,@inf,@class=tr.format,@md.notes.format,'dc' #9
+ meta << self.meta_para
+ end
+ if defined? @md.notes.prefix_a \
+ and @md.notes.prefix_a=~/\S+/
+ @tag,@inf,@class=tr.prefix_a,@md.notes.prefix_a,'inf'
+ meta << self.meta_para
+ end
+ if defined? @md.notes.prefix_b \
+ and @md.notes.prefix_b=~/\S+/
+ @tag,@inf,@class=tr.prefix_b,@md.notes.prefix_b,'inf'
+ meta << self.meta_para
+ end
+ if defined? @md.original.source \
+ and @md.original.source=~/\S+/
+ @tag,@inf,@class=tr.source,@md.original.source,'dc' #11
+ meta << self.meta_para
+ end
+ if defined? @md.title.language \
+ and @md.title.language=~/\S+/
+ @tag,@inf,@class=tr.language,@md.title.language,'dc' #12
+ meta << self.meta_para
+ end
+ if defined? @md.original.language \
+ and @md.original.language=~/\S+/
+ @tag,@inf,@class=tr.language_original,@md.original.language,'ext'
+ meta << self.meta_para
+ end
+ if @display_heading
+ @tag,@inf=%{<b><u>Version Information</u></b>},''
+ meta << self.meta_para
+ end
+ if defined? @md.fns \
+ and @md.fns=~/\S+/
+ @tag,@inf,@class=tr.sourcefile,@md.fns,'src'
+ meta << self.meta_para
+ end
+ if defined? @md.file_encoding \
+ and @md.file_encoding=~/\S+/
+ @tag,@inf,@class='Filetype',@md.file_encoding,'src'
+ meta << self.meta_para
+ end
+ if defined? @md.dgst \
+ and @md.dgst.is_a?(Array)
+ @tag,@inf,@class='Source Digest',"#{@md.dgst[0]} #{@md.dgst[1]}",'src'
+ meta << self.meta_para
+ end
+ if @display_heading
+ @tag,@inf=%{<b><u>Generated</u></b>},''
+ meta << self.meta_para
+ end
+ if defined? @md.sisu_version \
+ and @md.sisu_version[:version]=~/\S+/
+ v="#{tr.sisu_version}: " +
+ "#{@md.sisu_version[:project]} " +
+ "#{@md.sisu_version[:version]} " +
+ "of #{@md.sisu_version[:date_stamp]} " +
+ "(#{@md.sisu_version[:date]})"
+ @tag,@inf,@class='Generated by',v,'ver'
+ meta << self.meta_para
+ end
+ if defined? @md.ruby_version \
+ and @md.ruby_version=~/\S+/
+ @tag,@inf,@class=tr.ruby_version,@md.ruby_version,'ver'
+ meta << self.meta_para
+ end
+ if defined? @md.generated \
+ and @md.generated.is_a?(Time)
+ @tag,@inf,@class=tr.last_generated,@md.generated,'date'
+ meta << self.meta_para
+ end
+ meta
+ end
+ def processing_tags
+ def make
+ def language
+ if defined? @md.make.language \
+ and @md.make.language
+ ' :language: ' + @md.make.language.join(', ')
+ else nil
+ end
+ end
+ def headings
+ if defined? @md.make.headings \
+ and @md.make.headings
+ ' :headings: ' + @md.make.headings[0].join('; ')
+ else nil
+ end
+ end
+ def num_top
+ if defined? @md.make.num_top \
+ and @md.make.num_top
+ ' :num_top: ' + @md.make.num_top
+ else nil
+ end
+ end
+ def breaks
+ x=if defined? @md.make.breaks \
+ and @md.make.breaks
+ x=' :breaks:'
+ if @md.make.breaks[:page_break]
+ x +=' break=' + @md.make.breaks[:page_break] + ';'
+ end
+ if @md.make.breaks[:page_new]
+ x +=' new=' + @md.make.breaks[:page_new] + ';'
+ end
+ else nil
+ end
+ end
+ def emphasis
+ if defined? @md.make.emphasis \
+ and @md.make.emphasis
+ ' :emphasis: ' + @md.make.emphasis[:regx].inspect
+ else nil
+ end
+ end
+ def bold
+ if defined? @md.make.bold \
+ and @md.make.bold
+ ' :bold: ' + @md.make.bold[:regx].inspect
+ else nil
+ end
+ end
+ def italics
+ if defined? @md.make.italics \
+ and @md.make.italics
+ ' :italics: ' + @md.make.italics[:regx].inspect
+ else nil
+ end
+ end
+ def texpdf_font
+ if defined? @md.make.texpdf_font \
+ and @md.make.texpdf_font
+ ' :texpdf_font: ' + @md.make.texpdf_font.main
+ else nil
+ end
+ end
+ self
+ end
+ self
+ end
+ def metadata_tags
+ def title
+ def main
+ if defined? @md.title.main \
+ and @md.title.main
+ '@title: ' + @md.title.main
+ else '@title:'
+ end
+ end
+ def sub
+ if defined? @md.title.sub \
+ and @md.title.sub
+ ' :subtitle: ' + @md.title.sub
+ else nil
+ end
+ end
+ def edition
+ if defined? @md.title.edition \
+ and @md.title.edition
+ ' :edition: ' + @md.title.edition
+ else nil
+ end
+ end
+ def note
+ if defined? @md.title.note \
+ and @md.title.note
+ ' :note: ' + @md.title.note
+ else nil
+ end
+ end
+ def short
+ if defined? @md.title.short \
+ and @md.title.short
+ ' :short: ' + @md.title.short
+ else nil
+ end
+ end
+ def language
+ if defined? @md.title.language \
+ and @md.title.language
+ ' :language: ' + @md.title.language.join(', ')
+ else nil
+ end
+ end
+ def language_char
+ if defined? @md.title.language_char \
+ and @md.title.language_char
+ ' :language_char: ' + @md.title.language_char
+ else nil
+ end
+ end
+ self
+ end
+ def creator
+ def head
+ '@creator:'
+ end
+ def author
+ x=if defined? @md.creator.author_detail \
+ and @md.creator.author_detail
+ x=''
+ @md.creator.author_detail.each do |n|
+ x += "#{n[:the]}, #{n[:others]}; "
+ end
+ x=x.gsub(/;\s*$/,'')
+ ' :author: ' + x
+ else nil
+ end
+ end
+ def contributor
+ x=if defined? @md.creator.contributor_detail \
+ and @md.creator.contributor_detail
+ x=''
+ @md.creator.contributor_detail.each do |n|
+ x += "#{n[:the]}, #{n[:others]}; "
+ end
+ x=x.gsub(/;\s*$/,'')
+ ' :contributor: ' + x
+ else nil
+ end
+ end
+ def illustrator
+ x=if defined? @md.creator.illustrator_detail \
+ and @md.creator.illustrator_detail
+ x=''
+ @md.creator.illustrator_detail.each do |n|
+ x += "#{n[:the]}, #{n[:others]}; "
+ end
+ x=x.gsub(/;\s*$/,'')
+ ' :illustrator: ' + x
+ else nil
+ end
+ end
+ def photographer
+ x=if defined? @md.creator.photographer_detail \
+ and @md.creator.photographer_detail
+ x=''
+ @md.creator.photographer_detail.each do |n|
+ x += "#{n[:the]}, #{n[:others]}; "
+ end
+ x=x.gsub(/;\s*$/,'')
+ ' :photographer: ' + x
+ else nil
+ end
+ end
+ def translator
+ x=if defined? @md.creator.translator_detail \
+ and @md.creator.translator_detail
+ x=''
+ @md.creator.translator_detail.each do |n|
+ x += "#{n[:the]}, #{n[:others]}; "
+ end
+ x=x.gsub(/;\s*$/,'')
+ ' :translator: ' + x
+ else nil
+ end
+ end
+ def audio
+ x=if defined? @md.creator.audio_detail \
+ and @md.creator.audio_detail
+ x=''
+ @md.creator.audio_detail.each do |n|
+ x += "#{n[:the]}, #{n[:others]}; "
+ end
+ x=x.gsub(/;\s*$/,'')
+ ' :audio: ' + x
+ else nil
+ end
+ end
+ def digitized_by
+ x=if defined? @md.creator.digitized_by_detail \
+ and @md.creator.digitized_by_detail
+ x=''
+ @md.creator.digitized_by_detail.each do |n|
+ x += "#{n[:the]}, #{n[:others]}; "
+ end
+ x=x.gsub(/;\s*$/,'')
+ ' :digitized_by: ' + x
+ else nil
+ end
+ end
+ def prepared_by
+ x=if defined? @md.creator.prepared_by_detail \
+ and @md.creator.prepared_by_detail
+ x=''
+ @md.creator.prepared_by_detail.each do |n|
+ x += "#{n[:the]}, #{n[:others]}; "
+ end
+ x=x.gsub(/;\s*$/,'')
+ ' :prepared_by: ' + x
+ else nil
+ end
+ end
+ self
+ end
+ def rights
+ def head
+ '@rights:'
+ end
+ def copyright
+ def text
+ if defined? @md.rights.copyright.text \
+ and @md.rights.copyright.text
+ ' :copyright: ' + @md.rights.copyright.text
+ else nil
+ end
+ end
+ def translation
+ if defined? @md.rights.copyright.translation \
+ and @md.rights.copyright.translation
+ ' :translation: ' + @md.rights.copyright.translation
+ else nil
+ end
+ end
+ def illustrations
+ if defined? @md.rights.copyright.illustrations \
+ and @md.rights.copyright.illustrations
+ ' :illustrations: ' + @md.rights.copyright.illustrations
+ else nil
+ end
+ end
+ def photographs
+ if defined? @md.rights.copyright.photographs \
+ and @md.rights.copyright.photographs
+ ' :photographs: ' + @md.rights.copyright.photographs
+ else nil
+ end
+ end
+ def digitization
+ if defined? @md.rights.copyright.digitization \
+ and @md.rights.copyright.digitization
+ ' :digitization: ' + @md.rights.copyright.digitization
+ else nil
+ end
+ end
+ def audio
+ if defined? @md.rights.copyright.audio \
+ and @md.rights.copyright.audio
+ ' :audio: ' + @md.rights.copyright.audio
+ else nil
+ end
+ end
+ self
+ end
+ def license
+ if defined? @md.rights.license \
+ and @md.rights.license
+ ' :license: ' + @md.rights.license
+ else nil
+ end
+ end
+ self
+ end
+ def classify
+ def head
+ '@classify:'
+ end
+ def coverage
+ if defined? @md.classify.coverage \
+ and @md.classify.coverage
+ ' :coverage: ' + @md.classify.coverage
+ else nil
+ end
+ end
+ def relation
+ if defined? @md.classify.relation \
+ and @md.classify.relation
+ ' :relation: ' + @md.classify.relation
+ else nil
+ end
+ end
+ def subject
+ if defined? @md.classify.subject \
+ and @md.classify.subject
+ ' :subject: ' + @md.classify.subject
+ else nil
+ end
+ end
+ def topic_register
+ if defined? @md.classify.topic_register \
+ and @md.classify.topic_register
+ ' :topic_register: ' + @md.classify.topic_register
+ else nil
+ end
+ end
+ def type
+# if defined? @md.classify.type \
+# and @md.classify.type
+# ' :type: ' + @md.classify.type
+# else nil
+# end
+ nil
+ end
+ def identifier
+ if defined? @md.classify.identifier \
+ and @md.classify.identifier
+ ' :identifier: ' + @md.classify.identifier
+ else nil
+ end
+ end
+ def loc
+ if defined? @md.classify.loc \
+ and @md.classify.loc
+ ' :loc: ' + @md.classify.loc
+ else nil
+ end
+ end
+ def dewey
+ if defined? @md.classify.dewey \
+ and @md.classify.dewey
+ ' :dewey: ' + @md.classify.dewey
+ else nil
+ end
+ end
+ def oclc
+ if defined? @md.classify.oclc \
+ and @md.classify.oclc
+ ' :oclc: ' + @md.classify.oclc
+ else nil
+ end
+ end
+ def pg
+ if defined? @md.classify.pg \
+ and @md.classify.pg
+ ' :pg: ' + @md.classify.pg
+ else nil
+ end
+ end
+ def isbn
+ if defined? @md.classify.isbn \
+ and @md.classify.isbn
+ ' :isbn: ' + @md.classify.isbn
+ else nil
+ end
+ end
+ self
+ end
+ def date
+ def head
+ '@date:'
+ end
+ def added_to_site
+ if defined? @md.date.added_to_site \
+ and @md.date.added_to_site
+ ' :added_to_site: ' + @md.date.added_to_site
+ else nil
+ end
+ end
+ def available
+ if defined? @md.date.available \
+ and @md.date.available
+ ' :available: ' + @md.date.available
+ else nil
+ end
+ end
+ def created
+ if defined? @md.date.created \
+ and @md.date.created
+ ' :created: ' + @md.date.created
+ else nil
+ end
+ end
+ def issued
+ if defined? @md.date.issued \
+ and @md.date.issued
+ ' :issued: ' + @md.date.issued
+ else nil
+ end
+ end
+ def modified
+ if defined? @md.date.modified \
+ and @md.date.modified
+ ' :modified: ' + @md.date.modified
+ else nil
+ end
+ end
+ def published
+ if defined? @md.date.published \
+ and @md.date.published
+ ' :published: ' + @md.date.published
+ else nil
+ end
+ end
+ def valid
+ if defined? @md.date.valid \
+ and @md.date.valid
+ ' :valid: ' + @md.date.valid
+ else nil
+ end
+ end
+ self
+ end
+ #def make
+ # def headings
+ # @md.make.headings \
+ # ? (' :headings: ' + @md.make.headings) \
+ # : nil
+ # end
+ #end
+ self
+ end
+ def char_enc(str)
+ @s=str
+ def utf8
+ if @s \
+ and @s.is_a?(String)
+ @s=@s.gsub(/<br(?: \/)?>/u,Mx[:br_paragraph]).
+ gsub(/</um,'&#60;'). # '&lt;' # &#060;
+ gsub(/</um,'&#60;'). # '&lt;' # &#060;
+ gsub(/>/um,'&#62;'). # '&gt;' # &#062;
+ gsub(/¢/um,'&#162;'). # '&cent;' # &#162;
+ gsub(/£/um,'&#163;'). # '&pound;' # &#163;
+ gsub(/¥/um,'&#165;'). # '&yen;' # &#165;
+ gsub(/§/um,'&#167;'). # '&sect;' # &#167;
+ gsub(/©/um,'&#169;'). # '&copy;' # &#169;
+ gsub(/ª/um,'&#170;'). # '&ordf;' # &#170;
+ gsub(/«/um,'&#171;'). # '&laquo;' # &#171;
+ gsub(/®/um,'&#174;'). # '&reg;' # &#174;
+ gsub(/°/um,'&#176;'). # '&deg;' # &#176;
+ gsub(/±/um,'&#177;'). # '&plusmn;' # &#177;
+ gsub(/²/um,'&#178;'). # '&sup2;' # &#178;
+ gsub(/³/um,'&#179;'). # '&sup3;' # &#179;
+ gsub(/µ/um,'&#181;'). # '&micro;' # &#181;
+ gsub(/¶/um,'&#182;'). # '&para;' # &#182;
+ gsub(/¹/um,'&#185;'). # '&sup1;' # &#185;
+ gsub(/º/um,'&#186;'). # '&ordm;' # &#186;
+ gsub(/»/um,'&#187;'). # '&raquo;' # &#187;
+ gsub(/¼/um,'&#188;'). # '&frac14;' # &#188;
+ gsub(/½/um,'&#189;'). # '&frac12;' # &#189;
+ gsub(/¾/um,'&#190;'). # '&frac34;' # &#190;
+ gsub(/×/um,'&#215;'). # '&times;' # &#215;
+ gsub(/÷/um,'&#247;'). # '&divide;' # &#247;
+ gsub(/¿/um,'&#191;'). # '&iquest;' # &#191;
+ gsub(/À/um,'&#192;'). # '&Agrave;' # &#192;
+ gsub(/Á/um,'&#193;'). # '&Aacute;' # &#193;
+ gsub(/Â/um,'&#194;'). # '&Acirc;' # &#194;
+ gsub(/Ã/um,'&#195;'). # '&Atilde;' # &#195;
+ gsub(/Ä/um,'&#196;'). # '&Auml;' # &#196;
+ gsub(/Å/um,'&#197;'). # '&Aring;' # &#197;
+ gsub(/Æ/um,'&#198;'). # '&AElig;' # &#198;
+ gsub(/Ç/um,'&#199;'). # '&Ccedil;' # &#199;
+ gsub(/È/um,'&#200;'). # '&Egrave;' # &#200;
+ gsub(/É/um,'&#201;'). # '&Eacute;' # &#201;
+ gsub(/Ê/um,'&#202;'). # '&Ecirc;' # &#202;
+ gsub(/Ë/um,'&#203;'). # '&Euml;' # &#203;
+ gsub(/Ì/um,'&#204;'). # '&Igrave;' # &#204;
+ gsub(/Í/um,'&#205;'). # '&Iacute;' # &#205;
+ gsub(/Î/um,'&#206;'). # '&Icirc;' # &#206;
+ gsub(/Ï/um,'&#207;'). # '&Iuml;' # &#207;
+ gsub(/Ð/um,'&#208;'). # '&ETH;' # &#208;
+ gsub(/Ñ/um,'&#209;'). # '&Ntilde;' # &#209;
+ gsub(/Ò/um,'&#210;'). # '&Ograve;' # &#210;
+ gsub(/Ó/um,'&#211;'). # '&Oacute;' # &#211;
+ gsub(/Ô/um,'&#212;'). # '&Ocirc;' # &#212;
+ gsub(/Õ/um,'&#213;'). # '&Otilde;' # &#213;
+ gsub(/Ö/um,'&#214;'). # '&Ouml;' # &#214;
+ gsub(/Ø/um,'&#216;'). # '&Oslash;' # &#216;
+ gsub(/Ù/um,'&#217;'). # '&Ugrave;' # &#217;
+ gsub(/Ú/um,'&#218;'). # '&Uacute;' # &#218;
+ gsub(/Û/um,'&#219;'). # '&Ucirc;' # &#219;
+ gsub(/Ü/um,'&#220;'). # '&Uuml;' # &#220;
+ gsub(/Ý/um,'&#221;'). # '&Yacute;' # &#221;
+ gsub(/Þ/um,'&#222;'). # '&THORN;' # &#222;
+ gsub(/ß/um,'&#223;'). # '&szlig;' # &#223;
+ gsub(/à/um,'&#224;'). # '&agrave;' # &#224;
+ gsub(/á/um,'&#225;'). # '&aacute;' # &#225;
+ gsub(/â/um,'&#226;'). # '&acirc;' # &#226;
+ gsub(/ã/um,'&#227;'). # '&atilde;' # &#227;
+ gsub(/ä/um,'&#228;'). # '&auml;' # &#228;
+ gsub(/å/um,'&#229;'). # '&aring;' # &#229;
+ gsub(/æ/um,'&#230;'). # '&aelig;' # &#230;
+ gsub(/ç/um,'&#231;'). # '&ccedil;' # &#231;
+ gsub(/è/um,'&#232;'). # '&egrave;' # &#232;
+ gsub(/é/um,'&#233;'). # '&acute;' # &#233;
+ gsub(/ê/um,'&#234;'). # '&circ;' # &#234;
+ gsub(/ë/um,'&#235;'). # '&euml;' # &#235;
+ gsub(/ì/um,'&#236;'). # '&igrave;' # &#236;
+ gsub(/í/um,'&#237;'). # '&acute;' # &#237;
+ gsub(/î/um,'&#238;'). # '&icirc;' # &#238;
+ gsub(/ï/um,'&#239;'). # '&iuml;' # &#239;
+ gsub(/ð/um,'&#240;'). # '&eth;' # &#240;
+ gsub(/ñ/um,'&#241;'). # '&ntilde;' # &#241;
+ gsub(/ò/um,'&#242;'). # '&ograve;' # &#242;
+ gsub(/ó/um,'&#243;'). # '&oacute;' # &#243;
+ gsub(/ô/um,'&#244;'). # '&ocirc;' # &#244;
+ gsub(/õ/um,'&#245;'). # '&otilde;' # &#245;
+ gsub(/ö/um,'&#246;'). # '&ouml;' # &#246;
+ gsub(/ø/um,'&#248;'). # '&oslash;' # &#248;
+ gsub(/ù/um,'&#250;'). # '&ugrave;' # &#250;
+ gsub(/ú/um,'&#251;'). # '&uacute;' # &#251;
+ gsub(/û/um,'&#252;'). # '&ucirc;' # &#252;
+ gsub(/ü/um,'&#253;'). # '&uuml;' # &#253;
+ gsub(/þ/um,'&#254;'). # '&thorn;' # &#254;
+ gsub(/ÿ/um,'&#255;'). # '&yuml;' # &#255;
+ gsub(/‘/um,'&#8216;'). # '&lsquo;' # &#8216;
+ gsub(/’/um,'&#8217;'). # '&rsquo;' # &#8217;
+ gsub(/“/um,'&#8220;'). # &ldquo; # &#8220;
+ gsub(/”/um,'&#8221;'). # &rdquo; # &#8221;
+ gsub(/–/um,'&#8211;'). # &ndash; # &#8211;
+ gsub(/—/um,'&#8212;'). # &mdash; # &#8212;
+ gsub(/∝/um,'&#8733;'). # &prop; # &#8733;
+ gsub(/∞/um,'&#8734;'). # &infin; # &#8734;
+ gsub(/™/um,'&#8482;'). # &trade; # &#8482;
+ gsub(/✠/um,'&#10016;'). # &cross; # &#10016;
+ gsub(/ /um,' '). # space identify
+ gsub(/ /um,' '). # space identify
+ gsub(/#{Mx[:br_paragraph]}/u,'<br />')
+ end
+ @s
+ end
+ self
+ end
+ def xml_sax
+ def meta_para
+ inf_xml=char_enc(@inf).utf8
+ <<WOK
+<metadata>
+#{Ax[:tab]}<meta>#{@tag.capitalize}:</meta>
+#{Ax[:tab]}<data class="#{@attrib}">
+#{Ax[:tab]*2}#{inf_xml}
+#{Ax[:tab]}</data>
+</metadata>
+WOK
+ end
+ def metadata
+ SiSU_Metadata::Summary.new(@md).metadata_base
+ end
+ self
+ end
+ def xml_dom
+ def meta_para
+ inf_xml=char_enc(@inf).utf8
+ <<WOK
+#{Ax[:tab]}<header>
+#{Ax[:tab]*2}<meta>#{@tag.capitalize}:</meta>
+#{Ax[:tab]*2}<#{@attrib}>
+#{Ax[:tab]*3}#{inf_xml}
+#{Ax[:tab]*2}</#{@attrib}>
+#{Ax[:tab]}</header>
+WOK
+ end
+ def metadata
+ SiSU_Metadata::Summary.new(@md).metadata_base
+ end
+ self
+ end
+ def xhtml_scroll
+ def meta_para
+ inf_xml=char_enc(@inf).utf8
+ <<WOK
+#{Ax[:tab]}<metadata>
+#{Ax[:tab]}<meta>#{@tag.capitalize}:</meta>
+#{Ax[:tab]}<#{@attrib} class="#{@class}">
+#{Ax[:tab]*2}#{inf_xml}
+#{Ax[:tab]}</#{@attrib}>
+#{Ax[:tab]}</metadata>
+ <br />
+WOK
+ end
+ def metadata
+ SiSU_Metadata::Summary.new(@md).metadata_base
+ end
+ self
+ end
+ def xhtml_display
+ def meta_para
+ inf_xml=char_enc(@inf).utf8
+ %{<p class="norm">
+ <b>#{@tag}</b>: #{inf_xml}
+</p>}
+ end
+ def metadata
+ SiSU_Metadata::Summary.new(@md,true).metadata_base
+ end
+ self
+ end
+ def odf
+ def meta_para
+ url_brace=SiSU_Viz::Defaults.new.url_decoration
+ if @inf.is_a?(String)
+ @inf=@inf.gsub(/</,'&lt;').gsub(/>/,'&gt;').
+ gsub(/&lt;br(?: \/)?&gt;/,'<br />')
+ if @inf =~/&/
+ inf_array=[]
+ word=@inf.scan(/\S+|\n/)
+ word.each do |w| # _ - / # | : ! ^ ~
+ w=w.gsub(/&nbsp;/,'&#160;')
+ if w !~/&\S{2,7}?;/
+ w=w.gsub(/&/,'&amp;')
+ end
+ inf_array << w
+ end
+ @inf=inf_array.join(' ')
+ end
+ @inf=@inf.gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,
+ '<text:a xlink:type="simple" xlink:href="\1">\1</text:a>'). #http ftp matches escaped, no decoration
+ gsub(/(#{Mx[:lnk_c]})#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
+ '\1<text:a xlink:type="simple" xlink:href="\2">\2</text:a>') #special case \{ e.g. \}http://url
+ @inf=if @inf =~/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/
+ @inf.gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
+ %{#{url_brace.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{url_brace.xml_close}}) #http ftp matches with decoration
+ else
+ @inf.gsub(/(https?:\/\/[^<>()'"\s]+)/,
+ %{#{url_brace.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{url_brace.xml_close}}) #http ftp matches with decoration
+ end
+ @inf=@inf.gsub(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+)/,
+ %{#{url_brace.xml_open}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{url_brace.xml_close}}) if @inf !~/http:\/\// # improve upon, document crash where url contains '@' symbol
+ end
+ <<WOK
+<text:p text:style-name="P1">#{@tag.capitalize}: #{@inf}</text:p>
+WOK
+ end
+ def metadata
+ SiSU_Metadata::Summary.new(@md).metadata_base
+ end
+ self
+ end
+ def plaintext
+ def meta_para
+ <<WOK
+
+#{@tag.capitalize}: #{@inf}
+WOK
+ end
+ def metadata
+ SiSU_Metadata::Summary.new(@md).metadata_base
+ end
+ self
+ end
+ def manpage
+ def meta_para
+ <<WOK
+
+.TP
+#{@tag.capitalize}:
+.I #{@inf}
+WOK
+ end
+ def metadata
+ SiSU_Metadata::Summary.new(@md).metadata_base
+ end
+ self
+ end
+ end
+ class TeX_Metadata
+ def initialize(md)
+ @md=md
+ @br="\\\\\n"
+ end
+ def meta_para(tag,inf,sc=true)
+ inf=((inf.is_a?(String) && sc) ? spec_char(inf) : inf)
+ %{\\begin\{bfseries\}#{tag}:\\end\{bfseries\} #{inf}
+}
+ end
+ def spec_char(inf)
+ SiSU_TeX_Pdf::SpecialCharacters.new(@md,inf).special_characters
+ end
+ def word_break_points(inf)
+ SiSU_TeX_Pdf::SpecialCharacters.new(@md,inf).special_word_break_points
+ end
+ def number_break_points(inf)
+ SiSU_TeX_Pdf::SpecialCharacters.new(@md,inf).special_number_break_points
+ end
+ def metadata_tex
+ meta=[]
+ dir=SiSU_Env::InfoEnv.new(@md.fns)
+ base_html="#{dir.url.root}/#{@md.fnb}"
+ l=SiSU_Env::StandardiseLanguage.new(@md.opt.lng).language
+ language=l[:n]
+ tr=SiSU_Translate::Source.new(@md,language)
+ tag="Document Manifest @"
+ inf="#{@br}#{@md.file.output_path.manifest.url}/#{@md.file.base_filename.manifest}"
+ meta << meta_para(tag,inf)
+ if defined? @md.title.full \
+ and @md.title.full=~/\S+/
+ tag,inf=tr.full_title,@md.title.full
+ meta << meta_para(tag,inf)
+ end
+ if defined? @md.creator.author \
+ and @md.creator.author=~/\S+/
+ tag,inf=tr.author,@md.creator.author
+ meta << meta_para(tag,inf)
+ end
+ if defined? @md.creator.translator \
+ and @md.creator.translator=~/\S+/
+ tag,inf=tr.translator,@md.creator.translator
+ meta << meta_para(tag,inf)
+ end
+ if defined? @md.creator.illustrator \
+ and @md.creator.illustrator=~/\S+/
+ tag,inf=tr.illustrator,@md.creator.illustrator
+ meta << meta_para(tag,inf)
+ end
+ if defined? @md.creator.prepared_by \
+ and @md.creator.prepared_by=~/\S+/
+ tag,inf=tr.prepared_by,@md.creator.prepared_by
+ meta << meta_para(tag,inf)
+ end
+ if defined? @md.creator.digitized_by \
+ and @md.creator.digitized_by=~/\S+/
+ tag,inf=tr.digitized_by,@md.creator.digitized_by
+ meta << meta_para(tag,inf)
+ end
+ if defined? @md.rights.all \
+ and @md.rights.all=~/\S+/
+ tag,inf=tr.rights,@md.rights.all
+ meta << meta_para(tag,inf)
+ end
+ if defined? @md.notes.description \
+ and @md.notes.description=~/\S+/
+ tag,inf=tr.description,@md.notes.description
+ meta << meta_para(tag,inf)
+ end
+ if defined? @md.classify.subject \
+ and @md.classify.subject=~/\S+/
+ tag,inf=tr.subject,@md.classify.subject
+ meta << meta_para(tag,inf)
+ end
+ if defined? @md.publisher \
+ and @md.publisher=~/\S+/
+ tag,inf=tr.publisher,@md.publisher
+ meta << meta_para(tag,inf)
+ end
+ if defined? @md.creator.contributor \
+ and @md.creator.contributor=~/\S+/
+ tag,inf=tr.contributor,@md.creator.contributor
+ meta << meta_para(tag,inf)
+ end
+ if defined? @md.notes.abstract \
+ and @md.notes.abstract=~/\S+/
+ tag,inf=tr.abstract,@md.notes.abstract
+ meta << meta_para(tag,inf)
+ end
+ if defined? @md.date.created \
+ and @md.date.created=~/\S+/
+ tag,inf=tr.date_created,@md.date.created
+ meta << meta_para(tag,inf)
+ end
+ if defined? @md.date.issued \
+ and @md.date.issued=~/\S+/
+ tag,inf=tr.date_issued,@md.date.issued
+ meta << meta_para(tag,inf)
+ end
+ if defined? @md.date.available \
+ and @md.date.available=~/\S+/
+ tag,inf=tr.date_available,@md.date.available
+ meta << meta_para(tag,inf)
+ end
+ if defined? @md.date.modified \
+ and @md.date.modified=~/\S+/
+ tag,inf=tr.date_modified,@md.date.modified
+ meta << meta_para(tag,inf)
+ end
+ if defined? @md.date.valid \
+ and @md.date.valid=~/\S+/
+ tag,inf=tr.date_valid,@md.date.valid
+ meta << meta_para(tag,inf)
+ end
+ if defined? @md.date.published \
+ and @md.date.published=~/\S+/
+ tag,inf=tr.date,@md.date.published
+ meta << meta_para(tag,inf)
+ end
+ if defined? @md.classify.topic_register \
+ and @md.classify.topic_register=~/\S+/
+ tag,inf=tr.topic_register,@md.classify.topic_register
+ inf=word_break_points(inf)
+ meta << meta_para(tag,inf)
+ end
+ if defined? @md.classify.loc \
+ and @md.classify.loc=~/\S+/
+ tag,inf=tr.cls_loc,@md.classify.loc
+ meta << meta_para(tag,inf)
+ end
+ if defined? @md.classify.dewey \
+ and @md.classify.dewey=~/\S+/
+ tag,inf=tr.cls_dewey,@md.classify.dewey
+ meta << meta_para(tag,inf)
+ end
+ if defined? @md.classify.oclc \
+ and @md.classify.oclc=~/\S+/
+ tag,inf=tr.cls_oclc,@md.classify.oclc
+ meta << meta_para(tag,inf)
+ end
+ if defined? @md.classify.pg \
+ and @md.classify.pg=~/\S+/
+ tag,inf=tr.cls_gutenberg,@md.classify.pg
+ meta << meta_para(tag,inf)
+ end
+ if defined? @md.classify.isbn \
+ and @md.classify.isbn=~/\S+/
+ tag,inf=tr.cls_isbn,@md.classify.isbn
+ meta << meta_para(tag,inf)
+ end
+ if defined? @md.notes.comment \
+ and @md.notes.comment=~/\S+/
+ tag,inf=tr.comments,@md.notes.comment
+ meta << meta_para(tag,inf)
+ end
+ if defined? @md.notes.prefix_a \
+ and @md.notes.prefix_a=~/\S+/
+ tag,inf=tr.prefix_a,@md.notes.prefix_a
+ meta << meta_para(tag,inf)
+ end
+ if defined? @md.notes.prefix_b \
+ and @md.notes.prefix_b=~/\S+/
+ tag,inf=tr.prefix_b,@md.notes.prefix_b
+ meta << meta_para(tag,inf)
+ end
+ if defined? @md.classify.identifier \
+ and @md.classify.identifier=~/\S+/
+ tag,inf=tr.identifier,@md.classify.identifier
+ meta << meta_para(tag,inf)
+ end
+ if defined? @md.original.source \
+ and @md.original.source=~/\S+/
+ tag,inf=tr.source,@md.original.source
+ meta << meta_para(tag,inf)
+ end
+ if defined? @md.title.language \
+ and @md.title.language=~/\S+/
+ tag,inf=tr.language,@md.title.language
+ meta << meta_para(tag,inf)
+ end
+ if defined? @md.original.language \
+ and @md.original.language=~/\S+/
+ tag,inf=tr.language_original,@md.original.language
+ meta << meta_para(tag,inf)
+ end
+ if defined? @md.classify.format \
+ and @md.classify.format=~/\S+/
+ tag,inf=tr.format,@md.classify.format
+ meta << meta_para(tag,inf)
+ end
+ if defined? @md.classify.relation \
+ and @md.classify.relation=~/\S+/
+ tag,inf=tr.relation,@md.classify.relation
+ meta << meta_para(tag,inf)
+ end
+ if defined? @md.classify.coverage \
+ and @md.classify.coverage=~/\S+/
+ tag,inf=tr.coverage,@md.classify.coverage
+ meta << meta_para(tag,inf)
+ end
+ if defined? @md.classify.keywords \
+ and @md.classify.keywords=~/\S+/
+ tag,inf=tr.keywords,@md.classify.keywords
+ meta << meta_para(tag,inf)
+ end
+ meta << %{#{@br}\\begin\{bfseries\}Version Information \\end\{bfseries\}}
+ if defined? @md.fns \
+ and @md.fns=~/\S+/
+ fn=spec_char(@md.fns)
+ fn=word_break_points(fn)
+ fn="\\begin\{footnotesize\}#{fn}\\end\{footnotesize\}"
+ tag,inf=tr.sourcefile,fn
+ meta << meta_para(tag,inf,false)
+ end
+ if defined? @md.file_encoding \
+ and @md.file_encoding=~/\S+/
+ tag,inf='Filetype',@md.file_encoding
+ meta << meta_para(tag,inf)
+ end
+ if defined? @md.dgst \
+ and @md.dgst.is_a?(Array)
+ hash_of=spec_char(@md.dgst[0])
+ hash_of=word_break_points(hash_of)
+ dgst=number_break_points(@md.dgst[1])
+ tag,inf='Source Digest',"\\begin\{footnotesize\}#{hash_of}\\end\{footnotesize\}\\-\\begin\{scriptsize\}#{dgst}\\end\{scriptsize\}"
+ meta << meta_para(tag,inf,false)
+ end
+ meta << %{#{@br}\\begin\{bfseries\}Generated \\end\{bfseries\}}
+ if defined? @md.generated \
+ and @md.generated.is_a?(Time)
+ tag,inf=tr.last_generated,@md.generated
+ meta << meta_para(tag,inf)
+ end
+ if defined? @md.sisu_version \
+ and @md.sisu_version[:version]=~/\S+/
+ tag=tr.sisu_version
+ inf="#{@md.sisu_version[:project]} " +
+ "#{@md.sisu_version[:version]} " +
+ "of #{@md.sisu_version[:date_stamp]} " +
+ "(#{@md.sisu_version[:date]})"
+ meta << meta_para(tag,inf)
+ end
+ if defined? @md.ruby_version \
+ and @md.ruby_version=~/\S+/
+ tag,inf=tr.ruby_version,@md.ruby_version
+ meta << meta_para(tag,inf)
+ end
+ meta
+ end
+ end
+end
+__END__
+if @md.title
+ x=[
+ @md.title.main,
+ @md.title.sub,
+ @md.title.edition,
+ @md.title.note,
+ @md.title.short,
+ @md.title.full,
+ @md.title.language,
+ @md.title.language_char
+ ]
+ x.each {|y| p y if y}
+end
+if @md.creator
+ x=[
+ @md.creator.author,
+ @md.creator.author_detail,
+ @md.creator.contributor,
+ @md.creator.contributor_detail,
+ @md.creator.illustrator,
+ @md.creator.illustrator_detail,
+ @md.creator.photographer,
+ @md.creator.photographer_detail,
+ @md.creator.translator,
+ @md.creator.translator_detail,
+ @md.creator.audio,
+ @md.creator.audio_detail,
+ @md.creator.digitized_by,
+ @md.creator.digitized_by_detail,
+ @md.creator.prepared_by,
+ @md.creator.prepared_by_detail
+ ]
+ x.each {|y| p y if y}
+end
+if @md.rights
+ x=[
+ @md.rights.copyright.text,
+ @md.rights.copyright.translation,
+ @md.rights.copyright.illustrations,
+ @md.rights.copyright.photographs,
+ @md.rights.copyright.digitization,
+ @md.rights.copyright.audio,
+ @md.rights.license,
+ @md.rights.all
+ ]
+ x.each {|y| p y if y}
+end
+if @md.classify
+ x=[
+ @md.classify.coverage,
+ @md.classify.relation,
+ @md.classify.subject,
+ @md.classify.topic_register,
+ @md.classify.type,
+ @md.classify.identifier,
+ @md.classify.loc,
+ @md.classify.dewey,
+ @md.classify.oclc,
+ @md.classify.pg,
+ @md.classify.isbn,
+ ]
+ x.each {|y| p y if y}
+end
+if @md.date
+ x=[
+ @md.date.added_to_site,
+ @md.date.available,
+ @md.date.created,
+ @md.date.issued,
+ @md.date.modified,
+ @md.date.published,
+ @md.date.valid
+ ]
+ x.each {|y| p y if y}
+end
+#if @md.language
+# p @md.language.document
+# p @md.language.document_char
+# p @md.language.original
+# p @md.language.original_char
+#end
+if @md.make
+ x=[
+ @md.make.headings,
+ @md.make.num_top,
+ @md.make.breaks,
+ @md.make.bold,
+ @md.make.italics,
+ @md.make.emphasis,
+ @md.make.plaintext_wrap,
+ @md.make.texpdf_font,
+ @md.make.promo,
+ @md.make.ad,
+ @md.make.manpage
+ ]
+ x.each {|y| p y if y}
+end
+if @md.current_publisher # @md.publisher
+ x=[
+ @md.current_publisher
+ ]
+ x.each {|y| p y if y}
+end
+if @md.original
+ x=[
+ @md.original.publisher,
+ @md.original.language,
+ @md.original.language_char,
+ @md.original.source,
+ @md.original.institution,
+ @md.original.nationality
+ ]
+ x.each {|y| p y if y}
+end
+if @md.notes
+ x=[
+ @md.notes.abstract,
+ @md.notes.comment,
+ @md.notes.description,
+ @md.notes.history,
+ @md.notes.prefix
+ ]
+ x.each {|y| p y if y}
+end
diff --git a/lib/sisu/v2/shared_sem.rb b/lib/sisu/v4/shared_sem.rb
index 4ffae2f5..1fa919c2 100644
--- a/lib/sisu/v2/shared_sem.rb
+++ b/lib/sisu/v4/shared_sem.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -8,7 +8,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -32,11 +33,9 @@
If you have Internet connection, the latest version of the GPL should be
available at these locations:
<http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/copyleft/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -48,7 +47,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -57,8 +56,8 @@
** Description: system environment, resource control and configuration details
=end
-module SiSU_sem
- require "#{SiSU_lib}/param" # param.rb
+module SiSU_Sem
+ require_relative 'param' # param.rb
class Tags
def initialize(para,md)
@para,@md=para,md
@@ -105,11 +104,13 @@ module SiSU_sem
puts matched[0] unless matched[0].nil?
end
def if_pair_c
- if @para=~/([a-z](?:[a-z_:.]+?[a-z])?)+(?::\{(.+?)\}:\1)/m; puts "#{$1}:{ #{$2} }:#{$1}"
+ if @para=~/([a-z](?:[a-z_:.]+?[a-z])?)+(?::\{(.+?)\}:\1)/m
+ puts "#{$1}:{ #{$2} }:#{$1}"
end
end
def if_pair_sc
- if @para=~/;\{\s*(.+?)\s*\};([a-z]+(?:[_:.][a-z]+)*)/; puts ";{ #{$1} };#{$2}"
+ if @para=~/;\{\s*(.+?)\s*\};([a-z]+(?:[_:.][a-z]+)*)/
+ puts ";{ #{$1} };#{$2}"
end
end
def match_pair_c
@@ -137,7 +138,8 @@ module SiSU_sem
def sem_marker_added_extra_parts
unless @para =~ rgx.exclude
@para.gsub!(rgx.whole_csc_ae,'')
- if @para =~rgx.each_csc_ae; puts "WARNING semantic taggin error: #{@para}"
+ if @para =~rgx.each_csc_ae
+ STDERR.puts "WARNING semantic tagging error: #{@para}"
end
end
@para
diff --git a/lib/sisu/v4/shared_sisupod_source.rb b/lib/sisu/v4/shared_sisupod_source.rb
new file mode 100644
index 00000000..38213858
--- /dev/null
+++ b/lib/sisu/v4/shared_sisupod_source.rb
@@ -0,0 +1,305 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: create sisupod filetype and copy it to output directory!
+
+=end
+module SiSU_Source
+ include SiSU_Env
+ class SiSUpodSource
+ require_relative 'sysenv' # sysenv.rb
+ require_relative 'particulars' # particulars.rb
+ def initialize(opt,build=nil,place=nil)
+ @opt=opt
+ m=/.+\/(?:src\/)?(\S+)/im
+ @date=SiSU_Env::InfoDate.new.dt
+ @env=SiSU_Env::InfoEnv.new(@opt.fns)
+ @ver=SiSU_Env::InfoVersion.instance.get_version
+ @v=(@opt.cmd =~/[VM]/) ? 'v' : ''
+ @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)
+ @file=@particulars.file
+ @local_path="#{@file.output_path.sisupod.dir}"
+ processing_sisupod=@env.processing_path.processing_sisupod(@opt)
+ processing_sisupod.make
+ path_pod=processing_sisupod.paths[:sisupod]
+ path_pod_fnb=processing_sisupod.paths[:fnb]
+ FileUtils::mkdir_p(path_pod) unless FileTest.directory?(path_pod)
+ @path_pod={
+ fnb: path_pod_fnb,
+ pod: path_pod,
+ doc: path_pod + '/' + Gt[:doc] + '/' + @opt.lng,
+ po: path_pod + '/' + Gt[:po] + '/' + @opt.lng,
+ pot: path_pod + '/' + Gt[:pot],
+ conf: path_pod + '/' + Gt[:conf],
+ image: path_pod + '/' + Gt[:image],
+ audio: path_pod + '/' + Gt[:audio],
+ video: path_pod + '/' + Gt[:video],
+ }
+ end
+ def read
+ unless @opt.cmd =~/q/
+ @opt.cmd=~/[MVv]/ \
+ ? SiSU_Screen::Ansi.new(@opt.cmd,'Assemble SiSU source',"[#{@opt.f_pth[:lng_is]}] #{@opt.fno}").green_hi_blue
+ : ''
+ end
+ unless @opt.fns.empty?
+ directories
+ pod_source_build #this needs to be built in case of multi-lingual for all of them, before single pass tar
+ end
+ end
+ def directories
+ SiSU_Env::InfoEnv.new.sisupod_v4(@opt)
+ end
+ def images_extract(f,images) # consider using param info
+ rgx_image=/(?:^|[^_\\])\{(?:\s*|\~\^\s+)(\S+?\.(?:png|jpg|gif)\b)/m
+ if f !~/^%+\s/ \
+ and f =~rgx_image
+ images << f.scan(rgx_image).uniq
+ end
+ images.flatten
+ end
+ def pod_source_build
+ @pwd=Dir.pwd
+ @rgx_rb_image=/["']\S*?([a-zA-Z0-9_-]+?\.(?:png|jpg|gif))["']/
+ @rgx_image=/(?:^|[^_\\])\{\s*(\S+?\.(?:png|jpg|gif))/
+ @rgx_doc_import=/^<<\s*(\S+?\.ss[ti])/
+ file_array=IO.readlines(@opt.fno,'')
+ images,doc_import=[],[]
+ doc_import_dir=@opt.sub_location
+ file_array.each do |f| #% work area
+ if f !~/^%+\s/
+ f=f.gsub(/<:=(\S+?)>/,'{ c_\1.png 14x14 }image') # embedded symbol (image)
+ if f !~/^%+\s/ \
+ and f =~@rgx_image
+ images=images_extract(f,images)
+ end
+ if @opt.fno =~/\.ssm$/
+ doc_import << f.scan(@rgx_doc_import) if f =~@rgx_doc_import
+ end
+ end
+ end
+ if doc_import.length > 0
+ doc_import=doc_import.uniq.flatten
+ doc_import.each do |fn|
+ file_array=IO.readlines(fn,'')
+ file_array.each do |f| #% work area
+ if f !~/^%+\s/ \
+ and f =~@rgx_image
+ images=images_extract(f,images)
+ end
+ end
+ end
+ end
+ gi=SiSU_Env::GetInit.new
+ unless FileTest.file?("#{@path_pod[:conf]}/#{gi.makefile_name}")
+ if gi.makefile \
+ && FileTest.file?(gi.makefile)
+ FileUtils::mkdir_p(@path_pod[:conf]) unless FileTest.directory?(@path_pod[:conf])
+ FileUtils::cp(gi.makefile,"#{@path_pod[:conf]}/#{gi.makefile_name}")
+ end
+ #get images from makefile, consider placing in param
+ end
+ if images \
+ and images.length > 1
+ images=images.flatten.uniq
+ images.delete_if {|x| x =~/https?:\/\// }
+ #images=images.sort
+ FileUtils::mkdir_p(@path_pod[:image])
+ #unattractive hard coding ... !
+ image_path='_sisu/image'
+ images_pwd="#{@opt.base_path}/#{image_path}"
+ ##sequence copies base images, defaults used in all html outputs
+ #image_source_base='/usr/share/sisu/image'
+ #dir_pwd=Dir.pwd
+ #Dir.chdir(image_source_base)
+ #base_images=Dir.glob('*')
+ #base_images.each do |i|
+ # FileUtils::cp_r(i,"#{images_path_pod}/#{i}")
+ #end
+ #Dir.chdir(dir_pwd)
+ if FileTest.directory?(images_pwd)
+ images=images.uniq
+ images.each do |i|
+ if FileTest.file?("#{images_pwd}/#{i}")
+ FileUtils::cp("#{images_pwd}/#{i}","#{@path_pod[:image]}/#{i}")
+ else STDERR.puts %{\t*WARN* did not find image - "#{images_pwd}/#{i}" [#{__FILE__}:#{__LINE__}]}
+ end
+ end
+ else STDERR.puts %{\t*WARN* did not find - #{images_pwd} #{@path_pod[:image]} [#{__FILE__}:#{__LINE__}]}
+ end
+ end
+ if doc_import.length > 0 \
+ and @opt.fno =~/\.ssm$/
+ doc_import.each do |f|
+ if FileTest.file?("#{@opt.base_path}#{doc_import_dir}/#{f}")
+ FileUtils::cp("#{@opt.base_path}#{doc_import_dir}/#{f}","#{@path_pod[:doc]}/#{f}")
+ else STDERR.puts %{\t*WARN* did not find image - "#{@opt.base_path}#{doc_import_dir}/#{f}" [#{__FILE__}:#{__LINE__}]}
+ end
+ end
+ end
+ x=@env.document_language_versions_found #check multiple document language versions (param not used)
+ if x[:f] \
+ and x[:f].length > 0 #store multiple document language versions, sisupod
+ x[:f].each do |f|
+ FileUtils::mkdir_p(@path_pod[:doc]) unless FileTest.directory?(@path_pod[:doc])
+ if f[:f] =~/\~(\S{2,3})\.ss[tm]$/
+ lng_f=$1
+ if @opt.lng == lng_f
+ if @opt.fno =~/\.ssm$/
+ if FileTest.file?("#{@opt.base_path}#{doc_import_dir}/#{f[:f]}")
+ FileUtils::cp("#{@opt.base_path}#{doc_import_dir}/#{f[:f]}",
+ "#{@path_pod[:doc]}/#{f[:n]}")
+ else STDERR.puts %{\t*WARN* did not find - "#{@opt.base_path}#{doc_import_dir}/#{f[:f]}" [#{__FILE__}:#{__LINE__}]}
+ end
+ else
+ if FileTest.file?("#{@opt.base_path}/#{f[:f]}")
+ cpy= :no
+ cpy=if f[:f] =~ /^#{@opt.f_pth[:lng_is]}\// \
+ or f[:f] =~ /~#{@opt.f_pth[:lng_is]}\.sst/
+ :yes
+ elsif f[:f] !~ /^(?:#{Px[:lng_lst_rgx]})\/|~(?:#{Px[:lng_lst_rgx]})\.sst/ \
+ and @opt.f_pth[:lng_is] == 'en'
+ :yes
+ else :no
+ end
+ if cpy == :yes
+ FileUtils::cp("#{@opt.base_path}/#{f[:f]}",
+ "#{@path_pod[:doc]}/#{f[:n]}")
+ end
+ else STDERR.puts %{\t*WARN* did not find - "#{@opt.base_path}/#{f[:f]}" [#{__FILE__}:#{__LINE__}]}
+ end
+ end
+ end
+ else
+ if @opt.fno =~/\.ssm$/
+ if FileTest.file?("#{@opt.base_path}#{doc_import_dir}/#{f[:f]}")
+ FileUtils::cp_r("#{@opt.base_path}#{doc_import_dir}/#{f[:f]}",
+ "#{@path_pod[:doc]}/#{f[:n]}")
+ else STDERR.puts %{\t*WARN* did not find - "#{@opt.base_path}#{doc_import_dir}/#{f[:f]}" [#{__FILE__}:#{__LINE__}]}
+ end
+ else
+ if FileTest.file?("#{@opt.base_path}/#{f[:f]}")
+ cpy= :no
+ cpy=if f[:f] =~ /^#{@opt.f_pth[:lng_is]}\// \
+ or f[:f] =~ /~#{@opt.f_pth[:lng_is]}\.sst/
+ :yes
+ elsif f[:f] !~ /^(?:#{Px[:lng_lst_rgx]})\/|~(?:#{Px[:lng_lst_rgx]})\.sst/ \
+ and @opt.f_pth[:lng_is] == 'en'
+ :yes
+ else :no
+ end
+ if cpy == :yes
+ FileUtils::cp("#{@opt.base_path}/#{f[:f]}",
+ "#{@path_pod[:doc]}/#{f[:n]}")
+ end
+ else STDERR.puts %{\t*WARN* did not find - "#{@opt.base_path}/#{f[:f]}" [#{__FILE__}:#{__LINE__}]}
+ end
+ end
+ end
+ end
+ end #NB not all possibilies met, revisit, also in case of composite file may wish to add README
+ end
+ end
+end
+__END__
+question?: should you permit the packing of multiple documents in single .xz ?
+
+ open @opt.fns, parse file
+ extract from file content:
+ images and copy each image from whatever image source to _sisu/sisupod/sisu/_sisu/image
+
+ remove previously existing contents of _/sisu/sisupod &
+ make directory structure:
+
+v3 -->
+ _sisu
+ sisupod
+ doc
+ manifest.txt
+ en/content.sst [file content]
+ fr/content.sst
+ _sisu
+ conf
+ image (ln -s ../../image)
+ audio (ln -s ../../audio)
+ video (ln -s ../../video)
+ image [all images for specific document gathered here]
+ audio
+ video
+
+v2 -->
+ _sisu
+ sisupod
+ content.sst [file content]
+ filename.sst [link to content.sst]
+ _sisu/
+ image/ [all images for specific document gathered here]
+
+sisu
+ _sisu
+ sisurc.yml
+ convert/
+ standard_terms/
+ image
+ processing
+ dal/
+ tex/
+ texinfo/
+ tune/
+ sisupod
+
+special case
+
+composite file (master), e.g.
+SiSU.ssm
diff --git a/lib/sisu/v2/shared_txt.rb b/lib/sisu/v4/shared_txt.rb
index 598fc52d..6876dabd 100644
--- a/lib/sisu/v2/shared_txt.rb
+++ b/lib/sisu/v4/shared_txt.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -56,7 +55,7 @@
** Description: modules shared by flatfile output generators
=end
-module SiSU_text_utils
+module SiSU_TextUtils
class Wrap
def initialize(para='',n_char_max=76,n_indent=0,n_hang=nil)
@para,@n_char_max,@n_indent=para,n_char_max,n_indent
@@ -70,8 +69,8 @@ module SiSU_text_utils
line=0
out=[]
out[line]=''
- @para.gsub!(/<br>/,' <br> ')
- @para.gsub!(/#{Mx[:br_nl]}/,"\n\n")
+ @para=@para.gsub(/<br>/,' <br> ').
+ gsub(/#{Mx[:br_nl]}/,"\n\n")
words=@para.scan(/\n\n|<br>|\S+/m)
while words != ''
word=words.shift
@@ -84,8 +83,8 @@ module SiSU_text_utils
line=line
elsif word =~/\n\n/
word="\n"
- @n_char_max_extend = @n_char_max + out[line].length
- line=line
+ @n_char_max_extend = @n_char_max
+ line += 1
elsif (out[line].length + word.length) > (@n_char_max_extend - @n_indent) \
and out[line] =~/\S+/
@n_char_max_extend = @n_char_max
@@ -104,7 +103,7 @@ module SiSU_text_utils
end
@oldword=word if word =~/\S+/
end
- x=out.join(spaces_indent).gsub(/\A\n+/m,'').insert(0,spaces_hang)
+ spaces_hang + out.join(spaces_indent)
end
def line_wrap_indent1
@n_indent,@n_hang=2,2
@@ -115,16 +114,16 @@ module SiSU_text_utils
line_wrap
end
def array_wrap
- if @para.class==Array
+ if @para.is_a?(Array)
@arr=[]
@para.each do |line|
- @arr << SiSU_text_utils::Wrap.new(line,@n_char_max,@n_indent,@n_hang).line_wrap
+ @arr << SiSU_TextUtils::Wrap.new(line,@n_char_max,@n_indent,@n_hang).line_wrap
end
end
@arr
end
end
- class Header_scan
+ class HeaderScan
def initialize(md,para)
@md,@p=md,para
end
@@ -204,7 +203,6 @@ module SiSU_text_utils
when /^#{Mx[:meta_o]}(bold)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct')
when /^#{Mx[:meta_o]}(italics|itali[sz]e)#{Mx[:meta_c]}\s*(.+?)$/; header('italicize',$2,'process','instruct')
when /^#{Mx[:meta_o]}(vocabulary|wordlist)#{Mx[:meta_c]}\s*(.+?)$/; header('vocabulary',$2,'process','instruct')
- when /^#{Mx[:meta_o]}(skin)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct')
when /^#{Mx[:meta_o]}(css|stylesheet)#{Mx[:meta_c]}\s*(.+?)$/; header('css',$2,'process','instruct')
when /^#{Mx[:meta_o]}(links)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct')
when /^#{Mx[:meta_o]}(prefix)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct') #add a & b
diff --git a/lib/sisu/v2/shared_xhtml.rb b/lib/sisu/v4/shared_xhtml.rb
index 84f8be80..f78f98fc 100644
--- a/lib/sisu/v2/shared_xhtml.rb
+++ b/lib/sisu/v4/shared_xhtml.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -56,10 +55,10 @@
** Description: shared html parts
=end
-module SiSU_XHTML_shared
- require "#{SiSU_lib}/defaults" # defaults.rb
- require "#{SiSU_lib}/xhtml_table" # xhtml_table.rb
- class Table_xhtml < SiSU_XHTML_table::Table_xhtml
+module SiSU_XHTML_Shared
+ require_relative 'defaults' # defaults.rb
+ require_relative 'xhtml_table' # xhtml_table.rb
+ class TableXHTML < SiSU_XHTML_Table::TableXHTML
end
end
__END__
diff --git a/lib/sisu/v4/shared_xml.rb b/lib/sisu/v4/shared_xml.rb
new file mode 100644
index 00000000..ba95c805
--- /dev/null
+++ b/lib/sisu/v4/shared_xml.rb
@@ -0,0 +1,717 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: common file for xml generation
+=end
+module SiSU_XML_Munge
+ class Trans
+ require_relative 'defaults' # defaults.rb
+ def initialize(md)
+ @md=md
+ @sys=SiSU_Env::SystemCall.new
+ @dir=SiSU_Env::InfoEnv.new(@md.fns)
+ @brace_url=SiSU_Viz::Defaults.new.url_decoration
+ if @md.sem_tag
+ @ab ||=semantic_tags.default
+ end
+ end
+ def semantic_tags
+ def default
+ {
+ pub: 'publication',
+ conv: 'convention',
+ vol: 'volume',
+ pg: 'page',
+ cty: 'city',
+ org: 'organization',
+ uni: 'university',
+ dept: 'department',
+ fac: 'faculty',
+ inst: 'institute',
+ co: 'company',
+ com: 'company',
+ conv: 'convention',
+ dt: 'date',
+ y: 'year',
+ m: 'month',
+ d: 'day',
+ ti: 'title',
+ au: 'author',
+ ed: 'editor', #editor?
+ v: 'version', #edition
+ n: 'name',
+ fn: 'firstname',
+ mn: 'middlename',
+ ln: 'lastname',
+ in: 'initials',
+ qt: 'quote',
+ ct: 'cite',
+ ref: 'reference',
+ ab: 'abreviation',
+ def: 'define',
+ desc: 'description',
+ trans: 'translate',
+ }
+ end
+ self
+ end
+ def char_enc #character encode
+ def utf8(dob='')
+ if @sys.locale =~/utf-?8/i # instead ucs for utf8 # String#encode Iñtërnâtiônàlizætiøn
+ str=if defined? dob.obj then dob.obj
+ elsif dob.is_a?(String) then dob
+ end
+ if str
+ #¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûü
+ #¢£¥§©ª«®°±²³µ¶¹º»¼½¾×÷
+ str=str.gsub(/</um,'&#60;'). # '&lt;' # &#060;
+ gsub(/>/um,'&#62;'). # '&gt;' # &#062;
+ gsub(/¢/um,'&#162;'). # '&cent;' # &#162;
+ gsub(/£/um,'&#163;'). # '&pound;' # &#163;
+ gsub(/¥/um,'&#165;'). # '&yen;' # &#165;
+ gsub(/§/um,'&#167;'). # '&sect;' # &#167;
+ gsub(/©/um,'&#169;'). # '&copy;' # &#169;
+ gsub(/ª/um,'&#170;'). # '&ordf;' # &#170;
+ gsub(/«/um,'&#171;'). # '&laquo;' # &#171;
+ gsub(/®/um,'&#174;'). # '&reg;' # &#174;
+ gsub(/°/um,'&#176;'). # '&deg;' # &#176;
+ gsub(/±/um,'&#177;'). # '&plusmn;' # &#177;
+ gsub(/²/um,'&#178;'). # '&sup2;' # &#178;
+ gsub(/³/um,'&#179;'). # '&sup3;' # &#179;
+ gsub(/µ/um,'&#181;'). # '&micro;' # &#181;
+ gsub(/¶/um,'&#182;'). # '&para;' # &#182;
+ gsub(/¹/um,'&#185;'). # '&sup1;' # &#185;
+ gsub(/º/um,'&#186;'). # '&ordm;' # &#186;
+ gsub(/»/um,'&#187;'). # '&raquo;' # &#187;
+ gsub(/¼/um,'&#188;'). # '&frac14;' # &#188;
+ gsub(/½/um,'&#189;'). # '&frac12;' # &#189;
+ gsub(/¾/um,'&#190;'). # '&frac34;' # &#190;
+ gsub(/×/um,'&#215;'). # '&times;' # &#215;
+ gsub(/÷/um,'&#247;'). # '&divide;' # &#247;
+ gsub(/¿/um,'&#191;'). # '&iquest;' # &#191;
+ gsub(/À/um,'&#192;'). # '&Agrave;' # &#192;
+ gsub(/Á/um,'&#193;'). # '&Aacute;' # &#193;
+ gsub(/Â/um,'&#194;'). # '&Acirc;' # &#194;
+ gsub(/Ã/um,'&#195;'). # '&Atilde;' # &#195;
+ gsub(/Ä/um,'&#196;'). # '&Auml;' # &#196;
+ gsub(/Å/um,'&#197;'). # '&Aring;' # &#197;
+ gsub(/Æ/um,'&#198;'). # '&AElig;' # &#198;
+ gsub(/Ç/um,'&#199;'). # '&Ccedil;' # &#199;
+ gsub(/È/um,'&#200;'). # '&Egrave;' # &#200;
+ gsub(/É/um,'&#201;'). # '&Eacute;' # &#201;
+ gsub(/Ê/um,'&#202;'). # '&Ecirc;' # &#202;
+ gsub(/Ë/um,'&#203;'). # '&Euml;' # &#203;
+ gsub(/Ì/um,'&#204;'). # '&Igrave;' # &#204;
+ gsub(/Í/um,'&#205;'). # '&Iacute;' # &#205;
+ gsub(/Î/um,'&#206;'). # '&Icirc;' # &#206;
+ gsub(/Ï/um,'&#207;'). # '&Iuml;' # &#207;
+ gsub(/Ð/um,'&#208;'). # '&ETH;' # &#208;
+ gsub(/Ñ/um,'&#209;'). # '&Ntilde;' # &#209;
+ gsub(/Ò/um,'&#210;'). # '&Ograve;' # &#210;
+ gsub(/Ó/um,'&#211;'). # '&Oacute;' # &#211;
+ gsub(/Ô/um,'&#212;'). # '&Ocirc;' # &#212;
+ gsub(/Õ/um,'&#213;'). # '&Otilde;' # &#213;
+ gsub(/Ö/um,'&#214;'). # '&Ouml;' # &#214;
+ gsub(/Ø/um,'&#216;'). # '&Oslash;' # &#216;
+ gsub(/Ù/um,'&#217;'). # '&Ugrave;' # &#217;
+ gsub(/Ú/um,'&#218;'). # '&Uacute;' # &#218;
+ gsub(/Û/um,'&#219;'). # '&Ucirc;' # &#219;
+ gsub(/Ü/um,'&#220;'). # '&Uuml;' # &#220;
+ gsub(/Ý/um,'&#221;'). # '&Yacute;' # &#221;
+ gsub(/Þ/um,'&#222;'). # '&THORN;' # &#222;
+ gsub(/ß/um,'&#223;'). # '&szlig;' # &#223;
+ gsub(/à/um,'&#224;'). # '&agrave;' # &#224;
+ gsub(/á/um,'&#225;'). # '&aacute;' # &#225;
+ gsub(/â/um,'&#226;'). # '&acirc;' # &#226;
+ gsub(/ã/um,'&#227;'). # '&atilde;' # &#227;
+ gsub(/ä/um,'&#228;'). # '&auml;' # &#228;
+ gsub(/å/um,'&#229;'). # '&aring;' # &#229;
+ gsub(/æ/um,'&#230;'). # '&aelig;' # &#230;
+ gsub(/ç/um,'&#231;'). # '&ccedil;' # &#231;
+ gsub(/è/um,'&#232;'). # '&egrave;' # &#232;
+ gsub(/é/um,'&#233;'). # '&acute;' # &#233;
+ gsub(/ê/um,'&#234;'). # '&circ;' # &#234;
+ gsub(/ë/um,'&#235;'). # '&euml;' # &#235;
+ gsub(/ì/um,'&#236;'). # '&igrave;' # &#236;
+ gsub(/í/um,'&#237;'). # '&acute;' # &#237;
+ gsub(/î/um,'&#238;'). # '&icirc;' # &#238;
+ gsub(/ï/um,'&#239;'). # '&iuml;' # &#239;
+ gsub(/ð/um,'&#240;'). # '&eth;' # &#240;
+ gsub(/ñ/um,'&#241;'). # '&ntilde;' # &#241;
+ gsub(/ò/um,'&#242;'). # '&ograve;' # &#242;
+ gsub(/ó/um,'&#243;'). # '&oacute;' # &#243;
+ gsub(/ô/um,'&#244;'). # '&ocirc;' # &#244;
+ gsub(/õ/um,'&#245;'). # '&otilde;' # &#245;
+ gsub(/ö/um,'&#246;'). # '&ouml;' # &#246;
+ gsub(/ø/um,'&#248;'). # '&oslash;' # &#248;
+ gsub(/ù/um,'&#250;'). # '&ugrave;' # &#250;
+ gsub(/ú/um,'&#251;'). # '&uacute;' # &#251;
+ gsub(/û/um,'&#252;'). # '&ucirc;' # &#252;
+ gsub(/ü/um,'&#253;'). # '&uuml;' # &#253;
+ gsub(/þ/um,'&#254;'). # '&thorn;' # &#254;
+ gsub(/ÿ/um,'&#255;'). # '&yuml;' # &#255;
+ gsub(/‘/um,'&#8216;'). # '&lsquo;' # &#8216;
+ gsub(/’/um,'&#8217;'). # '&rsquo;' # &#8217;
+ gsub(/“/um,'&#8220;'). # &ldquo; # &#8220;
+ gsub(/”/um,'&#8221;'). # &rdquo; # &#8221;
+ gsub(/–/um,'&#8211;'). # &ndash; # &#8211;
+ gsub(/—/um,'&#8212;'). # &mdash; # &#8212;
+ gsub(/∝/um,'&#8733;'). # &prop; # &#8733;
+ gsub(/∞/um,'&#8734;'). # &infin; # &#8734;
+ gsub(/™/um,'&#8482;'). # &trade; # &#8482;
+ gsub(/✠/um,'&#10016;'). # &cross; # &#10016;
+ gsub(/ /um,' '). # space identify
+ gsub(/ /um,' ') # space identify
+ end
+ dob=if defined? dob.obj
+ dob.obj=str
+ dob
+ elsif dob.is_a?(String)
+ str
+ end
+ dob
+ end
+ end
+ def html(dob='')
+ if @sys.locale =~/utf-?8/i # instead ucs for utf8 # String#encode Iñtërnâtiônàlizætiøn
+ dob.obj=dob.obj.gsub(/ /u,' '). # space identify
+ gsub(/ /u,' ') # space identify
+ else
+ dob.obj=dob.obj.gsub(/¢/u,'&cent;'). # &#162;
+ gsub(/£/u,'&pound;'). # &#163;
+ gsub(/¥/u,'&yen;'). # &#165;
+ gsub(/§/u,'&sect;'). # &#167;
+ gsub(/©/u,'&copy;'). # &#169;
+ gsub(/ª/u,'&ordf;'). # &#170;
+ gsub(/«/u,'&laquo;'). # &#171;
+ gsub(/®/u,'&reg;'). # &#174;
+ gsub(/°/u,'&deg;'). # &#176;
+ gsub(/±/u,'&plusmn;'). # &#177;
+ gsub(/²/u,'&sup2;'). # &#178;
+ gsub(/³/u,'&sup3;'). # &#179;
+ gsub(/µ/u,'&micro;'). # &#181;
+ gsub(/¶/u,'&para;'). # &#182;
+ gsub(/¹/u,'&sup1;'). # &#185;
+ gsub(/º/u,'&ordm;'). # &#186;
+ gsub(/»/u,'&raquo;'). # &#187;
+ gsub(/¼/u,'&frac14;'). # &#188;
+ gsub(/½/u,'&frac12;'). # &#189;
+ gsub(/¾/u,'&frac34;'). # &#190;
+ gsub(/×/u,'&times;'). # &#215;
+ gsub(/÷/u,'&divide;'). # &#247;
+ gsub(/¿/u,'&iquest;'). # &#191;
+ gsub(/À/u,'&Agrave;'). # &#192;
+ gsub(/Á/u,'&Aacute;'). # &#193;
+ gsub(/Â/u,'&Acirc;'). # &#194;
+ gsub(/Ã/u,'&Atilde;'). # &#195;
+ gsub(/Ä/u,'&Auml;'). # &#196;
+ gsub(/Å/u,'&Aring;'). # &#197;
+ gsub(/Æ/u,'&AElig;'). # &#198;
+ gsub(/Ç/u,'&Ccedil;'). # &#199;
+ gsub(/È/u,'&Egrave;'). # &#200;
+ gsub(/É/u,'&Eacute;'). # &#201;
+ gsub(/Ê/u,'&Ecirc;'). # &#202;
+ gsub(/Ë/u,'&Euml;'). # &#203;
+ gsub(/Ì/u,'&Igrave;'). # &#204;
+ gsub(/Í/u,'&Iacute;'). # &#205;
+ gsub(/Î/u,'&Icirc;'). # &#206;
+ gsub(/Ï/u,'&Iuml;'). # &#207;
+ gsub(/Ð/u,'&ETH;'). # &#208;
+ gsub(/Ñ/u,'&Ntilde;'). # &#209;
+ gsub(/Ò/u,'&Ograve;'). # &#210;
+ gsub(/Ó/u,'&Oacute;'). # &#211;
+ gsub(/Ô/u,'&Ocirc;'). # &#212;
+ gsub(/Õ/u,'&Otilde;'). # &#213;
+ gsub(/Ö/u,'&Ouml;'). # &#214;
+ gsub(/Ø/u,'&Oslash;'). # &#216;
+ gsub(/Ù/u,'&Ugrave;'). # &#217;
+ gsub(/Ú/u,'&Uacute;'). # &#218;
+ gsub(/Û/u,'&Ucirc;'). # &#219;
+ gsub(/Ü/u,'&Uuml;'). # &#220;
+ gsub(/Ý/u,'&Yacute;'). # &#221;
+ gsub(/Þ/u,'&THORN;'). # &#222;
+ gsub(/ß/u,'&szlig;'). # &#223;
+ gsub(/à/u,'&agrave;'). # &#224;
+ gsub(/á/u,'&aacute;'). # &#225;
+ gsub(/â/u,'&acirc;'). # &#226;
+ gsub(/ã/u,'&atilde;'). # &#227;
+ gsub(/ä/u,'&auml;'). # &#228;
+ gsub(/å/u,'&aring;'). # &#229;
+ gsub(/æ/u,'&aelig;'). # &#230;
+ gsub(/ç/u,'&ccedil;'). # &#231;
+ gsub(/è/u,'&egrave;'). # &#232;
+ gsub(/é/u,'&acute;'). # &#233;
+ gsub(/ê/u,'&circ;'). # &#234;
+ gsub(/ë/u,'&euml;'). # &#235;
+ gsub(/ì/u,'&igrave;'). # &#236;
+ gsub(/í/u,'&acute;'). # &#237;
+ gsub(/î/u,'&icirc;'). # &#238;
+ gsub(/ï/u,'&iuml;'). # &#239;
+ gsub(/ð/u,'&eth;'). # &#240;
+ gsub(/ñ/u,'&ntilde;'). # &#241;
+ gsub(/ò/u,'&ograve;'). # &#242;
+ gsub(/ó/u,'&oacute;'). # &#243;
+ gsub(/ô/u,'&ocirc;'). # &#244;
+ gsub(/õ/u,'&otilde;'). # &#245;
+ gsub(/ö/u,'&ouml;'). # &#246;
+ gsub(/ø/u,'&oslash;'). # &#248;
+ gsub(/ù/u,'&ugrave;'). # &#250;
+ gsub(/ú/u,'&uacute;'). # &#251;
+ gsub(/û/u,'&ucirc;'). # &#252;
+ gsub(/ü/u,'&uuml;'). # &#253;
+ gsub(/þ/u,'&thorn;'). # &#254;
+ gsub(/ÿ/u,'&yuml;'). # &#255;
+ gsub(/‘/u,'&#lsquo;'). # &lsquo; # &#8216;
+ gsub(/’/u,'&#rsquo;'). # &rsquo; # &#8217;
+ gsub(/“/u,'&ldquo;'). # &ldquo; # &#8220;
+ gsub(/”/u,'&rdquo;'). # &rdquo; # &#8221;
+ gsub(/–/u,'&ndash;'). # &ndash; # &#8211;
+ gsub(/—/u,'&mdash;'). # &mdash; # &#8212;
+ gsub(/∝/u,'&prop;'). # &prop; # &#8733;
+ gsub(/∞/u,'&infin;'). # &infin; # &#8734;
+ gsub(/™/u,'&trade;'). # &trade; # &#8482;
+ gsub(/✠/u,'&#10016;'). # &#10016;
+ #gsub(/✠/u '&dagger;'). # &dagger; # &#8224; incorrect replacement †
+ gsub(/ /u,' '). # space identify
+ gsub(/ /u,' ') # space identify
+ end
+ end
+ self
+ end
+ def tidywords(wordlist)
+ wordlist_new=[]
+ wordlist.each do |x|
+ #imperfect solution will not catch all possible cases
+ x=x.gsub(/&/,'&amp;') unless x =~/&\S+;/
+ x=x.gsub(/&([A-Z])/,'&amp;\1')
+ wordlist_new << x
+ end
+ wordlist_new
+ end
+ def markup(dob='')
+ wordlist=dob.obj.scan(/&[#0-9a-z]+;|\S+|\n/) #\n needed for tables, check though added 2005w17
+ dob.obj=tidywords(wordlist).join(' ').strip
+ unless dob.is==:table
+ dob.obj=dob.obj.gsub(/#{Mx[:br_line]}/u,'<br />').
+ gsub(/#{Mx[:br_paragraph]}/u,'<br />').
+ gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />')
+ end
+ dob.obj=dob.obj.gsub(/#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}/,'').
+ gsub(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;').
+ gsub(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;').
+ gsub(/(^|#{Mx[:gl_c]}|\s+)<\s+/,'\1&lt; ').gsub(/\s+>(\s+|$)/,' &gt;\1').
+ #gsub(/#{Mx[:fa_emphasis_o]}(.+?)#{Mx[:fa_emphasis_c]}/,'<em>\1</em>'). #reinstate
+ gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/m,'<b>\1</b>').
+ gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/m,'<i>\1</i>').
+ gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>').
+ gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>').
+ gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>').
+ gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'<ins>\1</ins>').
+ gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>').
+ gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>').
+ gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>').
+ gsub(/<:pb>\s*/,''). #Fix
+ gsub(/<+[-~]#>+/,'')
+ if dob.is !=:code
+ #embeds a red-bullet image -->
+ dob.obj=dob.obj.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>').
+ gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>').
+ gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>').
+ gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>')
+ dob.obj=dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />') unless dob.is==:table
+ dob.obj=dob.obj.gsub(/#{Mx[:br_page]}\s*/,'').
+ gsub(/#{Mx[:br_page_new]}\s*/,'').
+ gsub(/#{Mx[:pa_non_object_no_heading]}|#{Mx[:pa_non_object_dummy_heading]}/,'').
+ gsub(/<[-~]#>/,'').
+ gsub(/href="#{Xx[:segment]}/m,'href="').
+ gsub(/#{Mx[:lnk_o]}([^#{Mx[:lnk_o]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{Mx[:rel_c]}]+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}(\.\.\/\S+?)#{Mx[:rel_c]}/,
+ '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\2">\1</link>').
+ gsub(/#{Mx[:lnk_o]}([^#{Mx[:lnk_o]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{Mx[:rel_c]}]+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}:(\S+?)#{Mx[:rel_c]}/,
+ '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="../\2">\1</link>').
+ gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}(\S+?)#{Mx[:rel_c]}/,
+ '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="#\2">\1</link>').
+ gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))[ ]+(\d+)x(\d+)(\s+[^}]+)?#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
+ %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@md.file.output_path.xml.rel_image}/\\1" width="\\2" height="\\3" />[\\1] \\4}).
+ gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))([ ]+[^}]+)?#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
+ %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@md.file.output_path.xml.rel_image}/\\1"/>\\1}).
+ gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))[ ]+(\d+)x(\d+)(\s+[^}]+)?#{Mx[:lnk_c]}image/,
+ %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@md.file.output_path.xml.rel_image}/\\1" width="\\2" height="\\3" />[\\1] \\4}).
+ gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))([ ]+[^}]+)?#{Mx[:lnk_c]}image/,
+ %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@md.file.output_path.xml.rel_image}/\\1"/>\\1}).
+ gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
+ '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\2">\1</link>'). #watch, compare html_tune
+ gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
+ %{#{@brace_url.xml_open}<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\\1">\\1</link>#{@brace_url.xml_close}}).
+ gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,
+ '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\1">\1</link>') #escaped urls not linked, deal with later
+ else
+ dob.obj=dob.obj.gsub(/</m,'&lt;').gsub(/>/m,'&gt;')
+ end
+ if dob.of==:block
+ dob.obj=dob.obj.gsub(/#{Mx[:gl_bullet]}/,'● ')
+ end
+ dob.obj=dob.obj.gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,
+ %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}).
+ gsub(/#{Dx[:url_o]}/,"#{Dx[:url_o_xml]}").
+ gsub(/#{Dx[:url_c]}/,"#{Dx[:url_c_xml]}").
+ gsub(/&nbsp;|#{Mx[:nbsp]}/m,'&#160;')
+ dob
+ end
+ def markup_light(dob='')
+ dob.obj=dob.obj.gsub(/\/\{(.+?)\}\//,'<i>\1</i>').
+ gsub(/[*!]\{(.+?)\}[*!]/,'<b>\1</b>').
+ gsub(/_\{(.+?)\}_/,'<u>\1</u>').
+ gsub(/-\{(.+?)\}-/,'<del>\1</del>').
+ gsub(/<br(\s*\/)?>/,'<br />').
+ gsub(/<:pb>\s*/,'').
+ gsub(/<[-~]#>/,'').
+ gsub(/(^|#{Mx[:gl_c]}|\s)&\s+/,'\1&amp; '). #sort
+ gsub(/&([^;]{1,5})/,'&amp;\1'). #sort, rough estimate, revisit #WATCH found in node not sax
+ gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif))[ ]+.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/,
+ "<image.path>#{@md.file.output_path.xml.rel_image}\/\\1</image.path>").
+ gsub(/&nbsp;|#{Mx[:nbsp]}/,'&#160;')
+ wordlist=dob.obj.scan(/&[#0-9a-z]+;|\S+|\n/) #\n needed for tables, check though added 2005w17
+ dob.obj=tidywords(wordlist).join(' ').strip
+ dob
+ end
+ def markup_fictionbook(dob='')
+ dob.obj.gsub(/~\{([\d*+]+).+?\}~/,'[\1]').
+ gsub(/\/\{(.+?)\}\//,'<i>\1</i>').
+ gsub(/[*!]\{(.+?)\}[*!]/,'<b>\1</b>').
+ gsub(/_\{(.+?)\}_/,'<u>\1</u>').
+ gsub(/-\{(.+?)\}-/,'<del>\1</del>').
+ gsub(/<br(?:\s*\/)?>/,'<br />').
+ gsub(/<:pb>\s*/,'').
+ gsub(/<[-~]#>/,'').
+ #temporary -->
+ gsub(/<:\S+?>/,'').
+ #<-- temporary
+ gsub(/<[-~]#>/,'').
+ gsub(/(^|#{Mx[:gl_c]}|\s)&\s+/,'\1&amp; '). #sort
+ gsub(/&([^;]{1,5})/,'&amp;\1') #sort, rough estimate, revisit #WATCH found in node not sax
+ gsub(/(#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif))[ ]+.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/,
+ "<image.path>#{@md.file.output_path.xml.rel_image}\/\\1</image.path>").
+ gsub(/&nbsp;|#{Mx[:nbsp]}/,'&#160;')
+ wordlist=dob.obj.scan(/&[#0-9a-z]+;|\S+|\n/) #\n needed for tables, check though added 2005w17
+ dob.obj=tidywords(wordlist).join(' ').strip
+ dob
+ end
+ def markup_group(dob='')
+ dob.obj=dob.obj.gsub(/</,'&lt;').gsub(/>/,'&gt;').
+ gsub(/&lt;:?br(?:\s+\/)?&gt;/,'<br />').
+ gsub(/&lt;(link xmlns:xlink=".+?")&gt;/,'<\1>').
+ gsub(/&lt;(\/link)&gt;/,'<\1>').
+ gsub(/&lt;(\/?en)&gt;/,'<\1>')
+ dob
+ end
+ def markup_block(dob='')
+ dob.obj=dob.obj.gsub(/</,'&lt;').gsub(/>/,'&gt;').
+ gsub(/&lt;:?br(?:\s+\/)?&gt;/,'<br />').
+ gsub(/&lt;(link xmlns:xlink=".+?")&gt;/,'<\1>').
+ gsub(/&lt;(\/link)&gt;/,'<\1>').
+ gsub(/&lt;(\/?en)&gt;/,'<\1>')
+ dob
+ end
+ def xml_sem_block_paired(matched) # colon depth: many, recurs
+ matched=matched.gsub(/\b(au):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:au]} depth="many">\\2</sem:#{@ab[:au]}>}).
+ gsub(/\b(vol):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:vol]} depth="many">\\2</sem:#{@ab[:vol]}>}).
+ gsub(/\b(pub):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:pub]} depth="many">\\2</sem:#{@ab[:pub]}>}).
+ gsub(/\b(ref):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:ref]} depth="many">\\2</sem:#{@ab[:ref]}>}).
+ gsub(/\b(desc):\{(.+?)\}:\1\b/m,%{<sem:#{@ab[:desc]} depth="many">\\2</sem:#{@ab[:desc]}>}).
+ gsub(/\b(conv):\{(.+?)\}:\1\b/m,%{<sem:#{@ab[:conv]} depth="many">\\2</sem:#{@ab[:conv]}>}).
+ gsub(/\b(ct):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:ct]} depth="many">\\2</sem:#{@ab[:ct]}>}).
+ gsub(/\b(cty):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:cty]} depth="many">\\2</sem:#{@ab[:cty]}>}).
+ gsub(/\b(org):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:org]} depth="many">\\2</sem:#{@ab[:org]}>}).
+ gsub(/\b(dt):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:dt]} depth="many">\\2</sem:#{@ab[:dt]}>}).
+ gsub(/\b(n):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:n]} depth="many">\\2</sem:#{@ab[:n]}>}).
+ gsub(/([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\1)/m,'<sem:\1 depth="many">\2</sem:\1>')
+ end
+ def xml_semantic_tags(dob)
+ if @md.sem_tag
+ dob.obj.gsub!(/([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\1)/m) {|c| xml_sem_block_paired(c) }
+ dob.obj.gsub!(/([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\1)/m) {|c| xml_sem_block_paired(c) }
+ dob.obj.gsub!(/([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\1)/m) {|c| xml_sem_block_paired(c) }
+ dob.obj=dob.obj.gsub(/:\{(.+?)\}:au\b/m, %{<sem:#{@ab[:au]} depth="one">\\1</sem:#{@ab[:au]}>}).
+ gsub(/:\{(.+?)\}:n\b/m, %{<sem:#{@ab[:n]} depth="one">\\1</sem:#{@ab[:n]}>}).
+ gsub(/:\{(.+?)\}:ti\b/m, %{<sem:#{@ab[:ti]} depth="one">\\1</sem:#{@ab[:ti]}>}).
+ gsub(/:\{(.+?)\}:ref\b/m, %{<sem:#{@ab[:ref]} depth="one">\\1</sem:#{@ab[:ref]}>}).
+ gsub(/:\{(.+?)\}:desc\b/m, %{<sem:#{@ab[:desc]} depth="one">\\1</sem:#{@ab[:desc]}>}).
+ gsub(/:\{(.+?)\}:cty\b/m, %{<sem:#{@ab[:cty]} depth="one">\\1</sem:#{@ab[:cty]}>}).
+ gsub(/:\{(.+?)\}:org\b/m, %{<sem:#{@ab[:org]} depth="one">\\1</sem:#{@ab[:org]}>}).
+ gsub(/:\{(.+?)\}:([a-z]+(?:[_:.][a-z]+)*)/m,'<sem:\2 depth="one">\1</sem:\2>').
+ gsub(/;\{([^}]+(?![;]))\};ti\b/m, %{<sem:#{@ab[:ti]} depth="zero">\\1</sem:#{@ab[:ti]}>}).
+ gsub(/;\{([^}]+(?![;]))\};qt\b/m, %{<sem:#{@ab[:qt]} depth="zero">\\1</sem:#{@ab[:qt]}>}).
+ gsub(/;\{([^}]+(?![;]))\};ref\b/m, %{<sem:#{@ab[:ref]} depth="zero">\\1</sem:#{@ab[:ref]}>}).
+ gsub(/;\{([^}]+(?![;]))\};ed\b/m, %{<sem:#{@ab[:ed]} depth="zero">\\1</sem:#{@ab[:ed]}>}).
+ gsub(/;\{([^}]+(?![;]))\};v\b/m, %{<sem:#{@ab[:v]} depth="zero">\\1</sem:#{@ab[:v]}>}).
+ gsub(/;\{([^}]+(?![;]))\};desc\b/m, %{<sem:#{@ab[:desc]} depth="zero">\\1</sem:#{@ab[:desc]}>}).
+ gsub(/;\{([^}]+(?![;]))\};def\b/m, %{<sem:#{@ab[:def]} depth="zero">\\1</sem:#{@ab[:def]}>}).
+ gsub(/;\{([^}]+(?![;]))\};trans\b/m, %{<sem:#{@ab[:trans]} depth="zero">\\1</sem:#{@ab[:trans]}>}).
+ gsub(/;\{([^}]+(?![;]))\};y\b/m, %{<sem:#{@ab[:y]} depth="zero">\\1</sem:#{@ab[:y]}>}).
+ gsub(/;\{([^}]+(?![;]))\};ab\b/m, %{<sem:#{@ab[:ab]} depth="zero">\\1</sem:#{@ab[:ab]}>}).
+ gsub(/;\{([^}]+(?![;]))\};pg\b/m, %{<sem:#{@ab[:pg]} depth="zero">\\1</sem:#{@ab[:pg]}>}).
+ gsub(/;\{([^}]+(?![;]))\};fn?\b/m, %{<sem:#{@ab[:fn]} depth="zero">\\1</sem:#{@ab[:fn]}>}).
+ gsub(/;\{([^}]+(?![;]))\};mn?\b/m, %{<sem:#{@ab[:mn]} depth="zero">\\1</sem:#{@ab[:mn]}>}).
+ gsub(/;\{([^}]+(?![;]))\};ln?\b/m, %{<sem:#{@ab[:ln]} depth="zero">\\1</sem:#{@ab[:ln]}>}).
+ gsub(/;\{([^}]+(?![;]))\};in\b/m, %{<sem:#{@ab[:in]} depth="zero">\\1</sem:#{@ab[:in]}>}).
+ gsub(/;\{([^}]+(?![;]))\};uni\b/m, %{<sem:#{@ab[:uni]} depth="zero">\\1</sem:#{@ab[:uni]}>}).
+ gsub(/;\{([^}]+(?![;]))\};fac\b/m, %{<sem:#{@ab[:fac]} depth="zero">\\1</sem:#{@ab[:fac]}>}).
+ gsub(/;\{([^}]+(?![;]))\};inst\b/m, %{<sem:#{@ab[:inst]} depth="zero">\\1</sem:#{@ab[:inst]}>}).
+ gsub(/;\{([^}]+(?![;]))\};dept\b/m, %{<sem:#{@ab[:dpt]} depth="zero">\\1</sem:#{@ab[:dept]}>}).
+ gsub(/;\{([^}]+(?![;]))\};org\b/m, %{<sem:#{@ab[:org]} depth="zero">\\1</sem:#{@ab[:org]}>}).
+ gsub(/;\{([^}]+(?![;]))\};com?\b/m, %{<sem:#{@ab[:com]} depth="zero">\\1</sem:#{@ab[:com]}>}).
+ gsub(/;\{([^}]+(?![;]))\};cty\b/m, %{<sem:#{@ab[:cty]} depth="zero">\\1</sem:#{@ab[:cty]}>}).
+ gsub(/;\{([^}]+(?![;]))\};([a-z]+(?:[_:.][a-z]+)*)/m,'<sem:\2 depth="zero">\1</sem:\2>')
+ end
+ dob
+ end
+ end
+end
+module SiSU_XML_Tags #Format
+ require_relative 'param' # param.rb
+ include SiSU_Param
+ include SiSU_Viz
+ class RDF
+ def initialize(md='',seg_name=[],tracker=0)
+ @full_title=@subtitle=@author=@subject=@description=@publisher=@contributor=@date=@date_created=@date_issued=@date_available=@date_valid=@date_modified=@type=@format=@identifier=@source=@language=@relation=@coverage=@rights=@copyright=@owner=@keywords=''
+ @md=md
+ @rdfurl=%{ rdf:about="http://www.jus.uio.no/lm/toc"\n}
+ if defined? @md.title.full \
+ and @md.title.full # DublinCore 1 - title
+ @rdf_title=%{ dc.title="#{seg_name}#{@md.title.full}"\n}
+ @full_title=%{ <meta name="dc.title" content="#{@md.title.full}" />\n}
+ end
+ if defined? @md.creator.author \
+ and @md.creator.author=~/\S+/ # DublinCore 2 - creator/author (author)
+ @rdf_author=%{ dc.author="#{@md.creator.author}"\n}
+ content=meta_content_clean(@md.creator.author)
+ @author=%{ <meta name="dc.author" content="#{content}" />\n}
+ end
+ if defined? @md.publisher \
+ and @md.publisher # DublinCore 5 - publisher (current copy published by)
+ @rdf_publisher=%{ dc.publisher="#{@md.publisher}"\n}
+ content=meta_content_clean(@md.publisher)
+ @publisher=%{ <meta name="dc.publisher" content="#{content}" />\n}
+ end
+ if defined? @md.creator.contributor \
+ and @md.creator.contributor=~/\S+/ # DublinCore 6 - contributor
+ @rdf_contributor=%{ dc.contributor="#{@md.creator.contributor}"\n}
+ content=meta_content_clean(@md.creator.contributor)
+ @contributor=%{ <meta name="dc.contributor" content="#{content}" />\n}
+ end
+ if defined? @md.date.published \
+ and @md.date.published=~/\S+/ # DublinCore 7 - date year-mm-dd
+ @rdf_date=%{ dc.date="#{@md.date.published}"\n}
+ @date=%{ <meta name="dc.date" content="#{@md.date.published}" #{@md.date_scheme} />\n} # fix @md.date_scheme
+ end
+ if defined? @md.date.created \
+ and @md.date.created=~/\S+/ # DublinCore 7 - date.created year-mm-dd
+ @rdf_date_created=%{ dc.date.created="#{@md.date.created}"\n}
+ @date_created=%{ <meta name="dc.date.created" content="#{@md.date.created}" #{@md.date_scheme} />\n}
+ end
+ if defined? @md.date.issued \
+ and @md.date.issued=~/\S+/ # DublinCore 7 - date.issued year-mm-dd
+ @rdf_date_issued=%{ dc.date.issued="#{@md.date.issued}"\n}
+ @date_issued=%{ <meta name="dc.date.issued" content="#{@md.date.issued}" #{@md.date_scheme} />\n}
+ end
+ if defined? @md.date.available \
+ and @md.date.available=~/\S+/ # DublinCore 7 - date.available year-mm-dd
+ @rdf_date_available=%{ dc.date.available="#{@md.date.available}"\n}
+ @date_available=%{ <meta name="dc.date.available" content="#{@md.date.available}" #{@md.date_scheme} />\n}
+ end
+ if defined? @md.date.valid \
+ and @md.date.valid=~/\S+/ # DublinCore 7 - date.valid year-mm-dd
+ @rdf_date_valid=%{ dc.date.valid="#{@md.date.valid}"\n}
+ @date_valid=%{ <meta name="dc.date.valid" content="#{@md.date.valid}" #{@md.date_scheme} />\n}
+ end
+ if defined? @md.date.modified \
+ and @md.date.modified=~/\S+/ # DublinCore 7 - date.modified year-mm-dd
+ @rdf_date_modified=%{ dc.date.modified="#{@md.date.modified}"\n}
+ @date_modified=%{ <meta name="dc.date.modified" content="#{@md.date.modified}" #{@md.date_scheme} />\n}
+ end
+ if defined? @md.rights.all \
+ and @md.rights.all # DublinCore 15 - rights
+ @rdf_rights=%{ dc.rights="#{@md.rights.all}"\n}
+ content=meta_content_clean(@md.rights.all)
+ @rights=%{ <meta name="dc.rights" content="#{content}" />\n}
+ end
+ if defined? @md.classify.subject \
+ and @md.classify.subject=~/\S+/ # DublinCore 3 - subject (us library of congress, eric or udc, or schema???)
+ @rdf_subject=%{ dc.subject="#{@md.classify.subject}"\n}
+ content=meta_content_clean(@md.classify.subject)
+ @subject=%{ <meta name="dc.subject" content="#{content}" />\n}
+ end
+ if defined? @md.notes.description \
+ and @md.notes.description=~/\S+/ # DublinCore 4 - description
+ @rdf_description=%{ dc.description="#{@md.notes.description}"\n}
+ content=meta_content_clean(@md.notes.description)
+ @description=%{ <meta name="dc.description" content="#{content}" />\n}
+ end
+ if defined? @md.notes.coverage \
+ and @md.notes.coverage=~/\S+/ # DublinCore 14 - coverage
+ @rdf_coverage=%{ dc.coverage="#{@md.notes.coverage}"\n}
+ content=meta_content_clean(@md.notes.coverage)
+ @coverage=%{ <meta name="dc.coverage" content="#{content}" />\n}
+ end
+ if defined? @md.notes.relation \
+ and @md.notes.relation=~/\S+/ # DublinCore 13 - relation
+ @rdf_relation=%{ dc.relation="#{@md.notes.relation}"\n}
+ content=meta_content_clean(@md.notes.relation)
+ @relation=%{ <meta name="dc.relation" content="#{content}" />\n}
+ end
+ if defined? @md.notes.type \
+ and @md.notes.type # DublinCore 8 - type (genre eg. report, convention etc)
+ @rdf_type=%{ dc.type="#{@md.notes.type}"\n}
+ content=meta_content_clean(@md.notes.type)
+ @type=%{ <meta name="dc.type" content="#{content}" />\n}
+ end
+ if defined? @md.notes.format \
+ and @md.notes.format=~/\S+/ # DublinCore 9 - format (use your mime type)
+ @rdf_format=%{ dc.format="#{@md.notes.format}"\n}
+ content=meta_content_clean(@md.notes.format)
+ @format=%{ <meta name="dc.format" content="#{content}" />\n}
+ end
+ #if defined? @md.identifier.sisupod \
+ #and @md.identifier.sisupod=~/\S+/ # DublinCore 10 - identifier (your identifier, could use urn which is free)
+ # @rdf_identifier=%{ dc.identifier="#{@md.identifier.sisupod}"\n}
+ # content=meta_content_clean(@md.identifier.sisupod)
+ # @identifier=%{ <meta name="dc.identifier" content="#{content}" />\n}
+ #end
+ if defined? @md.original.source \
+ and @md.original.source=~/\S+/ # DublinCore 11 - source (document source)
+ @rdf_source=%{ dc.source="#{@md.original.source}"\n}
+ content=meta_content_clean(@md.original.source)
+ @source=%{ <meta name="dc.source" content="#{content}" />\n}
+ end
+ if defined? @md.title.language \
+ and @md.title.language=~/\S+/ # DublinCore 12 - language (English)
+ @rdf_language=%{ dc.language="#{@md.title.language}"\n}
+ @language=%{ <meta name="dc.language" content="#{@md.title.language}" />\n}
+ end
+ if defined? @md.original.language \
+ and @md.original.language=~/\S+/
+ @rdf_language_original=%{ dc.language="#{@md.original.language}"\n}
+ @language_original=%{ <meta name="dc.language" content="#{@md.original.language}" />\n}
+ end
+ content=meta_content_clean(@md.keywords)
+ @keywords=%{ <meta name="keywords" content="#{content}" />\n} if @md.keywords
+ @vz=SiSU_Viz::Defaults.new
+ end
+ def meta_content_clean(content='')
+ content
+ unless content.nil?
+ content=content.tr('"',"'")
+ content=SiSU_XML_Munge::Trans.new(@md).char_enc.utf8(content)
+ end
+ content
+ end
+ def rdfseg #segHead
+ rdftoc
+ end
+ def comment_xml(extra='')
+ generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version]
+ lastdone="Last Generated on: #{Time.now}"
+ rubyv="Ruby version: #{@md.ruby_version}"
+ sc=if @md.sc_info
+ "Source file: #{@md.sc_filename} version: #{@md.sc_number} of: #{@md.sc_date}"
+ else ''
+ end
+ if extra.empty?
+<<WOK
+<!-- Document processing information:
+ * #{generator}
+ * #{rubyv}
+ * #{sc}
+ * #{lastdone}
+ * SiSU http://www.jus.uio.no/sisu
+-->
+WOK
+ else
+<<WOK
+<!-- Document processing information:
+ * #{extra}
+ * #{generator}
+ * #{rubyv}
+ * #{sc}
+ * #{lastdone}
+ * SiSU http://www.jus.uio.no/sisu
+-->
+WOK
+ end
+ end
+ def comment_xml_sax
+ desc='SiSU XML, SAX type representation'
+ comment_xml(desc)
+ end
+ def comment_xml_node
+ desc='SiSU XML, Node type representation'
+ comment_xml(desc)
+ end
+ def comment_xml_dom
+ desc='SiSU XML, DOM type representation'
+ comment_xml(desc)
+ end
+ def metatag_html #values strung together, because some empty, and resulting output (line breaks) is much better
+<<WOK
+#{@full_title}#{@subtitle}#{@author}#{@subject}#{@description}#{@publisher}#{@contributor}#{@date}#{@date_created}#{@date_issued}#{@date_available}#{@date_valid}#{@date_modified}#{@type}#{@format}#{@identifier}#{@source}#{@language}#{@relation}#{@coverage}#{@rights}#{@copyright}#{@owner}
+#{@vz.txt_generator}
+#{@vz.png_ico}
+WOK
+ end
+ end
+end
+module SiSU_Tables
+ require_relative 'xml_tables' # xml_tables.rb
+end
+__END__
diff --git a/lib/sisu/v4/sisupod_make.rb b/lib/sisu/v4/sisupod_make.rb
new file mode 100644
index 00000000..bea6e775
--- /dev/null
+++ b/lib/sisu/v4/sisupod_make.rb
@@ -0,0 +1,149 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: create sisupod filetype and copy it to output directory!
+
+=end
+module SiSU_Doc
+ require_relative 'shared_sisupod_source' # shared_sisupod_source.rb
+ include SiSU_Source
+ require_relative 'sysenv' # sysenv.rb
+ include SiSU_Env
+ class Source < SiSU_Source::SiSUpodSource
+ require_relative 'response' # response.rb
+ def initialize(opt,build=nil,place=nil)
+ super(opt,build,place)
+ @zipfile=@opt.fno.gsub(/(?:\~\S{2,3})?(\.ss[tm])$/,'\1')
+ @ans=SiSU_Response::Response.new
+ if @opt.cmd=~/[MVv]/
+ SiSU_Screen::Ansi.new(@opt.cmd,'Assemble source for sisu document',"#{@opt.fns} -> file://#{@file.output_path.sisupod.dir}/#{@zipfile}.txz").warn
+ end
+ end
+ def sisupod_tar_xz
+ begin
+ FileUtils::mkdir_p(@file.output_path.sisupod.dir) unless FileTest.directory?(@file.output_path.sisupod.dir)
+ tree=(@opt.cmd =~/[vVM]/ \
+ && SiSU_Env::SystemCall.new.program_found?('tree')) \
+ ? 'tree sisupod'
+ : ''
+ if FileTest.directory?(@path_pod[:fnb])
+ Dir.chdir(@path_pod[:fnb])
+ system(%{
+ #{tree}
+ tar -cJf #{@zipfile}.txz sisupod
+ #echo "#{@file.place_file.sisupod.dir}"
+ })
+ FileUtils::mv("#{@zipfile}.txz",@file.place_file.sisupod.dir)
+ Dir.chdir(@env.path.pwd)
+ SiSU_Screen::Ansi.new('',"#{@opt.fns}.txz").blue_tab if @opt.cmd=~/[MVv]/
+ else
+ SiSU_Screen::Ansi.new('',"#{@opt.fns}.txz not built").blue_tab if @opt.cmd=~/[MVv]/
+ end
+ rescue
+ ensure
+ end
+ end
+ end
+end
+__END__
+question?: should you permit the packing of multiple documents in single .xz ?
+
+ open @opt.fns, parse file
+ extract from file content:
+ images and copy each image from whatever image source to _sisu/sisupod/sisu/_sisu/image
+
+ remove previously existing contents of _/sisu/sisupod &
+ make directory structure:
+
+v3 -->
+ _sisu
+ sisupod
+ doc
+ manifest.txt
+ en/content.sst [file content]
+ fr/content.sst
+ _sisu
+ conf
+ image (ln -s ../../image)
+ audio (ln -s ../../audio)
+ video (ln -s ../../video)
+ image [all images for specific document gathered here]
+ audio
+ video
+
+v2 -->
+ _sisu
+ sisupod
+ content.sst [file content]
+ filename.sst [link to content.sst]
+ _sisu/
+ image/ [all images for specific document gathered here]
+
+sisu
+ _sisu
+ sisurc.yml
+ convert/
+ standard_terms/
+ image
+ processing
+ dal/
+ tex/
+ texinfo/
+ tune/
+ sisupod
+
+special case
+
+composite file (master), e.g.
+SiSU.ssm
diff --git a/lib/sisu/v2/sitemaps.rb b/lib/sisu/v4/sitemaps.rb
index 87bd21c0..d45af899 100644
--- a/lib/sisu/v2/sitemaps.rb
+++ b/lib/sisu/v4/sitemaps.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -57,15 +56,13 @@
=end
module SiSU_Sitemaps
- require "#{SiSU_lib}/param" # param.rb
+ require_relative 'param' # param.rb
include SiSU_Param
- require "#{SiSU_lib}/sysenv" # sysenv.rb
+ require_relative 'sysenv' # sysenv.rb
include SiSU_Env
- require "#{SiSU_lib}/shared_xml" # shared_xml.rb
- include SiSU_XML_munge
+ require_relative 'shared_xml' # shared_xml.rb
+ include SiSU_XML_Munge
class Source
- require 'fileutils'
- include FileUtils
def initialize(opt)
@opt=opt
end
@@ -74,46 +71,46 @@ module SiSU_Sitemaps
end
def songsheet
begin
- @sys=SiSU_Env::System_call.new
- fn_set_lang=SiSU_Env::Standardise_language.new.file_to_language(@opt.fns)
- @fn=SiSU_Env::Env_call.new(@opt.fns).lang(fn_set_lang[:c])
+ @sys=SiSU_Env::SystemCall.new
+ fn_set_lang=SiSU_Env::StandardiseLanguage.new(@opt.lng).language
+ @fn=SiSU_Env::EnvCall.new(@opt.fns).lang(fn_set_lang[:c])
if @opt.cmd =~/Y/
@md=SiSU_Param::Parameters.new(@opt).get
- @trans=SiSU_XML_munge::Trans.new(@md) #check @md is required
- @env=SiSU_Env::Info_env.new(@md.fns)
- @rdf=SiSU_XML_tags::RDF.new(@md)
+ @trans=SiSU_XML_Munge::Trans.new(@md) #check @md is required
+ @env=SiSU_Env::InfoEnv.new(@md.fns)
+# @file=SiSU_Env::FileOp.new(@md)
+ @rdf=SiSU_XML_Tags::RDF.new(@md)
@fnb_utf8_xml=@md.fnb.dup
@trans.char_enc.utf8(@fnb_utf8_xml) if @sys.locale =~/utf-?8/i #% utf8
output_map(sitemap)
elsif @opt.mod.inspect =~/--sitemaps/
@sitemap_idx_fn='sitemapindex.xml'
- @env=SiSU_Env::Info_env.new
+ @env=SiSU_Env::InfoEnv.new
output_idx(sitemap_index)
SiSU_Screen::Ansi.new(@opt.cmd,"sitemap index:","#{@env.path.output}/#{@sitemap_idx_fn}").result unless @opt.cmd =~/q/
end
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
ensure
end
end
def make_file(path,filename)
- if File.writable?("#{path}/."); File.new("#{path}/#{filename}",'w+')
- else
- SiSU_Screen::Ansi.new('',"is the file or directory writable?, could not create #{filename}").warn
- end
- end
- def make_path(path)
- mkdir_p(path) unless FileTest.directory?(path)
+ (File.writable?("#{path}/.")) \
+ ? (File.new("#{path}/#{filename}",'w+'))
+ : (SiSU_Screen::Ansi.new('',"is the file or directory writable?, could not create #{filename}").warn)
end
def output_map(sitemap)
- path="#{@env.path.output}/#{@md.fnb}"
+ path=@md.file.output_path.sitemaps.dir
filename=@fn[:sitemap]
- touch_path=@env.path.sitemaps
+ touch_path=@md.file.output_path.sitemaps.dir
touch_filename=@fn[:sitemap_touch]
- SiSU_Env::SiSU_file.new(@md).make_path(path)
- file=SiSU_Env::SiSU_file.new(@md).make_file(path,filename)
+ SiSU_Env::FileOp.new(@md).make_path(path)
+ file=SiSU_Env::FileOp.new(@md).make_file(path,filename)
file << sitemap
if FileTest.file?("#{touch_path}/#{touch_filename}")
- rm("#{touch_path}/#{touch_filename}")
+ FileUtils::rm("#{touch_path}/#{touch_filename}")
end
end
def output_idx(sitemap)
diff --git a/lib/sisu/v2/spell.rb b/lib/sisu/v4/spell.rb
index fed55cab..e0a8fbc3 100644
--- a/lib/sisu/v2/spell.rb
+++ b/lib/sisu/v4/spell.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -56,7 +55,7 @@
** Description: spellchecking
=end
-module Utility
+module SiSU_SpellUtility
class Spell
def initialize(input,filesrc,flg)
@flg=flg
@@ -70,23 +69,23 @@ module Utility
end
def check
@input.each do |data|
- data.gsub!(/(https?|www|ftp|gopher|png|jpg|gif|html|htm)\S+/i,' ')
- data.gsub!(/(&nbsp;|#{Mx[:nbsp]})/i,' ')
- data.gsub!(/<\/?(table|tr|td|b|p|href).*?>/i,' ')
- data.gsub!(/(<==.+|<:\S+>|<!.+?!>|^@\S+?:.+|\{\{\{|~)/,' ')
- data.gsub!(/(["|<>)(\n'`'.;&_-]|\=)/,' ')
- data.gsub!(/\b(altExternal|
- target|externalimg|
- srcimagebext|
- img|src|toc|pdf|
- cd|org|
- helvetica|roman
- )\b/i,' ')
- data.gsub!(/EOF/,'')
+ data=data.gsub(/(https?|www|ftp|gopher|png|jpg|gif|html|htm)\S+/i,' ').
+ gsub(/(&nbsp;|#{Mx[:nbsp]})/i,' ').
+ gsub(/<\/?(table|tr|td|b|p|href).*?>/i,' ').
+ gsub(/(<==.+|<:\S+>|<!.+?!>|^@\S+?:.+|\{\{\{|~)/,' ').
+ gsub(/(["|<>)(\n'`'.;&_-]|\=)/,' ').
+ gsub(/\b(altExternal|
+ target|externalimg|
+ srcimagebext|
+ img|src|toc|pdf|
+ cd|org|
+ helvetica|roman
+ )\b/i,' ').
+ gsub(/EOF/,'')
@words=data.scan(/\S+/)
@words.each { |y| @allwords << y }
end
- @allwords.uniq!
+ @allwords=@allwords.uniq
if @flg =~ /S/
File.open('/home/ralph/spell_error','a+') do |file| #fix
file.puts %{\n\n<<#{@filename}>>}
diff --git a/lib/sisu/v2/sst_convert_markup.rb b/lib/sisu/v4/sst_convert_markup.rb
index 25d12d07..20b6d775 100644
--- a/lib/sisu/v2/sst_convert_markup.rb
+++ b/lib/sisu/v4/sst_convert_markup.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -59,16 +58,10 @@
=end
module SiSU_Modify
- require "#{SiSU_lib}/sst_identify_markup" # sst_identify_markup.rb
- require "#{SiSU_lib}/sst_from_kdissert" # sst_from_kdissert.rb
- require "#{SiSU_lib}/sst_to_s_xml_sax" # sst_to_s_xml_sax.rb
- require "#{SiSU_lib}/sst_to_s_xml_dom" # sst_to_s_xml_dom.rb
- require "#{SiSU_lib}/sst_to_s_xml_node" # sst_to_s_xml_node.rb
- require "#{SiSU_lib}/sst_from_xml" # sst_from_xml.rb
- require "#{SiSU_lib}/response" # response.rb
- class Convert_markup
- require 'fileutils'
- include FileUtils #::Verbose
+ require_relative 'sst_identify_markup' # sst_identify_markup.rb
+ require_relative 'sst_from_xml' # sst_from_xml.rb
+ require_relative 'response' # response.rb
+ class ConvertMarkup
def initialize(opt)
@opt=opt
@description='This is a script that contains canned text conversions for reuse'
@@ -172,14 +165,14 @@ WOK
unless f==s
unless File.exist?("#{pwd}/#{s}")
puts "./#{f} -> ./#{s}"
- cp("#{pwd}/#{f}","#{pwd}/#{s}")
+ FileUtils::cp("#{pwd}/#{f}","#{pwd}/#{s}")
else "File already exists, < #{s} > will not overwrite"
end
end
end
end
def convert_to_simple_xml_model_sax
- SiSU_simple_xml_model_sax::Convert.new(@opt).read
+ SiSU_SimpleXML_ModelSax::Convert.new(@opt).read
end
def convert_to_simple_xml_model_dom
SiSU_simple_xml_model_dom::Convert.new(@opt).read
@@ -191,11 +184,11 @@ WOK
SiSU_Kdissert::Convert.new(@opt).read
end
def convert_s_xml_to_sst
- SiSU_sst_from_xml::Convert.new(@opt).read
+ SiSU_sstFromXML::Convert.new(@opt).read
end
def convert_footnotes
- require "#{SiSU_lib}/sst_do_inline_footnotes"
- SiSU_Convert_footnotes::Source.new(@opt).read
+ require_relative 'sst_do_inline_footnotes'
+ SiSU_ConvertFootnotes::Source.new(@opt).read
end
def conversion
#%% do it -------------------------->
@@ -203,7 +196,7 @@ WOK
and @opt.files.length > 0
mr=nil
#%% changes to make m match, r replace -------------------------->
- if @opt.mod.inspect =~/--help/; help
+ if @opt.mod.inspect =~/--help/ then help
elsif @opt.mod.inspect =~/(?:convert|to)[=-](?:xml |sxs|sax|sxd|dom|sxn|node)/
ext=case @opt.mod.inspect
when /(?:convert|to)[=-](?:xml|sxs|sax)/; '.sxs.xml'
@@ -237,7 +230,7 @@ WOK
if i =~/(?:\.sst|\.ssm|\.ssi)$/
@new,@matched,@flag_start,@flag_end,@empty1,@empty2=true,false,false,false,false,false
o="#{i}.bk" #o is for old
- markup_version=SiSU_Markup::Markup_identify.new(@opt).markup_version?
+ markup_version=SiSU_Markup::MarkupIdentify.new(@opt).markup_version?
if (@opt.mod.inspect=~/37/ and markup_version=~/0.38/) \
or (@opt.mod.inspect=~/current|38/ and markup_version=~/0.37/)
puts "#{i} #{markup_version}"
@@ -279,13 +272,13 @@ WOK
end
end
end
- if y=~/^\s*$/; @empty1=true
- else @empty1=false
- end
+ @empty1=(y=~/^\s*$/) \
+ ? true
+ : false
@file.puts y unless (@empty1==true and @empty2==true)
- if y=~/^\s*$/; @empty2=true
- else @empty2=false
- end
+ @empty2=(y=~/^\s*$/) \
+ ? true
+ : false
end
@file.close
else puts "NO conversion match in #{i}" unless @opt.cmd=~/q/
@@ -300,19 +293,19 @@ WOK
end
end
#%% files to match for this conversion set ------------------------->
-require "#{SiSU_lib}/options" # options.rb
+require_relative 'options' # options.rb
argv=$*
-@opt=SiSU_commandline::Options.new(argv)
+@opt=SiSU_Commandline::Options.new(argv)
case @opt.mod.inspect
when /=kdi/
- SiSU_Modify::Convert_markup.new(@opt).conversion
+ SiSU_Modify::ConvertMarkup.new(@opt).conversion
when /(?:36|37|38)?to-?(?:37|38)|--convert|--to|--from|default/
@opt.files.each do |fns|
@opt.fns=fns
- SiSU_Modify::Convert_markup.new(@opt).conversion
+ SiSU_Modify::ConvertMarkup.new(@opt).conversion
end
else
@opt.mod='--help'
- SiSU_Modify::Convert_markup.new(@opt).help
+ SiSU_Modify::ConvertMarkup.new(@opt).help
end
__END__
diff --git a/lib/sisu/v2/sst_do_inline_footnotes.rb b/lib/sisu/v4/sst_do_inline_footnotes.rb
index f114d97a..b395af55 100644
--- a/lib/sisu/v2/sst_do_inline_footnotes.rb
+++ b/lib/sisu/v4/sst_do_inline_footnotes.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,26 +46,26 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
<ralph.amissah@gmail.com>
- ** Description: preprocessing, (dal), data abstraction used in subsequent
- processing
+ ** Description: preprocessing, convert bi-footnotemarker-footnote to inline
+ footnotes, invoked using: sisu --to-footnotes filename.sst
=end
-module SiSU_Convert_footnotes
- require "#{SiSU_lib}/defaults" # defaults.rb
+module SiSU_ConvertFootnotes
+ require_relative 'defaults' # defaults.rb
include SiSU_Viz
- require "#{SiSU_lib}/sysenv" # sysenv.rb
+ require_relative 'sysenv' # sysenv.rb
include SiSU_Env
- require "#{SiSU_lib}/param" # param.rb
+ require_relative 'param' # param.rb
include SiSU_Param
- require "#{SiSU_lib}/dal_syntax" # dal_syntax.rb
- include SiSU_Syntax
- require "#{SiSU_lib}/i18n" # i18n.rb
+ require_relative 'dal_syntax' # dal_syntax.rb
+ include SiSU_DAL_Syntax
+ require_relative 'i18n' # i18n.rb
class Instantiate < SiSU_Param::Parameters::Instructions
@@flag={} #Beware!!
def initialize
@@ -84,9 +83,8 @@ module SiSU_Convert_footnotes
def initialize(opt)
@opt=opt
@@fns||@opt.fns
- @my_make_fns=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns)
- @fnm=@my_make_fns.dal_content
- SiSU_Env::Create_system_link.new.images
+ @my_make=SiSU_Env::CreateFile.new(@opt.fns)
+ @fnm=SiSU_Env::InfoFile.new(@opt.fns).marshal.dal_content
end
def read #creates dal
begin
@@ -94,7 +92,10 @@ module SiSU_Convert_footnotes
@@dal_array=[]
@@fns=@opt.fns
create_dal
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
ensure
Instantiate.new
end
@@ -106,10 +107,13 @@ module SiSU_Convert_footnotes
@@fns=@opt.fns
@@dal_array=[]
end
- dal=if @@dal_array.empty?; read_fnm
- else @@dal_array.dup #check
+ dal=(@@dal_array.empty?) \
+ ? read_fnm
+ : @@dal_array.dup #check
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
end
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
ensure
Instantiate.new
end
@@ -120,37 +124,37 @@ module SiSU_Convert_footnotes
SiSU_Screen::Ansi.new(@opt.cmd,'convert footnotes').green_title_hi unless @opt.cmd =~/q/
file_array=IO.readlines(@opt.fns,'')
file_array.each do |l|
- if l =~/\r\n/; l.gsub!(/\r\n/,"\n")
+ if l =~/\r\n/ then l.gsub!(/\r\n/,"\n")
end
end
meta=file_array.dup
meta=meta.join.split("\n\n") #check whether can be eliminated, some of these are large objects to have twice
@md=SiSU_Param::Parameters::Instructions.new(meta,@opt).extract
if @md.en[:mismatch]==0 \
- or @md.mod.inspect =~/=footnotes-force/
+ or @md.opt.mod.inspect =~/=footnotes-force/
meta=nil
- dal=SiSU_Convert_footnotes::Make.new(@md,file_array).song
- SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@md.fns}.fn").output if @md.cmd =~/v/
- SiSU_Screen::Ansi.new(@opt.cmd,"#{@md.fns}.fn -> #{@md.fns}.fn").txt_red unless @md.cmd =~/q/
- dal.each{|s| dal_array << "#{s.strip}\n\n" unless s.strip.empty?}
+ dal=SiSU_ConvertFootnotes::Make.new(@md,file_array).song
+ SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@md.fns}.fn").output if @md.opt.cmd =~/v/
+ SiSU_Screen::Ansi.new(@opt.cmd,"#{@md.fns}.fn -> #{@md.fns}.fn").txt_red unless @md.opt.cmd =~/q/
+ dal.each {|s| dal_array << "#{s.strip}\n\n" unless s.strip.empty?}
dal_array
else
- SiSU_Screen::Ansi.new(@md.cmd,'no footnote conversion done, problem with source file','to override use --convert=footnote-force (this is not advised)').warn if @cmd !~/q/
+ SiSU_Screen::Ansi.new(@md.opt.cmd,'*WARN* no footnote conversion done, problem with source file','to override use --convert=footnote-force (this is not advised)').warn if @cmd !~/q/
''
end
end
def read_fnm
dal=[]
- dal=if FileTest.file?(@fnm); File.open(@fnm){ |f| dal=Marshal.load(f)}
- else SiSU_Convert_footnotes::Source.new(@opt).create_dal #watch
- end
+ dal=(FileTest.file?(@fnm)) \
+ ? (File.open(@fnm){ |f| dal=Marshal.load(f)})
+ : (SiSU_ConvertFootnotes::Source.new(@opt).create_dal) #watch
end
end
class Output
def initialize(md,data)
@md,@data=md,data
- @my_make=SiSU_Env::Create_file.new(@md.cmd,@md.fns)
- dir=SiSU_Env::Info_env.new(@md.fns)
+ @my_make=SiSU_Env::CreateFile.new(@md.fns)
+ dir=SiSU_Env::InfoEnv.new(@md.fns)
@hard="#{Dir.pwd}/#{@md.fns}.fn"
end
def hard_output
@@ -167,10 +171,9 @@ module SiSU_Convert_footnotes
def initialize(md,data)
@md,@data=md,data
@@word_mode=[]
- @env=SiSU_Env::Info_env.new(@md.fns)
- @skin=SiSU_Env::Info_skin.new(@md)
- l=SiSU_Env::Standardise_language.new.file_to_language(@md.fns)
- @language=l[:l]
+ @env=SiSU_Env::InfoEnv.new(@md.fns)
+ l=SiSU_Env::StandardiseLanguage.new(@md.opt.lng).language
+ @language=l[:n]
@translate=SiSU_Translate::Source.new(@md,@language)
end
def reset
@@ -183,20 +186,20 @@ module SiSU_Convert_footnotes
def song
reset
data=@data
- @metafile="#{@env.path.dal}/#{@md.fns}.meta"
- my_make_source_file=SiSU_Env::Create_file.new(@md.cmd,@md.fns)
+ @metafile="#{@env.processing_path.dal}/#{@md.fns}.meta"
+ my_make_source_file=SiSU_Env::CreateFile.new(@md.fns)
data=data.join.split("\n\n")
data_new=[]
data.each do |x|
- data_new << if x =~ /\n\n/m; x.split(/\n\n+/)
- else x
- end
+ data_new << (x =~ /\n\n/m) \
+ ? (x.split(/\n\n+/))
+ : x
end
data=data_new.flatten
- data=SiSU_Convert_footnotes::Make.new(@md,data).substitutions_and_insertions?
- data=SiSU_Convert_footnotes::Make.new(@md,data).character_check
- data=SiSU_Convert_footnotes::Make.new(@md,data).endnotes
- SiSU_Convert_footnotes::Output.new(@md,data).hard_output
+ data=SiSU_ConvertFootnotes::Make.new(@md,data).substitutions_and_insertions?
+ data=SiSU_ConvertFootnotes::Make.new(@md,data).character_check
+ data=SiSU_ConvertFootnotes::Make.new(@md,data).endnotes
+ SiSU_ConvertFootnotes::Output.new(@md,data).hard_output
reset
data
end
@@ -216,7 +219,6 @@ module SiSU_Convert_footnotes
tuned_file
end
def character_check
- require 'iconv'
reset
data=@data
@tuned_file=[]
@@ -271,34 +273,33 @@ module SiSU_Convert_footnotes
end
if para =~/<:insert\d+!?>/ \
and para !~/^%\s+/
- @skin.select
ins=SiSU_Viz::Inserts.new
case para
when /^\s*<:insert1>\s*$/
para=[]
- ins.insert1.split(/\n\n/).each{|x| para << x }
+ ins.insert1.split(/\n\n/).each {|x| para << x }
when /^\s*<:insert2>\s*$/
para=[]
- ins.insert2.split(/\n\n/).each{|x| para << x }
+ ins.insert2.split(/\n\n/).each {|x| para << x }
when /^\s*<:insert3>\s*$/
para=[]
- ins.insert3.split(/\n\n/).each{|x| para << x << "\n"}
+ ins.insert3.split(/\n\n/).each {|x| para << x << "\n"}
para=ins.insert3
when /^\s*<:insert4>\s*$/
para=[]
- ins.insert4.split(/\n\n/).each{|x| para << x << "\n"}
+ ins.insert4.split(/\n\n/).each {|x| para << x << "\n"}
para=ins.insert4
when /^\s*<:insert5>\s*$/
para=[]
- ins.insert5.split(/\n\n/).each{|x| para << x << "\n"}
+ ins.insert5.split(/\n\n/).each {|x| para << x << "\n"}
when /^\s*<:insert6>\s*$/
para=[]
- ins.insert6.split(/\n\n/).each{|x| para << x << "\n"}
+ ins.insert6.split(/\n\n/).each {|x| para << x << "\n"}
when /^\s*<:insert7>\s*$/
para=[]
- ins.insert7.split(/\n\n/).each{|x| para << x << "\n"}
+ ins.insert7.split(/\n\n/).each {|x| para << x << "\n"}
end
- para.each{|x| tuned_file << x }
+ para.each {|x| tuned_file << x }
else tuned_file << para
end
tuned_file.compact!
@@ -349,7 +350,7 @@ module SiSU_Convert_footnotes
end
def set_heading_top #% make sure no false positives
unless @md.set_heading_top
- puts "\tdocument contains no top level heading, (will have to manufacture one)" if @md.cmd =~/[MV]/
+ puts "\tdocument contains no top level heading, (will have to manufacture one)" if @md.opt.cmd =~/[MV]/
data=@data
@tuned_file=[]
data.each do |para|
@@ -357,9 +358,9 @@ module SiSU_Convert_footnotes
if para !~/^(?:@\S+:|0~\S+)\s/m \
and para !~/\A\s*\Z/m
@md.set_heading_top=true
- head=if @md.title.full ; ":A~ #{@md.title.full}"
- else ':A~ [no title provided]'
- end
+ head=(@md.title.full) \
+ ? (":A~ #{@md.title.full}")
+ : (':A~ [no title provided]')
@tuned_file << head
end
end
@@ -370,7 +371,7 @@ module SiSU_Convert_footnotes
end
def set_heading_seg #% make sure no false positives
unless @md.set_heading_seg
- puts "\tdocument contains no segment level, (will have to manufacture one)" if @md.cmd =~/[MV]/
+ puts "\tdocument contains no segment level, (will have to manufacture one)" if @md.opt.cmd =~/[MV]/
data=@data
@tuned_file=[]
data.each do |para|
@@ -379,9 +380,9 @@ module SiSU_Convert_footnotes
and para !~/\A\s*\Z/m \
and para !~/<:p[bn]>/
@md.set_heading_seg=true
- head=if @md.title.full ; "1~seg [#{@md.title.full}]"
- else '1~seg [segment]'
- end
+ head=(@md.title.full) \
+ ? ("1~seg [#{@md.title.full}]")
+ : ('1~seg [segment]')
@tuned_file << head
end
end
@@ -392,7 +393,7 @@ module SiSU_Convert_footnotes
end
def set_header_title #% make sure no false positives
unless @md.set_header_title
- puts "\t no document title provided, (will have to manufacture one)" if @md.cmd =~/[MV]/
+ puts "\t no document title provided, (will have to manufacture one)" if @md.opt.cmd =~/[MV]/
data=@data
@tuned_file=[]
data.each do |para|
@@ -419,12 +420,12 @@ module SiSU_Convert_footnotes
when /~\{\s+.+?\}~/ # auto-numbered endnotes <!e!> <!e_!> -->
para.gsub!(/\s*\}~/,' }~') # required 2003w31
@word_mode=para.scan(/\S+/)
- word_mode=SiSU_Convert_footnotes::Make.new(@md,@word_mode).endnote_call_number
+ word_mode=SiSU_ConvertFootnotes::Make.new(@md,@word_mode).endnote_call_number
para=word_mode.join(' ')
endnote_ref+=1
when /~\^(?:\s|$)|<:e>/ #%Note inserts endnotes previously gathered from /^(<!e[:_]!>|[-~]\{{3})/ (in earlier loop)
word_mode=para.scan(/\S+/)
- word_mode=SiSU_Convert_footnotes::Make.new(@md,word_mode).endnote_call_number
+ word_mode=SiSU_ConvertFootnotes::Make.new(@md,word_mode).endnote_call_number
para=word_mode.join(' ')
endnote_ref+=1
end
@@ -469,3 +470,5 @@ module SiSU_Convert_footnotes
end
end
__END__
+@particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)
+dal_array=@particulars.dal_array # dal file drawn here
diff --git a/lib/sisu/v2/sst_from_xml.rb b/lib/sisu/v4/sst_from_xml.rb
index b41934d8..ab55f0de 100644
--- a/lib/sisu/v2/sst_from_xml.rb
+++ b/lib/sisu/v4/sst_from_xml.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -57,15 +56,15 @@
(master document)
=end
-module SiSU_sst_from_xml
- require "#{SiSU_lib}/sysenv" # sysenv.rb
+module SiSU_sstFromXML
+ require_relative 'sysenv' # sysenv.rb
class Convert
require 'rexml/document'
include REXML
def initialize(opt)
@opt=opt
@sisu,@sisu_base=[],[]
- @ver=SiSU_Env::Info_version.instance.get_version
+ @ver=SiSU_Env::InfoVersion.instance.get_version
end
def tell(filename,type)
SiSU_Screen::Ansi.new(@opt.cmd,"XML #{type} to SiSU sst","#{filename} --> #{filename}.sst").green_hi_blue
diff --git a/lib/sisu/v2/sst_identify_markup.rb b/lib/sisu/v4/sst_identify_markup.rb
index a6f2a550..012475be 100644
--- a/lib/sisu/v2/sst_identify_markup.rb
+++ b/lib/sisu/v4/sst_identify_markup.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -59,7 +58,7 @@
=end
module SiSU_Markup
- class Markup_inform
+ class MarkupInform
attr_accessor :version
def initialize(version,message,declared_markup='',declared_type='')
@version,@message,@declared_markup,@declared_type=version,message,declared_markup,declared_type
@@ -77,10 +76,10 @@ module SiSU_Markup
@declared_type
end
def history
- Markup_history.new(@version).query
+ MarkupHistory.new(@version).query
end
end
- class Markup_identify
+ class MarkupIdentify
def initialize(opt)
@opt=opt
@description='This is a script attempts to identify the version of markup used in SiSU (and provides information on changes in markup)'
@@ -121,14 +120,14 @@ WOK
if @flag_2_0 \
or y =~/^@make:|^@classify|^\s\s?:[a-z_-]+?:\s+\S/
version=2.0.to_f
- markup=Markup_inform.new(version,'2.0' + oldlinks,@declared_markup,@declared_type)
+ markup=MarkupInform.new(version,'2.0' + oldlinks,@declared_markup,@declared_type)
@flag_2_0=true
break
end
unless @flag_38
if (y =~/^:?A~/ and f =~/(?:\.sst|\.ssm|\.ssi)/)
version='0.38'
- markup=Markup_inform.new(version,'0.38' + oldlinks,@declared_markup,@declared_type)
+ markup=MarkupInform.new(version,'0.38' + oldlinks,@declared_markup,@declared_type)
@flag_38=true
end
end
@@ -136,14 +135,14 @@ WOK
if @flag_1_0 \
or y =~/^=\{.+?\}\s*$/
version='0.69'
- markup=Markup_inform.new(version,'0.69' + oldlinks,@declared_markup,@declared_type)
+ markup=MarkupInform.new(version,'0.69' + oldlinks,@declared_markup,@declared_type)
@flag_1_0=true
break
end
if @flag_66 \
or y =~/[a-z+][:;]\{.+?\}[:;][a-z+]/
version='0.66'
- markup=Markup_inform.new(version,'0.66' + oldlinks,@declared_markup,@declared_type)
+ markup=MarkupInform.new(version,'0.66' + oldlinks,@declared_markup,@declared_type)
@flag_66=true
break
end
@@ -162,26 +161,26 @@ WOK
if @flag_57 \
or (y =~/^:?A~\?? @title/ and f =~/(?:\.sst|\.ssm|\.ssi)/)
version='0.57'
- markup=Markup_inform.new(version,'0.57' + oldlinks,@declared_markup,@declared_type)
+ markup=MarkupInform.new(version,'0.57' + oldlinks,@declared_markup,@declared_type)
@flag_57=true
break
end
if @flag_38 \
or (y =~/^:?A~/ and f =~/(?:\.sst|\.ssm|\.ssi)/)
version='0.38'
- markup=Markup_inform.new(version,'0.38' + oldlinks,@declared_markup,@declared_type)
+ markup=MarkupInform.new(version,'0.38' + oldlinks,@declared_markup,@declared_type)
@flag_38=true
break if i >= 200
if y =~ /(?:~{\*+|~\[\*|~\[\+)\s/
version='0.42'
- markup=Markup_inform.new(version,'0.42' + oldlinks,@declared_markup,@declared_type)
+ markup=MarkupInform.new(version,'0.42' + oldlinks,@declared_markup,@declared_type)
break
end
end
if (y =~/^1~/ and f =~/(?:\.sst|\.ssm|\.ssi)/) \
and not @flag_38
version='0.37'
- markup=Markup_inform.new(version,'0.37 is substantially 0.16 - 0.36 markup with new file-extension' + oldlinks,@declared_markup,@declared_type)
+ markup=MarkupInform.new(version,'0.37 is substantially 0.16 - 0.36 markup with new file-extension' + oldlinks,@declared_markup,@declared_type)
break
end
if y =~/^1~/ \
@@ -193,31 +192,31 @@ WOK
" (change file extension from .#{t}#{n} to .ssm)"
else " (change file extension from .#{t}#{n} to .sst)"
end
- markup=Markup_inform.new(version,'0.16 - 0.36' + instruct + links,@declared_markup,@declared_type)
+ markup=MarkupInform.new(version,'0.16 - 0.36' + instruct + links,@declared_markup,@declared_type)
break
end
if y =~/^0\{~/ \
and not @flag_38
version='0.1'
- markup=Markup_inform.new(version,'0.1 - 0.15',@declared_markup,@declared_type)
+ markup=MarkupInform.new(version,'0.1 - 0.15',@declared_markup,@declared_type)
break
end
if y =~/^0\{{3}/ \
and not @flag_38
- markup=Markup_inform.new('circa. 1997','old, check date',@declared_markup,@declared_type)
+ markup=MarkupInform.new('circa. 1997','old, check date',@declared_markup,@declared_type)
break
end
markup='Not a recognised file type '
end
end
markup
- else Markup_history.new(@opt).help_query
+ else MarkupHistory.new(@opt).help_query
end
end
def determine_markup_version
if @opt.fns.nil? \
or @opt.fns.empty?
- Markup_history.new(@opt).help_identify
+ MarkupHistory.new(@opt).help_identify
end
if File.exist?(@opt.fns)
if @opt.fns =~/\.(?:sst|ssm|ssi|s[123i]|r[123])/
@@ -237,9 +236,9 @@ WOK
end
else puts 'file not found: ' + @opt.fns
end
- if defined? markup.version; markup.version
- else 'markup type/version not determined'
- end
+ (defined? markup.version) \
+ ? markup.version
+ : 'markup type/version not determined'
end
def markup_version?
if @opt.fns.empty?
@@ -251,10 +250,18 @@ WOK
end
end
end
- class Markup_history
+ class MarkupHistory
def initialize(opt)
@opt=opt
end
+ def sisu_3_0
+ <<WOK
+ SiSU 3.0 same as 2.0, apart from change to headers
+
+ see document markup samples, and sisu --help headers
+
+WOK
+ end
def sisu_2_0
<<WOK
SiSU 2.0 same as 1.0, apart from the changing of headers and the addition of a monospace tag
@@ -427,7 +434,9 @@ WOK
tell=if @opt.mod.inspect =~/--query/
tell=case @opt.mod.inspect
when /history/
- "#{sisu_2_0}#{sisu_1_0}#{sisu_0_69}#{sisu_0_66}#{sisu_0_57}#{sisu_0_42}#{sisu_0_38}\n#{sisu_0_37}\n#{sisu_0_16}\n#{sisu_0_1}"
+ "#{sisu_3_0}#{sisu_2_0}#{sisu_1_0}#{sisu_0_69}#{sisu_0_66}#{sisu_0_57}#{sisu_0_42}#{sisu_0_38}\n#{sisu_0_37}\n#{sisu_0_16}\n#{sisu_0_1}"
+ when /3.0/
+ "#{sisu_3_0}#{sisu_2_0}#{sisu_1_0}#{sisu_0_69}#{sisu_0_66}#{sisu_0_57}#{sisu_0_42}#{sisu_0_38}#{sisu_0_16}"
when /2.0/
"#{sisu_2_0}#{sisu_1_0}#{sisu_0_69}#{sisu_0_66}#{sisu_0_57}#{sisu_0_42}#{sisu_0_38}#{sisu_0_16}"
when /1.0/
@@ -470,5 +479,5 @@ end
puts "SiSU files:"
puts f
f.each do |x|
- SiSU_Markup::Markup_identify.new(x).markup_version?
+ SiSU_Markup::MarkupIdentify.new(x).markup_version?
end
diff --git a/lib/sisu/v2/sst_to_s_xml_sax.rb b/lib/sisu/v4/sst_to_s_xml_sax.rb
index 25dfe927..18ad3955 100644
--- a/lib/sisu/v2/sst_to_s_xml_sax.rb
+++ b/lib/sisu/v4/sst_to_s_xml_sax.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -56,22 +55,22 @@
** Description: simple xml representation (sax style)
=end
-module SiSU_simple_xml_model_sax
- require "#{SiSU_lib}/particulars" # particulars.rb
+module SiSU_SimpleXML_ModelSax
+ require_relative 'particulars' # particulars.rb
include SiSU_Particulars
- require "#{SiSU_lib}/defaults" # defaults.rb
+ require_relative 'defaults' # defaults.rb
include SiSU_Viz
- require "#{SiSU_lib}/param" # param.rb
+ require_relative 'param' # param.rb
include SiSU_Param
- require "#{SiSU_lib}/sysenv" # sysenv.rb
+ require_relative 'sysenv' # sysenv.rb
include SiSU_Env
- require "#{SiSU_lib}/dal_doc_str" # dal_doc_str.rb
- require "#{SiSU_lib}/shared_xml" # shared_xml.rb
- include SiSU_XML_munge
- require "#{SiSU_lib}/shared_sem" # shared_sem.rb
- require "#{SiSU_lib}/xml_format" # xml_format.rb
- include SiSU_XML_format
- require "#{SiSU_lib}/rexml" # rexml.rb
+ require_relative 'dal_doc_str' # dal_doc_str.rb
+ require_relative 'shared_xml' # shared_xml.rb
+ include SiSU_XML_Munge
+ require_relative 'shared_sem' # shared_sem.rb
+ require_relative 'xml_format' # xml_format.rb
+ include SiSU_XML_Format
+ require_relative 'rexml' # rexml.rb
include SiSU_Rexml
@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0
@@tablefoot=''
@@ -79,7 +78,7 @@ module SiSU_simple_xml_model_sax
@@fns=nil
def initialize(opt)
@opt=opt
- @particulars=SiSU_Particulars::Combined_singleton.instance.get_env_md(opt)
+ @particulars=SiSU_Particulars::CombinedSingleton.instance.get_env_md(opt)
end
def read
begin
@@ -100,8 +99,11 @@ module SiSU_simple_xml_model_sax
@fns_array=if @@fns_array.empty?; read_fnm
else @@fns_array.dup #check
end
- SiSU_simple_xml_model_sax::Convert::Songsheet.new(@fns_array,@particulars).songsheet
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
+ SiSU_SimpleXML_ModelSax::Convert::Songsheet.new(@fns_array,@particulars).songsheet
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
ensure #file closed in songsheet
end
end
@@ -109,7 +111,7 @@ module SiSU_simple_xml_model_sax
dal=[]
if FileTest.file?("#{Dir.pwd}/#{@opt.fns}")
dal=IO.readlines("#{Dir.pwd}/#{@opt.fns}","\n\n")
- else puts 'Error'
+ else STDERR.puts 'Error'
end
end
private
@@ -119,28 +121,31 @@ module SiSU_simple_xml_model_sax
end
def songsheet
begin
- SiSU_simple_xml_model_sax::Convert::Scroll.new(@data,@particulars).songsheet
- SiSU_simple_xml_model_sax::Convert::Tidy.new(@md,@env).xml if @md.cmd =~/[vVM]/ # test wellformedness, comment out when not in use
- SiSU_Rexml::Rexml.new(@md,@md.fn[:sxs]).xml if @md.cmd =~/M/ # test rexml parsing, comment out when not in use #debug
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error
+ SiSU_SimpleXML_ModelSax::Convert::Scroll.new(@data,@particulars).songsheet
+ SiSU_SimpleXML_ModelSax::Convert::Tidy.new(@md,@env).xml if @md.opt.cmd =~/[vVM]/ # test wellformedness, comment out when not in use
+ SiSU_Rexml::Rexml.new(@md,@md.fn[:sxs]).xml if @md.opt.cmd =~/M/ # test rexml parsing, comment out when not in use #debug
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
ensure
end
end
end
class Scroll
- require "#{SiSU_lib}/shared_txt" # shared_txt.rb
- require "#{SiSU_lib}/css" # css.rb
- include SiSU_text_utils
- @@xml={ :body=>[],:open=>[],:close=>[],:head=>[] }
+ require_relative 'shared_txt' # shared_txt.rb
+ require_relative 'css' # css.rb
+ include SiSU_TextUtils
+ @@xml={ body: [], open: [], close: [], head: [] }
def initialize(data='',particulars='')
@data,@env,@md=data,particulars.env,particulars.md
- @vz=SiSU_Env::Get_init.instance.skin
+ @vz=SiSU_Viz::Defaults.new
@regx=/^(?:#{Mx[:mk_o]}:p[bn]#{Mx[:mk_c]}\s*)?(?:#{Mx[:lv_o]}[1-9]:(\S*)#{Mx[:lv_c]})?(.+)/
@tab="\t"
if @md
- @trans=SiSU_XML_munge::Trans.new(@md)
+ @trans=SiSU_XML_Munge::Trans.new(@md)
end
- @sys=SiSU_Env::System_call.new
+ @sys=SiSU_Env::SystemCall.new
end
def songsheet
pre
@@ -196,7 +201,7 @@ WOK
embedded_endnotes(para)
if para[@regx]
paragraph="#{para[@regx,2]}"
- util=SiSU_text_utils::Wrap.new(paragraph,70)
+ util=SiSU_TextUtils::Wrap.new(paragraph,70)
wrapped=util.line_wrap
end
@@xml[:body] << "#{@tab*0}<object>" if para[@regx]
@@ -209,6 +214,15 @@ WOK
@@xml[:body] << "#{@tab*0}</object>" << "\n" if para[@regx]
@endnotes=[]
end
+ def block_structure(para='')
+ para.gsub!(/<:block(?:-end)?>/,'')
+ para.strip!
+ @@xml[:body] << %{#{@tab*0}<object>}
+ @@xml[:body] << %{#{@tab*1}<text class="block">#{@tab*1}\n}
+ @@xml[:body] << %{#{@tab*2}#{para}#{@tab*1}\n}
+ @@xml[:body] << %{#{@tab*1}</text>\n}
+ @@xml[:body] << "#{@tab*0}</object>"
+ end
def group_structure(para='')
para.gsub!(/<:group(?:-end)?>/,'')
para.strip!
@@ -253,14 +267,14 @@ WOK
end
def markup
data=[]
- dir=SiSU_Env::Info_env.new(@md.fns)
+ dir=SiSU_Env::InfoEnv.new(@md.fns)
xml_sc(@md)
@endnotes,@level,@cont,@copen,@xml_contents_close=[],[],[],[],[]
@rcdc=false
(0..6).each { |x| @cont[x]=@level[x]=false }
(4..6).each { |x| @xml_contents_close[x]='' }
@data.each do |para|
- data << SiSU_document_structure_extract::Structure.new(@md,para).structure #takes on Mx marks
+ data << SiSU_DAL_DocumentStructureExtract::Structure.new(@md,para).structure #takes on Mx marks
end
data.each do |para|
if para !~/^\s*(?:%+ |<:code>)/
@@ -268,14 +282,14 @@ WOK
para=@trans.xml_semantic_tags(para)
end
if para =~/[:;]\{|\}[:;]/
- para=SiSU_sem::Tags.new(para,@md).rm.all
+ para=SiSU_Sem::Tags.new(para,@md).rm.all
end
end
para=@trans.markup_light(para)
@trans.char_enc.utf8(para) if @sys.locale =~/utf-?8/i #% utf8
para.gsub!(/^@(\S+?):/,"#{Mx[:lv_o]}@\\1#{Mx[:lv_c]}")
if para =~/\A#{Mx[:lv_o]}@(\S+?)#{Mx[:lv_c]}\s*(.+?)\Z/m # for headers
- d_meta=SiSU_text_utils::Header_scan.new(@md,para).meta
+ d_meta=SiSU_TextUtils::HeaderScan.new(@md,para).meta
if d_meta; xml_head(d_meta)
end
end
@@ -285,9 +299,9 @@ WOK
@rcdc=true
end
if para !~/(^@\S+?:|^\s*$|<ENDNOTES>|<EOF>)/
- @sto=SiSU_text_parts::Split_text_object.new(@md,para).lev_segname_para
+ @sto=SiSU_text_parts::SplitTextObject.new(@md,para).lev_segname_para
unless @rcdc
- format_scroll=SiSU_XML_format::Format_scroll.new(@md,@sto.text) if @sto.format =~/i[1-9]|ordinary/
+ format_scroll=SiSU_XML_Format::FormatScroll.new(@md,@sto.text) if @sto.format =~/i[1-9]|ordinary/
case @sto.format
when /^(1):(\S*)/
xml_clean(para)
@@ -301,7 +315,7 @@ WOK
xml_clean(para)
xml_structure(para,$1,$2)
para=@sto.lev_para_ocn.heading_body3
- when /^(4):(\S*)/ # work on see Split_text_object
+ when /^(4):(\S*)/ # work on see SplitTextObject
xml_clean(para)
xml_structure(para,$1,$2)
para=@sto.lev_para_ocn.heading_body4
@@ -323,7 +337,7 @@ WOK
para.gsub!(/>/,'&gt;')
para=code_structure(para)
elsif para =~/<!Th?.+/ # tables come as single block #work area 2005w13
- table=SiSU_Tables::Table_xml.new(para)
+ table=SiSU_Tables::TableXML.new(para)
para=table.table_split
para=table_structure(para)
else xml_structure(para,nil,nil)
@@ -336,16 +350,16 @@ WOK
if para =~/.*<:#>.*$/
para=case para
when /<:i1>/
- format_text=Format_text_object.new(para,'')
+ format_text=FormatTextObject.new(para,'')
format_text.scr_inden_ocn_e_no_paranum
when /<:i2>/
- format_text=Format_text_object.new(para,'')
+ format_text=FormatTextObject.new(para,'')
format_text.scr_inden_ocn_e_no_paranum
end
end
if para =~/<:center>/
one,two=/(.*)<:center>(.*)/.match(para)[1,2]
- format_text=Format_text_object.new(one,two)
+ format_text=FormatTextObject.new(one,two)
para=format_text.center
end
end
@@ -365,10 +379,10 @@ WOK
end
end
def pre
- rdf=SiSU_XML_tags::RDF.new(@md)
- dir=SiSU_Env::Info_env.new
+ rdf=SiSU_XML_Tags::RDF.new(@md)
+ dir=SiSU_Env::InfoEnv.new
@@xml[:head],@@xml[:body]=[],[]
- css=SiSU_Env::CSS_select.new(@md).xml_sax
+ css=SiSU_Env::CSS_Select.new(@md).xml_sax
encoding=if @sys.locale =~/utf-?8/i; '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'
else '<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>'
end
@@ -411,9 +425,9 @@ WOK
end
new_file_data=@sisu.join
@sisu=new_file_data.scan(/.+/)
- SiSU_Env::SiSU_file.new(@md).mkdir
- filename_sxm=SiSU_Env::SiSU_file.new(@md,@md.fn[:sxs]).mkfile_pwd
- if filename_sxm.class==File
+ SiSU_Env::FileOp.new(@md).mkdir
+ filename_sxm=SiSU_Env::FileOp.new(@md,@md.fn[:sxs]).mkfile_pwd
+ if filename_sxm.is_a?(File)
@sisu.each {|para| filename_sxm.puts para}
filename_sxm.close
else puts 'file not created, is directory writable?'
@@ -423,18 +437,18 @@ WOK
class Tidy
def initialize(md,dir)
@md,@env=md,dir
- @prog=SiSU_Env::Info_program.new
+ @prog=SiSU_Env::InfoProgram.new
end
def xml
if @prog.tidy !=false #note values can be other than true
- if @md.cmd =~/[VM]/
- SiSU_Screen::Ansi.new(@md.cmd,'invert','Using XML Tidy','check document structure').colorize unless @md.cmd =~/q/
- SiSU_Screen::Ansi.new(@md.cmd,'','','check document structure')
- tell.grey_open unless @md.cmd =~/q/
+ if @md.opt.cmd =~/[VM]/
+ SiSU_Screen::Ansi.new(@md.opt.cmd,'invert','Using XML Tidy','check document structure').colorize unless @md.opt.cmd =~/q/
+ SiSU_Screen::Ansi.new(@md.opt.cmd,'','','check document structure')
+ tell.grey_open unless @md.opt.cmd =~/q/
tidyfile='/dev/null' #don't want one or screen output, check for alternative flags
- tidy =SiSU_Env::System_call.new("#{Dir.pwd}/#{@md.fn[:sxs]}",tidyfile)
+ tidy =SiSU_Env::SystemCall.new("#{Dir.pwd}/#{@md.fn[:sxs]}",tidyfile)
tidy.well_formed?
- tell.p_off unless @md.cmd =~/q/
+ tell.p_off unless @md.opt.cmd =~/q/
end
end
end
diff --git a/lib/sisu/v4/sysenv.rb b/lib/sisu/v4/sysenv.rb
new file mode 100644
index 00000000..f1dfdb16
--- /dev/null
+++ b/lib/sisu/v4/sysenv.rb
@@ -0,0 +1,6014 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: system environment, resource control and configuration details
+
+=end
+@@cX=nil
+@@current_document=Dir.pwd #nil #''
+@@lang_info=nil
+module SiSU_Env
+ require_relative 'constants' # constants.rb
+ require 'fileutils'
+ include FileUtils::Verbose
+ require 'singleton'
+ @@noyaml=false
+ class InfoDate
+ require 'date'
+ attr_accessor :dt,:t
+ def initialize
+ @dt,@t=Date.today.to_s,Time.now
+ end
+ def week
+ w=@t.strftime('%W')
+ "#{@t.year}w#{w}"
+ end
+ def month
+ "#{@t.year}#{@t.month}"
+ end
+ def year
+ @t.year
+ end
+ def weekonly
+ @t.strftime('%W')
+ end
+ def monthonly
+ @t.month
+ end
+ def year_static
+ YEAR
+ end
+ end
+ class InfoSystemGen
+ require 'rbconfig'
+ @@user,@@home,@@hostname,@@pwd,@@sisu_etc,@@host,@@arch,@@rbver,@@dir_arch,@@dir_sitearch,@@dir_bin,@@locale,@@rc,@@sisurc_path,@@ad=ENV['USER'],ENV['HOME'],ENV['HOSTNAME'],ENV['PWD'],Config::CONFIG['sysconfdir'] + '/sisu',Config::CONFIG['host'],Config::CONFIG['arch'],%x{ruby -v}.strip,Config::CONFIG['archdir'],Config::CONFIG['sitearchdir'],Config::CONFIG['bindir'],%x{locale charmap}.strip,nil,nil,{} # %x{ruby -v}.strip # Config::CONFIG['rb_ver']
+ out=Config::CONFIG['localstatedir']
+ etc=Config::CONFIG['sysconfdir'] + '/sisu'
+ share=Config::CONFIG['datadir'] + '/sisu'
+ data=Config::CONFIG['datadir'] + '/doc/sisu'
+ m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m
+ @stub_pwd ||=@@pwd[m,1]
+ prcss_dir='_sisu_processing_' + '.' + SiSU_version_dir
+ prcss_dir_tmp_root="/tmp/#{prcss_dir}"
+ prcss_dir_stub="#{prcss_dir}/#{@stub_pwd}"
+ if @@user
+ tmp_processing="#{prcss_dir_tmp_root}/#{@@user}/#{@stub_pwd}"
+ tmp_processing_individual="#{prcss_dir_tmp_root}/#{@@user}/#{@stub_pwd}"
+ else #error
+ tmp_processing=tmp_processing_individual="/tmp/#{prcss_dir_stub}"
+ end
+ tmp_processing_home=if @@home \
+ and File.writable?("#{@@home}/.")
+ "#{@@home}/#{prcss_dir_stub}"
+ else prcss_dir_stub
+ end
+ processing_pth=tmp_processing_individual
+ processing_dir=prcss_dir
+ processing_git="#{Dir.pwd}/#{Gt[:grotto]}"
+ user=ENV['USER']
+ port_pgsql=if defined? ENV['PGPORT'] \
+ and not (ENV['PGPORT'].nil? \
+ or ENV['PGPORT'].empty?) \
+ and ENV['PGPORT']=~/^\d+$/
+ ENV['PGPORT']
+ else '5432'
+ end
+ IMAGES=:images
+ SISU_ETC=:sisu_etc
+ SISU_SHARE=:sisu_share
+ SAMPLE_DATA_PATH=:sample_data_path
+ IMAGE_STUB=:image_stub
+ STYLESHEET_STUB=:stylesheet_stub
+ IMAGE_LOCAL=:image_local
+ WEBSERV_PATH=:webserv_path
+ WEBSERV_MAN=:webserv_man
+ WEBSERV_PHP=:webserv_php
+ WEBSERV_CGI=:webserv_cgi
+ WEBSERV_RSS=:webserv_rss
+ WEBSERV_SQLITE=:webserv_sqlite
+ OUTPUT_LOCAL=:output_local
+ PROCESSING_DIR=:processing_dir
+ PROCESSING_PATH=:processing_path
+ PROCESSING_DIR_TMP_ROOT=:processing_dir_tmp_root
+ PROCESSING_PATH_TMP_BASE=:processing_path_tmp_base
+ PROCESSING_DAL=:processing_dal
+ PROCESSING_TUNE=:processing_tune
+ PROCESSING_LATEX=:processing_latex
+ PROCESSING_TEXINFO=:processing_texinfo
+ PROCESSING_LOUT=:processing_lout
+ PROCESSING_SQLITE=:processing_sqlite
+ PROCESSING_POSTGRESQL=:processing_postgresql
+ PROCESSING_ENCODING=:processing_encoding
+ PROCESSING_GIT=:processing_git
+ PAPERSIZE=:papersize
+ #LANGUAGE=:language
+ #LANGUAGE_CODE=:language_code
+ MULTILINGUAL=:multilingual
+ BUNDLE=:bundle
+ CONCORD_MAX=:concord_max
+ DIGEST=:digest
+ WEBSERV_HOST_CGI=:webserv_host_cgi
+ WEBSERV_PORT_CGI=:webserv_port_cgi
+ POSTGRESQL_USER=:postgresql_user
+ POSTGRESQL_PORT=:postgresql_port
+ SQLITE_USER=:sqlite_user
+ SQLITE_PATH=:sqlite_path
+ SQLITE_PORT=:sqlite_port
+ DEFAULT_DIR={
+ IMAGES => '_sisu/image',
+ SISU_ETC => etc,
+ SISU_SHARE => share,
+ SAMPLE_DATA_PATH => data,
+ IMAGE_STUB => '_sisu/image',
+ STYLESHEET_STUB => '_sisu/css',
+ IMAGE_LOCAL => @@pwd + '/_sisu/image',
+ WEBSERV_PATH => out + '/www',
+ #WEBSERV_DIR => www, # uncomment for urls...
+ #WEBSERV_IMAGE => out + '/www/_sisu/image',
+ WEBSERV_MAN => out + '/www/man', #alter
+ WEBSERV_PHP => out + '/www/php',
+ WEBSERV_CGI => '/usr/lib/cgi-bin',
+ WEBSERV_RSS => out + '/www/feed',
+ WEBSERV_SQLITE => out + '/www/sqlite',
+ OUTPUT_LOCAL => @@home + '/sisu_www',
+ PROCESSING_DIR => processing_dir,
+ PROCESSING_PATH => processing_pth,
+ PROCESSING_DIR_TMP_ROOT => prcss_dir_tmp_root,
+ PROCESSING_PATH_TMP_BASE => processing_pth,
+ PROCESSING_DAL => 'dal',
+ PROCESSING_TUNE => 'tune',
+ PROCESSING_LATEX => 'tex',
+ PROCESSING_TEXINFO => 'texinfo',
+ PROCESSING_SQLITE => 'sqlite',
+ PROCESSING_POSTGRESQL=> 'postgresql',
+ PROCESSING_ENCODING => 'encoding',
+ PROCESSING_GIT => processing_git,
+ #TEXINFO_STUB => 'texinfo',
+ PAPERSIZE => 'A4', #A4, US_letter, book_b5, book_a5, US_legal
+ #LANGUAGE => 'English',
+ #LANGUAGE_CODE => 'en', #change, unecessary duplication though currently used
+ MULTILINGUAL => false,
+ BUNDLE => false,
+ CONCORD_MAX => 260000,
+ DIGEST => 'sha256',
+ WEBSERV_HOST_CGI => ' http://localhost',
+ WEBSERV_PORT_CGI => 8081, #8111,8123,8081
+ POSTGRESQL_USER => @@user, #'ralph', # change user !!!
+ POSTGRESQL_PORT => port_pgsql,
+ #POSGRESQL_LINKS_PATH => '',
+ SQLITE_USER => @@user,
+ SQLITE_PATH => @@user, #??
+ SQLITE_PORT => '**',
+ }
+ @@default_dir=DEFAULT_DIR
+ m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m
+ @@pwd=@pwd=(/(\S+?)(?:\/(?:#{Px[:lng_lst_rgx]}))?$/).match(Dir.pwd)[1]
+ stub_pwd=@pwd[m,1]
+ attr_accessor :user,:home,:hostname,:pwd,:host,:arch,:rbver,:dir_arch,:dir_sitearch,:dir_bin,:locale,:webserv_path,:webserv_host_cgi,:webserv_port_cgi,:default_dir,:rc_path,:ad_path
+ def initialize
+ @user,@home,@hostname,@pwd,@sisu_etc,@host,@arch,@rbver,@dir_arch,@dir_sitearch,@dir_bin,@locale,@default_dir=\
+ @@user,@@home,@@hostname,@@pwd,@@sisu_etc,@@host,@@arch,@@rbver,@@dir_arch,@@dir_sitearch,@@dir_bin,@@locale,@@default_dir
+ #note rbver is duplicated in InfoVersion
+ end
+ end
+ class InfoSystem < InfoSystemGen
+ include Singleton
+ def initialize
+ super()
+ end
+ end
+ class Load
+ def initialize(prog,mandatory=false)
+ @prog,@mandatory=prog,mandatory
+ end
+ def prog
+ load_prog=false
+ pp=''
+ $:.each do |reqpath|
+ if FileTest.exist?("#{reqpath}/#{@prog}.rb")
+ load_prog=true
+ break
+ end
+ end
+ if load_prog \
+ and @prog=~/dbi/
+ require 'dbi' #revisit
+ end
+ if load_prog
+ require @prog
+ else
+ @mandatory \
+ ? (SiSU_Screen::Ansi.new(@cmd,"*WARN* module required: #{@prog}").warn)
+ : (SiSU_Screen::Ansi.new(@cmd,"*WARN* #{@prog} load requested").warn)
+ end
+ load_prog
+ end
+ def prog?
+ load_prog=false
+ $:.each do |reqpath|
+ if FileTest.exist?("#{reqpath}/#{@prog}.rb"); load_prog=true
+ break
+ end
+ end
+ load_prog
+ end
+ end
+ class GetInit < InfoSystemGen
+ @@noyaml=false
+ @@rc,@@sisu_doc_makefile,@@sisurc_path,@@tx=nil,nil,nil,nil
+ @@ad={ promo: nil, promo_list: nil, flag_promo: false }
+ @@sdmd=nil
+ attr_accessor :yaml
+ def initialize
+ super()
+ @markup_dir_changed_=if @@sdmd==$sisu_document_markup_directory
+ false
+ else
+ @@sdmd=$sisu_document_markup_directory
+ true
+ end
+ end
+ def tex
+ @@tx ||=SiSU_Viz::TeX.new
+ end
+ def rc_path_options
+ @rc_path=[
+ "#{$sisu_document_markup_directory}/.sisu/#{SiSU_version_dir}",
+ "#{$sisu_document_markup_directory}/.sisu",
+ "#{$sisu_document_markup_directory}/_sisu/#{SiSU_version_dir}",
+ "#{$sisu_document_markup_directory}/_sisu",
+ "#{@@home}/.sisu/#{SiSU_version_dir}",
+ "#{@@home}/.sisu",
+ "#{@@sisu_etc}/#{SiSU_version_dir}",
+ "#{@@sisu_etc}",
+ ]
+ end
+ def sisu_document_make
+ def makefile_name
+ S_CONF[:header_make]
+ end
+ def makefile
+ #if @markup_dir_changed_
+ rc_path_options.each do |v|
+ if FileTest.exist?("#{v}/#{makefile_name}")
+ @sisu_make_path=v
+ break
+ end
+ end
+ #end
+ @sisu_make_file_path=@sisu_make_path \
+ ? "#{@sisu_make_path}/#{makefile_name}"
+ : nil
+ end
+ def makefile_read
+ if makefile
+ sisu_doc_makefile=IO.read(makefile, mode: 'r:utf-8')
+ @sisu_doc_makefile=sisu_doc_makefile.split(/\s*\n\s*\n/m)
+ end
+ @sisu_doc_makefile
+ end
+ self
+ end
+ def sisu_yaml
+ def rc
+ if @markup_dir_changed_
+ rc_path_options.each do |v|
+ if @@noyaml \
+ or FileTest.exist?("#{v}/noyaml")
+ STDERR.puts "WARNING - YAML loading switched off, to enable delete the file:\n\t#{v}/noyaml\n\n" unless @@noyaml
+ @@noyaml=true
+ break
+ else
+ f=S_CONF[:rc_yml]
+ if FileTest.exist?("#{v}/#{f}")
+ require 'yaml'
+ @@sisurc_path=v
+ @@rc=YAML::load(File::open("#{@@sisurc_path}/#{f}"))
+ break
+ end
+ unless @@rc
+ f='sisurc.yaml'
+ if FileTest.exist?("#{v}/#{f}")
+ require 'yaml'
+ @@sisurc_path=v
+ @@rc=YAML::load(File::open("#{@@sisurc_path}/#{f}"))
+ break
+ end
+ end
+ end
+ end
+ end
+ @@rc
+ end
+ def rc_path
+ rc
+ @@sisurc_path
+ end
+ self
+ end
+ def ads #WORK AREA
+ tell_no_yaml='WARNING - YAML loading switched off, to enable delete the file:'
+ if @markup_dir_changed_
+ @ad_path=[
+ "#{$sisu_document_markup_directory}/.sisu/#{SiSU_version_dir}/skin/yml",
+ "#{$sisu_document_markup_directory}/.sisu/skin/yml",
+ "#{$sisu_document_markup_directory}/_sisu/#{SiSU_version_dir}/skin/yml",
+ "#{$sisu_document_markup_directory}/_sisu/skin/yml",
+ "#{@@home}/.sisu/#{SiSU_version_dir}/skin/yml",
+ "#{@@home}/.sisu/skin/yml",
+ "#{@@sisu_etc}/#{SiSU_version_dir}/skin/yml",
+ "#{@@sisu_etc}/skin/yml",
+ ]
+ @ad_path.each do |v|
+ if @@noyaml \
+ or FileTest.exist?("#{v}/noyaml")
+ puts tell_no_yaml + "\n\t#{v}/noyaml\n" unless @@noyaml
+ @@noyaml=true
+ break
+ else
+ if FileTest.exist?("#{v}/list.yml")
+ unless @@ad[:promo_list]
+ require 'yaml'
+ @@ad[:promo_list] ||= YAML::load(File::open("#{v}/list.yml"))
+ end
+ @@ad[:flag_promo]=true
+ break
+ end
+ @@ad[:flag_promo]=false
+ end
+ end
+ @ad_path.each do |v|
+ if @@noyaml \
+ or FileTest.exist?("#{v}/noyaml")
+ puts tell_no_yaml + "\n\t#{v}/noyaml\n" unless @@noyaml
+ @@noyaml=true
+ break
+ else
+ if FileTest.exist?("#{v}/promo.yml")
+ unless @@ad[:promo]
+ require 'yaml'
+ @@ad[:promo] ||= YAML::load(File::open("#{v}/promo.yml"))
+ end
+ @@ad[:flag_promo]=true
+ break
+ end
+ @@ad[:flag_promo]=false
+ end
+ end
+ end
+ @@ad
+ end
+ end
+ class EnvCall
+ @@rc,@@fns,@@fnn,@@fnb,@@fnt,@@flv,@@fnz=nil,nil,nil,nil,nil,nil,nil
+ @@ad={}
+ attr_accessor :rc,:fnn,:fnb,:fnt,:fnv,:fnz,:ad
+ def initialize(fns='')
+ @fns=fns
+ @sys=InfoSystem.instance
+ get_init=SiSU_Env::GetInit.new
+ @rc=get_init.sisu_yaml.rc
+ @ad=get_init.ads
+ if @fns \
+ and @fns != '' \
+ and @fns !=@@fns
+ @@fns,@@fnn,@@fnb,@@fnt,@@flv,@@fnz=@fns,nil,nil,nil,nil,nil
+ end
+ if @fns \
+ and @fns != '' #watch
+ m=/((.+?)(?:\~\w\w(?:_\w\w)?)?)\.((?:-|ssm\.)?sst|ssm|ssi)$/
+ @@fnn ||=@fns[m,1]
+ @@fnb ||=@fns[m,2]
+ @@fnt ||=@fns[m,3]
+ @@flv ||=document_language_versions_found[:f]
+ unless @@fns =~/\S+?\.txz/
+ @@fnz ||=if @@fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/; @@fnb + '.ssm.txz'
+ elsif @@fnb; @@fnb + '.sst.txz'
+ else '' # e.g. termsheet
+ end
+ end
+ end
+ @fnn,@fnb,@fnt,@flv,@fnz=@@fnn,@@fnb,@@fnt,@@flv,@@fnz
+ end
+ def output_dir_structure
+ def by?
+ output_structure=:filename #set default output structure
+ output_structure=if defined? @rc['output_dir_structure_by']
+ output_structure=if (@rc['output_dir_structure_by'] =~/dump/) \
+ or ((defined? @rc['output_structure']['dump']) \
+ && @rc['output_structure']['dump'] ==true)
+ :dump
+ elsif (@rc['output_dir_structure_by'] =~/redirect/) \
+ or ((defined? @rc['output_structure']['redirect']) \
+ && @rc['output_structure']['redirect'] ==true)
+ :redirect
+ elsif (@rc['output_dir_structure_by'] =~/language/) \
+ or ((defined? @rc['output_structure']['by_language']) \
+ && @rc['output_structure']['by_language'] ==true)
+ :language
+ elsif (@rc['output_dir_structure_by'] =~/filetype/) \
+ or ((defined? @rc['output_structure']['by_filetype']) \
+ && @rc['output_structure']['by_filetype'] ==true)
+ :filetype
+ elsif (@rc['output_dir_structure_by'] =~/filename/) \
+ or ((defined? @rc['output_structure']['by_filename']) \
+ && @rc['output_structure']['by_filename'] ==true)
+ :filename
+ else #recheck current default
+ :language
+ end
+ end
+ end
+ def dump?
+ ((by?) ==:dump) \
+ ? true
+ : false
+ end
+ def redirect?
+ ((by?) ==:redirect) \
+ ? true
+ : false
+ end
+ def by_language_code?
+ ((by?) ==:language) \
+ ? true
+ : false
+ end
+ def by_filetype?
+ ((by?) ==:filetype) \
+ ? true
+ : false
+ end
+ def by_filename?
+ ((by?) ==:filename) \
+ ? true
+ : false
+ end
+ def multilingual?
+ by_language_code?
+ end
+ self
+ end
+ def document_language_versions_found #REVISIT
+ @fn={}
+ filename=(@fns =~/\.ssm\.sst$/) \
+ ? @fns.gsub(/\.ssm\.sst$/,'.ssm')
+ : @fns
+ if filename.is_a?(String) \
+ and not filename.empty?
+ if output_dir_structure.by_language_code?
+ m=/((.+?)(?:\~\w{2,3})?)\.(sst|ssm)$/
+ @fn[:b],@fn[:m],@fn[:t]=filename[m,1],filename[m,2],filename[m,3]
+ else m=/(.+?)\.(sst|ssm)$/
+ @fn[:b]=@fn[:m]=filename[m,1]
+ @fn[:t]=filename[m,2]
+ end
+ end
+ lng_base=SiSU_Env::InfoEnv.new.language_default_set
+ lang=SiSU_Env::StandardiseLanguage.new
+ langs=lang.codes
+ x=[]
+ if FileTest.file?("#{@fn[:m]}.#{@fn[:t]}")
+ n=@fn[:m].gsub(/^.+?\//,'')
+ n =n + '.' + @fn[:t]
+ x << { f: "#{@fn[:m]}.#{@fn[:t]}", l: lng_base, n: n }
+ end
+ #x << { f: "#{@fns}", l: lng_base }
+ langs.each do |l|
+ lng=SiSU_Env::StandardiseLanguage.new(l)
+ if FileTest.file?("#{@fn[:m]}~#{lng.code}.#{@fn[:t]}")
+ x << { f: "#{@fn[:m]}~#{lng.code}.#{@fn[:t]}", l: lng.code }
+ elsif FileTest.file?("#{@fn[:m]}~#{lng.name}.#{@fn[:t]}")
+ x << { f: "#{@fn[:m]}~#{lng.name}.#{@fn[:t]}", l: lng.code }
+ end
+ if FileTest.file?("#{lng.code}/#{@fn[:m]}~#{lng.code}.#{@fn[:t]}")
+ if FileTest.file?("#{lng.code}/#{@fn[:m]}~#{lng.code}.#{@fn[:t]}")
+ x << { f: "#{lng.code}/#{@fn[:m]}~#{lng.code}.#{@fn[:t]}", l: lng.code }
+ elsif FileTest.file?("#{lng.code}/#{@fn[:m]}~#{lng.name}.#{@fn[:t]}")
+ x << { f: "#{lng.code}/#{@fn[:m]}~#{lng.name}.#{@fn[:t]}", l: lng.code }
+ end
+ end
+ if FileTest.file?("#{lng.code}/#{@fn[:m]}.#{@fn[:t]}")
+ if FileTest.file?("#{lng.code}/#{@fn[:m]}.#{@fn[:t]}")
+ x << { f: "#{lng.code}/#{@fn[:m]}.#{@fn[:t]}", l: lng.code }
+ elsif FileTest.file?("#{lng.code}/#{@fn[:m]}.#{@fn[:t]}")
+ x << { f: "#{lng.code}/#{@fn[:m]}.#{@fn[:t]}", l: lng.code }
+ end
+ end
+ end
+ @fn[:f]=x
+ @fn
+ end
+ def published_manifests?(output_base)
+ ob=output_base
+ @fn={}
+ @m=[]
+ unless (@fns.nil? \
+ or @fns.empty?)
+ if output_dir_structure.by_language_code?
+ m=/((.+?)(?:\~\w{2,3})?)\.((?:-|ssm\.)?sst$)/
+ @fn[:b],@fn[:m],@fn[:t]=@fns[m,1],@fns[m,2],@fns[m,3]
+ else m=/(.+?)\.((?:-|ssm\.)?sst$)/
+ @fn[:b]=@fn[:m]=@fns[m,1]
+ @fn[:t]=@fns[m,2]
+ end
+ end
+ lang=SiSU_Env::StandardiseLanguage.new
+ langs=lang.codes
+ x=[]
+ if FileTest.file?("#{@fn[:m]}.#{@fn[:t]}"); x << "#{@fn[:m]}.#{@fn[:t]}"
+ end
+ dir=SiSU_Env::InfoEnv.new(@fns)
+ @m << { m: 'sisu_manifest.html', l: 'English' } #fix later, default language
+ langs.each do |l|
+ lng=SiSU_Env::StandardiseLanguage.new(l)
+ fns_c="#{@fn[:m]}~#{lng.code}.#{@fn[:t]}"
+ fns_l="#{@fn[:m]}~#{lng.name}.#{@fn[:t]}"
+ if FileTest.file?(fns_c)
+ fn_set_lang=SiSU_Env::StandardiseLanguage.new.file_to_language(fns_c) #reconsider file_to_language
+ lng=fn_set_lang[:n]
+ fn=SiSU_Env::EnvCall.new(fns_c).lang(fn_set_lang[:c])
+ @m << { m: fn[:manifest], l: lng }
+ elsif FileTest.file?(fns_l)
+ fn_set_lang=SiSU_Env::StandardiseLanguage.new.file_to_language(fns_l) #reconsider file_to_language
+ @fnl=dir.i18n.lang_filename(fn_set_lang[:c])
+ fn=SiSU_Env::EnvCall.new(fns_l).lang(fn_set_lang[:c])
+ @m << { m: fn[:manifest], l: lng }
+ end
+ end
+ @m=@m.uniq
+ end
+ def filename(code,name,suffix)
+ #d=SiSU_Env::InfoEnv.new(@fns)
+ #fnl=d.i18n.lang_filename(code)
+ "#{name}#{suffix}"
+ #if code
+ # "#{fnl[:pre]}#{name}#{fnl[:mid]}#{suffix}#{fnl[:post]}"
+ #else "#{name}#{suffix}"
+ #end
+ end
+ def lang(code)
+ @fn={
+ html: filename(code,'','.html'),
+ book_index: filename(code,'book_index','.html'),
+ concordance: filename(code,'concordance','.html'),
+ sax: filename(code,'sax','.xml'),
+ dom: filename(code,'dom','.xml'),
+ docbook: filename(code,'docbook','.xml'),
+ xhtml: filename(code,'scroll','.xhtml'),
+ pdf_l: filename(code,'','.pdf'),
+ pdf_p: filename(code,'','.pdf'),
+ pdf_l_a4: filename(code,"a4",'.pdf'),
+ pdf_p_a4: filename(code,"a4",'.pdf'),
+ pdf_l_a5: filename(code,"a5",'.pdf'),
+ pdf_p_a5: filename(code,"a5",'.pdf'),
+ pdf_l_b5: filename(code,"b5",'.pdf'),
+ pdf_p_b5: filename(code,"b5",'.pdf'),
+ pdf_l_letter: filename(code,"letter",'.pdf'),
+ pdf_p_letter: filename(code,"letter",'.pdf'),
+ pdf_l_legal: filename(code,"legal",'.pdf'),
+ pdf_p_legal: filename(code,"legal",'.pdf'),
+ toc: filename(code,'toc','.html'),
+ doc: filename(code,fnb,'.html'),
+ index: filename(code,'index','.html'),
+ po: filename(code,@fns,'.po'),
+ pot: filename(code,@fns,'.pot'),
+ odf: filename(code,'','.odt'),
+ epub: filename(code,'','.epub'),
+ plain: filename(code,'','.txt'),
+ qrcode: filename(code,'','.jpg'),
+ manpage: filename(code,'','.1'), #fix, section number
+ wiki: filename(code,'wiki','.txt'),
+ digest: filename(code,'digest','.txt'),
+ metadata: filename(code,'metadata','.html'), #chk
+ manifest: filename(code,'manifest','.html'),
+ oai_pmh: filename(code,'oai_pmh','.xml'),
+ sitemap: filename(code,'sitemap','.xml'),
+ sitemap_touch: filename(code,"sitemap_#{fnb}",'.xml'),
+ sxs: filename(code,fnb,'.sxs.xml'),
+ sxd: filename(code,fnb,'.sxd.xml'),
+ sxn: filename(code,fnb,'.sxn.xml'),
+ sisupod: filename(nil,@fnz,''),
+ book_idx_html: filename(code,'book_index','.html'),
+ book_idx_epub: filename(code,'book_index','.xhtml'),
+ epub_concord: filename(code,'concordance','.xhtml'),
+ }
+ @fn
+ end
+ end
+ class SystemCall
+ @@locale_flag=false
+ def initialize(input='',output='',cmd='')
+ @input,@output,@cmd=input,output,cmd
+ @prog=SiSU_Env::InfoProgram.new
+ @sys=InfoSystem.instance
+ end
+ def program_found?(program)
+ found=`which #{program}` #`whereis #{program}`
+ (found =~/bin\/#{program}\b/) ? true : false
+ end
+ def locale #locales utf8 or other
+ unless @@locale_flag
+ @@locale_flag=true
+ end
+ @sys.locale
+ end
+ def file_encoding(filename,cmd='') #file encoding
+ program='file'
+ fnsp=SiSU_Env::InfoEnv.new(filename).source_file_with_path
+ if program_found?(program)
+ encoding=%x{file -L #{fnsp}}.strip
+ encoding=encoding.gsub(/#{fnsp}:(\s+|$)/,'')
+ encoding=if encoding \
+ and not encoding.empty?
+ encoding
+ else 'UTF-8 assumed, encoding undetermined'
+ end
+ puts encoding if cmd =~/[VM]/
+ encoding
+ else encoding='UTF-8 assumed, file encoding check program unavailable'
+ end
+ end
+ def wc #word count
+ program='wc'
+ if program_found?(program) \
+ and locale !~/utf-?8/i
+ true
+ else
+ program_ref="(not available)" unless program_found?(program)
+ program_ref="(UTF-8)" if locale =~/utf-?8/i
+ false
+ end
+ end
+ def rcs #rcs for document markup data
+ program='rcs'
+ program_ref="\n\t\tdocument version information requested"
+ if program_found?(program); true
+ else STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" #if @cmd =~/v/
+ false
+ end
+ end
+ def cvs #cvs for document markup data
+ program='cvs'
+ program_ref="\n\t\tdocument version information requested"
+ if program_found?(program); true
+ else STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" #if @cmd =~/v/
+ false
+ end
+ end
+ def openssl #openssl for digests
+ program='openssl'
+ program_ref="\n\t\tused to generate requested source document identification digest"
+ if program_found?(program); true
+ else STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" #if @cmd =~/v/
+ false
+ end
+ end
+ def md5(filename) #md5 dgst
+ program='openssl'
+ program_ref="\n\t\tmd5 digest requested"
+ if program_found?(program)
+ pwd=Dir.pwd
+ Dir.chdir(File.dirname(filename))
+ dgst=%x{openssl dgst -md5 #{File.basename(filename)}}.strip #use file name without file path
+ Dir.chdir(pwd)
+ dgst.scan(/\S+/)
+ else STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" #if @cmd =~/v/
+ false
+ end
+ end
+ def sha256(filename) #sha dgst
+ program='openssl'
+ program_ref="\n\t\tsha digest requested"
+ if program_found?(program)
+ pwd=Dir.pwd
+ Dir.chdir(File.dirname(filename))
+ dgst=%x{openssl dgst -sha256 #{File.basename(filename)}}.strip #use file name without file path
+ Dir.chdir(pwd)
+ dgst.scan(/\S+/)
+ else STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" #if @cmd =~/v/
+ false
+ end
+ end
+ def psql #psql
+ program='psql'
+ program_ref="\n\t\tpsql requested"
+ if program_found?(program); true
+ else STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" #if @cmd =~/v/
+ false
+ end
+ end
+ def create_pg_db(dbname_stub=nil) #createdb
+ unless dbname_stub
+ @pwd ||=Dir.pwd
+ m=/.+\/(?:src\/)?(\S+)/im # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m
+ dbname_stub=@pwd[m,1]
+ end
+ program='createdb'
+ db_name="#{Db[:name_prefix]}#{dbname_stub}"
+ program_ref="\n\t\tcreatedb dbname #{db_name} #for postgresql database creation"
+ (program_found?(program)) \
+ ? system("#{program} #{dbname_name}")
+ : (STDERR.puts "\t*WARN* #{program} is not available #{program_ref}")
+ end
+ def relaxng(cmd='') #trang - convert between different schema languages for XML
+ program='trang'
+ program_ref="\n\t\tsee <http://www.thaiopensource.com/relaxng/trang.html>"
+ (program_found?(program)) \
+ ? system("#{program} #{@input} #{@output}")
+ : (STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" if cmd =~/V/)
+ end
+ def qrencode #qrcode - for generating QR code
+ program='qrencode'
+ program_ref="\n\t\tsee <http://megaui.net/fukuchi/works/qrencode/index.en.html>"
+ found=(program_found?(program)) ? true : false
+ found \
+ ? (system(%{
+ echo "#{@input}" | #{program} -s 3 -o #{@output}
+ }))
+ : (STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" if cmd =~/V/)
+ #found
+ end
+ def imagemagick #imagemagick is a image manipulation program
+ program='identify'
+ program_ref="\n\t\tsee <http://www.imagemagick.org/>"
+ found=(program_found?(program)) ? true : false
+ STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" unless found
+ found
+ end
+ def graphicksmagick #graphicsmagick is a image manipulation program
+ program='gm'
+ program_ref="\n\t\tsee <http://www.graphicsmagick.org/>"
+ found=(program_found?(program)) ? true : false
+ STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" unless found
+ found
+ end
+ def well_formed? #tidy - check for well formed xml xhtml etc.
+ program=@prog.tidy
+ program_ref="\n\t\tsee <http://tidy.sourceforge.net/>"
+ (program_found?(program)) \
+ ? system("#{@prog.tidy} -xml #{@input} > #{@output}")
+ : (STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}")
+ end
+ def tex2pdf_engine
+ prog=['xetex','xelatex','pdflatex','pdfetex','pdftex']
+ @pdfetex_flag=false
+ @cmd ||=''
+ @texpdf=nil
+ prog.each do |program|
+ if program_found?(program)
+ @texpdf=program if program =~/xetex|xelatex|pdftex|pdflatex/
+ @pdfetex_flag=true
+ break
+ end
+ end
+ if @pdfetex_flag==false
+ @texpdf=prog.join(', ')
+ end
+ @texpdf
+ end
+ def latex2pdf(md,papersize='a4') #convert from latex to pdf
+ tell=if @cmd =~/[MV]/
+ ''
+ elsif @cmd =~/[v]/
+ %q{2>&1 | grep -v ' WARNING '}
+ else %q{2>&1 | grep -v '$'}
+ end
+ mode='batchmode' #mode='nonstopmode'
+ program_ref="\n\t\tSee http://www.tug.org/applications/pdftex/\n\t\tOn Debian this is is included in tetex-extra"
+ texpdf=tex2pdf_engine
+ if @pdfetex_flag
+ texpdf_cmd=case texpdf
+ when /xetex/
+ %{#{texpdf} -interaction=#{mode} -fmt=xelatex -papersize="#{papersize}" #{@input} #{tell}\n}
+ when /xelatex/
+ %{#{texpdf} -interaction=#{mode} -papersize="#{papersize}" #{@input} #{tell}\n}
+ when /pdftex/
+ "#{texpdf} -interaction=#{mode} -fmt=pdflatex #{@input} #{tell}\n"
+ when /pdflatex/
+ "#{texpdf} -interaction=#{mode} #{@input} #{tell}\n"
+ end
+ system(texpdf_cmd)
+ else STDERR.puts "\t*WARN* none of the following programs are installed: #{program[0]}, #{program[1]}, #{program[2]} is installed. #{program_ref}"
+ end
+ end
+ def makeinfo #texinfo
+ program='makeinfo'
+ options='' #'--force' #''
+ program_ref="\n\t\tsee http://www.gnu.org/software/texinfo/"
+ (program_found?(program)) \
+ ? system("#{program} #{options} #{@input}\n")
+ : (STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}")
+ end
+ def scp
+ program='scp'
+ puts "scp -Cr #{@input} #{@output}" if @cmd =~/[vVM]/
+ puts "scp disabled"
+ #(program_found?(program)) \
+ #? system("scp -Cr #{@input} #{@output}") \
+ #: (STDERR.puts "\t*WARN* #{program} not found" )
+ end
+ def rsync(action='',chdir=nil)
+ program='rsync'
+ if program_found?(program)
+ vb=if @cmd =~/q/; 'q'
+ elsif @cmd =~/v/; 'v'
+ else ''
+ end
+ msg=''
+ msg=" && echo 'OK: #{@input} -> #{@output}'" unless @cmd =~/q/
+ rsync_cmd="rsync -az#{vb} #{action} #{@input} #{@output}"
+ puts rsync_cmd if @cmd =~/[vVM]/
+ dir_change,dir_return='',''
+ if chdir \
+ && chdir != Dir.pwd
+ dir_change=Dir.chdir(chdir)
+ dir_return=Dir.pwd
+ end
+ dir_change
+ system("
+ #{rsync_cmd} #{msg}
+ ")
+ dir_return
+ else STDERR.puts "\t*WARN* #{program} not found"
+ end
+ end
+ def rm
+ if @cmd =~/^-Z[mMvVq]*$/; FileUtils::rm_rf(@input)
+ elsif @cmd =~/V/; FileUtils::rm(@input)
+ elsif @cmd !~/q/; FileUtils::rm(@input)
+ elsif @cmd =~/q/; FileUtils::rm(@input)
+ else STDERR.puts "\t*WARN* operation ignored"
+ end
+ end
+ end
+ class StandardiseLanguage
+ require_relative 'i18n' # i18n.rb
+ def initialize(l='')
+ @language=(l.nil? || l.empty?) \
+ ? SiSU_Env::InfoEnv.new.language_default_set
+ : l
+ @r=%{(?:#{Px[:lng_lst_rgx]})}
+ @lang_info=SiSU_i18n::Languages.new
+ end
+ def lang_lst # from i18n
+ @@lang_info ||=@lang_info.language.list
+ end
+ def lang(l='') # from i18n
+ x=if l =~/^#{@r}$/
+ @lang_info.language.list[l]
+ elsif @language =~/^#{@r}$/
+ @lang_info.language.list[@language]
+ else nil
+ end
+ end
+ def language
+ lng={}
+ case @language
+ when /^am$|Amharic/i; d,c,l=false,lang_lst['am'][:c], lang_lst['am'][:n]
+ when /^bg$|Bulgarian/i; d,c,l=false,lang_lst['bg'][:c], lang_lst['bg'][:n]
+ when /^bn$|Bengali/i; d,c,l=false,lang_lst['bn'][:c], lang_lst['bn'][:n]
+ when /^br$|Breton/i; d,c,l=false,lang_lst['br'][:c], lang_lst['br'][:n]
+ when /^ca$|Catalan/i; d,c,l=false,lang_lst['ca'][:c], lang_lst['ca'][:n]
+ when /^cs$|Czech/i; d,c,l=false,lang_lst['cs'][:c], lang_lst['cs'][:n]
+ when /^cy$|Welsh/i; d,c,l=false,lang_lst['cy'][:c], lang_lst['cy'][:n]
+ when /^da$|Danish|Dansk/i; d,c,l=false,lang_lst['da'][:c], lang_lst['da'][:n]
+ when /^de$|German/i; d,c,l=false,lang_lst['de'][:c], lang_lst['de'][:n]
+ when /^el$|Greek/i; d,c,l=false,lang_lst['el'][:c], lang_lst['el'][:n]
+ when /^en$|English/i; d,c,l=false,lang_lst['en'][:c], lang_lst['en'][:n]
+ when /^eo$|Esperanto/i; d,c,l=false,lang_lst['eo'][:c], lang_lst['eo'][:n]
+ when /^es$|Spanish|Espanol/i; d,c,l=false,lang_lst['es'][:c], lang_lst['es'][:n]
+ when /^et$|Estonian/i; d,c,l=false,lang_lst['et'][:c], lang_lst['et'][:n]
+ when /^eu$|Basque/i; d,c,l=false,lang_lst['eu'][:c], lang_lst['eu'][:n]
+ when /^fi$|Finnish|Finsk|Suomi/i; d,c,l=false,lang_lst['fi'][:c], lang_lst['fi'][:n]
+ when /^fr$|French|Francais/i; d,c,l=false,lang_lst['fr'][:c], lang_lst['fr'][:n]
+ when /^ga$|Irish/i; d,c,l=false,lang_lst['ga'][:c], lang_lst['ga'][:n]
+ when /^gl$|Galician/i; d,c,l=false,lang_lst['gl'][:c], lang_lst['gl'][:n]
+ when /^he$|Hebrew/i; d,c,l=false,lang_lst['he'][:c], lang_lst['he'][:n]
+ when /^hi$|Hindi/i; d,c,l=false,lang_lst['hi'][:c], lang_lst['hi'][:n]
+ when /^hr$|Croatian/i; d,c,l=false,lang_lst['hr'][:c], lang_lst['hr'][:n]
+ when /^hy$|Armenian/i; d,c,l=false,lang_lst['hy'][:c], lang_lst['hy'][:n]
+ when /^ia$|Interlingua/i; d,c,l=false,lang_lst['ia'][:c], lang_lst['ia'][:n]
+ when /^is$|Icelandic/i; d,c,l=false,lang_lst['is'][:c], lang_lst['is'][:n]
+ when /^it$|Italian/i; d,c,l=false,lang_lst['it'][:c], lang_lst['it'][:n]
+ when /^la$|Latin/i; d,c,l=false,lang_lst['la'][:c], lang_lst['la'][:n]
+ when /^lo$|Lao/i; d,c,l=false,lang_lst['lo'][:c], lang_lst['lo'][:n]
+ when /^lt$|Lithuanian/i; d,c,l=false,lang_lst['lt'][:c], lang_lst['lt'][:n]
+ when /^lv$|Latvian/i; d,c,l=false,lang_lst['lv'][:c], lang_lst['lv'][:n]
+ when /^ml$|Malayalam/i; d,c,l=false,lang_lst['ml'][:c], lang_lst['ml'][:n]
+ when /^mr$|Marathi/i; d,c,l=false,lang_lst['mr'][:c], lang_lst['mr'][:n]
+ when /^nl$|Dutch/i; d,c,l=false,lang_lst['nl'][:c], lang_lst['nl'][:n]
+ when /^no$|Norwegian|Norsk/i; d,c,l=false,lang_lst['no'][:c], lang_lst['no'][:n]
+ when /^nn$|Norwegian Nynorsk/i; d,c,l=false,lang_lst['nn'][:c], lang_lst['nn'][:n]
+ when /^oc$|Occitan/i; d,c,l=false,lang_lst['oc'][:c], lang_lst['oc'][:n]
+ when /^pl$|Polish/i; d,c,l=false,lang_lst['pl'][:c], lang_lst['pl'][:n]
+ when /^pt$|Portuguese/i; d,c,l=false,lang_lst['pt'][:c], lang_lst['pt'][:n]
+ when /^pt_BR$|Portuguese Brazil/i; d,c,l=false,lang_lst['pt_BR'][:c], lang_lst['pt_BR'][:n]
+ when /^ro$|Romanian/i; d,c,l=false,lang_lst['ro'][:c], lang_lst['ro'][:n]
+ when /^ru$|Russian/i; d,c,l=false,lang_lst['ru'][:c], lang_lst['ru'][:n]
+ when /^sa$|Sanskrit/i; d,c,l=false,lang_lst['sa'][:c], lang_lst['sa'][:n]
+ when /^se$|Sami/i; d,c,l=false,lang_lst['se'][:c], lang_lst['se'][:n]
+ when /^sk$|Slovak/i; d,c,l=false,lang_lst['sk'][:c], lang_lst['sk'][:n]
+ when /^sl$|Slovenian/i; d,c,l=false,lang_lst['sl'][:c], lang_lst['sl'][:n]
+ when /^sq$|Albanian/i; d,c,l=false,lang_lst['sq'][:c], lang_lst['sq'][:n]
+ when /^sr$|Serbian/i; d,c,l=false,lang_lst['sr'][:c], lang_lst['sr'][:n]
+ when /^sv$|Swedish|Svensk/i; d,c,l=false,lang_lst['sv'][:c], lang_lst['sv'][:n]
+ when /^ta$|Tamil/i; d,c,l=false,lang_lst['ta'][:c], lang_lst['ta'][:n]
+ when /^te$|Telugu/i; d,c,l=false,lang_lst['te'][:c], lang_lst['te'][:n]
+ when /^th$|Thai/i; d,c,l=false,lang_lst['th'][:c], lang_lst['th'][:n]
+ when /^tk$|Turkmen/i; d,c,l=false,lang_lst['tk'][:c], lang_lst['tk'][:n]
+ when /^tr$|Turkish/i; d,c,l=false,lang_lst['tr'][:c], lang_lst['tr'][:n]
+ when /^uk$|Ukranian/i; d,c,l=false,lang_lst['uk'][:c], lang_lst['uk'][:n]
+ when /^ur$|Urdu/i; d,c,l=false,lang_lst['ur'][:c], lang_lst['ur'][:n]
+ when /^us|American$|/i; d,c,l=false,lang_lst['en'][:c], lang_lst['en'][:n]
+ when /^vi$|Vietnamese/i; d,c,l=false,lang_lst['vi'][:c], lang_lst['vi'][:n]
+ else d,c,l=true, lang_lst['en'][:c], lang_lst['en'][:n] #default
+ end
+ lng[:d],lng[:c],lng[:n]=d,c,l
+ lng
+ end
+ def name
+ language[:n].downcase
+ end
+ def title
+ language[:n]
+ end
+ def code
+ language[:c]
+ end
+ def tex_name
+ language[:xlp]
+ end
+ def file_to_language(file) # used, fix and remove
+ m=/.+?\~(\w{2,3})\.(?:-|ssm\.)?sst$/
+ @language=if file =~m ; file[m,1]
+ else ''
+ end
+ language
+ end
+ def codes
+ # Language List po4a
+ # <http://www.debian.org/international/l10n/po/>
+ # Px[: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 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]
+ # see polyglossia for subset
+ # <http://mirrors.ctan.org/macros/xetex/latex/polyglossia/polyglossia.pdf>
+ # also note ISO_639-2
+ # <http://en.wikipedia.org/wiki/ISO_639-2>
+ # <http://en.wikipedia.org/wiki/List_of_ISO_639-2_codes>
+ Px[:lng_lst] # constants.rb
+ end
+ end
+ class InfoEnv < EnvCall
+ require 'pathname'
+ require 'fileutils'
+ include FileUtils
+ attr_accessor :filename,:sys,:home,:hostname,:user,:env,:rc,:www,:fnb,:fnn,:fnt,:flv,:webserv_path,:stub_pwd,:stub_src,:webserv_host_cgi,:webserv_port_cgi,:processing,:processing_git,:etc,:yamlrc_dir
+ @@image_flag,@@local_image=true,true #warning on @@image_flag
+ @@fb,@@man_path=nil,nil
+ def initialize(fns='',md=nil)
+ super() #you may not want to re-execute this static info so frequently!
+ @init=SiSU_Env::GetInit.new
+ @fns,@md=fns,md
+ @env=SiSU_Env::EnvCall.new(fns) if fns
+ fnb=if @md \
+ and defined? @md.fnb
+ @md.fnb
+ elsif defined? @env.fnb \
+ and @env.fnb
+ @env.fnb
+ elsif @fns.is_a?(String) \
+ and not @fns.empty?
+ m=/(.+)?\.(?:(?:-|ssm\.)?sst|ssm)$/m
+ @fns[m,1] if not @fns.empty?
+ end
+ if fnb; @@fb ||=fnb
+ end
+ @sys=InfoSystem.instance
+ @fnb ||=@@fb #clean up this... used primarily for zap which is not passed normal parameters
+ @fixed_websev_root='' # @home
+ @pwd=@@pwd=Dir.pwd
+ m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m
+ @stub_pwd=@@pwd[m,1]
+ @stub_txt= @stub_pwd + '/txt'
+ @stub_html= @stub_pwd + '/html'
+ @stub_epub= @stub_pwd + '/epub'
+ @stub_odt= @stub_pwd + '/odt'
+ @stub_pdf= @stub_pwd + '/pdf'
+ @stub_manifest=@stub_pwd + '/manifest'
+ @stub_odt= @stub_pwd + '/odt'
+ @stub_src= @stub_pwd + '/src'
+ @stub_pod= @stub_pwd + '/pod'
+ @stub_md= @stub_pwd + '/sisu_site_metadata'
+ pt=Pathname.new(Dir.pwd)
+ stub=if output_dir_structure.by_language_code?
+ r=Px[:lng_lst_rgx]
+ stub=if Dir.pwd =~/.+?\/([^\/]+)(?:\/(#{r})$)/
+ lng=pt.split[-1].to_s
+ lng_part='/' + lng
+ base=pt.split[0].split[-1].to_s
+ else
+ lng_part='/' + language_default_set
+ base=pt.split[-1].to_s
+ end
+ base + lng_part
+ elsif output_dir_structure.by_filetype?
+ pt.split[-1].to_s
+ elsif output_dir_structure.by_filename?
+ ''
+ end
+ @stub_set_manifest=stub + '/manifest'
+ end
+ def user
+ @sys.user
+ end
+ def hostname
+ @sys.hostname
+ end
+ def host
+ @sys.host
+ end
+ def arch
+ @sys.arch
+ end
+ def rbver
+ @sys.rbver
+ end
+ def locale
+ @sys.locale
+ end
+ def concord_max
+ ((defined? @rc['processing']['concord_max']) \
+ && @rc['processing']['concord_max']) \
+ ? @rc['processing']['concord_max']
+ : (defaults[:concord_max])
+ end
+ def language_default_set #set directory (default) language
+ ((defined? @rc['default']['language']) \
+ && @rc['default']['language'] =~/\S+/) \
+ ? @rc['default']['language']
+ : 'en'
+ end
+ def markup_emphasis
+ if defined? @rc['default']['emphasis'] \
+ and @rc['default']['emphasis'] \
+ and @rc['default']['emphasis']=~/bold/
+ 'bold'
+ elsif defined? @rc['default']['emphasis'] \
+ and @rc['default']['emphasis'] \
+ and @rc['default']['emphasis']=~/italic/
+ 'italics'
+ elsif defined? @rc['default']['emphasis'] \
+ and @rc['default']['emphasis'] \
+ and @rc['default']['emphasis']=~/underscore/
+ 'underscore'
+ else 'bold'
+ end
+ end
+ def plaintext_wrap
+ ((defined? @rc['default']['text_wrap']) \
+ && (@rc['default']['text_wrap']) \
+ && (@rc['default']['text_wrap'].to_s=~/\d\d+/) \
+ && (@rc['default']['text_wrap'].to_i > 19) \
+ && (@rc['default']['text_wrap'].to_i < 201)) \
+ ? @rc['default']['text_wrap'].to_i
+ : 78
+ end
+ def current_document
+ @@current_document||=Dir.pwd
+ @@current_document
+ end
+ def stub_pwd #200412
+ @stub_pwd
+ end
+ def stub_md_harvest #watch
+ @stub_set_manifest
+ end
+ def stub_src
+ @stub_src
+ end
+ def stub_pod
+ @stub_pod
+ end
+ def sisupod_v4(opt)
+ #processing_path.processing
+ # sisupod
+ # doc/
+ # manifest.txt
+ # en/content.sst [file content]
+ # fr/content.sst
+ # _sisu
+ # sisu_document_make
+ # image@ (ln -s ../../image)
+ # audio@ (ln -s ../../audio)
+ # video@ (ln -s ../../video)
+ # image/ [all images for specific document gathered here]
+ # audio/
+ # video/
+ spp="#{processing_path.processing}/#{Gt[:sisupod]}"
+ sppc="#{spp}/doc/_sisu"
+ lng_dirs=[]
+ if FileTest.directory?(spp) \
+ or FileTest.file?(spp)
+ FileUtils::rm_rf(spp)
+ end
+ paths=[]
+ flv=SiSU_Env::EnvCall.new(opt.fns).document_language_versions_found
+ flv[:f].each {|l| lng_dirs << l[:l] }
+ lng_dirs.uniq.each do |lng|
+ paths << "#{spp}/doc/#{lng}"
+ end
+ paths \
+ << "#{spp}/image"
+ #<< "#{spp}/audio" \
+ #<< "#{spp}/video" \
+ paths.each do |x|
+ unless FileTest.directory?(x)
+ FileUtils::mkdir_p(x)
+ end
+ end
+ if FileTest.directory?(sppc)
+ pwd=Dir.pwd
+ Dir.chdir(sppc)
+ FileUtils::ln_s('../../image', 'image')
+ #FileUtils::ln_s('../../audio', 'audio')
+ #FileUtils::ln_s('../../video', 'video')
+ Dir.chdir(pwd)
+ end
+ end
+ def sisupod_v3(opt)
+ #processing_path.processing
+ # sisupod
+ # doc/
+ # manifest.txt
+ # en/content.sst [file content]
+ # fr/content.sst
+ # _sisu
+ # skin/
+ # doc [relevant skin if any other than default]
+ # image@ (ln -s ../../image)
+ # audio@ (ln -s ../../audio)
+ # video@ (ln -s ../../video)
+ # image/ [all images for specific document gathered here]
+ # audio/
+ # video/
+ spp="#{processing_path.processing}/#{Gt[:sisupod]}"
+ sppc="#{spp}/doc/_sisu"
+ lng_dirs=[]
+ if FileTest.directory?(spp) \
+ or FileTest.file?(spp)
+ FileUtils::rm_rf(spp)
+ end
+ paths=[]
+ flv=SiSU_Env::EnvCall.new(opt.fns).document_language_versions_found
+ flv[:f].each {|l| lng_dirs << l[:l] }
+ lng_dirs.uniq.each do |lng|
+ paths << "#{spp}/doc/#{lng}"
+ end
+ paths \
+ << "#{spp}/image" \
+ << "#{sppc}/skin/doc" \
+ << "#{sppc}/skin/dir" \
+ << "#{sppc}/skin/site"
+ #<< "#{spp}/audio" \
+ #<< "#{spp}/video" \
+ paths.each do |x|
+ unless FileTest.directory?(x)
+ FileUtils::mkdir_p(x)
+ end
+ end
+ if FileTest.directory?(sppc)
+ pwd=Dir.pwd
+ Dir.chdir(sppc)
+ FileUtils::ln_s('../../image', 'image')
+ #FileUtils::ln_s('../../audio', 'audio')
+ #FileUtils::ln_s('../../video', 'video')
+ Dir.chdir(pwd)
+ end
+ end
+ def sisupod_v2
+ #processing_path.processing
+ # sisupod
+ # content.sst [file content]
+ # filename.sst [link to content.sst]
+ # _sisu
+ # skin/
+ # doc [relevant skin if any other than default]
+ # image [all images for specific document gathered here]
+ sisupod_processing_path="#{processing_path.processing}/#{Gt[:sisupod]}"
+ if FileTest.directory?(sisupod_processing_path) \
+ or FileTest.file?(sisupod_processing_path)
+ FileUtils::rm_rf(sisupod_processing_path)
+ end
+ paths=[]
+ paths=[
+ "#{processing_path.processing}/#{Gt[:sisupod]}/_sisu/skin/doc",
+ "#{processing_path.processing}/#{Gt[:sisupod]}/_sisu/skin/dir",
+ "#{processing_path.processing}/#{Gt[:sisupod]}/_sisu/skin/site",
+ "#{processing_path.processing}/#{Gt[:sisupod]}/_sisu/image"
+ ]
+ paths.each {|x| FileUtils::mkdir_p(x) unless FileTest.directory?(x) }
+ end
+ def defaults #multiple default directories
+ @default_dir ||=@sys.default_dir #DEFAULT_DIR
+ end
+ def html_seg_title_banner?
+ ((defined? @rc['html']['seg_title_banner']) \
+ && @rc['html']['seg_title_banner']==true) \
+ ? @rc['html']['seg_title_banner']
+ : false
+ end
+ def html_quick_ref?
+ ((defined? @rc['html']['quick_ref']) \
+ && @rc['html']['quick_ref']==true) \
+ ? @rc['html']['quick_ref']
+ : false
+ end
+ def html_minitoc?
+ flag=if defined? @rc['html']['minitoc'] \
+ and @rc['html']['minitoc'].is_a?(String)
+ @rc['html']['minitoc']
+ else false
+ end
+ end
+ def manifest_minitoc?
+ flag=if defined? @rc['manifest']['minitoc'] \
+ and @rc['manifest']['minitoc'].is_a?(String)
+ @rc['manifest']['minitoc']
+ else false
+ end
+ end
+ def build
+ def omit_list
+ @off_list ||=if defined? @rc['omit_list'] \
+ and @rc['omit_list'].is_a?(String)
+ @rc['omit_list']
+ elsif defined? @rc['omit']['list'] \
+ and @rc['omit']['list'].is_a?(String)
+ @rc['omit']['list']
+ else
+ nil
+ end
+ end
+ def listed?(test) #fix
+ listed=if omit_list
+ x=(omit_list.scan(/\b#{test}\b/)).join
+ test==x \
+ ? true
+ : false
+ else
+ false
+ end
+ listed
+ end
+ def ocn?
+ if (defined? @rc['omit']['ocn'] \
+ and not @rc['omit']['ocn'].nil?) \
+ or listed?('ocn')
+ :off
+ else
+ :na
+ end
+ end
+ def toc?
+ if (defined? @rc['omit']['toc'] \
+ and not @rc['omit']['toc'].nil?) \
+ or listed?('toc')
+ :off
+ else
+ :na
+ end
+ end
+ def manifest?
+ if (defined? @rc['omit']['manifest'] \
+ and not @rc['omit']['manifest'].nil?) \
+ or listed?('manifest')
+ :off
+ else
+ :na
+ end
+ end
+ def links_to_manifest?
+ flag=if (defined? @rc['omit']['links_to_manifest'] \
+ and not @rc['omit']['links_to_manifest'].nil?) \
+ or (listed?('links_to_manifest') \
+ || listed?('manifest_links'))
+ :off
+ else
+ :na
+ end
+ end
+ def metadata?
+ if (defined? @rc['omit']['metadata'] \
+ and not @rc['omit']['metadata'].nil?) \
+ or listed?('metadata')
+ :off
+ else
+ :na
+ end
+ end
+ def minitoc?
+ flag=if (defined? @rc['omit']['minitoc'] \
+ and not @rc['omit']['minitoc'].nil?) \
+ or (listed?('minitoc'))
+ :off
+ else
+ :na
+ end
+ end
+ def manifest_minitoc?
+ flag=if (defined? @rc['omit']['manifest_minitoc'] \
+ and not @rc['omit']['manifest_minitoc'].nil?) \
+ or listed?('manifest_minitoc')
+ :off
+ else
+ :na
+ end
+ end
+ def html_minitoc?
+ flag=if (defined? @rc['omit']['html_minitoc'] \
+ and not @rc['omit']['html_minitoc'].nil?) \
+ or (listed?('html_minitoc') \
+ || listed?('minitoc'))
+ :off
+ else
+ :na
+ end
+ end
+ def html_navigation?
+ flag=if (defined? @rc['omit']['html_navigation'] \
+ and not @rc['omit']['html_navigation'].nil?) \
+ or listed?('html_navigation')
+ :off
+ else
+ :na
+ end
+ end
+ def html_navigation_bar?
+ flag=if (defined? @rc['omit']['html_navigation_bar'] \
+ and not @rc['omit']['html_navigation_bar'].nil?) \
+ or listed?('html_navigation_bar')
+ :off
+ else
+ :na
+ end
+ end
+ def segsubtoc?
+ flag=if (defined? @rc['omit']['segsubtoc'] \
+ and not @rc['omit']['segsubtoc'].nil?) \
+ or listed?('segsubtoc')
+ :off
+ else
+ :na
+ end
+ end
+ def html_right_pane?
+ flag=if (defined? @rc['omit']['html_right_pane'] \
+ and not @rc['omit']['html_right_pane'].nil?) \
+ or listed?('html_right_pane')
+ :off
+ else
+ :na
+ end
+ end
+ def html_top_band?
+ flag=if (defined? @rc['omit']['html_top_band'] \
+ and not @rc['omit']['html_top_band'].nil?) \
+ or listed?('html_top_band')
+ :off
+ else
+ :na
+ end
+ end
+ def search_form? #decide later, as is configured here (in sisurc) and can be turned off on command line
+ flag=if (defined? @rc['omit']['search_form'] \
+ and not @rc['omit']['search_form'].nil?) \
+ or listed?('search_form')
+ :off
+ else
+ :na
+ end
+ end
+ def html_search_form? #decide later, as is configured here (in sisurc) and can be turned off on command line
+ flag=if (defined? @rc['omit']['html_search_form'] \
+ and not @rc['omit']['html_search_form'].nil?) \
+ or listed?('html_search_form')
+ :off
+ else
+ :na
+ end
+ end
+ self
+ end
+ def odt_ocn?
+ ((defined? @rc['odt']['ocn']) \
+ && @rc['odt']['ocn']==true) \
+ ? @rc['odt']['ocn']
+ : false
+ end
+ def plaintext_ocn?
+ ((defined? @rc['plaintext']['ocn']) \
+ && @rc['plaintext']['ocn']==true) \
+ ? @rc['plaintext']['ocn']
+ : false
+ end
+ def widget #needs (md) #move
+ @rc=SiSU_Env::GetInit.new.sisu_yaml.rc
+ @ad=SiSU_Env::GetInit.new.ads
+ @vz=SiSU_Viz::Defaults.new
+ @flag={ ad: false, md: false, sk: false, rc: false }
+ def promo?
+ @flag[:ad]=if @md.flag_promo && @ad[:flag_promo]
+ @flag[:md]=true
+ true
+ elsif defined? @vz.widget_promo \
+ and not @vz.widget_promo.nil? \
+ and @vz.widget_promo.is_a?(Array) \
+ and @vz.widget_promo.length > 0
+ @flag[:sk]=true
+ true
+ elsif defined? @rc['html']['promo'] \
+ and not @rc['html']['promo'].nil? \
+ and @rc['html']['promo'].length > 0
+ @flag[:rc]=true
+ true
+ else false
+ end
+ @flag
+ end
+ def search?
+ searches=['sisu']
+ flag=false
+ if defined? @rc['search']
+ searches.each do |type|
+ flag=if defined? @rc['search'][type] \
+ and defined? @rc['search'][type]['action'] \
+ and @rc['search'][type]['flag']==true \
+ and @rc['search'][type]['action'] =~/https?:\/\//
+ flag=if promo?[:ad]
+ false
+ elsif defined? @vz.widget_search \
+ and @vz.widget_search==true
+ true
+ elsif defined? @rc['search'][type]['flag'] \
+ and @rc['search'][type]['flag']==true
+ true
+ else false
+ end
+ else false
+ end
+ end
+ else false
+ end
+ flag
+ end
+ def search_fixed?
+ searches=['sisu','hyperestraier']
+ flag=if defined? @rc['search']
+ searches.each do |type|
+ if defined? @rc['search'][type] \
+ and defined? @rc['search'][type]['action'] \
+ and @rc['search'][type]['action'] =~/https?:\/\// \
+ and defined? @rc['search'][type]['db'] \
+ and @rc['search'][type]['db'] =~/\S+/
+ flag=if promo?[:ad]
+ false
+ elsif defined? @vz.widget_search \
+ and @vz.widget_search==true
+ true
+ elsif defined? @rc['search'][type]['flag'] \
+ and @rc['search'][type]['flag']==true
+ true
+ else false
+ end
+ else false
+ end
+ end
+ else false
+ end
+ end
+ def search_form(type='sisusearch',action=nil,db=nil,table=false)
+ rc=SiSU_Env::GetInit.new.sisu_yaml.rc
+ create_form_sisu=if action \
+ and db \
+ and action =~/https?:\/\// \
+ and db =~/\S+/
+ true
+ elsif widget.search?
+ db=if rc['search']['sisu']['flag']==true \
+ and rc['search']['sisu']['db']=~/\S+/
+ (rc['search']['sisu']['db']=~/^#{Db[:name_prefix]}\S+/) \
+ ? rc['search']['sisu']['db']
+ : "#{Db[:name_prefix]}#{rc['search']['sisu']['db']}"
+ else nil
+ end
+ action=rc['search']['sisu']['action']
+ true
+ elsif defined? rc['search']['sisu']['flag'] \
+ and defined? rc['search']['sisu']['action'] \
+ and rc['search']['sisu']['flag']==true \
+ and rc['search']['sisu']['action'] =~/https?:\/\//
+ true
+ else false
+ end
+ if table
+ table_open='<td align="center" bgcolor="#ffffff">'
+ table_close='</td>'
+ else
+ table_open=''
+ table_close='<br />'
+ end
+ form=if create_form_sisu \
+ and type=~/sisusearch/ \
+ and defined? rc['search']['sisu'] \
+ and defined? rc['search']['sisu']['action']
+ <<WOK
+<!-- SiSU Search -->
+#{table_open}
+<a name="search"></a>
+<form method="get" action="#{rc['search']['sisu']['action']}" target="_top">
+<font size="2">
+<input type="text" name="s1" size="24" maxlength="255" />
+<input type="hidden" name="db" value="#{db}" />
+<input type="hidden" name="ltd" value="1000" />
+<input type="hidden" name="off" value="0" />
+<input type="hidden" name="doc" value="#{@md.fnb}" /><br />
+<input type="submit" name="search" value="search doc" />
+<input type="submit" name="search" value="search db" />
+</font></form>
+#{table_close}
+<!-- SiSU Search -->
+WOK
+ else ''
+ end
+ form
+ end
+ def search_form_static(action=nil,db=nil)
+ rc=SiSU_Env::GetInit.new.sisu_yaml.rc
+ create_form=if rc['search']['sisu']['flag']==true \
+ and action \
+ and db \
+ and action =~/https?:\/\// \
+ and db =~/\S+/
+ true
+ elsif widget.search_fixed?
+ db=if rc['search']['sisu']['flag']==true \
+ and rc['search']['sisu']['db']=~/\S+/
+ (rc['search']['sisu']['db']=~/^#{Db[:name_prefix]}\S+/) \
+ ? rc['search']['sisu']['db']
+ : "#{Db[:name_prefix]}#{rc['search']['sisu']['db']}"
+ else nil
+ end
+ action=rc['search']['sisu']['action']
+ true
+ else false
+ end
+ if create_form
+ %{<td align="center" bgcolor="#ffffff">
+<!-- SiSU Search -->
+<a name="search"></a>
+<form method="get" action="#{rc['search']['sisu']['action']}" target="_top">
+<font size="2">
+<input type="text" name="s1" size="24" maxlength="255" />
+<br />
+<input type="hidden" name="db" value="#{db}" />
+<input type="hidden" name="ltd" value="1000" />
+<input type="hidden" name="off" value="0" />
+<input type="hidden" name="doc" value="#{@md.fnb}" />
+<input type="submit" name="search" value="search doc" />
+<input type="submit" name="search" value="search db" />
+</font>
+</form>
+<!-- SiSU Search -->
+</td> }
+ else ''
+ end
+ end
+ def search_action #check
+ action=if search?
+ else ''
+ end
+ end
+ self
+ end
+ def widget_static
+ @rc=SiSU_Env::GetInit.new.sisu_yaml.rc
+ @vz=SiSU_Viz::Defaults.new
+ @flag={ ad: false, md: false, sk: false, rc: false }
+ def search?
+ flag=if defined? @rc['search'] \
+ and defined? @rc['search']['sisu'] \
+ and defined? @rc['search']['sisu']['action'] \
+ and @rc['search']['sisu']['action'] =~/https?:\/\// \
+ and defined? @rc['search']['sisu']['db'] \
+ and @rc['search']['sisu']['db'] =~/\S+/ \
+ and defined? @rc['search']['sisu']['db'] \
+ and @rc['search']['sisu']['db'] =~/\S+/
+ flag=if defined? @vz.widget_search \
+ and @vz.widget_search==true
+ true
+ elsif defined? @rc['search']['sisu']['flag'] \
+ and @rc['search']['sisu']['flag']==true
+ true
+ else
+ false
+ end
+ else
+ false
+ end
+ end
+ def search_fixed?
+ flag=if defined? @rc['search'] \
+ and defined? @rc['search']['sisu'] \
+ and defined? @rc['search']['sisu']['action'] \
+ and @rc['search']['sisu']['action'] =~/https?:\/\// \
+ and defined? @rc['search']['sisu']['db'] \
+ and @rc['search']['sisu']['db'] =~/\S+/ \
+ and defined? @rc['search']['sisu']['db'] \
+ and @rc['search']['sisu']['db'] =~/\S+/
+ flag=if defined? @vz.widget_search \
+ and @vz.widget_search==true
+ true
+ elsif defined? @rc['search']['sisu']['flag'] \
+ and @rc['search']['sisu']['flag']==true
+ true
+ else
+ false
+ end
+ else
+ false
+ end
+ end
+ def search_form(action=nil,db=nil)
+ rc=SiSU_Env::GetInit.new.sisu_yaml.rc
+ create_form=if defined? rc['search']['sisu']['flag'] \
+ and rc['search']['sisu']['flag']==true \
+ and action \
+ and db \
+ and action =~/https?:\/\// \
+ and db =~/\S+/
+ true
+ elsif widget_static.search? \
+ and rc['search']['sisu']['flag']==true
+ db=if rc['search']['sisu']['db']=~/\S+/
+ (rc['search']['sisu']['db']=~/^#{Db[:name_prefix]}\S+/) \
+ ? rc['search']['sisu']['db']
+ : "#{Db[:name_prefix]}#{rc['search']['sisu']['db']}"
+ else nil
+ end
+ action=rc['search']['sisu']['action']
+ true
+ else false
+ end
+ if create_form \
+ and @fnb \
+ and @fnb=~/\S+/
+ %{<!-- SiSU Search -->
+<a name="search"></a>
+<form method="get" action="#{rc['search']['sisu']['action']}" target="_top">
+<font size="2">
+<input type="text" name="s1" size="24" maxlength="255" />
+<br />
+<input type="hidden" name="db" value="#{db}" />
+<input type="hidden" name="doc" value="#{@fnb}" />
+<input type="submit" name="search" value="search doc" />
+<input type="submit" name="search" value="search db" />
+</font>
+</form>
+<!-- SiSU Search --> }
+ elsif create_form
+ %{<!-- SiSU Search -->
+<a name="search"></a>
+<form method="get" action="#{rc['search']['sisu']['action']}" target="_top">
+<font size="2">
+<input type="text" name="s1" size="24" maxlength="255" />
+<br />
+<input type="hidden" name="db" value="#{db}" />
+<input type="submit" name="search" value="search db" />
+</font>
+</form>
+<!-- SiSU Search --> }
+ else ''
+ end
+ end
+ def search_action #check
+ action=if search?
+ else ''
+ end
+ end
+ self
+ end
+ def source_file_path
+ file=@fns.gsub(/\.ssm(?:\.sst)?/,'.ssm.sst')
+ pth=unless file =~/\.ssm\.sst$/; "#{Dir.pwd}"
+ else "#{processing_path.composite_file}"
+ end
+ end
+ def source_file_with_path
+ file=@fns.gsub(/\.ssm(?:\.sst)?/,'.ssm.sst')
+ "#{source_file_path}/#{file}"
+ end
+ def font
+ def texpdf
+ def main
+ (defined? @rc['default']['texpdf_font']) \
+ && (@rc['default']['texpdf_font']=~/\S{3,}/) \
+ ? @rc['default']['texpdf_font']
+ : 'Liberation Sans'
+ end
+ def sans # not used
+ (defined? @rc['default']['texpdf_font_sans']) \
+ && (@rc['default']['texpdf_font_sans']=~/\S{3,}/) \
+ ? @rc['default']['texpdf_font_sans']
+ : 'Liberation Sans'
+ end
+ def serif # not used
+ (defined? @rc['default']['texpdf_font_serif']) \
+ && (@rc['default']['texpdf_font_serif']=~/\S{3,}/) \
+ ? @rc['default']['texpdf_font_serif']
+ : 'Liberation Serif'
+ end
+ def mono
+ (defined? @rc['default']['texpdf_font_mono']) \
+ && (@rc['default']['texpdf_font_mono']=~/\S{3,}/) \
+ ? @rc['default']['texpdf_font_mono']
+ : 'Liberation Mono'
+ end
+ self
+ end
+ self
+ end
+ def path_rel_links
+ def html_scroll_2
+ if @env.output_dir_structure.by_language_code?
+ '../../'
+ elsif @env.output_dir_structure.by_filetype?
+ '../'
+ else
+ '../'
+ end
+ end
+ def html_seg_2
+ if @env.output_dir_structure.by_language_code?
+ '../../../'
+ elsif @env.output_dir_structure.by_filetype?
+ '../../'
+ else
+ '../'
+ end
+ end
+ def html_scroll_1
+ if @env.output_dir_structure.by_language_code?
+ '../'
+ elsif @env.output_dir_structure.by_filetype?
+ '../'
+ else
+ './'
+ end
+ end
+ def html_seg_1
+ if @env.output_dir_structure.by_language_code?
+ '../../'
+ elsif @env.output_dir_structure.by_filetype?
+ '../../'
+ else
+ './'
+ end
+ end
+ self
+ end
+ def read_source_file_array(fns)
+ fns_array=unless fns =~/\.ssm.sst$/
+ IO.readlines(fns, mode: 'r:utf-8', cr_newline: true)
+ else
+ IO.readlines("#{processing_path.composite_file}/#{fns}", mode: 'r:utf-8', cr_newline: true)
+ end
+ end
+ def read_source_file(fns)
+ read_source_file_array(fns)
+ end
+ def read_source_file_string(fns)
+ fns_str=unless fns =~/\.ssm.sst$/
+ IO.read(fns, mode: 'r:utf-8', cr_newline: true)
+ else
+ IO.read("#{processing_path.composite_file}/#{fns}", mode: 'r:utf-8', cr_newline: true)
+ end
+ end
+ def source_file_processing_array(fns)
+ sf=read_source_file_string(fns).split(/\s*\n\s*\n/m)
+ end
+ def path #dir
+ def home
+ @sys.home
+ end
+ def sisurc_path
+ GetInit.new.sisu_yaml.rc_path
+ end
+ def pwd
+ @sys.pwd
+ end
+ def stub_pwd
+ @stub_pwd
+ end
+ def stub_txt
+ @stub_txt
+ end
+ def stub_html
+ @stub_html
+ end
+ def stub_epub
+ @stub_epub
+ end
+ def stub_odt
+ @stub_odt
+ end
+ def stub_pdf
+ @stub_pdf
+ end
+ def stub_manifest
+ @stub_manifest
+ end
+ def stub_set_manifest
+ @stub_set_manifest
+ end
+ def stub_src
+ @stub_src
+ end
+ def stub_pod
+ @stub_pod
+ end
+ def stub_md_harvest
+ @stub_set_manifest
+ end
+ def etc
+ defaults[:sisu_etc] #live/dynamic
+ end
+ def arch
+ @sys.dir_arch
+ end
+ def sitearch
+ @sys.dir_sitearch
+ end
+ def bin
+ @sys.dir_bin
+ end
+ def share #shared data repository source directory
+ defaults[:sisu_share]
+ end
+ def style
+ if @md \
+ && ((@md.opt.opt_act[:dump][:bool] \
+ && @md.opt.opt_act[:dump][:inst]) \
+ || (@md.opt.opt_act[:redirect][:bool] \
+ && @md.opt.opt_act[:redirect][:inst]))
+ 'css'
+ else
+ defaults[:stylesheet_stub]
+ end
+ end
+ def sample_data #sample data repository source directory
+ defaults[:sample_data_path]
+ end
+ def rc
+ @init.rc_path
+ end
+ def yamlrc
+ GetInit.new.sisu_yaml.rc_path
+ end
+ def man #check use
+ (defined? @rc['webserv']['man']) \
+ ? "#{webserv}/#{@rc['webserv']['man']}"
+ : defaults[:webserv_man]
+ end
+ def webserv_path #testing, check need, remove
+ webserv
+ end
+ def webserv #separation required for webrick which cannot use path.output (different requirements as no file is passed)
+ man_path=if @@man_path.nil?
+ man_path=if defined? @rc['webserv']['path'] \
+ and @rc['webserv']['path'] =~/\S\S+/
+ man_path=@@man_path=File.expand_path(@rc['webserv']['path'])
+ else defaults[:webserv_path]
+ end
+ else @@man_path
+ end
+ man_path_head=man_path.gsub(/(\S+)\/[^\/\s]+$/,'\1')
+ unless FileTest.directory?(man_path)
+ FileUtils::mkdir_p(man_path) if File.writable?("#{man_path_head}/.")
+ end
+ @webserv_path=if defined? man_path \
+ and File.writable?("#{man_path}/.")
+ man_path #web server path as configured in rc file
+ elsif FileTest.directory?(defaults[:webserv_path]) \
+ and File.writable?("#{defaults[:webserv_path]}/.") #web server path default
+ defaults[:webserv_path]
+ else #create default directory under home and place output there
+ unless FileTest.directory?(defaults[:output_local])
+ FileUtils::mkdir_p(defaults[:output_local])
+ end
+ defaults[:output_local]
+ end
+ end
+ def webserv_stub_ensure
+ FileUtils::mkdir_p(path.webserv) unless FileTest.directory?(path.webserv)
+ FileUtils::mkdir_p("#{path.webserv}/#{@stub_pwd}") unless FileTest.directory?("#{path.webserv}/#{@stub_pwd}")
+ end
+ def webserv_map_pwd #dir
+ "#{path.webserv}/#{stub_pwd}"
+ end
+ def webserv_dir #fixed/hard path to /www web/presentation directory, on Debian /var/www subdirectories are created within it, depending on markup directory stub-name (last segment of markup directory name)
+ defaults[:webserv_dir]
+ end
+ def webserv_image #web/presentation directory, subdirectories are created within it, depending on markup directory stub-name (last segment of markup directory name)
+ images=if defined? @rc['webserv']['images']
+ @rc['webserv']['images']
+ else defaults[:images]
+ end
+ "#{path.webserv}/#{images}"
+ end
+ def output #web/webserv output directory... subdirectory into which further subdirectories are made based on file names
+ r=Px[:lng_lst_rgx]
+ u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/
+ base_stub=@sys.pwd.gsub(u,'\1')
+ if Dir.pwd =~/\/#{Gt[:sisupod]}\/[^\/]+\/#{Gt[:pod]}\/#{Gt[:doc]}/
+ "#{path.webserv}/#{Gt[:doc]}"
+ else
+ "#{path.webserv}/#{base_stub}"
+ end
+ end
+ def feed
+ (defined? @rc['webserv']['feed']) \
+ ? ("#{public_output}/#{@rc['webserv']['feed']}")
+ : (defaults[:webserv_feed])
+ end
+ def feed_home
+ "#{public_output}/#{@rc['webserv']['feed_home']}"
+ end
+ def scripts #used previously only to include tla version info
+ if defined? @rc['project']['path']; "#{home}/#{@rc['project']['path']}"
+ end
+ end
+ def cgi
+ (defined? @rc['webserv']['cgi']) \
+ ? "#{@rc['webserv']['cgi']}"
+ : (defaults[:webserv_cgi])
+ end
+ def php
+ (defined? @rc['webserv']['php']) \
+ ? "#{public_output}/#{@rc['webserv']['php']}"
+ : (defaults[:webserv_php])
+ end
+ # programs
+ def output_tell
+ url.webserv_map_pwd
+ end
+ def image_source #image repository source directory
+ image_path=if defined? @rc['image']['path'] \
+ and defined? @rc['image']['public']
+ pth="#{@rc['image']['path']}"
+ "#{pth}/#{@rc['image']['public']}"
+ else "#{share}/image"
+ end
+ end
+ def image_source_sisu_includes
+ "#{share}/image"
+ end
+ def image_source_include #image repository source directory
+ image_path=if defined? @rc['image']['path'] \
+ and defined? @rc['image']['public'] \
+ and FileTest.directory?("#{@rc['image']['path']}/#{@rc['image']['public']}")==true
+ "#{@rc['image']['path']}/#{@rc['image']['public']}"
+ elsif FileTest.directory?("#{@@pwd}/#{defaults[:image_stub]}")==true
+ "#{@@pwd}/#{defaults[:image_stub]}"
+ else
+ "#{share}/image"
+ end
+ end
+ def image_external
+ "#{processing}/external_document/image"
+ end
+ def image_source_include_local
+ if FileTest.directory?(defaults[:image_local]); defaults[:image_local]
+ end
+ end
+ def image_source_include_remote
+ if FileTest.directory?(image_external); image_external
+ end
+ end
+ self
+ end
+ def processing_path
+ def encoding
+ pth="#{processing}/#{defaults[:processing_encoding]}"
+ FileUtils::mkdir_p(pth) unless FileTest.directory?(pth)
+ pth
+ end
+ def processing_base_tmp
+ defaults[:processing_path_tmp_base]
+ end
+ def tmp_root_dir
+ defaults[:processing_dir_tmp_root]
+ end
+ def root_dir
+ proposed_path_base=if defined? @rc['processing']['path'] \
+ and not @rc['processing']['path'].nil? \
+ and not @rc['processing']['path'].empty?
+ x=if @rc['processing']['path'] =~/^(?:~|home)$/
+ home #fix
+ else @rc['processing']['path']
+ end
+ else nil
+ end
+ proposed_dir=if defined? @rc['processing']['dir'] \
+ and not @rc['processing']['dir'].nil? \
+ and not @rc['processing']['dir'].empty?
+ @rc['processing']['dir']
+ else defaults[:processing_dir]
+ end
+ v=SiSU_Env::InfoVersion.instance.get_version
+ v_dev=(DEVELOPER[:maintenance]==:true) \
+ ? "_#{v[:version]}"
+ : ''
+ path=if proposed_path_base \
+ and FileTest.directory?(proposed_path_base) \
+ and File.writable?("#{proposed_path_base}/.")
+ x=proposed_dir \
+ ? "#{proposed_path_base}/#{proposed_dir}"
+ : "#{proposed_path_base}/#{defaults[:processing_dir]}"
+ else defaults[:processing_dir_tmp_root]
+ end
+ path = path + v_dev
+ end
+ def usr_dir?
+ case root_dir
+ when /^\/home/; false
+ else true
+ end
+ end
+ def stub_dir
+ (usr_dir?) \
+ ? ("#{root_dir}/#{user}/#{stub_pwd}")
+ : ("#{root_dir}/#{stub_pwd}") # see defaults[:processing_path]
+ end
+ def stub_dir_orig # ends up with lang, if lang dir
+ (usr_dir?) \
+ ? ("#{root_dir}/#{user}/#{stub_pwd}")
+ : ("#{root_dir}/#{stub_pwd}") # see defaults[:processing_path]
+ end
+ def processing_sisupod(opt=nil) #processing directory, used/needed for sisu work files, has sub-directories (dal,tex etc)
+ @opt=opt
+ def paths
+ processing_path_usr="#{root_dir}/#{user}"
+ processing_path_fnb=processing_path_usr + '/' + Gt[:pods] + '/' + @opt.fng
+ processing_path_sisupod=processing_path_fnb + '/' + Gt[:sisupod]
+ { fnb: processing_path_fnb, sisupod: processing_path_sisupod }
+ end
+ def make
+ unless FileTest.directory?(root_dir)
+ FileUtils::mkdir_p(root_dir)
+ File.chmod(0777,root_dir)
+ end
+ if usr_dir?
+ processing_path_usr="#{root_dir}/#{user}"
+ FileUtils::mkdir_p(processing_path_usr) unless FileTest.directory?(processing_path_usr)
+ File.chmod(0700,processing_path_usr)
+ end
+ fn_base_bundle=paths[:fnb]
+ sisupod_processing_path=paths[:sisupod]
+ FileUtils::mkdir_p(sisupod_processing_path) unless FileTest.directory?(sisupod_processing_path)
+ sisupod_processing_path_lng=if defined? @opt.lng
+ sisupod_processing_path + '/' + Gt[:doc] + '/' + @opt.lng
+ else
+ sisupod_processing_path + '/' + Gt[:doc]
+ end
+#p sisup od_processing_path_lng
+ unless FileTest.directory?(sisupod_processing_path_lng)
+ #puts "a processing directory (#{sisupod_processing_path_lng}) is being created for use by sisu"
+ FileUtils::mkdir_p(sisupod_processing_path_lng)
+ File.chmod(0700,sisupod_processing_path_lng)
+ end
+ sisupod_processing_path
+ end
+ self
+ end
+ def processing #processing directory, used/needed for sisu work files, has sub-directories (dal,tex etc)
+ unless FileTest.directory?(root_dir)
+ FileUtils::mkdir_p(root_dir)
+ File.chmod(0777,root_dir)
+ end
+ if usr_dir?
+ processing_path_usr="#{root_dir}/#{user}"
+ FileUtils::mkdir_p(processing_path_usr) unless FileTest.directory?(processing_path_usr)
+ File.chmod(0700,processing_path_usr)
+ end
+ FileUtils::mkdir_p(stub_dir) unless FileTest.directory?(stub_dir)
+ File.chmod(0700,stub_dir)
+ path_processing=[stub_dir,defaults[:processing_path],defaults[:processing_path_home]]
+ processing=nil
+ path_processing.each do |v| #
+ processing=v
+ unless FileTest.directory?(processing)
+ FileUtils::mkdir_p(processing)
+ File.chmod(0700,processing)
+ end
+ break
+ end
+ processing
+ end
+ def dal
+ pth=if defined? @rc['processing']['dal'] \
+ and @rc['processing']['dal'].is_a?(String)
+ "#{processing}/#{@rc['processing']['dal']}"
+ else "#{processing}/#{defaults[:processing_dal]}"
+ end
+ FileUtils::mkdir_p(pth) unless FileTest.directory?(pth)
+ pth
+ end
+ def tune
+ pth=if defined? @rc['processing']['tune'] \
+ and @rc['processing']['tune'].is_a?(String)
+ "#{processing}/#{@rc['processing']['tune']}"
+ else "#{processing}/#{defaults[:processing_tune]}"
+ end
+ FileUtils::mkdir_p(pth) unless FileTest.directory?(pth)
+ pth
+ end
+ def composite_file
+ pth=processing_path.dal #"#{processing}/composite"
+ FileUtils::mkdir_p(pth) unless FileTest.directory?(pth)
+ pth
+ end
+ def git
+ pth=if defined? @rc['git']['dir'] \
+ and @rc['git']['dir'].is_a?(String)
+ x=(@rc['git']['dir'] =~/^(?:~|home)$/) \
+ ? home + '/' + Gt[:git]
+ : @rc['git']['dir'] + '/' + Gt[:git]
+ else defaults[:processing_git]
+ end
+ unless FileTest.directory?(pth)
+ FileUtils::mkdir_p(pth)
+ File.chmod(0700,pth)
+ end
+ pth
+ end
+ def odf_pth
+ pth="#{processing}/odf/#{@fns}"
+ pth
+ end
+ def odf
+ odt
+ end
+ def odt
+ pth=odf_pth + '/odt'
+ FileUtils::mkdir_p(pth) unless FileTest.directory?(pth)
+ pth
+ end
+ def odf
+ pth="#{processing}/odf"
+ FileUtils::mkdir_p(pth) unless FileTest.directory?(pth)
+ pth
+ end
+ def odt_bld
+ FileUtils::rm_rf(processing_path.odt)
+ FileUtils::mkdir_p(processing_path.odt) unless FileTest.directory?(processing_path.odt)
+ FileUtils::mkdir_p("#{processing_path.odt}/Configurations2") unless FileTest.directory?("#{processing_path.odt}/Configurations2")
+ FileUtils::mkdir_p("#{processing_path.odt}/META-INF") unless FileTest.directory?("#{processing_path.odt}/META-INF")
+ FileUtils::mkdir_p("#{processing_path.odt}/Pictures") unless FileTest.directory?("#{processing_path.odt}/Pictures")
+ FileUtils::mkdir_p("#{processing_path.odt}/Thumbnails") unless FileTest.directory?("#{processing_path.odt}/Thumbnails")
+ processing_path.odt
+ end
+ def epub
+ "#{processing}/epub/#{@fnb}"
+ end
+ def epub_bld #(md)
+ FileUtils::rm_rf(processing_path.epub) if FileTest.directory?(processing_path.epub)
+ FileUtils::mkdir_p(processing_path.epub) unless FileTest.directory?(processing_path.epub)
+ FileUtils::mkdir_p("#{processing_path.epub}/META-INF") unless FileTest.directory?("#{processing_path.epub}/META-INF")
+ FileUtils::mkdir_p("#{processing_path.epub}/#{Ep[:d_oebps]}/image") unless FileTest.directory?("#{processing_path.epub}/#{Ep[:d_oebps]}/image")
+ FileUtils::mkdir_p("#{processing_path.epub}/#{Ep[:d_oebps]}/css") unless FileTest.directory?("#{processing_path.epub}/#{Ep[:d_oebps]}/css")
+ images=%W[bullet_09.png arrow_next_red.png arrow_prev_red.png arrow_up_red.png]
+ processing_path.epub
+ end
+ def epub_cp_images(md)
+ pth="#{processing_path.epub}/#{Ep[:d_oebps]}/image"
+ FileUtils::mkdir_p(pth) unless FileTest.directory?(pth)
+ src="#{path.share}/image"
+ images=%W[bullet_09.png arrow_next_red.png arrow_prev_red.png arrow_up_red.png]
+ images.each do |i| #move to avoid repeated tests
+ if FileTest.file?("#{src}/#{i}")
+ FileUtils::cp("#{src}/#{i}","#{pth}/#{i}") unless FileTest.file?("#{pth}/#{i}")
+ else STDERR.puts %{\t*WARN* did not find image - "#{i}" [#{__FILE__}:#{__LINE__}]}
+ end
+ end
+ pth
+ end
+ def tex
+ pth=if defined? @rc['processing']['latex'] \
+ and @rc['processing']['latex'].is_a?(String)
+ "#{processing}/#{@rc['processing']['latex']}"
+ else "#{processing}/#{defaults[:processing_latex]}"
+ end
+ FileUtils::mkdir_p(pth) unless FileTest.directory?(pth)
+ pth
+ end
+ def texi
+ pth=if defined? @rc['processing']['texinfo'] \
+ and @rc['processing']['texinfo'].is_a?(String)
+ "#{processing}/#{@rc['processing']['texinfo']}"
+ else "#{processing}/#{defaults[:processing_texinfo]}"
+ end
+ FileUtils::mkdir_p(pth) unless FileTest.directory?(pth)
+ pth
+ end
+ def texinfo #texinfo webserv, check
+ "#{processing}/#{defaults[:processing_texinfo]}"
+ end
+ def manpage
+ "#{path.output}/man"
+ end
+ def lout
+ pth=if defined? @rc['processing']['lout'] \
+ and @rc['processing']['lout'].is_a?(String)
+ "#{processing}/#{@rc['processing']['lout']}"
+ else "#{processing}/#{defaults[:processing_lout]}"
+ end
+ FileUtils::mkdir_p(pth) unless FileTest.directory?(pth)
+ pth
+ end
+ def sql
+ pth="#{processing}/sql"
+ FileUtils::mkdir_p(pth) unless FileTest.directory?(pth)
+ pth
+ end
+ def sqlite
+ pth=if defined? @rc['processing']['sqlite'] \
+ and @rc['processing']['sqlite'].is_a?(String)
+ "#{processing}/#{@rc['processing']['sqlite']}"
+ else "#{processing}/#{defaults[:processing_sqlite]}"
+ end
+ FileUtils::mkdir_p(pth) unless FileTest.directory?(pth)
+ pth
+ end
+ def postgresql
+ pth=if defined? @rc['processing']['postgresql'] \
+ and @rc['processing']['postgresql'].is_a?(String)
+ "#{processing}/#{@rc['processing']['postgresql']}"
+ else "#{processing}/#{defaults[:processing_postgresql]}"
+ end
+ FileUtils::mkdir_p(pth) unless FileTest.directory?(pth)
+ pth
+ end
+ self
+ end
+ def url
+ def hostname
+ "http://#{@sys.hostname}"
+ end
+ def dir_url
+ "file://#{path.webserv}/#{stub_pwd}"
+ end
+ def localhost
+ "http://localhost/#{stub_pwd}"
+ end
+ def local
+ "http://#{hostname}/#{@stub_pwd}"
+ end
+ def root
+ if defined? @rc['webserv']['url_root'] \
+ and @rc['webserv']['url_root'] =~/https?:\/\//
+ "#{@rc['webserv']['url_root']}/#{@stub_pwd}"
+ elsif defined? @rc['webserv']['url_root'] \
+ and @rc['webserv']['url_root'] =~/localhost/
+ "http://localhost/#{@stub_pwd}"
+ else "file://#{path.output}"
+ end
+ end
+ def remote
+ root
+ end
+ def txt
+ "#{root}/txt"
+ end
+ def html
+ "#{root}/html"
+ end
+ def epub
+ "#{root}/epub"
+ end
+ def odt
+ "#{root}/odt"
+ end
+ def pdf
+ "#{root}/pdf"
+ end
+ def src_txt
+ "#{root}/src"
+ end
+ def src_pod
+ "#{root}/pod"
+ end
+ def pot
+ "#{root}/po4a/pot"
+ end
+ def po
+ "#{root}/po4a/po"
+ end
+ def webserv_host_base
+ if defined? @rc['webserv']['host']
+ case @rc['webserv']['host']
+ when /https?:\/\//; @rc['webserv']['host']
+ when /\S+/; "http://#{@rc['webserv']['host']}"
+ else defaults[:webserv_host_cgi]
+ end
+ else defaults[:webserv_host_cgi]
+ end
+ end
+ def webserv_cgi #web url for local webserv (localhost, or hostname)
+ if defined? @rc['webserv_cgi']['host'] \
+ and @rc['webserv_cgi']['host'].is_a?(String)
+ http=((@rc['webserv_cgi']['host'] =~ /https?:\/\//) ? '' : 'http://') #check https? missing
+ if port.webserv_port_cgi
+ "#{http}#{@rc['webserv_cgi']['host']}:#{port.webserv_port_cgi}/#{@stub_pwd}"
+ else "#{http}#{@rc['webserv_cgi']['host']}/#{@stub_pwd}"
+ end
+ else
+ http=((webserv_host_base=~/https?:\/\//) ? '' : 'http://')
+ if port.webserv_port_cgi
+ "#{http}#{webserv_host_base}:#{port.webserv_port_cgi}/#{@stub_pwd}"
+ else "#{http}#{webserv_host_base}/#{@stub_pwd}"
+ end
+ end
+ end
+ def webserv_base_cgi #web url for local webserv (localhost, or hostname)
+ if defined? @rc['webserv_cgi']['host'] \
+ and @rc['webserv_cgi']['host'].is_a?(String)
+ http=((@rc['webserv_cgi']['host'] =~ /https?:\/\//) ? '' : 'http://')
+ if port.webserv_port_cgi
+ "#{http}#{@rc['webserv_cgi']['host']}:#{port.webserv_port_cgi}"
+ else "#{http}#{@rc['webserv_cgi']['host']}"
+ end
+ else
+ http=((webserv_host_base=~/https?:\/\//) ? '' : 'http://')
+ if port.webserv_port_cgi
+ "#{http}#{webserv_host_base}:#{port.webserv_port_cgi}"
+ else "#{http}#{webserv_host_base}"
+ end
+ end
+ end
+ def webrick #must have a port #REMOVE
+ if defined? @rc['webserv_cgi']['host'] \
+ and @rc['webserv_cgi']['host'].is_a?(String)
+ http=if @rc['webserv_cgi']['host'] =~/http:\/\//
+ 'http://'
+ elsif @rc['webserv_cgi']['host'] =~/https:\/\//
+ 'https://'
+ else defaults
+ end
+ "#{http}#{@rc['webserv_cgi']['host']}"
+ elsif webserv_host_base \
+ and webserv_host_base.is_a?(String)
+ "#{http}#{webserv_host_base}"
+ else "#{http}localhost" end
+ end
+ def webserv #web url for local webserv (localhost, or hostname)
+ if defined? @rc['webserv']['url_root'] \
+ and @rc['webserv']['url_root'] =~/http/
+ # needed for alternative output dir structures, fixes manifest url links, check may cause problems elsewhere
+ @rc['webserv']['url_root']
+ elsif path.webserv_dir \
+ and path.webserv =~ /#{path.webserv_dir}/ #revisit
+ "#{path.webserv}/#{@stub_pwd}".gsub(/#{path.webserv_dir}/,"#{url.hostname}/#{@stub_pwd}")
+ elsif defined? @rc['webserv']['webrick_url'] \
+ and @rc['webserv']['webrick_url']==false
+ "file://#{path.webserv}"
+ elsif port.webserv_port_cgi =~/\S+/
+ "#{url.hostname}:#{port.webserv_port_cgi}"
+ else
+ url.hostname
+ end
+ end
+ def webserv_base #web url for local webserv (localhost, or hostname)
+ if path.webserv_dir \
+ and path.webserv =~ /#{path.webserv_dir}/ #revisit
+ "#{path.webserv}/#{@stub_pwd}".gsub(/#{path.webserv_dir}/,"#{url.hostname}")
+ elsif defined? @rc['webserv']['webrick_url'] \
+ and @rc['webserv']['webrick_url']==false
+ "file://#{path.webserv}"
+ else "#{url.webrick_base}"
+ end
+ end
+ def webserv_files_from_db #sort this out, messy
+ if defined? @rc['webserv_cgi']['file_links']
+ case @rc['webserv_cgi']['file_links']
+ when /webserv_cgi/; url.webserv_base_cgi
+ when /webserv/; @rc['webserv']['url_root']
+ when /https?:\/\//; @rc['webserv_cgi']['file_links']
+ when /\S+/; "http://#{@rc['webserv_cgi']['file_links']}"
+ else webserv_base_cgi
+ end
+ else webserv_base_cgi
+ end
+ end
+ def sample_search_form_title
+ if defined? @rc['search']['sisu']['title'] \
+ and @rc['search']['sisu']['title'] =~/\S+/
+ @rc['search']['sisu']['title']
+ else %{(SiSU (generated sample) search form}
+ end
+ end
+ def output_tell #BROKEN Revisit 2011-02
+ output_type=if defined? @rc['show_output_on'] \
+ and @rc['show_output_on'] =~/^(?:filesystem|webserv|(?:local|remote)(?:_webserv)?|webrick)/
+ @rc['show_output_on']
+ else 'filesystem'
+ end
+ output=case output_type
+ when /^filesystem(?:_url)?/; url.dir_url
+ when /^remote(?:_webserv)?/; url.remote
+ when /^(?:webserv|local_webserv)/; url.local
+ when /^local(:\d+)/; url.hostname + $1 + '/' + stub_pwd
+ when /^localhost(:\d+)/; url.localhost + $1 + '/' + stub_pwd
+ when /^localhost/; url.localhost
+ when /^webrick/; url.webrick
+ when /^path/; url.webserv_map_pwd
+ else url.webserv_map_pwd
+ end
+ end
+ def images
+ "#{Xx[:html_relative2]}/_sisu/image"
+ end
+ #def images
+ # '../_sisu/image'
+ #end
+ def images_local
+ if FileTest.directory?(path.image_source_include)
+ path.image_source_include
+ else
+ if @@local_image==true
+ cmd=@cmd ? @cmd : ''
+ SiSU_Screen::Ansi.new(cmd,"WARNING - no local image directory or images:", defaults[:image_local] ).warn unless cmd =~/q/
+ @@local_image=false
+ end
+ url.images
+ end
+ end
+ def images_external
+ if FileTest.directory?(image_external)
+ if @@image_flag
+ images=Dir.glob("#{image_external}/*.{png,jpg,gif}")
+ pth="#{path.webserv}/#{@stub_pwd}"
+ FileUtils::mkdir_p("#{pth}/_sisu/image_external") unless FileTest.directory?("#{pth}/_sisu/image_external")
+ images.each { |i| File.install(i,"#{pth}/#{i}") } unless images.length > 0
+ @@image_flag=false
+ end
+ "#{Xx[:html_relative2]}/_sisu/image_external"
+ else
+ if @@local_image==true
+ SiSU_Screen::Ansi.new(@cmd,"WARNING - image directory for external images or no such images:", :image_external ).warn unless @cmd =~/q/
+ @@local_image=false
+ end
+ url.images_external
+ end
+ end
+ def images_epub
+ './image'
+ end
+ self
+ end
+ def port
+ def webrick_port
+ if @md \
+ and @md.opt.cmd.inspect=~/-F/ \
+ and @md.opt.mod.inspect=~/port=(\d+)/
+ $1
+ else
+ if defined? @rc['webserv_cgi']['port']
+ if @rc['webserv_cgi']['port'].nil? \
+ and (defined? @md.opt.mod \
+ and not @md.opt.mod.nil? \
+ and @md.opt.mod.inspect=~/webrick/)
+ defaults[:webserv_port_cgi]
+ elsif not @rc['webserv_cgi']['port'].nil?
+ @rc['webserv_cgi']['port']
+ else defaults[:webserv_port_cgi]
+ end
+ else defaults[:webserv_port_cgi]
+ end
+ end
+ end
+ def webserv_port_cgi
+ if @md \
+ and defined? @md.opt \
+ and @md.opt.cmd.inspect=~/-F/ \
+ and @md.opt.mod.inspect=~/port=(\d+)/
+ $1
+ else
+ if defined? @rc['webserv_cgi']['port']
+ if @rc['webserv_cgi']['port'].nil? \
+ and (defined? @md.opt.mod \
+ and not @md.opt.mod.nil? \
+ and @md.opt.mod.inspect=~/webrick/)
+ defaults[:webserv_port_cgi]
+ elsif not @rc['webserv_cgi']['port'].nil?
+ @rc['webserv_cgi']['port']
+ else nil
+ end
+ else nil
+ end
+ end
+ end
+ self
+ end
+ def digest
+ def type
+ if defined? @rc['default']['digest'] \
+ and @rc['default']['digest'] != nil
+ case @rc['default']['digest']
+ when /^sha(?:2|256)?$/; 'sha256'
+ when /^md5$/; 'md5'
+ else 'sha256'
+ end
+ else 'sha256'
+ end
+ end
+ def length
+ case digest.type
+ when /sha256/; 64
+ when /md5/; 32
+ else 64
+ end
+ end
+ def pattern
+ "[0-9a-f]{#{digest.length}}" #/[0-9a-f]{#{digest.length}}/
+ end
+ self
+ end
+ def program
+ def text_editor
+ if defined? @rc['program_select']['editor'] \
+ and @rc['program_select']['editor'] =~/\S\S+/
+ @rc['program_select']['editor']
+ elsif defined? @rc['program_select']['text_editor'] \
+ and @rc['program_select']['text_editor'] =~/\S\S+/
+ @rc['program_select']['text_editor']
+ else 'editor' #'gvim -c :R -c :S'
+ end
+ end
+ def pdf_viewer
+ ((defined? @rc['program_select']['pdf_viewer']) \
+ && @rc['program_select']['pdf_viewer'] =~/\S\S+/) \
+ ? @rc['program_select']['pdf_viewer']
+ : 'pdf-viewer' #'evince'
+ end
+ def web_browser
+ if defined? @rc['program_select']['www_browser'] \
+ and @rc['program_select']['www_browser'] =~/\S\S+/
+ @rc['program_select']['www_browser']
+ elsif defined? @rc['program_select']['web_browser'] \
+ and @rc['program_select']['web_browser'] =~/\S\S+/
+ @rc['program_select']['web_browser']
+ else 'x-www-browser' #'firefox' 'iceweasel' 'kazehakase' 'galeon'
+ end
+ end
+ def www_browser
+ web_browser
+ end
+ def console_web_browser
+ if defined? @rc['program_select']['console_www_browser'] \
+ and @rc['program_select']['console_www_browser'] =~/\S\S+/
+ @rc['program_select']['console_www_browser']
+ elsif defined? @rc['program_select']['console_web_browser'] \
+ and @rc['program_select']['console_web_browser'] =~/\S\S+/
+ @rc['program_select']['console_web_browser']
+ else 'console-www-browser' #'lynx' 'links' 'links2' 'elinks' 'w3m'
+ end
+ end
+ def console_www_browser
+ web_browser
+ end
+ def epub_viewer
+ ((defined? @rc['program_select']['epub_viewer']) \
+ && @rc['program_select']['epub_viewer'] =~/\S\S+/) \
+ ? @rc['program_select']['epub_viewer']
+ : 'ebook-viewer' #'calibre' 'fbreader'
+ end
+ def xml_viewer
+ ((defined? @rc['program_select']['xml_viewer']) \
+ && @rc['program_select']['xml_viewer'] =~/\S\S+/) \
+ ? @rc['program_select']['xml_viewer']
+ : text_editor
+ end
+ def xml_editor
+ xml_viewer
+ end
+ def odf_viewer
+ ((defined? @rc['program_select']['odf_viewer']) \
+ && @rc['program_select']['odf_viewer'] =~/\S\S+/) \
+ ? @rc['program_select']['odf_viewer']
+ : 'lowriter' #'odf-viewer','oowriter'
+ end
+ def manpage_viewer
+ 'man'
+ end
+ def manpage_generator
+ ((defined? @rc['program_select']['man']) \
+ && @rc['program_select']['man'] =~/\S\S+/) \
+ ? @rc['program_select']['man']
+ : 'nroff -man' #'nroff -man' #'groff -man -Tascii'
+ end
+ def texinfo
+ ((defined? @rc['program_select']['info_viewer']) \
+ && @rc['program_select']['info_viewer'] =~/\S\S+/) \
+ ? @rc['program_select']['info_viewer']
+ : 'pinfo -f' #'pinfo -f' 'info' 'tkinfo'
+ end
+ def file_encoding
+ is=(defined? @rc['program_set']['file_encoding']) ? @rc['program_set']['encoding'] : ''
+ (is.nil? || is==true) ? 'encoding' : is
+ end
+ def wc #wordcount
+ is=(defined? @rc['program_set']['wc']) ? @rc['program_set']['wc'] : ''
+ (is.nil? || is==true) ? 'wc' : is
+ end
+ def tidy
+ is=(defined? @rc['program_set']['tidy']) ? @rc['program_set']['tidy'] : nil
+ (is.nil? || is==true) ? 'tidy' : is
+ end
+ def rmagick
+ is=(defined? @rc['program_set']['rmagick']) ? @rc['program_set']['rmagick'] : nil
+ (is.nil? || is==true) ? 'rmagick' : is
+ end
+ def rexml #should be part of ruby 1.8 but apparently not always
+ is=(defined? @rc['program_set']['rexml']) ? @rc['program_set']['rexml'] : ''
+ (is.nil? || is==true) ? 'rexml' : is
+ end
+ def pdflatex
+ is=(defined? @rc['program_set']['pdflatex']) ? @rc['program_set']['pdflatex'] : ''
+ (is.nil? || is==true) ? 'pdflatex' : is
+ end
+ def postgresql
+ is=(defined? @rc['program_set']['postgresql']) ? @rc['program_set']['postgresql'] : ''
+ (is.nil? || is==true) ? 'postgresql' : is
+ end
+ def sqlite
+ is=(defined? @rc['program_set']['sqlite']) ? @rc['program_set']['sqlite'] : ''
+ (is.nil? || is==true) ? 'sqlite' : is
+ end
+ self
+ end
+ def i18n
+ def language # language settings
+ m=/.+\/\S+?\~(\S+)/
+ pwd=Dir.pwd
+ conf=(defined? @rc['default']['language']) ? @rc['default']['language'] : nil
+ l=if pwd=~ m; pwd[m,1] #2 directory: by visible directory name
+ elsif conf; @rc['default']['language'] #3 config: from sisurc.yaml
+ else defaults[:language] #4 sisu: program default
+ end #1 document: param gets
+ SiSU_Env::StandardiseLanguage.new(l)
+ end
+ #def multilingual
+ # x=(defined? @rc['output_structure']['multilingual'] \
+ # && @rc['output_structure']['multilingual'] ==true) \
+ # ? true : false
+ #end
+ #def bundle
+ # x=(defined? @rc['output_structure']['bundle'] \
+ # && @rc['output_structure']['bundle'] ==true) \
+ # ? true : false
+ #end
+ def lang_filename(l)
+ @lang={}
+ x=if output_dir_structure.by_language_code?
+ (( defined? @rc['default']['language_file']) \
+ && @rc['default']['language_file'] != nil) \
+ ? @rc['default']['language_file']
+ : 1
+ else 0
+ end
+ if (l != defaults[:language_code]) \
+ or (language.code != defaults[:language_code]) #watch
+ if x==1; @lang[:pre],@lang[:mid],@lang[:post]="#{l}.",'',''
+ elsif x==2; @lang[:pre],@lang[:mid],@lang[:post]='',".#{l}",''
+ elsif x==3; @lang[:pre],@lang[:mid],@lang[:post]='','',".#{l}"
+ else @lang[:pre],@lang[:mid],@lang[:post]='','',''
+ end
+ else @lang[:pre],@lang[:mid],@lang[:post]='','',''
+ end
+ @lang
+ end
+ self
+ end
+ def file_encoding
+ is=''
+ if defined? @rc['program_set']['file_encoding']; is=@rc['program_set']['encoding']
+ end
+ if is.nil? \
+ or is==true
+ is='encoding'
+ end
+ is
+ end
+ def papersize # paper settings, default overidden in param if set within document
+ (defined? @rc['default']['papersize']) \
+ ? @rc['default']['papersize'].downcase
+ : (defaults[:papersize].downcase)
+ end
+ def odf_structure
+ FileUtils::rm_rf(processing_path.processing_path.odf_pth)
+ FileUtils::mkdir_p(processing_path.processing_path.odf_pth)
+ system("unzip -q #{path.share}/#{SiSU_version_dir}/odf/odt.zip -d #{processing_path.odf_pth}")
+ end
+ def sisupod_gen(fns_pod)
+ sisupod_gen_v3(fns_pod)
+ end
+ def sisupod_gen_v3(fns_pod)
+ pwd=Dir.pwd
+ sisupod_processing_path="#{processing_path.processing}/#{Gt[:sisupod]}"
+ if FileTest.directory?(sisupod_processing_path) \
+ or FileTest.file?(sisupod_processing_path)
+ FileUtils::rm_rf(sisupod_processing_path)
+ end
+ unless FileTest.directory?(sisupod_processing_path)
+ FileUtils::mkdir_p(sisupod_processing_path)
+ end
+ f_pod=if FileTest.file?("#{Dir.pwd}/#{fns_pod}")
+ "#{Dir.pwd}/#{fns_pod}"
+ elsif FileTest.file?(fns_pod)
+ fns_pod
+ end
+ if f_pod \
+ && FileTest.file?(f_pod)
+ tree=(SiSU_Env::SystemCall.new.program_found?('tree')) \
+ ? "tree #{processing_path.processing}/#{Gt[:sisupod]}"
+ : ''
+ if FileTest.directory?(processing_path.processing)
+ Dir.chdir(processing_path.processing)
+ system(%{tar xJf #{f_pod}})
+ Dir.chdir(pwd)
+ end
+ #system(tree) #enable if (/[vVM]/)
+ else
+ SiSU_Screen::Ansi.new('',"*WARN* file not found: #{fns_pod}").warn unless @cmd=~/q/
+ end
+ sisupod_processing_path
+ end
+ def sisupod_gen_v2(fns_pod)
+ pwd=Dir.pwd
+ sisupod_processing_path="#{processing_path.processing}/#{Gt[:sisupod]}"
+ if FileTest.directory?(sisupod_processing_path) \
+ or FileTest.file?(sisupod_processing_path)
+ FileUtils::rm_rf(sisupod_processing_path)
+ end
+ unless FileTest.directory?(sisupod_processing_path)
+ FileUtils::mkdir_p(sisupod_processing_path)
+ end
+ (FileTest.file?(fns_pod)) \
+ ? system("unzip -q #{fns_pod} -d #{processing_path.processing}")
+ : (SiSU_Screen::Ansi.new('',"*WARN* file not found: #{fns_pod}").warn unless @cmd=~/q/)
+ sisupod_processing_path
+ end
+ end
+ class InfoProcessingFlag
+ attr_accessor :color,:cf_0,:cf_1,:cf_2,:cf_3,:cf_4,:cf_5
+ def initialize
+ @rc=GetInit.new.sisu_yaml.rc
+ end
+ def color #processing flag shortcuts
+ (defined? @rc['flag']['color']) ? @rc['flag']['color'] : false
+ end
+ def cf_0 #processing flag shortcuts
+ if defined? @rc['flag']['default'] \
+ and @rc['flag']['default'].is_a?(String)
+ @rc['flag']['default']
+ else '-NQhewpotbxXdyYv'
+ end
+ end
+ def cf_1 #processing flag shortcuts
+ if defined? @rc['flag']['i'] \
+ and @rc['flag']['i'].is_a?(String)
+ @rc['flag']['i']
+ else '-Qhewpoty'
+ end
+ end
+ def cf_2 #processing flag shortcuts
+ if defined? @rc['flag']['ii'] \
+ and @rc['flag']['ii'].is_a?(String)
+ @rc['flag']['ii']
+ else '-NQhewpotbxXdy'
+ end
+ end
+ def cf_3 #processing flag shortcuts
+ if defined? @rc['flag']['iii'] \
+ and @rc['flag']['iii'].is_a?(String)
+ @rc['flag']['iii']
+ else '-NQhewpotbxXdyY'
+ end
+ end
+ def cf_4 #processing flag shortcuts
+ if defined? @rc['flag']['iv'] \
+ and @rc['flag']['iv'].is_a?(String)
+ @rc['flag']['iv']
+ else '-NQhewpotbxXdDyY --update'
+ end
+ end
+ def cf_5 #processing flag shortcuts
+ if defined? @rc['flag']['v'] \
+ and @rc['flag']['v'].is_a?(String)
+ @rc['flag']['v']
+ else '-NQhewpotbxXdDyYv --update'
+ end
+ end
+ end
+ class InfoSettings < InfoEnv
+ def permission?(prog) #program defaults
+ (defined? @rc['permission_set'][prog]) \
+ ? @rc['permission_set'][prog]
+ : false
+ end
+ def program?(prog) #program defaults
+ (defined? @rc['program_set'][prog]) \
+ ? @rc['program_set'][prog]
+ : false
+ end
+ end
+ class FileMap < InfoEnv
+ attr_accessor :local_sisu_source
+ def initialize(opt='') #watch / REVIEW
+ super()
+ @opt=opt #,opt.fns,opt.cmd
+ @env=(@opt.fns && !(@opt.fns.empty?) \
+ ? (SiSU_Env::InfoEnv.new(@opt.fns))
+ : (SiSU_Env::InfoEnv.new('dummy.sst')))
+ if @opt.cmd =~/m/; @md=SiSU_Param::Parameters.new(@opt).get
+ end
+ ft=[]
+ if @md \
+ and defined? @md.fn \
+ and @md.fn # used for by_language_code?
+ if @md.opt.cmd =~ /[hH]/
+ ft << @md.fn[:html]
+ end
+ if @md.opt.cmd =~ /w/ \
+ and @md.opt.cmd !~ /[hH]/
+ ft << @md.fn[:concordance]
+ end
+ if @md.opt.cmd =~ /y/ \
+ and @md.opt.cmd !~ /[hH]/
+ ft << @md.fn[:manifest]
+ end
+ if @md.opt.cmd =~ /[at]/; ft << @md.fn[:plain]
+ end
+ if @md.opt.cmd =~ /b/; ft << @md.fn[:xhtml]
+ end
+ if @md.opt.cmd =~ /e/; ft << @md.fn[:epub]
+ end
+ if @md.opt.cmd =~ /g/; ft << @md.fn[:wiki]
+ end
+ if @md.opt.cmd =~ /i/; ft << @md.fn[:manpage]
+ end
+ if @md.opt.cmd =~ /N/; ft << @md.fn[:digest]
+ end
+ if @md.opt.cmd =~ /o/; ft << @md.fn[:odf]
+ end
+ if @md.opt.cmd =~ /O/; ft << @md.fn[:oai_pmh]
+ end
+ if @md.opt.cmd =~ /p/; ft << @md.fn[:pdf_l] << @md.fn[:pdf_p]
+ end
+ if @md.opt.cmd =~ /s/; ft << @md.fns
+ end
+ if @md.opt.cmd =~ /S/; ft << @md.fn[:sisupod] << '.kdi'
+ end
+ if @md.opt.cmd =~ /x/; ft << @md.fn[:sax]
+ end
+ if @md.opt.cmd =~ /X/; ft << @md.fn[:dom]
+ end
+ if @md.opt.cmd =~ /G/; ft << @md.fn[:pot]
+ end
+ @fnb=@md.fnb
+ else # still needed where/when param is not parsed
+ if @opt.cmd =~ /[hH]/; ft << '.html' << '.html.??'
+ end
+ if @opt.cmd =~ /w/ \
+ and @opt.cmd !~ /[hH]/
+ ft << 'concordance.html' << '??.concordance.html' << 'concordance.??.html'
+ end
+ if @opt.cmd =~ /y/ \
+ and @opt.cmd !~ /[hH]/
+ ft << 'sisu_manifest.html' << '??.sisu_manifest.html' << 'sisu_manifest.??.html'
+ end
+ if @opt.cmd =~ /a/; ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt'
+ end
+ if @opt.cmd =~ /b/; ft << 'scroll.xhtml' << '??.scroll.xhtml' << 'scroll.??.xhtml'
+ end
+ if @opt.cmd =~ /e/; ft << @fnb << '.epub'
+ end
+ if @opt.cmd =~ /g/; ft << 'wiki.txt' << '??.wiki.txt' << 'wiki.??.txt'
+ end
+ if @opt.cmd =~ /i/; ft << '.1' << '??.man.1' << 'man.??.1'
+ end
+ if @opt.cmd =~ /N/; ft << 'digest.txt' << '??.digest.txt' << 'digest.??.txt'
+ end
+ if @opt.cmd =~ /o/; ft << 'opendocument.odt' << '??.opendocument.odt' << 'opendocument.??.odt'
+ end
+ if @opt.cmd =~ /O/; ft << 'oai_pmh.xml'
+ end
+ if @opt.cmd =~ /p/; ft << 'landscape.pdf' << 'portrait.pdf' << '.pdf'
+ end
+ if @opt.cmd =~ /s/; ft << '.sst' << '.ssi' << '.ssm'
+ end
+ if @opt.cmd =~ /S/; ft << '.zip' << '.kdi'
+ end
+ if @opt.cmd =~ /x/; ft << 'sax.xml' << '??.sax.xml' << 'sax.??.xml'
+ end
+ if @opt.cmd =~ /X/; ft << 'dom.xml' << '??.dom.xml' << 'dom.??.xml'
+ end
+ if @opt.mod.inspect =~ /sxm|sxs|xml/; ft << @fnb << '.sxs.xml'
+ end
+ if @opt.mod.inspect =~ /sxd/; ft << @fnb << '.sxd.xml'
+ end
+ if @opt.mod.inspect =~ /sxn/; ft << @fnb << '.sxn.xml'
+ end
+ end
+ ft=ft.uniq
+ filetypes=ft.join(',')
+ @filetypes=if filetypes !~/..+/; '' # -r called alone, copy all
+ elsif @opt.cmd =~/u/; '' # -u added, copy all, (used to create remote directory tree see output path), not the usual function of -u
+ elsif filetypes =~/\S+?,\S+/; '*{' + filetypes + '}' # more than one relevant file type
+ else '*' + filetypes # one relevant file type
+ end
+ @source_path=(@fnb && !(@fnb.empty?) \
+ ? "#{@env.path.output}/#{@fnb}"
+ : @env.path.output)
+ @source_path_epub=(@fnb && !(@fnb.empty?) \
+ ? "#{@env.path.output}/epub"
+ : @env.path.output_epub)
+ @source_path_src=(@fnb && !(@fnb.empty?) \
+ ? "#{@env.path.output}/src"
+ : @env.path.output_src)
+ @source_path_pod=(@fnb && !(@fnb.empty?) \
+ ? "#{@env.path.output}/pod"
+ : @env.path.output_pod)
+ @source_path_harvest=(@fnb && !(@fnb.empty?) \
+ ? "#{@env.path.output}/manifest"
+ : @env.path.output_harvest)
+ @local_sisu_source=(@filetypes =~/\S/) \
+ ? "#{@source_path}/#{@filetypes}"
+ : @source_path
+ end
+ end
+ class CleanOutput
+ require 'fileutils'
+ include FileUtils::Verbose
+ def initialize(opt)
+ @opt=opt
+ z=SiSU_Env::FileMap.new(@opt)
+ @zap=z.local_sisu_source
+ if @opt.cmd =~ /[hH]/
+ @zap=Dir.glob(@zap).join(' ')
+ @zap=if @opt.cmd !~ /w/
+ @zap.gsub(/#{@source_path}\/concordance.html/,'')
+ else @zap
+ end
+ end
+ @env=SiSU_Env::InfoEnv.new
+ end
+ def zap
+ def main_output
+ (@zap !~/\/\//) \
+ ? (FileUtils::rm_rf(@zap) if FileTest.directory?(@zap))
+ : (puts 'suspect zap request, ignored')
+ end
+ def site_map
+ if @opt.fnb \
+ and not @opt.fnb.empty?
+ sm="#{@env.path.output}/sitemaps/sitemap_#{@opt.fnb}.xml"
+ FileUtils::rm(sm) if FileTest.file?(sm)
+ end
+ end
+ def epub
+ if @opt.fnb \
+ and not @opt.fnb.empty?
+ sm="#{@env.path.output}/epub/#{@opt.fnb}.epub"
+ FileUtils::rm(sm) if FileTest.file?(sm)
+ end
+ end
+ def src # consider
+ if @opt.fnb \
+ and not @opt.fnb.empty?
+ sm="#{@env.path.output}/src/pod/#{@opt.fns}.txz"
+ FileUtils::rm(sm) if FileTest.file?(sm)
+ sm="#{@env.path.output}/src/#{@opt.fns}"
+ FileUtils::rm(sm) if FileTest.file?(sm)
+ end
+ end
+ self
+ end
+ end
+ class InfoRemoteHost
+ def initialize
+ @rc=GetInit.new.sisu_yaml.rc
+ end
+ def remote_host #see InfoRemote remote_host_base_general
+ r=[]
+ r=if (defined? @rc['remote'] \
+ and @rc['remote'].is_a?(Array))
+ r_array=@rc['remote']
+ r_array.each_with_index do |renv,i|
+ r[i]={}
+ if defined? renv['user'] \
+ and defined? renv['host']
+ end
+ r[i][:user]=renv['user']
+ r[i][:host]=renv['host']
+ r[i][:path]=if defined? renv['path']
+ renv['path']
+ else ''
+ end
+ r[i][:name]="#{r[i][:user]}@#{r[i][:host]}:#{r[i][:path]}"
+ end
+ r
+ elsif (defined? @rc['remote'] \
+ and @rc['remote'].is_a?(Hash) \
+ and defined? @rc['remote']['user'] \
+ and defined? @rc['remote']['host'])
+ r[0]={}
+ r[0][:user]=@rc['remote']['user']
+ r[0][:host]=@rc['remote']['host']
+ r[0][:path]=if defined? @rc['remote']['path']
+ @rc['remote']['path']
+ else ''
+ end
+ r[0][:name]="#{r[0][:user]}@#{r[0][:host]}:#{r[0][:path]}"
+ r
+ else
+ r[0]={}
+ r[0][:name]='.'
+ r[0][:user]=''
+ r[0][:host]=''
+ r[0][:path]=''
+ #puts "no remote host or user"
+ r
+ end
+ end
+ def rhost
+ def r1
+ (defined? SiSU_Env::InfoRemoteHost.new.remote_host[0][:name]) \
+ ? (SiSU_Env::InfoRemoteHost.new.remote_host[0][:name])
+ : nil
+ end
+ def r2
+ (defined? SiSU_Env::InfoRemoteHost.new.remote_host[1][:name]) \
+ ? (SiSU_Env::InfoRemoteHost.new.remote_host[1][:name])
+ : nil
+ end
+ def r3
+ (defined? SiSU_Env::InfoRemoteHost.new.remote_host[2][:name]) \
+ ? (SiSU_Env::InfoRemoteHost.new.remote_host[2][:name])
+ : nil
+ end
+ def r4
+ (defined? SiSU_Env::InfoRemoteHost.new.remote_host[3][:name]) \
+ ? (SiSU_Env::InfoRemoteHost.new.remote_host[3][:name])
+ : nil
+ end
+ def r5
+ (defined? SiSU_Env::InfoRemoteHost.new.remote_host[4][:name]) \
+ ? (SiSU_Env::InfoRemoteHost.new.remote_host[4][:name])
+ : nil
+ end
+ def r6
+ (defined? SiSU_Env::InfoRemoteHost.new.remote_host[5][:name]) \
+ ? (@ls + SiSU_Env::InfoRemoteHost.new.remote_host[5][:name])
+ : nil
+ end
+ self
+ end
+ end
+ class InfoRemote < FileMap
+ @@flag_remote=false
+ require 'socket'
+ def initialize(opt)
+ super(opt) #
+ @opt=opt
+ @rc=GetInit.new.sisu_yaml.rc
+ end
+ def remote_host_base_general
+ SiSU_Env::InfoRemoteHost.new.remote_host
+ end
+ def remote_host_base
+ remote_host_base_general.each do |remote_conn|
+ @@flag_remote=true if remote_conn[:name] =~/\S+?@\S+/
+ end
+ remote_host_base_general
+ end
+ def scp #sort out later using ruby libraries #not ideal, first time each file is sent, -r must be called separately for subdir to be built
+ def document
+ self.remote_host_base.each do |remote_conn|
+ local_gen=@source_path
+ remote_gen=case @opt.cmd
+ when /u/; "#{remote_conn[:name]}/#{@env.path.stub_pwd}/." #creates remote directory tree, this is not the usual function of u
+ when /[abhHNopwxXy]/; "#{remote_conn[:name]}/#{@env.path.stub_pwd}/#{@fnb}/."
+ else "#{remote_conn[:name]}/#{@env.path.stub_pwd}/."
+ end
+ local_epub=@source_path_epub
+ local_src=@source_path_src
+ local_pod=@source_path_pod
+ remote_epub="#{remote_conn[:name]}/#{@env.path.stub_epub}/."
+ remote_src="#{remote_conn[:name]}/#{@env.path.stub_src}/."
+ remote_pod="#{remote_conn[:name]}/#{@env.path.stub_pod}/."
+ src_txt=@opt.fnc
+ src_pod=@opt.fncb.gsub(/(\.ss[mt])(?:\.sst)?$/,'\1.txz')
+ if (local_gen =~/\S/ \
+ and local_gen !~/\/\//) \
+ and (remote_gen =~/\S/ \
+ and remote_gen !~/\/\//) \
+ and @@flag_remote==true \
+ and @opt.cmd !~/U/
+ SiSU_Env::SystemCall.new(local_gen,remote_gen).scp
+ if FileTest.file?("#{local_src}/#{src_txt}")
+ SiSU_Env::SystemCall.new("#{local_src}/#{src_txt}",remote_src).scp
+ end
+ if FileTest.file?("#{local_pod}/#{src_pod}")
+ SiSU_Env::SystemCall.new("#{local_src}/#{src_pod}",remote_pod).scp
+ end
+ if FileTest.file?("#{local_epub}/#{@opt.fnb}.epub")
+ SiSU_Env::SystemCall.new("#{local_epub}/#{@opt.fnb}.epub",remote_epub,@opt.cmd).scp
+ end
+ elsif @opt.cmd =~/U/
+ puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
+ puts "#{local_gen} -> #{remote_gen}"
+ if FileTest.file?("#{local_src}/#{src_doc}")
+ puts "#{local_src}/#{src_doc}* -> #{remote_src}"
+ end
+ if FileTest.file?("#{local_pod}/#{src_doc}.txz")
+ puts "#{local_pod}/#{src_doc}* -> #{remote_pod}"
+ end
+ else
+ puts 'suspect scp request, ignored'
+ puts "#{local_gen} -> #{remote_gen} remote flag: #{@@flag_remote}"
+ puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
+ end
+ end
+ end
+ def site_base #base site
+ self.remote_host_base.each do |remote_conn|
+ local=@source_path
+ remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/."
+ if defined? @rc['permission_set']['remote_base_site'] \
+ and @rc['permission_set']['remote_base_site'] \
+ and @@flag_remote==true \
+ and @opt.cmd !~/U/
+ puts "begin scp_base: #{local} -> #{remote}"
+ SiSU_Env::SystemCall.new("#{local}/#{@env.path.style}/",remote).scp
+ elsif @opt.cmd =~/U/
+ puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
+ puts "begin scp_base: #{local} -> #{remote}"
+ puts "#{local}/#{@env.path.style}/ -> #{remote}"
+ else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
+ end
+ end
+ end
+ def site_base_all #base site
+ self.remote_host_base.each do |remote_conn|
+ local=@source_path
+ remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/."
+ if defined? @rc['permission_set']['remote_base_site'] \
+ and @rc['permission_set']['remote_base_site'] \
+ and @@flag_remote==true \
+ and @opt.cmd !~/U/
+ puts "begin scp_base_all: #{local} -> #{remote}"
+ SiSU_Env::SystemCall.new("#{local}/_sisu/image_sys/",remote).scp
+ SiSU_Env::SystemCall.new("#{local}/_sisu/image/",remote).scp
+ SiSU_Env::SystemCall.new("#{local}/#{@env.path.style}/",remote).scp
+ elsif @opt.cmd =~/U/
+ puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
+ puts "scp_base_all: #{local} -> #{remote}"
+ puts "#{local}/_sisu/image_sys/ -> #{remote}"
+ puts "#{local}/_sisu/image/ -> #{remote}"
+ puts "#{local}/#{@env.path.style}/ -> #{remote}"
+ else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
+ end
+ end
+ end
+ self
+ end
+ def rsync
+ @f=SiSU_Env::FileOp.new(@md)
+ def document
+ self.remote_host_base.each do |remote_conn|
+ local_gen=@source_path
+ #local_gen_image="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image"
+ #local_gen_image_external="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image_external"
+ remote_gen="#{remote_conn[:name]}/#{@env.path.stub_pwd}/."
+ remote_rel=remote_conn[:name] + '/' + @f.output_path.stub.rcp
+ src_txt=@opt.fnc
+ if (local_gen =~/\S/ \
+ and local_gen !~/\/\//) \
+ and (remote_gen =~/\S/ \
+ and remote_gen !~/\/\//) \
+ and @@flag_remote==true \
+ and @opt.cmd !~/U/
+# SiSU_Env::SystemCall.new("#{local_src}/#{src_txt}",remote_src,@opt.cmd).rsync
+ delete_extra_files='--delete' # '--delete-after'
+ inp=[]
+ if (@opt.act[:html][:set]==:on \
+ || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \
+ && FileTest.file?(@f.place_file.html_scroll.dir)
+ inp << @f.output_path.html_seg.rel << @f.place_file.html_scroll.rel
+ end
+ if (@opt.act[:concordance][:set]==:on \
+ || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \
+ && FileTest.file?(@f.place_file.html_concordance.dir)
+ inp << @f.place_file.html_concordance.rel
+ end
+ if (@opt.act[:epub][:set]==:on \
+ || @opt.cmd =~/^-R[mqvVM]*$/) \
+ && FileTest.file?(@f.place_file.epub.dir)
+ inp << @f.place_file.epub.rel
+ end
+ if (@opt.act[:odt][:set]==:on \
+ || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \
+ && FileTest.file?(@f.place_file.odt.dir)
+ inp << @f.place_file.odt.rel
+ end
+ if (@opt.act[:xhtml][:set]==:on \
+ || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \
+ && FileTest.file?(@f.place_file.xhtml.dir)
+ inp << @f.place_file.xhtml.rel
+ end
+ if (@opt.act[:xml_sax][:set]==:on \
+ || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \
+ && FileTest.file?(@f.place_file.xml_sax.dir)
+ inp << @f.place_file.xml_sax.rel
+ end
+ if (@opt.act[:xml_dom][:set]==:on \
+ || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \
+ && FileTest.file?(@f.place_file.xml_dom.dir)
+ inp << @f.place_file.xml_dom.rel
+ end
+ if (@opt.act[:txt][:set]==:on \
+ || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \
+ && FileTest.file?(@f.place_file.txt.dir)
+ inp << @f.place_file.txt.rel
+ end
+ if (@opt.act[:manpage][:set]==:on \
+ || @opt.cmd =~/^-[mqvVM]*i[mqvVM]*$/) \
+ && FileTest.file?(@f.place_file.manpage.dir)
+ inp << @f.place_file.manpage.rel
+ end
+ if (@opt.act[:texinfo][:set]==:on \
+ || @opt.cmd =~/^-[mqvVM]*I[mqvVM]*$/) \
+ && FileTest.file?(@f.place_file.info.dir)
+ inp << @f.place_file.info.rel
+ end
+ if (@opt.act[:hash_digests][:set]==:on \
+ || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \
+ && FileTest.file?(@f.place_file.hash_digest.dir)
+ inp << @f.place_file.hash_digest.rel
+ end
+ if (@opt.act[:share_source][:set]==:on \
+ || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \
+ && FileTest.file?(@f.place_file.src.dir)
+ inp << @f.place_file.src.rel
+ end
+ if (@opt.act[:sisupod][:set]==:on \
+ || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \
+ && FileTest.file?(@f.place_file.sisupod.dir)
+ inp << @f.place_file.sisupod.rel
+ end
+ if (@opt.act[:pdf][:set]==:on \
+ || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/)
+ inp << @f.output_path.pdf.rel + '/' + @opt.fnb + '*'
+ end
+ if (@opt.act[:sqlite_discreet][:set]==:on \
+ || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \
+ && FileTest.file?(@f.place_file.sqlite_discreet.dir)
+ inp << @f.place_file.sqlite_discreet.rel
+ end
+ if (@opt.act[:qrcode][:set]==:on \
+ || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \
+ && FileTest.file?(@f.place_file.qrcode_md.dir)
+ inp << @f.place_file.qrcode_md.rel << @f.place_file.qrcode_title.rel
+ end
+ if (@opt.act[:manifest][:set]==:on \
+ || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \
+ && FileTest.file?(@f.place_file.manifest.dir)
+ inp << @f.place_file.manifest.rel
+ end
+ local_gen=if inp.length > 0
+ inp.join(' ')
+ else ''
+ end
+ local_css,images,images_external,images_system='','','',''
+ images_gen=images=images_skin=images_system=local_css=''
+ if @opt.cmd =~/[hwbxX]/ \
+ && (defined? @md.ec[:image]) \
+ && (@md.ec[:image].length > 0)
+ images=@f.place_file.images.rel + '/' + @md.ec[:image].join(" #{@f.output_path.images.rel}/")
+ end
+ if @opt.cmd =~/[yhwbxX]/ \
+ && (defined? @md.ec[:image]) \
+ && (@md.ec[:image].length > 0)
+ local_css=@f.output_path.css.rel
+ images_system='_sisu/image_sys'
+ if @f.output_path.images.rel.length > 0 \
+ && images_from_skin.length > 0
+ images_skin=@f.place_file.images.rel + '/' + images_from_skin.join(" #{@f.output_path.images.rel}/")
+ end
+ end
+ begin
+ ##create file structure without copying files?:
+ ##rsync -av -f"+ */" -f"- *" @f.output_path.base.dir remote:./path/.
+ #local_dirs=%{-f"+ */" -f"- *" #{@f.output_path.base.dir}/*}
+ #SiSU_Env::SystemCall.new(local_dirs,remote_gen,@opt.cmd).rsync
+ local=local_gen + ' ' + images + ' ' + images_skin + ' ' + images_system + ' ' + local_css
+ SiSU_Env::SystemCall.new(local,remote_rel,@opt.cmd).rsync('--relative',@f.output_path.base.dir)
+ rescue
+ p __LINE__.to_s + ':' + __FILE__
+ local_dirs=%{--include='*/' --exclude='*' #{@f.output_path.base.dir}}
+ SiSU_Env::SystemCall.new(local_dirs,remote_gen,@opt.cmd).rsync
+ end
+ elsif @opt.cmd =~/U/
+ puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
+ puts "#{local_gen} -> #{remote_gen}"
+ if FileTest.file?("#{local_src}/#{src_doc}") \
+ or FileTest.file?("#{local_src}/#{src_doc}.txz")
+ puts "#{local_src}/#{src_doc}* -> #{remote_src}"
+ end
+ else
+ puts 'suspect rsync request, ignored'
+ puts "#{local_gen} -> #{remote_gen} remote flag: #{@@flag_remote}"
+ puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
+ end
+ end
+ end
+ def site_base #base site
+ ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu"
+ image_sys="#{@env.path.webserv}/_sisu/image_sys"
+ images="#{@env.path.webserv}/_sisu/image"
+ self.remote_host_base.each do |remote_conn|
+ remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/."
+ remote_conf="#{remote_conn[:name]}/_sisu"
+ if defined? @rc['permission_set']['remote_base_site'] \
+ and @rc['permission_set']['remote_base_site'] \
+ and @@flag_remote==true \
+ and @opt.cmd !~/U/
+ SiSU_Env::SystemCall.new("#{image_sys}","#{remote_conf}").rsync
+ SiSU_Env::SystemCall.new("#{images}","#{remote_conf}").rsync
+ SiSU_Env::SystemCall.new("#{ldest}","#{remote}").rsync
+ elsif @opt.cmd =~/U/
+ puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
+ puts "rsync_base: #{local} -> #{remote}"
+ puts "#{local}/_sisu/image -> #{remote}"
+ puts "#{local}/_sisu/image_sys/ -> #{remote}"
+ puts "#{local}/#{@env.path.style}/ -> #{remote}"
+ else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
+ end
+ end
+ end
+ def site_base_sync
+ self.remote_host_base.each do |remote_conn|
+ local=@source_path
+ remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/."
+ if defined? @rc['permission_set']['remote_base_site'] \
+ and @rc['permission_set']['remote_base_site'] \
+ and @@flag_remote==true \
+ and @opt.cmd !~/U/
+ delete_extra_files='--delete' # '--delete-after'
+ puts "begin rsync_base_sync: #{local} -> #{remote}"
+ SiSU_Env::SystemCall.new("#{local}/_sisu/image_sys/",remote).rsync(delete_extra_files)
+ SiSU_Env::SystemCall.new("#{local}/_sisu/image/",remote).rsync(delete_extra_files)
+ SiSU_Env::SystemCall.new("#{local}/#{@env.path.style}/",remote).rsync(delete_extra_files)
+ elsif @opt.cmd =~/U/
+ puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
+ puts "rsync_base_sync: #{local} -> #{remote}"
+ puts "#{local}/_sisu/image_sys/ -> #{remote}"
+ puts "#{local}/_sisu/image/ -> #{remote}"
+ puts "#{local}/#{@env.path.style}/ -> #{remote}"
+ else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
+ end
+ end
+ end
+ self
+ end
+ def rsync_sitemaps #sitemap directory
+ self.remote_host_base.each do |remote_conn|
+ local="#{@source_path}/sitemapindex.xml"
+ remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/."
+ if @@flag_remote
+ delete_extra_files='--delete' # '--delete-after'
+ SiSU_Env::SystemCall.new(local,remote).rsync(delete_extra_files)
+ elsif @opt.cmd =~/U/
+ puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
+ puts "rsync_sitemaps: #{local} -> #{remote}"
+ else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
+ end
+ end
+ end
+ def rsync_harvest
+ self.remote_host_base.each do |remote_conn|
+ local=@source_path_harvest
+ remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/."
+ if @@flag_remote
+ delete_extra_files='--delete' # '--delete-after'
+ SiSU_Env::SystemCall.new(local,remote).rsync(delete_extra_files)
+ elsif @opt.cmd =~/U/
+ puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
+ puts "rsync_sitemaps: #{local} -> #{remote}"
+ else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
+ end
+ end
+ end
+ end
+ class InfoVersion <InfoEnv
+ include Singleton
+ require 'rbconfig'
+ @@lib_path=nil
+ def get_version
+ @version={}
+ @pwd=ENV['PWD']
+ yst_ver=SiSU_path_specified_Version_ \
+ ? SiSU_path_specified_Version_
+ : "#{defaults[:sisu_share]}/#{SiSU_version_dir}/v/version.yml"
+ lib_path=@@lib_path ? @@lib_path : `echo $RUBYLIB`.split(':')
+ @@lib_path ||=lib_path
+ if File.exist?(yst_ver); @version=YAML::load(File::open(yst_ver)) #unless @@noyaml
+ end
+ @version
+ end
+ def rbversion
+ %x{ruby -v}.strip
+ end
+ end
+ class InfoFile <InfoEnv #todo unify with FileOp
+ def initialize(fns)
+ begin
+ super(fns)
+ @fns=fns
+ @env=SiSU_Env::InfoEnv.new(@fns)
+ 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]
+ rescue
+ SiSU_Screen::Ansi.new('',$!,$@).rescue do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ end
+ end
+ def basefilename #Remove if possible
+ m=/(.+?)\.(?:(?:-|ssm\.)?sst|ssm)$/m
+ fnb=@fns[m,1]
+ end
+ def make_file(path,filename)
+ (File.writable?("#{path}/.")) \
+ ? File.new("#{path}/#{filename}",'w+')
+ : (SiSU_Screen::Ansi.new('',"*WARN* is the file or directory writable?, could not create #{filename}").warn)
+ end
+ def touch_file(path,filename)
+ if File.writable?("#{path}/.");
+ FileUtils::touch("#{path}/#{filename}")
+ else SiSU_Screen::Ansi.new('',"*WARN* is the file or directory writable?, could not create #{filename}").warn
+ end
+ end
+ def make_path(path)
+ FileUtils::mkdir_p(path) unless FileTest.directory?(path)
+ end
+ def marshal
+ def dal_content
+ "#{@env.processing_path.dal}/#{@fns}.content.rbm"
+ end
+ def dal_idx_sst_rel_html_seg
+ "#{@env.processing_path.dal}/#{@fns}.idx_sst.rbm"
+ end
+ def dal_idx_sst_rel #used by tex & odf
+ "#{@env.processing_path.dal}/#{@fns}.idx_raw.rbm"
+ end
+ def dal_idx_html
+ "#{@env.processing_path.dal}/#{@fns}.idx_html.rbm"
+ end
+ def dal_idx_xhtml
+ "#{@env.processing_path.dal}/#{@fns}.idx_xhtml.rbm"
+ end
+ def dal_metadata
+ "#{@env.processing_path.dal}/#{@fns}.metadata.rbm"
+ end
+ def dal_map_nametags
+ "#{@env.processing_path.dal}/#{@fns}.map_name_tags.rbm"
+ end
+ def dal_map_ocn_htmlseg
+ "#{@env.processing_path.dal}/#{@fns}.map_ocn_htmlseg.rbm"
+ end
+ def html_tune
+ "#{@env.processing_path.tune}/#{@fns}.marshal_tune"
+ end
+ self
+ end
+ def write_file_processing
+ def html_tune
+ File.new("#{@env.processing_path.tune}/#{@fns}.tune",'w+')
+ end
+ self
+ end
+ def mkdir #check moved from FileOp, existing mkdir
+ def processing
+ def dal
+ FileUtils::mkdir_p(@env.processing_path.dal) unless FileTest.directory?(@env.processing_path.dal)
+ end
+ def tune
+ FileUtils::mkdir_p(@env.processing_path.tune) unless FileTest.directory?(@env.processing_path.tune)
+ end
+ self
+ end
+ end
+ end
+ class ProcessingSettings
+ def initialize(md)
+ @md=md
+ end
+ def cnf_rc #sisurc.yml
+ @rc=SiSU_Env::GetInit.new.sisu_yaml.rc
+ end
+ def env_rc #env rc (including sisurc.yml)
+ @env_rc ||=SiSU_Env::InfoEnv.new(@md.fns)
+ end
+ def doc_rc #document rc, make instructions
+ @md.make
+ end
+ def cmd_rc_act #command-line rc
+ @cmd_rc_act=@md.opt.opt_act
+ end
+ def build
+ def ocn?
+ if cmd_rc_act[:ocn][:set]==:on
+ true
+ elsif cmd_rc_act[:ocn][:set]==:off
+ false
+ elsif defined? @md.make.ocn? \
+ and @md.make.ocn? ==:off
+ false
+ elsif env_rc.build.ocn? ==:off
+ false
+ else
+ true
+ end
+ end
+ def toc?
+ if cmd_rc_act[:toc][:set]==:on
+ true
+ elsif cmd_rc_act[:toc][:set]==:off
+ false
+ elsif defined? @md.make.toc? \
+ and @md.make.toc? ==:off
+ false
+ elsif env_rc.build.toc? ==:off
+ false
+ else
+ true
+ end
+ end
+ def manifest?
+ if cmd_rc_act[:manifest][:set]==:on
+ true
+ elsif cmd_rc_act[:manifest][:set]==:off
+ false
+ elsif defined? @md.make.manifest? \
+ and @md.make.manifest? ==:off
+ false
+ elsif env_rc.build.manifest? ==:off
+ false
+ else
+ true
+ end
+ end
+ def links_to_manifest?
+ if cmd_rc_act[:links_to_manifest][:set]==:on
+ true
+ elsif cmd_rc_act[:links_to_manifest][:set]==:off
+ false
+ elsif defined? @md.make.links_to_manifest? \
+ and @md.make.links_to_manifest? ==:off
+ false
+ elsif env_rc.build.links_to_manifest? ==:off
+ false
+ else
+ true
+ end
+ end
+ def metadata?
+ if cmd_rc_act[:metadata][:set]==:on
+ true
+ elsif cmd_rc_act[:metadata][:set]==:off
+ false
+ elsif defined? @md.make.metadata? \
+ and @md.make.metadata? ==:off
+ false
+ elsif env_rc.build.metadata? ==:off
+ false
+ else
+ true
+ end
+ end
+ def minitoc?
+ if html_top_band? == false #one form of navigation necessary
+ true
+ elsif cmd_rc_act[:minitoc][:set]==:on
+ true
+ elsif cmd_rc_act[:minitoc][:set]==:off
+ false
+ elsif defined? @md.make.minitoc? \
+ and @md.make.minitoc? ==:off
+ false
+ elsif env_rc.build.minitoc? ==:off
+ false
+ else
+ true
+ end
+ end
+ def manifest_minitoc?
+ if html_top_band? == false #one form of navigation necessary
+ true
+ elsif cmd_rc_act[:manifest_minitoc][:set]==:on \
+ || cmd_rc_act[:minitoc][:set]==:on
+ true
+ elsif cmd_rc_act[:manifest_minitoc][:set]==:off \
+ || cmd_rc_act[:minitoc][:set]==:off
+ false
+ elsif defined? @md.make.manifest_minitoc? \
+ and (@md.make.manifest_minitoc? ==:off \
+ || @md.make.minitoc? ==:off)
+ false
+ elsif env_rc.build.manifest_minitoc? ==:off \
+ || env_rc.build.minitoc? ==:off
+ false
+ elsif minitoc? == false
+ false
+ else
+ true
+ end
+ end
+ def html_minitoc?
+ if html_top_band? == false #one form of navigation necessary
+ true
+ elsif cmd_rc_act[:html_minitoc][:set]==:on \
+ || cmd_rc_act[:minitoc][:set]==:on
+ true
+ elsif cmd_rc_act[:html_minitoc][:set]==:off \
+ || cmd_rc_act[:minitoc][:set]==:off
+ false
+ elsif defined? @md.make.html_minitoc? \
+ and (@md.make.html_minitoc? ==:off \
+ || @md.make.minitoc? ==:off)
+ false
+ elsif env_rc.build.html_minitoc? ==:off \
+ || env_rc.build.minitoc? ==:off
+ false
+ elsif minitoc? == false
+ false
+ else
+ true
+ end
+ end
+ def html_top_band?
+ if cmd_rc_act[:html_top_band][:set]==:on
+ true
+ elsif cmd_rc_act[:html_top_band][:set]==:off
+ false
+ elsif defined? @md.make.html_top_band? \
+ and @md.make.html_top_band? ==:off
+ false
+ elsif env_rc.build.html_top_band? ==:off
+ false
+ else
+ true
+ end
+ end
+ def html_navigation?
+ if cmd_rc_act[:html_navigation][:set]==:on
+ true
+ elsif cmd_rc_act[:html_navigation][:set]==:off
+ false
+ elsif defined? @md.make.html_navigation? \
+ and @md.make.html_navigation? ==:off
+ false
+ elsif env_rc.build.html_navigation? ==:off
+ false
+ else
+ true
+ end
+ end
+ def html_navigation_bar?
+ if cmd_rc_act[:html_navigation_bar][:set]==:on
+ true
+ elsif cmd_rc_act[:html_navigation_bar][:set]==:off
+ false
+ elsif defined? @md.make.html_navigation_bar? \
+ and @md.make.html_navigation_bar? ==:off
+ false
+ elsif env_rc.build.html_navigation_bar? ==:off
+ false
+ else
+ true
+ end
+ end
+ def search_form?
+ if cmd_rc_act[:search_form][:set]==:on
+ true
+ elsif cmd_rc_act[:search_form][:set]==:off
+ false
+ elsif defined? @md.make.html_search_form? \
+ and @md.make.search_form? ==:off
+ false
+ elsif env_rc.build.search_form? ==:off
+ false
+ else
+ true
+ end
+ end
+ def html_search_form?
+ if cmd_rc_act[:html_search_form][:set]==:on \
+ || cmd_rc_act[:search_form][:set]==:on
+ true
+ elsif cmd_rc_act[:html_search_form][:set]==:off \
+ || cmd_rc_act[:search_form][:set]==:off
+ false
+ elsif defined? @md.make.html_search_form? \
+ and (@md.make.html_search_form? ==:off \
+ || @md.make.search_form? ==:off)
+ false
+ elsif env_rc.build.html_search_form? ==:off \
+ || env_rc.build.search_form? ==:off
+ false
+ elsif search_form? == false
+ false
+ else
+ true
+ end
+ end
+ def html_right_pane?
+ if cmd_rc_act[:html_right_pane][:set]==:on
+ true
+ elsif cmd_rc_act[:html_right_pane][:set]==:off
+ false
+ elsif defined? @md.make.html_right_pane? \
+ and @md.make.html_right_pane? ==:off
+ false
+ elsif env_rc.build.html_right_pane? ==:off
+ false
+ else
+ true
+ end
+ end
+ def segsubtoc?
+ if cmd_rc_act[:segsubtoc][:set]==:on
+ true
+ elsif cmd_rc_act[:segsubtoc][:set]==:off
+ false
+ elsif defined? @md.make.segsubtoc? \
+ and @md.make.segsubtoc? ==:off
+ false
+ elsif env_rc.build.segsubtoc? ==:off
+ false
+ else
+ true
+ end
+ end
+ self
+ end
+ def output_dir_structure
+ def by_language_code?
+ if cmd_rc_act[:output_by][:set] == :language
+ true
+ elsif cmd_rc_act[:output_by][:set] == :filetype \
+ or cmd_rc_act[:output_by][:set] == :filename
+ false
+ elsif cmd_rc_act[:output_by][:set] == :language
+ true
+ else
+ env_rc.output_dir_structure.by_language_code?
+ end
+ end
+ def by_filetype?
+ if cmd_rc_act[:output_by][:set] == :filetype
+ true
+ elsif cmd_rc_act[:output_by][:set] == :language \
+ or cmd_rc_act[:output_by][:set] == :filename
+ false
+ elsif cmd_rc_act[:output_by][:set] == :filetype
+ true
+ else
+ env_rc.output_dir_structure.by_filetype?
+ end
+ end
+ def by_filename?
+ if cmd_rc_act[:output_by][:set] == :filename
+ true
+ elsif cmd_rc_act[:output_by][:set] == :language \
+ or cmd_rc_act[:output_by][:set] == :filetype
+ false
+ elsif cmd_rc_act[:output_by][:set] == :filename
+ true
+ else
+ env_rc.output_dir_structure.by_filename?
+ end
+ end
+ def multilingual?
+ by_language_code?
+ end
+ def dump?
+ ((cmd_rc_act[:dump][:bool] \
+ && cmd_rc_act[:dump][:inst]) \
+ || (env_rc.output_dir_structure.dump?)) \
+ ? true
+ : false
+ end
+ def redirect?
+ ((cmd_rc_act[:redirect][:bool] \
+ && cmd_rc_act[:redirect][:inst]) \
+ || (env_rc.output_dir_structure.redirect?)) \
+ ? true
+ : false
+ end
+ def dump_or_redirect?
+ ((dump?) || (redirect?)) \
+ ? true
+ : false
+ end
+ def by?
+ if dump?
+ :dump
+ elsif redirect?
+ :redirect
+ elsif by_language_code?
+ :language
+ elsif by_filetype?
+ :filetype
+ elsif by_filename?
+ :filename
+ else #recheck current default
+ :language
+ end
+ end
+ self
+ end
+ end
+ class InfoDb < InfoEnv
+ @@rc=nil
+ def initialize
+ @@pwd=@pwd=(/(\S+?)(?:\/(?:#{Px[:lng_lst_rgx]}))?$/).match(Dir.pwd)[1]
+ @env=SiSU_Env::InfoEnv.new
+ pt=Pathname.new(@pwd)
+ r=Px[:lng_lst_rgx]
+ u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/
+ @pwd_stub=pt.realpath.to_s[u,1]
+ @rc=@@rc ||=GetInit.new.sisu_yaml.rc
+ @defaults=SiSU_Env::InfoEnv.new.defaults
+ end
+ def share_source?
+ ((defined? @rc['db']['share_source']) \
+ && @rc['db']['share_source']==true) \
+ ? @rc['db']['share_source']
+ : false
+ end
+ def engine
+ def default
+ ((defined? @rc['db']['engine']['default']) \
+ && @rc['db']['engine']['default']=~/postgresql|sqlite/) \
+ ? @rc['db']['engine']['default']
+ : 'sqlite'
+ end
+ self
+ end
+ def psql
+ def user
+ ((defined? @rc['db']['postgresql']['user']) \
+ && @rc['db']['postgresql']['user']=~/\S+/) \
+ ? @rc['db']['postgresql']['user']
+ : @env.user
+ end
+ def db #db_name
+ "#{Db[:name_prefix]}#{@pwd_stub}"
+ end
+ def port #PGPORT
+ ((defined? @rc['db']['postgresql']['port']) \
+ && ( @rc['db']['postgresql']['port'] =~/\d+/ \
+ || @rc['db']['postgresql']['port'].is_a?(Fixnum))) \
+ ? @rc['db']['postgresql']['port']
+ : (@defaults[:postgresql_port])
+ end
+ def password
+ ((defined? @rc['db']['postgresql']['password']) \
+ && @rc['db']['postgresql']['password']=~/\S+/) \
+ ? @rc['db']['postgresql']['password']
+ : ''
+ end
+ def host
+ ((defined? @rc['db']['postgresql']['host']) \
+ && @rc['db']['postgresql']['host']=~/(?:\S{1,3}\.){3}\S{1,3}|\S+?\.\S+/) \
+ ? @rc['db']['postgresql']['host']
+ : ''
+ end
+ def dbi
+ (psql.host =~/(?:\S{1,3}\.){3}\S{1,3}|\S+?\.\S+/) \
+ ? "DBI:Pg:database=#{psql.db};host=#{psql.host};port=#{psql.port}"
+ : "DBI:Pg:database=#{psql.db};port=#{psql.port}"
+ end
+ def conn_dbi
+ DBI.connect(psql.dbi,psql.user,psql.db)
+ end
+ self
+ end
+ def mysql
+ def db
+ #"#{Db[:name_prefix]}#{@pwd_stub}"
+ end
+ def port
+ '**'
+ end
+ def dbi
+ "dbi:Mysql:database=#{mysql.db};port=#{mysql.port}"
+ end
+ self
+ end
+ def sqlite
+ def db
+ "#{@env.path.webserv}/#{@pwd_stub}/sisu_sqlite.db"
+ end
+ def db_discreet(md)
+ # "#{@env.path.webserv}/#{@pwd_stub}/sisu_sqlite.db"
+ end
+ def dbi
+ "DBI:SQLite3:#{sqlite.db}" #sqlite3 ?
+ end
+ def sqlite3
+ sqlite.db #sqlite3 ?
+ end
+ def conn_dbi
+ DBI.connect(sqlite.dbi)
+ end
+ def conn_sqlite3
+ SQLite3::Database.new(sqlite.sqlite3)
+ end
+ self
+ end
+ end
+ class DbOp <InfoDb
+ def initialize(md)
+ begin
+ @md=md
+ rescue
+ SiSU_Screen::Ansi.new(md.opt.cmd,$!,$@).rescue do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ end
+ end
+ def sqlite_discreet
+ def db
+ "#{@md.file.output_path.sqlite_discreet.dir}/#{@md.file.base_filename.sqlite_discreet}"
+ end
+ def dbi
+ "DBI:SQLite3:#{sqlite_discreet.db}"
+ end
+ def sqlite3
+ sqlite_discreet.db
+ end
+ def conn_dbi
+ DBI.connect(sqlite_discreet.dbi)
+ end
+ def conn_sqlite3
+ SQLite3::Database.new(sqlite_discreet.sqlite3)
+ end
+ self
+ end
+ end
+ class FileOp <InfoFile #todo unify with CreateFile
+ def initialize(md,fno='')
+ begin
+ @md,@fno=md,fno
+ @env=SiSU_Env::InfoEnv.new(@md.fns)
+ rescue
+ SiSU_Screen::Ansi.new(md.opt.cmd,$!,$@).rescue do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ end
+ end
+ def output_dir_structure
+ ProcessingSettings.new(@md).output_dir_structure
+ end
+ def mkdir_initialize # not used but consider using
+ FileUtils::mkdir_p(output_path.base.dir) unless FileTest.directory?(output_path.base.dir)
+ FileUtils::mkdir_p("#{output_path.base.dir}/#{@md.fnb}") unless FileTest.directory?("#{output_path.base.dir}/#{@md.fnb}")
+ FileUtils::mkdir_p("#{output_path.base.dir}/#{@env.path.style}") unless FileTest.directory?("#{output_path.base.dir}/#{@env.path.style}")
+ FileUtils::mkdir_p(@env.processing_path.dal) unless FileTest.directory?(@env.processing_path.dal)
+ FileUtils::mkdir_p(@env.processing_path.tune) unless FileTest.directory?(@env.processing_path.tune)
+ end
+ def path_rel_links
+ def html_scroll_2
+ if output_dir_structure.by_language_code?
+ '../../'
+ elsif output_dir_structure.by_filetype?
+ '../'
+ else
+ '../'
+ end
+ end
+ def html_seg_2
+ if output_dir_structure.by_language_code?
+ '../../../'
+ elsif output_dir_structure.by_filetype?
+ '../../'
+ else
+ '../'
+ end
+ end
+ def html_scroll_1
+ if output_dir_structure.by_language_code?
+ '../'
+ elsif output_dir_structure.by_filetype?
+ '../'
+ else
+ './'
+ end
+ end
+ def html_seg_1
+ if output_dir_structure.by_language_code?
+ '../../'
+ elsif output_dir_structure.by_filetype?
+ '../../'
+ else
+ './'
+ end
+ end
+ def default_output_css
+ if (@md.opt.opt_act[:dump][:bool] \
+ && @md.opt.opt_act[:dump][:inst]) \
+ || (@md.opt.opt_act[:redirect][:bool] \
+ && @md.opt.opt_act[:redirect][:inst])
+ './'
+ elsif output_dir_structure.by_language_code?
+ '../../'
+ elsif output_dir_structure.by_filetype?
+ '../'
+ else
+ '../'
+ end
+ end
+ def html_scroll_css
+ default_output_css
+ end
+ def xhtml_css
+ default_output_css
+ end
+ def xml_css
+ default_output_css
+ end
+ def html_seg_css
+ if output_dir_structure.by_language_code?
+ '../../../'
+ elsif output_dir_structure.by_filetype?
+ '../../'
+ else
+ '../'
+ end
+ end
+ def manifest_css
+ if output_dir_structure.by_language_code?
+ '../../_sisu/css'
+ elsif output_dir_structure.by_filetype?
+ ''
+ else
+ '../'
+ end
+ end
+ self
+ end
+ def mkdir
+ txt_path="#{output_path.base.dir}/#{@md.fnb}"
+ def output
+ def base
+ FileUtils::mkdir_p(output_path.base.dir) unless FileTest.directory?(output_path.base.dir)
+ end
+ def css
+ FileUtils::mkdir_p("#{output_path.base.dir}/#{@env.path.style}") unless FileTest.directory?("#{output_path.base.dir}/#{@env.path.style}")
+ end
+ def epub
+ path=output_path.epub.dir
+ make_path(path)
+ end
+ self
+ end
+ self
+ end
+ def mkfile #consider using more
+ path="#{output_path.base.dir}/#{@md.fnb}"
+ make_path(path)
+ filename=@fno
+ file=make_file(path,filename)
+ end
+ def mkfile_pwd
+ path=Dir.pwd
+ filename=@fno
+ file=make_file(path,filename)
+ end
+ def write_file
+ def txt
+ path=output_path.txt.dir
+ make_path(path)
+ fn=base_filename.txt
+ make_file(path,fn)
+ end
+ def html_scroll
+ pth=output_path.html.dir
+ make_path(pth)
+ p_fn=place_file.html_scroll.dir
+ @@filename_html_scroll=File.new(p_fn,'w+')
+ end
+ def html_seg_index
+ pth=((by_filename?) \
+ || (output_dir_structure.dump?)) \
+ ? "#{output_path.html.dir}"
+ : "#{output_path.html.dir}/#{@md.fnb}"
+ fn=base_filename.html_seg_index
+ make_path(pth)
+ p_fn=place_file.html_seg_index.dir
+ @@filename_html_index=File.new(p_fn,'w+')
+ end
+ def html_segtoc
+ pth=((by_filename?) \
+ || (output_dir_structure.dump?)) \
+ ? "#{output_path.html.dir}"
+ : "#{output_path.html.dir}/#{@md.fnb}"
+ fn=base_filename.html_segtoc
+ make_path(pth)
+ p_fn=place_file.html_segtoc.dir
+ @@filename_html_index=File.new(p_fn,'w+')
+ end
+ def xhtml
+ path=output_path.xhtml.dir
+ make_path(path)
+ fn=base_filename.xhtml
+ file=make_file(path,fn)
+ end
+ def xml_sax
+ path=output_path.xml.dir
+ make_path(path)
+ fn=base_filename.xml_sax
+ file=make_file(path,fn)
+ end
+ def xml_dom
+ path=output_path.xml.dir
+ make_path(path)
+ fn=base_filename.xml_dom
+ file=make_file(path,fn)
+ end
+ def manpage
+ path=output_path.manpage.dir
+ make_path(path)
+ fn=base_filename.manpage
+ file=make_file(path,fn)
+ end
+ def texinfo
+ path=output_path.texinfo.dir
+ make_path(path)
+ fn=base_filename.texinfo
+ file=make_file(path,fn)
+ end
+ def info
+ path=output_path.texinfo.dir
+ make_path(path)
+ fn=base_filename.info
+ file=make_file(path,fn)
+ end
+ def hash_digest
+ path=output_path.hash_digest.dir
+ make_path(path)
+ fn=base_filename.hash_digest
+ file=make_file(path,fn)
+ end
+ def qrcode
+ path=output_path.qrcode.dir
+ make_path(path)
+ fn=base_filename.qrcode
+ make_file(path,fn)
+ end
+ def manifest
+ path=output_path.manifest.dir
+ make_path(path)
+ fn=base_filename.manifest
+ make_file(path,fn)
+ end
+ def manifest_txt
+ path=output_path.manifest.dir
+ make_path(path)
+ fn=base_filename.manifest_txt
+ make_file(path,fn)
+ end
+ def pot
+ path=output_path.pot.dir
+ make_path(path)
+ fn=base_filename.pot
+ make_file(path,fn)
+ end
+ def po
+ path=output_path.po.dir
+ make_path(path)
+ fn=base_filename.po
+ make_file(path,fn)
+ end
+ self
+ end
+ def place_file
+ def txt
+ def dir
+ output_path.txt.dir + '/' + base_filename.txt
+ end
+ def rel
+ output_path.txt.rel + '/' + base_filename.txt
+ end
+ self
+ end
+ def html_scroll
+ def dir
+ output_path.html_scroll.dir + '/' + base_filename.html_scroll
+ end
+ def rel
+ output_path.html_scroll.rel + '/' + base_filename.html_scroll
+ end
+ self
+ end
+ def html_seg_index
+ def dir
+ output_path.html_seg.dir + '/' + base_filename.html_seg_index
+ end
+ def rel
+ output_path.html_seg.rel + '/' + base_filename.html_seg_index
+ end
+ self
+ end
+ def html_segtoc
+ def dir
+ output_path.html_seg.dir + '/' + base_filename.html_segtoc
+ end
+ def rel
+ output_path.html_seg.rel + '/' + base_filename.html_segtoc
+ end
+ self
+ end
+ def html_book_index
+ def dir
+ output_path.html_seg.dir + '/' + base_filename.html_book_index
+ end
+ def rel
+ output_path.html_seg.rel + '/' + base_filename.html_book_index
+ end
+ self
+ end
+ def html_concordance
+ def dir
+ output_path.html_seg.dir + '/' + base_filename.html_concordance
+ end
+ def rel
+ output_path.html_seg.rel + '/' + base_filename.html_concordance
+ end
+ self
+ end
+ def odt
+ def dir
+ output_path.odt.dir + '/' + base_filename.odt
+ end
+ def rel
+ output_path.odt.rel + '/' + base_filename.odt
+ end
+ self
+ end
+ def epub
+ def dir
+ output_path.epub.dir + '/' + base_filename.epub
+ end
+ def rel
+ output_path.epub.rel + '/' + base_filename.epub
+ end
+ self
+ end
+ def pdf_p
+ STDERR.puts 'ERROR not available due to multiple page format sizes'
+ end
+ def pdf_l
+ STDERR.puts 'ERROR not available due to multiple page format sizes'
+ end
+ def xhtml
+ def dir
+ output_path.xhtml.dir + '/' + base_filename.xhtml
+ end
+ def rel
+ output_path.xhtml.rel + '/' + base_filename.xhtml
+ end
+ self
+ end
+ def xml_sax
+ def dir
+ output_path.xml.dir + '/' + base_filename.xml_sax
+ end
+ def rel
+ output_path.xml.rel + '/' + base_filename.xml_sax
+ end
+ self
+ end
+ def xml_dom
+ def dir
+ output_path.xml.dir + '/' + base_filename.xml_dom
+ end
+ def rel
+ output_path.xml.rel + '/' + base_filename.xml_dom
+ end
+ self
+ end
+ def sqlite_discreet
+ def dir
+ output_path.sqlite_discreet.dir + '/' + base_filename.sqlite_discreet
+ end
+ def rel
+ output_path.sqlite_discreet.rel + '/' + base_filename.sqlite_discreet
+ end
+ self
+ end
+ def hash_digest
+ def dir
+ output_path.hash_digest.dir + '/' + base_filename.hash_digest
+ end
+ def rel
+ output_path.hash_digest.rel + '/' + base_filename.hash_digest
+ end
+ self
+ end
+ def src
+ def dir
+ output_path.src.dir + '/' + base_filename.src
+ end
+ def rel
+ output_path.src.rel + '/' + base_filename.src
+ end
+ self
+ end
+ def sisupod
+ def dir
+ output_path.sisupod.dir + '/' + base_filename.sisupod
+ end
+ def rel
+ output_path.sisupod.rel + '/' + base_filename.sisupod
+ end
+ self
+ end
+ def po
+ def dir
+ output_path.po.dir + '/' + base_filename.po
+ end
+ def rel
+ output_path.po.rel + '/' + base_filename.po
+ end
+ self
+ end
+ def pot
+ def dir
+ output_path.pot.dir + '/' + base_filename.pot
+ end
+ def rel
+ output_path.pot.rel + '/' + base_filename.pot
+ end
+ self
+ end
+ def po_git
+ def dir
+ output_path.po_git + '/' + base_filename.po
+ end
+ def rel
+ #output_path.po_git + '/' + base_filename.po
+ end
+ self
+ end
+ def pot_git
+ def dir
+ output_path.pot_git + '/' + base_filename.pot
+ end
+ def rel
+ #output_path.pot_git + '/' + base_filename.pot
+ end
+ self
+ end
+ def manpage
+ def dir
+ output_path.manpage.dir + '/' + base_filename.manpage
+ end
+ def rel
+ output_path.manpage.rel + '/' + base_filename.manpage
+ end
+ self
+ end
+ def texinfo
+ def dir
+ output_path.texinfo.dir + '/' + base_filename.texinfo
+ end
+ def rel
+ output_path.texinfo.rel + '/' + base_filename.texinfo
+ end
+ self
+ end
+ def info
+ def dir
+ output_path.texinfo.dir + '/' + base_filename.info
+ end
+ def rel
+ output_path.texinfo.rel + '/' + base_filename.info
+ end
+ self
+ end
+ def qrcode_title
+ def dir
+ output_path.qrcode.dir + '/' + base_filename.qrcode_title
+ end
+ def rel
+ output_path.qrcode.rel + '/' + base_filename.qrcode_title
+ end
+ self
+ end
+ def qrcode_md
+ def dir
+ output_path.qrcode.dir + '/' + base_filename.qrcode_md
+ end
+ def rel
+ output_path.qrcode.rel + '/' + base_filename.qrcode_md
+ end
+ self
+ end
+ def manifest
+ def dir
+ output_path.manifest.dir + '/' + base_filename.manifest
+ end
+ def rel
+ output_path.manifest.rel + '/' + base_filename.manifest
+ end
+ self
+ end
+ self
+ end
+ def base_filename
+ def txt
+ ft='.txt'
+ if output_dir_structure.by_language_code?
+ @md.fnb + ft
+ elsif output_dir_structure.by_filetype?
+ @md.fnb + @md.lang_code_insert + ft
+ else
+ 'plain' + @md.lang_code_insert + ft
+ end
+ end
+ def html_scroll
+ ft='.html'
+ if output_dir_structure.by_language_code?
+ @md.fnb + ft
+ elsif output_dir_structure.by_filetype?
+ @md.fnb + @md.lang_code_insert + ft
+ else
+ 'scroll' + @md.lang_code_insert + ft
+ end
+ end
+ def html_seg_index
+ ft='.html'
+ if output_dir_structure.by_language_code?
+ 'index' + ft
+ else
+ 'index' + @md.lang_code_insert + ft
+ end
+ end
+ def html_segtoc
+ ft='.html'
+ if output_dir_structure.dump_or_redirect?
+ @md.fnb + '.toc' + ft
+ elsif output_dir_structure.by_language_code?
+ 'toc' + ft
+ else
+ 'toc' + @md.lang_code_insert + ft
+ end
+ end
+ def html_book_index
+ ft='.html'
+ if output_dir_structure.by_language_code?
+ 'book_index' + ft
+ else
+ 'book_index' + @md.lang_code_insert + ft
+ end
+ end
+ def html_concordance
+ ft='.html'
+ if output_dir_structure.dump_or_redirect?
+ @md.fnb + '.concordance' + ft
+ elsif output_dir_structure.by_language_code?
+ 'concordance' + ft
+ else
+ 'concordance' + @md.lang_code_insert + ft
+ end
+ end
+ def xhtml
+ ft= '.xhtml'
+ if output_dir_structure.by_language_code?
+ @md.fnb + ft
+ elsif output_dir_structure.by_filetype?
+ @md.fnb + @md.lang_code_insert + ft
+ else
+ 'scroll' + @md.lang_code_insert + ft
+ end
+ end
+ def epub
+ ft='.epub'
+ if output_dir_structure.by_language_code?
+ @md.fnb + ft
+ else
+ @md.fnb + @md.lang_code_insert + ft
+ end
+ end
+ def odt
+ ft='.odt'
+ if output_dir_structure.by_language_code?
+ @md.fnb + ft
+ elsif output_dir_structure.by_filetype?
+ @md.fnb + @md.lang_code_insert + ft
+ else
+ 'opendocument' + @md.lang_code_insert + ft
+ end
+ end
+ def xml_sax
+ ft='.sax.xml'
+ if output_dir_structure.by_language_code?
+ @md.fnb + ft
+ elsif output_dir_structure.by_filetype?
+ @md.fnb + @md.lang_code_insert + ft
+ else
+ 'scroll' + @md.lang_code_insert + ft
+ end
+ end
+ def xml_dom
+ ft='.dom.xml'
+ if output_dir_structure.by_language_code?
+ @md.fnb + ft
+ elsif output_dir_structure.by_filetype?
+ @md.fnb + @md.lang_code_insert + ft
+ else
+ 'scroll' + @md.lang_code_insert + ft
+ end
+ end
+ def pdf_p
+ if output_dir_structure.by_language_code?
+ @md.fnb + '.portrait.'
+ else 'portrait' + @md.lang_code_insert + '.'
+ end
+ end
+ def pdf_l
+ if output_dir_structure.by_language_code?
+ @md.fnb + '.landscape.'
+ else 'landscape' + @md.lang_code_insert + '.'
+ end
+ end
+ def pdf_p_a4
+ pdf_p + @md.fn[:pdf_p_a4]
+ end
+ def pdf_p_a5
+ pdf_p + @md.fn[:pdf_p_a5]
+ end
+ def pdf_p_b5
+ pdf_p + @md.fn[:pdf_p_b5]
+ end
+ def pdf_p_letter
+ pdf_p + @md.fn[:pdf_p_letter]
+ end
+ def pdf_p_legal
+ pdf_p + @md.fn[:pdf_p_legal]
+ end
+ def pdf_l_a4
+ pdf_l + @md.fn[:pdf_l_a4]
+ end
+ def pdf_l_a5
+ pdf_l + @md.fn[:pdf_l_a5]
+ end
+ def pdf_l_b5
+ pdf_l + @md.fn[:pdf_l_b5]
+ end
+ def pdf_l_letter
+ pdf_l + @md.fn[:pdf_l_letter]
+ end
+ def pdf_l_legal
+ pdf_l + @md.fn[:pdf_l_legal]
+ end
+ def manpage
+ ft='1'
+ if output_dir_structure.by_language_code?
+ @md.fnb + '.' + ft
+ else
+ @md.fnb + '.' + @md.opt.f_pth[:lng_is] + '.' + ft
+ end
+ end
+ def info
+ ft='info'
+ if output_dir_structure.by_language_code?
+ @md.fnb + '.' + ft
+ else
+ @md.fnb + '.' + @md.opt.f_pth[:lng_is] + '.' + ft
+ end
+ end
+ def texinfo
+ ft='texinfo'
+ if output_dir_structure.by_language_code?
+ @md.fnb + '.' + ft
+ else
+ @md.fnb + '.' + @md.opt.f_pth[:lng_is] + '.' + ft
+ end
+ end
+ def sqlite_discreet
+ ft='.sql.db'
+ if output_dir_structure.by_language_code?
+ @md.fnb + ft
+ else
+ @md.fnb + @md.lang_code_insert + ft
+ end
+ end
+ def hash_digest
+ ft='.txt'
+ if output_dir_structure.by_language_code?
+ @md.fnb + '.hash_digest' + ft
+ elsif output_dir_structure.by_filetype?
+ @md.fnb + @md.lang_code_insert + ft
+ else
+ 'digest' + @md.lang_code_insert + ft
+ end
+ end
+ def sitemap
+ ft='.xml'
+ if output_dir_structure.by_language_code?
+ @md.fnb + '.sitemap' + ft
+ elsif output_dir_structure.by_filetype?
+ @md.fnb + @md.lang_code_insert + ft
+ else
+ 'sitemap' + @md.lang_code_insert + ft
+ end
+ end
+ def qrcode_title
+ ft='.title.png'
+ if output_dir_structure.by_language_code?
+ @md.fnb + ft
+ elsif output_dir_structure.by_filetype?
+ @md.fnb + @md.lang_code_insert + ft
+ else #fix
+ 'sisu_manifest' + @md.lang_code_insert + ft
+ end
+ end
+ def qrcode_md
+ ft='.md.png'
+ if output_dir_structure.by_language_code?
+ @md.fnb + ft
+ elsif output_dir_structure.by_filetype?
+ @md.fnb + @md.lang_code_insert + ft
+ else #fix
+ 'sisu_manifest' + @md.lang_code_insert + ft
+ end
+ end
+ def manifest_txt
+ ft='.txt'
+ if output_dir_structure.by_language_code?
+ @md.fnb + ft
+ elsif output_dir_structure.by_filetype?
+ @md.fnb + @md.lang_code_insert + ft
+ else #fix
+ 'sisu_manifest' + @md.lang_code_insert + ft
+ end
+ end
+ def manifest
+ ft='.html'
+ if output_dir_structure.dump_or_redirect?
+ @md.fnb + '.manifest' + ft
+ elsif output_dir_structure.by_language_code?
+ @md.fnb + ft
+ elsif output_dir_structure.by_filetype?
+ @md.fnb + @md.lang_code_insert + ft
+ else #fix
+ 'sisu_manifest' + @md.lang_code_insert + ft
+ end
+ end
+ def src
+ @md.fno
+ end
+ def po #check
+ (@fno.empty?) \
+ ? (@md.fn[:po])
+ : (@fno + '.po')
+ end
+ def pot
+ (@fno.empty?) \
+ ? (@md.fn[:pot])
+ : (@fno + '.pot')
+ end
+ def sisupod
+ (@md.fns =~/\.ssm\.sst$/) \
+ ? @md.fns.gsub(/(?:\~\S{2,3})?\.ssm\.sst$/,'.ssm.txz')
+ : @md.fns.gsub(/(?:\~\S{2,3})?(\.sst)$/,'\1.txz')
+ end
+ self
+ end
+ def set_path(ft)
+ @ft=ft
+ def dir
+ def abc
+ if output_dir_structure.redirect?
+ "#{@md.opt.opt_act[:redirect][:inst]}/#{@md.fnb}"
+ elsif output_dir_structure.dump?
+ @md.opt.opt_act[:dump][:inst]
+ elsif output_dir_structure.by_language_code?
+ "#{output_path.base.dir}/#{@md.opt.lng}/#{@ft}"
+ elsif output_dir_structure.by_filetype?
+ "#{output_path.base.dir}/#{@ft}"
+ else
+ "#{output_path.base.dir}/#{@md.fnb}"
+ end
+ end
+ def ab
+ if output_dir_structure.redirect?
+ "#{@md.opt.opt_act[:redirect][:inst]}/#{@md.fnb}"
+ elsif output_dir_structure.dump?
+ @md.opt.opt_act[:dump][:inst]
+ elsif output_dir_structure.by_language_code?
+ "#{output_path.base.dir}/#{@md.opt.lng}/#{@ft}"
+ else
+ "#{output_path.base.dir}/#{@ft}"
+ end
+ end
+ def ab_src
+ if output_dir_structure.redirect?
+ "#{@md.opt.opt_act[:redirect][:inst]}/#{@md.fnb}"
+ elsif output_dir_structure.dump?
+ @md.opt.opt_act[:dump][:inst]
+ else
+ "#{output_path.base.dir}/#{@ft}/#{@md.opt.fng}/#{Gt[:sisupod]}/#{Gt[:doc]}/#{@md.opt.lng}"
+ end
+ end
+ def ab_pod
+ if output_dir_structure.redirect?
+ "#{@md.opt.opt_act[:redirect][:inst]}/#{@md.fnb}"
+ elsif output_dir_structure.dump?
+ @md.opt.opt_act[:dump][:inst]
+ else
+ "#{output_path.base.dir}/#{@ft}"
+ end
+ end
+ self
+ end
+ def url
+ def abc
+ if output_dir_structure.by_language_code?
+ "#{output_path.base.url}/#{@md.opt.lng}/#{@ft}"
+ elsif output_dir_structure.by_filetype?
+ "#{output_path.base.url}/#{@ft}"
+ else
+ "#{output_path.base.url}/#{@md.fnb}"
+ end
+ end
+ def ab
+ if output_dir_structure.by_language_code?
+ "#{output_path.base.url}/#{@md.opt.lng}/#{@ft}"
+ else
+ "#{output_path.base.url}/#{@ft}"
+ end
+ end
+ def ab_src
+ "#{output_path.base.url}/#{@ft}/#{@md.opt.fng}/#{Gt[:sisupod]}/#{Gt[:doc]}/#{@md.opt.lng}"
+ end
+ def ab_pod
+ "#{output_path.base.url}/#{@ft}"
+ end
+ self
+ end
+ def rel
+ def abc
+ if output_dir_structure.by_language_code?
+ "#{@md.opt.lng}/#{@ft}"
+ elsif output_dir_structure.by_filetype?
+ "#{@ft}"
+ else
+ "#{@md.fnb}"
+ end
+ end
+ def ab
+ if output_dir_structure.by_language_code?
+ "#{@md.opt.lng}/#{@ft}"
+ else
+ "#{@ft}"
+ end
+ end
+ def ab_src
+ @ft
+ end
+ def ab_pod
+ @ft
+ end
+ self
+ end
+ def rel_sm
+ def abc
+ if output_dir_structure.by_language_code?
+ "#{@md.opt.lng}/#{@ft}"
+ elsif output_dir_structure.by_filetype?
+ "#{@ft}"
+ else
+ "#{@md.fnb}"
+ end
+ end
+ def ab
+ if output_dir_structure.dump_or_redirect?
+ '.'
+ elsif output_dir_structure.by_language_code? \
+ or output_dir_structure.by_filetype?
+ '../' + @ft
+ else '.'
+ end
+ end
+ def ab_src
+ locate="#{@ft}/#{@md.opt.fng}/#{Gt[:sisupod]}/#{Gt[:doc]}/#{@md.opt.lng}"
+ if output_dir_structure.dump_or_redirect?
+ '.'
+ elsif output_dir_structure.by_language_code?
+ "../../#{locate}"
+ else
+ "../#{locate}"
+ end
+ end
+ def ab_pod
+ if output_dir_structure.dump_or_redirect?
+ '.'
+ elsif output_dir_structure.by_language_code?
+ "../../#{@ft}/#{@md.opt.lng}"
+ else
+ "../#{@ft}"
+ end
+ end
+ self
+ end
+ def rcp
+ def abc
+ if output_dir_structure.by_language_code?
+ "#{output_path.stub.rcp}/#{@md.opt.lng}/#{@ft}"
+ elsif output_dir_structure.by_filetype?
+ "#{output_path.stub.rcp}/#{@ft}"
+ else
+ "#{output_path.stub.rcp}/#{@md.fnb}"
+ end
+ end
+ def ab
+ if output_dir_structure.by_language_code?
+ "#{output_path.stub.rcp}/#{@md.opt.lng}/#{@ft}"
+ else
+ "#{output_path.stub.rcp}/#{@ft}"
+ end
+ end
+ self
+ end
+ self
+ end
+ def output_path
+ def web_base
+ def dir
+ @env.path.webserv
+ end
+ def url
+ #"#{@env.url.root}"
+ end
+ def rel
+ '.'
+ end
+ def rcp
+ '.'
+ end
+ self
+ end
+ def stub
+ def dir
+ "#{@md.opt.f_pth[:pth_stub]}"
+ end
+ #def url
+ # "#{@env.url.root}"
+ #end
+ def rel
+ "./#{@md.opt.f_pth[:pth_stub]}"
+ end
+ def rcp
+ "#{@md.opt.f_pth[:pth_stub]}"
+ end
+ self
+ end
+ def webserver_path
+ if output_dir_structure.dump?
+ @md.opt.opt_act[:dump][:inst]
+ elsif output_dir_structure.redirect?
+ @md.opt.opt_act[:redirect][:inst]
+ else
+ @env.path.webserv
+ end
+ end
+ def base
+ def dir
+ "#{webserver_path}/#{@md.opt.f_pth[:pth_stub]}"
+ end
+ def url
+ "#{@env.url.webserv}/#{@md.opt.f_pth[:pth_stub]}"
+ end
+ def rel
+ "./#{@md.opt.f_pth[:pth_stub]}"
+ end
+ def rcp
+ "./#{@md.opt.f_pth[:pth_stub]}"
+ end
+ self
+ end
+ def sisugit
+ def dir
+ "#{output_path.base.dir}/git"
+ end
+ def url
+ "#{output_path.base.url}/git"
+ end
+ def rel
+ "#{output_path.base.rel}/git"
+ end
+ def rcp
+ "#{output_path.base.rcp}/git"
+ end
+ self
+ end
+ #def pod
+ # ft='pod'
+ # path=set_path(ft).dir.ab
+ #end
+ def src
+ def ft
+ Gt[:src]
+ end
+ def dir
+ set_path(ft).dir.ab_src
+ end
+ def url
+ set_path(ft).url.ab_src
+ end
+ def rel
+ set_path(ft).rel.ab_src
+ end
+ def rcp
+ set_path(ft).rcp.ab_src
+ end
+ def rel_sm
+ set_path(ft).rel_sm.ab_src
+ end
+ self
+ end
+ def sisupod
+ def ft
+ Gt[:src]
+ end
+ def dir
+ set_path(ft).dir.ab_pod
+ end
+ def url
+ set_path(ft).url.ab_pod
+ end
+ def rel
+ set_path(ft).rel.ab_pod
+ end
+ def rcp
+ set_path(ft).rcp.ab_pod
+ end
+ def rel_sm
+ set_path(ft).rel_sm.ab_pod
+ end
+ self
+ end
+ def po
+ def dir
+ "#{output_path.base.dir}/#{Gt[:src]}/#{@md.opt.fng}/po4a/po/#{@md.opt.lng}"
+ end
+ def url
+ "#{output_path.base.url}/po4a/#{@md.fnb}/po/#{@md.opt.lng}"
+ end
+ self
+ end
+ def pot
+ def dir
+ "#{output_path.base.dir}/#{Gt[:src]}/#{@md.opt.fng}/po4a/pot"
+ end
+ def url
+ "#{output_path.base.url}/po4a/#{@md.fnb}/pot"
+ end
+ def rcp
+ #p "#{output_path.base.dir}/po4a/#{@md.fnb}/pot"
+ end
+ self
+ end
+ def po_git # consider !!!
+ def ft
+ Gt[:po]
+ end
+ def dir
+ pth=@env.processing_path.git + '/' + @md.fnb + '/' + ft + '/' + @md.opt.lng
+ FileUtils::mkdir_p(pth) unless FileTest.directory?(pth)
+ pth
+ end
+ self
+ end
+ def pot_git # consider !!!
+ def ft
+ Gt[:pot]
+ end
+ def dir
+ @env.processing_path.git + '/' + @md.fnb + '/' + ft
+ end
+ self
+ end
+ def md_harvest
+ manifest
+ self
+ end
+ def txt
+ def ft
+ 'txt'
+ end
+ def dir
+ set_path(ft).dir.abc
+ end
+ def url
+ set_path(ft).url.abc
+ end
+ def rel
+ set_path(ft).rel.abc
+ end
+ def rcp
+ set_path(ft).rcp.abc
+ end
+ def rel_sm
+ set_path(ft).rel_sm.ab
+ end
+ self
+ end
+ def html_scroll
+ def ft
+ 'html'
+ end
+ def dir
+ set_path(ft).dir.abc
+ end
+ def url
+ set_path(ft).url.abc
+ end
+ def rel
+ set_path(ft).rel.abc
+ end
+ def rcp
+ set_path(ft).rcp.abc
+ end
+ def rel_sm
+ set_path(ft).rel_sm.ab
+ end
+ def rel_image
+ if output_dir_structure.dump_or_redirect?
+ './image'
+ elsif output_dir_structure.by_language_code?
+ '../../_sisu/image'
+ elsif output_dir_structure.by_filetype?
+ '../_sisu/image'
+ else
+ '../_sisu/image'
+ end
+ end
+ self
+ end
+ def html_seg
+ def ft
+ "html/#{@md.fnb}"
+ end
+ def dir
+ set_path(ft).dir.abc
+ end
+ def url
+ set_path(ft).url.abc
+ end
+ def rel
+ set_path(ft).rel.abc
+ end
+ def rcp
+ set_path(ft).rcp.abc
+ end
+ def rel_sm
+ set_path(ft).rel_sm.ab
+ end
+ def rel_image
+ if output_dir_structure.dump_or_redirect?
+ './image'
+ elsif output_dir_structure.by_language_code?
+ '../../../_sisu/image'
+ elsif output_dir_structure.by_filetype?
+ '../../_sisu/image'
+ else
+ '../_sisu/image'
+ end
+ end
+ self
+ end
+ def html_concordance
+ html_seg
+ self
+ end
+ def html
+ def ft
+ 'html'
+ end
+ def dir
+ set_path(ft).dir.abc
+ end
+ def url
+ set_path(ft).url.abc
+ end
+ def rel
+ set_path(ft).url.abc
+ end
+ def rcp
+ set_path(ft).rcp.abc
+ end
+ def rel_sm
+ set_path(ft).rel_sm.ab
+ end
+ def rel_image
+ if output_dir_structure.by_language_code?
+ '../../_sisu/image'
+ elsif output_dir_structure.by_filetype?
+ '../_sisu/image'
+ else
+ '../_sisu/image'
+ end
+ end
+ self
+ end
+ def xhtml
+ def ft
+ 'xhtml'
+ end
+ def dir
+ set_path(ft).dir.abc
+ end
+ def url
+ set_path(ft).url.abc
+ end
+ def rel
+ set_path(ft).rel.abc
+ end
+ def rcp
+ set_path(ft).rcp.abc
+ end
+ def rel_sm
+ set_path(ft).rel_sm.ab
+ end
+ def rel_image
+ '../../_sisu/image'
+ end
+ self
+ end
+ def epub
+ def ft
+ 'epub'
+ end
+ def dir
+ set_path(ft).dir.ab
+ end
+ def url
+ set_path(ft).url.ab
+ end
+ def rel
+ set_path(ft).rel.ab
+ end
+ def rcp
+ set_path(ft).rcp.ab
+ end
+ def rel_sm
+ set_path(ft).rel_sm.ab
+ end
+ def rel_image
+ './image'
+ end
+ self
+ end
+ def odt
+ def ft
+ 'odt'
+ end
+ def dir
+ set_path(ft).dir.abc
+ end
+ def url
+ set_path(ft).url.abc
+ end
+ def rel
+ set_path(ft).rel.abc
+ end
+ def rcp
+ set_path(ft).rcp.abc
+ end
+ def rel_sm
+ set_path(ft).rel_sm.ab
+ end
+ self
+ end
+ def xml
+ def ft
+ 'xml'
+ end
+ def dir
+ set_path(ft).dir.abc
+ end
+ def url
+ set_path(ft).url.abc
+ end
+ def rel
+ set_path(ft).rel.abc
+ end
+ def rcp
+ set_path(ft).rcp.abc
+ end
+ def rel_sm
+ set_path(ft).rel_sm.ab
+ end
+ def rel_image
+ '../../_sisu/image'
+ end
+ self
+ end
+ def xml_sax
+ xml
+ self
+ end
+ def xml_dom
+ xml
+ self
+ end
+ def pdf
+ def ft
+ 'pdf'
+ end
+ def dir
+ set_path(ft).dir.abc
+ end
+ def url
+ set_path(ft).url.abc
+ end
+ def rel
+ set_path(ft).rel.abc
+ end
+ def rcp
+ set_path(ft).rcp.abc
+ end
+ def rel_sm
+ set_path(ft).rel_sm.ab
+ end
+ self
+ end
+ def sqlite_discreet
+ def ft
+ 'sql'
+ end
+ def dir
+ set_path(ft).dir.ab
+ end
+ def url
+ set_path(ft).url.ab
+ end
+ def rel
+ set_path(ft).rel.ab
+ end
+ def rcp
+ set_path(ft).rcp.ab
+ end
+ def rel_sm
+ set_path(ft).rel_sm.ab
+ end
+ self
+ end
+ def hash_digest
+ def ft
+ 'hashes'
+ end
+ def dir
+ set_path(ft).dir.abc
+ end
+ def url
+ set_path(ft).url.abc
+ end
+ def rel
+ set_path(ft).rel.abc
+ end
+ def rcp
+ set_path(ft).rcp.abc
+ end
+ def rel_sm
+ set_path(ft).rel_sm.ab
+ end
+ self
+ end
+ def manifest
+ def ft
+ 'manifest'
+ end
+ def dir
+ set_path(ft).dir.abc
+ end
+ def url
+ set_path(ft).url.abc
+ end
+ def rel
+ set_path(ft).rel.abc
+ end
+ def rel_image
+ if output_dir_structure.dump_or_redirect?
+ './image'
+ elsif output_dir_structure.by_language_code?
+ '../../_sisu/image'
+ elsif output_dir_structure.by_filetype?
+ '../../_sisu/image'
+ else
+ '../_sisu/image'
+ end
+ end
+ def rcp
+ set_path(ft).rcp.abc
+ end
+ self
+ end
+ def qrcode
+ def ft
+ 'manifest/qrcode'
+ end
+ def dir
+ set_path(ft).dir.abc
+ end
+ def url
+ set_path(ft).url.abc
+ end
+ def rel
+ set_path(ft).rel.abc
+ end
+ def rcp
+ set_path(ft).rcp.abc
+ end
+ def rel_sm
+ set_path(ft).rel_sm.ab
+ end
+ self
+ end
+ def harvest
+ def ft
+ 'site_metadata'
+ end
+ def dir
+ set_path(ft).dir.ab
+ end
+ def url
+ set_path(ft).url.ab
+ end
+ def rel
+ set_path(ft).rel.ab
+ end
+ def rcp
+ set_path(ft).rcp.ab
+ end
+ def rel_sm
+ if output_dir_structure.by_language_code?
+ ''
+ elsif output_dir_structure.by_filetype?
+ ''
+ else
+ ''
+ end
+ end
+ self
+ end
+ def manpage
+ def ft
+ 'man'
+ end
+ def dir
+ set_path(ft).dir.ab
+ end
+ def url
+ set_path(ft).url.ab
+ end
+ def rel
+ set_path(ft).rel.ab
+ end
+ def rcp
+ set_path(ft).rcp.ab
+ end
+ def rel_sm
+ set_path(ft).rel_sm.ab
+ end
+ self
+ end
+ def texinfo
+ def ft
+ 'texinfo'
+ end
+ def dir
+ set_path(ft).dir.ab
+ end
+ def url
+ set_path(ft).url.ab
+ end
+ def rel
+ set_path(ft).rel.ab
+ end
+ def rcp
+ set_path(ft).rcp.ab
+ end
+ def rel_sm
+ set_path(ft).rel_sm.ab
+ end
+ self
+ end
+ def sitemaps
+ def ft
+ 'sitemaps'
+ end
+ def dir
+ set_path(ft).dir.ab
+ end
+ def url
+ set_path(ft).url.ab
+ end
+ def rel
+ set_path(ft).rel.ab
+ end
+ def rcp
+ set_path(ft).rcp.ab
+ end
+ self
+ end
+ def sqlite #check url
+ def dir
+ output_path.base.dir
+ end
+ def url
+ output_path.base.url
+ end
+ def rel
+ output_path.base.rel
+ end
+ def rcp
+ output_path.base.rcp
+ end
+ self
+ end
+ #def cgi
+ #end
+ def css
+ @d='_sisu/css'
+ def dir
+ output_path.base.dir + '/' + @d
+ end
+ def url
+ output_path.base.url + '/' + @d
+ end
+ def rel
+ @d
+ #output_path.base.rel + '/' + @d
+ end
+ def rcp
+ output_path.stub.rcp + '/' + @d
+ end
+ self
+ end
+ def images
+ @d='_sisu/image'
+ def dir
+ output_path.base.dir + '/' + @d
+ end
+ def url
+ output_path.base.url + '/' + @d
+ end
+ def rel
+ @d
+ #output_path.base.rel + '/' + @d
+ end
+ def rcp
+ output_path.stub.rcp + '/' + @d
+ end
+ self
+ end
+ def images_external
+ @d='_sisu/image_external'
+ def dir
+ output_path.base.dir + '/' + @d
+ end
+ def url
+ output_path.base.url + '/' + @d
+ end
+ def rel
+ output_path.base.rel + '/' + @d
+ end
+ def rcp
+ output_path.base.rcp + '/' + @d
+ end
+ self
+ end
+ #def css
+ # #"#{@env.path.output}/#{@env.path.style}"
+ #end
+ self
+ end
+ end
+ class CreateFile <InfoEnv #todo unify with FileOp
+ def initialize(fns)
+ begin
+ super(fns)
+ @env=SiSU_Env::InfoEnv.new(fns)
+ rescue
+ SiSU_Screen::Ansi.new('',$!,$@).rescue do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ end
+ end
+ def html_root
+ #@env.path.output
+ end
+ def mkdir_pdf
+ Dir.mkdir(@env.processing_path.tex) unless FileTest.directory?(@env.processing_path.tex)
+ end
+ def file_generic(output_file='')
+ filename="#{@env.path.output}/#{@fnb}/#{output_file}"
+ File.new(filename,'w+')
+ end
+ def file_error
+ File.new('/tmp/errorlog.sisu','w+')
+ end
+ def file_txt
+ File.new("#{@env.processing_path.dal}/#{@fns}.txt",'w+')
+ end
+ def file_debug
+ File.new("#{@env.processing_path.dal}/#{@fns}.debug.txt",'w+')
+ end
+ def metaverse
+ def file_meta
+ File.new("#{@env.processing_path.dal}/#{@fns}.meta",'w+')
+ end
+ def file_meta_idx_html
+ File.new("#{@env.processing_path.dal}/#{@fns}.idx.html",'w+')
+ end
+ self
+ end
+ def file_note
+ File.new("#{Dir.pwd}/#{@fns}.fn",'w+')
+ end
+ def meta
+ "#{@env.processing_path.dal}/#{@fns}.meta"
+ end
+ def file_semantic
+ filename_semantic="./semantic.yaml"
+ @@filename_semantic=File.new(filename_semantic,'w+')
+ end
+ def file_rss
+ filename_rss="./semantic.xml"
+ @@filename_rss=File.new(filename_rss,'w+')
+ end
+ def epub
+ @pth=@env.processing_path.epub
+ def xhtml_index
+ filename_index="#{@pth}/#{Ep[:d_oebps]}/index.xhtml"
+ File.new(filename_index,'w+')
+ end
+ def xhtml_cover_image
+ filename_index="#{@pth}/#{Ep[:d_oebps]}/cover_image.xhtml"
+ File.new(filename_index,'w+')
+ end
+ def xhtml_segtoc
+ filename_segtoc="#{@pth}/#{Ep[:d_oebps]}/toc.xhtml"
+ File.new(filename_segtoc,'w+')
+ end
+ def mimetype #fixed application/epub+zip ~/grotto/theatre/dbld/builds/epub_sample/mimetype
+ File.new("#{@pth}/mimetype",'w')
+ end
+ def metadata #variable matadata ~/grotto/theatre/dbld/builds/epub_sample/metadata.opf
+ File.new("#{@pth}/#{Ep[:d_oebps]}/#{Ep[:f_opf]}",'w')
+ end
+ def toc_ncx #variable toc ~/grotto/theatre/dbld/builds/epub_sample/toc.ncx
+ File.new("#{@pth}/#{Ep[:d_oebps]}/#{Ep[:f_ncx]}",'w')
+ end
+ def metainf_cont #variable content ~/grotto/theatre/dbld/builds/epub_sample/META-INF/container.xml
+ File.new("#{@pth}/META-INF/container.xml",'w')
+ end
+ def xhtml_css #fixed epub xhtml css
+ File.new("#{@pth}/#{Ep[:d_oebps]}/css/xhtml.css",'w')
+ end
+ self
+ end
+ def file_texinfo
+ File.new("#{@env.processing_path.texinfo}/#{@fnb}.texinfo",'w+')
+ end
+ end
+ class Clear <InfoEnv #todo unify with FileOp
+ def initialize(cmd,fns,operation='')
+ @cmd=cmd
+ begin
+ super(fns)
+ @env=SiSU_Env::InfoEnv.new(fns)
+ ver=InfoVersion.instance
+ if operation.class.inspect =~/SiSU_Param/
+ @md=operation
+ end
+ case operation #watch
+ when /pdf/; @env_out=''
+ when /sql/
+ when /xml|plaintext|ascii/; @env_out="#{@env.path.output}/#{@fnb}" #check change of name to plaintext from ascii
+ else
+ if defined? @md.sfx_src \
+ and @md.sfx_src =~/ss[ftsumc]/
+ @env_suf='lm'
+ @env_out_root=@env.path.output
+ @env_out="#{@env.path.output}/#{@fnb}"
+ @@publisher='SiSU http://www.jus.uio.no/sisu'
+ @env_pdf="#{@env_out_root}/pdf"
+ end
+ end
+ rescue
+ SiSU_Screen::Ansi.new(@cmd,$!,$@).rescue do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ end
+ end
+ def param_instantiate
+ @cX||=SiSU_Screen::Ansi.new(@cmd)
+ @@date=SiSU_Env::InfoDate.new
+ @@proc=@@filename_txt=@@filename_texinfo=@@filename_lout_portrait=@@filename_lout_landscape=@@filename_html_scroll=@@filename_html_index=@@filename_html_segtoc=@@filename_semantic=@@filename_rss=@@newfile=@@drr=@@yaml=@@yamladdr=nil
+ @@publisher='SiSU scribe'
+ end
+ end
+ class InfoPort < InfoEnv
+ def initialize
+ @env=SiSU_Env::InfoEnv.new
+ end
+ def webrick
+ @env.port.webrick_port
+ end
+ end
+ class InfoProgram < InfoEnv #revisit
+ attr_accessor :editor,:wc,:tidy,:rexml,:pdflatex,:postgresql,:sqlite
+ def initialize
+ prog=SiSU_Env::InfoEnv.new.program
+ @editor,@wc,@tidy,@rexml,@pdflatex,@postgresql,@sqlite=prog.text_editor,prog.wc,prog.tidy,prog.rexml,prog.pdflatex,prog.postgresql,prog.sqlite
+ end
+ end
+ class CSS_Default
+ def html
+ 'html.css'
+ end
+ def html_tables
+ 'html_tables.css'
+ end
+ def xhtml
+ 'xhtml.css'
+ end
+ def xml_sax
+ 'sax.css'
+ end
+ def xml_dom
+ 'dom.css'
+ end
+ def docbook_xml
+ 'docbook.css'
+ end
+ def homepage
+ 'homepage.css'
+ end
+ def harvest
+ 'harvest.css'
+ end
+ end
+ class CSS_Select < InfoEnv
+ def initialize(md)
+ @md=md
+ @env=SiSU_Env::InfoEnv.new('',@md)
+ end
+ def html
+ css=if @md.doc_css \
+ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_html.css")
+ "#{@md.doc_css}_html.css"
+ elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_html.css")
+ "#{@env.path.stub_pwd}_html.css"
+ else
+ SiSU_Env::CSS_Default.new.html
+ end
+ end
+ def html_tables
+ css=if @md.doc_css \
+ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_html_tables.css")
+ "#{@md.doc_css}_html_tables.css"
+ elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_html_tables.css")
+ "#{@env.path.stub_pwd}_html_tables.css"
+ else SiSU_Env::CSS_Default.new.html_tables
+ end
+ end
+ def xhtml
+ css=if @md.doc_css \
+ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_xhtml.css")
+ "#{@md.doc_css}_xhtml.css"
+ elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_xhtml.css")
+ "#{@env.path.stub_pwd}_xhtml.css"
+ else SiSU_Env::CSS_Default.new.xhtml
+ end
+ end
+ def xml_sax
+ css=if @md.doc_css \
+ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_xml_sax.css")
+ "#{@md.doc_css}_xml_sax.css"
+ elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_xml_sax.css")
+ "#{@env.path.stub_pwd}_xml_sax.css"
+ else SiSU_Env::CSS_Default.new.xml_sax
+ end
+ end
+ def xml_dom
+ css=if @md.doc_css \
+ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_xml_dom.css")
+ "#{@md.doc_css}_xml_dom.css"
+ elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_xml_dom.css")
+ "#{@env.path.stub_pwd}_xml_dom.css"
+ else SiSU_Env::CSS_Default.new.xml_dom
+ end
+ end
+ def docbook_xml
+ css=if @md.doc_css \
+ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_docbook.css")
+ "#{@md.doc_css}_xml_dom.css"
+ elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_docbook.css")
+ "#{@env.path.stub_pwd}_docbook.css"
+ else SiSU_Env::CSS_Default.new.docbook_xml
+ end
+ end
+ def homepage
+ css=if @md.doc_css \
+ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_homepage.css")
+ "#{@md.doc_css}_homepage.css"
+ elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_homepage.css")
+ "#{@env.path.stub_pwd}_homepage.css"
+ else SiSU_Env::CSS_Default.new.homepage
+ end
+ end
+ end
+ class CSS_Stylesheet
+ def initialize(md)
+ @md=md
+ @css=SiSU_Env::CSS_Select.new(@md)
+ @env=SiSU_Env::InfoEnv.new('',@md)
+ @file=SiSU_Env::FileOp.new(@md)
+ end
+ def html
+ %{ <link rel="stylesheet" href="#{@file.path_rel_links.html_scroll_css}#{@env.path.style}/#{@css.html}" type="text/css" />}
+ end
+ def html_seg
+ %{ <link rel="stylesheet" href="#{@file.path_rel_links.html_seg_css}#{@env.path.style}/#{@css.html}" type="text/css" />}
+ end
+ def html_tables
+ %{ <link rel="stylesheet" href="#{@file.path_rel_links.html_seg_css}#{@env.path.style}/#{@css.html}" type="text/css" />}
+ end
+ def xhtml_epub
+ %{ <link rel="stylesheet" href="css/xhtml.css" type="text/css" />}
+ end
+ def epub
+ xhtml_epub
+ end
+ def xhtml
+ %{<?xml-stylesheet type="text/css" href="#{@file.path_rel_links.xhtml_css}#{@env.path.style}/#{@css.xhtml}"?>}
+ end
+ def xml_sax
+ %{<?xml-stylesheet type="text/css" href="#{@file.path_rel_links.xml_css}#{@env.path.style}/#{@css.xml_sax}"?>}
+ end
+ def xml_dom
+ %{<?xml-stylesheet type="text/css" href="#{@file.path_rel_links.xml_css}#{@env.path.style}/#{@css.xml_dom}"?>}
+ end
+ end
+ class CreateSite < InfoEnv
+ require_relative 'css' # css.rb
+ include SiSU_Style
+ def initialize(cmd)
+ @cmd=cmd
+ @env=SiSU_Env::InfoEnv.new
+ @init=SiSU_Env::GetInit.new
+ @home,@pwd=ENV['HOME'],ENV['PWD'] #@pwd=Dir.pwd
+ @rc=GetInit.new.sisu_yaml.rc
+ @vz=SiSU_Viz::Defaults.new
+ @vz_home=SiSU_Viz::Home.new
+ end
+ def homepage
+ home_pages_manually_created=Dir.glob("#{@env.path.rc}/home/*.html")
+ FileUtils::mkdir_p("#{@env.path.webserv}/#{@env.path.stub_pwd}") unless FileTest.directory?("#{@env.path.webserv}/#{@env.path.stub_pwd}")
+ if home_pages_manually_created.length > 0
+ home_pages_manually_created.each do |homepage|
+ FileUtils.cp(homepage,"#{@env.path.webserv}/#{@env.path.stub_pwd}")
+ end
+ else
+ filename_homepage="#{@env.path.webserv}/#{@env.path.stub_pwd}/index.html"
+ filename_home_toc="#{@env.path.webserv}/#{@env.path.stub_pwd}/toc.html"
+ file_homepage=File.new(filename_homepage,'w')
+ file_home_toc=File.new(filename_home_toc,'w')
+ file_homepage << @vz_home.homepage
+ file_home_toc << @vz_home.homepage
+ file_homepage.close
+ file_home_toc.close
+ end
+ end
+ def cp_images(src_path,dest_path)
+ if FileTest.directory?(src_path)
+ FileUtils::cd(src_path)
+ source=Dir.glob("*.{png,jpg,gif,ico}")
+ FileUtils::mkdir_p(dest_path) unless FileTest.directory?(dest_path)
+ FileUtils::chmod(0755,dest_path)
+ source.each do |i|
+ if FileTest.file?(i)
+ FileUtils::cp(i,"#{dest_path}/#{i}")
+ FileUtils::chmod(0644,"#{dest_path}/#{i}")
+ else STDERR.puts %{\t*WARN* did not find image - "#{i}" [#{__FILE__}:#{__LINE__}]}
+ end
+ end
+ FileUtils::cd(@pwd)
+ else STDERR.puts %{\t*WARN* did not find - #{src_path} [#{__FILE__}:#{__LINE__}]}
+ end
+ end
+ def cp_local_images
+ src="#{@pwd}/_sisu/image"
+ dest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image"
+ cp_images(src,dest) if FileTest.directory?(src)
+ end
+ def cp_external_images
+ src="#{@env.processing_path.processing}/external_document/image"
+ dest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image_external"
+ if FileTest.directory?(src)
+ cp_images(src,dest) if FileTest.directory?(src)
+ end
+ end
+ def cp_webserver_images
+ src=@env.path.image_source
+ dest_arr=[
+ "#{@env.path.webserv}/_sisu/image",
+ "#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image"
+ ]
+ dest_arr.each do |dest|
+ cp_images(src,dest) if FileTest.directory?(src)
+ end
+ end
+ def cp_webserver_images_local #this should not have been necessary
+ src=@env.path.image_source
+ dest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image"
+ cp_images(src,dest) if FileTest.directory?(src)
+ end
+ def cp_base_images #fix images
+ src="#{@env.path.share}/image"
+ dest_arr=[
+ "#{@env.path.webserv}/_sisu/image_sys",
+ "#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image_sys"
+ ]
+ dest_arr.each do |dest|
+ cp_images(src,dest) if FileTest.directory?(src)
+ end
+ end
+ def cp_css
+ FileUtils::mkdir_p("#{@env.path.output}/#{@env.path.style}") unless FileTest.directory?("#{@env.path.output}/#{@env.path.style}")
+ css_path=['/etc/sisu/css',"#{@home}/.sisu/css","#{@pwd}/_sisu/css"] #BROKEN
+ if defined? @rc['permission_set']['css_modify'] \
+ and @rc['permission_set']['css_modify']
+ SiSU_Screen::Ansi.new(@cmd,"*WARN* modify is css set to: #{@rc['permission_set']['css_modify']}").warn if @cmd=~/[MV]/
+ css_path.each do |x|
+ if FileTest.directory?(x)
+ FileUtils::cd(x)
+ source=Dir.glob("*.{css}")
+ source.each do |i|
+ if FileTest.file?(i)
+ FileUtils::cp(i,"#{@env.path.output}/#{@env.path.style}")
+ else STDERR.puts %{\t*WARN* did not find css - "#{i}" [#{__FILE__}:#{__LINE__}]}
+ end
+ end
+ FileUtils::cd(@pwd)
+ end
+ end
+ else SiSU_Screen::Ansi.new(@cmd,"*WARN* modify css is not set or is set to: false").warn if @cmd=~/[MV]/
+ end
+ fn_css=SiSU_Env::CSS_Default.new
+ css=SiSU_Style::CSS.new
+ path_style="#{@env.path.output}/#{@env.path.style}"
+ FileUtils::mkdir_p(path_style) unless FileTest.directory?(path_style)
+ if @cmd =~/C/ \
+ or not FileTest.file?("#{path_style}/#{fn_css.homepage}")
+ style=File.new("#{path_style}/#{fn_css.homepage}",'w')
+ style << css.homepage
+ style.close
+ end
+ if @cmd =~/C/ \
+ or not FileTest.file?("#{path_style}/#{fn_css.html_tables}")
+ style=File.new("#{path_style}/#{fn_css.html_tables}",'w')
+ style << css.html_tables
+ style.close
+ end
+ if @cmd =~/C/ \
+ or not FileTest.file?("#{path_style}/#{fn_css.html}")
+ style=File.new("#{path_style}/#{fn_css.html}",'w')
+ style << css.html
+ style.close
+ end
+ if @cmd =~/C/ \
+ or not FileTest.file?("#{path_style}/#{fn_css.harvest}")
+ style=File.new("#{path_style}/#{fn_css.harvest}",'w')
+ style << css.harvest
+ style.close
+ end
+ if @cmd =~/C/ \
+ or (@cmd =~/[x]/ \
+ and not FileTest.file?("#{path_style}/#{fn_css.xml_sax}"))
+ style=File.new("#{path_style}/#{fn_css.xml_sax}",'w')
+ style << css.xml_sax
+ style.close
+ end
+ if @cmd =~/C/ \
+ or (@cmd =~/[X]/ \
+ and not FileTest.file?("#{path_style}/#{fn_css.xml_dom}"))
+ style=File.new("#{path_style}/#{fn_css.xml_dom}",'w')
+ style << css.xml_dom
+ style.close
+ end
+ if @cmd =~/C/ \
+ or (@cmd =~/[b]/ \
+ and not FileTest.file?("#{path_style}/#{fn_css.xhtml}"))
+ style=File.new("#{path_style}/#{fn_css.xhtml}",'w')
+ style << css.xhtml
+ style.close
+ end
+ end
+ end
+end
+module SiSU_Screen
+ require_relative 'screen_text_color' # screen_text_color.rb
+end
+module SiSU_Errors
+ require_relative 'errors' # errors.rb
+end
+__END__
+https? intro check 2007-09-22
diff --git a/lib/sisu/v2/termsheet.rb b/lib/sisu/v4/termsheet.rb
index 8640f9a9..c376871c 100644
--- a/lib/sisu/v2/termsheet.rb
+++ b/lib/sisu/v4/termsheet.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -58,8 +57,8 @@
sample files must be provided - (saved till later as may confuse)
=end
-require "#{SiSU_lib}/sysenv" # sysenv.rb
-require "#{SiSU_lib}/param" # param.rb
+require_relative 'sysenv' # sysenv.rb
+require_relative 'param' # param.rb
include SiSU_Param
@do,@done,@used,@html_output,@txt_input,@txt_output,@@report=Array.new(7){[]}
@@info=nil
@@ -70,9 +69,9 @@ def talent(termsheet,flag)
no_ocn='0' if flag =~/0/ #flag to request switch off of text object numbering
@@info=nil
@@info=termsheet.gsub(/(.+?)\.termsheet\.rb/,'../facility_data/\1.html')
- @env=SiSU_Env::Info_env.new
+ @env=SiSU_Env::InfoEnv.new
@dir_fd="#{@env.path.output}/facility_data"
- mkdir_p(@dir_fd) unless FileTest.directory?(@dir_fd)==true
+ FileUtils::mkdir_p(@dir_fd) unless FileTest.directory?(@dir_fd)==true
html_output=[]
case termsheet
when /.+?\.(termsheet)\.rb$/
@@ -121,7 +120,7 @@ WOK
@@report << @done << @used << "\n"
@done,@used=[],[]
end
-require "#{SiSU_lib}/param" # param.rb
+require_relative 'param' # param.rb
@argv=$*
@proc="#{@argv[0].to_s}"
if @proc =~ /^-?[wft]/
@@ -130,7 +129,7 @@ if @proc =~ /^-?[wft]/
talent(termsheet,@proc)
end
end
-@env=SiSU_Env::Info_env.new
+@env=SiSU_Env::InfoEnv.new
@dir_fd="#{@env.path.output}/facility_data"
@url="#{@env.url.webserv}/facility_data"
@@report << %{\n#{@@cX.grey}See#{@@cX.off}: #{@@cX.blue}#{@dir_fd}/all.txt\t#{@dir_fd}/toc.html\t#{@dir_fd}/#{@@cX.off}\n\n#{@@cX.grey}See#{@@cX.off}: #{@@cX.blue}#{@url}/all.txt\t#{@url}/toc.html\t#{@url}/#{@@cX.off}\n\n}
diff --git a/lib/sisu/v2/texinfo.rb b/lib/sisu/v4/texinfo.rb
index bcff4915..ef622025 100644
--- a/lib/sisu/v2/texinfo.rb
+++ b/lib/sisu/v4/texinfo.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -57,13 +56,13 @@
=end
module SiSU_TexInfo
- require "#{SiSU_lib}/html" # html.rb
- require "#{SiSU_lib}/param" # param.rb
+ require_relative 'html' # html.rb
+ require_relative 'param' # param.rb
include SiSU_Param
include SiSU_Viz
#include Stamp ... needed removed arbitrarily 2005w05/1 (warnings about undefined flags)
- require "#{SiSU_lib}/texinfo_format" # texinfo_format.rb
- include SiSU_Texinfo_format
+ require_relative 'texinfo_format' # texinfo_format.rb
+ include SiSU_TexInfoFormat
@tex_file=[]
@@tabular="{tabular}"
@@table_pagebreak_counter,@@tex_endnote_call_counter,@@tex_table_flag,@@tex_counter,@@tex_column,@@tex_columns,@@counting=0,0,0,0,0,0,0
@@ -77,17 +76,21 @@ module SiSU_TexInfo
include SiSU_TexInfo
def initialize(opt)
@opt=opt
- @env=SiSU_Env::Info_env.new(@opt.fns)
- @vz=SiSU_Env::Get_init.instance.skin
+ @md=SiSU_Param::Parameters.new(@opt).get
+ @env=SiSU_Env::InfoEnv.new(@opt.fns)
+ @vz=SiSU_Viz::Defaults.new
end
def directories
begin
case @opt.fns
when /\.(?:-|ssm\.)?sst$/
Dir.mkdir(@env.path.output) unless FileTest.directory?("#{@env.path.output}")
- Dir.mkdir(@env.path.texi) unless FileTest.directory?(@env.path.tex)
+ Dir.mkdir(@env.processing_path.texi) unless FileTest.directory?(@env.processing_path.texi)
+ end
+ rescue
+ SiSU_Screen::Ansi.new(opt,$!,$@).rescue do
+ __LINE__.to_s + ':' + __FILE__
end
- rescue; STDERR.puts SiSU_Screen::Ansi.new(@opt.cmd,$!,$@).rescue
ensure
end
end
@@ -96,99 +99,107 @@ module SiSU_TexInfo
end
def song
begin
- unless @opt.cmd =~/q/
- tell=SiSU_Screen::Ansi.new(@opt.cmd,'TexInfo')
- tell.green_title_hi
- end
+ tool=(@opt.cmd =~/[MVv]/) \
+ ? "#{@env.program.texinfo} #{@md.file.output_path.texinfo.dir}/#{@md.file.base_filename.info}"
+ : "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}"
+ tell=@opt.cmd=~/[MVvz]/ \
+ && @opt.cmd !~/q/ \
+ ? SiSU_Screen::Ansi.new(@opt.cmd,'TexInfo',tool).green_hi_blue
+ : SiSU_Screen::Ansi.new(@opt.cmd,'TexInfo',tool).green_title_hi
+ tell
@md=SiSU_Param::Parameters.new(@opt).get
- puts "\t#{@@cX.grey}TexInfo#{@@cX.off}"
- my_make=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns)
directories
- @marshalfile=my_make.dal_content
+ @marshalfile=SiSU_Env::InfoFile.new(@opt.fns).marshal.dal_content
if FileTest.file?(@marshalfile)==true
File.open(@marshalfile) { |f| @@tuned_file=Marshal.load(f)}
- tell.meta_verse_skipped unless @opt.cmd =~/q/
+ #tell.meta_verse_skipped if @opt.cmd =~/[vVM]/
else
tex_array=IO.readlines(@opt.fns,'')
SiSU_Metaverse.songsheet(tex_array)
end
tex_array=@@tuned_file
- Texinfo_make.new(@md,tex_array).songsheet
+ TeXinfoMake.new(@md,tex_array).songsheet
tex_array=''
rescue; STDERR.puts SiSU_Screen::Ansi.new(@opt.cmd,$!,$@).rescue
ensure
end
end
end
- class Texinfo_make
+ class TeXinfoMake
include SiSU_Param
- include SiSU_Texinfo_format
+ include SiSU_TexInfoFormat
@@tex_1='(?:.+?)+~' #?? debug
@@tabular="{tabular}"
@@tex_pattern_margin_number="\\\\marginpar.+?\s+"
def initialize(md,data)
@md,@data=md,data
- @env=SiSU_Env::Info_env.new(@md.fns)
- @vz=SiSU_Env::Get_init.instance.skin
+ @env=SiSU_Env::InfoEnv.new(@md.fns)
+ @vz=SiSU_Viz::Defaults.new
+ @f=SiSU_Env::FileOp.new(@md)
end
def songsheet
begin
- @data=pre
- @data=endnote
- @data=markup
- @data=tail
- output
+ data=@data
+ data=pre(data)
+ data=endnote(data)
+ data,head=markup(data)
+ objs_txt=tail(data)
+ doc_txt=[head,objs_txt]
+ output(doc_txt)
makeinfo #KEEP reinstate when fixed #%
- rescue; STDERR.puts SiSU_Screen::Ansi.new(@md.cmd,$!,$@).rescue
+ place_info
+ rescue; STDERR.puts SiSU_Screen::Ansi.new(@md.opt.cmd,$!,$@).rescue
ensure
end
end
- def pre
- data=@data
+ def pre(data)
+ data_new=[]
data.each do |dob|
# DEBUG 2003w16 this is a kludge, because i could not get parameters
# from param, Sort out ... revert to more elegant solution
if dob.is =='table'
@@flag['tables']='y' # KLUDGE get from param
end
- dob.obj.gsub!(/<:p[bn]>/,'')
- dob.obj.gsub!(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1(\2 [linked to:] \3)')
- dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s)\{(.+?)\}((?:https?|file):\/\/\S+)/,'\1(\2 [linked to:] \3)')
- do_mono=SiSU_Texinfo_format::Texinfo.new(@md,dob)
+ dob.obj=dob.obj.gsub(/<:p[bn]>/,'').
+ gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1(\2 [linked to:] \3)').
+ gsub(/(^|#{Mx[:gl_c]}|\s)\{(.+?)\}((?:https?|file):\/\/\S+)/,'\1(\2 [linked to:] \3)')
+ do_mono=SiSU_TexInfoFormat::Texinfo.new(@md,dob)
dob.obj=do_mono.spec_char(dob.obj)
+ data_new << dob
end
- data
+ data_new
end
- def endnote
- data=@data
+ def endnote(data)
+ data_new=[]
data.each do |dob|
- if dob.of=~/para|group/
- dob.obj.gsub!(/\s*#{Mx[:en_a_o]}(?:\d+)\s+(.+?)#{Mx[:en_a_c]}/m,' @footnote{ \1} ')
- dob.obj.gsub!(/\s*#{Mx[:en_a_o]}(\*+)\s+(.+?)#{Mx[:en_a_c]}/m,' @footnote{ \1} ')
+ if dob.of==:para \
+ || dob.of==:block
+ dob.obj=dob.obj.gsub(/\s*#{Mx[:en_a_o]}(?:\d+)\s+(.+?)#{Mx[:en_a_c]}/m,' @footnote{ \1} ').
+ gsub(/\s*#{Mx[:en_a_o]}(\*+)\s+(.+?)#{Mx[:en_a_c]}/m,' @footnote{ \1} ')
end
- dob
+ data_new << dob
end
- data
+ data_new
end
def poem
- data=@data
+ data,data_new=@data,[]
@tex_file=[]
@@counting=0
data.each do |dob|
- if dob.is =='code'
+ if dob.is ==:code
@@flag['code']=true
@@counting=1
end
- if dob.is =='verse'
+ if dob.is ==:verse
@@flag['poem']=1
end
if @@flag['code']
if @@flag['code'] \
- and dob.obj =~ /#{Mx[:gr_o]}code[-_](?:end|close)#{Mx[:gr_c]}/ #watch change not tested 200501 #fix
+ && (dob.obj =~ /#{Mx[:gr_o]}code[-_](?:end|close)#{Mx[:gr_c]}/) #watch change not tested 200501 #fix
@@flag['code']=false
end
if @@flag['code'] \
- and dob.obj =~ /\S/
+ && (dob.obj =~ /\S/)
sub_array=dob.obj.dup
@@line_mode=sub_array.scan(/.+/)
Tune.code_lines(@@line_mode)
@@ -196,11 +207,11 @@ module SiSU_TexInfo
end
elsif @@flag['poem']==1
if @@flag['poem']==1 \
- and dob.obj =~ /#{Mx[:gr_o]}verse[-_](?:end|close)#{Mx[:gr_c]}/ #watch change not tested 200501 #fix
+ && (dob.obj =~ /#{Mx[:gr_o]}verse[-_](?:end|close)#{Mx[:gr_c]}/) #watch change not tested 200501 #fix
@@flag['poem']=0
end
if @@flag['poem']==1 \
- and dob.obj =~ /\S/
+ && (dob.obj =~ /\S/)
sub_array=dob.obj.dup
@@line_mode=sub_array.scan(/.+/)
Tune.code_lines(@@line_mode)
@@ -208,53 +219,58 @@ module SiSU_TexInfo
end
end
@tex_file << dob.obj
+ data_new << dob
end
+ data_new
end
def code_lines
- data=@data
+ data,data_new=@data,[]
data.each do |line|
- if line =~ /\S/ \
- and line !~ /#{Mx[:gr_o]}(code|verse).+/ #fix
- if @@flag['code']
- line.gsub!(/^\s*(.+)/m,"\\noindent \\marginpar\[left-text\]{\\begin{tiny}#{@@counting}\\end{tiny}}\\1\\")
+ if (line =~ /\S/) \
+ && (line !~ /#{Mx[:gr_o]}(code|verse).+/) #fix
+ line=if @@flag['code']
+ line.gsub(/^\s*(.+)/m,"\\noindent \\marginpar\[left-text\]{\\begin{tiny}#{@@counting}\\end{tiny}}\\1\\")
@@counting+=1 if @@flag['code']
- else line.gsub!(/(.+)/m,'\noindent\1')
+ else line.gsub(/(.+)/m,'\noindent\1')
end
end
+ data_new << line
end
end
def tables
- data=@data
+ data,data_new=@data,[]
@tex_file=[]
@@tableheader=0
data.each do |dob|
if dob.obj =~ /#{Mx[:tc_p]}|#{Mx[:gr_o]}T/ui #fix
- do_mono=SiSU_Texinfo_format::Texinfo.new(@md,dob)
+ do_mono=SiSU_TexInfoFormat::Texinfo.new(@md,dob)
dob.obj=do_mono.longtable # using longtable latex package
end
@tex_file << dob.obj
+ data_new << dob
end
+ data_new
end
- def markup
- data=@data
+ def markup(data)
+ data_new=[]
@tex_file=[]
@row_break='\\\\\\'
@break_page="#{@row_break}\n#{@row_break} \n"
md={}
- @tex_file << SiSU_Texinfo_format::Texinfo.new(@md).head
- mono=SiSU_Texinfo_format::Texinfo.new(@md)
+ @tex_file << SiSU_TexInfoFormat::Texinfo.new(@md).head
+ mono=SiSU_TexInfoFormat::Texinfo.new(@md)
@tex_file << mono.topnode(@md.title.full)
texinfo_menu=[]
n_menu,n_submenu=0,0
@submenu,@subsubmenu={},{}
data.each do |dob|
- if dob.is =='heading' \
- and dob.ln.to_s =~ /^[1-3]$/
- toc=SiSU_Texinfo_format::Texinfo.new(@md,dob)
+ if dob.is ==:heading \
+ && (dob.ln.to_s =~ /^[1-3]$/)
+ toc=SiSU_TexInfoFormat::Texinfo.new(@md,dob)
texinfo_menu << toc.menu
- elsif dob.is =='heading' \
- and dob.ln.to_s =~ /^[4-6]$/
- toc=SiSU_Texinfo_format::Texinfo.new(@md,dob)
+ elsif dob.is ==:heading \
+ && (dob.ln.to_s =~ /^[4-6]$/)
+ toc=SiSU_TexInfoFormat::Texinfo.new(@md,dob)
texinfo_menu << toc.menu
case dob.ln
when 4
@@ -270,10 +286,12 @@ module SiSU_TexInfo
@subsubmenu[n_submenu] << toc.menu
end
else
- dob.obj.gsub!(/\s*(?:<:?br>|<br \/>)\s*/,"\n\n")
+ dob.obj=dob.obj.gsub(/\s*(?:<:?br>|<br \/>)\s*/,"\n\n")
end
+ data_new << dob
end
- texinfo_menu.compact!
+ data=data_new
+ texinfo_menu=texinfo_menu.compact
texinfo_menu << "* Dublin Core::"
@tex_file << texinfo_menu
@tex_file << "* Index::\n" +
@@ -281,105 +299,118 @@ module SiSU_TexInfo
"@c %% 5\n\n"
n_menu,n_submenu=0,0
@@do_submenu,@@do_subsubmenu=1,1
+ data_new=[]
data.each do |dob|
- mono=SiSU_Texinfo_format::Texinfo.new(@md,dob)
- if dob.is=='heading'
+ mono=SiSU_TexInfoFormat::Texinfo.new(@md,dob)
+ if dob.is==:heading
case dob.ln
- when 1; mono.level1
- when 2; mono.level2
- when 3; mono.level3
+ when 1; dob=mono.level1
+ when 2; dob=mono.level2
+ when 3; dob=mono.level3
when 4;
- mono.level4
+ dob=mono.level4
n_menu+=1
@@do_submenu,@@do_subsubmenu=1,1
when 5;
n_submenu+=1
@@do_subsubmenu=1
if @@do_submenu==1
- menu=SiSU_Texinfo_format::Texinfo_txt.new(@md,dob,@submenu[n_menu])
+ menu=SiSU_TexInfoFormat::TeXinfoTxt.new(@md,dob,@submenu[n_menu])
dob.obj="#{menu.submenu}#{mono.level5.obj}"
@@do_submenu=0
- else mono.level5
+ else dob=mono.level5
end
when 6;
if @@do_submenu==1
- menu=SiSU_Texinfo_format::Texinfo_txt.new(@md,dob,@submenu[n_menu])
+ menu=SiSU_TexInfoFormat::TeXinfoTxt.new(@md,dob,@submenu[n_menu])
dob.obj="#{menu.subsubmenu}#{mono.level6.obj}"
@@do_subsubmenu=0
else
- mono.level6
+ dob=mono.level6
end
end
else
if dob.obj !~/\S/
dob.obj=nil
else
- if dob.is=='para' \
- and dob.obj !~/##{dob.ocn}/
+ if dob.is==:para \
+ && (dob.obj !~/##{dob.ocn}/)
dob.obj="#{dob.obj} ##{dob.ocn}"
end
end
end
#%case with endnotes
- dob.obj.gsub!(/\s*[0-8]\\+(\S+)?\s+/,' ') if dob.obj
- @tex_file << dob.obj if dob.obj and dob.is !~/structure|comment/ #sort exceptions
+ dob.obj=dob.obj.gsub(/\s*[0-8]\\+(\S+)?\s+/,' ') if dob.obj
+ data_new << dob
end
- data=@tex_file
+ [data_new, @tex_file]
end
def number_titles
- data=@data
+ data,data_new=@data,[]
@tex_file=[]
input=%{#{@md.markup}}[/(num_top\s*=\s*(\d?))?/m,2] # else default usually 4 # this was a bit of a trick required to pass nil to input if nothing matched... #puts input
num_top=input.to_i
t_no1=0; t_no2=0; t_no3=0; t_no4=0;
no1=num_top; no2=(num_top + 1); no3=(num_top + 2); no4=(num_top + 3);
data.each do |dob|
- if @md.markup =~ /num_top/i \
- and dob.obj !~ /#{Rx[:meta]}/
- if dob.obj =~ /^[1-6]\\+(?:~\S+)?\s*<!h-.+?-!>/ \
- and dob.obj !~ /<:\d-endnotes>/
- header=dob.obj[/<!h-(.+?)-!>/m, 1].gsub!(/-/m,'.')
- dob.obj.gsub!(/^(?:[1-6]\\+(?:~\S+)|<:([12356]|4-.+?-)>)\s*<!h-.+?-!>/,
+ if (@md.markup =~ /num_top/i) \
+ && (dob.obj !~ /#{Rx[:meta]}/)
+ if (dob.obj =~ /^[1-6]\\+(?:~\S+)?\s*<!h-.+?-!>/) \
+ && (dob.obj !~ /<:\d-endnotes>/)
+ header=dob.obj[/<!h-(.+?)-!>/m, 1].gsub(/-/m,'.')
+ dob.obj=dob.obj.gsub(/^(?:[1-6]\\+(?:~\S+)|<:([12356]|4-.+?-)>)\s*<!h-.+?-!>/,
"\\1 #{header} ")
end
elsif dob.obj=~ /<!h!>|<!h\d!>|<!h.+?!>|<!!h.+?!>/
if dob.obj=~ /<!h-.+?-!>/
- dob.obj.gsub!(/<!h-(.+?)-!>/,'\1 ')
+ dob.obj=dob.obj.gsub(/<!h-(.+?)-!>/,'\1 ')
end
end
@tex_file << dob.obj
end
- data=@tex_file
+ data_new << dob
end
- def tail
- data=@data
- tex=SiSU_Texinfo_format::Texinfo.new(@md)
- data << tex.dublincore
- data << tex.tail
+ def tail(data)
+ tex=SiSU_TexInfoFormat::Texinfo.new(@md)
+ objs_txt=[]
+ data.each do |dob|
+ if dob.obj \
+ && (dob.is !=:structure \
+ && dob.is !=:comment)
+ objs_txt << dob.obj if dob.obj
+ end
+ end
+ objs_txt << tex.dublincore << tex.tail
+ objs_txt
end
- def output
- data=@data
- data.compact!
- filename=%{#{@env.path.texi}/#{@md.fnb}.texinfo}
- filename_texinfo=File.new(filename,'w+')
- puts filename if @md.cmd =~/M/
- data.each {|s| (filename_texinfo.puts s,"\n") if s}
- filename_texinfo.close
+ def output(data)
+ filename_texinfo=%{#{@env.processing_path.texi}/#{@md.fnb}.texinfo}
+ file_texinfo=File.new(filename_texinfo,'w+')
+ puts filename_texinfo if @md.opt.cmd =~/M/
+ data.each {|s| (file_texinfo.puts s,"\n") if s}
+ file_texinfo.close
end
def makeinfo
if @md.fns =~/\.(?:-|ssm\.)?sst$/
- m=/(.+?)\.([_-]?sst)$/.match(@md.fns)
+ m=/(.+?)\.((?:-|ssm\.)?sst)$/.match(@md.fns)
fnb,sfx=m[1],m[2]
pwd=Dir.pwd
case sfx
when /(?:-|ssm\.)?sst$/
- @env=SiSU_Env::Info_env.new(@md.fns,@md.cmd)
- Dir.chdir(@env.path.texi)
- texinfo=SiSU_Env::System_call.new("#{fnb}.texinfo")
+ @env=SiSU_Env::InfoEnv.new(@md.fns,@md.opt.cmd)
+ Dir.chdir(@env.processing_path.texi)
+ texinfo=SiSU_Env::SystemCall.new("#{fnb}.texinfo")
texinfo.makeinfo
end
Dir.chdir(pwd)
end
+ def place_info
+ unless FileTest.directory?(@f.output_path.texinfo.dir)
+ FileUtils::mkdir_p(@f.output_path.texinfo.dir)
+ end
+ info_src=%{#{@env.processing_path.texi}/#{@md.fnb}.info}
+ FileUtils::cp(info_src, @f.place_file.info.dir)
+ end
end
end
end
diff --git a/lib/sisu/v2/texinfo_format.rb b/lib/sisu/v4/texinfo_format.rb
index 5e1d8af4..0c6b99f2 100644
--- a/lib/sisu/v2/texinfo_format.rb
+++ b/lib/sisu/v4/texinfo_format.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -56,9 +55,9 @@
** Description: texinfo formatting template
=end
-module SiSU_Texinfo_format
+module SiSU_TexInfoFormat
@@table_pg_break_counter=1
- require "#{SiSU_lib}/param" # param.rb
+ require_relative 'param' # param.rb
include SiSU_Param
include SiSU_Viz
class Texinfo
@@ -67,38 +66,37 @@ module SiSU_Texinfo_format
@@tex_pattern_margin_number="\\\\marginpar.+?\s+"
def initialize(md,dob=nil)
@md,@dob=md,dob
- if dob.class==Hash
+ if dob.is_a?(Hash)
p dob.class
p caller
- elsif dob.class==String
+ elsif dob.is_a?(String)
p dob.class
p caller
end
- @vz=SiSU_Env::Get_init.instance.skin
+ @vz=SiSU_Viz::Defaults.new
end
def head
t=Time.now
year=t.year
filename=%{#{@md.fns}}[/(.+?)\.\w\w\d\d$/,1]
title=spec_char(@md.title.full)
- title=title.gsub(/<(br|p|i)>|<\/\s*(br|p|i)>|<(br|p)\s*\/>/," #{Tex[:backslash]*2} ")
- title.gsub!(/\$/,"\\$")
- title.gsub!(/[,]\s*/,' - ')
+ title=title.gsub(/<(br|p|i)>|<\/\s*(br|p|i)>|<(br|p)\s*\/>/," #{Tex[:backslash]*2} ").
+ gsub(/\$/,"\\$").
+ gsub(/[,]\s*/,' - ')
if @md.title.sub
subtitle=spec_char(@md.title.sub)
- subtitle=subtitle.gsub(/<(br|p|i)>|<\/\s*(br|p|i)>|<(br|p)\s*\/>/," #{Tex[:backslash]*2} ")
- subtitle.gsub!(/\$/,"\\$")
- subtitle.gsub!(/[,]\s*/,' - ')
+ subtitle=subtitle.gsub(/<(br|p|i)>|<\/\s*(br|p|i)>|<(br|p)\s*\/>/," #{Tex[:backslash]*2} ").
+ gsub(/\$/,"\\$").
+ gsub(/[,]\s*/,' - ')
subtitle="@subtitle @value{VERSION}, @value{UPDATED}\n" #bugwatch
end
subtitle ||=''
author=@md.author if @md.author
author ||=''
- author.gsub!(/[\*]/,'') #if author
- v=SiSU_Env::Info_version.instance.get_version
+ author=author.gsub(/[\*]/,'') #if author
+ v=SiSU_Env::InfoVersion.instance.get_version
head =<<WOK
\\input texinfo @c -*-texinfo-*-
-@comment $Id$
@comment %**start of header
@setfilename #{@md.fnb}.info
@settitle #{title} @value{VERSION}
@@ -151,9 +149,9 @@ WOK
end
def topnode(txt)
txt=spec_char(txt)
- txt=txt.gsub(/<(br|p|i)>|<\/\s*(br|p|i)>|<(br|p)\s*\/>/," #{Tex[:backslash]*2} ")
- txt.gsub!(/\$/,"\\$")
- txt.gsub!(/[,]\s*/,' - ')
+ txt=txt.gsub(/<(br|p|i)>|<\/\s*(br|p|i)>|<(br|p)\s*\/>/," #{Tex[:backslash]*2} ").
+ gsub(/\$/,"\\$").
+ gsub(/[,]\s*/,' - ')
"@c %% 4\n" +
"@ifnottex\n" +
"@node Top\n" +
@@ -173,14 +171,6 @@ WOK
and @md.creator.author=~/\S+/
author=spec_char(@md.creator.author)
end
- if defined? @md.classify.subject \
- and @md.classify.subject=~/\S+/
- subject=spec_char(@md.classify.subject)
- end
- if defined? @md.notes.description \
- and @md.notes.description=~/\S+/
- description=spec_char(@md.description)
- end
if defined? @md.publisher \
and @md.publisher=~/\S+/
publisher=spec_char(@md.publisher)
@@ -213,15 +203,31 @@ WOK
and @md.date.modified=~/\S+/
date_modified=spec_char(@md.date.modified)
end
- type=spec_char(@md.type) if @md.type #dc
- if defined? @md.classify.format \
- and @md.classify.format=~/\S+/
- format=spec_char(@md.classify.format)
+ if defined? @md.classify.subject \
+ and @md.classify.subject=~/\S+/
+ subject=spec_char(@md.classify.subject)
+ end
+ if defined? @md.notes.description \
+ and @md.notes.description=~/\S+/
+ description=spec_char(@md.description)
end
- if defined? @md.classify.identifier \
- and @md.classify.identifier=~/\S+/
- identifier=spec_char(@md.classify.identifier)
+ if defined? @md.notes.coverage \
+ and @md.notes.coverage=~/\S+/
+ coverage=spec_char(@md.notes.coverage)
end
+ if defined? @md.notes.relation \
+ and @md.notes.relation=~/\S+/
+ relation=spec_char(@md.notes.relation)
+ end
+ #type=spec_char(@md.type) if @md.type #dc
+ if defined? @md.notes.format \
+ and @md.notes.format=~/\S+/
+ format=spec_char(@md.notes.format)
+ end
+ #if defined? @md.identifier.sisupod \
+ #and @md.identifier.sisupod=~/\S+/
+ # identifier=spec_char(@md.identifier.sisupod)
+ #end
if defined? @md.original.source \
and @md.original.source=~/\S+/
source=spec_char(@md.original.source)
@@ -230,14 +236,6 @@ WOK
and @md.title.language=~/\S+/
language=spec_char(@md.title.language)
end
- if defined? @md.classify.relation \
- and @md.classify.relation=~/\S+/
- relation=spec_char(@md.classify.relation)
- end
- if defined? @md.classify.coverage \
- and @md.classify.coverage=~/\S+/
- coverage=spec_char(@md.classify.coverage)
- end
if defined? @md.rights.all \
and @md.rights.all=~/\S+/
rights=spec_char(@md.rights.all)
@@ -262,165 +260,154 @@ WOK
relation="Relation: #{relation}\n\n" if relation #dc
coverage="Coverage: #{coverage}\n\n" if coverage #dc
rights="Rights: #{rights}\n\n" if rights #dc
- "@node Dublin Core\n" +
- "@unnumbered Dublin Core\n" +
- "@cindex chapter, Dublin Core\n\n" +
- "#{full_title}" +
- "#{author}" +
- "#{subject}" +
- "#{description}" +
- "#{publisher}" +
- "#{contributor}" +
- "#{date}" +
- "#{date_created}" +
- "#{date_issued}" +
- "#{date_available}" +
- "#{date_valid}" +
- "#{date_modified}" +
- "#{format}" +
- "#{identifier}" +
- "#{source}" +
- "#{language}" +
- "#{relation}" +
- "#{coverage}" +
- "#{rights}" +
- "\n\n"
+ <<WOK
+@node Dublin Core
+@unnumbered Dublin Core
+@cindex chapter, Dublin Core
+
+#{full_title}#{author}#{subject}#{description}#{publisher}#{contributor}#{date}#{date_created}#{date_issued}#{date_available}#{date_valid}#{date_modified}#{format}#{identifier}#{source}#{language}#{relation}#{coverage}#{rights}
+
+WOK
end
def tail
- "@c %% 6\n" +
- "@node Index\n" +
- "@unnumbered Index\n" +
- "@printindex cp\n\n" +
- "@bye"
+ <<WOK
+@c %% 6
+@node Index
+@unnumbered Index
+@printindex cp
+
+@bye
+WOK
end
def clean(dob)
- if dob.is=='heading' \
+ if dob.is==:heading \
and dob.obj !~/##{dob.ocn}/
dob.obj="#{dob.obj} ##{dob.ocn}"
end
- dob.obj.gsub!(/<:#>/,'')
- dob.obj.strip!
+ dob.obj=dob.obj.gsub(/\n/m,' ').
+ gsub(/<:#>/,'').
+ gsub(/,\s+/,' - ').
+ strip
dob
end
def menu
dob=clean(@dob)
m=dob.obj
- m.gsub!(/[:,]\s*/,' - ')
- m.gsub!(/@footnote\{.+?\}\s+/,'')
+ m=m.gsub(/[:,]\s*/,' - ').
+ gsub(/@footnote\{.+?\}\s+/,'')
m="* #{m}::"
end
def level1
dob=clean(@dob)
nd=dob.obj.gsub(/@footnote\{.+?\}\s+/,'')
- dob.obj="@node #{nd}\n@unnumbered #{dob.obj}\n@cindex chapter, #{nd}\n"
+ dob.obj="@node #{nd}\n@unnumbered #{nd}\n@cindex chapter, #{nd}\n"
dob
end
def level2
dob=clean(@dob)
nd=dob.obj.gsub(/@footnote\{.+?\}\s+/,'')
- dob.obj="@node #{nd}\n@unnumbered #{dob.obj}\n@cindex chapter, #{nd}\n"
+ dob.obj="@node #{nd}\n@unnumbered #{nd}\n@cindex chapter, #{nd}\n"
dob
end
def level3
dob=clean(@dob)
nd=dob.obj.gsub(/@footnote\{.+?\}\s+/,'')
- dob.obj="@node #{nd}\n@unnumbered #{dob.obj}\n@cindex chapter, #{nd}\n"
+ dob.obj="@node #{nd}\n@unnumbered #{nd}\n@cindex chapter, #{nd}\n"
dob
end
def level4
dob=clean(@dob)
nd=dob.obj.gsub(/@footnote\{.+?\}\s+/,'')
- dob.obj="@node #{nd}\n@unnumbered #{dob.obj}\n@cindex chapter, #{nd}\n"
+ dob.obj="@node #{nd}\n@unnumbered #{nd}\n@cindex chapter, #{nd}\n"
dob
end
def level5
dob=clean(@dob)
nd=dob.obj.gsub(/@footnote\{.+?\}\s+/,'')
- dob.obj="@node #{nd}\n@unnumbered #{dob.obj}\n@cindex chapter, #{nd}\n"
+ dob.obj="@node #{nd}\n@unnumbered #{nd}\n@cindex chapter, #{nd}\n"
dob
end
def level6
dob=clean(@dob)
nd=dob.obj.gsub(/@footnote\{.+?\}\s+/,'')
- dob.obj="@node #{nd}\n@unnumbered #{dob.obj}\n@cindex chapter, #{nd}\n"
+ dob.obj="@node #{nd}\n@unnumbered #{nd}\n@cindex chapter, #{nd}\n"
dob
end
def submenu
@dob.obj=@dob.obj.join("\n")
- @dob.obj.gsub!(/[5]\\+~\S+/,'')
+ @dob.obj=@dob.obj.gsub(/[5]\\+~\S+/,'')
dob=clean(@dob)
- dob.obj="@menu\n#{dob.obj}\n@end menu\n\n"
- dob.obj.gsub!(/.+/m,"#{dob.obj}")
+ dob.obj="@menu\n#{dob.obj}\n@end menu\n\n".
+ gsub(/.+/m,"#{dob.obj}")
end
def subsubmenu
@dob.obj=@dob.obj.join("\n")
- @dob.obj.gsub!(/[6]\\+~\S+/,'')
+ @dob.obj=@dob.obj.gsub(/[6]\\+~\S+/,'')
dob=clean(@dob)
- dob.obj="@menu\n#{dob.obj}\n@end menu\n\n"
- dob.obj.gsub!(/.+/m,"#{dob.obj}")
+ dob.obj="@menu\n#{dob.obj}\n@end menu\n\n".
+ gsub(/.+/m,"#{dob.obj}")
end
def indent1
- @dob.obj.gsub!(/<:i1>(.*)/,'\1')
+ @dob.obj=@dob.obj.gsub(/<:i1>(.*)/,'\1')
end
def indent2
- @dob.obj.gsub!(/<:i2>(.*)/,'\1')
+ @dob.obj=@dob.obj.gsub(/<:i2>(.*)/,'\1')
end
def spec_char(txt) # special characters
- txt.gsub!(/#{Mx[:br_eof]}/i,'')
- txt.gsub!(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'(c)')
- txt.gsub!(/#{Mx[:gl_o]}#(?:lt|060)#{Mx[:gl_c]}/,'<'); txt.gsub!(/#{Mx[:gl_o]}(gt|#062)#{Mx[:gl_c]}/,'>')
- txt.gsub!(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{'); txt.gsub!(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}')
- txt.gsub!(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/i,'~')
- txt.gsub!(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!')
- txt.gsub!(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#')
- txt.gsub!(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*')
- txt.gsub!(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/')
- txt.gsub!(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_')
- txt.gsub!(/#{Mx[:br_nl]}+/,"\n")
- txt.gsub!(/<sup><font face=symbol>&atild;<\/font><\/sup>/,' ')
- #txt.gsub!(/\\/,'\\backslash ')
- txt.gsub!(/<:pb>/,'\\newpage')
- txt.gsub!(/\\backslash copyright/,'\\copyright ')
- txt.gsub!(/\^/,'\\wedge ')
- txt.gsub!(/(\$)/,"\\$")
- txt.gsub!(/\~/,'\\~')
- txt.gsub!(/#{Mx[:url_o]}(https?:\S+?)#{Mx[:url_c]}/,'<\1>')
- txt.gsub!(/#{Mx[:url_o]}_(https?:\S+?)#{Mx[:url_c]}/,'\1')
- txt.gsub!(/§/i,'\S')
- txt.gsub!(/£/i,'\pounds')
- txt.gsub!(/å/,'\aa'); txt.gsub!(/Å/,'\AA')
- txt.gsub!(/æ/,'\ae'); txt.gsub!(/Æ/,'\AE')
- txt.gsub!(/ø/,'\o'); txt.gsub!(/Ø/,'\O')
- txt.gsub!(/<a href=".+?">/i,' ')
- txt.gsub!(/<\/a>/i,' ')
- txt.gsub!(/<:ee>/i,'')
- txt.gsub!(/<!>/i,' ')
- txt.gsub!(/#{Mx[:br_paragrph]}/i,'') #watch
- txt.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'*\1*')
- txt.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'/\1/')
- txt.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'_\1_')
- txt.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'[\1]')
- txt.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'^\1^')
- txt.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'+\1+')
- txt.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'"\1"')
- txt.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'-\1-')
- txt.gsub!(/@/i,'@@')
- txt.gsub!(/\{/,'@{'); txt.gsub!(/\}/,'@}')
- txt.gsub!(/(?:&nbsp;|#{Mx[:nbsp]})+/,' ') # ~ character for hardspace
- txt.gsub!(/&(\S+?);/,' ')
- txt.gsub!(/&/,'<=and>')
- txt.gsub!(/(\s+&\s+)/,' and ')
- txt.gsub!(/(\&)/,"\\&")
- txt.gsub!(/"(.+?)"/,"`\\1'") # open & close "
- txt.gsub!(/\s+"/," `") # open "
- txt.gsub!(/^([1-6-]\\+(?:~\S+)?|<.+?>)?\s*"/,'\1`') # open "
- txt.gsub!(/"(\s|\.|,|:|;)/,"'\\1") # close "
- txt.gsub!(/"([1-6-]\\+(?:~\S+)?|<.+?>)?\s*$/,"'\\1") # close "
- txt.gsub!(/"(\.|,)/,"'") # close "
- txt.gsub!(/\s+'/," `") # open '
- txt.gsub!(/^([1-6-]\\+(?:~\S+)?|<.+?>)?\s*'/,'\1`') # open '
- txt.gsub!(/(<font.*?>|<\/font>)/,'')
- txt
+ txt=txt.gsub(/#{Mx[:br_eof]}/i,'').
+ gsub(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'(c)').
+ gsub(/#{Mx[:gl_o]}#(?:lt|060)#{Mx[:gl_c]}/,'<').gsub(/#{Mx[:gl_o]}(gt|#062)#{Mx[:gl_c]}/,'>').
+ gsub(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{').gsub(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}').
+ gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/i,'~').
+ gsub(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!').
+ gsub(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#').
+ gsub(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*').
+ gsub(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/').
+ gsub(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_').
+ gsub(/#{Mx[:gl_o]}#092#{Mx[:gl_c]}/,'\\').
+ gsub(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*/,"\n\n"). # watch
+ gsub(/<sup><font face=symbol>&atild;<\/font><\/sup>/,' ').
+ #gsub(/\\/,'\\backslash ').
+ gsub(/<:pb>/,'\\newpage').
+ gsub(/\\backslash copyright/,'\\copyright ').
+ gsub(/\^/,'\\wedge ').
+ gsub(/(\$)/,"\\$").
+ gsub(/\~/,'\\~').
+ gsub(/#{Mx[:url_o]}(https?:\S+?)#{Mx[:url_c]}/,'<\1>').
+ gsub(/#{Mx[:url_o]}_(https?:\S+?)#{Mx[:url_c]}/,'\1').
+ gsub(/§/i,'\S').
+ gsub(/£/i,'\pounds').
+ gsub(/å/,'\aa').gsub(/Å/,'\AA').
+ gsub(/æ/,'\ae').gsub(/Æ/,'\AE').
+ gsub(/ø/,'\o').gsub(/Ø/,'\O').
+ gsub(/<a href=".+?">/i,' ').
+ gsub(/<\/a>/i,' ').
+ gsub(/<!>/i,' ').
+ gsub(/#{Mx[:br_paragrph]}/i,''). #watch
+ gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'*\1*').
+ gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'/\1/').
+ gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'_\1_').
+ gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'[\1]').
+ gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'^\1^').
+ gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'+\1+').
+ gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'"\1"').
+ gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'-\1-').
+ gsub(/@/i,'@@').
+ gsub(/\{/,'@{').gsub(/\}/,'@}').
+ gsub(/(?:&nbsp;|#{Mx[:nbsp]})+/,' '). # ~ character for hardspace
+ gsub(/&(\S+?);/,' ').
+ gsub(/&/,'<=and>').
+ gsub(/(\s+&\s+)/,' and ').
+ gsub(/(\&)/,"\\&").
+ gsub(/"(.+?)"/,"`\\1'"). # open & close "
+ gsub(/\s+"/," `"). # open "
+ gsub(/^([1-6-]\\+(?:~\S+)?|<.+?>)?\s*"/,'\1`'). # open "
+ gsub(/"(\s|\.|,|:|;)/,"'\\1"). # close "
+ gsub(/"([1-6-]\\+(?:~\S+)?|<.+?>)?\s*$/,"'\\1"). # close "
+ gsub(/"(\.|,)/,"'"). # close "
+ gsub(/\s+'/," `"). # open '
+ gsub(/^([1-6-]\\+(?:~\S+)?|<.+?>)?\s*'/,'\1`'). # open '
+ gsub(/(<font.*?>|<\/font>)/,'')
end
def longtable
@end_table="\\end{longtable}"
@@ -440,28 +427,28 @@ WOK
@colW=@colW.join
@@start_table="\\setlength{\\LTleft}{0pt}\n\\setlength{\\LTright}{\\fill}\n" +
"\\begin{longtable}[hb]#{@colW}\n"
- @dob.obj.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:gr_c]}/u,"#{@@start_table}") #fix
+ @dob.obj=@dob.obj.gsub(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:gr_c]}/u,"#{@@start_table}") #fix
end
if @dob =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ #fix
- @dob.obj.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/," #{@end_table}") #fix
+ @dob.obj=@dob.obj.gsub(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/," #{@end_table}") #fix
end
- @dob.obj.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}/u,'')
+ @dob.obj=@dob.obj.gsub(/#{Mx[:tc_o]}#{Mx[:tc_p]}/u,'')
if @@tableheader==1
if @dob =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u
tablefoot=para[/\<!f(.+?)!\>/,1]
- @dob.obj.gsub!(/\<!f(.+?)!\>/,'')
- @dob.obj.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u,
- "{\\begin{tiny} {\\bfseries \\1}\\end{tiny}}&")
- @dob.obj.gsub!(/&>\s*$/,
- " #{@row_break} \\hline\\endhead #{@row_break}")
+ @dob.obj=@dob.obj.gsub(/\<!f(.+?)!\>/,'').
+ gsub(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u,
+ "{\\begin{tiny} {\\bfseries \\1}\\end{tiny}}&").
+ gsub(/&>\s*$/,
+ " #{@row_break} \\hline\\endhead #{@row_break}")
@dob="#{@dob} \\multicolumn{#{@@number_of_cols}}{l}{\\tiny #{tablefoot}} \\\\ \\hline\n\\endfoot\n\\hline\n" if tablefoot
@@tableheader=0
@@number_of_cols=0
end
else
if @dob =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u
- @dob.obj.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u,"\\begin{tiny}\\1\\end{tiny}&")
- @dob.obj.gsub!(/&>\s*$/," #{@row_break}")
+ @dob.obj=@dob.obj.gsub(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u,"\\begin{tiny}\\1\\end{tiny}&").
+ gsub(/&>\s*$/," #{@row_break}")
end
end
@dob
@@ -482,10 +469,10 @@ WOK
@colW << "p{#{col_w}cm}" if col_w
end
@@start_table="\\begin{tabular}{#{@colW}}\n"
- @dob.obj.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:gr_c]}/u,"#{@@start_table}") #fix
+ @dob.obj=@dob.obj.gsub(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:gr_c]}/u,"#{@@start_table}") #fix
end
if @dob =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ #fix
- @dob.obj.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/,"#{@end_table}") #fix
+ @dob.obj=@dob.obj.gsub(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/,"#{@end_table}") #fix
@@table_pg_break_counter=1
end
if @dob =~/#{Mx[:tc_o]}#{Mx[:tc_p]}/u
@@ -496,39 +483,39 @@ WOK
"#{@@start_table}\n"
@@table_pg_break_counter=1
else
- @dob.obj.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}/u,'')
+ @dob.obj=@dob.obj.gsub(/#{Mx[:tc_o]}#{Mx[:tc_p]}/u,'')
@@table_pg_break_counter+=1
tablefoot=@dob[/\<!f(.+?)!\>/]
- @dob.obj.gsub!(/\<!f(.+?)!\>/,'')
+ @dob.obj=@dob.obj.gsub(/\<!f(.+?)!\>/,'')
end
end
if @dob =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u
- @dob.obj.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u,"\\begin{tiny}\\1\\end{tiny}&")
- @dob.obj.gsub!(/&>\s*$/,"#{@row_break}")
+ @dob.obj=@dob.obj.gsub(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u,"\\begin{tiny}\\1\\end{tiny}&").
+ gsub(/&>\s*$/,"#{@row_break}")
end
@dob
end
def graphics
- dir=SiSU_Env::Info_env.new(@md.fns)
- @dob.obj.gsub!(/<::\s+(\S+?)\s+>/i, #watch
- "\\includegraphics*[width=11pt]{#{dir.path.image_source_tex}/c_\\1.png}")
+ dir=SiSU_Env::InfoEnv.new(@md.fns)
+ @dob.obj=@dob.obj.gsub(/<::\s+(\S+?)\s+>/i, #watch
+ "\\includegraphics*[width=11pt]{#{dir.path.image_source_include}/c_\\1.png}")
end
def image
- dir=SiSU_Env::Info_env.new(@md.fns)
+ dir=SiSU_Env::InfoEnv.new(@md.fns)
width="100"
width=@dob[/<:image.+?width=``(\d+)''.+?>/im,1]
width=width.to_i*0.4
- @dob.obj.gsub!(/<:image\s+((?:https?|file|ftp)\S+)\s+(\S+)\s+.+\s+?>/i,
- "\\href{\\1}{\\includegraphics*[width=#{width}pt]{#{dir.path.image_source_tex}/\\2}}")
- @dob.obj.gsub!(/<:image\s+(\S+)\s+.+\s+?>/i,
- "\\includegraphics*[width=#{width}pt]{#{dir.path.image_source_tex}/\\1}")
+ @dob.obj=@dob.obj.gsub(/<:image\s+((?:https?|file|ftp)\S+)\s+(\S+)\s+.+\s+?>/i,
+ "\\href{\\1}{\\includegraphics*[width=#{width}pt]{#{dir.path.image_source_include}/\\2}}").
+ gsub(/<:image\s+(\S+)\s+.+\s+?>/i,
+ "\\includegraphics*[width=#{width}pt]{#{dir.path.image_source_include}/\\1}")
end
def png
# very messy clean up ! - work area, testing
z=@dob[/\\\{(.+?)\}(?:image|png)/,1] # match operator for z \\ fragile !
image,w,x,y=z.scan(/\S+/)
- image.gsub!(/\\/,'')
- @dob.obj.gsub!(/\\\{\S+\.(png|jpg|gif).+?\}(image|png)/,"<image #{image} not available>") # fragile match operator\\ fragile !
+ image=image.gsub(/\\/,'')
+ @dob.obj=@dob.obj.gsub(/\\\{\S+\.(png|jpg|gif).+?\}(image|png)/,"<image #{image} not available>") # fragile match operator\\ fragile !
end
def http
# very messy clean up ! - work area, testing
@@ -536,7 +523,7 @@ WOK
url=@dob[/((?:https?|file|ftp):\S+)/im,1]
if @dob =~/\.(png|jpg|gif)/
image,w,x,y=z.scan(/\S+/)
- image.gsub!(/\\/,'')
+ image=image.gsub(/\\/,'')
width=200
width=z[/w=(\d+)/im,1] if z =~/w=(\d+)/
width=width.to_i*0.8
@@ -545,41 +532,39 @@ WOK
caption="{\\\\\\\ \n\\begin{scriptsize}#{c}\\end{scriptsize}&}" if c
end
if image
- dir=SiSU_Env::Info_env.new(@md.fns)
- @dob.obj.gsub!(/#{Mx[:lnk_o]}\S+\.(png|jpg|gif).+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/, # fragile match operator\\ fragile !
- "\n\\href{#{url}}{\\includegraphics*[width=#{width}pt]{#{dir.path.image_source_tex}/#{image}}}#{caption}")
+ dir=SiSU_Env::InfoEnv.new(@md.fns)
+ @dob.obj=@dob.obj.gsub(/#{Mx[:lnk_o]}\S+\.(png|jpg|gif).+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/, # fragile match operator\\ fragile !
+ "\n\\href{#{url}}{\\includegraphics*[width=#{width}pt]{#{dir.path.image_source_include}/#{image}}}#{caption}")
else
link=z[/(.+?)\\/im,1]
- @dob.obj.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+#{Mx[:url_c]}/,"\n\\noindent\\href{#{url}}{#{link}}") # fragile match operator\\ fragile !
+ @dob.obj=@dob.obj.gsub(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+#{Mx[:url_c]}/,"\n\\noindent\\href{#{url}}{#{link}}") # fragile match operator\\ fragile !
end
end
end
- class Texinfo_txt
+ class TeXinfoTxt
def initialize(md,dob,txt)
@md,@dob,@txt=md,dob,txt
end
def clean(dob,txt)
- if dob.is=='heading' \
+ if dob.is==:heading \
and txt !~/##{dob.ocn}/
txt="#{dob.obj} ##{dob.ocn}"
end
- txt.gsub!(/<:#>/,'')
- txt.strip!
- txt
+ txt=txt.gsub(/<:#>/,'').strip
end
def submenu
txt=@txt.join("\n")
- txt.gsub!(/[5]\\+~\S+/,'')
+ txt=txt.gsub(/[5]\\+~\S+/,'')
txt=clean(@dob,txt)
txt="@menu\n#{txt}\n@end menu\n\n"
- txt.gsub!(/.+/m,"#{txt}")
+ txt=txt.gsub(/.+/m,"#{txt}")
end
def subsubmenu
txt=@txt.join("\n")
- txt.gsub!(/[6]\\+~\S+/,'')
+ txt=txt.gsub(/[6]\\+~\S+/,'')
txt=clean(@dob,txt)
txt="@menu\n#{dob.obj}\n@end menu\n\n"
- txt.gsub!(/.+/m,"#{txt}")
+ txt=txt.gsub(/.+/m,"#{txt}")
end
end
end
diff --git a/lib/sisu/v4/texpdf.rb b/lib/sisu/v4/texpdf.rb
new file mode 100644
index 00000000..f5c90cf5
--- /dev/null
+++ b/lib/sisu/v4/texpdf.rb
@@ -0,0 +1,992 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: LaTeX generation
+
+=end
+module SiSU_TeX
+ require 'pstore'
+ require_relative 'defaults' # defaults.rb
+ include SiSU_Viz
+ require_relative 'particulars' # particulars.rb
+ include SiSU_Particulars
+ require_relative 'texpdf_format' # texpdf_format.rb
+ include SiSU_TeX_Pdf
+ require_relative 'shared_metadata' # shared_metadata.rb
+ require_relative 'prog_text_translation' # prog_text_translation.rb
+ @tex_file=@@tex_footnote_array=@@tex_col_w=[]
+ @@tabular="{tabular}"
+ @@column_instruct=@@squigle_close=@@tex_line_mode=@@tex_word_mode=@@line_mode=''
+ @@tex_debug_counter=@@table_pagebreak_counter=@@tex_footnote_call_counter=@@tex_table_flag=@@tex_counter=@@tex_column=@@tex_columns=@@tex_columns=@@counting=0
+ @@tex_pattern_margin_number=/\\\\begin\\\{tiny\\\}\\\\hspace\\\{0mm\\\}\\\\end\\\{tiny\\\}\\\{\\\\marginpar.+?\s+/
+ @@n=@@tableheader=@@rights=nil
+ @@date ||=SiSU_Env::InfoDate.new
+ class Source
+ require 'pstore'
+ require_relative 'sysenv' # sysenv.rb
+ include SiSU_Env
+ include SiSU_Viz
+ require_relative 'dal' # dal.rb
+ include SiSU_DAL
+ include SiSU_TeX
+ def initialize(opt)
+ @opt=opt
+ @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)
+ @md=@particulars.md
+ @env=SiSU_Env::InfoEnv.new(@md.fns) #@env=@particulars.env
+ end
+ def directories
+ begin
+ case @opt.fns
+ when /\.(?:-|ssm\.)?sst$/
+ SiSU_Env::FileOp.new(@md).mkdir
+ Dir.mkdir(@env.processing_path.tex) unless FileTest.directory?(@env.processing_path.tex)
+ end
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ end
+ end
+ def read
+ song
+ end
+ def song
+ begin
+ @md=@particulars.md
+ SiSU_Screen::Ansi.new(@opt.cmd,'LaTeX/PDF',"[#{@opt.f_pth[:lng_is]}] #{@opt.fno}").green_title_hi unless @opt.cmd =~/q/
+ if @opt.cmd =~/[MVv]/
+ path=@env.url.output_tell
+ SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.program.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_l}pdf").flow
+ SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@opt.fns} #{@env.program.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_p}pdf").flow
+ end
+ @md=@particulars.md
+ $flag=@md.opt.cmd #introduced to pass 0 for no object citation numbers... to texpdf_format
+ directories
+ #% needed needs to be reprogrammed !!!
+ dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here
+ SiSU_TeX::Source::LaTeXcreate.new(@particulars).songsheet
+ dal_array=''
+ pwd=Dir.pwd
+ SiSU_TeX::Source::LaTeXtoPdf.new(@md,@particulars.env).latexrun_selective
+ Dir.chdir(pwd)
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ unless @opt.cmd =~/[MV]/ #check maintenance flag
+ texfiles=Dir["#{@env.processing_path.tex}/#{@opt.fns}*"]
+ texfiles.each do |f|
+ if FileTest.file?(f)
+ File.unlink(f)
+ end
+ end
+ end
+ @tex_file=@@tex_footnote_array=[]
+ @@column_instruct=''
+ @@squigle_close=@@tex_line_mode=@@tex_word_mode=@@line_mode=''
+ @@tex_debug_counter=@@table_pagebreak_counter=@@tex_footnote_call_counter=@@tex_table_flag=@@tex_counter=@@tex_column=@@tex_columns=@@tex_columns=@@counting=0
+ @@tex_col_w=[]
+ @@n=@@tableheader=@@rights=nil
+ @@date=SiSU_Env::InfoDate.new
+ @@flag={}
+ $flag=1 #remove at some stage
+ SiSU_Env::Clear.new(@opt.cmd,@opt.fns).param_instantiate
+ end
+ end
+ private
+ class LaTeXtoPdf
+ @@n_lpdf||=0 #change
+ def initialize(md,env)
+ @md,@env=md,env
+ @f=SiSU_Env::FileOp.new(@md).base_filename
+ end
+ def latex_do(texfilename,papersize)
+ @texfilename=texfilename
+ @@n_lpdf=@@n_lpdf+1
+ SiSU_Screen::Ansi.new(@md.opt.cmd,"#{papersize} portrait ->").dark_grey_title_hi if @md.opt.cmd =~/[MVv]/
+ tex_fn_base=@texfilename.gsub(/\.tex$/,'')
+ cmd=SiSU_Env::SystemCall.new("#{tex_fn_base}.tex",'',@md.opt.cmd)
+ tell=SiSU_Screen::Ansi.new(@md.opt.cmd)
+ tell.grey_open if @md.opt.cmd =~/[MVv]/
+ if "#{tex_fn_base}" =~/\w+/ \
+ and "#{papersize}" =~/\w+/
+ 2.times { |i| cmd.latex2pdf(@md,papersize) } #comment out to skip processing of latex portrait
+ end
+ tell.p_off if @md.opt.cmd =~/[MVv]/
+ SiSU_Screen::Ansi.new(@md.opt.cmd,"#{papersize} landscape ->").dark_grey_title_hi if @md.opt.cmd =~/[MVv]/
+ cmd=SiSU_Env::SystemCall.new("#{tex_fn_base}.landscape.tex",'',@md.opt.cmd)
+ tell.grey_open if @md.opt.cmd =~/[MVv]/
+ if "#{tex_fn_base}" =~/\w+/ \
+ and "#{papersize}" =~/\w+/
+ 2.times { |i| cmd.latex2pdf(@md,papersize) } #comment out to skip processing of latex landscape
+ end
+ tell.p_off if @md.opt.cmd =~/[MVv]/
+ pwd=Dir.pwd
+ portrait_pdf="#{pwd}/#{tex_fn_base}.pdf"
+ landscape_pdf="#{pwd}/#{tex_fn_base}.landscape.pdf"
+ case papersize
+ when /a4/; pdf_p=@f.pdf_p_a4; pdf_l=@f.pdf_l_a4
+ when /a5/; pdf_p=@f.pdf_p_a5; pdf_l=@f.pdf_l_a5
+ when /b5/; pdf_p=@f.pdf_p_b5; pdf_l=@f.pdf_l_b5
+ when /letter/; pdf_p=@f.pdf_p_letter; pdf_l=@f.pdf_l_letter
+ when /legal/; pdf_p=@f.pdf_p_legal; pdf_l=@f.pdf_l_legal
+ else pdf_p=@f.pdf_p_a4; pdf_l=@f.pdf_l_a4
+ end
+ FileUtils::mkdir_p(@md.file.output_path.pdf.dir) unless FileTest.directory?(@md.file.output_path.pdf.dir)
+ if FileTest.file?(portrait_pdf)
+ FileUtils::cp(portrait_pdf,"#{@md.file.output_path.pdf.dir}/#{pdf_p}")
+ FileUtils::rm(portrait_pdf)
+ else p "#{__FILE__}:#{__LINE__} NOT FOUND: #{portrait_pdf}" if @md.opt.cmd.inspect =~/M/
+ end
+ if FileTest.file?(landscape_pdf)
+ FileUtils::cp(landscape_pdf,"#{@md.file.output_path.pdf.dir}/#{pdf_l}")
+ FileUtils::rm(landscape_pdf)
+ else p "#{__FILE__}:#{__LINE__} NOT FOUND: #{landscape_pdf}" if @md.opt.cmd.inspect =~/M/
+ end
+ SiSU_Screen::Ansi.new(@md.opt.cmd,@@n_lpdf,'processed (SiSU LaTeX to pdf - using pdfetex aka. pdftex or pdflatex)').generic_number if @md.opt.cmd =~/[MVv]/
+ end
+ def latexrun_selective
+ begin
+ pwd=Dir.pwd
+ Dir.chdir(pwd) #watch
+ @tex_f_no=0
+ info={}
+ if FileTest.file?(@env.source_file_with_path)
+ @md.papersize_array.each do |ps|
+ if @md.fns =~/\.(?:-|ssm\.)?sst$/
+ case @md.fns
+ when /\.(?:-|ssm\.)?sst$/
+ if FileTest.directory?(@env.processing_path.tex)==true
+ Dir.chdir(@env.processing_path.tex)
+ texfile=@md.fns.gsub(/$/,".#{ps}.tex").
+ gsub(/~/,'-')
+ if File.exist?(texfile) \
+ and File.size(texfile) > 0
+ @tex_f_no+=1
+ #p "#{__FILE__}:#{__LINE__} texpdf generation disabled" if @md.opt.cmd.inspect =~/M/ #%% disable temporarily, re-enable
+ latex_do(texfile,ps)
+ else
+ puts "\tzero file size #{@env.processing_path.tex}/#{texfile}"
+ end
+ end
+ end
+ end
+ end
+ case @md.papersize_array[0] #default pdf
+ when /a4/; pdf_p=@f.pdf_p_a4; pdf_l=@f.pdf_l_a4
+ when /a5/; pdf_p=@f.pdf_p_a5; pdf_l=@f.pdf_l_a5
+ when /b5/; pdf_p=@f.pdf_p_b5; pdf_l=@f.pdf_l_b5
+ when /letter/; pdf_p=@f.pdf_p_letter; pdf_l=@f.pdf_l_letter
+ when /legal/; pdf_p=@f.pdf_p_legal; pdf_l=@f.pdf_l_legal
+ else pdf_p=@f.pdf_p_a4; pdf_l=@f.pdf_l_a4
+ end
+ if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{pdf_p}")
+ mklnk=if @md.file.output_dir_structure.by_language_code? \
+ or @md.file.output_dir_structure.by_filetype?
+ "#{@md.fnb}.portrait.pdf"
+ else 'portrait.pdf'
+ end
+ if FileTest.directory?(@md.file.output_path.pdf.dir)
+ pwd=Dir.pwd
+ Dir.chdir(@md.file.output_path.pdf.dir)
+ FileUtils::rm_f(mklnk)
+ FileUtils::ln_s(pdf_p, mklnk)
+ Dir.chdir(pwd)
+ end
+ end
+ if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{pdf_l}")
+ mklnk=if @md.file.output_dir_structure.by_language_code? \
+ or @md.file.output_dir_structure.by_filetype?
+ "#{@md.fnb}.landscape.pdf"
+ else 'landscape.pdf'
+ end
+ pwd_set=Dir.pwd
+ Dir.chdir(@md.file.output_path.pdf.dir)
+ FileUtils::rm_f(mklnk)
+ FileUtils::ln_s(pdf_l, mklnk)
+ Dir.chdir(pwd_set)
+ end
+ else
+ SiSU_Screen::Ansi.new(@md.opt.cmd,"*WARN* FILE NOT FOUND: << #{@md.fns} >> - requested latex system processing skipped").warn
+ end
+ lst=Dir["*.{aux,log,out}"]
+ lst.each {|file| File.unlink(file)} if lst
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ end
+ end
+ end
+ class LaTeXcreate
+ @@tex_head={
+ 'a4'=> { p: nil, l: nil },
+ 'a5'=> { p: nil, l: nil },
+ 'b5'=> { p: nil, l: nil },
+ 'letter'=>{ p: nil, l: nil },
+ 'legal'=> { p: nil, l: nil },
+ 'book'=> { p: nil, l: nil }
+ }
+ @@prefix_b=nil
+ def initialize(particulars)
+ @particulars=particulars
+ @md=@particulars.md
+ @env=SiSU_Env::InfoEnv.new(@md.fns) #@env=@particulars.env
+ @data=@particulars.dal_array # dal file drawn here
+ @st={ tex: {} }
+ @tex_ml=SiSU_TeX_Pdf::UseTeX.new(@md)
+ @vz=SiSU_Viz::Defaults.new
+ @dp=@@dp ||=SiSU_Env::InfoEnv.new.digest.pattern
+ @brace_url=SiSU_Viz::Defaults.new.url_decoration
+ l=SiSU_Env::StandardiseLanguage.new(@md.opt.lng).language
+ @language=l[:n]
+ @translate=SiSU_Translate::Source.new(@md,@language)
+ @codeblock_box='listings' #alternative 'boites'
+ @make ||=SiSU_Env::ProcessingSettings.new(@md)
+ end
+ def songsheet
+ begin
+ data=@data
+ @@tex_footnote_array=[]
+ @@rights=nil
+ SiSU_Screen::Ansi.new(@md.opt.cmd,"pdfTex portrait & landscape").txt_grey if @md.opt.cmd=~/[MVvz]/
+ if defined? @md.rights.all \
+ and not @md.rights.all.empty?
+ rght=@md.rights #.author.dup #dup is necessary, else contents of :rights changed
+ sp_char=SiSU_TeX_Pdf::SpecialCharacters.new(@md,rght.copyright.all)
+ copymark=@md.author_copymark \
+ ? '{\begin{small}\copyright\end{small}} '
+ : ''
+ copymark='Copyright {\begin{small}\copyright\end{small}} '
+ copyright=sp_char.special_characters_safe.gsub(/^\s*Copyright \(C\)/, copymark)
+ @@rights||="\n #{Tex[:backslash]*2}[3]\\ \\linebreak #{copyright}"
+ end
+ if defined? @md.notes.prefix_b \
+ and not @md.notes.prefix_b.empty?
+ sp_char=SiSU_TeX_Pdf::SpecialCharacters.new(@md,@md.notes.prefix_b)
+ prefix_b=sp_char.special_characters_safe
+ @@prefix_b="\n #{Tex[:backslash]*2}[3]\\ \\linebreak \\ #{prefix_b}\n" unless @@prefix_b
+ end
+ data=pre(data)
+ data=footnote(data)
+ if @md.flag_tables #WORK ON 2009
+ data=tables(data) #uncomment to start experimenting with tables
+ end
+ data=number_paras(data)
+ data=markup(data)
+ output(data)
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ end
+ end
+ protected
+ def pre(data)
+ @tex_file=[]
+ data.each do |dob|
+ # DEBUG 2003w16 this is a kludge, because i could not get parameters
+ # from param, Sort out ... revert to more elegant solution
+ # even more of a kludge as had to insert newlines where code is used not satisfactory, think about
+ dob.tmp=dob.obj #.dup
+ if dob.is==:para \
+ || dob.is==:heading
+ dob.tmp=dob.tmp.gsub(/#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}/,'')
+ dob.tmp=SiSU_TeX_Pdf::SpecialCharacters.new(@md,dob.tmp).special_characters
+ if dob.tmp =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/
+ dob.tmp=SiSU_TeX_Pdf::FormatTextObject.new(@md,dob.tmp).url_str_internal(dob.tmp)
+ end
+ elsif dob.is ==:code
+ dob.tmp=if @codeblock_box=='listings'
+ dob.tmp
+ else
+ SiSU_TeX_Pdf::SpecialCharacters.new(@md,dob.tmp).special_characters_code
+ end
+ elsif dob.is ==:break
+ if dob.obj==Mx[:br_page]; dob.tmp='\newpage'
+ elsif dob.obj==Mx[:br_page_new]; dob.tmp='\clearpage'
+ elsif dob.obj==Mx[:br_obj]; dob.tmp='\parasep'
+ end
+ elsif dob.is==:comment \
+ || dob.is==:meta
+ dob.tmp='' #dob.tmp=nil
+ end
+ end
+ data
+ end
+ def footnote(data)
+ data.each do |dob|
+ # EMBEDDED FOOTNOTES / ENDNOTES should be straightforward but not quite a synch.
+ if dob.tmp =~/#{Mx[:en_a_o]}[\d*+]+\s|#{Mx[:en_b_o]}([*+]\d+)\s/
+ dob.tmp=dob.tmp.gsub(/#{Mx[:en_a_o]}(\d+)\s+(.+?)#{Mx[:en_a_c]}/m,"\\footnote[\\1]{%\n \\2} ").
+ gsub(/#{Mx[:en_b_o]}([*+]\d+)\s+(.+?)#{Mx[:en_b_c]}/m,"\\FootnoteA{\\1}{%\n \\2} ").
+ gsub(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)#{Mx[:en_a_c]}/m,"\\FootnoteA{\\1}{%\n \\2} ")
+ end
+ end
+ data
+ end
+ def tables_hash(md,dob)
+ @block={}
+ @dob=dob
+ @md.papersize_array.each do |ps|
+ @@tableheader={ ps => { p: 0, l: 0 } }
+ dob.tmp={ tmp: dob.tmp, paper_size: ps }
+ format_l=SiSU_TeX_Pdf::FormatTextObject.new(md,dob)
+ dob.tmp={ tmp: dob.tmp, paper_size: ps }
+ format_p=SiSU_TeX_Pdf::FormatTextObject.new(md,dob)
+ @block[ps]={
+ l: format_l.longtable_landscape,
+ p: format_p.longtable_portrait
+ }
+ end
+ @dob.tmp=@block
+ @dob
+ end
+ def tables(data)
+ @tex_file=[]
+ data.each do |dob|
+ @tex_file << if dob.is_a?(String) \
+ or dob.is_a?(Hash)
+ dob
+ elsif dob.is==:table
+ tables_hash(@md,dob) #Hash result
+ else dob
+ end
+ end
+ @tex_file
+ end
+ def enclose(dob)
+ dob
+ end
+ def box_boites(dob,ocn)
+ sp_char=SiSU_TeX_Pdf::SpecialCharacters.new(@md,dob.tmp,dob.is)
+ dob.tmp=sp_char.special_characters_safe
+ dob.tmp=dob.tmp.gsub(/(#{Mx[:nbsp]})/m,'{\color{mywhite}\1}').
+ #dob.tmp.gsub(/#{Mx[:nbsp]}/m,'{~}') # dob.tmp.gsub(/#{Mx[:nbsp]}\s*/m,'{~}')
+ gsub(/#{Mx[:vline]}/m,'\vline').
+ gsub(/ \\( |#{Mx[:br_nl]})/,' {\textbackslash}\1').
+ gsub(/#{Mx[:br_nl]}\s*\Z/m,'').
+ gsub(/#{Mx[:br_nl]}{2}/,'\newline \\\\\\ ').
+ gsub(/#{Mx[:br_nl]}/,' \\\\\\ ').
+ gsub(/\n\n\n/m," \\newline\n\n")
+ ocn=SiSU_TeX_Pdf::FormatTextObject.new(@md).ocn_display(dob)
+ dob.tmp = ocn \
+ + @tex_ml.paraskip_small \
+ + '\begin{Codeblock}' \
+ + '\begin{codeblockboitebox} \hardspace \newline ' \
+ + dob.tmp \
+ + '\end{codeblockboitebox}' \
+ + '\end{Codeblock}' \
+ + "\n" \
+ + @tex_ml.paraskip_normal
+ dob
+ end
+ def box_listings(dob,ocn)
+ sp_char=SiSU_TeX_Pdf::SpecialCharacters.new(@md,dob.tmp,dob.is)
+ dob.tmp=sp_char.characters_code_listings
+ dob.tmp=dob.tmp.gsub(/^\s+/m,''). #bug, fix earlier, should be made unecessary
+ gsub(/#{Mx[:nbsp]}/m,' ').
+ gsub(/#{Mx[:vline]}/m,'|').
+ gsub(/#{Mx[:br_nl]}(?:\s?\n)?/m,"\n").
+ gsub(/\n\n\n/m," \n\n")
+ ocn=SiSU_TeX_Pdf::FormatTextObject.new(@md).ocn_display(dob)
+ dob.tmp = ocn \
+ + @tex_ml.paraskip_small \
+ + '\begin{Codeblock}' \
+ + "\n" \
+ + '\begin{lstlisting} ' \
+ + "\n" \
+ + dob.tmp \
+ + "\n" \
+ + '\end{lstlisting} ' \
+ + "\n" \
+ + '\end{Codeblock}' \
+ + "\n" \
+ + @tex_ml.paraskip_normal
+ dob
+ end
+ def markup_common(dob)
+ tex_f=nil
+ txt_obj={ dal: dob }
+ if dob.of==:block
+ @lineone=if dob.is==:block \
+ || dob.is==:group \
+ || dob.is==:alt \
+ || dob.is==:verse
+ dob.tmp=dob.tmp.gsub(/#{Mx[:nbsp]}/m,' \hardspace ').
+ gsub(/#{Mx[:gl_bullet]}/m,'\txtbullet \hardspace '). #Bullet environment not used for grouped text, no hanging indent here
+ gsub(/#{Mx[:br_nl]}+/m,"\n\n") #match not ideal, but currently not inserting extra newlines anyway
+ ocn=SiSU_TeX_Pdf::FormatTextObject.new(@md).ocn_display(dob)
+ dob.tmp=if dob.is==:group \
+ || dob.is==:block \
+ || dob.is==:alt
+ dob.tmp=SiSU_TeX_Pdf::SpecialCharacters.new(@md,dob.tmp).special_characters_safe
+ ocn \
+ + @tex_ml.paraskip_small \
+ + "\n" \
+ + ' \\begin{footnotesize}' \
+ + "\n\n" \
+ + dob.tmp \
+ + '\\end{footnotesize}' \
+ + "\n" \
+ + @tex_ml.paraskip_normal
+ elsif dob.is==:verse
+ dob.tmp=dob.tmp.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/m,'\begin{bfseries}\1 \end{bfseries}').
+ gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/m,'\emph{\1}').
+ gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/m,'\uline{\1}')
+ ocn \
+ + @tex_ml.paraskip_tiny \
+ + "\n" \
+ + ' \\begin{footnotesize}' \
+ + "\n\n" \
+ + dob.tmp \
+ + '\\end{footnotesize}' \
+ + "\n" \
+ + @tex_ml.paraskip_normal \
+ + "\n\\linebreak\n"
+ end
+ dob
+ elsif dob.is ==:code
+ dob=if @codeblock_box == 'listings'
+ box_listings(dob,ocn)
+ elsif @codeblock_box == 'boites'
+ box_boites(dob,ocn)
+ else
+ box_boites(dob,ocn)
+ end
+ dob
+ else 'error' #should never occur
+ end
+ dob=enclose(dob) unless dob.tmp =~/^$/
+ dob
+ else
+ tst=SiSU_TeX_Pdf::FormatTextObject.new(@md,dob)
+ case dob.is
+ when :heading
+ case dob.ln
+ when 1..3
+ tst.heading_major
+ when 4
+ tst.level4
+ when 5
+ tst.level5
+ when 6
+ tst.level6
+ else dob
+ end
+ when :heading_insert
+ br="\n\\\\\n"
+ if dob.name=='book_index'
+ h=tst.heading_major
+ heading="\\clearpage\n" + h.tmp
+ idx_arr=[]
+ idx=SiSU_Particulars::CombinedSingleton.instance.get_idx_raw(@md.opt).raw_idx
+ idx.each do |x|
+ x=if x.is_a?(String)
+ x=SiSU_TeX_Pdf::SpecialCharacters.new(@md,x).special_characters
+ x=SiSU_TeX_Pdf::FormatTextObject.new(@md,x).url_str_internal(x,true)
+ else x=nil
+ end
+ idx_arr << x.sub(/,$/,'') if x.is_a?(String)
+ end
+ idx_str=idx_arr.join(br)
+ l=heading + br + idx_str
+ p=heading + br +
+ '\begin{multicols}{2}' + br +
+ idx_str + br +
+ '\end{multicols}'
+ dob.tmp={ l: l, p: p }
+ elsif dob.ln==2 \
+ and dob.obj=~/Metadata\b/
+ tst.heading_major
+ elsif dob.ln==4 \
+ and dob.obj=~/Metadata\b/
+ h=tst.level4
+ metadata=SiSU_Metadata::TeX_Metadata.new(@md).metadata_tex
+ dob.tmp=h.tmp + ' ' + '\begin{scriptsize}' + metadata.join(br) + '\end{scriptsize}'
+ else dob.tmp='' # dob.tmp={ l: '', p: '' }
+ end
+ when :para
+ if dob.bullet_
+ dob.tmp=tst.bullet
+ elsif dob.indent \
+ and dob.hang \
+ and dob.indent =~/[1-9]/ \
+ and dob.indent == dob.hang
+ dob.tmp=tst.indent
+ elsif dob.hang \
+ and dob.hang =~/[0-9]/ \
+ and (dob.indent != dob.hang or dob.indent =~/[1-9]/)
+ dob.tmp=tst.hang
+ else
+ dob.tmp=dob.tmp.strip
+ dob=enclose(dob) unless dob.tmp =~/^$/
+ end
+ else
+ dob.tmp=dob.tmp.strip unless dob.is==:code
+ dob=enclose(dob) unless dob.tmp =~/^$/
+ end
+ if dob.is_a?(String)
+ dob.tmp=dob.tmp.gsub(/\s*(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*/,' \newline '). #% tread with care
+ gsub(/(\.#{Tex[:tilde]}\S*\s*|<:\S+>|#{Mx[:fa_o]}.*?#{Mx[:fa_c]}|#{Mx[:gr_o]}.*?#{Mx[:gr_c]}|<!.*?!>|<!>)/,' ') #% tread with care
+ end
+ dob
+ end
+ if dob.tmp =~/(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image\b)/m \
+ && dob.is !=:code
+ dob=SiSU_TeX_Pdf::BareUrls.new(@md,dob).bare_urls
+ tst=SiSU_TeX_Pdf::FormatTextObject.new(@md,dob)
+ dob=tst.urls_txt_and_images
+ dob
+ elsif dob.tmp =~/https?:\/\/\S+\b/m \
+ && dob.is ==:code \
+ && @codeblock_box !='listings'
+ dob=SiSU_TeX_Pdf::BareUrls.new(@md,dob).bare_urls_in_code
+ dob
+ end
+ if dob.class !=Hash \
+ && dob.tmp =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}image\b/ \
+ && dob.is !=:code
+ tst=SiSU_TeX_Pdf::FormatTextObject.new(@md,dob)
+ end
+ dob
+ end
+ def tex_box_listings
+ <<WOK
+\\definecolor{listinggray}{gray}{0.9}
+\\definecolor{lbcolor}{rgb}{0.9,0.9,0.9}
+\\lstset{
+ backgroundcolor=\\color{lbcolor},
+ tabsize=4,
+ rulecolor=,
+ language=,
+ basicstyle=\\scriptsize,
+ upquote=true,
+ aboveskip={1.5\\baselineskip},
+ columns=fixed,
+ showstringspaces=false,
+ extendedchars=true,
+ breaklines=true,
+ prebreak = \\raisebox{0ex}[0ex][0ex]{\\ensuremath{\\hookleftarrow}},
+ frame=single,
+ showtabs=false,
+ showspaces=false,
+ showstringspaces=false,
+ identifierstyle=\\ttfamily,
+ keywordstyle=\\color[rgb]{0,0,1},
+ commentstyle=\\color[rgb]{0.133,0.545,0.133},
+ stringstyle=\\color[rgb]{0.627,0.126,0.941},
+}
+WOK
+ end
+ def tex_box_boites
+ <<WOK
+\\def\\codeblockboitebox{%
+ \\def\\bkvz@before@breakbox{\\ifhmode\\par\\fi\\vskip\\breakboxskip\\relax}%
+ \\def\\bkvz@set@linewidth{\\advance\\linewidth -2\\fboxrule
+ \\advance\\linewidth -2\\fboxsep} %
+ \\def\\bk@line{\\hbox to \\linewidth{%
+ \\ifbkcount\\smash{\\llap{\\the\\bk@lcnt\\ }}\\fi
+ \\psframebox*[framesep=0pt,linewidth=0pt]{%
+ \\vrule\\@width\\fboxrule \\hskip\\fboxsep
+ \\box\\bk@bxa
+ \\hskip\\fboxsep \\vrule\\@width\\fboxrule
+ }%
+ }}%
+ %\\def\\bkvz@top{\\hrule\\@height\\fboxrule}
+ \\def\\bkvz@top{\\hrule height .6pt}%
+ \\def\\bkvz@bottom{\\hrule\\@height\\fboxrule}%
+ \\breakbox}
+\\def\\endcodeblockboitebox{\\endbreakbox}
+WOK
+ end
+ def tex_codeblock
+ codeblock_box=if @codeblock_box=='listings'
+ tex_box_listings
+ elsif @codeblock_box=='boites'
+ tex_box_boites
+ else
+ tex_box_boites
+ end
+ codeblock_box
+ end
+ def markup(data)
+ @tex_file=[]
+ md={}
+ home=@vz.txt_home.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}|#{Mx[:br_paragraph]}|\\\\/,' - ') #no line splitting in heading neither html nor latex
+ title=@md.title.full.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}|#{Mx[:br_paragraph]}|\\\\/,' - ') #no line splitting in heading neither html nor latex
+ @md.papersize_array.each do |ps|
+ txt_obj={ txt: "#{home}: - #{title}", paper_size: ps, orientation: 'portrait' }
+ orient_portrait=SiSU_TeX_Pdf::FormatHead.new(@md,txt_obj)
+ txt_obj={ txt: "#{home}: - #{title}", paper_size: ps, orientation: 'landscape' }
+ orient_landscape=SiSU_TeX_Pdf::FormatHead.new(@md,txt_obj)
+ @@tex_head[ps][:p]=orient_portrait.document_head_with_orientation(@codeblock_box)
+ @@tex_head[ps][:l]=orient_landscape.document_head_with_orientation(@codeblock_box)
+ end
+ @tex_file <<<<WOK
+#{@tex_ml.header}#{@tex_ml.footer}
+\\tolerance=300
+\\clubpenalty=300
+\\widowpenalty=300
+\\makeatother
+\\makeatother
+\\chardef\\txtbullet="2022
+\\chardef\\tilde="7E
+%\\chardef\\asterisk="2A
+\\def\\asterisk{{\\rm \\char42} }
+\\definecolor{Light}{gray}{.92}
+\\newcommand{\\Codeblock}[1]{\\normaltext\\raggedright\\small\\ttfamily\\texbackslash#1}
+\\newcommand{\\monosp}[1]{\\normaltext\\ttfamily\\texbackslash#1}
+\\newcommand{\\parasep}{\\\\ \\begin{center}*\\hspace{2em}*\\hspace{2em}*\\end{center} \\\\}
+\\newcommand{\\hardspace}{{~}}
+%\\newcommand{\\hardspace}{\\hspace{.5em}}
+\\newcommand{\\caret}{{\\^{~}}}
+\\newcommand{\\pipe}{{\\textbar}}
+\\newcommand{\\curlyopen}{\{}
+\\newcommand{\\curlyclose}{\}}
+\\newcommand{\\lt}{{\UseTextSymbol{OML}{<}}}
+\\newcommand{\\gt}{{\UseTextSymbol{OML}{>}}}
+\\newcommand{\\slash}{{/}}
+\\newcommand{\\underscore}{\\_}
+\\newcommand{\\exclaim}{\\Verbatim{!}}
+#{tex_codeblock}
+% (tilde hash amp affected by http)
+% \\sloppy
+\\begin{document}
+WOK
+ sisu_rc_footnote=if @md.sc_info then @tex_ml.doc_sc_info_footnote_full
+ else @tex_ml.doc_sc_info_footnote_brief
+ end
+ @copymark='' #check and remove as now is superflous
+ x={}
+ txt_obj={ title: @md.title.full }
+ x[:l]=SiSU_TeX_Pdf::FormatTextObject.new(@md,txt_obj).title_landscape
+ x[:p]=SiSU_TeX_Pdf::FormatTextObject.new(@md,txt_obj).title_portrait
+ @tex_file << x
+ x=nil
+ if defined? @md.creator.author \
+ and @md.creator.author
+ sp_char=SiSU_TeX_Pdf::SpecialCharacters.new(@md,@md.creator.author)
+ author=sp_char.special_characters
+ @tex_file << if @md.author_home
+ <<WOK
+
+\\author{\\href{#{@md.author_home}}{#{@copymark} \\textnormal{#{author}}}}
+WOK
+ else "\n\\author{#{@copymark} \\textnormal{#{author}}}"
+ end
+ end
+ if defined? @md.make.cover_image \
+ and not @md.make.cover_image.nil? \
+ and @md.make.cover_image[:cover] =~/\S+/
+ x={}
+ dir=SiSU_Env::InfoEnv.new(@md.fns)
+ x[:l] =<<WOK
+\\titlepic{\\includegraphics[width=0.3\\textwidth]{#{dir.path.image_source_include}/#{@md.make.cover_image[:cover]}}}
+WOK
+ x[:p] =<<WOK
+\\titlepic{\\includegraphics[width=0.6\\textwidth]{#{dir.path.image_source_include}/#{@md.make.cover_image[:cover]}}}
+WOK
+ @tex_file << x
+ x=nil
+ end
+ @tex_file << unless @md.fnb =~/^mail\s*$/ then @tex_ml.site
+ else '\date'
+ end
+ @tex_file <<<<WOK
+\\pagenumbering{roman}\\maketitle
+\\pagestyle{fancy}
+WOK
+ if defined? @md.rights.all \
+ and @md.rights.all
+ @tex_file << "\\newpage\n"
+ @tex_file << @@rights
+ @tex_file << @@prefix_b if defined? @md.creator.prefix_b and @md.creator.prefix_b
+ end
+ x={}
+ if (@make.build.toc?)
+ toc=<<WOK
+\\renewcommand{\\contentsname}{#{@translate.contents}}
+\\tableofcontents
+WOK
+ toc_pb={ l: @tex_ml.newpage('landscape'), p: @tex_ml.newpage('portrait') }
+ else
+ toc=''
+ toc_pb={ l: '', p: '' }
+ end
+ x[:l] =<<WOK
+#{@tex_ml.newpage('landscape')}
+\\pagestyle{fancy}
+#{toc}#{toc_pb[:l]}
+\\pagenumbering{arabic}
+#{@tex_ml.paraskip_normal}
+#{@tex_ml.newpage('landscape')}
+WOK
+ x[:p] =<<WOK
+#{@tex_ml.newpage('portrait')}
+\\pagestyle{fancy}
+#{toc}#{toc_pb[:p]}
+#{@tex_ml.newpage('portrait')}
+\\pagenumbering{arabic}
+#{@tex_ml.paraskip_normal}
+#{@tex_ml.newpage('portrait')}
+WOK
+ @tex_file << x
+ x=nil
+ data.each do |dob| #% case follows with levels 1-6 indents & graphics
+ if dob.is_a?(Hash)
+ elsif dob.of==:para \
+ || dob.of==:block #GATEWAY FIX FIX stuff
+ dob=markup_common(dob)
+ elsif dob.is==:table
+ if ( dob.tmp['a4'] \
+ or dob.tmp['a5'] \
+ or dob.tmp['b5'] \
+ or dob.tmp['letter'] \
+ or dob.tmp['legal'])
+ @md.papersize_array.each do |ps|
+ if dob.tmp[ps]
+ if (dob.tmp[ps][:p] and dob.tmp[ps][:l])
+ dob.tmp[ps]={
+ p: markup_common(dob.tmp[ps][:p]),
+ l: markup_common(dob.tmp[ps][:l])
+ }
+ else p "#{__FILE__}:#{__LINE__}" if @md.opt.cmd.inspect =~/M/
+ end
+ end
+ end
+ elsif dob.tmp.is_a?(Hash) \
+ and (dob.tmp[:p] and dob.tmp[:l])
+ dob = {
+ p: markup_common(dob.tmp[:p]),
+ l: markup_common(dob.tmp[:l])
+ }
+ else p "#{__FILE__}:#{__LINE__}" if @md.opt.cmd.inspect =~/M/
+ end
+ end
+ @tex_file << dob
+ end
+ @st[:tex][:stmp]||=@md.stmpd
+ stamp=@st[:tex][:stmp] if @st[:tex][:stmp]
+ if stamp
+ use=stamp.gsub(/\n/,"#{Tex[:backslash]*2}\n")
+ @tex_file << "\n\\newpage\n"
+ @tex_file << "\\section*" +
+ "{#{@tex_ml.owner_chapter}}\n" +
+ "\\addcontentsline{toc}" +
+ "{section}{#{@tex_ml.owner_chapter}}\n"
+ @tex_file << "#{use}\n"
+ @tex_file << @@rights if @@rights
+ end
+ @tex_file << "\n\\end{document}"
+ end
+ def number_paras_numbering(dob) # need tables and other types of object
+ if dob.of ==:para
+ paranum=dob.ocn ? dob.ocn : ''
+ paranum = '' if paranum.to_i==0
+ paranumber_display=if @make.build.ocn?
+ tags=''
+ #[keep] code that follows inserts "name tags" as hypertargets, currently using ocn (converting nametags to ocn) for internal linking, related code: |texpdf_format.rb|@|uses nametags directly|
+ #if dob.tags.length > 0 # insert tags "hypertargets"
+ # dob.tags.each do |t|
+ # tags=tags +"\\hspace{0mm}\\hypertarget{#{t}}{\\hspace{0mm}}"
+ # end
+ #end
+ "\\begin{tiny}\\hspace{0mm}\\end{tiny}{\\marginpar{\\begin{tiny}\\hspace{0mm}\\hypertarget{#{dob.ocn}}{#{dob.ocn}}#{tags}\\end{tiny}}}" #ocn object citation numbering
+ else ''
+ end
+ dob.tmp = paranumber_display + dob.tmp
+ end
+ dob
+ end
+ def number_paras(data)
+ tex_file=[]
+ data.each do |dob|
+ dob=if dob.is_a?(Hash)
+ if ( dob['a4'] \
+ or dob['a5'] \
+ or dob['b5'] \
+ or dob['letter'] \
+ or dob['legal'])
+ para_hash={}
+ @md.papersize_array.each do |ps|
+ if defined? dob.tmp and dob.tmp[ps]
+ if (dob.tmp[ps][:p] and dob.tmp[ps][:l])
+ para_hash[ps]={
+ p: number_paras_numbering(dob.tmp[ps][:p]),
+ l: number_paras_numbering(dob.tmp[ps][:l])
+ }
+ dob.tmp=para_hash
+ else p "#{__FILE__}:#{__LINE__}" if @md.opt.cmd.inspect =~/M/
+ end
+ end
+ end
+ elsif (dob.tmp[:p] and dob.tmp[:l])
+ dob.tmp = {
+ p: number_paras_numbering(dob.tmp[:p]),
+ l: number_paras_numbering(dob.tmp[:l])
+ }
+ else p "#{__FILE__}:#{__LINE__}" if @md.opt.cmd.inspect =~/M/
+ end
+ else
+ dob=if dob.of !=:comment \
+ || dob.of !=:meta \
+ || dob.of !=:layout
+ number_paras_numbering(dob)
+ else dob
+ end
+ end
+ end
+ data
+ end
+ def output_morph_hash(o)
+ ps,h,fn=o[:ps],o[:h],o[:filename]
+ if h[ps] \
+ and (h[ps][:p] and h[ps][:l])
+ if h[ps][:p]
+ h[ps][:p]=h[ps][:p].gsub(/[ ]+$/m,'').
+ gsub(/\n\n\n+/m,"\n\n")
+ end
+ if h[ps][:l]
+ h[ps][:l]=h[ps][:l].gsub(/[ ]+$/m,'').
+ gsub(/\n\n\n+/m,"\n\n")
+ end
+ #h[ps][:p].gsub!(/(?:^[ ]+|[ ]+$)/m,'') if h[ps][:p]
+ #h[ps][:l].gsub!(/(?:^[ ]+|[ ]+$)/m,'') if h[ps][:l]
+ if h[ps][:p] !~/\A\s*\Z/
+ fn[:portrait].puts h[ps][:p],"\n"
+ end
+ if h[ps][:l] !~/\A\s*\Z/
+ fn[:landscape].puts h[ps][:l],"\n"
+ end
+ elsif (h[:p] and h[:l])
+ if h[:p]
+ h[:p]=h[:p].gsub(/[ ]+$/m,'').
+ gsub(/\n\n\n+/m,"\n\n")
+ end
+ if h[:l]
+ h[:l]=h[:l].gsub(/[ ]+$/m,'').
+ gsub(/\n\n\n+/m,"\n\n")
+ end
+ #h[:p].gsub!(/(?:^[ ]+|[ ]+$)/m,'') if h[:p]
+ #h[:l].gsub!(/(?:^[ ]+|[ ]+$)/m,'') if h[:l]
+ if h[:p] !~/\A\s*\Z/
+ fn[:portrait].puts h[:p],"\n"
+ end
+ if h[:l] !~/\A\s*\Z/
+ fn[:landscape].puts h[:l],"\n"
+ end
+ else p "#{__FILE__}:#{__LINE__}" if @md.opt.cmd.inspect =~/M/
+ end
+ end
+ def output(array)
+ @array=array=array.flatten.compact
+ fns_l=@md.fns.gsub(/~/,'-') #this is a sorry fix, but necessary as it appears latex programs like not ~
+ @md.papersize_array.each do |ps|
+ file={
+ landscape: File.new("#{@env.processing_path.tex}/#{fns_l}.#{ps}.landscape.tex",'w+'),
+ portrait: File.new("#{@env.processing_path.tex}/#{fns_l}.#{ps}.tex",'w+')
+ }
+ file[:portrait] << @@tex_head[ps][:p]
+ file[:landscape] << @@tex_head[ps][:l]
+ array.each do |morph|
+ if morph.is_a?(String)
+ #morph.gsub!(/^\s+/,'')
+ if morph !~/\A\s*\Z/
+ file[:portrait].puts morph,"\n"
+ file[:landscape].puts morph,"\n"
+ end
+ elsif morph.class.inspect =~ /SiSU_DAL_DocumentStructure/ \
+ and morph.tmp \
+ and morph.tmp.is_a?(String)
+ if morph.is !=:code \
+ && morph.of !=:block
+ morph.tmp=morph.tmp.gsub(/^\s+/,'')
+ else morph.tmp
+ end
+ if (morph.tmp !~/\A\s*\Z/) \
+ || morph.is==:code
+ file[:portrait].puts morph.tmp,"\n"
+ file[:landscape].puts morph.tmp,"\n"
+ end
+ elsif morph.is_a?(Hash) #inserted headers and the like, only
+ h={ ps: ps, h: morph, filename: file }
+ output_morph_hash(h)
+ elsif morph.tmp.is_a?(Hash) #tables & images?
+ h={ ps: ps, h: morph.tmp, filename: file }
+ output_morph_hash(h)
+ end
+ end
+ array=@array
+ file[:portrait].close
+ file[:landscape].close
+ end
+ @@tex_head={
+ 'a4'=> { p: nil, l: nil },
+ 'a5'=> { p: nil, l: nil },
+ 'b5'=> { p: nil, l: nil },
+ 'letter'=>{ p: nil, l: nil },
+ 'legal'=> { p: nil, l: nil },
+ 'book'=> { p: nil, l: nil }
+ }
+ array=[]
+ end
+ end
+ end
+end
+__END__
diff --git a/lib/sisu/v2/texpdf_format.rb b/lib/sisu/v4/texpdf_format.rb
index 018232ac..223633de 100644
--- a/lib/sisu/v2/texpdf_format.rb
+++ b/lib/sisu/v4/texpdf_format.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -59,40 +58,39 @@
module SiSU_TeX_Pdf
@@table_pg_break_counter=1
include SiSU_Viz
- class Bare_urls
+ class BareUrls
def initialize(md,dob=nil)
@md,@dob=md,dob
- @brace_url=SiSU_Viz::Skin.new.url_decoration
+ @brace_url=SiSU_Viz::Defaults.new.url_decoration
end
def bare_urls
- @dob.obj.gsub!(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,
- "#{@brace_url.tex_open}\\1</a>#{@brace_url.tex_close}")
- @dob.tmp.gsub!(/(^|[^\\])_/m,'\1\_') #watch may not work
- @dob.tmp.gsub!(/(^|[^#{Mx[:lnk_c]}])#{Mx[:url_o]}_?(?:\\?_)?(\S+?)#{Mx[:url_c]}/m,
- "\\1#{@brace_url.tex_open}\\begin{scriptsize}\\url{\\2}\\end{scriptsize}#{@brace_url.tex_close}")
+ @dob.obj=@dob.obj.gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,
+ "#{@brace_url.tex_open}\\1</a>#{@brace_url.tex_close}")
+ @dob.tmp=@dob.tmp.gsub(/(^|[^\\])_/m,'\1\_'). #watch may not work
+ gsub(/(^|[^#{Mx[:lnk_c]}])#{Mx[:url_o]}_?(?:\\?_)?(\S+?)#{Mx[:url_c]}/m,
+ "\\1#{@brace_url.tex_open}\\begin{scriptsize}\\url{\\2}\\end{scriptsize}#{@brace_url.tex_close}")
@dob
end
def bare_urls_in_code
- @dob.tmp.gsub!(/(^|[^\\])_/m,'\1\_') #watch may not work
- @dob.tmp.gsub!(/(https?:\/\/\S+?)([{]|[.,;)\]]?(?: |$))/m,
- '\begin{scriptsize}\url{\1}\end{scriptsize}\2')
+ @dob.tmp=@dob.tmp.gsub(/(^|[^\\])_/m,'\1\_'). #watch may not work
+ gsub(/(https?:\/\/\S+?)([{]|[.,;)\]]?(?: |$))/m,
+ '\begin{scriptsize}\url{\1}\end{scriptsize}\2')
@dob
end
end
- class Format_text_object
- require 'iconv'
- require "#{SiSU_lib}/defaults" # defaults.rb
+ class FormatTextObject
+ require_relative 'defaults' # defaults.rb
attr_accessor :string,:string1,:orientation,:url,:dir,:tex
- @@sys=SiSU_Env::System_call.new
+ @@sys=SiSU_Env::SystemCall.new
@@tex_pattern_margin_number=/\\begin\{tiny\}\\hspace\{0mm\}\\end\{tiny\}\{\\marginpar.+?\}\}\}/
@@tableheader={
- 'a4' => { :p => 0, :l => 0 },
- 'a5' => { :p => 0, :l => 0 },
- 'b5' => { :p => 0, :l => 0 },
- 'letter' => { :p => 0, :l => 0 },
- 'legal' => { :p => 0, :l => 0 }
+ 'a4' => { p: 0, l: 0 },
+ 'a5' => { p: 0, l: 0 },
+ 'b5' => { p: 0, l: 0 },
+ 'letter' => { p: 0, l: 0 },
+ 'legal' => { p: 0, l: 0 }
}
- @@sys=SiSU_Env::System_call.new
+ @@sys=SiSU_Env::SystemCall.new
def initialize(md,dob=nil)
@md,@dob=md,dob
if defined? @md.image \
@@ -101,31 +99,34 @@ module SiSU_TeX_Pdf
else @center_begin,@center_end='',''
end
@start_table=''
- @tx=SiSU_Env::Get_init.instance.tex
- @brace_rel=SiSU_Viz::Skin.new.rel_decoration
- @env ||=SiSU_Env::Info_env.new(@md.fns)
- @tex2pdf=@@tex3pdf ||=SiSU_Env::System_call.new.tex2pdf_engine
+ @tx=SiSU_Env::GetInit.new.tex
+ @brace_rel=SiSU_Viz::Defaults.new.rel_decoration
+ @env ||=SiSU_Env::InfoEnv.new(@md.fns)
+ @tex2pdf=@@tex3pdf ||=SiSU_Env::SystemCall.new.tex2pdf_engine
+ @make ||=SiSU_Env::ProcessingSettings.new(@md)
end
def ocn_display(dob)
- "\\begin{tiny}\\hspace{0mm}\\end{tiny}{\\marginpar{\\begin{tiny}\\hspace{0mm}\\hypertarget{#{dob.ocn}}{#{dob.ocn}}\\end{tiny}}}" #ocn object citation numbering
+ show_ocn=(@make.build.ocn?) \
+ ? dob.ocn
+ : ''
+ "\\begin{tiny}\\hspace{0mm}\\end{tiny}{\\marginpar{\\begin{tiny}\\hspace{0mm}\\hypertarget{#{dob.ocn}}{#{show_ocn}}\\end{tiny}}}" #ocn object citation numbering
end
def table_special_characters(r)
- r.gsub!(/#{Mx[:tc_p]}|$/u,'&')
- r.gsub!(/%/,'\%')
- r.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\begin{bfseries}\1 \end{bfseries}')
- r.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\emph{\1}')
- r.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\uline{\1}') # ulem
- r.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,"``\\1''") # quote #CHECK
- r.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'\uline{\1}') # ulem
- r.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'\sout{\1}') # ulem
- r.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,"\$^{\\textrm{\\1}}\$")
- r.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,"\$_{\\textrm{\\1}}\$")
- r
+ r=r.gsub(/#{Mx[:tc_p]}|$/u,'&').
+ gsub(/%/,'\%').
+ gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\begin{bfseries}\1 \end{bfseries}').
+ gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\emph{\1}').
+ gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\uline{\1}'). # ulem
+ gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,"``\\1''"). # quote #CHECK
+ gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'\uline{\1}'). # ulem
+ gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'\sout{\1}'). # ulem
+ gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,"\$^{\\textrm{\\1}}\$").
+ gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,"\$_{\\textrm{\\1}}\$")
end
def longtable_landscape
end_table='\end{longtable}'
row_break='\\\\\\'
- txt=if @dob.is=='table'
+ txt=if @dob.is==:table
tw=case @dob.tmp[:paper_size]
when /a4/i; @tx.a4.landscape.w #European default, SiSU default
when /letter/i; @tx.letter.landscape.w #U.S. default
@@ -148,19 +149,21 @@ module SiSU_TeX_Pdf
"\\begin{tiny}\n\\begin{longtable}#{colW}\n"
rows=@dob.obj.split(/#{Mx[:br_nl]}/)
if @dob.head_ #result imperfect, check on
- rows[0].gsub!(/(^|.+?)(?:#{Mx[:tc_p]}|$)/u,'\bfseries \1&')
- rows[0].gsub!(/&\s*$/," #{row_break} \\hline\\endhead #{row_break}")
+ rows[0]=rows[0].gsub(/(^|.+?)(?:#{Mx[:tc_p]}|$)/u,'\bfseries \1&').
+ gsub(/&\s*$/," #{row_break} \\hline\\endhead #{row_break}")
end
+ rows_new=[]
rows.each do |r|
r=table_special_characters(r)
- r.gsub!(/$/," #{row_break}\n") unless r =~/#{row_break*2}$/
+ r=r.gsub(/$/," #{row_break}\n") unless r =~/#{row_break*2}$/
if r=~/\<!f(.+?)!\>/ # not tested table footer if any
tablefoot=$1
- r.gsub!(/\<!f(.+?)!\>/,'')
+ r=r.gsub(/\<!f(.+?)!\>/,'')
r="#{r} \\multicolumn{#{@dob.cols}}{l}{\\tiny #{tablefoot}} \\\\ \\hline\n\\endfoot\n\\hline\n"
end
+ rows_new << r
end
- table=rows.join #@dob[:dal].obj=rows.join
+ table=rows_new.join #@dob[:dal].obj=rows.join
ocn_display(@dob) + start_table + table + " #{end_table}\n\\end{tiny}"
else ''
end
@@ -168,7 +171,7 @@ module SiSU_TeX_Pdf
def longtable_portrait
end_table='\end{longtable}'
row_break='\\\\\\'
- txt=if @dob.is=='table'
+ txt=if @dob.is==:table
tw=case @dob.tmp[:paper_size]
when /a4/i; @tx.a4.portrait.w #European default, SiSU default
when /letter/i; @tx.letter.portrait.w #U.S. default
@@ -180,7 +183,7 @@ module SiSU_TeX_Pdf
textwidth=tw.to_i - 20
colW=[]
colW << '{'
- @dob.widths.each do |x|
+ @dob.widths.each do |x|
x=(x.to_i * textwidth)/100 #x=(x.to_i/100.0 * 160)
col_w=x.to_s # x.gsub(/.+/,'l\|') #unless x.nil?
colW << "p{#{col_w}mm}" if col_w
@@ -191,19 +194,21 @@ module SiSU_TeX_Pdf
"\\begin{tiny}\n\\begin{longtable}#{colW}\n"
rows=@dob.obj.split(/#{Mx[:br_nl]}/)
if @dob.head_
- rows[0].gsub!(/(^|.+?)(?:#{Mx[:tc_p]}|$)/u,'\bfseries \1&')
- rows[0].gsub!(/&\s*$/," #{row_break} \\hline\\endhead #{row_break}")
+ rows[0]=rows[0].gsub(/(^|.+?)(?:#{Mx[:tc_p]}|$)/u,'\bfseries \1&').
+ gsub(/&\s*$/," #{row_break} \\hline\\endhead #{row_break}")
end
+ rows_new=[]
rows.each do |r|
r=table_special_characters(r)
- r.gsub!(/$/," #{row_break}\n") unless r =~/#{row_break*2}$/
+ r=r.gsub(/$/," #{row_break}\n") unless r =~/#{row_break*2}$/
if r=~/\<!f(.+?)!\>/ # not tested table footer if any
tablefoot=$1
- r.gsub!(/\<!f(.+?)!\>/,'')
+ r=r.gsub(/\<!f(.+?)!\>/,'')
r="#{r} \\multicolumn{#{@dob.cols}}{l}{\\tiny #{tablefoot}} \\\\ \\hline\n\\endfoot\n\\hline\n"
end
+ rows_new << r
end
- table=rows.join #@dob[:dal].obj=rows.join
+ table=rows_new.join #@dob[:dal].obj=rows.join
ocn_display(@dob) + start_table + table + " #{end_table}\n\\end{tiny}"
else ''
end
@@ -211,17 +216,18 @@ module SiSU_TeX_Pdf
def heading_major
dob=@dob
title=@md.title.full
- dob.tmp.strip! if dob.tmp
- dob.tmp.gsub!(/\\begin\{(bfseries|itshape)\}(.+?)\\end\{\1\}/m,'\2')
+ dob.tmp=dob.tmp.strip if dob.tmp
+ dob.tmp=dob.tmp.gsub(/\\begin\{(bfseries|itshape)\}(.+?)\\end\{\1\}/m,'\2').
+ gsub(/#{Mx[:url_o]}|#{Mx[:url_c]}/,'')
cont_ln=dob.tmp.dup
- cont_ln.gsub!(/\\begin\{(monosp)\}(.+?)\\end\{\1\}/m,'\2')
- cont_ln.gsub!(@@tex_pattern_margin_number,'')
+ cont_ln=cont_ln.gsub(/\\begin\{(monosp)\}(.+?)\\end\{\1\}/m,'\2').
+ gsub(@@tex_pattern_margin_number,'')
clearp=(dob.lv =~/B/ && dob.obj =='Metadata') ? "\\clearpage\n" : ''
if dob.tmp =~/\\[Ff]ootnote/ #and dob =~/^[1-6]#{Tex[:tilde]}/ # removing footnotes from headings!
- cont_ln.gsub!(/\s*\\footnote\[\d+\]\{%\n .+? \}\s*/,' ')
- cont_ln.gsub!(/\s*\\Footnote[A]\{[*+]+\d*\}\{%\n .+? \}\s*/,' ')
+ cont_ln=cont_ln.gsub(/\s*\\footnote\[\d+\]\{%\n .+? \}\s*/,' ').
+ gsub(/\s*\\Footnote[A]\{[*+]+\d*\}\{%\n .+? \}\s*/,' ')
end
- dob.tmp.gsub!(/^(.*)\n?$/m,
+ dob.tmp=dob.tmp.gsub(/^(.*)\n?$/m,
"#{clearp}\\part*{\\1}
\\addcontentsline{toc}{section}{#{cont_ln}}
\\markboth{#{title}}\n")
@@ -229,23 +235,24 @@ module SiSU_TeX_Pdf
end
def level4
dob=@dob
- dob.tmp.strip! if dob.tmp
- dob.tmp.gsub!(/\\begin\{(bfseries|itshape)\}(.+?)\\end\{\1\}/m,'\2')
+ dob.tmp=dob.tmp.strip if dob.tmp
+ dob.tmp=dob.tmp.gsub(/\\begin\{(bfseries|itshape)\}(.+?)\\end\{\1\}/m,'\2').
+ gsub(/#{Mx[:url_o]}|#{Mx[:url_c]}/,'')
cont_ln=dob.tmp.dup
- cont_ln.gsub!(/\\begin\{(monosp)\}(.+?)\\end\{\1\}/m,'\2')
- cont_ln.gsub!(@@tex_pattern_margin_number,'')
- cont_ln.gsub!(/#{Tex[:backslash]*2}/,"#{Tex[:backslash]*4}") # added w42
- cont_ln.gsub!(/\\footnote\[\d+\]\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22
- cont_ln.gsub!(/\\Footnote[A]\{[*+]+\d*\}\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22
+ cont_ln=cont_ln.gsub(/\\begin\{(monosp)\}(.+?)\\end\{\1\}/m,'\2').
+ gsub(@@tex_pattern_margin_number,'').
+ gsub(/#{Tex[:backslash]*2}/,"#{Tex[:backslash]*4}"). # added w42
+ gsub(/\\footnote\[\d+\]\{%.+?\\end\{scriptsize\}\s*\}/m,''). #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22
+ gsub(/\\Footnote[A]\{[*+]+\d*\}\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22
title=@md.title.full
if dob.name =~/endnotes/
- dob.tmp.gsub!(/.+/m,'')
+ dob.tmp=dob.tmp.gsub(/.+/m,'')
end
if dob.tmp =~/\\footnote/ #and dob =~/^[1-6]#{Tex[:tilde]}/ # removing footnotes from headings!
- cont_ln.gsub!(/\s*\\footnote\[\d+\]\{%\n .+? \}\s*/,' ')
- cont_ln.gsub!(/\s*\\Footnote[A]\{[*+]+\d*\}\{%\n .+? \}\s*/,' ')
+ cont_ln=cont_ln.gsub(/\s*\\footnote\[\d+\]\{%\n .+? \}\s*/,' ').
+ gsub(/\s*\\Footnote[A]\{[*+]+\d*\}\{%\n .+? \}\s*/,' ')
end
- dob.tmp.gsub!(/^(.*)?\n?$/m,"\\subsubsection*{\\1}
+ dob.tmp=dob.tmp.gsub(/^(.*)?\n?$/m,"\\subsubsection*{\\1}
\\addcontentsline{toc}{subsection}{#{cont_ln}}
\\markright{#{title}}")
dob
@@ -253,19 +260,20 @@ module SiSU_TeX_Pdf
def level5
dob=@dob
# there is a problem here with creation of headers does not do what you would want it to header starts with a * and is not in bold work on \\@txt*, same for next section 2002w46
- dob.tmp.strip! if dob.tmp
- dob.tmp.gsub!(/\\begin\{(bfseries|itshape)\}(.+?)\\end\{\1\}/m,'\2')
+ dob.tmp=dob.tmp.strip if dob.tmp
+ dob.tmp=dob.tmp.gsub(/\\begin\{(bfseries|itshape)\}(.+?)\\end\{\1\}/m,'\2').
+ gsub(/#{Mx[:url_o]}|#{Mx[:url_c]}/,'')
cont_ln=dob.tmp.dup
- cont_ln.gsub!(/\\begin\{(monosp)\}(.+?)\\end\{\1\}/m,'\2')
- cont_ln.gsub!(@@tex_pattern_margin_number,'')
- cont_ln.gsub!(/\\footnote\[\d+\]\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22
- cont_ln.gsub!(/\\Footnote[A]\{[*+]+\d*\}\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22
- cont_ln.gsub!(/\\\&/,' and ') #revisit: tmp bugfix 200507, substitutes & with 'and' in toc, needed e.g. for AT&T, see ffa
+ cont_ln=cont_ln.gsub(/\\begin\{(monosp)\}(.+?)\\end\{\1\}/m,'\2').
+ gsub(@@tex_pattern_margin_number,'').
+ gsub(/\\footnote\[\d+\]\{%.+?\\end\{scriptsize\}\s*\}/m,''). #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22
+ gsub(/\\Footnote[A]\{[*+]+\d*\}\{%.+?\\end\{scriptsize\}\s*\}/m,''). #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22
+ gsub(/\\\&/,' and ') #revisit: tmp bugfix 200507, substitutes & with 'and' in toc, needed e.g. for AT&T, see ffa
if dob.tmp =~/\\footnote/ #and dob =~/^[1-6]#{Tex[:tilde]}/ # removing footnotes from headings!
- cont_ln.gsub!(/\s*\\footnote\[\d+\]\{%\n .+? \}\s*/,' ')
- cont_ln.gsub!(/\s*\\Footnote[A]\{[*+]+\d*\}\{%\n .+? \}\s*/,' ')
+ cont_ln=cont_ln.gsub(/\s*\\footnote\[\d+\]\{%\n .+? \}\s*/,' ').
+ gsub(/\s*\\Footnote[A]\{[*+]+\d*\}\{%\n .+? \}\s*/,' ')
end
- dob.tmp.gsub!(/^(.*)?\n?$/m,
+ dob.tmp=dob.tmp.gsub(/^(.*)?\n?$/m,
"\\subsubsection*{\\1}
\\addcontentsline{toc}{subsubsection}{#{cont_ln} \\\\
}")
@@ -274,23 +282,161 @@ module SiSU_TeX_Pdf
def level6
dob=@dob
# there is a problem here with creation of headers does not do what you would want it to header starts with a * and is not in bold work on \\sub@txt*, same for previous section 2002w46
- dob.tmp.strip! if dob.tmp
- dob.tmp.gsub!(/\\begin\{(bfseries|itshape)\}(.+?)\\end\{\1\}/m,'\2')
+ dob.tmp=dob.tmp.strip if dob.tmp
+ dob.tmp=dob.tmp.gsub(/\\begin\{(bfseries|itshape)\}(.+?)\\end\{\1\}/m,'\2').
+ gsub(/#{Mx[:url_o]}|#{Mx[:url_c]}/,'')
cont_ln=dob.tmp.dup
- cont_ln.gsub!(/\\begin\{(monosp)\}(.+?)\\end\{\1\}/m,'\2')
- cont_ln.gsub!(@@tex_pattern_margin_number,'')
- cont_ln.gsub!(/\\footnote\[\d+\]\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22
- cont_ln.gsub!(/\\Footnote[A]\{[*+]+\d*\}\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22
+ cont_ln=cont_ln.gsub(/\\begin\{(monosp)\}(.+?)\\end\{\1\}/m,'\2').
+ gsub(@@tex_pattern_margin_number,'').
+ gsub(/\\footnote\[\d+\]\{%.+?\\end\{scriptsize\}\s*\}/m,''). #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22
+ gsub(/\\Footnote[A]\{[*+]+\d*\}\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22
if dob.tmp =~/\\footnote/ #and dob =~/^[1-6]#{Tex[:tilde]}/ # removing footnotes from headings!
- cont_ln.gsub!(/\s*\\footnote\[\d+\]\{%\n .+? \}\s*/,' ')
- cont_ln.gsub!(/\s*\\Footnote[A]\{[*+]+\d*\}\{%\n .+? \}\s*/,' ')
+ cont_ln=cont_ln.gsub(/\s*\\footnote\[\d+\]\{%\n .+? \}\s*/,' ').
+ gsub(/\s*\\Footnote[A]\{[*+]+\d*\}\{%\n .+? \}\s*/,' ')
end
- dob.tmp.gsub!(/^(.*)?\n?$/m,
+ dob.tmp=dob.tmp.gsub(/^(.*)?\n?$/m,
"\\subsubsection*{\\1}
\\addcontentsline{toc}{subsubsection}{~~~~#{cont_ln} \\\\
}")
+ #dob.tmp.gsub(/^(.*)?\n?$/m,
+ # '\subsubsection*{\1}')
dob
end
+ def hang
+ case @dob.indent
+ when /0/
+ case @dob.hang
+ when /0/; indent,hang='0mm', '0mm'
+ when /1/; indent,hang='0mm','10mm'
+ when /2/; indent,hang='0mm','20mm'
+ when /3/; indent,hang='0mm','30mm'
+ when /4/; indent,hang='0mm','40mm'
+ when /5/; indent,hang='0mm','50mm'
+ when /6/; indent,hang='0mm','60mm'
+ when /7/; indent,hang='0mm','70mm'
+ when /8/; indent,hang='0mm','80mm'
+ when /9/; indent,hang='0mm','90mm'
+ end
+ when /1/
+ case @dob.hang
+ when /0/; indent,hang='10mm','-10mm'
+ when /1/; indent,hang='10mm', '0mm'
+ when /2/; indent,hang='10mm', '10mm'
+ when /3/; indent,hang='10mm', '20mm'
+ when /4/; indent,hang='10mm', '30mm'
+ when /5/; indent,hang='10mm', '40mm'
+ when /6/; indent,hang='10mm', '50mm'
+ when /7/; indent,hang='10mm', '60mm'
+ when /8/; indent,hang='10mm', '70mm'
+ when /9/; indent,hang='10mm', '80mm'
+ end
+ when /2/
+ case @dob.hang
+ when /0/; indent,hang='20mm','-20mm'
+ when /1/; indent,hang='20mm','-10mm'
+ when /2/; indent,hang='20mm', '0mm'
+ when /3/; indent,hang='20mm', '10mm'
+ when /4/; indent,hang='20mm', '20mm'
+ when /5/; indent,hang='20mm', '30mm'
+ when /6/; indent,hang='20mm', '40mm'
+ when /7/; indent,hang='20mm', '50mm'
+ when /8/; indent,hang='20mm', '60mm'
+ when /9/; indent,hang='20mm', '70mm'
+ end
+ when /3/
+ case @dob.hang
+ when /0/; indent,hang='30mm','-30mm'
+ when /1/; indent,hang='30mm','-20mm'
+ when /2/; indent,hang='30mm','-10mm'
+ when /3/; indent,hang='30mm', '0mm'
+ when /4/; indent,hang='30mm', '10mm'
+ when /5/; indent,hang='30mm', '20mm'
+ when /6/; indent,hang='30mm', '30mm'
+ when /7/; indent,hang='30mm', '40mm'
+ when /8/; indent,hang='30mm', '50mm'
+ when /9/; indent,hang='30mm', '60mm'
+ end
+ when /4/
+ case @dob.hang
+ when /0/; indent,hang='40mm','-40mm'
+ when /1/; indent,hang='40mm','-30mm'
+ when /2/; indent,hang='40mm','-20mm'
+ when /3/; indent,hang='40mm','-10mm'
+ when /4/; indent,hang='40mm', '0mm'
+ when /5/; indent,hang='40mm', '10mm'
+ when /6/; indent,hang='40mm', '20mm'
+ when /7/; indent,hang='40mm', '30mm'
+ when /8/; indent,hang='40mm', '40mm'
+ when /9/; indent,hang='40mm', '50mm'
+ end
+ when /5/
+ case @dob.hang
+ when /0/; indent,hang='50mm','-50mm'
+ when /1/; indent,hang='50mm','-40mm'
+ when /2/; indent,hang='50mm','-30mm'
+ when /3/; indent,hang='50mm','-20mm'
+ when /4/; indent,hang='50mm','-10mm'
+ when /5/; indent,hang='50mm', '0mm'
+ when /6/; indent,hang='50mm', '10mm'
+ when /7/; indent,hang='50mm', '20mm'
+ when /8/; indent,hang='50mm', '30mm'
+ when /9/; indent,hang='50mm', '40mm'
+ end
+ when /6/
+ case @dob.hang
+ when /0/; indent,hang='60mm','-60mm'
+ when /1/; indent,hang='60mm','-50mm'
+ when /2/; indent,hang='60mm','-40mm'
+ when /3/; indent,hang='60mm','-30mm'
+ when /4/; indent,hang='60mm','-20mm'
+ when /5/; indent,hang='60mm','-10mm'
+ when /6/; indent,hang='60mm', '0mm'
+ when /7/; indent,hang='60mm', '10mm'
+ when /8/; indent,hang='60mm', '20mm'
+ when /9/; indent,hang='60mm', '30mm'
+ end
+ when /7/
+ case @dob.hang
+ when /0/; indent,hang='70mm','-70mm'
+ when /1/; indent,hang='70mm','-60mm'
+ when /2/; indent,hang='70mm','-50mm'
+ when /3/; indent,hang='70mm','-40mm'
+ when /4/; indent,hang='70mm','-30mm'
+ when /5/; indent,hang='70mm','-20mm'
+ when /6/; indent,hang='70mm','-10mm'
+ when /7/; indent,hang='70mm', '0mm'
+ when /8/; indent,hang='70mm', '10mm'
+ when /9/; indent,hang='70mm', '20mm'
+ end
+ when /8/
+ case @dob.hang
+ when /0/; indent,hang='80mm','-80mm'
+ when /1/; indent,hang='80mm','-70mm'
+ when /2/; indent,hang='80mm','-60mm'
+ when /3/; indent,hang='80mm','-50mm'
+ when /4/; indent,hang='80mm','-40mm'
+ when /5/; indent,hang='80mm','-30mm'
+ when /6/; indent,hang='80mm','-20mm'
+ when /7/; indent,hang='80mm','-10mm'
+ when /8/; indent,hang='80mm', '0mm'
+ when /9/; indent,hang='80mm', '10mm'
+ end
+ when /9/
+ case @dob.hang
+ when /0/; indent,hang='90mm','-90mm'
+ when /1/; indent,hang='90mm','-80mm'
+ when /2/; indent,hang='90mm','-70mm'
+ when /3/; indent,hang='90mm','-60mm'
+ when /4/; indent,hang='90mm','-50mm'
+ when /5/; indent,hang='90mm','-40mm'
+ when /6/; indent,hang='90mm','-30mm'
+ when /7/; indent,hang='90mm','-20mm'
+ when /8/; indent,hang='90mm','-10mm'
+ when /9/; indent,hang='90mm', '0mm'
+ end
+ end
+ "\\begin{ParagraphHang}{#{indent}}{#{hang}}#{@dob.tmp} \\end{ParagraphHang}}"
+ end
def indent
indent=case @dob.indent
when /1/; '0mm'
@@ -326,79 +472,18 @@ module SiSU_TeX_Pdf
blt
end
def symbol_graphic
- dir=SiSU_Env::Info_env.new(@md.fns)
+ dir=SiSU_Env::InfoEnv.new(@md.fns)
image='c_' + /<:=\s*(\S+?)\s*>/m.match(@txt).captures.join + '.png' #watch
- if FileTest.file?("#{dir.path.image_source_tex}/#{image}")
+ if FileTest.file?("#{dir.path.image_source_include}/#{image}")
@txt.gsub!(/<:=\s*(\S+?)\s*>/,
- "\\includegraphics*[width=11pt]{#{dir.path.image_source_tex}/c_\\1.png}")
+ "\\includegraphics*[width=11pt]{#{dir.path.image_source_include}/c_\\1.png}")
else
- SiSU_Screen::Ansi.new(@md.cmd,"ERROR - image:",%{"#{image}" missing},"search path: #{dir.path.image_source_tex}").error2 unless @md.cmd =~/q/
+ SiSU_Screen::Ansi.new(@md.opt.cmd,"ERROR - image:",%{"#{image}" missing},"search path: #{dir.path.image_source_include}").error2 unless @md.opt.cmd =~/q/
@txt.gsub!(/#{Mx[:lnk_o]}\S+\.(png|jpg|gif).+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,'') # fragile match operator\\ fragile !
end
end
- def image
- dir=SiSU_Env::Info_env.new(@md.fns)
- image,m=/#{Mx[:lnk_o]}\s*(\S+)\s+.+?width=``(\d+)''.+?#{Mx[:lnk_c]}/m.match(@txt).captures
- width=m[1] || '100'
- width=width.to_i*0.4
- image_source=if @md.fns =~/\.(?:ssm\.)?sst$/ \
- and FileTest.file?("#{dir.path.image_source_local_tex}/#{image}")
- dir.path.image_source_local_tex
- elsif @md.fns =~/\.-ss[tm]$/ \
- and FileTest.file?("#{dir.path.image_source_remote_tex}/#{image}")
- dir.path.image_source_remote_tex
- elsif FileTest.file?("#{dir.path.image_source_tex}/#{image}")
- dir.path.image_source_tex
- else
- SiSU_Screen::Ansi.new(@md.cmd,"ERROR - image:",%{"#{image}" missing},"search locations: #{dir.path.image_source_local_tex},#{dir.path.image_source_remote_tex} and #{dir.path.image_source_tex}").error2 unless @md.cmd =~/q/
- nil
- end
- if image_source #CHECK
- @txt.gsub!(/#{Mx[:lnk_o]}\s*(\S+)\s+.+?#{Mx[:lnk_c]}/,
- @center_begin + "\\includegraphics*[width=#{width}pt]{#{image_source}/\\1}" + @center_end )
- else @txt.gsub!(/#{Mx[:lnk_o]}\s*(\S+)\s+.+?#{Mx[:lnk_c]}/,'\1}')
- end
- end
- def png(ps='') #fc missing image check
- dir=SiSU_Env::Info_env.new(@md.fns)
- # messy clean up
- z=@txt[/#{Mx[:lnk_o]}(\S.+?)#{Mx[:lnk_c]}(?:image|png)/,1].strip if @txt =~ /#{Mx[:lnk_o]}\S.+?#{Mx[:lnk_c]}(?:image|png)/ # match operator for z \\ fragile !
- if z #debug 2004w14
- image=z[/(\S+?\.(?:png|jpg|gif)\b)/m]
- image.gsub!(/\\/,'')
- width=if z =~ /\d+x\d*/
- w=(z[/\s(\d+)x\d*/,1]).to_i
- w*0.8
- else '100' #revisit, is bug for small images/icons
- end
- width='380' if width.to_i > 380
- c=z[/``(.+?)''/m]
- end
- hsp="\n{\\color{mywhite} .}&~\n" # ~ character for hardspace
- caption="{\\\\\\\ \n\\begin{scriptsize}#{hsp*3}#{c}\\end{scriptsize}&}" if c
- image_source=if @md.fns =~/\.(?:ssm\.)?sst$/ \
- and FileTest.file?("#{dir.path.image_source_local_tex}/#{image}")
- dir.path.image_source_local_tex
- elsif @md.fns =~/\.-ss[tm]$/ \
- and FileTest.file?("#{dir.path.image_source_remote_tex}/#{image}")
- dir.path.image_source_remote_tex
- elsif FileTest.file?("#{dir.path.image_source_tex}/#{image}")
- dir.path.image_source_tex
- else
- unless image.nil? \
- or image.length < 2
- SiSU_Screen::Ansi.new(@md.cmd,"ERROR - image:",%{"#{image}" missing},"search locations: #{dir.path.image_source_local_tex},#{dir.path.image_source_remote_tex} and #{dir.path.image_source_tex}").error2 unless @md.cmd =~/q/
- end
- nil
- end
- if image_source
- @txt.gsub!(/#{Mx[:lnk_o]}\S+\.(png|jpg|gif).+?#{Mx[:lnk_c]}(image|png)/, # fragile match operator\\ fragile !
- "#{@center_begin}\n\\includegraphics*[width=#{width}pt]{#{image_source}/#{image}}#{caption}#{@center_end}")
- else @txt.gsub!(/#{Mx[:lnk_o]}\S+\.(png|jpg|gif).+?#{Mx[:lnk_c]}(image|png)/,'')
- end
- end
def url_str_internal(str,idx=nil)
- map_nametags=SiSU_Particulars::Combined_singleton.instance.get_map_nametags(@md).nametags_map #p map_nametags
+ map_nametags=SiSU_Particulars::CombinedSingleton.instance.get_map_nametags(@md).nametags_map #p map_nametags
rgx_url_generic=/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/m
rgx_url_relative=/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}:\S+?#{Mx[:rel_c]}/m
rgx_url_internal=/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}#?\S+?#{Mx[:rel_c]}/m
@@ -419,10 +504,10 @@ module SiSU_TeX_Pdf
map_nametags[url][:ocn]
else nil
end
- ocn_lnk=(url=~/^\d+$/ ? url : ocn_lnk)
+ ocn_lnk=(url=~/^\d+$/ ? url : ocn_lnk)
if ocn_lnk and not ocn_lnk.empty?
idx \
- ? (str.sub!(rgx_url_internal,"\\hyperlink{#{ocn_lnk}}{#{link}}")) \
+ ? (str.sub!(rgx_url_internal,"\\hyperlink{#{ocn_lnk}}{#{link}}"))
: (str.sub!(rgx_url_internal,"#{@brace_rel.tex_open}\\hyperlink{#{ocn_lnk}}{#{link}}#{@brace_rel.tex_close}"))
else
puts %{name tag: "#{url}" not found}
@@ -433,8 +518,7 @@ module SiSU_TeX_Pdf
#? (str.sub!(rgx_url_internal,"\\hyperlink{#{url}}{#{link}}")) \
#: (str.sub!(rgx_url_internal,"#{@brace_rel.tex_open}\\hyperlink{#{url}}{#{link}}#{@brace_rel.tex_close}"))
end
- str.gsub!(/#{Xx[:protect]}/,'')
- str
+ str=str.gsub(/#{Xx[:protect]}/,'')
end
def url_str(str)
rgx_url_generic=/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/m
@@ -446,7 +530,7 @@ module SiSU_TeX_Pdf
link=z.strip
link.gsub!(/&/,"#{Xx[:protect]}&")
str.sub!(rgx_url_generic,"#{@brace_rel.tex_open}\\href{#{url}}{#{link}}#{@brace_rel.tex_close}")
- str.gsub!(/#{Xx[:protect]}/,'')
+ str=str.gsub(/#{Xx[:protect]}/,'')
str
else str
end
@@ -471,6 +555,8 @@ module SiSU_TeX_Pdf
link.gsub!(/&/,"#{Xx[:protect]}&")
dob.tmp.sub!(rgx_url_generic,"#{@brace_rel.tex_open}\\href{#{url}}{#{link}}#{@brace_rel.tex_close}#{punctuate}")
dob.tmp.gsub!(/#{Xx[:protect]}/,'')
+ #dob.tmp=dob.tmp.sub(rgx_url_generic,"#{@brace_rel.tex_open}\\href{#{url}}{#{link}}#{@brace_rel.tex_close}#{punctuate}").
+ # gsub(/#{Xx[:protect]}/,'')
dob
else dob
end
@@ -480,7 +566,7 @@ module SiSU_TeX_Pdf
end
def urls_txt_and_images
dob=@dob
- dir=SiSU_Env::Info_env.new(@md.fns)
+ dir=SiSU_Env::InfoEnv.new(@md.fns)
@dm={
'a4'=> @tx.a4.landscape.img_px,
'letter'=> @tx.letter.landscape.img_px,
@@ -537,44 +623,61 @@ module SiSU_TeX_Pdf
hsp="\n{\\color{mywhite} .}&~\n" # ~ character for hardspace
caption=(c ? "{\\\\\ \n\\begin{scriptsize}#{hsp*3}#{c}\\end{scriptsize}&}" : '')
elsif images_hash[ps] =~/#{Mx[:lnk_o]}\s*(\S+\.?\.(?:png|jpg|gif))/m
- SiSU_Screen::Ansi.new(@md.cmd,%{document built without image: "#{$1}" as image dimensions not provided (either image not found or neither imagemagick nor graphicsmagick is installed)?\n}).print_grey #unless @opt.cmd =~/q/
+ SiSU_Screen::Ansi.new(@md.opt.cmd,%{document built without image: "#{$1}" as image dimensions not provided (either image not found or neither imagemagick nor graphicsmagick is installed)?\n}).print_grey #unless @opt.cmd =~/q/
images_hash[ps].gsub!(/#{Mx[:lnk_o]}\s*(\S+\.?\.(?:png|jpg|gif))/,'[image]')
end
if image #most images fc etc. #% clean up !
- if @md.fns =~/\.(?:ssm\.)?sst$/ \
- and FileTest.file?("#{dir.path.image_source_local_tex}/#{image}")
+ if FileTest.file?("#{dir.path.image_source_include}/#{image}")
case images_hash[ps]
when url_image_rgx
images_hash[ps].sub!(url_image_rgx,
- "#{@center_begin}\\\n\\href{#{url}}{\\includegraphics*[width=#{width[ps]}pt]{#{dir.path.image_source_local_tex}/#{image}}}#{caption} #{@center_end}")
+ "#{@center_begin}\\\n\\href{#{url}}\n{\\includegraphics*[width=#{width[ps]}pt]{#{dir.path.image_source_include}/#{image}}}#{caption}#{@center_end}")
when image_rgx
images_hash[ps].sub!(image_rgx,
- "#{@center_begin}\\\n\\includegraphics*[width=#{width[ps]}pt]{#{dir.path.image_source_local_tex}/#{image}}#{caption} #{@center_end}")
+ "#{@center_begin}\\\n\\includegraphics*[width=#{width[ps]}pt]{#{dir.path.image_source_include}/#{image}}#{caption}#{@center_end}")
end
images_hash[ps]
- elsif @md.fns =~/\.-ss[tm]$/ \
- and FileTest.file?("#{dir.path.image_source_remote_tex}/#{image}")
+ elsif @md.opt.f_pth[:pth] =~/\/\S+?\/sisupod\/\S+?\/sisupod\/doc/
+ pt=/(\/\S+?\/sisupod\/\S+?\/sisupod)\/doc/.match(@md.opt.f_pth[:pth])[1]
+ img_src=pt + '/image'
+ if FileTest.file?("#{img_src}/#{image}")
+ img_src
+
+ case images_hash[ps]
+ when url_image_rgx
+ images_hash[ps].sub!(url_image_rgx,
+ "#{@center_begin}\\\n\\href{#{url}}{\\includegraphics*[width=#{width[ps]}pt]{#{img_src}/#{image}}}#{caption} #{@center_end}")
+ when image_rgx
+ images_hash[ps].sub!(image_rgx,
+ "#{@center_begin}\\\n\\includegraphics*[width=#{width[ps]}pt]{#{img_src}/#{image}}#{caption} #{@center_end}")
+ end
+ images_hash[ps]
+ end
+
+ elsif @md.fns =~/\.(?:ssm\.)?sst$/ \
+ and FileTest.file?("#{dir.path.image_source_include_local}/#{image}")
case images_hash[ps]
when url_image_rgx
images_hash[ps].sub!(url_image_rgx,
- "#{@center_begin}\\\n\\href{#{url}}{\\includegraphics*[width=#{width[ps]}pt]{#{dir.path.image_source_remote_tex}/#{image}}}#{caption}#{@center_end}")
+ "#{@center_begin}\\\n\\href{#{url}}{\\includegraphics*[width=#{width[ps]}pt]{#{dir.path.image_source_include_local}/#{image}}}#{caption} #{@center_end}")
when image_rgx
images_hash[ps].sub!(image_rgx,
- "#{@center_begin}\\\n\\includegraphics*[width=#{width[ps]}pt]{#{dir.path.image_source_remote_tex}/#{image}}#{caption}#{@center_end}")
+ "#{@center_begin}\\\n\\includegraphics*[width=#{width[ps]}pt]{#{dir.path.image_source_include_local}/#{image}}#{caption} #{@center_end}")
end
images_hash[ps]
- elsif FileTest.file?("#{dir.path.image_source_tex}/#{image}")
+ elsif @md.fns =~/\.-ss[tm]$/ \
+ and FileTest.file?("#{dir.path.image_source_include_remote}/#{image}")
case images_hash[ps]
when url_image_rgx
images_hash[ps].sub!(url_image_rgx,
- "#{@center_begin}\\\n\\href{#{url}}\n{\\includegraphics*[width=#{width[ps]}pt]{#{dir.path.image_source_tex}/#{image}}}#{caption}#{@center_end}")
+ "#{@center_begin}\\\n\\href{#{url}}{\\includegraphics*[width=#{width[ps]}pt]{#{dir.path.image_source_include_remote}/#{image}}}#{caption}#{@center_end}")
when image_rgx
images_hash[ps].sub!(image_rgx,
- "#{@center_begin}\\\n\\includegraphics*[width=#{width[ps]}pt]{#{dir.path.image_source_tex}/#{image}}#{caption}#{@center_end}")
+ "#{@center_begin}\\\n\\includegraphics*[width=#{width[ps]}pt]{#{dir.path.image_source_include_remote}/#{image}}#{caption}#{@center_end}")
end
images_hash[ps]
else
- SiSU_Screen::Ansi.new(@md.cmd,"ERROR - image:",%{"#{image}" missing},"search locations: #{dir.path.image_source_local_tex},#{dir.path.image_source_remote_tex} and #{dir.path.image_source_tex}").error2 unless @md.cmd =~/q/
+ SiSU_Screen::Ansi.new(@md.opt.cmd,"ERROR - image:",%{"#{image}" missing},"search locations: #{dir.path.image_source_include_local},#{dir.path.image_source_include_remote} and #{dir.path.image_source_include}").error2 unless @md.opt.cmd =~/q/
if images_hash[ps] =~url_image_rgx \
or images_hash[ps] =~image_rgx
images_hash[ps]=''
@@ -595,13 +698,13 @@ module SiSU_TeX_Pdf
images_hash
use_images_hash={}
images_hash.each do |k,t|
- use_images_hash[k]={ :l =>t, :p =>t}
+ use_images_hash[k]={ l: t, p: t}
end
dob.tmp=use_images_hash
dob
end
def title
- title=SiSU_TeX_Pdf::Special_characters.new(@md,@md.title.full).special_characters_safe
+ title=SiSU_TeX_Pdf::SpecialCharacters.new(@md,@md.title.full).special_characters_safe
"\n\\title{#{title}}"
end
def title_landscape
@@ -611,12 +714,12 @@ module SiSU_TeX_Pdf
title
end
end
- class Format_head
- require "#{SiSU_lib}/i18n" # defaults.rb
+ class FormatHead
+ require_relative 'prog_text_translation' # prog_text_translation.rb
def initialize(md,t_o)
@md,@t_o=md,t_o
- @env=SiSU_Env::Info_env.new(@md.fns)
- if t_o.class==Hash
+ @env=SiSU_Env::InfoEnv.new(@md.fns)
+ if t_o.is_a?(Hash)
@txt =t_o[:txt] || nil
@subtitle=t_o[:subtitle] || nil
@ps=t_o[:paper_size] || nil
@@ -626,28 +729,73 @@ module SiSU_TeX_Pdf
p t_o.class
p caller
end
- @tx=SiSU_Env::Get_init.instance.tex
- @brace_url=SiSU_Viz::Skin.new.url_decoration
- @tex2pdf=@@tex3pdf ||=SiSU_Env::System_call.new.tex2pdf_engine
+ @tx=SiSU_Env::GetInit.new.tex
+ @brace_url=SiSU_Viz::Defaults.new.url_decoration
+ @tex2pdf=@@tex3pdf ||=SiSU_Env::SystemCall.new.tex2pdf_engine
@ps=@txt if @txt=~/(?:a4|letter|legal|book|a5|b5)/i
- @lang ||=SiSU_i18n::Language.new(@md)
+ @lang ||=SiSU_i18n::Languages.new #.list[@md.opt.lng][:xlp]
+ @author=if defined? @md.creator.author \
+ and @md.creator.author=~/\S+/
+ SiSU_TeX_Pdf::SpecialCharacters.new(@md,@md.creator.author).special_characters_safe
+ else ''
+ end
+ @subject=if defined? @md.classify.subject \
+ and @md.classify.subject=~/\S+/
+ SiSU_TeX_Pdf::SpecialCharacters.new(@md,@md.classify.subject).special_characters_safe
+ else ''
+ end
+ @keywords=if defined? @md.classify.keywords \
+ and @md.classify.keywords=~/\S+/
+ SiSU_TeX_Pdf::SpecialCharacters.new(@md,@md.classify.keywords).special_characters_safe
+ else ''
+ end
end
def tex_head_lang #babel 18n
lang_char_arr=@md.i18n
- mainlang_char=lang_char_arr.slice(0)
- mainlang=@lang.tex_name(mainlang_char)
- otherlang=[]
- lang_char_arr.slice(1..9).each { |ch| otherlang << @lang.tex_name(ch) }
+ mainlang_char=if @md.i18n == Array \
+ and @md.i18n.length > 0
+ lang_char_arr.slice(0)
+ else @md.opt.lng
+ end
+ mainlang=@lang.list[mainlang_char][:xlp]
+ otherlang=if mainlang != 'english'
+ [ @lang.list['en'][:xlp] ]
+ else []
+ end
+ if lang_char_arr.length > 0
+ lang_char_arr.slice(1..9).each { |ch| otherlang << @lang.list[ch][:xlp] }
+ otherlang=otherlang.uniq
+ end
otherlang=otherlang.join(',')
- { :mainlang=>mainlang, :otherlang=>otherlang }
+ { mainlang: mainlang, otherlang: otherlang }
end
def tex_head_encode
- texpdf_font=if defined? @md.make.texpdf_font \
- and not @md.make.texpdf_font.nil? \
- and @md.make.texpdf_font=~/\S{3,}/
- @md.make.texpdf_font
- else @env.font.texpdf
+ texpdf_font=if defined? @md.make.texpdf_font.main \
+ and not @md.make.texpdf_font.main.nil? \
+ and @md.make.texpdf_font.main=~/\S{3,}/
+ @md.make.texpdf_font.main
+ else @env.font.texpdf.main
+ end
+ texpdf_font_sans=if defined? @md.make.texpdf_font.sans \
+ and not @md.make.texpdf_font.sans.nil? \
+ and @md.make.texpdf_font.sans=~/\S{3,}/ # not used
+ @md.make.texpdf_font.sans
+ else @env.font.texpdf.sans
end
+ texpdf_font_serif=if defined? @md.make.texpdf_font.serif \
+ and not @md.make.texpdf_font.serif.nil? \
+ and @md.make.texpdf_font.serif=~/\S{3,}/ # not used
+ @md.make.texpdf_font.serif
+ else @env.font.texpdf.serif
+ end
+ texpdf_font_mono=if defined? @md.make.texpdf_font.mono \
+ and not @md.make.texpdf_font.mono.nil? \
+ and @md.make.texpdf_font.mono=~/\S{3,}/
+ @md.make.texpdf_font.mono
+ else @env.font.texpdf.mono
+ end
+ # you may wish to check selected font against avaiable fonts:
+ # fc-list :outline -f "%{family}\n"
case @tex2pdf
when /xe/
<<WOK
@@ -655,6 +803,9 @@ module SiSU_TeX_Pdf
\\setmainlanguage{#{tex_head_lang[:mainlang]}}
\\setotherlanguage{#{tex_head_lang[:otherlang]}}
\\setmainfont{#{texpdf_font}}
+\\setmonofont[Scale=0.85]{#{texpdf_font_mono}}
+% \\setsansfont{#{texpdf_font_sans}}
+% \\setromanfont{#{texpdf_font_serif}}
WOK
when /pdf/
if @md.file_encoding =~ /iso-?8859/i #% iso8859
@@ -672,7 +823,7 @@ WOK
end
end
def tex_head_info
- generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version]
+ generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version]
lastdone="Last Generated on: #{Time.now}"
rubyv="Ruby version: #{@md.ruby_version}"
<<WOK
@@ -689,9 +840,9 @@ WOK
<<WOK
#{tex_head_info}
\\documentclass[#{d[:fontsize]},#{d[:papertype]},titlepage]{scrartcl} %with titlepage
-\\setlength{\\textheight}{#{d[:textheight]}mm} \\setlength{\\textwidth}{#{d[:textwidth]}mm}
-\\setlength{\\oddsidemargin}{#{d[:oddsidemargin]}} \\setlength{\\evensidemargin}{#{d[:evensidemargin]}}
-\\setlength{\\topmargin}{#{d[:topmargin]}} \\setlength{\\headheight}{#{d[:headheight]}}
+\\setlength{\\textheight}{#{d[:textheight]}mm} \\setlength{\\textwidth}{#{d[:textwidth]}mm}
+\\setlength{\\oddsidemargin}{#{d[:oddsidemargin]}} \\setlength{\\evensidemargin}{#{d[:evensidemargin]}}
+\\setlength{\\topmargin}{#{d[:topmargin]}} \\setlength{\\headheight}{#{d[:headheight]}}
\\setlength{\\headsep}{#{d[:headsep]}}
\\setlength{\\marginparsep}{#{d[:marginparsep]}}
\\setlength{\\marginparwidth}{#{d[:marginparwidth]}}
@@ -702,9 +853,9 @@ WOK
<<WOK
#{tex_head_info}
\\documentclass[#{d[:fontsize]},#{d[:papertype]},landscape,titlepage,twocolumn]{scrartcl} %with titlepage
-\\setlength{\\textheight}{#{d[:textheight]}mm} \\setlength{\\textwidth}{#{d[:textwidth]}mm}
-\\setlength{\\oddsidemargin}{#{d[:oddsidemargin]}} \\setlength{\\evensidemargin}{#{d[:evensidemargin]}}
-\\setlength{\\topmargin}{#{d[:topmargin]}} \\setlength{\\headheight}{#{d[:headheight]}}
+\\setlength{\\textheight}{#{d[:textheight]}mm} \\setlength{\\textwidth}{#{d[:textwidth]}mm}
+\\setlength{\\oddsidemargin}{#{d[:oddsidemargin]}} \\setlength{\\evensidemargin}{#{d[:evensidemargin]}}
+\\setlength{\\topmargin}{#{d[:topmargin]}} \\setlength{\\headheight}{#{d[:headheight]}}
\\setlength{\\headsep}{#{d[:headsep]}}
\\setlength{\\columnsep}{#{d[:columnsep]}}
\\setlength{\\marginparsep}{#{d[:marginparsep]}}
@@ -715,9 +866,9 @@ WOK
<<WOK
#{tex_head_info}
\\documentclass[#{d[:fontsize]},#{d[:papertype]},titlepage]{scrartcl} %with titlepage
-\\setlength{\\textheight}{#{d[:textheight]}mm} \\setlength{\\textwidth}{#{d[:textwidth]}mm}
-\\setlength{\\oddsidemargin}{#{d[:oddsidemargin]}} \\setlength{\\evensidemargin}{#{d[:evensidemargin]}}
-\\setlength{\\topmargin}{#{d[:topmargin]}} \\setlength{\\headheight}{#{d[:headheight]}}
+\\setlength{\\textheight}{#{d[:textheight]}mm} \\setlength{\\textwidth}{#{d[:textwidth]}mm}
+\\setlength{\\oddsidemargin}{#{d[:oddsidemargin]}} \\setlength{\\evensidemargin}{#{d[:evensidemargin]}}
+\\setlength{\\topmargin}{#{d[:topmargin]}} \\setlength{\\headheight}{#{d[:headheight]}}
\\setlength{\\headsep}{#{d[:headsep]}}
\\setlength{\\marginparsep}{#{d[:marginparsep]}}
\\setlength{\\marginparwidth}{#{d[:marginparwidth]}}
@@ -816,10 +967,9 @@ WOK
\\usepackage[#{@tex2pdf},
#{color.strip}
pdftitle={#{@txt}},
-% pdftitle={Untitled},
- pdfauthor={LM-sisu-scribe},
- pdfsubject={law},
- pdfkeywords={law},
+ pdfauthor={#{@author}},
+ pdfsubject={#{@subject}},
+ pdfkeywords={#{@keywords}},
pageanchor=true,
plainpages=true,
pdfpagelabels=true,
@@ -874,6 +1024,20 @@ WOK
WOK
end
end
+ def tex_head_codeblock(codeblock_box_type)
+ codeblock_box=if codeblock_box_type=='listings'
+ <<WOK
+\\usepackage{listings}
+\\usepackage{color}
+\\usepackage{textcomp}
+WOK
+ elsif codeblock_box_type=='boites'
+ "\\usepackage{boites}"
+ else
+ "\\usepackage{boites}"
+ end
+ codeblock_box
+ end
def tex_head_misc
<<WOK
\\usepackage{textcomp}
@@ -881,6 +1045,7 @@ WOK
\\usepackage[normalem]{ulem}
\\usepackage{soul}
\\usepackage{longtable}
+\\usepackage[tc]{titlepic}
\\usepackage{graphicx}
\\makeatletter
\\parindent0pt
@@ -889,14 +1054,15 @@ WOK
% amssymb used for backslash
WOK
end
- def document_head_with_orientation
+ def document_head_with_orientation(codeblock_box_type)
endnotes=("\\usepackage{endnotes}" if @txt =~/endnotes?/)||'' #not implemented see also def endnotes
- @lang.tex_name(@md.i18n[0])
+ @lang.list[@md.i18n[0]][:xlp]
<<WOK
#{tex_head_paper}
#{tex_head_encode}
#{tex_head_pdftex_dvi}
#{tex_head_misc}
+#{tex_head_codeblock(codeblock_box_type)}
\\setcounter{secnumdepth}{2}
\\setcounter{tocdepth}{4}
\\makeatletter
@@ -916,6 +1082,19 @@ WOK
\\item[]
}
{\\end{list}}
+
+\\newenvironment{ParagraphHang}[2]%
+{
+\\begin{list}{}{%
+\\setlength\\topsep{0pt}%
+\\addtolength{\\leftmargin}{#1}
+\\itemindent=#2
+\\setlength\\parsep{0pt plus 1pt}%
+}
+\\item[]
+}
+{\\end{list}}
+
\\newenvironment{Bullet}[1]%
{
\\begin{list}{}{%
@@ -954,20 +1133,65 @@ WOK
{-\\baselineskip}{0.5\\baselineskip}%
{\\normalfont\\normalsize\\itshape\\raggedright}}
% \\makeatother
-\\selectlanguage{#{@lang.tex_name(@md.i18n[0])}}
+\\selectlanguage{#{@lang.list[@md.i18n[0]][:xlp]}}
WOK
end
def a4generic
end
end
- class Special_characters
- def initialize(md,str,is='')
+ class SpecialCharacters
+ def initialize(md,str,is=:default)
@md,@txt,@is=md,str,is
- @brace_url=SiSU_Viz::Skin.new.url_decoration
- @tex2pdf=@@tex3pdf ||=SiSU_Env::System_call.new.tex2pdf_engine
+ @brace_url=SiSU_Viz::Defaults.new.url_decoration
+ @tex2pdf=@@tex3pdf ||=SiSU_Env::SystemCall.new.tex2pdf_engine
end
- def xetex_special_characters_1(str,is='') # ~ ^ $ & % _ { } #LaTeX special characters - KEEP list
- #str=Iconv.conv('ISO-8859-1', 'UTF-8', @txt)
+ def xetex_code_listings(str,is=:default) # ~ ^ $ & % _ { } #LaTeX special characters - KEEP list
+ word=str.scan(/\S+|\n/) #unless line =~/^(?:@\S|%+\s)/
+ para_array=[]
+ str=if word
+ word.each do |w| # _ - / # | : ! ^ ~
+ w=w.gsub(/#{Mx[:gl_o]}#lt#{Mx[:gl_c]}/,'<').gsub(/#{Mx[:gl_o]}#gt#{Mx[:gl_c]}/,'>').
+ gsub(/[\\]?~/,'~').
+ gsub(/[#{Mx[:br_line]}#{Mx[:br_paragraph]}]/,"\n"). #watch
+ gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/,'~'). #126 usual
+ gsub(/\\?\||#{Mx[:gl_o]}#124#{Mx[:gl_c]}/,'|') #unless is=='code' #unless w=~/<~\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+>/ # | SiSU not really special sisu character but done, also LaTeX
+ para_array << w
+ end
+ str=para_array.join(' ')
+ str=str.strip unless is==:code
+ str
+ else ''
+ end
+ str=str.gsub(/\s*#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}\s*/,' ').
+ gsub(/.+?<-#>/,'').
+ gsub(/#{Mx[:br_eof]}/,'').
+ gsub(/#{Mx[:br_endnotes]}/,'').
+ #problem sequence ->
+ gsub(/&(?:lt|#060);/,'<'). # < SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#(?:gt|062)#{Mx[:gl_c]}/,'>'). # > SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{'). # { SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}'). # } SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/,'~'). # ~ SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#'). # # SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!'). # ! SiSU not really special sisu character but done, also LaTeX
+ #gsub(/(^|\s)\*\s/,'\1\asterisk '). # * should you wish to escape astrisk e.g. describing \*{bold}*
+ gsub(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*'). # * should you wish to escape astrisk e.g. describing \*{bold}*
+ gsub(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-'). # - SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#043#{Mx[:gl_c]}/,'+'). # + SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#044#{Mx[:gl_c]}/,','). # + SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#038#{Mx[:gl_c]}/,'&'). #unless @txt=~/<:code>/ # / SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/'). # / SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#092#{Mx[:gl_c]}/,'\\'). # \ SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_'). # _ SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#124#{Mx[:gl_c]}/,'|'). # | SiSU not really special sisu character but done, also LaTeX
+ gsub(/#{Mx[:gl_o]}#058#{Mx[:gl_c]}/,':'). # : SiSU not really special sisu character but done, also LaTeX
+ gsub(/#{Mx[:gl_o]}#094#{Mx[:gl_c]}|\^/,'^'). # ^ SiSU not really special sisu character but done, also LaTeX
+ ##watch placement, problem sequence ^
+ gsub(/<sup><font face=symbol>&atild;<\/font><\/sup>/,' ').
+ gsub(/\\copy(right|mark)?/,'<=copymark>') # ok problem with superscript
+ end
+ def xetex_special_characters_1(str,is=:default) # ~ ^ $ & % _ { } #LaTeX special characters - KEEP list
+ #str=Iconv.conv('ISO-8859-1', 'UTF-8', @txt) # `require': iconv will be deprecated in the future, use String#encode instead.
word=str.scan(/\S+|\n/) #unless line =~/^(?:@\S|%+\s)/
para_array=[]
str=if word
@@ -975,166 +1199,149 @@ WOK
if w !~/https?:/ \
and w=~/\/\S+?\// \
and w.length > 6
- w.gsub!(/([_.\/])/,'\1\-')
+ w=w.gsub(/([_.\/])/,'\1\-')
end
- w.gsub!(/#{Mx[:gl_o]}#lt#{Mx[:gl_c]}/,'<'); w.gsub!(/#{Mx[:gl_o]}#gt#{Mx[:gl_c]}/,'>')
- w.gsub!(/[\\]?~/,'<=tilde>')
- w.gsub!(/[#{Mx[:br_line]}#{Mx[:br_paragraph]}]/,' \newline ') #watch
- w.gsub!(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/,'<=tilde>') #126 usual
- w.gsub!(/\\?\||#{Mx[:gl_o]}#124#{Mx[:gl_c]}/,'<=pipe>') #unless is=='code' #unless w=~/<~\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+>/ # | SiSU not really special sisu character but done, also LaTeX
+ w=w.gsub(/#{Mx[:gl_o]}#lt#{Mx[:gl_c]}/,'<').gsub(/#{Mx[:gl_o]}#gt#{Mx[:gl_c]}/,'>').
+ gsub(/[\\]?~/,'<=tilde>').
+ gsub(/[#{Mx[:br_line]}#{Mx[:br_paragraph]}]/,' \newline '). #watch
+ gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/,'<=tilde>'). #126 usual
+ gsub(/\\?\||#{Mx[:gl_o]}#124#{Mx[:gl_c]}/,'\pipe') #unless is=='code' #unless w=~/<~\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+>/ # | SiSU not really special sisu character but done, also LaTeX
if w !~/#{Mx[:rel_o]}/ \
and w !~/#{Mx[:gl_o]}#/
- w.gsub!(/\#/,'<=hash>')
+ w=w.gsub(/\#/,'<=hash>')
end
para_array << w
end
str=para_array.join(' ')
- str=str.strip unless is=='code'
+ str=str.strip unless is==:code
str
else ''
end
- str.gsub(/\s*#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}\s*/,' ')
- str.gsub!(/.+?<-#>/,'')
- str.gsub!(/#{Mx[:br_eof]}/,'')
- str.gsub!(/#{Mx[:br_endnotes]}/,'')
+ str=str.gsub(/\s*#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}\s*/,' ').
+ gsub(/.+?<-#>/,'').
+ gsub(/#{Mx[:br_eof]}/,'').
+ gsub(/#{Mx[:br_endnotes]}/,'')
#problem sequence ->
- str.gsub!(/&(?:nbsp);|#{Mx[:nbsp]}/,'<=hardspace>') unless is=='code' # < SiSU special character also LaTeX
- str.gsub!(/&(?:lt|#060);/,'<=lt>') # < SiSU special character also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#(?:gt|062)#{Mx[:gl_c]}/,'<=gt>') # > SiSU special character also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'<=curlyopen>') # { SiSU special character also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'<=curlyclose>') # } SiSU special character also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/,'<=tilde>') # ~ SiSU special character also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'\#') # # SiSU special character also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!') # ! SiSU not really special sisu character but done, also LaTeX
- str.gsub!(/(^|\s)\*\s/,'\1\asterisk ') # * should you wish to escape astrisk e.g. describing \*{bold}*
- str.gsub!(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'\*') # * should you wish to escape astrisk e.g. describing \*{bold}*
- str.gsub!(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-') # - SiSU special character also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#043#{Mx[:gl_c]}/,'+') # + SiSU special character also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#044#{Mx[:gl_c]}/,',') # + SiSU special character also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#038#{Mx[:gl_c]}/,'<=amp>') #unless @txt=~/<:code>/ # / SiSU special character also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'<=slash>') # / SiSU special character also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#092#{Mx[:gl_c]}/,'<=backslash>') # \ SiSU special character also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'<=underscore>') # _ SiSU special character also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#124#{Mx[:gl_c]}/,'|') # | SiSU not really special sisu character but done, also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#058#{Mx[:gl_c]}/,':') # : SiSU not really special sisu character but done, also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#094#{Mx[:gl_c]}|\^/,'<=caret>') # ^ SiSU not really special sisu character but done, also LaTeX
+ str=str.gsub(/&(?:nbsp);|#{Mx[:nbsp]}/,'\hardspace') unless is==:code # < SiSU special character also LaTeX
+ str=str.gsub(/&(?:lt|#060);/,'\lt'). # < SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#(?:gt|062)#{Mx[:gl_c]}/,'\gt'). # > SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'\curlyopen'). # { SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'\curlyclose'). # } SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/,'<=tilde>'). # ~ SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'\#'). # # SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!'). # ! SiSU not really special sisu character but done, also LaTeX
+ gsub(/(^|\s)\*\s/,'\1\asterisk '). # * should you wish to escape astrisk e.g. describing \*{bold}*
+ gsub(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'\*'). # * should you wish to escape astrisk e.g. describing \*{bold}*
+ gsub(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-'). # - SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#043#{Mx[:gl_c]}/,'+'). # + SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#044#{Mx[:gl_c]}/,','). # + SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#038#{Mx[:gl_c]}/,'<=amp>'). #unless @txt=~/<:code>/ # / SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'\slash'). # / SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#092#{Mx[:gl_c]}/,'\textbackslash'). # \ SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'<=underscore>'). # _ SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#124#{Mx[:gl_c]}/,'|'). # | SiSU not really special sisu character but done, also LaTeX
+ gsub(/#{Mx[:gl_o]}#058#{Mx[:gl_c]}/,':'). # : SiSU not really special sisu character but done, also LaTeX
+ gsub(/#{Mx[:gl_o]}#094#{Mx[:gl_c]}|\^/,'\caret'). # ^ SiSU not really special sisu character but done, also LaTeX
##watch placement, problem sequence ^
- str.gsub!(/<sup><font face=symbol>&atild;<\/font><\/sup>/,' ')
- str.gsub!(/\\copy(right|mark)?/,'<=copymark>') # ok problem with superscript
- str
- end
- def xetex_special_characters_2(str,is='')
- str.gsub!(/#{Mx[:gl_o]}#156#{Mx[:gl_c]}/,'\oe ')
- str.gsub!(/\$/,'\$')
- str.gsub!(/\#/,'\#')
- str.gsub!(/\%/,'\%')
- str.gsub!(/\~/,'\~') #revist, should not be necessary to mark remaining tildes
+ gsub(/<sup><font face=symbol>&atild;<\/font><\/sup>/,' ').
+ gsub(/\\copy(right|mark)?/,'<=copymark>') # ok problem with superscript
+ end
+ def xetex_special_characters_2(str,is=:default)
+ str=str.gsub(/#{Mx[:gl_o]}#156#{Mx[:gl_c]}/,'\oe ').
+ gsub(/\$/,'\$').
+ gsub(/\#/,'\#').
+ gsub(/\%/,'\%').
+ gsub(/\~/,'\~') #revist, should not be necessary to mark remaining tildes
if str !~/^\s*#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}image\s/
- str.gsub!(/_/,'\_')
+ str=str.gsub(/_/,'\_')
end
- str.gsub!(/\{/,'\{')
- str.gsub!(/\}/,'\}')
- if is=='code'
- str.gsub!(/&/,'{\\\&}')
- str.gsub!(/\\~(\\\{)/,'{$\tilde$}\1')
- str.gsub!(/(\\\})\\~/,'\1{$\tilde$}')
- str.gsub!(/\\~(\[)/,'{$\tilde$}\1')
- str.gsub!(/(\])\\~/,'\1{$\tilde$}')
- str.gsub!(/<=tilde>/,'{$\tilde$}')
- str.gsub!(/<=pipe>/,'{\textbar}')
- str.gsub!(/<=caret>/,'{\^{~}}')
- str.gsub!(/<=hash>/,'{\#}')
+ str=str.gsub(/\{/,'\{').
+ gsub(/\}/,'\}')
+ str=if is==:code
+ str.gsub(/&/,'{\\\&}').
+ gsub(/\\~(\\\{)/,'{$\tilde$}\1').
+ gsub(/(\\\})\\~/,'\1{$\tilde$}').
+ gsub(/\\~(\[)/,'{$\tilde$}\1').
+ gsub(/(\])\\~/,'\1{$\tilde$}').
+ gsub(/<=tilde>/,'{$\tilde$}').
+ gsub(/<=hash>/,'{\#}')
else
- str.gsub!(/&nbsp;|#{Mx[:nbsp]}/,'~') # ~ character for hardspace
- str.gsub!(/&/,'<=amp>')
+ str.gsub(/&nbsp;|#{Mx[:nbsp]}/,'~'). # ~ character for hardspace
+ gsub(/&/,'<=amp>')
end
- str.gsub!(/&\S+?;/,' ')
- str.gsub!(/§/u,'\S') #latex: space between next character not preserved? #str.gsub!(/§ /,'\S ')
- str.gsub!(/£/u,'\pounds')
- str.gsub!(/<a href=".+?">/,' ')
- str.gsub!(/<\/a>/,' ')
- str.gsub!(/((?:^|\s)#{Mx[:lnk_c]})#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
- '\1\begin{scriptsize}\url{\2}\end{scriptsize}\3') #special case \{ e.g. \}http://url
- str.gsub!(/#{Mx[:url_o]}\\_(\S+?)#{Mx[:url_c]}/,
- '\begin{scriptsize}\url{\1}\end{scriptsize}') #special case \{ e.g. \}http://url
- str.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,
- '\begin{scriptsize}\\url{\1}\end{scriptsize}') #specially escaped url no decoration
- unless is=='code'
- str.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"\s]+?)([;.,]?(?=\s|$))/,
+ str=str.gsub(/&\S+?;/,' ').
+ gsub(/§/u,'\S'). #latex: space between next character not preserved? #str.gsub(/§ /,'\S ')
+ gsub(/£/u,'\pounds').
+ gsub(/<a href=".+?">/,' ').
+ gsub(/<\/a>/,' ').
+ gsub(/((?:^|\s)#{Mx[:lnk_c]})#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
+ '\1\begin{scriptsize}\url{\2}\end{scriptsize}\3'). #special case \{ e.g. \}http://url
+ gsub(/#{Mx[:url_o]}\\_(\S+?)#{Mx[:url_c]}/,
+ '\begin{scriptsize}\url{\1}\end{scriptsize}'). #special case \{ e.g. \}http://url
+ gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,
+ '\begin{scriptsize}\\url{\1}\end{scriptsize}') #specially escaped url no decoration
+ unless is==:code
+ str=str.gsub(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"\s]+?)([;.,]?(?=\s|$))/,
"\\1#{@brace_url.tex_open}\\begin{scriptsize}\\url{\\2}\\end{scriptsize}#{@brace_url.tex_close}\\3") #url matching with decoration <url> positive lookahead, sequence issue with { linked }http://url cannot use \b at start
- else #code-block: angle brackets special characters, note _ already escaped
- str.gsub!(/\\_</m,'{\UseTextSymbol{OML}{<}}')
- str.gsub!(/\\_>/m,'{\UseTextSymbol{OML}{>}}')
end
- str.gsub!(/<:ee>/,'')
- str.gsub!(/<!>/,' ')
- #proposed change, insert, but may be redundant
- str.gsub!(/<(br|p)>|<\/\s*(br|p)>|<(br|p)\s*\/>/," #{Tex[:backslash]*2} ") # Work Area
- str.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\begin{bfseries}\1 \end{bfseries}')
- str.gsub!(/<h\d+>(.+?)<\/h\d+>/,'\begin{bfseries}\1 \end{bfseries}')
- str.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\emph{\1}')
- str.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\uline{\1}') # ulem
- str.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,"``\\1''") # quote #CHECK
- str.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'\uline{\1}') # ulem
- str.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'\sout{\1}') # ulem
- str.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,"\$^{\\textrm{\\1}}\$")
- str.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,"\$_{\\textrm{\\1}}\$")
- str.gsub!(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'\begin{monosp}\1\end{monosp}')
- unless is=='code'
- str.gsub!(/"(.+?)"/,'“\1”') # quote marks / quotations open & close " need condition exclude for code
- str.gsub!(/\s+"/,' “') # open "
- str.gsub!(/^(#{Mx[:lv_o]}[1-6-]:\S*?#{Mx[:lv_c]}|<.+?>)?\s*"/,'\1“') #fix Mx[:lv_o] # open "
- str.gsub!(/"(\s|\.|,|:|;)/,'”\1') # close "
- str.gsub!(/"(#{Mx[:lv_o]}[1-6-]:\S*?#{Mx[:lv_c]}|<.+?>)?\s*$/,'”\1') #fix Mx[:lv_o] # close "
- str.gsub!(/"(\.|,)/,'”') # close "
- str.gsub!(/\s+'/,' `') # open '
- str.gsub!(/^(#{Mx[:lv_o]}[1-6-]:\S*?#{Mx[:lv_c]}|<.+?>)?\s*'/,'\1`') #fix Mx[:lv_o] # open '
+ str=str.gsub(/<:ee>/,'').
+ gsub(/<!>/,' '). #proposed change, insert, but may be redundant
+ gsub(/<(br|p)>|<\/\s*(br|p)>|<(br|p)\s*\/>/," #{Tex[:backslash]*2} "). # Work Area
+ gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\begin{bfseries}\1 \end{bfseries}').
+ gsub(/<h\d+>(.+?)<\/h\d+>/,'\begin{bfseries}\1 \end{bfseries}').
+ gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\emph{\1}').
+ gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\uline{\1}'). # ulem
+ gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,"``\\1''"). # quote #CHECK
+ gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'\uline{\1}'). # ulem
+ gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'\sout{\1}'). # ulem
+ gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,"\$^{\\textrm{\\1}}\$").
+ gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,"\$_{\\textrm{\\1}}\$").
+ gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'\begin{monosp}\1\end{monosp}')
+ unless is==:code
+ str=str.gsub(/"(.+?)"/,'“\1”'). # quote marks / quotations open & close " need condition exclude for code
+ gsub(/\s+"/,' “'). # open "
+ gsub(/^(#{Mx[:lv_o]}[1-6-]:\S*?#{Mx[:lv_c]}|<.+?>)?\s*"/,'\1“'). #fix Mx[:lv_o] # open "
+ gsub(/"(\s|\.|,|:|;)/,'”\1'). # close "
+ gsub(/"(#{Mx[:lv_o]}[1-6-]:\S*?#{Mx[:lv_c]}|<.+?>)?\s*$/,'”\1'). #fix Mx[:lv_o] # close "
+ gsub(/"(\.|,)/,'”'). # close "
+ gsub(/\s+'/,' `'). # open '
+ gsub(/^(#{Mx[:lv_o]}[1-6-]:\S*?#{Mx[:lv_c]}|<.+?>)?\s*'/,'\1`') #fix Mx[:lv_o] # open '
end
- str.gsub!(/(<font.*?>|<\/font>)/,'')
- str.gsub!(/\s*#{Mx[:fa_superscript_o]}(\S+?)#{Mx[:fa_superscript_c]}/,'^\1')
+ str=str.gsub(/(<font.*?>|<\/font>)/,'').
+ gsub(/\s*#{Mx[:fa_superscript_o]}(\S+?)#{Mx[:fa_superscript_c]}/,'^\1')
str
end
def xetex_special_characters_3(str)
- str.gsub!(/<br(\s*[^\/][^>])/,'\1') # clean up, incredibly messy :-( footnote indents, problems if match exists in ordinary paragraphs? check! Work Area 200501 a bit tricky as must be able to match multiple times, and to clean remainder
- str.gsub!(/([^<][^b][^r]\s+)\/>/,'\1') # clean up, incredibly messy :-( footnote indents, problems if match exists in ordinary paragraphs? check! Work Area 200501 a bit tricky as must be able to match multiple times, and to clean remainder
- #problem sequence (another kludge) ->
- str.gsub!(/<=lt>/m,'{\UseTextSymbol{OML}{<}}')
- str.gsub!(/<=gt>/m,'{\UseTextSymbol{OML}{>}}')
- str.gsub!(/<=underscore>/,'\_')
+ str=str.gsub(/<br(\s*[^\/][^>])/,'\1'). # clean up, incredibly messy :-( footnote indents, problems if match exists in ordinary paragraphs? check! Work Area 200501 a bit tricky as must be able to match multiple times, and to clean remainder
+ gsub(/([^<][^b][^r]\s+)\/>/,'\1') # clean up, incredibly messy :-( footnote indents, problems if match exists in ordinary paragraphs? check! Work Area 200501 a bit tricky as must be able to match multiple times, and to clean remainder
while str =~/(https?:\/\/\S+?)(?:<=tilde>\S+)+/ #tilde in urls \href treated differently from text #FIX
- str.gsub!(/(https?:\/\/\S+?)(?:<=tilde>(\S+))+/,'\1~\2')
+ str=str.gsub(/(https?:\/\/\S+?)(?:<=tilde>(\S+))+/,'\1~\2')
end
- str.gsub!(/<=tilde>/,'{$\tilde$}')
- str.gsub!(/<=pipe>/,'{\textbar}')
- str.gsub!(/<=caret>/,'{\^{~}}')
- str.gsub!(/<=exclaim>/,'\Verbatim{!}')
- str.gsub!(/(https?:\/\/\S+?)(?:(?:<=hash>)(\S+))+/,'\1#\2') #hash in urls \href treated differently from text #FIX
- str.gsub!(/<=hash>/,'{\#}')
- str.gsub!(/<=hardspace>/,'{~}') #changed ... 2005
+ str=str.gsub(/<=tilde>/,'{$\tilde$}').
+ gsub(/(https?:\/\/\S+?)(?:(?:<=hash>)(\S+))+/,'\1#\2'). #hash in urls \href treated differently from text #FIX
+ gsub(/<=hash>/,'{\#}')
while str =~/(https?:\/\/\S+?)(?:<=amp>\S+)+/ #amp in urls \href treated differently from text #FIX
- str.gsub!(/(https?:\/\/\S+?)(?:<=amp>(\S+))+/,'\1&\2')
+ str=str.gsub(/(https?:\/\/\S+?)(?:<=amp>(\S+))+/,'\1&\2')
end
- str.gsub!(/<=amp>/,'{\\\&}') #changed ... 2005
- str.gsub!(/<=slash>/,'{/}')
- str.gsub!(/<=backslash>/,'{\textbackslash}')
- str.gsub!(/<=copymark>\s*(.+)/,
- '^\copyright \textnormal{\1} \2') # watch likely to be problematic
+ str=str.gsub(/<=amp>/,'{\\\&}'). #changed ... 2005
+ gsub(/<=copymark>\s*(.+)/,
+ '^\copyright \textnormal{\1} \2') # watch likely to be problematic
str
end
- def special_characters_curly(str)
- str.gsub!(/<=curlyopen>/,'\{')
- str.gsub!(/<=curlyclose>/,'\}')
- str
+ def special_characters_safe_close(str)
+ str=str.gsub(/<=tilde>/,'{$\tilde$}').
+ gsub(/<=hash>/,'{\#}').
+ gsub(/<=amp>/,'{\\\&}'). #changed ... 2005
+ gsub(/<=copymark>\s*(.+)/,
+ '^\copyright \textnormal{\1} \2') # watch likely to be problematic
end
def special_characters_code_fix(str)
- str.gsub!(/<=hardspace>/,'{~}')
- str.gsub!(/<=pipe>/,'{\textbar}')
- str.gsub!(/<=tilde>/,'{$\tilde$}')
+ str=str.gsub(/<=tilde>/,'{$\tilde$}')
str
end
def special_characters_unsafe_1(str) #depreciated, make obsolete
# some substitutions are sequence sensitive, rearrange with care.
- str.gsub!(/\\backslash (copyright|clearpage|newpage)/,"\\\\\\1") #kludge bad solution, find out where tail is sent through specChar !
+ str=str.gsub(/\\textbackslash (copyright|clearpage|newpage)/,"\\\\\\1") #kludge bad solution, find out where tail is sent through specChar !
str
end
def special_characters #special characters - some substitutions are sequence sensitive, rearrange with care.
@@ -1147,8 +1354,8 @@ WOK
end
def special_word_break_points
str=@txt
- str.gsub!(/([_,.;:\/|=])/,'\1\-')
- str.gsub!(/(--)(\S{4,})/,'\1\-\2')
+ str=str.gsub(/([_,.;:\/|=])/,'\1\-').
+ gsub(/(--)(\S{4,})/,'\1\-\2')
@txt=str
end
def special_number_break_points
@@ -1160,22 +1367,28 @@ WOK
str,is=@txt,@is
str=xetex_special_characters_1(str,is) unless str.nil?
str=xetex_special_characters_2(str,is) unless str.nil? # remove this to start with, causes issues
+ str=special_characters_safe_close(str) unless str.nil?
+ @txt=str
+ end
+ def characters_code_listings #special characters - some substitutions are sequence sensitive, rearrange with care.
+ str,is=@txt,@is
+ str=xetex_code_listings(str,is) unless str.nil?
@txt=str
end
def special_characters_code
str=@txt
- str.gsub!(/ \\\\([ #{Mx[:br_nl]}]+|$)/,' \textbackslash\textbackslash\hardspace\1')
+ str=str.gsub(/ \\\\([ #{Mx[:br_nl]}]+|$)/,' \textbackslash\textbackslash\hardspace\1')
str
end
end
- class Use_TeX
+ class UseTeX
attr_accessor :url,:txt,:date
def initialize(md)
@md=md
- @vz=SiSU_Env::Get_init.instance.skin
- @date=SiSU_Env::Info_date.new # #{@date.year}
+ @vz=SiSU_Viz::Defaults.new
+ @date=SiSU_Env::InfoDate.new # #{@date.year}
@copymark='{\\begin{footnotesize}\\raisebox{1ex}{\\copyright}\\end{footnotesize}}'
- @brace_url=SiSU_Viz::Skin.new.url_decoration
+ @brace_url=SiSU_Viz::Defaults.new.url_decoration
end
def skip
"\n\\vspace*{\\smallskipamount} \n"
@@ -1205,25 +1418,18 @@ WOK
end
def header
"\\lhead[ ]{ }\n" +
- "\\chead[ \\fancyplain{} \\bfseries \\footnotesize \\leftmark ]{ \\fancyplain{} \\bfseries \\footnotesize \\rightmark }\n" +
+ "\\chead[ \\fancyplain{} \\bfseries \\footnotesize \\leftmark ]{ \\fancyplain{} \\bfseries \\footnotesize \\rightmark }\n" +
"\\rhead[ ]{ }\n"
end
def footer
- base_prog_txt=if @md.base_program
- case @md.base_program
- when /kdissert/i; " \\\\ \\href{http://freehackers.org/~tnagy/kdissert/}{Kdissert}"
- else ''
- end
- else ''
- end
- "\\lfoot[\\textrm{\\thepage}]{\\tiny \\href{#{@vz.url_footer_signature}}{#{@vz.txt_signature}}#{base_prog_txt}}\n" +
- "\\cfoot[\\href{#{@vz.url_home}}{#{@vz.url_txt}}]{\\href{#{@vz.url_home}}{#{@vz.url_txt}}}\n" +
- "\\rfoot[\\tiny \\href{#{@vz.url_sisu}}{#{@vz.txt_signature}}]{\\textrm{\\thepage}}\n"
+ f="\\lfoot[\\textrm{\\thepage}]{\\tiny \\href{#{@md.footer_links[:left][:url]}}{#{@md.footer_links[:left][:say]}}}\n" +
+ "\\cfoot{\\href{#{@md.footer_links[:center][:url]}}{#{@md.footer_links[:center][:say]}}}\n" +
+ "\\rfoot[\\tiny \\href{}{}]{\\textrm{\\thepage}}\n"
end
def site
if not @vz.url_home.empty? \
and not @vz.url_txt.empty?
- "\n\\date{\\begin{footnotesize} copy @ \\href{#{@vz.url_home}}{#{@vz.url_txt}} \\end{footnotesize}}"
+ "\n\\date{\\begin{tiny} \\end{tiny}}"
else ''
end
end
@@ -1247,7 +1453,7 @@ WOK
end
end
def sisu_rights
- v=SiSU_Env::Info_version.instance.get_version
+ v=SiSU_Env::InfoVersion.instance.get_version
base_prog_txt=if @md.base_program
case @md.base_program
when /kdissert/i; "\n\\\\ This document prepared using \\href{http://freehackers.org/~tnagy/kdissert/}{Kdissert \\ http://freehackers.org/~tnagy/kdissert/ } \\\\ Kdissert is Document Mapping software by Thomas Nagy"
@@ -1275,7 +1481,7 @@ WOK
" \\footnote{%\nGenerated by \\href{http://www.jus.uio.no/sisu}{SiSU} \\ \\href{http://www.jus.uio.no/sisu}{www.jus.uio.no/sisu} \\newline \\href{http://www.sisudoc.org}{www.sisudoc.org} \\\n}"
end
def doc_sc_info
- v=SiSU_Env::Info_version.instance.get_version
+ v=SiSU_Env::InfoVersion.instance.get_version
<<WOK
\\\\
{\\begin{footnotesize}
@@ -1287,7 +1493,7 @@ Generated by \\href{http://www.jus.uio.no/sisu}{SiSU www.jus.uio.no/sisu }\\- ve
WOK
end
def doc_no_sc_info
- v=SiSU_Env::Info_version.instance.get_version
+ v=SiSU_Env::InfoVersion.instance.get_version
<<WOK
\\\\
{\\begin{small}
@@ -1299,16 +1505,6 @@ Generated by \\href{http://www.jus.uio.no/sisu}{SiSU www.jus.uio.no/sisu } \\\\
\\end{small}}&
WOK
end
- def manifest_info
- url=@md.fnb.gsub(/(?:\\)*([$&~%_#}{^])/,'\\\\\1')
- fn=@md.fn[:manifest].gsub(/(?:\\)*([$&~%_#}{^])/,'\\\\\1')
-<<WOK
-{\\begin{footnotesize}
-\\\\ For alternative output formats of this document check:
-\\\\ #{@brace_url.tex_open}\\begin{scriptsize}\\href{#{@vz.url_root_http}/#{url}/#{fn}}{#{@vz.url_root_http}/#{url}/#{fn}}\\end{scriptsize}#{@brace_url.tex_close}
-\\end{footnotesize}}&
-WOK
- end
def endnotes #not used should be inserted before MetaData section which preceeds doc_tail, but is "part of document"
<<WOK
\\subsection*{Endnotes}
@@ -1318,13 +1514,13 @@ WOK
WOK
end
def doc_tail
- dir=SiSU_Env::Info_env.new(@md.fns)
+ dir=SiSU_Env::InfoEnv.new(@md.fns)
base_html="#{dir.url.root}/#{@md.fnb}"
- v=SiSU_Env::Info_version.instance.get_version
- sisu_ico=if FileTest.file?("#{dir.path.image_source_tex}/sisu.png")
- "\\includegraphics*[width=60pt]{#{dir.path.image_source_tex}/sisu.png}"
+ v=SiSU_Env::InfoVersion.instance.get_version
+ sisu_ico=if FileTest.file?("#{dir.path.image_source_include}/sisu.png")
+ "\\includegraphics*[width=60pt]{#{dir.path.image_source_include}/sisu.png}"
else
- SiSU_Screen::Ansi.new(@md.cmd,'WARNING - image directory or image(s) missing:', %{"#{dir.path.image_source_tex}"} ).warn unless @md.cmd =~/q/
+ SiSU_Screen::Ansi.new(@md.opt.cmd,'WARNING - image directory or image(s) missing:', %{"#{dir.path.image_source_include}"} ).warn unless @md.opt.cmd =~/q/
" SiSU "
end
url=@md.fnb.gsub(/(?:\\)*([$&~%_#}{^])/,'\\\\\1')
@@ -1336,13 +1532,13 @@ WOK
\"Support Open Standards and Software Libré for the Information Technology Infrastructure\" RA\\subsubsection*{Information on this document copy #{site}}
\\addcontentsline{toc}{subsection}{Information on this document copy}
{\\begin{footnotesize}
-\\\\ Generated by \\href{http://www.jus.uio.no/sisu/}{SiSU} found at \\href{http://www.jus.uio.no/sisu/}{www.jus.uio.no/sisu} \\begin{tiny}[ #{v[:project]} #{v[:version]} #{v[:date_stamp]} ]\\end{tiny} \\href{http://www.sisudoc.org}{www.sisudoc.org}. SiSU is software for document structuring, publishing and search (using SiSU: object citation numbering, markup, meta-markup, and system) Copyright #{@copymark} 1997, current #{@date.year_static} Ralph Amissah, All Rights Reserved.
+\\\\ Generated by \\href{http://www.jus.uio.no/sisu/}{SiSU} found at \\href{http://www.jus.uio.no/sisu/}{www.jus.uio.no/sisu} \\begin{tiny}[ #{v[:project]} #{v[:version]} #{v[:date_stamp]} ]\\end{tiny} \\href{http://www.sisudoc.org}{www.sisudoc.org}. SiSU is software for document structuring, publishing and search (using SiSU: object citation numbering, markup, meta-markup, and system) Copyright #{@copymark} 1997, current #{@date.year_static} Ralph Amissah, All Rights Reserved.
\\\\ SiSU is released under \\href{http://www.fsf.org/licenses/gpl.html}{GPL 3 } or later (\\href{http://www.fsf.org/licenses/gpl.html}{www.fsf.org/licenses/gpl.html}). {\\end{footnotesize}
{\\begin{small}
-\\\\ W3 since October 3 1993 \\href{http://www.jus.uio.no/sisu/}{#{sisu_ico}}SiSU 1997, current #{@date.year_static}. \\\\ #{sitename} presentations at \\begin{scriptsize}#{site}\\end{scriptsize} \\\\ \\\\ #{@md.title.full} \\textbf{pdf} versions can be found at: \\\\
+\\\\ W3 since October 3 1993 \\href{http://www.jus.uio.no/sisu/}{#{sisu_ico}}SiSU 1997, current #{@date.year_static}. \\\\ #{sitename} presentations at \\begin{scriptsize}#{site}\\end{scriptsize} \\\\ \\\\ #{@md.title.full} \\textbf{pdf} versions can be found at: \\\\
{\\end{small}
-\\\\ #{@brace_url.tex_open}\\begin{scriptsize}\\url{#{@vz.url_root_http}/#{url}/#{@md.fn[:pdf_p]}}\\end{scriptsize}#{@brace_url.tex_close} \\\\
-#{@brace_url.tex_open}\\begin{scriptsize}\\url{#{@vz.url_root_http}/#{url}/#{@md.fn[:pdf_l]}}\\end{scriptsize}#{@brace_url.tex_close} \\\\
+\\\\ #{@brace_url.tex_open}\\begin{scriptsize}\\url{#{@vz.url_root_http}/#{url}/#{@md.fn[:pdf_p]}}\\end{scriptsize}#{@brace_url.tex_close} \\\\
+#{@brace_url.tex_open}\\begin{scriptsize}\\url{#{@vz.url_root_http}/#{url}/#{@md.fn[:pdf_l]}}\\end{scriptsize}#{@brace_url.tex_close} \\\\
\\\\\n#{@md.title.full} \\textbf{html} versions may be found at: \\\\
#{@brace_url.tex_open}\\begin{scriptsize}\\url{#{@vz.url_root_http}/#{url}/#{@md.fn[:toc]}}\\end{scriptsize}#{@brace_url.tex_close} or \\\\
#{@brace_url.tex_open}\\begin{scriptsize}\\url{#{@vz.url_root_http}/#{url}/#{@md.fn[:doc]}}\\end{scriptsize}#{@brace_url.tex_close}
@@ -1358,7 +1554,7 @@ WOK
WOK
end
def mail_tail #not retested, the old mail_tail is commented out and appended to this program
- dir=SiSU_Env::Info_env.new(@md.fns)
+ dir=SiSU_Env::InfoEnv.new(@md.fns)
<<WOK
\\subsection*{Mail sender details}
\\addcontentsline{toc}{subsection}{Mail sender details}
@@ -1369,7 +1565,7 @@ Mail from: ralph@amissah.com\\\\
\\\\
\"Support Open Standards and Open Sources for the Information Technology Infrastructure\" RA
\\subsubsection*{Information on this document copy #{site}\\copyright}
-Presentations' look and feel generated by \\href{http://www.jus.uio.no/sisu/}{SiSU Scribe} \\href{http://www.jus.uio.no/sisu/}{http://www.jus.uio.no/sisu/} programmed in Ruby on Debian/Gnu/Linux by Copyright \\copyright Ralph Amissah, W3 since October 3 1993 \\href{http://www.jus.uio.no/sisu/}{\\includegraphics*[width=35pt]{#{dir.path.image_source_tex}/sisu.png}}for #{sitename}. SiSU Scribe (sisu information structuring unit) produces Electronic Documents, i.e. it generates structured output for use in a number of file formats, including the pdf file produced here.
+Presentations' look and feel generated by \\href{http://www.jus.uio.no/sisu/}{SiSU Scribe} \\href{http://www.jus.uio.no/sisu/}{http://www.jus.uio.no/sisu/} programmed in Ruby on Debian/Gnu/Linux by Copyright \\copyright Ralph Amissah, W3 since October 3 1993 \\href{http://www.jus.uio.no/sisu/}{\\includegraphics*[width=35pt]{#{dir.path.image_source_include}/sisu.png}}for #{sitename}. SiSU Scribe (sisu information structuring unit) produces Electronic Documents, i.e. it generates structured output for use in a number of file formats, including the pdf file produced here.
WOK
end
end
diff --git a/lib/sisu/v4/update.rb b/lib/sisu/v4/update.rb
new file mode 100644
index 00000000..4630d640
--- /dev/null
+++ b/lib/sisu/v4/update.rb
@@ -0,0 +1,138 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: update previous output (with similar output file type formats)
+
+=end
+module SiSU_UpdateControlFlag
+ require_relative 'sysenv' # sysenv.rb
+ include SiSU_Env
+ include SiSU_Param
+ class Check
+ def initialize(opt)
+ @opt=opt
+ @md=SiSU_Param::Parameters.new(@opt).get
+ end
+ def read
+ begin
+ @env=SiSU_Env::InfoEnv.new(@md.fns)
+ out=@env.path.output
+ base_path="#{out}/#{@md.fnb}"
+ SiSU_Screen::Ansi.new(@md.opt.cmd,'Checking previous output',base_path).green_hi_blue unless @md.opt.cmd =~/q/
+ SetCF.new(@md).set_flags
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ end
+ end
+ private
+ class SetCF
+ def initialize(md)
+ @md=md
+ @env=SiSU_Env::InfoEnv.new(@md.fns)
+ out=@env.path.output
+ @base_path="#{out}/#{@md.fnb}"
+ @pdf_fn=SiSU_Env::FileOp.new(@md).base_filename
+ end
+ def set_flags #-mNhwpoabxXyv
+ flag='-v'
+ if FileTest.file?("#{@md.file.output_path.txt.dir}/#{@md.file.base_filename.txt}")==true
+ flag=flag + 'a'
+ end
+ if FileTest.file?("#{@md.file.output_path.html_seg.dir}/#{@md.file.base_filename.html_seg}")==true
+ or FileTest.file?("#{@md.file.output_path.html_scroll.dir}/#{@md.file.base_filename.html_scroll}")==true
+ flag=flag + 'h'
+ end
+ if FileTest.file?("#{@md.file.output_path.xhtml.dir}/#{@md.file.base_filename.xhtml}")==true
+ flag=flag + 'b'
+ end
+ if FileTest.file?("#{@md.file.output_path.xml_sax.dir}/#{@md.file.base_filename.xml_sax}")==true
+ flag=flag + 'x'
+ end
+ if FileTest.file?("#{@md.file.output_path.xml_dom.dir}/#{@md.file.base_filename.xml_dom}")==true
+ flag=flag + 'X'
+ end
+ if FileTest.file?("#{@md.file.output_path.epub.dir}/#{@md.file.base_filename.epub}")==true
+ flag=flag + 'e'
+ end
+ if FileTest.file?("#{@md.file.output_path.odt.dir}/#{@md.file.base_filename.odt}")==true
+ flag=flag + 'o'
+ end
+ if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@pdf_fn.pdf_p_a4}")==true \
+ or FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@pdf_fn.pdf_l_a4}")==true \
+ or FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@pdf_fn.pdf_p_letter}")==true \
+ or FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@pdf_fn.pdf_l_letter}")==true
+ flag=flag + 'p'
+ end
+ if FileTest.file?("#{@md.file.output_path.html_concordance.dir}/#{@md.file.base_filename.html_concordance}")==true
+ flag=flag + 'w'
+ end
+ if FileTest.file?("#{@md.file.output_path.digest.dir}/#{@md.file.base_filename.digest}")==true
+ flag=flag + 'N'
+ end
+ if FileTest.file?("#{@md.file.output_path.src.dir}/#{@md.file.base_filename.src}")==true
+ flag=flag + 's'
+ end
+ if FileTest.file?("#{@md.file.output_path.sisupod.dir}/#{@md.file.base_filename.sisupod}")==true
+ flag=flag + 'S'
+ end
+ puts flag
+ flag
+ end
+ end
+ end
+end
+__END__
diff --git a/lib/sisu/v4/urls.rb b/lib/sisu/v4/urls.rb
new file mode 100644
index 00000000..0aba1d89
--- /dev/null
+++ b/lib/sisu/v4/urls.rb
@@ -0,0 +1,442 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: urls for output files
+
+=end
+module SiSU_Urls
+ require_relative 'particulars' # particulars.rb
+ include SiSU_Particulars
+ require_relative 'sysenv' # sysenv.rb
+ include SiSU_Env; include SiSU_Screen
+ class Source
+ attr_reader :opt
+ def initialize(opt)
+ @opt=opt
+ end
+ def read
+ begin
+ SiSU_Urls::OutputUrls.new(@opt).songsheet if @opt.fnb
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ end
+ end
+ end
+ class OutputUrls
+ attr_reader :fns,:fnb,:cmd,:dir,:m_regular,:u
+ def initialize(opt)
+ @opt=opt
+ @particulars=SiSU_Particulars::CombinedSingleton.instance.get_env_md(opt)
+ @cmd=@opt.cmd
+ @md=@particulars.md
+ @env=@particulars.env
+ @fnb=@env.fnb
+ fn_set_lang=SiSU_Env::StandardiseLanguage.new(@opt.lng).language
+ @fnl=@env.i18n.lang_filename(fn_set_lang[:c])
+ @fn=SiSU_Env::EnvCall.new(@opt.fns).lang(fn_set_lang[:c])
+ @m_regular=/(.+?)\.(?:(?:-|ssm\.)?sst|ssm)$/
+ @prog=@env.program
+ @u ||= {
+ 'b --xhtml (XHTML)'=>@fn[:xhtml],
+ 'D[iu] --psql (DBI import/update postgresql)'=>'dbi psql',
+ 'd --sqlite (DBI sqlite)'=>'dbi sqlite3',
+ 'd[iu] --sqlite (DBI sqlite)'=>'dbi sqlite3',
+ 'e --epub (EPUB)'=>@fn[:epub],
+ 'P --pot (Pot)'=>@fn[:pot],
+ 'h --html (HTML segmented)'=>@fn[:toc],
+ 'h --html (HTML scroll)'=>@fn[:doc],
+ 'I --texinfo (Info file)'=>'info',
+ 'i --manpage (manpage)'=>'manpage',
+ 'm --dal (Document Abstraction)'=>'dal',
+ 'N --hash-digests (Digests md5/sha256)'=>@fn[:digest],
+ 'o --odt (ODF:ODT - Open Document)'=>@fn[:odf],
+ 'p --pdf (PDF landscape)'=>@fn[:pdf_l],
+ 'p --pdf (PDF portrait)'=>@fn[:pdf_p],
+ 'E --profile (Ruby profiler)'=>'profile',
+ 's --source (sisu markup)'=>@opt.fno,
+ 'S --sisupod (sisupod)'=>@fn[:sisupod],
+ 't --txt (Plain-text (endnotes))'=>@fn[:plain],
+ 'x --xml-sax (XML sax type)'=>@fn[:sax],
+ 'X --xml-dom (XML dom type)'=>@fn[:dom],
+ 'Q --qrcode (QR Code jpg)'=>@fn[:qrcode],
+ 'y --manifest (Manifest, html)'=>@fn[:manifest],
+ 'Y (Sitemap, xml)'=>@fn[:sitemap],
+ 'w --concordance (Concordance, html)'=>@fn[:concordance],
+ }.sort {|a,b| a[0].downcase<=>b[0].downcase}
+ end
+ def songsheet
+ begin
+ @opt.cmd=~/U/ ? urls_all : (urls_select unless @opt.cmd=~/q/)
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ end
+ end
+ def show
+ def source
+ def src(x,y)
+ SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.text_editor} #{@md.file.output_path.src.dir}/#{y}").result
+ end
+ def pod(x,y)
+ SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.sisupod.dir}/#{y}").result
+ end
+ self
+ end
+ def generic(x,y)
+ SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} #{@env.url.output_tell}/#{@fnb}/#{y}").result
+ end
+ def meta(x,y)
+ SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.text_editor} ~#{y}/#{@fnb}.#{y}").result
+ end
+ def text(x)
+ SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.txt.dir}/#{@md.file.base_filename.txt}").result
+ end
+ def epub(x)
+ SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.epub_viewer} #{@md.file.output_path.epub.dir}/#{@md.file.base_filename.epub}").result
+ end
+ def html
+ def scroll(x)
+ SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.html_scroll.dir}/#{@md.file.base_filename.html_scroll}").result
+ end
+ def toc(x)
+ SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.html_seg.dir}/#{@md.file.base_filename.html_segtoc}").result
+ end
+ def concordance(x)
+ SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.html_concordance.dir}/#{@md.file.base_filename.html_concordance}").result
+ end
+ def manifest(x)
+ SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}").result
+ end
+ self
+ end
+ def qrcode(x)
+ SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}").result
+ end
+ def odt(x)
+ SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.odf_viewer} file://#{@md.file.output_path.odt.dir}/#{@md.file.base_filename.odt}").result
+ end
+ def pdf
+ def portrait(x)
+ SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_p}pdf").result
+ end
+ def landscape(x)
+ SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_l}pdf").result
+ end
+ self
+ end
+ def manpage(x)
+ SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.manpage_viewer} #{@md.file.output_path.manpage.dir}/#{@md.file.base_filename.manpage}").result
+ end
+ def pinfo(x,y)
+ SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","pinfo -f #{@md.file.output_path.texinfo.dir}/#{@md.file.base_filename.info}").result
+ end
+ def po4a
+ def po(x,y)
+ SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@md.file.output_path.po.dir}/#{y}").result
+ end
+ def pot(x,y)
+ SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@md.file.output_path.pot.dir}/#{y}").result
+ end
+ self
+ end
+ def xhtml(x)
+ SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.xhtml.dir}/#{@md.file.base_filename.xhtml}").result
+ end
+ def xml
+ def sax(x)
+ SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.xml_sax.dir}/#{@md.file.base_filename.xml_sax}").result
+ end
+ def dom(x)
+ SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.xml_dom.dir}/#{@md.file.base_filename.xml_dom}").result
+ end
+ def sitemap(x) #BROKEN
+ SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.sitemaps.dir}/#{@md.file.base_filename.sitemap}").result
+ end
+ self
+ end
+ def hash_digest(x)
+ SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.hash_digest.dir}/#{@md.file.base_filename.hash_digest}").result
+ end
+ def db
+ def psql(x,y)
+ SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x} DBI psql","#{@pwd_stub}::#{@opt.fns}",y).result
+ end
+ def sqlite(x,y)
+ SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x} DBI sqlite","sqlite3 #{@env.path.webserv}/#{@md.opt.f_pth[:pth_stub]}/sisu_sqlite.db").result
+ end
+ def sqlite_discreet(x,y)
+ SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","sqlite3 #{@md.file.output_path.sqlite_discreet.dir}/#{@md.file.base_filename.sqlite_discreet}").result
+ end
+ self
+ end
+ self
+ end
+ def urls_maintenance(opt,x,y)
+ if x=~/^([abcehHmNoptwxXy])/ \
+ and opt.cmd =~/[abcehHmNoptwxXy]/ \
+ and x=~/^[#{opt.cmd}]/ \
+ and opt.cmd =~/[MV]/
+ m=$1
+ f=y
+ tool=@prog.text_editor
+ if x =~/^m/ \
+ and @opt.cmd=~/m/ \
+ and x=~/^[#{opt.cmd}]/
+ SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@env.processing_path.dal}/#{@opt.fns}.meta").maintenance
+ end
+ if x=~/^([hw])/ \
+ and @opt.cmd=~/[hw]/ \
+ and x=~/^[#{@opt.cmd}]/ \
+ and x !~/segmented/; "#{y}.html"
+ SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@env.processing_path.tune}/#{@md.fns}.tune").maintenance
+ end
+ if x=~/^p/ \
+ and @opt.cmd=~/p/ \
+ and x=~/^[#{@opt.cmd}]/
+ tool=@prog.pdf_viewer
+ fns=@opt.fns.gsub(/~/,'-')
+ unless @opt.cmd =~/q/
+ tell=if x =~/landscape/
+ SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@env.processing_path.tex}/#{fns}.landscape.tex")
+ else SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@env.processing_path.tex}/#{fns}.tex")
+ end
+ tell.maintenance
+ end
+ end
+ if x=~/^o/ \
+ and @opt.cmd=~/o/ \
+ and x=~/^[#{@opt.cmd}]/
+ tool=@prog.odf_viewer
+ end
+ if x=~/^e/ \
+ and @opt.cmd=~/e/ \
+ and x=~/^[#{@opt.cmd}]/
+ SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@env.processing_path.epub}/#{Ep[:d_oebps]}/toc.xhtml").maintenance
+ end
+ if x=~/^o/ \
+ and @opt.cmd=~/o/ \
+ and x=~/^[#{@opt.cmd}]/
+ SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@env.processing_path.odf}/#{@opt.fns}/odt/content.xml").maintenance
+ end
+ end
+ end
+ def urls_select
+ unless @opt.cmd =~/q/
+ i1="[#{@opt.f_pth[:lng_is]}]"
+ i2="file://#{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}"
+ @opt.cmd=~/[MVvz]/ \
+ ? SiSU_Screen::Ansi.new(@opt.cmd,'URLs').green_title_hi
+ : SiSU_Screen::Ansi.new(@opt.cmd,'URL (output manifest)',i1, i2).grey_title_grey_blue
+ SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}").flow if @opt.cmd =~/[MVv]/
+ end
+ m=/.+\/(?:src\/)?(\S+)/im # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m
+ @pwd_stub="#{@env.url.output_tell}"[m,1]
+ unless @opt.cmd =~/q/
+ @u.each do |x,y|
+ if @opt.fns =~ @m_regular
+ if @opt.cmd =~/[MVv]/
+ if x=~/--txt\b/ \
+ and @opt.act[:txt][:set]==:on
+ show.text(x)
+ end
+ if x=~/--xhtml\b/ \
+ and @opt.act[:xhtml][:set]==:on
+ show.xhtml(x)
+ end
+ if x=~/--psql\b/ \
+ and @opt.act[:psql][:set]==:on
+ show.db.psql(x,y)
+ end
+ if x=~/d\s+--sqlite\b|--sql\b/ \
+ and @opt.act[:sqlite_discreet][:set]==:on
+ show.db.sqlite_discreet(x,y)
+ end
+ if x=~/d\[iu\]\s+--sqlite\b/ \
+ and @opt.act[:sqlite][:set]==:on
+ show.db.sqlite(x,y)
+ end
+ if x=~/--epub\b/ \
+ and @opt.act[:epub][:set]==:on
+ show.epub(x)
+ end
+ if x=~/--html\b/ \
+ and @opt.act[:html][:set]==:on
+ if x =~/scroll/
+ show.html.scroll(x)
+ else
+ show.html.toc(x)
+ end
+ end
+ if x=~/--texinfo\b/ \
+ and @opt.cmd =~/I/
+ show.pinfo(x,y)
+ end
+ if x=~/--manpage\b/ \
+ and @opt.act[:manpage][:set]==:on
+ show.manpage(x)
+ end
+ if x=~/--hash-digests\b/ \
+ and @opt.cmd =~/N/
+ show.hash_digest(x)
+ end
+ if x=~/--odt\b|--odf\b/ \
+ and @opt.act[:odt][:set]==:on
+ show.odt(x)
+ end
+ if x=~/^P/ \
+ and @opt.cmd =~/P/
+ if @opt.fns =~/\S+?~\S{2}(?:_\S{2})?\.ss[mt]/
+ f=y.gsub(/\.pot$/,'.po')
+ show.po4a.po(x,f)
+ else
+ show.po4a.pot(x,f)
+ end
+ end
+ if x=~/--pdf\b/ \
+ and @opt.act[:pdf][:set]==:on
+ if x =~/portrait/
+ show.pdf.portrait(x)
+ else
+ show.pdf.landscape(x)
+ end
+ end
+ if x=~/--sisupod\b/ \
+ and @opt.act[:sisupod][:set]==:on
+ (@opt.fno =~/\.ssm$/) \
+ ? y.gsub(/(?:\~\S{2,3})?(\.ssm.sst\.txz)$/,'.ssm.txz')
+ : y.gsub(/(?:\~\S{2,3})?(\.sst\.txz)$/,'\1')
+ show.source.pod(x,y)
+ end
+ if x=~/--source\b/ \
+ and @opt.act[:share_source][:set]==:on
+ show.source.src(x,y)
+ end
+ if x=~/--concordance\b/ \
+ and @opt.act[:concordance][:set]==:on
+ show.html.concordance(x)
+ end
+ if x=~/--xml-dom\b/ \
+ and @opt.act[:xml_dom][:set]==:on
+ show.xml.dom(x)
+ end
+ if x=~/--xml-sax\b/ \
+ and @opt.act[:xml_sax][:set]==:on
+ show.xml.sax(x)
+ end
+ if x=~/--qrcode\b/ \
+ and @opt.act[:qrcode][:set]==:on
+ show.qrcode(x)
+ end
+ if x=~/--sitemap\b/ \
+ and @opt.cmd =~/Y/ #BROKEN
+ show.xml.sitemap(x)
+ end
+ if x=~/--manifest\b/ \
+ and @opt.act[:manifest][:set]==:on
+ show.html.manifest(x)
+ end
+ end
+ urls_maintenance(@opt,x,y) if @opt.cmd =~/[MV]/
+ end
+ end
+ end
+ end
+ def urls_all
+ i="(output manifest) [#{@opt.f_pth[:lng_is]}] #{@env.url.output_tell}/#{@fnb}/sisu_manifest.html"
+ SiSU_Screen::Ansi.new(@opt.cmd,'URLs',i).grey_title_hi
+ @u.each do |x,y|
+ tell=case x
+ when /^m/
+ show.meta(x,y)
+ when /^[BcdNsxXy]/
+ show.generic(x,y)
+ when /^[at]/
+ show.text(x)
+ when /^b/
+ show.xhtml(x)
+ when /^e/
+ show.epub(x)
+ when /^h/
+ if x =~/scroll/
+ show.html.scroll(x)
+ else
+ show.html.toc(x)
+ end
+ when /^o/
+ show.odt(x)
+ when /^p/
+ if x =~/portrait/
+ show.pdf.portrait(x)
+ else
+ show.pdf.landscape(x)
+ end
+ when /^w/
+ show.html.concordance(x)
+ when /^Y/
+ show.xml.sitemap(x)
+ when /^I/
+ show.pinfo(x,y)
+ when /^i/
+ show.manpage(x)
+ end
+ end
+ end
+ end
+end
+__END__
diff --git a/lib/sisu/v4/webrick.rb b/lib/sisu/v4/webrick.rb
new file mode 100644
index 00000000..96280d0c
--- /dev/null
+++ b/lib/sisu/v4/webrick.rb
@@ -0,0 +1,185 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: webrick share - note sisu by default does not link with file
+ suffixes, see man pages for options
+
+=end
+module SiSU_Webserv
+ class WebrickStart
+ require 'webrick'
+ include WEBrick
+ require 'time'
+ require_relative 'sysenv' # sysenv.rb
+ include SiSU_Env
+ include SiSU_Screen
+ def initialize
+ begin #%
+ @cX=SiSU_Screen::Ansi.new('yes').cX
+ @env=SiSU_Env::InfoEnv.new
+ port=SiSU_Env::InfoPort.new
+ @host=@env.url.webrick
+ host='localhost'
+ @port=port.webrick
+ @serve=[]
+ Dir.foreach(@env.path.webserv) do |x|
+ if x !~/^\./ \
+ and FileTest.directory?("#{@env.path.webserv}/#{x}")
+ @serve << x
+ end
+ end
+ @mount=[]
+ @serve.each {|x| @mount << ["/#{x}", "#{@env.path.webserv}/#{x}"]}
+ @pwd=Dir.pwd
+ @week=Time.now.strftime(%{%Yw%W})
+ puts "\n"
+ @mount.each { |x,y|
+ puts " #{@cX.cyan}#{x}#{@cX.off}\t#{@cX.grey}see#{@cX.off} #{@cX.blue}#{@host}:#{@port}#{x}/wb.cgi#{@cX.off} #{@cX.ruby}@#{@cX.off} #{@cX.blue}#{@host}:#{@port}#{x}/#{@cX.off}"
+ }
+ puts "#{@cX.grey}"
+ wb_s2=[]
+ #% writes file wb.cgi to shared directories ...
+ #% wb_top
+ wb_top=%q(#!/usr/bin/env ruby
+ # * arch-tag: webrick info on environment, mounted directories, and contents of pwd
+ require 'time'
+ require 'cgi'
+ require 'fcgi'
+ ls=Dir.entries('./')
+ dir_contents=[]
+ ls.each { |x| dir_contents << "<a href=\"./#{x}/\">#{x}</a><br>" unless x =~/^(\.)+$/ }
+ dir_contents=dir_contents.sort.join(' ')
+ #host=ENV['HOSTNAME']
+ #host=%x{echo $HOSTNAME}
+ )
+ wb_s1=<<WOK
+
+ page=CGI.new "html3"
+ page.out {
+ page.html {
+ page.head { page.title {"#{@host} Webrick Report"} } +
+ page.body {
+ page.h1 {"Webrick #{@host}"} +
+ page.p {"Webrick is Ruby's built in webserver."} +
+ page.center {"Host name: " + page.b{"#{@host} "} + "(#{@host}) port: " + page.b{"#{@port}"}} +
+ page.center {"#{Time.now}"} +
+ page.center {"#{Time.now.strftime(%{%Yw%W})}"} +
+ page.p {''} +
+ page.p {''} +
+ page.p {page.b{"Webrick Served Directories: "}} +
+WOK
+ #% wb_s2 (mounts)
+ @mount.each do |x,y| wb_s2 <<<<WOK
+ page.p {page.b{'<a href="#{@host}:#{@port}#{x}/">#{x}</a> '} + '<a href="#{@host}:#{@port}#{x}/">#{@host}:#{@port}#{x}</a> (mounts: #{y}/) <a href="#{@host}:#{@port}#{x}/wb.cgi">info (wb.cgi)</a>'} +
+WOK
+ end
+ #% wb_end
+ wb_end=<<WOK
+ page.p {page.b{"Contents of PWD (see URL): "}} +
+ page.p {"#\{dir_contents}"}
+ }
+ }
+ }
+WOK
+ @mount.each { |x,y| #% wb puts
+ puts y
+ filename=File.new("#{y}/wb.cgi",'w')
+ filename << wb_top
+ filename << wb_s1
+ filename << wb_s2
+ filename << wb_end
+ filename.close
+ FileUtils::chmod(0755,"#{y}/wb.cgi &") if FileTest.file?("#{y}/wb.cgi &")
+ }
+ puts " #{@cX.off}"
+ #get=@argv.shift if @argv[0] =~/pwd/ #% argv
+ get=Dir.pwd
+ brick(@port,get)
+ rescue
+ require_relative 'sysenv' # sysenv.rb
+ SiSU_Errors::InfoError.new($!,$@,'-W',nil).error do #fix
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ end
+ end
+ def brick(port,get='')
+ cgidir=if get=~/pwd/; Dir.pwd
+ else '/usr/lib/cgi-bin' # @env.path.cgi
+ end
+ port=SiSU_Env::InfoPort.new.webrick
+ begin
+ s=HTTPServer.new(
+ Port: port,
+ DocumentRoot: Dir::pwd + '/htdocs',
+ CGIPathEnv: ENV['PATH']
+ )
+ cgi_dir=File.expand_path(cgidir)
+ @mount.each { |x,y| # mount subdirectories
+ s.mount(x, HTTPServlet::FileHandler, y, true)
+ }
+ s.mount('/cgi-bin', HTTPServlet::FileHandler, cgi_dir, { FancyIndexing: true })
+ trap("INT"){ s.shutdown }
+ s.start
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,'-W',nil).error do #fix
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ end
+ end
+ end
+ensure
+end
+__END__
diff --git a/lib/sisu/v2/wikispeak.rb b/lib/sisu/v4/wikispeak.rb
index df6cdb50..e67213f0 100644
--- a/lib/sisu/v2/wikispeak.rb
+++ b/lib/sisu/v4/wikispeak.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -57,14 +56,14 @@
=end
module SiSU_Wikispeak
- require "#{SiSU_lib}/dal" # dal.rb
- require "#{SiSU_lib}/sysenv" # sysenv.rb
+ require_relative 'dal' # dal.rb
+ require_relative 'sysenv' # sysenv.rb
include SiSU_Env
include SiSU_Param
include SiSU_Viz
- require "#{SiSU_lib}/plaintext_format" # plaintext_format.rb
+ require_relative 'plaintext_format' # plaintext_format.rb
include Format
- require "#{SiSU_lib}/shared_txt"
+ require_relative 'shared_txt'
pwd=Dir.pwd
@@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0
@@tablefoot=''
@@ -76,24 +75,25 @@ module SiSU_Wikispeak
def read
begin
@md=SiSU_Param::Parameters.new(@opt).get
- @env=SiSU_Env::Info_env.new(@opt.fns)
+ @env=SiSU_Env::InfoEnv.new(@opt.fns)
path=@env.path.output_tell
tool=(@opt.cmd =~/[MVv]/) \
- ? "#{@env.program.text_editor} #{path}/#{@md.fnb}/#{@md.fn[:wiki]}" \
+ ? "#{@env.program.text_editor} #{path}/#{@md.fnb}/#{@md.fn[:wiki]}"
: ''
SiSU_Screen::Ansi.new(@opt.cmd,'Wikispeak',tool).green_hi_blue unless @opt.cmd =~/q/
SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/#{@md.fnb}/#{@md.fn[:wiki]}").flow if @opt.cmd =~/[MV]/
- my_make=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns)
@dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here
SiSU_Wikispeak::Source::Scroll.new(@dal_array,@md).songsheet
- SiSU_Env::Info_skin.new(@md).select #watch
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
ensure
end
end
private
- class Split_text_object <Source
- require "#{SiSU_lib}/plaintext_format" # plaintext_format.rb
+ class SplitTextObject <Source
+ require_relative 'plaintext_format' # plaintext_format.rb
include Format
include SiSU_Viz
@@alt_id_count=0
@@ -102,7 +102,7 @@ module SiSU_Wikispeak
def initialize(para)
@para=para
@format,@ocn='ordinary','ordinary'
- @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern
+ @dp=@@dp ||=SiSU_Env::InfoEnv.new.digest.pattern
end
def lev_segname_para_ocn
@text=nil
@@ -133,23 +133,23 @@ module SiSU_Wikispeak
end
format=@format.dup
@lev_para_ocn=if @para =~/.+#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{#Mx[:id_c]}$/
- Format::Format_text_object.new(format,@text,@ocn)
+ Format::FormatTextObject.new(format,@text,@ocn)
else
- Format::Format_text_object.new(format,@text,"#{Mx[:id_o]}~(\d+);[um]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}")
+ Format::FormatTextObject.new(format,@text,"#{Mx[:id_o]}~(\d+);[um]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}")
end
self
end
end
class Scroll <Source
- require "#{SiSU_lib}/shared_txt" # shared_txt.rb
- include SiSU_text_utils
+ require_relative 'shared_txt' # shared_txt.rb
+ include SiSU_TextUtils
@@endnotes_para=[]
- @@wiki={ :body=>[],:open=>[],:close=>[],:head=>[],:metadata=>[],:tail=>[],:endnotes=>[] }
+ @@wiki={ body: [], open: [], close: [], head: [], metadata: [], tail: [], endnotes: [] }
@@dp=nil
def initialize(data,md)
@data,@md=data,md
- @vz=SiSU_Env::Get_init.instance.skin
- @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern
+ @vz=SiSU_Viz::Defaults.new
+ @dp=@@dp ||=SiSU_Env::InfoEnv.new.digest.pattern
@regx=/^(?:(?:#{Mx[:br_line]}\s*|#{Mx[:br_nl]}\s*)?#{Mx[:lv_o]}\d:(\S*?)#{Mx[:lv_c]}\s*)?(.+)/ #fix Mx[:lv_o] #m # 2004w18 pb pn removal added
@tab="\t"
@@dostype='unix footnotes'
@@ -165,7 +165,7 @@ module SiSU_Wikispeak
@n=[]
end
def wiki_metadata(meta)
- util=SiSU_text_utils::Wrap.new(meta.text,70,15,1)
+ util=SiSU_TextUtils::Wrap.new(meta.text,70,15,1)
txt=util.line_wrap
@@wiki[:metadata] <<= if meta.type=='meta'
<<WOK
@@ -176,8 +176,7 @@ WOK
end
end
def wiki_tail
- SiSU_Env::Info_skin.new(@md).select
- vz=SiSU_Env::Get_init.instance.skin
+ vz=SiSU_Viz::Defaults.new
generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version]
lastdone="Last Generated on: #{Time.now}"
rubyv="Ruby version: #{@md.ruby_version}"
@@ -228,7 +227,7 @@ WOK
end
def markup # Used for major markup instructions
data=@data
- dir=SiSU_Env::Info_env.new(@md.fns)
+ dir=SiSU_Env::InfoEnv.new(@md.fns)
@data_mod,@endnotes,@level,@cont,@copen,@wiki_contents_close=Array.new(6){[]}
(0..6).each { |x| @cont[x]=@level[x]=false }
(4..6).each { |x| @wiki_contents_close[x]='' }
@@ -248,7 +247,7 @@ WOK
para.gsub!(/<u>(.+?)<\/u>/,'_\1_')
para.gsub!(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'[\2 \1]')
para.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'[\1]')
- para.gsub!(/<:(?:group|verse|alt|code)(?:-end)?>(?:\s+#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]})?/,'')
+ para.gsub!(/<:(?:block|group|verse|alt|code)(?:-end)?>(?:\s+#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]})?/,'')
para.gsub!(/<:p[bn]>/,'') # remove page breaks
para.gsub!(/^\s*#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/,'') # remove empty lines - check
para.gsub!(/<a href=".+?">(.+?)<\/a>/m,'\1')
@@ -258,16 +257,16 @@ WOK
para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*#{Mx[:lnk_c]}\S+/,'[image: "\1"]')
wordlist=para.scan(/\S+/)
if para =~/^@(\S+?):\s+(.+?)\Z/m # for headers
- d_meta=SiSU_text_utils::Header_scan.new(@md,para).meta
+ d_meta=SiSU_TextUtils::HeaderScan.new(@md,para).meta
if d_meta; wiki_metadata(d_meta)
end
end
if para !~/(^@\S+?:|#{Mx[:br_endnotes]}|#{Mx[:br_eof]})/
if para =~@regx #/.+?<~\d+;\w\d+;\w\d+>.*/ #watch change
paranum=para[@regx,3]
- @p_num=Format::Paragraph_number.new(paranum)
+ @p_num=Format::ParagraphNumber.new(paranum)
end
- @sto=Split_text_object.new(para).lev_segname_para_ocn
+ @sto=SplitTextObject.new(para).lev_segname_para_ocn
### problem in scroll, it appears tables are getting paragraph numbers
m=/#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/
if para =~m \
@@ -282,7 +281,7 @@ WOK
when /^(3)~(?:(\S+))?/
wiki_structure(para,$1,@sto.ocn,$2)
@sto.lev_para_ocn.heading_body3
- when /^(4)~(\S+)/ # work on see SiSU_text_parts::Split_text_object
+ when /^(4)~(\S+)/ # work on see SiSU_text_parts::SplitTextObject
wiki_structure(para,$1,@sto.ocn,$2)
@sto.lev_para_ocn.heading_body4
when /^(5)~(?:(\S+))?/
@@ -306,7 +305,7 @@ WOK
elsif para =~/(#{Mx[:tc_p]}|#{Mx[:gr_o]}Th?)/u #tables ! #fix
elsif para =~/(.*)<!#!>(.*)/
one,two=$1,$2
- format_text=Format_text_object.new(one,two)
+ format_text=FormatTextObject.new(one,two)
para=format_text.seg_no_paranum
end
if (para =~/<a name="n\d+">/ \
@@ -316,12 +315,12 @@ WOK
case para
when /<:i1>/
if para =~/.*<:#>.*$/
- format_text=Format_text_object.new(para,'')
+ format_text=FormatTextObject.new(para,'')
para=format_text.scr_indent_one_no_paranum
end
when /<:i2>/
if para =~/.*<:#>.*$/
- format_text=Format_text_object.new(para,'')
+ format_text=FormatTextObject.new(para,'')
para=format_text.scr_indent_one_no_paranum
end
end
@@ -330,7 +329,7 @@ WOK
end
if para =~/<:center>/
one,two=/(.*)<:center>(.*)/.match(para)[1,2]
- format_text=Format_text_object.new(one,two)
+ format_text=FormatTextObject.new(one,two)
para=format_text.center
end
para.gsub!(/<!.+!>/,' ') if para ## Clean Prepared Text
@@ -356,8 +355,8 @@ WOK
@content,@md=content,md
end
def wiki #%wiki output
- SiSU_Env::SiSU_file.new(@md).mkdir
- filename_wiki=SiSU_Env::SiSU_file.new(@md,@md.fn[:wiki]).mkfile
+ SiSU_Env::FileOp.new(@md).mkdir
+ filename_wiki=SiSU_Env::FileOp.new(@md,@md.fn[:wiki]).mkfile
@sisu=[]
@content.each do |para| # this is a hack
if para =~/^\S/
diff --git a/lib/sisu/v2/xhtml.rb b/lib/sisu/v4/xhtml.rb
index f142f3ce..df3f18a6 100644
--- a/lib/sisu/v2/xhtml.rb
+++ b/lib/sisu/v4/xhtml.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -57,25 +56,25 @@
** Notes: tidy -xml scroll.xhtml >> index.tidy
=end
module SiSU_XHTML
- require "#{SiSU_lib}/defaults" # defaults.rb
+ require_relative 'defaults' # defaults.rb
include SiSU_Viz
- require "#{SiSU_lib}/particulars" # particulars.rb
+ require_relative 'particulars' # particulars.rb
include SiSU_Particulars
- require "#{SiSU_lib}/sysenv" # sysenv.rb
+ require_relative 'sysenv' # sysenv.rb
include SiSU_Env
- require "#{SiSU_lib}/shared_xml" # shared_xml.rb
- include SiSU_XML_munge
- require "#{SiSU_lib}/xml_format" # xml_format.rb
- include SiSU_XML_format
- require "#{SiSU_lib}/rexml" # rexml.rb
+ require_relative 'shared_xml' # shared_xml.rb
+ include SiSU_XML_Munge
+ require_relative 'xml_format' # xml_format.rb
+ include SiSU_XML_Format
+ require_relative 'rexml' # rexml.rb
include SiSU_Rexml
- require "#{SiSU_lib}/shared_metadata" # shared_metadata.rb
+ require_relative 'shared_metadata' # shared_metadata.rb
@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0
@@tablefoot=''
class Source
def initialize(opt)
@opt=opt
- @particulars=SiSU_Particulars::Combined_singleton.instance.get_all(opt)
+ @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)
end
def read
begin
@@ -83,47 +82,57 @@ module SiSU_XHTML
unless @opt.cmd =~/q/
path=@env.path.output_tell
loc=@env.url.output_tell
- tool=if @opt.cmd =~/[MV]/; "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:xhtml]}\n\t#{@env.program.xml_viewer} #{path}/#{@md.fnb}/#{@md.fn[:xhtml]}"
- elsif @opt.cmd =~/v/; "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:xhtml]}"
- else @opt.fns
+ tool=if @opt.cmd =~/[MV]/
+ "#{@env.program.web_browser} file://#{@md.file.output_path.xhtml.dir}/#{@md.file.base_filename.xhtml}"
+ elsif @opt.cmd =~/v/
+ "#{@env.program.web_browser} file://#{@md.file.output_path.xhtml.dir}/#{@md.file.base_filename.xhtml}"
+ else "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}"
end
@opt.cmd=~/[MVvz]/ \
- ? SiSU_Screen::Ansi.new(@opt.cmd,'invert','XHTML',tool).colorize \
+ ? SiSU_Screen::Ansi.new(@opt.cmd,'invert','XHTML',tool).colorize
: SiSU_Screen::Ansi.new(@opt.cmd,'XHTML',tool).green_title_hi
- SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{path}/#{@md.fnb}/#{@md.fn[:xhtml]}").flow if @opt.cmd =~/[MV]/
+ SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"/#{@md.file.output_path.xhtml.dir}/#{@md.file.base_filename.xhtml}").flow if @opt.cmd =~/[MV]/
end
SiSU_XHTML::Source::Songsheet.new(@particulars).song
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
ensure
+ SiSU_Env::CreateSite.new(@opt.cmd).cp_css
end
end
private
class Songsheet
def initialize(particulars)
@env,@md,@dal_array,@particulars=particulars.env,particulars.md,particulars.dal_array,particulars
+ @file=SiSU_Env::FileOp.new(@md)
end
def song
begin
SiSU_XHTML::Source::Scroll.new(@particulars).songsheet
- SiSU_XHTML::Source::Tidy.new(@md,@env).xml if @md.cmd =~/[vVM]/ # test wellformedness, comment out when not in use
- SiSU_Rexml::Rexml.new(@md,@md.fn[:xhtml]).xml if @md.cmd =~/M/ # test rexml parsing, comment out when not in use #debug
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error
+ SiSU_XHTML::Source::Tidy.new(@md,@file.place_file.xhtml.dir).xml if @md.opt.cmd =~/[vVM]/ # test wellformedness, comment out when not in use
+ SiSU_Rexml::Rexml.new(@md,@file.place_file.xhtml.dir).xml if @md.opt.cmd =~/M/ # test rexml parsing, comment out when not in use #debug
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
ensure
end
end
end
class Scroll
- require "#{SiSU_lib}/shared_xhtml" # shared_xhtml.rb #check already called
- require "#{SiSU_lib}/shared_txt" # shared_txt.rb
- include SiSU_text_utils
- require "#{SiSU_lib}/css" # css.rb
- @@xml={ :body=>[],:sisu=>[],:open=>[],:close=>[],:head=>[] }
+ require_relative 'shared_xhtml' # shared_xhtml.rb #check already called
+ require_relative 'shared_txt' # shared_txt.rb
+ include SiSU_TextUtils
+ require_relative 'css' # css.rb
+ @@xml={ body: [], sisu: [], open: [], close: [], head: [] }
def initialize(particulars)
@env,@md,@dal_array=particulars.env,particulars.md,particulars.dal_array
- @vz=SiSU_Env::Get_init.instance.skin
+ @vz=SiSU_Viz::Defaults.new
@tab="\t"
- @trans=SiSU_XML_munge::Trans.new(@md)
- @sys=SiSU_Env::System_call.new
+ @trans=SiSU_XML_Munge::Trans.new(@md)
+ @sys=SiSU_Env::SystemCall.new
end
def songsheet
pre
@@ -133,39 +142,39 @@ module SiSU_XHTML
end
protected
def embedded_endnotes(dob='')
- dob.obj.gsub!(/#{Mx[:en_a_o]}(\d+)\s+(.+?)#{Mx[:en_a_c]}/,
- '<endnote><number>\1</number><note>\2</note></endnote> ')
- dob.obj.gsub!(/#{Mx[:en_b_o]}([*+]\d+)\s+(.+?)#{Mx[:en_b_c]}/,
- '<endnote><symbol>\1</symbol><note>\2</note></endnote> ')
- dob.obj.gsub!(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)#{Mx[:en_a_c]}/,
- '<endnote><symbol>\1</symbol><note>\2</note></endnote> ')
+ dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}(\d+)\s+(.+?)#{Mx[:en_a_c]}/,
+ '<endnote><number>\1</number><note>\2</note></endnote> ').
+ gsub(/#{Mx[:en_b_o]}([*+]\d+)\s+(.+?)#{Mx[:en_b_c]}/,
+ '<endnote><symbol>\1</symbol><note>\2</note></endnote> ').
+ gsub(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)#{Mx[:en_a_c]}/,
+ '<endnote><symbol>\1</symbol><note>\2</note></endnote> ')
end
def extract_endnotes(dob='')
notes=dob.obj.scan(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})([\d*+]+\s+.+?)(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/)
notes.flatten.each do |e|
s=e.to_s
- util=SiSU_text_utils::Wrap.new(s,70)
+ util=SiSU_TextUtils::Wrap.new(s,70)
wrap=util.line_wrap
- wrap.gsub!(/^(\d+)\s+(.+?)\s*\Z/m, <<WOK
+ wrap=wrap.gsub(/^(\d+)\s+(.+?)\s*\Z/m, <<WOK
#{Ax[:tab]*1}<endnote notenumber="\\1">
#{Ax[:tab]*2}\\1. \\2
#{Ax[:tab]*1}</endnote>
WOK
-)
- wrap.gsub!(/^([*+]\d+)\s+(.+?)\s*\Z/m, <<WOK
+).
+ gsub(/^([*+]\d+)\s+(.+?)\s*\Z/m, <<WOK
#{Ax[:tab]*1}<endnote symbol="\\1">
#{Ax[:tab]*2}\\1 \\2
#{Ax[:tab]*1}</endnote>
WOK
-)
- wrap.gsub!(/^([*+]+)\s+(.+?)\s*\Z/m, <<WOK
+).
+ gsub(/^([*+]+)\s+(.+?)\s*\Z/m, <<WOK
#{Ax[:tab]*1}<endnote symbol="\\1.length">
#{Ax[:tab]*2}\\1 \\2
#{Ax[:tab]*1}</endnote>
WOK
)
#KEEP alternative presentation of endnotes
-# wrap.gsub!(/^(\d+)\s+(.+?)\s*\Z/m, <<WOK
+# wrap=wrap.gsub(/^(\d+)\s+(.+?)\s*\Z/m, <<WOK
##{Ax[:tab]*1}<p class="endnote" notenumber="\\1">
##{Ax[:tab]*2}\\1. \\2
##{Ax[:tab]*1}</p>
@@ -175,7 +184,7 @@ WOK
end
end
def xml_head
- metadata=Metadata::Summary.new(@md).xhtml_scroll.metadata
+ metadata=SiSU_Metadata::Summary.new(@md).xhtml_scroll.metadata
@@xml[:head] << metadata
end
def name_tags(dob)
@@ -189,18 +198,19 @@ WOK
tags
end
def xml_structure(dob,type='norm')
- if dob.is =~/para|heading/
+ if dob.is ==:para \
+ || dob.is ==:heading
named=name_tags(dob)
- if dob.is=='heading'
+ if dob.is==:heading
lv=dob.ln
n=dob.ln - 1
n3=dob.ln + 2
else lv=nil
end
extract_endnotes(dob)
- dob.obj.gsub!(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'<en>\1</en>') #footnote/endnote clean
- dob.obj.gsub!(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'<en>\1</en>') #footnote/endnote clean
- util=SiSU_text_utils::Wrap.new(dob.obj,70)
+ dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'<en>\1</en>'). #footnote/endnote clean
+ gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'<en>\1</en>') #footnote/endnote clean
+ util=SiSU_TextUtils::Wrap.new(dob.obj,70)
wrapped=util.line_wrap
@@xml[:body] << if defined? dob.ocn
%{#{Ax[:tab]*0}<object id="#{dob.ocn}">}
@@ -214,12 +224,25 @@ WOK
@endnotes=[]
end
end
+ def block_structure(dob)
+ named=name_tags(dob)
+ dob=@trans.markup_block(dob)
+ dob.obj=dob.obj.strip.
+ gsub(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'<en>\1</en>'). #footnote/endnote clean
+ gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'<en>\1</en>') #footnote/endnote clean
+ @@xml[:body] << %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}
+ @@xml[:body] << %{#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>}
+ @@xml[:body] << %{#{Ax[:tab]*1}<text class="block">#{named}#{Ax[:tab]*1}}
+ @@xml[:body] << %{#{Ax[:tab]*2}#{dob.obj}#{Ax[:tab]*1}}
+ @@xml[:body] << %{#{Ax[:tab]*1}</text>}
+ @@xml[:body] << "#{Ax[:tab]*0}</object>"
+ end
def group_structure(dob)
named=name_tags(dob)
dob=@trans.markup_group(dob)
- dob.obj.strip!
- dob.obj.gsub!(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'<en>\1</en>') #footnote/endnote clean
- dob.obj.gsub!(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'<en>\1</en>') #footnote/endnote clean
+ dob.obj=dob.obj.strip.
+ gsub(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'<en>\1</en>'). #footnote/endnote clean
+ gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'<en>\1</en>') #footnote/endnote clean
@@xml[:body] << %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}
@@xml[:body] << %{#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>}
@@xml[:body] << %{#{Ax[:tab]*1}<text class="group">#{named}#{Ax[:tab]*1}}
@@ -230,7 +253,7 @@ WOK
def poem_structure(dob)
named=name_tags(dob)
dob=@trans.markup_group(dob)
- dob.obj.strip!
+ dob.obj=dob.obj.strip
@@xml[:body] << %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}
@@xml[:body] << %{#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>}
@@xml[:body] << %{#{Ax[:tab]*1}<text class="verse">#{named}#{Ax[:tab]*1}}
@@ -241,8 +264,7 @@ WOK
def code_structure(dob)
named=name_tags(dob)
dob=@trans.markup_group(dob)
- dob.obj.gsub!(/\s\s/,'&#160;&#160;')
- dob.obj.strip!
+ dob.obj=dob.obj.gsub(/\s\s/,'&#160;&#160;').strip
@@xml[:body] << %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}
@@xml[:body] << %{#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>}
@@xml[:body] << %{#{Ax[:tab]*1}<text class="code">#{named}#{Ax[:tab]*1}}
@@ -252,7 +274,7 @@ WOK
end
def table_structure(dob)
named=name_tags(dob)
- table=SiSU_XHTML_shared::Table_xhtml.new(dob)
+ table=SiSU_XHTML_Shared::TableXHTML.new(dob)
@@xml[:body] << %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}
@@xml[:body] << %{#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>}
@@xml[:body] << %{#{Ax[:tab]*2}#{named}#{table.table.obj}}
@@ -276,11 +298,11 @@ WOK
if dob.obj !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/
if defined? dob.ocn #look to move to format section
ocn=(dob.ocn.to_s =~/\d+/) ? dob.ocn : nil
- @p_num=SiSU_XML_format::Paragraph_number.new(@md,ocn)
+ @p_num=SiSU_XML_Format::ParagraphNumber.new(@md,ocn)
end
if not @rcdc
- x=SiSU_XML_format::Format_seg.new(@md,dob)
- if dob.is=='heading'
+ x=SiSU_XML_Format::FormatSeg.new(@md,dob)
+ if dob.is==:heading
xml_structure(dob)
dob.obj=case dob.ln
when 1; x.heading_body1
@@ -291,28 +313,35 @@ WOK
when 6; x.heading_body6
end
else
- if dob.is =='verse'
+ if dob.is ==:verse
poem_structure(dob)
- elsif dob.is =='group'
+ elsif dob.is ==:group
group_structure(dob)
- elsif dob.is =='code'
+ elsif dob.is ==:block
+ block_structure(dob)
+ elsif dob.is ==:code
code_structure(dob)
- elsif dob.is =='table'
+ elsif dob.is ==:table
table_structure(dob)
- elsif dob.is =='para' \
+ elsif dob.is ==:para \
and dob.indent.to_s =~/[1-9]/ \
and dob.bullet_==true
xml_structure(dob,"indent_bullet#{dob.indent}")
- elsif dob.is =='para' \
- and dob.indent.to_s =~/[1-9]/
+ elsif dob.is ==:para \
+ and dob.indent.to_s =~/[1-9]/ \
+ and dob.indent == dob.hang
xml_structure(dob,"indent#{dob.indent}")
+ elsif dob.is==:para \
+ and dob.hang.to_s =~/[0-9]/ \
+ and dob.indent != dob.hang
+ xml_structure(dob,"hang#{dob.hang.to_s}_indent#{dob.indent.to_s}")
else xml_structure(dob)
end
end
if dob.obj =~/.*<:#>.*$/ #investigate removal
dob.obj=if dob.obj =~ /#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]}/
- txt_obj={:txt =>dob}
- format_text=Format_text_object.new(@md,txt_obj)
+ txt_obj={ txt: dob }
+ format_text=FormatTextObject.new(@md,txt_obj)
format_text.scr_inden_ocn_e_no_paranum
end
end
@@ -320,7 +349,7 @@ WOK
end
else #
end
- dob.obj.gsub!(/#{Mx[:pa_o]}:\S+#{Mx[:pa_c]}/,'') if dob.obj
+ dob.obj=dob.obj.gsub(/#{Mx[:pa_o]}:\S+#{Mx[:pa_c]}/,'') if dob.obj
end
end
6.downto(4) do |x|
@@ -333,14 +362,14 @@ WOK
end
end
def pre
- rdf=SiSU_XML_tags::RDF.new(@md)
- dir=SiSU_Env::Info_env.new
+ rdf=SiSU_XML_Tags::RDF.new(@md)
+ dir=SiSU_Env::InfoEnv.new
@@xml[:head],@@xml[:body]=[],[]
- css=SiSU_Env::CSS_select.new(@md).xhtml
+ stylesheet=SiSU_Style::CSS_HeadInfo.new(@md,'xhtml').stylesheet
encoding=(@sys.locale =~/utf-?8/i) ? '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' : '<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>'
@@xml[:open] =<<WOK
#{encoding}
-<?xml-stylesheet type="text/css" href="../#{@env.path.style}/#{css}"?>
+#{stylesheet.css_head_xml}
#{rdf.comment_xml}
<document>
WOK
@@ -357,7 +386,7 @@ WOK
content << @@xml[:open] << @@xml[:head] << @@xml[:body] << @@xml[:metadata]
content << @@xml[:owner_details] if @md.stmp =~/\w\w/
content << @@xml[:tail] << @@xml[:close]
- content.flatten!.compact!
+ content=content.flatten.compact
Output.new(content,@md).xhtml
@@xml={}
end
@@ -365,34 +394,35 @@ WOK
class Output
def initialize(data,md)
@data,@md=data,md
+ @file=SiSU_Env::FileOp.new(@md)
end
def xhtml
- SiSU_Env::SiSU_file.new(@md).mkdir
- filename_xml=SiSU_Env::SiSU_file.new(@md,@md.fn[:xhtml]).mkfile
+ SiSU_Env::FileOp.new(@md).mkdir
+ filename_xml=@file.write_file.xhtml
@data.each do |str|
- str.gsub!(/\A\s+\Z/m,'') #str.gsub!(/^\s+$/,'')
+ str=str.gsub(/\A\s+\Z/m,'') #str.gsub(/^\s+$/,'')
filename_xml.puts str unless str.empty?
end
filename_xml.close
end
end
class Tidy
- def initialize(md,dir)
- @md,@env=md,dir
- @prog=SiSU_Env::Info_program.new
+ def initialize(md,file)
+ @md,@file=md,file
+ @prog=SiSU_Env::InfoProgram.new
end
def xml
if @prog.tidy !=false
- if @md.cmd =~/[VM]/
- unless @md.cmd =~/q/
- SiSU_Screen::Ansi.new(@md.cmd,'invert','Using XML Tidy','check document structure').colorize
- tell=SiSU_Screen::Ansi.new(@md.cmd,'invert','','')
+ if @md.opt.cmd =~/[VM]/
+ unless @md.opt.cmd =~/q/
+ SiSU_Screen::Ansi.new(@md.opt.cmd,'invert','Using XML Tidy','check document structure').colorize
+ tell=SiSU_Screen::Ansi.new(@md.opt.cmd,'invert','','')
tell.grey_open
end
tidyfile='/dev/null' #don't want one or screen output, check for alternative flags
- tidy=SiSU_Env::System_call.new("#{@env.path.output}/#{@md.fnb}/#{@md.fn[:xhtml]}",tidyfile)
+ tidy=SiSU_Env::SystemCall.new(@file,tidyfile)
tidy.well_formed?
- tell.p_off unless @md.cmd =~/q/
+ tell.p_off unless @md.opt.cmd =~/q/
end
end
end
diff --git a/lib/sisu/v2/xhtml_table.rb b/lib/sisu/v4/xhtml_table.rb
index 25db60c8..991359fa 100644
--- a/lib/sisu/v2/xhtml_table.rb
+++ b/lib/sisu/v4/xhtml_table.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -56,13 +55,13 @@
** Description: shared html parts
=end
-module SiSU_XHTML_table
- require "#{SiSU_lib}/defaults" # defaults.rb
- class Table_xhtml
+module SiSU_XHTML_Table
+ require_relative 'defaults' # defaults.rb
+ class TableXHTML
@@tablehead=0
@@tablefoot=[] #watch
def initialize(table)
- @table_obj,@vz=table,SiSU_Env::Get_init.instance.skin
+ @table_obj,@vz=table,SiSU_Viz::Defaults.new
end
def table
table_obj=@table_obj
@@ -78,14 +77,14 @@ module SiSU_XHTML_table
table_row_with_columns=table_row.split(Mx[:tc_p])
trc,nc=[],0
table_row_with_columns.each do |c|
- c.gsub!(/^~$/,'') # tilde / empty cell
- c.gsub!(/<:br>/,'<br />')
+ c=c.gsub(/^~$/,''). # tilde / empty cell
+ gsub(/<:br>/,'<br />')
trc <<= if table_obj.head_ and nr==0; %{<th width="#{table_obj.widths[nc]}%">#{c}</th>}
else %{<td width="#{table_obj.widths[nc]}%">#{c}</td>}
end
nc+=1
end
- trc=trc.class==Array ? trc.flatten.join : trc
+ trc=(trc.is_a?(Array)) ? trc.flatten.join : trc
trc=" <tr>#{trc}</tr>\n"
nr+=1
table_rows << trc
diff --git a/lib/sisu/v2/xml.rb b/lib/sisu/v4/xml.rb
index d3ff280e..beccb393 100644
--- a/lib/sisu/v2/xml.rb
+++ b/lib/sisu/v4/xml.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -57,25 +56,25 @@
=end
module SiSU_XML_SAX
- require "#{SiSU_lib}/defaults" # defaults.rb
+ require_relative 'defaults' # defaults.rb
include SiSU_Viz
- require "#{SiSU_lib}/particulars" # particulars.rb
+ require_relative 'particulars' # particulars.rb
include SiSU_Particulars
- require "#{SiSU_lib}/sysenv" # sysenv.rb
+ require_relative 'sysenv' # sysenv.rb
include SiSU_Env
- require "#{SiSU_lib}/shared_xml" # shared_xml.rb
- include SiSU_XML_munge
- require "#{SiSU_lib}/xml_format" # xml_format.rb
- include SiSU_XML_format
- require "#{SiSU_lib}/rexml" # rexml.rb
+ require_relative 'shared_xml' # shared_xml.rb
+ include SiSU_XML_Munge
+ require_relative 'xml_format' # xml_format.rb
+ include SiSU_XML_Format
+ require_relative 'rexml' # rexml.rb
include SiSU_Rexml
- require "#{SiSU_lib}/shared_metadata" # shared_metadata.rb
+ require_relative 'shared_metadata' # shared_metadata.rb
@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0
@@tablefoot=''
class Source
def initialize(opt)
@opt=opt
- @particulars=SiSU_Particulars::Combined_singleton.instance.get_all(opt)
+ @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)
end
def read
begin
@@ -83,47 +82,55 @@ module SiSU_XML_SAX
unless @opt.cmd =~/q/
path=@env.path.output_tell
loc=@env.url.output_tell
- tool=if @opt.cmd =~/[MV]/; "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:sax]}\n\t#{@env.program.xml_viewer} #{path}/#{@md.fnb}/#{@md.fn[:sax]}"
- elsif @opt.cmd =~/v/; "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:sax]}"
- else @opt.fns
+ tool=if @opt.cmd =~/[MV]/; "#{@env.program.web_browser} file://#{@md.file.output_path.xml_sax.dir}/#{@md.file.base_filename.xml_sax}\n\t#{@env.program.xml_viewer} file://#{@md.file.output_path.xml_sax.dir}/#{@md.file.base_filename.xml_sax}"
+ elsif @opt.cmd =~/v/; "#{@env.program.web_browser} file://#{@md.file.output_path.xml_sax.dir}/#{@md.file.base_filename.xml_sax}"
+ else "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}"
end
@opt.cmd=~/[MVvz]/ \
- ? SiSU_Screen::Ansi.new(@opt.cmd,'invert','XML SAX',tool).colorize \
+ ? SiSU_Screen::Ansi.new(@opt.cmd,'invert','XML SAX',tool).colorize
: SiSU_Screen::Ansi.new(@opt.cmd,'XML SAX',tool).green_title_hi
- SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{path}/#{@md.fnb}/#{@md.fn[:sax]}").flow if @opt.cmd =~/[MV]/
+ SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"file://#{@md.file.output_path.xml_sax.dir}/#{@md.file.base_filename.xml_sax}").flow if @opt.cmd =~/[MV]/
end
SiSU_XML_SAX::Source::Songsheet.new(@particulars).song
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
ensure
#file closed in songsheet
+ SiSU_Env::CreateSite.new(@opt.cmd).cp_css
end
end
private
class Songsheet
def initialize(particulars)
@env,@md,@dal_array,@particulars=particulars.env,particulars.md,particulars.dal_array,particulars
+ @file=SiSU_Env::FileOp.new(@md)
end
def song
begin
SiSU_XML_SAX::Source::Scroll.new(@particulars).songsheet
- SiSU_XML_SAX::Source::Tidy.new(@md,@env).xml if @md.cmd =~/[vVM]/ # test wellformedness, comment out when not in use
- SiSU_Rexml::Rexml.new(@md,@md.fn[:sax]).xml if @md.cmd =~/M/ # test rexml parsing, comment out when not in use #debug
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error
+ SiSU_XML_SAX::Source::Tidy.new(@md,@file.place_file.xml_sax.dir).xml if @md.opt.cmd =~/[vVM]/ # test wellformedness, comment out when not in use
+ SiSU_Rexml::Rexml.new(@md,@file.place_file.xml_sax.dir).xml if @md.opt.cmd =~/M/ # test rexml parsing, comment out when not in use #debug
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
ensure
end
end
end
class Scroll
- require "#{SiSU_lib}/shared_txt" # shared_txt.rb
- include SiSU_text_utils
- require "#{SiSU_lib}/css" # css.rb
- require "#{SiSU_lib}/shared_xhtml" # decide use, whether xml rather than xhtml
- @@xml={ :body=>[],:open=>[],:close=>[],:head=>[] }
+ require_relative 'shared_txt' # shared_txt.rb
+ include SiSU_TextUtils
+ require_relative 'css' # css.rb
+ require_relative 'shared_xhtml' # decide use, whether xml rather than xhtml
+ @@xml={ body: [], open: [], close: [], head: [] }
def initialize(particulars)
@env,@md,@dal_array=particulars.env,particulars.md,particulars.dal_array
- @vz=SiSU_Env::Get_init.instance.skin
- @trans=SiSU_XML_munge::Trans.new(@md)
- @sys=SiSU_Env::System_call.new
+ @vz=SiSU_Viz::Defaults.new
+ @trans=SiSU_XML_Munge::Trans.new(@md)
+ @sys=SiSU_Env::SystemCall.new
end
def songsheet
pre
@@ -133,20 +140,20 @@ module SiSU_XML_SAX
end
protected
def embedded_endnotes(dob='')
- dob.obj.gsub!(/#{Mx[:en_a_o]}(\d+)\s+(.+?)#{Mx[:en_a_c]}/,
- '<endnote><number>\1</number><note>\2</note></endnote> ')
- dob.obj.gsub!(/#{Mx[:en_b_o]}([*+]\d+)\s+(.+?)#{Mx[:en_b_c]}/,
- '<endnote><symbol>\1</symbol><note>\2</note></endnote> ')
- dob.obj.gsub!(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)#{Mx[:en_a_c]}/,
- '<endnote><symbol>\1</symbol><note>\2</note></endnote> ')
+ dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}(\d+)\s+(.+?)#{Mx[:en_a_c]}/,
+ '<endnote><number>\1</number><note>\2</note></endnote> ').
+ gsub(/#{Mx[:en_b_o]}([*+]\d+)\s+(.+?)#{Mx[:en_b_c]}/,
+ '<endnote><symbol>\1</symbol><note>\2</note></endnote> ').
+ gsub(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)#{Mx[:en_a_c]}/,
+ '<endnote><symbol>\1</symbol><note>\2</note></endnote> ')
end
def extract_endnotes(dob='')
notes=dob.obj.scan(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})([\d*+]+\s+.+?)(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/)
notes.flatten.each do |e|
s=e.to_s
- util=SiSU_text_utils::Wrap.new(s,70)
+ util=SiSU_TextUtils::Wrap.new(s,70)
wrap=util.line_wrap
- wrap.gsub!(/^(\d+)\s+(.+?)\s*\Z/m, <<WOK
+ wrap=wrap.gsub(/^(\d+)\s+(.+?)\s*\Z/m, <<WOK
#{Ax[:tab]*1}<endnote notenumber="\\1">
#{Ax[:tab]*2}<number>\\1</number>
#{Ax[:tab]*2}<note>
@@ -154,8 +161,8 @@ module SiSU_XML_SAX
#{Ax[:tab]*2}</note>
#{Ax[:tab]*1}</endnote>
WOK
-)
- wrap.gsub!(/^([*+]\d+)\s+(.+?)\s*\Z/m, <<WOK
+).
+ gsub(/^([*+]\d+)\s+(.+?)\s*\Z/m, <<WOK
#{Ax[:tab]*1}<endnote symbol="\\1">
#{Ax[:tab]*2}<symbol>\\1</symbol>
#{Ax[:tab]*2}<note>
@@ -163,8 +170,8 @@ WOK
#{Ax[:tab]*2}</note>
#{Ax[:tab]*1}</endnote>
WOK
-)
- wrap.gsub!(/^([*+]+)\s+(.+?)\s*\Z/m, <<WOK
+).
+ gsub(/^([*+]+)\s+(.+?)\s*\Z/m, <<WOK
#{Ax[:tab]*1}<endnote symbol="\\1.length">
#{Ax[:tab]*2}<symbol>\\1</symbol>
#{Ax[:tab]*2}<note>
@@ -177,7 +184,7 @@ WOK
end
end
def xml_head
- metadata=Metadata::Summary.new(@md).xml_sax.metadata
+ metadata=SiSU_Metadata::Summary.new(@md).xml_sax.metadata
@@xml[:head] << metadata
end
def xml_sc(md='')
@@ -203,18 +210,18 @@ WOK
@@xml[:sc]=sc
end
def xml_structure(dob,type='norm')
- if dob.is=='heading'
+ if dob.is==:heading
lv=dob.ln
n=dob.ln - 1
n3=dob.ln + 2
else lv=nil
end
extract_endnotes(dob)
- dob.obj.gsub!(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'<en>\1</en>') #footnote/endnote clean
- dob.obj.gsub!(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'<en>\1</en>') #footnote/endnote clean
+ dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'<en>\1</en>'). #footnote/endnote clean
+ gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'<en>\1</en>') #footnote/endnote clean
#if defined? dob.obj
#t_ograph="#{dob.obj}"
- util=SiSU_text_utils::Wrap.new(dob.obj,70)
+ util=SiSU_TextUtils::Wrap.new(dob.obj,70)
wrapped=util.line_wrap
#end
@@xml[:body] << if defined? dob.ocn; %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}
@@ -229,12 +236,27 @@ WOK
@@xml[:body] << "#{Ax[:tab]*0}</object>"
@endnotes=[]
end
+ def block_structure(dob='')
+ extract_endnotes(dob)
+ dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'<en>\1</en>'). #footnote/endnote clean
+ gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'<en>\1</en>') #footnote/endnote clean
+ dob=@trans.markup_block(dob)
+ dob.obj=dob.obj.strip
+ @@xml[:body] << %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}
+ @@xml[:body] << %{#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>}
+ @@xml[:body] << %{#{Ax[:tab]*1}<text class="block">#{Ax[:tab]*1}}
+ @@xml[:body] << %{#{Ax[:tab]*2}#{dob.obj}#{Ax[:tab]*1}}
+ @@xml[:body] << %{#{Ax[:tab]*1}</text>}
+ @@xml[:body] << "#{Ax[:tab]*0}</object>"
+ @@xml[:body] << @endnotes if @endnotes
+ @endnotes=[]
+ end
def group_structure(dob='')
extract_endnotes(dob)
- dob.obj.gsub!(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'<en>\1</en>') #footnote/endnote clean
- dob.obj.gsub!(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'<en>\1</en>') #footnote/endnote clean
+ dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'<en>\1</en>'). #footnote/endnote clean
+ gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'<en>\1</en>') #footnote/endnote clean
dob=@trans.markup_group(dob)
- dob.obj.strip!
+ dob.obj=dob.obj.strip
@@xml[:body] << %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}
@@xml[:body] << %{#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>}
@@xml[:body] << %{#{Ax[:tab]*1}<text class="group">#{Ax[:tab]*1}}
@@ -246,8 +268,8 @@ WOK
end
def poem_structure(dob='')
dob=@trans.markup_group(dob)
- #dob.obj.gsub!(/\s\s/,'&#160;&#160;')
- dob.obj.strip!
+ #dob.obj.gsub(/\s\s/,'&#160;&#160;')
+ dob.obj=dob.obj.strip
@@xml[:body] << %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}
@@xml[:body] << %{#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>}
@@xml[:body] << %{#{Ax[:tab]*1}<text class="verse">#{Ax[:tab]*1}}
@@ -257,8 +279,7 @@ WOK
end
def code_structure(dob='')
dob=@trans.markup_group(dob)
- dob.obj.gsub!(/\s\s/,'&#160;&#160;')
- dob.obj.strip!
+ dob.obj=dob.obj.gsub(/\s\s/,'&#160;&#160;').strip
@@xml[:body] << %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}
@@xml[:body] << %{#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>}
@@xml[:body] << %{#{Ax[:tab]*1}<text class="code">#{Ax[:tab]*1}}
@@ -267,7 +288,7 @@ WOK
@@xml[:body] << "#{Ax[:tab]*0}</object>"
end
def table_structure(dob)
- table=SiSU_XHTML_shared::Table_xhtml.new(dob)
+ table=SiSU_XHTML_Shared::TableXHTML.new(dob)
@@xml[:body] << %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}
@@xml[:body] << %{#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>}
@@xml[:body] << %{#{Ax[:tab]*1}<text class="table">#{Ax[:tab]*1}}
@@ -291,20 +312,20 @@ WOK
@trans.char_enc.utf8(dob) if @sys.locale =~/utf-?8/i #% utf8
dob=@trans.markup(dob)
if @rcdc==false \
- and (dob.is =~/^meta/ \
+ and (dob.is ==:meta \
and dob.obj =~/Document Information/)
@rcdc=true
end
if dob.obj !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/
if defined? dob.ocn #look to move to format section
ocn=((dob.ocn.to_s =~/\d+/) ? dob.ocn : nil)
- @p_num=SiSU_XML_format::Paragraph_number.new(@md,ocn)
+ @p_num=SiSU_XML_Format::ParagraphNumber.new(@md,ocn)
end
if not @rcdc
if defined? dob.ocn \
and dob.ocn.to_s =~/\d+/
- x=SiSU_XML_format::Format_seg.new(@md,dob)
- if dob.is=='heading'
+ x=SiSU_XML_Format::FormatSeg.new(@md,dob)
+ if dob.is==:heading
xml_structure(dob)
dob.obj=case dob.ln
when 1; x.heading_body1
@@ -315,32 +336,39 @@ WOK
when 6; x.heading_body6
end
else
- if dob.is=='verse'
+ if dob.is==:verse
poem_structure(dob)
- elsif dob.is=='group'
+ elsif dob.is==:group
group_structure(dob)
- elsif dob.is=='code'
+ elsif dob.is==:block
+ block_structure(dob)
+ elsif dob.is==:code
code_structure(dob)
- elsif dob.is=='table' # FIX, check css, will need to modify
+ elsif dob.is==:table # FIX, check css, will need to modify
table_structure(dob)
- elsif dob.is =~ /^para/ \
+ elsif dob.is ==:para \
and dob.indent.to_s =~/[1-9]/ \
and dob.bullet_==true
xml_structure(dob,"indent_bullet#{dob.indent}")
- elsif dob.is =~ /^para/ \
- and dob.indent.to_s =~/[1-9]/
+ elsif dob.is ==:para \
+ and dob.indent.to_s =~/[1-9]/ \
+ and dob.indent == dob.hang
xml_structure(dob,"indent#{dob.indent}")
+ elsif dob.is ==:para \
+ and dob.hang.to_s =~/[0-9]/ \
+ and dob.indent != dob.hang
+ xml_structure(dob,"hang#{dob.hang.to_s}_indent#{dob.indent.to_s}")
else xml_structure(dob)
end
end
elsif dob.obj =~/(#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/
elsif dob.obj =~/MetaData/
- txt_obj={:txt =>'<br /><a name="metadata">MetaData</a>'}
- format_scroll=Format_scroll.new(@md,txt_obj)
+ txt_obj={ txt: '<br /><a name="metadata">MetaData</a>' }
+ format_scroll=FormatScroll.new(@md,txt_obj)
dob.obj=format_scroll.bold_para
elsif dob.obj =~/(Owner Details)/
-# txt_obj={:txt =>'<br /><a name="owner.details">Owner Details</a>'}
-# format_scroll=Format_scroll.new(@md,txt_obj)
+# txt_obj={ txt: '<br /><a name="owner.details">Owner Details</a>' }
+# format_scroll=FormatScroll.new(@md,txt_obj)
# @@xml[:owner_details]=format_scroll.bold_para
dob.obj=''
end
@@ -350,14 +378,14 @@ WOK
end
if dob.obj =~/.*<:#>.*$/ #investigate removal
dob.obj=if dob.obj =~ /#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]}/
- txt_obj={:txt =>dob}
- format_text=Format_text_object.new(@md,txt_obj)
+ txt_obj={ txt: dob }
+ format_text=FormatTextObject.new(@md,txt_obj)
format_text.scr_inden_ocn_e_no_paranum
end
end
else #
end
- dob.obj.gsub!(/#{Mx[:pa_o]}:\S+#{Mx[:pa_c]}/,'') if dob.obj
+ dob.obj=dob.obj.gsub(/#{Mx[:pa_o]}:\S+#{Mx[:pa_c]}/,'') if dob.obj
end
end
6.downto(4) do |x|
@@ -371,16 +399,16 @@ WOK
#6.downto(1) { |x| y=x - 1; @@xml[:body] << "#{Ax[:tab]*y}</level #{x}>" if @level[x]==true }
end
def pre
- rdf=SiSU_XML_tags::RDF.new(@md)
- dir=SiSU_Env::Info_env.new
+ rdf=SiSU_XML_Tags::RDF.new(@md)
+ dir=SiSU_Env::InfoEnv.new
@@xml[:head],@@xml[:body]=[],[]
- css=SiSU_Env::CSS_select.new(@md).xml_sax
+ stylesheet=SiSU_Style::CSS_HeadInfo.new(@md,'xml_sax').stylesheet
encoding=if @sys.locale =~/utf-?8/i; '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'
else '<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>'
end
@@xml[:open] =<<WOK
#{encoding}
-<?xml-stylesheet type="text/css" href="../#{dir.path.style}/#{css}"?>
+#{stylesheet.css_head_xml}
#{rdf.comment_xml}
<document>
WOK
@@ -398,7 +426,7 @@ WOK
content << @@xml[:open] << @@xml[:head] << @@xml[:body] << @@xml[:metadata]
content << @@xml[:owner_details] if @md.stmp =~/\w\w/
content << @@xml[:tail] << @@xml[:close]
- content.flatten!.compact!
+ content=content.flatten.compact
Output.new(content,@md).xml
@@xml={}
end
@@ -406,34 +434,35 @@ WOK
class Output
def initialize(data,md)
@data,@md=data,md
+ @file=SiSU_Env::FileOp.new(@md)
end
def xml
- SiSU_Env::SiSU_file.new(@md).mkdir
- filename_xml=SiSU_Env::SiSU_file.new(@md,@md.fn[:sax]).mkfile
+ SiSU_Env::FileOp.new(@md).mkdir
+ filename_xml=@file.write_file.xml_sax
@data.each do |str|
- str.gsub!(/\A\s+\Z/m,'') #str.gsub!(/^\s+$/,'')
+ str=str.gsub(/\A\s+\Z/m,'')
filename_xml.puts str unless str.empty?
end
filename_xml.close
end
end
class Tidy
- def initialize(md,dir)
- @md,@env=md,dir
- @prog=SiSU_Env::Info_program.new
+ def initialize(md,file)
+ @md,@file=md,file
+ @prog=SiSU_Env::InfoProgram.new
end
def xml
if @prog.tidy !=false #note values can be other than true
- if @md.cmd =~/[VM]/
- unless @md.cmd =~/q/
- SiSU_Screen::Ansi.new(@md.cmd,'invert','Using XML Tidy','check document structure').colorize
- tell=SiSU_Screen::Ansi.new(@md.cmd,'invert','','')
+ if @md.opt.cmd =~/[VM]/
+ unless @md.opt.cmd =~/q/
+ SiSU_Screen::Ansi.new(@md.opt.cmd,'invert','Using XML Tidy','check document structure').colorize
+ tell=SiSU_Screen::Ansi.new(@md.opt.cmd,'invert','','')
tell.grey_open
end
tidyfile='/dev/null' #don't want one or screen output, check for alternative flags
- tidy=SiSU_Env::System_call.new("#{@env.path.output}/#{@md.fnb}/#{@md.fn[:sax]}",tidyfile)
+ tidy=SiSU_Env::SystemCall.new(@file,tidyfile)
tidy.well_formed?
- tell.p_off unless @md.cmd =~/q/
+ tell.p_off unless @md.opt.cmd =~/q/
end
end
end
diff --git a/lib/sisu/v2/xml_dom.rb b/lib/sisu/v4/xml_dom.rb
index c07364f2..d0d39dbe 100644
--- a/lib/sisu/v2/xml_dom.rb
+++ b/lib/sisu/v4/xml_dom.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -30,9 +31,10 @@
If you have Internet connection, the latest version of the GPL should be
available at these locations:
- <http://www.fsf.org/licenses/gpl.html>
+ <http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf>
+
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -44,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -54,26 +56,26 @@
** Notes: tidy -xml dom.xml >> index.tidy
=end
module SiSU_XML_DOM
- require "#{SiSU_lib}/defaults" # defaults.rb
+ require_relative 'defaults' # defaults.rb
include SiSU_Viz
- require "#{SiSU_lib}/particulars" # particulars.rb
+ require_relative 'particulars' # particulars.rb
include SiSU_Particulars
- require "#{SiSU_lib}/sysenv" # sysenv.rb
+ require_relative 'sysenv' # sysenv.rb
include SiSU_Env
- require "#{SiSU_lib}/dal" # dal.rb
- require "#{SiSU_lib}/shared_xml" # shared_xml.rb
- include SiSU_XML_munge
- require "#{SiSU_lib}/xml_format" # xml_format.rb
- include SiSU_XML_format
- require "#{SiSU_lib}/rexml" # rexml.rb
+ require_relative 'dal' # dal.rb
+ require_relative 'shared_xml' # shared_xml.rb
+ include SiSU_XML_Munge
+ require_relative 'xml_format' # xml_format.rb
+ include SiSU_XML_Format
+ require_relative 'rexml' # rexml.rb
include SiSU_Rexml
- require "#{SiSU_lib}/shared_metadata" # shared_metadata.rb
+ require_relative 'shared_metadata' # shared_metadata.rb
@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0
@@tablefoot=''
class Source
def initialize(opt)
@opt=opt
- @particulars=SiSU_Particulars::Combined_singleton.instance.get_all(opt)
+ @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)
end
def read
begin
@@ -81,45 +83,53 @@ module SiSU_XML_DOM
unless @opt.cmd =~/q/
path=@env.path.output_tell
loc=@env.url.output_tell
- tool=if @opt.cmd =~/[MV]/; "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:dom]}\n\t#{@env.program.xml_viewer} #{path}/#{@md.fnb}/#{@md.fn[:dom]}"
- elsif @opt.cmd =~/v/; "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:dom]}"
- else @opt.fns
+ tool=if @opt.cmd =~/[MV]/; "#{@env.program.web_browser} file://#{@md.file.output_path.xml_dom.dir}/#{@md.file.base_filename.xml_dom}\n\t#{@env.program.xml_viewer} file://#{@md.file.output_path.xml_dom.dir}/#{@md.file.base_filename.xml_dom}"
+ elsif @opt.cmd =~/v/; "#{@env.program.web_browser} file://#{@md.file.output_path.xml_dom.dir}/#{@md.file.base_filename.xml_dom}"
+ else "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}"
end
@opt.cmd=~/[MVvz]/ \
- ? SiSU_Screen::Ansi.new(@opt.cmd,'invert','XML DOM',tool).colorize \
+ ? SiSU_Screen::Ansi.new(@opt.cmd,'invert','XML DOM',tool).colorize
: SiSU_Screen::Ansi.new(@opt.cmd,'XML DOM',tool).green_title_hi
- SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{path}/#{@md.fnb}/#{@md.fn[:dom]}").flow if @opt.cmd =~/[MV]/
+ SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"file://#{@md.file.output_path.xml_dom.dir}/#{@md.file.base_filename.xml_dom}").flow if @opt.cmd =~/[MV]/
end
SiSU_XML_DOM::Source::Songsheet.new(@particulars).songsheet
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
ensure
+ SiSU_Env::CreateSite.new(@opt.cmd).cp_css
end
end
private
class Songsheet
def initialize(particulars)
@env,@md,@dal_array,@particulars=particulars.env,particulars.md,particulars.dal_array,particulars
+ @file=SiSU_Env::FileOp.new(@md)
end
def songsheet
begin
SiSU_XML_DOM::Source::Scroll.new(@particulars).songsheet
- SiSU_XML_DOM::Source::Tidy.new(@md,@env).xml if @md.cmd =~/[vVM]/ # test wellformedness, comment out when not in use
- SiSU_Rexml::Rexml.new(@md,@md.fn[:dom]).xml if @md.cmd =~/M/ # test rexml parsing, comment out when not in use #debug
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error
+ SiSU_XML_DOM::Source::Tidy.new(@md,@file.place_file.xml_dom.dir).xml if @md.opt.cmd =~/[vVM]/ # test wellformedness, comment out when not in use
+ SiSU_Rexml::Rexml.new(@md,@file.place_file.xml_dom.dir).xml if @md.opt.cmd =~/M/ # test rexml parsing, comment out when not in use #debug
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
ensure
end
end
end
class Scroll
- require "#{SiSU_lib}/shared_txt" # shared_txt.rb
- include SiSU_text_utils
- require "#{SiSU_lib}/shared_xhtml" # decide use, whether xml rather than xhtml
- @@xml={ :body=>[],:open=>[],:close=>[],:head=>[],:sc=>[] }
+ require_relative 'shared_txt' # shared_txt.rb
+ include SiSU_TextUtils
+ require_relative 'shared_xhtml' # decide use, whether xml rather than xhtml
+ @@xml={ body: [], open: [], close: [], head: [], sc: [] }
def initialize(particulars)
@env,@md,@dal_array=particulars.env,particulars.md,particulars.dal_array
- @vz=SiSU_Env::Get_init.instance.skin
- @trans=SiSU_XML_munge::Trans.new(@md)
- @sys=SiSU_Env::System_call.new
+ @vz=SiSU_Viz::Defaults.new
+ @trans=SiSU_XML_Munge::Trans.new(@md)
+ @sys=SiSU_Env::SystemCall.new
end
def songsheet
pre
@@ -129,15 +139,15 @@ module SiSU_XML_DOM
end
protected
def xml_markup(dob='')
- dob.obj.gsub!(/#{Mx[:en_a_o]}(\d+)\s+(.+?)#{Mx[:en_a_c]}/,
- '<endnote><number>\1</number><note>\2</note></endnote> ')
- dob.obj.gsub!(/#{Mx[:en_b_o]}([*+]\d+)\s+(.+?)#{Mx[:en_b_c]}/,
- '<endnote><symbol>\1</symbol><note>\2</note></endnote> ')
- dob.obj.gsub!(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)#{Mx[:en_a_c]}/,
- '<endnote><symbol>\1</symbol><note>\2</note></endnote> ')
+ dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}(\d+)\s+(.+?)#{Mx[:en_a_c]}/,
+ '<endnote><number>\1</number><note>\2</note></endnote> ').
+ gsub(/#{Mx[:en_b_o]}([*+]\d+)\s+(.+?)#{Mx[:en_b_c]}/,
+ '<endnote><symbol>\1</symbol><note>\2</note></endnote> ').
+ gsub(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)#{Mx[:en_a_c]}/,
+ '<endnote><symbol>\1</symbol><note>\2</note></endnote> ')
end
def xml_head
- metadata=Metadata::Summary.new(@md).xml_dom.metadata
+ metadata=SiSU_Metadata::Summary.new(@md).xml_dom.metadata
@@xml[:head] << metadata
end
def xml_sc(md='')
@@ -164,7 +174,7 @@ WOK
end
def xml_element(dob,xml_el='',xml_content='',type='norm')
n=n1=n2=n3=0
- if dob.is=='heading'
+ if dob.is==:heading
lv=dob.ln
n=dob.ln - 1
n1=dob.ln
@@ -199,7 +209,7 @@ WOK
end
def xml_structure(dob,type='norm')
n=n1=n2=n3=0
- if dob.is=='heading'
+ if dob.is==:heading
lv=dob.ln
n=dob.ln - 1
n1=dob.ln
@@ -306,26 +316,30 @@ WOK
@@xml[:body] << %{#{Ax[:tab]*6}</object>}
end
end
+ def block_structure(dob)
+ dob=@trans.markup_block(dob) #decide check & FIX
+ dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}(\d+)\s+(.+?)#{Mx[:en_a_c]}/m,
+ '<endnote><number>\1</number><note>\2</note></endnote> ').strip
+ dob
+ end
def group_structure(dob)
dob=@trans.markup_group(dob) #decide check & FIX
- dob.obj.gsub!(/#{Mx[:en_a_o]}(\d+)\s+(.+?)#{Mx[:en_a_c]}/m,
- '<endnote><number>\1</number><note>\2</note></endnote> ')
- dob.obj.strip!
+ dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}(\d+)\s+(.+?)#{Mx[:en_a_c]}/m,
+ '<endnote><number>\1</number><note>\2</note></endnote> ').strip
dob
end
def poem_structure(dob)
dob=@trans.markup_group(dob) #decide check & FIX
- dob.obj.strip!
+ dob.obj=dob.obj.strip
dob
end
def code_structure(dob)
dob=@trans.markup_group(dob) #decide check & FIX
- dob.obj.gsub!(/\s\s/,'&#160;&#160;')
- dob.obj.strip!
+ dob.obj=dob.obj.gsub(/\s\s/,'&#160;&#160;').strip
dob
end
def table_structure(dob) #tables
- table=SiSU_XHTML_shared::Table_xhtml.new(dob)
+ table=SiSU_XHTML_Shared::TableXHTML.new(dob)
end
def markup(data)
xml_sc(@md)
@@ -339,18 +353,18 @@ WOK
@trans.char_enc.utf8(dob) if @sys.locale =~/utf-?8/i #% utf8
dob=@trans.markup(dob)
if @rcdc==false \
- and (dob.is =~/^meta/ \
+ and (dob.is ==:meta \
and dob.obj =~/Document Information/)
@rcdc=true
end
if dob !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/
- @p_num=SiSU_XML_format::Paragraph_number.new(@md,dob.ocn) if defined? dob.ocn
+ @p_num=SiSU_XML_Format::ParagraphNumber.new(@md,dob.ocn) if defined? dob.ocn
if not @rcdc
if defined? dob.ocn \
and dob.ocn.to_s =~/\d+/
- format_scroll=SiSU_XML_format::Format_scroll.new(@md,dob) if dob.is=='para' and dob.indent ##FIX
- x=SiSU_XML_format::Format_seg.new(@md,dob)
- if dob.is=='heading'
+ format_scroll=SiSU_XML_Format::FormatScroll.new(@md,dob) if dob.is==:para and dob.indent ##FIX
+ x=SiSU_XML_Format::FormatSeg.new(@md,dob)
+ if dob.is==:heading
if dob.ln==1
type="heading_section_#{dob.ln.to_s}"
xml_markup(dob)
@@ -383,27 +397,36 @@ WOK
end
else
ocn=dob.ocn
- if dob.is=='verse'
+ if dob.is==:verse
type='verse'
poem_structure(dob) #redo
- elsif dob.is=='group'
+ elsif dob.is==:group
type='group'
group_structure(dob) #redo
- elsif dob.is=='code'
+ elsif dob.is==:block
+ type='block'
+ block_structure(dob) #redo
+ elsif dob.is==:code
type='code'
code_structure(dob) #redo
- elsif dob.is=='table' # tables come as single block #work area 2005w13
+ elsif dob.is==:table # tables come as single block #work area 2005w13
type='table'
table_structure(dob)
- elsif dob.is=='para' \
+ elsif dob.is==:para \
and dob.indent.to_s =~/[1-9]/ \
and dob.bullet_
type="indent_bullet#{dob.indent.to_s}"
xml_markup(dob)
- elsif dob.is=='para' \
- and dob.indent.to_s =~/[1-9]/
+ elsif dob.is==:para \
+ and dob.indent.to_s =~/[1-9]/ \
+ and dob.indent == dob.hang
type="indent#{dob.indent.to_s}"
xml_markup(dob)
+ elsif dob.is==:para \
+ and dob.hang.to_s =~/[0-9]/ \
+ and dob.indent != dob.hang
+ type="hang#{dob.hang.to_s}_indent#{dob.indent.to_s}"
+ xml_markup(dob)
else
type='norm'
xml_markup(dob)
@@ -412,8 +435,8 @@ WOK
end
elsif dob.obj =~/(#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/
elsif dob.obj =~/(MetaData)/
- txt_obj={:txt =>'<br /><a name="metadata">MetaData</a>'}
- format_scroll=Format_scroll.new(@md,txt_obj)
+ txt_obj={ txt: '<br /><a name="metadata">MetaData</a>' }
+ format_scroll=FormatScroll.new(@md,txt_obj)
dob.obj=format_scroll.bold_para
elsif dob.obj =~/(Owner Details)/
dob.obj=''
@@ -424,8 +447,8 @@ WOK
end
if dob.obj =~/.*<:#>.*$/
dob.obj=if dob.obj =~ /#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]}/
- txt_obj={:txt =>dob.obj}
- format_text=Format_text_object.new(@md,txt_obj)
+ txt_obj={ txt: dob.obj }
+ format_text=FormatTextObject.new(@md,txt_obj)
format_text.scr_inden_ocn_e_no_paranum
end
end
@@ -433,7 +456,7 @@ WOK
end
else #
end
- dob.obj.gsub!(/#{Mx[:pa_o]}:\S+#{Mx[:pa_c]}/,'') if dob.obj
+ dob.obj=dob.obj.gsub(/#{Mx[:pa_o]}:\S+#{Mx[:pa_c]}/,'') if dob.obj
end
end
@content_flag=true
@@ -454,15 +477,15 @@ WOK
end
end
def pre
- rdf=SiSU_XML_tags::RDF.new(@md)
- dir=SiSU_Env::Info_env.new
- css=SiSU_Env::CSS_select.new(@md).xml_dom
+ rdf=SiSU_XML_Tags::RDF.new(@md)
+ dir=SiSU_Env::InfoEnv.new
+ stylesheet=SiSU_Style::CSS_HeadInfo.new(@md,'xml_dom').stylesheet
encoding=if @sys.locale =~/utf-?8/i; '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'
else '<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>'
end
@@xml[:open] =<<WOK
#{encoding}
-<?xml-stylesheet type="text/css" href="../#{dir.path.style}/#{css}"?>
+#{stylesheet.css_head_xml}
#{rdf.comment_xml}
<document>
WOK
@@ -480,7 +503,7 @@ WOK
content << @@xml[:open] << @@xml[:head] << @@xml[:body] << @@xml[:metadata]
content << @@xml[:owner_details] if @md.stmp =~/\w\w/
content << @@xml[:tail] << @@xml[:close]
- content.flatten!.compact!
+ content=content.flatten.compact
Output.new(content,@md).xml
@@xml[:head],@@xml[:body],@@xml[:tail]=[],[],[] # check whether should be nil
end
@@ -489,32 +512,33 @@ WOK
include SiSU_Param
def initialize(data,md)
@data,@md=data,md
+ @file=SiSU_Env::FileOp.new(@md)
end
def xml
- SiSU_Env::SiSU_file.new(@md).mkdir
- filename_xml=SiSU_Env::SiSU_file.new(@md,@md.fn[:dom]).mkfile
+ SiSU_Env::FileOp.new(@md).mkdir
+ filename_xml=@file.write_file.xml_dom
@data.each do |str|
- str.gsub!(/#{Mx[:pa_o]}:\S+#{Mx[:pa_c]}/,'')
+ str=str.gsub(/#{Mx[:pa_o]}:\S+#{Mx[:pa_c]}/,'')
filename_xml.puts str unless str.empty?
end
filename_xml.close
end
end
class Tidy
- def initialize(md,dir)
- @md,@env=md,dir
- @prog=SiSU_Env::Info_program.new
+ def initialize(md,file)
+ @md,@file=md,file
+ @prog=SiSU_Env::InfoProgram.new
end
def xml
if @prog.tidy !=false
- if @md.cmd =~/[VM]/
- SiSU_Screen::Ansi.new(@md.cmd,'invert','Using XML Tidy','check document structure').colorize unless @md.cmd =~/q/
- tell=SiSU_Screen::Ansi.new(@md.cmd,'invert','','')
- tell.grey_open unless @md.cmd =~/q/
+ if @md.opt.cmd =~/[VM]/
+ SiSU_Screen::Ansi.new(@md.opt.cmd,'invert','Using XML Tidy','check document structure').colorize unless @md.opt.cmd =~/q/
+ tell=SiSU_Screen::Ansi.new(@md.opt.cmd,'invert','','')
+ tell.grey_open unless @md.opt.cmd =~/q/
tidyfile='/dev/null' #don't want one or screen output, check for alternative flags
- tidy=SiSU_Env::System_call.new("#{@env.path.output}/#{@md.fnb}/#{@md.fn[:dom]}",tidyfile)
+ tidy=SiSU_Env::SystemCall.new(@file,tidyfile)
tidy.well_formed?
- tell.p_off unless @md.cmd =~/q/
+ tell.p_off unless @md.opt.cmd =~/q/
end
end
end
diff --git a/lib/sisu/v2/xml_fictionbook.rb b/lib/sisu/v4/xml_fictionbook.rb
index 045fdb93..abb903e9 100644
--- a/lib/sisu/v2/xml_fictionbook.rb
+++ b/lib/sisu/v4/xml_fictionbook.rb
@@ -1,13 +1,14 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
- * Description: extract and print an XML rendition of document structure to screen
+ * Description: a framework for document structuring, publishing and search
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,23 +46,23 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
<ralph.amissah@gmail.com>
- ** Description: SiSU information Structuring Universe, processing
+ ** Description: extract and print an XML rendition of document structure to screen
=end
module SiSU_XML_Fictionbook
- require "#{SiSU_lib}/dal" # dal.rb
- require "#{SiSU_lib}/sysenv" # sysenv.rb
+ require_relative 'dal' # dal.rb
+ require_relative 'sysenv' # sysenv.rb
include SiSU_Env
- require "#{SiSU_lib}/shared_txt" # shared_txt.rb
- include SiSU_text_utils
- require "#{SiSU_lib}/shared_xml" # shared_xml.rb
- include SiSU_XML_munge
+ require_relative 'shared_txt' # shared_txt.rb
+ include SiSU_TextUtils
+ require_relative 'shared_xml' # shared_xml.rb
+ include SiSU_XML_Munge
include SiSU_Param
pwd=Dir.pwd
class Source
@@ -76,7 +75,10 @@ module SiSU_XML_Fictionbook
@md=SiSU_Param::Parameters.new(@opt).get
@dal_array=SiSU_DAL::Source.new(@opt).get
SiSU_XML_Fictionbook::Source::Scroll.new(@dal_array,@md).songsheet
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
ensure
end
end
@@ -84,8 +86,8 @@ module SiSU_XML_Fictionbook
class Scroll <Source
def initialize(data='',md='')
@data,@md=data,md
- @trans=SiSU_XML_munge::Trans.new(@md)
- @file_fictionbook=SiSU_Env::SiSU_file.new(@md,'fictionbook.xml').mkfile
+ @trans=SiSU_XML_Munge::Trans.new(@md)
+ @file_fictionbook=SiSU_Env::FileOp.new(@md,'fictionbook.xml').mkfile
end
def songsheet
@t='fictionbook'
@@ -103,8 +105,8 @@ module SiSU_XML_Fictionbook
tail
end
def head
- version=SiSU_Env::Info_version.instance.get_version
- rb_ver=SiSU_Env::Info_version.instance.rbversion
+ version=SiSU_Env::InfoVersion.instance.get_version
+ rb_ver=SiSU_Env::InfoVersion.instance.rbversion
date_available=if defined? @md.date.available; "\n <p>#{@md.date.available} Initial version</p>"
else ''
end
@@ -151,14 +153,14 @@ WOK
@data.each do |para|
@endnotes << para.scan(/~\{(.+?)\}~/m)
end
- @endnotes.flatten!
+ @endnotes=@endnotes.flatten
end
def endnotes
@endnotes.each do |endnote|
- endnote.strip!
+ endnote=endnote.strip
endnote=@trans.markup_fictionbook(endnote)
endnote="<p>#{endnote}</p>"
- util=SiSU_text_utils::Wrap.new(endnote,80,10)
+ util=SiSU_TextUtils::Wrap.new(endnote,80,10)
endnote=util.line_wrap
put(endnote)
end
@@ -171,17 +173,17 @@ WOK
put(tail)
end
def markup(para,type='')
- para.strip!
+ para=para.strip
para=@trans.markup_fictionbook(para)
para=if type.empty?; "<p>#{para}</p>"
else "<#{type}><p>#{para}</p></#{type}>"
end
- util=SiSU_text_utils::Wrap.new(para,80,10)
+ util=SiSU_TextUtils::Wrap.new(para,80,10)
wrap=util.line_wrap
end
def put(line)
@file_fictionbook.puts line
- puts line if @md.cmd =~/V/
+ puts line if @md.opt.cmd =~/V/
end
def structure_build_tag_close(lev,h)
@sp=' '
@@ -261,7 +263,7 @@ WOK
y="#{@sp*6}<#{@s[6]}>\n#{x[:para]}"
@h[0]=6
else
- y=if @md.cmd =~/V/; "#{x[:para]}"
+ y=if @md.opt.cmd =~/V/; "#{x[:para]}"
else nil
end
end
@@ -286,7 +288,7 @@ WOK
@ds[c][:para]=markup(para,'title')
else
@ds[c]={}
- @ds[c][:para]=markup(para) if @md.cmd =~/V/
+ @ds[c][:para]=markup(para) if @md.opt.cmd =~/V/
end
c+=1
end
diff --git a/lib/sisu/v2/xml_format.rb b/lib/sisu/v4/xml_format.rb
index c98c2111..212a2866 100644
--- a/lib/sisu/v2/xml_format.rb
+++ b/lib/sisu/v4/xml_format.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -57,11 +56,11 @@
** Notes: tidy -xml index.xml >> index.tidy
=end
-module SiSU_XML_format
- require "#{SiSU_lib}/param" # param.rb
+module SiSU_XML_Format
+ require_relative 'param' # param.rb
include SiSU_Param
include SiSU_Viz
- class Paragraph_number
+ class ParagraphNumber
def initialize(md,paranum)
@md=md
@paranum=(paranum ? (/(\d+)/m.match(paranum)[1]) : nil)
@@ -84,7 +83,7 @@ module SiSU_XML_format
p_num_goto
end
end
- class Head_information
+ class HeadInformation
def initialize #dc rdf
@full_title=@subtitle=@author=@subject=@description=@publisher=@contributor=@date=@type=@format=@identifier=@source=@language=@relation=@coverage=@rights=@copyright=@owner=@keywords=''
@md=@@md
@@ -150,21 +149,31 @@ module SiSU_XML_format
@rdf_date_modified=%{ dc.date.modified="#{@md.date.modified}"\n}
@date_modified=%{<meta name="dc.date.modified" content="#{@md.date.modified}" #{@md.date_modified_scheme} />\n}
end
- if defined? @md.type \
- and @md.type # DublinCore 8 - type (genre eg. report, convention etc)
- @rdf_type=%{ dc.type="#{@md.type}"\n}
- @type=%{<meta name="dc.type" content="#{@md.type}" />\n}
+ if defined? @md.notes.coverage \
+ and @md.notes.coverage=~/\S+/ # DublinCore 14 - coverage
+ @rdf_coverage=%{ dc.coverage="#{@md.notes.coverage}"\n}
+ @coverage=%{<meta name="dc.coverage" content="#{@md.notes.coverage}" />\n}
end
- if defined? @md.classify.format \
- and @md.classify.format=~/\S+/ # DublinCore 9 - format (use your mime type)
- @rdf_format=%{ dc.format="#{@md.classify.format}"\n}
- @format=%{<meta name="dc.format" content="#{@md.classify.format}" />\n}
+ if defined? @md.notes.relation \
+ and @md.notes.relation=~/\S+/ # DublinCore 13 - relation
+ @rdf_relation=%{ dc.relation="#{@md.notes.relation}"\n}
+ @relation=%{<meta name="dc.relation" content="#{@md.notes.relation}" />\n}
end
- if defined? @md.classify.identifier \
- and @md.classify.identifier=~/\S+/ # DublinCore 10 - identifier (your identifier, could use urn which is free)
- @rdf_identifier=%{ dc.identifier="#{@md.classify.identifier}"\n}
- @identifier=%{<meta name="dc.identifier" content="#{@md.identifier}" />\n}
+ if defined? @md.notes.type \
+ and @md.notes.type # DublinCore 8 - type (genre eg. report, convention etc)
+ @rdf_type=%{ dc.type="#{@md.notes.type}"\n}
+ @type=%{<meta name="dc.type" content="#{@md.notes.type}" />\n}
end
+ if defined? @md.notes.format \
+ and @md.notes.format=~/\S+/ # DublinCore 9 - format (use your mime type)
+ @rdf_format=%{ dc.format="#{@md.notes.format}"\n}
+ @format=%{<meta name="dc.format" content="#{@md.notes.format}" />\n}
+ end
+ #if defined? @md.identifier.sisupod \
+ #and @md.identifier.sisupod=~/\S+/ # DublinCore 10 - identifier (your identifier, could use urn which is free)
+ # @rdf_identifier=%{ dc.identifier="#{@md.identifier.sisupod}"\n}
+ # @identifier=%{<meta name="dc.identifier" content="#{@md.identifier.sisupod}" />\n}
+ #end
if defined? @md.original.source \
and @md.original.source=~/\S+/ # DublinCore 11 - source (document source)
@rdf_source=%{ dc.source="#{@md.original.source}"\n}
@@ -175,16 +184,6 @@ module SiSU_XML_format
@rdf_language=%{ dc.language="#{@md.original.title}"\n}
@language=%{<meta name="dc.language" content="#{@md.language[:name]}" />\n}
end
- if defined? @md.classify.relation \
- and @md.classify.relation=~/\S+/ # DublinCore 13 - relation
- @rdf_relation=%{ dc.relation="#{@md.classify.relation}"\n}
- @relation=%{<meta name="dc.relation" content="#{@md.classify.relation}" />\n}
- end
- if defined? @md.classify.coverage \
- and @md.classify.coverage=~/\S+/ # DublinCore 14 - coverage
- @rdf_coverage=%{ dc.coverage="#{@md.classify.coverage}"\n}
- @coverage=%{<meta name="dc.coverage" content="#{@md.classify.coverage}" />\n}
- end
if defined? @md.rights.all \
and @md.rights.all=~/\S+/ # DublinCore 15 - rights
@rdf_rights=%{ dc.rights="#{@md.rights.all}"\n}
@@ -193,20 +192,12 @@ module SiSU_XML_format
@copyright=%{<meta name="copyright" content="#{@md.rights.copyright.all}" />\n} if @md.rights.copyright.all # possibly redundant see dc.rights
@owner=%{<meta name="owner" content="#{@md.owner}" />\n} if @md.owner
@keywords=%{<meta name="keywords" content="#{@md.keywords}" />\n} if @md.keywords
- @vz=SiSU_Env::Get_init.instance.skin #margin,paragraph,table,banner,url,png,txt,color,font,nav_txt,nav_png,credits,js,php
+ @vz=SiSU_Viz::Defaults.new #margin,paragraph,table,banner,url,png,txt,color,font,nav_txt,nav_png,credits,js,php
@index='index'
end
- def toc_head_escript #embedded script in this case PHP
- end
def table_close
'</font> </td></tr></table>'
end
- def buttons_home
- %{\n#{@banner.home_and_index_buttons}\n}
- end
- def copyat
- %{copy @ <a href="#{@url.home}" #{@js.home}>#{@txt.home}</a>}
- end
def toc_head
<<WOK
<html>
@@ -274,7 +265,7 @@ module SiSU_XML_format
WOK
end
end
- class Format_text_object
+ class FormatTextObject
attr_accessor :md,:txt,:format,:paranum,:p_num,:para_id,:headname,:font
def initialize(md,dob)
@md,@dob=md,dob
@@ -282,19 +273,19 @@ WOK
@paranum=/(\d+)/m.match(@dob[:ocn])[1]
@headname=''
@headname=%{<a name="h#{dob.name}"></a>} if defined? dob.name
- @p_num=SiSU_XML_format::Paragraph_number.new(@md,dob.ocn)
+ @p_num=SiSU_XML_Format::ParagraphNumber.new(@md,dob.ocn)
end
rgx=/^[1-6-]~{1,2}/ #watch
@lnk_url=@lnk_url.gsub(rgx,'') if @lnk_url =~rgx
rgx=/~\{\d+\s+(.+?)\}~/
@lnk_url=@lnk_url.gsub(rgx,'\1') if @lnk_url =~rgx
- @vz=SiSU_Env::Get_init.instance.skin
+ @vz=SiSU_Viz::Defaults.new
end
def scr_endnote_body
"<endnote>#{@txt}</endnote> "
end
end
- class Format_scroll < Format_text_object
+ class FormatScroll < FormatTextObject
def initialize(md,dob)
super(md,dob)
end
@@ -327,33 +318,26 @@ WOK
%{<p class="paranum"><font size="1" color="#777777">&nbsp;&nbsp;#{@dob.ocn}</font></p>\n}
end
end
- class Paragraph_number
+ class ParagraphNumber
def initialize(md,ocn)
@md,@ocn=md,ocn.to_s
@ocn ||=''
- vz=SiSU_Env::Get_init.instance.skin
- @skin_no_ocn=if not ocn
- true
- elsif defined? vz.ocn_display_off \
- and vz.ocn_display_off==true
- true
- else false
- end
end
def ocn_display
- if @md.markup.inspect =~/no_ocn/ \
- or @md.mod.inspect =~/--no-ocn/ \
- or @skin_no_ocn
- ocn_class='ocn_off'
- @ocn.gsub(/^(\d+|)$/,
- %{<label class="#{ocn_class}">&nbsp;</label>})
- elsif @ocn.to_i==0
- @ocn.gsub(/^(\d+|)$/,
- %{<label class="#{ocn_class}"><a name="#{@ocn}">&nbsp;</a></label>})
- else
+ @make=SiSU_Env::ProcessingSettings.new(@md)
+ if @make.build.ocn?
ocn_class='ocn'
+ if @ocn.to_i==0
+ @ocn.gsub(/^(\d+|)$/,
+ %{<label class="#{ocn_class}"><a name="#{@ocn}">&nbsp;</a></label>})
+ else
+ @ocn.gsub(/^(\d+|)$/,
+ %{<label class="#{ocn_class}"><a name="#{@ocn}">\\1</a></label>})
+ end
+ else
+ ocn_class='ocn_off'
@ocn.gsub(/^(\d+|)$/,
- %{<label class="#{ocn_class}"><a name="#{@ocn}">\\1</a></label>})
+ %{<label class="#{ocn_class}">&nbsp;</label>})
end
end
def name
@@ -366,15 +350,15 @@ WOK
%{<a href="##{@ocn}">}
end
end
- class Head_information
+ class HeadInformation
include SiSU_Viz
attr_reader :md,:sfx,:pdf,:rdf,:vz
def initialize(md)
@md=md
- @rdf=SiSU_XML_tags::RDF.new(md)
+ @rdf=SiSU_XML_Tags::RDF.new(md)
# DublinCore 1 - title
- @vz=SiSU_Env::Get_init.instance.skin
- @css=SiSU_Env::CSS_stylesheet.new(md)
+ @vz=SiSU_Viz::Defaults.new
+ @stylesheet=SiSU_Style::CSS_HeadInfo.new(md).stylesheet
@seg_name_html=(SiSU_HTML::Source::Seg.new.seg_name_html || [])
@seg_name_html_tracker=(SiSU_HTML::Source::Seg.new.seg_name_html_tracker || [])
@index='index'
@@ -390,108 +374,14 @@ WOK
%{ </font>
#{@vz.table_close}}
end
- def buttons_home
- %{<!- home and index buttons -!>
- #{@vz.banner_home_and_index_buttons}
-<!- home and index buttons -!>}
- end
- def copyat
- %{#{@vz.paragraph_font_tiny}copy @
- <a href="#{@vz.url_home}" #{@vz.js_home}>
- #{@vz.txt_home}
- </a></font>}
- end
def html_close #moved
%{</body>
</html>}
end
end
- class Widget < Head_information
- def initialize(md)
- super(md)
- @md=md
- @cf_defaults=SiSU_Env::Info_processing_flag.new
- end
- def home
- %{<td align="center" bgcolor=#{@vz.color_band2}>
- <a href="../index.html" target="_top">
- #{@vz.png_homepage}</a>
-</td>
-}
- end
- def scroll(text)
- if @md.fns =~ /\.(?:-|ssm\.)?sst$/
- scroll=%{<td align="center" bgcolor=#{@vz.color_band2}>
- <a href="#{@md.fn[:doc]}" target="_top" #{@vz.js_doc}>
- #{text}
- </a>
-</td>
-}
- end
- end
- def seg(text)
- %{<td align="center" bgcolor="#99CC66">
- <a href="#{@md.fn[:toc]}" target="_top" #{@vz.js_doc}>
- #{text}
- </a>
-</td>
-}
- end
- def search
- env=SiSU_Env::Info_env.new(@md.fns,@md)
- env.widget.search_form('sisusearch',nil,nil,true)
- end
- def manifest
- %{<td align="center" bgcolor=#{@vz.color_band2}>
- <a href="#{@md.fn[:manifest]}" target="_top" #{@vz.js_manifest}>
- #{@vz.nav_txt_manifest}
- </a>
-</td>}
- end
- def pdf
- pdf=if @md.programs[:pdf] \
- and @cf_defaults.cf_0 =~/p/
- %{
-<td align="center" bgcolor=#{@vz.color_band2}>
- <a href="#{@md.fn[:pdf_p]}" target="_top" #{@vz.js_portrait}>
- #{@vz.nav_txt_pdf_portrait}
- </a>
-</td>
-<td align="center" bgcolor=#{@vz.color_band2}>
- <a href="#{@md.fn[:pdf_l]}" target="_top" #{@vz.js_landscape}>
- #{@vz.nav_txt_pdf_landscape}
- </a>
-</td>
-}
- else ''
- end
- end
- def odf
- odf=if @cf_defaults.cf_0 =~/o/
- %{
-<td align="center" bgcolor=#{@vz.color_band2}>
- <a href="#{@md.fn[:odf]}" target="_top" #{@vz.js_odf}>
- #{@vz.nav_txt_odf}
- </a>
-</td>}
- else ''
- end
- end
- def concordance(text)
- if @md.concord_make \
- and @md.wc_words < 300000 #max word count for display of concordance here as would now be a large file
- %{<td align="center" bgcolor=#{@vz.color_band2}>
- <a href="#{@md.fn[:concordance]}" target="_top" #{@vz.js_concordance}>
- #{text}
- </a>
- </td>}
- else ''
- end
- end
- end
class XML
end
- class Head_toc < Head_information
+ class HeadToc < HeadInformation
def initialize(md)
super(md)
@md=md
@@ -537,7 +427,7 @@ WOK
if type=~/pdf/
@tocband_segtoc=make_scroll_seg_pdf
end
- firstseg=%{<a href="#{@md.fnl[:pre]}#{@md.firstseg}#{@md.fnl[:mid]}#{Sfx[:xhtml]}#{@md.fnl[:post]}" target="_top" alt="-&gt;">
+ firstseg=%{<a href="#{@md.firstseg}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top" alt="-&gt;">
#{@vz.png_nav_nxt}
</a>} if @md.firstseg =~/\S+/
%{<table summary="table of contents segment navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}>
@@ -556,7 +446,7 @@ WOK
if type=~/pdf/
@tocband_segtoc=make_scroll_seg_pdf
end
- firstseg=%{<a href="#{@md.fnl[:pre]}#{@md.firstseg}#{@md.fnl[:mid]}#{Sfx[:xhtml]}#{@md.fnl[:post]}" target="_top" alt="-&gt;">
+ firstseg=%{<a href="#{@md.firstseg}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top" alt="-&gt;">
#{@vz.png_nav_nxt}
</a>} if @md.firstseg =~/\S+/
%{<table summary="table of contents segment navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}>
@@ -571,21 +461,6 @@ WOK
#{@vz.table_close}
<p />}
end
- def manifest_link(text)
- %{<font size=2>
- <a href="#{@md.fn[:manifest]}" target="_top" #{@vz.js_manifest}>#{text}</a>
- </font>}
- end
- def concordance_link(text)
- if @md.concord_make
- %{<font size=2>
- <a href="#{@md.fn[:concordance]}" target="_top" #{@vz.js_concordance}>
- #{text}
- </a>
- </font>}
- else ''
- end
- end
def make_seg_scroll_pdf
wgt=Widget.new(@md)
scroll=%{<td align="center" bgcolor=#{@vz.color_band2}>
@@ -642,67 +517,12 @@ WOK
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
#{@rdf.rdftoc}
#{@rdf.metatag_html}
-#{@css.html}
+#{@stylesheet.css_head}
</head>
#{@vz.color_body}
<a name="top" id="top"></a>
<a name="up" id="up"></a>
-<a name="start" id="start"></a>
-#{@vz.js_top}}
- end
- def concordance
- if @md.concord_make
- %{#{@vz.margin_css}
- <h4 class="toc">
- <a href="./#{@md.fn[:concordance]}" #{@vz.js_concordance}>
- <i>Concordance</i>
- </a>
- </h4>
-#{@vz.table_close}}
- else
- %{#{@vz.margin_css}
-#{@vz.table_close}}
- end
- end
- def links_guide_vertical_open #???
- url=(((defined? @vz.url_hp) && @vz.url_hp =~/^https?:\/\/\S+$/) ? @vz.url_hp : @vz.url_home)
- %{
-<div id="vertical_links">
- <ul id="vertical">
- <li class="refbold">
- <a href="#{url}" #{@vz.js_home}>
- #{@vz.txt_hp}
- </a>
- </li>
- <li class="ref">
- Quick Ref.:
- </li>
- <li class="ref">
- <a href="#{@md.fn[:manifest]}" target="_top">
- Manifest
- </a>
- </li>
-<!- quick ref -!>}
- end
- def links_guide_horizontal_open #???
- url=(((defined? @vz.url_hp) && @vz.url_hp =~/^https?:\/\/\S+$/) ? @vz.url_hp : @vz.url_home)
- %{
-<div id="horizontal_links">
- <ul id="horizontal">
- <li class="refbold">
- <a href="#{url}" #{@vz.js_home}>
- #{@vz.txt_hp}
- </a>
- </li>
- <li class="ref">
- Quick Ref.:
- </li>
- <li class="ref">
- <a href="#{@md.fn[:manifest]}" target="_top">
- Manifest
- </a>
- </li>
-<!- quick ref -!>}
+<a name="start" id="start"></a>}
end
def links_guide_open(type='horizontal')
if type=='vertical'; links_guide_vertical_open
@@ -789,16 +609,12 @@ WOK
def metadata
%{#{@vz.margin_css}
<h4 class="toc">
- <a href="#{@metalink}" #{@vz.js_metalink}>
+ <a href="#{@metalink}">
<i>MetaData</i>
</a>
</h4>
#{@vz.table_close}}
end
- def seg_metadata
- @metalink=%{./#{@md.fn[:metadata]}}
- metadata
- end
def seg_tail
%{
<div class="main_column">
@@ -864,7 +680,7 @@ WOK
}
end
end
- class Head_seg < Head_information
+ class HeadSeg < HeadInformation
def initialize(md) #(md='')
super(md)
end
@@ -883,43 +699,24 @@ WOK
#{@vz.color_body}
<a name="top" id="top"></a>
<a name="up" id="up"></a>
-<a name="start" id="start"></a>
-#{@vz.js_top}}
+<a name="start" id="start"></a>}
end
def title_banner(title,subtitle,creator)
end
def dot_control_pre_next
%{<table summary="segment hidden control pre and next" width="100%" border="0" cellpadding="0" bgcolor=#{@vz.color_grey_pale} align="center">
<tr><td align="left">
- <a href="#{@md.fnl[:pre]}#{@seg_name_html[@seg_name_html_tracker-1]}#{@md.fnl[:mid]}#{Sfx[:xhtml]}#{@md.fnl[:post]}" target="_top" #{@vz.js_prev}>
+ <a href="#{@seg_name_html[@seg_name_html_tracker-1]}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top">
#{@vz.png_nav_dot_pre}
</a>
</td>
<td align="center">
- <a href="#{@md.fnl[:pre]}#{@index}#{@md.fnl[:mid]}#{Sfx[:xhtml]}#{@md.fnl[:post]}" target="_top" #{@vz.js_toc}>
+ <a href="#{@index}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top">
#{@vz.png_nav_dot_toc}
</a>
</td>
<td align="right">
- <a href="#{@md.fnl[:pre]}#{@seg_name_html[@seg_name_html_tracker+1]}#{@md.fnl[:mid]}#{Sfx[:xhtml]}#{@md.fnl[:post]}" target="_top" #{@vz.js_next}>
- #{@vz.png_nav_dot_nxt}
- </a>
-#{@vz.table_close}}
- end
- def dot_control_pre
- %{<table summary="segment hidden control pre" width="100%" border="0" cellpadding="0" bgcolor=#{@vz.color_grey_pale} align="center">
-<tr><td align="left">
- <a href="#{@md.fnl[:pre]}#{@seg_name_html[@seg_name_html_tracker-2]}#{@md.fnl[:mid]}#{Sfx[:xhtml]}#{@md.fnl[:post]}" target="_top" #{@vz.js_prev}>
- #{@vz.png_nav_dot_pre}
- </a>
-</td>
-<td align="center">
- <a href="#{@md.fnl[:pre]}#{@index}#{@md.fnl[:mid]}#{Sfx[:xhtml]}#{@md.fnl[:post]}" target="_top" #{@vz.js_toc}>
- #{@vz.png_nav_dot_toc}
- </a>
-</td>
-<td align="right">
- <a href="#{@md.fn[:toc]}" target="_top" #{@vz.js_next}>
+ <a href="#{@seg_name_html[@seg_name_html_tracker+1]}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top">
#{@vz.png_nav_dot_nxt}
</a>
#{@vz.table_close}}
@@ -927,17 +724,17 @@ WOK
def toc_nav(f_pre=false,f_nxt=false,use=1)
pre=nxt=''
toc=%{<td align="center" bgcolor=#{@vz.color_band1}>
- <a href="#{@md.fnl[:pre]}#{@index}#{@md.fnl[:mid]}#{Sfx[:xhtml]}#{@md.fnl[:post]}" target="_top" #{@vz.js_toc}>
+ <a href="#{@index}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top">
#{@vz.png_nav_toc}
</a>
</td>}
pre=%{<td align="center" bgcolor=#{@vz.color_band1}>
- <a href="#{@md.fnl[:pre]}#{@seg_name_html[@seg_name_html_tracker-use]}#{@md.fnl[:mid]}#{Sfx[:xhtml]}#{@md.fnl[:post]}" target="_top" #{@vz.js_prev}>
+ <a href="#{@seg_name_html[@seg_name_html_tracker-use]}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top">
#{@vz.png_nav_pre}
</a>
</td>} if f_pre==true
nxt=%{<td align="center" bgcolor=#{@vz.color_band1}>
- <a href="#{@md.fnl[:pre]}#{@seg_name_html[@seg_name_html_tracker+1]}#{@md.fnl[:mid]}#{Sfx[:xhtml]}#{@md.fnl[:post]}" target="_top" #{@vz.js_next}>
+ <a href="#{@seg_name_html[@seg_name_html_tracker+1]}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top">
#{@vz.png_nav_nxt}
</a>
</td>} if f_nxt==true
@@ -959,27 +756,10 @@ WOK
def toc_pre2
toc_nav(true,false,2).dup
end
- def manifest_link(text)
- %{<font size=2>
- <a href="#{@md.fn[:manifest]}" target="_top" #{@vz.js_manifest}>
- #{text}
- </a>
- </font>}
- end
- def concordance_link(text)
- if @md.concord_make
- %{<font size=2>
- <a href="#{@md.fn[:concordance]}" target="_top" #{@vz.js_concordance}>
- #{text}
- </a>
- </font>}
- else ''
- end
- end
def doc_types #used in seg_nav_band ###
scroll=seg=''
wgt=Widget.new(@md)
- #dir=SiSU_Env::Info_env.new(@md.fns)
+ #dir=SiSU_Env::InfoEnv.new(@md.fns)
x=if @md.concord_make
%{
<table summary="segment navigation available documents types: toc,doc,pdf,concordance" border="0" cellpadding="3" cellspacing="0">
@@ -1025,7 +805,7 @@ WOK
<font size="2">}
end
def header_advert_local_1
- dir=SiSU_Env::Info_env.new(@fns)
+ dir=SiSU_Env::InfoEnv.new(@fns)
%{ <center>
<table summary="image" border="0" cellpadding="3" cellspacing="0" align="center">
<tr><td align="center" bgcolor="white">
@@ -1037,7 +817,7 @@ WOK
</center>}
end
def header_advert_local_2
- dir=SiSU_Env::Info_env.new(@fns)
+ dir=SiSU_Env::InfoEnv.new(@fns)
%{ <center>
<table summary="image" border="0" cellpadding="3" cellspacing="0" align="center">
<tr><td align="center" bgcolor="white">
@@ -1049,7 +829,7 @@ WOK
</center>}
end
def header_advert_external
- dir=SiSU_Env::Info_env.new(@fns)
+ dir=SiSU_Env::InfoEnv.new(@fns)
%{ <center>
<table summary="image" border="0" cellpadding="3" cellspacing="0" align="center">
<tr><td align="center" bgcolor="white">
@@ -1129,17 +909,12 @@ WOK
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
#{@rdf.rdfseg}
#{@rdf.metatag_html}
-#{@css.html}
+#{@stylesheet.css_head}
</head>
#{@vz.color_body}
<a name="top" id="top"></a>
<a name="up" id="up"></a>
-<a name="start" id="start"></a>
-#{@vz.js_top}}
- end
- def toc_metadata
- @metalink=%{./#{@md.fn[:meatadata]}}
- toc_metadata
+<a name="start" id="start"></a>}
end
def title_banner(title,subtitle,creator)
%{
@@ -1163,7 +938,7 @@ WOK
}
end
end
- class Head_scroll < Head_toc
+ class HeadScroll < HeadToc
def initialize(md) #(md='')
super(md)
end
@@ -1197,12 +972,12 @@ WOK
#{@vz.paragraph_txt}}
end
end
- class Format_text_object
- @vz=SiSU_Env::Get_init.instance.skin
+ class FormatTextObject
+ @vz=SiSU_Viz::Defaults.new
attr_accessor :md,:dob,:txt,:ocn,:format,:table,:link,:linkname,:paranum,:p_num,:headname,:banner,:url
def initialize(md,t_o)
@md,@t_o=md,t_o
- if t_o.class==Hash
+ if t_o.is_a?(Hash)
@txt =t_o[:txt] || nil
@ocn =t_o[:ocn] || nil
@ocn_display =t_o[:ocn_display] || nil
@@ -1221,11 +996,11 @@ WOK
@ocn=if defined? t_o.ocn; t_o.ocn.to_s
else nil
end
- @headname=if t_o.is=='heading' and defined? t_o.name; t_o.name
+ @headname=if t_o.is==:heading and defined? t_o.name; t_o.name
else nil
end
else
- if @md.cmd =~/M/
+ if @md.opt.cmd =~/M/
p __FILE__ +':'+ __LINE__.to_s
p t_o.class
p caller
@@ -1233,7 +1008,7 @@ WOK
end
if defined? @t_o.ocn
ocn=((@t_o.ocn.to_s =~/\d+/) ? @t_o.ocn : nil)
- @p_num=Paragraph_number.new(@md,ocn)
+ @p_num=ParagraphNumber.new(@md,ocn)
end
if @format and not @format.empty?
if @format=~/^\d:(\S+)/ #need more reliable marker #if @format =~ /#{Rx[:lv]}/
@@ -1244,7 +1019,7 @@ WOK
end
end
@dob=t_o if defined? t_o.is
- @vz=SiSU_Env::Get_init.instance.skin
+ @vz=SiSU_Viz::Defaults.new
end
def endnote_body
%{
@@ -1372,17 +1147,18 @@ WOK
end
def gsub_body
#fix
- case @txt
+ @txt=case @txt
when /^\s*\((i+|iv|v|vi+|ix|x|xi+)\)/
- @txt.gsub!(/^\((i+|iv|v|vi+|ix|x|xi+)\)/,'<b>(\1)</b>')
- @txt.gsub!(/^(#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]})\s*\((i+|iv|v|vi+|ix|x|xi+)\)/,'\1<b>(\2)</b>')
+ @txt.gsub(/^\((i+|iv|v|vi+|ix|x|xi+)\)/,'<b>(\1)</b>').
+ gsub(/^(#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]})\s*\((i+|iv|v|vi+|ix|x|xi+)\)/,'\1<b>(\2)</b>')
when /^\s*\(?(\d|[a-z])+\)/
- @txt.gsub!(/^\((\d+|[a-z])+\)/,'<b>(\1)</b>')
- @txt.gsub!(/^(#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]})\s*\((\d+|[a-z])+\)/,'\1<b>(\2)</b>')
+ @txt.gsub(/^\((\d+|[a-z])+\)/,'<b>(\1)</b>').
+ gsub(/^(#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]})\s*\((\d+|[a-z])+\)/,'\1<b>(\2)</b>')
when /^\s*\d{1,3}\.\s/
- @txt.gsub!(/^\s*(\d+\.)/,'<b>\1</b>')
+ @txt.gsub(/^\s*(\d+\.)/,'<b>\1</b>')
when /^\s*[A-Z]\.\s/
- @txt.gsub!(/^\s*([A-Z]\.)/,'<b>\1</b>')
+ @txt.gsub(/^\s*([A-Z]\.)/,'<b>\1</b>')
+ else @txt
end
end
def bold_para
@@ -1395,8 +1171,8 @@ WOK
#{@vz.table_close}}
end
def bold_header
- @txt.gsub!(/[1-9]~(\S+)/,'<a name="\1"></a>')
- @txt.gsub!(/[1-9]~/,'')
+ @txt=@txt.gsub(/[1-9]~(\S+)/,'<a name="\1"></a>').
+ gsub(/[1-9]~/,'')
%{<p class="bold">
#{@txt}
</p>
@@ -1417,13 +1193,13 @@ WOK
%{<p class="centerbold">#{@txt}</p>\n}
end
end
- class Format_scroll < Format_text_object
+ class FormatScroll < FormatTextObject
def initialize(md,txt)
super(md,txt)
- @vz=SiSU_Env::Get_init.instance.skin
+ @vz=SiSU_Viz::Defaults.new
end
end
- class Format_seg < Format_text_object
+ class FormatSeg < FormatTextObject
def initialize(md,txt)
super(md,txt)
end
@@ -1479,7 +1255,7 @@ WOK
fn='doc' if fn.empty? #you may wish to reconsider, sends to 'doc' where no segment info # Sfx[:html] or Sfx[:xhtml] ?
%{
<p class="endnote">
- #{@endnote_part_a}#{@md.fnl[:pre]}#{fn}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}#{@endnote_part_b}
+ #{@endnote_part_a}#{fn}#{@md.lang_code_insert}#{Sfx[:html]}#{@endnote_part_b}
</p>
}
end
@@ -1492,9 +1268,9 @@ WOK
note=''
if txt =~/(#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}\s*)/m
note=$1
- note.gsub!(/[\n\s]+/m,' ')
- txt.gsub!(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ')
- txt.gsub!(/<a[\n\s]+name="-\d+"[\n\s]+href="#_\d+">&nbsp;<sup>\d+<\/sup>&nbsp;/m,'')
+ note=note.gsub(/[\n\s]+/m,' ')
+ txt=txt.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ').
+ gsub(/<a[\n\s]+name="-\d+"[\n\s]+href="#_\d+">&nbsp;<sup>\d+<\/sup>&nbsp;/m,'')
end
%{<#{tag} class="#{attrib}">
<a href="##{@ocn}"><i>#{txt}</i></a> #{note}
@@ -1508,7 +1284,7 @@ WOK
end
#% para sisu
def header_sub(tag,attrib)
- @txt.gsub!(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ')
+ @txt=@txt.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ')
%{
<div class="substance">
#{@p_num.ocn_display}
@@ -1557,7 +1333,7 @@ WOK
"<center>#{@txt}</center>"
end
end
- class Format_toc < Format_text_object
+ class FormatToc < FormatTextObject
def initialize(md,txt)
super(md,txt)
end
diff --git a/lib/sisu/v2/xml_md_oai_pmh_dc.rb b/lib/sisu/v4/xml_md_oai_pmh_dc.rb
index 5851a36b..56e19e0e 100644
--- a/lib/sisu/v2/xml_md_oai_pmh_dc.rb
+++ b/lib/sisu/v4/xml_md_oai_pmh_dc.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -56,10 +55,10 @@
** Description: summary of generated outputs and metadata
=end
-module SiSU_XML_metadata
- require "#{SiSU_lib}/sysenv" # sysenv.rb
+module SiSU_XML_Metadata
+ require_relative 'sysenv' # sysenv.rb
include SiSU_Env
- require "#{SiSU_lib}/param" # param.rb
+ require_relative 'param' # param.rb
include SiSU_Param
class OAI_PMH
def initialize(opt)
@@ -91,100 +90,101 @@ WOK
@oai_pmh << %{ <dc:author>#{txt}</dc:author>\n}
end
if defined? @md.classify.subject \
- and @md.classify.subject=~/\S+/ # DublinCore 3 - subject (us library of congress, eric or udc, or schema???)
+ and @md.classify.subject=~/\S+/ # DublinCore 3 - subject (us library of congress, eric or udc, or schema???)
txt=meta_content_clean(@md.classify.subject)
@oai_pmh << %{ <dc:subject>#{txt}</dc:subject>\n}
end
- if defined? @md.notes.description \
- and @md.notes.description=~/\S+/ # DublinCore 4 - description
- txt=meta_content_clean(@md.notes.description)
- @oai_pmh << %{ <dc:description>#{txt}</dc:description>\n}
+ if defined? @md.classify.keywords \
+ and @md.classify.keywords=~/\S+/
+ txt=meta_content_clean(@md.classify.keywords)
+ @oai_pmh << %{ <dc:keywords>#{txt}</dc:keywords>\n}
end
- if @md.publisher # DublinCore 5 - publisher (current copy published by)
+ if @md.publisher # DublinCore 5 - publisher (current copy published by)
txt=meta_content_clean(@md.publisher)
@oai_pmh << %{ <dc:publisher>#{txt}</dc:publisher>\n}
end
if defined? @md.creator.contributor \
- and @md.creator.contributor=~/\S+/ # DublinCore 6 - contributor
+ and @md.creator.contributor=~/\S+/ # DublinCore 6 - contributor
txt=meta_content_clean(@md.creator.contributor)
@oai_pmh << %{ <dc:contributor>#{txt}</dc:contributor>\n}
end
if defined? @md.date.published \
- and @md.date.published=~/\S+/ # DublinCore 7 - date year-mm-dd
+ and @md.date.published=~/\S+/ # DublinCore 7 - date year-mm-dd
@oai_pmh << %{ <dc:date>#{@md.date.published}</dc:date>\n}
end
if defined? @md.date.created \
- and @md.date.created=~/\S+/ # DublinCore 7 - date.created
+ and @md.date.created=~/\S+/ # DublinCore 7 - date.created
@oai_pmh << %{ <dc:date_created>#{@md.date.created}</dc:date_created>\n}
end
if defined? @md.date.issued \
- and @md.date.issued=~/\S+/ # DublinCore 7 - date.issued
+ and @md.date.issued=~/\S+/ # DublinCore 7 - date.issued
@oai_pmh << %{ <dc:date_issued>#{@md.date.issued}</dc:date_issued>\n}
end
if defined? @md.date.available \
- and @md.date.available=~/\S+/ # DublinCore 7 - date.available
+ and @md.date.available=~/\S+/ # DublinCore 7 - date.available
@oai_pmh << %{ <dc:date_available>#{@md.date.available}</dc:date_available>\n}
end
if defined? @md.date.valid \
- and @md.date.valid=~/\S+/ # DublinCore 7 - date.valid
+ and @md.date.valid=~/\S+/ # DublinCore 7 - date.valid
@oai_pmh << %{ <dc:date_valid>#{@md.date.valid}</dc:date_valid>\n}
end
if defined? @md.date.modified \
- and @md.date.modified=~/\S+/ # DublinCore 7 - date.modified
+ and @md.date.modified=~/\S+/ # DublinCore 7 - date.modified
@oai_pmh << %{ <dc:date_modified>#{@md.date.modified}</dc:date_modified>\n}
end
- if @md.type # DublinCore 8 - type
- txt=meta_content_clean(@md.type)
+ if defined? @md.notes.description \
+ and @md.notes.description=~/\S+/ # DublinCore 4 - description
+ txt=meta_content_clean(@md.notes.description)
+ @oai_pmh << %{ <dc:description>#{txt}</dc:description>\n}
+ end
+ if defined? @md.notes.coverage \
+ and @md.notes.coverage=~/\S+/ # DublinCore 14 - coverage
+ txt=meta_content_clean(@md.notes.coverage)
+ @oai_pmh << %{ <dc:coverage>#{txt}</dc:coverage>\n}
+ end
+ if defined? @md.notes.relation \
+ and @md.notes.relation=~/\S+/ # DublinCore 13 - relation
+ txt=meta_content_clean(@md.notes.relation)
+ @oai_pmh << %{ <dc:relation>#{txt}</dc:relation>\n}
+ end
+ if defined? @md.notes.type \
+ and @md.notes.type=~/\S+/ # DublinCore 8 - type
+ txt=meta_content_clean(@md.notes.type)
@oai_pmh << %{ <dc:type>#{txt}</dc:type>\n}
end
- if defined? @md.classify.format \
- and @md.classify.format=~/\S+/ # DublinCore 9 - format
- txt=meta_content_clean(@md.classify.format)
+ if defined? @md.notes.format \
+ and @md.notes.format=~/\S+/ # DublinCore 9 - format
+ txt=meta_content_clean(@md.notes.format)
@oai_pmh << %{ <dc:format>#{txt}</dc:format>\n}
end
- if defined? @md.classify.identifier \
- and @md.classify.identifier=~/\S+/ # DublinCore 10 - identifier
- txt=meta_content_clean(@md.classify.identifier)
- @oai_pmh << %{ <dc:identifier>#{txt}</dc:identifier>\n}
- end
+ #if defined? @md.identifier.sisupod \
+ #and @md.identifier.sisupod=~/\S+/ # DublinCore 10 - identifier
+ # txt=meta_content_clean(@md.identifier.sisupod)
+ # @oai_pmh << %{ <dc:identifier>#{txt}</dc:identifier>\n}
+ #end
if defined? @md.original.source \
- and @md.original.source=~/\S+/ # DublinCore 11 - source
+ and @md.original.source=~/\S+/ # DublinCore 11 - source
txt=meta_content_clean(@md.original.source)
@oai_pmh << %{ <dc:source>#{txt}</dc:source>\n}
end
if defined? @md.title.language \
- and @md.title.language=~/\S+/ # DublinCore 12 - language (English)
+ and @md.title.language=~/\S+/ # DublinCore 12 - language (English)
@oai_pmh << %{ <dc:language>#{@md.title.language}</dc:language>\n}
end
if defined? @md.original.language \
and @md.original.language=~/\S+/
@oai_pmh << %{ <dc:language>#{@md.original.language}</dc:language>\n}
end
- if defined? @md.classify.relation \
- and @md.classify.relation=~/\S+/ # DublinCore 13 - relation
- txt=meta_content_clean(@md.relation)
- @oai_pmh << %{ <dc:relation>#{txt}</dc:relation>\n}
- end
- if defined? @md.classify.coverage \
- and @md.classify.coverage=~/\S+/ # DublinCore 14 - coverage
- txt=meta_content_clean(@md.classify.coverage)
- @oai_pmh << %{ <dc:coverage>#{txt}</dc:coverage>\n}
- end
if defined? @md.rights.all \
- and @md.rights.all=~/\S+/ # DublinCore 15 - rights
+ and @md.rights.all=~/\S+/ # DublinCore 15 - rights
txt=meta_content_clean(@md.rights.all)
@oai_pmh << %{ <dc:rights>#{txt}</dc:rights>\n}
end
- if defined? @md.classify.keywords \
- and @md.classify.keywords=~/\S+/
- txt=meta_content_clean(@md.classify.keywords)
- @oai_pmh << %{ <dc:keywords>#{txt}</dc:keywords>\n}
- end
@oai_pmh
end
def meta_content_clean(content='')
unless content.nil?
- content.tr!('"',"'")
+ content=content.tr('"',"'")
end
content
end
@@ -192,8 +192,8 @@ WOK
'</oai_dc:dc>'
end
def output
- SiSU_Env::SiSU_file.new(@md).mkdir
- oai_pmh=SiSU_Env::SiSU_file.new(@md,@md.fn[:oai_pmh]).mkfile #implement in param
+ SiSU_Env::FileOp.new(@md).mkdir
+ oai_pmh=SiSU_Env::FileOp.new(@md,@md.fn[:oai_pmh]).mkfile #implement in param
oai_pmh << pre
body.each do |x|
oai_pmh << x
diff --git a/lib/sisu/v2/xml_scaffold.rb b/lib/sisu/v4/xml_scaffold.rb
index d85acd7e..2b7ae055 100644
--- a/lib/sisu/v2/xml_scaffold.rb
+++ b/lib/sisu/v4/xml_scaffold.rb
@@ -1,13 +1,14 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
- * Description: extract and print an XML rendition of document structure to screen
+ * Description: a framework for document structuring, publishing and search
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,33 +46,36 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
<ralph.amissah@gmail.com>
- ** Description: SiSU information Structuring Universe, processing
+ ** Description: extract and print an XML rendition of document structure to screen
=end
-module SiSU_XML_scaffold
- require "#{SiSU_lib}/particulars" # particulars.rb
+module SiSU_XML_Scaffold
+ require_relative 'particulars' # particulars.rb
include SiSU_Particulars
- require "#{SiSU_lib}/dal" # dal.rb
- require "#{SiSU_lib}/sysenv" # sysenv.rb
+ require_relative 'dal' # dal.rb
+ require_relative 'sysenv' # sysenv.rb
include SiSU_Env
pwd=Dir.pwd
class Source
def initialize(opt)
@opt=opt
- @particulars=SiSU_Particulars::Combined_singleton.instance.get_all(opt)
+ @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)
@sp=' '
end
def read
begin
@md,@dal_array=@particulars.md,@particulars.dal_array
- SiSU_XML_scaffold::Source::Scroll.new(@dal_array,@md).songsheet
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
+ SiSU_XML_Scaffold::Source::Scroll.new(@dal_array,@md).songsheet
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
ensure
end
end
@@ -103,20 +105,20 @@ module SiSU_XML_scaffold
# 'sect2' # 'section'
#] #]
data=@data
- structure_outline(data) if @md.cmd =~/V/
- structure_simple(data) if @md.cmd =~/V/
+ structure_outline(data) if @md.opt.cmd =~/V/
+ structure_simple(data) if @md.opt.cmd =~/V/
structure_build(data)
end
def structure_outline(data)
puts "\ninfo outline --->\n\n"
data.each do |o|
- puts "#{o.ocn} #{o.ln} #{o.obj}" if o.is =~/^heading/
+ puts "#{o.ocn} #{o.ln} #{o.obj}" if (o.is ==:heading || o.is ==:heading_insert)
end
end
def structure_simple(data)
puts "\nheading outline --->\n\n"
data.each_with_index do |o,i|
- if o.is =~ /^heading/; puts "<#{@s[o.ln]}>#{o.ocn} #{o.ln} #{o.obj}</#{@s[o.ln]}>"
+ if (o.is ==:heading || o.is ==:heading_insert); puts "<#{@s[o.ln]}>#{o.ocn} #{o.ln} #{o.obj}</#{@s[o.ln]}>"
end
end
end
@@ -125,7 +127,7 @@ module SiSU_XML_scaffold
h=[0,false,false,false]
puts "<#{@s[0]}>"
data.each_with_index do |o,i|
- if o.is =~/^heading/
+ if (o.is ==:heading || o.is ==:heading_insert)
case o.ln
when 1
structure_build_tag_close(o.ln,h)
diff --git a/lib/sisu/v2/xml_tables.rb b/lib/sisu/v4/xml_tables.rb
index 71bcb37e..8f95024d 100644
--- a/lib/sisu/v2/xml_tables.rb
+++ b/lib/sisu/v4/xml_tables.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -57,36 +56,36 @@
=end
module SiSU_Tables
- require "#{SiSU_lib}/defaults" # defaults.rb
+ require_relative 'defaults' # defaults.rb
include SiSU_Viz
class Table #_xml
@@tablehead=0
@@tablefoot=[] #watch #bug??? #check was @@tablefoot
def initialize(one,ocn='')
- @one,@parablock,@ocn,@vz=one,one,ocn,SiSU_Env::Get_init.instance.skin
+ @one,@parablock,@ocn,@vz=one,one,ocn,SiSU_Viz::Defaults.new
end
def table_split #% used but, no longer operational, revisit
@new_content=[]
@one.split(/\n/).each do |parablock|
- table=Table_xml.new("#{parablock}\n")
+ table=TableXML.new("#{parablock}\n")
@new_content << table.table
end
@new_content.join
end
end
- class Table_xml <Table
+ class TableXML <Table
@@tablehead=0
@@tablefoot=[]
def initialize(one,ocn='')
- @one,@parablock,@ocn,@vz=one,one,ocn,SiSU_Env::Get_init.instance.skin
+ @one,@parablock,@ocn,@vz=one,one,ocn,SiSU_Viz::Defaults.new
end
def table
m=@parablock[/<!f(.+?)!>/,1]
@@tablefoot << m if m
- @parablock.gsub!(/<!f.+?!>/,'')
+ @parablock=@parablock.gsub(/<!f.+?!>/,'')
@@tablehead=1 if @parablock =~/#{Mx[:gr_o]}Th#{Mx[:tc_p]}/u
if @parablock =~/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}/u
- @parablock.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+?#{Mx[:tc_p]}~(\d+);\w\d+;\w\d+#{Mx[:gr_c]}/u,
+ @parablock=@parablock.gsub(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+?#{Mx[:tc_p]}~(\d+);\w\d+;\w\d+#{Mx[:gr_c]}/u,
%{\n<ocn>#{@ocn}</ocn><table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">})
end
if @parablock =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/
@@ -96,37 +95,33 @@ module SiSU_Tables
end
if @@tablehead==1
if @parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}/u
- @parablock.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,
+ @parablock=@parablock.gsub(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,
%{<tr>
- <td width="\\1%" valign="top">
- #{@vz.paragraph_table_xml}<b>})
- @parablock.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,
- %{</b></td><td width="\\1%" valign="top">
- #{@vz.paragraph_table_xml}<b>})
- @parablock.gsub!(/#{Mx[:tc_c]}/,"</b>\n</td>\n</tr>")
+ <td width="\\1%" valign="top"><b>}).
+ gsub(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,
+ %{</b></td><td width="\\1%" valign="top"><b>}).
+ gsub(/#{Mx[:tc_c]}/,"</b>\n</td>\n</tr>")
@@tablehead=0
end
@parablock
else
- @parablock.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,
+ @parablock=@parablock.gsub(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,
%{<tr>
- <td width="\\1%" valign="top">
- #{@vz.paragraph_table_xml}})
- @parablock.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,
- %{
+ <td width="\\1%" valign="top">}).
+ gsub(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,
+ %{
</td>
- <td width="\\1%" valign="top">
- #{@vz.paragraph_table_xml}})
- @parablock.gsub!(/#{Mx[:tc_c]}/,"\n</td>\n</tr>\n")
+ <td width="\\1%" valign="top">}).
+ gsub(/#{Mx[:tc_c]}/,"\n</td>\n</tr>\n")
end
@parablock
end
end
- class Table_xml_exp <Table
+ class TableXMLexp <Table
@@tablehead=0
@@tablefoot=[]
def initialize(one)
- @one,@parablock,@vz=one,one,SiSU_Env::Get_init.instance.skin
+ @one,@parablock,@vz=one,one,SiSU_Viz::Defaults.new
end
def table_head(inf)
%{<table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">
@@ -159,7 +154,7 @@ module SiSU_Tables
def table
m=@parablock[/<!f(.+?)!>/,1]
@@tablefoot << m if m
- @parablock.gsub!(/<!f.+?!>/,'')
+ @parablock=@parablock.gsub(/<!f.+?!>/,'')
@@tablehead=1 if @parablock =~/#{Mx[:gr_o]}Th#{Mx[:tc_p]}/u
if @parablock =~/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+?#{Mx[:tc_p]}~(\d+);\w\d+;\w\d+#{Mx[:gr_c]}/u; @parablock=table_head($1)
end
@@ -173,26 +168,26 @@ module SiSU_Tables
if @@tablehead==1
if @parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}/u
if @parablock =~/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u
- @parablock.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_row($1,true))
+ @parablock=@parablock.gsub(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_row($1,true))
end
if @parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u
- @parablock.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_cell($1,true))
+ @parablock=@parablock.gsub(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_cell($1,true))
end
if @parablock =~/#{Mx[:tc_c]}/
- @parablock.gsub!(/#{Mx[:tc_c]}/,table_row_close(true))
+ @parablock=@parablock.gsub(/#{Mx[:tc_c]}/,table_row_close(true))
end
@@tablehead=0
end
@parablock
else
if @parablock =~/^#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u
- @parablock.gsub!(/^#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_row($1))
+ @parablock=@parablock.gsub(/^#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_row($1))
end
if @parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u
- @parablock.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_cell($1))
+ @parablock=@parablock.gsub(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_cell($1))
end
if @parablock =~/#{Mx[:tc_c]}/
- @parablock.gsub!(/#{Mx[:tc_c]}/,table_row_close)
+ @parablock=@parablock.gsub(/#{Mx[:tc_c]}/,table_row_close)
end
@parablock
end
diff --git a/lib/sisu/v2/zap.rb b/lib/sisu/v4/zap.rb
index 4e925813..5e338da2 100644
--- a/lib/sisu/v2/zap.rb
+++ b/lib/sisu/v4/zap.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# encoding: utf-8
=begin
* Name: SiSU
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -57,18 +56,18 @@
=end
module SiSU_Zap
- require "#{SiSU_lib}/sysenv" # sysenv.rb
+ require_relative 'sysenv' # sysenv.rb
include SiSU_Env
pwd=Dir.pwd
class Source
def initialize(opt)
@opt=opt
- @env=SiSU_Env::Info_env.new(@opt.fns)
+ @env=SiSU_Env::InfoEnv.new(@opt.fns)
@zap_path="#{@env.path.output}/#{@env.fnb}"
- @zap=SiSU_Env::Clean_output.new(@opt)
+ @zap=SiSU_Env::CleanOutput.new(@opt)
end
def read
- if SiSU_Env::Info_settings.new.permission?('zap')
+ if SiSU_Env::InfoSettings.new.permission?('zap')
tell=SiSU_Screen::Ansi.new(@opt.cmd,"Clean files related to processing #{@opt.cmd} ->","#{@opt.fns} -> #{@zap_path}")
@zap.zap.main_output
@zap.zap.site_map
diff --git a/man/man1/sisu-concordance.1 b/man/man1/sisu-concordance.1
index 2b5a981f..f1eb4705 100644
--- a/man/man1/sisu-concordance.1
+++ b/man/man1/sisu-concordance.1
@@ -1,4 +1,4 @@
-.TH SISU\-CONCORDANCE 1 "2011\-03\-05" "2.8.1" "SiSU"
+.TH SISU-CONCORDANCE 1 "2011-03-05" "2.8.1" "SiSU"
.SH NAME
\fBSiSU\fR \- Structured information, Serialized Units \- a document publishing system
@@ -16,8 +16,6 @@ The \fBsisu\-concordance\fR command is an alias for \fBsisu \-\-concordance\fR (
.br
\fIsisu\-epub\fR(1),
.br
-\fIsisu\-git\fR(1),
-.br
\fIsisu\-harvest\fR(1),
.br
\fIsisu\-html\fR(1),
@@ -28,8 +26,6 @@ The \fBsisu\-concordance\fR command is an alias for \fBsisu \-\-concordance\fR (
.br
\fIsisu\-pg\fR(1),
.br
-\fIsisu\-po\fR(1),
-.br
\fIsisu\-sqlite\fR(1),
.br
\fIsisu\-txt\fR(1).
diff --git a/man/man1/sisu-epub.1 b/man/man1/sisu-epub.1
index ab6a4d6e..bf4c2755 100644
--- a/man/man1/sisu-epub.1
+++ b/man/man1/sisu-epub.1
@@ -1,4 +1,4 @@
-.TH SISU\-EPUB 1 "2011\-03\-05" "2.8.1" "SiSU"
+.TH SISU-EPUB 1 "2011-03-05" "2.8.1" "SiSU"
.SH NAME
\fBSiSU\fR \- Structured information, Serialized Units \- a document publishing system
@@ -16,8 +16,6 @@ The \fBsisu\-epub\fR command is an alias for \fBsisu \-\-epub\fR (or \fBsisu \-e
.br
\fIsisu\-concordance\fR(1),
.br
-\fIsisu\-git\fR(1),
-.br
\fIsisu\-harvest\fR(1),
.br
\fIsisu\-html\fR(1),
@@ -28,8 +26,6 @@ The \fBsisu\-epub\fR command is an alias for \fBsisu \-\-epub\fR (or \fBsisu \-e
.br
\fIsisu\-pg\fR(1),
.br
-\fIsisu\-po\fR(1),
-.br
\fIsisu\-sqlite\fR(1),
.br
\fIsisu\-txt\fR(1).
diff --git a/man/man1/sisu-git.1 b/man/man1/sisu-git.1
deleted file mode 100644
index c5c612eb..00000000
--- a/man/man1/sisu-git.1
+++ /dev/null
@@ -1,39 +0,0 @@
-.TH SISU\-GIT 1 "2011\-03\-05" "2.8.1" "SiSU"
-
-.SH NAME
-\fBSiSU\fR \- Structured information, Serialized Units \- a document publishing system
-
-.SH SYNOPSIS
-\fBsisu\-git\fR \fIsisu_document.sst\fR | \fIsisu_document.ssm\fR
-
-.SH DESCRIPTION
-\fBSiSU\fR is a lightweight markup based document structuring, publishing and search framework for document collections.
-.PP
-The \fBsisu\-git\fR command is an alias for \fBsisu \-\-git\fR (or \fBsisu \-g\fR) which produces a git repository of the sisu source document and associated parts (images, ).
-
-.SH SEE ALSO
-\fIsisu\fR(1),
-.br
-\fIsisu\-concordance\fR(1),
-.br
-\fIsisu\-epub\fR(1),
-.br
-\fIsisu\-harvest\fR(1),
-.br
-\fIsisu\-html\fR(1),
-.br
-\fIsisu\-pdf\fR(1),
-.br
-\fIsisu\-pg\fR(1),
-.br
-\fIsisu\-po\fR(1),
-.br
-\fIsisu\-sqlite\fR(1),
-.br
-\fIsisu\-txt\fR(1).
-
-.SH HOMEPAGE
-More information about \fBSiSU\fR can be found at <\fIhttp://www.sisudoc.org/\fR> or <\fIhttp://www.jus.uio.no/sisu/\fR>.
-
-.SH AUTHOR
-\fBSiSU\fR is written by Ralph Amissah <\fIralph@amissah.com\fR>.
diff --git a/man/man1/sisu-harvest.1 b/man/man1/sisu-harvest.1
index 3967c18e..35b7b9c9 100644
--- a/man/man1/sisu-harvest.1
+++ b/man/man1/sisu-harvest.1
@@ -1,4 +1,4 @@
-.TH SISU\-HARVEST 1 "2011\-03\-05" "2.8.1" "SiSU"
+.TH SISU-HARVEST 1 "2011-03-05" "2.8.1" "SiSU"
.SH NAME
\fBSiSU\fR \- Structured information, Serialized Units \- a document publishing system
@@ -18,8 +18,6 @@ The \fBsisu\-harvest\fR command is an alias for \fBsisu \-\-harvest\fR which bas
.br
\fIsisu\-epub\fR(1),
.br
-\fIsisu\-git\fR(1),
-.br
\fIsisu\-html\fR(1),
.br
\fIsisu\-pdf\fR(1),
@@ -28,8 +26,6 @@ The \fBsisu\-harvest\fR command is an alias for \fBsisu \-\-harvest\fR which bas
.br
\fIsisu\-pg\fR(1),
.br
-\fIsisu\-po\fR(1),
-.br
\fIsisu\-sqlite\fR(1),
.br
\fIsisu\-txt\fR(1).
diff --git a/man/man1/sisu-html.1 b/man/man1/sisu-html.1
index 7d80cb69..205cb8d9 100644
--- a/man/man1/sisu-html.1
+++ b/man/man1/sisu-html.1
@@ -1,4 +1,4 @@
-.TH SISU\-HTML 1 "2011\-03\-05" "2.8.1" "SiSU"
+.TH SISU-HTML 1 "2011-03-05" "2.8.1" "SiSU"
.SH NAME
\fBSiSU\fR \- Structured information, Serialized Units \- a document publishing system
@@ -18,8 +18,6 @@ The \fBsisu\-html\fR command is an alias for \fBsisu \-\-html\fR (or \fBsisu \-h
.br
\fIsisu\-epub\fR(1),
.br
-\fIsisu\-git\fR(1),
-.br
\fIsisu\-harvest\fR(1),
.br
\fIsisu\-pdf\fR(1),
@@ -28,8 +26,6 @@ The \fBsisu\-html\fR command is an alias for \fBsisu \-\-html\fR (or \fBsisu \-h
.br
\fIsisu\-pg\fR(1),
.br
-\fIsisu\-po\fR(1),
-.br
\fIsisu\-sqlite\fR(1),
.br
\fIsisu\-txt\fR(1).
diff --git a/man/man1/sisu-odf.1 b/man/man1/sisu-odf.1
index 9e3bbbba..18df172f 100644
--- a/man/man1/sisu-odf.1
+++ b/man/man1/sisu-odf.1
@@ -1,4 +1,4 @@
-.TH SISU\-ODF 1 "2011\-03\-05" "2.8.1" "SiSU"
+.TH SISU-ODF 1 "2011-03-05" "2.8.1" "SiSU"
.SH NAME
\fBSiSU\fR \- Structured information, Serialized Units \- a document publishing system
@@ -18,8 +18,6 @@ The \fBsisu\-odf\fR command is an alias for \fBsisu \-\-odt\fR (or \fBsisu \-o\f
.br
\fIsisu\-epub\fR(1),
.br
-\fIsisu\-git\fR(1),
-.br
\fIsisu\-harvest\fR(1),
.br
\fIsisu\-html\fR(1),
@@ -28,8 +26,6 @@ The \fBsisu\-odf\fR command is an alias for \fBsisu \-\-odt\fR (or \fBsisu \-o\f
.br
\fIsisu\-pg\fR(1),
.br
-\fIsisu\-po\fR(1),
-.br
\fIsisu\-sqlite\fR(1),
.br
\fIsisu\-txt\fR(1).
diff --git a/man/man1/sisu-pdf.1 b/man/man1/sisu-pdf.1
index 49a86ef1..07cd526d 100644
--- a/man/man1/sisu-pdf.1
+++ b/man/man1/sisu-pdf.1
@@ -1,4 +1,4 @@
-.TH SISU\-PDF 1 "2011\-03\-05" "2.8.1" "SiSU"
+.TH SISU-PDF 1 "2011-03-05" "2.8.1" "SiSU"
.SH NAME
\fBSiSU\fR \- Structured information, Serialized Units \- a document publishing system
@@ -18,8 +18,6 @@ The \fBsisu\-pdf\fR command is an alias for \fBsisu \-\-pdf\fR (or \fBsisu \-p\f
.br
\fIsisu\-epub\fR(1),
.br
-\fIsisu\-git\fR(1),
-.br
\fIsisu\-harvest\fR(1),
.br
\fIsisu\-html\fR(1),
@@ -28,8 +26,6 @@ The \fBsisu\-pdf\fR command is an alias for \fBsisu \-\-pdf\fR (or \fBsisu \-p\f
.br
\fIsisu\-pg\fR(1),
.br
-\fIsisu\-po\fR(1),
-.br
\fIsisu\-sqlite\fR(1),
.br
\fIsisu\-txt\fR(1).
diff --git a/man/man1/sisu-pg.1 b/man/man1/sisu-pg.1
index 81125ff2..094b84d5 100644
--- a/man/man1/sisu-pg.1
+++ b/man/man1/sisu-pg.1
@@ -1,4 +1,4 @@
-.TH SISU\-PG 1 "2011\-03\-05" "2.8.1" "SiSU"
+.TH SISU-PG 1 "2011-03-05" "2.8.1" "SiSU"
.SH NAME
\fBSiSU\fR \- Structured information, Serialized Units \- a document publishing system
@@ -18,16 +18,12 @@ The \fBsisu\-pq\fR command is an alias for \fBsisu \-\-pg\fR (or \fBsisu \-D\fR)
.br
\fIsisu\-epub\fR(1),
.br
-\fIsisu\-git\fR(1),
-.br
\fIsisu\-harvest\fR(1),
.br
\fIsisu\-html\fR(1),
.br
\fIsisu\-pdf\fR(1),
.br
-\fIsisu\-po\fR(1),
-.br
\fIsisu\-odf\fR(1),
.br
\fIsisu\-sqlite\fR(1),
diff --git a/man/man1/sisu-po.1 b/man/man1/sisu-po.1
deleted file mode 100644
index 7581369d..00000000
--- a/man/man1/sisu-po.1
+++ /dev/null
@@ -1,42 +0,0 @@
-.TH SISU\-PO 1 "2011\-03\-05" "2.8.1" "SiSU"
-
-.SH NAME
-\fBSiSU\fR \- Structured information, Serialized Units \- a document publishing system
-
-.SH SYNOPSIS
-\fBsisu\-po\fR \fIsisu_document.sst\fR | \fIsisu_document.ssm\fR
-
-.SH DESCRIPTION
-\fBSiSU\fR is a lightweight markup based document structuring, publishing and search framework for document collections.
-.PP
-The \fBsisu\-po\fR command is an alias for \fBsisu \-\-po4a\fR (or \fBsisu \-o\fR) which provided two sisu markup files of the same document in different languages produces .pot and .po output of a SiSU markup file. Experimental, and under development.
-
-.SH SEE ALSO
-\fIsisu\fR(1),
-.br
-\fIsisu\-concordance\fR(1),
-.br
-\fIsisu\-epub\fR(1),
-.br
-\fIsisu\-git\fR(1),
-.br
-\fIsisu\-harvest\fR(1),
-.br
-\fIsisu\-html\fR(1),
-.br
-\fIsisu\-odf\fR(1),
-.br
-\fIsisu\-pdf\fR(1),
-.br
-\fIsisu\-pg\fR(1),
-.br
-\fIsisu\-sqlite\fR(1),
-.br
-\fIsisu\-txt\fR(1).
-
-.SH HOMEPAGE
-More information about \fBSiSU\fR can be found at <\fIhttp://www.sisudoc.org/\fR> or <\fIhttp://www.jus.uio.no/sisu/\fR>.
-
-.SH AUTHOR
-\fBSiSU\fR is written by Ralph Amissah <\fIralph@amissah.com\fR>.
-
diff --git a/man/man1/sisu-sqlite.1 b/man/man1/sisu-sqlite.1
index 07b68619..96e091be 100644
--- a/man/man1/sisu-sqlite.1
+++ b/man/man1/sisu-sqlite.1
@@ -1,4 +1,4 @@
-.TH SISU\-SQLITE 1 "2011\-03\-05" "2.8.1" "SiSU"
+.TH SISU-SQLITE 1 "2011-03-05" "2.8.1" "SiSU"
.SH NAME
\fBSiSU\fR \- Structured information, Serialized Units \- a document publishing system
@@ -18,8 +18,6 @@ The \fBsisu\-sqlite\fR command is an alias for \fBsisu \-\-sqlite\fR (or \fBsisu
.br
\fIsisu\-epub\fR(1),
.br
-\fIsisu\-git\fR(1),
-.br
\fIsisu\-harvest\fR(1),
.br
\fIsisu\-html\fR(1),
@@ -30,8 +28,6 @@ The \fBsisu\-sqlite\fR command is an alias for \fBsisu \-\-sqlite\fR (or \fBsisu
.br
\fIsisu\-pg\fR(1),
.br
-\fIsisu\-po\fR(1),
-.br
\fIsisu\-txt\fR(1).
.SH HOMEPAGE
diff --git a/man/man1/sisu-txt.1 b/man/man1/sisu-txt.1
index 68d1b080..87fa6625 100644
--- a/man/man1/sisu-txt.1
+++ b/man/man1/sisu-txt.1
@@ -1,4 +1,4 @@
-.TH SISU\-TXT 1 "2011\-03\-05" "2.8.1" "SiSU"
+.TH SISU-TXT 1 "2011-03-05" "2.8.1" "SiSU"
.SH NAME
\fBSiSU\fR \- Structured information, Serialized Units \- a document publishing system
@@ -18,8 +18,6 @@ The \fBsisu\-txt\fR command is an alias for \fBsisu \-\-txt\fR (or \fBsisu \-t\f
.br
\fIsisu\-epub\fR(1),
.br
-\fIsisu\-git\fR(1),
-.br
\fIsisu\-harvest\fR(1),
.br
\fIsisu\-html\fR(1),
@@ -30,8 +28,6 @@ The \fBsisu\-txt\fR command is an alias for \fBsisu \-\-txt\fR (or \fBsisu \-t\f
.br
\fIsisu\-pg\fR(1),
.br
-\fIsisu\-po\fR(1),
-.br
\fIsisu\-sqlite\fR(1).
.SH HOMEPAGE
diff --git a/man/man1/sisu_webrick.1 b/man/man1/sisu-webrick.1
index 2cfe9455..2cfe9455 100644
--- a/man/man1/sisu_webrick.1
+++ b/man/man1/sisu-webrick.1
diff --git a/man/man1/sisu.1 b/man/man1/sisu.1
index 35af5f8d..ccf359c0 100644
--- a/man/man1/sisu.1
+++ b/man/man1/sisu.1
@@ -1,4 +1,4 @@
-.TH "sisu" "1" "2012-05-25" "3.2.10" "SiSU"
+.TH "sisu" "1" "2012-10-03" "4.0.0" "SiSU"
.br
.SH NAME
.br
@@ -6,25 +6,28 @@ sisu \- documents: markup, structuring, publishing in multiple standard formats,
.br
.SH SYNOPSIS
.br
+sisu [\-short\-options|\-\-long\-options] [filename/wildcard]
+
+.br
sisu [\-abCcDdeFGghIikLMmNnoPpQqRrSsTtUuVvWwXxYyZ_0\-9] [filename/wildcard]
.br
-sisu [\-Ddcv] [instruction] [filename/wildcard]
+sisu \-\-txt \-\-html \-\-epub \-\-odt \-\-pdf \-\-wordmap \-\-sqlite \-\-manpage \-\-texinfo \-\-sisupod \-\-source \-\-qrcode [filename/wildcard]
.br
-sisu [\-CcFLSVvW]
+sisu [\-Ddcv] [instruction] [filename/wildcard]
.br
-sisu [operations]
+sisu \-\-pg (\-\-createdb|update [filename/wildcard]|\-\-dropall)
.br
-sisu \-\-v3 [operations]
+sisu [operations]
.br
-sisu \-\-v2 [operations]
+sisu [\-CcFLSVvW]
.br
-sisu2 [operations]
+sisu (\-\-configure|\-\-webrick|\-\-sample\-search\-form)
.SH SISU \- MANUAL,
RALPH AMISSAH
.br
@@ -32,7 +35,7 @@ RALPH AMISSAH
.SH WHAT IS SISU?
.br
-.SH 1. INTRODUCTION \- WHAT IS SISU?
+.SH INTRODUCTION \- WHAT IS SISU?
.br
.br
@@ -47,11 +50,12 @@ text within a document.
.br
.B SiSU
-is developed under an open source, software libre license (GPL3). Its use case
-for development is work with medium to large document sets and cope with
-evolving document formats/ representation technologies. Documents are prepared
-once, and generated as need be to update the technical presentation or add
-additional output formats. Various output formats (including search related
+is developed under an open source, software libre license (
+.I GPLv3
+). Its use case for development is work with medium to large document sets and
+cope with evolving document formats/ representation technologies. Documents are
+prepared once, and generated as need be to update the technical presentation or
+add additional output formats. Various output formats (including search related
output) share a common mechanism for cross\-output\-format citation.
.br
@@ -66,12 +70,20 @@ The sisu engine works with an abstraction of the document's structure and
content from which it is possible to generate different forms of representation
of the document. Significantly
.B SiSU
-markup is more sparse than html and outputs which include html, EPUB, LaTeX,
-landscape and portrait pdfs, Open Document Format (ODF), all of which can be
-added to and updated.
+markup is more sparse than html and outputs which include
+.I HTML,
+.I EPUB,
+.I ODT
+(Open Document Format text),
+.I LaTeX,
+landscape and portrait
+.I PDF,
+all of which can be added to and updated.
.B SiSU
-is also able to populate SQL type databases at an object level, which means
-that searches can be made with that degree of granularity.
+is also able to populate
+.I SQL
+type databases at an object level, which means that searches can be made with
+that degree of granularity.
.br
Source document preparation and output generation is a two step process: (i)
@@ -84,15 +96,24 @@ markup applied to a document,
.B SiSU
custom builds (to take advantage of the strengths of different ways of
representing documents) various standard open output formats including plain
-text, HTML, XHTML, XML, EPUB, OpenDocument, LaTeX or PDF files, and populate an
-SQL database with objects[^1] (equating generally to paragraph\-sized chunks)
-so searches may be performed and matches returned with that degree of
-granularity ( e.g. your search criteria is met by these documents and at these
-locations within each document). Document output formats share a common object
-numbering system for locating content. This is particularly suitable for
-"published" works (finalized texts as opposed to works that are frequently
-changed or updated) for which it provides a fixed means of reference of
-content.
+text,
+.I HTML,
+.I XHTML,
+.I XML,
+.I EPUB,
+.I ODT,
+.I LaTeX
+or
+.I PDF
+files, and populate an
+.I SQL
+database with objects[^1] (equating generally to paragraph\-sized chunks) so
+searches may be performed and matches returned with that degree of granularity
+( e.g. your search criteria is met by these documents and at these locations
+within each document). Document output formats share a common object numbering
+system for locating content. This is particularly suitable for "published"
+works (finalized texts as opposed to works that are frequently changed or
+updated) for which it provides a fixed means of reference of content.
.br
In preparing a
@@ -131,7 +152,16 @@ proprietary software/equipment) in 15 years time, or the way the way in which
html has evolved over its relatively short span of existence.
.B SiSU
provides the flexibility of producing documents in multiple non\-proprietary
-open formats including html, pdf[^5] ODF,[^6] and EPUB.[^7] Whilst
+open formats including
+.I HTML,
+.I EPUB,
+[^5]
+.I ODT,
+[^6]
+.I PDF
+[^7]
+.I ODF,
+[^8]. Whilst
.B SiSU
relies on software, the markup is uncomplicated and minimalistic which
guarantees that future engines can be written to run against it. It is also
@@ -140,19 +170,29 @@ easily converted to other formats, which means documents prepared in
can be migrated to other document formats. Further security is provided by the
fact that the software itself,
.B SiSU
-is available under GPL3 a licence that guarantees that the source code will
-always be open, and free as in libre, which means that that code base can be
-used, updated and further developed as required under the terms of its license.
-Another challenge is to keep up with a moving target.
+is available under
+.I GPLv3
+a licence that guarantees that the source code will always be open, and free as
+in libre, which means that that code base can be used, updated and further
+developed as required under the terms of its license. Another challenge is to
+keep up with a moving target.
.B SiSU
permits new forms of output to be added as they become important, (Open
Document Format text was added in 2006 when it became an ISO standard for
-office applications and the archival of documents), EPUB was introduced in
-2009; and allows the technical representations existing output to be updated
-(html has evolved and the related module has been updated repeatedly over the
-years, presumably when the World Wide Web Consortium (w3c) finalises html 5
-which is currently under development, the html module will again be updated
-allowing all existing documents to be regenerated as html 5).
+office applications and the archival of documents),
+.I EPUB
+was introduced in 2009; and allows the technical representations existing
+output to be updated (
+.I HTML
+has evolved and the related module has been updated repeatedly over the years,
+presumably when the World Wide Web Consortium (w3c) finalises
+.I HTML
+5 which is currently under development, the
+.I HTML
+module will again be updated allowing all existing documents to be regenerated
+as
+.I HTML
+5).
.br
The document formats are written to the file\-system and available for indexing
@@ -185,29 +225,50 @@ content prepared in
.br
<http://www.jus.uio.no/sisu>
-.SH 2. COMMANDS SUMMARY
+.SH COMMANDS SUMMARY
.br
-.SH 2.1 DESCRIPTION
+.SH DESCRIPTION
.br
.B SiSU
is a document publishing system, that from a simple single marked\-up document,
-produces multiple output formats including: plaintext, html, xhtml, XML, epub,
-odt (odf text), LaTeX, pdf, info, and SQL (PostgreSQL and SQLite), which share
-text object numbers ("object citation numbering") and the same document
-structure information. For more see: <http://www.jus.uio.no/sisu>
+produces multiple output formats including:
+.I plaintext,
+.I HTML,
+.I XHTML,
+.I XML,
+.I EPUB,
+.I ODT
+(
+.I OpenDocument
+(
+.I ODF
+) text),
+.I LaTeX,
+.I PDF,
+info, and
+.I SQL
+(
+.I PostgreSQL
+and
+.I SQLite
+) , which share text object numbers ("object citation numbering") and the same
+document structure information. For more see: <http://sisudoc.org> or
+<http://www.jus.uio.no/sisu>
-.SH 2.2 DOCUMENT PROCESSING COMMAND FLAGS
+.SH DOCUMENT PROCESSING COMMAND FLAGS
.TP
.B \-a [filename/wildcard]
-produces plaintext with Unix linefeeds and without markup, (object numbers are
-omitted), has footnotes at end of each paragraph that contains them [ \ \-A \
-for \ equivalent \ dos \ (linefeed) \ output \ file] [see \ \-e \ for \
-endnotes]. (Options include: \-\-endnotes for endnotes \-\-footnotes for
-footnotes at the end of each paragraph \-\-unix for unix linefeed (default)
-\-\-msdos for msdos linefeed)
+produces
+.I plaintext
+with Unix linefeeds and without markup, (object numbers are omitted), has
+footnotes at end of each paragraph that contains them [ \ \-A \ for \
+equivalent \ dos \ (linefeed) \ output \ file] [see \ \-e \ for \ endnotes].
+(Options include: \-\-endnotes for endnotes \-\-footnotes for footnotes at the
+end of each paragraph \-\-unix for unix linefeed (default) \-\-msdos for msdos
+linefeed)
.TP
.B \-b [filename/wildcard]
@@ -290,23 +351,28 @@ produces an epub document, [sisu \ version \ >=2 \ ] (filename.epub). Alias \-e
.TP
.B \-\-exc\-*
-exclude output feature, overrides configuration settings \-\-exc\-ocn, (exclude
-object citation numbering, (switches off object citation numbering), affects
-html (seg, scroll), epub, xhtml, xml, pdf); \-\-exc\-toc, (exclude table of
-contents, affects html (scroll), epub, pdf); \-\-exc\-links\-to\-manifest,
-\-\-exc\-manifest\-links, (exclude links to manifest, affects html (seg,
-scroll)); \-\-exc\-search\-form, (exclude search form, affects html (seg,
-scroll), manifest); \-\-exc\-minitoc, (exclude mini table of contents, affects
-html (seg), concordance, manifest); \-\-exc\-manifest\-minitoc, (exclude mini
-table of contents, affects manifest); \-\-exc\-html\-minitoc, (exclude mini
-table of contents, affects html (seg), concordance); \-\-exc\-html\-navigation,
-(exclude navigation, affects html (seg)); \-\-exc\-html\-navigation\-bar,
-(exclude navigation bar, affects html (seg)); \-\-exc\-html\-search\-form,
-(exclude search form, affects html (seg, scroll)); \-\-exc\-html\-right\-pane,
-(exclude right pane/column, affects html (seg, scroll));
-\-\-exc\-html\-top\-band, (exclude top band, affects html (seg, scroll),
-concordance (minitoc forced on to provide seg navigation)); \-\-exc\-segsubtoc
-(exclude sub table of contents, affects html (seg), epub); see also \-\-inc\-*
+exclude output feature, overrides configuration settings \-\-exc\-
+.I ocn,
+(exclude
+.I object citation numbering,
+(switches off
+.I object citation numbering
+) , affects html (seg, scroll), epub, xhtml, xml, pdf) ; \-\-exc\-toc, (exclude
+table of contents, affects html (scroll), epub, pdf) ;
+\-\-exc\-links\-to\-manifest, \-\-exc\-manifest\-links, (exclude links to
+manifest, affects html (seg, scroll)); \-\-exc\-search\-form, (exclude search
+form, affects html (seg, scroll), manifest); \-\-exc\-minitoc, (exclude mini
+table of contents, affects html (seg), concordance, manifest);
+\-\-exc\-manifest\-minitoc, (exclude mini table of contents, affects manifest);
+\-\-exc\-html\-minitoc, (exclude mini table of contents, affects html (seg),
+concordance); \-\-exc\-html\-navigation, (exclude navigation, affects html
+(seg)); \-\-exc\-html\-navigation\-bar, (exclude navigation bar, affects html
+(seg)); \-\-exc\-html\-search\-form, (exclude search form, affects html (seg,
+scroll)); \-\-exc\-html\-right\-pane, (exclude right pane/column, affects html
+(seg, scroll)); \-\-exc\-html\-top\-band, (exclude top band, affects html (seg,
+scroll), concordance (minitoc forced on to provide seg navigation));
+\-\-exc\-segsubtoc (exclude sub table of contents, affects html (seg), epub) ;
+see also \-\-inc\-*
.TP
.B \-F [\-\-webserv=webrick]
@@ -460,17 +526,20 @@ see \-\-pdf
.TP
.B \-\-pdf [filename/wildcard]
-produces LaTeX pdf (portrait.pdf & landscape.pdf). Default paper size is set in
-config file, or document header, or provided with additional command line
-parameter, e.g. \-\-papersize\-a4 preset sizes include: 'A4', U.S. 'letter' and
-'legal' and book sizes 'A5' and 'B5' (system defaults to A4). Alias \-p
+produces
+.I LaTeX
+pdf (portrait.pdf & landscape.pdf). Default paper size is set in config file,
+or document header, or provided with additional command line parameter, e.g.
+\-\-papersize\-a4 preset sizes include: 'A4', U.S. 'letter' and 'legal' and
+book sizes 'A5' and 'B5' (system defaults to A4). Alias \-p
.TP
.B \-\-pg [instruction] [filename]
-database postgresql ( \-\-pgsql may be used instead) possible instructions,
-include: \-\-createdb; \-\-create; \-\-dropall; \-\-import [filename];
-\-\-update [filename]; \-\-remove [filename]; see database section below. Alias
-\-D
+database
+.I PostgreSQL
+( \-\-pgsql may be used instead) possible instructions, include: \-\-createdb;
+\-\-create; \-\-dropall; \-\-import [filename]; \-\-update [filename];
+\-\-remove [filename]; see database section below. Alias \-D
.TP
.B \-\-po [language_directory/filename \ language_directory]
@@ -538,11 +607,15 @@ see \-\-source
.TP
.B \-\-sample\-search\-form [\-\-webserv=webrick]
-generate examples of (naive) cgi search form for sqlite and pgsql depends on
-your already having used sisu to populate an sqlite and/or pgsql database, (the
-sqlite version scans the output directories for existing sisu_sqlite databases,
-so it is first necessary to create them, before generating the search form) see
-\-d \-D and the database section below. If the optional parameter
+generate examples of (naive) cgi search form for
+.I SQLite
+and PgSQL depends on your already having used sisu to populate an
+.I SQLite
+and/or PgSQL database, (the
+.I SQLite
+version scans the output directories for existing sisu_sqlite databases, so it
+is first necessary to create them, before generating the search form) see \-d
+\-D and the database section below. If the optional parameter
\-\-webserv=webrick is passed, the cgi examples created will be set up to use
the default port set for use by the webrick server, (otherwise the port is left
blank and the system setting used, usually 80). The samples are dumped in the
@@ -557,14 +630,19 @@ that you have your "keys" and ssh agent in place. Also see \-\-rsync. Alias \-r
.TP
.B \-\-sqlite \-\-[instruction] [filename]
-database type set to sqlite, this produces one of two possible databases,
-without additional database related instructions it produces a discreet sqlite
+database type set to
+.I SQLite,
+this produces one of two possible databases, without additional database
+related instructions it produces a discreet
+.I SQLite
file for the document processed; with additional instructions it produces a
-common sqlite database of all processed documents that (come from the same
-document preparation directory and as a result) share the same output directory
-base path (possible instructions include: \-\-createdb; \-\-create;
-\-\-dropall; \-\-import [filename]; \-\-update [filename]; \-\-remove
-[filename]); see database section below. Alias \-d
+common
+.I SQLite
+database of all processed documents that (come from the same document
+preparation directory and as a result) share the same output directory base
+path (possible instructions include: \-\-createdb; \-\-create; \-\-dropall;
+\-\-import [filename]; \-\-update [filename]; \-\-remove [filename]); see
+database section below. Alias \-d
.TP
.B \-\-sisupod
@@ -612,12 +690,14 @@ produces texinfo and info file, (view with pinfo). Alias \-I
.TP
.B \-\-txt [filename/wildcard]
-produces plaintext with Unix linefeeds and without markup, (object numbers are
-omitted), has footnotes at end of each paragraph that contains them [ \ \-A \
-for \ equivalent \ dos \ (linefeed) \ output \ file] [see \ \-e \ for \
-endnotes]. (Options include: \-\-endnotes for endnotes \-\-footnotes for
-footnotes at the end of each paragraph \-\-unix for unix linefeed (default)
-\-\-msdos for msdos linefeed). Alias \-t
+produces
+.I plaintext
+with Unix linefeeds and without markup, (object numbers are omitted), has
+footnotes at end of each paragraph that contains them [ \ \-A \ for \
+equivalent \ dos \ (linefeed) \ output \ file] [see \ \-e \ for \ endnotes].
+(Options include: \-\-endnotes for endnotes \-\-footnotes for footnotes at the
+end of each paragraph \-\-unix for unix linefeed (default) \-\-msdos for msdos
+linefeed). Alias \-t
.TP
.B \-U [filename/wildcard]
@@ -659,14 +739,13 @@ version information
see \-\-verbose
.TP
-.B \-\-v2 [filename/wildcard]
-invokes the sisu v2 document parser/generator. This is the default and is
-normally omitted.
+.B \-\-v3 [filename/wildcard]
+invokes the sisu v3 document parser/generator. You may run sisu3 instead.
.TP
-.B \-\-v3 [filename/wildcard]
-invokes the sisu v3 document parser/generator. Currently under development and
-incomplete, v3 requires >= ruby1.9.2p180. You may run sisu3 instead.
+.B \-\-v4 [filename/wildcard]
+invokes the sisu v4 document parser/generator. This is the default and is
+normally omitted.
.TP
.B \-\-verbose [filename/wildcard]
@@ -684,7 +763,7 @@ see \-\-concordance
.TP
.B \-\-webrick
-starts ruby's webrick webserver points at sisu output directories, the default
+starts ruby' s webrick webserver points at sisu output directories, the default
port is set to 8081 and can be changed in the resource configuration files.
[tip: \ the \ webrick \ server \ requires \ link \ suffixes, \ so \ html \
output \ should \ be \ created \ using \ the \ \-h \ option \ rather \ than \
@@ -696,16 +775,21 @@ see \-\-concordance
.TP
.B \-\-xhtml [filename/wildcard]
-produces xhtml/XML output for browser viewing (sax parsing). Alias \-b
+produces xhtml/
+.I XML
+output for browser viewing (sax parsing). Alias \-b
.TP
.B \-\-xml\-dom [filename/wildcard]
-produces XML output with deep document structure, in the nature of dom. Alias
-\-X
+produces
+.I XML
+output with deep document structure, in the nature of dom. Alias \-X
.TP
.B \-\-xml\-sax [filename/wildcard]
-produces XML output shallow structure (sax parsing). Alias \-x
+produces
+.I XML
+output shallow structure (sax parsing). Alias \-x
.TP
.B \-X [filename/wildcard]
@@ -738,14 +822,17 @@ to be processed, prior to processing. If \-Z is used as the lone processing
related flag (or in conjunction with a combination of \-[mMvVq]), will remove
the related document output directory. Alias \-Z
-.SH 3. COMMAND LINE MODIFIERS
+.SH COMMAND LINE MODIFIERS
.br
.TP
-.B \-\-no\-ocn
-[with \ \-\-html \ \-\-pdf \ or \ \-\-epub] switches off object citation
-numbering. Produce output without identifying numbers in margins of html or
-LaTeX/pdf output.
+.B \-\-no\-
+.I ocn
+[with \ \-\-html \ \-\-pdf \ or \ \-\-epub] switches off
+.I object citation numbering.
+Produce output without identifying numbers in margins of html or
+.I LaTeX
+/pdf output.
.TP
.B \-\-no\-annotate
@@ -760,51 +847,66 @@ strips output text of editor endnotes[^*2] denoted by asterisk sign
.B \-\-no\-dagger
strips output text of editor endnotes[^+1] denoted by dagger/plus sign
-.SH 4. DATABASE COMMANDS
+.SH DATABASE COMMANDS
.br
.br
-dbi \- database interface
+.B dbi \- database interface
.br
-\-D or \-\-pgsql set for postgresql \-d or \-\-sqlite default set for sqlite
-\-d is modifiable with \-\-db=[database \ type \ (pgsql \ or \ sqlite)]
+.B \-D or \-\-pgsql
+set for
+.I PostgreSQL
+.B \-d or \-\-sqlite
+default set for
+.I SQLite
+\-d is modifiable with \-\-db=[database \ type \ (PgSQL \ or \ .I \ SQLite \ )
+\ ]
.TP
.B \-\-pg \-v \-\-createall
initial step, creates required relations (tables, indexes) in existing
-postgresql database (a database should be created manually and given the same
-name as working directory, as requested) (rb.dbi) [ \ \-dv \ \-\-createall \
-sqlite \ equivalent] it may be necessary to run sisu \-Dv \-\-createdb
-initially NOTE: at the present time for postgresql it may be necessary to
-manually create the database. The command would be 'createdb [database \ name]'
-where database name would be SiSU_[present \ working \ directory \ name \
-(without \ path)]. Please use only alphanumerics and underscores.
+.I PostgreSQL
+database (a database should be created manually and given the same name as
+working directory, as requested) (rb.dbi) [ \ \-dv \ \-\-createall \ .I \
+SQLite \ equivalent] it may be necessary to run sisu \-Dv \-\-createdb
+initially NOTE: at the present time for
+.I PostgreSQL
+it may be necessary to manually create the database. The command would be
+'createdb [database \ name]' where database name would be SiSU_[present \
+working \ directory \ name \ (without \ path)]. Please use only alphanumerics
+and underscores.
.TP
.B \-\-pg \-v \-\-import
-[filename/wildcard] imports data specified to postgresql db (rb.dbi) [ \ \-dv \
-\-\-import \ sqlite \ equivalent]
+[filename/wildcard] imports data specified to
+.I PostgreSQL
+db (rb.dbi) [ \ \-dv \ \-\-import \ .I \ SQLite \ equivalent]
.TP
.B \-\-pg \-v \-\-update
-[filename/wildcard] updates/imports specified data to postgresql db (rb.dbi) [
-\ \-dv \ \-\-update \ sqlite \ equivalent]
+[filename/wildcard] updates/imports specified data to
+.I PostgreSQL
+db (rb.dbi) [ \ \-dv \ \-\-update \ .I \ SQLite \ equivalent]
.TP
.B \-\-pg \-\-remove
-[filename/wildcard] removes specified data to postgresql db (rb.dbi) [ \ \-d \
-\-\-remove \ sqlite \ equivalent]
+[filename/wildcard] removes specified data to
+.I PostgreSQL
+db (rb.dbi) [ \ \-d \ \-\-remove \ .I \ SQLite \ equivalent]
.TP
.B \-\-pg \-\-dropall
-kills data" and drops (postgresql or sqlite) db, tables & indexes [ \ \-d \
-\-\-dropall \ sqlite \ equivalent]
+kills data" and drops (
+.I PostgreSQL
+or
+.I SQLite
+) db, tables & indexes [ \ \-d \ \-\-dropall \ .I \ SQLite \ equivalent]
.br
The \-v is for verbose output.
-.SH 5. SHORTCUTS, SHORTHAND FOR MULTIPLE FLAGS
+.SH SHORTCUTS, SHORTHAND FOR MULTIPLE FLAGS
.br
.TP
@@ -852,7 +954,7 @@ add \-v for verbose mode and \-c to toggle color state, e.g. sisu \-2vc
.br
consider \-u for appended url info or \-v for verbose output
-.SH 5.1 COMMAND LINE WITH FLAGS \- BATCH PROCESSING
+.SH COMMAND LINE WITH FLAGS \- BATCH PROCESSING
.br
In the data directory run sisu \-mh filename or wildcard eg. "sisu \-h
@@ -863,10 +965,10 @@ Running sisu (alone without any flags, filenames or wildcards) brings up the
interactive help, as does any sisu command that is not recognised. Enter to
escape.
-.SH 6. HELP
+.SH HELP
.br
-.SH 6.1 SISU MANUAL
+.SH SISU MANUAL
.br
The most up to date information on sisu should be contained in the sisu_manual,
@@ -892,7 +994,7 @@ move to the respective directory and type e.g.:
.br
sisu sisu_manual.ssm
-.SH 6.2 SISU MAN PAGES
+.SH SISU MAN PAGES
.br
If
@@ -932,12 +1034,12 @@ Available man pages are converted back to html using man2html:
An online version of the sisu man page is available here:
.br
-* various sisu man pages <http://www.jus.uio.no/sisu/man/> [^8]
+* various sisu man pages <http://www.jus.uio.no/sisu/man/> [^9]
.br
-* sisu.1 <http://www.jus.uio.no/sisu/man/sisu.1.html> [^9]
+* sisu.1 <http://www.jus.uio.no/sisu/man/sisu.1.html> [^10]
-.SH 6.3 SISU BUILT\-IN INTERACTIVE HELP
+.SH SISU BUILT\-IN INTERACTIVE HELP
.br
This is particularly useful for getting the current sisu setup/environment
@@ -957,7 +1059,7 @@ information:
.br
sisu \-\-help env [for \ feedback \ on \ the \ way \ your \ system \ is \
- setup \ with \ regard \ to \ sisu]
+ setup \ with \ regard \ to \ sisu \ ]
.br
sisu \-V [environment \ information, \ same \ as \ above \ command]
@@ -976,14 +1078,18 @@ NOTE: Running the command sisu (alone without any flags, filenames or
wildcards) brings up the interactive help, as does any sisu command that is not
recognised. Enter to escape.
-.SH 7. INTRODUCTION TO SISU MARKUP[^10]
+.SH INTRODUCTION TO SISU MARKUP[^11]
.br
-.SH 7.1 SUMMARY
+.SH SUMMARY
.br
.B SiSU
-source documents are plaintext (UTF\-8)[^11] files
+source documents are
+.I plaintext
+(
+.I UTF\-8
+)[^12] files
.br
All paragraphs are separated by an empty line.
@@ -1042,9 +1148,9 @@ or if for a particular version:
.br
sisu \-\-query\-0.38
-.SH 7.2 MARKUP EXAMPLES
+.SH MARKUP EXAMPLES
-.SH 7.2.1 ONLINE
+.SH ONLINE
.br
Online markup examples are available together with the respective outputs
@@ -1060,16 +1166,16 @@ markup and the respective output produced:
an alternative presentation of markup syntax:
/usr/share/doc/sisu/on_markup.txt.gz
-.SH 7.2.2 INSTALLED
+.SH INSTALLED
.br
With
.B SiSU
installed sample skins may be found in: /usr/share/doc/sisu/markup\-samples (or
-equivalent directory) and if sisu\-markup\-samples is installed also under:
+equivalent directory) and if sisu \-markup\-samples is installed also under:
/usr/share/doc/sisu/markup\-samples\-non\-free
-.SH 8. MARKUP OF HEADERS
+.SH MARKUP OF HEADERS
.br
.br
@@ -1086,7 +1192,7 @@ a space and the comment:
% this would be a comment
.fi
-.SH 8.1 SAMPLE HEADER
+.SH SAMPLE HEADER
.br
This current document is loaded by a master document that has a header similar
@@ -1095,57 +1201,60 @@ to this one:
.nf
% SiSU master 2.0
@title: SiSU
- :subtitle: Manual
+:subtitle: Manual
@creator:
- :author: Amissah, Ralph
-@publisher: \ [publisher \ name]
-@rights: Copyright (C) Ralph Amissah 2007, License GPL 3
+:author: Amissah, Ralph
+@publisher: [publisher \ name]
+@rights: Copyright (C) Ralph Amissah 2007, part of SiSU documentation, License GPL 3
@classify:
- :type: information
- :topic_register: SiSU:manual;electronic documents:SiSU:manual
- :subject: ebook, epublishing, electronic book, electronic publishing,
+:type: information
+:topic_register: SiSU:manual;electronic documents:SiSU:manual
+:subject: ebook, epublishing, electronic book, electronic publishing,
electronic document, electronic citation, data structure,
citation systems, search
% used_by: manual
@date:
- :published: 2008\-05\-22
- :created: 2002\-08\-28
- :issued: 2002\-08\-28
- :available: 2002\-08\-28
- :modified: 2010\-03\-03
+:published: 2008\-05\-22
+:created: 2002\-08\-28
+:issued: 2002\-08\-28
+:available: 2002\-08\-28
+:modified: 2010\-03\-03
@make:
- :num_top: 1
- :breaks: new=C; break=1
- :skin: skin_sisu_manual
- :bold: /Gnu|Debian|Ruby|SiSU/
- :manpage: name=sisu \- documents: markup, structuring, publishing
- in multiple standard formats, and search;
- synopsis=sisu \ [\-abcDdeFhIiMmNnopqRrSsTtUuVvwXxYyZz0\-9] \ [filename/wildcard \ ]
- . sisu \ [\-Ddcv] \ [instruction]
- . sisu \ [\-CcFLSVvW]
- . sisu \-\-v2 \ [operations]
- . sisu \-\-v3 \ [operations]
+:num_top: 1
+:breaks: new=C; break=1
+:bold: /Gnu|Debian|Ruby|SiSU/
+:home_button_text: {SiSU}http://sisudoc.org; {git}http://git.sisudoc.org
+:footer: {SiSU}http://sisudoc.org; {git}http://git.sisudoc.org
+:manpage: name=sisu \- documents: markup, structuring, publishing in multiple standard formats, and search;
+ synopsis=sisu [\-abcDdeFhIiMmNnopqRrSsTtUuVvwXxYyZz0\-9] [filename/wildcard \ ]
+ . sisu [\-Ddcv] [instruction]
+ . sisu [\-CcFLSVvW]
+ . sisu \-\-v4 [operations]
+ . sisu \-\-v3 [operations]
@links:
- { SiSU Homepage }http://www.sisudoc.org/
- { SiSU Manual }http://www.sisudoc.org/sisu/sisu_manual/
- { Book Samples & Markup Examples }http://www.jus.uio.no/sisu/SiSU/examples.html
- { SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html
- { SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html
- { SiSU Git repo }http://git.sisudoc.org/?p=code/sisu.git;a=summary
- { SiSU List Archives }http://lists.sisudoc.org/pipermail/sisu/
- { SiSU @ Debian }http://packages.qa.debian.org/s/sisu.html
- { SiSU Project @ Debian }http://qa.debian.org/developer.php?login=sisu@lists.sisudoc.org
- { SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU
+{ SiSU Homepage }http://www.sisudoc.org/
+{ SiSU Manual }http://www.sisudoc.org/sisu/sisu_manual/
+{ Book Samples & Markup Examples }http://www.jus.uio.no/sisu/SiSU/examples.html
+{ SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html
+{ SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html
+{ SiSU Git repo }http://git.sisudoc.org/?p=code/sisu.git;a=summary
+{ SiSU List Archives }http://lists.sisudoc.org/pipermail/sisu/
+{ SiSU @ Debian }http://packages.qa.debian.org/s/sisu.html
+{ SiSU Project @ Debian }http://qa.debian.org/developer.php?login=sisu@lists.sisudoc.org
+{ SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU
.fi
-.SH 8.2 AVAILABLE HEADERS
+.SH AVAILABLE HEADERS
.br
Header tags appear at the beginning of a document and provide meta information
-on the document (such as the Dublin Core), or information as to how the
-document as a whole is to be processed. All header instructions take the form
-@headername: or on the next line and indented by once space :subheadername: All
-Dublin Core meta tags are available
+on the document (such as the
+.I Dublin Core
+) , or information as to how the document as a whole is to be processed. All
+header instructions take the form @headername: or on the next line and indented
+by once space :subheadername: All
+.I Dublin Core
+meta tags are available
.br
.B @indentifier:
@@ -1164,56 +1273,60 @@ structure, and can be useful to know.
This is a sample header
.nf
-% SiSU 2.0 \ [declared \ file\-type \ identifier \ with \ markup \ version]
+% SiSU 2.0 [declared \ file\-type \ identifier \ with \ markup \ version]
.fi
.nf
-@title: \ [title \ text] \ [this \ header \ is \ the \ only \ one \ that \ is \ mandatory]
- :subtitle: \ [subtitle \ if \ any]
+@title: [title \ text] [this \ header \ is \ the \ only \ one \ that \ is \ mandatory]
+ :subtitle: [subtitle \ if \ any]
:language: English
.fi
.nf
@creator:
- :author: \ [Lastname, \ First \ names]
- :illustrator: \ [Lastname, \ First \ names]
- :translator: \ [Lastname, \ First \ names]
- :prepared_by: \ [Lastname, \ First \ names]
+:author: [Lastname, \ First \ names]
+:illustrator: [Lastname, \ First \ names]
+:translator: [Lastname, \ First \ names]
+:prepared_by: [Lastname, \ First \ names]
.fi
.nf
@date:
- :published: \ [year \ or \ yyyy\-mm\-dd]
- :created: \ [year \ or \ yyyy\-mm\-dd]
- :issued: \ [year \ or \ yyyy\-mm\-dd]
- :available: \ [year \ or \ yyyy\-mm\-dd]
- :modified: \ [year \ or \ yyyy\-mm\-dd]
- :valid: \ [year \ or \ yyyy\-mm\-dd]
- :added_to_site: \ [year \ or \ yyyy\-mm\-dd]
- :translated: \ [year \ or \ yyyy\-mm\-dd]
+:published: [year \ or \ yyyy\-mm\-dd]
+:created: [year \ or \ yyyy\-mm\-dd]
+:issued: [year \ or \ yyyy\-mm\-dd]
+:available: [year \ or \ yyyy\-mm\-dd]
+:modified: [year \ or \ yyyy\-mm\-dd]
+:valid: [year \ or \ yyyy\-mm\-dd]
+:added_to_site: [year \ or \ yyyy\-mm\-dd]
+:translated: [year \ or \ yyyy\-mm\-dd]
.fi
.nf
@rights:
- :copyright: Copyright (C) \ [Year \ and \ Holder]
- :license: \ [Use \ License \ granted]
- :text: \ [Year \ and \ Holder]
- :translation: \ [Name, \ Year]
- :illustrations: \ [Name, \ Year]
+:copyright: Copyright (C) [Year \ and \ Holder]
+:license: [Use \ License \ granted]
+:text: [Year \ and \ Holder]
+:translation: [Name, \ Year]
+:illustrations: [Name, \ Year]
.fi
.nf
@classify:
- :topic_register: SiSU:markup sample:book;book:novel:fantasy
- :type:
- :subject:
- :description:
- :keywords:
- :abstract:
- :isbn: \ [ISBN]
- :loc: \ [Library \ of \ Congress \ classification]
- :dewey: \ [Dewey \ classification]
- :pg: \ [Project \ Gutenberg \ text \ number]
+:topic_register: SiSU:markup sample:book;book:novel:fantasy
+:type:
+:subject:
+:description:
+:keywords:
+:abstract:
+:loc: [Library \ of \ Congress \ classification]
+:dewey: Dewey classification
+.fi
+
+.nf
+@identify:
+:isbn: [ISBN]
+:oclc:
.fi
.nf
@@ -1223,33 +1336,28 @@ This is a sample header
.nf
@make:
- :skin: skin_name
- [skins change default settings related to the appearance of documents generated]
- :num_top: 1
- :headings: \ [text \ to \ match \ for \ each \ level
- (e.g. PART; Chapter; Section; Article;
- or another: none; BOOK|FIRST|SECOND; none; CHAPTER;)
- :breaks: new=:C; break=1
- :promo: sisu, ruby, sisu_search_libre, open_society
- :bold: [regular expression of words/phrases to be made bold]
- :italics: \ [regular \ expression \ of \ words/phrases \ to \ italicise]
+:num_top: 1
+:headings: [text \ to \ match \ for \ each \ level \ (e.g. \ PART; \ Chapter; \ Section; \ Article; \ or \ another: \ none; \ BOOK|FIRST|SECOND; \ none; \ CHAPTER;) \ :breaks: \ new=:C; \ break=1 \ :promo: \ sisu, \ ruby, \ sisu_search_libre, \ open_society \ :bold: \ [regular \ expression \ of \ words/phrases \ to \ be \ made \ bold]
+:italics: [regular \ expression \ of \ words/phrases \ to \ italicise]
+:home_button_text: {SiSU}http://sisudoc.org; {git}http://git.sisudoc.org
+:footer: {SiSU}http://sisudoc.org; {git}http://git.sisudoc.org
.fi
.nf
@original:
- :language: \ [language]
+:language: [language]
.fi
.nf
@notes:
- :comment:
- :prefix: \ [prefix \ is \ placed \ just \ after \ table \ of \ contents]
+:comment:
+:prefix: [prefix \ is \ placed \ just \ after \ table \ of \ contents]
.fi
-.SH 9. MARKUP OF SUBSTANTIVE TEXT
+.SH MARKUP OF SUBSTANTIVE TEXT
.br
-.SH 9.1 HEADING LEVELS
+.SH HEADING LEVELS
.br
Heading levels are :A~ ,:B~ ,:C~ ,1~ ,2~ ,3~ \... :A \- :C being part / section
@@ -1282,7 +1390,7 @@ otherwise takes the form 1~my_filename_for_this_segment
.br
.B 2~ [heading \ text]
-Second level heading preceding substantive text of document or sub\-heading 3,
+Second level heading preceding substantive text of document or sub\-heading 3 ,
the heading level that would normally be marked 1.1 or 1.2 or 1.3 or 2.1 etc.
in a document.
@@ -1293,12 +1401,10 @@ be marked 1.1.1 or 1.1.2 or 1.2.1 or 2.1.1 etc. in a document
.nf
1~filename level 1 heading,
-% the primary division such as Chapter that is followed by substantive text,
-% and may be further subdivided (this is the level on which by default html
-% segments are made)
+% the primary division such as Chapter that is followed by substantive text, and may be further subdivided (this is the level on which by default html segments are made)
.fi
-.SH 9.2 FONT ATTRIBUTES
+.SH FONT ATTRIBUTES
.br
.B markup example:
@@ -1307,25 +1413,15 @@ be marked 1.1.1 or 1.1.2 or 1.2.1 or 2.1.1 etc. in a document
normal text, *{emphasis}*, !{bold text}!, /{italics}/, _{underscore}_, "{citation}",
^{superscript}^, ,{subscript},, +{inserted text}+, \-{strikethrough}\-, #{monospace}#
normal text
-.br
-*{emphasis}* \ [note: \ can \ be \ configured \ to \ be \ represented \ by \ bold, \ italics \ or \ underscore]
-.br
+*{emphasis}* [note: \ can \ be \ configured \ to \ be \ represented \ by \ bold, \ italics \ or \ underscore]
!{bold text}!
-.br
-_{underscore}_
-.br
/{italics}/
-.br
+_{underscore}_
"{citation}"
-.br
^{superscript}^
-.br
,{subscript},
-.br
+{inserted text}+
-.br
\-{strikethrough}\-
-.br
#{monospace}#
.fi
@@ -1335,7 +1431,8 @@ _{underscore}_
.br
normal text,
.B emphasis,
-.B bold text,
+.B bold text
+,
.I italics,
.I underscore,
"citation", ^superscript^, [subscript], ++inserted text++,
@@ -1376,18 +1473,15 @@ or \ underscore]
.br
monospace
-.SH 9.3 INDENTATION AND BULLETS
+.SH INDENTATION AND BULLETS
.br
.B markup example:
.nf
ordinary paragraph
-.br
_1 indent paragraph one step
-.br
_2 indent paragraph two steps
-.br
_9 indent paragraph nine steps
.fi
@@ -1411,9 +1505,7 @@ ordinary paragraph
.nf
_* bullet text
-.br
_1* bullet text, first indent
-.br
_2* bullet text, two step indent
.fi
@@ -1437,11 +1529,10 @@ Numbered List (not to be confused with headings/titles, (document structure))
.nf
# numbered list numbered list 1., 2., 3, etc.
-.br
_# numbered list numbered list indented a., b., c., d., etc.
.fi
-.SH 9.4 HANGING INDENTS
+.SH HANGING INDENTS
.br
.B markup example:
@@ -1466,7 +1557,7 @@ first line indented, rest of paragraph no indent
.br
in each case level may be 0\-9
-.SH 9.5 FOOTNOTES / ENDNOTES
+.SH FOOTNOTES / ENDNOTES
.br
Footnotes and endnotes are marked up at the location where they would be
@@ -1484,7 +1575,7 @@ determines whether footnotes or endnotes will be produced
.B resulting output:
.br
-[^12]
+[^13]
.br
.B markup example:
@@ -1497,14 +1588,13 @@ normal text~{ self contained endnote marker & endnote in one }~ continues
.B resulting output:
.br
-normal text[^13] continues
+normal text[^14] continues
.br
.B markup example:
.nf
normal text ~{* unnumbered asterisk footnote/endnote, insert multiple asterisks if required }~ continues
-.br
normal text ~{** another unnumbered asterisk footnote/endnote }~ continues
.fi
@@ -1522,7 +1612,6 @@ normal text [^**] continues
.nf
normal text ~[* \ editors \ notes, \ numbered \ asterisk \ footnote/endnote \ series \ ]~ continues
-.br
normal text ~[+ \ editors \ notes, \ numbered \ asterisk \ footnote/endnote \ series \ ]~ continues
.fi
@@ -1541,16 +1630,15 @@ normal text [^+2] continues
.nf
% note the endnote marker "~^"
normal text~^ continues
-.br
^~ endnote text following the paragraph in which the marker occurs
.fi
.br
the standard and pair notation cannot be mixed in the same document
-.SH 9.6 LINKS
+.SH LINKS
-.SH 9.6.1 NAKED URLS WITHIN TEXT, DEALING WITH URLS
+.SH NAKED URLS WITHIN TEXT, DEALING WITH URLS
.br
urls found within text are marked up automatically. A url within text is
@@ -1601,11 +1689,10 @@ blocks are discussed later in this document
.nf
deb http://www.jus.uio.no/sisu/archive unstable main non\-free
-.br
deb\-src http://www.jus.uio.no/sisu/archive unstable main non\-free
.fi
-.SH 9.6.2 LINKING TEXT
+.SH LINKING TEXT
.br
To link text or an image to a url the markup is as follows
@@ -1638,27 +1725,45 @@ about {~^ SiSU }http://url.org markup
.B resulting output:
.br
-about SiSU <http://www.sisudoc.org/> [^14] markup
+aboutSiSU <http://www.sisudoc.org/> [^15] markup
.br
-Internal document links to a tagged location, including an ocn
+Internal document links to a tagged location, including an
+.I ocn
.br
.B markup example:
.nf
- { tux.png 64x80 }image
-.br
- % various url linked images
+about { text links }#link_text
+.fi
+
.br
- {tux.png 64x80 "a better way" }http://www.sisudoc.org/
+.B resulting output:
+
.br
+about ⌠text links⌡⌈link_text⌋
+
.br
- {GnuDebianLinuxRubyBetterWay.png 100x101 "Way Better \- with Gnu/Linux, Debian and Ruby" }http://www.sisudoc.org/
+Shared document collection link
+
.br
+.B markup example:
+
+.nf
+about { SiSU book markup examples }:SiSU/examples.html
+.fi
+
.br
- {~^ ruby_logo.png "Ruby" }http://www.ruby\-lang.org/en/
+.B resulting output:
+
.br
+about ⌠
+.B SiSU
+book markup examples⌡⌈:SiSU/examples.html⌋
+
+.SH LINKING IMAGES
+
.br
.B markup example:
@@ -1684,16 +1789,15 @@ GnuDebianLinuxRubyBetterWay.png 100x101 "Way Better \- with Gnu/Linux, Debian
and Ruby" <http://www.sisudoc.org/>
.br
-[ \ ruby_logo \ (png \ missing) \ ] [^15]
+ruby_logo.png 70x90 "Ruby" <http://www.ruby\-lang.org/en/> [^16]
.br
.B linked url footnote shortcut
.nf
-{~^ \ [text \ to \ link] }http://url.org
-% maps to: { \ [text \ to \ link] }http://url.org ~{ http://url.org }~
-% which produces hyper\-linked text within a document/paragraph,
-% with an endnote providing the url for the text location used in the hyperlink
+{~^ [text \ to \ link] }http://url.org
+% maps to: { [text \ to \ link] }http://url.org ~{ http://url.org }~
+% which produces hyper\-linked text within a document/paragraph, with an endnote providing the url for the text location used in the hyperlink
.fi
.nf
@@ -1705,9 +1809,41 @@ note at a heading level the same is automatically achieved by providing names
to headings 1, 2 and 3 i.e. 2~[name] and 3~[name] or in the case of
auto\-heading numbering, without further intervention.
-.SH 9.7 GROUPED TEXT
+.SH LINK SHORTCUT FOR MULTIPLE VERSIONS OF A SISU DOCUMENT IN THE SAME DIRECTORY
+TREE
+
+.br
+.B markup example:
-.SH 9.7.1 TABLES
+.nf
+!_ /{"Viral Spiral"}/, David Bollier
+{ "Viral Spiral", David Bollier [3sS]}viral_spiral.david_bollier.sst
+.fi
+
+.br
+.B
+.I "Viral Spiral",
+David Bollier
+
+"Viral Spiral", David Bollier <http://corundum/sisu_manual/en/manifest/viral_spiral.david_bollier.html>
+ document manifest <http://corundum/sisu_manual/en/manifest/viral_spiral.david_bollier.html>
+ ⌠html, segmented text⌡「http://corundum/sisu_manual/en/html/viral_spiral.david_bollier.html」
+ ⌠html, scroll, document in one⌡「http://corundum/sisu_manual/en/html/viral_spiral.david_bollier.html」
+ ⌠epub⌡「http://corundum/sisu_manual/en/epub/viral_spiral.david_bollier.epub」
+ ⌠pdf, landscape⌡「http://corundum/sisu_manual/en/pdf/viral_spiral.david_bollier.pdf」
+ ⌠pdf, portrait⌡「http://corundum/sisu_manual/en/pdf/viral_spiral.david_bollier.pdf」
+ ⌠odf: odt, open document text⌡「http://corundum/sisu_manual/en/odt/viral_spiral.david_bollier.odt」
+ ⌠xhtml scroll⌡「http://corundum/sisu_manual/en/xhtml/viral_spiral.david_bollier.xhtml」
+ ⌠xml, sax⌡「http://corundum/sisu_manual/en/xml/viral_spiral.david_bollier.xml」
+ ⌠xml, dom⌡「http://corundum/sisu_manual/en/xml/viral_spiral.david_bollier.xml」
+ ⌠concordance⌡「http://corundum/sisu_manual/en/html/viral_spiral.david_bollier.html」
+ ⌠dcc, document content certificate (digests)⌡「http://corundum/sisu_manual/en/digest/viral_spiral.david_bollier.txt」
+ ⌠markup source text⌡「http://corundum/sisu_manual/en/src/viral_spiral.david_bollier.sst」
+ ⌠markup source (zipped) pod⌡「http://corundum/sisu_manual/en/pod/viral_spiral.david_bollier.sst.zip」
+
+.SH GROUPED TEXT
+
+.SH TABLES
.br
Tables may be prepared in two either of two forms
@@ -1729,7 +1865,7 @@ column three of row two, and so on
.br
.B resulting output:
- [table omitted, see other document formats]
+This is a table|this would become column two of row one|column three of row one is here』And here begins another row|column two of row two|column three of row two, and so on』
.br
a second form may be easier to work with in cases where there is not much
@@ -1737,7 +1873,7 @@ information in each column
.br
.B markup example:
-[^17]
+[^18]
.nf
!_ Table 3.1: Contributors to Wikipedia, January 2001 \- June 2005
@@ -1757,13 +1893,13 @@ No. of articles, all languages | 25| 19,000| 138,000| 490,000| 862,0
.br
.B Table 3.1: Contributors to Wikipedia, January 2001 \- June 2005
- [table omitted, see other document formats]
+|Jan. 2001|Jan. 2002|Jan. 2003|Jan. 2004|July 2004|June 2006』Contributors*|10|472|2,188|9,653|25,011|48,721』Active contributors**|9|212|846|3,228|8,442|16,945』Very active contributors***|0|31|190|692|1,639|3,016』No. of English language articles|25|16,000|101,000|190,000|320,000|630,000』No. of articles, all languages|25|19,000|138,000|490,000|862,000|1,600,000』
.br
* Contributed at least ten times; ** at least 5 times in last month; *** more
than 100 times in last month.
-.SH 9.7.2 POEM
+.SH POEM
.br
.B basic markup:
@@ -1831,106 +1967,59 @@ poem{
.B resulting output:
`Fury said to a
-.br
mouse, That he
-.br
met in the
-.br
house,
-.br
"Let us
-.br
both go to
-.br
law: I will
-.br
prosecute
-.br
YOU. \-\-Come,
-.br
I'll take no
-.br
denial; We
-.br
must have a
-.br
trial: For
-.br
really this
-.br
morning I've
-.br
nothing
-.br
to do."
-.br
Said the
-.br
mouse to the
-.br
cur, "Such
-.br
a trial,
-.br
dear Sir,
-.br
With
-.br
no jury
-.br
or judge,
-.br
would be
-.br
wasting
-.br
our
-.br
breath."
-.br
"I'll be
-.br
judge, I'll
-.br
be jury,"
-.br
Said
-.br
cunning
-.br
old Fury:
-.br
"I'll
-.br
try the
-.br
whole
-.br
cause,
-.br
and
-.br
condemn
-.br
you
-.br
to
-.br
death."'
-.br
-.SH 9.7.3 GROUP
+.SH GROUP
.br
.B basic markup:
.nf
group{
-.br
Your grouped text here
-.br
}group
-.br
A group is treated as an object and given a single object number.
.fi
@@ -1939,7 +2028,7 @@ A group is treated as an object and given a single object number.
.nf
group{
- 'Fury said to a
+ `Fury said to a
mouse, That he
met in the
house,
@@ -1990,95 +2079,51 @@ group{
.B resulting output:
`Fury said to a
-.br
mouse, That he
-.br
met in the
-.br
house,
-.br
"Let us
-.br
both go to
-.br
law: I will
-.br
prosecute
-.br
YOU. \-\-Come,
-.br
I'll take no
-.br
denial; We
-.br
must have a
-.br
trial: For
-.br
really this
-.br
morning I've
-.br
nothing
-.br
to do."
-.br
Said the
-.br
mouse to the
-.br
cur, "Such
-.br
a trial,
-.br
dear Sir,
-.br
With
-.br
no jury
-.br
or judge,
-.br
would be
-.br
wasting
-.br
our
-.br
breath."
-.br
"I'll be
-.br
judge, I'll
-.br
be jury,"
-.br
Said
-.br
cunning
-.br
old Fury:
-.br
"I'll
-.br
try the
-.br
whole
-.br
cause,
-.br
and
-.br
condemn
-.br
you
-.br
to
-.br
death."'
-.br
-.SH 9.7.4 CODE
+.SH CODE
.br
Code tags code{ \... }code (used as with other group tags described above) are
@@ -2196,9 +2241,9 @@ code{# as demonstrated here:
44 | death."'
.fi
-.SH 9.8 ADDITIONAL BREAKS \- LINEBREAKS WITHIN OBJECTS, COLUMN AND PAGE\-BREAKS
+.SH ADDITIONAL BREAKS \- LINEBREAKS WITHIN OBJECTS, COLUMN AND PAGE\-BREAKS
-.SH 9.8.1 LINE\-BREAKS
+.SH LINE\-BREAKS
.br
To break a line within a "paragraph object", two backslashes \e\e
@@ -2217,14 +2262,23 @@ The html break br enclosed in angle brackets (though undocumented) is available
in versions prior to 3.0.13 and 2.9.7 (it remains available for the time being,
but is depreciated).
-.SH 9.8.2 PAGE BREAKS
+.SH PAGE BREAKS
.br
Page breaks are only relevant and honored in some output formats. A page break
or a new page may be inserted manually using the following markup on a line on
its own:
+.br
+page new =\e= or breaks the page, starts a new page.
+
+.br
+page break \-\\- or breaks a column, starts a new column, if using columns,
+else breaks the page, starts a new page.
+
.nf
+\-\e\e\-
+or
<:pb>
.fi
@@ -2232,17 +2286,12 @@ its own:
or
.nf
+=\e\e=
+or
<:pn>
.fi
-.br
-page new <:pn> breaks the page, starts a new page.
-
-.br
-page break <:pb> breaks a column, starts a new column, if using columns, else
-breaks the page, starts a new page.
-
-.SH 9.9 BOOK INDEX
+.SH BOOK INDEX
.br
To make an index append to paragraph the book index term relates to it, using
@@ -2307,7 +2356,7 @@ additional paragraph. The logical structure of the resulting index would be:
second sub\-term, 1,
.fi
-.SH 10. COMPOSITE DOCUMENTS MARKUP
+.SH COMPOSITE DOCUMENTS MARKUP
.br
.br
@@ -2338,305 +2387,30 @@ basic markup for importing a document into a master document
.fi
.br
-The form described above should be relied on. Within the Vim editor it results
-in the text thus linked becoming hyperlinked to the document it is calling in
-which is convenient for editing. Alternative markup for importation of
-documents under consideration, and occasionally supported have been.
-
-.nf
-<< filename.ssi
-<<{filename.ssi}
-% using textlink alternatives
-<< |filename.ssi|@|^|
-.fi
-
-.SH 11. MARKUP SYNTAX HISTORY
-.br
-
-.SH 11.1 NOTES RELATED TO FILES\-TYPES AND MARKUP SYNTAX
-.br
-
-2.0 introduced new headers and is therefore incompatible with 1.0 though
-otherwise the same with the addition of a couple of tags (i.e. a superset)
-
-.br
-0.38 is substantially current for version 1.0
-
-.br
-depreciated 0.16 supported, though file names were changed at 0.37
-
-.br
-* sisu \-\-query=[sisu \ version \ [0.38] or 'history]
-
-.br
-provides a short history of changes to
-.B SiSU
-markup
-
-.br
-.B SiSU 2.0
-(2010\-03\-06:09/6) same as 1.0, apart from the changing of headers and the
-addition of a monospace tag related headers now grouped, e.g.
-
-.nf
-@title:
- :subtitle:
-
-@creator:
- :author:
- :translator:
- :illustrator:
-
-@rights:
- :text:
- :illustrations:
-.fi
-
-.br
-see document markup samples, and sisu \-\-help headers
-
-.br
-the monospace tag takes the form of a hash '#'
-
-.nf
-#{ this enclosed text would be monospaced }#
-.fi
-
-.br
-.B 1.0
-(2009\-12\-19:50/6) same as 0.69
+The form described above should be relied on. Within the
+.I Vim
+editor it results in the text thus linked becoming hyperlinked to the document
+it is calling in which is convenient for editing.
+.SH SISU FILETYPES
.br
-.B 0.69
-(2008\-09\-16:37/2) (same as 1.0) and as previous (0.57) with the addition of
-book index tags
-
-.nf
-/^={.+?}$/
-.fi
-
-.br
-e.g. appended to a paragraph, on a new\-line (without a blank line in between)
-logical structure produced assuming this is the first text "object"
-
-.nf
-={GNU/Linux community distribution:Debian+2|Fedora|Gentoo;Free Software Foundation+5}
-.fi
-
-.nf
-Free Software Foundation, 1\-6
-GNU/Linux community distribution, 1
- Debian, 1\-3
- Fedora, 1
- Gentoo,
-.fi
.br
-.B 0.66
-(2008\-02\-24:07/7) same as previous, adds semantic tags, [experimental \ and \
-not\-used]
-
-.nf
-/[:;]{.+?}[:;][a\-z+]/
-.fi
-
-.br
-.B 0.57
-(2007w34/4)
.B SiSU
-0.57 is the same as 0.42 with the introduction of some a shortcut to use the
-headers @title and @creator in the first heading [expanded \ using \ the \
-contents \ of \ the \ headers \ @title: \ and \ @author:]
+has
+.I plaintext
+and binary filetypes, and can process either type of document.
-.nf
-:A~ @title by @author
-.fi
-
-.br
-.B 0.52
-(2007w14/6) declared document type identifier at start of text/document:
-
-.br
- .B SiSU
-0.52
-
-.br
-or, backward compatible using the comment marker:
-
-.br
- %
-.B SiSU
-0.38
-
-.br
-variations include '
-.B SiSU
-(text|master|insert) [version]' and 'sisu\-[version]'
-
-.br
-.B 0.51
-(2007w13/6) skins changed (simplified), markup unchanged
-
-.br
-.B 0.42
-(2006w27/4) * (asterisk) type endnotes, used e.g. in relation to author
-
-.br
-.B SiSU
-0.42 is the same as 0.38 with the introduction of some additional endnote
-types,
-
-.br
-Introduces some variations on endnotes, in particular the use of the asterisk
-
-.nf
-~{* for example for describing an author }~ and ~{** for describing a second author }~
-.fi
-
-.br
-* for example for describing an author
-
-.br
-** for describing a second author
-
-.br
-and
-
-.nf
-~[* \ my \ note \ ]~ or ~[+ \ another \ note \ ]~
-.fi
-
-.br
-which numerically increments an asterisk and plus respectively
-
-.br
-*1 my note +1 another note
-
-.br
-.B 0.38
-(2006w15/7) introduced new/alternative notation for headers, e.g. @title:
-(instead of 0~title), and accompanying document structure markup,
-:A,:B,:C,1,2,3 (maps to previous 1,2,3,4,5,6)
-
-.br
-.B SiSU
-0.38 introduced alternative experimental header and heading/structure markers,
-
-.nf
-@headername: and headers :A~ :B~ :C~ 1~ 2~ 3~
-.fi
-
-.br
-as the equivalent of:
+.SH .SST \.SSM \.SSI MARKED UP PLAIN TEXT
-.nf
-0~headername and headers 1~ 2~ 3~ 4~ 5~ 6~
-.fi
-
-.br
-The internal document markup of
-.B SiSU
-0.16 remains valid and standard Though note that
-.B SiSU
-0.37 introduced a new file naming convention
-
-.br
-.B SiSU
-has in effect two sets of levels to be considered, using 0.38 notation A\-C
-headings/levels, pre\-ordinary paragraphs /pre\-substantive text, and 1\-3
-headings/levels, levels which are followed by ordinary text. This may be
-conceptualised as levels A,B,C, 1,2,3, and using such letter number notation,
-in effect: A must exist, optional B and C may follow in sequence (not strict) 1
-must exist, optional 2 and 3 may follow in sequence i.e. there are two
-independent heading level sequences A,B,C and 1,2,3 (using the 0.16 standard
-notation 1,2,3 and 4,5,6) on the positive side: the 0.38 A,B,C,1,2,3
-alternative makes explicit an aspect of structuring documents in
-.B SiSU
-that is not otherwise obvious to the newcomer (though it appears more
-complicated, is more in your face and likely to be understood fairly quickly);
-the substantive text follows levels 1,2,3 and it is 'nice' to do most work in
-those levels
-
-.br
-.B 0.37
-(2006w09/7) introduced new file naming convention, \.sst (text), \.ssm
-(master), \.ssi (insert), markup syntax unchanged
-
-.br
-.B SiSU
-0.37 introduced new file naming convention, using the file extensions \.sst
- \.ssm and \.ssi to replace \.s1 \.s2 \.s3 \.r1 \.r2 \.r3 and \.si
-
-.br
-this is captured by the following file 'rename' instruction:
-
-.nf
-rename 's/\e.s[123]$/\e.sst/' *.s{1,2,3}
-rename 's/\e.r[123]$/\e.ssm/' *.r{1,2,3}
-rename 's/\e.si$/\e.ssi/' *.si
-.fi
-
-.br
-The internal document markup remains unchanged, from
-.B SiSU
-0.16
-
-.br
-.B 0.35
-(2005w52/3) sisupod, zipped content file introduced
-
-.br
-.B 0.23
-(2005w36/2) utf\-8 for markup file
-
-.br
-.B 0.22
-(2005w35/3) image dimensions may be omitted if rmagick is available to be
-relied upon
-
-.br
-.B 0.20.4
-(2005w33/4) header 0~links
-
-.br
-.B 0.16
-(2005w25/2) substantial changes introduced to make markup cleaner, header
-0~title type, and headings [1\-6]~ introduced, also percentage sign (%) at
-start of a text line as comment marker
-
-.br
-.B SiSU
-0.16 (0.15 development branch) introduced the use of
-
-.br
-the header 0~ and headings/structure 1~ 2~ 3~ 4~ 5~ 6~
-
-.br
-in place of the 0.1 header, heading/structure notation
-
-.br
-.B SiSU
-0.1 headers and headings structure represented by header 0{~ and
-headings/structure 1{ 2{ 3{ 4{~ 5{ 6{
-
-.SH 12. SISU FILETYPES
-.br
-
-.br
-.B SiSU
-has plaintext and binary filetypes, and can process either type of document.
-
-.SH 12.1 \.SST \.SSM \.SSI MARKED UP PLAIN TEXT
-
-.br
-.B SiSU
-documents are prepared as plain\-text (utf\-8) files with
+.TP
+.B SiSU¤b〕 documents are prepared as plain\-text (utf\-8) files with
.B SiSU
markup. They may make reference to and contain images (for example), which are
-stored in the directory beneath them _sisu/image.
-.B SiSU
-plaintext markup files are of three types that may be distinguished by the file
-extension used: regular text \.sst; master documents, composite documents that
+stored in the directory beneath them _sisu/image. 〔b¤SiSU
+.I plaintext
+markup files are of three types that may be distinguished by the file extension
+used: regular text \.sst; master documents, composite documents that
incorporate other text, which can be any regular text or text insert; and
inserts the contents of which are like regular text except these are marked
\.ssi and are not processed.
@@ -2653,7 +2427,7 @@ source markup can be shared with the command:
.br
sisu \-s [filename]
-.SH 12.1.1 SISU TEXT \- REGULAR FILES (.SST)
+.SH SISU TEXT \- REGULAR FILES (.SST)
.br
The most common form of document in
@@ -2662,13 +2436,7 @@ see the section on
.B SiSU
markup.
-.br
-<http://www.sisudoc.org/sisu/sisu_markup>
-
-.br
-<http://www.sisudoc.org/sisu/sisu_manual>
-
-.SH 12.1.2 SISU MASTER FILES (.SSM)
+.SH SISU MASTER FILES (.SSM)
.br
Composite documents which incorporate other
@@ -2694,15 +2462,9 @@ contain other documents.
.br
Note: a secondary file of the composite document is built prior to processing
-with the same prefix and the suffix \._sst [^18]
+with the same prefix and the suffix \._sst [^19]
-.br
-<http://www.sisudoc.org/sisu/sisu_markup>
-
-.br
-<http://www.sisudoc.org/sisu/sisu_manual>
-
-.SH 12.1.3 SISU INSERT FILES (.SSI)
+.SH SISU INSERT FILES (.SSI)
.br
Inserts are documents prepared solely for the purpose of being incorporated
@@ -2713,7 +2475,7 @@ text files except they are ignored by the
processor. Making a file a \.ssi file is a quick and convenient way of flagging
that it is not intended that the file should be processed on its own.
-.SH 12.2 SISUPOD, ZIPPED BINARY CONTAINER (SISUPOD.ZIP, \.SSP)
+.SH SISUPOD, ZIPPED BINARY CONTAINER (SISUPOD.ZIP, \.SSP)
.br
A sisupod is a zipped
@@ -2723,15 +2485,15 @@ text file or set of
text files and any associated images that they contain (this will be extended
to include sound and multimedia\-files)
-.br
+.TP
.B SiSU
-plaintext files rely on a recognised directory structure to find contents such
-as images associated with documents, but all images for example for all
-documents contained in a directory are located in the sub\-directory
-_sisu/image. Without the ability to create a sisupod it can be inconvenient to
-manually identify all other files associated with a document. A sisupod
-automatically bundles all associated files with the document that is turned
-into a pod.
+.I plaintext
+files rely on a recognised directory structure to find contents such as images
+associated with documents, but all images for example for all documents
+contained in a directory are located in the sub\-directory _sisu/image. Without
+the ability to create a sisupod it can be inconvenient to manually identify all
+other files associated with a document. A sisupod automatically bundles all
+associated files with the document that is turned into a pod.
.br
The structure of the sisupod is such that it may for example contain a single
@@ -2764,125 +2526,12 @@ or on a remote server for which a url is provided.
.br
<http://www.sisudoc.org/sisu/sisu_manual>
-.SH 13. EXPERIMENTAL ALTERNATIVE INPUT REPRESENTATIONS
-.br
-
-.SH 13.1 ALTERNATIVE XML
-
+.SH CONFIGURATION
.br
-.B SiSU
-offers alternative XML input representations of documents as a proof of
-concept, experimental feature. They are however not strictly maintained, and
-incomplete and should be handled with care.
-
-.br
-.B convert from sst to simple xml representations (sax, dom and node):
-
-.br
- sisu \-\-to\-sax [filename/wildcard] or sisu \-\-to\-sxs [filename/wildcard]
-
-.br
- sisu \-\-to\-dom [filename/wildcard] or sisu \-\-to\-sxd [filename/wildcard]
-
-.br
- sisu \-\-to\-node [filename/wildcard] or sisu \-\-to\-sxn [filename/wildcard]
-
-.br
-.B convert to sst from any sisu xml representation (sax, dom and node):
-
-.br
- sisu \-\-from\-xml2sst [filename/wildcard \ [.sxs.xml,.sxd.xml,sxn.xml]]
-
-.br
-or the same:
-
-.br
- sisu \-\-from\-sxml [filename/wildcard \ [.sxs.xml,.sxd.xml,sxn.xml]]
-
-.SH 13.1.1 XML SAX REPRESENTATION
-
-.br
-To convert from sst to simple xml (sax) representation:
-
-.br
- sisu \-\-to\-sax [filename/wildcard] or sisu \-\-to\-sxs [filename/wildcard]
-
-.br
-To convert from any sisu xml representation back to sst
-
-.br
- sisu \-\-from\-xml2sst [filename/wildcard \ [.sxs.xml,.sxd.xml,sxn.xml]]
-
-.br
-or the same:
-
-.br
- sisu \-\-from\-sxml [filename/wildcard \ [.sxs.xml,.sxd.xml,sxn.xml]]
-
-.SH 13.1.2 XML DOM REPRESENTATION
-
-.br
-To convert from sst to simple xml (dom) representation:
-
-.br
- sisu \-\-to\-dom [filename/wildcard] or sisu \-\-to\-sxd [filename/wildcard]
-.br
-To convert from any sisu xml representation back to sst
-
-.br
- sisu \-\-from\-xml2sst [filename/wildcard \ [.sxs.xml,.sxd.xml,sxn.xml]]
-
-.br
-or the same:
-
-.br
- sisu \-\-from\-sxml [filename/wildcard \ [.sxs.xml,.sxd.xml,sxn.xml]]
-
-.SH 13.1.3 XML NODE REPRESENTATION
-
-.br
-To convert from sst to simple xml (node) representation:
-
-.br
- sisu \-\-to\-node [filename/wildcard] or sisu \-\-to\-sxn [filename/wildcard]
-
-.br
-To convert from any sisu xml representation back to sst
-
-.br
- sisu \-\-from\-xml2sst [filename/wildcard \ [.sxs.xml,.sxd.xml,sxn.xml]]
-
-.br
-or the same:
-
-.br
- sisu \-\-from\-sxml [filename/wildcard \ [.sxs.xml,.sxd.xml,sxn.xml]]
-
-.SH 14. CONFIGURATION
-.br
-
-.SH 14.1 DETERMINING THE CURRENT CONFIGURATION
-
-.br
-Information on the current configuration of
-.B SiSU
-should be available with the help command:
-
-.br
- sisu \-v
-
-.br
-which is an alias for:
-
-.br
- sisu \-\-help env
-
-.br
-Either of these should be executed from within a directory that contains sisu
-markup source documents.
+.SH CONFIGURATION FILES
-.SH 14.2 CONFIGURATION FILES (CONFIG.YML)
+.SH CONFIG.YML
.br
.B SiSU
@@ -2902,12 +2551,21 @@ resource configuration is determined by looking at the following files if they
exist:
.br
+ ./_sisu/v4/sisurc.yml
+
+.br
./_sisu/sisurc.yml
.br
+ ~/.sisu/v4/sisurc.yml
+
+.br
~/.sisu/sisurc.yml
.br
+ /etc/sisu/v4/sisurc.yml
+
+.br
/etc/sisu/sisurc.yml
.br
@@ -2926,131 +2584,81 @@ If
.B SiSU
is installed a sample sisurc.yml may be found in /etc/sisu/sisurc.yml
-.SH 15. SKINS
-.br
-
-.br
-Skins modify the default appearance of document output on a document,
-directory, or site wide basis. Skins are looked for in the following locations:
-
-.br
- ./_sisu/skin
+.SH SISU_DOCUMENT_MAKE
.br
- ~/.sisu/skin
+Most sisu document headers relate to metadata, the exception is the @make:
+header which provides processing related information. The default contents of
+the @make header may be set by placing them in a file sisu_document_make.
.br
- /etc/sisu/skin
+The search order is as for resource configuration:
.br
-.B Within the skin directory
-are the following the default sub\-directories for document skins:
+ ./_sisu/v4/sisu_document_make
.br
- ./skin/doc
+ ./_sisu/sisu_document_make
.br
- ./skin/dir
+ ~/.sisu/v4/sisu_document_make
.br
- ./skin/site
+ ~/.sisu/sisu_document_make
.br
-A skin is placed in the appropriate directory and the file named skin_[name].rb
+ /etc/sisu/v4/sisu_document_make
.br
-The skin itself is a ruby file which modifies the default appearances set in
-the program.
-
-.SH 15.1 DOCUMENT SKIN
+ /etc/sisu/sisu_document_make
.br
-Documents take on a document skin, if the header of the document specifies a
-skin to be used.
-
-.nf
-@skin: skin_united_nations
-.fi
-
-.SH 15.2 DIRECTORY SKIN
+A sample sisu_document_make can be found in the _sisu/ directory under along
+with the provided sisu markup samples.
-.br
-A directory may be mapped on to a particular skin, so all documents within that
-directory take on a particular appearance. If a skin exists in the skin/dir
-with the same name as the document directory, it will automatically be used for
-each of the documents in that directory, (except where a document specifies the
-use of another skin, in the skin/doc directory).
-
-.br
-A personal habit is to place all skins within the doc directory, and symbolic
-links as needed from the site, or dir directories as required.
-
-.SH 15.3 SITE SKIN
-
-.br
-A site skin, modifies the program default skin.
-
-.SH 15.4 SAMPLE SKINS
-
-.br
-With
-.B SiSU
-installed sample skins may be found in:
-
-.br
- /etc/sisu/skin/doc and
- /usr/share/doc/sisu/markup\-samples/samples/_sisu/skin/doc
-
-.br
-(or equivalent directory) and if sisu\-markup\-samples is installed also under:
-
-.br
- /usr/share/doc/sisu/markup\-samples\-non\-free/samples/_sisu/skin/doc
-
-.br
-Samples of list.yml and promo.yml (which are used to create the right column
-list) may be found in:
-
-.br
- /usr/share/doc/sisu/markup\-samples\-non\-free/samples/_sisu/skin/yml (or
- equivalent directory)
-
-.SH 16. CSS \- CASCADING STYLE SHEETS (FOR HTML, XHTML AND XML)
+.SH CSS \- CASCADING STYLE SHEETS (FOR HTML, XHTML AND XML)
.br
.br
CSS files to modify the appearance of
.B SiSU
-html, XHTML or XML may be placed in the configuration directory: \./_sisu/css;
-~/.sisu/css or; /etc/sisu/css and these will be copied to the output
-directories with the command sisu \-CC.
+html,
+.I XHTML
+or
+.I XML
+may be placed in the configuration directory: \./_sisu/css ; ~/.sisu/css or;
+/etc/sisu/css and these will be copied to the output directories with the
+command sisu \-CC.
.br
-The basic CSS file for html output is html.css, placing a file of that name in
+The basic CSS file for html output is html. css, placing a file of that name in
directory _sisu/css or equivalent will result in the default file of that name
being overwritten.
.br
-HTML: html.css
+.I HTML:
+html. css
.br
-XML DOM: dom.css
+.I XML
+DOM: dom.css
.br
-XML SAX: sax.css
+.I XML
+SAX: sax.css
.br
-XHTML: xhtml.css
+.I XHTML:
+xhtml. css
.br
-The default homepage may use homepage.css or html.css
+The default homepage may use homepage.css or html. css
.br
Under consideration is to permit the placement of a CSS file with a different
-name in directory _sisu/css directory or equivalent, and change the default CSS
-file that is looked for in a skin.[^19]
+name in directory _sisu/css directory or equivalent.[^20]
-.SH 17. ORGANISING CONTENT \- DIRECTORY STRUCTURE AND MAPPING
+.SH ORGANISING CONTENT \- DIRECTORY STRUCTURE AND MAPPING
.br
.br
@@ -3058,7 +2666,7 @@ file that is looked for in a skin.[^19]
v3 has new options for the source directory tree, and output directory
structures of which there are 3 alternatives.
-.SH 17.1 DOCUMENT SOURCE DIRECTORY
+.SH DOCUMENT SOURCE DIRECTORY
.br
The document source directory is the directory in which sisu processing
@@ -3070,27 +2678,24 @@ list of available languages (and possible sub\-directory names) can be obtained
with the command "sisu \-\-help lang" The list of languages is limited to
langagues supported by XeTeX polyglosia.
-.SH 17.1.1 GENERAL DIRECTORIES
+.SH GENERAL DIRECTORIES
.nf
./subject_name/
% files stored at this level e.g. sisu_manual.sst or
% for sisu v3 may be under language sub\-directories
% e.g.
-./subject_name/en
-./subject_name/fr
-./subject_name/es
-./subject_name/_sisu
-% configuration file e.g. sisurc.yml
-./subject_name/_sisu/skin
-% skins in various skin directories doc, dir, site, yml
-./subject_name/_sisu/css
-./subject_name/_sisu/image
+ \./subject_name/en
+ \./subject_name/fr
+ \./subject_name/es
+ \./subject_name/_sisu
+ \./subject_name/_sisu/css
+ \./subject_name/_sisu/image
.fi
-.SH 17.2 DOCUMENT OUTPUT DIRECTORY STRUCTURES
+.SH DOCUMENT OUTPUT DIRECTORY STRUCTURES
-.SH 17.2.1 OUTPUT DIRECTORY ROOT
+.SH OUTPUT DIRECTORY ROOT
.br
The output directory root can be set in the sisurc.yml file. Under the root,
@@ -3118,7 +2723,7 @@ output directory. Skins could be associated with each institution on a
directory basis and resulting documents will take on the appropriate different
appearance.
-.SH 17.2.2 ALTERNATIVE OUTPUT STRUCTURES
+.SH ALTERNATIVE OUTPUT STRUCTURES
.br
There are 3 possibile output structures described as being, by language, by
@@ -3131,7 +2736,7 @@ output_dir_structure_by: language #(language & filetype, preferred?)
#output_dir_structure_by: filename #(default, closest to original v1 & v2)
.fi
-.SH 17.2.3 BY LANGUAGE
+.SH BY LANGUAGE
.br
The by language directory structure places output files
@@ -3178,7 +2783,7 @@ output_dir_structure_by: language
.br
#by: language subject_dir/en/manifest/filename.html
-.SH 17.2.4 BY FILETYPE
+.SH BY FILETYPE
.br
The by filetype directory structure separates output files by filetype, all
@@ -3222,7 +2827,7 @@ output_dir_structure_by: filetype
.br
#by: filetype subject_dir/html/filename/manifest.en.html
-.SH 17.2.5 BY FILENAME
+.SH BY FILENAME
.br
The by filename directory structure places most output of a particular file
@@ -3258,10 +2863,10 @@ output_dir_structure_by: filename
.br
#by: filename subject_dir/filename/manifest.en.html
-.SH 17.2.6 REMOTE DIRECTORIES
+.SH REMOTE DIRECTORIES
.nf
-\./subject_name/
+./subject_name/
% containing sub_directories named after the generated files from which they are made
\./subject_name/src
% contains shared source files text and binary e.g. sisu_manual.sst and sisu_manual.sst.zip
@@ -3275,10 +2880,10 @@ output_dir_structure_by: filename
\./subject_name/_sisu/mm
.fi
-.SH 17.2.7 SISUPOD
+.SH SISUPOD
.nf
-\./sisupod/
+./sisupod/
% files stored at this level e.g. sisu_manual.sst
\./sisupod/_sisu
% configuration file e.g. sisurc.yml
@@ -3290,9 +2895,9 @@ output_dir_structure_by: filename
\./sisupod/_sisu/mm
.fi
-.SH 17.3 ORGANISING CONTENT
+.SH ORGANISING CONTENT
-.SH 18. HOMEPAGES
+.SH HOMEPAGES
.br
.br
@@ -3319,7 +2924,7 @@ Document sets are contained in directories, usually organised by site or
subject. Each directory can/should have its own homepage. See the section on
directory structure and organisation of content.
-.SH 18.1 HOME PAGE AND OTHER CUSTOM BUILT PAGES IN A SUB\-DIRECTORY
+.SH HOME PAGE AND OTHER CUSTOM BUILT PAGES IN A SUB\-DIRECTORY
.br
Custom built pages, including the home page index.html may be placed within the
@@ -3330,52 +2935,147 @@ there they are copied to the root of the output directory with the command:
.br
sisu \-CC
-.SH 18.2 HOME PAGE WITHIN A SKIN
+.SH MARKUP AND OUTPUT EXAMPLES
+.br
+
+.SH MARKUP EXAMPLES
.br
-Skins are described in a separate section, but basically are a file written in
-the programming language
-.B Ruby
-that may be provided to change the defaults that are provided with sisu with
-respect to individual documents, a directories contents or for a site.
+Current markup examples and document output samples are provided off
+<http://sisudoc.org> or <http://www.jus.uio.no/sisu> and in the sisu
+\-markup\-sample package available off <http://sources.sisudoc.org>
.br
-If you wish to provide a homepage within a skin the skin should be in the
-directory _sisu/skin/dir and have the name of the directory for which it is to
-become the home page. Documents in the directory commercial_law would have the
-homepage modified in skin_commercial law.rb; or the directory poems in
-skin_poems.rb
+For some documents hardly any markup at all is required at all, other than a
+header, and an indication that the levels to be taken into account by the
+program in generating its output are.
-.nf
- class Home
- def homepage
- # place the html content of your homepage here, this will become index.html
- <<HOME <html>
-<head></head>
-<doc>
-<p>this is my new homepage.</p>
-</doc>
-</html>
-HOME
- end
- end
-.fi
+.SH SISU MARKUP SAMPLES
-.SH 19. MARKUP AND OUTPUT EXAMPLES
.br
+A few additional sample books prepared as sisu markup samples, output formats
+to be generated using
+.B SiSU
+are contained in a separate package sisu \-markup\-samples. sisu
+\-markup\-samples contains books (prepared using sisu markup), that were
+released by their authors various licenses mostly different Creative Commons
+licences that do not permit inclusion in the
+.B Debian
+Project as they have requirements that do not meet the
+.B Debian
+Free Software Guidelines for various reasons, most commonly that they require
+that the original substantive text remain unchanged, and sometimes that the
+works be used only non\-commercially.
-.SH 19.1 MARKUP EXAMPLES
+.br
+.I Accelerando,
+Charles Stross (2005)
+accelerando.charles_stross.sst
.br
-Current markup examples and document output samples are provided at
-<http://www.jus.uio.no/sisu/SiSU/examples.html>
+.I Alice's Adventures in Wonderland,
+Lewis Carroll (1865)
+alices_adventures_in_wonderland.lewis_carroll.sst
.br
-For some documents hardly any markup at all is required at all, other than a
-header, and an indication that the levels to be taken into account by the
-program in generating its output are.
+.I CONTENT,
+Cory Doctorow (2008)
+content.cory_doctorow.sst
+
+.br
+.I Democratizing Innovation,
+Eric von Hippel (2005)
+democratizing_innovation.eric_von_hippel.sst
+
+.br
+.I Down and Out in the Magic Kingdom,
+Cory Doctorow (2003)
+down_and_out_in_the_magic_kingdom.cory_doctorow.sst
+
+.br
+.I For the Win,
+Cory Doctorow (2010)
+for_the_win.cory_doctorow.sst
+
+.br
+.I Free as in Freedom \- Richard Stallman's Crusade for Free Software,
+Sam Williams (2002)
+free_as_in_freedom.richard_stallman_crusade_for_free_software.sam_williams.sst
+
+.br
+.I Free as in Freedom 2.0 \- Richard Stallman and the Free Software Revolution,
+Sam Williams (2002), Richard M. Stallman (2010)
+free_as_in_freedom_2.richard_stallman_and_the_free_software_revolution.sam_williams.richard_stallman.sst
+
+.br
+.I Free Culture \- How Big Media Uses Technology and the Law to Lock Down
+Culture and Control Creativity,
+Lawrence Lessig (2004)
+free_culture.lawrence_lessig.sst
+
+.br
+.I Free For All \- How Linux and the Free Software Movement Undercut the High
+Tech Titans,
+Peter Wayner (2002)
+free_for_all.peter_wayner.sst
+
+.br
+.I GNU GENERAL PUBLIC LICENSE v2,
+Free Software Foundation (1991)
+gpl2.fsf.sst
+
+.br
+.I GNU GENERAL PUBLIC LICENSE v3,
+Free Software Foundation (2007)
+gpl3.fsf.sst
-.SH 20. SISU SEARCH \- INTRODUCTION
+.br
+.I Gulliver's Travels,
+Jonathan Swift (1726 / 1735)
+gullivers_travels.jonathan_swift.sst
+
+.br
+.I Little Brother,
+Cory Doctorow (2008)
+little_brother.cory_doctorow.sst
+
+.br
+.I The Cathederal and the Bazaar,
+Eric Raymond (2000)
+the_cathedral_and_the_bazaar.eric_s_raymond.sst
+
+.br
+.I The Public Domain \- Enclosing the Commons of the Mind,
+James Boyle (2008)
+the_public_domain.james_boyle.sst
+
+.br
+.I The Wealth of Networks \- How Social Production Transforms Markets and
+Freedom,
+Yochai Benkler (2006)
+the_wealth_of_networks.yochai_benkler.sst
+
+.br
+.I Through the Looking Glass,
+Lewis Carroll (1871)
+through_the_looking_glass.lewis_carroll.sst
+
+.br
+.I Two Bits \- The Cultural Significance of Free Software,
+Christopher Kelty (2008)
+two_bits.christopher_kelty.sst
+
+.br
+.I UN Contracts for International Sale of Goods,
+UN (1980)
+un_contracts_international_sale_of_goods_convention_1980.sst
+
+.br
+.I Viral Spiral,
+David Bollier (2008)
+viral_spiral.david_bollier.sst
+
+.SH SISU SEARCH \- INTRODUCTION
.br
.br
@@ -3385,10 +3085,11 @@ indexing tools, such as Lucene, Hyperestraier.
.br
Because the document structure of sites created is clearly defined, and the
-text object citation system is available hypothetically at least, for all forms
-of output, it is possible to search the sql database, and either read results
-from that database, or just as simply map the results to the html output, which
-has richer text markup.
+text
+.I object citation system
+is available hypothetically at least, for all forms of output, it is possible
+to search the sql database, and either read results from that database, or just
+as simply map the results to the html output, which has richer text markup.
.br
In addition to this
@@ -3400,15 +3101,18 @@ your match criteria is met by these documents and at these locations within
each document, which can be viewed within the database directly or in various
output formats.
-.SH 21. SQL
+.SH SQL
.br
-.SH 21.1 POPULATING SQL TYPE DATABASES
+.SH POPULATING SQL TYPE DATABASES
.br
.B SiSU
-feeds sisu markupd documents into sql type databases PostgreSQL[^20] and/or
-SQLite[^21] database together with information related to document structure.
+feeds sisu markupd documents into sql type databases
+.I PostgreSQL
+[^21] and/or
+.I SQLite
+[^22] database together with information related to document structure.
.br
This is one of the more interesting output forms, as all the structural data of
@@ -3418,7 +3122,9 @@ four tables:
.br
* one containing semantic (and other) headers, including, title, author,
- subject, (the Dublin Core...);
+ subject, (the
+ .I Dublin Core.
+ ..);
.br
* another the substantive texts by individual "paragraph" (or object) \-
@@ -3434,7 +3140,8 @@ four tables:
.br
* a fourth table with a one to one relation with the headers table contains
- full text versions of output, eg. pdf, html, xml, and ascii.
+ full text versions of output, eg. pdf, html, xml, and
+ .I ascii.
.br
There is of course the possibility to add further structures.
@@ -3461,20 +3168,21 @@ results relevant for all available output formats, with live links to the
precise locations in the database or in html/xml documents; or, the structural
information provided makes it possible to search the full contents of the
database and have headings in which search content appears, or to search only
-headings etc. (as the Dublin Core is incorporated it is easy to make use of
-that as well).
+headings etc. (as the
+.I Dublin Core
+is incorporated it is easy to make use of that as well).
-.SH 22. POSTGRESQL
+.SH POSTGRESQL
.br
-.SH 22.1 NAME
+.SH NAME
.br
.B SiSU
\- Structured information, Serialized Units \- a document publishing system,
postgresql dependency package
-.SH 22.2 DESCRIPTION
+.SH DESCRIPTION
.br
Information related to using postgresql with sisu (and related to the
@@ -3483,9 +3191,9 @@ dependencies needed for
.B SiSU
to populate a postgresql database, this being part of
.B SiSU
-\- man sisu).
+\- man sisu) .
-.SH 22.3 SYNOPSIS
+.SH SYNOPSIS
.br
sisu \-D [instruction] [filename/wildcard \ if \ required]
@@ -3493,7 +3201,7 @@ to populate a postgresql database, this being part of
.br
sisu \-D \-\-pg \-\-[instruction] [filename/wildcard \ if \ required]
-.SH 22.4 COMMANDS
+.SH COMMANDS
.br
Mappings to two databases are provided by default, postgresql and sqlite, the
@@ -3505,7 +3213,7 @@ alternatively \-\-sqlite or \-\-pgsql may be used
.B \-D or \-\-pgsql
may be used interchangeably.
-.SH 22.4.1 CREATE AND DESTROY DATABASE
+.SH CREATE AND DESTROY DATABASE
.TP
.B \-\-pgsql \-\-createall
@@ -3531,7 +3239,7 @@ same name).
.B sisu \-D \-\-recreate
destroys existing database and builds a new empty database structure
-.SH 22.4.2 IMPORT AND REMOVE DOCUMENTS
+.SH IMPORT AND REMOVE DOCUMENTS
.TP
.B sisu \-D \-\-import \-v [filename/wildcard]
@@ -3546,16 +3254,16 @@ updates file contents in database
.B sisu \-D \-\-remove \-v [filename/wildcard]
removes specified document from postgresql database.
-.SH 23. SQLITE
+.SH SQLITE
.br
-.SH 23.1 NAME
+.SH NAME
.br
.B SiSU
\- Structured information, Serialized Units \- a document publishing system.
-.SH 23.2 DESCRIPTION
+.SH DESCRIPTION
.br
Information related to using sqlite with sisu (and related to the sisu_sqlite
@@ -3563,9 +3271,9 @@ dependency package, which is a dummy package to install dependencies needed for
.B SiSU
to populate an sqlite database, this being part of
.B SiSU
-\- man sisu).
+\- man sisu) .
-.SH 23.3 SYNOPSIS
+.SH SYNOPSIS
.br
sisu \-d [instruction] [filename/wildcard \ if \ required]
@@ -3574,7 +3282,7 @@ to populate an sqlite database, this being part of
sisu \-d \-\-(sqlite|pg) \-\-[instruction] [filename/wildcard \ if \
required]
-.SH 23.4 COMMANDS
+.SH COMMANDS
.br
Mappings to two databases are provided by default, postgresql and sqlite, the
@@ -3586,7 +3294,7 @@ alternatively \-\-sqlite or \-\-pgsql may be used
.B \-d or \-\-sqlite
may be used interchangeably.
-.SH 23.4.1 CREATE AND DESTROY DATABASE
+.SH CREATE AND DESTROY DATABASE
.TP
.B \-\-sqlite \-\-createall
@@ -3612,7 +3320,7 @@ same name).
.B sisu \-d \-\-recreate
destroys existing database and builds a new empty database structure
-.SH 23.4.2 IMPORT AND REMOVE DOCUMENTS
+.SH IMPORT AND REMOVE DOCUMENTS
.TP
.B sisu \-d \-\-import \-v [filename/wildcard]
@@ -3627,32 +3335,41 @@ updates file contents in database
.B sisu \-d \-\-remove \-v [filename/wildcard]
removes specified document from sqlite database.
-.SH 24. INTRODUCTION
+.SH INTRODUCTION
.br
-.SH 24.1 SEARCH \- DATABASE FRONTEND SAMPLE, UTILISING DATABASE AND SISU FEATURES,
+.SH SEARCH \- DATABASE FRONTEND SAMPLE, UTILISING DATABASE AND SISU FEATURES,
INCLUDING OBJECT CITATION NUMBERING (BACKEND CURRENTLY POSTGRESQL)
.br
-Sample search frontend <http://search.sisudoc.org> [^22] A small database and
+Sample search frontend <http://search.sisudoc.org> [^23] A small database and
sample query front\-end (search from) that makes use of the citation system,
.I object citation numbering
-to demonstrates functionality.[^23]
+to demonstrates functionality.[^24]
.br
.B SiSU
can provide information on which documents are matched and at what locations
within each document the matches are found. These results are relevant across
-all outputs using object citation numbering, which includes html, XML, EPUB,
-LaTeX, PDF and indeed the SQL database. You can then refer to one of the other
-outputs or in the SQL database expand the text within the matched objects
-(paragraphs) in the documents matched.
+all outputs using
+.I object citation numbering,
+which includes html,
+.I XML,
+.I EPUB,
+.I LaTeX,
+.I PDF
+and indeed the
+.I SQL
+database. You can then refer to one of the other outputs or in the
+.I SQL
+database expand the text within the matched objects (paragraphs) in the
+documents matched.
.br
Note you may set results either for documents matched and object number
locations within each matched document meeting the search criteria; or display
the names of the documents matched along with the objects (paragraphs) that
-meet the search criteria.[^24]
+meet the search criteria.[^25]
.TP
.B sisu \-F \-\-webserv\-webrick
@@ -3687,7 +3404,7 @@ working in a directory called /home/ralph/ebook the database SiSU_ebook is
used. [otherwise \ a \ manual \ mapping \ for \ the \ collection \ is \
necessary]
-.SH 24.2 SEARCH FORM
+.SH SEARCH FORM
.TP
.B sisu \-F
@@ -3700,10 +3417,6 @@ generates a sample search form for use with the webrick server, which must be
copied to the web\-server cgi directory
.TP
-.B sisu \-Fv
-as above, and provides some information on setting up hyperestraier
-
-.TP
.B sisu \-W
starts the webrick server which should be available wherever sisu is properly
installed
@@ -3712,16 +3425,16 @@ installed
The generated search form must be copied manually to the webserver directory as
instructed
-.SH 25. SISU_WEBRICK
+.SH SISU_WEBRICK
.br
-.SH 25.1 NAME
+.SH NAME
.br
.B SiSU
\- Structured information, Serialized Units \- a document publishing system
-.SH 25.2 SYNOPSIS
+.SH SYNOPSIS
.br
sisu_webrick [port]
@@ -3732,7 +3445,7 @@ or
.br
sisu \-W [port]
-.SH 25.3 DESCRIPTION
+.SH DESCRIPTION
.br
sisu_webrick is part of
@@ -3750,7 +3463,7 @@ The default port for sisu_webrick is set to 8081, this may be modified in the
yaml file: ~/.sisu/sisurc.yml a sample of which is provided as
/etc/sisu/sisurc.yml (or in the equivalent directory on your system).
-.SH 25.4 SUMMARY OF MAN PAGE
+.SH SUMMARY OF MAN PAGE
.br
sisu_webrick, may be started on it's own with the command: sisu_webrick [port]
@@ -3759,7 +3472,7 @@ or using the sisu command with the \-W flag: sisu \-W [port]
.br
where no port is given and settings are unchanged the default port is 8081
-.SH 25.5 DOCUMENT PROCESSING COMMAND FLAGS
+.SH DOCUMENT PROCESSING COMMAND FLAGS
.br
sisu \-W [port] starts
@@ -3769,717 +3482,22 @@ Webrick web\-server, serving
output directories, on the port provided, or if no port is provided and the
defaults have not been changed in ~/.sisu/sisurc.yaml then on port 8081
-.SH 25.6 FURTHER INFORMATION
-
-.br
-For more information on
-.B SiSU
-see: <http://www.sisudoc.org/> or <http://www.jus.uio.no/sisu>
-
-.br
-or man sisu
-
-.SH 25.7 AUTHOR
-
-.br
-Ralph Amissah <ralph@amissah.com> or <ralph.amissah@gmail.com>
-
-.SH 25.8 SEE ALSO
-
-.br
- sisu(1)
-
-.br
- sisu_vim(7)
-
-.SH 26. REMOTE SOURCE DOCUMENTS
-.br
-
-.br
-.B SiSU
-processing instructions can be run against remote source documents by providing
-the url of the documents against which the processing instructions are to be
-carried out. The remote
-.B SiSU
-documents can either be sisu marked up files in plaintext \.sst or \.ssm or;
-zipped sisu files, sisupod.zip or filename.ssp
-
-.br
-.B \.sst / \.ssm \- sisu text files
-
-.br
-.B SiSU
-can be run against source text files on a remote machine, provide the
-processing instruction and the url. The source file and any associated parts
-(such as images) will be downloaded and generated locally.
-
-.nf
-sisu \-3 http://[provide \ url \ to \ valid \ \.sst \ or \ \.ssm \ file]
-.fi
-
-.br
-Any of the source documents in the sisu examples page can be used in this way,
-see <http://www.jus.uio.no/sisu/SiSU/examples.html> and use the url to the
- \.sst for the desired document.
-
-.br
-NOTE: to set up a remote machine to serve
-.B SiSU
-documents in this way, images should be in the directory relative to the
-document source \../_sisu/image
-
-.br
-.B sisupod \- zipped sisu files
-
-.br
-A sisupod is the zipped content of a sisu marked up text or texts and any other
-associated parts to the document such as images.
-
-.br
-.B SiSU
-can be run against a sisupod on a (local or) remote machine, provide the
-processing instruction and the url, the sisupod will be downloaded and the
-documents it contains generated locally.
-
-.nf
-sisu \-3 http://[provide \ url \ to \ valid \ sisupod.zip \ or \ \.ssp \ file]
-.fi
-
-.br
-Any of the source documents in the sisu examples page can be used in this way,
-see <http://www.jus.uio.no/sisu/SiSU/examples.html> and use the url for the
-desired document.
-
-.SH REMOTE DOCUMENT OUTPUT
-.br
-
-.SH 27. REMOTE OUTPUT
-.br
-
-.br
-Once properly configured
-.B SiSU
-output can be automatically posted once generated to a designated remote
-machine using either rsync, or scp.
-
-.br
-In order to do this some ssh authentication agent and keychain or similar tool
-will need to be configured. Once that is done the placement on a remote host
-can be done seamlessly with the \-r (for scp) or \-R (for rsync) flag, which
-may be used in conjunction with other processing flags, e.g.
-
-.nf
-sisu \-3R sisu_remote.sst
-.fi
-
-.SH 27.1 COMMANDS
-
-.TP
-.B \-R [filename/wildcard]
-copies sisu output files to remote host using rsync. This requires that
-sisurc.yml has been provided with information on hostname and username, and
-that you have your "keys" and ssh agent in place. Note the behavior of rsync
-different if \-R is used with other flags from if used alone. Alone the rsync
-\-\-delete parameter is sent, useful for cleaning the remote directory (when
-\-R is used together with other flags, it is not). Also see \-r
-
-.TP
-.B \-r [filename/wildcard]
-copies sisu output files to remote host using scp. This requires that
-sisurc.yml has been provided with information on hostname and username, and
-that you have your "keys" and ssh agent in place. Also see \-R
-
-.SH 27.2 CONFIGURATION
-
-.br
-[expand \ on \ the \ setting \ up \ of \ an \ ssh\-agent \ / \ keychain]
-
-.SH 28. REMOTE SERVERS
-.br
-
-.br
-As
-.B SiSU
-is generally operated using the command line, and works within a Unix type
-environment,
-.B SiSU
-the program and all documents can just as easily be on a remote server, to
-which you are logged on using a terminal, and commands and operations would be
-pretty much the same as they would be on your local machine.
-
-.SH 29. QUICKSTART \- GETTING STARTED HOWTO
-.br
-
-.SH 29.1 INSTALLATION
-
-.br
-Installation is currently most straightforward and tested on the
-.B Debian
-platform, as there are packages for the installation of sisu and all
-requirements for what it does.
-
-.SH 29.1.1 DEBIAN INSTALLATION
-
-.br
-.B SiSU
-is available directly from the
-.B Debian
-Sid and testing archives (and possibly Ubuntu), assuming your
-/etc/apt/sources.list is set accordingly:
-
-.nf
- aptitude update
- aptitude install sisu\-complete
-.fi
-
-.br
-The following /etc/apt/sources.list setting permits the download of additional
-markup samples:
-
-.nf
- #/etc/apt/sources.list
-.br
- deb http://ftp.fi.debian.org/debian/ unstable main non\-free contrib
-.br
- deb\-src http://ftp.fi.debian.org/debian/ unstable main non\-free contrib
-.br
-
-.fi
-
-.br
-The aptitude commands become:
-
-.nf
- aptitude update
-.br
- aptitude install sisu\-complete sisu\-markup\-samples
-.fi
-
-.br
-If there are newer versions of
-.B SiSU
-upstream of the
-.B Debian
-archives, they will be available by adding the following to your
-/etc/apt/sources.list
-
-.nf
-#/etc/apt/sources.list
- deb http://www.jus.uio.no/sisu/archive unstable main non\-free
- deb\-src http://www.jus.uio.no/sisu/archive unstable main non\-free
-.fi
-
-.br
-repeat the aptitude commands
-
-.nf
- aptitude update
- aptitude install sisu\-complete sisu\-markup\-samples
-.fi
-
-.br
-Note however that it is not necessary to install sisu\-complete if not all
-components of sisu are to be used. Installing just the package sisu will
-provide basic functionality.
-
-.SH 29.1.2 RPM INSTALLATION
-
-.br
-RPMs are provided though untested, they are prepared by running alien against
-the source package, and against the debs.
-
-.br
-They may be downloaded from:
-
-.br
- <http://www.jus.uio.no/sisu/SiSU/download.html#rpm>
-
-.br
-as root type:
-
-.br
- rpm \-i [rpm \ package \ name]
-
-.SH 29.1.3 INSTALLATION FROM SOURCE
-
-.br
-To install
-.B SiSU
-from source check information at:
-
-.br
- <http://www.jus.uio.no/sisu/SiSU/download.html#current>
-
-.br
-* download the source package
-
-.br
-* Unpack the source
-
-.br
-Two alternative modes of installation from source are provided, setup.rb (by
-Minero Aoki) and a rant(by Stefan Lang) built install file, in either case: the
-first steps are the same, download and unpack the source file:
-
-.br
-For basic use
-.B SiSU
-is only dependent on the programming language in which it is written
-.B Ruby,
-and
-.B SiSU
-will be able to generate html, EPUB, various XMLs, including ODF (and will also
-produce LaTeX). Dependencies required for further actions, though it relies on
-the installation of additional dependencies which the source tarball does not
-take care of, for things like using a database (postgresql or sqlite)[^25] or
-converting LaTeX to pdf.
-
-.br
-.B setup.rb
-
-.br
-This is a standard ruby installer, using setup.rb is a three step process. In
-the root directory of the unpacked
-.B SiSU
-as root type:
-
-.nf
- ruby setup.rb config
- ruby setup.rb setup
- #[and \ as \ root:]
- ruby setup.rb install
-.fi
-
-.br
-further information on setup.rb is available from:
-
-.br
- <http://i.loveruby.net/en/projects/setup/>
-
-.br
- <http://i.loveruby.net/en/projects/setup/doc/usage.html>
-
-.br
-.B "install"
-
-.br
-The "install" file provided is an installer prepared using "rant". In the root
-directory of the unpacked
-.B SiSU
-as root type:
-
-.br
- ruby install base
-
-.br
-or for a more complete installation:
-
-.br
- ruby install
-
-.br
-or
-
-.br
- ruby install base
-
-.br
-This makes use of Rant (by Stefan Lang) and the provided Rantfile. It has been
-configured to do post installation setup setup configuration and generation of
-first test file. Note however, that additional external package dependencies,
-such as tetex\-extra are not taken care of for you.
-
-.br
-Further information on "rant" is available from:
-
-.br
- <http://make.rubyforge.org/>
-
-.br
- <http://rubyforge.org/frs/?group_id=615>
-
-.br
-For a list of alternative actions you may type:
-
-.br
- ruby install help
-
-.br
- ruby install \-T
-
-.SH 29.2 TESTING SISU, GENERATING OUTPUT
-
-.br
-To check which version of sisu is installed:
-
-.br
-sisu \-v
-
-.br
-Depending on your mode of installation one or a number of markup sample files
-may be found either in the directory:
-
-.br
-...
-
-.br
-or
-
-.br
-...
-
-.br
-change directory to the appropriate one:
-
-.br
-cd /usr/share/doc/sisu/markup\-samples/samples
-
-.SH 29.2.1 BASIC TEXT, PLAINTEXT, HTML, XML, ODF, EPUB
-
-.br
-Having moved to the directory that contains the markup samples (see
-instructions above if necessary), choose a file and run sisu against it
-
-.br
-sisu \-NhwoabxXyv free_as_in_freedom.rms_and_free_software.sam_williams.sst
-
-.br
-this will generate html including a concordance file, opendocument text format,
-plaintext, XHTML and various forms of XML, and OpenDocument text
-
-.SH 29.2.2 LATEX / PDF
-
-.br
-Assuming a LaTeX engine such as tetex or texlive is installed with the required
-modules (done automatically on selection of sisu\-pdf in
-.B Debian
-)
-
-.br
-Having moved to the directory that contains the markup samples (see
-instructions above if necessary), choose a file and run sisu against it
-
-.br
-sisu \-pv free_as_in_freedom.rms_and_free_software.sam_williams.sst
-
-.br
-sisu \-3 free_as_in_freedom.rms_and_free_software.sam_williams.sst
-
-.br
-should generate most available output formats: html including a concordance
-file, opendocument text format, plaintext, XHTML and various forms of XML, and
-OpenDocument text and pdf
-
-.SH 29.2.3 RELATIONAL DATABASE \- POSTGRESQL, SQLITE
-
-.br
-Relational databases need some setting up \- you must have permission to create
-the database and write to it when you run sisu.
-
-.br
-Assuming you have the database installed and the requisite permissions
-
-.br
-sisu \-\-sqlite \-\-recreate
-
-.br
-sisu \-\-sqlite \-v \-\-import
-free_as_in_freedom.rms_and_free_software.sam_williams.sst
-
-.br
-sisu \-\-pgsql \-\-recreate
-
-.br
-sisu \-\-pgsql \-v \-\-import
-free_as_in_freedom.rms_and_free_software.sam_williams.sst
-
-.SH 29.3 GETTING HELP
-
-.SH 29.3.1 THE MAN PAGES
-
-.br
-Type:
-
-.br
- man sisu
-
-.br
-The man pages are also available online, though not always kept as up to date
-as within the package itself:
-
-.br
-* sisu.1 <http://www.jus.uio.no/sisu/man/sisu.1.html> [^26]
-
-.br
-* sisu.8 <http://www.jus.uio.no/sisu/man/sisu.8.html> [^27]
-
-.br
-* man directory <http://www.jus.uio.no/sisu/man> [^28]
-
-.SH 29.3.2 BUILT IN HELP
-
-.br
-sisu \-\-help
-
-.br
-sisu \-\-help \-\-env
-
-.br
-sisu \-\-help \-\-commands
-
-.br
-sisu \-\-help \-\-markup
-
-.SH 29.3.3 THE HOME PAGE
-
-.br
-<http://www.sisudoc.org/>
-
-.br
-<http://www.jus.uio.no/sisu>
-
-.br
-<http://www.jus.uio.no/sisu/SiSU>
-
-.SH 29.4 MARKUP SAMPLES
-
-.br
-A number of markup samples (along with output) are available off:
-
-.br
-<http://www.jus.uio.no/sisu/SiSU/examples.html>
-
-.br
-Additional markup samples are packaged separately in the file:
-
-.br
-***
-
-.br
-On
-.B Debian
-they are available in non\-free[^29] to include them it is necessary to include
-non\-free in your /etc/apt/source.list or obtain them from the sisu home site.
-
-.SH 30. EDITOR FILES, SYNTAX HIGHLIGHTING
-.br
-
-.br
-The directory:
-
-.br
- ./data/sisu/v2/conf/editor\-syntax\-etc/
-
-.br
- ./data/sisu/v3/conf/editor\-syntax\-etc/
-
-.br
- /usr/share/sisu/v2/conf/editor\-syntax\-etc
-
-.br
- /usr/share/sisu/v3/conf/editor\-syntax\-etc
-
-.br
-contains rudimentary sisu syntax highlighting files for:
-
-.br
-* (g)vim <http://www.vim.org>
-
-.br
- package: sisu\-vim
-
-.br
-status: largely done
-
-.br
- there is a vim syntax highlighting and folds component
-
-.br
-* gedit <http://www.gnome.org/projects/gedit>
-
-.br
-* gobby <http://gobby.0x539.de/>
-
-.br
- file: sisu.lang
-
-.br
-place in:
-
-.br
- /usr/share/gtksourceview\-1.0/language\-specs
-
-.br
-or
-
-.br
- ~/.gnome2/gtksourceview\-1.0/language\-specs
-
-.br
- status: very basic syntax highlighting
-
-.br
- comments: this editor features display line wrap and is used by Goby!
-
-.br
-* nano <http://www.nano\-editor.org>
-
-.br
- file: nanorc
-
-.br
-save as:
-
-.br
- ~/.nanorc
-
-.br
- status: basic syntax highlighting
-
-.br
- comments: assumes dark background; no display line\-wrap; does line breaks
-
-.br
-* diakonos (an editor written in ruby) <http://purepistos.net/diakonos>
-
-.br
-file: diakonos.conf
-
-.br
-save as:
-
-.br
- ~/.diakonos/diakonos.conf
-
-.br
-includes:
-
-.br
- status: basic syntax highlighting
-
-.br
-comments: assumes dark background; no display line\-wrap
-
-.br
-* kate & kwrite <http://kate.kde.org>
-
-.br
- file: sisu.xml
-
-.br
- place in:
-
-.br
- /usr/share/apps/katepart/syntax
-
-.br
- or
-
-.br
- ~/.kde/share/apps/katepart/syntax
-
-.br
- [settings::configure \ kate::{highlighting,filetypes}]
-
-.br
- [tools::highlighting::{markup,scripts}:: \ .B \ SiSU \ ]
-
-.br
-* nedit <http://www.nedit.org>
-
-.br
- file: sisu_nedit.pats
-
-.br
- nedit \-import sisu_nedit.pats
-
-.br
- status: a very clumsy first attempt [not \ really \ done]
-
-.br
- comments: this editor features display line wrap
-
-.br
-* emacs <http://www.gnu.org/software/emacs/emacs.html>
-
-.br
- files: sisu\-mode.el
-
-.br
- to file ~/.emacs add the following 2 lines:
-
-.br
- (add\-to\-list 'load\-path
- "/usr/share/sisu/v2/conf/editor\-syntax\-etc/emacs")
-
-.br
- (require 'sisu\-mode.el)
-
-.br
- [not \ done \ / \ not \ yet \ included]
-
-.br
-* vim & gvim <http://www.vim.org>
-
-.br
- files:
-
-.br
- package is the most comprehensive sisu syntax highlighting and editor
- environment provided to date (is for vim/ gvim, and is separate from the
- contents of this directory)
-
-.br
- status: this includes: syntax highlighting; vim folds; some error checking
-
-.br
- comments: this editor features display line wrap
-
-.br
-NOTE:
-
-.br
-[ \ .B \ SiSU \ parses \ files \ with \ long \ lines \ or \ line \ breaks, \
-but, \ display \ linewrap \ (without \ line\-breaks) \ is \ a \ convenient \
-editor \ feature \ to \ have \ for \ sisu \ markup]
-
-.SH 31. HOW DOES SISU WORK?
-.br
-
-.br
-.B SiSU
-markup is fairly minimalistic, it consists of: a (largely optional) document
-header, made up of information about the document (such as when it was
-published, who authored it, and granting what rights) and any processing
-instructions; and markup within the substantive text of the document, which is
-related to document structure and typeface.
-.B SiSU
-must be able to discern the structure of a document, (text headings and their
-levels in relation to each other), either from information provided in the
-document header or from markup within the text (or from a combination of both).
-Processing is done against an abstraction of the document comprising of
-information on the document's structure and its objects,[2] which the program
-serializes (providing the object numbers) and which are assigned hash sum
-values based on their content. This abstraction of information about document
-structure, objects, (and hash sums), provides considerable flexibility in
-representing documents different ways and for different purposes (e.g. search,
-document layout, publishing, content certification, concordance etc.), and
-makes it possible to take advantage of some of the strengths of established
-ways of representing documents, (or indeed to create new ones).
-
-.SH 32. SUMMARY OF FEATURES
+.SH SUMMARY OF FEATURES
.br
.br
* sparse/minimal markup (clean utf\-8 source texts). Documents are prepared in
-a single UTF\-8 file using a minimalistic mnemonic syntax. Typical literature,
-documents like "War and Peace" require almost no markup, and most of the
-headers are optional.
+a single
+.I UTF\-8
+file using a minimalistic mnemonic syntax. Typical literature, documents like
+"War and Peace" require almost no markup, and most of the headers are optional.
.br
* markup is easily readable/parsable by the human eye, (basic markup is simpler
-and more sparse than the most basic HTML), [this \ may \ also \ be \ converted
-\ to \ XML \ representations \ of \ the \ same \ input/source \ document].
+and more sparse than the most basic
+.I HTML
+) , [this \ may \ also \ be \ converted \ to \ .I \ XML \ representations \ of
+\ the \ same \ input/source \ document].
.br
* markup defines document structure (this may be done once in a header
@@ -4502,38 +3520,59 @@ different strengths of various standard formats for representing documents,
amongst the output formats currently supported are:
.br
- * html \- both as a single scrollable text and a segmented document
+*
+.I HTML
+\- both as a single scrollable text and a segmented document
.br
- * xhtml
+*
+.I XHTML
.br
- * epub
+*
+.I EPUB
.br
- * XML \- both in sax and dom style xml structures for further development as
- required
+*
+.I XML
+\- both in sax and dom style xml structures for further development as required
.br
- * ODF \- open document format, the iso standard for document storage
+*
+.I ODT
+\- Open Document Format text, the iso standard for document storage
.br
- * LaTeX \- used to generate pdf
+*
+.I LaTeX
+\- used to generate pdf
.br
- * pdf (via LaTeX)
+*
+.I PDF
+(via
+.I LaTeX
+)
.br
- * sql \- population of an sql database, (at the same object level that is
- used to cite text within a document)
+*
+.I SQL
+\- population of an sql database (
+.I PostgreSQL
+or
+.I SQLite
+) , (at the same object level that is used to cite text within a document)
.br
Also produces: concordance files; document content certificates (md5 or sha256
digests of headings, paragraphs, images etc.) and html manifests (and sitemaps
of content). (b) takes advantage of the strengths implicit in these very
-different output types, (e.g. PDFs produced using typesetting of LaTeX,
+different output types, (e.g. PDFs produced using typesetting of
+.I LaTeX,
databases populated with documents at an individual object/paragraph level,
-making possible granular search (and related possibilities))
+making possible
+.I granular search
+(and related possibilities))
.br
* ensuring content can be cited in a meaningful way regardless of selected
@@ -4544,17 +3583,21 @@ browsers and formats. sisu seeks to provide a common way of pinpoint the text
within a document, (which can be utilized for citation and by search engines).
The outputs share a common numbering system that is meaningful (to man and
machine) across all digital outputs whether paper, screen, or database
-oriented, (pdf, HTML, EPUB, xml, sqlite, postgresql), this numbering system can
-be used to reference content.
+oriented, (pdf,
+.I HTML,
+.I EPUB,
+xml, sqlite, postgresql) , this numbering system can be used to reference
+content.
.br
-* Granular search within documents. SQL databases are populated at an object
-level (roughly headings, paragraphs, verse, tables) and become searchable with
-that degree of granularity, the output information provides the
-object/paragraph numbers which are relevant across all generated outputs; it is
-also possible to look at just the matching paragraphs of the documents in the
-database; [output \ indexing \ also \ work \ well \ with \ search \ indexing \
-tools \ like \ hyperestraier].
+* Granular search within documents.
+.I SQL
+databases are populated at an object level (roughly headings, paragraphs,
+verse, tables) and become searchable with that degree of granularity, the
+output information provides the object/paragraph numbers which are relevant
+across all generated outputs; it is also possible to look at just the matching
+paragraphs of the documents in the database; [output \ indexing \ also \ work \
+well \ with \ search \ indexing \ tools \ like \ hyperestraier].
.br
* long term maintainability of document collections in a world of changing
@@ -4565,8 +3608,9 @@ considerable degree of future\-proofing, output representations are
sometime in future, without modification of existing prepared texts
.br
-* SQL search aside, documents are generated as required and static once
-generated.
+*
+.I SQL
+search aside, documents are generated as required and static once generated.
.br
* documents produced are static files, and may be batch processed, this needs
@@ -4575,8 +3619,10 @@ to be done only once but may be repeated for various reasons as desired
presentations/representations)
.br
-* document source (plaintext utf\-8) if shared on the net may be used as input
-and processed locally to produce the different document outputs
+* document source (
+.I plaintext
+utf\-8) if shared on the net may be used as input and processed locally to
+produce the different document outputs
.br
* document source may be bundled together (automatically) with associated
@@ -4590,8 +3636,15 @@ may be processed locally to produce the desired document outputs
.br
* for basic document generation, the only software dependency is
.B Ruby,
-and a few standard Unix tools (this covers plaintext, HTML, EPUB, XML, ODF,
-LaTeX). To use a database you of course need that, and to convert the LaTeX
+and a few standard Unix tools (this covers
+.I plaintext,
+.I HTML,
+.I EPUB,
+.I XML,
+.I ODF,
+.I LaTeX
+) . To use a database you of course need that, and to convert the
+.I LaTeX
generated to pdf, a latex processor like tetex or texlive.
.br
@@ -4615,8 +3668,8 @@ i.e. to be able to take advantage from this minimal preparation starting point
of some of the strengths of rather different established ways of representing
documents for different purposes, whether for search (relational database, or
indexed flat files generated for that purpose whether of complete documents, or
-say of files made up of objects), online viewing (e.g. html, xml, pdf), or
-paper publication (e.g. pdf)...
+say of files made up of objects), online viewing (e.g. html, xml, pdf) , or
+paper publication (e.g. pdf) \...
.br
the solution arrived at is by extracting structural information about the
@@ -4627,155 +3680,64 @@ present. For example objects could be saved individually and identified by
their hashes, with an index of how the objects relate to each other to form a
document.
-.SH 33. HELP SOURCES
-.br
-
-.SH 33.1 MAN PAGES
-
-.br
- man sisu
-
-.br
- man sisu\-concordance
-
-.br
- man sisu\-epub
-
-.br
- man sisu\-git
-
-.br
- man sisu\-harvest
-
-.br
- man sisu\-html
-
-.br
- man sisu\-odf
-
-.br
- man sisu\-pdf
-
-.br
- man sisu\-pg
-
-.br
- man sisu\-po
-
-.br
- man sisu\-sqlite
-
-.br
- man sisu\-txt
-
-.br
- man 7 sisu_complete
-
-.br
- man 7 sisu_pdf
-
-.br
- man 7 sisu_postgresql
-
-.br
- man 7 sisu_sqlite
-
-.br
- man sisu_termsheet
-
-.br
- man sisu_webrick
-
-.SH 33.2 SISU GENERATED OUTPUT \- LINKS TO HTML
-
-.br
-Note
-.B SiSU
-documentation is prepared in
-.B SiSU
-and output is available in multiple formats including amongst others html, pdf,
-odf and epub, which may be also be accessed via the html pages[^30]
-
-.SH 33.2.1 WWW.SISUDOC.ORG
-
-.br
-<http://sisudoc.org/sisu/sisu_manual/index.html>
-
-.br
- <http://sisudoc.org/sisu/sisu_manual/index.html>
-
-.SH 33.3 MAN2HTML
-
-.SH 33.3.1 LOCALLY INSTALLED
-
-.br
-file:///usr/share/doc/sisu/html/sisu.1.html
-
-.br
- file:///usr/share/doc/sisu/html/sisu.1.html
-
-.br
- /usr/share/doc/sisu/html/sisu_pdf.7.html
-
-.br
- /usr/share/doc/sisu/html/sisu_postgresql.7.html
+.TP
+.BI 1.
+objects include: headings, paragraphs, verse, tables, images, but not
+footnotes/endnotes which are numbered separately and tied to the object from
+which they are referenced.
.br
- /usr/share/doc/sisu/html/sisu_sqlite.7.html
+.TP
+.BI 2.
+i.e. the
.br
- /usr/share/doc/sisu/html/sisu_webrick.1.html
-
-.SH 33.3.2 WWW.JUS.UIO.NO/SISU
+.I HTML,
.br
-<http://www.jus.uio.no/sisu/man/sisu.1.html>
+.I PDF,
.br
- <http://www.jus.uio.no/sisu/man/sisu.1.html>
+.I EPUB,
.br
- <http://www.jus.uio.no/sisu/man/sisu_complete.7.html>
+.I ODT
.br
- <http://www.jus.uio.no/sisu/man/sisu_pdf.7.html>
+outputs are each built individually and optimised for that form of
+presentation, rather than for example the html being a saved version of the
+odf, or the pdf being a saved version of the html.
.br
- <http://www.jus.uio.no/sisu/man/sisu_postgresql.7.html>
+.TP
+.BI 3.
+the different heading levels
.br
- <http://www.jus.uio.no/sisu/man/sisu_sqlite.7.html>
+.TP
+.BI 4.
+units of text, primarily paragraphs and headings, also any tables, poems,
+code-blocks
.br
- <http://www.jus.uio.no/sisu/man/sisu_webrick.1.html>
-
.TP
-.BI 1.
-objects include: headings, paragraphs, verse, tables, images, but not
-footnotes/endnotes which are numbered separately and tied to the object from
-which they are referenced.
+.BI 5.
+An open standard format for e-books
.br
.TP
-.BI 2.
-i.e. the html, pdf, epub, odf outputs are each built individually and
-optimised for that form of presentation, rather than for example the html being
-a saved version of the odf, or the pdf being a saved version of the html.
+.BI 6.
+Open Document Format (
.br
-.TP
-.BI 3.
-the different heading levels
+.I ODF
.br
-.TP
-.BI 4.
-units of text, primarily paragraphs and headings, also any tables, poems,
-code-blocks
+) text
.br
.TP
-.BI 5.
+.BI 7.
Specification submitted by Adobe to ISO to become a full open ISO
specification
@@ -4784,16 +3746,11 @@ specification
.br
.TP
-.BI 6.
+.BI 8.
ISO standard ISO/IEC 26300:2006
.br
.TP
-.BI 7.
-An open standard format for e-books
-
-.br
-.TP
.BI *1.
square brackets
@@ -4809,33 +3766,39 @@ square brackets
.br
.TP
-.BI 8.
+.BI 9.
<http://www.jus.uio.no/sisu/man/>
.br
.TP
-.BI 9.
+.BI 10.
<http://www.jus.uio.no/sisu/man/sisu.1.html>
.br
.TP
-.BI 10.
+.BI 11.
From sometime after SiSU 0.58 it should be possible to describe SiSU markup
using SiSU, which though not an original design goal is useful.
.br
.TP
-.BI 11.
-files should be prepared using UTF-8 character encoding
+.BI 12.
+files should be prepared using
+
+.br
+.I UTF-8
+
+.br
+character encoding
.br
.TP
-.BI 12.
+.BI 13.
a footnote or endnote
.br
.TP
-.BI 13.
+.BI 14.
self contained endnote marker & endnote in one
.br
@@ -4860,17 +3823,17 @@ editors notes, numbered asterisk footnote/endnote series
.br
.TP
-.BI 14.
+.BI 15.
<http://www.sisudoc.org/>
.br
.TP
-.BI 15.
+.BI 16.
<http://www.ruby-lang.org/en/>
.br
.TP
-.BI 17.
+.BI 18.
Table from the Wealth of Networks by Yochai Benkler
.br
@@ -4878,7 +3841,7 @@ Table from the Wealth of Networks by Yochai Benkler
.br
.TP
-.BI 18.
+.BI 19.
\.ssc (for composite) is under consideration but \._sst makes clear that this
is not a regular file to be worked on, and thus less likely that people will
have "accidents", working on a \.ssc file that is overwritten by subsequent
@@ -4887,35 +3850,38 @@ appropriate suffix to use.
.br
.TP
-.BI 20.
+.BI 21.
<http://www.postgresql.org/>
.br
<http://advocacy.postgresql.org/>
+
.br
<http://en.wikipedia.org/wiki/Postgresql>
+
.br
.TP
-.BI 21.
+.BI 22.
<http://www.hwaci.com/sw/sqlite/>
.br
<http://en.wikipedia.org/wiki/Sqlite>
+
.br
.TP
-.BI 22.
+.BI 23.
<http://search.sisudoc.org>
.br
.TP
-.BI 23.
+.BI 24.
(which could be extended further with current back-end). As regards scaling
of the database, it is as scalable as the database (here Postgresql) and
hardware allow.
.br
.TP
-.BI 24.
+.BI 25.
of this feature when demonstrated to an IBM software innovations evaluator
in 2004 he said to paraphrase: this could be of interest to us. We have large
document management systems, you can search hundreds of thousands of documents
@@ -4924,62 +3890,25 @@ way we can tell you without opening each document where within each your
matches are found.
.br
-.TP
-.BI 25.
-There is nothing to stop MySQL support being added in future.
-.br
.TP
-.BI 26.
-<http://www.jus.uio.no/sisu/man/sisu.1.html>
-
-.br
-.TP
-.BI 27.
-<http://www.jus.uio.no/sisu/man/sisu.8.html>
-
-.br
-.TP
-.BI 28.
-<http://www.jus.uio.no/sisu/man>
-
-.br
-29. the
-.B Debian
-Free Software guidelines require that everything distributed within
-.B Debian
-can be changed \- and the documents are authors' works that while freely
-distributable are not freely changeable.
-
-.br
-30. named index.html or more extensively through sisu_manifest.html
-.br
-
.SH SEE ALSO
-.br
-\fIsisu\fR(1),
-.br
-\fIsisu\-epub\fR(1),
-.br
-\fIsisu\-harvest\fR(1),
-.br
-\fIsisu\-html\fR(1),
-.br
-\fIsisu\-odf\fR(1),
-.br
-\fIsisu\-pdf\fR(1),
-.br
-\fIsisu\-pg\fR(1),
-.br
-\fIsisu\-sqlite\fR(1),
-.br
-\fIsisu\-txt\fR(1).
-.br
-\fIsisu_vim\fR(7)
-
+ sisu(1),
+ sisu-epub(1),
+ sisu-harvest(1),
+ sisu-html(1),
+ sisu-odf(1),
+ sisu-pdf(1),
+ sisu-pg(1),
+ sisu-sqlite(1),
+ sisu-txt(1).
+ sisu_vim(7)
+.TP
.SH HOMEPAGE
-.br
-More information about \fBSiSU\fR can be found at <\fIhttp://www.sisudoc.org/\fR> or <\fIhttp://www.jus.uio.no/sisu/\fR>.
-
+ More information about SiSU can be found at <http://www.sisudoc.org/> or <http://www.jus.uio.no/sisu/>
+.TP
+.SH SOURCE
+ <http://sources.sisudoc.org/>
+.TP
.SH AUTHOR
-\fBSiSU\fR is written by Ralph Amissah <\fIralph@amissah.com\fR>.
+ SiSU is written by Ralph Amissah <ralph@amissah.com>
diff --git a/man/man1/sisu2.1 b/man/man1/sisu4.1
index 09708b31..09708b31 120000
--- a/man/man1/sisu2.1
+++ b/man/man1/sisu4.1
diff --git a/man/man1/sisu_termsheet.1 b/man/man1/sisu_termsheet.1
deleted file mode 100644
index 518e65fc..00000000
--- a/man/man1/sisu_termsheet.1
+++ /dev/null
@@ -1,66 +0,0 @@
-.\" Name: SiSU information Structuring Universe
-.\" Author: Ralph Amissah
-.\" Description: sisu termsheet (preprocessing) manpage
-.\" arch-tag: sisu manpage
-.\" License: GPL 3 or later
-.\" Notes: Process this file with
-.\" groff -man -Tascii sisu.1
-.\" nroff -man sisu.1 | most
-.\" |sisu.1|@|^|<url:sisu.1>
-.TH sisu_termsheet 1 "December 17, 2005" "version 0.34" "SiSU termsheet merge (sisu \-t [termsheet\-name])"
-.SH NAME
-.B SiSU
-\- Structured information, Serialized Units \- a document publishing system
-.SH SYNOPSIS
-.PP
-.B sisu
-.B \-t
-.I [termsheet\-name(s)]
-.\"%% Description
-.SH DESCRIPTION
-.B sisu_termsheet
-.I is part of SiSU is
-.B invoked
-.I through the sisu command (man sisu)
-.PP
-.\"%% Summary
-.SH Summary of man page
-.PP
-sisu_termsheet, is started with the command:
-.B sisu \-\-termsheet
-.I [termsheet\-name(s)]
-.\"%% Flags
-.SH DOCUMENT PROCESSING COMMAND FLAGS
-.PP
-.BI sisu \ \-t \ [termsheet\-name(s)]
-(runs sisu_termsheet) merges the termsheet(s) specified on the commandline with the documents it is instructed to merge in the termsheet(s), and produces regular
-.I SiSU
-output documents from the merged results.
-.PP
-[further documentation on termsheets required]
-.\"%% Further Information
-.SH FURTHER INFORMATION
-.PP
-For more information on
-.I SiSU
-see:
-.I <http://www.jus.uio.no/sisu>
-.PP
-or
-.I man sisu
-.SH AUTHOR
-Ralph Amissah
-.I <ralph@amissah.com>
-or
-.I <ralph.amissah@gmail.com>
-.SH SEE ALSO
-.BR sisu(1),
-.BR sisu(8),
-.BR sisu_webrick(1),
-.BR sisu_vim(7)
-
-.SH HOMEPAGE
-More information about \fBSiSU\fR can be found at <\fIhttp://www.sisudoc.org/\fR> or <\fIhttp://www.jus.uio.no/sisu/\fR>.
-
-.SH AUTHOR
-\fBSiSU\fR is written by Ralph Amissah <\fIralph@amissah.com\fR>.