From 4b51bc00cda70d3c118401a74f1704df38c947a3 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 1 Feb 2011 09:48:30 -0500 Subject: v3 introduced as development branch, invoked using "sisu --v3 [instructions] --- CHANGELOG_v2 | 10 + CHANGELOG_v3 | 130 + bin/sisu | 13 +- bin/sisu-git | 2 + bin/sisu-po | 2 + bin/sisu1 | 76 + bin/sisu2 | 76 + bin/sisu3 | 76 + bin/sisu_termsheet | 13 +- bin/sisu_webrick | 13 +- conf/sisu/v3/sisurc.yml | 148 + data/doc/sisu/v2/CHANGELOG | 10 + data/doc/sisu/v3/CHANGELOG | 130 + data/doc/sisu/v3/html/README | 10 + data/doc/sisu/v3/html/_sisu | 1 + data/doc/sisu/v3/html/homepage/index.html | 264 ++ data/doc/sisu/v3/html/index.html | 1 + data/doc/sisu/v3/html/sisu-concordance.1.html | 67 + data/doc/sisu/v3/html/sisu-epub.1.html | 67 + data/doc/sisu/v3/html/sisu-git.1.html | 67 + data/doc/sisu/v3/html/sisu-harvest.1.html | 69 + data/doc/sisu/v3/html/sisu-html.1.html | 67 + data/doc/sisu/v3/html/sisu-odf.1.html | 67 + data/doc/sisu/v3/html/sisu-pdf.1.html | 67 + data/doc/sisu/v3/html/sisu-pg.1.html | 67 + data/doc/sisu/v3/html/sisu-sqlite.1.html | 67 + data/doc/sisu/v3/html/sisu-txt.1.html | 67 + data/doc/sisu/v3/html/sisu.1.html | 3500 +++++++++++++++++ data/doc/sisu/v3/html/sisu.8.html | 273 ++ data/doc/sisu/v3/html/sisu_complete.7.html | 54 + data/doc/sisu/v3/html/sisu_pdf.7.html | 171 + data/doc/sisu/v3/html/sisu_postgresql.7.html | 198 + data/doc/sisu/v3/html/sisu_sqlite.7.html | 196 + data/doc/sisu/v3/html/sisu_termsheet.1.html | 74 + data/doc/sisu/v3/html/sisu_vim.7.html | 153 + data/doc/sisu/v3/html/sisu_webrick.1.html | 91 + data/doc/sisu/v3/markup-samples/README | 101 + .../image/Gnu_Debian_Linux_Ruby_Way_Better.png | Bin 0 -> 37629 bytes .../markup-samples/samples/_sisu/image/b_doc.png | Bin 0 -> 274 bytes .../samples/_sisu/image/c_Copyleft.png | Bin 0 -> 668 bytes .../markup-samples/samples/_sisu/image/c_Euro.png | Bin 0 -> 514 bytes .../samples/_sisu/image/debian_home.png | Bin 0 -> 7746 bytes .../samples/_sisu/image/free_as_in_freedom.png | Bin 0 -> 31223 bytes .../_sisu/image/free_as_in_freedom_01_rms.png | Bin 0 -> 81111 bytes .../free_as_in_freedom_02_rms_snr_year_report.png | Bin 0 -> 65996 bytes .../free_as_in_freedom_03_rms_st_ignucius.png | Bin 0 -> 34409 bytes .../free_as_in_freedom_04_rms_pleasure_card.png | Bin 0 -> 17364 bytes .../samples/_sisu/image/levitating_gnu.png | Bin 0 -> 66279 bytes .../samples/_sisu/image/philosophical_gnu.png | Bin 0 -> 2695 bytes .../v3/markup-samples/samples/_sisu/image/sisu.png | Bin 0 -> 3260 bytes .../samples/_sisu/skin/dir/skin_sisu.rb | 99 + .../samples/_sisu/skin/doc/skin_gnu.rb | 88 + .../samples/_sisu/skin/doc/skin_rms.rb | 101 + .../samples/_sisu/skin/site/skin_sisu.rb | 99 + .../markup-samples/samples/_sisu/skin/yml/list.yml | 27 + .../samples/_sisu/skin/yml/promo.yml | 215 ++ .../samples/_sisu/skin/yml/skin_countries.yml | 481 +++ .../samples/_sisu/skin/yml/skin_country.yml | 735 ++++ ...lman_crusade_for_free_software.sam_williams.sst | 2484 ++++++++++++ .../samples/sisu_output_overview.ssi | 61 + .../_sisu/image/GnuDebianLinuxRubyBetterWay.png | Bin 0 -> 33396 bytes .../sisu_manual/_sisu/image/sisu.home.png | Bin 0 -> 3260 bytes .../sisu_manual/_sisu/image/sisu.png | Bin 0 -> 3260 bytes .../markup-samples/sisu_manual/_sisu/image/tux.png | Bin 0 -> 6297 bytes .../v3/markup-samples/sisu_manual/_sisu/sisurc.yml | 172 + .../sisu_manual/_sisu/skin/dir/skin_sisu.rb | 1 + .../sisu_manual/_sisu/skin/yml/list.yml | 30 + .../sisu_manual/_sisu/skin/yml/promo.yml | 166 + .../sisu/v3/markup-samples/sisu_manual/sisu.ssm | 103 + .../markup-samples/sisu_manual/sisu_commands.sst | 365 ++ .../v3/markup-samples/sisu_manual/sisu_config.ssi | 80 + .../sisu_manual/sisu_content_directories.ssi | 141 + .../v3/markup-samples/sisu_manual/sisu_css.ssi | 63 + .../sisu_manual/sisu_description.sst | 564 +++ .../markup-samples/sisu_manual/sisu_download.ssi | 163 + .../markup-samples/sisu_manual/sisu_examples.ssi | 54 + .../markup-samples/sisu_manual/sisu_examples.sst | 220 ++ .../v3/markup-samples/sisu_manual/sisu_faq.sst | 221 ++ .../markup-samples/sisu_manual/sisu_filetypes.sst | 170 + .../v3/markup-samples/sisu_manual/sisu_help.sst | 131 + .../sisu_manual/sisu_help_sources.sst | 180 + .../markup-samples/sisu_manual/sisu_homepages.ssi | 87 + .../v3/markup-samples/sisu_manual/sisu_how.ssi | 47 + .../v3/markup-samples/sisu_manual/sisu_howto.sst | 1406 +++++++ .../sisu_manual/sisu_hyperestraier.ssi | 115 + .../sisu_manual/sisu_installation.ssi | 389 ++ .../sisu_manual/sisu_interesting_to_whom.ssi | 53 + .../sisu_manual/sisu_introduction.sst | 72 + .../v3/markup-samples/sisu_manual/sisu_manual.ssm | 118 + .../v3/markup-samples/sisu_manual/sisu_markup.sst | 1417 +++++++ .../sisu_manual/sisu_output_overview.sst | 160 + .../markup-samples/sisu_manual/sisu_postgresql.sst | 98 + .../markup-samples/sisu_manual/sisu_quickstart.sst | 272 ++ .../v3/markup-samples/sisu_manual/sisu_remote.sst | 106 + .../v3/markup-samples/sisu_manual/sisu_search.ssm | 53 + .../markup-samples/sisu_manual/sisu_search_cgi.ssi | 99 + .../sisu_manual/sisu_search_intro.ssi | 52 + .../sisu_manual/sisu_short_feature_summary.ssi | 103 + .../v3/markup-samples/sisu_manual/sisu_skin.sst | 104 + .../v3/markup-samples/sisu_manual/sisu_sql.ssi | 68 + .../v3/markup-samples/sisu_manual/sisu_sqlite.sst | 98 + .../markup-samples/sisu_manual/sisu_synopsis.ssi | 64 + .../sisu_manual/sisu_syntax_highlighting.sst | 169 + .../v3/markup-samples/sisu_manual/sisu_webrick.sst | 93 + .../sisu_manual/sisu_work_needed_and_wishlist.ssi | 78 + data/doc/sisu/v3/sisu_user_txt/configuration.txt | 8 + .../sisu/v3/sisu_user_txt/configuration_css.txt | 9 + .../sisu/v3/sisu_user_txt/configuration_sisurc.txt | 137 + .../sisu/v3/sisu_user_txt/configuration_skin.txt | 15 + data/doc/sisu/v3/sisu_user_txt/index.txt | 5 + data/doc/sisu/v3/sisu_user_txt/markup.txt | 11 + data/doc/sisu/v3/sisu_user_txt/markup_content.txt | 296 ++ .../v3/sisu_user_txt/markup_headers_metadata.txt | 34 + .../markup_headers_processing_instructions.txt | 12 + .../sisu_user_txt/markup_minimum_requirement.txt | 79 + data/sisu/v2/v/version.yml | 6 +- data/sisu/v3/conf/cgi-bin/sisu_search_pgsql.cgi | 904 +++++ data/sisu/v3/conf/cgi-bin/sisu_search_sqlite.cgi | 901 +++++ data/sisu/v3/conf/completion/README | 7 + data/sisu/v3/conf/completion/_sisu | 64 + data/sisu/v3/conf/convert/kdissert_to_sisu | 161 + data/sisu/v3/conf/convert/modify.rb | 250 ++ data/sisu/v3/conf/convert/sisu_convert | 519 +++ data/sisu/v3/conf/convert/wvHtml.xml | 388 ++ data/sisu/v3/conf/convert/wvSiSU.xml | 360 ++ data/sisu/v3/conf/editor-syntax-etc/README | 90 + .../conf/editor-syntax-etc/diakonos/diakonos.conf | 1159 ++++++ data/sisu/v3/conf/editor-syntax-etc/emacs/README | 5 + .../v3/conf/editor-syntax-etc/emacs/sisu-mode.el | 400 ++ .../sisu/v3/conf/editor-syntax-etc/gedit/sisu.lang | 128 + data/sisu/v3/conf/editor-syntax-etc/kate/sisu.xml | 178 + data/sisu/v3/conf/editor-syntax-etc/nano/nanorc | 221 ++ .../conf/editor-syntax-etc/nedit/sisu_nedit.pats | 79 + .../v3/conf/editor-syntax-etc/vim/colors/slate.vim | 59 + .../v3/conf/editor-syntax-etc/vim/filetype.vim | 8 + .../conf/editor-syntax-etc/vim/ftplugin/sisu.vim | 182 + .../v3/conf/editor-syntax-etc/vim/syntax/sisu.vim | 210 + .../conf/editor-syntax-etc/vim/templates/ssi.tpl | 40 + .../conf/editor-syntax-etc/vim/templates/ssm.tpl | 40 + .../conf/editor-syntax-etc/vim/templates/sst.tpl | 40 + .../v3/conf/editor-syntax-etc/vim/vim-sisu.yaml | 7 + data/sisu/v3/conf/lighttpd/lighttpd.cfg.sisu | 115 + data/sisu/v3/conf/lighttpd/lighttpd.cfg.sisu_www | 115 + data/sisu/v3/conf/ruby/irbrc | 19 + data/sisu/v3/odf/odt.zip | Bin 0 -> 5577 bytes data/sisu/v3/v/version.yml | 5 + lib/sisu/v3/air.rb | 85 + lib/sisu/v3/author_format.rb | 113 + lib/sisu/v3/cgi.rb | 86 + lib/sisu/v3/cgi_pgsql.rb | 230 ++ lib/sisu/v3/cgi_sql_common.rb | 992 +++++ lib/sisu/v3/cgi_sqlite.rb | 216 ++ lib/sisu/v3/character_encoding.rb | 379 ++ lib/sisu/v3/composite.rb | 275 ++ lib/sisu/v3/concordance.rb | 345 ++ lib/sisu/v3/conf.rb | 249 ++ lib/sisu/v3/constants.rb | 595 +++ lib/sisu/v3/css.rb | 2085 ++++++++++ lib/sisu/v3/dal.rb | 506 +++ lib/sisu/v3/dal_character_check.rb | 104 + lib/sisu/v3/dal_doc_objects.rb | 444 +++ lib/sisu/v3/dal_doc_str.rb | 1195 ++++++ lib/sisu/v3/dal_endnotes.rb | 125 + lib/sisu/v3/dal_expand_insertions.rb | 198 + lib/sisu/v3/dal_hash_digest.rb | 155 + lib/sisu/v3/dal_idx.rb | 357 ++ lib/sisu/v3/dal_images.rb | 155 + lib/sisu/v3/dal_metadata.rb | 79 + lib/sisu/v3/dal_numbering.rb | 465 +++ lib/sisu/v3/dal_substitutions_and_insertions.rb | 154 + lib/sisu/v3/dal_syntax.rb | 523 +++ lib/sisu/v3/db_columns.rb | 2079 ++++++++++ lib/sisu/v3/db_create.rb | 612 +++ lib/sisu/v3/db_dbi.rb | 93 + lib/sisu/v3/db_drop.rb | 187 + lib/sisu/v3/db_import.rb | 649 ++++ lib/sisu/v3/db_indexes.rb | 113 + lib/sisu/v3/db_load_tuple.rb | 331 ++ lib/sisu/v3/db_remove.rb | 109 + lib/sisu/v3/db_select.rb | 209 + lib/sisu/v3/db_sqltxt.rb | 134 + lib/sisu/v3/db_tests.rb | 117 + lib/sisu/v3/dbi.rb | 143 + lib/sisu/v3/defaults.rb | 2342 ++++++++++++ lib/sisu/v3/digests.rb | 388 ++ lib/sisu/v3/embedded.rb | 139 + lib/sisu/v3/epub.rb | 673 ++++ lib/sisu/v3/epub_concordance.rb | 312 ++ lib/sisu/v3/epub_format.rb | 2030 ++++++++++ lib/sisu/v3/epub_segments.rb | 525 +++ lib/sisu/v3/epub_tune.rb | 417 ++ lib/sisu/v3/errors.rb | 81 + lib/sisu/v3/git.rb | 276 ++ lib/sisu/v3/harvest.rb | 101 + lib/sisu/v3/harvest_authors.rb | 316 ++ lib/sisu/v3/harvest_topics.rb | 559 +++ lib/sisu/v3/help.rb | 1924 ++++++++++ lib/sisu/v3/html.rb | 654 ++++ lib/sisu/v3/html_format.rb | 1480 ++++++++ lib/sisu/v3/html_minitoc.rb | 198 + lib/sisu/v3/html_promo.rb | 434 +++ lib/sisu/v3/html_scroll.rb | 202 + lib/sisu/v3/html_segments.rb | 553 +++ lib/sisu/v3/html_table.rb | 65 + lib/sisu/v3/html_tune.rb | 377 ++ lib/sisu/v3/hub.rb | 594 +++ lib/sisu/v3/i18n.rb | 1781 +++++++++ lib/sisu/v3/manifest.rb | 738 ++++ lib/sisu/v3/manpage.rb | 429 +++ lib/sisu/v3/manpage_format.rb | 108 + lib/sisu/v3/objects.txt | 42 + lib/sisu/v3/odf.rb | 751 ++++ lib/sisu/v3/odf_format.rb | 220 ++ lib/sisu/v3/options.rb | 248 ++ lib/sisu/v3/param.rb | 1403 +++++++ lib/sisu/v3/param_identify_markup.rb | 168 + lib/sisu/v3/particulars.rb | 210 + lib/sisu/v3/plaintext.rb | 424 +++ lib/sisu/v3/plaintext_format.rb | 113 + lib/sisu/v3/po4a.rb | 974 +++++ lib/sisu/v3/po4a_set.rb | 300 ++ lib/sisu/v3/relaxng.rb | 1161 ++++++ lib/sisu/v3/remote.rb | 211 ++ lib/sisu/v3/response.rb | 75 + lib/sisu/v3/rexml.rb | 121 + lib/sisu/v3/screen_text_color.rb | 414 ++ lib/sisu/v3/share_src.rb | 97 + lib/sisu/v3/share_src_kdissert.rb | 88 + lib/sisu/v3/shared_html.rb | 65 + lib/sisu/v3/shared_html_lite.rb | 316 ++ lib/sisu/v3/shared_markup_alt.rb | 320 ++ lib/sisu/v3/shared_metadata.rb | 1361 +++++++ lib/sisu/v3/shared_sem.rb | 156 + lib/sisu/v3/shared_txt.rb | 232 ++ lib/sisu/v3/shared_xhtml.rb | 65 + lib/sisu/v3/shared_xml.rb | 712 ++++ lib/sisu/v3/sisupod_make.rb | 341 ++ lib/sisu/v3/sitemaps.rb | 217 ++ lib/sisu/v3/spell.rb | 101 + lib/sisu/v3/sst_convert_markup.rb | 318 ++ lib/sisu/v3/sst_do_inline_footnotes.rb | 474 +++ lib/sisu/v3/sst_from_xml.rb | 169 + lib/sisu/v3/sst_identify_markup.rb | 474 +++ lib/sisu/v3/sst_to_s_xml_sax.rb | 453 +++ lib/sisu/v3/sysenv.rb | 3993 ++++++++++++++++++++ lib/sisu/v3/termsheet.rb | 166 + lib/sisu/v3/texinfo.rb | 385 ++ lib/sisu/v3/texinfo_format.rb | 587 +++ lib/sisu/v3/texpdf.rb | 832 ++++ lib/sisu/v3/texpdf_format.rb | 1372 +++++++ lib/sisu/v3/update.rb | 130 + lib/sisu/v3/urls.rb | 305 ++ lib/sisu/v3/webrick.rb | 176 + lib/sisu/v3/wikispeak.rb | 373 ++ lib/sisu/v3/xhtml.rb | 425 +++ lib/sisu/v3/xhtml_table.rb | 99 + lib/sisu/v3/xml.rb | 462 +++ lib/sisu/v3/xml_dom.rb | 536 +++ lib/sisu/v3/xml_fictionbook.rb | 300 ++ lib/sisu/v3/xml_format.rb | 1644 ++++++++ lib/sisu/v3/xml_md_oai_pmh_dc.rb | 230 ++ lib/sisu/v3/xml_scaffold.rb | 199 + lib/sisu/v3/xml_tables.rb | 203 + lib/sisu/v3/zap.rb | 83 + man/man1/sisu-git.1 | 37 + 265 files changed, 84166 insertions(+), 6 deletions(-) create mode 100644 CHANGELOG_v3 create mode 100644 bin/sisu-git create mode 100644 bin/sisu-po create mode 100644 bin/sisu1 create mode 100644 bin/sisu2 create mode 100644 bin/sisu3 create mode 100644 conf/sisu/v3/sisurc.yml create mode 100644 data/doc/sisu/v3/CHANGELOG create mode 100644 data/doc/sisu/v3/html/README create mode 120000 data/doc/sisu/v3/html/_sisu create mode 100644 data/doc/sisu/v3/html/homepage/index.html create mode 120000 data/doc/sisu/v3/html/index.html create mode 100644 data/doc/sisu/v3/html/sisu-concordance.1.html create mode 100644 data/doc/sisu/v3/html/sisu-epub.1.html create mode 100644 data/doc/sisu/v3/html/sisu-git.1.html create mode 100644 data/doc/sisu/v3/html/sisu-harvest.1.html create mode 100644 data/doc/sisu/v3/html/sisu-html.1.html create mode 100644 data/doc/sisu/v3/html/sisu-odf.1.html create mode 100644 data/doc/sisu/v3/html/sisu-pdf.1.html create mode 100644 data/doc/sisu/v3/html/sisu-pg.1.html create mode 100644 data/doc/sisu/v3/html/sisu-sqlite.1.html create mode 100644 data/doc/sisu/v3/html/sisu-txt.1.html create mode 100644 data/doc/sisu/v3/html/sisu.1.html create mode 100644 data/doc/sisu/v3/html/sisu.8.html create mode 100644 data/doc/sisu/v3/html/sisu_complete.7.html create mode 100644 data/doc/sisu/v3/html/sisu_pdf.7.html create mode 100644 data/doc/sisu/v3/html/sisu_postgresql.7.html create mode 100644 data/doc/sisu/v3/html/sisu_sqlite.7.html create mode 100644 data/doc/sisu/v3/html/sisu_termsheet.1.html create mode 100644 data/doc/sisu/v3/html/sisu_vim.7.html create mode 100644 data/doc/sisu/v3/html/sisu_webrick.1.html create mode 100644 data/doc/sisu/v3/markup-samples/README create mode 100644 data/doc/sisu/v3/markup-samples/samples/_sisu/image/Gnu_Debian_Linux_Ruby_Way_Better.png create mode 100644 data/doc/sisu/v3/markup-samples/samples/_sisu/image/b_doc.png create mode 100644 data/doc/sisu/v3/markup-samples/samples/_sisu/image/c_Copyleft.png create mode 100644 data/doc/sisu/v3/markup-samples/samples/_sisu/image/c_Euro.png create mode 100644 data/doc/sisu/v3/markup-samples/samples/_sisu/image/debian_home.png create mode 100644 data/doc/sisu/v3/markup-samples/samples/_sisu/image/free_as_in_freedom.png create mode 100644 data/doc/sisu/v3/markup-samples/samples/_sisu/image/free_as_in_freedom_01_rms.png create mode 100644 data/doc/sisu/v3/markup-samples/samples/_sisu/image/free_as_in_freedom_02_rms_snr_year_report.png create mode 100644 data/doc/sisu/v3/markup-samples/samples/_sisu/image/free_as_in_freedom_03_rms_st_ignucius.png create mode 100644 data/doc/sisu/v3/markup-samples/samples/_sisu/image/free_as_in_freedom_04_rms_pleasure_card.png create mode 100644 data/doc/sisu/v3/markup-samples/samples/_sisu/image/levitating_gnu.png create mode 100644 data/doc/sisu/v3/markup-samples/samples/_sisu/image/philosophical_gnu.png create mode 100644 data/doc/sisu/v3/markup-samples/samples/_sisu/image/sisu.png create mode 100644 data/doc/sisu/v3/markup-samples/samples/_sisu/skin/dir/skin_sisu.rb create mode 100644 data/doc/sisu/v3/markup-samples/samples/_sisu/skin/doc/skin_gnu.rb create mode 100644 data/doc/sisu/v3/markup-samples/samples/_sisu/skin/doc/skin_rms.rb create mode 100644 data/doc/sisu/v3/markup-samples/samples/_sisu/skin/site/skin_sisu.rb create mode 100644 data/doc/sisu/v3/markup-samples/samples/_sisu/skin/yml/list.yml create mode 100644 data/doc/sisu/v3/markup-samples/samples/_sisu/skin/yml/promo.yml create mode 100644 data/doc/sisu/v3/markup-samples/samples/_sisu/skin/yml/skin_countries.yml create mode 100644 data/doc/sisu/v3/markup-samples/samples/_sisu/skin/yml/skin_country.yml create mode 100644 data/doc/sisu/v3/markup-samples/samples/free_as_in_freedom.richard_stallman_crusade_for_free_software.sam_williams.sst create mode 100644 data/doc/sisu/v3/markup-samples/samples/sisu_output_overview.ssi create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/_sisu/image/GnuDebianLinuxRubyBetterWay.png create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/_sisu/image/sisu.home.png create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/_sisu/image/sisu.png create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/_sisu/image/tux.png create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/_sisu/sisurc.yml create mode 120000 data/doc/sisu/v3/markup-samples/sisu_manual/_sisu/skin/dir/skin_sisu.rb create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/_sisu/skin/yml/list.yml create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/_sisu/skin/yml/promo.yml create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/sisu.ssm create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/sisu_commands.sst create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/sisu_config.ssi create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/sisu_content_directories.ssi create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/sisu_css.ssi create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/sisu_description.sst create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/sisu_download.ssi create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/sisu_examples.ssi create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/sisu_examples.sst create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/sisu_faq.sst create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/sisu_filetypes.sst create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/sisu_help.sst create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/sisu_help_sources.sst create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/sisu_homepages.ssi create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/sisu_how.ssi create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/sisu_howto.sst create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/sisu_hyperestraier.ssi create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/sisu_installation.ssi create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/sisu_interesting_to_whom.ssi create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/sisu_introduction.sst create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/sisu_manual.ssm create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/sisu_markup.sst create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/sisu_output_overview.sst create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/sisu_postgresql.sst create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/sisu_quickstart.sst create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/sisu_remote.sst create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/sisu_search.ssm create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/sisu_search_cgi.ssi create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/sisu_search_intro.ssi create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/sisu_short_feature_summary.ssi create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/sisu_skin.sst create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/sisu_sql.ssi create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/sisu_sqlite.sst create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/sisu_synopsis.ssi create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/sisu_syntax_highlighting.sst create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/sisu_webrick.sst create mode 100644 data/doc/sisu/v3/markup-samples/sisu_manual/sisu_work_needed_and_wishlist.ssi create mode 100644 data/doc/sisu/v3/sisu_user_txt/configuration.txt create mode 100644 data/doc/sisu/v3/sisu_user_txt/configuration_css.txt create mode 100644 data/doc/sisu/v3/sisu_user_txt/configuration_sisurc.txt create mode 100644 data/doc/sisu/v3/sisu_user_txt/configuration_skin.txt create mode 100644 data/doc/sisu/v3/sisu_user_txt/index.txt create mode 100644 data/doc/sisu/v3/sisu_user_txt/markup.txt create mode 100644 data/doc/sisu/v3/sisu_user_txt/markup_content.txt create mode 100644 data/doc/sisu/v3/sisu_user_txt/markup_headers_metadata.txt create mode 100644 data/doc/sisu/v3/sisu_user_txt/markup_headers_processing_instructions.txt create mode 100644 data/doc/sisu/v3/sisu_user_txt/markup_minimum_requirement.txt create mode 100644 data/sisu/v3/conf/cgi-bin/sisu_search_pgsql.cgi create mode 100644 data/sisu/v3/conf/cgi-bin/sisu_search_sqlite.cgi create mode 100644 data/sisu/v3/conf/completion/README create mode 100644 data/sisu/v3/conf/completion/_sisu create mode 100644 data/sisu/v3/conf/convert/kdissert_to_sisu create mode 100644 data/sisu/v3/conf/convert/modify.rb create mode 100644 data/sisu/v3/conf/convert/sisu_convert create mode 100644 data/sisu/v3/conf/convert/wvHtml.xml create mode 100644 data/sisu/v3/conf/convert/wvSiSU.xml create mode 100644 data/sisu/v3/conf/editor-syntax-etc/README create mode 100644 data/sisu/v3/conf/editor-syntax-etc/diakonos/diakonos.conf create mode 100644 data/sisu/v3/conf/editor-syntax-etc/emacs/README create mode 100644 data/sisu/v3/conf/editor-syntax-etc/emacs/sisu-mode.el create mode 100644 data/sisu/v3/conf/editor-syntax-etc/gedit/sisu.lang create mode 100644 data/sisu/v3/conf/editor-syntax-etc/kate/sisu.xml create mode 100644 data/sisu/v3/conf/editor-syntax-etc/nano/nanorc create mode 100644 data/sisu/v3/conf/editor-syntax-etc/nedit/sisu_nedit.pats create mode 100644 data/sisu/v3/conf/editor-syntax-etc/vim/colors/slate.vim create mode 100644 data/sisu/v3/conf/editor-syntax-etc/vim/filetype.vim create mode 100644 data/sisu/v3/conf/editor-syntax-etc/vim/ftplugin/sisu.vim create mode 100644 data/sisu/v3/conf/editor-syntax-etc/vim/syntax/sisu.vim create mode 100644 data/sisu/v3/conf/editor-syntax-etc/vim/templates/ssi.tpl create mode 100644 data/sisu/v3/conf/editor-syntax-etc/vim/templates/ssm.tpl create mode 100644 data/sisu/v3/conf/editor-syntax-etc/vim/templates/sst.tpl create mode 100644 data/sisu/v3/conf/editor-syntax-etc/vim/vim-sisu.yaml create mode 100644 data/sisu/v3/conf/lighttpd/lighttpd.cfg.sisu create mode 100644 data/sisu/v3/conf/lighttpd/lighttpd.cfg.sisu_www create mode 100644 data/sisu/v3/conf/ruby/irbrc create mode 100644 data/sisu/v3/odf/odt.zip create mode 100644 data/sisu/v3/v/version.yml create mode 100644 lib/sisu/v3/air.rb create mode 100644 lib/sisu/v3/author_format.rb create mode 100644 lib/sisu/v3/cgi.rb create mode 100644 lib/sisu/v3/cgi_pgsql.rb create mode 100644 lib/sisu/v3/cgi_sql_common.rb create mode 100644 lib/sisu/v3/cgi_sqlite.rb create mode 100644 lib/sisu/v3/character_encoding.rb create mode 100644 lib/sisu/v3/composite.rb create mode 100644 lib/sisu/v3/concordance.rb create mode 100644 lib/sisu/v3/conf.rb create mode 100644 lib/sisu/v3/constants.rb create mode 100644 lib/sisu/v3/css.rb create mode 100644 lib/sisu/v3/dal.rb create mode 100644 lib/sisu/v3/dal_character_check.rb create mode 100644 lib/sisu/v3/dal_doc_objects.rb create mode 100644 lib/sisu/v3/dal_doc_str.rb create mode 100644 lib/sisu/v3/dal_endnotes.rb create mode 100644 lib/sisu/v3/dal_expand_insertions.rb create mode 100644 lib/sisu/v3/dal_hash_digest.rb create mode 100644 lib/sisu/v3/dal_idx.rb create mode 100644 lib/sisu/v3/dal_images.rb create mode 100644 lib/sisu/v3/dal_metadata.rb create mode 100644 lib/sisu/v3/dal_numbering.rb create mode 100644 lib/sisu/v3/dal_substitutions_and_insertions.rb create mode 100644 lib/sisu/v3/dal_syntax.rb create mode 100644 lib/sisu/v3/db_columns.rb create mode 100644 lib/sisu/v3/db_create.rb create mode 100644 lib/sisu/v3/db_dbi.rb create mode 100644 lib/sisu/v3/db_drop.rb create mode 100644 lib/sisu/v3/db_import.rb create mode 100644 lib/sisu/v3/db_indexes.rb create mode 100644 lib/sisu/v3/db_load_tuple.rb create mode 100644 lib/sisu/v3/db_remove.rb create mode 100644 lib/sisu/v3/db_select.rb create mode 100644 lib/sisu/v3/db_sqltxt.rb create mode 100644 lib/sisu/v3/db_tests.rb create mode 100644 lib/sisu/v3/dbi.rb create mode 100644 lib/sisu/v3/defaults.rb create mode 100644 lib/sisu/v3/digests.rb create mode 100644 lib/sisu/v3/embedded.rb create mode 100644 lib/sisu/v3/epub.rb create mode 100644 lib/sisu/v3/epub_concordance.rb create mode 100644 lib/sisu/v3/epub_format.rb create mode 100644 lib/sisu/v3/epub_segments.rb create mode 100644 lib/sisu/v3/epub_tune.rb create mode 100644 lib/sisu/v3/errors.rb create mode 100644 lib/sisu/v3/git.rb create mode 100644 lib/sisu/v3/harvest.rb create mode 100644 lib/sisu/v3/harvest_authors.rb create mode 100644 lib/sisu/v3/harvest_topics.rb create mode 100644 lib/sisu/v3/help.rb create mode 100644 lib/sisu/v3/html.rb create mode 100644 lib/sisu/v3/html_format.rb create mode 100644 lib/sisu/v3/html_minitoc.rb create mode 100644 lib/sisu/v3/html_promo.rb create mode 100644 lib/sisu/v3/html_scroll.rb create mode 100644 lib/sisu/v3/html_segments.rb create mode 100644 lib/sisu/v3/html_table.rb create mode 100644 lib/sisu/v3/html_tune.rb create mode 100644 lib/sisu/v3/hub.rb create mode 100644 lib/sisu/v3/i18n.rb create mode 100644 lib/sisu/v3/manifest.rb create mode 100644 lib/sisu/v3/manpage.rb create mode 100644 lib/sisu/v3/manpage_format.rb create mode 100644 lib/sisu/v3/objects.txt create mode 100644 lib/sisu/v3/odf.rb create mode 100644 lib/sisu/v3/odf_format.rb create mode 100644 lib/sisu/v3/options.rb create mode 100644 lib/sisu/v3/param.rb create mode 100644 lib/sisu/v3/param_identify_markup.rb create mode 100644 lib/sisu/v3/particulars.rb create mode 100644 lib/sisu/v3/plaintext.rb create mode 100644 lib/sisu/v3/plaintext_format.rb create mode 100644 lib/sisu/v3/po4a.rb create mode 100644 lib/sisu/v3/po4a_set.rb create mode 100644 lib/sisu/v3/relaxng.rb create mode 100644 lib/sisu/v3/remote.rb create mode 100644 lib/sisu/v3/response.rb create mode 100644 lib/sisu/v3/rexml.rb create mode 100644 lib/sisu/v3/screen_text_color.rb create mode 100644 lib/sisu/v3/share_src.rb create mode 100644 lib/sisu/v3/share_src_kdissert.rb create mode 100644 lib/sisu/v3/shared_html.rb create mode 100644 lib/sisu/v3/shared_html_lite.rb create mode 100644 lib/sisu/v3/shared_markup_alt.rb create mode 100644 lib/sisu/v3/shared_metadata.rb create mode 100644 lib/sisu/v3/shared_sem.rb create mode 100644 lib/sisu/v3/shared_txt.rb create mode 100644 lib/sisu/v3/shared_xhtml.rb create mode 100644 lib/sisu/v3/shared_xml.rb create mode 100644 lib/sisu/v3/sisupod_make.rb create mode 100644 lib/sisu/v3/sitemaps.rb create mode 100644 lib/sisu/v3/spell.rb create mode 100644 lib/sisu/v3/sst_convert_markup.rb create mode 100644 lib/sisu/v3/sst_do_inline_footnotes.rb create mode 100644 lib/sisu/v3/sst_from_xml.rb create mode 100644 lib/sisu/v3/sst_identify_markup.rb create mode 100644 lib/sisu/v3/sst_to_s_xml_sax.rb create mode 100644 lib/sisu/v3/sysenv.rb create mode 100644 lib/sisu/v3/termsheet.rb create mode 100644 lib/sisu/v3/texinfo.rb create mode 100644 lib/sisu/v3/texinfo_format.rb create mode 100644 lib/sisu/v3/texpdf.rb create mode 100644 lib/sisu/v3/texpdf_format.rb create mode 100644 lib/sisu/v3/update.rb create mode 100644 lib/sisu/v3/urls.rb create mode 100644 lib/sisu/v3/webrick.rb create mode 100644 lib/sisu/v3/wikispeak.rb create mode 100644 lib/sisu/v3/xhtml.rb create mode 100644 lib/sisu/v3/xhtml_table.rb create mode 100644 lib/sisu/v3/xml.rb create mode 100644 lib/sisu/v3/xml_dom.rb create mode 100644 lib/sisu/v3/xml_fictionbook.rb create mode 100644 lib/sisu/v3/xml_format.rb create mode 100644 lib/sisu/v3/xml_md_oai_pmh_dc.rb create mode 100644 lib/sisu/v3/xml_scaffold.rb create mode 100644 lib/sisu/v3/xml_tables.rb create mode 100644 lib/sisu/v3/zap.rb create mode 100644 man/man1/sisu-git.1 diff --git a/CHANGELOG_v2 b/CHANGELOG_v2 index 644f1301..98f12957 100644 --- a/CHANGELOG_v2 +++ b/CHANGELOG_v2 @@ -12,6 +12,16 @@ Reverse Chronological: %% STABLE Branch +%% 2.8.0.orig.tar.gz (2011-02-01:05/2) +http://www.jus.uio.no/sisu/pkg/src/sisu_2.8.0.orig.tar.gz + sisu_2.8.0.orig.tar.gz + sisu_2.8.0-1.dsc + sisu_2.8.0-1.diff.gz + + * note opening of version 3 branch, see v3 changelog + + [post Debian Squeeze] + %% 2.7.10.orig.tar.gz (2010-12-16:50/4) http://www.jus.uio.no/sisu/pkg/src/sisu_2.7.10.orig.tar.gz sisu_2.7.10.orig.tar.gz diff --git a/CHANGELOG_v3 b/CHANGELOG_v3 new file mode 100644 index 00000000..f51ac307 --- /dev/null +++ b/CHANGELOG_v3 @@ -0,0 +1,130 @@ +%% SiSU version 3 + +* homepage at: +* +* +* +* data/doc/sisu/sisu_markup_samples/sisu_manual/sisu_manual.ssm +* data/doc/sisu/sisu_markup_samples/sisu_manual/sisu_download.ssi + gi* CHANGELOG CHANGELOG_v1 CHANGELOG_v2 README data/doc/sisu/ + +Reverse Chronological: + +%% Development branch UNSTABLE +v3 branch once stable will supersede & replace current stable v2 branch + +%% 3.0.0.orig.tar.gz (2011-01-12:02/3) +http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.0.orig.tar.gz + sisu_3.0.0.orig.tar.gz + sisu_3.0.0-1.dsc + sisu_3.0.0-1.diff.gz + + NOTE: big patch, changes interim/incomplete (with possibility of breakage) + primarily for: ebook-readers and other downloading viewers (alternative + directory structures and use of title based filenames); use of git; + internationalisation (use with po4a, export pot & po, alternative directory + structures, use of git to ensure changes not lost). + + * alternative output directory structures, configurable + ├── en + │   ├── epub + │   ├── hashes + │   ├── html + │   │   └── live-manual + │   ├── manifest + │   ├── odt + │   ├── pdf + │   ├── sitemaps + │   ├── txt + │   ├── xhtml + │   └── xml + ├── fr + │   ├── epub + │   ├── hashes + │   ├── html + │   │   └── live-manual + │   ├── manifest + │   ├── odt + │   ├── pdf + │   ├── sitemaps + │   ├── txt + │   ├── xhtml + │   └── xml + ├── po4a + │   └── live-manual + │   ├── po + │   │   └── fr + │   └── pot + └── _sisu + ├── css + ├── image + ├── image_sys -> ../../_sisu/image_sys + └── xml + ├── rnc + ├── rng + └── xsd + [FIX todo: + * post rsync, + * output url paths, + * also processing of url, + * processing of sisupod, + * search db?, + * search cgi + ] + + * sisu processing possibility of using directory path and sisu source + filename, rather than only content in current directory by filename + [rc config rules are that if not processing from current directory, or + directory above language sub-directory, will not find _sisu in sisu source + file directory, but rather will use ~/.sisu if any or /etc/sisu] + + * po4a, work on + * pot, po output from source language and translation + * directory structure + * alternative source directory structures: source and translation files + organised either by existing file naming convention (file.sst + filename~es.sst filname~fr.sst filename~de.sst), or; by placement in + language subdirectories (that follow debian po4a language identification + convention) ( ./en/file.sst ./es/file.sst ./fr/file.sst ./de/file.sst + [./_sisu]) + * process po4a source composite file (.ssm) together with its includes + (.ssi and/or .sst), by identifying composite file to process ... includes + are identified and processed as well + [extensive testing required, initial tests passed on "free_culture" and + "live-manual" and translations] + * integrate use of git, ensure changes are not lost + + * sisupod git, revisiting + * internationalize directory structure + ├── conf + │   └── skin + ├── mm + │   └── image + ├── po4a + │   ├── po + │   │   ├── en + │   │   └── fr + │   └── pot + └── src + ├── en + └── fr + [FIX todo: sisu parsing, not sorted!, directory path parsing major step] + + * object, block text of='block' (instead of 'group'), introduce is='block' + * dal_doc_str, dal_doc_objects, identify + * dal_syntax, introduce block syntax block{ }block, like group + * vim syntax highlighting, match block + * related downstream changes (many files affected) + Note: adjust output representation later + + [UGLY HACKS: + po4a, en assumed as source lanuage, should be configurable + po4a, only configured so far to recognise fr & es, fix + po4a for processing .ssm .ssi, skipping of md title & author + ] + [FIX todo: + directory structure for multilingual outputs + breakage to epub, where src and trans dirs + manifest + decide what to do about source output & po4a & git + ] diff --git a/bin/sisu b/bin/sisu index d977642f..54075d98 100644 --- a/bin/sisu +++ b/bin/sisu @@ -6,7 +6,18 @@ raise "Please, use Ruby1.8.4 or later, current Ruby #{RUBY_VERSION}" if RUBY_VER $VERBOSE=nil $KCODE='u' if RUBY_VERSION < '1.9' argv=$* -SiSU_version_dir=(argv.inspect=~/--v1/) ? 'v1' : 'v2' +SiSU_version_dir=case argv.inspect +when /--v1/ + 'v1' +when /--v2/ + 'v2' +when /--v3/ + 'v3' +when /--dev/ + 'v3' +else + 'v2' +end SiSU_lib="sisu/#{SiSU_version_dir}" require "#{SiSU_lib}/hub" __END__ diff --git a/bin/sisu-git b/bin/sisu-git new file mode 100644 index 00000000..d38b10c5 --- /dev/null +++ b/bin/sisu-git @@ -0,0 +1,2 @@ +#!/bin/sh +sisu -g ${@} diff --git a/bin/sisu-po b/bin/sisu-po new file mode 100644 index 00000000..9d0d1b95 --- /dev/null +++ b/bin/sisu-po @@ -0,0 +1,2 @@ +#!/bin/sh +sisu --v3 --po4a ${@} diff --git a/bin/sisu1 b/bin/sisu1 new file mode 100644 index 00000000..87d9d19a --- /dev/null +++ b/bin/sisu1 @@ -0,0 +1,76 @@ +#!/usr/bin/env ruby +# coding: utf-8 +#SiSU: copyright (C) 1997 - 2009 Ralph Amissah; License GPL, see appended program information +#raise "Please, use Ruby1.8 (1.8.4 or later), current Ruby #{RUBY_VERSION}" if RUBY_VERSION < '1.8.4' or RUBY_VERSION > '1.9' +raise "Please, use Ruby1.8.4 or later, current Ruby #{RUBY_VERSION}" if RUBY_VERSION < '1.8.4' +$VERBOSE=nil +$KCODE='u' if RUBY_VERSION < '1.9' +argv=$* +SiSU_version_dir=case argv.inspect +when /--v1/ + 'v1' +when /--v2/ + 'v2' +when /--v3/ + 'v3' +when /--dev/ + 'v3' +else + 'v1' +end +SiSU_lib="sisu/#{SiSU_version_dir}" +require "#{SiSU_lib}/hub" +__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 Ralph Amissah All Rights Reserved. + + * License: GPL 3 or later: + + SiSU, a framework for document structuring, publishing and search + + Copyright (C) Ralph Amissah + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program. If not, see . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + diff --git a/bin/sisu2 b/bin/sisu2 new file mode 100644 index 00000000..54075d98 --- /dev/null +++ b/bin/sisu2 @@ -0,0 +1,76 @@ +#!/usr/bin/env ruby +# coding: utf-8 +#SiSU: copyright (C) 1997 - 2009 Ralph Amissah; License GPL, see appended program information +#raise "Please, use Ruby1.8 (1.8.4 or later), current Ruby #{RUBY_VERSION}" if RUBY_VERSION < '1.8.4' or RUBY_VERSION > '1.9' +raise "Please, use Ruby1.8.4 or later, current Ruby #{RUBY_VERSION}" if RUBY_VERSION < '1.8.4' +$VERBOSE=nil +$KCODE='u' if RUBY_VERSION < '1.9' +argv=$* +SiSU_version_dir=case argv.inspect +when /--v1/ + 'v1' +when /--v2/ + 'v2' +when /--v3/ + 'v3' +when /--dev/ + 'v3' +else + 'v2' +end +SiSU_lib="sisu/#{SiSU_version_dir}" +require "#{SiSU_lib}/hub" +__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 Ralph Amissah All Rights Reserved. + + * License: GPL 3 or later: + + SiSU, a framework for document structuring, publishing and search + + Copyright (C) Ralph Amissah + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program. If not, see . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + diff --git a/bin/sisu3 b/bin/sisu3 new file mode 100644 index 00000000..e2f21554 --- /dev/null +++ b/bin/sisu3 @@ -0,0 +1,76 @@ +#!/usr/bin/env ruby +# coding: utf-8 +#SiSU: copyright (C) 1997 - 2009 Ralph Amissah; License GPL, see appended program information +#raise "Please, use Ruby1.8 (1.8.4 or later), current Ruby #{RUBY_VERSION}" if RUBY_VERSION < '1.8.4' or RUBY_VERSION > '1.9' +raise "Please, use Ruby1.8.4 or later, current Ruby #{RUBY_VERSION}" if RUBY_VERSION < '1.8.4' +$VERBOSE=nil +$KCODE='u' if RUBY_VERSION < '1.9' +argv=$* +SiSU_version_dir=case argv.inspect +when /--v1/ + 'v1' +when /--v2/ + 'v2' +when /--v3/ + 'v3' +when /--dev/ + 'v3' +else + 'v3' +end +SiSU_lib="sisu/#{SiSU_version_dir}" +require "#{SiSU_lib}/hub" +__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 Ralph Amissah All Rights Reserved. + + * License: GPL 3 or later: + + SiSU, a framework for document structuring, publishing and search + + Copyright (C) Ralph Amissah + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program. If not, see . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + diff --git a/bin/sisu_termsheet b/bin/sisu_termsheet index 15771bae..66370567 100644 --- a/bin/sisu_termsheet +++ b/bin/sisu_termsheet @@ -5,7 +5,18 @@ raise "Please, use Ruby1.8 (1.8.4 or later), current Ruby #{RUBY_VERSION}" if RU #raise "Please, use Ruby1.8.4 or later, current Ruby #{RUBY_VERSION}" if RUBY_VERSION < '1.8.4' $VERBOSE=nil argv=$* -SiSU_version_dir=(argv.inspect=~/--v1/) ? 'v1' : 'v2' +SiSU_version_dir=case argv.inspect +when /--v1/ + 'v1' +when /--v2/ + 'v2' +when /--v3/ + 'v3' +when /--dev/ + 'v3' +else + 'v2' +end SiSU_lib="sisu/#{SiSU_version_dir}" require "#{SiSU_lib}/termsheet" __END__ diff --git a/bin/sisu_webrick b/bin/sisu_webrick index e0d6e5ca..cde38193 100644 --- a/bin/sisu_webrick +++ b/bin/sisu_webrick @@ -5,7 +5,18 @@ raise "Please, use Ruby1.8 (1.8.4 or later), current Ruby #{RUBY_VERSION}" if RU #raise "Please, use Ruby1.8.4 or later, current Ruby #{RUBY_VERSION}" if RUBY_VERSION < '1.8.4' $VERBOSE=nil argv=$* -SiSU_version_dir=(argv.inspect=~/--v1/) ? 'v1' : 'v2' +SiSU_version_dir=case argv.inspect +when /--v1/ + 'v1' +when /--v2/ + 'v2' +when /--v3/ + 'v3' +when /--dev/ + 'v3' +else + 'v2' +end SiSU_lib="sisu/#{SiSU_version_dir}" require "#{SiSU_lib}/webrick" __END__ diff --git a/conf/sisu/v3/sisurc.yml b/conf/sisu/v3/sisurc.yml new file mode 100644 index 00000000..dea3f653 --- /dev/null +++ b/conf/sisu/v3/sisurc.yml @@ -0,0 +1,148 @@ +# Name: SiSU - Simple information Structuring Universe +# Author: Ralph@Amissah.com +# Description: Site wide envionment defaults set here +# system environment info / resource configuration file, for sisu +# License: GPL v3 or later +# site environment configuration file +# this file should be configured and live in +# /etc/sisu #per environment settings, overridden by: +# ~/.sisu #per user settings, overridden by: +# ./_sisu #per local markup directory settings +#% #image source directory, main path and subdirectories +#image: +# path: 'sisu_working' +# public: '_sisu/image' +# #all: 'image' +#% presentation/web directory, main path and subdirectories (most subdirectories are created automatically based on markup directory name) +#webserv: +# url_root: 'http://www.your.url' #without dir stub +# path: '/var/www' #either (i) / [full path from root] or (ii) ~/ [home] or (iii) ./ [pwd] or (iv) will be made from home +# images: '_sisu/image' +# man: 'man' +# cgi: '/usr/lib/cgi-bin' +# feed: 'feed' +# sqlite: 'sisu/sqlite' +# webrick_url: true +#show_output_on: 'filesystem' #for -v and -u url information, alternatives: 'filesystem','webserver','remote_webserver','local:8111','localhost','localhost:8080','webrick','path' +#show_output_on: 'local:8111' +#webserv_cgi: +# host: localhost +# base_path: ~ +# port: '8081' +# user: ~ +show_output_on: 'filesystem_url' +#texinfo display output +#texinfo: +# stub: 'texinfo' +##% processing directories, main path and subdirectories (appended to $HOME), using defaults set in sysenv +#processing: +# path: '~' +# dir: '.sisu_processing~' +# metaverse: 'metaverse' +# tune: 'tune' +# latex: 'tex' +# texinfo: 'texinfo' +# concord_max: 400000 +#% flag - set (non-default) processing flag shortcuts -1, -2 etc. (here adding colour and verbosity as default) +flag: + color: true # making colour default -c is toggle, and will now toggle colour off + default: '-NhwepoabxXyYv' # -m run by default; includes verbose + i: '-hwpoay' # -m run by default + ii: '-NhwepoabxXy' # -m run by default + iii: '-NhwepoabxXyY' # -m run by default + iv: '-NhwepoabxXYDy --update' # -m run by default + v: '-NhwepoabxXYDyv --update' # -m run by default; includes verbose +#% 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' + #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 +#remote: +# - +# user: '[usrname]' +# host: '[remote.hostname]' +# path: '.' #no trailing slash eg 'sisu/www' +# - +# user: '[usrname]' +# host: '[remote.hostname]' +# path: '.' #no trailing slash eg 'sisu/www' +#% webrick information +#webrick: +# port: '8081' +#% sql database info, postgresql and sqlite +#db: +# share_source: false # boolean, default is false +# postgresql: +# port: # '[port (default is 5432)]' +# host: # '[if not localhost, provide host tcp/ip address or domain name]'' +# user: # '[(if different from user) provide username]' +# password: # '[password if required]' +# sqlite: +# path: ~ # './sisu_sqlite.db' +# port: "**" +#html: +# quick_ref: true #default false +# seg_title_banner: true #default false +#odt: +# ocn: true +#plaintext: +# ocn: true +#% output_strucure: by_language: and/or by_filetype: (else default "bundled" +#output) possible values ~, true, false, (default where not set, false), +#output_structure: by_language: (language code directories with filetype +#subdirectories); by_filetype: (filetype directories output_structure) the +#previous default was by_language: false by_filetype: false. Note that where +#by_language is true, by_filetype is (forced) true. If e.g. using po4a +#by_langauge should be used and set true: +output_structure: + by_language: true + by_filetype: true +#% possible values ~, true, false, or command instruction e.g. editor: 'gvim -c +#:R -c :S'. will only ignore if value set to false, absence or nil will not +#remove program as should operate without rc file ie in case of ~ will ignore +#and use hard coded defaults within program), true, false, or command +#instruction e.g. editor: 'gvim -c :R -c :S' on value true system defaults used, +#to change, e.g. editor specify + +permission_set: + zap: false + css_modify: false +# remote_base_site: true +program_set: + rmagick: false +# wc: true +# editor: true +# postgresql: true +# sqlite: true +# tidy: true +# rexml: true +# pdflatex: true +#program_select: +# editor: 'gvim -c :R -c :S' +# pdf_viewer: 'evince' +# web_browser: 'firefox' #'iceweasel' #'epiphany' #'galeon' #'konqueror' #'kazehakase' +# console_www_browser: 'links2' #'elinks' #'w3m' #'lynx' #'links' +# epub_viewer: 'ebook-viewer' #'calibre' #'okular' #'fbreader' +# odf_viewer: 'oowriter' #'abiword' +# xml_viewer: 'xml-viewer' +# man: 'nroff -man' #'groff -man -Tascii' # 'nroff -man' +#promo: sisu_icon, sisu, sisu_search_libre, open_society, fsf, ruby +#search: +# sisu: +# flag: true +## action: http://localhost:8081/cgi-bin/sisu_pgsql.cgi +# action: http://search.sisudoc.org +# db: sisu +# title: sample search form +# hyperestraier: +# flag: true +# action: http://search.sisudoc.org/cgi-bin/estseek.cgi? +#manifest: +# minitoc: true diff --git a/data/doc/sisu/v2/CHANGELOG b/data/doc/sisu/v2/CHANGELOG index 644f1301..98f12957 100644 --- a/data/doc/sisu/v2/CHANGELOG +++ b/data/doc/sisu/v2/CHANGELOG @@ -12,6 +12,16 @@ Reverse Chronological: %% STABLE Branch +%% 2.8.0.orig.tar.gz (2011-02-01:05/2) +http://www.jus.uio.no/sisu/pkg/src/sisu_2.8.0.orig.tar.gz + sisu_2.8.0.orig.tar.gz + sisu_2.8.0-1.dsc + sisu_2.8.0-1.diff.gz + + * note opening of version 3 branch, see v3 changelog + + [post Debian Squeeze] + %% 2.7.10.orig.tar.gz (2010-12-16:50/4) http://www.jus.uio.no/sisu/pkg/src/sisu_2.7.10.orig.tar.gz sisu_2.7.10.orig.tar.gz diff --git a/data/doc/sisu/v3/CHANGELOG b/data/doc/sisu/v3/CHANGELOG new file mode 100644 index 00000000..750fb749 --- /dev/null +++ b/data/doc/sisu/v3/CHANGELOG @@ -0,0 +1,130 @@ +%% SiSU version 3 + +* homepage at: +* +* +* +* data/doc/sisu/sisu_markup_samples/sisu_manual/sisu_manual.ssm +* data/doc/sisu/sisu_markup_samples/sisu_manual/sisu_download.ssi +* ../CHANGELOG ../v1/CHANGELOG ../v2/CHANGELOG ../README ../ + +Reverse Chronological: + +%% Development branch UNSTABLE +v3 branch once stable will supersede & replace current stable v2 branch + +%% 3.0.0.orig.tar.gz (2011-01-12:02/3) +http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.0.orig.tar.gz + sisu_3.0.0.orig.tar.gz + sisu_3.0.0-1.dsc + sisu_3.0.0-1.diff.gz + + NOTE: big patch, changes interim/incomplete (with possibility of breakage) + primarily for: ebook-readers and other downloading viewers (alternative + directory structures and use of title based filenames); use of git; + internationalisation (use with po4a, export pot & po, alternative directory + structures, use of git to ensure changes not lost). + + * alternative output directory structures, configurable + ├── en + │   ├── epub + │   ├── hashes + │   ├── html + │   │   └── live-manual + │   ├── manifest + │   ├── odt + │   ├── pdf + │   ├── sitemaps + │   ├── txt + │   ├── xhtml + │   └── xml + ├── fr + │   ├── epub + │   ├── hashes + │   ├── html + │   │   └── live-manual + │   ├── manifest + │   ├── odt + │   ├── pdf + │   ├── sitemaps + │   ├── txt + │   ├── xhtml + │   └── xml + ├── po4a + │   └── live-manual + │   ├── po + │   │   └── fr + │   └── pot + └── _sisu + ├── css + ├── image + ├── image_sys -> ../../_sisu/image_sys + └── xml + ├── rnc + ├── rng + └── xsd + [FIX todo: + * post rsync, + * output url paths, + * also processing of url, + * processing of sisupod, + * search db?, + * search cgi + ] + + * sisu processing possibility of using directory path and sisu source + filename, rather than only content in current directory by filename + [rc config rules are that if not processing from current directory, or + directory above language sub-directory, will not find _sisu in sisu source + file directory, but rather will use ~/.sisu if any or /etc/sisu] + + * po4a, work on + * pot, po output from source language and translation + * directory structure + * alternative source directory structures: source and translation files + organised either by existing file naming convention (file.sst + filename~es.sst filname~fr.sst filename~de.sst), or; by placement in + language subdirectories (that follow debian po4a language identification + convention) ( ./en/file.sst ./es/file.sst ./fr/file.sst ./de/file.sst + [./_sisu]) + * process po4a source composite file (.ssm) together with its includes + (.ssi and/or .sst), by identifying composite file to process ... includes + are identified and processed as well + [extensive testing required, initial tests passed on "free_culture" and + "live-manual" and translations] + * integrate use of git, ensure changes are not lost + + * sisupod git, revisiting + * internationalize directory structure + ├── conf + │   └── skin + ├── mm + │   └── image + ├── po4a + │   ├── po + │   │   ├── en + │   │   └── fr + │   └── pot + └── src + ├── en + └── fr + [FIX todo: sisu parsing, not sorted!, directory path parsing major step] + + * object, block text of='block' (instead of 'group'), introduce is='block' + * dal_doc_str, dal_doc_objects, identify + * dal_syntax, introduce block syntax block{ }block, like group + * vim syntax highlighting, match block + * related downstream changes (many files affected) + Note: adjust output representation later + + [UGLY HACKS: + po4a, en assumed as source lanuage, should be configurable + po4a, only configured so far to recognise fr & es, fix + po4a for processing .ssm .ssi, skipping of md title & author + ] + [FIX todo: + directory structure for multilingual outputs + breakage to epub, where src and trans dirs + manifest + decide what to do about source output & po4a & git + ] diff --git a/data/doc/sisu/v3/html/README b/data/doc/sisu/v3/html/README new file mode 100644 index 00000000..a4263458 --- /dev/null +++ b/data/doc/sisu/v3/html/README @@ -0,0 +1,10 @@ +this "html" directory contains SiSU man pages in html +- generated from man pages using man2html + +man pages are either created by sisu from sisu markup documents contained in +the directory "sisu_markup_samples/sisu_manual" +or manually crafted + +also see the contents of the directories: +* "sisu_manual" [sisu documentation in various file formats] +* "sisu_markup_samples" [sisu markup examples] diff --git a/data/doc/sisu/v3/html/_sisu b/data/doc/sisu/v3/html/_sisu new file mode 120000 index 00000000..0e977351 --- /dev/null +++ b/data/doc/sisu/v3/html/_sisu @@ -0,0 +1 @@ +../sisu_manual/_sisu \ No newline at end of file diff --git a/data/doc/sisu/v3/html/homepage/index.html b/data/doc/sisu/v3/html/homepage/index.html new file mode 100644 index 00000000..6c55c9c0 --- /dev/null +++ b/data/doc/sisu/v3/html/homepage/index.html @@ -0,0 +1,264 @@ + + + +SiSU information Structuring Universe - Structured +information, Serialized Units - software for electronic texts, +documents, books, digital libraries in plaintext, html, xhtml, XML, +ODF (OpenDocument), LaTeX, pdf, SQL (PostgreSQL and SQLite), and +for search + + + + + + + + + + + + + +
+

+ + SiSU >> + +

+

+ SiSU information Structuring Universe +

+

+ Structured information, Serialized Units +

+

+software for electronic texts, document collections, books, digital libraries, and search +

+

+ with "atomic search" and text positioning system (shared text citation numbering: "ocn") +

+

+outputs include: plaintext, html, xhtml, XML, ODF (OpenDocument), LaTeX, pdf, SQL (PostgreSQL and SQLite) +

+
+
+

+ + SiSU + +

+

+ --- +

+

+ + What does SiSU do? Summary + +

+

+ --- +

+

+ + Book Samples and Markup Examples + +

+

+ --- +

+

+ + Object Citation Numbering - ocn + +

+

(a text positioning system)

+

+ --- +

+

+

+ + Search - "Atomic" + +

+

+ 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 + + abandoned U.S. provisional patent application + +

+

+ --- +

+

+ + Download + +

+

+ --- +

+

+ + Changelog + +

+

+ --- +

+

+ + License + +

+

+ Gnu / Linux / Unix +

+

+ ============= +

+

+ + sisu man pages + +

+

+ --- +

+

+ document preparation can be on any platform, in any editor: + (syntax highlight support currently for: vim, kate, write, gedit, diakonos) +

+

+ + Syntax highlighting + +

+

+ ============= +

+

+ + * Composite document + +

+

+ the composite document is a superset of the following documents: +

+

+ + SiSU description + +

+

+ + SiSU examples + +

+

+ + SiSU chronology + +

+

+ + SiSU technical + +

+

+ + SiSU FAQ + +

+

+ + SiSU download + +

+

+ + SiSU changelog + +

+

+ + SiSU license + +

+

+ + SiSU standard + +

+

+ + SiSU abandoned provisional patent + +

+

+ Note: the placement of SiSU documents on the Net predate the release of SiSU. +

+
+
+

+ For less markup than the most elementary HTML you can have so much more. +

+

SiSU - Structured information, Serialized Units for Electronic Documents, is an information structuring, transforming and publishing framework with the following features:

+

(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,

+

(iii) (a) multiple outputs include amongst others: html; pdf via LaTeX; (structured) XML; ODF (OpenDocument); sql - currently PostgreSQL (and SQLite); ascii, (also texinfo), (b) takes advantage of the strengths implicit in these very different output types, (e.g. pdfs produced using typsetting of LaTeX, databases populated with documents at an individual object/paragraph level, with implications for search possibilities...)

+

(iv) provides a common object positioning and citation system for all outputs, which is human relevant and machine usable: object citation numbering, all objects (paragraphs, headings, verse, tables etc. and images) are numbered identically, for citation purposes, in all outputs (html, pdf, sql etc.),

+

(v) use of Dublin Core and other meta-tags to permit the addition of some semantic information on documents, and making easy integration of rdf/rss feeds etc.,

+

(vi) 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 (eg. 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,

+

(vii) search of document sets, at object/paragraph level, the relational database retains information on the document structure, and citation numbering makes it possible for example to present search matches as an index of documents and locations within the document where the match is found,

+

(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: (a) 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) version control, documents integrated with time based source control system, default RCS or CVS with use of $Id$ tag, which SiSU checks +

(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) is a batch processor for handling large document sets, ... though once generated they need not be re-generated, unless changes are made to the desired presentation of a particular output type,

+

(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

+

(xv) future proofing, a framework for adding further capability or updating existing capability as required: (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, 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 (in my case Reiserfs) 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) use your favourite editor, syntax highlighting files for markup, primarily (g)vim so far,

+

(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) alternatively, (assuming sisu is available to you locally but not installed on the remote server) configure sisu to securely copy (scp) its output to your remote host and run sisu locally, (c) request a remotely located sisu markup file and process it locally by identifying it by its' url.

+
+

+More information on SiSU provided at www.jus.uio.no/sisu/SiSU

+
+
+

+ More information on SiSU provided at: + + www.jus.uio.no/sisu/SiSU + +

+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.

+

+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, as is the OpenDocument output which is a limited SiSU feature set (SiSU is interested in a very limited ODF feature set).

+

+ +ralph@amissah.com + +

+

+ +ralph.amissah@gmail.com + +

+

+2007 +

+

+w3 since October 3 1993 +

+
+ + diff --git a/data/doc/sisu/v3/html/index.html b/data/doc/sisu/v3/html/index.html new file mode 120000 index 00000000..c6513ea0 --- /dev/null +++ b/data/doc/sisu/v3/html/index.html @@ -0,0 +1 @@ +../sisu_manual/index.html \ No newline at end of file diff --git a/data/doc/sisu/v3/html/sisu-concordance.1.html b/data/doc/sisu/v3/html/sisu-concordance.1.html new file mode 100644 index 00000000..0c1f5622 --- /dev/null +++ b/data/doc/sisu/v3/html/sisu-concordance.1.html @@ -0,0 +1,67 @@ + + + + + +SISU\-CONCORDANCE(1) manual page + + +Table of Contents

+ +

+

Name

+SiSU - Structured information, Serialized Units - a document publishing + +

system +

+

Synopsis

+sisu-concordance sisu_document.sst | sisu_document.ssm +

+

Description

+SiSU +is a lightweight markup based document structuring, publishing and search +framework for document collections.

+The sisu-concordance command is an alias +for sisu --concordance (or sisu -w) which produces an HTML concordance file +(wordlist) of a SiSU markup file. +

+

See Also

+sisu(1) +,
+sisu-epub(1) +,
+sisu-harvest(1) +,
+sisu-html(1) +,
+sisu-pdf(1) +,
+sisu-odf(1) +,
+sisu-pg(1) +,
+sisu-sqlite(1) +,
+sisu-txt(1) +. +

+

Homepage

+More information about SiSU can be found at <http://www.jus.uio.no/sisu/ +>. + +

+

Author

+SiSU was written by Ralph Amissah <ralph@amissah.com>.

+ +


+Table of Contents

+

+ + diff --git a/data/doc/sisu/v3/html/sisu-epub.1.html b/data/doc/sisu/v3/html/sisu-epub.1.html new file mode 100644 index 00000000..f3722477 --- /dev/null +++ b/data/doc/sisu/v3/html/sisu-epub.1.html @@ -0,0 +1,67 @@ + + + + + +SISU\-EPUB(1) manual page + + +Table of Contents

+ +

+

Name

+SiSU - Structured information, Serialized Units - a document publishing + +

system +

+

Synopsis

+sisu-epub sisu_document.sst | sisu_document.ssm +

+

Description

+SiSU +is a lightweight markup based document structuring, publishing and search +framework for document collections.

+The sisu-epub command is an alias for +sisu --epub (or sisu -e) which produces EPUB output of a SiSU markup file. + +

+

See Also

+sisu(1) +,
+sisu-concordance(1) +,
+sisu-harvest(1) +,
+sisu-html(1) +,
+sisu-pdf(1) +,
+sisu-odf(1) +,
+sisu-pg(1) +,
+sisu-sqlite(1) +,
+sisu-txt(1) +. +

+

Homepage

+More information about SiSU can be found at <http://www.jus.uio.no/sisu/ +>. + +

+

Author

+SiSU was written by Ralph Amissah <ralph@amissah.com>.

+ +


+Table of Contents

+

+ + diff --git a/data/doc/sisu/v3/html/sisu-git.1.html b/data/doc/sisu/v3/html/sisu-git.1.html new file mode 100644 index 00000000..8df25642 --- /dev/null +++ b/data/doc/sisu/v3/html/sisu-git.1.html @@ -0,0 +1,67 @@ + + + + + +SISU\-GIT(1) manual page + + +Table of Contents

+ +

+

Name

+SiSU - Structured information, Serialized Units - a document publishing + +

system +

+

Synopsis

+sisu-git sisu_document.sst | sisu_document.ssm +

+

Description

+SiSU +is a lightweight markup based document structuring, publishing and search +framework for document collections.

+The sisu-git command is an alias for +sisu --git (or sisu -g) which produces a git repository of the sisu source +document and associated parts (images, ). +

+

See Also

+sisu(1) +,
+sisu-concordance(1) +,
+sisu-epub(1) +,
+sisu-harvest(1) +,
+sisu-html(1) +,
+sisu-pdf(1) +,
+sisu-pg(1) +,
+sisu-sqlite(1) +,
+sisu-txt(1) +. +

+

Homepage

+More information about SiSU can be found at <http://www.jus.uio.no/sisu/ +>. + +

+

Author

+SiSU was written by Ralph Amissah <ralph@amissah.com>.

+ +


+Table of Contents

+

+ + diff --git a/data/doc/sisu/v3/html/sisu-harvest.1.html b/data/doc/sisu/v3/html/sisu-harvest.1.html new file mode 100644 index 00000000..8a542a94 --- /dev/null +++ b/data/doc/sisu/v3/html/sisu-harvest.1.html @@ -0,0 +1,69 @@ + + + + + +SISU\-HARVEST(1) manual page + + +Table of Contents

+ +

+

Name

+SiSU - Structured information, Serialized Units - a document publishing + +

system +

+

Synopsis

+sisu-harvest sisu_document.sst | sisu_document.ssm +

+

Description

+SiSU +is a lightweight markup based document structuring, publishing and search +framework for document collections.

+The sisu-harvest command is an alias +for sisu --harvest which based on the @classify: :topic_register: headers +in each SiSU markup file, produces HTML output in the form of an index +of authors and their texts and an index of topics and related texts. +

+

See +Also

+sisu(1) +,
+sisu-concordance(1) +,
+sisu-epub(1) +,
+sisu-html(1) +,
+sisu-pdf(1) +,
+sisu-odf(1) +,
+sisu-pg(1) +,
+sisu-sqlite(1) +,
+sisu-txt(1) +. +

+

Homepage

+More information about SiSU can be found at <http://www.jus.uio.no/sisu/ +>. + +

+

Author

+SiSU was written by Ralph Amissah <ralph@amissah.com>.

+ +


+Table of Contents

+

+ + diff --git a/data/doc/sisu/v3/html/sisu-html.1.html b/data/doc/sisu/v3/html/sisu-html.1.html new file mode 100644 index 00000000..99fd959f --- /dev/null +++ b/data/doc/sisu/v3/html/sisu-html.1.html @@ -0,0 +1,67 @@ + + + + + +SISU\-HTML(1) manual page + + +Table of Contents

+ +

+

Name

+SiSU - Structured information, Serialized Units - a document publishing + +

system +

+

Synopsis

+sisu-html sisu_document.sst | sisu_document.ssm +

+

Description

+SiSU +is a lightweight markup based document structuring, publishing and search +framework for document collections.

+The sisu-html command is an alias for +sisu --html (or sisu -h) which produces HTML output of a SiSU markup file. + +

+

See Also

+sisu(1) +,
+sisu-concordance(1) +,
+sisu-epub(1) +,
+sisu-harvest(1) +,
+sisu-pdf(1) +,
+sisu-odf(1) +,
+sisu-pg(1) +,
+sisu-sqlite(1) +,
+sisu-txt(1) +. +

+

Homepage

+More information about SiSU can be found at <http://www.jus.uio.no/sisu/ +>. + +

+

Author

+SiSU was written by Ralph Amissah <ralph@amissah.com>.

+ +


+Table of Contents

+

+ + diff --git a/data/doc/sisu/v3/html/sisu-odf.1.html b/data/doc/sisu/v3/html/sisu-odf.1.html new file mode 100644 index 00000000..ae929917 --- /dev/null +++ b/data/doc/sisu/v3/html/sisu-odf.1.html @@ -0,0 +1,67 @@ + + + + + +SISU\-ODF(1) manual page + + +Table of Contents

+ +

+

Name

+SiSU - Structured information, Serialized Units - a document publishing + +

system +

+

Synopsis

+sisu-odf sisu_document.sst | sisu_document.ssm +

+

Description

+SiSU +is a lightweight markup based document structuring, publishing and search +framework for document collections.

+The sisu-odf command is an alias for +sisu --odt (or sisu -o) which produces OpenDocument output of a SiSU markup +file. +

+

See Also

+sisu(1) +,
+sisu-concordance(1) +,
+sisu-epub(1) +,
+sisu-harvest(1) +,
+sisu-html(1) +,
+sisu-pdf(1) +,
+sisu-pg(1) +,
+sisu-sqlite(1) +,
+sisu-txt(1) +. +

+

Homepage

+More information about SiSU can be found at <http://www.jus.uio.no/sisu/ +>. + +

+

Author

+SiSU was written by Ralph Amissah <ralph@amissah.com>.

+ +


+Table of Contents

+

+ + diff --git a/data/doc/sisu/v3/html/sisu-pdf.1.html b/data/doc/sisu/v3/html/sisu-pdf.1.html new file mode 100644 index 00000000..685e0a68 --- /dev/null +++ b/data/doc/sisu/v3/html/sisu-pdf.1.html @@ -0,0 +1,67 @@ + + + + + +SISU\-PDF(1) manual page + + +Table of Contents

+ +

+

Name

+SiSU - Structured information, Serialized Units - a document publishing + +

system +

+

Synopsis

+sisu-pdf sisu_document.sst | sisu_document.ssm +

+

Description

+SiSU +is a lightweight markup based document structuring, publishing and search +framework for document collections.

+The sisu-pdf command is an alias for +sisu --pdf (or sisu -p) which produces PDF output of a SiSU markup file. +

+

See +Also

+sisu(1) +,
+sisu-concordance(1) +,
+sisu-epub(1) +,
+sisu-harvest(1) +,
+sisu-html(1) +,
+sisu-odf(1) +,
+sisu-pg(1) +,
+sisu-sqlite(1) +,
+sisu-txt(1) +. +

+

Homepage

+More information about SiSU can be found at <http://www.jus.uio.no/sisu/ +>. + +

+

Author

+SiSU was written by Ralph Amissah <ralph@amissah.com>.

+ +


+Table of Contents

+

+ + diff --git a/data/doc/sisu/v3/html/sisu-pg.1.html b/data/doc/sisu/v3/html/sisu-pg.1.html new file mode 100644 index 00000000..c87ae7a7 --- /dev/null +++ b/data/doc/sisu/v3/html/sisu-pg.1.html @@ -0,0 +1,67 @@ + + + + + +SISU\-PG(1) manual page + + +Table of Contents

+ +

+

Name

+SiSU - Structured information, Serialized Units - a document publishing + +

system +

+

Synopsis

+sisu-pq sisu_document.sst | sisu_document.ssm +

+

Description

+SiSU +is a lightweight markup based document structuring, publishing and search +framework for document collections.

+The sisu-pq command is an alias for sisu +--pg (or sisu -D) which populates a PostgreSQL database with SiSU content +(for search) from a SiSU markup file. +

+

See Also

+sisu(1) +,
+sisu-concordance(1) +,
+sisu-epub(1) +,
+sisu-harvest(1) +,
+sisu-html(1) +,
+sisu-pdf(1) +,
+sisu-odf(1) +,
+sisu-sqlite(1) +,
+sisu-txt(1) +. +

+

Homepage

+More information about SiSU can be found at <http://www.jus.uio.no/sisu/ +>. + +

+

Author

+SiSU was written by Ralph Amissah <ralph@amissah.com>.

+ +


+Table of Contents

+

+ + diff --git a/data/doc/sisu/v3/html/sisu-sqlite.1.html b/data/doc/sisu/v3/html/sisu-sqlite.1.html new file mode 100644 index 00000000..ab0997e8 --- /dev/null +++ b/data/doc/sisu/v3/html/sisu-sqlite.1.html @@ -0,0 +1,67 @@ + + + + + +SISU\-SQLITE(1) manual page + + +Table of Contents

+ +

+

Name

+SiSU - Structured information, Serialized Units - a document publishing + +

system +

+

Synopsis

+sisu-sqlite sisu_document.sst | sisu_document.ssm +

+

Description

+SiSU +is a lightweight markup based document structuring, publishing and search +framework for document collections.

+The sisu-sqlite command is an alias for +sisu --sqlite (or sisu -d) which populates a SQLite database with SiSU content +(for search) from a SiSU markup file. +

+

See Also

+sisu(1) +,
+sisu-concordance(1) +,
+sisu-epub(1) +,
+sisu-harvest(1) +,
+sisu-html(1) +,
+sisu-pdf(1) +,
+sisu-odf(1) +,
+sisu-pg(1) +,
+sisu-txt(1) +. +

+

Homepage

+More information about SiSU can be found at <http://www.jus.uio.no/sisu/ +>. + +

+

Author

+SiSU was written by Ralph Amissah <ralph@amissah.com>.

+ +


+Table of Contents

+

+ + diff --git a/data/doc/sisu/v3/html/sisu-txt.1.html b/data/doc/sisu/v3/html/sisu-txt.1.html new file mode 100644 index 00000000..2479cd8e --- /dev/null +++ b/data/doc/sisu/v3/html/sisu-txt.1.html @@ -0,0 +1,67 @@ + + + + + +SISU\-TXT(1) manual page + + +Table of Contents

+ +

+

Name

+SiSU - Structured information, Serialized Units - a document publishing + +

system +

+

Synopsis

+sisu-txt sisu_document.sst | sisu_document.ssm +

+

Description

+SiSU +is a lightweight markup based document structuring, publishing and search +framework for document collections.

+The sisu-txt command is an alias for +sisu --txt (or sisu -t) which produces plain text output of a SiSU markup +file. +

+

See Also

+sisu(1) +,
+sisu-concordance(1) +,
+sisu-epub(1) +,
+sisu-harvest(1) +,
+sisu-html(1) +,
+sisu-pdf(1) +,
+sisu-odf(1) +,
+sisu-pg(1) +,
+sisu-sqlite(1) +. +

+

Homepage

+More information about SiSU can be found at <http://www.jus.uio.no/sisu/ +>. + +

+

Author

+SiSU was written by Ralph Amissah <ralph@amissah.com>.

+ +


+Table of Contents

+

+ + diff --git a/data/doc/sisu/v3/html/sisu.1.html b/data/doc/sisu/v3/html/sisu.1.html new file mode 100644 index 00000000..67867294 --- /dev/null +++ b/data/doc/sisu/v3/html/sisu.1.html @@ -0,0 +1,3500 @@ + + + + + +"sisu"("1") manual page + + +Table of Contents

+ +

Name

+sisu - documents: markup, structuring, publishing in multiple standard +formats, and search +

Synopsis

+sisu [-abcDdFehIiMmNnopqRrSsTtUuVvwXxYyZz0-9] +[filename/wildcard] +

sisu [-Ddcv] [instruction] [filename/wildcard] +

sisu +[-CcFLSVvW] +

sisu --v2 [operations] +

sisu --v1 [operations] SISU - MANUAL, +RALPH AMISSAH +

WHAT IS SISU? +

1. 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 (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 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. +

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[^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. +

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[^2] the different forms +of output requested. +

SiSU works with an abstraction of the document based +on its structure which is comprised of its headings[^3] and objects[^4], +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[^5] ODF,[^6] and EPUB.[^7] 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). + +

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.jus.uio.no/sisu +> +

2. COMMANDS SUMMARY +

2.1 DESCRIPTION +

SiSU SiSU +is a document publishing system, that from a simple single marked-up document, +produces multiple of output formats including: plaintext, html, xhtml, +XML, epub, odt (odf text), LaTeX, pdf, info, and SQL (PostgreSQL and SQLite), +which share numbered text objects ("object citation numbering") and the +same document structure information. For more see: <http://www.jus.uio.no/sisu +> + +

2.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 (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 +

+ +
--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 +

+ +
--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 +

+ +
-C [--init-site]
+
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
+
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. +

+ +
-c [filename/wildcard] +
+
+

see --color-toggle +

+ +
--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 +

+ +
-D [instruction] [filename]
+
see --pg +

+ +
-d [--db-[database  type  (sqlite|pg)]] +--[instruction] [filename]
+
see --sqlite +

+ +
--epub [filename/wildcard]
+
produces +an epub document, [sisu  version  2  only] (filename.epub). Alias -e +

+ +
-e [filename/wildcard] +
+
+

see --epub +

+ +
-F [--webserv=webrick]
+
see --sample-search-form +

+ +
--git [filename/wildcard] +
+
produces or updates markup source file structure in a git repo (experimental +and subject to change). Alias -g +

+ +
-g [filename/wildcard]
+
see --git +

+ +
--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 +

+ +
-h [filename/wildcard]
+
see --html +

+ +
-I [filename/wildcard] +
+
+

see --texinfo +

+ +
-i [filename/wildcard]
+
see --manpage +

+ +
-L
+
prints license information. + +

+ +
--machine [filename/wildcard/url]
+
see --dal (document abstraction level/layer) + +

+ +
--maintenance [filename/wildcard/url]
+
maintenance mode files created for +processing preserved and their locations indicated. (also see -V). Alias -M + +

+ +
--manpage [filename/wildcard]
+
produces man page of file, not suitable for +all outputs. Alias -i +

+ +
-M [filename/wildcard/url]
+
see --maintenance +

+ +
-m [filename/wildcard/url] +
+
see --dal (document abstraction level/layer) +

+ +
--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. +

+ +
-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. +

+ +
--odf [filename/wildcard/url] +
+
+

see --odt +

+ +
--odt [filename/wildcard/url]
+
output basic document in opendocument +file format (opendocument.odt). Alias -o +

+ +
-o [filename/wildcard/url]
+
see --odt + +

+ +
--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 +

+ +
--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 +

+ +
-p [filename/wildcard]
+
see --pdf +

+ +
--quiet [filename/wildcard] +
+
quiet less output to screen. +

+ +
-q [filename/wildcard]
+
see --quiet +

+ +
--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 +

+ +
-R [filename/wildcard]
+
see --rsync +

+ +
-r [filename/wildcard]
+
see --scp +

+ +
--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). -Fv (in addition to the above) provides some information +on setting up hyperestraier for sisu. 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 default set to sqlite, (for which +--sqlite may be used instead) or to specify another database --db-[pgsql,  sqlite] +(however see -D) 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 +

+ +
-S
+
see --sisupod +

+ +
-S [filename/wildcard] +
+
+

see --sisupod +

+ +
-s [filename/wildcard]
+
see --source +

+ +
--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 (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 +

+ +
-T [filename/wildcard + (*.termsheet.rb)]
+
standard form document builder, preprocessing feature +

+

+ +
-t [filename/wildcard]
+
see --txt +

+ +
--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 +

+ +
-U [filename/wildcard]
+
see --urls +

+ +
-u [filename/wildcard] +
+
provides url mapping of output files for the flags requested for processing, + +

also see -U +

+ +
--v1 [filename/wildcard]
+
invokes the sisu v1 document parser/generator. +For use with sisu v1 markup documents. (Markup conversion to v2 involves +the modification of document headers) +

+ +
--v2 [filename/wildcard]
+
invokes the +sisu v2 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 +

+ +
-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 +

+ +
--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 and search +-H  ;  also,  note  -F  webrick  ]. Alias -W +

+ +
-W
+
see --webrick +

+ +
--wordmap [filename/wildcard] +
+
+

see --concordance +

+ +
-w [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. + +

+ +
--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 +

+ +
-Z [filename/wildcard]
+
see --zap +

+
+3. 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[^*1] denoted by asterisk + +

or dagger/plus sign +

+ +
--no-asterisk
+
strips output text of editor endnotes[^*2] + +

denoted by asterisk sign +

+ +
--no-dagger
+
strips output text of editor endnotes[^+1] + +

denoted by dagger/plus sign +

+
+4. 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. +

+
+5. 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 (note that the defaults can be +changed/configured in the sisurc.yml file): +

+ +
-0
+
-mNhwpAobxXyYv [this  is  the + default  action  run  when  no  i.e.  on  ’sisu  [filename]’] +

+ +
-1
+
-mhewpy +

+ +
-2
+
-mhewpaoy + +

+ +
-3
+
-mhewpAobxXyY +

+ +
-4
+
-mhewpAobxXDyY --import +

+ +
-5
+
-mhewpAobxXDyY --update +

add -v +for verbose mode and -c for color, e.g. sisu -2vc [filename  or +

consider -u + +

for appended url info or -v for verbose output +

+
+5.1 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. +

6. HELP +

6.1 SISU MANUAL +

The most up to date information +on sisu should be contained in the sisu_manual, available at: +

<http://sisudoc.org/sisu/sisu_manual/ +>
+ +

The manual can be generated from source, found respectively, either +within the SiSU tarball or installed locally at: +

./data/doc/sisu/v2/sisu_markup_samples/sisu_manual/
+ +

/usr/share/doc/sisu/v2/sisu_markup_samples/sisu_manual/
+ +

move to the respective directory and type e.g.: +

sisu sisu_manual.ssm
+ +

6.2 SISU MAN PAGES +

If SiSU is installed on your system usual man commands +should be available, try: +

man sisu
+ +

man sisu_markup
+ +

man sisu_commands
+ +

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: +

./data/doc/sisu/v2/sisu_markup_samples/sisu_manual/
+ +

Once installed, directory equivalent to: +

/usr/share/doc/sisu/sisu_manual/
+ +

Available man pages are converted back to html using man2html: +

/usr/share/doc/sisu/v2/html/
+ +

./data/doc/sisu/v2/html/
+ +

An online version of the sisu man page is available here: +

* various +sisu man pages <http://www.jus.uio.no/sisu/man/ +> [^8] +

* sisu.1 <http://www.jus.uio.no/sisu/man/sisu.1.html +> +[^9] +

6.3 SISU BUILT-IN INTERACTIVE HELP +

This is particularly useful for +getting the current sisu setup/environment information: +

sisu --help
+ +

sisu --help [subject]
+ +

sisu --help commands
+ +

sisu --help markup
+ +

sisu --help env [for  feedback  on  the  way  your  system  is
+ setup  with  regard  to  sisu]
+ +

sisu -V [environment  information,  same  as  above  command]
+ +

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. +

6.4 HELP SOURCES +

For lists of alternative help sources, +see: +

man page +

man sisu_help_sources
+ +

man2html +

/usr/share/doc/sisu/v2/html/sisu.1.html
+ +

<http://sisudoc.org/sisu/sisu_help_sources/index.html +>
+ +

7. INTRODUCTION TO SISU MARKUP[^10] +

7.1 SUMMARY +

SiSU source documents +are plaintext (UTF-8)[^11] 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: +

* heading levels defines +document structure
+ +

* text basic attributes, italics, bold etc.
+ +

* grouped text (objects), which are to be treated differently, such +as code
+ blocks or poems.
+ +

* footnotes/endnotes
+ +

* linked text and images
+ +

* 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: +

sisu --identify +[filename].sst
+ +

For brief descriptive summary of markup history +

sisu --query-history
+ +

or if for a particular version: +

sisu --query-0.38
+ +

7.2 MARKUP EXAMPLES +

7.2.1 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/ +> +

Some example marked +up files are available as html with syntax highlighting for viewing: <http://www.jus.uio.no/sisu/sample/syntax +> + +

an alternative presentation of markup syntax: <http://www.jus.uio.no/sisu/sample/on_markup.txt +> + +

7.2.2 INSTALLED +

With SiSU installed sample skins may be found in: /usr/share/doc/sisu/sisu_markup_samples/dfsg +(or equivalent directory) and if sisu-markup-samples is installed also under: + +

/usr/share/doc/sisu/sisu_markup_samples/non-free +

8. 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: +

+


+

  % this would be a comment
+
+

8.1 SAMPLE HEADER +

This current document is loaded by a master document +that has a header similar to this one: +

+


+

  % SiSU master 2.0
+  @title: SiSU
+   :subtitle: Manual
+  @creator: :author: Amissah, Ralph
+  @rights: Copyright (C) Ralph Amissah 2007, 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
+   :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 --v1  [operations]
+  @links: { SiSU Manual }http://www.jus.uio.no/sisu/sisu_manual/
+    { Book Samples and Markup Examples }http://www.jus.uio.no/sisu/SiSU/examples.html
+    { SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU
+    { SiSU @ Freshmeat }http://freshmeat.net/projects/sisu/
+    { SiSU @ Ruby Application Archive }http://raa.ruby-lang.org/project/sisu/
+    { SiSU @ Debian }http://packages.qa.debian.org/s/sisu.html
+    { SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html
+    { SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html
+    { SiSU help }http://www.jus.uio.no/sisu/sisu_manual/sisu_help/
+    { SiSU help sources }http://www.jus.uio.no/sisu/sisu_manual/sisu_help_sources/
+
+

8.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 either the form @headername: or 0~headername. 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 +

+


+

  % SiSU 2.0  [declared  file-type  identifier  with  markup  version]
+
+


+

  @title:  [title  text]  [this  header  is  the  only  one  that  is  mandatory]
+    :subtitle:  [subtitle  if  any]
+    :language: English
+
+


+

  @creator: :author:  [Lastname,  First  names]
+   :illustrator:  [Lastname,  First  names]
+   :translator:  [Lastname,  First  names]
+   :prepared_by:  [Lastname,  First  names]
+
+


+

  @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]
+
+


+

  @rights: :copyright: Copyright (C)  [Year  and  Holder]
+   :license:  [Use  License  granted]
+   :text:  [Year  and  Holder]
+   :translation:  [Name,  Year]
+   :illustrations:  [Name,  Year]
+
+


+

  @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]
+
+


+

  @links: { SiSU }http://www.jus.uio.no/sisu/
+    { FSF }http://www.fsf.org
+
+


+

  @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]
+
+


+

  @original: :language:  [language]
+
+


+

  @notes: :comment:
+   :prefix:  [prefix  is  placed  just  after  table  of  contents]
+
+

9. MARKUP OF SUBSTANTIVE TEXT +

9.1 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  ] 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 +

+


+

  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)
+
+

9.2 FONT ATTRIBUTES +

markup example: +

+


+

  normal text,  *{emphasis}*, !{bold text}!, /{italics}/, _{underscore}_,
+"{citation}",
+  ^{superscript}^, ,{subscript},, +{inserted text}+, -{strikethrough}- #{monospace}#
+  normal text
+  !{emphasis}!
+  *{bold text}*
+  _{underscore}_
+  /{italics}/
+
+  ^{superscript}^
+  ,{subscript},
+  +{inserted text}+
+  -{strikethrough}-
+  #{monospace}#
+
+

resulting output: +

normal text emphasis bold text underscore italics +"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 + +

9.3 INDENTATION AND BULLETS +

markup example: +

+


+

  ordinary paragraph
+  _1 indent paragraph one step
+  _2 indent paragraph two steps
+  _9 indent paragraph nine steps
+
+

+

resulting output: +

ordinary paragraph +

indent paragraph one step
+ +

indent paragraph two steps
+ +

indent paragraph nine steps
+ +

markup example: +

+


+

  _* bullet text
+  _1* bullet text, first indent
+  _2* bullet text, two step indent
+
+

resulting output: +

* bullet text +

* bullet text, first indent
+ +

* bullet text, two step indent
+ +

Numbered List (not to be confused with headings/titles, (document structure)) + +

markup example: +

+


+

  # numbered list                numbered list 1., 2., 3, etc.
+  _# numbered list numbered list indented a., b., c., d., etc.
+
+

9.4 FOOTNOTES / ENDNOTES +

Footnotes and endnotes not distinguished in +markup. They are automatically numbered. Depending on the output file format +(html, EPUB, odf, pdf etc.), the document output selected will have either +footnotes or endnotes. +

markup example: +

+


+

  ~{ a footnote or endnote }~
+
+

resulting output: +

[^12] +

markup example: +

+


+

  normal text~{ self contained endnote marker & endnote in one }~ continues
+
+

resulting output: +

normal text[^13] continues +

markup example: +

+


+

  normal text ~{* unnumbered asterisk footnote/endnote, insert multiple
+asterisks if required }~ continues
+  normal text ~{** another unnumbered asterisk footnote/endnote }~ continues
+
+

resulting output: +

normal text [^*] continues +

normal text [^**] continues + +

markup example: +

+


+

  normal text ~[*  editors  notes,  numbered  asterisk  footnote/endnote  series
+ ]~ continues
+  normal text ~[+  editors  notes,  numbered  asterisk  footnote/endnote  series
+ ]~ continues
+
+

resulting output: +

normal text [^*3] continues +

normal text [^+2] continues + +

Alternative endnote pair notation for footnotes/endnotes: +

+


+

  % note the endnote marker
+  normal text~^ continues
+  ^~ endnote text following the paragraph in which the marker occurs
+
+

the standard and pair notation cannot be mixed in the same document +

+ +

9.5 LINKS +

9.5.1 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: +

+


+

  normal text http://www.jus.uio.no/sisu continues
+
+

resulting output: +

normal text <http://www.jus.uio.no/sisu +> continues +

An + +

escaped url without decoration +

markup example: +

+


+

  normal text _http://www.jus.uio.no/sisu continues
+  deb http://www.jus.uio.no/sisu/archive unstable main non-free
+
+

resulting output: +

normal text <_http://www.jus.uio.no/sisu +> 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: +

+


+

  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
+
+

To link text or an image to a url the markup is as follows +

markup example: + +

+


+

  about { SiSU }http://url.org markup
+
+

9.5.2 LINKING TEXT +

resulting output: +

about SiSU <http://www.jus.uio.no/sisu/ +> + +

markup +

A shortcut notation is available so the url link may also be provided + +

automatically as a footnote +

markup example: +

+


+

  about {~^ SiSU }http://url.org markup
+
+

resulting output: +

abou tSiSU <http://www.jus.uio.no/sisu/ +> [^14] markup +

+ +

9.5.3 LINKING IMAGES +

markup example: +

+


+

  { tux.png 64x80 }image
+  % various url linked images
+  {tux.png 64x80
+  {GnuDebianLinuxRubyBetterWay.png 100x101
+  {~^ ruby_logo.png
+
+

resulting output: +

[ tux.png ] +

tux.png 64x80 +

[  ruby_logo  (png  missing) + ] [^15] +

GnuDebianLinuxRubyBetterWay.png 100x101 and Ruby +

linked url footnote + +

shortcut +

+


+

  {~^  [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 marker *~name
+
+

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. +

9.6 GROUPED TEXT +

9.6.1 + +

TABLES +

Tables may be prepared in two either of two forms +

markup example: + +

+


+

  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
+
+

resulting output: +

 [table  omitted,  see  other  document  formats]
+ +

a second form may be easier to work with in cases where there is not + +

much information in each column +

markup example: [^16] +

+


+

  !_ 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.
+
+

resulting output: +

Table 3.1: Contributors to Wikipedia, January 2001 +- June 2005 +

 [table  omitted,  see  other  document  formats]
+ +

* Contributed at least ten times; ** at least 5 times in last month; +*** more than 100 times in last month. +

9.6.2 POEM +

basic markup: +

+


+

  poem{
+    Your poem here
+  }poem
+  Each verse in a poem is given a separate object number.
+
+

markup example: +

+


+

  poem{
+                      ‘Fury said to a
+                     mouse, That he
+                   met in the
+                 house,
+
+                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,
+                   a trial,
+                     dear Sir,
+                           With
+                       no jury
+                    or judge,
+                  would be
+                wasting
+               our
+                breath.
+
+                   judge, I’ll
+                     be jury,
+                           Said
+                      cunning
+                        old Fury:
+
+                        try the
+                           whole
+                            cause,
+                               and
+                          condemn
+                         you
+                        to
+                         death.
+  }poem
+
+

resulting output: +

’Fury said to a
+ mouse, That he
+ met in the
+ house,
+
+ 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,
+ a trial,
+ dear Sir,
+ With
+ no jury
+ or judge,
+ would be
+ wasting
+ our
+ breath.
+
+ judge, I’ll
+ be jury,
+ Said
+ cunning
+ old Fury:
+
+ try the
+ whole
+ cause,
+ and
+ condemn
+ you
+ to
+ death.
+ +

9.6.3 GROUP +

basic markup: +

+


+

  group{
+    Your grouped text here
+  }group
+  A group is treated as an object and given a single object number.
+
+

markup example: +

+


+

  group{
+                      ’Fury said to a
+                     mouse, That he
+                   met in the
+                 house,
+
+                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,
+                   a trial,
+                     dear Sir,
+                           With
+                       no jury
+                    or judge,
+                  would be
+                wasting
+               our
+                breath.
+
+                   judge, I’ll
+                     be jury,
+                           Said
+                      cunning
+                        old Fury:
+
+                        try the
+                           whole
+                            cause,
+                               and
+                          condemn
+                         you
+                        to
+                         death.
+  }group
+
+

resulting output: +

’Fury said to a
+ mouse, That he
+ met in the
+ house,
+
+ 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,
+ a trial,
+ dear Sir,
+ With
+ no jury
+ or judge,
+ would be
+ wasting
+ our
+ breath.
+
+ judge, I’ll
+ be jury,
+ Said
+ cunning
+ old Fury:
+
+ try the
+ whole
+ cause,
+ and
+ condemn
+ you
+ to
+ death.
+ +

9.6.4 CODE +

Code tags 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 more than 100 times in last +month. option  to  number  each  line  of  code  may  be  considered  at more than +100 times in last month. some  later  time] +

use of code tags instead of +poem compared, resulting output: +

+


+

                      ’Fury said to a
+                     mouse, That he
+                   met in the
+                 house,
+
+                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,
+                   a trial,
+                     dear Sir,
+                           With
+                       no jury
+                    or judge,
+                  would be
+                wasting
+               our
+                breath.
+
+                   judge, I’ll
+                     be jury,
+                           Said
+                      cunning
+                        old Fury:
+
+                        try the
+                           whole
+                            cause,
+                               and
+                          condemn
+                         you
+                        to
+                         death.
+
+

9.7 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. +

+


+

    Paragraph containing main term and sub-term.
+    ={Main term:sub-term}
+
+

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: +

+


+

    Main term, 1
+      sub-term, 1
+
+

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. + +

+


+

    Paragraph containing main term, second term and sub-term.
+    ={first term; second term: sub-term}
+
+

The structure of the resulting index would be: +

+


+

    First term, 1,
+    Second term, 1,
+      sub-term, 1
+
+

If multiple sub-terms appear under one paragraph, they are separated under +the main term heading from each other by a pipe symbol. +

+


+

    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
+
+

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: +

+


+

    Main term, 1,
+      sub-term, 1-3,
+      second sub-term, 1,
+
+

10. 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 +

+


+

  << filename1.sst
+  << filename2.ssi
+
+

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. + +

+


+

  << filename.ssi
+  <<{filename.ssi}
+  % using textlink alternatives
+  << |filename.ssi|@|^|
+
+

MARKUP SYNTAX HISTORY +

11. NOTES RELATED TO FILES-TYPES AND MARKUP SYNTAX + +

0.38 is substantially current, 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 +

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  and  @author:] +

+


+

  :A~ @title by @author
+
+

0.52 (2007w14/6) declared document type identifier at start of text/document: + +

.B SiSU
+ 0.52 +

or, backward compatible using the comment marker: +

%
+ 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 +

+


+

  ~{* for example for describing an author }~ and ~{** for describing a
+second author }~
+
+

* for example for describing an author +

** for describing a second author + +

and +

+


+

  ~[*  my  note  ]~ or ~[+  another  note  ]~
+
+

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, + +

+


+

  @headername: and headers :A~ :B~ :C~ 1~ 2~ 3~
+
+

as the equivalent of: +

+


+

  0~headername and headers 1~ 2~ 3~ 4~ 5~ 6~
+
+

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: +

+


+

  rename ’s/.s[123]$/.sst/’ *.s{1,2,3}
+  rename ’s/.r[123]$/.ssm/’ *.r{1,2,3}
+  rename ’s/.si$/.ssi/’ *.si
+
+

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{ +

12. +SISU FILETYPES +

SiSU has plaintext and binary filetypes, and can process +either type of document. +

12.1 .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: +

sisu -s [filename]
+ +

12.1.1 SISU TEXT - REGULAR FILES (.SST) +

The most common form of document +in SiSU , see the section on SiSU markup. +

<http://www.jus.uio.no/sisu/sisu_markup +> + +

<http://www.jus.uio.no/sisu/sisu_manual +> +

12.1.2 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 [^17] + +

<http://www.jus.uio.no/sisu/sisu_markup +> +

<http://www.jus.uio.no/sisu/sisu_manual +> + +

12.1.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. +

12.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: +

sisu -S [filename]
+ +

Alternatively, make a pod of the contents of a whole directory: +

+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.jus.uio.no/sisu/sisu_commands +> + +

<http://www.jus.uio.no/sisu/sisu_manual +> +

13. EXPERIMENTAL ALTERNATIVE INPUT +REPRESENTATIONS +

13.1 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): +

sisu --to-sax [filename/wildcard] or sisu --to-sxs [filename/wildcard]
+ +

sisu --to-dom [filename/wildcard] or sisu --to-sxd [filename/wildcard]
+ +

sisu --to-node [filename/wildcard] or sisu --to-sxn [filename/wildcard]
+ +

convert to sst from any sisu xml representation (sax, dom and node): + +

sisu --from-xml2sst [filename/wildcard  [.sxs.xml,.sxd.xml,sxn.xml]]
+ +

or the same: +

sisu --from-sxml [filename/wildcard  [.sxs.xml,.sxd.xml,sxn.xml]]
+ +

13.1.1 XML SAX REPRESENTATION +

To convert from sst to simple xml (sax) +representation: +

sisu --to-sax [filename/wildcard] or sisu --to-sxs [filename/wildcard]
+ +

To convert from any sisu xml representation back to sst +

sisu --from-xml2sst +[filename/wildcard  [.sxs.xml,.sxd.xml,sxn.xml]]
+ +

or the same: +

sisu --from-sxml [filename/wildcard  [.sxs.xml,.sxd.xml,sxn.xml]]
+ +

13.1.2 XML DOM REPRESENTATION +

To convert from sst to simple xml (dom) +representation: +

sisu --to-dom [filename/wildcard] or sisu --to-sxd [filename/wildcard]
+ +

To convert from any sisu xml representation back to sst +

sisu --from-xml2sst +[filename/wildcard  [.sxs.xml,.sxd.xml,sxn.xml]]
+ +

or the same: +

sisu --from-sxml [filename/wildcard  [.sxs.xml,.sxd.xml,sxn.xml]]
+ +

13.1.3 XML NODE REPRESENTATION +

To convert from sst to simple xml (node) +representation: +

sisu --to-node [filename/wildcard] or sisu --to-sxn [filename/wildcard]
+ +

To convert from any sisu xml representation back to sst +

sisu --from-xml2sst +[filename/wildcard  [.sxs.xml,.sxd.xml,sxn.xml]]
+ +

or the same: +

sisu --from-sxml [filename/wildcard  [.sxs.xml,.sxd.xml,sxn.xml]]
+ +

14. CONFIGURATION +

14.1 DETERMINING THE CURRENT CONFIGURATION +

Information +on the current configuration of SiSU should be available with the help +command: +

sisu -v
+ +

which is an alias for: +

sisu --help env
+ +

Either of these should be executed from within a directory that contains +sisu markup source documents. +

14.2 CONFIGURATION FILES (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: +

./_sisu/sisurc.yml
+ +

~/.sisu/sisurc.yml
+ +

/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 +

15. SKINS +

Skins modify the default +appearance of document output on a document, directory, or site wide basis. +Skins are looked for in the following locations: +

./_sisu/skin
+ +

~/.sisu/skin
+ +

/etc/sisu/skin
+ +

Within the skin directory are the following the default sub-directories +for document skins: +

./skin/doc
+ +

./skin/dir
+ +

./skin/site
+ +

A skin is placed in the appropriate directory and the file named skin_[name].rb + +

The skin itself is a ruby file which modifies the default appearances +set in the program. +

15.1 DOCUMENT SKIN +

Documents take on a document skin, +if the header of the document specifies a skin to be used. +

+


+

  @skin: skin_united_nations
+
+

15.2 DIRECTORY SKIN +

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). +

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. + +

15.3 SITE SKIN +

A site skin, modifies the program default skin. +

15.4 SAMPLE + +

SKINS +

With SiSU installed sample skins may be found in: +

/etc/sisu/skin/doc +and
+ /usr/share/doc/sisu/v2/sisu_markup_samples/samples/_sisu/skin/doc
+ +

(or equivalent directory) and if sisu-markup-samples is installed also +under: +

/usr/share/doc/sisu-markup-samples/v2/samples/_sisu/skin/doc
+ +

Samples of list.yml and promo.yml (which are used to create the right +column list) may be found in: +

/usr/share/doc/sisu/sisu_markup_samples/dfsg/_sisu/skin/yml +(or equivalent
+ directory)
+ +

16. 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, and +change the default CSS file that is looked for in a skin.[^18] +

17. ORGANISING +CONTENT +

17.1 DIRECTORY STRUCTURE AND MAPPING +

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. +

+

18. HOMEPAGES +

SiSU is about the ability +to auto-generate documents. Home pages are regarded as custom built items, +and are not created by SiSU 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: +

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) +

2. 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. +

18.1 + +

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: +

+ sisu -CC
+ +

18.2 HOME PAGE WITHIN A SKIN +

Skins are described in a separate section, +but basically are a file written in the programming language 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. +

+ 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 +

+


+

    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
+
+

19. MARKUP AND OUTPUT EXAMPLES +

19.1 MARKUP EXAMPLES +

Current markup examples +and document output samples are provided at <http://www.jus.uio.no/sisu/SiSU/examples.html +> + +

Some markup with syntax highlighting may be found under <http://www.jus.uio.no/sisu/sample/syntax +> +but is not as up to date. +

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. +

20. +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. +

21. SQL +

21.1 POPULATING SQL TYPE DATABASES + +

SiSU feeds sisu markupd documents into sql type databases PostgreSQL[^19] +and/or SQLite[^20] 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: +

* one containing semantic +(and other) headers, including, title, author,
+ subject, (the Dublin Core...);
+ +

* 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
+ +

* a third containing endnotes cross-referenced back to the paragraph +from
+ which they are referenced (both in formatted and clean text versions +for
+ searching).
+ +

* 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 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). +

22. +POSTGRESQL +

22.1 NAME +

SiSU - Structured information, Serialized Units +- a document publishing system, postgresql dependency package +

22.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). +

22.3 SYNOPSIS +

sisu -D [instruction] [filename/wildcard + if  required]
+ +

sisu -D --pg --[instruction] [filename/wildcard  if  required]
+ +

22.4 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. +

22.4.1 CREATE AND DESTROY DATABASE +

+

+ +
--pgsql --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) +

+ +
sisu -D --createdb +
+
+

creates database where no database existed before +

+ +
sisu -D --create
+
creates + +

database tables where no database tables existed before +

+ +
sisu -D --Dropall +
+
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
+
destroys existing database and builds + +

a new empty database structure +

+
+22.4.2 IMPORT AND REMOVE DOCUMENTS +

+

+ +
sisu +-D --import -v [filename/wildcard]
+
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]
+
updates file contents + +

in database +

+ +
sisu -D --remove -v [filename/wildcard]
+
removes specified document +from postgresql database. +

+
+23. SQLITE +

23.1 NAME +

SiSU - Structured information, +Serialized Units - a document publishing system. +

23.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). +

23.3 + +

SYNOPSIS +

sisu -d [instruction] [filename/wildcard  if  required]
+ +

sisu -d --(sqlite|pg) --[instruction] [filename/wildcard  if
+ required]
+ +

23.4 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. +

23.4.1 CREATE AND DESTROY DATABASE +

+

+ +
--sqlite --createall +
+
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 +
+
+

creates database where no database existed before +

+ +
sisu -d --create
+
creates + +

database tables where no database tables existed before +

+ +
sisu -d --dropall +
+
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
+
destroys existing database and builds + +

a new empty database structure +

+
+23.4.2 IMPORT AND REMOVE DOCUMENTS +

+

+ +
sisu +-d --import -v [filename/wildcard]
+
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]
+
updates file contents in database + +

+ +
sisu -d --remove -v [filename/wildcard]
+
removes specified document from sqlite +database. +

+
+24. INTRODUCTION +

24.1 SEARCH - DATABASE FRONTEND SAMPLE, UTILISING +DATABASE AND SISU FEATURES, INCLUDING OBJECT CITATION NUMBERING (BACKEND +CURRENTLY POSTGRESQL) +

Sample search frontend <http://search.sisudoc.org +> +[^21] A small database and sample query front-end (search from) that makes +use of the citation system, object citation numbering to demonstrates functionality.[^22] + +

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.[^23] +

+

+ +
sisu -F --webserv-webrick
+
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: +

sisu --help sql
+ +

+


+

  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
+
+

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 +

+
+24.2 SEARCH FORM +

+

+ +
sisu -F
+
generates a sample search form, which must + +

be copied to the web-server cgi directory +

+ +
sisu -F --webserv-webrick
+
generates +a sample search form for use with the webrick server, which must be copied + +

to the web-server cgi directory +

+ +
sisu -Fv
+
as above, and provides some information + +

on setting up hyperestraier +

+ +
sisu -W
+
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 +

+

+
+25. HYPERESTRAIER +

See the documentation for hyperestraier: +

<http://hyperestraier.sourceforge.net/ +>
+ +

/usr/share/doc/hyperestraier/index.html
+ +

man estcmd
+ +

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: +

estcmd gather -sd [index  name] [directory + path  to  index]
+ +

the following are examples that will need to be tailored according to +your needs: +

cd /home/ralph/sisu_www
+ +

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: + +

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. +

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: +

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: +

sudo cp -vi /usr/lib/estraier/estseek.cgi +/usr/lib/cgi-bin
+ +

sudo chmod -v 755 /usr/lib/cgi-bin/estseek.cgi
+ +

sudo cp -v /usr/share/hyperestraier/estseek.* /usr/lib/cgi-bin
+ +

[see  estraier  documentation  for  paths]
+ +

(ii) edit estseek.conf, with attention to the lines starting ’indexname:’ +and ’replace:’: +

indexname: /home/ralph/sisu_www/casket
+ +

replace: ^file:///home/ralph/sisu_www{{!}}http://localhost +
+ +

replace: /index.html?${{!}}/
+ +

(C) to test using webrick, start webrick: +

sisu -W
+ +

and try open the url: <http://localhost:8081/cgi-bin/estseek.cgi +> +

26. SISU_WEBRICK + +

26.1 NAME +

SiSU - Structured information, Serialized Units - a document + +

publishing system +

26.2 SYNOPSIS +

sisu_webrick [port] +

or +

sisu -W [port] + +

26.3 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). +

26.4 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 +

26.5 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 +

26.6 FURTHER INFORMATION + +

For more information on SiSU see: <http://www.jus.uio.no/sisu +> +

or man sisu + +

26.7 AUTHOR +

Ralph Amissah ralph@amissah.com or ralph.amissah@gmail.com +

+ +

26.8 SEE ALSO +

sisu(1) +
+ +

sisu_vim(7) +
+ +

sisu(8) +
+ +

27. 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. +

+


+

  sisu -3 http://[provide  url  to  valid  .sst  or  .ssm  file]
+
+

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. +

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. +

+


+

  sisu -3 http://[provide  url  to  valid  sisupod.zip  or  .ssp  file]
+
+

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. +

REMOTE DOCUMENT OUTPUT +

28. 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. +

+


+

  sisu -3R sisu_remote.sst
+
+

28.1 COMMANDS +

+

+ +
-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 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]
+
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 +

+
+28.2 CONFIGURATION +

[expand  on  the  setting  up  of  an  ssh-agent  /  keychain] + +

29. 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. +

30. QUICKSTART - GETTING STARTED HOWTO + +

30.1 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. +

30.1.1 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: + +

+


+

    aptitude update
+    aptitude install sisu-complete
+
+

The following /etc/apt/sources.list setting permits the download of additional +markup samples: +

+


+

  #/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
+  d
+
+

The aptitude commands become: +

+


+

    aptitude update
+    aptitude install sisu-complete sisu-markup-samples
+
+

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 + +

+


+

  #/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
+
+

repeat the aptitude commands +

+


+

    aptitude update
+    aptitude install sisu-complete sisu-markup-samples
+
+

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. +

30.1.2 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: +

<http://www.jus.uio.no/sisu/SiSU/download.html#rpm +>
+ +

as root type: +

rpm -i [rpm  package  name]
+ +

30.1.3 INSTALLATION FROM SOURCE +

To install SiSU from source check information +at: +

<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)[^24] 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: +

+


+

      ruby setup.rb config
+      ruby setup.rb setup
+      #[and  as  root:]
+      ruby setup.rb install
+
+

further information on setup.rb is available from: +

<http://i.loveruby.net/en/projects/setup/ +>
+ +

<http://i.loveruby.net/en/projects/setup/doc/usage.html +>
+ +

+

The root directory of the unpacked SiSU as root type: +

ruby install +base
+ +

or for a more complete installation: +

ruby install
+ +

or +

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 +

<http://make.rubyforge.org/ +>
+ +

<http://rubyforge.org/frs/?group_id=615 +>
+ +

For a list of alternative actions you may type: +

ruby install help
+ +

ruby install -T
+ +

30.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/sisu_markup_samples/dfsg + +

30.2.1 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 + +

30.2.2 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 +

30.2.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 + +

30.3 GETTING HELP +

30.3.1 THE MAN PAGES +

Type: +

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 +> +[^25] +

* sisu.8 <http://www.jus.uio.no/sisu/man/sisu.8 +> [^26] +

* man directory +<http://www.jus.uio.no/sisu/man +> [^27] +

30.3.2 BUILT IN HELP +

sisu --help +

sisu + +

- +

- +

help --env +

sisu --help --commands +

sisu --help --markup +

30.3.3 THE HOME PAGE +

+<http://www.jus.uio.no/sisu +> +

<http://www.jus.uio.no/sisu/SiSU +> +

30.4 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[^28] to include them it is necessary +to include non-free in your /etc/apt/source.list or obtain them from the +sisu home site. +

31. EDITOR FILES, SYNTAX HIGHLIGHTING +

The directory: + +

./data/sisu/v2/conf/editor-syntax-etc/
+ +

/usr/share/sisu/v2/conf/editor-syntax-etc
+ +

contains rudimentary sisu syntax highlighting files for: +

* (g)vim +<http://www.vim.org +> +

package: sisu-vim
+ +

status: largely done +

there is a vim syntax highlighting and folds +component
+ +

* gedit <http://www.gnome.org/projects/gedit +> +

* gobby <http://gobby.0x539.de/ +> + +

file: sisu.lang
+ +

place in: +

/usr/share/gtksourceview-1.0/language-specs
+ +

or +

~/.gnome2/gtksourceview-1.0/language-specs
+ +

status: very basic syntax highlighting
+ +

comments: this editor features display line wrap and is used by Goby!
+ +

* nano <http://www.nano-editor.org +> +

file: nanorc
+ +

save as: +

~/.nanorc
+ +

status: basic syntax highlighting
+ +

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: +

~/.diakonos/diakonos.conf
+ +

includes: +

status: basic syntax highlighting
+ +

comments: assumes dark background; no display line-wrap +

* kate & kwrite +<http://kate.kde.org +> +

file: sisu.xml
+ +

place in:
+ +

/usr/share/apps/katepart/syntax
+ +

or
+ +

~/.kde/share/apps/katepart/syntax
+ +

[settings::configure  kate::{highlighting,filetypes}]
+ +

[tools::highlighting::{markup,scripts}::  .B  SiSU  ]
+ +

* nedit <http://www.nedit.org +> +

file: sisu_nedit.pats
+ +

nedit -import sisu_nedit.pats
+ +

status: a very clumsy first attempt [not  really  done]
+ +

comments: this editor features display line wrap
+ +

* emacs <http://www.gnu.org/software/emacs/emacs.html +> +

files: sisu-mode.el
+ +

to file ~/.emacs add the following 2 lines:
+ +

(add-to-list ’load-path
+ +

(require ’sisu-mode.el)
+ +

[not  done  /  not  yet  included]
+ +

* vim & gvim <http://www.vim.org +> +

files:
+ +

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)
+ +

status: this includes: syntax highlighting; vim folds; some error +checking
+ +

comments: this editor features display line wrap
+ +

NOTE: +

[  .B  SiSU  parses  files  with  long  lines  or  line  breaks,  display + linewrap  (without  line-breaks)  is  a  convenient editor  feature  to  have  for + sisu  markup] +

32. 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). +

33. 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 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  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
+ +

* ODF - open document format, the iso standard for document storage
+ +

* LaTeX - used to generate pdf
+ +

* pdf (via LaTeX)
+ +

* sql - population of an sql database, (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]. +

*longtermmaintainabilityofdocumentcollectionsinaworldofchanging +formats, having a very sparsely marked-up source document base. there is +a considerable degree of future-proofing, output representations are upgradeable +(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. +

34. HELP SOURCES +

For a summary of alternative +ways to get help on SiSU try one of the following: +

man page +

man sisu_help
+ +

man2html +

<http://www.jus.uio.no/sisu/man/sisu_help.1.html +>
+ +

sisu generated output - links to html +

<http://sisudoc.org/sisu/sisu_help/index.html +>
+ +

help sources lists +

Alternative sources for this help sources page +listed here: +

man sisu_help_sources
+ +

<http://sisudoc.org/sisu/sisu_help_sources/index.html +>
+ +

34.1 MAN PAGES +

34.1.1 MAN +

man sisu
+ +

man 7 sisu_complete
+ +

man 7 sisu_pdf
+ +

man 7 sisu_postgresql
+ +

man 7 sisu_sqlite
+ +

man sisu_termsheet
+ +

man sisu_webrick
+ +

34.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[^28] +

34.2.1 WWW.SISUDOC.ORG +

<http://sisudoc.org/sisu/sisu_manual/index.html +> + +

<http://sisudoc.org/sisu/sisu_manual/index.html +>
+ +

<http://sisudoc.org/sisu/sisu_commands/index.html +>
+ +

<http://sisudoc.org/sisu/sisu_complete/index.html +>
+ +

<http://sisudoc.org/sisu/sisu_configuration/index.html +>
+ +

<http://sisudoc.org/sisu/sisu_description/index.html +>
+ +

<http://sisudoc.org/sisu/sisu_examples/index.html +>
+ +

<http://sisudoc.org/sisu/sisu_faq/index.html +>
+ +

<http://sisudoc.org/sisu/sisu_filetypes/index.html +>
+ +

<http://sisudoc.org/sisu/sisu_help/index.html +>
+ +

<http://sisudoc.org/sisu/sisu_help_sources/index.html +>
+ +

<http://sisudoc.org/sisu/sisu_howto/index.html +>
+ +

<http://sisudoc.org/sisu/sisu_introduction/index.html +>
+ +

<http://sisudoc.org/sisu/sisu_manual/index.html +>
+ +

<http://sisudoc.org/sisu/sisu_markup/index.html +>
+ +

<http://sisudoc.org/sisu/sisu_output_overview/index.html +>
+ +

<http://sisudoc.org/sisu/sisu_pdf/index.html +>
+ +

<http://sisudoc.org/sisu/sisu_postgresql/index.html +>
+ +

<http://sisudoc.org/sisu/sisu_quickstart/index.html +>
+ +

<http://sisudoc.org/sisu/sisu_remote/index.html +>
+ +

<http://sisudoc.org/sisu/sisu_search/index.html +>
+ +

<http://sisudoc.org/sisu/sisu_skin/index.html +>
+ +

<http://sisudoc.org/sisu/sisu_sqlite/index.html +>
+ +

<http://sisudoc.org/sisu/sisu_syntax_highlighting/index.html +>
+ +

<http://sisudoc.org/sisu/sisu_vim/index.html +>
+ +

<http://sisudoc.org/sisu/sisu_webrick/index.html +>
+ +

34.3 MAN2HTML +

34.3.1 LOCALLY INSTALLED +

<file:///usr/share/doc/sisu/v2/html/sisu.1.html> + +

<file:///usr/share/doc/sisu/v2/html/sisu_help.1.html> +

<file:///usr/share/doc/sisu/v2/html/sisu_help_sources.1.html> + +

/usr/share/doc/sisu/v2/html/sisu.1.html
+ +

/usr/share/doc/sisu/v2/html/sisu_pdf.7.html
+ +

/usr/share/doc/sisu/v2/html/sisu_postgresql.7.html
+ +

/usr/share/doc/sisu/v2/html/sisu_sqlite.7.html
+ +

/usr/share/doc/sisu/v2/html/sisu_webrick.1.html
+ +

34.3.2 WWW.JUS.UIO.NO/SISU +

<http://www.jus.uio.no/sisu/man/sisu.1.html +> +

<http://www.jus.uio.no/sisu/man/sisu.1.html +>
+ +

<http://www.jus.uio.no/sisu/man/sisu_complete.7.html +>
+ +

<http://www.jus.uio.no/sisu/man/sisu_pdf.7.html +>
+ +

<http://www.jus.uio.no/sisu/man/sisu_postgresql.7.html +>
+ +

<http://www.jus.uio.no/sisu/man/sisu_sqlite.7.html +>
+ +

<http://www.jus.uio.no/sisu/man/sisu_webrick.1.html +>
+ +

+

    +.
  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.
  2. .
  3. 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. +

  4. .
  5. the different heading levels
  6. .
  7. units +of text, primarily paragraphs and headings, also any tables, poems, code-blocks +
  8. .
  9. Specification submitted by Adobe to ISO to become a full open ISO specification +<http://www.linux-watch.com/news/NS7542722606.html +>
  10. .
  11. ISO standard ISO/IEC 26300:2006 + +

  12. .
  13. An open standard format for e-books +

    + +

    *1.
    +
    square brackets
    + +
    *2.
    +
    square brackets +
    + +
    +1.
    +
    square brackets
  14. .
  15. <http://www.jus.uio.no/sisu/man/ +>
  16. .
  17. <http://www.jus.uio.no/sisu/man/sisu.1.html +> +
  18. .
  19. 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.
  20. .
  21. files should +be prepared using UTF-8 character encoding
  22. .
  23. a footnote or endnote
  24. .
  25. self contained +endnote marker & endnote in one + +
    *.
    +
    unnumbered asterisk footnote/endnote, +insert multiple asterisks if required
    + +
    **.
    +
    another unnumbered asterisk footnote/endnote +
    + +
    *3.
    +
    editors notes, numbered asterisk footnote/endnote series
    + +
    +2.
    +
    editors +notes, numbered asterisk footnote/endnote series
  26. .
  27. <http://www.jus.uio.no/sisu/ +> +
  28. .
  29. <http://www.ruby-lang.org/en/ +>
  30. .
  31. Table from the Wealth of Networks by Yochai Benkler +<http://www.jus.uio.no/sisu/the_wealth_of_networks.yochai_benkler +>
  32. .
  33. .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 processing. +It may be however that when the resulting file is shared .ssc is an appropriate +suffix to use.
  34. .
  35. <http://www.postgresql.org/ +> <http://advocacy.postgresql.org/ +> <http://en.wikipedia.org/wiki/Postgresql +> +
  36. .
  37. <http://www.hwaci.com/sw/sqlite/ +> <http://en.wikipedia.org/wiki/Sqlite +>
  38. .
  39. <http://search.sisudoc.org +> +
  40. .
  41. (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.
  42. .
  43. 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.
  44. .
  45. There is nothing to stop MySQL support +being added in future.
  46. .
  47. <http://www.jus.uio.no/sisu/man/sisu.1 +>
  48. .
  49. <http://www.jus.uio.no/sisu/man/sisu.8 +> +
  50. .
  51. <http://www.jus.uio.no/sisu/man +>
  52. .
  53. 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. +
  54. .
  55. +

    named index.html or more extensively through sisu_manifest.html +

  56. +
+ +

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) +
+sisu(8) + +

+

Homepage

+More information about SiSU can be found at <http://www.jus.uio.no/sisu/ +>. + +

+

Author

+SiSU was written by Ralph Amissah <ralph@amissah.com>.

+ +


+Table of Contents

+

+ + diff --git a/data/doc/sisu/v3/html/sisu.8.html b/data/doc/sisu/v3/html/sisu.8.html new file mode 100644 index 00000000..4c81d9c3 --- /dev/null +++ b/data/doc/sisu/v3/html/sisu.8.html @@ -0,0 +1,273 @@ + + + + + +sisu(8) manual page + + +Table of Contents

+ +

Name

+SiSU - Structured information, Serialized Units - a document +publishing system +

Synopsis

+sisu [-mhwpxXv...] [ filename/wildcard ] +

Description

+A +document publishing system, that from a simple single marked-up document, +produces a multitude of output formats including: html, latex, pdf, info, +and sql output, which can be cross referenced as having the same document +structure and text object numbering, "object citation numbering". Features +include its’ simple syntax; the semantic tagging of documents; document +management; built to be associated with a revision control system; text +object numbering for the identification of a texts location in any of the +output formats, easy skinning on a site wide, or per document basis; granular +search; a degree of future proofing ... for more see man 1 sisu or <http://www.jus.uio.no/sisu +> +

+SiSU is a way of preparing, publishing, managing and searching documents. + +

Installation

+

+Up to date information on SiSU downloads, and their installation +should be available from: <http://www.jus.uio.no/sisu/SiSU/download.html +> or +at: <http://www.jus.uio.no/sisu/sisu_download/download.html +>

+There you should +find links to the latest source tarball, and instructions on how to install +SiSU.

+Sample marked up documents are are available at /usr/share/doc/sisu/sisu_markup_samples/dfsg +or equivalent directory, or online, see <http://www.jus.uio.no/sisu/SiSU/2.html +> +

+man 1 sisu has a syntax table along with processing commands.

+SiSU also +provides some help via the command: sisu --help and selecting an appropriate +subject, e.g.

+sisu --help commands

+sisu --help markup

+sisu --help headers

+sisu +--help env

+The rest of this note is on post installation setup +

Post Installation +Setup - Quick start

+

+ +

After installation of sisu-complete, move to the document +samples directory,

+ cd /usr/share/doc/sisu/sisu_markup_samples/dfsg
+

+[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

+sisu -CC

+then run:

+sisu -1 free_as_in_freedom.rms_and_free_software.sam_williams.sst +

+or the same:

+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:

+sisu --help env

+or

+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.

+sisu -1 http://www.jus.uio.no/sisu/gpl3.fsf/gpl3.fsf.sst + +

+sisu -3 http://www.jus.uio.no/sisu/free_culture.lawrence_lessig/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 <http://www.jus.uio.no/sisu/SiSU/2.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. +

+sisu -3 http://www.jus.uio.no/sisu/free_culture.lawrence_lessig/sisupod.zip +

+there +is a security issue associated with the running of document skins that +are not your own, so these are turned of by default, and the use of the +following command, which switches on the associated skin is not recommended: +

+sisu -3 --trust http://www.jus.uio.no/sisu/free_culture.lawrence_lessig/sisupod.zip + +

+For help man sisu

+sisu --help

+sisu --help env for the way sisu "sees/maps" +your system

+sisu --help commands for list of commands and so on

+ Document +markup 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: +mkdir ~/sisu_test

+cd ~/sisu_test

+cp -a /usr/share/doc/sisu/sisu_markup_samples/dfsg/* +~/sisu_test/.

+----------

+Tip: the markup syntax examples may be of interest <http://www.jus.uio.no/sisu/sample/ +> +

+Tip: 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 c to your flags.

+----------

+ SiSU configuration file search path is:

+./_sisu/sisurc.yaml +

+~/.sisu/sisurc.yaml

+/etc/sisu/sisurc.yaml

+ +

Debian INSTALLATION Note

+

+It is best +you see <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

+Depends: ruby (>= 1.8.2), libwebrick-ruby, unzip, zip +

+Conflicts: vim-sisu, sisu-vim, sisu-remote

+Replaces: vim-sisu, sisu-vim

+Recommends: +sisu-pdf, sisu-sqlite, sisu-postgresql, librmagick-ruby, trang, tidy, librexml-ruby, +openssl, rsync, openssh-client lsh-client, keychain, hyperestraier, kdissert +Suggests: rcs cvs, lv, texinfo, pinfo

+Package: sisu-complete

+Depends: ruby +(>= 1.8.2), sisu, sisu-pdf, sisu-postgresql, sisu-sqlite

+Recommends: hyperestraier +

+Package: sisu-pdf

+Depends: sisu, texlive-latex-base, texlive-fonts-recommended, +texlive-latex-recommended, texlive-latex-extra

+Suggests: evince, xpdf

+Package: +sisu-postgresql

+Depends: sisu, libdbd-pg-ruby, libdbi-ruby, libdbm-ruby, postgresql +

+Recommends: libfcgi-ruby

+Package: sisu-sqlite

+Depends: sisu, sqlite, libdbd-sqlite-ruby, +libdbi-ruby, libdbm-ruby

+Recommends: libfcgi-ruby

+Package: sisu-markup-samples +

+Depends: sisu

+ +

Package Description

+sisu

+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, 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.

+Homepage: <http://www.jus.uio.no/sisu +> + +

Document Resource Configuration

+sisu resource configuration information +is obtained from sources (where they exist):
+
~/.sisu/sisurc.yaml/etc/sisu/[sisu version]/sisurc.yamlsisu program defaults

+ +Skins

+default document appearance may be modified using skins contained +in sub-directories located at the following paths:
+

./_sisu/skin~/.sisu/skin/etc/sisu/skin

+more specifically, the following locations +(or their /etc/sisu equivalent) should be used:

+~/.sisu/skin/doc skins for +individual documents;

+~/.sisu/skin/dir skins for directories of matching +names;

+~/.sisu/skin/site site-wide skin modifying the site-wide appearance +of documents.

+Usually all skin files are placed in the document skin directory: +~/.sisu/skin/doc with softlinks being made to the skins contained there +from other skin directories as required. +

Further Information

+

+For more information +on SiSU see: <http://www.jus.uio.no/sisu +>

+or man sisu +

Author

+Ralph Amissah <ralph@amissah.com> +or <ralph.amissah@gmail.com> +

See Also

+sisu(1) +, sisu_examples(1) +, sisu_webrick(1) +, +sisu_pdf(1) + sisu_sqlite(1) + sisu_postgresql(1) + sisu_termsheet(1) +,

+ +


+Table of Contents

+

+ + diff --git a/data/doc/sisu/v3/html/sisu_complete.7.html b/data/doc/sisu/v3/html/sisu_complete.7.html new file mode 100644 index 00000000..1a1e025d --- /dev/null +++ b/data/doc/sisu/v3/html/sisu_complete.7.html @@ -0,0 +1,54 @@ + + + + + +sisu_complete(7) manual page + + +Table of Contents

+ +

Name

+SiSU - Structured information, Serialized Units - a document +publishing system, complete dependency package

+ +

Synopsis

+Dummy package installs +the whole of SiSU, excluding sisu-examples

+sisu-complete together with sisu-examples +is the whole of sisu +

Further Information

+

+For more information on SiSU see: +<http://www.jus.uio.no/sisu +>

+or man sisu +

Author

+Ralph Amissah <ralph@amissah.com> +or <ralph.amissah@gmail.com> +

See

+sisu(1) +, sisu(8) +, +

Also

+sisu_webrick(1) +, sisu_pdf(7) + +sisu_sqlite(7) + sisu_postgresql(7) + sisu_vim(7) + sisu_termsheet(1) +,

+ +


+Table of Contents

+

+ + diff --git a/data/doc/sisu/v3/html/sisu_pdf.7.html b/data/doc/sisu/v3/html/sisu_pdf.7.html new file mode 100644 index 00000000..e2e41bda --- /dev/null +++ b/data/doc/sisu/v3/html/sisu_pdf.7.html @@ -0,0 +1,171 @@ + + + + + +"sisu_pdf"("1") manual page + + +Table of Contents

+ +

Name

+sisu - package to install what sisu needs to generate pdf (latex to +pdf dependency component) +

Synopsis

+sisu -pv [filename/wildcard ] SISU - PDF, +RALPH AMISSAH +

1. SISU PDF +

1.1 NAME +

SiSU - Structured information, Serialized +Units - a document publishing system. +

1.2 DESCRIPTION +

Information creating +pdf output with sisu (and related to the sisu_pdf dependency package, which +is a dummy package to install dependencies needed for SiSU to generate +pdfs (primarily related to LaTeX), sisu_pdf being part of SiSU - man sisu). + +

SiSU generates LaTeX which is converted by LaTeX tools to pdf. +

1.3 SYNOPSIS + +

sisu -pv  [filename/wildcard]
+ +

1.4 COMMANDS +

+

+ +
 sisu  -pv   [filename/wildcard]
+
creates two pdf documents: vertical +(portrait.pdf) and; horizontal (landscape.pdf). SiSU generates LaTeX output +which is converted to pdf if the appropriate LaTeX dependencies are met +on the system. +

+ +
 sisu  -pv  --papersize-a4   [filename/wildcard]
+
overrides the default +papersize set to A4. Preset alternative sizes include: ’A4’, U.S. ’letter’ and +’legal’ and book sizes ’A5’ and ’B5’ (system defaults to A4). +

+
+1.5 SETTING PAPER + +

SIZE +

The paper-size may be set to any of the following sizes: ’A4’, U.S. ’letter’ +and ’legal’ and book sizes: ’A5’ and ’B5’ +

1. The preset default if not otherwise +given in the configuration file or elsewhere is A4. +

2. The default paper +size may be set in the configuration file sisurc.yml. See sisu_configuration: + +

+


+

  #% papersize, (LaTeX/pdf) current values A4, US_letter, book_b5, book_a5,
+US_legal
+  default:
+    papersize:    ’A4’
+
+

3. Paper size may be set in a document header: +

+


+

  @papersize: (A4|US_letter|book_B5|book_A5|US_legal)
+
+

4. or provided with additional command line parameter, e.g. +

sisu -pv +--papersize-a4  [filename/wildcard]
+ +

DOCUMENT INFORMATION (METADATA) +

METADATA +

Document Manifest @ <http://sisudoc.org/sisu_manual/sisu_pdf/sisu_manifest.html +> + +

Dublin Core (DC) +

DC tags included with this document are provided here. + +

DC Title: SiSU - PDF +

DC Creator: Ralph Amissah +

DC Rights: Copyright +(C) Ralph Amissah 2007, part of SiSU documentation, License GPL 3 +

DC +Type: information +

DC Date created: 2002-08-28 +

DC Date issued: 2002-08-28 + +

DC Date available: 2002-08-28 +

DC Date modified: 2007-09-16 +

DC Date: 2007-09-16 + +

Version Information +

Sourcefile: sisu_pdf.sst +

Filetype: SiSU text 0.58 + +

Sourcefile Digest, MD5(sisu_pdf.sst)= bed13854370b5daf1b1541527e8946b7 + +

Skin_Digest: MD5(skin_sisu_manual.rb)= 20fc43cf3eb6590bc3399a1aef65c5a9 + +

Generated +

Document (metaverse) last generated: Sat Sep 29 17:05:37 + +

+0100 2007 +

Generated by: SiSU 0.59.1 of 2007w39/2 (2007-09-25) +

Ruby version: +ruby 1.8.6 (2007-06-07 patchlevel 36)  [i486-linux] +

+

+

+ +
Other versions of this +document:
+
+ +
manifest: <http://www.jus.uio.no/sisu/sisu_pdf/sisu_manifest.html + +> +
+
+ +
html: <http://www.jus.uio.no/sisu/sisu_pdf/toc.html + +>
+
+ +
pdf: <http://www.jus.uio.no/sisu/sisu_pdf/portrait.pdf + +> +
+
+ +
pdf: <http://www.jus.uio.no/sisu/sisu_pdf/landscape.pdf + +>
+
+ +
at: <http://www.jus.uio.no/sisu + +> +
+
+ +
* Generated by: SiSU 0.59.1 of 2007w39/2 (2007-09-25)
+
+ +
* Ruby version: ruby +1.8.6 (2007-06-07 patchlevel 36) [i486-linux]
+
+ +
* Last Generated on: Sat Sep 29 +17:05:39 +0100 2007
+
+ +
* SiSU http://www.jus.uio.no/sisu +
+
+
+

+ +


+Table of Contents

+

+ + diff --git a/data/doc/sisu/v3/html/sisu_postgresql.7.html b/data/doc/sisu/v3/html/sisu_postgresql.7.html new file mode 100644 index 00000000..6bc6be80 --- /dev/null +++ b/data/doc/sisu/v3/html/sisu_postgresql.7.html @@ -0,0 +1,198 @@ + + + + + +"sisu_postgresql"("1") manual page + + +Table of Contents

+ +

Name

+sisu - package to install what sisu needs to to populate a postgresql +database (postgresql dependency component) +

Synopsis

+sisu -Dv [filename/wildcard +] sisu -Dv [instruction] SISU - SEARCH, RALPH AMISSAH +

1. POSTGRESQL +

1.1 + +

NAME +

SiSU - Structured information, Serialized Units - a document publishing +system, postgresql dependency package +

1.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). +

+ +

1.3 SYNOPSIS +

sisu -D  [instruction]  [filename/wildcard  if  required]
+ +

sisu -D --pg --[instruction]  [filename/wildcard  if  required]
+ +

1.4 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. +

1.4.1 CREATE AND DESTROY DATABASE +

+

+ +
 --pgsql  --createall +
+
 initial  step,  creates  required  relations  (tables,  indexes)  in  existing + (postgresql)  database  (a  database  should  be  created (postgresql dependency +component) manually  and  given  the  same  name  as  working  directory,  as requested) + (rb.dbi) the  same  name  as  working  directory,  as +

+ +
 sisu  -D  --createdb
+
 creates + database  where  no  database  existed  before  as +

+ +
 sisu  -D  --create
+
 creates  database + tables  where  no  database  tables  existed before  database  tables  where  no + database  tables  existed +

+ +
 sisu  -D  --Dropall
+
 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).  a +

+ +
 sisu  -D  --recreate +
+
+

 destroys  existing  database  and  builds  a  new  empty  database  structure +

+
+1.4.2 + +

IMPORT AND REMOVE DOCUMENTS +

+

+ +
 sisu  -D  --import  -v   [filename/wildcard]
+
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] +
+
+

updates file contents in database +

+ +
 sisu  -D  --remove  -v   [filename/wildcard] +
+
removes specified document from postgresql database. +

+
+DOCUMENT INFORMATION +(METADATA) +

METADATA +

Document Manifest @ <http://sisudoc.org/sisu_manual/sisu_postgresql/sisu_manifest.html +> + +

Dublin Core (DC) +

DC tags included with this document are provided here. + +

DC Title: SiSU - Search +

DC Creator: Ralph Amissah +

DC Rights: Copyright +(C) Ralph Amissah 2007, part of SiSU documentation, License GPL 3 +

DC +Type: information +

DC Date created: 2002-08-28 +

DC Date issued: 2002-08-28 + +

DC Date available: 2002-08-28 +

DC Date modified: 2007-09-16 +

DC Date: 2007-09-16 + +

Version Information +

Sourcefile: sisu_postgresql.sst +

Filetype: SiSU + +

text 0.58 +

Sourcefile Digest, MD5(sisu_postgresql.sst)= 9010e85001c50e30ba2ab69f9097825a + +

Skin_Digest: MD5(skin_sisu_manual.rb)= 20fc43cf3eb6590bc3399a1aef65c5a9 + +

Generated +

Document (metaverse) last generated: Sat Sep 29 17:05:38 + +

+0100 2007 +

Generated by: SiSU 0.59.1 of 2007w39/2 (2007-09-25) +

Ruby version: +ruby 1.8.6 (2007-06-07 patchlevel 36)  [i486-linux] +

+

+

+ +
Other versions of this +document:
+
+ +
manifest: <http://www.jus.uio.no/sisu/sisu_postgresql/sisu_manifest.html + +> +
+
+ +
html: <http://www.jus.uio.no/sisu/sisu_postgresql/toc.html + +>
+
+ +
pdf: <http://www.jus.uio.no/sisu/sisu_postgresql/portrait.pdf + +> +
+
+ +
pdf: <http://www.jus.uio.no/sisu/sisu_postgresql/landscape.pdf + +>
+
+ +
at: <http://www.jus.uio.no/sisu + +> +
+
+ +
* Generated by: SiSU 0.59.1 of 2007w39/2 (2007-09-25)
+
+ +
* Ruby version: ruby +1.8.6 (2007-06-07 patchlevel 36) [i486-linux]
+
+ +
* Last Generated on: Sat Sep 29 +17:05:39 +0100 2007
+
+ +
* SiSU http://www.jus.uio.no/sisu +
+
+
+

+ +


+Table of Contents

+

+ + diff --git a/data/doc/sisu/v3/html/sisu_sqlite.7.html b/data/doc/sisu/v3/html/sisu_sqlite.7.html new file mode 100644 index 00000000..b6f8b59b --- /dev/null +++ b/data/doc/sisu/v3/html/sisu_sqlite.7.html @@ -0,0 +1,196 @@ + + + + + +"sisu_sqlite"("1") manual page + + +Table of Contents

+ +

Name

+sisu - package to install what sisu needs to to populate a postgresql +database (postgresql dependency component) +

Synopsis

+sisu -dv [filename/wildcard +] sisu -dv [instruction] SISU - SEARCH, RALPH AMISSAH +

1. SQLITE +

1.1 NAME + +

SiSU - Structured information, Serialized Units - a document publishing +system. +

1.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). +

1.3 SYNOPSIS +

sisu -d  [instruction] + [filename/wildcard  if  required]
+ +

sisu -d --(sqlite|pg) --[instruction]  [filename/wildcard  if
+ required]
+ +

1.4 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. +

1.4.1 CREATE AND DESTROY DATABASE +

+

+ +
 --sqlite  --createall +
+
 initial  step,  creates  required  relations  (tables,  indexes)  in  existing + (sqlite)  database  (a  database  should  be  created  as requested)  (rb.dbi) the + same  name  as  working  directory,  as +

+ +
 sisu  -d  --createdb
+
 creates  database  where + no  database  existed  before  as +

+ +
 sisu  -d  --create
+
 creates  database  tables  where + no  database  tables  existed before  database  tables  where  no  database  tables + existed +

+ +
 sisu  -d  --dropall
+
 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).  a +

+ +
 sisu  -d  --recreate
+
 destroys + +

 existing  database  and  builds  a  new  empty  database  structure +

+
+1.4.2 IMPORT + +

AND REMOVE DOCUMENTS +

+

+ +
 sisu  -d  --import  -v   [filename/wildcard]
+
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]
+
updates + +

file contents in database +

+ +
 sisu  -d  --remove  -v   [filename/wildcard]
+
removes +specified document from sqlite database. +

+
+DOCUMENT INFORMATION (METADATA) + +

METADATA +

Document Manifest @ <http://sisudoc.org/sisu_manual/sisu_sqlite/sisu_manifest.html +> + +

Dublin Core (DC) +

DC tags included with this document are provided here. + +

DC Title: SiSU - Search +

DC Creator: Ralph Amissah +

DC Rights: Copyright +(C) Ralph Amissah 2007, part of SiSU documentation, License GPL 3 +

DC +Type: information +

DC Date created: 2002-08-28 +

DC Date issued: 2002-08-28 + +

DC Date available: 2002-08-28 +

DC Date modified: 2007-09-16 +

DC Date: 2007-09-16 + +

Version Information +

Sourcefile: sisu_sqlite.sst +

Filetype: SiSU text + +

0.58 +

Sourcefile Digest, MD5(sisu_sqlite.sst)= c4717fcab8a43de498d41a916bb99551 + +

Skin_Digest: MD5(skin_sisu_manual.rb)= 20fc43cf3eb6590bc3399a1aef65c5a9 + +

Generated +

Document (metaverse) last generated: Sat Sep 29 17:05:38 + +

+0100 2007 +

Generated by: SiSU 0.59.1 of 2007w39/2 (2007-09-25) +

Ruby version: +ruby 1.8.6 (2007-06-07 patchlevel 36)  [i486-linux] +

+

+

+ +
Other versions of this +document:
+
+ +
manifest: <http://www.jus.uio.no/sisu/sisu_sqlite/sisu_manifest.html + +> +
+
+ +
html: <http://www.jus.uio.no/sisu/sisu_sqlite/toc.html + +>
+
+ +
pdf: <http://www.jus.uio.no/sisu/sisu_sqlite/portrait.pdf + +> +
+
+ +
pdf: <http://www.jus.uio.no/sisu/sisu_sqlite/landscape.pdf + +>
+
+ +
at: <http://www.jus.uio.no/sisu + +> +
+
+ +
* Generated by: SiSU 0.59.1 of 2007w39/2 (2007-09-25)
+
+ +
* Ruby version: ruby +1.8.6 (2007-06-07 patchlevel 36) [i486-linux]
+
+ +
* Last Generated on: Sat Sep 29 +17:05:39 +0100 2007
+
+ +
* SiSU http://www.jus.uio.no/sisu +
+
+
+

+ +


+Table of Contents

+

+ + diff --git a/data/doc/sisu/v3/html/sisu_termsheet.1.html b/data/doc/sisu/v3/html/sisu_termsheet.1.html new file mode 100644 index 00000000..061e097d --- /dev/null +++ b/data/doc/sisu/v3/html/sisu_termsheet.1.html @@ -0,0 +1,74 @@ + + + + + +sisu_termsheet(1) manual page + + +Table of Contents

+ +

Name

+SiSU - Structured information, Serialized Units - a document +publishing system +

Synopsis

+

+sisu -t [termsheet-name(s)] +

Description

+sisu_termsheet +is part of SiSU is invoked through the sisu command (man sisu)

+ +

Summary +of man page

+

+sisu_termsheet, is started with the command: sisu --termsheet +[termsheet-name(s)] +

Document Processing Command Flags

+

+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 SiSU output documents from the merged results.

+[further documentation +on termsheets required] +

Further Information

+

+For more information on SiSU +see: <http://www.jus.uio.no/sisu +>

+or man sisu +

Author

+Ralph Amissah <ralph@amissah.com> +or <ralph.amissah@gmail.com> +

See Also

+sisu(1) +, sisu(8) +, sisu_webrick(1) +, sisu_vim(7) + + +

+

Homepage

+More information about SiSU can be found at <http://www.jus.uio.no/sisu/ +>. + +

+

Author

+SiSU was written by Ralph Amissah <ralph@amissah.com>.

+ +


+Table of Contents

+

+ + diff --git a/data/doc/sisu/v3/html/sisu_vim.7.html b/data/doc/sisu/v3/html/sisu_vim.7.html new file mode 100644 index 00000000..f9e18237 --- /dev/null +++ b/data/doc/sisu/v3/html/sisu_vim.7.html @@ -0,0 +1,153 @@ + + + + + +"sisu_vim"("1") manual page + + +Table of Contents

+ +

Name

+ sisu_vim - vim syntax and folds file for sisu: markup, structuring, +publishing in multiple standard formats, and search
+ SISU - VIM, RALPH AMISSAH +

SISU VIM +

1. SISU VIM +

Synopsis +

SiSU has +syntax highlighting for a number of editors including vim which are documented +under: +

man sisu_syntax_highlighting
+ +

/usr/share/doc/sisu/sisu_manual/sisu_syntax_highlighting/index.html
+ +

<http://sisudoc.org/sisu_manual/sisu_syntax_highlighting/index.html +>
+ +

<http://www.jus.uio.no/sisu/sisu_manual/sisu_syntax_highlighting/index.html +>
+ +

SiSU also provides an ftplugin to provide vim folds for SiSU markup, +and to set some defaults for SiSU markup in installed by sisu. +

Vim 7 includes +sisu markup syntax highlighting. +

Vim related files are included in: /usr/share/sisu/conf/editor-syntax-etc/vim +(including the syntax highlighter, together with an ftplugin which may +be sourced if so desired from your vimrc). +

sisu-vim actions are activated +on files with the suffix .sst .ssm .ssi .-sst ._sst (and the same with a further +.meta extension)
+ +

+


+

  <ctrl>F activate folds on headings matched in a document
+  (also provides folds when sourced on a ruby program file),
+  also :F
+  <ctrl>S search and replace down
+  <ctrl>G search and replace globally within file
+  <ctrl>X ruby regex global search and replace within file
+  <ctrl>C set color scheme to slate which is provided
+
+

FURTHER INFORMATION +

For more information on SiSU see: +

<http://www.jus.uio.no/sisu +> + +

or man sisu +

DOCUMENT INFORMATION (METADATA) +

METADATA +

Document Manifest +@ <http://sisudoc.org/sisu_manual/sisu_vim/sisu_manifest.html +> +

Dublin Core +(DC) +

DC tags included with this document are provided here. +

DC Title: +SiSU - Vim +

DC Creator: Ralph Amissah +

DC Rights: Copyright (C) Ralph +Amissah 2008, part of SiSU documentation, License GPL 3 +

DC Type: information + +

DC Date created: 2002-11-12 +

DC Date issued: 2002-11-12 +

DC Date available: + +

2002-11-12 +

DC Date modified: 2008-02-12 +

DC Date: 2008-02-12 +

Version Information + +

Sourcefile: sisu_vim.sst +

Filetype: SiSU text insert 0.58 +

Sourcefile +Digest, MD5(sisu_vim.sst)= b5028f957b128162f7653bbd940042ca +

Skin_Digest: +MD5(skin_sisu_manual.rb)= 072b2584bedea82ea8a416587b9fa244 +

Generated +

+ Document (metaverse) last generated: Thu Feb 14 02:44:14 +0000 2008 +

+Generated by: SiSU 0.64.4 of 2008w06/4 (2008-02-14) +

Ruby version: ruby 1.8.6 +(2007-09-24 patchlevel 111)  [i486-linux] +

+

+

+ +
Other versions of this document: +
+
+ +
manifest: <http://www.jus.uio.no/sisu/sisu_vim/sisu_manifest.html + +>
+
+ +
html: <http://www.jus.uio.no/sisu/sisu_vim/toc.html + +> +
+
+ +
pdf: <http://www.jus.uio.no/sisu/sisu_vim/portrait.pdf + +>
+
+ +
pdf: <http://www.jus.uio.no/sisu/sisu_vim/landscape.pdf + +> +
+
+ +
at: <http://www.jus.uio.no/sisu + +>
+
+ +
* Generated by: SiSU 0.64.4 of 2008w06/4 (2008-02-14) +
+
+ +
* Ruby version: ruby 1.8.6 (2007-09-24 patchlevel 111) [i486-linux]
+
+ +
* Last Generated +on: Thu Feb 14 02:44:14 +0000 2008
+
+ +
* SiSU http://www.jus.uio.no/sisu +
+
+
+

+ +


+Table of Contents

+

+ + diff --git a/data/doc/sisu/v3/html/sisu_webrick.1.html b/data/doc/sisu/v3/html/sisu_webrick.1.html new file mode 100644 index 00000000..ddfb69ba --- /dev/null +++ b/data/doc/sisu/v3/html/sisu_webrick.1.html @@ -0,0 +1,91 @@ + + + + + +"sisu_webrick"("1") manual page + + +Table of Contents

+ +

Name

+sisu - documents: structuring, publishing in multiple formats, and search + +

Synopsis

+sisu -W SISU - SISU_WEBRICK, RALPH AMISSAH +

SISU WEBRICK +

1. SISU_WEBRICK + +

1.1 NAME +

SiSU - Structured information, Serialized Units - a document + +

publishing system +

1.2 SYNOPSIS +

sisu_webrick  [port] +

or +

sisu --Webrick + [port] +

or +

sisu -W  [port] +

1.3 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). +

1.4 SUMMARY OF MAN PAGE +

sisu_webrick, +may be started on it’s own with the command: sisu_webrick 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 +

1.5 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 +

1.6 FURTHER + +

INFORMATION +

For more information on SiSU see: <http://www.jus.uio.no/sisu +> + +

or man sisu +

1.7 AUTHOR +

Ralph Amissah ralph@amissah.com or ralph.amissah@gmail.com + +

1.8 SEE ALSO +

sisu(1) +
+ +

sisu_vim(7) +
+ +

sisu(8) +
+ +

+

Homepage

+More information about SiSU can be found at <http://www.jus.uio.no/sisu/ +>. + +

+

Author

+SiSU was written by Ralph Amissah <ralph@amissah.com>.

+ +


+Table of Contents

+

+ + diff --git a/data/doc/sisu/v3/markup-samples/README b/data/doc/sisu/v3/markup-samples/README new file mode 100644 index 00000000..0b78f4ab --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/README @@ -0,0 +1,101 @@ +A few sample books prepared as sisu markup samples, output formats to be +generated using SiSU are contained in a separate package sisu_markup_samples + +Online a few sample marked up documents, and their resulting outputs, can be +found at: + + + +The package sisu contains fewer sample documents, that are published under the +GPL or that are Debian Free Software Guideline license compatible, notably: + + Text: Free as in Freedom - Richard Stallman's Crusade for Free Software + URL: + Author: Sam Williams + Copyright: Sam Williams 2002 + 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 + URL: + +sisu_markup_samples contains gpl content and additional material released under +various licenses mostly different Creative Commons licences that do not permit +inclusion in the Debian Project as they do not meet the DFSG for various +reasons, most commonly in that they require the original substantive text me +maintained and often that the works be used only non-commercially + + Free as in Freedom - Richard Stallman's Crusade for Free Software, Sam Williams, [as above] + + Text: Free Culture - How Big Media Uses Technology and the Law to Lock Down Culture and Control Creativity + URL: + Author: Lawrence Lessig + URL: + Copyright: Lawrence Lessig, 2004 + License: + URL: + + Text: The Wealth of Networks - How Social Production Transforms Markets and Freedom + URL: + Author: Yochai Benkler + URL: + Copyright: 2006 Yochai Benkler + License: + URL: + + Text: Two Bits - The Cultural Significance of Free Software + URL: + Author: Christopher Kelty + URL: + Copyright: Duke University Press, 2008 + License: + URL: + + Text: Free For All - How Linux and the Free Software Movement Undercut the High Tech Titans + URL: + Author: Peter Wayner + URL: + Copyright: Peter Wayner, 2000 + License: + URL: + + Text: The Cathederal and the Bazaar + URL: + Author: Eric Raymond + URL: + Copyright: Eric S Raymond, 2000 + License: Open Publication License, v 2.0 + URL: + + Text: Little Brother + URL: + Author: Cory Doctorow + URL: + Copyright: Cory Doctorow, 2008 + License: + URL: + + Text: Accelerando + URL: + Author: Charles Stross + URL: + Copyright: Charles Stross, 2005 + License: + URL: + Note: The SiSU preparation (presentations) of Accelerando are done with the kind permission of the author Charles Stross + + Text: UN Contracts for International Sale of Goods + Author: UN, UNCITRAL + URL: + Copyright: + License: + +Most additional material contained in sisu_markup_samples were published under +various Creative Commons licenses, check the rights section of each document +for the copyright and license, or the COPYRIGHT file associated with the +package for a listing of material and their associated licenses. + +A few document more markup samples can be found at + + diff --git a/data/doc/sisu/v3/markup-samples/samples/_sisu/image/Gnu_Debian_Linux_Ruby_Way_Better.png b/data/doc/sisu/v3/markup-samples/samples/_sisu/image/Gnu_Debian_Linux_Ruby_Way_Better.png new file mode 100644 index 00000000..0f3f4a16 Binary files /dev/null and b/data/doc/sisu/v3/markup-samples/samples/_sisu/image/Gnu_Debian_Linux_Ruby_Way_Better.png differ diff --git a/data/doc/sisu/v3/markup-samples/samples/_sisu/image/b_doc.png b/data/doc/sisu/v3/markup-samples/samples/_sisu/image/b_doc.png new file mode 100644 index 00000000..13ca8ebe Binary files /dev/null and b/data/doc/sisu/v3/markup-samples/samples/_sisu/image/b_doc.png differ diff --git a/data/doc/sisu/v3/markup-samples/samples/_sisu/image/c_Copyleft.png b/data/doc/sisu/v3/markup-samples/samples/_sisu/image/c_Copyleft.png new file mode 100644 index 00000000..5b3865b8 Binary files /dev/null and b/data/doc/sisu/v3/markup-samples/samples/_sisu/image/c_Copyleft.png differ diff --git a/data/doc/sisu/v3/markup-samples/samples/_sisu/image/c_Euro.png b/data/doc/sisu/v3/markup-samples/samples/_sisu/image/c_Euro.png new file mode 100644 index 00000000..8e5c13a9 Binary files /dev/null and b/data/doc/sisu/v3/markup-samples/samples/_sisu/image/c_Euro.png differ diff --git a/data/doc/sisu/v3/markup-samples/samples/_sisu/image/debian_home.png b/data/doc/sisu/v3/markup-samples/samples/_sisu/image/debian_home.png new file mode 100644 index 00000000..cee42aa0 Binary files /dev/null and b/data/doc/sisu/v3/markup-samples/samples/_sisu/image/debian_home.png differ diff --git a/data/doc/sisu/v3/markup-samples/samples/_sisu/image/free_as_in_freedom.png b/data/doc/sisu/v3/markup-samples/samples/_sisu/image/free_as_in_freedom.png new file mode 100644 index 00000000..ad4c05b2 Binary files /dev/null and b/data/doc/sisu/v3/markup-samples/samples/_sisu/image/free_as_in_freedom.png differ diff --git a/data/doc/sisu/v3/markup-samples/samples/_sisu/image/free_as_in_freedom_01_rms.png b/data/doc/sisu/v3/markup-samples/samples/_sisu/image/free_as_in_freedom_01_rms.png new file mode 100644 index 00000000..3b4563b0 Binary files /dev/null and b/data/doc/sisu/v3/markup-samples/samples/_sisu/image/free_as_in_freedom_01_rms.png differ diff --git a/data/doc/sisu/v3/markup-samples/samples/_sisu/image/free_as_in_freedom_02_rms_snr_year_report.png b/data/doc/sisu/v3/markup-samples/samples/_sisu/image/free_as_in_freedom_02_rms_snr_year_report.png new file mode 100644 index 00000000..5d5a57aa Binary files /dev/null and b/data/doc/sisu/v3/markup-samples/samples/_sisu/image/free_as_in_freedom_02_rms_snr_year_report.png differ diff --git a/data/doc/sisu/v3/markup-samples/samples/_sisu/image/free_as_in_freedom_03_rms_st_ignucius.png b/data/doc/sisu/v3/markup-samples/samples/_sisu/image/free_as_in_freedom_03_rms_st_ignucius.png new file mode 100644 index 00000000..d84bf568 Binary files /dev/null and b/data/doc/sisu/v3/markup-samples/samples/_sisu/image/free_as_in_freedom_03_rms_st_ignucius.png differ diff --git a/data/doc/sisu/v3/markup-samples/samples/_sisu/image/free_as_in_freedom_04_rms_pleasure_card.png b/data/doc/sisu/v3/markup-samples/samples/_sisu/image/free_as_in_freedom_04_rms_pleasure_card.png new file mode 100644 index 00000000..2ab79e1c Binary files /dev/null and b/data/doc/sisu/v3/markup-samples/samples/_sisu/image/free_as_in_freedom_04_rms_pleasure_card.png differ diff --git a/data/doc/sisu/v3/markup-samples/samples/_sisu/image/levitating_gnu.png b/data/doc/sisu/v3/markup-samples/samples/_sisu/image/levitating_gnu.png new file mode 100644 index 00000000..9a25319a Binary files /dev/null and b/data/doc/sisu/v3/markup-samples/samples/_sisu/image/levitating_gnu.png differ diff --git a/data/doc/sisu/v3/markup-samples/samples/_sisu/image/philosophical_gnu.png b/data/doc/sisu/v3/markup-samples/samples/_sisu/image/philosophical_gnu.png new file mode 100644 index 00000000..ebd239ef Binary files /dev/null and b/data/doc/sisu/v3/markup-samples/samples/_sisu/image/philosophical_gnu.png differ diff --git a/data/doc/sisu/v3/markup-samples/samples/_sisu/image/sisu.png b/data/doc/sisu/v3/markup-samples/samples/_sisu/image/sisu.png new file mode 100644 index 00000000..b449fa6b Binary files /dev/null and b/data/doc/sisu/v3/markup-samples/samples/_sisu/image/sisu.png differ diff --git a/data/doc/sisu/v3/markup-samples/samples/_sisu/skin/dir/skin_sisu.rb b/data/doc/sisu/v3/markup-samples/samples/_sisu/skin/dir/skin_sisu.rb new file mode 100644 index 00000000..bd2e2a53 --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/samples/_sisu/skin/dir/skin_sisu.rb @@ -0,0 +1,99 @@ +# coding: utf-8 +=begin + * Name: SiSU information Structuring Universe - Structured information, Serialized Units + * Author: Ralph@Amissah.com + * http://www.jus.uio.no/sisu + * http://www.jus.uio.no/sisu/SiSU/download + * Description: Document skin for SiSU descriptive pages, ... + * License: Same as SiSU see http://www.jus.uio.no/sisu + * Notes: Site default appearance variables set in defaults.rb + Generic site wide modifications set here scribe_skin.rb, and this file required by other "scribes" instead of defaults.rb +=end +module SiSU_Viz + require SiSU_lib + '/defaults' + class Skin + #% widget + def widget_search + true + end + def widget_promo +#put s "#{__LINE__} #{__FILE__}" + #['sisu','ruby','sisu_search_libre','ruby','open_society'] + end + #% path + def path_root +#puts "#{__LINE__} #{__FILE__}" + './sisu/' # the only parameter that cannot be changed here + end + def path_rel +#puts "#{__LINE__} #{__FILE__}" + '../' + end + #% url + def url_home +#puts "#{__LINE__} #{__FILE__}" + 'http://www.jus.uio.no/sisu/' + end + def url_site # used in pdf header +#puts "#{__LINE__} #{__FILE__}" + 'http://www.jus.uio.no/sisu' + end + def url_txt # text to go with url usually stripped url +#puts "#{__LINE__} #{__FILE__}" + 'www.jus.uio.no/sisu/' + end + def url_home_url +#puts "#{__LINE__} #{__FILE__}" + '../index.html' + end + #def url_root_http + #root server path info, used in document information + #end + #% color + def color_band1 + '"#ffffff"' + end + def color_band2 + '"#ffffff"' + end + #% text + def text_hp + ' SiSU' + end + def text_home + 'SiSU' + end + #% icon + def icon_home_button + 'sisu.png' + end + def icon_home_banner + icon_home_button + end + #% banner + def banner_home_button + %{
#{png_home}
\n} + end + def banner_home_and_index_buttons + %{
#{png_home}#{table_close}
 This text sub- 
 Table of Contents 
#{table_close}
 #{table_close}} + end + def banner_band + %{
#{png_home}#{table_close}} + end + end + class TeX + def header_center + "\\chead{\\href{#{@vz.url_site}/}{www.jus.uio.no/sisu/}}" + end + def home_url + "\\href{#{@vz.url_site}/}{www.jus.uio.no/sisu/}" + end + def home + "\\href{#{@vz.url_site}/}{Ralph Amissah}" + end + def owner_chapter + 'Document owner details' + end + end +end +__END__ diff --git a/data/doc/sisu/v3/markup-samples/samples/_sisu/skin/doc/skin_gnu.rb b/data/doc/sisu/v3/markup-samples/samples/_sisu/skin/doc/skin_gnu.rb new file mode 100644 index 00000000..8ac38227 --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/samples/_sisu/skin/doc/skin_gnu.rb @@ -0,0 +1,88 @@ +# coding: utf-8 +=begin + * Name: SiSU - Simple information Structuring Universe - Structured information, Serialized Units + * Author: Ralph Amissah + * http://www.jus.uio.no/sisu + * http://www.jus.uio.no/sisu/SiSU/download + * Description: Free Software Foundation, Gnu sisu skin + * License: Same as SiSU see http://www.jus.uio.no/sisu + * Notes: Site default appearance variables set in defaults.rb + Generic site wide modifications set here scribe_skin.rb, and this file required by other "scribes" instead of defaults.rb +=end +module SiSU_Viz + require SiSU_lib + '/defaults' + class Skin + #% widget + def widget_promo + # ['sisu_icon','sisu','sisu_search_libre','open_society','fsf','ruby'] + end + #% home + def home_index + end + def home_toc + end + #% path + def path_root + './sisu/' # the only parameter that cannot be changed here + end + def path_rel + '../' + end + #% url + def url_home + 'http://www.fsf.org' + end + def url_site # used in pdf header + 'http://www.fsf.org' + end + def url_txt # text to go with url usually stripped url + 'www.fsf.org' + end + def url_home_url + '../index.html' + end + # color + def color_band1 + '"#000070"' + end + #% txt + def txt_hp + 'Free Software Foundation' + end + def txt_home # this should be the name of the site eg. Lex Mercatoria or if you prefer to see a url the url in text form copy & ... + #"www.jus.uio.no/sisu/" + 'Free Software Foundation' + end + #% icon + def icon_home_button + 'philosophical_gnu.png' + end + def icon_home_banner + icion_home_button + end + #% banner + def banner_home_button + %{
#{png_home}
\n} + end + def banner_home_and_index_buttons + %{
#{png_home}#{table_close}
 This text sub- 
 Table of Contents 
#{table_close}
 #{table_close}} + end + def banner_band + %{
#{png_home}#{table_close}} + end + end + class TeX + def header_center + "\\chead{\\href{#{@vz.url_site}/}{www.jus.uio.no/sisu/}}" + end + def home_url + "\\href{#{@vz.url_site}/}{www.fsf.org}" + end + def home + "\\href{#{@vz.url_site}/}{Free Software Foundation}" + end + def owner_chapter + "Document owner details" + end + end +end diff --git a/data/doc/sisu/v3/markup-samples/samples/_sisu/skin/doc/skin_rms.rb b/data/doc/sisu/v3/markup-samples/samples/_sisu/skin/doc/skin_rms.rb new file mode 100644 index 00000000..0f3e7d34 --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/samples/_sisu/skin/doc/skin_rms.rb @@ -0,0 +1,101 @@ +# coding: utf-8 +=begin + * Name: SiSU - Simple information Structuring Universe - Structured information, Serialized Units + * Author: Ralph Amissah + * http://www.jus.uio.no/sisu + * http://www.jus.uio.no/sisu/SiSU/download + * Description: Document skin used for Free as in Freedom + * License: Same as SiSU see http://www.jus.uio.no/sisu + * Notes: Site default appearance variables set in defaults.rb + Generic site wide modifications set here scribe_skin.rb, and this file required by other "scribes" instead of defaults.rb +=end +module SiSU_Viz + require "#{SiSU_lib}/defaults" + class Skin + #% promo + def promo_promo + ['sisu_icon','sisu','sisu_search_libre','open_society','fsf','ruby'] + end + ##% home + #def home_index + #end + #def home_toc + #end + ##% path + #def path_root # the only parameter that cannot be changed here + # './sisu/' + #end + #def path_rel + # '../' + #end + #% url + def url_home + 'http://www.gnu.org' + end + def url_site # used in pdf header + 'http://www.gnu.org' + end + def url_txt # text to go with url usually stripped url + 'www.gnu.org' + end + def url_home_url + '../index.html' + end + #def url_root_http + #root server path info, used in document information + #end + #% color + def color_band1 + '"#cccccc"' + #'"#000070"' + end + #% txt + def txt_hp + 'Free as in Freedom' + end + def txt_home # this should be the name of the site eg. Lex Mercatoria or if you prefer to see a url the url in text form copy & ... + #"www.jus.uio.no/sisu/" + 'Free as in Freedom' + end + #% icon + def icon_home_button + 'free_as_in_freedom.png' + end + def icon_home_banner + icon_home_button + end + #% banner + def banner_home_button + %{
#{png_home}
\n} + end + def banner_home_and_index_buttons + %{
#{png_home}#{table_close}
 This text sub- 
 Table of Contents 
#{table_close}
 #{table_close}} + end + def banner_band + %{ +
#{png_home}#{table_close}} + end + def banner_home_guide + end + #% credits + def insert_levitating_gnu #used locally this skin only + %{
RMS/FSF - Levitating Gnu -->
} + end + def credits_splash + %{
#{insert_levitating_gnu}
} + end + end + class TeX + def header_center + "\\chead{\\href{#{@vz.url_site}/}{www.jus.uio.no/sisu/}}" + end + def home_url + "\\href{#{@vz.url_site}/}{www.gnu.org}" + end + def home + "\\href{#{@vz.url_site}/}{GNU - Free Software Foundation}" + end + def owner_chapter + "Document owner details" + end + end +end diff --git a/data/doc/sisu/v3/markup-samples/samples/_sisu/skin/site/skin_sisu.rb b/data/doc/sisu/v3/markup-samples/samples/_sisu/skin/site/skin_sisu.rb new file mode 100644 index 00000000..bd2e2a53 --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/samples/_sisu/skin/site/skin_sisu.rb @@ -0,0 +1,99 @@ +# coding: utf-8 +=begin + * Name: SiSU information Structuring Universe - Structured information, Serialized Units + * Author: Ralph@Amissah.com + * http://www.jus.uio.no/sisu + * http://www.jus.uio.no/sisu/SiSU/download + * Description: Document skin for SiSU descriptive pages, ... + * License: Same as SiSU see http://www.jus.uio.no/sisu + * Notes: Site default appearance variables set in defaults.rb + Generic site wide modifications set here scribe_skin.rb, and this file required by other "scribes" instead of defaults.rb +=end +module SiSU_Viz + require SiSU_lib + '/defaults' + class Skin + #% widget + def widget_search + true + end + def widget_promo +#put s "#{__LINE__} #{__FILE__}" + #['sisu','ruby','sisu_search_libre','ruby','open_society'] + end + #% path + def path_root +#puts "#{__LINE__} #{__FILE__}" + './sisu/' # the only parameter that cannot be changed here + end + def path_rel +#puts "#{__LINE__} #{__FILE__}" + '../' + end + #% url + def url_home +#puts "#{__LINE__} #{__FILE__}" + 'http://www.jus.uio.no/sisu/' + end + def url_site # used in pdf header +#puts "#{__LINE__} #{__FILE__}" + 'http://www.jus.uio.no/sisu' + end + def url_txt # text to go with url usually stripped url +#puts "#{__LINE__} #{__FILE__}" + 'www.jus.uio.no/sisu/' + end + def url_home_url +#puts "#{__LINE__} #{__FILE__}" + '../index.html' + end + #def url_root_http + #root server path info, used in document information + #end + #% color + def color_band1 + '"#ffffff"' + end + def color_band2 + '"#ffffff"' + end + #% text + def text_hp + ' SiSU' + end + def text_home + 'SiSU' + end + #% icon + def icon_home_button + 'sisu.png' + end + def icon_home_banner + icon_home_button + end + #% banner + def banner_home_button + %{
#{png_home}
\n} + end + def banner_home_and_index_buttons + %{
+
#{png_home}#{table_close}
+
 This text sub- 
 Table of Contents 
#{table_close}
 #{table_close}} + end + def banner_band + %{ +
#{png_home}#{table_close}} + end + end + class TeX + def header_center + "\\chead{\\href{#{@vz.url_site}/}{www.jus.uio.no/sisu/}}" + end + def home_url + "\\href{#{@vz.url_site}/}{www.jus.uio.no/sisu/}" + end + def home + "\\href{#{@vz.url_site}/}{Ralph Amissah}" + end + def owner_chapter + 'Document owner details' + end + end +end +__END__ diff --git a/data/doc/sisu/v3/markup-samples/samples/_sisu/skin/yml/list.yml b/data/doc/sisu/v3/markup-samples/samples/_sisu/skin/yml/list.yml new file mode 100644 index 00000000..388ef360 --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/samples/_sisu/skin/yml/list.yml @@ -0,0 +1,27 @@ +sisu: + site: + - sisu +open_society: + site: + - vs + - twon + - fc + - content + - di + - faif + - twobits + - ffa + - catb + - littlebrother +sisu_icon: + site: + - sisu_icon +fsf: + site: + - fsf +gpl: + site: + - gpl +sisu_search_libre: + search: + - sisu_books_libre_sisusearch diff --git a/data/doc/sisu/v3/markup-samples/samples/_sisu/skin/yml/promo.yml b/data/doc/sisu/v3/markup-samples/samples/_sisu/skin/yml/promo.yml new file mode 100644 index 00000000..8fc37137 --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/samples/_sisu/skin/yml/promo.yml @@ -0,0 +1,215 @@ +# Author: ralph@amissah.com +site: + sisu_icon: + url: SiSU + image: sisu.png + blurb: ~ + sisu: + title: SiSU + url: index.html + blurb: ~ + links: + - + title: What does SiSU do? Summary + url: SiSU/1.html#summary + - + title: SiSU Book Samples and Markup Examples + url: SiSU/examples.html + - + title: Manual + url: http://sisudoc.org/sisu/sisu_manual/ + - + title: Markup + url: http://sisudoc.org/sisu/sisu_markup/ + - + title: Commands + url: http://sisudoc.org/sisu/sisu_commands/ + - + title: SiSU Download + url: SiSU/download.html + - + title: SiSU Changelog + url: SiSU/changelog.html + blurb: ~ + - + title: output by Author + url: sisu_site_metadata/harvest_authors.html + - + title: output by Topic + url: sisu_site_metadata/harvest_topics.html + - + title: Wikipedia entry + url: http://en.wikipedia.org/wiki/SiSU + blurb: ~ + - + title: Freshmeat + url: http://freshmeat.net/projects/sisu/ + - + title: Ruby Application Archive + url: http://raa.ruby-lang.org/project/sisu/ + vs: + title: Viral Spiral + subtitle: How the Commoners Built a Digital Republic of Their Own + author: David Bollier + year: 2009 + url: viral_spiral.david_bollier + links: + - + title: Source Wiki + url: http://viralspiral.cc/ + twon: + title: The Wealth of Networks + subtitle: How Social Production Transforms Markets and Freedom + author: Yochai Benkler + year: 2006 + url: the_wealth_of_networks.yochai_benkler + links: + - + title: Wikipedia entry + url: http://en.wikipedia.org/wiki/The_Wealth_of_Networks + - + title: Source Wiki + url: http://www.benkler.org/wealth_of_networks/index.php/Main_Page + fc: + title: Free Culture + subtitle: How Big Media Uses Technology and the Law to Lock Down Culture and Control Creativity + author: Lawrence Lessig + year: 2004 + url: free_culture.lawrence_lessig + links: + - + title: Wikipedia entry + url: http://en.wikipedia.org/wiki/Free_Culture_%28book%29 + - + title: Creative Commons + url: http://creativecommons.org/ + - + title: Source + url: http://www.free-culture.cc/ + di: + title: Democratizing Innovation + author: Eric von Hippel + year: 2005 + url: democratizing_innovation.eric_von_hippel + links: + - + title: Wikipedia entry + url: http://en.wikipedia.org/wiki/Democratizing_Innovation + - + title: Source + url: http://web.mit.edu/evhippel/www/democ1.htm + faif: + title: Free As In Freedom + subtitle: Richard Stallman's Crusade for Free Software + author: Sam Williams + year: 2002 + url: free_as_in_freedom.richard_stallman_crusade_for_free_software.sam_williams + links: + - + title: Wikipedia entry + url: http://en.wikipedia.org/wiki/Free_as_in_Freedom:_Richard_Stallman%27s_Crusade_for_Free_Software + - + title: Source + url: http://faifzilla.org/ + - + title: FSF + url: http://www.fsf.org/ + - + title: FSF Wikipedia + url: http://en.wikipedia.org/wiki/Free_Software_Foundation + - + title: GPL + url: http://www.gnu.org/copyleft/gpl.html + - + title: GPL Wikipedia + url: http://en.wikipedia.org/wiki/GNU_General_Public_License + twobits: + title: Two Bits + subtitle: The Cultural Significance of Free Software + author: Christopher Kelty + year: 2008 + url: two_bits.christopher_kelty + links: + - + title: Home + url: http://twobits.net + ffa: + title: Free For All + subtitle: How Linux and the Free Software Movement Undercut the High Tech Titans + author: Peter Wayner + year: 2002 + url: free_for_all.peter_wayner + links: + - + title: Source + url: http://www.wayner.org/books/ffa/ + catb: + title: The Cathedral & the Bazaar + subtitle: Musings on Linux and Open Source by an Accidental Revolutionary + author: Erik S. Raymond + year: 1999 + url: the_cathedral_and_the_bazaar.eric_s_raymond + links: + - + title: Wikipedia entry + url: http://en.wikipedia.org/wiki/Cathedral_and_the_bazaar + - + title: Source + url: http://www.catb.org/~esr/writings/cathedral-bazaar/cathedral-bazaar/ + fsf: + title: Free Software Foundation + subtitle: FSF + url: http://www.fsf.org/ + links: + - + title: Wikipedia entry + url: http://en.wikipedia.org/wiki/Free_Software_Foundation + - + title: GPL + subtitle: GNU General Public License + url: http://www.gnu.org/copyleft/gpl.html + gpl: + title: GNU General Public License + subtitle: GPL + url: http://www.gnu.org/copyleft/gpl.html + links: + - + title: Wikipedia entry + url: http://en.wikipedia.org/wiki/GNU_General_Public_License + - + title: GPL 3 + url: http://gplv3.fsf.org/ + - + title: Software License List + url: http://www.fsf.org/licensing/licenses/ + content: + title: CONTENT + subtitle: Selected Essays on Technology, Creativity, Copyright and the Future of the Future + author: Cory Doctorow + year: 2008 + url: content.cory_doctorow + links: + - + title: Home + url: http://craphound.com/content + - + title: Wikipedia entry + url: http://en.wikipedia.org/wiki/Cory_Doctorow + littlebrother: + title: Little Brother + author: Cory Doctorow + year: 2008 + url: little_brother.cory_doctorow + links: + - + title: Home + url: http://craphound.com/littlebrother + - + title: Wikipedia entry + url: http://en.wikipedia.org/wiki/Little_Brother_(Cory_Doctorow_novel) +search: + sisu_books_libre_sisusearch: + type: sisusearch + action: http://search.sisudoc.org + target: _top + db: sisu diff --git a/data/doc/sisu/v3/markup-samples/samples/_sisu/skin/yml/skin_countries.yml b/data/doc/sisu/v3/markup-samples/samples/_sisu/skin/yml/skin_countries.yml new file mode 100644 index 00000000..274e19fa --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/samples/_sisu/skin/yml/skin_countries.yml @@ -0,0 +1,481 @@ +# arch-tag: yaml country list +# Author: Ralph@Amissah.com +# License: Same as SiSU see http://www.jus.uio.no/sisu +id: AF + name: Afghanistan +id: AL + name: Albania +id: DZ + name: Algeria +id: AS + name: American Samoa +id: AD + name: Andorra +id: AO + name: Angola +id: AI + name: Anguilla +id: AQ + name: Antarctica +id: AG + name: Antigua and Barbuda +id: AR + name: Argentina +id: AM + name: Armenia +id: AW + name: Aruba +id: AU + name: Australia +id: AT + name: Austria +id: AZ + name: Azerbaijan +id: BS + name: Bahamas +id: BH + name: Bahrain +id: BD + name: Bangladesh +id: BB + name: Barbados +id: BY + name: Belarus +id: BE + name: Belgium +id: BZ + name: Belize +id: BJ + name: Benin +id: BM + name: Bermuda +id: BT + name: Bhutan +id: BO + name: Bolivia +id: BA + name: Bosnia and Herzegovina +id: BW + name: Botswana +id: BV + name: Bouvet Island +id: BR + name: Brazil +id: IO + name: British Indian Ocean Territory +id: BN + name: Brunei Darussalam +id: BG + name: Bulgaria +id: BF + name: Burkina Faso +id: BI + name: Burundi +id: KH + name: Cambodia +id: CM + name: Cameroon +id: CA + name: Canada +id: CV + name: Cape Verde +id: KY + name: Cayman Islands +id: CF + name: Central African Republic +id: TD + name: Chad +id: CL + name: Chile +id: CN + name: China +id: CX + name: Christmas Island +id: CC + name: Cocos (Keeling) Islands +id: CO + name: Colombia +id: KM + name: Comoros +id: CG + name: Congo +id: CK + name: Cook Islands +id: CR + name: Costa Rica +id: HR + name: Croatia (Hrvatska) +id: CU + name: Cuba +id: CY + name: Cyprus +id: CZ + name: Czech Republic +id: CS + name: Czechoslovakia +id: DK + name: Denmark +id: DJ + name: Djibouti +id: DM + name: Dominica +id: DO + name: Dominican Republic +id: TP + name: East Timor +id: EC + name: Ecuador +id: EG + name: Egypt +id: SV + name: El Salvador +id: GQ + name: Equatorial Guinea +id: ER + name: Eritrea +id: EE + name: Estonia +id: ET + name: Ethiopia +id: FK + name: Falkland Islands (Malvinas) +id: FO + name: Faroe Islands +id: FJ + name: Fiji +id: FI + name: Finland +id: FR + name: France +id: FX + name: France, Metroplitan +id: GF + name: French Guiana +id: PF + name: French Polynesia +id: TF + name: French Southern Territories +id: GA + name: Gabon +id: GM + name: Gambia +id: GE + name: Georgia +id: DE + name: Germany +id: GH + name: Ghana +id: GI + name: Gibraltar +id: GB + name: Great Britain (UK) +id: GR + name: Greece +id: GL + name: Greenland +id: GD + name: Grenada +id: GP + name: Guadeloupe +id: GU + name: Guam +id: GT + name: Guatemala +id: GN + name: Guinea +id: GW + name: Guinea-Bissau +id: GY + name: Guyana +id: HT + name: Haiti +id: HM + name: Heard and McDonald Islands +id: HN + name: Honduras +id: HK + name: Hong Kong +id: HU + name: Hungary +id: IS + name: Iceland +id: IN + name: India +id: ID + name: Indonesia +id: IR + name: Iran +id: IQ + name: Iraq +id: IE + name: Ireland +id: IL + name: Israel +id: IT + name: Italy +id: CI + name: Ivory Coast +id: JM + name: Jamaica +id: JP + name: Japan +id: JO + name: Jordan +id: KZ + name: Kazakhstan +id: KE + name: Kenya +id: KI + name: Kiribati +id: KP + name: Korea (North) +id: KR + name: Korea (South) +id: KW + name: Kuwait +id: KG + name: Kyrgyzstan +id: LA + name: Laos +id: LV + name: Latvia +id: LB + name: Lebanon +id: LS + name: Lesotho +id: LR + name: Liberia +id: LY + name: Libya +id: LI + name: Liechtenstein +id: LT + name: Lithuania +id: LU + name: Luxembourg +id: MO + name: Macau +id: ME + name: Macedonia +id: MG + name: Madagascar +id: MW + name: Malawi +id: MY + name: Malaysia +id: MV + name: Maldives +id: ML + name: Mali +id: MT + name: Malta +id: MB + name: Marshall Islands +id: MQ + name: Martinique +id: MR + name: Mauritania +id: MU + name: Mauritius +id: YT + name: Mayotte +id: MX + name: Mexico +id: FM + name: Micronesia +id: MD + name: Moldova +id: MC + name: Monaco +id: MN + name: Mongolia +id: MS + name: Montserrat +id: MA + name: Morocco +id: MZ + name: Mozambique +id: MM + name: Myanmar +id: NA + name: Namibia +id: NR + name: Nauru +id: NP + name: Nepal +id: NL + name: Netherlands +id: AN + name: Netherlands Antilles +id: NT + name: Neutral Zone +id: NC + name: New Caledonia +id: NZ + name: New Zealand (Aotearoa) +id: NI + name: Nicaragua +id: NE + name: Niger +id: NG + name: Nigeria +id: NU + name: Niue +id: NF + name: Norfolk Island +id: MP + name: Northern Mariana Islands +id: NO + name: Norway +id: OM + name: Oman +id: 00 + name: Other +id: PK + name: Pakistan +id: PW + name: Palau +id: PA + name: Panama +id: PG + name: Papua New Guinea +id: PY + name: Paraguay +id: PE + name: Peru +id: PH + name: Philippines +id: PN + name: Pitcairn +id: PL + name: Poland +id: PT + name: Portugal +id: PR + name: Puerto Rico +id: QA + name: Qatar +id: RE + name: Reunion +id: RO + name: Romania +id: RU + name: Russian Federation +id: RW + name: Rwanda +id: GS + name: S. Georgia and S. Sandwich Isls. +id: KN + name: Saint Kitts and Nevis +id: LC + name: Saint Lucia +id: VC + name: Saint Vincent and the Grenadines +id: WS + name: Samoa +id: SM + name: San Marino +id: ST + name: Sao Tome and Principe +id: SA + name: Saudi Arabia +id: SN + name: Senegal +id: SC + name: Seychelles +id: SL + name: Sierra Leone +id: SG + name: Singapore +id: SK + name: Slovak Republic +id: SI + name: Slovenia +id: SB + name: Solomon Islands +id: SO + name: Somalia +id: ZA + name: South Africa +id: ES + name: Spain +id: LK + name: Sri Lanka +id: SH + name: St. Helena +id: PM + name: St. Pierre and Miquelon +id: SD + name: Sudan +id: SR + name: Suriname +id: SJ + name: Svalbard and Jan Mayen Islands +id: SZ + name: Swaziland +id: SE + name: Sweden +id: CH + name: Switzerland +id: SY + name: Syria +id: TW + name: Taiwan +id: TJ + name: Tajikistan +id: TZ + name: Tanzania +id: TH + name: Thailand +id: TG + name: Togo +id: TK + name: Tokelau +id: TO + name: Tonga +id: TT + name: Trinidad and Tobago +id: TN + name: Tunisia +id: TR + name: Turkey +id: TM + name: Turkmenistan +id: TC + name: Turks and Caicos Islands +id: TV + name: Tuvalu +id: UM + name: US Minor Outlying Islands +id: SU + name: USSR (former) +id: UG + name: Uganda +id: UA + name: Ukraine +id: AE + name: United Arab Emirates +id: UK + name: United Kingdom +id: US + name: United States +id: UY + name: Uruguay +id: UZ + name: Uzbekistan +id: VU + name: Vanuatu +id: VA + name: Vatican City State (Holy See) +id: VE + name: Venezuela +id: VN + name: Viet Nam +id: VG + name: Virgin Islands (British) +id: VI + name: Virgin Islands (U.S.) +id: WF + name: Wallis and Futuna Islands +id: EH + name: Western Sahara diff --git a/data/doc/sisu/v3/markup-samples/samples/_sisu/skin/yml/skin_country.yml b/data/doc/sisu/v3/markup-samples/samples/_sisu/skin/yml/skin_country.yml new file mode 100644 index 00000000..dc835465 --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/samples/_sisu/skin/yml/skin_country.yml @@ -0,0 +1,735 @@ +# arch-tag: yaml country list array +# Author: Ralph@Amissah.com +# License: Same as SiSU see http://www.jus.uio.no/sisu +- + - AF + - Afghanistan +- + - AL + - Albania +- + - DZ + - Algeria +- + - AS + - American Samoa +- + - AD + - Andorra +- + - AO + - Angola +- + - AI + - Anguilla +- + - AQ + - Antarctica +- + - AG + - Antigua and Barbuda +- + - AR + - Argentina +- + - AM + - Armenia +- + - AW + - Aruba +- + - AU + - Australia +- + - AT + - Austria +- + - AZ + - Azerbaijan +- + - BS + - Bahamas +- + - BH + - Bahrain +- + - BD + - Bangladesh +- + - BB + - Barbados +- + - BY + - Belarus +- + - BE + - Belgium +- + - BZ + - Belize +- + - BJ + - Benin +- + - BM + - Bermuda +- + - BT + - Bhutan +- + - BO + - Bolivia +- + - BA + - Bosnia and Herzegovina +- + - BW + - Botswana +- + - BV + - Bouvet Island +- + - BR + - Brazil +- + - IO + - British Indian Ocean Territory +- + - BN + - Brunei Darussalam +- + - BG + - Bulgaria +- + - BF + - Burkina Faso +- + - BI + - Burundi +- + - KH + - Cambodia +- + - CM + - Cameroon +- + - CA + - Canada +- + - CV + - Cape Verde +- + - KY + - Cayman Islands +- + - CF + - Central African Republic +- + - TD + - Chad +- + - CL + - Chile +- + - CN + - China +- + - CX + - Christmas Island +- + - CC + - Cocos (Keeling) Islands +- + - CO + - Colombia +- + - KM + - Comoros +- + - CG + - Congo +- + - CK + - Cook Islands +- + - CR + - Costa Rica +- + - HR + - Croatia (Hrvatska) +- + - CU + - Cuba +- + - CY + - Cyprus +- + - CZ + - Czech Republic +- + - CS + - Czechoslovakia (former) +- + - DK + - Denmark +- + - DJ + - Djibouti +- + - DM + - Dominica +- + - DO + - Dominican Republic +- + - TP + - East Timor +- + - EC + - Ecuador +- + - EG + - Egypt +- + - SV + - El Salvador +- + - GQ + - Equatorial Guinea +- + - ER + - Eritrea +- + - EE + - Estonia +- + - ET + - Ethiopia +- + - FK + - Falkland Islands (Malvinas) +- + - FO + - Faroe Islands +- + - FJ + - Fiji +- + - FI + - Finland +- + - FR + - France +- + - FX + - France, Metropolitan +- + - GF + - French Guiana +- + - PF + - French Polynesia +- + - TF + - French Southern Territories +- + - GA + - Gabon +- + - GM + - Gambia +- + - GE + - Georgia +- + - DE + - Germany +- + - GH + - Ghana +- + - GI + - Gibraltar +- + - GB + - Great Britain (UK) +- + - GR + - Greece +- + - GL + - Greenland +- + - GD + - Grenada +- + - GP + - Guadeloupe +- + - GU + - Guam +- + - GT + - Guatemala +- + - GN + - Guinea +- + - GW + - Guinea-Bissau +- + - GY + - Guyana +- + - HT + - Haiti +- + - HM + - Heard and McDonald Islands +- + - HN + - Honduras +- + - HK + - Hong Kong +- + - HU + - Hungary +- + - IS + - Iceland +- + - IN + - India +- + - ID + - Indonesia +- + - IR + - Iran +- + - IQ + - Iraq +- + - IE + - Ireland +- + - IL + - Israel +- + - IT + - Italy +- + - CI + - Ivory Coast +- + - JM + - Jamaica +- + - JP + - Japan +- + - JO + - Jordan +- + - KZ + - Kazakhstan +- + - KE + - Kenya +- + - KI + - Kiribati +- + - KP + - Korea (North) +- + - KR + - Korea (South) +- + - KW + - Kuwait +- + - KG + - Kyrgyzstan +- + - LA + - Laos +- + - LV + - Latvia +- + - LB + - Lebanon +- + - LS + - Lesotho +- + - LR + - Liberia +- + - LY + - Libya +- + - LI + - Liechtenstein +- + - LT + - Lithuania +- + - LU + - Luxembourg +- + - MO + - Macau +- + - ME + - Macedonia +- + - MG + - Madagascar +- + - MW + - Malawi +- + - MY + - Malaysia +- + - MV + - Maldives +- + - ML + - Mali +- + - MT + - Malta +- + - MB + - Marshall Islands +- + - MQ + - Martinique +- + - MR + - Mauritania +- + - MU + - Mauritius +- + - YT + - Mayotte +- + - MX + - Mexico +- + - FM + - Micronesia +- + - MD + - Moldova +- + - MC + - Monaco +- + - MN + - Mongolia +- + - MS + - Montserrat +- + - MA + - Morocco +- + - MZ + - Mozambique +- + - MM + - Myanmar +- + - NA + - Namibia +- + - NR + - Nauru +- + - NP + - Nepal +- + - NL + - Netherlands +- + - AN + - Netherlands Antilles +- + - NT + - Neutral Zone +- + - NC + - New Caledonia +- + - NZ + - New Zealand (Aotearoa) +- + - NI + - Nicaragua +- + - NE + - Niger +- + - NG + - Nigeria +- + - NU + - Niue +- + - NF + - Norfolk Island +- + - MP + - Northern Mariana Islands +- + - 'NO' + - Norway +- + - OM + - Oman +- + - '00' + - Other +- + - PK + - Pakistan +- + - PW + - Palau +- + - PA + - Panama +- + - PG + - Papua New Guinea +- + - PY + - Paraguay +- + - PE + - Peru +- + - PH + - Philippines +- + - PN + - Pitcairn +- + - PL + - Poland +- + - PT + - Portugal +- + - PR + - Puerto Rico +- + - QA + - Qatar +- + - RE + - Reunion +- + - RO + - Romania +- + - RU + - Russian Federation +- + - RW + - Rwanda +- + - GS + - S. Georgia and S. Sandwich Isls. +- + - KN + - Saint Kitts and Nevis +- + - LC + - Saint Lucia +- + - VC + - Saint Vincent and the Grenadines +- + - WS + - Samoa +- + - SM + - San Marino +- + - ST + - Sao Tome and Principe +- + - SA + - Saudi Arabia +- + - SN + - Senegal +- + - SC + - Seychelles +- + - SL + - Sierra Leone +- + - SG + - Singapore +- + - SK + - Slovak Republic +- + - SI + - Slovenia +- + - SB + - Solomon Islands +- + - SO + - Somalia +- + - ZA + - South Africa +- + - ES + - Spain +- + - LK + - Sri Lanka +- + - SH + - St. Helena +- + - PM + - St. Pierre and Miquelon +- + - SD + - Sudan +- + - SR + - Suriname +- + - SJ + - Svalbard and Jan Mayen Islands +- + - SZ + - Swaziland +- + - SE + - Sweden +- + - CH + - Switzerland +- + - SY + - Syria +- + - TW + - Taiwan +- + - TJ + - Tajikistan +- + - TZ + - Tanzania +- + - TH + - Thailand +- + - TG + - Togo +- + - TK + - Tokelau +- + - TO + - Tonga +- + - TT + - Trinidad and Tobago +- + - TN + - Tunisia +- + - TR + - Turkey +- + - TM + - Turkmenistan +- + - TC + - Turks and Caicos Islands +- + - TV + - Tuvalu +- + - UM + - US Minor Outlying Islands +- + - SU + - USSR (former) +- + - UG + - Uganda +- + - UA + - Ukraine +- + - AE + - United Arab Emirates +- + - UK + - United Kingdom +- + - US + - United States +- + - UY + - Uruguay +- + - UZ + - Uzbekistan +- + - VU + - Vanuatu +- + - VA + - Vatican City State (Holy See) +- + - VE + - Venezuela +- + - VN + - Viet Nam +- + - VG + - Virgin Islands (British) +- + - VI + - Virgin Islands (U.S.) +- + - WF + - Wallis and Futuna Islands +- + - EH + - Western Sahara +- + - YE + - Yemen +- + - YU + - Yugoslavia +- + - ZR + - Zaire +- + - ZM + - Zambia +- + - ZW + - Zimbabwe diff --git a/data/doc/sisu/v3/markup-samples/samples/free_as_in_freedom.richard_stallman_crusade_for_free_software.sam_williams.sst b/data/doc/sisu/v3/markup-samples/samples/free_as_in_freedom.richard_stallman_crusade_for_free_software.sam_williams.sst new file mode 100644 index 00000000..213c76e7 --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/samples/free_as_in_freedom.richard_stallman_crusade_for_free_software.sam_williams.sst @@ -0,0 +1,2484 @@ +% SiSU 2.0 + +@title: Free as in Freedom + :subtitle: Richard Stallman's Crusade for Free Software + +@creator: Williams, Sam + +@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;copyright;GNU/Linux:GPL|copyleft|free software;free software;Software:Software Libré;GPL;Linux:GNU|Software Libré;book:biography;programming + :oclc: 49044520 + :isbn: 9780596002879 + +@date: + :published: 2002 + +@notes: March 2002 + +@links: + { Home and Source }http://faifzilla.org/ + {Free as in Freedom (on Richard Stallman), Sam Williams @ SiSU}http://www.jus.uio.no/sisu/free_as_in_freedom.richard_stallman_crusade_for_free_software.sam_williams + {@ 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 + {Viral Spiral, David Bollier@ SiSU}http://www.jus.uio.no/sisu/viral_spiral.david_bollier + {Democratizing Innovation, Eric von Hippel @ SiSU}http://www.jus.uio.no/sisu/democratizing_innovation.eric_von_hippel + {The Wealth of Networks, Yochai Benkler @ SiSU}http://www.jus.uio.no/sisu/the_wealth_of_networks.yochai_benkler + {Two Bits, Christopher Kelty @ SiSU}http://www.jus.uio.no/sisu/two_bits.christopher_kelty + {Free For All, Peter Wayner @ SiSU}http://www.jus.uio.no/sisu/free_for_all.peter_wayner + {The Cathedral and the Bazaar, Eric S. Raymond @ SiSU }http://www.jus.uio.no/sisu/the_cathedral_and_the_bazaar.eric_s_raymond + {Free Culture, Lawrence Lessig @ SiSU}http://www.jus.uio.no/sisu/free_culture.lawrence_lessig + {CONTENT, Cory Doctorow @ SiSU}http://www.jus.uio.no/sisu/content.cory_doctorow + {Little Brother, Cory Doctorow @ SiSU}http://www.jus.uio.no/sisu/little_brother.cory_doctorow + +@make: + :skin: skin_rms + :breaks: new=:A,:B,:C,1 + +: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:
_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. +={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/v3/markup-samples/samples/sisu_output_overview.ssi b/data/doc/sisu/v3/markup-samples/samples/sisu_output_overview.ssi new file mode 100644 index 00000000..e2c90529 --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/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/v3/markup-samples/sisu_manual/_sisu/image/GnuDebianLinuxRubyBetterWay.png b/data/doc/sisu/v3/markup-samples/sisu_manual/_sisu/image/GnuDebianLinuxRubyBetterWay.png new file mode 100644 index 00000000..ce5b8830 Binary files /dev/null and b/data/doc/sisu/v3/markup-samples/sisu_manual/_sisu/image/GnuDebianLinuxRubyBetterWay.png differ diff --git a/data/doc/sisu/v3/markup-samples/sisu_manual/_sisu/image/sisu.home.png b/data/doc/sisu/v3/markup-samples/sisu_manual/_sisu/image/sisu.home.png new file mode 100644 index 00000000..b449fa6b Binary files /dev/null and b/data/doc/sisu/v3/markup-samples/sisu_manual/_sisu/image/sisu.home.png differ diff --git a/data/doc/sisu/v3/markup-samples/sisu_manual/_sisu/image/sisu.png b/data/doc/sisu/v3/markup-samples/sisu_manual/_sisu/image/sisu.png new file mode 100644 index 00000000..b449fa6b Binary files /dev/null and b/data/doc/sisu/v3/markup-samples/sisu_manual/_sisu/image/sisu.png differ diff --git a/data/doc/sisu/v3/markup-samples/sisu_manual/_sisu/image/tux.png b/data/doc/sisu/v3/markup-samples/sisu_manual/_sisu/image/tux.png new file mode 100644 index 00000000..15fd152b Binary files /dev/null and b/data/doc/sisu/v3/markup-samples/sisu_manual/_sisu/image/tux.png differ diff --git a/data/doc/sisu/v3/markup-samples/sisu_manual/_sisu/sisurc.yml b/data/doc/sisu/v3/markup-samples/sisu_manual/_sisu/sisurc.yml new file mode 100644 index 00000000..2b3df4db --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/sisu_manual/_sisu/sisurc.yml @@ -0,0 +1,172 @@ +# Name: SiSU - Simple information Structuring Universe +# Author: Ralph@Amissah.com +# Description: Site wide envionment defaults set here +# system environment info / resource configuration file, for sisu +# License: GPL v3 or later +# this file should be configured and live in +# /etc/sisu #per environment settings, overridden by: +# ~/.sisu #per user settings, overridden by: +# ./_sisu/config #per local directory settings +# $Date$ +# $Id$ +# Notes: implemented 2004w03 +# Site environment configuration file +# this file should be configured and live in +# /etc/sisu #per environment settings, overridden by: +# ~/.sisu #per user settings, overridden by: +# ./_sisu #per local markup directory settings +#% #image source directory, main path and subdirectories +#image: +## path: 'grotto/theatre/working' +# path: 'sisu_working' +# public: 'sisu_image' +# #all: 'image' +#% presentation/web directory, main path and subdirectories (most subdirectories are created automatically based on markup directory name) +webserv: + url_root: 'http://www.jus.uio.no' #without dir stub, e.g. this dir would map to http://www.jus.uio.no/sisu + path: '/var/www' #either (i) / [full path from root] or (ii) ~/ [home] or (iii) ./ [pwd] or (iv) will be made from home + #images: 'sisu/image' + #man: 'man' + #php: 'php' + #cgi: '/usr/local/lib/sisu-cgi' + feed: 'feed' + sqlite: 'sisu/sqlite' +# webrick_url: true +#show_output_on: 'filesystem' #for -v and -u url information, alternatives: 'filesystem','webserver','remote_webserver','local:8111','localhost','localhost:8080','webrick','path' +#show_output_on: 'local:8111' +webserv_cgi: +# host: localhost +# base_path: ~ +# port: '8081' +# user: ~ + file_links: webserv +# file_links: www.jus.uio.no +show_output_on: 'filesystem_url' +#texinfo display output +#texinfo: +# stub: 'texinfo' +#% processing directories, main path and subdirectories +processing: +# path: 'sisu_processing' +# metaverse: 'metaverse' +# tune: 'tune' +# latex: 'tex' +# texinfo: 'texinfo' +# concord_max: 400000 +#% flag - set (non-default) processing flag shortcuts -1, -2 etc. (here adding colour and verbosity as default) +flag: + color: true # making colour default -c is toggle, and will now toggle colour off + default: '-NhewpoabxXyYv' # includes verbose; -m would in any event be run by default + i: '-Nhewpoayv' # includes verbose; -m run by default + ii: '-NhewpoabxXyv' # includes verbose; -m run by default + iii: '-NhewpoabxXyYv' # includes verbose; -m run by default + iv: '-NhewpoabxXYDyv --import' # includes verbose; -m run by default + v: '-NhewpoabxXYDyv --update' # includes verbose; -m run by default +#flag: +# color: false # colour off default -c is toggle, and will toggle colour on +# i: '-mhwpcyv' # adding colour and verbosity to defaults (note: another -c won't toggle off) +# ii: '-mhwpaocyv' # adding colour and verbosity to defaults (note: another -c won't toggle off) +# iii: '-mhwpaobxXcyv' # adding colour and verbosity to defaults (note: another -c won't toggle off) +# iv: '-mhwpaobxXDcyv --import' # adding colour and verbosity to defaults (note: another -c won't toggle off) +# v: '-mhwpaobxXDcyv --update' # adding colour and verbosity to defaults (note: another -c won't toggle off) +#% papersize, (LaTeX/pdf) current values A4, US_letter, book_b5, book_a5, US_legal, easily extensible +default: + #papersize: 'a4,letter' + papersize: 'A4' + language_file: 2 + #digest: 'sha' #sha is sha256, default is md5 + #multilingual: false + #language: 'English' +#% settings used by ssh scp +remote: + user: 'ralpha' + host: 'ulrik.uio.no' + #host: 'klodrik.uio.no' + path: '.' #no trailing slash eg 'sisu/www' +#% webrick information +#sql database info, postgresql and sqlite +db: + postgresql: + port: '5432' # '5432' + #user: 'tst' # '[provide username]' + #host: 'sisudoc.org' + #password: 'alternate1' + #user: 'ralph' + ##port: '5433' + #port: '5432' + sqlite: + user: 'ralph' + path: ~ # './sisu_sqlite.db' + port: "**" + multi: true +# single: true +#% possible values ~, true, false, or command instruction e.g. editor: 'gvim -c :R -c :S'. +#will only ignore if value set to false, absence or nil will not remove program as should operate without rc file +#ie in case of ~ will ignore and use hard coded defaults within program), true, false, or command instruction e.g. editor: 'gvim -c :R -c :S' +#on value true system defaults used, to change, e.g. editor specify +permission_set: + zap: true + css_modify: true + remote_base_site: true +program_set: + rmagick: true + wc: true + editor: true + postgresql: true + sqlite: true + tidy: true + rexml: true + pdflatex: true +program_select: + editor: 'gvim -c :R' + pdf_viewer: 'evince' + web_browser: 'kazehakase' + console_web_browser: 'links2' + odf_viewer: 'oowriter' + xml_viewer: 'xml-viewer' +search: + sisu: + flag: true +# action: http://localhost:8081/cgi-bin/sisu_pgsql.cgi + action: http://search.sisudoc.org + db: sisu + title: sample search form + hyperestraier: + flag: true + action: http://search.sisudoc.org/cgi-bin/estseek.cgi? +promo: sisu_search_libre, sisu_icon, sisu, open_society, fsf, ruby +#promo: sisu_search_libre, ad, sisu_icon, sisu, open_society, fsf, ruby +#promo: ad, sisu_icon, sisu, sisu_search_libre, open_society, fsf, ruby +## on (unless file says off); off (unless file says on); off regardless of file status +#promo: +# default_status: true +# switch_off: false +# list: +# ad: +# adsense: +# sisu: +# site: +# - sisu +# open_society: +# site: +# - twon +# - fc +# - faif +# - twobits +# # - ffa +# - catb +# sisu_icon: +# site: +# - sisu_icon +# ruby: +# site: +# - ruby_logo +# fsf: +# site: +# - fsf +# gpl: +# site: +# - gpl +# sisu_search_libre: +# search: +# - sisu_books_libre_sisusearch diff --git a/data/doc/sisu/v3/markup-samples/sisu_manual/_sisu/skin/dir/skin_sisu.rb b/data/doc/sisu/v3/markup-samples/sisu_manual/_sisu/skin/dir/skin_sisu.rb new file mode 120000 index 00000000..77ee1e13 --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/sisu_manual/_sisu/skin/dir/skin_sisu.rb @@ -0,0 +1 @@ +../doc/skin_sisu.rb \ No newline at end of file diff --git a/data/doc/sisu/v3/markup-samples/sisu_manual/_sisu/skin/yml/list.yml b/data/doc/sisu/v3/markup-samples/sisu_manual/_sisu/skin/yml/list.yml new file mode 100644 index 00000000..0d4235ab --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/sisu_manual/_sisu/skin/yml/list.yml @@ -0,0 +1,30 @@ +sisu_manual: + site: + - sisu_manual +sisu: + site: + - sisu +open_society: + site: + - twon + - fc + - faif + - twobits + - ffa + - catb + - littlebrother +sisu_icon: + site: + - sisu_icon +ruby: + site: + - ruby_logo +fsf: + site: + - fsf +gpl: + site: + - gpl +sisu_search_libre: + search: + - sisu_books_libre_sisusearch diff --git a/data/doc/sisu/v3/markup-samples/sisu_manual/_sisu/skin/yml/promo.yml b/data/doc/sisu/v3/markup-samples/sisu_manual/_sisu/skin/yml/promo.yml new file mode 100644 index 00000000..2971ff81 --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/sisu_manual/_sisu/skin/yml/promo.yml @@ -0,0 +1,166 @@ +# Author: ralph@amissah.com +search: + sisu_books_libre_sisusearch: + type: sisusearch + db: sisu +site: + sisu_icon: + url: SiSU + image: sisu.png + blurb: ~ + sisu: + title: SiSU + url: index.html + blurb: ~ + links: + - + title: What does SiSU do? Summary + url: SiSU/1.html#summary + - + title: SiSU Book Samples and Markup Examples + url: SiSU/examples.html + - + title: SiSU Download + url: SiSU/download.html + - + title: SiSU Changelog + url: SiSU/changelog.html + blurb: ~ + - + title: output by Author + url: sisu_site_metadata/harvest_authors.html + - + title: output by Topic + url: sisu_site_metadata/harvest_topics.html + - + title: Wikipedia entry + url: http://en.wikipedia.org/wiki/SiSU + blurb: ~ + - + title: Freshmeat + url: http://freshmeat.net/projects/sisu/ + - + title: Ruby Application Archive + url: http://raa.ruby-lang.org/project/sisu/ + twon: + title: The Wealth of Networks + subtitle: How Social Production Transforms Markets and Freedom + author: Yochai Benkler + year: 2006 + url: the_wealth_of_networks.yochai_benkler + links: + - + title: Wikipedia entry + url: http://en.wikipedia.org/wiki/The_Wealth_of_Networks + - + title: Source Wiki + url: http://www.benkler.org/wealth_of_networks/index.php/Main_Page + fc: + title: Free Culture + subtitle: How Big Media Uses Technology and the Law to Lock Down Culture and Control Creativity + author: Lawrence Lessig + year: 2004 + url: free_culture.lawrence_lessig + links: + - + title: Wikipedia entry + url: http://en.wikipedia.org/wiki/Free_Culture_%28book%29 + - + title: Creative Commons + url: http://creativecommons.org/ + - + title: Source + url: http://www.free-culture.cc/ + faif: + title: Free As In Freedom + subtitle: Richard Stallman's Crusade for Free Software + author: Sam Williams + year: 2002 + url: free_as_in_freedom.richard_stallman_crusade_for_free_software.sam_williams + links: + - + title: Wikipedia entry + url: http://en.wikipedia.org/wiki/Free_as_in_Freedom:_Richard_Stallman%27s_Crusade_for_Free_Software + - + title: Source + url: http://faifzilla.org/ + - + title: FSF + url: http://www.fsf.org/ + - + title: FSF Wikipedia + url: http://en.wikipedia.org/wiki/Free_Software_Foundation + - + title: GPL + url: http://www.gnu.org/copyleft/gpl.html + - + title: GPL Wikipedia + url: http://en.wikipedia.org/wiki/GNU_General_Public_License + twobits: + title: Two Bits + subtitle: The Cultural Significance of Free Software + author: Christopher Kelty + year: 2008 + url: two_bits.christopher_kelty + links: + - + title: Home + url: http://twobits.net + ffa: + title: Free For All + subtitle: How Linux and the Free Software Movement Undercut the High Tech Titans + author: Peter Wayner + year: 2002 + url: free_for_all.peter_wayner + links: + - + title: Source + url: http://www.wayner.org/books/ffa/ + catb: + title: The Cathedral & the Bazaar + subtitle: Musings on Linux and Open Source by an Accidental Revolutionary + author: Erik S. Raymond + year: 1999 + url: the_cathedral_and_the_bazaar.eric_s_raymond + links: + - + title: Wikipedia entry + url: http://en.wikipedia.org/wiki/Cathedral_and_the_bazaar + - + title: Source + url: http://www.catb.org/~esr/writings/cathedral-bazaar/cathedral-bazaar/ + fsf: + title: Free Software Foundation + subtitle: FSF + url: http://www.fsf.org/ + links: + - + title: Wikipedia entry + url: http://en.wikipedia.org/wiki/Free_Software_Foundation + - + title: GPL + subtitle: GNU General Public License + url: http://www.gnu.org/copyleft/gpl.html + gpl: + title: GNU General Public License + subtitle: GPL + url: http://www.gnu.org/copyleft/gpl.html + links: + - + title: Wikipedia entry + url: http://en.wikipedia.org/wiki/GNU_General_Public_License + - + title: GPL 3 + url: http://gplv3.fsf.org/ + - + title: Software License List + url: http://www.fsf.org/licensing/licenses/ + littlebrother: + title: Little Brother + author: Cory Doctorow + year: 2008 + url: little_brother.cory_doctorow + links: + - + title: Home + url: http://craphound.com/littlebrother diff --git a/data/doc/sisu/v3/markup-samples/sisu_manual/sisu.ssm b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu.ssm new file mode 100644 index 00000000..c162db3f --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu.ssm @@ -0,0 +1,103 @@ +% SiSU master 2.0 + +@title: SiSU + :subtitle: Manual + +@creator: :author: Amissah, Ralph + +@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-07-07 + +@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 [-abcDdFehIiMmNnopqRrSsTtUuVvwXxYyZz0-9] [filename/wildcard] . sisu [-Ddcv] [instruction] [filename/wildcard] . sisu [-CcFLSVvW] . sisu --v2 [operations] . sisu --v1 [operations] + +@links: + { SiSU Manual }http://www.jus.uio.no/sisu/sisu_manual/ + { Book Samples and Markup Examples }http://www.jus.uio.no/sisu/SiSU/examples.html + { SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU + { SiSU @ Freshmeat }http://freshmeat.net/projects/sisu/ + { SiSU @ Ruby Application Archive }http://raa.ruby-lang.org/project/sisu/ + { SiSU @ Debian }http://packages.qa.debian.org/s/sisu.html + { SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html + { SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html + { SiSU help }http://www.jus.uio.no/sisu/sisu_manual/sisu_help/ + { SiSU help sources }http://www.jus.uio.no/sisu/sisu_manual/sisu_help_sources/ + +: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 and Skins + +<< sisu_config.ssi + +<< sisu_skin.sst + +<< 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_hyperestraier.ssi + +<< sisu_webrick.sst + +<< sisu_remote.sst + +<< sisu_quickstart.sst + +<< sisu_syntax_highlighting.sst + +<< sisu_how.ssi + +<< sisu_short_feature_summary.ssi + +<< sisu_help_sources.sst diff --git a/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_commands.sst b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_commands.sst new file mode 100644 index 00000000..d32c9dad --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_commands.sst @@ -0,0 +1,365 @@ +% SiSU 2.0 + +@title: SiSU + :subtitle: Commands + +@creator: + :author: Amissah, Ralph + +@rights: + :copyright: Copyright (C) Ralph Amissah 2007, part of SiSU documentation, License GPL 3 + +@classify: + :type: information + :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 + +% used_by: sisu_manual SiSU.ssm + +@date: + :created: 2002-08-28 + :issued: 2002-08-28 + :available: 2002-08-28 + :published: 2007-09-16 + :modified: 2010-09-17 + +@make: + :num_top: 1 + :breaks: new=C; break=1 + :skin: skin_sisu_manual + :bold: /Gnu|Debian|Ruby|SiSU/ + +@links: + { SiSU Manual }http://www.jus.uio.no/sisu/sisu_manual/ + { Book Samples and Markup Examples }http://www.jus.uio.no/sisu/SiSU/examples.html + { SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU + { SiSU @ Freshmeat }http://freshmeat.net/projects/sisu/ + { SiSU @ Ruby Application Archive }http://raa.ruby-lang.org/project/sisu/ + { SiSU @ Debian }http://packages.qa.debian.org/s/sisu.html + { SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html + { SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html + { SiSU help }http://www.jus.uio.no/sisu/sisu_manual/sisu_help/ + { SiSU help sources }http://www.jus.uio.no/sisu/sisu_manual/sisu_help_sources/ + +:A~? @title @creator + +:B~? SiSU Commands + +1~commands Commands Summary + +2~ Description + +SiSU SiSU is a document publishing system, that from a simple single marked-up document, produces multiple of output formats including: plaintext, html, xhtml, XML, epub, odt (odf text), LaTeX, pdf, info, and SQL (PostgreSQL and SQLite), which share numbered text objects ("object citation numbering") and the same document structure information. For more see: 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 + +!_ --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 + +!_ --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 + +!_ -C [--init-site]
+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
+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. + +!_ -c [filename/wildcard]
+see --color-toggle + +!_ --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 + +!_ -D [instruction] [filename]
+see --pg + +!_ -d [--db-[database type (sqlite|pg)]] --[instruction] [filename]
+see --sqlite + +!_ --epub [filename/wildcard]
+produces an epub document, [sisu version 2 only] (filename.epub). Alias -e + +!_ -e [filename/wildcard]
+see --epub + +!_ -F [--webserv=webrick]
+see --sample-search-form + +!_ --git [filename/wildcard]
+produces or updates markup source file structure in a git repo (experimental and subject to change). Alias -g + +!_ -g [filename/wildcard]
+see --git + +!_ --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 + +!_ -h [filename/wildcard]
+see --html + +!_ -I [filename/wildcard]
+see --texinfo + +!_ -i [filename/wildcard]
+see --manpage + +!_ -L
+prints license information. + +!_ --machine [filename/wildcard/url]
+see --dal (document abstraction level/layer) + +!_ --maintenance [filename/wildcard/url]
+maintenance mode files created for processing preserved and their locations indicated. (also see -V). Alias -M + +!_ --manpage [filename/wildcard]
+produces man page of file, not suitable for all outputs. Alias -i + +!_ -M [filename/wildcard/url]
+see --maintenance + +!_ -m [filename/wildcard/url]
+see --dal (document abstraction level/layer) + +!_ --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. + +!_ -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. + +!_ --odf [filename/wildcard/url]
+see --odt + +!_ --odt [filename/wildcard/url]
+output basic document in opendocument file format (opendocument.odt). Alias -o + +!_ -o [filename/wildcard/url]
+see --odt + +!_ --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 + +!_ -p [filename/wildcard]
+see --pdf + +!_ --quiet [filename/wildcard]
+quiet less output to screen. + +!_ -q [filename/wildcard]
+see --quiet + +!_ --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 + +!_ -R [filename/wildcard]
+see --rsync + +!_ -r [filename/wildcard]
+see --scp + +!_ --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). -Fv (in addition to the above) provides some information on setting up hyperestraier for sisu. 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 default set to sqlite, (for which --sqlite may be used instead) or to specify another database --db-[pgsql, sqlite] (however see -D) 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 + +!_ -S
+see --sisupod + +!_ -S [filename/wildcard]
+see --sisupod + +!_ -s [filename/wildcard]
+see --source + +!_ --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 + +!_ -T [filename/wildcard (*.termsheet.rb)]
+standard form document builder, preprocessing feature + +!_ -t [filename/wildcard]
+see --txt + +!_ --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 + +!_ -U [filename/wildcard]
+see --urls + +!_ -u [filename/wildcard]
+provides url mapping of output files for the flags requested for processing, also see -U + +!_ --v1 [filename/wildcard]
+invokes the sisu v1 document parser/generator. For use with sisu v1 markup documents. (Markup conversion to v2 involves the modification of document headers) + +!_ --v2 [filename/wildcard]
+invokes the sisu v2 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 + +!_ -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 + +!_ --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 + +!_ -W
+see --webrick + +!_ --wordmap [filename/wildcard]
+see --concordance + +!_ -w [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. + +!_ --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 + +!_ -Z [filename/wildcard]
+see --zap + +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 (note that the defaults can be changed/configured in the sisurc.yml file): + +!_ -0
+-mNhwpAobxXyYv [this is the default action run when no options are give, i.e. on 'sisu [filename]'] + +!_ -1
+-mhewpy + +!_ -2
+-mhewpaoy + +!_ -3
+-mhewpAobxXyY + +!_ -4
+-mhewpAobxXDyY --import + +!_ -5
+-mhewpAobxXDyY --update + +add -v for verbose mode and -c for color, 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/v3/markup-samples/sisu_manual/sisu_config.ssi b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_config.ssi new file mode 100644 index 00000000..b7370b4c --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_config.ssi @@ -0,0 +1,80 @@ +% SiSU insert 2.0 + +@title: SiSU + :subtitle: Configuration + +@creator: :author: Amissah, Ralph + +@rights: Copyright (C) Ralph Amissah 2007, part of SiSU documentation, License GPL 3 + +% used_by: sisu_manual + +@classify: + :type: information + :subject: ebook, epublishing, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, search + +@date: + :published: 2007-09-16 + :created: 2002-08-28 + :issued: 2002-08-28 + :available: 2002-08-28 + :modified: 2009-12-16 + +@make: + :num_top: 1 + :breaks: new=C; break=1 + :skin: skin_sisu_manual + :bold: /Gnu|Debian|Ruby|SiSU/ + +@links: + { SiSU Manual }http://www.jus.uio.no/sisu/sisu_manual/ + { Book Samples and Markup Examples }http://www.jus.uio.no/sisu/SiSU/examples.html + { SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU + { SiSU @ Freshmeat }http://freshmeat.net/projects/sisu/ + { SiSU @ Ruby Application Archive }http://raa.ruby-lang.org/project/sisu/ + { SiSU @ Debian }http://packages.qa.debian.org/s/sisu.html + { SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html + { SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html + { SiSU help }http://www.jus.uio.no/sisu/sisu_manual/sisu_help/ + { SiSU help sources }http://www.jus.uio.no/sisu/sisu_manual/sisu_help_sources/ + +:A~? Configuration + +:B~? Configure Environment + +1~config Configuration + +2~ Determining the Current Configuration + +Information on the current configuration of SiSU should be available with the help command: + +_1 sisu -v + +which is an alias for: + +_1 sisu --help env + +Either of these should be executed from within a directory that contains sisu markup source documents. + +2~ Configuration files (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/sisurc.yml + +_1 ~/.sisu/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 + diff --git a/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_content_directories.ssi b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_content_directories.ssi new file mode 100644 index 00000000..11590de2 --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_content_directories.ssi @@ -0,0 +1,141 @@ +% SiSU insert 2.0 + +@title: SiSU + :subtitle: Content Directories, Organising Content + +@creator: :author: Amissah, Ralph + +@rights: Copyright (C) Ralph Amissah 2007, part of SiSU documentation, License GPL 3 + +% used_by: sisu_manual + +@classify: + :type: information + :subject: ebook, epublishing, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, search + +@date: + :created: 2002-08-28 + :issued: 2002-08-28 + :available: 2007-08-28 + :published: 2007-09-16 + :modified: 2009-12-16 + +@make: + :num_top: 1 + :breaks: new=C; break=1 + :skin: skin_sisu_manual + :bold: /Gnu|Debian|Ruby|SiSU/ + +@links: + { SiSU Manual }http://www.jus.uio.no/sisu/sisu_manual/ + { Book Samples and Markup Examples }http://www.jus.uio.no/sisu/SiSU/examples.html + { SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU + { SiSU @ Freshmeat }http://freshmeat.net/projects/sisu/ + { SiSU @ Ruby Application Archive }http://raa.ruby-lang.org/project/sisu/ + { SiSU @ Debian }http://packages.qa.debian.org/s/sisu.html + { SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html + { SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html + { SiSU help }http://www.jus.uio.no/sisu/sisu_manual/sisu_help/ + { SiSU help sources }http://www.jus.uio.no/sisu/sisu_manual/sisu_help_sources/ + +:A~? Organisation of Content + +:B~? Content Directories + +1~organising_content Organising Content + +2~ Directory Structure and Mapping + +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~ General Directories + +code{ + +./subject_name/ + +% files stored at this level e.g. sisu_manual.sst + +./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~ 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/v3/markup-samples/sisu_manual/sisu_css.ssi b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_css.ssi new file mode 100644 index 00000000..5ef419f1 --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_css.ssi @@ -0,0 +1,63 @@ +% SiSU insert 2.0 + +@title: SiSU + :subtitle: CSS - Cascading Style Sheets + +@creator: :author: Amissah, Ralph + +@rights: Copyright (C) Ralph Amissah 2007, part of SiSU documentation, License GPL 3 + +% used_by: sisu_manual + +@classify: + :type: information + :subject: ebook, epublishing, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, search + +@date: + :created: 2007-08-28 + :issued: 2007-08-28 + :available: 2007-08-28 + :published: 2007-09-16 + :modified: 2009-12-16 + +@make: + :num_top: 1 + :breaks: new=C; break=1 + :skin: skin_sisu_manual + :bold: /Gnu|Debian|Ruby|SiSU/ + +@links: + { SiSU Manual }http://www.jus.uio.no/sisu/sisu_manual/ + { Book Samples and Markup Examples }http://www.jus.uio.no/sisu/SiSU/examples.html + { SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU + { SiSU @ Freshmeat }http://freshmeat.net/projects/sisu/ + { SiSU @ Ruby Application Archive }http://raa.ruby-lang.org/project/sisu/ + { SiSU @ Debian }http://packages.qa.debian.org/s/sisu.html + { SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html + { SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html + { SiSU help }http://www.jus.uio.no/sisu/sisu_manual/sisu_help/ + { SiSU help sources }http://www.jus.uio.no/sisu/sisu_manual/sisu_help_sources/ + +: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, and change the default CSS file that is looked for in a skin.~{ 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/v3/markup-samples/sisu_manual/sisu_description.sst b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_description.sst new file mode 100644 index 00000000..fe3b5c46 --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_description.sst @@ -0,0 +1,564 @@ +% SiSU 2.0 + +@title: SiSU - SiSU information Structuring Universe / Structured information, Serialized Units + :subtitle: Description + +@creator: :author: Amissah, Ralph + +@classify: + :type: information + :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 + +% SiSU.ssm + +@rights: Copyright (C) Ralph Amissah 2007, part of SiSU documentation, License GPL 3 + +@date: + :created: 2002-11-12 + :issued: 2002-11-12 + :available: 2002-11-12 + :published: 2007-08-30 + :modified: 2009-12-16 + +@make: + :num_top: 1 + :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 + +@links: + {What does SiSU do? Summary}../SiSU/1.html#summary + {Book Samples and Markup Examples}../SiSU/examples.html + {SiSU Markup Syntax}../sample + {*Citation System* Object Citation Numbering}../SiSU/1.html#citation + {*Granular Search*}../SiSU/1.html#search + {The Chart (pdf)}../diagram/sisu.chart.pdf + {Accompanying Diagrams}../diagram/sisu_provisional_patent_application_diagram_200408.pdf + {Standard}../SiSU/standard.html + {License}../SiSU/license.html + {man pages}../SiSU/3.html#man + {SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU + {SiSU @ Freshmeat}http://freshmeat.net/projects/sisu/ + {SiSU @ Ruby Application Archive }http://raa.ruby-lang.org/project/sisu/ + {SiSU @ Debian}http://packages.qa.debian.org/s/sisu.html + {Download}../SiSU/download.html + {Changelog}../SiSU/changelog.html + +: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 for information on this version. Dates related to the development of SiSU are mostly contained within the Chronology section of this document, e.g. 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, ODF (OpenDocument), 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. + +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. }~ + +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; + +_* 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 is 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 (ext3, Reiserfs, XFS, whatever) 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/sample/markup/un_contracts_international_sale_of_goods_convention_1980.sst ~{ http://www.jus.uio.no/sisu/sample/markup/un_contracts_international_sale_of_goods_convention_1980.sst output provided as example in the next section }~ + +_* { view basic markup, as it would be highlighted by vim editor }http://www.jus.uio.no/sisu/sample/syntax/un_contracts_international_sale_of_goods_convention_1980.sst.html ~{ http://www.jus.uio.no/sisu/sample/syntax/un_contracts_international_sale_of_goods_convention_1980.sst.html as it would appear with syntax highlighting (by vim) }~ + +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/sample/markup/un_contracts_international_sale_of_goods_convention_1980.sst + +_* {~^ view as syntax would be highlighted by vim editor }http://www.jus.uio.no/sisu/sample/syntax/un_contracts_international_sale_of_goods_convention_1980.sst.html + +Produces the following output: + +_* {~^ 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 + +_* {~^ pdf landscape version of document }http://www.jus.uio.no/sisu/un_contracts_international_sale_of_goods_convention_1980/landscape.pdf + +_* {~^ pdf portrait version of document }http://www.jus.uio.no/sisu/un_contracts_international_sale_of_goods_convention_1980/portrait.pdf + +_* {~^ clean tex ascii version of document }http://www.jus.uio.no/sisu/un_contracts_international_sale_of_goods_convention_1980/plain.txt + +_* {~^ /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 + +_* {~^ 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_table/doc.html#h200306
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. + +Directory wide skins. + +Directory specific images. + +# If there is a "directory skin", that is a skin of the same name as the directory, it is used in the generation of the documents within it, rather than the default skin, unless the document has a specific skin associated with it. + +_# default skin (always available) + +_# directory skin (precedence over default if exists) + +_# document skin (takes precedence wherever document requests a specific skin) + +Skins are defined in the document skin directory and if a directory association is desired a softlink made to the relevant skin. Skins (directory association auto load) auto load skin if a directory skin exists of same name as directory stub, (and there is no specific doc skin) + +# 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
The Unidroit Contract Principles http://www.jus.uio.no/lm/unidroit.contract.principles.1994/doc or
The Autonomous Contract http://www.jus.uio.no/lm/autonomous.contract.2000.amissah/doc }~ 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/sisu/un_contracts_international_sale_of_goods_convention_1980
The Unidroit Principles http://www.jus.uio.no/lm/unidroit.contract.principles.1994
The Autonomous Contract http://www.jus.uio.no/sisu/the.autonomous.contract.2000.amissah 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?s1=Linux%2BOR%2BDebian&lang=En&db=SiSU_sisu&view=index&a=1 + +{ GPL OR Richard Stallman }http://search.sisudoc.org?s1=GPL%2BOR%2BRichard%2BStallman&lang=En&db=SiSU_sisu&view=index&a=1 + +{ invention OR innovation in English language }http://search.sisudoc.org?s1=invention%2BOR%2Binnovation&lang=En&db=SiSU_sisu&view=index&a=1 + +{ copyright in English language documents }http://search.sisudoc.org?s1=copyright&lang=En&db=SiSU_sisu&view=index&a=1 + +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?s1=Linux%2BOR%2BDebian&lang=En&db=SiSU_sisu&view=text&a=1 + +{ GPL OR Richard Stallman }http://search.sisudoc.org?s1=GPL%2BOR%2BRichard%2BStallman&lang=En&db=SiSU_sisu&view=text&a=1 + +{ invention OR innovation in English language }http://search.sisudoc.org?s1=invention%2BOR%2Binnovation&lang=En&db=SiSU_sisu&view=text&a=1 + +{ copyright in English language documents }http://search.sisudoc.org?s1=copyright&lang=En&db=SiSU_sisu&view=text&a=1 + +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.jus.uio.no/sisu/syntax_highlight. {~^ 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/v3/markup-samples/sisu_manual/sisu_download.ssi b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_download.ssi new file mode 100644 index 00000000..b71ddbca --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_download.ssi @@ -0,0 +1,163 @@ +% SiSU insert 2.0 + +@title: SiSU - SiSU information Structuring Universe / Structured information, Serialized Units + :subtitle: Download, Stable and Development Branches + +@creator: :author: Amissah, Ralph + +% used_by: SiSU.ssm + +@classify: + :type: information + :subject: ebook, epublishing, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, search + +@date: + :created: 2002-11-12 + :issued: 2002-11-12 + :available: 2002-11-12 + :published: 2009-01-18 + :modified: 2010-06-11 + +@make: + :num_top: 1 + :breaks: new=C; break=1 + :skin: skin_sisu + :bold: /Debian|Ruby|SiSU|ocn|object citation numbering|granular search|atomic search|rant|utf-?8|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|atomic search|Dublin Core|Lex Mercatoria|Project Gutenberg|Slashdot/i + +@links: + {What does SiSU do? Summary}../SiSU/1.html#summary + { Book Samples and Markup Examples }../SiSU/examples.html + {SiSU Markup Syntax}../sample + {*Citation System* Object Citation Numbering}../SiSU/1.html#citation + {*Granular Search*}../SiSU/1.html#search + {The Chart (pdf)}../diagram/sisu.chart.pdf + {Accompanying Diagrams}../diagram/sisu_provisional_patent_application_diagram_200408.pdf + {Standard}../SiSU/standard.html + {License}../SiSU/license.html + {man pages}../SiSU/3.html#man + {SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU + {SiSU @ Freshmeat}http://freshmeat.net/projects/sisu/ + {SiSU @ Ruby Application Archive }http://raa.ruby-lang.org/project/sisu/ + {SiSU @ Debian}http://packages.qa.debian.org/s/sisu.html + {Download}../SiSU/download.html + {Changelog}../SiSU/changelog.html + +: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_2.5.1.orig.tar.gz (2010-06-12:23/6) }http://www.jus.uio.no/sisu/pkg/src/sisu_2.5.1.orig.tar.gz + +_* {~^ sisu-markup-samples_2.0.3.orig.tar.gz (of 2010-05-01:17/6 ) }http://www.jus.uio.no/sisu/pkg/src/sisu-markup-samples_2.0.3.orig.tar.gz *~sisu-markup-samples + +For installation notes see http://sisudoc.org/sisu/sisu_manual/installation.html + +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 + +group{ + +*{Source}* + +{~^ sisu_2.5.1.orig.tar.gz }http://www.jus.uio.no/sisu/pkg/src/sisu_2.5.1.orig.tar.gz + +{~^ sisu_2.5.1-1.diff.gz }http://www.jus.uio.no/sisu/pkg/src/sisu_2.5.1-1.diff.gz + +{~^ sisu_2.5.1-1.dsc }http://www.jus.uio.no/sisu/pkg/src/sisu_2.5.1-1.dsc + +}group + +group{ + +*{Debs}* + +{~^ sisu_2.5.1-1_all.deb }http://www.jus.uio.no/sisu/archive/pool/main/s/sisu/sisu_2.5.1-1_all.deb ~{
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.2), 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_2.5.1-1_all.deb }http://www.jus.uio.no/sisu/archive/pool/main/s/sisu/sisu-complete_2.5.1-1_all.deb ~{
a package that pulls in other packages to build the whole of sisu (excluding sisu-examples)
Depends: ruby (>=1.8.2), sisu, sisu-pdf, sisu-postgresql, sisu-remote, sisu-sqlite, vim-sisu
Recommends: sisu-examples }~ + +{~^ sisu-pdf_2.5.1-1_all.deb }http://www.jus.uio.no/sisu/archive/pool/main/s/sisu/sisu-pdf_2.5.1-1_all.deb ~{
dependencies used by sisu to produce pdf from LaTeX generated
Depends: sisu, tetex-bin, tetex-extra, latex-ucs
Suggests: evince, xpdf }~ + +{~^ sisu-postgresql_2.5.1-1_all.deb }http://www.jus.uio.no/sisu/archive/pool/main/s/sisu/sisu-postgresql_2.5.1-1_all.deb ~{
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 }~ + +{~^ sisu-sqlite_2.5.1-1_all.deb }http://www.jus.uio.no/sisu/archive/pool/main/s/sisu/sisu-sqlite_2.5.1-1_all.deb ~{
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.jus.uio.no/sisu/SiSU/changelog.html + +_1 http://www.jus.uio.no/sisu/sisu_changelog/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_2.0.3-1_all.deb }http://www.jus.uio.no/sisu/archive/pool/non-free/s/sisu-markup-samples/sisu-markup-samples_2.0.3-1_all.deb ~{
marked up documents and other examples related to sisu, a larger package containing a number of texts
Depends: sisu }~ + +_* {~^ sisu-markup-samples_2.0.3-1.dsc }http://www.jus.uio.no/sisu/pkg/src/sisu-markup-samples_2.0.3-1.dsc ~{
sisu-markup-samples_2.0.3-1.dsc }~ + +For changelogs see: + +_1 http://www.jus.uio.no/sisu/SiSU/changelog_markup_samples.html + +_1 http://www.jus.uio.no/sisu/sisu_markup_samples_changelog/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-2.5.1-2.noarch.rpm }http://www.jus.uio.no/sisu/pkg/rpm/sisu-2.5.1-2.noarch.rpm ~{
created using alien }~ + +_* {~^ sisu-markup-samples_2.0.3.orig-2.noarch.rpm }http://www.jus.uio.no/sisu/pkg/rpm/sisu-markup-samples_2.0.3.orig-2.noarch.rpm ~{
http://www.jus.uio.no/sisu/archive/pool/non-free/s/sisu-markup-samples/sisu-markup-samples_2.0.3-1_all.deb
created using: alien -r sisu_0.70.5-1_all.deb }~ + +For changelogs see: + +_1 http://www.jus.uio.no/sisu/SiSU/changelog_markup_samples.html + +_1 http://www.jus.uio.no/sisu/sisu_markup_samples_changelog/changelog_markup_samples.html diff --git a/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_examples.ssi b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_examples.ssi new file mode 100644 index 00000000..64a1fe90 --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_examples.ssi @@ -0,0 +1,54 @@ +% SiSU 2.0 + +@title: SiSU + :subtitle: Markup Samples, Output Examples + +@creator: :author: Amissah, Ralph + +@classify: + :type: information + :topic_register: electronic documents;SiSU:document:examples;sisu:document:examples + :subject: ebook, epublishing, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, search + +% used_by: SiSU.ssm + +@rights: Copyright (C) Ralph Amissah 2007, part of SiSU documentation, License GPL 3 + +@date: + :created: 2002-11-12 + :issued: 2002-11-12 + :available: 2002-11-12 + :published: 2007-09-16 + :modified: 2009-12-16 + +@make: + :num_top: 1 + :breaks: new=C; break=1 + :skin: skin_sisu_manual +% :bold: /Gnu|Debian|Ruby|SiSU/ + +@links: + { SiSU Manual }http://www.jus.uio.no/sisu/sisu_manual/ + {Book Samples and Markup Examples}../SiSU/examples.html + { SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU + { SiSU @ Freshmeat }http://freshmeat.net/projects/sisu/ + { SiSU @ Ruby Application Archive }http://raa.ruby-lang.org/project/sisu/ + { SiSU @ Debian }http://packages.qa.debian.org/s/sisu.html + { SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html + { SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html + { SiSU help }http://www.jus.uio.no/sisu/sisu_manual/sisu_help/ + { SiSU help sources }http://www.jus.uio.no/sisu/sisu_manual/sisu_help_sources/ + +: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 at http://www.jus.uio.no/sisu/SiSU/examples.html + +Some markup with syntax highlighting may be found under http://www.jus.uio.no/sisu/sample/syntax but is not as up to date. + +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. diff --git a/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_examples.sst b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_examples.sst new file mode 100644 index 00000000..9460615e --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_examples.sst @@ -0,0 +1,220 @@ +% SiSU 2.0 + +@title: SiSU + :subtitle: Markup Samples, Output Examples + +@creator: :author: Amissah, Ralph + +@classify: + :type: information + :topic_register: electronic documents;SiSU:document:examples;sisu:document:examples + :subject: ebook, epublishing, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, search + +% used_by: SiSU.ssm + +@rights: Copyright (C) Ralph Amissah 2007, part of SiSU documentation, License GPL 3 + +@date: + :created: 2002-11-12 + :issued: 2002-11-12 + :available: 2002-11-12 + :published: 2007-09-16 + :modified: 2009-12-16 + +@make: + :num_top: 1 + :breaks: new=C; break=1 + :skin: skin_sisu_manual +% :bold: /Gnu|Debian|Ruby|SiSU/ + +@links: + { SiSU Manual }http://www.jus.uio.no/sisu/sisu_manual/ + {Book Samples and Markup Examples}../SiSU/examples.html + { SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU + { SiSU @ Freshmeat }http://freshmeat.net/projects/sisu/ + { SiSU @ Ruby Application Archive }http://raa.ruby-lang.org/project/sisu/ + { SiSU @ Debian }http://packages.qa.debian.org/s/sisu.html + { SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html + { SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html + { SiSU help }http://www.jus.uio.no/sisu/sisu_manual/sisu_help/ + { SiSU help sources }http://www.jus.uio.no/sisu/sisu_manual/sisu_help_sources/ + +: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 at http://www.jus.uio.no/sisu/SiSU/examples.html + +Some markup with syntax highlighting may be found under http://www.jus.uio.no/sisu/sample/syntax but is not as up to date. + +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. + +<:pb> + +2~ A few book (and other) examples *~books *~sample *~example *~output + +3~wealth_of_networks- /{"The Wealth of Networks"}/, Yochai Benkler + +{ "The Wealth of Networks", Yochai Benkler [3sS]}the_wealth_of_networks.yochai_benkler.sst + +3~two_bits- /{"Two Bits"}/, Christopher Kelty + +{ "Two Bits", Christopher Kelty [3sS]}two_bits.christopher_kelty.sst + +3~freeculture- /{"Free Culture"}/, Lawrence Lessig + +{ "Free Culture", Lawrence Lessig [3sS]}free_culture.lawrence_lessig.sst + +3~free_as_in_freedom- /{"Free as in Freedom: Richard Stallman's Crusade for Free Software"}/, by Sam Williams + +{ "Free as in Freedom: Richard Stallman's Crusade for Free Software", by Sam Williams [3sS]}free_as_in_freedom.richard_stallman_crusade_for_free_software.sam_williams.sst + +3~free_for_all- /{"Free For All: How Linux and the Free Software Movement Undercut the High Tech Titans"}/, by Peter Wayner + +{ "Free For All: How Linux and the Free Software Movement Undercut the High Tech Titans", by Peter Wayner [3sS]}free_for_all.peter_wayner.sst + +3~catb- /{"The Cathedral and the Bazaar"}/, by Eric S. Raymond + +{ "The Cathedral and the Bazaar", by Eric S. Raymond [3sS]}the_cathedral_and_the_bazaar.eric_s_raymond.sst + +3~littlebrother- /{"Little Brother"}/, Cory Doctorow *~doctorow + +{ "Little Brother", Cory Doctorow [3sS]}little_brother.cory_doctorow.sst *~littlebrother + +3~accelerando- /{"Accelerando"}/, Charles Stross *~stross + +{ "Accelerando", Charles Stross [3sS]}accelerando.charles_stross.sst *~accelerando + +3~tainaron- /{"Tainaron"}/, Leena Krohn *~krohn + +{ "Tainaron", Leena Krohn [3sS]}tainaron.leena_krohn.1998.sst *~tainaron + +3~sphinx- /{"Sphinx or Robot"}/, Leena Krohn *~sor + +{ "Sphinx or Robot", Leena Krohn [3sS]}sphinx_or_robot.leena_krohn.1996.sst + +3~war_and_peace- /{"War and Peace"}/, Leo Tolstoy, PG Etext 2600 *~wap *~gutenberg + +{ "War and Peace", Leo Tolstoy [3sS]}war_and_peace.leo_tolstoy.sst ~{ http://www.jus.uio.no/sisu/war_and_peace.leo_tolstoy/toc.html
The ascii text was taken from Project Gutenberg. The markup transforms required are trivial. Of interest, in this instance I am saved by having alternative syntaxes/(structural modes) for marking up endnotes... as it was possible to do a simple search and replace to make the Project Gutenberg ascii presentation suitable for SiSU, using the older endnote markup style. This example instructs the program to use regular expressions, in this example the words: none; none; BOOK|FIRST|SECOND; CHAPTER; occurring at the beginning of a line, to identify what should be treated as different levels of heading in a document (and used to make the table of contents). Note that there was _{very little markup required}_ after the document headers and Project Gutenberg legal notices. As I presume the legal notices are similar in Project Gutenberg documents, (and I could not bear to think of preparing the same legal notices twice), I moved those to the "skin" for the Project, and these are now represented in the markup by \<:insert1\> and \<:insert2\> and the legal notices are available for similar insertion into the next Project Gutenberg text prepared for SiSU, should there be one.
I did a stylesheet/skin for the Gutenberg Project, ... I may have to remove. }~ + +3~quixote- /{"Don Quixote"}/, Miguel de Cervantes [Saavedra], translated by John Ormsby, PG Etext 996 + +{ "Don Quixote", Miguel de Cervantes [Saavedra] [3sS]}don_quixote.miguel_de_cervantes.sst + +3~gulliver- /{"Gulliver's Travels"}/, Jonathan Swift, transcribed from the 1892 George Bell and Sons edition by David Price, PG Etext 829 *~swift + +{ "Gulliver's Travels", Jonathan Swift [3sS]}gullivers_travels.jonathan_swift.sst + +3~alice- /{"Alice's Adventures in Wonderland"}/, Lewis Carroll, PG Etext 11 + +{ "Alice's Adventures in Wonderland", Lewis Carroll [3sS]}alices_adventures_in_wonderland.lewis_carroll.sst + +3~glass- /{"Through The Looking-Glass"}/, Lewis Carroll, PG Etext 12 + +{ "Through The Looking-Glass", Lewis Carroll [3sS]}through_the_looking_glass.lewis_carroll.sst + +3~alice- /{"Alice's Adventures in Wonderland"}/ and /{"Through The Looking-Glass"}/, Lewis Carroll, PG Etexts 11 and 12 + +{ "Alice's Adventures in Wonderland" and "Through The Looking-Glass", Lewis Carroll [3sS]}alices_adventures_in_wonderland_and_through_the_looking_glass.lewis_carroll.ssm + +3~gpl- /{"Gnu Public License 2"}/, (GPL 2) Free Software Foundation + +{ "Gnu Public License 2", (GPL 2) Free Software Foundation [3sS]}gpl2.fsf.sst + +3~gpl- /{"Gnu Public License v3 - Third discussion draft"}/, (GPLv3) Free Software Foundation + +{ "Gnu Public License 3 - Third discussion draft", (GPL v3 draft3) Free Software Foundation [3sS]}gpl3_draft3.fsf.sst + +3~dsc- /{"Debian Social Contract"}/ + +{ "Debian Social Contract" [3sS]}debian_social_contract_v1.1.sst + +3~dc- /{"Debian Constitution v1.3"}/, (simple/default markup) + +{ "Debian Constitution v1.3" [3sS]}debian_constitution_v1.3.sst + +3~dc- /{"Debian Constitution v1.3"}/, (markup adjusted for output to more closely match the original) + +{ "Debian Constitution v1.3", (markup adjusted for output to more closely match the original) [3sS]}debian_constitution_v1.3.adjusted.sst + +3~dc- /{"Debian Constitution v1.2"}/, (simple/default markup) + +{ "Debian Constitution v1.2 (more translations)" [3sS]}debian_constitution_v1.2.sst + +3~dc- /{"Debian Constitution v1.2"}/, (markup adjusted for output to more closely match the original) + +{ "Debian Constitution (more translations)", (markup adjusted for output to more closely match the original) [3sS]}debian_constitution_v1.2.adjusted.sst + +3~terminology- /{"A Uniform Sales Terminology"}/, Vikki Rogers and Albert Kritzer + +{ "A Uniform Sales Terminology", Vikki Rogers and Albert Kritzer [3sS]}a_uniform_international_sales_terminology.vikki_rogers.and.albert_kritzer.sst + +3~autonomous- /{"The Autonomous Contract" 1997 }/ - markup sample + +{ "The Autonomous Contract" 1997 - markup sample [3sS]}the_autonomous_contract.amissah.19970710.sst + +3~autonomous- /{"The Autonomous Contract Revisited"}/ - markup sample + +{ "The Autonomous Contract Revisited" - markup sample [3sS]}autonomy_markup0.sst ~{ http://www.jus.uio.no/sisu/autonomy_markup0/toc.html
alternative markup variations revolving around endnotes
(i) as above, markup with embedded endnotes, and header list of words/phrases to emphasise
http://www.jus.uio.no/sisu/sample/syntax/autonomy_markup0.sst.html
http://www.jus.uio.no/sisu/sample/markup/autonomy_markup0.sst
(ii) Again markup with embedded endnotes, but font faces changed within paragraphs rather than in header as in i
http://www.jus.uio.no/sisu/sample/syntax/autonomy_markup1.sst.html
http://www.jus.uio.no/sisu/sample/markup/autonomy_markup1.sst
(iii) Markup with endnote placemarks within paragraphs, the endnotes following the paragraph that contains them http://www.jus.uio.no/sisu/sample/syntax/autonomy_markup2.sst.html
http://www.jus.uio.no/sisu/sample/markup/autonomy_markup2.sst
(iv) Another alternative is to place the marked up endnotes sequentially and at the end of the text. This also works. The paragraph variant iii is perhaps easier to visually check should there be missing endnotes; but this variant iv may better suit the conversion of alternatively pre-prepared documents. }~ + +3~cisg- /{"United Nations Convention on Contracts for the International Sale of Goods"}/ + +{ "United Nations Convention on Contracts for the International Sale of Goods" [3sS]}un_contracts_international_sale_of_goods_convention_1980.sst ~{ http://www.jus.uio.no/sisu/un_contracts_international_sale_of_goods_convention_1980/toc.html
This example instructs the program to use regular expressions, in this example the words: Part, Chapter, Section, Article occurring at the beginning of a line, to identify what should be treated as different levels of heading in a document (and used to make the table of contents).
This example instructs the program to use regular expressions, in this example the words: Part, Chapter, Section, Article occurring at the beginning of a line, to identify what should be treated as different levels of heading in a document (and used to make the table of contents). }~ + +3~pecl- /PECL/ the "Principles of European Contract Law" + +{ "Principles of European Contract Law" [3sS]}eu_contract_principles_parts_1_to_3_2002.sst + +2~sql SQL - PostgreSQL, SQLite + +A Sample search form is available at http://search.sisudoc.org + +A few canned searches, showing object numbers. Search for: + +_1 { English documents matching Linux OR Debian }http://search.sisudoc.org?s1=Linux%2BOR%2BDebian&lang=En&db=SiSU_sisu&view=index&a=1 + +_1 { GPL OR Richard Stallman }http://search.sisudoc.org?s1=GPL%2BOR%2BRichard%2BStallman&lang=En&db=SiSU_sisu&view=index&a=1 + +_1 { invention OR innovation in English language }http://search.sisudoc.org?s1=invention%2BOR%2Binnovation&lang=En&db=SiSU_sisu&view=index&a=1 + +_1 { copyright in English language documents }http://search.sisudoc.org?s1=copyright&lang=En&db=SiSU_sisu&view=index&a=1 + +Note that the searches done in this form are case sensitive. + +Expand those same searches, showing the matching text in each document: + +_1 { English documents matching Linux OR Debian }http://search.sisudoc.org?s1=Linux%2BOR%2BDebian&lang=En&db=SiSU_sisu&view=text&a=1 + +_1 { GPL OR Richard Stallman }http://search.sisudoc.org?s1=GPL%2BOR%2BRichard%2BStallman&lang=En&db=SiSU_sisu&view=text&a=1 + +_1 { invention OR innovation in English language }http://search.sisudoc.org?s1=invention%2BOR%2Binnovation&lang=En&db=SiSU_sisu&view=text&a=1 + +_1 { copyright in English language documents }http://search.sisudoc.org?s1=copyright&lang=En&db=SiSU_sisu&view=text&a=1 + +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. }~ + +2~ Lex Mercatoria as an example + +There is quite a bit to peruse if you explore the site Lex Mercatoria: + +http://www.lexmercatoria.org/ ~{ http://www.jus.uio.no/lm/index }~ + +or perhaps: + +http://lexmercatoria.org/treaties.and.organisations/lm.chronological ~{ http://www.jus.uio.no/lm/treaties.and.organisations/lm.chronological }~ + +2~ For good measure the markup for a document with lots of (simple) tables + +SiSU is not optimised for table making, but does handle simple tables. + +_* {~^ SiSU marked up file with tables }http://www.jus.uio.no/sisu/sample/syntax/un_conventions_membership_status.sst.html ~{
http://www.jus.uio.no/sisu/sample/markup/un_conventions_membership_status.sst }~ + +_* {~^ Output of table file example }http://www.jus.uio.no/lm/un_conventions_membership_status/toc.html + +2~ And a link to the output of a reported case + +http://www.jus.uio.no/lm/england.fothergill.v.monarch.airlines.hl.1980/toc.html diff --git a/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_faq.sst b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_faq.sst new file mode 100644 index 00000000..3acbbb74 --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_faq.sst @@ -0,0 +1,221 @@ +% SiSU 2.0 + +@title: SiSU + :subtitle: FAQ - Frequently Asked/Answered Questions + +@creator: :author: Amissah, Ralph + +@classify: + :type: information + :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 + +% used_by: manual SiSU.ssm + +@rights: Copyright (C) Ralph Amissah 2007, part of SiSU documentation, License GPL 3 + +@date: + :published: 2008-03-12 + :created: 2006-09-06 + :available: 2006-09-06 + :issued: 2006-09-06 + :modified: 2009-12-16 + +@make: + :num_top: 1 + :breaks: new=C; break=1 + :skin: skin_sisu_manual + :bold: /Gnu|Debian|Ruby|SiSU/ + +@links: + { SiSU Manual }http://www.jus.uio.no/sisu/sisu_manual/ + { Book Samples and Markup Examples }../SiSU/examples.html + { SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU + { SiSU @ Freshmeat }http://freshmeat.net/projects/sisu/ + { SiSU @ Ruby Application Archive }http://raa.ruby-lang.org/project/sisu/ + { SiSU @ Debian }http://packages.qa.debian.org/s/sisu.html + { SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html + { SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html + { SiSU help }http://www.jus.uio.no/sisu/sisu_manual/sisu_help/ + { SiSU help sources }http://www.jus.uio.no/sisu/sisu_manual/sisu_help_sources/ + +: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.0? + +Most of SiSU is mature and stable. +Version 1.0 will be based on the current markup, (more likely with optional additions rather than significant changes) and directory structure. +At this point (semantic tagging apart) it is largely a matter of choice as to when the version change is made. + +The feature set for html,~{ html w3c compliance has been largely met. }~ LaTeX/pdf and opendocument is in place. +XML, and plaintext are in order. + +html and LaTeX/pdf may be regarded as reference copy outputs + +With regard to the populating of sql databases (postgresql and sqlite), there is a bit to be done. + +We are still almost there. diff --git a/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_filetypes.sst b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_filetypes.sst new file mode 100644 index 00000000..55ab627f --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_filetypes.sst @@ -0,0 +1,170 @@ +% SiSU 2.0 + +@title: SiSU + :subtitle: Filetypes + +@creator: :author: Amissah, Ralph + +@rights: Copyright (C) Ralph Amissah 2007, part of SiSU documentation, License GPL 3 + +@classify: + :type: information + :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 + +% used_by: sisu_manual + +@date: + :published: 2007-09-16 + :created: 2002-08-28 + :issued: 2002-08-28 + :available: 2002-08-28 + :modified: 2009-12-16 + +@make: + :num_top: 1 + :breaks: new=C; break=1 + :skin: skin_sisu_manual + :bold: /Gnu|Debian|Ruby|SiSU/ + +@links: + { SiSU Manual }http://www.jus.uio.no/sisu/sisu_manual/ + { Book Samples and Markup Examples }http://www.jus.uio.no/sisu/SiSU/examples.html + { SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU + { SiSU @ Freshmeat }http://freshmeat.net/projects/sisu/ + { SiSU @ Ruby Application Archive }http://raa.ruby-lang.org/project/sisu/ + { SiSU @ Debian }http://packages.qa.debian.org/s/sisu.html + { SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html + { SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html + { SiSU help }http://www.jus.uio.no/sisu/sisu_manual/sisu_help/ + { SiSU help sources }http://www.jus.uio.no/sisu/sisu_manual/sisu_help_sources/ + +: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. + +http://www.jus.uio.no/sisu/sisu_markup + +http://www.jus.uio.no/sisu/sisu_manual + +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. }~ + +http://www.jus.uio.no/sisu/sisu_markup + +http://www.jus.uio.no/sisu/sisu_manual + +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.jus.uio.no/sisu/sisu_commands + +http://www.jus.uio.no/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]] + +% .SH "SKINS \- document, directory and site skins" diff --git a/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_help.sst b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_help.sst new file mode 100644 index 00000000..c10807bd --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_help.sst @@ -0,0 +1,131 @@ +% SiSU 2.0 + +@title: SiSU + :subtitle: Help + +@creator: :author: Amissah, Ralph + +@rights: Copyright (C) Ralph Amissah 2007, part of SiSU documentation, License GPL 3 + +@classify: + :type: information + :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 + +% used_by: sisu_manual + +@date: + :created: 2002-08-28 + :issued: 2002-08-28 + :available: 2002-08-28 + :published: 2007-08-30 + :modified: 2009-12-16 + +@make: + :num_top: 1 + :breaks: new=C; break=1 + :skin: skin_sisu_manual + :bold: /Gnu|Debian|Ruby|SiSU/ + +@links: + { SiSU Manual }http://www.jus.uio.no/sisu/sisu_manual/ + { Book Samples and Markup Examples }http://www.jus.uio.no/sisu/SiSU/examples.html + { SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU + { SiSU @ Freshmeat }http://freshmeat.net/projects/sisu/ + { SiSU @ Ruby Application Archive }http://raa.ruby-lang.org/project/sisu/ + { SiSU @ Debian }http://packages.qa.debian.org/s/sisu.html + { SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html + { SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html + { SiSU help }http://www.jus.uio.no/sisu/sisu_manual/sisu_help/ + { SiSU help sources }http://www.jus.uio.no/sisu/sisu_manual/sisu_help_sources/ + +: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/v2/sisu_markup_samples/sisu_manual/ + +_1 /usr/share/doc/sisu/v2/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 + +_1 man sisu_markup + +_1 man sisu_commands + +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/v2/sisu_markup_samples/sisu_manual/ + +Once installed, directory equivalent to: + +_1 /usr/share/doc/sisu/sisu_manual/ + +Available man pages are converted back to html using man2html: + +_1 /usr/share/doc/sisu/v2/html/ + +_1 ./data/doc/sisu/v2/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. + +2~ Help Sources + +For lists of alternative help sources, see: + +!_ man page + +_1 man sisu_help_sources + +!_ man2html + +_1 /usr/share/doc/sisu/v2/html/sisu.1.html + +_1 http://sisudoc.org/sisu/sisu_help_sources/index.html diff --git a/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_help_sources.sst b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_help_sources.sst new file mode 100644 index 00000000..edd4699e --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_help_sources.sst @@ -0,0 +1,180 @@ +% SiSU insert 2.0 + +@title: SiSU + :subtitle: References + +@creator: Amissah, Ralph + +@rights: Copyright (C) Ralph Amissah 2007, part of SiSU documentation, License GPL 3 + +@classify: + :type: information + :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 + +% used_by: sisu_manual + +@date: + :created: 2002-11-12 + :issued: 2002-11-12 + :available: 2002-11-12 + :published: 2007-09-16 + :modified: 2009-12-16 + +@make: + :num_top: 1 + :breaks: new=C; break=1 + :skin: skin_sisu_manual + :bold: /Gnu|Debian|Ruby|SiSU/ + +@links: + { SiSU Manual }http://www.jus.uio.no/sisu/sisu_manual/ + { Book Samples and Markup Examples }http://www.jus.uio.no/sisu/SiSU/examples.html + { SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU + { SiSU @ Freshmeat }http://freshmeat.net/projects/sisu/ + { SiSU @ Ruby Application Archive }http://raa.ruby-lang.org/project/sisu/ + { SiSU @ Debian }http://packages.qa.debian.org/s/sisu.html + { SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html + { SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html + { SiSU help }http://www.jus.uio.no/sisu/sisu_manual/sisu_help/ + { SiSU help sources }http://www.jus.uio.no/sisu/sisu_manual/sisu_help_sources/ + +:A~? @title @creator + +:B~? SiSU Help Sources + +1~help_sources Help Sources + +For a summary of alternative ways to get help on SiSU try one of the following: + +!_ man page + +_1 man sisu_help + +!_ man2html + +_1 http://www.jus.uio.no/sisu/man/sisu_help.1.html + +!_ sisu generated output - links to html + +_1 http://sisudoc.org/sisu/sisu_help/index.html + +!_ help sources lists + +Alternative sources for this help sources page listed here: + +_1 man sisu_help_sources + +_1 http://sisudoc.org/sisu/sisu_help_sources/index.html + +2~ man pages + +3~ man + +_1 man sisu + +_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 + +_1 http://sisudoc.org/sisu/sisu_commands/index.html + +_1 http://sisudoc.org/sisu/sisu_complete/index.html + +_1 http://sisudoc.org/sisu/sisu_configuration/index.html + +_1 http://sisudoc.org/sisu/sisu_description/index.html + +_1 http://sisudoc.org/sisu/sisu_examples/index.html + +_1 http://sisudoc.org/sisu/sisu_faq/index.html + +_1 http://sisudoc.org/sisu/sisu_filetypes/index.html + +_1 http://sisudoc.org/sisu/sisu_help/index.html + +_1 http://sisudoc.org/sisu/sisu_help_sources/index.html + +_1 http://sisudoc.org/sisu/sisu_howto/index.html + +_1 http://sisudoc.org/sisu/sisu_introduction/index.html + +_1 http://sisudoc.org/sisu/sisu_manual/index.html + +_1 http://sisudoc.org/sisu/sisu_markup/index.html + +_1 http://sisudoc.org/sisu/sisu_output_overview/index.html + +_1 http://sisudoc.org/sisu/sisu_pdf/index.html + +_1 http://sisudoc.org/sisu/sisu_postgresql/index.html + +_1 http://sisudoc.org/sisu/sisu_quickstart/index.html + +_1 http://sisudoc.org/sisu/sisu_remote/index.html + +_1 http://sisudoc.org/sisu/sisu_search/index.html + +_1 http://sisudoc.org/sisu/sisu_skin/index.html + +_1 http://sisudoc.org/sisu/sisu_sqlite/index.html + +_1 http://sisudoc.org/sisu/sisu_syntax_highlighting/index.html + +_1 http://sisudoc.org/sisu/sisu_vim/index.html + +_1 http://sisudoc.org/sisu/sisu_webrick/index.html + +2~ man2html + +3~ locally installed + +file:///usr/share/doc/sisu/v2/html/sisu.1.html + +file:///usr/share/doc/sisu/v2/html/sisu_help.1.html + +file:///usr/share/doc/sisu/v2/html/sisu_help_sources.1.html + +_1 /usr/share/doc/sisu/v2/html/sisu.1.html + +_1 /usr/share/doc/sisu/v2/html/sisu_pdf.7.html + +_1 /usr/share/doc/sisu/v2/html/sisu_postgresql.7.html + +_1 /usr/share/doc/sisu/v2/html/sisu_sqlite.7.html + +_1 /usr/share/doc/sisu/v2/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/v3/markup-samples/sisu_manual/sisu_homepages.ssi b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_homepages.ssi new file mode 100644 index 00000000..31b44c1c --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_homepages.ssi @@ -0,0 +1,87 @@ +% SiSU insert 2.0 + +@title: SiSU + :subtitle: Homepages + +@creator: :author: Amissah, Ralph + +@rights: Copyright (C) Ralph Amissah 2007, part of SiSU documentation, License GPL 3 + +% used_by: sisu_manual.ssm sisu.ssm + +@classify: + :type: information + :subject: ebook, epublishing, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, search + +@date: + :published: 2007-09-16 + :created: 2007-08-28 + :issued: 2007-08-28 + :available: 2007-08-28 + :modified: 2009-12-16 + +@make: + :num_top: 1 + :breaks: new=C; break=1 + :skin: skin_sisu_manual + :bold: /Gnu|Debian|Ruby|SiSU/ + +@links: + { SiSU Manual }http://www.jus.uio.no/sisu/sisu_manual/ + { Book Samples and Markup Examples }http://www.jus.uio.no/sisu/SiSU/examples.html + { SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU + { SiSU @ Freshmeat }http://freshmeat.net/projects/sisu/ + { SiSU @ Ruby Application Archive }http://raa.ruby-lang.org/project/sisu/ + { SiSU @ Debian }http://packages.qa.debian.org/s/sisu.html + { SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html + { SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html + { SiSU help }http://www.jus.uio.no/sisu/sisu_manual/sisu_help/ + { SiSU help sources }http://www.jus.uio.no/sisu/sisu_manual/sisu_help_sources/ + +: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 + +2~ Home page within a skin + +Skins are described in a separate section, but basically are a file written in the programming language 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. + +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 + +code{ + + class Home + def homepage + # place the html content of your homepage here, this will become index.html + < + + +

this is my new homepage.

+
+ +HOME + end + end + +}code + +% .SH "SKINS \- document, directory and site skins" + + diff --git a/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_how.ssi b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_how.ssi new file mode 100644 index 00000000..7928abb5 --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_how.ssi @@ -0,0 +1,47 @@ +% SiSU 2.0 + +@title: SiSU + :subtitle: How Does SiSU Work? + +@creator: :author: Amissah, Ralph + +@rights: Copyright (C) Ralph Amissah 2007, part of SiSU documentation, License GPL 3 + +% used_by: manual + +@classify: + :type: information + :subject: ebook, epublishing, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, search + +@date: + :published: 2007-09-16 + :created: 2002-08-28 + :issued: 2002-08-28 + :available: 2002-08-28 + :modified: 2009-12-16 + +@make: + :num_top: 1 + :breaks: new=C; break=1 + :skin: skin_sisu_manual + :bold: /Gnu|Debian|Ruby|SiSU/ + +@links: + { SiSU Manual }http://www.jus.uio.no/sisu/sisu_manual/ + { Book Samples and Markup Examples }http://www.jus.uio.no/sisu/SiSU/examples.html + { SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU + { SiSU @ Freshmeat }http://freshmeat.net/projects/sisu/ + { SiSU @ Ruby Application Archive }http://raa.ruby-lang.org/project/sisu/ + { SiSU @ Debian }http://packages.qa.debian.org/s/sisu.html + { SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html + { SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html + { SiSU help }http://www.jus.uio.no/sisu/sisu_manual/sisu_help/ + { SiSU help sources }http://www.jus.uio.no/sisu/sisu_manual/sisu_help_sources/ + +: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/v3/markup-samples/sisu_manual/sisu_howto.sst b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_howto.sst new file mode 100644 index 00000000..d53bafa2 --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_howto.sst @@ -0,0 +1,1406 @@ +% SiSU insert 2.0 + +@title: SiSU + :subtitle: Technical, Howto + +@creator: :author: Amissah, Ralph + +@rights: Copyright (C) Ralph Amissah 2007, part of SiSU documentation, License GPL 3 + +@classify: + :type: information + :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 + +% used_by: sisu_manual SiSU.ssm document + +@date: + :published: 2007-09-16 + :created: 2002-11-12 + :issued: 2002-11-12 + :available: 2002-11-12 + :modified: 2009-12-16 + +@make: + :num_top: 1 + :breaks: new=C; break=1 + :skin: skin_sisu_manual + :bold: /Gnu|Debian|Ruby|SiSU/ + +@links: + { SiSU Manual }http://www.jus.uio.no/sisu/sisu_manual/ + { Book Samples and Markup Examples }http://www.jus.uio.no/sisu/SiSU/examples.html + { SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU + { SiSU @ Freshmeat }http://freshmeat.net/projects/sisu/ + { SiSU @ Ruby Application Archive }http://raa.ruby-lang.org/project/sisu/ + { SiSU @ Debian }http://packages.qa.debian.org/s/sisu.html + { SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html + { SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html + { SiSU help }http://www.jus.uio.no/sisu/sisu_manual/sisu_help/ + { SiSU help sources }http://www.jus.uio.no/sisu/sisu_manual/sisu_help_sources/ + +: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
http://polyglotman.sourceforge.net/rman.html
With regard to SiSU man pages the formatting generated for markup syntax is not quite right, for that you might prefer the links under:
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_examples.1 }http://www.jus.uio.no/sisu/man/sisu_examples.1.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/v2/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 webrick + +#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 + +the string should be provided as output from the previous command + +sudo cp -vi /usr/share/doc/sisu-markup-samples/v2/samples/sisu_sqlite.cgi /usr/lib/cgi-bin + +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/sisurc.yaml + +and on installation under: + +_1 /etc/sisu/sisurc.yaml + +The following paths are searched: + +_1 ./_sisu/sisurc.yaml + +_1 ~/.sisu/sisurc.yaml + +_1 ./etc/sisu/sisurc.yaml + +1~howto_markup Markup + +See sample markup provided on + +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/2#books + +on untarring the source tarball: + +_1 data/sisu-examples/sample/document_samples_sisu_markup/ + +or the same once source is installed (or sisu-examples) under: + +_1 /usr/share/doc/sisu-markup-samples/v2/samples + +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://sisudoc.org + +code{ + +{ SiSU }http://sisudoc.org + +}code + +{sisu.png }http://sisudoc.org + +code{ + +{sisu.png }http://sisudoc.org + +}code + +{tux.png 64x80 }image + +code{ + +{ tux.png 64x80 }image + +}code + +{~^ SiSU }http://sisudoc.org + +code{ + +{~^ SiSU }http://sisudoc.org + +}code + +is equivalent to: + +code{ + +{ SiSU }http://sisudoc.org ~{ http://sisudoc.org }~ + +}code + +the same can be done with an image: + +{~^ sisu.png "SiSU" }http://sisudoc.org + +code{ + +{~^ sisu.png "SiSU" }http://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" may be used to change various aspects related to the output documents appearance, including such things as the url for the home page on which the material will be published, information on the credit band, and for html documents colours and icons used in navigation bars. Skins are ruby files which permit changing of the default values set within the program for SiSU output. + +There are a few examples provided, on untarring the source tarball: + +_1 conf/sisu/skin/doc/ + +_1 data/sisu-examples/sample/document_samples_sisu_markup/_sisu/skin/doc + +and on installation under: + +_1 /etc/sisu/skin/doc/ + +_1 /usr/share/doc/sisu-markup-samples/v2/samples/_sisu/skin/doc + +The following paths are searched: + +_1 ./_sisu/skin + +_1 ~/.sisu/skin + +_1 /etc/sisu/skin + +Skins under the searched paths in a per document directory, a per directory directory, or a site directory, named: + +doc [may be specified individually in each document] + +dir [used if identifier part of name matches markup directory name] + +site + +It is usual to place all skins in the document directory, with symbolic links as required from dir or site directories. + +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.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.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 be dependent on your hardware, and filesystem (in my case Reiserfs), 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.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-0.58.2, which amongst other things provides the dependencies of sisu within Debian. + +code{ + +Package: sisu +Architecture: all +Depends: ruby (>= 1.8.2), libwebrick-ruby, unzip, zip +Conflicts: vim-sisu, sisu-vim, sisu-remote +Replaces: vim-sisu, sisu-vim +Recommends: sisu-pdf, sisu-sqlite, sisu-postgresql, librmagick-ruby, trang, +tidy, librexml-ruby, openssl, rsync, openssh-client | lsh-client, keychain, +hyperestraier, kdissert, vim-addon-manager +Suggests: rcs | cvs, lv, texinfo, pinfo + +Package: sisu-complete +Depends: ruby (>= 1.8.4), sisu, sisu-pdf, sisu-postgresql, sisu-sqlite +Recommends: hyperestraier + +Package: sisu-pdf +Architecture: all +Depends: sisu, texlive-latex-base, texlive-fonts-recommended, +texlive-latex-recommended, texlive-latex-extra +Suggests: evince, xpdf + +Package: sisu-postgresql +Depends: sisu, postgresql-8.1, libdbi-ruby, libdbm-ruby, libdbd-pg-ruby +Suggests: pgaccess, libdbd-pgsql, postgresql-contrib-8.1 + +Package: sisu-sqlite +Depends: sisu, sqlite, libdbi-ruby, libdbm-ruby, libdbd-sqlite-ruby +Suggests: libdbd-sqlite + +Package: sisu-markup-samples +Depends: sisu + +}code + +code{ + +Source: sisu +Section: text +Priority: optional +Maintainer: Ralph Amissah +Build-Depends: debhelper (>= 5) +Standards-Version: 3.7.2 + +Package: sisu +Architecture: all +Depends: ruby (>= 1.8.2), ruby (<< 1.9), libwebrick-ruby, unzip, zip +Conflicts: vim-sisu, sisu-vim, sisu-remote +Replaces: vim-sisu, sisu-vim +Recommends: sisu-doc, sisu-pdf, sisu-sqlite, sisu-postgresql, hyperestraier, keychain, librmagick-ruby, librexml-ruby, openssl, openssh-client | lsh-client, rsync, tidy, vim-addon-manager +Suggests: kdissert, lv, rcs | cvs, pinfo, texinfo, trang +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, EPUB, XML, 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. + . + Homepage: + +}code + +code{ + +Package: sisu-complete +Architecture: all +Depends: ruby (>= 1.8.2), ruby (<< 1.9), sisu, sisu-doc, sisu-pdf, sisu-postgresql, sisu-sqlite +Recommends: hyperestraier +Description: installs all SiSU related packages + This package installs SiSU and related packages that enable sisu to produce + pdf and to populate postgresql and sqlite databases. + . + SiSU is a lightweight markup based document structuring, publishing and search + framework for document collections. + . + See sisu for a description of the package. + . + Homepage: + +}code + +code{ + +Package: sisu-doc +Architecture: all +Depends: sisu +Recommends: sisu-pdf, sisu-postgresql, sisu-sqlite +Description: sisu manual and other documentation for sisu + Multiple file formats generated output of sisu documentation generated from + sisu markup source documents included in the main package + . + SiSU is a lightweight markup based document structuring, publishing and search + framework for document collections. + . + Homepage: + +}code + +code{ + +Package: sisu-pdf +Architecture: all +Depends: sisu, texlive-latex-base, texlive-fonts-recommended, texlive-latex-recommended, texlive-latex-extra +Recommends: sisu-doc +Description: dependencies to convert SiSU LaTeX output to pdf + This package enables the conversion of SiSU LaTeX output to pdf. + . + SiSU is a lightweight markup based document structuring, publishing and search + framework for document collections. + . + Homepage: + +}code + +code{ + +Package: sisu-postgresql +Architecture: all +Depends: sisu, libdbd-pg-ruby, libdbi-ruby, libdbm-ruby, postgresql +Recommends: sisu-doc, libfcgi-ruby +Suggests: postgresql-contrib +Description: SiSU dependencies for use with postgresql database + 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. + . + SiSU is a lightweight markup based document structuring, publishing and search + framework for document collections. + . + Homepage: + +}code + +code{ + +Package: sisu-sqlite +Architecture: all +Depends: sisu, sqlite, libdbd-sqlite-ruby, libdbi-ruby, libdbm-ruby +Recommends: sisu-doc, libfcgi-ruby +Description: SiSU dependencies for use with sqlite database + 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. + . + SiSU is a lightweight markup based document structuring, publishing and search + framework for document collections. + . + Homepage: + +}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/v2/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/free_culture.lawrence_lessig/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. + +* skins - changing the appearance of a project, directory or individual +documents within ~/.sisu/skin + +_1 ~/.sisu/skin/doc contains individual skins, with symbolic links from + +_1 ~/.sisu/skin/dir if the contents of a directory are to take a particular document skin. + +_* 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/sisu_markup_samples/dfsg + +These are installed on the system usually at: + +_1 /usr/share/doc/sisu/v2/sisu_markup_samples/samples + +More markup samples are available in the package sisu-markup-samples + +_1 http://www.jus.uio.no/sisu/SiSU/download.html#sisu-markup-samples + +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/conf/syntax + +usually installed to: + +_1 /usr/share/sisu/v2/conf/syntax + +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/v2/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/gpl3.fsf/gpl3.fsf.sst + +_1 sisu -3 http://www.jus.uio.no/sisu/free_culture.lawrence_lessig/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/free_culture.lawrence_lessig/sisupod.zip + +there is a security issue associated with the running of document skins that are not your own, so these are turned of by default, and the use of the following command, which switches on the associated skin is not recommended: + +_1 sisu -3 --trust http://www.jus.uio.no/sisu/free_culture.lawrence_lessig/sisupod.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/v2/sisu_markup_samples/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.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 + +3~ Skins + +!_ Skins +default document appearance may be modified using skins contained in sub-directories located at the following paths: + +_1 ./_sisu/skin + +_1 ~/.sisu/skin + +_1 /etc/sisu/skin + +more specifically, the following locations (or their /etc/sisu equivalent) should be used: + +_1 ~/.sisu/skin/doc + +skins for individual documents; + +_1 ~/.sisu/skin/dir + +skins for directories of matching names; + +_1 ~/.sisu/skin/site + +site-wide skin modifying the site-wide appearance of documents. + +Usually all skin files are placed in the document skin directory: + +_1 ~/.sisu/skin/doc + +with softlinks being made to the skins contained there from other skin +directories as required. diff --git a/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_hyperestraier.ssi b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_hyperestraier.ssi new file mode 100644 index 00000000..4b528900 --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_hyperestraier.ssi @@ -0,0 +1,115 @@ +% SiSU insert 2.0 + +@title: SiSU + :subtitle: Hyperestraier Search + +@creator: :author: Amissah, Ralph + +@rights: Copyright (C) Ralph Amissah 2007, part of SiSU documentation, License GPL 3 + +% used_by: sisu_manual + +@classify: + :type: information + :subject: ebook, epublishing, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, search + +@date: + :created: 2002-08-28 + :issued: 2002-08-28 + :available: 2002-08-28 + :published: 2007-09-16 + :modified: 2009-12-16 + +@make: + :num_top: 1 + :breaks: new=C; break=1 + :skin: skin_sisu_manual + :bold: /Gnu|Debian|Ruby|SiSU/ + +@links: + { SiSU Manual }http://www.jus.uio.no/sisu/sisu_manual/ + { Book Samples and Markup Examples }http://www.jus.uio.no/sisu/SiSU/examples.html + { SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU + { SiSU @ Freshmeat }http://freshmeat.net/projects/sisu/ + { SiSU @ Ruby Application Archive }http://raa.ruby-lang.org/project/sisu/ + { SiSU @ Debian }http://packages.qa.debian.org/s/sisu.html + { SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html + { SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html + { SiSU help }http://www.jus.uio.no/sisu/sisu_manual/sisu_help/ + { SiSU help sources }http://www.jus.uio.no/sisu/sisu_manual/sisu_help_sources/ + +: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/v3/markup-samples/sisu_manual/sisu_installation.ssi b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_installation.ssi new file mode 100644 index 00000000..adf5b921 --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_installation.ssi @@ -0,0 +1,389 @@ +% SiSU insert 2.0 + +@title: SiSU + :subtitle: Installation + +@creator: Amissah, Ralph + +@rights: Copyright (C) Ralph Amissah 2007, part of SiSU documentation, License GPL 3 + +% used_by: sisu_manual.ssm SiSU.ssm + +@classify: + :type: information + :subject: ebook, epublishing, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, search + +@date: + :published: 2007-09-16 + :created: 2002-11-12 + :issued: 2002-11-12 + :available: 2002-11-12 + :modified: 2009-12-16 + +@make: + :num_top: 1 + :breaks: new=C; break=1 + :skin: skin_sisu_manual + :bold: /Gnu|Debian|Ruby|SiSU/ + +@links: + { SiSU Manual }http://www.jus.uio.no/sisu/sisu_manual/ + { Book Samples and Markup Examples }http://www.jus.uio.no/sisu/SiSU/examples.html + { SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU + { SiSU @ Freshmeat }http://freshmeat.net/projects/sisu/ + { SiSU @ Ruby Application Archive }http://raa.ruby-lang.org/project/sisu/ + { SiSU @ Debian }http://packages.qa.debian.org/s/sisu.html + { SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html + { SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html + { SiSU help }http://www.jus.uio.no/sisu/sisu_manual/sisu_help/ + { SiSU help sources }http://www.jus.uio.no/sisu/sisu_manual/sisu_help_sources/ + +:A~? SiSU Installation notes + +:C~ Installation + +1~installation Installation + +See the {~^ download pages }http://www.jus.uio.no/sisu/SiSU/download ~{
http://www.jus.uio.no/sisu/sisu_download }~ 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/
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/
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
http://i.loveruby.net/en/projects/setup/doc/ }~ installation is a 3 step process~{ Installation instructions
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/v3/markup-samples/sisu_manual/sisu_interesting_to_whom.ssi b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_interesting_to_whom.ssi new file mode 100644 index 00000000..f3a94e0e --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_interesting_to_whom.ssi @@ -0,0 +1,53 @@ +% SiSU 2.0 + +@title: SiSU + :subtitle: Who Might Be Interested? + +@creator: :author: Amissah, Ralph + +@rights: Copyright (C) Ralph Amissah 2007, part of SiSU documentation, License GPL 3 + +% used_by: manual + +@classify: + :type: information + :subject: ebook, epublishing, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, search + +@date: + :created: 2002-08-28 + :issued: 2002-08-28 + :available: 2002-08-28 + :published: 2007-09-16 + :modified: 2009-12-16 + +@make: + :num_top: 1 + :breaks: new=C; break=1 + :skin: skin_sisu_manual + :bold: /Gnu|Debian|Ruby|SiSU/ + +@links: + { SiSU Manual }http://www.jus.uio.no/sisu/sisu_manual/ + { Book Samples and Markup Examples }http://www.jus.uio.no/sisu/SiSU/examples.html + { SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU + { SiSU @ Freshmeat }http://freshmeat.net/projects/sisu/ + { SiSU @ Ruby Application Archive }http://raa.ruby-lang.org/project/sisu/ + { SiSU @ Debian }http://packages.qa.debian.org/s/sisu.html + { SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html + { SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html + { SiSU help }http://www.jus.uio.no/sisu/sisu_manual/sisu_help/ + { SiSU help sources }http://www.jus.uio.no/sisu/sisu_manual/sisu_help_sources/ + +: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/v3/markup-samples/sisu_manual/sisu_introduction.sst b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_introduction.sst new file mode 100644 index 00000000..e2df51d0 --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_introduction.sst @@ -0,0 +1,72 @@ +% SiSU 2.0 + +@title: SiSU + :subtitle: Introduction + +@creator: :author: Amissah, Ralph + +@rights: Copyright (C) Ralph Amissah 2007, part of SiSU documentation, License GPL 3 + +% used_by: manual + +@classify: + :type: information + :subject: ebook, epublishing, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, search + +@date: + :published: 2007-09-16 + :created: 2002-08-28 + :issued: 2002-08-28 + :available: 2002-08-28 + :modified: 2009-12-16 + +@make: + :num_top: 1 + :breaks: new=C; break=1 + :skin: skin_sisu_manual + :bold: /Gnu|Debian|Ruby|SiSU/ + +@links: + { SiSU Manual }http://www.jus.uio.no/sisu/sisu_manual/ + { Book Samples and Markup Examples }http://www.jus.uio.no/sisu/SiSU/examples.html + { SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU + { SiSU @ Freshmeat }http://freshmeat.net/projects/sisu/ + { SiSU @ Ruby Application Archive }http://raa.ruby-lang.org/project/sisu/ + { SiSU @ Debian }http://packages.qa.debian.org/s/sisu.html + { SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html + { SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html + { SiSU help }http://www.jus.uio.no/sisu/sisu_manual/sisu_help/ + { SiSU help sources }http://www.jus.uio.no/sisu/sisu_manual/sisu_help_sources/ + +: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 (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 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. + +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. + +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. + +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
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). + +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.jus.uio.no/sisu + +% SiSU is a way of preparing, publishing, managing and searching documents. + diff --git a/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_manual.ssm b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_manual.ssm new file mode 100644 index 00000000..878dc5cb --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_manual.ssm @@ -0,0 +1,118 @@ +% SiSU master 2.0 + +@title: SiSU + :subtitle: Manual + +@creator: :author: Amissah, Ralph + +@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-07-21 + :created: 2002-08-28 + :issued: 2002-08-28 + :available: 2002-08-28 + :modified: 2009-12-16 + +@make: + :num_top: 1 + :breaks: new=C; break=1 + :skin: skin_sisu_manual + :bold: /Gnu|Debian|Ruby|SiSU/ + +@links: + { SiSU Manual }http://www.jus.uio.no/sisu/sisu_manual/ + { Book Samples and Markup Examples }http://www.jus.uio.no/sisu/SiSU/examples.html + { SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU + { SiSU @ Freshmeat }http://freshmeat.net/projects/sisu/ + { SiSU @ Ruby Application Archive }http://raa.ruby-lang.org/project/sisu/ + { SiSU @ Debian }http://packages.qa.debian.org/s/sisu.html + { SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html + { SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html + { SiSU help }http://www.jus.uio.no/sisu/sisu_manual/sisu_help/ + { SiSU help sources }http://www.jus.uio.no/sisu/sisu_manual/sisu_help_sources/ + +: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 and Skins + +<< sisu_config.ssi + +<< sisu_skin.sst + +<< sisu_css.ssi + +<< sisu_content_directories.ssi + +<< sisu_homepages.ssi + +% :B~? SiSU Output and Markup Examples + +<< sisu_examples.sst + +<< sisu_output_overview.sst + +<< sisu_search_intro.ssi + +<< sisu_sql.ssi + +<< sisu_postgresql.sst + +<< sisu_sqlite.sst + +<< sisu_search_cgi.ssi + +<< sisu_hyperestraier.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/v3/markup-samples/sisu_manual/sisu_markup.sst b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_markup.sst new file mode 100644 index 00000000..09f3cc63 --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_markup.sst @@ -0,0 +1,1417 @@ +% SiSU 2.0 + +@title: SiSU + :subtitle: Markup + +@creator: + :author: Amissah, Ralph + +@rights: + :copyright: Copyright (C) Ralph Amissah 2007, part of SiSU documentation + :license: GPL 3 or later + +@classify: + :type: information + :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 + +% used_by: SiSU.ssm sisu.ssm + +@date: + :created: 2002-08-28 + :issued: 2002-08-28 + :available: 2002-08-28 + :published: 2008-05-22 + :modified: 2010-10-14 + +@make: + :num_top: 1 + :breaks: new=C; break=1 + :skin: skin_sisu_manual + :bold: /Gnu|Debian|Ruby|SiSU/ + +@links: + { SiSU Manual }http://www.jus.uio.no/sisu/sisu_manual/ + { Book Samples and Markup Examples }../SiSU/examples.html + { SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU + { SiSU @ Freshmeat }http://freshmeat.net/projects/sisu/ + { SiSU @ Ruby Application Archive }http://raa.ruby-lang.org/project/sisu/ + { SiSU @ Debian }http://packages.qa.debian.org/s/sisu.html + { SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html + { SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html + { SiSU help }http://www.jus.uio.no/sisu/sisu_manual/sisu_help/ + { SiSU help sources }http://www.jus.uio.no/sisu/sisu_manual/sisu_help_sources/ + +: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/ + +Some example marked up files are available as html with syntax highlighting for viewing: http://www.jus.uio.no/sisu/sample/syntax + +an alternative presentation of markup syntax: http://www.jus.uio.no/sisu/sample/on_markup.txt + +3~ Installed + +With SiSU installed sample skins may be found in: /usr/share/doc/sisu/sisu_markup_samples/dfsg (or equivalent directory) and if sisu-markup-samples is installed also under: /usr/share/doc/sisu/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 + +@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 + :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 --v1 [operations] + +@links: + { SiSU Manual }http://www.jus.uio.no/sisu/sisu_manual/ + { Book Samples and Markup Examples }http://www.jus.uio.no/sisu/SiSU/examples.html + { SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU + { SiSU @ Freshmeat }http://freshmeat.net/projects/sisu/ + { SiSU @ Ruby Application Archive }http://raa.ruby-lang.org/project/sisu/ + { SiSU @ Debian }http://packages.qa.debian.org/s/sisu.html + { SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html + { SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html + { SiSU help }http://www.jus.uio.no/sisu/sisu_manual/sisu_help/ + { SiSU help sources }http://www.jus.uio.no/sisu/sisu_manual/sisu_help_sources/ + +}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: + :isbn: [ISBN] + :loc: [Library of Congress classification] + :dewey: [Dewey classification + :pg: [Project Gutenberg text number] + +}code + +code{ + +@links: { SiSU }http://www.jus.uio.no/sisu/ + { FSF }http://www.fsf.org + +}code + +code{ + +@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] + +}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~ 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.jus.uio.no/sisu continues + +}code + +!_ resulting output: + +normal text http://www.jus.uio.no/sisu continues + +An escaped url without decoration + +!_ markup example: + +code{ + +normal text _http://www.jus.uio.no/sisu continues + +deb http://www.jus.uio.no/sisu/archive unstable main non-free + +}code + +!_ resulting output: + +normal text _http://www.jus.uio.no/sisu 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.jus.uio.no/sisu/ 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.jus.uio.no/sisu/ 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.jus.uio.no/sisu/ + +{GnuDebianLinuxRubyBetterWay.png 100x101 "Way Better - with Gnu/Linux, Debian and Ruby" }http://www.jus.uio.no/sisu/ + +{~^ 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.jus.uio.no/sisu/ + +{GnuDebianLinuxRubyBetterWay.png 100x101 "Way Better - with Gnu/Linux, Debian and Ruby" }http://www.jus.uio.no/sisu/ + +{~^ 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. + +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
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~ 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. Alternative markup for importation of documents under consideration, and occasionally supported have been. + +code{ + +<< filename.ssi + +<<{filename.ssi} + +% using textlink alternatives + +<< |filename.ssi|@|^| + +}code + +:C~ Markup Syntax History + +1~ Notes related to Files-types and Markup Syntax + +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/v3/markup-samples/sisu_manual/sisu_output_overview.sst b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_output_overview.sst new file mode 100644 index 00000000..92d5274e --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_output_overview.sst @@ -0,0 +1,160 @@ +% SiSU 2.0 + +@title: SiSU + :subtitle: SiSU overview of status of features available in various outputs + +@creator: :author: Amissah, Ralph + +@rights: Copyright (C) Ralph Amissah 2007, part of SiSU documentation, License GPL 3 + +@classify: + :type: information + :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 + +% used_by: manual, document + +@date: + :published: 2007-09-16 + :created: 2005-10-31 + :available: 2006-10-31 + :issued: 2006-10-31 + :modified: 2009-12-16 + +@make: + :num_top: 1 + :breaks: new=C; break=1 + :skin: skin_sisu_manual +% :bold: /Gnu|Debian|Ruby|SiSU/ + +@links: + { SiSU Manual }http://www.jus.uio.no/sisu/sisu_manual/ + { Book Samples and Markup Examples }http://www.jus.uio.no/sisu/SiSU/examples.html + { SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU + { SiSU @ Freshmeat }http://freshmeat.net/projects/sisu/ + { SiSU @ Ruby Application Archive }http://raa.ruby-lang.org/project/sisu/ + { SiSU @ Debian }http://packages.qa.debian.org/s/sisu.html + { SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html + { SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html + { SiSU help }http://www.jus.uio.no/sisu/sisu_manual/sisu_help/ + { SiSU help sources }http://www.jus.uio.no/sisu/sisu_manual/sisu_help_sources/ + +: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/v3/markup-samples/sisu_manual/sisu_postgresql.sst b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_postgresql.sst new file mode 100644 index 00000000..addf1bd1 --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_postgresql.sst @@ -0,0 +1,98 @@ +% SiSU 2.0 + +@title: SiSU + :subtitle: Search + +@creator: :author: Amissah, Ralph + +@rights: Copyright (C) Ralph Amissah 2007, part of SiSU documentation, License GPL 3 + +@classify: + :topic_register: electronic documents:SiSU:document:postgresql;SiSU:manual:postgresql;electronic documents:SiSU:manual:postgresql;SiSU:document:postgresql;SiSU:document:postgresql; + :type: information + :subject: ebook, epublishing, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, search + +% used_by: sisu_manual.ssm SiSU.ssm + +@date: + :published: 2007-09-16 + :created: 2002-08-28 + :issued: 2002-08-28 + :available: 2002-08-28 + :modified: 2009-12-16 + +@make: + :num_top: 1 + :breaks: new=C; break=1 + :skin: skin_sisu_manual + :bold: /Gnu|Debian|Ruby|SiSU/ + :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] + +@links: + { SiSU Manual }http://www.jus.uio.no/sisu/sisu_manual/ + { Book Samples and Markup Examples }http://www.jus.uio.no/sisu/SiSU/examples.html + { SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU + { SiSU @ Freshmeat }http://freshmeat.net/projects/sisu/ + { SiSU @ Ruby Application Archive }http://raa.ruby-lang.org/project/sisu/ + { SiSU @ Debian }http://packages.qa.debian.org/s/sisu.html + { SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html + { SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html + { SiSU help }http://www.jus.uio.no/sisu/sisu_manual/sisu_help/ + { SiSU help sources }http://www.jus.uio.no/sisu/sisu_manual/sisu_help_sources/ + +: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
+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
+creates database where no database existed before + +!_ sisu -D --create
+creates database tables where no database tables existed before + +!_ sisu -D --Dropall
+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
+destroys existing database and builds a new empty database structure + +3~ import and remove documents + +!_ sisu -D --import -v [filename/wildcard]
+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]
+updates file contents in database + +!_ sisu -D --remove -v [filename/wildcard]
+removes specified document from postgresql database. + diff --git a/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_quickstart.sst b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_quickstart.sst new file mode 100644 index 00000000..652b12f2 --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_quickstart.sst @@ -0,0 +1,272 @@ +% SiSU 2.0 + +@title: SiSU + :subtitle: Quickstart, installation and use + +@creator: :author: Amissah, Ralph + +@rights: Copyright (C) Ralph Amissah 2007, part of SiSU documentation, License GPL 3 + +@classify: + :type: information + :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 + +% used_by: SiSU.ssm sisu_manual.ssm + +@date: + :created: 2006-09-06 + :available: 2006-09-06 + :issued: 2006-09-06 + :published: 2007-09-16 + :modified: 2009-12-16 + +@make: + :num_top: 1 + :breaks: new=C; break=1 + :skin: skin_sisu_manual + :bold: /Gnu|Debian|Ruby|SiSU/ + +@links: + { SiSU Manual }http://www.jus.uio.no/sisu/sisu_manual/ + { Book Samples and Markup Examples }http://www.jus.uio.no/sisu/SiSU/examples.html + { SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU + { SiSU @ Freshmeat }http://freshmeat.net/projects/sisu/ + { SiSU @ Ruby Application Archive }http://raa.ruby-lang.org/project/sisu/ + { SiSU @ Debian }http://packages.qa.debian.org/s/sisu.html + { SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html + { SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html + { SiSU help }http://www.jus.uio.no/sisu/sisu_manual/sisu_help/ + { SiSU help sources }http://www.jus.uio.no/sisu/sisu_manual/sisu_help_sources/ + +: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/sisu_markup_samples/dfsg + +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 + +_* {~^ sisu.8 }http://www.jus.uio.no/sisu/man/sisu.8 + +_* {~^ 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.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/v3/markup-samples/sisu_manual/sisu_remote.sst b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_remote.sst new file mode 100644 index 00000000..3f85743f --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_remote.sst @@ -0,0 +1,106 @@ +% SiSU 2.0 + +@title: SiSU + :subtitle: Remote Operations + +@creator: :author: Amissah, Ralph + +@rights: Copyright (C) Ralph Amissah 2007, part of SiSU documentation, License GPL 3 + +@classify: + :type: information + :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 + +% used_by: sisu_manual.ssm SiSU.ssm + +@date: + :published: 2007-09-16 + :created: 2002-08-28 + :issued: 2002-08-28 + :available: 2002-08-28 + :modified: 2009-12-16 + +@make: + :num_top: 1 + :breaks: new=C; break=1 + :skin: skin_sisu_manual + :bold: /Gnu|Debian|Ruby|SiSU/ + +@links: + { SiSU Manual }http://www.jus.uio.no/sisu/sisu_manual/ + { Book Samples and Markup Examples }http://www.jus.uio.no/sisu/SiSU/examples.html + { SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU + { SiSU @ Freshmeat }http://freshmeat.net/projects/sisu/ + { SiSU @ Ruby Application Archive }http://raa.ruby-lang.org/project/sisu/ + { SiSU @ Debian }http://packages.qa.debian.org/s/sisu.html + { SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html + { SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html + { SiSU help }http://www.jus.uio.no/sisu/sisu_manual/sisu_help/ + { SiSU help sources }http://www.jus.uio.no/sisu/sisu_manual/sisu_help_sources/ + +: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 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]
+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]
+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/v3/markup-samples/sisu_manual/sisu_search.ssm b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_search.ssm new file mode 100644 index 00000000..e72d2a4c --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_search.ssm @@ -0,0 +1,53 @@ +% SiSU master 2.0 + +@title: SiSU + :subtitle: Search + +@creator: :author: Ralph Amissah + +@rights: Copyright (C) Ralph Amissah 2007, part of SiSU documentation, License GPL 3 + +@classify: + :type: information + :subject: ebook, epublishing, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, search + +@date: + :created: 2002-08-28 + :issued: 2002-08-28 + :available: 2002-08-28 + :published: 2007-09-16 + :modified: 2009-12-16 + +@make: + :num_top: 1 + :breaks: new=C; break=1 + :skin: skin_sisu_manual + :bold: /Gnu|Debian|Ruby|SiSU/ + +@links: + { SiSU Manual }http://www.jus.uio.no/sisu/sisu_manual/ + { Book Samples and Markup Examples }http://www.jus.uio.no/sisu/SiSU/examples.html + { SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU + { SiSU @ Freshmeat }http://freshmeat.net/projects/sisu/ + { SiSU @ Ruby Application Archive }http://raa.ruby-lang.org/project/sisu/ + { SiSU @ Debian }http://packages.qa.debian.org/s/sisu.html + { SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html + { SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html + { SiSU help }http://www.jus.uio.no/sisu/sisu_manual/sisu_help/ + { SiSU help sources }http://www.jus.uio.no/sisu/sisu_manual/sisu_help_sources/ + +:A~? @title @creator + +:B~? SiSU Search + +<< sisu_search_intro.ssi + +<< sisu_sql.ssi + +<< sisu_postgresql.sst + +<< sisu_sqlite.sst + +<< sisu_search_cgi.ssi + +<< sisu_hyperestraier.ssi diff --git a/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_search_cgi.ssi b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_search_cgi.ssi new file mode 100644 index 00000000..7e7e211f --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_search_cgi.ssi @@ -0,0 +1,99 @@ +% SiSU insert 2.0 + +@title: SiSU + :subtitle: Search + +@creator: :author: Ralph Amissah + +@rights: Copyright (C) Ralph Amissah 2007, part of SiSU documentation, License GPL 3 + +% used_by: sisu_manual.ssm sisu.ssm + +@classify: + :type: information + :subject: ebook, epublishing, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, search + +@date: + :published: 2007-09-16 + :created: 2002-08-28 + :issued: 2002-08-28 + :available: 2002-08-28 + :modified: 2009-12-16 + +@make: + :num_top: 1 + :breaks: new=C; break=1 + :skin: skin_sisu_manual + :bold: /Gnu|Debian|Ruby|SiSU/ + +@links: + { SiSU Manual }http://www.jus.uio.no/sisu/sisu_manual/ + { Book Samples and Markup Examples }http://www.jus.uio.no/sisu/SiSU/examples.html + { SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU + { SiSU @ Freshmeat }http://freshmeat.net/projects/sisu/ + { SiSU @ Ruby Application Archive }http://raa.ruby-lang.org/project/sisu/ + { SiSU @ Debian }http://packages.qa.debian.org/s/sisu.html + { SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html + { SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html + { SiSU help }http://www.jus.uio.no/sisu/sisu_manual/sisu_help/ + { SiSU help sources }http://www.jus.uio.no/sisu/sisu_manual/sisu_help_sources/ + +: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
+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
+generates a sample search form, which must be copied to the web-server cgi directory + +!_ sisu -F --webserv-webrick
+generates a sample search form for use with the webrick server, which must be copied to the web-server cgi directory + +!_ sisu -Fv
+as above, and provides some information on setting up hyperestraier + +!_ sisu -W
+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/v3/markup-samples/sisu_manual/sisu_search_intro.ssi b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_search_intro.ssi new file mode 100644 index 00000000..24ae1cea --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_search_intro.ssi @@ -0,0 +1,52 @@ +% SiSU insert 2.0 + +@title: SiSU + :subtitle: Search + +@creator: :author: Amissah, Ralph + +@rights: Copyright (C) Ralph Amissah 2007, part of SiSU documentation, License GPL 3 + +% used_by: sisu_manual.ssm + +@classify: + :type: information + :subject: ebook, epublishing, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, search + +@date: + :published: 2007-09-16 + :created: 2002-08-28 + :issued: 2002-08-28 + :available: 2002-08-28 + :modified: 2009-12-16 + +@make: + :num_top: 1 + :breaks: new=C; break=1 + :skin: skin_sisu_manual + :bold: /Gnu|Debian|Ruby|SiSU/ + +@links: + { SiSU Manual }http://www.jus.uio.no/sisu/sisu_manual/ + { Book Samples and Markup Examples }http://www.jus.uio.no/sisu/SiSU/examples.html + { SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU + { SiSU @ Freshmeat }http://freshmeat.net/projects/sisu/ + { SiSU @ Ruby Application Archive }http://raa.ruby-lang.org/project/sisu/ + { SiSU @ Debian }http://packages.qa.debian.org/s/sisu.html + { SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html + { SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html + { SiSU help }http://www.jus.uio.no/sisu/sisu_manual/sisu_help/ + { SiSU help sources }http://www.jus.uio.no/sisu/sisu_manual/sisu_help_sources/ + +: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/v3/markup-samples/sisu_manual/sisu_short_feature_summary.ssi b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_short_feature_summary.ssi new file mode 100644 index 00000000..0009352e --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_short_feature_summary.ssi @@ -0,0 +1,103 @@ +% SiSU 2.0 + +@title: SiSU + :subtitle: Summary of Features + +@creator: :author: Ralph Amissah + +@rights: Copyright (C) Ralph Amissah 2007, part of SiSU documentation, License GPL 3 + +% used_by: manual + +@classify: + :type: information + :subject: ebook, epublishing, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, search + +@date: + :created: 2002-08-28 + :issued: 2002-08-28 + :available: 2002-08-28 + :modified: 2009-12-16 + +@date: :published: 2007-09-16 + +@make: + :num_top: 1 + :breaks: new=C; break=1 + :skin: skin_sisu_manual + :bold: /Gnu|Debian|Ruby|SiSU/ + +@links: + { SiSU Manual }http://www.jus.uio.no/sisu/sisu_manual/ + { Book Samples and Markup Examples }http://www.jus.uio.no/sisu/SiSU/examples.html + { SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU + { SiSU @ Freshmeat }http://freshmeat.net/projects/sisu/ + { SiSU @ Ruby Application Archive }http://raa.ruby-lang.org/project/sisu/ + { SiSU @ Debian }http://packages.qa.debian.org/s/sisu.html + { SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html + { SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html + { SiSU help }http://www.jus.uio.no/sisu/sisu_manual/sisu_help/ + { SiSU help sources }http://www.jus.uio.no/sisu/sisu_manual/sisu_help_sources/ + +: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: + +_1* html - both as a single scrollable text and a segmented document + +_1* xhtml + +_1* epub + +_1* XML - both in sax and dom style xml structures for further development as required + +_1* ODF - open document format, the iso standard for document storage + +_1* LaTeX - used to generate pdf + +_1* pdf (via LaTeX) + +_1* sql - population of an sql database, (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/v3/markup-samples/sisu_manual/sisu_skin.sst b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_skin.sst new file mode 100644 index 00000000..9cff0ed7 --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_skin.sst @@ -0,0 +1,104 @@ +% SiSU insert 2.0 + +@title: SiSU + :subtitle: Skins + +@creator: :author: Amissah, Ralph + +@rights: Copyright (C) Ralph Amissah 2007, part of SiSU documentation, License GPL 3 + +@classify: + :type: information + :topic_register: electronic documents:SiSU:document:skins;SiSU:manual:skins;electronic documents:SiSU:manual:skins;SiSU:document:skins;SiSU:document:skins + :subject: ebook, epublishing, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, search + +% used_by: sisu_manual.ssm SiSU.ssm + +@date: + :published: 2007-09-16 + :created: 2002-11-12 + :issued: 2002-11-12 + :available: 2002-11-12 + :modified: 2009-12-16 + +@make: + :num_top: 1 + :breaks: new=C; break=1 + :skin: skin_sisu_manual + :bold: /Gnu|Debian|Ruby|SiSU/ + +@links: + { SiSU Manual }http://www.jus.uio.no/sisu/sisu_manual/ + { Book Samples and Markup Examples }http://www.jus.uio.no/sisu/SiSU/examples.html + { SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU + { SiSU @ Freshmeat }http://freshmeat.net/projects/sisu/ + { SiSU @ Ruby Application Archive }http://raa.ruby-lang.org/project/sisu/ + { SiSU @ Debian }http://packages.qa.debian.org/s/sisu.html + { SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html + { SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html + { SiSU help }http://www.jus.uio.no/sisu/sisu_manual/sisu_help/ + { SiSU help sources }http://www.jus.uio.no/sisu/sisu_manual/sisu_help_sources/ + +:A~? @title @creator + +:B~? Document Skins - configuration + +1~skins Skins + +% .SH "SKINS \- document, directory and site skins" + +Skins modify the default appearance of document output on a document, directory, or site wide basis. Skins are looked for in the following locations: + +_1 ./_sisu/skin + +_1 ~/.sisu/skin + +_1 /etc/sisu/skin + +!_ Within the skin directory +are the following the default sub-directories for document skins: + +_1 ./skin/doc + +_1 ./skin/dir + +_1 ./skin/site + +A skin is placed in the appropriate directory and the file named skin_[name].rb + +The skin itself is a ruby file which modifies the default appearances set in the program. + +2~ Document Skin + +Documents take on a document skin, if the header of the document specifies a skin to be used. + +code{ + +@skin: skin_united_nations + +}code + +2~ Directory Skin + +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). + +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. + +2~ Site Skin + +A site skin, modifies the program default skin. + +2~ Sample Skins + +With SiSU installed sample skins may be found in: + +_1 /etc/sisu/skin/doc and /usr/share/doc/sisu/v2/sisu_markup_samples/samples/_sisu/skin/doc + +(or equivalent directory) and if sisu-markup-samples is installed also under: + +_1 /usr/share/doc/sisu-markup-samples/v2/samples/_sisu/skin/doc + +Samples of list.yml and promo.yml (which are used to create the right column list) may be found in: + +_1 /usr/share/doc/sisu/sisu_markup_samples/dfsg/_sisu/skin/yml (or equivalent directory) + diff --git a/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_sql.ssi b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_sql.ssi new file mode 100644 index 00000000..0f2e8b7b --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_sql.ssi @@ -0,0 +1,68 @@ +% SiSU insert 2.0 + +@title: SiSU + :subtitle: SQL and Search + +@creator: :author: Amissah, Ralph + +@rights: Copyright (C) Ralph Amissah 2007, part of SiSU documentation, License GPL 3 + +% used_by: sisu_manual.ssm + +@classify: + :type: information + :subject: ebook, epublishing, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, search + +@date: + :created: 2002-08-28 + :issued: 2002-08-28 + :available: 2002-08-28 + :published: 2007-09-16 + :modified: 2009-12-16 + +@make: + :num_top: 1 + :breaks: new=C; break=1 + :skin: skin_sisu_manual + :bold: /Gnu|Debian|Ruby|SiSU/ + +@links: + { SiSU Manual }http://www.jus.uio.no/sisu/sisu_manual/ + { Book Samples and Markup Examples }http://www.jus.uio.no/sisu/SiSU/examples.html + { SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU + { SiSU @ Freshmeat }http://freshmeat.net/projects/sisu/ + { SiSU @ Ruby Application Archive }http://raa.ruby-lang.org/project/sisu/ + { SiSU @ Debian }http://packages.qa.debian.org/s/sisu.html + { SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html + { SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html + { SiSU help }http://www.jus.uio.no/sisu/sisu_manual/sisu_help/ + { SiSU help sources }http://www.jus.uio.no/sisu/sisu_manual/sisu_help_sources/ + +: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/
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 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/v3/markup-samples/sisu_manual/sisu_sqlite.sst b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_sqlite.sst new file mode 100644 index 00000000..7f312e0f --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_sqlite.sst @@ -0,0 +1,98 @@ +% SiSU 2.0 + +@title: SiSU + :subtitle: Sqlite / search + +@creator: :author: Amissah, Ralph + +@rights: Copyright (C) Ralph Amissah 2007, part of SiSU documentation, License GPL 3 + +@classify: + :type: information + :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 + +% used_by: sisu_manual.ssm SiSU.ssm + +@date: + :published: 2007-09-16 + :created: 2002-08-28 + :issued: 2002-08-28 + :available: 2002-08-28 + :modified: 2009-12-16 + +@make: + :num_top: 1 + :breaks: new=C; break=1 + :skin: skin_sisu_manual + :bold: /Gnu|Debian|Ruby|SiSU/ + :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] + +@links: + { SiSU Manual }http://www.jus.uio.no/sisu/sisu_manual/ + { Book Samples and Markup Examples }http://www.jus.uio.no/sisu/SiSU/examples.html + { SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU + { SiSU @ Freshmeat }http://freshmeat.net/projects/sisu/ + { SiSU @ Ruby Application Archive }http://raa.ruby-lang.org/project/sisu/ + { SiSU @ Debian }http://packages.qa.debian.org/s/sisu.html + { SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html + { SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html + { SiSU help }http://www.jus.uio.no/sisu/sisu_manual/sisu_help/ + { SiSU help sources }http://www.jus.uio.no/sisu/sisu_manual/sisu_help_sources/ + +: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
+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
+creates database where no database existed before + +!_ sisu -d --create
+creates database tables where no database tables existed before + +!_ sisu -d --dropall
+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
+destroys existing database and builds a new empty database structure + +3~ import and remove documents + +!_ sisu -d --import -v [filename/wildcard]
+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]
+updates file contents in database + +!_ sisu -d --remove -v [filename/wildcard]
+removes specified document from sqlite database. diff --git a/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_synopsis.ssi b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_synopsis.ssi new file mode 100644 index 00000000..909cb2c2 --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_synopsis.ssi @@ -0,0 +1,64 @@ +% SiSU 2.0 + +@title: SiSU + :subtitle: Commands + +@creator: :author: Amissah, Ralph + +@rights: Copyright (C) Ralph Amissah 2007, part of SiSU documentation, License GPL 3 + +@classify: + :type: information + :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 + +% used_by: sisu_manual SiSU.ssm + +@date: + :created: 2002-08-28 + :issued: 2002-08-28 + :available: 2002-08-28 + :published: 2007-09-16 + :modified: 2009-12-16 + +@make: + :num_top: 1 + :breaks: new=C; break=1 + :skin: skin_sisu_manual + :bold: /Gnu|Debian|Ruby|SiSU/ + +@links: + { SiSU Manual }http://www.jus.uio.no/sisu/sisu_manual/ + { Book Samples and Markup Examples }http://www.jus.uio.no/sisu/SiSU/examples.html + { SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU + { SiSU @ Freshmeat }http://freshmeat.net/projects/sisu/ + { SiSU @ Ruby Application Archive }http://raa.ruby-lang.org/project/sisu/ + { SiSU @ Debian }http://packages.qa.debian.org/s/sisu.html + { SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html + { SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html + { SiSU help }http://www.jus.uio.no/sisu/sisu_manual/sisu_help/ + { SiSU help sources }http://www.jus.uio.no/sisu/sisu_manual/sisu_help_sources/ + +: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, to use sisu version 1 + +sisu --v1 [and options/operations as above] + +for settings see sisu --help env + +sisu [ filename/ wildcard] == sisu -0 [filename/wildcard] diff --git a/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_syntax_highlighting.sst b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_syntax_highlighting.sst new file mode 100644 index 00000000..24f72c71 --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_syntax_highlighting.sst @@ -0,0 +1,169 @@ +% SiSU insert 2.0 + +@title: SiSU + :subtitle: Syntax Highlighting + +@creator: :author: Amissah, Ralph + +@rights: Copyright (C) Ralph Amissah 2007, part of SiSU documentation, License GPL 3 + +@classify: + :type: information + :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 + +% used_by: sisu_manual.ssm SiSU.ssm + +@date: + :published: 2007-09-16 + :created: 2002-11-12 + :issued: 2002-11-12 + :available: 2002-11-12 + :modified: 2009-12-16 + +@make: + :num_top: 1 + :breaks: new=C; break=1 + :skin: skin_sisu_manual + :bold: /Gnu|Debian|Ruby|SiSU/ + +@links: + { SiSU Manual }http://www.jus.uio.no/sisu/sisu_manual/ + { Book Samples and Markup Examples }http://www.jus.uio.no/sisu/SiSU/examples.html + { SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU + { SiSU @ Freshmeat }http://freshmeat.net/projects/sisu/ + { SiSU @ Ruby Application Archive }http://raa.ruby-lang.org/project/sisu/ + { SiSU @ Debian }http://packages.qa.debian.org/s/sisu.html + { SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html + { SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html + { SiSU help }http://www.jus.uio.no/sisu/sisu_manual/sisu_help/ + { SiSU help sources }http://www.jus.uio.no/sisu/sisu_manual/sisu_help_sources/ + +:A~? @title @creator + +:B~? SiSU Syntax Highlighting + +1~ Editor Files, Syntax Highlighting + +The directory: + +_1 ./data/sisu/conf/editor-syntax-etc/ + +_1 /usr/share/sisu/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-examples/config/syntax_hi") + +_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/v3/markup-samples/sisu_manual/sisu_webrick.sst b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_webrick.sst new file mode 100644 index 00000000..52f8c579 --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_webrick.sst @@ -0,0 +1,93 @@ +% SiSU 2.0 + +@title: SiSU + :subtitle: sisu_webrick + +@creator: :author: Amissah, Ralph + +@rights: Copyright (C) Ralph Amissah 2007, part of SiSU documentation, License GPL 3 + +@classify: + :type: information + :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 + +% used_by: sisu_manual.ssm SiSU.ssm + +@date: + :created: 2002-08-28 + :issued: 2002-08-28 + :available: 2007-08-28 + :published: 2007-09-16 + :modified: 2009-12-16 + +@make: + :num_top: 1 + :breaks: new=C; break=1 + :skin: skin_sisu + :bold: /Gnu|Debian|Ruby|SiSU/ + :manpage: section=7; name=sisu - documents: structuring, publishing in multiple formats, and search; synopsis=sisu -W + +@links: + { Book Samples and Markup Examples }http://www.jus.uio.no/sisu/SiSU/examples.html + { SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU + { SiSU @ Freshmeat }http://freshmeat.net/projects/sisu/ + { SiSU @ Ruby Application Archive }http://raa.ruby-lang.org/project/sisu/ + { SiSU @ Debian }http://packages.qa.debian.org/s/sisu.html + { SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html + { SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html + { SiSU help }http://www.jus.uio.no/sisu/sisu_manual/sisu_help/ + { SiSU help sources }http://www.jus.uio.no/sisu/sisu_manual/sisu_help_sources/ + +: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 + +2~ Further information + +For more information on SiSU see: http://www.jus.uio.no/sisu + +or man sisu + +2~ Author + +Ralph Amissah ralph@amissah.com or ralph.amissah@gmail.com + +2~ SEE ALSO + +_1 sisu(1) + +_1 sisu_vim(7) + +_1 sisu(8) + diff --git a/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_work_needed_and_wishlist.ssi b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_work_needed_and_wishlist.ssi new file mode 100644 index 00000000..98f46e1f --- /dev/null +++ b/data/doc/sisu/v3/markup-samples/sisu_manual/sisu_work_needed_and_wishlist.ssi @@ -0,0 +1,78 @@ +% SiSU 2.0 + +@title: SiSU + :subtitle: Work Needed and Wishlist + +@creator: :author: Ralph Amissah + +@rights: Copyright (C) Ralph Amissah 2007, part of SiSU documentation, License GPL 3 + +@classify: + :type: information + :subject: ebook, epublishing, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, search + +@date: + :created: 2002-08-28 + :issued: 2002-08-28 + :available: 2002-08-28 + :published: 2007-09-16 + :modified: 2009-12-16 + +@make: + :num_top: 1 + :breaks: new=C; break=1 + :skin: skin_sisu_manual + :bold: /Gnu|Debian|Ruby|SiSU/ + +@links: + { SiSU Manual }http://www.jus.uio.no/sisu/sisu_manual/ + { Book Samples and Markup Examples }http://www.jus.uio.no/sisu/SiSU/examples.html + { SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU + { SiSU @ Freshmeat }http://freshmeat.net/projects/sisu/ + { SiSU @ Ruby Application Archive }http://raa.ruby-lang.org/project/sisu/ + { SiSU @ Debian }http://packages.qa.debian.org/s/sisu.html + { SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html + { SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html + { SiSU help }http://www.jus.uio.no/sisu/sisu_manual/sisu_help/ + { SiSU help sources }http://www.jus.uio.no/sisu/sisu_manual/sisu_help_sources/ + +: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/doc/sisu/v3/sisu_user_txt/configuration.txt b/data/doc/sisu/v3/sisu_user_txt/configuration.txt new file mode 100644 index 00000000..1f122d56 --- /dev/null +++ b/data/doc/sisu/v3/sisu_user_txt/configuration.txt @@ -0,0 +1,8 @@ + index.txt +%% configuration --------------------------------------------------------------- + +configuration_sisurc.txt + +configuration_skin.txt + +configuration_css.txt diff --git a/data/doc/sisu/v3/sisu_user_txt/configuration_css.txt b/data/doc/sisu/v3/sisu_user_txt/configuration_css.txt new file mode 100644 index 00000000..17fb2e97 --- /dev/null +++ b/data/doc/sisu/v3/sisu_user_txt/configuration_css.txt @@ -0,0 +1,9 @@ + index.txt + configuration.txt +%% css ------------------------------------------------------------------------ + +the default css may be replaced for the site or particular processing +directories + +[provide information] + diff --git a/data/doc/sisu/v3/sisu_user_txt/configuration_sisurc.txt b/data/doc/sisu/v3/sisu_user_txt/configuration_sisurc.txt new file mode 100644 index 00000000..62a2ce02 --- /dev/null +++ b/data/doc/sisu/v3/sisu_user_txt/configuration_sisurc.txt @@ -0,0 +1,137 @@ + index.txt + configuration.txt +%% config, sisurc.yml ---------------------------------------------------------- + +There are default configuration settings within the program many of which can +be modified in sisurc.yml + +sisurc.yml can be located in one of the following locations: +/etc/sisu/sisurc.yml ~/.sisu/sisurc.yml and ./_sisu/sisurc.yml + +if sisu versions 1 and 2 are both in use, the v2 sisurc.yml can be placed a the +following locations: +/etc/sisu/v2/sisurc.yml ~/.sisu/v2/sisurc.yml and ./_sisu/v2/sisurc.yml + +# Name: SiSU - Simple information Structuring Universe +# Author: Ralph@Amissah.com +# Description: Site wide envionment defaults set here +# system environment info / resource configuration file, for sisu +# License: GPL v3 or later +# site environment configuration file +# this file should be configured and live in +# /etc/sisu #per environment settings, overridden by: +# ~/.sisu #per user settings, overridden by: +# ./_sisu #per local markup directory settings +#% #image source directory, main path and subdirectories +#image: +# path: 'sisu_working' +# public: '_sisu/image' +#% presentation/web directory, main path and subdirectories (most subdirectories are created automatically based on markup directory name) +#webserv: +# url_root: 'http://www.your.url' #without dir stub +# path: '/var/www' #either (i) / [full path from root] or (ii) ~/ [home] or (iii) ./ [pwd] or (iv) will be made from home +# images: '_sisu/image' +# man: 'man' +# cgi: '/usr/lib/cgi-bin' +# feed: 'feed' +# sqlite: 'sisu/sqlite' +# webrick_url: true +#show_output_on: 'filesystem' #for -v and -u url information, alternatives: 'filesystem','webserver','remote_webserver','local:8111','localhost','localhost:8080','webrick','path' +#show_output_on: 'local:8111' +#webserv_cgi: +# host: localhost +# base_path: ~ +# port: '8081' +# user: ~ +show_output_on: 'filesystem_url' +#texinfo display output +#texinfo: +# stub: 'texinfo' +##% processing directories, main path and subdirectories (appended to $HOME), using defaults set in sysenv +#processing: +# path: '~' +# dir: '.sisu_processing~' +# metaverse: 'metaverse' +# tune: 'tune' +# latex: 'tex' +# texinfo: 'texinfo' +# concord_max: 400000 +#% flag - set (non-default) processing flag shortcuts -1, -2 etc. (here adding colour and verbosity as default) +flag: + color: true # making colour default -c is toggle, and will now toggle colour off + default: '-NhwepoabxXyYv' # -m run by default; includes verbose + i: '-hwpoay' # -m run by default + ii: '-NhwepoabxXy' # -m run by default + iii: '-NhwepoabxXyY' # -m run by default + iv: '-NhwepoabxXYDy --update' # -m run by default + v: '-NhwepoabxXYDyv --update' # -m run by default; includes verbose +#% papersize, (LaTeX/pdf) available values: A4, US_letter, book_b5, book_a5, US_legal +default: + papersize: 'A4,letter' + #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 +#remote: +# - +# user: '[usrname]' +# host: '[remote.hostname]' +# path: '.' #no trailing slash eg 'sisu/www' +# - +# user: '[usrname]' +# host: '[remote.hostname]' +# path: '.' #no trailing slash eg 'sisu/www' +#% webrick information +#webrick: +# port: '8081' +#% sql database info, postgresql and sqlite +#db: +# share_source: false # boolean, default is false +# postgresql: +# port: # '[port (default is 5432)]' +# host: # '[if not localhost, provide host tcp/ip address or domain name]'' +# user: # '[(if different from user) provide username]' +# password: # '[password if required]' +# sqlite: +# path: ~ # './sisu_sqlite.db' +# port: "**" +#% possible values ~, true, false, or command instruction e.g. editor: 'gvim -c :R -c :S'. +#will only ignore if value set to false, absence or nil will not remove program as should operate without rc file +#ie in case of ~ will ignore and use hard coded defaults within program), true, false, or command instruction e.g. editor: 'gvim -c :R -c :S' +#on value true system defaults used, to change, e.g. editor specify +permission_set: + zap: false + css_modify: false +# remote_base_site: true +program_set: + rmagick: false +# wc: true +# editor: true +# postgresql: true +# sqlite: true +# tidy: true +# rexml: true +# pdflatex: true +#program_select: +# editor: 'gvim -c :R -c :S' +# pdf_viewer: 'evince' +# web_browser: 'firefox' #'iceweasel' #'epiphany' #'galeon' #'konqueror' #'kazehakase' +# console_www_browser: 'links2' #'elinks' +# odf_viewer: 'oowriter' #'abiword' +# xml_viewer: 'xml-viewer' +# man: 'nroff -man' #'groff -man -Tascii' # 'nroff -man' +#promo: sisu_icon, sisu, sisu_search_libre, open_society, fsf, ruby +#search: +# sisu: +# flag: true +## action: http://localhost:8081/cgi-bin/sisu_pgsql.cgi +# action: http://search.sisudoc.org +# db: sisu +# title: sample search form +# hyperestraier: +# flag: true +# action: http://search.sisudoc.org/cgi-bin/estseek.cgi? diff --git a/data/doc/sisu/v3/sisu_user_txt/configuration_skin.txt b/data/doc/sisu/v3/sisu_user_txt/configuration_skin.txt new file mode 100644 index 00000000..2695dda8 --- /dev/null +++ b/data/doc/sisu/v3/sisu_user_txt/configuration_skin.txt @@ -0,0 +1,15 @@ + index.txt + configuration.txt +%% skin ------------------------------------------------------------------------ + +skins can be used to modify the appearance of output + +[provide information] + +%% css ------------------------------------------------------------------------ + +the default css may be replaced for the site or particular processing +directories + +[provide information] + diff --git a/data/doc/sisu/v3/sisu_user_txt/index.txt b/data/doc/sisu/v3/sisu_user_txt/index.txt new file mode 100644 index 00000000..3e66cb19 --- /dev/null +++ b/data/doc/sisu/v3/sisu_user_txt/index.txt @@ -0,0 +1,5 @@ +%% Summary --------------------------------------------------------------------- + +markup.txt + +configuration.txt diff --git a/data/doc/sisu/v3/sisu_user_txt/markup.txt b/data/doc/sisu/v3/sisu_user_txt/markup.txt new file mode 100644 index 00000000..4ab55606 --- /dev/null +++ b/data/doc/sisu/v3/sisu_user_txt/markup.txt @@ -0,0 +1,11 @@ + index.txt +%% Summary --------------------------------------------------------------------- + +markup_minimum_requirement.txt + +markup_content.txt + +markup_headers_metadata.txt + +markup_headers_processing_instructions.txt + diff --git a/data/doc/sisu/v3/sisu_user_txt/markup_content.txt b/data/doc/sisu/v3/sisu_user_txt/markup_content.txt new file mode 100644 index 00000000..326fabe1 --- /dev/null +++ b/data/doc/sisu/v3/sisu_user_txt/markup_content.txt @@ -0,0 +1,296 @@ + index.txt + markup.txt +%% The Gory Details ------------------------------------------------------------ + +%% comments -------------------------------------------------------------------- + +Comments in sisu are a percentage sign at the start of a line followed by a +space and then the comment + +% this would be a comment + +%% headings -------------------------------------------------------------------- + +There are two sets of docment heading markers :A~ and an optional :B~ & :C~ and +beneath that 1~, 2~, 3~. These markers are placed at the start of the +line/paragraph, and followed by the heading + +There is usually one :A~ top level heading, which is the document title, +sometimes including the author. This is such a common occurrence that there is +a shortcut where metadata headers are provided for @title: and @creator +:author:, instead of rewriting the title and author's name, you may write :A~ +@title @author + +If you have a document/manuscript that has subsections above the level of +chapter, such as multiple books, parts, section, two additional top level +headings are available :B~ and :C~ + +At the main division level, usually chapter heading level 1~ begins, followed +by 2~ and 3~ if the chapter has subheadings. Because the html and epub +segmented output breaks level 1~ into separate files it is possible to provide +the filename, e.g. 1~prologue Prologue + +Where names are provided following the heading tilde, these become tagged +points within the document which can where the output format permits be +(hyper-)linked to. + +%% font effect, modified font including emphasis ------------------------------- + +Whithin normal text it is possible to modify the font effect of a word or +phrase using the following markers: + +!{ bold }! + +/{ italics }/ + +_{ underscore }_ + +*{ emphasis }* (how emphasis is represented in output text can be defined in +the header @make: section of a document or in the sisurc.yml config file, and +this may be as bold, italics or underscore, the default being bold) + +^{ superscript }^ + +,{ subscript }, + ++{ inserted text }+ + +_{ strikethrough }_ + +An exclamation mark followed by an underscore at the start of a line will bold +that line until the first line-break + +!_ this line would be bold + +It is also possible to define in the header section under the @make: section +which words or patterns should automatically be made bold or italics. + +@make: + :bold: /Gnu|Linux|Debian|Fedora|Ruby|SiSU/ + :italics: /inter alia/ + +%% indent ---------------------------------------------------------------------- + +_1 a paragraph that is indented one level + +_2 a paragraph that is indented two steps + +%% bullet ---------------------------------------------------------------------- + +_* bulleted text + +_1* bulleted indented text + +%% auto-numbering ------------------------------------------------------------- + +Some auto-numbering occurs in the building of sisu documents, either by default +or when requested through configuration options + +%% auto-numbering document objects --------------------------------------------- + +Document objects are automatically given sequential object numbers, object +citation numbers (ocn). If there is text that for some reason should not be +regarded as substantive objects, it is possible to prevent a document number +being given by adding ~# to the end of the object (paragraph/heading, etc.) ~# + +A variation used for headings that are added to provide document structure that +should where possible not be included in output is -# a heading that is marked +with -# is un-numbered and may be excluded from document outputs. + +%% auto-numbering headings ----------------------------------------------------- + +Note auto-numbering of headings may be specified in the header @make: :num_top: +by providing the heading level from which numbering is to start, this is +usually at the chapter level (1~). + +@make: + :num_top: 1 + +numbering continues three levels down, level 1 being numbered 1, 2, 3 ... +level 2: 1.1, 1.2, 1.3 and so on +level 3: 1.1.1, 1.1.2, 1.1.3 + +It is also possible to make an auto-numbered list + +# numbered list numbered list 1., 2., 3, etc. + +_# indented lettered list sub-level of previous list number a., b., c., d., etc. + +%% line breaks ----------------------------------------------------------------- + +<:br> line break + +In paper/ page oriented outputs, such as LaTeX/pdf the following are avaiable + +<:pb> page or column break + +<:pn> new page + +in the header section under @make: :breaks: new and break set a page break or +new page at the levels indicated, e.g. + +@make: + :breaks: new=C; break=1 + +%% footnotes / endnotes -------------------------------------------------------- + +This paragraph contains a footnote~{ a footnote or endnote }~ which would be +automatically numbered + +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 + +In addition to regular footnotes/endnotes there are astrisk and plus sign +numbered and unnumbered footnotes. + +normal text ~[* editors notes, numbered asterisk footnote/endnote series ]~ continues + +normal text ~[+ editors notes, numbered asterisk footnote/endnote series ]~ continues + +normal text ~{* unnumbered asterisk footnote/endnote, insert multiple asterisks if required }~ continues + +%% tag points ------------------------------------------------------------------ + +Tag points are markers within the document which may be used within the +document for (internal document) linking where the output format permits. Tag +names should use alphanumeric characters and underscores [a-z0-9_]+. + +There are different types of tag point, some automatically provided by sisu, +such as each ocn (object citation number) + +Manual tags may be provided either: + +(a) with headings where a name is added to the heading level after the tilde: + +1~prefix [heading] + +(b) a tag marker can be added to a paragraph using an asterisk tilde and the +name *~tag_marker + +%% links and urls -------------------------------------------------------------- + +Urls found within text are marked up automatically, and where the output type +permits is autmatically hyperlinked to inself and decorated with angled braces +(unless contained in a code block, or escaped by a preceeding underscore). + +To link text or an image to a url the markup is as follows + +{ this is the linked section of text}http://url.org + +Where it is wished to include the url for the linked text in a footnote, the +long form of markup would be: +{ SiSU }http://www.jus.uio.no/sisu/ ~{ http://www.jus.uio.no/sisu/ }~ + +A short form is provided for achieving the same: + {~^ SiSU }http://www.jus.uio.no/sisu/ + +%% images ---------------------------------------------------------------------- + +Images are placed in the directory beneath the location of the document to be +processed _sisu/image + +The following are examples of links to images + +{ tux.png 64x80 }image + +{tux.png 64x80 "Gnu/Linux - a better way" }http://www.jus.uio.no/sisu/ + +{GnuDebianLinuxRubyBetterWay.png 100x101 "Way Better - with Gnu/Linux, Debian and Ruby" }http://www.jus.uio.no/sisu/ + +The 64x80 in the first example is the image dimension, (width x height). This +may be omitted if imagemagick or graphicsmagick are installed, as they will +determine the image dimensions + +As with other linked text, the following markup + +{~^ ruby_logo.png "Ruby" }http://www.ruby-lang.org/en/ + +maps to + +{ ruby_logo.png "Ruby" }http://www.ruby-lang.org/en/ ~{ http://www.ruby-lang.org/en/ }~ + +%% grouped text ---------------------------------------------------------------- + +%% group ----------------------------------------------------------------------- + +The start and end of text that is grouped are tagged. Grouped text retains its +line breaks, and is treated as a unit, getting a single ocn + +group{ + +License: GPL 3 or later: + +SiSU, a framework for document structuring, publishing and search + +Copyright (C) Ralph Amissah + +This program is free software: you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation, either version 3 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with +this program. If not, see . + +If you have Internet connection, the latest version of the GPL should be +available at these locations: + + + +}group + +%% poem ------------------------------------------------------------------------ + +The start and end of a poem are tagged. Each verse in a poem is given an object +number. Verses retain their line breaks. + +poem{ + +verse here +declare + +another verse +here + +}poem + +%% table ----------------------------------------------------------------------- + +{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 + + +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 + +%% code ------------------------------------------------------------------------ + +code{ + +code lines here + +and so on + +}code + diff --git a/data/doc/sisu/v3/sisu_user_txt/markup_headers_metadata.txt b/data/doc/sisu/v3/sisu_user_txt/markup_headers_metadata.txt new file mode 100644 index 00000000..c24789c8 --- /dev/null +++ b/data/doc/sisu/v3/sisu_user_txt/markup_headers_metadata.txt @@ -0,0 +1,34 @@ + index.txt + markup.txt +%% headers --------------------------------------------------------------------- + +%% header metadata ------------------------------------------------------------- + +@title: SiSU + :subtitle: Markup + +@creator: + :author: Amissah, Ralph + +@rights: + :copyright: Copyright (C) Ralph Amissah 2007, part of SiSU documentation + :license: GPL 3 or later + +@classify: + :type: information + :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 + +@date: + :created: 2002-08-28 + :issued: 2002-08-28 + :available: 2002-08-28 + :published: 2008-05-22 + :modified: 2010-05-25 + +@links: + { SiSU Manual }http://www.jus.uio.no/sisu/sisu_manual/ + { Book Samples and Markup Examples }http://www.jus.uio.no/SiSU/examples.html + { SiSU @ Wikipedia }http://en.wikipedia.org/wiki/SiSU + { SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html + { SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html diff --git a/data/doc/sisu/v3/sisu_user_txt/markup_headers_processing_instructions.txt b/data/doc/sisu/v3/sisu_user_txt/markup_headers_processing_instructions.txt new file mode 100644 index 00000000..b2c559c1 --- /dev/null +++ b/data/doc/sisu/v3/sisu_user_txt/markup_headers_processing_instructions.txt @@ -0,0 +1,12 @@ + index.txt + markup.txt +%% header processing instructions, @make: -------------------------------------- + +Some document processing parameters can be set in the @make: section of the header + +@make: + :num_top: 1 + :breaks: new=C; break=1 + :skin: skin_sisu_manual + :bold: /Gnu|Debian|Ruby|SiSU/ + diff --git a/data/doc/sisu/v3/sisu_user_txt/markup_minimum_requirement.txt b/data/doc/sisu/v3/sisu_user_txt/markup_minimum_requirement.txt new file mode 100644 index 00000000..27b5b774 --- /dev/null +++ b/data/doc/sisu/v3/sisu_user_txt/markup_minimum_requirement.txt @@ -0,0 +1,79 @@ + index.txt + markup.txt +%% Summary --------------------------------------------------------------------- + +sisu takes an ASCII (UTF-8) document and abstracts the document into its +structure and smaller constituent parts, objects. This abstraction is then used +in subsequent processing to reconstitute the document into disparate document +representations, many quite different from one another, e.g. HTML, ODF, LaTeX +and to populate SQL + +SiSU identifies the document structure (headings and their levels) and pulls +the document apart in to its constituent parts, objects (paragraphs, headings, +tables, images etc.) to which it assigns an object number if substantive +content. + +From the marked up document SiSU need to be able to determine a documents +structure, and the objects that a document contains + +The first line of a SiSU marked up document can identify itself with + +%% Identify SiSU Document ------------------------------------------------------ + +% SiSU + +%% The Basic SiSU Markup Document ---------------------------------------------- + +SiSU documents are divided into two parts, (i) the document header and (ii) +substantive content. + +(i) the document header, which contains (a) metadata and (b) processing +instructions if any. Document headers take the form of a tag and the related +related information. The Document header, metadata, should contain at least: + +@title: + +@creator: + :author: + +Processing instructions are grouped under the @make: tag. In the absence of any +program (or configured) defaults will be used. + +(ii) for the substantive content the document structure must be defined, here +structure equates to the headings and their relative levels (this can be done +either by explicit markup where each heading occurs, or in the header @make: +section of the, or both). + +The basic document objects are headings and paragraphs. Paragraphs are +identified automatically, and headings must be defined (with respect to +document structure), so sisu is able to determine the basic objects without +anything further. + +sample_1.sst + +%% Document Structure (heading levels) ----------------------------------------- + +Document structure (heading levels) are determined from information provided in +the markup of the document. There are two ways to identify document structure: +(i) manual markup of headings with their level; (ii) in the sisu header, under +@make: :heading: provide a regex, in the manner understood by sisu, that +identifies what to look for in headings of various levels. + +Document structure is the different headings in a document, and their relative +levels. + +There are two sets of docment level markers :A~ and an optional :B~ & :C~ and +beneath that 1~, 2~, 3~. + +For the first set of document level markers the document Title being the top +level in the hierarchy; beneath that book titles if the document contains more +than one book followed by sections + +%% Document Objects (paragraphs, headings, tables, verse etc.) ----------------- + +Document objects are units of text that are identified, stored and processed as +a block. The most usual document objects would be paragraphs and headings. A +more complete list of objects includes: paragraphs; headings; tables; code +blocks; verse (the poem is identified, but each verse is an object); grouped +text... + diff --git a/data/sisu/v2/v/version.yml b/data/sisu/v2/v/version.yml index 3af00bea..2a8d7941 100644 --- a/data/sisu/v2/v/version.yml +++ b/data/sisu/v2/v/version.yml @@ -1,5 +1,5 @@ --- -:version: 2.7.16 -:date_stamp: 2010w50/4 -:date: "2010-12-10" +:version: 2.8.0 +:date_stamp: 2011w05/2 +:date: "2011-02-01" :project: SiSU diff --git a/data/sisu/v3/conf/cgi-bin/sisu_search_pgsql.cgi b/data/sisu/v3/conf/cgi-bin/sisu_search_pgsql.cgi new file mode 100644 index 00000000..c196c756 --- /dev/null +++ b/data/sisu/v3/conf/cgi-bin/sisu_search_pgsql.cgi @@ -0,0 +1,904 @@ +#!/usr/bin/env ruby +=begin + * Name: SiSU information Structuring Universe + * Author: Ralph Amissah + * http://www.jus.uio.no/sisu + * http://www.jus.uio.no/sisu/SiSU/download + + * Description: generates naive cgi search form for search of sisu database (pgsql) + * Name: SiSU generated sample cgi search form + + * Description: generated sample cgi search form for SiSU + (SiSU is a framework for document structuring, publishing and search) + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007 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 Ralph Amissah + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program. If not, see . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + +=end + require 'cgi' + require 'fcgi' + require 'dbi' + @version='sisu_search_pgsql' + @image_src="http://localhost/sisu/_sisu/image" + @hosturl_db="http://localhost" + @hosturl_files="http://www.jus.uio.no" + @port="5432" + user='' + @@limit,@@offset=1000,0 + @base="#@hosturl_db/cgi-bin/#@version.cgi" + @@canned_search_url=@base + @color_heading='#DDFFAA' + @color_match='#ffff48' + class Form + def initialize(base,search_field,selected_db,checked_index,checked_text,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='') + search_note='' if checked_searched !~/\S/ + the_can='' if checked_url !~/\S/ + search_field='' if checked_echo !~/\S/ + @base,@search_field,@selected_db,@checked_index,@checked_text,@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,checked_index,checked_text,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/ + 'text:__; keywords:__; title:__; author:__; subject:__; description:__; publisher:__; contributor:__; date:__; type:__; format:__; identifier:__; source:__; language:__; relation:__; coverage:__; rights:__; comment:__; abstract:__; filename:__;
' + else '' + end + end + def submission_form + search_form=<<-WOK + + + + + SiSU search form (sample): SiSU information Structuring Universe + + + + + + + + + + +
SiSU --> + + +
+
+ + +
+ + + #@tip + #@search_note + #@the_can +
+
+ + + + to search: select which database to search (drop-down menu below); enter your search query (in the form above); and click on the search button (below) +
+ + + index + text / grep + case sensitive +
+ echo query + result stats + search url + searched + available fields + sql statement +
+ checks: + default + selected + all + none +
+
+ + WOK + end + end + class Search_request #% search_for + attr_accessor :text1,:keywords,:title,:author,: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 + def initialize(search_field='',q='') + @search_field,@q=search_field,q + @text1=@keywords=@title=@author=@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='' + if @search_field=~/\S/ + @text1=text_to_match('text:') + @keywords=text_to_match('key(?:words?)?:') + @title=text_to_match('title:') # DublinCore 1 - title + @author=text_to_match('(?:author|creator)s?:') # DublinCore 2 - creator/author + @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 + @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 + @format=text_to_match('format:') # DublinCore 9 - format + @identifier=text_to_match('identifier:') # DublinCore 10 - identifier + @source=text_to_match('source:') # DublinCore 11 - source + @language=text_to_match('language:') # DublinCore 12 - language + @relation=text_to_match('relation:') # DublinCore 13 - relation + @coverage=text_to_match('coverage:') # DublinCore 14 - coverage + @rights=text_to_match('rights:') # DublinCore 15 - rights + @comment=text_to_match('comment:') + @abstract=text_to_match('abs(?:tract)?:') + @owner=text_to_match('owner:') + @date_created=text_to_match('date_created:') + @date_issued=text_to_match('date_issued:') + @date_modified=text_to_match('date_modified:') + @date_available=text_to_match('date_available:') + @date_valid=text_to_match('date_valid:') + @filename=text_to_match('filename:') + @text1=text_to_match unless @keywords or @author or @title or @text1 or @comment or @abstract or @rights or @subject or @publisher or @date or @filename + else + @text1=q['s1'] if q['s1']=~/\S/ + @keywords=q['key'] if q['key']=~/\S/ + @title=q['ti'] if q['ti']=~/\S/ + @author=q['au'] if q['au']=~/\S/ + @subject=q['sj'] if q['sj']=~/\S/ + @description=q['dsc'] if q['dsc']=~/\S/ + @publisher=q['pb'] if q['pb']=~/\S/ + @contributor=q['cntr'] if q['cntr']=~/\S/ + @date=q['dt'] if q['dt']=~/\S/ + @type=q['ty'] if q['ty']=~/\S/ + @identifier=q['id'] if q['id']=~/\S/ + @source=q['src'] if q['src']=~/\S/ + @language=q['lang'] if q['lang']=~/\S/ + @relation=q['rel'] if q['rel']=~/\S/ + @coverage=q['cov'] if q['cov']=~/\S/ + @rights=q['cr'] if q['cr']=~/\S/ + @comment=q['co'] if q['co']=~/\S/ + @abstract=q['ab'] if q['ab']=~/\S/ + @date_created=q['dtc'] if q['dtc']=~/\S/ + @date_issued=q['dti'] if q['dti']=~/\S/ + @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=q['fns'] if q['fns']=~/\S/ + @@limit=q['ltd'] if q['ltd']=~/\d+/ # 1000 + @@offset=q['off'] if q['off']=~/\d+/ # 0 + end + end + def text_to_match(identifier='') + m={ + :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] + else + str=m[:word].match(@search_field)[1] + str.gsub!(/[()]/,'') + str + end + search_string.strip! + search_string.gsub!(/\s+/,'+') + search_string + #else + # "__" + end + end + end + class Dbi_search_string + def initialize(l,t,q,cse=false) + @l,@t,@q,@c=l,t,q,cse + end + def string + 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) + end + search_construct=[] + if @c + unescaped_search.gsub!(/\s*(AND|OR)\s*/,"' \) \\1 #@l~\( '") + unescaped_search.gsub!(/(.+)/,"#@l~\( '\\1' \)") + else + unescaped_search.gsub!(/\s*(AND|OR)\s*/,"' \) \\1 #@l~*\( '") + unescaped_search.gsub!(/(.+)/,"#@l~*\( '\\1' \)") + end + search_construct << unescaped_search + search_construct=search_construct.join(' ') + search[:search] << search_construct + search[:flag]=true + search + end + search + end + end + class Dbi_search_statement + 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=>'' } + #@offset||=@@offset + #@offset+=@@limit + search={ :text => [],:endnotes => [] } + cse=if c =~/\S/; true + else false + end + st=Dbi_search_string.new('documents.clean',search_for.text1,q['s1'],cse).string + se=Dbi_search_string.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.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.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.creator',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.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.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.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.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.date',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.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.identifier',search_for.identifier,q['id'],cse).string + if st[:flag] + search[:text] << st[:search] + search[:endnotes] << st[:search] + end + st=Dbi_search_string.new('metadata.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.language',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.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.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.rights',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.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.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.filename',search_for.filename,q['fns'],cse).string + if st[:flag] + search[:text] << st[:search] + search[:endnotes] << st[:search] + end + @@limit=q['ltd'] if q['ltd']=~/\d+/ # 1000 + @@offset=q['off'] if q['off']=~/\d+/ # 0 + @search_text,@search_endnotes=[],[] + #% + search[:text].each{|x| @search_text << "#{x} AND " } + @search_text=@search_text.to_s.gsub!(/AND\s+$/,'') + @search_text.gsub!(/(documents\.clean~\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+documents\.clean~\(\s*'[^']+'\s*\))+)/,'(\1)') + search[:endnotes].each{|x| @search_endnotes << "#{x} AND " } + @search_endnotes=@search_endnotes.to_s.gsub!(/AND\s+$/,'') + @search_endnotes.gsub!(/(endnotes\.clean~\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean~\(\s*'[^']+'\s*\))+)/,'(\1)') + end + def sql_offset + @@offset + end + def sql_limit + @@limit + end + def sql_canned_search + @offset_next=sql_offset.to_i + sql_limit.to_i + @offset_previous=sql_offset.to_i - sql_limit.to_i + def current + @@canned_search_url.to_s + '<d=' + sql_limit.to_s + '&off=' + sql_offset.to_s + end + def next + @@canned_search_url.to_s + '<d=' + sql_limit.to_s + '&off=' + @offset_next.to_s + end + def previous + @offset_previous >= 0 ? (@@canned_search_url.to_s + '<d=' + sql_limit.to_s + '&off=' + @offset_previous.to_s) : '' + end + def start + @@canned_search_url.to_s + '<d=' + sql_limit.to_s + '&off=' + 0.to_s + end + self + end + def sql_canned_search_url(ok) + if ok + can=sql_canned_search + page=(sql_offset.to_i + sql_limit.to_i)/sql_limit.to_i + case page.to_s + when /^1$/ + %{

+ pg. #{page.to_s} +   > +
} + when /^2$/ + %{

+ <   + pg. #{page.to_s} +   > +
} + else + %{

+ |<   + <   + pg. #{page.to_s} +   > +
} + end + else '' + end + end + def sql_select_body + limit ||=@@limit + offset ||=@@offset + @sql_statement[:body]=%{SELECT metadata.title, metadata.subtitle, metadata.creator, metadata.filename, metadata.suffix, documents.body, documents.seg, documents.ocn, metadata.tid FROM documents, metadata WHERE (#@search_text) AND documents.metadata_tid = metadata.tid ORDER BY metadata.title, metadata.filename, documents.ocn} + @sql_statement[:range]=%{LIMIT #{limit} OFFSET #{offset} ;} + select=@sql_statement[:body] + ' ' + @sql_statement[:range] + select + end + def sql_select_endnotes + limit ||=@@limit + offset ||=@@offset + @sql_statement[:endnotes]=%{SELECT metadata.title, metadata.subtitle, metadata.creator, metadata.filename, endnotes.body, endnotes.nr, endnotes.ocn, endnotes.metadata_tid FROM metadata, endnotes WHERE (#@search_endnotes) AND metadata.tid = endnotes.metadata_tid ORDER BY metadata.title, metadata.filename, endnotes.nr} + @sql_statement[:range]=%{LIMIT #{limit} OFFSET #{offset} ;} + select=@sql_statement[:endnotes] + ' ' + @sql_statement[:range] + select + end + def sql_select_body_format + %{#{sql_select_body}} + end + def sql_select_endnotes_format + %{#{sql_select_endnotes}} + end + def contents + @conn.select_all(sql_select_body) + end + def endnotes + @conn.select_all(sql_select_endnotes) + end + end + def tail + <<-'WOK' +


+ + + + + +
+

+ + SiSU + +

+
+ +

+ Generated by + + SiSU 0.55.3 2007-07-10 (2007w28/2) +
+ + SiSU © Ralph Amissah + 1993, current 2007. + All Rights Reserved. +
+ + SiSU + is software for document structuring, publishing and search, +
+ + www.jus.uio.no/sisu + + and + + www.sisudoc.org + +
+ w3 since October 3 1993 + + ralph@amissah.com + +

+
+

+ SiSU using: +
Standard SiSU markup syntax, +
Standard SiSU meta-markup syntax, and the +
Standard SiSU object citation numbering and system, (object/text positioning system) +
+ © Ralph Amissah 1997, current 2007. + All Rights Reserved. +

+
+

+ + GPLv3 + +

+
+

+ SiSU is released under + GPL v3 + or later, + + http://www.gnu.org/licenses/gpl.html + +

+
+

+ SiSU, developed using + + Ruby + + on + + Debian/Gnu/Linux + + software infrastructure, + with the usual GPL (or OSS) suspects. +
+ Better - "performance, reliability, scalability, security & total cost of ownership" + [not to mention flexibility & choice] +
+ Get With the Future + + Way Better! + +

+
+ + + WOK + end + @tail=tail + @counter_txt_doc,@counter_txt_ocn,@counter_endn_doc,@counter_endn_ocn=0,0,0,0 + @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 => [] } + q=CGI.new + @db=if cgi['db'] =~/\S+/; + @stub=/SiSU_(\S+)/.match(cgi['db'])[1] + cgi['db'] + else + @stub='sisu' + 'SiSU_sisu' + 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='','','','','','','','','' + if cgi['view']=~/text/; checked_index,checked_text='','checked' + else checked_index,checked_text='checked','' + end + checked_echo='checked' if cgi['echo'] =~/\S/ + checked_stats='checked' if cgi['stats'] =~/\S/ + checked_url='checked' if cgi['url'] =~/\S/ or cgi['u'].to_i==1 + checked_searched='checked' if cgi['searched'] =~/\S/ + checked_tip='checked' if cgi['tip'] =~/\S/ + checked_case='checked' if cgi['casesense'] =~/\S/ + checked_sql='checked' if cgi['sql'] =~/\S/ + if cgi['checks'] =~/check_all/ or cgi['check_all'] =~/\S/ or cgi['a'].to_i==1 + checked_all='checked' + checked_echo=checked_stats=checked_url=checked_searched=checked_tip=checked_sql='checked' + checked_none='' + elsif cgi['checks'] =~/check_none/ + checked_none='checked' + checked_all=checked_url=checked_stats=checked_searched=checked_tip=checked_echo=checked_sql='' + elsif cgi['checks'] =~/check_selected/ + checked_selected='checked' + elsif cgi['checks'] =~/check_default/ + checked_default='checked' + checked_echo=checked_stats=checked_url='checked' + checked_searched=checked_tip=checked_case=checked_sql='' + else + checked_selected='checked' + checked_echo=checked_stats=checked_url='checked' + checked_searched=checked_tip=checked_case=checked_sql='' + end + selected_db=case cgi['db'] + when /SiSU_pace/; '' + when /SiSU_sisu/; '' + end + dbi="dbi:Pg:database=#{@db};port=#{@port}" + @conn=DBI.connect(dbi,user) + search_field=cgi['find'] if cgi['find'] # =~/\S+/ + @search_for=Search_request.new(search_field,q) #.analyze #% search_for + #% searches + #Canned_search.new(@base,@search_for.text1,cgi) + if @search_for.text1=~/\S+/ or @search_for.author=~/\S+/ #and search_field =~/\S/ + s1='s1=' + CGI.escape(@search_for.text1) if @search_for.text1=~/\S/ + key='key=' + CGI.escape(@search_for.keywords) if @search_for.keywords=~/\S/ + ti='&ti=' + CGI.escape(@search_for.title) if @search_for.title=~/\S/ + au='&au=' + CGI.escape(@search_for.author) if @search_for.author=~/\S/ + 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/ + 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/ + id='&id=' + CGI.escape(@search_for.identifier) if @search_for.identifier=~/\S/ + src='&src=' + CGI.escape(@search_for.source) if @search_for.source=~/\S/ + lang='&lang=' + CGI.escape(@search_for.language) if @search_for.language=~/\S/ + rel='&rel=' + CGI.escape(@search_for.relation) if @search_for.relation=~/\S/ + cov='&cov=' + CGI.escape(@search_for.coverage) if @search_for.coverage=~/\S/ + cr='&cr=' + CGI.escape(@search_for.rights) if @search_for.rights=~/\S/ + co='&co=' + CGI.escape(@search_for.comment) if @search_for.comment=~/\S/ + ab='&ab=' + CGI.escape(@search_for.abstract) if @search_for.abstract=~/\S/ + dtc='&dtc=' + CGI.escape(@search_for.date_created) if @search_for.date_created=~/\S/ + dti='&dti=' + CGI.escape(@search_for.date_issued) if @search_for.date_issued=~/\S/ + dtm='&dtm=' + CGI.escape(@search_for.date_modified) if @search_for.date_modified=~/\S/ + dta='&dta=' + CGI.escape(@search_for.date_available) if @search_for.date_available=~/\S/ + 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=if checked_all =~/checked/ + "#@base?#{s1}#{key}#{ti}#{au}#{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" + else "#@base?#{s1}#{key}#{ti}#{au}#{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']}" + end + @canned_base_url="#@base?#{s1}&db=#{cgi['db']}" + if checked_case=~/\S/ + @search[:text][1]=%{documents.clean~'#{@search_for.text1}'} #s1 + @search[:endnotes][1]=%{endnotes.clean~'#{@search_for.text1}'} #s1 + else + @search[:text][1]=%{documents.clean~*'#{@search_for.text1}'} #s1 + @search[:endnotes][1]=%{endnotes.clean~*'#{@search_for.text1}'} #s1 + end + canned_note='search url:' + else + @@canned_search_url="#@base?s1=United+Nations&db=documents&view=index" + canned_note='search url example:' + end + if search_field =~/\S+/ + analyze_format=search_field.gsub(/\s*\n/,'; ') + elsif checked_all =~/checked/ or checked_url =~/checked/ + canned_search=@@canned_search_url.scan(/(?:s1|au|ti|fns)=[^&]+/) + af=canned_search.join('; ') + af.gsub!(/s1=/,'text: ') + af.gsub!(/au=/,'author: ') + af.gsub!(/ti=/,'title: ') + af.gsub!(/fns=/,'filename: ') + af.gsub!(/%2B/,' ') + analyze_format=af + st=af.split(/\s*;\s*/) + search_field=st.join("\n") + end + green=%{} + canned_search_url_txt=CGI.escapeHTML(@@canned_search_url) + the_can=%{#{canned_note} #{canned_search_url_txt}
} + p_text=p_keywords=p_title=p_author=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_subject=p_filename='' + p_text=%{text: #{green}#{@search_for.text1}

} if @search_for.text1 =~/\S+/ + p_keywords=%{keywords: #{green}#{@search_for.keywords}
} if @search_for.keywords =~/\S+/ + p_title=%{title: #{green}#{@search_for.title}
} if @search_for.title =~/\S+/ + p_author=%{author: #{green}#{@search_for.author}
} if @search_for.author =~/\S+/ + p_subject=%{subject: #{green}#{@search_for.subject}
} if @search_for.subject =~/\S+/ + p_description=%{description: #{green}#{@search_for.description}
} if @search_for.description =~/\S+/ + p_publisher=%{publisher: #{green}#{@search_for.publisher}
} if @search_for.publisher =~/\S+/ + p_contributor=%{contributor: #{green}#{@search_for.contributor}
} if @search_for.contributor =~/\S+/ + p_date=%{date: #{green}#{@search_for.date}
} if @search_for.date =~/\S+/ + p_type=%{type: #{green}#{@search_for.type}
} if @search_for.type =~/\S+/ + p_format=%{format: #{green}#{@search_for.format}
} if @search_for.format =~/\S+/ + p_identifier=%{identifier: #{green}#{@search_for.identifier}
} if @search_for.identifier =~/\S+/ + p_source=%{source: #{green}#{@search_for.source}
} if @search_for.source =~/\S+/ + p_language=%{language: #{green}#{@search_for.language}
} if @search_for.language =~/\S+/ + p_relation=%{relation: #{green}#{@search_for.relation}
} if @search_for.relation =~/\S+/ + p_coverage=%{coverage: #{green}#{@search_for.coverage}
} if @search_for.coverage =~/\S+/ + p_rights=%{rights: #{green}#{@search_for.rights}
} if @search_for.rights =~/\S+/ + p_comment=%{comment: #{green}#{@search_for.comment}
} if @search_for.comment =~/\S+/ + p_abstract=%{abstract: #{green}#{@search_for.abstract}
} if @search_for.abstract =~/\S+/ + p_filename=%{filename: #{green}#{@search_for.filename}
} if @search_for.filename =~/\S+/ + search_note=<<-WOK + + database: #{green}#@db; selected view: #{green}#{cgi['view']} + search string: "#{green}#{analyze_format}"
+ #{p_text} #{p_keywords} #{p_title} #{p_author} #{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} + + WOK + #eg = %{canned search e.g.:
#{url}
find: #{analyze}
database: #{database}} + #dbi_canning + @header=Form.new(@base,search_field,selected_db,checked_index,checked_text,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=if @search_for.text1 =~/\S/ + @search_for.text1 + else 'Unavailable' + end + if checked_case=~/\S/ + @search[:text]<<%{documents.clean~'#{CGI.unescape(s1)}'} + @search[:endnotes]<<%{endnotes.clean~'#{CGI.unescape(s1)}'} + else + @search[:text]<<%{documents.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) + @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=[],[] + @search_regx=nil + oldtid=0 + if @text_search_flag + if checked_sql =~/\S/ + sql_select_body=dbi_statement.sql_select_body_format + sql_select_endnotes=dbi_statement.sql_select_endnotes_format + else sql_select_body,sql_select_endnotes='','' + end + @body_main << '



Main Text:
' << sql_select_body + @endnotes << '



Endnotes:
' << sql_select_endnotes + else + end + #text_objects_body + s_contents.each do |c| #% text body + location=c['filename'][/(.+?)\.(?:_?sst|ssm)$/,1] + file_suffix=c['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') + l=".#{l}" + else '' + end + #metadata_found_body + if c['tid'].to_i != oldtid.to_i + ti=if c['subtitle'] =~/\S+/; "#{c['title']} - #{c['subtitle']}" + else c['title'] + end + can_txt_srch=if cgi['view']=~/index/; %{red bullet } + else %{red bullet } + end + title=%{toc html #{ti} by #{c['creator']} #{can_txt_srch}toc html pdf portrait pdf landscape odf manifest
} if file_suffix=~/s/ #hmm watch file_suffix + if @text_search_flag; title='

'+title + else title='
'+title + end + @counter_txt_doc+=1 + oldtid=c['tid'].to_i + else title='' + end + if @text_search_flag + if cgi['view']=~/text/ #% txt body + text=if c['suffix'] !~/1/ #seg + if @search_for.text1 =~/\S+/ or q['s1'] =~/\S+/ #% only this branch is working !! + unescaped_search=if @search_for.text1 =~/\S+/; CGI.unescape(@search_for.text1) + elsif q['s1'] =~/\S+/; CGI.unescape(q['s1']) + else nil + end + @search_regx=if unescaped_search #check + search_regex=[] + build=unescaped_search.scan(/\S+/).each do |g| + if g.to_s =~/(AND|OR)/ + search_regex << '|' + else search_regex << %{#{g.to_s}} + end + end + search_regex=search_regex.join(' ') + search_regex=search_regex.gsub(/\s*\|\s*/,'|') + Regexp.new(search_regex, Regexp::IGNORECASE) + else nil + end + else nil + end + matched_para=if (@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/) + matched=c['body'].gsub(/(<\s]+#{@search_regx}[^>]+?>|#@search_regx)/mi,%{\\1}) + else c['body'] + end + %{

ocn #{c['ocn']}:

#{matched_para}} + elsif c['suffix'] =~/1/ #doc + %{#{title}

ocn #{c['ocn']}:#{c['body']}} + end + @counter_txt_ocn+=1 + output=if c['seg'] =~/\S+/; title+text + else text + end + elsif cgi['view']=~/index/ #% idx body + if c['suffix'] !~/1/ #seg + index=%{#{c['ocn']}, } if @text_search_flag + elsif c['suffix'] =~/1/ #doc + index=%{#{c['ocn']}, } + end + if c['seg'] =~/\S+/ + if @text_search_flag + @counter_txt_ocn+=1 + output=title+index + end + else + @counter_txt_ocn+=1 + output=unless c['suffix'] =~/1/; title+index + else %{#{title}#{c['ocn'].sort}, } + end + end + end + else output=title + end + @counters_txt=if @counter_txt_doc > 0 + if checked_stats =~/\S/ + @@lt_t=if @counter_txt_ocn == dbi_statement.sql_limit.to_i + over='over' + true + else + over='' + false + end + %{


Found in the main body of #@counter_txt_doc documents, and at #{over} #@counter_txt_ocn locations within.
} + else '' + end + else '' + end + @body_main << output #+ details + end + #text_objects_endnote + oldtid = 0 + s_endnotes.each do |e| #% endnotes + location=e['filename'][/(.+?)\.(?:_?sst|ssm)$/,1] + file_suffix=e['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') + l=".#{l}" + else '' + end + #metadata_found_endnotes + if @text_search_flag + if e['metadata_tid'].to_i != oldtid.to_i + ti=if e['subtitle'] =~/\S+/; "#{e['title']} - #{e['subtitle']}" + else e['title'] + end + can_txt_srch=if cgi['view']=~/index/; %{red bullet } + else %{red bullet } + end + title=%{

toc html #{ti} by #{e['creator']} #{can_txt_srch}toc html pdf portraitpdf landscape odf manifest
} if file_suffix=~/s/ + @counter_endn_doc+=1 + oldtid=e['metadata_tid'].to_i + else title = '' + end + if cgi['view']=~/text/ #% txt endnotes + @counter_endn_ocn+=1 + matched_endnote=if (@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/) + matched=e['body'].gsub(/(<\s]+#{@search_regx}[^>]+?>|#@search_regx)/mi,%{\\1}) + else e['body'] + end + output=%{#{title}
note #{e['nr']} referred to from ocn #{e['ocn']}: #{matched_endnote}} + elsif cgi['view']=~/index/ #% idx endnotes + @counter_endn_ocn+=1 + output=%{#{title}#{e['nr']}#{e['ocn']}], } + end + @counters_endn=if @counter_endn_doc > 0 + if checked_stats =~/\S/ + @@lt_e=if @counter_endn_ocn == dbi_statement.sql_limit.to_i + over='over' + true + else + over='' + false + end + %{Found in the endnotes of #@counter_endn_doc documents, and at #{over} #@counter_endn_ocn locations within.
} + else '' + end + end + @endnotes << output #+ details + else @endnotes=[] #does not take out yet + end + end + offset=dbi_statement.sql_offset.to_s + limit=dbi_statement.sql_limit.to_s + @@lt_t ||=false; @@lt_e ||=false + canned=if (@@lt_t or @@lt_e) + dbi_statement.sql_canned_search_url(true).to_s + else + dbi_statement.sql_canned_search_url(false).to_s + end + limit=dbi_statement.sql_limit.to_s + cgi.out{@header + @counters_txt + @counters_endn + @body_main.join + @endnotes.join + canned + @tail} #% print cgi_output_header+counters+body+endnotes + end + rescue Exception => e + s='
' + CGI::escapeHTML(e.backtrace.reverse.join("\n"))
+          s << CGI::escapeHTML(e.message) + '
' + cgi.out{s} + next + ensure # eg. disconnect from server + @conn.disconnect if @conn + end + end diff --git a/data/sisu/v3/conf/cgi-bin/sisu_search_sqlite.cgi b/data/sisu/v3/conf/cgi-bin/sisu_search_sqlite.cgi new file mode 100644 index 00000000..34bb3748 --- /dev/null +++ b/data/sisu/v3/conf/cgi-bin/sisu_search_sqlite.cgi @@ -0,0 +1,901 @@ +#!/usr/bin/env ruby +=begin + * Name: SiSU information Structuring Universe + * Author: Ralph Amissah + * http://www.jus.uio.no/sisu + * http://www.jus.uio.no/sisu/SiSU/download + + * Description: generates naive cgi search form for search of sisu database (sqlite) + * Name: SiSU generated sample cgi search form + + * Description: generated sample cgi search form for SiSU + (SiSU is a framework for document structuring, publishing and search) + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007 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 Ralph Amissah + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program. If not, see . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + +=end + require 'cgi' + require 'fcgi' + require 'dbi' + @version='sisu_search_sqlite' + @image_src="http://localhost/sisu/_sisu/image" + @hosturl_db="http://localhost" + @hosturl_files="http://www.jus.uio.no" + @@limit,@@offset=1000,0 + @base="#@hosturl_db/cgi-bin/#@version.cgi" + @@canned_search_url=@base + @color_heading='#DDFFAA' + @color_match='#ffff48' + class Form + def initialize(base,search_field,selected_db,checked_index,checked_text,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='') + search_note='' if checked_searched !~/\S/ + the_can='' if checked_url !~/\S/ + search_field='' if checked_echo !~/\S/ + @base,@search_field,@selected_db,@checked_index,@checked_text,@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,checked_index,checked_text,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/ + 'text:__; keywords:__; title:__; author:__; subject:__; description:__; publisher:__; contributor:__; date:__; type:__; format:__; identifier:__; source:__; language:__; relation:__; coverage:__; rights:__; comment:__; abstract:__; filename:__;
' + else '' + end + end + def submission_form + search_form=<<-WOK + + + + + SiSU search form (sample): SiSU information Structuring Universe + + + + + + + + + + +
SiSU --> + + +
+
+ + +
+ + + #@tip + #@search_note + #@the_can +
+
+ + + + to search: select which database to search (drop-down menu below); enter your search query (in the form above); and click on the search button (below) +
+ + + index + text / grep +
+ echo query + result stats + search url + searched + available fields + sql statement +
+ checks: + default + selected + all + none +
+
+ + WOK + end + end + class Search_request #% search_for + attr_accessor :text1,:keywords,:title,:author,: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 + def initialize(search_field='',q='') + @search_field,@q=search_field,q + @text1=@keywords=@title=@author=@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='' + if @search_field=~/\S/ + @text1=text_to_match('text:') + @keywords=text_to_match('key(?:words?)?:') + @title=text_to_match('title:') # DublinCore 1 - title + @author=text_to_match('(?:author|creator)s?:') # DublinCore 2 - creator/author + @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 + @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 + @format=text_to_match('format:') # DublinCore 9 - format + @identifier=text_to_match('identifier:') # DublinCore 10 - identifier + @source=text_to_match('source:') # DublinCore 11 - source + @language=text_to_match('language:') # DublinCore 12 - language + @relation=text_to_match('relation:') # DublinCore 13 - relation + @coverage=text_to_match('coverage:') # DublinCore 14 - coverage + @rights=text_to_match('rights:') # DublinCore 15 - rights + @comment=text_to_match('comment:') + @abstract=text_to_match('abs(?:tract)?:') + @owner=text_to_match('owner:') + @date_created=text_to_match('date_created:') + @date_issued=text_to_match('date_issued:') + @date_modified=text_to_match('date_modified:') + @date_available=text_to_match('date_available:') + @date_valid=text_to_match('date_valid:') + @filename=text_to_match('filename:') + @text1=text_to_match unless @keywords or @author or @title or @text1 or @comment or @abstract or @rights or @subject or @publisher or @date or @filename + else + @text1=q['s1'] if q['s1']=~/\S/ + @keywords=q['key'] if q['key']=~/\S/ + @title=q['ti'] if q['ti']=~/\S/ + @author=q['au'] if q['au']=~/\S/ + @subject=q['sj'] if q['sj']=~/\S/ + @description=q['dsc'] if q['dsc']=~/\S/ + @publisher=q['pb'] if q['pb']=~/\S/ + @contributor=q['cntr'] if q['cntr']=~/\S/ + @date=q['dt'] if q['dt']=~/\S/ + @type=q['ty'] if q['ty']=~/\S/ + @identifier=q['id'] if q['id']=~/\S/ + @source=q['src'] if q['src']=~/\S/ + @language=q['lang'] if q['lang']=~/\S/ + @relation=q['rel'] if q['rel']=~/\S/ + @coverage=q['cov'] if q['cov']=~/\S/ + @rights=q['cr'] if q['cr']=~/\S/ + @comment=q['co'] if q['co']=~/\S/ + @abstract=q['ab'] if q['ab']=~/\S/ + @date_created=q['dtc'] if q['dtc']=~/\S/ + @date_issued=q['dti'] if q['dti']=~/\S/ + @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=q['fns'] if q['fns']=~/\S/ + @@limit=q['ltd'] if q['ltd']=~/\d+/ # 1000 + @@offset=q['off'] if q['off']=~/\d+/ # 0 + end + end + def text_to_match(identifier='') + m={ + :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] + else + str=m[:word].match(@search_field)[1] + str.gsub!(/[()]/,'') + str + end + search_string.strip! + search_string.gsub!(/\s+/,'+') + search_string + #else + # "__" + end + end + end + class Dbi_search_string + def initialize(l,t,q,cse=false) + @l,@t,@q=l,t,q + end + def string + search={ :search => [],:flag => false } + if @t =~/\S+/ or @q =~/\S+/ + if @t =~/\S+/; unescaped_search=CGI.unescape(@t) + elsif @q =~/\S+/; unescaped_search=CGI.unescape(@q) + end + search_construct=[] + unescaped_search.gsub!(/\s*(AND|OR)\s*/,"%' \) \\1 #@l LIKE \( '%") + unescaped_search.gsub!(/(.+)/,"#@l LIKE \( '%\\1%' \)") + search_construct << unescaped_search + search_construct=search_construct.join(' ') + search[:search] << search_construct + search[:flag]=true + search + end + search + end + end + class Dbi_search_statement + 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=>'' } + #@offset||=@@offset + #@offset+=@@limit + search={ :text => [],:endnotes => [] } + cse=if c =~/\S/; true + else false + end + st=Dbi_search_string.new('documents.clean',search_for.text1,q['s1'],cse).string + se=Dbi_search_string.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.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.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.creator',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.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.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.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.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.date',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.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.identifier',search_for.identifier,q['id'],cse).string + if st[:flag] + search[:text] << st[:search] + search[:endnotes] << st[:search] + end + st=Dbi_search_string.new('metadata.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.language',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.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.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.rights',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.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.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.filename',search_for.filename,q['fns'],cse).string + if st[:flag] + search[:text] << st[:search] + search[:endnotes] << st[:search] + end + @@limit=q['ltd'] if q['ltd']=~/\d+/ # 1000 + @@offset=q['off'] if q['off']=~/\d+/ # 0 + @search_text,@search_endnotes=[],[] + #% + search[:text].each{|x| @search_text << "#{x} AND " } + @search_text=@search_text.to_s.gsub!(/AND\s+$/,'') + @search_text.gsub!(/(documents\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+documents\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)') + search[:endnotes].each{|x| @search_endnotes << "#{x} AND " } + @search_endnotes=@search_endnotes.to_s.gsub!(/AND\s+$/,'') + @search_text.gsub!(/(endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)') + end + def sql_offset + @@offset + end + def sql_limit + @@limit + end + def sql_canned_search + @offset_next=sql_offset.to_i + sql_limit.to_i + @offset_previous=sql_offset.to_i - sql_limit.to_i + def current + @@canned_search_url.to_s + '<d=' + sql_limit.to_s + '&off=' + sql_offset.to_s + end + def next + @@canned_search_url.to_s + '<d=' + sql_limit.to_s + '&off=' + @offset_next.to_s + end + def previous + @offset_previous >= 0 ? (@@canned_search_url.to_s + '<d=' + sql_limit.to_s + '&off=' + @offset_previous.to_s) : '' + end + def start + @@canned_search_url.to_s + '<d=' + sql_limit.to_s + '&off=' + 0.to_s + end + self + end + def sql_canned_search_url(ok) + if ok + can=sql_canned_search + page=(sql_offset.to_i + sql_limit.to_i)/sql_limit.to_i + case page.to_s + when /^1$/ + %{

+ pg. #{page.to_s} +   > +
} + when /^2$/ + %{

+ <   + pg. #{page.to_s} +   > +
} + else + %{

+ |<   + <   + pg. #{page.to_s} +   > +
} + end + else '' + end + end + def sql_select_body + limit ||=@@limit + offset ||=@@offset + @sql_statement[:body]=%{SELECT metadata.title, metadata.subtitle, metadata.creator, metadata.filename, metadata.suffix, documents.body, documents.seg, documents.ocn, metadata.tid FROM documents, metadata WHERE #{@search_text} AND documents.metadata_tid = metadata.tid ORDER BY metadata.title, metadata.filename, documents.ocn} + @sql_statement[:range]=%{LIMIT #{limit} OFFSET #{offset} ;} + select=@sql_statement[:body] + ' ' + @sql_statement[:range] + select + end + def sql_select_endnotes + limit ||=@@limit + offset ||=@@offset + @sql_statement[:endnotes]= %{SELECT metadata.title, metadata.subtitle, metadata.creator, metadata.filename, endnotes.body, endnotes.nr, endnotes.ocn, endnotes.metadata_tid FROM metadata, endnotes WHERE #{@search_endnotes} AND metadata.tid = endnotes.metadata_tid ORDER BY metadata.title, metadata.filename, endnotes.nr} + @sql_statement[:range]=%{LIMIT #{limit} OFFSET #{offset} ;} + select=@sql_statement[:endnotes] + ' ' + @sql_statement[:range] + select + end + def sql_select_body_format + %{#{sql_select_body}} + end + def sql_select_endnotes_format + %{#{sql_select_endnotes}} + end + def contents + @conn.select_all(sql_select_body) + end + def endnotes + @conn.select_all(sql_select_endnotes) + end + end + def tail + <<-'WOK' +


+ + + + + +
+

+ + SiSU + +

+
+ +

+ Generated by + + SiSU 0.55.3 2007-07-10 (2007w28/2) +
+ + SiSU © Ralph Amissah + 1993, current 2007. + All Rights Reserved. +
+ + SiSU + is software for document structuring, publishing and search, +
+ + www.jus.uio.no/sisu + + and + + www.sisudoc.org + +
+ w3 since October 3 1993 + + ralph@amissah.com + +

+
+

+ SiSU using: +
Standard SiSU markup syntax, +
Standard SiSU meta-markup syntax, and the +
Standard SiSU object citation numbering and system, (object/text positioning system) +
+ © Ralph Amissah 1997, current 2007. + All Rights Reserved. +

+
+

+ + GPLv3 + +

+
+

+ SiSU is released under + GPL v3 + or later, + + http://www.gnu.org/licenses/gpl.html + +

+
+

+ SiSU, developed using + + Ruby + + on + + Debian/Gnu/Linux + + software infrastructure, + with the usual GPL (or OSS) suspects. +
+ Better - "performance, reliability, scalability, security & total cost of ownership" + [not to mention flexibility & choice] +
+ Get With the Future + + Way Better! + +

+
+ + + WOK + end + @tail=tail + @counter_txt_doc,@counter_txt_ocn,@counter_endn_doc,@counter_endn_ocn=0,0,0,0 + @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 => [] } + q=CGI.new + @db=if cgi['db'] =~/\S+/; + @stub=/SiSU_(\S+)/.match(cgi['db'])[1] + cgi['db'] + else + @stub='sisu' + 'SiSU_sisu' + 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='','','','','','','','','' + if cgi['view']=~/text/; checked_index,checked_text='','checked' + else checked_index,checked_text='checked','' + end + checked_echo='checked' if cgi['echo'] =~/\S/ + checked_stats='checked' if cgi['stats'] =~/\S/ + checked_url='checked' if cgi['url'] =~/\S/ or cgi['u'].to_i==1 + checked_searched='checked' if cgi['searched'] =~/\S/ + checked_tip='checked' if cgi['tip'] =~/\S/ + checked_case='checked' if cgi['casesense'] =~/\S/ + checked_sql='checked' if cgi['sql'] =~/\S/ + if cgi['checks'] =~/check_all/ or cgi['check_all'] =~/\S/ or cgi['a'].to_i==1 + checked_all='checked' + checked_echo=checked_stats=checked_url=checked_searched=checked_tip=checked_sql='checked' + checked_none='' + elsif cgi['checks'] =~/check_none/ + checked_none='checked' + checked_all=checked_url=checked_stats=checked_searched=checked_tip=checked_echo=checked_sql='' + elsif cgi['checks'] =~/check_selected/ + checked_selected='checked' + elsif cgi['checks'] =~/check_default/ + checked_default='checked' + checked_echo=checked_stats=checked_url='checked' + checked_searched=checked_tip=checked_case=checked_sql='' + else + checked_selected='checked' + checked_echo=checked_stats=checked_url='checked' + checked_searched=checked_tip=checked_case=checked_sql='' + end + selected_db=case cgi['db'] + when /SiSU_pace/; '' + when /SiSU_sisu/; '' + end + db_name='sisu_sqlite.db' + db_sqlite=case cgi['db'] + when /SiSU_pace/; "/home/ralph/sisu_www/pace/sisu_sqlite.db" + when /SiSU_sisu/; "/home/ralph/sisu_www/sisu/sisu_sqlite.db" + end + @dbi="DBI:SQLite:#{db_sqlite}" #sqlite3 ? + @conn=DBI.connect(@dbi) + search_field=cgi['find'] if cgi['find'] # =~/\S+/ + @search_for=Search_request.new(search_field,q) #.analyze #% search_for + #% searches + #Canned_search.new(@base,@search_for.text1,cgi) + if @search_for.text1=~/\S+/ or @search_for.author=~/\S+/ #and search_field =~/\S/ + s1='s1=' + CGI.escape(@search_for.text1) if @search_for.text1=~/\S/ + key='key=' + CGI.escape(@search_for.keywords) if @search_for.keywords=~/\S/ + ti='&ti=' + CGI.escape(@search_for.title) if @search_for.title=~/\S/ + au='&au=' + CGI.escape(@search_for.author) if @search_for.author=~/\S/ + 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/ + 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/ + id='&id=' + CGI.escape(@search_for.identifier) if @search_for.identifier=~/\S/ + src='&src=' + CGI.escape(@search_for.source) if @search_for.source=~/\S/ + lang='&lang=' + CGI.escape(@search_for.language) if @search_for.language=~/\S/ + rel='&rel=' + CGI.escape(@search_for.relation) if @search_for.relation=~/\S/ + cov='&cov=' + CGI.escape(@search_for.coverage) if @search_for.coverage=~/\S/ + cr='&cr=' + CGI.escape(@search_for.rights) if @search_for.rights=~/\S/ + co='&co=' + CGI.escape(@search_for.comment) if @search_for.comment=~/\S/ + ab='&ab=' + CGI.escape(@search_for.abstract) if @search_for.abstract=~/\S/ + dtc='&dtc=' + CGI.escape(@search_for.date_created) if @search_for.date_created=~/\S/ + dti='&dti=' + CGI.escape(@search_for.date_issued) if @search_for.date_issued=~/\S/ + dtm='&dtm=' + CGI.escape(@search_for.date_modified) if @search_for.date_modified=~/\S/ + dta='&dta=' + CGI.escape(@search_for.date_available) if @search_for.date_available=~/\S/ + 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=if checked_all =~/checked/ + "#@base?#{s1}#{key}#{ti}#{au}#{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" + else "#@base?#{s1}#{key}#{ti}#{au}#{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']}" + end + @canned_base_url="#@base?#{s1}&db=#{cgi['db']}" + if checked_case=~/\S/ + @search[:text][1]=%{documents.clean~'#{@search_for.text1}'} #s1 + @search[:endnotes][1]=%{endnotes.clean~'#{@search_for.text1}'} #s1 + else + @search[:text][1]=%{documents.clean~*'#{@search_for.text1}'} #s1 + @search[:endnotes][1]=%{endnotes.clean~*'#{@search_for.text1}'} #s1 + end + canned_note='search url:' + else + @@canned_search_url="#@base?s1=United+Nations&db=documents&view=index" + canned_note='search url example:' + end + if search_field =~/\S+/ + analyze_format=search_field.gsub(/\s*\n/,'; ') + elsif checked_all =~/checked/ or checked_url =~/checked/ + canned_search=@@canned_search_url.scan(/(?:s1|au|ti|fns)=[^&]+/) + af=canned_search.join('; ') + af.gsub!(/s1=/,'text: ') + af.gsub!(/au=/,'author: ') + af.gsub!(/ti=/,'title: ') + af.gsub!(/fns=/,'filename: ') + af.gsub!(/%2B/,' ') + analyze_format=af + st=af.split(/\s*;\s*/) + search_field=st.join("\n") + end + green=%{} + canned_search_url_txt=CGI.escapeHTML(@@canned_search_url) + the_can=%{#{canned_note} #{canned_search_url_txt}
} + p_text=p_keywords=p_title=p_author=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_subject=p_filename='' + p_text=%{text: #{green}#{@search_for.text1}

} if @search_for.text1 =~/\S+/ + p_keywords=%{keywords: #{green}#{@search_for.keywords}
} if @search_for.keywords =~/\S+/ + p_title=%{title: #{green}#{@search_for.title}
} if @search_for.title =~/\S+/ + p_author=%{author: #{green}#{@search_for.author}
} if @search_for.author =~/\S+/ + p_subject=%{subject: #{green}#{@search_for.subject}
} if @search_for.subject =~/\S+/ + p_description=%{description: #{green}#{@search_for.description}
} if @search_for.description =~/\S+/ + p_publisher=%{publisher: #{green}#{@search_for.publisher}
} if @search_for.publisher =~/\S+/ + p_contributor=%{contributor: #{green}#{@search_for.contributor}
} if @search_for.contributor =~/\S+/ + p_date=%{date: #{green}#{@search_for.date}
} if @search_for.date =~/\S+/ + p_type=%{type: #{green}#{@search_for.type}
} if @search_for.type =~/\S+/ + p_format=%{format: #{green}#{@search_for.format}
} if @search_for.format =~/\S+/ + p_identifier=%{identifier: #{green}#{@search_for.identifier}
} if @search_for.identifier =~/\S+/ + p_source=%{source: #{green}#{@search_for.source}
} if @search_for.source =~/\S+/ + p_language=%{language: #{green}#{@search_for.language}
} if @search_for.language =~/\S+/ + p_relation=%{relation: #{green}#{@search_for.relation}
} if @search_for.relation =~/\S+/ + p_coverage=%{coverage: #{green}#{@search_for.coverage}
} if @search_for.coverage =~/\S+/ + p_rights=%{rights: #{green}#{@search_for.rights}
} if @search_for.rights =~/\S+/ + p_comment=%{comment: #{green}#{@search_for.comment}
} if @search_for.comment =~/\S+/ + p_abstract=%{abstract: #{green}#{@search_for.abstract}
} if @search_for.abstract =~/\S+/ + p_filename=%{filename: #{green}#{@search_for.filename}
} if @search_for.filename =~/\S+/ + search_note=<<-WOK + + database: #{green}#@db; selected view: #{green}#{cgi['view']} + search string: "#{green}#{analyze_format}"
+ #{p_text} #{p_keywords} #{p_title} #{p_author} #{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} + + WOK + #eg = %{canned search e.g.:
#{url}
find: #{analyze}
database: #{database}} + #dbi_canning + @header=Form.new(@base,search_field,selected_db,checked_index,checked_text,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=if @search_for.text1 =~/\S/ + @search_for.text1 + else 'Unavailable' + end + if checked_case=~/\S/ + @search[:text]<<%{documents.clean~'#{CGI.unescape(s1)}'} + @search[:endnotes]<<%{endnotes.clean~'#{CGI.unescape(s1)}'} + else + @search[:text]<<%{documents.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) + @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=[],[] + @search_regx=nil + oldtid=0 + if @text_search_flag + if checked_sql =~/\S/ + sql_select_body=dbi_statement.sql_select_body_format + sql_select_endnotes=dbi_statement.sql_select_endnotes_format + else sql_select_body,sql_select_endnotes='','' + end + @body_main << '



Main Text:
' << sql_select_body + @endnotes << '



Endnotes:
' << sql_select_endnotes + else + end + #text_objects_body + s_contents.each do |c| #% text body + location=c['filename'][/(.+?)\.(?:_?sst|ssm)$/,1] + file_suffix=c['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') + l=".#{l}" + else '' + end + #metadata_found_body + if c['tid'].to_i != oldtid.to_i + ti=if c['subtitle'] =~/\S+/; "#{c['title']} - #{c['subtitle']}" + else c['title'] + end + can_txt_srch=if cgi['view']=~/index/; %{red bullet } + else %{red bullet } + end + title=%{toc html #{ti} by #{c['creator']} #{can_txt_srch}toc html pdf portrait pdf landscape odf manifest
} if file_suffix=~/s/ #hmm watch file_suffix + if @text_search_flag; title='

'+title + else title='
'+title + end + @counter_txt_doc+=1 + oldtid=c['tid'].to_i + else title='' + end + if @text_search_flag + if cgi['view']=~/text/ #% txt body + text=if c['suffix'] !~/1/ #seg + if @search_for.text1 =~/\S+/ or q['s1'] =~/\S+/ #% only this branch is working !! + unescaped_search=if @search_for.text1 =~/\S+/; CGI.unescape(@search_for.text1) + elsif q['s1'] =~/\S+/; CGI.unescape(q['s1']) + else nil + end + @search_regx=if unescaped_search #check + search_regex=[] + build=unescaped_search.scan(/\S+/).each do |g| + if g.to_s =~/(AND|OR)/ + search_regex << '|' + else search_regex << %{#{g.to_s}} + end + end + search_regex=search_regex.join(' ') + search_regex=search_regex.gsub(/\s*\|\s*/,'|') + Regexp.new(search_regex, Regexp::IGNORECASE) + else nil + end + else nil + end + matched_para=if (@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/) + matched=c['body'].gsub(/(<\s]+#{@search_regx}[^>]+?>|#@search_regx)/mi,%{\\1}) + else c['body'] + end + %{

ocn #{c['ocn']}:

#{matched_para}} + elsif c['suffix'] =~/1/ #doc + %{#{title}

ocn #{c['ocn']}:#{c['body']}} + end + @counter_txt_ocn+=1 + output=if c['seg'] =~/\S+/; title+text + else text + end + elsif cgi['view']=~/index/ #% idx body + if c['suffix'] !~/1/ #seg + index=%{#{c['ocn']}, } if @text_search_flag + elsif c['suffix'] =~/1/ #doc + index=%{#{c['ocn']}, } + end + if c['seg'] =~/\S+/ + if @text_search_flag + @counter_txt_ocn+=1 + output=title+index + end + else + @counter_txt_ocn+=1 + output=unless c['suffix'] =~/1/; title+index + else %{#{title}#{c['ocn'].sort}, } + end + end + end + else output=title + end + @counters_txt=if @counter_txt_doc > 0 + if checked_stats =~/\S/ + @@lt_t=if @counter_txt_ocn == dbi_statement.sql_limit.to_i + over='over' + true + else + over='' + false + end + %{


Found in the main body of #@counter_txt_doc documents, and at #{over} #@counter_txt_ocn locations within.
} + else '' + end + else '' + end + @body_main << output #+ details + end + #text_objects_endnote + oldtid = 0 + s_endnotes.each do |e| #% endnotes + location=e['filename'][/(.+?)\.(?:_?sst|ssm)$/,1] + file_suffix=e['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') + l=".#{l}" + else '' + end + #metadata_found_endnotes + if @text_search_flag + if e['metadata_tid'].to_i != oldtid.to_i + ti=if e['subtitle'] =~/\S+/; "#{e['title']} - #{e['subtitle']}" + else e['title'] + end + can_txt_srch=if cgi['view']=~/index/; %{red bullet } + else %{red bullet } + end + title=%{

toc html #{ti} by #{e['creator']} #{can_txt_srch}toc html pdf portraitpdf landscape odf manifest
} if file_suffix=~/s/ + @counter_endn_doc+=1 + oldtid=e['metadata_tid'].to_i + else title = '' + end + if cgi['view']=~/text/ #% txt endnotes + @counter_endn_ocn+=1 + matched_endnote=if (@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/) + matched=e['body'].gsub(/(<\s]+#{@search_regx}[^>]+?>|#@search_regx)/mi,%{\\1}) + else e['body'] + end + output=%{#{title}
note #{e['nr']} referred to from ocn #{e['ocn']}: #{matched_endnote}} + elsif cgi['view']=~/index/ #% idx endnotes + @counter_endn_ocn+=1 + output=%{#{title}#{e['nr']}#{e['ocn']}], } + end + @counters_endn=if @counter_endn_doc > 0 + if checked_stats =~/\S/ + @@lt_e=if @counter_endn_ocn == dbi_statement.sql_limit.to_i + over='over' + true + else + over='' + false + end + %{Found in the endnotes of #@counter_endn_doc documents, and at #{over} #@counter_endn_ocn locations within.
} + else '' + end + end + @endnotes << output #+ details + else @endnotes=[] #does not take out yet + end + end + offset=dbi_statement.sql_offset.to_s + limit=dbi_statement.sql_limit.to_s + @@lt_t ||=false; @@lt_e ||=false + canned=if (@@lt_t or @@lt_e) + dbi_statement.sql_canned_search_url(true).to_s + else + dbi_statement.sql_canned_search_url(false).to_s + end + limit=dbi_statement.sql_limit.to_s + cgi.out{@header + @counters_txt + @counters_endn + @body_main.join + @endnotes.join + canned + @tail} #% print cgi_output_header+counters+body+endnotes + end + rescue Exception => e + s='
' + CGI::escapeHTML(e.backtrace.reverse.join("\n"))
+          s << CGI::escapeHTML(e.message) + '
' + cgi.out{s} + next + ensure # eg. disconnect from server + @conn.disconnect if @conn + end + end diff --git a/data/sisu/v3/conf/completion/README b/data/sisu/v3/conf/completion/README new file mode 100644 index 00000000..d723a140 --- /dev/null +++ b/data/sisu/v3/conf/completion/README @@ -0,0 +1,7 @@ +_sisu (naive zsh completion for SiSU) + on Debian file is located at /usr/share/sisu/conf/completion + installation: works if copied somewhere within your $fpath + do it yourself on Debian copy to ~/.zfunc or + /usr/local/share/zsh/site-functions and run compinit + + note zsh is not installed by default on a Debian system diff --git a/data/sisu/v3/conf/completion/_sisu b/data/sisu/v3/conf/completion/_sisu new file mode 100644 index 00000000..076795cb --- /dev/null +++ b/data/sisu/v3/conf/completion/_sisu @@ -0,0 +1,64 @@ +#compdef sisu +# Copyright (C) 2006 Ralph Amissah +# sisu, version 0.46.1 +# same license as Zsh or SiSU +local curcontext="$curcontext" state line ret=1 +typeset -A opt_args +_arguments -s -C -M 'r:|[_-]=* r:|=*' \ + '(--convert --to -C)-U[prints to screen url output map of available output possibilities]' \ + '(--convert --to -C)-u[url mapping of output files for requested processing flags]' \ + '(--convert --to -C)-V[more verbose than -v]' \ + '(--convert --to -C)-v[verbose]' \ + '--no-ocn[-\[hHp\]switches off object citation numbering]' \ + '--no-annotate[-\[mhHpoxXabN\] strips output text of additional editors endnotes]' \ + '(--convert --to -C)-A[plaintext with dos line-feeds, footnotes follow paragraphs in which they occur]' \ + '(--convert --to -C)-a[plaintext with Unix line-feeds, footnotes follow paragraphs in which they occur]' \ + '(--convert --to -C)-b[XHTML output]' \ + '(- *)-C[initialise site]' \ + '(--convert --to -C)-c[toggle screen color on or off depending on set default]' \ + '(--convert --to -C)-E[plaintext with dos line-feeds, endnotes following main text]' \ + '(--convert --to -C)-e[plaintext with Unix line-feeds, endnotes following main text]' \ + '(--convert --to -C)-F[generate sample cgi web search form \[--webserv=webrick for sisu webrick url\]]' \ + '(--convert --to -C -h)-H[HTML output, without link suffixes]' \ + '(--convert --to -C -H)-h[HTML output]' \ + '(--convert --to -C)-I[texinfo output, not maintained]' \ + '(--convert --to -C)-L[print license info]' \ + '(--convert --to -C)-M[maintenance mode, retain intermediate processing files]' \ + '(--convert --to -C)-m[create intermediate markup file, metaverse, assumed for most output instuctions]' \ + '(--convert --to -C)-N[document content certificate, output document digests]' \ + '(--convert --to -C)-n[skip intermediate markup, skip -m]' \ + '(--convert --to -C)-o[Open Document text format output]' \ + '(--convert --to -C)-p[LaTeX pdf output]' \ + '(--convert --to -C)-q[quiet mode]' \ + '(--convert --to -C)-R[post output to remote host using rsync, requires pre-configuration]' \ + '(--convert --to -C)-r[post output to remote host using scp, requires pre-configuration]' \ + '(--convert --to -C)-S[produces and shares tarred gzipped markup source document with associated images etc.]' \ + '(--convert --to -C)-s[shares markup source]' \ + '(--convert --to -C)-t[termsheet, preprocessing]' \ + '(- *)-W[starts ruby webrick server]' \ + '(--convert --to -C)-w[concordance file]' \ + '(--convert --to -C)-X[XML dom style]' \ + '(--convert --to -C)-x[XML sax style]' \ + '(--convert --to -C)-y[output summary page, manifest of existing generated output]' \ + '(--convert --to -C)-Z[Zap delete/destroy output]' \ + '--import[-\[Dd\] imports document to database]' \ + '--update[-\[Dd\] updates document in database]' \ + '--remove[-\[Dd\] removes document from database]' \ + '--dropall[-\[Dd\] drops database, tables, indexes, all!]' \ + '--create[-\[Dd\] creates new database - tables, indexes, etc.]' \ + '--recreate[-\[Dd\] drops database, killing data and creates new empty database - tables, indexes, etc.]' \ + '(--convert --to -C)-D[postgresql database instruction]' \ + '(--convert --to -C)-d[sqlite database instruction]' \ + '(- *)--help[display help information]' \ + '(--convert --to -C -2 -3 -4 -5)-1[shortcut, initial default -mNHwpy]' \ + '(--convert --to -C -1 -3 -4 -5)-2[shortcut, initial default -mNHwpaoy]' \ + '(--convert --to -C -1 -2 -4 -5)-3[shortcut, initial default -mNHwpaobxXy]' \ + '(--convert --to -C -1 -2 -3 -5)-4[shortcut, initial default -mNHwpaobxXDy --import]' \ + '(--convert --to -C -1 -2 -3 -4)-5[shortcut, initial default -mNHwpaobxXDy --update]' \ + '--to=node[XML node based input representation, experimental]' \ + '--to=sax[XML sax based input representation, experimental]' \ + '--to=dom[XML dom based input representation, experimental]' \ + '--convert=footnotes[embedded footnotes]' \ + '--to=current[current markup]' \ + '--to=xml2sst[from sisu xml to sst]' \ + '*:SiSU files:_files -g "*.(sst|ssm)(.)"' diff --git a/data/sisu/v3/conf/convert/kdissert_to_sisu b/data/sisu/v3/conf/convert/kdissert_to_sisu new file mode 100644 index 00000000..35921c3e --- /dev/null +++ b/data/sisu/v3/conf/convert/kdissert_to_sisu @@ -0,0 +1,161 @@ +#!/usr/bin/env ruby +=begin + * Name: modify.rb + * Author: Ralph Amissah + * http://www.jus.uio.no/sisu + * http://www.jus.uio.no/sisu/SiSU/download + * Description: Conversion script from kdissert .kdi to sisu markup .sst + * 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 + + © Ralph Amissah 1997, current 2006. + All Rights Reserved. + + * Ralph Amissah: ralph@amissah.com + ralph.amissah@gmail.com +=end +require 'rexml/document' +include REXML +argv=$* +@sisu,@sisu_base=Array.new,Array.new +unless argv.empty? + argv.each do |kdi| + if kdi =~/\.kdi$/ + system("cp #{kdi} #{kdi}.tar.gz && tar xzvf #{kdi}.tar.gz && rm #{kdi}.tar.gz") + file=File.new("maindoc.xml") + #system("cp #{kdi} /tmp/. && cd /tmp && tar xzvf /tmp/#{kdi} && cd -") + #file=File.new("/tmp/maindoc.xml") + @output=File.new("#{kdi}.sst",'w') + doc=Document.new(file) + root=doc.root + @el=Array.new + root.each do |x| + end + root.each_with_index do |content,idx| + if root.elements["item[#{idx}]/summary"] + id,ma,ch=nil,nil,Array.new + if root.elements["item[#{idx}]/id"] + id=root.elements["item[#{idx}]/id"].text.to_i + end + if root.elements["item[#{idx}]/parent"] + ma=root.elements["item[#{idx}]/parent"].text.to_s + end + if root.elements["item[#{idx}]/child"] #problem only get one child, even where several + root.get_elements("item[#{idx}]/child").each do |x| + ch << x.text + end + end + if root.elements["item[#{idx}]/summary"] + sum=root.elements["item[#{idx}]/summary"].text.to_s.strip + end + if root.elements["item[#{idx}]/text"] + txt=root.elements["item[#{idx}]/text"].text.to_s.strip + end + @el[id]=Hash.new + @el[id][:id]=id + @el[id][:ma]=ma + @el[id][:ch]=ch + @el[id][:sum]=sum + @el[id][:txt]=txt + if ma == '-1' + @el[id][:lev]=':A' + @top=id + end + end + end + @doc=Array.new + @title=@el[@top][:sum] + p @el[@top][:sum] + @doc << ':A~ ' + @el[@top][:sum] + @el[@top][:ch].each do |x| + @el[x.to_i][:lev]='1' + @doc << '1~ ' + @el[x.to_i][:sum] + @doc << @el[x.to_i][:txt] + @el[x.to_i][:ch].each do |y| + @el[y.to_i][:lev]='2' + @doc << '2~ ' + @el[y.to_i][:sum] + @doc << @el[y.to_i][:txt] + @el[y.to_i][:ch].each do |z| + @el[z.to_i][:lev]='3' + @doc << '3~ ' + @el[z.to_i][:sum] + @doc << @el[z.to_i][:txt] + @el[z.to_i][:ch].each do |za| #unsupported... consder + @el[za.to_i][:lev]='4' + @doc << '!_ ' + @el[za.to_i][:sum] + @doc << @el[za.to_i][:txt] + end + end + end + end + #@el.each_with_index do |x,i| + # if x: puts "#{i}: lev: #{x[:lev]}, id: #{x[:id]}, ma: #{x[:ma]}, ch: #{x[:ch].join(',')}" + # end + #end +# regexs strip most kdissert markup, and provide minimal info for sisu markup --> + @doc.each do |c,idx| + c.gsub!(/<\/summary>/,'') + c.gsub!(/.+?\n|<\/body>|<\/html>|

/m,'') + c.gsub!(/<\/p>/,"\n") + c.gsub!(/(.+?)<\/span>/," *{ \\1 }* ") + c.gsub!(/(.+?)<\/span>/," _{ \\1 }_ ") + c.gsub!(/(.+?)<\/span>/," /{ \\1 }/ ") + c.gsub!(/

+ + + + to search: select which database to search (drop-down menu below); enter your search query (in the form above); and click on the search button (below) +
+ + + index + text / grep + WOK_SQL + end + def buttons2 + <<-'WOK_SQL' +
+ match limit: + 1,000 + 2,500 +
+ echo query + result stats + search url + searched + available fields + sql statement +
+ checks: + default + selected + all + none +
+
+ + WOK + end + end + WOK_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 + 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='' + if @search_field=~/\S/ + @text1=text_to_match('text:') + @fulltext=text_to_match('fulltxt:') + @topic_register=text_to_match('topic_register:') + @title=text_to_match('title:') # DublinCore 1 - title + @author=text_to_match('(?:author|creator)s?:') # DublinCore 2 - creator/author + @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 + @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 + @format=text_to_match('format:') # DublinCore 9 - format + @identifier=text_to_match('identifier:') # DublinCore 10 - identifier + @source=text_to_match('source:') # DublinCore 11 - source + @language=text_to_match('language:') # DublinCore 12 - language + @relation=text_to_match('relation:') # DublinCore 13 - relation + @coverage=text_to_match('coverage:') # DublinCore 14 - coverage + @rights=text_to_match('rights:') # DublinCore 15 - rights + @keywords=text_to_match('key(?:words?)?:') + @comment=text_to_match('comment:') + @abstract=text_to_match('abs(?:tract)?:') + @owner=text_to_match('owner:') + @date_created=text_to_match('date_created:') + @date_issued=text_to_match('date_issued:') + @date_modified=text_to_match('date_modified:') + @date_available=text_to_match('date_available:') + @date_valid=text_to_match('date_valid:') + @filename=text_to_match('filename:') + @text1=text_to_match unless @keywords or @author or @title or @text1 or @fulltext or @comment or @abstract or @rights or @subject or @publisher or @date or @filename or @topic_register + else + @text1=q['s1'] if q['s1']=~/\S/ + @fulltext=q['ft'] if q['ft']=~/\S/ + @keywords=q['key'] if q['key']=~/\S/ + @title=q['ti'] if q['ti']=~/\S/ + @author=q['au'] if q['au']=~/\S/ + @topic_register=q['tr'] if q['tr']=~/\S/ + @subject=q['sj'] if q['sj']=~/\S/ + @description=q['dsc'] if q['dsc']=~/\S/ + @publisher=q['pb'] if q['pb']=~/\S/ + @contributor=q['cntr'] if q['cntr']=~/\S/ + @date=q['dt'] if q['dt']=~/\S/ + @type=q['ty'] if q['ty']=~/\S/ + @identifier=q['id'] if q['id']=~/\S/ + @source=q['src'] if q['src']=~/\S/ + @language=q['lang'] if q['lang']=~/\S/ + @relation=q['rel'] if q['rel']=~/\S/ + @coverage=q['cov'] if q['cov']=~/\S/ + @rights=q['cr'] if q['cr']=~/\S/ + @comment=q['co'] if q['co']=~/\S/ + @abstract=q['ab'] if q['ab']=~/\S/ + @date_created=q['dtc'] if q['dtc']=~/\S/ + @date_issued=q['dti'] if q['dti']=~/\S/ + @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'] + end + @@limit=q['ltd'] if q['ltd']=~/\d+/ # 1000 + @@offset=q['off'] if q['off']=~/\d+/ # 0 + end + end + def text_to_match(identifier='') + m={ + :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] + else + str=m[:word].match(@search_field)[1] + str.gsub!(/[()]/,'') + str + end + search_string.strip! + search_string.gsub!(/\s+/,'+') + search_string + #else + # "__" + end + end + end + WOK_SQL + end + def search_statement_common + <<-'WOK_SQL' + class Dbi_search_statement + 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=>'' } + #@offset||=@@offset + #@offset+=@@limit + search={ :text => [],:endnotes => [] } + cse=(c =~/\S/) ? true : false + st=Dbi_search_string.new('doc_objects.clean',search_for.text1,q['s1'],cse).string + se=Dbi_search_string.new('endnotes.clean',search_for.text1,q['s1'],cse).string + @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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + if st[:flag] + search[:text] << st[:search] + search[:endnotes] << st[:search] + end + @@limit=q['ltd'] if q['ltd']=~/\d+/ # 1000 + @@offset=q['off'] if q['off']=~/\d+/ # 0 + WOK_SQL + end + def pages + <<-'WOK_SQL' + def sql_offset + @@offset + end + def sql_match_limit + @@limit + end + def sql_canned_search + @offset_next=sql_offset.to_i + sql_match_limit.to_i + @offset_previous=sql_offset.to_i - sql_match_limit.to_i + def current + @@canned_search_url.to_s + '<d=' + sql_match_limit.to_s + '&off=' + sql_offset.to_s + end + def next + @@canned_search_url.to_s + '<d=' + sql_match_limit.to_s + '&off=' + @offset_next.to_s + end + def previous + @offset_previous >= 0 \ + ? (@@canned_search_url.to_s + '<d=' + sql_match_limit.to_s + '&off=' + @offset_previous.to_s) \ + : '' + end + def start + @@canned_search_url.to_s + '<d=' + sql_match_limit.to_s + '&off=' + 0.to_s + end + self + end + def pre_next(beyond_limit,img) + can=sql_canned_search + page=(sql_offset.to_i + sql_match_limit.to_i)/sql_match_limit.to_i + if beyond_limit + if page.to_s =~ /^1$/ + %{
+ pg. #{page.to_s} + +  >> + +
} + elsif page.to_s =~ /^2$/ + %{
+ + <<  + + pg. #{page.to_s} + +  >> + +
} + else + %{
+ + |<  + + + <<  + + pg. #{page.to_s} + +  >> + +
} + end + else + if page.to_s =~ /^1$/; '' + elsif page.to_s =~ /^2$/ + %{
+ + <<  + + pg. #{page.to_s} +
} + else + %{
+ + |<  + + + <<  + + pg. #{page.to_s} +
} + end + end + end + WOK_SQL + end + def tail + v=SiSU_Env::Info_version.instance.get_version + <<-WOK_SQL + def tail + <<-'WOK' +


+ + + + + +
+

+ + SiSU + +

+
+ +

+ Generated by + + #{v[:project]} #{v[:version]} #{v[:date]} (#{v[:date_stamp]}) +
+ + #{v[:project]} © Ralph Amissah + 1993, current 2010. + All Rights Reserved. +
+ + #{v[:project]} + is software for document structuring, publishing and search, +
+ + www.jus.uio.no/sisu + + and + + www.sisudoc.org + +
+ w3 since October 3 1993 + + ralph@amissah.com + +
+ mailing list subscription + + http://lists.sisudoc.org/listinfo/sisu + +
+ + sisu@lists.sisudoc.org + +

+
+

+ #{v[:project]} using: +
Standard SiSU markup syntax, +
Standard SiSU meta-markup syntax, and the +
Standard SiSU object citation numbering and system, (object/text positioning system) +
+ © Ralph Amissah 1997, current 2010. + All Rights Reserved. +

+
+

+ + GPLv3 + +

+
+

+ SiSU is released under + GPL v3 + or later, + + http://www.gnu.org/licenses/gpl.html + +

+
+

+ #{v[:project]}, developed using + + Ruby + + on + + Debian/Gnu/Linux + + software infrastructure, + with the usual GPL (or OSS) suspects. +
+ Better - "performance, reliability, scalability, security & total cost of ownership" + [not to mention flexibility & choice] use of and adherence to open standards (where practical and fair) and it is software libré. +
+ Get With the Future + + Way Better! + +

+
+ + + WOK + end + WOK_SQL + end + def main1 + <<-'WOK_SQL' + @tail=tail + @counter_txt_doc,@counter_txt_ocn,@counter_endn_doc,@counter_endn_ocn=0,0,0,0 + @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 => [] } + q=CGI.new + @db=if cgi['db'] =~/\S+/; + @stub=/#{@db_name_prefix}(\S+)/.match(cgi['db'])[1] + cgi['db'] + else + @stub='sisu' + "#{@db_name_prefix}#{@stub}" + 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=>''} + @@limit=if cgi['sql_match_limit'].to_s=~/2500/ + checked_sql_limit={:l1000=>'',:l2500=>'checked'} + '2500' + else + checked_sql_limit={:l1000=>'checked',:l2500=>''} + '1000' + end + checked_echo='checked' if cgi['echo'] =~/\S/ + checked_stats='checked' if cgi['stats'] =~/\S/ + checked_url='checked' if cgi['url'] =~/\S/ or cgi['u'].to_i==1 + checked_searched='checked' if cgi['searched'] =~/\S/ + checked_tip='checked' if cgi['tip'] =~/\S/ + checked_case='checked' if cgi['casesense'] =~/\S/ + checked_sql='checked' if cgi['sql'] =~/\S/ + if cgi['checks'] =~/check_all/ or cgi['check_all'] =~/\S/ or cgi['a'].to_i==1 + checked_all='checked' + checked_echo=checked_stats=checked_url=checked_searched=checked_tip=checked_sql='checked' + checked_none='' + elsif cgi['checks'] =~/check_none/ + checked_none='checked' + checked_all=checked_url=checked_stats=checked_searched=checked_tip=checked_echo=checked_sql='' + elsif cgi['checks'] =~/check_selected/ + checked_selected='checked' + elsif cgi['checks'] =~/check_default/ + checked_default='checked' + checked_echo=checked_stats=checked_url='checked' + checked_searched=checked_tip=checked_case=checked_sql='' + else + checked_selected='checked' + checked_echo=checked_stats=checked_url='checked' + checked_searched=checked_tip=checked_case=checked_sql='' + end + WOK_SQL + end + def main2 + <<-'WOK_SQL' + search_field=cgi['find'] if cgi['find'] # =~/\S+/ + @search_for=Search_request.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/ + s1='s1=' + CGI.escape(@search_for.text1) if @search_for.text1=~/\S/ + ft='&ft=' + CGI.escape(@search_for.fulltext) if @search_for.fulltext=~/\S/ + key='key=' + CGI.escape(@search_for.keywords) if @search_for.keywords=~/\S/ + ti='&ti=' + CGI.escape(@search_for.title) if @search_for.title=~/\S/ + au='&au=' + CGI.escape(@search_for.author) if @search_for.author=~/\S/ + tr='&tr=' + CGI.escape(@search_for.topic_register) if @search_for.topic_register=~/\S/ + 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/ + 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/ + id='&id=' + CGI.escape(@search_for.identifier) if @search_for.identifier=~/\S/ + src='&src=' + CGI.escape(@search_for.source) if @search_for.source=~/\S/ + lang='&lang=' + CGI.escape(@search_for.language) if @search_for.language=~/\S/ + rel='&rel=' + CGI.escape(@search_for.relation) if @search_for.relation=~/\S/ + cov='&cov=' + CGI.escape(@search_for.coverage) if @search_for.coverage=~/\S/ + cr='&cr=' + CGI.escape(@search_for.rights) if @search_for.rights=~/\S/ + co='&co=' + CGI.escape(@search_for.comment) if @search_for.comment=~/\S/ + ab='&ab=' + CGI.escape(@search_for.abstract) if @search_for.abstract=~/\S/ + dtc='&dtc=' + CGI.escape(@search_for.date_created) if @search_for.date_created=~/\S/ + dti='&dti=' + CGI.escape(@search_for.date_issued) if @search_for.date_issued=~/\S/ + dtm='&dtm=' + CGI.escape(@search_for.date_modified) if @search_for.date_modified=~/\S/ + dta='&dta=' + CGI.escape(@search_for.date_available) if @search_for.date_available=~/\S/ + 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']}" + mod=ft=~/\S+/ ? (ft.gsub(/ft/,'s1')) : s1 + @canned_base_url="#{@base}?#{mod}&db=#{cgi['db']}" + if checked_case=~/\S/ + @search[:text][1]=%{doc_objects.clean~'#{@search_for.text1}'} #s1 + @search[:endnotes][1]=%{endnotes.clean~'#{@search_for.text1}'} #s1 + else + @search[:text][1]=%{doc_objects.clean~*'#{@search_for.text1}'} #s1 + @search[:endnotes][1]=%{endnotes.clean~*'#{@search_for.text1}'} #s1 + end + canned_note='search url:' + else + @@canned_search_url="#{@base}?db=#{@db}&view=index" + canned_note='search url example:' + end + if search_field =~/\S+/ + analyze_format=search_field.gsub(/\s*\n/,'; ') + 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/,' ') + analyze_format=af + st=af.split(/\s*;\s*/) + search_field=st.join("\n") + end + green=%{} + canned_search_url_txt=CGI.escapeHTML(@@canned_search_url) + the_can=%{#{canned_note} #{canned_search_url_txt}
} + 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_filename=%{filename: #{green}#{@search_for.filename}

} if @search_for.filename =~/\S+/ + p_text=%{text: #{green}#{@search_for.text1}
} if @search_for.text1 =~/\S+/ + p_fulltext=%{fulltxt: #{green}#{@search_for.fulltext}
} if @search_for.fulltext =~/\S+/ + p_title=%{title: #{green}#{@search_for.title}
} if @search_for.title =~/\S+/ + p_author=%{author: #{green}#{@search_for.author}
} if @search_for.author =~/\S+/ + p_contributor=%{contributor: #{green}#{@search_for.contributor}
} if @search_for.contributor =~/\S+/ + p_date=%{date: #{green}#{@search_for.date}
} if @search_for.date =~/\S+/ + p_rights=%{rights: #{green}#{@search_for.rights}
} if @search_for.rights =~/\S+/ + p_topic_register=%{topic_register: #{green}#{@search_for.topic_register}
} if @search_for.topic_register =~/\S+/ + p_subject=%{subject: #{green}#{@search_for.subject}
} if @search_for.subject =~/\S+/ + p_keywords=%{keywords: #{green}#{@search_for.keywords}
} if @search_for.keywords =~/\S+/ + p_identifier=%{identifier: #{green}#{@search_for.identifier}
} if @search_for.identifier =~/\S+/ + p_type=%{type: #{green}#{@search_for.type}
} if @search_for.type =~/\S+/ + p_format=%{format: #{green}#{@search_for.format}
} if @search_for.format =~/\S+/ + p_relation=%{relation: #{green}#{@search_for.relation}
} if @search_for.relation =~/\S+/ + p_coverage=%{coverage: #{green}#{@search_for.coverage}
} if @search_for.coverage =~/\S+/ + p_description=%{description: #{green}#{@search_for.description}
} if @search_for.description =~/\S+/ + p_abstract=%{abstract: #{green}#{@search_for.abstract}
} if @search_for.abstract =~/\S+/ + p_comment=%{comment: #{green}#{@search_for.comment}
} if @search_for.comment =~/\S+/ + p_publisher=%{publisher: #{green}#{@search_for.publisher}
} if @search_for.publisher =~/\S+/ + p_source=%{source: #{green}#{@search_for.source}
} if @search_for.source =~/\S+/ + p_language=%{language: #{green}#{@search_for.language}
} if @search_for.language =~/\S+/ + search_note=<<-WOK + + database: #{green}#{@db}; selected view: #{green}#{cgi['view']} + search string: "#{green}#{analyze_format}"
+ #{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} + + WOK + #eg = %{canned search e.g.:
#{url}
find: #{analyze}
database: #{database}} + #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 \ + : 'Unavailable' + if checked_case=~/\S/ + @search[:text]<<%{doc_objects.clean~'#{CGI.unescape(s1)}'} + @search[:endnotes]<<%{endnotes.clean~'#{CGI.unescape(s1)}'} + else + @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) + @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=[],[] + @search_regx=nil + oldtid=0 + if @text_search_flag + if checked_sql =~/\S/ + sql_select_body=dbi_statement.sql_select_body_format + sql_select_endnotes=dbi_statement.sql_select_endnotes_format + else sql_select_body,sql_select_endnotes='','' + end + @body_main << '



Main Text:
' << sql_select_body + @endnotes << '



Endnotes:
' << sql_select_endnotes + else + end + #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') + l=".#{l}" + else '' + end + #metadata_found_body + if c['tid'].to_i != oldtid.to_i + ti=c['title'] + can_txt_srch=(cgi['view']=~/index/) \ + ? %{search } \ + : %{search } + title=%{toc html #{ti} by #{c['creator_author']} #{can_txt_srch}toc html epub pdf portrait pdf landscape odf manifest
} if file_suffix=~/s/ #hmm watch file_suffix + title=@text_search_flag \ + ? '

'+title \ + : '
'+title + @counter_txt_doc+=1 + oldtid=c['tid'].to_i + else title='' + end + if @text_search_flag + if cgi['view']=~/text/ \ + or (cgi['view']!~/index/ and cgi['search'] !~/search db/) #% txt body + text=if c['suffix'] !~/1/ #seg + if @search_for.text1 =~/\S+/ \ + or q['s1'] =~/\S+/ #% only this branch is working !! + unescaped_search=if @search_for.text1 =~/\S+/ + CGI.unescape(@search_for.text1) + elsif q['s1'] =~/\S+/ + CGI.unescape(q['s1']) + else nil + end + @search_regx=if unescaped_search #check + search_regex=[] + build=unescaped_search.scan(/\S+/).each do |g| + (g.to_s =~/(AND|OR)/) \ + ? (search_regex << '|') \ + : (search_regex << %{#{g.to_s}}) + end + search_regex=search_regex.join(' ') + search_regex=search_regex.gsub(/\s*\|\s*/,'|') + Regexp.new(search_regex, Regexp::IGNORECASE) + else nil + end + else nil + end + matched_para=(@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/) \ + ? (c['body'].gsub(/(<\s]+#{@search_regx}[^>]+?>|#{@search_regx})/mi,%{\\1})) \ + : c['body'] + %{

ocn #{c['ocn']}:

#{matched_para}} + elsif c['suffix'] =~/1/ #doc + %{#{title}

ocn #{c['ocn']}:#{c['body']}} + end + @counter_txt_ocn+=1 + output=title+text + else #elsif cgi['view']=~/index/ #% idx body + if c['suffix'] !~/1/ #seg + index=%{#{c['ocn']}, } if @text_search_flag + elsif c['suffix'] =~/1/ #doc + index=%{#{c['ocn']}, } + end + if c['seg'] =~/\S+/ + if @text_search_flag + @counter_txt_ocn+=1 + output=title+index + end + else + @counter_txt_ocn+=1 + output=c['suffix'] !~/1/ \ + ? title+index \ + : %{#{title}#{c['ocn'].sort}, } + end + end + else output=title + end + @counters_txt=if @counter_txt_doc > 0 + if checked_stats =~/\S/ + @@lt_t=(@counter_txt_ocn==dbi_statement.sql_match_limit.to_i) ? true : false + start=(@@offset.to_i+1).to_s + range=(@@offset.to_i+@counter_txt_ocn.to_i).to_s + %{


Found #{@counter_txt_ocn} times in the main body of #{@counter_txt_doc} documents [ matches #{start} to #{range} ]
} + else '' + end + else '' + end + @body_main << output #+ details + end + #text_objects_endnote + oldtid = 0 + s_endnotes.each do |e| #% endnotes + location=e['src_filename'][/(.+?)\.(?:ssm\.sst|sst)$/,1] + 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') + l=".#{l}" + else '' + end + #metadata_found_endnotes + if @text_search_flag + if e['metadata_tid'].to_i != oldtid.to_i + ti=e['title'] + can_txt_srch=(cgi['view']=~/index/) \ + ? %{search } \ + : %{search } + title=%{

toc html #{ti} by #{e['creator_author']} #{can_txt_srch}toc html epub pdf portrait pdf landscape odf manifest
} if file_suffix=~/s/ + @counter_endn_doc+=1 + oldtid=e['metadata_tid'].to_i + else title = '' + end + 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(/(<\s]+#{@search_regx}[^>]+?>|#{@search_regx})/mi,%{\\1}) \ + : e['body'] + output=%{#{title}
note #{e['nr']} referred to from ocn #{e['ocn']}: #{matched_endnote}} + else #elsif cgi['view']=~/index/ #% idx endnotes + @counter_endn_ocn+=1 + output=%{#{title}#{e['nr']}#{e['ocn']}], } + 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 \ + : false + start=(@@offset.to_i+1).to_s + range=(@@offset.to_i+@counter_endn_ocn.to_i).to_s + %{Found #{@counter_endn_ocn} times in the endnotes of #{@counter_endn_doc} documents [ matches #{start} to #{range} ]
} + else '' + end + end + @endnotes << output #+ details + 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(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 + end + rescue Exception => e + s='
' + CGI::escapeHTML(e.backtrace.reverse.join("\n"))
+          s << CGI::escapeHTML(e.message) + '
' + cgi.out{s} + next + ensure # eg. disconnect from server + @conn.disconnect if @conn + end + end + WOK_SQL + end + end +end +__END__ diff --git a/lib/sisu/v3/cgi_sqlite.rb b/lib/sisu/v3/cgi_sqlite.rb new file mode 100644 index 00000000..5c20b072 --- /dev/null +++ b/lib/sisu/v3/cgi_sqlite.rb @@ -0,0 +1,216 @@ +# 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: 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 + def initialize(opt,webserv) + @opt,@webserv=opt,webserv + @env=SiSU_Env::Info_env.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) + end + def sqlite + serve=[] + Dir.foreach(@env.path.webserv) do |x| + if x !~/^\./ \ + and FileTest.directory?("#{@env.path.webserv}/#{x}") + if FileTest.file?("#{@env.path.webserv}/#{x}/sisu_sqlite.db") + serve << x unless x =~/^_\S+/ + end + end + end + serve.sort! + f1,f2,f3=[],[],[] + serve.each do |x| + f1 << %{ \n} + end + f2 << %{ selected_db=case cgi['db']\n} + serve.each do |x| + f2 << %{ when /#{Db[:name_prefix]}#{x}/; ''\n} + end + f2 << " end\n" + #f3 + f3 << %{ db_name='sisu_sqlite.db'\n} + f3 << %{ db_sqlite=case cgi['db']\n} + serve.each do |x| + f3 << %{ when /#{Db[:name_prefix]}#{x}/; "#{@env.path.webserv}/#{x}/sisu_sqlite.db"\n} + 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 + a=%{ generated sisu_sqlite.cgi, + BASED ON ALREADY CREATED sisu_sqlite.db OUTPUT, (-d) + } + SiSU_Screen::Ansi.new(@opt.cmd,a).print_grey + 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" + 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?' + end + end + def header0 + <<-WOK_SQL +#!/usr/bin/env ruby +=begin +#{about} + * Description: generates naive cgi search form for search of sisu database (sqlite) +#{gpl} +=end + require 'cgi' + require 'fcgi' + require 'dbi' + @version='sisu_sqlite' + @image_src="#{@env.url.webserv_cgi}/_sisu/image_sys" + @hosturl_db="#{@env.url.webserv_base_cgi}" + @hosturl_files="#{@env.url.webserv_files_from_db}" + @db_name_prefix="#{Db[:name_prefix]}" + WOK_SQL + end + def search_statement + <<-'WOK_SQL' + class Dbi_search_string + def initialize(l,t,q,cse=false) + @l,@t,@q=l,t,q + end + def string + search={ :search => [],:flag => false } + if @t =~/\S+/ or @q =~/\S+/ + if @t =~/\S+/; unescaped_search=CGI.unescape(@t) + elsif @q =~/\S+/; unescaped_search=CGI.unescape(@q) + end + search_construct=[] + unescaped_search.gsub!(/\s*(AND|OR)\s*/,"%' \) \\1 #{@l} LIKE \( '%") + unescaped_search.gsub!(/(.+)/,"#{@l} LIKE \( '%\\1%' \)") + search_construct << unescaped_search + search_construct=search_construct.join(' ') + search[:search] << search_construct + search[:flag]=true + search + end + search + end + end + WOK_SQL + end + def search_query1 + <<-'WOK_SQL' + @search_text,@search_endnotes=[],[] + search[:text].each{|x| @search_text << "#{x} AND " } + @search_text=@search_text.join.gsub!(/AND\s+$/,'') + @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].each{|x| @search_endnotes << "#{x} AND " } + @search_endnotes=@search_endnotes.join.gsub!(/AND\s+$/,'') + @search_text.gsub!(/(endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)') + end + WOK_SQL + end + def search_query2 + <<-'WOK_SQL' + def sql_select_body + limit ||=@@limit + offset ||=@@offset + @sql_statement[:body]=%{SELECT metadata_and_text.title, metadata_and_text.creator_author, metadata_and_text.src_filename, metadata_and_text.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[:range]=%{LIMIT #{limit} OFFSET #{offset} ;} + select=@sql_statement[:body] + ' ' + @sql_statement[:range] + select + end + 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[:range]=%{LIMIT #{limit} OFFSET #{offset} ;} + select=@sql_statement[:endnotes] + ' ' + @sql_statement[:range] + select + end + def sql_select_body_format + %{#{sql_select_body}} + end + def sql_select_endnotes_format + %{#{sql_select_endnotes}} + end + def contents + @conn.select_all(sql_select_body) + end + def endnotes + @conn.select_all(sql_select_endnotes) + end + end + WOK_SQL + end + def dbi_connect + <<-'WOK_SQL' + @dbi="DBI:SQLite3:#{db_sqlite}" #sqlite3 ? + @conn=DBI.connect(@dbi) + WOK_SQL + end + end +end +__END__ diff --git a/lib/sisu/v3/character_encoding.rb b/lib/sisu/v3/character_encoding.rb new file mode 100644 index 00000000..5d19a61f --- /dev/null +++ b/lib/sisu/v3/character_encoding.rb @@ -0,0 +1,379 @@ +# 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: 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 ', 62, '76', '\76', '>', '>', '', '', '', 'Greater than >' ], + ['?', 63, '77', '\77', '?', nil, '?', '?', '?', 'Punctuation Question mark ?' ], + ['@', 64, '100', '\100', '@', nil, '', '', '', 'Commercial at sign @' ], + ['A', 65, '101', '\101', 'A', nil, 'A', 'A', 'A', 'Captial A' ], + ['B', 66, '102', '\102', 'B', nil, 'B', 'B', 'B', 'Captial B' ], + ['C', 67, '103', '\103', 'C', nil, 'C', 'C', 'C', 'Captial C' ], + ['D', 68, '104', '\104', 'D', nil, 'D', 'D', 'D', 'Captial D' ], + ['E', 69, '105', '\105', 'E', nil, 'E', 'E', 'E', 'Captial E' ], + ['F', 70, '106', '\106', 'F', nil, 'F', 'F', 'F', 'Captial F' ], + ['G', 71, '107', '\107', 'G', nil, 'G', 'G', 'G', 'Captial G' ], + ['H', 72, '110', '\110', 'H', nil, 'H', 'H', 'H', 'Captial H' ], + ['I', 73, '111', '\111', 'I', nil, 'I', 'I', 'I', 'Captial I' ], + ['J', 74, '112', '\112', 'J', nil, 'J', 'J', 'J', 'Captial J' ], + ['K', 75, '113', '\113', 'K', nil, 'K', 'K', 'K', 'Captial K' ], + ['L', 76, '114', '\114', 'L', nil, 'L', 'L', 'L', 'Captial L' ], + ['M', 77, '115', '\115', 'M', nil, 'M', 'M', 'M', 'Captial M' ], + ['N', 78, '116', '\116', 'N', nil, 'N', 'N', 'N', 'Captial N' ], + ['O', 79, '117', '\117', 'O', nil, 'O', 'O', 'O', 'Captial O' ], + ['P', 80, '120', '\120', 'P', nil, 'P', 'P', 'P', 'Captial P' ], + ['Q', 81, '121', '\121', 'Q', nil, 'Q', 'Q', 'Q', 'Captial Q' ], + ['R', 82, '122', '\122', 'R', nil, 'R', 'R', 'R', 'Captial R' ], + ['S', 83, '123', '\123', 'S', nil, 'S', 'S', 'S', 'Captial S' ], + ['T', 84, '124', '\124', 'T', nil, 'T', 'T', 'T', 'Captial T' ], + ['U', 85, '125', '\125', 'U', nil, 'U', 'U', 'U', 'Captial U' ], + ['V', 86, '126', '\126', 'V', nil, 'V', 'V', 'V', 'Captial V' ], + ['W', 87, '127', '\127', 'W', nil, 'W', 'W', 'W', 'Captial W' ], + ['X', 88, '130', '\130', 'X', nil, 'X', 'X', 'X', 'Captial X' ], + ['Y', 89, '131', '\131', 'Y', nil, 'Y', 'Y', 'Y', 'Captial Y' ], + ['Z', 90, '132', '\132', 'Z', nil, 'Z', 'Z', 'Z', 'Captial Z' ], + ['[', 91, '133', '\133', '[', nil, '', '', '', 'Left square bracket [' ], + ['\\', 92, '134', '\134', '\', nil, '', '\textbackslash', '', 'Backslash \\'], + [']', 93, '135', '\135', ']', nil, '', '', '', 'Right square bracket ]' ], + ['^', 94, '136', '\136', '^', nil, '', '', '', 'Caret ^' ], + ['_', 95, '137', '\137', '_', nil, '{\_}', '\textunderscore', '', 'Underscore _' ], + ['`', 96, '140', '\140', '`', nil, '', '', '', 'Grave accent `' ], + ['a', 97, '141', '\141', 'a', nil, 'a', 'a', 'a', 'Small a' ], + ['b', 98, '142', '\142', 'b', nil, 'b', 'b', 'b', 'Small b' ], + ['c', 99, '143', '\143', 'c', nil, 'c', 'c', 'c', 'Small c' ], + ['d', 100, '144', '\144', 'd', nil, 'd', 'd', 'd', 'Small d' ], + ['e', 101, '145', '\145', 'e', nil, 'e', 'e', 'e', 'Small e' ], + ['f', 102, '146', '\146', 'f', nil, 'f', 'f', 'f', 'Small f' ], + ['g', 103, '147', '\147', 'g', nil, 'g', 'g', 'g', 'Small g' ], + ['h', 104, '150', '\150', 'h', nil, 'h', 'h', 'h', 'Small h' ], + ['i', 105, '151', '\151', 'i', nil, 'i', 'i', 'i', 'Small i' ], + ['j', 106, '152', '\152', 'j', nil, 'j', 'j', 'j', 'Small j' ], + ['k', 107, '153', '\153', 'k', nil, 'k', 'k', 'k', 'Small k' ], + ['l', 108, '154', '\154', 'l', nil, 'l', 'l', 'l', 'Small l' ], + ['m', 109, '155', '\155', 'm', nil, 'm', 'm', 'm', 'Small m' ], + ['n', 110, '156', '\156', 'n', nil, 'n', 'n', 'n', 'Small n' ], + ['o', 111, '157', '\157', 'o', nil, 'o', 'o', 'o', 'Small o' ], + ['p', 112, '160', '\160', 'p', nil, 'p', 'p', 'p', 'Small p' ], + ['q', 113, '161', '\161', 'q', nil, 'q', 'q', 'q', 'Small q' ], + ['r', 114, '162', '\162', 'r', nil, 'r', 'r', 'r', 'Small r' ], + ['s', 115, '163', '\163', 's', nil, 's', 's', 's', 'Small s' ], + ['t', 116, '164', '\164', 't', nil, 't', 't', 't', 'Small t' ], + ['u', 117, '165', '\165', 'u', nil, 'u', 'u', 'u', 'Small u' ], + ['v', 118, '166', '\166', 'v', nil, 'v', 'v', 'v', 'Small v' ], + ['w', 119, '167', '\167', 'w', nil, 'w', 'w', 'w', 'Small w' ], + ['x', 120, '170', '\170', 'x', nil, 'x', 'x', 'x', 'Small x' ], + ['y', 121, '171', '\171', 'y', nil, 'y', 'y', 'y', 'Small y' ], + ['z', 122, '172', '\172', 'z', nil, 'z', 'z', 'z', 'Small z' ], + ['{', 123, '173', '\173', '{', nil, '{\{}', '\{', '', 'Left curly brace {' ], + ['|', 124, '174', '\174', '|', nil, '', '', '', 'Vertical bar / pipe |' ], + ['}', 125, '175', '\175', '}', nil, '{\}}', '\}', '', 'Right curly brace }' ], + ['~', 126, '176', '\176', '~', nil, '', '', '', 'Tilde ~' ], + ['', 127, '177', '', '', nil, '', '', '', ' ' ], + ['', 128, '200', '', '€', nil, '', '', '', ' ' ], + ['', 129, '201', '', '', nil, '', '', '', ' ' ], + ['\'', 130, '202', '', '‚', nil, '', '', '', 'Low left single quote \''], + [' ', 131, '203', '', 'ƒ', nil, '', '', '', 'Florin ' ], + ['"', 132, '204', '', '„', nil, '', '', '', 'Low left double quote "' ], + ['…', 133, '205', '\342\200\246', '…', nil, '…', '\textellipsis', '', 'Ellipsis …' ], + ['†', 134, '206', '\342\200\240', '†', nil, '†', '\textdagger', '', 'Dagger †' ], + ['‡', 135, '207', '\342\200\241', '‡', nil, '‡', '\textdaggerbl', '', 'Double dagger ‡' ], + ['^', 136, '210', '', 'ˆ', nil, '', '', '', 'Circumflex ^' ], + ['', 137, '211', '', '‰', nil, '', '', '', 'Permil ' ], + ['', 138, '212', '', 'Š', nil, '', '', '', 'Capital S, caron ' ], + ['<', 139, '213', '', '‹', nil, '', '', '', 'Less than sign (see &060;) <' ], + ['', 140, '214', '', 'Œ', nil, '', '', '', 'Capital OE ligature ' ], + ['', 141, '215', '', '', nil, '', '', '', ' ' ], + ['', 142, '216', '', 'Ž', nil, '', '', '', 'Capital Z, caron ' ], + ['', 143, '217', '', '', nil, '', '', '', ' ' ], + ['', 144, '220', '', '', nil, '', '', '', ' ' ], + ['', 145, '221', '', '‘', nil, '', '', '', 'Left single quote ' ], + ['', 146, '222', '', '’', nil, '', '', '', 'Right single quote ' ], + ['', 147, '223', '', '“', nil, '', '', '', 'Left double quote ' ], + ['', 148, '224', '', '”', nil, '', '', '', 'Right double quote ' ], + ['', 149, '225', '', '•', nil, '', '', '', 'Bullet ' ], + ['-', 150, '226', '', '–', nil, '', '', '', 'En dash -' ], + ['', 151, '227', '', '—', nil, '', '', '', 'Em dash -' ], + ['~', 152, '230', '', '˜', nil, '', '', '', 'Tilde (see &126;) ~' ], + ['t', 153, '231', '', '™', nil, '', '', '', 'Trademark t' ], + ['', 154, '232', '', 'š', nil, '', '', '', 'small s, caron ' ], + ['', 155, '233', '', '›', nil, '', '', '', 'Greater than sign (see &062;) ' ], + ['', 156, '234', '', 'œ', nil, '', '', '', 'Small oe ligature ' ], + ['', 157, '235', '', '', nil, '', '', '', ' ' ], + ['', 158, '236', '', 'ž', nil, '', '', '', 'Small z, caron ' ], + ['', 159, '237', '', 'Ÿ', nil, '', '', '', 'Capital Y, umlaut ' ], + ['', 160, '240', '', ' ', ' ', '', '', '', 'Non-breaking space ' ], + ['¡', 161, '241', '\302\241', '¡', '¡', '¡', '', '', 'Inverted exclamation ' ], + ['¢', 162, '242', '\302\242', '¢', '¢', '¢', '', '', 'Cent sign ¢' ], + ['£', 163, '243', '\302\243', '£', '£', '£', '\textsterling', '', 'Pound sign £' ], + ['¤', 164, '244', '\302\244', '¤', '¤', '¤', '\textcurrency', '', 'General currency sign ' ], + ['¥', 165, '245', '\302\245', '¥', '¥', '¥', '', '', 'Yen sign ¥' ], + ['¦', 166, '246', '\302\246', '¦', '¦', '¦', '', '', 'Broken vertical bar ' ], + ['§', 167, '247', '\302\247', '§', '§', '§', '\textsection', '', 'Section sign §' ], + ['¨', 168, '250', '\302\250', '¨', '¨', '¨', '\"', '', 'Umlaut ' ], + ['©', 169, '251', '\302\251', '©', '©', '©', '\copyright', '\textcopyright', 'Copyright ©' ], + ['ª', 170, '252', '\302\252', 'ª', 'ª', 'ª', '', '', 'Feminine ordinal ª' ], + ['«', 171, '253', '\302\253', '«', '«', '«', '', '', 'Left angle quote «' ], + ['¬', 172, '254', '\302\254', '¬', '¬', '¬', '', '', 'Not sign ' ], + ['­', 173, '255', '\302\255', '­', '­', '­', '', '', 'Soft hyphen ' ], + ['®', 174, '256', '\302\256', '®', '®', '®', '', '', 'Registered trademark ®' ], + ['¯', 175, '257', '\302\257', '¯', '¯', '¯', '', '', 'Macron accent ' ], + ['°', 176, '260', '\302\260', '°', '°', '°', '', '', 'Degree sign °' ], + ['±', 177, '261', '\302\261', '±', '&plusmin;', '±', '', '', 'Plus or minus ±' ], + ['²', 178, '262', '\302\262', '²', '²', '²', '', '', 'Superscript 2 ²' ], + ['³', 179, '263', '\302\263', '³', '³', '³', '', '', 'Superscript 3 ³' ], + ['', 180, '264', '\302\264', '´', '´', ''', '', '', 'Acute accent ' ], + ['µ', 181, '265', '\302\265', 'µ', 'µ', 'µ', '', '', 'Micro sign (Greek mu) µ' ], + ['¶', 182, '266', '\302\266', '¶', '¶', '¶', '\textparagraph', '', 'Paragraph sign ¶' ], + ['·', 183, '267', '\302\267', '·', '·', %q{·}, '', %q{}, 'Middle dot ' ], + ['¸', 184, '270', '\302\270', '¸', '¸', '¸', '', '', 'Cedilla ' ], + ['¹', 185, '271', '\302\271', '¹', '¹', '¹', '', '', 'Superscript 1 ¹' ], + ['º', 186, '272', '\302\272', 'º', 'º', 'º', '', '', 'Masculine ordinal º' ], + ['»', 187, '273', '\302\273', '»', '»', '»', '', '', 'Right angle quote ' ], + ['¼', 188, '274', '\302\274', '¼', '¼', '¼', '', '', 'Fraction one quarter ¼' ], + ['½', 189, '275', '\302\275', '½', '½', '½', '', '', 'Fraction on half ½' ], + ['¾', 190, '276', '\302\276', '¾', '¾', '¾', '', '', 'Fraction three quarters ¾' ], + ['¿', 191, '277', '\302\277', '¿', '¿', '¿', '', '', 'Inverted question mark ¿' ], + ['À', 192, '300', '\303\200', 'À', 'À', 'À', '\`{A}', '', 'Capital A, grave accent À' ], + ['Á', 193, '301', '\303\201', 'Á', 'Á', 'Á', %q{\'{A}}, '', 'Capital A, acute accent Á' ], + ['Â', 194, '302', '\303\202', 'Â', 'Â', 'Â', '^{A}', '', 'Capital A, circumflex accent Â' ], + ['Ã', 195, '303', '\303\203', 'Ã', 'Ã', 'Ã', '~{A}', '', 'Capital A, tilde Ã' ], + ['Ä', 196, '304', '\303\204', 'Ä', 'Ä', 'Ä', '"{A}', '', 'Capital A, umlaut Ä' ], + ['Å', 197, '305', '\303\205', 'Å', 'Å', 'Å', 'r{A}', '', 'Capital A, ring Å' ], + ['Æ', 198, '306', '\303\206', 'Æ', 'Æ', 'Æ', 'AE', '', 'Capital AE ligature Æ' ], + ['Ç', 199, '307', '\303\207', 'Ç', 'Ç', 'Ç', '', '', 'Capital C, cedilla Ç' ], + ['È', 200, '310', '\303\210', 'È', 'È', 'È', '`{E}', '', 'Capital E, grave accent È' ], + ['É', 201, '311', '\303\211', 'É', 'É', 'É', ''{E}', '', 'Capital E, acute accent É' ], + ['Ê', 202, '312', '\303\212', 'Ê', 'Ê', 'Ê', '^{E}', '', 'Capital E, circumflex accent Ê' ], + ['Ë', 203, '313', '\303\213', 'Ë', 'Ë', 'Ë', '"{E}', '', 'Capital E, umlaut Ë' ], + ['Ì', 204, '314', '\303\214', 'Ì', 'Ì', 'Ì', '`{I}', '', 'Capital I, grave accent Ì' ], + ['Í', 205, '315', '\303\215', 'Í', 'Í', 'Í', ''{I}', '', 'Capital I, acute accent Í' ], + ['Î', 206, '316', '\303\216', 'Î', 'Î', 'Î', '^{I}', '', 'Capital I, circumflex accent Î' ], + ['Ï', 207, '317', '\303\217', 'Ï', 'Ï', 'Ï', '"{I}', '', 'Capital I, umlaut Ï' ], + ['Ð', 208, '320', '\303\220', 'Ð', 'Ð', 'Ð', '', '', 'Capital eth, Icelandic ' ], + ['Ñ', 209, '321', '\303\221', 'Ñ', 'Ñ', 'Ñ', '', '', 'Capital N, tilde Ñ' ], + ['Ò', 210, '322', '\303\222', 'Ò', 'Ò', 'Ò', '`{O}', '', 'Capital O, grave accent Ò' ], + ['Ó', 211, '323', '\303\223', 'Ó', 'Ó', 'Ó', ''{O}', '', 'Capital O, acute accent Ó' ], + ['Ô', 212, '324', '\303\224', 'Ô', 'Ô', 'Ô', '^{O}', '', 'Capital O, circumflex accent Ô' ], + ['Õ', 213, '325', '\303\225', 'Õ', 'Õ', 'Õ', '~{O}', '', 'Capital O, tilde Õ' ], + ['Ö', 214, '326', '\303\226', 'Ö', 'Ö', 'Ö', '"{O}', '', 'Capital O, umlaut Ö' ], + ['×', 215, '327', '\303\227', '×', '×', '×', '', '', 'Multiply sign ×' ], + ['Ø', 216, '330', '\303\230', 'Ø', 'Ø', 'Ø', 'O', '', 'Capital O, slash Ø' ], + ['Ù', 217, '331', '\303\231', 'Ù', 'Ù', 'Ù', '', '', 'Capital U, grave accent Ù' ], + ['Ú', 218, '332', '\303\232', 'Ú', 'Ú', 'Ú', '', '', 'Capital U, acute accent Ú' ], + ['Û', 219, '333', '\303\233', 'Û', 'Û', 'Û', '', '', 'Capital U, circumflex accent Û' ], + ['Ü', 220, '334', '\303\234', 'Ü', 'Ü', 'Ü', '', '', 'Capital U, umlaut Ü' ], + ['Ý', 221, '335', '\303\235', 'Ý', 'Ý', 'Ý', '', '', 'Capital Y, acute accent Ý' ], + ['Þ', 222, '336', '\303\236', 'Þ', 'Þ', 'Þ', '', '', 'Capital thorn, Icelandic Þ' ], + ['ß', 223, '337', '\303\237', 'ß', 'ß', 'ß', '', '', 'Small sz ligature, German ß' ], + ['à', 224, '340', '\303\240', 'à', 'à', 'à', '\`{a}', '', 'Small a, grave accent à' ], + ['á', 225, '341', '\303\241', 'á', 'á', 'á', %q{\'{a}}, '', 'Small a, acute accent á' ], + ['â', 226, '342', '\303\242', 'â', 'â', 'â', '\^{a}', '', 'Small a, circumflex accent â' ], + ['ã', 227, '343', '\303\243', 'ã', 'ã', 'ã', '\~{a}', '', 'Small a, tilde ã' ], + ['ä', 228, '344', '\303\244', 'ä', 'ä', 'ä', '\"{a}', '', 'Small a, umlaut ä' ], + ['å', 229, '345', '\303\245', 'å', 'å', 'å', '\r{a}', '', 'Small a, ring å' ], + ['æ', 230, '346', '\303\246', 'æ', 'æ', 'æ', '\ae', '', 'Small ae ligature æ' ], + ['ç', 231, '347', '\303\257', 'ç', 'ç', 'ç', '', '', 'Small c, cedilla ç' ], + ['è', 232, '350', '\303\250', 'è', 'è', 'è', '\`{e}', '', 'Small e, grave accent è' ], + ['é', 233, '351', '\303\251', 'é', 'é', 'é', %q{\'{e}}, '', 'Small e, acute accent é' ], + ['ê', 234, '352', '\303\252', 'ê', 'ê', 'ê', '\^{e}', '', 'Small e, circumflex accent ê' ], + ['ë', 235, '353', '\303\253', 'ë', 'ë', 'ë', '\"{e}', '', 'Small e, umlaut ë' ], + ['ì', 236, '354', '\303\254', 'ì', 'ì', 'ì', '\`{i}', '', 'Small i, grave accent ì' ], + ['í', 237, '355', '\303\255', 'í', 'í', 'í', '\'{i}', '', 'Small i, acute accent í' ], + ['î', 238, '356', '\303\256', 'î', 'î', 'î', '\^{i}', '', 'Small i, circumflex accent î' ], + ['ï', 239, '357', '\303\257', 'ï', 'ï', 'ï', '\"{i}', '', 'Small i, umlaut ï' ], + ['ð', 240, '360', '\303\260', 'ð', 'ð', 'ð', '', '', 'Small eth, Icelandic ð' ], + ['ñ', 241, '361', '\303\261', 'ñ', 'ñ', 'ñ', '', '', 'Small n, tilde ñ' ], + ['ò', 242, '362', '\303\262', 'ò', 'ò', 'ò', '\`{o}', '', 'Small o, grave accent ò' ], + ['ó', 243, '363', '\303\263', 'ó', 'ó', 'ó', %q{\'{o}}, '', 'Small o, acute accent ó' ], + ['ô', 244, '364', '\303\264', 'ô', 'ô', 'ô', '\^{o}', '', 'Small o, circumflex accent ô' ], + ['õ', 245, '365', '\303\265', 'õ', 'õ', 'õ', '\^{o}', '', 'Small o, tilde õ' ], + ['ö', 246, '366', '\303\266', 'ö', 'ö', 'ö', '\"{o}', '', 'Small o, umlaut ö' ], + ['÷', 247, '367', '\303\267', '÷', '÷', '÷', '', '', 'Divide sign ÷' ], + ['ø', 248, '370', '\303\270', 'ø', 'ø', 'ø', '', '', 'Small o, slash ø' ], + ['ù', 249, '371', '\303\271', 'ù', 'ù', 'ù', '\`{u}', '', 'Small u, grave accent ù' ], + ['ú', 250, '372', '\303\272', 'ú', 'ú', 'ú', %q{\'{u}}, '', 'Small u, acute accent ú' ], + ['û', 251, '373', '\303\273', 'û', 'û', 'û', '\^{u}', '', 'Small u, circumflex accent û' ], + ['ü', 252, '374', '\303\274', 'ü', 'ü', 'ü', '\"{u}', '', 'Small u, umlaut ü' ], + ['ý', 253, '375', '\303\275', 'ý', 'ý', 'ý', '', '', 'Small y, acute accent ý' ], + ['þ', 254, '376', '\303\276', 'þ', 'þ', 'þ', '', '', 'Small thorn, Icelandic þ' ], + ['ÿ', 255, '377', '\303\277', 'ÿ', 'ÿ', 'ÿ', '', '', 'Smally y, umlaut ÿ' ], + ['∝', , '', '', '∝', '∝', '∝', '', '', 'proportional to U+221D (8733) ∝' ], + ['∞', , '', '', '∞', '∞', '∞', '', '', 'infinity U+221E (8734) ∞' ], +] + end + end +end +__END__ diff --git a/lib/sisu/v3/composite.rb b/lib/sisu/v3/composite.rb new file mode 100644 index 00000000..1a801e58 --- /dev/null +++ b/lib/sisu/v3/composite.rb @@ -0,0 +1,275 @@ +# 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: composite documents, assemble/build documents from other + documents or parts of marked up text + +=end +module SiSU_Assemble + require 'fileutils' + require "#{SiSU_lib}/sysenv" # sysenv.rb + class Remote_image + include FileUtils + def initialize + @env=SiSU_Env::Info_env.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| + image="#{path}/#{i}" + imagefile=File.new(image,'w+') + open("#{download_from}/#{i}") do |g| + imagefile << g.read + end + imagefile.close + end + output_path="#{@env.path.webserv}/#{@env.path.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 + end + end + class Composite + @@imager={} + def initialize(opt) + @opt=opt + @env=SiSU_Env::Info_env.new + end + def read + begin + @fns_array=IO.readlines(@opt.fns,'') + assembled=insertions? + write(assembled) + rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error + 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.close + 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| + image="#{path}/#{i}" + unless FileTest.exists?(image) + imagefile=File.new(image,'w+') + open("#{download_from}/#{i}") do |g| + imagefile << g.read + end + imagefile.close + end + end + end + def 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=>[] } + 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 + else @code_flag + end + if not @code_flag \ + and i !~/^%+\s/ + 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 + end + end + file[:prepared] << i + if i !~/^%+\s/ \ + and i =~rgx_image + file[:images] << i.scan(rgx_image).uniq + end + end + file[:prepared] << "\n% end import" << "\n\n" + if file[:images].length > 0 + file[:images].flatten! + file[:images].uniq! + file[:images].delete_if {|x| x =~/https?:\/\// } + end + file + end + 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/ + para=data.each do |para| + if para =~/^<<\s+(\S+?\.ss[it])$/ \ + or para =~/^<<\{(\S+?\.ss[it])\}$/ \ + or para =~/^(?:<<\s*)\|(\S+?)\|@\|.+?\|(?:req(?:quire)?\b|\s*\})?/ \ + or para =~/^r\{(.+?)\}/ #depreciated + 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]$/ # and NetTest + imagedir = /((?:https?|file):\/\/\S+?)\/[^\/]+?\.ss[ti]$/.match(loadfile).captures.join + '/_sisu/image' #watch + require 'uri' + image_uri=URI.parse(imagedir) + require 'open-uri' + require 'pp' + insert=open(loadfile) + insert_array=insert.dup + insert.close + file=insertion(loadfile,insert_array) + @@imager[image_uri] ||=[] + @@imager[image_uri] << file[:images] + file[:prepared] + elsif loadfile =~ /\.ss[ti]$/ \ + and FileTest.file?(loadfile) + insert_array=IO.readlines(loadfile,'') + file=insertion(loadfile,insert_array) + 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}" + para + end + else tuned_file << para + end + tuned_file.flatten! + tuned_file.compact! + end + if @@imager.length >0 + @@imager.each do |d,i| + i.flatten! + i.uniq! + download_images(d,i) + end + end + tuned_file + end + end + class Composite_file_list + @@imager={} + def initialize(opt) + @opt=opt + @env=SiSU_Env::Info_env.new + end + def read + begin + @opt.fns=@opt.fns.gsub(/\.ssm\.sst$/,'.ssm') #FIX earlier, hub + @fns_array=IO.readlines(@opt.fns,'') + files=insertions? + rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error + ensure + end + end + 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/ + @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 + 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/v3/concordance.rb b/lib/sisu/v3/concordance.rb new file mode 100644 index 00000000..9b62b441 --- /dev/null +++ b/lib/sisu/v3/concordance.rb @@ -0,0 +1,345 @@ +# 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: concordance file (html concordance, wordmap, linked index of + words in document) + +=end +module SiSU_Concordance + require "#{SiSU_lib}/particulars" # particulars.rb + include SiSU_Particulars + require "#{SiSU_lib}/sysenv" # sysenv.rb + include SiSU_Env + require "#{SiSU_lib}/defaults" # defaults.rb + include SiSU_Viz + require "#{SiSU_lib}/html_format" # html_format.rb + include SiSU_HTML_Format + require "#{SiSU_lib}/html_minitoc" # html_minitoc.rb + class Source + def initialize(opt) + @opt=opt + @particulars=SiSU_Particulars::Combined_singleton.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 + 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/ + 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_Concordance::Source::Words.new(@particulars).songsheet + end + rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error + ensure + end + end + private + class Doc_title + 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 + def initialize(particulars) + @particulars,@md=particulars,particulars.md + @data=SiSU_HTML::Source::Html_environment.new(particulars).tuned_file_instructions + @file=SiSU_Env::SiSU_file.new(@md) + @vz=SiSU_Env::Get_init.instance.skin + txt_path=%{#{@md.dir_out}} + SiSU_Env::Info_skin.new(@md).select + @fnb=@md.fnb + @lex_button=%{SiSU home -->} + @doc_details =<
 

#{@md.title.full}

#{@md.author}

+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") + @css=SiSU_Env::CSS_stylesheet.new(@md) + toc='
' + minitoc + '
' + < + + + + SiSU created WordIndex for: #{@md.title.full} + + + + + + + + #{@css.html_seg} + #{@vz.js_head} + + + #{@vz.js_top} + #{head_banner.concordance_navigation_band('pdf')} + #{toc} +
+ #{@doc_details} +

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

+

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

+

+ word (number of occurences)
linked references to word within document
+ [if number of occurences exceed number of references - word occurs more than once in at least one reference. Footnote/endnotes are either assigned to the paragraph from which they are referenced or ignored, so it is relevant to check the footnotes referenced from within a paragraph as well.] +

+

+ (After the page is fully loaded) you can jump directly to a word by appending a hash (#) and the word to the url for this text, (do not forget that words are case sensitive, and may be listed twice (starting with and without an upper case letter)), #your_word # [ http://[web host]/#{@fnb}/concordance.html#your_word ] +

+WOK + end + end + class Word + @@word_previous='' + def initialize(word,freq) + @word,@freq=word,freq + end + def html + w=if @word.capitalize==@@word_previous + %{\n

#{@word}

(#{@freq})

\n\t

} + else n=@word.strip.gsub(/\s+/,'_') #also need to convert extended character set to html + %{\n

#{@word}

(#{@freq})

\n\t

} + end + @@word_previous=@word.capitalize + w + end + end + class Words + require "#{SiSU_lib}/defaults" # defaults.rb + include SiSU_Viz + require "#{SiSU_lib}/html_format" # html_format.rb + include SiSU_HTML_Format + require "#{SiSU_lib}/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 + @file=SiSU_Env::SiSU_file.new(@md) + @freq=Hash.new(0) + @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern + @rxp_lv1=/^#{Mx[:lv_o]}1:/ #fix @rxp_lv # Mx[:lv_o] + @rxp_lv2=/^#{Mx[:lv_o]}2:/ #fix @rxp_lv # Mx[:lv_o] + @rxp_lv3=/^#{Mx[:lv_o]}3:/ #fix @rxp_lv # Mx[:lv_o] + @rxp_title=Regexp.new("^#{Mx[:meta_o]}title#{Mx[:meta_c]}\s*(.+?)\s*$") + @rxp_t1=Regexp.new('^T1') + @rxp_t2=Regexp.new('^T2') + @rxp_t3=Regexp.new('^T3') + @rxp_excluded1=/#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/ + @rxp_excluded0=/^(?:#{Mx[:fa_bold_o]}|#{Mx[:fa_italics_o]})?(?:to\d+|\d+| |#{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 + end + end + def songsheet + begin + mkdir_p(@file.output_path.html_concordance) unless FileTest.directory?(@file.output_path.html_concordance) + @file_concordance=File.open(@file.place_file.html_concordance,'w') + map_para + rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error + ensure + @file_concordance.close + end + end + protected + def location_scroll(wordlocation,show) + %{#{wordlocation}; } + 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? + case wordlocation + when @rxp_t1 + %{[H]#{show}, } + when @rxp_t2 + %{[H]#{show}, } + when @rxp_t3 + %{[H]#{show}, } + else %{#{show}, } + end + end + def map_para + @seg,ocn=nil,nil + @word_map={} + @dal_array.each do |line| + if defined? line.ocn \ + and line.ocn.to_s =~/\d/ + if line.is =~/heading/ \ + and 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.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$/,'') + 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=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! + end + @freq[word] +=1 + @word_map[word] ||= [] + if line !~@rxp_lv1 \ + and line !~@rxp_lv2 \ + and line !~@rxp_lv3 #fix @rxp_lv # Mx[:lv_o] + @word_map[word] << location_seg("#{@seg}\##{ocn}",ocn) + else + @word_map[word] << case line + when @rxp_lv1; location_seg('T1',ocn) #fix @rxp_lv # Mx[:lv_o] + when @rxp_lv2; location_seg('T2',ocn) #fix @rxp_lv # Mx[:lv_o] + when @rxp_lv3; location_seg('T3',ocn) #fix @rxp_lv # Mx[:lv_o] + end + end + end + end + end + end + end + end + scr='Full Text scroll: doc#  ' + seg='' + head=SiSU_Concordance::Source::Doc_title.new(@particulars).create + head.gsub!(/#{Xx[:html_relative2]}/m,@file.path_rel_links.html_seg_2) + head.gsub!(/#{Xx[:html_relative1]}/m,@file.path_rel_links.html_seg_1) + @file_concordance << head + alph=%W[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z] + @file_concordance << '

' + alph.each {|x| @file_concordance << %{#{x}, }} + @file_concordance << '

' + letter=alph.shift + @file_concordance << %{\n

A

} + for word in @freq.keys.sort! {|a,b| a.downcase<=>b.downcase} + f=/^(\S)/.match(word)[1] + if letter < f.upcase + while letter < f.upcase + if alph.length > 0 + letter=alph.shift + @file_concordance << %{\n

#{letter}

} + else break + end + end + end + keyword=SiSU_Concordance::Source::Word.new(word,@freq[word]).html + if keyword !~ @rxp_excluded0 + if @word_map[word][0] =~ /\d+/ + wm=[] + @file_concordance << %{#{keyword}#{seg}#{@word_map[word].uniq.compact.join}} + end + @file_concordance << '

' + end + # special cases endnotes and header levels 1 - 3 + end + credits=@vz.credits_sisu + @file_concordance << %{
\n} # footer + SiSU_Screen::Ansi.new(@md.cmd,@md.fns,"#{@env.path.output_tell}/#{@md.fn[:concordance]}").flow if @md.cmd =~/[MV]/ + end + end + end +end +__END__ diff --git a/lib/sisu/v3/conf.rb b/lib/sisu/v3/conf.rb new file mode 100644 index 00000000..f3f978db --- /dev/null +++ b/lib/sisu/v3/conf.rb @@ -0,0 +1,249 @@ +# 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: configuration + +=end +module SiSU_Initialize + require "#{SiSU_lib}/sysenv" # sysenv.rb + include SiSU_Env + include SiSU_Screen + require "#{SiSU_lib}/relaxng" # relaxng.rb + include SiSU_relaxng + require "#{SiSU_lib}/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/ + 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 + def initialize(opt) + @opt=opt + @env=SiSU_Env::Info_env.new(@opt.fns) + @suffix,@path={},{} + @suffix[:rnc]='rnc' + @suffix[:rng]='rng' + @suffix[:xsd]='xsd' + @path[:xml]= @env.path.output + '/_sisu/xml' + @path[:xsd]= @env.path.output + '/_sisu/xml/xsd' + @path[:rnc]= @env.path.output + '/_sisu/xml/rnc' + @path[:rng]= @env.path.output + '/_sisu/xml/rng' + @pwd,@home=Dir.pwd,@env.path.home + 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 + 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 + 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 + 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 + 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 + 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]) } + #ugly code, sort later + if @rxng.methods.join =~/[^_]dtd_sax\b/ + if @rxng.dtd_sax.length > 200 + dtd=File.new("#{@env.path.output}/#{@env.path.style}/#{@rxng.rng_name.output_sax}",'w') + dtd << @rxng.dtd_sax + dtd.close + else trang_rnc_model_output_sax + end + else trang_rnc_model_output_sax + end + if @rxng.methods.join =~/[^_]dtd_dom\b/ + if @rxng.dtd_dom.length > 200 + dtd=File.new("#{@env.path.output}/#{@env.path.style}/#{@rxng.rng_name.output_dom}",'w') + dtd << @rxng.dtd_dom + dtd.close + else trang_rnc_model_output_dom + end + else trang_rnc_model_output_dom + end + if @rxng.methods.join =~/[^_]dtd_node\b/ + if @rxng.dtd_node.length > 200 + dtd=File.new("#{@env.path.output}/#{@env.path.style}/#{@rxng.rng_name.input_node}",'w') + dtd << @rxng.dtd_node + dtd.close + else trang_rnc_model_input_node + end + else trang_rnc_model_input_node + end + if @rxng.methods.join =~/[^_]dtd_xhtml\b/ + if @rxng.dtd_xhtml.length > 200 + dtd=File.new("#{@env.path.output}/#{@env.path.style}/#{@rxng.rng_name.output_xhtml}",'w') + dtd << @rxng.dtd_xhtml + dtd.close + else trang_rnc_model_output_xhtml + end + else trang_rnc_model_output_xhtml + end + end + def trang_rnc_model_output_sax + s=@suffix + rnc_src=@env.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 + rnc=File.new(rnc_src,'w') + rnc << @rxng.rnc_model_output_sax + rnc.close + #xsd + schema=SiSU_Env::System_call.new(rnc_src,xsd_file) + schema.relaxng(@opt.cmd) + #rng + schema=SiSU_Env::System_call.new(rnc_src,rng_file) + schema.relaxng(@opt.cmd) + #rnc + cp(rnc_src,rnc_file) + chmod(0644,rnc_file) + end + def trang_rnc_model_output_dom + s=@suffix + rnc_src=@env.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 + rnc=File.new(rnc_src,'w') + rnc << @rxng.rnc_model_output_dom + rnc.close + #xsd + schema=SiSU_Env::System_call.new(rnc_src,xsd_file) + schema.relaxng(@opt.cmd) + #rng + schema=SiSU_Env::System_call.new(rnc_src,rng_file) + schema.relaxng(@opt.cmd) + #rnc + cp(rnc_src,rnc_file) + chmod(0644,rnc_file) + end + def trang_rnc_model_output_xhtml + s=@suffix + rnc_src=@env.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 + rnc=File.new(rnc_src,'w') + rnc << @rxng.rnc_model_output_xhtml + rnc.close + #xsd + schema=SiSU_Env::System_call.new(rnc_src,xsd_file) + schema.relaxng(@opt.cmd) + #rng + schema=SiSU_Env::System_call.new(rnc_src,rng_file) + schema.relaxng(@opt.cmd) + #rnc + cp(rnc_src,rnc_file) + chmod(0644,rnc_file) + end + def trang_rnc_model_input_sax + rnc_file=@env.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.relaxng(@opt.cmd) + end + def trang_rnc_model_input_dom + rnc_file=@env.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.relaxng(@opt.cmd) + end + def trang_rnc_model_input_node + rnc_file=@env.path.dal + '/node.rnc' + rng_file=@env.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.relaxng(@opt.cmd) + end + end +end +__END__ diff --git a/lib/sisu/v3/constants.rb b/lib/sisu/v3/constants.rb new file mode 100644 index 00000000..c8cac1f6 --- /dev/null +++ b/lib/sisu/v3/constants.rb @@ -0,0 +1,595 @@ +# 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: 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]='Ф' +Xx[:html_relative2]='※※' #'※' '☼' +Xx[:html_relative1]='※' #'※' '☼' +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[:bl_o]='〔'; Mx[:bl_c]='〕' #block text mark +Mx[:gr_o]='〔'; Mx[:gr_c]='〕' #group text mark #REPLACE & RETIRE +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_nl]= '╲' #lB ▌ 』 ┘ +Mx[:br_paragraph]= '█' #FB █ 9608 # PP ∥ 8741 #▐ #'┘' #'¶' #FB █ 9608 lB ▌ 9612 RB ▐ 9616 +Mx[:br_obj]= 'break_obj'; Hx[:br_obj]= {:obj=>Mx[:br_obj]} # 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]='<'; Dx[:url_c_xml]='>' +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[:po_bold_o]= '!{'; Px[:po_bold_c]= '}!' +Px[:po_italics_o]= '/{'; Px[:po_italics_c]= '}/' +Px[:po_underscore_o]= '_{'; Px[:po_underscore_c]= '}_' +Px[:po_cite_o]= '"{'; Px[:po_cite_c]= '}"' +Px[:po_insert_o]= '+{'; Px[:po_insert_c]= '}+' +Px[:po_strike_o]= '-{'; Px[:po_strike_c]= '}-' +Px[:po_superscript_o]='^{'; Px[:po_superscript_c]='}^' +Px[:po_subscript_o]= ',{'; Px[:po_subscript_c]= '},' +Px[:po_hilite_o]= '*{'; Px[:po_hilite_c]= '}*' +Px[:po_monospace_o]= '#{'; Px[:po_monospace_c]= '}#' +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] +#Px[:lng_lst]=%w[sq am hy eu bn pt_BR br bg ca hr cs da nl en eo et gl de el he hi is ia ga it fi fr lo la lv lt ml mr no nn oc pl pt ro ru se sa sr sk sl es sv ta te th tr tk uk ur vi cy us] +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[:src]='src' +Gt[:po]='po4a/po' +Gt[:pot]='po4a/pot' +Gt[:image]='mm/image' +Gt[:audio]='mm/audio' +Gt[:video]='mm/video' +Gt[:conf]='conf' +Gt[:skin]='conf/skin' #Gt[:skin]='conf/skin/doc' +__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 + +#% 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/v3/css.rb b/lib/sisu/v3/css.rb new file mode 100644 index 00000000..d9727a83 --- /dev/null +++ b/lib/sisu/v3/css.rb @@ -0,0 +1,2085 @@ +# 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: css stylesheets + +=end +module SiSU_Style + require "#{SiSU_lib}/sysenv" # sysenv.rb + require "#{SiSU_lib}/defaults" # defaults.rb + class CSS + def initialize + @vz=SiSU_Env::Get_init.instance.skin + end + def fonts + @vz.font_fonts + end + def html_tables #stylesheet for css table_pages +<. + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: 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 [],: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::Info_file.new(@fnx) + else + SiSU_Env::Info_file.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_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=(@fnx && @fnx =~/\.ss[tmi]$/) \ + ? @fnx \ + : @opt.fns + create_dal + rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@@fns).error + ensure + 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::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 \ + 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::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 \ + or @@fns==@fnx + @@fns=(@fnx && @fnx =~/\.ss[tmi]$/) \ + ? @fnx \ + : @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 \ + 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::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 \ + 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::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 \ + 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::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 \ + 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::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 + fn=(@fnx && @fnx =~/\.ss[tmi]$/) \ + ? @fnx \ + : @opt.fns + file_array=@env.read_source_file(fn) + 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(fn,@md,file_array).song + if @opt.cmd =~/[vM]/ + cf=SiSU_Env::Create_file.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) + (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(fn,md,data) + @fn,@md,@data=fn,md,data + @cf=SiSU_Env::Create_file.new(@fn) + @make=SiSU_Env::Info_file.new(@fn) + @dir=SiSU_Env::Info_env.new(@fn) + 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=@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} #{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=@cf.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=@cf.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(fn,md,data) + @fn,@md,@data=fn,md,data + @env=SiSU_Env::Info_env.new(@md.fns) + end + def reset + @@flag_vocab=0 + @@line_mode='' + end + def song + reset + data=@data + data=data.join.split("\n\n") + data=SiSU_insertions::Insertions.new(@md,data).expand_insertions? # dal_expand_insertions.rb + data=SiSU_substitute_and_insert::SI.new(@md,data).substitutions_and_insertions? # dal_substitutions_and_insertions.rb + data,metadata=SiSU_document_structure_extract::Build.new(@md,data).identify_parts # dal_doc_str.rb + data=SiSU_Syntax::Markup.new(@md,data).songsheet # dal_syntax.rb + data,endnote_array=SiSU_character_check::Check.new(data).character_check_and_oldstyle_endnote_array # dal_character_check.rb + data=SiSU_images::Images.new(@md,data).images # dal_images.rb + data,tags_map,ocn_html_seg_map=SiSU_numbering::Numbering.new(@md,data).numbering_song # dal_numbering.rb + data,book_index_rel,book_index_rel_html_seg,html_idx,xhtml_idx=SiSU_book_index::Book_index.new(@md,data,@env).indexing_song if @md.book_idx # dal_idx.rb + data=SiSU_endnotes::Endnotes.new(@md,data,endnote_array).endnotes # dal_endnotes.rb + outputdata=data + if @md.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/v3/dal_character_check.rb b/lib/sisu/v3/dal_character_check.rb new file mode 100644 index 00000000..a843f202 --- /dev/null +++ b/lib/sisu/v3/dal_character_check.rb @@ -0,0 +1,104 @@ +# 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_character_check + class Check + def initialize(data) + @data=data + @comment='%' + @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!(/
/,"#{Mx[:br_line]}") #needed by xml, xhtml etc. + dob.obj.gsub!(/\t/,' ') + dob.obj.gsub!(/\342\200\231/u,"'") #if dob =~/’/ #Avoid #‘ ’ #“ ” + dob.obj.gsub!(/�/u,' ') #watch, replace with char code + dob.obj.gsub!(/·/u,'*') + dob.obj.gsub!(/\\copy(?:right)?\b/,'©') + dob.obj.gsub!(/\\trademark\b|\\tm\b/,'®') + dob.obj=dob.obj + "\n" + 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_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? + end + @tuned_file=@tuned_file.flatten.compact + [@tuned_file,@endnote_array] + end + end +end +__END__ diff --git a/lib/sisu/v3/dal_doc_objects.rb b/lib/sisu/v3/dal_doc_objects.rb new file mode 100644 index 00000000..feb5d2c1 --- /dev/null +++ b/lib/sisu/v3/dal_doc_objects.rb @@ -0,0 +1,444 @@ +# 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: 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_block_txt + 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?; ((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?; ((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?; ((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?; ((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='block' + @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/v3/dal_doc_str.rb b/lib/sisu/v3/dal_doc_str.rb new file mode 100644 index 00000000..209fc1dd --- /dev/null +++ b/lib/sisu/v3/dal_doc_str.rb @@ -0,0 +1,1195 @@ +# 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: 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_block,@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|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.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) + h={:bullet_=>bullet,:indent=>indent,:obj=>obj,:idx=>idx,:note_=>note,:image_=>image,:tags=>tags} + SiSU_document_structure::Object_para.new.paragraph(h) + else nil + end + when /^[<\[](?:br)?:(?:pa?r|o(?:bj|---)?)[>\]]\s*$/ #[br:par] #[br:obj] + SiSU_document_structure::Object_layout.new.break(Hx[:br_obj]) + when /^(?:[<\[](?:br)?:pg[>\]]|?)\s*$/ #[br:pg] + SiSU_document_structure::Object_layout.new.break(Hx[:br_page]) + when /^[<\[](?:br)?:pg?n[>\]]\s*$/ #[br:pgn] + SiSU_document_structure::Object_layout.new.break(Hx[:br_page_new]) + else #paragraph + image=image_test(t_o) + note=endnote_test?(t_o) + obj,tags=extract_tags(t_o) + h={:bullet_=>false,:indent=>0,:obj=>obj,:idx=>idx,:note_=>note,:image_=>image,:tags=>tags} + SiSU_document_structure::Object_para.new.paragraph(h) + 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 =~/^block\{/ + @@flag['block']=true + h={:obj=>'block text start'} #introduce a counter + t_o=SiSU_document_structure::Object_comment.new.comment(h) #t_o=SiSU_document_structure::Object_layout.new.insert(h) + 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,"#{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_block_txt.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 =~/[\Ss]+/} + 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['block'] \ + 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_block.join("\n")) + h={:obj=>obj,:tags=>tags} + @tuned_block=[] + t_o=SiSU_document_structure::Object_block_txt.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['block'] \ + and t_o =~/^\}block/ ) + @@flag['block']=false + obj,tags=extract_tags(@tuned_block.join("\n")) + h={:obj=>obj,:tags=>tags} + @tuned_block=[] + t_o=SiSU_document_structure::Object_block_txt.new.block(h) + tuned_file << t_o + h={:obj=>'block text end'} #introduce a counter + t_o=SiSU_document_structure::Object_comment.new.comment(h) #t_o=SiSU_document_structure::Object_layout.new.insert(h) + elsif ( @@flag['alt'] \ + and t_o =~/^\}alt/ ) + @@flag['alt']=false + obj,tags=extract_tags(@tuned_block.join("\n")) + h={:obj=>obj,:tags=>tags} + t_o=SiSU_document_structure::Object_block_txt.new.alt(h) + @tuned_block=[] + tuned_file << t_o + h={:obj=>'alt text end'} #introduce a counter + t_o=SiSU_document_structure::Object_comment.new.comment(h) #t_o=SiSU_document_structure::Object_layout.new.insert(h) + 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_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_block_txt.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=='block' \ + or t_o.is=='alt' \ + or t_o.is=='verse' + t_o.obj.gsub!(/\n/m,"#{Mx[:br_nl]}") + t_o.obj.gsub!(/[ ][ ]/m,"#{Mx[:nbsp]*2}") + t_o.obj.gsub!(/#{Mx[:nbsp]}\s/,"#{Mx[:nbsp]*2}") + 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_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|
+ 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|block|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|block)/ #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 "" + 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}" if (lev <= 1) and hs[1] + puts "" if (lev==0) + when 2 + puts "#{@sp*2}" if (lev <= 2) and hs[2] + puts "#{@sp*1}" if (lev <= 1) and hs[1] + puts "" if (lev==0) + when 3 + puts "#{@sp*3}" if (lev <= 3) and hs[3] + puts "#{@sp*2}" if (lev <= 2) and hs[2] + puts "#{@sp*1}" if (lev <= 1) and hs[1] + puts "" if (lev==0) + when 4 + puts "#{@sp*4}" if (lev <= 4) + puts "#{@sp*3}" if (lev <= 3) and hs[3] + puts "#{@sp*2}" if (lev <= 2) and hs[2] + puts "#{@sp*1}" if (lev <= 1) and hs[1] + puts "" if (lev==0) + when 5 + puts "#{@sp*5}" if (lev <= 5) + puts "#{@sp*4}" if (lev <= 4) + puts "#{@sp*3}" if (lev <= 3) and hs[3] + puts "#{@sp*2}" if (lev <= 2) and hs[2] + puts "#{@sp*1}" if (lev <= 1) and hs[1] + puts "" if (lev==0) + when 6 + puts "#{@sp*6}" if (lev <= 6) + puts "#{@sp*5}" if (lev <= 5) + puts "#{@sp*4}" if (lev <= 4) + puts "#{@sp*3}" if (lev <= 3) and hs[3] + puts "#{@sp*2}" if (lev <= 2) and hs[2] + puts "#{@sp*1}" if (lev <= 1) and hs[1] + puts "" if (lev==0) + end + end + end +end +__END__ diff --git a/lib/sisu/v3/dal_endnotes.rb b/lib/sisu/v3/dal_endnotes.rb new file mode 100644 index 00000000..95176516 --- /dev/null +++ b/lib/sisu/v3/dal_endnotes.rb @@ -0,0 +1,125 @@ +# 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_endnotes + class Endnotes + def initialize(md,data,endnote_array=nil) + @md,@data,@endnote_array=md,data,endnote_array + @endnote_counter,@endnote_counter_asterisk,@endnote_counter_dag=1,1,1 + end + def endnotes + data=@data + @tuned_file=[] + endnote_no,endnote_ref=1,1 + data.each do |dob| + # manually numbered endnotes --> + if @md.mod.inspect =~/--no-asterisk|--no-annotate/ + 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]}/,'') + end + if defined? dob.obj \ + and defined? dob.is \ + and dob.is !~/^code/ + case dob.obj # auto-numbered endnotes --> + when /#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}[*+]\s+.+?#{Mx[:en_b_c]}/ + dob.obj.gsub!(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/,' \1') # required 2003w31 + word_mode=dob.obj.scan(/\S+/m) + word_mode=endnote_call_number(word_mode) + dob.obj=word_mode.join(' ') + endnote_ref+=1 + when /~\^(?:\s|$)|<:e>/ #%note inserts endnotes previously gathered from /^(|[-~]\{{3})/ (in earlier loop) + word_mode=dob.obj.scan(/\S+/m) + word_mode=endnote_call_number(word_mode) + dob.obj=word_mode.join(' ') + endnote_ref+=1 + end + end + @tuned_file << dob + end + @endnote_counter,@endnote_counter_asterisk,@endnote_counter_dag=1,1,1 + @tuned_file=@tuned_file.flatten + end + def endnote_call_number(words) + words.each do |word| + case word + when /#{Mx[:en_a_o]}/ + unless word =~/#{Mx[:en_a_o]}[*+]+/ + word.gsub!(/#{Mx[:en_a_o]}/,"#{Mx[:en_a_o]}#{@endnote_counter} ") + @endnote_counter+=1 + end + when /#{Mx[:en_b_o]}/ + if word =~/#{Mx[:en_b_o]}[+]/ + word.gsub!(/#{Mx[:en_b_o]}[+]/,"#{Mx[:en_b_o]}\+#{@endnote_counter_dag} ") + @endnote_counter_dag+=1 + else + word.gsub!(/#{Mx[:en_b_o]}[*]?/,"#{Mx[:en_b_o]}\*#{@endnote_counter_asterisk} ") + @endnote_counter_asterisk+=1 + end + when /~\^|<:e>/ + if @endnote_array + word.gsub!(/~\^|<:e>/,"#{@endnote_array[@endnote_counter-1]}") + @endnote_counter+=1 + end + end + end + end + end +end +__END__ diff --git a/lib/sisu/v3/dal_expand_insertions.rb b/lib/sisu/v3/dal_expand_insertions.rb new file mode 100644 index 00000000..f7adb76e --- /dev/null +++ b/lib/sisu/v3/dal_expand_insertions.rb @@ -0,0 +1,198 @@ +# 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: 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/v3/dal_hash_digest.rb b/lib/sisu/v3/dal_hash_digest.rb new file mode 100644 index 00000000..a78c54f1 --- /dev/null +++ b/lib/sisu/v3/dal_hash_digest.rb @@ -0,0 +1,155 @@ +# 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: 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 + def initialize(md,data,env=nil) + @md,@data,@env=md,data,env + @env ||=SiSU_Env::Info_env.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 + @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! + end + if t_o.of !~/structure|comment|layout/ \ + and t_o.ocn.class==Fixnum + if sha_ + for hash_class in [ Digest::SHA256 ] + @tuned_file << stamped(t_o,hash_class) + end + else + for hash_class in [ Digest::MD5 ] + @tuned_file << stamped(t_o,hash_class) + end + end + else @tuned_file << t_o unless t_o.nil? + end + end + @tuned_file=@tuned_file.flatten + #use md5 or to create hash of each dal object including ocn, & add into to each dal object + end + def endnote_digest(data) + t_o_bit=[] + data.each do |en_plus| + t_o_bit <<= case en_plus + when /#{Mx[:en_a_o]}|#{Mx[:en_b_o]}/ + if en_plus =~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/ + t_o_txt,en_open,en_txt,en_close=/(.*?)(#{Mx[:en_a_o]}|#{Mx[:en_b_o]})(.+?)(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m.match(en_plus)[1..4] + stripped_en=SiSU_text_representation::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 + end + else en_plus + end + end + 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_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' + 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_plus_en=t_o.obj.scan(/.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/m) + t_o_tail=if t_o.obj =~/(?:.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})+([\s\S]+)/m + /(?:.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})+.*/m.match(t_o.obj)[1] + else '' + end + t_o_plus_en << t_o_tail + en_and_t_o_digest << endnote_digest(t_o_plus_en) + t_o_new=en_and_t_o_digest.join(' ') + #@tuned << t_o_new + Mx[:id_o] + digest_strip + ':' + digest_all + Mx[:id_c] unless t_o.nil? + else #@tuned << t_o + Mx[:id_o] + digest_strip + ':' + digest_all + Mx[:id_c] unless t_o.nil? + end + else #@tuned << t_o + Mx[:id_o] + digest_strip + ':' + digest_all + Mx[:id_c] unless t_o.nil? + end + t_o #KEEP intact + end + def strip_clean_extra_spaces(s) # 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 + end +end +__END__ diff --git a/lib/sisu/v3/dal_idx.rb b/lib/sisu/v3/dal_idx.rb new file mode 100644 index 00000000..7c00be3c --- /dev/null +++ b/lib/sisu/v3/dal_idx.rb @@ -0,0 +1,357 @@ +# 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_book_index + class Book_index + 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) + end + def indexing_song + data=@data + data,sisu_markup_idx_rel,sisu_markup_idx_rel_html_seg,html_idx,xhtml_idx=extract_book_index(data) + data=clean_and_insert_index(data,sisu_markup_idx_rel_html_seg) + [data,sisu_markup_idx_rel,sisu_markup_idx_rel_html_seg,html_idx,xhtml_idx] + end + def extract_book_index(data) + tuned_file=[] + idx_array=[] + data.each do |dob| + if dob.is =~/heading/ \ + and 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?) + tuned_file << dob if dob + end + idx_array=construct_idx_array(idx_array) if idx_array.length > 0 + if idx_array.length > 0 + the_idx=construct_book_index(idx_array) + sisu_markup_idx_rel,sisu_markup_idx_rel_html_seg,html_idx,xhtml_idx=nil,nil,nil,nil + if @md.book_idx + idx=index(the_idx) + sisu_markup_idx_rel,sisu_markup_idx_rel_html_seg,html_idx,xhtml_idx=idx[:sst_rel],idx[:sst_rel_html_seg],idx[:html],idx[:xhtml] + end + end + [tuned_file,sisu_markup_idx_rel,sisu_markup_idx_rel_html_seg,html_idx,xhtml_idx] + end + def construct_idx_array(idx_array) + idx_lst=[] + idx_array.each do |idx| + idx_list,ocn,seg=@rgx_idx_ocn_seg.match(idx)[1..3] + idx_lst <<=if idx_list =~/;/ + g=idx_list.scan(/[^;]+/) + idxl=[] + g.each do |i| + i.strip! + idxl << { :rough_idx => i, :ocn => ocn, :seg => seg } + end + idxl + else { :rough_idx => idx_list, :ocn => ocn, :seg => seg } + end + end + idx_lst.flatten! + idx_lst + 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}" + else + the_idx[use]['term_node_lev2'][i] << { :ocn => idx[:ocn], :seg => idx[:seg] } + "#{idx_lst[0]}:#{i} #{idx[:ocn]}" + end + end + end + end + the_idx=the_idx.sort + the_idx + end + def clean_xml(str) + str.gsub!(/&/,'&') + str.gsub!(/\(/,'(') + str.gsub!(/\)/,')') + str.gsub!(/\*/,'*') + str.gsub!(/\+/,'+') + str.gsub!(/,/,',') + 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) + 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) + 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) + idx[:sst_rel_html_seg] << o + idx[:sst_rel] << o + alph=%W[9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z] + idx[:html] << '

' + idx[:xhtml] << '

' + alph.each do |x| + if x =~/[0-9]/ + idx[:html] << '' + idx[:xhtml] << '' + else + idx[:html] << %{#{x}, } + idx[:xhtml] << %{#{x}, } + end + end + idx[:html] << '

' + idx[:xhtml] << '

' + letter=alph.shift + idx[:html] << %{\n

} + idx[:xhtml] << %{\n

0 - 9

} + the_idx.each do |i| + i.each do |x| + if x.class==String + f=/^(\S)/.match(x)[1] + if letter < f + while letter < f + if alph.length > 0 + letter=alph.shift + idx[:html] << %{\n

#{letter}

} + idx[:xhtml] << %{\n

#{letter}

} + else break + end + end + end + idx[:sst_rel_html_seg] << %{\n\n#{Mx[:fa_bold_o]}#{x},#{Mx[:fa_bold_c]} } + idx[:sst_rel] << %{\n\n#{Mx[:fa_bold_o]}#{x},#{Mx[:fa_bold_c]} } + aname=x.gsub(/\s+/,'_') + idx[:html] << %{\n

#{x}, } + c=clean_xml(x.dup) + idx[:xhtml] << %{\n

#{c}, } + @o=idx[:sst_rel_html_seg].index(idx[:sst_rel_html_seg].last) + @t=idx[:sst_rel].index(idx[:sst_rel].last) + @q=idx[:html].index(idx[:html].last) + @r=idx[:xhtml].index(idx[:xhtml].last) + print "\n" + x + ', ' if @md.cmd =~/V/ + elsif x.class==Array + p 'array error? -->' + print x + elsif x.class==Hash + if x['term_node_lev1'].class==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[:range]}, } + idx[:xhtml][@q]=idx[:xhtml][@q] + %{#{a[:range]}, } + print a[:range] + ', ' if @md.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[:ocn]}, } + idx[:xhtml][@q]=idx[:xhtml][@q] + %{#{a[:ocn]}, } + print a[:ocn] + ', ' if @md.cmd =~/V/ + else p 'error' + end + end + idx[:html][@q]=idx[:html][@q] + '

' + idx[:xhtml][@r]=idx[:xhtml][@r] + '

' + end + if x['term_node_lev2'] + m=x['term_node_lev2'] + m=m.sort + m.each do |k,y| + if k !~/term_node_lev1/ + idx[:sst_rel_html_seg][@o]=idx[:sst_rel_html_seg][@o] + %{#{k}, } + idx[:sst_rel][@t]=idx[:sst_rel][@t] + %{#{k}, } + idx[:html][@q]=idx[:html][@q] + %{\n

#{k}, } + c=clean_xml(k.dup) + idx[:xhtml][@r]=idx[:xhtml][@r] + %{\n

#{c}, } + print "\n\t" + k + ', ' if @md.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] + %{#{z[:range]}, } + idx[:xhtml][@q]=idx[:xhtml][@q] + %{#{z[:range]}, } + print z[:range] + ', ' if @md.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] + %{#{z[:ocn]}, } + idx[:xhtml][@q]=idx[:xhtml][@q] + %{#{z[:ocn]}, } + print z[:ocn] + ', ' if @md.cmd =~/V/ + else p 'error' + end + end + idx[:html][@q]=idx[:html][@q] + '

' + idx[:xhtml][@r]=idx[:xhtml][@r] + '

' + end + end + end + idx + @x +=1 + end + end + end + print "\n" if @md.cmd =~/V/ + idx + end + def screen_print(the_idx) + the_idx.each do |i| + i.each do |x| + if x.class==String + print "\n" + x + ', ' + elsif x.class==Array + p 'array error? -->' + print x + elsif x.class==Hash + if x['term_node_lev1'].class==Array + x['term_node_lev1'].each do |a| + if a[:range] + print a[:range] + ', ' + elsif a[:ocn] + print a[:ocn] + ', ' + else p 'error' + end + end + end + if x['term_node_lev2'] + m=x['term_node_lev2'] + m=m.sort + m.each do |k,y| + if k !~/term_node_lev1/ + print "\n\t" + k + ', ' + y.each do |z| + if z[:range] + print z[:range] + ', ' + elsif z[:ocn] + print z[:ocn] + ', ' + else p 'error' + end + end + end + end + end + end + end + end + end + def output_idx(idx) + if @md.book_idx + path="#{@env.path.output}/#{@md.fnb}" + Dir.mkdir(path) unless FileTest.directory?(path) + puts "#{path}/#{@md.fn[:book_idx_html]} #{__FILE__}::#{__LINE__}" + html_index_file=File.new("#{path}/#{@md.fn[:book_idx_html]}",'w') + idx[:html].each {|x| html_index_file << x } + html_index_file.close + end + end + def clean_and_insert_index(data,sisu_markup_idx) + tuned_file=[] + data.each do |dob| + tuned_file << dob + if dob.obj =~/#{Mx[:br_endnotes]}/ \ + and sisu_markup_idx + sisu_markup_idx.each do |idx| + tuned_file << idx + end + end + end + tuned_file + end + def clean_index(data) #check on use of dob + tuned_file=[] + data.each do |para| + para.gsub!(/\n*#{@rgx_idx}/m,'') + tuned_file << para + end + tuned_file + end + end +end +__END__ diff --git a/lib/sisu/v3/dal_images.rb b/lib/sisu/v3/dal_images.rb new file mode 100644 index 00000000..76a94dab --- /dev/null +++ b/lib/sisu/v3/dal_images.rb @@ -0,0 +1,155 @@ +# 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_images + class Images + #require 'RMagick' + #include Magick + def initialize(md,data) + @md,@data=md,data + end + def images + data=@data + tuned_file=[] + @rmgk=false + imagemagick_=SiSU_Env::Info_settings.new.program?('rmagick') + if imagemagick_ + begin + @rmgk=SiSU_Env::Load.new('RMagick').prog + rescue + @rmgk=false + end + else + if @md.cmd =~/[vVM]/ + SiSU_Screen::Ansi.new(@md.cmd,'use of RMagick is not enabled in sisurc.yml').warn + end + end + data.each do |dob| + unless dob.is =~/^table/ + dob.obj.strip! + if dob.obj =~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif)(?:\s*|\s+.+)?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/ + if dob.obj !~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif)\s+\d+x\d+/ + m=/#{Mx[:lnk_o]}\s*(\S+\.(?:png|jpg|gif))/ + if imagemagick_ + imgs=dob.obj.scan(m).flatten + img_col=img_row=nil + images=imgs.each do |image| + dir=SiSU_Env::Info_env.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 |image_path| + break if FileTest.exist?("#{image_path}/#{image}") + end + if FileTest.exist?("#{image_path}/#{image}") + if @rmgk + img=Magick::ImageList.new("#{image_path}/#{image}") + img_col,img_row=img.columns,img.rows + else + if @md.cmd =~/[vVM]/ + SiSU_Screen::Ansi.new(@md.cmd,'RMagick not present, will attempt to use imagemagick (identify) directly').warn + end + imgk=SiSU_Env::System_call.new.imagemagick + gmgk=SiSU_Env::System_call.new.graphicksmagick + if imgk or gmgk + if imgk + imgsys=`identify #{image_path}/#{image}`.strip #system call + elsif gmgk + imgsys=`gm identify #{image_path}/#{image}`.strip #system call + end + img_col,img_row=/(\d+)x(\d+)/m.match(imgsys)[1,2] + img_col,img_row=img_col.to_i,img_row.to_i + end + end + row=((img && defined? img.rows) ? img.rows : img_row) + col=((img && defined? img.columns) ? img.columns : img_col) + if img_col > img_row #landscape + if img_col> 640 + img_col=640 + img_row=((1.00*img_col/col)*row).round + end + else #portrait + if img_col> 640 + img_col=640 + img_row=((1.00*img_col/col)*row).round + end + if img_row > 640 + img_row=640 + img_col=((1.00*img_row/row)*col).round + end + end + dob.obj.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) ]') + 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/ + 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)/ + end + tuned_file << dob unless dob.nil? + end + tuned_file + end + end +end +__END__ +imgsys=`identify #{image_path}/#{image}`.strip diff --git a/lib/sisu/v3/dal_metadata.rb b/lib/sisu/v3/dal_metadata.rb new file mode 100644 index 00000000..77b58f86 --- /dev/null +++ b/lib/sisu/v3/dal_metadata.rb @@ -0,0 +1,79 @@ +# 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_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] + @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) + 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) + end + def metadata + end + end +end +__END__ diff --git a/lib/sisu/v3/dal_numbering.rb b/lib/sisu/v3/dal_numbering.rb new file mode 100644 index 00000000..4bfb7da3 --- /dev/null +++ b/lib/sisu/v3/dal_numbering.rb @@ -0,0 +1,465 @@ +# 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_numbering + class Numbering + attr_accessor :obj,:osp,:ocn,:lv,:name,:index,:comment + def initialize(md,data) + @md,@data=md,data + @obj=@type=@ocn=@lv=@name=@index=@comment=nil + end + def numbering_song + data=@data + data=number_plaintext_para(data) + data=auto_number_heading_ie_title(data.compact) #tr issue + data=ocn(data.compact) #watch + data=xml(data.compact) + data=minor_numbering(data.compact) + data,tags_map,ocn_html_seg_map=name_para_seg_filename(data) + data=set_heading_top(data) unless @md.set_heading_top + [data,tags_map,ocn_html_seg_map] + end + def number_plaintext_para(data) + @tuned_file=[] + data.each do |dob| + if dob.of !~/(?:block|comment|layout)/ and dob.ocn_ #and dob.obj !~ /#{Mx[:gr_o]}Th|#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}/ #FIX + dob.obj.gsub!(/(.+)\n/,'\1 ') #messy, but idea is that tables should retain breaks + end + unless dob.obj.class==Array + dob.obj.gsub!(/^\s+/,'') + dob.obj.gsub!(/\s$/,"\n") + end + @tuned_file << dob + end + @tuned_file=@tuned_file.flatten + 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} ") + 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 + end + if @md.toc_lev_limit \ + and @md.toc_lev_limit < num + 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 + end + def auto_number_heading_ie_title(data) #also does some segment naming + @tuned_file=[] + if defined? @md.make.num_top \ + and @md.make.num_top \ + and @md.make.num_top !~/^$/ + input||=@md.make.num_top + end + num_top=(input ? input.to_i : nil) + t_no1=t_no2=t_no3=t_no4=0 + if num_top + 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.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_ \ + 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") + end + if dob.ln==no1 + @subnumber=1 + @subnumber=0 if dob.ln==no1 + end + if dob.ln.to_s =~/^[1-6]/ \ + and not dob.toc_ \ + and dob.obj !~/#{Mx[:fa_o]}(?:~#|-#)#{Mx[:fa_c]}/ # <-- fix + if dob.ln==no1 + t_no1+=1; t_no2=0; t_no3=0 + title_no="#{t_no1}" + if not @md.seg_names.nil? \ + and not @md.seg_names.include?(title_no) + if dob.ln==no1 + 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 + 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 + 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}. ") + end + @md.seg_names << title_no + end + if dob.ln!=no1 \ + 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}. ") + end + end + if dob.ln==no1 #watch because here you change dob.name + dob.tags=["h#{title_no}",dob.tags].flatten #check whether will work across file types with stop signs + end + if dob.ln==no2 #watch because here you change dob.name + t_no2+=1; t_no3=0 + title_no="#{t_no1}.#{t_no2}" + dob.tags=["h#{title_no}",dob.tags].flatten #check whether will work across file types with stop signs + dob=number_sub_heading(dob,no2,title_no) + end + if dob.ln==no3 #watch because here you change dob.name + t_no3+=1 + title_no="#{t_no1}.#{t_no2}.#{t_no3}" + dob.tags=["h#{title_no}",dob.tags].flatten #check whether will work across file types with stop signs + dob=number_sub_heading(dob,no3,title_no) + end + elsif dob.ln.to_s =~/^[1-6]/ \ + and dob.name =~ /^[\w-]+-/ # endnotes, watch2005# endnotes, watch2005 + 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' \ + 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 + if (dob.name.nil? or dob.name.empty?) \ + and dob.ln.to_s =~/^[1-9]/ \ + and dob.obj =~ /^([\d\.]+)/ #risky (must be unique) consider output to 4~~\d instead of 4~\d + dob.name=$1 + dob.tags=[dob.name,dob.tags].flatten if dob.name !~/^\d+$/ #check whether will work across file types with stop signs + end + if @md.toc_lev_limit + end + elsif defined? dob.name \ + and dob.name + dob.tags=[dob.name,dob.tags].flatten if dob.name !~/^\d+$/ #check whether will work across file types with stop signs + end + dob.tags=dob.tags.uniq if defined? dob.tags + @tuned_file << dob + end + @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 + end + def xml(data) + @tuned_file=SiSU_document_structure_extract::XML.new(@md,data).dom + @tuned_file + end + def minor_numbering(data) #and auto segment numbering increment + @tuned_file=[] + number_small,letter_small=0,0 + letter=%w( a b c d e f g h i j k l m n o p q r s t u v w x y z ) + data.each do |dob| + if dob.of =~/heading|para|block/ + if dob.is =='heading' \ + 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/ + 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 + end + if dob.obj =~/^_# / + dob.obj.gsub!(/^_# /,"#{letter[letter_small]}. ") #change 2004 + dob.indent='1' + letter_small+=1 + end + end + end + @tuned_file << dob + end + @tuned_file=@tuned_file.flatten + end + def name_para_seg_filename(data) #segment naming, remaining + # paragraph name/numbering rules + # manual naming overrides, manual naming may be + # alpha-numeric characters mixed, + # numeric only (a number), if + # all segments have been named, + # the numbers used are over 1000 or + # it is not minded that auto-numbering uses a funny scheme for naming segments (not yet implemented) + # [for now a warning is printed for such documents on use of maintenance or very-verbose flag] + # auto-naming takes the form of giving numbers to segments + # the rules for which are as follows + # if the title/heading text starts with a numeric, then that is used (1 3.1 3rd etc.) + # otherwise the level 4 segment number from the embedded document structure info is used + # if there is none a sequential number is designated, preceded by an underscore + @tuned_file,@unique_auto_name=[],[] + tags={} + art_filename_auto=1 + @counter=1 + if not @md.seg_autoname_safe and @md.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 \ + and dob.ln.to_s =~/^[456]/ + if dob.ln==4 \ + and not dob.name \ + and not @md.set_heading_seg + @md.set_heading_seg=true + end + 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? \ + 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]/ + end + end + if dob.ln==4 \ + and dob.name #extract segment name from embedded document structure info + if not @md.seg_names.nil? \ + and not @md.seg_names.include?(dob.name) + dob.tags=[dob.name,dob.tags].flatten if dob.name !~/^\d+$/ + @md.seg_names << dob.name + end + end + if dob.ln==4 \ + 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? \ + 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 + @md.seg_names << segn_auto + else puts 'segment name (numbering) error' + end + art_filename_auto+=1 + end + if dob.ln==4 \ + and not dob.name #should not occur + puts "e r r o r -\t#{__FILE__}::#{__LINE__}\n#{dob.inspect}" + end + end + if dob.is =~/heading/ \ + and dob.ln==4 + @seg=dob.name + end + @tuned_file << if dob.is=='heading' \ + and (@md.pagenew or @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 + elsif @md.pagebreak.inspect =~/#{m}/ + dob_tmp << SiSU_document_structure::Object_layout.new.break(Hx[:br_page]) << dob + end + para_result=unless dob_tmp.length > 0; dob + else dob_tmp + end + else dob + 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 + tags["#{dob.ocn}"]={:segname=>@segname} + ocn_html_seg[dob.ocn]=if dob.is =~/heading/ + x=if dob.ln =~/[1-3]/ + {:seg=>nil,:level=> dob.ln} + else #elsif dob.ln =~/[4-6]/ + {:seg=>@seg,:level=> dob.ln} + end + else + {:seg=>@seg,:level=>nil} + end + end + dob.tags=dob.tags.uniq if defined? dob.tags + if defined? dob.tags \ + and dob.tags.length > 0 + #@segname=((dob.is=='heading'|| dob.is=='heading_insert') && dob.ln==4 && (defined? dob.name)) \ + #? (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] + end + end + dob + end + ocn_html_seg.each_with_index do |ocn,i| + if ocn \ + and ocn[:level].to_s=~/[1-3]/ + ocn_seg=nil + (1..4).each do |x| + if ocn_html_seg[i+x] and ocn_html_seg[i+x][:level]==4 + ocn[:seg]=ocn_html_seg[i+x][:seg] + end + end + end + end + if @md.seg_names.length > 0 + @md.set_heading_seg=true + end + tuned_file=@tuned_file.flatten + [tuned_file,tags,ocn_html_seg] + 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]/ + @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 + 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 + end + @tuned_file=@tuned_file.flatten + end + 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]/ + @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' + @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 + @tuned_file << head + end + end + @tuned_file << dob + end + @tuned_file=@tuned_file.flatten + end + 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]/ + @tuned_file=[] + data.each do |t_o| + unless @md.set_header_title + if t_o !~/^%{1,2}\s/m \ + and t_o !~/\A\s*\Z/m + @tuned_file << "#{Mx[:meta_o]}title#{Mx[:meta_c]} #{@md.heading_seg_first}" + @md.title.main=@md.heading_seg_first + @md.set_header_title=true + end + end + @tuned_file << t_o + end + @tuned_file=@tuned_file.flatten + end + end + end +end +__END__ diff --git a/lib/sisu/v3/dal_substitutions_and_insertions.rb b/lib/sisu/v3/dal_substitutions_and_insertions.rb new file mode 100644 index 00000000..e1326232 --- /dev/null +++ b/lib/sisu/v3/dal_substitutions_and_insertions.rb @@ -0,0 +1,154 @@ +# 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_substitute_and_insert + 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/,'') + end + if data[0] =~ /^(SiSU\s+[\d.]*|sisu-[\d.]+)$/ # SiSU identifier + data[0].gsub!(/^(SiSU\s*[\d.]*)$/,'% \1') + data[0].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}" + 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}" + 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}" + 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}" + 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}" + 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}" + 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}" + end + end + para.each{|x| data_expand << x } + else data_expand << para + end + data_expand.flatten! + data_expand.compact! + end + data_expand.each do |para| + para=if @md.markup_version.determined >= 0.38 + SiSU_document_structure_extract::Structure.new(@md,para).structure_markup_normalize + else + SiSU_document_structure_extract::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 + if para =~/^@\S+?:/ + para.gsub!(/^@(\S+?):\s+/,"#{Mx[:meta_o]}\\1#{Mx[:meta_c]}") + para.gsub!(/^@(\S+?):([+-])\s+/,"#{Mx[:meta_o]}\\1\\2#{Mx[:meta_c]}") + end + end + end + end +end +__END__ diff --git a/lib/sisu/v3/dal_syntax.rb b/lib/sisu/v3/dal_syntax.rb new file mode 100644 index 00000000..34ac65e2 --- /dev/null +++ b/lib/sisu/v3/dal_syntax.rb @@ -0,0 +1,523 @@ +# 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: 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|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.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=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 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 emphasis + # !{bold text}! b{bold}b bold text + # _{underline}_ u{underline}u underline + # /{italics}/ i{italics}i italics + # "{citation}" c{citation}c citation #blockquote? + # ^{superscript}^ superscript + # ,{subscript}, subscript + # +{inserted text}+ inserted text + # -{deleted text}- deleted text + # #{monospace text}# + # + # {url address}:url + # {image.png}imageurl + # {image.png}png + # ~{endnote}~ + # !_ #bold/emphasise paragraph + # _" #blockquote paragraph + # _1 <:i1> #indent paragraph 1 step + # _2 <:i2> #indent paragraph 2 steps + # _3 <:i3> #indent paragraph 3 steps + # _4 <:i4> #indent paragraph 4 steps + # _* #bullet (list) ● + # _1* #bullet (list) indented + # _1* #bullet (list) indented + # # #numbered (list) level 1 + # _# #numbered (list) level 2 + dob=dob.dup + if dob.is !~/^(?:meta|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)/,",
#{@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.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 + 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!(//,'<:\1>') #escaped special character + dob.obj.gsub!(/ /,"#{Mx[:nbsp]}") #escaped special character + dob.obj.gsub!(/\\~/,"#{Mx[:gl_o]}#126#{Mx[:gl_c]}") #escaped special character + dob.obj.gsub!(/\\\{/,"#{Mx[:gl_o]}#123#{Mx[:gl_c]}") #escaped special character + dob.obj.gsub!(/\\\}/,"#{Mx[:gl_o]}#125#{Mx[:gl_c]}") #escaped special character + dob.obj.gsub!(/\\\<>/,"#{Mx[:gl_o]}#gt#{Mx[:gl_c]}#{Mx[:gl_o]}#gt#{Mx[:gl_c]}") #escaped special character + dob.obj.gsub!(/\\\/,"#{Mx[:gl_o]}#gt#{Mx[:gl_c]}") #escaped special character + dob.obj.gsub!(/\\\_/,"#{Mx[:gl_o]}#095#{Mx[:gl_c]}") #escaped special character + dob.obj.gsub!(/\\\-/,"#{Mx[:gl_o]}#045#{Mx[:gl_c]}") #escaped special character + dob.obj.gsub!(/\\\+/,"#{Mx[:gl_o]}#043#{Mx[:gl_c]}") #escaped special character + dob.obj.gsub!(/\\\//,"#{Mx[:gl_o]}#047#{Mx[:gl_c]}") #escaped special character + dob.obj.gsub!(/\\\#/,"#{Mx[:gl_o]}#035#{Mx[:gl_c]}") #escaped special character + dob.obj.gsub!(/\\\&/,"#{Mx[:gl_o]}#038#{Mx[:gl_c]}") #& #escaped special character + dob.obj.gsub!(/\\\|/,"#{Mx[:gl_o]}#124#{Mx[:gl_c]}") #not really a sisu special character but made available as possibility + dob.obj.gsub!(/\\\:/,"#{Mx[:gl_o]}#058#{Mx[:gl_c]}") #not really a sisu special character but made available as possibility + dob.obj.gsub!(/\\\!/,"#{Mx[:gl_o]}#033#{Mx[:gl_c]}") #not really a sisu special character but made available as possibility + dob.obj.gsub!(/\\\^/,"#{Mx[:gl_o]}#094#{Mx[:gl_c]}") #not really a sisu special character but made available as possibility + dob.obj.gsub!(/\\\,/,"#{Mx[:gl_o]}#044#{Mx[:gl_c]}") #not really a sisu special character but made available as possibility + dob.obj.gsub!(/\\\\/,"#{Mx[:gl_o]}#092#{Mx[:gl_c]}") #escaped special character + dob.obj.gsub!(/\\\*/,"#{Mx[:gl_o]}#042#{Mx[:gl_c]}") #escaped special character + dob.obj.gsub!(/\\\!/,"#{Mx[:gl_o]}#033#{Mx[:gl_c]}") #escaped special character + dob.obj.gsub!(/(?:<:?br>|
)/,"#{Mx[:br_line]}") #indent used in endnotes, not implemented, replace when ready with: line.gsub!(/(?:
|
)\s*_([12])\s+/,'
<:i\1> ') + 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!(/(?:<:?br>|
)/, + "#{Mx[:br_line]}") #indent used in endnotes, not implemented, replace when ready with: line.gsub!(/(?:
|
)\s*_([12])\s+/,'
<:i\1> ') + dob.obj.gsub!(/<:hi>/,"#{Mx[:fa_hilite_o]}") #'') # bright yellow rgb(255,255,0) pale yellow rgb(255,255,200) + dob.obj.gsub!(/<:\/hi>/,"#{Mx[:fa_hilite_c]}") #'') + dob.obj.gsub!(/(#{Mx[:gr_o]}verse#{Mx[:gr_c]}.+)/m,"\\1\n") + dob.obj.gsub!(/[ ]+($)/,'\1') + dob.obj.gsub!(/\{\s*(.+?)\s*\}(https?:\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/, + "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}#{Mx[:url_o]}\\2#{Mx[:url_c]}\\3") #any remaining linked text or image + dob.obj.gsub!(/\{\s*(.+?)\s*\}(#{Mx[:url_o]}\S+?#{Mx[:url_c]})/, + "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2") #any remaining linked text or image + dob.obj.gsub!(/(^|[ ])\{\s*(.+?)\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*\}#(\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[: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' +#p dob.obj + 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

back, clumsy + dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s)<(br(?: \/)?)>([\s,.]|$)/,'\1<\2>\3') #convert

back, clumsy + if dob.number_ + codeline=[] + ln=1 + dob.obj.split(/#{Mx[:gr_o]}codeline#{Mx[:gr_c]}||\n/).each_with_index do |cl,i| + unless i == 0 + cl.gsub!(Mx[:br_nl],'') + 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 emphasis + # !{bold text}! b{bold}b bold text + # _{underline}_ u{underline}u underline + # /{italics}/ i{italics}i italics + # "{citation}" c{citation}c citation + # ^{superscript}^ superscript + # ,{subscript}, subscript + # +{inserted text}+ inserted text + # -{deleted text}- deleted text + # #{monospace text}# + # {url address}:url + # {image.png}imageurl + # {image.png}png + # ~{endnote}~ + # +1 + # +2 + puts 'tech' + @data.each do |line| + line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)e\{(.+?)\}e/, + "\\1#{@emph[:o]}\\2#{@emph[:c]}") #emphasis + line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)b\{(.+?)\}b/, + "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold + line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)u\{(.+?)\}u/, + "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}") #underscore + line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)c\{(.+?)\}c/, + "\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}") #cite + line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)i\{(.+?)\}i/, + "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}") #italics + line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)!\{(.+?)\}!/, + "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold + line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)\*\{(.+?)\}\*/, + "\\1#{@emph[:o]}\\2#{@emph[:c]}") #emphasis + line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)_\{(.+?)\}_/, + "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}") #underscore + line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\(|\>)\/\{(.+?)\}\//, + "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}") #italics + line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\"\{(.+?)\}\"/, + "\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}") + line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\^\{(.+?)\}\^/, + "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") + line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)9\{(.+?)\}9/, + "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") + line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>),\{(.+?)\},/, + "\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}") + line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)6\{(.+?)\}6/, + "\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}") + line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\+\{(.+?)\}\+/, + "\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}") + line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)v\{(.+?)\}v/, + "\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}") + line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)-\{(.+?)\}-/, + "\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}") + line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)x\{(.+?)\}x/, + "\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}") + line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\*(\S+?)\*/, + "\\1#{@emph[:o]}\\2#{@emph[:c]}") #emphasise single word, watch + line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\!(\S+?)\!/, + "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold single word, watch + line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\/([\(\)a-zA-Z0-9']+?)\/([ ,.;:'"~$]|[^a-zA-Z0-9])/, + "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}\\3") #italics single word, watch + line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)_(\S+?)_/, + "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}") #underscore single word, watch + line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\^(\S+?)\^/, + "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") #check #superscript single word, watch digit added + line.gsub!(/^\s*_\([1-9]\)\(\*\+\)\s*/, + "#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}#{Mx[:fa_o]}\\2#{Mx[:fa_c_o]}") #bullets, shortcut + line.gsub!(/^\s*_\([1-9]\)\s+/, + "#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}") + line.gsub!(/(?:<:?br>|
)\s*_[12]\s+/, + "#{Mx[:br_line]} ") #indent used in endnotes, not implemented, replace when ready with: line.gsub!(/(?:
|
)\s*_([12])\s+/,'
<:i\1> ') + end + @data + end + end +end +__END__ diff --git a/lib/sisu/v3/db_columns.rb b/lib/sisu/v3/db_columns.rb new file mode 100644 index 00000000..c1fb6109 --- /dev/null +++ b/lib/sisu/v3/db_columns.rb @@ -0,0 +1,2079 @@ +# 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: modules shared by the different db types, dbi, postgresql, + 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 + def initialize(md=nil) + @md=md + @db=SiSU_Env::Info_db.new #watch + if defined? md.mod \ + and md.mod.inspect=~/import|update/ \ + and FileTest.exist?(md.fns) + txt_arr=IO.readlines(md.fns,'') + src=txt_arr.join("\n") + if @db.share_source? + @sisutxt=special_character_escape(src) + else @sisutxt='' + end + @fulltext=clean_searchable_text(txt_arr) + else @sisutxt,@fulltext='','' + end + end +#% structures + #def column_define + # def varchar(name,size) + # "#{name} VARCHAR(#{size}) NULL," + # end + #end +=begin +#% title +@title: + :subtitle: + :short: + :edition: + :language: + :note: +=end + def column + def title # DublinCore 1 - title + def name + 'title' + end + def create_column + "#{name} VARCHAR(#{Db[:col_title]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata full document title [DC1]';} + end + def tuple + t=if defined? @md.title.full \ + and @md.title.full=~/\S+/ + txt=@md.title.full + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def title_main + def name + 'title_main' + end + def create_column + "#{name} VARCHAR(#{Db[:col_title_part]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata main document title';} + end + def tuple + t=if defined? @md.title.main \ + and @md.title.main=~/\S+/ + txt=@md.title.main + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def title_sub + def name + 'title_sub' + end + def create_column + "#{name} VARCHAR(#{Db[:col_title_part]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata document subtitle';} + end + def tuple + t=if defined? @md.title.sub \ + and @md.title.sub=~/\S+/ + txt=@md.title.sub + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def title_short + def name + 'title_short' + end + def create_column + "#{name} VARCHAR(#{Db[:col_title_part]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata document short title if any';} + end + def tuple + t=if defined? @md.title.short \ + and @md.title.short=~/\S+/ + txt=@md.title.short + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def title_edition + def name + 'title_edition' + end + def create_column + "#{name} VARCHAR(#{Db[:col_title_edition]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata document edition (version)';} + end + def tuple + t=if defined? @md.title.edition \ + and @md.title.edition=~/\S+/ + txt=@md.title.edition + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def title_note + def name + 'title_note' + end + def create_column + "#{name} VARCHAR(#{Db[:col_info_note]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata document notes associated with title';} + end + def tuple + t=if defined? @md.title.note \ + and @md.title.note=~/\S+/ + txt=@md.title.note + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def title_language + def name + 'title_language' + end + def create_column + "#{name} VARCHAR(#{Db[:col_language]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + 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) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def title_language_char # consider + def name + 'title_language_char' + end + def create_column + "#{name} VARCHAR(#{Db[:col_language_char]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + 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) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end +=begin +#% creator +@creator: + :author: + :contributor: + :illustrator: + :photographer: + :translator: + :prepared_by: + :digitized_by: + :audio: + :video: +=end + def creator_author # DublinCore 2 - creator/author (author) + def name + 'creator_author' + end + def create_column + "#{name} VARCHAR(#{Db[:col_name]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata document author (creator) [DC2]';} + end + def tuple + t=if defined? @md.creator.author_detail \ + and @md.creator.author_detail.class==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) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def creator_author_honorific # consider + def name + 'creator_author_hon' + end + def create_column + "#{name} VARCHAR(#{Db[:col_creator_misc_short]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata document author honorific (title e.g, Ms. Dr. Prof.)';} + end + def tuple + t=if defined? @md.creator.author_hon \ + and @md.creator.author_hon=~/\S+/ + txt=@md.creator.author_hon + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def creator_author_nationality # consider + def name + 'creator_author_nationality' + end + def create_column + "#{name} VARCHAR(#{Db[:col_creator_misc_short]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata nationality of document author (creator)';} + end + def tuple + t=if defined? @md.creator.author_nationality_detail \ + and @md.creator.author_nationality=~/\S+/ + txt=@md.creator.author_nationality_detail + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def creator_contributor # DublinCore 6 - contributor + def name + 'creator_contributor' + end + def create_column + "#{name} VARCHAR(#{Db[:col_name]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata document contributor name(s) [DC6]';} + end + def tuple + t=if defined? @md.creator.contributor_detail \ + and @md.creator.contributor_detail.class==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) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def creator_illustrator + def name + 'creator_illustrator' + end + def create_column + "#{name} VARCHAR(#{Db[:col_name]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata document illustrator name(s)';} + end + def tuple + t=if defined? @md.creator.illustrator_detail \ + and @md.creator.illustrator_detail.class==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) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def creator_photographer + def name + 'creator_photographer' + end + def create_column + "#{name} VARCHAR(#{Db[:col_name]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata document photographer name(s)';} + end + def tuple + t=if defined? @md.creator.photographer_detail \ + and @md.creator.photographer_detail.class==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) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def creator_translator + def name + 'creator_translator' + end + def create_column + "#{name} VARCHAR(#{Db[:col_name]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata document translator name(s)';} + end + def tuple + t=if defined? @md.creator.translator_detail \ + and @md.creator.translator_detail.class==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) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def creator_prepared_by + def name + 'creator_prepared_by' + end + def create_column + "#{name} VARCHAR(#{Db[:col_name]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata document prepared by name(s)';} + 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.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) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def creator_digitized_by + def name + 'creator_digitized_by' + end + def create_column + "#{name} VARCHAR(#{Db[:col_name]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata document digitized by name(s)';} + 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.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) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def creator_audio + def name + 'creator_audio' + end + def create_column + "#{name} VARCHAR(#{Db[:col_name]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata document audio by name(s)';} + end + def tuple + t=if defined? @md.creator.audio_detail \ + and @md.creator.audio_detail.class==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) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def creator_video + def name + 'creator_video' + end + def create_column + "#{name} VARCHAR(#{Db[:col_name]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata document video by name(s)';} + end + def tuple + t=if defined? @md.creator.video_detail \ + and @md.creator.video_detail.class==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) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end +=begin +#% language +#taken from other fields +@title: + :language: +@original: + :language: +#not available --> +#@language: +# :document: +# :original: +=end + def language_document + def name + 'language_document' + end + def create_column + "#{name} VARCHAR(#{Db[:col_language]}) 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 \ + and @md.language.document=~/\S+/ + txt=@md.language.document + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def language_document_char + def name + 'language_document_char' + end + def create_column + "#{name} VARCHAR(#{Db[:col_language_char]}) 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) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def language_original + def name + 'language_original' + end + def create_column + "#{name} VARCHAR(#{Db[:col_language]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata original document/text language';} + end + def tuple + t=if defined? @md.language.original \ + and @md.language.original=~/\S+/ + txt=@md.language.original + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def language_original_char + def name + 'language_original_char' + end + def create_column + "#{name} VARCHAR(#{Db[:col_language_char]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata document language';} + end + def tuple + t=if defined? @md.language.original_char \ + and @md.language.original_char=~/\S+/ + txt=@md.language.original_char + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end +=begin +#% date +@date: + :added_to_site: + :available: + :created: + :issued: + :modified: + :published: + :valid: + :translated: + :original_publication: +=end + def date_added_to_site + def name + 'date_added_to_site' + end + def create_column + "#{name} VARCHAR(#{Db[:col_date_text]}) NULL," + #"#{name} DATE," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata date added to site';} + end + def tuple + 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) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def date_available + def name + 'date_available' + end + def create_column + "#{name} VARCHAR(#{Db[:col_date_text]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata date added to site [DC]';} + end + def tuple + t=if defined? @md.date.available \ + and @md.date.available=~/\S+/ + txt=@md.date.available + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def date_created + def name + 'date_created' + end + def create_column + "#{name} VARCHAR(#{Db[:col_date_text]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata date created [DC]';} + end + def tuple + t=if defined? @md.date.created \ + and @md.date.created=~/\S+/ + txt=@md.date.created + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def date_issued + def name + 'date_issued' + end + def create_column + "#{name} VARCHAR(#{Db[:col_date_text]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata date issued [DC]';} + end + def tuple + t=if defined? @md.date.issued \ + and @md.date.issued=~/\S+/ + txt=@md.date.issued + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def date_modified + def name + 'date_modified' + end + def create_column + "#{name} VARCHAR(#{Db[:col_date_text]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata date modified [DC]';} + end + def tuple + t=if defined? @md.date.modified \ + and @md.date.modified=~/\S+/ + txt=@md.date.modified + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def date_published + def name + 'date_published' + end + def create_column + "#{name} VARCHAR(#{Db[:col_date_text]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata date published [DC7]';} + end + def tuple + t=if defined? @md.date.published \ + and @md.date.published=~/\S+/ + txt=@md.date.published + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def date_valid + def name + 'date_valid' + end + def create_column + "#{name} VARCHAR(#{Db[:col_date_text]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata date valid [DC]';} + end + def tuple + t=if defined? @md.date.valid \ + and @md.date.valid=~/\S+/ + txt=@md.date.valid + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def date_translated + def name + 'date_translated' + end + def create_column + "#{name} VARCHAR(#{Db[:col_date_text]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata date translated';} + end + def tuple + t=if defined? @md.date.translated \ + and @md.date.translated=~/\S+/ + txt=@md.date.translated + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def date_original_publication + def name + 'date_original_publication' + end + def create_column + "#{name} VARCHAR(#{Db[:col_date_text]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata date of original publication';} + end + def tuple + t=if defined? @md.date.original_publication \ + and @md.date.original_publication=~/\S+/ + txt=@md.date.original_publication + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def date_generated + def name + 'date_generated' + end + def create_column #choose other representation of time + "#{name} VARCHAR(30) NULL," + #"#{name} VARCHAR(10) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata date of sisu generation of document, automatically populated';} + end + def tuple #choose other representation of time + t=if defined? @md.generated \ + and @md.generated.to_s=~/\S+/ + txt=@md.generated.to_s + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end +=begin +#% publisher +@publisher: +=end + def publisher + def name + 'publisher' + end + def create_column + "#{name} VARCHAR(#{Db[:col_name]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata document publisher [DC5]';} + end + def tuple + t=if defined? @md.publisher \ + and @md.publisher=~/\S+/ + txt=@md.publisher + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end +##% current +# def current_publisher +# def name +# 'current_publisher' +# end +# def size +# 10 +# end +# def create_column +# "#{name} VARCHAR(#{current_publisher.size}) NULL," +# end +# def tuple +# t=if defined? @md.current.publisher \ +# and @md.current.publisher=~/\S+/ +# txt=@md.current.publisher +# special_character_escape(txt) +# "'#{txt}', " +# end +# end +# self +# end +=begin +#% original +@original: + :publisher: + #:date: #repeated under date + :language: + :institution: + :nationality: + :source: +=end + def original_publisher + def name + 'original_publisher' + end + def create_column + "#{name} VARCHAR(#{Db[:col_name]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata document original publisher [DC5]';} + end + def tuple + t=if defined? @md.original.publisher \ + and @md.original.publisher=~/\S+/ + txt=@md.original.publisher + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def original_language + def name + 'original_language' + end + def create_column + "#{name} VARCHAR(#{Db[:col_language]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata document original language';} + end + def tuple + t=if defined? @md.original.language \ + and @md.original.language=~/\S+/ + txt=@md.original.language + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def original_language_char # consider + def name + 'original_language_char' + end + def create_column + "#{name} VARCHAR(#{Db[:col_language_char]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata document original language iso character';} + end + def tuple + t=if defined? @md.original.language_char \ + and @md.original.language_char=~/\S+/ + txt=@md.original.language_char + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def original_source + def name + 'original_source' + end + def create_column + "#{name} VARCHAR(#{Db[:col_name]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata document original source [DC11]';} + end + def tuple + t=if defined? @md.original.source \ + and @md.original.source=~/\S+/ + txt=@md.original.source + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def original_institution + def name + 'original_institution' + end + def create_column + "#{name} VARCHAR(#{Db[:col_name]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata document original institution';} + end + def tuple + t=if defined? @md.original.institution \ + and @md.original.institution=~/\S+/ + txt=@md.original.institution + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def original_nationality + def name + 'original_nationality' + end + def create_column + "#{name} VARCHAR(#{Db[:col_language]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata document original nationality';} + end + def tuple + t=if defined? @md.original.nationality \ + and @md.original.nationality=~/\S+/ + txt=@md.original.nationality + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end +=begin +#% rights +@rights: + #:copyright: #mapped to :text: used where no other copyrights and included in :all: + :text: + :translation: + :illustrations: + :photographs: + :preparation: + :digitization: + :audio: + :video: + :license: + :all: +=end + def rights_all + def name + 'rights' + end + def create_column + "#{name} VARCHAR(#{Db[:col_info_note]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata rights associated with document (composite) [DC15]';} + end + def tuple + t=if defined? @md.rights.all \ + and @md.rights.all=~/\S+/ + txt=@md.rights.all + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def rights_copyright_text + def name + 'rights_copyright_text' + end + def create_column + "#{name} VARCHAR(#{Db[:col_info_note]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata copyright associated for document text';} + end + def tuple + t=if defined? @md.rights.copyright_text \ + and @md.rights.copyright_text=~/\S+/ + txt=@md.rights.copyright_text + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def rights_copyright_translation + def name + 'rights_copyright_translation' + end + def create_column + "#{name} VARCHAR(#{Db[:col_info_note]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata copyright associated for document text translation (if any)';} + end + def tuple + t=if defined? @md.rights.copyright_translation \ + and @md.rights.copyright_translation=~/\S+/ + txt=@md.rights.copyright_translation + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def rights_copyright_illustrations + def name + 'rights_copyright_illustrations' + end + def create_column + "#{name} VARCHAR(#{Db[:col_info_note]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata copyright associated for document text illustrations (if any)';} + end + def tuple + t=if defined? @md.rights.copyright_illustrations \ + and @md.rights.copyright_illustrations=~/\S+/ + txt=@md.rights.copyright_illustrations + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def rights_copyright_photographs + def name + 'rights_copyright_photographs' + end + def create_column + "#{name} VARCHAR(#{Db[:col_info_note]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata copyright associated for document text photographs (if any)';} + end + def tuple + t=if defined? @md.rights.copyright_photographs \ + and @md.rights.copyright_photographs=~/\S+/ + txt=@md.rights.copyright_photographs + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def rights_copyright_preparation + def name + 'rights_copyright_preparation' + end + def create_column + "#{name} VARCHAR(#{Db[:col_info_note]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata copyright associated for document text preparation (if any)';} + end + def tuple + t=if defined? @md.rights.copyright_preparation \ + and @md.rights.copyright_preparation=~/\S+/ + txt=@md.rights.copyright_preparation + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def rights_copyright_digitization + def name + 'rights_copyright_digitization' + end + def create_column + "#{name} VARCHAR(#{Db[:col_info_note]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata copyright associated for document text digitization (if any)';} + end + def tuple + t=if defined? @md.rights.copyright_digitization \ + and @md.rights.copyright_digitization=~/\S+/ + txt=@md.rights.copyright_digitization + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def rights_copyright_audio + def name + 'rights_copyright_audio' + end + def create_column + "#{name} VARCHAR(#{Db[:col_info_note]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata copyright associated for document text audio (if any)';} + end + def tuple + t=if defined? @md.rights.copyright_audio \ + and @md.rights.copyright_audio=~/\S+/ + txt=@md.rights.copyright_audio + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def rights_copyright_video + def name + 'rights_copyright_video' + end + def create_column + "#{name} VARCHAR(#{Db[:col_info_note]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata copyright associated for document text video (if any)';} + end + def tuple + t=if defined? @md.rights.copyright_video \ + and @md.rights.copyright_video=~/\S+/ + txt=@md.rights.copyright_video + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def rights_license + def name + 'rights_license' + end + def create_column + "#{name} VARCHAR(#{Db[:col_info_note]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata license granted for use of document if any)';} + end + def tuple + t=if defined? @md.rights.license \ + and @md.rights.license=~/\S+/ + txt=@md.rights.license + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end +=begin +#% classify +@classify: + :topic_register: + :coverage: + :format: + :identifier: + :keywords: + :relation: + :subject: + :type: + :loc: + :dewey: + :pg: + :isbn: +=end + def classify_topic_register + def name + 'classify_topic_register' + end + def create_column + "#{name} VARCHAR(#{Db[:col_info_note]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata classify document topic register (semi-structured document subject information)';} + end + def tuple + t=if defined? @md.classify.topic_register \ + and @md.classify.topic_register=~/\S+/ + txt=@md.classify.topic_register + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def classify_subject + def name + 'classify_subject' + 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 subject matter [DC3]';} + end + def tuple + 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) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def classify_loc + def name + 'classify_loc' + 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 Library of Congress';} + end + def tuple + t=if defined? @md.classify.loc \ + and @md.classify.loc=~/\S+/ + txt=@md.classify.loc + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def classify_dewey + def name + 'classify_dewey' + 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 Dewey';} + end + def tuple + t=if defined? @md.classify.dewey \ + and @md.classify.dewey=~/\S+/ + txt=@md.classify.dewey + 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 name + 'classify_isbn' + 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 isbn (if any)';} + end + def tuple + t=if defined? @md.classify.isbn \ + and @md.classify.isbn=~/\S+/ + txt=@md.classify.isbn + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def classify_format + def name + 'classify_format' + 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 format [DC9]';} + end + def tuple + t=if defined? @md.classify.format \ + and @md.classify.format=~/\S+/ + txt=@md.classify.format + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def classify_identifier + def name + 'classify_identifier' + end + def create_column + "#{name} VARCHAR(#{Db[:col_classify_identify]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata classify document identifier [DC10]';} + end + def tuple + t=if defined? @md.classify.identifier \ + and @md.classify.identifier=~/\S+/ + txt=@md.classify.identifier + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def classify_relation + def name + 'classify_relation' + end + def create_column + "#{name} VARCHAR(#{Db[:col_classify_short]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata classify document relation [DC13]';} + end + def tuple + t=if defined? @md.classify.relation \ + and @md.classify.relation=~/\S+/ + txt=@md.classify.relation + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def classify_coverage + def name + 'classify_coverage' + end + def create_column + "#{name} VARCHAR(#{Db[:col_classify_short]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata classify document coverage [DC14]';} + end + def tuple + t=if defined? @md.classify.coverage \ + and @md.classify.coverage=~/\S+/ + txt=@md.classify.coverage + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def classify_keywords + def name + 'classify_keywords' + 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 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';} + end + def tuple + t=if defined? @md.notes.abstract \ + and @md.notes.abstract=~/\S+/ + txt=@md.notes.abstract + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def notes_comment + def name + 'notes_comment' + end + def create_column + "#{name} TEXT NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata document notes comment';} + end + def tuple + t=if defined? @md.notes.comment \ + and @md.notes.comment=~/\S+/ + txt=@md.notes.comment + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def notes_description + def name + 'notes_description' + end + def create_column + "#{name} TEXT NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata document notes description [DC4]';} + end + def tuple + t=if defined? @md.notes.description \ + and @md.notes.description=~/\S+/ + txt=@md.notes.description + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def notes_history #check, consider removal + def name + 'notes_history' + 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 document notes history';} + end + def tuple + t=if defined? @md.notes.history \ + and @md.notes.history=~/\S+/ + txt=@md.notes.history + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def notes_prefix + def name + 'notes_prefix' + end + def create_column + "#{name} TEXT NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata document notes prefix';} + end + def tuple + t=if defined? @md.notes.prefix \ + and @md.notes.prefix=~/\S+/ + txt=@md.notes.prefix + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def notes_prefix_a + def name + 'notes_prefix_a' + end + def create_column + "#{name} TEXT NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata document notes prefix_a';} + end + def tuple + t=if defined? @md.notes.prefix_a \ + and @md.notes.prefix_a=~/\S+/ + txt=@md.notes.prefix_a + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def notes_prefix_b + def name + 'notes_prefix_b' + end + def create_column + "#{name} TEXT NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata document notes prefix_b';} + end + def tuple + t=if defined? @md.notes.prefix_b \ + and @md.notes.prefix_b=~/\S+/ + txt=@md.notes.prefix_b + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def notes_suffix + def name + 'notes_suffix' + end + def create_column # keep text + "#{name} TEXT NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata document notes suffix';} + end + def tuple + t=if defined? @md.notes.suffix \ + and @md.notes.suffix=~/\S+/ + txt=@md.notes.suffix + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end +=begin +#% src +=end + def src_filename + def name + 'src_filename' + end + def create_column + "#{name} VARCHAR(#{Db[:col_filename]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'sisu markup source text filename';} + end + def tuple + t=if defined? @md.fns \ + and @md.fns=~/\S+/ + txt=@md.fns + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def src_fingerprint + def name + 'src_fingerprint' #hash/digest, sha256 or md5 + end + def create_column + "#{name} VARCHAR(#{Db[:col_digest]}) NULL," + #"#{name} TEXT NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'sisu markup source text fingerprint, hash digest sha256 (or md5)';} + end + def tuple + t=if defined? @md.dgst \ + and @md.dgst.class==Array \ + and @md.dgst[1]=~/\S+/ + txt=@md.dgst[1] + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def src_filesize + def name + 'src_filesize' + end + def create_column + "#{name} VARCHAR(#{Db[:col_filesize]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'sisu markup source text file size';} + end + def tuple + t=if defined? @md.filesize \ + and @md.filesize=~/\S+/ + txt=@md.filesize + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def src_word_count + def name + 'src_word_count' + end + def create_column + "#{name} TEXT NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'sisu markup source text word count';} + end + def tuple + t=if defined? @md.wc_words \ + and @md.wc_words=~/\S+/ + txt=@md.wc_words + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + def src_txt # consider naming sisusrc + def name + 'src_text' + end + def create_column + "#{name} TEXT NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'sisu markup source text (if shared)';} + end + def tuple + t=if @md.mod.inspect=~/import|update/ \ + and FileTest.exist?(@md.fns) + ["#{name}, ","'#{@sisutxt}', "] + else ['',''] + end + end + self + end +=begin +#% misc +@make: + :skin: +@links: +=end + def fulltext + def name + 'fulltext' + end + def create_column + "#{name} TEXT NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'document full text clean, searchable';} + end + def tuple + t=if @md.mod.inspect=~/import|update/ \ + and FileTest.exist?(@md.fns) + ["#{name}, ","'#{@fulltext}', "] + else ['',''] + end + 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' + end + def create_column + "#{name} TEXT NULL," + #"#{name} VARCHAR(#{links.size}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata document links';} + end + def tuple + t=if defined? @md.links \ + and @md.links=~/\S+/ + txt=@md.links + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end + self + end + end + class Column_size + def document_clean # restriction not necessary + 60000 + end + def document_body + 16000 + end + def document_seg + 120 + end + def document_seg_full + 120 + end + def endnote_clean # restriction not necessary + 60000 + end + def endnote_body + 16000 + end + end +end +__END__ diff --git a/lib/sisu/v3/db_create.rb b/lib/sisu/v3/db_create.rb new file mode 100644 index 00000000..2676542e --- /dev/null +++ b/lib/sisu/v3/db_create.rb @@ -0,0 +1,612 @@ +# 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: modules shared by the different db types, dbi, postgresql, + 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 + @@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)) \ + : nil + @@dl ||=SiSU_Env::Info_env.new.digest.length + end + def available + DBI.available_drivers.each do |driver| + puts "Driver: #{driver}" + DBI.data_sources(driver).each do |dsn| + puts "\tDatasource: #{dsn}" + end + end + end + def create_db + @env=SiSU_Env::Info_env.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 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 + end + def output_dir? + dir=SiSU_Env::Info_env.new('') + if @opt.cmd =~/d/ + dir.path.webserv_stub_ensure + end + end + def create_table + def metadata_and_text + print %{ + currently using sisu dbi module + to be populated from document files + create tables metadata_and_text + data import through ruby transfer + } unless @opt.cmd =~/q/ + @conn.execute(%{ + CREATE TABLE metadata_and_text ( + tid BIGINT PRIMARY KEY, + /* title */ + #{column.title.create_column} + #{column.title_main.create_column} + #{column.title_sub.create_column} + #{column.title_short.create_column} + #{column.title_edition.create_column} + #{column.title_note.create_column} + #{column.title_language.create_column} + #{column.title_language_char.create_column} + /* creator */ + #{column.creator_author.create_column} + #{column.creator_author_honorific.create_column} + #{column.creator_author_nationality.create_column} + #{column.creator_contributor.create_column} + #{column.creator_illustrator.create_column} + #{column.creator_photographer.create_column} + #{column.creator_translator.create_column} + #{column.creator_prepared_by.create_column} + #{column.creator_digitized_by.create_column} + #{column.creator_audio.create_column} + #{column.creator_video.create_column} + /* language */ + #{column.language_document.create_column} + #{column.language_document_char.create_column} + #{column.language_original.create_column} + #{column.language_original_char.create_column} + /* date */ + #{column.date_added_to_site.create_column} + #{column.date_available.create_column} + #{column.date_created.create_column} + #{column.date_issued.create_column} + #{column.date_modified.create_column} + #{column.date_published.create_column} + #{column.date_valid.create_column} + #{column.date_translated.create_column} + #{column.date_original_publication.create_column} + #{column.date_generated.create_column} + /* publisher */ + #{column.publisher.create_column} + /* original */ + #{column.original_publisher.create_column} + #{column.original_language.create_column} + #{column.original_language_char.create_column} + #{column.original_source.create_column} + #{column.original_institution.create_column} + #{column.original_nationality.create_column} + /* rights */ + #{column.rights_all.create_column} + #{column.rights_copyright_text.create_column} + #{column.rights_copyright_translation.create_column} + #{column.rights_copyright_illustrations.create_column} + #{column.rights_copyright_photographs.create_column} + #{column.rights_copyright_preparation.create_column} + #{column.rights_copyright_digitization.create_column} + #{column.rights_copyright_audio.create_column} + #{column.rights_copyright_video.create_column} + #{column.rights_license.create_column} + /* classify */ + #{column.classify_topic_register.create_column} + #{column.classify_subject.create_column} + #{column.classify_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} + /* notes */ + #{column.notes_abstract.create_column} + #{column.notes_comment.create_column} + #{column.notes_description.create_column} + #{column.notes_history.create_column} + #{column.notes_prefix.create_column} + #{column.notes_prefix_a.create_column} + #{column.notes_prefix_b.create_column} + #{column.notes_suffix.create_column} + /* src */ + #{column.src_filename.create_column} + #{column.src_fingerprint.create_column} + #{column.src_filesize.create_column} + #{column.src_word_count.create_column} + #{column.src_txt.create_column} + /* misc */ + #{column.fulltext.create_column} + #{column.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, */ +/* information VARCHAR(100) NULL, */ +/* types CHAR(1) NULL, */ +/* writing_focus_nationality VARCHAR(100) NULL, */ + ); + }) + @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(%{ + CREATE TABLE doc_objects ( + lid BIGINT PRIMARY KEY, + metadata_tid BIGINT REFERENCES metadata_and_text, + ocn SMALLINT, + ocnd VARCHAR(6), + ocns VARCHAR(6), + clean TEXT NULL, + body TEXT NULL, + seg VARCHAR(256) NULL, + lev_an VARCHAR(1), + lev SMALLINT NULL, + lev1 SMALLINT, + lev2 SMALLINT, + lev3 SMALLINT, + lev4 SMALLINT, + lev5 SMALLINT, + lev6 SMALLINT, + en_a SMALLINT NULL, + en_z SMALLINT NULL, + en_a_asterisk SMALLINT NULL, + en_z_asterisk SMALLINT NULL, + en_a_plus SMALLINT NULL, + en_z_plus SMALLINT NULL, + t_of VARCHAR(16), + t_is VARCHAR(16), + node VARCHAR(16) NULL, + parent VARCHAR(16) NULL, + digest_clean CHAR(#{@@dl}), + digest_all CHAR(#{@@dl}), + types CHAR(1) NULL + ); + }) + @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(%{ + CREATE TABLE endnotes ( + nid BIGINT PRIMARY KEY, + document_lid BIGINT REFERENCES doc_objects, + nr SMALLINT, + clean TEXT NULL, + body TEXT NULL, + ocn SMALLINT, + ocnd VARCHAR(6), + ocns VARCHAR(6), + digest_clean CHAR(#{@@dl}), + metadata_tid BIGINT REFERENCES metadata_and_text + ); + }) + @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(%{ + CREATE TABLE endnotes_asterisk ( + nid BIGINT PRIMARY KEY, + document_lid BIGINT REFERENCES doc_objects, + nr SMALLINT, + clean TEXT NULL, + body TEXT NULL, + ocn SMALLINT, + ocnd VARCHAR(6), + ocns VARCHAR(6), + digest_clean CHAR(#{@@dl}), + metadata_tid BIGINT REFERENCES metadata_and_text + ); + }) + @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(%{ + CREATE TABLE endnotes_plus ( + nid BIGINT PRIMARY KEY, + document_lid BIGINT REFERENCES doc_objects, + nr SMALLINT, + clean TEXT NULL, + body TEXT NULL, + ocn SMALLINT, + ocnd VARCHAR(6), + ocns VARCHAR(6), + digest_clean CHAR(#{@@dl}), + metadata_tid BIGINT REFERENCES metadata_and_text + ); + }) + @comment.psql.endnotes_plus if @comment + end + def urls # create doc_objects file links mapping + print %{ + currently using sisu dbi module + to be populated from doc_objects files + create tables urls + data import through ruby transfer + } unless @opt.cmd =~/q/ + @conn.execute(%{ + CREATE TABLE urls ( + metadata_tid BIGINT REFERENCES metadata_and_text, + plaintext varchar(512), + html_toc varchar(512), + html_doc varchar(512), + xhtml varchar(512), + xml_sax varchar(512), + xml_dom varchar(512), + odf varchar(512), + pdf_p varchar(512), + pdf_l varchar(512), + concordance varchar(512), + latex_p varchar(512), + latex_l varchar(512), + digest varchar(512), + manifest varchar(512), + markup varchar(512), + sisupod varchar(512) + ); + }) + @comment.psql.urls if @comment + end + self + end + end + class Comment < SiSU_DB_columns::Columns + def initialize(conn,sql_type='pg') + @conn=conn + if sql_type =~ /pg/; psql + end + end + def psql + def conn_execute_array(sql_arr) + @conn.transaction do |conn| + sql_arr.each do |sql| + conn.execute(sql) + end + end + end + def metadata_and_text + sql_arr=[ + %{COMMENT ON Table metadata_and_text + IS 'contains SiSU metadata and fulltext for search (including source .sst if shared)';}, + %{COMMENT ON COLUMN metadata_and_text.tid + IS 'unique';}, + %{#{column.title.column_comment}}, + %{#{column.title_main.column_comment}}, + %{#{column.title_sub.column_comment}}, + %{#{column.title_short.column_comment}}, + %{#{column.title_edition.column_comment}}, + %{#{column.title_note.column_comment}}, + %{#{column.title_language.column_comment}}, + %{#{column.title_language_char.column_comment}}, + %{#{column.creator_author.column_comment}}, + %{#{column.creator_author_honorific.column_comment}}, + %{#{column.creator_author_nationality.column_comment}}, + %{#{column.creator_contributor.column_comment}}, + %{#{column.creator_illustrator.column_comment}}, + %{#{column.creator_photographer.column_comment}}, + %{#{column.creator_translator.column_comment}}, + %{#{column.creator_prepared_by.column_comment}}, + %{#{column.creator_digitized_by.column_comment}}, + %{#{column.creator_audio.column_comment}}, + %{#{column.creator_video.column_comment}}, + %{#{column.language_document.column_comment}}, + %{#{column.language_document_char.column_comment}}, + %{#{column.language_original.column_comment}}, + %{#{column.language_original_char.column_comment}}, + %{#{column.date_added_to_site.column_comment}}, + %{#{column.date_available.column_comment}}, + %{#{column.date_created.column_comment}}, + %{#{column.date_issued.column_comment}}, + %{#{column.date_modified.column_comment}}, + %{#{column.date_published.column_comment}}, + %{#{column.date_valid.column_comment}}, + %{#{column.date_translated.column_comment}}, + %{#{column.date_original_publication.column_comment}}, + %{#{column.date_generated.column_comment}}, + %{#{column.publisher.column_comment}}, + %{#{column.original_publisher.column_comment}}, + %{#{column.original_language.column_comment}}, + %{#{column.original_language_char.column_comment}}, + %{#{column.original_source.column_comment}}, + %{#{column.original_institution.column_comment}}, + %{#{column.original_nationality.column_comment}}, + %{#{column.rights_all.column_comment}}, + %{#{column.rights_copyright_text.column_comment}}, + %{#{column.rights_copyright_translation.column_comment}}, + %{#{column.rights_copyright_illustrations.column_comment}}, + %{#{column.rights_copyright_photographs.column_comment}}, + %{#{column.rights_copyright_preparation.column_comment}}, + %{#{column.rights_copyright_digitization.column_comment}}, + %{#{column.rights_copyright_audio.column_comment}}, + %{#{column.rights_copyright_video.column_comment}}, + %{#{column.rights_license.column_comment}}, + %{#{column.classify_topic_register.column_comment}}, + %{#{column.classify_subject.column_comment}}, + %{#{column.classify_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.notes_abstract.column_comment}}, + %{#{column.notes_comment.column_comment}}, + %{#{column.notes_description.column_comment}}, + %{#{column.notes_history.column_comment}}, + %{#{column.notes_prefix.column_comment}}, + %{#{column.notes_prefix_a.column_comment}}, + %{#{column.notes_prefix_b.column_comment}}, + %{#{column.notes_suffix.column_comment}}, + %{#{column.src_filename.column_comment}}, + %{#{column.src_fingerprint.column_comment}}, + %{#{column.src_filesize.column_comment}}, + %{#{column.src_word_count.column_comment}}, + %{#{column.src_txt.column_comment}}, + %{#{column.fulltext.column_comment}}, + %{#{column.skin_name.column_comment}}, + %{#{column.skin_fingerprint.column_comment}}, + %{#{column.skin.column_comment}}, + %{#{column.links.column_comment}}, + ] + conn_execute_array(sql_arr) + end + def doc_objects + sql_arr=[ + %{COMMENT ON Table doc_objects + IS 'contains searchable text of SiSU document objects';}, + %{COMMENT ON COLUMN doc_objects.lid + IS 'unique';}, + %{COMMENT ON COLUMN doc_objects.metadata_tid + IS 'tie to title in metadata_and_text';}, + %{COMMENT ON COLUMN doc_objects.lev_an + IS 'doc level A-C 1-6';}, + %{COMMENT ON COLUMN doc_objects.lev + IS 'doc level 1-6 \d\~';}, + %{COMMENT ON COLUMN doc_objects.seg + IS 'segment name from level number 4 (lv 1)';}, + %{COMMENT ON COLUMN doc_objects.ocn + IS 'object citation number';}, + %{COMMENT ON COLUMN doc_objects.en_a + IS 'first endnote number in text object (eg. NULL or 34) (used with en_z to create range)';}, + %{COMMENT ON COLUMN doc_objects.en_z + IS 'last endnote number within text object (eg. NULL, 34 or say 47) (used with en_a to create range)';}, + %{COMMENT ON COLUMN doc_objects.en_a_asterisk + IS 'first endnote number in text object (eg. NULL or 34) (used with en_z_asterisk to create range)';}, + %{COMMENT ON COLUMN doc_objects.en_z_asterisk + IS 'last endnote number within text object (eg. NULL, 34 or say 47) (used with en_a_asterisk to create range)';}, + %{COMMENT ON COLUMN doc_objects.en_a_plus + IS 'first endnote number in text object (eg. NULL or 34) (used with en_z_plus to create range)';}, + %{COMMENT ON COLUMN doc_objects.en_z_plus + IS 'last endnote number within text object (eg. NULL, 34 or say 47) (used with en_a_plus to create range)';}, + %{COMMENT ON COLUMN doc_objects.types + IS 'document types seg scroll';}, + %{COMMENT ON COLUMN doc_objects.clean + IS 'text object - substantive text: clean, stripped of markup';}, + %{COMMENT ON COLUMN doc_objects.body + IS 'text object - substantive text: light html markup';}, + %{COMMENT ON COLUMN doc_objects.lev1 + IS 'document structure, level number 1';}, + %{COMMENT ON COLUMN doc_objects.lev2 + IS 'document structure, level number 2';}, + %{COMMENT ON COLUMN doc_objects.lev3 + IS 'document structure, level number 3';}, + %{COMMENT ON COLUMN doc_objects.lev4 + IS 'document structure, level number 4';}, + %{COMMENT ON COLUMN doc_objects.lev5 + IS 'document structure, level number 5';}, + %{COMMENT ON COLUMN doc_objects.lev6 + IS 'document structure, level number 6';}, + %{COMMENT ON COLUMN doc_objects.t_of + IS 'document structure, type of object (object is of)';}, + %{COMMENT ON COLUMN doc_objects.t_is + IS 'document structure, object is';}, + %{COMMENT ON COLUMN doc_objects.node + IS 'document structure, object node if heading';}, + %{COMMENT ON COLUMN doc_objects.parent + IS 'document structure, object parent (is a heading)';} + ] + conn_execute_array(sql_arr) + end + def endnotes + sql_arr=[ + %{COMMENT ON Table endnotes + IS 'contains searchable text of SiSU documents endnotes';}, + %{COMMENT ON COLUMN endnotes.nid + IS 'unique';}, + %{COMMENT ON COLUMN endnotes.document_lid + IS 'ties to text block from which referenced';}, + %{COMMENT ON COLUMN endnotes.nr + IS 'endnote number ';}, + %{COMMENT ON COLUMN endnotes.clean + IS 'endnote substantive content, stripped of markup';}, + %{COMMENT ON COLUMN endnotes.body + IS 'endnote substantive content';}, + %{COMMENT ON COLUMN endnotes.ocn + IS 'object citation no# <\~(\d+)> from which endnote is referenced';}, + %{COMMENT ON COLUMN doc_objects.metadata_tid + IS 'tie to title in metadata_and_text - unique for each document';} + ] + conn_execute_array(sql_arr) + end + def endnotes_asterisk + sql_arr=[ + %{COMMENT ON Table endnotes_asterisk + IS 'contains searchable text of SiSU documents endnotes marked with asterisk';}, + %{COMMENT ON COLUMN endnotes_asterisk.nid + IS 'unique';}, + %{COMMENT ON COLUMN endnotes_asterisk.document_lid + IS 'ties to text block from which referenced';}, + %{COMMENT ON COLUMN endnotes_asterisk.nr + IS 'endnote number ';}, + %{COMMENT ON COLUMN endnotes_asterisk.clean + IS 'endnote substantive content, stripped of markup';}, + %{COMMENT ON COLUMN endnotes_asterisk.body + IS 'endnote substantive content';}, + %{COMMENT ON COLUMN endnotes_asterisk.ocn + IS 'object citation no# <\~(\d+)> from which endnote is referenced';}, + %{COMMENT ON COLUMN doc_objects.metadata_tid + IS 'tie to title in metadata_and_text - unique for each document';} + ] + conn_execute_array(sql_arr) + end + def endnotes_plus + sql_arr=[ + %{COMMENT ON Table endnotes_plus + IS 'contains searchable text of SiSU documents endnotes marked with plus';}, + %{COMMENT ON COLUMN endnotes_plus.nid + IS 'unique';}, + %{COMMENT ON COLUMN endnotes_plus.document_lid + IS 'ties to text block from which referenced';}, + %{COMMENT ON COLUMN endnotes_plus.nr + IS 'endnote number ';}, + %{COMMENT ON COLUMN endnotes_plus.clean + IS 'endnote substantive content, stripped of markup';}, + %{COMMENT ON COLUMN endnotes_plus.body + IS 'endnote substantive content';}, + %{COMMENT ON COLUMN endnotes_plus.ocn + IS 'object citation no# <\~(\d+)> from which endnote is referenced';}, + %{COMMENT ON COLUMN doc_objects.metadata_tid + IS 'tie to title in metadata_and_text - unique for each document';}, + ] + conn_execute_array(sql_arr) + end + def urls + sql_arr=[ + %{COMMENT ON Table urls + IS 'contains base url links to different SiSU output';}, + %{COMMENT ON COLUMN doc_objects.metadata_tid + IS 'tie to title in metadata_and_text - unique for each document, the mapping of rows is one to one';}, + %{COMMENT ON COLUMN urls.plaintext + IS 'plaintext utf-8';}, + %{COMMENT ON COLUMN urls.html_toc + IS 'table of contents for segmented html document';}, + %{COMMENT ON COLUMN urls.html_doc + IS 'html document (scroll)';}, + %{COMMENT ON COLUMN urls.xhtml + IS 'xhtml document (scroll)';}, + %{COMMENT ON COLUMN urls.xml_sax + IS 'xml sax oriented document (scroll)';}, + %{COMMENT ON COLUMN urls.xml_dom + IS 'xml dom oriented document (scroll)';}, + %{COMMENT ON COLUMN urls.odf + IS 'opendocument format text';}, + %{COMMENT ON COLUMN urls.pdf_p + IS 'pdf portrait';}, + %{COMMENT ON COLUMN urls.pdf_l + IS 'pdf landscape';}, + %{COMMENT ON COLUMN urls.concordance + IS 'rudimentary document index linked to html';}, + %{COMMENT ON COLUMN urls.latex_p + IS 'latex portrait';}, + %{COMMENT ON COLUMN urls.latex_l + IS 'latex_landscape';}, + %{COMMENT ON COLUMN urls.markup + IS 'markup';}, + %{COMMENT ON COLUMN urls.sisupod + IS 'SiSU document format .tgz (all SiSU information on document)';}, + ] + conn_execute_array(sql_arr) + end + self + end + end +end +__END__ diff --git a/lib/sisu/v3/db_dbi.rb b/lib/sisu/v3/db_dbi.rb new file mode 100644 index 00000000..1a3825b9 --- /dev/null +++ b/lib/sisu/v3/db_dbi.rb @@ -0,0 +1,93 @@ +# 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: modules shared by the different db types, dbi, postgresql, + sqlite + +=end +module SiSU_DB_drop + class Drop + require "#{SiSU_lib}/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 + case @sql_type + when /sqlite/ + cascade='' + else + cascade='CASCADE' + end + @drop_table=[ + "DROP TABLE metadata_and_text #{cascade};", + "DROP TABLE doc_objects #{cascade};", + "DROP TABLE urls #{cascade};", + "DROP TABLE endnotes #{cascade};", + "DROP TABLE endnotes_asterisk #{cascade};", + "DROP TABLE endnotes_plus #{cascade};", + ] + end + def drop + def tables #% drop all tables + begin + msg_sqlite="as not all disk space is recovered after dropping the database << #{@db_info.sqlite.db} >>, you may be better off deleting the file, and recreating it as necessary" + case @sql_type + when /sqlite/ + puts msg_sqlite + ans=@ans.response?('remove sql database?') + if ans \ + and File.exist?(@db_info.sqlite.db) + @conn.close + File.unlink(@db_info.sqlite.db) + db=SiSU_Env::Info_db.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.output_dir? + begin + sdb.create_db + sdb.create_table.metadata_and_text + sdb.create_table.doc_objects + sdb.create_table.endnotes + sdb.create_table.endnotes_asterisk + sdb.create_table.endnotes_plus + sdb.create_table.urls + sdb_index.create_indexes + rescue; SiSU_Errors::Info_error.new($!,$@,'-D').error; @sdb.output_dir? + end + exit + else + @conn.transaction + @drop_table.each do |d| + @conn.execute(d) + end + @conn.commit + end + else + @drop_table.each do |d| + @conn.execute(d) + end + end + rescue + case @sql_type + when /sqlite/ + ans=@ans.response?('remove sql database?') + if ans and File.exist?(@db_info.sqlite.db); File.unlink(@db_info.sqlite.db) + end + else + @drop_table.each do |d| + @conn.execute(d) + end + end + ensure + end + end + def indexes + def conn_execute_array(sql_arr) + @conn.transaction do |conn| + sql_arr.each do |sql| + conn.execute(sql) + end + end + end + def base #% drop base indexes + print "\n drop documents common indexes\n" unless @opt.cmd =~/q/ + sql_arr=[ + %{DROP INDEX idx_title;}, + %{DROP INDEX idx_author;}, + %{DROP INDEX idx_filename;}, + %{DROP INDEX idx_topics;}, + %{DROP INDEX idx_ocn;}, + %{DROP INDEX idx_digest_clean;}, + %{DROP INDEX idx_digest_all;}, + %{DROP INDEX idx_lev1;}, + %{DROP INDEX idx_lev2;}, + %{DROP INDEX idx_lev3;}, + %{DROP INDEX idx_lev4;}, + %{DROP INDEX idx_lev5;}, + %{DROP INDEX idx_lev6;}, + %{DROP INDEX idx_endnote_nr;}, + %{DROP INDEX idx_digest_en;}, + %{DROP INDEX idx_endnote_nr_asterisk;}, + %{DROP INDEX idx_endnote_asterisk;}, + %{DROP INDEX idx_digest_en_asterisk;}, + %{DROP INDEX idx_endnote_nr_plus;}, + %{DROP INDEX idx_endnote_plus;}, + %{DROP INDEX idx_digest_en_plus}, + ] + conn_execute_array(sql_arr) + end + def text #% drop TEXT indexes, sqlite + print "\n drop documents TEXT indexes\n" unless @opt.cmd =~/q/ + sql_arr=[ + %{DROP INDEX idx_clean;}, + %{DROP INDEX idx_endnote}, + ] + conn_execute_array(sql_arr) + end + self + end + indexes.base + @opt.cmd=~/D/ || ((@opt.mod=~/psql/) ? '' : indexes.text) + self + end + end +end +__END__ diff --git a/lib/sisu/v3/db_import.rb b/lib/sisu/v3/db_import.rb new file mode 100644 index 00000000..41515747 --- /dev/null +++ b/lib/sisu/v3/db_import.rb @@ -0,0 +1,649 @@ +# 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: modules shared by the different db types, dbi, postgresql, + 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 + require 'sqlite3' + class Import < SiSU_DB_text::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 + @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='' + else + @md=SiSU_Param::Parameters.new(@opt).get + @fnb=@md.fnb + end + @suffix=@opt.fns[/(?:.+?)(?:\.ssm\.sst|\.-?sst)/,1] + @fnc="#{@dal}/#{@opt.fns}.content.rbm" + @@seg,@@seg_full='','' #create? consider placing field just before clean text as opposed to seg which contains seg(.html) name info seg_full would contain seg info for levels 5 & 6 where available eg seg_full may be 7.3 (level 5) and 7.3.1 (level 6) where seg is 7 + @col=Hash.new('') + @col[:ocn]='' + @counter={} + @db=SiSU_Env::Info_db.new + if @sql_type=='sqlite' + @driver_sqlite3=(@conn.inspect.match(/^(.{10})/)[1]==@db.sqlite.conn_sqlite3.inspect.match(/^(.{10})/)[1]) \ + ? 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 } + 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 } + 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 + end + def marshal_load + require "#{SiSU_lib}/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}'; } + file_exist=@sql_type=~/sqlite/ \ + ? @conn.get_first_value(select_first_match) \ + : @conn.select_one(select_first_match) + if not file_exist + t_d=[] # transaction_data + t_d << db_import_metadata + t_d << db_import_documents(@dal_array) + t_d << db_import_urls(@dal_array,@fnc) #import OID on/off + t_d=t_d.flatten + if @opt.cmd =~/[MV]/ + puts @conn.class if defined? @conn.class + puts @conn.driver_name if defined? @conn.driver_name + puts @conn.driver if defined? @conn.driver + end + begin + sql='' + if @sql_type=~/sqlite/ + @conn.transaction do |conn| + t_d.each do |sql| + conn.execute(sql) + end + end + #also 'execute' works for sqlite + #@conn.execute("BEGIN") + # t_d.each do |sql| + # @conn.execute(sql) + # end + #@conn.execute("COMMIT") + else + #'do' works for postgresql + @conn.do("BEGIN") + t_d.each do |sql| + @conn.do(sql) + end + @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" + sql=File.new(sqlfn,'w') + t_d.each {|i| sql.puts i} + p sqlfn + if @opt.cmd =~/M/ + puts sql + p @conn.methods.sort + puts "#{__FILE__}:#{__LINE__}" + end + rescue + SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error + sqlfn="#{@env.path.sql}/#{@md.fnb}.sql" + sql=File.new(sqlfn,'w') + t_d.each {|i| sql.puts i} + p sqlfn + if @opt.cmd =~/M/ + puts sql + p @conn.methods.sort + puts "#{__FILE__}:#{__LINE__}" + end + ensure + 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}" + end + end + end + def pf_db_import_transaction_open + end + def pf_db_import_transaction_close + end + def db_import_metadata #% import documents - populate database + print %{ #{@cX.grey}import documents dbi_unit #{@cX.off} } if @opt.cmd =~/vVM/ + @tp={} + @md=SiSU_Param::Parameters.new(@opt).get +#% sisutxt & fulltxt + if FileTest.exist?(@md.fns) + txt_arr=IO.readlines(@md.fns,'') + src=txt_arr.join("\n") + src=special_character_escape(src) + @tp[:sisutxt_f],@tp[:sisutxt_i]='sisutxt, ',"'#{src}', " + txt=clean_searchable_text(txt_arr) + #special_character_escape(txt) + @tp[:fulltxt_f],@tp[:fulltxt_i]='fulltxt, ',"'#{txt}', " + end +#% title + if defined? @md.title.full \ + and @md.title.full=~/\S+/ # DublinCore 1 - title + #@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' + 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 } + 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) + tuple=t.tuple + tuple + end + def db_import_documents(dal_array) #% import documents - populate main database table, import into substantive database tables (tuple) + begin + @col[:tid]=@@id_t + @en,@en_ast,@en_pls,@tuple_array=[],[],[],[] + @col[:en_a],@col[:en_z]=nil,nil + dal_array.each do |data| + data.obj.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\1') + data.obj.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\1') + data.obj.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\1') + data.obj.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'\1') + data.obj.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'\1') + data.obj.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'\1') + data.obj.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'\1') + data.obj.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'\1') + data.obj.gsub!(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'\1') + 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|block|group/ # regular text what of code-blocks grouped text etc. + notedata=data.obj.dup + if data.is=='heading' \ + and 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 + end + if @en_ast[0]; @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 + end + t=SiSU_DB_tuple::Load_documents.new(@conn,@col,@opt,@file) + @tuple_array << t.tuple + case @col[:lev] + when /1/; @col[:lv1]+=1 + when /2/; @col[:lv2]+=1 + when /3/; @col[:lv3]+=1 + end + @col[:lev]=@col[:plaintext]=@col[:body]='' + elsif data.is=='heading' \ + and 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 + @col[:lid]+=1 + @col[:lev]=4 + @hname=if @col[:seg] \ + and not @col[:seg].to_s.empty? + @@hname=@col[:seg].to_s + else @@hname + end + @env=SiSU_Env::Info_env.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]) + @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) + @tuple_array << t.tuple + @col[:lev]=@col[:plaintext]=@col[:body]='' + elsif data.is=='heading' and 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 ||='' #nil # watch + @col[:seg]=@@seg + @col[:lv5]+=1 + @col[:lid]+=1 + @col[:lev]=5 + @hname=if @col[:seg] \ + and not @col[:seg].to_s.empty? + @@hname=@col[:seg].to_s + else @@hname + end + @env=SiSU_Env::Info_env.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]) + @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) + @tuple_array << t.tuple + @col[:lev]=@col[:plaintext]=@col[:body]='' + elsif data.is=='heading' and 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 ||='' #nil # watch + @col[:seg]=@@seg + @col[:lv6]+=1 + @col[:lid]+=1 + @col[:lev]=6 + @hname=if @col[:seg] \ + and not @col[:seg].to_s.empty? + @@hname=@col[:seg].to_s + else @@hname + end + @env=SiSU_Env::Info_env.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]) + @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) + @tuple_array << t.tuple + @col[:lev]=@col[:plaintext]=@col[:body]='' + else #% regular text + @col[:lid]+=1 + txt='' + txt,@col[:ocn],@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.odv,data.osp,data.of,data.is,'',data.parent,'','' + @hname=if @col[:seg] \ + and not @col[:seg].to_s.empty? + @@hname=@col[:seg].to_s + else @@hname + end + @env=SiSU_Env::Info_env.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 + 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)}") + end + txt=%{\n\nLARGE TEXT BLOCK OMITTED\n\n} + end + @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) + else + SiSU_Format_Shared::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) + @tuple_array << t.tuple + @en,@en_ast,@en_pls=[],[],[] + @col[:en_a]=@col[:en_z]=nil + @col[:lev]=@col[:plaintext]=@col[:body]=@col[:words]='' + end + if notedata =~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/ #% import into database endnotes tables + endnote_array=notedata.scan(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/) + endnote_array.each do |inf| + if inf[/#{Mx[:en_a_o]}\d+.+?#{Mx[:en_a_c]}/] + if inf[/#{Mx[:en_a_o]}(\d+)(.+?)#{Mx[:en_a_c]}/] + 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) + 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)}") + end + 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 + } + t=SiSU_DB_tuple::Load_endnotes.new(@conn,en,@opt,@file) + @tuple_array << t.tuple + end + end + end + word_mode=notedata.scan(/\S+/) + end + if notedata =~/#{Mx[:en_b_o]}\*.+?#{Mx[:en_b_c]}/ #% import into database endnotes tables + endnote_array=notedata.scan(/#{Mx[:en_b_o]}\*.+?#{Mx[:en_b_c]}/) + endnote_array.each do |inf| + if inf[/#{Mx[:en_b_o]}\*\d+.+?#{Mx[:en_b_c]}/] # dal new endnotes 2003w31/1 + if inf[/#{Mx[:en_b_o]}[*](\d+)(.+?)#{Mx[:en_b_c]}/] # dal new endnotes 2003w31/1 + 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) + 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)}") + end + 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 + } + t=SiSU_DB_tuple::Load_endnotes.new(@conn,en,@opt,@file) + @tuple_array << t.tuple + end + end + end + word_mode=notedata.scan(/\S+/) + end + if notedata =~/#{Mx[:en_b_o]}\+.+?#{Mx[:en_b_c]}/ #% import into database endnotes tables + endnote_array=notedata.scan(/#{Mx[:en_b_o]}\+.+?#{Mx[:en_b_c]}/) + endnote_array.each do |inf| + if inf[/#{Mx[:en_b_o]}\+\d+.+?#{Mx[:en_b_c]}/] # dal new endnotes 2003w31/1 + if inf[/#{Mx[:en_b_o]}[+](\d+)(.+?)#{Mx[:en_b_c]}/] # dal new endnotes 2003w31/1 + 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) + 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)}") + end + 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 + } + t=SiSU_DB_tuple::Load_endnotes.new(@conn,en,@opt,@file) + @tuple_array << t.tuple + end + end + end + word_mode=notedata.scan(/\S+/) + end + end + end + rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error + ensure + end + @tuple_array + end + def endnotes(txt) + @txt=txt + def extract_any + if @txt =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[*+]?(\d+)\s+.+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/ + endnotes(@txt).range + @en << endnotes(@txt).standard if @txt =~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/ + @en_ast << endnotes(@txt).asterisk if @txt =~/#{Mx[:en_b_o]}\*.+?#{Mx[:en_b_c]}/ + @en_pls << endnotes(@txt).plus if @txt =~/#{Mx[:en_b_o]}\+.+?#{Mx[:en_b_c]}/ + @txt=endnotes(@txt).clean_text + end + @txt + end + def standard + x=(@txt =~/#{Mx[:en_a_o]}.+?#{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]}/) \ + : 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]}/) \ + : nil + end + def clean_text(base_url=nil) + if base_url + @txt.gsub!(/#{Mx[:en_a_o]}(\d+).+?#{Mx[:en_a_c]}/,%{\\1}) + @txt.gsub!(/#{Mx[:en_b_o]}([*]\d+).+?#{Mx[:en_b_c]}/,%{\\1}) + @txt.gsub!(/#{Mx[:en_b_o]}([+]\d+).+?#{Mx[:en_b_c]}/,%{\\1}) + else + @txt.gsub!(/#{Mx[:en_a_o]}(\d+).+?#{Mx[:en_a_c]}/,'\1') + @txt.gsub!(/#{Mx[:en_b_o]}([*]\d+).+?#{Mx[:en_b_c]}/,'\1') + @txt.gsub!(/#{Mx[:en_b_o]}([+]\d+).+?#{Mx[:en_b_c]}/,'\1') + end + @txt + end + def range + @col[:en_a]=@col[:en_z]=nil + if @txt =~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}([*]\d+).+?#{Mx[:en_b_c]}|#{Mx[:en_b_o]}([+]\d+).+?#{Mx[:en_b_c]}/ + word_array=@txt.scan(/\S+/) + word_array.each do |w| + if w[/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[*+]?(\d+)\s+.+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/] # not tested since change 2003w31 + @col[:en_a]=$1 unless @col[:en_a] + @col[:en_z]=@col[:en_a].dup unless @col[:en_a] + @col[:en_z]=$1 if @col[:en_a] + end + end + end + @col + end + self + end + def db_import_urls(dbi_unit,content) #% import documents OID - populate database + begin + @fnc=content + @env=SiSU_Env::Info_env.new(@opt.fns) + base=@env.url.root + out=@env.path.output + f,u={},{} + if @fnb.empty? \ + 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]}'," + end + if FileTest.file?("#{out}/#{@fnb}/#{@md.fn[:doc]}")==true + f[:html_doc],u[:html_doc]='html_doc,', "'#{base}/#{@fnb}/#{@md.fn[:doc]}'," + end + if FileTest.file?("#{out}/#{@fnb}/#{@md.fn[:xhtml]}")==true + f[:xhtml],u[:xhtml]='xhtml,', "'#{base}/#{@fnb}/#{@md.fn[:xhtml]}'," + end + if FileTest.file?("#{out}/#{@fnb}/#{@md.fn[:sax]}")==true + f[:xml_sax],u[:xml_sax]='xml_sax,', "'#{base}/#{@fnb}/#{@md.fn[:sax]}'," + end + if FileTest.file?("#{out}/#{@fnb}/#{@md.fn[:dom]}")==true + f[:xml_dom],u[:xml_dom]='xml_dom,', "'#{base}/#{@fnb}/#{@md.fn[:dom]}'," + end + if FileTest.file?("#{out}/#{@fnb}/#{@md.fn[:odf]}")==true + f[:odf],u[:odf]='odf,', "'#{base}/#{@fnb}/#{@md.fn[:odf]}'," + 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]}'," + 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]}'," + end + if FileTest.file?("#{out}/#{@fnb}/#{@md.fn[:concordance]}")==true + f[:concordance],u[:concordance]='concordance,', "'#{base}/#{@fnb}/#{@md.fn[:concordance]}'," + 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?("#{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?("#{out}/#{@fnb}/#{@md.fn[:digest]}")==true + f[:digest],u[:digest]='digest,', "'#{base}/#{@fnb}/#{@md.fn[: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]}'," + end + if FileTest.file?("#{out}/#{@fnb}/#{@opt.fns}.meta")==true + f[:markup],u[:markup]='markup,', "'#{base}/#{@fnb}/#{@opt.fns}.meta'," + end + if FileTest.file?("#{out}/#{@fnb}/#{@opt.fns}.tgz")==true + f[:sisupod],u[:sisupod]='sisupod,', "'#{base}/#{@fnb}/#{@opt.fns}.tgz'," + end + t=SiSU_DB_tuple::Load_urls.new(@conn,f,u,@@id_t,@opt,@file) + tuple=t.tuple + rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error + ensure + end + tuple + end + end +end +__END__ diff --git a/lib/sisu/v3/db_indexes.rb b/lib/sisu/v3/db_indexes.rb new file mode 100644 index 00000000..abd90409 --- /dev/null +++ b/lib/sisu/v3/db_indexes.rb @@ -0,0 +1,113 @@ +# 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: modules shared by the different db types, dbi, postgresql, + sqlite + +=end +module SiSU_DB_index + class Index # create documents Indexes def initialize(opt,conn='',sql_type='') + def initialize(opt,conn,file,sql_type='') + @opt,@conn,@file,@sql_type=opt,conn,file,sql_type + end + def create_indexes # check added from pg not tested + def conn_execute_array(sql_arr) + @conn.transaction do |conn| + sql_arr.each do |sql| + conn.execute(sql) + end + end + end + def base + print "\n create documents common indexes\n" unless @opt.cmd =~/q/ + sql_arr=[ + %{CREATE INDEX idx_ocn ON doc_objects(ocn);}, + %{CREATE INDEX idx_digest_clean ON doc_objects(digest_clean);}, + %{CREATE INDEX idx_digest_all ON doc_objects(digest_all);}, + %{CREATE INDEX idx_lev1 ON doc_objects(lev1);}, + %{CREATE INDEX idx_lev2 ON doc_objects(lev2);}, + %{CREATE INDEX idx_lev3 ON doc_objects(lev3);}, + %{CREATE INDEX idx_lev4 ON doc_objects(lev4);}, + %{CREATE INDEX idx_lev5 ON doc_objects(lev5);}, + %{CREATE INDEX idx_lev6 ON doc_objects(lev6);}, + %{CREATE INDEX idx_endnote_nr ON endnotes(nr);}, + %{CREATE INDEX idx_digest_en ON endnotes(digest_clean);}, + %{CREATE INDEX idx_endnote_nr_asterisk ON endnotes_asterisk(nr);}, + %{CREATE INDEX idx_endnote_asterisk ON endnotes_asterisk(clean);}, + %{CREATE INDEX idx_digest_en_asterisk ON endnotes_asterisk(digest_clean);}, + %{CREATE INDEX idx_endnote_nr_plus ON endnotes_plus(nr);}, + %{CREATE INDEX idx_endnote_plus ON endnotes_plus(clean);}, + %{CREATE INDEX idx_digest_en_plus ON endnotes_plus(digest_clean);}, + %{CREATE INDEX idx_title ON metadata_and_text(title);}, + %{CREATE INDEX idx_author ON metadata_and_text(creator_author);}, + %{CREATE INDEX idx_filename ON metadata_and_text(src_filename);}, + %{CREATE INDEX idx_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/ + sql_arr=[ + %{CREATE INDEX idx_clean ON doc_objects(clean);}, + %{CREATE INDEX idx_endnote ON endnotes(clean);} + ] + conn_execute_array(sql_arr) + end + base + @opt.cmd=~/D/ || ((@opt.mod=~/psql/) ? '' : text) + end + end +end +__END__ diff --git a/lib/sisu/v3/db_load_tuple.rb b/lib/sisu/v3/db_load_tuple.rb new file mode 100644 index 00000000..f1af99a0 --- /dev/null +++ b/lib/sisu/v3/db_load_tuple.rb @@ -0,0 +1,331 @@ +# 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: modules shared by the different db types, dbi, postgresql, + sqlite + +=end +module SiSU_DB_tuple + require "#{SiSU_lib}/db_columns" # db_columns.rb + class Load_documents + require "#{SiSU_lib}/param" # param.rb + include SiSU_Param + def initialize(conn,col,opt,file) + @conn,@col,@opt,@file=conn,col,opt,file + @col[:lev]=@col[:lev].to_i + unless @col[:lev]=~/^[1-6]/ \ + or @col[:lev]==1 \ + or @col[:lev]==2 \ + or @col[:lev]==3 \ + or @col[:lev]==4 \ + or @col[:lev]==5 \ + or @col[:lev]==6 #changed from \d+ ?? + @col[:lev]=0 + end + @col[:ocn]=0 unless @col[:ocn].inspect=~/\d+/ + @cX=SiSU_Screen::Ansi.new(@opt.cmd).cX + 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]}');" + 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]}');" + end + if @opt.cmd =~/M/ + if @opt.cmd =~/V/ + puts @file.inspect + puts sql_entry + end + @file.puts sql_entry + else + if @opt.cmd =~/V/ + puts sql_entry + @file.puts sql_entry + end + end + if @opt.cmd =~/v/ + if @col[:lev].inspect =~/[12356789]/ + lev=case @col[:lev].inspect + when /1/; ':A' + when /2/; ':B' + when /3/; ':C' + when /5/; ' 2' + when /6/; ' 3' + end + puts %{#{lev}>\t#{@col[:lv1]}\t#{@col[:lv2]}\t#{@col[:lv3]}\t#{@col[:lv4]}\t#{@col[:lv5]}\t#{@col[:lv6]}\t#{@col[:ocn]}\t#{@col[:node]}\t#{@col[:ocns]}} + elsif @col[:lev].inspect =~/[4]/ + puts %{ #{@cX.green}1>#{@cX.off}\t#{@col[:lv1]}\t#{@col[:lv2]}\t#{@col[:lv3]}\t#{@col[:lv4]}\t#{@col[:lv5]}\t#{@col[:lv6]}\t#{@col[:ocn]}\t#{@col[:node]}\t#{@col[:ocns]}\t#{@col[:seg]}} + end + end + 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) + end + def tuple + sql_entry="INSERT INTO metadata_and_text ( +#{@tp.column.title.tuple[0]} +#{@tp.column.title_main.tuple[0]} +#{@tp.column.title_sub.tuple[0]} +#{@tp.column.title_short.tuple[0]} +#{@tp.column.title_edition.tuple[0]} +#{@tp.column.title_note.tuple[0]} +#{@tp.column.title_language.tuple[0]} +#{@tp.column.title_language_char.tuple[0]} +#{@tp.column.creator_author.tuple[0]} +#{@tp.column.creator_author_honorific.tuple[0]} +#{@tp.column.creator_author_nationality.tuple[0]} +#{@tp.column.creator_contributor.tuple[0]} +#{@tp.column.creator_illustrator.tuple[0]} +#{@tp.column.creator_photographer.tuple[0]} +#{@tp.column.creator_translator.tuple[0]} +#{@tp.column.creator_prepared_by.tuple[0]} +#{@tp.column.creator_digitized_by.tuple[0]} +#{@tp.column.creator_audio.tuple[0]} +#{@tp.column.creator_video.tuple[0]} +#{@tp.column.language_document.tuple[0]} +#{@tp.column.language_document_char.tuple[0]} +#{@tp.column.language_original.tuple[0]} +#{@tp.column.language_original_char.tuple[0]} +#{@tp.column.date_added_to_site.tuple[0]} +#{@tp.column.date_available.tuple[0]} +#{@tp.column.date_created.tuple[0]} +#{@tp.column.date_issued.tuple[0]} +#{@tp.column.date_modified.tuple[0]} +#{@tp.column.date_published.tuple[0]} +#{@tp.column.date_valid.tuple[0]} +#{@tp.column.date_translated.tuple[0]} +#{@tp.column.date_original_publication.tuple[0]} +#{@tp.column.date_generated.tuple[0]} +#{@tp.column.publisher.tuple[0]} +#{@tp.column.original_publisher.tuple[0]} +#{@tp.column.original_language.tuple[0]} +#{@tp.column.original_language_char.tuple[0]} +#{@tp.column.original_source.tuple[0]} +#{@tp.column.original_institution.tuple[0]} +#{@tp.column.original_nationality.tuple[0]} +#{@tp.column.rights_all.tuple[0]} +#{@tp.column.rights_copyright_text.tuple[0]} +#{@tp.column.rights_copyright_translation.tuple[0]} +#{@tp.column.rights_copyright_illustrations.tuple[0]} +#{@tp.column.rights_copyright_photographs.tuple[0]} +#{@tp.column.rights_copyright_preparation.tuple[0]} +#{@tp.column.rights_copyright_digitization.tuple[0]} +#{@tp.column.rights_copyright_audio.tuple[0]} +#{@tp.column.rights_copyright_video.tuple[0]} +#{@tp.column.rights_license.tuple[0]} +#{@tp.column.classify_topic_register.tuple[0]} +#{@tp.column.classify_subject.tuple[0]} +#{@tp.column.classify_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.notes_abstract.tuple[0]} +#{@tp.column.notes_comment.tuple[0]} +#{@tp.column.notes_description.tuple[0]} +#{@tp.column.notes_history.tuple[0]} +#{@tp.column.notes_prefix.tuple[0]} +#{@tp.column.notes_prefix_a.tuple[0]} +#{@tp.column.notes_prefix_b.tuple[0]} +#{@tp.column.notes_suffix.tuple[0]} +#{@tp.column.src_filename.tuple[0]} +#{@tp.column.src_fingerprint.tuple[0]} +#{@tp.column.src_filesize.tuple[0]} +#{@tp.column.src_word_count.tuple[0]} +#{@tp.column.src_txt.tuple[0]} +#{@tp.column.fulltext.tuple[0]} +#{@tp.column.skin_name.tuple[0]} +#{@tp.column.skin_fingerprint.tuple[0]} +#{@tp.column.skin.tuple[0]} +#{@tp.column.links.tuple[0]} +tid) +" + + "VALUES ( +#{@tp.column.title.tuple[1]} +#{@tp.column.title_main.tuple[1]} +#{@tp.column.title_sub.tuple[1]} +#{@tp.column.title_short.tuple[1]} +#{@tp.column.title_edition.tuple[1]} +#{@tp.column.title_note.tuple[1]} +#{@tp.column.title_language.tuple[1]} +#{@tp.column.title_language_char.tuple[1]} +#{@tp.column.creator_author.tuple[1]} +#{@tp.column.creator_author_honorific.tuple[1]} +#{@tp.column.creator_author_nationality.tuple[1]} +#{@tp.column.creator_contributor.tuple[1]} +#{@tp.column.creator_illustrator.tuple[1]} +#{@tp.column.creator_photographer.tuple[1]} +#{@tp.column.creator_translator.tuple[1]} +#{@tp.column.creator_prepared_by.tuple[1]} +#{@tp.column.creator_digitized_by.tuple[1]} +#{@tp.column.creator_audio.tuple[1]} +#{@tp.column.creator_video.tuple[1]} +#{@tp.column.language_document.tuple[1]} +#{@tp.column.language_document_char.tuple[1]} +#{@tp.column.language_original.tuple[1]} +#{@tp.column.language_original_char.tuple[1]} +#{@tp.column.date_added_to_site.tuple[1]} +#{@tp.column.date_available.tuple[1]} +#{@tp.column.date_created.tuple[1]} +#{@tp.column.date_issued.tuple[1]} +#{@tp.column.date_modified.tuple[1]} +#{@tp.column.date_published.tuple[1]} +#{@tp.column.date_valid.tuple[1]} +#{@tp.column.date_translated.tuple[1]} +#{@tp.column.date_original_publication.tuple[1]} +#{@tp.column.date_generated.tuple[1]} +#{@tp.column.publisher.tuple[1]} +#{@tp.column.original_publisher.tuple[1]} +#{@tp.column.original_language.tuple[1]} +#{@tp.column.original_language_char.tuple[1]} +#{@tp.column.original_source.tuple[1]} +#{@tp.column.original_institution.tuple[1]} +#{@tp.column.original_nationality.tuple[1]} +#{@tp.column.rights_all.tuple[1]} +#{@tp.column.rights_copyright_text.tuple[1]} +#{@tp.column.rights_copyright_translation.tuple[1]} +#{@tp.column.rights_copyright_illustrations.tuple[1]} +#{@tp.column.rights_copyright_photographs.tuple[1]} +#{@tp.column.rights_copyright_preparation.tuple[1]} +#{@tp.column.rights_copyright_digitization.tuple[1]} +#{@tp.column.rights_copyright_audio.tuple[1]} +#{@tp.column.rights_copyright_video.tuple[1]} +#{@tp.column.rights_license.tuple[1]} +#{@tp.column.classify_topic_register.tuple[1]} +#{@tp.column.classify_subject.tuple[1]} +#{@tp.column.classify_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.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_prefix.tuple[1]} +#{@tp.column.notes_prefix_a.tuple[1]} +#{@tp.column.notes_prefix_b.tuple[1]} +#{@tp.column.notes_suffix.tuple[1]} +#{@tp.column.src_filename.tuple[1]} +#{@tp.column.src_fingerprint.tuple[1]} +#{@tp.column.src_filesize.tuple[1]} +#{@tp.column.src_word_count.tuple[1]} +#{@tp.column.src_txt.tuple[1]} +#{@tp.column.fulltext.tuple[1]} +#{@tp.column.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 + else + @file.puts sql_entry if @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 + 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 + else + @file.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 + 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 + else + @file.puts sql_entry if @opt.cmd =~/V/ + end + sql_entry + end + end +end +__END__ diff --git a/lib/sisu/v3/db_remove.rb b/lib/sisu/v3/db_remove.rb new file mode 100644 index 00000000..364f5fc7 --- /dev/null +++ b/lib/sisu/v3/db_remove.rb @@ -0,0 +1,109 @@ +# 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: modules shared by the different db types, dbi, postgresql, + sqlite + +=end +module SiSU_DB_remove + 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 + end + def remove + driver_sqlite3=if @sql_type=='sqlite' + (@conn.inspect.match(/^(.{10})/)[1]==@db.sqlite.conn_sqlite3.inspect.match(/^(.{10})/)[1]) \ + ? true \ + : false + end + del_id=if driver_sqlite3 + @conn.get_first_value(%{ SELECT tid FROM metadata_and_text WHERE src_filename = '#{@opt.fns}'; }).to_i + else + x=@conn.select_one(%{ SELECT metadata_and_text.tid FROM metadata_and_text WHERE metadata_and_text.src_filename = '#{@opt.fns}'; }) + x ? (x.join.to_i) : nil + end + if del_id + sql_entry=[ + "DELETE FROM endnotes WHERE metadata_tid = '#{del_id}';", + "DELETE FROM endnotes_asterisk WHERE metadata_tid = '#{del_id}';", + "DELETE FROM endnotes_plus WHERE metadata_tid = '#{del_id}';", + "DELETE FROM doc_objects WHERE metadata_tid = '#{del_id}';", + "DELETE FROM urls WHERE metadata_tid = '#{del_id}';", + "DELETE FROM metadata_and_text WHERE metadata_and_text.tid = '#{del_id}';", + ] + if driver_sqlite3 + @conn.transaction + sql_entry.each do |s| + @conn.execute(s) + end + @conn.commit if driver_sqlite3 + else + sql_entry.each do |s| + @conn.execute(s) + end + end + if @opt.cmd =~/M/ + @file.puts sql_entry if @opt.cmd =~/M/ + end + else + SiSU_Screen::Ansi.new(@opt.cmd,"no such file in database #{@db.psql.db}::#{@opt.fns}").puts_grey if @opt.cmd =~/vVM/ + end + end + end +end +__END__ diff --git a/lib/sisu/v3/db_select.rb b/lib/sisu/v3/db_select.rb new file mode 100644 index 00000000..04d12acb --- /dev/null +++ b/lib/sisu/v3/db_select.rb @@ -0,0 +1,209 @@ +# 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: modules shared by the different db types, dbi, postgresql, + sqlite + +=end +module SiSU_DB_select + 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 + 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) + elsif @opt.mod.inspect =~/remove/ + @sdb_remove_doc=SiSU_DB_DBI::Remove.new(@opt,@conn,@file,@sql_type) + end + end + def db_exist? + if @sql_type=='sqlite' \ + and (not (FileTest.file?(@db.sqlite.db)) or FileTest.zero?(@db.sqlite.db)) + puts %{no connection with #{@sql_type} database established, createdb "#{@db.sqlite.db}"?} + exit + end + if @conn.class==NilClass + db=@sql_type=='sqlite' \ + ? @db.sqlite.db \ + : @db.psql.db + puts %{no connection with #{@sql_type} database established, createdb "#{db}"?} + exit + end + end + 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 + else nil + end + else nil + end + file + end + def cases + @opt.mod.each do |mod| + case mod + when /^--createdb$/ + @sdb.output_dir? + begin + @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? + 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 + 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 + rescue; @sdb.output_dir? + end + when /^--cr(eate)?lex$/ + @sdb.output_dir? + begin + @sdb.create_table.doc_objects + rescue; @sdb.output_dir? + end + when /^--cr(eate)?metadata$/ + @sdb.output_dir? + begin + @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 /pg/; SiSU_Screen::Ansi.new(@opt.cmd,"pgaccess or psql #{@db.psql.db} database?") + else '???' + end + tell.puts_grey if @opt.cmd =~/v/ + when /^--update$/ + 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/ + when /^--remove$/ + db_exist? + @sdb_remove_doc.remove + when /^--index$/ + db_exist? + @sdb_index.create_indexes + when /^droptable(s)?$/ + db_exist? + @sdb_no.drop.tables + when /^--dropindex(es)?$/ + db_exist? + @sdb_no.drop.indexes + when /^--(?:dropall|drop)$/ + db_exist? + @sdb_no.drop.tables + when /^--(?:db=)?(?:(?:sq)?lite|pg(?:sql)?|my(?:sql)?)$/ + else + help=SiSU_Help::Help.new + help.summary + help.commands + end + if @opt.cmd =~/M/ \ + and @opt.cmd =~/d/ + puts @job + end + end + begin + rescue; @sdb.output_dir? + end + end + end +end +__END__ diff --git a/lib/sisu/v3/db_sqltxt.rb b/lib/sisu/v3/db_sqltxt.rb new file mode 100644 index 00000000..4e451e2a --- /dev/null +++ b/lib/sisu/v3/db_sqltxt.rb @@ -0,0 +1,134 @@ +# coding: 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. + + * License: GPL 3 or later: + + SiSU, a framework for document structuring, publishing and search + + Copyright (C) Ralph Amissah + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program. If not, see . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_DB_text + class Prepare + def special_character_escape(str) + str.gsub!(/'/,"''") #string.gsub!(/'/,"\047") #string.gsub!(/'/,"\\'") + str.gsub!(/(\\)/m,'\1\1') #ok but with warnings, double backslash on sqlite #str.gsub!(/[\\]/m,'\\x5C') #ok but with warnings, but not for sqlite #str.gsub!(/(\\)/m,'\1') #ok for sqlite not for pgsql + str.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"
\n") + str.gsub!(/#{Mx[:tag_o]}\S+?#{Mx[:tag_c]}/,'') #check + str.gsub!(/#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg))(?:\s+\d+x\d+)?(.+?)#{Mx[:lnk_c]}\S+/,'[image: \1] \2') + str.gsub!(/#{Mx[:lnk_o]}\s*(.+?)\s*#{Mx[:lnk_c]}(?:file|ftp):\/\/\S+?([.,!?]?(?:\s|$))/,'\1\2') + str.gsub!(/#{Mx[:lnk_o]}\s*(.+?)\s*#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,'\1') + str + end + def clean_searchable_text(arr) #produce clean, searchable, plaintext from document source + txt_arr,en=[],[] + arr=arr.class==String ? arr.split(/\n+/m) : arr + arr.each do |s| + s.gsub!(/([*\/_-])\{(.+?)\}\1/m,'\2') + s.gsub!(/^(?:block|group|poem|code)\{/m,''); s.gsub!(/^\}(?:block|group|poem|code)/m,'') + s.gsub!(/\A(?:@\S+:\s+.+)\Z/m,'') + if s =~/^:A~/ + if defined? @md.creator \ + and defined? @md.creator.author \ + and not @md.creator.author.empty? + 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/ + end + if defined? @md.title \ + and defined? @md.title.full \ + and not @md.title.full.empty? + 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/ + end + end + s.gsub!(/^(?:_[1-9]\*?|_\*)\s+/m,'') + s.gsub!(/^(?:[1-9]\~(\S+)?)\s+/m,'') + s.gsub!(/^(?::?[A-C]\~(\S+)?)\s+/m,'') + s.gsub!(/^%{1,3} .+/m,'') #removed even if contained in code block + s.gsub!(/
/m,' ') + en << s.scan(/~\{\s*(.+?)\s*\}~/m) + s.gsub!(/~\{.+?\}~/m,'') + s.gsub!(/ \s+/m,' ') + #special_character_escape(s) + s + end + txt_arr << arr << en + #txt_arr=txt_arr.flatten + txt=txt_arr.flatten.join("\n") + txt=special_character_escape(txt) + txt + end + def strip_markup(str) #define rules, make same as in dal clean + str.gsub!(/#{Mx[:fa_superscript_o]}(\d+)#{Mx[:fa_superscript_c]}/,'[\1]') + str.gsub!(/(?: \\;|#{Mx[:nbsp]})+/,' ') + str.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}\d+(.+)#{Mx[:tc_c]}/u,'\1') #tables + str.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}\d+#{Mx[:tc_p]}/u,' ') #tables + str.gsub!(/#{Mx[:tc_p]}/u,' ') #tables tidy later + str.gsub!(/<.+?>/,'') + str.gsub!(/#{Mx[:lnk_o]}.+?\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:file|ftp)\/\/:\S+ /,' [image] ') # else image names found in search + str.gsub!(/#{Mx[:lnk_o]}.+?\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,' [image]') # else image names found in search + str.gsub!(/\s\s+/,' ') + str.strip! + str + end + def unique_words(str) + a=str.scan(/[a-zA-Z0-9\\\/_-]{2,}/) #a=str.scan(/\S+{2,}/) + str=a.uniq.sort.join(' ') + str + end + end +end +__END__ + diff --git a/lib/sisu/v3/db_tests.rb b/lib/sisu/v3/db_tests.rb new file mode 100644 index 00000000..55ea2e0b --- /dev/null +++ b/lib/sisu/v3/db_tests.rb @@ -0,0 +1,117 @@ +# 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: modules shared by the different db types, dbi, postgresql, + sqlite + +=end +module SiSU_DB_tests + class Test + def initialize(info,opt) + @ck,@opt=info,opt + unless @opt.cmd =~/q/ + puts @ck.tp[:fns] if @ck.tp[:fns] and not @ck.tp[:fns].empty? + puts @ck.tp[:title] if @ck.tp[:title] and not @ck.tp[:title].empty? + puts @ck.tp[:creator] if @ck.tp[:creator] and not @ck.tp[:creator].empty? + end + end + def verify + unless @opt.cmd =~/q/ + puts @ck.tp[:fns].length.to_s + ' checklength ' + @ck.tp[:fns] if @ck.tp[:fns] and @ck.tp[:fns].length >@ck.lt_filename + puts @ck.tp[:title].length.to_s + ' checklength ' + @ck.tp[:title] if @ck.tp[:title] and @ck.tp[:title].length >@ck.lt_title + puts @ck.tp[:subtitle].length.to_s + ' checklength ' + @ck.tp[:subtitle] if @ck.tp[:subtitle] and @ck.tp[:subtitle].length >@ck.lt_subtitle + puts @ck.tp[:creator].length.to_s + ' checklength ' + @ck.tp[:creator] if @ck.tp[:creator] and @ck.tp[:creator].length >@ck.lt_creator + puts @ck.tp[:author_title].length.to_s + ' checklength ' + @ck.tp[:author_title] if @ck.tp[:author_title] and @ck.tp[:author_title].length >@ck.lt_author_title + puts @ck.tp[:illustrator].length.to_s + ' checklength ' + @ck.tp[:illustrator] if @ck.tp[:illustrator] and @ck.tp[:illustrator].length >@ck.lt_illustrator + puts @ck.tp[:translator].length.to_s + ' checklength ' + @ck.tp[:translator] if @ck.tp[:translator] and @ck.tp[:translator].length >@ck.lt_translator + puts @ck.tp[:prepared_by].length.to_s + ' checklength ' + @ck.tp[:prepared_by] if @ck.tp[:prepared_by] and @ck.tp[:prepared_by].length >@ck.lt_prepared_by + puts @ck.tp[:digitized_by].length.to_s + ' checklength ' + @ck.tp[:digitized_by] if @ck.tp[:digitized_by] and @ck.tp[:digitized_by].length >@ck.lt_digitized_by + puts @ck.tp[:subject].length.to_s + ' checklength ' + @ck.tp[:subject] if @ck.tp[:subject] and @ck.tp[:subject].length >@ck.lt_subject + puts @ck.tp[:description].length.to_s + ' checklength ' + @ck.tp[:description] if @ck.tp[:description] and @ck.tp[:description].length >@ck.lt_description + puts @ck.tp[:publisher].length.to_s + ' checklength ' + @ck.tp[:publisher] if @ck.tp[:publisher] and @ck.tp[:publisher].length >@ck.lt_publisher + puts @ck.tp[:contributor].length.to_s + ' checklength ' + @ck.tp[:contributor] if @ck.tp[:contributor] and @ck.tp[:contributor].length >@ck.lt_contributor + puts @ck.tp[:date].length.to_s + ' checklength ' + @ck.tp[:date] if @ck.tp[:date] and @ck.tp[:date].length >@ck.lt_date + puts @ck.tp[:date_created].length.to_s + ' checklength ' + @ck.tp[:date_created] if @ck.tp[:date_created] and @ck.tp[:date_created].length >@ck.lt_date + puts @ck.tp[:date_issued].length.to_s + ' checklength ' + @ck.tp[:date_issued] if @ck.tp[:date_issued] and @ck.tp[:date_issued].length >@ck.lt_date + puts @ck.tp[:date_valid].length.to_s + ' checklength ' + @ck.tp[:date_valid] if @ck.tp[:date_valid] and @ck.tp[:date_valid].length >@ck.lt_date + puts @ck.tp[:date_available].length.to_s + ' checklength ' + @ck.tp[:date_available] if @ck.tp[:date_available] and @ck.tp[:date_available].length >@ck.lt_date + puts @ck.tp[:date_modified].length.to_s + ' checklength ' + @ck.tp[:date_modified] if @ck.tp[:date_modified] and @ck.tp[:date_modified].length >@ck.lt_date + puts @ck.tp[:date_translated].length.to_s + ' checklength ' + @ck.tp[:date_translated] if @ck.tp[:date_translated] and @ck.tp[:date_translated].length >@ck.lt_date + puts @ck.tp[:date_added_to_site].length.to_s + ' checklength ' + @ck.tp[:date_added_to_site] if @ck.tp[:date_added_to_site] and @ck.tp[:date_added_to_site].length >@ck.lt_date + puts @ck.tp[:type].length.to_s + ' checklength ' + @ck.tp[:type] if @ck.tp[:type] and @ck.tp[:type].length >@ck.lt_type + puts @ck.tp[:format].length.to_s + ' checklength ' + @ck.tp[:format] if @ck.tp[:format] and @ck.tp[:format].length >@ck.lt_format + puts @ck.tp[:identifier].length.to_s + ' checklength ' + @ck.tp[:identifier] if @ck.tp[:identifier] and @ck.tp[:identifier].length >@ck.lt_identifier + puts @ck.tp[:source].length.to_s + ' checklength ' + @ck.tp[:source] if @ck.tp[:source] and @ck.tp[:source].length >@ck.lt_source + puts @ck.tp[:language].length.to_s + ' checklength ' + @ck.tp[:language] if @ck.tp[:language] and @ck.tp[:language].length >@ck.lt_language + puts @ck.tp[:language_original].length.to_s + ' checklength ' + @ck.tp[:language_original] if @ck.tp[:language_original] and @ck.tp[:language_original].length >@ck.lt_language_original + puts @ck.tp[:relation].length.to_s + ' checklength ' + @ck.tp[:relation] if @ck.tp[:relation] and @ck.tp[:relation].length >@ck.lt_relation + puts @ck.tp[:coverage].length.to_s + ' checklength ' + @ck.tp[:coverage] if @ck.tp[:coverage] and @ck.tp[:coverage].length >@ck.lt_coverage + puts @ck.tp[:rights].length.to_s + ' checklength ' + @ck.tp[:rights] if @ck.tp[:rights] and @ck.tp[:rights].length >@ck.lt_rights + puts @ck.tp[:copyright].length.to_s + ' checklength ' + @ck.tp[:copyright] if @ck.tp[:copyright] and @ck.tp[:copyright].length >@ck.lt_copyright + puts @ck.tp[:owner].length.to_s + ' checklength ' + @ck.tp[:owner] if @ck.tp[:owner] and @ck.tp[:owner].length >@ck.lt_owner + puts @ck.tp[:keywords].length.to_s + ' checklength ' + @ck.tp[:keywords] if @ck.tp[:keywords] and @ck.tp[:keywords].length >@ck.lt_keywords + puts @ck.tp[:abstract].length.to_s + ' checklength ' + @ck.tp[:abstract] if @ck.tp[:abstract] and @ck.tp[:abstract].length >@ck.lt_abstract + puts @ck.tp[:comment].length.to_s + ' checklength ' + @ck.tp[:comment] if @ck.tp[:comment] and @ck.tp[:comment].length >@ck.lt_comment + puts @ck.tp[:loc].length.to_s + ' checklength ' + @ck.tp[:loc] if @ck.tp[:loc] and @ck.tp[:loc].length >@ck.lt_loc + puts @ck.tp[:dewey].length.to_s + ' checklength ' + @ck.tp[:dewey] if @ck.tp[:dewey] and @ck.tp[:dewey].length >@ck.lt_dewey + puts @ck.tp[:isbn].length.to_s + ' checklength ' + @ck.tp[:isbn] if @ck.tp[:isbn] and @ck.tp[:isbn].length >@ck.lt_isbn + puts @ck.tp[:pg].length.to_s + ' checklength ' + @ck.tp[:pg] if @ck.tp[:pg] and @ck.tp[:pg].length >@ck.lt_pg + puts @ck.tp[:topic_register].length.to_s + ' checklength ' + @ck.tp[:topic_register] if @ck.tp[:topic_register] and @ck.tp[:topci_register].length >@ck.lt_topic_register + puts @ck.tp[:date] if @ck.tp[:date] and not @ck.tp[:date].empty? and @ck.tp[:date] !~/\d\d-\d\d-\d\d/ + end + end + end +end +__END__ diff --git a/lib/sisu/v3/dbi.rb b/lib/sisu/v3/dbi.rb new file mode 100644 index 00000000..191d5099 --- /dev/null +++ b/lib/sisu/v3/dbi.rb @@ -0,0 +1,143 @@ +# 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: postgresql module, dbi import frame + +=end +module SiSU_DBI #% database building + require "#{SiSU_lib}/help" # help.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}/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 + def initialize(opt) + SiSU_Env::Load.new('dbi',true).prog + @opt=opt + @db=SiSU_Env::Info_db.new + if @opt.cmd =~/d/i \ + or @opt.mod.inspect =~/--(pg(?:sql)?|(?:sq)?lite)/ + @sql_type=if @opt.cmd=~/D/ \ + or @opt.mod.inspect =~/--pg(?:sql)?/ + maintenance_check(@opt,__FILE__,__LINE__) if @opt.cmd.inspect =~/M/ + 'pg' + elsif @opt.cmd =~/d/ \ + and @opt.mod.inspect =~/--(?:db[=-])?pg(?:sql)?/ + maintenance_check(@opt,__FILE__,__LINE__) if @opt.cmd.inspect =~/M/ + 'pg' + elsif @opt.cmd=~/d/ \ + or @opt.mod.inspect =~/--(?:sq)?lite/ + maintenance_check(@opt,__FILE__,__LINE__) if @opt.cmd.inspect =~/M/ + 'sqlite' + elsif @opt.cmd =~/d/ \ + and @opt.mod.inspect =~/--(?:db[=-])?(?:sq)?lite/ + maintenance_check(@opt,__FILE__,__LINE__) if @opt.cmd.inspect =~/M/ + 'sqlite' + else + maintenance_check(@opt,__FILE__,__LINE__) if @opt.cmd.inspect =~/M/ + 'sqlite' + end + end + end + def maintenance_check(opt,file,line) + p opt.mod + p opt.cmd + p "at #{file} #{line}" + end + def read_psql + begin + @conn=@db.psql.conn_dbi + rescue + if @opt.mod.inspect=~/--(createall|create)/ + 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 + def read_sqlite + begin + sql_type='sqlite' + @conn=@db.sqlite.conn_sqlite3 + rescue + ensure + end + end + def connect + case @sql_type + 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/ + begin + SiSU_DB_DBI::Case.new(@opt,@conn,@sql_type).cases + rescue + SiSU_Errors::Info_error.new($!,$@,@cf,@opt.fns).error + ensure + end + begin + rescue + connect + end + end + end +end +__END__ diff --git a/lib/sisu/v3/defaults.rb b/lib/sisu/v3/defaults.rb new file mode 100644 index 00000000..19941d48 --- /dev/null +++ b/lib/sisu/v3/defaults.rb @@ -0,0 +1,2342 @@ +# 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: Default values (reset by skins) + +=end +$latex_run=nil +module SiSU_Viz + require 'uri' + require "#{SiSU_lib}/sysenv" # sysenv.rb + include SiSU_Env + require "#{SiSU_lib}/css" # css.rb + include SiSU_Style + class Skin + def initialize + @fonts='verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman' # 'verdana, arial, georgia, tahoma, sans-serif, helvetica, "times new roman", times, roman' + @dir=SiSU_Env::Info_env.new + @date=SiSU_Env::Info_date.new #{@date.year} + @v=SiSU_Env::Info_version.instance.get_version + end + #% glyph + def glyph_bullet # • + '• ' # [• flagged] + end + #% html + def html_hardspace + ' ' + 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', + } + end + self + end + #% decorate + def decorate_italics + 'title|article|book|journal' + end + def decorate_bold + end + def decorate_uppercase + 'surname' + end + #% semantic + def sem_title #dc 1 + 'title' + end + def sem_article + 'article' + end + def sem_book + 'book' + end + def sem_journal + 'journal' + end + def sem_fullname # (contains: firstname, surname) #issues arise as contains surname etc. + 'fullname' + end + def sem_first + 'first' + end + def sem_surname + 'surname' + end + def sem_middle + 'middle' + end + def sem_creator #dc 2 #==fullname (contains: firstname, surname) + 'creator' + end + def sem_author #==fullname (contains: firstname, surname) + 'author' + end + def sem_editor #==fullname (contains: firstname, surname) + 'editor' + end + def sem_illustrator #==fullname (contains: firstname, surname) + 'illustrator' + end + def sem_translator #==fullname (contains: firstname, surname) + 'translator' + end + def sem_isbn # 10 or 13 + 'isbn' + end + def sem_isbn_10 + 'isbn10' + end + def sem_isbn_13 + 'isbn13' + end + def sem_loc # library of congress + 'loc' + end + def sem_dewey + 'dewey' + end + def sem_pg # project gutenberg number + 'pg' + end + def sem_subject #dc 3 + 'subject' + end + def sem_date #dc 7 + 'date' + end + def sem_date_created + 'date_created' + end + def sem_date_issued + 'date_issued' + end + def sem_date_available + 'date_available' + end + def sem_date_valid + 'date_valid' + end + def sem_date_modified + 'date_modified' + end + def sem_type #dc 8 + 'type' + end + def sem_description #dc 4 + 'description' + end + def sem_publisher #dc 5 + 'publisher' + end + def sem_contributor #dc 6 + 'contributor' + end + def sem_format #dc 9 + 'format' + end + def sem_identifier #dc 10 + 'identifier' + end + def sem_source #dc 11 + 'source' + end + def sem_language #dc 12 + 'language' + end + def sem_relation #dc 13 + 'source' + end + def sem_coverage #dc 14 + 'coverage' + end + def sem_rights #dc 15 + 'rights' + end + def sem_copyright + 'copyright' + end + def sem_license + 'license' + end + def sem_prepared_by + 'prepared_by' + end + def sem_digitized_by + 'digitized_by' + end + def sem_keywords + 'keywords' + end + def sem_comments + 'comments' + end + def sem_abstract + 'abstract' + end + #% path + def path_stylesheet_home + %{ } + end + #% text #changed from txt to avoid naming conflicts #FOLLOW + def txt_generator + %{ + } + end + def txt_generator_comment + %{ } + end + def txt_hp + ' SiSU' + end + def txt_hp_alias + 'SiSU' + end + def txt_home + 'SiSU' + end + def txt_signature # used in latex/pdf footer + 'SiSU' + end + #% url + def url_urify(uri) + URI.parse(uri) + end + def url_sisu + 'http://www.sisudoc.org/' + end + def url_sisudoc + 'http://www.sisudoc.org' + end + def url_footer_signature + 'http://www.sisudoc.org/' + end + def url_root + '/sisu' #watch + end + def url_root_http + 'http://www.sisudoc.org/' #watch + end + def url_home + 'http://www.sisudoc.org/' # used in pdf header + end + def url_site #used as stub... where there are subdirectories and is different from home + url_home + #'http://www.sisudoc.org/' # used in pdf header + end + def url_txt + 'www.sisudoc.org/' + end + def url_path_image_base #used for html image display + "#{Xx[:html_relative2]}_sisu/image" + end + def url_path_image #used for html image display + "#{Xx[:html_relative2]}_sisu/image" + end + def url_path_image_sys #used for html image display + "#{Xx[:html_relative2]}_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 + '' + end + def url_decoration + def tex_open #'{\UseTextSymbol{OML}{<}}' + Dx[:url_o] + end + def tex_close #'{\UseTextSymbol{OML}{>}}' + Dx[:url_c] + end + def xml_open #'<' + Dx[:url_o] + end + def xml_close #'>' + Dx[:url_c] + end + def txt_open + '<' + end + def txt_close + '>' + end + self + end + def rel_decoration + def tex_open #'{\UseTextSymbol{OML}{<}}' + Dx[:rel_o] + end + def tex_close #'{\UseTextSymbol{OML}{>}}' + Dx[:rel_c] + end + def xml_open #'<' + Dx[:rel_o] + end + def xml_close #'>' + Dx[:rel_c] + end + def txt_open + '<' + end + def txt_close + '>' + end + self + end + #% color + def color_shadow + '"4"' + end + def color_body + %{} + end + def color_white + '"#ffffff"' + end + 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 + def color_blue_tinge + '#e3ecef' + end + def color_blue_grey + '#8faebf' + end + def color_blue_murky + '#437389' + end + def color_beige + '#f1e8de' + end + def color_subtleglow + '#dddccc' + end + def color_glow + '#fff0c3' + end + def color_rose + '#ffdec9' + end + def color_turquoise + '#1c869b' + end + def color_grey_pale + '#eeeeee' + end + def color_grey_medium + '#cccccc' + end + def color_grey + '#999999' + end + def color_yellow_light + '#fff3b6' + end + def color_yellow + '#ffde14' + end + def color_yellow_dark + '#ffcc00' + end + def color_green_light + '#b7d398' # #e2efd5 #b7d398 #b1c999 # '#aed19e' + end + def color_green + '#0a8400' + end + def color_green_dark + '#086800' + end + def color_ruby + '#a00000' + end + def color_maroon + '#800000' + end + def color_paper + %{"#{color_white}"} + end + def color_band1 + %{"#{color_white}"} + end + def color_band2 + %{"#{color_white}"} + end + def color_body + %{\n\n} + end + def color_font_face #was font WATCH + "#{color_black}" + end + def color_surround + %{"#{color_white}"} + end + def color_band + %{"#{color_white}"} + end + def color_table1 + 'ffffcc' + end + def color_table2 + 'c0d0f0' + end + def color_band1 + '"#ffffff"' + end + def color_band2 + '"#ffffff"' + end + #% icon + def icon_ico + 'rb7.ico' + end + def icon_sisu + 'sisu.png' + end + def icon_manifest + 'b_info.png' + end + def icon_doc + 'b_doc.png' + end + def icon_toc + 'b_toc.png' + end + def icon_wmp + 'b_wmp.png' + end + def icon_odf + 'b_odf.png' + end + def icon_epub + 'b_epub.png' + end + def icon_pdf + 'b_pdf.png' + end + def icon_pdf_portrait + 'b_pdf.png' + end + 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 + def icon_dot_white + 'dot_white.png' + end + 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 + def icon_previous + 'arrow_prev_red.png' + end + def icon_up + 'arrow_up_red.png' + end + #% font + def font_fonts + @fonts + end + 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 + def font_small + 'size="3"' + end + def font_tiny + 'size="2"' + end + #% markup + def markup_italics_list #regular expression of words to be italised + end + def markup_bold_list #regular expression of words to be made bold + 'SiSU' + end + def markup_make_italic + if defined? italics_list \ + and italics_list + make={} + if italics_list + r=italics_list.dup + x=case r + when /\/i$/; 'i' + else '' + end + r.gsub!(/^\/(.+?)\/i?/,'\1') + r.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 + else nil + end + end + end + def markup_make_bold + if defined? bold_list \ + and not bold_list.empty? + make={} + if bold_list + r=bold_list.dup + x=case r + when /\/i$/; 'i' + else '' + end + r.gsub!(/^\/(.+?)\/i?/,'\1') + r.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 + else nil + end + make + end + end + #% paragraph + def paragraph_txt + %{

} + end + def paragraph_txt_00 + %{

} + end + def paragraph_font_citation + %{} + end + def paragraph_endnote + %{

} + end + def paragraph_table + %{

} + end + def paragraph_table_xml + end + def paragraph_tiny + %{

} + end + def paragraph_small + %{

} # keep but not used? + end + def paragraph_font_tiny + %{} + end + def paragraph_font_small + %{} + end + def paragraph_heading_1 + %{

} + end + def paragraph_heading_1_center + %{

} + end + #% table + def table_close + '

' + 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 + '
' + end + def table_table_align_B + '
' + end + def table_table_align_C + ' ' + end + #% table_do + def table_do_table_paper + %{#{table_align_C}
\n

\n} + end + def table_do_table_surround + %{ + +
\n} + end + #% indent + def indent_level_0 + '"1%"' + end + def indent_level_1 + '"4%"' + end + def indent_level_2 + '"6%"' + end + def indent_level_3 + '"8%"' + end + def indent_level_4 + '"10%"' + end + #% margin + def margin_num + '

' + end + def margin_numless + '' + end + def margin_num_css + ' ' + end + def margin_num_header + '' + end + def margin_txt_00_1 + %{ + +
+} + end + def margin_txt_w1 + %{ + +
 } + end + def margin_txt_w2 + %{ + +
 } + end + def margin_txt_0 + %{ +
+} + end + def margin_txt_1 + %{ +
} + end + def margin_txt_2 + %{ + +
+} + end + def margin_txt_3 + %{ + +
+} + end + def margin_css #unused, check + ' +
' + end + #% png + def png_ico + %{ } + end + def png_sisu #check url path + %{ + SiSU + } + end + def png_hp + dir=SiSU_Env::Info_env.new #(@fns) + %{ + #{txt_home} + } + end + def png_site + %{@} + end + def png_homepage + png_site + end + def png_nav + %{Contents} + end + def png_manifest + %{Document Manifest} + end + def png_doc + %{Full Text} + end + def png_toc + %{TOC linked} + end + def png_odf + %{ODF/ODT} + end + def png_epub + %{EPUB} + end + def png_pdf + %{PDF} + end + def png_pdf_portrait + %{PDF portrait} + end + def png_pdf_landscape + %{PDF landscape} + end + def png_wmp + %{Concordance} + end + def png_para + %{Segment} + end + def png_status + %{Membership status} + end + def png_mark + %{*} + end + def png_doc_tiny + %{Doc} + end + def png_toc_tiny + %{TOC} + end + def png_status_tiny + %{Status, Member States} + end + def png_ftp + %{FTP} + end + def png_gopher + %{Gopher} + end + def png_crosslink + %{lateral hop} + end + def png_crosslink_ext + %{lateral hop} + end + def png_home + dir=SiSU_Env::Info_env.new #(@fns) + %{#{txt_home} -->} + end + def png_home_button + #dir=SiSU_Env::Info_env.new #(@fns) + %{#{txt_home} -->} + end + def png_book + %{Cameron May Books} + end + #% png_nav + def png_nav_home + end + def png_nav_toc + %{TOC} + end + def png_nav_doc + end + def png_nav_previous + %{<< previous} + end + def png_nav_next + %{next >>} + end + def png_nav_pre + png_nav_previous + end + def png_nav_nxt + png_nav_next + end + def epub_png_nav_previous + %{<< previous} + end + def epub_png_nav_next + %{next >>} + end + def epub_png_nav_up + %{^up ^} + 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 + %{PDF} + end + def png_nav_pdf_portrait + %{pdf portrait} + end + def png_nav_pdf_landscape + %{pdf landscape} + end + def png_nav_dot_toc + %{^} + end + def png_nav_dot_previous + %{<} + end + def png_nav_dot_next + %{>} + end + def png_nav_dot_pre + png_nav_dot_previous + end + def png_nav_dot_nxt + png_nav_dot_next + end + #% nav_txt + def nav_txt_home + %{ + #{png_site}  + } + end + def nav_txt_home_button + %{ + #{png_home_button}  + } + end + def nav_txt_homepage + %{ +  home  + } + end + def nav_txt_toc_link + %{ +   toc  + } + end + def nav_txt_toc_link_verbose + %{ + #{png_toc}  segments' toc  + } + end + def nav_txt_doc_link + %{ +  scroll  + } + end + def nav_txt_manifest + #{png_manifest} document manifest + %{ + [ document manifest ] + } + end + def nav_txt_concordance + %{ +   A-Z  + } + end + def nav_txt_previous + ' +   << Previous   + + Full Text ' + end + def nav_txt_next + %{ +   Next     >>   + } + end + def nav_txt_plaintext + %{ +   txt  + } + end + def nav_txt_odf + %{ +   odt  + } + end + def nav_txt_pdfs + %{ + pdfs   + } + end + def nav_txt_epub + %{ +  epub  + } + end + def nav_txt_pdf_portrait + %{ +  pdf  + } + end + def nav_txt_pdf_landscape + %{ +  pdf  + } + end + #% banner + def banner_home + %{
+ + #{png_site} + +
+ + an +
+ ( international | transnational ) +
+ commercial law & e-commerce +
+ infrastructure monitor
} + end + def banner_home_guide + %{
+ + #{png_doc} LM toc + + + #{png_doc} LM 20** + +
} + end + def banner_home_button_only + %{ + #{png_home_button} + } + end + def banner_home_button #yellow_dark now white + %{ + +
+ + #{png_home_button} + + +#{table_close}} + end + def banner_home_and_index_buttons #yellow_dark now white + %{ + + +
+ + +
+ + #{png_home} + +
+
+ + +
+ + +  This text's sub-  +
+  Table of Contents  +
+
+
+
+   +#{table_close}} + end + def banner_url_txt_sisu + %{SiSU} + end + def banner_band #yellow_dark now white + %{ + +
+ + #{png_home} + + +#{table_close}} + end + def banner_credit_band + %{ +
+ +
+ +
} + end + def banner_instrument_cover_band_scr + ' +
' + end + def banner_instrument_cover_band_seg + ' +
' + end + #% widget + 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 +< + +
+

+ + If you have problems viewing pages on this site please update your browser: + +

+#{table_close} + + + + + + + + + +
+

+ + +  Epiphany + + ® | + +

+
+

+ + +  Galeon + + ® | + +

+
+

+ + + I-Explorer + + ® | + +

+
+

+ + + Kazehakase + ® |

+ +

+ + + Konqueror + ® |

+

+ + + Mozilla + + + Firefox + + ® | + +

+
+

+ + + Netscape + + ® | + +

+
+

+ + + Opera + + ® | + +

+
+

+ + + Safari + + ® + +

+#{table_close} + + + + + + + + + + +WOK + end + def widgets_open +< +WOK + end + def widget_pdfviewers +< + + + + +WOK + end + def widget_sisu_text +< + Output generated by + + #{@v[:project]} + + #{@v[:version]} #{@v[:date]} (#{@v[:date_stamp]}) +

+WOK + end + def widget_sisu +< +
+WOK + end + def widget_sisu_verbose +< + +WOK + end + def widget_way_better + < + +WOK + end + #% credits + def credits_itl_cover_band + %{
+

+ + for console/text viewing: + +

+
+

+ + + elinks +  | + +

+
+

+ + + links2 +  | + +

+
+

+ + + w3m + + +

+
+

+ + for lightweight gui (X) viewing try: + +

+
+

+ + + Dillo + +  | + +

+
+

+ + +  Epiphany + + ® | + +

+
+

+ + +  Galeon +  | + +

+
+

+ + + links2 -g + + +

+#{table_close} +
+ +
+

+ + & for + + pdf + + viewings of this site we recommend stand alone viewers +
+ (rather than web browser plugins): +
+

+
+

+ + + Acrobat Reader + + ® +  | + +

+
+

+ + + Evince + + ® + +

+
+

+ +  GhostView® , + + GV® + + & + + GSview® + +  | + +

+
+

+ + +  Xpdf + + ® + +

+
+ +#{widget_sisu_text} +
+

+ + SiSU + +

+
+ +

+ Output generated by + + #{@v[:project]} + + #{@v[:version]} #{@v[:date]} (#{@v[:date_stamp]}) +
+ + #{@v[:project]} + + Copyright © Ralph Amissah + 1997, current #{@date.year_static}. + All Rights Reserved. +
+ + #{@v[:project]} + + is software for document structuring, publishing and search, +
+ + www.sisudoc.org/ + + and + + www.sisudoc.org + +
+ w3 since October 3 1993 + + ralph@amissah.com + +

+
+

+ #{@v[:project]} using: +
Standard SiSU markup syntax, +
Standard SiSU meta-markup syntax, and the +
Standard SiSU object citation numbering and system, (object/text positioning system) +
+ Copyright © Ralph Amissah 1997, current #{@date.year_static}. + All Rights Reserved. +

+
+

+ + GPLv3 + +

+
+

+ + #{@v[:project]} + + is released under + GPLv3 + or later, + #{url_decoration.xml_open}http://www.gnu.org/licenses/gpl.html#{url_decoration.xml_close} +

+
+

+ #{@v[:project]}, developed using + + Ruby + + on + + Debian/Gnu/Linux + + software infrastructure, + with the usual GPL (or OSS) suspects. +
+ Better - "performance, reliability, scalability, security & total cost of ownership" + [not to mention flexibility & choice] use of and adherence to open standards (where practical and fair) and it is software libré. +
+ Get With the Future + + Way Better! + +

+
+
+ +
+ +
+ + +
+ +
+ \@ +
+ #{txt_home} +
+ #{banner_url_txt_sisu} +
+
+#{table_close*4}} + end + def credits_sisu_manifest + widget_sisu_text + end + def credits_sisu + x=%{
+ +
+ #{widget_sisu} + #{widget_way_better} +
} + '' + end + def credits_splash + end + def credits_sisu_epub + x=%{
+

EPUB generated by #{@v[:project]} v#{@v[:version]}, GPL3

+
} + '' + end + #% bottom + def bottom_surround + %{
#{table_close} +
+ +
+#{table_close} + + #{banner_band} +#{table_close} + + +} + end + def search + env=SiSU_Env::Info_env.new(@md.fns,@md) + env.widget.search_form('sisusearch',nil,nil,true) + end + def manifest + %{} + end + end + class XML + end + class Head_toc < Head_information + 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 + %{

+ + #{@vz.epub_png_nav_toc} + +

+} + end + def seg_head_navigation_band + firstseg=%{ + #{@vz.epub_png_nav_nxt} + } if @md.firstseg =~/\S+/ + %{

#{firstseg}

} + end + def seg_head_navigation_band_bottom + firstseg=%{ + #{@vz.epub_png_nav_nxt} + } if @md.firstseg =~/\S+/ + %{

#{firstseg}

} + end + def manifest_link(text) #watch fix removed font size 2 + %{ #{text}} + end + def concordance_link(text) #watch fix removed font size 2 + if @md.concord_make + %{ + #{text} + } + else '' + end + end + def make_concordance + manifest=scroll=seg='' + wgt=Widget.new(@md) + %{
+ + +
+ #{table_close} + + #{credits_splash} +#{table_close} + +} + end + end + class Home < Skin + def initialize + @v=SiSU_Env::Info_version.instance.get_version + @dir=SiSU_Env::Info_env.new + @date=SiSU_Env::Info_date.new #{@date.year} + end + def redirect + < +SiSU + + + +SiSU informtion provided at www.sisudoc.org/sisu/SiSU

+If your browser supports redirection, you will be escorted there shortly. + + +WOK + end + def homepage + < + + +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 + + + + + + + + + + + + + +

+

+ + SiSU >> + +

+

+ SiSU information Structuring Universe +

+

+ Structured information, Serialized Units +

+

+software for electronic texts, document collections, books, digital libraries, and search, +

+

+ with "atomic search" and text positioning system (shared text citation numbering: "ocn") +

+

+outputs include: plaintext, html, XHTML, XML, ODF (OpenDocument), EPUB, LaTeX, PDF, SQL (PostgreSQL and SQLite) +

+
+ +
+

+ + SiSU + +

+

+ --- +

+

+ + SiSU Manual + +

+

+ --- +

+

+ + What does SiSU do? Summary + +

+

+ --- +

+

+ + Book Samples and Markup Examples + +

+

+ + sorted by Author (sisu metadata) + +

+

+ + sorted by Topic (sisu metadata) + +

+

+ --- +

+

+ + Object Citation Numbering - ocn + +

+

(a text positioning system)

+

+ --- +

+

+ + Search - "granular" + +

+ 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 + + abandoned U.S. provisional patent application + +

+

+ --- +

+

+ + Download + +

+

+ --- +

+

+ + Changelog + +

+

+ --- +

+

+ + License + +

+

+ Gnu / Linux / Unix +

+

+ ============= +

+

+ + sisu markup + +

+

+ + sisu commands + +

+

+ + sisu manual + +

+

+ + sisu man pages + +

+

+ --- +

+

+ document preparation can be on any platform, in any editor: + (syntax highlight support currently for: vim, kate, write, gedit, diakonos) +

+

+ + Syntax highlighting + +

+

+ ============= +

+

+ + * Composite document + +

+

+ the composite document is a superset of the following documents: +

+

+ + SiSU description + +

+

+ + SiSU examples + +

+

+ + SiSU chronology + +

+

+ + SiSU technical + +

+

+ + SiSU FAQ + +

+

+ + SiSU download + +

+

+ + SiSU changelog + +

+

+ + SiSU license + +

+

+ + SiSU standard + +

+

+ + SiSU abandoned provisional patent + +

+

+ Note: the placement of SiSU documents on the Net predate the release of SiSU. +

+
+
+

+SiSU Short Description +

+

+SiSU is a comprehensive future-proofing electronic document management system. Built-in search capabilities allow you to search across multiple documents and highlight matches in an easy-to-follow format. Paragraph numbering system allows you to cite your electronic documents in a consistent manner across multiple file formats. Multiple format outputs allow you to display your documents in plain text, PDF (portrait and horizontal), OpenDocument format, HTML, or e-book reading format (EPUB). Word mapping allows you to easily create word indexes for your documents. Future-proofing flexibility allows you to quickly adapt your documents to newer output formats as needed. All these and many other features are achieved with little or no additional work on your documents - by marking up the documents with a super simplistic markup language, leaving the SiSU engine to handle the heavy-lifting processing. +

+

+Potential users of SiSU include individual authors who want to publish their books or articles electronically to reach a broad audience, web publishers who want to provide multiple channels of access to their electronic documents, or any organizations which centrally manage a medium or large set of electronic documents, especially governmental organizations which may prefer to keep their documents in easily accessible yet non-proprietary formats. +

+

+SiSU is an Open Source project initiated and led by Ralph Amissah (ralph.amissah@gmail.com) and can be contacted via mailing list http://lists.sisudoc.org/listinfo/sisu at sisu@lists.sisudoc.org. SiSU is licensed under the GNU General Public License. +

+

+ For less markup than the most elementary HTML you can have more. +

+

SiSU - Structured information, Serialized Units for electronic documents, is an information structuring, transforming, publishing and search framework with the following features:

+

+(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; (structured) XML; ODF (Open Document text); EPUB; 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, XML, EPUB, 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: +(a) +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) +version control, documents integrated with time based source control system, default RCS or CVS with use of $Id$ tag, which SiSU checks +

+(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, 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,

+

+(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, XML, ODF, EPUB, 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 +

+
+

+More information on SiSU provided at www.sisudoc.org/sisu/SiSU

+
+
+

+ +

+ +
+ + + + idx + txt +search.sisudoc.org +
+ +

+

+SiSU ("SiSU information Structuring Universe" or "Structured information, Serialized Units"),1 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, LaTeX or PDF files, and populate an SQL database with objects2 (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. +

+ +

+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,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).

+

+1. also chosen for the meaning of the Finnish term "sisu". +

+

+2 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.

+

+ More information on SiSU provided at: + + www.sisudoc.org/sisu/SiSU + +

+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.

+

+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.

+

+ +ralph@amissah.com + +

+

+ +ralph.amissah@gmail.com + +

+

+ +sisu@lists.sisudoc.org. + +

+

+ +http://lists.sisudoc.org/listinfo/sisu + +

+

+#{@date.year_static} +

+

+w3 since October 3 1993 +

+
+ + +WOK + end + def home_toc + ' ' + end + end + class Inserts + end + class TeX < Skin + def initialize(papersize='') + @papersize=papersize + end + def a4 + def portrait + def w + 160 + end + def h + 228 + end + def img_px + 450 + end + self + end + def landscape + def w + 238 + end + def h + 160 + end + def img_px + 300 + end + self + end + self + end + def letter + def portrait + def w + 166 + end + def h + 212 + end + def img_px + 468 + end + self + end + def landscape + def w + 226 + end + def h + 166 + end + def img_px + 290 + end + self + end + self + end + def legal + def portrait + def w + 168 + end + def h + 286 + end + def img_px + 474 + end + self + end + def landscape + def w + 296 + end + def h + 166 + end + def img_px + 420 + end + self + end + self + end + def b5 + def portrait + def w + 140 + end + def h + 204 + end + def img_px + 356 + end + self + end + def landscape + def w + 200 + end + def h + 130 + end + def img_px + 260 + end + self + end + self + end + def a5 + def portrait + def w + 112 + end + def h + 162 + end + def img_px + 280 + end + self + end + def landscape + def w + 152 + end + def h + 100 + end + def img_px + 190 + end + self + end + self + end + def dimensions + d=case @papersize + when /a4/; a4 + when /letter/; letter + when /legal/; legal + when /b5/; b5 + when /a5/; a5 + else a4 + end + end + end +end +__END__ diff --git a/lib/sisu/v3/digests.rb b/lib/sisu/v3/digests.rb new file mode 100644 index 00000000..77c593ac --- /dev/null +++ b/lib/sisu/v3/digests.rb @@ -0,0 +1,388 @@ +# 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: 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 + pwd=Dir.pwd + class Source + @@dg=nil + def initialize(opt) + @opt=opt + @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) + 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 + @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_title_hi + SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/#{@md.fnb}/#{@md.fn[:digest]}").flow if @opt.cmd =~/[MV]/ + end + SiSU_Digest_view::Source::Scroll.new(@particulars).songsheet + SiSU_Env::Info_skin.new(@md).select + rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error + ensure + end + end + private + class Scroll \1') + para.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\1') + para.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\1') + if para=~/#{Mx[:en_a_o]}[\d*+]+.+?#{Mx[:id_o]}[0-9a-f]{#{@dl}}#{Mx[:id_c]}#{Mx[:en_a_c]}/ + para_endnotes << para.scan(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})([\d*+]+).+?#{Mx[:id_o]}([0-9a-f]{#{@dl}})#{Mx[:id_c]}(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/) + end + ima=[] + if para !~/^%+\s/ \ + and para =~/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+\.(png|jpg|gif))\s.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/ + images=para.scan(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+\.(?:png|jpg|gif))\s.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/).flatten + else image=nil + end + x=case para + when /^#{Mx[:meta_o]}title#{Mx[:meta_c]}/ + "\n" + ' '*0 +'@' + ' '*9 + when /^#{Mx[:meta_o]}subtitle#{Mx[:meta_c]}/ + "\n" + ' '*1 +'@' + ' '*8 + when /^#{Mx[:lv_o]}1:/ #fix Mx[:lv_o] + "\n" + ' '*2 +':A ' + ' '*6 +'- ' + ocn + ' '*(10-ocn.length) + d_clean + ' ' + d_all + when /^#{Mx[:lv_o]}2:/ #fix Mx[:lv_o] + "\n" + ' '*3 +':B ' + ' '*5 +'- ' + ocn + ' '*(10-ocn.length) + d_clean + ' ' + d_all + when /^#{Mx[:lv_o]}3:/ #fix Mx[:lv_o] + "\n" + ' '*4 +':C ' + ' '*4 +'- ' + ocn + ' '*(10-ocn.length) + d_clean + ' ' + d_all + when /^#{Mx[:lv_o]}4:/ #fix Mx[:lv_o] + "\n" + ' '*5 +'1' + ' '*4 +'- ' + ocn + ' '*(10-ocn.length) + d_clean + ' ' + d_all + when /^#{Mx[:lv_o]}5:/ #fix Mx[:lv_o] + "\n" + ' '*6 +'2' + ' '*3 +'- ' + ocn + ' '*(10-ocn.length) + d_clean + ' ' + d_all + when /^#{Mx[:lv_o]}6:/ #fix Mx[:lv_o] + "\n" + ' '*7 +'3' + ' '*2 +'- ' + ocn + ' '*(10-ocn.length) + d_clean + ' ' + d_all + else + if para =~/MD5\(\S+?\.sst\)=\s*([0-9a-f]{#{@dl}})<\/u>/ #watch + @n,@s=/MD5\((\S+?\.sst)\)=\s*([0-9a-f]{#{@dl}})<\/u>/.match(para)[1,2] + end + x=unless ocn =~ /^0$/ + if images \ + 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_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_include_local}, #{@env.path.image_source_include_remote} and #{@env.path.image_source_include}").error2 unless @md.cmd =~/q/ + nil + end + @img << /\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 << if @dg =~/^sha(?:2|256)$/; sys.sha256(para_image) + else sys.md5(para_image) + end + else + @image_name << ' '*16 + i + ' [image missing]' + @image_dgst << '' + @image_dgst[1]=not_found_msg + ' '*(32-not_found_msg.length) + end + end + line= "\n" + ' '*9 + ' - ' + ocn + ' '*(10-ocn.length) + d_clean + ' ' + d_all + "\n" + line_image=[] + c=0 + @image_name.each do |ok| + line_image << %{ #{@img[c]} #{@image_dgst[c][1]} #{@image_name[c]}} + c +=1 + end + line=line + line_image.join("\n") + else "\n" + ' '*9 + ' - ' + ocn + ' '*(10-ocn.length) + d_clean + ' ' + d_all + 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.each do |n| + m=rgx_txt(n) + if m=~/\S+/ \ + and para=~/^#{m}:/ + x,o=0,18 + while x < 2; o = o + 2 + x=o - n.length + end + space=' '*x + prefix="#{n.downcase}#{space}" + break + else prefix=' '*9 + end + end + m_title=rgx_txt(@tr.full_title) + m_author=rgx_txt(@tr.author) + m_sourcefile_digest=rgx_txt(@tr.sourcefile_digest) + m_sisu_version=rgx_txt(@tr.sisu_version) + m_last_generated=rgx_txt(@tr.last_generated) + m_ruby_version=rgx_txt(@tr.ruby_version) + case para + when /#{m_title}: / + @t=/#{m_title}: (.+?)#{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_author}: / + @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}.+?/ #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}: / + @g=/#{m_last_generated}: (.+?)#{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_ruby_version}: / + @r=/#{m_ruby_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 + end + dgst_extra ||='' + "\n" + prefix +' - ' + ocn + ' '*(10-ocn.length) + d_clean + ' ' + d_all + dgst_extra + "\n" + end + end + para_endnotes[0].each { |e| y << "\n" + ' '*(28-e[0].length) + "[#{e[0].to_s}] #{e[1].to_s}" } if para_endnotes[0] + if y; digests(x,y) + else digests(x) + end + end + end + manifest="#{@env.url.root}/#{@md.fnb}/sisu_manifest.html" + a=%{ocn digest clean (no markup/notes),#{@sp*33}digest all (includes markup & endnotes)\n} + description("#{@md.title.full}\n") + description("#{@md.author}\n") + description("#{@md.fns}\n") + description("----------------------------------------------\n") + description("SiSU Document Content Certificate (Digest/DCC)\n") + description("----------------------------------------------\n") + description(" #{@dg} digests\n") + description("------------\n") + description("Sourcefile digest: #{@md.dgst[1]}\n") + description(" source filename: #{@md.fns}\n") + description("available outputs: #{manifest}\n") + #description(" time generated: #{@g}\n") + #description(" SiSU version used: #{@v}\n") + #description(" Ruby version used: #{@r}\n") + description("------------\n") + description("Document Digests\n") + description(a) + end + def dal_structure + data=@data + endnotes=nil + data.each do |t_o| + dgst=SiSU_text_representation::Modified_text_plus_Hash_digest.new(@md,t_o).composite.dgst + if dgst + 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' + 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]}") + if dgst[:images] + dgst[:images].each do |img| + digests("#{@sp*8}#{img[:img_dgst]}#{@sp*66}#{img[:img_type]} #{img[:img_name]}") + end + end + end + if dgst[:endnotes] + dgst[:endnotes].each do |en| + digests("#{@sp*8}#{en[:note_dgst]}#{@sp*66}note [#{en[:note_number]}]") + endnotes=en[:note_number] + end + end + end + end + l=Hash.new(0) + ocn=nil + dal_structure_tree("------------\n") + dal_structure_tree("document structure[*]\n") + data.each do |t_o| + if t_o.is=='heading' + x=case t_o.ln + when 1; l[1] +=1 #fix Mx[:lv_o] + ' '*0 +':A' + when 2; l[2] +=1 #fix Mx[:lv_o] + ' '*1 +':B' + when 3; l[3] +=1 #fix Mx[:lv_o] + ' '*2 +':C' + when 4; l[4] +=1 #fix Mx[:lv_o] + ' '*3 +'1' + when 5; l[5] +=1 #fix Mx[:lv_o] + ' '*4 +'2' + when 6; l[6] +=1 #fix Mx[:lv_o] + ' '*5 +'3' + else nil + end + end + 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") + dal_structure_summary("------------\n") + dal_structure_summary("document structure[*]\n") + [0,1,2,3,4,5,6].each do |y| + v=case y + when 1; ':A' + when 2; ':B' + when 3; ':C' + when 4; '1 ' + when 5; '2 ' + when 6; '3 ' + end + dal_structure_summary("#{v} = #{l[y]}\n") if l[y] > 0 + end + dal_structure_summary("objects (ocn) = #{ocn}\n") + dal_structure_summary("endnotes = #{endnotes}\n") + dal_structure_summary(" [*] number of headers (@) and of each heading level (:A to :C and 1 to 3)\n") + end + def supplementary + if defined? @md.sc_number \ + and @md.sc_number + rcinfo("------------\n") + rcinfo("source control information\n") + rcinfo(" (the following information while not important for document content certification\n may help the publisher in locating the version referred to)\n") + rcinfo(" rcs version number: #{@md.sc_number}\n") + if defined? @md.sc_date \ + and @md.sc_date + rcinfo(" rcs date: #{@md.sc_date}\n") + end + if defined? @md.sc_time \ + and @md.sc_time + rcinfo(" rcs time: #{@md.sc_time}\n") + end + end + rcinfo("------------\n") + rcinfo("Note: the time generated related fields (text and digests) will vary between otherwise identical document outputs\n") + end + end + end +end +__END__ diff --git a/lib/sisu/v3/embedded.rb b/lib/sisu/v3/embedded.rb new file mode 100644 index 00000000..afdfd5a7 --- /dev/null +++ b/lib/sisu/v3/embedded.rb @@ -0,0 +1,139 @@ +# 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: sitemap created from parameters extracted from input file(s) + +=end +module SiSU_Embedded + require "#{SiSU_lib}/param" # param.rb + include SiSU_Param + require "#{SiSU_lib}/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 + end + def read + songsheet + end + def songsheet + images + audio + multimedia + begin + rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error + ensure + end + end + def images + src="#{Dir.pwd}/_sisu/image" + ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image" + @rhost.each do |remote_conn| + rdest="#{remote_conn[:name]}/#{@env.path.stub_pwd}/_sisu/image" + if @md.cmd.inspect =~/[vVMR]/ \ + and FileTest.directory?(src) + mkdir_p(ldest) unless FileTest.directory?(ldest) + src_ec="#{src}/" + @md.ec[:image].join(" #{src}/") + 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 + end + end + end + end + def audio + #p @md.ec[:audio] + src="#{Dir.pwd}/_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]/ \ + and FileTest.directory?(src) + 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 + end + end + end + end + def multimedia + #p @md.ec[:multimedia] + src="#{Dir.pwd}/_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]/ \ + and FileTest.directory?(src) + 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 + end + end + end + end + end +end +__END__ diff --git a/lib/sisu/v3/epub.rb b/lib/sisu/v3/epub.rb new file mode 100644 index 00000000..aa4ede99 --- /dev/null +++ b/lib/sisu/v3/epub.rb @@ -0,0 +1,673 @@ +# 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: 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 + SiSU_Env::SiSU_file.new(@md).mkdir.output.epub + @tuned_file_array=SiSU_EPUB::Source::XHtml_environment.new(@particulars).tuned_file_instructions + data=@tuned_file_array + scr_endnotes=SiSU_EPUB::Source::Endnotes.new(@md,data).scroll + toc=SiSU_EPUB::Source::Toc.new(@md,data).songsheet + data=@tuned_file_array + scr_toc=SiSU_EPUB::Source::Scroll_head_and_segtoc.new(@md,toc).in_common #watch + 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::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_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 + title=File.basename(@md.fns,'.rb') + SiSU_Env::SiSU_file.new(@md).mkdir.output.epub + 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 + 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] << %{
\n
} + @@toc[:scr] << %{
\n
} + md_opf_a_content << @epub.metadata_opf.manifest_content_sisu_toc + md_opf_a_spine << @epub.metadata_opf.spine_sisu_toc + @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] << "
\n
" + @@toc[:scr] << "
\n
" + @@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") + '
' + minitoc + '
' + end + protected + def level_1 + dob=@data + linkname,link=dob.obj.strip,dob.ocn + if link \ + and link !~/#/ #% keep eye on link + p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,link) + end + title=if dob.obj !~/Document Information/; linkname + else + link='metadata' + %{#{linkname}} + 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/ + %{#{linkname}} + else linkname + end + else + @@toc[:scr] << '
' + link=if dob.ln; dob.ln + else '' + end + %{#{linkname}} + 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}} + 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}} + 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=%{ + #{dob.obj} + } + @@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+)(.*)/, + %{} + + %{\\1 \\2 }) + 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}} 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=%{ + #{linkname} + } + 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}} + 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=%{ + #{linkname} +} + 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}} + 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+(.+)/, + %{ +
+ #{@png.crosslink_ext} +   \\2 + <\/a> +
+}) + else + dob.gsub!(/^4~!\s+(\S+)\s+(.+)/, + %{
+ + + #{@png.crosslink} +   \\2 + <\/a> +
+}) + end + end + end + class Scroll_head_and_segtoc < Toc + 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(/(\*+)/,'\1') + tmp_head=doc_title_endnote + "\n" + txt_obj={:txt =>tmp_head} + format_txt_obj=SiSU_EPUB_Format::Format_text_object.new(@md,txt_obj) + 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(/(\*+)/,%{ \\1}) + 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_doc="#{@md.fnb}.epub" + @epub_header=SiSU_EPUB_Format::Head_information.new(@md) + @make=SiSU_Env::Create_file.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.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_include + @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(@md.file.output_path.epub) unless FileTest.directory?(@md.file.output_path.epub) + system(" + cd #{@md.env.path.epub} + zip -qXr9D #{@epub_doc} * + mv #{@epub_doc} #{@md.file.place_file.epub} + 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/v3/epub_concordance.rb b/lib/sisu/v3/epub_concordance.rb new file mode 100644 index 00000000..301d34a2 --- /dev/null +++ b/lib/sisu/v3/epub_concordance.rb @@ -0,0 +1,312 @@ +# 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: epub concordance file (html concordance, wordmap, linked index + of words in document) + +=end +module SiSU_EPUB_Concordance + require "#{SiSU_lib}/particulars" # particulars.rb + include SiSU_Particulars + require "#{SiSU_lib}/sysenv" # sysenv.rb + include SiSU_Env + require "#{SiSU_lib}/defaults" # defaults.rb + include SiSU_Viz + require "#{SiSU_lib}/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) + 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/ + 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_EPUB_Concordance::Source::Words.new(@particulars).songsheet + end + rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error + ensure + end + end + private + class Doc_title + include SiSU_Viz + #revisit, both requires (html & shared_xml) needed for stand alone operation (sisu -w [filename]) + require "#{SiSU_lib}/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 + txt_path=%{#{@md.dir_out}} + SiSU_Env::Info_skin.new(@md).select + @fnb=@md.fnb + @lex_button=%{SiSU home -->} + @doc_details =<
 

#{@md.title.full}

#{@md.creator.author}

+WOK + end + def create + @css=SiSU_Env::CSS_stylesheet.new(@particulars.md) + format_head_toc=SiSU_EPUB_Format::Head_toc.new(@md) + dochead=format_head_toc.head + < + #{@doc_details} +

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

+

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

+

+ word (number of occurences)
linked references to word within document
+ [if number of occurences exceed number of references - word occurs more than once in at least one reference. Footnote/endnotes are either assigned to the paragraph from which they are referenced or ignored, so it is relevant to check the footnotes referenced from within a paragraph as well.] +

+

+ (After the page is fully loaded) you can jump directly to a word by appending a hash (#) and the word to the url for this text, (do not forget that words are case sensitive, and may be listed twice (starting with and without an upper case letter)), #your_word # [ http://[web host]/#{@fnb}/concordance.html#your_word ] +

+WOK + end + end + class Word + @@word_previous='' + def initialize(word,freq) + @word,@freq=word,freq + end + def html + w=if @word.capitalize==@@word_previous + %{\n

#{@word}

(#{@freq})

\n\t

} + else n=@word.strip.gsub(/\s+/,'_') #also need to convert extended character set to html + %{\n

#{@word}

(#{@freq})

\n\t

} + end + @@word_previous=@word.capitalize + w + end + end + class Words + require "#{SiSU_lib}/defaults" # defaults.rb + include SiSU_Viz + require "#{SiSU_lib}/epub_format" # epub_format.rb + include SiSU_EPUB_Format + require "#{SiSU_lib}/sysenv" # sysenv.rb + include SiSU_Screen + 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.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] + @rxp_lv3=/^#{Mx[:lv_o]}3:/ #fix Mx[:lv_o] + @rxp_seg=/^#{Mx[:lv_o]}4:(\S+?)#{Mx[:lv_c]}/ + @rxp_title=Regexp.new("^#{Mx[:meta_o]}title#{Mx[:meta_c]}\s*(.+?)\s*$") + @rxp_t1=Regexp.new('^T1') + @rxp_t2=Regexp.new('^T2') + @rxp_t3=Regexp.new('^T3') + @rxp_excluded1=/(?:https?|file|ftp):\/\/\S+/ + @rxp_excluded0=/^(?:#{Mx[:fa_bold_o]}|#{Mx[:fa_italics_o]})?(?:to\d+|\d+| |#{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 + end + end + def songsheet + begin + @file_concordance=File.open("#{@path}/content/#{@md.fn[:epub_concord]}",'w') + map_para + rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error + ensure + @file_concordance.close + end + end + protected + def location_scroll(wordlocation,show) + @wordlocation=wordlocation + %{#{@wordlocation}; } + 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? + case @wordlocation + when @rxp_t1 + %{[H]#{@show}, } + when @rxp_t2 + %{[H]#{@show}, } + when @rxp_t3 + %{[H]#{@show}, } + else %{#{@show}, } + end + end + def map_para + @seg,toy=nil,nil + @word_map={} + @dal_array.each do |line| + if defined? line.ocn + if line.is =~/heading/ and line.ln==4; @seg=line.name + end + if line.ocn.to_s =~/\d+/; 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=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=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! + end + @freq[word] +=1 + @word_map[word] ||= [] + if line !~@rxp_lv1 \ + and line !~@rxp_lv2 \ + and line !~@rxp_lv3 + @word_map[word] << location_seg("#{@seg}\##{toy}",toy) + else + @word_map[word] << case line + when @rxp_lv1; location_seg('T1',toy) + when @rxp_lv2; location_seg('T2',toy) + when @rxp_lv3; location_seg('T3',toy) + end + end + end + end + end + end + end + end + scr='Full Text scroll: doc#  ' + seg='' + @file_concordance << SiSU_EPUB_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] + @file_concordance << '

' + alph.each {|x| @file_concordance << %{#{x}, }} + @file_concordance << '

' + letter=alph.shift + @file_concordance << %{\n

A

} + for word in @freq.keys.sort! {|a,b| a.downcase<=>b.downcase} + f=/^(\S)/.match(word)[1] + if letter < f.upcase + while letter < f.upcase + if alph.length > 0 + letter=alph.shift + @file_concordance << %{\n

#{letter}

} + else break + end + end + end + keyword=SiSU_EPUB_Concordance::Source::Word.new(word,@freq[word]).html + if keyword !~ @rxp_excluded0 + if @word_map[word][0] =~ /\d+/ + wm=[] + @file_concordance << %{#{keyword}#{seg}#{@word_map[word].uniq.compact.join}} + end + @file_concordance << '

' + end + # special cases endnotes and header levels 1 - 3 + end + credits=@vz.credits_sisu_epub + @file_concordance << %{>#{credits}\n} # footer + end + end + end +end +__END__ diff --git a/lib/sisu/v3/epub_format.rb b/lib/sisu/v3/epub_format.rb new file mode 100644 index 00000000..c189eb3a --- /dev/null +++ b/lib/sisu/v3/epub_format.rb @@ -0,0 +1,2030 @@ +# 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: epub formating, css template + +=end +module SiSU_EPUB_Format + include SiSU_Viz + class Paragraph_number + 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+|)$/, + %{}) + elsif @ocn.to_i==0 + @ocn.gsub(/^(\d+|)$/, + %{}) + else + ocn_class='ocn' + @ocn.gsub(/^(\d+|)$/, + %{}) + end + end + def name + %{} + end + def id #w3c? "tidy" complains about numbers as identifiers ! annoying + %{id="o#{@ocn}"} + end + def goto + %{} + end + end + class Css + def css_epub_xhtml +< + + +WOK + end +=begin +~/epub + |-- META-INF + | `-- container.xml #✓ simple, make sure full-path of rootfile points to metadata.opf + |-- content + | |-- 1.xhtml + | |-- 2.xhtml + | |-- 3.xhtml + | |-- ... .xhtml + | |-- concordance.xhtml + | |-- css + | | `-- xhtml.css + | |-- endnotes.xhtml + | |-- image + | | |-- arrow_next_red.png + | | |-- arrow_prev_red.png + | | |-- arrow_up_red.png + | | `-- bullet_09.png + | |-- index.xhtml + | |-- meta.xhtml + | |-- metadata.xhtml + | `-- toc.xhtml + |-- metadata.opf #(i) metadata dc; (ii) manifest (contents); (iii) spine (mimetypes) + |-- mimetype #✓ application/epub+zip + `-- toc.ncx #✓ (i) head (ii) doc title (iii) navmap, list of navigation points (like chapters) +=end + def doc_type + doc_type_xhtml + end + def mimetype + < + + + + + +WOK + 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 + head_open + head + head_close + doc_title + doc_author + navmap_open + #navmap ... + navmap_close + close + end + def open + < +WOK + end + def close + < +WOK + end + def head_open + < +WOK + end + def head + depth=@md.lvs[2] + @md.lvs[3] + @md.lvs[4] + < + + + + + +WOK + end + def head_close + < +WOK + end + def doc_title + < + #{@md.title.full} + +WOK + end + def doc_author + < + #{@md.author} + +WOK + end + def navmap_open + < +WOK + end + def navmap_sisu_toc(no) + < + + Table of Contents + + + +WOK + end + def navpoint(dob,no) + < + + #{dob.obj} + + +WOK + end + def navpoint_top3(dob,no,name) + < + + #{dob.obj} + + +WOK + end + def navpoint_close + < +WOK + end + def navmap_close + < +WOK + end + self + end + def metadata_opf #(i) metadata dc; (ii) manifest (contents); (iii) spine (mimetypes) + def structure + package_open + metadata_open + metadata_close + manifest_open + manifest_close + spine_open + spine_close + package_close + end + def package_open + < + +WOK + end + def package_close + < +WOK + end + def metadata #metadata dc + author=if defined? @md.creator.author \ + and @md.creator.author =~/\S+/ + x=@md.creator.author.gsub!(//,'>') + @md.creator.author.gsub!(/<br(?: \/)?>/,'
') + %{\n #{x}} + else '' + end + illustrator=if defined? @md.creator.illustrator \ + and @md.creator.illustrator =~/\S+/ + x=@md.creator.illustrator.gsub!(//,'>') + @md.creator.illustrator.gsub!(/<br(?: \/)?>/,'
') + %{\n #{x}} + else '' + end + rights=if defined? @md.rights.all \ + and @md.rights.all =~/\S+/ + rights=@md.rights.all.gsub(/
/,'
') + %{\n #{rights}} + else '' + end + < + #{@md.title.full} + #{author}#{illustrator} + en-US + ... + #{rights} + urn:uuid:#{@md.dgst[1]} + +WOK + end + def manifest_open + < + + + + + +WOK + end + def manifest_content_sisu_toc + < +WOK + end + def manifest_content(dob) + < +WOK + end + def manifest_images(imgs) + imgs=imgs + ['arrow_next_red.png','arrow_prev_red.png','arrow_up_red.png','bullet_09.png'] + images=[" \n"] + imgs.each do |i| + image,type=/(\S+?)\.(png|jpg|gif)/.match(i)[1,2] + images<<< +WOK + end + images=images.join('') + images + end + def manifest_close + < +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.). + < +WOK + end + def spine_sisu_toc + < +WOK + end + def spine(dob) + < +WOK + end + def spine_close + < +WOK + end + self + end + def toc_head_escript + end + def seg_head_escript + end + def table_close + %{ +#{@vz.table_close}} + end + def buttons_home + %{ + #{@vz.banner_home_and_index_buttons} +} + end + def copyat + %{

copy @ + + #{@vz.txt_home} +

} + end + def xhtml_close + %{#{@vz.credits_sisu_epub} + +} + end + end + class Widget < Head_information + def initialize(md) + super(md) + @md=md + @cf_defaults=SiSU_Env::Info_processing_flag.new + end + def home + %{
+ + #{@vz.png_homepage} + + + #{@vz.nav_txt_manifest} + +
+ + #{wgt.seg(@vz.nav_txt_toc_link)}#{wgt.scroll(@vz.nav_txt_doc_link)}#{wgt.pdf}#{wgt.odf} +
+ #{wgt.concordance(@vz.nav_txt_concordance)} + #{wgt.manifest} + #{wgt.search} + #{wgt.home} +
} + end + def head + %{#{doc_type} + + +#{@css.xhtml_epub} + +#{@vz.color_body} +#{@vz.js_top}} + end + def concordance + if @md.concord_make + %{#{@vz.margin_css} +

+ + Concordance + +

+#{@vz.table_close}} + else + %{#{@vz.margin_css} +#{@vz.table_close}} + end + end + def links_guide_open(type='horizontal') + if type=='vertical'; links_guide_vertical_open + else links_guide_horizontal_open + end + end + def prefix_a + end + def rights + def all + rghts=@md.rights.all.gsub(/
/,'
') + rghts=rghts.gsub(/^\s*Copyright\s+\(C\)/,'Copyright © ') + %{

Rights: #{rghts}

} + end + self + end + def prefix_b + %{

Prefix: #{@md.prefix_b}} + end + def make_seg + concord=concordance_link(@vz.nav_txt_concordance) + %{ + +
+ #{@vz.nav_txt_toc_link} + + + #{concord} +#{@vz.table_close}} + end + def manifest #check structure + manifest=manifest_link(@vz.nav_txt_manifest) + %{#{@vz.margin_txt_3} + #{@vz.paragraph_font_small} + #{manifest} + +#{@vz.table_close}} + end + def concordance #check structure + concord=concordance_link(@vz.nav_txt_concordance) + %{#{@vz.margin_txt_3} + #{@vz.paragraph_font_small} + #{concord} + +#{@vz.table_close}} + end + def metadata + %{#{@vz.margin_css} +

+ + MetaData + +

+#{@vz.table_close}} + end + def seg_metadata + @metalink=%{./#{@md.fn[:metadata]}} + metadata + end + end + class Head_seg < Head_information + def initialize(md) + super(md) + end + def head + %{#{doc_type} + + + #{@seg_name_xhtml[@seg_name_xhtml_tracker]} - + #{@md.html_title} + + +#{@vz.font_css_table_file} + +#{@vz.color_body} +#{@vz.js_top}} + end + def title_banner(title,subtitle,creator) + end + def dot_control_pre_next + %{ + + +
+ + #{@vz.png_nav_dot_pre} + + + + #{@vz.png_nav_dot_toc} + + + + #{@vz.png_nav_dot_nxt} + +#{@vz.table_close}} + end + def dot_control_pre + %{ + + +
+ + #{@vz.png_nav_dot_pre} + + + + #{@vz.png_nav_dot_toc} + + + + #{@vz.png_nav_dot_nxt} + +#{@vz.table_close}} + end + def toc_nav(f_pre=false,f_nxt=false,use=1) + pre=nxt='' + toc=%{ + #{@vz.epub_png_nav_toc} + +} + pre=%{ + #{@vz.epub_png_nav_pre} + +} if f_pre==true + nxt=%{ + #{@vz.epub_png_nav_nxt} + +} if f_nxt==true + %{

+#{pre} +#{toc} +#{nxt} +

+} + 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) + %{ + #{text} + } + end + def concordance_link(text) + if @md.concord_make + %{ + #{text} + } + else '' + end + end + def doc_types #used in seg_nav_band ### + scroll=seg='' + wgt=Widget.new(@md) + x=if @md.concord_make + %{ + + + #{wgt.seg(@vz.nav_txt_toc_link)} + #{wgt.scroll(@vz.nav_txt_doc_link)} + #{wgt.pdf}#{wgt.odf} +
+ #{wgt.concordance(@vz.nav_txt_concordance)} + #{wgt.manifest} + #{wgt.search} + #{wgt.home} +
} + else + %{ + + + #{wgt.seg(@vz.nav_txt_toc_link)} + #{wgt.scroll(@vz.nav_txt_doc_link)} + #{wgt.pdf}#{wgt.odf} +
+ #{wgt.manifest} + #{wgt.search} + #{wgt.home} +
} + end + end + def navigation_table + %{ +
+ + + } + end + def navigation_table1 + %{ +
+ } + end + def navigation_table2 + %{ +
+ } + end + def heading_advert_local_1 + dir=SiSU_Env::Info_env.new(@fns) + %{

+ +
+ + #{@md.ad_alt} + +#{@vz.table_close} +

} + end + def heading_advert_local_2 + dir=SiSU_Env::Info_env.new(@fns) + %{

+ +
+ + #{@md.ad_alt} + +#{@vz.table_close} +

} + end + def heading_advert_external + dir=SiSU_Env::Info_env.new(@fns) + %{

+ +
+ + #{@md.ad_alt} + +#{@vz.table_close} +

} + 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 + %{ +
+ + + +
+ #{doc_types} + + #{segtocband} +
+ #{seg_table_top_control} +
+} + end + def endnote_mark +%{ +
+} + end + def endnote_section_open +%{ +
+} + end + def endnote_section_close +%{ +
+} #revisit + end + def head + %{#{doc_type} + + + #{@seg_name_xhtml[@seg_name_xhtml_tracker]} - + #{@md.html_title} + + +#{@css.xhtml_epub} + +#{@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 + def initialize(md) + super(md) + end + def toc_owner_details + %{#{@vz.margin_txt_3} +#{@vz.paragraph_font_small} + + Owner Details + +     + + + +#{@vz.table_close}} + end + end + class Format_text_object + @vz=SiSU_Env::Get_init.instance.skin + attr_accessor :md,:t_o,:txt,:ocn,:format,:table,:link,:linkname,:paranum,:p_num,:headname,:banner,:url + def initialize(md,t_o) + @md,@t_o=md,t_o + if t_o.class==Hash + @txt =t_o[:txt] || nil + @ocn =t_o[:ocn] || nil + @ocn_display =t_o[:ocn_display] || nil + @headname =t_o[:headname] || nil + @trailer =t_o[:trailer] || nil + @endnote_part_a =t_o[:endnote_part_a] || nil + @endnote_part_b =t_o[:endnote_part_b] || nil + @lnk_url =t_o[:lnk_url] || nil + @lnk_txt =t_o[:lnk_txt] || nil + @format =t_o[:format] || nil + @target =t_o[:target] || nil #occasionally passed but not used + 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]/; %{} #consider: h_#{headname} + else %{} + end + @headname=if headname =~/^[a-zA-Z]/; %{} #consider: h_#{headname} + else %{} + end + end + end + elsif t_o.class.inspect =~/Object/ + @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) + else + if @md.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]}/,'') + end + @p_num=Paragraph_number.new(@md,@ocn) + @vz=SiSU_Env::Get_init.instance.skin + end + def nametags_seg(dob) #FIX + tags='' + if defined? dob.tags \ + and dob.tags.length > 0 # insert tags "hypertargets" + dob.tags.each do |t| + tags=tags +%{} + end + end + tags + end + def endnote_body + %{ +

+ #{@txt} +

+} + end + def endnote_body_indent + %{ +

+ #{@txt} +

+} + end + def no_paranum + %{ +
+ +

+ #{@txt} +

+
+} + end + def para_form_css(tag,attrib) # regular paragraphs shaped here + ul=ulc='' + ul,ulc="
    \n ","\n
" if @tag =~/li/ + %{ +
+ #{@p_num.ocn_display} + #{ul}<#{tag} class="#{attrib}" #{@p_num.id}> + #{@named}#{@txt} + #{ulc} +
+} + end + def para + para_form_css('p','norm') + end + def group + para_form_css('p','group') + end + def block + para_form_css('p','block') + end + def alt + para_form_css('p','alt') + end + def verse + para_form_css('p','verse') + end + def code + para_form_css('p','code') + end + def center + para_form_css('p','center') + end + def bold + para_form_css('p','bold') + end + def bullet + para_form_css('li','bullet') + end + def table + @txt=if @t_o.obj !~/^
') + @txt.gsub!(/#{Mx[:br_obj]}/,'

') + para_form_css('p','norm') + end + def format(tag,attrib) + para_form_css(tag,attrib) + end + def title_heading(tag,attrib) + %{ +
+<#{tag} class="#{attrib}"> + #{@named}#{@txt} + +
+} + end + def title_heading1 + title_heading('h1','tiny') + end + def title_heading2 + title_heading('h2','tiny') + end + def title_heading3 + 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,' ') + %{ +
+ #{@p_num.ocn_display} + <#{tag} class="#{attrib}" #{@p_num.id}>#{@p_num.name} + #{@named}#{@txt} + +
+} + end + def seg_heading4 + %{ +
+ #{@p_num.ocn_display} +

+ #{@txt} +

+
+} + end + def seg_heading5 + seg_heading_sub('p','bold') + end + def seg_heading6 + seg_heading_sub('p','bold') + end + def dl #check :trailer + "
#{@txt} #{@trailer}
" + end + def table_css_end + '
+

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

+ #{@txt} +

+#{@vz.margin_num_css} +     +#{@vz.table_close}} + end + def bold_heading + @txt.gsub!(/[1-9]~\S+/,'') + @txt.gsub!(/[1-9]~/,'') + %{

+ #{@txt} +

+#{@vz.margin_num_css} +     +#{@vz.table_close}} + end + def toc_head_copy_at + %{

#{@txt}

\n} + end + def center + %{

#{@txt}

\n} + end + def bold + %{

#{@txt}

\n} + end + def center_bold + %{

#{@txt}

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

+#{@txt} +#{@two} +

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

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

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

+ #{@txt} +

+#{@vz.table_close}} + end + def navigation_toc_lev5 + end + def navigation_toc_lev6 + end + def endnote_seg_body(fn='') #FIX #url construction keep within single line... BUG WATCH 200408 + fn='doc' if fn.to_s.empty? #you may wish to reconsider, sends to 'doc' where no segment info + %{ +

+ #{@endnote_part_a}#{@md.fnl[:pre]}#{fn}#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}#{@endnote_part_b} +

+} + 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 + end + def subtoc_lev(tag,attrib) + @txt=clean(@txt) + txt=if @txt \ + and @txt =~/<\/?i>|/mi + @txt.gsub(/<\/?i>|/mi,'') #removes name markers from subtoc, go directly to substantive text + else @txt + end + note='' + if txt =~/(#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})/m # had \s* at end + note=$1 + note.gsub!(/[\n\s]+/m,' ') + txt.gsub!(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ') + txt.gsub!(/ \d+<\/sup> /m,'') + txt.gsub!(/#{Mx[:nbsp]}\d+<\/sup>#{Mx[:nbsp]}/m,'') #remove + end + %{<#{tag} class="#{attrib}"> + #{txt} #{note} + } + end + def subtoc_lev5 + subtoc_lev('h5','subtoc') if @txt + end + 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,' ') + %{ +
+ #{@p_num.ocn_display} + <#{tag} class="#{attrib}" #{@p_num.id}> #{@headname} + #{@txt} + +
+} + end + def heading4 + %{ +
+ #{@p_num.ocn_display} +

+ #{@t_o[:format]} + #{@txt} +

+
+} + end + def heading5 + heading_sub('p','bold') + end + def heading6 + heading_sub('p','bold') + end + def navigation_heading4 + %{ + +} + end + def scroll(text) + if @md.fns =~ /\.(?:-|ssm\.)?sst$/ + scroll=%{ +} + end + end + def seg(text) + %{ +} + end + def search + env=SiSU_Env::Info_env.new(@md.fns,@md) + env.widget.search_form('sisusearch',nil,nil,true) + end + def manifest + manifest_lnk=if @file.by_language? \ + or @file.by_filetype? + "#{Xx[:html_relative1]}manifest/#{@file.base_filename.manifest}" + else @file.base_filename.manifest + end + %{} + end + def pdf #retired 2.7.9 + pdf=if @md.programs[:pdf] \ + and @cf_defaults.cf_0 =~/p/ + %{ + + +} + else '' + end + end + def txt #retired 2.7.9 + txt=if @cf_defaults.cf_0 =~/[at]/ + %{ +} + else '' + end + end + def epub #retired 2.7.9 + epub=if @cf_defaults.cf_0 =~/e/ + %{ +} + else '' + end + end + def odf #retired 2.7.9 + odf=if @cf_defaults.cf_0 =~/o/ + %{ +} + 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 + %{} + else '' + end + end + end + class XML + end + class Head_toc < Head_information + def initialize(md) + super(md) + @md=md + end + def scroll_head_navigation_band + pdf=if @md.programs[:pdf] + < + #{make_seg_scroll_pdf} + +WOK + else '' + end + %{
+

+ #{@txt} +

+#{@vz.table_close}} + end + def navigation_heading5 + %{

+ #{@txt} +

} + end + def navigation_heading6 + %{

+ #{@txt} +

} + end + def navigation_center + %{

#{@txt}

} + end + end + class Format_toc < Format_text_object + def initialize(md,txt) + super(md,txt) + end + def links_guide + %{
  • + + #{@lnk_txt} + +
  • +} + end + def lev(tag,attrib) + if @txt + %{<#{tag} class="#{attrib}"> + #{@txt} + +} + else '' + end + end + def lev1 + lev('h1','toc') + end + def lev2 + lev('h2','toc') + end + def lev3 + lev('h3','toc') + end + def lev4 + lev('h4','toc') + end + def lev5 + lev('h5','toc') + end + def lev6 + lev('h6','toc') + end + def lev0 #docinfo + lev('h0','toc') + end + def mini_lev1 + lev('h1','minitoc') + end + def mini_lev2 + lev('h2','minitoc') + end + def mini_lev3 + lev('h3','minitoc') + end + def mini_lev4 + lev('h4','minitoc') + end + def mini_lev5 + lev('h5','minitoc') + end + def mini_lev6 + lev('h6','minitoc') + end + def mini_lev0 #docinfo + lev('h0','minitoc') + end + def mini_tail + %{ +

    + Manifest (alternative outputs) +

    +} + end + def mini_concord_tail + %{ +

    + Concordance (wordlist) +

    +

    + Manifest (alternative outputs) +

    +} + end + end +end +__END__ diff --git a/lib/sisu/v3/epub_segments.rb b/lib/sisu/v3/epub_segments.rb new file mode 100644 index 00000000..bd13b08b --- /dev/null +++ b/lib/sisu/v3/epub_segments.rb @@ -0,0 +1,525 @@ +# 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: 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 + 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] << format_seg.title_heading1 + filename_seg << @seg[:heading_endnotes] << @seg[:headings] << %{\n
    \n} << @seg[:endnote_all] << '
    ' + elsif @type=='idx' + @seg[:headings]=[] + format_head_seg=SiSU_EPUB_Format::Head_seg.new(@md) + @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) + @seg[:headings] << format_seg.title_heading1 + filename_seg << @seg[:heading_idx] << @seg[:headings] << %{\n
    \n} << @seg[:idx] << '
    ' + elsif @type=='metadata' + metadata=Metadata::Summary.new(@md).xhtml_display.metadata + @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) + @seg[:headings] << format_seg.title_heading1 + filename_seg << @seg[:heading_idx] << @seg[:headings] << %{\n
    \n} << metadata << '
    ' + elsif @type=='sisu_manifest' + env=SiSU_Env::Info_env.new(@md.fns) + 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 + <A list of available output types may be available at the following url:

    +

    #{url_and_name}

    +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) + @seg[:headings] << format_seg.title_heading1 + filename_seg << @seg[:heading_idx] << @seg[:headings] << %{\n
    \n} << manifest << '
    ' + else + filename_seg << @seg[:headings] << @seg[:main] << "\n\n" + end + filename_seg << @seg[:tail] << @seg[:nav] << @seg[:close] + filename_seg.flatten!.compact! + filename_seg.each do |str| + unless str =~/\A\s*\Z/ + str.strip! + @output_epub_cont_seg << str + end + end + @output_epub_cont_seg.close + end + end + end + class Seg + @@seg,@@seg_subtoc,@@seg_endnotes,@@seg_ad={},{},{},{} + @@seg_name,@@seg_name_xhtml=[],[] + @@seg_url=@@fn=@@get_hash_to=@@get_hash_fn='' + @@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[: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 + @seg_name_xhtml=@@seg_name_xhtml || nil + @seg_name_xhtml_tracker=@@tracker || nil + 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 )))) + #### (((( END )))) #### + rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error + ensure + @@seg_name=[] + end + end + protected + def articles(data) + track,tracking,newfile=0,0,0 + @@is4=@@is3=@@is2=@@is1=0 + printed_endnote_seg='n' + idx_xhtml=nil + if @md.book_idx + idx_xhtml=SiSU_Particulars::Combined_singleton.instance.get_idx_xhtml(@md).xhtml_idx + idx_xhtml.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 + @@seg_name << dob.name + seg_name=dob.name + end + end + @@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 + data.each do |dob| + #if defined? dob.obj \ + #and dob.obj =~/href="#{Xx[:segment]}#+\S+?"/ + # ##Consider: remove, reinstate earlier? + # #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"}) + # # else + # # p "NOT FOUND name_tags: #{m}" + # # dob.obj.sub!(/href="#{Xx[:segment]}#+(\S+?)"/,%{href="#\\1"}) # not satisfactory + # # end + # #end + #end + if (dob.is=='heading' or dob.is=='heading_insert') \ + and 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 + @@heading3=dob.obj + @@is4,@@is3=0,1 + end + if (dob.is=='heading' or 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') \ + 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') \ + and dob.ln==1 + head1=$_ #; check + end + end + if @@is4==1 + dir_epub_cont="#{@md.env.path.epub}/OPS" + 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 tracking != 0 + 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]}" + output_epub_cont_seg=File.new(segfilename,'w') if @@seg_name_xhtml[tracking-1] + 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' + if @@seg_name_xhtml[tracking-1]=='endnotes' + Seg_output.new(@md,output_epub_cont_seg,@@seg,@minitoc,'endnotes').output + elsif @@seg_name_xhtml[tracking-1]=='book_index' + Seg_output.new(@md,output_epub_cont_seg,@@seg,@minitoc,'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 + else puts "#{__FILE__}::#{__LINE__}" + end + else puts "#{__FILE__}::#{__LINE__}" + end + 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]}" + 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 + end + #@output_epub_cont_seg.close #%(((( EOF )))) --> + end + if tracking==0 + heading_art(dob) + head(dob) + end + 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 + markup(dob) + elsif dob.obj.class==Array + dob.obj.each do |pg| + markup(pg) + end + end + if testforartnum[tracking-1] =~/endnote/ + if printed_endnote_seg=='n' + printed_endnote_seg='y' + end + end + end + end + data + end + def heading_art(dob) + format_head_seg=SiSU_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 + 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=%{#{@md.creator.author}\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) + @@seg[:headings] << format_seg.title_heading1.gsub(clean,'') + @@heading1.gsub!(/  [\d*+]+<\/sup> <\/a>/,'') + end + if @@is2==1 + heading2=@@heading2 + ocn=if heading2[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]; $1 #fix + else '' + end + @p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,ocn) + txt_obj={:txt =>heading2,:ocn_display =>@p_num.ocn_display} + format_seg=SiSU_EPUB_Format::Format_seg.new(@md,txt_obj) + @@seg[:headings] << format_seg.title_heading2.gsub(clean,'') + @@heading2.gsub!(/  [\d*+]+<\/sup> <\/a>/,'') + end + if @@is3==1 + heading3=@@heading3 + ocn=if heading3[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]; $1 #fix + else '' + end + @p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,ocn) + txt_obj={:txt =>heading3,:ocn_display =>@p_num.ocn_display} + format_seg=SiSU_EPUB_Format::Format_seg.new(@md,txt_obj) + @@seg[:headings] << format_seg.title_heading3.gsub(clean,'') + @@heading3.gsub!(/  [\d*+]+<\/sup> <\/a>/,'') + end + if @@is4==1 + heading4=@@heading4 + ocn=if heading4[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]; $1 #fix + else '' + end + @p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,ocn) + txt_obj={:txt =>heading4,:ocn_display =>@p_num.ocn_display} + format_seg=SiSU_EPUB_Format::Format_seg.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) + 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' + if dob.ln==4 + sto.seg_heading4 # work on see Split_text_object + elsif dob.ln==5 + sto.seg_heading5 + elsif dob.ln==6; sto.seg_heading6 + end + 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 + if dob.bullet_ + sto.format('li','bullet') + else sto.para + end + end + end + elsif dob.is =~/^(?:block|group|alt)$/ + sto.para #fix this should be block type specific #FIX + elsif dob.is=='verse' + sto.verse + elsif dob.is=='code' + sto.code + elsif dob.is=='table' + sto.table + 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 + 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) + end + if (dob.is=='heading' or dob.is=='heading_insert' or dob.is=='para') \ + and dob.note_ #dob.obj =~/ \n} + @@seg[:main] << dob_xhtml + @@seg[:main] << @@seg_subtoc[@@get_hash_fn] #% insertion of sub-toc + 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] + @@seg[:tail] << %{\n
    \n
    \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| + end + @@seg[:tail] << '
    ' + @@seg[:tail] << '
    ' #this div closes div class content + end + @@seg[:close]=[] + @@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 + end + def cleanup + reinitialise + @@seg_total,@@tracker=0,0 + @@seg_endnotes,@@seg_subtoc={},{} + @@seg_endnotes_array,@@seg_subtoc_array=[],[] + @@seg[:endnote_all]=[] + end + def get_subtoc_endnotes(data) #get endnotes & sub-table of contents subtoc + data.each do |dob| + dob.obj.gsub!(/
    (.+?)<\/a>/mi,'\1') + if @md.flag_auto_endnotes + if (dob.is=='heading' or dob.is=='heading_insert') \ + and 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 + @@seg_subtoc[@@fn]=@@seg_subtoc_array + @@seg_subtoc_array=[] + if dob.name \ + and dob.obj + @@fn=dob.name + else + if dob.name =~/\S+/ + @@fn=dob.name + else @@fn='' + end + end + end + end + 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) + 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) + subtoc=format_seg.subtoc_lev6 #keep and make available, this is the subtoc + end + @@seg_subtoc_array << subtoc + end + if @md.flag_auto_endnotes + ast,pls='*','+' + if dob.obj =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})(?:\d|#{ast}|#{pls})+ / \ + and dob.is !~/^code/ # endnote- + endnote_array=[] + if dob.obj=~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/m + endnote_array << dob.obj.scan(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/m) + end + if dob.obj=~/#{Mx[:en_b_o]}#{ast}\d+\s.+?#{Mx[:en_b_c]}/m + endnote_array << dob.obj.scan(/#{Mx[:en_b_o]}#{ast}\d+\s.+?#{Mx[:en_b_c]}/m) + end + 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.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(/
    /) + try.each do |e| + txt_obj={:txt =>e} + format_seg=SiSU_EPUB_Format::Format_seg.new(@md,txt_obj) + note_match=if e =~/#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]}/ + format_seg.endnote_body_indent + else format_seg.endnote_body + end + @@seg_endnotes_array << note_match + end + try.join('
    ') + #% creation of separate end segment/page of all endnotes referenced back to reference segment + 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) + 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,' ') + end + end + end + end + end +end +__END__ diff --git a/lib/sisu/v3/epub_tune.rb b/lib/sisu/v3/epub_tune.rb new file mode 100644 index 00000000..23b0acf0 --- /dev/null +++ b/lib/sisu/v3/epub_tune.rb @@ -0,0 +1,417 @@ +# 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: 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_align_close=' + +   
    ' + @@counter,@@column,@columns=0,0,0 + class Output + def initialize(data,md) + @data,@md=data,md + @file=SiSU_Env::SiSU_file.new(@md) + @cX=SiSU_Screen::Ansi.new(@md.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 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,'*') # * + str.gsub!(/\+/u,'+') # + + str.gsub!(/¢/u,'¢') # ¢ + str.gsub!(/£/u,'£') # £ + str.gsub!(/¥/u,'¥') # ¥ + str.gsub!(/§/u,'§') # § + str.gsub!(/©/u,'©') # © + str.gsub!(/ª/u,'ª') # ª + str.gsub!(/«/u,'«') # « + str.gsub!(/®/u,'®') # ® + str.gsub!(/°/u,'°') # ° + str.gsub!(/±/u,'±') # ± + str.gsub!(/²/u,'²') # ² + str.gsub!(/³/u,'³') # ³ + str.gsub!(/µ/u,'µ') # µ + str.gsub!(/¶/u,'¶') # ¶ + str.gsub!(/¹/u,'¹') # ¹ + str.gsub!(/º/u,'º') # º + str.gsub!(/»/u,'»') # » + str.gsub!(/¼/u,'¼') # ¼ + str.gsub!(/½/u,'½') # ½ + str.gsub!(/¾/u,'¾') # ¾ + str.gsub!(/×/u,'×') # × + str.gsub!(/÷/u,'÷') # ÷ + str.gsub!(/¿/u,'¿') # ¿ + str.gsub!(/À/u,'À') # À + str.gsub!(/Á/u,'Á') # Á + str.gsub!(/Â/u,'Â') # Â + str.gsub!(/Ã/u,'Ã') # Ã + str.gsub!(/Ä/u,'Ä') # Ä + str.gsub!(/Å/u,'Å') # Å + str.gsub!(/Æ/u,'Æ') # Æ + str.gsub!(/Ç/u,'Ç') # Ç + str.gsub!(/È/u,'È') # È + str.gsub!(/É/u,'É') # É + str.gsub!(/Ê/u,'Ê') # Ê + str.gsub!(/Ë/u,'Ë') # Ë + str.gsub!(/Ì/u,'Ì') # Ì + str.gsub!(/Í/u,'Í') # Í + str.gsub!(/Î/u,'Î') # Î + str.gsub!(/Ï/u,'Ï') # Ï + str.gsub!(/Ð/u,'Ð') # Ð + str.gsub!(/Ñ/u,'Ñ') # Ñ + str.gsub!(/Ò/u,'Ò') # Ò + str.gsub!(/Ó/u,'Ó') # Ó + str.gsub!(/Ô/u,'Ô') # Ô + str.gsub!(/Õ/u,'Õ') # Õ + str.gsub!(/Ö/u,'Ö') # Ö + str.gsub!(/Ø/u,'Ø') # Ø + str.gsub!(/Ù/u,'Ù') # Ù + str.gsub!(/Ú/u,'Ú') # Ú + str.gsub!(/Û/u,'Û') # Û + str.gsub!(/Ü/u,'Ü') # Ü + str.gsub!(/Ý/u,'Ý') # Ý + str.gsub!(/Þ/u,'Þ') # Þ + str.gsub!(/ß/u,'ß') # ß + str.gsub!(/à/u,'à') # à + str.gsub!(/á/u,'á') # á + str.gsub!(/â/u,'â') # â + str.gsub!(/ã/u,'ã') # ã + str.gsub!(/ä/u,'ä') # ä + str.gsub!(/å/u,'å') # å + str.gsub!(/æ/u,'æ') # æ + str.gsub!(/ç/u,'ç') # ç + str.gsub!(/è/u,'è') # è + str.gsub!(/é/u,'é') # é + str.gsub!(/ê/u,'ê') # ê + str.gsub!(/ë/u,'ë') # ë + str.gsub!(/ì/u,'ì') # ì + str.gsub!(/í/u,'í') # í + str.gsub!(/î/u,'î') # î + str.gsub!(/ï/u,'ï') # ï + str.gsub!(/ð/u,'ð') # ð + str.gsub!(/ñ/u,'ñ') # ñ + str.gsub!(/ò/u,'ò') # ò + str.gsub!(/ó/u,'ó') # ó + str.gsub!(/ô/u,'ô') # ô + str.gsub!(/õ/u,'õ') # õ + str.gsub!(/ö/u,'ö') # ö + str.gsub!(/ø/u,'ø') # ø + str.gsub!(/ù/u,'ù') # ú + str.gsub!(/ú/u,'ú') # û + str.gsub!(/û/u,'û') # ü + str.gsub!(/ü/u,'ü') # ý + str.gsub!(/þ/u,'þ') # þ + str.gsub!(/ÿ/u,'ÿ') # ÿ + str.gsub!(/ý/u,'ý') + str.gsub!(/
    /u,'
    ') + str.gsub(/#{Mx[:nbsp]}/u,' ') + str + 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. ') #fix Mx[:lv_o] + @tuned_file << dob + end + end + def markup + @tuned_file=[] + @data.each do |dob| + dob.obj.gsub!(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;') + dob.obj.gsub!(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;') + dob.obj.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'
    ') unless dob.is=='table' + dob.obj.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\1') + dob.obj.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\1') + dob.obj.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\1') + dob.obj.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'\1') + dob.obj.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'\1') + dob.obj.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'\1') + dob.obj.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'\1') + dob.obj.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'\1') + dob.obj.gsub!(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'\1') # tt, kbd + dob.obj.gsub!(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'') + dob.obj.gsub!(/^#{Mx[:gl_bullet]}/m,'●  ') + dob.obj.gsub!(/#{Mx[:nbsp]}/,' ') + dob.obj.gsub!(/<(p|br)>/,'<\1 />') + dob=SiSU_EPUB_Tune::Clean_xhtml.new(dob).clean + @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=%{

    #{c}

    } if c + png=m.scan(/\S+/)[0] + image_path='./image' + ins=if u \ + and u.strip !~/^image$/ + %{
    #{caption}} + else %{#{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=%{#{link}} + word.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,ins) + word.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/,ins) + 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+!>/, + %{\\1}) + end + if dob.obj =~/<:image\s+/ + dob.obj.gsub!(/<:image\s+(http\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+>/, + %{}) + dob.obj.gsub!(/<:image\s+(http\S+)\s+(\S+)\s+>/, + %{}) + dob.obj.gsub!(/<:image\s+(\S+)\s+(\S+)\s+(\S+)\s+>/, + %{}) + dob.obj.gsub!(/<:image\s+(\S+)\s+>/, + %{}) + 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,%{©}) + if (dob.obj !~/\<:ad\s+\.\.\//) + dob.obj.gsub!(/\<:ad\s+(\S+)?\s+(\S+\.png)\s+(.+)?\;\s+(.+)?\;\s*!\>/, + %{\n
    \\3
    \n}) + else + dob.obj.gsub!(/\<:ad\s+(\S+)?\s+(\S+\.png)\s+(.+)?\;\s+(.+)?\;\s*\>/, + %{\n
    \\3
    \n}) + end + dob.obj.gsub!(/!pick/,%{stellar}) + dob.obj.gsub!(/!new/,%{ new}) + dob.obj.gsub!(/<:h(.{1,7}?)>/,'\1') + dob.obj.gsub!(/<:to(\d{1,7}?)>/,'to { \1 } ') + if dob.obj =~/\b\S+\@\S+?\.\S+/ \ + and dob.obj !~/(\"\S+\@\S+?\.\S+\"|>\S+\@\S+?\.\S+?<)/ + dob.obj.gsub!(/([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)/,'<\1>') + end + dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1') #http ftp matches escaped, no decoration + dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) #http ftp matches with decoration + if dob.obj =~/..\/\S+/ \ + and dob.obj !~/(\"..\/\S+?\"|>\s*..\/\S+<)/ + dob.obj.gsub!(/(\.\.\/\S+)/,'\1') + end + dob.obj.gsub!(//m,'\1>') #code-block: angle brackets special characters + dob.obj.gsub!(/(^|[^}])_/m,'\1>') + end + @tuned_file << dob + end + end + def amp_html + data=@data + data.each do |dob| + dob.obj.gsub!(/&/u,'&') + end + data + end + def endnotes_html + data=@data + @tuned_file=[] + a,s='_a','_s' + ast,pls='*','+' + data.each do |dob| + unless dob.is =~/^code/ + dob.obj.gsub!(/(#{Mx[:en_a_o]}|#{Mx[:en_b_o]})(\d+)\s+(.+?)(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/, + %{#{Mx[:nbsp]}#{Mx[:nbsp]}\\2#{Mx[:nbsp]} } + #note- endnote- + %{\\1\\2 #{Mx[:nbsp]}\\2. \\3 \\4}) #endnote- note- (careful may have switched) + dob.obj.gsub!(/(#{Mx[:en_b_o]})[*](\d+)\s+(.+?)(#{Mx[:en_b_c]})/, + %{#{Mx[:nbsp]}#{Mx[:nbsp]}#{ast}\\2#{Mx[:nbsp]} } + #note- endnote- + %{\\1#{ast}\\2 #{Mx[:nbsp]}#{ast}\\2. \\3 \\4}) #endnote- note- (careful may have switched) + dob.obj.gsub!(/(#{Mx[:en_b_o]})[+](\d+)\s+(.+?)(#{Mx[:en_b_c]})/, + %{#{Mx[:nbsp]}#{Mx[:nbsp]}#{pls}\\2#{Mx[:nbsp]} } + #note- endnote- + %{\\1#{pls}\\2 #{Mx[:nbsp]}#{pls}\\2. \\3 \\4}) #endnote- note- (careful may have switched) # double-check there may here be a bug + if dob.obj =~/#{Mx[:en_a_o]}([*+]+)\s+.+?#{Mx[:en_a_c]}/ + m=$1.length.to_i + dob.obj.gsub!(/(#{Mx[:en_a_o]})[*]+\s+(.+?)(#{Mx[:en_a_c]})/, + %{#{Mx[:nbsp]}#{Mx[:nbsp]}#{ast*m}#{Mx[:nbsp]} } + #note- endnote- + %{\\1#{ast*m} #{Mx[:nbsp]}#{ast*m} \\2 \\3}) #endnote- note- (careful may have switched) + dob.obj.gsub!(/(#{Mx[:en_a_o]})([+]+)\s+(.+?)(#{Mx[:en_a_c]})/, + %{#{Mx[:nbsp]}#{Mx[:nbsp]}#{pls*m}#{Mx[:nbsp]} } + #note- endnote- + %{\\1#{pls*m} #{Mx[:nbsp]}#{pls*m} \\2 \\3}) #endnote- note- (careful may have switched) + 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" if (@md.fns =~/\.sst0/) #remove + @tuned_file + end + end +end +__END__ diff --git a/lib/sisu/v3/errors.rb b/lib/sisu/v3/errors.rb new file mode 100644 index 00000000..d761e1db --- /dev/null +++ b/lib/sisu/v3/errors.rb @@ -0,0 +1,81 @@ +# 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: system environment, error screen reporting + +=end +module SiSU_Errors + require "#{SiSU_lib}/sysenv" # sysenv.rb + include SiSU_Env; include SiSU_Screen + class Info_error . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: 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 + @md=SiSU_Param::Parameters.new(@opt).get + @file=SiSU_Env::SiSU_file.new(@md) + l=SiSU_Env::Standardise_language.new.file_to_language(@opt.fns) + unless @md.i18n[0]==l[:c] + p "using: #{@md.i18n[0]} (@make: :language:); filename #{@md.fns} filename language: #{l[:c]}, mismatch" + end + if @env.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 + #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.f_pth[:lng]) ? (@md.opt.f_pth[:lng]) : (@md.i18n[0]) + @git_path={ + :fnb=> git_path_fnb, + :src=> git_path_fnb + '/' + Gt[:src] + '/' + lng, + :po=> git_path_fnb + '/' + Gt[:po] + '/' + lng, + :pot=> git_path_fnb + '/' + Gt[:pot], + :conf=> git_path_fnb + '/' + Gt[:conf], + :skin=> git_path_fnb + '/' + Gt[:skin], + :image=>git_path_fnb + '/' + Gt[:image], + :audio=>git_path_fnb + '/' + Gt[:audio], + :video=>git_path_fnb + '/' + Gt[:video], + :conf=> git_path_fnb + '/' + 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 + 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[:po]) unless FileTest.directory?(@git_path[:po]) + mkdir_p(@git_path[:pot]) unless FileTest.directory?(@git_path[:pot]) + mkdir_p(@git_path[:conf]) unless FileTest.directory?(@git_path[:conf]) + mkdir_p(@git_path[:skin]) unless FileTest.directory?(@git_path[:skin]) + mkdir_p(@git_path[:image]) unless FileTest.directory?(@git_path[:image]) + #mkdir_p(@git_path[:audio]) unless FileTest.directory?(@git_path[:audio]) + #mkdir_p(@git_path[:video]) unless FileTest.directory?(@git_path[:video]) + 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.f_pth[:lng] + cp_r("#{@env.path.pwd}/#{@opt.f_pth[:lng]}/#{@opt.fns}",@git_path[:src]) + elsif @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| + if @opt.f_pth[:lng] + cp_r("#{@env.path.pwd}/#{@opt.f_pth[:lng]}/#{f}",@git_path[:src]) + else + cp_r("#{@env.path.pwd}/#{f}",@git_path[:src]) + 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.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 sisuyaml_rc + sisurc=@env.path.sisurc_path + if FileTest.file?(sisurc) + 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 + populate.extract_skin + #parse_file_name=locate_parse_file + #parse_file=IO.readlines(parse_file_name,'') + populate.sisuyaml_rc #(parse_file) + 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__ +@file.output_path.sisugit diff --git a/lib/sisu/v3/harvest.rb b/lib/sisu/v3/harvest.rb new file mode 100644 index 00000000..2a01910e --- /dev/null +++ b/lib/sisu/v3/harvest.rb @@ -0,0 +1,101 @@ +# 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: system environment, resource control and configuration details + +=end +def help + puts <. + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: 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.sisu_yaml.rc + @alph=%W[9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z] + @letter=@alph.shift + @vz=SiSU_Env::Get_init.instance.skin + 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 + < + + +SiSU Metadata Harvest - Authors + + + + + + + + + + + + +

    SiSU Metadata Harvest - Authors

    +

    [ HOME ] also see SiSU Metadata Harvest - Topics

    +

    #{@env.widget_static.search_form}

    +
    +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 << '

    ' + @alph.each do |x| + a << ((x =~/[0-9]/) ? '' : %{#{x}, }) + end + @output[:html_mnt] << a.join if @output[:html_mnt].class==File + @output[:html] << a.join + end + def html_tail + a=[] + a <<< + + + + + + +#{@vz.credits_sisu} + + +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=%{

    #{string}

    } + 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

    #{@letter}

    } + end + @output[:html] << %{\n

    #{@letter}

    } + 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 = %{

    #{a[0]}

    } + 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]}", %{

    #{x[:date]} #{x[:title]}, #{x[:author][:authors_s]}

    } ] + works<<=(@output[:html_mnt].class==File) \ + ? (work.concat([%{

    [src]  #{x[:date]} #{x[:title]}, #{x[:author][:authors_s]} -- [#{x[:file]}.sst]

    }])) \ + : 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/v3/harvest_topics.rb b/lib/sisu/v3/harvest_topics.rb new file mode 100644 index 00000000..948965dd --- /dev/null +++ b/lib/sisu/v3/harvest_topics.rb @@ -0,0 +1,559 @@ +# 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: 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 += %{#{n}, } + 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.sisu_yaml.rc + @alph=%W[9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z] + @letter=@alph.shift + @vz=SiSU_Env::Get_init.instance.skin + 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 + < + + +SiSU Metadata Harvest - Topics + + + + + + + + + + + + +

    SiSU Metadata Harvest - Topics

    +

    [ HOME ] also see SiSU Metadata Harvest - Authors

    +

    #{@env.widget_static.search_form}

    +
    +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 << '

    ' + @alph.each do |x| + a << (x =~/[0-9]/) \ + ? '' \ + : %{#{x}, } + end + @output[:html_mnt] << a if @opt.cmd.inspect =~/M/ + @output[:html] << a.join + end + def html_tail + a=[] + a <<< + + + + + + +#{@vz.credits_sisu} + + +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=%{

    #{string}

    } + do_html(html) + do_html_maintenance(html) if @output[:html_mnt].class==File + end + def do_string_default(attrib,string) + html=%{

    #{string}

    } + do_html(html) + end + def do_string_maintenance(attrib,string) + html=%{

    #{string}

    } + 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

    #{@letter}

    } + end + @output[:html] << %{\n

    #{@letter}

    } + else break + end + end + end + name=string.strip.gsub(/\s+/,'_') + html=%{

    #{string}

    } + 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=%{#{hash[:title]} - #{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=%{[src]  #{hash[:title]} - #{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/v3/help.rb b/lib/sisu/v3/help.rb new file mode 100644 index 00000000..b23d8066 --- /dev/null +++ b/lib/sisu/v3/help.rb @@ -0,0 +1,1924 @@ +# 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: interactive infomation/help + +=end +module SiSU_Help + require "#{SiSU_lib}/sysenv" # sysenv.rb + include SiSU_Screen + require "#{SiSU_lib}/param" # param.rb + class Help + 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 + fns='help_example_dummy_file_name.sst' + @env=SiSU_Env::Info_env.new(fns) + @db=SiSU_Env::Info_db.new + m=/.+\/(?:src\/)?(\S+)/im # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m + @output_stub=Dir.pwd[m,1] + end + def help_request + begin + gotten=nil + regx=/^(list|com(?:mands)?|mod(?:ifiers)|markup|syntax|example(?:_v1|_v2)?|head(?:ers?)?|(?:heading|title|level|structure)s?|endnotes|footnotes|tables?|customise|skin|dir(?:ectories)?|paths?|lang(?:uage)?|modules|setup|conf(?:ig(?:ure)?)?|standards?|li[cs]en[sc]e|scratch|install|termsheet|dublin(?:core)?|dc|customise|styles?|appearance|theme|env(ironment)?|dir(?:ector(?:y|ies))?|metaverse|abstract|features|summary|(?:short)?cuts?|sisu|about|ext(?:ernal)?(?:_?prog(?:rams)?)?)|utf-?8|plaintext|html|xml|xhtml|epub|odf|odt|opendocument|css|pdf|latex|tex|(?:tex)?info|search|(?:hyper)?est(?:raier)?|searchform|cgi|sql|db|pg|postgresql|pg?sql|sqlite|convert|php|webrick|sitemaps?|ya?ml|ansi|colors|-[AabcDdEeFHhIMmNnopqrRSstUuVvwXxyZz0-9]|-[Ddcv]|-[CcFLSVvW]/ + help_info=%{#{@cX.blue_hi}SiSU help#{@cX.off} #{@cX.ruby}~#{@cX.off} #{@request}} + help_list=%{#{@cX.blue}sisu --help#{@cX.off} #{@cX.cyan}type keyword else "enter" to exit help:\n\tkeywords include:#{@cX.off} #{@cX.brown}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#{@cX.off} \n} + help_prompt=%{#{@cX.fuschia}exit, [or carriage return to exit help] #{@cX.off}\n#{@cX.blue_hi}SiSU help#{@cX.off} #{@cX.ruby}~#{@cX.off} } + until gotten =~/exit|quit|bye|q|^\s*$/ \ + and ( @request.nil? or @request.empty? ) + @help=Help.new(@request,@color) + if @request + puts help_info + gotten=@request + @request=nil + end + case gotten + when /h((?:elp)| )|~/i + @help.summary + help_@request + when /list/; @help.summary + when /com(mands)?/; @help.commands + when /mod(ifiers)?/; @help.modifiers + when /markup|syntax/; @help.markup + when /example\b/; @help.example_v2 + when /example_v1/; @help.example_v1 + when /example(_v2)?/; @help.example_v2 + when /(?:heading|title|level)s?|structure/; @help.headings + when /head(ers?)?/; @help.headers + when /dublin(core)?|dc/; @help.dublin_core + when /(?:foot|end)notes/; @help.endnotes + when /tables?/; @help.tables + when /customise|skin/; @help.customise + when /modules/; @help.modules + when /env(ironment)?/; @help.environment + when /dir(ector(y|ies))?/; @help.directories + when /paths?/; @help.path + when /setup/; @help.setup + when /conf(?:ig(?:ure)?)?/; @help.configure + when /standards?/; @help.standards + when /lang(?:uage)?/; @help.languages + when /li[cs]en[sc]e/; @help.license + when /scratch/; @help.scratch + when /install/; @help.install + when /(?:--)?termsheet/; @help.termsheet + when /customise|styles?|appearance|theme/; @help.customise + when /metaverse/; @help.dal + when /(?:--)?plaintext|(?:--)?te?xt|-[aAeE]/; @help.plaintext + when /utf-?8/i; @help.utf8 + when /(?:--)?html|-[hH]/; @help.html + when /css/; @help.css + when /(?:--)?xhtml|-b/; @help.xhtml + when /(?:--)?xml|-[xX]/; @help.xml + when /(?:--)?odf|(?:--)?odt|opendocument|-o/; @help.odf + when /(?:--)?epub|-e/; @help.epub + when /php/; @help.php + when /(?:--)?pdf|-p/; @help.pdf + when /latex|tex/; @help.latex + when /(tex)?info/; @help.texinfo + when /lout/; @help.lout + when /concordance|index|-w/; @help.concordance + when /search\b/; @help.help_search + when /(?:hyper)?est(?:raier)?/; @help.hyperestraier + when /db|database|sql|postgresql|(?:--)?sqlite|(?:--)?pg|pg?sql|-[dD]/; @help.sql + when /searchform|cgi/; @help.cgi + when /convert/; @help.convert + when /(?:--)?webrick|-W/; @help.webrick + when /abstract|features|summary|about|sisu/; @help.abstract + when /ext(?:ernal)?(?:_?prog(?:rams)?)?/; @help.external_programs + when /ya?ml/; @help.yaml + when /sitemaps?/; @help.sitemap + when /(?:short)?cuts?/; @help.shortcuts + when /ansi|colors?/; SiSU_Screen::Ansi.new('c').colors + else @help.summary + end + print help_list + print help_prompt + gotten=nil + gotten=gets + end + rescue + #STDERR.puts Ansi.new($!, $@).rescue + # dies silently... for now, silence of use in connection with "sisu ~ commands" etc. + ensure + end + end + def summary + print < + ------------------------------------------ + #{@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} + #{@cX.green}{#{@cX.off}filename.ssi#{@cX.green}}require#{@cX.off} + #{@cX.green}<< {#{@cX.off}filename.ssi#{@cX.green}}#{@cX.off} + + #{@cX.cyan}#using textlink alternatives#{@cX.off} + #{@cX.green}|#{@cX.off}filename.ssi#{@cX.green}|@|^|require#{@cX.off} + #{@cX.green}<< |#{@cX.off}filename.ssi#{@cX.green}|@|^|#{@cX.off} + + #{@cX.cyan}#using thlnk alternatives#{@cX.off} + #{@cX.green}require#{@cX.off} + #{@cX.green}<< #{@cX.off} + + #{@cX.cyan}Composite documents - remote parts#{@cX.off} + Composite documents may be built from remote parts, by using the composite document syntax with a url. This makes sense using either sisu regular syntax (which is just a convenient way of marking up), or thlnk syntax, which also recognises remote urls, and permits hyperlinking ascii to the url location. + + #{@cX.cyan}Remote documents#{@cX.off} + SiSU will download and process remote locations if a url is provided instead of a filename. [this at present works only for sisu markup files without images] + + ------------------------------------------ + #{@cX.green}%#{@cX.off}#{@cX.off} add a comment to text, that will be removed prior to processing (place marker at beginning of line) + #{@cX.green}\\#{@cX.off}#{@cX.off} escape a sepcial character, whether general: { } < > or contextual special characters, (in combination with other characters) ~ - _ / % ^ and occasionally ! # + , + #{@cX.green}%%#{@cX.off}#{@cX.off} same as above but recognised by vim folds for placing fold in document text, in addition to headers and headings + ------------------------------------------ + + #{@cX.ruby}More HELP on Markup#{@cX.off} markup help is available on: + document wide instructions: headers (document structure) + 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 + help_markup +# {../_sisu/image/tux.png http://www.jus.uio.no/sisu/ w=64 c=\"a better way\" }:image depreciated image eg +# old form + end + def example + help_markup + end + def example_v1 + print <. + + If you have Internet connection, the latest version of the GPL should be + 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, + * Standard SiSU meta-markup syntax, and the + * 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}> + + * Download: + <#{@cX.blue}http://www.jus.uio.no/sisu/SiSU/download.html#{@cX.off}> + + Ralph Amissah + <#{@cX.blue}ralph@amissah.com#{@cX.off}> + <#{@cX.blue}ralph.amissah@gmail.com#{@cX.off}> + +WOK + end + def standards + print <to bold to indent for superscript for subscript text + +_1 at the beginning of a line indents the paragraph + +_2 at the beginning of a line double indents the paragraph + +Others include + +Other things to note: + +By default paragraphs are automatically numbered... and is the same across all output formats +This makes citation a lot easier... regardless of the form of output that is being looked at +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 + end + end +end +__END__ + diff --git a/lib/sisu/v3/html.rb b/lib/sisu/v3/html.rb new file mode 100644 index 00000000..ebfd15bf --- /dev/null +++ b/lib/sisu/v3/html.rb @@ -0,0 +1,654 @@ +# 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: html generation, processing + +=end +module SiSU_HTML + require 'pstore' + require "#{SiSU_lib}/particulars" # particulars.rb + include SiSU_Particulars + require "#{SiSU_lib}/defaults" # defaults.rb + include SiSU_Viz + require "#{SiSU_lib}/html_table" # html_table.rb + require "#{SiSU_lib}/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 + include SiSU_HTML_Tune + 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.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 + @opt.cmd=~/[MVvz]/ \ + ? 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]/ + end + SiSU_Env::Info_skin.new(@md).select + data=nil + @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 + data=@tuned_file_array + scr_toc=SiSU_HTML::Source::Scroll_head_and_segtoc.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 + SiSU_HTML::Source::Output.new(scroll,@md).scroll + 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::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){[]} + @@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 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 + title=File.basename(@md.fns,'.rb') + 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_HTML_Tune::Tune.new(dal_array,@md).songsheet + @tuned_file_array + end + end + class Links_guide + @links_guide_toc=[] + def initialize(data,md) + @data,@md=data,md + @links_guide_=SiSU_Env::Create_site.new(@md.cmd).html_quick_ref? + end + def toc + @links_guide_toc=[] + if @links_guide_ + format_head_toc=SiSU_HTML_Format::Head_toc.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 + 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) + @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) + @links_guide_toc << format_head_toc.links_guide_close #(guide_type) + @links_guide_toc + else '' + end + end + end + class Endnotes + include SiSU_HTML_Format + def initialize(data,md) + @data,@md=data,md + end + def scroll + @scr_endnotes=[] + format_head_scroll=SiSU_HTML_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_HTML_Format::Format_scroll.new(@md,txt_obj) + @scr_endnotes << format_scroll.endnote_body + end + end + end + end + @scr_endnotes + end + end + class Toc [],: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 + 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=>[] } + @data.each do |dob| + if dob.is=='heading' \ + or dob.is=='heading_insert' + dob_toc=dob.dup + toc=if dob_toc.is =='heading' \ + or 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 + else nil + end + end + toc.each do |k,d| + d.gsub!(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ') + end if toc + if @@firstseg.nil? \ + and dob.ln==4 \ + and dob.name =~/\S+/ + @@firstseg=dob.name + end + if toc + begin + @@toc[:seg] << toc[:seg] if toc[:seg] + @@toc[:seg_mini] << toc[:seg_mini] if toc[:seg_mini] + @@toc[:scr] << toc[:scr] if toc[:scr] + rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error + end + end + end + end + @md.firstseg=@@firstseg + @@toc + end + def minitoc + minitoc=@@toc[:seg_mini].join("\n") + '
    ' + minitoc + '
    ' + end + protected + def rss #sort all wrong, disabled but kept + @@toc[:seg] <<< +
    +

    +(relatively static) RSS feeds for DOCUMENTS:
    +RSS feed http://www.jus.uio.no/lm/rssfeed/documents.xml
    +RSS feed http://www.jus.uio.no/lm/rssfeed/tradelaw.xml
    +RSS feed http://www.jus.uio.no/lm/rssfeed/environmental.xml
    +

    info@address.com
    +

    +
    +WOK + end +#not used --> + def level_endnotes + if @md.flag_endnotes + format_head_scroll=SiSU_HTML_Format::Head_scroll.new(@md) + @@toc[:scr] << format_head_scroll.toc_endnote + end + end + def level_concordance + format_head_toc=SiSU_HTML_Format::Head_toc.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) + @@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) + @@toc[:scr] << format_head_toc.concordance + @@toc[:seg] << format_head_toc.concordance + @@toc[:seg_mini] << format_head_toc.mini_concordance + end +# <-- not used + def level_1 + dob=@data + 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) + end + title=if dob.obj !~/Metadata/; linkname + else + link='metadata' + %{#{linkname}} + end + toc={} + txt_obj={:txt =>title} + format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) + toc[:seg]=if dob.name =~/^meta/ \ + and dob.obj =~/Document Information/ + format_toc.lev0 + else format_toc.lev1 + end + toc[:seg_mini]=if dob.name =~/^meta/ \ + and dob.obj =~/Document Information/ + 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/ + %{#{linkname}} + else linkname + end + else + @@toc[:scr] << '
    ' + link=if dob.ln; dob.ln + else '' + end + %{#{linkname}} + end + txt_obj={:txt =>title} + format_toc=SiSU_HTML_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 + p_num=if ocn \ + and ocn !~/#/ + SiSU_HTML_Format::Paragraph_number.new(@md,ocn) + else nil + end + txt_obj={:txt =>linkname} + format_toc=SiSU_HTML_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}} + txt_obj={:txt =>title} + format_toc=SiSU_HTML_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 + p_num=if ocn \ + and ocn !~/#/ + SiSU_HTML_Format::Paragraph_number.new(@md,ocn) + else nil + end + txt_obj={:txt =>linkname} + format_toc=SiSU_HTML_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}} + txt_obj={:txt =>title} + format_toc=SiSU_HTML_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_HTML_Format::Paragraph_number.new(@md,ocn) if ocn + if dob.ln ==4 + seg_link=%{ + #{dob.obj} + } + @@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+)(.*)/, + %{\\1 \\2 }) + end + p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) if ocn + @file=SiSU_Env::SiSU_file.new(@md) if @md + txt_obj=if seg_link=~/sisu_manifest\.html/ + man_link=if @file.by_language? \ + or @file.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::Format_toc.new(@md,txt_obj) + toc={} + toc[:seg]=format_toc.lev4 + toc[:seg_mini]=format_toc.mini_lev4 + title=%{#{p_num.goto}#{linkname}} if p_num + txt_obj=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::Format_toc.new(@md,txt_obj) + toc[:scr]=format_toc.lev4 + toc + #end + end + def level_5 + dob=@data + linkname,ocn=dob.obj.strip,dob.ocn + toc={} + if ocn \ + and ocn !~/#/ + p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) + lnk_n_txt=%{ + #{linkname} + } + txt_obj={:txt =>lnk_n_txt} + format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) + toc[:seg]=format_toc.lev5 + toc[:seg_mini]=format_toc.mini_lev5 + title=%{#{p_num.goto}#{linkname}} + txt_obj={:txt =>title} + format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) + 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_HTML_Format::Paragraph_number.new(@md,ocn) + lnk_n_txt=%{ + #{linkname} +} + txt_obj={:txt =>lnk_n_txt} + format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) + toc[:seg]=format_toc.lev6 + toc[:seg_mini]=format_toc.mini_lev6 + title=%{#{p_num.goto}#{linkname}} + txt_obj={:txt =>title} + format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) + toc[:scr]=format_toc.lev6 + end + toc + end + def level_crosslink + dob=@data + if dob !~/^4~!/ + dob.gsub!(/^4~!\s+(\S+)\s+(.+)/, + %{ +
    + #{@png.crosslink_ext} +   \\2 + <\/a> +
    +}) + else + dob.gsub!(/^4~!\s+(\S+)\s+(.+)/, + %{
    + + + #{@png.crosslink} +   \\2 + <\/a> +
    +}) + end + end + end + class Scroll_head_and_segtoc < Toc + 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_HTML_Format::Head_toc.new(@md) + dochead=format_head_toc.head + 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 defined? @md.rights.all + rights=format_head_toc.rights.all + rights=SiSU_HTML_Tune::Clean_html.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 + 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(/(\*+)/,'\1') + tmp_head=doc_title_endnote + "\n" + txt_obj={:txt =>tmp_head} + format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,txt_obj) + toc_shared << format_txt_obj.center_bold + @segtoc << format_txt_obj.center_bold + if defined? @md.creator.author + creator_endnote=@md.creator.author.gsub(/(\*+)/,%{ \\1}) + tmp_head=creator_endnote + "\n" + txt_obj={:txt =>tmp_head} + format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,txt_obj) + toc_shared << format_txt_obj.center_bold + @segtoc << format_txt_obj.center_bold + end + toc_shared << "#{@vz.table_close*1}\n" + @segtoc << "#{@vz.table_close*1}\n" + tmp_head=nil + if @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 + 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 not @md.rights.all.empty? + @segtoc << rights + end + @segtoc << prefix_b if @md.prefix_b + #Segtoc tail added here + @segtoc << "

    \n" #bugfix sort later DEBUGNOW + @segtoc << @seg_toc_band_bottom + 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=[] + @toc[:scr],@toc[:seg]=[],[] + toc_shared + end + end + class Table < SiSU_HTML_table::Table_html + end + class Scroll < SiSU_HTML_scroll::Scroll + end + class Scroll_output + 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='

    ' + scroll << @scr_toc << '
    ' << hr << @scr_body << @scr_endnotes << hr << @scr_owner_details << '
    ' << @scr_tails + scroll.flatten!.compact! + end + end + class Seg < SiSU_HTML_seg::Seg + end + class Output + def initialize(data='',md='') + @data,@md=data,md + @file=SiSU_Env::SiSU_file.new(@md) + end + def scroll + begin + @filename_html_scroll=@file.write_file.html_scroll + @data.each do |para| + para.strip! + para.gsub!(/<:.+?>/,'') + para.gsub!(Xx[:html_relative2],@file.path_rel_links.html_scroll_2) + para.gsub!(Xx[:html_relative1],@file.path_rel_links.html_scroll_1) + #para.gsub!(/#{Xx[:html_relative]}/,@file.path_rel_links.html_scroll) + para.gsub!(/#{Rx[:mx_fa_clean]}/,'') + unless para =~/\A\s*\Z/ + @filename_html_scroll.puts para,"\n" + end + end + rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error + end + end + def segtoc + begin + @filename_html_segtoc=@file.write_file.html_segtoc + @filename_html_index=@file.write_file.html_seg_index + @data.each do |para| + para.strip! + para.gsub!(//,'') + para.gsub!(Xx[:html_relative2],@file.path_rel_links.html_seg_2) + para.gsub!(Xx[:html_relative1],@file.path_rel_links.html_seg_1) + 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 + end + end + end + end +end +__END__ diff --git a/lib/sisu/v3/html_format.rb b/lib/sisu/v3/html_format.rb new file mode 100644 index 00000000..0a5e6e45 --- /dev/null +++ b/lib/sisu/v3/html_format.rb @@ -0,0 +1,1480 @@ +# 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: html formating, css template + +=end +module SiSU_HTML_Format + include SiSU_Viz + class Paragraph_number + 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+|)$/, + %{}) + elsif @ocn.to_i==0 + @ocn.gsub(/^(\d+|)$/, + %{}) + else + ocn_class='ocn' + @ocn.gsub(/^(\d+|)$/, + %{}) + end + end + def name + %{} + end + def id #w3c? "tidy" complains about numbers as identifiers ! annoying + %{id="o#{@ocn}"} + end + def goto + %{} + end + end + class Head_information + require "#{SiSU_lib}/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) + @seg_name_html=(SiSU_HTML::Source::Seg.new.seg_name_html || []) + @seg_name_html_tracker=(SiSU_HTML::Source::Seg.new.seg_name_html_tracker || []) + @toc,@index='toc','index' + @metalink='#metadata' + @tocband_scroll,@tocband_segtoc=nil,nil + end + def doc_types #used in toc & seg_nav_band + scroll=seg='' + wgt=Widget.new(@md) + %{ + + +
    + #{wgt.manifest} + #{wgt.search} +
    } + end + def rdf + SiSU_XML_tags::RDF.new(md) + end + def doc_type + %{ +\n} + end + def table_close + %{ +#{@vz.table_close}} + end + def buttons_home + %{ + #{@vz.banner_home_and_index_buttons} +} + end + def copyat + %{#{@vz.paragraph_font_tiny}copy @ +
    + #{@vz.txt_home} + } + end + def html_close #moved + %{ +} + end + end + class Widget < Head_information + def initialize(md) + super(md) + @md=md + @cf_defaults=SiSU_Env::Info_processing_flag.new + @env=SiSU_Env::Info_env.new(@md.fns) + @file=SiSU_Env::SiSU_file.new(@md) + end + def home + %{
    + + #{@vz.nav_txt_homepage} + + + #{text} + + + + #{text} + + + + #{@vz.nav_txt_manifest} + + + + #{@vz.nav_txt_pdf_portrait} + + + + #{@vz.nav_txt_pdf_landscape} + + + + #{@vz.nav_txt_plaintext} + + + + #{@vz.nav_txt_epub} + + + + #{@vz.nav_txt_odf} + + + + #{text} + +
    +#{pdf} +
    + #{@vz.banner_band} + +   +#{@vz.table_close} +

    } + end + def concordance_navigation_band(type='') + %{ + +
    + #{@vz.banner_band} + +   + #{@vz.png_nav_toc} +   +#{@vz.table_close} +

    } + end + def seg_head_navigation_band(type='') + firstseg=%{ + #{@vz.png_nav_nxt} + } if @md.firstseg =~/\S+/ + %{ + + + +} + %{
    + #{@vz.banner_band} + + #{doc_types} + +  #{firstseg}  +#{@vz.table_close} +

    } + end + def seg_head_navigation_band_bottom(type='') #retired 2.7.9 + if type=~/pdf/ + @tocband_segtoc=make_scroll_seg_pdf + end + firstseg=%{ + #{@vz.png_nav_nxt} + } if @md.firstseg =~/\S+/ + %{ + + + +} + %{
    +   + + #{@tocband_segtoc} + +  #{firstseg}  +#{@vz.table_close} +

    } + end + def manifest_link(text) +# @file=SiSU_Env::SiSU_file.new(@md) if @md + %{ + #{text} + } + end + def concordance_link(text) + if @md.concord_make + %{ + + #{text} + + } + else '' + end + end + def make_seg_scroll_pdf + wgt=Widget.new(@md) + scroll=%{

    + #{@vz.nav_txt_doc_link} +
    + + #{wgt.manifest} + #{wgt.search} +
    } + end + def make_scroll_seg_pdf + manifest=scroll=seg='' + wgt=Widget.new(@md) + seg=%{

    + #{@vz.nav_txt_toc_link} +
    + +
    + #{wgt.manifest} + #{wgt.search} +
    } + end + def make_concordance + manifest=scroll=seg='' + wgt=Widget.new(@md) + %{ + +
    + #{wgt.manifest} + #{wgt.search} +
    } + end + def head + rdf=SiSU_XML_tags::RDF.new(@md) + %{#{doc_type} + + + #{@md.html_title} + + +#{rdf.metatag_html} +#{@css.html}#{@css.html_seg} + +#{@vz.color_body} + + + +#{@vz.js_top}} + end + def concordance + if @md.concord_make + %{#{@vz.margin_css} +

    + + Concordance + +

    +#{@vz.table_close}} + else + %{#{@vz.margin_css} +#{@vz.table_close}} + end + end + def links_guide_vertical_open +# @file=SiSU_Env::SiSU_file.new(@md) if @md + url=((defined? @vz.url_hp) && @vz.url_hp =~/^https?:\/\/\S+$/ ? @vz.url_hp : @vz.url_home) + %{ +